@agg-build/ui 4.26.1 → 4.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/event-trading-state.utils-B3my25Re.mjs +789 -0
- package/dist/event-trading-state.utils-s4DEc4iA.js +921 -0
- package/dist/events.js +23 -17658
- package/dist/events.mjs +3 -50
- package/dist/index.js +811 -47152
- package/dist/index.mjs +584 -1204
- package/dist/list-D8v2SmY1.js +6989 -0
- package/dist/list-DD7roCVl.mjs +6838 -0
- package/dist/manage-betdex-account-modal-21ZVLsz0.js +2390 -0
- package/dist/manage-betdex-account-modal-D2vKHird.mjs +2294 -0
- package/dist/modals-BReGwJzz.mjs +2993 -0
- package/dist/modals-CSexQO1C.js +3077 -0
- package/dist/modals.js +24 -11810
- package/dist/modals.mjs +3 -49
- package/dist/pages-CMlCYngA.mjs +7846 -0
- package/dist/pages-xvAzj6c2.js +7955 -0
- package/dist/pages.js +25 -42391
- package/dist/pages.mjs +3 -57
- package/dist/primitives-CqxNeV7H.js +9930 -0
- package/dist/primitives-Dz5aF8ma.mjs +8928 -0
- package/dist/primitives.js +102 -11079
- package/dist/primitives.mjs +1 -204
- package/dist/trading-CDkNdjGx.mjs +7086 -0
- package/dist/trading-CXsZFd3l.js +7217 -0
- package/dist/trading.js +39 -18215
- package/dist/trading.mjs +3 -68
- package/dist/types/agg-provider.d.mts +1 -1
- package/dist/types/agg-provider.d.ts +1 -1
- package/dist/types/auth/connect-button-view/index.d.mts +4 -5
- package/dist/types/auth/connect-button-view/index.d.ts +4 -5
- package/dist/types/deposit/components/DepositQRCode.d.mts +2 -2
- package/dist/types/deposit/components/DepositQRCode.d.ts +2 -2
- package/dist/types/deposit/index.d.mts +4 -4
- package/dist/types/deposit/index.d.ts +4 -4
- package/dist/types/deposit/steps/card-deposit.d.mts +1 -1
- package/dist/types/deposit/steps/card-deposit.d.ts +1 -1
- package/dist/types/deposit/steps/card-payment-pending.d.mts +1 -1
- package/dist/types/deposit/steps/card-payment-pending.d.ts +1 -1
- package/dist/types/deposit/steps/card-provider.d.mts +1 -1
- package/dist/types/deposit/steps/card-provider.d.ts +1 -1
- package/dist/types/deposit/steps/card-purchase-success.d.mts +1 -1
- package/dist/types/deposit/steps/card-purchase-success.d.ts +1 -1
- package/dist/types/deposit/steps/card-widget.d.mts +1 -1
- package/dist/types/deposit/steps/card-widget.d.ts +1 -1
- package/dist/types/deposit/steps/crypto-transfer.d.mts +1 -1
- package/dist/types/deposit/steps/crypto-transfer.d.ts +1 -1
- package/dist/types/deposit/steps/deposit-method.d.mts +2 -1
- package/dist/types/deposit/steps/deposit-method.d.ts +2 -1
- package/dist/types/deposit/steps/venue-selection.d.mts +1 -1
- package/dist/types/deposit/steps/venue-selection.d.ts +1 -1
- package/dist/types/deposit/steps/wallet-form.d.mts +1 -1
- package/dist/types/deposit/steps/wallet-form.d.ts +1 -1
- package/dist/types/deposit/steps/wallet-processing.d.mts +1 -1
- package/dist/types/deposit/steps/wallet-processing.d.ts +1 -1
- package/dist/types/deposit/steps/wallet-success.d.mts +1 -1
- package/dist/types/deposit/steps/wallet-success.d.ts +1 -1
- package/dist/types/events/item/event-list-item.utils.d.mts +1 -1
- package/dist/types/events/item/event-list-item.utils.d.ts +1 -1
- package/dist/types/events/item/index.d.mts +8 -8
- package/dist/types/events/item/index.d.ts +8 -8
- package/dist/types/events/item-details/event-list-item-details-market-selector.d.mts +1 -1
- package/dist/types/events/item-details/event-list-item-details-market-selector.d.ts +1 -1
- package/dist/types/events/item-details/event-markets-chart.d.mts +1 -1
- package/dist/types/events/item-details/event-markets-chart.d.ts +1 -1
- package/dist/types/events/item-details/event-markets-chart.utils.d.mts +1 -1
- package/dist/types/events/item-details/event-markets-chart.utils.d.ts +1 -1
- package/dist/types/events/item-details/index.d.mts +4 -4
- package/dist/types/events/item-details/index.d.ts +4 -4
- package/dist/types/events/item-details/settlement-summary.d.mts +4 -4
- package/dist/types/events/item-details/settlement-summary.d.ts +4 -4
- package/dist/types/events/list/category-sidebar.d.mts +4 -4
- package/dist/types/events/list/category-sidebar.d.ts +4 -4
- package/dist/types/events/list/event-list-tabs.d.mts +4 -8
- package/dist/types/events/list/event-list-tabs.d.ts +4 -8
- package/dist/types/events/list/event-list-venue-strip.d.mts +4 -11
- package/dist/types/events/list/event-list-venue-strip.d.ts +4 -11
- package/dist/types/events/list/index.d.mts +4 -4
- package/dist/types/events/list/index.d.ts +4 -4
- package/dist/types/events/market-details/index.d.mts +8 -8
- package/dist/types/events/market-details/index.d.ts +8 -8
- package/dist/types/events/market-details/market-details-graph-panel.d.mts +4 -14
- package/dist/types/events/market-details/market-details-graph-panel.d.ts +4 -14
- package/dist/types/events/market-details/market-details-outcome-button.d.mts +4 -4
- package/dist/types/events/market-details/market-details-outcome-button.d.ts +4 -4
- package/dist/types/events/market-details/orderbook-aggregation.d.mts +3 -1
- package/dist/types/events/market-details/orderbook-aggregation.d.ts +3 -1
- package/dist/types/events/market-details/use-visible-market-streams.d.mts +1 -1
- package/dist/types/events/market-details/use-visible-market-streams.d.ts +1 -1
- package/dist/types/events/orderbook/index.d.mts +4 -4
- package/dist/types/events/orderbook/index.d.ts +4 -4
- package/dist/types/events/orderbook/orderbook-with-states.d.mts +4 -4
- package/dist/types/events/orderbook/orderbook-with-states.d.ts +4 -4
- package/dist/types/events/shared/chart-source-caption.d.mts +1 -1
- package/dist/types/events/shared/chart-source-caption.d.ts +1 -1
- package/dist/types/events/shared/sports-live-score.d.mts +4 -4
- package/dist/types/events/shared/sports-live-score.d.ts +4 -4
- package/dist/types/events/shared/use-chart-orderbook.d.mts +3 -3
- package/dist/types/events/shared/use-chart-orderbook.d.ts +3 -3
- package/dist/types/geo-block-banner/index.d.mts +4 -4
- package/dist/types/geo-block-banner/index.d.ts +4 -4
- package/dist/types/geo-block-modal/index.d.mts +4 -4
- package/dist/types/geo-block-modal/index.d.ts +4 -4
- package/dist/types/kyc/shared-kyc-modal.d.mts +4 -4
- package/dist/types/kyc/shared-kyc-modal.d.ts +4 -4
- package/dist/types/notifications/agg-notification-events-provider.d.mts +1 -1
- package/dist/types/notifications/agg-notification-events-provider.d.ts +1 -1
- package/dist/types/notifications/agg-toast-provider.d.mts +1 -1
- package/dist/types/notifications/agg-toast-provider.d.ts +1 -1
- package/dist/types/onboarding/index.d.mts +4 -4
- package/dist/types/onboarding/index.d.ts +4 -4
- package/dist/types/onboarding/steps/connect-accounts.d.mts +4 -4
- package/dist/types/onboarding/steps/connect-accounts.d.ts +4 -4
- package/dist/types/onboarding/steps/connect-kalshi-modal.d.mts +4 -4
- package/dist/types/onboarding/steps/connect-kalshi-modal.d.ts +4 -4
- package/dist/types/onboarding/steps/connect-novig-modal.d.mts +1 -1
- package/dist/types/onboarding/steps/connect-novig-modal.d.ts +1 -1
- package/dist/types/onboarding/steps/connect-onchain-modal.d.mts +4 -4
- package/dist/types/onboarding/steps/connect-onchain-modal.d.ts +4 -4
- package/dist/types/onboarding/steps/connect-prophetx-modal.d.mts +1 -1
- package/dist/types/onboarding/steps/connect-prophetx-modal.d.ts +1 -1
- package/dist/types/onboarding/steps/how-it-works.d.mts +4 -4
- package/dist/types/onboarding/steps/how-it-works.d.ts +4 -4
- package/dist/types/onboarding/steps/profile-setup.d.mts +4 -4
- package/dist/types/onboarding/steps/profile-setup.d.ts +4 -4
- package/dist/types/pages/event-market/event-market.shared.d.mts +4 -4
- package/dist/types/pages/event-market/event-market.shared.d.ts +4 -4
- package/dist/types/pages/event-market/event-market.types.d.mts +2 -0
- package/dist/types/pages/event-market/event-market.types.d.ts +2 -0
- package/dist/types/pages/event-market/event-open-orders.d.mts +8 -27
- package/dist/types/pages/event-market/event-open-orders.d.ts +8 -27
- package/dist/types/pages/event-market/index.d.mts +6 -6
- package/dist/types/pages/event-market/index.d.ts +6 -6
- package/dist/types/pages/event-market/sports-event-market-page.d.mts +6 -6
- package/dist/types/pages/event-market/sports-event-market-page.d.ts +6 -6
- package/dist/types/pages/event-market/sports-line-rail.d.mts +2 -1
- package/dist/types/pages/event-market/sports-line-rail.d.ts +2 -1
- package/dist/types/pages/event-market/sports-market-card.d.mts +4 -4
- package/dist/types/pages/event-market/sports-market-card.d.ts +4 -4
- package/dist/types/pages/event-market/sports-markets.d.mts +4 -4
- package/dist/types/pages/event-market/sports-markets.d.ts +4 -4
- package/dist/types/pages/home/index.d.mts +6 -6
- package/dist/types/pages/home/index.d.ts +6 -6
- package/dist/types/pages/leaderboard/components/leaderboard-header-row.d.mts +1 -1
- package/dist/types/pages/leaderboard/components/leaderboard-header-row.d.ts +1 -1
- package/dist/types/pages/leaderboard/components/leaderboard-row.d.mts +1 -1
- package/dist/types/pages/leaderboard/components/leaderboard-row.d.ts +1 -1
- package/dist/types/pages/leaderboard/components/leaderboard-skeleton.d.mts +1 -1
- package/dist/types/pages/leaderboard/components/leaderboard-skeleton.d.ts +1 -1
- package/dist/types/pages/leaderboard/components/segmented-control.d.mts +1 -1
- package/dist/types/pages/leaderboard/components/segmented-control.d.ts +1 -1
- package/dist/types/pages/leaderboard/index.d.mts +1 -1
- package/dist/types/pages/leaderboard/index.d.ts +1 -1
- package/dist/types/pages/user-profile/components/activity-row.d.mts +4 -4
- package/dist/types/pages/user-profile/components/activity-row.d.ts +4 -4
- package/dist/types/pages/user-profile/components/available-balance-card.d.mts +4 -4
- package/dist/types/pages/user-profile/components/available-balance-card.d.ts +4 -4
- package/dist/types/pages/user-profile/components/balance-display.d.mts +4 -4
- package/dist/types/pages/user-profile/components/balance-display.d.ts +4 -4
- package/dist/types/pages/user-profile/components/balances-card.d.mts +4 -4
- package/dist/types/pages/user-profile/components/balances-card.d.ts +4 -4
- package/dist/types/pages/user-profile/components/betdex-account-activity.d.mts +1 -1
- package/dist/types/pages/user-profile/components/betdex-account-activity.d.ts +1 -1
- package/dist/types/pages/user-profile/components/betdex-account-card.d.mts +1 -1
- package/dist/types/pages/user-profile/components/betdex-account-card.d.ts +1 -1
- package/dist/types/pages/user-profile/components/betdex-account-transfers.d.mts +1 -1
- package/dist/types/pages/user-profile/components/betdex-account-transfers.d.ts +1 -1
- package/dist/types/pages/user-profile/components/betdex-wallet-deposit.d.mts +1 -1
- package/dist/types/pages/user-profile/components/betdex-wallet-deposit.d.ts +1 -1
- package/dist/types/pages/user-profile/components/claim-activity-breakdown-modal.d.mts +1 -1
- package/dist/types/pages/user-profile/components/claim-activity-breakdown-modal.d.ts +1 -1
- package/dist/types/pages/user-profile/components/empty-state.d.mts +4 -4
- package/dist/types/pages/user-profile/components/empty-state.d.ts +4 -4
- package/dist/types/pages/user-profile/components/manage-balances-modal.d.mts +4 -4
- package/dist/types/pages/user-profile/components/manage-balances-modal.d.ts +4 -4
- package/dist/types/pages/user-profile/components/open-order-row.d.mts +4 -4
- package/dist/types/pages/user-profile/components/open-order-row.d.ts +4 -4
- package/dist/types/pages/user-profile/components/position-row.d.mts +4 -4
- package/dist/types/pages/user-profile/components/position-row.d.ts +4 -4
- package/dist/types/pages/user-profile/components/positions-activity.d.mts +4 -4
- package/dist/types/pages/user-profile/components/positions-activity.d.ts +4 -4
- package/dist/types/pages/user-profile/components/positions-value-card.d.mts +4 -4
- package/dist/types/pages/user-profile/components/positions-value-card.d.ts +4 -4
- package/dist/types/pages/user-profile/components/user-info-card.d.mts +4 -4
- package/dist/types/pages/user-profile/components/user-info-card.d.ts +4 -4
- package/dist/types/pages/user-profile/index.d.mts +6 -6
- package/dist/types/pages/user-profile/index.d.ts +6 -6
- package/dist/types/paper-trading/paper-onboarding-modal.d.mts +4 -14
- package/dist/types/paper-trading/paper-onboarding-modal.d.ts +4 -14
- package/dist/types/paper-trading/paper-trading-badge.d.mts +4 -16
- package/dist/types/paper-trading/paper-trading-badge.d.ts +4 -16
- package/dist/types/paper-trading/paper-trading-onboarding.d.mts +4 -12
- package/dist/types/paper-trading/paper-trading-onboarding.d.ts +4 -12
- package/dist/types/primitives/agg-logo/agg-logo.utils.d.mts +1 -1
- package/dist/types/primitives/agg-logo/agg-logo.utils.d.ts +1 -1
- package/dist/types/primitives/agg-logo/index.d.mts +4 -5
- package/dist/types/primitives/agg-logo/index.d.ts +4 -5
- package/dist/types/primitives/autocomplete-select/index.d.mts +4 -5
- package/dist/types/primitives/autocomplete-select/index.d.ts +4 -5
- package/dist/types/primitives/badge/index.d.mts +1 -1
- package/dist/types/primitives/badge/index.d.ts +1 -1
- package/dist/types/primitives/button/button.types.d.mts +2 -2
- package/dist/types/primitives/button/button.types.d.ts +2 -2
- package/dist/types/primitives/button/index.d.mts +4 -5
- package/dist/types/primitives/button/index.d.ts +4 -5
- package/dist/types/primitives/calendar/index.d.mts +4 -4
- package/dist/types/primitives/calendar/index.d.ts +4 -4
- package/dist/types/primitives/card/index.d.mts +4 -5
- package/dist/types/primitives/card/index.d.ts +4 -5
- package/dist/types/primitives/chart/chart-type-switch.d.mts +4 -5
- package/dist/types/primitives/chart/chart-type-switch.d.ts +4 -5
- package/dist/types/primitives/chart/index.d.mts +4 -5
- package/dist/types/primitives/chart/index.d.ts +4 -5
- package/dist/types/primitives/chart/probability-chart.d.mts +2 -2
- package/dist/types/primitives/chart/probability-chart.d.ts +2 -2
- package/dist/types/primitives/chart/probability-live-tail.d.mts +1 -1
- package/dist/types/primitives/chart/probability-live-tail.d.ts +1 -1
- package/dist/types/primitives/conditional-wrapper.d.mts +6 -7
- package/dist/types/primitives/conditional-wrapper.d.ts +6 -7
- package/dist/types/primitives/copy-button/index.d.mts +4 -5
- package/dist/types/primitives/copy-button/index.d.ts +4 -5
- package/dist/types/primitives/currency-input/index.d.mts +4 -5
- package/dist/types/primitives/currency-input/index.d.ts +4 -5
- package/dist/types/primitives/footer/agg-build-logo.d.mts +12 -15
- package/dist/types/primitives/footer/agg-build-logo.d.ts +12 -15
- package/dist/types/primitives/footer/index.d.mts +4 -6
- package/dist/types/primitives/footer/index.d.ts +4 -6
- package/dist/types/primitives/header/index.d.mts +4 -6
- package/dist/types/primitives/header/index.d.ts +4 -6
- package/dist/types/primitives/icon/index.d.mts +4 -5
- package/dist/types/primitives/icon/index.d.ts +4 -5
- package/dist/types/primitives/icon/registry.d.mts +180 -351
- package/dist/types/primitives/icon/registry.d.ts +180 -351
- package/dist/types/primitives/icon/svg/activity-chart.d.mts +4 -4
- package/dist/types/primitives/icon/svg/activity-chart.d.ts +4 -4
- package/dist/types/primitives/icon/svg/activity.d.mts +4 -4
- package/dist/types/primitives/icon/svg/activity.d.ts +4 -4
- package/dist/types/primitives/icon/svg/apple.d.mts +4 -4
- package/dist/types/primitives/icon/svg/apple.d.ts +4 -4
- package/dist/types/primitives/icon/svg/apps.d.mts +4 -4
- package/dist/types/primitives/icon/svg/apps.d.ts +4 -4
- package/dist/types/primitives/icon/svg/arbitrum.d.mts +4 -4
- package/dist/types/primitives/icon/svg/arbitrum.d.ts +4 -4
- package/dist/types/primitives/icon/svg/arrow-right.d.mts +4 -4
- package/dist/types/primitives/icon/svg/arrow-right.d.ts +4 -4
- package/dist/types/primitives/icon/svg/arrow-trend-up.d.mts +4 -4
- package/dist/types/primitives/icon/svg/arrow-trend-up.d.ts +4 -4
- package/dist/types/primitives/icon/svg/arrows-to-dot.d.mts +4 -4
- package/dist/types/primitives/icon/svg/arrows-to-dot.d.ts +4 -4
- package/dist/types/primitives/icon/svg/badge-check-thin.d.mts +4 -4
- package/dist/types/primitives/icon/svg/badge-check-thin.d.ts +4 -4
- package/dist/types/primitives/icon/svg/bank.d.mts +4 -4
- package/dist/types/primitives/icon/svg/bank.d.ts +4 -4
- package/dist/types/primitives/icon/svg/base.d.mts +4 -4
- package/dist/types/primitives/icon/svg/base.d.ts +4 -4
- package/dist/types/primitives/icon/svg/best-prices.d.mts +4 -4
- package/dist/types/primitives/icon/svg/best-prices.d.ts +4 -4
- package/dist/types/primitives/icon/svg/bnb.d.mts +4 -4
- package/dist/types/primitives/icon/svg/bnb.d.ts +4 -4
- package/dist/types/primitives/icon/svg/bolt.d.mts +4 -4
- package/dist/types/primitives/icon/svg/bolt.d.ts +4 -4
- package/dist/types/primitives/icon/svg/calendar.d.mts +1 -1
- package/dist/types/primitives/icon/svg/calendar.d.ts +1 -1
- package/dist/types/primitives/icon/svg/chart-candlestick.d.mts +4 -4
- package/dist/types/primitives/icon/svg/chart-candlestick.d.ts +4 -4
- package/dist/types/primitives/icon/svg/chart-line.d.mts +4 -4
- package/dist/types/primitives/icon/svg/chart-line.d.ts +4 -4
- package/dist/types/primitives/icon/svg/check-badge.d.mts +4 -4
- package/dist/types/primitives/icon/svg/check-badge.d.ts +4 -4
- package/dist/types/primitives/icon/svg/check-circle.d.mts +4 -4
- package/dist/types/primitives/icon/svg/check-circle.d.ts +4 -4
- package/dist/types/primitives/icon/svg/chevron-down-thin.d.mts +4 -5
- package/dist/types/primitives/icon/svg/chevron-down-thin.d.ts +4 -5
- package/dist/types/primitives/icon/svg/chevron-down.d.mts +4 -4
- package/dist/types/primitives/icon/svg/chevron-down.d.ts +4 -4
- package/dist/types/primitives/icon/svg/chevron-left.d.mts +4 -4
- package/dist/types/primitives/icon/svg/chevron-left.d.ts +4 -4
- package/dist/types/primitives/icon/svg/chevron-right.d.mts +4 -4
- package/dist/types/primitives/icon/svg/chevron-right.d.ts +4 -4
- package/dist/types/primitives/icon/svg/chevron-up.d.mts +4 -4
- package/dist/types/primitives/icon/svg/chevron-up.d.ts +4 -4
- package/dist/types/primitives/icon/svg/circle-overlap.d.mts +4 -4
- package/dist/types/primitives/icon/svg/circle-overlap.d.ts +4 -4
- package/dist/types/primitives/icon/svg/circle-xmark.d.mts +4 -4
- package/dist/types/primitives/icon/svg/circle-xmark.d.ts +4 -4
- package/dist/types/primitives/icon/svg/close.d.mts +4 -4
- package/dist/types/primitives/icon/svg/close.d.ts +4 -4
- package/dist/types/primitives/icon/svg/copy.d.mts +4 -4
- package/dist/types/primitives/icon/svg/copy.d.ts +4 -4
- package/dist/types/primitives/icon/svg/create-account.d.mts +4 -4
- package/dist/types/primitives/icon/svg/create-account.d.ts +4 -4
- package/dist/types/primitives/icon/svg/credit-card.d.mts +4 -4
- package/dist/types/primitives/icon/svg/credit-card.d.ts +4 -4
- package/dist/types/primitives/icon/svg/cross-circle.d.mts +4 -4
- package/dist/types/primitives/icon/svg/cross-circle.d.ts +4 -4
- package/dist/types/primitives/icon/svg/disconnect.d.mts +4 -4
- package/dist/types/primitives/icon/svg/disconnect.d.ts +4 -4
- package/dist/types/primitives/icon/svg/discord.d.mts +4 -4
- package/dist/types/primitives/icon/svg/discord.d.ts +4 -4
- package/dist/types/primitives/icon/svg/document.d.mts +4 -4
- package/dist/types/primitives/icon/svg/document.d.ts +4 -4
- package/dist/types/primitives/icon/svg/dots-horizontal.d.mts +4 -4
- package/dist/types/primitives/icon/svg/dots-horizontal.d.ts +4 -4
- package/dist/types/primitives/icon/svg/download.d.mts +4 -4
- package/dist/types/primitives/icon/svg/download.d.ts +4 -4
- package/dist/types/primitives/icon/svg/email.d.mts +4 -4
- package/dist/types/primitives/icon/svg/email.d.ts +4 -4
- package/dist/types/primitives/icon/svg/error-filled.d.mts +4 -4
- package/dist/types/primitives/icon/svg/error-filled.d.ts +4 -4
- package/dist/types/primitives/icon/svg/ethereum.d.mts +4 -4
- package/dist/types/primitives/icon/svg/ethereum.d.ts +4 -4
- package/dist/types/primitives/icon/svg/external-link.d.mts +4 -4
- package/dist/types/primitives/icon/svg/external-link.d.ts +4 -4
- package/dist/types/primitives/icon/svg/gift-bonus.d.mts +4 -4
- package/dist/types/primitives/icon/svg/gift-bonus.d.ts +4 -4
- package/dist/types/primitives/icon/svg/google.d.mts +4 -4
- package/dist/types/primitives/icon/svg/google.d.ts +4 -4
- package/dist/types/primitives/icon/svg/hourglass-start.d.mts +4 -4
- package/dist/types/primitives/icon/svg/hourglass-start.d.ts +4 -4
- package/dist/types/primitives/icon/svg/image.d.mts +4 -4
- package/dist/types/primitives/icon/svg/image.d.ts +4 -4
- package/dist/types/primitives/icon/svg/info.d.mts +4 -4
- package/dist/types/primitives/icon/svg/info.d.ts +4 -4
- package/dist/types/primitives/icon/svg/internet-security.d.mts +4 -4
- package/dist/types/primitives/icon/svg/internet-security.d.ts +4 -4
- package/dist/types/primitives/icon/svg/link-accounts.d.mts +4 -4
- package/dist/types/primitives/icon/svg/link-accounts.d.ts +4 -4
- package/dist/types/primitives/icon/svg/lock.d.mts +4 -4
- package/dist/types/primitives/icon/svg/lock.d.ts +4 -4
- package/dist/types/primitives/icon/svg/minus.d.mts +1 -1
- package/dist/types/primitives/icon/svg/minus.d.ts +1 -1
- package/dist/types/primitives/icon/svg/paper-buying-power.d.mts +4 -10
- package/dist/types/primitives/icon/svg/paper-buying-power.d.ts +4 -10
- package/dist/types/primitives/icon/svg/paper-earnings.d.mts +4 -10
- package/dist/types/primitives/icon/svg/paper-earnings.d.ts +4 -10
- package/dist/types/primitives/icon/svg/paper-mode.d.mts +4 -4
- package/dist/types/primitives/icon/svg/paper-mode.d.ts +4 -4
- package/dist/types/primitives/icon/svg/paper-onboarding-funds.d.mts +4 -11
- package/dist/types/primitives/icon/svg/paper-onboarding-funds.d.ts +4 -11
- package/dist/types/primitives/icon/svg/paper-onboarding-markets.d.mts +4 -11
- package/dist/types/primitives/icon/svg/paper-onboarding-markets.d.ts +4 -11
- package/dist/types/primitives/icon/svg/paper-onboarding-performance.d.mts +4 -11
- package/dist/types/primitives/icon/svg/paper-onboarding-performance.d.ts +4 -11
- package/dist/types/primitives/icon/svg/paper-plane.d.mts +4 -4
- package/dist/types/primitives/icon/svg/paper-plane.d.ts +4 -4
- package/dist/types/primitives/icon/svg/pencil.d.mts +4 -4
- package/dist/types/primitives/icon/svg/pencil.d.ts +4 -4
- package/dist/types/primitives/icon/svg/play-square.d.mts +4 -4
- package/dist/types/primitives/icon/svg/play-square.d.ts +4 -4
- package/dist/types/primitives/icon/svg/plus.d.mts +1 -1
- package/dist/types/primitives/icon/svg/plus.d.ts +1 -1
- package/dist/types/primitives/icon/svg/polygon.d.mts +4 -4
- package/dist/types/primitives/icon/svg/polygon.d.ts +4 -4
- package/dist/types/primitives/icon/svg/profile-about-tab.d.mts +4 -5
- package/dist/types/primitives/icon/svg/profile-about-tab.d.ts +4 -5
- package/dist/types/primitives/icon/svg/profile-accounts-wallets-tab.d.mts +4 -5
- package/dist/types/primitives/icon/svg/profile-accounts-wallets-tab.d.ts +4 -5
- package/dist/types/primitives/icon/svg/profile.d.mts +4 -4
- package/dist/types/primitives/icon/svg/profile.d.ts +4 -4
- package/dist/types/primitives/icon/svg/quotes-warning.d.mts +4 -5
- package/dist/types/primitives/icon/svg/quotes-warning.d.ts +4 -5
- package/dist/types/primitives/icon/svg/recenter.d.mts +4 -4
- package/dist/types/primitives/icon/svg/recenter.d.ts +4 -4
- package/dist/types/primitives/icon/svg/revenue-alt.d.mts +4 -4
- package/dist/types/primitives/icon/svg/revenue-alt.d.ts +4 -4
- package/dist/types/primitives/icon/svg/search.d.mts +4 -4
- package/dist/types/primitives/icon/svg/search.d.ts +4 -4
- package/dist/types/primitives/icon/svg/shield-trust.d.mts +4 -4
- package/dist/types/primitives/icon/svg/shield-trust.d.ts +4 -4
- package/dist/types/primitives/icon/svg/solana.d.mts +4 -4
- package/dist/types/primitives/icon/svg/solana.d.ts +4 -4
- package/dist/types/primitives/icon/svg/sort-end-date.d.mts +4 -4
- package/dist/types/primitives/icon/svg/sort-end-date.d.ts +4 -4
- package/dist/types/primitives/icon/svg/sort-top-arbitrage.d.mts +4 -4
- package/dist/types/primitives/icon/svg/sort-top-arbitrage.d.ts +4 -4
- package/dist/types/primitives/icon/svg/sort-volume-24hr.d.mts +4 -4
- package/dist/types/primitives/icon/svg/sort-volume-24hr.d.ts +4 -4
- package/dist/types/primitives/icon/svg/sort-volume.d.mts +4 -4
- package/dist/types/primitives/icon/svg/sort-volume.d.ts +4 -4
- package/dist/types/primitives/icon/svg/sparkles-filled.d.mts +4 -4
- package/dist/types/primitives/icon/svg/sparkles-filled.d.ts +4 -4
- package/dist/types/primitives/icon/svg/spinner.d.mts +4 -4
- package/dist/types/primitives/icon/svg/spinner.d.ts +4 -4
- package/dist/types/primitives/icon/svg/stay-in-control.d.mts +4 -4
- package/dist/types/primitives/icon/svg/stay-in-control.d.ts +4 -4
- package/dist/types/primitives/icon/svg/success-check.d.mts +4 -4
- package/dist/types/primitives/icon/svg/success-check.d.ts +4 -4
- package/dist/types/primitives/icon/svg/telegram.d.mts +4 -4
- package/dist/types/primitives/icon/svg/telegram.d.ts +4 -4
- package/dist/types/primitives/icon/svg/triangle-down.d.mts +4 -4
- package/dist/types/primitives/icon/svg/triangle-down.d.ts +4 -4
- package/dist/types/primitives/icon/svg/triangle-up-filled.d.mts +4 -4
- package/dist/types/primitives/icon/svg/triangle-up-filled.d.ts +4 -4
- package/dist/types/primitives/icon/svg/triangle-up.d.mts +4 -4
- package/dist/types/primitives/icon/svg/triangle-up.d.ts +4 -4
- package/dist/types/primitives/icon/svg/twitter.d.mts +4 -4
- package/dist/types/primitives/icon/svg/twitter.d.ts +4 -4
- package/dist/types/primitives/icon/svg/upload.d.mts +4 -4
- package/dist/types/primitives/icon/svg/upload.d.ts +4 -4
- package/dist/types/primitives/icon/svg/usdc.d.mts +4 -4
- package/dist/types/primitives/icon/svg/usdc.d.ts +4 -4
- package/dist/types/primitives/icon/svg/user-trust.d.mts +4 -4
- package/dist/types/primitives/icon/svg/user-trust.d.ts +4 -4
- package/dist/types/primitives/icon/svg/wallet-avatar.d.mts +1 -1
- package/dist/types/primitives/icon/svg/wallet-avatar.d.ts +1 -1
- package/dist/types/primitives/icon/svg/wallet-filled.d.mts +4 -4
- package/dist/types/primitives/icon/svg/wallet-filled.d.ts +4 -4
- package/dist/types/primitives/icon/svg/wallet.d.mts +4 -4
- package/dist/types/primitives/icon/svg/wallet.d.ts +4 -4
- package/dist/types/primitives/icon/svg/warning-filled.d.mts +4 -4
- package/dist/types/primitives/icon/svg/warning-filled.d.ts +4 -4
- package/dist/types/primitives/icon/svg/warning.d.mts +4 -4
- package/dist/types/primitives/icon/svg/warning.d.ts +4 -4
- package/dist/types/primitives/inline-alert/index.d.mts +4 -5
- package/dist/types/primitives/inline-alert/index.d.ts +4 -5
- package/dist/types/primitives/loading-icon/index.d.mts +4 -5
- package/dist/types/primitives/loading-icon/index.d.ts +4 -5
- package/dist/types/primitives/modal/index.d.mts +12 -9
- package/dist/types/primitives/modal/index.d.ts +12 -9
- package/dist/types/primitives/number-value.d.mts +4 -4
- package/dist/types/primitives/number-value.d.ts +4 -4
- package/dist/types/primitives/remote-image/index.d.mts +4 -5
- package/dist/types/primitives/remote-image/index.d.ts +4 -5
- package/dist/types/primitives/search/index.d.mts +4 -5
- package/dist/types/primitives/search/index.d.ts +4 -5
- package/dist/types/primitives/search/search-empty-icon.d.mts +4 -4
- package/dist/types/primitives/search/search-empty-icon.d.ts +4 -4
- package/dist/types/primitives/select/index.d.mts +4 -5
- package/dist/types/primitives/select/index.d.ts +4 -5
- package/dist/types/primitives/skeleton/index.d.mts +4 -5
- package/dist/types/primitives/skeleton/index.d.ts +4 -5
- package/dist/types/primitives/skeleton/skeleton-block.d.mts +4 -4
- package/dist/types/primitives/skeleton/skeleton-block.d.ts +4 -4
- package/dist/types/primitives/skeleton/views/event-list-item-details-skeleton-view.d.mts +4 -4
- package/dist/types/primitives/skeleton/views/event-list-item-details-skeleton-view.d.ts +4 -4
- package/dist/types/primitives/skeleton/views/event-list-item-skeleton-view.d.mts +4 -10
- package/dist/types/primitives/skeleton/views/event-list-item-skeleton-view.d.ts +4 -10
- package/dist/types/primitives/skeleton/views/event-list-skeleton-view.d.mts +4 -4
- package/dist/types/primitives/skeleton/views/event-list-skeleton-view.d.ts +4 -4
- package/dist/types/primitives/skeleton/views/market-details-skeleton-view.d.mts +5 -5
- package/dist/types/primitives/skeleton/views/market-details-skeleton-view.d.ts +5 -5
- package/dist/types/primitives/skeleton/views/place-order-skeleton-view.d.mts +8 -8
- package/dist/types/primitives/skeleton/views/place-order-skeleton-view.d.ts +8 -8
- package/dist/types/primitives/skeleton/views/search-skeleton-view.d.mts +4 -4
- package/dist/types/primitives/skeleton/views/search-skeleton-view.d.ts +4 -4
- package/dist/types/primitives/skeleton/views/settlement-skeleton-view.d.mts +4 -4
- package/dist/types/primitives/skeleton/views/settlement-skeleton-view.d.ts +4 -4
- package/dist/types/primitives/skeleton/views/user-profile-overview-skeleton-view.d.mts +4 -4
- package/dist/types/primitives/skeleton/views/user-profile-overview-skeleton-view.d.ts +4 -4
- package/dist/types/primitives/skeleton/views/user-profile-positions-activity-skeleton-view.d.mts +4 -4
- package/dist/types/primitives/skeleton/views/user-profile-positions-activity-skeleton-view.d.ts +4 -4
- package/dist/types/primitives/state-message/index.d.mts +4 -5
- package/dist/types/primitives/state-message/index.d.ts +4 -5
- package/dist/types/primitives/switch-button/index.d.mts +4 -5
- package/dist/types/primitives/switch-button/index.d.ts +4 -5
- package/dist/types/primitives/tabs/index.d.mts +4 -5
- package/dist/types/primitives/tabs/index.d.ts +4 -5
- package/dist/types/primitives/toast/index.d.mts +1 -1
- package/dist/types/primitives/toast/index.d.ts +1 -1
- package/dist/types/primitives/tooltip/index.d.mts +4 -5
- package/dist/types/primitives/tooltip/index.d.ts +4 -5
- package/dist/types/primitives/typography/index.d.mts +4 -5
- package/dist/types/primitives/typography/index.d.ts +4 -5
- package/dist/types/primitives/typography/typography.types.d.mts +1 -1
- package/dist/types/primitives/typography/typography.types.d.ts +1 -1
- package/dist/types/primitives/venue-logo/index.d.mts +4 -5
- package/dist/types/primitives/venue-logo/index.d.ts +4 -5
- package/dist/types/primitives/venue-logo/svg/default-venue.d.mts +1 -1
- package/dist/types/primitives/venue-logo/svg/default-venue.d.ts +1 -1
- package/dist/types/primitives/venue-logo/svg/logo-betdex.d.mts +1 -1
- package/dist/types/primitives/venue-logo/svg/logo-betdex.d.ts +1 -1
- package/dist/types/primitives/venue-logo/svg/logo-hyperliquid.d.mts +4 -4
- package/dist/types/primitives/venue-logo/svg/logo-hyperliquid.d.ts +4 -4
- package/dist/types/primitives/venue-logo/svg/logo-kalshi.d.mts +4 -4
- package/dist/types/primitives/venue-logo/svg/logo-kalshi.d.ts +4 -4
- package/dist/types/primitives/venue-logo/svg/logo-limitless.d.mts +4 -4
- package/dist/types/primitives/venue-logo/svg/logo-limitless.d.ts +4 -4
- package/dist/types/primitives/venue-logo/svg/logo-myriad.d.mts +4 -4
- package/dist/types/primitives/venue-logo/svg/logo-myriad.d.ts +4 -4
- package/dist/types/primitives/venue-logo/svg/logo-novig.d.mts +4 -23
- package/dist/types/primitives/venue-logo/svg/logo-novig.d.ts +4 -23
- package/dist/types/primitives/venue-logo/svg/logo-opinion.d.mts +4 -4
- package/dist/types/primitives/venue-logo/svg/logo-opinion.d.ts +4 -4
- package/dist/types/primitives/venue-logo/svg/logo-polymarket.d.mts +4 -4
- package/dist/types/primitives/venue-logo/svg/logo-polymarket.d.ts +4 -4
- package/dist/types/primitives/venue-logo/svg/logo-pred.d.mts +4 -5
- package/dist/types/primitives/venue-logo/svg/logo-pred.d.ts +4 -5
- package/dist/types/primitives/venue-logo/svg/logo-predict.d.mts +4 -4
- package/dist/types/primitives/venue-logo/svg/logo-predict.d.ts +4 -4
- package/dist/types/primitives/venue-logo/svg/logo-probable.d.mts +4 -4
- package/dist/types/primitives/venue-logo/svg/logo-probable.d.ts +4 -4
- package/dist/types/primitives/venue-logo/svg/logo-prophetx.d.mts +4 -26
- package/dist/types/primitives/venue-logo/svg/logo-prophetx.d.ts +4 -26
- package/dist/types/primitives/venue-logo/svg/logo-tiprun.d.mts +4 -5
- package/dist/types/primitives/venue-logo/svg/logo-tiprun.d.ts +4 -5
- package/dist/types/primitives/venue-logo/venue-logo.constants.d.mts +1 -1
- package/dist/types/primitives/venue-logo/venue-logo.constants.d.ts +1 -1
- package/dist/types/profile/index.d.mts +4 -4
- package/dist/types/profile/index.d.ts +4 -4
- package/dist/types/profile/tabs/about-tab.d.mts +4 -4
- package/dist/types/profile/tabs/about-tab.d.ts +4 -4
- package/dist/types/profile/tabs/accounts-wallets-tab.d.mts +4 -4
- package/dist/types/profile/tabs/accounts-wallets-tab.d.ts +4 -4
- package/dist/types/profile/tabs/trading-access-tab.d.mts +4 -4
- package/dist/types/profile/tabs/trading-access-tab.d.ts +4 -4
- package/dist/types/shared/default-avatar.d.mts +4 -4
- package/dist/types/shared/default-avatar.d.ts +4 -4
- package/dist/types/shared/open-orders.d.mts +1 -1
- package/dist/types/shared/open-orders.d.ts +1 -1
- package/dist/types/shared/react-inert.d.mts +1 -0
- package/dist/types/shared/react-inert.d.ts +1 -0
- package/dist/types/shared/transfer-fee-summary.d.mts +1 -1
- package/dist/types/shared/transfer-fee-summary.d.ts +1 -1
- package/dist/types/trading/fund-kalshi-modal.d.mts +4 -4
- package/dist/types/trading/fund-kalshi-modal.d.ts +4 -4
- package/dist/types/trading/manage-betdex-account-modal.d.mts +1 -1
- package/dist/types/trading/manage-betdex-account-modal.d.ts +1 -1
- package/dist/types/trading/place-order/index.d.mts +4 -4
- package/dist/types/trading/place-order/index.d.ts +4 -4
- package/dist/types/trading/place-order/index.place-order.execution-view.d.mts +6 -6
- package/dist/types/trading/place-order/index.place-order.execution-view.d.ts +6 -6
- package/dist/types/trading/place-order/index.place-order.failure.d.mts +4 -4
- package/dist/types/trading/place-order/index.place-order.failure.d.ts +4 -4
- package/dist/types/trading/place-order/index.place-order.success.d.mts +4 -4
- package/dist/types/trading/place-order/index.place-order.success.d.ts +4 -4
- package/dist/types/trading/settlement/index.d.mts +4 -4
- package/dist/types/trading/settlement/index.d.ts +4 -4
- package/dist/types/trading/settlement/settlement-details.d.mts +4 -4
- package/dist/types/trading/settlement/settlement-details.d.ts +4 -4
- package/dist/types/trading/settlement/settlement-text-renderer.d.mts +4 -4
- package/dist/types/trading/settlement/settlement-text-renderer.d.ts +4 -4
- package/dist/types/withdraw/index.d.mts +4 -4
- package/dist/types/withdraw/index.d.ts +4 -4
- package/dist/types/withdraw/steps/withdraw-amount.d.mts +1 -1
- package/dist/types/withdraw/steps/withdraw-amount.d.ts +1 -1
- package/dist/types/withdraw/steps/withdraw-method.d.mts +1 -1
- package/dist/types/withdraw/steps/withdraw-method.d.ts +1 -1
- package/dist/types/withdraw/steps/withdraw-provider.d.mts +1 -1
- package/dist/types/withdraw/steps/withdraw-provider.d.ts +1 -1
- package/dist/types/withdraw/steps/withdraw-success.d.mts +2 -2
- package/dist/types/withdraw/steps/withdraw-success.d.ts +2 -2
- package/package.json +9 -8
- package/dist/chunk-6CZNJSRL.mjs +0 -3551
- package/dist/chunk-7G2GTWAS.mjs +0 -5189
- package/dist/chunk-7ORC3TUJ.mjs +0 -2883
- package/dist/chunk-EJXA32MG.mjs +0 -2377
- package/dist/chunk-JH4B3ZHQ.mjs +0 -1
- package/dist/chunk-KN7JN7F5.mjs +0 -8303
- package/dist/chunk-PN5HEBFC.mjs +0 -5789
- package/dist/chunk-W2LCFCW3.mjs +0 -2879
- package/dist/chunk-WOCZ4TVT.mjs +0 -1645
- package/dist/chunk-XZVGHKMW.mjs +0 -11426
- package/dist/event-market-A276CAYG.mjs +0 -21
|
@@ -0,0 +1,2390 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_primitives = require("./primitives-CqxNeV7H.js");
|
|
3
|
+
let react = require("react");
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
let _agg_build_hooks = require("@agg-build/hooks");
|
|
6
|
+
let _agg_build_sdk = require("@agg-build/sdk");
|
|
7
|
+
let _radix_ui_react_dialog = require("@radix-ui/react-dialog");
|
|
8
|
+
_radix_ui_react_dialog = require_primitives.__toESM(_radix_ui_react_dialog);
|
|
9
|
+
let zod = require("zod");
|
|
10
|
+
let _agg_build_hooks_withdraw = require("@agg-build/hooks/withdraw");
|
|
11
|
+
//#region src/notifications/deposit-notification-events.ts
|
|
12
|
+
const AGG_DEPOSIT_NOTIFICATION_EVENT = "agg:deposit-notification";
|
|
13
|
+
const dispatchAggDepositNotification = (detail) => {
|
|
14
|
+
if (typeof window === "undefined") return;
|
|
15
|
+
window.dispatchEvent(new CustomEvent(AGG_DEPOSIT_NOTIFICATION_EVENT, { detail }));
|
|
16
|
+
};
|
|
17
|
+
const subscribeAggDepositNotification = (handler) => {
|
|
18
|
+
if (typeof window === "undefined") return () => {};
|
|
19
|
+
const handleDepositNotification = (event) => {
|
|
20
|
+
if (!(event instanceof CustomEvent)) return;
|
|
21
|
+
handler(event.detail);
|
|
22
|
+
};
|
|
23
|
+
window.addEventListener(AGG_DEPOSIT_NOTIFICATION_EVENT, handleDepositNotification);
|
|
24
|
+
return () => {
|
|
25
|
+
window.removeEventListener(AGG_DEPOSIT_NOTIFICATION_EVENT, handleDepositNotification);
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/geo-block-banner/index.tsx
|
|
30
|
+
const GeoBlockBanner = ({ venue, termsUrl = require_primitives.AGG_TERMS_OF_SERVICE_URL, className }) => {
|
|
31
|
+
const labels = (0, _agg_build_hooks.useLabels)();
|
|
32
|
+
const message = venue ? labels.trading.geoBlockVenueMessage(venue) : labels.trading.geoBlockGenericMessage;
|
|
33
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
34
|
+
className: require_primitives.cn("flex items-center gap-5 rounded-agg-lg bg-agg-secondary-hover p-3", className),
|
|
35
|
+
role: "status",
|
|
36
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
37
|
+
className: "min-w-0 flex-1 text-agg-xs leading-agg-4 text-agg-foreground",
|
|
38
|
+
children: [
|
|
39
|
+
message,
|
|
40
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
41
|
+
href: termsUrl,
|
|
42
|
+
className: "underline",
|
|
43
|
+
target: "_blank",
|
|
44
|
+
rel: "noreferrer noopener",
|
|
45
|
+
children: labels.trading.geoBlockTermsLink
|
|
46
|
+
}),
|
|
47
|
+
labels.trading.geoBlockMessageSuffix
|
|
48
|
+
]
|
|
49
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Icon, {
|
|
50
|
+
name: "internet-security",
|
|
51
|
+
className: "h-6 w-6 shrink-0 text-agg-muted-foreground"
|
|
52
|
+
})]
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
GeoBlockBanner.displayName = "GeoBlockBanner";
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/kyc/shared-kyc-modal.tsx
|
|
58
|
+
const SharedKycModal = ({ open, state = "initial", errorMessage, onOpenChange, onStartVerification }) => {
|
|
59
|
+
const labels = (0, _agg_build_hooks.useLabels)();
|
|
60
|
+
const modalLabels = labels.trading.sharedKyc.modal;
|
|
61
|
+
const isInitiating = state === "initiating";
|
|
62
|
+
const handleOpenChange = (nextOpen) => {
|
|
63
|
+
if (isInitiating && !nextOpen) return;
|
|
64
|
+
onOpenChange(nextOpen);
|
|
65
|
+
};
|
|
66
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal, {
|
|
67
|
+
open,
|
|
68
|
+
onOpenChange: handleOpenChange,
|
|
69
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_primitives.Modal.Container, {
|
|
70
|
+
maxWidth: "420px",
|
|
71
|
+
"aria-label": modalLabels.ariaLabel,
|
|
72
|
+
classNames: { container: "!rounded-agg-2xl" },
|
|
73
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
74
|
+
className: "flex h-14 shrink-0 items-center justify-end px-5",
|
|
75
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Close, {
|
|
76
|
+
"aria-label": labels.common.close,
|
|
77
|
+
disabled: isInitiating,
|
|
78
|
+
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",
|
|
79
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Icon, {
|
|
80
|
+
name: "close",
|
|
81
|
+
size: "small",
|
|
82
|
+
"aria-hidden": "true"
|
|
83
|
+
})
|
|
84
|
+
})
|
|
85
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Body, {
|
|
86
|
+
classNames: { root: "!px-8 !pb-9 !pt-0" },
|
|
87
|
+
children: state === "success" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
88
|
+
className: "flex flex-col items-center gap-6 text-center",
|
|
89
|
+
role: "status",
|
|
90
|
+
"aria-live": "polite",
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
93
|
+
className: "flex size-12 items-center justify-center rounded-agg-full border border-agg-success bg-agg-success/10 text-agg-success",
|
|
94
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Icon, {
|
|
95
|
+
name: "success-check",
|
|
96
|
+
className: "size-5",
|
|
97
|
+
"aria-hidden": "true"
|
|
98
|
+
})
|
|
99
|
+
}),
|
|
100
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
101
|
+
className: "flex flex-col items-center gap-2",
|
|
102
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Title, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Typography, {
|
|
103
|
+
as: "span",
|
|
104
|
+
variant: "body-large-strong",
|
|
105
|
+
children: modalLabels.successTitle
|
|
106
|
+
}) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Description, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Typography, {
|
|
107
|
+
as: "span",
|
|
108
|
+
variant: "label",
|
|
109
|
+
className: "text-pretty text-agg-foreground",
|
|
110
|
+
children: modalLabels.successDescription
|
|
111
|
+
}) })]
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
114
|
+
variant: "secondary",
|
|
115
|
+
size: "large",
|
|
116
|
+
onClick: () => handleOpenChange(false),
|
|
117
|
+
children: modalLabels.done
|
|
118
|
+
})
|
|
119
|
+
]
|
|
120
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
121
|
+
className: "flex flex-col items-center gap-6 text-center",
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Icon, {
|
|
124
|
+
name: "user-trust",
|
|
125
|
+
className: "h-12! w-12! text-agg-muted-foreground",
|
|
126
|
+
"aria-hidden": "true"
|
|
127
|
+
}),
|
|
128
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
129
|
+
className: "flex flex-col items-center gap-2",
|
|
130
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Title, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Typography, {
|
|
131
|
+
as: "span",
|
|
132
|
+
variant: "body-large-strong",
|
|
133
|
+
children: state === "pending" ? modalLabels.pendingTitle : modalLabels.title
|
|
134
|
+
}) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Description, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Typography, {
|
|
135
|
+
as: "span",
|
|
136
|
+
variant: "label",
|
|
137
|
+
className: "text-pretty text-agg-foreground",
|
|
138
|
+
children: state === "pending" ? modalLabels.pendingDescription : modalLabels.freeDescription
|
|
139
|
+
}) })]
|
|
140
|
+
}),
|
|
141
|
+
state === "error" || state === "pending" && errorMessage ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.InlineAlert, {
|
|
142
|
+
tone: "error",
|
|
143
|
+
variant: "surface",
|
|
144
|
+
message: errorMessage || modalLabels.error
|
|
145
|
+
}) : null,
|
|
146
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
147
|
+
className: "flex flex-col items-center gap-4",
|
|
148
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
149
|
+
variant: "primary",
|
|
150
|
+
size: "large",
|
|
151
|
+
isLoading: isInitiating,
|
|
152
|
+
disabled: isInitiating,
|
|
153
|
+
"aria-label": state === "pending" ? modalLabels.checkStatus : modalLabels.startVerification,
|
|
154
|
+
onClick: onStartVerification,
|
|
155
|
+
children: state === "pending" ? modalLabels.checkStatus : modalLabels.startVerification
|
|
156
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
157
|
+
variant: "tertiary",
|
|
158
|
+
size: "large",
|
|
159
|
+
disabled: isInitiating,
|
|
160
|
+
onClick: () => handleOpenChange(false),
|
|
161
|
+
children: modalLabels.doItLater
|
|
162
|
+
})]
|
|
163
|
+
})
|
|
164
|
+
]
|
|
165
|
+
})
|
|
166
|
+
})]
|
|
167
|
+
})
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
SharedKycModal.displayName = "SharedKycModal";
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/onboarding/steps/connect-kalshi-modal.tsx
|
|
173
|
+
const kalshiCredentialsSchema = zod.z.object({
|
|
174
|
+
apiKeyId: zod.z.string().trim().min(1),
|
|
175
|
+
privateKey: zod.z.string().trim().min(1)
|
|
176
|
+
});
|
|
177
|
+
const getSafeConnectionError = ({ apiKeyId, error, fallback, privateKey }) => {
|
|
178
|
+
if (!(error instanceof Error) || !error.message.trim()) return fallback;
|
|
179
|
+
return [apiKeyId, privateKey].filter(Boolean).reduce((message, sensitiveValue) => message.split(sensitiveValue).join("[redacted]"), error.message).trim();
|
|
180
|
+
};
|
|
181
|
+
const CloseButton = ({ className, disabled }) => {
|
|
182
|
+
const labels = (0, _agg_build_hooks.useLabels)();
|
|
183
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Close, {
|
|
184
|
+
"aria-label": labels.common.close,
|
|
185
|
+
disabled,
|
|
186
|
+
className: require_primitives.cn("z-30 flex size-6 cursor-pointer items-center justify-center rounded-agg-full", "text-agg-foreground transition-colors hover:text-agg-foreground/80", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-accent", "disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
187
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Icon, {
|
|
188
|
+
name: "close",
|
|
189
|
+
size: "medium",
|
|
190
|
+
className: "!text-agg-foreground"
|
|
191
|
+
})
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
const ConnectKalshiModal = ({ open, onOpenChange, onVerify }) => {
|
|
195
|
+
const labels = (0, _agg_build_hooks.useLabels)();
|
|
196
|
+
const { disabledVenues, isLoading: isAppConfigLoading } = (0, _agg_build_hooks.useAppConfig)();
|
|
197
|
+
const apiKeyInputRef = (0, react.useRef)(null);
|
|
198
|
+
const errorId = (0, react.useId)();
|
|
199
|
+
const [apiKeyId, setApiKeyId] = (0, react.useState)("");
|
|
200
|
+
const [privateKey, setPrivateKey] = (0, react.useState)("");
|
|
201
|
+
const [isVerifying, setIsVerifying] = (0, react.useState)(false);
|
|
202
|
+
const [isConnected, setIsConnected] = (0, react.useState)(false);
|
|
203
|
+
const [error, setError] = (0, react.useState)();
|
|
204
|
+
const availabilityState = (0, _agg_build_hooks.getVenueAvailabilityState)({
|
|
205
|
+
venueId: _agg_build_sdk.Venue.kalshi,
|
|
206
|
+
disabledVenues,
|
|
207
|
+
isConfigLoading: isAppConfigLoading
|
|
208
|
+
});
|
|
209
|
+
const parsedCredentials = (0, react.useMemo)(() => kalshiCredentialsSchema.safeParse({
|
|
210
|
+
apiKeyId,
|
|
211
|
+
privateKey
|
|
212
|
+
}), [apiKeyId, privateKey]);
|
|
213
|
+
(0, react.useEffect)(() => {
|
|
214
|
+
if (!open) return;
|
|
215
|
+
setApiKeyId("");
|
|
216
|
+
setPrivateKey("");
|
|
217
|
+
setError(void 0);
|
|
218
|
+
setIsVerifying(false);
|
|
219
|
+
setIsConnected(false);
|
|
220
|
+
}, [open]);
|
|
221
|
+
const handleOpenAutoFocus = (0, react.useCallback)((event) => {
|
|
222
|
+
event.preventDefault();
|
|
223
|
+
apiKeyInputRef.current?.focus({ preventScroll: true });
|
|
224
|
+
}, []);
|
|
225
|
+
const handleOpenChange = (0, react.useCallback)((nextOpen) => {
|
|
226
|
+
if (isVerifying && !nextOpen) return;
|
|
227
|
+
onOpenChange(nextOpen);
|
|
228
|
+
}, [isVerifying, onOpenChange]);
|
|
229
|
+
const handleVerify = (0, react.useCallback)(async () => {
|
|
230
|
+
if (!parsedCredentials.success || isVerifying || isConnected) return;
|
|
231
|
+
const credentials = parsedCredentials.data;
|
|
232
|
+
setIsVerifying(true);
|
|
233
|
+
setError(void 0);
|
|
234
|
+
try {
|
|
235
|
+
await onVerify(credentials);
|
|
236
|
+
setApiKeyId("");
|
|
237
|
+
setPrivateKey("");
|
|
238
|
+
setIsConnected(true);
|
|
239
|
+
} catch (verificationError) {
|
|
240
|
+
setError(getSafeConnectionError({
|
|
241
|
+
...credentials,
|
|
242
|
+
error: verificationError,
|
|
243
|
+
fallback: labels.onboarding.connectKalshiModal.fallbackError
|
|
244
|
+
}));
|
|
245
|
+
} finally {
|
|
246
|
+
setIsVerifying(false);
|
|
247
|
+
}
|
|
248
|
+
}, [
|
|
249
|
+
isConnected,
|
|
250
|
+
isVerifying,
|
|
251
|
+
labels.onboarding.connectKalshiModal.fallbackError,
|
|
252
|
+
onVerify,
|
|
253
|
+
parsedCredentials
|
|
254
|
+
]);
|
|
255
|
+
const handleSubmit = (0, react.useCallback)((event) => {
|
|
256
|
+
event.preventDefault();
|
|
257
|
+
handleVerify();
|
|
258
|
+
}, [handleVerify]);
|
|
259
|
+
if (availabilityState === "hidden") return null;
|
|
260
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal, {
|
|
261
|
+
open,
|
|
262
|
+
onOpenChange: handleOpenChange,
|
|
263
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Container, {
|
|
264
|
+
maxWidth: isConnected ? "480px" : "600px",
|
|
265
|
+
"aria-label": labels.onboarding.connectKalshiModal.ariaLabel,
|
|
266
|
+
classNames: { container: "!rounded-t-agg-xl !rounded-b-none md:!rounded-agg-2xl" },
|
|
267
|
+
onOpenAutoFocus: isConnected ? void 0 : handleOpenAutoFocus,
|
|
268
|
+
children: isConnected ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_primitives.Modal.Body, {
|
|
269
|
+
classNames: { root: "relative !px-5 !py-8 md:!px-10 md:!py-12" },
|
|
270
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CloseButton, { className: "absolute right-5 top-5 md:right-8 md:top-8" }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
271
|
+
className: "flex flex-col items-center gap-8 text-center",
|
|
272
|
+
role: "status",
|
|
273
|
+
"aria-live": "polite",
|
|
274
|
+
children: [
|
|
275
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
276
|
+
className: "flex size-[60px] items-center justify-center rounded-agg-full bg-agg-success/15",
|
|
277
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Icon, {
|
|
278
|
+
name: "success-check",
|
|
279
|
+
className: "size-6 text-agg-success",
|
|
280
|
+
"aria-hidden": "true"
|
|
281
|
+
})
|
|
282
|
+
}),
|
|
283
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
284
|
+
className: "flex flex-col items-center gap-3",
|
|
285
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Title, {
|
|
286
|
+
className: "text-agg-2xl font-agg-bold leading-agg-8 text-agg-foreground",
|
|
287
|
+
children: labels.onboarding.connectKalshiModal.success.title
|
|
288
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Description, {
|
|
289
|
+
className: "text-agg-base leading-agg-6 text-agg-foreground",
|
|
290
|
+
children: labels.onboarding.connectKalshiModal.success.description
|
|
291
|
+
})]
|
|
292
|
+
}),
|
|
293
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
294
|
+
variant: "secondary",
|
|
295
|
+
size: "large",
|
|
296
|
+
onClick: () => handleOpenChange(false),
|
|
297
|
+
children: labels.onboarding.connectKalshiModal.success.done
|
|
298
|
+
})
|
|
299
|
+
]
|
|
300
|
+
})]
|
|
301
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
302
|
+
className: "flex min-h-0 flex-1 flex-col",
|
|
303
|
+
onSubmit: handleSubmit,
|
|
304
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Body, {
|
|
305
|
+
classNames: { root: "relative !px-5 !pb-6 !pt-5 md:!px-10 md:!pb-0 md:!pt-12" },
|
|
306
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
307
|
+
className: "flex flex-col gap-6 md:items-center md:gap-0",
|
|
308
|
+
children: [
|
|
309
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
310
|
+
className: "flex w-full flex-col md:contents",
|
|
311
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
312
|
+
className: "flex items-center gap-3 md:contents",
|
|
313
|
+
children: [
|
|
314
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.VenueLogo, {
|
|
315
|
+
venue: _agg_build_sdk.Venue.kalshi,
|
|
316
|
+
variant: "logo",
|
|
317
|
+
size: "large",
|
|
318
|
+
className: "!size-10 md:!mb-8 md:!size-[60px]"
|
|
319
|
+
}),
|
|
320
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Title, {
|
|
321
|
+
className: "text-agg-lg font-agg-bold leading-agg-7 text-agg-foreground md:mb-4 md:text-center md:text-agg-2xl md:leading-agg-8",
|
|
322
|
+
children: labels.onboarding.connectKalshiModal.title
|
|
323
|
+
}),
|
|
324
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CloseButton, {
|
|
325
|
+
disabled: isVerifying,
|
|
326
|
+
className: "ml-auto shrink-0 md:absolute md:right-8 md:top-8 md:ml-0"
|
|
327
|
+
})
|
|
328
|
+
]
|
|
329
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Description, {
|
|
330
|
+
className: "mt-3 text-agg-sm leading-agg-5 text-agg-foreground md:mb-8 md:mt-0 md:text-center md:text-agg-base md:leading-agg-6",
|
|
331
|
+
children: labels.onboarding.connectKalshiModal.description
|
|
332
|
+
})]
|
|
333
|
+
}),
|
|
334
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
335
|
+
className: "flex w-full flex-col gap-4",
|
|
336
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
337
|
+
className: "flex flex-col gap-3 rounded-agg-xl bg-agg-secondary-hover p-4",
|
|
338
|
+
children: [
|
|
339
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
340
|
+
className: "flex flex-col gap-1",
|
|
341
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
342
|
+
className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground",
|
|
343
|
+
children: labels.onboarding.connectKalshiModal.stepOne.label
|
|
344
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
345
|
+
className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground",
|
|
346
|
+
children: labels.onboarding.connectKalshiModal.stepOne.title
|
|
347
|
+
})]
|
|
348
|
+
}),
|
|
349
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
350
|
+
className: "text-agg-sm leading-agg-5 text-agg-foreground",
|
|
351
|
+
children: [
|
|
352
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.signIn }),
|
|
353
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", { children: [
|
|
354
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfilePrefix,
|
|
355
|
+
" ",
|
|
356
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
357
|
+
className: "font-agg-bold",
|
|
358
|
+
children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileText
|
|
359
|
+
}),
|
|
360
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfileSeparator,
|
|
361
|
+
" ",
|
|
362
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
363
|
+
href: labels.onboarding.connectKalshiModal.stepOne.instructions.profileUrl,
|
|
364
|
+
target: "_blank",
|
|
365
|
+
rel: "noreferrer",
|
|
366
|
+
className: "cursor-pointer underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
|
|
367
|
+
children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileUrl
|
|
368
|
+
})
|
|
369
|
+
] }),
|
|
370
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", { children: [
|
|
371
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeyPrefix,
|
|
372
|
+
" ",
|
|
373
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
374
|
+
className: "font-agg-bold",
|
|
375
|
+
children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKeyText
|
|
376
|
+
}),
|
|
377
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeySuffix
|
|
378
|
+
] }),
|
|
379
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", { children: [
|
|
380
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsPrefix,
|
|
381
|
+
" ",
|
|
382
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
383
|
+
className: "font-agg-bold",
|
|
384
|
+
children: labels.onboarding.connectKalshiModal.stepOne.instructions.readWriteText
|
|
385
|
+
}),
|
|
386
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsSuffix
|
|
387
|
+
] }),
|
|
388
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKey })
|
|
389
|
+
]
|
|
390
|
+
}),
|
|
391
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
392
|
+
className: "text-agg-sm leading-agg-5 text-agg-foreground",
|
|
393
|
+
children: [
|
|
394
|
+
labels.onboarding.connectKalshiModal.stepOne.footerLineOne,
|
|
395
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("br", {}),
|
|
396
|
+
labels.onboarding.connectKalshiModal.stepOne.footerLineTwo
|
|
397
|
+
]
|
|
398
|
+
})
|
|
399
|
+
]
|
|
400
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
401
|
+
className: "flex flex-col gap-3 rounded-agg-xl bg-agg-secondary-hover p-4",
|
|
402
|
+
children: [
|
|
403
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
404
|
+
className: "flex flex-col gap-1",
|
|
405
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
406
|
+
className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground",
|
|
407
|
+
children: labels.onboarding.connectKalshiModal.stepTwo.label
|
|
408
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
409
|
+
className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground",
|
|
410
|
+
children: labels.onboarding.connectKalshiModal.stepTwo.title
|
|
411
|
+
})]
|
|
412
|
+
}),
|
|
413
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
414
|
+
className: "text-agg-sm leading-agg-5 text-agg-foreground",
|
|
415
|
+
children: labels.onboarding.connectKalshiModal.stepTwo.description
|
|
416
|
+
}),
|
|
417
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
418
|
+
className: "flex flex-col gap-2",
|
|
419
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
420
|
+
htmlFor: "kalshi-api-key-id",
|
|
421
|
+
className: "text-agg-sm font-agg-bold text-agg-foreground",
|
|
422
|
+
children: labels.onboarding.connectKalshiModal.stepTwo.apiKeyIdLabel
|
|
423
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
424
|
+
ref: apiKeyInputRef,
|
|
425
|
+
id: "kalshi-api-key-id",
|
|
426
|
+
type: "text",
|
|
427
|
+
autoComplete: "off",
|
|
428
|
+
value: apiKeyId,
|
|
429
|
+
onChange: (event) => setApiKeyId(event.target.value),
|
|
430
|
+
placeholder: labels.onboarding.connectKalshiModal.stepTwo.apiKeyIdPlaceholder,
|
|
431
|
+
disabled: isVerifying,
|
|
432
|
+
"aria-invalid": !!error,
|
|
433
|
+
"aria-describedby": error ? errorId : void 0,
|
|
434
|
+
className: require_primitives.cn("h-10 w-full rounded-agg-sm border border-agg-separator bg-agg-secondary px-3 py-2.5", "text-agg-base text-agg-foreground placeholder:text-agg-muted-foreground", "outline-none transition-colors focus:border-agg-primary focus:ring-1 focus:ring-agg-primary", "disabled:cursor-not-allowed disabled:opacity-60")
|
|
435
|
+
})]
|
|
436
|
+
}),
|
|
437
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
438
|
+
className: "flex flex-col gap-2",
|
|
439
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
440
|
+
htmlFor: "kalshi-private-key",
|
|
441
|
+
className: "text-agg-sm font-agg-bold text-agg-foreground",
|
|
442
|
+
children: labels.onboarding.connectKalshiModal.stepTwo.privateKeyLabel
|
|
443
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
444
|
+
id: "kalshi-private-key",
|
|
445
|
+
autoComplete: "off",
|
|
446
|
+
value: privateKey,
|
|
447
|
+
onChange: (event) => setPrivateKey(event.target.value),
|
|
448
|
+
placeholder: labels.onboarding.connectKalshiModal.stepTwo.privateKeyPlaceholder,
|
|
449
|
+
rows: 3,
|
|
450
|
+
disabled: isVerifying,
|
|
451
|
+
"aria-invalid": !!error,
|
|
452
|
+
"aria-describedby": error ? errorId : void 0,
|
|
453
|
+
className: require_primitives.cn("w-full resize-none rounded-agg-sm border border-agg-separator bg-agg-secondary px-3 py-2.5", "text-agg-base text-agg-foreground placeholder:text-agg-muted-foreground", "outline-none transition-colors focus:border-agg-primary focus:ring-1 focus:ring-agg-primary", "disabled:cursor-not-allowed disabled:opacity-60")
|
|
454
|
+
})]
|
|
455
|
+
})
|
|
456
|
+
]
|
|
457
|
+
})]
|
|
458
|
+
}),
|
|
459
|
+
error ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
460
|
+
id: errorId,
|
|
461
|
+
className: "flex items-center gap-2 md:justify-center",
|
|
462
|
+
role: "alert",
|
|
463
|
+
"aria-live": "assertive",
|
|
464
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Icon, {
|
|
465
|
+
name: "warning",
|
|
466
|
+
size: "small",
|
|
467
|
+
className: "size-3.5 text-agg-error"
|
|
468
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
469
|
+
className: "text-agg-sm leading-agg-5 text-agg-error",
|
|
470
|
+
children: error
|
|
471
|
+
})]
|
|
472
|
+
}) : null
|
|
473
|
+
]
|
|
474
|
+
})
|
|
475
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_primitives.Modal.Footer, {
|
|
476
|
+
classNames: { root: "relative !h-auto !gap-3 !p-4 md:!justify-center md:!border-0 md:!px-10 md:!pb-12 md:!pt-8" },
|
|
477
|
+
children: [
|
|
478
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
479
|
+
"aria-hidden": "true",
|
|
480
|
+
className: "pointer-events-none absolute inset-x-0 -top-[60px] h-[60px] bg-gradient-to-b from-transparent to-agg-secondary md:hidden"
|
|
481
|
+
}),
|
|
482
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
483
|
+
variant: "secondary",
|
|
484
|
+
size: "large",
|
|
485
|
+
className: "shrink-0",
|
|
486
|
+
onClick: () => handleOpenChange(false),
|
|
487
|
+
disabled: isVerifying,
|
|
488
|
+
children: labels.onboarding.connectKalshiModal.actions.cancel
|
|
489
|
+
}),
|
|
490
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
491
|
+
type: "submit",
|
|
492
|
+
variant: "primary",
|
|
493
|
+
size: "large",
|
|
494
|
+
className: "flex-1 md:flex-none",
|
|
495
|
+
disabled: !parsedCredentials.success || isVerifying,
|
|
496
|
+
isLoading: isVerifying,
|
|
497
|
+
children: labels.onboarding.connectKalshiModal.actions.verifyConnection
|
|
498
|
+
})
|
|
499
|
+
]
|
|
500
|
+
})]
|
|
501
|
+
})
|
|
502
|
+
})
|
|
503
|
+
});
|
|
504
|
+
};
|
|
505
|
+
ConnectKalshiModal.displayName = "ConnectKalshiModal";
|
|
506
|
+
//#endregion
|
|
507
|
+
//#region src/onboarding/steps/connect-prophetx-modal.tsx
|
|
508
|
+
function ConnectProphetxModal({ open, onOpenChange, onVerify, onDisconnect, allowExistingConnection = false }) {
|
|
509
|
+
const copy = (0, _agg_build_hooks.useLabels)().onboarding.connectProphetxModal;
|
|
510
|
+
const common = (0, _agg_build_hooks.useLabels)().common;
|
|
511
|
+
const { prophetxExecutionMode, disabledVenues, isLoading } = (0, _agg_build_hooks.useAppConfig)();
|
|
512
|
+
const id = (0, react.useId)();
|
|
513
|
+
const [accessKey, setAccessKey] = (0, react.useState)("");
|
|
514
|
+
const [secretKey, setSecretKey] = (0, react.useState)("");
|
|
515
|
+
const [pending, setPending] = (0, react.useState)(false);
|
|
516
|
+
const [disconnecting, setDisconnecting] = (0, react.useState)(false);
|
|
517
|
+
const [disconnectError, setDisconnectError] = (0, react.useState)(false);
|
|
518
|
+
const busy = pending || disconnecting;
|
|
519
|
+
const [connected, setConnected] = (0, react.useState)(false);
|
|
520
|
+
const [error, setError] = (0, react.useState)(false);
|
|
521
|
+
(0, react.useEffect)(() => {
|
|
522
|
+
if (!open) {
|
|
523
|
+
setAccessKey("");
|
|
524
|
+
setSecretKey("");
|
|
525
|
+
setError(false);
|
|
526
|
+
setDisconnectError(false);
|
|
527
|
+
setConnected(false);
|
|
528
|
+
}
|
|
529
|
+
}, [open]);
|
|
530
|
+
if (isLoading || !allowExistingConnection && (prophetxExecutionMode !== "direct" || disabledVenues.includes(_agg_build_sdk.Venue.prophetx))) return null;
|
|
531
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal, {
|
|
532
|
+
open,
|
|
533
|
+
onOpenChange: (value) => {
|
|
534
|
+
if (!busy) onOpenChange(value);
|
|
535
|
+
},
|
|
536
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Container, {
|
|
537
|
+
maxWidth: "480px",
|
|
538
|
+
"aria-label": copy.title,
|
|
539
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_primitives.Modal.Body, {
|
|
540
|
+
classNames: { root: "relative !p-6" },
|
|
541
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Close, {
|
|
542
|
+
"aria-label": common.close,
|
|
543
|
+
disabled: busy,
|
|
544
|
+
className: "absolute right-4 top-4 cursor-pointer disabled:cursor-not-allowed",
|
|
545
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Icon, {
|
|
546
|
+
name: "close",
|
|
547
|
+
size: "medium"
|
|
548
|
+
})
|
|
549
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
550
|
+
className: "flex flex-col gap-4",
|
|
551
|
+
onSubmit: async (event) => {
|
|
552
|
+
event.preventDefault();
|
|
553
|
+
if (busy || !accessKey.trim() || !secretKey.trim()) return;
|
|
554
|
+
setPending(true);
|
|
555
|
+
setError(false);
|
|
556
|
+
try {
|
|
557
|
+
await onVerify({
|
|
558
|
+
accessKey: accessKey.trim(),
|
|
559
|
+
secretKey: secretKey.trim()
|
|
560
|
+
});
|
|
561
|
+
setAccessKey("");
|
|
562
|
+
setSecretKey("");
|
|
563
|
+
setConnected(true);
|
|
564
|
+
} catch {
|
|
565
|
+
setError(true);
|
|
566
|
+
} finally {
|
|
567
|
+
setPending(false);
|
|
568
|
+
}
|
|
569
|
+
},
|
|
570
|
+
children: [
|
|
571
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.VenueLogo, {
|
|
572
|
+
venue: _agg_build_sdk.Venue.prophetx,
|
|
573
|
+
size: "large"
|
|
574
|
+
}),
|
|
575
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Title, {
|
|
576
|
+
className: "text-agg-xl font-agg-bold text-agg-foreground",
|
|
577
|
+
children: copy.title
|
|
578
|
+
}),
|
|
579
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Description, {
|
|
580
|
+
className: "text-agg-sm text-agg-muted-foreground",
|
|
581
|
+
children: copy.description
|
|
582
|
+
}),
|
|
583
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
584
|
+
className: "text-agg-sm text-agg-muted-foreground",
|
|
585
|
+
children: copy.fundingNotice
|
|
586
|
+
}),
|
|
587
|
+
connected ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
588
|
+
role: "status",
|
|
589
|
+
children: copy.connected
|
|
590
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
591
|
+
type: "button",
|
|
592
|
+
onClick: () => onOpenChange(false),
|
|
593
|
+
children: copy.done
|
|
594
|
+
})] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
595
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
596
|
+
className: "text-agg-sm text-agg-primary underline",
|
|
597
|
+
href: "https://www.prophetx.co",
|
|
598
|
+
target: "_blank",
|
|
599
|
+
rel: "noopener noreferrer",
|
|
600
|
+
children: copy.instructions
|
|
601
|
+
}),
|
|
602
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
603
|
+
htmlFor: `${id}-access`,
|
|
604
|
+
className: "text-agg-sm text-agg-foreground",
|
|
605
|
+
children: copy.accessKey
|
|
606
|
+
}),
|
|
607
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
608
|
+
id: `${id}-access`,
|
|
609
|
+
type: "password",
|
|
610
|
+
autoComplete: "off",
|
|
611
|
+
spellCheck: false,
|
|
612
|
+
className: "rounded-agg-md border border-agg-border bg-agg-secondary p-3 text-agg-foreground",
|
|
613
|
+
value: accessKey,
|
|
614
|
+
onChange: (e) => setAccessKey(e.target.value),
|
|
615
|
+
disabled: busy,
|
|
616
|
+
required: true
|
|
617
|
+
}),
|
|
618
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
619
|
+
htmlFor: `${id}-secret`,
|
|
620
|
+
className: "text-agg-sm text-agg-foreground",
|
|
621
|
+
children: copy.secretKey
|
|
622
|
+
}),
|
|
623
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
624
|
+
id: `${id}-secret`,
|
|
625
|
+
type: "password",
|
|
626
|
+
autoComplete: "new-password",
|
|
627
|
+
spellCheck: false,
|
|
628
|
+
className: "rounded-agg-md border border-agg-border bg-agg-secondary p-3 text-agg-foreground",
|
|
629
|
+
value: secretKey,
|
|
630
|
+
onChange: (e) => setSecretKey(e.target.value),
|
|
631
|
+
disabled: busy,
|
|
632
|
+
required: true
|
|
633
|
+
}),
|
|
634
|
+
error ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
635
|
+
role: "alert",
|
|
636
|
+
className: "text-agg-sm text-agg-error",
|
|
637
|
+
children: copy.error
|
|
638
|
+
}) : null,
|
|
639
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
640
|
+
type: "submit",
|
|
641
|
+
disabled: busy || !accessKey.trim() || !secretKey.trim(),
|
|
642
|
+
children: pending ? copy.verifying : copy.verify
|
|
643
|
+
})
|
|
644
|
+
] }),
|
|
645
|
+
allowExistingConnection && onDisconnect ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
646
|
+
type: "button",
|
|
647
|
+
variant: "secondary",
|
|
648
|
+
disabled: busy,
|
|
649
|
+
onClick: async () => {
|
|
650
|
+
setDisconnecting(true);
|
|
651
|
+
setDisconnectError(false);
|
|
652
|
+
setError(false);
|
|
653
|
+
try {
|
|
654
|
+
await onDisconnect();
|
|
655
|
+
setAccessKey("");
|
|
656
|
+
setSecretKey("");
|
|
657
|
+
onOpenChange(false);
|
|
658
|
+
} catch {
|
|
659
|
+
setDisconnectError(true);
|
|
660
|
+
} finally {
|
|
661
|
+
setDisconnecting(false);
|
|
662
|
+
}
|
|
663
|
+
},
|
|
664
|
+
children: disconnecting ? copy.disconnecting : copy.disconnect
|
|
665
|
+
}) : null,
|
|
666
|
+
disconnectError ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
667
|
+
role: "alert",
|
|
668
|
+
className: "text-agg-sm text-agg-error",
|
|
669
|
+
children: copy.disconnectError
|
|
670
|
+
}) : null
|
|
671
|
+
]
|
|
672
|
+
})]
|
|
673
|
+
})
|
|
674
|
+
})
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
//#endregion
|
|
678
|
+
//#region src/onboarding/steps/connect-novig-modal.tsx
|
|
679
|
+
function ConnectNovigModal({ open, onOpenChange, onVerify, onDisconnect, allowExistingConnection = false }) {
|
|
680
|
+
const copy = (0, _agg_build_hooks.useLabels)().onboarding.connectNovigModal;
|
|
681
|
+
const common = (0, _agg_build_hooks.useLabels)().common;
|
|
682
|
+
const { novigExecutionMode, disabledVenues, isLoading } = (0, _agg_build_hooks.useAppConfig)();
|
|
683
|
+
const id = (0, react.useId)();
|
|
684
|
+
const [keyId, setKeyId] = (0, react.useState)("");
|
|
685
|
+
const [privateKey, setPrivateKey] = (0, react.useState)("");
|
|
686
|
+
const [pending, setPending] = (0, react.useState)(false);
|
|
687
|
+
const [disconnecting, setDisconnecting] = (0, react.useState)(false);
|
|
688
|
+
const [disconnectError, setDisconnectError] = (0, react.useState)(false);
|
|
689
|
+
const busy = pending || disconnecting;
|
|
690
|
+
const [connected, setConnected] = (0, react.useState)(false);
|
|
691
|
+
const [error, setError] = (0, react.useState)(false);
|
|
692
|
+
(0, react.useEffect)(() => {
|
|
693
|
+
if (!open) {
|
|
694
|
+
setKeyId("");
|
|
695
|
+
setPrivateKey("");
|
|
696
|
+
setError(false);
|
|
697
|
+
setDisconnectError(false);
|
|
698
|
+
setConnected(false);
|
|
699
|
+
}
|
|
700
|
+
}, [open]);
|
|
701
|
+
if (isLoading || !allowExistingConnection && (novigExecutionMode !== "direct" || disabledVenues.includes(_agg_build_sdk.Venue.novig))) return null;
|
|
702
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal, {
|
|
703
|
+
open,
|
|
704
|
+
onOpenChange: (value) => {
|
|
705
|
+
if (!busy) onOpenChange(value);
|
|
706
|
+
},
|
|
707
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Container, {
|
|
708
|
+
maxWidth: "480px",
|
|
709
|
+
"aria-label": copy.title,
|
|
710
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_primitives.Modal.Body, {
|
|
711
|
+
classNames: { root: "relative !p-6" },
|
|
712
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Close, {
|
|
713
|
+
"aria-label": common.close,
|
|
714
|
+
disabled: busy,
|
|
715
|
+
className: "absolute right-4 top-4 cursor-pointer disabled:cursor-not-allowed",
|
|
716
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Icon, {
|
|
717
|
+
name: "close",
|
|
718
|
+
size: "medium"
|
|
719
|
+
})
|
|
720
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
721
|
+
className: "flex flex-col gap-4",
|
|
722
|
+
onSubmit: async (event) => {
|
|
723
|
+
event.preventDefault();
|
|
724
|
+
if (busy || !keyId.trim() || !privateKey.trim()) return;
|
|
725
|
+
setPending(true);
|
|
726
|
+
setError(false);
|
|
727
|
+
try {
|
|
728
|
+
await onVerify({
|
|
729
|
+
keyId: keyId.trim(),
|
|
730
|
+
privateKey: privateKey.trim()
|
|
731
|
+
});
|
|
732
|
+
setKeyId("");
|
|
733
|
+
setPrivateKey("");
|
|
734
|
+
setConnected(true);
|
|
735
|
+
} catch {
|
|
736
|
+
setError(true);
|
|
737
|
+
} finally {
|
|
738
|
+
setPending(false);
|
|
739
|
+
}
|
|
740
|
+
},
|
|
741
|
+
children: [
|
|
742
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.VenueLogo, {
|
|
743
|
+
venue: _agg_build_sdk.Venue.novig,
|
|
744
|
+
size: "large"
|
|
745
|
+
}),
|
|
746
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Title, {
|
|
747
|
+
className: "text-agg-xl font-agg-bold text-agg-foreground",
|
|
748
|
+
children: copy.title
|
|
749
|
+
}),
|
|
750
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Description, {
|
|
751
|
+
className: "text-agg-sm text-agg-muted-foreground",
|
|
752
|
+
children: copy.description
|
|
753
|
+
}),
|
|
754
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
755
|
+
className: "text-agg-sm text-agg-muted-foreground",
|
|
756
|
+
children: copy.fundingNotice
|
|
757
|
+
}),
|
|
758
|
+
connected ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
759
|
+
role: "status",
|
|
760
|
+
children: copy.connected
|
|
761
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
762
|
+
type: "button",
|
|
763
|
+
onClick: () => onOpenChange(false),
|
|
764
|
+
children: copy.done
|
|
765
|
+
})] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
766
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
767
|
+
className: "text-agg-sm text-agg-primary underline",
|
|
768
|
+
href: "https://docs.novig.com/api/quickstart",
|
|
769
|
+
target: "_blank",
|
|
770
|
+
rel: "noopener noreferrer",
|
|
771
|
+
children: copy.instructions
|
|
772
|
+
}),
|
|
773
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
774
|
+
htmlFor: `${id}-access`,
|
|
775
|
+
className: "text-agg-sm text-agg-foreground",
|
|
776
|
+
children: copy.keyId
|
|
777
|
+
}),
|
|
778
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
779
|
+
id: `${id}-access`,
|
|
780
|
+
type: "password",
|
|
781
|
+
autoComplete: "off",
|
|
782
|
+
spellCheck: false,
|
|
783
|
+
className: "rounded-agg-md border border-agg-border bg-agg-secondary p-3 text-agg-foreground",
|
|
784
|
+
value: keyId,
|
|
785
|
+
onChange: (e) => setKeyId(e.target.value),
|
|
786
|
+
disabled: busy,
|
|
787
|
+
required: true
|
|
788
|
+
}),
|
|
789
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
790
|
+
htmlFor: `${id}-secret`,
|
|
791
|
+
className: "text-agg-sm text-agg-foreground",
|
|
792
|
+
children: copy.privateKey
|
|
793
|
+
}),
|
|
794
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
795
|
+
id: `${id}-secret`,
|
|
796
|
+
rows: 5,
|
|
797
|
+
autoComplete: "new-password",
|
|
798
|
+
spellCheck: false,
|
|
799
|
+
className: "rounded-agg-md border border-agg-border bg-agg-secondary p-3 text-agg-foreground",
|
|
800
|
+
value: privateKey,
|
|
801
|
+
onChange: (e) => setPrivateKey(e.target.value),
|
|
802
|
+
disabled: busy,
|
|
803
|
+
required: true
|
|
804
|
+
}),
|
|
805
|
+
error ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
806
|
+
role: "alert",
|
|
807
|
+
className: "text-agg-sm text-agg-error",
|
|
808
|
+
children: copy.error
|
|
809
|
+
}) : null,
|
|
810
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
811
|
+
type: "submit",
|
|
812
|
+
disabled: busy || !keyId.trim() || !privateKey.trim(),
|
|
813
|
+
children: pending ? copy.verifying : copy.verify
|
|
814
|
+
})
|
|
815
|
+
] }),
|
|
816
|
+
allowExistingConnection && onDisconnect ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
817
|
+
type: "button",
|
|
818
|
+
variant: "secondary",
|
|
819
|
+
disabled: busy,
|
|
820
|
+
onClick: async () => {
|
|
821
|
+
setDisconnecting(true);
|
|
822
|
+
setDisconnectError(false);
|
|
823
|
+
setError(false);
|
|
824
|
+
try {
|
|
825
|
+
await onDisconnect();
|
|
826
|
+
setKeyId("");
|
|
827
|
+
setPrivateKey("");
|
|
828
|
+
onOpenChange(false);
|
|
829
|
+
} catch {
|
|
830
|
+
setDisconnectError(true);
|
|
831
|
+
} finally {
|
|
832
|
+
setDisconnecting(false);
|
|
833
|
+
}
|
|
834
|
+
},
|
|
835
|
+
children: disconnecting ? copy.disconnecting : copy.disconnect
|
|
836
|
+
}) : null,
|
|
837
|
+
disconnectError ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
838
|
+
role: "alert",
|
|
839
|
+
className: "text-agg-sm text-agg-error",
|
|
840
|
+
children: copy.disconnectError
|
|
841
|
+
}) : null
|
|
842
|
+
]
|
|
843
|
+
})]
|
|
844
|
+
})
|
|
845
|
+
})
|
|
846
|
+
});
|
|
847
|
+
}
|
|
848
|
+
//#endregion
|
|
849
|
+
//#region src/pages/user-profile/components/betdex-account-transfers.tsx
|
|
850
|
+
function hostedWithdrawalRaw(value) {
|
|
851
|
+
const match = /^([0-9]{1,26})(?:\.([0-9]{1,6}))?$/.exec(value.trim());
|
|
852
|
+
if (!match) return null;
|
|
853
|
+
const raw = BigInt(match[1]) * BigInt(1e6) + BigInt((match[2] ?? "").padEnd(6, "0"));
|
|
854
|
+
return raw > BigInt(0) ? raw.toString() : null;
|
|
855
|
+
}
|
|
856
|
+
const amountText = (raw) => {
|
|
857
|
+
const value = BigInt(raw);
|
|
858
|
+
const fraction = (value % BigInt(1e6)).toString().padStart(6, "0").replace(/0+$/, "");
|
|
859
|
+
return (value / BigInt(1e6)).toString() + (fraction ? "." + fraction : "");
|
|
860
|
+
};
|
|
861
|
+
function BetdexAccountTransfers({ accountId, environment, availableRaw, canDeposit, onWalletDeposit }) {
|
|
862
|
+
const labels = (0, _agg_build_hooks.useLabels)().userProfile.hostedBetdex;
|
|
863
|
+
const transfer = (0, _agg_build_hooks.useHostedVenueTransfers)(accountId, environment);
|
|
864
|
+
const [showWithdraw, setShowWithdraw] = (0, react.useState)(false);
|
|
865
|
+
const wallet = (0, _agg_build_hooks.useDepositAddresses)({ enabled: transfer.isAvailable && environment === "production" && showWithdraw });
|
|
866
|
+
const [amount, setAmount] = (0, react.useState)("");
|
|
867
|
+
const [destination, setDestination] = (0, react.useState)("");
|
|
868
|
+
const [actionError, setActionError] = (0, react.useState)(false);
|
|
869
|
+
const raw = hostedWithdrawalRaw(amount);
|
|
870
|
+
const withinBalance = raw !== null && (availableRaw === void 0 || BigInt(raw) <= BigInt(availableRaw));
|
|
871
|
+
const validDestination = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(destination.trim());
|
|
872
|
+
const result = transfer.withdrawal.data;
|
|
873
|
+
const terminal = result?.status === "confirmed" || result?.status === "failed";
|
|
874
|
+
const run = (work) => {
|
|
875
|
+
setActionError(false);
|
|
876
|
+
work().catch(() => setActionError(true));
|
|
877
|
+
};
|
|
878
|
+
if (!transfer.isAvailable) return null;
|
|
879
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
880
|
+
className: "flex flex-col gap-3 border-t border-agg-separator pt-3",
|
|
881
|
+
children: [
|
|
882
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
883
|
+
className: "flex flex-wrap gap-2",
|
|
884
|
+
children: [
|
|
885
|
+
canDeposit && environment === "production" && onWalletDeposit ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
886
|
+
type: "button",
|
|
887
|
+
variant: "secondary",
|
|
888
|
+
size: "small",
|
|
889
|
+
disabled: transfer.deposit.isPending,
|
|
890
|
+
isLoading: transfer.deposit.isPending,
|
|
891
|
+
onClick: () => run(async () => {
|
|
892
|
+
onWalletDeposit((await transfer.deposit.mutateAsync()).result.address);
|
|
893
|
+
}),
|
|
894
|
+
children: labels.fromWallet
|
|
895
|
+
}) : null,
|
|
896
|
+
canDeposit ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
897
|
+
type: "button",
|
|
898
|
+
variant: "secondary",
|
|
899
|
+
size: "small",
|
|
900
|
+
"aria-label": labels.deposit,
|
|
901
|
+
isLoading: transfer.deposit.isPending,
|
|
902
|
+
disabled: transfer.deposit.isPending,
|
|
903
|
+
onClick: () => run(() => transfer.deposit.mutateAsync()),
|
|
904
|
+
children: labels.deposit
|
|
905
|
+
}) : null,
|
|
906
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
907
|
+
type: "button",
|
|
908
|
+
variant: "secondary",
|
|
909
|
+
size: "small",
|
|
910
|
+
"aria-expanded": showWithdraw || !!transfer.request,
|
|
911
|
+
onClick: () => setShowWithdraw((value) => !value),
|
|
912
|
+
children: labels.withdraw
|
|
913
|
+
})
|
|
914
|
+
]
|
|
915
|
+
}),
|
|
916
|
+
transfer.deposit.data ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
917
|
+
className: "flex flex-col gap-2 agg-type-caption",
|
|
918
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
919
|
+
className: "text-agg-muted-foreground",
|
|
920
|
+
children: labels.depositInstructions[environment]
|
|
921
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
922
|
+
className: "flex flex-col gap-1 text-agg-muted-foreground",
|
|
923
|
+
children: [labels.depositAddress, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
924
|
+
readOnly: true,
|
|
925
|
+
value: transfer.deposit.data.address,
|
|
926
|
+
onFocus: (event) => event.currentTarget.select(),
|
|
927
|
+
className: "w-full rounded-agg-md border border-agg-separator bg-agg-primary p-2 text-agg-foreground"
|
|
928
|
+
})]
|
|
929
|
+
})]
|
|
930
|
+
}) : null,
|
|
931
|
+
transfer.deposit.isError || transfer.withdrawal.isError || transfer.storageError || actionError ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
932
|
+
role: "alert",
|
|
933
|
+
className: "agg-type-caption text-agg-error",
|
|
934
|
+
children: labels.transferUnavailable
|
|
935
|
+
}) : null,
|
|
936
|
+
transfer.request ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
937
|
+
className: "flex flex-col gap-2 agg-type-caption",
|
|
938
|
+
children: [
|
|
939
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", { children: [
|
|
940
|
+
labels.withdrawalAmount,
|
|
941
|
+
": ",
|
|
942
|
+
amountText(transfer.request.amountRaw)
|
|
943
|
+
] }),
|
|
944
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
945
|
+
className: "break-all",
|
|
946
|
+
children: [
|
|
947
|
+
labels.withdrawalDestination,
|
|
948
|
+
": ",
|
|
949
|
+
transfer.request.destinationAddress
|
|
950
|
+
]
|
|
951
|
+
}),
|
|
952
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
953
|
+
role: "status",
|
|
954
|
+
children: result ? labels.withdrawalStatuses[result.status] : labels.withdrawalUnknown
|
|
955
|
+
}),
|
|
956
|
+
terminal ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
957
|
+
type: "button",
|
|
958
|
+
variant: "tertiary",
|
|
959
|
+
size: "small",
|
|
960
|
+
onClick: () => {
|
|
961
|
+
transfer.clear();
|
|
962
|
+
setAmount("");
|
|
963
|
+
setDestination("");
|
|
964
|
+
setActionError(false);
|
|
965
|
+
setShowWithdraw(false);
|
|
966
|
+
},
|
|
967
|
+
children: labels.withdrawalNew
|
|
968
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
969
|
+
type: "button",
|
|
970
|
+
variant: "tertiary",
|
|
971
|
+
size: "small",
|
|
972
|
+
"aria-label": result ? labels.withdrawalCheck : labels.withdrawalRetry,
|
|
973
|
+
isLoading: transfer.withdrawal.isPending,
|
|
974
|
+
disabled: transfer.withdrawal.isPending,
|
|
975
|
+
onClick: () => run(transfer.check),
|
|
976
|
+
children: result ? labels.withdrawalCheck : labels.withdrawalRetry
|
|
977
|
+
})
|
|
978
|
+
]
|
|
979
|
+
}) : showWithdraw ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
980
|
+
className: "flex flex-col gap-3",
|
|
981
|
+
onSubmit: (event) => {
|
|
982
|
+
event.preventDefault();
|
|
983
|
+
if (!raw || !withinBalance || !validDestination || !transfer.ready) return;
|
|
984
|
+
run(() => transfer.submit(raw, destination.trim()));
|
|
985
|
+
},
|
|
986
|
+
children: [
|
|
987
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
988
|
+
className: "flex flex-col gap-1 agg-type-caption text-agg-muted-foreground",
|
|
989
|
+
children: [labels.withdrawalAmount, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
990
|
+
inputMode: "decimal",
|
|
991
|
+
autoComplete: "off",
|
|
992
|
+
value: amount,
|
|
993
|
+
onChange: (event) => setAmount(event.target.value),
|
|
994
|
+
className: "rounded-agg-md border border-agg-separator bg-agg-primary p-2 text-agg-foreground"
|
|
995
|
+
})]
|
|
996
|
+
}),
|
|
997
|
+
environment === "production" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
998
|
+
type: "button",
|
|
999
|
+
variant: "secondary",
|
|
1000
|
+
size: "small",
|
|
1001
|
+
disabled: !wallet.isReady || !wallet.svmAddress || wallet.isError,
|
|
1002
|
+
isLoading: wallet.isLoading,
|
|
1003
|
+
onClick: () => {
|
|
1004
|
+
if (wallet.isReady && wallet.svmAddress && !wallet.isError) setDestination(wallet.svmAddress);
|
|
1005
|
+
},
|
|
1006
|
+
children: labels.toWallet
|
|
1007
|
+
}) : null,
|
|
1008
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
1009
|
+
className: "flex flex-col gap-1 agg-type-caption text-agg-muted-foreground",
|
|
1010
|
+
children: [labels.withdrawalDestination, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1011
|
+
autoComplete: "off",
|
|
1012
|
+
spellCheck: false,
|
|
1013
|
+
value: destination,
|
|
1014
|
+
onChange: (event) => setDestination(event.target.value),
|
|
1015
|
+
className: "rounded-agg-md border border-agg-separator bg-agg-primary p-2 text-agg-foreground"
|
|
1016
|
+
})]
|
|
1017
|
+
}),
|
|
1018
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
1019
|
+
type: "submit",
|
|
1020
|
+
variant: "primary",
|
|
1021
|
+
size: "small",
|
|
1022
|
+
"aria-label": labels.withdrawalSubmit,
|
|
1023
|
+
disabled: !withinBalance || !validDestination || !transfer.ready || transfer.withdrawal.isPending,
|
|
1024
|
+
isLoading: transfer.withdrawal.isPending,
|
|
1025
|
+
children: labels.withdrawalSubmit
|
|
1026
|
+
})
|
|
1027
|
+
]
|
|
1028
|
+
}) : null
|
|
1029
|
+
]
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
//#endregion
|
|
1033
|
+
//#region src/pages/user-profile/components/betdex-account-activity.tsx
|
|
1034
|
+
/** Preserve sub-micro ledger dust; no floating-point arithmetic or rounded zero. */
|
|
1035
|
+
function amount(raw) {
|
|
1036
|
+
const negative = raw.startsWith("-");
|
|
1037
|
+
const digits = (negative ? raw.slice(1) : raw).padStart(19, "0");
|
|
1038
|
+
const fraction = digits.slice(-18).replace(/0+$/, "");
|
|
1039
|
+
return `${negative ? "-" : "+"}${digits.slice(0, -18)}${fraction ? `.${fraction}` : ""}`;
|
|
1040
|
+
}
|
|
1041
|
+
function BetdexAccountActivity({ accountId, environment }) {
|
|
1042
|
+
const labels = (0, _agg_build_hooks.useLabels)().userProfile.hostedBetdex;
|
|
1043
|
+
const [page, setPage] = (0, react.useState)(0);
|
|
1044
|
+
const { activity, isAvailable } = (0, _agg_build_hooks.useHostedVenueActivity)("betdex", page);
|
|
1045
|
+
if (!isAvailable) return null;
|
|
1046
|
+
const data = activity.data;
|
|
1047
|
+
const valid = data?.accountId === accountId && data.environment === environment && data.page === page;
|
|
1048
|
+
const unavailable = activity.isError || !!data && !valid;
|
|
1049
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
1050
|
+
"aria-label": labels.activityTitle,
|
|
1051
|
+
className: "flex flex-col gap-3 border-t border-agg-separator pt-3",
|
|
1052
|
+
children: [
|
|
1053
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", {
|
|
1054
|
+
className: "agg-type-label text-agg-foreground",
|
|
1055
|
+
children: labels.activityTitle
|
|
1056
|
+
}),
|
|
1057
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1058
|
+
className: "agg-type-caption text-agg-muted-foreground",
|
|
1059
|
+
children: labels.activityDescription
|
|
1060
|
+
}),
|
|
1061
|
+
activity.isPending ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.SkeletonBlock, { className: "h-16 w-full" }) : null,
|
|
1062
|
+
unavailable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1063
|
+
role: "status",
|
|
1064
|
+
className: "agg-type-caption text-agg-muted-foreground",
|
|
1065
|
+
children: labels.activityUnavailable
|
|
1066
|
+
}) : null,
|
|
1067
|
+
valid && !unavailable ? data.items.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1068
|
+
className: "flex flex-col gap-3 agg-type-caption",
|
|
1069
|
+
children: data.items.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
1070
|
+
className: "flex flex-col gap-1",
|
|
1071
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1072
|
+
className: "flex justify-between gap-3 text-agg-foreground",
|
|
1073
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: labels.activityCodes[item.code] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1074
|
+
className: "break-all tabular-nums",
|
|
1075
|
+
children: [
|
|
1076
|
+
amount(item.amountRaw),
|
|
1077
|
+
" ",
|
|
1078
|
+
data.asset
|
|
1079
|
+
]
|
|
1080
|
+
})]
|
|
1081
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("time", {
|
|
1082
|
+
dateTime: item.createdAt,
|
|
1083
|
+
className: "text-agg-muted-foreground",
|
|
1084
|
+
children: new Date(item.createdAt).toLocaleString()
|
|
1085
|
+
})]
|
|
1086
|
+
}, item.id))
|
|
1087
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1088
|
+
className: "agg-type-caption text-agg-muted-foreground",
|
|
1089
|
+
children: labels.activityEmpty
|
|
1090
|
+
}) : null,
|
|
1091
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1092
|
+
className: "flex flex-wrap gap-2",
|
|
1093
|
+
children: [
|
|
1094
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
1095
|
+
type: "button",
|
|
1096
|
+
variant: "tertiary",
|
|
1097
|
+
size: "small",
|
|
1098
|
+
disabled: activity.isFetching || page === 0,
|
|
1099
|
+
onClick: () => setPage((value) => Math.max(0, value - 1)),
|
|
1100
|
+
children: labels.activityPrevious
|
|
1101
|
+
}),
|
|
1102
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
1103
|
+
type: "button",
|
|
1104
|
+
variant: "tertiary",
|
|
1105
|
+
size: "small",
|
|
1106
|
+
disabled: activity.isFetching || unavailable || !valid || data.nextPage === null,
|
|
1107
|
+
onClick: () => {
|
|
1108
|
+
if (valid && data.nextPage !== null) setPage(data.nextPage);
|
|
1109
|
+
},
|
|
1110
|
+
children: labels.activityNext
|
|
1111
|
+
}),
|
|
1112
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
1113
|
+
type: "button",
|
|
1114
|
+
variant: "tertiary",
|
|
1115
|
+
size: "small",
|
|
1116
|
+
disabled: activity.isFetching,
|
|
1117
|
+
onClick: () => {
|
|
1118
|
+
activity.refetch();
|
|
1119
|
+
},
|
|
1120
|
+
children: labels.activityRefresh
|
|
1121
|
+
})
|
|
1122
|
+
]
|
|
1123
|
+
})
|
|
1124
|
+
]
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
//#endregion
|
|
1128
|
+
//#region src/pages/user-profile/components/betdex-account-card.tsx
|
|
1129
|
+
/** Hosted venue cash must never be presented as a signing-wallet chain balance. */
|
|
1130
|
+
function BetdexAccountCard({ onWalletDeposit } = {}) {
|
|
1131
|
+
const [showActivity, setShowActivity] = (0, react.useState)(false);
|
|
1132
|
+
const labels = (0, _agg_build_hooks.useLabels)().userProfile.hostedBetdex;
|
|
1133
|
+
const { account, provision, isAvailable } = (0, _agg_build_hooks.useHostedVenueAccount)("betdex");
|
|
1134
|
+
const data = account.data;
|
|
1135
|
+
if (!isAvailable || data?.status === "disabled") return null;
|
|
1136
|
+
const pending = provision.isPending || data?.status === "provisioning";
|
|
1137
|
+
const canCreate = data?.status === "not_created" && data.provisioningEnabled;
|
|
1138
|
+
const rawLabel = (raw) => require_primitives.formatUsd(Number(raw) / 1e6);
|
|
1139
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
1140
|
+
"aria-label": labels.title,
|
|
1141
|
+
className: "flex flex-col gap-3 rounded-agg-xl border border-agg-separator bg-agg-secondary p-5",
|
|
1142
|
+
children: [
|
|
1143
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1144
|
+
className: "flex items-center gap-2",
|
|
1145
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.VenueLogo, {
|
|
1146
|
+
venue: _agg_build_sdk.Venue.betdex,
|
|
1147
|
+
size: "small",
|
|
1148
|
+
className: "size-4"
|
|
1149
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
1150
|
+
className: "agg-type-label text-agg-foreground",
|
|
1151
|
+
children: labels.title
|
|
1152
|
+
})]
|
|
1153
|
+
}),
|
|
1154
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1155
|
+
className: "agg-type-caption text-agg-muted-foreground",
|
|
1156
|
+
children: labels.description
|
|
1157
|
+
}),
|
|
1158
|
+
data?.environment === "sandbox" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1159
|
+
className: "agg-type-caption text-agg-warning",
|
|
1160
|
+
children: labels.sandbox
|
|
1161
|
+
}) : null,
|
|
1162
|
+
account.isPending ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.SkeletonBlock, { className: "h-10 w-full" }) : null,
|
|
1163
|
+
data?.status === "active" && data.balanceStatus === "available" && data.balance && !account.isError ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dl", {
|
|
1164
|
+
className: "flex flex-col gap-2 agg-type-caption",
|
|
1165
|
+
children: [
|
|
1166
|
+
[labels.total, data.balance.totalRaw],
|
|
1167
|
+
[labels.available, data.balance.availableRaw],
|
|
1168
|
+
[labels.reserved, data.balance.unmatchedExposureRaw]
|
|
1169
|
+
].map(([label, raw]) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1170
|
+
className: "flex justify-between gap-3",
|
|
1171
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", {
|
|
1172
|
+
className: "text-agg-muted-foreground",
|
|
1173
|
+
children: label
|
|
1174
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", {
|
|
1175
|
+
className: "text-agg-foreground",
|
|
1176
|
+
children: rawLabel(raw)
|
|
1177
|
+
})]
|
|
1178
|
+
}, label))
|
|
1179
|
+
}) : null,
|
|
1180
|
+
pending ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1181
|
+
role: "status",
|
|
1182
|
+
className: "agg-type-caption text-agg-muted-foreground",
|
|
1183
|
+
children: labels.provisioning
|
|
1184
|
+
}) : null,
|
|
1185
|
+
data?.status === "suspended" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1186
|
+
role: "status",
|
|
1187
|
+
className: "agg-type-caption text-agg-muted-foreground",
|
|
1188
|
+
children: labels.suspended
|
|
1189
|
+
}) : null,
|
|
1190
|
+
account.isError || data?.status === "unavailable" || data?.balanceStatus === "unavailable" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1191
|
+
role: "status",
|
|
1192
|
+
className: "agg-type-caption text-agg-muted-foreground",
|
|
1193
|
+
children: labels.unavailable
|
|
1194
|
+
}) : null,
|
|
1195
|
+
data?.status === "not_created" && !data.provisioningEnabled ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1196
|
+
className: "agg-type-caption text-agg-muted-foreground",
|
|
1197
|
+
children: labels.provisioningUnavailable
|
|
1198
|
+
}) : null,
|
|
1199
|
+
provision.isError ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1200
|
+
role: "alert",
|
|
1201
|
+
className: "agg-type-caption text-agg-error",
|
|
1202
|
+
children: labels.creationFailed
|
|
1203
|
+
}) : null,
|
|
1204
|
+
canCreate || data?.status === "provisioning" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
1205
|
+
type: "button",
|
|
1206
|
+
"aria-label": data?.status === "provisioning" ? labels.checkSetup : labels.createAccount,
|
|
1207
|
+
variant: "secondary",
|
|
1208
|
+
size: "small",
|
|
1209
|
+
isLoading: provision.isPending,
|
|
1210
|
+
disabled: provision.isPending || account.isError,
|
|
1211
|
+
onClick: () => provision.mutate(),
|
|
1212
|
+
children: data?.status === "provisioning" ? labels.checkSetup : labels.createAccount
|
|
1213
|
+
}) : null,
|
|
1214
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
1215
|
+
type: "button",
|
|
1216
|
+
variant: "tertiary",
|
|
1217
|
+
size: "small",
|
|
1218
|
+
disabled: account.isFetching || provision.isPending,
|
|
1219
|
+
onClick: () => {
|
|
1220
|
+
account.refetch();
|
|
1221
|
+
},
|
|
1222
|
+
children: labels.refresh
|
|
1223
|
+
}),
|
|
1224
|
+
data?.accountId && data.environment && ["active", "suspended"].includes(data.status) ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
1225
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", {
|
|
1226
|
+
className: "group/agg-betdex-funds border-t border-agg-separator pt-3",
|
|
1227
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("summary", {
|
|
1228
|
+
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",
|
|
1229
|
+
children: [labels.manageFunds, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Icon, {
|
|
1230
|
+
name: "chevron-down",
|
|
1231
|
+
size: "small",
|
|
1232
|
+
className: "transition-transform group-open/agg-betdex-funds:rotate-180"
|
|
1233
|
+
})]
|
|
1234
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BetdexAccountTransfers, {
|
|
1235
|
+
accountId: data.accountId,
|
|
1236
|
+
environment: data.environment,
|
|
1237
|
+
availableRaw: data.balanceStatus === "available" ? data.balance?.availableRaw : void 0,
|
|
1238
|
+
canDeposit: data.status === "active",
|
|
1239
|
+
onWalletDeposit
|
|
1240
|
+
}, `transfers:${data.accountId}:${data.environment}`)]
|
|
1241
|
+
}),
|
|
1242
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
1243
|
+
type: "button",
|
|
1244
|
+
variant: "tertiary",
|
|
1245
|
+
size: "small",
|
|
1246
|
+
"aria-expanded": showActivity,
|
|
1247
|
+
onClick: () => setShowActivity((shown) => !shown),
|
|
1248
|
+
children: showActivity ? labels.hideActivity : labels.showActivity
|
|
1249
|
+
}),
|
|
1250
|
+
showActivity ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BetdexAccountActivity, {
|
|
1251
|
+
accountId: data.accountId,
|
|
1252
|
+
environment: data.environment
|
|
1253
|
+
}, `${data.accountId}:${data.environment}`) : null
|
|
1254
|
+
] }) : null
|
|
1255
|
+
]
|
|
1256
|
+
});
|
|
1257
|
+
}
|
|
1258
|
+
//#endregion
|
|
1259
|
+
//#region src/shared/constants.ts
|
|
1260
|
+
const USDC = {
|
|
1261
|
+
value: "USDC",
|
|
1262
|
+
label: "USDC",
|
|
1263
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/usdc.svg"
|
|
1264
|
+
};
|
|
1265
|
+
const SUPPORTED_NETWORKS = [
|
|
1266
|
+
{
|
|
1267
|
+
value: "abstract",
|
|
1268
|
+
label: "Abstract",
|
|
1269
|
+
iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/Abstract.svg",
|
|
1270
|
+
tokens: [USDC]
|
|
1271
|
+
},
|
|
1272
|
+
{
|
|
1273
|
+
value: "arbitrum",
|
|
1274
|
+
label: "Arbitrum One",
|
|
1275
|
+
iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/Arbitrum.svg",
|
|
1276
|
+
tokens: [USDC]
|
|
1277
|
+
},
|
|
1278
|
+
{
|
|
1279
|
+
value: "base",
|
|
1280
|
+
label: "Base",
|
|
1281
|
+
iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/Base.svg",
|
|
1282
|
+
tokens: [USDC]
|
|
1283
|
+
},
|
|
1284
|
+
{
|
|
1285
|
+
value: "bnb",
|
|
1286
|
+
label: "BNB Chain",
|
|
1287
|
+
iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/BNB.svg",
|
|
1288
|
+
tokens: [USDC]
|
|
1289
|
+
},
|
|
1290
|
+
{
|
|
1291
|
+
value: "flow",
|
|
1292
|
+
label: "Flow",
|
|
1293
|
+
iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/Flow.svg",
|
|
1294
|
+
tokens: [USDC]
|
|
1295
|
+
},
|
|
1296
|
+
{
|
|
1297
|
+
value: "hyperliquid",
|
|
1298
|
+
label: "Hyperliquid",
|
|
1299
|
+
iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/hyperliquid.png",
|
|
1300
|
+
tokens: [USDC]
|
|
1301
|
+
},
|
|
1302
|
+
{
|
|
1303
|
+
value: "mainnet",
|
|
1304
|
+
label: "Ethereum",
|
|
1305
|
+
iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/ETH.svg",
|
|
1306
|
+
tokens: [USDC]
|
|
1307
|
+
},
|
|
1308
|
+
{
|
|
1309
|
+
value: "optimism",
|
|
1310
|
+
label: "Optimism",
|
|
1311
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/chains/optimism/colored.svg",
|
|
1312
|
+
tokens: [USDC]
|
|
1313
|
+
},
|
|
1314
|
+
{
|
|
1315
|
+
value: "polygon",
|
|
1316
|
+
label: "Polygon Mainnet",
|
|
1317
|
+
iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/Polygon.svg",
|
|
1318
|
+
tokens: [USDC]
|
|
1319
|
+
},
|
|
1320
|
+
{
|
|
1321
|
+
value: "solana",
|
|
1322
|
+
label: "Solana",
|
|
1323
|
+
iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/Solana.svg",
|
|
1324
|
+
tokens: [USDC]
|
|
1325
|
+
},
|
|
1326
|
+
{
|
|
1327
|
+
value: "zksync",
|
|
1328
|
+
label: "zkSync Era",
|
|
1329
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/chains/zksync/colored.svg",
|
|
1330
|
+
tokens: [USDC]
|
|
1331
|
+
}
|
|
1332
|
+
];
|
|
1333
|
+
/** Map local SUPPORTED_NETWORKS to Select items with iconUrl. */
|
|
1334
|
+
const mapNetworksToOptions = () => {
|
|
1335
|
+
return SUPPORTED_NETWORKS.map((n) => ({
|
|
1336
|
+
value: n.value,
|
|
1337
|
+
label: n.label,
|
|
1338
|
+
iconUrl: n.iconUrl
|
|
1339
|
+
}));
|
|
1340
|
+
};
|
|
1341
|
+
const USDC_ICON_URL = "https://assets.snagsolutions.io/public/web/icons/usdc.svg";
|
|
1342
|
+
/** Default currency options shown when the caller does not provide any. */
|
|
1343
|
+
const DEFAULT_CURRENCY_OPTIONS = [
|
|
1344
|
+
{
|
|
1345
|
+
value: "USDC",
|
|
1346
|
+
label: "USDC",
|
|
1347
|
+
iconUrl: USDC_ICON_URL
|
|
1348
|
+
},
|
|
1349
|
+
{
|
|
1350
|
+
value: "USDC.e",
|
|
1351
|
+
label: "USDC.e",
|
|
1352
|
+
iconUrl: USDC_ICON_URL
|
|
1353
|
+
},
|
|
1354
|
+
{
|
|
1355
|
+
value: "USDH",
|
|
1356
|
+
label: "USDH",
|
|
1357
|
+
iconUrl: USDC_ICON_URL
|
|
1358
|
+
},
|
|
1359
|
+
{
|
|
1360
|
+
value: "pUSD",
|
|
1361
|
+
label: "pUSD",
|
|
1362
|
+
iconUrl: USDC_ICON_URL
|
|
1363
|
+
},
|
|
1364
|
+
{
|
|
1365
|
+
value: "USDT",
|
|
1366
|
+
label: "USDT",
|
|
1367
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/usdt.svg"
|
|
1368
|
+
},
|
|
1369
|
+
{
|
|
1370
|
+
value: "USDT",
|
|
1371
|
+
label: "USDT",
|
|
1372
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/usdt.svg"
|
|
1373
|
+
},
|
|
1374
|
+
{
|
|
1375
|
+
value: "ARB",
|
|
1376
|
+
label: "ARB",
|
|
1377
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/tokens/arb.svg"
|
|
1378
|
+
},
|
|
1379
|
+
{
|
|
1380
|
+
value: "BNB",
|
|
1381
|
+
label: "BNB",
|
|
1382
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/tokens/bnb.svg"
|
|
1383
|
+
},
|
|
1384
|
+
{
|
|
1385
|
+
value: "BTC",
|
|
1386
|
+
label: "BTC",
|
|
1387
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/tokens/btc.svg"
|
|
1388
|
+
},
|
|
1389
|
+
{
|
|
1390
|
+
value: "MATIC",
|
|
1391
|
+
label: "MATIC",
|
|
1392
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/tokens/matic.svg"
|
|
1393
|
+
},
|
|
1394
|
+
{
|
|
1395
|
+
value: "ETH",
|
|
1396
|
+
label: "ETH",
|
|
1397
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/tokens/eth.svg"
|
|
1398
|
+
},
|
|
1399
|
+
{
|
|
1400
|
+
value: "SOL",
|
|
1401
|
+
label: "SOL",
|
|
1402
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/tokens/sol.svg"
|
|
1403
|
+
},
|
|
1404
|
+
{
|
|
1405
|
+
value: "OP",
|
|
1406
|
+
label: "OP",
|
|
1407
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/tokens/op.svg"
|
|
1408
|
+
}
|
|
1409
|
+
];
|
|
1410
|
+
/** Add iconUrl to token options when missing, based on DEFAULT_CURRENCY_OPTIONS. */
|
|
1411
|
+
const withTokenIcons = (options) => {
|
|
1412
|
+
const byValue = new Map(DEFAULT_CURRENCY_OPTIONS.map((o) => [o.value, o.iconUrl]));
|
|
1413
|
+
return options.map((o) => o.iconUrl ? o : {
|
|
1414
|
+
...o,
|
|
1415
|
+
iconUrl: byValue.get(o.value)
|
|
1416
|
+
});
|
|
1417
|
+
};
|
|
1418
|
+
/** Maps numeric EIP-155 chain IDs to the slug values used in SUPPORTED_NETWORKS. */
|
|
1419
|
+
const CHAIN_ID_TO_SLUG = {
|
|
1420
|
+
"1": "mainnet",
|
|
1421
|
+
"10": "optimism",
|
|
1422
|
+
"56": "bnb",
|
|
1423
|
+
"137": "polygon",
|
|
1424
|
+
"324": "zksync",
|
|
1425
|
+
"747": "flow",
|
|
1426
|
+
"1337": "hyperliquid",
|
|
1427
|
+
"8453": "base",
|
|
1428
|
+
"42161": "arbitrum",
|
|
1429
|
+
"2741": "abstract",
|
|
1430
|
+
"792703809": "solana"
|
|
1431
|
+
};
|
|
1432
|
+
/** Add iconUrl to network options when missing, resolved via chain ID or slug. */
|
|
1433
|
+
const withNetworkIcons = (options) => {
|
|
1434
|
+
const bySlug = new Map(SUPPORTED_NETWORKS.map((n) => [n.value, n.iconUrl]));
|
|
1435
|
+
return options.map((o) => {
|
|
1436
|
+
const slug = CHAIN_ID_TO_SLUG[o.value] ?? o.value;
|
|
1437
|
+
return {
|
|
1438
|
+
...o,
|
|
1439
|
+
iconUrl: o.iconUrl ?? bySlug.get(slug)
|
|
1440
|
+
};
|
|
1441
|
+
});
|
|
1442
|
+
};
|
|
1443
|
+
/** Merge two option arrays by value (preserving caller order, then filling from defaults). */
|
|
1444
|
+
const mergeSelectOptionsUnique = (base, fill) => {
|
|
1445
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1446
|
+
const out = [];
|
|
1447
|
+
for (const opt of base ?? []) if (!seen.has(opt.value)) {
|
|
1448
|
+
out.push(opt);
|
|
1449
|
+
seen.add(opt.value);
|
|
1450
|
+
}
|
|
1451
|
+
for (const opt of fill) if (!seen.has(opt.value)) {
|
|
1452
|
+
out.push(opt);
|
|
1453
|
+
seen.add(opt.value);
|
|
1454
|
+
}
|
|
1455
|
+
return out;
|
|
1456
|
+
};
|
|
1457
|
+
//#endregion
|
|
1458
|
+
//#region src/withdraw/steps/withdraw-method.tsx
|
|
1459
|
+
const WithdrawMethodStep = ({ balance, onSelectMethod }) => {
|
|
1460
|
+
const labels = (0, _agg_build_hooks.useLabels)();
|
|
1461
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Header, {
|
|
1462
|
+
title: labels.withdraw.title,
|
|
1463
|
+
hideBorder: true
|
|
1464
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Body, {
|
|
1465
|
+
classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" },
|
|
1466
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1467
|
+
className: "flex flex-col gap-5",
|
|
1468
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
1469
|
+
className: "agg-type-body text-agg-foreground",
|
|
1470
|
+
children: [
|
|
1471
|
+
labels.withdraw.balancePrefix,
|
|
1472
|
+
" ",
|
|
1473
|
+
require_primitives.formatCompactUsd(balance)
|
|
1474
|
+
]
|
|
1475
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1476
|
+
className: require_primitives.cn("flex items-center gap-3 sm:gap-4 rounded-xl border border-agg-separator bg-agg-secondary p-3 sm:p-4", "hover:bg-agg-secondary-hover transition-colors cursor-pointer"),
|
|
1477
|
+
role: "button",
|
|
1478
|
+
tabIndex: 0,
|
|
1479
|
+
onClick: () => onSelectMethod("wallet"),
|
|
1480
|
+
onKeyDown: (e) => {
|
|
1481
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1482
|
+
e.preventDefault();
|
|
1483
|
+
onSelectMethod("wallet");
|
|
1484
|
+
}
|
|
1485
|
+
},
|
|
1486
|
+
children: [
|
|
1487
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1488
|
+
className: "shrink-0 flex items-center justify-center h-10 w-10 rounded-lg bg-agg-secondary-hover",
|
|
1489
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.WalletIcon, { className: "h-6 w-6 text-agg-muted-foreground" })
|
|
1490
|
+
}),
|
|
1491
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1492
|
+
className: "flex-1 min-w-0",
|
|
1493
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1494
|
+
className: "agg-type-body-strong text-agg-foreground",
|
|
1495
|
+
children: labels.withdraw.methods.walletTitle
|
|
1496
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1497
|
+
className: "agg-type-label text-agg-muted-foreground",
|
|
1498
|
+
children: labels.withdraw.methods.walletDescription
|
|
1499
|
+
})]
|
|
1500
|
+
}),
|
|
1501
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1502
|
+
className: "shrink-0 text-agg-muted-foreground",
|
|
1503
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.ChevronRightIcon, { className: "h-5 w-5" })
|
|
1504
|
+
})
|
|
1505
|
+
]
|
|
1506
|
+
})]
|
|
1507
|
+
})
|
|
1508
|
+
})] });
|
|
1509
|
+
};
|
|
1510
|
+
//#endregion
|
|
1511
|
+
//#region src/shared/transfer-fee-summary.tsx
|
|
1512
|
+
const separator = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1513
|
+
className: "text-agg-muted-foreground",
|
|
1514
|
+
"aria-hidden": "true",
|
|
1515
|
+
children: "·"
|
|
1516
|
+
});
|
|
1517
|
+
const normalizeFeeLabel = (label) => label.replace(/\s*~\s*$/, "");
|
|
1518
|
+
const TransferFeeSummary = ({ estimate, view, minDeposit, eta }) => {
|
|
1519
|
+
const labels = (0, _agg_build_hooks.useLabels)();
|
|
1520
|
+
if (!estimate) return null;
|
|
1521
|
+
if (view === "deposit") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
1522
|
+
className: "agg-type-label flex flex-wrap items-center gap-x-2 gap-y-1 text-agg-foreground",
|
|
1523
|
+
children: [
|
|
1524
|
+
minDeposit ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
1525
|
+
labels.deposit.sendCrypto.minDepositPrefix,
|
|
1526
|
+
" ",
|
|
1527
|
+
minDeposit
|
|
1528
|
+
] }) : null,
|
|
1529
|
+
minDeposit ? separator : null,
|
|
1530
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
1531
|
+
normalizeFeeLabel(labels.deposit.walletFlow.feePrefix),
|
|
1532
|
+
": ",
|
|
1533
|
+
estimate.estimatedFees
|
|
1534
|
+
] }),
|
|
1535
|
+
eta ? separator : null,
|
|
1536
|
+
eta ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: eta }) : null
|
|
1537
|
+
]
|
|
1538
|
+
});
|
|
1539
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1540
|
+
className: "agg-type-label flex flex-wrap items-center gap-x-2 gap-y-1 text-agg-foreground",
|
|
1541
|
+
children: [
|
|
1542
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
1543
|
+
labels.withdraw.walletFlow.estimatedFees,
|
|
1544
|
+
": ",
|
|
1545
|
+
estimate.estimatedFees
|
|
1546
|
+
] }),
|
|
1547
|
+
separator,
|
|
1548
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1549
|
+
className: "inline-flex items-center gap-1",
|
|
1550
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
1551
|
+
labels.withdraw.walletFlow.networkReserve,
|
|
1552
|
+
": ",
|
|
1553
|
+
estimate.networkReserve
|
|
1554
|
+
] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Tooltip, {
|
|
1555
|
+
"aria-label": labels.withdraw.walletFlow.networkReserveTooltipAria,
|
|
1556
|
+
size: "medium",
|
|
1557
|
+
content: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1558
|
+
className: "text-center",
|
|
1559
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: labels.withdraw.walletFlow.networkReserveTooltipLineOne }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: labels.withdraw.walletFlow.networkReserveTooltipLineTwo })]
|
|
1560
|
+
}),
|
|
1561
|
+
classNames: {
|
|
1562
|
+
content: "min-w-96 max-w-none!",
|
|
1563
|
+
arrow: "[&_polygon]:fill-agg-background",
|
|
1564
|
+
icon: "text-agg-foreground! h-3! w-3!"
|
|
1565
|
+
}
|
|
1566
|
+
})]
|
|
1567
|
+
}),
|
|
1568
|
+
separator,
|
|
1569
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
1570
|
+
labels.withdraw.walletFlow.youReceive,
|
|
1571
|
+
": ",
|
|
1572
|
+
estimate.youReceive
|
|
1573
|
+
] })
|
|
1574
|
+
]
|
|
1575
|
+
});
|
|
1576
|
+
};
|
|
1577
|
+
//#endregion
|
|
1578
|
+
//#region src/withdraw/steps/withdraw-amount.tsx
|
|
1579
|
+
/** Converts a raw integer string (e.g. "1000000") to a decimal string ("1.000000"). */
|
|
1580
|
+
const formatRawTokenAmount$1 = (rawAmount, decimals) => {
|
|
1581
|
+
if (!rawAmount) return "0";
|
|
1582
|
+
const raw = BigInt(rawAmount);
|
|
1583
|
+
const divisor = BigInt(`1${"0".repeat(decimals)}`);
|
|
1584
|
+
const whole = raw / divisor;
|
|
1585
|
+
const remainder = raw % divisor;
|
|
1586
|
+
if (remainder === BigInt(0)) return whole.toString();
|
|
1587
|
+
return `${whole.toString()}.${remainder.toString().padStart(decimals, "0").replace(/0+$/, "")}`;
|
|
1588
|
+
};
|
|
1589
|
+
/** Converts a human-readable decimal string to a raw integer string, or null if invalid. */
|
|
1590
|
+
const parseTokenAmountToRaw = (amount, decimals) => {
|
|
1591
|
+
const normalizedAmount = amount.trim();
|
|
1592
|
+
if (!normalizedAmount || !/^\d*(?:\.\d*)?$/.test(normalizedAmount)) return null;
|
|
1593
|
+
const [wholePart = "0", fractionalPart = ""] = normalizedAmount.split(".");
|
|
1594
|
+
if (fractionalPart.length > decimals) return null;
|
|
1595
|
+
const normalizedWhole = wholePart === "" ? "0" : wholePart;
|
|
1596
|
+
const normalizedFraction = fractionalPart.padEnd(decimals, "0");
|
|
1597
|
+
try {
|
|
1598
|
+
return `${BigInt(normalizedWhole)}${normalizedFraction}`.replace(/^0+(?=\d)/, "");
|
|
1599
|
+
} catch {
|
|
1600
|
+
return null;
|
|
1601
|
+
}
|
|
1602
|
+
};
|
|
1603
|
+
const WithdrawAmountStep = ({ title, fixedDestination = false, amount, destinationWallet, balanceDisplay, tokenOptions, networkOptions, selectedToken, selectedNetwork, destDecimals, isConfirming = false, error, max = false, onBack, onAmountChange, onDestinationChange, onTokenChange, onNetworkChange, onMaxClick, onContinue }) => {
|
|
1604
|
+
const labels = (0, _agg_build_hooks.useLabels)();
|
|
1605
|
+
const isSolanaDest = selectedNetwork === "792703809";
|
|
1606
|
+
const trimmedDestination = destinationWallet.trim();
|
|
1607
|
+
const isValidAddress = isSolanaDest ? /^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(trimmedDestination) : /^0x[a-fA-F0-9]{40}$/.test(trimmedDestination);
|
|
1608
|
+
const isValid = Number(amount) > 0 && isValidAddress;
|
|
1609
|
+
const amountRaw = amount && Number(amount) > 0 ? parseTokenAmountToRaw(amount, destDecimals) : null;
|
|
1610
|
+
const destinationChainId = Number(selectedNetwork) || null;
|
|
1611
|
+
const preview = (0, _agg_build_hooks.useWithdrawPreview)({
|
|
1612
|
+
amountRaw,
|
|
1613
|
+
tokenSymbol: selectedToken || null,
|
|
1614
|
+
destinationChainId,
|
|
1615
|
+
destinationAddress: trimmedDestination || null,
|
|
1616
|
+
max
|
|
1617
|
+
});
|
|
1618
|
+
const previewUnviable = preview.data?.pricingStatus === "unviable";
|
|
1619
|
+
const previewUnviableMessage = previewUnviable ? preview.data?.maxDeliverableRaw != null && BigInt(preview.data.maxDeliverableRaw) > BigInt(0) ? `Amount exceeds your withdrawable balance. Max: ~${formatRawTokenAmount$1(preview.data.maxDeliverableRaw, destDecimals)} ${selectedToken}` : preview.data?.unviableReason ?? "This amount can't be withdrawn right now." : null;
|
|
1620
|
+
const previewLoading = preview.isFetching;
|
|
1621
|
+
const isDisabled = !isValid || isConfirming || previewUnviable || previewLoading;
|
|
1622
|
+
const withdrawEstimate = preview.data && preview.data.pricingStatus === "quoted" ? {
|
|
1623
|
+
estimatedFees: preview.data.feeRaw != null ? `~${formatRawTokenAmount$1(preview.data.feeRaw, destDecimals)} ${selectedToken}` : "—",
|
|
1624
|
+
networkReserve: preview.data.networkFeeRaw != null ? `~${formatRawTokenAmount$1(preview.data.networkFeeRaw, destDecimals)} ${selectedToken}` : "—",
|
|
1625
|
+
youReceive: preview.data.receiveAmountRaw != null ? `~${formatRawTokenAmount$1(preview.data.receiveAmountRaw, destDecimals)} ${selectedToken}` : "—"
|
|
1626
|
+
} : null;
|
|
1627
|
+
/**
|
|
1628
|
+
* Only show withdraw estimate if the backend returned a valid quoted preview.
|
|
1629
|
+
*/
|
|
1630
|
+
const shouldShowWithdrawEstimate = Boolean(withdrawEstimate);
|
|
1631
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Header, {
|
|
1632
|
+
title: title ?? labels.withdraw.walletFlow.title,
|
|
1633
|
+
hideBorder: true,
|
|
1634
|
+
leftElement: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1635
|
+
type: "button",
|
|
1636
|
+
className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
|
|
1637
|
+
onClick: onBack,
|
|
1638
|
+
"aria-label": labels.withdraw.back,
|
|
1639
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.ChevronLeftIcon, { className: "h-6 w-6" })
|
|
1640
|
+
})
|
|
1641
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Body, {
|
|
1642
|
+
classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" },
|
|
1643
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1644
|
+
className: "flex flex-col gap-5",
|
|
1645
|
+
children: [
|
|
1646
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1647
|
+
className: "flex flex-col gap-5",
|
|
1648
|
+
children: [
|
|
1649
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1650
|
+
className: "flex flex-col gap-2",
|
|
1651
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1652
|
+
className: "agg-type-label-strong text-agg-foreground",
|
|
1653
|
+
children: labels.withdraw.walletFlow.recipientAddressLabel
|
|
1654
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1655
|
+
type: "text",
|
|
1656
|
+
"aria-label": labels.withdraw.walletFlow.recipientAddressLabel,
|
|
1657
|
+
className: require_primitives.cn("agg-type-body w-full h-10 rounded border border-agg-separator bg-agg-secondary px-3 outline-none", "text-agg-foreground placeholder:text-agg-muted-foreground", "focus:border-agg-primary transition-colors"),
|
|
1658
|
+
placeholder: isSolanaDest ? "FwR3..." : "0x971d...",
|
|
1659
|
+
value: destinationWallet,
|
|
1660
|
+
readOnly: fixedDestination,
|
|
1661
|
+
onChange: (e) => onDestinationChange(e.target.value)
|
|
1662
|
+
})]
|
|
1663
|
+
}),
|
|
1664
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1665
|
+
className: "flex flex-col gap-2",
|
|
1666
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1667
|
+
className: "flex items-center justify-between",
|
|
1668
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1669
|
+
className: "agg-type-label-strong text-agg-foreground",
|
|
1670
|
+
children: labels.withdraw.walletFlow.amountLabel
|
|
1671
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
1672
|
+
className: "agg-type-label text-agg-muted-foreground",
|
|
1673
|
+
children: [
|
|
1674
|
+
labels.withdraw.balancePrefix,
|
|
1675
|
+
" ",
|
|
1676
|
+
balanceDisplay
|
|
1677
|
+
]
|
|
1678
|
+
})]
|
|
1679
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1680
|
+
className: "flex h-10 items-center gap-2 rounded border border-agg-separator bg-agg-secondary px-3 focus-within:border-agg-primary transition-colors",
|
|
1681
|
+
children: [
|
|
1682
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1683
|
+
type: "text",
|
|
1684
|
+
inputMode: "decimal",
|
|
1685
|
+
"aria-label": labels.withdraw.walletFlow.amountLabel,
|
|
1686
|
+
className: require_primitives.cn("agg-type-body flex-1 min-w-0 bg-transparent outline-none", Number(amount) > 0 ? "text-agg-foreground" : "text-agg-muted-foreground"),
|
|
1687
|
+
placeholder: "0.00",
|
|
1688
|
+
value: amount,
|
|
1689
|
+
onChange: (e) => onAmountChange(e.target.value)
|
|
1690
|
+
}),
|
|
1691
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1692
|
+
className: "agg-type-body text-agg-muted-foreground shrink-0",
|
|
1693
|
+
children: selectedToken
|
|
1694
|
+
}),
|
|
1695
|
+
onMaxClick ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1696
|
+
type: "button",
|
|
1697
|
+
className: "agg-type-label-strong text-agg-primary hover:opacity-80 transition-opacity cursor-pointer shrink-0",
|
|
1698
|
+
onClick: onMaxClick,
|
|
1699
|
+
children: labels.withdraw.walletFlow.max
|
|
1700
|
+
}) : null
|
|
1701
|
+
]
|
|
1702
|
+
})]
|
|
1703
|
+
}),
|
|
1704
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1705
|
+
className: "flex flex-col gap-3 sm:flex-row sm:gap-5",
|
|
1706
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1707
|
+
className: "flex-1 flex flex-col gap-2 min-w-0",
|
|
1708
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1709
|
+
className: "agg-type-label-strong text-agg-foreground",
|
|
1710
|
+
children: labels.withdraw.walletFlow.tokenLabel
|
|
1711
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Select, {
|
|
1712
|
+
items: tokenOptions,
|
|
1713
|
+
disabled: fixedDestination,
|
|
1714
|
+
value: selectedToken,
|
|
1715
|
+
onChange: onTokenChange,
|
|
1716
|
+
ariaLabel: labels.withdraw.walletFlow.tokenLabel
|
|
1717
|
+
})]
|
|
1718
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1719
|
+
className: "flex-1 flex flex-col gap-2 min-w-0",
|
|
1720
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1721
|
+
className: "agg-type-label-strong text-agg-foreground",
|
|
1722
|
+
children: labels.withdraw.walletFlow.networkLabel
|
|
1723
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Select, {
|
|
1724
|
+
items: networkOptions,
|
|
1725
|
+
disabled: fixedDestination,
|
|
1726
|
+
value: selectedNetwork,
|
|
1727
|
+
onChange: onNetworkChange,
|
|
1728
|
+
ariaLabel: labels.withdraw.walletFlow.networkLabel
|
|
1729
|
+
})]
|
|
1730
|
+
})]
|
|
1731
|
+
}),
|
|
1732
|
+
shouldShowWithdrawEstimate && withdrawEstimate ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TransferFeeSummary, {
|
|
1733
|
+
estimate: withdrawEstimate,
|
|
1734
|
+
view: "withdraw"
|
|
1735
|
+
}) : null,
|
|
1736
|
+
previewUnviableMessage ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1737
|
+
className: "agg-type-label text-agg-error",
|
|
1738
|
+
role: "alert",
|
|
1739
|
+
children: previewUnviableMessage
|
|
1740
|
+
}) : null
|
|
1741
|
+
]
|
|
1742
|
+
}),
|
|
1743
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
1744
|
+
variant: isValid && !isConfirming && !previewUnviable && !previewLoading ? "primary" : "secondary",
|
|
1745
|
+
size: "large",
|
|
1746
|
+
className: "w-full",
|
|
1747
|
+
disabled: isDisabled,
|
|
1748
|
+
prefix: previewLoading && !isConfirming ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.LoadingIcon, {
|
|
1749
|
+
size: "small",
|
|
1750
|
+
className: "mr-2 text-current"
|
|
1751
|
+
}) : void 0,
|
|
1752
|
+
onClick: onContinue,
|
|
1753
|
+
children: isConfirming ? labels.common.loading : previewLoading ? labels.withdraw.walletFlow.calculatingFees : labels.withdraw.walletFlow.confirm
|
|
1754
|
+
}),
|
|
1755
|
+
error ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1756
|
+
className: "agg-type-label text-agg-error text-center",
|
|
1757
|
+
role: "alert",
|
|
1758
|
+
children: error
|
|
1759
|
+
}) : null
|
|
1760
|
+
]
|
|
1761
|
+
})
|
|
1762
|
+
})] });
|
|
1763
|
+
};
|
|
1764
|
+
//#endregion
|
|
1765
|
+
//#region src/withdraw/steps/withdraw-success.tsx
|
|
1766
|
+
const SummaryRow = ({ label, value }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1767
|
+
className: "flex items-center justify-between gap-4 border-b border-agg-separator py-2 last:border-b-0",
|
|
1768
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1769
|
+
className: "min-w-0 text-[12px] leading-4 font-agg-bold uppercase text-agg-muted-foreground",
|
|
1770
|
+
children: label
|
|
1771
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1772
|
+
className: "min-w-0 text-right text-[14px] leading-5 text-agg-foreground",
|
|
1773
|
+
children: value
|
|
1774
|
+
})]
|
|
1775
|
+
});
|
|
1776
|
+
const WithdrawCloseButton = ({ onClose, label }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1777
|
+
type: "button",
|
|
1778
|
+
className: "absolute right-8 top-7 flex cursor-pointer items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
|
|
1779
|
+
onClick: onClose,
|
|
1780
|
+
"aria-label": label,
|
|
1781
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.CloseIcon, { className: "h-6 w-6" })
|
|
1782
|
+
});
|
|
1783
|
+
const LoadingGlyph = ({ className, enableAnimations }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1784
|
+
"aria-hidden": "true",
|
|
1785
|
+
className: require_primitives.cn("inline-block rounded-full border-2 border-current border-r-transparent", require_primitives.getMotionClassName(enableAnimations, "animate-spin"), className)
|
|
1786
|
+
});
|
|
1787
|
+
const loadingActiveIndexFor = (state) => {
|
|
1788
|
+
if (state.status === "transferring") return 2;
|
|
1789
|
+
if (state.status === "bridging") return 1;
|
|
1790
|
+
return 0;
|
|
1791
|
+
};
|
|
1792
|
+
const getLoadingSteps = (labels) => [
|
|
1793
|
+
{
|
|
1794
|
+
id: "preparing",
|
|
1795
|
+
label: labels.lifecycle.loadingSteps.preparing
|
|
1796
|
+
},
|
|
1797
|
+
{
|
|
1798
|
+
id: "bridging",
|
|
1799
|
+
label: labels.lifecycle.loadingSteps.bridging
|
|
1800
|
+
},
|
|
1801
|
+
{
|
|
1802
|
+
id: "sending",
|
|
1803
|
+
label: labels.lifecycle.loadingSteps.sending
|
|
1804
|
+
},
|
|
1805
|
+
{
|
|
1806
|
+
id: "confirming",
|
|
1807
|
+
label: labels.lifecycle.loadingSteps.confirming
|
|
1808
|
+
}
|
|
1809
|
+
];
|
|
1810
|
+
const WithdrawLoadingStep = ({ lifecycleState, onClose }) => {
|
|
1811
|
+
const labels = (0, _agg_build_hooks.useLabels)();
|
|
1812
|
+
const { features: { enableAnimations } } = (0, _agg_build_hooks.useSdkUiConfig)();
|
|
1813
|
+
const walletFlowLabels = labels.withdraw.walletFlow;
|
|
1814
|
+
const activeIndex = loadingActiveIndexFor(lifecycleState);
|
|
1815
|
+
const loadingSteps = getLoadingSteps(walletFlowLabels);
|
|
1816
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1817
|
+
className: "relative",
|
|
1818
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Body, {
|
|
1819
|
+
classNames: { root: "px-8 py-7" },
|
|
1820
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1821
|
+
className: "flex flex-col gap-7",
|
|
1822
|
+
children: [
|
|
1823
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1824
|
+
className: "flex items-center justify-between gap-4",
|
|
1825
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
1826
|
+
className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground",
|
|
1827
|
+
children: walletFlowLabels.successTitle
|
|
1828
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1829
|
+
type: "button",
|
|
1830
|
+
className: "flex cursor-pointer items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
|
|
1831
|
+
onClick: onClose,
|
|
1832
|
+
"aria-label": labels.common.close,
|
|
1833
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.CloseIcon, { className: "h-6 w-6" })
|
|
1834
|
+
})]
|
|
1835
|
+
}),
|
|
1836
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1837
|
+
className: "flex flex-col gap-5",
|
|
1838
|
+
role: "status",
|
|
1839
|
+
"aria-live": "polite",
|
|
1840
|
+
children: loadingSteps.map((step, index) => {
|
|
1841
|
+
const isComplete = index < activeIndex;
|
|
1842
|
+
const isActive = index === activeIndex;
|
|
1843
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1844
|
+
className: "flex items-center gap-3",
|
|
1845
|
+
children: [
|
|
1846
|
+
isComplete ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Icon, {
|
|
1847
|
+
name: "check-circle",
|
|
1848
|
+
size: "small",
|
|
1849
|
+
className: "h-4 w-4 shrink-0 text-agg-primary",
|
|
1850
|
+
"aria-hidden": "true"
|
|
1851
|
+
}) : null,
|
|
1852
|
+
isActive ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LoadingGlyph, {
|
|
1853
|
+
enableAnimations,
|
|
1854
|
+
className: "h-4 w-4 shrink-0 text-agg-primary"
|
|
1855
|
+
}) : null,
|
|
1856
|
+
!isComplete && !isActive ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1857
|
+
"aria-hidden": "true",
|
|
1858
|
+
className: "h-4 w-4 shrink-0 rounded-full border border-agg-separator"
|
|
1859
|
+
}) : null,
|
|
1860
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1861
|
+
className: require_primitives.cn("min-w-0 flex-1 text-agg-base leading-agg-6", isActive || isComplete ? "text-agg-foreground" : "text-agg-muted-foreground"),
|
|
1862
|
+
children: step.label
|
|
1863
|
+
})
|
|
1864
|
+
]
|
|
1865
|
+
}, step.id);
|
|
1866
|
+
})
|
|
1867
|
+
}),
|
|
1868
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1869
|
+
className: "text-agg-sm leading-agg-5 text-agg-foreground",
|
|
1870
|
+
children: walletFlowLabels.loadingDescription
|
|
1871
|
+
})
|
|
1872
|
+
]
|
|
1873
|
+
})
|
|
1874
|
+
})
|
|
1875
|
+
});
|
|
1876
|
+
};
|
|
1877
|
+
const resultCopyFor = ({ status, tokenSymbol, labels }) => {
|
|
1878
|
+
if (status === "failed") return {
|
|
1879
|
+
title: labels.successTitleFailed,
|
|
1880
|
+
description: labels.successDescriptionFailed(tokenSymbol)
|
|
1881
|
+
};
|
|
1882
|
+
if (status === "partial_success") return {
|
|
1883
|
+
title: labels.successTitlePartial,
|
|
1884
|
+
description: labels.successDescriptionPartial(tokenSymbol)
|
|
1885
|
+
};
|
|
1886
|
+
return {
|
|
1887
|
+
title: labels.successTitleCompleted,
|
|
1888
|
+
description: labels.successDescriptionCompleted(tokenSymbol)
|
|
1889
|
+
};
|
|
1890
|
+
};
|
|
1891
|
+
const WithdrawSuccessStep = ({ summary, tokenSymbol, requestedWithdrawal, resultStatus, errorMessage, onDone, onRetry, onClose }) => {
|
|
1892
|
+
const labels = (0, _agg_build_hooks.useLabels)();
|
|
1893
|
+
const walletFlowLabels = labels.withdraw.walletFlow;
|
|
1894
|
+
const { title, description } = resultCopyFor({
|
|
1895
|
+
status: resultStatus,
|
|
1896
|
+
tokenSymbol,
|
|
1897
|
+
labels: walletFlowLabels
|
|
1898
|
+
});
|
|
1899
|
+
const isFailed = resultStatus === "failed";
|
|
1900
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1901
|
+
className: "relative",
|
|
1902
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_primitives.Modal.Body, {
|
|
1903
|
+
classNames: { root: "px-10 py-12" },
|
|
1904
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(WithdrawCloseButton, {
|
|
1905
|
+
onClose,
|
|
1906
|
+
label: labels.common.close
|
|
1907
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1908
|
+
className: "flex flex-col items-center justify-center gap-8 text-center",
|
|
1909
|
+
children: [
|
|
1910
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1911
|
+
className: require_primitives.cn("flex h-[60px] w-[60px] items-center justify-center rounded-full", isFailed ? "bg-agg-error/15" : "bg-agg-success/15"),
|
|
1912
|
+
"aria-hidden": "true",
|
|
1913
|
+
children: isFailed ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.CloseIcon, { className: "h-6 w-6 text-agg-error" }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.SuccessCheckIcon, { className: "h-6 w-6 text-agg-success" })
|
|
1914
|
+
}),
|
|
1915
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1916
|
+
className: "flex w-full flex-col items-center gap-3 text-center text-agg-foreground",
|
|
1917
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
1918
|
+
className: "text-agg-2xl leading-agg-8 font-agg-bold",
|
|
1919
|
+
children: title
|
|
1920
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1921
|
+
className: "max-w-[400px] text-agg-base leading-agg-6",
|
|
1922
|
+
"data-withdraw-result-status": resultStatus,
|
|
1923
|
+
children: errorMessage && isFailed ? errorMessage : description
|
|
1924
|
+
})]
|
|
1925
|
+
}),
|
|
1926
|
+
!isFailed ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1927
|
+
className: "flex w-full max-w-[400px] flex-col rounded-agg-lg border border-agg-separator bg-agg-secondary px-3 py-1 text-left",
|
|
1928
|
+
children: [
|
|
1929
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SummaryRow, {
|
|
1930
|
+
label: walletFlowLabels.summary.requestedWithdrawal,
|
|
1931
|
+
value: requestedWithdrawal
|
|
1932
|
+
}),
|
|
1933
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SummaryRow, {
|
|
1934
|
+
label: walletFlowLabels.summary.amountReceived,
|
|
1935
|
+
value: summary.amountReceived
|
|
1936
|
+
}),
|
|
1937
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SummaryRow, {
|
|
1938
|
+
label: walletFlowLabels.summary.fees,
|
|
1939
|
+
value: summary.fees
|
|
1940
|
+
}),
|
|
1941
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SummaryRow, {
|
|
1942
|
+
label: walletFlowLabels.summary.network,
|
|
1943
|
+
value: summary.network
|
|
1944
|
+
}),
|
|
1945
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SummaryRow, {
|
|
1946
|
+
label: walletFlowLabels.summary.toWallet,
|
|
1947
|
+
value: summary.toWallet
|
|
1948
|
+
})
|
|
1949
|
+
]
|
|
1950
|
+
}) : null,
|
|
1951
|
+
isFailed ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1952
|
+
className: "flex items-center justify-center gap-3",
|
|
1953
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
1954
|
+
variant: "secondary",
|
|
1955
|
+
size: "large",
|
|
1956
|
+
className: "w-[120px]",
|
|
1957
|
+
onClick: onClose,
|
|
1958
|
+
children: walletFlowLabels.close
|
|
1959
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
1960
|
+
variant: "primary",
|
|
1961
|
+
size: "large",
|
|
1962
|
+
className: "w-[123px]",
|
|
1963
|
+
onClick: onRetry,
|
|
1964
|
+
children: walletFlowLabels.retry
|
|
1965
|
+
})]
|
|
1966
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
|
|
1967
|
+
variant: "secondary",
|
|
1968
|
+
size: "large",
|
|
1969
|
+
className: "w-[120px]",
|
|
1970
|
+
onClick: onDone,
|
|
1971
|
+
children: labels.withdraw.done
|
|
1972
|
+
})
|
|
1973
|
+
]
|
|
1974
|
+
})]
|
|
1975
|
+
})
|
|
1976
|
+
});
|
|
1977
|
+
};
|
|
1978
|
+
//#endregion
|
|
1979
|
+
//#region src/withdraw/index.tsx
|
|
1980
|
+
const DEFAULT_TOKEN_DECIMALS = 6;
|
|
1981
|
+
const TOKEN_DECIMALS_BY_SYMBOL = {
|
|
1982
|
+
BNB: 18,
|
|
1983
|
+
ETH: 18,
|
|
1984
|
+
MATIC: 18,
|
|
1985
|
+
POL: 18,
|
|
1986
|
+
WETH: 18,
|
|
1987
|
+
USDC: 6,
|
|
1988
|
+
USDT: 6
|
|
1989
|
+
};
|
|
1990
|
+
const TOKEN_DECIMALS_BY_CHAIN_AND_SYMBOL = { "56": {
|
|
1991
|
+
USDC: 18,
|
|
1992
|
+
USDT: 18
|
|
1993
|
+
} };
|
|
1994
|
+
const getTokenDecimals = (tokenSymbol, chainId) => {
|
|
1995
|
+
const normalizedSymbol = tokenSymbol.trim().toUpperCase();
|
|
1996
|
+
const normalizedChainId = chainId?.trim();
|
|
1997
|
+
if (normalizedChainId) {
|
|
1998
|
+
const chainTokenDecimals = TOKEN_DECIMALS_BY_CHAIN_AND_SYMBOL[normalizedChainId]?.[normalizedSymbol];
|
|
1999
|
+
if (chainTokenDecimals != null) return chainTokenDecimals;
|
|
2000
|
+
}
|
|
2001
|
+
return TOKEN_DECIMALS_BY_SYMBOL[normalizedSymbol] ?? DEFAULT_TOKEN_DECIMALS;
|
|
2002
|
+
};
|
|
2003
|
+
const formatRawTokenAmount = (rawAmount, decimals) => {
|
|
2004
|
+
const raw = BigInt(rawAmount);
|
|
2005
|
+
const divisor = BigInt(`1${"0".repeat(decimals)}`);
|
|
2006
|
+
const whole = raw / divisor;
|
|
2007
|
+
const remainder = raw % divisor;
|
|
2008
|
+
if (remainder === BigInt(0)) return whole.toString();
|
|
2009
|
+
return `${whole.toString()}.${remainder.toString().padStart(decimals, "0").replace(/0+$/, "")}`;
|
|
2010
|
+
};
|
|
2011
|
+
const formatLifecycleTokenAmount = ({ rawAmount, tokenSymbol, chainId }) => `${formatRawTokenAmount(rawAmount, getTokenDecimals(tokenSymbol, chainId))} ${tokenSymbol}`;
|
|
2012
|
+
const buildTerminalSummary = ({ fallbackSummary, lifecycleCompletedAmountRaw, lifecycleRequestedAmountRaw, lifecycleFeeRaw, tokenSymbol, chainId }) => {
|
|
2013
|
+
if (!lifecycleCompletedAmountRaw) return fallbackSummary;
|
|
2014
|
+
const amountReceived = formatLifecycleTokenAmount({
|
|
2015
|
+
rawAmount: lifecycleCompletedAmountRaw,
|
|
2016
|
+
tokenSymbol,
|
|
2017
|
+
chainId
|
|
2018
|
+
});
|
|
2019
|
+
let feeRaw = lifecycleFeeRaw;
|
|
2020
|
+
if (feeRaw == null && lifecycleRequestedAmountRaw) try {
|
|
2021
|
+
const r = BigInt(lifecycleRequestedAmountRaw);
|
|
2022
|
+
const c = BigInt(lifecycleCompletedAmountRaw);
|
|
2023
|
+
feeRaw = (r > c ? r - c : BigInt(0)).toString();
|
|
2024
|
+
} catch {
|
|
2025
|
+
feeRaw = null;
|
|
2026
|
+
}
|
|
2027
|
+
return {
|
|
2028
|
+
...fallbackSummary,
|
|
2029
|
+
amountReceived,
|
|
2030
|
+
...feeRaw != null ? { fees: formatLifecycleTokenAmount({
|
|
2031
|
+
rawAmount: feeRaw,
|
|
2032
|
+
tokenSymbol,
|
|
2033
|
+
chainId
|
|
2034
|
+
}) } : {}
|
|
2035
|
+
};
|
|
2036
|
+
};
|
|
2037
|
+
function isControlledWithdrawModalProps(props) {
|
|
2038
|
+
return "withdrawFlow" in props;
|
|
2039
|
+
}
|
|
2040
|
+
function WithdrawModalSelfDriven({ open, onOpenChange }) {
|
|
2041
|
+
const withdrawProps = (0, _agg_build_hooks_withdraw.useWithdrawFlow)({
|
|
2042
|
+
open,
|
|
2043
|
+
onOpenChange
|
|
2044
|
+
});
|
|
2045
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WithdrawModalControlled, { ...withdrawProps });
|
|
2046
|
+
}
|
|
2047
|
+
function WithdrawModalControlled({ open, onOpenChange, withdrawFlow, transferTarget, onWithdrawDestinationChange, onWithdrawAmountChange, onWithdrawTokenChange, onWithdrawNetworkChange, onMaxClick, onSelectWithdrawProvider, onDoneWithdraw }) {
|
|
2048
|
+
const initialFormStep = transferTarget ? "withdraw-amount" : "method";
|
|
2049
|
+
const [flowState, setFlowState] = (0, react.useState)({
|
|
2050
|
+
status: "form",
|
|
2051
|
+
formStep: initialFormStep
|
|
2052
|
+
});
|
|
2053
|
+
const [isConfirming, setIsConfirming] = (0, react.useState)(false);
|
|
2054
|
+
const [confirmError, setConfirmError] = (0, react.useState)(null);
|
|
2055
|
+
const { state: withdrawalLifecycleState, reset: resetWithdrawalLifecycle } = (0, _agg_build_hooks_withdraw.useWithdrawalLifecycle)(withdrawFlow.withdrawalId);
|
|
2056
|
+
(0, react.useEffect)(() => {
|
|
2057
|
+
if (!open) {
|
|
2058
|
+
setFlowState({
|
|
2059
|
+
status: "form",
|
|
2060
|
+
formStep: initialFormStep
|
|
2061
|
+
});
|
|
2062
|
+
setIsConfirming(false);
|
|
2063
|
+
setConfirmError(null);
|
|
2064
|
+
resetWithdrawalLifecycle();
|
|
2065
|
+
}
|
|
2066
|
+
}, [
|
|
2067
|
+
open,
|
|
2068
|
+
resetWithdrawalLifecycle,
|
|
2069
|
+
initialFormStep
|
|
2070
|
+
]);
|
|
2071
|
+
(0, react.useEffect)(() => {
|
|
2072
|
+
if (flowState.status !== "loading") return;
|
|
2073
|
+
if (!withdrawalLifecycleState.terminal) return;
|
|
2074
|
+
if (withdrawalLifecycleState.status === "completed") {
|
|
2075
|
+
setFlowState({ status: "success" });
|
|
2076
|
+
return;
|
|
2077
|
+
}
|
|
2078
|
+
if (withdrawalLifecycleState.status === "partial") {
|
|
2079
|
+
setFlowState({ status: "partial_success" });
|
|
2080
|
+
return;
|
|
2081
|
+
}
|
|
2082
|
+
if (withdrawalLifecycleState.status === "failed") setFlowState({
|
|
2083
|
+
status: "failed",
|
|
2084
|
+
errorMessage: withdrawalLifecycleState.errorMessage
|
|
2085
|
+
});
|
|
2086
|
+
}, [
|
|
2087
|
+
flowState.status,
|
|
2088
|
+
withdrawalLifecycleState.errorMessage,
|
|
2089
|
+
withdrawalLifecycleState.status,
|
|
2090
|
+
withdrawalLifecycleState.terminal
|
|
2091
|
+
]);
|
|
2092
|
+
const handleOpenChange = (isOpen) => {
|
|
2093
|
+
if (!isOpen) {
|
|
2094
|
+
setFlowState({
|
|
2095
|
+
status: "form",
|
|
2096
|
+
formStep: initialFormStep
|
|
2097
|
+
});
|
|
2098
|
+
setIsConfirming(false);
|
|
2099
|
+
setConfirmError(null);
|
|
2100
|
+
resetWithdrawalLifecycle();
|
|
2101
|
+
}
|
|
2102
|
+
onOpenChange(isOpen);
|
|
2103
|
+
};
|
|
2104
|
+
const handleBack = () => {
|
|
2105
|
+
if (transferTarget) {
|
|
2106
|
+
handleOpenChange(false);
|
|
2107
|
+
return;
|
|
2108
|
+
}
|
|
2109
|
+
setConfirmError(null);
|
|
2110
|
+
setFlowState({
|
|
2111
|
+
status: "form",
|
|
2112
|
+
formStep: initialFormStep
|
|
2113
|
+
});
|
|
2114
|
+
};
|
|
2115
|
+
const handleRetry = () => {
|
|
2116
|
+
setConfirmError(null);
|
|
2117
|
+
setIsConfirming(false);
|
|
2118
|
+
resetWithdrawalLifecycle();
|
|
2119
|
+
setFlowState({
|
|
2120
|
+
status: "form",
|
|
2121
|
+
formStep: "withdraw-amount"
|
|
2122
|
+
});
|
|
2123
|
+
};
|
|
2124
|
+
const handleConfirm = async () => {
|
|
2125
|
+
if (isConfirming || transferTarget && (withdrawFlow.destinationWallet !== transferTarget.address || withdrawFlow.selectedNetwork !== transferTarget.chainId || withdrawFlow.selectedToken !== transferTarget.tokenSymbol)) return;
|
|
2126
|
+
setFlowState({ status: "loading" });
|
|
2127
|
+
setIsConfirming(true);
|
|
2128
|
+
setConfirmError(null);
|
|
2129
|
+
try {
|
|
2130
|
+
await onSelectWithdrawProvider("wallet");
|
|
2131
|
+
} catch (err) {
|
|
2132
|
+
const errorMessage = err instanceof Error ? err.message : "Withdrawal failed. Please try again.";
|
|
2133
|
+
setConfirmError(errorMessage);
|
|
2134
|
+
setFlowState({
|
|
2135
|
+
status: "failed",
|
|
2136
|
+
errorMessage
|
|
2137
|
+
});
|
|
2138
|
+
} finally {
|
|
2139
|
+
setIsConfirming(false);
|
|
2140
|
+
}
|
|
2141
|
+
};
|
|
2142
|
+
const withdrawTokenOptions = withTokenIcons(withdrawFlow.tokenOptions);
|
|
2143
|
+
const withdrawNetworkOptions = withNetworkIcons(withdrawFlow.networkOptions);
|
|
2144
|
+
const requestedWithdrawal = `${withdrawFlow.amount} ${withdrawFlow.selectedToken}`.trim();
|
|
2145
|
+
const modalMaxWidth = flowState.status === "form" && flowState.formStep === "method" ? "600px" : "480px";
|
|
2146
|
+
const resultStatus = flowState.status;
|
|
2147
|
+
const terminalSummary = buildTerminalSummary({
|
|
2148
|
+
fallbackSummary: withdrawFlow.purchaseSummary,
|
|
2149
|
+
lifecycleCompletedAmountRaw: withdrawalLifecycleState.completedAmountRaw,
|
|
2150
|
+
lifecycleRequestedAmountRaw: withdrawalLifecycleState.requestedAmountRaw,
|
|
2151
|
+
lifecycleFeeRaw: withdrawalLifecycleState.feeRaw,
|
|
2152
|
+
tokenSymbol: withdrawFlow.selectedToken,
|
|
2153
|
+
chainId: withdrawFlow.selectedNetwork
|
|
2154
|
+
});
|
|
2155
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal, {
|
|
2156
|
+
open,
|
|
2157
|
+
onOpenChange: handleOpenChange,
|
|
2158
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_primitives.Modal.Container, {
|
|
2159
|
+
maxWidth: modalMaxWidth,
|
|
2160
|
+
"aria-label": transferTarget?.title ?? "Withdraw",
|
|
2161
|
+
children: [
|
|
2162
|
+
flowState.status === "form" && flowState.formStep === "method" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WithdrawMethodStep, {
|
|
2163
|
+
balance: withdrawFlow.balance,
|
|
2164
|
+
onSelectMethod: () => setFlowState({
|
|
2165
|
+
status: "form",
|
|
2166
|
+
formStep: "withdraw-amount"
|
|
2167
|
+
})
|
|
2168
|
+
}) : null,
|
|
2169
|
+
flowState.status === "form" && flowState.formStep === "withdraw-amount" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WithdrawAmountStep, {
|
|
2170
|
+
title: transferTarget?.title,
|
|
2171
|
+
fixedDestination: !!transferTarget,
|
|
2172
|
+
amount: withdrawFlow.amount,
|
|
2173
|
+
destinationWallet: withdrawFlow.destinationWallet,
|
|
2174
|
+
balanceDisplay: withdrawFlow.balanceDisplay,
|
|
2175
|
+
tokenOptions: withdrawTokenOptions,
|
|
2176
|
+
networkOptions: withdrawNetworkOptions,
|
|
2177
|
+
selectedToken: withdrawFlow.selectedToken,
|
|
2178
|
+
selectedNetwork: withdrawFlow.selectedNetwork,
|
|
2179
|
+
destDecimals: getTokenDecimals(withdrawFlow.selectedToken, withdrawFlow.selectedNetwork),
|
|
2180
|
+
isConfirming,
|
|
2181
|
+
error: confirmError,
|
|
2182
|
+
max: withdrawFlow.isMax,
|
|
2183
|
+
onBack: handleBack,
|
|
2184
|
+
onAmountChange: onWithdrawAmountChange,
|
|
2185
|
+
onDestinationChange: onWithdrawDestinationChange,
|
|
2186
|
+
onTokenChange: onWithdrawTokenChange,
|
|
2187
|
+
onNetworkChange: onWithdrawNetworkChange,
|
|
2188
|
+
onMaxClick,
|
|
2189
|
+
onContinue: handleConfirm
|
|
2190
|
+
}) : null,
|
|
2191
|
+
flowState.status === "loading" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WithdrawLoadingStep, {
|
|
2192
|
+
lifecycleState: withdrawalLifecycleState,
|
|
2193
|
+
onClose: () => handleOpenChange(false)
|
|
2194
|
+
}) : null,
|
|
2195
|
+
flowState.status === "success" || flowState.status === "partial_success" || flowState.status === "failed" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WithdrawSuccessStep, {
|
|
2196
|
+
summary: terminalSummary,
|
|
2197
|
+
tokenSymbol: withdrawFlow.selectedToken,
|
|
2198
|
+
requestedWithdrawal,
|
|
2199
|
+
resultStatus,
|
|
2200
|
+
errorMessage: flowState.status === "failed" ? flowState.errorMessage : null,
|
|
2201
|
+
onDone: onDoneWithdraw,
|
|
2202
|
+
onRetry: handleRetry,
|
|
2203
|
+
onClose: () => handleOpenChange(false)
|
|
2204
|
+
}) : null
|
|
2205
|
+
]
|
|
2206
|
+
})
|
|
2207
|
+
});
|
|
2208
|
+
}
|
|
2209
|
+
const WithdrawModal = (props) => {
|
|
2210
|
+
if (isControlledWithdrawModalProps(props)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WithdrawModalControlled, { ...props });
|
|
2211
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WithdrawModalSelfDriven, { ...props });
|
|
2212
|
+
};
|
|
2213
|
+
WithdrawModal.displayName = "WithdrawModal";
|
|
2214
|
+
//#endregion
|
|
2215
|
+
//#region src/pages/user-profile/components/betdex-wallet-deposit.tsx
|
|
2216
|
+
/** Move the user's managed cash through the normal bridge/withdrawal pipeline
|
|
2217
|
+
* to their verified BETDEX deposit address. Only confirmation submits money. */
|
|
2218
|
+
function BetdexWalletDeposit({ address, onClose }) {
|
|
2219
|
+
const labels = (0, _agg_build_hooks.useLabels)().userProfile.hostedBetdex;
|
|
2220
|
+
const flow = (0, _agg_build_hooks_withdraw.useWithdrawFlow)({
|
|
2221
|
+
open: true,
|
|
2222
|
+
onOpenChange: (open) => {
|
|
2223
|
+
if (!open) onClose();
|
|
2224
|
+
}
|
|
2225
|
+
});
|
|
2226
|
+
const { onWithdrawDestinationChange, onWithdrawNetworkChange, onWithdrawTokenChange } = flow;
|
|
2227
|
+
(0, react.useEffect)(() => {
|
|
2228
|
+
onWithdrawDestinationChange(address);
|
|
2229
|
+
onWithdrawNetworkChange("792703809");
|
|
2230
|
+
onWithdrawTokenChange("USDC");
|
|
2231
|
+
}, [
|
|
2232
|
+
address,
|
|
2233
|
+
onWithdrawDestinationChange,
|
|
2234
|
+
onWithdrawNetworkChange,
|
|
2235
|
+
onWithdrawTokenChange
|
|
2236
|
+
]);
|
|
2237
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WithdrawModal, {
|
|
2238
|
+
...flow,
|
|
2239
|
+
transferTarget: {
|
|
2240
|
+
title: labels.transferToBetdex,
|
|
2241
|
+
address,
|
|
2242
|
+
chainId: "792703809",
|
|
2243
|
+
tokenSymbol: "USDC"
|
|
2244
|
+
}
|
|
2245
|
+
});
|
|
2246
|
+
}
|
|
2247
|
+
//#endregion
|
|
2248
|
+
//#region src/trading/manage-betdex-account-modal.tsx
|
|
2249
|
+
/** Reuse the account controls without treating hosted cash as wallet cash. */
|
|
2250
|
+
function ManageBetdexAccountModal({ open, onOpenChange, userId }) {
|
|
2251
|
+
const labels = (0, _agg_build_hooks.useLabels)();
|
|
2252
|
+
const [fundingTarget, setFundingTarget] = (0, react.useState)(null);
|
|
2253
|
+
const currentTarget = fundingTarget?.userId === userId ? fundingTarget : null;
|
|
2254
|
+
(0, react.useEffect)(() => {
|
|
2255
|
+
if (!open) setFundingTarget(null);
|
|
2256
|
+
}, [open]);
|
|
2257
|
+
(0, react.useEffect)(() => setFundingTarget(null), [userId]);
|
|
2258
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal, {
|
|
2259
|
+
open: open && !currentTarget,
|
|
2260
|
+
onOpenChange,
|
|
2261
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_primitives.Modal.Container, {
|
|
2262
|
+
maxWidth: "600px",
|
|
2263
|
+
"aria-label": labels.trading.manageBetdexAccount,
|
|
2264
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Close, {
|
|
2265
|
+
"aria-label": labels.common.close,
|
|
2266
|
+
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",
|
|
2267
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Icon, {
|
|
2268
|
+
name: "close",
|
|
2269
|
+
size: "medium"
|
|
2270
|
+
})
|
|
2271
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_primitives.Modal.Body, {
|
|
2272
|
+
classNames: { root: "!px-5 !py-16" },
|
|
2273
|
+
children: [
|
|
2274
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Title, {
|
|
2275
|
+
className: "sr-only",
|
|
2276
|
+
children: labels.trading.manageBetdexAccount
|
|
2277
|
+
}),
|
|
2278
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Description, {
|
|
2279
|
+
className: "sr-only",
|
|
2280
|
+
children: labels.userProfile.hostedBetdex.description
|
|
2281
|
+
}),
|
|
2282
|
+
open ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BetdexAccountCard, { onWalletDeposit: userId ? (address) => setFundingTarget({
|
|
2283
|
+
userId,
|
|
2284
|
+
address
|
|
2285
|
+
}) : void 0 }) : null
|
|
2286
|
+
]
|
|
2287
|
+
})]
|
|
2288
|
+
})
|
|
2289
|
+
}), open && currentTarget ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BetdexWalletDeposit, {
|
|
2290
|
+
address: currentTarget.address,
|
|
2291
|
+
onClose: () => setFundingTarget(null)
|
|
2292
|
+
}, currentTarget.userId) : null] });
|
|
2293
|
+
}
|
|
2294
|
+
//#endregion
|
|
2295
|
+
Object.defineProperty(exports, "ConnectKalshiModal", {
|
|
2296
|
+
enumerable: true,
|
|
2297
|
+
get: function() {
|
|
2298
|
+
return ConnectKalshiModal;
|
|
2299
|
+
}
|
|
2300
|
+
});
|
|
2301
|
+
Object.defineProperty(exports, "ConnectNovigModal", {
|
|
2302
|
+
enumerable: true,
|
|
2303
|
+
get: function() {
|
|
2304
|
+
return ConnectNovigModal;
|
|
2305
|
+
}
|
|
2306
|
+
});
|
|
2307
|
+
Object.defineProperty(exports, "ConnectProphetxModal", {
|
|
2308
|
+
enumerable: true,
|
|
2309
|
+
get: function() {
|
|
2310
|
+
return ConnectProphetxModal;
|
|
2311
|
+
}
|
|
2312
|
+
});
|
|
2313
|
+
Object.defineProperty(exports, "DEFAULT_CURRENCY_OPTIONS", {
|
|
2314
|
+
enumerable: true,
|
|
2315
|
+
get: function() {
|
|
2316
|
+
return DEFAULT_CURRENCY_OPTIONS;
|
|
2317
|
+
}
|
|
2318
|
+
});
|
|
2319
|
+
Object.defineProperty(exports, "GeoBlockBanner", {
|
|
2320
|
+
enumerable: true,
|
|
2321
|
+
get: function() {
|
|
2322
|
+
return GeoBlockBanner;
|
|
2323
|
+
}
|
|
2324
|
+
});
|
|
2325
|
+
Object.defineProperty(exports, "ManageBetdexAccountModal", {
|
|
2326
|
+
enumerable: true,
|
|
2327
|
+
get: function() {
|
|
2328
|
+
return ManageBetdexAccountModal;
|
|
2329
|
+
}
|
|
2330
|
+
});
|
|
2331
|
+
Object.defineProperty(exports, "SharedKycModal", {
|
|
2332
|
+
enumerable: true,
|
|
2333
|
+
get: function() {
|
|
2334
|
+
return SharedKycModal;
|
|
2335
|
+
}
|
|
2336
|
+
});
|
|
2337
|
+
Object.defineProperty(exports, "TransferFeeSummary", {
|
|
2338
|
+
enumerable: true,
|
|
2339
|
+
get: function() {
|
|
2340
|
+
return TransferFeeSummary;
|
|
2341
|
+
}
|
|
2342
|
+
});
|
|
2343
|
+
Object.defineProperty(exports, "WithdrawModal", {
|
|
2344
|
+
enumerable: true,
|
|
2345
|
+
get: function() {
|
|
2346
|
+
return WithdrawModal;
|
|
2347
|
+
}
|
|
2348
|
+
});
|
|
2349
|
+
Object.defineProperty(exports, "buildTerminalSummary", {
|
|
2350
|
+
enumerable: true,
|
|
2351
|
+
get: function() {
|
|
2352
|
+
return buildTerminalSummary;
|
|
2353
|
+
}
|
|
2354
|
+
});
|
|
2355
|
+
Object.defineProperty(exports, "dispatchAggDepositNotification", {
|
|
2356
|
+
enumerable: true,
|
|
2357
|
+
get: function() {
|
|
2358
|
+
return dispatchAggDepositNotification;
|
|
2359
|
+
}
|
|
2360
|
+
});
|
|
2361
|
+
Object.defineProperty(exports, "mapNetworksToOptions", {
|
|
2362
|
+
enumerable: true,
|
|
2363
|
+
get: function() {
|
|
2364
|
+
return mapNetworksToOptions;
|
|
2365
|
+
}
|
|
2366
|
+
});
|
|
2367
|
+
Object.defineProperty(exports, "mergeSelectOptionsUnique", {
|
|
2368
|
+
enumerable: true,
|
|
2369
|
+
get: function() {
|
|
2370
|
+
return mergeSelectOptionsUnique;
|
|
2371
|
+
}
|
|
2372
|
+
});
|
|
2373
|
+
Object.defineProperty(exports, "subscribeAggDepositNotification", {
|
|
2374
|
+
enumerable: true,
|
|
2375
|
+
get: function() {
|
|
2376
|
+
return subscribeAggDepositNotification;
|
|
2377
|
+
}
|
|
2378
|
+
});
|
|
2379
|
+
Object.defineProperty(exports, "withNetworkIcons", {
|
|
2380
|
+
enumerable: true,
|
|
2381
|
+
get: function() {
|
|
2382
|
+
return withNetworkIcons;
|
|
2383
|
+
}
|
|
2384
|
+
});
|
|
2385
|
+
Object.defineProperty(exports, "withTokenIcons", {
|
|
2386
|
+
enumerable: true,
|
|
2387
|
+
get: function() {
|
|
2388
|
+
return withTokenIcons;
|
|
2389
|
+
}
|
|
2390
|
+
});
|