@opexa/portal-components 0.0.297 → 0.0.299

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.
@@ -0,0 +1,4 @@
1
+ import type { SetOptional } from 'type-fest';
2
+ import { type CreateAIOInstapayWithdrawalNextInput } from '../../services/wallet';
3
+ import type { Mutation } from '../../types';
4
+ export declare const useCreateInstapayWithdrawalNextMutation: Mutation<string, SetOptional<CreateAIOInstapayWithdrawalNextInput, 'id'>>;
@@ -0,0 +1,28 @@
1
+ import { ObjectId } from '@opexa/object-id';
2
+ import { useMutation } from '@tanstack/react-query';
3
+ import invariant from 'tiny-invariant';
4
+ import { ObjectType } from '../../services/ObjectType.js';
5
+ import { createAIOInstapayWithdrawalNext, } from '../../services/wallet.js';
6
+ import { getCreateInstapayWithdrawalNextMutationKey } from '../../utils/mutationKeys.js';
7
+ import { getSession } from '../services/getSession.js';
8
+ export const useCreateInstapayWithdrawalNextMutation = (config) => {
9
+ const mutation = useMutation({
10
+ ...config,
11
+ mutationKey: getCreateInstapayWithdrawalNextMutationKey(),
12
+ mutationFn: async (input) => {
13
+ const id = input.id ?? ObjectId.generate(ObjectType.Withdrawal).toString();
14
+ const session = await getSession();
15
+ invariant(session.status === 'authenticated');
16
+ await createAIOInstapayWithdrawalNext({ ...input, id }, {
17
+ headers: {
18
+ Authorization: `Bearer ${session.token}`,
19
+ ...(session.domain && {
20
+ Domain: session.domain,
21
+ }),
22
+ },
23
+ });
24
+ return id;
25
+ },
26
+ });
27
+ return mutation;
28
+ };
@@ -7,6 +7,8 @@ import { Controller, useForm } from 'react-hook-form';
7
7
  import { z } from 'zod';
8
8
  import { useShallow } from 'zustand/shallow';
9
9
  import { useCreateInstapayWithdrawalMutation } from '../../../../client/hooks/useCreateInstapayWithdrawalMutation.js';
10
+ import { useCreateInstapayWithdrawalNextMutation } from '../../../../client/hooks/useCreateInstapayWithdrawalNextMutation.js';
11
+ import { useFeatureFlag } from '../../../../client/hooks/useFeatureFlag.js';
10
12
  import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
11
13
  import { useInstapayBankListQuery } from '../../../../client/hooks/useInstapayBankListQuery.js';
12
14
  import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSettingsQuery.js';
@@ -32,6 +34,7 @@ import { explainError } from '../../utils.js';
32
34
  import { TransactionPasswordNotSet } from '../TransactionPasswordNotSet.js';
33
35
  export function InstapayWithdrawal() {
34
36
  const depositWithdrawalProps = useDepositWithdrawalPropsContext();
37
+ const { enabled } = useFeatureFlag();
35
38
  const globalStore = useGlobalStore(useShallow((ctx) => ({
36
39
  depositWithdrawal: ctx.depositWithdrawal,
37
40
  })));
@@ -48,6 +51,19 @@ export function InstapayWithdrawal() {
48
51
  setStatus('failed');
49
52
  },
50
53
  });
54
+ const createWithdrawalNextMutation = useCreateInstapayWithdrawalNextMutation({
55
+ onMutate() {
56
+ setStatus('processing');
57
+ },
58
+ onSuccess() {
59
+ form.reset();
60
+ setStatus('success');
61
+ },
62
+ onError(err) {
63
+ console.log(err, 'error');
64
+ setStatus('failed');
65
+ },
66
+ });
51
67
  const instapayBankListQuery = useInstapayBankListQuery();
52
68
  const instapayBankList = instapayBankListQuery.data;
53
69
  const paymentSettingsQuery = usePaymentSettingsQuery();
@@ -82,6 +98,11 @@ export function InstapayWithdrawal() {
82
98
  .min(8, 'Password must be 8 or more characters')
83
99
  .max(64, 'Password must be not be more than 64 characters'),
84
100
  accountNumber: z.string().min(1).trim(),
101
+ accountName: enabled
102
+ ? z
103
+ .string({ required_error: 'Account name is required' })
104
+ .min(4, 'Account name must be at least 4 characters')
105
+ : z.string().optional().or(z.string().trim()),
85
106
  bankCode: z.string().min(1, 'Bank is required').trim(),
86
107
  });
