@opexa/portal-components 0.0.41 → 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.
Files changed (86) hide show
  1. package/dist/client/hooks/useCreateOnlineBankDepositMutation.js +4 -1
  2. package/dist/client/hooks/useCreateQRPHDepositMutation.js +4 -1
  3. package/dist/client/hooks/useIsMayaSessionValidQuery.js +5 -1
  4. package/dist/components/DepositWithdrawal/Deposit/Deposit.js +15 -4
  5. package/dist/components/DepositWithdrawal/Deposit/GCashDeposit/GCashDeposit.js +23 -16
  6. package/dist/components/DepositWithdrawal/Deposit/MayaAppDeposit/MayaAppDeposit.js +23 -25
  7. package/dist/components/DepositWithdrawal/Deposit/MayaDeposit/MayaDeposit.js +23 -16
  8. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDeposit.js +3 -4
  9. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositAlert.d.ts +1 -0
  10. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositAlert.js +96 -0
  11. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts +16 -16
  12. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositDetails.d.ts +1 -0
  13. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositDetails.js +16 -0
  14. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositForm.d.ts +1 -1
  15. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositForm.js +3 -11
  16. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts +9 -10
  17. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.js +38 -51
  18. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDeposit.js +3 -4
  19. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositAlert.d.ts +1 -0
  20. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositAlert.js +96 -0
  21. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositContext.d.ts +14 -16
  22. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositDetails.d.ts +1 -0
  23. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositDetails.js +16 -0
  24. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositForm.d.ts +1 -1
  25. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositForm.js +3 -11
  26. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/useQRPHDeposit.d.ts +8 -10
  27. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/useQRPHDeposit.js +37 -54
  28. package/dist/components/DepositWithdrawal/PaymentMethods.js +3 -2
  29. package/dist/components/DepositWithdrawal/Withdrawal/GCashWithdrawal/GCashWithdrawal.js +23 -19
  30. package/dist/components/DepositWithdrawal/Withdrawal/InstapayWithdrawal/InstapayWithdrawal.js +23 -20
  31. package/dist/components/DepositWithdrawal/Withdrawal/MayaAppWithdrawal/MayaAppWithdrawal.js +23 -25
  32. package/dist/components/DepositWithdrawal/Withdrawal/MayaWithdrawal/MayaWithdrawal.js +23 -19
  33. package/dist/components/DepositWithdrawal/Withdrawal/Withdrawal.js +11 -2
  34. package/dist/icons/SpinnerIcon.js +1 -1
  35. package/dist/images/QRPH.png +0 -0
  36. package/dist/images/gcash.png +0 -0
  37. package/dist/styles/theme.css +28 -1
  38. package/dist/tsconfig.build.tsbuildinfo +1 -1
  39. package/dist/ui/AlertDialog/AlertDialog.d.ts +154 -154
  40. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +14 -14
  41. package/dist/ui/Badge/Badge.d.ts +12 -12
  42. package/dist/ui/Badge/badge.recipe.d.ts +3 -3
  43. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  44. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  45. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  46. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  47. package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
  48. package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
  49. package/dist/ui/Combobox/Combobox.d.ts +196 -196
  50. package/dist/ui/Combobox/combobox.recipe.d.ts +14 -14
  51. package/dist/ui/DatePicker/DatePicker.d.ts +192 -192
  52. package/dist/ui/DatePicker/datePicker.recipe.d.ts +8 -8
  53. package/dist/ui/NumberInput/NumberInput.d.ts +24 -24
  54. package/dist/ui/NumberInput/numberInput.recipe.d.ts +3 -3
  55. package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
  56. package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
  57. package/dist/ui/Popover/Popover.d.ts +55 -55
  58. package/dist/ui/Popover/popover.recipe.d.ts +5 -5
  59. package/dist/ui/Progress/Progress.d.ts +27 -27
  60. package/dist/ui/Progress/progress.recipe.d.ts +3 -3
  61. package/dist/ui/Select/Select.d.ts +45 -45
  62. package/dist/ui/Select/select.recipe.d.ts +3 -3
  63. package/dist/ui/Table/Table.d.ts +21 -21
  64. package/dist/ui/Table/table.recipe.d.ts +3 -3
  65. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  66. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  67. package/package.json +10 -5
  68. package/dist/components/AccountVerification/selfie.png +0 -0
  69. package/dist/components/AccountVerification/upload-id.png +0 -0
  70. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositLoading.d.ts +0 -1
  71. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositLoading.js +0 -5
  72. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositSuccess.d.ts +0 -1
  73. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositSuccess.js +0 -5
  74. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositVCA.d.ts +0 -1
  75. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositVCA.js +0 -14
  76. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositLoading.d.ts +0 -1
  77. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositLoading.js +0 -5
  78. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositQrCode.d.ts +0 -1
  79. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositQrCode.js +0 -18
  80. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositSuccess.d.ts +0 -1
  81. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositSuccess.js +0 -8
  82. package/dist/components/DepositWithdrawal/MayaSessionExpired.d.ts +0 -1
  83. package/dist/components/DepositWithdrawal/MayaSessionExpired.js +0 -5
  84. package/dist/components/PortalProvider/PortalProvider.client.d.ts +0 -2
  85. package/dist/components/PortalProvider/PortalProvider.client.js +0 -38
  86. package/dist/images/QRPh.png +0 -0
