@opexa/portal-components 0.0.842 → 0.0.844

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 (243) hide show
  1. package/dist/client/hooks/useAiOGCashDepositMutation.js +10 -0
  2. package/dist/client/hooks/useCreateGCashDepositMutation.js +10 -0
  3. package/dist/client/hooks/useCreateMayaDepositMutation.js +10 -0
  4. package/dist/client/hooks/useCreateOnlineBankDepositMutation.js +10 -0
  5. package/dist/client/hooks/useCreateQRPHDepositMutation.js +10 -0
  6. package/dist/components/DepositWithdrawal/Deposit/AiOGCashDeposit/AiOGCashDeposit.js +9 -4
  7. package/dist/components/DepositWithdrawal/Deposit/AiOPayMayaDeposit/AiOPayMayaDeposit.js +9 -4
  8. package/dist/components/DepositWithdrawal/Deposit/GCashDeposit/GCashDeposit.js +10 -5
  9. package/dist/components/DepositWithdrawal/Deposit/MayaAppDeposit/MayaAppDeposit.js +9 -4
  10. package/dist/components/DepositWithdrawal/Deposit/MayaDeposit/MayaDeposit.js +9 -4
  11. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts +2 -2
  12. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts +1 -1
  13. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/Failed.js +1 -1
  14. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositContext.d.ts +8 -0
  15. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/useQRPHDeposit.d.ts +4 -0
  16. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/useQRPHDeposit.js +8 -1
  17. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositContext.d.ts +2 -2
  18. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/useQRPHDeposit.d.ts +1 -1
  19. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Confirmed.d.ts +1 -0
  20. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Confirmed.js +11 -0
  21. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Failed.d.ts +1 -0
  22. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Failed.js +11 -0
  23. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Form.d.ts +1 -0
  24. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Form.js +126 -0
  25. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/GeneratingQrCode.d.ts +1 -0
  26. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/GeneratingQrCode.js +10 -0
  27. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QRPHDeposit.d.ts +1 -0
  28. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QRPHDeposit.js +12 -0
  29. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QRPHDepositContext.d.ts +17 -0
  30. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QRPHDepositContext.js +2 -0
  31. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QrCodeGenerated.d.ts +1 -0
  32. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QrCodeGenerated.js +41 -0
  33. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/useQRPHDeposit.d.ts +13 -0
  34. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/useQRPHDeposit.js +91 -0
  35. package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositContext.d.ts +2 -2
  36. package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/useOnlineBankDeposit.d.ts +1 -1
  37. package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositContext.d.ts +2 -2
  38. package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/useQRPHDeposit.d.ts +1 -1
  39. package/dist/components/DepositWithdrawal/PaymentMethods.js +20 -10
  40. package/dist/components/DepositWithdrawal/Withdrawal/InstapayGCashWithdrawal/InstapayGcashWithdrawal.d.ts +1 -0
  41. package/dist/components/DepositWithdrawal/Withdrawal/InstapayGCashWithdrawal/InstapayGcashWithdrawal.js +143 -0
  42. package/dist/components/DepositWithdrawal/Withdrawal/InstapayPaymayaWithdrawal/InstapayPaymayaWithdrawal.d.ts +1 -0
  43. package/dist/components/DepositWithdrawal/Withdrawal/InstapayPaymayaWithdrawal/InstapayPaymayaWithdrawal.js +143 -0
  44. package/dist/components/DepositWithdrawal/Withdrawal/InstapayWithdrawal/InstapayWithdrawal.js +2 -1
  45. package/dist/components/DepositWithdrawal/Withdrawal/Withdrawal.js +13 -1
  46. package/dist/components/DepositWithdrawal/utils.d.ts +1 -1
  47. package/dist/components/DepositWithdrawal/utils.js +3 -0
  48. package/dist/components/DigitainLauncher/Loading.js +1 -1
  49. package/dist/components/Disclaimer/ResponsibleGaming.d.ts +10 -0
  50. package/dist/components/Disclaimer/ResponsibleGaming.js +13 -0
  51. package/dist/components/Disclaimer/TermsOfUse.d.ts +11 -0
  52. package/dist/components/Disclaimer/TermsOfUse.js +13 -0
  53. package/dist/components/FeatureFlag/FeatureFlag.d.ts +1 -0
  54. package/dist/components/FeatureFlag/FeatureFlag.js +29 -0
  55. package/dist/components/FeatureFlag/index.d.ts +1 -0
  56. package/dist/components/FeatureFlag/index.js +1 -0
  57. package/dist/components/Jackpots/Jackpots.module.css +221 -221
  58. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +184 -184
  59. package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +184 -184
  60. package/dist/components/KYC/AutoOpen.d.ts +1 -0
  61. package/dist/components/KYC/AutoOpen.js +40 -0
  62. package/dist/components/KYC/BasicInformation.js +1 -1
  63. package/dist/components/KYC/CaptureIdDocument.d.ts +1 -0
  64. package/dist/components/KYC/CaptureIdDocument.js +219 -0
  65. package/dist/components/KYC/CaptureSelfie.d.ts +1 -0
  66. package/dist/components/KYC/CaptureSelfie.js +285 -0
  67. package/dist/components/KYC/DisplayImage.d.ts +5 -0
  68. package/dist/components/KYC/DisplayImage.js +8 -0
  69. package/dist/components/KYC/FileUpload.d.ts +10 -0
  70. package/dist/components/KYC/FileUpload.js +72 -0
  71. package/dist/components/KYC/IdentityVerification.js +1 -1
  72. package/dist/components/KYC/KYC.lazy.js +1 -1
  73. package/dist/components/KYC/KYCDefault/KYCVerificationStatus.lazy.js +2 -2
  74. package/dist/components/KYC/KYCVerificationStatus.lazy.js +8 -5
  75. package/dist/components/KYC/NoCameraError.d.ts +7 -0
  76. package/dist/components/KYC/NoCameraError.js +6 -0
  77. package/dist/components/KYC/PersonOverlayDesktop.d.ts +7 -0
  78. package/dist/components/KYC/PersonOverlayDesktop.js +9 -0
  79. package/dist/components/KYC/PersonalInformation.js +1 -1
  80. package/dist/components/KYC/backup/Header.d.ts +1 -0
  81. package/dist/components/KYC/backup/Header.js +8 -0
  82. package/dist/components/KYC/backup/Indicator.d.ts +1 -0
  83. package/dist/components/KYC/backup/Indicator.js +9 -0
  84. package/dist/components/KYC/backup/KYC.d.ts +1 -0
  85. package/dist/components/KYC/backup/KYC.js +14 -0
  86. package/dist/components/KYC/backup/KYC.lazy.d.ts +1 -0
  87. package/dist/components/KYC/backup/KYC.lazy.js +26 -0
  88. package/dist/components/KYC/backup/KYCContext.d.ts +6 -0
  89. package/dist/components/KYC/backup/KYCContext.js +2 -0
  90. package/dist/components/KYC/backup/Step1.d.ts +1 -0
  91. package/dist/components/KYC/backup/Step1.js +13 -0
  92. package/dist/components/KYC/backup/Step2.d.ts +1 -0
  93. package/dist/components/KYC/backup/Step2.js +13 -0
  94. package/dist/components/KYC/backup/Step3.d.ts +1 -0
  95. package/dist/components/KYC/backup/Step3.js +13 -0
  96. package/dist/components/KYC/backup/Step4.d.ts +1 -0
  97. package/dist/components/KYC/backup/Step4.js +7 -0
  98. package/dist/components/KYC/backup/useKYC.d.ts +10 -0
  99. package/dist/components/KYC/backup/useKYC.js +8 -0
  100. package/dist/components/KYC/loadModels.d.ts +1 -0
  101. package/dist/components/KYC/loadModels.js +9 -0
  102. package/dist/components/KYC/utils.d.ts +9 -0
  103. package/dist/components/KYC/utils.js +79 -0
  104. package/dist/components/Messages/Message.d.ts +1 -0
  105. package/dist/components/Messages/Message.js +35 -0
  106. package/dist/components/Messages/MessageContext.d.ts +6 -0
  107. package/dist/components/Messages/MessageContext.js +2 -0
  108. package/dist/components/Messages/MessagePopup.d.ts +1 -0
  109. package/dist/components/Messages/MessagePopup.js +20 -0
  110. package/dist/components/Messages/MessageTrigger.d.ts +8 -0
  111. package/dist/components/Messages/MessageTrigger.js +19 -0
  112. package/dist/components/PortalProvider/CXDTokenObserver.js +11 -11
  113. package/dist/components/Quests/CountdownTimer.d.ts +15 -0
  114. package/dist/components/Quests/CountdownTimer.js +33 -0
  115. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.d.ts +4 -0
  116. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.js +78 -0
  117. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.d.ts +8 -0
  118. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.js +9 -0
  119. package/dist/components/Quests/OnboardingQuest/OnboardingQuest.d.ts +4 -0
  120. package/dist/components/Quests/OnboardingQuest/OnboardingQuest.js +4 -0
  121. package/dist/components/Quests/WageringQuest/WageringQuest.d.ts +4 -0
  122. package/dist/components/Quests/WageringQuest/WageringQuest.js +20 -0
  123. package/dist/components/Quests/WageringQuest/WageringQuestModal.d.ts +9 -0
  124. package/dist/components/Quests/WageringQuest/WageringQuestModal.js +9 -0
  125. package/dist/components/SignUp/SignUp.lazy.d.ts +12 -0
  126. package/dist/components/SignUp/SignUp.lazy.js +18 -0
  127. package/dist/components/SignUp/SignUpContext.d.ts +6 -0
  128. package/dist/components/SignUp/SignUpContext.js +2 -0
  129. package/dist/components/SignUp/SignUpDefault/SignUp.lazy.d.ts +17 -0
  130. package/dist/components/SignUp/SignUpDefault/SignUp.lazy.js +18 -0
  131. package/dist/components/SignUp/SignUpDefault/SignUpContext.d.ts +6 -0
  132. package/dist/components/SignUp/SignUpDefault/SignUpContext.js +2 -0
  133. package/dist/components/SignUp/SignUpDefault/SignUpForm.d.ts +1 -0
  134. package/dist/components/SignUp/SignUpDefault/SignUpForm.js +310 -0
  135. package/dist/components/SignUp/SignUpForm.d.ts +1 -0
  136. package/dist/components/SignUp/SignUpForm.js +284 -0
  137. package/dist/components/SignUp/SignUpKYC/CaptureIdDocument.d.ts +1 -0
  138. package/dist/components/SignUp/SignUpKYC/CaptureIdDocument.js +198 -0
  139. package/dist/components/SignUp/SignUpKYC/CaptureSelfie.d.ts +1 -0
  140. package/dist/components/SignUp/SignUpKYC/CaptureSelfie.js +251 -0
  141. package/dist/components/SignUp/SignUpKYC/ImageUploader.d.ts +10 -0
  142. package/dist/components/SignUp/SignUpKYC/ImageUploader.js +42 -0
  143. package/dist/components/SignUp/SignUpKYC/PersonOverlayDesktop.d.ts +7 -0
  144. package/dist/components/SignUp/SignUpKYC/PersonOverlayDesktop.js +9 -0
  145. package/dist/components/SignUp/SignUpKYC/SignUpFormKYC.d.ts +1 -0
  146. package/dist/components/SignUp/SignUpKYC/SignUpFormKYC.js +464 -0
  147. package/dist/components/SignUp/SignUpKYC/useImageUploader.d.ts +11 -0
  148. package/dist/components/SignUp/SignUpKYC/useImageUploader.js +20 -0
  149. package/dist/components/SignUp/SignUpKYC/utils.d.ts +9 -0
  150. package/dist/components/SignUp/SignUpKYC/utils.js +79 -0
  151. package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.d.ts +1 -0
  152. package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.js +198 -0
  153. package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.d.ts +1 -0
  154. package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.js +251 -0
  155. package/dist/components/SignUp/SignUpPagcor/ImageUploader.d.ts +10 -0
  156. package/dist/components/SignUp/SignUpPagcor/ImageUploader.js +41 -0
  157. package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.d.ts +1 -0
  158. package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.js +429 -0
  159. package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.d.ts +13 -0
  160. package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.js +26 -0
  161. package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.d.ts +7 -0
  162. package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.js +2 -0
  163. package/dist/components/SignUp/SignUpPagcor/useImageUploader.d.ts +11 -0
  164. package/dist/components/SignUp/SignUpPagcor/useImageUploader.js +20 -0
  165. package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.module.css +184 -184
  166. package/dist/components/Tournaments/TournamentsList/TournamentItem.module.css +184 -184
  167. package/dist/components/shared/IdDocumentField.client.d.ts +25 -0
  168. package/dist/components/shared/IdDocumentField.client.js +204 -0
  169. package/dist/components/shared/IdDocumentField.d.ts +2 -0
  170. package/dist/components/shared/IdDocumentField.js +11 -0
  171. package/dist/components/shared/SelfieField.client.d.ts +20 -0
  172. package/dist/components/shared/SelfieField.client.js +327 -0
  173. package/dist/components/shared/SelfieField.d.ts +2 -0
  174. package/dist/components/shared/SelfieField.js +11 -0
  175. package/dist/constants/BranchCode.d.ts +4 -0
  176. package/dist/constants/BranchCode.js +42 -0
  177. package/dist/handlers/postTransformIdFrontImage.d.ts +3 -0
  178. package/dist/handlers/postTransformIdFrontImage.js +67 -0
  179. package/dist/handlers/postTransformSelfieImage.d.ts +3 -0
  180. package/dist/handlers/postTransformSelfieImage.js +71 -0
  181. package/dist/handlers.d.ts +43 -0
  182. package/dist/handlers.js +297 -0
  183. package/dist/icons/BellRingIcon.d.ts +2 -0
  184. package/dist/icons/BellRingIcon.js +4 -0
  185. package/dist/services/queries.js +3153 -3153
  186. package/dist/styles/theme.css +776 -776
  187. package/dist/ui/AlertDialog/AlertDialog.d.ts +55 -55
  188. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +5 -5
  189. package/dist/ui/Badge/Badge.d.ts +12 -12
  190. package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
  191. package/dist/ui/Badge/badge.recipe.d.ts +3 -3
  192. package/dist/ui/Carousel/Carousel.d.ts +45 -45
  193. package/dist/ui/Carousel/carousel.recipe.d.ts +5 -5
  194. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  195. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  196. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  197. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  198. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  199. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  200. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  201. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  202. package/dist/ui/Dialog/Dialog.d.ts +33 -33
  203. package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
  204. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  205. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  206. package/dist/ui/Field/Field.d.ts +21 -21
  207. package/dist/ui/Field/field.recipe.d.ts +3 -3
  208. package/dist/ui/Menu/Menu.d.ts +252 -252
  209. package/dist/ui/Menu/menu.recipe.d.ts +14 -14
  210. package/dist/ui/NumberInput/NumberInput.d.ts +24 -24
  211. package/dist/ui/NumberInput/numberInput.recipe.d.ts +3 -3
  212. package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
  213. package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
  214. package/dist/ui/PinInput/PinInput.d.ts +12 -12
  215. package/dist/ui/PinInput/pinInput.recipe.d.ts +3 -3
  216. package/dist/ui/Popover/Popover.d.ts +55 -55
  217. package/dist/ui/Popover/popover.recipe.d.ts +5 -5
  218. package/dist/ui/Progress/Progress.d.ts +27 -27
  219. package/dist/ui/Progress/progress.recipe.d.ts +3 -3
  220. package/dist/ui/QrCode/QrCode.d.ts +25 -25
  221. package/dist/ui/QrCode/qrCode.recipe.d.ts +5 -5
  222. package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
  223. package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
  224. package/dist/ui/Select/Select.d.ts +45 -45
  225. package/dist/ui/Select/select.recipe.d.ts +3 -3
  226. package/dist/ui/Table/Table.d.ts +21 -21
  227. package/dist/ui/Table/table.anatomy.d.ts +1 -1
  228. package/dist/ui/Table/table.recipe.d.ts +3 -3
  229. package/dist/utils/dataUrlToBlob.d.ts +1 -0
  230. package/dist/utils/dataUrlToBlob.js +11 -0
  231. package/dist/utils/gamesAvailable3pmTo3am.d.ts +1 -0
  232. package/dist/utils/gamesAvailable3pmTo3am.js +1 -0
  233. package/dist/utils/getGameName.d.ts +1 -0
  234. package/dist/utils/getGameName.js +6 -0
  235. package/dist/utils/isBetween3amAnd3pm.d.ts +1 -0
  236. package/dist/utils/isBetween3amAnd3pm.js +5 -0
  237. package/dist/utils/resizeImageSize.d.ts +2 -0
  238. package/dist/utils/resizeImageSize.js +11 -0
  239. package/package.json +177 -177
  240. package/dist/components/Banner/Banner.client.d.ts +0 -12
  241. package/dist/components/Banner/Banner.client.js +0 -49
  242. package/dist/components/PortalProvider/AndroidOnlyComponents.d.ts +0 -1
  243. package/dist/components/PortalProvider/AndroidOnlyComponents.js +0 -12
