@opexa/portal-components 0.0.303 → 0.0.305

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 (220) hide show
  1. package/dist/client/hooks/useGlobalStore.d.ts +8 -0
  2. package/dist/client/hooks/useGlobalStore.js +21 -0
  3. package/dist/components/DepositWithdrawal/DepositWithdrawal.lazy.js +26 -13
  4. package/dist/components/DepositWithdrawal/HasPendingBonuses.d.ts +5 -0
  5. package/dist/components/DepositWithdrawal/HasPendingBonuses.js +22 -0
  6. package/dist/components/DepositWithdrawal/Withdrawal/GCashWithdrawal/GCashWithdrawal.js +5 -0
  7. package/dist/components/DepositWithdrawal/Withdrawal/InstapayWithdrawal/InstapayWithdrawal.js +18 -41
  8. package/dist/components/DepositWithdrawal/Withdrawal/MayaAppWithdrawal/MayaAppWithdrawal.js +5 -0
  9. package/dist/components/DepositWithdrawal/Withdrawal/MayaWithdrawal/MayaWithdrawal.js +5 -0
  10. package/dist/components/DepositWithdrawal/Withdrawal/PisoPayWithdrawal/PisoPayWithdrawal.js +5 -0
  11. package/dist/components/DepositWithdrawal/Withdrawal/VentajaWithdrawal/VentajaWithdrawal.js +5 -0
  12. package/dist/components/Disclaimer/ResponsibleGaming.d.ts +10 -0
  13. package/dist/components/Disclaimer/ResponsibleGaming.js +13 -0
  14. package/dist/components/Disclaimer/TermsOfUse.d.ts +11 -0
  15. package/dist/components/Disclaimer/TermsOfUse.js +13 -0
  16. package/dist/components/FeatureFlag/FeatureFlag.d.ts +1 -0
  17. package/dist/components/FeatureFlag/FeatureFlag.js +29 -0
  18. package/dist/components/FeatureFlag/index.d.ts +1 -0
  19. package/dist/components/FeatureFlag/index.js +1 -0
  20. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +184 -184
  21. package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +184 -184
  22. package/dist/components/KYC/AutoOpen.d.ts +1 -0
  23. package/dist/components/KYC/AutoOpen.js +40 -0
  24. package/dist/components/KYC/CaptureIdDocument.d.ts +1 -0
  25. package/dist/components/KYC/CaptureIdDocument.js +219 -0
  26. package/dist/components/KYC/CaptureSelfie.d.ts +1 -0
  27. package/dist/components/KYC/CaptureSelfie.js +285 -0
  28. package/dist/components/KYC/DisplayImage.d.ts +5 -0
  29. package/dist/components/KYC/DisplayImage.js +8 -0
  30. package/dist/components/KYC/FileUpload.d.ts +10 -0
  31. package/dist/components/KYC/FileUpload.js +72 -0
  32. package/dist/components/KYC/NoCameraError.d.ts +7 -0
  33. package/dist/components/KYC/NoCameraError.js +6 -0
  34. package/dist/components/KYC/PersonOverlayDesktop.d.ts +7 -0
  35. package/dist/components/KYC/PersonOverlayDesktop.js +9 -0
  36. package/dist/components/KYC/backup/Header.d.ts +1 -0
  37. package/dist/components/KYC/backup/Header.js +8 -0
  38. package/dist/components/KYC/backup/Indicator.d.ts +1 -0
  39. package/dist/components/KYC/backup/Indicator.js +9 -0
  40. package/dist/components/KYC/backup/KYC.d.ts +1 -0
  41. package/dist/components/KYC/backup/KYC.js +14 -0
  42. package/dist/components/KYC/backup/KYC.lazy.d.ts +1 -0
  43. package/dist/components/KYC/backup/KYC.lazy.js +26 -0
  44. package/dist/components/KYC/backup/KYCContext.d.ts +6 -0
  45. package/dist/components/KYC/backup/KYCContext.js +2 -0
  46. package/dist/components/KYC/backup/Step1.d.ts +1 -0
  47. package/dist/components/KYC/backup/Step1.js +13 -0
  48. package/dist/components/KYC/backup/Step2.d.ts +1 -0
  49. package/dist/components/KYC/backup/Step2.js +13 -0
  50. package/dist/components/KYC/backup/Step3.d.ts +1 -0
  51. package/dist/components/KYC/backup/Step3.js +13 -0
  52. package/dist/components/KYC/backup/Step4.d.ts +1 -0
  53. package/dist/components/KYC/backup/Step4.js +7 -0
  54. package/dist/components/KYC/backup/useKYC.d.ts +10 -0
  55. package/dist/components/KYC/backup/useKYC.js +8 -0
  56. package/dist/components/KYC/loadModels.d.ts +1 -0
  57. package/dist/components/KYC/loadModels.js +9 -0
  58. package/dist/components/KYC/utils.d.ts +9 -0
  59. package/dist/components/KYC/utils.js +79 -0
  60. package/dist/components/Messages/Message.d.ts +1 -0
  61. package/dist/components/Messages/Message.js +35 -0
  62. package/dist/components/Messages/MessageContext.d.ts +6 -0
  63. package/dist/components/Messages/MessageContext.js +2 -0
  64. package/dist/components/Messages/MessagePopup.d.ts +1 -0
  65. package/dist/components/Messages/MessagePopup.js +20 -0
  66. package/dist/components/Messages/MessageTrigger.d.ts +8 -0
  67. package/dist/components/Messages/MessageTrigger.js +19 -0
  68. package/dist/components/Quests/CountdownTimer.d.ts +15 -0
  69. package/dist/components/Quests/CountdownTimer.js +33 -0
  70. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.d.ts +4 -0
  71. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.js +78 -0
  72. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.d.ts +8 -0
  73. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.js +9 -0
  74. package/dist/components/Quests/OnboardingQuest/OnboardingQuest.d.ts +4 -0
  75. package/dist/components/Quests/OnboardingQuest/OnboardingQuest.js +4 -0
  76. package/dist/components/Quests/WageringQuest/WageringQuest.d.ts +4 -0
  77. package/dist/components/Quests/WageringQuest/WageringQuest.js +20 -0
  78. package/dist/components/Quests/WageringQuest/WageringQuestModal.d.ts +9 -0
  79. package/dist/components/Quests/WageringQuest/WageringQuestModal.js +9 -0
  80. package/dist/components/SignUp/SignUp.lazy.d.ts +12 -0
  81. package/dist/components/SignUp/SignUp.lazy.js +18 -0
  82. package/dist/components/SignUp/SignUpContext.d.ts +6 -0
  83. package/dist/components/SignUp/SignUpContext.js +2 -0
  84. package/dist/components/SignUp/SignUpDefault/SignUp.lazy.d.ts +17 -0
  85. package/dist/components/SignUp/SignUpDefault/SignUp.lazy.js +18 -0
  86. package/dist/components/SignUp/SignUpDefault/SignUpContext.d.ts +6 -0
  87. package/dist/components/SignUp/SignUpDefault/SignUpContext.js +2 -0
  88. package/dist/components/SignUp/SignUpDefault/SignUpDefault.lazy.d.ts +1 -2
  89. package/dist/components/SignUp/SignUpDefault/SignUpDefault.lazy.js +1 -1
  90. package/dist/components/SignUp/SignUpDefault/SignUpDefaultForm.js +6 -4
  91. package/dist/components/SignUp/SignUpDefault/SignUpForm.d.ts +1 -0
  92. package/dist/components/SignUp/SignUpDefault/SignUpForm.js +310 -0
  93. package/dist/components/SignUp/SignUpForm.d.ts +1 -0
  94. package/dist/components/SignUp/SignUpForm.js +284 -0
  95. package/dist/components/SignUp/SignUpKYC/CaptureIdDocument.d.ts +1 -0
  96. package/dist/components/SignUp/SignUpKYC/CaptureIdDocument.js +198 -0
  97. package/dist/components/SignUp/SignUpKYC/CaptureSelfie.d.ts +1 -0
  98. package/dist/components/SignUp/SignUpKYC/CaptureSelfie.js +251 -0
  99. package/dist/components/SignUp/SignUpKYC/ImageUploader.d.ts +10 -0
  100. package/dist/components/SignUp/SignUpKYC/ImageUploader.js +42 -0
  101. package/dist/components/SignUp/SignUpKYC/PersonOverlayDesktop.d.ts +7 -0
  102. package/dist/components/SignUp/SignUpKYC/PersonOverlayDesktop.js +9 -0
  103. package/dist/components/SignUp/SignUpKYC/SignUpFormKYC.d.ts +1 -0
  104. package/dist/components/SignUp/SignUpKYC/SignUpFormKYC.js +464 -0
  105. package/dist/components/SignUp/SignUpKYC/SignUpKYC.lazy.d.ts +1 -1
  106. package/dist/components/SignUp/SignUpKYC/SignUpKYCForm.js +7 -5
  107. package/dist/components/SignUp/SignUpKYC/useImageUploader.d.ts +11 -0
  108. package/dist/components/SignUp/SignUpKYC/useImageUploader.js +20 -0
  109. package/dist/components/SignUp/SignUpKYC/utils.d.ts +9 -0
  110. package/dist/components/SignUp/SignUpKYC/utils.js +79 -0
  111. package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.d.ts +1 -0
  112. package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.js +198 -0
  113. package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.d.ts +1 -0
  114. package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.js +251 -0
  115. package/dist/components/SignUp/SignUpPagcor/ImageUploader.d.ts +10 -0
  116. package/dist/components/SignUp/SignUpPagcor/ImageUploader.js +41 -0
  117. package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.d.ts +1 -0
  118. package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.js +429 -0
  119. package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.d.ts +13 -0
  120. package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.js +26 -0
  121. package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.d.ts +7 -0
  122. package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.js +2 -0
  123. package/dist/components/SignUp/SignUpPagcor/useImageUploader.d.ts +11 -0
  124. package/dist/components/SignUp/SignUpPagcor/useImageUploader.js +20 -0
  125. package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.module.css +184 -184
  126. package/dist/components/Tournaments/TournamentsList/TournamentItem.module.css +184 -184
  127. package/dist/components/shared/IdDocumentField.client.d.ts +25 -0
  128. package/dist/components/shared/IdDocumentField.client.js +204 -0
  129. package/dist/components/shared/IdDocumentField.d.ts +2 -0
  130. package/dist/components/shared/IdDocumentField.js +11 -0
  131. package/dist/components/shared/SelfieField.client.d.ts +20 -0
  132. package/dist/components/shared/SelfieField.client.js +327 -0
  133. package/dist/components/shared/SelfieField.d.ts +2 -0
  134. package/dist/components/shared/SelfieField.js +11 -0
  135. package/dist/constants/BranchCode.d.ts +4 -0
  136. package/dist/constants/BranchCode.js +42 -0
  137. package/dist/constants/index.d.ts +0 -1
  138. package/dist/constants/index.js +0 -1
  139. package/dist/handlers/postTransformIdFrontImage.d.ts +3 -0
  140. package/dist/handlers/postTransformIdFrontImage.js +67 -0
  141. package/dist/handlers/postTransformSelfieImage.d.ts +3 -0
  142. package/dist/handlers/postTransformSelfieImage.js +71 -0
  143. package/dist/handlers.d.ts +43 -0
  144. package/dist/handlers.js +297 -0
  145. package/dist/icons/BellRingIcon.d.ts +2 -0
  146. package/dist/icons/BellRingIcon.js +4 -0
  147. package/dist/next.config.js +11 -36
  148. package/dist/services/queries.js +2639 -2639
  149. package/dist/styles/theme.css +706 -706
  150. package/dist/third-parties/FacebookPixel/FacebookPixel.d.ts +4 -0
  151. package/dist/third-parties/FacebookPixel/FacebookPixel.js +4 -0
  152. package/dist/third-parties/FacebookPixel/api.d.ts +0 -0
  153. package/dist/third-parties/FacebookPixel/api.js +1 -0
  154. package/dist/third-parties/FacebookPixel/index.d.ts +1 -0
  155. package/dist/third-parties/FacebookPixel/index.js +1 -0
  156. package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.d.ts +4 -0
  157. package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.js +4 -0
  158. package/dist/third-parties/GoogleRecaptcha/api.d.ts +0 -0
  159. package/dist/third-parties/GoogleRecaptcha/api.js +1 -0
  160. package/dist/third-parties/GoogleRecaptcha/index.d.ts +1 -0
  161. package/dist/third-parties/GoogleRecaptcha/index.js +1 -0
  162. package/dist/third-parties/index.d.ts +2 -0
  163. package/dist/third-parties/index.js +2 -0
  164. package/dist/ui/AlertDialog/AlertDialog.d.ts +121 -121
  165. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +11 -11
  166. package/dist/ui/Avatar/Avatar.d.ts +9 -9
  167. package/dist/ui/Avatar/avatar.recipe.d.ts +3 -3
  168. package/dist/ui/Badge/Badge.d.ts +12 -12
  169. package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
  170. package/dist/ui/Badge/badge.recipe.d.ts +3 -3
  171. package/dist/ui/Carousel/Carousel.d.ts +99 -99
  172. package/dist/ui/Carousel/carousel.recipe.d.ts +11 -11
  173. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  174. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  175. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  176. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  177. package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
  178. package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
  179. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  180. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  181. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  182. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  183. package/dist/ui/Dialog/Dialog.d.ts +121 -121
  184. package/dist/ui/Dialog/dialog.recipe.d.ts +11 -11
  185. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  186. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  187. package/dist/ui/Field/Field.d.ts +21 -21
  188. package/dist/ui/Field/field.recipe.d.ts +3 -3
  189. package/dist/ui/Menu/Menu.d.ts +252 -252
  190. package/dist/ui/Menu/menu.recipe.d.ts +14 -14
  191. package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
  192. package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
  193. package/dist/ui/Popover/Popover.d.ts +187 -187
  194. package/dist/ui/Popover/popover.recipe.d.ts +17 -17
  195. package/dist/ui/Progress/Progress.d.ts +27 -27
  196. package/dist/ui/Progress/progress.recipe.d.ts +3 -3
  197. package/dist/ui/QrCode/QrCode.d.ts +25 -25
  198. package/dist/ui/QrCode/qrCode.recipe.d.ts +5 -5
  199. package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
  200. package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
  201. package/dist/ui/Select/Select.d.ts +45 -45
  202. package/dist/ui/Select/select.recipe.d.ts +3 -3
  203. package/dist/ui/Table/Table.d.ts +21 -21
  204. package/dist/ui/Table/table.anatomy.d.ts +1 -1
  205. package/dist/ui/Table/table.recipe.d.ts +3 -3
  206. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  207. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  208. package/dist/utils/dataUrlToBlob.d.ts +1 -0
  209. package/dist/utils/dataUrlToBlob.js +11 -0
  210. package/dist/utils/gamesAvailable3pmTo3am.d.ts +1 -0
  211. package/dist/utils/gamesAvailable3pmTo3am.js +1 -0
  212. package/dist/utils/getGameName.d.ts +1 -0
  213. package/dist/utils/getGameName.js +6 -0
  214. package/dist/utils/isBetween3amAnd3pm.d.ts +1 -0
  215. package/dist/utils/isBetween3amAnd3pm.js +5 -0
  216. package/dist/utils/resizeImageSize.d.ts +2 -0
  217. package/dist/utils/resizeImageSize.js +11 -0
  218. package/package.json +164 -164
  219. package/dist/client/utils/recaptcha.d.ts +0 -14
  220. package/dist/client/utils/recaptcha.js +0 -18
