@opexa/portal-components 0.0.805 → 0.0.806

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 (136) hide show
  1. package/dist/components/DepositWithdrawal/Deposit/AiOGCashDeposit/AiOGCashDeposit.js +10 -54
  2. package/dist/components/DepositWithdrawal/Deposit/AiOGrabPayDeposit/AiOGrabPayDeposit.js +10 -54
  3. package/dist/components/DepositWithdrawal/Deposit/AiOPalawanPayDeposit/AiOPalawanPayDeposit.js +10 -54
  4. package/dist/components/DepositWithdrawal/Deposit/AiOPayMayaDeposit/AiOPayMayaDeposit.js +10 -54
  5. package/dist/components/DepositWithdrawal/Deposit/GCashDeposit/GCashDeposit.js +9 -54
  6. package/dist/components/DepositWithdrawal/Deposit/GCashWebpayDeposit/GCashWebpayDeposit.js +9 -54
  7. package/dist/components/DepositWithdrawal/Deposit/LibanganDeposit/LibanganDeposit.js +25 -49
  8. package/dist/components/DepositWithdrawal/Deposit/MayaDeposit/MayaDeposit.js +9 -54
  9. package/dist/components/DepositWithdrawal/Deposit/MayaWebpayDeposit/MayaWebpayDeposit.js +9 -54
  10. package/dist/components/DepositWithdrawal/Deposit/PisoPayDeposit/PisoPayDeposit.js +10 -54
  11. package/dist/styles/theme.css +1 -4
  12. package/dist/ui/AlertDialog/AlertDialog.d.ts +88 -88
  13. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +8 -8
  14. package/dist/ui/Avatar/Avatar.d.ts +9 -9
  15. package/dist/ui/Avatar/avatar.recipe.d.ts +3 -3
  16. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  17. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  18. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  19. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  20. package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
  21. package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
  22. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  23. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  24. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  25. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  26. package/dist/ui/Dialog/Dialog.d.ts +33 -33
  27. package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
  28. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  29. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  30. package/dist/ui/Menu/Menu.d.ts +144 -144
  31. package/dist/ui/Menu/menu.recipe.d.ts +8 -8
  32. package/dist/ui/NumberInput/NumberInput.d.ts +24 -24
  33. package/dist/ui/NumberInput/numberInput.recipe.d.ts +3 -3
  34. package/dist/ui/Popover/Popover.d.ts +154 -154
  35. package/dist/ui/Popover/popover.recipe.d.ts +14 -14
  36. package/dist/ui/QrCode/QrCode.d.ts +25 -25
  37. package/dist/ui/QrCode/qrCode.recipe.d.ts +5 -5
  38. package/dist/ui/Select/Select.d.ts +45 -45
  39. package/dist/ui/Select/select.recipe.d.ts +3 -3
  40. package/dist/ui/Table/Table.d.ts +21 -21
  41. package/dist/ui/Table/table.anatomy.d.ts +1 -1
  42. package/dist/ui/Table/table.recipe.d.ts +3 -3
  43. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  44. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  45. package/dist/ui/Tooltip/Tooltip.d.ts +30 -30
  46. package/dist/ui/Tooltip/tooltip.recipe.d.ts +5 -5
  47. package/package.json +1 -1
  48. package/dist/assets/providers/alize.png +0 -0
  49. package/dist/assets/providers/bigtime-gaming.png +0 -0
  50. package/dist/assets/providers/bng.png +0 -0
  51. package/dist/assets/providers/boongo.png +0 -0
  52. package/dist/assets/providers/btg.png +0 -0
  53. package/dist/assets/providers/cq9.png +0 -0
  54. package/dist/assets/providers/darwin.png +0 -0
  55. package/dist/assets/providers/digitain.png +0 -0
  56. package/dist/assets/providers/evolution.png +0 -0
  57. package/dist/assets/providers/fantasma-games.png +0 -0
  58. package/dist/assets/providers/fc.png +0 -0
  59. package/dist/assets/providers/fp.png +0 -0
  60. package/dist/assets/providers/habanero.png +0 -0
  61. package/dist/assets/providers/hacksaw.png +0 -0
  62. package/dist/assets/providers/jdb.png +0 -0
  63. package/dist/assets/providers/jili.png +0 -0
  64. package/dist/assets/providers/leap.png +0 -0
  65. package/dist/assets/providers/live-22-metaverse.png +0 -0
  66. package/dist/assets/providers/netent.png +0 -0
  67. package/dist/assets/providers/no-limit.png +0 -0
  68. package/dist/assets/providers/pg.png +0 -0
  69. package/dist/assets/providers/pgsoft.png +0 -0
  70. package/dist/assets/providers/pragmatic-play.png +0 -0
  71. package/dist/assets/providers/realtime-gaming.png +0 -0
  72. package/dist/assets/providers/redtiger.png +0 -0
  73. package/dist/assets/providers/rtg.png +0 -0
  74. package/dist/assets/providers/sagaming.png +0 -0
  75. package/dist/components/Banner/Banner.client.d.ts +0 -12
  76. package/dist/components/Banner/Banner.client.js +0 -49
  77. package/dist/components/DepositWithdrawal/AiOPaymentMethods.d.ts +0 -11
  78. package/dist/components/DepositWithdrawal/AiOPaymentMethods.js +0 -55
  79. package/dist/components/DigitainLauncher/Loading.d.ts +0 -1
  80. package/dist/components/DigitainLauncher/Loading.js +0 -5
  81. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +0 -184
  82. package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +0 -184
  83. package/dist/components/KYC/BasicInformation.d.ts +0 -1
  84. package/dist/components/KYC/BasicInformation.js +0 -101
  85. package/dist/components/KYC/IdentityVerification.d.ts +0 -1
  86. package/dist/components/KYC/IdentityVerification.js +0 -120
  87. package/dist/components/KYC/Indicator.d.ts +0 -1
  88. package/dist/components/KYC/Indicator.js +0 -8
  89. package/dist/components/KYC/KYC.lazy.d.ts +0 -6
  90. package/dist/components/KYC/KYC.lazy.js +0 -45
  91. package/dist/components/KYC/KYCContext.d.ts +0 -6
  92. package/dist/components/KYC/KYCContext.js +0 -2
  93. package/dist/components/KYC/KYCDefault/BasicInformation.d.ts +0 -1
  94. package/dist/components/KYC/KYCDefault/BasicInformation.js +0 -101
  95. package/dist/components/KYC/KYCVerificationStatus.d.ts +0 -1
  96. package/dist/components/KYC/KYCVerificationStatus.js +0 -10
  97. package/dist/components/KYC/KYCVerificationStatus.lazy.d.ts +0 -1
  98. package/dist/components/KYC/KYCVerificationStatus.lazy.js +0 -36
  99. package/dist/components/KYC/PersonalInformation.d.ts +0 -1
  100. package/dist/components/KYC/PersonalInformation.js +0 -122
  101. package/dist/components/KYC/useKYC.d.ts +0 -25
  102. package/dist/components/KYC/useKYC.js +0 -38
  103. package/dist/components/KYCNotRequired/KYCNotRequired.d.ts +0 -0
  104. package/dist/components/KYCNotRequired/KYCNotRequired.js +0 -1
  105. package/dist/components/PortalProvider/AndroidOnlyComponents.d.ts +0 -1
  106. package/dist/components/PortalProvider/AndroidOnlyComponents.js +0 -12
  107. package/dist/components/PortalProvider/CXDTokenObserver.d.ts +0 -1
  108. package/dist/components/PortalProvider/CXDTokenObserver.js +0 -30
  109. package/dist/components/PortalProvider/LinkGoogleAccountObserver.d.ts +0 -1
  110. package/dist/components/PortalProvider/LinkGoogleAccountObserver.js +0 -29
  111. package/dist/components/Quests/MultiWageringQuest.d.ts +0 -1
  112. package/dist/components/Quests/MultiWageringQuest.js +0 -111
  113. package/dist/components/SessionWatcher/SessionWatcher.d.ts +0 -1
  114. package/dist/components/SessionWatcher/SessionWatcher.js +0 -20
  115. package/dist/components/SessionWatcher/index.d.ts +0 -1
  116. package/dist/components/SessionWatcher/index.js +0 -1
  117. package/dist/components/SignIn/utils.d.ts +0 -8
  118. package/dist/components/SignIn/utils.js +0 -26
  119. package/dist/constants/Branches.d.ts +0 -2
  120. package/dist/constants/Branches.js +0 -42
  121. package/dist/images/game-providers/ALPHACHINKO.png +0 -0
  122. package/dist/images/responsible-gaming-yellow.png +0 -0
  123. package/dist/third-parties/FacebookPixel/FacebookPixel.d.ts +0 -4
  124. package/dist/third-parties/FacebookPixel/FacebookPixel.js +0 -4
  125. package/dist/third-parties/FacebookPixel/api.d.ts +0 -0
  126. package/dist/third-parties/FacebookPixel/api.js +0 -1
  127. package/dist/third-parties/FacebookPixel/index.d.ts +0 -1
  128. package/dist/third-parties/FacebookPixel/index.js +0 -1
  129. package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.d.ts +0 -4
  130. package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.js +0 -4
  131. package/dist/third-parties/GoogleRecaptcha/api.d.ts +0 -0
  132. package/dist/third-parties/GoogleRecaptcha/api.js +0 -1
  133. package/dist/third-parties/GoogleRecaptcha/index.d.ts +0 -1
  134. package/dist/third-parties/GoogleRecaptcha/index.js +0 -1
  135. package/dist/third-parties/index.d.ts +0 -2
  136. package/dist/third-parties/index.js +0 -2