87
108
  const form = useForm({
@@ -92,6 +113,7 @@ export function InstapayWithdrawal() {
92
113
  password: '',
93
114
  accountNumber: '',
94
115
  bankCode: '',
116
+ accountName: '',
95
117
  },
96
118
  });
97
119
  useEffect(() => {
@@ -115,12 +137,23 @@ export function InstapayWithdrawal() {
115
137
  }
116
138
  }, [form, instapayBankList]);
117
139
  const handleSubmit = form.handleSubmit(async (data) => {
118
- createWithdrawalMutation.mutate({
119
- amount: data.amount,
120
- transactionPassword: data.password,
121
- accountNumber: data.accountNumber,
122
- bankCode: data.bankCode,
123
- });
140
+ if (enabled) {
141
+ createWithdrawalNextMutation.mutate({
142
+ amount: data.amount,
143
+ transactionPassword: data.password,
144
+ accountNumber: data.accountNumber,
145
+ bankCode: data.bankCode,
146
+ accountName: data.accountName ?? '',
147
+ });
148
+ }
149
+ else {
150
+ createWithdrawalMutation.mutate({
151
+ amount: data.amount,
152
+ transactionPassword: data.password,
153
+ accountNumber: data.accountNumber,
154
+ bankCode: data.bankCode,
155
+ });
156
+ }
124
157
  });
125
158
  const bankCollection = useMemo(() => createListCollection({
126
159
  items: instapayBankList ?? [],
@@ -131,7 +164,7 @@ export function InstapayWithdrawal() {
131
164
  sameWidth: true,
132
165
  }, value: o.field.value ? [o.field.value] : [], onValueChange: (details) => {
133
166
  o.field.onChange(details.value.at(0) ?? '');
134
- }, children: [_jsx(Select.Label, { children: "Bank" }), _jsx(Select.Control, { children: _jsxs(Select.Trigger, { children: [_jsx(Select.ValueText, {}), _jsx(Select.Indicator, { asChild: true, children: _jsx(ChevronDownIcon, {}) })] }) }), _jsx(Select.Positioner, { children: _jsx(Select.Content, { children: _jsx(Select.ItemGroup, { children: bankCollection.items.map((item) => (_jsxs(Select.Item, { item: item, children: [_jsx(Select.ItemText, { children: item.name }), _jsx(Select.ItemIndicator, { asChild: true, children: _jsx(CheckIcon, {}) })] }, item.id))) }) }) })] }), _jsx(Field.ErrorText, { children: form.formState.errors.bankCode?.message })] })) }), _jsxs(Field.Root, { invalid: !!form.formState.errors.accountNumber, className: "mt-3xl", children: [_jsx(Field.Label, { children: "Bank account number" }), _jsx(Field.Input, { ...form.register('accountNumber') }), _jsx(Field.ErrorText, { children: form.formState.errors.accountNumber?.message })] }), _jsx(Controller, { control: form.control, name: "amount", render: (o) => (_jsxs(Field.Root, { invalid: !!form.formState.errors.amount, className: "mt-3xl", children: [_jsxs(NumberInput.Root, { min: 0, step: 1, value: o.field.value, onValueChange: (details) => {
167
+ }, children: [_jsx(Select.Label, { children: "Bank" }), _jsx(Select.Control, { children: _jsxs(Select.Trigger, { children: [_jsx(Select.ValueText, {}), _jsx(Select.Indicator, { asChild: true, children: _jsx(ChevronDownIcon, {}) })] }) }), _jsx(Select.Positioner, { children: _jsx(Select.Content, { children: _jsx(Select.ItemGroup, { children: bankCollection.items.map((item) => (_jsxs(Select.Item, { item: item, children: [_jsx(Select.ItemText, { children: item.name }), _jsx(Select.ItemIndicator, { asChild: true, children: _jsx(CheckIcon, {}) })] }, item.id))) }) }) })] }), _jsx(Field.ErrorText, { children: form.formState.errors.bankCode?.message })] })) }), _jsxs(Field.Root, { invalid: !!form.formState.errors.accountNumber, className: "mt-3xl", children: [_jsx(Field.Label, { children: "Bank account number" }), _jsx(Field.Input, { ...form.register('accountNumber') }), _jsx(Field.ErrorText, { children: form.formState.errors.accountNumber?.message })] }), enabled && (_jsxs(Field.Root, { invalid: !!form.formState.errors.accountName, className: "mt-3xl", children: [_jsx(Field.Label, { children: "Account name" }), _jsx(Field.Input, { ...form.register('accountName') }), _jsx(Field.ErrorText, { children: form.formState.errors.accountName?.message })] })), _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) => {
135
168
  o.field.onChange(details.value);
136
169
  }, formatOptions: {
137
170
  maximumFractionDigits: 2,
@@ -149,7 +182,9 @@ export function InstapayWithdrawal() {
149
182
  }, 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 Withdraw', status === 'success' && 'Withdrawal Submitted', status === 'failed' && 'Withdraw Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
150
183
  "We're verifying your account and amount. Please hold a moment.", status === 'success' &&
151
184
  'Your withdrawal request has been submitted successfully and is awaiting confirmation. You won’t have to wait long — once approved, the funds will be credited to your account.', status === 'failed' &&
152
- explainError(createWithdrawalMutation.error?.name)] })] }), (status === 'failed' || status === 'success') && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
185
+ explainError(enabled
186
+ ? createWithdrawalNextMutation.error?.name
187
+ : createWithdrawalMutation.error?.name)] })] }), (status === 'failed' || status === 'success') && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
153
188
  api.setOpen(false);
