@opexa/portal-components 0.0.40 → 0.0.42
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.
- package/dist/client/hooks/useCreateOnlineBankDepositMutation.js +4 -1
- package/dist/client/hooks/useCreateQRPHDepositMutation.js +4 -1
- package/dist/client/hooks/useGlobalStore.d.ts +1 -2
- package/dist/client/hooks/useGlobalStore.js +19 -36
- package/dist/client/hooks/useIsMayaSessionValidQuery.js +5 -1
- package/dist/components/Account/Account.d.ts +1 -7
- package/dist/components/Account/Account.js +15 -40
- package/dist/components/AccountInfo/AccountInfo.js +20 -3
- package/dist/components/AccountSecurity/AccountSecurity.js +14 -6
- package/dist/components/AccountVerification/VerificationDetails.js +6 -6
- package/dist/components/DepositWithdrawal/AmountChoices.js +1 -1
- package/dist/components/DepositWithdrawal/Deposit/AvailablePromos.js +21 -16
- package/dist/components/DepositWithdrawal/Deposit/Deposit.js +15 -4
- package/dist/components/DepositWithdrawal/Deposit/GCashDeposit/GCashDeposit.js +20 -32
- package/dist/components/DepositWithdrawal/Deposit/MayaAppDeposit/MayaAppDeposit.js +20 -41
- package/dist/components/DepositWithdrawal/Deposit/MayaDeposit/MayaDeposit.js +20 -32
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDeposit.js +3 -4
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositAlert.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositAlert.js +96 -0
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts +16 -16
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositDetails.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositDetails.js +16 -0
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositForm.d.ts +1 -1
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositForm.js +7 -34
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts +9 -10
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.js +38 -51
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDeposit.js +3 -4
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositAlert.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositAlert.js +96 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositContext.d.ts +14 -16
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositDetails.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositDetails.js +16 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositForm.d.ts +1 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositForm.js +7 -34
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/useQRPHDeposit.d.ts +8 -10
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/useQRPHDeposit.js +37 -54
- package/dist/components/DepositWithdrawal/DepositWithdrawal.js +3 -3
- package/dist/components/DepositWithdrawal/PaymentMethods.js +4 -3
- package/dist/components/DepositWithdrawal/Withdrawal/GCashWithdrawal/GCashWithdrawal.js +23 -19
- package/dist/components/DepositWithdrawal/Withdrawal/InstapayWithdrawal/InstapayWithdrawal.js +23 -20
- package/dist/components/DepositWithdrawal/Withdrawal/MayaAppWithdrawal/MayaAppWithdrawal.js +23 -25
- package/dist/components/DepositWithdrawal/Withdrawal/MayaWithdrawal/MayaWithdrawal.js +23 -19
- package/dist/components/DepositWithdrawal/Withdrawal/Withdrawal.js +36 -20
- package/dist/components/GameLaunch/GameLaunch.js +33 -57
- package/dist/components/KYC/KYC.d.ts +1 -0
- package/dist/components/KYC/KYC.js +3 -0
- package/dist/components/KYC/index.d.ts +1 -0
- package/dist/components/KYC/index.js +1 -0
- package/dist/components/Messages/MessageItem.js +12 -7
- package/dist/components/Messages/MessagePopup.js +8 -7
- package/dist/components/PortalProvider/PortalProvider.d.ts +2 -2
- package/dist/components/PortalProvider/PortalProvider.js +8 -5
- package/dist/components/PortalProvider/Providers.d.ts +4 -0
- package/dist/components/PortalProvider/Providers.js +12 -0
- package/dist/components/PortalProvider/Snackbar.d.ts +1 -0
- package/dist/components/PortalProvider/Snackbar.js +21 -0
- package/dist/components/PortalProvider/WebVitals.d.ts +1 -0
- package/dist/components/PortalProvider/WebVitals.js +8 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/icons/SpinnerIcon.js +1 -1
- package/dist/images/QRPH.png +0 -0
- package/dist/images/gcash.png +0 -0
- package/dist/images/gift.png +0 -0
- package/dist/styles/theme.css +28 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/ui/AlertDialog/alertDialog.recipe.js +4 -4
- package/dist/ui/Badge/Badge.d.ts +12 -12
- package/dist/ui/Badge/badge.recipe.d.ts +3 -3
- package/dist/ui/Button/button.recipe.js +1 -1
- package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
- package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
- package/dist/ui/Checkbox/checkbox.recipe.js +2 -2
- package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
- package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
- package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
- package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
- package/dist/ui/Combobox/Combobox.d.ts +196 -196
- package/dist/ui/Combobox/combobox.recipe.d.ts +14 -14
- package/dist/ui/DatePicker/DatePicker.d.ts +192 -192
- package/dist/ui/DatePicker/datePicker.recipe.d.ts +8 -8
- package/dist/ui/NumberInput/NumberInput.d.ts +24 -24
- package/dist/ui/NumberInput/numberInput.recipe.d.ts +3 -3
- package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
- package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
- package/dist/ui/Popover/Popover.d.ts +55 -55
- package/dist/ui/Popover/popover.recipe.d.ts +5 -5
- package/dist/ui/Progress/Progress.d.ts +27 -27
- package/dist/ui/Progress/progress.recipe.d.ts +3 -3
- package/dist/ui/Select/Select.d.ts +45 -45
- package/dist/ui/Select/select.recipe.d.ts +3 -3
- package/dist/ui/Table/Table.d.ts +21 -21
- package/dist/ui/Table/table.recipe.d.ts +3 -3
- package/dist/ui/Tabs/Tabs.d.ts +15 -15
- package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
- package/package.json +11 -5
- package/dist/components/AccountVerification/selfie.png +0 -0
- package/dist/components/AccountVerification/upload-id.png +0 -0
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositLoading.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositLoading.js +0 -5
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositSuccess.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositSuccess.js +0 -5
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositVCA.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositVCA.js +0 -14
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositLoading.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositLoading.js +0 -5
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositQrCode.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositQrCode.js +0 -18
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositSuccess.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositSuccess.js +0 -8
- package/dist/components/DepositWithdrawal/MayaSessionExpired.d.ts +0 -1
- package/dist/components/DepositWithdrawal/MayaSessionExpired.js +0 -5
- package/dist/components/PortalProvider/PortalProvider.client.d.ts +0 -2
- package/dist/components/PortalProvider/PortalProvider.client.js +0 -38
- package/dist/images/QRPh.png +0 -0
|
@@ -1,34 +1,30 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Portal } from '@ark-ui/react';
|
|
3
3
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
4
|
-
import { useEffect } from 'react';
|
|
4
|
+
import { useEffect, useState } from 'react';
|
|
5
5
|
import { Controller, useForm } from 'react-hook-form';
|
|
6
6
|
import invariant from 'tiny-invariant';
|
|
7
7
|
import { z } from 'zod';
|
|
8
|
-
import {
|
|
9
|
-
import { useAvailablePromosQuery, useCreateGCashDepositMutation, useDepositsCountQuery, useDisclosure, useGlobalStore, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
|
|
10
|
-
import { toaster } from '../../../../client/utils/index.js';
|
|
8
|
+
import { useAvailablePromosQuery, useCreateGCashDepositMutation, useDepositsCountQuery, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
|
|
11
9
|
import { AlertCircleIcon, ChevronDownIcon, ChevronUpIcon, SpinnerIcon, XIcon, } from '../../../../icons/index.js';
|
|
12
10
|
import { AlertDialog, Button, Field, NumberInput } from '../../../../ui/index.js';
|
|
13
11
|
import { parseDecimal } from '../../../../utils/index.js';
|
|
14
12
|
import { AmountChoices } from '../../AmountChoices.js';
|
|
15
13
|
import { AvailablePromos } from '../AvailablePromos.js';
|
|
16
14
|
export function GCashDeposit() {
|
|
17
|
-
const
|
|
18
|
-
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
19
|
-
depositWithdrawal: ctx.depositWithdrawal,
|
|
20
|
-
})));
|
|
15
|
+
const [status, setStatus] = useState('waiting');
|
|
21
16
|
const createDepositMutation = useCreateGCashDepositMutation({
|
|
17
|
+
onMutate() {
|
|
18
|
+
setStatus('processing');
|
|
19
|
+
},
|
|
22
20
|
onSuccess(data) {
|
|
23
21
|
invariant(data.checkoutUrl);
|
|
24
22
|
window.open(data.checkoutUrl, '_blank', 'noopener,noreferrer');
|
|
25
23
|
form.reset();
|
|
26
|
-
|
|
24
|
+
setStatus('success');
|
|
27
25
|
},
|
|
28
|
-
onError(
|
|
29
|
-
|
|
30
|
-
description: error.message,
|
|
31
|
-
});
|
|
26
|
+
onError() {
|
|
27
|
+
setStatus('failed');
|
|
32
28
|
},
|
|
33
29
|
});
|
|
34
30
|
const depositsCountQuery = useDepositsCountQuery();
|
|
@@ -120,22 +116,14 @@ export function GCashDeposit() {
|
|
|
120
116
|
shouldDirty: true,
|
|
121
117
|
shouldValidate: true,
|
|
122
118
|
});
|
|
123
|
-
}, min: minimumAmount, max: maximumAmount, className: "mt-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}, children: createDepositMutation.isPending ? (_jsxs(_Fragment, { children: [_jsx(SpinnerIcon, {}), "Processing..."] })) : ('Deposit') }), _jsx(AlertDialog.Root, { role: "alertdialog", open: disclosure.open, onOpenChange: (details) => {
|
|
134
|
-
disclosure.setOpen(details.open);
|
|
135
|
-
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+10)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+25)]", children: _jsxs(AlertDialog.Content, { children: [_jsxs(AlertDialog.Header, { children: [_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-[#FEE4E2] text-[#D92D20]", children: _jsx(AlertCircleIcon, {}) }), _jsx(AlertDialog.CloseTrigger, { children: _jsx(XIcon, {}) })] }), _jsxs(AlertDialog.Body, { children: [_jsx(AlertDialog.Title, { children: "Submit deposit request without promo?" }), _jsx(AlertDialog.Description, { children: "You haven\u2019t selected a promo. Are you sure you want to proceed without one?" })] }), _jsxs(AlertDialog.Footer, { children: [_jsx(Button, { variant: "outline", colorScheme: "gray", onClick: () => {
|
|
136
|
-
disclosure.setOpen(false);
|
|
137
|
-
}, children: "Cancel" }), _jsx(Button, { onClick: () => {
|
|
138
|
-
handleSubmit();
|
|
139
|
-
disclosure.setOpen(false);
|
|
140
|
-
}, children: "Proceed" })] })] }) })] }) })] }));
|
|
119
|
+
}, min: minimumAmount, max: maximumAmount, className: "mt-lg" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { value: o.field.value, onChange: o.field.onChange, className: "mt-3xl" })) }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: createDepositMutation.isPending, children: "Deposit" }), _jsxs("p", { className: "text-text-tertiary-600 mt-lg text-xs", children: ["By depositing, you agree to our", ' ', _jsx("button", { type: "button", className: "text-text-warning-primary-600 underline underline-offset-2", children: "Terms of Use and Privacy Policy" }), "."] }), _jsx(AlertDialog.Root, { open: status !== 'waiting', onOpenChange: (details) => {
|
|
120
|
+
if (!details.open) {
|
|
121
|
+
setStatus('waiting');
|
|
122
|
+
}
|
|
123
|
+
}, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+2)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+3)]", children: _jsxs(AlertDialog.Content, { children: [_jsx(AlertDialog.CloseTrigger, { disabled: status === 'processing', children: _jsx(XIcon, {}) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "text-text-brand-primary-600 size-12" })), status === 'success' && (_jsx("div", { className: "bg-bg-success-secondary text-text-featured-icon-light-success flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "bg-bg-error-secondary text-text-featured-icon-light-error flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Deposit', status === 'success' && 'Deposit Successful', status === 'failed' && 'Deposit Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
|
|
124
|
+
"We're verifying your account and amount. Please hold a moment.", status === 'success' &&
|
|
125
|
+
'Your deposit has been successfully processed.', status === 'failed' &&
|
|
126
|
+
'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: () => {
|
|
127
|
+
api.setOpen(false);
|
|
128
|
+
}, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
|
|
141
129
|
}
|
|
@@ -1,39 +1,29 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Portal } from '@ark-ui/react';
|
|
3
3
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
4
|
-
import { useEffect } from 'react';
|
|
4
|
+
import { useEffect, useState } from 'react';
|
|
5
5
|
import { Controller, useForm } from 'react-hook-form';
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
-
import {
|
|
8
|
-
import { useAvailablePromosQuery, useCreateMayaAppDepositMutation, useDepositsCountQuery, useDisclosure, useGlobalStore, useIsMayaSessionValidQuery, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
|
|
9
|
-
import { toaster } from '../../../../client/utils/index.js';
|
|
7
|
+
import { useAvailablePromosQuery, useCreateMayaAppDepositMutation, useDepositsCountQuery, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
|
|
10
8
|
import { AlertCircleIcon, ChevronDownIcon, ChevronUpIcon, SpinnerIcon, XIcon, } from '../../../../icons/index.js';
|
|
11
9
|
import { AlertDialog, Button, Field, NumberInput } from '../../../../ui/index.js';
|
|
12
10
|
import { parseDecimal } from '../../../../utils/index.js';
|
|
13
11
|
import { AmountChoices } from '../../AmountChoices.js';
|
|
14
|
-
import { MayaSessionExpired } from '../../MayaSessionExpired.js';
|
|
15
12
|
import { AvailablePromos } from '../AvailablePromos.js';
|
|
16
13
|
export function MayaAppDeposit() {
|
|
17
|
-
const
|
|
18
|
-
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
19
|
-
depositWithdrawal: ctx.depositWithdrawal,
|
|
20
|
-
})));
|
|
14
|
+
const [status, setStatus] = useState('waiting');
|
|
21
15
|
const createDepositMutation = useCreateMayaAppDepositMutation({
|
|
16
|
+
onMutate() {
|
|
17
|
+
setStatus('processing');
|
|
18
|
+
},
|
|
22
19
|
onSuccess() {
|
|
20
|
+
setStatus('success');
|
|
23
21
|
form.reset();
|
|
24
|
-
globalStore.depositWithdrawal.setOpen(false);
|
|
25
|
-
toaster.success({
|
|
26
|
-
description: 'Deposit success!',
|
|
27
|
-
});
|
|
28
22
|
},
|
|
29
|
-
onError(
|
|
30
|
-
|
|
31
|
-
description: error.message,
|
|
32
|
-
});
|
|
23
|
+
onError() {
|
|
24
|
+
setStatus('failed');
|
|
33
25
|
},
|
|
34
26
|
});
|
|
35
|
-
const isMayaSessionValidQuery = useIsMayaSessionValidQuery();
|
|
36
|
-
const isMayaSessionValid = isMayaSessionValidQuery.data ?? true;
|
|
37
27
|
const depositsCountQuery = useDepositsCountQuery();
|
|
38
28
|
const depositsCount = depositsCountQuery.data ?? 0;
|
|
39
29
|
const paymentSettingsQuery = usePaymentSettingsQuery();
|
|
@@ -112,9 +102,6 @@ export function MayaAppDeposit() {
|
|
|
112
102
|
promo: data.promo ?? undefined,
|
|
113
103
|
});
|
|
114
104
|
});
|
|
115
|
-
if (!isMayaSessionValid) {
|
|
116
|
-
return _jsx(MayaSessionExpired, {});
|
|
117
|
-
}
|
|
118
105
|
return (_jsxs("form", { onSubmit: handleSubmit, noValidate: true, children: [_jsx(Controller, { control: form.control, name: "amount", render: (o) => (_jsxs(Field.Root, { invalid: !!form.formState.errors.amount, children: [_jsxs(NumberInput.Root, { min: 0, step: 1, value: o.field.value, onValueChange: (details) => {
|
|
119
106
|
o.field.onChange(details.value);
|
|
120
107
|
}, formatOptions: {
|
|
@@ -126,22 +113,14 @@ export function MayaAppDeposit() {
|
|
|
126
113
|
shouldDirty: true,
|
|
127
114
|
shouldValidate: true,
|
|
128
115
|
});
|
|
129
|
-
}, min: minimumAmount, max: maximumAmount, className: "mt-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}, children: createDepositMutation.isPending ? (_jsxs(_Fragment, { children: [_jsx(SpinnerIcon, {}), "Processing..."] })) : ('Deposit') }), _jsx(AlertDialog.Root, { role: "alertdialog", open: disclosure.open, onOpenChange: (details) => {
|
|
140
|
-
disclosure.setOpen(details.open);
|
|
141
|
-
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+10)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+25)]", children: _jsxs(AlertDialog.Content, { children: [_jsxs(AlertDialog.Header, { children: [_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-[#FEE4E2] text-[#D92D20]", children: _jsx(AlertCircleIcon, {}) }), _jsx(AlertDialog.CloseTrigger, { children: _jsx(XIcon, {}) })] }), _jsxs(AlertDialog.Body, { children: [_jsx(AlertDialog.Title, { children: "Submit deposit request without promo?" }), _jsx(AlertDialog.Description, { children: "You haven\u2019t selected a promo. Are you sure you want to proceed without one?" })] }), _jsxs(AlertDialog.Footer, { children: [_jsx(Button, { variant: "outline", colorScheme: "gray", onClick: () => {
|
|
142
|
-
disclosure.setOpen(false);
|
|
143
|
-
}, children: "Cancel" }), _jsx(Button, { onClick: () => {
|
|
144
|
-
handleSubmit();
|
|
145
|
-
disclosure.setOpen(false);
|
|
146
|
-
}, children: "Proceed" })] })] }) })] }) })] }));
|
|
116
|
+
}, min: minimumAmount, max: maximumAmount, className: "mt-lg" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { value: o.field.value, onChange: o.field.onChange, className: "mt-3xl" })) }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: createDepositMutation.isPending, children: "Deposit" }), _jsxs("p", { className: "text-text-tertiary-600 mt-lg text-xs", children: ["By depositing, you agree to our", ' ', _jsx("button", { type: "button", className: "text-text-warning-primary-600 underline underline-offset-2", children: "Terms of Use and Privacy Policy" }), "."] }), _jsx(AlertDialog.Root, { open: status !== 'waiting', onOpenChange: (details) => {
|
|
117
|
+
if (!details.open) {
|
|
118
|
+
setStatus('waiting');
|
|
119
|
+
}
|
|
120
|
+
}, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+2)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+3)]", children: _jsxs(AlertDialog.Content, { children: [_jsx(AlertDialog.CloseTrigger, { disabled: status === 'processing', children: _jsx(XIcon, {}) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "text-text-brand-primary-600 size-12" })), status === 'success' && (_jsx("div", { className: "bg-bg-success-secondary text-text-featured-icon-light-success flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "bg-bg-error-secondary text-text-featured-icon-light-error flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Deposit', status === 'success' && 'Deposit Successful', status === 'failed' && 'Deposit Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
|
|
121
|
+
"We're verifying your account and amount. Please hold a moment.", status === 'success' &&
|
|
122
|
+
'Your deposit has been successfully processed.', status === 'failed' &&
|
|
123
|
+
'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: () => {
|
|
124
|
+
api.setOpen(false);
|
|
125
|
+
}, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
|
|
147
126
|
}
|
|
@@ -1,34 +1,30 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Portal } from '@ark-ui/react';
|
|
3
3
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
4
|
-
import { useEffect } from 'react';
|
|
4
|
+
import { useEffect, useState } from 'react';
|
|
5
5
|
import { Controller, useForm } from 'react-hook-form';
|
|
6
6
|
import invariant from 'tiny-invariant';
|
|
7
7
|
import { z } from 'zod';
|
|
8
|
-
import {
|
|
9
|
-
import { useAvailablePromosQuery, useCreateMayaDepositMutation, useDepositsCountQuery, useDisclosure, useGlobalStore, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
|
|
10
|
-
import { toaster } from '../../../../client/utils/index.js';
|
|
8
|
+
import { useAvailablePromosQuery, useCreateMayaDepositMutation, useDepositsCountQuery, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
|
|
11
9
|
import { AlertCircleIcon, ChevronDownIcon, ChevronUpIcon, SpinnerIcon, XIcon, } from '../../../../icons/index.js';
|
|
12
10
|
import { AlertDialog, Button, Field, NumberInput } from '../../../../ui/index.js';
|
|
13
11
|
import { parseDecimal } from '../../../../utils/index.js';
|
|
14
12
|
import { AmountChoices } from '../../AmountChoices.js';
|
|
15
13
|
import { AvailablePromos } from '../AvailablePromos.js';
|
|
16
14
|
export function MayaDeposit() {
|
|
17
|
-
const
|
|
18
|
-
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
19
|
-
depositWithdrawal: ctx.depositWithdrawal,
|
|
20
|
-
})));
|
|
15
|
+
const [status, setStatus] = useState('waiting');
|
|
21
16
|
const createDepositMutation = useCreateMayaDepositMutation({
|
|
17
|
+
onMutate() {
|
|
18
|
+
setStatus('processing');
|
|
19
|
+
},
|
|
22
20
|
onSuccess(data) {
|
|
23
21
|
invariant(data.checkoutUrl);
|
|
24
22
|
window.open(data.checkoutUrl, '_blank', 'noopener,noreferrer');
|
|
25
23
|
form.reset();
|
|
26
|
-
|
|
24
|
+
setStatus('success');
|
|
27
25
|
},
|
|
28
|
-
onError(
|
|
29
|
-
|
|
30
|
-
description: error.message,
|
|
31
|
-
});
|
|
26
|
+
onError() {
|
|
27
|
+
setStatus('failed');
|
|
32
28
|
},
|
|
33
29
|
});
|
|
34
30
|
const depositsCountQuery = useDepositsCountQuery();
|
|
@@ -120,22 +116,14 @@ export function MayaDeposit() {
|
|
|
120
116
|
shouldDirty: true,
|
|
121
117
|
shouldValidate: true,
|
|
122
118
|
});
|
|
123
|
-
}, min: minimumAmount, max: maximumAmount, className: "mt-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}, children: createDepositMutation.isPending ? (_jsxs(_Fragment, { children: [_jsx(SpinnerIcon, {}), "Processing..."] })) : ('Deposit') }), _jsx(AlertDialog.Root, { role: "alertdialog", open: disclosure.open, onOpenChange: (details) => {
|
|
134
|
-
disclosure.setOpen(details.open);
|
|
135
|
-
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+10)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+25)]", children: _jsxs(AlertDialog.Content, { children: [_jsxs(AlertDialog.Header, { children: [_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-[#FEE4E2] text-[#D92D20]", children: _jsx(AlertCircleIcon, {}) }), _jsx(AlertDialog.CloseTrigger, { children: _jsx(XIcon, {}) })] }), _jsxs(AlertDialog.Body, { children: [_jsx(AlertDialog.Title, { children: "Submit deposit request without promo?" }), _jsx(AlertDialog.Description, { children: "You haven\u2019t selected a promo. Are you sure you want to proceed without one?" })] }), _jsxs(AlertDialog.Footer, { children: [_jsx(Button, { variant: "outline", colorScheme: "gray", onClick: () => {
|
|
136
|
-
disclosure.setOpen(false);
|
|
137
|
-
}, children: "Cancel" }), _jsx(Button, { onClick: () => {
|
|
138
|
-
handleSubmit();
|
|
139
|
-
disclosure.setOpen(false);
|
|
140
|
-
}, children: "Proceed" })] })] }) })] }) })] }));
|
|
119
|
+
}, min: minimumAmount, max: maximumAmount, className: "mt-lg" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { value: o.field.value, onChange: o.field.onChange, className: "mt-3xl" })) }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: createDepositMutation.isPending, children: "Deposit" }), _jsxs("p", { className: "text-text-tertiary-600 mt-lg text-xs", children: ["By depositing, you agree to our", ' ', _jsx("button", { type: "button", className: "text-text-warning-primary-600 underline underline-offset-2", children: "Terms of Use and Privacy Policy" }), "."] }), _jsx(AlertDialog.Root, { open: status !== 'waiting', onOpenChange: (details) => {
|
|
120
|
+
if (!details.open) {
|
|
121
|
+
setStatus('waiting');
|
|
122
|
+
}
|
|
123
|
+
}, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+2)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+3)]", children: _jsxs(AlertDialog.Content, { children: [_jsx(AlertDialog.CloseTrigger, { disabled: status === 'processing', children: _jsx(XIcon, {}) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "text-text-brand-primary-600 size-12" })), status === 'success' && (_jsx("div", { className: "bg-bg-success-secondary text-text-featured-icon-light-success flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "bg-bg-error-secondary text-text-featured-icon-light-error flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Deposit', status === 'success' && 'Deposit Successful', status === 'failed' && 'Deposit Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
|
|
124
|
+
"We're verifying your account and amount. Please hold a moment.", status === 'success' &&
|
|
125
|
+
'Your deposit has been successfully processed.', status === 'failed' &&
|
|
126
|
+
'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: () => {
|
|
127
|
+
api.setOpen(false);
|
|
128
|
+
}, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
|
|
141
129
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { OnlineBankDepositAlert } from './OnlineBankDepositAlert.js';
|
|
2
3
|
import { OnlineBankDepositContext } from './OnlineBankDepositContext.js';
|
|
4
|
+
import { OnlineBankDepositDetails } from './OnlineBankDepositDetails.js';
|
|
3
5
|
import { OnlineBankDepositForm } from './OnlineBankDepositForm.js';
|
|
4
|
-
import { OnlineBankDepositLoading } from './OnlineBankDepositLoading.js';
|
|
5
|
-
import { OnlineBankDepositSuccess } from './OnlineBankDepositSuccess.js';
|
|
6
|
-
import { OnlineBankDepositVCA } from './OnlineBankDepositVCA.js';
|
|
7
6
|
import { useOnlineBankDeposit } from './useOnlineBankDeposit.js';
|
|
8
7
|
export function OnlineBankDeposit() {
|
|
9
8
|
const context = useOnlineBankDeposit();
|
|
10
|
-
return (_jsxs(OnlineBankDepositContext, { value: context, children: [
|
|
9
|
+
return (_jsxs(OnlineBankDepositContext, { value: context, children: [_jsx(OnlineBankDepositForm, {}), _jsx(OnlineBankDepositDetails, {}), _jsx(OnlineBankDepositAlert, {})] }));
|
|
11
10
|
}
|
package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositAlert.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function OnlineBankDepositAlert(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Portal } from '@ark-ui/react';
|
|
3
|
+
import { AlertCircleIcon, SpinnerIcon, XIcon } from '../../../../icons/index.js';
|
|
4
|
+
import { AlertDialog, Button } from '../../../../ui/index.js';
|
|
5
|
+
import { useOnlineBankDepositContext } from './OnlineBankDepositContext.js';
|
|
6
|
+
export function OnlineBankDepositAlert() {
|
|
7
|
+
const context = useOnlineBankDepositContext();
|
|
8
|
+
const details = useDetails();
|
|
9
|
+
return (_jsx(AlertDialog.Root, { open: context.status !== 'waiting' &&
|
|
10
|
+
context.status !== 'verification-waiting', onOpenChange: (details) => {
|
|
11
|
+
if (!details.open) {
|
|
12
|
+
context.reset();
|
|
13
|
+
}
|
|
14
|
+
}, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+2)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+3)]", children: _jsxs(AlertDialog.Content, { children: [_jsx(AlertDialog.CloseTrigger, { disabled: details.type === 'loading', children: _jsx(XIcon, {}) }), _jsxs(AlertDialog.Header, { children: [details.type === 'loading' && (_jsx(SpinnerIcon, { className: "text-text-brand-primary-600 size-12" })), details.type === 'success' && (_jsx("div", { className: "bg-bg-success-secondary text-text-featured-icon-light-success flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, {}) })), details.type === 'erorr' && (_jsx("div", { className: "bg-bg-error-secondary text-text-featured-icon-light-error flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsx(AlertDialog.Title, { children: details.title }), _jsx(AlertDialog.Description, { children: details.description })] }), (details.type === 'erorr' || details.type === 'success') && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
|
|
15
|
+
api.setOpen(false);
|
|
16
|
+
}, children: details.type === 'success' ? 'Ok' : 'Try Again' })) }) }))] }) })] }) }));
|
|
17
|
+
}
|
|
18
|
+
function useDetails() {
|
|
19
|
+
const context = useOnlineBankDepositContext();
|
|
20
|
+
const title = (() => {
|
|
21
|
+
let s = '';
|
|
22
|
+
if (context.status === 'processing') {
|
|
23
|
+
s = 'Processing Deposit';
|
|
24
|
+
}
|
|
25
|
+
else if (context.status === 'failed') {
|
|
26
|
+
s = 'Deposit Failed';
|
|
27
|
+
}
|
|
28
|
+
else if (context.status === 'verification-success') {
|
|
29
|
+
s = 'Deposit Successful';
|
|
30
|
+
}
|
|
31
|
+
else if (context.status === 'verification-processing') {
|
|
32
|
+
s = 'Verifying Deposit';
|
|
33
|
+
}
|
|
34
|
+
else if (context.status === 'verification-failed') {
|
|
35
|
+
if (context.deposit?.status === 'CANCELLED') {
|
|
36
|
+
s = 'Deposit Cancelled';
|
|
37
|
+
}
|
|
38
|
+
else if (context.deposit?.status === 'REJECTED') {
|
|
39
|
+
s = 'Deposit Rejected';
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
s = 'Deposit Failed';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return s;
|
|
46
|
+
})();
|
|
47
|
+
const description = (() => {
|
|
48
|
+
let d = '';
|
|
49
|
+
if (context.status === 'processing') {
|
|
50
|
+
d = "We're verifying your account and amount. Please hold a moment.";
|
|
51
|
+
}
|
|
52
|
+
else if (context.status === 'failed') {
|
|
53
|
+
d =
|
|
54
|
+
'Something went wrong while processing your deposit. ' +
|
|
55
|
+
'Please try again or contact support.';
|
|
56
|
+
}
|
|
57
|
+
else if (context.status === 'verification-success') {
|
|
58
|
+
d = 'Your deposit has been successfully processed.';
|
|
59
|
+
}
|
|
60
|
+
else if (context.status === 'verification-processing') {
|
|
61
|
+
d = 'Your deposit is being processed.';
|
|
62
|
+
}
|
|
63
|
+
else if (context.status === 'verification-failed') {
|
|
64
|
+
if (context.deposit?.status === 'CANCELLED') {
|
|
65
|
+
d = 'Your deposit has been cancelled.';
|
|
66
|
+
}
|
|
67
|
+
else if (context.deposit?.status === 'REJECTED') {
|
|
68
|
+
d = 'Your deposit has been rejected.';
|
|
69
|
+
}
|
|
70
|
+
else if (context.deposit?.status === 'FAILED') {
|
|
71
|
+
d = context.deposit.error ?? 'Your deposit has failed.';
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
d =
|
|
75
|
+
'Something went wrong while processing your deposit. ' +
|
|
76
|
+
'Please try again or contact support.';
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return d;
|
|
80
|
+
})();
|
|
81
|
+
const type = (() => {
|
|
82
|
+
if (context.status === 'failed' ||
|
|
83
|
+
context.status === 'verification-failed') {
|
|
84
|
+
return 'erorr';
|
|
85
|
+
}
|
|
86
|
+
if (context.status === 'verification-success') {
|
|
87
|
+
return 'success';
|
|
88
|
+
}
|
|
89
|
+
return 'loading';
|
|
90
|
+
})();
|
|
91
|
+
return {
|
|
92
|
+
type,
|
|
93
|
+
title,
|
|
94
|
+
description,
|
|
95
|
+
};
|
|
96
|
+
}
|
package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
export declare const OnlineBankDepositContext: import("react").Context<{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
amount: string;
|
|
6
|
-
promo?: string | undefined;
|
|
7
|
-
id?: string | undefined;
|
|
8
|
-
}, unknown>;
|
|
9
|
-
regenerateVca: () => void;
|
|
2
|
+
view: "form" | "vca";
|
|
3
|
+
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
4
|
+
verify: () => void;
|
|
10
5
|
reset: () => void;
|
|
6
|
+
deposit: import("@opexa/portal-sdk-core").Deposit | null;
|
|
7
|
+
generateVCA: (input: {
|
|
8
|
+
amount: string;
|
|
9
|
+
promo?: string | null;
|
|
10
|
+
}) => void;
|
|
11
11
|
} | null>;
|
|
12
12
|
export declare const useOnlineBankDepositContext: () => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
amount: string;
|
|
17
|
-
promo?: string | undefined;
|
|
18
|
-
id?: string | undefined;
|
|
19
|
-
}, unknown>;
|
|
20
|
-
regenerateVca: () => void;
|
|
13
|
+
view: "form" | "vca";
|
|
14
|
+
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
15
|
+
verify: () => void;
|
|
21
16
|
reset: () => void;
|
|
17
|
+
deposit: import("@opexa/portal-sdk-core").Deposit | null;
|
|
18
|
+
generateVCA: (input: {
|
|
19
|
+
amount: string;
|
|
20
|
+
promo?: string | null;
|
|
21
|
+
}) => void;
|
|
22
22
|
};
|
package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositDetails.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function OnlineBankDepositDetails(): import("react/jsx-runtime").JSX.Element | null;
|
package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositDetails.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Portal } from '@ark-ui/react';
|
|
3
|
+
import Image from 'next/image';
|
|
4
|
+
import { BankIcon, XIcon } from '../../../../icons/index.js';
|
|
5
|
+
import bankIcon from '../../../../images/bank-icon.png';
|
|
6
|
+
import { Button, Clipboard, Dialog } from '../../../../ui/index.js';
|
|
7
|
+
import { useOnlineBankDepositContext } from './OnlineBankDepositContext.js';
|
|
8
|
+
export function OnlineBankDepositDetails() {
|
|
9
|
+
const context = useOnlineBankDepositContext();
|
|
10
|
+
if (context.view !== 'vca')
|
|
11
|
+
return null;
|
|
12
|
+
return (_jsxs("div", { className: "bg-bg-primary-alt rounded-lg p-2xl", children: [_jsx(Image, { src: bankIcon, alt: "", width: 52, height: 44.2, className: "mx-auto h-auto w-[3.25rem]" }), _jsx("p", { className: "mt-8 text-center font-semibold", children: "Your unique Virtual Collection Account (VCA) is:" }), _jsx(Clipboard.Root, { value: context.deposit?.vca ?? '', className: "mx-auto mt-6 max-w-[22.5rem]", children: _jsxs(Clipboard.Control, { className: "flex flex-col gap-4 lg:flex-row", children: [_jsx(Clipboard.Input, { className: "lg:grow" }), _jsx(Clipboard.Context, { children: (ctx) => (_jsx(Clipboard.Trigger, { asChild: true, children: _jsx(Button, { fullWidth: false, className: "w-full shrink-0 lg:w-28", children: ctx.copied ? 'Copied' : 'Copy VCA' }) })) })] }) }), _jsx(Instruction, {})] }));
|
|
13
|
+
}
|
|
14
|
+
function Instruction() {
|
|
15
|
+
return (_jsxs("p", { className: "text-text-tertiary-600 mt-6 text-center text-xs", children: ["Need help using the online bank for payment?", ' ', _jsxs(Dialog.Root, { lazyMount: true, unmountOnExit: true, children: [_jsx(Dialog.Trigger, { className: "text-text-warning-primary-600", children: "See instructions" }), _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+2)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+3)] flex items-center justify-center", children: _jsxs(Dialog.Content, { className: "mx-auto w-[calc(100%-2rem)] rounded-lg p-4xl lg:w-[33.625rem]", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs(Dialog.Body, { children: [_jsxs("div", { className: "flex items-center gap-xl", children: [_jsx("div", { className: "border-border-primary shadow-xs text-gray-700 text-text-secondary-700 flex size-11 items-center justify-center rounded-lg border", children: _jsx(BankIcon, { className: "size-6" }) }), _jsx(Dialog.Title, { className: "text-lg font-semibold", children: "How to Use Online Bank for Payment" })] }), _jsx(Dialog.Description, { className: "mt-5", children: "Follow these simple steps to complete your transaction:" }), _jsxs("ol", { className: "mt-3 list-inside list-decimal space-y-3", children: [_jsx("li", { children: "Click the 'Copy VCA' button to save your unique account number." }), _jsx("li", { children: "Log in to your Online Banking: Open your bank's app or website." }), _jsx("li", { children: "Initiate a Deposit: Choose the option to make a deposit." }), _jsx("li", { children: "Enter VCA: Paste your VCA in the designated field." }), _jsx("li", { children: "Complete Transaction: Follow your bank's prompts to finalize the deposit." })] }), _jsx("p", { className: "mt-3", children: "Note: Please ensure that the deposit amount you enter matches exactly." })] })] }) })] })] })] }));
|
|
16
|
+
}
|
package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositForm.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function OnlineBankDepositForm(): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare function OnlineBankDepositForm(): import("react/jsx-runtime").JSX.Element | null;
|
package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositForm.js
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Portal } from '@ark-ui/react';
|
|
3
2
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
4
3
|
import { noop } from 'lodash-es';
|
|
5
4
|
import { useEffect } from 'react';
|
|
6
5
|
import { Controller, useForm } from 'react-hook-form';
|
|
7
6
|
import { z } from 'zod';
|
|
8
|
-
import { useAvailablePromosQuery, useDepositsCountQuery,
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { useAvailablePromosQuery, useDepositsCountQuery, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
|
|
8
|
+
import { ChevronDownIcon, ChevronUpIcon } from '../../../../icons/index.js';
|
|
9
|
+
import { Button, Field, NumberInput } from '../../../../ui/index.js';
|
|
11
10
|
import { parseDecimal } from '../../../../utils/index.js';
|
|
12
11
|
import { AmountChoices } from '../../AmountChoices.js';
|
|
13
12
|
import { AvailablePromos } from '../AvailablePromos.js';
|
|
14
13
|
import { useOnlineBankDepositContext } from './OnlineBankDepositContext.js';
|
|
15
14
|
export function OnlineBankDepositForm() {
|
|
16
15
|
const context = useOnlineBankDepositContext();
|
|
17
|
-
const disclosure = useDisclosure();
|
|
18
16
|
const depositsCountQuery = useDepositsCountQuery();
|
|
19
17
|
const depositsCount = depositsCountQuery.data ?? 0;
|
|
20
18
|
const paymentSettingsQuery = usePaymentSettingsQuery();
|
|
@@ -87,17 +85,9 @@ export function OnlineBankDepositForm() {
|
|
|
87
85
|
});
|
|
88
86
|
}
|
|
89
87
|
}, [form, minimumAmount]);
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
promo: data.promo ?? undefined,
|
|
94
|
-
}, {
|
|
95
|
-
onSuccess() {
|
|
96
|
-
form.reset();
|
|
97
|
-
},
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
return (_jsxs("form", { onSubmit: handleSubmit, noValidate: true, children: [_jsxs(Field.Root, { children: [_jsx(Field.Label, { children: "Bank" }), _jsx(Field.Input, { value: "BANKNET", onChange: noop, readOnly: true })] }), _jsx(Controller, { control: form.control, name: "amount", render: (o) => (_jsxs(Field.Root, { invalid: !!form.formState.errors.amount, className: "mt-4", children: [_jsxs(NumberInput.Root, { min: 0, step: 1, value: o.field.value, onValueChange: (details) => {
|
|
88
|
+
if (context.view !== 'form')
|
|
89
|
+
return null;
|
|
90
|
+
return (_jsxs("form", { onSubmit: form.handleSubmit(context.generateVCA), noValidate: true, children: [_jsxs(Field.Root, { children: [_jsx(Field.Label, { children: "Bank" }), _jsx(Field.Input, { value: "BANKNET", onChange: noop, readOnly: true })] }), _jsx(Controller, { control: form.control, name: "amount", render: (o) => (_jsxs(Field.Root, { invalid: !!form.formState.errors.amount, className: "mt-3xl", children: [_jsxs(NumberInput.Root, { min: 0, step: 1, value: o.field.value, onValueChange: (details) => {
|
|
101
91
|
o.field.onChange(details.value);
|
|
102
92
|
}, formatOptions: {
|
|
103
93
|
maximumFractionDigits: 2,
|
|
@@ -108,22 +98,5 @@ export function OnlineBankDepositForm() {
|
|
|
108
98
|
shouldDirty: true,
|
|
109
99
|
shouldValidate: true,
|
|
110
100
|
});
|
|
111
|
-
}, min: minimumAmount, max: maximumAmount, className: "mt-
|
|
112
|
-
const ok = await form.trigger('amount');
|
|
113
|
-
if (!ok)
|
|
114
|
-
return;
|
|
115
|
-
if (promos.length <= 0)
|
|
116
|
-
return;
|
|
117
|
-
if (form.getValues('promo'))
|
|
118
|
-
return;
|
|
119
|
-
e.preventDefault();
|
|
120
|
-
disclosure.setOpen(true);
|
|
121
|
-
}, children: "Deposit" }), _jsx(AlertDialog.Root, { role: "alertdialog", open: disclosure.open, onOpenChange: (details) => {
|
|
122
|
-
disclosure.setOpen(details.open);
|
|
123
|
-
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+10)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+25)]", children: _jsxs(AlertDialog.Content, { children: [_jsxs(AlertDialog.Header, { children: [_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-[#FEE4E2] text-[#D92D20]", children: _jsx(AlertCircleIcon, {}) }), _jsx(AlertDialog.CloseTrigger, { children: _jsx(XIcon, {}) })] }), _jsxs(AlertDialog.Body, { children: [_jsx(AlertDialog.Title, { children: "Submit deposit request without promo?" }), _jsx(AlertDialog.Description, { children: "You haven\u2019t selected a promo. Are you sure you want to proceed without one?" })] }), _jsxs(AlertDialog.Footer, { children: [_jsx(Button, { variant: "outline", colorScheme: "gray", onClick: () => {
|
|
124
|
-
disclosure.setOpen(false);
|
|
125
|
-
}, children: "Cancel" }), _jsx(Button, { onClick: () => {
|
|
126
|
-
handleSubmit();
|
|
127
|
-
disclosure.setOpen(false);
|
|
128
|
-
}, children: "Proceed" })] })] }) })] }) })] }));
|
|
101
|
+
}, min: minimumAmount, max: maximumAmount, className: "mt-lg" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { className: "mt-3xl", value: o.field.value, onChange: o.field.onChange })) }), _jsx(Button, { type: "submit", className: "mt-3xl", children: "Deposit" }), _jsxs("p", { className: "text-text-tertiary-600 mt-lg text-xs", children: ["By depositing, you agree to our", ' ', _jsx("button", { type: "button", className: "text-text-warning-primary-600 underline underline-offset-2", children: "Terms of Use and Privacy Policy" }), "."] })] }));
|
|
129
102
|
}
|
package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
type
|
|
1
|
+
import type { Deposit } from '@opexa/portal-sdk-core';
|
|
2
2
|
export type UseOnlineBankDepositReturn = ReturnType<typeof useOnlineBankDeposit>;
|
|
3
3
|
export declare function useOnlineBankDeposit(): {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
amount: string;
|
|
8
|
-
promo?: string | undefined;
|
|
9
|
-
id?: string | undefined;
|
|
10
|
-
}, unknown>;
|
|
11
|
-
regenerateVca: () => void;
|
|
4
|
+
view: "form" | "vca";
|
|
5
|
+
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
6
|
+
verify: () => void;
|
|
12
7
|
reset: () => void;
|
|
8
|
+
deposit: Deposit | null;
|
|
9
|
+
generateVCA: (input: {
|
|
10
|
+
amount: string;
|
|
11
|
+
promo?: string | null;
|
|
12
|
+
}) => void;
|
|
13
13
|
};
|
|
14
|
-
export {};
|