@@ -4,12 +4,10 @@ import Link from 'next/link';
4
4
  import { useEffect, useState } from 'react';
5
5
  import { Controller, useForm } from 'react-hook-form';
6
6
  import invariant from 'tiny-invariant';
7
- import { useBoolean } from 'usehooks-ts';
8
7
  import { z } from 'zod';
9
8
  import { useShallow } from 'zustand/shallow';
10
9
  import { useAvailablePromosQuery } from '../../../../client/hooks/useAvailablePromosQuery.js';
11
10
  import { useCreateGCashWebpayDepositMutation } from '../../../../client/hooks/useCreateGCashWebpayDepositMutation.js';
12
- import { useDepositQuery } from '../../../../client/hooks/useDepositQuery.js';
13
11
  import { useDepositsCountQuery } from '../../../../client/hooks/useDepositsCountQuery.js';
14
12
  import { useDisclosure } from '../../../../client/hooks/useDisclosure.js';
15
13
  import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
@@ -18,7 +16,6 @@ import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSett
18
16
  import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
19
17
  import { ChevronDownIcon } from '../../../../icons/ChevronDownIcon.js';
20
18
  import { ChevronUpIcon } from '../../../../icons/ChevronUpIcon.js';
21
- import { RefreshCcw01Icon } from '../../../../icons/RefreshCcw01Icon.js';
22
19
  import { SpinnerIcon } from '../../../../icons/SpinnerIcon.js';
23
20
  import { XIcon } from '../../../../icons/XIcon.js';
24
21
  import { AlertDialog } from '../../../../ui/AlertDialog/index.js';
@@ -32,13 +29,7 @@ import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext
32
29
  import { AvailablePromos } from '../AvailablePromos.js';
