Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
827bc6c
Create basic list modal
IzaakPrats Feb 1, 2025
e7caeea
setup list item modal to have buy now and auction. implement list ite…
IzaakPrats Feb 1, 2025
f56b550
Add state for already listed. Add success state to modal
IzaakPrats Feb 1, 2025
53dbed5
Add untradable state in modal
IzaakPrats Feb 2, 2025
c96f133
Make list an item modal done button not rounded
IzaakPrats Feb 2, 2025
ec3d939
Optimize price fetching and list item modal. Add ui validation for in…
IzaakPrats Feb 2, 2025
cfe5cf6
Fetch prices from price-list and cache results.
IzaakPrats Feb 4, 2025
f933d0d
Hide list on csfloat button if asset is not tradable
IzaakPrats Feb 4, 2025
d433d2f
Remove unused vars in list_item_modal
IzaakPrats Feb 4, 2025
c0c62b6
Can never be too punctual
IzaakPrats Feb 4, 2025
965b9e9
Centralize price update logic and add validation for < 100000
IzaakPrats Feb 4, 2025
0a8c7c0
minor: Remove unused import
IzaakPrats Feb 4, 2025
246bab2
Update auction duration options to 1, 3, 7, 14
IzaakPrats Feb 12, 2025
c7f15da
Update rec price range to 80-120%
IzaakPrats Feb 13, 2025
37b53a7
Update font to roboto to match csfloat
IzaakPrats Feb 13, 2025
7397d09
Update title styling to include icon -- matching csfloat modals
IzaakPrats Feb 13, 2025
3add91a
Update styling to match csfloat modals closer.
IzaakPrats Feb 13, 2025
7a0d633
Fix up percentage slider to match csfloat behavior. Add subtotal + sa…
IzaakPrats Feb 13, 2025
f96a478
Make sales fee label in subtotal section dynamic
IzaakPrats Feb 13, 2025
de94c4f
Improve price input styling
IzaakPrats Feb 13, 2025
5236521
Fix issue listing non-skins. Add animations. Add confirmation step. C…
IzaakPrats Feb 14, 2025
945779b
Fix styling on auction button
IzaakPrats Feb 14, 2025
906ebc5
Clean up success modal
IzaakPrats Feb 14, 2025
13f2af4
Display price fetch error instead of allowing input. Clean up title s…
IzaakPrats Feb 14, 2025
2640286
Move styles into new file
IzaakPrats Feb 14, 2025
8718c98
Fix roboto font loading. Implement loading skeleton. Add error ux for…
IzaakPrats Feb 14, 2025
c0a5d5c
Make success done button nicer
IzaakPrats Feb 14, 2025
9518fda
Fix some code organization. Fix error cta issue with non-link ctas
IzaakPrats Feb 14, 2025
707bca1
Undo changes to background_ff.html
IzaakPrats Feb 14, 2025
3d7f986
Clean up the loading skeleton
IzaakPrats Feb 16, 2025
c99e15d
Use price-list/doppler for dopplers based on market_hash + paint_index
IzaakPrats Feb 17, 2025
c009c5e
Fix font for input and button
IzaakPrats Feb 19, 2025
81eb3ba
Allow listing fetcher to throw unauth exceptions and catch while init…
IzaakPrats Feb 19, 2025
48b17d4
Bubble up auth exceptions from list_item handler
IzaakPrats Feb 19, 2025
79c426d
Fix backdrop blur
IzaakPrats Feb 19, 2025
e637e7b
Fix scrollbar shift on modal open. Fixed position while modal is open
IzaakPrats Mar 1, 2025
768ce8d
Improve list_item.ts error handling
IzaakPrats Mar 1, 2025
c76b5dd
Fix error handling. Add cache clearing and instead of reload window, …
IzaakPrats Mar 1, 2025
02023dc
Only set custom price if no price has been set
IzaakPrats Mar 1, 2025
24a63dd
Add min price validation
IzaakPrats Mar 1, 2025
cd04a58
Price fetcher nits. Backdrop blur on modal content. Update price fetc…
IzaakPrats Mar 1, 2025
27001fe
Add USD disclosure to recommended price label
IzaakPrats Mar 4, 2025
dbfd47d
Console log error in price_fetcher
IzaakPrats Apr 13, 2025
10304fd
Fix casing in stall_fetcher.ts params
IzaakPrats Apr 13, 2025
394bfe7
Create new CSFError structure to use throughout app for error handling.
IzaakPrats Apr 13, 2025
cb5f228
Merge branch 'master' into izaak/feature/issue-277
Step7750 May 5, 2025
f977a2f
Merge branch 'master' into izaak/feature/issue-277
IzaakPrats May 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/lib/bridge/handlers/fetch_recommended_price.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {SimpleHandler} from './main';
import {RequestType} from './types';
import {gPriceFetcher} from '../../services/price_fetcher';

