@opexa/portal-components 0.0.925 → 0.0.926

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 (201) hide show
  1. package/dist/assets/providers/alize.png +0 -0
  2. package/dist/assets/providers/bigtime-gaming.png +0 -0
  3. package/dist/assets/providers/bng.png +0 -0
  4. package/dist/assets/providers/boongo.png +0 -0
  5. package/dist/assets/providers/btg.png +0 -0
  6. package/dist/assets/providers/cq9.png +0 -0
  7. package/dist/assets/providers/darwin.png +0 -0
  8. package/dist/assets/providers/digitain.png +0 -0
  9. package/dist/assets/providers/evolution.png +0 -0
  10. package/dist/assets/providers/fantasma-games.png +0 -0
  11. package/dist/assets/providers/fc.png +0 -0
  12. package/dist/assets/providers/fp.png +0 -0
  13. package/dist/assets/providers/habanero.png +0 -0
  14. package/dist/assets/providers/hacksaw.png +0 -0
  15. package/dist/assets/providers/jdb.png +0 -0
  16. package/dist/assets/providers/jili.png +0 -0
  17. package/dist/assets/providers/leap.png +0 -0
  18. package/dist/assets/providers/live-22-metaverse.png +0 -0
  19. package/dist/assets/providers/netent.png +0 -0
  20. package/dist/assets/providers/no-limit.png +0 -0
  21. package/dist/assets/providers/pg.png +0 -0
  22. package/dist/assets/providers/pgsoft.png +0 -0
  23. package/dist/assets/providers/pragmatic-play.png +0 -0
  24. package/dist/assets/providers/realtime-gaming.png +0 -0
  25. package/dist/assets/providers/redtiger.png +0 -0
  26. package/dist/assets/providers/rtg.png +0 -0
  27. package/dist/assets/providers/sagaming.png +0 -0
  28. package/dist/client/hooks/useAiOGCashDepositMutation.d.ts +4 -0
  29. package/dist/client/hooks/useAiOGCashDepositMutation.js +90 -0
  30. package/dist/client/hooks/useAiOGrabPayDepositMutation.d.ts +4 -0
  31. package/dist/client/hooks/useAiOGrabPayDepositMutation.js +80 -0
  32. package/dist/client/hooks/useAiOPalawanPayDepositMutation.d.ts +4 -0
  33. package/dist/client/hooks/useAiOPalawanPayDepositMutation.js +80 -0
  34. package/dist/client/hooks/useAiOPayMayaDepositMutation.d.ts +4 -0
  35. package/dist/client/hooks/useAiOPayMayaDepositMutation.js +80 -0
  36. package/dist/client/hooks/useRedeemVoucherMutation.d.ts +3 -0
  37. package/dist/client/hooks/useRedeemVoucherMutation.js +24 -0
  38. package/dist/components/Banner/Banner.client.d.ts +12 -0
  39. package/dist/components/Banner/Banner.client.js +49 -0
  40. package/dist/components/DepositWithdrawal/AiOPaymentMethods.d.ts +11 -0
  41. package/dist/components/DepositWithdrawal/AiOPaymentMethods.js +55 -0
  42. package/dist/components/DepositWithdrawal/Deposit/AurixPayPayMayaDeposit/AurixPayGrabPayDeposit.js +21 -2
  43. package/dist/components/DepositWithdrawal/Deposit/Deposit.js +6 -1
  44. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositAlert.d.ts +1 -0
  45. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositAlert.js +99 -0
  46. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositDetails.d.ts +1 -0
  47. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositDetails.js +17 -0
  48. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositForm.d.ts +1 -0
  49. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositForm.js +116 -0
  50. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHQRCode.d.ts +3 -0
  51. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHQRCode.js +69 -0
  52. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDeposit.d.ts +1 -0
  53. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDeposit.js +10 -0
  54. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositAlert.d.ts +1 -0
  55. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositAlert.js +99 -0
  56. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositContext.d.ts +25 -0
  57. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositContext.js +2 -0
  58. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositDetails.d.ts +1 -0
  59. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositDetails.js +17 -0
  60. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositForm.d.ts +1 -0
  61. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositForm.js +116 -0
  62. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHQRCode.d.ts +3 -0
  63. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHQRCode.js +69 -0
  64. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/useQRPHDeposit.d.ts +13 -0
  65. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/useQRPHDeposit.js +85 -0
  66. package/dist/components/DepositWithdrawal/Deposit/Voucher/Voucher.d.ts +1 -0
  67. package/dist/components/DepositWithdrawal/Deposit/Voucher/Voucher.js +86 -0
  68. package/dist/components/DepositWithdrawal/Deposit/Voucher/definition.d.ts +11 -0
  69. package/dist/components/DepositWithdrawal/Deposit/Voucher/definition.js +6 -0
  70. package/dist/components/DepositWithdrawal/Deposit__legacy/AiOGCashDeposit/AiOGCashDeposit.d.ts +1 -0
  71. package/dist/components/DepositWithdrawal/Deposit__legacy/AiOGCashDeposit/AiOGCashDeposit.js +173 -0
  72. package/dist/components/DepositWithdrawal/Deposit__legacy/AiOGrabPayDeposit/AiOGrabPayDeposit.d.ts +1 -0
  73. package/dist/components/DepositWithdrawal/Deposit__legacy/AiOGrabPayDeposit/AiOGrabPayDeposit.js +171 -0
  74. package/dist/components/DepositWithdrawal/Deposit__legacy/AiOPalawanPayDeposit/AiOPalawanPayDeposit.d.ts +1 -0
  75. package/dist/components/DepositWithdrawal/Deposit__legacy/AiOPalawanPayDeposit/AiOPalawanPayDeposit.js +171 -0
  76. package/dist/components/DepositWithdrawal/Deposit__legacy/AiOPayMayaDeposit/AiOPayMayaDeposit.d.ts +1 -0
  77. package/dist/components/DepositWithdrawal/Deposit__legacy/AiOPayMayaDeposit/AiOPayMayaDeposit.js +171 -0
  78. package/dist/components/DepositWithdrawal/Deposit__legacy/AvailablePromos.d.ts +8 -0
  79. package/dist/components/DepositWithdrawal/Deposit__legacy/AvailablePromos.js +33 -0
  80. package/dist/components/DepositWithdrawal/Deposit__legacy/Deposit.d.ts +1 -0
  81. package/dist/components/DepositWithdrawal/Deposit__legacy/Deposit.js +120 -0
  82. package/dist/components/DepositWithdrawal/Deposit__legacy/GCashDeposit/GCashDeposit.d.ts +1 -0
  83. package/dist/components/DepositWithdrawal/Deposit__legacy/GCashDeposit/GCashDeposit.js +163 -0
  84. package/dist/components/DepositWithdrawal/Deposit__legacy/GCashWebpayDeposit/GCashWebpayDeposit.d.ts +1 -0
  85. package/dist/components/DepositWithdrawal/Deposit__legacy/GCashWebpayDeposit/GCashWebpayDeposit.js +165 -0
  86. package/dist/components/DepositWithdrawal/Deposit__legacy/LibanganDeposit/LibanganDeposit.d.ts +1 -0
  87. package/dist/components/DepositWithdrawal/Deposit__legacy/LibanganDeposit/LibanganDeposit.js +186 -0
  88. package/dist/components/DepositWithdrawal/Deposit__legacy/MayaAppDeposit/MayaAppDeposit.d.ts +1 -0
  89. package/dist/components/DepositWithdrawal/Deposit__legacy/MayaAppDeposit/MayaAppDeposit.js +157 -0
  90. package/dist/components/DepositWithdrawal/Deposit__legacy/MayaDeposit/MayaDeposit.d.ts +1 -0
  91. package/dist/components/DepositWithdrawal/Deposit__legacy/MayaDeposit/MayaDeposit.js +163 -0
  92. package/dist/components/DepositWithdrawal/Deposit__legacy/MayaWebpayDeposit/MayaWebpayDeposit.d.ts +1 -0
  93. package/dist/components/DepositWithdrawal/Deposit__legacy/MayaWebpayDeposit/MayaWebpayDeposit.js +166 -0
  94. package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDeposit.d.ts +1 -0
  95. package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDeposit.js +10 -0
  96. package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositAlert.d.ts +1 -0
  97. package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositAlert.js +99 -0
  98. package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositContext.d.ts +25 -0
  99. package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositContext.js +2 -0
  100. package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositDetails.d.ts +1 -0
  101. package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositDetails.js +19 -0
  102. package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositForm.d.ts +1 -0
  103. package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositForm.js +115 -0
  104. package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/useOnlineBankDeposit.d.ts +13 -0
  105. package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/useOnlineBankDeposit.js +81 -0
  106. package/dist/components/DepositWithdrawal/Deposit__legacy/PisoPayDeposit/PisoPayDeposit.d.ts +1 -0
  107. package/dist/components/DepositWithdrawal/Deposit__legacy/PisoPayDeposit/PisoPayDeposit.js +180 -0
  108. package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDeposit.d.ts +1 -0
  109. package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDeposit.js +10 -0
  110. package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositAlert.d.ts +1 -0
  111. package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositAlert.js +99 -0
  112. package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositContext.d.ts +25 -0
  113. package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositContext.js +2 -0
  114. package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositDetails.d.ts +1 -0
  115. package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositDetails.js +17 -0
  116. package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositForm.d.ts +1 -0
  117. package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositForm.js +116 -0
  118. package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHQRCode.d.ts +3 -0
  119. package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHQRCode.js +69 -0
  120. package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/useQRPHDeposit.d.ts +13 -0
  121. package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/useQRPHDeposit.js +85 -0
  122. package/dist/components/DepositWithdrawal/PaymentMethods.js +9 -2
  123. package/dist/components/DepositWithdrawal/utils.d.ts +1 -1
  124. package/dist/components/DepositWithdrawal/utils.js +1 -0
  125. package/dist/components/DigitainLauncher/Loading.d.ts +1 -0
  126. package/dist/components/DigitainLauncher/Loading.js +5 -0
  127. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +184 -0
  128. package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +184 -0
  129. package/dist/components/KYC/BasicInformation.d.ts +1 -0
  130. package/dist/components/KYC/BasicInformation.js +101 -0
  131. package/dist/components/KYC/IdentityVerification.d.ts +1 -0
  132. package/dist/components/KYC/IdentityVerification.js +120 -0
  133. package/dist/components/KYC/Indicator.d.ts +1 -0
  134. package/dist/components/KYC/Indicator.js +8 -0
  135. package/dist/components/KYC/KYC.lazy.d.ts +6 -0
  136. package/dist/components/KYC/KYC.lazy.js +45 -0
  137. package/dist/components/KYC/KYCContext.d.ts +6 -0
  138. package/dist/components/KYC/KYCContext.js +2 -0
  139. package/dist/components/KYC/KYCDefault/BasicInformation.d.ts +1 -0
  140. package/dist/components/KYC/KYCDefault/BasicInformation.js +101 -0
  141. package/dist/components/KYC/KYCNonPagCor/PersonalInformation.js +51 -5
  142. package/dist/components/KYC/KYCNonPagCor/useKYCNonPagCor.js +5 -3
  143. package/dist/components/KYC/KYCVerificationStatus.d.ts +1 -0
  144. package/dist/components/KYC/KYCVerificationStatus.js +10 -0
  145. package/dist/components/KYC/KYCVerificationStatus.lazy.d.ts +1 -0
  146. package/dist/components/KYC/KYCVerificationStatus.lazy.js +36 -0
  147. package/dist/components/KYC/PersonalInformation.d.ts +1 -0
  148. package/dist/components/KYC/PersonalInformation.js +122 -0
  149. package/dist/components/KYC/useKYC.d.ts +25 -0
  150. package/dist/components/KYC/useKYC.js +38 -0
  151. package/dist/components/KYCNotRequired/KYCNotRequired.d.ts +0 -0
  152. package/dist/components/KYCNotRequired/KYCNotRequired.js +1 -0
  153. package/dist/components/PortalProvider/AndroidOnlyComponents.d.ts +1 -0
  154. package/dist/components/PortalProvider/AndroidOnlyComponents.js +12 -0
  155. package/dist/components/PortalProvider/CXDTokenObserver.d.ts +1 -0
  156. package/dist/components/PortalProvider/CXDTokenObserver.js +30 -0
  157. package/dist/components/PortalProvider/LinkGoogleAccountObserver.d.ts +1 -0
  158. package/dist/components/PortalProvider/LinkGoogleAccountObserver.js +29 -0
  159. package/dist/components/Quests/MultiWageringQuest.d.ts +1 -0
  160. package/dist/components/Quests/MultiWageringQuest.js +111 -0
  161. package/dist/components/SessionWatcher/SessionWatcher.d.ts +1 -0
  162. package/dist/components/SessionWatcher/SessionWatcher.js +20 -0
  163. package/dist/components/SessionWatcher/index.d.ts +1 -0
  164. package/dist/components/SessionWatcher/index.js +1 -0
  165. package/dist/components/SignIn/utils.d.ts +8 -0
  166. package/dist/components/SignIn/utils.js +26 -0
  167. package/dist/components/SingleSignOn/SingleSignOn.d.ts +1 -1
  168. package/dist/components/SingleSignOn/SingleSignOn.js +7 -15
  169. package/dist/constants/Branches.d.ts +2 -0
  170. package/dist/constants/Branches.js +42 -0
  171. package/dist/icons/CelebrationIcon.d.ts +2 -0
  172. package/dist/icons/CelebrationIcon.js +4 -0
  173. package/dist/images/game-providers/ALPHACHINKO.png +0 -0
  174. package/dist/images/responsible-gaming-yellow.png +0 -0
  175. package/dist/images/voucher-lazada.png +0 -0
  176. package/dist/images/voucher-ticket.png +0 -0
  177. package/dist/services/queries.d.ts +1 -0
  178. package/dist/services/queries.js +18 -0
  179. package/dist/services/wallet.d.ts +25 -0
  180. package/dist/services/wallet.js +19 -1
  181. package/dist/third-parties/FacebookPixel/FacebookPixel.d.ts +4 -0
  182. package/dist/third-parties/FacebookPixel/FacebookPixel.js +4 -0
  183. package/dist/third-parties/FacebookPixel/api.d.ts +0 -0
  184. package/dist/third-parties/FacebookPixel/api.js +1 -0
  185. package/dist/third-parties/FacebookPixel/index.d.ts +1 -0
  186. package/dist/third-parties/FacebookPixel/index.js +1 -0
  187. package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.d.ts +4 -0
  188. package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.js +4 -0
  189. package/dist/third-parties/GoogleRecaptcha/api.d.ts +0 -0
  190. package/dist/third-parties/GoogleRecaptcha/api.js +1 -0
  191. package/dist/third-parties/GoogleRecaptcha/index.d.ts +1 -0
  192. package/dist/third-parties/GoogleRecaptcha/index.js +1 -0
  193. package/dist/third-parties/index.d.ts +2 -0
  194. package/dist/third-parties/index.js +2 -0
  195. package/dist/ui/QrCode/QrCode.d.ts +25 -25
  196. package/dist/ui/QrCode/qrCode.recipe.d.ts +5 -5
  197. package/dist/utils/getLocaleInfo.d.ts +79 -0
  198. package/dist/utils/getLocaleInfo.js +175 -0
  199. package/dist/utils/mutationKeys.d.ts +1 -0
  200. package/dist/utils/mutationKeys.js +4 -0
  201. package/package.json +1 -1