154
189
  }, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
155
190
  }
@@ -24,5 +24,5 @@ export function TransactionRecords__suspense(props) {
24
24
  newSearchParams.delete('id');
25
25
  router.push(`${pathname}?${newSearchParams.toString()}`);
26
26
  };
27
- return (_jsxs("div", { className: props.className, children: [_jsx("h2", { className: "text-sm font-semibold leading-tight lg:text-lg", children: "Transactions" }), _jsx("p", { className: "text-text-tertiary-600 mt-xs text-sm leading-tight", children: "View your transaction records" }), _jsxs(Tabs.Root, { className: "mt-lg lg:mt-2xl", value: tab, onValueChange: (details) => setTab(TabSchema.parse(details.value)), lazyMount: true, unmountOnExit: true, children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Trigger, { value: "transactions", children: "All Transactions" }), _jsx(Tabs.Trigger, { value: "deposits", children: "Deposits" }), _jsx(Tabs.Trigger, { value: "withdrawals", children: "Withdrawals" }), _jsx(Tabs.Indicator, {})] }), _jsx("div", { className: "border-border-secondary mt-2xl hidden border-t lg:block" }), _jsx("h3", { className: "text-text-secondary-700 mt-3xl text-sm font-semibold", children: "Table" }), _jsx(Tabs.Content, { value: "transactions", className: "mt-xl", children: _jsx(TransactionRecordsTable, {}) }), _jsx(Tabs.Content, { value: "deposits", className: "mt-xl", children: _jsx(Suspense, { fallback: null, children: _jsx(DepositRecordsTable, {}) }) }), _jsx(Tabs.Content, { value: "withdrawals", className: "mt-xl", children: _jsx(Suspense, { fallback: null, children: _jsx(WithdrawalRecordsTable, {}) }) })] })] }));
27
+ return (_jsxs("div", { className: props.className, children: [_jsx("h2", { className: "text-sm font-semibold leading-tight lg:text-lg", children: "Transactions" }), _jsx("p", { className: "text-text-tertiary-600 mt-xs text-sm leading-tight", children: "View your transaction records" }), _jsxs(Tabs.Root, { className: "mt-lg lg:mt-2xl", value: tab, onValueChange: (details) => setTab(TabSchema.parse(details.value)), lazyMount: true, unmountOnExit: true, children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Trigger, { value: "transactions", children: "All Transactions" }), _jsx(Tabs.Trigger, { value: "deposits", children: "Deposits" }), _jsx(Tabs.Trigger, { value: "withdrawals", children: "Withdrawals" }), _jsx(Tabs.Indicator, {})] }), _jsx("div", { className: "border-border-secondary mt-2xl hidden border-[1.5px] border-t lg:block" }), _jsx("h3", { className: "text-text-secondary-700 mt-3xl text-sm font-semibold", children: "Table" }), _jsx(Tabs.Content, { value: "transactions", className: "mt-xl", children: _jsx(TransactionRecordsTable, {}) }), _jsx(Tabs.Content, { value: "deposits", className: "mt-xl", children: _jsx(Suspense, { fallback: null, children: _jsx(DepositRecordsTable, {}) }) }), _jsx(Tabs.Content, { value: "withdrawals", className: "mt-xl", children: _jsx(Suspense, { fallback: null, children: _jsx(WithdrawalRecordsTable, {}) }) })] })] }));
28
28
  }