@@ -53,6 +53,13 @@ export interface TermsOfUseStore extends TermsAndConditionsStore {
53
53
  }
54
54
  export interface ResponsibleGamingStore extends TermsAndConditionsStore {
55
55
  }
56
+ export interface HasPendingBonusStore {
57
+ open: boolean;
58
+ setOpen: (open: boolean) => void;
59
+ '~touched': boolean;
60
+ shouldShowWarning: boolean;
61
+ setShouldShowWarning: (shouldShow: boolean) => void;
62
+ }
56
63
  export interface GlobalStore {
57
64
  signUp: PopupStore;
58
65
  signIn: PopupStore;
@@ -73,6 +80,7 @@ export interface GlobalStore {
73
80
  termsAndConditions: TermsAndConditionsStore;
74
81
  termsOfUse: TermsOfUseStore;
75
82
  responsibleGaming: ResponsibleGamingStore;
83
+ pendingBonus: HasPendingBonusStore;
76
84
  }
77
85
  export declare const useGlobalStore: import("zustand").UseBoundStore<import("zustand").StoreApi<GlobalStore>>;
78
86
  export {};
@@ -371,4 +371,25 @@ export const useGlobalStore = create((set) => ({
371
371
  },
372
372
  '~touched': false,
373
373
  },
374
+ pendingBonus: {
375
+ open: false,
376
+ setOpen(open) {
377
+ set((prev) => ({
378
+ pendingBonus: {
379
+ ...prev.pendingBonus,
380
+ open,
381
+ '~touched': true,
382
+ },
383
+ }));
384
+ },
385
+ shouldShowWarning: false,
386
+ setShouldShowWarning: (shouldShowWarning) => set((state) => ({
387
+ pendingBonus: {
388
+ ...state.pendingBonus,
389
+ shouldShowWarning,
390
+ '~touched': true,
391
+ },
392
+ })),
393
+ '~touched': false,
394
+ },
374
395
  }));