@@ -0,0 +1,116 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { zodResolver } from '@hookform/resolvers/zod';
3
+ import Link from 'next/link';
4
+ import { useEffect } from 'react';
5
+ import { Controller, useForm } from 'react-hook-form';
6
+ import { z } from 'zod';
7
+ import { useShallow } from 'zustand/shallow';
8
+ import { useAvailablePromosQuery } from '../../../../client/hooks/useAvailablePromosQuery.js';
9
+ import { useDepositsCountQuery } from '../../../../client/hooks/useDepositsCountQuery.js';
10
+ import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
11
+ import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSettingsQuery.js';
12
+ import { Button } from '../../../../ui/Button/index.js';
13
+ import { Field } from '../../../../ui/Field/index.js';
14
+ import { parseDecimal } from '../../../../utils/parseDecimal.js';
15
+ import { AmountChoices } from '../../AmountChoices.js';
16
+ import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext.js';
17
+ import { AvailablePromos } from '../AvailablePromos.js';
18
+ import { useQRPHDepositContext } from './QRPHDepositContext.js';
19
+ export function QRPHDepositForm() {
20
+ const depositWithdrawalProps = useDepositWithdrawalPropsContext();
21
+ const globalStore = useGlobalStore(useShallow((ctx) => ({
22
+ depositWithdrawal: ctx.depositWithdrawal,
23
+ })));
24
+ const context = useQRPHDepositContext();
25
+ const depositsCountQuery = useDepositsCountQuery();
26
+ const depositsCount = depositsCountQuery.data ?? 0;
27
+ const paymentSettingsQuery = usePaymentSettingsQuery();
28
+ const paymentSettings = paymentSettingsQuery.data;
29
+ const gatewaySettings = paymentSettings?.qrphDepositGatewaySettings;
30
+ const maximumAmount = parseDecimal(gatewaySettings?.maximumAmount, 0);
31
+ const minimumAmount = depositsCount <= 0
32
+ ? parseDecimal(paymentSettingsQuery.data?.minimumFirstDepositAmount, 0)
33
+ : parseDecimal(gatewaySettings?.minimumAmount, 0);
34
+ const promosQuery = useAvailablePromosQuery();
35
+ const promos = promosQuery.data ?? [];
36
+ const definition = z
37
+ .object({
38
+ amount: z.string().superRefine((val, ctx) => {
39
+ const n = parseDecimal(val, 0);
40
+ if (val.includes('.')) {
41
+ ctx.addIssue({
42
+ code: z.ZodIssueCode.custom,
43
+ message: 'Amount must be a whole number',
44
+ });
45
+ return;
46
+ }
47
+ if (n < minimumAmount) {
48
+ ctx.addIssue({
49
+ type: 'number',
50
+ code: z.ZodIssueCode.too_small,
51
+ inclusive: true,
52
+ minimum: minimumAmount,
53
+ message: `Please enter ${minimumAmount.toLocaleString()} or more to proceed with your deposit.`,
54
+ });
55
+ }
56
+ if (n > maximumAmount) {
57
+ ctx.addIssue({
58
+ type: 'number',
59
+ code: z.ZodIssueCode.too_big,
60
+ inclusive: true,
61
+ maximum: maximumAmount,
62
+ message: `Maximum amount is ${maximumAmount.toLocaleString()}`,
63
+ });
64
+ }
65
+ }),
66
+ promo: z.string().optional().nullable(),
67
+ })
68
+ .superRefine((value, ctx) => {
69
+ const promo = promos.find((o) => o.id === value.promo);
70
+ const promoMinAmount = parseDecimal(promo?.minimumDepositAmount, 0);
71
+ const promoMaxAmount = parseDecimal(promo?.maximumDepositAmount, 0);
72
+ const amount = parseDecimal(value.amount, 0);
73
+ if (promo && amount < promoMinAmount) {
74
+ ctx.addIssue({
75
+ path: ['amount'],
76
+ code: z.ZodIssueCode.custom,
77
+ message: `Minimum amount for this promo is ${promoMinAmount.toLocaleString()}`,
78
+ });
79
+ }
80
+ if (promo && amount > promoMaxAmount) {
81
+ ctx.addIssue({
82
+ path: ['amount'],
83
+ code: z.ZodIssueCode.custom,
84
+ message: `Maximum amount for this promo is ${promoMaxAmount}`,
85
+ });
86
+ }
87
+ });
88
+ const form = useForm({
89
+ mode: 'all',
90
+ resolver: zodResolver(definition),
91
+ defaultValues: {
92
+ amount: '0',
93
+ promo: globalStore.depositWithdrawal.promo ?? null,
94
+ },
95
+ });
96
+ useEffect(() => {
97
+ if (minimumAmount) {
98
+ form.reset({
99
+ amount: minimumAmount.toString(),
100
+ promo: form.getValues('promo') ?? null,
101
+ });
102
+ }
103
+ }, [form, minimumAmount]);
104
+ if (context.view !== 'form')
105
+ return null;
106
+ return (_jsxs("form", { onSubmit: form.handleSubmit(context.generateQRCode), noValidate: true, children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.amount, className: "mt-3xl", children: [_jsx(Field.Label, { children: "Enter the amount you want to deposit" }), _jsx(Field.Input, { type: "number", ...form.register('amount') }), _jsx(Field.ErrorText, { children: form.formState.errors.amount?.message })] }), _jsx(AmountChoices, { value: parseDecimal(form.watch('amount'), 0), onChange: (value) => {
107
+ form.setValue('amount', value.toString(), {
108
+ shouldTouch: true,
109
+ shouldDirty: true,
110
+ shouldValidate: true,
111
+ });
112
+ }, min: minimumAmount, max: maximumAmount, className: "mt-lg" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { value: o.field.value, onChange: (value) => {
113
+ o.field.onChange(value);
114
+ globalStore.depositWithdrawal.setPromo(null);
115
+ }, className: "mt-3xl" })) }), _jsx(Button, { type: "submit", className: "mt-3xl", 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" }), "."] }))] }));
116
+ }
@@ -0,0 +1,3 @@
1
+ export declare function QRPHQRCode(props: {
2
+ qrCodeString: string;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,69 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Capacitor } from '@capacitor/core';
4
+ import { Directory, Filesystem } from '@capacitor/filesystem';
5
+ import Image from 'next/image';
6
+ import { toaster } from '../../../../client/utils/toaster.js';
7
+ import qrphIcon from '../../../../images/qrph-icon.png';
8
+ import { QrCode } from '../../../../ui/QrCode/index.js';
9
+ export function QRPHQRCode(props) {
10
+ async function handleNativeDownload() {
11
+ const QRCode = await import('qrcode');
12
+ const dataUrl = await QRCode.toDataURL(props.qrCodeString, {
13
+ type: 'image/png',
14
+ color: {
15
+ light: '#FFFFFF',
16
+ dark: '#000000',
17
+ },
18
+ });
19
+ const base64 = dataUrl.split(',')[1];
20
+ try {
21
+ await Filesystem.writeFile({
22
+ path: `qrcode-${Date.now()}.png`,
23
+ data: base64,
24
+ directory: Directory.Documents,
25
+ });
26
+ toaster.success({
27
+ title: 'QR Code successfully saved to your device',
28
+ description: 'To continue with your deposit, please upload the QR code in your banking app.',
29
+ });
30
+ }
31
+ catch (error) {
32
+ console.log(error, 'error');
33
+ toaster.error({
34
+ title: 'Failed to save QR Code',
35
+ description: 'An error occurred while saving the QR code to your device.',
36
+ });
37
+ }
38
+ }
39
+ async function handleWebDownload() {
40
+ try {
41
+ const QRCode = await import('qrcode');
42
+ const dataUrl = await QRCode.toDataURL(props.qrCodeString, {
43
+ type: 'image/png',
44
+ color: {
45
+ light: '#FFFFFF',
46
+ dark: '#000000',
47
+ },
48
+ });
49
+ const link = document.createElement('a');
50
+ link.href = dataUrl;
51
+ link.download = `qrcode-${Date.now()}.png`;
52
+ document.body.appendChild(link);
53
+ link.click();
54
+ document.body.removeChild(link);
55
+ toaster.success({
56
+ title: 'QR Code successfully saved to your device',
57
+ description: 'To continue with your deposit, please upload the QR code in your banking app.',
58
+ });
59
+ }
60
+ catch (error) {
61
+ console.log(error, 'error');
62
+ toaster.error({
63
+ title: 'Failed to save QR Code',
64
+ description: 'An error occurred while saving the QR code to your device.',
65
+ });
66
+ }
67
+ }
68
+ return (_jsxs(QrCode.Root, { value: props.qrCodeString, className: "mx-auto mt-6 w-[12.5rem] rounded-lg border border-border-primary bg-bg-brand-secondary-alt p-5 lg:w-[13rem] lg:p-6", children: [_jsxs("div", { className: "relative", children: [_jsx(QrCode.Frame, { className: "mx-auto size-[10rem] rounded-[0.25rem] border border-border-primary bg-white", children: _jsx(QrCode.Pattern, {}) }), _jsx(QrCode.Overlay, { className: "bg-white p-0.5", children: _jsx(Image, { src: qrphIcon, alt: "", className: "size-8", width: 40, height: 40 }) })] }), Capacitor.isNativePlatform() ? (_jsx("button", { type: "button", onClick: handleNativeDownload, className: "mt-5 block w-full text-center font-semibold text-sm text-text-secondary-700", children: "Download QR Code to Device" })) : (_jsx("button", { type: "button", onClick: handleWebDownload, className: "mt-5 block w-full text-center font-semibold text-sm text-text-secondary-700", children: "Download QR Code" }))] }));
69
+ }
@@ -0,0 +1,13 @@
1
+ import type { Deposit } from '../../../../types';
2
+ export type UseQRPHDepositReturn = ReturnType<typeof useQRPHDeposit>;
3
+ export declare function useQRPHDeposit(): {
4
+ view: "form" | "qrCode";
5
+ status: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
6
+ verify: () => void;
7
+ reset: () => void;
8
+ deposit: Deposit | null;
9
+ generateQRCode: (input: {
10
+ amount: string;
11
+ promo?: string | null;
12
+ }) => void;
13
+ };
@@ -0,0 +1,85 @@
1
+ import { useEffect, useState } from 'react';
2
+ import invariant from 'tiny-invariant';
3
+ import { useShallow } from 'zustand/shallow';
4
+ import { useCreateQRPHDepositMutation } from '../../../../client/hooks/useCreateQRPHDepositMutation.js';
5
+ import { useDepositQuery } from '../../../../client/hooks/useDepositQuery.js';
6
+ import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
7
+ import { useMemberVerificationQuery } from '../../../../client/hooks/useMemberVerificationQuery.js';
8
+ import { getQueryClient } from '../../../../utils/getQueryClient.js';
9
+ import { getDepositsCountQueryKey } from '../../../../utils/queryKeys.js';
10
+ export function useQRPHDeposit() {
11
+ const globalStore = useGlobalStore(useShallow((ctx) => ({
12
+ kycVerificationStatus: ctx.kycVerificationStatus,
13
+ })));
14
+ const [deposit, setDeposit] = useState(null);
15
+ const verificationQuery = useMemberVerificationQuery();
16
+ const verificationStatus = verificationQuery.data?.status ?? 'UNVERIFIED';
17
+ const [status, setStatus] = useState('waiting');
18
+ const view = status === 'verification-failed' ||
19
+ status === 'verification-waiting' ||
20
+ status === 'verification-success' ||
21
+ status === 'verification-processing'
22
+ ? 'qrCode'
23
+ : 'form';
24
+ const mutation = useCreateQRPHDepositMutation({
25
+ onMutate() {
26
+ setStatus('processing');
27
+ },
28
+ onSuccess(data) {
29
+ const queryClient = getQueryClient();
30
+ invariant(data.qrCode);
31
+ setStatus('verification-waiting');
32
+ queryClient.invalidateQueries({ queryKey: getDepositsCountQueryKey() });
33
+ setDeposit(data);
34
+ },
35
+ onError() {
36
+ setStatus('failed');
37
+ },
38
+ });
39
+ const generateQRCode = (input) => {
40
+ //handle new kyc process
41
+ if (verificationStatus === 'PENDING' ||
42
+ verificationStatus === 'UNVERIFIED' ||
43
+ verificationStatus === 'REJECTED' ||
44
+ verificationStatus === 'CREATED') {
45
+ globalStore.kycVerificationStatus.setOpen(true);
46
+ return;
47
+ }
48
+ else {
49
+ mutation.mutate({
50
+ amount: input.amount,
51
+ promo: input.promo ?? undefined,
52
+ });
53
+ }
54
+ };
55
+ const query = useDepositQuery(deposit?.id, {
56
+ enabled: !!deposit,
57
+ refetchInterval: 5000,
58
+ });
59
+ useEffect(() => {
60
+ if (query.data?.status === 'APPROVED' ||
61
+ query.data?.status === 'CONFIRMED') {
62
+ setStatus('verification-success');
63
+ }
64
+ if (query.data?.status === 'CANCELLED' ||
65
+ query.data?.status === 'REJECTED' ||
66
+ query.data?.status === 'FAILED') {
67
+ setStatus('verification-failed');
68
+ }
69
+ }, [query.data?.status]);
70
+ const reset = () => {
71
+ setDeposit(null);
72
+ setStatus('waiting');
73
+ };
74
+ const verify = () => {
75
+ setStatus('verification-processing');
76
+ };
77
+ return {
78
+ view,
79
+ status,
80
+ verify,
81
+ reset,
82
+ deposit,
83
+ generateQRCode,
84
+ };
85
+ }
@@ -0,0 +1 @@
1
+ export declare function Voucher(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,86 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Controller, useForm } from 'react-hook-form';
3
+ import { useMemo, useState } from 'react';
4
+ import { Button } from '../../../../ui/Button/index.js';
5
+ import { Field } from '../../../../ui/Field/index.js';
6
+ import { Checkbox } from '../../../../ui/Checkbox/index.js';
7
+ import { zodResolver } from '@hookform/resolvers/zod';
8
+ import { definition } from './definition.js';
9
+ import { useRedeemVoucherMutation } from '../../../../client/hooks/useRedeemVoucherMutation.js';
10
+ import { Dialog } from '../../../../ui/Dialog/index.js';
11
+ import { Portal } from '../../../../ui/Portal/index.js';
12
+ import { CelebrationIcon } from '../../../../icons/CelebrationIcon.js';
13
+ import LazadaVoucherIcon from '../../../../images/voucher-lazada.png';
14
+ import VoucherIcon from '../../../../images/voucher-ticket.png';
15
+ import Image from 'next/image';
16
+ import { twMerge } from 'tailwind-merge';
17
+ const voucherChannels = [
18
+ {
19
+ value: 'BUILTIN',
20
+ label: 'Voucher',
21
+ image: VoucherIcon,
22
+ },
23
+ {
24
+ value: 'LAZADA',
25
+ label: 'Lazada',
26
+ image: LazadaVoucherIcon,
27
+ },
28
+ ];
29
+ export function Voucher() {
30
+ const [isSuccessModalOpen, setIsSuccessModalOpen] = useState(false);
31
+ const channels = useMemo(() => {
32
+ return voucherChannels.map((channel) => {
33
+ return {
34
+ value: channel.value,
35
+ label: channel.label,
36
+ image: channel.image,
37
+ };
38
+ });
39
+ }, []);
40
+ const { control, handleSubmit: formSubmit, formState: { errors }, reset, } = useForm({
41
+ resolver: zodResolver(definition),
42
+ defaultValues: {
43
+ voucherChannel: 'BUILTIN',
44
+ voucherCode: '',
45
+ },
46
+ mode: 'all',
47
+ });
48
+ const redeemVoucherMutation = useRedeemVoucherMutation({
49
+ onSuccess: () => {
50
+ reset({
51
+ voucherCode: '',
52
+ });
53
+ setIsSuccessModalOpen(true);
54
+ },
55
+ });
56
+ const handleSubmit = async (data) => {
57
+ try {
58
+ await redeemVoucherMutation.mutateAsync({
59
+ type: data.voucherChannel,
60
+ code: data.voucherCode,
61
+ });
62
+ }
63
+ catch (error) {
64
+ console.error('Error redeeming voucher:', error);
65
+ }
66
+ };
67
+ return (_jsxs(_Fragment, { children: [_jsxs("form", { noValidate: true, onSubmit: formSubmit(handleSubmit), children: [_jsxs("section", { children: [_jsx(Field.Label, { asChild: true, children: _jsx("div", { children: "Select Channel" }) }), _jsx(Controller, { control: control, name: "voucherChannel", render: ({ field }) => (_jsx(Checkbox.Group, { value: field.value ? [field.value] : [], onValueChange: (values) => {
68
+ const last = values.at(-1);
69
+ if (last)
70
+ field.onChange(last);
71
+ }, className: "grid grid-cols-2 gap-x-4 gap-y-3", children: channels.map((channel) => (_jsxs(Checkbox.Root, { value: channel.value, className: "flex cursor-pointer items-center justify-between rounded-xl border border-border-secondary ui-checked:border-border-brand-solid p-lg", children: [_jsx(Image, { src: channel.image, alt: "", width: 100, height: 25, loading: "lazy", className: twMerge('w-auto', 'h-[2.8rem]'), draggable: false }), _jsx(Checkbox.Control, { className: "ml-auto", children: _jsx(Checkbox.Indicator, {}) }), _jsx(Checkbox.HiddenInput, {})] }, channel.value))) })) })] }), _jsxs("section", { className: 'my-5', children: [_jsx(Field.Label, { asChild: true, children: _jsx("div", { children: "Voucher Code" }) }), _jsx(Controller, { control: control, name: "voucherCode", render: ({ field }) => {
72
+ return (_jsxs(Field.Root, { invalid: !!errors, children: [_jsx(Field.Input, { ...field, placeholder: "Enter your Voucher code", onChange: (e) => {
73
+ redeemVoucherMutation.reset();
74
+ field.onChange(e.target.value.toUpperCase());
75
+ } }), redeemVoucherMutation.isError && (_jsx(Field.ErrorText, { children: redeemVoucherMutation.error.message }))] }));
76
+ } })] }), _jsx("section", { children: _jsx(Button, { type: "submit", className: "mt-4xl", children: "Redeem" }) })] }), _jsx(SuccessfulRedemptionModal, { open: isSuccessModalOpen, onClose: () => {
77
+ setIsSuccessModalOpen(false);
78
+ redeemVoucherMutation.reset();
79
+ } })] }));
80
+ }
81
+ function SuccessfulRedemptionModal({ open, onClose, }) {
82
+ return (_jsx(Dialog.Root, { unmountOnExit: true, open: open, onOpenChange: (isOpen) => {
83
+ if (!isOpen)
84
+ onClose();
85
+ }, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+3)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+4)]", children: _jsxs(Dialog.Content, { className: "mx-auto h-full w-full overflow-y-auto px-4 py-3xl lg:h-auto lg:max-h-[80vh] lg:w-[480px] lg:rounded-xl", children: [_jsx(Dialog.Header, { className: "text-center", children: _jsx(Dialog.Title, { className: "flex grow items-center justify-center font-semibold", children: _jsx(CelebrationIcon, { className: "text-6xl" }) }) }), _jsx(Dialog.Body, { className: "mt-4", children: _jsx("p", { className: 'text-center font-bold', children: "Voucher successfully redeemed." }) }), _jsx(Dialog.Footer, { className: "mt-6", children: _jsx(Button, { className: "w-full", onClick: onClose, children: "OK" }) })] }) })] }) }));
86
+ }
@@ -0,0 +1,11 @@
1
+ import * as z from 'zod';
2
+ export declare const definition: z.ZodObject<{
3
+ voucherChannel: z.ZodNullable<z.ZodOptional<z.ZodString>>;
4
+ voucherCode: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ voucherCode: string;
7
+ voucherChannel?: string | null | undefined;
8
+ }, {
9
+ voucherCode: string;
10
+ voucherChannel?: string | null | undefined;
11
+ }>;
@@ -0,0 +1,6 @@
1
+ import * as z from 'zod';
2
+ export const definition = z.object({
3
+ voucherChannel: z.string().optional().nullable(),
4
+ voucherCode: z.string()
5
+ .regex(/^[A-Z0-9-_]+$/, 'Voucher code can only contain uppercase letters, numbers, hyphens, and underscores'),
6
+ });
@@ -0,0 +1 @@
1
+ export declare function AiOGCashDeposit(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,173 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { zodResolver } from '@hookform/resolvers/zod';
3
+ import Link from 'next/link';
4
+ import { useEffect, useState } from 'react';
5
+ import { Controller, useForm } from 'react-hook-form';
6
+ import invariant from 'tiny-invariant';
7
+ import { z } from 'zod';
8
+ import { useShallow } from 'zustand/shallow';
9
+ import { useCreateAiOGCashDepositMutation } from '../../../../client/hooks/useAiOGCashDepositMutation.js';
10
+ import { useAvailablePromosQuery } from '../../../../client/hooks/useAvailablePromosQuery.js';
11
+ import { useDepositsCountQuery } from '../../../../client/hooks/useDepositsCountQuery.js';
12
+ import { useDisclosure } from '../../../../client/hooks/useDisclosure.js';
13
+ import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
14
+ import { useMemberVerificationQuery } from '../../../../client/hooks/useMemberVerificationQuery.js';
15
+ import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSettingsQuery.js';
16
+ import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
17
+ import { ChevronDownIcon } from '../../../../icons/ChevronDownIcon.js';
18
+ import { ChevronUpIcon } from '../../../../icons/ChevronUpIcon.js';
19
+ import { SpinnerIcon } from '../../../../icons/SpinnerIcon.js';
20
+ import { XIcon } from '../../../../icons/XIcon.js';
21
+ import { AlertDialog } from '../../../../ui/AlertDialog/index.js';
22
+ import { Button } from '../../../../ui/Button/index.js';
23
+ import { Field } from '../../../../ui/Field/index.js';
24
+ import { NumberInput } from '../../../../ui/NumberInput/index.js';
25
+ import { Portal } from '../../../../ui/Portal/index.js';
26
+ import { getQueryClient } from '../../../../utils/getQueryClient.js';
27
+ import { parseDecimal } from '../../../../utils/parseDecimal.js';
28
+ import { getDepositsCountQueryKey } from '../../../../utils/queryKeys.js';
29
+ import { AmountChoices } from '../../AmountChoices.js';
30
+ import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext.js';
31
+ import { explainError } from '../../utils.js';
32
+ import { AvailablePromos } from '../AvailablePromos.js';
33
+ export function AiOGCashDeposit() {
34
+ const depositWithdrawalProps = useDepositWithdrawalPropsContext();
35
+ const disclosure = useDisclosure();
36
+ const globalStore = useGlobalStore(useShallow((ctx) => ({
37
+ depositWithdrawal: ctx.depositWithdrawal,
38
+ kycVerificationStatus: ctx.kycVerificationStatus,
39
+ })));
40
+ const verificationQuery = useMemberVerificationQuery();
41
+ const verificationStatus = verificationQuery.data?.status ?? 'UNVERIFIED';
42
+ const [status, setStatus] = useState('waiting');
43
+ const createDepositMutation = useCreateAiOGCashDepositMutation({
44
+ onMutate() {
45
+ disclosure.setOpen(true);
46
+ setStatus('processing');
47
+ },
48
+ onSuccess(data) {
49
+ const queryClient = getQueryClient();
50
+ invariant(data.checkoutUrl);
51
+ window.open(data.checkoutUrl, '_blank', 'noopener,noreferrer');
52
+ queryClient.invalidateQueries({
53
+ queryKey: getDepositsCountQueryKey(),
54
+ });
55
+ setStatus('success');
56
+ },
57
+ onError() {
58
+ setStatus('failed');
59
+ },
60
+ });
61
+ const depositsCountQuery = useDepositsCountQuery();
62
+ const depositsCount = depositsCountQuery.data ?? 0;
63
+ const paymentSettingsQuery = usePaymentSettingsQuery();
64
+ const paymentSettings = paymentSettingsQuery.data;
65
+ const gatewaySettings = paymentSettings?.aioGCashDepositGatewaySettings;
66
+ const maximumAmount = parseDecimal(gatewaySettings?.maximumAmount, 0);
67
+ const minimumAmount = depositsCount <= 0
68
+ ? parseDecimal(paymentSettingsQuery.data?.minimumFirstDepositAmount, 0)
69
+ : parseDecimal(gatewaySettings?.minimumAmount, 0);
70
+ const promosQuery = useAvailablePromosQuery();
71
+ const promos = promosQuery.data ?? [];
72
+ const definition = z
73
+ .object({
74
+ amount: z.string().superRefine((val, ctx) => {
75
+ const n = parseDecimal(val, 0);
76
+ if (n < minimumAmount) {
77
+ ctx.addIssue({
78
+ type: 'number',
79
+ code: z.ZodIssueCode.too_small,
80
+ inclusive: true,
81
+ minimum: minimumAmount,
82
+ message: `Please enter ${minimumAmount.toLocaleString()} or more to proceed with your deposit.`,
83
+ });
84
+ }
85
+ if (n > maximumAmount) {
86
+ ctx.addIssue({
87
+ type: 'number',
88
+ code: z.ZodIssueCode.too_big,
89
+ inclusive: true,
90
+ maximum: maximumAmount,
91
+ message: `Maximum amount is ${maximumAmount.toLocaleString()}`,
92
+ });
93
+ }
94
+ }),
95
+ promo: z.string().optional().nullable(),
96
+ })
97
+ .superRefine((value, ctx) => {
98
+ const promo = promos.find((o) => o.id === value.promo);
99
+ const promoMinAmount = parseDecimal(promo?.minimumDepositAmount, 0);
100
+ const promoMaxAmount = parseDecimal(promo?.maximumDepositAmount, 0);
101
+ const amount = parseDecimal(value.amount, 0);
102
+ if (promo && amount < promoMinAmount) {
103
+ ctx.addIssue({
104
+ path: ['amount'],
105
+ code: z.ZodIssueCode.custom,
106
+ message: `Minimum amount for this promo is ${promoMinAmount.toLocaleString()}`,
107
+ });
108
+ }
109
+ if (promo && amount > promoMaxAmount) {
110
+ ctx.addIssue({
111
+ path: ['amount'],
112
+ code: z.ZodIssueCode.custom,
113
+ message: `Maximum amount for this promo is ${promoMaxAmount}`,
114
+ });
115
+ }
116
+ });
117
+ const form = useForm({
118
+ mode: 'all',
119
+ resolver: zodResolver(definition),
120
+ defaultValues: {
121
+ amount: '0',
122
+ promo: globalStore.depositWithdrawal.promo ?? null,
123
+ },
124
+ });
125
+ useEffect(() => {
126
+ if (minimumAmount) {
127
+ form.reset({
128
+ amount: minimumAmount.toString(),
129
+ promo: form.getValues('promo') ?? null,
130
+ });
131
+ }
132
+ }, [form, minimumAmount]);
133
+ return (_jsxs("form", { onSubmit: form.handleSubmit(async (data) => {
134
+ if (verificationStatus === 'PENDING' ||
135
+ verificationStatus === 'UNVERIFIED' ||
136
+ verificationStatus === 'REJECTED' ||
137
+ verificationStatus === 'CREATED') {
138
+ globalStore.kycVerificationStatus.setOpen(true);
139
+ return;
140
+ }
141
+ else {
142
+ createDepositMutation.reset();
143
+ createDepositMutation.mutate({
144
+ amount: data.amount.toString(),
145
+ promo: data.promo ?? undefined,
146
+ redirectUrl: window.location.origin.includes('localhost')
147
+ ? 'https://uat.powerplay.ph'
148
+ : window.location.origin,
149
+ });
150
+ }
151
+ }), noValidate: true, children: [_jsx(Controller, { control: form.control, name: "amount", render: (o) => (_jsxs(Field.Root, { invalid: !!form.formState.errors.amount, children: [_jsxs(NumberInput.Root, { min: 0, step: 1, value: o.field.value, onValueChange: (details) => {
152
+ o.field.onChange(details.value);
153
+ }, allowMouseWheel: true, children: [_jsx(NumberInput.Label, { children: "Enter amount you want to deposit" }), _jsxs(NumberInput.Control, { children: [_jsx(NumberInput.Input, {}), _jsx(NumberInput.IncrementTrigger, { children: _jsx(ChevronUpIcon, {}) }), _jsx(NumberInput.DecrementTrigger, { children: _jsx(ChevronDownIcon, {}) })] })] }), _jsx(Field.ErrorText, { children: form.formState.errors.amount?.message })] })) }), _jsx(AmountChoices, { value: parseDecimal(form.watch('amount'), 0), onChange: (value) => {
154
+ form.setValue('amount', value.toString(), {
155
+ shouldTouch: true,
156
+ shouldDirty: true,
157
+ shouldValidate: true,
158
+ });
159
+ }, min: minimumAmount, max: maximumAmount, className: "mt-lg" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { value: o.field.value, onChange: (value) => {
160
+ o.field.onChange(value);
161
+ globalStore.depositWithdrawal.setPromo(null);
162
+ }, 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) => {
163
+ disclosure.setOpen(details.open);
164
+ if (!details.open) {
165
+ setStatus('waiting');
166
+ form.reset();
167
+ }
168
+ }, 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' &&
169
+ "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' &&
170
+ explainError(createDepositMutation?.error?.name)] })] }), (status === 'failed' || status === 'success') && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
171
+ api.setOpen(false);
172
+ }, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
173
+ }
@@ -0,0 +1 @@
1
+ export declare function AiOGrabPayDeposit(): import("react/jsx-runtime").JSX.Element;