@@ -85,15 +85,15 @@ export function WithdrawalRecordsTable() {
85
85
  withdrawalStatus: true,
86
86
  } }), rows.length <= 0 && (_jsx(Empty, { icon: loading ? SpinnerIcon : File02Icon, title: loading ? 'Just a moment' : 'No data', message: loading
87
87
  ? 'Fetching latest withdrawal records...'
88
- : 'No data is currently available.', className: "mt-5xl" })), rows.length >= 1 && (_jsxs("div", { className: twMerge('mt-xl', 'border-y', 'border-border-secondary', 'bleed', 'lg:not-bleed', 'lg:mt-3xl', 'lg:w-full', 'lg:rounded-xl', 'lg:border-x'), children: [_jsx("div", { className: "border-border-secondary scrollbar-thumb:bg-bg-quaternary scrollbar-track:bg-transparent scrollbar:h-2 scrollbar-thumb:rounded-full overflow-hidden overflow-x-auto rounded-none border-b lg:rounded-t-xl", children: _jsxs(Table.Root, { className: "border-0", children: [_jsx(Table.Header, { children: _jsxs(Table.Row, { children: [_jsx(Table.Heading, { children: "Withdrawal No." }), _jsx(Table.Heading, { children: "Reference Number" }), _jsx(Table.Heading, { children: "Withdrawal Method" }), _jsx(Table.Heading, { children: "Mobile Number" }), _jsx(Table.Heading, { children: "Withdrawal Amount" }), _jsx(Table.Heading, { children: "Net Amount" }), _jsx(Table.Heading, { children: "Transaction Fee" }), _jsx(Table.Heading, { children: "Bank Name" }), _jsx(Table.Heading, { children: "Withdrawal Time" }), _jsx(Table.Heading, { children: "Status" })] }) }), _jsx(Table.Body, { children: rows.map((data) => (_jsxs(Table.Row, { children: [_jsx(Table.Cell, { className: "!py-1", children: data.withdrawalNumber }), _jsx(Table.Cell, { className: "!py-1", children: data.reference }), _jsx(Table.Cell, { className: "!py-1", children: capitalize(data.type, {
88
+ : 'No data is currently available.', className: "mt-5xl" })), rows.length >= 1 && (_jsxs("div", { className: twMerge('mt-xl', 'border-y', 'border-border-secondary', 'bleed', 'lg:not-bleed', 'lg:mt-3xl', 'lg:w-full', 'lg:rounded-xl', 'lg:border-x'), children: [_jsx("div", { className: "border-border-secondary scrollbar-thumb:bg-bg-quaternary scrollbar-track:bg-transparent scrollbar:h-2 scrollbar-thumb:rounded-full overflow-hidden overflow-x-auto rounded-none border-b lg:rounded-t-xl", children: _jsxs(Table.Root, { className: "border-0", children: [_jsx(Table.Header, { children: _jsxs(Table.Row, { children: [_jsx(Table.Heading, { children: "Withdrawal No." }), _jsx(Table.Heading, { children: "Reference Number" }), _jsx(Table.Heading, { children: "Withdrawal Method" }), _jsx(Table.Heading, { children: "Mobile Number" }), _jsx(Table.Heading, { children: "Withdrawal Amount" }), _jsx(Table.Heading, { children: "Net Amount" }), _jsx(Table.Heading, { children: "Transaction Fee" }), _jsx(Table.Heading, { children: "Bank Name" }), _jsx(Table.Heading, { children: "Withdrawal Time" }), _jsx(Table.Heading, { children: "Status" })] }) }), _jsx(Table.Body, { children: rows.map((data) => (_jsxs(Table.Row, { children: [_jsx(Table.Cell, { className: "!py-1", children: data.withdrawalNumber }), _jsx(Table.Cell, { className: "!py-1", children: data.reference }), _jsx(Table.Cell, { className: "!py-1 text-right", children: capitalize(data.type, {
89
89
  delimiter: capitalize.delimiters.UNDERSCORE,
90
- }) }), _jsx(Table.Cell, { className: "!py-1", children: data.recipientMobileNumber }), _jsx(Table.Cell, { className: "!py-1", children: formatNumber(data.amount, {
90
+ }) }), _jsx(Table.Cell, { className: "!py-1", children: data.recipientMobileNumber }), _jsx(Table.Cell, { className: "!py-1 text-right", children: formatNumber(data.amount, {
91
91
  currency: localeInfo.currency.code,
92
92
  minDecimalPlaces: 2,
93
- }) }), _jsx(Table.Cell, { className: "!py-1", children: formatNumber(data.netAmount, {
93
+ }) }), _jsx(Table.Cell, { className: "!py-1 text-right", children: formatNumber(data.netAmount, {
94
94
  currency: localeInfo.currency.code,
95
95
  minDecimalPlaces: 2,
96
- }) }), _jsx(Table.Cell, { className: "!py-1", children: formatNumber(data.fee, {
96
+ }) }), _jsx(Table.Cell, { className: "!py-1 text-right", children: formatNumber(data.fee, {
97
97
  currency: localeInfo.currency.code,
98
98
  minDecimalPlaces: 2,
99
99
  }) }), _jsx(Table.Cell, { className: "!py-1", children: data?.bankName }), _jsxs(Table.Cell, { className: "!py-1", children: [_jsx("div", { className: "leading-tight", children: format(data.dateTimeCreated, 'MM/dd/yyyy', {
@@ -108,5 +108,5 @@ export function WithdrawalRecordsTable() {
108
108
  ? 'warning'
109
109
  : 'success', children: _jsx(Badge.Label, { children: capitalize(data.status, {
110
110
  delimiter: capitalize.delimiters.UNDERSCORE,
111
- }) }) }) })] }, data.id))) })] }) }), _jsxs("div", { className: "flex items-center justify-between gap-lg px-4 py-3", children: [_jsx(IconButton, { size: "xs", variant: "outline", colorScheme: "gray", disabled: !hasPrevPage || loading, onClick: () => prev(), children: _jsx(ChevronLeftIcon, { className: "size-5" }) }), _jsxs("p", { className: "text-text-secondary-700 text-sm font-medium", children: ["Page ", page, " of ", totalPages] }), _jsx(IconButton, { size: "xs", variant: "outline", colorScheme: "gray", disabled: !hasNextPage || loading, onClick: () => next(), children: _jsx(ChevronRightIcon, { className: "size-5" }) })] })] }))] }));
111
+ }) }) }) })] }, data.id))) })] }) }), _jsxs("div", { className: "gap-lg flex items-center justify-between px-4 py-3", children: [_jsx(IconButton, { size: "xs", variant: "outline", colorScheme: "gray", disabled: !hasPrevPage || loading, onClick: () => prev(), children: _jsx(ChevronLeftIcon, { className: "size-5" }) }), _jsxs("p", { className: "text-text-secondary-700 text-sm font-medium", children: ["Page ", page, " of ", totalPages] }), _jsx(IconButton, { size: "xs", variant: "outline", colorScheme: "gray", disabled: !hasNextPage || loading, onClick: () => next(), children: _jsx(ChevronRightIcon, { className: "size-5" }) })] })] }))] }));
112
112
  }