@@ -1,8 +1,9 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { twMerge } from 'tailwind-merge';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useEffect } from 'react';
4
4
  import { z } from 'zod';
5
5
  import { useShallow } from 'zustand/shallow';
6
+ import { useBonusesQuery } from '../../client/hooks/useBonusesQuery.js';
6
7
  import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
7
8
  import { useLocaleInfo } from '../../client/hooks/useLocaleInfo.js';
8
9
  import { useWalletQuery } from '../../client/hooks/useWalletQuery.js';
@@ -15,24 +16,36 @@ import { Tabs } from '../../ui/Tabs/index.js';
15
16
  import { formatNumber } from '../../utils/formatNumber.js';
16
17
  import { Deposit } from './Deposit/Deposit.js';
17
18
  import { DepositWithdrawalPropsProvider } from './DepositWithdrawalContext.js';
19
+ import HasPendingBonuses from './HasPendingBonuses.js';
18
20
  import { Withdrawal } from './Withdrawal/Withdrawal.js';
19
21
  export function DepositWithdrawal(props) {
20
22
  const globalStore = useGlobalStore(useShallow((ctx) => ({
21
23
  depositWithdrawal: ctx.depositWithdrawal,
24
+ pendingBonus: ctx.pendingBonus,
22
25
  })));
26
+ const bonusesQuery = useBonusesQuery();
27
+ const hasPendingBonus = Boolean(bonusesQuery?.data &&
28
+ bonusesQuery?.data?.length > 0 &&
29
+ bonusesQuery.data?.some((bonus) => +bonus.currentTurnoverRequirementContributionPercentage < 100));
23
30
  const localeInfo = useLocaleInfo();
24
31
  const walletQuery = useWalletQuery({
25
32
  refetchInterval: 5000,
26
33
  });
27
- return (_jsx(DepositWithdrawalPropsProvider, { value: props, children: _jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: globalStore.depositWithdrawal.open, onOpenChange: (details) => {
28
- globalStore.depositWithdrawal.setOpen(details.open);
29
- if (!details.open) {
30
- globalStore.depositWithdrawal.setPromo(null);
31
- }
32
- }, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)]", children: _jsxs(Dialog.Content, { className: twMerge('py-3xl mx-auto h-full w-full overflow-y-auto px-4 lg:min-h-[80vh] lg:w-[480px] lg:rounded-xl', 'scrollbar-thumb:bg-bg-quaternary scrollbar-track:bg-transparent scrollbar:h-2 scrollbar:w-2 scrollbar-thumb:rounded-full'), children: [_jsxs(Dialog.Header, { className: "gap-xl flex items-center", children: [_jsx("div", { className: "border-border-primary shadow-xs text-text-secondary-700 flex size-10 items-center justify-center rounded-md border text-gray-700", children: _jsx(Wallet02Icon, { className: "size-5" }) }), _jsx(Dialog.Title, { className: "grow text-lg font-semibold", children: "Wallet" }), _jsx(Dialog.Context, { children: (api) => (_jsx(IconButton, { size: "sm", variant: "outline", colorScheme: "gray", onClick: () => api.setOpen(false), children: _jsx(XIcon, {}) })) })] }), _jsxs(Dialog.Body, { className: "mt-3xl", children: [_jsx("p", { className: "text-text-secondary-700 text-center text-sm", children: "Deposit Balance" }), _jsx("p", { className: "text-center text-3xl font-bold leading-tight tracking-tight", children: formatNumber(walletQuery.data?.balance, {
33
- currency: localeInfo.currency.code,
34
- minDecimalPlaces: 2,
35
- }) }), _jsxs(Tabs.Root, { value: globalStore.depositWithdrawal.tab, onValueChange: (details) => {
36
- globalStore.depositWithdrawal.setTab(z.enum(['DEPOSIT', 'WITHDRAWAL']).parse(details.value));
37
- }, lazyMount: true, unmountOnExit: true, className: "mt-3xl space-y-4xl", children: [_jsxs(Tabs.List, { className: "w-full", children: [_jsx(Tabs.Trigger, { value: "DEPOSIT", className: "grow", children: "Deposit" }), _jsx(Tabs.Trigger, { value: "WITHDRAWAL", className: "grow", children: "Withdrawal" }), _jsx(Tabs.Indicator, {})] }), _jsx(Tabs.Content, { value: "DEPOSIT", className: "space-y-3xl", children: _jsx(Deposit, {}) }), _jsx(Tabs.Content, { value: "WITHDRAWAL", className: "space-y-3xl", children: _jsx(Withdrawal, {}) })] })] })] }) })] }) }) }));
34
+ //check if the user has pending/ongoing bonuses
35
+ useEffect(() => {
36
+ if (hasPendingBonus && !globalStore.pendingBonus.shouldShowWarning) {
37
+ globalStore.pendingBonus.setShouldShowWarning(hasPendingBonus);
38
+ }
39
+ }, [hasPendingBonus]);
40
+ return (_jsxs(_Fragment, { children: [_jsx(DepositWithdrawalPropsProvider, { value: props, children: _jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: globalStore.depositWithdrawal.open, onOpenChange: (details) => {
41
+ globalStore.depositWithdrawal.setOpen(details.open);
42
+ if (!details.open) {
43
+ globalStore.depositWithdrawal.setPromo(null);
44
+ }
45
+ }, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)]", children: _jsxs(Dialog.Content, { className: "lg:min-h-auto py-3xl mx-auto min-h-full w-full overflow-y-auto px-4 lg:w-[480px] lg:rounded-xl", children: [_jsxs(Dialog.Header, { className: "gap-xl flex items-center", children: [_jsx("div", { className: "border-border-primary shadow-xs text-text-secondary-700 flex size-10 items-center justify-center rounded-md border text-gray-700", children: _jsx(Wallet02Icon, { className: "size-5" }) }), _jsx(Dialog.Title, { className: "grow text-lg font-semibold", children: "Wallet" }), _jsx(Dialog.Context, { children: (api) => (_jsx(IconButton, { size: "sm", variant: "outline", colorScheme: "gray", onClick: () => api.setOpen(false), children: _jsx(XIcon, {}) })) })] }), _jsxs(Dialog.Body, { className: "mt-3xl", children: [_jsx("p", { className: "text-text-secondary-700 text-center text-sm", children: "Deposit Balance" }), _jsx("p", { className: "text-center text-3xl font-bold leading-tight tracking-tight", children: formatNumber(walletQuery.data?.balance, {
46
+ currency: localeInfo.currency.code,
47
+ minDecimalPlaces: 2,
48
+ }) }), _jsxs(Tabs.Root, { value: globalStore.depositWithdrawal.tab, onValueChange: (details) => {
49
+ globalStore.depositWithdrawal.setTab(z.enum(['DEPOSIT', 'WITHDRAWAL']).parse(details.value));
50
+ }, lazyMount: true, unmountOnExit: true, className: "mt-3xl space-y-4xl", children: [_jsxs(Tabs.List, { className: "w-full", children: [_jsx(Tabs.Trigger, { value: "DEPOSIT", className: "grow", children: "Deposit" }), _jsx(Tabs.Trigger, { value: "WITHDRAWAL", className: "grow", children: "Withdrawal" }), _jsx(Tabs.Indicator, {})] }), _jsx(Tabs.Content, { value: "DEPOSIT", className: "space-y-3xl", children: _jsx(Deposit, {}) }), _jsx(Tabs.Content, { value: "WITHDRAWAL", className: "space-y-3xl", children: _jsx(Withdrawal, {}) })] })] })] }) })] }) }) }), _jsx(HasPendingBonuses, {})] }));
38
51
  }