export interface FetchRecommendedPriceRequest {
market_hash_name: string;
paint_index?: number;
}

export interface FetchRecommendedPriceResponse {
price: number;
}

export const FetchRecommendedPrice = new SimpleHandler<FetchRecommendedPriceRequest, FetchRecommendedPriceResponse>(
RequestType.FETCH_RECOMMENDED_PRICE,
async (req) => ({price: await gPriceFetcher.fetch(req.market_hash_name, req.paint_index)})
);
4 changes: 4 additions & 0 deletions src/lib/bridge/handlers/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import {FetchSteamTrades} from './fetch_steam_trades';
import {FetchBlockedUsers} from './fetch_blocked_users';
import {PingBlockedUsers} from './ping_blocked_users';
import {FetchBluegem} from './fetch_bluegem';
import {ListItem} from './list_item';
import {FetchRecommendedPrice} from './fetch_recommended_price';

export const HANDLERS_MAP: {[key in RequestType]: RequestHandler<any, any>} = {
[RequestType.EXECUTE_SCRIPT_ON_PAGE]: ExecuteScriptOnPage,
Expand Down Expand Up @@ -56,4 +58,6 @@ export const HANDLERS_MAP: {[key in RequestType]: RequestHandler<any, any>} = {
[RequestType.FETCH_BLOCKED_USERS]: FetchBlockedUsers,
[RequestType.PING_BLOCKED_USERS]: PingBlockedUsers,
[RequestType.FETCH_BLUEGEM]: FetchBluegem,
[RequestType.LIST_ITEM]: ListItem,
Comment thread
Step7750 marked this conversation as resolved.
[RequestType.FETCH_RECOMMENDED_PRICE]: FetchRecommendedPrice,
};
61 changes: 61 additions & 0 deletions src/lib/bridge/handlers/list_item.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import {SimpleHandler} from './main';
import {RequestType} from './types';
import {environment} from '../../../environment';
import {CSFError, CSFErrorCode} from '../../utils/errors';

type ListingType = 'buy_now' | 'auction';

interface BaseListItemRequest {
asset_id: string;
type: ListingType;
description?: string;
private?: boolean;
}

interface BuyNowListItemRequest extends BaseListItemRequest {
type: 'buy_now';
price: number;
max_offer_discount?: number;
}

interface AuctionListItemRequest extends BaseListItemRequest {
type: 'auction';
reserve_price: number;
duration_days: 1 | 3 | 5 | 7 | 14;
}

type ListItemRequest = BuyNowListItemRequest | AuctionListItemRequest;

interface ListItemResponse {
success: boolean;
error?: string;
id?: string;
}

export const ListItem = new SimpleHandler<ListItemRequest, ListItemResponse>(RequestType.LIST_ITEM, async (req) => {
const response = await fetch(`${environment.csfloat_base_api_url}/v1/listings`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(req),
credentials: 'include',
});

if (!response.ok) {
// Error comes with this body format: { message: string, code: number }
const error = await response.json();
if (response.status === 401) {
// This is here for normalized auth errors across all handlers
throw new CSFError(CSFErrorCode.NOT_AUTHENTICATED);
}

throw new Error(`Failed to List Item: ${error.message} - ${error.code}`);
}

const data = await response.json();
return {
success: true,
id: data.id,
};
});
2 changes: 2 additions & 0 deletions src/lib/bridge/handlers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ export enum RequestType {
FETCH_BLOCKED_USERS = 24,
PING_BLOCKED_USERS = 25,
FETCH_BLUEGEM = 26,
LIST_ITEM = 27,
FETCH_RECOMMENDED_PRICE = 28,
}
Loading