33
30
  export function GCashWebpayDeposit() {
34
31
  const depositWithdrawalProps = useDepositWithdrawalPropsContext();
35
- const disclosure = useDisclosure({
36
- onOpenChange(open) {
37
- if (!open) {
38
- form.reset();
39
- }
40
- },
41
- });
32
+ const disclosure = useDisclosure();
42
33
  const globalStore = useGlobalStore(useShallow((ctx) => ({
43
34
  depositWithdrawal: ctx.depositWithdrawal,
44
35
  kycVerificationStatus: ctx.kycVerificationStatus,
@@ -60,26 +51,6 @@ export function GCashWebpayDeposit() {
60
51
  setStatus('failed');
61
52
  },
62
53
  });
63
- const warn = useBoolean();
64
- const depositQuery = useDepositQuery(createDepositMutation.data?.id, {
65
- enabled: !warn.value && status === 'success',
66
- refetchInterval: (ctx) => ctx.state.data?.status === 'CONFIRMED' ||
67
- ctx.state.data?.status === 'REJECTED' ||
68
- ctx.state.data?.status === 'CANCELLED'
69
- ? false
70
- : 1000,
71
- });
72
- useEffect(() => {
73
- if (depositQuery.data?.status === 'CONFIRMED') {
74
- setStatus('confirmed');
75
- return;
76
- }
77
- if (depositQuery.data?.status === 'REJECTED' ||
78
- depositQuery.data?.status === 'CANCELLED') {
79
- setStatus('failed');
80
- return;
81
- }
82
- }, [depositQuery.data?.status]);
83
54
  const depositsCountQuery = useDepositsCountQuery();
84
55
  const depositsCount = depositsCountQuery.data ?? 0;
85
56
  const paymentSettingsQuery = usePaymentSettingsQuery();
@@ -182,29 +153,13 @@ export function GCashWebpayDeposit() {
182
153
  globalStore.depositWithdrawal.setPromo(null);
183
154
  }, className: "mt-3xl" })) }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: createDepositMutation.isPending, children: "Deposit" }), _jsxs("p", { className: "mt-lg text-text-tertiary-600 text-xs", children: ["By depositing, 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: disclosure.open, onOpenChange: (details) => {
184
155
  disclosure.setOpen(details.open);
185
- }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: () => {
186
- setStatus('waiting');
187
- form.reset();
188
- warn.setFalse();
189
- }, 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.Context, { children: (api) => (_jsx("button", { type: "button", className: "absolute top-2.5 right-2.5 flex icon:size-6 size-11 items-center justify-center text-text-quinary", onClick: () => {
190
- if (status === 'success' && !warn.value) {
191
- warn.setTrue();
192
- }
193
- else {
156
+ if (!details.open) {
157
+ setStatus('waiting');
158
+ form.reset();
159
+ }
160
+ }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, 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, { children: _jsx(XIcon, {}) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "size-12 text-text-brand-primary-600" })), status === 'success' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-success-secondary text-text-featured-icon-light-success", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Deposit', status === 'success' && 'Deposit Successful', status === 'failed' && 'Deposit Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
161
+ "We're verifying your account and amount. Please hold a moment.", status === 'success' && (_jsxs(_Fragment, { children: ["Your deposit has been successfully processed. ", _jsx("br", {}), " If you are not redirected automatically, click", ' ', !!createDepositMutation.data?.checkoutUrl && (_jsx("a", { href: createDepositMutation.data?.checkoutUrl, target: "_blank", rel: "noopener noreferrer", className: "text-text-brand underline underline-offset-2", children: "here" })), "."] })), status === 'failed' &&
162
+ 'Something went wrong while processing your deposit. Please try again or contact support.'] })] }), (status === 'failed' || status === 'success') && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
194
163
  api.setOpen(false);
195
- }
196
- }, children: _jsx(XIcon, {}) })) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "size-12 text-text-brand-primary-600" })), status === 'success' && !warn.value && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-brand-secondary text-text-featured-icon-light-brand", children: _jsx(RefreshCcw01Icon, {}) })), status === 'success' && warn.value && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) })), status === 'confirmed' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-success-secondary text-text-featured-icon-light-success", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Deposit', status === 'success' &&
197
- !warn.value &&
198
- 'Didn’t see the payment window?', status === 'success' && warn.value && (_jsx(_Fragment, { children: "Are you sure you want to close this\u00A0window?" })), status === 'confirmed' && 'Deposit Successful', status === 'failed' && 'Deposit Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
199
- "We're verifying your account and amount. Please hold a moment.", status === 'success' &&
200
- !warn.value &&
201
- 'Sometimes the payment pop up doesn’t appear right away. Don’t worry, just click the button below to reopen it and continue your deposit.', status === 'success' &&
202
- warn.value &&
203
- 'Closing this window might cancel your current deposit. Do you want to continue?', status === 'confirmed' &&
204
- 'Your deposit has been successfully processed.', status === 'failed' &&
205
- 'Something went wrong while processing your deposit. Please try again or contact support.'] })] }), (status === 'failed' ||
206
- status === 'success' ||
207
- status === 'confirmed') && (_jsxs(AlertDialog.Footer, { children: [status === 'success' && !warn.value && (_jsx(Button, { asChild: true, children: _jsx("a", { href: createDepositMutation.data?.checkoutUrl ?? '', target: "_blank", rel: "noopener noreferrer", children: "Try Again" }) })), status === 'success' && warn.value && (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", onClick: () => {
208
- warn.setFalse();
209
- }, children: "Go back" }), _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => api.setOpen(false), children: "Continue" })) })] })), status !== 'success' && (_jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => api.setOpen(false), children: "Ok" })) }))] }))] }) })] }) })] }));
164
+ }, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
210
165
  }
@@ -4,7 +4,6 @@ import Link from 'next/link';
4
4
  import { useEffect, useState } from 'react';
5
5
  import { Controller, useForm } from 'react-hook-form';
6
6
  import invariant from 'tiny-invariant';
7
- import { useBoolean } from 'usehooks-ts';
8
7
  import { z } from 'zod';
9
8
  import { useShallow } from 'zustand/shallow';
10
9
  import { useAvailablePromosQuery } from '../../../../client/hooks/useAvailablePromosQuery.js';
@@ -18,7 +17,6 @@ import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSett
18
17
  import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
19
18
  import { ChevronDownIcon } from '../../../../icons/ChevronDownIcon.js';
20
19
  import { ChevronUpIcon } from '../../../../icons/ChevronUpIcon.js';
21
- import { RefreshCcw01Icon } from '../../../../icons/RefreshCcw01Icon.js';
22
20
  import { SpinnerIcon } from '../../../../icons/SpinnerIcon.js';
23
21
  import { XIcon } from '../../../../icons/XIcon.js';