@@ -0,0 +1,5 @@
1
+ interface Props {
2
+ className?: string;
3
+ }
4
+ declare function HasPendingBonuses(props: Props): import("react/jsx-runtime").JSX.Element;
5
+ export default HasPendingBonuses;
@@ -0,0 +1,22 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { twMerge } from 'tailwind-merge';
4
+ import { useShallow } from 'zustand/shallow';
5
+ import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
6
+ import { AlertTriangleIcon } from '../../icons/AlertTriangle.js';
7
+ import { XIcon } from '../../icons/XIcon.js';
8
+ import { Button } from '../../ui/Button/index.js';
9
+ import { Dialog } from '../../ui/Dialog/index.js';
10
+ import { Portal } from '../../ui/Portal/index.js';
11
+ function HasPendingBonuses(props) {
12
+ const hasPendingBonusStore = useGlobalStore(useShallow((ctx) => ctx.pendingBonus));
13
+ return (_jsx(Dialog.Root, { open: hasPendingBonusStore.open, onOpenChange: (details) => {
14
+ hasPendingBonusStore.setOpen(details.open);
15
+ }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "z-popover" }), _jsx(Dialog.Positioner, { className: "z-tooltip flex items-center justify-center", children: _jsxs(Dialog.Content, { className: twMerge('bg-bg-primary-alt p-3xl pb-4xl mx-auto h-fit w-[90vw] overflow-y-auto rounded-2xl text-center lg:h-auto lg:w-[400px] lg:rounded-xl', props.className), children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsx("div", { className: "mb-xl bg-bg-warning-secondary mx-auto flex w-fit items-center justify-center rounded-full p-3", children: _jsx(AlertTriangleIcon, { className: "size-6 text-[#FEDF89]" }) }), _jsx("h1", { className: "text-text-primary-900 text-lg font-semibold", children: "Confirm Promo Cancellation" }), _jsx("p", { className: "text-text-tertiary-600 text-sm", children: "Proceeding will cancel the promo and result in the loss of your active bonus. Do you want to continue?" }), _jsxs(Dialog.Footer, { className: "mt-4xl flex items-center gap-2", children: [_jsx(Button, { type: "button", variant: "outline", onClick: () => {
16
+ hasPendingBonusStore.setOpen(false);
17
+ }, children: "No" }), _jsx(Button, { type: "submit", onClick: () => {
18
+ hasPendingBonusStore.setOpen(false);
19
+ hasPendingBonusStore.setShouldShowWarning(false);
20
+ }, children: "Yes" })] })] }) })] }) }));
21
+ }
22
+ export default HasPendingBonuses;
@@ -31,6 +31,7 @@ export function GCashWithdrawal() {
31
31
  const depositWithdrawalProps = useDepositWithdrawalPropsContext();
32
32
  const globalStore = useGlobalStore(useShallow((ctx) => ({
33
33
  depositWithdrawal: ctx.depositWithdrawal,
34
+ hasPendingBonus: ctx.pendingBonus,
34
35
  })));
35
36
  const [status, setStatus] = useState('waiting');
36
37
  const localeInfo = useLocaleInfo();
@@ -101,6 +102,10 @@ export function GCashWithdrawal() {
101
102
  }
102
103
  }, [form, minimumAmount]);
