@agg-build/ui 4.4.0 → 4.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/{chunk-64BBTXFE.mjs → chunk-3RQCBGIK.mjs} +11 -6
- package/dist/{chunk-V5CRUO6S.mjs → chunk-C4GFVJ62.mjs} +98 -30
- package/dist/{chunk-WW5QKNIM.mjs → chunk-EOLR7DHL.mjs} +302 -26
- package/dist/{chunk-UCU2XCV5.mjs → chunk-LXQ3U4X2.mjs} +2 -2
- package/dist/{chunk-N7UPPT5J.mjs → chunk-RDBMHBR2.mjs} +14 -0
- package/dist/{chunk-6STRIKUA.mjs → chunk-WYCSTAN7.mjs} +1 -1
- package/dist/{chunk-734VTGCV.mjs → chunk-XN2NB2NP.mjs} +1 -1
- package/dist/events.js +97 -25
- package/dist/events.mjs +3 -3
- package/dist/index.js +407 -50
- package/dist/index.mjs +7 -7
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +407 -50
- package/dist/pages.mjs +6 -6
- package/dist/primitives.mjs +1 -1
- package/dist/trading.js +8 -3
- package/dist/trading.mjs +4 -4
- package/dist/types/events/list/event-list.constants.d.mts +3 -1
- package/dist/types/events/list/event-list.constants.d.ts +3 -1
- package/dist/types/events/list/event-list.types.d.mts +17 -0
- package/dist/types/events/list/event-list.types.d.ts +17 -0
- package/dist/types/events/list/event-list.utils.d.mts +4 -0
- package/dist/types/events/list/event-list.utils.d.ts +4 -0
- package/dist/types/events/list/index.d.mts +2 -2
- package/dist/types/events/list/index.d.ts +2 -2
- package/dist/types/pages/home/event-discovery-url-state.d.mts +35 -0
- package/dist/types/pages/home/event-discovery-url-state.d.ts +35 -0
- package/package.json +3 -3
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
DEFAULT_EVENTS_LIMIT,
|
|
4
|
+
DEFAULT_EVENT_LIST_SORT,
|
|
5
|
+
EVENT_LIST_SORT_VALUES,
|
|
4
6
|
EventList,
|
|
5
7
|
EventListItem,
|
|
6
8
|
EventListItemDetails,
|
|
@@ -10,7 +12,7 @@ import {
|
|
|
10
12
|
isErrorWithStatus,
|
|
11
13
|
useEventListTabs,
|
|
12
14
|
useEventListTabsHeaderOverflow
|
|
13
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-C4GFVJ62.mjs";
|
|
14
16
|
import {
|
|
15
17
|
DEPOSIT_MODAL_OPEN_EVENT,
|
|
16
18
|
PlaceOrder,
|
|
@@ -19,12 +21,12 @@ import {
|
|
|
19
21
|
formatChainIdLabel,
|
|
20
22
|
useClaimWinnings,
|
|
21
23
|
useResolvedMarketClaim
|
|
22
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-3RQCBGIK.mjs";
|
|
23
25
|
import {
|
|
24
26
|
getDisplayOutcomePrice,
|
|
25
27
|
resolveHeaderOutcomeItems,
|
|
26
28
|
resolveMarketFromVenueMarkets
|
|
27
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-WYCSTAN7.mjs";
|
|
28
30
|
import {
|
|
29
31
|
AggErrorBoundary,
|
|
30
32
|
Button,
|
|
@@ -60,7 +62,7 @@ import {
|
|
|
60
62
|
skeletonViews,
|
|
61
63
|
sortCategoriesForNavigation,
|
|
62
64
|
useOptionalToast
|
|
63
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-RDBMHBR2.mjs";
|
|
64
66
|
|
|
65
67
|
// src/pages/home/index.tsx
|
|
66
68
|
import {
|
|
@@ -2732,6 +2734,85 @@ var resolveInitialTabValue = (tabs, defaultActiveTab) => {
|
|
|
2732
2734
|
return (_b = (_a = tabs[0]) == null ? void 0 : _a.value) != null ? _b : ALL_CATEGORIES_TAB_VALUE;
|
|
2733
2735
|
};
|
|
2734
2736
|
|
|
2737
|
+
// src/pages/home/event-discovery-url-state.ts
|
|
2738
|
+
import { z } from "zod";
|
|
2739
|
+
var nonEmptyParamSchema = z.string().trim().min(1);
|
|
2740
|
+
var sortParamSchema = z.enum(EVENT_LIST_SORT_VALUES);
|
|
2741
|
+
var readScalarParam = (searchParams, name, schema) => {
|
|
2742
|
+
const values = searchParams.getAll(name);
|
|
2743
|
+
if (values.length === 0) return { invalid: false };
|
|
2744
|
+
if (values.length !== 1) return { invalid: true };
|
|
2745
|
+
const parsedValue = schema.safeParse(values[0]);
|
|
2746
|
+
if (!parsedValue.success) return { invalid: true };
|
|
2747
|
+
return { value: parsedValue.data, invalid: false };
|
|
2748
|
+
};
|
|
2749
|
+
var readEventDiscoveryUrlState = (searchParams) => {
|
|
2750
|
+
const category = readScalarParam(searchParams, "category", nonEmptyParamSchema);
|
|
2751
|
+
const venue = readScalarParam(searchParams, "venue", nonEmptyParamSchema);
|
|
2752
|
+
const sort = readScalarParam(searchParams, "sort", sortParamSchema);
|
|
2753
|
+
const subcategoryPath = [];
|
|
2754
|
+
let hasInvalidSubcategory = false;
|
|
2755
|
+
for (const value of searchParams.getAll("subcategory")) {
|
|
2756
|
+
const parsedValue = nonEmptyParamSchema.safeParse(value);
|
|
2757
|
+
if (!parsedValue.success) {
|
|
2758
|
+
hasInvalidSubcategory = true;
|
|
2759
|
+
break;
|
|
2760
|
+
}
|
|
2761
|
+
subcategoryPath.push(parsedValue.data);
|
|
2762
|
+
}
|
|
2763
|
+
return {
|
|
2764
|
+
category: category.value,
|
|
2765
|
+
subcategoryPath,
|
|
2766
|
+
venue: venue.value,
|
|
2767
|
+
sort: sort.value,
|
|
2768
|
+
categoryIsInvalid: category.invalid,
|
|
2769
|
+
shouldCanonicalize: category.invalid || venue.invalid || sort.invalid || hasInvalidSubcategory
|
|
2770
|
+
};
|
|
2771
|
+
};
|
|
2772
|
+
var resolveEventDiscoveryUrlState = ({
|
|
2773
|
+
parsedState,
|
|
2774
|
+
categoryValues,
|
|
2775
|
+
venueValues,
|
|
2776
|
+
defaultCategory,
|
|
2777
|
+
defaultVenue
|
|
2778
|
+
}) => {
|
|
2779
|
+
var _a, _b, _c;
|
|
2780
|
+
const categoryIsValid = parsedState.category == null || categoryValues.includes(parsedState.category);
|
|
2781
|
+
const venueIsValid = parsedState.venue == null || venueValues.includes(parsedState.venue);
|
|
2782
|
+
const category = categoryIsValid ? (_a = parsedState.category) != null ? _a : defaultCategory : defaultCategory;
|
|
2783
|
+
const venue = venueIsValid ? (_b = parsedState.venue) != null ? _b : defaultVenue : defaultVenue;
|
|
2784
|
+
const sort = (_c = parsedState.sort) != null ? _c : DEFAULT_EVENT_LIST_SORT;
|
|
2785
|
+
return {
|
|
2786
|
+
state: {
|
|
2787
|
+
category,
|
|
2788
|
+
subcategoryPath: categoryIsValid && !parsedState.categoryIsInvalid ? parsedState.subcategoryPath : [],
|
|
2789
|
+
venue,
|
|
2790
|
+
sort
|
|
2791
|
+
},
|
|
2792
|
+
shouldCanonicalize: parsedState.shouldCanonicalize || !categoryIsValid || !venueIsValid || parsedState.category === defaultCategory || parsedState.venue === defaultVenue || parsedState.sort === DEFAULT_EVENT_LIST_SORT
|
|
2793
|
+
};
|
|
2794
|
+
};
|
|
2795
|
+
var buildEventDiscoveryUrl = ({
|
|
2796
|
+
currentUrl,
|
|
2797
|
+
state,
|
|
2798
|
+
defaultCategory,
|
|
2799
|
+
defaultVenue
|
|
2800
|
+
}) => {
|
|
2801
|
+
const nextUrl = new URL(currentUrl.toString());
|
|
2802
|
+
nextUrl.searchParams.delete("category");
|
|
2803
|
+
nextUrl.searchParams.delete("subcategory");
|
|
2804
|
+
nextUrl.searchParams.delete("venue");
|
|
2805
|
+
nextUrl.searchParams.delete("sort");
|
|
2806
|
+
if (state.category !== defaultCategory) nextUrl.searchParams.set("category", state.category);
|
|
2807
|
+
for (const subcategory of state.subcategoryPath) {
|
|
2808
|
+
nextUrl.searchParams.append("subcategory", subcategory);
|
|
2809
|
+
}
|
|
2810
|
+
if (state.venue !== defaultVenue) nextUrl.searchParams.set("venue", state.venue);
|
|
2811
|
+
if (state.sort !== DEFAULT_EVENT_LIST_SORT) nextUrl.searchParams.set("sort", state.sort);
|
|
2812
|
+
const search = nextUrl.searchParams.toString();
|
|
2813
|
+
return `${nextUrl.pathname}${search ? `?${search}` : ""}${nextUrl.hash}`;
|
|
2814
|
+
};
|
|
2815
|
+
|
|
2735
2816
|
// src/pages/home/use-scroll-restoration.ts
|
|
2736
2817
|
import { useLayoutEffect as useLayoutEffect2, useRef as useRef6, useState as useState7 } from "react";
|
|
2737
2818
|
function useScrollRestoration({
|
|
@@ -3011,7 +3092,7 @@ var HomePage = ({
|
|
|
3011
3092
|
onError,
|
|
3012
3093
|
stickyOrderPanel
|
|
3013
3094
|
}) => {
|
|
3014
|
-
var _a, _b, _c, _d;
|
|
3095
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
3015
3096
|
const labels = useLabels5();
|
|
3016
3097
|
const {
|
|
3017
3098
|
search: {
|
|
@@ -3021,8 +3102,11 @@ var HomePage = ({
|
|
|
3021
3102
|
onChange: onSearchChange,
|
|
3022
3103
|
onSelect: onSelectEventInternal
|
|
3023
3104
|
},
|
|
3024
|
-
trading: { executionMode }
|
|
3105
|
+
trading: { executionMode },
|
|
3106
|
+
features: { enableEventDiscoveryUrlPersistence }
|
|
3025
3107
|
} = useSdkUiConfig4();
|
|
3108
|
+
const { isLoading: isAppConfigLoading } = useAppConfig();
|
|
3109
|
+
const primaryEventListTabs = useEventListTabs();
|
|
3026
3110
|
const { capture, consume } = useEventListState();
|
|
3027
3111
|
const [snapshot] = useState9(() => consume());
|
|
3028
3112
|
const eventListStateRef = useRef7(null);
|
|
@@ -3093,7 +3177,7 @@ var HomePage = ({
|
|
|
3093
3177
|
}, [isShowingAllResults, normalizedSearchValue, selectedEvent]);
|
|
3094
3178
|
const resolvedSelectedEvent = selectedEvent != null ? selectedEvent : stickySelectedEvent;
|
|
3095
3179
|
const resolvedAllCategoryTabLabel = allCategoryTabLabel === DEFAULT_ALL_CATEGORY_TAB_LABEL ? labels.home.trending : allCategoryTabLabel;
|
|
3096
|
-
const { categories } = useCategories({
|
|
3180
|
+
const { categories, isLoading: isCategoriesLoading } = useCategories({
|
|
3097
3181
|
limit: categoriesLimit,
|
|
3098
3182
|
enabled: !hasCustomTabs
|
|
3099
3183
|
});
|
|
@@ -3104,22 +3188,180 @@ var HomePage = ({
|
|
|
3104
3188
|
if (hasCustomTabs && tabs) return tabs;
|
|
3105
3189
|
return categoryTabs;
|
|
3106
3190
|
}, [categoryTabs, hasCustomTabs, tabs]);
|
|
3191
|
+
const availableCategoryValues = useMemo5(
|
|
3192
|
+
() => resolvedTabs.filter((tab) => !tab.disabled).map((tab) => tab.value),
|
|
3193
|
+
[resolvedTabs]
|
|
3194
|
+
);
|
|
3195
|
+
const resolvedDefaultCategory = resolveInitialTabValue(resolvedTabs, defaultActiveTab);
|
|
3196
|
+
const defaultCategory = availableCategoryValues.includes(resolvedDefaultCategory) ? resolvedDefaultCategory : (_a = availableCategoryValues[0]) != null ? _a : resolvedDefaultCategory;
|
|
3197
|
+
const availableVenueTabs = useMemo5(
|
|
3198
|
+
() => primaryEventListTabs.filter((tab) => !tab.disabled && !tab.isComingSoon),
|
|
3199
|
+
[primaryEventListTabs]
|
|
3200
|
+
);
|
|
3201
|
+
const availableVenueValues = useMemo5(
|
|
3202
|
+
() => availableVenueTabs.map((tab) => tab.value),
|
|
3203
|
+
[availableVenueTabs]
|
|
3204
|
+
);
|
|
3205
|
+
const defaultVenue = (_c = (_b = availableVenueTabs[0]) == null ? void 0 : _b.value) != null ? _c : "matched";
|
|
3107
3206
|
const resolvedEventSectionItems = eventSectionItems && eventSectionItems.length > 0 ? eventSectionItems : getDefaultEventSectionItems(labels);
|
|
3108
|
-
const [
|
|
3109
|
-
|
|
3110
|
-
|
|
3207
|
+
const [discoveryFilterState, setDiscoveryFilterState] = useState9(
|
|
3208
|
+
() => {
|
|
3209
|
+
var _a2, _b2;
|
|
3210
|
+
return {
|
|
3211
|
+
category: (_a2 = snapshot == null ? void 0 : snapshot.categoryTab) != null ? _a2 : defaultCategory,
|
|
3212
|
+
venue: (_b2 = snapshot == null ? void 0 : snapshot.venueTab) != null ? _b2 : defaultVenue,
|
|
3213
|
+
sort: DEFAULT_EVENT_LIST_SORT,
|
|
3214
|
+
subcategoryPath: []
|
|
3215
|
+
};
|
|
3111
3216
|
}
|
|
3112
|
-
|
|
3113
|
-
|
|
3217
|
+
);
|
|
3218
|
+
const discoveryFilterStateRef = useRef7(discoveryFilterState);
|
|
3219
|
+
discoveryFilterStateRef.current = discoveryFilterState;
|
|
3220
|
+
const [isUrlStateReady, setIsUrlStateReady] = useState9(!enableEventDiscoveryUrlPersistence);
|
|
3221
|
+
const hasInitializedUrlStateRef = useRef7(false);
|
|
3222
|
+
const activeTabValue = discoveryFilterState.category;
|
|
3223
|
+
const resolveCurrentUrlState = useCallback5(() => {
|
|
3224
|
+
if (typeof window === "undefined") return null;
|
|
3225
|
+
const parsedState = readEventDiscoveryUrlState(new URL(window.location.href).searchParams);
|
|
3226
|
+
const resolvedState = resolveEventDiscoveryUrlState({
|
|
3227
|
+
parsedState,
|
|
3228
|
+
categoryValues: availableCategoryValues,
|
|
3229
|
+
venueValues: availableVenueValues,
|
|
3230
|
+
defaultCategory,
|
|
3231
|
+
defaultVenue
|
|
3232
|
+
});
|
|
3233
|
+
return {
|
|
3234
|
+
state: {
|
|
3235
|
+
category: resolvedState.state.category,
|
|
3236
|
+
venue: resolvedState.state.venue,
|
|
3237
|
+
sort: resolvedState.state.sort,
|
|
3238
|
+
subcategoryPath: resolvedState.state.subcategoryPath.map((id) => ({
|
|
3239
|
+
id,
|
|
3240
|
+
label: id,
|
|
3241
|
+
eventCount: 0
|
|
3242
|
+
}))
|
|
3243
|
+
},
|
|
3244
|
+
shouldCanonicalize: resolvedState.shouldCanonicalize
|
|
3245
|
+
};
|
|
3246
|
+
}, [availableCategoryValues, availableVenueValues, defaultCategory, defaultVenue]);
|
|
3247
|
+
const writeFilterStateToHistory = useCallback5(
|
|
3248
|
+
(state, historyMode) => {
|
|
3249
|
+
if (!enableEventDiscoveryUrlPersistence || typeof window === "undefined") return;
|
|
3250
|
+
const currentUrl = new URL(window.location.href);
|
|
3251
|
+
const nextUrl = buildEventDiscoveryUrl({
|
|
3252
|
+
currentUrl,
|
|
3253
|
+
state: {
|
|
3254
|
+
category: state.category,
|
|
3255
|
+
venue: state.venue,
|
|
3256
|
+
sort: state.sort,
|
|
3257
|
+
subcategoryPath: state.subcategoryPath.map((entry) => entry.id)
|
|
3258
|
+
},
|
|
3259
|
+
defaultCategory,
|
|
3260
|
+
defaultVenue
|
|
3261
|
+
});
|
|
3262
|
+
const currentRelativeUrl = `${currentUrl.pathname}${currentUrl.search}${currentUrl.hash}`;
|
|
3263
|
+
if (nextUrl === currentRelativeUrl) return;
|
|
3264
|
+
const method = historyMode === "push" ? "pushState" : "replaceState";
|
|
3265
|
+
window.history[method](window.history.state, "", nextUrl);
|
|
3266
|
+
},
|
|
3267
|
+
[defaultCategory, defaultVenue, enableEventDiscoveryUrlPersistence]
|
|
3268
|
+
);
|
|
3269
|
+
const commitDiscoveryFilterState = useCallback5(
|
|
3270
|
+
(state, historyMode) => {
|
|
3271
|
+
discoveryFilterStateRef.current = state;
|
|
3272
|
+
setDiscoveryFilterState(state);
|
|
3273
|
+
if (isUrlStateReady) writeFilterStateToHistory(state, historyMode);
|
|
3274
|
+
},
|
|
3275
|
+
[isUrlStateReady, writeFilterStateToHistory]
|
|
3276
|
+
);
|
|
3277
|
+
useEffect8(() => {
|
|
3278
|
+
if (!enableEventDiscoveryUrlPersistence) {
|
|
3279
|
+
hasInitializedUrlStateRef.current = false;
|
|
3280
|
+
setIsUrlStateReady(true);
|
|
3281
|
+
return;
|
|
3282
|
+
}
|
|
3283
|
+
if (hasInitializedUrlStateRef.current) return;
|
|
3284
|
+
if (!hasCustomTabs && isCategoriesLoading || isAppConfigLoading) return;
|
|
3285
|
+
const resolvedUrlState = resolveCurrentUrlState();
|
|
3286
|
+
if (!resolvedUrlState) return;
|
|
3287
|
+
hasInitializedUrlStateRef.current = true;
|
|
3288
|
+
discoveryFilterStateRef.current = resolvedUrlState.state;
|
|
3289
|
+
setDiscoveryFilterState(resolvedUrlState.state);
|
|
3290
|
+
setIsUrlStateReady(true);
|
|
3291
|
+
const currentUrl = new URL(window.location.href);
|
|
3292
|
+
const canonicalUrl = buildEventDiscoveryUrl({
|
|
3293
|
+
currentUrl,
|
|
3294
|
+
state: {
|
|
3295
|
+
category: resolvedUrlState.state.category,
|
|
3296
|
+
venue: resolvedUrlState.state.venue,
|
|
3297
|
+
sort: resolvedUrlState.state.sort,
|
|
3298
|
+
subcategoryPath: resolvedUrlState.state.subcategoryPath.map((entry) => entry.id)
|
|
3299
|
+
},
|
|
3300
|
+
defaultCategory,
|
|
3301
|
+
defaultVenue
|
|
3302
|
+
});
|
|
3303
|
+
const currentRelativeUrl = `${currentUrl.pathname}${currentUrl.search}${currentUrl.hash}`;
|
|
3304
|
+
if (resolvedUrlState.shouldCanonicalize || canonicalUrl !== currentRelativeUrl) {
|
|
3305
|
+
window.history.replaceState(window.history.state, "", canonicalUrl);
|
|
3306
|
+
}
|
|
3307
|
+
}, [
|
|
3308
|
+
defaultCategory,
|
|
3309
|
+
defaultVenue,
|
|
3310
|
+
enableEventDiscoveryUrlPersistence,
|
|
3311
|
+
hasCustomTabs,
|
|
3312
|
+
isAppConfigLoading,
|
|
3313
|
+
isCategoriesLoading,
|
|
3314
|
+
resolveCurrentUrlState
|
|
3315
|
+
]);
|
|
3316
|
+
useEffect8(() => {
|
|
3317
|
+
if (!enableEventDiscoveryUrlPersistence || !isUrlStateReady) return;
|
|
3318
|
+
const handlePopState = () => {
|
|
3319
|
+
const resolvedUrlState = resolveCurrentUrlState();
|
|
3320
|
+
if (!resolvedUrlState) return;
|
|
3321
|
+
discoveryFilterStateRef.current = resolvedUrlState.state;
|
|
3322
|
+
setDiscoveryFilterState(resolvedUrlState.state);
|
|
3323
|
+
if (resolvedUrlState.shouldCanonicalize) {
|
|
3324
|
+
writeFilterStateToHistory(resolvedUrlState.state, "replace");
|
|
3325
|
+
}
|
|
3326
|
+
};
|
|
3327
|
+
window.addEventListener("popstate", handlePopState);
|
|
3328
|
+
return () => {
|
|
3329
|
+
window.removeEventListener("popstate", handlePopState);
|
|
3330
|
+
};
|
|
3331
|
+
}, [
|
|
3332
|
+
enableEventDiscoveryUrlPersistence,
|
|
3333
|
+
isUrlStateReady,
|
|
3334
|
+
resolveCurrentUrlState,
|
|
3335
|
+
writeFilterStateToHistory
|
|
3336
|
+
]);
|
|
3114
3337
|
const activeTabValueRef = useRef7(activeTabValue);
|
|
3115
3338
|
activeTabValueRef.current = activeTabValue;
|
|
3116
3339
|
useEffect8(() => {
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3340
|
+
if (enableEventDiscoveryUrlPersistence && !isUrlStateReady) return;
|
|
3341
|
+
const currentState = discoveryFilterStateRef.current;
|
|
3342
|
+
const categoryIsAvailable = availableCategoryValues.includes(currentState.category);
|
|
3343
|
+
const venueIsAvailable = availableVenueValues.includes(currentState.venue);
|
|
3344
|
+
if (categoryIsAvailable && (!enableEventDiscoveryUrlPersistence || venueIsAvailable)) return;
|
|
3345
|
+
const nextState = __spreadProps(__spreadValues({}, currentState), {
|
|
3346
|
+
category: categoryIsAvailable ? currentState.category : defaultCategory,
|
|
3347
|
+
venue: venueIsAvailable ? currentState.venue : defaultVenue,
|
|
3348
|
+
subcategoryPath: categoryIsAvailable ? currentState.subcategoryPath : []
|
|
3121
3349
|
});
|
|
3122
|
-
|
|
3350
|
+
if (enableEventDiscoveryUrlPersistence) {
|
|
3351
|
+
commitDiscoveryFilterState(nextState, "replace");
|
|
3352
|
+
return;
|
|
3353
|
+
}
|
|
3354
|
+
discoveryFilterStateRef.current = nextState;
|
|
3355
|
+
setDiscoveryFilterState(nextState);
|
|
3356
|
+
}, [
|
|
3357
|
+
availableCategoryValues,
|
|
3358
|
+
availableVenueValues,
|
|
3359
|
+
commitDiscoveryFilterState,
|
|
3360
|
+
defaultCategory,
|
|
3361
|
+
defaultVenue,
|
|
3362
|
+
enableEventDiscoveryUrlPersistence,
|
|
3363
|
+
isUrlStateReady
|
|
3364
|
+
]);
|
|
3123
3365
|
const tabsItems = useMemo5(() => {
|
|
3124
3366
|
return resolvedTabs.map((tab) => {
|
|
3125
3367
|
const isActive = tab.value === activeTabValue;
|
|
@@ -3160,7 +3402,13 @@ var HomePage = ({
|
|
|
3160
3402
|
];
|
|
3161
3403
|
}, [activeTab, activeTabValue, resolvedEventSectionItems]);
|
|
3162
3404
|
const handleTabChange = (value) => {
|
|
3163
|
-
|
|
3405
|
+
commitDiscoveryFilterState(
|
|
3406
|
+
__spreadProps(__spreadValues({}, discoveryFilterStateRef.current), {
|
|
3407
|
+
category: value,
|
|
3408
|
+
subcategoryPath: []
|
|
3409
|
+
}),
|
|
3410
|
+
"push"
|
|
3411
|
+
);
|
|
3164
3412
|
_onTabChange == null ? void 0 : _onTabChange(value);
|
|
3165
3413
|
};
|
|
3166
3414
|
const handleCategoryRootChange = (categoryId) => {
|
|
@@ -3182,10 +3430,10 @@ var HomePage = ({
|
|
|
3182
3430
|
handleSelectEvent(event);
|
|
3183
3431
|
};
|
|
3184
3432
|
const shouldRenderMobileSearch = isMobileSearchViewport && !resolvedSelectedEvent;
|
|
3185
|
-
const isScrollRestorationReady = !!snapshot && !isShowingAllResults && !resolvedSelectedEvent && ((
|
|
3433
|
+
const isScrollRestorationReady = !!snapshot && !isShowingAllResults && !resolvedSelectedEvent && ((_e = (_d = eventListStateRef.current) == null ? void 0 : _d.loadedPageCount) != null ? _e : 0) >= ((_f = snapshot.loadedPageCount) != null ? _f : 1);
|
|
3186
3434
|
useScrollRestoration({
|
|
3187
3435
|
enabled: !!snapshot && snapshot.scrollY > 0,
|
|
3188
|
-
scrollY: (
|
|
3436
|
+
scrollY: (_g = snapshot == null ? void 0 : snapshot.scrollY) != null ? _g : 0,
|
|
3189
3437
|
isReady: isScrollRestorationReady
|
|
3190
3438
|
});
|
|
3191
3439
|
return /* @__PURE__ */ jsx7(AggErrorBoundary, { onError, children: /* @__PURE__ */ jsxs6("section", { className: cn("agg-home-page flex w-full flex-col", classNames == null ? void 0 : classNames.root), children: [
|
|
@@ -3267,7 +3515,13 @@ var HomePage = ({
|
|
|
3267
3515
|
"div",
|
|
3268
3516
|
{
|
|
3269
3517
|
className: "agg-home-section",
|
|
3270
|
-
children: /* @__PURE__ */ jsx7(
|
|
3518
|
+
children: sectionIndex === 0 && !isUrlStateReady ? /* @__PURE__ */ jsx7(
|
|
3519
|
+
Skeleton,
|
|
3520
|
+
{
|
|
3521
|
+
view: "event-list",
|
|
3522
|
+
ariaLabel: labels.eventList.loading(eventSectionItem.title)
|
|
3523
|
+
}
|
|
3524
|
+
) : /* @__PURE__ */ jsx7(
|
|
3271
3525
|
EventList,
|
|
3272
3526
|
__spreadValues({
|
|
3273
3527
|
title: eventSectionItem.title,
|
|
@@ -3283,11 +3537,33 @@ var HomePage = ({
|
|
|
3283
3537
|
handleSelectEvent(event);
|
|
3284
3538
|
},
|
|
3285
3539
|
onMarketClick: onMarketClickProp
|
|
3286
|
-
}, sectionIndex === 0 ? {
|
|
3540
|
+
}, sectionIndex === 0 ? __spreadValues({
|
|
3287
3541
|
stateRef: eventListStateRef,
|
|
3288
|
-
initialVenueTab: (_d2 = snapshot == null ? void 0 : snapshot.venueTab) != null ? _d2 : void 0,
|
|
3542
|
+
initialVenueTab: enableEventDiscoveryUrlPersistence ? void 0 : (_d2 = snapshot == null ? void 0 : snapshot.venueTab) != null ? _d2 : void 0,
|
|
3289
3543
|
initialLoadedPageCount: snapshot == null ? void 0 : snapshot.loadedPageCount
|
|
3290
|
-
}
|
|
3544
|
+
}, enableEventDiscoveryUrlPersistence ? {
|
|
3545
|
+
activeVenueTab: discoveryFilterState.venue,
|
|
3546
|
+
onActiveVenueTabChange: (venue) => {
|
|
3547
|
+
commitDiscoveryFilterState(
|
|
3548
|
+
__spreadProps(__spreadValues({}, discoveryFilterStateRef.current), { venue }),
|
|
3549
|
+
"push"
|
|
3550
|
+
);
|
|
3551
|
+
},
|
|
3552
|
+
selectedSort: discoveryFilterState.sort,
|
|
3553
|
+
onSelectedSortChange: (sort) => {
|
|
3554
|
+
commitDiscoveryFilterState(
|
|
3555
|
+
__spreadProps(__spreadValues({}, discoveryFilterStateRef.current), { sort }),
|
|
3556
|
+
"push"
|
|
3557
|
+
);
|
|
3558
|
+
},
|
|
3559
|
+
categoryPath: discoveryFilterState.subcategoryPath,
|
|
3560
|
+
onCategoryPathChange: (subcategoryPath, options) => {
|
|
3561
|
+
commitDiscoveryFilterState(
|
|
3562
|
+
__spreadProps(__spreadValues({}, discoveryFilterStateRef.current), { subcategoryPath }),
|
|
3563
|
+
options.history
|
|
3564
|
+
);
|
|
3565
|
+
}
|
|
3566
|
+
} : void 0) : void 0)
|
|
3291
3567
|
)
|
|
3292
3568
|
},
|
|
3293
3569
|
`${(_a2 = eventSectionItem.id) != null ? _a2 : eventSectionItem.title}-${sectionIndex}`
|
|
@@ -3672,7 +3948,7 @@ import {
|
|
|
3672
3948
|
} from "@agg-build/sdk";
|
|
3673
3949
|
import * as Dialog2 from "@radix-ui/react-dialog";
|
|
3674
3950
|
import { useCallback as useCallback6, useEffect as useEffect9, useId, useMemo as useMemo6, useRef as useRef8, useState as useState10 } from "react";
|
|
3675
|
-
import { z } from "zod";
|
|
3951
|
+
import { z as z2 } from "zod";
|
|
3676
3952
|
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3677
3953
|
var USDC_DECIMALS = 6;
|
|
3678
3954
|
var EDITABLE_AMOUNT_PATTERN = /^\d*(?:\.\d{0,6})?$/;
|
|
@@ -3697,7 +3973,7 @@ var VENUE_LABELS = {
|
|
|
3697
3973
|
[Venue2.hyperliquid]: "Hyperliquid",
|
|
3698
3974
|
[Venue2.novig]: "Novig"
|
|
3699
3975
|
};
|
|
3700
|
-
var amountSchema =
|
|
3976
|
+
var amountSchema = z2.string().min(1).regex(FINAL_AMOUNT_PATTERN);
|
|
3701
3977
|
var decimalToRaw = (value, decimals = USDC_DECIMALS) => {
|
|
3702
3978
|
const parsed = amountSchema.safeParse(value.trim());
|
|
3703
3979
|
if (!parsed.success) return null;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ConnectKalshiModal,
|
|
4
4
|
dispatchAggDepositNotification
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-XN2NB2NP.mjs";
|
|
6
6
|
import {
|
|
7
7
|
BoltIcon,
|
|
8
8
|
Button,
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
shortenAddress,
|
|
36
36
|
useOptionalToast,
|
|
37
37
|
venueLogoLabels
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-RDBMHBR2.mjs";
|
|
39
39
|
|
|
40
40
|
// src/deposit/index.tsx
|
|
41
41
|
import { useAggAuthState, useAggUiConfig, useDepositAddresses, useLabels as useLabels11 } from "@agg-build/hooks";
|
|
@@ -5435,6 +5435,19 @@ var resolveCategoryIdsFromPath = (path, fallbackCategoryIds) => {
|
|
|
5435
5435
|
if (deepest) return [deepest];
|
|
5436
5436
|
return fallbackCategoryIds;
|
|
5437
5437
|
};
|
|
5438
|
+
var validateSubcategoryPath = (requestedPath, rootCategoryId, childrenByParentId) => {
|
|
5439
|
+
var _a;
|
|
5440
|
+
if (!rootCategoryId) return [];
|
|
5441
|
+
const validPath = [];
|
|
5442
|
+
let parentId = rootCategoryId;
|
|
5443
|
+
for (const categoryId of requestedPath) {
|
|
5444
|
+
const category = (_a = childrenByParentId.get(parentId)) == null ? void 0 : _a.find((child) => child.id === categoryId);
|
|
5445
|
+
if (!category) break;
|
|
5446
|
+
validPath.push(category.id);
|
|
5447
|
+
parentId = category.id;
|
|
5448
|
+
}
|
|
5449
|
+
return validPath;
|
|
5450
|
+
};
|
|
5438
5451
|
var resolveTabVenus = (tab, visibleVenues) => {
|
|
5439
5452
|
const applyAllowList = (venues) => {
|
|
5440
5453
|
if (!venues) {
|
|
@@ -10197,6 +10210,7 @@ export {
|
|
|
10197
10210
|
filterEventsByTabValue,
|
|
10198
10211
|
sortCategoriesForNavigation,
|
|
10199
10212
|
resolveCategoryIdsFromPath,
|
|
10213
|
+
validateSubcategoryPath,
|
|
10200
10214
|
resolveTabVenus,
|
|
10201
10215
|
SkeletonBlock,
|
|
10202
10216
|
RemoteImage,
|