@@ -2,9 +2,11 @@ import { ObjectId } from '@opexa/object-id';
2
2
  import { useMutation } from '@tanstack/react-query';
3
3
  import { clamp } from 'lodash-es';
4
4
  import invariant from 'tiny-invariant';
5
+ import { explainError } from '../../components/DepositWithdrawal/utils.js';
5
6
  import { OPEXAPAY_ENDPOINT } from '../../constants/index.js';
6
7
  import { ObjectType } from '../../services/ObjectType.js';
7
8
  import { createAiOGCashDeposit, getDeposit, } from '../../services/wallet.js';
9
+ import { capitalize } from '../../utils/capitalize.js';
8
10
  import { createPoll } from '../../utils/createPoll.js';
9
11
  import { getQueryClient } from '../../utils/getQueryClient.js';
10
12
  import { getCreateAiOGCashDepositMutationKey } from '../../utils/mutationKeys.js';
@@ -51,6 +53,14 @@ export const useCreateAiOGCashDepositMutation = (config) => {
51
53
  maxAttempt: 20,
52
54
  });
53
55
  const res = await poll();
56
+ if (res?.error) {
57
+ const error = new Error();
58
+ error.name = capitalize(res.error, {
59
+ delimiter: capitalize.delimiters.UNDERSCORE,
60
+ });
61
+ error.message = explainError(res.error);
62
+ throw error;
63
+ }
54
64
  if (!res?.checkoutUrl) {
55
65
  const error = new Error();
56
66
  error.name = 'AiOGCashDepositError';
@@ -2,8 +2,10 @@ import { ObjectId } from '@opexa/object-id';
2
2
  import { useMutation } from '@tanstack/react-query';
3
3
  import { clamp } from 'lodash-es';
4
4
  import invariant from 'tiny-invariant';
5
+ import { explainError } from '../../components/DepositWithdrawal/utils.js';
5
6
  import { ObjectType } from '../../services/ObjectType.js';
6
7
  import { createGCashDeposit, getDeposit, } from '../../services/wallet.js';
8
+ import { capitalize } from '../../utils/capitalize.js';
7
9
  import { createPoll } from '../../utils/createPoll.js';
8
10
  import { getQueryClient } from '../../utils/getQueryClient.js';
9
11
  import { getCreateGCashDepositMutationKey } from '../../utils/mutationKeys.js';
@@ -43,6 +45,14 @@ export const useCreateGCashDepositMutation = (config) => {
43
45
  maxAttempt: 20,
44
46
  });