103
104
  const handleSubmit = form.handleSubmit(async (data) => {
105
+ if (globalStore.hasPendingBonus.shouldShowWarning) {
106
+ globalStore.hasPendingBonus.setOpen(true);
107
+ return;
108
+ }
104
109
  createWithdrawalMutation.mutate({
105
110
  amount: data.amount,
106
111
  recipientMobileNumber: mobileNumberParser.format(data.mobileNumber),
@@ -6,7 +6,6 @@ import { useEffect, useMemo, useState } from 'react';
6
6
  import { Controller, useForm } from 'react-hook-form';
7
7
  import { z } from 'zod';
8
8
  import { useShallow } from 'zustand/shallow';
9
- import { useCreateInstapayWithdrawalMutation } from '../../../../client/hooks/useCreateInstapayWithdrawalMutation.js';
10
9
  import { useCreateInstapayWithdrawalNextMutation } from '../../../../client/hooks/useCreateInstapayWithdrawalNextMutation.js';
11
10
  import { useFeatureFlag } from '../../../../client/hooks/useFeatureFlag.js';
12
11
  import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
@@ -37,20 +36,9 @@ export function InstapayWithdrawal() {
37
36
  const { enabled } = useFeatureFlag();
38
37
  const globalStore = useGlobalStore(useShallow((ctx) => ({
39
38
  depositWithdrawal: ctx.depositWithdrawal,
39
+ hasPendingBonus: ctx.pendingBonus,
40
40
  })));
41
41
  const [status, setStatus] = useState('waiting');
42
- const createWithdrawalMutation = useCreateInstapayWithdrawalMutation({
43
- onMutate() {
44
- setStatus('processing');
45
- },
46
- onSuccess() {
47
- form.reset();
48
- setStatus('success');
49
- },
50
- onError() {
51
- setStatus('failed');
52
- },
53
- });
54
42
  const createWithdrawalNextMutation = useCreateInstapayWithdrawalNextMutation({
55
43
  onMutate() {
56
44
  setStatus('processing');
@@ -59,8 +47,7 @@ export function InstapayWithdrawal() {
59
47
  form.reset();
60
48
  setStatus('success');
61
49
  },
62
- onError(err) {
63
- console.log(err, 'error');
50
+ onError() {
64
51
  setStatus('failed');
65
52
  },
66
53
  });
@@ -98,11 +85,9 @@ export function InstapayWithdrawal() {
98
85
  .min(8, 'Password must be 8 or more characters')
99
86
  .max(64, 'Password must be not be more than 64 characters'),
100
87
  accountNumber: z.string().min(1).trim(),
101
- accountName: enabled
102
- ? z
103
- .string({ required_error: 'Account name is required' })
104
- .min(4, 'Account name must be at least 4 characters')
105
- : z.string().optional().or(z.string().trim()),
88
+ accountName: z
89
+ .string({ required_error: 'Account name is required' })
90
+ .min(4, 'Account name must be at least 4 characters'),
106
91
  bankCode: z.string().min(1, 'Bank is required').trim(),
107
92
  });
108
93
  const form = useForm({
@@ -137,23 +122,17 @@ export function InstapayWithdrawal() {
137
122
  }
138
123
  }, [form, instapayBankList]);
139
124
  const handleSubmit = form.handleSubmit(async (data) => {
140
- if (enabled) {
141
- createWithdrawalNextMutation.mutate({
142
- amount: data.amount,
143
- transactionPassword: data.password,
144
- accountNumber: data.accountNumber,
145
- bankCode: data.bankCode,
146
- accountName: data.accountName ?? '',
147
- });
148
- }
149
- else {
150
- createWithdrawalMutation.mutate({
151
- amount: data.amount,
152
- transactionPassword: data.password,
153
- accountNumber: data.accountNumber,
154
- bankCode: data.bankCode,
155
- });
125
+ if (globalStore.hasPendingBonus.shouldShowWarning) {
126
+ globalStore.hasPendingBonus.setOpen(true);
127
+ return;
156
128
  }
129
+ createWithdrawalNextMutation.mutate({
130
+ amount: data.amount,
131
+ transactionPassword: data.password,
132
+ accountNumber: data.accountNumber,
133
+ bankCode: data.bankCode,
134
+ accountName: data.accountName ?? '',
135
+ });
157
136
  });
158
137
  const bankCollection = useMemo(() => createListCollection({
159
138
  items: instapayBankList ?? [],
@@ -164,7 +143,7 @@ export function InstapayWithdrawal() {
164
143
  sameWidth: true,
165
144
  }, value: o.field.value ? [o.field.value] : [], onValueChange: (details) => {
166
145
  o.field.onChange(details.value.at(0) ?? '');
167
- }, children: [_jsx(Select.Label, { children: "Bank" }), _jsx(Select.Control, { children: _jsxs(Select.Trigger, { children: [_jsx(Select.ValueText, {}), _jsx(Select.Indicator, { asChild: true, children: _jsx(ChevronDownIcon, {}) })] }) }), _jsx(Select.Positioner, { children: _jsx(Select.Content, { children: _jsx(Select.ItemGroup, { children: bankCollection.items.map((item) => (_jsxs(Select.Item, { item: item, children: [_jsx(Select.ItemText, { children: item.name }), _jsx(Select.ItemIndicator, { asChild: true, children: _jsx(CheckIcon, {}) })] }, item.id))) }) }) })] }), _jsx(Field.ErrorText, { children: form.formState.errors.bankCode?.message })] })) }), _jsxs(Field.Root, { invalid: !!form.formState.errors.accountNumber, className: "mt-3xl", children: [_jsx(Field.Label, { children: "Bank account number" }), _jsx(Field.Input, { ...form.register('accountNumber') }), _jsx(Field.ErrorText, { children: form.formState.errors.accountNumber?.message })] }), enabled && (_jsxs(Field.Root, { invalid: !!form.formState.errors.accountName, className: "mt-3xl", children: [_jsx(Field.Label, { children: "Account name" }), _jsx(Field.Input, { ...form.register('accountName') }), _jsx(Field.ErrorText, { children: form.formState.errors.accountName?.message })] })), _jsx(Controller, { control: form.control, name: "amount", render: (o) => (_jsxs(Field.Root, { invalid: !!form.formState.errors.amount, className: "mt-3xl", children: [_jsxs(NumberInput.Root, { min: 0, step: 1, value: o.field.value, onValueChange: (details) => {
146
+ }, children: [_jsx(Select.Label, { children: "Bank" }), _jsx(Select.Control, { children: _jsxs(Select.Trigger, { children: [_jsx(Select.ValueText, {}), _jsx(Select.Indicator, { asChild: true, children: _jsx(ChevronDownIcon, {}) })] }) }), _jsx(Select.Positioner, { children: _jsx(Select.Content, { children: _jsx(Select.ItemGroup, { children: bankCollection.items.map((item) => (_jsxs(Select.Item, { item: item, children: [_jsx(Select.ItemText, { children: item.name }), _jsx(Select.ItemIndicator, { asChild: true, children: _jsx(CheckIcon, {}) })] }, item.id))) }) }) })] }), _jsx(Field.ErrorText, { children: form.formState.errors.bankCode?.message })] })) }), _jsxs(Field.Root, { invalid: !!form.formState.errors.accountNumber, className: "mt-3xl", children: [_jsx(Field.Label, { children: "Bank account number" }), _jsx(Field.Input, { ...form.register('accountNumber') }), _jsx(Field.ErrorText, { children: form.formState.errors.accountNumber?.message })] }), _jsxs(Field.Root, { invalid: !!form.formState.errors.accountName, className: "mt-3xl", children: [_jsx(Field.Label, { children: "Account name" }), _jsx(Field.Input, { ...form.register('accountName') }), _jsx(Field.ErrorText, { children: form.formState.errors.accountName?.message })] }), _jsx(Controller, { control: form.control, name: "amount", render: (o) => (_jsxs(Field.Root, { invalid: !!form.formState.errors.amount, className: "mt-3xl", children: [_jsxs(NumberInput.Root, { min: 0, step: 1, value: o.field.value, onValueChange: (details) => {
168
147
  o.field.onChange(details.value);
169
148
  }, formatOptions: {
170
149
  maximumFractionDigits: 2,
@@ -175,16 +154,14 @@ export function InstapayWithdrawal() {
175
154
  shouldDirty: true,
176
155
  shouldValidate: true,
177
156
  });
178
- }, min: minimumAmount, max: maximumAmount, className: "mt-xl" }), _jsxs(Field.Root, { className: "mt-3xl", invalid: !!form.formState.errors.password, children: [_jsxs(PasswordInput.Root, { children: [_jsx(PasswordInput.Label, { children: "Transaction Password" }), _jsxs(PasswordInput.Control, { children: [_jsx(PasswordInput.Input, { placeholder: "Enter password", ...form.register('password') }), _jsx(PasswordInput.VisibilityTrigger, { children: _jsx(PasswordInput.Indicator, { fallback: _jsx(EyeOffIcon, {}), asChild: true, children: _jsx(EyeIcon, {}) }) })] })] }), _jsx(Field.ErrorText, { children: form.formState.errors.password?.message })] }), _jsx(TransactionPasswordNotSet, {}), _jsx(Button, { type: "submit", className: "mt-6", disabled: createWithdrawalMutation.isPending, children: "Withdraw" }), _jsxs("p", { className: "text-text-tertiary-600 mt-lg text-xs", children: ["Upon withdrawing, you agree to our", ' ', _jsx(Link, { href: depositWithdrawalProps.termsOfUseUrl ?? '/terms-of-use', onClick: () => globalStore.depositWithdrawal.setOpen(false), className: "text-text-warning-primary-600 underline underline-offset-2", children: "Terms of Use" }), ' ', "and", ' ', _jsx(Link, { href: depositWithdrawalProps.privacyPolicyUrl ?? '/privacy-policy', onClick: () => globalStore.depositWithdrawal.setOpen(false), className: "text-text-warning-primary-600 underline underline-offset-2", children: "Privacy Policy" }), "."] }), _jsx(AlertDialog.Root, { open: status !== 'waiting', onOpenChange: (details) => {
157
+ }, min: minimumAmount, max: maximumAmount, className: "mt-xl" }), _jsxs(Field.Root, { className: "mt-3xl", invalid: !!form.formState.errors.password, children: [_jsxs(PasswordInput.Root, { children: [_jsx(PasswordInput.Label, { children: "Transaction Password" }), _jsxs(PasswordInput.Control, { children: [_jsx(PasswordInput.Input, { placeholder: "Enter password", ...form.register('password') }), _jsx(PasswordInput.VisibilityTrigger, { children: _jsx(PasswordInput.Indicator, { fallback: _jsx(EyeOffIcon, {}), asChild: true, children: _jsx(EyeIcon, {}) }) })] })] }), _jsx(Field.ErrorText, { children: form.formState.errors.password?.message })] }), _jsx(TransactionPasswordNotSet, {}), _jsx(Button, { type: "submit", className: "mt-6", disabled: createWithdrawalNextMutation.isPending, children: "Withdraw" }), _jsxs("p", { className: "text-text-tertiary-600 mt-lg text-xs", children: ["Upon withdrawing, you agree to our", ' ', _jsx(Link, { href: depositWithdrawalProps.termsOfUseUrl ?? '/terms-of-use', onClick: () => globalStore.depositWithdrawal.setOpen(false), className: "text-text-warning-primary-600 underline underline-offset-2", children: "Terms of Use" }), ' ', "and", ' ', _jsx(Link, { href: depositWithdrawalProps.privacyPolicyUrl ?? '/privacy-policy', onClick: () => globalStore.depositWithdrawal.setOpen(false), className: "text-text-warning-primary-600 underline underline-offset-2", children: "Privacy Policy" }), "."] }), _jsx(AlertDialog.Root, { open: status !== 'waiting', onOpenChange: (details) => {
179
158
  if (!details.open) {
180
159
  setStatus('waiting');
181
160
  }
182
161
  }, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+2)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+3)]", children: _jsxs(AlertDialog.Content, { children: [_jsx(AlertDialog.CloseTrigger, { disabled: status === 'processing', children: _jsx(XIcon, {}) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "text-text-brand-primary-600 size-12" })), status === 'success' && (_jsx("div", { className: "bg-bg-success-secondary text-text-featured-icon-light-success flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "bg-bg-error-secondary text-text-featured-icon-light-error flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Withdraw', status === 'success' && 'Withdrawal Submitted', status === 'failed' && 'Withdraw Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
183
162
  "We're verifying your account and amount. Please hold a moment.", status === 'success' &&
184
163
  'Your withdrawal request has been submitted successfully and is awaiting confirmation. You won’t have to wait long — once approved, the funds will be credited to your account.', status === 'failed' &&
185
- explainError(enabled
186
- ? createWithdrawalNextMutation.error?.name
187
- : createWithdrawalMutation.error?.name)] })] }), (status === 'failed' || status === 'success') && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
164
+ explainError(createWithdrawalNextMutation.error?.name)] })] }), (status === 'failed' || status === 'success') && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
188
165
  api.setOpen(false);
