@agg-build/ui 4.26.0 → 4.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (552) hide show
  1. package/dist/event-trading-state.utils-B3my25Re.mjs +789 -0
  2. package/dist/event-trading-state.utils-s4DEc4iA.js +921 -0
  3. package/dist/events.js +23 -17650
  4. package/dist/events.mjs +3 -50
  5. package/dist/index.js +811 -47144
  6. package/dist/index.mjs +584 -1204
  7. package/dist/list-D8v2SmY1.js +6989 -0
  8. package/dist/list-DD7roCVl.mjs +6838 -0
  9. package/dist/manage-betdex-account-modal-21ZVLsz0.js +2390 -0
  10. package/dist/manage-betdex-account-modal-D2vKHird.mjs +2294 -0
  11. package/dist/modals-BReGwJzz.mjs +2993 -0
  12. package/dist/modals-CSexQO1C.js +3077 -0
  13. package/dist/modals.js +24 -11810
  14. package/dist/modals.mjs +3 -49
  15. package/dist/pages-CMlCYngA.mjs +7846 -0
  16. package/dist/pages-xvAzj6c2.js +7955 -0
  17. package/dist/pages.js +25 -42383
  18. package/dist/pages.mjs +3 -57
  19. package/dist/primitives-CqxNeV7H.js +9930 -0
  20. package/dist/primitives-Dz5aF8ma.mjs +8928 -0
  21. package/dist/primitives.js +102 -11079
  22. package/dist/primitives.mjs +1 -204
  23. package/dist/trading-CDkNdjGx.mjs +7086 -0
  24. package/dist/trading-CXsZFd3l.js +7217 -0
  25. package/dist/trading.js +39 -18215
  26. package/dist/trading.mjs +3 -68
  27. package/dist/types/agg-provider.d.mts +1 -1
  28. package/dist/types/agg-provider.d.ts +1 -1
  29. package/dist/types/auth/connect-button-view/index.d.mts +4 -5
  30. package/dist/types/auth/connect-button-view/index.d.ts +4 -5
  31. package/dist/types/deposit/components/DepositQRCode.d.mts +2 -2
  32. package/dist/types/deposit/components/DepositQRCode.d.ts +2 -2
  33. package/dist/types/deposit/index.d.mts +4 -4
  34. package/dist/types/deposit/index.d.ts +4 -4
  35. package/dist/types/deposit/steps/card-deposit.d.mts +1 -1
  36. package/dist/types/deposit/steps/card-deposit.d.ts +1 -1
  37. package/dist/types/deposit/steps/card-payment-pending.d.mts +1 -1
  38. package/dist/types/deposit/steps/card-payment-pending.d.ts +1 -1
  39. package/dist/types/deposit/steps/card-provider.d.mts +1 -1
  40. package/dist/types/deposit/steps/card-provider.d.ts +1 -1
  41. package/dist/types/deposit/steps/card-purchase-success.d.mts +1 -1
  42. package/dist/types/deposit/steps/card-purchase-success.d.ts +1 -1
  43. package/dist/types/deposit/steps/card-widget.d.mts +1 -1
  44. package/dist/types/deposit/steps/card-widget.d.ts +1 -1
  45. package/dist/types/deposit/steps/crypto-transfer.d.mts +1 -1
  46. package/dist/types/deposit/steps/crypto-transfer.d.ts +1 -1
  47. package/dist/types/deposit/steps/deposit-method.d.mts +2 -1
  48. package/dist/types/deposit/steps/deposit-method.d.ts +2 -1
  49. package/dist/types/deposit/steps/venue-selection.d.mts +1 -1
  50. package/dist/types/deposit/steps/venue-selection.d.ts +1 -1
  51. package/dist/types/deposit/steps/wallet-form.d.mts +1 -1
  52. package/dist/types/deposit/steps/wallet-form.d.ts +1 -1
  53. package/dist/types/deposit/steps/wallet-processing.d.mts +1 -1
  54. package/dist/types/deposit/steps/wallet-processing.d.ts +1 -1
  55. package/dist/types/deposit/steps/wallet-success.d.mts +1 -1
  56. package/dist/types/deposit/steps/wallet-success.d.ts +1 -1
  57. package/dist/types/events/item/event-list-item.utils.d.mts +1 -1
  58. package/dist/types/events/item/event-list-item.utils.d.ts +1 -1
  59. package/dist/types/events/item/index.d.mts +8 -8
  60. package/dist/types/events/item/index.d.ts +8 -8
  61. package/dist/types/events/item-details/event-list-item-details-market-selector.d.mts +1 -1
  62. package/dist/types/events/item-details/event-list-item-details-market-selector.d.ts +1 -1
  63. package/dist/types/events/item-details/event-markets-chart.d.mts +1 -1
  64. package/dist/types/events/item-details/event-markets-chart.d.ts +1 -1
  65. package/dist/types/events/item-details/event-markets-chart.utils.d.mts +1 -1
  66. package/dist/types/events/item-details/event-markets-chart.utils.d.ts +1 -1
  67. package/dist/types/events/item-details/index.d.mts +4 -4
  68. package/dist/types/events/item-details/index.d.ts +4 -4
  69. package/dist/types/events/item-details/settlement-summary.d.mts +4 -4
  70. package/dist/types/events/item-details/settlement-summary.d.ts +4 -4
  71. package/dist/types/events/list/category-sidebar.d.mts +4 -4
  72. package/dist/types/events/list/category-sidebar.d.ts +4 -4
  73. package/dist/types/events/list/event-list-tabs.d.mts +4 -8
  74. package/dist/types/events/list/event-list-tabs.d.ts +4 -8
  75. package/dist/types/events/list/event-list-venue-strip.d.mts +4 -11
  76. package/dist/types/events/list/event-list-venue-strip.d.ts +4 -11
  77. package/dist/types/events/list/index.d.mts +4 -4
  78. package/dist/types/events/list/index.d.ts +4 -4
  79. package/dist/types/events/market-details/index.d.mts +8 -8
  80. package/dist/types/events/market-details/index.d.ts +8 -8
  81. package/dist/types/events/market-details/market-details-graph-panel.d.mts +4 -14
  82. package/dist/types/events/market-details/market-details-graph-panel.d.ts +4 -14
  83. package/dist/types/events/market-details/market-details-outcome-button.d.mts +4 -4
  84. package/dist/types/events/market-details/market-details-outcome-button.d.ts +4 -4
  85. package/dist/types/events/market-details/orderbook-aggregation.d.mts +3 -1
  86. package/dist/types/events/market-details/orderbook-aggregation.d.ts +3 -1
  87. package/dist/types/events/market-details/use-visible-market-streams.d.mts +1 -1
  88. package/dist/types/events/market-details/use-visible-market-streams.d.ts +1 -1
  89. package/dist/types/events/orderbook/index.d.mts +4 -4
  90. package/dist/types/events/orderbook/index.d.ts +4 -4
  91. package/dist/types/events/orderbook/orderbook-with-states.d.mts +4 -4
  92. package/dist/types/events/orderbook/orderbook-with-states.d.ts +4 -4
  93. package/dist/types/events/shared/chart-source-caption.d.mts +1 -1
  94. package/dist/types/events/shared/chart-source-caption.d.ts +1 -1
  95. package/dist/types/events/shared/sports-live-score.d.mts +4 -4
  96. package/dist/types/events/shared/sports-live-score.d.ts +4 -4
  97. package/dist/types/events/shared/use-chart-orderbook.d.mts +3 -3
  98. package/dist/types/events/shared/use-chart-orderbook.d.ts +3 -3
  99. package/dist/types/geo-block-banner/index.d.mts +4 -4
  100. package/dist/types/geo-block-banner/index.d.ts +4 -4
  101. package/dist/types/geo-block-modal/index.d.mts +4 -4
  102. package/dist/types/geo-block-modal/index.d.ts +4 -4
  103. package/dist/types/kyc/shared-kyc-modal.d.mts +4 -4
  104. package/dist/types/kyc/shared-kyc-modal.d.ts +4 -4
  105. package/dist/types/notifications/agg-notification-events-provider.d.mts +1 -1
  106. package/dist/types/notifications/agg-notification-events-provider.d.ts +1 -1
  107. package/dist/types/notifications/agg-toast-provider.d.mts +1 -1
  108. package/dist/types/notifications/agg-toast-provider.d.ts +1 -1
  109. package/dist/types/onboarding/index.d.mts +4 -4
  110. package/dist/types/onboarding/index.d.ts +4 -4
  111. package/dist/types/onboarding/steps/connect-accounts.d.mts +4 -4
  112. package/dist/types/onboarding/steps/connect-accounts.d.ts +4 -4
  113. package/dist/types/onboarding/steps/connect-kalshi-modal.d.mts +4 -4
  114. package/dist/types/onboarding/steps/connect-kalshi-modal.d.ts +4 -4
  115. package/dist/types/onboarding/steps/connect-novig-modal.d.mts +1 -1
  116. package/dist/types/onboarding/steps/connect-novig-modal.d.ts +1 -1
  117. package/dist/types/onboarding/steps/connect-onchain-modal.d.mts +4 -4
  118. package/dist/types/onboarding/steps/connect-onchain-modal.d.ts +4 -4
  119. package/dist/types/onboarding/steps/connect-prophetx-modal.d.mts +1 -1
  120. package/dist/types/onboarding/steps/connect-prophetx-modal.d.ts +1 -1
  121. package/dist/types/onboarding/steps/how-it-works.d.mts +4 -4
  122. package/dist/types/onboarding/steps/how-it-works.d.ts +4 -4
  123. package/dist/types/onboarding/steps/profile-setup.d.mts +4 -4
  124. package/dist/types/onboarding/steps/profile-setup.d.ts +4 -4
  125. package/dist/types/pages/event-market/event-market.shared.d.mts +4 -4
  126. package/dist/types/pages/event-market/event-market.shared.d.ts +4 -4
  127. package/dist/types/pages/event-market/event-market.types.d.mts +2 -0
  128. package/dist/types/pages/event-market/event-market.types.d.ts +2 -0
  129. package/dist/types/pages/event-market/event-open-orders.d.mts +8 -27
  130. package/dist/types/pages/event-market/event-open-orders.d.ts +8 -27
  131. package/dist/types/pages/event-market/index.d.mts +6 -6
  132. package/dist/types/pages/event-market/index.d.ts +6 -6
  133. package/dist/types/pages/event-market/sports-event-market-page.d.mts +6 -6
  134. package/dist/types/pages/event-market/sports-event-market-page.d.ts +6 -6
  135. package/dist/types/pages/event-market/sports-line-rail.d.mts +2 -1
  136. package/dist/types/pages/event-market/sports-line-rail.d.ts +2 -1
  137. package/dist/types/pages/event-market/sports-market-card.d.mts +4 -4
  138. package/dist/types/pages/event-market/sports-market-card.d.ts +4 -4
  139. package/dist/types/pages/event-market/sports-markets.d.mts +4 -4
  140. package/dist/types/pages/event-market/sports-markets.d.ts +4 -4
  141. package/dist/types/pages/home/index.d.mts +6 -6
  142. package/dist/types/pages/home/index.d.ts +6 -6
  143. package/dist/types/pages/leaderboard/components/leaderboard-header-row.d.mts +1 -1
  144. package/dist/types/pages/leaderboard/components/leaderboard-header-row.d.ts +1 -1
  145. package/dist/types/pages/leaderboard/components/leaderboard-row.d.mts +1 -1
  146. package/dist/types/pages/leaderboard/components/leaderboard-row.d.ts +1 -1
  147. package/dist/types/pages/leaderboard/components/leaderboard-skeleton.d.mts +1 -1
  148. package/dist/types/pages/leaderboard/components/leaderboard-skeleton.d.ts +1 -1
  149. package/dist/types/pages/leaderboard/components/segmented-control.d.mts +1 -1
  150. package/dist/types/pages/leaderboard/components/segmented-control.d.ts +1 -1
  151. package/dist/types/pages/leaderboard/index.d.mts +1 -1
  152. package/dist/types/pages/leaderboard/index.d.ts +1 -1
  153. package/dist/types/pages/user-profile/components/activity-row.d.mts +4 -4
  154. package/dist/types/pages/user-profile/components/activity-row.d.ts +4 -4
  155. package/dist/types/pages/user-profile/components/available-balance-card.d.mts +4 -4
  156. package/dist/types/pages/user-profile/components/available-balance-card.d.ts +4 -4
  157. package/dist/types/pages/user-profile/components/balance-display.d.mts +4 -4
  158. package/dist/types/pages/user-profile/components/balance-display.d.ts +4 -4
  159. package/dist/types/pages/user-profile/components/balances-card.d.mts +4 -4
  160. package/dist/types/pages/user-profile/components/balances-card.d.ts +4 -4
  161. package/dist/types/pages/user-profile/components/betdex-account-activity.d.mts +1 -1
  162. package/dist/types/pages/user-profile/components/betdex-account-activity.d.ts +1 -1
  163. package/dist/types/pages/user-profile/components/betdex-account-card.d.mts +1 -1
  164. package/dist/types/pages/user-profile/components/betdex-account-card.d.ts +1 -1
  165. package/dist/types/pages/user-profile/components/betdex-account-transfers.d.mts +1 -1
  166. package/dist/types/pages/user-profile/components/betdex-account-transfers.d.ts +1 -1
  167. package/dist/types/pages/user-profile/components/betdex-wallet-deposit.d.mts +1 -1
  168. package/dist/types/pages/user-profile/components/betdex-wallet-deposit.d.ts +1 -1
  169. package/dist/types/pages/user-profile/components/claim-activity-breakdown-modal.d.mts +1 -1
  170. package/dist/types/pages/user-profile/components/claim-activity-breakdown-modal.d.ts +1 -1
  171. package/dist/types/pages/user-profile/components/empty-state.d.mts +4 -4
  172. package/dist/types/pages/user-profile/components/empty-state.d.ts +4 -4
  173. package/dist/types/pages/user-profile/components/manage-balances-modal.d.mts +4 -4
  174. package/dist/types/pages/user-profile/components/manage-balances-modal.d.ts +4 -4
  175. package/dist/types/pages/user-profile/components/open-order-row.d.mts +4 -4
  176. package/dist/types/pages/user-profile/components/open-order-row.d.ts +4 -4
  177. package/dist/types/pages/user-profile/components/position-row.d.mts +4 -4
  178. package/dist/types/pages/user-profile/components/position-row.d.ts +4 -4
  179. package/dist/types/pages/user-profile/components/positions-activity.d.mts +4 -4
  180. package/dist/types/pages/user-profile/components/positions-activity.d.ts +4 -4
  181. package/dist/types/pages/user-profile/components/positions-value-card.d.mts +4 -4
  182. package/dist/types/pages/user-profile/components/positions-value-card.d.ts +4 -4
  183. package/dist/types/pages/user-profile/components/user-info-card.d.mts +4 -4
  184. package/dist/types/pages/user-profile/components/user-info-card.d.ts +4 -4
  185. package/dist/types/pages/user-profile/index.d.mts +6 -6
  186. package/dist/types/pages/user-profile/index.d.ts +6 -6
  187. package/dist/types/paper-trading/paper-onboarding-modal.d.mts +4 -14
  188. package/dist/types/paper-trading/paper-onboarding-modal.d.ts +4 -14
  189. package/dist/types/paper-trading/paper-trading-badge.d.mts +4 -16
  190. package/dist/types/paper-trading/paper-trading-badge.d.ts +4 -16
  191. package/dist/types/paper-trading/paper-trading-onboarding.d.mts +4 -12
  192. package/dist/types/paper-trading/paper-trading-onboarding.d.ts +4 -12
  193. package/dist/types/primitives/agg-logo/agg-logo.utils.d.mts +1 -1
  194. package/dist/types/primitives/agg-logo/agg-logo.utils.d.ts +1 -1
  195. package/dist/types/primitives/agg-logo/index.d.mts +4 -5
  196. package/dist/types/primitives/agg-logo/index.d.ts +4 -5
  197. package/dist/types/primitives/autocomplete-select/index.d.mts +4 -5
  198. package/dist/types/primitives/autocomplete-select/index.d.ts +4 -5
  199. package/dist/types/primitives/badge/index.d.mts +1 -1
  200. package/dist/types/primitives/badge/index.d.ts +1 -1
  201. package/dist/types/primitives/button/button.types.d.mts +2 -2
  202. package/dist/types/primitives/button/button.types.d.ts +2 -2
  203. package/dist/types/primitives/button/index.d.mts +4 -5
  204. package/dist/types/primitives/button/index.d.ts +4 -5
  205. package/dist/types/primitives/calendar/index.d.mts +4 -4
  206. package/dist/types/primitives/calendar/index.d.ts +4 -4
  207. package/dist/types/primitives/card/index.d.mts +4 -5
  208. package/dist/types/primitives/card/index.d.ts +4 -5
  209. package/dist/types/primitives/chart/chart-type-switch.d.mts +4 -5
  210. package/dist/types/primitives/chart/chart-type-switch.d.ts +4 -5
  211. package/dist/types/primitives/chart/index.d.mts +4 -5
  212. package/dist/types/primitives/chart/index.d.ts +4 -5
  213. package/dist/types/primitives/chart/probability-chart.d.mts +2 -2
  214. package/dist/types/primitives/chart/probability-chart.d.ts +2 -2
  215. package/dist/types/primitives/chart/probability-live-tail.d.mts +1 -1
  216. package/dist/types/primitives/chart/probability-live-tail.d.ts +1 -1
  217. package/dist/types/primitives/conditional-wrapper.d.mts +6 -7
  218. package/dist/types/primitives/conditional-wrapper.d.ts +6 -7
  219. package/dist/types/primitives/copy-button/index.d.mts +4 -5
  220. package/dist/types/primitives/copy-button/index.d.ts +4 -5
  221. package/dist/types/primitives/currency-input/index.d.mts +4 -5
  222. package/dist/types/primitives/currency-input/index.d.ts +4 -5
  223. package/dist/types/primitives/footer/agg-build-logo.d.mts +12 -15
  224. package/dist/types/primitives/footer/agg-build-logo.d.ts +12 -15
  225. package/dist/types/primitives/footer/index.d.mts +4 -6
  226. package/dist/types/primitives/footer/index.d.ts +4 -6
  227. package/dist/types/primitives/header/index.d.mts +4 -6
  228. package/dist/types/primitives/header/index.d.ts +4 -6
  229. package/dist/types/primitives/icon/index.d.mts +4 -5
  230. package/dist/types/primitives/icon/index.d.ts +4 -5
  231. package/dist/types/primitives/icon/registry.d.mts +180 -351
  232. package/dist/types/primitives/icon/registry.d.ts +180 -351
  233. package/dist/types/primitives/icon/svg/activity-chart.d.mts +4 -4
  234. package/dist/types/primitives/icon/svg/activity-chart.d.ts +4 -4
  235. package/dist/types/primitives/icon/svg/activity.d.mts +4 -4
  236. package/dist/types/primitives/icon/svg/activity.d.ts +4 -4
  237. package/dist/types/primitives/icon/svg/apple.d.mts +4 -4
  238. package/dist/types/primitives/icon/svg/apple.d.ts +4 -4
  239. package/dist/types/primitives/icon/svg/apps.d.mts +4 -4
  240. package/dist/types/primitives/icon/svg/apps.d.ts +4 -4
  241. package/dist/types/primitives/icon/svg/arbitrum.d.mts +4 -4
  242. package/dist/types/primitives/icon/svg/arbitrum.d.ts +4 -4
  243. package/dist/types/primitives/icon/svg/arrow-right.d.mts +4 -4
  244. package/dist/types/primitives/icon/svg/arrow-right.d.ts +4 -4
  245. package/dist/types/primitives/icon/svg/arrow-trend-up.d.mts +4 -4
  246. package/dist/types/primitives/icon/svg/arrow-trend-up.d.ts +4 -4
  247. package/dist/types/primitives/icon/svg/arrows-to-dot.d.mts +4 -4
  248. package/dist/types/primitives/icon/svg/arrows-to-dot.d.ts +4 -4
  249. package/dist/types/primitives/icon/svg/badge-check-thin.d.mts +4 -4
  250. package/dist/types/primitives/icon/svg/badge-check-thin.d.ts +4 -4
  251. package/dist/types/primitives/icon/svg/bank.d.mts +4 -4
  252. package/dist/types/primitives/icon/svg/bank.d.ts +4 -4
  253. package/dist/types/primitives/icon/svg/base.d.mts +4 -4
  254. package/dist/types/primitives/icon/svg/base.d.ts +4 -4
  255. package/dist/types/primitives/icon/svg/best-prices.d.mts +4 -4
  256. package/dist/types/primitives/icon/svg/best-prices.d.ts +4 -4
  257. package/dist/types/primitives/icon/svg/bnb.d.mts +4 -4
  258. package/dist/types/primitives/icon/svg/bnb.d.ts +4 -4
  259. package/dist/types/primitives/icon/svg/bolt.d.mts +4 -4
  260. package/dist/types/primitives/icon/svg/bolt.d.ts +4 -4
  261. package/dist/types/primitives/icon/svg/calendar.d.mts +1 -1
  262. package/dist/types/primitives/icon/svg/calendar.d.ts +1 -1
  263. package/dist/types/primitives/icon/svg/chart-candlestick.d.mts +4 -4
  264. package/dist/types/primitives/icon/svg/chart-candlestick.d.ts +4 -4
  265. package/dist/types/primitives/icon/svg/chart-line.d.mts +4 -4
  266. package/dist/types/primitives/icon/svg/chart-line.d.ts +4 -4
  267. package/dist/types/primitives/icon/svg/check-badge.d.mts +4 -4
  268. package/dist/types/primitives/icon/svg/check-badge.d.ts +4 -4
  269. package/dist/types/primitives/icon/svg/check-circle.d.mts +4 -4
  270. package/dist/types/primitives/icon/svg/check-circle.d.ts +4 -4
  271. package/dist/types/primitives/icon/svg/chevron-down-thin.d.mts +4 -5
  272. package/dist/types/primitives/icon/svg/chevron-down-thin.d.ts +4 -5
  273. package/dist/types/primitives/icon/svg/chevron-down.d.mts +4 -4
  274. package/dist/types/primitives/icon/svg/chevron-down.d.ts +4 -4
  275. package/dist/types/primitives/icon/svg/chevron-left.d.mts +4 -4
  276. package/dist/types/primitives/icon/svg/chevron-left.d.ts +4 -4
  277. package/dist/types/primitives/icon/svg/chevron-right.d.mts +4 -4
  278. package/dist/types/primitives/icon/svg/chevron-right.d.ts +4 -4
  279. package/dist/types/primitives/icon/svg/chevron-up.d.mts +4 -4
  280. package/dist/types/primitives/icon/svg/chevron-up.d.ts +4 -4
  281. package/dist/types/primitives/icon/svg/circle-overlap.d.mts +4 -4
  282. package/dist/types/primitives/icon/svg/circle-overlap.d.ts +4 -4
  283. package/dist/types/primitives/icon/svg/circle-xmark.d.mts +4 -4
  284. package/dist/types/primitives/icon/svg/circle-xmark.d.ts +4 -4
  285. package/dist/types/primitives/icon/svg/close.d.mts +4 -4
  286. package/dist/types/primitives/icon/svg/close.d.ts +4 -4
  287. package/dist/types/primitives/icon/svg/copy.d.mts +4 -4
  288. package/dist/types/primitives/icon/svg/copy.d.ts +4 -4
  289. package/dist/types/primitives/icon/svg/create-account.d.mts +4 -4
  290. package/dist/types/primitives/icon/svg/create-account.d.ts +4 -4
  291. package/dist/types/primitives/icon/svg/credit-card.d.mts +4 -4
  292. package/dist/types/primitives/icon/svg/credit-card.d.ts +4 -4
  293. package/dist/types/primitives/icon/svg/cross-circle.d.mts +4 -4
  294. package/dist/types/primitives/icon/svg/cross-circle.d.ts +4 -4
  295. package/dist/types/primitives/icon/svg/disconnect.d.mts +4 -4
  296. package/dist/types/primitives/icon/svg/disconnect.d.ts +4 -4
  297. package/dist/types/primitives/icon/svg/discord.d.mts +4 -4
  298. package/dist/types/primitives/icon/svg/discord.d.ts +4 -4
  299. package/dist/types/primitives/icon/svg/document.d.mts +4 -4
  300. package/dist/types/primitives/icon/svg/document.d.ts +4 -4
  301. package/dist/types/primitives/icon/svg/dots-horizontal.d.mts +4 -4
  302. package/dist/types/primitives/icon/svg/dots-horizontal.d.ts +4 -4
  303. package/dist/types/primitives/icon/svg/download.d.mts +4 -4
  304. package/dist/types/primitives/icon/svg/download.d.ts +4 -4
  305. package/dist/types/primitives/icon/svg/email.d.mts +4 -4
  306. package/dist/types/primitives/icon/svg/email.d.ts +4 -4
  307. package/dist/types/primitives/icon/svg/error-filled.d.mts +4 -4
  308. package/dist/types/primitives/icon/svg/error-filled.d.ts +4 -4
  309. package/dist/types/primitives/icon/svg/ethereum.d.mts +4 -4
  310. package/dist/types/primitives/icon/svg/ethereum.d.ts +4 -4
  311. package/dist/types/primitives/icon/svg/external-link.d.mts +4 -4
  312. package/dist/types/primitives/icon/svg/external-link.d.ts +4 -4
  313. package/dist/types/primitives/icon/svg/gift-bonus.d.mts +4 -4
  314. package/dist/types/primitives/icon/svg/gift-bonus.d.ts +4 -4
  315. package/dist/types/primitives/icon/svg/google.d.mts +4 -4
  316. package/dist/types/primitives/icon/svg/google.d.ts +4 -4
  317. package/dist/types/primitives/icon/svg/hourglass-start.d.mts +4 -4
  318. package/dist/types/primitives/icon/svg/hourglass-start.d.ts +4 -4
  319. package/dist/types/primitives/icon/svg/image.d.mts +4 -4
  320. package/dist/types/primitives/icon/svg/image.d.ts +4 -4
  321. package/dist/types/primitives/icon/svg/info.d.mts +4 -4
  322. package/dist/types/primitives/icon/svg/info.d.ts +4 -4
  323. package/dist/types/primitives/icon/svg/internet-security.d.mts +4 -4
  324. package/dist/types/primitives/icon/svg/internet-security.d.ts +4 -4
  325. package/dist/types/primitives/icon/svg/link-accounts.d.mts +4 -4
  326. package/dist/types/primitives/icon/svg/link-accounts.d.ts +4 -4
  327. package/dist/types/primitives/icon/svg/lock.d.mts +4 -4
  328. package/dist/types/primitives/icon/svg/lock.d.ts +4 -4
  329. package/dist/types/primitives/icon/svg/minus.d.mts +1 -1
  330. package/dist/types/primitives/icon/svg/minus.d.ts +1 -1
  331. package/dist/types/primitives/icon/svg/paper-buying-power.d.mts +4 -10
  332. package/dist/types/primitives/icon/svg/paper-buying-power.d.ts +4 -10
  333. package/dist/types/primitives/icon/svg/paper-earnings.d.mts +4 -10
  334. package/dist/types/primitives/icon/svg/paper-earnings.d.ts +4 -10
  335. package/dist/types/primitives/icon/svg/paper-mode.d.mts +4 -4
  336. package/dist/types/primitives/icon/svg/paper-mode.d.ts +4 -4
  337. package/dist/types/primitives/icon/svg/paper-onboarding-funds.d.mts +4 -11
  338. package/dist/types/primitives/icon/svg/paper-onboarding-funds.d.ts +4 -11
  339. package/dist/types/primitives/icon/svg/paper-onboarding-markets.d.mts +4 -11
  340. package/dist/types/primitives/icon/svg/paper-onboarding-markets.d.ts +4 -11
  341. package/dist/types/primitives/icon/svg/paper-onboarding-performance.d.mts +4 -11
  342. package/dist/types/primitives/icon/svg/paper-onboarding-performance.d.ts +4 -11
  343. package/dist/types/primitives/icon/svg/paper-plane.d.mts +4 -4
  344. package/dist/types/primitives/icon/svg/paper-plane.d.ts +4 -4
  345. package/dist/types/primitives/icon/svg/pencil.d.mts +4 -4
  346. package/dist/types/primitives/icon/svg/pencil.d.ts +4 -4
  347. package/dist/types/primitives/icon/svg/play-square.d.mts +4 -4
  348. package/dist/types/primitives/icon/svg/play-square.d.ts +4 -4
  349. package/dist/types/primitives/icon/svg/plus.d.mts +1 -1
  350. package/dist/types/primitives/icon/svg/plus.d.ts +1 -1
  351. package/dist/types/primitives/icon/svg/polygon.d.mts +4 -4
  352. package/dist/types/primitives/icon/svg/polygon.d.ts +4 -4
  353. package/dist/types/primitives/icon/svg/profile-about-tab.d.mts +4 -5
  354. package/dist/types/primitives/icon/svg/profile-about-tab.d.ts +4 -5
  355. package/dist/types/primitives/icon/svg/profile-accounts-wallets-tab.d.mts +4 -5
  356. package/dist/types/primitives/icon/svg/profile-accounts-wallets-tab.d.ts +4 -5
  357. package/dist/types/primitives/icon/svg/profile.d.mts +4 -4
  358. package/dist/types/primitives/icon/svg/profile.d.ts +4 -4
  359. package/dist/types/primitives/icon/svg/quotes-warning.d.mts +4 -5
  360. package/dist/types/primitives/icon/svg/quotes-warning.d.ts +4 -5
  361. package/dist/types/primitives/icon/svg/recenter.d.mts +4 -4
  362. package/dist/types/primitives/icon/svg/recenter.d.ts +4 -4
  363. package/dist/types/primitives/icon/svg/revenue-alt.d.mts +4 -4
  364. package/dist/types/primitives/icon/svg/revenue-alt.d.ts +4 -4
  365. package/dist/types/primitives/icon/svg/search.d.mts +4 -4
  366. package/dist/types/primitives/icon/svg/search.d.ts +4 -4
  367. package/dist/types/primitives/icon/svg/shield-trust.d.mts +4 -4
  368. package/dist/types/primitives/icon/svg/shield-trust.d.ts +4 -4
  369. package/dist/types/primitives/icon/svg/solana.d.mts +4 -4
  370. package/dist/types/primitives/icon/svg/solana.d.ts +4 -4
  371. package/dist/types/primitives/icon/svg/sort-end-date.d.mts +4 -4
  372. package/dist/types/primitives/icon/svg/sort-end-date.d.ts +4 -4
  373. package/dist/types/primitives/icon/svg/sort-top-arbitrage.d.mts +4 -4
  374. package/dist/types/primitives/icon/svg/sort-top-arbitrage.d.ts +4 -4
  375. package/dist/types/primitives/icon/svg/sort-volume-24hr.d.mts +4 -4
  376. package/dist/types/primitives/icon/svg/sort-volume-24hr.d.ts +4 -4
  377. package/dist/types/primitives/icon/svg/sort-volume.d.mts +4 -4
  378. package/dist/types/primitives/icon/svg/sort-volume.d.ts +4 -4
  379. package/dist/types/primitives/icon/svg/sparkles-filled.d.mts +4 -4
  380. package/dist/types/primitives/icon/svg/sparkles-filled.d.ts +4 -4
  381. package/dist/types/primitives/icon/svg/spinner.d.mts +4 -4
  382. package/dist/types/primitives/icon/svg/spinner.d.ts +4 -4
  383. package/dist/types/primitives/icon/svg/stay-in-control.d.mts +4 -4
  384. package/dist/types/primitives/icon/svg/stay-in-control.d.ts +4 -4
  385. package/dist/types/primitives/icon/svg/success-check.d.mts +4 -4
  386. package/dist/types/primitives/icon/svg/success-check.d.ts +4 -4
  387. package/dist/types/primitives/icon/svg/telegram.d.mts +4 -4
  388. package/dist/types/primitives/icon/svg/telegram.d.ts +4 -4
  389. package/dist/types/primitives/icon/svg/triangle-down.d.mts +4 -4
  390. package/dist/types/primitives/icon/svg/triangle-down.d.ts +4 -4
  391. package/dist/types/primitives/icon/svg/triangle-up-filled.d.mts +4 -4
  392. package/dist/types/primitives/icon/svg/triangle-up-filled.d.ts +4 -4
  393. package/dist/types/primitives/icon/svg/triangle-up.d.mts +4 -4
  394. package/dist/types/primitives/icon/svg/triangle-up.d.ts +4 -4
  395. package/dist/types/primitives/icon/svg/twitter.d.mts +4 -4
  396. package/dist/types/primitives/icon/svg/twitter.d.ts +4 -4
  397. package/dist/types/primitives/icon/svg/upload.d.mts +4 -4
  398. package/dist/types/primitives/icon/svg/upload.d.ts +4 -4
  399. package/dist/types/primitives/icon/svg/usdc.d.mts +4 -4
  400. package/dist/types/primitives/icon/svg/usdc.d.ts +4 -4
  401. package/dist/types/primitives/icon/svg/user-trust.d.mts +4 -4
  402. package/dist/types/primitives/icon/svg/user-trust.d.ts +4 -4
  403. package/dist/types/primitives/icon/svg/wallet-avatar.d.mts +1 -1
  404. package/dist/types/primitives/icon/svg/wallet-avatar.d.ts +1 -1
  405. package/dist/types/primitives/icon/svg/wallet-filled.d.mts +4 -4
  406. package/dist/types/primitives/icon/svg/wallet-filled.d.ts +4 -4
  407. package/dist/types/primitives/icon/svg/wallet.d.mts +4 -4
  408. package/dist/types/primitives/icon/svg/wallet.d.ts +4 -4
  409. package/dist/types/primitives/icon/svg/warning-filled.d.mts +4 -4
  410. package/dist/types/primitives/icon/svg/warning-filled.d.ts +4 -4
  411. package/dist/types/primitives/icon/svg/warning.d.mts +4 -4
  412. package/dist/types/primitives/icon/svg/warning.d.ts +4 -4
  413. package/dist/types/primitives/inline-alert/index.d.mts +4 -5
  414. package/dist/types/primitives/inline-alert/index.d.ts +4 -5
  415. package/dist/types/primitives/loading-icon/index.d.mts +4 -5
  416. package/dist/types/primitives/loading-icon/index.d.ts +4 -5
  417. package/dist/types/primitives/modal/index.d.mts +12 -9
  418. package/dist/types/primitives/modal/index.d.ts +12 -9
  419. package/dist/types/primitives/number-value.d.mts +4 -4
  420. package/dist/types/primitives/number-value.d.ts +4 -4
  421. package/dist/types/primitives/remote-image/index.d.mts +4 -5
  422. package/dist/types/primitives/remote-image/index.d.ts +4 -5
  423. package/dist/types/primitives/search/index.d.mts +4 -5
  424. package/dist/types/primitives/search/index.d.ts +4 -5
  425. package/dist/types/primitives/search/search-empty-icon.d.mts +4 -4
  426. package/dist/types/primitives/search/search-empty-icon.d.ts +4 -4
  427. package/dist/types/primitives/select/index.d.mts +4 -5
  428. package/dist/types/primitives/select/index.d.ts +4 -5
  429. package/dist/types/primitives/skeleton/index.d.mts +4 -5
  430. package/dist/types/primitives/skeleton/index.d.ts +4 -5
  431. package/dist/types/primitives/skeleton/skeleton-block.d.mts +4 -4
  432. package/dist/types/primitives/skeleton/skeleton-block.d.ts +4 -4
  433. package/dist/types/primitives/skeleton/views/event-list-item-details-skeleton-view.d.mts +4 -4
  434. package/dist/types/primitives/skeleton/views/event-list-item-details-skeleton-view.d.ts +4 -4
  435. package/dist/types/primitives/skeleton/views/event-list-item-skeleton-view.d.mts +4 -10
  436. package/dist/types/primitives/skeleton/views/event-list-item-skeleton-view.d.ts +4 -10
  437. package/dist/types/primitives/skeleton/views/event-list-skeleton-view.d.mts +4 -4
  438. package/dist/types/primitives/skeleton/views/event-list-skeleton-view.d.ts +4 -4
  439. package/dist/types/primitives/skeleton/views/market-details-skeleton-view.d.mts +5 -5
  440. package/dist/types/primitives/skeleton/views/market-details-skeleton-view.d.ts +5 -5
  441. package/dist/types/primitives/skeleton/views/place-order-skeleton-view.d.mts +8 -8
  442. package/dist/types/primitives/skeleton/views/place-order-skeleton-view.d.ts +8 -8
  443. package/dist/types/primitives/skeleton/views/search-skeleton-view.d.mts +4 -4
  444. package/dist/types/primitives/skeleton/views/search-skeleton-view.d.ts +4 -4
  445. package/dist/types/primitives/skeleton/views/settlement-skeleton-view.d.mts +4 -4
  446. package/dist/types/primitives/skeleton/views/settlement-skeleton-view.d.ts +4 -4
  447. package/dist/types/primitives/skeleton/views/user-profile-overview-skeleton-view.d.mts +4 -4
  448. package/dist/types/primitives/skeleton/views/user-profile-overview-skeleton-view.d.ts +4 -4
  449. package/dist/types/primitives/skeleton/views/user-profile-positions-activity-skeleton-view.d.mts +4 -4
  450. package/dist/types/primitives/skeleton/views/user-profile-positions-activity-skeleton-view.d.ts +4 -4
  451. package/dist/types/primitives/state-message/index.d.mts +4 -5
  452. package/dist/types/primitives/state-message/index.d.ts +4 -5
  453. package/dist/types/primitives/switch-button/index.d.mts +4 -5
  454. package/dist/types/primitives/switch-button/index.d.ts +4 -5
  455. package/dist/types/primitives/tabs/index.d.mts +4 -5
  456. package/dist/types/primitives/tabs/index.d.ts +4 -5
  457. package/dist/types/primitives/toast/index.d.mts +1 -1
  458. package/dist/types/primitives/toast/index.d.ts +1 -1
  459. package/dist/types/primitives/tooltip/index.d.mts +4 -5
  460. package/dist/types/primitives/tooltip/index.d.ts +4 -5
  461. package/dist/types/primitives/typography/index.d.mts +4 -5
  462. package/dist/types/primitives/typography/index.d.ts +4 -5
  463. package/dist/types/primitives/typography/typography.types.d.mts +1 -1
  464. package/dist/types/primitives/typography/typography.types.d.ts +1 -1
  465. package/dist/types/primitives/venue-logo/index.d.mts +4 -5
  466. package/dist/types/primitives/venue-logo/index.d.ts +4 -5
  467. package/dist/types/primitives/venue-logo/svg/default-venue.d.mts +1 -1
  468. package/dist/types/primitives/venue-logo/svg/default-venue.d.ts +1 -1
  469. package/dist/types/primitives/venue-logo/svg/logo-betdex.d.mts +1 -1
  470. package/dist/types/primitives/venue-logo/svg/logo-betdex.d.ts +1 -1
  471. package/dist/types/primitives/venue-logo/svg/logo-hyperliquid.d.mts +4 -4
  472. package/dist/types/primitives/venue-logo/svg/logo-hyperliquid.d.ts +4 -4
  473. package/dist/types/primitives/venue-logo/svg/logo-kalshi.d.mts +4 -4
  474. package/dist/types/primitives/venue-logo/svg/logo-kalshi.d.ts +4 -4
  475. package/dist/types/primitives/venue-logo/svg/logo-limitless.d.mts +4 -4
  476. package/dist/types/primitives/venue-logo/svg/logo-limitless.d.ts +4 -4
  477. package/dist/types/primitives/venue-logo/svg/logo-myriad.d.mts +4 -4
  478. package/dist/types/primitives/venue-logo/svg/logo-myriad.d.ts +4 -4
  479. package/dist/types/primitives/venue-logo/svg/logo-novig.d.mts +4 -23
  480. package/dist/types/primitives/venue-logo/svg/logo-novig.d.ts +4 -23
  481. package/dist/types/primitives/venue-logo/svg/logo-opinion.d.mts +4 -4
  482. package/dist/types/primitives/venue-logo/svg/logo-opinion.d.ts +4 -4
  483. package/dist/types/primitives/venue-logo/svg/logo-polymarket.d.mts +4 -4
  484. package/dist/types/primitives/venue-logo/svg/logo-polymarket.d.ts +4 -4
  485. package/dist/types/primitives/venue-logo/svg/logo-pred.d.mts +4 -5
  486. package/dist/types/primitives/venue-logo/svg/logo-pred.d.ts +4 -5
  487. package/dist/types/primitives/venue-logo/svg/logo-predict.d.mts +4 -4
  488. package/dist/types/primitives/venue-logo/svg/logo-predict.d.ts +4 -4
  489. package/dist/types/primitives/venue-logo/svg/logo-probable.d.mts +4 -4
  490. package/dist/types/primitives/venue-logo/svg/logo-probable.d.ts +4 -4
  491. package/dist/types/primitives/venue-logo/svg/logo-prophetx.d.mts +4 -26
  492. package/dist/types/primitives/venue-logo/svg/logo-prophetx.d.ts +4 -26
  493. package/dist/types/primitives/venue-logo/svg/logo-tiprun.d.mts +4 -5
  494. package/dist/types/primitives/venue-logo/svg/logo-tiprun.d.ts +4 -5
  495. package/dist/types/primitives/venue-logo/venue-logo.constants.d.mts +1 -1
  496. package/dist/types/primitives/venue-logo/venue-logo.constants.d.ts +1 -1
  497. package/dist/types/profile/index.d.mts +4 -4
  498. package/dist/types/profile/index.d.ts +4 -4
  499. package/dist/types/profile/tabs/about-tab.d.mts +4 -4
  500. package/dist/types/profile/tabs/about-tab.d.ts +4 -4
  501. package/dist/types/profile/tabs/accounts-wallets-tab.d.mts +4 -4
  502. package/dist/types/profile/tabs/accounts-wallets-tab.d.ts +4 -4
  503. package/dist/types/profile/tabs/trading-access-tab.d.mts +4 -4
  504. package/dist/types/profile/tabs/trading-access-tab.d.ts +4 -4
  505. package/dist/types/shared/default-avatar.d.mts +4 -4
  506. package/dist/types/shared/default-avatar.d.ts +4 -4
  507. package/dist/types/shared/open-orders.d.mts +1 -1
  508. package/dist/types/shared/open-orders.d.ts +1 -1
  509. package/dist/types/shared/react-inert.d.mts +1 -0
  510. package/dist/types/shared/react-inert.d.ts +1 -0
  511. package/dist/types/shared/transfer-fee-summary.d.mts +1 -1
  512. package/dist/types/shared/transfer-fee-summary.d.ts +1 -1
  513. package/dist/types/trading/fund-kalshi-modal.d.mts +4 -4
  514. package/dist/types/trading/fund-kalshi-modal.d.ts +4 -4
  515. package/dist/types/trading/manage-betdex-account-modal.d.mts +1 -1
  516. package/dist/types/trading/manage-betdex-account-modal.d.ts +1 -1
  517. package/dist/types/trading/place-order/index.d.mts +4 -4
  518. package/dist/types/trading/place-order/index.d.ts +4 -4
  519. package/dist/types/trading/place-order/index.place-order.execution-view.d.mts +6 -6
  520. package/dist/types/trading/place-order/index.place-order.execution-view.d.ts +6 -6
  521. package/dist/types/trading/place-order/index.place-order.failure.d.mts +4 -4
  522. package/dist/types/trading/place-order/index.place-order.failure.d.ts +4 -4
  523. package/dist/types/trading/place-order/index.place-order.success.d.mts +4 -4
  524. package/dist/types/trading/place-order/index.place-order.success.d.ts +4 -4
  525. package/dist/types/trading/settlement/index.d.mts +4 -4
  526. package/dist/types/trading/settlement/index.d.ts +4 -4
  527. package/dist/types/trading/settlement/settlement-details.d.mts +4 -4
  528. package/dist/types/trading/settlement/settlement-details.d.ts +4 -4
  529. package/dist/types/trading/settlement/settlement-text-renderer.d.mts +4 -4
  530. package/dist/types/trading/settlement/settlement-text-renderer.d.ts +4 -4
  531. package/dist/types/withdraw/index.d.mts +4 -4
  532. package/dist/types/withdraw/index.d.ts +4 -4
  533. package/dist/types/withdraw/steps/withdraw-amount.d.mts +1 -1
  534. package/dist/types/withdraw/steps/withdraw-amount.d.ts +1 -1
  535. package/dist/types/withdraw/steps/withdraw-method.d.mts +1 -1
  536. package/dist/types/withdraw/steps/withdraw-method.d.ts +1 -1
  537. package/dist/types/withdraw/steps/withdraw-provider.d.mts +1 -1
  538. package/dist/types/withdraw/steps/withdraw-provider.d.ts +1 -1
  539. package/dist/types/withdraw/steps/withdraw-success.d.mts +2 -2
  540. package/dist/types/withdraw/steps/withdraw-success.d.ts +2 -2
  541. package/package.json +9 -8
  542. package/dist/chunk-4X7OLBO6.mjs +0 -3551
  543. package/dist/chunk-7ORC3TUJ.mjs +0 -2883
  544. package/dist/chunk-JH4B3ZHQ.mjs +0 -1
  545. package/dist/chunk-KN7JN7F5.mjs +0 -8303
  546. package/dist/chunk-MDCFCGA3.mjs +0 -2377
  547. package/dist/chunk-PHT5VLGB.mjs +0 -5789
  548. package/dist/chunk-W2LCFCW3.mjs +0 -2879
  549. package/dist/chunk-WOCZ4TVT.mjs +0 -1645
  550. package/dist/chunk-XZVGHKMW.mjs +0 -11426
  551. package/dist/chunk-YYGS6S7N.mjs +0 -5180
  552. package/dist/event-market-Q2LBJJ5E.mjs +0 -21
