@opexa/portal-components 0.0.889 → 0.0.891

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 (117) hide show
  1. package/dist/client/hooks/useCreateAiOGCashDepositMutation.d.ts +4 -0
  2. package/dist/client/hooks/useCreateAiOGCashDepositMutation.js +90 -0
  3. package/dist/client/hooks/useCreateAiOGrabPayDepositMutation.d.ts +4 -0
  4. package/dist/client/hooks/useCreateAiOGrabPayDepositMutation.js +80 -0
  5. package/dist/client/hooks/useCreateAiOPalawanPayDepositMutation.d.ts +4 -0
  6. package/dist/client/hooks/useCreateAiOPalawanPayDepositMutation.js +80 -0
  7. package/dist/client/hooks/useCreateAiOPayMayaDepositMutation.d.ts +4 -0
  8. package/dist/client/hooks/useCreateAiOPayMayaDepositMutation.js +80 -0
  9. package/dist/client/hooks/useCreateAurixPayGCashDepositMutation.d.ts +4 -0
  10. package/dist/client/hooks/useCreateAurixPayGCashDepositMutation.js +82 -0
  11. package/dist/client/hooks/useCreateAurixPayGrabPayDepositMutation.d.ts +4 -0
  12. package/dist/client/hooks/useCreateAurixPayGrabPayDepositMutation.js +88 -0
  13. package/dist/client/hooks/useCreateAurixPayPayMayaDepositMutation.d.ts +4 -0
  14. package/dist/client/hooks/useCreateAurixPayPayMayaDepositMutation.js +88 -0
  15. package/dist/client/hooks/useCreateAurixPayQrphDepositMutation.d.ts +4 -0
  16. package/dist/client/hooks/useCreateAurixPayQrphDepositMutation.js +88 -0
  17. package/dist/components/DepositWithdrawal/Deposit/AiOGCashDeposit/AiOGCashDeposit.js +1 -1
  18. package/dist/components/DepositWithdrawal/Deposit/AiOGrabPayDeposit/AiOGrabPayDeposit.js +1 -1
  19. package/dist/components/DepositWithdrawal/Deposit/AiOPalawanPayDeposit/AiOPalawanPayDeposit.js +1 -1
  20. package/dist/components/DepositWithdrawal/Deposit/AiOPayMayaDeposit/AiOPayMayaDeposit.js +1 -1
  21. package/dist/components/DepositWithdrawal/Deposit/AurixPayGCashDeposit/AurixPayGCashDeposit.d.ts +1 -0
  22. package/dist/components/DepositWithdrawal/Deposit/AurixPayGCashDeposit/AurixPayGCashDeposit.js +241 -0
  23. package/dist/components/DepositWithdrawal/Deposit/AurixPayGrabPayDeposit/AurixPayGrabPayDeposit.d.ts +1 -0
  24. package/dist/components/DepositWithdrawal/Deposit/AurixPayGrabPayDeposit/AurixPayGrabPayDeposit.js +241 -0
  25. package/dist/components/DepositWithdrawal/Deposit/AurixPayPayMayaDeposit/AurixPayGrabPayDeposit.d.ts +1 -0
  26. package/dist/components/DepositWithdrawal/Deposit/AurixPayPayMayaDeposit/AurixPayGrabPayDeposit.js +241 -0
  27. package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/AurixPayQRPHDeposit.d.ts +1 -0
  28. package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/AurixPayQRPHDeposit.js +12 -0
  29. package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/AurixPayQRPHDepositContext.d.ts +25 -0
  30. package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/AurixPayQRPHDepositContext.js +2 -0
  31. package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/Confirmed.d.ts +1 -0
  32. package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/Confirmed.js +11 -0
  33. package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/Failed.d.ts +1 -0
  34. package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/Failed.js +13 -0
  35. package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/Form.d.ts +1 -0
  36. package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/Form.js +126 -0
  37. package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/GeneratingQrCode.d.ts +1 -0
  38. package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/GeneratingQrCode.js +10 -0
  39. package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/QrCodeGenerated.d.ts +1 -0
  40. package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/QrCodeGenerated.js +41 -0
  41. package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/useAurixPayQRPHDeposit.d.ts +17 -0
  42. package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/useAurixPayQRPHDeposit.js +117 -0
  43. package/dist/components/DepositWithdrawal/Deposit/Deposit.js +23 -1
  44. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts +2 -2
  45. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts +1 -1
  46. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QrCodeGenerated.js +37 -1
  47. package/dist/components/DepositWithdrawal/DepositWithdrawal.lazy.d.ts +6 -0
  48. package/dist/components/DepositWithdrawal/PaymentMethods.js +20 -0
  49. package/dist/components/DepositWithdrawal/utils.d.ts +1 -1
  50. package/dist/components/DepositWithdrawal/utils.js +4 -0
  51. package/dist/components/ForgotPassword/ForgotPassword.lazy.d.ts +2 -2
  52. package/dist/components/ForgotPassword/ForgotPassword.lazy.js +14 -3
  53. package/dist/components/ForgotPassword/ForgotPasswordForm.d.ts +5 -1
  54. package/dist/components/ForgotPassword/ForgotPasswordForm.js +68 -33
  55. package/dist/components/SignUp/SignUpDefault/SignUpDefaultFormInternational.js +4 -1
  56. package/dist/components/Tournaments/TournamentsCarousel/TournamentCarouselItem.Crazywin.d.ts +1 -0
  57. package/dist/components/Tournaments/TournamentsCarousel/TournamentCarouselItem.Crazywin.js +53 -0
  58. package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarousel.d.ts +1 -0
  59. package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarousel.js +9 -2
  60. package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.HappyBingo.d.ts +1 -0
  61. package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.HappyBingo.js +54 -0
  62. package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.js +2 -2
  63. package/dist/components/TransactionRecords/DepositRecordsTable.js +6 -21
  64. package/dist/components/TransactionRecords/WithdrawalRecordsTable.js +1 -1
  65. package/dist/images/tourna-icon.webp +0 -0
  66. package/dist/schemas/forgotPasswordSchema.d.ts +8 -8
  67. package/dist/services/queries.d.ts +6 -2
  68. package/dist/services/queries.js +179 -1
  69. package/dist/services/wallet.d.ts +55 -0
  70. package/dist/services/wallet.js +44 -1
  71. package/dist/types/index.d.ts +4 -0
  72. package/dist/ui/AlertDialog/AlertDialog.d.ts +154 -154
  73. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +14 -14
  74. package/dist/ui/Badge/Badge.d.ts +12 -12
  75. package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
  76. package/dist/ui/Badge/badge.recipe.d.ts +3 -3
  77. package/dist/ui/Carousel/Carousel.d.ts +72 -72
  78. package/dist/ui/Carousel/carousel.recipe.d.ts +8 -8
  79. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  80. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  81. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  82. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  83. package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
  84. package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
  85. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  86. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  87. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  88. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  89. package/dist/ui/Dialog/Dialog.d.ts +33 -33
  90. package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
  91. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  92. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  93. package/dist/ui/Field/Field.d.ts +21 -21
  94. package/dist/ui/Field/field.recipe.d.ts +3 -3
  95. package/dist/ui/Menu/Menu.d.ts +307 -307
  96. package/dist/ui/Menu/menu.recipe.d.ts +17 -17
  97. package/dist/ui/Popover/Popover.d.ts +121 -121
  98. package/dist/ui/Popover/popover.recipe.d.ts +11 -11
  99. package/dist/ui/Progress/Progress.d.ts +27 -27
  100. package/dist/ui/Progress/progress.recipe.d.ts +3 -3
  101. package/dist/ui/QrCode/QrCode.d.ts +40 -40
  102. package/dist/ui/QrCode/qrCode.recipe.d.ts +8 -8
  103. package/dist/ui/Select/Select.d.ts +45 -45
  104. package/dist/ui/Select/select.recipe.d.ts +3 -3
  105. package/dist/ui/Table/Table.d.ts +21 -21
  106. package/dist/ui/Table/table.anatomy.d.ts +1 -1
  107. package/dist/ui/Table/table.recipe.d.ts +3 -3
  108. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  109. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  110. package/dist/utils/capitalize.d.ts +11 -0
  111. package/dist/utils/capitalize.js +48 -5
  112. package/dist/utils/countries/types.d.ts +1 -1
  113. package/dist/utils/downloadImage.d.ts +4 -0
  114. package/dist/utils/downloadImage.js +47 -0
  115. package/dist/utils/mutationKeys.d.ts +4 -0
  116. package/dist/utils/mutationKeys.js +16 -0
  117. package/package.json +1 -1
