@agg-build/ui 1.0.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/README.md +287 -0
- package/dist/chunk-2QJXRRYP.mjs +37 -0
- package/dist/chunk-6NS7D73S.mjs +8811 -0
- package/dist/chunk-75IGOQ4N.mjs +3415 -0
- package/dist/chunk-C7T56TJR.mjs +748 -0
- package/dist/chunk-CGNDMLQL.mjs +3813 -0
- package/dist/chunk-DMKKNK76.mjs +3742 -0
- package/dist/chunk-I2WBGEWK.mjs +4512 -0
- package/dist/chunk-KHHFHXXD.mjs +1 -0
- package/dist/events.d.mts +1 -0
- package/dist/events.d.ts +1 -0
- package/dist/events.js +11414 -0
- package/dist/events.mjs +41 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +25520 -0
- package/dist/index.mjs +978 -0
- package/dist/modals.d.mts +1 -0
- package/dist/modals.d.ts +1 -0
- package/dist/modals.js +7743 -0
- package/dist/modals.mjs +36 -0
- package/dist/pages.d.mts +1 -0
- package/dist/pages.d.ts +1 -0
- package/dist/pages.js +20230 -0
- package/dist/pages.mjs +33 -0
- package/dist/primitives.d.mts +1 -0
- package/dist/primitives.d.ts +1 -0
- package/dist/primitives.js +8599 -0
- package/dist/primitives.mjs +179 -0
- package/dist/styles.css +2 -0
- package/dist/tailwind.css +2 -0
- package/dist/trading.d.mts +1 -0
- package/dist/trading.d.ts +1 -0
- package/dist/trading.js +8658 -0
- package/dist/trading.mjs +49 -0
- package/dist/types/auth/connect-button-view/connect-button-view.constants.d.mts +30 -0
- package/dist/types/auth/connect-button-view/connect-button-view.constants.d.ts +30 -0
- package/dist/types/auth/connect-button-view/connect-button-view.types.d.mts +115 -0
- package/dist/types/auth/connect-button-view/connect-button-view.types.d.ts +115 -0
- package/dist/types/auth/connect-button-view/index.d.mts +7 -0
- package/dist/types/auth/connect-button-view/index.d.ts +7 -0
- package/dist/types/auth/index.d.mts +1 -0
- package/dist/types/auth/index.d.ts +1 -0
- package/dist/types/constants.d.mts +5 -0
- package/dist/types/constants.d.ts +5 -0
- package/dist/types/deposit/components/DepositQRCode.d.mts +12 -0
- package/dist/types/deposit/components/DepositQRCode.d.ts +12 -0
- package/dist/types/deposit/deposit-modal.constants.d.mts +10 -0
- package/dist/types/deposit/deposit-modal.constants.d.ts +10 -0
- package/dist/types/deposit/deposit-modal.types.d.mts +233 -0
- package/dist/types/deposit/deposit-modal.types.d.ts +233 -0
- package/dist/types/deposit/index.d.mts +22 -0
- package/dist/types/deposit/index.d.ts +22 -0
- package/dist/types/deposit/steps/card-deposit.d.mts +17 -0
- package/dist/types/deposit/steps/card-deposit.d.ts +17 -0
- package/dist/types/deposit/steps/card-payment-pending.d.mts +7 -0
- package/dist/types/deposit/steps/card-payment-pending.d.ts +7 -0
- package/dist/types/deposit/steps/card-provider.d.mts +14 -0
- package/dist/types/deposit/steps/card-provider.d.ts +14 -0
- package/dist/types/deposit/steps/card-purchase-success.d.mts +7 -0
- package/dist/types/deposit/steps/card-purchase-success.d.ts +7 -0
- package/dist/types/deposit/steps/card-widget.d.mts +6 -0
- package/dist/types/deposit/steps/card-widget.d.ts +6 -0
- package/dist/types/deposit/steps/crypto-transfer.d.mts +19 -0
- package/dist/types/deposit/steps/crypto-transfer.d.ts +19 -0
- package/dist/types/deposit/steps/deposit-method.d.mts +12 -0
- package/dist/types/deposit/steps/deposit-method.d.ts +12 -0
- package/dist/types/deposit/steps/venue-selection.d.mts +7 -0
- package/dist/types/deposit/steps/venue-selection.d.ts +7 -0
- package/dist/types/deposit/steps/wallet-form.d.mts +24 -0
- package/dist/types/deposit/steps/wallet-form.d.ts +24 -0
- package/dist/types/deposit/steps/wallet-processing.d.mts +7 -0
- package/dist/types/deposit/steps/wallet-processing.d.ts +7 -0
- package/dist/types/deposit/steps/wallet-success.d.mts +7 -0
- package/dist/types/deposit/steps/wallet-success.d.ts +7 -0
- package/dist/types/events/index.d.mts +5 -0
- package/dist/types/events/index.d.ts +5 -0
- package/dist/types/events/item/event-list-item.constants.d.mts +1 -0
- package/dist/types/events/item/event-list-item.constants.d.ts +1 -0
- package/dist/types/events/item/event-list-item.types.d.mts +71 -0
- package/dist/types/events/item/event-list-item.types.d.ts +71 -0
- package/dist/types/events/item/event-list-item.utils.d.mts +46 -0
- package/dist/types/events/item/event-list-item.utils.d.ts +46 -0
- package/dist/types/events/item/index.d.mts +6 -0
- package/dist/types/events/item/index.d.ts +6 -0
- package/dist/types/events/item-details/event-list-item-details-market-selector.d.mts +10 -0
- package/dist/types/events/item-details/event-list-item-details-market-selector.d.ts +10 -0
- package/dist/types/events/item-details/event-list-item-details.constants.d.mts +3 -0
- package/dist/types/events/item-details/event-list-item-details.constants.d.ts +3 -0
- package/dist/types/events/item-details/event-list-item-details.types.d.mts +116 -0
- package/dist/types/events/item-details/event-list-item-details.types.d.ts +116 -0
- package/dist/types/events/item-details/event-list-item-details.utils.d.mts +75 -0
- package/dist/types/events/item-details/event-list-item-details.utils.d.ts +75 -0
- package/dist/types/events/item-details/index.d.mts +8 -0
- package/dist/types/events/item-details/index.d.ts +8 -0
- package/dist/types/events/item-details/settlement-summary.d.mts +9 -0
- package/dist/types/events/item-details/settlement-summary.d.ts +9 -0
- package/dist/types/events/list/event-list-tabs.d.mts +44 -0
- package/dist/types/events/list/event-list-tabs.d.ts +44 -0
- package/dist/types/events/list/event-list.constants.d.mts +4 -0
- package/dist/types/events/list/event-list.constants.d.ts +4 -0
- package/dist/types/events/list/event-list.types.d.mts +48 -0
- package/dist/types/events/list/event-list.types.d.ts +48 -0
- package/dist/types/events/list/event-list.utils.d.mts +19 -0
- package/dist/types/events/list/event-list.utils.d.ts +19 -0
- package/dist/types/events/list/index.d.mts +6 -0
- package/dist/types/events/list/index.d.ts +6 -0
- package/dist/types/events/market-details/index.d.mts +12 -0
- package/dist/types/events/market-details/index.d.ts +12 -0
- package/dist/types/events/market-details/market-details-outcome-button.d.mts +13 -0
- package/dist/types/events/market-details/market-details-outcome-button.d.ts +13 -0
- package/dist/types/events/market-details/market-details.constants.d.mts +9 -0
- package/dist/types/events/market-details/market-details.constants.d.ts +9 -0
- package/dist/types/events/market-details/market-details.types.d.mts +143 -0
- package/dist/types/events/market-details/market-details.types.d.ts +143 -0
- package/dist/types/events/market-details/market-details.utils.d.mts +72 -0
- package/dist/types/events/market-details/market-details.utils.d.ts +72 -0
- package/dist/types/events/market-details/orderbook-aggregation.d.mts +30 -0
- package/dist/types/events/market-details/orderbook-aggregation.d.ts +30 -0
- package/dist/types/events/orderbook/index.d.mts +11 -0
- package/dist/types/events/orderbook/index.d.ts +11 -0
- package/dist/types/events/orderbook/orderbook-with-states.d.mts +35 -0
- package/dist/types/events/orderbook/orderbook-with-states.d.ts +35 -0
- package/dist/types/events/orderbook/orderbook.constants.d.mts +10 -0
- package/dist/types/events/orderbook/orderbook.constants.d.ts +10 -0
- package/dist/types/events/orderbook/orderbook.types.d.mts +65 -0
- package/dist/types/events/orderbook/orderbook.types.d.ts +65 -0
- package/dist/types/events/orderbook/orderbook.utils.d.mts +13 -0
- package/dist/types/events/orderbook/orderbook.utils.d.ts +13 -0
- package/dist/types/events/orderbook/use-center-orderbook-spread.d.mts +13 -0
- package/dist/types/events/orderbook/use-center-orderbook-spread.d.ts +13 -0
- package/dist/types/events/shared/chart-venue-selection.d.mts +20 -0
- package/dist/types/events/shared/chart-venue-selection.d.ts +20 -0
- package/dist/types/events/shared/event-trading-state.utils.d.mts +14 -0
- package/dist/types/events/shared/event-trading-state.utils.d.ts +14 -0
- package/dist/types/events/shared/venue-market-cluster.d.mts +11 -0
- package/dist/types/events/shared/venue-market-cluster.d.ts +11 -0
- package/dist/types/geo-block-banner/index.d.mts +12 -0
- package/dist/types/geo-block-banner/index.d.ts +12 -0
- package/dist/types/geo-block-modal/geo-block-modal.types.d.mts +13 -0
- package/dist/types/geo-block-modal/geo-block-modal.types.d.ts +13 -0
- package/dist/types/geo-block-modal/index.d.mts +6 -0
- package/dist/types/geo-block-modal/index.d.ts +6 -0
- package/dist/types/index.d.mts +10 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/modals/index.d.mts +6 -0
- package/dist/types/modals/index.d.ts +6 -0
- package/dist/types/onboarding/index.d.mts +11 -0
- package/dist/types/onboarding/index.d.ts +11 -0
- package/dist/types/onboarding/onboarding-modal.constants.d.mts +10 -0
- package/dist/types/onboarding/onboarding-modal.constants.d.ts +10 -0
- package/dist/types/onboarding/onboarding-modal.types.d.mts +76 -0
- package/dist/types/onboarding/onboarding-modal.types.d.ts +76 -0
- package/dist/types/onboarding/steps/connect-accounts.d.mts +5 -0
- package/dist/types/onboarding/steps/connect-accounts.d.ts +5 -0
- package/dist/types/onboarding/steps/connect-kalshi-modal.d.mts +5 -0
- package/dist/types/onboarding/steps/connect-kalshi-modal.d.ts +5 -0
- package/dist/types/onboarding/steps/connect-onchain-modal.d.mts +5 -0
- package/dist/types/onboarding/steps/connect-onchain-modal.d.ts +5 -0
- package/dist/types/onboarding/steps/how-it-works.d.mts +5 -0
- package/dist/types/onboarding/steps/how-it-works.d.ts +5 -0
- package/dist/types/onboarding/steps/profile-setup.d.mts +5 -0
- package/dist/types/onboarding/steps/profile-setup.d.ts +5 -0
- package/dist/types/pages/event-market/event-market.types.d.mts +84 -0
- package/dist/types/pages/event-market/event-market.types.d.ts +84 -0
- package/dist/types/pages/event-market/event-market.utils.d.mts +14 -0
- package/dist/types/pages/event-market/event-market.utils.d.ts +14 -0
- package/dist/types/pages/event-market/index.d.mts +8 -0
- package/dist/types/pages/event-market/index.d.ts +8 -0
- package/dist/types/pages/home/home.constants.d.mts +6 -0
- package/dist/types/pages/home/home.constants.d.ts +6 -0
- package/dist/types/pages/home/home.types.d.mts +85 -0
- package/dist/types/pages/home/home.types.d.ts +85 -0
- package/dist/types/pages/home/home.utils.d.mts +7 -0
- package/dist/types/pages/home/home.utils.d.ts +7 -0
- package/dist/types/pages/home/index.d.mts +9 -0
- package/dist/types/pages/home/index.d.ts +9 -0
- package/dist/types/pages/home/use-home-page-modals.d.mts +32 -0
- package/dist/types/pages/home/use-home-page-modals.d.ts +32 -0
- package/dist/types/pages/home/use-scroll-restoration.d.mts +17 -0
- package/dist/types/pages/home/use-scroll-restoration.d.ts +17 -0
- package/dist/types/pages/index.d.mts +4 -0
- package/dist/types/pages/index.d.ts +4 -0
- package/dist/types/pages/user-profile/chain-display.d.mts +1 -0
- package/dist/types/pages/user-profile/chain-display.d.ts +1 -0
- package/dist/types/pages/user-profile/components/activity-row.d.mts +11 -0
- package/dist/types/pages/user-profile/components/activity-row.d.ts +11 -0
- package/dist/types/pages/user-profile/components/available-balance-card.d.mts +18 -0
- package/dist/types/pages/user-profile/components/available-balance-card.d.ts +18 -0
- package/dist/types/pages/user-profile/components/balance-display.d.mts +10 -0
- package/dist/types/pages/user-profile/components/balance-display.d.ts +10 -0
- package/dist/types/pages/user-profile/components/balances-card.d.mts +12 -0
- package/dist/types/pages/user-profile/components/balances-card.d.ts +12 -0
- package/dist/types/pages/user-profile/components/default-avatar.d.mts +8 -0
- package/dist/types/pages/user-profile/components/default-avatar.d.ts +8 -0
- package/dist/types/pages/user-profile/components/empty-state.d.mts +10 -0
- package/dist/types/pages/user-profile/components/empty-state.d.ts +10 -0
- package/dist/types/pages/user-profile/components/open-order-row.d.mts +12 -0
- package/dist/types/pages/user-profile/components/open-order-row.d.ts +12 -0
- package/dist/types/pages/user-profile/components/position-row.d.mts +15 -0
- package/dist/types/pages/user-profile/components/position-row.d.ts +15 -0
- package/dist/types/pages/user-profile/components/positions-activity.d.mts +51 -0
- package/dist/types/pages/user-profile/components/positions-activity.d.ts +51 -0
- package/dist/types/pages/user-profile/components/positions-value-card.d.mts +10 -0
- package/dist/types/pages/user-profile/components/positions-value-card.d.ts +10 -0
- package/dist/types/pages/user-profile/components/user-info-card.d.mts +15 -0
- package/dist/types/pages/user-profile/components/user-info-card.d.ts +15 -0
- package/dist/types/pages/user-profile/index.d.mts +10 -0
- package/dist/types/pages/user-profile/index.d.ts +10 -0
- package/dist/types/pages/user-profile/user-profile.constants.d.mts +9 -0
- package/dist/types/pages/user-profile/user-profile.constants.d.ts +9 -0
- package/dist/types/pages/user-profile/user-profile.types.d.mts +281 -0
- package/dist/types/pages/user-profile/user-profile.types.d.ts +281 -0
- package/dist/types/primitives/agg-logo/agg-logo.constants.d.mts +3 -0
- package/dist/types/primitives/agg-logo/agg-logo.constants.d.ts +3 -0
- package/dist/types/primitives/agg-logo/agg-logo.types.d.mts +2 -0
- package/dist/types/primitives/agg-logo/agg-logo.types.d.ts +2 -0
- package/dist/types/primitives/agg-logo/agg-logo.utils.d.mts +2 -0
- package/dist/types/primitives/agg-logo/agg-logo.utils.d.ts +2 -0
- package/dist/types/primitives/agg-logo/index.d.mts +7 -0
- package/dist/types/primitives/agg-logo/index.d.ts +7 -0
- package/dist/types/primitives/autocomplete-select/autocomplete-select.constants.d.mts +1 -0
- package/dist/types/primitives/autocomplete-select/autocomplete-select.constants.d.ts +1 -0
- package/dist/types/primitives/autocomplete-select/autocomplete-select.types.d.mts +26 -0
- package/dist/types/primitives/autocomplete-select/autocomplete-select.types.d.ts +26 -0
- package/dist/types/primitives/autocomplete-select/autocomplete-select.utils.d.mts +7 -0
- package/dist/types/primitives/autocomplete-select/autocomplete-select.utils.d.ts +7 -0
- package/dist/types/primitives/autocomplete-select/index.d.mts +7 -0
- package/dist/types/primitives/autocomplete-select/index.d.ts +7 -0
- package/dist/types/primitives/badge/badge.constants.d.mts +4 -0
- package/dist/types/primitives/badge/badge.constants.d.ts +4 -0
- package/dist/types/primitives/badge/badge.types.d.mts +27 -0
- package/dist/types/primitives/badge/badge.types.d.ts +27 -0
- package/dist/types/primitives/badge/badge.utils.d.mts +11 -0
- package/dist/types/primitives/badge/badge.utils.d.ts +11 -0
- package/dist/types/primitives/badge/index.d.mts +8 -0
- package/dist/types/primitives/badge/index.d.ts +8 -0
- package/dist/types/primitives/button/button.constants.d.mts +6 -0
- package/dist/types/primitives/button/button.constants.d.ts +6 -0
- package/dist/types/primitives/button/button.types.d.mts +18 -0
- package/dist/types/primitives/button/button.types.d.ts +18 -0
- package/dist/types/primitives/button/button.utils.d.mts +12 -0
- package/dist/types/primitives/button/button.utils.d.ts +12 -0
- package/dist/types/primitives/button/index.d.mts +7 -0
- package/dist/types/primitives/button/index.d.ts +7 -0
- package/dist/types/primitives/card/card.constants.d.mts +4 -0
- package/dist/types/primitives/card/card.constants.d.ts +4 -0
- package/dist/types/primitives/card/card.types.d.mts +8 -0
- package/dist/types/primitives/card/card.types.d.ts +8 -0
- package/dist/types/primitives/card/card.utils.d.mts +8 -0
- package/dist/types/primitives/card/card.utils.d.ts +8 -0
- package/dist/types/primitives/card/index.d.mts +6 -0
- package/dist/types/primitives/card/index.d.ts +6 -0
- package/dist/types/primitives/chart/chart-type-switch.constants.d.mts +2 -0
- package/dist/types/primitives/chart/chart-type-switch.constants.d.ts +2 -0
- package/dist/types/primitives/chart/chart-type-switch.d.mts +7 -0
- package/dist/types/primitives/chart/chart-type-switch.d.ts +7 -0
- package/dist/types/primitives/chart/chart-type-switch.types.d.mts +9 -0
- package/dist/types/primitives/chart/chart-type-switch.types.d.ts +9 -0
- package/dist/types/primitives/chart/chart-type-switch.utils.d.mts +13 -0
- package/dist/types/primitives/chart/chart-type-switch.utils.d.ts +13 -0
- package/dist/types/primitives/chart/chart.constants.d.mts +5 -0
- package/dist/types/primitives/chart/chart.constants.d.ts +5 -0
- package/dist/types/primitives/chart/chart.types.d.mts +59 -0
- package/dist/types/primitives/chart/chart.types.d.ts +59 -0
- package/dist/types/primitives/chart/chart.utils.d.mts +35 -0
- package/dist/types/primitives/chart/chart.utils.d.ts +35 -0
- package/dist/types/primitives/chart/index.d.mts +7 -0
- package/dist/types/primitives/chart/index.d.ts +7 -0
- package/dist/types/primitives/conditional-wrapper.d.mts +11 -0
- package/dist/types/primitives/conditional-wrapper.d.ts +11 -0
- package/dist/types/primitives/currency-input/currency-input.constants.d.mts +6 -0
- package/dist/types/primitives/currency-input/currency-input.constants.d.ts +6 -0
- package/dist/types/primitives/currency-input/currency-input.types.d.mts +36 -0
- package/dist/types/primitives/currency-input/currency-input.types.d.ts +36 -0
- package/dist/types/primitives/currency-input/currency-input.utils.d.mts +10 -0
- package/dist/types/primitives/currency-input/currency-input.utils.d.ts +10 -0
- package/dist/types/primitives/currency-input/index.d.mts +7 -0
- package/dist/types/primitives/currency-input/index.d.ts +7 -0
- package/dist/types/primitives/error-boundary/index.d.mts +24 -0
- package/dist/types/primitives/error-boundary/index.d.ts +24 -0
- package/dist/types/primitives/footer/agg-build-logo.d.mts +16 -0
- package/dist/types/primitives/footer/agg-build-logo.d.ts +16 -0
- package/dist/types/primitives/footer/footer.constants.d.mts +3 -0
- package/dist/types/primitives/footer/footer.constants.d.ts +3 -0
- package/dist/types/primitives/footer/footer.types.d.mts +25 -0
- package/dist/types/primitives/footer/footer.types.d.ts +25 -0
- package/dist/types/primitives/footer/index.d.mts +8 -0
- package/dist/types/primitives/footer/index.d.ts +8 -0
- package/dist/types/primitives/header/agg-logo.d.mts +2 -0
- package/dist/types/primitives/header/agg-logo.d.ts +2 -0
- package/dist/types/primitives/header/header.constants.d.mts +2 -0
- package/dist/types/primitives/header/header.constants.d.ts +2 -0
- package/dist/types/primitives/header/header.types.d.mts +42 -0
- package/dist/types/primitives/header/header.types.d.ts +42 -0
- package/dist/types/primitives/header/header.utils.d.mts +12 -0
- package/dist/types/primitives/header/header.utils.d.ts +12 -0
- package/dist/types/primitives/header/index.d.mts +8 -0
- package/dist/types/primitives/header/index.d.ts +8 -0
- package/dist/types/primitives/icon/icon.constants.d.mts +2 -0
- package/dist/types/primitives/icon/icon.constants.d.ts +2 -0
- package/dist/types/primitives/icon/icon.types.d.mts +12 -0
- package/dist/types/primitives/icon/icon.types.d.ts +12 -0
- package/dist/types/primitives/icon/icon.utils.d.mts +3 -0
- package/dist/types/primitives/icon/icon.utils.d.ts +3 -0
- package/dist/types/primitives/icon/index.d.mts +68 -0
- package/dist/types/primitives/icon/index.d.ts +68 -0
- package/dist/types/primitives/icon/registry.d.mts +286 -0
- package/dist/types/primitives/icon/registry.d.ts +286 -0
- package/dist/types/primitives/icon/svg/activity-chart.d.mts +5 -0
- package/dist/types/primitives/icon/svg/activity-chart.d.ts +5 -0
- package/dist/types/primitives/icon/svg/activity.d.mts +5 -0
- package/dist/types/primitives/icon/svg/activity.d.ts +5 -0
- package/dist/types/primitives/icon/svg/apple.d.mts +5 -0
- package/dist/types/primitives/icon/svg/apple.d.ts +5 -0
- package/dist/types/primitives/icon/svg/arbitrum.d.mts +5 -0
- package/dist/types/primitives/icon/svg/arbitrum.d.ts +5 -0
- package/dist/types/primitives/icon/svg/arrow-right.d.mts +5 -0
- package/dist/types/primitives/icon/svg/arrow-right.d.ts +5 -0
- package/dist/types/primitives/icon/svg/arrow-trend-up.d.mts +5 -0
- package/dist/types/primitives/icon/svg/arrow-trend-up.d.ts +5 -0
- package/dist/types/primitives/icon/svg/arrows-to-dot.d.mts +5 -0
- package/dist/types/primitives/icon/svg/arrows-to-dot.d.ts +5 -0
- package/dist/types/primitives/icon/svg/badge-check-thin.d.mts +5 -0
- package/dist/types/primitives/icon/svg/badge-check-thin.d.ts +5 -0
- package/dist/types/primitives/icon/svg/bank.d.mts +5 -0
- package/dist/types/primitives/icon/svg/bank.d.ts +5 -0
- package/dist/types/primitives/icon/svg/base.d.mts +5 -0
- package/dist/types/primitives/icon/svg/base.d.ts +5 -0
- package/dist/types/primitives/icon/svg/best-prices.d.mts +5 -0
- package/dist/types/primitives/icon/svg/best-prices.d.ts +5 -0
- package/dist/types/primitives/icon/svg/bnb.d.mts +5 -0
- package/dist/types/primitives/icon/svg/bnb.d.ts +5 -0
- package/dist/types/primitives/icon/svg/bolt.d.mts +5 -0
- package/dist/types/primitives/icon/svg/bolt.d.ts +5 -0
- package/dist/types/primitives/icon/svg/chart-candlestick.d.mts +5 -0
- package/dist/types/primitives/icon/svg/chart-candlestick.d.ts +5 -0
- package/dist/types/primitives/icon/svg/chart-line.d.mts +5 -0
- package/dist/types/primitives/icon/svg/chart-line.d.ts +5 -0
- package/dist/types/primitives/icon/svg/check-badge.d.mts +5 -0
- package/dist/types/primitives/icon/svg/check-badge.d.ts +5 -0
- package/dist/types/primitives/icon/svg/check-circle.d.mts +5 -0
- package/dist/types/primitives/icon/svg/check-circle.d.ts +5 -0
- package/dist/types/primitives/icon/svg/chevron-down-thin.d.mts +6 -0
- package/dist/types/primitives/icon/svg/chevron-down-thin.d.ts +6 -0
- package/dist/types/primitives/icon/svg/chevron-down.d.mts +5 -0
- package/dist/types/primitives/icon/svg/chevron-down.d.ts +5 -0
- package/dist/types/primitives/icon/svg/chevron-left.d.mts +5 -0
- package/dist/types/primitives/icon/svg/chevron-left.d.ts +5 -0
- package/dist/types/primitives/icon/svg/chevron-right.d.mts +5 -0
- package/dist/types/primitives/icon/svg/chevron-right.d.ts +5 -0
- package/dist/types/primitives/icon/svg/chevron-up.d.mts +5 -0
- package/dist/types/primitives/icon/svg/chevron-up.d.ts +5 -0
- package/dist/types/primitives/icon/svg/close.d.mts +5 -0
- package/dist/types/primitives/icon/svg/close.d.ts +5 -0
- package/dist/types/primitives/icon/svg/copy.d.mts +5 -0
- package/dist/types/primitives/icon/svg/copy.d.ts +5 -0
- package/dist/types/primitives/icon/svg/create-account.d.mts +5 -0
- package/dist/types/primitives/icon/svg/create-account.d.ts +5 -0
- package/dist/types/primitives/icon/svg/credit-card.d.mts +5 -0
- package/dist/types/primitives/icon/svg/credit-card.d.ts +5 -0
- package/dist/types/primitives/icon/svg/cross-circle.d.mts +5 -0
- package/dist/types/primitives/icon/svg/cross-circle.d.ts +5 -0
- package/dist/types/primitives/icon/svg/disconnect.d.mts +5 -0
- package/dist/types/primitives/icon/svg/disconnect.d.ts +5 -0
- package/dist/types/primitives/icon/svg/discord.d.mts +5 -0
- package/dist/types/primitives/icon/svg/discord.d.ts +5 -0
- package/dist/types/primitives/icon/svg/document.d.mts +5 -0
- package/dist/types/primitives/icon/svg/document.d.ts +5 -0
- package/dist/types/primitives/icon/svg/dots-horizontal.d.mts +5 -0
- package/dist/types/primitives/icon/svg/dots-horizontal.d.ts +5 -0
- package/dist/types/primitives/icon/svg/download.d.mts +5 -0
- package/dist/types/primitives/icon/svg/download.d.ts +5 -0
- package/dist/types/primitives/icon/svg/email.d.mts +5 -0
- package/dist/types/primitives/icon/svg/email.d.ts +5 -0
- package/dist/types/primitives/icon/svg/error-filled.d.mts +5 -0
- package/dist/types/primitives/icon/svg/error-filled.d.ts +5 -0
- package/dist/types/primitives/icon/svg/ethereum.d.mts +5 -0
- package/dist/types/primitives/icon/svg/ethereum.d.ts +5 -0
- package/dist/types/primitives/icon/svg/external-link.d.mts +5 -0
- package/dist/types/primitives/icon/svg/external-link.d.ts +5 -0
- package/dist/types/primitives/icon/svg/google.d.mts +5 -0
- package/dist/types/primitives/icon/svg/google.d.ts +5 -0
- package/dist/types/primitives/icon/svg/image.d.mts +5 -0
- package/dist/types/primitives/icon/svg/image.d.ts +5 -0
- package/dist/types/primitives/icon/svg/info.d.mts +5 -0
- package/dist/types/primitives/icon/svg/info.d.ts +5 -0
- package/dist/types/primitives/icon/svg/internet-security.d.mts +5 -0
- package/dist/types/primitives/icon/svg/internet-security.d.ts +5 -0
- package/dist/types/primitives/icon/svg/link-accounts.d.mts +5 -0
- package/dist/types/primitives/icon/svg/link-accounts.d.ts +5 -0
- package/dist/types/primitives/icon/svg/paper-plane.d.mts +5 -0
- package/dist/types/primitives/icon/svg/paper-plane.d.ts +5 -0
- package/dist/types/primitives/icon/svg/pencil.d.mts +5 -0
- package/dist/types/primitives/icon/svg/pencil.d.ts +5 -0
- package/dist/types/primitives/icon/svg/play-square.d.mts +5 -0
- package/dist/types/primitives/icon/svg/play-square.d.ts +5 -0
- package/dist/types/primitives/icon/svg/polygon.d.mts +5 -0
- package/dist/types/primitives/icon/svg/polygon.d.ts +5 -0
- package/dist/types/primitives/icon/svg/profile-about-tab.d.mts +6 -0
- package/dist/types/primitives/icon/svg/profile-about-tab.d.ts +6 -0
- package/dist/types/primitives/icon/svg/profile-accounts-wallets-tab.d.mts +6 -0
- package/dist/types/primitives/icon/svg/profile-accounts-wallets-tab.d.ts +6 -0
- package/dist/types/primitives/icon/svg/profile.d.mts +5 -0
- package/dist/types/primitives/icon/svg/profile.d.ts +5 -0
- package/dist/types/primitives/icon/svg/quotes-warning.d.mts +6 -0
- package/dist/types/primitives/icon/svg/quotes-warning.d.ts +6 -0
- package/dist/types/primitives/icon/svg/recenter.d.mts +5 -0
- package/dist/types/primitives/icon/svg/recenter.d.ts +5 -0
- package/dist/types/primitives/icon/svg/revenue-alt.d.mts +5 -0
- package/dist/types/primitives/icon/svg/revenue-alt.d.ts +5 -0
- package/dist/types/primitives/icon/svg/search.d.mts +5 -0
- package/dist/types/primitives/icon/svg/search.d.ts +5 -0
- package/dist/types/primitives/icon/svg/shield-trust.d.mts +5 -0
- package/dist/types/primitives/icon/svg/shield-trust.d.ts +5 -0
- package/dist/types/primitives/icon/svg/solana.d.mts +5 -0
- package/dist/types/primitives/icon/svg/solana.d.ts +5 -0
- package/dist/types/primitives/icon/svg/sparkles-filled.d.mts +5 -0
- package/dist/types/primitives/icon/svg/sparkles-filled.d.ts +5 -0
- package/dist/types/primitives/icon/svg/stay-in-control.d.mts +5 -0
- package/dist/types/primitives/icon/svg/stay-in-control.d.ts +5 -0
- package/dist/types/primitives/icon/svg/success-check.d.mts +5 -0
- package/dist/types/primitives/icon/svg/success-check.d.ts +5 -0
- package/dist/types/primitives/icon/svg/telegram.d.mts +5 -0
- package/dist/types/primitives/icon/svg/telegram.d.ts +5 -0
- package/dist/types/primitives/icon/svg/triangle-down.d.mts +5 -0
- package/dist/types/primitives/icon/svg/triangle-down.d.ts +5 -0
- package/dist/types/primitives/icon/svg/triangle-up-filled.d.mts +5 -0
- package/dist/types/primitives/icon/svg/triangle-up-filled.d.ts +5 -0
- package/dist/types/primitives/icon/svg/triangle-up.d.mts +5 -0
- package/dist/types/primitives/icon/svg/triangle-up.d.ts +5 -0
- package/dist/types/primitives/icon/svg/twitter.d.mts +5 -0
- package/dist/types/primitives/icon/svg/twitter.d.ts +5 -0
- package/dist/types/primitives/icon/svg/upload.d.mts +5 -0
- package/dist/types/primitives/icon/svg/upload.d.ts +5 -0
- package/dist/types/primitives/icon/svg/usdc.d.mts +5 -0
- package/dist/types/primitives/icon/svg/usdc.d.ts +5 -0
- package/dist/types/primitives/icon/svg/user-trust.d.mts +5 -0
- package/dist/types/primitives/icon/svg/user-trust.d.ts +5 -0
- package/dist/types/primitives/icon/svg/wallet-avatar.d.mts +5 -0
- package/dist/types/primitives/icon/svg/wallet-avatar.d.ts +5 -0
- package/dist/types/primitives/icon/svg/wallet-filled.d.mts +5 -0
- package/dist/types/primitives/icon/svg/wallet-filled.d.ts +5 -0
- package/dist/types/primitives/icon/svg/wallet.d.mts +5 -0
- package/dist/types/primitives/icon/svg/wallet.d.ts +5 -0
- package/dist/types/primitives/icon/svg/warning-filled.d.mts +5 -0
- package/dist/types/primitives/icon/svg/warning-filled.d.ts +5 -0
- package/dist/types/primitives/icon/svg/warning.d.mts +5 -0
- package/dist/types/primitives/icon/svg/warning.d.ts +5 -0
- package/dist/types/primitives/icon/types.d.mts +6 -0
- package/dist/types/primitives/icon/types.d.ts +6 -0
- package/dist/types/primitives/index.d.mts +25 -0
- package/dist/types/primitives/index.d.ts +25 -0
- package/dist/types/primitives/inline-alert/index.d.mts +7 -0
- package/dist/types/primitives/inline-alert/index.d.ts +7 -0
- package/dist/types/primitives/inline-alert/inline-alert.constants.d.mts +7 -0
- package/dist/types/primitives/inline-alert/inline-alert.constants.d.ts +7 -0
- package/dist/types/primitives/inline-alert/inline-alert.types.d.mts +24 -0
- package/dist/types/primitives/inline-alert/inline-alert.types.d.ts +24 -0
- package/dist/types/primitives/inline-alert/inline-alert.utils.d.mts +10 -0
- package/dist/types/primitives/inline-alert/inline-alert.utils.d.ts +10 -0
- package/dist/types/primitives/loading-icon/index.d.mts +7 -0
- package/dist/types/primitives/loading-icon/index.d.ts +7 -0
- package/dist/types/primitives/loading-icon/loading-icon.constants.d.mts +11 -0
- package/dist/types/primitives/loading-icon/loading-icon.constants.d.ts +11 -0
- package/dist/types/primitives/loading-icon/loading-icon.types.d.mts +15 -0
- package/dist/types/primitives/loading-icon/loading-icon.types.d.ts +15 -0
- package/dist/types/primitives/loading-icon/loading-icon.utils.d.mts +5 -0
- package/dist/types/primitives/loading-icon/loading-icon.utils.d.ts +5 -0
- package/dist/types/primitives/modal/index.d.mts +11 -0
- package/dist/types/primitives/modal/index.d.ts +11 -0
- package/dist/types/primitives/modal/modal.constants.d.mts +2 -0
- package/dist/types/primitives/modal/modal.constants.d.ts +2 -0
- package/dist/types/primitives/modal/modal.types.d.mts +78 -0
- package/dist/types/primitives/modal/modal.types.d.ts +78 -0
- package/dist/types/primitives/modal/modal.utils.d.mts +8 -0
- package/dist/types/primitives/modal/modal.utils.d.ts +8 -0
- package/dist/types/primitives/number-value.d.mts +12 -0
- package/dist/types/primitives/number-value.d.ts +12 -0
- package/dist/types/primitives/remote-image/index.d.mts +7 -0
- package/dist/types/primitives/remote-image/index.d.ts +7 -0
- package/dist/types/primitives/remote-image/remote-image.constants.d.mts +4 -0
- package/dist/types/primitives/remote-image/remote-image.constants.d.ts +4 -0
- package/dist/types/primitives/remote-image/remote-image.types.d.mts +28 -0
- package/dist/types/primitives/remote-image/remote-image.types.d.ts +28 -0
- package/dist/types/primitives/remote-image/remote-image.utils.d.mts +4 -0
- package/dist/types/primitives/remote-image/remote-image.utils.d.ts +4 -0
- package/dist/types/primitives/search/index.d.mts +7 -0
- package/dist/types/primitives/search/index.d.ts +7 -0
- package/dist/types/primitives/search/search-empty-icon.d.mts +5 -0
- package/dist/types/primitives/search/search-empty-icon.d.ts +5 -0
- package/dist/types/primitives/search/search.constants.d.mts +3 -0
- package/dist/types/primitives/search/search.constants.d.ts +3 -0
- package/dist/types/primitives/search/search.types.d.mts +57 -0
- package/dist/types/primitives/search/search.types.d.ts +57 -0
- package/dist/types/primitives/search/search.utils.d.mts +4 -0
- package/dist/types/primitives/search/search.utils.d.ts +4 -0
- package/dist/types/primitives/select/index.d.mts +7 -0
- package/dist/types/primitives/select/index.d.ts +7 -0
- package/dist/types/primitives/select/select.constants.d.mts +1 -0
- package/dist/types/primitives/select/select.constants.d.ts +1 -0
- package/dist/types/primitives/select/select.types.d.mts +25 -0
- package/dist/types/primitives/select/select.types.d.ts +25 -0
- package/dist/types/primitives/select/select.utils.d.mts +9 -0
- package/dist/types/primitives/select/select.utils.d.ts +9 -0
- package/dist/types/primitives/skeleton/index.d.mts +8 -0
- package/dist/types/primitives/skeleton/index.d.ts +8 -0
- package/dist/types/primitives/skeleton/skeleton-block.d.mts +8 -0
- package/dist/types/primitives/skeleton/skeleton-block.d.ts +8 -0
- package/dist/types/primitives/skeleton/skeleton.constants.d.mts +1 -0
- package/dist/types/primitives/skeleton/skeleton.constants.d.ts +1 -0
- package/dist/types/primitives/skeleton/skeleton.types.d.mts +27 -0
- package/dist/types/primitives/skeleton/skeleton.types.d.ts +27 -0
- package/dist/types/primitives/skeleton/skeleton.utils.d.mts +3 -0
- package/dist/types/primitives/skeleton/skeleton.utils.d.ts +3 -0
- package/dist/types/primitives/skeleton/views/event-list-item-details-skeleton-view.d.mts +5 -0
- package/dist/types/primitives/skeleton/views/event-list-item-details-skeleton-view.d.ts +5 -0
- package/dist/types/primitives/skeleton/views/event-list-item-skeleton-view.d.mts +9 -0
- package/dist/types/primitives/skeleton/views/event-list-item-skeleton-view.d.ts +9 -0
- package/dist/types/primitives/skeleton/views/event-list-skeleton-view.d.mts +5 -0
- package/dist/types/primitives/skeleton/views/event-list-skeleton-view.d.ts +5 -0
- package/dist/types/primitives/skeleton/views/market-details-skeleton-view.d.mts +12 -0
- package/dist/types/primitives/skeleton/views/market-details-skeleton-view.d.ts +12 -0
- package/dist/types/primitives/skeleton/views/place-order-skeleton-view.d.mts +5 -0
- package/dist/types/primitives/skeleton/views/place-order-skeleton-view.d.ts +5 -0
- package/dist/types/primitives/skeleton/views/search-skeleton-view.d.mts +5 -0
- package/dist/types/primitives/skeleton/views/search-skeleton-view.d.ts +5 -0
- package/dist/types/primitives/skeleton/views/settlement-skeleton-view.d.mts +5 -0
- package/dist/types/primitives/skeleton/views/settlement-skeleton-view.d.ts +5 -0
- package/dist/types/primitives/skeleton/views/user-profile-overview-skeleton-view.d.mts +5 -0
- package/dist/types/primitives/skeleton/views/user-profile-overview-skeleton-view.d.ts +5 -0
- package/dist/types/primitives/skeleton/views/user-profile-positions-activity-skeleton-view.d.mts +5 -0
- package/dist/types/primitives/skeleton/views/user-profile-positions-activity-skeleton-view.d.ts +5 -0
- package/dist/types/primitives/state-message/index.d.mts +7 -0
- package/dist/types/primitives/state-message/index.d.ts +7 -0
- package/dist/types/primitives/state-message/state-message.constants.d.mts +1 -0
- package/dist/types/primitives/state-message/state-message.constants.d.ts +1 -0
- package/dist/types/primitives/state-message/state-message.types.d.mts +24 -0
- package/dist/types/primitives/state-message/state-message.types.d.ts +24 -0
- package/dist/types/primitives/state-message/state-message.utils.d.mts +4 -0
- package/dist/types/primitives/state-message/state-message.utils.d.ts +4 -0
- package/dist/types/primitives/switch-button/index.d.mts +7 -0
- package/dist/types/primitives/switch-button/index.d.ts +7 -0
- package/dist/types/primitives/switch-button/switch-button.constants.d.mts +5 -0
- package/dist/types/primitives/switch-button/switch-button.constants.d.ts +5 -0
- package/dist/types/primitives/switch-button/switch-button.types.d.mts +19 -0
- package/dist/types/primitives/switch-button/switch-button.types.d.ts +19 -0
- package/dist/types/primitives/switch-button/switch-button.utils.d.mts +7 -0
- package/dist/types/primitives/switch-button/switch-button.utils.d.ts +7 -0
- package/dist/types/primitives/tabs/index.d.mts +7 -0
- package/dist/types/primitives/tabs/index.d.ts +7 -0
- package/dist/types/primitives/tabs/tabs.constants.d.mts +1 -0
- package/dist/types/primitives/tabs/tabs.constants.d.ts +1 -0
- package/dist/types/primitives/tabs/tabs.types.d.mts +36 -0
- package/dist/types/primitives/tabs/tabs.types.d.ts +36 -0
- package/dist/types/primitives/tabs/tabs.utils.d.mts +15 -0
- package/dist/types/primitives/tabs/tabs.utils.d.ts +15 -0
- package/dist/types/primitives/tooltip/index.d.mts +7 -0
- package/dist/types/primitives/tooltip/index.d.ts +7 -0
- package/dist/types/primitives/tooltip/tooltip.constants.d.mts +3 -0
- package/dist/types/primitives/tooltip/tooltip.constants.d.ts +3 -0
- package/dist/types/primitives/tooltip/tooltip.types.d.mts +27 -0
- package/dist/types/primitives/tooltip/tooltip.types.d.ts +27 -0
- package/dist/types/primitives/tooltip/tooltip.utils.d.mts +7 -0
- package/dist/types/primitives/tooltip/tooltip.utils.d.ts +7 -0
- package/dist/types/primitives/typography/index.d.mts +8 -0
- package/dist/types/primitives/typography/index.d.ts +8 -0
- package/dist/types/primitives/typography/typography.constants.d.mts +3 -0
- package/dist/types/primitives/typography/typography.constants.d.ts +3 -0
- package/dist/types/primitives/typography/typography.types.d.mts +12 -0
- package/dist/types/primitives/typography/typography.types.d.ts +12 -0
- package/dist/types/primitives/typography/typography.utils.d.mts +6 -0
- package/dist/types/primitives/typography/typography.utils.d.ts +6 -0
- package/dist/types/primitives/venue-logo/index.d.mts +9 -0
- package/dist/types/primitives/venue-logo/index.d.ts +9 -0
- package/dist/types/primitives/venue-logo/logo-props.d.mts +10 -0
- package/dist/types/primitives/venue-logo/logo-props.d.ts +10 -0
- package/dist/types/primitives/venue-logo/svg/default-venue.d.mts +2 -0
- package/dist/types/primitives/venue-logo/svg/default-venue.d.ts +2 -0
- package/dist/types/primitives/venue-logo/svg/logo-hyperliquid.d.mts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-hyperliquid.d.ts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-kalshi.d.mts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-kalshi.d.ts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-limitless.d.mts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-limitless.d.ts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-myriad.d.mts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-myriad.d.ts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-opinion.d.mts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-opinion.d.ts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-polymarket.d.mts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-polymarket.d.ts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-predict.d.mts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-predict.d.ts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-probable.d.mts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-probable.d.ts +5 -0
- package/dist/types/primitives/venue-logo/venue-logo.constants.d.mts +17 -0
- package/dist/types/primitives/venue-logo/venue-logo.constants.d.ts +17 -0
- package/dist/types/primitives/venue-logo/venue-logo.types.d.mts +24 -0
- package/dist/types/primitives/venue-logo/venue-logo.types.d.ts +24 -0
- package/dist/types/primitives/venue-logo/venue-logo.utils.d.mts +13 -0
- package/dist/types/primitives/venue-logo/venue-logo.utils.d.ts +13 -0
- package/dist/types/profile/index.d.mts +6 -0
- package/dist/types/profile/index.d.ts +6 -0
- package/dist/types/profile/profile-modal.constants.d.mts +17 -0
- package/dist/types/profile/profile-modal.constants.d.ts +17 -0
- package/dist/types/profile/profile-modal.types.d.mts +84 -0
- package/dist/types/profile/profile-modal.types.d.ts +84 -0
- package/dist/types/profile/tabs/about-tab.d.mts +18 -0
- package/dist/types/profile/tabs/about-tab.d.ts +18 -0
- package/dist/types/profile/tabs/accounts-wallets-tab.d.mts +33 -0
- package/dist/types/profile/tabs/accounts-wallets-tab.d.ts +33 -0
- package/dist/types/shared/constants.d.mts +33 -0
- package/dist/types/shared/constants.d.ts +33 -0
- package/dist/types/shared/deposit-modal-events.d.mts +4 -0
- package/dist/types/shared/deposit-modal-events.d.ts +4 -0
- package/dist/types/shared/query-error.d.mts +2 -0
- package/dist/types/shared/query-error.d.ts +2 -0
- package/dist/types/shared/types.d.mts +1 -0
- package/dist/types/shared/types.d.ts +1 -0
- package/dist/types/shared/utils.d.mts +15 -0
- package/dist/types/shared/utils.d.ts +15 -0
- package/dist/types/trading/index.d.mts +7 -0
- package/dist/types/trading/index.d.ts +7 -0
- package/dist/types/trading/place-order/index.d.mts +10 -0
- package/dist/types/trading/place-order/index.d.ts +10 -0
- package/dist/types/trading/place-order/index.place-order.constants.d.mts +18 -0
- package/dist/types/trading/place-order/index.place-order.constants.d.ts +18 -0
- package/dist/types/trading/place-order/index.place-order.failure.d.mts +14 -0
- package/dist/types/trading/place-order/index.place-order.failure.d.ts +14 -0
- package/dist/types/trading/place-order/index.place-order.success.d.mts +12 -0
- package/dist/types/trading/place-order/index.place-order.success.d.ts +12 -0
- package/dist/types/trading/place-order/index.place-order.types.d.mts +192 -0
- package/dist/types/trading/place-order/index.place-order.types.d.ts +192 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +100 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +100 -0
- package/dist/types/trading/settlement/index.d.mts +12 -0
- package/dist/types/trading/settlement/index.d.ts +12 -0
- package/dist/types/trading/settlement/settlement-details.d.mts +8 -0
- package/dist/types/trading/settlement/settlement-details.d.ts +8 -0
- package/dist/types/trading/settlement/settlement-details.utils.d.mts +7 -0
- package/dist/types/trading/settlement/settlement-details.utils.d.ts +7 -0
- package/dist/types/trading/trading-context/index.d.mts +2 -0
- package/dist/types/trading/trading-context/index.d.ts +2 -0
- package/dist/types/trading/types.d.mts +82 -0
- package/dist/types/trading/types.d.ts +82 -0
- package/dist/types/trading/use-kalshi-kyc-flow.d.mts +22 -0
- package/dist/types/trading/use-kalshi-kyc-flow.d.ts +22 -0
- package/dist/types/trading/utils.d.mts +16 -0
- package/dist/types/trading/utils.d.ts +16 -0
- package/dist/types/withdraw/index.d.mts +6 -0
- package/dist/types/withdraw/index.d.ts +6 -0
- package/dist/types/withdraw/steps/withdraw-amount.d.mts +17 -0
- package/dist/types/withdraw/steps/withdraw-amount.d.ts +17 -0
- package/dist/types/withdraw/steps/withdraw-method.d.mts +6 -0
- package/dist/types/withdraw/steps/withdraw-method.d.ts +6 -0
- package/dist/types/withdraw/steps/withdraw-provider.d.mts +10 -0
- package/dist/types/withdraw/steps/withdraw-provider.d.ts +10 -0
- package/dist/types/withdraw/steps/withdraw-success.d.mts +7 -0
- package/dist/types/withdraw/steps/withdraw-success.d.ts +7 -0
- package/dist/types/withdraw/withdraw-modal.constants.d.mts +5 -0
- package/dist/types/withdraw/withdraw-modal.constants.d.ts +5 -0
- package/dist/types/withdraw/withdraw-modal.types.d.mts +64 -0
- package/dist/types/withdraw/withdraw-modal.types.d.ts +64 -0
- package/package.json +128 -0
|
@@ -0,0 +1,3742 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
ArbitrumIcon,
|
|
4
|
+
BaseIcon,
|
|
5
|
+
BestPricesIcon,
|
|
6
|
+
BnbIcon,
|
|
7
|
+
BoltIcon,
|
|
8
|
+
Button,
|
|
9
|
+
CheckCircleIcon,
|
|
10
|
+
ChevronLeftIcon,
|
|
11
|
+
ChevronRightIcon,
|
|
12
|
+
CloseIcon,
|
|
13
|
+
CopyIcon,
|
|
14
|
+
CreateAccountIcon,
|
|
15
|
+
CreditCardIcon,
|
|
16
|
+
DocumentIcon,
|
|
17
|
+
EthereumIcon,
|
|
18
|
+
ExternalLinkIcon,
|
|
19
|
+
Icon,
|
|
20
|
+
LinkAccountsIcon,
|
|
21
|
+
LoadingIcon,
|
|
22
|
+
Modal,
|
|
23
|
+
PlaySquareIcon,
|
|
24
|
+
PolygonIcon,
|
|
25
|
+
ProfileIcon,
|
|
26
|
+
RemoteImage,
|
|
27
|
+
Select,
|
|
28
|
+
SolanaIcon,
|
|
29
|
+
StayInControlIcon,
|
|
30
|
+
SuccessCheckIcon,
|
|
31
|
+
UsdcIcon,
|
|
32
|
+
VenueLogo,
|
|
33
|
+
WalletIcon,
|
|
34
|
+
WarningIcon,
|
|
35
|
+
__async,
|
|
36
|
+
__spreadProps,
|
|
37
|
+
__spreadValues,
|
|
38
|
+
cn,
|
|
39
|
+
formatCompactUsd,
|
|
40
|
+
venueLogoLabels
|
|
41
|
+
} from "./chunk-6NS7D73S.mjs";
|
|
42
|
+
|
|
43
|
+
// src/deposit/index.tsx
|
|
44
|
+
import { useEffect as useEffect3, useMemo, useRef, useState as useState3 } from "react";
|
|
45
|
+
import { useAggAuthState, useAggUiConfig, useDepositAddresses, useLabels as useLabels10 } from "@agg-build/hooks";
|
|
46
|
+
import { SVM_CHAIN_IDS, useDepositFlow } from "@agg-build/hooks/deposit";
|
|
47
|
+
|
|
48
|
+
// src/shared/constants.ts
|
|
49
|
+
import React from "react";
|
|
50
|
+
var USDC = {
|
|
51
|
+
value: "USDC",
|
|
52
|
+
label: "USDC",
|
|
53
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/usdc.svg"
|
|
54
|
+
};
|
|
55
|
+
var SUPPORTED_NETWORKS = [
|
|
56
|
+
{
|
|
57
|
+
value: "arbitrum",
|
|
58
|
+
label: "Arbitrum One",
|
|
59
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/chains/arbitrum/colored.svg",
|
|
60
|
+
tokens: [USDC]
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
value: "base",
|
|
64
|
+
label: "Base",
|
|
65
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/chains/base/colored.svg",
|
|
66
|
+
tokens: [USDC]
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
value: "bnb",
|
|
70
|
+
label: "BNB Chain",
|
|
71
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/chains/bnb/colored.svg",
|
|
72
|
+
tokens: [USDC]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
value: "mainnet",
|
|
76
|
+
label: "Ethereum",
|
|
77
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/chains/eth/colored.svg",
|
|
78
|
+
tokens: [USDC]
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
value: "optimism",
|
|
82
|
+
label: "Optimism",
|
|
83
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/chains/optimism/colored.svg",
|
|
84
|
+
tokens: [USDC]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
value: "polygon",
|
|
88
|
+
label: "Polygon Mainnet",
|
|
89
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/chains/polygon/colored.svg",
|
|
90
|
+
tokens: [USDC]
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
value: "solana",
|
|
94
|
+
label: "Solana",
|
|
95
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/chains/solana/dark.svg",
|
|
96
|
+
tokens: [USDC]
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
value: "zksync",
|
|
100
|
+
label: "zkSync Era",
|
|
101
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/chains/zksync/colored.svg",
|
|
102
|
+
tokens: [USDC]
|
|
103
|
+
}
|
|
104
|
+
];
|
|
105
|
+
var mapNetworksToOptions = () => {
|
|
106
|
+
return SUPPORTED_NETWORKS.map((n) => {
|
|
107
|
+
const Component = CHAIN_ICON_COMPONENTS[n.value];
|
|
108
|
+
return {
|
|
109
|
+
value: n.value,
|
|
110
|
+
label: n.label,
|
|
111
|
+
iconUrl: n.iconUrl,
|
|
112
|
+
icon: Component ? React.createElement(Component) : void 0
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
var DEFAULT_CURRENCY_OPTIONS = [
|
|
117
|
+
{
|
|
118
|
+
value: "USDC",
|
|
119
|
+
label: "USDC",
|
|
120
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/usdc.svg"
|
|
121
|
+
},
|
|
122
|
+
// Add commonly-used tokens with icons. These can be overridden by props.
|
|
123
|
+
{
|
|
124
|
+
value: "ARB",
|
|
125
|
+
label: "ARB",
|
|
126
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/tokens/arb.svg"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
value: "BNB",
|
|
130
|
+
label: "BNB",
|
|
131
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/tokens/bnb.svg"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
value: "BTC",
|
|
135
|
+
label: "BTC",
|
|
136
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/tokens/btc.svg"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
value: "MATIC",
|
|
140
|
+
label: "MATIC",
|
|
141
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/tokens/matic.svg"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
value: "ETH",
|
|
145
|
+
label: "ETH",
|
|
146
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/tokens/eth.svg"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
value: "SOL",
|
|
150
|
+
label: "SOL",
|
|
151
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/tokens/sol.svg"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
value: "OP",
|
|
155
|
+
label: "OP",
|
|
156
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/tokens/op.svg"
|
|
157
|
+
}
|
|
158
|
+
];
|
|
159
|
+
var withTokenIcons = (options) => {
|
|
160
|
+
const byValue = new Map(DEFAULT_CURRENCY_OPTIONS.map((o) => [o.value, o.iconUrl]));
|
|
161
|
+
return options.map((o) => o.iconUrl ? o : __spreadProps(__spreadValues({}, o), { iconUrl: byValue.get(o.value) }));
|
|
162
|
+
};
|
|
163
|
+
var CHAIN_ID_TO_SLUG = {
|
|
164
|
+
"1": "mainnet",
|
|
165
|
+
"10": "optimism",
|
|
166
|
+
"56": "bnb",
|
|
167
|
+
"137": "polygon",
|
|
168
|
+
"324": "zksync",
|
|
169
|
+
"8453": "base",
|
|
170
|
+
"42161": "arbitrum",
|
|
171
|
+
"792703809": "solana"
|
|
172
|
+
};
|
|
173
|
+
var CHAIN_ICON_COMPONENTS = {
|
|
174
|
+
mainnet: EthereumIcon,
|
|
175
|
+
polygon: PolygonIcon,
|
|
176
|
+
base: BaseIcon,
|
|
177
|
+
arbitrum: ArbitrumIcon,
|
|
178
|
+
solana: SolanaIcon,
|
|
179
|
+
bnb: BnbIcon
|
|
180
|
+
};
|
|
181
|
+
var withNetworkIcons = (options) => {
|
|
182
|
+
const bySlug = new Map(SUPPORTED_NETWORKS.map((n) => [n.value, n.iconUrl]));
|
|
183
|
+
return options.map((o) => {
|
|
184
|
+
var _a, _b, _c;
|
|
185
|
+
const slug = (_a = CHAIN_ID_TO_SLUG[o.value]) != null ? _a : o.value;
|
|
186
|
+
const Component = CHAIN_ICON_COMPONENTS[slug];
|
|
187
|
+
return __spreadProps(__spreadValues({}, o), {
|
|
188
|
+
iconUrl: (_b = o.iconUrl) != null ? _b : bySlug.get(slug),
|
|
189
|
+
icon: (_c = o.icon) != null ? _c : Component ? React.createElement(Component) : void 0
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
};
|
|
193
|
+
var mergeSelectOptionsUnique = (base, fill) => {
|
|
194
|
+
const seen = /* @__PURE__ */ new Set();
|
|
195
|
+
const out = [];
|
|
196
|
+
for (const opt of base != null ? base : []) {
|
|
197
|
+
if (!seen.has(opt.value)) {
|
|
198
|
+
out.push(opt);
|
|
199
|
+
seen.add(opt.value);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
for (const opt of fill) {
|
|
203
|
+
if (!seen.has(opt.value)) {
|
|
204
|
+
out.push(opt);
|
|
205
|
+
seen.add(opt.value);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return out;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
// src/deposit/deposit-modal.constants.ts
|
|
212
|
+
import React2 from "react";
|
|
213
|
+
var CARD_NETWORK_OPTIONS = [
|
|
214
|
+
{ value: "ethereum", label: "Ethereum", icon: React2.createElement(EthereumIcon) },
|
|
215
|
+
{ value: "arbitrum", label: "Arbitrum", icon: React2.createElement(ArbitrumIcon) },
|
|
216
|
+
{ value: "base", label: "Base", icon: React2.createElement(BaseIcon) },
|
|
217
|
+
{ value: "solana", label: "Solana", icon: React2.createElement(SolanaIcon) },
|
|
218
|
+
{ value: "polygon", label: "Polygon", icon: React2.createElement(PolygonIcon) }
|
|
219
|
+
];
|
|
220
|
+
var NETWORK_TO_CURRENCY_CODE = {
|
|
221
|
+
ethereum: "USDC",
|
|
222
|
+
arbitrum: "USDC_ARBITRUM",
|
|
223
|
+
base: "USDC_BASE",
|
|
224
|
+
solana: "USDC_SOLANA",
|
|
225
|
+
polygon: "USDC_POLYGON"
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
// src/deposit/steps/deposit-method.tsx
|
|
229
|
+
import { useLabels } from "@agg-build/hooks";
|
|
230
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
231
|
+
var DepositMethodCard = ({
|
|
232
|
+
icon,
|
|
233
|
+
title,
|
|
234
|
+
description,
|
|
235
|
+
value,
|
|
236
|
+
highlighted = false,
|
|
237
|
+
disabled = false,
|
|
238
|
+
onContinue
|
|
239
|
+
}) => /* @__PURE__ */ jsxs(
|
|
240
|
+
"div",
|
|
241
|
+
{
|
|
242
|
+
className: cn(
|
|
243
|
+
"flex items-center gap-3 sm:gap-4",
|
|
244
|
+
"rounded-xl border border-agg-separator",
|
|
245
|
+
"p-3 sm:p-4",
|
|
246
|
+
"transition-colors",
|
|
247
|
+
disabled ? "opacity-50 cursor-not-allowed pointer-events-none" : "cursor-pointer hover:bg-agg-secondary-hover",
|
|
248
|
+
highlighted ? "" : ""
|
|
249
|
+
),
|
|
250
|
+
role: "button",
|
|
251
|
+
tabIndex: disabled ? -1 : 0,
|
|
252
|
+
"aria-disabled": disabled || void 0,
|
|
253
|
+
onClick: disabled ? void 0 : onContinue,
|
|
254
|
+
onKeyDown: disabled ? void 0 : (e) => {
|
|
255
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
256
|
+
e.preventDefault();
|
|
257
|
+
onContinue();
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
children: [
|
|
261
|
+
/* @__PURE__ */ jsx("div", { className: "shrink-0 flex items-center justify-center h-10 w-10 rounded-lg bg-agg-secondary-hover", children: icon }),
|
|
262
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
263
|
+
/* @__PURE__ */ jsx("p", { className: "agg-type-body-strong text-agg-foreground", children: title }),
|
|
264
|
+
/* @__PURE__ */ jsx("p", { className: "agg-type-label text-agg-muted-foreground", children: description })
|
|
265
|
+
] }),
|
|
266
|
+
value ? /* @__PURE__ */ jsx("p", { className: "agg-type-label text-agg-muted-foreground", children: value }) : null,
|
|
267
|
+
/* @__PURE__ */ jsx("div", { className: "shrink-0 text-agg-muted-foreground", children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-5 w-5" }) })
|
|
268
|
+
]
|
|
269
|
+
}
|
|
270
|
+
);
|
|
271
|
+
var DepositMethodStep = ({
|
|
272
|
+
balance,
|
|
273
|
+
walletLabel,
|
|
274
|
+
walletBalance,
|
|
275
|
+
isWalletBalanceLoading = false,
|
|
276
|
+
showWalletMethod = true,
|
|
277
|
+
highlightedMethod,
|
|
278
|
+
depositAddressesReady = true,
|
|
279
|
+
onSelectMethod
|
|
280
|
+
}) => {
|
|
281
|
+
const labels = useLabels();
|
|
282
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
283
|
+
/* @__PURE__ */ jsx(Modal.Header, { title: labels.deposit.title, hideBorder: true }),
|
|
284
|
+
/* @__PURE__ */ jsx(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5", children: [
|
|
285
|
+
/* @__PURE__ */ jsxs("p", { className: "agg-type-body text-agg-foreground", children: [
|
|
286
|
+
labels.deposit.balancePrefix,
|
|
287
|
+
" ",
|
|
288
|
+
formatCompactUsd(balance)
|
|
289
|
+
] }),
|
|
290
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
291
|
+
showWalletMethod ? /* @__PURE__ */ jsx(
|
|
292
|
+
DepositMethodCard,
|
|
293
|
+
{
|
|
294
|
+
icon: /* @__PURE__ */ jsx(WalletIcon, { className: "h-6 w-6 text-agg-muted-foreground" }),
|
|
295
|
+
title: labels.deposit.methods.walletTitle(walletLabel),
|
|
296
|
+
description: labels.deposit.methods.walletDescription,
|
|
297
|
+
value: isWalletBalanceLoading ? /* @__PURE__ */ jsx(LoadingIcon, { size: "small" }) : formatCompactUsd(walletBalance),
|
|
298
|
+
highlighted: highlightedMethod === "wallet",
|
|
299
|
+
disabled: !depositAddressesReady,
|
|
300
|
+
onContinue: () => onSelectMethod("wallet")
|
|
301
|
+
}
|
|
302
|
+
) : null,
|
|
303
|
+
/* @__PURE__ */ jsx(
|
|
304
|
+
DepositMethodCard,
|
|
305
|
+
{
|
|
306
|
+
icon: /* @__PURE__ */ jsx(BoltIcon, { className: "h-6 w-6 text-agg-muted-foreground" }),
|
|
307
|
+
title: labels.deposit.methods.cryptoTitle,
|
|
308
|
+
description: labels.deposit.methods.cryptoDescription,
|
|
309
|
+
highlighted: highlightedMethod === "crypto",
|
|
310
|
+
disabled: !depositAddressesReady,
|
|
311
|
+
onContinue: () => onSelectMethod("crypto")
|
|
312
|
+
}
|
|
313
|
+
),
|
|
314
|
+
/* @__PURE__ */ jsx(
|
|
315
|
+
DepositMethodCard,
|
|
316
|
+
{
|
|
317
|
+
icon: /* @__PURE__ */ jsx(CreditCardIcon, { className: "h-6 w-6 text-agg-muted-foreground" }),
|
|
318
|
+
title: labels.deposit.methods.cardTitle,
|
|
319
|
+
description: labels.deposit.methods.cardDescription,
|
|
320
|
+
highlighted: highlightedMethod === "card",
|
|
321
|
+
onContinue: () => onSelectMethod("card")
|
|
322
|
+
}
|
|
323
|
+
)
|
|
324
|
+
] })
|
|
325
|
+
] }) })
|
|
326
|
+
] });
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
// src/deposit/steps/card-deposit.tsx
|
|
330
|
+
import { useLabels as useLabels2 } from "@agg-build/hooks";
|
|
331
|
+
import { useEffect, useState } from "react";
|
|
332
|
+
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
333
|
+
var CardDepositStep = ({
|
|
334
|
+
amount,
|
|
335
|
+
currency,
|
|
336
|
+
// tokenOptions,
|
|
337
|
+
networkOptions,
|
|
338
|
+
// selectedToken,
|
|
339
|
+
selectedNetwork,
|
|
340
|
+
minAmount,
|
|
341
|
+
onBack,
|
|
342
|
+
onAmountChange,
|
|
343
|
+
onCurrencyChange,
|
|
344
|
+
// onTokenChange,
|
|
345
|
+
onNetworkChange,
|
|
346
|
+
onContinue
|
|
347
|
+
}) => {
|
|
348
|
+
const labels = useLabels2();
|
|
349
|
+
const [localAmount, setLocalAmount] = useState(amount);
|
|
350
|
+
useEffect(() => {
|
|
351
|
+
setLocalAmount(amount);
|
|
352
|
+
}, [amount]);
|
|
353
|
+
const numericAmount = Number(localAmount) || 0;
|
|
354
|
+
const hasInput = localAmount.length > 0;
|
|
355
|
+
const isBelowMin = minAmount != null && hasInput && numericAmount < minAmount;
|
|
356
|
+
const isValid = numericAmount > 0 && !isBelowMin;
|
|
357
|
+
const formattedMin = minAmount != null ? `$${minAmount}` : void 0;
|
|
358
|
+
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
359
|
+
/* @__PURE__ */ jsx2(
|
|
360
|
+
Modal.Header,
|
|
361
|
+
{
|
|
362
|
+
title: labels.deposit.cardFlow.title,
|
|
363
|
+
hideBorder: true,
|
|
364
|
+
leftElement: /* @__PURE__ */ jsx2(
|
|
365
|
+
"button",
|
|
366
|
+
{
|
|
367
|
+
type: "button",
|
|
368
|
+
className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
|
|
369
|
+
onClick: onBack,
|
|
370
|
+
"aria-label": "Go back",
|
|
371
|
+
children: /* @__PURE__ */ jsx2(ChevronLeftIcon, { className: "h-6 w-6" })
|
|
372
|
+
}
|
|
373
|
+
)
|
|
374
|
+
}
|
|
375
|
+
),
|
|
376
|
+
/* @__PURE__ */ jsx2(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-5", children: [
|
|
377
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-3", children: [
|
|
378
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex-1 flex flex-col gap-2", children: [
|
|
379
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between", children: [
|
|
380
|
+
/* @__PURE__ */ jsx2("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.cardFlow.amountLabel }),
|
|
381
|
+
formattedMin ? /* @__PURE__ */ jsx2("p", { className: "agg-type-label text-agg-foreground", children: labels.deposit.cardFlow.minRequired(formattedMin) }) : null
|
|
382
|
+
] }),
|
|
383
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex gap-3 items-center", children: [
|
|
384
|
+
/* @__PURE__ */ jsxs2(
|
|
385
|
+
"div",
|
|
386
|
+
{
|
|
387
|
+
className: cn(
|
|
388
|
+
"flex h-10 flex-1 items-center gap-2 rounded-agg-sm border bg-agg-secondary px-3",
|
|
389
|
+
isBelowMin ? "border-agg-primary border-2" : "border-agg-separator"
|
|
390
|
+
),
|
|
391
|
+
children: [
|
|
392
|
+
/* @__PURE__ */ jsx2(
|
|
393
|
+
"input",
|
|
394
|
+
{
|
|
395
|
+
type: "text",
|
|
396
|
+
inputMode: "decimal",
|
|
397
|
+
"aria-label": labels.deposit.cardFlow.amountLabel,
|
|
398
|
+
className: "agg-type-body w-full bg-transparent text-agg-foreground outline-none",
|
|
399
|
+
placeholder: "0.00",
|
|
400
|
+
value: localAmount,
|
|
401
|
+
onChange: (event) => {
|
|
402
|
+
const next = event.target.value;
|
|
403
|
+
setLocalAmount(next);
|
|
404
|
+
onAmountChange(next);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
),
|
|
408
|
+
/* @__PURE__ */ jsx2("span", { className: "agg-type-body text-agg-muted-foreground", children: "$" })
|
|
409
|
+
]
|
|
410
|
+
}
|
|
411
|
+
),
|
|
412
|
+
/* @__PURE__ */ jsx2("div", { className: "w-[100px]", children: /* @__PURE__ */ jsx2(
|
|
413
|
+
Select,
|
|
414
|
+
{
|
|
415
|
+
items: [{ value: currency, label: currency }],
|
|
416
|
+
value: currency,
|
|
417
|
+
onChange: onCurrencyChange,
|
|
418
|
+
ariaLabel: labels.deposit.cardFlow.currencyLabel,
|
|
419
|
+
triggerClassName: "rounded-agg-sm"
|
|
420
|
+
}
|
|
421
|
+
) })
|
|
422
|
+
] })
|
|
423
|
+
] }),
|
|
424
|
+
isBelowMin && formattedMin ? /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", role: "alert", "aria-live": "assertive", children: [
|
|
425
|
+
/* @__PURE__ */ jsx2(
|
|
426
|
+
Icon,
|
|
427
|
+
{
|
|
428
|
+
name: "warning",
|
|
429
|
+
className: "!h-3.5 !w-3.5 shrink-0 text-agg-error",
|
|
430
|
+
"aria-hidden": "true"
|
|
431
|
+
}
|
|
432
|
+
),
|
|
433
|
+
/* @__PURE__ */ jsx2("p", { className: "agg-type-label text-agg-error", children: labels.deposit.cardFlow.minAmountError(formattedMin) })
|
|
434
|
+
] }) : null
|
|
435
|
+
] }),
|
|
436
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-2", children: [
|
|
437
|
+
/* @__PURE__ */ jsx2("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.cardFlow.networkLabel }),
|
|
438
|
+
/* @__PURE__ */ jsx2(
|
|
439
|
+
Select,
|
|
440
|
+
{
|
|
441
|
+
items: networkOptions,
|
|
442
|
+
value: selectedNetwork,
|
|
443
|
+
onChange: onNetworkChange,
|
|
444
|
+
ariaLabel: labels.deposit.cardFlow.networkLabel,
|
|
445
|
+
triggerClassName: "rounded-agg-sm"
|
|
446
|
+
}
|
|
447
|
+
)
|
|
448
|
+
] }),
|
|
449
|
+
/* @__PURE__ */ jsx2(
|
|
450
|
+
Button,
|
|
451
|
+
{
|
|
452
|
+
variant: "secondary",
|
|
453
|
+
size: "large",
|
|
454
|
+
className: "w-full",
|
|
455
|
+
disabled: !isValid,
|
|
456
|
+
onClick: () => onContinue(numericAmount),
|
|
457
|
+
children: labels.deposit.cardFlow.getQuotes
|
|
458
|
+
}
|
|
459
|
+
)
|
|
460
|
+
] }) })
|
|
461
|
+
] });
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
// src/deposit/steps/crypto-transfer.tsx
|
|
465
|
+
import { useState as useState2, useCallback } from "react";
|
|
466
|
+
import { useLabels as useLabels3 } from "@agg-build/hooks";
|
|
467
|
+
|
|
468
|
+
// src/deposit/components/DepositQRCode.tsx
|
|
469
|
+
import { QRCodeSVG } from "qrcode.react";
|
|
470
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
471
|
+
function DepositQRCode({
|
|
472
|
+
depositAddress,
|
|
473
|
+
networkLogoUrl,
|
|
474
|
+
networkLogo,
|
|
475
|
+
size = 160
|
|
476
|
+
}) {
|
|
477
|
+
const logoOverlay = networkLogo ? /* @__PURE__ */ jsx3(
|
|
478
|
+
"div",
|
|
479
|
+
{
|
|
480
|
+
className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-sm",
|
|
481
|
+
style: { width: 32, height: 32, backgroundColor: "#FFFFFF", padding: 2 },
|
|
482
|
+
children: networkLogo
|
|
483
|
+
}
|
|
484
|
+
) : networkLogoUrl ? /* @__PURE__ */ jsx3(
|
|
485
|
+
"img",
|
|
486
|
+
{
|
|
487
|
+
src: networkLogoUrl,
|
|
488
|
+
alt: "",
|
|
489
|
+
className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-sm",
|
|
490
|
+
width: 32,
|
|
491
|
+
height: 32,
|
|
492
|
+
style: { backgroundColor: "#FFFFFF", padding: 2 }
|
|
493
|
+
}
|
|
494
|
+
) : null;
|
|
495
|
+
return /* @__PURE__ */ jsx3(
|
|
496
|
+
"div",
|
|
497
|
+
{
|
|
498
|
+
className: "inline-flex items-center justify-center rounded-xl border",
|
|
499
|
+
style: {
|
|
500
|
+
padding: 16,
|
|
501
|
+
borderColor: "#E5E7EB",
|
|
502
|
+
backgroundColor: "#FFFFFF"
|
|
503
|
+
},
|
|
504
|
+
children: /* @__PURE__ */ jsxs3("div", { className: "relative", style: { width: size, height: size }, children: [
|
|
505
|
+
/* @__PURE__ */ jsx3(QRCodeSVG, { value: depositAddress, size, level: "H" }),
|
|
506
|
+
logoOverlay
|
|
507
|
+
] })
|
|
508
|
+
}
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
DepositQRCode.displayName = "DepositQRCode";
|
|
512
|
+
|
|
513
|
+
// src/deposit/steps/crypto-transfer.tsx
|
|
514
|
+
import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
515
|
+
var CryptoAddressLoadingState = () => {
|
|
516
|
+
const labels = useLabels3();
|
|
517
|
+
const sendCryptoLabels = labels.deposit.sendCrypto;
|
|
518
|
+
return /* @__PURE__ */ jsxs4(
|
|
519
|
+
"div",
|
|
520
|
+
{
|
|
521
|
+
className: "flex w-full flex-col items-center justify-center gap-6 py-10 text-center text-agg-foreground",
|
|
522
|
+
role: "status",
|
|
523
|
+
"aria-live": "polite",
|
|
524
|
+
children: [
|
|
525
|
+
/* @__PURE__ */ jsx4(
|
|
526
|
+
"span",
|
|
527
|
+
{
|
|
528
|
+
className: "h-9 w-9 animate-spin rounded-full border-2 border-agg-primary/25 border-t-agg-primary",
|
|
529
|
+
"aria-hidden": "true"
|
|
530
|
+
}
|
|
531
|
+
),
|
|
532
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex w-full flex-col items-center gap-2", children: [
|
|
533
|
+
/* @__PURE__ */ jsx4("p", { className: "text-agg-base font-agg-bold leading-agg-6", children: sendCryptoLabels.addressLoadingTitle }),
|
|
534
|
+
/* @__PURE__ */ jsx4("p", { className: "max-w-[300px] text-agg-sm leading-agg-5", children: sendCryptoLabels.addressLoadingDescription })
|
|
535
|
+
] })
|
|
536
|
+
]
|
|
537
|
+
}
|
|
538
|
+
);
|
|
539
|
+
};
|
|
540
|
+
var CryptoTransferStep = ({
|
|
541
|
+
tokenOptions,
|
|
542
|
+
networkOptions,
|
|
543
|
+
selectedToken,
|
|
544
|
+
selectedNetwork,
|
|
545
|
+
depositAddress,
|
|
546
|
+
minDeposit,
|
|
547
|
+
feeEstimate,
|
|
548
|
+
eta,
|
|
549
|
+
isLoadingAddress,
|
|
550
|
+
addressError,
|
|
551
|
+
onBack,
|
|
552
|
+
onTokenChange,
|
|
553
|
+
onNetworkChange,
|
|
554
|
+
onCopyAddress,
|
|
555
|
+
onDone
|
|
556
|
+
}) => {
|
|
557
|
+
var _a;
|
|
558
|
+
const labels = useLabels3();
|
|
559
|
+
const [isCopied, setIsCopied] = useState2(false);
|
|
560
|
+
const handleCopy = useCallback(() => {
|
|
561
|
+
onCopyAddress();
|
|
562
|
+
setIsCopied(true);
|
|
563
|
+
window.setTimeout(() => setIsCopied(false), 2e3);
|
|
564
|
+
}, [onCopyAddress]);
|
|
565
|
+
const selectedNetworkOption = networkOptions.find((n) => n.value === selectedNetwork);
|
|
566
|
+
const networkLogoUrl = (_a = selectedNetworkOption == null ? void 0 : selectedNetworkOption.iconUrl) != null ? _a : "";
|
|
567
|
+
const networkLogo = selectedNetworkOption == null ? void 0 : selectedNetworkOption.icon;
|
|
568
|
+
return /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
569
|
+
/* @__PURE__ */ jsx4(
|
|
570
|
+
Modal.Header,
|
|
571
|
+
{
|
|
572
|
+
title: labels.deposit.sendCrypto.title,
|
|
573
|
+
hideBorder: true,
|
|
574
|
+
leftElement: /* @__PURE__ */ jsx4(
|
|
575
|
+
"button",
|
|
576
|
+
{
|
|
577
|
+
type: "button",
|
|
578
|
+
className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
|
|
579
|
+
onClick: onBack,
|
|
580
|
+
"aria-label": "Go back",
|
|
581
|
+
children: /* @__PURE__ */ jsx4(ChevronLeftIcon, { className: "h-6 w-6" })
|
|
582
|
+
}
|
|
583
|
+
)
|
|
584
|
+
}
|
|
585
|
+
),
|
|
586
|
+
/* @__PURE__ */ jsx4(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-7", children: [
|
|
587
|
+
/* @__PURE__ */ jsx4("div", { className: "flex flex-col gap-5", children: /* @__PURE__ */ jsxs4("div", { className: "flex gap-5", children: [
|
|
588
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-1 flex-col gap-2 min-w-0", children: [
|
|
589
|
+
/* @__PURE__ */ jsx4("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.sendCrypto.tokenLabel }),
|
|
590
|
+
/* @__PURE__ */ jsx4(
|
|
591
|
+
Select,
|
|
592
|
+
{
|
|
593
|
+
items: tokenOptions,
|
|
594
|
+
value: selectedToken,
|
|
595
|
+
onChange: onTokenChange,
|
|
596
|
+
ariaLabel: labels.deposit.sendCrypto.tokenLabel
|
|
597
|
+
}
|
|
598
|
+
)
|
|
599
|
+
] }),
|
|
600
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-1 flex-col gap-2 min-w-0", children: [
|
|
601
|
+
/* @__PURE__ */ jsx4("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.sendCrypto.networkLabel }),
|
|
602
|
+
/* @__PURE__ */ jsx4(
|
|
603
|
+
Select,
|
|
604
|
+
{
|
|
605
|
+
items: networkOptions,
|
|
606
|
+
value: selectedNetwork,
|
|
607
|
+
onChange: onNetworkChange,
|
|
608
|
+
ariaLabel: labels.deposit.sendCrypto.networkLabel
|
|
609
|
+
}
|
|
610
|
+
)
|
|
611
|
+
] })
|
|
612
|
+
] }) }),
|
|
613
|
+
/* @__PURE__ */ jsx4("div", { className: "mx-auto", children: isLoadingAddress ? /* @__PURE__ */ jsx4(CryptoAddressLoadingState, {}) : addressError ? /* @__PURE__ */ jsx4("div", { className: "flex h-[192px] w-[192px] items-center justify-center rounded-xl border border-agg-separator bg-agg-secondary", children: /* @__PURE__ */ jsx4("p", { className: "agg-type-label text-center text-agg-error px-3", children: addressError }) }) : /* @__PURE__ */ jsx4(
|
|
614
|
+
DepositQRCode,
|
|
615
|
+
{
|
|
616
|
+
depositAddress,
|
|
617
|
+
networkLogoUrl,
|
|
618
|
+
networkLogo
|
|
619
|
+
}
|
|
620
|
+
) }),
|
|
621
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-3", children: [
|
|
622
|
+
/* @__PURE__ */ jsx4("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.sendCrypto.depositAddressLabel }),
|
|
623
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 rounded border border-agg-separator bg-agg-secondary h-10 px-3", children: [
|
|
624
|
+
isLoadingAddress ? /* @__PURE__ */ jsx4("div", { className: "h-4 flex-1 animate-pulse rounded bg-agg-muted-foreground/20" }) : /* @__PURE__ */ jsx4("p", { className: "agg-type-body flex-1 min-w-0 truncate text-agg-foreground", children: depositAddress }),
|
|
625
|
+
/* @__PURE__ */ jsxs4(
|
|
626
|
+
"button",
|
|
627
|
+
{
|
|
628
|
+
type: "button",
|
|
629
|
+
disabled: isLoadingAddress || !!addressError || !depositAddress,
|
|
630
|
+
className: "shrink-0 inline-flex items-center gap-1 text-agg-primary hover:text-agg-primary/80 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",
|
|
631
|
+
onClick: handleCopy,
|
|
632
|
+
children: [
|
|
633
|
+
isCopied ? /* @__PURE__ */ jsx4(CheckCircleIcon, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx4(CopyIcon, { className: "h-4 w-4" }),
|
|
634
|
+
/* @__PURE__ */ jsx4("span", { className: "agg-type-label-strong", children: isCopied ? labels.deposit.sendCrypto.copied : labels.deposit.sendCrypto.copy })
|
|
635
|
+
]
|
|
636
|
+
}
|
|
637
|
+
)
|
|
638
|
+
] }),
|
|
639
|
+
/* @__PURE__ */ jsx4("p", { className: "agg-type-label text-agg-foreground", children: `${labels.deposit.sendCrypto.minDepositPrefix} ${minDeposit} \xB7 ${labels.deposit.walletFlow.feePrefix} ${feeEstimate} \xB7 ${eta}` })
|
|
640
|
+
] }),
|
|
641
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-start gap-3 rounded-lg bg-agg-secondary-hover p-3", children: [
|
|
642
|
+
/* @__PURE__ */ jsx4(WarningIcon, { className: "h-4 w-4 text-agg-muted-foreground mt-0.5" }),
|
|
643
|
+
/* @__PURE__ */ jsx4("p", { className: "text-agg-xs leading-agg-4 text-agg-foreground", children: labels.deposit.sendCrypto.warning })
|
|
644
|
+
] }),
|
|
645
|
+
/* @__PURE__ */ jsx4(
|
|
646
|
+
Button,
|
|
647
|
+
{
|
|
648
|
+
variant: "secondary",
|
|
649
|
+
size: "large",
|
|
650
|
+
className: "w-[120px] self-center",
|
|
651
|
+
onClick: onDone,
|
|
652
|
+
children: labels.deposit.done
|
|
653
|
+
}
|
|
654
|
+
)
|
|
655
|
+
] }) })
|
|
656
|
+
] });
|
|
657
|
+
};
|
|
658
|
+
|
|
659
|
+
// src/deposit/steps/wallet-form.tsx
|
|
660
|
+
import { useLabels as useLabels4 } from "@agg-build/hooks";
|
|
661
|
+
import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
662
|
+
var WalletFormStep = ({
|
|
663
|
+
walletLabel,
|
|
664
|
+
walletBalance,
|
|
665
|
+
isBalanceLoading = false,
|
|
666
|
+
tokenOptions,
|
|
667
|
+
networkOptions,
|
|
668
|
+
selectedToken,
|
|
669
|
+
selectedNetwork,
|
|
670
|
+
amount,
|
|
671
|
+
isSubmitting = false,
|
|
672
|
+
formErrorMessage,
|
|
673
|
+
formErrorTone = "error",
|
|
674
|
+
estimatedReceive,
|
|
675
|
+
feeEstimate,
|
|
676
|
+
eta,
|
|
677
|
+
onBack,
|
|
678
|
+
onTokenChange,
|
|
679
|
+
onNetworkChange,
|
|
680
|
+
onAmountChange,
|
|
681
|
+
onMax,
|
|
682
|
+
onConfirm
|
|
683
|
+
}) => {
|
|
684
|
+
const labels = useLabels4();
|
|
685
|
+
const isConfirmEnabled = !isSubmitting && !isBalanceLoading && Number(amount) > 0 && Number(amount) <= walletBalance;
|
|
686
|
+
return /* @__PURE__ */ jsxs5(Fragment4, { children: [
|
|
687
|
+
/* @__PURE__ */ jsx5(
|
|
688
|
+
Modal.Header,
|
|
689
|
+
{
|
|
690
|
+
title: labels.deposit.walletFlow.title,
|
|
691
|
+
hideBorder: true,
|
|
692
|
+
leftElement: /* @__PURE__ */ jsx5(
|
|
693
|
+
"button",
|
|
694
|
+
{
|
|
695
|
+
type: "button",
|
|
696
|
+
className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
|
|
697
|
+
onClick: onBack,
|
|
698
|
+
"aria-label": "Go back",
|
|
699
|
+
children: /* @__PURE__ */ jsx5(ChevronLeftIcon, { className: "h-6 w-6" })
|
|
700
|
+
}
|
|
701
|
+
)
|
|
702
|
+
}
|
|
703
|
+
),
|
|
704
|
+
/* @__PURE__ */ jsx5(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-7", children: [
|
|
705
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between", children: [
|
|
706
|
+
/* @__PURE__ */ jsx5("p", { className: "agg-type-label text-agg-foreground", children: walletLabel }),
|
|
707
|
+
/* @__PURE__ */ jsxs5("p", { className: "agg-type-label text-agg-muted-foreground", children: [
|
|
708
|
+
labels.deposit.balanceLabel,
|
|
709
|
+
" ",
|
|
710
|
+
isBalanceLoading ? /* @__PURE__ */ jsx5(LoadingIcon, { size: "small" }) : formatCompactUsd(walletBalance)
|
|
711
|
+
] })
|
|
712
|
+
] }),
|
|
713
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-5", children: [
|
|
714
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex gap-5", children: [
|
|
715
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex flex-1 flex-col gap-2 min-w-0", children: [
|
|
716
|
+
/* @__PURE__ */ jsx5("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.walletFlow.tokenLabel }),
|
|
717
|
+
/* @__PURE__ */ jsx5(
|
|
718
|
+
Select,
|
|
719
|
+
{
|
|
720
|
+
items: tokenOptions,
|
|
721
|
+
value: selectedToken,
|
|
722
|
+
onChange: onTokenChange,
|
|
723
|
+
ariaLabel: labels.deposit.walletFlow.tokenLabel
|
|
724
|
+
}
|
|
725
|
+
)
|
|
726
|
+
] }),
|
|
727
|
+
networkOptions.length > 1 ? /* @__PURE__ */ jsxs5("div", { className: "flex flex-1 flex-col gap-2 min-w-0", children: [
|
|
728
|
+
/* @__PURE__ */ jsx5("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.walletFlow.networkLabel }),
|
|
729
|
+
/* @__PURE__ */ jsx5(
|
|
730
|
+
Select,
|
|
731
|
+
{
|
|
732
|
+
items: networkOptions,
|
|
733
|
+
value: selectedNetwork,
|
|
734
|
+
onChange: onNetworkChange,
|
|
735
|
+
ariaLabel: labels.deposit.walletFlow.networkLabel
|
|
736
|
+
}
|
|
737
|
+
)
|
|
738
|
+
] }) : null
|
|
739
|
+
] }),
|
|
740
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2", children: [
|
|
741
|
+
/* @__PURE__ */ jsx5("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.walletFlow.amountLabel }),
|
|
742
|
+
/* @__PURE__ */ jsxs5(
|
|
743
|
+
"div",
|
|
744
|
+
{
|
|
745
|
+
className: cn(
|
|
746
|
+
"flex items-center gap-2",
|
|
747
|
+
"rounded border border-agg-separator bg-agg-secondary",
|
|
748
|
+
"h-10 px-3"
|
|
749
|
+
),
|
|
750
|
+
children: [
|
|
751
|
+
/* @__PURE__ */ jsx5(
|
|
752
|
+
"input",
|
|
753
|
+
{
|
|
754
|
+
type: "text",
|
|
755
|
+
inputMode: "decimal",
|
|
756
|
+
"aria-label": labels.deposit.walletFlow.amountLabel,
|
|
757
|
+
className: "agg-type-body w-full bg-transparent outline-none text-agg-foreground",
|
|
758
|
+
placeholder: "0.00",
|
|
759
|
+
value: amount,
|
|
760
|
+
onChange: (event) => onAmountChange(event.target.value)
|
|
761
|
+
}
|
|
762
|
+
),
|
|
763
|
+
/* @__PURE__ */ jsx5(
|
|
764
|
+
"button",
|
|
765
|
+
{
|
|
766
|
+
type: "button",
|
|
767
|
+
className: "shrink-0 text-agg-sm font-agg-bold leading-agg-5 text-agg-primary transition-colors hover:text-agg-primary/80 cursor-pointer",
|
|
768
|
+
onClick: onMax,
|
|
769
|
+
"aria-label": labels.deposit.walletFlow.max,
|
|
770
|
+
children: labels.deposit.walletFlow.max
|
|
771
|
+
}
|
|
772
|
+
)
|
|
773
|
+
]
|
|
774
|
+
}
|
|
775
|
+
)
|
|
776
|
+
] }),
|
|
777
|
+
estimatedReceive && feeEstimate && eta ? /* @__PURE__ */ jsx5("p", { className: "agg-type-label text-agg-foreground", children: `\u2248 ${estimatedReceive} \xB7 ${labels.deposit.walletFlow.feePrefix} ${feeEstimate} \xB7 ${eta}` }) : null,
|
|
778
|
+
formErrorMessage ? /* @__PURE__ */ jsxs5(
|
|
779
|
+
"div",
|
|
780
|
+
{
|
|
781
|
+
className: cn(
|
|
782
|
+
"flex items-start gap-2",
|
|
783
|
+
formErrorTone === "warning" ? "text-agg-warning" : "text-agg-error"
|
|
784
|
+
),
|
|
785
|
+
children: [
|
|
786
|
+
/* @__PURE__ */ jsx5(WarningIcon, { className: "mt-0.5 h-4 w-4 shrink-0" }),
|
|
787
|
+
/* @__PURE__ */ jsx5("p", { className: "agg-type-label", children: formErrorMessage })
|
|
788
|
+
]
|
|
789
|
+
}
|
|
790
|
+
) : null
|
|
791
|
+
] }),
|
|
792
|
+
/* @__PURE__ */ jsx5(
|
|
793
|
+
Button,
|
|
794
|
+
{
|
|
795
|
+
variant: isConfirmEnabled ? "primary" : "secondary",
|
|
796
|
+
size: "large",
|
|
797
|
+
className: "w-full",
|
|
798
|
+
disabled: !isConfirmEnabled,
|
|
799
|
+
isLoading: isSubmitting,
|
|
800
|
+
"aria-label": labels.deposit.walletFlow.confirm,
|
|
801
|
+
onClick: onConfirm,
|
|
802
|
+
children: labels.deposit.walletFlow.confirm
|
|
803
|
+
}
|
|
804
|
+
)
|
|
805
|
+
] }) })
|
|
806
|
+
] });
|
|
807
|
+
};
|
|
808
|
+
|
|
809
|
+
// src/deposit/steps/card-provider.tsx
|
|
810
|
+
import { useLabels as useLabels5 } from "@agg-build/hooks";
|
|
811
|
+
import { Fragment as Fragment5, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
812
|
+
var CardProviderItem = ({ provider, onSelect }) => {
|
|
813
|
+
const labels = useLabels5();
|
|
814
|
+
const badgeText = provider.badge === "best" ? labels.deposit.cardFlow.providerBadges.best : provider.badge === "low-kyc" ? labels.deposit.cardFlow.providerBadges.lowKyc : void 0;
|
|
815
|
+
return /* @__PURE__ */ jsx6(
|
|
816
|
+
"button",
|
|
817
|
+
{
|
|
818
|
+
type: "button",
|
|
819
|
+
className: "w-full rounded-xl border border-agg-separator px-4 py-3 text-left bg-agg-secondary hover:bg-agg-secondary-hover transition-colors cursor-pointer",
|
|
820
|
+
onClick: () => onSelect(provider.id),
|
|
821
|
+
children: /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-4", children: [
|
|
822
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
|
|
823
|
+
/* @__PURE__ */ jsx6("p", { className: "text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: provider.name }),
|
|
824
|
+
badgeText ? /* @__PURE__ */ jsx6(
|
|
825
|
+
"span",
|
|
826
|
+
{
|
|
827
|
+
className: `rounded border px-2 py-[2px] text-[10px] leading-[14px] font-agg-bold uppercase ${provider.badge === "best" ? "border-agg-primary/50 text-agg-primary bg-agg-secondary" : "border-agg-separator text-agg-foreground bg-agg-secondary"}`,
|
|
828
|
+
children: badgeText
|
|
829
|
+
}
|
|
830
|
+
) : null
|
|
831
|
+
] }),
|
|
832
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-4", children: [
|
|
833
|
+
/* @__PURE__ */ jsxs6("div", { className: "text-right", children: [
|
|
834
|
+
/* @__PURE__ */ jsx6("p", { className: "agg-type-body text-agg-foreground", children: provider.quote }),
|
|
835
|
+
/* @__PURE__ */ jsxs6("p", { className: "agg-type-label text-agg-muted-foreground", children: [
|
|
836
|
+
labels.deposit.cardFlow.feeLabel,
|
|
837
|
+
" ",
|
|
838
|
+
provider.fee
|
|
839
|
+
] })
|
|
840
|
+
] }),
|
|
841
|
+
/* @__PURE__ */ jsx6(ChevronRightIcon, { className: "h-5 w-5 text-agg-muted-foreground" })
|
|
842
|
+
] })
|
|
843
|
+
] })
|
|
844
|
+
}
|
|
845
|
+
);
|
|
846
|
+
};
|
|
847
|
+
var CardProviderStep = ({
|
|
848
|
+
token,
|
|
849
|
+
amount,
|
|
850
|
+
currency,
|
|
851
|
+
providers,
|
|
852
|
+
isLoading,
|
|
853
|
+
error,
|
|
854
|
+
sessionError,
|
|
855
|
+
onBack,
|
|
856
|
+
onSelectProvider,
|
|
857
|
+
onRetry
|
|
858
|
+
}) => {
|
|
859
|
+
const labels = useLabels5();
|
|
860
|
+
return /* @__PURE__ */ jsxs6(Fragment5, { children: [
|
|
861
|
+
/* @__PURE__ */ jsx6(
|
|
862
|
+
Modal.Header,
|
|
863
|
+
{
|
|
864
|
+
title: labels.deposit.cardFlow.selectProviderTitle,
|
|
865
|
+
hideBorder: true,
|
|
866
|
+
leftElement: /* @__PURE__ */ jsx6(
|
|
867
|
+
"button",
|
|
868
|
+
{
|
|
869
|
+
type: "button",
|
|
870
|
+
className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
|
|
871
|
+
onClick: onBack,
|
|
872
|
+
"aria-label": labels.deposit.back,
|
|
873
|
+
children: /* @__PURE__ */ jsx6(ChevronLeftIcon, { className: "h-6 w-6" })
|
|
874
|
+
}
|
|
875
|
+
)
|
|
876
|
+
}
|
|
877
|
+
),
|
|
878
|
+
/* @__PURE__ */ jsx6(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-4", children: [
|
|
879
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1.5", children: [
|
|
880
|
+
/* @__PURE__ */ jsx6(UsdcIcon, { className: "h-4 w-4 shrink-0" }),
|
|
881
|
+
/* @__PURE__ */ jsx6("span", { className: "agg-type-body font-agg-bold text-agg-foreground", children: token }),
|
|
882
|
+
/* @__PURE__ */ jsxs6("span", { className: "agg-type-body text-agg-foreground", children: [
|
|
883
|
+
"$",
|
|
884
|
+
amount,
|
|
885
|
+
" ",
|
|
886
|
+
currency
|
|
887
|
+
] })
|
|
888
|
+
] }),
|
|
889
|
+
isLoading ? /* @__PURE__ */ jsxs6("div", { className: "flex min-h-[200px] flex-col items-center justify-center gap-3", children: [
|
|
890
|
+
/* @__PURE__ */ jsx6(LoadingIcon, { variant: "prominent" }),
|
|
891
|
+
/* @__PURE__ */ jsx6("p", { className: "agg-type-body text-agg-foreground", children: labels.deposit.cardFlow.loadingQuotes })
|
|
892
|
+
] }) : error ? /* @__PURE__ */ jsxs6("div", { className: "flex min-h-[200px] flex-col items-center justify-center gap-6 px-2 text-center", children: [
|
|
893
|
+
/* @__PURE__ */ jsx6(
|
|
894
|
+
Icon,
|
|
895
|
+
{
|
|
896
|
+
name: "quotes-warning",
|
|
897
|
+
size: "large",
|
|
898
|
+
className: "!h-9 !w-9 shrink-0 text-agg-muted-foreground",
|
|
899
|
+
color: "currentColor"
|
|
900
|
+
}
|
|
901
|
+
),
|
|
902
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex max-w-[320px] flex-col gap-2", children: [
|
|
903
|
+
/* @__PURE__ */ jsx6("p", { className: "text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: labels.deposit.cardFlow.errorLoadingQuotesTitle }),
|
|
904
|
+
/* @__PURE__ */ jsx6("p", { className: "agg-type-body text-agg-muted-foreground", children: labels.deposit.cardFlow.errorLoadingQuotesDescription })
|
|
905
|
+
] }),
|
|
906
|
+
onRetry ? /* @__PURE__ */ jsx6(Button, { variant: "secondary", size: "medium", onClick: onRetry, children: labels.deposit.cardFlow.retry }) : null
|
|
907
|
+
] }) : providers.length === 0 ? /* @__PURE__ */ jsx6("div", { className: "flex min-h-[200px] items-center justify-center", children: /* @__PURE__ */ jsx6("p", { className: "agg-type-body text-agg-muted-foreground", children: labels.deposit.cardFlow.noQuotes }) }) : /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-4", children: [
|
|
908
|
+
providers.map((provider) => /* @__PURE__ */ jsx6(
|
|
909
|
+
CardProviderItem,
|
|
910
|
+
{
|
|
911
|
+
provider,
|
|
912
|
+
onSelect: onSelectProvider
|
|
913
|
+
},
|
|
914
|
+
provider.id
|
|
915
|
+
)),
|
|
916
|
+
sessionError ? /* @__PURE__ */ jsx6("p", { className: "agg-type-label text-agg-error text-center", children: sessionError }) : null
|
|
917
|
+
] })
|
|
918
|
+
] }) })
|
|
919
|
+
] });
|
|
920
|
+
};
|
|
921
|
+
|
|
922
|
+
// src/deposit/steps/card-payment-pending.tsx
|
|
923
|
+
import { useLabels as useLabels6 } from "@agg-build/hooks";
|
|
924
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
925
|
+
var CardPaymentPendingStep = ({
|
|
926
|
+
providerName,
|
|
927
|
+
onClose,
|
|
928
|
+
onViewActivity,
|
|
929
|
+
onChooseAnotherProvider
|
|
930
|
+
}) => {
|
|
931
|
+
const labels = useLabels6();
|
|
932
|
+
return /* @__PURE__ */ jsx7("div", { className: "relative", children: /* @__PURE__ */ jsxs7(Modal.Body, { classNames: { root: "px-5 py-8 sm:px-8 sm:py-10" }, children: [
|
|
933
|
+
/* @__PURE__ */ jsx7(
|
|
934
|
+
"button",
|
|
935
|
+
{
|
|
936
|
+
type: "button",
|
|
937
|
+
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors cursor-pointer hover:text-agg-foreground/80",
|
|
938
|
+
onClick: onClose,
|
|
939
|
+
"aria-label": labels.common.close,
|
|
940
|
+
children: /* @__PURE__ */ jsx7(CloseIcon, { className: "h-6 w-6" })
|
|
941
|
+
}
|
|
942
|
+
),
|
|
943
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex flex-col items-center gap-8", children: [
|
|
944
|
+
/* @__PURE__ */ jsx7("div", { className: "flex h-[60px] w-[60px] items-center justify-center text-agg-muted-foreground", children: /* @__PURE__ */ jsx7(ExternalLinkIcon, { className: "h-[60px] w-[60px]" }) }),
|
|
945
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
946
|
+
/* @__PURE__ */ jsx7("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: labels.deposit.cardFlow.pendingTitle(providerName) }),
|
|
947
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-type-body text-agg-foreground", children: labels.deposit.cardFlow.pendingDescription })
|
|
948
|
+
] }),
|
|
949
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-start justify-center gap-3", children: [
|
|
950
|
+
/* @__PURE__ */ jsx7(Button, { variant: "secondary", size: "large", className: "w-[120px]", onClick: onClose, children: labels.common.close }),
|
|
951
|
+
/* @__PURE__ */ jsx7(Button, { variant: "primary", size: "large", onClick: onViewActivity, children: labels.deposit.cardFlow.viewActivity })
|
|
952
|
+
] }),
|
|
953
|
+
/* @__PURE__ */ jsx7(
|
|
954
|
+
"button",
|
|
955
|
+
{
|
|
956
|
+
type: "button",
|
|
957
|
+
className: "agg-type-body font-agg-bold text-agg-primary transition-colors cursor-pointer hover:text-agg-primary/80",
|
|
958
|
+
onClick: onChooseAnotherProvider,
|
|
959
|
+
children: labels.deposit.cardFlow.chooseAnotherProvider
|
|
960
|
+
}
|
|
961
|
+
)
|
|
962
|
+
] })
|
|
963
|
+
] }) });
|
|
964
|
+
};
|
|
965
|
+
|
|
966
|
+
// src/deposit/steps/card-purchase-success.tsx
|
|
967
|
+
import { useLabels as useLabels7 } from "@agg-build/hooks";
|
|
968
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
969
|
+
var SummaryRow = ({ label, value }) => /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between border-b border-agg-separator py-2 last:border-b-0", children: [
|
|
970
|
+
/* @__PURE__ */ jsx8("p", { className: "text-[12px] leading-4 font-agg-bold uppercase text-agg-muted-foreground", children: label }),
|
|
971
|
+
/* @__PURE__ */ jsx8("p", { className: "agg-type-label text-agg-foreground", children: value })
|
|
972
|
+
] });
|
|
973
|
+
var CardPurchaseSuccessStep = ({
|
|
974
|
+
summary,
|
|
975
|
+
onDone,
|
|
976
|
+
onClose
|
|
977
|
+
}) => {
|
|
978
|
+
const labels = useLabels7();
|
|
979
|
+
return /* @__PURE__ */ jsx8("div", { className: "relative", children: /* @__PURE__ */ jsxs8(Modal.Body, { classNames: { root: "px-5 py-8 sm:px-8 sm:py-10" }, children: [
|
|
980
|
+
/* @__PURE__ */ jsx8(
|
|
981
|
+
"button",
|
|
982
|
+
{
|
|
983
|
+
type: "button",
|
|
984
|
+
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
985
|
+
onClick: onClose,
|
|
986
|
+
"aria-label": labels.common.close,
|
|
987
|
+
children: /* @__PURE__ */ jsx8(CloseIcon, { className: "h-6 w-6" })
|
|
988
|
+
}
|
|
989
|
+
),
|
|
990
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex flex-col items-center gap-8", children: [
|
|
991
|
+
/* @__PURE__ */ jsx8("div", { className: "flex h-[60px] w-[60px] items-center justify-center rounded-full bg-agg-success/15", children: /* @__PURE__ */ jsx8(SuccessCheckIcon, { className: "h-6 w-6 text-agg-success" }) }),
|
|
992
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
993
|
+
/* @__PURE__ */ jsx8("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: labels.deposit.cardFlow.successTitle }),
|
|
994
|
+
/* @__PURE__ */ jsx8("p", { className: "agg-type-body text-agg-foreground", children: labels.deposit.cardFlow.successDescription })
|
|
995
|
+
] }),
|
|
996
|
+
/* @__PURE__ */ jsxs8("div", { className: "w-full rounded-lg border border-agg-separator bg-agg-secondary px-3 py-1", children: [
|
|
997
|
+
/* @__PURE__ */ jsx8(
|
|
998
|
+
SummaryRow,
|
|
999
|
+
{
|
|
1000
|
+
label: labels.deposit.summary.amountReceived,
|
|
1001
|
+
value: summary.amountReceived
|
|
1002
|
+
}
|
|
1003
|
+
),
|
|
1004
|
+
/* @__PURE__ */ jsx8(SummaryRow, { label: labels.deposit.summary.network, value: summary.network }),
|
|
1005
|
+
/* @__PURE__ */ jsx8(SummaryRow, { label: labels.deposit.cardFlow.summary.fees, value: summary.fees })
|
|
1006
|
+
] }),
|
|
1007
|
+
/* @__PURE__ */ jsx8(Button, { variant: "secondary", size: "large", className: "w-[120px]", onClick: onDone, children: labels.deposit.done })
|
|
1008
|
+
] })
|
|
1009
|
+
] }) });
|
|
1010
|
+
};
|
|
1011
|
+
|
|
1012
|
+
// src/deposit/steps/wallet-processing.tsx
|
|
1013
|
+
import { useLabels as useLabels8 } from "@agg-build/hooks";
|
|
1014
|
+
import { useEffect as useEffect2 } from "react";
|
|
1015
|
+
import { Fragment as Fragment6, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1016
|
+
var WalletProcessingStep = ({
|
|
1017
|
+
steps,
|
|
1018
|
+
errorMessage,
|
|
1019
|
+
onComplete
|
|
1020
|
+
}) => {
|
|
1021
|
+
const labels = useLabels8();
|
|
1022
|
+
useEffect2(() => {
|
|
1023
|
+
const allDone = steps.length > 0 && steps.every((s) => s.status === "complete");
|
|
1024
|
+
if (allDone) {
|
|
1025
|
+
onComplete();
|
|
1026
|
+
}
|
|
1027
|
+
}, [steps, onComplete]);
|
|
1028
|
+
return /* @__PURE__ */ jsxs9(Fragment6, { children: [
|
|
1029
|
+
/* @__PURE__ */ jsx9(Modal.Header, { title: labels.deposit.processingTitle, hideBorder: true }),
|
|
1030
|
+
/* @__PURE__ */ jsx9(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-5", children: [
|
|
1031
|
+
steps.map((step) => {
|
|
1032
|
+
const isComplete = step.status === "complete";
|
|
1033
|
+
const isActive = step.status === "active";
|
|
1034
|
+
return /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-3", children: [
|
|
1035
|
+
isComplete ? /* @__PURE__ */ jsx9(CheckCircleIcon, { className: "h-4 w-4 text-agg-primary" }) : /* @__PURE__ */ jsx9(
|
|
1036
|
+
"span",
|
|
1037
|
+
{
|
|
1038
|
+
className: [
|
|
1039
|
+
"inline-block h-4 w-4 rounded-full border",
|
|
1040
|
+
isActive ? "border-2 border-agg-primary border-r-transparent animate-spin" : "",
|
|
1041
|
+
!isActive ? "border-agg-separator" : ""
|
|
1042
|
+
].join(" ")
|
|
1043
|
+
}
|
|
1044
|
+
),
|
|
1045
|
+
/* @__PURE__ */ jsx9(
|
|
1046
|
+
"p",
|
|
1047
|
+
{
|
|
1048
|
+
className: isComplete || isActive ? "agg-type-body text-agg-foreground" : "agg-type-body text-agg-muted-foreground",
|
|
1049
|
+
children: step.label
|
|
1050
|
+
}
|
|
1051
|
+
)
|
|
1052
|
+
] }, step.id);
|
|
1053
|
+
}),
|
|
1054
|
+
errorMessage ? /* @__PURE__ */ jsx9("p", { className: "agg-type-body text-agg-destructive", children: errorMessage }) : null
|
|
1055
|
+
] }) })
|
|
1056
|
+
] });
|
|
1057
|
+
};
|
|
1058
|
+
|
|
1059
|
+
// src/deposit/steps/wallet-success.tsx
|
|
1060
|
+
import { useLabels as useLabels9 } from "@agg-build/hooks";
|
|
1061
|
+
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1062
|
+
var SummaryRow2 = ({ label, value }) => /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between border-b border-agg-separator py-2 last:border-b-0", children: [
|
|
1063
|
+
/* @__PURE__ */ jsx10("p", { className: "text-[12px] leading-4 font-agg-bold uppercase text-agg-muted-foreground", children: label }),
|
|
1064
|
+
/* @__PURE__ */ jsx10("p", { className: "agg-type-label text-agg-foreground", children: value })
|
|
1065
|
+
] });
|
|
1066
|
+
var WalletSuccessStep = ({
|
|
1067
|
+
summary,
|
|
1068
|
+
onDone,
|
|
1069
|
+
onClose
|
|
1070
|
+
}) => {
|
|
1071
|
+
const labels = useLabels9();
|
|
1072
|
+
return /* @__PURE__ */ jsx10("div", { className: "relative", children: /* @__PURE__ */ jsxs10(Modal.Body, { classNames: { root: "px-5 py-8 sm:px-8 sm:py-10" }, children: [
|
|
1073
|
+
/* @__PURE__ */ jsx10(
|
|
1074
|
+
"button",
|
|
1075
|
+
{
|
|
1076
|
+
type: "button",
|
|
1077
|
+
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
1078
|
+
onClick: onClose,
|
|
1079
|
+
"aria-label": labels.common.close,
|
|
1080
|
+
children: /* @__PURE__ */ jsx10(CloseIcon, { className: "h-6 w-6" })
|
|
1081
|
+
}
|
|
1082
|
+
),
|
|
1083
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex flex-col items-center gap-8", children: [
|
|
1084
|
+
/* @__PURE__ */ jsx10("div", { className: "flex h-[60px] w-[60px] items-center justify-center rounded-full bg-agg-success/15", children: /* @__PURE__ */ jsx10(SuccessCheckIcon, { className: "h-6 w-6 text-agg-success" }) }),
|
|
1085
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
1086
|
+
/* @__PURE__ */ jsx10("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: labels.deposit.successTitle }),
|
|
1087
|
+
/* @__PURE__ */ jsx10("p", { className: "agg-type-body text-agg-foreground", children: labels.deposit.successDescription })
|
|
1088
|
+
] }),
|
|
1089
|
+
/* @__PURE__ */ jsxs10("div", { className: "w-full rounded-lg border border-agg-separator bg-agg-secondary px-3 py-1", children: [
|
|
1090
|
+
/* @__PURE__ */ jsx10(
|
|
1091
|
+
SummaryRow2,
|
|
1092
|
+
{
|
|
1093
|
+
label: labels.deposit.summary.amountReceived,
|
|
1094
|
+
value: summary.amountReceived
|
|
1095
|
+
}
|
|
1096
|
+
),
|
|
1097
|
+
/* @__PURE__ */ jsx10(SummaryRow2, { label: labels.deposit.summary.network, value: summary.network }),
|
|
1098
|
+
/* @__PURE__ */ jsx10(SummaryRow2, { label: labels.deposit.summary.fromWallet, value: summary.fromWallet }),
|
|
1099
|
+
/* @__PURE__ */ jsx10(SummaryRow2, { label: labels.deposit.summary.gasFee, value: summary.gasFee })
|
|
1100
|
+
] }),
|
|
1101
|
+
/* @__PURE__ */ jsx10(Button, { variant: "secondary", size: "large", className: "w-[120px]", onClick: onDone, children: labels.deposit.done })
|
|
1102
|
+
] })
|
|
1103
|
+
] }) });
|
|
1104
|
+
};
|
|
1105
|
+
|
|
1106
|
+
// src/deposit/index.tsx
|
|
1107
|
+
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1108
|
+
var PENDING_CARD_SESSION_KEY = "agg-pending-card-session";
|
|
1109
|
+
function savePendingCardSession(data) {
|
|
1110
|
+
try {
|
|
1111
|
+
localStorage.setItem(PENDING_CARD_SESSION_KEY, JSON.stringify(data));
|
|
1112
|
+
} catch (e) {
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
function clearPendingCardSession() {
|
|
1116
|
+
try {
|
|
1117
|
+
localStorage.removeItem(PENDING_CARD_SESSION_KEY);
|
|
1118
|
+
} catch (e) {
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
function getPendingCardSession() {
|
|
1122
|
+
try {
|
|
1123
|
+
const raw = localStorage.getItem(PENDING_CARD_SESSION_KEY);
|
|
1124
|
+
if (!raw) return null;
|
|
1125
|
+
return JSON.parse(raw);
|
|
1126
|
+
} catch (e) {
|
|
1127
|
+
return null;
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
function getDefaultProcessingSteps(transactionStatus, labels) {
|
|
1131
|
+
var _a;
|
|
1132
|
+
const defaultSteps = [
|
|
1133
|
+
{ id: "submitting", label: labels.submitting, status: "active" },
|
|
1134
|
+
{ id: "confirming", label: labels.confirming, status: "pending" }
|
|
1135
|
+
];
|
|
1136
|
+
const activeByStatus = {
|
|
1137
|
+
submitting: 0,
|
|
1138
|
+
submitted: 1,
|
|
1139
|
+
confirming: 1,
|
|
1140
|
+
error: 1
|
|
1141
|
+
};
|
|
1142
|
+
if (transactionStatus === "settled") {
|
|
1143
|
+
return defaultSteps.map((step) => __spreadProps(__spreadValues({}, step), { status: "complete" }));
|
|
1144
|
+
}
|
|
1145
|
+
const activeIndex = (_a = activeByStatus[transactionStatus != null ? transactionStatus : "submitted"]) != null ? _a : 0;
|
|
1146
|
+
return defaultSteps.map((step, index) => __spreadProps(__spreadValues({}, step), {
|
|
1147
|
+
status: index < activeIndex ? "complete" : index === activeIndex ? "active" : "pending"
|
|
1148
|
+
}));
|
|
1149
|
+
}
|
|
1150
|
+
function isControlledDepositModalProps(props) {
|
|
1151
|
+
return "walletFlow" in props;
|
|
1152
|
+
}
|
|
1153
|
+
function DepositModalSelfDriven({ open, onOpenChange }) {
|
|
1154
|
+
const depositProps = useDepositFlow({ open, onOpenChange });
|
|
1155
|
+
return /* @__PURE__ */ jsx11(DepositModalControlled, __spreadValues({}, depositProps));
|
|
1156
|
+
}
|
|
1157
|
+
function DepositModalControlled({
|
|
1158
|
+
open,
|
|
1159
|
+
onOpenChange,
|
|
1160
|
+
onSelectDepositMethod,
|
|
1161
|
+
onContinueCardDeposit,
|
|
1162
|
+
onDoneCryptoTransfer,
|
|
1163
|
+
walletFlow,
|
|
1164
|
+
onWalletAmountChange,
|
|
1165
|
+
onWalletMax,
|
|
1166
|
+
onConfirmWalletDeposit,
|
|
1167
|
+
onDoneWalletDeposit,
|
|
1168
|
+
onWalletNetworkChange,
|
|
1169
|
+
onWalletTokenChange,
|
|
1170
|
+
initialWalletChainId,
|
|
1171
|
+
connectedWalletKind,
|
|
1172
|
+
sendCryptoConfig,
|
|
1173
|
+
onDoneSendCrypto,
|
|
1174
|
+
cardFlow,
|
|
1175
|
+
onCardAmountChange,
|
|
1176
|
+
onCardCurrencyChange,
|
|
1177
|
+
onCardTokenChange,
|
|
1178
|
+
onCardNetworkChange,
|
|
1179
|
+
onSelectCardProvider,
|
|
1180
|
+
onDoneCardPurchase,
|
|
1181
|
+
onViewActivity,
|
|
1182
|
+
cardRedirectUrl,
|
|
1183
|
+
onGetCardQuotes,
|
|
1184
|
+
onCreateCardSession,
|
|
1185
|
+
pendingCardPurchaseSummary
|
|
1186
|
+
}) {
|
|
1187
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1188
|
+
const { isWeb3User } = useAggAuthState();
|
|
1189
|
+
const { walletActions } = useAggUiConfig();
|
|
1190
|
+
const labels = useLabels10();
|
|
1191
|
+
const defaultMethod = isWeb3User ? "wallet" : "crypto";
|
|
1192
|
+
const [step, setStep] = useState3(
|
|
1193
|
+
() => pendingCardPurchaseSummary ? "card-success" : "method"
|
|
1194
|
+
);
|
|
1195
|
+
const [highlightedMethod, setHighlightedMethod] = useState3(defaultMethod);
|
|
1196
|
+
const walletSubmitInFlightRef = useRef(false);
|
|
1197
|
+
const [isWalletSubmitting, setIsWalletSubmitting] = useState3(false);
|
|
1198
|
+
const [cardProviders, setCardProviders] = useState3([]);
|
|
1199
|
+
const [quotesLoading, setQuotesLoading] = useState3(false);
|
|
1200
|
+
const [quotesError, setQuotesError] = useState3(null);
|
|
1201
|
+
const [sessionError, setSessionError] = useState3(null);
|
|
1202
|
+
const [pendingProviderName, setPendingProviderName] = useState3("");
|
|
1203
|
+
useEffect3(() => {
|
|
1204
|
+
if (pendingCardPurchaseSummary) {
|
|
1205
|
+
clearPendingCardSession();
|
|
1206
|
+
setStep("card-success");
|
|
1207
|
+
}
|
|
1208
|
+
}, [pendingCardPurchaseSummary]);
|
|
1209
|
+
const [walletChainId, setWalletChainId] = useState3("");
|
|
1210
|
+
const [walletToken, setWalletToken] = useState3("");
|
|
1211
|
+
const [sendChainId, setSendChainId] = useState3("");
|
|
1212
|
+
const [sendToken, setSendToken] = useState3("");
|
|
1213
|
+
const {
|
|
1214
|
+
isReady,
|
|
1215
|
+
isTimedOut,
|
|
1216
|
+
error: addrError,
|
|
1217
|
+
supportedChains,
|
|
1218
|
+
getAddress
|
|
1219
|
+
} = useDepositAddresses({ enabled: open });
|
|
1220
|
+
const fallbackNetworkOptions = useMemo(() => mapNetworksToOptions(), []);
|
|
1221
|
+
const networkOptions = useMemo(() => {
|
|
1222
|
+
if (!(supportedChains == null ? void 0 : supportedChains.length)) return fallbackNetworkOptions;
|
|
1223
|
+
return withNetworkIcons(
|
|
1224
|
+
supportedChains.map((c) => ({ value: String(c.chainId), label: c.name }))
|
|
1225
|
+
);
|
|
1226
|
+
}, [supportedChains, fallbackNetworkOptions]);
|
|
1227
|
+
const walletNetworkOptions = useMemo(() => {
|
|
1228
|
+
if (!(supportedChains == null ? void 0 : supportedChains.length) || !connectedWalletKind) return networkOptions;
|
|
1229
|
+
const filtered = supportedChains.filter(
|
|
1230
|
+
(c) => connectedWalletKind === "solana" ? SVM_CHAIN_IDS.has(c.chainId) : !SVM_CHAIN_IDS.has(c.chainId)
|
|
1231
|
+
);
|
|
1232
|
+
if (filtered.length === 0) return networkOptions;
|
|
1233
|
+
return withNetworkIcons(filtered.map((c) => ({ value: String(c.chainId), label: c.name })));
|
|
1234
|
+
}, [supportedChains, networkOptions, connectedWalletKind]);
|
|
1235
|
+
const walletTokenOptions = useMemo(() => {
|
|
1236
|
+
const chain = supportedChains == null ? void 0 : supportedChains.find((c) => String(c.chainId) === walletChainId);
|
|
1237
|
+
if (!chain) return withTokenIcons(DEFAULT_CURRENCY_OPTIONS);
|
|
1238
|
+
return withTokenIcons(chain.tokens.map((t) => ({ value: t.symbol, label: t.symbol })));
|
|
1239
|
+
}, [supportedChains, walletChainId]);
|
|
1240
|
+
const sendTokenOptions = useMemo(() => {
|
|
1241
|
+
const chain = supportedChains == null ? void 0 : supportedChains.find((c) => String(c.chainId) === sendChainId);
|
|
1242
|
+
if (!chain) return withTokenIcons(DEFAULT_CURRENCY_OPTIONS);
|
|
1243
|
+
return withTokenIcons(chain.tokens.map((t) => ({ value: t.symbol, label: t.symbol })));
|
|
1244
|
+
}, [supportedChains, sendChainId]);
|
|
1245
|
+
useEffect3(() => {
|
|
1246
|
+
if (walletNetworkOptions.length > 0) {
|
|
1247
|
+
if (!walletChainId || !walletNetworkOptions.some((o) => o.value === walletChainId)) {
|
|
1248
|
+
const preferred = initialWalletChainId && walletNetworkOptions.some((o) => o.value === initialWalletChainId) ? initialWalletChainId : walletNetworkOptions[0].value;
|
|
1249
|
+
setWalletChainId(preferred);
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
}, [walletNetworkOptions, walletChainId, initialWalletChainId]);
|
|
1253
|
+
useEffect3(() => {
|
|
1254
|
+
if (networkOptions.length > 0) {
|
|
1255
|
+
if (!sendChainId || !networkOptions.some((o) => o.value === sendChainId)) {
|
|
1256
|
+
setSendChainId(networkOptions[0].value);
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
}, [networkOptions, sendChainId]);
|
|
1260
|
+
useEffect3(() => {
|
|
1261
|
+
if (walletTokenOptions.length > 0) setWalletToken(walletTokenOptions[0].value);
|
|
1262
|
+
}, [walletTokenOptions]);
|
|
1263
|
+
useEffect3(() => {
|
|
1264
|
+
if (sendTokenOptions.length > 0) setSendToken(sendTokenOptions[0].value);
|
|
1265
|
+
}, [sendTokenOptions]);
|
|
1266
|
+
useEffect3(() => {
|
|
1267
|
+
if (walletChainId) {
|
|
1268
|
+
onWalletNetworkChange == null ? void 0 : onWalletNetworkChange(walletChainId);
|
|
1269
|
+
}
|
|
1270
|
+
}, [walletChainId, onWalletNetworkChange]);
|
|
1271
|
+
useEffect3(() => {
|
|
1272
|
+
if (walletToken) {
|
|
1273
|
+
onWalletTokenChange == null ? void 0 : onWalletTokenChange(walletToken);
|
|
1274
|
+
}
|
|
1275
|
+
}, [walletToken, onWalletTokenChange]);
|
|
1276
|
+
const sendChainIdNum = sendChainId ? Number(sendChainId) : void 0;
|
|
1277
|
+
const depositAddress = (_a = getAddress(sendChainIdNum)) != null ? _a : "";
|
|
1278
|
+
const isLoadingAddress = open && !isReady && !isTimedOut && !addrError;
|
|
1279
|
+
const addressError = isTimedOut && !isReady ? "Address generation timed out. Please try again." : addrError && !isReady ? "Failed to load deposit address." : void 0;
|
|
1280
|
+
const usesTransactionStatus = walletFlow.transactionStatus !== void 0;
|
|
1281
|
+
const processingStatus = isWalletSubmitting ? "submitting" : walletFlow.transactionStatus;
|
|
1282
|
+
const processingSteps = usesTransactionStatus ? (_b = walletFlow.processingSteps) != null ? _b : getDefaultProcessingSteps(processingStatus, labels.deposit.processingSteps) : (_c = walletFlow.processingSteps) != null ? _c : getDefaultProcessingSteps(processingStatus, labels.deposit.processingSteps);
|
|
1283
|
+
const selectedNetworkLabel = (_e = (_d = networkOptions.find((n) => n.value === walletChainId)) == null ? void 0 : _d.label) != null ? _e : "";
|
|
1284
|
+
const resolvedSuccessSummary = __spreadValues({
|
|
1285
|
+
amountReceived: `+${walletFlow.amount} ${walletToken}`,
|
|
1286
|
+
network: selectedNetworkLabel,
|
|
1287
|
+
fromWallet: walletFlow.walletLabel,
|
|
1288
|
+
gasFee: ""
|
|
1289
|
+
}, walletFlow.successSummary);
|
|
1290
|
+
useEffect3(() => {
|
|
1291
|
+
if (step === "wallet-processing" && !isWalletSubmitting && walletFlow.transactionStatus === "settled") {
|
|
1292
|
+
setStep("wallet-success");
|
|
1293
|
+
}
|
|
1294
|
+
}, [isWalletSubmitting, step, walletFlow.transactionStatus]);
|
|
1295
|
+
const cardTokenOptions = withTokenIcons(
|
|
1296
|
+
mergeSelectOptionsUnique(cardFlow == null ? void 0 : cardFlow.tokenOptions, DEFAULT_CURRENCY_OPTIONS)
|
|
1297
|
+
);
|
|
1298
|
+
const cardNetworkOptions = withNetworkIcons(
|
|
1299
|
+
mergeSelectOptionsUnique(cardFlow == null ? void 0 : cardFlow.networkOptions, CARD_NETWORK_OPTIONS)
|
|
1300
|
+
);
|
|
1301
|
+
const handleSelectMethod = (method) => {
|
|
1302
|
+
if (method === "wallet" && !isWeb3User) return;
|
|
1303
|
+
if (!isReady && (method === "wallet" || method === "crypto")) return;
|
|
1304
|
+
setHighlightedMethod(method);
|
|
1305
|
+
onSelectDepositMethod == null ? void 0 : onSelectDepositMethod(method);
|
|
1306
|
+
if (method === "wallet") {
|
|
1307
|
+
setStep("wallet-form");
|
|
1308
|
+
return;
|
|
1309
|
+
}
|
|
1310
|
+
if (method === "card") {
|
|
1311
|
+
setStep("card-deposit");
|
|
1312
|
+
} else if (method === "crypto") {
|
|
1313
|
+
setStep("crypto-transfer");
|
|
1314
|
+
}
|
|
1315
|
+
};
|
|
1316
|
+
const handleContinueCardDeposit = (amount) => __async(null, null, function* () {
|
|
1317
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
1318
|
+
onContinueCardDeposit == null ? void 0 : onContinueCardDeposit(amount);
|
|
1319
|
+
setStep("card-provider");
|
|
1320
|
+
if (onGetCardQuotes) {
|
|
1321
|
+
setQuotesLoading(true);
|
|
1322
|
+
setQuotesError(null);
|
|
1323
|
+
setCardProviders([]);
|
|
1324
|
+
try {
|
|
1325
|
+
const providers = yield onGetCardQuotes({
|
|
1326
|
+
sourceAmount: String(amount),
|
|
1327
|
+
sourceCurrencyCode: (_a2 = cardFlow == null ? void 0 : cardFlow.currency) != null ? _a2 : "USD",
|
|
1328
|
+
destinationCurrencyCode: (_d2 = (_c2 = NETWORK_TO_CURRENCY_CODE[(_b2 = cardFlow == null ? void 0 : cardFlow.selectedNetwork) != null ? _b2 : ""]) != null ? _c2 : cardFlow == null ? void 0 : cardFlow.selectedNetwork) != null ? _d2 : ""
|
|
1329
|
+
});
|
|
1330
|
+
setCardProviders(providers);
|
|
1331
|
+
} catch (err) {
|
|
1332
|
+
setQuotesError(err instanceof Error ? err.message : "Failed to load quotes");
|
|
1333
|
+
} finally {
|
|
1334
|
+
setQuotesLoading(false);
|
|
1335
|
+
}
|
|
1336
|
+
} else {
|
|
1337
|
+
setCardProviders((_e2 = cardFlow == null ? void 0 : cardFlow.providers) != null ? _e2 : []);
|
|
1338
|
+
}
|
|
1339
|
+
});
|
|
1340
|
+
const handleRetryQuotes = () => {
|
|
1341
|
+
const amount = Number(cardFlow == null ? void 0 : cardFlow.amount) || 0;
|
|
1342
|
+
if (amount > 0) {
|
|
1343
|
+
handleContinueCardDeposit(amount);
|
|
1344
|
+
}
|
|
1345
|
+
};
|
|
1346
|
+
const handleSelectProvider = (providerId) => __async(null, null, function* () {
|
|
1347
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k, _l, _m;
|
|
1348
|
+
onSelectCardProvider == null ? void 0 : onSelectCardProvider(providerId);
|
|
1349
|
+
if (onCreateCardSession) {
|
|
1350
|
+
setSessionError(null);
|
|
1351
|
+
try {
|
|
1352
|
+
const networkVal = (_a2 = cardFlow == null ? void 0 : cardFlow.selectedNetwork) != null ? _a2 : "";
|
|
1353
|
+
const numericId = Number(networkVal);
|
|
1354
|
+
const cardChainId = Number.isFinite(numericId) && numericId > 0 ? numericId : (_b2 = supportedChains == null ? void 0 : supportedChains.find((c) => c.name.toLowerCase() === networkVal.toLowerCase())) == null ? void 0 : _b2.chainId;
|
|
1355
|
+
const depositAddr = (_c2 = getAddress(cardChainId)) != null ? _c2 : "";
|
|
1356
|
+
const session = yield onCreateCardSession({
|
|
1357
|
+
serviceProvider: providerId,
|
|
1358
|
+
sourceAmount: (_d2 = cardFlow == null ? void 0 : cardFlow.amount) != null ? _d2 : "",
|
|
1359
|
+
sourceCurrencyCode: (_e2 = cardFlow == null ? void 0 : cardFlow.currency) != null ? _e2 : "USD",
|
|
1360
|
+
destinationCurrencyCode: (_f2 = NETWORK_TO_CURRENCY_CODE[networkVal]) != null ? _f2 : networkVal,
|
|
1361
|
+
walletAddress: depositAddr,
|
|
1362
|
+
redirectUrl: cardRedirectUrl
|
|
1363
|
+
});
|
|
1364
|
+
const selectedProvider = cardProviders.find((p) => p.id === providerId);
|
|
1365
|
+
const networkLabel = (_j2 = (_i2 = (_h2 = (_g2 = cardFlow == null ? void 0 : cardFlow.networkOptions) == null ? void 0 : _g2.find((o) => o.value === (cardFlow == null ? void 0 : cardFlow.selectedNetwork))) == null ? void 0 : _h2.label) != null ? _i2 : cardFlow == null ? void 0 : cardFlow.selectedNetwork) != null ? _j2 : "";
|
|
1366
|
+
savePendingCardSession({
|
|
1367
|
+
sessionId: session.id,
|
|
1368
|
+
summary: {
|
|
1369
|
+
amountReceived: (_k = selectedProvider == null ? void 0 : selectedProvider.quote) != null ? _k : "",
|
|
1370
|
+
network: networkLabel,
|
|
1371
|
+
fees: (_l = selectedProvider == null ? void 0 : selectedProvider.fee) != null ? _l : ""
|
|
1372
|
+
}
|
|
1373
|
+
});
|
|
1374
|
+
window.open(session.widgetUrl, "_blank", "noopener,noreferrer");
|
|
1375
|
+
setPendingProviderName((_m = selectedProvider == null ? void 0 : selectedProvider.name) != null ? _m : providerId);
|
|
1376
|
+
setStep("card-payment-pending");
|
|
1377
|
+
} catch (err) {
|
|
1378
|
+
setSessionError(err instanceof Error ? err.message : "Failed to create session");
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
});
|
|
1382
|
+
const handleViewActivity = () => {
|
|
1383
|
+
onViewActivity == null ? void 0 : onViewActivity();
|
|
1384
|
+
if (typeof window !== "undefined") {
|
|
1385
|
+
window.location.href = "/profile?tab=activity";
|
|
1386
|
+
}
|
|
1387
|
+
};
|
|
1388
|
+
const handleChooseAnotherProvider = () => {
|
|
1389
|
+
setCardProviders([]);
|
|
1390
|
+
setQuotesError(null);
|
|
1391
|
+
setSessionError(null);
|
|
1392
|
+
setPendingProviderName("");
|
|
1393
|
+
setStep("card-deposit");
|
|
1394
|
+
};
|
|
1395
|
+
const handleDoneCryptoTransfer = () => {
|
|
1396
|
+
onDoneCryptoTransfer == null ? void 0 : onDoneCryptoTransfer();
|
|
1397
|
+
onDoneSendCrypto == null ? void 0 : onDoneSendCrypto();
|
|
1398
|
+
};
|
|
1399
|
+
const handleDoneWalletDeposit = () => {
|
|
1400
|
+
handleOpenChange(false);
|
|
1401
|
+
onDoneWalletDeposit == null ? void 0 : onDoneWalletDeposit();
|
|
1402
|
+
};
|
|
1403
|
+
const handleDoneCardPurchase = () => {
|
|
1404
|
+
handleOpenChange(false);
|
|
1405
|
+
onDoneCardPurchase == null ? void 0 : onDoneCardPurchase();
|
|
1406
|
+
};
|
|
1407
|
+
const handleOpenChange = (isOpen) => {
|
|
1408
|
+
if (!isOpen) {
|
|
1409
|
+
setStep("method");
|
|
1410
|
+
setHighlightedMethod(defaultMethod);
|
|
1411
|
+
setWalletChainId("");
|
|
1412
|
+
setWalletToken("");
|
|
1413
|
+
setSendChainId("");
|
|
1414
|
+
setSendToken("");
|
|
1415
|
+
walletSubmitInFlightRef.current = false;
|
|
1416
|
+
setIsWalletSubmitting(false);
|
|
1417
|
+
setCardProviders([]);
|
|
1418
|
+
setQuotesLoading(false);
|
|
1419
|
+
setQuotesError(null);
|
|
1420
|
+
setSessionError(null);
|
|
1421
|
+
setPendingProviderName("");
|
|
1422
|
+
clearPendingCardSession();
|
|
1423
|
+
}
|
|
1424
|
+
onOpenChange(isOpen);
|
|
1425
|
+
};
|
|
1426
|
+
const depositModalMaxWidth = step === "method" ? "600px" : "480px";
|
|
1427
|
+
return /* @__PURE__ */ jsx11(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs11(Modal.Container, { maxWidth: depositModalMaxWidth, "aria-label": "Deposit", children: [
|
|
1428
|
+
step === "method" ? /* @__PURE__ */ jsx11(
|
|
1429
|
+
DepositMethodStep,
|
|
1430
|
+
{
|
|
1431
|
+
balance: walletFlow.balance,
|
|
1432
|
+
walletLabel: walletFlow.walletLabel,
|
|
1433
|
+
walletBalance: walletFlow.walletBalance,
|
|
1434
|
+
isWalletBalanceLoading: walletFlow.isWalletBalanceLoading,
|
|
1435
|
+
showWalletMethod: isWeb3User,
|
|
1436
|
+
highlightedMethod,
|
|
1437
|
+
depositAddressesReady: isReady,
|
|
1438
|
+
onSelectMethod: handleSelectMethod
|
|
1439
|
+
}
|
|
1440
|
+
) : null,
|
|
1441
|
+
step === "wallet-form" ? /* @__PURE__ */ jsx11(
|
|
1442
|
+
WalletFormStep,
|
|
1443
|
+
{
|
|
1444
|
+
walletLabel: walletFlow.walletLabel,
|
|
1445
|
+
walletBalance: walletFlow.walletBalance,
|
|
1446
|
+
isBalanceLoading: walletFlow.isWalletBalanceLoading,
|
|
1447
|
+
tokenOptions: walletTokenOptions,
|
|
1448
|
+
networkOptions: walletNetworkOptions,
|
|
1449
|
+
selectedToken: walletToken,
|
|
1450
|
+
selectedNetwork: walletChainId,
|
|
1451
|
+
amount: walletFlow.amount,
|
|
1452
|
+
formErrorMessage: walletFlow.formErrorMessage,
|
|
1453
|
+
formErrorTone: walletFlow.formErrorTone,
|
|
1454
|
+
estimatedReceive: walletFlow.estimatedReceive,
|
|
1455
|
+
feeEstimate: walletFlow.feeEstimate,
|
|
1456
|
+
eta: walletFlow.eta,
|
|
1457
|
+
isSubmitting: isWalletSubmitting,
|
|
1458
|
+
onBack: () => setStep("method"),
|
|
1459
|
+
onTokenChange: setWalletToken,
|
|
1460
|
+
onNetworkChange: (id) => {
|
|
1461
|
+
setWalletChainId(id);
|
|
1462
|
+
setWalletToken("");
|
|
1463
|
+
},
|
|
1464
|
+
onAmountChange: onWalletAmountChange,
|
|
1465
|
+
onMax: onWalletMax,
|
|
1466
|
+
onConfirm: () => __async(null, null, function* () {
|
|
1467
|
+
var _a2, _b2;
|
|
1468
|
+
if (walletSubmitInFlightRef.current) return;
|
|
1469
|
+
walletSubmitInFlightRef.current = true;
|
|
1470
|
+
setIsWalletSubmitting(true);
|
|
1471
|
+
setStep("wallet-processing");
|
|
1472
|
+
const walletChainIdNum = walletChainId ? Number(walletChainId) : void 0;
|
|
1473
|
+
const address = (_a2 = getAddress(walletChainIdNum)) != null ? _a2 : "";
|
|
1474
|
+
try {
|
|
1475
|
+
if (walletActions == null ? void 0 : walletActions.sendToken) {
|
|
1476
|
+
const chain = supportedChains == null ? void 0 : supportedChains.find((c) => String(c.chainId) === walletChainId);
|
|
1477
|
+
const tokenMeta = chain == null ? void 0 : chain.tokens.find((t) => t.symbol === walletToken);
|
|
1478
|
+
yield walletActions.sendToken({
|
|
1479
|
+
chainId: walletChainIdNum != null ? walletChainIdNum : 0,
|
|
1480
|
+
token: {
|
|
1481
|
+
symbol: walletToken,
|
|
1482
|
+
address: tokenMeta == null ? void 0 : tokenMeta.address,
|
|
1483
|
+
decimals: (_b2 = tokenMeta == null ? void 0 : tokenMeta.decimals) != null ? _b2 : 6
|
|
1484
|
+
},
|
|
1485
|
+
to: address,
|
|
1486
|
+
amount: walletFlow.amount
|
|
1487
|
+
});
|
|
1488
|
+
} else {
|
|
1489
|
+
yield onConfirmWalletDeposit == null ? void 0 : onConfirmWalletDeposit({
|
|
1490
|
+
address,
|
|
1491
|
+
amount: walletFlow.amount,
|
|
1492
|
+
chainId: walletChainIdNum != null ? walletChainIdNum : 0,
|
|
1493
|
+
token: walletToken
|
|
1494
|
+
});
|
|
1495
|
+
}
|
|
1496
|
+
} catch (e) {
|
|
1497
|
+
walletSubmitInFlightRef.current = false;
|
|
1498
|
+
setStep("wallet-form");
|
|
1499
|
+
} finally {
|
|
1500
|
+
setIsWalletSubmitting(false);
|
|
1501
|
+
}
|
|
1502
|
+
})
|
|
1503
|
+
}
|
|
1504
|
+
) : null,
|
|
1505
|
+
step === "wallet-processing" ? /* @__PURE__ */ jsx11(
|
|
1506
|
+
WalletProcessingStep,
|
|
1507
|
+
{
|
|
1508
|
+
steps: processingSteps,
|
|
1509
|
+
errorMessage: walletFlow.transactionStatus === "error" ? (_f = walletFlow.transactionErrorMessage) != null ? _f : "Something went wrong with the transaction." : void 0,
|
|
1510
|
+
onComplete: () => setStep("wallet-success")
|
|
1511
|
+
}
|
|
1512
|
+
) : null,
|
|
1513
|
+
step === "wallet-success" ? /* @__PURE__ */ jsx11(
|
|
1514
|
+
WalletSuccessStep,
|
|
1515
|
+
{
|
|
1516
|
+
summary: resolvedSuccessSummary,
|
|
1517
|
+
onDone: handleDoneWalletDeposit,
|
|
1518
|
+
onClose: () => handleOpenChange(false)
|
|
1519
|
+
}
|
|
1520
|
+
) : null,
|
|
1521
|
+
step === "card-deposit" && cardFlow ? /* @__PURE__ */ jsx11(
|
|
1522
|
+
CardDepositStep,
|
|
1523
|
+
{
|
|
1524
|
+
amount: cardFlow.amount,
|
|
1525
|
+
currency: cardFlow.currency,
|
|
1526
|
+
tokenOptions: cardTokenOptions,
|
|
1527
|
+
networkOptions: cardNetworkOptions,
|
|
1528
|
+
selectedToken: cardFlow.selectedToken,
|
|
1529
|
+
selectedNetwork: cardFlow.selectedNetwork,
|
|
1530
|
+
minAmount: cardFlow.minAmount,
|
|
1531
|
+
onBack: () => setStep("method"),
|
|
1532
|
+
onAmountChange: onCardAmountChange != null ? onCardAmountChange : (() => {
|
|
1533
|
+
}),
|
|
1534
|
+
onCurrencyChange: onCardCurrencyChange != null ? onCardCurrencyChange : (() => {
|
|
1535
|
+
}),
|
|
1536
|
+
onTokenChange: onCardTokenChange != null ? onCardTokenChange : (() => {
|
|
1537
|
+
}),
|
|
1538
|
+
onNetworkChange: onCardNetworkChange != null ? onCardNetworkChange : (() => {
|
|
1539
|
+
}),
|
|
1540
|
+
onContinue: handleContinueCardDeposit
|
|
1541
|
+
}
|
|
1542
|
+
) : null,
|
|
1543
|
+
step === "card-provider" && cardFlow ? /* @__PURE__ */ jsx11(
|
|
1544
|
+
CardProviderStep,
|
|
1545
|
+
{
|
|
1546
|
+
amount: cardFlow.amount,
|
|
1547
|
+
currency: cardFlow.currency,
|
|
1548
|
+
token: cardFlow.selectedToken,
|
|
1549
|
+
providers: cardProviders,
|
|
1550
|
+
isLoading: quotesLoading,
|
|
1551
|
+
error: quotesError,
|
|
1552
|
+
sessionError,
|
|
1553
|
+
onBack: () => setStep("card-deposit"),
|
|
1554
|
+
onSelectProvider: handleSelectProvider,
|
|
1555
|
+
onRetry: handleRetryQuotes
|
|
1556
|
+
}
|
|
1557
|
+
) : null,
|
|
1558
|
+
step === "card-payment-pending" ? /* @__PURE__ */ jsx11(
|
|
1559
|
+
CardPaymentPendingStep,
|
|
1560
|
+
{
|
|
1561
|
+
providerName: pendingProviderName,
|
|
1562
|
+
onClose: () => handleOpenChange(false),
|
|
1563
|
+
onViewActivity: handleViewActivity,
|
|
1564
|
+
onChooseAnotherProvider: handleChooseAnotherProvider
|
|
1565
|
+
}
|
|
1566
|
+
) : null,
|
|
1567
|
+
step === "card-success" ? /* @__PURE__ */ jsx11(
|
|
1568
|
+
CardPurchaseSuccessStep,
|
|
1569
|
+
{
|
|
1570
|
+
summary: (_g = pendingCardPurchaseSummary != null ? pendingCardPurchaseSummary : cardFlow == null ? void 0 : cardFlow.purchaseSummary) != null ? _g : {
|
|
1571
|
+
amountReceived: "",
|
|
1572
|
+
network: "",
|
|
1573
|
+
fees: ""
|
|
1574
|
+
},
|
|
1575
|
+
onClose: () => handleOpenChange(false),
|
|
1576
|
+
onDone: handleDoneCardPurchase
|
|
1577
|
+
}
|
|
1578
|
+
) : null,
|
|
1579
|
+
step === "crypto-transfer" ? /* @__PURE__ */ jsx11(
|
|
1580
|
+
CryptoTransferStep,
|
|
1581
|
+
{
|
|
1582
|
+
tokenOptions: sendTokenOptions,
|
|
1583
|
+
networkOptions,
|
|
1584
|
+
selectedToken: sendToken,
|
|
1585
|
+
selectedNetwork: sendChainId,
|
|
1586
|
+
depositAddress,
|
|
1587
|
+
minDeposit: (_h = sendCryptoConfig == null ? void 0 : sendCryptoConfig.minDeposit) != null ? _h : "$1",
|
|
1588
|
+
feeEstimate: (_i = sendCryptoConfig == null ? void 0 : sendCryptoConfig.feeEstimate) != null ? _i : "~$0.01",
|
|
1589
|
+
eta: (_j = sendCryptoConfig == null ? void 0 : sendCryptoConfig.eta) != null ? _j : "~30s",
|
|
1590
|
+
isLoadingAddress,
|
|
1591
|
+
addressError,
|
|
1592
|
+
onBack: () => setStep("method"),
|
|
1593
|
+
onTokenChange: setSendToken,
|
|
1594
|
+
onNetworkChange: (id) => {
|
|
1595
|
+
setSendChainId(id);
|
|
1596
|
+
setSendToken("");
|
|
1597
|
+
},
|
|
1598
|
+
onCopyAddress: () => {
|
|
1599
|
+
var _a2;
|
|
1600
|
+
if (depositAddress) (_a2 = navigator.clipboard) == null ? void 0 : _a2.writeText(depositAddress).catch(() => {
|
|
1601
|
+
});
|
|
1602
|
+
},
|
|
1603
|
+
onDone: handleDoneCryptoTransfer
|
|
1604
|
+
}
|
|
1605
|
+
) : null
|
|
1606
|
+
] }) });
|
|
1607
|
+
}
|
|
1608
|
+
var DepositModal = (props) => {
|
|
1609
|
+
if (!isControlledDepositModalProps(props)) {
|
|
1610
|
+
return /* @__PURE__ */ jsx11(DepositModalSelfDriven, __spreadValues({}, props));
|
|
1611
|
+
}
|
|
1612
|
+
return /* @__PURE__ */ jsx11(DepositModalControlled, __spreadValues({}, props));
|
|
1613
|
+
};
|
|
1614
|
+
DepositModal.displayName = "DepositModal";
|
|
1615
|
+
|
|
1616
|
+
// src/withdraw/index.tsx
|
|
1617
|
+
import { useMemo as useMemo2, useState as useState4 } from "react";
|
|
1618
|
+
|
|
1619
|
+
// src/withdraw/steps/withdraw-method.tsx
|
|
1620
|
+
import { useLabels as useLabels11 } from "@agg-build/hooks";
|
|
1621
|
+
import { Fragment as Fragment7, jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1622
|
+
var WithdrawMethodCard = ({
|
|
1623
|
+
icon,
|
|
1624
|
+
title,
|
|
1625
|
+
description,
|
|
1626
|
+
onContinue
|
|
1627
|
+
}) => /* @__PURE__ */ jsxs12(
|
|
1628
|
+
"div",
|
|
1629
|
+
{
|
|
1630
|
+
className: cn(
|
|
1631
|
+
"flex items-center gap-3 sm:gap-4 rounded-xl border border-agg-separator bg-agg-secondary p-3 sm:p-4",
|
|
1632
|
+
"hover:bg-agg-secondary-hover transition-colors cursor-pointer"
|
|
1633
|
+
),
|
|
1634
|
+
role: "button",
|
|
1635
|
+
tabIndex: 0,
|
|
1636
|
+
onClick: onContinue,
|
|
1637
|
+
onKeyDown: (e) => {
|
|
1638
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1639
|
+
e.preventDefault();
|
|
1640
|
+
onContinue();
|
|
1641
|
+
}
|
|
1642
|
+
},
|
|
1643
|
+
children: [
|
|
1644
|
+
/* @__PURE__ */ jsx12("div", { className: "shrink-0 flex items-center justify-center h-10 w-10 rounded-lg bg-agg-secondary-hover", children: icon }),
|
|
1645
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex-1 min-w-0", children: [
|
|
1646
|
+
/* @__PURE__ */ jsx12("p", { className: "agg-type-body-strong text-agg-foreground", children: title }),
|
|
1647
|
+
/* @__PURE__ */ jsx12("p", { className: "agg-type-label text-agg-muted-foreground", children: description })
|
|
1648
|
+
] }),
|
|
1649
|
+
/* @__PURE__ */ jsx12("div", { className: "shrink-0 text-agg-muted-foreground", children: /* @__PURE__ */ jsx12(ChevronRightIcon, { className: "h-5 w-5" }) })
|
|
1650
|
+
]
|
|
1651
|
+
}
|
|
1652
|
+
);
|
|
1653
|
+
var WithdrawMethodStep = ({
|
|
1654
|
+
balance,
|
|
1655
|
+
onSelectMethod
|
|
1656
|
+
}) => {
|
|
1657
|
+
const labels = useLabels11();
|
|
1658
|
+
return /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
1659
|
+
/* @__PURE__ */ jsx12(Modal.Header, { title: labels.withdraw.title, hideBorder: true }),
|
|
1660
|
+
/* @__PURE__ */ jsx12(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-5", children: [
|
|
1661
|
+
/* @__PURE__ */ jsxs12("p", { className: "agg-type-body text-agg-foreground", children: [
|
|
1662
|
+
labels.withdraw.balancePrefix,
|
|
1663
|
+
" ",
|
|
1664
|
+
formatCompactUsd(balance)
|
|
1665
|
+
] }),
|
|
1666
|
+
/* @__PURE__ */ jsx12(
|
|
1667
|
+
WithdrawMethodCard,
|
|
1668
|
+
{
|
|
1669
|
+
icon: /* @__PURE__ */ jsx12(CreditCardIcon, { className: "h-6 w-6 text-agg-muted-foreground" }),
|
|
1670
|
+
title: labels.withdraw.methods.cardTitle,
|
|
1671
|
+
description: labels.withdraw.methods.cardDescription,
|
|
1672
|
+
onContinue: () => onSelectMethod("card")
|
|
1673
|
+
}
|
|
1674
|
+
)
|
|
1675
|
+
] }) })
|
|
1676
|
+
] });
|
|
1677
|
+
};
|
|
1678
|
+
|
|
1679
|
+
// src/withdraw/steps/withdraw-amount.tsx
|
|
1680
|
+
import { useLabels as useLabels12 } from "@agg-build/hooks";
|
|
1681
|
+
import { Fragment as Fragment8, jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1682
|
+
var WithdrawAmountStep = ({
|
|
1683
|
+
amount,
|
|
1684
|
+
currency,
|
|
1685
|
+
destinationWallet,
|
|
1686
|
+
tokenOptions,
|
|
1687
|
+
networkOptions,
|
|
1688
|
+
selectedToken,
|
|
1689
|
+
selectedNetwork,
|
|
1690
|
+
onBack,
|
|
1691
|
+
onAmountChange,
|
|
1692
|
+
onCurrencyChange,
|
|
1693
|
+
onTokenChange,
|
|
1694
|
+
onNetworkChange,
|
|
1695
|
+
onContinue
|
|
1696
|
+
}) => {
|
|
1697
|
+
const labels = useLabels12();
|
|
1698
|
+
const isValid = Number(amount) > 0;
|
|
1699
|
+
return /* @__PURE__ */ jsxs13(Fragment8, { children: [
|
|
1700
|
+
/* @__PURE__ */ jsx13(
|
|
1701
|
+
Modal.Header,
|
|
1702
|
+
{
|
|
1703
|
+
title: labels.withdraw.cardFlow.title,
|
|
1704
|
+
hideBorder: true,
|
|
1705
|
+
leftElement: /* @__PURE__ */ jsx13(
|
|
1706
|
+
"button",
|
|
1707
|
+
{
|
|
1708
|
+
type: "button",
|
|
1709
|
+
className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
|
|
1710
|
+
onClick: onBack,
|
|
1711
|
+
"aria-label": "Go back",
|
|
1712
|
+
children: /* @__PURE__ */ jsx13(ChevronLeftIcon, { className: "h-6 w-6" })
|
|
1713
|
+
}
|
|
1714
|
+
)
|
|
1715
|
+
}
|
|
1716
|
+
),
|
|
1717
|
+
/* @__PURE__ */ jsx13(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-5", children: [
|
|
1718
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex gap-3 items-end", children: [
|
|
1719
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex-1 flex flex-col gap-2", children: [
|
|
1720
|
+
/* @__PURE__ */ jsx13("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.withdraw.cardFlow.amountLabel }),
|
|
1721
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex h-10 items-center gap-2 rounded border border-agg-separator bg-agg-secondary px-3", children: [
|
|
1722
|
+
/* @__PURE__ */ jsx13(
|
|
1723
|
+
"input",
|
|
1724
|
+
{
|
|
1725
|
+
type: "text",
|
|
1726
|
+
inputMode: "decimal",
|
|
1727
|
+
"aria-label": labels.withdraw.cardFlow.amountLabel,
|
|
1728
|
+
className: cn(
|
|
1729
|
+
"agg-type-body w-full bg-transparent outline-none",
|
|
1730
|
+
isValid ? "text-agg-foreground" : "text-agg-muted-foreground"
|
|
1731
|
+
),
|
|
1732
|
+
placeholder: "0.00",
|
|
1733
|
+
value: amount,
|
|
1734
|
+
onChange: (event) => onAmountChange(event.target.value)
|
|
1735
|
+
}
|
|
1736
|
+
),
|
|
1737
|
+
/* @__PURE__ */ jsx13("span", { className: "agg-type-body text-agg-muted-foreground", children: "$" })
|
|
1738
|
+
] })
|
|
1739
|
+
] }),
|
|
1740
|
+
/* @__PURE__ */ jsx13("div", { className: "w-[100px]", children: /* @__PURE__ */ jsx13(
|
|
1741
|
+
Select,
|
|
1742
|
+
{
|
|
1743
|
+
items: [{ value: currency, label: currency }],
|
|
1744
|
+
value: currency,
|
|
1745
|
+
onChange: onCurrencyChange,
|
|
1746
|
+
ariaLabel: labels.withdraw.cardFlow.currencyLabel
|
|
1747
|
+
}
|
|
1748
|
+
) })
|
|
1749
|
+
] }),
|
|
1750
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex gap-5", children: [
|
|
1751
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex-1 flex flex-col gap-2 min-w-0", children: [
|
|
1752
|
+
/* @__PURE__ */ jsx13("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.withdraw.cardFlow.tokenLabel }),
|
|
1753
|
+
/* @__PURE__ */ jsx13(
|
|
1754
|
+
Select,
|
|
1755
|
+
{
|
|
1756
|
+
items: tokenOptions,
|
|
1757
|
+
value: selectedToken,
|
|
1758
|
+
onChange: onTokenChange,
|
|
1759
|
+
ariaLabel: labels.withdraw.cardFlow.tokenLabel
|
|
1760
|
+
}
|
|
1761
|
+
)
|
|
1762
|
+
] }),
|
|
1763
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex-1 flex flex-col gap-2 min-w-0", children: [
|
|
1764
|
+
/* @__PURE__ */ jsx13("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.withdraw.cardFlow.networkLabel }),
|
|
1765
|
+
/* @__PURE__ */ jsx13(
|
|
1766
|
+
Select,
|
|
1767
|
+
{
|
|
1768
|
+
items: networkOptions,
|
|
1769
|
+
value: selectedNetwork,
|
|
1770
|
+
onChange: onNetworkChange,
|
|
1771
|
+
ariaLabel: labels.withdraw.cardFlow.networkLabel
|
|
1772
|
+
}
|
|
1773
|
+
)
|
|
1774
|
+
] })
|
|
1775
|
+
] }),
|
|
1776
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-2", children: [
|
|
1777
|
+
/* @__PURE__ */ jsx13("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.withdraw.cardFlow.destinationWalletLabel }),
|
|
1778
|
+
/* @__PURE__ */ jsx13("div", { className: "flex h-10 items-center rounded border border-agg-separator bg-agg-secondary px-3", children: /* @__PURE__ */ jsx13("p", { className: "agg-type-body truncate text-agg-foreground", children: destinationWallet }) })
|
|
1779
|
+
] }),
|
|
1780
|
+
/* @__PURE__ */ jsx13(
|
|
1781
|
+
Button,
|
|
1782
|
+
{
|
|
1783
|
+
variant: isValid ? "primary" : "secondary",
|
|
1784
|
+
size: "large",
|
|
1785
|
+
className: "w-full",
|
|
1786
|
+
disabled: !isValid,
|
|
1787
|
+
onClick: onContinue,
|
|
1788
|
+
children: labels.withdraw.cardFlow.getQuotes
|
|
1789
|
+
}
|
|
1790
|
+
)
|
|
1791
|
+
] }) })
|
|
1792
|
+
] });
|
|
1793
|
+
};
|
|
1794
|
+
|
|
1795
|
+
// src/withdraw/steps/withdraw-provider.tsx
|
|
1796
|
+
import { useLabels as useLabels13 } from "@agg-build/hooks";
|
|
1797
|
+
import { Fragment as Fragment9, jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1798
|
+
var WithdrawProviderItem = ({ provider, onSelect }) => {
|
|
1799
|
+
const labels = useLabels13();
|
|
1800
|
+
const badgeText = provider.badge === "best" ? labels.withdraw.cardFlow.providerBadges.best : provider.badge === "low-kyc" ? labels.withdraw.cardFlow.providerBadges.lowKyc : void 0;
|
|
1801
|
+
return /* @__PURE__ */ jsx14(
|
|
1802
|
+
"button",
|
|
1803
|
+
{
|
|
1804
|
+
type: "button",
|
|
1805
|
+
className: "w-full rounded-xl border border-agg-separator px-4 py-3 text-left bg-agg-secondary hover:bg-agg-secondary-hover transition-colors cursor-pointer",
|
|
1806
|
+
onClick: () => onSelect(provider.id),
|
|
1807
|
+
children: /* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between gap-4", children: [
|
|
1808
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
|
|
1809
|
+
/* @__PURE__ */ jsx14("p", { className: "text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: provider.name }),
|
|
1810
|
+
badgeText ? /* @__PURE__ */ jsx14(
|
|
1811
|
+
"span",
|
|
1812
|
+
{
|
|
1813
|
+
className: `rounded border px-2 py-[2px] text-[10px] leading-[14px] font-agg-bold uppercase ${provider.badge === "best" ? "border-agg-primary/50 text-agg-primary bg-agg-secondary" : "border-agg-separator text-agg-foreground bg-agg-secondary"}`,
|
|
1814
|
+
children: badgeText
|
|
1815
|
+
}
|
|
1816
|
+
) : null
|
|
1817
|
+
] }),
|
|
1818
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-4", children: [
|
|
1819
|
+
/* @__PURE__ */ jsxs14("div", { className: "text-right", children: [
|
|
1820
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-type-body text-agg-foreground", children: provider.quote }),
|
|
1821
|
+
/* @__PURE__ */ jsxs14("p", { className: "agg-type-label text-agg-muted-foreground", children: [
|
|
1822
|
+
labels.withdraw.cardFlow.feeLabel,
|
|
1823
|
+
" ",
|
|
1824
|
+
provider.fee
|
|
1825
|
+
] })
|
|
1826
|
+
] }),
|
|
1827
|
+
/* @__PURE__ */ jsx14(ChevronRightIcon, { className: "h-5 w-5 text-agg-muted-foreground" })
|
|
1828
|
+
] })
|
|
1829
|
+
] })
|
|
1830
|
+
}
|
|
1831
|
+
);
|
|
1832
|
+
};
|
|
1833
|
+
var WithdrawProviderStep = ({
|
|
1834
|
+
token,
|
|
1835
|
+
amount,
|
|
1836
|
+
currency,
|
|
1837
|
+
providers,
|
|
1838
|
+
onBack,
|
|
1839
|
+
onSelectProvider
|
|
1840
|
+
}) => {
|
|
1841
|
+
const labels = useLabels13();
|
|
1842
|
+
return /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
1843
|
+
/* @__PURE__ */ jsx14(
|
|
1844
|
+
Modal.Header,
|
|
1845
|
+
{
|
|
1846
|
+
title: labels.withdraw.cardFlow.selectProviderTitle,
|
|
1847
|
+
hideBorder: true,
|
|
1848
|
+
leftElement: /* @__PURE__ */ jsx14(
|
|
1849
|
+
"button",
|
|
1850
|
+
{
|
|
1851
|
+
type: "button",
|
|
1852
|
+
className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
|
|
1853
|
+
onClick: onBack,
|
|
1854
|
+
"aria-label": labels.withdraw.back,
|
|
1855
|
+
children: /* @__PURE__ */ jsx14(ChevronLeftIcon, { className: "h-6 w-6" })
|
|
1856
|
+
}
|
|
1857
|
+
)
|
|
1858
|
+
}
|
|
1859
|
+
),
|
|
1860
|
+
/* @__PURE__ */ jsx14(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-4", children: [
|
|
1861
|
+
/* @__PURE__ */ jsxs14("p", { className: "agg-type-body text-agg-foreground", children: [
|
|
1862
|
+
/* @__PURE__ */ jsx14("span", { className: "font-agg-bold", children: token }),
|
|
1863
|
+
" $",
|
|
1864
|
+
amount,
|
|
1865
|
+
" ",
|
|
1866
|
+
currency
|
|
1867
|
+
] }),
|
|
1868
|
+
/* @__PURE__ */ jsx14("div", { className: "flex flex-col gap-4", children: providers.map((provider) => /* @__PURE__ */ jsx14(
|
|
1869
|
+
WithdrawProviderItem,
|
|
1870
|
+
{
|
|
1871
|
+
provider,
|
|
1872
|
+
onSelect: onSelectProvider
|
|
1873
|
+
},
|
|
1874
|
+
provider.id
|
|
1875
|
+
)) })
|
|
1876
|
+
] }) })
|
|
1877
|
+
] });
|
|
1878
|
+
};
|
|
1879
|
+
|
|
1880
|
+
// src/withdraw/steps/withdraw-success.tsx
|
|
1881
|
+
import { useLabels as useLabels14 } from "@agg-build/hooks";
|
|
1882
|
+
import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1883
|
+
var SummaryRow3 = ({ label, value }) => /* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between border-b border-agg-separator py-2 last:border-b-0", children: [
|
|
1884
|
+
/* @__PURE__ */ jsx15("p", { className: "text-[12px] leading-4 font-agg-bold uppercase text-agg-muted-foreground", children: label }),
|
|
1885
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-type-label text-agg-foreground", children: value })
|
|
1886
|
+
] });
|
|
1887
|
+
var WithdrawSuccessStep = ({
|
|
1888
|
+
summary,
|
|
1889
|
+
onDone,
|
|
1890
|
+
onClose
|
|
1891
|
+
}) => {
|
|
1892
|
+
const labels = useLabels14();
|
|
1893
|
+
return /* @__PURE__ */ jsx15("div", { className: "relative", children: /* @__PURE__ */ jsxs15(Modal.Body, { classNames: { root: "px-5 py-8 sm:px-8 sm:py-10" }, children: [
|
|
1894
|
+
/* @__PURE__ */ jsx15(
|
|
1895
|
+
"button",
|
|
1896
|
+
{
|
|
1897
|
+
type: "button",
|
|
1898
|
+
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
1899
|
+
onClick: onClose,
|
|
1900
|
+
"aria-label": labels.common.close,
|
|
1901
|
+
children: /* @__PURE__ */ jsx15(CloseIcon, { className: "h-6 w-6" })
|
|
1902
|
+
}
|
|
1903
|
+
),
|
|
1904
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-col items-center gap-8", children: [
|
|
1905
|
+
/* @__PURE__ */ jsx15("div", { className: "flex h-[60px] w-[60px] items-center justify-center rounded-full border border-agg-success/50 bg-agg-success/15", children: /* @__PURE__ */ jsx15(SuccessCheckIcon, { className: "h-6 w-6 text-agg-success" }) }),
|
|
1906
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
1907
|
+
/* @__PURE__ */ jsx15("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: labels.withdraw.cardFlow.successTitle }),
|
|
1908
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-type-body text-agg-foreground", children: labels.withdraw.cardFlow.successDescription })
|
|
1909
|
+
] }),
|
|
1910
|
+
/* @__PURE__ */ jsxs15("div", { className: "w-full rounded-lg border border-agg-separator bg-agg-secondary px-3 py-1", children: [
|
|
1911
|
+
/* @__PURE__ */ jsx15(
|
|
1912
|
+
SummaryRow3,
|
|
1913
|
+
{
|
|
1914
|
+
label: labels.withdraw.summary.amountReceived,
|
|
1915
|
+
value: summary.amountReceived
|
|
1916
|
+
}
|
|
1917
|
+
),
|
|
1918
|
+
/* @__PURE__ */ jsx15(SummaryRow3, { label: labels.withdraw.summary.network, value: summary.network }),
|
|
1919
|
+
/* @__PURE__ */ jsx15(
|
|
1920
|
+
SummaryRow3,
|
|
1921
|
+
{
|
|
1922
|
+
label: labels.withdraw.cardFlow.summary.provider,
|
|
1923
|
+
value: summary.provider
|
|
1924
|
+
}
|
|
1925
|
+
),
|
|
1926
|
+
/* @__PURE__ */ jsx15(
|
|
1927
|
+
SummaryRow3,
|
|
1928
|
+
{
|
|
1929
|
+
label: labels.withdraw.cardFlow.summary.toWallet,
|
|
1930
|
+
value: summary.toWallet
|
|
1931
|
+
}
|
|
1932
|
+
),
|
|
1933
|
+
/* @__PURE__ */ jsx15(SummaryRow3, { label: labels.withdraw.cardFlow.summary.fees, value: summary.fees })
|
|
1934
|
+
] }),
|
|
1935
|
+
/* @__PURE__ */ jsx15(Button, { variant: "secondary", size: "large", className: "w-[120px]", onClick: onDone, children: labels.withdraw.done })
|
|
1936
|
+
] })
|
|
1937
|
+
] }) });
|
|
1938
|
+
};
|
|
1939
|
+
|
|
1940
|
+
// src/withdraw/index.tsx
|
|
1941
|
+
import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1942
|
+
var WithdrawModal = ({
|
|
1943
|
+
open,
|
|
1944
|
+
onOpenChange,
|
|
1945
|
+
withdrawFlow,
|
|
1946
|
+
onSelectWithdrawMethod,
|
|
1947
|
+
onWithdrawAmountChange,
|
|
1948
|
+
onWithdrawCurrencyChange,
|
|
1949
|
+
onWithdrawTokenChange,
|
|
1950
|
+
onWithdrawNetworkChange,
|
|
1951
|
+
onGetWithdrawQuotes,
|
|
1952
|
+
onSelectWithdrawProvider,
|
|
1953
|
+
onDoneWithdraw
|
|
1954
|
+
}) => {
|
|
1955
|
+
const [step, setStep] = useState4("method");
|
|
1956
|
+
const handleBackToMethod = () => {
|
|
1957
|
+
setStep("method");
|
|
1958
|
+
};
|
|
1959
|
+
const handleSelectMethod = (method) => {
|
|
1960
|
+
setStep("withdraw-amount");
|
|
1961
|
+
onSelectWithdrawMethod == null ? void 0 : onSelectWithdrawMethod(method);
|
|
1962
|
+
};
|
|
1963
|
+
const handleOpenChange = (isOpen) => {
|
|
1964
|
+
if (!isOpen) {
|
|
1965
|
+
setStep("method");
|
|
1966
|
+
}
|
|
1967
|
+
onOpenChange(isOpen);
|
|
1968
|
+
};
|
|
1969
|
+
const fallbackNetworkOptions = useMemo2(() => mapNetworksToOptions(), []);
|
|
1970
|
+
const withdrawTokenOptions = withTokenIcons(
|
|
1971
|
+
mergeSelectOptionsUnique(withdrawFlow.tokenOptions, DEFAULT_CURRENCY_OPTIONS)
|
|
1972
|
+
);
|
|
1973
|
+
const withdrawNetworkOptions = withNetworkIcons(
|
|
1974
|
+
mergeSelectOptionsUnique(withdrawFlow.networkOptions, fallbackNetworkOptions)
|
|
1975
|
+
);
|
|
1976
|
+
return /* @__PURE__ */ jsx16(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs16(Modal.Container, { maxWidth: "600px", "aria-label": "Withdraw", children: [
|
|
1977
|
+
step === "method" ? /* @__PURE__ */ jsx16(WithdrawMethodStep, { balance: withdrawFlow.balance, onSelectMethod: handleSelectMethod }) : null,
|
|
1978
|
+
step === "withdraw-amount" ? /* @__PURE__ */ jsx16(
|
|
1979
|
+
WithdrawAmountStep,
|
|
1980
|
+
{
|
|
1981
|
+
amount: withdrawFlow.amount,
|
|
1982
|
+
currency: withdrawFlow.currency,
|
|
1983
|
+
destinationWallet: withdrawFlow.destinationWallet,
|
|
1984
|
+
tokenOptions: withdrawTokenOptions,
|
|
1985
|
+
networkOptions: withdrawNetworkOptions,
|
|
1986
|
+
selectedToken: withdrawFlow.selectedToken,
|
|
1987
|
+
selectedNetwork: withdrawFlow.selectedNetwork,
|
|
1988
|
+
onBack: handleBackToMethod,
|
|
1989
|
+
onAmountChange: onWithdrawAmountChange,
|
|
1990
|
+
onCurrencyChange: onWithdrawCurrencyChange,
|
|
1991
|
+
onTokenChange: onWithdrawTokenChange,
|
|
1992
|
+
onNetworkChange: onWithdrawNetworkChange,
|
|
1993
|
+
onContinue: () => {
|
|
1994
|
+
onGetWithdrawQuotes == null ? void 0 : onGetWithdrawQuotes();
|
|
1995
|
+
setStep("provider");
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
) : null,
|
|
1999
|
+
step === "provider" ? /* @__PURE__ */ jsx16(
|
|
2000
|
+
WithdrawProviderStep,
|
|
2001
|
+
{
|
|
2002
|
+
token: withdrawFlow.selectedToken,
|
|
2003
|
+
amount: withdrawFlow.amount,
|
|
2004
|
+
currency: withdrawFlow.currency,
|
|
2005
|
+
providers: withdrawFlow.providers,
|
|
2006
|
+
onBack: () => setStep("withdraw-amount"),
|
|
2007
|
+
onSelectProvider: (providerId) => {
|
|
2008
|
+
onSelectWithdrawProvider(providerId);
|
|
2009
|
+
setStep("success");
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
) : null,
|
|
2013
|
+
step === "success" ? /* @__PURE__ */ jsx16(
|
|
2014
|
+
WithdrawSuccessStep,
|
|
2015
|
+
{
|
|
2016
|
+
summary: withdrawFlow.purchaseSummary,
|
|
2017
|
+
onDone: onDoneWithdraw,
|
|
2018
|
+
onClose: () => onOpenChange(false)
|
|
2019
|
+
}
|
|
2020
|
+
) : null
|
|
2021
|
+
] }) });
|
|
2022
|
+
};
|
|
2023
|
+
WithdrawModal.displayName = "WithdrawModal";
|
|
2024
|
+
|
|
2025
|
+
// src/onboarding/index.tsx
|
|
2026
|
+
import { useCallback as useCallback6, useEffect as useEffect4, useState as useState9 } from "react";
|
|
2027
|
+
import { useLabels as useLabels20 } from "@agg-build/hooks";
|
|
2028
|
+
import * as Dialog3 from "@radix-ui/react-dialog";
|
|
2029
|
+
|
|
2030
|
+
// src/onboarding/onboarding-modal.constants.ts
|
|
2031
|
+
import { Venue } from "@agg-build/sdk";
|
|
2032
|
+
var HOW_IT_WORKS_FEATURE_KEYS = [
|
|
2033
|
+
"createAccount",
|
|
2034
|
+
"linkAccounts",
|
|
2035
|
+
"bestPrices",
|
|
2036
|
+
"stayInControl"
|
|
2037
|
+
];
|
|
2038
|
+
var ONBOARDING_STEPS = {
|
|
2039
|
+
HOW_IT_WORKS: 0,
|
|
2040
|
+
PROFILE_SETUP: 1,
|
|
2041
|
+
CONNECT_ACCOUNTS: 2
|
|
2042
|
+
};
|
|
2043
|
+
var ONCHAIN_VENUES = [Venue.polymarket, Venue.opinion, Venue.predict];
|
|
2044
|
+
|
|
2045
|
+
// src/onboarding/steps/how-it-works.tsx
|
|
2046
|
+
import { useCallback as useCallback2, useRef as useRef2, useState as useState5 } from "react";
|
|
2047
|
+
import { useLabels as useLabels15 } from "@agg-build/hooks";
|
|
2048
|
+
import { jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2049
|
+
var defaultIcons = {
|
|
2050
|
+
createAccount: /* @__PURE__ */ jsx17(CreateAccountIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
|
|
2051
|
+
linkAccounts: /* @__PURE__ */ jsx17(LinkAccountsIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
|
|
2052
|
+
bestPrices: /* @__PURE__ */ jsx17(BestPricesIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
|
|
2053
|
+
stayInControl: /* @__PURE__ */ jsx17(StayInControlIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" })
|
|
2054
|
+
};
|
|
2055
|
+
var HowItWorksStep = ({ onContinue, icons }) => {
|
|
2056
|
+
const labels = useLabels15();
|
|
2057
|
+
const scrollRef = useRef2(null);
|
|
2058
|
+
const [showTopGradient, setShowTopGradient] = useState5(false);
|
|
2059
|
+
const [showBottomGradient, setShowBottomGradient] = useState5(true);
|
|
2060
|
+
const handleScroll = useCallback2(() => {
|
|
2061
|
+
const el = scrollRef.current;
|
|
2062
|
+
if (!el) return;
|
|
2063
|
+
setShowTopGradient(el.scrollTop > 0);
|
|
2064
|
+
setShowBottomGradient(el.scrollTop + el.clientHeight < el.scrollHeight - 1);
|
|
2065
|
+
}, []);
|
|
2066
|
+
return /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-6 h-[600px] sm:h-auto", children: [
|
|
2067
|
+
/* @__PURE__ */ jsx17("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.howItWorks.title }),
|
|
2068
|
+
/* @__PURE__ */ jsxs17("div", { className: "relative flex-1 min-h-0 sm:flex-initial", children: [
|
|
2069
|
+
/* @__PURE__ */ jsx17(
|
|
2070
|
+
"div",
|
|
2071
|
+
{
|
|
2072
|
+
ref: scrollRef,
|
|
2073
|
+
onScroll: handleScroll,
|
|
2074
|
+
className: "flex flex-col gap-4 overflow-y-auto sm:overflow-visible h-full",
|
|
2075
|
+
children: HOW_IT_WORKS_FEATURE_KEYS.map((featureKey) => {
|
|
2076
|
+
var _a;
|
|
2077
|
+
const icon = (_a = icons == null ? void 0 : icons[featureKey]) != null ? _a : defaultIcons[featureKey];
|
|
2078
|
+
const feature = labels.onboarding.howItWorks.features[featureKey];
|
|
2079
|
+
return /* @__PURE__ */ jsxs17(
|
|
2080
|
+
"div",
|
|
2081
|
+
{
|
|
2082
|
+
className: cn(
|
|
2083
|
+
"flex items-center gap-4 py-4 px-5 sm:px-4",
|
|
2084
|
+
"rounded-agg-md",
|
|
2085
|
+
"bg-agg-secondary-hover"
|
|
2086
|
+
),
|
|
2087
|
+
children: [
|
|
2088
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex flex-col flex-1 min-w-0 gap-[6px]", children: [
|
|
2089
|
+
/* @__PURE__ */ jsx17("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: feature.title }),
|
|
2090
|
+
/* @__PURE__ */ jsx17("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: feature.description })
|
|
2091
|
+
] }),
|
|
2092
|
+
icon ? /* @__PURE__ */ jsx17("div", { className: "hidden shrink-0 items-center justify-center text-agg-muted-foreground sm:flex", children: icon }) : null
|
|
2093
|
+
]
|
|
2094
|
+
},
|
|
2095
|
+
featureKey
|
|
2096
|
+
);
|
|
2097
|
+
})
|
|
2098
|
+
}
|
|
2099
|
+
),
|
|
2100
|
+
/* @__PURE__ */ jsx17(
|
|
2101
|
+
"div",
|
|
2102
|
+
{
|
|
2103
|
+
className: cn(
|
|
2104
|
+
"pointer-events-none absolute inset-x-0 top-0 h-20",
|
|
2105
|
+
"bg-gradient-to-b from-agg-secondary to-transparent",
|
|
2106
|
+
"sm:hidden transition-opacity",
|
|
2107
|
+
showTopGradient ? "opacity-100" : "opacity-0"
|
|
2108
|
+
)
|
|
2109
|
+
}
|
|
2110
|
+
),
|
|
2111
|
+
/* @__PURE__ */ jsx17(
|
|
2112
|
+
"div",
|
|
2113
|
+
{
|
|
2114
|
+
className: cn(
|
|
2115
|
+
"pointer-events-none absolute inset-x-0 bottom-0 h-20",
|
|
2116
|
+
"bg-gradient-to-t from-agg-secondary to-transparent",
|
|
2117
|
+
"sm:hidden transition-opacity",
|
|
2118
|
+
showBottomGradient ? "opacity-100" : "opacity-0"
|
|
2119
|
+
)
|
|
2120
|
+
}
|
|
2121
|
+
)
|
|
2122
|
+
] }),
|
|
2123
|
+
/* @__PURE__ */ jsx17(Button, { variant: "primary", size: "large", className: "w-full", onClick: onContinue, children: labels.onboarding.howItWorks.continue })
|
|
2124
|
+
] });
|
|
2125
|
+
};
|
|
2126
|
+
HowItWorksStep.displayName = "HowItWorksStep";
|
|
2127
|
+
|
|
2128
|
+
// src/onboarding/steps/profile-setup.tsx
|
|
2129
|
+
import { useCallback as useCallback3, useRef as useRef3, useState as useState6 } from "react";
|
|
2130
|
+
import { useLabels as useLabels16 } from "@agg-build/hooks";
|
|
2131
|
+
import { jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2132
|
+
var ProfileSetupStep = ({ onContinue }) => {
|
|
2133
|
+
const labels = useLabels16();
|
|
2134
|
+
const [username, setUsername] = useState6("");
|
|
2135
|
+
const [avatarFile, setAvatarFile] = useState6();
|
|
2136
|
+
const [avatarPreview, setAvatarPreview] = useState6();
|
|
2137
|
+
const fileInputRef = useRef3(null);
|
|
2138
|
+
const handleAvatarClick = useCallback3(() => {
|
|
2139
|
+
var _a;
|
|
2140
|
+
(_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
2141
|
+
}, []);
|
|
2142
|
+
const handleFileChange = useCallback3((e) => {
|
|
2143
|
+
var _a;
|
|
2144
|
+
const file = (_a = e.target.files) == null ? void 0 : _a[0];
|
|
2145
|
+
if (!file) return;
|
|
2146
|
+
setAvatarFile(file);
|
|
2147
|
+
const reader = new FileReader();
|
|
2148
|
+
reader.onload = (event) => {
|
|
2149
|
+
var _a2;
|
|
2150
|
+
setAvatarPreview((_a2 = event.target) == null ? void 0 : _a2.result);
|
|
2151
|
+
};
|
|
2152
|
+
reader.readAsDataURL(file);
|
|
2153
|
+
}, []);
|
|
2154
|
+
const handleContinue = useCallback3(() => {
|
|
2155
|
+
onContinue({
|
|
2156
|
+
username,
|
|
2157
|
+
avatarFile,
|
|
2158
|
+
avatarPreview
|
|
2159
|
+
});
|
|
2160
|
+
}, [username, avatarFile, avatarPreview, onContinue]);
|
|
2161
|
+
return /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-7", children: [
|
|
2162
|
+
/* @__PURE__ */ jsx18("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.profileSetup.title }),
|
|
2163
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-5 items-center w-full", children: [
|
|
2164
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex justify-center", children: [
|
|
2165
|
+
/* @__PURE__ */ jsxs18(
|
|
2166
|
+
"button",
|
|
2167
|
+
{
|
|
2168
|
+
type: "button",
|
|
2169
|
+
onClick: handleAvatarClick,
|
|
2170
|
+
className: cn(
|
|
2171
|
+
"group relative flex items-center justify-center",
|
|
2172
|
+
"h-[80px] w-[80px]",
|
|
2173
|
+
"rounded-agg-full",
|
|
2174
|
+
"bg-agg-secondary-hover",
|
|
2175
|
+
!avatarPreview && "hover:bg-agg-tertiary",
|
|
2176
|
+
"transition-colors cursor-pointer",
|
|
2177
|
+
"overflow-hidden"
|
|
2178
|
+
),
|
|
2179
|
+
"aria-label": labels.onboarding.profileSetup.uploadProfilePictureAria,
|
|
2180
|
+
children: [
|
|
2181
|
+
!avatarPreview ? /* @__PURE__ */ jsx18(
|
|
2182
|
+
"svg",
|
|
2183
|
+
{
|
|
2184
|
+
"aria-hidden": true,
|
|
2185
|
+
viewBox: "0 0 80 80",
|
|
2186
|
+
className: "pointer-events-none absolute inset-0 h-full w-full text-agg-separator group-hover:text-agg-muted-foreground",
|
|
2187
|
+
children: /* @__PURE__ */ jsx18(
|
|
2188
|
+
"circle",
|
|
2189
|
+
{
|
|
2190
|
+
cx: "40",
|
|
2191
|
+
cy: "40",
|
|
2192
|
+
r: "39.5",
|
|
2193
|
+
fill: "none",
|
|
2194
|
+
stroke: "currentColor",
|
|
2195
|
+
strokeWidth: "1",
|
|
2196
|
+
strokeDasharray: "8 8"
|
|
2197
|
+
}
|
|
2198
|
+
)
|
|
2199
|
+
}
|
|
2200
|
+
) : null,
|
|
2201
|
+
avatarPreview ? /* @__PURE__ */ jsx18(
|
|
2202
|
+
RemoteImage,
|
|
2203
|
+
{
|
|
2204
|
+
src: avatarPreview,
|
|
2205
|
+
alt: labels.onboarding.profileSetup.profilePreviewAlt,
|
|
2206
|
+
className: "h-full w-full object-cover"
|
|
2207
|
+
}
|
|
2208
|
+
) : /* @__PURE__ */ jsx18(ProfileIcon, { className: "h-7 w-7 text-agg-muted-foreground" })
|
|
2209
|
+
]
|
|
2210
|
+
}
|
|
2211
|
+
),
|
|
2212
|
+
/* @__PURE__ */ jsx18(
|
|
2213
|
+
"input",
|
|
2214
|
+
{
|
|
2215
|
+
ref: fileInputRef,
|
|
2216
|
+
type: "file",
|
|
2217
|
+
accept: "image/*",
|
|
2218
|
+
onChange: handleFileChange,
|
|
2219
|
+
className: "hidden",
|
|
2220
|
+
"aria-hidden": "true"
|
|
2221
|
+
}
|
|
2222
|
+
)
|
|
2223
|
+
] }),
|
|
2224
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-2 w-full", children: [
|
|
2225
|
+
/* @__PURE__ */ jsx18(
|
|
2226
|
+
"label",
|
|
2227
|
+
{
|
|
2228
|
+
htmlFor: "onboarding-username",
|
|
2229
|
+
className: "text-agg-sm font-agg-bold text-agg-foreground",
|
|
2230
|
+
children: labels.onboarding.profileSetup.usernameLabel
|
|
2231
|
+
}
|
|
2232
|
+
),
|
|
2233
|
+
/* @__PURE__ */ jsx18(
|
|
2234
|
+
"input",
|
|
2235
|
+
{
|
|
2236
|
+
id: "onboarding-username",
|
|
2237
|
+
type: "text",
|
|
2238
|
+
value: username,
|
|
2239
|
+
onChange: (e) => setUsername(e.target.value),
|
|
2240
|
+
placeholder: labels.onboarding.profileSetup.usernamePlaceholder,
|
|
2241
|
+
className: cn(
|
|
2242
|
+
"w-full px-3 py-2.5",
|
|
2243
|
+
"rounded-[4px]",
|
|
2244
|
+
"border border-agg-separator",
|
|
2245
|
+
"bg-agg-secondary text-agg-foreground",
|
|
2246
|
+
"placeholder:text-agg-muted-foreground",
|
|
2247
|
+
"outline-none",
|
|
2248
|
+
"hover:bg-agg-secondary-hover",
|
|
2249
|
+
"focus:border-agg-primary focus:ring-1 focus:ring-agg-primary",
|
|
2250
|
+
"transition-colors",
|
|
2251
|
+
"text-agg-sm sm:text-agg-base"
|
|
2252
|
+
)
|
|
2253
|
+
}
|
|
2254
|
+
)
|
|
2255
|
+
] })
|
|
2256
|
+
] }),
|
|
2257
|
+
/* @__PURE__ */ jsx18(Button, { variant: "primary", size: "large", className: "w-full", onClick: handleContinue, children: labels.onboarding.profileSetup.continue })
|
|
2258
|
+
] });
|
|
2259
|
+
};
|
|
2260
|
+
ProfileSetupStep.displayName = "ProfileSetupStep";
|
|
2261
|
+
|
|
2262
|
+
// src/onboarding/steps/connect-accounts.tsx
|
|
2263
|
+
import { Venue as Venue2 } from "@agg-build/sdk";
|
|
2264
|
+
import { useLabels as useLabels17 } from "@agg-build/hooks";
|
|
2265
|
+
import { jsx as jsx19, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2266
|
+
var OnchainVenueLogos = () => {
|
|
2267
|
+
return /* @__PURE__ */ jsx19("div", { className: "flex gap-1 sm:gap-0 sm:-space-x-5", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ jsx19("div", { style: { zIndex: ONCHAIN_VENUES.length - index }, children: /* @__PURE__ */ jsx19(VenueLogo, { venue, variant: "logo", size: "medium", className: "sm:h-8 sm:w-8" }) }, venue)) });
|
|
2268
|
+
};
|
|
2269
|
+
var VenueCard = ({
|
|
2270
|
+
logos,
|
|
2271
|
+
title,
|
|
2272
|
+
mobileTitle,
|
|
2273
|
+
description,
|
|
2274
|
+
mobileDescription,
|
|
2275
|
+
onConnect,
|
|
2276
|
+
connected = false
|
|
2277
|
+
}) => {
|
|
2278
|
+
const labels = useLabels17();
|
|
2279
|
+
const action = connected ? /* @__PURE__ */ jsx19(CheckCircleIcon, { className: "h-6 w-6 text-agg-success" }) : /* @__PURE__ */ jsx19(
|
|
2280
|
+
Button,
|
|
2281
|
+
{
|
|
2282
|
+
variant: "tertiary",
|
|
2283
|
+
size: "large",
|
|
2284
|
+
className: "!h-auto !px-0 !py-0 text-agg-primary hover:bg-transparent hover:text-agg-primary-hover",
|
|
2285
|
+
onClick: onConnect,
|
|
2286
|
+
children: labels.onboarding.connectAccounts.connect
|
|
2287
|
+
}
|
|
2288
|
+
);
|
|
2289
|
+
const mobileAction = connected ? /* @__PURE__ */ jsx19(CheckCircleIcon, { className: "h-6 w-6 text-agg-success" }) : /* @__PURE__ */ jsx19(
|
|
2290
|
+
Button,
|
|
2291
|
+
{
|
|
2292
|
+
variant: "tertiary",
|
|
2293
|
+
size: "medium",
|
|
2294
|
+
className: "!h-auto !px-0 !py-0 text-agg-primary hover:bg-transparent hover:text-agg-primary-hover",
|
|
2295
|
+
onClick: onConnect,
|
|
2296
|
+
suffix: /* @__PURE__ */ jsx19(ChevronRightIcon, { className: "h-4 w-4" }),
|
|
2297
|
+
children: labels.onboarding.connectAccounts.connectAccount
|
|
2298
|
+
}
|
|
2299
|
+
);
|
|
2300
|
+
return /* @__PURE__ */ jsxs19(
|
|
2301
|
+
"div",
|
|
2302
|
+
{
|
|
2303
|
+
className: cn(
|
|
2304
|
+
"rounded-agg-md p-5 transition-colors",
|
|
2305
|
+
connected ? "bg-agg-success/5" : "bg-agg-secondary-hover hover:bg-agg-tertiary"
|
|
2306
|
+
),
|
|
2307
|
+
children: [
|
|
2308
|
+
/* @__PURE__ */ jsxs19("div", { className: "hidden sm:flex items-center justify-between", children: [
|
|
2309
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-5", children: [
|
|
2310
|
+
/* @__PURE__ */ jsx19("div", { className: "shrink-0", children: logos }),
|
|
2311
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-[2px]", children: [
|
|
2312
|
+
/* @__PURE__ */ jsx19("p", { className: "text-agg-base font-agg-bold text-agg-foreground", children: title }),
|
|
2313
|
+
/* @__PURE__ */ jsx19("p", { className: "text-agg-sm text-agg-foreground", children: description })
|
|
2314
|
+
] })
|
|
2315
|
+
] }),
|
|
2316
|
+
/* @__PURE__ */ jsx19("div", { className: "shrink-0", children: action })
|
|
2317
|
+
] }),
|
|
2318
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-3 sm:hidden", children: [
|
|
2319
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-3", children: [
|
|
2320
|
+
/* @__PURE__ */ jsx19("div", { className: "shrink-0", children: logos }),
|
|
2321
|
+
/* @__PURE__ */ jsx19("p", { className: "text-agg-lg font-agg-bold text-agg-foreground", children: mobileTitle != null ? mobileTitle : title })
|
|
2322
|
+
] }),
|
|
2323
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-col items-start gap-2", children: [
|
|
2324
|
+
/* @__PURE__ */ jsx19("p", { className: "text-agg-base text-agg-foreground", children: mobileDescription != null ? mobileDescription : description }),
|
|
2325
|
+
mobileAction
|
|
2326
|
+
] })
|
|
2327
|
+
] })
|
|
2328
|
+
]
|
|
2329
|
+
}
|
|
2330
|
+
);
|
|
2331
|
+
};
|
|
2332
|
+
var ConnectAccountsStep = ({
|
|
2333
|
+
onConnectOnchain,
|
|
2334
|
+
onConnectKalshi,
|
|
2335
|
+
onContinue,
|
|
2336
|
+
connectedOnchain = false,
|
|
2337
|
+
connectedKalshi = false
|
|
2338
|
+
}) => {
|
|
2339
|
+
const labels = useLabels17();
|
|
2340
|
+
const canContinue = connectedOnchain || connectedKalshi;
|
|
2341
|
+
return /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-6", children: [
|
|
2342
|
+
/* @__PURE__ */ jsx19("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectAccounts.title }),
|
|
2343
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-4", children: [
|
|
2344
|
+
/* @__PURE__ */ jsx19(
|
|
2345
|
+
VenueCard,
|
|
2346
|
+
{
|
|
2347
|
+
logos: /* @__PURE__ */ jsx19(OnchainVenueLogos, {}),
|
|
2348
|
+
title: labels.onboarding.connectAccounts.onchainTitle,
|
|
2349
|
+
mobileTitle: labels.onboarding.connectAccounts.onchainMobileTitle(
|
|
2350
|
+
ONCHAIN_VENUES.length - 1
|
|
2351
|
+
),
|
|
2352
|
+
description: labels.onboarding.connectAccounts.onchainDescription,
|
|
2353
|
+
mobileDescription: labels.onboarding.connectAccounts.onchainMobileDescription,
|
|
2354
|
+
onConnect: onConnectOnchain,
|
|
2355
|
+
connected: connectedOnchain
|
|
2356
|
+
}
|
|
2357
|
+
),
|
|
2358
|
+
/* @__PURE__ */ jsx19(
|
|
2359
|
+
VenueCard,
|
|
2360
|
+
{
|
|
2361
|
+
logos: /* @__PURE__ */ jsx19("div", { className: "sm:flex sm:w-14 sm:items-center sm:justify-center", children: /* @__PURE__ */ jsx19(
|
|
2362
|
+
VenueLogo,
|
|
2363
|
+
{
|
|
2364
|
+
venue: Venue2.kalshi,
|
|
2365
|
+
variant: "logo",
|
|
2366
|
+
size: "large",
|
|
2367
|
+
className: "h-6 w-6 sm:h-9 sm:w-9"
|
|
2368
|
+
}
|
|
2369
|
+
) }),
|
|
2370
|
+
title: labels.onboarding.connectAccounts.kalshiTitle,
|
|
2371
|
+
mobileTitle: labels.onboarding.connectAccounts.kalshiMobileTitle,
|
|
2372
|
+
description: labels.onboarding.connectAccounts.kalshiDescription,
|
|
2373
|
+
mobileDescription: labels.onboarding.connectAccounts.kalshiMobileDescription,
|
|
2374
|
+
onConnect: onConnectKalshi,
|
|
2375
|
+
connected: connectedKalshi
|
|
2376
|
+
}
|
|
2377
|
+
)
|
|
2378
|
+
] }),
|
|
2379
|
+
/* @__PURE__ */ jsx19(
|
|
2380
|
+
Button,
|
|
2381
|
+
{
|
|
2382
|
+
variant: "primary",
|
|
2383
|
+
size: "large",
|
|
2384
|
+
className: "w-full",
|
|
2385
|
+
onClick: onContinue,
|
|
2386
|
+
disabled: !canContinue,
|
|
2387
|
+
children: labels.onboarding.connectAccounts.continue
|
|
2388
|
+
}
|
|
2389
|
+
)
|
|
2390
|
+
] });
|
|
2391
|
+
};
|
|
2392
|
+
ConnectAccountsStep.displayName = "ConnectAccountsStep";
|
|
2393
|
+
|
|
2394
|
+
// src/onboarding/steps/connect-kalshi-modal.tsx
|
|
2395
|
+
import { Venue as Venue3 } from "@agg-build/sdk";
|
|
2396
|
+
import { useCallback as useCallback4, useState as useState7 } from "react";
|
|
2397
|
+
import { useLabels as useLabels18 } from "@agg-build/hooks";
|
|
2398
|
+
import * as Dialog from "@radix-ui/react-dialog";
|
|
2399
|
+
import { jsx as jsx20, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2400
|
+
var ConnectKalshiModal = ({
|
|
2401
|
+
open,
|
|
2402
|
+
onOpenChange,
|
|
2403
|
+
onVerify
|
|
2404
|
+
}) => {
|
|
2405
|
+
const labels = useLabels18();
|
|
2406
|
+
const [apiKeyId, setApiKeyId] = useState7("");
|
|
2407
|
+
const [privateKey, setPrivateKey] = useState7("");
|
|
2408
|
+
const [verifying, setVerifying] = useState7(false);
|
|
2409
|
+
const [error, setError] = useState7();
|
|
2410
|
+
const canVerify = apiKeyId.trim().length > 0 && privateKey.trim().length > 0;
|
|
2411
|
+
const handleCancel = useCallback4(() => {
|
|
2412
|
+
onOpenChange(false);
|
|
2413
|
+
}, [onOpenChange]);
|
|
2414
|
+
const handleVerify = useCallback4(() => __async(null, null, function* () {
|
|
2415
|
+
if (!canVerify || verifying) return;
|
|
2416
|
+
setVerifying(true);
|
|
2417
|
+
setError(void 0);
|
|
2418
|
+
try {
|
|
2419
|
+
const credentials = {
|
|
2420
|
+
apiKeyId: apiKeyId.trim(),
|
|
2421
|
+
privateKey: privateKey.trim()
|
|
2422
|
+
};
|
|
2423
|
+
yield onVerify(credentials);
|
|
2424
|
+
setApiKeyId("");
|
|
2425
|
+
setPrivateKey("");
|
|
2426
|
+
onOpenChange(false);
|
|
2427
|
+
} catch (err) {
|
|
2428
|
+
setError(
|
|
2429
|
+
err instanceof Error ? err.message : labels.onboarding.connectKalshiModal.fallbackError
|
|
2430
|
+
);
|
|
2431
|
+
} finally {
|
|
2432
|
+
setVerifying(false);
|
|
2433
|
+
}
|
|
2434
|
+
}), [
|
|
2435
|
+
apiKeyId,
|
|
2436
|
+
canVerify,
|
|
2437
|
+
labels.onboarding.connectKalshiModal.fallbackError,
|
|
2438
|
+
onOpenChange,
|
|
2439
|
+
onVerify,
|
|
2440
|
+
privateKey,
|
|
2441
|
+
verifying
|
|
2442
|
+
]);
|
|
2443
|
+
const handleOpenChange = useCallback4(
|
|
2444
|
+
(value) => {
|
|
2445
|
+
if (value) {
|
|
2446
|
+
setApiKeyId("");
|
|
2447
|
+
setPrivateKey("");
|
|
2448
|
+
setError(void 0);
|
|
2449
|
+
setVerifying(false);
|
|
2450
|
+
}
|
|
2451
|
+
onOpenChange(value);
|
|
2452
|
+
},
|
|
2453
|
+
[onOpenChange]
|
|
2454
|
+
);
|
|
2455
|
+
return /* @__PURE__ */ jsx20(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs20(
|
|
2456
|
+
Modal.Container,
|
|
2457
|
+
{
|
|
2458
|
+
maxWidth: "600px",
|
|
2459
|
+
"aria-label": labels.onboarding.connectKalshiModal.ariaLabel,
|
|
2460
|
+
classNames: { container: "!rounded-agg-lg" },
|
|
2461
|
+
children: [
|
|
2462
|
+
/* @__PURE__ */ jsx20(Dialog.Title, { className: "sr-only", children: labels.onboarding.connectKalshiModal.title }),
|
|
2463
|
+
/* @__PURE__ */ jsx20(
|
|
2464
|
+
Modal.Header,
|
|
2465
|
+
{
|
|
2466
|
+
hideClose: false,
|
|
2467
|
+
hideBorder: true,
|
|
2468
|
+
classNames: {
|
|
2469
|
+
root: "!min-h-0",
|
|
2470
|
+
container: "!py-[18px] !px-8"
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
),
|
|
2474
|
+
/* @__PURE__ */ jsx20(Modal.Body, { classNames: { root: "!px-5 !pt-0 !pb-[60px] sm:!px-8" }, children: /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-8 items-center", children: [
|
|
2475
|
+
/* @__PURE__ */ jsx20(
|
|
2476
|
+
VenueLogo,
|
|
2477
|
+
{
|
|
2478
|
+
venue: Venue3.kalshi,
|
|
2479
|
+
variant: "logo",
|
|
2480
|
+
size: "large",
|
|
2481
|
+
className: "h-[60px] w-[60px]"
|
|
2482
|
+
}
|
|
2483
|
+
),
|
|
2484
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-4 items-center text-center", children: [
|
|
2485
|
+
/* @__PURE__ */ jsx20("h2", { className: "text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectKalshiModal.title }),
|
|
2486
|
+
/* @__PURE__ */ jsx20("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: labels.onboarding.connectKalshiModal.description })
|
|
2487
|
+
] }),
|
|
2488
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-4 w-full", children: [
|
|
2489
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-3 rounded-agg-lg bg-agg-secondary-hover p-4", children: [
|
|
2490
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-1", children: [
|
|
2491
|
+
/* @__PURE__ */ jsx20("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepOne.label }),
|
|
2492
|
+
/* @__PURE__ */ jsx20("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepOne.title })
|
|
2493
|
+
] }),
|
|
2494
|
+
/* @__PURE__ */ jsxs20("div", { className: "space-y-0 text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
2495
|
+
/* @__PURE__ */ jsx20("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.signIn }),
|
|
2496
|
+
/* @__PURE__ */ jsxs20("p", { children: [
|
|
2497
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfilePrefix,
|
|
2498
|
+
" ",
|
|
2499
|
+
/* @__PURE__ */ jsx20("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileText }),
|
|
2500
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfileSeparator,
|
|
2501
|
+
" ",
|
|
2502
|
+
/* @__PURE__ */ jsx20("span", { className: "text-agg-foreground underline", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileUrl })
|
|
2503
|
+
] }),
|
|
2504
|
+
/* @__PURE__ */ jsxs20("p", { children: [
|
|
2505
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeyPrefix,
|
|
2506
|
+
" ",
|
|
2507
|
+
/* @__PURE__ */ jsx20("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKeyText }),
|
|
2508
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeySuffix
|
|
2509
|
+
] }),
|
|
2510
|
+
/* @__PURE__ */ jsxs20("p", { children: [
|
|
2511
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsPrefix,
|
|
2512
|
+
" ",
|
|
2513
|
+
/* @__PURE__ */ jsx20("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.readWriteText }),
|
|
2514
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsSuffix
|
|
2515
|
+
] }),
|
|
2516
|
+
/* @__PURE__ */ jsx20("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKey })
|
|
2517
|
+
] }),
|
|
2518
|
+
/* @__PURE__ */ jsxs20("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
2519
|
+
labels.onboarding.connectKalshiModal.stepOne.footerLineOne,
|
|
2520
|
+
/* @__PURE__ */ jsx20("br", {}),
|
|
2521
|
+
labels.onboarding.connectKalshiModal.stepOne.footerLineTwo
|
|
2522
|
+
] })
|
|
2523
|
+
] }),
|
|
2524
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-3 rounded-agg-lg bg-agg-secondary-hover p-4", children: [
|
|
2525
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-1", children: [
|
|
2526
|
+
/* @__PURE__ */ jsx20("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.label }),
|
|
2527
|
+
/* @__PURE__ */ jsx20("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.title })
|
|
2528
|
+
] }),
|
|
2529
|
+
/* @__PURE__ */ jsx20("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.description }),
|
|
2530
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-2", children: [
|
|
2531
|
+
/* @__PURE__ */ jsx20(
|
|
2532
|
+
"label",
|
|
2533
|
+
{
|
|
2534
|
+
htmlFor: "kalshi-api-key-id",
|
|
2535
|
+
className: "text-agg-sm font-agg-bold text-agg-foreground",
|
|
2536
|
+
children: labels.onboarding.connectKalshiModal.stepTwo.apiKeyIdLabel
|
|
2537
|
+
}
|
|
2538
|
+
),
|
|
2539
|
+
/* @__PURE__ */ jsx20(
|
|
2540
|
+
"input",
|
|
2541
|
+
{
|
|
2542
|
+
id: "kalshi-api-key-id",
|
|
2543
|
+
type: "text",
|
|
2544
|
+
value: apiKeyId,
|
|
2545
|
+
onChange: (e) => setApiKeyId(e.target.value),
|
|
2546
|
+
placeholder: labels.onboarding.connectKalshiModal.stepTwo.apiKeyIdPlaceholder,
|
|
2547
|
+
className: cn(
|
|
2548
|
+
"w-full px-3 py-2.5 h-10",
|
|
2549
|
+
"rounded border border-agg-separator",
|
|
2550
|
+
"bg-agg-secondary text-agg-base text-agg-foreground",
|
|
2551
|
+
"placeholder:text-agg-muted-foreground",
|
|
2552
|
+
"outline-none",
|
|
2553
|
+
"focus:border-agg-primary focus:ring-1 focus:ring-agg-primary",
|
|
2554
|
+
"transition-colors"
|
|
2555
|
+
)
|
|
2556
|
+
}
|
|
2557
|
+
)
|
|
2558
|
+
] }),
|
|
2559
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-2", children: [
|
|
2560
|
+
/* @__PURE__ */ jsx20(
|
|
2561
|
+
"label",
|
|
2562
|
+
{
|
|
2563
|
+
htmlFor: "kalshi-private-key",
|
|
2564
|
+
className: "text-agg-sm font-agg-bold text-agg-foreground",
|
|
2565
|
+
children: labels.onboarding.connectKalshiModal.stepTwo.privateKeyLabel
|
|
2566
|
+
}
|
|
2567
|
+
),
|
|
2568
|
+
/* @__PURE__ */ jsx20(
|
|
2569
|
+
"textarea",
|
|
2570
|
+
{
|
|
2571
|
+
id: "kalshi-private-key",
|
|
2572
|
+
value: privateKey,
|
|
2573
|
+
onChange: (e) => setPrivateKey(e.target.value),
|
|
2574
|
+
placeholder: labels.onboarding.connectKalshiModal.stepTwo.privateKeyPlaceholder,
|
|
2575
|
+
rows: 3,
|
|
2576
|
+
className: cn(
|
|
2577
|
+
"w-full px-3 py-2.5",
|
|
2578
|
+
"rounded border border-agg-separator",
|
|
2579
|
+
"bg-agg-secondary text-agg-base text-agg-foreground",
|
|
2580
|
+
"placeholder:text-agg-muted-foreground",
|
|
2581
|
+
"outline-none resize-none",
|
|
2582
|
+
"focus:border-agg-primary focus:ring-1 focus:ring-agg-primary",
|
|
2583
|
+
"transition-colors"
|
|
2584
|
+
)
|
|
2585
|
+
}
|
|
2586
|
+
)
|
|
2587
|
+
] })
|
|
2588
|
+
] })
|
|
2589
|
+
] }),
|
|
2590
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between w-full", children: [
|
|
2591
|
+
/* @__PURE__ */ jsx20("p", { className: "text-agg-base text-agg-foreground", children: labels.onboarding.connectKalshiModal.help.label }),
|
|
2592
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-3", children: [
|
|
2593
|
+
/* @__PURE__ */ jsxs20(
|
|
2594
|
+
"a",
|
|
2595
|
+
{
|
|
2596
|
+
href: "#",
|
|
2597
|
+
className: "flex items-center gap-2 text-agg-base font-agg-bold text-agg-primary hover:text-agg-primary-hover",
|
|
2598
|
+
children: [
|
|
2599
|
+
/* @__PURE__ */ jsx20(DocumentIcon, { className: "h-4 w-4" }),
|
|
2600
|
+
labels.onboarding.connectKalshiModal.help.docsLinkLabel
|
|
2601
|
+
]
|
|
2602
|
+
}
|
|
2603
|
+
),
|
|
2604
|
+
/* @__PURE__ */ jsx20("span", { className: "h-3 w-px bg-agg-separator" }),
|
|
2605
|
+
/* @__PURE__ */ jsxs20(
|
|
2606
|
+
"a",
|
|
2607
|
+
{
|
|
2608
|
+
href: "#",
|
|
2609
|
+
className: "flex items-center gap-2 text-agg-base font-agg-bold text-agg-primary hover:text-agg-primary-hover",
|
|
2610
|
+
children: [
|
|
2611
|
+
/* @__PURE__ */ jsx20(PlaySquareIcon, { className: "h-4 w-4" }),
|
|
2612
|
+
labels.onboarding.connectKalshiModal.help.tutorialLinkLabel
|
|
2613
|
+
]
|
|
2614
|
+
}
|
|
2615
|
+
)
|
|
2616
|
+
] })
|
|
2617
|
+
] }),
|
|
2618
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-5 items-center", children: [
|
|
2619
|
+
error ? /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2", children: [
|
|
2620
|
+
/* @__PURE__ */ jsx20(WarningIcon, { className: "h-3.5 w-3.5 shrink-0 text-agg-error" }),
|
|
2621
|
+
/* @__PURE__ */ jsx20("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
|
|
2622
|
+
] }) : null,
|
|
2623
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-3 justify-center", children: [
|
|
2624
|
+
/* @__PURE__ */ jsx20(Button, { variant: "secondary", size: "large", onClick: handleCancel, children: labels.onboarding.connectKalshiModal.actions.cancel }),
|
|
2625
|
+
/* @__PURE__ */ jsx20(
|
|
2626
|
+
Button,
|
|
2627
|
+
{
|
|
2628
|
+
variant: "primary",
|
|
2629
|
+
size: "large",
|
|
2630
|
+
onClick: handleVerify,
|
|
2631
|
+
disabled: !canVerify,
|
|
2632
|
+
isLoading: verifying,
|
|
2633
|
+
children: labels.onboarding.connectKalshiModal.actions.verifyConnection
|
|
2634
|
+
}
|
|
2635
|
+
)
|
|
2636
|
+
] })
|
|
2637
|
+
] })
|
|
2638
|
+
] }) })
|
|
2639
|
+
]
|
|
2640
|
+
}
|
|
2641
|
+
) });
|
|
2642
|
+
};
|
|
2643
|
+
ConnectKalshiModal.displayName = "ConnectKalshiModal";
|
|
2644
|
+
|
|
2645
|
+
// src/onboarding/steps/connect-onchain-modal.tsx
|
|
2646
|
+
import { useCallback as useCallback5, useState as useState8 } from "react";
|
|
2647
|
+
import { useLabels as useLabels19 } from "@agg-build/hooks";
|
|
2648
|
+
import * as Dialog2 from "@radix-ui/react-dialog";
|
|
2649
|
+
import { jsx as jsx21, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2650
|
+
var ConnectOnchainModal = ({
|
|
2651
|
+
open,
|
|
2652
|
+
onOpenChange,
|
|
2653
|
+
onConnect
|
|
2654
|
+
}) => {
|
|
2655
|
+
const labels = useLabels19();
|
|
2656
|
+
const [connecting, setConnecting] = useState8(false);
|
|
2657
|
+
const [error, setError] = useState8();
|
|
2658
|
+
const handleCancel = useCallback5(() => {
|
|
2659
|
+
onOpenChange(false);
|
|
2660
|
+
}, [onOpenChange]);
|
|
2661
|
+
const handleConnect = useCallback5(() => __async(null, null, function* () {
|
|
2662
|
+
if (connecting) return;
|
|
2663
|
+
setConnecting(true);
|
|
2664
|
+
setError(void 0);
|
|
2665
|
+
try {
|
|
2666
|
+
yield onConnect();
|
|
2667
|
+
onOpenChange(false);
|
|
2668
|
+
} catch (err) {
|
|
2669
|
+
setError(
|
|
2670
|
+
err instanceof Error ? err.message : labels.onboarding.connectOnchainModal.fallbackError
|
|
2671
|
+
);
|
|
2672
|
+
} finally {
|
|
2673
|
+
setConnecting(false);
|
|
2674
|
+
}
|
|
2675
|
+
}), [connecting, labels.onboarding.connectOnchainModal.fallbackError, onConnect, onOpenChange]);
|
|
2676
|
+
const handleOpenChange = useCallback5(
|
|
2677
|
+
(value) => {
|
|
2678
|
+
if (value) {
|
|
2679
|
+
setError(void 0);
|
|
2680
|
+
setConnecting(false);
|
|
2681
|
+
}
|
|
2682
|
+
onOpenChange(value);
|
|
2683
|
+
},
|
|
2684
|
+
[onOpenChange]
|
|
2685
|
+
);
|
|
2686
|
+
return /* @__PURE__ */ jsx21(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs21(
|
|
2687
|
+
Modal.Container,
|
|
2688
|
+
{
|
|
2689
|
+
maxWidth: "600px",
|
|
2690
|
+
"aria-label": labels.onboarding.connectOnchainModal.ariaLabel,
|
|
2691
|
+
classNames: { container: "!rounded-agg-lg" },
|
|
2692
|
+
children: [
|
|
2693
|
+
/* @__PURE__ */ jsx21(Dialog2.Title, { className: "sr-only", children: labels.onboarding.connectOnchainModal.title }),
|
|
2694
|
+
/* @__PURE__ */ jsx21(
|
|
2695
|
+
Modal.Header,
|
|
2696
|
+
{
|
|
2697
|
+
hideClose: false,
|
|
2698
|
+
hideBorder: true,
|
|
2699
|
+
classNames: {
|
|
2700
|
+
root: "!min-h-0",
|
|
2701
|
+
container: "!py-[18px] !px-8"
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2704
|
+
),
|
|
2705
|
+
/* @__PURE__ */ jsx21(Modal.Body, { classNames: { root: "!px-5 !pt-0 !pb-[60px] sm:!px-8" }, children: /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-8 items-center", children: [
|
|
2706
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-4 items-center text-center", children: [
|
|
2707
|
+
/* @__PURE__ */ jsx21("h2", { className: "text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectOnchainModal.title }),
|
|
2708
|
+
/* @__PURE__ */ jsx21("p", { className: "text-agg-base text-center leading-agg-6 text-agg-foreground whitespace-pre-line", children: labels.onboarding.connectOnchainModal.description })
|
|
2709
|
+
] }),
|
|
2710
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex w-full flex-col items-center gap-4 rounded-agg-xl bg-agg-secondary-hover p-6", children: [
|
|
2711
|
+
/* @__PURE__ */ jsx21("p", { className: "text-agg-sm font-agg-bold uppercase leading-agg-5 text-agg-muted-foreground", children: labels.onboarding.connectOnchainModal.supportedVenuesLabel }),
|
|
2712
|
+
/* @__PURE__ */ jsx21("div", { className: "flex flex-wrap items-center justify-center gap-x-4 gap-y-3", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-[6px]", children: [
|
|
2713
|
+
index > 0 && /* @__PURE__ */ jsx21("span", { className: "mr-2.5 h-3 w-px bg-agg-separator" }),
|
|
2714
|
+
/* @__PURE__ */ jsx21(VenueLogo, { venue, size: "medium" }),
|
|
2715
|
+
/* @__PURE__ */ jsx21("span", { className: "text-agg-base text-agg-foreground", children: labels.venues[venue] })
|
|
2716
|
+
] }, venue)) })
|
|
2717
|
+
] }),
|
|
2718
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-6 items-center", children: [
|
|
2719
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-3 items-center", children: [
|
|
2720
|
+
error ? /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-2", children: [
|
|
2721
|
+
/* @__PURE__ */ jsx21(WarningIcon, { className: "h-3.5 w-3.5 shrink-0 text-agg-error" }),
|
|
2722
|
+
/* @__PURE__ */ jsx21("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
|
|
2723
|
+
] }) : null,
|
|
2724
|
+
/* @__PURE__ */ jsx21(
|
|
2725
|
+
Button,
|
|
2726
|
+
{
|
|
2727
|
+
variant: "primary",
|
|
2728
|
+
size: "large",
|
|
2729
|
+
onClick: handleConnect,
|
|
2730
|
+
isLoading: connecting,
|
|
2731
|
+
children: labels.onboarding.connectOnchainModal.connect
|
|
2732
|
+
}
|
|
2733
|
+
)
|
|
2734
|
+
] }),
|
|
2735
|
+
/* @__PURE__ */ jsx21(
|
|
2736
|
+
Button,
|
|
2737
|
+
{
|
|
2738
|
+
variant: "tertiary",
|
|
2739
|
+
size: "medium",
|
|
2740
|
+
className: "!h-auto !px-0 !py-0 text-agg-primary hover:bg-transparent hover:text-agg-primary-hover",
|
|
2741
|
+
onClick: handleCancel,
|
|
2742
|
+
children: labels.onboarding.connectOnchainModal.cancel
|
|
2743
|
+
}
|
|
2744
|
+
)
|
|
2745
|
+
] })
|
|
2746
|
+
] }) })
|
|
2747
|
+
]
|
|
2748
|
+
}
|
|
2749
|
+
) });
|
|
2750
|
+
};
|
|
2751
|
+
ConnectOnchainModal.displayName = "ConnectOnchainModal";
|
|
2752
|
+
|
|
2753
|
+
// src/onboarding/index.tsx
|
|
2754
|
+
import { Fragment as Fragment10, jsx as jsx22, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2755
|
+
var OnboardingModal = ({
|
|
2756
|
+
open,
|
|
2757
|
+
onOpenChange,
|
|
2758
|
+
onProfileSubmit,
|
|
2759
|
+
onConnectOnchain,
|
|
2760
|
+
onConnectKalshi,
|
|
2761
|
+
onComplete,
|
|
2762
|
+
howItWorksIcons,
|
|
2763
|
+
connectedOnchain = false,
|
|
2764
|
+
connectedKalshi = false
|
|
2765
|
+
}) => {
|
|
2766
|
+
var _a;
|
|
2767
|
+
const labels = useLabels20();
|
|
2768
|
+
const [step, setStep] = useState9(ONBOARDING_STEPS.HOW_IT_WORKS);
|
|
2769
|
+
const stepLabels = {
|
|
2770
|
+
[ONBOARDING_STEPS.HOW_IT_WORKS]: labels.onboarding.modal.stepHowItWorks,
|
|
2771
|
+
[ONBOARDING_STEPS.PROFILE_SETUP]: labels.onboarding.modal.stepProfileSetup,
|
|
2772
|
+
[ONBOARDING_STEPS.CONNECT_ACCOUNTS]: labels.onboarding.modal.stepConnectAccounts
|
|
2773
|
+
};
|
|
2774
|
+
const resolvedTitle = (_a = stepLabels[step]) != null ? _a : labels.onboarding.modal.title;
|
|
2775
|
+
const [kalshiModalOpen, setKalshiModalOpen] = useState9(false);
|
|
2776
|
+
const [kalshiConnected, setKalshiConnected] = useState9(false);
|
|
2777
|
+
const [onchainModalOpen, setOnchainModalOpen] = useState9(false);
|
|
2778
|
+
const [onchainConnected, setOnchainConnected] = useState9(false);
|
|
2779
|
+
useEffect4(() => {
|
|
2780
|
+
if (open) {
|
|
2781
|
+
setStep(ONBOARDING_STEPS.HOW_IT_WORKS);
|
|
2782
|
+
setKalshiConnected(false);
|
|
2783
|
+
setOnchainConnected(false);
|
|
2784
|
+
}
|
|
2785
|
+
}, [open]);
|
|
2786
|
+
const handleHowItWorksContinue = useCallback6(() => {
|
|
2787
|
+
setStep(ONBOARDING_STEPS.PROFILE_SETUP);
|
|
2788
|
+
}, []);
|
|
2789
|
+
const handleProfileContinue = useCallback6(
|
|
2790
|
+
(data) => {
|
|
2791
|
+
onProfileSubmit == null ? void 0 : onProfileSubmit(data);
|
|
2792
|
+
setStep(ONBOARDING_STEPS.CONNECT_ACCOUNTS);
|
|
2793
|
+
},
|
|
2794
|
+
[onProfileSubmit]
|
|
2795
|
+
);
|
|
2796
|
+
const handleConnectContinue = useCallback6(() => {
|
|
2797
|
+
onComplete == null ? void 0 : onComplete();
|
|
2798
|
+
}, [onComplete]);
|
|
2799
|
+
const handleOpenOnchainModal = useCallback6(() => {
|
|
2800
|
+
setOnchainModalOpen(true);
|
|
2801
|
+
}, []);
|
|
2802
|
+
const handleOnchainConnect = useCallback6(() => __async(null, null, function* () {
|
|
2803
|
+
yield onConnectOnchain == null ? void 0 : onConnectOnchain();
|
|
2804
|
+
setOnchainConnected(true);
|
|
2805
|
+
}), [onConnectOnchain]);
|
|
2806
|
+
const handleOpenKalshiModal = useCallback6(() => {
|
|
2807
|
+
setKalshiModalOpen(true);
|
|
2808
|
+
}, []);
|
|
2809
|
+
const handleKalshiVerify = useCallback6(
|
|
2810
|
+
(credentials) => __async(null, null, function* () {
|
|
2811
|
+
yield onConnectKalshi == null ? void 0 : onConnectKalshi(credentials);
|
|
2812
|
+
setKalshiConnected(true);
|
|
2813
|
+
}),
|
|
2814
|
+
[onConnectKalshi]
|
|
2815
|
+
);
|
|
2816
|
+
return /* @__PURE__ */ jsxs22(Fragment10, { children: [
|
|
2817
|
+
/* @__PURE__ */ jsx22(Modal, { open, onOpenChange, children: /* @__PURE__ */ jsxs22(
|
|
2818
|
+
Modal.Container,
|
|
2819
|
+
{
|
|
2820
|
+
maxWidth: "600px",
|
|
2821
|
+
"aria-label": resolvedTitle,
|
|
2822
|
+
classNames: { container: "!rounded-agg-lg" },
|
|
2823
|
+
children: [
|
|
2824
|
+
/* @__PURE__ */ jsx22(Dialog3.Title, { className: "sr-only", children: resolvedTitle }),
|
|
2825
|
+
/* @__PURE__ */ jsxs22(Modal.Body, { classNames: { root: "px-5 py-6 sm:px-10 sm:py-8" }, children: [
|
|
2826
|
+
step === ONBOARDING_STEPS.HOW_IT_WORKS && /* @__PURE__ */ jsx22(HowItWorksStep, { onContinue: handleHowItWorksContinue, icons: howItWorksIcons }),
|
|
2827
|
+
step === ONBOARDING_STEPS.PROFILE_SETUP && /* @__PURE__ */ jsx22(ProfileSetupStep, { onContinue: handleProfileContinue }),
|
|
2828
|
+
step === ONBOARDING_STEPS.CONNECT_ACCOUNTS && /* @__PURE__ */ jsx22(
|
|
2829
|
+
ConnectAccountsStep,
|
|
2830
|
+
{
|
|
2831
|
+
onConnectOnchain: handleOpenOnchainModal,
|
|
2832
|
+
onConnectKalshi: handleOpenKalshiModal,
|
|
2833
|
+
onContinue: handleConnectContinue,
|
|
2834
|
+
connectedOnchain: connectedOnchain || onchainConnected,
|
|
2835
|
+
connectedKalshi: connectedKalshi || kalshiConnected
|
|
2836
|
+
}
|
|
2837
|
+
)
|
|
2838
|
+
] })
|
|
2839
|
+
]
|
|
2840
|
+
}
|
|
2841
|
+
) }),
|
|
2842
|
+
/* @__PURE__ */ jsx22(
|
|
2843
|
+
ConnectOnchainModal,
|
|
2844
|
+
{
|
|
2845
|
+
open: onchainModalOpen,
|
|
2846
|
+
onOpenChange: setOnchainModalOpen,
|
|
2847
|
+
onConnect: handleOnchainConnect
|
|
2848
|
+
}
|
|
2849
|
+
),
|
|
2850
|
+
/* @__PURE__ */ jsx22(
|
|
2851
|
+
ConnectKalshiModal,
|
|
2852
|
+
{
|
|
2853
|
+
open: kalshiModalOpen,
|
|
2854
|
+
onOpenChange: setKalshiModalOpen,
|
|
2855
|
+
onVerify: handleKalshiVerify
|
|
2856
|
+
}
|
|
2857
|
+
)
|
|
2858
|
+
] });
|
|
2859
|
+
};
|
|
2860
|
+
OnboardingModal.displayName = "OnboardingModal";
|
|
2861
|
+
|
|
2862
|
+
// src/profile/index.tsx
|
|
2863
|
+
import { Venue as Venue4 } from "@agg-build/sdk";
|
|
2864
|
+
import { useState as useState11, useEffect as useEffect6, useCallback as useCallback9, useMemo as useMemo3 } from "react";
|
|
2865
|
+
import { useAggClient as useAggClient2, useAggAuthState as useAggAuthState2 } from "@agg-build/hooks";
|
|
2866
|
+
|
|
2867
|
+
// src/profile/profile-modal.constants.ts
|
|
2868
|
+
var PROFILE_TAB_KEYS = {
|
|
2869
|
+
ABOUT: "about",
|
|
2870
|
+
ACCOUNTS_WALLETS: "accounts-wallets"
|
|
2871
|
+
};
|
|
2872
|
+
var PROFILE_TAB_ITEMS = [
|
|
2873
|
+
{ value: PROFILE_TAB_KEYS.ABOUT, label: "About", icon: "profile-about-tab" },
|
|
2874
|
+
{
|
|
2875
|
+
value: PROFILE_TAB_KEYS.ACCOUNTS_WALLETS,
|
|
2876
|
+
label: "Accounts & wallets",
|
|
2877
|
+
icon: "profile-accounts-wallets-tab"
|
|
2878
|
+
}
|
|
2879
|
+
];
|
|
2880
|
+
|
|
2881
|
+
// src/profile/tabs/about-tab.tsx
|
|
2882
|
+
import { useCallback as useCallback7, useRef as useRef4 } from "react";
|
|
2883
|
+
import { useLabels as useLabels21 } from "@agg-build/hooks";
|
|
2884
|
+
import { jsx as jsx23, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2885
|
+
var AboutTab = ({
|
|
2886
|
+
avatarPreview,
|
|
2887
|
+
onDeleteProfile: _onDeleteProfile,
|
|
2888
|
+
draftUsername,
|
|
2889
|
+
onDraftUsernameChange,
|
|
2890
|
+
onDraftAvatarChange,
|
|
2891
|
+
draftAvatarPreview,
|
|
2892
|
+
avatarError: _avatarError
|
|
2893
|
+
}) => {
|
|
2894
|
+
const labels = useLabels21();
|
|
2895
|
+
const fileInputRef = useRef4(null);
|
|
2896
|
+
const handleAvatarClick = useCallback7(() => {
|
|
2897
|
+
var _a;
|
|
2898
|
+
(_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
2899
|
+
}, []);
|
|
2900
|
+
const handleFileChange = useCallback7(
|
|
2901
|
+
(e) => {
|
|
2902
|
+
var _a;
|
|
2903
|
+
const file = (_a = e.target.files) == null ? void 0 : _a[0];
|
|
2904
|
+
if (!file) return;
|
|
2905
|
+
const reader = new FileReader();
|
|
2906
|
+
reader.onload = (event) => {
|
|
2907
|
+
var _a2;
|
|
2908
|
+
onDraftAvatarChange(file, (_a2 = event.target) == null ? void 0 : _a2.result);
|
|
2909
|
+
};
|
|
2910
|
+
reader.readAsDataURL(file);
|
|
2911
|
+
},
|
|
2912
|
+
[onDraftAvatarChange]
|
|
2913
|
+
);
|
|
2914
|
+
const resolvedPreview = draftAvatarPreview != null ? draftAvatarPreview : avatarPreview;
|
|
2915
|
+
const hasAvatarPreview = Boolean(resolvedPreview);
|
|
2916
|
+
return /* @__PURE__ */ jsxs23("div", { className: "agg-profile-about flex flex-col gap-8", children: [
|
|
2917
|
+
/* @__PURE__ */ jsxs23("div", { className: "agg-profile-avatar-section flex w-full flex-col items-stretch sm:items-start", children: [
|
|
2918
|
+
/* @__PURE__ */ jsxs23(
|
|
2919
|
+
"button",
|
|
2920
|
+
{
|
|
2921
|
+
type: "button",
|
|
2922
|
+
onClick: handleAvatarClick,
|
|
2923
|
+
className: cn(
|
|
2924
|
+
"agg-profile-avatar-trigger",
|
|
2925
|
+
"group relative flex items-center justify-center self-start",
|
|
2926
|
+
"h-[80px] w-[80px]",
|
|
2927
|
+
"rounded-agg-full",
|
|
2928
|
+
"bg-agg-secondary-hover",
|
|
2929
|
+
!hasAvatarPreview && "hover:bg-agg-tertiary",
|
|
2930
|
+
"transition-colors cursor-pointer",
|
|
2931
|
+
"overflow-hidden"
|
|
2932
|
+
),
|
|
2933
|
+
"aria-label": labels.onboarding.profileSetup.uploadProfilePictureAria,
|
|
2934
|
+
children: [
|
|
2935
|
+
!hasAvatarPreview ? /* @__PURE__ */ jsx23(
|
|
2936
|
+
"svg",
|
|
2937
|
+
{
|
|
2938
|
+
"aria-hidden": true,
|
|
2939
|
+
viewBox: "0 0 80 80",
|
|
2940
|
+
className: "pointer-events-none absolute inset-0 h-full w-full text-agg-separator group-hover:text-agg-muted-foreground",
|
|
2941
|
+
children: /* @__PURE__ */ jsx23(
|
|
2942
|
+
"circle",
|
|
2943
|
+
{
|
|
2944
|
+
cx: "40",
|
|
2945
|
+
cy: "40",
|
|
2946
|
+
r: "39.5",
|
|
2947
|
+
fill: "none",
|
|
2948
|
+
stroke: "currentColor",
|
|
2949
|
+
strokeWidth: "1",
|
|
2950
|
+
strokeDasharray: "8 8"
|
|
2951
|
+
}
|
|
2952
|
+
)
|
|
2953
|
+
}
|
|
2954
|
+
) : null,
|
|
2955
|
+
resolvedPreview ? /* @__PURE__ */ jsx23(
|
|
2956
|
+
RemoteImage,
|
|
2957
|
+
{
|
|
2958
|
+
src: resolvedPreview,
|
|
2959
|
+
alt: labels.onboarding.profileSetup.profilePreviewAlt,
|
|
2960
|
+
className: "h-full w-full object-cover"
|
|
2961
|
+
}
|
|
2962
|
+
) : /* @__PURE__ */ jsx23(Icon, { name: "profile", className: "h-7 w-7 text-agg-muted-foreground" })
|
|
2963
|
+
]
|
|
2964
|
+
}
|
|
2965
|
+
),
|
|
2966
|
+
/* @__PURE__ */ jsx23(
|
|
2967
|
+
"input",
|
|
2968
|
+
{
|
|
2969
|
+
ref: fileInputRef,
|
|
2970
|
+
type: "file",
|
|
2971
|
+
accept: "image/*",
|
|
2972
|
+
onChange: handleFileChange,
|
|
2973
|
+
className: "hidden",
|
|
2974
|
+
"aria-hidden": "true"
|
|
2975
|
+
}
|
|
2976
|
+
)
|
|
2977
|
+
] }),
|
|
2978
|
+
/* @__PURE__ */ jsxs23("div", { className: "agg-form-section flex flex-col gap-2", children: [
|
|
2979
|
+
/* @__PURE__ */ jsx23(
|
|
2980
|
+
"label",
|
|
2981
|
+
{
|
|
2982
|
+
htmlFor: "profile-username",
|
|
2983
|
+
className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground",
|
|
2984
|
+
children: "Username"
|
|
2985
|
+
}
|
|
2986
|
+
),
|
|
2987
|
+
/* @__PURE__ */ jsx23(
|
|
2988
|
+
"input",
|
|
2989
|
+
{
|
|
2990
|
+
id: "profile-username",
|
|
2991
|
+
type: "text",
|
|
2992
|
+
placeholder: "e.g. CryptoJohn",
|
|
2993
|
+
value: draftUsername,
|
|
2994
|
+
onChange: (e) => onDraftUsernameChange(e.target.value),
|
|
2995
|
+
className: cn(
|
|
2996
|
+
"w-full px-4 py-3",
|
|
2997
|
+
"rounded-agg-sm",
|
|
2998
|
+
"border border-agg-separator",
|
|
2999
|
+
"bg-agg-secondary text-agg-foreground",
|
|
3000
|
+
"placeholder:text-agg-muted-foreground",
|
|
3001
|
+
"outline-none",
|
|
3002
|
+
"focus:border-agg-primary focus:ring-1 focus:ring-agg-primary",
|
|
3003
|
+
"transition-colors",
|
|
3004
|
+
"text-agg-sm sm:text-agg-base"
|
|
3005
|
+
)
|
|
3006
|
+
}
|
|
3007
|
+
)
|
|
3008
|
+
] })
|
|
3009
|
+
] });
|
|
3010
|
+
};
|
|
3011
|
+
AboutTab.displayName = "AboutTab";
|
|
3012
|
+
|
|
3013
|
+
// src/profile/tabs/accounts-wallets-tab.tsx
|
|
3014
|
+
import { useCallback as useCallback8, useEffect as useEffect5, useState as useState10 } from "react";
|
|
3015
|
+
import { useAggClient, useDepositAddresses as useDepositAddresses2 } from "@agg-build/hooks";
|
|
3016
|
+
import { jsx as jsx24, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3017
|
+
var SectionTitle = ({ children }) => /* @__PURE__ */ jsx24("h3", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children });
|
|
3018
|
+
var AccountRow = ({ children, className }) => /* @__PURE__ */ jsx24(
|
|
3019
|
+
"div",
|
|
3020
|
+
{
|
|
3021
|
+
className: cn(
|
|
3022
|
+
"flex items-center justify-between",
|
|
3023
|
+
"rounded-agg-lg border border-agg-separator bg-agg-secondary",
|
|
3024
|
+
"px-5 py-3",
|
|
3025
|
+
className
|
|
3026
|
+
),
|
|
3027
|
+
children
|
|
3028
|
+
}
|
|
3029
|
+
);
|
|
3030
|
+
var ConnectTextButton = ({ onClick }) => /* @__PURE__ */ jsx24(
|
|
3031
|
+
"button",
|
|
3032
|
+
{
|
|
3033
|
+
type: "button",
|
|
3034
|
+
onClick,
|
|
3035
|
+
className: "shrink-0 cursor-pointer text-agg-sm font-agg-bold leading-agg-5 text-agg-primary whitespace-nowrap",
|
|
3036
|
+
children: "Connect"
|
|
3037
|
+
}
|
|
3038
|
+
);
|
|
3039
|
+
var DisconnectTextButton = ({ onClick }) => /* @__PURE__ */ jsx24(
|
|
3040
|
+
"button",
|
|
3041
|
+
{
|
|
3042
|
+
type: "button",
|
|
3043
|
+
onClick,
|
|
3044
|
+
className: "shrink-0 cursor-pointer text-agg-sm font-agg-bold leading-agg-5 text-agg-muted-foreground whitespace-nowrap",
|
|
3045
|
+
children: "Disconnect"
|
|
3046
|
+
}
|
|
3047
|
+
);
|
|
3048
|
+
var TRADING_ACCESS_VENUES = ["kalshi", "polymarket", "opinion", "predict"];
|
|
3049
|
+
var VerifyIdentityButton = ({ onError }) => {
|
|
3050
|
+
const client = useAggClient();
|
|
3051
|
+
const [isInitiating, setIsInitiating] = useState10(false);
|
|
3052
|
+
const [needsDepositAddress, setNeedsDepositAddress] = useState10(false);
|
|
3053
|
+
const { isReady, isTimedOut } = useDepositAddresses2({
|
|
3054
|
+
enabled: needsDepositAddress,
|
|
3055
|
+
poll: true
|
|
3056
|
+
});
|
|
3057
|
+
useEffect5(() => {
|
|
3058
|
+
if (!isInitiating || !isReady) return;
|
|
3059
|
+
const redirectUri = window.location.href;
|
|
3060
|
+
client.initiateKyc("kalshi", redirectUri).then((res) => {
|
|
3061
|
+
if (res.kycUrl) {
|
|
3062
|
+
window.location.assign(res.kycUrl);
|
|
3063
|
+
}
|
|
3064
|
+
}).catch((err) => {
|
|
3065
|
+
onError == null ? void 0 : onError(err instanceof Error ? err : new Error(String(err)));
|
|
3066
|
+
}).finally(() => {
|
|
3067
|
+
setIsInitiating(false);
|
|
3068
|
+
setNeedsDepositAddress(false);
|
|
3069
|
+
});
|
|
3070
|
+
}, [isReady, isInitiating, client, onError]);
|
|
3071
|
+
useEffect5(() => {
|
|
3072
|
+
if (isTimedOut && isInitiating) {
|
|
3073
|
+
setIsInitiating(false);
|
|
3074
|
+
setNeedsDepositAddress(false);
|
|
3075
|
+
onError == null ? void 0 : onError(new Error("Deposit address provisioning timed out"));
|
|
3076
|
+
}
|
|
3077
|
+
}, [isTimedOut, isInitiating, onError]);
|
|
3078
|
+
const handleClick = useCallback8(() => {
|
|
3079
|
+
setIsInitiating(true);
|
|
3080
|
+
setNeedsDepositAddress(true);
|
|
3081
|
+
}, []);
|
|
3082
|
+
return /* @__PURE__ */ jsx24(
|
|
3083
|
+
"button",
|
|
3084
|
+
{
|
|
3085
|
+
type: "button",
|
|
3086
|
+
disabled: isInitiating,
|
|
3087
|
+
onClick: handleClick,
|
|
3088
|
+
className: "shrink-0 cursor-pointer text-agg-sm font-agg-bold leading-agg-5 text-agg-primary whitespace-nowrap disabled:cursor-not-allowed disabled:opacity-60",
|
|
3089
|
+
children: isInitiating ? /* @__PURE__ */ jsx24("span", { className: "inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }) : "Verify Identity"
|
|
3090
|
+
}
|
|
3091
|
+
);
|
|
3092
|
+
};
|
|
3093
|
+
var TradingAccessSection = ({
|
|
3094
|
+
venueAccounts,
|
|
3095
|
+
onKycError
|
|
3096
|
+
}) => {
|
|
3097
|
+
return /* @__PURE__ */ jsxs24("div", { className: "agg-trading-access-section flex flex-col gap-3", children: [
|
|
3098
|
+
/* @__PURE__ */ jsx24(SectionTitle, { children: "Trading access" }),
|
|
3099
|
+
/* @__PURE__ */ jsx24("div", { className: "flex flex-col gap-2", children: TRADING_ACCESS_VENUES.map((venue) => {
|
|
3100
|
+
var _a;
|
|
3101
|
+
const venueAccount = venueAccounts == null ? void 0 : venueAccounts.find((va) => va.venue === venue);
|
|
3102
|
+
const isKalshi = venue === "kalshi";
|
|
3103
|
+
const isVerified = (venueAccount == null ? void 0 : venueAccount.kycStatus) === "verified";
|
|
3104
|
+
const displayName = (_a = venueLogoLabels[venue]) != null ? _a : venue;
|
|
3105
|
+
return /* @__PURE__ */ jsxs24(AccountRow, { children: [
|
|
3106
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-3", children: [
|
|
3107
|
+
/* @__PURE__ */ jsx24(VenueLogo, { venue, size: "small" }),
|
|
3108
|
+
/* @__PURE__ */ jsx24("span", { className: "text-agg-base font-agg-normal leading-6 text-agg-foreground whitespace-nowrap", children: displayName })
|
|
3109
|
+
] }),
|
|
3110
|
+
isKalshi && !isVerified ? /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-4", children: [
|
|
3111
|
+
/* @__PURE__ */ jsx24("span", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-muted-foreground whitespace-nowrap", children: "KYC required" }),
|
|
3112
|
+
/* @__PURE__ */ jsx24(VerifyIdentityButton, { onError: onKycError })
|
|
3113
|
+
] }) : isKalshi && isVerified ? /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-4", children: [
|
|
3114
|
+
/* @__PURE__ */ jsx24("span", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-muted-foreground whitespace-nowrap", children: "Verified" }),
|
|
3115
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2", children: [
|
|
3116
|
+
/* @__PURE__ */ jsx24(
|
|
3117
|
+
Icon,
|
|
3118
|
+
{
|
|
3119
|
+
name: "check-badge",
|
|
3120
|
+
size: "small",
|
|
3121
|
+
color: "var(--agg-color-primary, #536dfe)"
|
|
3122
|
+
}
|
|
3123
|
+
),
|
|
3124
|
+
/* @__PURE__ */ jsx24("span", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground whitespace-nowrap", children: "Available" })
|
|
3125
|
+
] })
|
|
3126
|
+
] }) : /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2", children: [
|
|
3127
|
+
/* @__PURE__ */ jsx24(Icon, { name: "check-badge", size: "small", color: "var(--agg-color-primary, #536dfe)" }),
|
|
3128
|
+
/* @__PURE__ */ jsx24("span", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground whitespace-nowrap", children: "Available" })
|
|
3129
|
+
] })
|
|
3130
|
+
] }, venue);
|
|
3131
|
+
}) })
|
|
3132
|
+
] });
|
|
3133
|
+
};
|
|
3134
|
+
var AccountsWalletsTab = ({
|
|
3135
|
+
exchanges: _exchanges,
|
|
3136
|
+
socialAccounts,
|
|
3137
|
+
email,
|
|
3138
|
+
venueAccounts,
|
|
3139
|
+
onKycError,
|
|
3140
|
+
onDisconnectExchange: _onDisconnectExchange,
|
|
3141
|
+
onConnectTwitter,
|
|
3142
|
+
onDisconnectTwitter,
|
|
3143
|
+
onConnectGoogle,
|
|
3144
|
+
onDisconnectGoogle,
|
|
3145
|
+
onConnectApple,
|
|
3146
|
+
onDisconnectApple,
|
|
3147
|
+
onConnectDiscord: _onConnectDiscord,
|
|
3148
|
+
onDisconnectDiscord: _onDisconnectDiscord,
|
|
3149
|
+
onConnectTelegram: _onConnectTelegram,
|
|
3150
|
+
onDisconnectTelegram: _onDisconnectTelegram,
|
|
3151
|
+
onConnectEmail
|
|
3152
|
+
}) => {
|
|
3153
|
+
const twitter = socialAccounts == null ? void 0 : socialAccounts.twitter;
|
|
3154
|
+
const google = socialAccounts == null ? void 0 : socialAccounts.google;
|
|
3155
|
+
const apple = socialAccounts == null ? void 0 : socialAccounts.apple;
|
|
3156
|
+
return /* @__PURE__ */ jsxs24("div", { className: "agg-accounts-wallets-tab flex flex-col gap-8", children: [
|
|
3157
|
+
/* @__PURE__ */ jsx24(TradingAccessSection, { venueAccounts, onKycError }),
|
|
3158
|
+
/* @__PURE__ */ jsxs24("div", { className: "agg-social-accounts-section flex flex-col gap-3", children: [
|
|
3159
|
+
/* @__PURE__ */ jsx24(SectionTitle, { children: "Social Accounts" }),
|
|
3160
|
+
/* @__PURE__ */ jsxs24("div", { className: "agg-social-accounts-list flex flex-col gap-2", children: [
|
|
3161
|
+
/* @__PURE__ */ jsxs24(AccountRow, { className: "agg-social-account-row", children: [
|
|
3162
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-3", children: [
|
|
3163
|
+
/* @__PURE__ */ jsx24("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-agg-foreground", children: /* @__PURE__ */ jsx24(Icon, { name: "google", size: "small", color: "currentColor" }) }),
|
|
3164
|
+
/* @__PURE__ */ jsx24("span", { className: "text-agg-base font-agg-normal leading-6 text-agg-foreground whitespace-nowrap", children: "Google" })
|
|
3165
|
+
] }),
|
|
3166
|
+
(google == null ? void 0 : google.connected) ? /* @__PURE__ */ jsx24(DisconnectTextButton, { onClick: onDisconnectGoogle }) : /* @__PURE__ */ jsx24(ConnectTextButton, { onClick: onConnectGoogle })
|
|
3167
|
+
] }),
|
|
3168
|
+
/* @__PURE__ */ jsxs24(AccountRow, { className: "agg-social-account-row", children: [
|
|
3169
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-3", children: [
|
|
3170
|
+
/* @__PURE__ */ jsx24("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-agg-foreground", children: /* @__PURE__ */ jsx24(Icon, { name: "apple", size: "small", color: "currentColor" }) }),
|
|
3171
|
+
/* @__PURE__ */ jsx24("span", { className: "text-agg-base font-agg-normal leading-6 text-agg-foreground whitespace-nowrap", children: "Apple" })
|
|
3172
|
+
] }),
|
|
3173
|
+
(apple == null ? void 0 : apple.connected) ? /* @__PURE__ */ jsx24(DisconnectTextButton, { onClick: onDisconnectApple }) : /* @__PURE__ */ jsx24(ConnectTextButton, { onClick: onConnectApple })
|
|
3174
|
+
] }),
|
|
3175
|
+
/* @__PURE__ */ jsxs24(AccountRow, { className: "agg-social-account-row", children: [
|
|
3176
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-3", children: [
|
|
3177
|
+
/* @__PURE__ */ jsx24("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-agg-foreground", children: /* @__PURE__ */ jsx24(Icon, { name: "twitter", size: "small", color: "currentColor" }) }),
|
|
3178
|
+
/* @__PURE__ */ jsx24("span", { className: "text-agg-base font-agg-normal leading-6 text-agg-foreground whitespace-nowrap", children: "X (Twitter)" })
|
|
3179
|
+
] }),
|
|
3180
|
+
(twitter == null ? void 0 : twitter.connected) ? /* @__PURE__ */ jsx24(DisconnectTextButton, { onClick: onDisconnectTwitter }) : /* @__PURE__ */ jsx24(ConnectTextButton, { onClick: onConnectTwitter })
|
|
3181
|
+
] })
|
|
3182
|
+
] })
|
|
3183
|
+
] }),
|
|
3184
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-3", children: [
|
|
3185
|
+
/* @__PURE__ */ jsx24(SectionTitle, { children: "Email Address" }),
|
|
3186
|
+
/* @__PURE__ */ jsxs24(
|
|
3187
|
+
"button",
|
|
3188
|
+
{
|
|
3189
|
+
type: "button",
|
|
3190
|
+
onClick: onConnectEmail,
|
|
3191
|
+
className: cn(
|
|
3192
|
+
"flex items-center justify-between",
|
|
3193
|
+
"rounded-agg-lg border border-agg-separator bg-agg-secondary",
|
|
3194
|
+
"px-5 py-3",
|
|
3195
|
+
"cursor-pointer hover:bg-agg-secondary-hover"
|
|
3196
|
+
),
|
|
3197
|
+
children: [
|
|
3198
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-3", children: [
|
|
3199
|
+
/* @__PURE__ */ jsx24("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-agg-foreground", children: /* @__PURE__ */ jsx24(Icon, { name: "email", size: "small", color: "currentColor" }) }),
|
|
3200
|
+
/* @__PURE__ */ jsx24("span", { className: "text-agg-base font-agg-normal leading-6 text-agg-foreground whitespace-nowrap", children: email != null ? email : "Connect email" })
|
|
3201
|
+
] }),
|
|
3202
|
+
/* @__PURE__ */ jsx24(Icon, { name: "chevron-right", size: "small", color: "currentColor" })
|
|
3203
|
+
]
|
|
3204
|
+
}
|
|
3205
|
+
)
|
|
3206
|
+
] })
|
|
3207
|
+
] });
|
|
3208
|
+
};
|
|
3209
|
+
AccountsWalletsTab.displayName = "AccountsWalletsTab";
|
|
3210
|
+
|
|
3211
|
+
// src/profile/index.tsx
|
|
3212
|
+
import { jsx as jsx25, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3213
|
+
var EVM_WALLET_VENUES = [Venue4.polymarket, Venue4.predict, Venue4.opinion];
|
|
3214
|
+
var ProfileModal = ({
|
|
3215
|
+
open,
|
|
3216
|
+
onOpenChange,
|
|
3217
|
+
username,
|
|
3218
|
+
avatarPreview,
|
|
3219
|
+
onSave,
|
|
3220
|
+
onDeleteProfile,
|
|
3221
|
+
exchanges,
|
|
3222
|
+
socialAccounts,
|
|
3223
|
+
wallets,
|
|
3224
|
+
email,
|
|
3225
|
+
onDisconnectExchange: onDisconnectExchangeProp,
|
|
3226
|
+
onConnectTwitter,
|
|
3227
|
+
onDisconnectTwitter,
|
|
3228
|
+
onConnectGoogle,
|
|
3229
|
+
onDisconnectGoogle,
|
|
3230
|
+
onConnectApple,
|
|
3231
|
+
onDisconnectApple,
|
|
3232
|
+
onConnectDiscord,
|
|
3233
|
+
onDisconnectDiscord,
|
|
3234
|
+
onConnectTelegram,
|
|
3235
|
+
onDisconnectTelegram,
|
|
3236
|
+
onDisconnectWallet,
|
|
3237
|
+
onConnectEmail,
|
|
3238
|
+
onKycError
|
|
3239
|
+
}) => {
|
|
3240
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
3241
|
+
const client = useAggClient2();
|
|
3242
|
+
const { user, startAuth } = useAggAuthState2();
|
|
3243
|
+
const [activeTab, setActiveTab] = useState11(PROFILE_TAB_KEYS.ABOUT);
|
|
3244
|
+
const resolvedInitialUsername = (_a = username != null ? username : user == null ? void 0 : user.username) != null ? _a : "";
|
|
3245
|
+
const [draftUsername, setDraftUsername] = useState11(resolvedInitialUsername);
|
|
3246
|
+
const [draftAvatarFile, setDraftAvatarFile] = useState11();
|
|
3247
|
+
const [draftAvatarPreview, setDraftAvatarPreview] = useState11();
|
|
3248
|
+
const [isSaving, setIsSaving] = useState11(false);
|
|
3249
|
+
const [avatarTypeError, setAvatarTypeError] = useState11(null);
|
|
3250
|
+
useEffect6(() => {
|
|
3251
|
+
var _a2;
|
|
3252
|
+
setDraftUsername((_a2 = username != null ? username : user == null ? void 0 : user.username) != null ? _a2 : "");
|
|
3253
|
+
}, [username, user == null ? void 0 : user.username]);
|
|
3254
|
+
const handleOpenChange = useCallback9(
|
|
3255
|
+
(isOpen) => {
|
|
3256
|
+
var _a2;
|
|
3257
|
+
if (!isOpen) {
|
|
3258
|
+
setActiveTab(PROFILE_TAB_KEYS.ABOUT);
|
|
3259
|
+
setIsSaving(false);
|
|
3260
|
+
setDraftUsername((_a2 = username != null ? username : user == null ? void 0 : user.username) != null ? _a2 : "");
|
|
3261
|
+
setDraftAvatarFile(void 0);
|
|
3262
|
+
setDraftAvatarPreview(void 0);
|
|
3263
|
+
setAvatarTypeError(null);
|
|
3264
|
+
}
|
|
3265
|
+
onOpenChange(isOpen);
|
|
3266
|
+
},
|
|
3267
|
+
[
|
|
3268
|
+
onOpenChange,
|
|
3269
|
+
username,
|
|
3270
|
+
user == null ? void 0 : user.username,
|
|
3271
|
+
setActiveTab,
|
|
3272
|
+
setIsSaving,
|
|
3273
|
+
setDraftUsername,
|
|
3274
|
+
setDraftAvatarFile,
|
|
3275
|
+
setDraftAvatarPreview
|
|
3276
|
+
]
|
|
3277
|
+
);
|
|
3278
|
+
const handleDraftAvatarChange = useCallback9(
|
|
3279
|
+
(file, preview) => {
|
|
3280
|
+
const ACCEPTED_AVATAR_TYPES = ["image/jpeg", "image/png", "image/gif", "image/webp"];
|
|
3281
|
+
if (file && !ACCEPTED_AVATAR_TYPES.includes(file.type)) {
|
|
3282
|
+
setAvatarTypeError("Unsupported format. Please use JPEG, PNG, GIF, or WebP.");
|
|
3283
|
+
return;
|
|
3284
|
+
}
|
|
3285
|
+
setAvatarTypeError(null);
|
|
3286
|
+
setDraftAvatarFile(file);
|
|
3287
|
+
setDraftAvatarPreview(preview);
|
|
3288
|
+
},
|
|
3289
|
+
[]
|
|
3290
|
+
);
|
|
3291
|
+
const originalUsername = (_b = username != null ? username : user == null ? void 0 : user.username) != null ? _b : "";
|
|
3292
|
+
const hasChanges = draftUsername !== originalUsername || draftAvatarFile !== void 0;
|
|
3293
|
+
const handleSave = useCallback9(() => __async(null, null, function* () {
|
|
3294
|
+
var _a2, _b2;
|
|
3295
|
+
setIsSaving(true);
|
|
3296
|
+
try {
|
|
3297
|
+
const normalizedUsername = draftUsername.trim();
|
|
3298
|
+
if (normalizedUsername !== originalUsername) {
|
|
3299
|
+
yield client.updateUser({ username: normalizedUsername || void 0 });
|
|
3300
|
+
}
|
|
3301
|
+
let avatarCdnUrl;
|
|
3302
|
+
if (draftAvatarFile) {
|
|
3303
|
+
const { uploadUrl, cdnUrl } = yield client.createAvatarUploadUrl(draftAvatarFile.type);
|
|
3304
|
+
const uploadResponse = yield fetch(uploadUrl, {
|
|
3305
|
+
method: "PUT",
|
|
3306
|
+
headers: {
|
|
3307
|
+
"Content-Type": draftAvatarFile.type
|
|
3308
|
+
},
|
|
3309
|
+
body: draftAvatarFile
|
|
3310
|
+
});
|
|
3311
|
+
if (!uploadResponse.ok) {
|
|
3312
|
+
throw new Error(`Avatar upload failed (${uploadResponse.status})`);
|
|
3313
|
+
}
|
|
3314
|
+
avatarCdnUrl = cdnUrl || void 0;
|
|
3315
|
+
yield new Promise((resolve) => setTimeout(resolve, 5e3));
|
|
3316
|
+
yield client.updateUser({ confirmAvatar: true });
|
|
3317
|
+
}
|
|
3318
|
+
const profile = yield client.getCurrentUser();
|
|
3319
|
+
const resolvedAvatarPreview = (_b2 = (_a2 = profile == null ? void 0 : profile.avatarUrl) != null ? _a2 : avatarCdnUrl) != null ? _b2 : draftAvatarPreview;
|
|
3320
|
+
onSave({
|
|
3321
|
+
username: normalizedUsername || void 0,
|
|
3322
|
+
avatarFile: draftAvatarFile,
|
|
3323
|
+
avatarPreview: resolvedAvatarPreview
|
|
3324
|
+
});
|
|
3325
|
+
onOpenChange(false);
|
|
3326
|
+
} finally {
|
|
3327
|
+
setIsSaving(false);
|
|
3328
|
+
}
|
|
3329
|
+
}), [
|
|
3330
|
+
client,
|
|
3331
|
+
draftAvatarFile,
|
|
3332
|
+
draftAvatarPreview,
|
|
3333
|
+
draftUsername,
|
|
3334
|
+
onOpenChange,
|
|
3335
|
+
onSave,
|
|
3336
|
+
originalUsername
|
|
3337
|
+
]);
|
|
3338
|
+
const handleCancel = useCallback9(() => {
|
|
3339
|
+
handleOpenChange(false);
|
|
3340
|
+
}, [handleOpenChange]);
|
|
3341
|
+
const isAccountConnected = (providers) => {
|
|
3342
|
+
var _a2, _b2, _c2;
|
|
3343
|
+
const normalizedProviders = providers.map((provider) => provider.toLowerCase());
|
|
3344
|
+
const fromAccounts = (_b2 = (_a2 = user == null ? void 0 : user.accounts) == null ? void 0 : _a2.some(
|
|
3345
|
+
(account) => normalizedProviders.includes(String(account.provider).toLowerCase())
|
|
3346
|
+
)) != null ? _b2 : false;
|
|
3347
|
+
const legacyIdentities = user == null ? void 0 : user.identities;
|
|
3348
|
+
const fromLegacy = (_c2 = legacyIdentities == null ? void 0 : legacyIdentities.some(
|
|
3349
|
+
(identity) => {
|
|
3350
|
+
var _a3;
|
|
3351
|
+
return normalizedProviders.includes(String((_a3 = identity.provider) != null ? _a3 : "").toLowerCase());
|
|
3352
|
+
}
|
|
3353
|
+
)) != null ? _c2 : false;
|
|
3354
|
+
return fromAccounts || fromLegacy;
|
|
3355
|
+
};
|
|
3356
|
+
const resolvedSocialAccounts = socialAccounts != null ? socialAccounts : {
|
|
3357
|
+
twitter: {
|
|
3358
|
+
connected: isAccountConnected(["twitter"])
|
|
3359
|
+
},
|
|
3360
|
+
google: {
|
|
3361
|
+
connected: isAccountConnected(["google"])
|
|
3362
|
+
},
|
|
3363
|
+
apple: {
|
|
3364
|
+
connected: isAccountConnected(["apple"])
|
|
3365
|
+
}
|
|
3366
|
+
};
|
|
3367
|
+
const resolvedEmail = (_h = (_g = email != null ? email : (_d = (_c = user == null ? void 0 : user.accounts) == null ? void 0 : _c.find(
|
|
3368
|
+
(account) => String(account.provider).toLowerCase() === "email"
|
|
3369
|
+
)) == null ? void 0 : _d.providerAccountId) != null ? _g : (_f = (_e = user == null ? void 0 : user.identities) == null ? void 0 : _e.find((identity) => {
|
|
3370
|
+
var _a2;
|
|
3371
|
+
return String((_a2 = identity.provider) != null ? _a2 : "").toLowerCase() === "email";
|
|
3372
|
+
})) == null ? void 0 : _f.providerAccountId) != null ? _h : null;
|
|
3373
|
+
const resolveRedirectUrl = () => {
|
|
3374
|
+
if (typeof window === "undefined") return "http://localhost";
|
|
3375
|
+
return `${window.location.origin}${window.location.pathname}${window.location.search}`;
|
|
3376
|
+
};
|
|
3377
|
+
const navigateTopWindow = (url) => {
|
|
3378
|
+
var _a2;
|
|
3379
|
+
if (typeof window === "undefined") return;
|
|
3380
|
+
((_a2 = window.top) != null ? _a2 : window).location.assign(url);
|
|
3381
|
+
};
|
|
3382
|
+
const handleConnectTwitter = useCallback9(() => __async(null, null, function* () {
|
|
3383
|
+
const result = yield startAuth({
|
|
3384
|
+
provider: "twitter",
|
|
3385
|
+
redirectUrl: resolveRedirectUrl()
|
|
3386
|
+
});
|
|
3387
|
+
onConnectTwitter == null ? void 0 : onConnectTwitter();
|
|
3388
|
+
if (result.type === "redirect") {
|
|
3389
|
+
navigateTopWindow(result.url);
|
|
3390
|
+
}
|
|
3391
|
+
}), [onConnectTwitter, startAuth]);
|
|
3392
|
+
const handleConnectGoogle = useCallback9(() => __async(null, null, function* () {
|
|
3393
|
+
const result = yield startAuth({
|
|
3394
|
+
provider: "google",
|
|
3395
|
+
redirectUrl: resolveRedirectUrl()
|
|
3396
|
+
});
|
|
3397
|
+
onConnectGoogle == null ? void 0 : onConnectGoogle();
|
|
3398
|
+
if (result.type === "redirect") {
|
|
3399
|
+
navigateTopWindow(result.url);
|
|
3400
|
+
}
|
|
3401
|
+
}), [onConnectGoogle, startAuth]);
|
|
3402
|
+
const handleConnectApple = useCallback9(() => __async(null, null, function* () {
|
|
3403
|
+
const result = yield startAuth({
|
|
3404
|
+
provider: "apple",
|
|
3405
|
+
redirectUrl: resolveRedirectUrl()
|
|
3406
|
+
});
|
|
3407
|
+
onConnectApple == null ? void 0 : onConnectApple();
|
|
3408
|
+
if (result.type === "redirect") {
|
|
3409
|
+
navigateTopWindow(result.url);
|
|
3410
|
+
}
|
|
3411
|
+
}), [onConnectApple, startAuth]);
|
|
3412
|
+
const handleDisconnectTwitter = useCallback9(() => __async(null, null, function* () {
|
|
3413
|
+
yield client.disconnectAccount("twitter");
|
|
3414
|
+
yield client.getCurrentUser();
|
|
3415
|
+
onDisconnectTwitter == null ? void 0 : onDisconnectTwitter();
|
|
3416
|
+
}), [client, onDisconnectTwitter]);
|
|
3417
|
+
const handleDisconnectGoogle = useCallback9(() => __async(null, null, function* () {
|
|
3418
|
+
yield client.disconnectAccount("google");
|
|
3419
|
+
yield client.getCurrentUser();
|
|
3420
|
+
onDisconnectGoogle == null ? void 0 : onDisconnectGoogle();
|
|
3421
|
+
}), [client, onDisconnectGoogle]);
|
|
3422
|
+
const handleDisconnectApple = useCallback9(() => __async(null, null, function* () {
|
|
3423
|
+
yield client.disconnectAccount("apple");
|
|
3424
|
+
yield client.getCurrentUser();
|
|
3425
|
+
onDisconnectApple == null ? void 0 : onDisconnectApple();
|
|
3426
|
+
}), [client, onDisconnectApple]);
|
|
3427
|
+
const handleConnectEmail = useCallback9(() => __async(null, null, function* () {
|
|
3428
|
+
var _a2;
|
|
3429
|
+
const typedEmail = typeof window !== "undefined" ? (_a2 = window.prompt("Enter your email to receive a magic link")) == null ? void 0 : _a2.trim() : void 0;
|
|
3430
|
+
if (!typedEmail) return;
|
|
3431
|
+
yield startAuth({
|
|
3432
|
+
provider: "email",
|
|
3433
|
+
email: typedEmail,
|
|
3434
|
+
redirectUrl: resolveRedirectUrl()
|
|
3435
|
+
});
|
|
3436
|
+
onConnectEmail == null ? void 0 : onConnectEmail();
|
|
3437
|
+
}), [onConnectEmail, startAuth]);
|
|
3438
|
+
const handleDisconnectWallet = useCallback9(
|
|
3439
|
+
(wallet) => __async(null, null, function* () {
|
|
3440
|
+
const normalizedChain = wallet.chain.toLowerCase();
|
|
3441
|
+
const provider = normalizedChain === "solana" || normalizedChain === "svm" ? "solana_wallet" : "wallet";
|
|
3442
|
+
yield client.disconnectAccount(provider);
|
|
3443
|
+
yield client.getCurrentUser();
|
|
3444
|
+
onDisconnectWallet == null ? void 0 : onDisconnectWallet(wallet);
|
|
3445
|
+
}),
|
|
3446
|
+
[client, onDisconnectWallet]
|
|
3447
|
+
);
|
|
3448
|
+
const providerActionMap = useMemo3(
|
|
3449
|
+
() => ({
|
|
3450
|
+
twitter: {
|
|
3451
|
+
connect: () => {
|
|
3452
|
+
void handleConnectTwitter();
|
|
3453
|
+
},
|
|
3454
|
+
disconnect: () => {
|
|
3455
|
+
void handleDisconnectTwitter();
|
|
3456
|
+
}
|
|
3457
|
+
},
|
|
3458
|
+
google: {
|
|
3459
|
+
connect: () => {
|
|
3460
|
+
void handleConnectGoogle();
|
|
3461
|
+
},
|
|
3462
|
+
disconnect: () => {
|
|
3463
|
+
void handleDisconnectGoogle();
|
|
3464
|
+
}
|
|
3465
|
+
},
|
|
3466
|
+
apple: {
|
|
3467
|
+
connect: () => {
|
|
3468
|
+
void handleConnectApple();
|
|
3469
|
+
},
|
|
3470
|
+
disconnect: () => {
|
|
3471
|
+
void handleDisconnectApple();
|
|
3472
|
+
}
|
|
3473
|
+
},
|
|
3474
|
+
email: {
|
|
3475
|
+
connect: () => {
|
|
3476
|
+
void handleConnectEmail();
|
|
3477
|
+
}
|
|
3478
|
+
}
|
|
3479
|
+
}),
|
|
3480
|
+
[
|
|
3481
|
+
handleConnectApple,
|
|
3482
|
+
handleConnectEmail,
|
|
3483
|
+
handleConnectGoogle,
|
|
3484
|
+
handleConnectTwitter,
|
|
3485
|
+
handleDisconnectApple,
|
|
3486
|
+
handleDisconnectGoogle,
|
|
3487
|
+
handleDisconnectTwitter
|
|
3488
|
+
]
|
|
3489
|
+
);
|
|
3490
|
+
const shortenAddress = (address) => {
|
|
3491
|
+
if (address.length <= 12) return address;
|
|
3492
|
+
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
3493
|
+
};
|
|
3494
|
+
const resolvedWallets = useMemo3(() => {
|
|
3495
|
+
var _a2, _b2;
|
|
3496
|
+
if (wallets) return wallets;
|
|
3497
|
+
return (_b2 = (_a2 = user == null ? void 0 : user.wallets) == null ? void 0 : _a2.map((wallet) => ({
|
|
3498
|
+
chain: wallet.chain,
|
|
3499
|
+
address: wallet.address,
|
|
3500
|
+
displayAddress: shortenAddress(wallet.address)
|
|
3501
|
+
}))) != null ? _b2 : [];
|
|
3502
|
+
}, [user == null ? void 0 : user.wallets, wallets]);
|
|
3503
|
+
const resolvedExchanges = useMemo3(() => {
|
|
3504
|
+
var _a2, _b2;
|
|
3505
|
+
if (exchanges !== void 0) return exchanges;
|
|
3506
|
+
const walletAccount = (_a2 = user == null ? void 0 : user.accounts) == null ? void 0 : _a2.find(
|
|
3507
|
+
(a) => a.provider.toLowerCase() === "wallet"
|
|
3508
|
+
);
|
|
3509
|
+
if (!walletAccount) return [];
|
|
3510
|
+
const addr = walletAccount.providerAccountId;
|
|
3511
|
+
const displayAddress = (_b2 = shortenAddress(addr)) != null ? _b2 : addr;
|
|
3512
|
+
return EVM_WALLET_VENUES.map((venue) => ({ venue, displayAddress, verified: false }));
|
|
3513
|
+
}, [exchanges, user == null ? void 0 : user.accounts]);
|
|
3514
|
+
const handleDisconnectExchange = useCallback9(
|
|
3515
|
+
(venue) => __async(null, null, function* () {
|
|
3516
|
+
if (exchanges !== void 0) {
|
|
3517
|
+
onDisconnectExchangeProp == null ? void 0 : onDisconnectExchangeProp(venue);
|
|
3518
|
+
return;
|
|
3519
|
+
}
|
|
3520
|
+
yield client.disconnectAccount("wallet");
|
|
3521
|
+
yield client.getCurrentUser();
|
|
3522
|
+
onDisconnectExchangeProp == null ? void 0 : onDisconnectExchangeProp(venue);
|
|
3523
|
+
}),
|
|
3524
|
+
[client, exchanges, onDisconnectExchangeProp]
|
|
3525
|
+
);
|
|
3526
|
+
return /* @__PURE__ */ jsx25(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs25(
|
|
3527
|
+
Modal.Container,
|
|
3528
|
+
{
|
|
3529
|
+
maxWidth: "800px",
|
|
3530
|
+
"aria-label": "Edit Profile",
|
|
3531
|
+
classNames: {
|
|
3532
|
+
container: cn("agg-profile-modal", "min-h-[37.5rem]")
|
|
3533
|
+
},
|
|
3534
|
+
children: [
|
|
3535
|
+
/* @__PURE__ */ jsx25(Modal.Header, { title: "Edit Profile", classNames: { root: "agg-profile-modal-header" } }),
|
|
3536
|
+
/* @__PURE__ */ jsx25(Modal.Body, { classNames: { root: cn("agg-profile-modal-body", "overflow-x-visible") }, children: /* @__PURE__ */ jsxs25("div", { className: "agg-profile-layout flex flex-col sm:flex-row sm:gap-10", children: [
|
|
3537
|
+
/* @__PURE__ */ jsxs25("div", { className: "shrink-0", children: [
|
|
3538
|
+
/* @__PURE__ */ jsx25("div", { className: "agg-profile-tabs mb-6 flex gap-2 sm:hidden", children: PROFILE_TAB_ITEMS.map((tab) => {
|
|
3539
|
+
const isActive = activeTab === tab.value;
|
|
3540
|
+
return /* @__PURE__ */ jsxs25(
|
|
3541
|
+
"button",
|
|
3542
|
+
{
|
|
3543
|
+
type: "button",
|
|
3544
|
+
onClick: () => setActiveTab(tab.value),
|
|
3545
|
+
className: cn(
|
|
3546
|
+
"agg-profile-tab-trigger",
|
|
3547
|
+
"flex items-center gap-3 px-4 py-3 rounded-agg-lg",
|
|
3548
|
+
"text-agg-sm leading-agg-5 font-agg-sans",
|
|
3549
|
+
"transition-colors cursor-pointer",
|
|
3550
|
+
"border-b-2",
|
|
3551
|
+
isActive ? "font-agg-normal text-agg-foreground bg-agg-secondary-hover border-agg-primary" : "font-agg-normal text-agg-foreground border-transparent"
|
|
3552
|
+
),
|
|
3553
|
+
children: [
|
|
3554
|
+
/* @__PURE__ */ jsx25(Icon, { name: tab.icon, size: "small", color: "currentColor" }),
|
|
3555
|
+
/* @__PURE__ */ jsx25("span", { className: "whitespace-nowrap", children: tab.label })
|
|
3556
|
+
]
|
|
3557
|
+
},
|
|
3558
|
+
tab.value
|
|
3559
|
+
);
|
|
3560
|
+
}) }),
|
|
3561
|
+
/* @__PURE__ */ jsx25(
|
|
3562
|
+
"nav",
|
|
3563
|
+
{
|
|
3564
|
+
className: cn(
|
|
3565
|
+
"agg-profile-sidebar",
|
|
3566
|
+
"hidden sm:sticky sm:top-0 sm:self-start sm:flex sm:flex-col",
|
|
3567
|
+
"w-[240px]",
|
|
3568
|
+
"overflow-hidden rounded-agg-lg",
|
|
3569
|
+
"border border-agg-separator",
|
|
3570
|
+
"bg-agg-secondary",
|
|
3571
|
+
"py-3"
|
|
3572
|
+
),
|
|
3573
|
+
role: "tablist",
|
|
3574
|
+
"aria-label": "Profile sections",
|
|
3575
|
+
children: PROFILE_TAB_ITEMS.map((tab) => {
|
|
3576
|
+
const isActive = activeTab === tab.value;
|
|
3577
|
+
return /* @__PURE__ */ jsxs25(
|
|
3578
|
+
"button",
|
|
3579
|
+
{
|
|
3580
|
+
type: "button",
|
|
3581
|
+
role: "tab",
|
|
3582
|
+
"aria-selected": isActive,
|
|
3583
|
+
onClick: () => setActiveTab(tab.value),
|
|
3584
|
+
className: cn(
|
|
3585
|
+
"agg-profile-tab-trigger",
|
|
3586
|
+
"relative flex items-center gap-3",
|
|
3587
|
+
"h-[49px] px-6 py-4",
|
|
3588
|
+
"text-agg-sm leading-agg-5 font-agg-sans",
|
|
3589
|
+
"transition-colors cursor-pointer",
|
|
3590
|
+
isActive ? "font-agg-normal text-agg-foreground bg-agg-secondary-hover" : "font-agg-normal text-agg-foreground"
|
|
3591
|
+
),
|
|
3592
|
+
children: [
|
|
3593
|
+
isActive ? /* @__PURE__ */ jsx25("div", { className: "absolute left-0 top-0 bottom-0 w-1 bg-agg-primary" }) : null,
|
|
3594
|
+
/* @__PURE__ */ jsx25(Icon, { name: tab.icon, size: "small", color: "currentColor" }),
|
|
3595
|
+
/* @__PURE__ */ jsx25("span", { className: "shrink-0 whitespace-nowrap", children: tab.label })
|
|
3596
|
+
]
|
|
3597
|
+
},
|
|
3598
|
+
tab.value
|
|
3599
|
+
);
|
|
3600
|
+
})
|
|
3601
|
+
}
|
|
3602
|
+
)
|
|
3603
|
+
] }),
|
|
3604
|
+
/* @__PURE__ */ jsxs25("div", { className: "agg-profile-content min-w-0 flex-1", children: [
|
|
3605
|
+
activeTab === PROFILE_TAB_KEYS.ABOUT ? /* @__PURE__ */ jsx25(
|
|
3606
|
+
AboutTab,
|
|
3607
|
+
{
|
|
3608
|
+
username: username != null ? username : user == null ? void 0 : user.username,
|
|
3609
|
+
avatarPreview: (_i = user == null ? void 0 : user.avatarUrl) != null ? _i : avatarPreview,
|
|
3610
|
+
onDeleteProfile,
|
|
3611
|
+
draftUsername,
|
|
3612
|
+
onDraftUsernameChange: setDraftUsername,
|
|
3613
|
+
draftAvatarFile,
|
|
3614
|
+
onDraftAvatarChange: handleDraftAvatarChange,
|
|
3615
|
+
draftAvatarPreview,
|
|
3616
|
+
avatarError: avatarTypeError
|
|
3617
|
+
}
|
|
3618
|
+
) : null,
|
|
3619
|
+
activeTab === PROFILE_TAB_KEYS.ACCOUNTS_WALLETS ? /* @__PURE__ */ jsx25(
|
|
3620
|
+
AccountsWalletsTab,
|
|
3621
|
+
{
|
|
3622
|
+
exchanges: resolvedExchanges,
|
|
3623
|
+
venueAccounts: user == null ? void 0 : user.venueAccounts,
|
|
3624
|
+
onKycError,
|
|
3625
|
+
socialAccounts: resolvedSocialAccounts,
|
|
3626
|
+
wallets: resolvedWallets,
|
|
3627
|
+
email: resolvedEmail,
|
|
3628
|
+
onDisconnectExchange: (venue) => {
|
|
3629
|
+
void handleDisconnectExchange(venue);
|
|
3630
|
+
},
|
|
3631
|
+
onConnectTwitter: providerActionMap.twitter.connect,
|
|
3632
|
+
onDisconnectTwitter: providerActionMap.twitter.disconnect,
|
|
3633
|
+
onConnectGoogle: providerActionMap.google.connect,
|
|
3634
|
+
onDisconnectGoogle: providerActionMap.google.disconnect,
|
|
3635
|
+
onConnectApple: providerActionMap.apple.connect,
|
|
3636
|
+
onDisconnectApple: providerActionMap.apple.disconnect,
|
|
3637
|
+
onConnectDiscord,
|
|
3638
|
+
onDisconnectDiscord,
|
|
3639
|
+
onConnectTelegram,
|
|
3640
|
+
onDisconnectTelegram,
|
|
3641
|
+
onDisconnectWallet: (wallet) => {
|
|
3642
|
+
void handleDisconnectWallet(wallet);
|
|
3643
|
+
},
|
|
3644
|
+
onConnectEmail: providerActionMap.email.connect
|
|
3645
|
+
}
|
|
3646
|
+
) : null
|
|
3647
|
+
] })
|
|
3648
|
+
] }) }),
|
|
3649
|
+
/* @__PURE__ */ jsxs25(Modal.Footer, { classNames: { root: "agg-profile-modal-footer" }, children: [
|
|
3650
|
+
/* @__PURE__ */ jsx25(Button, { variant: "secondary", size: "large", onClick: handleCancel, className: "min-w-[120px]", children: "Cancel" }),
|
|
3651
|
+
/* @__PURE__ */ jsx25(
|
|
3652
|
+
Button,
|
|
3653
|
+
{
|
|
3654
|
+
variant: "primary",
|
|
3655
|
+
size: "large",
|
|
3656
|
+
disabled: !hasChanges,
|
|
3657
|
+
isLoading: isSaving,
|
|
3658
|
+
onClick: handleSave,
|
|
3659
|
+
children: "Save Changes"
|
|
3660
|
+
}
|
|
3661
|
+
)
|
|
3662
|
+
] })
|
|
3663
|
+
]
|
|
3664
|
+
}
|
|
3665
|
+
) });
|
|
3666
|
+
};
|
|
3667
|
+
ProfileModal.displayName = "ProfileModal";
|
|
3668
|
+
|
|
3669
|
+
// src/geo-block-modal/index.tsx
|
|
3670
|
+
import { useLabels as useLabels22 } from "@agg-build/hooks";
|
|
3671
|
+
import { useCallback as useCallback10 } from "react";
|
|
3672
|
+
import { jsx as jsx26, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3673
|
+
var GeoBlockModal = ({
|
|
3674
|
+
open,
|
|
3675
|
+
onOpenChange,
|
|
3676
|
+
onConfirm,
|
|
3677
|
+
classNames
|
|
3678
|
+
}) => {
|
|
3679
|
+
const labels = useLabels22();
|
|
3680
|
+
const handleConfirm = useCallback10(() => {
|
|
3681
|
+
onConfirm == null ? void 0 : onConfirm();
|
|
3682
|
+
onOpenChange(false);
|
|
3683
|
+
}, [onConfirm, onOpenChange]);
|
|
3684
|
+
return /* @__PURE__ */ jsx26(
|
|
3685
|
+
Modal,
|
|
3686
|
+
{
|
|
3687
|
+
open,
|
|
3688
|
+
onOpenChange,
|
|
3689
|
+
"aria-label": labels.trading.geoBlockModalAriaLabel,
|
|
3690
|
+
children: /* @__PURE__ */ jsxs26(
|
|
3691
|
+
Modal.Container,
|
|
3692
|
+
{
|
|
3693
|
+
maxWidth: "480px",
|
|
3694
|
+
classNames: { container: cn("!rounded-agg-2xl", classNames == null ? void 0 : classNames.container) },
|
|
3695
|
+
children: [
|
|
3696
|
+
/* @__PURE__ */ jsx26(Modal.Header, { title: "", hideBorder: true, classNames: { container: "px-8 pt-8 pb-0" } }),
|
|
3697
|
+
/* @__PURE__ */ jsx26(Modal.Body, { classNames: { root: cn("!px-10 !pb-12 !pt-0", classNames == null ? void 0 : classNames.body) }, children: /* @__PURE__ */ jsxs26("div", { className: "flex flex-col items-center gap-8", children: [
|
|
3698
|
+
/* @__PURE__ */ jsx26(
|
|
3699
|
+
Icon,
|
|
3700
|
+
{
|
|
3701
|
+
name: "internet-security",
|
|
3702
|
+
className: "h-[60px] w-[60px] text-agg-muted-foreground"
|
|
3703
|
+
}
|
|
3704
|
+
),
|
|
3705
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
3706
|
+
/* @__PURE__ */ jsx26("h2", { className: "text-agg-2xl font-agg-bold leading-agg-8 text-agg-foreground", children: labels.trading.geoBlockModalTitle }),
|
|
3707
|
+
/* @__PURE__ */ jsx26("p", { className: "text-agg-base font-agg-normal leading-agg-6 text-agg-foreground", children: labels.trading.geoBlockModalDescription })
|
|
3708
|
+
] }),
|
|
3709
|
+
/* @__PURE__ */ jsx26(
|
|
3710
|
+
Button,
|
|
3711
|
+
{
|
|
3712
|
+
variant: "secondary",
|
|
3713
|
+
size: "large",
|
|
3714
|
+
className: "h-10 min-w-[140px] px-6",
|
|
3715
|
+
onClick: handleConfirm,
|
|
3716
|
+
children: labels.trading.geoBlockModalConfirm
|
|
3717
|
+
}
|
|
3718
|
+
)
|
|
3719
|
+
] }) })
|
|
3720
|
+
]
|
|
3721
|
+
}
|
|
3722
|
+
)
|
|
3723
|
+
}
|
|
3724
|
+
);
|
|
3725
|
+
};
|
|
3726
|
+
GeoBlockModal.displayName = "GeoBlockModal";
|
|
3727
|
+
|
|
3728
|
+
export {
|
|
3729
|
+
CARD_NETWORK_OPTIONS,
|
|
3730
|
+
clearPendingCardSession,
|
|
3731
|
+
getPendingCardSession,
|
|
3732
|
+
DepositModal,
|
|
3733
|
+
WithdrawModal,
|
|
3734
|
+
HowItWorksStep,
|
|
3735
|
+
ProfileSetupStep,
|
|
3736
|
+
ConnectAccountsStep,
|
|
3737
|
+
ConnectKalshiModal,
|
|
3738
|
+
ConnectOnchainModal,
|
|
3739
|
+
OnboardingModal,
|
|
3740
|
+
ProfileModal,
|
|
3741
|
+
GeoBlockModal
|
|
3742
|
+
};
|