@@ -20,6 +20,7 @@ export declare const CREATE_MAYA_WITHDRAWAL = "\n mutation CreateMayaWithdrawal
20
20
  export declare const CREATE_MAYA_APP_WITHDRAWAL = "\n mutation CreateMayaAppWithdrawal($input: CreateMayaAppWithdrawalInput!) {\n createMayaAppWithdrawal(input: $input) {\n ... on AccountNotVerifiedError {\n name: __typename\n message\n }\n ... on InvalidTransactionPasswordError {\n name: __typename\n message\n }\n ... on InvalidWithdrawalAmountError {\n name: __typename\n message\n }\n ... on NotEnoughBalanceError {\n name: __typename\n message\n }\n ... on WithdrawalDailyLimitExceededError {\n name: __typename\n message\n }\n ... on WalletDoesNotExistError {\n name: __typename\n message\n }\n ... on TransactionPasswordNotSetError {\n name: __typename\n message\n }\n }\n }\n";
21
21
  export declare const CREATE_BANK_WITHDRAWAL = "\n mutation CreateBankWithdrawal($input: CreateBankWithdrawalInput!) {\n createBankWithdrawal(input: $input) {\n ... on MobileNumberNotVerifiedError {\n name: __typename\n message\n }\n }\n }\n";
22
22
  export declare const CREATE_AIO_INSTAPAY_WITHDRAWAL = "\n mutation CreateAIOInstapayWithdrawal(\n $input: CreateAIOInstapayWithdrawalInput!\n ) {\n createAIOInstapayWithdrawal(input: $input) {\n ... on AccountNotVerifiedError {\n name: __typename\n message\n }\n ... on InvalidWithdrawalAmountError {\n name: __typename\n message\n }\n ... on WithdrawalDailyLimitExceededError {\n name: __typename\n message\n }\n ... on InvalidTransactionPasswordError {\n name: __typename\n message\n }\n ... on NotEnoughBalanceError {\n name: __typename\n message\n }\n ... on WalletDoesNotExistError {\n name: __typename\n message\n }\n ... on TransactionPasswordNotSetError {\n name: __typename\n message\n }\n }\n }\n";