@@ -0,0 +1,88 @@
1
+ import { ObjectId } from '@opexa/object-id';
2
+ import { useMutation } from '@tanstack/react-query';
3
+ import { clamp } from 'lodash-es';
4
+ import invariant from 'tiny-invariant';
5
+ import { explainError } from '../../components/DepositWithdrawal/utils.js';
6
+ import { ObjectType } from '../../services/ObjectType.js';
7
+ import { createAurixPayQrphDeposit, getDeposit, } from '../../services/wallet.js';
8
+ import { capitalize } from '../../utils/capitalize.js';
9
+ import { createPoll } from '../../utils/createPoll.js';
10
+ import { getQueryClient } from '../../utils/getQueryClient.js';
11
+ import { getCreateAurixPayQrphDepositMutationKey } from '../../utils/mutationKeys.js';
12
+ import { parseDecimal } from '../../utils/parseDecimal.js';
13
+ import { getAvailableQuestsQueryKey, getDepositsCountQueryKey, } from '../../utils/queryKeys.js';
14
+ import { getSession } from '../services/getSession.js';
15
+ export const useCreateAurixPayQrphDepositMutation = (config) => {
16
+ const queryClient = getQueryClient();
17
+ const mutation = useMutation({
18
+ ...config,
19
+ mutationKey: getCreateAurixPayQrphDepositMutationKey(),
20
+ mutationFn: async (input) => {
21
+ const id = input.id ?? ObjectId.generate(ObjectType.Deposit).toString();
22
+ const session = await getSession();
23
+ invariant(session.status === 'authenticated');
24
+ const successRedirectUrl = new URL('/transactions', input.redirectUrl);
25
+ successRedirectUrl.searchParams.set('tab', 'deposits');
26
+ successRedirectUrl.searchParams.set('id', id);
27
+ await createAurixPayQrphDeposit({
28
+ ...input,
29
+ id,
30
+ }, {
31
+ headers: {
32
+ Authorization: `Bearer ${session.token}`,
33
+ ...(session.domain && {
34
+ Domain: session.domain,
35
+ }),
36
+ },
37
+ });
38
+ const poll = createPoll(async () => {
39
+ const session = await getSession();
40
+ invariant(session.status === 'authenticated');
41
+ return await getDeposit(id, {
42
+ headers: {
43
+ Authorization: `Bearer ${session.token}`,
44
+ },
45
+ });
46
+ }, {
47
+ until(res) {
48
+ return (!!res?.checkoutUrl || !!res?.error || res?.status === 'FAILED');
49
+ },
50
+ interval: 1000,
51
+ maxAttempt: 20,
52
+ });
53
+ const res = await poll();
54
+ if (res?.error) {
55
+ const error = new Error();
56
+ error.name = capitalize(res.error, {
57
+ delimiter: capitalize.delimiters.UNDERSCORE,
58
+ });
59
+ error.message = explainError(res.error);
60
+ throw error;
61
+ }
62
+ if (!res?.checkoutUrl) {
63
+ const error = new Error();
64
+ error.name = 'AurixPayQrphDepositError';
65
+ error.message = 'Failed to process QR PH deposit';
66
+ throw error;
67
+ }
68
+ const depositsCount = queryClient.getQueryData(getDepositsCountQueryKey()) ?? 0;
69
+ if (depositsCount <= 0) {
70
+ queryClient.setQueryData(getAvailableQuestsQueryKey(), (prev) => {
71
+ return prev?.map((quest) => {
72
+ const progressPercentage = clamp(parseDecimal(quest.progressPercentage, 0) + 50, 100);
73
+ if (quest.type === 'ONBOARDING') {
74
+ return {
75
+ ...quest,
76
+ status: progressPercentage >= 100 ? 'COMPLETED' : quest.status,
77
+ progressPercentage: progressPercentage.toFixed(2),
78
+ };
79
+ }
80
+ return quest;
81
+ });
82
+ });
83
+ }
84
+ return res;
85
+ },
86
+ });
87
+ return mutation;
88
+ };
@@ -7,8 +7,8 @@ import invariant from 'tiny-invariant';
7
7
  import { useBoolean } from 'usehooks-ts';
