@agg-build/ui 4.19.0 → 4.19.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/dist/chunk-CKHECAKV.mjs +2724 -0
- package/dist/{chunk-NSQQ62QK.mjs → chunk-DONMO42Q.mjs} +1 -1
- package/dist/{chunk-GT3DCFIT.mjs → chunk-KRYMEFPL.mjs} +16 -8
- package/dist/{chunk-5YHKIJ23.mjs → chunk-NV6WT3TN.mjs} +481 -826
- package/dist/{chunk-47CCGQH6.mjs → chunk-UXLC3FFY.mjs} +451 -1349
- package/dist/{event-market-2BAMDM5I.mjs → event-market-UREM3ZE7.mjs} +3 -3
- package/dist/index.js +21902 -21626
- package/dist/index.mjs +8 -8
- package/dist/modals.js +898 -335
- package/dist/modals.mjs +5 -5
- package/dist/pages.js +2857 -1683
- package/dist/pages.mjs +4 -4
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +1746 -643
- package/dist/trading.mjs +2 -2
- package/dist/types/pages/user-profile/components/available-balance-card.d.mts +2 -1
- package/dist/types/pages/user-profile/components/available-balance-card.d.ts +2 -1
- package/dist/types/pages/user-profile/components/betdex-account-card.d.mts +3 -1
- package/dist/types/pages/user-profile/components/betdex-account-card.d.ts +3 -1
- package/dist/types/pages/user-profile/components/betdex-account-transfers.d.mts +2 -1
- package/dist/types/pages/user-profile/components/betdex-account-transfers.d.ts +2 -1
- package/dist/types/pages/user-profile/components/betdex-wallet-deposit.d.mts +6 -0
- package/dist/types/pages/user-profile/components/betdex-wallet-deposit.d.ts +6 -0
- package/dist/types/profile/tabs/trading-access-tab.d.mts +2 -1
- package/dist/types/profile/tabs/trading-access-tab.d.ts +2 -1
- package/dist/types/trading/manage-betdex-account-modal.d.mts +2 -1
- package/dist/types/trading/manage-betdex-account-modal.d.ts +2 -1
- package/dist/types/trading/place-order/index.place-order.types.d.mts +1 -0
- package/dist/types/trading/place-order/index.place-order.types.d.ts +1 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +2 -2
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +2 -2
- package/dist/types/withdraw/steps/withdraw-amount.d.mts +3 -1
- package/dist/types/withdraw/steps/withdraw-amount.d.ts +3 -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/chunk-ROA5K67W.mjs +0 -1237
package/dist/modals.js
CHANGED
|
@@ -152,17 +152,17 @@ var formatUsd = (value, options) => {
|
|
|
152
152
|
maximumFractionDigits
|
|
153
153
|
});
|
|
154
154
|
};
|
|
155
|
-
var formatCompactUsd = (
|
|
156
|
-
const formatted =
|
|
155
|
+
var formatCompactUsd = (amount2) => {
|
|
156
|
+
const formatted = amount2 % 1 === 0 ? amount2.toString() : amount2.toFixed(1);
|
|
157
157
|
return `$${formatted}`;
|
|
158
158
|
};
|
|
159
|
-
var formatTokenAmount = (
|
|
159
|
+
var formatTokenAmount = (amount2, symbol, options) => {
|
|
160
160
|
var _a;
|
|
161
161
|
const normalizedSymbol = symbol.trim();
|
|
162
162
|
const tokenSymbol = normalizedSymbol.length > 0 ? normalizedSymbol : "USDC";
|
|
163
|
-
if (!Number.isFinite(
|
|
163
|
+
if (!Number.isFinite(amount2)) return `0 ${tokenSymbol}`;
|
|
164
164
|
const maximumFractionDigits = (_a = options == null ? void 0 : options.maximumFractionDigits) != null ? _a : 6;
|
|
165
|
-
const formattedAmount =
|
|
165
|
+
const formattedAmount = amount2.toLocaleString("en-US", {
|
|
166
166
|
maximumFractionDigits
|
|
167
167
|
});
|
|
168
168
|
return `${formattedAmount} ${tokenSymbol}`;
|
|
@@ -5190,7 +5190,7 @@ Select.displayName = "Select";
|
|
|
5190
5190
|
// src/deposit/steps/card-deposit.tsx
|
|
5191
5191
|
var import_jsx_runtime112 = require("react/jsx-runtime");
|
|
5192
5192
|
var CardDepositStep = ({
|
|
5193
|
-
amount,
|
|
5193
|
+
amount: amount2,
|
|
5194
5194
|
currency,
|
|
5195
5195
|
// tokenOptions,
|
|
5196
5196
|
networkOptions,
|
|
@@ -5205,10 +5205,10 @@ var CardDepositStep = ({
|
|
|
5205
5205
|
onContinue
|
|
5206
5206
|
}) => {
|
|
5207
5207
|
const labels = (0, import_hooks17.useLabels)();
|
|
5208
|
-
const [localAmount, setLocalAmount] = (0, import_react5.useState)(
|
|
5208
|
+
const [localAmount, setLocalAmount] = (0, import_react5.useState)(amount2);
|
|
5209
5209
|
(0, import_react5.useEffect)(() => {
|
|
5210
|
-
setLocalAmount(
|
|
5211
|
-
}, [
|
|
5210
|
+
setLocalAmount(amount2);
|
|
5211
|
+
}, [amount2]);
|
|
5212
5212
|
const numericAmount = Number(localAmount) || 0;
|
|
5213
5213
|
const hasInput = localAmount.length > 0;
|
|
5214
5214
|
const isBelowMin = minAmount != null && hasInput && numericAmount < minAmount;
|
|
@@ -5611,7 +5611,7 @@ var CardProviderItem = ({ provider, onSelect }) => {
|
|
|
5611
5611
|
};
|
|
5612
5612
|
var CardProviderStep = ({
|
|
5613
5613
|
token,
|
|
5614
|
-
amount,
|
|
5614
|
+
amount: amount2,
|
|
5615
5615
|
currency,
|
|
5616
5616
|
providers,
|
|
5617
5617
|
isLoading,
|
|
@@ -5646,7 +5646,7 @@ var CardProviderStep = ({
|
|
|
5646
5646
|
/* @__PURE__ */ (0, import_jsx_runtime116.jsx)("span", { className: "agg-type-body font-agg-bold text-agg-foreground", children: token }),
|
|
5647
5647
|
/* @__PURE__ */ (0, import_jsx_runtime116.jsxs)("span", { className: "agg-type-body text-agg-foreground", children: [
|
|
5648
5648
|
"$",
|
|
5649
|
-
|
|
5649
|
+
amount2,
|
|
5650
5650
|
" ",
|
|
5651
5651
|
currency
|
|
5652
5652
|
] })
|
|
@@ -6239,7 +6239,7 @@ var WalletFormStep = ({
|
|
|
6239
6239
|
networkOptions,
|
|
6240
6240
|
selectedToken,
|
|
6241
6241
|
selectedNetwork,
|
|
6242
|
-
amount,
|
|
6242
|
+
amount: amount2,
|
|
6243
6243
|
isSubmitting = false,
|
|
6244
6244
|
formErrorMessage,
|
|
6245
6245
|
formErrorTone = "error",
|
|
@@ -6254,7 +6254,7 @@ var WalletFormStep = ({
|
|
|
6254
6254
|
onConfirm
|
|
6255
6255
|
}) => {
|
|
6256
6256
|
const labels = (0, import_hooks26.useLabels)();
|
|
6257
|
-
const isConfirmEnabled = !isSubmitting && !isBalanceLoading && Number(
|
|
6257
|
+
const isConfirmEnabled = !isSubmitting && !isBalanceLoading && Number(amount2) > 0 && Number(amount2) <= walletBalance;
|
|
6258
6258
|
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(import_jsx_runtime123.Fragment, { children: [
|
|
6259
6259
|
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
6260
6260
|
Modal.Header,
|
|
@@ -6328,7 +6328,7 @@ var WalletFormStep = ({
|
|
|
6328
6328
|
"aria-label": labels.deposit.walletFlow.amountLabel,
|
|
6329
6329
|
className: "agg-type-body w-full bg-transparent outline-none text-agg-foreground",
|
|
6330
6330
|
placeholder: "0.00",
|
|
6331
|
-
value:
|
|
6331
|
+
value: amount2,
|
|
6332
6332
|
onChange: (event) => onAmountChange(event.target.value)
|
|
6333
6333
|
}
|
|
6334
6334
|
),
|
|
@@ -6727,9 +6727,9 @@ function DepositModalControlled({
|
|
|
6727
6727
|
setStep("crypto-transfer");
|
|
6728
6728
|
}
|
|
6729
6729
|
};
|
|
6730
|
-
const handleContinueCardDeposit = (
|
|
6730
|
+
const handleContinueCardDeposit = (amount2) => __async(null, null, function* () {
|
|
6731
6731
|
var _a2, _b2, _c2, _d2, _e2;
|
|
6732
|
-
onContinueCardDeposit == null ? void 0 : onContinueCardDeposit(
|
|
6732
|
+
onContinueCardDeposit == null ? void 0 : onContinueCardDeposit(amount2);
|
|
6733
6733
|
setStep("card-provider");
|
|
6734
6734
|
if (onGetCardQuotes) {
|
|
6735
6735
|
setQuotesLoading(true);
|
|
@@ -6737,7 +6737,7 @@ function DepositModalControlled({
|
|
|
6737
6737
|
setCardProviders([]);
|
|
6738
6738
|
try {
|
|
6739
6739
|
const providers = yield onGetCardQuotes({
|
|
6740
|
-
sourceAmount: String(
|
|
6740
|
+
sourceAmount: String(amount2),
|
|
6741
6741
|
sourceCurrencyCode: (_a2 = cardFlow == null ? void 0 : cardFlow.currency) != null ? _a2 : "USD",
|
|
6742
6742
|
destinationCurrencyCode: (_d2 = (_c2 = NETWORK_TO_CURRENCY_CODE[(_b2 = cardFlow == null ? void 0 : cardFlow.selectedNetwork) != null ? _b2 : ""]) != null ? _c2 : cardFlow == null ? void 0 : cardFlow.selectedNetwork) != null ? _d2 : ""
|
|
6743
6743
|
});
|
|
@@ -6752,9 +6752,9 @@ function DepositModalControlled({
|
|
|
6752
6752
|
}
|
|
6753
6753
|
});
|
|
6754
6754
|
const handleRetryQuotes = () => {
|
|
6755
|
-
const
|
|
6756
|
-
if (
|
|
6757
|
-
handleContinueCardDeposit(
|
|
6755
|
+
const amount2 = Number(cardFlow == null ? void 0 : cardFlow.amount) || 0;
|
|
6756
|
+
if (amount2 > 0) {
|
|
6757
|
+
handleContinueCardDeposit(amount2);
|
|
6758
6758
|
}
|
|
6759
6759
|
};
|
|
6760
6760
|
const handleSelectProvider = (providerId) => __async(null, null, function* () {
|
|
@@ -7092,8 +7092,8 @@ var formatRawTokenAmount = (rawAmount, decimals) => {
|
|
|
7092
7092
|
if (remainder === BigInt(0)) return whole.toString();
|
|
7093
7093
|
return `${whole.toString()}.${remainder.toString().padStart(decimals, "0").replace(/0+$/, "")}`;
|
|
7094
7094
|
};
|
|
7095
|
-
var parseTokenAmountToRaw = (
|
|
7096
|
-
const normalizedAmount =
|
|
7095
|
+
var parseTokenAmountToRaw = (amount2, decimals) => {
|
|
7096
|
+
const normalizedAmount = amount2.trim();
|
|
7097
7097
|
if (!normalizedAmount || !/^\d*(?:\.\d*)?$/.test(normalizedAmount)) return null;
|
|
7098
7098
|
const [wholePart = "0", fractionalPart = ""] = normalizedAmount.split(".");
|
|
7099
7099
|
if (fractionalPart.length > decimals) return null;
|
|
@@ -7106,7 +7106,9 @@ var parseTokenAmountToRaw = (amount, decimals) => {
|
|
|
7106
7106
|
}
|
|
7107
7107
|
};
|
|
7108
7108
|
var WithdrawAmountStep = ({
|
|
7109
|
-
|
|
7109
|
+
title: title2,
|
|
7110
|
+
fixedDestination = false,
|
|
7111
|
+
amount: amount2,
|
|
7110
7112
|
destinationWallet,
|
|
7111
7113
|
balanceDisplay,
|
|
7112
7114
|
tokenOptions,
|
|
@@ -7131,8 +7133,8 @@ var WithdrawAmountStep = ({
|
|
|
7131
7133
|
const isSolanaDest = selectedNetwork === SOLANA_CHAIN_ID;
|
|
7132
7134
|
const trimmedDestination = destinationWallet.trim();
|
|
7133
7135
|
const isValidAddress = isSolanaDest ? /^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(trimmedDestination) : /^0x[a-fA-F0-9]{40}$/.test(trimmedDestination);
|
|
7134
|
-
const isValid = Number(
|
|
7135
|
-
const amountRaw =
|
|
7136
|
+
const isValid = Number(amount2) > 0 && isValidAddress;
|
|
7137
|
+
const amountRaw = amount2 && Number(amount2) > 0 ? parseTokenAmountToRaw(amount2, destDecimals) : null;
|
|
7136
7138
|
const destinationChainId = Number(selectedNetwork) || null;
|
|
7137
7139
|
const preview = (0, import_hooks31.useWithdrawPreview)({
|
|
7138
7140
|
amountRaw,
|
|
@@ -7155,7 +7157,7 @@ var WithdrawAmountStep = ({
|
|
|
7155
7157
|
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
7156
7158
|
Modal.Header,
|
|
7157
7159
|
{
|
|
7158
|
-
title: labels.withdraw.walletFlow.title,
|
|
7160
|
+
title: title2 != null ? title2 : labels.withdraw.walletFlow.title,
|
|
7159
7161
|
hideBorder: true,
|
|
7160
7162
|
leftElement: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
7161
7163
|
"button",
|
|
@@ -7185,6 +7187,7 @@ var WithdrawAmountStep = ({
|
|
|
7185
7187
|
),
|
|
7186
7188
|
placeholder: isSolanaDest ? "FwR3..." : "0x971d...",
|
|
7187
7189
|
value: destinationWallet,
|
|
7190
|
+
readOnly: fixedDestination,
|
|
7188
7191
|
onChange: (e) => onDestinationChange(e.target.value)
|
|
7189
7192
|
}
|
|
7190
7193
|
)
|
|
@@ -7207,10 +7210,10 @@ var WithdrawAmountStep = ({
|
|
|
7207
7210
|
"aria-label": labels.withdraw.walletFlow.amountLabel,
|
|
7208
7211
|
className: cn(
|
|
7209
7212
|
"agg-type-body flex-1 min-w-0 bg-transparent outline-none",
|
|
7210
|
-
Number(
|
|
7213
|
+
Number(amount2) > 0 ? "text-agg-foreground" : "text-agg-muted-foreground"
|
|
7211
7214
|
),
|
|
7212
7215
|
placeholder: "0.00",
|
|
7213
|
-
value:
|
|
7216
|
+
value: amount2,
|
|
7214
7217
|
onChange: (e) => onAmountChange(e.target.value)
|
|
7215
7218
|
}
|
|
7216
7219
|
),
|
|
@@ -7233,6 +7236,7 @@ var WithdrawAmountStep = ({
|
|
|
7233
7236
|
Select,
|
|
7234
7237
|
{
|
|
7235
7238
|
items: tokenOptions,
|
|
7239
|
+
disabled: fixedDestination,
|
|
7236
7240
|
value: selectedToken,
|
|
7237
7241
|
onChange: onTokenChange,
|
|
7238
7242
|
ariaLabel: labels.withdraw.walletFlow.tokenLabel
|
|
@@ -7245,6 +7249,7 @@ var WithdrawAmountStep = ({
|
|
|
7245
7249
|
Select,
|
|
7246
7250
|
{
|
|
7247
7251
|
items: networkOptions,
|
|
7252
|
+
disabled: fixedDestination,
|
|
7248
7253
|
value: selectedNetwork,
|
|
7249
7254
|
onChange: onNetworkChange,
|
|
7250
7255
|
ariaLabel: labels.withdraw.walletFlow.networkLabel
|
|
@@ -7555,6 +7560,7 @@ function WithdrawModalControlled({
|
|
|
7555
7560
|
open,
|
|
7556
7561
|
onOpenChange,
|
|
7557
7562
|
withdrawFlow,
|
|
7563
|
+
transferTarget,
|
|
7558
7564
|
onWithdrawDestinationChange,
|
|
7559
7565
|
onWithdrawAmountChange,
|
|
7560
7566
|
onWithdrawTokenChange,
|
|
@@ -7563,21 +7569,23 @@ function WithdrawModalControlled({
|
|
|
7563
7569
|
onSelectWithdrawProvider,
|
|
7564
7570
|
onDoneWithdraw
|
|
7565
7571
|
}) {
|
|
7572
|
+
var _a;
|
|
7573
|
+
const initialFormStep = transferTarget ? "withdraw-amount" : "method";
|
|
7566
7574
|
const [flowState, setFlowState] = (0, import_react10.useState)({
|
|
7567
7575
|
status: "form",
|
|
7568
|
-
formStep:
|
|
7576
|
+
formStep: initialFormStep
|
|
7569
7577
|
});
|
|
7570
7578
|
const [isConfirming, setIsConfirming] = (0, import_react10.useState)(false);
|
|
7571
7579
|
const [confirmError, setConfirmError] = (0, import_react10.useState)(null);
|
|
7572
7580
|
const { state: withdrawalLifecycleState, reset: resetWithdrawalLifecycle } = (0, import_withdraw.useWithdrawalLifecycle)(withdrawFlow.withdrawalId);
|
|
7573
7581
|
(0, import_react10.useEffect)(() => {
|
|
7574
7582
|
if (!open) {
|
|
7575
|
-
setFlowState({ status: "form", formStep:
|
|
7583
|
+
setFlowState({ status: "form", formStep: initialFormStep });
|
|
7576
7584
|
setIsConfirming(false);
|
|
7577
7585
|
setConfirmError(null);
|
|
7578
7586
|
resetWithdrawalLifecycle();
|
|
7579
7587
|
}
|
|
7580
|
-
}, [open, resetWithdrawalLifecycle]);
|
|
7588
|
+
}, [open, resetWithdrawalLifecycle, initialFormStep]);
|
|
7581
7589
|
(0, import_react10.useEffect)(() => {
|
|
7582
7590
|
if (flowState.status !== "loading") return;
|
|
7583
7591
|
if (!withdrawalLifecycleState.terminal) return;
|
|
@@ -7603,7 +7611,7 @@ function WithdrawModalControlled({
|
|
|
7603
7611
|
]);
|
|
7604
7612
|
const handleOpenChange = (isOpen) => {
|
|
7605
7613
|
if (!isOpen) {
|
|
7606
|
-
setFlowState({ status: "form", formStep:
|
|
7614
|
+
setFlowState({ status: "form", formStep: initialFormStep });
|
|
7607
7615
|
setIsConfirming(false);
|
|
7608
7616
|
setConfirmError(null);
|
|
7609
7617
|
resetWithdrawalLifecycle();
|
|
@@ -7611,8 +7619,12 @@ function WithdrawModalControlled({
|
|
|
7611
7619
|
onOpenChange(isOpen);
|
|
7612
7620
|
};
|
|
7613
7621
|
const handleBack = () => {
|
|
7622
|
+
if (transferTarget) {
|
|
7623
|
+
handleOpenChange(false);
|
|
7624
|
+
return;
|
|
7625
|
+
}
|
|
7614
7626
|
setConfirmError(null);
|
|
7615
|
-
setFlowState({ status: "form", formStep:
|
|
7627
|
+
setFlowState({ status: "form", formStep: initialFormStep });
|
|
7616
7628
|
};
|
|
7617
7629
|
const handleRetry = () => {
|
|
7618
7630
|
setConfirmError(null);
|
|
@@ -7621,6 +7633,8 @@ function WithdrawModalControlled({
|
|
|
7621
7633
|
setFlowState({ status: "form", formStep: "withdraw-amount" });
|
|
7622
7634
|
};
|
|
7623
7635
|
const handleConfirm = () => __async(null, null, function* () {
|
|
7636
|
+
if (isConfirming || transferTarget && (withdrawFlow.destinationWallet !== transferTarget.address || withdrawFlow.selectedNetwork !== transferTarget.chainId || withdrawFlow.selectedToken !== transferTarget.tokenSymbol))
|
|
7637
|
+
return;
|
|
7624
7638
|
setFlowState({ status: "loading" });
|
|
7625
7639
|
setIsConfirming(true);
|
|
7626
7640
|
setConfirmError(null);
|
|
@@ -7647,7 +7661,7 @@ function WithdrawModalControlled({
|
|
|
7647
7661
|
tokenSymbol: withdrawFlow.selectedToken,
|
|
7648
7662
|
chainId: withdrawFlow.selectedNetwork
|
|
7649
7663
|
});
|
|
7650
|
-
return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(Modal.Container, { maxWidth: modalMaxWidth, "aria-label": "Withdraw", children: [
|
|
7664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(Modal.Container, { maxWidth: modalMaxWidth, "aria-label": (_a = transferTarget == null ? void 0 : transferTarget.title) != null ? _a : "Withdraw", children: [
|
|
7651
7665
|
flowState.status === "form" && flowState.formStep === "method" ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
|
|
7652
7666
|
WithdrawMethodStep,
|
|
7653
7667
|
{
|
|
@@ -7658,6 +7672,8 @@ function WithdrawModalControlled({
|
|
|
7658
7672
|
flowState.status === "form" && flowState.formStep === "withdraw-amount" ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
|
|
7659
7673
|
WithdrawAmountStep,
|
|
7660
7674
|
{
|
|
7675
|
+
title: transferTarget == null ? void 0 : transferTarget.title,
|
|
7676
|
+
fixedDestination: !!transferTarget,
|
|
7661
7677
|
amount: withdrawFlow.amount,
|
|
7662
7678
|
destinationWallet: withdrawFlow.destinationWallet,
|
|
7663
7679
|
balanceDisplay: withdrawFlow.balanceDisplay,
|
|
@@ -9914,10 +9930,514 @@ var PaperTradingOnboarding = ({
|
|
|
9914
9930
|
PaperTradingOnboarding.displayName = "PaperTradingOnboarding";
|
|
9915
9931
|
|
|
9916
9932
|
// src/profile/index.tsx
|
|
9933
|
+
var import_react28 = require("react");
|
|
9934
|
+
var import_hooks52 = require("@agg-build/hooks");
|
|
9935
|
+
var import_sdk16 = require("@agg-build/sdk");
|
|
9936
|
+
|
|
9937
|
+
// src/trading/manage-betdex-account-modal.tsx
|
|
9938
|
+
var import_react25 = require("react");
|
|
9939
|
+
var import_hooks49 = require("@agg-build/hooks");
|
|
9940
|
+
var Dialog6 = __toESM(require("@radix-ui/react-dialog"));
|
|
9941
|
+
|
|
9942
|
+
// src/pages/user-profile/components/betdex-account-card.tsx
|
|
9917
9943
|
var import_react23 = require("react");
|
|
9918
9944
|
var import_hooks47 = require("@agg-build/hooks");
|
|
9919
9945
|
var import_sdk15 = require("@agg-build/sdk");
|
|
9920
9946
|
|
|
9947
|
+
// src/pages/user-profile/components/betdex-account-transfers.tsx
|
|
9948
|
+
var import_react21 = require("react");
|
|
9949
|
+
var import_hooks45 = require("@agg-build/hooks");
|
|
9950
|
+
var import_jsx_runtime146 = require("react/jsx-runtime");
|
|
9951
|
+
function hostedWithdrawalRaw(value) {
|
|
9952
|
+
var _a;
|
|
9953
|
+
const match = /^([0-9]{1,26})(?:\.([0-9]{1,6}))?$/.exec(value.trim());
|
|
9954
|
+
if (!match) return null;
|
|
9955
|
+
const raw = BigInt(match[1]) * BigInt(1e6) + BigInt(((_a = match[2]) != null ? _a : "").padEnd(6, "0"));
|
|
9956
|
+
return raw > BigInt(0) ? raw.toString() : null;
|
|
9957
|
+
}
|
|
9958
|
+
var amountText = (raw) => {
|
|
9959
|
+
const value = BigInt(raw);
|
|
9960
|
+
const fraction = (value % BigInt(1e6)).toString().padStart(6, "0").replace(/0+$/, "");
|
|
9961
|
+
return (value / BigInt(1e6)).toString() + (fraction ? "." + fraction : "");
|
|
9962
|
+
};
|
|
9963
|
+
function BetdexAccountTransfers({
|
|
9964
|
+
accountId,
|
|
9965
|
+
environment,
|
|
9966
|
+
availableRaw,
|
|
9967
|
+
canDeposit,
|
|
9968
|
+
onWalletDeposit
|
|
9969
|
+
}) {
|
|
9970
|
+
const labels = (0, import_hooks45.useLabels)().userProfile.hostedBetdex;
|
|
9971
|
+
const transfer = (0, import_hooks45.useHostedVenueTransfers)(accountId, environment);
|
|
9972
|
+
const [showWithdraw, setShowWithdraw] = (0, import_react21.useState)(false);
|
|
9973
|
+
const wallet = (0, import_hooks45.useDepositAddresses)({
|
|
9974
|
+
enabled: transfer.isAvailable && environment === "production" && showWithdraw
|
|
9975
|
+
});
|
|
9976
|
+
const [amount2, setAmount] = (0, import_react21.useState)("");
|
|
9977
|
+
const [destination, setDestination] = (0, import_react21.useState)("");
|
|
9978
|
+
const [actionError, setActionError] = (0, import_react21.useState)(false);
|
|
9979
|
+
const raw = hostedWithdrawalRaw(amount2);
|
|
9980
|
+
const withinBalance = raw !== null && (availableRaw === void 0 || BigInt(raw) <= BigInt(availableRaw));
|
|
9981
|
+
const validDestination = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(destination.trim());
|
|
9982
|
+
const result = transfer.withdrawal.data;
|
|
9983
|
+
const terminal = (result == null ? void 0 : result.status) === "confirmed" || (result == null ? void 0 : result.status) === "failed";
|
|
9984
|
+
const run = (work) => {
|
|
9985
|
+
setActionError(false);
|
|
9986
|
+
void work().catch(() => setActionError(true));
|
|
9987
|
+
};
|
|
9988
|
+
if (!transfer.isAvailable) return null;
|
|
9989
|
+
return /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)("div", { className: "flex flex-col gap-3 border-t border-agg-separator pt-3", children: [
|
|
9990
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsxs)("div", { className: "flex flex-wrap gap-2", children: [
|
|
9991
|
+
canDeposit && environment === "production" && onWalletDeposit ? /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
9992
|
+
Button,
|
|
9993
|
+
{
|
|
9994
|
+
type: "button",
|
|
9995
|
+
variant: "secondary",
|
|
9996
|
+
size: "small",
|
|
9997
|
+
disabled: transfer.deposit.isPending,
|
|
9998
|
+
isLoading: transfer.deposit.isPending,
|
|
9999
|
+
onClick: () => run(() => __async(null, null, function* () {
|
|
10000
|
+
const response = yield transfer.deposit.mutateAsync();
|
|
10001
|
+
onWalletDeposit(response.result.address);
|
|
10002
|
+
})),
|
|
10003
|
+
children: labels.fromWallet
|
|
10004
|
+
}
|
|
10005
|
+
) : null,
|
|
10006
|
+
canDeposit ? /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
10007
|
+
Button,
|
|
10008
|
+
{
|
|
10009
|
+
type: "button",
|
|
10010
|
+
variant: "secondary",
|
|
10011
|
+
size: "small",
|
|
10012
|
+
"aria-label": labels.deposit,
|
|
10013
|
+
isLoading: transfer.deposit.isPending,
|
|
10014
|
+
disabled: transfer.deposit.isPending,
|
|
10015
|
+
onClick: () => run(() => transfer.deposit.mutateAsync()),
|
|
10016
|
+
children: labels.deposit
|
|
10017
|
+
}
|
|
10018
|
+
) : null,
|
|
10019
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
10020
|
+
Button,
|
|
10021
|
+
{
|
|
10022
|
+
type: "button",
|
|
10023
|
+
variant: "secondary",
|
|
10024
|
+
size: "small",
|
|
10025
|
+
"aria-expanded": showWithdraw || !!transfer.request,
|
|
10026
|
+
onClick: () => setShowWithdraw((value) => !value),
|
|
10027
|
+
children: labels.withdraw
|
|
10028
|
+
}
|
|
10029
|
+
)
|
|
10030
|
+
] }),
|
|
10031
|
+
transfer.deposit.data ? /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)("div", { className: "flex flex-col gap-2 agg-type-caption", children: [
|
|
10032
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsx)("p", { className: "text-agg-muted-foreground", children: labels.depositInstructions[environment] }),
|
|
10033
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsxs)("label", { className: "flex flex-col gap-1 text-agg-muted-foreground", children: [
|
|
10034
|
+
labels.depositAddress,
|
|
10035
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
10036
|
+
"input",
|
|
10037
|
+
{
|
|
10038
|
+
readOnly: true,
|
|
10039
|
+
value: transfer.deposit.data.address,
|
|
10040
|
+
onFocus: (event) => event.currentTarget.select(),
|
|
10041
|
+
className: "w-full rounded-agg-md border border-agg-separator bg-agg-primary p-2 text-agg-foreground"
|
|
10042
|
+
}
|
|
10043
|
+
)
|
|
10044
|
+
] })
|
|
10045
|
+
] }) : null,
|
|
10046
|
+
transfer.deposit.isError || transfer.withdrawal.isError || transfer.storageError || actionError ? /* @__PURE__ */ (0, import_jsx_runtime146.jsx)("p", { role: "alert", className: "agg-type-caption text-agg-error", children: labels.transferUnavailable }) : null,
|
|
10047
|
+
transfer.request ? /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)("div", { className: "flex flex-col gap-2 agg-type-caption", children: [
|
|
10048
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsxs)("p", { children: [
|
|
10049
|
+
labels.withdrawalAmount,
|
|
10050
|
+
": ",
|
|
10051
|
+
amountText(transfer.request.amountRaw)
|
|
10052
|
+
] }),
|
|
10053
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsxs)("p", { className: "break-all", children: [
|
|
10054
|
+
labels.withdrawalDestination,
|
|
10055
|
+
": ",
|
|
10056
|
+
transfer.request.destinationAddress
|
|
10057
|
+
] }),
|
|
10058
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsx)("p", { role: "status", children: result ? labels.withdrawalStatuses[result.status] : labels.withdrawalUnknown }),
|
|
10059
|
+
terminal ? /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
10060
|
+
Button,
|
|
10061
|
+
{
|
|
10062
|
+
type: "button",
|
|
10063
|
+
variant: "tertiary",
|
|
10064
|
+
size: "small",
|
|
10065
|
+
onClick: () => {
|
|
10066
|
+
transfer.clear();
|
|
10067
|
+
setAmount("");
|
|
10068
|
+
setDestination("");
|
|
10069
|
+
setActionError(false);
|
|
10070
|
+
setShowWithdraw(false);
|
|
10071
|
+
},
|
|
10072
|
+
children: labels.withdrawalNew
|
|
10073
|
+
}
|
|
10074
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
10075
|
+
Button,
|
|
10076
|
+
{
|
|
10077
|
+
type: "button",
|
|
10078
|
+
variant: "tertiary",
|
|
10079
|
+
size: "small",
|
|
10080
|
+
"aria-label": result ? labels.withdrawalCheck : labels.withdrawalRetry,
|
|
10081
|
+
isLoading: transfer.withdrawal.isPending,
|
|
10082
|
+
disabled: transfer.withdrawal.isPending,
|
|
10083
|
+
onClick: () => run(transfer.check),
|
|
10084
|
+
children: result ? labels.withdrawalCheck : labels.withdrawalRetry
|
|
10085
|
+
}
|
|
10086
|
+
)
|
|
10087
|
+
] }) : showWithdraw ? /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(
|
|
10088
|
+
"form",
|
|
10089
|
+
{
|
|
10090
|
+
className: "flex flex-col gap-3",
|
|
10091
|
+
onSubmit: (event) => {
|
|
10092
|
+
event.preventDefault();
|
|
10093
|
+
if (!raw || !withinBalance || !validDestination || !transfer.ready) return;
|
|
10094
|
+
run(() => transfer.submit(raw, destination.trim()));
|
|
10095
|
+
},
|
|
10096
|
+
children: [
|
|
10097
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsxs)("label", { className: "flex flex-col gap-1 agg-type-caption text-agg-muted-foreground", children: [
|
|
10098
|
+
labels.withdrawalAmount,
|
|
10099
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
10100
|
+
"input",
|
|
10101
|
+
{
|
|
10102
|
+
inputMode: "decimal",
|
|
10103
|
+
autoComplete: "off",
|
|
10104
|
+
value: amount2,
|
|
10105
|
+
onChange: (event) => setAmount(event.target.value),
|
|
10106
|
+
className: "rounded-agg-md border border-agg-separator bg-agg-primary p-2 text-agg-foreground"
|
|
10107
|
+
}
|
|
10108
|
+
)
|
|
10109
|
+
] }),
|
|
10110
|
+
environment === "production" ? /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
10111
|
+
Button,
|
|
10112
|
+
{
|
|
10113
|
+
type: "button",
|
|
10114
|
+
variant: "secondary",
|
|
10115
|
+
size: "small",
|
|
10116
|
+
disabled: !wallet.isReady || !wallet.svmAddress || wallet.isError,
|
|
10117
|
+
isLoading: wallet.isLoading,
|
|
10118
|
+
onClick: () => {
|
|
10119
|
+
if (wallet.isReady && wallet.svmAddress && !wallet.isError)
|
|
10120
|
+
setDestination(wallet.svmAddress);
|
|
10121
|
+
},
|
|
10122
|
+
children: labels.toWallet
|
|
10123
|
+
}
|
|
10124
|
+
) : null,
|
|
10125
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsxs)("label", { className: "flex flex-col gap-1 agg-type-caption text-agg-muted-foreground", children: [
|
|
10126
|
+
labels.withdrawalDestination,
|
|
10127
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
10128
|
+
"input",
|
|
10129
|
+
{
|
|
10130
|
+
autoComplete: "off",
|
|
10131
|
+
spellCheck: false,
|
|
10132
|
+
value: destination,
|
|
10133
|
+
onChange: (event) => setDestination(event.target.value),
|
|
10134
|
+
className: "rounded-agg-md border border-agg-separator bg-agg-primary p-2 text-agg-foreground"
|
|
10135
|
+
}
|
|
10136
|
+
)
|
|
10137
|
+
] }),
|
|
10138
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
10139
|
+
Button,
|
|
10140
|
+
{
|
|
10141
|
+
type: "submit",
|
|
10142
|
+
variant: "primary",
|
|
10143
|
+
size: "small",
|
|
10144
|
+
"aria-label": labels.withdrawalSubmit,
|
|
10145
|
+
disabled: !withinBalance || !validDestination || !transfer.ready || transfer.withdrawal.isPending,
|
|
10146
|
+
isLoading: transfer.withdrawal.isPending,
|
|
10147
|
+
children: labels.withdrawalSubmit
|
|
10148
|
+
}
|
|
10149
|
+
)
|
|
10150
|
+
]
|
|
10151
|
+
}
|
|
10152
|
+
) : null
|
|
10153
|
+
] });
|
|
10154
|
+
}
|
|
10155
|
+
|
|
10156
|
+
// src/pages/user-profile/components/betdex-account-activity.tsx
|
|
10157
|
+
var import_react22 = require("react");
|
|
10158
|
+
var import_hooks46 = require("@agg-build/hooks");
|
|
10159
|
+
var import_jsx_runtime147 = require("react/jsx-runtime");
|
|
10160
|
+
function amount(raw) {
|
|
10161
|
+
const negative = raw.startsWith("-");
|
|
10162
|
+
const digits = (negative ? raw.slice(1) : raw).padStart(19, "0");
|
|
10163
|
+
const fraction = digits.slice(-18).replace(/0+$/, "");
|
|
10164
|
+
return `${negative ? "-" : "+"}${digits.slice(0, -18)}${fraction ? `.${fraction}` : ""}`;
|
|
10165
|
+
}
|
|
10166
|
+
function BetdexAccountActivity({
|
|
10167
|
+
accountId,
|
|
10168
|
+
environment
|
|
10169
|
+
}) {
|
|
10170
|
+
const labels = (0, import_hooks46.useLabels)().userProfile.hostedBetdex;
|
|
10171
|
+
const [page, setPage] = (0, import_react22.useState)(0);
|
|
10172
|
+
const { activity, isAvailable } = (0, import_hooks46.useHostedVenueActivity)("betdex", page);
|
|
10173
|
+
if (!isAvailable) return null;
|
|
10174
|
+
const data = activity.data;
|
|
10175
|
+
const valid = (data == null ? void 0 : data.accountId) === accountId && data.environment === environment && data.page === page;
|
|
10176
|
+
const unavailable = activity.isError || !!data && !valid;
|
|
10177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)(
|
|
10178
|
+
"section",
|
|
10179
|
+
{
|
|
10180
|
+
"aria-label": labels.activityTitle,
|
|
10181
|
+
className: "flex flex-col gap-3 border-t border-agg-separator pt-3",
|
|
10182
|
+
children: [
|
|
10183
|
+
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)("h4", { className: "agg-type-label text-agg-foreground", children: labels.activityTitle }),
|
|
10184
|
+
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)("p", { className: "agg-type-caption text-agg-muted-foreground", children: labels.activityDescription }),
|
|
10185
|
+
activity.isPending ? /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(SkeletonBlock, { className: "h-16 w-full" }) : null,
|
|
10186
|
+
unavailable ? /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("p", { role: "status", className: "agg-type-caption text-agg-muted-foreground", children: labels.activityUnavailable }) : null,
|
|
10187
|
+
valid && !unavailable ? data.items.length ? /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("ul", { className: "flex flex-col gap-3 agg-type-caption", children: data.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("li", { className: "flex flex-col gap-1", children: [
|
|
10188
|
+
/* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "flex justify-between gap-3 text-agg-foreground", children: [
|
|
10189
|
+
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)("span", { children: labels.activityCodes[item.code] }),
|
|
10190
|
+
/* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("span", { className: "break-all tabular-nums", children: [
|
|
10191
|
+
amount(item.amountRaw),
|
|
10192
|
+
" ",
|
|
10193
|
+
data.asset
|
|
10194
|
+
] })
|
|
10195
|
+
] }),
|
|
10196
|
+
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)("time", { dateTime: item.createdAt, className: "text-agg-muted-foreground", children: new Date(item.createdAt).toLocaleString() })
|
|
10197
|
+
] }, item.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("p", { className: "agg-type-caption text-agg-muted-foreground", children: labels.activityEmpty }) : null,
|
|
10198
|
+
/* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "flex flex-wrap gap-2", children: [
|
|
10199
|
+
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
|
|
10200
|
+
Button,
|
|
10201
|
+
{
|
|
10202
|
+
type: "button",
|
|
10203
|
+
variant: "tertiary",
|
|
10204
|
+
size: "small",
|
|
10205
|
+
disabled: activity.isFetching || page === 0,
|
|
10206
|
+
onClick: () => setPage((value) => Math.max(0, value - 1)),
|
|
10207
|
+
children: labels.activityPrevious
|
|
10208
|
+
}
|
|
10209
|
+
),
|
|
10210
|
+
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
|
|
10211
|
+
Button,
|
|
10212
|
+
{
|
|
10213
|
+
type: "button",
|
|
10214
|
+
variant: "tertiary",
|
|
10215
|
+
size: "small",
|
|
10216
|
+
disabled: activity.isFetching || unavailable || !valid || data.nextPage === null,
|
|
10217
|
+
onClick: () => {
|
|
10218
|
+
if (valid && data.nextPage !== null) setPage(data.nextPage);
|
|
10219
|
+
},
|
|
10220
|
+
children: labels.activityNext
|
|
10221
|
+
}
|
|
10222
|
+
),
|
|
10223
|
+
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
|
|
10224
|
+
Button,
|
|
10225
|
+
{
|
|
10226
|
+
type: "button",
|
|
10227
|
+
variant: "tertiary",
|
|
10228
|
+
size: "small",
|
|
10229
|
+
disabled: activity.isFetching,
|
|
10230
|
+
onClick: () => {
|
|
10231
|
+
void activity.refetch();
|
|
10232
|
+
},
|
|
10233
|
+
children: labels.activityRefresh
|
|
10234
|
+
}
|
|
10235
|
+
)
|
|
10236
|
+
] })
|
|
10237
|
+
]
|
|
10238
|
+
}
|
|
10239
|
+
);
|
|
10240
|
+
}
|
|
10241
|
+
|
|
10242
|
+
// src/pages/user-profile/components/betdex-account-card.tsx
|
|
10243
|
+
var import_jsx_runtime148 = require("react/jsx-runtime");
|
|
10244
|
+
function BetdexAccountCard({
|
|
10245
|
+
onWalletDeposit
|
|
10246
|
+
} = {}) {
|
|
10247
|
+
var _a;
|
|
10248
|
+
const [showActivity, setShowActivity] = (0, import_react23.useState)(false);
|
|
10249
|
+
const labels = (0, import_hooks47.useLabels)().userProfile.hostedBetdex;
|
|
10250
|
+
const { account, provision, isAvailable } = (0, import_hooks47.useHostedVenueAccount)("betdex");
|
|
10251
|
+
const data = account.data;
|
|
10252
|
+
if (!isAvailable || (data == null ? void 0 : data.status) === "disabled") return null;
|
|
10253
|
+
const pending = provision.isPending || (data == null ? void 0 : data.status) === "provisioning";
|
|
10254
|
+
const canCreate = (data == null ? void 0 : data.status) === "not_created" && data.provisioningEnabled;
|
|
10255
|
+
const rawLabel = (raw) => formatUsd(Number(raw) / 1e6);
|
|
10256
|
+
return /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(
|
|
10257
|
+
"section",
|
|
10258
|
+
{
|
|
10259
|
+
"aria-label": labels.title,
|
|
10260
|
+
className: "flex flex-col gap-3 rounded-agg-xl border border-agg-separator bg-agg-secondary p-5",
|
|
10261
|
+
children: [
|
|
10262
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
10263
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)(VenueLogo, { venue: import_sdk15.Venue.betdex, size: "small", className: "size-4" }),
|
|
10264
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("h3", { className: "agg-type-label text-agg-foreground", children: labels.title })
|
|
10265
|
+
] }),
|
|
10266
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("p", { className: "agg-type-caption text-agg-muted-foreground", children: labels.description }),
|
|
10267
|
+
(data == null ? void 0 : data.environment) === "sandbox" ? /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("p", { className: "agg-type-caption text-agg-warning", children: labels.sandbox }) : null,
|
|
10268
|
+
account.isPending ? /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(SkeletonBlock, { className: "h-10 w-full" }) : null,
|
|
10269
|
+
(data == null ? void 0 : data.status) === "active" && data.balanceStatus === "available" && data.balance && !account.isError ? /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("dl", { className: "flex flex-col gap-2 agg-type-caption", children: [
|
|
10270
|
+
[labels.total, data.balance.totalRaw],
|
|
10271
|
+
[labels.available, data.balance.availableRaw],
|
|
10272
|
+
[labels.reserved, data.balance.unmatchedExposureRaw]
|
|
10273
|
+
].map(([label2, raw]) => /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex justify-between gap-3", children: [
|
|
10274
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("dt", { className: "text-agg-muted-foreground", children: label2 }),
|
|
10275
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("dd", { className: "text-agg-foreground", children: rawLabel(raw) })
|
|
10276
|
+
] }, label2)) }) : null,
|
|
10277
|
+
pending ? /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("p", { role: "status", className: "agg-type-caption text-agg-muted-foreground", children: labels.provisioning }) : null,
|
|
10278
|
+
(data == null ? void 0 : data.status) === "suspended" ? /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("p", { role: "status", className: "agg-type-caption text-agg-muted-foreground", children: labels.suspended }) : null,
|
|
10279
|
+
account.isError || (data == null ? void 0 : data.status) === "unavailable" || (data == null ? void 0 : data.balanceStatus) === "unavailable" ? /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("p", { role: "status", className: "agg-type-caption text-agg-muted-foreground", children: labels.unavailable }) : null,
|
|
10280
|
+
(data == null ? void 0 : data.status) === "not_created" && !data.provisioningEnabled ? /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("p", { className: "agg-type-caption text-agg-muted-foreground", children: labels.provisioningUnavailable }) : null,
|
|
10281
|
+
provision.isError ? /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("p", { role: "alert", className: "agg-type-caption text-agg-error", children: labels.creationFailed }) : null,
|
|
10282
|
+
canCreate || (data == null ? void 0 : data.status) === "provisioning" ? /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
|
|
10283
|
+
Button,
|
|
10284
|
+
{
|
|
10285
|
+
type: "button",
|
|
10286
|
+
"aria-label": (data == null ? void 0 : data.status) === "provisioning" ? labels.checkSetup : labels.createAccount,
|
|
10287
|
+
variant: "secondary",
|
|
10288
|
+
size: "small",
|
|
10289
|
+
isLoading: provision.isPending,
|
|
10290
|
+
disabled: provision.isPending || account.isError,
|
|
10291
|
+
onClick: () => provision.mutate(),
|
|
10292
|
+
children: (data == null ? void 0 : data.status) === "provisioning" ? labels.checkSetup : labels.createAccount
|
|
10293
|
+
}
|
|
10294
|
+
) : null,
|
|
10295
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
|
|
10296
|
+
Button,
|
|
10297
|
+
{
|
|
10298
|
+
type: "button",
|
|
10299
|
+
variant: "tertiary",
|
|
10300
|
+
size: "small",
|
|
10301
|
+
disabled: account.isFetching || provision.isPending,
|
|
10302
|
+
onClick: () => {
|
|
10303
|
+
void account.refetch();
|
|
10304
|
+
},
|
|
10305
|
+
children: labels.refresh
|
|
10306
|
+
}
|
|
10307
|
+
),
|
|
10308
|
+
(data == null ? void 0 : data.accountId) && data.environment && ["active", "suspended"].includes(data.status) ? /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(import_jsx_runtime148.Fragment, { children: [
|
|
10309
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("details", { className: "group/agg-betdex-funds border-t border-agg-separator pt-3", children: [
|
|
10310
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("summary", { className: "flex min-h-11 cursor-pointer list-none items-center justify-between gap-3 text-agg-sm font-agg-bold text-agg-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary [&::-webkit-details-marker]:hidden", children: [
|
|
10311
|
+
labels.manageFunds,
|
|
10312
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
|
|
10313
|
+
Icon,
|
|
10314
|
+
{
|
|
10315
|
+
name: "chevron-down",
|
|
10316
|
+
size: "small",
|
|
10317
|
+
className: "transition-transform group-open/agg-betdex-funds:rotate-180"
|
|
10318
|
+
}
|
|
10319
|
+
)
|
|
10320
|
+
] }),
|
|
10321
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
|
|
10322
|
+
BetdexAccountTransfers,
|
|
10323
|
+
{
|
|
10324
|
+
accountId: data.accountId,
|
|
10325
|
+
environment: data.environment,
|
|
10326
|
+
availableRaw: data.balanceStatus === "available" ? (_a = data.balance) == null ? void 0 : _a.availableRaw : void 0,
|
|
10327
|
+
canDeposit: data.status === "active",
|
|
10328
|
+
onWalletDeposit
|
|
10329
|
+
},
|
|
10330
|
+
`transfers:${data.accountId}:${data.environment}`
|
|
10331
|
+
)
|
|
10332
|
+
] }),
|
|
10333
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
|
|
10334
|
+
Button,
|
|
10335
|
+
{
|
|
10336
|
+
type: "button",
|
|
10337
|
+
variant: "tertiary",
|
|
10338
|
+
size: "small",
|
|
10339
|
+
"aria-expanded": showActivity,
|
|
10340
|
+
onClick: () => setShowActivity((shown) => !shown),
|
|
10341
|
+
children: showActivity ? labels.hideActivity : labels.showActivity
|
|
10342
|
+
}
|
|
10343
|
+
),
|
|
10344
|
+
showActivity ? /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
|
|
10345
|
+
BetdexAccountActivity,
|
|
10346
|
+
{
|
|
10347
|
+
accountId: data.accountId,
|
|
10348
|
+
environment: data.environment
|
|
10349
|
+
},
|
|
10350
|
+
`${data.accountId}:${data.environment}`
|
|
10351
|
+
) : null
|
|
10352
|
+
] }) : null
|
|
10353
|
+
]
|
|
10354
|
+
}
|
|
10355
|
+
);
|
|
10356
|
+
}
|
|
10357
|
+
|
|
10358
|
+
// src/pages/user-profile/components/betdex-wallet-deposit.tsx
|
|
10359
|
+
var import_react24 = require("react");
|
|
10360
|
+
var import_hooks48 = require("@agg-build/hooks");
|
|
10361
|
+
var import_withdraw2 = require("@agg-build/hooks/withdraw");
|
|
10362
|
+
var import_jsx_runtime149 = require("react/jsx-runtime");
|
|
10363
|
+
function BetdexWalletDeposit({
|
|
10364
|
+
address,
|
|
10365
|
+
onClose
|
|
10366
|
+
}) {
|
|
10367
|
+
const labels = (0, import_hooks48.useLabels)().userProfile.hostedBetdex;
|
|
10368
|
+
const flow = (0, import_withdraw2.useWithdrawFlow)({
|
|
10369
|
+
open: true,
|
|
10370
|
+
onOpenChange: (open) => {
|
|
10371
|
+
if (!open) onClose();
|
|
10372
|
+
}
|
|
10373
|
+
});
|
|
10374
|
+
const { onWithdrawDestinationChange, onWithdrawNetworkChange, onWithdrawTokenChange } = flow;
|
|
10375
|
+
(0, import_react24.useEffect)(() => {
|
|
10376
|
+
onWithdrawDestinationChange(address);
|
|
10377
|
+
onWithdrawNetworkChange("792703809");
|
|
10378
|
+
onWithdrawTokenChange("USDC");
|
|
10379
|
+
}, [address, onWithdrawDestinationChange, onWithdrawNetworkChange, onWithdrawTokenChange]);
|
|
10380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
|
|
10381
|
+
WithdrawModal,
|
|
10382
|
+
__spreadProps(__spreadValues({}, flow), {
|
|
10383
|
+
transferTarget: {
|
|
10384
|
+
title: labels.transferToBetdex,
|
|
10385
|
+
address,
|
|
10386
|
+
chainId: "792703809",
|
|
10387
|
+
tokenSymbol: "USDC"
|
|
10388
|
+
}
|
|
10389
|
+
})
|
|
10390
|
+
);
|
|
10391
|
+
}
|
|
10392
|
+
|
|
10393
|
+
// src/trading/manage-betdex-account-modal.tsx
|
|
10394
|
+
var import_jsx_runtime150 = require("react/jsx-runtime");
|
|
10395
|
+
function ManageBetdexAccountModal({
|
|
10396
|
+
open,
|
|
10397
|
+
onOpenChange,
|
|
10398
|
+
userId
|
|
10399
|
+
}) {
|
|
10400
|
+
const labels = (0, import_hooks49.useLabels)();
|
|
10401
|
+
const [fundingTarget, setFundingTarget] = (0, import_react25.useState)(
|
|
10402
|
+
null
|
|
10403
|
+
);
|
|
10404
|
+
const currentTarget = (fundingTarget == null ? void 0 : fundingTarget.userId) === userId ? fundingTarget : null;
|
|
10405
|
+
(0, import_react25.useEffect)(() => {
|
|
10406
|
+
if (!open) setFundingTarget(null);
|
|
10407
|
+
}, [open]);
|
|
10408
|
+
(0, import_react25.useEffect)(() => setFundingTarget(null), [userId]);
|
|
10409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)(import_jsx_runtime150.Fragment, { children: [
|
|
10410
|
+
/* @__PURE__ */ (0, import_jsx_runtime150.jsx)(Modal, { open: open && !currentTarget, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)(Modal.Container, { maxWidth: "600px", "aria-label": labels.trading.manageBetdexAccount, children: [
|
|
10411
|
+
/* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
|
|
10412
|
+
Dialog6.Close,
|
|
10413
|
+
{
|
|
10414
|
+
"aria-label": labels.common.close,
|
|
10415
|
+
className: "absolute right-4 top-4 z-10 flex size-11 cursor-pointer items-center justify-center rounded-agg-full text-agg-muted-foreground hover:bg-agg-quaternary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-accent",
|
|
10416
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(Icon, { name: "close", size: "medium" })
|
|
10417
|
+
}
|
|
10418
|
+
),
|
|
10419
|
+
/* @__PURE__ */ (0, import_jsx_runtime150.jsxs)(Modal.Body, { classNames: { root: "!px-5 !py-16" }, children: [
|
|
10420
|
+
/* @__PURE__ */ (0, import_jsx_runtime150.jsx)(Dialog6.Title, { className: "sr-only", children: labels.trading.manageBetdexAccount }),
|
|
10421
|
+
/* @__PURE__ */ (0, import_jsx_runtime150.jsx)(Dialog6.Description, { className: "sr-only", children: labels.userProfile.hostedBetdex.description }),
|
|
10422
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
|
|
10423
|
+
BetdexAccountCard,
|
|
10424
|
+
{
|
|
10425
|
+
onWalletDeposit: userId ? (address) => setFundingTarget({ userId, address }) : void 0
|
|
10426
|
+
}
|
|
10427
|
+
) : null
|
|
10428
|
+
] })
|
|
10429
|
+
] }) }),
|
|
10430
|
+
open && currentTarget ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
|
|
10431
|
+
BetdexWalletDeposit,
|
|
10432
|
+
{
|
|
10433
|
+
address: currentTarget.address,
|
|
10434
|
+
onClose: () => setFundingTarget(null)
|
|
10435
|
+
},
|
|
10436
|
+
currentTarget.userId
|
|
10437
|
+
) : null
|
|
10438
|
+
] });
|
|
10439
|
+
}
|
|
10440
|
+
|
|
9921
10441
|
// src/profile/profile-modal.constants.ts
|
|
9922
10442
|
var PROFILE_TAB_KEYS = {
|
|
9923
10443
|
PROFILE_ACCOUNTS: "profile-accounts",
|
|
@@ -9933,9 +10453,9 @@ var getProfileTabItems = () => [
|
|
|
9933
10453
|
];
|
|
9934
10454
|
|
|
9935
10455
|
// src/profile/tabs/about-tab.tsx
|
|
9936
|
-
var
|
|
9937
|
-
var
|
|
9938
|
-
var
|
|
10456
|
+
var import_react26 = require("react");
|
|
10457
|
+
var import_hooks50 = require("@agg-build/hooks");
|
|
10458
|
+
var import_jsx_runtime151 = require("react/jsx-runtime");
|
|
9939
10459
|
var AboutTab = ({
|
|
9940
10460
|
avatarPreview,
|
|
9941
10461
|
onDeleteProfile: _onDeleteProfile,
|
|
@@ -9945,13 +10465,13 @@ var AboutTab = ({
|
|
|
9945
10465
|
draftAvatarPreview,
|
|
9946
10466
|
avatarError: _avatarError
|
|
9947
10467
|
}) => {
|
|
9948
|
-
const labels = (0,
|
|
9949
|
-
const fileInputRef = (0,
|
|
9950
|
-
const handleAvatarClick = (0,
|
|
10468
|
+
const labels = (0, import_hooks50.useLabels)();
|
|
10469
|
+
const fileInputRef = (0, import_react26.useRef)(null);
|
|
10470
|
+
const handleAvatarClick = (0, import_react26.useCallback)(() => {
|
|
9951
10471
|
var _a;
|
|
9952
10472
|
(_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
9953
10473
|
}, []);
|
|
9954
|
-
const handleFileChange = (0,
|
|
10474
|
+
const handleFileChange = (0, import_react26.useCallback)(
|
|
9955
10475
|
(e) => {
|
|
9956
10476
|
var _a;
|
|
9957
10477
|
const file = (_a = e.target.files) == null ? void 0 : _a[0];
|
|
@@ -9967,8 +10487,8 @@ var AboutTab = ({
|
|
|
9967
10487
|
);
|
|
9968
10488
|
const resolvedPreview = draftAvatarPreview != null ? draftAvatarPreview : avatarPreview;
|
|
9969
10489
|
const hasAvatarPreview = Boolean(resolvedPreview);
|
|
9970
|
-
return /* @__PURE__ */ (0,
|
|
9971
|
-
/* @__PURE__ */ (0,
|
|
10490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { className: "agg-profile-about flex flex-col gap-8", children: /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "agg-profile-avatar-section flex w-full items-center gap-6", children: [
|
|
10491
|
+
/* @__PURE__ */ (0, import_jsx_runtime151.jsxs)(
|
|
9972
10492
|
"button",
|
|
9973
10493
|
{
|
|
9974
10494
|
type: "button",
|
|
@@ -9985,13 +10505,13 @@ var AboutTab = ({
|
|
|
9985
10505
|
),
|
|
9986
10506
|
"aria-label": labels.onboarding.profileSetup.uploadProfilePictureAria,
|
|
9987
10507
|
children: [
|
|
9988
|
-
!hasAvatarPreview ? /* @__PURE__ */ (0,
|
|
10508
|
+
!hasAvatarPreview ? /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
|
|
9989
10509
|
"svg",
|
|
9990
10510
|
{
|
|
9991
10511
|
"aria-hidden": true,
|
|
9992
10512
|
viewBox: "0 0 80 80",
|
|
9993
10513
|
className: "pointer-events-none absolute inset-0 h-full w-full text-agg-separator group-hover:text-agg-muted-foreground",
|
|
9994
|
-
children: /* @__PURE__ */ (0,
|
|
10514
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
|
|
9995
10515
|
"circle",
|
|
9996
10516
|
{
|
|
9997
10517
|
cx: "40",
|
|
@@ -10005,18 +10525,18 @@ var AboutTab = ({
|
|
|
10005
10525
|
)
|
|
10006
10526
|
}
|
|
10007
10527
|
) : null,
|
|
10008
|
-
resolvedPreview ? /* @__PURE__ */ (0,
|
|
10528
|
+
resolvedPreview ? /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
|
|
10009
10529
|
RemoteImage,
|
|
10010
10530
|
{
|
|
10011
10531
|
src: resolvedPreview,
|
|
10012
10532
|
alt: labels.onboarding.profileSetup.profilePreviewAlt,
|
|
10013
10533
|
className: "h-full w-full object-cover"
|
|
10014
10534
|
}
|
|
10015
|
-
) : /* @__PURE__ */ (0,
|
|
10535
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(Icon, { name: "profile", className: "h-7 w-7 text-agg-muted-foreground" })
|
|
10016
10536
|
]
|
|
10017
10537
|
}
|
|
10018
10538
|
),
|
|
10019
|
-
/* @__PURE__ */ (0,
|
|
10539
|
+
/* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
|
|
10020
10540
|
"input",
|
|
10021
10541
|
{
|
|
10022
10542
|
ref: fileInputRef,
|
|
@@ -10027,8 +10547,8 @@ var AboutTab = ({
|
|
|
10027
10547
|
"aria-hidden": "true"
|
|
10028
10548
|
}
|
|
10029
10549
|
),
|
|
10030
|
-
/* @__PURE__ */ (0,
|
|
10031
|
-
/* @__PURE__ */ (0,
|
|
10550
|
+
/* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "agg-form-section flex min-w-0 flex-1 flex-col gap-2", children: [
|
|
10551
|
+
/* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
|
|
10032
10552
|
"label",
|
|
10033
10553
|
{
|
|
10034
10554
|
htmlFor: "profile-username",
|
|
@@ -10036,7 +10556,7 @@ var AboutTab = ({
|
|
|
10036
10556
|
children: "Username"
|
|
10037
10557
|
}
|
|
10038
10558
|
),
|
|
10039
|
-
/* @__PURE__ */ (0,
|
|
10559
|
+
/* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
|
|
10040
10560
|
"input",
|
|
10041
10561
|
{
|
|
10042
10562
|
id: "profile-username",
|
|
@@ -10063,9 +10583,9 @@ var AboutTab = ({
|
|
|
10063
10583
|
AboutTab.displayName = "AboutTab";
|
|
10064
10584
|
|
|
10065
10585
|
// src/profile/tabs/accounts-wallets-tab.tsx
|
|
10066
|
-
var
|
|
10067
|
-
var SectionTitle = ({ children }) => /* @__PURE__ */ (0,
|
|
10068
|
-
var AccountRow = ({ children, className }) => /* @__PURE__ */ (0,
|
|
10586
|
+
var import_jsx_runtime152 = require("react/jsx-runtime");
|
|
10587
|
+
var SectionTitle = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("h3", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children });
|
|
10588
|
+
var AccountRow = ({ children, className }) => /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
10069
10589
|
"div",
|
|
10070
10590
|
{
|
|
10071
10591
|
className: cn(
|
|
@@ -10081,11 +10601,11 @@ var AccountIdentity = ({
|
|
|
10081
10601
|
icon,
|
|
10082
10602
|
label: label2,
|
|
10083
10603
|
iconClassName
|
|
10084
|
-
}) => /* @__PURE__ */ (0,
|
|
10085
|
-
/* @__PURE__ */ (0,
|
|
10086
|
-
/* @__PURE__ */ (0,
|
|
10604
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
10605
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: cn("flex h-5 w-5 shrink-0 items-center justify-center", iconClassName), children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Icon, { name: icon, size: "small", color: "currentColor" }) }),
|
|
10606
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "truncate text-agg-base font-agg-normal leading-6 text-agg-foreground", children: label2 })
|
|
10087
10607
|
] });
|
|
10088
|
-
var ConnectTextButton = ({ onClick }) => /* @__PURE__ */ (0,
|
|
10608
|
+
var ConnectTextButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
10089
10609
|
"button",
|
|
10090
10610
|
{
|
|
10091
10611
|
type: "button",
|
|
@@ -10094,7 +10614,7 @@ var ConnectTextButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime1
|
|
|
10094
10614
|
children: "Connect"
|
|
10095
10615
|
}
|
|
10096
10616
|
);
|
|
10097
|
-
var DisconnectTextButton = ({ onClick }) => /* @__PURE__ */ (0,
|
|
10617
|
+
var DisconnectTextButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
10098
10618
|
"button",
|
|
10099
10619
|
{
|
|
10100
10620
|
type: "button",
|
|
@@ -10103,7 +10623,7 @@ var DisconnectTextButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runti
|
|
|
10103
10623
|
children: "Disconnect"
|
|
10104
10624
|
}
|
|
10105
10625
|
);
|
|
10106
|
-
var VerifiedBadge = () => /* @__PURE__ */ (0,
|
|
10626
|
+
var VerifiedBadge = () => /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Icon, { name: "check-badge", size: "small", color: "var(--agg-color-primary, #536dfe)" });
|
|
10107
10627
|
var getWalletIconName = (wallet) => {
|
|
10108
10628
|
const chain = wallet.chain.toLowerCase();
|
|
10109
10629
|
if (chain === "solana" || chain === "svm") {
|
|
@@ -10121,12 +10641,12 @@ var ConnectedAccountRow = ({
|
|
|
10121
10641
|
onDisconnect
|
|
10122
10642
|
}) => {
|
|
10123
10643
|
const displayLabel = connected ? connectedLabel != null ? connectedLabel : label2 : label2;
|
|
10124
|
-
return /* @__PURE__ */ (0,
|
|
10125
|
-
/* @__PURE__ */ (0,
|
|
10126
|
-
/* @__PURE__ */ (0,
|
|
10127
|
-
connected ? /* @__PURE__ */ (0,
|
|
10644
|
+
return /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(AccountRow, { className: "agg-social-account-row gap-4", children: [
|
|
10645
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
10646
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)(AccountIdentity, { icon, label: displayLabel, iconClassName }),
|
|
10647
|
+
connected ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(VerifiedBadge, {}) : null
|
|
10128
10648
|
] }),
|
|
10129
|
-
connected ? /* @__PURE__ */ (0,
|
|
10649
|
+
connected ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(DisconnectTextButton, { onClick: onDisconnect }) : /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(ConnectTextButton, { onClick: onConnect })
|
|
10130
10650
|
] });
|
|
10131
10651
|
};
|
|
10132
10652
|
var AccountsWalletsTab = ({
|
|
@@ -10145,11 +10665,11 @@ var AccountsWalletsTab = ({
|
|
|
10145
10665
|
const google = socialAccounts == null ? void 0 : socialAccounts.google;
|
|
10146
10666
|
const apple = socialAccounts == null ? void 0 : socialAccounts.apple;
|
|
10147
10667
|
const hasEmail = Boolean(email);
|
|
10148
|
-
return /* @__PURE__ */ (0,
|
|
10149
|
-
/* @__PURE__ */ (0,
|
|
10150
|
-
/* @__PURE__ */ (0,
|
|
10151
|
-
/* @__PURE__ */ (0,
|
|
10152
|
-
/* @__PURE__ */ (0,
|
|
10668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-accounts-wallets-tab flex flex-col gap-6", children: [
|
|
10669
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-social-accounts-section flex flex-col gap-3", children: [
|
|
10670
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)(SectionTitle, { children: "Connected accounts" }),
|
|
10671
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-social-accounts-list flex flex-col gap-4", children: [
|
|
10672
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
10153
10673
|
ConnectedAccountRow,
|
|
10154
10674
|
{
|
|
10155
10675
|
icon: "google",
|
|
@@ -10161,7 +10681,7 @@ var AccountsWalletsTab = ({
|
|
|
10161
10681
|
onDisconnect: onDisconnectGoogle
|
|
10162
10682
|
}
|
|
10163
10683
|
),
|
|
10164
|
-
/* @__PURE__ */ (0,
|
|
10684
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
10165
10685
|
ConnectedAccountRow,
|
|
10166
10686
|
{
|
|
10167
10687
|
icon: "apple",
|
|
@@ -10173,7 +10693,7 @@ var AccountsWalletsTab = ({
|
|
|
10173
10693
|
onDisconnect: onDisconnectApple
|
|
10174
10694
|
}
|
|
10175
10695
|
),
|
|
10176
|
-
/* @__PURE__ */ (0,
|
|
10696
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
10177
10697
|
ConnectedAccountRow,
|
|
10178
10698
|
{
|
|
10179
10699
|
icon: "twitter",
|
|
@@ -10185,7 +10705,7 @@ var AccountsWalletsTab = ({
|
|
|
10185
10705
|
onDisconnect: onDisconnectTwitter
|
|
10186
10706
|
}
|
|
10187
10707
|
),
|
|
10188
|
-
/* @__PURE__ */ (0,
|
|
10708
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
10189
10709
|
ConnectedAccountRow,
|
|
10190
10710
|
{
|
|
10191
10711
|
icon: "email",
|
|
@@ -10198,12 +10718,12 @@ var AccountsWalletsTab = ({
|
|
|
10198
10718
|
)
|
|
10199
10719
|
] })
|
|
10200
10720
|
] }),
|
|
10201
|
-
wallets.length > 0 ? /* @__PURE__ */ (0,
|
|
10202
|
-
/* @__PURE__ */ (0,
|
|
10203
|
-
/* @__PURE__ */ (0,
|
|
10721
|
+
wallets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-wallets-section flex flex-col gap-3", children: [
|
|
10722
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)(SectionTitle, { children: "Wallets" }),
|
|
10723
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: "flex flex-col gap-2", children: wallets.map((wallet) => {
|
|
10204
10724
|
var _a;
|
|
10205
|
-
return /* @__PURE__ */ (0,
|
|
10206
|
-
/* @__PURE__ */ (0,
|
|
10725
|
+
return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(AccountRow, { className: "gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
10726
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
10207
10727
|
AccountIdentity,
|
|
10208
10728
|
{
|
|
10209
10729
|
icon: getWalletIconName(wallet),
|
|
@@ -10211,7 +10731,7 @@ var AccountsWalletsTab = ({
|
|
|
10211
10731
|
label: (_a = wallet.displayAddress) != null ? _a : wallet.address
|
|
10212
10732
|
}
|
|
10213
10733
|
),
|
|
10214
|
-
/* @__PURE__ */ (0,
|
|
10734
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)(VerifiedBadge, {})
|
|
10215
10735
|
] }) }, `${wallet.chain}:${wallet.address}`);
|
|
10216
10736
|
}) })
|
|
10217
10737
|
] }) : null
|
|
@@ -10220,11 +10740,13 @@ var AccountsWalletsTab = ({
|
|
|
10220
10740
|
AccountsWalletsTab.displayName = "AccountsWalletsTab";
|
|
10221
10741
|
|
|
10222
10742
|
// src/profile/tabs/trading-access-tab.tsx
|
|
10223
|
-
var
|
|
10224
|
-
var
|
|
10225
|
-
var
|
|
10743
|
+
var import_hooks51 = require("@agg-build/hooks");
|
|
10744
|
+
var import_react27 = require("react");
|
|
10745
|
+
var import_jsx_runtime153 = require("react/jsx-runtime");
|
|
10226
10746
|
var TRADING_ACCESS_VENUES = [
|
|
10227
10747
|
"kalshi",
|
|
10748
|
+
"betdex",
|
|
10749
|
+
"tiprun",
|
|
10228
10750
|
"polymarket",
|
|
10229
10751
|
"opinion",
|
|
10230
10752
|
"probable",
|
|
@@ -10237,8 +10759,8 @@ var TRADING_ACCESS_VENUES = [
|
|
|
10237
10759
|
"pred"
|
|
10238
10760
|
];
|
|
10239
10761
|
var TRADING_ACCESS_VENUE_ITEMS = TRADING_ACCESS_VENUES.map((id) => ({ id }));
|
|
10240
|
-
var SectionTitle2 = ({ children }) => /* @__PURE__ */ (0,
|
|
10241
|
-
var AccessRow = ({ children }) => /* @__PURE__ */ (0,
|
|
10762
|
+
var SectionTitle2 = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("h3", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children });
|
|
10763
|
+
var AccessRow = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
|
|
10242
10764
|
"div",
|
|
10243
10765
|
{
|
|
10244
10766
|
className: cn(
|
|
@@ -10250,52 +10772,69 @@ var AccessRow = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime148.jsx)
|
|
|
10250
10772
|
}
|
|
10251
10773
|
);
|
|
10252
10774
|
var AvailableStatus = () => {
|
|
10253
|
-
const labels = (0,
|
|
10254
|
-
return /* @__PURE__ */ (0,
|
|
10255
|
-
/* @__PURE__ */ (0,
|
|
10256
|
-
/* @__PURE__ */ (0,
|
|
10775
|
+
const labels = (0, import_hooks51.useLabels)();
|
|
10776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
10777
|
+
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Icon, { name: "check-badge", size: "small", className: "text-agg-primary" }),
|
|
10778
|
+
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)("span", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground whitespace-nowrap", children: labels.trading.tradingAccessAvailable })
|
|
10257
10779
|
] });
|
|
10258
10780
|
};
|
|
10259
10781
|
var GeoblockedStatus = () => {
|
|
10260
|
-
const labels = (0,
|
|
10261
|
-
return /* @__PURE__ */ (0,
|
|
10262
|
-
/* @__PURE__ */ (0,
|
|
10263
|
-
/* @__PURE__ */ (0,
|
|
10782
|
+
const labels = (0, import_hooks51.useLabels)();
|
|
10783
|
+
return /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: "flex items-center gap-2 text-agg-muted-foreground", children: [
|
|
10784
|
+
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Icon, { name: "warning-filled", size: "small", color: "currentColor" }),
|
|
10785
|
+
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)("span", { className: "text-agg-sm font-agg-normal leading-agg-5 whitespace-nowrap", children: labels.trading.venueUnavailableInRegion })
|
|
10264
10786
|
] });
|
|
10265
10787
|
};
|
|
10266
10788
|
var TradingAccessTab = ({
|
|
10267
10789
|
venueAccounts,
|
|
10268
10790
|
onConnectKalshi,
|
|
10269
|
-
onDisconnectKalshi
|
|
10791
|
+
onDisconnectKalshi,
|
|
10792
|
+
onConfigureBetdex
|
|
10270
10793
|
}) => {
|
|
10271
|
-
|
|
10272
|
-
const
|
|
10273
|
-
const {
|
|
10274
|
-
const
|
|
10275
|
-
|
|
10276
|
-
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
|
|
10281
|
-
|
|
10794
|
+
var _a;
|
|
10795
|
+
const labels = (0, import_hooks51.useLabels)();
|
|
10796
|
+
const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks51.useAppConfig)();
|
|
10797
|
+
const { isLocationBlocked } = (0, import_hooks51.useGeoBlock)();
|
|
10798
|
+
const hasBetdexAccount = (_a = venueAccounts == null ? void 0 : venueAccounts.some((account) => account.venue === "betdex")) != null ? _a : false;
|
|
10799
|
+
const visibleVenues = (0, import_react27.useMemo)(() => {
|
|
10800
|
+
const visible = (0, import_hooks51.getVisibleVenuesByConfig)(TRADING_ACCESS_VENUE_ITEMS, disabledVenues);
|
|
10801
|
+
return TRADING_ACCESS_VENUE_ITEMS.filter(
|
|
10802
|
+
(item) => visible.includes(item) || item.id === "betdex" && hasBetdexAccount
|
|
10803
|
+
);
|
|
10804
|
+
}, [disabledVenues, hasBetdexAccount]);
|
|
10805
|
+
return /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: "agg-trading-access-section flex flex-col gap-4", children: [
|
|
10806
|
+
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)(SectionTitle2, { children: labels.trading.tradingAccessVenues }),
|
|
10807
|
+
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { className: "flex flex-col gap-3", children: visibleVenues.map(({ id: venue }) => {
|
|
10808
|
+
var _a2;
|
|
10282
10809
|
const venueAccount = venueAccounts == null ? void 0 : venueAccounts.find((account) => account.venue === venue);
|
|
10283
10810
|
const isKalshi = venue === "kalshi";
|
|
10811
|
+
const isBetdex = venue === "betdex";
|
|
10812
|
+
const canManageBetdex = isBetdex && hasBetdexAccount && !isAppConfigLoading;
|
|
10284
10813
|
const isConnected = (venueAccount == null ? void 0 : venueAccount.status) === "active";
|
|
10285
|
-
const availabilityState = (0,
|
|
10814
|
+
const availabilityState = (0, import_hooks51.getVenueAvailabilityState)({
|
|
10286
10815
|
venueId: venue,
|
|
10287
10816
|
disabledVenues,
|
|
10288
|
-
isConfigLoading: isKalshi && isAppConfigLoading,
|
|
10817
|
+
isConfigLoading: (isKalshi || isBetdex) && isAppConfigLoading,
|
|
10289
10818
|
isLocationBlocked
|
|
10290
10819
|
});
|
|
10291
|
-
const displayName = (
|
|
10292
|
-
if (availabilityState === "hidden") return null;
|
|
10293
|
-
return /* @__PURE__ */ (0,
|
|
10294
|
-
/* @__PURE__ */ (0,
|
|
10295
|
-
/* @__PURE__ */ (0,
|
|
10296
|
-
/* @__PURE__ */ (0,
|
|
10820
|
+
const displayName = (_a2 = venueLogoLabels[venue]) != null ? _a2 : venue;
|
|
10821
|
+
if (availabilityState === "hidden" && !canManageBetdex) return null;
|
|
10822
|
+
return /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(AccessRow, { children: [
|
|
10823
|
+
/* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
10824
|
+
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)(VenueLogo, { venue, size: "small" }),
|
|
10825
|
+
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)("span", { className: "truncate text-agg-base font-agg-normal leading-6 text-agg-foreground", children: displayName })
|
|
10297
10826
|
] }),
|
|
10298
|
-
availabilityState === "
|
|
10827
|
+
isBetdex && (availabilityState === "available" || canManageBetdex) ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
|
|
10828
|
+
"button",
|
|
10829
|
+
{
|
|
10830
|
+
type: "button",
|
|
10831
|
+
onClick: onConfigureBetdex,
|
|
10832
|
+
disabled: !onConfigureBetdex,
|
|
10833
|
+
"aria-label": labels.trading.manageBetdexAccount,
|
|
10834
|
+
className: "min-h-11 shrink-0 cursor-pointer text-agg-sm font-agg-bold leading-agg-5 text-agg-primary whitespace-nowrap focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary disabled:cursor-not-allowed disabled:opacity-60",
|
|
10835
|
+
children: labels.trading.configureBetdexAccount
|
|
10836
|
+
}
|
|
10837
|
+
) : availabilityState === "geoblocked" ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(GeoblockedStatus, {}) : isKalshi && !isConnected ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
|
|
10299
10838
|
"button",
|
|
10300
10839
|
{
|
|
10301
10840
|
type: "button",
|
|
@@ -10304,9 +10843,9 @@ var TradingAccessTab = ({
|
|
|
10304
10843
|
className: "shrink-0 cursor-pointer text-agg-sm font-agg-bold leading-agg-5 text-agg-primary whitespace-nowrap focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary disabled:cursor-not-allowed disabled:opacity-60",
|
|
10305
10844
|
children: labels.trading.tradingAccessAddKalshiAccount
|
|
10306
10845
|
}
|
|
10307
|
-
) : isKalshi ? /* @__PURE__ */ (0,
|
|
10308
|
-
/* @__PURE__ */ (0,
|
|
10309
|
-
onDisconnectKalshi ? /* @__PURE__ */ (0,
|
|
10846
|
+
) : isKalshi ? /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
10847
|
+
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)(AvailableStatus, {}),
|
|
10848
|
+
onDisconnectKalshi ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
|
|
10310
10849
|
"button",
|
|
10311
10850
|
{
|
|
10312
10851
|
type: "button",
|
|
@@ -10315,7 +10854,7 @@ var TradingAccessTab = ({
|
|
|
10315
10854
|
children: labels.auth.disconnect
|
|
10316
10855
|
}
|
|
10317
10856
|
) : null
|
|
10318
|
-
] }) : /* @__PURE__ */ (0,
|
|
10857
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(AvailableStatus, {})
|
|
10319
10858
|
] }, venue);
|
|
10320
10859
|
}) })
|
|
10321
10860
|
] });
|
|
@@ -10323,7 +10862,7 @@ var TradingAccessTab = ({
|
|
|
10323
10862
|
TradingAccessTab.displayName = "TradingAccessTab";
|
|
10324
10863
|
|
|
10325
10864
|
// src/profile/index.tsx
|
|
10326
|
-
var
|
|
10865
|
+
var import_jsx_runtime154 = require("react/jsx-runtime");
|
|
10327
10866
|
var ProfileModal = ({
|
|
10328
10867
|
open,
|
|
10329
10868
|
onOpenChange,
|
|
@@ -10346,32 +10885,36 @@ var ProfileModal = ({
|
|
|
10346
10885
|
onConnectKalshi,
|
|
10347
10886
|
onDisconnectExchange
|
|
10348
10887
|
}) => {
|
|
10349
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
10350
|
-
const client = (0,
|
|
10351
|
-
const { user } = (0,
|
|
10888
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
10889
|
+
const client = (0, import_hooks52.useAggClient)();
|
|
10890
|
+
const { user } = (0, import_hooks52.useAggAuthState)();
|
|
10352
10891
|
const toastCtx = useOptionalToast();
|
|
10353
|
-
const [activeTab, setActiveTab] = (0,
|
|
10354
|
-
const profileTabItems = (0,
|
|
10892
|
+
const [activeTab, setActiveTab] = (0, import_react28.useState)(PROFILE_TAB_KEYS.PROFILE_ACCOUNTS);
|
|
10893
|
+
const profileTabItems = (0, import_react28.useMemo)(() => getProfileTabItems(), []);
|
|
10355
10894
|
const resolvedInitialUsername = (_a = username != null ? username : user == null ? void 0 : user.username) != null ? _a : "";
|
|
10356
|
-
const [draftUsername, setDraftUsername] = (0,
|
|
10357
|
-
const [draftAvatarFile, setDraftAvatarFile] = (0,
|
|
10358
|
-
const [draftAvatarPreview, setDraftAvatarPreview] = (0,
|
|
10359
|
-
const [isSaving, setIsSaving] = (0,
|
|
10360
|
-
const [avatarTypeError, setAvatarTypeError] = (0,
|
|
10361
|
-
const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0,
|
|
10362
|
-
const
|
|
10363
|
-
|
|
10895
|
+
const [draftUsername, setDraftUsername] = (0, import_react28.useState)(resolvedInitialUsername);
|
|
10896
|
+
const [draftAvatarFile, setDraftAvatarFile] = (0, import_react28.useState)();
|
|
10897
|
+
const [draftAvatarPreview, setDraftAvatarPreview] = (0, import_react28.useState)();
|
|
10898
|
+
const [isSaving, setIsSaving] = (0, import_react28.useState)(false);
|
|
10899
|
+
const [avatarTypeError, setAvatarTypeError] = (0, import_react28.useState)(null);
|
|
10900
|
+
const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0, import_react28.useState)(false);
|
|
10901
|
+
const [betdexAccountUserId, setBetdexAccountUserId] = (0, import_react28.useState)(null);
|
|
10902
|
+
const isBetdexAccountModalOpen = !!(user == null ? void 0 : user.id) && betdexAccountUserId === user.id;
|
|
10903
|
+
const { data: kalshiStatus, refetch: refetchKalshiStatus } = (0, import_hooks52.useVenueKeyStatus)(
|
|
10904
|
+
import_sdk16.Venue.kalshi,
|
|
10364
10905
|
open
|
|
10365
10906
|
);
|
|
10366
|
-
(0,
|
|
10907
|
+
(0, import_react28.useEffect)(() => {
|
|
10367
10908
|
var _a2;
|
|
10368
10909
|
setDraftUsername((_a2 = username != null ? username : user == null ? void 0 : user.username) != null ? _a2 : "");
|
|
10369
10910
|
}, [username, user == null ? void 0 : user.username]);
|
|
10370
|
-
(0,
|
|
10911
|
+
(0, import_react28.useEffect)(() => {
|
|
10371
10912
|
if (open) return;
|
|
10372
10913
|
setIsConnectKalshiModalOpen(false);
|
|
10914
|
+
setBetdexAccountUserId(null);
|
|
10373
10915
|
}, [open]);
|
|
10374
|
-
|
|
10916
|
+
(0, import_react28.useEffect)(() => setBetdexAccountUserId(null), [user == null ? void 0 : user.id]);
|
|
10917
|
+
const handleOpenChange = (0, import_react28.useCallback)(
|
|
10375
10918
|
(isOpen) => {
|
|
10376
10919
|
var _a2;
|
|
10377
10920
|
if (!isOpen) {
|
|
@@ -10395,7 +10938,7 @@ var ProfileModal = ({
|
|
|
10395
10938
|
setDraftAvatarPreview
|
|
10396
10939
|
]
|
|
10397
10940
|
);
|
|
10398
|
-
const handleDraftAvatarChange = (0,
|
|
10941
|
+
const handleDraftAvatarChange = (0, import_react28.useCallback)(
|
|
10399
10942
|
(file, preview) => {
|
|
10400
10943
|
const ACCEPTED_AVATAR_TYPES = ["image/jpeg", "image/png", "image/gif", "image/webp"];
|
|
10401
10944
|
if (file && !ACCEPTED_AVATAR_TYPES.includes(file.type)) {
|
|
@@ -10410,7 +10953,7 @@ var ProfileModal = ({
|
|
|
10410
10953
|
);
|
|
10411
10954
|
const originalUsername = (_b = username != null ? username : user == null ? void 0 : user.username) != null ? _b : "";
|
|
10412
10955
|
const hasChanges = draftUsername !== originalUsername || draftAvatarFile !== void 0;
|
|
10413
|
-
const handleSave = (0,
|
|
10956
|
+
const handleSave = (0, import_react28.useCallback)(() => __async(null, null, function* () {
|
|
10414
10957
|
var _a2, _b2, _c2;
|
|
10415
10958
|
setIsSaving(true);
|
|
10416
10959
|
try {
|
|
@@ -10465,16 +11008,16 @@ var ProfileModal = ({
|
|
|
10465
11008
|
originalUsername,
|
|
10466
11009
|
toastCtx
|
|
10467
11010
|
]);
|
|
10468
|
-
const handleCancel = (0,
|
|
11011
|
+
const handleCancel = (0, import_react28.useCallback)(() => {
|
|
10469
11012
|
handleOpenChange(false);
|
|
10470
11013
|
}, [handleOpenChange]);
|
|
10471
|
-
const handleVerifyKalshi = (0,
|
|
11014
|
+
const handleVerifyKalshi = (0, import_react28.useCallback)(
|
|
10472
11015
|
(credentials) => __async(null, null, function* () {
|
|
10473
11016
|
if (onConnectKalshi) {
|
|
10474
11017
|
yield onConnectKalshi(credentials);
|
|
10475
11018
|
} else {
|
|
10476
11019
|
yield client.upsertVenueKey({
|
|
10477
|
-
venue:
|
|
11020
|
+
venue: import_sdk16.Venue.kalshi,
|
|
10478
11021
|
credentials: {
|
|
10479
11022
|
keyId: credentials.apiKeyId,
|
|
10480
11023
|
privateKey: credentials.privateKey
|
|
@@ -10486,12 +11029,12 @@ var ProfileModal = ({
|
|
|
10486
11029
|
}),
|
|
10487
11030
|
[client, onConnectKalshi, refetchKalshiStatus]
|
|
10488
11031
|
);
|
|
10489
|
-
const handleDisconnectKalshi = (0,
|
|
10490
|
-
yield client.deleteVenueKey(
|
|
11032
|
+
const handleDisconnectKalshi = (0, import_react28.useCallback)(() => __async(null, null, function* () {
|
|
11033
|
+
yield client.deleteVenueKey(import_sdk16.Venue.kalshi);
|
|
10491
11034
|
yield refetchKalshiStatus();
|
|
10492
|
-
onDisconnectExchange == null ? void 0 : onDisconnectExchange(
|
|
11035
|
+
onDisconnectExchange == null ? void 0 : onDisconnectExchange(import_sdk16.Venue.kalshi);
|
|
10493
11036
|
}), [client, onDisconnectExchange, refetchKalshiStatus]);
|
|
10494
|
-
const resolvedVenueAccounts = (0,
|
|
11037
|
+
const resolvedVenueAccounts = (0, import_react28.useMemo)(() => {
|
|
10495
11038
|
var _a2;
|
|
10496
11039
|
const nonKalshiAccounts = (_a2 = user == null ? void 0 : user.venueAccounts) == null ? void 0 : _a2.filter((account) => account.venue !== "kalshi");
|
|
10497
11040
|
if (!kalshiStatus) return user == null ? void 0 : user.venueAccounts;
|
|
@@ -10500,7 +11043,7 @@ var ProfileModal = ({
|
|
|
10500
11043
|
...nonKalshiAccounts != null ? nonKalshiAccounts : [],
|
|
10501
11044
|
{
|
|
10502
11045
|
id: "kalshi-venue-key",
|
|
10503
|
-
venue:
|
|
11046
|
+
venue: import_sdk16.Venue.kalshi,
|
|
10504
11047
|
status: "active",
|
|
10505
11048
|
kycStatus: kalshiStatus.kycStatus
|
|
10506
11049
|
}
|
|
@@ -10547,7 +11090,7 @@ var ProfileModal = ({
|
|
|
10547
11090
|
if (typeof window === "undefined") return;
|
|
10548
11091
|
((_a2 = window.top) != null ? _a2 : window).location.assign(url);
|
|
10549
11092
|
};
|
|
10550
|
-
const surfaceError = (0,
|
|
11093
|
+
const surfaceError = (0, import_react28.useCallback)(
|
|
10551
11094
|
(err, title2) => {
|
|
10552
11095
|
const message = (err == null ? void 0 : err.message) || "Something went wrong. Please try again.";
|
|
10553
11096
|
if (toastCtx) {
|
|
@@ -10558,7 +11101,7 @@ var ProfileModal = ({
|
|
|
10558
11101
|
},
|
|
10559
11102
|
[toastCtx]
|
|
10560
11103
|
);
|
|
10561
|
-
const handleConnectTwitter = (0,
|
|
11104
|
+
const handleConnectTwitter = (0, import_react28.useCallback)(() => __async(null, null, function* () {
|
|
10562
11105
|
try {
|
|
10563
11106
|
const result = yield client.linkAccount({
|
|
10564
11107
|
provider: "twitter",
|
|
@@ -10572,7 +11115,7 @@ var ProfileModal = ({
|
|
|
10572
11115
|
surfaceError(err, "Could not connect X (Twitter)");
|
|
10573
11116
|
}
|
|
10574
11117
|
}), [client, onConnectTwitter, surfaceError]);
|
|
10575
|
-
const handleConnectGoogle = (0,
|
|
11118
|
+
const handleConnectGoogle = (0, import_react28.useCallback)(() => __async(null, null, function* () {
|
|
10576
11119
|
try {
|
|
10577
11120
|
const result = yield client.linkAccount({
|
|
10578
11121
|
provider: "google",
|
|
@@ -10586,7 +11129,7 @@ var ProfileModal = ({
|
|
|
10586
11129
|
surfaceError(err, "Could not connect Google");
|
|
10587
11130
|
}
|
|
10588
11131
|
}), [client, onConnectGoogle, surfaceError]);
|
|
10589
|
-
const handleConnectApple = (0,
|
|
11132
|
+
const handleConnectApple = (0, import_react28.useCallback)(() => __async(null, null, function* () {
|
|
10590
11133
|
try {
|
|
10591
11134
|
const result = yield client.linkAccount({
|
|
10592
11135
|
provider: "apple",
|
|
@@ -10600,7 +11143,7 @@ var ProfileModal = ({
|
|
|
10600
11143
|
surfaceError(err, "Could not connect Apple");
|
|
10601
11144
|
}
|
|
10602
11145
|
}), [client, onConnectApple, surfaceError]);
|
|
10603
|
-
const handleDisconnectTwitter = (0,
|
|
11146
|
+
const handleDisconnectTwitter = (0, import_react28.useCallback)(() => __async(null, null, function* () {
|
|
10604
11147
|
try {
|
|
10605
11148
|
yield client.disconnectAccount("twitter");
|
|
10606
11149
|
yield client.getCurrentUser();
|
|
@@ -10609,7 +11152,7 @@ var ProfileModal = ({
|
|
|
10609
11152
|
surfaceError(err, "Could not disconnect X (Twitter)");
|
|
10610
11153
|
}
|
|
10611
11154
|
}), [client, onDisconnectTwitter, surfaceError]);
|
|
10612
|
-
const handleDisconnectGoogle = (0,
|
|
11155
|
+
const handleDisconnectGoogle = (0, import_react28.useCallback)(() => __async(null, null, function* () {
|
|
10613
11156
|
try {
|
|
10614
11157
|
yield client.disconnectAccount("google");
|
|
10615
11158
|
yield client.getCurrentUser();
|
|
@@ -10618,7 +11161,7 @@ var ProfileModal = ({
|
|
|
10618
11161
|
surfaceError(err, "Could not disconnect Google");
|
|
10619
11162
|
}
|
|
10620
11163
|
}), [client, onDisconnectGoogle, surfaceError]);
|
|
10621
|
-
const handleDisconnectApple = (0,
|
|
11164
|
+
const handleDisconnectApple = (0, import_react28.useCallback)(() => __async(null, null, function* () {
|
|
10622
11165
|
try {
|
|
10623
11166
|
yield client.disconnectAccount("apple");
|
|
10624
11167
|
yield client.getCurrentUser();
|
|
@@ -10627,7 +11170,7 @@ var ProfileModal = ({
|
|
|
10627
11170
|
surfaceError(err, "Could not disconnect Apple");
|
|
10628
11171
|
}
|
|
10629
11172
|
}), [client, onDisconnectApple, surfaceError]);
|
|
10630
|
-
const handleConnectEmail = (0,
|
|
11173
|
+
const handleConnectEmail = (0, import_react28.useCallback)(() => __async(null, null, function* () {
|
|
10631
11174
|
var _a2;
|
|
10632
11175
|
const typedEmail = typeof window !== "undefined" ? (_a2 = window.prompt("Enter your email to receive a magic link")) == null ? void 0 : _a2.trim() : void 0;
|
|
10633
11176
|
if (!typedEmail) return;
|
|
@@ -10646,7 +11189,7 @@ var ProfileModal = ({
|
|
|
10646
11189
|
surfaceError(err, "Could not connect email");
|
|
10647
11190
|
}
|
|
10648
11191
|
}), [client, onConnectEmail, surfaceError, toastCtx]);
|
|
10649
|
-
const handleDisconnectWallet = (0,
|
|
11192
|
+
const handleDisconnectWallet = (0, import_react28.useCallback)(
|
|
10650
11193
|
(wallet) => __async(null, null, function* () {
|
|
10651
11194
|
const normalizedChain = wallet.chain.toLowerCase();
|
|
10652
11195
|
const provider = normalizedChain === "solana" || normalizedChain === "svm" ? "solana_wallet" : "wallet";
|
|
@@ -10660,7 +11203,7 @@ var ProfileModal = ({
|
|
|
10660
11203
|
}),
|
|
10661
11204
|
[client, onDisconnectWallet, surfaceError]
|
|
10662
11205
|
);
|
|
10663
|
-
const providerActionMap = (0,
|
|
11206
|
+
const providerActionMap = (0, import_react28.useMemo)(
|
|
10664
11207
|
() => ({
|
|
10665
11208
|
twitter: {
|
|
10666
11209
|
connect: () => {
|
|
@@ -10702,7 +11245,7 @@ var ProfileModal = ({
|
|
|
10702
11245
|
handleDisconnectTwitter
|
|
10703
11246
|
]
|
|
10704
11247
|
);
|
|
10705
|
-
const resolvedWallets = (0,
|
|
11248
|
+
const resolvedWallets = (0, import_react28.useMemo)(() => {
|
|
10706
11249
|
var _a2, _b2;
|
|
10707
11250
|
if (wallets) return wallets;
|
|
10708
11251
|
const walletAccounts = (_b2 = (_a2 = user == null ? void 0 : user.accounts) == null ? void 0 : _a2.filter((account) => {
|
|
@@ -10721,178 +11264,198 @@ var ProfileModal = ({
|
|
|
10721
11264
|
};
|
|
10722
11265
|
});
|
|
10723
11266
|
}, [user == null ? void 0 : user.accounts, wallets]);
|
|
10724
|
-
return /* @__PURE__ */ (0,
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
|
|
10729
|
-
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10733
|
-
|
|
10734
|
-
|
|
10735
|
-
|
|
10736
|
-
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
|
|
10741
|
-
|
|
10742
|
-
|
|
10743
|
-
|
|
10744
|
-
|
|
10745
|
-
|
|
10746
|
-
|
|
10747
|
-
|
|
10748
|
-
|
|
10749
|
-
|
|
10750
|
-
|
|
10751
|
-
|
|
10752
|
-
|
|
10753
|
-
|
|
10754
|
-
|
|
10755
|
-
|
|
10756
|
-
|
|
10757
|
-
"
|
|
10758
|
-
"overflow-hidden rounded-agg-lg",
|
|
10759
|
-
"border border-agg-separator",
|
|
10760
|
-
"bg-agg-secondary",
|
|
10761
|
-
"py-3"
|
|
10762
|
-
),
|
|
10763
|
-
role: "tablist",
|
|
10764
|
-
"aria-label": "Profile sections",
|
|
10765
|
-
children: profileTabItems.map((tab) => {
|
|
10766
|
-
const isActive = activeTab === tab.value;
|
|
10767
|
-
return /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)(
|
|
10768
|
-
"button",
|
|
10769
|
-
{
|
|
10770
|
-
type: "button",
|
|
10771
|
-
role: "tab",
|
|
10772
|
-
"aria-selected": isActive,
|
|
10773
|
-
onClick: () => setActiveTab(tab.value),
|
|
10774
|
-
className: cn(
|
|
10775
|
-
"agg-profile-tab-trigger",
|
|
10776
|
-
"relative flex items-center gap-3",
|
|
10777
|
-
"h-[49px] px-6 py-4",
|
|
10778
|
-
"text-agg-sm leading-agg-5 font-agg-sans",
|
|
10779
|
-
"transition-colors cursor-pointer",
|
|
10780
|
-
isActive ? "font-agg-normal text-agg-foreground bg-agg-secondary-hover" : "font-agg-normal text-agg-foreground"
|
|
10781
|
-
),
|
|
10782
|
-
children: [
|
|
10783
|
-
isActive ? /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "absolute left-0 top-0 bottom-0 w-1 bg-agg-primary" }) : null,
|
|
10784
|
-
/* @__PURE__ */ (0, import_jsx_runtime149.jsx)(Icon, { name: tab.icon, size: "small", color: "currentColor" }),
|
|
10785
|
-
/* @__PURE__ */ (0, import_jsx_runtime149.jsx)("span", { className: "shrink-0 whitespace-nowrap", children: tab.label })
|
|
10786
|
-
]
|
|
10787
|
-
},
|
|
10788
|
-
tab.value
|
|
10789
|
-
);
|
|
10790
|
-
})
|
|
10791
|
-
}
|
|
10792
|
-
) }),
|
|
10793
|
-
/* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "agg-profile-content min-w-0 flex-1", children: [
|
|
10794
|
-
activeTab === PROFILE_TAB_KEYS.PROFILE_ACCOUNTS ? /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "agg-profile-accounts-tab flex flex-col gap-8", children: [
|
|
10795
|
-
/* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
|
|
10796
|
-
AboutTab,
|
|
11267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(
|
|
11268
|
+
Modal,
|
|
11269
|
+
{
|
|
11270
|
+
open: open && !isConnectKalshiModalOpen && !isBetdexAccountModalOpen,
|
|
11271
|
+
onOpenChange: handleOpenChange,
|
|
11272
|
+
children: [
|
|
11273
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(
|
|
11274
|
+
Modal.Container,
|
|
11275
|
+
{
|
|
11276
|
+
maxWidth: "800px",
|
|
11277
|
+
"aria-label": "Edit Profile",
|
|
11278
|
+
classNames: {
|
|
11279
|
+
container: cn("agg-profile-modal", "min-h-[37.5rem]")
|
|
11280
|
+
},
|
|
11281
|
+
children: [
|
|
11282
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(Modal.Header, { title: "Edit Profile", classNames: { root: "agg-profile-modal-header" } }),
|
|
11283
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)("div", { className: "agg-profile-tabs sm:hidden w-full", children: /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
11284
|
+
Tabs,
|
|
11285
|
+
{
|
|
11286
|
+
className: "w-full [&>div]:w-full",
|
|
11287
|
+
variant: "underline",
|
|
11288
|
+
classNames: { tabList: "w-full" },
|
|
11289
|
+
items: profileTabItems.map((tab) => ({
|
|
11290
|
+
value: tab.value,
|
|
11291
|
+
label: tab.label,
|
|
11292
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(Icon, { name: tab.icon, size: "small" })
|
|
11293
|
+
})),
|
|
11294
|
+
value: activeTab,
|
|
11295
|
+
onChange: (val) => setActiveTab(val)
|
|
11296
|
+
}
|
|
11297
|
+
) }),
|
|
11298
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(Modal.Body, { classNames: { root: cn("agg-profile-modal-body", "overflow-x-visible") }, children: /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)("div", { className: "agg-profile-layout flex flex-col sm:flex-row sm:gap-10", children: [
|
|
11299
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
11300
|
+
"nav",
|
|
10797
11301
|
{
|
|
10798
|
-
|
|
10799
|
-
|
|
10800
|
-
|
|
10801
|
-
|
|
10802
|
-
|
|
10803
|
-
|
|
10804
|
-
|
|
10805
|
-
|
|
10806
|
-
|
|
11302
|
+
className: cn(
|
|
11303
|
+
"agg-profile-sidebar",
|
|
11304
|
+
"hidden sm:sticky sm:top-0 sm:self-start sm:flex sm:flex-col",
|
|
11305
|
+
"w-[240px]",
|
|
11306
|
+
"overflow-hidden rounded-agg-lg",
|
|
11307
|
+
"border border-agg-separator",
|
|
11308
|
+
"bg-agg-secondary",
|
|
11309
|
+
"py-3"
|
|
11310
|
+
),
|
|
11311
|
+
role: "tablist",
|
|
11312
|
+
"aria-label": "Profile sections",
|
|
11313
|
+
children: profileTabItems.map((tab) => {
|
|
11314
|
+
const isActive = activeTab === tab.value;
|
|
11315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(
|
|
11316
|
+
"button",
|
|
11317
|
+
{
|
|
11318
|
+
type: "button",
|
|
11319
|
+
role: "tab",
|
|
11320
|
+
"aria-selected": isActive,
|
|
11321
|
+
onClick: () => setActiveTab(tab.value),
|
|
11322
|
+
className: cn(
|
|
11323
|
+
"agg-profile-tab-trigger",
|
|
11324
|
+
"relative flex items-center gap-3",
|
|
11325
|
+
"h-[49px] px-6 py-4",
|
|
11326
|
+
"text-agg-sm leading-agg-5 font-agg-sans",
|
|
11327
|
+
"transition-colors cursor-pointer",
|
|
11328
|
+
isActive ? "font-agg-normal text-agg-foreground bg-agg-secondary-hover" : "font-agg-normal text-agg-foreground"
|
|
11329
|
+
),
|
|
11330
|
+
children: [
|
|
11331
|
+
isActive ? /* @__PURE__ */ (0, import_jsx_runtime154.jsx)("div", { className: "absolute left-0 top-0 bottom-0 w-1 bg-agg-primary" }) : null,
|
|
11332
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(Icon, { name: tab.icon, size: "small", color: "currentColor" }),
|
|
11333
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)("span", { className: "shrink-0 whitespace-nowrap", children: tab.label })
|
|
11334
|
+
]
|
|
11335
|
+
},
|
|
11336
|
+
tab.value
|
|
11337
|
+
);
|
|
11338
|
+
})
|
|
10807
11339
|
}
|
|
10808
|
-
),
|
|
10809
|
-
/* @__PURE__ */ (0,
|
|
10810
|
-
|
|
11340
|
+
) }),
|
|
11341
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsxs)("div", { className: "agg-profile-content min-w-0 flex-1", children: [
|
|
11342
|
+
activeTab === PROFILE_TAB_KEYS.PROFILE_ACCOUNTS ? /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)("div", { className: "agg-profile-accounts-tab flex flex-col gap-8", children: [
|
|
11343
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
11344
|
+
AboutTab,
|
|
11345
|
+
{
|
|
11346
|
+
username: username != null ? username : user == null ? void 0 : user.username,
|
|
11347
|
+
avatarPreview: (_i = user == null ? void 0 : user.avatarUrl) != null ? _i : avatarPreview,
|
|
11348
|
+
onDeleteProfile,
|
|
11349
|
+
draftUsername,
|
|
11350
|
+
onDraftUsernameChange: setDraftUsername,
|
|
11351
|
+
draftAvatarFile,
|
|
11352
|
+
onDraftAvatarChange: handleDraftAvatarChange,
|
|
11353
|
+
draftAvatarPreview,
|
|
11354
|
+
avatarError: avatarTypeError
|
|
11355
|
+
}
|
|
11356
|
+
),
|
|
11357
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
11358
|
+
AccountsWalletsTab,
|
|
11359
|
+
{
|
|
11360
|
+
socialAccounts: resolvedSocialAccounts,
|
|
11361
|
+
wallets: resolvedWallets,
|
|
11362
|
+
email: resolvedEmail,
|
|
11363
|
+
onConnectTwitter: providerActionMap.twitter.connect,
|
|
11364
|
+
onDisconnectTwitter: providerActionMap.twitter.disconnect,
|
|
11365
|
+
onConnectGoogle: providerActionMap.google.connect,
|
|
11366
|
+
onDisconnectGoogle: providerActionMap.google.disconnect,
|
|
11367
|
+
onConnectApple: providerActionMap.apple.connect,
|
|
11368
|
+
onDisconnectApple: providerActionMap.apple.disconnect,
|
|
11369
|
+
onDisconnectWallet: (wallet) => {
|
|
11370
|
+
void handleDisconnectWallet(wallet);
|
|
11371
|
+
},
|
|
11372
|
+
onConnectEmail: providerActionMap.email.connect
|
|
11373
|
+
}
|
|
11374
|
+
)
|
|
11375
|
+
] }) : null,
|
|
11376
|
+
activeTab === PROFILE_TAB_KEYS.TRADING_ACCESS ? /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
11377
|
+
TradingAccessTab,
|
|
11378
|
+
{
|
|
11379
|
+
venueAccounts: resolvedVenueAccounts,
|
|
11380
|
+
onConnectKalshi: () => setIsConnectKalshiModalOpen(true),
|
|
11381
|
+
onConfigureBetdex: (user == null ? void 0 : user.id) ? () => setBetdexAccountUserId(user.id) : void 0,
|
|
11382
|
+
onDisconnectKalshi: handleDisconnectKalshi,
|
|
11383
|
+
onKycError
|
|
11384
|
+
}
|
|
11385
|
+
) : null
|
|
11386
|
+
] })
|
|
11387
|
+
] }) }),
|
|
11388
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(Modal.Footer, { classNames: { root: "agg-profile-modal-footer" }, children: [
|
|
11389
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(Button, { variant: "secondary", size: "large", onClick: handleCancel, className: "min-w-[120px]", children: "Cancel" }),
|
|
11390
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
11391
|
+
Button,
|
|
10811
11392
|
{
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
|
|
10816
|
-
|
|
10817
|
-
|
|
10818
|
-
onDisconnectGoogle: providerActionMap.google.disconnect,
|
|
10819
|
-
onConnectApple: providerActionMap.apple.connect,
|
|
10820
|
-
onDisconnectApple: providerActionMap.apple.disconnect,
|
|
10821
|
-
onDisconnectWallet: (wallet) => {
|
|
10822
|
-
void handleDisconnectWallet(wallet);
|
|
10823
|
-
},
|
|
10824
|
-
onConnectEmail: providerActionMap.email.connect
|
|
11393
|
+
variant: "primary",
|
|
11394
|
+
size: "large",
|
|
11395
|
+
disabled: !hasChanges,
|
|
11396
|
+
isLoading: isSaving,
|
|
11397
|
+
onClick: handleSave,
|
|
11398
|
+
children: "Save changes"
|
|
10825
11399
|
}
|
|
10826
11400
|
)
|
|
10827
|
-
] })
|
|
10828
|
-
|
|
10829
|
-
|
|
10830
|
-
|
|
10831
|
-
|
|
10832
|
-
|
|
10833
|
-
|
|
10834
|
-
|
|
10835
|
-
|
|
10836
|
-
|
|
10837
|
-
|
|
10838
|
-
|
|
10839
|
-
|
|
10840
|
-
|
|
10841
|
-
|
|
10842
|
-
|
|
10843
|
-
|
|
10844
|
-
|
|
10845
|
-
|
|
10846
|
-
|
|
10847
|
-
|
|
10848
|
-
|
|
10849
|
-
|
|
10850
|
-
|
|
10851
|
-
|
|
10852
|
-
|
|
10853
|
-
|
|
10854
|
-
}
|
|
10855
|
-
),
|
|
10856
|
-
/* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
|
|
10857
|
-
ConnectKalshiModal,
|
|
10858
|
-
{
|
|
10859
|
-
open: open && isConnectKalshiModalOpen,
|
|
10860
|
-
onOpenChange: setIsConnectKalshiModalOpen,
|
|
10861
|
-
onVerify: handleVerifyKalshi
|
|
10862
|
-
}
|
|
10863
|
-
)
|
|
10864
|
-
] });
|
|
11401
|
+
] })
|
|
11402
|
+
]
|
|
11403
|
+
}
|
|
11404
|
+
),
|
|
11405
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
11406
|
+
ManageBetdexAccountModal,
|
|
11407
|
+
{
|
|
11408
|
+
userId: user == null ? void 0 : user.id,
|
|
11409
|
+
open: open && isBetdexAccountModalOpen,
|
|
11410
|
+
onOpenChange: (isOpen) => {
|
|
11411
|
+
var _a2;
|
|
11412
|
+
return setBetdexAccountUserId(isOpen ? (_a2 = user == null ? void 0 : user.id) != null ? _a2 : null : null);
|
|
11413
|
+
}
|
|
11414
|
+
},
|
|
11415
|
+
(_j = user == null ? void 0 : user.id) != null ? _j : "signed-out"
|
|
11416
|
+
),
|
|
11417
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
11418
|
+
ConnectKalshiModal,
|
|
11419
|
+
{
|
|
11420
|
+
open: open && isConnectKalshiModalOpen,
|
|
11421
|
+
onOpenChange: setIsConnectKalshiModalOpen,
|
|
11422
|
+
onVerify: handleVerifyKalshi
|
|
11423
|
+
}
|
|
11424
|
+
)
|
|
11425
|
+
]
|
|
11426
|
+
}
|
|
11427
|
+
);
|
|
10865
11428
|
};
|
|
10866
11429
|
ProfileModal.displayName = "ProfileModal";
|
|
10867
11430
|
|
|
10868
11431
|
// src/geo-block-modal/index.tsx
|
|
10869
|
-
var
|
|
10870
|
-
var
|
|
10871
|
-
var
|
|
11432
|
+
var import_hooks53 = require("@agg-build/hooks");
|
|
11433
|
+
var import_react29 = require("react");
|
|
11434
|
+
var import_jsx_runtime155 = require("react/jsx-runtime");
|
|
10872
11435
|
var GeoBlockModal = ({
|
|
10873
11436
|
open,
|
|
10874
11437
|
onOpenChange,
|
|
10875
11438
|
onConfirm,
|
|
10876
11439
|
classNames
|
|
10877
11440
|
}) => {
|
|
10878
|
-
const labels = (0,
|
|
10879
|
-
const handleConfirm = (0,
|
|
11441
|
+
const labels = (0, import_hooks53.useLabels)();
|
|
11442
|
+
const handleConfirm = (0, import_react29.useCallback)(() => {
|
|
10880
11443
|
onConfirm == null ? void 0 : onConfirm();
|
|
10881
11444
|
onOpenChange(false);
|
|
10882
11445
|
}, [onConfirm, onOpenChange]);
|
|
10883
|
-
return /* @__PURE__ */ (0,
|
|
11446
|
+
return /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
|
|
10884
11447
|
Modal,
|
|
10885
11448
|
{
|
|
10886
11449
|
open,
|
|
10887
11450
|
onOpenChange,
|
|
10888
11451
|
"aria-label": labels.trading.geoBlockModalAriaLabel,
|
|
10889
|
-
children: /* @__PURE__ */ (0,
|
|
11452
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime155.jsxs)(
|
|
10890
11453
|
Modal.Container,
|
|
10891
11454
|
{
|
|
10892
11455
|
maxWidth: "480px",
|
|
10893
11456
|
classNames: { container: cn("!rounded-agg-2xl", classNames == null ? void 0 : classNames.container) },
|
|
10894
11457
|
children: [
|
|
10895
|
-
/* @__PURE__ */ (0,
|
|
11458
|
+
/* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
|
|
10896
11459
|
Modal.Header,
|
|
10897
11460
|
{
|
|
10898
11461
|
title: "",
|
|
@@ -10904,19 +11467,19 @@ var GeoBlockModal = ({
|
|
|
10904
11467
|
}
|
|
10905
11468
|
}
|
|
10906
11469
|
),
|
|
10907
|
-
/* @__PURE__ */ (0,
|
|
10908
|
-
/* @__PURE__ */ (0,
|
|
11470
|
+
/* @__PURE__ */ (0, import_jsx_runtime155.jsx)(Modal.Body, { classNames: { root: cn("!px-10 !pt-0 !pb-12", classNames == null ? void 0 : classNames.body) }, children: /* @__PURE__ */ (0, import_jsx_runtime155.jsxs)("div", { className: "flex flex-col items-center gap-8", children: [
|
|
11471
|
+
/* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
|
|
10909
11472
|
Icon,
|
|
10910
11473
|
{
|
|
10911
11474
|
name: "internet-security",
|
|
10912
11475
|
className: "h-[60px] w-[60px] text-agg-muted-foreground"
|
|
10913
11476
|
}
|
|
10914
11477
|
),
|
|
10915
|
-
/* @__PURE__ */ (0,
|
|
10916
|
-
/* @__PURE__ */ (0,
|
|
10917
|
-
/* @__PURE__ */ (0,
|
|
11478
|
+
/* @__PURE__ */ (0, import_jsx_runtime155.jsxs)("div", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
11479
|
+
/* @__PURE__ */ (0, import_jsx_runtime155.jsx)("h2", { className: "text-agg-2xl font-agg-bold leading-agg-8 text-agg-foreground", children: labels.trading.geoBlockModalTitle }),
|
|
11480
|
+
/* @__PURE__ */ (0, import_jsx_runtime155.jsx)("p", { className: "text-agg-base font-agg-normal leading-agg-6 text-agg-foreground", children: labels.trading.geoBlockModalDescription })
|
|
10918
11481
|
] }),
|
|
10919
|
-
/* @__PURE__ */ (0,
|
|
11482
|
+
/* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
|
|
10920
11483
|
Button,
|
|
10921
11484
|
{
|
|
10922
11485
|
variant: "secondary",
|
|
@@ -10936,27 +11499,27 @@ var GeoBlockModal = ({
|
|
|
10936
11499
|
GeoBlockModal.displayName = "GeoBlockModal";
|
|
10937
11500
|
|
|
10938
11501
|
// src/geo-block-banner/index.tsx
|
|
10939
|
-
var
|
|
10940
|
-
var
|
|
11502
|
+
var import_hooks54 = require("@agg-build/hooks");
|
|
11503
|
+
var import_jsx_runtime156 = require("react/jsx-runtime");
|
|
10941
11504
|
var GeoBlockBanner = ({
|
|
10942
11505
|
venue,
|
|
10943
11506
|
termsUrl = AGG_TERMS_OF_SERVICE_URL,
|
|
10944
11507
|
className
|
|
10945
11508
|
}) => {
|
|
10946
|
-
const labels = (0,
|
|
11509
|
+
const labels = (0, import_hooks54.useLabels)();
|
|
10947
11510
|
const message = venue ? labels.trading.geoBlockVenueMessage(venue) : labels.trading.geoBlockGenericMessage;
|
|
10948
|
-
return /* @__PURE__ */ (0,
|
|
11511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)(
|
|
10949
11512
|
"div",
|
|
10950
11513
|
{
|
|
10951
11514
|
className: cn("flex items-center gap-5 rounded-agg-lg bg-agg-secondary-hover p-3", className),
|
|
10952
11515
|
role: "status",
|
|
10953
11516
|
children: [
|
|
10954
|
-
/* @__PURE__ */ (0,
|
|
11517
|
+
/* @__PURE__ */ (0, import_jsx_runtime156.jsxs)("p", { className: "min-w-0 flex-1 text-agg-xs leading-agg-4 text-agg-foreground", children: [
|
|
10955
11518
|
message,
|
|
10956
|
-
/* @__PURE__ */ (0,
|
|
11519
|
+
/* @__PURE__ */ (0, import_jsx_runtime156.jsx)("a", { href: termsUrl, className: "underline", target: "_blank", rel: "noreferrer noopener", children: labels.trading.geoBlockTermsLink }),
|
|
10957
11520
|
labels.trading.geoBlockMessageSuffix
|
|
10958
11521
|
] }),
|
|
10959
|
-
/* @__PURE__ */ (0,
|
|
11522
|
+
/* @__PURE__ */ (0, import_jsx_runtime156.jsx)(Icon, { name: "internet-security", className: "h-6 w-6 shrink-0 text-agg-muted-foreground" })
|
|
10960
11523
|
]
|
|
10961
11524
|
}
|
|
10962
11525
|
);
|
|
@@ -10964,9 +11527,9 @@ var GeoBlockBanner = ({
|
|
|
10964
11527
|
GeoBlockBanner.displayName = "GeoBlockBanner";
|
|
10965
11528
|
|
|
10966
11529
|
// src/kyc/shared-kyc-modal.tsx
|
|
10967
|
-
var
|
|
10968
|
-
var
|
|
10969
|
-
var
|
|
11530
|
+
var import_hooks55 = require("@agg-build/hooks");
|
|
11531
|
+
var Dialog7 = __toESM(require("@radix-ui/react-dialog"));
|
|
11532
|
+
var import_jsx_runtime157 = require("react/jsx-runtime");
|
|
10970
11533
|
var SharedKycModal = ({
|
|
10971
11534
|
open,
|
|
10972
11535
|
state = "initial",
|
|
@@ -10974,46 +11537,46 @@ var SharedKycModal = ({
|
|
|
10974
11537
|
onOpenChange,
|
|
10975
11538
|
onStartVerification
|
|
10976
11539
|
}) => {
|
|
10977
|
-
const labels = (0,
|
|
11540
|
+
const labels = (0, import_hooks55.useLabels)();
|
|
10978
11541
|
const modalLabels = labels.trading.sharedKyc.modal;
|
|
10979
11542
|
const isInitiating = state === "initiating";
|
|
10980
11543
|
const handleOpenChange = (nextOpen) => {
|
|
10981
11544
|
if (isInitiating && !nextOpen) return;
|
|
10982
11545
|
onOpenChange(nextOpen);
|
|
10983
11546
|
};
|
|
10984
|
-
return /* @__PURE__ */ (0,
|
|
11547
|
+
return /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime157.jsxs)(
|
|
10985
11548
|
Modal.Container,
|
|
10986
11549
|
{
|
|
10987
11550
|
maxWidth: "420px",
|
|
10988
11551
|
"aria-label": modalLabels.ariaLabel,
|
|
10989
11552
|
classNames: { container: "!rounded-agg-2xl" },
|
|
10990
11553
|
children: [
|
|
10991
|
-
/* @__PURE__ */ (0,
|
|
10992
|
-
|
|
11554
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsx)("div", { className: "flex h-14 shrink-0 items-center justify-end px-5", children: /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
|
|
11555
|
+
Dialog7.Close,
|
|
10993
11556
|
{
|
|
10994
11557
|
"aria-label": labels.common.close,
|
|
10995
11558
|
disabled: isInitiating,
|
|
10996
11559
|
className: "flex size-11 cursor-pointer items-center justify-center rounded-agg-full text-agg-foreground hover:bg-agg-secondary-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary disabled:cursor-not-allowed disabled:opacity-50",
|
|
10997
|
-
children: /* @__PURE__ */ (0,
|
|
11560
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(Icon, { name: "close", size: "small", "aria-hidden": "true" })
|
|
10998
11561
|
}
|
|
10999
11562
|
) }),
|
|
11000
|
-
/* @__PURE__ */ (0,
|
|
11563
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsx)(Modal.Body, { classNames: { root: "!px-8 !pb-9 !pt-0" }, children: state === "success" ? /* @__PURE__ */ (0, import_jsx_runtime157.jsxs)(
|
|
11001
11564
|
"div",
|
|
11002
11565
|
{
|
|
11003
11566
|
className: "flex flex-col items-center gap-6 text-center",
|
|
11004
11567
|
role: "status",
|
|
11005
11568
|
"aria-live": "polite",
|
|
11006
11569
|
children: [
|
|
11007
|
-
/* @__PURE__ */ (0,
|
|
11008
|
-
/* @__PURE__ */ (0,
|
|
11009
|
-
/* @__PURE__ */ (0,
|
|
11010
|
-
/* @__PURE__ */ (0,
|
|
11570
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsx)("div", { className: "flex size-12 items-center justify-center rounded-agg-full border border-agg-success bg-agg-success/10 text-agg-success", children: /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(Icon, { name: "success-check", className: "size-5", "aria-hidden": "true" }) }),
|
|
11571
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsxs)("div", { className: "flex flex-col items-center gap-2", children: [
|
|
11572
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsx)(Dialog7.Title, { children: /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(Typography, { as: "span", variant: "body-large-strong", children: modalLabels.successTitle }) }),
|
|
11573
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsx)(Dialog7.Description, { children: /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(Typography, { as: "span", variant: "label", className: "text-pretty text-agg-foreground", children: modalLabels.successDescription }) })
|
|
11011
11574
|
] }),
|
|
11012
|
-
/* @__PURE__ */ (0,
|
|
11575
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsx)(Button, { variant: "secondary", size: "large", onClick: () => handleOpenChange(false), children: modalLabels.done })
|
|
11013
11576
|
]
|
|
11014
11577
|
}
|
|
11015
|
-
) : /* @__PURE__ */ (0,
|
|
11016
|
-
/* @__PURE__ */ (0,
|
|
11578
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime157.jsxs)("div", { className: "flex flex-col items-center gap-6 text-center", children: [
|
|
11579
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
|
|
11017
11580
|
Icon,
|
|
11018
11581
|
{
|
|
11019
11582
|
name: "user-trust",
|
|
@@ -11021,11 +11584,11 @@ var SharedKycModal = ({
|
|
|
11021
11584
|
"aria-hidden": "true"
|
|
11022
11585
|
}
|
|
11023
11586
|
),
|
|
11024
|
-
/* @__PURE__ */ (0,
|
|
11025
|
-
/* @__PURE__ */ (0,
|
|
11026
|
-
/* @__PURE__ */ (0,
|
|
11587
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsxs)("div", { className: "flex flex-col items-center gap-2", children: [
|
|
11588
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsx)(Dialog7.Title, { children: /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(Typography, { as: "span", variant: "body-large-strong", children: state === "pending" ? modalLabels.pendingTitle : modalLabels.title }) }),
|
|
11589
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsx)(Dialog7.Description, { children: /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(Typography, { as: "span", variant: "label", className: "text-pretty text-agg-foreground", children: state === "pending" ? modalLabels.pendingDescription : modalLabels.freeDescription }) })
|
|
11027
11590
|
] }),
|
|
11028
|
-
state === "error" || state === "pending" && errorMessage ? /* @__PURE__ */ (0,
|
|
11591
|
+
state === "error" || state === "pending" && errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
|
|
11029
11592
|
InlineAlert,
|
|
11030
11593
|
{
|
|
11031
11594
|
tone: "error",
|
|
@@ -11033,8 +11596,8 @@ var SharedKycModal = ({
|
|
|
11033
11596
|
message: errorMessage || modalLabels.error
|
|
11034
11597
|
}
|
|
11035
11598
|
) : null,
|
|
11036
|
-
/* @__PURE__ */ (0,
|
|
11037
|
-
/* @__PURE__ */ (0,
|
|
11599
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsxs)("div", { className: "flex flex-col items-center gap-4", children: [
|
|
11600
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
|
|
11038
11601
|
Button,
|
|
11039
11602
|
{
|
|
11040
11603
|
variant: "primary",
|
|
@@ -11046,7 +11609,7 @@ var SharedKycModal = ({
|
|
|
11046
11609
|
children: state === "pending" ? modalLabels.checkStatus : modalLabels.startVerification
|
|
11047
11610
|
}
|
|
11048
11611
|
),
|
|
11049
|
-
/* @__PURE__ */ (0,
|
|
11612
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
|
|
11050
11613
|
Button,
|
|
11051
11614
|
{
|
|
11052
11615
|
variant: "tertiary",
|