24
22
  import { AlertDialog } from '../../../../ui/AlertDialog/index.js';
@@ -32,13 +30,7 @@ import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext
32
30
  import { AvailablePromos } from '../AvailablePromos.js';
33
31
  export function LibanganDeposit() {
34
32
  const depositWithdrawalProps = useDepositWithdrawalPropsContext();
35
- const disclosure = useDisclosure({
36
- onOpenChange(open) {
37
- if (!open) {
38
- form.reset();
39
- }
40
- },
41
- });
33
+ const disclosure = useDisclosure();
42
34
  const globalStore = useGlobalStore(useShallow((ctx) => ({
43
35
  depositWithdrawal: ctx.depositWithdrawal,
44
36
  kycVerificationStatus: ctx.kycVerificationStatus,
@@ -54,32 +46,36 @@ export function LibanganDeposit() {
54
46
  onSuccess(data) {
55
47
  invariant(data.checkoutUrl);
56
48
  window.open(data.checkoutUrl, '_blank', 'noopener,noreferrer');
57
- setStatus('success');
49
+ form.reset();
50
+ disclosure.setOpen(false);
58
51
  },
59
52
  onError() {
53
+ disclosure.setOpen(true);
60
54
  setStatus('failed');
61
55
  },
62
56
  });
63
- const warn = useBoolean();
64
57
  const depositQuery = useDepositQuery(createDepositMutation.data?.id, {
65
- enabled: !warn.value && status === 'success',
66
- refetchInterval: (ctx) => ctx.state.data?.status === 'CONFIRMED' ||
67
- ctx.state.data?.status === 'REJECTED' ||
68
- ctx.state.data?.status === 'CANCELLED'
69
- ? false
70
- : 1000,
58
+ enabled: createDepositMutation.data != null,
59
+ refetchInterval(ctx) {
60
+ if (ctx.state.data?.status === 'CANCELLED' ||
61
+ ctx.state.data?.status === 'CONFIRMED') {
62
+ return false;
63
+ }
64
+ else {
65
+ return 2500;
66
+ }
67
+ },
71
68
  });
72
69
  useEffect(() => {
73
- if (depositQuery.data?.status === 'CONFIRMED') {
74
- setStatus('confirmed');
75
- return;
76
- }
77
- if (depositQuery.data?.status === 'REJECTED' ||
78
- depositQuery.data?.status === 'CANCELLED') {
70
+ if (depositQuery.data?.status === 'CANCELLED') {
71
+ disclosure.setOpen(true);
79
72
  setStatus('failed');
80
- return;
81
73
  }
82
- }, [depositQuery.data?.status]);
74
+ else if (depositQuery.data?.status === 'CONFIRMED') {
75
+ disclosure.setOpen(true);
76
+ setStatus('success');
77
+ }
78
+ }, [depositQuery.data?.status, disclosure]);
83
79
  const depositsCountQuery = useDepositsCountQuery();
84
80
  const depositsCount = depositsCountQuery.data ?? 0;
85
81
  const paymentSettingsQuery = usePaymentSettingsQuery();
@@ -182,29 +178,9 @@ export function LibanganDeposit() {
182
178
  globalStore.depositWithdrawal.setPromo(null);
183
179
  }, className: "mt-3xl" })) }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: createDepositMutation.isPending, children: "Deposit" }), depositWithdrawalProps.hasPrivacyPolicyAndTermsOfUse && (_jsxs("p", { className: "mt-lg text-text-tertiary-600 text-xs", children: ["By depositing, 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: disclosure.open, onOpenChange: (details) => {
184
180
  disclosure.setOpen(details.open);
185
- }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: () => {
186
- setStatus('waiting');
187
- form.reset();
188
- warn.setFalse();
189
- }, 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.Context, { children: (api) => (_jsx("button", { type: "button", className: "absolute top-2.5 right-2.5 flex icon:size-6 size-11 items-center justify-center text-text-quinary", onClick: () => {
190
- if (status === 'success' && !warn.value) {
191
- warn.setTrue();
192
- }
193
- else {
181
+ }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, 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, { children: _jsx(XIcon, {}) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "size-12 text-text-brand-primary-600" })), status === 'success' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-success-secondary text-text-featured-icon-light-success", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Deposit', status === 'success' && 'Deposit Successful', status === 'failed' && 'Deposit Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
182
+ "We're verifying your account and amount. Please hold a moment.", status === 'success' && (_jsxs(_Fragment, { children: ["Your deposit has been successfully processed. ", _jsx("br", {}), " If you are not redirected automatically, click", ' ', !!createDepositMutation.data?.checkoutUrl && (_jsx("a", { href: createDepositMutation.data?.checkoutUrl, target: "_blank", rel: "noopener noreferrer", className: "text-text-brand underline underline-offset-2", children: "here" })), "."] })), status === 'failed' &&
183
+ 'Something went wrong while processing your deposit. Please try again or contact support.'] })] }), (status === 'failed' || status === 'success') && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
194
184
  api.setOpen(false);
195
- }
196
- }, children: _jsx(XIcon, {}) })) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "size-12 text-text-brand-primary-600" })), status === 'success' && !warn.value && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-brand-secondary text-text-featured-icon-light-brand", children: _jsx(RefreshCcw01Icon, {}) })), status === 'success' && warn.value && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) })), status === 'confirmed' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-success-secondary text-text-featured-icon-light-success", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Deposit', status === 'success' &&
197
- !warn.value &&
198
- 'Didn’t see the payment window?', status === 'success' && warn.value && (_jsx(_Fragment, { children: "Are you sure you want to close this\u00A0window?" })), status === 'confirmed' && 'Deposit Successful', status === 'failed' && 'Deposit Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
199
- "We're verifying your account and amount. Please hold a moment.", status === 'success' &&
200
- !warn.value &&
201
- 'Sometimes the payment pop up doesn’t appear right away. Don’t worry, just click the button below to reopen it and continue your deposit.', status === 'success' &&
202
- warn.value &&
203
- 'Closing this window might cancel your current deposit. Do you want to continue?', status === 'confirmed' &&
204
- 'Your deposit has been successfully processed.', status === 'failed' &&
205
- 'Something went wrong while processing your deposit. Please try again or contact support.'] })] }), (status === 'failed' ||
206
- status === 'success' ||
207
- status === 'confirmed') && (_jsxs(AlertDialog.Footer, { children: [status === 'success' && !warn.value && (_jsx(Button, { asChild: true, children: _jsx("a", { href: createDepositMutation.data?.checkoutUrl ?? '', target: "_blank", rel: "noopener noreferrer", children: "Try Again" }) })), status === 'success' && warn.value && (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", onClick: () => {
208
- warn.setFalse();
209
- }, children: "Go back" }), _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => api.setOpen(false), children: "Continue" })) })] })), status !== 'success' && (_jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => api.setOpen(false), children: "Ok" })) }))] }))] }) })] }) })] }));
185
+ }, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
210
186
  }