45
47
  const res = await poll();
48
+ if (res?.error) {
49
+ const error = new Error();
50
+ error.name = capitalize(res.error, {
51
+ delimiter: capitalize.delimiters.UNDERSCORE,
52
+ });
53
+ error.message = explainError(res.error);
54
+ throw error;
55
+ }
46
56
  if (!res?.checkoutUrl) {
47
57
  const error = new Error();
48
58
  error.name = 'GCashDepositError';
@@ -2,8 +2,10 @@ import { ObjectId } from '@opexa/object-id';
2
2
  import { useMutation } from '@tanstack/react-query';
3
3
  import { clamp } from 'lodash-es';
4
4
  import invariant from 'tiny-invariant';
5
+ import { explainError } from '../../components/DepositWithdrawal/utils.js';
5
6
  import { ObjectType } from '../../services/ObjectType.js';
6
7
  import { createMayaDeposit, getDeposit, } from '../../services/wallet.js';
8
+ import { capitalize } from '../../utils/capitalize.js';
7
9
  import { createPoll } from '../../utils/createPoll.js';
8
10
  import { getQueryClient } from '../../utils/getQueryClient.js';
9
11
  import { getCreateMayaDepositMutationKey } from '../../utils/mutationKeys.js';
@@ -43,6 +45,14 @@ export const useCreateMayaDepositMutation = (config) => {
43
45
  maxAttempt: 20,
44
46
  });