23
+ export declare const CREATE_AIO_INSTAPAY_WITHDRAWAL_NEXT = "\n mutation CreateAIOInstapayWithdrawal_next(\n $input: CreateAIOInstapayWithdrawalInput_next!\n ) {\n createAIOInstapayWithdrawal_next(input: $input) {\n ... on AccountNotVerifiedError {\n name: __typename\n message\n }\n ... on InvalidWithdrawalAmountError {\n name: __typename\n message\n }\n ... on WithdrawalDailyLimitExceededError {\n name: __typename\n message\n }\n ... on InvalidTransactionPasswordError {\n name: __typename\n message\n }\n ... on NotEnoughBalanceError {\n name: __typename\n message\n }\n ... on WalletDoesNotExistError {\n name: __typename\n message\n }\n ... on TransactionPasswordNotSetError {\n name: __typename\n message\n }\n }\n }\n";
23
24
  export declare const CREATE_VENTAJA_WITHDRAWAL = "\n mutation CreateVentajaDisbursementWithdrawal(\n $input: CreateVentajaDisbursementWithdrawalInput!\n $transactionPassword: String!\n ) {\n createVentajaDisbursementWithdrawal(\n input: $input\n transactionPassword: $transactionPassword\n ) {\n ... on AccountNotVerifiedError {\n name: __typename\n message\n }\n ... on InvalidWithdrawalAmountError {\n name: __typename\n message\n }\n ... on WithdrawalDailyLimitExceededError {\n name: __typename\n message\n }\n ... on NotEnoughBalanceError {\n name: __typename\n message\n }\n ... on WalletDoesNotExistError {\n name: __typename\n message\n }\n }\n }\n";
24
25
  export declare const CREATE_PISO_PAY_WITHDRAWAL = "\n mutation CreatePisopayWithdrawal(\n $input: CreatePisoPayRemittanceWithdrawalInput!\n $transactionPassword: String!\n ) {\n createPisoPayRemittanceWithdrawal(\n input: $input\n transactionPassword: $transactionPassword\n ) {\n ... on AccountNotVerifiedError {\n name: __typename\n message\n }\n ... on InvalidWithdrawalAmountError {\n name: __typename\n message\n }\n ... on WithdrawalDailyLimitExceededError {\n name: __typename\n message\n }\n ... on InvalidTransactionPasswordError {\n name: __typename\n message\n }\n ... on NotEnoughBalanceError {\n name: __typename\n message\n }\n ... on WalletDoesNotExistError {\n name: __typename\n message\n }\n ... on TransactionPasswordNotSetError {\n name: __typename\n message\n }\n }\n }\n";
25
26
  export declare const CREATE_MANUAL_UPI_WITHDRAWAL = "\n mutation CreateManualUPIWithdrawal($input: CreateManualUPIWithdrawalInput!) {\n createManualUPIWithdrawal(input: $input) {\n ... on AccountNotVerifiedError {\n name: __typename\n message\n }\n ... on InvalidWithdrawalAmountError {\n name: __typename\n message\n }\n ... on WithdrawalDailyLimitExceededError {\n name: __typename\n message\n }\n ... on NotEnoughBalanceError {\n name: __typename\n message\n }\n ... on WalletDoesNotExistError {\n name: __typename\n message\n }\n }\n }\n";
@@ -501,6 +501,42 @@ export const CREATE_AIO_INSTAPAY_WITHDRAWAL = /* GraphQL */ `
501
501
  }
502
502
  }
503
503
  `;