@@ -4,12 +4,10 @@ import Link from 'next/link';
4
4
  import { useEffect, useState } from 'react';
5
5
  import { Controller, useForm } from 'react-hook-form';
6
6
  import invariant from 'tiny-invariant';
7
- import { useBoolean } from 'usehooks-ts';
8
7
  import { z } from 'zod';
9
8
  import { useShallow } from 'zustand/shallow';
10
9
  import { useAvailablePromosQuery } from '../../../../client/hooks/useAvailablePromosQuery.js';
11
10
  import { useCreateMayaDepositMutation } from '../../../../client/hooks/useCreateMayaDepositMutation.js';
12
- import { useDepositQuery } from '../../../../client/hooks/useDepositQuery.js';
13
11
  import { useDepositsCountQuery } from '../../../../client/hooks/useDepositsCountQuery.js';
14
12
  import { useDisclosure } from '../../../../client/hooks/useDisclosure.js';
15
13
  import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
@@ -18,7 +16,6 @@ import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSett
18
16
  import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
19
17
  import { ChevronDownIcon } from '../../../../icons/ChevronDownIcon.js';
20
18
  import { ChevronUpIcon } from '../../../../icons/ChevronUpIcon.js';
21
- import { RefreshCcw01Icon } from '../../../../icons/RefreshCcw01Icon.js';
22
19
  import { SpinnerIcon } from '../../../../icons/SpinnerIcon.js';
23
20
  import { XIcon } from '../../../../icons/XIcon.js';
24
21
  import { AlertDialog } from '../../../../ui/AlertDialog/index.js';
@@ -32,13 +29,7 @@ import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext
32
29
  import { AvailablePromos } from '../AvailablePromos.js';
33
30
  export function MayaDeposit() {
34
31
  const depositWithdrawalProps = useDepositWithdrawalPropsContext();
35
- const disclosure = useDisclosure({
36
- onOpenChange(open) {
37
- if (!open) {
38
- form.reset();
39
- }
40
- },
41
- });
32
+ const disclosure = useDisclosure();
42
33
  const globalStore = useGlobalStore(useShallow((ctx) => ({
43
34
  depositWithdrawal: ctx.depositWithdrawal,
44
35
  kycVerificationStatus: ctx.kycVerificationStatus,
@@ -60,26 +51,6 @@ export function MayaDeposit() {
60
51
  setStatus('failed');
61
52
  },
62
53
  });
63
- const warn = useBoolean();
64
- const depositQuery = useDepositQuery(createDepositMutation.data?.id, {
65
- enabled: !warn.value && status === 'success',
66
- refetchInterval: (ctx) => ctx.state.data?.status === 'CONFIRMED' ||
67
- ctx.state.data?.status === 'REJECTED' ||
68
- ctx.state.data?.status === 'CANCELLED'
69
- ? false
70
- : 1000,
71
- });
72
- useEffect(() => {
73
- if (depositQuery.data?.status === 'CONFIRMED') {
74
- setStatus('confirmed');
75
- return;
76
- }
77
- if (depositQuery.data?.status === 'REJECTED' ||
78
- depositQuery.data?.status === 'CANCELLED') {
79
- setStatus('failed');
80
- return;
81
- }
82
- }, [depositQuery.data?.status]);
83
54
  const depositsCountQuery = useDepositsCountQuery();
84
55
  const depositsCount = depositsCountQuery.data ?? 0;
85
56
  const paymentSettingsQuery = usePaymentSettingsQuery();
@@ -180,29 +151,13 @@ export function MayaDeposit() {
180
151
  globalStore.depositWithdrawal.setPromo(null);
181
152
  }, className: "mt-3xl" })) }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: createDepositMutation.isPending, children: "Deposit" }), depositWithdrawalProps.hasPrivacyPolicyAndTermsOfUse && (_jsxs("p", { className: "mt-lg text-text-tertiary-600 text-xs", children: ["By depositing, 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: disclosure.open, onOpenChange: (details) => {
182
153
  disclosure.setOpen(details.open);
183
- }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: () => {
184
- setStatus('waiting');
185
- form.reset();
186
- warn.setFalse();
187
- }, 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.Context, { children: (api) => (_jsx("button", { type: "button", className: "absolute top-2.5 right-2.5 flex icon:size-6 size-11 items-center justify-center text-text-quinary", onClick: () => {
188
- if (status === 'success' && !warn.value) {
189
- warn.setTrue();
190
- }
191
- else {
154
+ if (!details.open) {
155
+ setStatus('waiting');
156
+ form.reset();
157
+ }
158
+ }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, 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, { children: _jsx(XIcon, {}) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "size-12 text-text-brand-primary-600" })), status === 'success' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-success-secondary text-text-featured-icon-light-success", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Deposit', status === 'success' && 'Deposit Successful', status === 'failed' && 'Deposit Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
159
+ "We're verifying your account and amount. Please hold a moment.", status === 'success' && (_jsxs(_Fragment, { children: ["Your deposit has been successfully processed. ", _jsx("br", {}), " If you are not redirected automatically, click", ' ', !!createDepositMutation.data?.checkoutUrl && (_jsx("a", { href: createDepositMutation.data?.checkoutUrl, target: "_blank", rel: "noopener noreferrer", className: "text-text-brand underline underline-offset-2", children: "here" })), "."] })), status === 'failed' &&
160
+ 'Something went wrong while processing your deposit. Please try again or contact support.'] })] }), (status === 'failed' || status === 'success') && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
192
161
  api.setOpen(false);
