@agg-build/ui 2.0.0 → 2.1.0
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/dist/{chunk-2UKDQ7WP.mjs → chunk-3OI2ZLLT.mjs} +94 -39
- package/dist/{chunk-4CM4F4S6.mjs → chunk-C5M2OOM3.mjs} +1 -1
- package/dist/{chunk-2ZS3BPSF.mjs → chunk-DXF2LMNN.mjs} +132 -81
- package/dist/{chunk-RWOF44TC.mjs → chunk-R6FBYAY5.mjs} +239 -183
- package/dist/{chunk-RF2EPYLN.mjs → chunk-Y6PVXAUQ.mjs} +27 -77
- package/dist/{chunk-R3U6YXSQ.mjs → chunk-YAEA6EDG.mjs} +31 -18
- package/dist/{chunk-HH7L3KLS.mjs → chunk-YMVD6Q2A.mjs} +1 -1
- package/dist/events.js +497 -462
- package/dist/events.mjs +3 -3
- package/dist/index.js +2116 -1990
- package/dist/index.mjs +9 -7
- package/dist/modals.js +278 -171
- package/dist/modals.mjs +5 -3
- package/dist/pages.js +1557 -1487
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +137 -86
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +28 -15
- package/dist/trading.mjs +4 -4
- package/dist/types/events/list/category-sidebar.d.mts +33 -0
- package/dist/types/events/list/category-sidebar.d.ts +33 -0
- package/dist/types/events/list/event-list-tabs.d.mts +2 -0
- package/dist/types/events/list/event-list-tabs.d.ts +2 -0
- package/dist/types/events/list/index.d.mts +1 -0
- package/dist/types/events/list/index.d.ts +1 -0
- package/dist/types/pages/event-market/event-market.types.d.mts +1 -0
- package/dist/types/pages/event-market/event-market.types.d.ts +1 -0
- package/dist/types/pages/user-profile/index.d.mts +1 -1
- package/dist/types/pages/user-profile/index.d.ts +1 -1
- package/dist/types/pages/user-profile/user-profile.types.d.mts +1 -0
- package/dist/types/pages/user-profile/user-profile.types.d.ts +1 -0
- package/dist/types/shared/use-horizontal-scroll-state.d.mts +15 -0
- package/dist/types/shared/use-horizontal-scroll-state.d.ts +15 -0
- package/dist/types/withdraw/index.d.mts +9 -1
- package/dist/types/withdraw/index.d.ts +9 -1
- package/dist/types/withdraw/steps/withdraw-amount.d.mts +10 -1
- package/dist/types/withdraw/steps/withdraw-amount.d.ts +10 -1
- package/dist/types/withdraw/withdraw-modal.types.d.mts +8 -0
- package/dist/types/withdraw/withdraw-modal.types.d.ts +8 -0
- package/package.json +3 -3
package/dist/modals.js
CHANGED
|
@@ -92,6 +92,7 @@ __export(modals_exports, {
|
|
|
92
92
|
ProfileModal: () => ProfileModal,
|
|
93
93
|
ProfileSetupStep: () => ProfileSetupStep,
|
|
94
94
|
WithdrawModal: () => WithdrawModal,
|
|
95
|
+
buildTerminalSummary: () => buildTerminalSummary,
|
|
95
96
|
clearPendingCardSession: () => clearPendingCardSession,
|
|
96
97
|
getPendingCardSession: () => getPendingCardSession
|
|
97
98
|
});
|
|
@@ -6341,6 +6342,28 @@ var WithdrawMethodStep = ({
|
|
|
6341
6342
|
// src/withdraw/steps/withdraw-amount.tsx
|
|
6342
6343
|
var import_hooks28 = require("@agg-build/hooks");
|
|
6343
6344
|
var import_jsx_runtime114 = require("react/jsx-runtime");
|
|
6345
|
+
var formatRawTokenAmount = (rawAmount, decimals) => {
|
|
6346
|
+
if (!rawAmount) return "0";
|
|
6347
|
+
const raw = BigInt(rawAmount);
|
|
6348
|
+
const divisor = BigInt(`1${"0".repeat(decimals)}`);
|
|
6349
|
+
const whole = raw / divisor;
|
|
6350
|
+
const remainder = raw % divisor;
|
|
6351
|
+
if (remainder === BigInt(0)) return whole.toString();
|
|
6352
|
+
return `${whole.toString()}.${remainder.toString().padStart(decimals, "0").replace(/0+$/, "")}`;
|
|
6353
|
+
};
|
|
6354
|
+
var parseTokenAmountToRaw = (amount, decimals) => {
|
|
6355
|
+
const normalizedAmount = amount.trim();
|
|
6356
|
+
if (!normalizedAmount || !/^\d*(?:\.\d*)?$/.test(normalizedAmount)) return null;
|
|
6357
|
+
const [wholePart = "0", fractionalPart = ""] = normalizedAmount.split(".");
|
|
6358
|
+
if (fractionalPart.length > decimals) return null;
|
|
6359
|
+
const normalizedWhole = wholePart === "" ? "0" : wholePart;
|
|
6360
|
+
const normalizedFraction = fractionalPart.padEnd(decimals, "0");
|
|
6361
|
+
try {
|
|
6362
|
+
return `${BigInt(normalizedWhole)}${normalizedFraction}`.replace(/^0+(?=\d)/, "");
|
|
6363
|
+
} catch (e) {
|
|
6364
|
+
return null;
|
|
6365
|
+
}
|
|
6366
|
+
};
|
|
6344
6367
|
var WithdrawAmountStep = ({
|
|
6345
6368
|
amount,
|
|
6346
6369
|
destinationWallet,
|
|
@@ -6349,8 +6372,10 @@ var WithdrawAmountStep = ({
|
|
|
6349
6372
|
networkOptions,
|
|
6350
6373
|
selectedToken,
|
|
6351
6374
|
selectedNetwork,
|
|
6375
|
+
destDecimals,
|
|
6352
6376
|
isConfirming = false,
|
|
6353
6377
|
error,
|
|
6378
|
+
max = false,
|
|
6354
6379
|
onBack,
|
|
6355
6380
|
onAmountChange,
|
|
6356
6381
|
onDestinationChange,
|
|
@@ -6359,18 +6384,31 @@ var WithdrawAmountStep = ({
|
|
|
6359
6384
|
onMaxClick,
|
|
6360
6385
|
onContinue
|
|
6361
6386
|
}) => {
|
|
6387
|
+
var _a, _b, _c, _d;
|
|
6362
6388
|
const labels = (0, import_hooks28.useLabels)();
|
|
6363
6389
|
const SOLANA_CHAIN_ID = "792703809";
|
|
6364
6390
|
const isSolanaDest = selectedNetwork === SOLANA_CHAIN_ID;
|
|
6365
6391
|
const trimmedDestination = destinationWallet.trim();
|
|
6366
6392
|
const isValidAddress = isSolanaDest ? /^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(trimmedDestination) : /^0x[a-fA-F0-9]{40}$/.test(trimmedDestination);
|
|
6367
6393
|
const isValid = Number(amount) > 0 && isValidAddress;
|
|
6368
|
-
const
|
|
6369
|
-
const
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6394
|
+
const amountRaw = amount && Number(amount) > 0 ? parseTokenAmountToRaw(amount, destDecimals) : null;
|
|
6395
|
+
const destinationChainId = Number(selectedNetwork) || null;
|
|
6396
|
+
const preview = (0, import_hooks28.useWithdrawPreview)({
|
|
6397
|
+
amountRaw,
|
|
6398
|
+
tokenSymbol: selectedToken || null,
|
|
6399
|
+
destinationChainId,
|
|
6400
|
+
destinationAddress: trimmedDestination || null,
|
|
6401
|
+
max
|
|
6373
6402
|
});
|
|
6403
|
+
const previewUnviable = ((_a = preview.data) == null ? void 0 : _a.pricingStatus) === "unviable";
|
|
6404
|
+
const previewUnviableMessage = previewUnviable ? ((_b = preview.data) == null ? void 0 : _b.maxDeliverableRaw) != null && BigInt(preview.data.maxDeliverableRaw) > BigInt(0) ? `Amount exceeds your withdrawable balance. Max: ~${formatRawTokenAmount(preview.data.maxDeliverableRaw, destDecimals)} ${selectedToken}` : (_d = (_c = preview.data) == null ? void 0 : _c.unviableReason) != null ? _d : "This amount can't be withdrawn right now." : null;
|
|
6405
|
+
const previewLoading = preview.isFetching;
|
|
6406
|
+
const isDisabled = !isValid || isConfirming || previewUnviable || previewLoading;
|
|
6407
|
+
const withdrawEstimate = preview.data && preview.data.pricingStatus === "quoted" ? {
|
|
6408
|
+
estimatedFees: preview.data.feeRaw != null ? `~${formatRawTokenAmount(preview.data.feeRaw, destDecimals)} ${selectedToken}` : "\u2014",
|
|
6409
|
+
networkReserve: preview.data.networkFeeRaw != null ? `~${formatRawTokenAmount(preview.data.networkFeeRaw, destDecimals)} ${selectedToken}` : "\u2014",
|
|
6410
|
+
youReceive: preview.data.receiveAmountRaw != null ? `~${formatRawTokenAmount(preview.data.receiveAmountRaw, destDecimals)} ${selectedToken}` : "\u2014"
|
|
6411
|
+
} : null;
|
|
6374
6412
|
const shouldShowWithdrawEstimate = Boolean(withdrawEstimate);
|
|
6375
6413
|
return /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(import_jsx_runtime114.Fragment, { children: [
|
|
6376
6414
|
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
|
|
@@ -6473,17 +6511,19 @@ var WithdrawAmountStep = ({
|
|
|
6473
6511
|
)
|
|
6474
6512
|
] })
|
|
6475
6513
|
] }),
|
|
6476
|
-
shouldShowWithdrawEstimate && withdrawEstimate ? /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(TransferFeeSummary, { estimate: withdrawEstimate, view: "withdraw" }) : null
|
|
6514
|
+
shouldShowWithdrawEstimate && withdrawEstimate ? /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(TransferFeeSummary, { estimate: withdrawEstimate, view: "withdraw" }) : null,
|
|
6515
|
+
previewUnviableMessage ? /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("p", { className: "agg-type-label text-agg-error", role: "alert", children: previewUnviableMessage }) : null
|
|
6477
6516
|
] }),
|
|
6478
6517
|
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
|
|
6479
6518
|
Button,
|
|
6480
6519
|
{
|
|
6481
|
-
variant: isValid && !isConfirming ? "primary" : "secondary",
|
|
6520
|
+
variant: isValid && !isConfirming && !previewUnviable && !previewLoading ? "primary" : "secondary",
|
|
6482
6521
|
size: "large",
|
|
6483
6522
|
className: "w-full",
|
|
6484
6523
|
disabled: isDisabled,
|
|
6524
|
+
prefix: previewLoading && !isConfirming ? /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(LoadingIcon, { size: "small", className: "mr-2 text-current" }) : void 0,
|
|
6485
6525
|
onClick: onContinue,
|
|
6486
|
-
children: isConfirming ? labels.common.loading : labels.withdraw.walletFlow.confirm
|
|
6526
|
+
children: isConfirming ? labels.common.loading : previewLoading ? labels.withdraw.walletFlow.calculatingFees : labels.withdraw.walletFlow.confirm
|
|
6487
6527
|
}
|
|
6488
6528
|
),
|
|
6489
6529
|
error ? /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("p", { className: "agg-type-label text-agg-error text-center", role: "alert", children: error }) : null
|
|
@@ -6713,7 +6753,7 @@ var getTokenDecimals = (tokenSymbol, chainId) => {
|
|
|
6713
6753
|
}
|
|
6714
6754
|
return (_a = TOKEN_DECIMALS_BY_SYMBOL[normalizedSymbol]) != null ? _a : DEFAULT_TOKEN_DECIMALS;
|
|
6715
6755
|
};
|
|
6716
|
-
var
|
|
6756
|
+
var formatRawTokenAmount2 = (rawAmount, decimals) => {
|
|
6717
6757
|
const raw = BigInt(rawAmount);
|
|
6718
6758
|
const divisor = BigInt(`1${"0".repeat(decimals)}`);
|
|
6719
6759
|
const whole = raw / divisor;
|
|
@@ -6725,11 +6765,12 @@ var formatLifecycleTokenAmount = ({
|
|
|
6725
6765
|
rawAmount,
|
|
6726
6766
|
tokenSymbol,
|
|
6727
6767
|
chainId
|
|
6728
|
-
}) => `${
|
|
6768
|
+
}) => `${formatRawTokenAmount2(rawAmount, getTokenDecimals(tokenSymbol, chainId))} ${tokenSymbol}`;
|
|
6729
6769
|
var buildTerminalSummary = ({
|
|
6730
6770
|
fallbackSummary,
|
|
6731
6771
|
lifecycleCompletedAmountRaw,
|
|
6732
6772
|
lifecycleRequestedAmountRaw,
|
|
6773
|
+
lifecycleFeeRaw,
|
|
6733
6774
|
tokenSymbol,
|
|
6734
6775
|
chainId
|
|
6735
6776
|
}) => {
|
|
@@ -6739,24 +6780,25 @@ var buildTerminalSummary = ({
|
|
|
6739
6780
|
tokenSymbol,
|
|
6740
6781
|
chainId
|
|
6741
6782
|
});
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
fees: formatLifecycleTokenAmount({
|
|
6752
|
-
rawAmount: feeRaw.toString(),
|
|
6753
|
-
tokenSymbol,
|
|
6754
|
-
chainId
|
|
6755
|
-
})
|
|
6756
|
-
});
|
|
6757
|
-
} catch (e) {
|
|
6758
|
-
return __spreadProps(__spreadValues({}, fallbackSummary), { amountReceived });
|
|
6783
|
+
let feeRaw = lifecycleFeeRaw;
|
|
6784
|
+
if (feeRaw == null && lifecycleRequestedAmountRaw) {
|
|
6785
|
+
try {
|
|
6786
|
+
const r = BigInt(lifecycleRequestedAmountRaw);
|
|
6787
|
+
const c = BigInt(lifecycleCompletedAmountRaw);
|
|
6788
|
+
feeRaw = (r > c ? r - c : BigInt(0)).toString();
|
|
6789
|
+
} catch (e) {
|
|
6790
|
+
feeRaw = null;
|
|
6791
|
+
}
|
|
6759
6792
|
}
|
|
6793
|
+
return __spreadValues(__spreadProps(__spreadValues({}, fallbackSummary), {
|
|
6794
|
+
amountReceived
|
|
6795
|
+
}), feeRaw != null ? {
|
|
6796
|
+
fees: formatLifecycleTokenAmount({
|
|
6797
|
+
rawAmount: feeRaw,
|
|
6798
|
+
tokenSymbol,
|
|
6799
|
+
chainId
|
|
6800
|
+
})
|
|
6801
|
+
} : {});
|
|
6760
6802
|
};
|
|
6761
6803
|
function isControlledWithdrawModalProps(props) {
|
|
6762
6804
|
return "withdrawFlow" in props;
|
|
@@ -6860,6 +6902,7 @@ function WithdrawModalControlled({
|
|
|
6860
6902
|
fallbackSummary: withdrawFlow.purchaseSummary,
|
|
6861
6903
|
lifecycleCompletedAmountRaw: withdrawalLifecycleState.completedAmountRaw,
|
|
6862
6904
|
lifecycleRequestedAmountRaw: withdrawalLifecycleState.requestedAmountRaw,
|
|
6905
|
+
lifecycleFeeRaw: withdrawalLifecycleState.feeRaw,
|
|
6863
6906
|
tokenSymbol: withdrawFlow.selectedToken,
|
|
6864
6907
|
chainId: withdrawFlow.selectedNetwork
|
|
6865
6908
|
});
|
|
@@ -6881,8 +6924,13 @@ function WithdrawModalControlled({
|
|
|
6881
6924
|
networkOptions: withdrawNetworkOptions,
|
|
6882
6925
|
selectedToken: withdrawFlow.selectedToken,
|
|
6883
6926
|
selectedNetwork: withdrawFlow.selectedNetwork,
|
|
6927
|
+
destDecimals: getTokenDecimals(
|
|
6928
|
+
withdrawFlow.selectedToken,
|
|
6929
|
+
withdrawFlow.selectedNetwork
|
|
6930
|
+
),
|
|
6884
6931
|
isConfirming,
|
|
6885
6932
|
error: confirmError,
|
|
6933
|
+
max: withdrawFlow.isMax,
|
|
6886
6934
|
onBack: handleBack,
|
|
6887
6935
|
onAmountChange: onWithdrawAmountChange,
|
|
6888
6936
|
onDestinationChange: onWithdrawDestinationChange,
|
|
@@ -6923,7 +6971,7 @@ var WithdrawModal = (props) => {
|
|
|
6923
6971
|
WithdrawModal.displayName = "WithdrawModal";
|
|
6924
6972
|
|
|
6925
6973
|
// src/onboarding/index.tsx
|
|
6926
|
-
var
|
|
6974
|
+
var import_react16 = require("react");
|
|
6927
6975
|
var import_hooks37 = require("@agg-build/hooks");
|
|
6928
6976
|
var Dialog4 = __toESM(require("@radix-ui/react-dialog"));
|
|
6929
6977
|
|
|
@@ -7026,7 +7074,7 @@ var HowItWorksStep = ({ onContinue, icons }) => {
|
|
|
7026
7074
|
HowItWorksStep.displayName = "HowItWorksStep";
|
|
7027
7075
|
|
|
7028
7076
|
// src/onboarding/steps/profile-setup.tsx
|
|
7029
|
-
var
|
|
7077
|
+
var import_react13 = require("react");
|
|
7030
7078
|
var import_hooks33 = require("@agg-build/hooks");
|
|
7031
7079
|
|
|
7032
7080
|
// src/primitives/venue-logo/index.tsx
|
|
@@ -7106,7 +7154,37 @@ VenueLogo.displayName = "VenueLogo";
|
|
|
7106
7154
|
|
|
7107
7155
|
// src/primitives/tabs/index.tsx
|
|
7108
7156
|
var import_hooks32 = require("@agg-build/hooks");
|
|
7157
|
+
var import_react11 = require("react");
|
|
7158
|
+
|
|
7159
|
+
// src/shared/use-horizontal-scroll-state.ts
|
|
7109
7160
|
var import_react10 = require("react");
|
|
7161
|
+
var useHorizontalScrollState = () => {
|
|
7162
|
+
const containerRef = (0, import_react10.useRef)(null);
|
|
7163
|
+
const [canScrollLeft, setCanScrollLeft] = (0, import_react10.useState)(false);
|
|
7164
|
+
const [canScrollRight, setCanScrollRight] = (0, import_react10.useState)(false);
|
|
7165
|
+
const update = (0, import_react10.useCallback)(() => {
|
|
7166
|
+
const el = containerRef.current;
|
|
7167
|
+
if (!el) return;
|
|
7168
|
+
const maxScroll = el.scrollWidth - el.clientWidth;
|
|
7169
|
+
setCanScrollLeft(el.scrollLeft > 4);
|
|
7170
|
+
setCanScrollRight(maxScroll - el.scrollLeft > 4);
|
|
7171
|
+
}, []);
|
|
7172
|
+
(0, import_react10.useEffect)(() => {
|
|
7173
|
+
const el = containerRef.current;
|
|
7174
|
+
if (!el) return;
|
|
7175
|
+
el.addEventListener("scroll", update, { passive: true });
|
|
7176
|
+
return () => el.removeEventListener("scroll", update);
|
|
7177
|
+
}, [update]);
|
|
7178
|
+
(0, import_react10.useEffect)(() => {
|
|
7179
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
7180
|
+
const el = containerRef.current;
|
|
7181
|
+
if (!el) return;
|
|
7182
|
+
const ro = new ResizeObserver(() => update());
|
|
7183
|
+
ro.observe(el);
|
|
7184
|
+
return () => ro.disconnect();
|
|
7185
|
+
}, [update]);
|
|
7186
|
+
return { containerRef, canScrollLeft, canScrollRight, update };
|
|
7187
|
+
};
|
|
7110
7188
|
|
|
7111
7189
|
// src/primitives/tabs/tabs.constants.ts
|
|
7112
7190
|
var MOBILE_TABS_MEDIA_QUERY = "(max-width: 736px)";
|
|
@@ -7180,8 +7258,8 @@ var Tabs = ({
|
|
|
7180
7258
|
const {
|
|
7181
7259
|
features: { enableAnimations }
|
|
7182
7260
|
} = (0, import_hooks32.useSdkUiConfig)();
|
|
7183
|
-
const buttonRefs = (0,
|
|
7184
|
-
const dragStateRef = (0,
|
|
7261
|
+
const buttonRefs = (0, import_react11.useRef)([]);
|
|
7262
|
+
const dragStateRef = (0, import_react11.useRef)({
|
|
7185
7263
|
isPointerDown: false,
|
|
7186
7264
|
isDragging: false,
|
|
7187
7265
|
pointerId: null,
|
|
@@ -7189,29 +7267,30 @@ var Tabs = ({
|
|
|
7189
7267
|
startClientY: 0,
|
|
7190
7268
|
startScrollLeft: 0
|
|
7191
7269
|
});
|
|
7192
|
-
const suppressClickRef = (0,
|
|
7270
|
+
const suppressClickRef = (0, import_react11.useRef)(false);
|
|
7193
7271
|
const resolvedAriaLabel = ariaLabel != null ? ariaLabel : labels.common.tabsAria;
|
|
7194
|
-
const [isMobileViewport, setIsMobileViewport] = (0,
|
|
7195
|
-
const [isDraggingTabs, setIsDraggingTabs] = (0,
|
|
7196
|
-
const [activeUnderlineStyle, setActiveUnderlineStyle] = (0,
|
|
7272
|
+
const [isMobileViewport, setIsMobileViewport] = (0, import_react11.useState)(false);
|
|
7273
|
+
const [isDraggingTabs, setIsDraggingTabs] = (0, import_react11.useState)(false);
|
|
7274
|
+
const [activeUnderlineStyle, setActiveUnderlineStyle] = (0, import_react11.useState)({
|
|
7197
7275
|
transform: "translateX(0px)",
|
|
7198
7276
|
width: 0,
|
|
7199
7277
|
opacity: 0
|
|
7200
7278
|
});
|
|
7201
|
-
const
|
|
7202
|
-
|
|
7203
|
-
|
|
7204
|
-
|
|
7205
|
-
|
|
7279
|
+
const {
|
|
7280
|
+
containerRef: tabListRef,
|
|
7281
|
+
canScrollLeft,
|
|
7282
|
+
canScrollRight,
|
|
7283
|
+
update: updateScrollState
|
|
7284
|
+
} = useHorizontalScrollState();
|
|
7206
7285
|
const isBarVariant = variant === "bar";
|
|
7207
|
-
const resolvedOverflowBehavior = (0,
|
|
7286
|
+
const resolvedOverflowBehavior = (0, import_react11.useMemo)(() => {
|
|
7208
7287
|
if (overflowBehavior) return overflowBehavior;
|
|
7209
7288
|
if (!isBarVariant) return "scroll";
|
|
7210
7289
|
return isMobileViewport ? "select" : "scroll";
|
|
7211
7290
|
}, [isBarVariant, isMobileViewport, overflowBehavior]);
|
|
7212
7291
|
const shouldUseOverflowScroll = resolvedOverflowBehavior === "scroll";
|
|
7213
7292
|
const shouldUseOverflowSelect = resolvedOverflowBehavior === "select";
|
|
7214
|
-
(0,
|
|
7293
|
+
(0, import_react11.useEffect)(() => {
|
|
7215
7294
|
if (typeof window === "undefined") return;
|
|
7216
7295
|
const mediaQueryList = window.matchMedia(MOBILE_TABS_MEDIA_QUERY);
|
|
7217
7296
|
const handleMediaQueryChange = (event) => {
|
|
@@ -7229,28 +7308,12 @@ var Tabs = ({
|
|
|
7229
7308
|
mediaQueryList.removeListener(handleMediaQueryChange);
|
|
7230
7309
|
};
|
|
7231
7310
|
}, []);
|
|
7232
|
-
const
|
|
7233
|
-
if (!shouldUseOverflowScroll) {
|
|
7234
|
-
setScrollAffordanceState({
|
|
7235
|
-
showStart: false,
|
|
7236
|
-
showEnd: false
|
|
7237
|
-
});
|
|
7238
|
-
return;
|
|
7239
|
-
}
|
|
7240
|
-
const tabListElement = tabListRef.current;
|
|
7241
|
-
if (!tabListElement) return;
|
|
7242
|
-
const maxScrollLeft = tabListElement.scrollWidth - tabListElement.clientWidth;
|
|
7243
|
-
setScrollAffordanceState({
|
|
7244
|
-
showStart: tabListElement.scrollLeft > 4,
|
|
7245
|
-
showEnd: maxScrollLeft - tabListElement.scrollLeft > 4
|
|
7246
|
-
});
|
|
7247
|
-
}, [shouldUseOverflowScroll]);
|
|
7248
|
-
const renderedItems = (0, import_react10.useMemo)(() => {
|
|
7311
|
+
const renderedItems = (0, import_react11.useMemo)(() => {
|
|
7249
7312
|
return items.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
7250
7313
|
disabled: item.disabled || item.isComingSoon
|
|
7251
7314
|
}));
|
|
7252
7315
|
}, [items]);
|
|
7253
|
-
const selectItems = (0,
|
|
7316
|
+
const selectItems = (0, import_react11.useMemo)(() => {
|
|
7254
7317
|
return renderedItems.map((item) => ({
|
|
7255
7318
|
value: item.value,
|
|
7256
7319
|
label: item.isComingSoon ? `${item.label} (soon)` : item.label,
|
|
@@ -7383,7 +7446,7 @@ var Tabs = ({
|
|
|
7383
7446
|
event == null ? void 0 : event.stopPropagation();
|
|
7384
7447
|
suppressClickRef.current = false;
|
|
7385
7448
|
};
|
|
7386
|
-
const updateActiveUnderline = (0,
|
|
7449
|
+
const updateActiveUnderline = (0, import_react11.useCallback)(() => {
|
|
7387
7450
|
if (isBarVariant) {
|
|
7388
7451
|
setActiveUnderlineStyle({
|
|
7389
7452
|
transform: "translateX(0px)",
|
|
@@ -7406,42 +7469,39 @@ var Tabs = ({
|
|
|
7406
7469
|
opacity: 1
|
|
7407
7470
|
});
|
|
7408
7471
|
}, [isBarVariant, renderedItems, value]);
|
|
7409
|
-
(0,
|
|
7472
|
+
(0, import_react11.useLayoutEffect)(() => {
|
|
7410
7473
|
updateActiveUnderline();
|
|
7411
7474
|
}, [updateActiveUnderline]);
|
|
7412
|
-
(0,
|
|
7475
|
+
(0, import_react11.useEffect)(() => {
|
|
7413
7476
|
if (isBarVariant || !shouldUseOverflowScroll) return;
|
|
7414
7477
|
const tabListElement = tabListRef.current;
|
|
7415
7478
|
if (!tabListElement) return;
|
|
7416
7479
|
const handleScroll = () => {
|
|
7417
7480
|
updateActiveUnderline();
|
|
7418
|
-
updateScrollAffordances();
|
|
7419
7481
|
};
|
|
7420
7482
|
tabListElement.addEventListener("scroll", handleScroll, { passive: true });
|
|
7421
|
-
updateScrollAffordances();
|
|
7422
7483
|
return () => {
|
|
7423
7484
|
tabListElement.removeEventListener("scroll", handleScroll);
|
|
7424
7485
|
};
|
|
7425
|
-
}, [isBarVariant, shouldUseOverflowScroll,
|
|
7426
|
-
(0,
|
|
7486
|
+
}, [isBarVariant, shouldUseOverflowScroll, tabListRef, updateActiveUnderline]);
|
|
7487
|
+
(0, import_react11.useEffect)(() => {
|
|
7427
7488
|
if (!shouldUseOverflowScroll) return;
|
|
7428
|
-
|
|
7429
|
-
}, [renderedItems, shouldUseOverflowScroll,
|
|
7430
|
-
(0,
|
|
7431
|
-
if (isBarVariant
|
|
7489
|
+
updateScrollState();
|
|
7490
|
+
}, [renderedItems, shouldUseOverflowScroll, updateScrollState, value]);
|
|
7491
|
+
(0, import_react11.useEffect)(() => {
|
|
7492
|
+
if (isBarVariant || !shouldUseOverflowScroll) return;
|
|
7432
7493
|
if (typeof ResizeObserver === "undefined") return;
|
|
7433
7494
|
const tabListElement = tabListRef.current;
|
|
7434
7495
|
if (!tabListElement) return;
|
|
7435
7496
|
const resizeObserver = new ResizeObserver(() => {
|
|
7436
7497
|
updateActiveUnderline();
|
|
7437
|
-
updateScrollAffordances();
|
|
7438
7498
|
});
|
|
7439
7499
|
resizeObserver.observe(tabListElement);
|
|
7440
7500
|
return () => {
|
|
7441
7501
|
resizeObserver.disconnect();
|
|
7442
7502
|
};
|
|
7443
|
-
}, [isBarVariant, shouldUseOverflowScroll,
|
|
7444
|
-
(0,
|
|
7503
|
+
}, [isBarVariant, shouldUseOverflowScroll, tabListRef, updateActiveUnderline]);
|
|
7504
|
+
(0, import_react11.useEffect)(() => {
|
|
7445
7505
|
if (!shouldUseOverflowScroll) return;
|
|
7446
7506
|
const tabListElement = tabListRef.current;
|
|
7447
7507
|
if (!tabListElement) return;
|
|
@@ -7588,7 +7648,7 @@ var Tabs = ({
|
|
|
7588
7648
|
"agg-tab-scroll-start",
|
|
7589
7649
|
"pointer-events-none absolute top-0 bottom-0 left-0 z-10 w-12 md:w-18 bg-linear-to-r from-agg-secondary via-agg-secondary to-transparent",
|
|
7590
7650
|
getMotionClassName(enableAnimations, "transition-opacity duration-200"),
|
|
7591
|
-
|
|
7651
|
+
canScrollLeft ? "opacity-100" : "opacity-0"
|
|
7592
7652
|
)
|
|
7593
7653
|
}
|
|
7594
7654
|
),
|
|
@@ -7600,24 +7660,63 @@ var Tabs = ({
|
|
|
7600
7660
|
"agg-tab-scroll-end",
|
|
7601
7661
|
"pointer-events-none absolute top-0 right-0 bottom-0 z-10 w-12 md:w-18 bg-linear-to-l from-agg-secondary via-agg-secondary to-transparent",
|
|
7602
7662
|
getMotionClassName(enableAnimations, "transition-opacity duration-200"),
|
|
7603
|
-
|
|
7663
|
+
canScrollRight ? "opacity-100" : "opacity-0"
|
|
7604
7664
|
)
|
|
7605
7665
|
}
|
|
7606
7666
|
)
|
|
7607
7667
|
] }) : null,
|
|
7608
|
-
shouldUseOverflowScroll && isBarVariant ? /* @__PURE__ */ (0, import_jsx_runtime119.
|
|
7609
|
-
|
|
7610
|
-
|
|
7611
|
-
|
|
7612
|
-
|
|
7613
|
-
"
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7668
|
+
shouldUseOverflowScroll && isBarVariant ? /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(import_jsx_runtime119.Fragment, { children: [
|
|
7669
|
+
/* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
7670
|
+
"button",
|
|
7671
|
+
{
|
|
7672
|
+
type: "button",
|
|
7673
|
+
"aria-label": labels.common.scrollTabsLeft,
|
|
7674
|
+
tabIndex: -1,
|
|
7675
|
+
className: cn(
|
|
7676
|
+
"agg-tab-scroll-start",
|
|
7677
|
+
"absolute top-0 bottom-0 left-0 z-10 w-20 rounded-l-agg-lg",
|
|
7678
|
+
"inline-flex items-center justify-start pl-2",
|
|
7679
|
+
"bg-linear-to-r from-agg-secondary from-[25%] via-agg-secondary/80 to-transparent",
|
|
7680
|
+
"cursor-pointer",
|
|
7681
|
+
getMotionClassName(enableAnimations, "transition-opacity duration-200"),
|
|
7682
|
+
canScrollLeft ? "opacity-100" : "opacity-0 pointer-events-none"
|
|
7683
|
+
),
|
|
7684
|
+
onClick: () => {
|
|
7685
|
+
var _a;
|
|
7686
|
+
(_a = tabListRef.current) == null ? void 0 : _a.scrollBy({
|
|
7687
|
+
left: -200,
|
|
7688
|
+
behavior: getScrollBehavior(enableAnimations)
|
|
7689
|
+
});
|
|
7690
|
+
},
|
|
7691
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(Icon, { name: "chevron-left", size: "small", color: "currentColor" })
|
|
7692
|
+
}
|
|
7693
|
+
),
|
|
7694
|
+
/* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
7695
|
+
"button",
|
|
7696
|
+
{
|
|
7697
|
+
type: "button",
|
|
7698
|
+
"aria-label": labels.common.scrollTabsRight,
|
|
7699
|
+
tabIndex: -1,
|
|
7700
|
+
className: cn(
|
|
7701
|
+
"agg-tab-scroll-end",
|
|
7702
|
+
"absolute top-0 right-0 bottom-0 z-10 w-20 rounded-r-agg-lg",
|
|
7703
|
+
"inline-flex items-center justify-end pr-2",
|
|
7704
|
+
"bg-linear-to-l from-agg-secondary from-[25%] via-agg-secondary/80 to-transparent",
|
|
7705
|
+
"cursor-pointer",
|
|
7706
|
+
getMotionClassName(enableAnimations, "transition-opacity duration-200"),
|
|
7707
|
+
canScrollRight ? "opacity-100" : "opacity-0 pointer-events-none"
|
|
7708
|
+
),
|
|
7709
|
+
onClick: () => {
|
|
7710
|
+
var _a;
|
|
7711
|
+
(_a = tabListRef.current) == null ? void 0 : _a.scrollBy({
|
|
7712
|
+
left: 200,
|
|
7713
|
+
behavior: getScrollBehavior(enableAnimations)
|
|
7714
|
+
});
|
|
7715
|
+
},
|
|
7716
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(Icon, { name: "chevron-right", size: "small", color: "currentColor" })
|
|
7717
|
+
}
|
|
7718
|
+
)
|
|
7719
|
+
] }) : null
|
|
7621
7720
|
]
|
|
7622
7721
|
}
|
|
7623
7722
|
);
|
|
@@ -7626,26 +7725,26 @@ Tabs.displayName = "Tabs";
|
|
|
7626
7725
|
|
|
7627
7726
|
// src/primitives/toast/index.tsx
|
|
7628
7727
|
var RadixToast = __toESM(require("@radix-ui/react-toast"));
|
|
7629
|
-
var
|
|
7728
|
+
var import_react12 = require("react");
|
|
7630
7729
|
var import_jsx_runtime120 = require("react/jsx-runtime");
|
|
7631
|
-
var ToastContext = (0,
|
|
7730
|
+
var ToastContext = (0, import_react12.createContext)(null);
|
|
7632
7731
|
function useOptionalToast() {
|
|
7633
|
-
return (0,
|
|
7732
|
+
return (0, import_react12.useContext)(ToastContext);
|
|
7634
7733
|
}
|
|
7635
7734
|
|
|
7636
7735
|
// src/onboarding/steps/profile-setup.tsx
|
|
7637
7736
|
var import_jsx_runtime121 = require("react/jsx-runtime");
|
|
7638
7737
|
var ProfileSetupStep = ({ onContinue }) => {
|
|
7639
7738
|
const labels = (0, import_hooks33.useLabels)();
|
|
7640
|
-
const [username, setUsername] = (0,
|
|
7641
|
-
const [avatarFile, setAvatarFile] = (0,
|
|
7642
|
-
const [avatarPreview, setAvatarPreview] = (0,
|
|
7643
|
-
const fileInputRef = (0,
|
|
7644
|
-
const handleAvatarClick = (0,
|
|
7739
|
+
const [username, setUsername] = (0, import_react13.useState)("");
|
|
7740
|
+
const [avatarFile, setAvatarFile] = (0, import_react13.useState)();
|
|
7741
|
+
const [avatarPreview, setAvatarPreview] = (0, import_react13.useState)();
|
|
7742
|
+
const fileInputRef = (0, import_react13.useRef)(null);
|
|
7743
|
+
const handleAvatarClick = (0, import_react13.useCallback)(() => {
|
|
7645
7744
|
var _a;
|
|
7646
7745
|
(_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
7647
7746
|
}, []);
|
|
7648
|
-
const handleFileChange = (0,
|
|
7747
|
+
const handleFileChange = (0, import_react13.useCallback)((e) => {
|
|
7649
7748
|
var _a;
|
|
7650
7749
|
const file = (_a = e.target.files) == null ? void 0 : _a[0];
|
|
7651
7750
|
if (!file) return;
|
|
@@ -7657,7 +7756,7 @@ var ProfileSetupStep = ({ onContinue }) => {
|
|
|
7657
7756
|
};
|
|
7658
7757
|
reader.readAsDataURL(file);
|
|
7659
7758
|
}, []);
|
|
7660
|
-
const handleContinue = (0,
|
|
7759
|
+
const handleContinue = (0, import_react13.useCallback)(() => {
|
|
7661
7760
|
onContinue({
|
|
7662
7761
|
username,
|
|
7663
7762
|
avatarFile,
|
|
@@ -7899,7 +7998,7 @@ ConnectAccountsStep.displayName = "ConnectAccountsStep";
|
|
|
7899
7998
|
|
|
7900
7999
|
// src/onboarding/steps/connect-kalshi-modal.tsx
|
|
7901
8000
|
var import_sdk12 = require("@agg-build/sdk");
|
|
7902
|
-
var
|
|
8001
|
+
var import_react14 = require("react");
|
|
7903
8002
|
var import_hooks35 = require("@agg-build/hooks");
|
|
7904
8003
|
var Dialog2 = __toESM(require("@radix-ui/react-dialog"));
|
|
7905
8004
|
var import_jsx_runtime123 = require("react/jsx-runtime");
|
|
@@ -7909,15 +8008,15 @@ var ConnectKalshiModal = ({
|
|
|
7909
8008
|
onVerify
|
|
7910
8009
|
}) => {
|
|
7911
8010
|
const labels = (0, import_hooks35.useLabels)();
|
|
7912
|
-
const [apiKeyId, setApiKeyId] = (0,
|
|
7913
|
-
const [privateKey, setPrivateKey] = (0,
|
|
7914
|
-
const [verifying, setVerifying] = (0,
|
|
7915
|
-
const [error, setError] = (0,
|
|
8011
|
+
const [apiKeyId, setApiKeyId] = (0, import_react14.useState)("");
|
|
8012
|
+
const [privateKey, setPrivateKey] = (0, import_react14.useState)("");
|
|
8013
|
+
const [verifying, setVerifying] = (0, import_react14.useState)(false);
|
|
8014
|
+
const [error, setError] = (0, import_react14.useState)();
|
|
7916
8015
|
const canVerify = apiKeyId.trim().length > 0 && privateKey.trim().length > 0;
|
|
7917
|
-
const handleCancel = (0,
|
|
8016
|
+
const handleCancel = (0, import_react14.useCallback)(() => {
|
|
7918
8017
|
onOpenChange(false);
|
|
7919
8018
|
}, [onOpenChange]);
|
|
7920
|
-
const handleVerify = (0,
|
|
8019
|
+
const handleVerify = (0, import_react14.useCallback)(() => __async(null, null, function* () {
|
|
7921
8020
|
if (!canVerify || verifying) return;
|
|
7922
8021
|
setVerifying(true);
|
|
7923
8022
|
setError(void 0);
|
|
@@ -7946,7 +8045,7 @@ var ConnectKalshiModal = ({
|
|
|
7946
8045
|
privateKey,
|
|
7947
8046
|
verifying
|
|
7948
8047
|
]);
|
|
7949
|
-
const handleOpenChange = (0,
|
|
8048
|
+
const handleOpenChange = (0, import_react14.useCallback)(
|
|
7950
8049
|
(value) => {
|
|
7951
8050
|
if (value) {
|
|
7952
8051
|
setApiKeyId("");
|
|
@@ -8149,7 +8248,7 @@ var ConnectKalshiModal = ({
|
|
|
8149
8248
|
ConnectKalshiModal.displayName = "ConnectKalshiModal";
|
|
8150
8249
|
|
|
8151
8250
|
// src/onboarding/steps/connect-onchain-modal.tsx
|
|
8152
|
-
var
|
|
8251
|
+
var import_react15 = require("react");
|
|
8153
8252
|
var import_hooks36 = require("@agg-build/hooks");
|
|
8154
8253
|
var Dialog3 = __toESM(require("@radix-ui/react-dialog"));
|
|
8155
8254
|
var import_jsx_runtime124 = require("react/jsx-runtime");
|
|
@@ -8159,12 +8258,12 @@ var ConnectOnchainModal = ({
|
|
|
8159
8258
|
onConnect
|
|
8160
8259
|
}) => {
|
|
8161
8260
|
const labels = (0, import_hooks36.useLabels)();
|
|
8162
|
-
const [connecting, setConnecting] = (0,
|
|
8163
|
-
const [error, setError] = (0,
|
|
8164
|
-
const handleCancel = (0,
|
|
8261
|
+
const [connecting, setConnecting] = (0, import_react15.useState)(false);
|
|
8262
|
+
const [error, setError] = (0, import_react15.useState)();
|
|
8263
|
+
const handleCancel = (0, import_react15.useCallback)(() => {
|
|
8165
8264
|
onOpenChange(false);
|
|
8166
8265
|
}, [onOpenChange]);
|
|
8167
|
-
const handleConnect = (0,
|
|
8266
|
+
const handleConnect = (0, import_react15.useCallback)(() => __async(null, null, function* () {
|
|
8168
8267
|
if (connecting) return;
|
|
8169
8268
|
setConnecting(true);
|
|
8170
8269
|
setError(void 0);
|
|
@@ -8179,7 +8278,7 @@ var ConnectOnchainModal = ({
|
|
|
8179
8278
|
setConnecting(false);
|
|
8180
8279
|
}
|
|
8181
8280
|
}), [connecting, labels.onboarding.connectOnchainModal.fallbackError, onConnect, onOpenChange]);
|
|
8182
|
-
const handleOpenChange = (0,
|
|
8281
|
+
const handleOpenChange = (0, import_react15.useCallback)(
|
|
8183
8282
|
(value) => {
|
|
8184
8283
|
if (value) {
|
|
8185
8284
|
setError(void 0);
|
|
@@ -8271,48 +8370,48 @@ var OnboardingModal = ({
|
|
|
8271
8370
|
}) => {
|
|
8272
8371
|
var _a;
|
|
8273
8372
|
const labels = (0, import_hooks37.useLabels)();
|
|
8274
|
-
const [step, setStep] = (0,
|
|
8373
|
+
const [step, setStep] = (0, import_react16.useState)(ONBOARDING_STEPS.HOW_IT_WORKS);
|
|
8275
8374
|
const stepLabels = {
|
|
8276
8375
|
[ONBOARDING_STEPS.HOW_IT_WORKS]: labels.onboarding.modal.stepHowItWorks,
|
|
8277
8376
|
[ONBOARDING_STEPS.PROFILE_SETUP]: labels.onboarding.modal.stepProfileSetup,
|
|
8278
8377
|
[ONBOARDING_STEPS.CONNECT_ACCOUNTS]: labels.onboarding.modal.stepConnectAccounts
|
|
8279
8378
|
};
|
|
8280
8379
|
const resolvedTitle = (_a = stepLabels[step]) != null ? _a : labels.onboarding.modal.title;
|
|
8281
|
-
const [kalshiModalOpen, setKalshiModalOpen] = (0,
|
|
8282
|
-
const [kalshiConnected, setKalshiConnected] = (0,
|
|
8283
|
-
const [onchainModalOpen, setOnchainModalOpen] = (0,
|
|
8284
|
-
const [onchainConnected, setOnchainConnected] = (0,
|
|
8285
|
-
(0,
|
|
8380
|
+
const [kalshiModalOpen, setKalshiModalOpen] = (0, import_react16.useState)(false);
|
|
8381
|
+
const [kalshiConnected, setKalshiConnected] = (0, import_react16.useState)(false);
|
|
8382
|
+
const [onchainModalOpen, setOnchainModalOpen] = (0, import_react16.useState)(false);
|
|
8383
|
+
const [onchainConnected, setOnchainConnected] = (0, import_react16.useState)(false);
|
|
8384
|
+
(0, import_react16.useEffect)(() => {
|
|
8286
8385
|
if (open) {
|
|
8287
8386
|
setStep(ONBOARDING_STEPS.HOW_IT_WORKS);
|
|
8288
8387
|
setKalshiConnected(false);
|
|
8289
8388
|
setOnchainConnected(false);
|
|
8290
8389
|
}
|
|
8291
8390
|
}, [open]);
|
|
8292
|
-
const handleHowItWorksContinue = (0,
|
|
8391
|
+
const handleHowItWorksContinue = (0, import_react16.useCallback)(() => {
|
|
8293
8392
|
setStep(ONBOARDING_STEPS.PROFILE_SETUP);
|
|
8294
8393
|
}, []);
|
|
8295
|
-
const handleProfileContinue = (0,
|
|
8394
|
+
const handleProfileContinue = (0, import_react16.useCallback)(
|
|
8296
8395
|
(data) => {
|
|
8297
8396
|
onProfileSubmit == null ? void 0 : onProfileSubmit(data);
|
|
8298
8397
|
setStep(ONBOARDING_STEPS.CONNECT_ACCOUNTS);
|
|
8299
8398
|
},
|
|
8300
8399
|
[onProfileSubmit]
|
|
8301
8400
|
);
|
|
8302
|
-
const handleConnectContinue = (0,
|
|
8401
|
+
const handleConnectContinue = (0, import_react16.useCallback)(() => {
|
|
8303
8402
|
onComplete == null ? void 0 : onComplete();
|
|
8304
8403
|
}, [onComplete]);
|
|
8305
|
-
const handleOpenOnchainModal = (0,
|
|
8404
|
+
const handleOpenOnchainModal = (0, import_react16.useCallback)(() => {
|
|
8306
8405
|
setOnchainModalOpen(true);
|
|
8307
8406
|
}, []);
|
|
8308
|
-
const handleOnchainConnect = (0,
|
|
8407
|
+
const handleOnchainConnect = (0, import_react16.useCallback)(() => __async(null, null, function* () {
|
|
8309
8408
|
yield onConnectOnchain == null ? void 0 : onConnectOnchain();
|
|
8310
8409
|
setOnchainConnected(true);
|
|
8311
8410
|
}), [onConnectOnchain]);
|
|
8312
|
-
const handleOpenKalshiModal = (0,
|
|
8411
|
+
const handleOpenKalshiModal = (0, import_react16.useCallback)(() => {
|
|
8313
8412
|
setKalshiModalOpen(true);
|
|
8314
8413
|
}, []);
|
|
8315
|
-
const handleKalshiVerify = (0,
|
|
8414
|
+
const handleKalshiVerify = (0, import_react16.useCallback)(
|
|
8316
8415
|
(credentials) => __async(null, null, function* () {
|
|
8317
8416
|
yield onConnectKalshi == null ? void 0 : onConnectKalshi(credentials);
|
|
8318
8417
|
setKalshiConnected(true);
|
|
@@ -8366,7 +8465,7 @@ var OnboardingModal = ({
|
|
|
8366
8465
|
OnboardingModal.displayName = "OnboardingModal";
|
|
8367
8466
|
|
|
8368
8467
|
// src/profile/index.tsx
|
|
8369
|
-
var
|
|
8468
|
+
var import_react19 = require("react");
|
|
8370
8469
|
var import_hooks40 = require("@agg-build/hooks");
|
|
8371
8470
|
|
|
8372
8471
|
// src/profile/profile-modal.constants.ts
|
|
@@ -8384,7 +8483,7 @@ var PROFILE_TAB_ITEMS = [
|
|
|
8384
8483
|
];
|
|
8385
8484
|
|
|
8386
8485
|
// src/profile/tabs/about-tab.tsx
|
|
8387
|
-
var
|
|
8486
|
+
var import_react17 = require("react");
|
|
8388
8487
|
var import_hooks38 = require("@agg-build/hooks");
|
|
8389
8488
|
var import_jsx_runtime126 = require("react/jsx-runtime");
|
|
8390
8489
|
var AboutTab = ({
|
|
@@ -8397,12 +8496,12 @@ var AboutTab = ({
|
|
|
8397
8496
|
avatarError: _avatarError
|
|
8398
8497
|
}) => {
|
|
8399
8498
|
const labels = (0, import_hooks38.useLabels)();
|
|
8400
|
-
const fileInputRef = (0,
|
|
8401
|
-
const handleAvatarClick = (0,
|
|
8499
|
+
const fileInputRef = (0, import_react17.useRef)(null);
|
|
8500
|
+
const handleAvatarClick = (0, import_react17.useCallback)(() => {
|
|
8402
8501
|
var _a;
|
|
8403
8502
|
(_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
8404
8503
|
}, []);
|
|
8405
|
-
const handleFileChange = (0,
|
|
8504
|
+
const handleFileChange = (0, import_react17.useCallback)(
|
|
8406
8505
|
(e) => {
|
|
8407
8506
|
var _a;
|
|
8408
8507
|
const file = (_a = e.target.files) == null ? void 0 : _a[0];
|
|
@@ -8649,9 +8748,9 @@ var AccountsWalletsTab = ({
|
|
|
8649
8748
|
)
|
|
8650
8749
|
] })
|
|
8651
8750
|
] }),
|
|
8652
|
-
/* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", { className: "agg-wallets-section flex flex-col gap-3", children: [
|
|
8751
|
+
wallets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", { className: "agg-wallets-section flex flex-col gap-3", children: [
|
|
8653
8752
|
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)(SectionTitle, { children: "Wallets" }),
|
|
8654
|
-
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", { className: "flex flex-col gap-2", children: wallets.
|
|
8753
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", { className: "flex flex-col gap-2", children: wallets.map((wallet) => {
|
|
8655
8754
|
var _a;
|
|
8656
8755
|
return /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(AccountRow, { className: "gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
8657
8756
|
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
|
|
@@ -8664,15 +8763,15 @@ var AccountsWalletsTab = ({
|
|
|
8664
8763
|
),
|
|
8665
8764
|
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)(VerifiedBadge, {})
|
|
8666
8765
|
] }) }, `${wallet.chain}:${wallet.address}`);
|
|
8667
|
-
})
|
|
8668
|
-
] })
|
|
8766
|
+
}) })
|
|
8767
|
+
] }) : null
|
|
8669
8768
|
] });
|
|
8670
8769
|
};
|
|
8671
8770
|
AccountsWalletsTab.displayName = "AccountsWalletsTab";
|
|
8672
8771
|
|
|
8673
8772
|
// src/profile/tabs/trading-access-tab.tsx
|
|
8674
8773
|
var import_hooks39 = require("@agg-build/hooks");
|
|
8675
|
-
var
|
|
8774
|
+
var import_react18 = require("react");
|
|
8676
8775
|
var import_jsx_runtime128 = require("react/jsx-runtime");
|
|
8677
8776
|
var TRADING_ACCESS_VENUES = [
|
|
8678
8777
|
"kalshi",
|
|
@@ -8700,13 +8799,13 @@ var AccessRow = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime128.jsx)
|
|
|
8700
8799
|
var VerifyIdentityButton = ({ onError }) => {
|
|
8701
8800
|
const labels = (0, import_hooks39.useLabels)();
|
|
8702
8801
|
const client = (0, import_hooks39.useAggClient)();
|
|
8703
|
-
const [isInitiating, setIsInitiating] = (0,
|
|
8704
|
-
const [needsDepositAddress, setNeedsDepositAddress] = (0,
|
|
8802
|
+
const [isInitiating, setIsInitiating] = (0, import_react18.useState)(false);
|
|
8803
|
+
const [needsDepositAddress, setNeedsDepositAddress] = (0, import_react18.useState)(false);
|
|
8705
8804
|
const { isReady, isTimedOut } = (0, import_hooks39.useDepositAddresses)({
|
|
8706
8805
|
enabled: needsDepositAddress,
|
|
8707
8806
|
poll: true
|
|
8708
8807
|
});
|
|
8709
|
-
(0,
|
|
8808
|
+
(0, import_react18.useEffect)(() => {
|
|
8710
8809
|
if (!isInitiating || !isReady) return;
|
|
8711
8810
|
const redirectUri = window.location.href;
|
|
8712
8811
|
client.initiateKyc("kalshi", redirectUri).then((res) => {
|
|
@@ -8720,13 +8819,13 @@ var VerifyIdentityButton = ({ onError }) => {
|
|
|
8720
8819
|
setNeedsDepositAddress(false);
|
|
8721
8820
|
});
|
|
8722
8821
|
}, [isReady, isInitiating, client, onError]);
|
|
8723
|
-
(0,
|
|
8822
|
+
(0, import_react18.useEffect)(() => {
|
|
8724
8823
|
if (!isTimedOut || !isInitiating) return;
|
|
8725
8824
|
setIsInitiating(false);
|
|
8726
8825
|
setNeedsDepositAddress(false);
|
|
8727
8826
|
onError == null ? void 0 : onError(new Error("Deposit address provisioning timed out"));
|
|
8728
8827
|
}, [isTimedOut, isInitiating, onError]);
|
|
8729
|
-
const handleClick = (0,
|
|
8828
|
+
const handleClick = (0, import_react18.useCallback)(() => {
|
|
8730
8829
|
setIsInitiating(true);
|
|
8731
8830
|
setNeedsDepositAddress(true);
|
|
8732
8831
|
}, []);
|
|
@@ -8759,7 +8858,7 @@ var TradingAccessTab = ({
|
|
|
8759
8858
|
const labels = (0, import_hooks39.useLabels)();
|
|
8760
8859
|
const { disabledVenues } = (0, import_hooks39.useAppConfig)();
|
|
8761
8860
|
const { isLocationBlocked } = (0, import_hooks39.useGeoBlock)();
|
|
8762
|
-
const visibleVenues = (0,
|
|
8861
|
+
const visibleVenues = (0, import_react18.useMemo)(
|
|
8763
8862
|
() => (0, import_hooks39.getVisibleVenuesByConfig)(TRADING_ACCESS_VENUE_ITEMS, disabledVenues),
|
|
8764
8863
|
[disabledVenues]
|
|
8765
8864
|
);
|
|
@@ -8820,18 +8919,18 @@ var ProfileModal = ({
|
|
|
8820
8919
|
const client = (0, import_hooks40.useAggClient)();
|
|
8821
8920
|
const { user, startAuth } = (0, import_hooks40.useAggAuthState)();
|
|
8822
8921
|
const toastCtx = useOptionalToast();
|
|
8823
|
-
const [activeTab, setActiveTab] = (0,
|
|
8922
|
+
const [activeTab, setActiveTab] = (0, import_react19.useState)(PROFILE_TAB_KEYS.PROFILE_ACCOUNTS);
|
|
8824
8923
|
const resolvedInitialUsername = (_a = username != null ? username : user == null ? void 0 : user.username) != null ? _a : "";
|
|
8825
|
-
const [draftUsername, setDraftUsername] = (0,
|
|
8826
|
-
const [draftAvatarFile, setDraftAvatarFile] = (0,
|
|
8827
|
-
const [draftAvatarPreview, setDraftAvatarPreview] = (0,
|
|
8828
|
-
const [isSaving, setIsSaving] = (0,
|
|
8829
|
-
const [avatarTypeError, setAvatarTypeError] = (0,
|
|
8830
|
-
(0,
|
|
8924
|
+
const [draftUsername, setDraftUsername] = (0, import_react19.useState)(resolvedInitialUsername);
|
|
8925
|
+
const [draftAvatarFile, setDraftAvatarFile] = (0, import_react19.useState)();
|
|
8926
|
+
const [draftAvatarPreview, setDraftAvatarPreview] = (0, import_react19.useState)();
|
|
8927
|
+
const [isSaving, setIsSaving] = (0, import_react19.useState)(false);
|
|
8928
|
+
const [avatarTypeError, setAvatarTypeError] = (0, import_react19.useState)(null);
|
|
8929
|
+
(0, import_react19.useEffect)(() => {
|
|
8831
8930
|
var _a2;
|
|
8832
8931
|
setDraftUsername((_a2 = username != null ? username : user == null ? void 0 : user.username) != null ? _a2 : "");
|
|
8833
8932
|
}, [username, user == null ? void 0 : user.username]);
|
|
8834
|
-
const handleOpenChange = (0,
|
|
8933
|
+
const handleOpenChange = (0, import_react19.useCallback)(
|
|
8835
8934
|
(isOpen) => {
|
|
8836
8935
|
var _a2;
|
|
8837
8936
|
if (!isOpen) {
|
|
@@ -8855,7 +8954,7 @@ var ProfileModal = ({
|
|
|
8855
8954
|
setDraftAvatarPreview
|
|
8856
8955
|
]
|
|
8857
8956
|
);
|
|
8858
|
-
const handleDraftAvatarChange = (0,
|
|
8957
|
+
const handleDraftAvatarChange = (0, import_react19.useCallback)(
|
|
8859
8958
|
(file, preview) => {
|
|
8860
8959
|
const ACCEPTED_AVATAR_TYPES = ["image/jpeg", "image/png", "image/gif", "image/webp"];
|
|
8861
8960
|
if (file && !ACCEPTED_AVATAR_TYPES.includes(file.type)) {
|
|
@@ -8870,7 +8969,7 @@ var ProfileModal = ({
|
|
|
8870
8969
|
);
|
|
8871
8970
|
const originalUsername = (_b = username != null ? username : user == null ? void 0 : user.username) != null ? _b : "";
|
|
8872
8971
|
const hasChanges = draftUsername !== originalUsername || draftAvatarFile !== void 0;
|
|
8873
|
-
const handleSave = (0,
|
|
8972
|
+
const handleSave = (0, import_react19.useCallback)(() => __async(null, null, function* () {
|
|
8874
8973
|
var _a2, _b2, _c2;
|
|
8875
8974
|
setIsSaving(true);
|
|
8876
8975
|
try {
|
|
@@ -8925,7 +9024,7 @@ var ProfileModal = ({
|
|
|
8925
9024
|
originalUsername,
|
|
8926
9025
|
toastCtx
|
|
8927
9026
|
]);
|
|
8928
|
-
const handleCancel = (0,
|
|
9027
|
+
const handleCancel = (0, import_react19.useCallback)(() => {
|
|
8929
9028
|
handleOpenChange(false);
|
|
8930
9029
|
}, [handleOpenChange]);
|
|
8931
9030
|
const isAccountConnected = (providers) => {
|
|
@@ -8969,7 +9068,7 @@ var ProfileModal = ({
|
|
|
8969
9068
|
if (typeof window === "undefined") return;
|
|
8970
9069
|
((_a2 = window.top) != null ? _a2 : window).location.assign(url);
|
|
8971
9070
|
};
|
|
8972
|
-
const handleConnectTwitter = (0,
|
|
9071
|
+
const handleConnectTwitter = (0, import_react19.useCallback)(() => __async(null, null, function* () {
|
|
8973
9072
|
const result = yield startAuth({
|
|
8974
9073
|
provider: "twitter",
|
|
8975
9074
|
redirectUrl: resolveRedirectUrl()
|
|
@@ -8979,7 +9078,7 @@ var ProfileModal = ({
|
|
|
8979
9078
|
navigateTopWindow(result.url);
|
|
8980
9079
|
}
|
|
8981
9080
|
}), [onConnectTwitter, startAuth]);
|
|
8982
|
-
const handleConnectGoogle = (0,
|
|
9081
|
+
const handleConnectGoogle = (0, import_react19.useCallback)(() => __async(null, null, function* () {
|
|
8983
9082
|
const result = yield startAuth({
|
|
8984
9083
|
provider: "google",
|
|
8985
9084
|
redirectUrl: resolveRedirectUrl()
|
|
@@ -8989,7 +9088,7 @@ var ProfileModal = ({
|
|
|
8989
9088
|
navigateTopWindow(result.url);
|
|
8990
9089
|
}
|
|
8991
9090
|
}), [onConnectGoogle, startAuth]);
|
|
8992
|
-
const handleConnectApple = (0,
|
|
9091
|
+
const handleConnectApple = (0, import_react19.useCallback)(() => __async(null, null, function* () {
|
|
8993
9092
|
const result = yield startAuth({
|
|
8994
9093
|
provider: "apple",
|
|
8995
9094
|
redirectUrl: resolveRedirectUrl()
|
|
@@ -8999,22 +9098,22 @@ var ProfileModal = ({
|
|
|
8999
9098
|
navigateTopWindow(result.url);
|
|
9000
9099
|
}
|
|
9001
9100
|
}), [onConnectApple, startAuth]);
|
|
9002
|
-
const handleDisconnectTwitter = (0,
|
|
9101
|
+
const handleDisconnectTwitter = (0, import_react19.useCallback)(() => __async(null, null, function* () {
|
|
9003
9102
|
yield client.disconnectAccount("twitter");
|
|
9004
9103
|
yield client.getCurrentUser();
|
|
9005
9104
|
onDisconnectTwitter == null ? void 0 : onDisconnectTwitter();
|
|
9006
9105
|
}), [client, onDisconnectTwitter]);
|
|
9007
|
-
const handleDisconnectGoogle = (0,
|
|
9106
|
+
const handleDisconnectGoogle = (0, import_react19.useCallback)(() => __async(null, null, function* () {
|
|
9008
9107
|
yield client.disconnectAccount("google");
|
|
9009
9108
|
yield client.getCurrentUser();
|
|
9010
9109
|
onDisconnectGoogle == null ? void 0 : onDisconnectGoogle();
|
|
9011
9110
|
}), [client, onDisconnectGoogle]);
|
|
9012
|
-
const handleDisconnectApple = (0,
|
|
9111
|
+
const handleDisconnectApple = (0, import_react19.useCallback)(() => __async(null, null, function* () {
|
|
9013
9112
|
yield client.disconnectAccount("apple");
|
|
9014
9113
|
yield client.getCurrentUser();
|
|
9015
9114
|
onDisconnectApple == null ? void 0 : onDisconnectApple();
|
|
9016
9115
|
}), [client, onDisconnectApple]);
|
|
9017
|
-
const handleConnectEmail = (0,
|
|
9116
|
+
const handleConnectEmail = (0, import_react19.useCallback)(() => __async(null, null, function* () {
|
|
9018
9117
|
var _a2;
|
|
9019
9118
|
const typedEmail = typeof window !== "undefined" ? (_a2 = window.prompt("Enter your email to receive a magic link")) == null ? void 0 : _a2.trim() : void 0;
|
|
9020
9119
|
if (!typedEmail) return;
|
|
@@ -9025,7 +9124,7 @@ var ProfileModal = ({
|
|
|
9025
9124
|
});
|
|
9026
9125
|
onConnectEmail == null ? void 0 : onConnectEmail();
|
|
9027
9126
|
}), [onConnectEmail, startAuth]);
|
|
9028
|
-
const handleDisconnectWallet = (0,
|
|
9127
|
+
const handleDisconnectWallet = (0, import_react19.useCallback)(
|
|
9029
9128
|
(wallet) => __async(null, null, function* () {
|
|
9030
9129
|
const normalizedChain = wallet.chain.toLowerCase();
|
|
9031
9130
|
const provider = normalizedChain === "solana" || normalizedChain === "svm" ? "solana_wallet" : "wallet";
|
|
@@ -9035,7 +9134,7 @@ var ProfileModal = ({
|
|
|
9035
9134
|
}),
|
|
9036
9135
|
[client, onDisconnectWallet]
|
|
9037
9136
|
);
|
|
9038
|
-
const providerActionMap = (0,
|
|
9137
|
+
const providerActionMap = (0, import_react19.useMemo)(
|
|
9039
9138
|
() => ({
|
|
9040
9139
|
twitter: {
|
|
9041
9140
|
connect: () => {
|
|
@@ -9077,18 +9176,25 @@ var ProfileModal = ({
|
|
|
9077
9176
|
handleDisconnectTwitter
|
|
9078
9177
|
]
|
|
9079
9178
|
);
|
|
9080
|
-
const resolvedWallets = (0,
|
|
9179
|
+
const resolvedWallets = (0, import_react19.useMemo)(() => {
|
|
9081
9180
|
var _a2, _b2;
|
|
9082
9181
|
if (wallets) return wallets;
|
|
9083
|
-
|
|
9182
|
+
const walletAccounts = (_b2 = (_a2 = user == null ? void 0 : user.accounts) == null ? void 0 : _a2.filter((account) => {
|
|
9084
9183
|
var _a3;
|
|
9184
|
+
const provider = (_a3 = account.provider) == null ? void 0 : _a3.toLowerCase();
|
|
9185
|
+
return provider === "wallet" || provider === "solana_wallet";
|
|
9186
|
+
})) != null ? _b2 : [];
|
|
9187
|
+
return walletAccounts.filter((account) => Boolean(account.providerAccountId)).map((account) => {
|
|
9188
|
+
var _a3, _b3;
|
|
9189
|
+
const chain = ((_a3 = account.provider) == null ? void 0 : _a3.toLowerCase()) === "solana_wallet" ? "solana" : "evm";
|
|
9190
|
+
const address = account.providerAccountId;
|
|
9085
9191
|
return {
|
|
9086
|
-
chain
|
|
9087
|
-
address
|
|
9088
|
-
displayAddress: (
|
|
9192
|
+
chain,
|
|
9193
|
+
address,
|
|
9194
|
+
displayAddress: (_b3 = shortenAddress(address, { chain })) != null ? _b3 : address
|
|
9089
9195
|
};
|
|
9090
|
-
})
|
|
9091
|
-
}, [user == null ? void 0 : user.
|
|
9196
|
+
});
|
|
9197
|
+
}, [user == null ? void 0 : user.accounts, wallets]);
|
|
9092
9198
|
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(
|
|
9093
9199
|
Modal.Container,
|
|
9094
9200
|
{
|
|
@@ -9217,7 +9323,7 @@ ProfileModal.displayName = "ProfileModal";
|
|
|
9217
9323
|
|
|
9218
9324
|
// src/geo-block-modal/index.tsx
|
|
9219
9325
|
var import_hooks41 = require("@agg-build/hooks");
|
|
9220
|
-
var
|
|
9326
|
+
var import_react20 = require("react");
|
|
9221
9327
|
var import_jsx_runtime130 = require("react/jsx-runtime");
|
|
9222
9328
|
var GeoBlockModal = ({
|
|
9223
9329
|
open,
|
|
@@ -9226,7 +9332,7 @@ var GeoBlockModal = ({
|
|
|
9226
9332
|
classNames
|
|
9227
9333
|
}) => {
|
|
9228
9334
|
const labels = (0, import_hooks41.useLabels)();
|
|
9229
|
-
const handleConfirm = (0,
|
|
9335
|
+
const handleConfirm = (0, import_react20.useCallback)(() => {
|
|
9230
9336
|
onConfirm == null ? void 0 : onConfirm();
|
|
9231
9337
|
onOpenChange(false);
|
|
9232
9338
|
}, [onConfirm, onOpenChange]);
|
|
@@ -9326,6 +9432,7 @@ GeoBlockBanner.displayName = "GeoBlockBanner";
|
|
|
9326
9432
|
ProfileModal,
|
|
9327
9433
|
ProfileSetupStep,
|
|
9328
9434
|
WithdrawModal,
|
|
9435
|
+
buildTerminalSummary,
|
|
9329
9436
|
clearPendingCardSession,
|
|
9330
9437
|
getPendingCardSession
|
|
9331
9438
|
});
|