8
8
  import { z } from 'zod';
9
9
  import { useShallow } from 'zustand/shallow';
10
- import { useCreateAiOGCashDepositMutation } from '../../../../client/hooks/useAiOGCashDepositMutation.js';
11
10
  import { useAvailablePromosQuery } from '../../../../client/hooks/useAvailablePromosQuery.js';
11
+ import { useCreateAiOGCashDepositMutation } from '../../../../client/hooks/useCreateAiOGCashDepositMutation.js';
12
12
  import { useDepositQuery } from '../../../../client/hooks/useDepositQuery.js';
13
13
  import { useDepositsCountQuery } from '../../../../client/hooks/useDepositsCountQuery.js';
14
14
  import { useDisclosure } from '../../../../client/hooks/useDisclosure.js';
@@ -7,8 +7,8 @@ import invariant from 'tiny-invariant';
7
7
  import { useBoolean } from 'usehooks-ts';
8
8
  import { z } from 'zod';
9
9
  import { useShallow } from 'zustand/shallow';
10
- import { useCreateAiOGrabPayDepositMutation } from '../../../../client/hooks/useAiOGrabPayDepositMutation.js';
11
10
  import { useAvailablePromosQuery } from '../../../../client/hooks/useAvailablePromosQuery.js';
11
+ import { useCreateAiOGrabPayDepositMutation } from '../../../../client/hooks/useCreateAiOGrabPayDepositMutation.js';
12
12
  import { useDepositQuery } from '../../../../client/hooks/useDepositQuery.js';
13
13
  import { useDepositsCountQuery } from '../../../../client/hooks/useDepositsCountQuery.js';
14
14
  import { useDisclosure } from '../../../../client/hooks/useDisclosure.js';
@@ -7,8 +7,8 @@ import invariant from 'tiny-invariant';
7
7
  import { useBoolean } from 'usehooks-ts';
8
8
  import { z } from 'zod';
9
9
  import { useShallow } from 'zustand/shallow';
10
- import { useCreateAiOPalawanPayDepositMutation } from '../../../../client/hooks/useAiOPalawanPayDepositMutation.js';
11
10
  import { useAvailablePromosQuery } from '../../../../client/hooks/useAvailablePromosQuery.js';
11
+ import { useCreateAiOPalawanPayDepositMutation } from '../../../../client/hooks/useCreateAiOPalawanPayDepositMutation.js';
12
12
  import { useDepositQuery } from '../../../../client/hooks/useDepositQuery.js';
13
13
  import { useDepositsCountQuery } from '../../../../client/hooks/useDepositsCountQuery.js';
14
14
  import { useDisclosure } from '../../../../client/hooks/useDisclosure.js';