193
- }
194
- }, children: _jsx(XIcon, {}) })) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "size-12 text-text-brand-primary-600" })), status === 'success' && !warn.value && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-brand-secondary text-text-featured-icon-light-brand", children: _jsx(RefreshCcw01Icon, {}) })), status === 'success' && warn.value && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) })), status === 'confirmed' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-success-secondary text-text-featured-icon-light-success", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Deposit', status === 'success' &&
195
- !warn.value &&
196
- 'Didn’t see the payment window?', status === 'success' && warn.value && (_jsx(_Fragment, { children: "Are you sure you want to close this\u00A0window?" })), status === 'confirmed' && 'Deposit Successful', status === 'failed' && 'Deposit Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
197
- "We're verifying your account and amount. Please hold a moment.", status === 'success' &&
198
- !warn.value &&
199
- 'Sometimes the payment pop up doesn’t appear right away. Don’t worry, just click the button below to reopen it and continue your deposit.', status === 'success' &&
200
- warn.value &&
201
- 'Closing this window might cancel your current deposit. Do you want to continue?', status === 'confirmed' &&
202
- 'Your deposit has been successfully processed.', status === 'failed' &&
203
- 'Something went wrong while processing your deposit. Please try again or contact support.'] })] }), (status === 'failed' ||
204
- status === 'success' ||
205
- status === 'confirmed') && (_jsxs(AlertDialog.Footer, { children: [status === 'success' && !warn.value && (_jsx(Button, { asChild: true, children: _jsx("a", { href: createDepositMutation.data?.checkoutUrl ?? '', target: "_blank", rel: "noopener noreferrer", children: "Try Again" }) })), status === 'success' && warn.value && (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", onClick: () => {
206
- warn.setFalse();
207
- }, children: "Go back" }), _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => api.setOpen(false), children: "Continue" })) })] })), status !== 'success' && (_jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => api.setOpen(false), children: "Ok" })) }))] }))] }) })] }) })] }));
162
+ }, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
208
163
  }
@@ -4,12 +4,10 @@ import Link from 'next/link';
4
4
  import { useEffect, useState } from 'react';
5
5
  import { Controller, useForm } from 'react-hook-form';
6
6
  import invariant from 'tiny-invariant';
7
- import { useBoolean } from 'usehooks-ts';
8
7
  import { z } from 'zod';
9
8
  import { useShallow } from 'zustand/shallow';
10
9
  import { useAvailablePromosQuery } from '../../../../client/hooks/useAvailablePromosQuery.js';
11
10
  import { useCreateMayaWebpayDepositMutation } from '../../../../client/hooks/useCreateMayaWebpayDepositMutation.js';
12
- import { useDepositQuery } from '../../../../client/hooks/useDepositQuery.js';
13
11
  import { useDepositsCountQuery } from '../../../../client/hooks/useDepositsCountQuery.js';
14
12
  import { useDisclosure } from '../../../../client/hooks/useDisclosure.js';
15
13
  import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
@@ -18,7 +16,6 @@ import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSett
18
16
  import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
19
17
  import { ChevronDownIcon } from '../../../../icons/ChevronDownIcon.js';
20
18
  import { ChevronUpIcon } from '../../../../icons/ChevronUpIcon.js';
21
- import { RefreshCcw01Icon } from '../../../../icons/RefreshCcw01Icon.js';
22
19
  import { SpinnerIcon } from '../../../../icons/SpinnerIcon.js';
23
20
  import { XIcon } from '../../../../icons/XIcon.js';
24
21
  import { AlertDialog } from '../../../../ui/AlertDialog/index.js';
@@ -32,13 +29,7 @@ import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext
32
29
  import { AvailablePromos } from '../AvailablePromos.js';
33
30
  export function MayaWebpayDeposit() {
34
31
  const depositWithdrawalProps = useDepositWithdrawalPropsContext();
35
- const disclosure = useDisclosure({
36
- onOpenChange(open) {
37
- if (!open) {
38
- form.reset();
39
- }
40
- },
41
- });
32
+ const disclosure = useDisclosure();
42
33
  const globalStore = useGlobalStore(useShallow((ctx) => ({
43
34
  depositWithdrawal: ctx.depositWithdrawal,
44
35
  kycVerificationStatus: ctx.kycVerificationStatus,
@@ -60,26 +51,6 @@ export function MayaWebpayDeposit() {
60
51
  setStatus('failed');
61
52
  },
62
53
  });
63
- const warn = useBoolean();
64
- const depositQuery = useDepositQuery(createDepositMutation.data?.id, {
65
- enabled: !warn.value && status === 'success',
66
- refetchInterval: (ctx) => ctx.state.data?.status === 'CONFIRMED' ||
67
- ctx.state.data?.status === 'REJECTED' ||
68
- ctx.state.data?.status === 'CANCELLED'
69
- ? false
70
- : 1000,
71
- });
72
- useEffect(() => {
73
- if (depositQuery.data?.status === 'CONFIRMED') {
74
- setStatus('confirmed');
75
- return;
76
- }
77
- if (depositQuery.data?.status === 'REJECTED' ||
78
- depositQuery.data?.status === 'CANCELLED') {
79
- setStatus('failed');
80
- return;
81
- }
82
- }, [depositQuery.data?.status]);
83
54
  const depositsCountQuery = useDepositsCountQuery();
84
55
  const depositsCount = depositsCountQuery.data ?? 0;
85
56
  const paymentSettingsQuery = usePaymentSettingsQuery();
@@ -183,29 +154,13 @@ export function MayaWebpayDeposit() {
183
154
  globalStore.depositWithdrawal.setPromo(null);
184
155
  }, className: "mt-3xl" })) }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: createDepositMutation.isPending, children: "Deposit" }), _jsxs("p", { className: "mt-lg text-text-tertiary-600 text-xs", children: ["By depositing, 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: disclosure.open, onOpenChange: (details) => {
185
156
  disclosure.setOpen(details.open);
186
- }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: () => {
187
- setStatus('waiting');
188
- form.reset();
189
- warn.setFalse();
190
- }, 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.Context, { children: (api) => (_jsx("button", { type: "button", className: "absolute top-2.5 right-2.5 flex icon:size-6 size-11 items-center justify-center text-text-quinary", onClick: () => {
191
- if (status === 'success' && !warn.value) {
192
- warn.setTrue();
193
- }
194
- else {
157
+ if (!details.open) {
158
+ setStatus('waiting');
159
+ form.reset();
160
+ }
161
+ }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, 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, { children: _jsx(XIcon, {}) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "size-12 text-text-brand-primary-600" })), status === 'success' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-success-secondary text-text-featured-icon-light-success", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Deposit', status === 'success' && 'Deposit Successful', status === 'failed' && 'Deposit Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
162
+ "We're verifying your account and amount. Please hold a moment.", status === 'success' && (_jsxs(_Fragment, { children: ["Your deposit has been successfully processed. ", _jsx("br", {}), " If you are not redirected automatically, click", ' ', !!createDepositMutation.data?.checkoutUrl && (_jsx("a", { href: createDepositMutation.data?.checkoutUrl, target: "_blank", rel: "noopener noreferrer", className: "text-text-brand underline underline-offset-2", children: "here" })), "."] })), status === 'failed' &&
163
+ 'Something went wrong while processing your deposit. Please try again or contact support.'] })] }), (status === 'failed' || status === 'success') && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
195
164
  api.setOpen(false);