504
+ export const CREATE_AIO_INSTAPAY_WITHDRAWAL_NEXT = /* GraphQL */ `
505
+ mutation CreateAIOInstapayWithdrawal_next(
506
+ $input: CreateAIOInstapayWithdrawalInput_next!
507
+ ) {
508
+ createAIOInstapayWithdrawal_next(input: $input) {
509
+ ... on AccountNotVerifiedError {
510
+ name: __typename
511
+ message
512
+ }
513
+ ... on InvalidWithdrawalAmountError {
514
+ name: __typename
515
+ message
516
+ }
517
+ ... on WithdrawalDailyLimitExceededError {
518
+ name: __typename
519
+ message
520
+ }
521
+ ... on InvalidTransactionPasswordError {
522
+ name: __typename
523
+ message
524
+ }
525
+ ... on NotEnoughBalanceError {
526
+ name: __typename
527
+ message
528
+ }
529
+ ... on WalletDoesNotExistError {
530
+ name: __typename
531
+ message
532
+ }
533
+ ... on TransactionPasswordNotSetError {
534
+ name: __typename
535
+ message
536
+ }
537
+ }
538
+ }
539
+ `;
504
540
  export const CREATE_VENTAJA_WITHDRAWAL = /* GraphQL */ `
505
541
  mutation CreateVentajaDisbursementWithdrawal(
506
542
  $input: CreateVentajaDisbursementWithdrawalInput!
@@ -355,11 +355,26 @@ export interface CreateAIOInstapayWithdrawalMutationVariables {
355
355
  transactionPassword: string;
356
356
  };
357
357
  }
358
+ export interface CreateAIOInstapayWithdrawalNextMutationVariables {
359
+ input: {
360
+ id: string;
361
+ amount: string;
362
+ bankCode: string;
363
+ accountName: string;
364
+ accountNumber: string;
365
+ transactionPassword: string;
366
+ };
367
+ }
358
368
  export interface CreateAIOInstapayWithdrawalMutation {
359
369
  createAIOInstapayWithdrawal?: null | CreateWithdrawalError;
360
370
  }
371
+ export interface CreateAIOInstapayWithdrawalNextMutation {
372
+ createAIOInstapayWithdrawal_next?: null | CreateWithdrawalError;
373
+ }
361
374
  export type CreateAIOInstapayWithdrawalInput = Simplify<CreateAIOInstapayWithdrawalMutationVariables['input']>;
375
+ export type CreateAIOInstapayWithdrawalNextInput = Simplify<CreateAIOInstapayWithdrawalNextMutationVariables['input']>;
362
376
  export declare const createAIOInstapayWithdrawal: (input: CreateAIOInstapayWithdrawalInput, options?: GraphQLRequestOptions) => Promise<void>;
377
+ export declare const createAIOInstapayWithdrawalNext: (input: CreateAIOInstapayWithdrawalNextInput, options?: GraphQLRequestOptions) => Promise<void>;
363
378
  export interface CreateVentajaDisbursementWithdrawalVariables {
364
379
  input: {
365
380
  id: string;
@@ -2,7 +2,7 @@ import { cache } from 'react';
2
2
  import { WALLET_GRAPHQL_ENDPOINT } from '../constants/index.js';
3
3
  import { parseDecimal } from '../utils/parseDecimal.js';
4
4
  import { graphqlRequest } from './graphqlRequest.js';
5
- import { AVAILABLE_PROMOS, BONUS, BONUS_BALANCES, BONUS_IDS, BONUSES, CASHBACK, CASHBACK_BONUS, CASHBACK_BONUS_IDS, CASHBACK_BONUSES, CASHBACKS, CLAIM_CASHBACK_BONUS, CLAIM_SPOT_BONUS, CREATE_AIO_INSTAPAY_WITHDRAWAL, CREATE_AIO_ONLINE_BANK_DEPOSIT, CREATE_AIO_QRPH_DEPOSIT, CREATE_BANK_WITHDRAWAL, CREATE_GAME_SESSION, CREATE_GCASH_DEPOSIT, CREATE_GCASH_DIRECT_WEBPAY_DEPOSIT, CREATE_GCASH_WITHDRAWAL, CREATE_LIBANGAN_DEPOSIT, CREATE_MANUAL_BANK_DEPOSIT, CREATE_MANUAL_BANK_WITHDRAWAL, CREATE_MANUAL_UPI_DEPOSIT, CREATE_MANUAL_UPI_WITHDRAWAL, CREATE_MAYA_APP_DEPOSIT, CREATE_MAYA_APP_WITHDRAWAL, CREATE_MAYA_DEPOSIT, CREATE_MAYA_WITHDRAWAL, CREATE_PISO_PAY_DEPOSIT, CREATE_PISO_PAY_WITHDRAWAL, CREATE_VENTAJA_WITHDRAWAL, DEPOSIT, END_GAME_SESSION, FAVORITE_GAMES, GAME_SESSION, INSTAPAY_BANK_LIST, MARK_GAME_AS_FAVORITE, MAYA_SESSION, POINTS_WALLET, PROMO, PROMOS, REDEEM_POINTS_TO_CASH, REMAINING_DAILY_WITHDRAWALS_COUNT, TOUCH_GCASH_DEPOSIT, TOUCH_QRPH_DEPOSIT, UNMARK_GAME_AS_FAVORITE, VALIDATE_MAYA_SESSION, WALLET, } from './queries.js';
5
+ import { AVAILABLE_PROMOS, BONUS, BONUS_BALANCES, BONUS_IDS, BONUSES, CASHBACK, CASHBACK_BONUS, CASHBACK_BONUS_IDS, CASHBACK_BONUSES, CASHBACKS, CLAIM_CASHBACK_BONUS, CLAIM_SPOT_BONUS, CREATE_AIO_INSTAPAY_WITHDRAWAL, CREATE_AIO_INSTAPAY_WITHDRAWAL_NEXT, CREATE_AIO_ONLINE_BANK_DEPOSIT, CREATE_AIO_QRPH_DEPOSIT, CREATE_BANK_WITHDRAWAL, CREATE_GAME_SESSION, CREATE_GCASH_DEPOSIT, CREATE_GCASH_DIRECT_WEBPAY_DEPOSIT, CREATE_GCASH_WITHDRAWAL, CREATE_LIBANGAN_DEPOSIT, CREATE_MANUAL_BANK_DEPOSIT, CREATE_MANUAL_BANK_WITHDRAWAL, CREATE_MANUAL_UPI_DEPOSIT, CREATE_MANUAL_UPI_WITHDRAWAL, CREATE_MAYA_APP_DEPOSIT, CREATE_MAYA_APP_WITHDRAWAL, CREATE_MAYA_DEPOSIT, CREATE_MAYA_WITHDRAWAL, CREATE_PISO_PAY_DEPOSIT, CREATE_PISO_PAY_WITHDRAWAL, CREATE_VENTAJA_WITHDRAWAL, DEPOSIT, END_GAME_SESSION, FAVORITE_GAMES, GAME_SESSION, INSTAPAY_BANK_LIST, MARK_GAME_AS_FAVORITE, MAYA_SESSION, POINTS_WALLET, PROMO, PROMOS, REDEEM_POINTS_TO_CASH, REMAINING_DAILY_WITHDRAWALS_COUNT, TOUCH_GCASH_DEPOSIT, TOUCH_QRPH_DEPOSIT, UNMARK_GAME_AS_FAVORITE, VALIDATE_MAYA_SESSION, WALLET, } from './queries.js';
6
6
  import { sha256 } from './sha256.js';
7
7
  export const getPromos = cache(async (options) => {
8
8
  const res = await graphqlRequest(WALLET_GRAPHQL_ENDPOINT, PROMOS, undefined, {
@@ -293,6 +293,22 @@ export const createAIOInstapayWithdrawal = async (input, options) => {
293
293
  throw error;
294
294
  }
295
295
  };
296
+ export const createAIOInstapayWithdrawalNext = async (input, options) => {
297
+ const res = await graphqlRequest(WALLET_GRAPHQL_ENDPOINT, CREATE_AIO_INSTAPAY_WITHDRAWAL_NEXT, {
298
+ input: {
299
+ ...input,
300
+ transactionPassword: await sha256(input.transactionPassword),
301
+ },
302
+ }, options);
303
+ if (res.createAIOInstapayWithdrawal_next) {
304
+ const error = new Error();
305
+ error.name = res.createAIOInstapayWithdrawal_next.name;
306
+ error.message =
307
+ ERROR_CODES_MESSAGE_MAP[res.createAIOInstapayWithdrawal_next.name];
308
+ Error.captureStackTrace?.(error, createAIOInstapayWithdrawal);
309
+ throw error;
310
+ }
311
+ };
296
312
  export const createVentajaDisbursementWithdrawal = async (input, transactionPassword, options) => {
297
313
  const res = await graphqlRequest(WALLET_GRAPHQL_ENDPOINT, CREATE_VENTAJA_WITHDRAWAL, { input, transactionPassword: await sha256(transactionPassword) }, options);
298
314
  if (res.createVentajaDisbursementWithdrawal) {
@@ -16,6 +16,7 @@ export declare const getCreateGCashWithdrawalMutationKey: () => MutationKey;
16
16
  export declare const getCreateMayaWithdrawalMutationKey: () => MutationKey;
17
17
  export declare const getCreateMayaAppWithdrawalMutationKey: () => MutationKey;
18
18
  export declare const getCreateInstapayWithdrawalMutationKey: () => MutationKey;
19
+ export declare const getCreateInstapayWithdrawalNextMutationKey: () => MutationKey;
19
20
  export declare const getCreateVentajaDisbursementWithdrawalMutationKey: () => MutationKey;
20
21
  export declare const getCreatePisoPayWithdrawalMutationKey: () => MutationKey;
21
22
  export declare const getMarkMessageAsReadMutationKey: () => MutationKey;
@@ -67,6 +67,10 @@ export const getCreateInstapayWithdrawalMutationKey = () => [
67
67
  PARENT_KEY,
68
68
  'createInstapayWithdrawal',
69
69
  ];
70
+ export const getCreateInstapayWithdrawalNextMutationKey = () => [
71
+ PARENT_KEY,
72
+ 'createInstapayWithdrawalNext',
73
+ ];
70
74
  export const getCreateVentajaDisbursementWithdrawalMutationKey = () => [PARENT_KEY, 'createVentajaDisbursementWithdrawal'];
71
75
  export const getCreatePisoPayWithdrawalMutationKey = () => [
72
76
  PARENT_KEY,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.297",
3
+ "version": "0.0.299",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",