45
47
  const res = await poll();
48
+ if (res?.error) {
49
+ const error = new Error();
50
+ error.name = capitalize(res.error, {
51
+ delimiter: capitalize.delimiters.UNDERSCORE,
52
+ });
53
+ error.message = explainError(res.error);
54
+ throw error;
55
+ }
46
56
  if (!res?.checkoutUrl) {
47
57
  const error = new Error();
48
58
  error.name = 'MayaDepositError';
@@ -2,8 +2,10 @@ import { ObjectId } from '@opexa/object-id';
2
2
  import { useMutation } from '@tanstack/react-query';
3
3
  import { clamp } from 'lodash-es';
4
4
  import invariant from 'tiny-invariant';
5
+ import { explainError } from '../../components/DepositWithdrawal/utils.js';
5
6
  import { ObjectType } from '../../services/ObjectType.js';
6
7
  import { createAIOOnlineBankDeposit, getDeposit, } from '../../services/wallet.js';
8
+ import { capitalize } from '../../utils/capitalize.js';
7
9
  import { createPoll } from '../../utils/createPoll.js';
8
10
  import { getQueryClient } from '../../utils/getQueryClient.js';
9
11
  import { getCreateOnlineBankDepositMutationKey } from '../../utils/mutationKeys.js';
@@ -46,6 +48,14 @@ export const useCreateOnlineBankDepositMutation = (config) => {
46
48
  maxAttempt: 5,
47
49
  });
48
50
  const res = await poll();