196
- }
197
- }, children: _jsx(XIcon, {}) })) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "size-12 text-text-brand-primary-600" })), status === 'success' && !warn.value && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-brand-secondary text-text-featured-icon-light-brand", children: _jsx(RefreshCcw01Icon, {}) })), status === 'success' && warn.value && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) })), status === 'confirmed' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-success-secondary text-text-featured-icon-light-success", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Deposit', status === 'success' &&
198
- !warn.value &&
199
- 'Didn’t see the payment window?', status === 'success' && warn.value && (_jsx(_Fragment, { children: "Are you sure you want to close this\u00A0window?" })), status === 'confirmed' && 'Deposit Successful', status === 'failed' && 'Deposit Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
200
- "We're verifying your account and amount. Please hold a moment.", status === 'success' &&
201
- !warn.value &&
202
- 'Sometimes the payment pop up doesn’t appear right away. Don’t worry, just click the button below to reopen it and continue your deposit.', status === 'success' &&
203
- warn.value &&
204
- 'Closing this window might cancel your current deposit. Do you want to continue?', status === 'confirmed' &&
205
- 'Your deposit has been successfully processed.', status === 'failed' &&
206
- 'Something went wrong while processing your deposit. Please try again or contact support.'] })] }), (status === 'failed' ||
207
- status === 'success' ||
208
- status === 'confirmed') && (_jsxs(AlertDialog.Footer, { children: [status === 'success' && !warn.value && (_jsx(Button, { asChild: true, children: _jsx("a", { href: createDepositMutation.data?.checkoutUrl ?? '', target: "_blank", rel: "noopener noreferrer", children: "Try Again" }) })), status === 'success' && warn.value && (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", onClick: () => {
209
- warn.setFalse();
210
- }, children: "Go back" }), _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => api.setOpen(false), children: "Continue" })) })] })), status !== 'success' && (_jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => api.setOpen(false), children: "Ok" })) }))] }))] }) })] }) })] }));
165
+ }, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
211
166
  }
@@ -5,19 +5,16 @@ import Link from 'next/link';
5
5
  import { useEffect, useState } from 'react';
6
6
  import { Controller, useForm } from 'react-hook-form';
7
7
  import invariant from 'tiny-invariant';
8
- import { useBoolean } from 'usehooks-ts';
9
8
  import { z } from 'zod';
10
9
  import { useShallow } from 'zustand/shallow';
11
10
  import { useAvailablePromosQuery } from '../../../../client/hooks/useAvailablePromosQuery.js';
12
11
  import { useCreatePisoPayDepositMutation } from '../../../../client/hooks/useCreatePisoPayDepositMutation.js';
13
- import { useDepositQuery } from '../../../../client/hooks/useDepositQuery.js';
14
12
  import { useDepositsCountQuery } from '../../../../client/hooks/useDepositsCountQuery.js';
15
13
  import { useDisclosure } from '../../../../client/hooks/useDisclosure.js';
16
14
  import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
17
15
  import { useMemberVerificationQuery } from '../../../../client/hooks/useMemberVerificationQuery.js';
18
16
  import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSettingsQuery.js';
19
17
  import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
20
- import { RefreshCcw01Icon } from '../../../../icons/RefreshCcw01Icon.js';
21
18
  import { SpinnerIcon } from '../../../../icons/SpinnerIcon.js';
22
19
  import { XIcon } from '../../../../icons/XIcon.js';
23
20
  import { ObjectType } from '../../../../services/ObjectType.js';
@@ -30,16 +27,11 @@ import { parseDecimal } from '../../../../utils/parseDecimal.js';
30
27
  import { getDepositsCountQueryKey } from '../../../../utils/queryKeys.js';
31
28
  import { AmountChoices } from '../../AmountChoices.js';
32
29
  import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext.js';
30
+ import { explainError } from '../../utils.js';
33
31
  import { AvailablePromos } from '../AvailablePromos.js';