@@ -39,7 +39,10 @@ export const useCreateOnlineBankDepositMutation = (config) => {
39
39
  });
40
40
  }, {
41
41
  until(res) {
42
- return !!res?.vca;
42
+ return (res?.vca != null ||
43
+ res?.status === 'CANCELLED' ||
44
+ res?.status === 'REJECTED' ||
45
+ res?.status === 'FAILED');
43
46
  },
44
47
  interval: 1000,
45
48
  maxAttempt: 5,
@@ -39,7 +39,10 @@ export const useCreateQRPHDepositMutation = (config) => {
39
39
  });
40
40
  }, {
41
41
  until(res) {
42
- return !!res?.qrCode;
42
+ return (res?.qrCode != null ||
43
+ res?.status === 'CANCELLED' ||
44
+ res?.status === 'FAILED' ||
45
+ res?.status === 'REJECTED');
43
46
  },
44
47
  interval: 1000,
45
48
  maxAttempt: 5,
@@ -4,8 +4,10 @@ import invariant from 'tiny-invariant';
4
4
  import { ENVIRONMENT, PLATFORM_CODE } from '../../constants/index.js';
5
5
  import { getIsMayaSessionValidQueryKey, getQueryClient, getSessionQueryKey, } from '../../utils/index.js';
6
6
  import { getSession } from '../services/index.js';
7
+ import { useOnMMA } from './useOnMMA.js';
7
8
  import { useSessionQuery } from './useSessionQuery.js';
8
9
  export const useIsMayaSessionValidQuery = (config) => {
10
+ const [onMMA] = useOnMMA();
9
11
  const queryClient = getQueryClient();
10
12
  const sessionQuery = useSessionQuery();
11
13
  const query = useQuery({
@@ -17,7 +19,9 @@ export const useIsMayaSessionValidQuery = (config) => {
17
19
  ...config,
18
20
  enabled: config?.enabled === false
19
21
  ? false
20
- : sessionQuery.data?.status === 'authenticated',
22
+ : !onMMA
23
+ ? false
24
+ : sessionQuery.data?.status === 'authenticated',
21
25
  queryKey: getIsMayaSessionValidQueryKey(),
22
26
  queryFn: async ({ signal }) => {
23
27
  const session = await queryClient.fetchQuery({
@@ -1,6 +1,6 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useState } from 'react';
3
- import { useOnMMA, usePaymentSettingsQuery } from '../../../client/hooks/index.js';
3
+ import { useIsMayaSessionValidQuery, useOnMMA, usePaymentSettingsQuery, } from '../../../client/hooks/index.js';
4
4
  import { AlertCircleIcon, SpinnerIcon } from '../../../icons/index.js';
5
5
  import { onMobileDevice } from '../../../utils/index.js';
6
6
  import { PaymentMethods } from '../PaymentMethods.js';
@@ -54,11 +54,22 @@ export function Deposit() {
54
54
  setPaymentMethod(enabledPaymentMethods[0]);
55
55
  }
56
56
  }, [enabledPaymentMethods, paymentMethod]);
57
- if (paymentSettingsQuery.isLoading) {
57
+ const isMayaSessionValidQuery = useIsMayaSessionValidQuery();
58
+ const isMayaSessionValid = isMayaSessionValidQuery.data ?? true;
59
+ if (paymentSettingsQuery.isLoading || isMayaSessionValidQuery.isLoading) {
58
60
  return _jsx(SpinnerIcon, { className: "mx-auto size-6" });
59
61
  }
62
+ if (!isMayaSessionValid) {
63
+ return _jsx(MayaSessionSessionExpired, {});
64
+ }
60
65
  if (enabledPaymentMethods.length <= 0) {
61
- return (_jsxs("div", { className: "border-amber-200 text-amber-700 bg-amber-50 flex items-center gap-1.5 rounded-sm border px-3 py-2.5 text-sm", children: [_jsx(AlertCircleIcon, { className: "size-4" }), "No available payment methods"] }));
66
+ return _jsx(NoAvailablePaymentMethods, {});
62
67
  }
63
68
  return (_jsxs(_Fragment, { children: [_jsx(PaymentMethods, { value: paymentMethod, onChange: setPaymentMethod, options: enabledPaymentMethods }), paymentMethod === 'QRPH' && _jsx(QRPHDeposit, {}), paymentMethod === 'GCASH' && _jsx(GCashDeposit, {}), paymentMethod === 'MAYA' && _jsx(MayaDeposit, {}), paymentMethod === 'MAYA_APP' && _jsx(MayaAppDeposit, {}), paymentMethod === 'ONLINE_BANK' && _jsx(OnlineBankDeposit, {})] }));
64
69
  }
70
+ function MayaSessionSessionExpired() {
71
+ return (_jsxs("div", { className: "py-xl", children: [_jsx("div", { className: "bg-bg-warning-secondary mx-auto flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, { className: "text-text-featured-icon-light-warning size-6" }) }), _jsx("h2", { className: "mt-lg text-center text-lg font-semibold", children: "Session Expired" }), _jsx("p", { className: "text-text-tertiary-600 mx-auto mt-xs max-w-[25rem] text-center text-sm", children: "Your session has timed out. To continue with deposits or withdrawals, Please try reloading the app." })] }));
72
+ }
73
+ function NoAvailablePaymentMethods() {
74
+ return (_jsxs("div", { className: "py-xl", children: [_jsx("div", { className: "bg-bg-warning-secondary mx-auto flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, { className: "text-text-featured-icon-light-warning size-6" }) }), _jsx("h2", { className: "mt-lg text-center text-lg font-semibold", children: "Not Available" }), _jsx("p", { className: "text-text-tertiary-600 mx-auto mt-xs max-w-[25rem] text-center text-sm", children: "Deposit is not available at this time. Please try again later or contact support for assistance." })] }));
75
+ }
@@ -1,32 +1,30 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Portal } from '@ark-ui/react';
2
3
  import { zodResolver } from '@hookform/resolvers/zod';
3
- import { useEffect } from 'react';
4
+ import { useEffect, useState } from 'react';
4
5
  import { Controller, useForm } from 'react-hook-form';
5
6
  import invariant from 'tiny-invariant';
6
7
  import { z } from 'zod';
7
- import { useShallow } from 'zustand/shallow';
8
- import { useAvailablePromosQuery, useCreateGCashDepositMutation, useDepositsCountQuery, useGlobalStore, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
9
- import { toaster } from '../../../../client/utils/index.js';
10
- import { ChevronDownIcon, ChevronUpIcon, SpinnerIcon } from '../../../../icons/index.js';
11
- import { Button, Field, NumberInput } from '../../../../ui/index.js';
8
+ import { useAvailablePromosQuery, useCreateGCashDepositMutation, useDepositsCountQuery, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
9
+ import { AlertCircleIcon, ChevronDownIcon, ChevronUpIcon, SpinnerIcon, XIcon, } from '../../../../icons/index.js';
10
+ import { AlertDialog, Button, Field, NumberInput } from '../../../../ui/index.js';
12
11
  import { parseDecimal } from '../../../../utils/index.js';
13
12
  import { AmountChoices } from '../../AmountChoices.js';
14
13
  import { AvailablePromos } from '../AvailablePromos.js';
15
14
  export function GCashDeposit() {
16
- const globalStore = useGlobalStore(useShallow((ctx) => ({
17
- depositWithdrawal: ctx.depositWithdrawal,
18
- })));
15
+ const [status, setStatus] = useState('waiting');
19
16
  const createDepositMutation = useCreateGCashDepositMutation({
17
+ onMutate() {
18
+ setStatus('processing');
19
+ },
20
20
  onSuccess(data) {
21
21
  invariant(data.checkoutUrl);
22
22
  window.open(data.checkoutUrl, '_blank', 'noopener,noreferrer');
23
23
  form.reset();
24
- globalStore.depositWithdrawal.setOpen(false);
24
+ setStatus('success');
25
25
  },
26
- onError(error) {
27
- toaster.error({
28
- description: error.message,
29
- });
26
+ onError() {
27
+ setStatus('failed');
30
28
  },
31
29
  });
32
30
  const depositsCountQuery = useDepositsCountQuery();
@@ -118,5 +116,14 @@ export function GCashDeposit() {
118
116
  shouldDirty: true,
119
117
  shouldValidate: true,
120
118
  });
121
- }, 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: createDepositMutation.isPending ? (_jsxs(_Fragment, { children: [_jsx(SpinnerIcon, {}), "Processing..."] })) : ('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" }), "."] })] }));
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' })) }) }))] }) })] }) })] }));
122
129
  }
@@ -1,37 +1,29 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Portal } from '@ark-ui/react';
2
3
  import { zodResolver } from '@hookform/resolvers/zod';
3
- import { useEffect } from 'react';
4
+ import { useEffect, useState } from 'react';
4
5
  import { Controller, useForm } from 'react-hook-form';
5
6
  import { z } from 'zod';
6
- import { useShallow } from 'zustand/shallow';
7
- import { useAvailablePromosQuery, useCreateMayaAppDepositMutation, useDepositsCountQuery, useGlobalStore, useIsMayaSessionValidQuery, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
8
- import { toaster } from '../../../../client/utils/index.js';
9
- import { ChevronDownIcon, ChevronUpIcon, SpinnerIcon } from '../../../../icons/index.js';
10
- import { Button, Field, NumberInput } from '../../../../ui/index.js';
7
+ import { useAvailablePromosQuery, useCreateMayaAppDepositMutation, useDepositsCountQuery, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
8
+ import { AlertCircleIcon, ChevronDownIcon, ChevronUpIcon, SpinnerIcon, XIcon, } from '../../../../icons/index.js';
9
+ import { AlertDialog, Button, Field, NumberInput } from '../../../../ui/index.js';
11
10
  import { parseDecimal } from '../../../../utils/index.js';
12
11
  import { AmountChoices } from '../../AmountChoices.js';
13
- import { MayaSessionExpired } from '../../MayaSessionExpired.js';
14
12
  import { AvailablePromos } from '../AvailablePromos.js';
15
13
  export function MayaAppDeposit() {
16
- const globalStore = useGlobalStore(useShallow((ctx) => ({
17
- depositWithdrawal: ctx.depositWithdrawal,
18
- })));
14
+ const [status, setStatus] = useState('waiting');
19
15
  const createDepositMutation = useCreateMayaAppDepositMutation({
16
+ onMutate() {
17
+ setStatus('processing');
18
+ },
20
19
  onSuccess() {
20
+ setStatus('success');
21
21
  form.reset();
22
- globalStore.depositWithdrawal.setOpen(false);
23
- toaster.success({
24
- description: 'Deposit success!',
25
- });
26
22
  },
27
- onError(error) {
28
- toaster.error({
29
- description: error.message,
30
- });
23
+ onError() {
24
+ setStatus('failed');
31
25
  },
32
26
  });
33
- const isMayaSessionValidQuery = useIsMayaSessionValidQuery();
34
- const isMayaSessionValid = isMayaSessionValidQuery.data ?? true;
35
27
  const depositsCountQuery = useDepositsCountQuery();
36
28
  const depositsCount = depositsCountQuery.data ?? 0;
37
29
  const paymentSettingsQuery = usePaymentSettingsQuery();
@@ -110,9 +102,6 @@ export function MayaAppDeposit() {
110
102
  promo: data.promo ?? undefined,
111
103
  });
112
104
  });
113
- if (!isMayaSessionValid) {
114
- return _jsx(MayaSessionExpired, {});
115
- }
116
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) => {
117
106
  o.field.onChange(details.value);
118
107
  }, formatOptions: {
@@ -124,5 +113,14 @@ export function MayaAppDeposit() {
124
113
  shouldDirty: true,
125
114
  shouldValidate: true,
126
115
  });
127
- }, 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: createDepositMutation.isPending ? (_jsxs(_Fragment, { children: [_jsx(SpinnerIcon, {}), "Processing..."] })) : ('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" }), "."] })] }));
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' })) }) }))] }) })] }) })] }));
128
126
  }
@@ -1,32 +1,30 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Portal } from '@ark-ui/react';
2
3
  import { zodResolver } from '@hookform/resolvers/zod';
3
- import { useEffect } from 'react';
4
+ import { useEffect, useState } from 'react';
4
5
  import { Controller, useForm } from 'react-hook-form';
5
6
  import invariant from 'tiny-invariant';
6
7
  import { z } from 'zod';
7
- import { useShallow } from 'zustand/shallow';
8
- import { useAvailablePromosQuery, useCreateMayaDepositMutation, useDepositsCountQuery, useGlobalStore, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
9
- import { toaster } from '../../../../client/utils/index.js';
10
- import { ChevronDownIcon, ChevronUpIcon, SpinnerIcon } from '../../../../icons/index.js';
11
- import { Button, Field, NumberInput } from '../../../../ui/index.js';
8
+ import { useAvailablePromosQuery, useCreateMayaDepositMutation, useDepositsCountQuery, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
9
+ import { AlertCircleIcon, ChevronDownIcon, ChevronUpIcon, SpinnerIcon, XIcon, } from '../../../../icons/index.js';
10
+ import { AlertDialog, Button, Field, NumberInput } from '../../../../ui/index.js';
12
11
  import { parseDecimal } from '../../../../utils/index.js';
13
12
  import { AmountChoices } from '../../AmountChoices.js';
14
13
  import { AvailablePromos } from '../AvailablePromos.js';
15
14
  export function MayaDeposit() {
16
- const globalStore = useGlobalStore(useShallow((ctx) => ({
17
- depositWithdrawal: ctx.depositWithdrawal,
18
- })));
15
+ const [status, setStatus] = useState('waiting');
19
16
  const createDepositMutation = useCreateMayaDepositMutation({
17
+ onMutate() {
18
+ setStatus('processing');
19
+ },
20
20
  onSuccess(data) {
21
21
  invariant(data.checkoutUrl);
22
22
  window.open(data.checkoutUrl, '_blank', 'noopener,noreferrer');
23
23
  form.reset();
24
- globalStore.depositWithdrawal.setOpen(false);
24
+ setStatus('success');
25
25
  },
26
- onError(error) {
27
- toaster.error({
28
- description: error.message,
29
- });
26
+ onError() {
27
+ setStatus('failed');
30
28
  },
31
29
  });
32
30
  const depositsCountQuery = useDepositsCountQuery();
@@ -118,5 +116,14 @@ export function MayaDeposit() {
118
116
  shouldDirty: true,
119
117
  shouldValidate: true,
120
118
  });
121
- }, 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: createDepositMutation.isPending ? (_jsxs(_Fragment, { children: [_jsx(SpinnerIcon, {}), "Processing..."] })) : ('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" }), "."] })] }));
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' })) }) }))] }) })] }) })] }));
122
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: [context.view === 'FORM' && _jsx(OnlineBankDepositForm, {}), context.view === 'LOADING' && _jsx(OnlineBankDepositLoading, {}), context.view === 'SUCCESS' && _jsx(OnlineBankDepositSuccess, {}), context.view === 'VCA' && _jsx(OnlineBankDepositVCA, {})] }));
9
+ return (_jsxs(OnlineBankDepositContext, { value: context, children: [_jsx(OnlineBankDepositForm, {}), _jsx(OnlineBankDepositDetails, {}), _jsx(OnlineBankDepositAlert, {})] }));
11
10
  }
@@ -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
+ }
@@ -1,22 +1,22 @@
1
1
  export declare const OnlineBankDepositContext: import("react").Context<{
2
- vca: string | null;
3
- view: "LOADING" | "FORM" | "SUCCESS" | "VCA";
4
- generateVca: import("@tanstack/react-query").UseMutateFunction<import("@opexa/portal-sdk-core").Deposit, Error, {
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
- vca: string | null;
14
- view: "LOADING" | "FORM" | "SUCCESS" | "VCA";
15
- generateVca: import("@tanstack/react-query").UseMutateFunction<import("@opexa/portal-sdk-core").Deposit, Error, {
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
  };
@@ -0,0 +1 @@
1
+ export declare function OnlineBankDepositDetails(): import("react/jsx-runtime").JSX.Element | null;
@@ -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
+ }
@@ -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;
@@ -85,17 +85,9 @@ export function OnlineBankDepositForm() {
85
85
  });
86
86
  }
87
87
  }, [form, minimumAmount]);
88
- const handleSubmit = form.handleSubmit(async (data) => {
89
- context.generateVca({
90
- amount: data.amount.toString(),
91
- promo: data.promo ?? undefined,
92
- }, {
93
- onSuccess() {
94
- form.reset();
95
- },
96
- });
97
- });
98
- 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-3xl", 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) => {
99
91
  o.field.onChange(details.value);
100
92
  }, formatOptions: {
101
93
  maximumFractionDigits: 2,
@@ -1,14 +1,13 @@
1
- type View = 'FORM' | 'LOADING' | 'SUCCESS' | 'VCA';
1
+ import type { Deposit } from '@opexa/portal-sdk-core';
2
2
  export type UseOnlineBankDepositReturn = ReturnType<typeof useOnlineBankDeposit>;
3
3
  export declare function useOnlineBankDeposit(): {
4
- vca: string | null;
5
- view: View;
6
- generateVca: import("@tanstack/react-query").UseMutateFunction<import("@opexa/portal-sdk-core").Deposit, Error, {
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 {};