51
+ if (res?.error) {
52
+ const error = new Error();
53
+ error.name = capitalize(res.error, {
54
+ delimiter: capitalize.delimiters.UNDERSCORE,
55
+ });
56
+ error.message = explainError(res.error);
57
+ throw error;
58
+ }
49
59
  if (!res?.vca) {
50
60
  const error = new Error();
51
61
  error.name = 'OnlineBankDepositError';
@@ -2,8 +2,10 @@ import { ObjectId } from '@opexa/object-id';
2
2
  import { useMutation } from '@tanstack/react-query';
3
3
  import { clamp } from 'lodash-es';
4
4
  import invariant from 'tiny-invariant';
5
+ import { explainError } from '../../components/DepositWithdrawal/utils.js';
5
6
  import { ObjectType } from '../../services/ObjectType.js';
6
7
  import { createAIOQRPHDeposit, getDeposit, } from '../../services/wallet.js';
8
+ import { capitalize } from '../../utils/capitalize.js';
7
9
  import { createPoll } from '../../utils/createPoll.js';
8
10
  import { getQueryClient } from '../../utils/getQueryClient.js';
9
11
  import { getCreateQRPHDepositMutationKey } from '../../utils/mutationKeys.js';
@@ -46,6 +48,14 @@ export const useCreateQRPHDepositMutation = (config) => {
46
48
  maxAttempt: 5,
47
49
  });
48
50
  const res = await poll();