@@ -7,8 +7,8 @@ import invariant from 'tiny-invariant';
7
7
  import { useBoolean } from 'usehooks-ts';
8
8
  import { z } from 'zod';
9
9
  import { useShallow } from 'zustand/shallow';
10
- import { useCreateAiOPayMayaDepositMutation } from '../../../../client/hooks/useAiOPayMayaDepositMutation.js';
11
10
  import { useAvailablePromosQuery } from '../../../../client/hooks/useAvailablePromosQuery.js';
11
+ import { useCreateAiOPayMayaDepositMutation } from '../../../../client/hooks/useCreateAiOPayMayaDepositMutation.js';
12
12
  import { useDepositQuery } from '../../../../client/hooks/useDepositQuery.js';
13
13
  import { useDepositsCountQuery } from '../../../../client/hooks/useDepositsCountQuery.js';
14
14
  import { useDisclosure } from '../../../../client/hooks/useDisclosure.js';
@@ -0,0 +1 @@
1
+ export declare function AurixPayGCashDeposit(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,241 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { zodResolver } from '@hookform/resolvers/zod';
3
+ import { ObjectId } from '@opexa/object-id';
4
+ import Link from 'next/link';
5
+ import { useEffect, useState } from 'react';
6
+ import { Controller, useForm } from 'react-hook-form';
7
+ import invariant from 'tiny-invariant';
8
+ import { useBoolean } from 'usehooks-ts';
9
+ import { z } from 'zod';
10
+ import { useShallow } from 'zustand/shallow';
11
+ import { useAvailablePromosQuery } from '../../../../client/hooks/useAvailablePromosQuery.js';
12
+ import { useCreateAurixPayGCashDepositMutation } from '../../../../client/hooks/useCreateAurixPayGCashDepositMutation.js';
13
+ import { useDepositQuery } from '../../../../client/hooks/useDepositQuery.js';
14
+ import { useDepositsCountQuery } from '../../../../client/hooks/useDepositsCountQuery.js';
15
+ import { useDisclosure } from '../../../../client/hooks/useDisclosure.js';
16
+ import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
17
+ import { useMemberVerificationQuery } from '../../../../client/hooks/useMemberVerificationQuery.js';
18
+ import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSettingsQuery.js';
19
+ import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
20
+ import { ChevronDownIcon } from '../../../../icons/ChevronDownIcon.js';
21
+ import { ChevronUpIcon } from '../../../../icons/ChevronUpIcon.js';
22
+ import { RefreshCcw01Icon } from '../../../../icons/RefreshCcw01Icon.js';
23
+ import { SpinnerIcon } from '../../../../icons/SpinnerIcon.js';
24
+ import { XIcon } from '../../../../icons/XIcon.js';
25
+ import { ObjectType } from '../../../../services/ObjectType.js';
26
+ import { AlertDialog } from '../../../../ui/AlertDialog/index.js';
27
+ import { Button } from '../../../../ui/Button/index.js';
28
+ import { Field } from '../../../../ui/Field/index.js';
29
+ import { NumberInput } from '../../../../ui/NumberInput/index.js';
30
+ import { Portal } from '../../../../ui/Portal/index.js';
31
+ import { getQueryClient } from '../../../../utils/getQueryClient.js';
32
+ import { parseDecimal } from '../../../../utils/parseDecimal.js';
33
+ import { getDepositsCountQueryKey } from '../../../../utils/queryKeys.js';
34
+ import { AmountChoices } from '../../AmountChoices.js';
35
+ import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext.js';
36
+ import { AvailablePromos } from '../AvailablePromos.js';
37
+ export function AurixPayGCashDeposit() {
38
+ const depositWithdrawalProps = useDepositWithdrawalPropsContext();
39
+ const disclosure = useDisclosure({
40
+ onOpenChange(open) {
41
+ if (!open) {
42
+ form.reset();
43
+ }
44
+ },
45
+ });
46
+ const globalStore = useGlobalStore(useShallow((ctx) => ({
47
+ depositWithdrawal: ctx.depositWithdrawal,
48
+ kycVerificationStatus: ctx.kycVerificationStatus,
49
+ })));
50
+ const verificationQuery = useMemberVerificationQuery();
51
+ const verificationStatus = verificationQuery.data?.status ?? 'UNVERIFIED';
52
+ const [status, setStatus] = useState('waiting');
53
+ const [errorMessage, setErrorMessage] = useState(null);
54
+ const createDepositMutation = useCreateAurixPayGCashDepositMutation({
55
+ onMutate() {
56
+ disclosure.setOpen(true);
57
+ setStatus('processing');
58
+ },
59
+ onSuccess(data) {
60
+ const queryClient = getQueryClient();
61
+ invariant(data.checkoutUrl);
62
+ window.open(data.checkoutUrl, '_blank', 'noopener,noreferrer');
63
+ queryClient.invalidateQueries({
64
+ queryKey: getDepositsCountQueryKey(),
65
+ });
66
+ setStatus('success');
67
+ },
68
+ onError(data) {
69
+ setStatus('failed');
70
+ setErrorMessage({
71
+ name: data.name,
72
+ message: data.message,
73
+ });
74
+ },
75
+ });
76
+ const warn = useBoolean();
77
+ const depositQuery = useDepositQuery(createDepositMutation.data?.id, {
78
+ enabled: !warn.value && status === 'success',
79
+ refetchInterval: (ctx) => ctx.state.data?.status === 'CONFIRMED' ||
80
+ ctx.state.data?.status === 'REJECTED' ||
81
+ ctx.state.data?.status === 'CANCELLED'
82
+ ? false
83
+ : 1000,
84
+ });
85
+ useEffect(() => {
86
+ if (depositQuery.data?.status === 'CONFIRMED') {
87
+ setStatus('confirmed');
88
+ return;
89
+ }
90
+ if (depositQuery.data?.status === 'REJECTED' ||
91
+ depositQuery.data?.status === 'CANCELLED') {
92
+ setStatus('failed');
93
+ return;
94
+ }
95
+ }, [depositQuery.data?.status]);
96
+ const depositsCountQuery = useDepositsCountQuery();
97
+ const depositsCount = depositsCountQuery.data ?? 0;
98
+ const paymentSettingsQuery = usePaymentSettingsQuery();
99
+ const paymentSettings = paymentSettingsQuery.data;
100
+ const gatewaySettings = paymentSettings?.aioGCashDepositGatewaySettings;
101
+ const maximumAmount = parseDecimal(gatewaySettings?.maximumAmount, 0);
102
+ const minimumAmount = depositsCount <= 0
103
+ ? parseDecimal(paymentSettingsQuery.data?.minimumFirstDepositAmount, 0)
104
+ : parseDecimal(gatewaySettings?.minimumAmount, 0);
105
+ const promosQuery = useAvailablePromosQuery();
106
+ const promos = promosQuery.data ?? [];
107
+ const definition = z
108
+ .object({
109
+ amount: z.string().superRefine((val, ctx) => {
110
+ const n = parseDecimal(val, 0);
111
+ if (n < minimumAmount) {
112
+ ctx.addIssue({
113
+ type: 'number',
114
+ code: z.ZodIssueCode.too_small,
115
+ inclusive: true,
116
+ minimum: minimumAmount,
117
+ message: `Please enter ${minimumAmount.toLocaleString()} or more to proceed with your deposit.`,
118
+ });
119
+ }
120
+ if (n > maximumAmount) {
121
+ ctx.addIssue({
122
+ type: 'number',
123
+ code: z.ZodIssueCode.too_big,
124
+ inclusive: true,
125
+ maximum: maximumAmount,
126
+ message: `Maximum amount is ${maximumAmount.toLocaleString()}`,
127
+ });
128
+ }
129
+ }),
130
+ promo: z.string().optional().nullable(),
131
+ accountNumber: z
132
+ .string()
133
+ .min(1, 'Account number is required')
134
+ .min(8, 'Account number must be 8 or more characters')
135
+ .max(32, 'Account number must not be more than 32 characters'),
136
+ })
137
+ .superRefine((value, ctx) => {
138
+ const promo = promos.find((o) => o.id === value.promo);
139
+ const promoMinAmount = parseDecimal(promo?.minimumDepositAmount, 0);
140
+ const promoMaxAmount = parseDecimal(promo?.maximumDepositAmount, 0);
141
+ const amount = parseDecimal(value.amount, 0);
142
+ if (promo && amount < promoMinAmount) {
143
+ ctx.addIssue({
144
+ path: ['amount'],
145
+ code: z.ZodIssueCode.custom,
146
+ message: `Minimum amount for this promo is ${promoMinAmount.toLocaleString()}`,
147
+ });
148
+ }
149
+ if (promo && amount > promoMaxAmount) {
150
+ ctx.addIssue({
151
+ path: ['amount'],
152
+ code: z.ZodIssueCode.custom,
153
+ message: `Maximum amount for this promo is ${promoMaxAmount}`,
154
+ });
155
+ }
156
+ });
157
+ const form = useForm({
158
+ mode: 'all',
159
+ resolver: zodResolver(definition),
160
+ defaultValues: {
161
+ amount: '0',
162
+ promo: globalStore.depositWithdrawal.promo ?? null,
163
+ accountNumber: '',
164
+ },
165
+ });
166
+ useEffect(() => {
167
+ if (minimumAmount) {
168
+ form.reset({
169
+ amount: minimumAmount.toString(),
170
+ promo: form.getValues('promo') ?? null,
171
+ accountNumber: form.getValues('accountNumber') ?? '',
172
+ });
173
+ }
174
+ }, [form, minimumAmount]);
175
+ const redirectUrl = (() => {
176
+ const path = depositWithdrawalProps.depositSuccessPageUrl ?? '/deposits/:id/status';
177
+ const origin = window.location.origin.includes('localhost')
178
+ ? 'https://uat.powerplay.ph/deposit-success' +
179
+ depositWithdrawalProps.depositSuccessPageUrl
180
+ : window.location.origin;
181
+ return `${origin}${path}`;
182
+ })();
183
+ return (_jsxs("form", { onSubmit: form.handleSubmit(async (data) => {
184
+ if (!depositWithdrawalProps.bypassDepositKycCheck &&
185
+ (verificationStatus === 'PENDING' ||
186
+ verificationStatus === 'UNVERIFIED' ||
187
+ verificationStatus === 'REJECTED' ||
188
+ verificationStatus === 'CREATED')) {
189
+ globalStore.kycVerificationStatus.setOpen(true);
190
+ return;
191
+ }
192
+ else {
193
+ const id = ObjectId.generate(ObjectType.Deposit).toString();
194
+ createDepositMutation.reset();
195
+ createDepositMutation.mutate({
196
+ id,
197
+ amount: data.amount.toString(),
198
+ promo: data.promo ?? undefined,
199
+ redirectUrl: redirectUrl.replace(':id', id),
200
+ accountNumber: data.accountNumber,
201
+ });
202
+ }
203
+ }), noValidate: true, children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.accountNumber, children: [_jsx(Field.Label, { children: "Account number" }), _jsx(Field.Input, { ...form.register('accountNumber') }), _jsx(Field.ErrorText, { children: form.formState.errors.accountNumber?.message })] }), _jsx(Controller, { control: form.control, name: "amount", render: (o) => (_jsxs(Field.Root, { invalid: !!form.formState.errors.amount, className: "mt-lg", children: [_jsxs(NumberInput.Root, { min: 0, step: 1, value: o.field.value, onValueChange: (details) => {
204
+ o.field.onChange(details.value);
205
+ }, 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) => {
206
+ form.setValue('amount', value.toString(), {
207
+ shouldTouch: true,
208
+ shouldDirty: true,
209
+ shouldValidate: true,
210
+ });
211
+ }, min: minimumAmount, max: maximumAmount, className: "mt-lg" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { value: o.field.value, onChange: (value) => {
212
+ o.field.onChange(value);
213
+ globalStore.depositWithdrawal.setPromo(null);
214
+ }, 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) => {
215
+ disclosure.setOpen(details.open);
216
+ }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: () => {
217
+ setStatus('waiting');
218
+ setErrorMessage(null);
219
+ form.reset();
220
+ warn.setFalse();
221
+ }, 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: () => {
222
+ if (status === 'success' && !warn.value) {
223
+ warn.setTrue();
224
+ }
225
+ else {
226
+ api.setOpen(false);
227
+ }
228
+ }, 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' &&
229
+ !warn.value &&
230
+ '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' &&
231
+ "We're verifying your account and amount. Please hold a moment.", status === 'success' &&
232
+ !warn.value &&
233
+ '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' &&
234
+ warn.value &&
235
+ 'Closing this window might cancel your current deposit. Do you want to continue?', status === 'confirmed' &&
236
+ 'Your deposit has been successfully processed.', status === 'failed' && errorMessage?.message] })] }), (status === 'failed' ||
237
+ status === 'success' ||
238
+ 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: () => {
239
+ warn.setFalse();
240
+ }, children: "Go back" }), _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => api.setOpen(false), children: "Continue" })) })] })), status !== 'success' && (_jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => api.setOpen(false), children: "Ok" })) }))] }))] }) })] }) })] }));
241
+ }
@@ -0,0 +1 @@
1
+ export declare function AurixPayPayMayaDeposit(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,241 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { zodResolver } from '@hookform/resolvers/zod';
3
+ import { ObjectId } from '@opexa/object-id';
4
+ import Link from 'next/link';
5
+ import { useEffect, useState } from 'react';
6
+ import { Controller, useForm } from 'react-hook-form';
7
+ import invariant from 'tiny-invariant';
8
+ import { useBoolean } from 'usehooks-ts';
9
+ import { z } from 'zod';
10
+ import { useShallow } from 'zustand/shallow';
11
+ import { useAvailablePromosQuery } from '../../../../client/hooks/useAvailablePromosQuery.js';
12
+ import { useCreateAurixPayPayMayaDepositMutation } from '../../../../client/hooks/useCreateAurixPayPayMayaDepositMutation.js';
13
+ import { useDepositQuery } from '../../../../client/hooks/useDepositQuery.js';
14
+ import { useDepositsCountQuery } from '../../../../client/hooks/useDepositsCountQuery.js';
15
+ import { useDisclosure } from '../../../../client/hooks/useDisclosure.js';
16
+ import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
17
+ import { useMemberVerificationQuery } from '../../../../client/hooks/useMemberVerificationQuery.js';
18
+ import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSettingsQuery.js';
19
+ import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
20
+ import { ChevronDownIcon } from '../../../../icons/ChevronDownIcon.js';
21
+ import { ChevronUpIcon } from '../../../../icons/ChevronUpIcon.js';
22
+ import { RefreshCcw01Icon } from '../../../../icons/RefreshCcw01Icon.js';
23
+ import { SpinnerIcon } from '../../../../icons/SpinnerIcon.js';
24
+ import { XIcon } from '../../../../icons/XIcon.js';
25
+ import { ObjectType } from '../../../../services/ObjectType.js';
26
+ import { AlertDialog } from '../../../../ui/AlertDialog/index.js';
27
+ import { Button } from '../../../../ui/Button/index.js';
28
+ import { Field } from '../../../../ui/Field/index.js';
29
+ import { NumberInput } from '../../../../ui/NumberInput/index.js';
30
+ import { Portal } from '../../../../ui/Portal/index.js';
31
+ import { getQueryClient } from '../../../../utils/getQueryClient.js';
32
+ import { parseDecimal } from '../../../../utils/parseDecimal.js';
33
+ import { getDepositsCountQueryKey } from '../../../../utils/queryKeys.js';
34
+ import { AmountChoices } from '../../AmountChoices.js';
35
+ import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext.js';
36
+ import { AvailablePromos } from '../AvailablePromos.js';
37
+ export function AurixPayPayMayaDeposit() {
38
+ const depositWithdrawalProps = useDepositWithdrawalPropsContext();
39
+ const disclosure = useDisclosure({
40
+ onOpenChange(open) {
41
+ if (!open) {
42
+ form.reset();
43
+ }
44
+ },
45
+ });
46
+ const globalStore = useGlobalStore(useShallow((ctx) => ({
47
+ depositWithdrawal: ctx.depositWithdrawal,
48
+ kycVerificationStatus: ctx.kycVerificationStatus,
49
+ })));
50
+ const verificationQuery = useMemberVerificationQuery();
51
+ const verificationStatus = verificationQuery.data?.status ?? 'UNVERIFIED';
52
+ const [status, setStatus] = useState('waiting');
53
+ const [errorMessage, setErrorMessage] = useState(null);
54
+ const createDepositMutation = useCreateAurixPayPayMayaDepositMutation({
55
+ onMutate() {
56
+ disclosure.setOpen(true);
57
+ setStatus('processing');
58
+ },
59
+ onSuccess(data) {
60
+ const queryClient = getQueryClient();
61
+ invariant(data.checkoutUrl);
62
+ window.open(data.checkoutUrl, '_blank', 'noopener,noreferrer');
63
+ queryClient.invalidateQueries({
64
+ queryKey: getDepositsCountQueryKey(),
65
+ });
66
+ setStatus('success');
67
+ },
68
+ onError(data) {
69
+ setStatus('failed');
70
+ setErrorMessage({
71
+ name: data.name,
72
+ message: data.message,
73
+ });
74
+ },
75
+ });
76
+ const warn = useBoolean();
77
+ const depositQuery = useDepositQuery(createDepositMutation.data?.id, {
78
+ enabled: !warn.value && status === 'success',
79
+ refetchInterval: (ctx) => ctx.state.data?.status === 'CONFIRMED' ||
80
+ ctx.state.data?.status === 'REJECTED' ||
81
+ ctx.state.data?.status === 'CANCELLED'
82
+ ? false
83
+ : 1000,
84
+ });
85
+ useEffect(() => {
86
+ if (depositQuery.data?.status === 'CONFIRMED') {
87
+ setStatus('confirmed');
88
+ return;
89
+ }
90
+ if (depositQuery.data?.status === 'REJECTED' ||
91
+ depositQuery.data?.status === 'CANCELLED') {
92
+ setStatus('failed');
93
+ return;
94
+ }
95
+ }, [depositQuery.data?.status]);
96
+ const depositsCountQuery = useDepositsCountQuery();
97
+ const depositsCount = depositsCountQuery.data ?? 0;
98
+ const paymentSettingsQuery = usePaymentSettingsQuery();
99
+ const paymentSettings = paymentSettingsQuery.data;
100
+ const gatewaySettings = paymentSettings?.aioGCashDepositGatewaySettings;
101
+ const maximumAmount = parseDecimal(gatewaySettings?.maximumAmount, 0);
102
+ const minimumAmount = depositsCount <= 0
103
+ ? parseDecimal(paymentSettingsQuery.data?.minimumFirstDepositAmount, 0)
104
+ : parseDecimal(gatewaySettings?.minimumAmount, 0);
105
+ const promosQuery = useAvailablePromosQuery();
106
+ const promos = promosQuery.data ?? [];
107
+ const definition = z
108
+ .object({
109
+ amount: z.string().superRefine((val, ctx) => {
110
+ const n = parseDecimal(val, 0);
111
+ if (n < minimumAmount) {
112
+ ctx.addIssue({
113
+ type: 'number',
114
+ code: z.ZodIssueCode.too_small,
115
+ inclusive: true,
116
+ minimum: minimumAmount,
117
+ message: `Please enter ${minimumAmount.toLocaleString()} or more to proceed with your deposit.`,
118
+ });
119
+ }
120
+ if (n > maximumAmount) {
121
+ ctx.addIssue({
122
+ type: 'number',
123
+ code: z.ZodIssueCode.too_big,
124
+ inclusive: true,
125
+ maximum: maximumAmount,
126
+ message: `Maximum amount is ${maximumAmount.toLocaleString()}`,
127
+ });
128
+ }
129
+ }),
130
+ promo: z.string().optional().nullable(),
131
+ accountNumber: z
132
+ .string()
133
+ .min(1, 'Account number is required')
134
+ .min(8, 'Account number must be 8 or more characters')
135
+ .max(32, 'Account number must not be more than 32 characters'),
136
+ })
137
+ .superRefine((value, ctx) => {
138
+ const promo = promos.find((o) => o.id === value.promo);
139
+ const promoMinAmount = parseDecimal(promo?.minimumDepositAmount, 0);
140
+ const promoMaxAmount = parseDecimal(promo?.maximumDepositAmount, 0);
141
+ const amount = parseDecimal(value.amount, 0);
142
+ if (promo && amount < promoMinAmount) {
143
+ ctx.addIssue({
144
+ path: ['amount'],
145
+ code: z.ZodIssueCode.custom,
146
+ message: `Minimum amount for this promo is ${promoMinAmount.toLocaleString()}`,
147
+ });
148
+ }
149
+ if (promo && amount > promoMaxAmount) {
150
+ ctx.addIssue({
151
+ path: ['amount'],
152
+ code: z.ZodIssueCode.custom,
153
+ message: `Maximum amount for this promo is ${promoMaxAmount}`,
154
+ });
155
+ }
156
+ });
157
+ const form = useForm({
158
+ mode: 'all',
159
+ resolver: zodResolver(definition),
160
+ defaultValues: {
161
+ amount: '0',
162
+ promo: globalStore.depositWithdrawal.promo ?? null,
163
+ accountNumber: '',
164
+ },
165
+ });
166
+ useEffect(() => {
167
+ if (minimumAmount) {
168
+ form.reset({
169
+ amount: minimumAmount.toString(),
170
+ promo: form.getValues('promo') ?? null,
171
+ accountNumber: form.getValues('accountNumber') ?? '',
172
+ });
173
+ }
174
+ }, [form, minimumAmount]);
175
+ const redirectUrl = (() => {
176
+ const path = depositWithdrawalProps.depositSuccessPageUrl ?? '/deposits/:id/status';
177
+ const origin = window.location.origin.includes('localhost')
178
+ ? 'https://uat.powerplay.ph/deposit-success' +
179
+ depositWithdrawalProps.depositSuccessPageUrl
180
+ : window.location.origin;
181
+ return `${origin}${path}`;
182
+ })();
183
+ return (_jsxs("form", { onSubmit: form.handleSubmit(async (data) => {
184
+ if (!depositWithdrawalProps.bypassDepositKycCheck &&
185
+ (verificationStatus === 'PENDING' ||
186
+ verificationStatus === 'UNVERIFIED' ||
187
+ verificationStatus === 'REJECTED' ||
188
+ verificationStatus === 'CREATED')) {
189
+ globalStore.kycVerificationStatus.setOpen(true);
190
+ return;
191
+ }
192
+ else {
193
+ const id = ObjectId.generate(ObjectType.Deposit).toString();
194
+ createDepositMutation.reset();
195
+ createDepositMutation.mutate({
196
+ id,
197
+ amount: data.amount.toString(),
198
+ promo: data.promo ?? undefined,
199
+ redirectUrl: redirectUrl.replace(':id', id),
200
+ accountNumber: data.accountNumber,
201
+ });
202
+ }
203
+ }), noValidate: true, children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.accountNumber, children: [_jsx(Field.Label, { children: "Account number" }), _jsx(Field.Input, { ...form.register('accountNumber') }), _jsx(Field.ErrorText, { children: form.formState.errors.accountNumber?.message })] }), _jsx(Controller, { control: form.control, name: "amount", render: (o) => (_jsxs(Field.Root, { invalid: !!form.formState.errors.amount, className: "mt-lg", children: [_jsxs(NumberInput.Root, { min: 0, step: 1, value: o.field.value, onValueChange: (details) => {
204
+ o.field.onChange(details.value);
205
+ }, 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) => {
206
+ form.setValue('amount', value.toString(), {
207
+ shouldTouch: true,
208
+ shouldDirty: true,
209
+ shouldValidate: true,
210
+ });
211
+ }, min: minimumAmount, max: maximumAmount, className: "mt-lg" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { value: o.field.value, onChange: (value) => {
212
+ o.field.onChange(value);
213
+ globalStore.depositWithdrawal.setPromo(null);
214
+ }, 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) => {
215
+ disclosure.setOpen(details.open);
216
+ }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: () => {
217
+ setStatus('waiting');
218
+ setErrorMessage(null);
219
+ form.reset();
220
+ warn.setFalse();
221
+ }, 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: () => {
222
+ if (status === 'success' && !warn.value) {
223
+ warn.setTrue();
224
+ }
225
+ else {
226
+ api.setOpen(false);
227
+ }
228
+ }, 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' &&
229
+ !warn.value &&
230
+ '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' &&
231
+ "We're verifying your account and amount. Please hold a moment.", status === 'success' &&
232
+ !warn.value &&
233
+ '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' &&
234
+ warn.value &&
235
+ 'Closing this window might cancel your current deposit. Do you want to continue?', status === 'confirmed' &&
236
+ 'Your deposit has been successfully processed.', status === 'failed' && errorMessage?.message] })] }), (status === 'failed' ||
237
+ status === 'success' ||
238
+ 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: () => {
239
+ warn.setFalse();
240
+ }, children: "Go back" }), _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => api.setOpen(false), children: "Continue" })) })] })), status !== 'success' && (_jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => api.setOpen(false), children: "Ok" })) }))] }))] }) })] }) })] }));
241
+ }
@@ -0,0 +1 @@
1
+ export declare function AurixPayGrabPayDeposit(): import("react/jsx-runtime").JSX.Element;