@@ -0,0 +1,3077 @@
1
+ "use client";
2
+ const require_primitives = require("./primitives-CqxNeV7H.js");
3
+ const require_manage_betdex_account_modal = require("./manage-betdex-account-modal-21ZVLsz0.js");
4
+ let react = require("react");
5
+ let react_jsx_runtime = require("react/jsx-runtime");
6
+ let _agg_build_hooks = require("@agg-build/hooks");
7
+ let _agg_build_sdk = require("@agg-build/sdk");
8
+ let _radix_ui_react_dialog = require("@radix-ui/react-dialog");
9
+ _radix_ui_react_dialog = require_primitives.__toESM(_radix_ui_react_dialog);
10
+ let _agg_build_hooks_deposit = require("@agg-build/hooks/deposit");
11
+ let qrcode_react = require("qrcode.react");
12
+ //#region src/paper-trading/paper-trading-badge.tsx
13
+ /**
14
+ * Header pill marking the whole app as simulated, with an explanatory tooltip.
15
+ *
16
+ * Figma node 4772:31077 — 10px bold uppercase in the app's primary colour on a
17
+ * 10%-alpha primary fill, 12/4 padding, fully rounded. Rendered directly
18
+ * rather than through the `Badge` primitive because Badge imposes its own
19
+ * type scale and padding, which do not match this spec.
20
+ *
21
+ * Renders nothing until the app mode has resolved from `/app/config` —
22
+ * flashing "PAPER TRADING" over a real-money app, even briefly, is the one
23
+ * mistake here that would genuinely mislead someone about their funds.
24
+ */
25
+ const PaperTradingBadge = ({ placement = "chip", isAuthenticated = false, forceVisible = false, label, showWhenAuthenticated = false, classNames }) => {
26
+ const labels = (0, _agg_build_hooks.useLabels)();
27
+ const { isPaperMode, isResolving } = (0, _agg_build_hooks.useResolvedExecutionMode)();
28
+ if (!forceVisible && (isResolving || !isPaperMode)) return null;
29
+ if (placement === "brand" && isAuthenticated && !forceVisible && !showWhenAuthenticated) return null;
30
+ const placementClassName = {
31
+ brand: "inline-flex md:hidden",
32
+ chip: "inline-flex",
33
+ signedOut: "hidden md:inline-flex"
34
+ }[placement];
35
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Tooltip, {
36
+ content: labels.paperTrading.badgeTooltip,
37
+ side: "bottom",
38
+ sideOffset: 3,
39
+ size: "small",
40
+ classNames: { content: require_primitives.cn("max-w-[253px]! px-3! py-2! text-agg-xs! leading-agg-4! text-center", classNames?.tooltip) },
41
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
42
+ className: require_primitives.cn("agg-paper-trading-badge items-center", placementClassName, classNames?.root),
43
+ "data-testid": "agg-paper-trading-badge",
44
+ "data-placement": placement,
45
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
46
+ className: require_primitives.cn("inline-flex items-center justify-center rounded-full", "px-3 py-1", "h-6 md:h-auto", "bg-agg-primary/10 text-agg-primary", "text-[10px] leading-[14px] font-agg-bold uppercase whitespace-nowrap", classNames?.pill),
47
+ children: label ?? labels.paperTrading.badge
48
+ })
49
+ })
50
+ });
51
+ };
52
+ PaperTradingBadge.displayName = "PaperTradingBadge";
53
+ //#endregion
54
+ //#region src/onboarding/onboarding-modal.constants.ts
55
+ const HOW_IT_WORKS_FEATURE_KEYS = [
56
+ "createAccount",
57
+ "linkAccounts",
58
+ "bestPrices",
59
+ "stayInControl"
60
+ ];
61
+ const ONBOARDING_STEPS = {
62
+ HOW_IT_WORKS: 0,
63
+ PROFILE_SETUP: 1,
64
+ CONNECT_ACCOUNTS: 2
65
+ };
66
+ const ONCHAIN_VENUES = [
67
+ _agg_build_sdk.Venue.polymarket,
68
+ _agg_build_sdk.Venue.opinion,
69
+ _agg_build_sdk.Venue.predict,
70
+ _agg_build_sdk.Venue.pred
71
+ ].filter(_agg_build_sdk.isVenueActive);
72
+ //#endregion
73
+ //#region src/onboarding/steps/how-it-works.tsx
74
+ const defaultIcons = {
75
+ createAccount: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.CreateAccountIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
76
+ linkAccounts: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.LinkAccountsIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
77
+ bestPrices: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.BestPricesIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
78
+ stayInControl: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.StayInControlIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" })
79
+ };
80
+ const HowItWorksStep = ({ onContinue, icons }) => {
81
+ const labels = (0, _agg_build_hooks.useLabels)();
82
+ const scrollRef = (0, react.useRef)(null);
83
+ const [showTopGradient, setShowTopGradient] = (0, react.useState)(false);
84
+ const [showBottomGradient, setShowBottomGradient] = (0, react.useState)(true);
85
+ const handleScroll = (0, react.useCallback)(() => {
86
+ const el = scrollRef.current;
87
+ if (!el) return;
88
+ setShowTopGradient(el.scrollTop > 0);
89
+ setShowBottomGradient(el.scrollTop + el.clientHeight < el.scrollHeight - 1);
90
+ }, []);
91
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
92
+ className: "flex flex-col gap-6 h-[600px] sm:h-auto",
93
+ children: [
94
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
95
+ className: "text-center text-agg-2xl font-agg-bold text-agg-foreground",
96
+ children: labels.onboarding.howItWorks.title
97
+ }),
98
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
99
+ className: "relative flex-1 min-h-0 sm:flex-initial",
100
+ children: [
101
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
102
+ ref: scrollRef,
103
+ onScroll: handleScroll,
104
+ className: "flex flex-col gap-4 overflow-y-auto sm:overflow-visible h-full",
105
+ children: HOW_IT_WORKS_FEATURE_KEYS.map((featureKey) => {
106
+ const icon = icons?.[featureKey] ?? defaultIcons[featureKey];
107
+ const feature = labels.onboarding.howItWorks.features[featureKey];
108
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
109
+ className: require_primitives.cn("flex items-center gap-4 py-4 px-5 sm:px-4", "rounded-agg-md", "bg-agg-secondary-hover"),
110
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
111
+ className: "flex flex-col flex-1 min-w-0 gap-[6px]",
112
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
113
+ className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground",
114
+ children: feature.title
115
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
116
+ className: "text-agg-sm leading-agg-5 text-agg-foreground",
117
+ children: feature.description
118
+ })]
119
+ }), icon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
120
+ className: "hidden shrink-0 items-center justify-center text-agg-muted-foreground sm:flex",
121
+ children: icon
122
+ }) : null]
123
+ }, featureKey);
124
+ })
125
+ }),
126
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: require_primitives.cn("pointer-events-none absolute inset-x-0 top-0 h-20", "bg-gradient-to-b from-agg-secondary to-transparent", "sm:hidden transition-opacity", showTopGradient ? "opacity-100" : "opacity-0") }),
127
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: require_primitives.cn("pointer-events-none absolute inset-x-0 bottom-0 h-20", "bg-gradient-to-t from-agg-secondary to-transparent", "sm:hidden transition-opacity", showBottomGradient ? "opacity-100" : "opacity-0") })
128
+ ]
129
+ }),
130
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
131
+ variant: "primary",
132
+ size: "large",
133
+ className: "w-full",
134
+ onClick: onContinue,
135
+ children: labels.onboarding.howItWorks.continue
136
+ })
137
+ ]
138
+ });
139
+ };
140
+ HowItWorksStep.displayName = "HowItWorksStep";
141
+ //#endregion
142
+ //#region src/onboarding/steps/profile-setup.tsx
143
+ const ProfileSetupStep = ({ onContinue }) => {
144
+ const labels = (0, _agg_build_hooks.useLabels)();
145
+ const [username, setUsername] = (0, react.useState)("");
146
+ const [avatarFile, setAvatarFile] = (0, react.useState)();
147
+ const [avatarPreview, setAvatarPreview] = (0, react.useState)();
148
+ const fileInputRef = (0, react.useRef)(null);
149
+ const handleAvatarClick = (0, react.useCallback)(() => {
150
+ fileInputRef.current?.click();
151
+ }, []);
152
+ const handleFileChange = (0, react.useCallback)((e) => {
153
+ const file = e.target.files?.[0];
154
+ if (!file) return;
155
+ setAvatarFile(file);
156
+ const reader = new FileReader();
157
+ reader.onload = (event) => {
158
+ setAvatarPreview(event.target?.result);
159
+ };
160
+ reader.readAsDataURL(file);
161
+ }, []);
162
+ const handleContinue = (0, react.useCallback)(() => {
163
+ onContinue({
164
+ username,
165
+ avatarFile,
166
+ avatarPreview
167
+ });
168
+ }, [
169
+ username,
170
+ avatarFile,
171
+ avatarPreview,
172
+ onContinue
173
+ ]);
174
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
175
+ className: "flex flex-col gap-7",
176
+ children: [
177
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
178
+ className: "text-center text-agg-2xl font-agg-bold text-agg-foreground",
179
+ children: labels.onboarding.profileSetup.title
180
+ }),
181
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
182
+ className: "flex flex-col gap-5 items-center w-full",
183
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
184
+ className: "flex justify-center",
185
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
186
+ type: "button",
187
+ onClick: handleAvatarClick,
188
+ className: require_primitives.cn("group relative flex items-center justify-center", "h-[80px] w-[80px]", "rounded-agg-full", "bg-agg-secondary-hover", !avatarPreview && "hover:bg-agg-tertiary", "transition-colors cursor-pointer", "overflow-hidden"),
189
+ "aria-label": labels.onboarding.profileSetup.uploadProfilePictureAria,
190
+ children: [!avatarPreview ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
191
+ "aria-hidden": true,
192
+ viewBox: "0 0 80 80",
193
+ className: "pointer-events-none absolute inset-0 h-full w-full text-agg-separator group-hover:text-agg-muted-foreground",
194
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
195
+ cx: "40",
196
+ cy: "40",
197
+ r: "39.5",
198
+ fill: "none",
199
+ stroke: "currentColor",
200
+ strokeWidth: "1",
201
+ strokeDasharray: "8 8"
202
+ })
203
+ }) : null, avatarPreview ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.RemoteImage, {
204
+ src: avatarPreview,
205
+ alt: labels.onboarding.profileSetup.profilePreviewAlt,
206
+ className: "h-full w-full object-cover"
207
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.ProfileIcon, { className: "h-7 w-7 text-agg-muted-foreground" })]
208
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
209
+ ref: fileInputRef,
210
+ type: "file",
211
+ accept: "image/*",
212
+ onChange: handleFileChange,
213
+ className: "hidden",
214
+ "aria-hidden": "true"
215
+ })]
216
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
217
+ className: "flex flex-col gap-2 w-full",
218
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
219
+ htmlFor: "onboarding-username",
220
+ className: "text-agg-sm font-agg-bold text-agg-foreground",
221
+ children: labels.onboarding.profileSetup.usernameLabel
222
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
223
+ id: "onboarding-username",
224
+ type: "text",
225
+ value: username,
226
+ onChange: (e) => setUsername(e.target.value),
227
+ placeholder: labels.onboarding.profileSetup.usernamePlaceholder,
228
+ className: require_primitives.cn("w-full px-3 py-2.5", "rounded-[4px]", "border border-agg-separator", "bg-agg-secondary text-agg-foreground", "placeholder:text-agg-muted-foreground", "outline-none", "hover:bg-agg-secondary-hover", "focus:border-agg-primary focus:ring-1 focus:ring-agg-primary", "transition-colors", "text-agg-sm sm:text-agg-base")
229
+ })]
230
+ })]
231
+ }),
232
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
233
+ variant: "primary",
234
+ size: "large",
235
+ className: "w-full",
236
+ onClick: handleContinue,
237
+ children: labels.onboarding.profileSetup.continue
238
+ })
239
+ ]
240
+ });
241
+ };
242
+ ProfileSetupStep.displayName = "ProfileSetupStep";
243
+ //#endregion
244
+ //#region src/onboarding/steps/connect-accounts.tsx
245
+ const OnchainVenueLogos = () => {
246
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
247
+ className: "flex gap-1 sm:gap-0 sm:-space-x-5",
248
+ children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
249
+ style: { zIndex: ONCHAIN_VENUES.length - index },
250
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.VenueLogo, {
251
+ venue,
252
+ variant: "logo",
253
+ size: "medium",
254
+ className: "sm:h-8 sm:w-8"
255
+ })
256
+ }, venue))
257
+ });
258
+ };
259
+ const VenueCard = ({ logos, title, mobileTitle, description, mobileDescription, onConnect, connected = false }) => {
260
+ const labels = (0, _agg_build_hooks.useLabels)();
261
+ const action = connected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.CheckCircleIcon, { className: "h-6 w-6 text-agg-success" }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
262
+ variant: "tertiary",
263
+ size: "large",
264
+ className: "!h-auto !px-0 !py-0 text-agg-primary hover:bg-transparent hover:text-agg-primary-hover",
265
+ onClick: onConnect,
266
+ children: labels.onboarding.connectAccounts.connect
267
+ });
268
+ const mobileAction = connected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.CheckCircleIcon, { className: "h-6 w-6 text-agg-success" }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
269
+ variant: "tertiary",
270
+ size: "medium",
271
+ className: "!h-auto !px-0 !py-0 text-agg-primary hover:bg-transparent hover:text-agg-primary-hover",
272
+ onClick: onConnect,
273
+ suffix: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.ChevronRightIcon, { className: "h-4 w-4" }),
274
+ children: labels.onboarding.connectAccounts.connectAccount
275
+ });
276
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
277
+ className: require_primitives.cn("rounded-agg-md p-5 transition-colors", connected ? "bg-agg-success/5" : "bg-agg-secondary-hover hover:bg-agg-tertiary"),
278
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
279
+ className: "hidden sm:flex items-center justify-between",
280
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
281
+ className: "flex items-center gap-5",
282
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
283
+ className: "shrink-0",
284
+ children: logos
285
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
286
+ className: "flex flex-col gap-[2px]",
287
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
288
+ className: "text-agg-base font-agg-bold text-agg-foreground",
289
+ children: title
290
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
291
+ className: "text-agg-sm text-agg-foreground",
292
+ children: description
293
+ })]
294
+ })]
295
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
296
+ className: "shrink-0",
297
+ children: action
298
+ })]
299
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
300
+ className: "flex flex-col gap-3 sm:hidden",
301
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
302
+ className: "flex flex-col gap-3",
303
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
304
+ className: "shrink-0",
305
+ children: logos
306
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
307
+ className: "text-agg-lg font-agg-bold text-agg-foreground",
308
+ children: mobileTitle ?? title
309
+ })]
310
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
311
+ className: "flex flex-col items-start gap-2",
312
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
313
+ className: "text-agg-base text-agg-foreground",
314
+ children: mobileDescription ?? description
315
+ }), mobileAction]
316
+ })]
317
+ })]
318
+ });
319
+ };
320
+ const ConnectAccountsStep = ({ onConnectOnchain, onContinue, connectedOnchain = false }) => {
321
+ const labels = (0, _agg_build_hooks.useLabels)();
322
+ const canContinue = connectedOnchain;
323
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
324
+ className: "flex flex-col gap-6",
325
+ children: [
326
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
327
+ className: "text-center text-agg-2xl font-agg-bold text-agg-foreground",
328
+ children: labels.onboarding.connectAccounts.title
329
+ }),
330
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
331
+ className: "flex flex-col gap-4",
332
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VenueCard, {
333
+ logos: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OnchainVenueLogos, {}),
334
+ title: labels.onboarding.connectAccounts.onchainTitle,
335
+ mobileTitle: labels.onboarding.connectAccounts.onchainMobileTitle(ONCHAIN_VENUES.length - 1),
336
+ description: labels.onboarding.connectAccounts.onchainDescription,
337
+ mobileDescription: labels.onboarding.connectAccounts.onchainMobileDescription,
338
+ onConnect: onConnectOnchain,
339
+ connected: connectedOnchain
340
+ })
341
+ }),
342
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
343
+ variant: "primary",
344
+ size: "large",
345
+ className: "w-full",
346
+ onClick: onContinue,
347
+ disabled: !canContinue,
348
+ children: labels.onboarding.connectAccounts.continue
349
+ })
350
+ ]
351
+ });
352
+ };
353
+ ConnectAccountsStep.displayName = "ConnectAccountsStep";
354
+ //#endregion
355
+ //#region src/onboarding/steps/connect-onchain-modal.tsx
356
+ const ConnectOnchainModal = ({ open, onOpenChange, onConnect }) => {
357
+ const labels = (0, _agg_build_hooks.useLabels)();
358
+ const [connecting, setConnecting] = (0, react.useState)(false);
359
+ const [error, setError] = (0, react.useState)();
360
+ const handleCancel = (0, react.useCallback)(() => {
361
+ onOpenChange(false);
362
+ }, [onOpenChange]);
363
+ const handleConnect = (0, react.useCallback)(async () => {
364
+ if (connecting) return;
365
+ setConnecting(true);
366
+ setError(void 0);
367
+ try {
368
+ await onConnect();
369
+ onOpenChange(false);
370
+ } catch (err) {
371
+ setError(err instanceof Error ? err.message : labels.onboarding.connectOnchainModal.fallbackError);
372
+ } finally {
373
+ setConnecting(false);
374
+ }
375
+ }, [
376
+ connecting,
377
+ labels.onboarding.connectOnchainModal.fallbackError,
378
+ onConnect,
379
+ onOpenChange
380
+ ]);
381
+ const handleOpenChange = (0, react.useCallback)((value) => {
382
+ if (value) {
383
+ setError(void 0);
384
+ setConnecting(false);
385
+ }
386
+ onOpenChange(value);
387
+ }, [onOpenChange]);
388
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal, {
389
+ open,
390
+ onOpenChange: handleOpenChange,
391
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_primitives.Modal.Container, {
392
+ maxWidth: "600px",
393
+ "aria-label": labels.onboarding.connectOnchainModal.ariaLabel,
394
+ classNames: { container: "!rounded-agg-lg" },
395
+ children: [
396
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Title, {
397
+ className: "sr-only",
398
+ children: labels.onboarding.connectOnchainModal.title
399
+ }),
400
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Header, {
401
+ hideClose: false,
402
+ hideBorder: true,
403
+ classNames: {
404
+ root: "!min-h-0",
405
+ container: "!py-[18px] !px-8"
406
+ }
407
+ }),
408
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Body, {
409
+ classNames: { root: "!px-5 !pt-0 !pb-[60px] sm:!px-8" },
410
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
411
+ className: "flex flex-col gap-8 items-center",
412
+ children: [
413
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
414
+ className: "flex flex-col gap-4 items-center text-center",
415
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
416
+ className: "text-agg-2xl font-agg-bold text-agg-foreground",
417
+ children: labels.onboarding.connectOnchainModal.title
418
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
419
+ className: "text-agg-base text-center leading-agg-6 text-agg-foreground whitespace-pre-line",
420
+ children: labels.onboarding.connectOnchainModal.description
421
+ })]
422
+ }),
423
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
424
+ className: "flex w-full flex-col items-center gap-4 rounded-agg-xl bg-agg-secondary-hover p-6",
425
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
426
+ className: "text-agg-sm font-agg-bold uppercase leading-agg-5 text-agg-muted-foreground",
427
+ children: labels.onboarding.connectOnchainModal.supportedVenuesLabel
428
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
429
+ className: "flex flex-wrap items-center justify-center gap-x-4 gap-y-3",
430
+ children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
431
+ className: "flex items-center gap-[6px]",
432
+ children: [
433
+ index > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "mr-2.5 h-3 w-px bg-agg-separator" }),
434
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.VenueLogo, {
435
+ venue,
436
+ size: "medium"
437
+ }),
438
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
439
+ className: "text-agg-base text-agg-foreground",
440
+ children: labels.venues[venue]
441
+ })
442
+ ]
443
+ }, venue))
444
+ })]
445
+ }),
446
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
447
+ className: "flex flex-col gap-6 items-center",
448
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
449
+ className: "flex flex-col gap-3 items-center",
450
+ children: [error ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
451
+ className: "flex items-center gap-2",
452
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.WarningIcon, { className: "h-3.5 w-3.5 shrink-0 text-agg-error" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
453
+ className: "text-agg-sm leading-agg-5 text-agg-error",
454
+ children: error
455
+ })]
456
+ }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
457
+ variant: "primary",
458
+ size: "large",
459
+ onClick: handleConnect,
460
+ isLoading: connecting,
461
+ children: labels.onboarding.connectOnchainModal.connect
462
+ })]
463
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
464
+ variant: "tertiary",
465
+ size: "medium",
466
+ className: "!h-auto !px-0 !py-0 text-agg-primary hover:bg-transparent hover:text-agg-primary-hover",
467
+ onClick: handleCancel,
468
+ children: labels.onboarding.connectOnchainModal.cancel
469
+ })]
470
+ })
471
+ ]
472
+ })
473
+ })
474
+ ]
475
+ })
476
+ });
477
+ };
478
+ ConnectOnchainModal.displayName = "ConnectOnchainModal";
479
+ //#endregion
480
+ //#region src/onboarding/index.tsx
481
+ const OnboardingModal = ({ open, onOpenChange, onProfileSubmit, onConnectOnchain, onComplete, howItWorksIcons, connectedOnchain = false }) => {
482
+ const labels = (0, _agg_build_hooks.useLabels)();
483
+ const [step, setStep] = (0, react.useState)(ONBOARDING_STEPS.HOW_IT_WORKS);
484
+ const resolvedTitle = {
485
+ [ONBOARDING_STEPS.HOW_IT_WORKS]: labels.onboarding.modal.stepHowItWorks,
486
+ [ONBOARDING_STEPS.PROFILE_SETUP]: labels.onboarding.modal.stepProfileSetup,
487
+ [ONBOARDING_STEPS.CONNECT_ACCOUNTS]: labels.onboarding.modal.stepConnectAccounts
488
+ }[step] ?? labels.onboarding.modal.title;
489
+ const [onchainModalOpen, setOnchainModalOpen] = (0, react.useState)(false);
490
+ const [onchainConnected, setOnchainConnected] = (0, react.useState)(false);
491
+ (0, react.useEffect)(() => {
492
+ if (open) {
493
+ setStep(ONBOARDING_STEPS.HOW_IT_WORKS);
494
+ setOnchainConnected(false);
495
+ }
496
+ }, [open]);
497
+ const handleHowItWorksContinue = (0, react.useCallback)(() => {
498
+ setStep(ONBOARDING_STEPS.PROFILE_SETUP);
499
+ }, []);
500
+ const handleProfileContinue = (0, react.useCallback)((data) => {
501
+ onProfileSubmit?.(data);
502
+ setStep(ONBOARDING_STEPS.CONNECT_ACCOUNTS);
503
+ }, [onProfileSubmit]);
504
+ const handleConnectContinue = (0, react.useCallback)(() => {
505
+ onComplete?.();
506
+ }, [onComplete]);
507
+ const handleOpenOnchainModal = (0, react.useCallback)(() => {
508
+ setOnchainModalOpen(true);
509
+ }, []);
510
+ const handleOnchainConnect = (0, react.useCallback)(async () => {
511
+ await onConnectOnchain?.();
512
+ setOnchainConnected(true);
513
+ }, [onConnectOnchain]);
514
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal, {
515
+ open,
516
+ onOpenChange,
517
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_primitives.Modal.Container, {
518
+ maxWidth: "600px",
519
+ "aria-label": resolvedTitle,
520
+ classNames: { container: "!rounded-agg-lg" },
521
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Title, {
522
+ className: "sr-only",
523
+ children: resolvedTitle
524
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_primitives.Modal.Body, {
525
+ classNames: { root: "px-5 py-6 sm:px-10 sm:py-8" },
526
+ children: [
527
+ step === ONBOARDING_STEPS.HOW_IT_WORKS && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HowItWorksStep, {
528
+ onContinue: handleHowItWorksContinue,
529
+ icons: howItWorksIcons
530
+ }),
531
+ step === ONBOARDING_STEPS.PROFILE_SETUP && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProfileSetupStep, { onContinue: handleProfileContinue }),
532
+ step === ONBOARDING_STEPS.CONNECT_ACCOUNTS && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ConnectAccountsStep, {
533
+ onConnectOnchain: handleOpenOnchainModal,
534
+ onContinue: handleConnectContinue,
535
+ connectedOnchain: connectedOnchain || onchainConnected
536
+ })
537
+ ]
538
+ })]
539
+ })
540
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ConnectOnchainModal, {
541
+ open: onchainModalOpen,
542
+ onOpenChange: setOnchainModalOpen,
543
+ onConnect: handleOnchainConnect
544
+ })] });
545
+ };
546
+ OnboardingModal.displayName = "OnboardingModal";
547
+ //#endregion
548
+ //#region src/deposit/deposit-modal.constants.ts
549
+ const BASE_URL = "https://assets.snagsolutions.io";
550
+ /** Default network options for the card deposit flow. */
551
+ const CARD_NETWORK_OPTIONS = [
552
+ {
553
+ value: "ethereum",
554
+ label: "Ethereum",
555
+ iconUrl: `${BASE_URL}/public/prediction-markets/logos/ETH.svg`
556
+ },
557
+ {
558
+ value: "arbitrum",
559
+ label: "Arbitrum",
560
+ iconUrl: `${BASE_URL}/public/prediction-markets/logos/Arbitrum.svg`
561
+ },
562
+ {
563
+ value: "base",
564
+ label: "Base",
565
+ iconUrl: `${BASE_URL}/public/prediction-markets/logos/Base.svg`
566
+ },
567
+ {
568
+ value: "solana",
569
+ label: "Solana",
570
+ iconUrl: `${BASE_URL}/public/prediction-markets/logos/Solana.svg`
571
+ },
572
+ {
573
+ value: "polygon",
574
+ label: "Polygon",
575
+ iconUrl: `${BASE_URL}/public/prediction-markets/logos/Polygon.svg`
576
+ }
577
+ ];
578
+ /** Maps network slugs to ramp destination currency codes. */
579
+ const NETWORK_TO_CURRENCY_CODE = {
580
+ ethereum: "USDC",
581
+ arbitrum: "USDC_ARBITRUM",
582
+ base: "USDC_BASE",
583
+ solana: "USDC_SOLANA",
584
+ polygon: "USDC_POLYGON"
585
+ };
586
+ //#endregion
587
+ //#region src/deposit/steps/card-deposit.tsx
588
+ const CardDepositStep = ({ amount, currency, networkOptions, selectedNetwork, minAmount, onBack, onAmountChange, onCurrencyChange, onNetworkChange, onContinue }) => {
589
+ const labels = (0, _agg_build_hooks.useLabels)();
590
+ const [localAmount, setLocalAmount] = (0, react.useState)(amount);
591
+ (0, react.useEffect)(() => {
592
+ setLocalAmount(amount);
593
+ }, [amount]);
594
+ const numericAmount = Number(localAmount) || 0;
595
+ const hasInput = localAmount.length > 0;
596
+ const isBelowMin = minAmount != null && hasInput && numericAmount < minAmount;
597
+ const isValid = numericAmount > 0 && !isBelowMin;
598
+ const formattedMin = minAmount != null ? `$${minAmount}` : void 0;
599
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Header, {
600
+ title: labels.deposit.cardFlow.title,
601
+ hideBorder: true,
602
+ leftElement: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
603
+ type: "button",
604
+ className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
605
+ onClick: onBack,
606
+ "aria-label": "Go back",
607
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.ChevronLeftIcon, { className: "h-6 w-6" })
608
+ })
609
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Body, {
610
+ classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" },
611
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
612
+ className: "flex flex-col gap-5",
613
+ children: [
614
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
615
+ className: "flex flex-col gap-3",
616
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
617
+ className: "flex-1 flex flex-col gap-2",
618
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
619
+ className: "flex items-center justify-between",
620
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
621
+ className: "agg-type-label-strong text-agg-foreground",
622
+ children: labels.deposit.cardFlow.amountLabel
623
+ }), formattedMin ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
624
+ className: "agg-type-label text-agg-foreground",
625
+ children: labels.deposit.cardFlow.minRequired(formattedMin)
626
+ }) : null]
627
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
628
+ className: "flex gap-3 items-center",
629
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
630
+ className: require_primitives.cn("flex h-10 flex-1 items-center gap-2 rounded-agg-sm border bg-agg-secondary px-3", isBelowMin ? "border-agg-primary border-2" : "border-agg-separator"),
631
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
632
+ type: "text",
633
+ inputMode: "decimal",
634
+ "aria-label": labels.deposit.cardFlow.amountLabel,
635
+ className: "agg-type-body w-full bg-transparent text-agg-foreground outline-none",
636
+ placeholder: "0.00",
637
+ value: localAmount,
638
+ onChange: (event) => {
639
+ const next = event.target.value;
640
+ setLocalAmount(next);
641
+ onAmountChange(next);
642
+ }
643
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
644
+ className: "agg-type-body text-agg-muted-foreground",
645
+ children: "$"
646
+ })]
647
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
648
+ className: "w-[100px]",
649
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Select, {
650
+ items: [{
651
+ value: currency,
652
+ label: currency
653
+ }],
654
+ value: currency,
655
+ onChange: onCurrencyChange,
656
+ ariaLabel: labels.deposit.cardFlow.currencyLabel,
657
+ triggerClassName: "rounded-agg-sm"
658
+ })
659
+ })]
660
+ })]
661
+ }), isBelowMin && formattedMin ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
662
+ className: "flex items-center gap-2",
663
+ role: "alert",
664
+ "aria-live": "assertive",
665
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Icon, {
666
+ name: "warning",
667
+ className: "!h-3.5 !w-3.5 shrink-0 text-agg-error",
668
+ "aria-hidden": "true"
669
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
670
+ className: "agg-type-label text-agg-error",
671
+ children: labels.deposit.cardFlow.minAmountError(formattedMin)
672
+ })]
673
+ }) : null]
674
+ }),
675
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
676
+ className: "flex flex-col gap-2",
677
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
678
+ className: "agg-type-label-strong text-agg-foreground",
679
+ children: labels.deposit.cardFlow.networkLabel
680
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Select, {
681
+ items: networkOptions,
682
+ value: selectedNetwork,
683
+ onChange: onNetworkChange,
684
+ ariaLabel: labels.deposit.cardFlow.networkLabel,
685
+ triggerClassName: "rounded-agg-sm"
686
+ })]
687
+ }),
688
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
689
+ variant: "secondary",
690
+ size: "large",
691
+ className: "w-full",
692
+ disabled: !isValid,
693
+ onClick: () => onContinue(numericAmount),
694
+ children: labels.deposit.cardFlow.getQuotes
695
+ })
696
+ ]
697
+ })
698
+ })] });
699
+ };
700
+ //#endregion
701
+ //#region src/deposit/steps/card-payment-pending.tsx
702
+ const CardPaymentPendingStep = ({ providerName, walletAddress, onClose, onViewActivity, onChooseAnotherProvider }) => {
703
+ const labels = (0, _agg_build_hooks.useLabels)();
704
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
705
+ className: "relative",
706
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_primitives.Modal.Body, {
707
+ classNames: { root: "px-5 py-8 sm:px-8 sm:py-10" },
708
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
709
+ type: "button",
710
+ className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors cursor-pointer hover:text-agg-foreground/80",
711
+ onClick: onClose,
712
+ "aria-label": labels.common.close,
713
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.CloseIcon, { className: "h-6 w-6" })
714
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
715
+ className: "flex flex-col items-center gap-8",
716
+ children: [
717
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
718
+ className: "flex h-[60px] w-[60px] items-center justify-center text-agg-muted-foreground",
719
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.ExternalLinkIcon, { className: "h-[60px] w-[60px]" })
720
+ }),
721
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
722
+ className: "flex flex-col items-center gap-3 text-center",
723
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
724
+ className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground",
725
+ children: labels.deposit.cardFlow.pendingTitle(providerName)
726
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
727
+ className: "agg-type-body text-agg-foreground",
728
+ children: labels.deposit.cardFlow.pendingDescription
729
+ })]
730
+ }),
731
+ walletAddress ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
732
+ className: "flex w-full flex-col items-center gap-3 rounded-agg-md bg-agg-secondary-hover p-5",
733
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
734
+ className: "agg-type-label text-agg-foreground w-full",
735
+ children: labels.deposit.cardFlow.pendingWalletAddressHelp
736
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
737
+ className: "flex w-full h-10 items-center gap-2 rounded border border-agg-separator bg-agg-secondary px-3 py-[10px]",
738
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
739
+ className: "agg-type-body flex-1 min-w-0 truncate text-agg-foreground",
740
+ children: walletAddress
741
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.CopyButton, {
742
+ value: walletAddress,
743
+ "aria-label": labels.deposit.cardFlow.pendingCopyAddress,
744
+ className: "text-agg-muted-foreground hover:text-agg-foreground"
745
+ })]
746
+ })]
747
+ }) : null,
748
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
749
+ className: "flex items-start justify-center gap-3",
750
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
751
+ variant: "secondary",
752
+ size: "large",
753
+ className: "w-[120px]",
754
+ onClick: onClose,
755
+ children: labels.common.close
756
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
757
+ variant: "primary",
758
+ size: "large",
759
+ onClick: onViewActivity,
760
+ children: labels.deposit.cardFlow.viewActivity
761
+ })]
762
+ }),
763
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
764
+ type: "button",
765
+ className: "agg-type-body font-agg-bold text-agg-primary transition-colors cursor-pointer hover:text-agg-primary/80",
766
+ onClick: onChooseAnotherProvider,
767
+ children: labels.deposit.cardFlow.chooseAnotherProvider
768
+ })
769
+ ]
770
+ })]
771
+ })
772
+ });
773
+ };
774
+ //#endregion
775
+ //#region src/deposit/steps/card-provider.tsx
776
+ const CardProviderItem = ({ provider, onSelect }) => {
777
+ const labels = (0, _agg_build_hooks.useLabels)();
778
+ const badgeText = provider.badge === "best" ? labels.deposit.cardFlow.providerBadges.best : provider.badge === "low-kyc" ? labels.deposit.cardFlow.providerBadges.lowKyc : void 0;
779
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
780
+ type: "button",
781
+ 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",
782
+ onClick: () => onSelect(provider.id),
783
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
784
+ className: "flex items-center justify-between gap-4",
785
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
786
+ className: "flex items-center gap-2",
787
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
788
+ className: "text-agg-base leading-agg-6 font-agg-bold text-agg-foreground",
789
+ children: provider.name
790
+ }), badgeText ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
791
+ 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"}`,
792
+ children: badgeText
793
+ }) : null]
794
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
795
+ className: "flex items-center gap-4",
796
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
797
+ className: "text-right",
798
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
799
+ className: "agg-type-body text-agg-foreground",
800
+ children: provider.quote
801
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
802
+ className: "agg-type-label text-agg-muted-foreground",
803
+ children: [
804
+ labels.deposit.cardFlow.feeLabel,
805
+ " ",
806
+ provider.fee
807
+ ]
808
+ })]
809
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.ChevronRightIcon, { className: "h-5 w-5 text-agg-muted-foreground" })]
810
+ })]
811
+ })
812
+ });
813
+ };
814
+ const CardProviderStep = ({ token, amount, currency, providers, isLoading, error, sessionError, onBack, onSelectProvider, onRetry }) => {
815
+ const labels = (0, _agg_build_hooks.useLabels)();
816
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Header, {
817
+ title: labels.deposit.cardFlow.selectProviderTitle,
818
+ hideBorder: true,
819
+ leftElement: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
820
+ type: "button",
821
+ className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
822
+ onClick: onBack,
823
+ "aria-label": labels.deposit.back,
824
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.ChevronLeftIcon, { className: "h-6 w-6" })
825
+ })
826
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Body, {
827
+ classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" },
828
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
829
+ className: "flex flex-col gap-4",
830
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
831
+ className: "flex items-center gap-1.5",
832
+ children: [
833
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.UsdcIcon, { className: "h-4 w-4 shrink-0" }),
834
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
835
+ className: "agg-type-body font-agg-bold text-agg-foreground",
836
+ children: token
837
+ }),
838
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
839
+ className: "agg-type-body text-agg-foreground",
840
+ children: [
841
+ "$",
842
+ amount,
843
+ " ",
844
+ currency
845
+ ]
846
+ })
847
+ ]
848
+ }), isLoading ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
849
+ className: "flex min-h-[200px] flex-col items-center justify-center gap-3",
850
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.LoadingIcon, { variant: "prominent" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
851
+ className: "agg-type-body text-agg-foreground",
852
+ children: labels.deposit.cardFlow.loadingQuotes
853
+ })]
854
+ }) : error ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
855
+ className: "flex min-h-[200px] flex-col items-center justify-center gap-6 px-2 text-center",
856
+ children: [
857
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Icon, {
858
+ name: "quotes-warning",
859
+ size: "large",
860
+ className: "!h-9 !w-9 shrink-0 text-agg-muted-foreground",
861
+ color: "currentColor"
862
+ }),
863
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
864
+ className: "flex max-w-[320px] flex-col gap-2",
865
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
866
+ className: "text-agg-base leading-agg-6 font-agg-bold text-agg-foreground",
867
+ children: labels.deposit.cardFlow.errorLoadingQuotesTitle
868
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
869
+ className: "agg-type-body text-agg-muted-foreground",
870
+ children: labels.deposit.cardFlow.errorLoadingQuotesDescription
871
+ })]
872
+ }),
873
+ onRetry ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
874
+ variant: "secondary",
875
+ size: "medium",
876
+ onClick: onRetry,
877
+ children: labels.deposit.cardFlow.retry
878
+ }) : null
879
+ ]
880
+ }) : providers.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
881
+ className: "flex min-h-[200px] items-center justify-center",
882
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
883
+ className: "agg-type-body text-agg-muted-foreground",
884
+ children: labels.deposit.cardFlow.noQuotes
885
+ })
886
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
887
+ className: "flex flex-col gap-4",
888
+ children: [providers.map((provider) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardProviderItem, {
889
+ provider,
890
+ onSelect: onSelectProvider
891
+ }, provider.id)), sessionError ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
892
+ className: "agg-type-label text-agg-error text-center",
893
+ children: sessionError
894
+ }) : null]
895
+ })]
896
+ })
897
+ })] });
898
+ };
899
+ //#endregion
900
+ //#region src/deposit/steps/card-purchase-success.tsx
901
+ const SummaryRow$1 = ({ label, value }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
902
+ className: "flex items-center justify-between border-b border-agg-separator py-2 last:border-b-0",
903
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
904
+ className: "text-[12px] leading-4 font-agg-bold uppercase text-agg-muted-foreground",
905
+ children: label
906
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
907
+ className: "agg-type-label text-agg-foreground",
908
+ children: value
909
+ })]
910
+ });
911
+ const CardPurchaseSuccessStep = ({ summary, onDone, onClose }) => {
912
+ const labels = (0, _agg_build_hooks.useLabels)();
913
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
914
+ className: "relative",
915
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_primitives.Modal.Body, {
916
+ classNames: { root: "px-5 py-8 sm:px-8 sm:py-10" },
917
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
918
+ type: "button",
919
+ className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80",
920
+ onClick: onClose,
921
+ "aria-label": labels.common.close,
922
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.CloseIcon, { className: "h-6 w-6" })
923
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
924
+ className: "flex flex-col items-center gap-8",
925
+ children: [
926
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
927
+ className: "flex h-[60px] w-[60px] items-center justify-center rounded-full bg-agg-success/15",
928
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.SuccessCheckIcon, { className: "h-6 w-6 text-agg-success" })
929
+ }),
930
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
931
+ className: "flex flex-col items-center gap-3 text-center",
932
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
933
+ className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground",
934
+ children: labels.deposit.cardFlow.successTitle
935
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
936
+ className: "agg-type-body text-agg-foreground",
937
+ children: labels.deposit.cardFlow.successDescription
938
+ })]
939
+ }),
940
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
941
+ className: "w-full rounded-lg border border-agg-separator bg-agg-secondary px-3 py-1",
942
+ children: [
943
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SummaryRow$1, {
944
+ label: labels.deposit.summary.amountReceived,
945
+ value: summary.amountReceived
946
+ }),
947
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SummaryRow$1, {
948
+ label: labels.deposit.summary.network,
949
+ value: summary.network
950
+ }),
951
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SummaryRow$1, {
952
+ label: labels.deposit.cardFlow.summary.fees,
953
+ value: summary.fees
954
+ })
955
+ ]
956
+ }),
957
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
958
+ variant: "secondary",
959
+ size: "large",
960
+ className: "w-[120px]",
961
+ onClick: onDone,
962
+ children: labels.deposit.done
963
+ })
964
+ ]
965
+ })]
966
+ })
967
+ });
968
+ };
969
+ //#endregion
970
+ //#region src/deposit/components/DepositQRCode.tsx
971
+ function DepositQRCode({ depositAddress, networkLogoUrl, networkLogo, size = 160 }) {
972
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
973
+ className: "inline-flex items-center justify-center rounded-xl border",
974
+ style: {
975
+ padding: 16,
976
+ borderColor: "#E5E7EB",
977
+ backgroundColor: "#FFFFFF"
978
+ },
979
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
980
+ className: "relative",
981
+ style: {
982
+ width: size,
983
+ height: size
984
+ },
985
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(qrcode_react.QRCodeSVG, {
986
+ value: depositAddress,
987
+ size,
988
+ level: "H"
989
+ }), networkLogo ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
990
+ className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-sm",
991
+ style: {
992
+ width: 32,
993
+ height: 32,
994
+ backgroundColor: "#FFFFFF",
995
+ padding: 2
996
+ },
997
+ children: networkLogo
998
+ }) : networkLogoUrl ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
999
+ src: networkLogoUrl,
1000
+ alt: "",
1001
+ className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-sm",
1002
+ width: 32,
1003
+ height: 32,
1004
+ style: {
1005
+ backgroundColor: "#FFFFFF",
1006
+ padding: 2
1007
+ }
1008
+ }) : null]
1009
+ })
1010
+ });
1011
+ }
1012
+ DepositQRCode.displayName = "DepositQRCode";
1013
+ //#endregion
1014
+ //#region src/deposit/steps/crypto-transfer.tsx
1015
+ const CryptoAddressLoadingState = () => {
1016
+ const sendCryptoLabels = (0, _agg_build_hooks.useLabels)().deposit.sendCrypto;
1017
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1018
+ className: "flex w-full flex-col items-center justify-center gap-6 py-10 text-center text-agg-foreground",
1019
+ role: "status",
1020
+ "aria-live": "polite",
1021
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1022
+ className: "h-9 w-9 animate-spin rounded-full border-2 border-agg-primary/25 border-t-agg-primary",
1023
+ "aria-hidden": "true"
1024
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1025
+ className: "flex w-full flex-col items-center gap-2",
1026
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1027
+ className: "text-agg-base font-agg-bold leading-agg-6",
1028
+ children: sendCryptoLabels.addressLoadingTitle
1029
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1030
+ className: "max-w-[300px] text-agg-sm leading-agg-5",
1031
+ children: sendCryptoLabels.addressLoadingDescription
1032
+ })]
1033
+ })]
1034
+ });
1035
+ };
1036
+ const getEstimateAmountFromMinDeposit = (minDeposit) => {
1037
+ return minDeposit.replace(/[^0-9.]/g, "") || "1";
1038
+ };
1039
+ const CryptoTransferStep = ({ tokenOptions, networkOptions, selectedToken, selectedNetwork, depositAddress, minDeposit, eta, isLoadingAddress, addressError, onBack, onTokenChange, onNetworkChange, onCopyAddress, onDone }) => {
1040
+ const labels = (0, _agg_build_hooks.useLabels)();
1041
+ const selectedNetworkOption = networkOptions.find((n) => n.value === selectedNetwork);
1042
+ const networkLogoUrl = selectedNetworkOption?.iconUrl ?? "";
1043
+ const networkLogo = selectedNetworkOption?.icon;
1044
+ const transferFeeEstimate = (0, _agg_build_hooks.useWithdrawEstimate)({
1045
+ amount: getEstimateAmountFromMinDeposit(minDeposit),
1046
+ selectedToken,
1047
+ selectedNetwork
1048
+ });
1049
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Header, {
1050
+ title: labels.deposit.sendCrypto.title,
1051
+ hideBorder: true,
1052
+ leftElement: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1053
+ type: "button",
1054
+ className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
1055
+ onClick: onBack,
1056
+ "aria-label": "Go back",
1057
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.ChevronLeftIcon, { className: "h-6 w-6" })
1058
+ })
1059
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Body, {
1060
+ classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" },
1061
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1062
+ className: "flex flex-col gap-7",
1063
+ children: [
1064
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1065
+ className: "flex flex-col gap-5",
1066
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1067
+ className: "flex gap-5",
1068
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1069
+ className: "flex flex-1 flex-col gap-2 min-w-0",
1070
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1071
+ className: "agg-type-label-strong text-agg-foreground",
1072
+ children: labels.deposit.sendCrypto.tokenLabel
1073
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Select, {
1074
+ items: tokenOptions,
1075
+ value: selectedToken,
1076
+ onChange: onTokenChange,
1077
+ ariaLabel: labels.deposit.sendCrypto.tokenLabel
1078
+ })]
1079
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1080
+ className: "flex flex-1 flex-col gap-2 min-w-0",
1081
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1082
+ className: "agg-type-label-strong text-agg-foreground",
1083
+ children: labels.deposit.sendCrypto.networkLabel
1084
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Select, {
1085
+ items: networkOptions,
1086
+ value: selectedNetwork,
1087
+ onChange: onNetworkChange,
1088
+ ariaLabel: labels.deposit.sendCrypto.networkLabel
1089
+ })]
1090
+ })]
1091
+ })
1092
+ }),
1093
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1094
+ className: "mx-auto",
1095
+ children: isLoadingAddress ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CryptoAddressLoadingState, {}) : addressError ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1096
+ className: "flex h-[192px] w-[192px] items-center justify-center rounded-xl border border-agg-separator bg-agg-secondary",
1097
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1098
+ className: "agg-type-label text-center text-agg-error px-3",
1099
+ children: addressError
1100
+ })
1101
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DepositQRCode, {
1102
+ depositAddress,
1103
+ networkLogoUrl,
1104
+ networkLogo
1105
+ })
1106
+ }),
1107
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1108
+ className: "flex flex-col gap-3",
1109
+ children: [
1110
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1111
+ className: "agg-type-label-strong text-agg-foreground",
1112
+ children: labels.deposit.sendCrypto.depositAddressLabel
1113
+ }),
1114
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1115
+ className: "flex items-center gap-2 rounded border border-agg-separator bg-agg-secondary h-10 px-3",
1116
+ children: [isLoadingAddress ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "h-4 flex-1 animate-pulse rounded bg-agg-muted-foreground/20" }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1117
+ className: "agg-type-body flex-1 min-w-0 truncate text-agg-foreground",
1118
+ children: depositAddress
1119
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.CopyButton, {
1120
+ value: depositAddress,
1121
+ label: labels.deposit.sendCrypto.copy,
1122
+ copiedLabel: labels.deposit.sendCrypto.copied,
1123
+ disabled: isLoadingAddress || !!addressError || !depositAddress,
1124
+ onCopy: onCopyAddress,
1125
+ className: "text-agg-primary hover:text-agg-primary/80"
1126
+ })]
1127
+ }),
1128
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_manage_betdex_account_modal.TransferFeeSummary, {
1129
+ estimate: transferFeeEstimate,
1130
+ view: "deposit",
1131
+ minDeposit,
1132
+ eta
1133
+ })
1134
+ ]
1135
+ }),
1136
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1137
+ className: "flex items-start gap-3 rounded-lg bg-agg-secondary-hover p-3",
1138
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.WarningIcon, { className: "h-4 w-4 text-agg-muted-foreground mt-0.5" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1139
+ className: "text-agg-xs leading-agg-4 text-agg-foreground",
1140
+ children: labels.deposit.sendCrypto.warning
1141
+ })]
1142
+ }),
1143
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
1144
+ variant: "secondary",
1145
+ size: "large",
1146
+ className: "w-[120px] self-center",
1147
+ onClick: onDone,
1148
+ children: labels.deposit.done
1149
+ })
1150
+ ]
1151
+ })
1152
+ })] });
1153
+ };
1154
+ //#endregion
1155
+ //#region src/deposit/steps/deposit-method.tsx
1156
+ const DepositMethodCard = ({ icon, title, description, value, highlighted = false, disabled = false, onContinue }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1157
+ className: require_primitives.cn("flex items-center gap-3 sm:gap-4", "rounded-xl border border-agg-separator", "p-3 sm:p-4", "transition-colors", disabled ? "opacity-50 cursor-not-allowed pointer-events-none" : "cursor-pointer hover:bg-agg-secondary-hover", highlighted ? "" : ""),
1158
+ role: "button",
1159
+ tabIndex: disabled ? -1 : 0,
1160
+ "aria-disabled": disabled || void 0,
1161
+ onClick: disabled ? void 0 : onContinue,
1162
+ onKeyDown: disabled ? void 0 : (e) => {
1163
+ if (e.key === "Enter" || e.key === " ") {
1164
+ e.preventDefault();
1165
+ onContinue();
1166
+ }
1167
+ },
1168
+ children: [
1169
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1170
+ className: "shrink-0 flex items-center justify-center h-10 w-10 rounded-lg bg-agg-secondary-hover",
1171
+ children: icon
1172
+ }),
1173
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1174
+ className: "flex-1 min-w-0",
1175
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1176
+ className: "agg-type-body-strong text-agg-foreground",
1177
+ children: title
1178
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1179
+ className: "agg-type-label text-agg-muted-foreground",
1180
+ children: description
1181
+ })]
1182
+ }),
1183
+ value ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1184
+ className: "agg-type-label text-agg-muted-foreground",
1185
+ children: value
1186
+ }) : null,
1187
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1188
+ className: "shrink-0 text-agg-muted-foreground",
1189
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.ChevronRightIcon, { className: "h-5 w-5" })
1190
+ })
1191
+ ]
1192
+ });
1193
+ const DepositMethodStep = ({ balance, walletLabel, walletBalance, walletToken, isWalletBalanceLoading = false, showWalletMethod = true, highlightedMethod, depositAddressesReady = true, onSelectMethod }) => {
1194
+ const labels = (0, _agg_build_hooks.useLabels)();
1195
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Header, {
1196
+ title: labels.deposit.title,
1197
+ hideBorder: true
1198
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Body, {
1199
+ classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" },
1200
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1201
+ className: "flex flex-col gap-5",
1202
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1203
+ className: "agg-type-body text-agg-foreground",
1204
+ children: [
1205
+ labels.deposit.balancePrefix,
1206
+ " ",
1207
+ require_primitives.formatCompactUsd(balance)
1208
+ ]
1209
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1210
+ className: "flex flex-col gap-4",
1211
+ children: [
1212
+ showWalletMethod ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DepositMethodCard, {
1213
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.WalletIcon, { className: "h-6 w-6 text-agg-muted-foreground" }),
1214
+ title: labels.deposit.methods.walletTitle(walletLabel),
1215
+ description: labels.deposit.methods.walletDescription,
1216
+ value: isWalletBalanceLoading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.LoadingIcon, { size: "small" }) : require_primitives.formatTokenAmount(walletBalance, walletToken),
1217
+ highlighted: highlightedMethod === "wallet",
1218
+ disabled: !depositAddressesReady,
1219
+ onContinue: () => onSelectMethod("wallet")
1220
+ }) : null,
1221
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DepositMethodCard, {
1222
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.BoltIcon, { className: "h-6 w-6 text-agg-muted-foreground" }),
1223
+ title: labels.deposit.methods.cryptoTitle,
1224
+ description: labels.deposit.methods.cryptoDescription,
1225
+ highlighted: highlightedMethod === "crypto",
1226
+ disabled: !depositAddressesReady,
1227
+ onContinue: () => onSelectMethod("crypto")
1228
+ }),
1229
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DepositMethodCard, {
1230
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.CreditCardIcon, { className: "h-6 w-6 text-agg-muted-foreground" }),
1231
+ title: labels.deposit.methods.cardTitle,
1232
+ description: labels.deposit.methods.cardDescription,
1233
+ highlighted: highlightedMethod === "card",
1234
+ onContinue: () => onSelectMethod("card")
1235
+ })
1236
+ ]
1237
+ })]
1238
+ })
1239
+ })] });
1240
+ };
1241
+ //#endregion
1242
+ //#region src/deposit/steps/wallet-form.tsx
1243
+ const WalletFormStep = ({ walletLabel, walletBalance, isBalanceLoading = false, tokenOptions, networkOptions, selectedToken, selectedNetwork, amount, isSubmitting = false, formErrorMessage, formErrorTone = "error", estimatedReceive, feeEstimate, eta, onBack, onTokenChange, onNetworkChange, onAmountChange, onMax, onConfirm }) => {
1244
+ const labels = (0, _agg_build_hooks.useLabels)();
1245
+ const isConfirmEnabled = !isSubmitting && !isBalanceLoading && Number(amount) > 0 && Number(amount) <= walletBalance;
1246
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Header, {
1247
+ title: labels.deposit.walletFlow.title,
1248
+ hideBorder: true,
1249
+ leftElement: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1250
+ type: "button",
1251
+ className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
1252
+ onClick: onBack,
1253
+ "aria-label": "Go back",
1254
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.ChevronLeftIcon, { className: "h-6 w-6" })
1255
+ })
1256
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Body, {
1257
+ classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" },
1258
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1259
+ className: "flex flex-col gap-7",
1260
+ children: [
1261
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1262
+ className: "flex items-center justify-between",
1263
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1264
+ className: "agg-type-label text-agg-foreground",
1265
+ children: walletLabel
1266
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1267
+ className: "agg-type-label text-agg-muted-foreground",
1268
+ children: [
1269
+ labels.deposit.balanceLabel,
1270
+ " ",
1271
+ isBalanceLoading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.LoadingIcon, { size: "small" }) : require_primitives.formatTokenAmount(walletBalance, selectedToken)
1272
+ ]
1273
+ })]
1274
+ }),
1275
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1276
+ className: "flex flex-col gap-5",
1277
+ children: [
1278
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1279
+ className: "flex gap-5",
1280
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1281
+ className: "flex flex-1 flex-col gap-2 min-w-0",
1282
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1283
+ className: "agg-type-label-strong text-agg-foreground",
1284
+ children: labels.deposit.walletFlow.tokenLabel
1285
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Select, {
1286
+ items: tokenOptions,
1287
+ value: selectedToken,
1288
+ onChange: onTokenChange,
1289
+ ariaLabel: labels.deposit.walletFlow.tokenLabel
1290
+ })]
1291
+ }), networkOptions.length >= 1 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1292
+ className: "flex flex-1 flex-col gap-2 min-w-0",
1293
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1294
+ className: "agg-type-label-strong text-agg-foreground",
1295
+ children: labels.deposit.walletFlow.networkLabel
1296
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Select, {
1297
+ items: networkOptions,
1298
+ value: selectedNetwork,
1299
+ onChange: onNetworkChange,
1300
+ ariaLabel: labels.deposit.walletFlow.networkLabel
1301
+ })]
1302
+ }) : null]
1303
+ }),
1304
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1305
+ className: "flex flex-col gap-2",
1306
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1307
+ className: "agg-type-label-strong text-agg-foreground",
1308
+ children: labels.deposit.walletFlow.amountLabel
1309
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1310
+ className: require_primitives.cn("flex items-center gap-2", "rounded border border-agg-separator bg-agg-secondary", "h-10 px-3"),
1311
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1312
+ type: "text",
1313
+ inputMode: "decimal",
1314
+ "aria-label": labels.deposit.walletFlow.amountLabel,
1315
+ className: "agg-type-body w-full bg-transparent outline-none text-agg-foreground",
1316
+ placeholder: "0.00",
1317
+ value: amount,
1318
+ onChange: (event) => onAmountChange(event.target.value)
1319
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1320
+ type: "button",
1321
+ className: "shrink-0 text-agg-sm font-agg-bold leading-agg-5 text-agg-primary transition-colors hover:text-agg-primary/80 cursor-pointer",
1322
+ onClick: onMax,
1323
+ "aria-label": labels.deposit.walletFlow.max,
1324
+ children: labels.deposit.walletFlow.max
1325
+ })]
1326
+ })]
1327
+ }),
1328
+ estimatedReceive && feeEstimate && eta ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1329
+ className: "agg-type-label text-agg-foreground",
1330
+ children: `≈ ${estimatedReceive} · ${labels.deposit.walletFlow.feePrefix} ${feeEstimate} · ${eta}`
1331
+ }) : null,
1332
+ formErrorMessage ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1333
+ className: require_primitives.cn("flex items-start gap-2", formErrorTone === "warning" ? "text-agg-warning" : "text-agg-error"),
1334
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.WarningIcon, { className: "mt-0.5 h-4 w-4 shrink-0" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1335
+ className: "agg-type-label",
1336
+ children: formErrorMessage
1337
+ })]
1338
+ }) : null
1339
+ ]
1340
+ }),
1341
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
1342
+ variant: isConfirmEnabled ? "primary" : "secondary",
1343
+ size: "large",
1344
+ className: "w-full",
1345
+ disabled: !isConfirmEnabled,
1346
+ isLoading: isSubmitting,
1347
+ "aria-label": labels.deposit.walletFlow.confirm,
1348
+ onClick: onConfirm,
1349
+ children: labels.deposit.walletFlow.confirm
1350
+ })
1351
+ ]
1352
+ })
1353
+ })] });
1354
+ };
1355
+ //#endregion
1356
+ //#region src/deposit/steps/wallet-processing.tsx
1357
+ const WalletProcessingStep = ({ steps, errorMessage, onComplete }) => {
1358
+ const labels = (0, _agg_build_hooks.useLabels)();
1359
+ (0, react.useEffect)(() => {
1360
+ if (steps.length > 0 && steps.every((s) => s.status === "complete")) onComplete();
1361
+ }, [steps, onComplete]);
1362
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Header, {
1363
+ title: labels.deposit.processingTitle,
1364
+ hideBorder: true
1365
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Body, {
1366
+ classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" },
1367
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1368
+ className: "flex flex-col gap-5",
1369
+ children: [steps.map((step) => {
1370
+ const isComplete = step.status === "complete";
1371
+ const isActive = step.status === "active";
1372
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1373
+ className: "flex items-center gap-3",
1374
+ children: [isComplete ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.CheckCircleIcon, { className: "h-4 w-4 text-agg-primary" }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: [
1375
+ "inline-block h-4 w-4 rounded-full border",
1376
+ isActive ? "border-2 border-agg-primary border-r-transparent animate-spin" : "",
1377
+ !isActive ? "border-agg-separator" : ""
1378
+ ].join(" ") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1379
+ className: isComplete || isActive ? "agg-type-body text-agg-foreground" : "agg-type-body text-agg-muted-foreground",
1380
+ children: step.label
1381
+ })]
1382
+ }, step.id);
1383
+ }), errorMessage ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1384
+ className: "agg-type-body text-agg-destructive",
1385
+ children: errorMessage
1386
+ }) : null]
1387
+ })
1388
+ })] });
1389
+ };
1390
+ //#endregion
1391
+ //#region src/deposit/steps/wallet-success.tsx
1392
+ const SummaryRow = ({ label, value }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1393
+ className: "flex items-center justify-between border-b border-agg-separator py-2 last:border-b-0",
1394
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1395
+ className: "text-[12px] leading-4 font-agg-bold uppercase text-agg-muted-foreground",
1396
+ children: label
1397
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1398
+ className: "agg-type-label text-agg-foreground",
1399
+ children: value
1400
+ })]
1401
+ });
1402
+ const WalletSuccessStep = ({ summary, onDone, onClose }) => {
1403
+ const labels = (0, _agg_build_hooks.useLabels)();
1404
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1405
+ className: "relative",
1406
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_primitives.Modal.Body, {
1407
+ classNames: { root: "px-5 py-8 sm:px-8 sm:py-10" },
1408
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1409
+ type: "button",
1410
+ className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80",
1411
+ onClick: onClose,
1412
+ "aria-label": labels.common.close,
1413
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.CloseIcon, { className: "h-6 w-6" })
1414
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1415
+ className: "flex flex-col items-center gap-8",
1416
+ children: [
1417
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1418
+ className: "flex h-[60px] w-[60px] items-center justify-center rounded-full bg-agg-success/15",
1419
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.SuccessCheckIcon, { className: "h-6 w-6 text-agg-success" })
1420
+ }),
1421
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1422
+ className: "flex flex-col items-center gap-3 text-center",
1423
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
1424
+ className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground",
1425
+ children: labels.deposit.successTitle
1426
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1427
+ className: "agg-type-body text-agg-foreground",
1428
+ children: labels.deposit.successDescription
1429
+ })]
1430
+ }),
1431
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1432
+ className: "w-full rounded-lg border border-agg-separator bg-agg-secondary px-3 py-1",
1433
+ children: [
1434
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SummaryRow, {
1435
+ label: labels.deposit.summary.amountReceived,
1436
+ value: summary.amountReceived
1437
+ }),
1438
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SummaryRow, {
1439
+ label: labels.deposit.summary.network,
1440
+ value: summary.network
1441
+ }),
1442
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SummaryRow, {
1443
+ label: labels.deposit.summary.fromWallet,
1444
+ value: summary.fromWallet
1445
+ }),
1446
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SummaryRow, {
1447
+ label: labels.deposit.summary.gasFee,
1448
+ value: summary.gasFee
1449
+ })
1450
+ ]
1451
+ }),
1452
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
1453
+ variant: "secondary",
1454
+ size: "large",
1455
+ className: "w-[120px]",
1456
+ onClick: onDone,
1457
+ children: labels.deposit.done
1458
+ })
1459
+ ]
1460
+ })]
1461
+ })
1462
+ });
1463
+ };
1464
+ //#endregion
1465
+ //#region src/deposit/index.tsx
1466
+ const PENDING_CARD_SESSION_KEY = "agg-pending-card-session";
1467
+ const DEFAULT_WALLET_CHAIN_ID = "1";
1468
+ const DEFAULT_WALLET_TOKEN = "USDC";
1469
+ function savePendingCardSession(data) {
1470
+ try {
1471
+ localStorage.setItem(PENDING_CARD_SESSION_KEY, JSON.stringify(data));
1472
+ } catch {}
1473
+ }
1474
+ function clearPendingCardSession() {
1475
+ try {
1476
+ localStorage.removeItem(PENDING_CARD_SESSION_KEY);
1477
+ } catch {}
1478
+ }
1479
+ /**
1480
+ * Returns a pending card session if one exists in localStorage.
1481
+ * Consumers should use this on page load to detect a redirect from the ramp provider
1482
+ * and pass it as `pendingCardSession` to the DepositModal.
1483
+ */
1484
+ function getPendingCardSession() {
1485
+ try {
1486
+ const raw = localStorage.getItem(PENDING_CARD_SESSION_KEY);
1487
+ if (!raw) return null;
1488
+ return JSON.parse(raw);
1489
+ } catch {
1490
+ return null;
1491
+ }
1492
+ }
1493
+ function getDefaultProcessingSteps(transactionStatus, labels) {
1494
+ const defaultSteps = [{
1495
+ id: "submitting",
1496
+ label: labels.submitting,
1497
+ status: "active"
1498
+ }, {
1499
+ id: "confirming",
1500
+ label: labels.confirming,
1501
+ status: "pending"
1502
+ }];
1503
+ const activeByStatus = {
1504
+ submitting: 0,
1505
+ submitted: 1,
1506
+ confirming: 1,
1507
+ error: 1
1508
+ };
1509
+ if (transactionStatus === "settled") return defaultSteps.map((step) => ({
1510
+ ...step,
1511
+ status: "complete"
1512
+ }));
1513
+ const activeIndex = activeByStatus[transactionStatus ?? "submitted"] ?? 0;
1514
+ return defaultSteps.map((step, index) => ({
1515
+ ...step,
1516
+ status: index < activeIndex ? "complete" : index === activeIndex ? "active" : "pending"
1517
+ }));
1518
+ }
1519
+ function isControlledDepositModalProps(props) {
1520
+ return "walletFlow" in props;
1521
+ }
1522
+ function DepositModalSelfDriven({ open, onOpenChange }) {
1523
+ const depositProps = (0, _agg_build_hooks_deposit.useDepositFlow)({
1524
+ open,
1525
+ onOpenChange
1526
+ });
1527
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DepositModalControlled, { ...depositProps });
1528
+ }
1529
+ function DepositModalControlled({ open, onOpenChange, onSelectDepositMethod, onContinueCardDeposit, onDoneCryptoTransfer, walletFlow, onWalletAmountChange, onWalletMax, onConfirmWalletDeposit, onCancelWalletDeposit, onDoneWalletDeposit, onWalletNetworkChange, onWalletTokenChange, initialWalletChainId, connectedWalletKind, sendCryptoConfig, onDoneSendCrypto, cardFlow, onCardAmountChange, onCardCurrencyChange, onCardTokenChange, onCardNetworkChange, onSelectCardProvider, onDoneCardPurchase, onViewActivity, cardRedirectUrl, onGetCardQuotes, onCreateCardSession, pendingCardPurchaseSummary }) {
1530
+ const { isWeb3User } = (0, _agg_build_hooks.useAggAuthState)();
1531
+ const { walletActions } = (0, _agg_build_hooks.useAggUiConfig)();
1532
+ const labels = (0, _agg_build_hooks.useLabels)();
1533
+ const defaultMethod = isWeb3User ? "wallet" : "crypto";
1534
+ const [step, setStep] = (0, react.useState)(() => pendingCardPurchaseSummary ? "card-success" : "method");
1535
+ const [highlightedMethod, setHighlightedMethod] = (0, react.useState)(defaultMethod);
1536
+ const walletSubmitInFlightRef = (0, react.useRef)(false);
1537
+ const walletDepositAttemptIdRef = (0, react.useRef)(0);
1538
+ const notifiedWalletDepositStatusesRef = (0, react.useRef)(/* @__PURE__ */ new Set());
1539
+ const [isWalletSubmitting, setIsWalletSubmitting] = (0, react.useState)(false);
1540
+ const [cardProviders, setCardProviders] = (0, react.useState)([]);
1541
+ const [quotesLoading, setQuotesLoading] = (0, react.useState)(false);
1542
+ const [quotesError, setQuotesError] = (0, react.useState)(null);
1543
+ const [sessionError, setSessionError] = (0, react.useState)(null);
1544
+ const [pendingProviderName, setPendingProviderName] = (0, react.useState)("");
1545
+ const [pendingProviderWalletAddress, setPendingProviderWalletAddress] = (0, react.useState)("");
1546
+ (0, react.useEffect)(() => {
1547
+ if (pendingCardPurchaseSummary) {
1548
+ clearPendingCardSession();
1549
+ setStep("card-success");
1550
+ }
1551
+ }, [pendingCardPurchaseSummary]);
1552
+ const [walletChainId, setWalletChainId] = (0, react.useState)("");
1553
+ const [walletToken, setWalletToken] = (0, react.useState)("");
1554
+ const [sendChainId, setSendChainId] = (0, react.useState)("");
1555
+ const [sendToken, setSendToken] = (0, react.useState)("");
1556
+ const { isReady, isTimedOut, error: addrError, supportedChains, getAddress } = (0, _agg_build_hooks.useDepositAddresses)({ enabled: open });
1557
+ const fallbackNetworkOptions = (0, react.useMemo)(() => require_manage_betdex_account_modal.mapNetworksToOptions(), []);
1558
+ const networkOptions = (0, react.useMemo)(() => {
1559
+ if (!supportedChains?.length) return fallbackNetworkOptions;
1560
+ return require_manage_betdex_account_modal.withNetworkIcons(supportedChains.map((c) => ({
1561
+ value: String(c.chainId),
1562
+ label: c.name
1563
+ })));
1564
+ }, [supportedChains, fallbackNetworkOptions]);
1565
+ const walletNetworkOptions = (0, react.useMemo)(() => {
1566
+ if (!supportedChains?.length || !connectedWalletKind) return networkOptions;
1567
+ const filtered = supportedChains.filter((c) => connectedWalletKind === "solana" ? _agg_build_hooks_deposit.SVM_CHAIN_IDS.has(c.chainId) : !_agg_build_hooks_deposit.SVM_CHAIN_IDS.has(c.chainId));
1568
+ if (filtered.length === 0) return networkOptions;
1569
+ return require_manage_betdex_account_modal.withNetworkIcons(filtered.map((c) => ({
1570
+ value: String(c.chainId),
1571
+ label: c.name
1572
+ })));
1573
+ }, [
1574
+ supportedChains,
1575
+ networkOptions,
1576
+ connectedWalletKind
1577
+ ]);
1578
+ const walletTokenOptions = (0, react.useMemo)(() => {
1579
+ const chain = supportedChains?.find((c) => String(c.chainId) === walletChainId);
1580
+ if (!chain) return require_manage_betdex_account_modal.withTokenIcons(require_manage_betdex_account_modal.DEFAULT_CURRENCY_OPTIONS);
1581
+ return require_manage_betdex_account_modal.withTokenIcons(chain.tokens.map((t) => ({
1582
+ value: t.symbol,
1583
+ label: t.symbol
1584
+ })));
1585
+ }, [supportedChains, walletChainId]);
1586
+ const sendTokenOptions = (0, react.useMemo)(() => {
1587
+ const chain = supportedChains?.find((c) => String(c.chainId) === sendChainId);
1588
+ if (!chain) return require_manage_betdex_account_modal.withTokenIcons(require_manage_betdex_account_modal.DEFAULT_CURRENCY_OPTIONS);
1589
+ return require_manage_betdex_account_modal.withTokenIcons(chain.tokens.map((t) => ({
1590
+ value: t.symbol,
1591
+ label: t.symbol
1592
+ })));
1593
+ }, [supportedChains, sendChainId]);
1594
+ (0, react.useEffect)(() => {
1595
+ if (walletNetworkOptions.length > 0) {
1596
+ if (!walletChainId || !walletNetworkOptions.some((o) => o.value === walletChainId)) {
1597
+ const ethereumMainnetOption = walletNetworkOptions.find((option) => option.value === DEFAULT_WALLET_CHAIN_ID || option.value === "mainnet" || option.label.toLowerCase() === "ethereum");
1598
+ const preferred = ethereumMainnetOption ? ethereumMainnetOption.value : initialWalletChainId && walletNetworkOptions.some((option) => option.value === initialWalletChainId) ? initialWalletChainId : walletNetworkOptions[0].value;
1599
+ setWalletChainId(preferred);
1600
+ }
1601
+ }
1602
+ }, [
1603
+ walletNetworkOptions,
1604
+ walletChainId,
1605
+ initialWalletChainId
1606
+ ]);
1607
+ (0, react.useEffect)(() => {
1608
+ if (networkOptions.length > 0) {
1609
+ if (!sendChainId || !networkOptions.some((o) => o.value === sendChainId)) setSendChainId(networkOptions[0].value);
1610
+ }
1611
+ }, [networkOptions, sendChainId]);
1612
+ (0, react.useEffect)(() => {
1613
+ if (walletTokenOptions.length > 0) {
1614
+ const preferredToken = walletTokenOptions.find((option) => option.value === DEFAULT_WALLET_TOKEN)?.value ?? walletTokenOptions[0].value;
1615
+ setWalletToken(preferredToken);
1616
+ }
1617
+ }, [walletTokenOptions]);
1618
+ (0, react.useEffect)(() => {
1619
+ setSendToken(sendTokenOptions?.[0]?.value ?? "");
1620
+ }, [sendTokenOptions]);
1621
+ (0, react.useEffect)(() => {
1622
+ if (walletChainId) onWalletNetworkChange?.(walletChainId);
1623
+ }, [walletChainId, onWalletNetworkChange]);
1624
+ (0, react.useEffect)(() => {
1625
+ if (walletToken) onWalletTokenChange?.(walletToken);
1626
+ }, [walletToken, onWalletTokenChange]);
1627
+ const depositAddress = getAddress(sendChainId ? Number(sendChainId) : void 0) ?? "";
1628
+ const isLoadingAddress = open && !isReady && !isTimedOut && !addrError;
1629
+ const addressError = isTimedOut && !isReady ? "Address generation timed out. Please try again." : addrError && !isReady ? "Failed to load deposit address." : void 0;
1630
+ const usesTransactionStatus = walletFlow.transactionStatus !== void 0;
1631
+ const processingStatus = isWalletSubmitting ? "submitting" : walletFlow.transactionStatus;
1632
+ const processingSteps = usesTransactionStatus ? walletFlow.processingSteps ?? getDefaultProcessingSteps(processingStatus, labels.deposit.processingSteps) : walletFlow.processingSteps ?? getDefaultProcessingSteps(processingStatus, labels.deposit.processingSteps);
1633
+ const selectedNetworkLabel = networkOptions.find((n) => n.value === walletChainId)?.label ?? "";
1634
+ const resolvedSuccessSummary = {
1635
+ amountReceived: `+${walletFlow.amount} ${walletToken}`,
1636
+ network: selectedNetworkLabel,
1637
+ fromWallet: walletFlow.walletLabel,
1638
+ gasFee: "",
1639
+ ...walletFlow.successSummary
1640
+ };
1641
+ const handleWalletDepositNotification = (0, react.useCallback)((status, errorMessage) => {
1642
+ if (notifiedWalletDepositStatusesRef.current.has(status)) return;
1643
+ notifiedWalletDepositStatusesRef.current.add(status);
1644
+ require_manage_betdex_account_modal.dispatchAggDepositNotification({
1645
+ id: `wallet-${walletDepositAttemptIdRef.current}`,
1646
+ status,
1647
+ amount: walletFlow.amount,
1648
+ tokenSymbol: walletToken || DEFAULT_WALLET_TOKEN,
1649
+ errorMessage
1650
+ });
1651
+ }, [walletFlow.amount, walletToken]);
1652
+ (0, react.useEffect)(() => {
1653
+ if (step === "wallet-processing" && !isWalletSubmitting && walletFlow.transactionStatus === "settled") {
1654
+ handleWalletDepositNotification("completed");
1655
+ setStep("wallet-success");
1656
+ }
1657
+ }, [
1658
+ handleWalletDepositNotification,
1659
+ isWalletSubmitting,
1660
+ step,
1661
+ walletFlow.transactionStatus
1662
+ ]);
1663
+ (0, react.useEffect)(() => {
1664
+ if (!onCancelWalletDeposit) return;
1665
+ if (step === "wallet-processing" && !isWalletSubmitting && walletFlow.transactionStatus === "error") {
1666
+ walletSubmitInFlightRef.current = false;
1667
+ handleWalletDepositNotification("failed", walletFlow.transactionErrorMessage);
1668
+ onCancelWalletDeposit();
1669
+ setStep("wallet-form");
1670
+ }
1671
+ }, [
1672
+ handleWalletDepositNotification,
1673
+ isWalletSubmitting,
1674
+ onCancelWalletDeposit,
1675
+ step,
1676
+ walletFlow.transactionErrorMessage,
1677
+ walletFlow.transactionStatus
1678
+ ]);
1679
+ const cardTokenOptions = require_manage_betdex_account_modal.withTokenIcons(require_manage_betdex_account_modal.mergeSelectOptionsUnique(cardFlow?.tokenOptions, require_manage_betdex_account_modal.DEFAULT_CURRENCY_OPTIONS));
1680
+ const cardNetworkOptions = require_manage_betdex_account_modal.withNetworkIcons(require_manage_betdex_account_modal.mergeSelectOptionsUnique(cardFlow?.networkOptions, CARD_NETWORK_OPTIONS));
1681
+ const handleSelectMethod = (method) => {
1682
+ if (method === "wallet" && !isWeb3User) return;
1683
+ if (!isReady && (method === "wallet" || method === "crypto")) return;
1684
+ setHighlightedMethod(method);
1685
+ onSelectDepositMethod?.(method);
1686
+ if (method === "wallet") {
1687
+ setStep("wallet-form");
1688
+ return;
1689
+ }
1690
+ if (method === "card") setStep("card-deposit");
1691
+ else if (method === "crypto") setStep("crypto-transfer");
1692
+ };
1693
+ const handleContinueCardDeposit = async (amount) => {
1694
+ onContinueCardDeposit?.(amount);
1695
+ setStep("card-provider");
1696
+ if (onGetCardQuotes) {
1697
+ setQuotesLoading(true);
1698
+ setQuotesError(null);
1699
+ setCardProviders([]);
1700
+ try {
1701
+ const providers = await onGetCardQuotes({
1702
+ sourceAmount: String(amount),
1703
+ sourceCurrencyCode: cardFlow?.currency ?? "USD",
1704
+ destinationCurrencyCode: NETWORK_TO_CURRENCY_CODE[cardFlow?.selectedNetwork ?? ""] ?? cardFlow?.selectedNetwork ?? ""
1705
+ });
1706
+ setCardProviders(providers);
1707
+ } catch (err) {
1708
+ setQuotesError(err instanceof Error ? err.message : "Failed to load quotes");
1709
+ } finally {
1710
+ setQuotesLoading(false);
1711
+ }
1712
+ } else setCardProviders(cardFlow?.providers ?? []);
1713
+ };
1714
+ const handleRetryQuotes = () => {
1715
+ const amount = Number(cardFlow?.amount) || 0;
1716
+ if (amount > 0) handleContinueCardDeposit(amount);
1717
+ };
1718
+ const handleSelectProvider = async (providerId) => {
1719
+ onSelectCardProvider?.(providerId);
1720
+ if (onCreateCardSession) {
1721
+ setSessionError(null);
1722
+ try {
1723
+ const networkVal = cardFlow?.selectedNetwork ?? "";
1724
+ const numericId = Number(networkVal);
1725
+ const cardChainId = Number.isFinite(numericId) && numericId > 0 ? numericId : supportedChains?.find((c) => c.name.toLowerCase() === networkVal.toLowerCase())?.chainId;
1726
+ const depositAddr = getAddress(cardChainId) ?? "";
1727
+ const session = await onCreateCardSession({
1728
+ serviceProvider: providerId,
1729
+ sourceAmount: cardFlow?.amount ?? "",
1730
+ sourceCurrencyCode: cardFlow?.currency ?? "USD",
1731
+ destinationCurrencyCode: NETWORK_TO_CURRENCY_CODE[networkVal] ?? networkVal,
1732
+ walletAddress: depositAddr,
1733
+ redirectUrl: cardRedirectUrl
1734
+ });
1735
+ const selectedProvider = cardProviders.find((p) => p.id === providerId);
1736
+ const networkLabel = cardFlow?.networkOptions?.find((o) => o.value === cardFlow?.selectedNetwork)?.label ?? cardFlow?.selectedNetwork ?? "";
1737
+ savePendingCardSession({
1738
+ sessionId: session.id,
1739
+ summary: {
1740
+ amountReceived: selectedProvider?.quote ?? "",
1741
+ network: networkLabel,
1742
+ fees: selectedProvider?.fee ?? ""
1743
+ }
1744
+ });
1745
+ window.open(session.widgetUrl, "_blank", "noopener,noreferrer");
1746
+ setPendingProviderName(selectedProvider?.name ?? providerId);
1747
+ setPendingProviderWalletAddress(depositAddr);
1748
+ setStep("card-payment-pending");
1749
+ } catch (err) {
1750
+ setSessionError(err instanceof Error ? err.message : "Failed to create session");
1751
+ }
1752
+ }
1753
+ };
1754
+ const handleViewActivity = () => {
1755
+ onViewActivity?.();
1756
+ if (typeof window !== "undefined") window.location.href = "/profile?tab=activity";
1757
+ };
1758
+ const handleChooseAnotherProvider = () => {
1759
+ setCardProviders([]);
1760
+ setQuotesError(null);
1761
+ setSessionError(null);
1762
+ setPendingProviderName("");
1763
+ setPendingProviderWalletAddress("");
1764
+ setStep("card-deposit");
1765
+ };
1766
+ const handleDoneCryptoTransfer = () => {
1767
+ onDoneCryptoTransfer?.();
1768
+ onDoneSendCrypto?.();
1769
+ };
1770
+ const handleDoneWalletDeposit = () => {
1771
+ handleOpenChange(false);
1772
+ onDoneWalletDeposit?.();
1773
+ };
1774
+ const handleDoneCardPurchase = () => {
1775
+ handleOpenChange(false);
1776
+ onDoneCardPurchase?.();
1777
+ };
1778
+ const handleOpenChange = (isOpen) => {
1779
+ if (!isOpen) {
1780
+ setStep("method");
1781
+ setHighlightedMethod(defaultMethod);
1782
+ setWalletChainId("");
1783
+ setWalletToken("");
1784
+ setSendChainId("");
1785
+ setSendToken("");
1786
+ walletSubmitInFlightRef.current = false;
1787
+ walletDepositAttemptIdRef.current = 0;
1788
+ notifiedWalletDepositStatusesRef.current = /* @__PURE__ */ new Set();
1789
+ setIsWalletSubmitting(false);
1790
+ setCardProviders([]);
1791
+ setQuotesLoading(false);
1792
+ setQuotesError(null);
1793
+ setSessionError(null);
1794
+ setPendingProviderName("");
1795
+ setPendingProviderWalletAddress("");
1796
+ clearPendingCardSession();
1797
+ }
1798
+ onOpenChange(isOpen);
1799
+ };
1800
+ const depositModalMaxWidth = step === "method" ? "600px" : "480px";
1801
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal, {
1802
+ open,
1803
+ onOpenChange: handleOpenChange,
1804
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_primitives.Modal.Container, {
1805
+ maxWidth: depositModalMaxWidth,
1806
+ "aria-label": "Deposit",
1807
+ children: [
1808
+ step === "method" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DepositMethodStep, {
1809
+ balance: walletFlow.balance,
1810
+ walletLabel: walletFlow.walletLabel,
1811
+ walletBalance: walletFlow.walletBalance,
1812
+ walletToken,
1813
+ isWalletBalanceLoading: walletFlow.isWalletBalanceLoading,
1814
+ showWalletMethod: isWeb3User,
1815
+ highlightedMethod,
1816
+ depositAddressesReady: isReady,
1817
+ onSelectMethod: handleSelectMethod
1818
+ }) : null,
1819
+ step === "wallet-form" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WalletFormStep, {
1820
+ walletLabel: walletFlow.walletLabel,
1821
+ walletBalance: walletFlow.walletBalance,
1822
+ isBalanceLoading: walletFlow.isWalletBalanceLoading,
1823
+ tokenOptions: walletTokenOptions,
1824
+ networkOptions: walletNetworkOptions,
1825
+ selectedToken: walletToken,
1826
+ selectedNetwork: walletChainId,
1827
+ amount: walletFlow.amount,
1828
+ formErrorMessage: walletFlow.formErrorMessage,
1829
+ formErrorTone: walletFlow.formErrorTone,
1830
+ estimatedReceive: walletFlow.estimatedReceive,
1831
+ feeEstimate: walletFlow.feeEstimate,
1832
+ eta: walletFlow.eta,
1833
+ isSubmitting: isWalletSubmitting,
1834
+ onBack: () => setStep("method"),
1835
+ onTokenChange: setWalletToken,
1836
+ onNetworkChange: (id) => {
1837
+ setWalletChainId(id);
1838
+ setWalletToken("");
1839
+ },
1840
+ onAmountChange: onWalletAmountChange,
1841
+ onMax: onWalletMax,
1842
+ onConfirm: async () => {
1843
+ if (walletSubmitInFlightRef.current) return;
1844
+ walletSubmitInFlightRef.current = true;
1845
+ walletDepositAttemptIdRef.current += 1;
1846
+ notifiedWalletDepositStatusesRef.current = /* @__PURE__ */ new Set();
1847
+ setIsWalletSubmitting(true);
1848
+ setStep("wallet-processing");
1849
+ const walletChainIdNum = walletChainId ? Number(walletChainId) : void 0;
1850
+ const address = getAddress(walletChainIdNum) ?? "";
1851
+ try {
1852
+ if (walletActions?.sendToken) {
1853
+ const tokenMeta = (supportedChains?.find((c) => String(c.chainId) === walletChainId))?.tokens.find((t) => t.symbol === walletToken);
1854
+ await walletActions.sendToken({
1855
+ chainId: walletChainIdNum ?? 0,
1856
+ token: {
1857
+ symbol: walletToken,
1858
+ address: tokenMeta?.address,
1859
+ decimals: tokenMeta?.decimals ?? 6
1860
+ },
1861
+ to: address,
1862
+ amount: walletFlow.amount
1863
+ });
1864
+ } else await onConfirmWalletDeposit?.({
1865
+ address,
1866
+ amount: walletFlow.amount,
1867
+ chainId: walletChainIdNum ?? 0,
1868
+ token: walletToken
1869
+ });
1870
+ } catch {
1871
+ walletSubmitInFlightRef.current = false;
1872
+ setStep("wallet-form");
1873
+ } finally {
1874
+ setIsWalletSubmitting(false);
1875
+ }
1876
+ }
1877
+ }) : null,
1878
+ step === "wallet-processing" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WalletProcessingStep, {
1879
+ steps: processingSteps,
1880
+ errorMessage: walletFlow.transactionStatus === "error" ? walletFlow.transactionErrorMessage ?? "Something went wrong with the transaction." : void 0,
1881
+ onComplete: () => setStep("wallet-success")
1882
+ }) : null,
1883
+ step === "wallet-success" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WalletSuccessStep, {
1884
+ summary: resolvedSuccessSummary,
1885
+ onDone: handleDoneWalletDeposit,
1886
+ onClose: () => handleOpenChange(false)
1887
+ }) : null,
1888
+ step === "card-deposit" && cardFlow ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardDepositStep, {
1889
+ amount: cardFlow.amount,
1890
+ currency: cardFlow.currency,
1891
+ tokenOptions: cardTokenOptions,
1892
+ networkOptions: cardNetworkOptions,
1893
+ selectedToken: cardFlow.selectedToken,
1894
+ selectedNetwork: cardFlow.selectedNetwork,
1895
+ minAmount: cardFlow.minAmount,
1896
+ onBack: () => setStep("method"),
1897
+ onAmountChange: onCardAmountChange ?? ignoreCardChange,
1898
+ onCurrencyChange: onCardCurrencyChange ?? ignoreCardChange,
1899
+ onTokenChange: onCardTokenChange ?? ignoreCardChange,
1900
+ onNetworkChange: onCardNetworkChange ?? ignoreCardChange,
1901
+ onContinue: handleContinueCardDeposit
1902
+ }) : null,
1903
+ step === "card-provider" && cardFlow ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardProviderStep, {
1904
+ amount: cardFlow.amount,
1905
+ currency: cardFlow.currency,
1906
+ token: cardFlow.selectedToken,
1907
+ providers: cardProviders,
1908
+ isLoading: quotesLoading,
1909
+ error: quotesError,
1910
+ sessionError,
1911
+ onBack: () => setStep("card-deposit"),
1912
+ onSelectProvider: handleSelectProvider,
1913
+ onRetry: handleRetryQuotes
1914
+ }) : null,
1915
+ step === "card-payment-pending" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardPaymentPendingStep, {
1916
+ providerName: pendingProviderName,
1917
+ walletAddress: pendingProviderWalletAddress || void 0,
1918
+ onClose: () => handleOpenChange(false),
1919
+ onViewActivity: handleViewActivity,
1920
+ onChooseAnotherProvider: handleChooseAnotherProvider
1921
+ }) : null,
1922
+ step === "card-success" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardPurchaseSuccessStep, {
1923
+ summary: pendingCardPurchaseSummary ?? cardFlow?.purchaseSummary ?? {
1924
+ amountReceived: "",
1925
+ network: "",
1926
+ fees: ""
1927
+ },
1928
+ onClose: () => handleOpenChange(false),
1929
+ onDone: handleDoneCardPurchase
1930
+ }) : null,
1931
+ step === "crypto-transfer" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CryptoTransferStep, {
1932
+ tokenOptions: sendTokenOptions,
1933
+ networkOptions,
1934
+ selectedToken: sendToken,
1935
+ selectedNetwork: sendChainId,
1936
+ depositAddress,
1937
+ minDeposit: sendCryptoConfig?.minDeposit ?? "$1",
1938
+ eta: sendCryptoConfig?.eta ?? "~30s",
1939
+ isLoadingAddress,
1940
+ addressError,
1941
+ onBack: () => setStep("method"),
1942
+ onTokenChange: setSendToken,
1943
+ onNetworkChange: (id) => {
1944
+ setSendChainId(id);
1945
+ if (id !== sendChainId) setSendToken("");
1946
+ },
1947
+ onDone: handleDoneCryptoTransfer
1948
+ }) : null
1949
+ ]
1950
+ })
1951
+ });
1952
+ }
1953
+ const ignoreCardChange = (_value) => {};
1954
+ const DepositModal = (props) => {
1955
+ if (!isControlledDepositModalProps(props)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DepositModalSelfDriven, { ...props });
1956
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DepositModalControlled, { ...props });
1957
+ };
1958
+ DepositModal.displayName = "DepositModal";
1959
+ //#endregion
1960
+ //#region src/paper-trading/paper-onboarding-modal.tsx
1961
+ /**
1962
+ * Three-step intro shown once, on a user's first sign-in to a paper app.
1963
+ *
1964
+ * Figma node 4772:31182 lays the three states out side by side; this is one
1965
+ * modal that advances through them, not three modals.
1966
+ *
1967
+ * All copy resolves through `labels.paperTrading.onboarding` — the design's
1968
+ * strings were written against an earlier daily-allowance model and are still
1969
+ * being revised, so nothing here renders a literal.
1970
+ */
1971
+ const PaperOnboardingModal = ({ open, onDismiss, startingBalanceLabel, classNames }) => {
1972
+ const copy = (0, _agg_build_hooks.useLabels)().paperTrading.onboarding;
1973
+ const [stepIndex, setStepIndex] = (0, react.useState)(0);
1974
+ const steps = (0, react.useMemo)(() => [
1975
+ {
1976
+ key: "realMarkets",
1977
+ icon: "paper-onboarding-markets",
1978
+ title: copy.realMarkets.title,
1979
+ body: copy.realMarkets.body
1980
+ },
1981
+ {
1982
+ key: "zeroRisk",
1983
+ icon: "paper-onboarding-funds",
1984
+ title: copy.zeroRisk.title,
1985
+ body: copy.zeroRisk.body({ amount: startingBalanceLabel })
1986
+ },
1987
+ {
1988
+ key: "readyToTrade",
1989
+ icon: "paper-onboarding-performance",
1990
+ title: copy.readyToTrade.title,
1991
+ body: copy.readyToTrade.body
1992
+ }
1993
+ ], [copy, startingBalanceLabel]);
1994
+ const total = steps.length;
1995
+ const isFirst = stepIndex === 0;
1996
+ const isLast = stepIndex === total - 1;
1997
+ const step = steps[stepIndex];
1998
+ const handleBack = (0, react.useCallback)(() => {
1999
+ setStepIndex((current) => Math.max(0, current - 1));
2000
+ }, []);
2001
+ const handleNext = (0, react.useCallback)(() => {
2002
+ if (isLast) {
2003
+ onDismiss();
2004
+ return;
2005
+ }
2006
+ setStepIndex((current) => Math.min(total - 1, current + 1));
2007
+ }, [
2008
+ isLast,
2009
+ onDismiss,
2010
+ total
2011
+ ]);
2012
+ const handleOpenChange = (0, react.useCallback)((next) => {
2013
+ if (next) return;
2014
+ setStepIndex(0);
2015
+ onDismiss();
2016
+ }, [onDismiss]);
2017
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal, {
2018
+ open,
2019
+ onOpenChange: handleOpenChange,
2020
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Container, {
2021
+ maxWidth: "480px",
2022
+ "aria-label": step.title,
2023
+ classNames: {
2024
+ overlay: classNames?.overlay,
2025
+ center: "items-center! p-6!",
2026
+ container: require_primitives.cn("rounded-agg-xl! md:rounded-agg-xl!", classNames?.card)
2027
+ },
2028
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2029
+ className: require_primitives.cn("agg-paper-onboarding", "flex w-full flex-col gap-5 p-6"),
2030
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2031
+ className: "flex w-full items-start justify-center gap-5",
2032
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2033
+ className: require_primitives.cn("flex size-11 shrink-0 items-center justify-center overflow-hidden", "rounded-agg-lg bg-agg-primary/10 text-agg-primary", classNames?.icon),
2034
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Icon, {
2035
+ name: step.icon,
2036
+ className: "!h-6 !w-6",
2037
+ "aria-hidden": "true"
2038
+ })
2039
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2040
+ className: "flex min-w-0 flex-1 flex-col gap-2 break-words",
2041
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2042
+ className: "flex flex-col gap-1",
2043
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2044
+ className: require_primitives.cn("text-agg-2xs leading-agg-14 font-agg-bold uppercase", "text-agg-muted-foreground", classNames?.eyebrow),
2045
+ children: copy.stepEyebrow({
2046
+ current: stepIndex + 1,
2047
+ total
2048
+ })
2049
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2050
+ className: require_primitives.cn("text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", classNames?.title),
2051
+ children: step.title
2052
+ })]
2053
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2054
+ className: require_primitives.cn("text-agg-sm leading-agg-5 text-agg-foreground", classNames?.body),
2055
+ children: step.body
2056
+ })]
2057
+ })]
2058
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2059
+ className: require_primitives.cn("flex w-full items-center justify-between", classNames?.footer),
2060
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2061
+ className: require_primitives.cn("flex items-center gap-1", classNames?.dots),
2062
+ "aria-hidden": "true",
2063
+ children: steps.map((dotStep, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: require_primitives.cn("rounded-full transition-all", index === stepIndex ? "h-1 w-4 bg-agg-primary" : "size-1 bg-agg-separator") }, dotStep.key))
2064
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2065
+ className: "flex items-start gap-3",
2066
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
2067
+ variant: "secondary",
2068
+ size: "small",
2069
+ onClick: isFirst ? onDismiss : handleBack,
2070
+ className: "w-20 rounded-full",
2071
+ children: isFirst ? copy.skip : copy.back
2072
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
2073
+ variant: "primary",
2074
+ size: "small",
2075
+ onClick: handleNext,
2076
+ className: "w-[120px] rounded-full",
2077
+ children: isLast ? copy.done : copy.next
2078
+ })]
2079
+ })]
2080
+ })]
2081
+ })
2082
+ })
2083
+ });
2084
+ };
2085
+ PaperOnboardingModal.displayName = "PaperOnboardingModal";
2086
+ //#endregion
2087
+ //#region src/paper-trading/paper-trading-onboarding.tsx
2088
+ const FALLBACK_STARTING_BALANCE = 1e4;
2089
+ /**
2090
+ * Drop-in paper-trading intro. Renders nothing in a live app, and nothing for
2091
+ * a user who has already seen it — mount it once, high in the tree, and forget
2092
+ * about it.
2093
+ *
2094
+ * Pairs `usePaperOnboarding` (when to show) with `PaperOnboardingModal` (what
2095
+ * to show). Use the modal directly if you need to drive visibility yourself.
2096
+ */
2097
+ const PaperTradingOnboarding = ({ classNames }) => {
2098
+ const { isOpen, dismiss } = (0, _agg_build_hooks.usePaperOnboarding)();
2099
+ const { paperStartingBalance } = (0, _agg_build_hooks.useAppConfig)();
2100
+ if (!isOpen) return null;
2101
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaperOnboardingModal, {
2102
+ open: true,
2103
+ onDismiss: dismiss,
2104
+ startingBalanceLabel: require_primitives.formatUsd(paperStartingBalance ?? FALLBACK_STARTING_BALANCE, { maximumFractionDigits: 0 }),
2105
+ classNames
2106
+ });
2107
+ };
2108
+ PaperTradingOnboarding.displayName = "PaperTradingOnboarding";
2109
+ //#endregion
2110
+ //#region src/profile/profile-modal.constants.ts
2111
+ const PROFILE_TAB_KEYS = {
2112
+ PROFILE_ACCOUNTS: "profile-accounts",
2113
+ TRADING_ACCESS: "trading-access"
2114
+ };
2115
+ const getProfileTabItems = () => [{
2116
+ value: PROFILE_TAB_KEYS.PROFILE_ACCOUNTS,
2117
+ label: "Profile & accounts",
2118
+ icon: "profile-about-tab"
2119
+ }, {
2120
+ value: PROFILE_TAB_KEYS.TRADING_ACCESS,
2121
+ label: "Trading access",
2122
+ icon: "shield-trust"
2123
+ }];
2124
+ //#endregion
2125
+ //#region src/profile/tabs/about-tab.tsx
2126
+ const AboutTab = ({ avatarPreview, onDeleteProfile: _onDeleteProfile, draftUsername, onDraftUsernameChange, onDraftAvatarChange, draftAvatarPreview, avatarError: _avatarError }) => {
2127
+ const labels = (0, _agg_build_hooks.useLabels)();
2128
+ const fileInputRef = (0, react.useRef)(null);
2129
+ const handleAvatarClick = (0, react.useCallback)(() => {
2130
+ fileInputRef.current?.click();
2131
+ }, []);
2132
+ const handleFileChange = (0, react.useCallback)((e) => {
2133
+ const file = e.target.files?.[0];
2134
+ if (!file) return;
2135
+ const reader = new FileReader();
2136
+ reader.onload = (event) => {
2137
+ onDraftAvatarChange(file, event.target?.result);
2138
+ };
2139
+ reader.readAsDataURL(file);
2140
+ }, [onDraftAvatarChange]);
2141
+ const resolvedPreview = draftAvatarPreview ?? avatarPreview;
2142
+ const hasAvatarPreview = Boolean(resolvedPreview);
2143
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2144
+ className: "agg-profile-about flex flex-col gap-8",
2145
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2146
+ className: "agg-profile-avatar-section flex w-full items-center gap-6",
2147
+ children: [
2148
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2149
+ type: "button",
2150
+ onClick: handleAvatarClick,
2151
+ className: require_primitives.cn("agg-profile-avatar-trigger", "group relative flex items-center justify-center self-start", "h-[80px] w-[80px]", "rounded-agg-full", "bg-agg-secondary-hover", !hasAvatarPreview && "hover:bg-agg-tertiary", "transition-colors cursor-pointer", "overflow-hidden"),
2152
+ "aria-label": labels.onboarding.profileSetup.uploadProfilePictureAria,
2153
+ children: [!hasAvatarPreview ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
2154
+ "aria-hidden": true,
2155
+ viewBox: "0 0 80 80",
2156
+ className: "pointer-events-none absolute inset-0 h-full w-full text-agg-separator group-hover:text-agg-muted-foreground",
2157
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
2158
+ cx: "40",
2159
+ cy: "40",
2160
+ r: "39.5",
2161
+ fill: "none",
2162
+ stroke: "currentColor",
2163
+ strokeWidth: "1",
2164
+ strokeDasharray: "8 8"
2165
+ })
2166
+ }) : null, resolvedPreview ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.RemoteImage, {
2167
+ src: resolvedPreview,
2168
+ alt: labels.onboarding.profileSetup.profilePreviewAlt,
2169
+ className: "h-full w-full object-cover"
2170
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Icon, {
2171
+ name: "profile",
2172
+ className: "h-7 w-7 text-agg-muted-foreground"
2173
+ })]
2174
+ }),
2175
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
2176
+ ref: fileInputRef,
2177
+ type: "file",
2178
+ accept: "image/*",
2179
+ onChange: handleFileChange,
2180
+ className: "hidden",
2181
+ "aria-hidden": "true"
2182
+ }),
2183
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2184
+ className: "agg-form-section flex min-w-0 flex-1 flex-col gap-2",
2185
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
2186
+ htmlFor: "profile-username",
2187
+ className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground",
2188
+ children: "Username"
2189
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
2190
+ id: "profile-username",
2191
+ type: "text",
2192
+ placeholder: "e.g. CryptoJohn",
2193
+ value: draftUsername,
2194
+ onChange: (e) => onDraftUsernameChange(e.target.value),
2195
+ className: require_primitives.cn("h-10 w-full px-3 py-2.5", "rounded-agg-sm", "border border-agg-separator", "bg-agg-secondary text-agg-foreground", "placeholder:text-agg-muted-foreground", "outline-none", "focus:border-agg-primary focus:ring-1 focus:ring-agg-primary", "transition-colors", "text-agg-sm sm:text-agg-base")
2196
+ })]
2197
+ })
2198
+ ]
2199
+ })
2200
+ });
2201
+ };
2202
+ AboutTab.displayName = "AboutTab";
2203
+ //#endregion
2204
+ //#region src/profile/tabs/accounts-wallets-tab.tsx
2205
+ const SectionTitle$1 = ({ children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
2206
+ className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground",
2207
+ children
2208
+ });
2209
+ const AccountRow = ({ children, className }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2210
+ className: require_primitives.cn("flex h-12 items-center justify-between", "rounded-agg-lg border border-agg-separator bg-agg-secondary", "px-5", className),
2211
+ children
2212
+ });
2213
+ const AccountIdentity = ({ icon, label, iconClassName }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2214
+ className: "flex min-w-0 items-center gap-3",
2215
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2216
+ className: require_primitives.cn("flex h-5 w-5 shrink-0 items-center justify-center", iconClassName),
2217
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Icon, {
2218
+ name: icon,
2219
+ size: "small",
2220
+ color: "currentColor"
2221
+ })
2222
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2223
+ className: "truncate text-agg-base font-agg-normal leading-6 text-agg-foreground",
2224
+ children: label
2225
+ })]
2226
+ });
2227
+ const ConnectTextButton = ({ onClick }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2228
+ type: "button",
2229
+ onClick,
2230
+ className: "shrink-0 cursor-pointer text-agg-sm font-agg-bold leading-agg-5 text-agg-primary whitespace-nowrap",
2231
+ children: "Connect"
2232
+ });
2233
+ const DisconnectTextButton = ({ onClick }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2234
+ type: "button",
2235
+ onClick,
2236
+ className: "shrink-0 cursor-pointer text-agg-sm font-agg-bold leading-agg-5 text-agg-muted-foreground whitespace-nowrap",
2237
+ children: "Disconnect"
2238
+ });
2239
+ const VerifiedBadge = () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Icon, {
2240
+ name: "check-badge",
2241
+ size: "small",
2242
+ color: "var(--agg-color-primary, #536dfe)"
2243
+ });
2244
+ const getWalletIconName = (wallet) => {
2245
+ const chain = wallet.chain.toLowerCase();
2246
+ if (chain === "solana" || chain === "svm") return "solana";
2247
+ return "ethereum";
2248
+ };
2249
+ const ConnectedAccountRow = ({ icon, label, connectedLabel, connected, iconClassName, onConnect, onDisconnect }) => {
2250
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(AccountRow, {
2251
+ className: "agg-social-account-row gap-4",
2252
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2253
+ className: "flex min-w-0 items-center gap-3",
2254
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AccountIdentity, {
2255
+ icon,
2256
+ label: connected ? connectedLabel ?? label : label,
2257
+ iconClassName
2258
+ }), connected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VerifiedBadge, {}) : null]
2259
+ }), connected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DisconnectTextButton, { onClick: onDisconnect }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ConnectTextButton, { onClick: onConnect })]
2260
+ });
2261
+ };
2262
+ const AccountsWalletsTab = ({ socialAccounts, email, wallets = [], onConnectTwitter, onDisconnectTwitter, onConnectGoogle, onDisconnectGoogle, onConnectApple, onDisconnectApple, onConnectEmail }) => {
2263
+ const twitter = socialAccounts?.twitter;
2264
+ const google = socialAccounts?.google;
2265
+ const apple = socialAccounts?.apple;
2266
+ const hasEmail = Boolean(email);
2267
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2268
+ className: "agg-accounts-wallets-tab flex flex-col gap-6",
2269
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2270
+ className: "agg-social-accounts-section flex flex-col gap-3",
2271
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SectionTitle$1, { children: "Connected accounts" }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2272
+ className: "agg-social-accounts-list flex flex-col gap-4",
2273
+ children: [
2274
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ConnectedAccountRow, {
2275
+ icon: "google",
2276
+ iconClassName: "text-agg-foreground",
2277
+ label: "Google",
2278
+ connected: google?.connected,
2279
+ connectedLabel: google?.handle,
2280
+ onConnect: onConnectGoogle,
2281
+ onDisconnect: onDisconnectGoogle
2282
+ }),
2283
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ConnectedAccountRow, {
2284
+ icon: "apple",
2285
+ iconClassName: "text-agg-foreground",
2286
+ label: "Apple",
2287
+ connected: apple?.connected,
2288
+ connectedLabel: apple?.handle,
2289
+ onConnect: onConnectApple,
2290
+ onDisconnect: onDisconnectApple
2291
+ }),
2292
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ConnectedAccountRow, {
2293
+ icon: "twitter",
2294
+ iconClassName: "text-agg-foreground",
2295
+ label: "X (Twitter)",
2296
+ connected: twitter?.connected,
2297
+ connectedLabel: twitter?.handle,
2298
+ onConnect: onConnectTwitter,
2299
+ onDisconnect: onDisconnectTwitter
2300
+ }),
2301
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ConnectedAccountRow, {
2302
+ icon: "email",
2303
+ iconClassName: "text-agg-foreground",
2304
+ label: "Email address",
2305
+ connected: hasEmail,
2306
+ connectedLabel: email ?? void 0,
2307
+ onConnect: onConnectEmail
2308
+ })
2309
+ ]
2310
+ })]
2311
+ }), wallets.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2312
+ className: "agg-wallets-section flex flex-col gap-3",
2313
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SectionTitle$1, { children: "Wallets" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2314
+ className: "flex flex-col gap-2",
2315
+ children: wallets.map((wallet) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AccountRow, {
2316
+ className: "gap-4",
2317
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2318
+ className: "flex min-w-0 items-center gap-3",
2319
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AccountIdentity, {
2320
+ icon: getWalletIconName(wallet),
2321
+ iconClassName: "text-agg-foreground",
2322
+ label: wallet.displayAddress ?? wallet.address
2323
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VerifiedBadge, {})]
2324
+ })
2325
+ }, `${wallet.chain}:${wallet.address}`))
2326
+ })]
2327
+ }) : null]
2328
+ });
2329
+ };
2330
+ AccountsWalletsTab.displayName = "AccountsWalletsTab";
2331
+ //#endregion
2332
+ //#region src/profile/tabs/trading-access-tab.tsx
2333
+ const TRADING_ACCESS_VENUE_ITEMS = [
2334
+ "kalshi",
2335
+ "betdex",
2336
+ "tiprun",
2337
+ "polymarket",
2338
+ "opinion",
2339
+ "probable",
2340
+ "limitless",
2341
+ "predict",
2342
+ "myriad",
2343
+ "hyperliquid",
2344
+ "novig",
2345
+ "prophetx",
2346
+ "pred"
2347
+ ].map((id) => ({ id }));
2348
+ const SectionTitle = ({ children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
2349
+ className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground",
2350
+ children
2351
+ });
2352
+ const AccessRow = ({ children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2353
+ className: require_primitives.cn("flex h-12 items-center justify-between gap-4", "rounded-agg-lg border border-agg-separator bg-agg-secondary", "px-5"),
2354
+ children
2355
+ });
2356
+ const AvailableStatus = () => {
2357
+ const labels = (0, _agg_build_hooks.useLabels)();
2358
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2359
+ className: "flex items-center gap-2",
2360
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Icon, {
2361
+ name: "check-badge",
2362
+ size: "small",
2363
+ className: "text-agg-primary"
2364
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2365
+ className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground whitespace-nowrap",
2366
+ children: labels.trading.tradingAccessAvailable
2367
+ })]
2368
+ });
2369
+ };
2370
+ const GeoblockedStatus = () => {
2371
+ const labels = (0, _agg_build_hooks.useLabels)();
2372
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2373
+ className: "flex items-center gap-2 text-agg-muted-foreground",
2374
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Icon, {
2375
+ name: "warning-filled",
2376
+ size: "small",
2377
+ color: "currentColor"
2378
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2379
+ className: "text-agg-sm font-agg-normal leading-agg-5 whitespace-nowrap",
2380
+ children: labels.trading.venueUnavailableInRegion
2381
+ })]
2382
+ });
2383
+ };
2384
+ const TradingAccessTab = ({ venueAccounts, onConnectKalshi, onDisconnectKalshi, onConfigureBetdex }) => {
2385
+ const labels = (0, _agg_build_hooks.useLabels)();
2386
+ const { disabledVenues, isLoading: isAppConfigLoading } = (0, _agg_build_hooks.useAppConfig)();
2387
+ const { isLocationBlocked } = (0, _agg_build_hooks.useGeoBlock)();
2388
+ const hasBetdexAccount = venueAccounts?.some((account) => account.venue === "betdex") ?? false;
2389
+ const visibleVenues = (0, react.useMemo)(() => {
2390
+ const visible = (0, _agg_build_hooks.getVisibleVenuesByConfig)(TRADING_ACCESS_VENUE_ITEMS, disabledVenues);
2391
+ return TRADING_ACCESS_VENUE_ITEMS.filter((item) => visible.includes(item) || item.id === "betdex" && hasBetdexAccount);
2392
+ }, [disabledVenues, hasBetdexAccount]);
2393
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2394
+ className: "agg-trading-access-section flex flex-col gap-4",
2395
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SectionTitle, { children: labels.trading.tradingAccessVenues }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2396
+ className: "flex flex-col gap-3",
2397
+ children: visibleVenues.map(({ id: venue }) => {
2398
+ const venueAccount = venueAccounts?.find((account) => account.venue === venue);
2399
+ const isKalshi = venue === "kalshi";
2400
+ const isBetdex = venue === "betdex";
2401
+ const canManageBetdex = isBetdex && hasBetdexAccount && !isAppConfigLoading;
2402
+ const isConnected = venueAccount?.status === "active";
2403
+ const availabilityState = (0, _agg_build_hooks.getVenueAvailabilityState)({
2404
+ venueId: venue,
2405
+ disabledVenues,
2406
+ isConfigLoading: (isKalshi || isBetdex) && isAppConfigLoading,
2407
+ isLocationBlocked
2408
+ });
2409
+ const displayName = require_primitives.venueLogoLabels[venue] ?? venue;
2410
+ if (availabilityState === "hidden" && !canManageBetdex) return null;
2411
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(AccessRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2412
+ className: "flex min-w-0 items-center gap-3",
2413
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.VenueLogo, {
2414
+ venue,
2415
+ size: "small"
2416
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2417
+ className: "truncate text-agg-base font-agg-normal leading-6 text-agg-foreground",
2418
+ children: displayName
2419
+ })]
2420
+ }), isBetdex && (availabilityState === "available" || canManageBetdex) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2421
+ type: "button",
2422
+ onClick: onConfigureBetdex,
2423
+ disabled: !onConfigureBetdex,
2424
+ "aria-label": labels.trading.manageBetdexAccount,
2425
+ className: "min-h-11 shrink-0 cursor-pointer text-agg-sm font-agg-bold leading-agg-5 text-agg-primary whitespace-nowrap focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary disabled:cursor-not-allowed disabled:opacity-60",
2426
+ children: labels.trading.configureBetdexAccount
2427
+ }) : availabilityState === "geoblocked" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GeoblockedStatus, {}) : isKalshi && !isConnected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2428
+ type: "button",
2429
+ onClick: onConnectKalshi,
2430
+ disabled: !onConnectKalshi,
2431
+ className: "shrink-0 cursor-pointer text-agg-sm font-agg-bold leading-agg-5 text-agg-primary whitespace-nowrap focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary disabled:cursor-not-allowed disabled:opacity-60",
2432
+ children: labels.trading.tradingAccessAddKalshiAccount
2433
+ }) : isKalshi ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2434
+ className: "flex items-center gap-4",
2435
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AvailableStatus, {}), onDisconnectKalshi ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2436
+ type: "button",
2437
+ onClick: onDisconnectKalshi,
2438
+ className: "min-h-11 cursor-pointer text-agg-sm font-agg-bold leading-agg-5 text-agg-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
2439
+ children: labels.auth.disconnect
2440
+ }) : null]
2441
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AvailableStatus, {})] }, venue);
2442
+ })
2443
+ })]
2444
+ });
2445
+ };
2446
+ TradingAccessTab.displayName = "TradingAccessTab";
2447
+ //#endregion
2448
+ //#region src/profile/index.tsx
2449
+ const ProfileModal = ({ open, onOpenChange, username, avatarPreview, onSave, onDeleteProfile, socialAccounts, wallets, email, onConnectTwitter, onDisconnectTwitter, onConnectGoogle, onDisconnectGoogle, onConnectApple, onDisconnectApple, onDisconnectWallet, onConnectEmail, onKycError, onConnectKalshi, onDisconnectExchange }) => {
2450
+ const client = (0, _agg_build_hooks.useAggClient)();
2451
+ const { user } = (0, _agg_build_hooks.useAggAuthState)();
2452
+ const toastCtx = require_primitives.useOptionalToast();
2453
+ const [activeTab, setActiveTab] = (0, react.useState)(PROFILE_TAB_KEYS.PROFILE_ACCOUNTS);
2454
+ const profileTabItems = (0, react.useMemo)(() => getProfileTabItems(), []);
2455
+ const resolvedInitialUsername = username ?? user?.username ?? "";
2456
+ const [draftUsername, setDraftUsername] = (0, react.useState)(resolvedInitialUsername);
2457
+ const [draftAvatarFile, setDraftAvatarFile] = (0, react.useState)();
2458
+ const [draftAvatarPreview, setDraftAvatarPreview] = (0, react.useState)();
2459
+ const [isSaving, setIsSaving] = (0, react.useState)(false);
2460
+ const [avatarTypeError, setAvatarTypeError] = (0, react.useState)(null);
2461
+ const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0, react.useState)(false);
2462
+ const [betdexAccountUserId, setBetdexAccountUserId] = (0, react.useState)(null);
2463
+ const isBetdexAccountModalOpen = !!user?.id && betdexAccountUserId === user.id;
2464
+ const { data: kalshiStatus, refetch: refetchKalshiStatus } = (0, _agg_build_hooks.useVenueKeyStatus)(_agg_build_sdk.Venue.kalshi, open);
2465
+ (0, react.useEffect)(() => {
2466
+ setDraftUsername(username ?? user?.username ?? "");
2467
+ }, [username, user?.username]);
2468
+ (0, react.useEffect)(() => {
2469
+ if (open) return;
2470
+ setIsConnectKalshiModalOpen(false);
2471
+ setBetdexAccountUserId(null);
2472
+ }, [open]);
2473
+ (0, react.useEffect)(() => setBetdexAccountUserId(null), [user?.id]);
2474
+ const handleOpenChange = (0, react.useCallback)((isOpen) => {
2475
+ if (!isOpen) {
2476
+ setActiveTab(PROFILE_TAB_KEYS.PROFILE_ACCOUNTS);
2477
+ setIsSaving(false);
2478
+ setDraftUsername(username ?? user?.username ?? "");
2479
+ setDraftAvatarFile(void 0);
2480
+ setDraftAvatarPreview(void 0);
2481
+ setAvatarTypeError(null);
2482
+ }
2483
+ onOpenChange(isOpen);
2484
+ }, [
2485
+ onOpenChange,
2486
+ username,
2487
+ user?.username,
2488
+ setActiveTab,
2489
+ setIsSaving,
2490
+ setDraftUsername,
2491
+ setDraftAvatarFile,
2492
+ setDraftAvatarPreview
2493
+ ]);
2494
+ const handleDraftAvatarChange = (0, react.useCallback)((file, preview) => {
2495
+ if (file && ![
2496
+ "image/jpeg",
2497
+ "image/png",
2498
+ "image/gif",
2499
+ "image/webp"
2500
+ ].includes(file.type)) {
2501
+ setAvatarTypeError("Unsupported format. Please use JPEG, PNG, GIF, or WebP.");
2502
+ return;
2503
+ }
2504
+ setAvatarTypeError(null);
2505
+ setDraftAvatarFile(file);
2506
+ setDraftAvatarPreview(preview);
2507
+ }, []);
2508
+ const originalUsername = username ?? user?.username ?? "";
2509
+ const hasChanges = draftUsername !== originalUsername || draftAvatarFile !== void 0;
2510
+ const handleSave = (0, react.useCallback)(async () => {
2511
+ setIsSaving(true);
2512
+ try {
2513
+ const normalizedUsername = draftUsername.trim();
2514
+ if (normalizedUsername !== originalUsername) await client.updateUser({ username: normalizedUsername || void 0 });
2515
+ let avatarCdnUrl;
2516
+ if (draftAvatarFile) {
2517
+ const { uploadUrl, cdnUrl } = await client.createAvatarUploadUrl(draftAvatarFile.type);
2518
+ const uploadResponse = await fetch(uploadUrl, {
2519
+ method: "PUT",
2520
+ headers: { "Content-Type": draftAvatarFile.type },
2521
+ body: draftAvatarFile
2522
+ });
2523
+ if (!uploadResponse.ok) throw new Error(`Avatar upload failed (${uploadResponse.status})`);
2524
+ avatarCdnUrl = cdnUrl || void 0;
2525
+ await new Promise((resolve) => setTimeout(resolve, 5e3));
2526
+ await client.updateUser({ confirmAvatar: true });
2527
+ }
2528
+ const resolvedAvatarPreview = (await client.getCurrentUser())?.avatarUrl ?? avatarCdnUrl ?? draftAvatarPreview;
2529
+ onSave({
2530
+ username: normalizedUsername || void 0,
2531
+ avatarFile: draftAvatarFile,
2532
+ avatarPreview: resolvedAvatarPreview
2533
+ });
2534
+ onOpenChange(false);
2535
+ } catch (err) {
2536
+ const apiError = err;
2537
+ const fieldErrors = (apiError.errors ?? []).map((e) => e?.message).filter((m) => typeof m === "string" && m.length > 0);
2538
+ const toastMessage = fieldErrors.length > 0 ? fieldErrors.join("\n") : apiError.message || "Failed to save profile. Please try again.";
2539
+ if (toastCtx) toastCtx.toast(toastMessage, {
2540
+ tone: "error",
2541
+ title: "Could not save profile"
2542
+ });
2543
+ else if (typeof console !== "undefined") console.error("[ProfileModal] save failed:", toastMessage);
2544
+ } finally {
2545
+ setIsSaving(false);
2546
+ }
2547
+ }, [
2548
+ client,
2549
+ draftAvatarFile,
2550
+ draftAvatarPreview,
2551
+ draftUsername,
2552
+ onOpenChange,
2553
+ onSave,
2554
+ originalUsername,
2555
+ toastCtx
2556
+ ]);
2557
+ const handleCancel = (0, react.useCallback)(() => {
2558
+ handleOpenChange(false);
2559
+ }, [handleOpenChange]);
2560
+ const handleVerifyKalshi = (0, react.useCallback)(async (credentials) => {
2561
+ if (onConnectKalshi) await onConnectKalshi(credentials);
2562
+ else await client.upsertVenueKey({
2563
+ venue: _agg_build_sdk.Venue.kalshi,
2564
+ credentials: {
2565
+ keyId: credentials.apiKeyId,
2566
+ privateKey: credentials.privateKey
2567
+ }
2568
+ });
2569
+ await refetchKalshiStatus();
2570
+ await client.getCurrentUser();
2571
+ }, [
2572
+ client,
2573
+ onConnectKalshi,
2574
+ refetchKalshiStatus
2575
+ ]);
2576
+ const handleDisconnectKalshi = (0, react.useCallback)(async () => {
2577
+ await client.deleteVenueKey(_agg_build_sdk.Venue.kalshi);
2578
+ await refetchKalshiStatus();
2579
+ onDisconnectExchange?.(_agg_build_sdk.Venue.kalshi);
2580
+ }, [
2581
+ client,
2582
+ onDisconnectExchange,
2583
+ refetchKalshiStatus
2584
+ ]);
2585
+ const resolvedVenueAccounts = (0, react.useMemo)(() => {
2586
+ const nonKalshiAccounts = user?.venueAccounts?.filter((account) => account.venue !== "kalshi");
2587
+ if (!kalshiStatus) return user?.venueAccounts;
2588
+ if (!kalshiStatus?.connected) return nonKalshiAccounts;
2589
+ return [...nonKalshiAccounts ?? [], {
2590
+ id: "kalshi-venue-key",
2591
+ venue: _agg_build_sdk.Venue.kalshi,
2592
+ status: "active",
2593
+ kycStatus: kalshiStatus.kycStatus
2594
+ }];
2595
+ }, [kalshiStatus, user?.venueAccounts]);
2596
+ const isAccountConnected = (providers) => {
2597
+ const normalizedProviders = providers.map((provider) => provider.toLowerCase());
2598
+ const fromAccounts = user?.accounts?.some((account) => normalizedProviders.includes(String(account.provider).toLowerCase())) ?? false;
2599
+ const fromLegacy = (user?.identities)?.some((identity) => normalizedProviders.includes(String(identity.provider ?? "").toLowerCase())) ?? false;
2600
+ return fromAccounts || fromLegacy;
2601
+ };
2602
+ const resolvedSocialAccounts = socialAccounts ?? {
2603
+ twitter: { connected: isAccountConnected(["twitter"]) },
2604
+ google: { connected: isAccountConnected(["google"]) },
2605
+ apple: { connected: isAccountConnected(["apple"]) }
2606
+ };
2607
+ const resolvedEmail = email ?? user?.accounts?.find((account) => String(account.provider).toLowerCase() === "email")?.providerAccountId ?? user?.identities?.find((identity) => String(identity.provider ?? "").toLowerCase() === "email")?.providerAccountId ?? null;
2608
+ const resolveRedirectUrl = () => {
2609
+ if (typeof window === "undefined") return "http://localhost";
2610
+ return `${window.location.origin}${window.location.pathname}${window.location.search}`;
2611
+ };
2612
+ const navigateTopWindow = (url) => {
2613
+ if (typeof window === "undefined") return;
2614
+ (window.top ?? window).location.assign(url);
2615
+ };
2616
+ const surfaceError = (0, react.useCallback)((err, title) => {
2617
+ const message = err?.message || "Something went wrong. Please try again.";
2618
+ if (toastCtx) toastCtx.toast(message, {
2619
+ tone: "error",
2620
+ title
2621
+ });
2622
+ else console.error(`[ProfileModal] ${title}:`, message);
2623
+ }, [toastCtx]);
2624
+ const handleConnectTwitter = (0, react.useCallback)(async () => {
2625
+ try {
2626
+ const result = await client.linkAccount({
2627
+ provider: "twitter",
2628
+ redirectUrl: resolveRedirectUrl()
2629
+ });
2630
+ onConnectTwitter?.();
2631
+ if (result.type === "redirect") navigateTopWindow(result.url);
2632
+ } catch (err) {
2633
+ surfaceError(err, "Could not connect X (Twitter)");
2634
+ }
2635
+ }, [
2636
+ client,
2637
+ onConnectTwitter,
2638
+ surfaceError
2639
+ ]);
2640
+ const handleConnectGoogle = (0, react.useCallback)(async () => {
2641
+ try {
2642
+ const result = await client.linkAccount({
2643
+ provider: "google",
2644
+ redirectUrl: resolveRedirectUrl()
2645
+ });
2646
+ onConnectGoogle?.();
2647
+ if (result.type === "redirect") navigateTopWindow(result.url);
2648
+ } catch (err) {
2649
+ surfaceError(err, "Could not connect Google");
2650
+ }
2651
+ }, [
2652
+ client,
2653
+ onConnectGoogle,
2654
+ surfaceError
2655
+ ]);
2656
+ const handleConnectApple = (0, react.useCallback)(async () => {
2657
+ try {
2658
+ const result = await client.linkAccount({
2659
+ provider: "apple",
2660
+ redirectUrl: resolveRedirectUrl()
2661
+ });
2662
+ onConnectApple?.();
2663
+ if (result.type === "redirect") navigateTopWindow(result.url);
2664
+ } catch (err) {
2665
+ surfaceError(err, "Could not connect Apple");
2666
+ }
2667
+ }, [
2668
+ client,
2669
+ onConnectApple,
2670
+ surfaceError
2671
+ ]);
2672
+ const handleDisconnectTwitter = (0, react.useCallback)(async () => {
2673
+ try {
2674
+ await client.disconnectAccount("twitter");
2675
+ await client.getCurrentUser();
2676
+ onDisconnectTwitter?.();
2677
+ } catch (err) {
2678
+ surfaceError(err, "Could not disconnect X (Twitter)");
2679
+ }
2680
+ }, [
2681
+ client,
2682
+ onDisconnectTwitter,
2683
+ surfaceError
2684
+ ]);
2685
+ const handleDisconnectGoogle = (0, react.useCallback)(async () => {
2686
+ try {
2687
+ await client.disconnectAccount("google");
2688
+ await client.getCurrentUser();
2689
+ onDisconnectGoogle?.();
2690
+ } catch (err) {
2691
+ surfaceError(err, "Could not disconnect Google");
2692
+ }
2693
+ }, [
2694
+ client,
2695
+ onDisconnectGoogle,
2696
+ surfaceError
2697
+ ]);
2698
+ const handleDisconnectApple = (0, react.useCallback)(async () => {
2699
+ try {
2700
+ await client.disconnectAccount("apple");
2701
+ await client.getCurrentUser();
2702
+ onDisconnectApple?.();
2703
+ } catch (err) {
2704
+ surfaceError(err, "Could not disconnect Apple");
2705
+ }
2706
+ }, [
2707
+ client,
2708
+ onDisconnectApple,
2709
+ surfaceError
2710
+ ]);
2711
+ const handleConnectEmail = (0, react.useCallback)(async () => {
2712
+ const typedEmail = typeof window !== "undefined" ? window.prompt("Enter your email to receive a magic link")?.trim() : void 0;
2713
+ if (!typedEmail) return;
2714
+ try {
2715
+ await client.linkAccount({
2716
+ provider: "email",
2717
+ email: typedEmail,
2718
+ redirectUrl: resolveRedirectUrl()
2719
+ });
2720
+ onConnectEmail?.();
2721
+ toastCtx?.toast(`We sent a link to ${typedEmail} to connect your email.`, {
2722
+ tone: "success",
2723
+ title: "Check your inbox"
2724
+ });
2725
+ } catch (err) {
2726
+ surfaceError(err, "Could not connect email");
2727
+ }
2728
+ }, [
2729
+ client,
2730
+ onConnectEmail,
2731
+ surfaceError,
2732
+ toastCtx
2733
+ ]);
2734
+ const handleDisconnectWallet = (0, react.useCallback)(async (wallet) => {
2735
+ const normalizedChain = wallet.chain.toLowerCase();
2736
+ const provider = normalizedChain === "solana" || normalizedChain === "svm" ? "solana_wallet" : "wallet";
2737
+ try {
2738
+ await client.disconnectAccount(provider);
2739
+ await client.getCurrentUser();
2740
+ onDisconnectWallet?.(wallet);
2741
+ } catch (err) {
2742
+ surfaceError(err, "Could not disconnect wallet");
2743
+ }
2744
+ }, [
2745
+ client,
2746
+ onDisconnectWallet,
2747
+ surfaceError
2748
+ ]);
2749
+ const providerActionMap = (0, react.useMemo)(() => ({
2750
+ twitter: {
2751
+ connect: () => {
2752
+ handleConnectTwitter();
2753
+ },
2754
+ disconnect: () => {
2755
+ handleDisconnectTwitter();
2756
+ }
2757
+ },
2758
+ google: {
2759
+ connect: () => {
2760
+ handleConnectGoogle();
2761
+ },
2762
+ disconnect: () => {
2763
+ handleDisconnectGoogle();
2764
+ }
2765
+ },
2766
+ apple: {
2767
+ connect: () => {
2768
+ handleConnectApple();
2769
+ },
2770
+ disconnect: () => {
2771
+ handleDisconnectApple();
2772
+ }
2773
+ },
2774
+ email: { connect: () => {
2775
+ handleConnectEmail();
2776
+ } }
2777
+ }), [
2778
+ handleConnectApple,
2779
+ handleConnectEmail,
2780
+ handleConnectGoogle,
2781
+ handleConnectTwitter,
2782
+ handleDisconnectApple,
2783
+ handleDisconnectGoogle,
2784
+ handleDisconnectTwitter
2785
+ ]);
2786
+ const resolvedWallets = (0, react.useMemo)(() => {
2787
+ if (wallets) return wallets;
2788
+ return ((user?.accounts)?.filter((account) => {
2789
+ const provider = account.provider?.toLowerCase();
2790
+ return provider === "wallet" || provider === "solana_wallet";
2791
+ }) ?? []).filter((account) => Boolean(account.providerAccountId)).map((account) => {
2792
+ const chain = account.provider?.toLowerCase() === "solana_wallet" ? "solana" : "evm";
2793
+ const address = account.providerAccountId;
2794
+ return {
2795
+ chain,
2796
+ address,
2797
+ displayAddress: require_primitives.shortenAddress(address, { chain }) ?? address
2798
+ };
2799
+ });
2800
+ }, [user?.accounts, wallets]);
2801
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_primitives.Modal, {
2802
+ open: open && !isConnectKalshiModalOpen && !isBetdexAccountModalOpen,
2803
+ onOpenChange: handleOpenChange,
2804
+ children: [
2805
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_primitives.Modal.Container, {
2806
+ maxWidth: "800px",
2807
+ "aria-label": "Edit Profile",
2808
+ classNames: { container: require_primitives.cn("agg-profile-modal", "min-h-[37.5rem]") },
2809
+ children: [
2810
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Header, {
2811
+ title: "Edit Profile",
2812
+ classNames: { root: "agg-profile-modal-header" }
2813
+ }),
2814
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2815
+ className: "agg-profile-tabs sm:hidden w-full",
2816
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Tabs, {
2817
+ className: "w-full [&>div]:w-full",
2818
+ variant: "underline",
2819
+ classNames: { tabList: "w-full" },
2820
+ items: profileTabItems.map((tab) => ({
2821
+ value: tab.value,
2822
+ label: tab.label,
2823
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Icon, {
2824
+ name: tab.icon,
2825
+ size: "small"
2826
+ })
2827
+ })),
2828
+ value: activeTab,
2829
+ onChange: (val) => setActiveTab(val)
2830
+ })
2831
+ }),
2832
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Body, {
2833
+ classNames: { root: require_primitives.cn("agg-profile-modal-body", "overflow-x-visible") },
2834
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2835
+ className: "agg-profile-layout flex flex-col sm:flex-row sm:gap-10",
2836
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2837
+ className: "shrink-0",
2838
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
2839
+ className: require_primitives.cn("agg-profile-sidebar", "hidden sm:sticky sm:top-0 sm:self-start sm:flex sm:flex-col", "w-[240px]", "overflow-hidden rounded-agg-lg", "border border-agg-separator", "bg-agg-secondary", "py-3"),
2840
+ role: "tablist",
2841
+ "aria-label": "Profile sections",
2842
+ children: profileTabItems.map((tab) => {
2843
+ const isActive = activeTab === tab.value;
2844
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2845
+ type: "button",
2846
+ role: "tab",
2847
+ "aria-selected": isActive,
2848
+ onClick: () => setActiveTab(tab.value),
2849
+ className: require_primitives.cn("agg-profile-tab-trigger", "relative flex items-center gap-3", "h-[49px] px-6 py-4", "text-agg-sm leading-agg-5 font-agg-sans", "transition-colors cursor-pointer", isActive ? "font-agg-normal text-agg-foreground bg-agg-secondary-hover" : "font-agg-normal text-agg-foreground"),
2850
+ children: [
2851
+ isActive ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "absolute left-0 top-0 bottom-0 w-1 bg-agg-primary" }) : null,
2852
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Icon, {
2853
+ name: tab.icon,
2854
+ size: "small",
2855
+ color: "currentColor"
2856
+ }),
2857
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2858
+ className: "shrink-0 whitespace-nowrap",
2859
+ children: tab.label
2860
+ })
2861
+ ]
2862
+ }, tab.value);
2863
+ })
2864
+ })
2865
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2866
+ className: "agg-profile-content min-w-0 flex-1",
2867
+ children: [activeTab === PROFILE_TAB_KEYS.PROFILE_ACCOUNTS ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2868
+ className: "agg-profile-accounts-tab flex flex-col gap-8",
2869
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AboutTab, {
2870
+ username: username ?? user?.username,
2871
+ avatarPreview: user?.avatarUrl ?? avatarPreview,
2872
+ onDeleteProfile,
2873
+ draftUsername,
2874
+ onDraftUsernameChange: setDraftUsername,
2875
+ draftAvatarFile,
2876
+ onDraftAvatarChange: handleDraftAvatarChange,
2877
+ draftAvatarPreview,
2878
+ avatarError: avatarTypeError
2879
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AccountsWalletsTab, {
2880
+ socialAccounts: resolvedSocialAccounts,
2881
+ wallets: resolvedWallets,
2882
+ email: resolvedEmail,
2883
+ onConnectTwitter: providerActionMap.twitter.connect,
2884
+ onDisconnectTwitter: providerActionMap.twitter.disconnect,
2885
+ onConnectGoogle: providerActionMap.google.connect,
2886
+ onDisconnectGoogle: providerActionMap.google.disconnect,
2887
+ onConnectApple: providerActionMap.apple.connect,
2888
+ onDisconnectApple: providerActionMap.apple.disconnect,
2889
+ onDisconnectWallet: (wallet) => {
2890
+ handleDisconnectWallet(wallet);
2891
+ },
2892
+ onConnectEmail: providerActionMap.email.connect
2893
+ })]
2894
+ }) : null, activeTab === PROFILE_TAB_KEYS.TRADING_ACCESS ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TradingAccessTab, {
2895
+ venueAccounts: resolvedVenueAccounts,
2896
+ onConnectKalshi: () => setIsConnectKalshiModalOpen(true),
2897
+ onConfigureBetdex: user?.id ? () => setBetdexAccountUserId(user.id) : void 0,
2898
+ onDisconnectKalshi: handleDisconnectKalshi,
2899
+ onKycError
2900
+ }) : null]
2901
+ })]
2902
+ })
2903
+ }),
2904
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_primitives.Modal.Footer, {
2905
+ classNames: { root: "agg-profile-modal-footer" },
2906
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
2907
+ variant: "secondary",
2908
+ size: "large",
2909
+ onClick: handleCancel,
2910
+ className: "min-w-[120px]",
2911
+ children: "Cancel"
2912
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
2913
+ variant: "primary",
2914
+ size: "large",
2915
+ disabled: !hasChanges,
2916
+ isLoading: isSaving,
2917
+ onClick: handleSave,
2918
+ children: "Save changes"
2919
+ })]
2920
+ })
2921
+ ]
2922
+ }),
2923
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_manage_betdex_account_modal.ManageBetdexAccountModal, {
2924
+ userId: user?.id,
2925
+ open: open && isBetdexAccountModalOpen,
2926
+ onOpenChange: (isOpen) => setBetdexAccountUserId(isOpen ? user?.id ?? null : null)
2927
+ }, user?.id ?? "signed-out"),
2928
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_manage_betdex_account_modal.ConnectKalshiModal, {
2929
+ open: open && isConnectKalshiModalOpen,
2930
+ onOpenChange: setIsConnectKalshiModalOpen,
2931
+ onVerify: handleVerifyKalshi
2932
+ })
2933
+ ]
2934
+ });
2935
+ };
2936
+ ProfileModal.displayName = "ProfileModal";
2937
+ //#endregion
2938
+ //#region src/geo-block-modal/index.tsx
2939
+ const GeoBlockModal = ({ open, onOpenChange, onConfirm, classNames }) => {
2940
+ const labels = (0, _agg_build_hooks.useLabels)();
2941
+ const handleConfirm = (0, react.useCallback)(() => {
2942
+ onConfirm?.();
2943
+ onOpenChange(false);
2944
+ }, [onConfirm, onOpenChange]);
2945
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal, {
2946
+ open,
2947
+ onOpenChange,
2948
+ "aria-label": labels.trading.geoBlockModalAriaLabel,
2949
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_primitives.Modal.Container, {
2950
+ maxWidth: "480px",
2951
+ classNames: { container: require_primitives.cn("!rounded-agg-2xl", classNames?.container) },
2952
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Header, {
2953
+ title: "",
2954
+ hideBorder: true,
2955
+ classNames: {
2956
+ root: "min-h-0! h-12!",
2957
+ container: "p-0! sm:p-0!",
2958
+ close: "absolute top-8 right-8"
2959
+ }
2960
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Modal.Body, {
2961
+ classNames: { root: require_primitives.cn("!px-10 !pt-0 !pb-12", classNames?.body) },
2962
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2963
+ className: "flex flex-col items-center gap-8",
2964
+ children: [
2965
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Icon, {
2966
+ name: "internet-security",
2967
+ className: "h-[60px] w-[60px] text-agg-muted-foreground"
2968
+ }),
2969
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2970
+ className: "flex flex-col items-center gap-3 text-center",
2971
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
2972
+ className: "text-agg-2xl font-agg-bold leading-agg-8 text-agg-foreground",
2973
+ children: labels.trading.geoBlockModalTitle
2974
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2975
+ className: "text-agg-base font-agg-normal leading-agg-6 text-agg-foreground",
2976
+ children: labels.trading.geoBlockModalDescription
2977
+ })]
2978
+ }),
2979
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives.Button, {
2980
+ variant: "secondary",
2981
+ size: "large",
2982
+ className: "h-10 min-w-[140px] px-6",
2983
+ onClick: handleConfirm,
2984
+ children: labels.trading.geoBlockModalConfirm
2985
+ })
2986
+ ]
2987
+ })
2988
+ })]
2989
+ })
2990
+ });
2991
+ };
2992
+ GeoBlockModal.displayName = "GeoBlockModal";
2993
+ //#endregion
2994
+ Object.defineProperty(exports, "CARD_NETWORK_OPTIONS", {
2995
+ enumerable: true,
2996
+ get: function() {
2997
+ return CARD_NETWORK_OPTIONS;
2998
+ }
2999
+ });
3000
+ Object.defineProperty(exports, "ConnectAccountsStep", {
3001
+ enumerable: true,
3002
+ get: function() {
3003
+ return ConnectAccountsStep;
3004
+ }
3005
+ });
3006
+ Object.defineProperty(exports, "ConnectOnchainModal", {
3007
+ enumerable: true,
3008
+ get: function() {
3009
+ return ConnectOnchainModal;
3010
+ }
3011
+ });
3012
+ Object.defineProperty(exports, "DepositModal", {
3013
+ enumerable: true,
3014
+ get: function() {
3015
+ return DepositModal;
3016
+ }
3017
+ });
3018
+ Object.defineProperty(exports, "GeoBlockModal", {
3019
+ enumerable: true,
3020
+ get: function() {
3021
+ return GeoBlockModal;
3022
+ }
3023
+ });
3024
+ Object.defineProperty(exports, "HowItWorksStep", {
3025
+ enumerable: true,
3026
+ get: function() {
3027
+ return HowItWorksStep;
3028
+ }
3029
+ });
3030
+ Object.defineProperty(exports, "OnboardingModal", {
3031
+ enumerable: true,
3032
+ get: function() {
3033
+ return OnboardingModal;
3034
+ }
3035
+ });
3036
+ Object.defineProperty(exports, "PaperOnboardingModal", {
3037
+ enumerable: true,
3038
+ get: function() {
3039
+ return PaperOnboardingModal;
3040
+ }
3041
+ });
3042
+ Object.defineProperty(exports, "PaperTradingBadge", {
3043
+ enumerable: true,
3044
+ get: function() {
3045
+ return PaperTradingBadge;
3046
+ }
3047
+ });
3048
+ Object.defineProperty(exports, "PaperTradingOnboarding", {
3049
+ enumerable: true,
3050
+ get: function() {
3051
+ return PaperTradingOnboarding;
3052
+ }
3053
+ });
3054
+ Object.defineProperty(exports, "ProfileModal", {
3055
+ enumerable: true,
3056
+ get: function() {
3057
+ return ProfileModal;
3058
+ }
3059
+ });
3060
+ Object.defineProperty(exports, "ProfileSetupStep", {
3061
+ enumerable: true,
3062
+ get: function() {
3063
+ return ProfileSetupStep;
3064
+ }
3065
+ });
3066
+ Object.defineProperty(exports, "clearPendingCardSession", {
3067
+ enumerable: true,
3068
+ get: function() {
3069
+ return clearPendingCardSession;
3070
+ }
3071
+ });
3072
+ Object.defineProperty(exports, "getPendingCardSession", {
3073
+ enumerable: true,
3074
+ get: function() {
3075
+ return getPendingCardSession;
3076
+ }
3077
+ });