34
32
  export function PisoPayDeposit() {
35
33
  const depositWithdrawalProps = useDepositWithdrawalPropsContext();
36
- const disclosure = useDisclosure({
37
- onOpenChange(open) {
38
- if (!open) {
39
- form.reset();
40
- }
41
- },
42
- });
34
+ const disclosure = useDisclosure();
43
35
  const globalStore = useGlobalStore(useShallow((ctx) => ({
44
36
  depositWithdrawal: ctx.depositWithdrawal,
45
37
  kycVerificationStatus: ctx.kycVerificationStatus,
@@ -63,26 +55,6 @@ export function PisoPayDeposit() {
63
55
  setStatus('failed');
64
56
  },
65
57
  });
66
- const warn = useBoolean();
67
- const depositQuery = useDepositQuery(createDepositMutation.data?.id, {
68
- enabled: !warn.value && status === 'success',
69
- refetchInterval: (ctx) => ctx.state.data?.status === 'CONFIRMED' ||
70
- ctx.state.data?.status === 'REJECTED' ||
71
- ctx.state.data?.status === 'CANCELLED'
72
- ? false
73
- : 1000,
74
- });
75
- useEffect(() => {
76
- if (depositQuery.data?.status === 'CONFIRMED') {
77
- setStatus('confirmed');
78
- return;
79
- }
80
- if (depositQuery.data?.status === 'REJECTED' ||
81
- depositQuery.data?.status === 'CANCELLED') {
82
- setStatus('failed');
83
- return;
84
- }
85
- }, [depositQuery.data?.status]);
86
58
  const depositsCountQuery = useDepositsCountQuery();
87
59
  const depositsCount = depositsCountQuery.data ?? 0;
88
60
  const paymentSettingsQuery = usePaymentSettingsQuery();
@@ -196,29 +168,13 @@ export function PisoPayDeposit() {
196
168
  globalStore.depositWithdrawal.setPromo(null);
197
169
  }, className: "mt-3xl" })) }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: createDepositMutation.isPending, children: "Deposit" }), depositWithdrawalProps.hasPrivacyPolicyAndTermsOfUse && (_jsxs("p", { className: "mt-lg text-text-tertiary-600 text-xs", children: ["By depositing, 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: disclosure.open, onOpenChange: (details) => {
198
170
  disclosure.setOpen(details.open);
199
- }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: () => {
200
- setStatus('waiting');
201
- form.reset();
202
- warn.setFalse();
203
- }, 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.Context, { children: (api) => (_jsx("button", { type: "button", className: "absolute top-2.5 right-2.5 flex icon:size-6 size-11 items-center justify-center text-text-quinary", onClick: () => {
204
- if (status === 'success' && !warn.value) {
205
- warn.setTrue();
206
- }
207
- else {
171
+ if (!details.open) {
172
+ setStatus('waiting');
173
+ form.reset();
174
+ }
175
+ }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, 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, { children: _jsx(XIcon, {}) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "size-12 text-text-brand-primary-600" })), status === 'success' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-success-secondary text-text-featured-icon-light-success", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Deposit', status === 'success' && 'Deposit Successful', status === 'failed' && 'Deposit Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
176
+ "We're verifying your account and amount. Please hold a moment.", status === 'success' && (_jsxs(_Fragment, { children: ["Your deposit has been successfully processed. ", _jsx("br", {}), " If you are not redirected automatically, click", ' ', !!createDepositMutation.data?.checkoutUrl && (_jsx("a", { href: createDepositMutation.data?.checkoutUrl, target: "_blank", rel: "noopener noreferrer", className: "text-text-brand underline underline-offset-2", children: "here" })), "."] })), status === 'failed' &&
177
+ explainError(createDepositMutation?.error?.name)] })] }), (status === 'failed' || status === 'success') && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
208
178
  api.setOpen(false);
209
- }
210
- }, children: _jsx(XIcon, {}) })) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "size-12 text-text-brand-primary-600" })), status === 'success' && !warn.value && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-brand-secondary text-text-featured-icon-light-brand", children: _jsx(RefreshCcw01Icon, {}) })), status === 'success' && warn.value && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) })), status === 'confirmed' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-success-secondary text-text-featured-icon-light-success", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Deposit', status === 'success' &&
211
- !warn.value &&
212
- 'Didn’t see the payment window?', status === 'success' && warn.value && (_jsx(_Fragment, { children: "Are you sure you want to close this\u00A0window?" })), status === 'confirmed' && 'Deposit Successful', status === 'failed' && 'Deposit Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
213
- "We're verifying your account and amount. Please hold a moment.", status === 'success' &&
214
- !warn.value &&
215
- 'Sometimes the payment pop up doesn’t appear right away. Don’t worry, just click the button below to reopen it and continue your deposit.', status === 'success' &&
216
- warn.value &&
217
- 'Closing this window might cancel your current deposit. Do you want to continue?', status === 'confirmed' &&
218
- 'Your deposit has been successfully processed.', status === 'failed' &&
219
- 'Something went wrong while processing your deposit. Please try again or contact support.'] })] }), (status === 'failed' ||
220
- status === 'success' ||
221
- status === 'confirmed') && (_jsxs(AlertDialog.Footer, { children: [status === 'success' && !warn.value && (_jsx(Button, { asChild: true, children: _jsx("a", { href: createDepositMutation.data?.checkoutUrl ?? '', target: "_blank", rel: "noopener noreferrer", children: "Try Again" }) })), status === 'success' && warn.value && (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", onClick: () => {
222
- warn.setFalse();
223
- }, children: "Go back" }), _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => api.setOpen(false), children: "Continue" })) })] })), status !== 'success' && (_jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => api.setOpen(false), children: "Ok" })) }))] }))] }) })] }) })] }));
179
+ }, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
224
180
  }
@@ -264,13 +264,10 @@
264
264
  --color-text-warning-primary: #f79009;
265
265
  --color-text-warning-primary-600: #fdb022;
266
266
  --color-text-error-primary: #f04438;
267
- --color-dark-text: #cccccc;
268
-
269
267
  --color-text-featured-icon-light-success: #abefc6;
270
268
  --color-text-featured-icon-light-error: #fecdca;
271
269
  --color-text-featured-icon-light-warning: #fedf89;
272
- --color-text-featured-icon-light-warning: #fedf89;
273
- --color-text-featured-icon-light-brand: #E4D5A4;
270
+ --color-dark-text: #cccccc;
274
271
 
275
272
  --color-border-primary: #373a41;
276
273
  --color-border-secondary: #22262f;