51
+ if (res?.error) {
52
+ const error = new Error();
53
+ error.name = capitalize(res.error, {
54
+ delimiter: capitalize.delimiters.UNDERSCORE,
55
+ });
56
+ error.message = explainError(res.error);
57
+ throw error;
58
+ }
49
59
  if (!res?.qrCode) {
50
60
  const error = new Error();
51
61
  error.name = 'QRPHDepositError';
@@ -48,6 +48,7 @@ export function AiOGCashDeposit() {
48
48
  const verificationQuery = useMemberVerificationQuery();
49
49
  const verificationStatus = verificationQuery.data?.status ?? 'UNVERIFIED';
50
50
  const [status, setStatus] = useState('waiting');
51
+ const [errorMessage, setErrorMessage] = useState(null);
51
52
  const createDepositMutation = useCreateAiOGCashDepositMutation({
52
53
  onMutate() {
53
54
  disclosure.setOpen(true);
@@ -62,8 +63,12 @@ export function AiOGCashDeposit() {
62
63
  });
63
64
  setStatus('success');
64
65
  },
65
- onError() {
66
+ onError(data) {
66
67
  setStatus('failed');
68
+ setErrorMessage({
69
+ name: data.name,
70
+ message: data.message,
71
+ });
67
72
  },
68
73
  });
69
74
  const warn = useBoolean();
@@ -192,6 +197,7 @@ export function AiOGCashDeposit() {
192
197
  disclosure.setOpen(details.open);
193
198
  }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: () => {
194
199
  setStatus('waiting');
200
+ setErrorMessage(null);
195
201
  form.reset();
196
202
  warn.setFalse();
197
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: () => {
@@ -203,14 +209,13 @@ export function AiOGCashDeposit() {
203
209
  }
204
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' &&
205
211
  !warn.value &&
206
- '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' &&
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' && errorMessage?.name] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
207
213
  "We're verifying your account and amount. Please hold a moment.", status === 'success' &&
208
214
  !warn.value &&
209
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' &&
210
216
  warn.value &&
211
217
  'Closing this window might cancel your current deposit. Do you want to continue?', status === 'confirmed' &&
212
- 'Your deposit has been successfully processed.', status === 'failed' &&
213
- 'Something went wrong while processing your deposit. Please try again or contact support.'] })] }), (status === 'failed' ||
218
+ 'Your deposit has been successfully processed.', status === 'failed' && errorMessage?.message] })] }), (status === 'failed' ||
214
219
  status === 'success' ||
215
220
  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: () => {
216
221
  warn.setFalse();
@@ -48,6 +48,7 @@ export function AiOPayMayaDeposit() {
48
48
  const verificationQuery = useMemberVerificationQuery();
49
49
  const verificationStatus = verificationQuery.data?.status ?? 'UNVERIFIED';
50
50
  const [status, setStatus] = useState('waiting');
51
+ const [errorMessage, setErrorMessage] = useState(null);
51
52
  const createDepositMutation = useCreateAiOPayMayaDepositMutation({
52
53
  onMutate() {
53
54
  disclosure.setOpen(true);
@@ -60,8 +61,12 @@ export function AiOPayMayaDeposit() {
60
61
  queryClient.invalidateQueries({ queryKey: getDepositsCountQueryKey() });
61
62
  setStatus('success');
62
63
  },
63
- onError() {
64
+ onError(data) {
64
65
  setStatus('failed');
66
+ setErrorMessage({
67
+ name: data.name,
68
+ message: data.message,
69
+ });
65
70
  },
66
71
  });
67
72
  const warn = useBoolean();
@@ -190,6 +195,7 @@ export function AiOPayMayaDeposit() {
190
195
  disclosure.setOpen(details.open);
191
196
  }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: () => {
192
197
  setStatus('waiting');
198
+ setErrorMessage(null);
193
199
  form.reset();
194
200
  warn.setFalse();
195
201
  }, 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: () => {
@@ -201,14 +207,13 @@ export function AiOPayMayaDeposit() {
201
207
  }
202
208
  }, 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' &&
203
209
  !warn.value &&
204
- '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' &&
210
+ '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' && errorMessage?.name] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
205
211
  "We're verifying your account and amount. Please hold a moment.", status === 'success' &&
206
212
  !warn.value &&
207
213
  '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' &&
208
214
  warn.value &&
209
215
  'Closing this window might cancel your current deposit. Do you want to continue?', status === 'confirmed' &&
210
- 'Your deposit has been successfully processed.', status === 'failed' &&
211
- 'Something went wrong while processing your deposit. Please try again or contact support.'] })] }), (status === 'failed' ||
216
+ 'Your deposit has been successfully processed.', status === 'failed' && errorMessage?.message] })] }), (status === 'failed' ||
212
217
  status === 'success' ||
213
218
  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: () => {
214
219
  warn.setFalse();
@@ -46,6 +46,7 @@ export function GCashDeposit() {
46
46
  const verificationQuery = useMemberVerificationQuery();
47
47
  const verificationStatus = verificationQuery.data?.status ?? 'UNVERIFIED';
48
48
  const [status, setStatus] = useState('waiting');
49
+ const [errorMessage, setErrorMessage] = useState(null);
49
50
  const createDepositMutation = useCreateGCashDepositMutation({
50
51
  onMutate() {
51
52
  disclosure.setOpen(true);
@@ -56,8 +57,12 @@ export function GCashDeposit() {
56
57
  window.open(data.checkoutUrl, '_blank', 'noopener,noreferrer');
57
58
  setStatus('success');
58
59
  },
59
- onError() {
60
+ onError(data) {
60
61
  setStatus('failed');
62
+ setErrorMessage({
63
+ name: data.name,
64
+ message: data.message,
65
+ });
61
66
  },
62
67
  });
63
68
  const warn = useBoolean();
@@ -183,6 +188,7 @@ export function GCashDeposit() {
183
188
  disclosure.setOpen(details.open);
184
189
  }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: () => {
185
190
  setStatus('waiting');
191
+ setErrorMessage(null);
186
192
  form.reset();
187
193
  warn.setFalse();
188
194
  }, 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: () => {
@@ -194,14 +200,13 @@ export function GCashDeposit() {
194
200
  }
195
201
  }, 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' &&
196
202
  !warn.value &&
197
- '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' &&
203
+ "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' && errorMessage?.name] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
198
204
  "We're verifying your account and amount. Please hold a moment.", status === 'success' &&
199
205
  !warn.value &&
200
- 'Sometimes the payment pop up doesnt appear right away. Dont worry, just click the button below to reopen it and continue your deposit.', status === 'success' &&
206
+ "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' &&
201
207
  warn.value &&
202
208
  'Closing this window might cancel your current deposit. Do you want to continue?', status === 'confirmed' &&
203
- 'Your deposit has been successfully processed.', status === 'failed' &&
204
- 'Something went wrong while processing your deposit. Please try again or contact support.'] })] }), (status === 'failed' ||
209
+ 'Your deposit has been successfully processed.', status === 'failed' && errorMessage?.message] })] }), (status === 'failed' ||
205
210
  status === 'success' ||
206
211
  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: () => {
207
212
  warn.setFalse();
@@ -34,6 +34,7 @@ export function MayaAppDeposit() {
34
34
  const verificationQuery = useMemberVerificationQuery();
35
35
  const verificationStatus = verificationQuery.data?.status ?? 'UNVERIFIED';
36
36
  const [status, setStatus] = useState('waiting');
37
+ const [errorMessage, setErrorMessage] = useState(null);
37
38
  const createDepositMutation = useCreateMayaAppDepositMutation({
38
39
  onMutate() {
39
40
  setStatus('processing');
@@ -42,8 +43,12 @@ export function MayaAppDeposit() {
42
43
  setStatus('success');
43
44
  form.reset();
44
45
  },
45
- onError() {
46
+ onError(data) {
46
47
  setStatus('failed');
48
+ setErrorMessage({
49
+ name: data.name,
50
+ message: data.message,
51
+ });
47
52
  },
48
53
  });
49
54
  const depositsCountQuery = useDepositsCountQuery();
@@ -149,10 +154,10 @@ export function MayaAppDeposit() {
149
154
  }, 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: status !== 'waiting', onOpenChange: (details) => {
150
155
  if (!details.open) {
151
156
  setStatus('waiting');
157
+ setErrorMessage(null);
152
158
  }
153
- }, 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, { disabled: status === 'processing', 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' &&
154
- "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' &&
155
- '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: () => {
159
+ }, 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, { disabled: status === 'processing', 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' && errorMessage?.name] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
160
+ "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' && errorMessage?.message] })] }), (status === 'failed' || status === 'success') && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
156
161
  api.setOpen(false);
157
162
  }, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
158
163
  }
@@ -46,6 +46,7 @@ export function MayaDeposit() {
46
46
  const verificationQuery = useMemberVerificationQuery();
47
47
  const verificationStatus = verificationQuery.data?.status ?? 'UNVERIFIED';
48
48
  const [status, setStatus] = useState('waiting');
49
+ const [errorMessage, setErrorMessage] = useState(null);
49
50
  const createDepositMutation = useCreateMayaDepositMutation({
50
51
  onMutate() {
51
52
  disclosure.setOpen(true);
@@ -56,8 +57,12 @@ export function MayaDeposit() {
56
57
  window.open(data.checkoutUrl, '_blank', 'noopener,noreferrer');
57
58
  setStatus('success');
58
59
  },
59
- onError() {
60
+ onError(data) {
60
61
  setStatus('failed');
62
+ setErrorMessage({
63
+ name: data.name,
64
+ message: data.message,
65
+ });
61
66
  },
62
67
  });
63
68
  const warn = useBoolean();
@@ -183,6 +188,7 @@ export function MayaDeposit() {
183
188
  disclosure.setOpen(details.open);
184
189
  }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: () => {
185
190
  setStatus('waiting');
191
+ setErrorMessage(null);
186
192
  form.reset();
187
193
  warn.setFalse();
188
194
  }, 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: () => {
@@ -194,14 +200,13 @@ export function MayaDeposit() {
194
200
  }
195
201
  }, 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' &&
196
202
  !warn.value &&
197
- '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' &&
203
+ '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' && errorMessage?.name] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
198
204
  "We're verifying your account and amount. Please hold a moment.", status === 'success' &&
199
205
  !warn.value &&
200
206
  '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' &&
201
207
  warn.value &&
202
208
  'Closing this window might cancel your current deposit. Do you want to continue?', status === 'confirmed' &&
203
- 'Your deposit has been successfully processed.', status === 'failed' &&
204
- 'Something went wrong while processing your deposit. Please try again or contact support.'] })] }), (status === 'failed' ||
209
+ 'Your deposit has been successfully processed.', status === 'failed' && errorMessage?.message] })] }), (status === 'failed' ||
205
210
  status === 'success' ||
206
211
  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: () => {
207
212
  warn.setFalse();
@@ -1,6 +1,6 @@
1
1
  export declare const OnlineBankDepositContext: (props: {
2
2
  value: {
3
- view: "form" | "vca";
3
+ view: "vca" | "form";
4
4
  status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
5
5
  verify: () => void;
6
6
  reset: () => void;
@@ -13,7 +13,7 @@ export declare const OnlineBankDepositContext: (props: {
13
13
  } & {
14
14
  children?: import("react").ReactNode | undefined;
15
15
  }) => React.ReactNode, useOnlineBankDepositContext: () => {
16
- view: "form" | "vca";
16
+ view: "vca" | "form";
17
17
  status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
18
18
  verify: () => void;
19
19
  reset: () => void;
@@ -1,7 +1,7 @@
1
1
  import type { Deposit } from '../../../../types';
2
2
  export type UseOnlineBankDepositReturn = ReturnType<typeof useOnlineBankDeposit>;
3
3
  export declare function useOnlineBankDeposit(): {
4
- view: "form" | "vca";
4
+ view: "vca" | "form";
5
5
  status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
6
6
  verify: () => void;
7
7
  reset: () => void;
@@ -7,5 +7,5 @@ import { Portal } from '../../../../ui/Portal/index.js';
7
7
  import { useQRPHDepositContext } from './QRPHDepositContext.js';
8
8
  export function Failed() {
9
9
  const context = useQRPHDepositContext();
10
- return (_jsx(AlertDialog.Root, { open: context.status === 'failed', lazyMount: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+3)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+4)]", children: _jsxs(AlertDialog.Content, { children: [_jsx("button", { type: "button", className: "absolute top-4 right-4 icon:size-6 p-md text-text-quinary disabled:cursor-not-allowed disabled:opacity-50", onClick: context.reset, children: _jsx(XIcon, {}) }), _jsx("div", { className: "mx-auto flex size-12 items-center justify-center rounded-full bg-bg-error-secondary", children: _jsx(AlertCircleIcon, { className: "size-6 text-text-featured-icon-light-error" }) }), _jsx(AlertDialog.Title, { className: "mt-xl", children: "Your deposit failed or was cancelled." }), _jsx(AlertDialog.Description, { className: "mt-xl px-3", children: "Your deposit was not completed or has been cancelled. You can try again by generating a\u00A0new\u00A0QR code." }), _jsx(Button, { className: "mt-4xl w-full", variant: "outline", onClick: context.regenerateQRCode, children: "Generate New QR Code" })] }) })] }) }));
10
+ return (_jsx(AlertDialog.Root, { open: context.status === 'failed', lazyMount: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+3)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+4)]", children: _jsxs(AlertDialog.Content, { children: [_jsx("button", { type: "button", className: "absolute top-4 right-4 icon:size-6 p-md text-text-quinary disabled:cursor-not-allowed disabled:opacity-50", onClick: context.reset, children: _jsx(XIcon, {}) }), _jsx("div", { className: "mx-auto flex size-12 items-center justify-center rounded-full bg-bg-error-secondary", children: _jsx(AlertCircleIcon, { className: "size-6 text-text-featured-icon-light-error" }) }), _jsx(AlertDialog.Title, { className: "mt-xl", children: context.errorMessage?.name || 'Your deposit failed or was cancelled.' }), _jsx(AlertDialog.Description, { className: "mt-xl px-3", children: context.errorMessage?.message || 'Your deposit was not completed or has been cancelled. You can try again by generating a new QR code.' }), _jsx(Button, { className: "mt-4xl w-full", variant: "outline", onClick: context.regenerateQRCode, children: "Generate New QR Code" })] }) })] }) }));
11
11
  }
@@ -2,6 +2,10 @@ export declare const QRPHDepositContext: (props: {
2
2
  value: {
3
3
  status: "idle" | "confirmed" | "failed" | "generating-qr-code" | "qr-code-generated";
4
4
  deposit: import("../../../../types").Deposit | null;
5
+ errorMessage: {
6
+ name: string;
7
+ message: string;
8
+ } | null;
5
9
  generateQRCode: (input: import("./useQRPHDeposit").GenerateQRCodeInput) => Promise<void>;
6
10
  regenerateQRCode: () => Promise<void>;
7
11
  reset: () => void;
@@ -11,6 +15,10 @@ export declare const QRPHDepositContext: (props: {
11
15
  }) => React.ReactNode, useQRPHDepositContext: () => {
12
16
  status: "idle" | "confirmed" | "failed" | "generating-qr-code" | "qr-code-generated";
13
17
  deposit: import("../../../../types").Deposit | null;
18
+ errorMessage: {
19
+ name: string;
20
+ message: string;
21
+ } | null;
14
22
  generateQRCode: (input: import("./useQRPHDeposit").GenerateQRCodeInput) => Promise<void>;
15
23
  regenerateQRCode: () => Promise<void>;
16
24
  reset: () => void;
@@ -7,6 +7,10 @@ export interface GenerateQRCodeInput {
7
7
  export declare function useQRPHDeposit(): {
8
8
  status: "idle" | "confirmed" | "failed" | "generating-qr-code" | "qr-code-generated";
9
9
  deposit: Deposit | null;
10
+ errorMessage: {
11
+ name: string;
12
+ message: string;
13
+ } | null;
10
14
  generateQRCode: (input: GenerateQRCodeInput) => Promise<void>;
11
15
  regenerateQRCode: () => Promise<void>;
12
16
  reset: () => void;
@@ -14,6 +14,7 @@ export function useQRPHDeposit() {
14
14
  const inputRef = useRef(null);
15
15
  const [deposit, setDeposit] = useState(null);
16
16
  const [status, setStatus] = useState('idle');
17
+ const [errorMessage, setErrorMessage] = useState(null);
17
18
  const verificationQuery = useMemberVerificationQuery();
18
19
  const verificationStatus = verificationQuery.data?.status ?? 'UNVERIFIED';
19
20
  const mutation = useCreateQRPHDepositMutation({
@@ -25,8 +26,12 @@ export function useQRPHDeposit() {
25
26
  setStatus('qr-code-generated');
26
27
  setDeposit(data);
27
28
  },
28
- onError() {
29
+ onError(data) {
29
30
  setStatus('failed');
31
+ setErrorMessage({
32
+ name: data.name,
33
+ message: data.message,
34
+ });
30
35
  },
31
36
  });
32
37
  const query = useDepositQuery(deposit?.id, {
@@ -82,11 +87,13 @@ export function useQRPHDeposit() {
82
87
  const reset = () => {
83
88
  setStatus('idle');
84
89
  setDeposit(null);
90
+ setErrorMessage(null);
85
91
  inputRef.current = null;
86
92
  };
87
93
  return {
88
94
  status,
89
95
  deposit,
96
+ errorMessage,
90
97
  generateQRCode,
91
98
  regenerateQRCode,
92
99
  reset,
@@ -1,6 +1,6 @@
1
1
  export declare const QRPHDepositContext: (props: {
2
2
  value: {
3
- view: "form" | "qrCode";
3
+ view: "qrCode" | "form";
4
4
  status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
5
5
  verify: () => void;
6
6
  reset: () => void;
@@ -13,7 +13,7 @@ export declare const QRPHDepositContext: (props: {
13
13
  } & {
14
14
  children?: import("react").ReactNode | undefined;
15
15
  }) => React.ReactNode, useQRPHDepositContext: () => {
16
- view: "form" | "qrCode";
16
+ view: "qrCode" | "form";
17
17
  status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
18
18
  verify: () => void;
19
19
  reset: () => void;
@@ -1,7 +1,7 @@
1
1
  import type { Deposit } from '../../../../types';
2
2
  export type UseQRPHDepositReturn = ReturnType<typeof useQRPHDeposit>;
3
3
  export declare function useQRPHDeposit(): {
4
- view: "form" | "qrCode";
4
+ view: "qrCode" | "form";
5
5
  status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
6
6
  verify: () => void;
7
7
  reset: () => void;
@@ -0,0 +1 @@
1
+ export declare function Confirmed(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { CheckCircleIcon } from '../../../../icons/CheckCircleIcon.js';
3
+ import { XIcon } from '../../../../icons/XIcon.js';
4
+ import { AlertDialog } from '../../../../ui/AlertDialog/index.js';
5
+ import { Button } from '../../../../ui/Button/index.js';
6
+ import { Portal } from '../../../../ui/Portal/index.js';
7
+ import { useQRPHDepositContext } from './QRPHDepositContext.js';
8
+ export function Confirmed() {
9
+ const context = useQRPHDepositContext();
10
+ return (_jsx(AlertDialog.Root, { open: context.status === 'confirmed', lazyMount: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+3)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+4)]", children: _jsxs(AlertDialog.Content, { children: [_jsx("button", { type: "button", className: "absolute top-4 right-4 icon:size-6 p-md text-text-quinary disabled:cursor-not-allowed disabled:opacity-50", onClick: context.reset, children: _jsx(XIcon, {}) }), _jsx("div", { className: "mx-auto flex size-12 items-center justify-center rounded-full bg-bg-success-secondary", children: _jsx(CheckCircleIcon, { className: "size-6 text-text-featured-icon-light-success" }) }), _jsx(AlertDialog.Title, { className: "mt-xl", children: "Your deposit was successful!" }), _jsx(AlertDialog.Description, { className: "mt-xl px-3", children: "The funds have been added to your account." }), _jsx(Button, { className: "mt-4xl w-full", onClick: context.reset, children: "Ok" })] }) })] }) }));
11
+ }
@@ -0,0 +1 @@
1
+ export declare function Failed(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
3
+ import { XIcon } from '../../../../icons/XIcon.js';
4
+ import { AlertDialog } from '../../../../ui/AlertDialog/index.js';
5
+ import { Button } from '../../../../ui/Button/index.js';
6
+ import { Portal } from '../../../../ui/Portal/index.js';
7
+ import { useQRPHDepositContext } from './QRPHDepositContext.js';
8
+ export function Failed() {
9
+ const context = useQRPHDepositContext();
10
+ return (_jsx(AlertDialog.Root, { open: context.status === 'failed', lazyMount: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+3)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+4)]", children: _jsxs(AlertDialog.Content, { children: [_jsx("button", { type: "button", className: "absolute top-4 right-4 icon:size-6 p-md text-text-quinary disabled:cursor-not-allowed disabled:opacity-50", onClick: context.reset, children: _jsx(XIcon, {}) }), _jsx("div", { className: "mx-auto flex size-12 items-center justify-center rounded-full bg-bg-error-secondary", children: _jsx(AlertCircleIcon, { className: "size-6 text-text-featured-icon-light-error" }) }), _jsx(AlertDialog.Title, { className: "mt-xl", children: "Your deposit failed or was cancelled." }), _jsx(AlertDialog.Description, { className: "mt-xl px-3", children: "Your deposit was not completed or has been cancelled. You can try again by generating a\u00A0new\u00A0QR code." }), _jsx(Button, { className: "mt-4xl w-full", variant: "outline", onClick: context.regenerateQRCode, children: "Generate New QR Code" })] }) })] }) }));
11
+ }
@@ -0,0 +1 @@
1
+ export declare function Form(): import("react/jsx-runtime").JSX.Element;