189
166
  }, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
190
167
  }
@@ -29,6 +29,7 @@ export function MayaAppWithdrawal() {
29
29
  const depositWithdrawalProps = useDepositWithdrawalPropsContext();
30
30
  const globalStore = useGlobalStore(useShallow((ctx) => ({
31
31
  depositWithdrawal: ctx.depositWithdrawal,
32
+ pendingBonus: ctx.pendingBonus,
32
33
  })));
33
34
  const [status, setStatus] = useState('waiting');
34
35
  const createWithdrawalMutation = useCreateMayaAppWithdrawalMutation({
@@ -92,6 +93,10 @@ export function MayaAppWithdrawal() {
92
93
  }
93
94
  }, [form, minimumAmount]);
94
95
  const handleSubmit = form.handleSubmit(async (data) => {
96
+ if (globalStore.pendingBonus.shouldShowWarning) {
97
+ globalStore.pendingBonus.setOpen(true);
98
+ return;
99
+ }
95
100
  createWithdrawalMutation.mutate({
96
101
  amount: data.amount,
97
102
  transactionPassword: data.password,
@@ -31,6 +31,7 @@ export function MayaWithdrawal() {
31
31
  const depositWithdrawalProps = useDepositWithdrawalPropsContext();
32
32
  const globalStore = useGlobalStore(useShallow((ctx) => ({
33
33
  depositWithdrawal: ctx.depositWithdrawal,
34
+ hasPendingBonus: ctx.pendingBonus,
34
35
  })));
35
36
  const [status, setStatus] = useState('waiting');
36
37
  const localeInfo = useLocaleInfo();
@@ -101,6 +102,10 @@ export function MayaWithdrawal() {
101
102
  }
102
103
  }, [form, minimumAmount]);
103
104
  const handleSubmit = form.handleSubmit(async (data) => {
105
+ if (globalStore.hasPendingBonus.shouldShowWarning) {
106
+ globalStore.hasPendingBonus.setOpen(true);
107
+ return;
108
+ }
104
109
  createWithdrawalMutation.mutate({
105
110
  amount: data.amount,
106
111
  recipientMobileNumber: mobileNumberParser.format(data.mobileNumber),
@@ -33,6 +33,7 @@ export function PisoPayWithdrawal() {
33
33
  const depositWithdrawalProps = useDepositWithdrawalPropsContext();
34
34
  const globalStore = useGlobalStore(useShallow((ctx) => ({
35
35
  depositWithdrawal: ctx.depositWithdrawal,
36
+ pendingBonus: ctx.pendingBonus,
36
37
  })));
37
38
  const [status, setStatus] = useState('waiting');
38
39
  const createWithdrawalMutation = useCreatePisoPayWithdrawalMutation({
@@ -115,6 +116,10 @@ export function PisoPayWithdrawal() {
115
116
  }
116
117
  }, [form]);
117
118
  const handleSubmit = form.handleSubmit(async (data) => {
119
+ if (globalStore.pendingBonus.shouldShowWarning) {
120
+ globalStore.pendingBonus.setOpen(true);
121
+ return;
122
+ }
118
123
  createWithdrawalMutation.mutate({
119
124
  amount: data.amount,
120
125
  transactionPassword: data.password,
@@ -33,6 +33,7 @@ export function VentajaWithdrawal() {
33
33
  const depositWithdrawalProps = useDepositWithdrawalPropsContext();
34
34
  const globalStore = useGlobalStore(useShallow((ctx) => ({
35
35
  depositWithdrawal: ctx.depositWithdrawal,
36
+ pendingBonus: ctx.pendingBonus,
36
37
  })));
37
38
  const [status, setStatus] = useState('waiting');
38
39
  const createWithdrawalMutation = useCreateVentajaDisbursementWithdrawalMutation({
@@ -114,6 +115,10 @@ export function VentajaWithdrawal() {
114
115
  }
115
116
  }, [form, instapayBankList]);
116
117
  const handleSubmit = form.handleSubmit(async (data) => {
118
+ if (globalStore.pendingBonus.shouldShowWarning) {
119
+ globalStore.pendingBonus.setOpen(true);
120
+ return;
121
+ }
117
122
  createWithdrawalMutation.mutate({
118
123
  input: {
119
124
  amount: data.amount,
@@ -0,0 +1,10 @@
1
+ import { type ImageProps } from 'next/image';
2
+ import type { ReactNode } from 'react';
3
+ export interface ResponsibleGamingProps {
4
+ responsibleGamingContent: string | ReactNode;
5
+ logo: ImageProps['src'];
6
+ open: boolean;
7
+ onCloseAction: () => void;
8
+ responsibleGamingLogo?: ImageProps['src'];
9
+ }
10
+ export declare function ResponsibleGaming({ logo, open, responsibleGamingContent, onCloseAction, ...props }: ResponsibleGamingProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import Image, {} from 'next/image';
4
+ import pagcorLogo from '../../images/pagcor.png';
5
+ import responsibleGamingLogo from '../../images/responsible-gaming.png';
6
+ import { Button } from '../../ui/Button/index.js';
7
+ import { Dialog } from '../../ui/Dialog/index.js';
8
+ import { Portal } from '../../ui/Portal/index.js';
9
+ export function ResponsibleGaming({ logo, open, responsibleGamingContent, onCloseAction, ...props }) {
10
+ return (_jsx(Dialog.Root, { open: open, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "z-popover" }), _jsx(Dialog.Positioner, { className: "z-popover", children: _jsxs(Dialog.Content, { className: "flex h-full w-full flex-col items-start overflow-y-auto p-3xl lg:mx-auto lg:h-auto lg:w-[400px] lg:rounded-xl", children: [_jsx(Image, { src: logo, alt: "", width: 200, height: 100, className: "mx-auto h-auto w-[120px]", draggable: false }), _jsxs("div", { className: "w-full grow", children: [_jsx(Dialog.Title, { className: "text-brand-400 mt-3xl text-center text-lg font-semibold", children: "Responsible Gaming" }), _jsx(Dialog.Description, { className: "leading-2xl mt-xs text-sm", children: responsibleGamingContent }), _jsxs("div", { className: "mt-5 flex items-center justify-center gap-3xl", children: [_jsx(Image, { src: pagcorLogo, alt: "", height: 75, width: 88, className: "h-[88px] w-auto shrink-0", draggable: false }), _jsx(Image, { src: props.responsibleGamingLogo ?? responsibleGamingLogo, alt: "", height: 62, width: 186, className: "h-[62px] w-auto shrink-0", draggable: false })] })] }), _jsx("div", { className: "w-full", children: _jsx(Button, { type: "button", className: "mt-3", onClick: () => {
11
+ onCloseAction();
12
+ }, children: "I Agree" }) })] }) })] }) }));
13
+ }
@@ -0,0 +1,11 @@
1
+ import { type ImageProps } from 'next/image';
2
+ import type { ReactNode } from 'react';
3
+ export interface TermsOfUseProps {
4
+ logo: ImageProps['src'];
5
+ open: boolean;
6
+ onCloseAction: () => void;
7
+ termsOfUseContent: string | ReactNode;
8
+ siteName: string;
9
+ responsibleGamingLogo?: ImageProps['src'];
10
+ }
11
+ export declare function TermsOfUse({ logo, open, onCloseAction, siteName, termsOfUseContent, ...props }: TermsOfUseProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import Image, {} from 'next/image';
4
+ import pagcorLogo from '../../images/pagcor.png';
5
+ import responsibleGamingLogo from '../../images/responsible-gaming.png';
6
+ import { Button } from '../../ui/Button/index.js';
7
+ import { Dialog } from '../../ui/Dialog/index.js';
8
+ import { Portal } from '../../ui/Portal/index.js';
9
+ export function TermsOfUse({ logo, open, onCloseAction, siteName, termsOfUseContent, ...props }) {
10
+ return (_jsx(Dialog.Root, { open: open, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "z-popover" }), _jsx(Dialog.Positioner, { className: "z-popover", children: _jsxs(Dialog.Content, { className: "flex h-full w-full flex-col items-start overflow-y-auto p-3xl lg:mx-auto lg:h-auto lg:w-[400px] lg:rounded-xl", children: [_jsx(Image, { src: logo, alt: "", width: 200, height: 100, className: "mx-auto h-auto w-[120px]", draggable: false }), _jsxs("div", { className: "w-full grow", children: [_jsxs(Dialog.Title, { className: "text-brand-400 mt-3xl text-center text-lg font-semibold", children: [siteName, " Terms of Use"] }), _jsx(Dialog.Description, { className: "leading-2xl mt-xs text-sm", children: termsOfUseContent }), _jsxs("div", { className: "mt-5 flex items-center justify-center gap-3xl", children: [_jsx(Image, { src: pagcorLogo, alt: "", height: 75, width: 88, className: "h-[88px] w-auto shrink-0", draggable: false }), _jsx(Image, { src: props.responsibleGamingLogo ?? responsibleGamingLogo, alt: "", height: 62, width: 186, className: "h-[62px] w-auto shrink-0", draggable: false })] })] }), _jsx("div", { className: "w-full", children: _jsx(Button, { type: "button", className: "mt-3", onClick: () => {
11
+ onCloseAction();
12
+ }, children: "I Agree" }) })] }) })] }) }));
13
+ }
@@ -0,0 +1 @@
1
+ export declare function FeatureFlag(): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,29 @@
1
+ 'use client';
2
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
3
+ import { useRouter, useSearchParams } from 'next/navigation';
4
+ import { useEffect } from 'react';
5
+ import { FEATURE_FLAG_KEY, useFeatureFlag, } from '../../client/hooks/useFeatureFlag.js';
6
+ export function FeatureFlag() {
7
+ const { featureFlagEnabled, setFeatureFlagEnabled } = useFeatureFlag();
8
+ const searchParams = useSearchParams();
9
+ const router = useRouter();
10
+ useEffect(() => {
11
+ const futureFlagParam = searchParams.get('future');
12
+ if (futureFlagParam !== null) {
13
+ const isEnabled = futureFlagParam === 'true';
14
+ setFeatureFlagEnabled(isEnabled);
15
+ localStorage.setItem(FEATURE_FLAG_KEY, isEnabled.toString());
16
+ }
17
+ }, [searchParams, setFeatureFlagEnabled]);
18
+ function disableFeatureFlag() {
19
+ setFeatureFlagEnabled(false);
20
+ localStorage.removeItem(FEATURE_FLAG_KEY);
21
+ const params = new URLSearchParams(searchParams.toString());
22
+ params.delete('future');
23
+ router.replace(`?${params.toString()}`, { scroll: false });
24
+ }
25
+ if (!featureFlagEnabled) {
26
+ return null;
27
+ }
28
+ return (_jsx("div", { className: "fixed bottom-3 flex w-full flex-col items-center justify-center", children: _jsxs("div", { className: "bg-black/70 p-1", children: ["Experimental features are enabled.", ' ', _jsxs("button", { onClick: () => disableFeatureFlag(), className: "cursor-pointer underline", children: [' ', "Disable"] })] }) }));
29
+ }
@@ -0,0 +1 @@
1
+ export * from './FeatureFlag';
@@ -0,0 +1 @@
1
+ export * from './FeatureFlag.js';