@opexa/portal-components 0.0.1043 → 0.0.1045
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/components/Bonuses/Bonuses.client.js +1 -0
- package/dist/components/DepositWithdrawal/Withdrawal/GCashWithdrawal/GCashWithdrawal.js +15 -1
- package/dist/components/DepositWithdrawal/Withdrawal/InstapayGCashWithdrawal/InstapayGcashWithdrawal.js +18 -4
- package/dist/components/DepositWithdrawal/Withdrawal/InstapayPaymayaWithdrawal/InstapayPaymayaWithdrawal.js +18 -3
- package/dist/components/DepositWithdrawal/Withdrawal/VentajaWithdrawal/VentajaWithdrawal.js +43 -10
- package/package.json +1 -1
|
@@ -122,6 +122,7 @@ function CashbackBonus(props) {
|
|
|
122
122
|
}, children: _jsx(Image, { src: moneyOnHand, alt: "", className: "mx-auto h-[11.25rem] w-auto shrink-0 object-cover", draggable: false, width: 600, height: 600 }) })), _jsxs("div", { className: "flex grow flex-col px-xl py-3xl", children: [_jsx("p", { className: "line-clamp-1 text-center font-semibold text-xl", children: cashback.name }), _jsx("h2", { className: "mt-2 text-center font-semibold text-3xl", children: formatNumber(currentAccumulatedCashbackAmount, {
|
|
123
123
|
currency: localeInfo.currency.code,
|
|
124
124
|
minDecimalPlaces: 2,
|
|
125
|
+
truncate: false,
|
|
125
126
|
}) }), _jsx("div", { className: "mt-2 line-clamp-1 text-center text-sm text-text-secondary-700", dangerouslySetInnerHTML: {
|
|
126
127
|
__html: cashback.description,
|
|
127
128
|
} }), _jsx("div", { className: "grow" }), disabled ? (_jsxs(Popover.Root, { lazyMount: true, unmountOnExit: true, positioning: {
|
|
@@ -62,9 +62,23 @@ export function GCashWithdrawal() {
|
|
|
62
62
|
const definition = z.object({
|
|
63
63
|
amount: z
|
|
64
64
|
.string()
|
|
65
|
-
.
|
|
65
|
+
.trim()
|
|
66
66
|
.superRefine((val, ctx) => {
|
|
67
67
|
const n = parseDecimal(val, 0);
|
|
68
|
+
if (!val || n === 0) {
|
|
69
|
+
ctx.addIssue({
|
|
70
|
+
code: z.ZodIssueCode.custom,
|
|
71
|
+
message: 'Amount is required',
|
|
72
|
+
});
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (!/^\d+$/.test(val)) {
|
|
76
|
+
ctx.addIssue({
|
|
77
|
+
code: z.ZodIssueCode.custom,
|
|
78
|
+
message: 'Amount must be a whole number',
|
|
79
|
+
});
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
68
82
|
if (n < minimumAmount) {
|
|
69
83
|
ctx.addIssue({
|
|
70
84
|
type: 'number',
|
|
@@ -8,6 +8,7 @@ import { useShallow } from 'zustand/shallow';
|
|
|
8
8
|
import { useAccountQuery } from '../../../../client/hooks/useAccountQuery.js';
|
|
9
9
|
import { useCreateInstapayWithdrawalMutation } from '../../../../client/hooks/useCreateInstapayWithdrawalMutation.js';
|
|
10
10
|
import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
|
|
11
|
+
import { useLocaleInfo } from '../../../../client/hooks/useLocaleInfo.js';
|
|
11
12
|
import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSettingsQuery.js';
|
|
12
13
|
import { useWalletQuery } from '../../../../client/hooks/useWalletQuery.js';
|
|
13
14
|
import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
|
|
@@ -33,6 +34,7 @@ export function InstapayGCashWithdrawal() {
|
|
|
33
34
|
depositWithdrawal: ctx.depositWithdrawal,
|
|
34
35
|
hasPendingBonus: ctx.pendingBonus,
|
|
35
36
|
})));
|
|
37
|
+
const localeInfo = useLocaleInfo();
|
|
36
38
|
const [status, setStatus] = useState('waiting');
|
|
37
39
|
const createWithdrawalMutation = useCreateInstapayWithdrawalMutation({
|
|
38
40
|
onMutate() {
|
|
@@ -57,10 +59,23 @@ export function InstapayGCashWithdrawal() {
|
|
|
57
59
|
const definition = z.object({
|
|
58
60
|
amount: z
|
|
59
61
|
.string()
|
|
60
|
-
.
|
|
61
|
-
.regex(/^\d+$/, 'Amount must be a whole number')
|
|
62
|
+
.trim()
|
|
62
63
|
.superRefine((val, ctx) => {
|
|
63
64
|
const n = parseDecimal(val, 0);
|
|
65
|
+
if (!val || n === 0) {
|
|
66
|
+
ctx.addIssue({
|
|
67
|
+
code: z.ZodIssueCode.custom,
|
|
68
|
+
message: 'Amount is required',
|
|
69
|
+
});
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (!/^\d+$/.test(val)) {
|
|
73
|
+
ctx.addIssue({
|
|
74
|
+
code: z.ZodIssueCode.custom,
|
|
75
|
+
message: 'Amount must be a whole number',
|
|
76
|
+
});
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
64
79
|
if (n < minimumAmount) {
|
|
65
80
|
ctx.addIssue({
|
|
66
81
|
type: 'number',
|
|
@@ -86,8 +101,7 @@ export function InstapayGCashWithdrawal() {
|
|
|
86
101
|
.max(64, 'Password must be not be more than 64 characters'),
|
|
87
102
|
accountNumber: z
|
|
88
103
|
.string()
|
|
89
|
-
.
|
|
90
|
-
.trim(),
|
|
104
|
+
.regex(localeInfo.mobileNumber.pattern, 'Invalid phone number'),
|
|
91
105
|
accountName: z
|
|
92
106
|
.string({ required_error: 'Account name is required' })
|
|
93
107
|
.min(4, 'Account name must be at least 4 characters'),
|
|
@@ -8,6 +8,7 @@ import { useShallow } from 'zustand/shallow';
|
|
|
8
8
|
import { useAccountQuery } from '../../../../client/hooks/useAccountQuery.js';
|
|
9
9
|
import { useCreateInstapayWithdrawalMutation } from '../../../../client/hooks/useCreateInstapayWithdrawalMutation.js';
|
|
10
10
|
import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
|
|
11
|
+
import { useLocaleInfo } from '../../../../client/hooks/useLocaleInfo.js';
|
|
11
12
|
import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSettingsQuery.js';
|
|
12
13
|
import { useWalletQuery } from '../../../../client/hooks/useWalletQuery.js';
|
|
13
14
|
import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
|
|
@@ -33,6 +34,7 @@ export function InstapayPaymayaWithdrawal() {
|
|
|
33
34
|
depositWithdrawal: ctx.depositWithdrawal,
|
|
34
35
|
hasPendingBonus: ctx.pendingBonus,
|
|
35
36
|
})));
|
|
37
|
+
const localeInfo = useLocaleInfo();
|
|
36
38
|
const [status, setStatus] = useState('waiting');
|
|
37
39
|
const createWithdrawalMutation = useCreateInstapayWithdrawalMutation({
|
|
38
40
|
onMutate() {
|
|
@@ -57,9 +59,23 @@ export function InstapayPaymayaWithdrawal() {
|
|
|
57
59
|
const definition = z.object({
|
|
58
60
|
amount: z
|
|
59
61
|
.string()
|
|
60
|
-
.
|
|
62
|
+
.trim()
|
|
61
63
|
.superRefine((val, ctx) => {
|
|
62
64
|
const n = parseDecimal(val, 0);
|
|
65
|
+
if (!val || n === 0) {
|
|
66
|
+
ctx.addIssue({
|
|
67
|
+
code: z.ZodIssueCode.custom,
|
|
68
|
+
message: 'Amount is required',
|
|
69
|
+
});
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (!/^\d+$/.test(val)) {
|
|
73
|
+
ctx.addIssue({
|
|
74
|
+
code: z.ZodIssueCode.custom,
|
|
75
|
+
message: 'Amount must be a whole number',
|
|
76
|
+
});
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
63
79
|
if (n < minimumAmount) {
|
|
64
80
|
ctx.addIssue({
|
|
65
81
|
type: 'number',
|
|
@@ -85,8 +101,7 @@ export function InstapayPaymayaWithdrawal() {
|
|
|
85
101
|
.max(64, 'Password must be not be more than 64 characters'),
|
|
86
102
|
accountNumber: z
|
|
87
103
|
.string()
|
|
88
|
-
.
|
|
89
|
-
.trim(),
|
|
104
|
+
.regex(localeInfo.mobileNumber.pattern, 'Invalid phone number'),
|
|
90
105
|
accountName: z
|
|
91
106
|
.string({ required_error: 'Account name is required' })
|
|
92
107
|
.min(4, 'Account name must be at least 4 characters'),
|
|
@@ -10,6 +10,7 @@ import { useAccountQuery } from '../../../../client/hooks/useAccountQuery.js';
|
|
|
10
10
|
import { useCreateVentajaDisbursementWithdrawalMutation } from '../../../../client/hooks/useCreateVentajaWithdrawalMutation.js';
|
|
11
11
|
import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
|
|
12
12
|
import { useInstapayBankListQuery } from '../../../../client/hooks/useInstapayBankListQuery.js';
|
|
13
|
+
import { useMobileNumberParser } from '../../../../client/hooks/useMobileNumberParser.js';
|
|
13
14
|
import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSettingsQuery.js';
|
|
14
15
|
import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
|
|
15
16
|
import { CheckIcon } from '../../../../icons/CheckIcon.js';
|
|
@@ -62,6 +63,7 @@ export function VentajaWithdrawal() {
|
|
|
62
63
|
...(instapayBankListQuery.data ?? []),
|
|
63
64
|
], [instapayBankListQuery.data]);
|
|
64
65
|
const paymentSettingsQuery = usePaymentSettingsQuery();
|
|
66
|
+
const mobileNumberParser = useMobileNumberParser();
|
|
65
67
|
const paymentSettings = paymentSettingsQuery.data;
|
|
66
68
|
const gatewaySettings = paymentSettings?.ventajaWithdrawalGatewaySettings;
|
|
67
69
|
const minimumAmount = parseDecimal(gatewaySettings?.minimumAmount, 0);
|
|
@@ -71,9 +73,23 @@ export function VentajaWithdrawal() {
|
|
|
71
73
|
const definition = z.object({
|
|
72
74
|
amount: z
|
|
73
75
|
.string()
|
|
74
|
-
.
|
|
76
|
+
.trim()
|
|
75
77
|
.superRefine((val, ctx) => {
|
|
76
78
|
const n = parseDecimal(val, 0);
|
|
79
|
+
if (!val || n === 0) {
|
|
80
|
+
ctx.addIssue({
|
|
81
|
+
code: z.ZodIssueCode.custom,
|
|
82
|
+
message: 'Amount is required',
|
|
83
|
+
});
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (!/^\d+$/.test(val)) {
|
|
87
|
+
ctx.addIssue({
|
|
88
|
+
code: z.ZodIssueCode.custom,
|
|
89
|
+
message: 'Amount must be a whole number',
|
|
90
|
+
});
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
77
93
|
if (n < minimumAmount) {
|
|
78
94
|
ctx.addIssue({
|
|
79
95
|
type: 'number',
|
|
@@ -100,10 +116,25 @@ export function VentajaWithdrawal() {
|
|
|
100
116
|
.max(64, 'Withdrawal Password must be not be more than 64 characters'),
|
|
101
117
|
accountNumber: z
|
|
102
118
|
.string()
|
|
103
|
-
.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
119
|
+
.trim()
|
|
120
|
+
.superRefine((val, ctx) => {
|
|
121
|
+
const isInstapay = paymentMethod === 'INSTAPAY';
|
|
122
|
+
if (!val) {
|
|
123
|
+
ctx.addIssue({
|
|
124
|
+
code: z.ZodIssueCode.custom,
|
|
125
|
+
message: isInstapay
|
|
126
|
+
? 'Bank Account Number is required'
|
|
127
|
+
: 'Phone Number is required',
|
|
128
|
+
});
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (!isInstapay && !mobileNumberParser.validate(val)) {
|
|
132
|
+
ctx.addIssue({
|
|
133
|
+
code: z.ZodIssueCode.custom,
|
|
134
|
+
message: 'Invalid Phone Number',
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}),
|
|
107
138
|
accountName: z.string().min(1, 'Account Name is required').trim(),
|
|
108
139
|
bankCode: z.string().min(1, 'Bank is required').trim(),
|
|
109
140
|
});
|
|
@@ -197,11 +228,13 @@ export function VentajaWithdrawal() {
|
|
|
197
228
|
sameWidth: true,
|
|
198
229
|
}, value: o.field.value ? [o.field.value] : [], onValueChange: (details) => {
|
|
199
230
|
o.field.onChange(details.value.at(0) ?? '');
|
|
200
|
-
}, 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.code))) }) }) })] }), _jsx(Field.ErrorText, { children: form.formState.errors.bankCode?.message })] })) }), _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 })] })] })),
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
231
|
+
}, 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.code))) }) }) })] }), _jsx(Field.ErrorText, { children: form.formState.errors.bankCode?.message })] })) }), _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 })] })] })), _jsxs(Field.Root, { invalid: !!form.formState.errors.accountNumber, className: "mt-3xl", children: [_jsx(Field.Label, { children: paymentMethod === 'INSTAPAY'
|
|
232
|
+
? 'Bank account number'
|
|
233
|
+
: 'Phone Number' }), _jsx(Field.Input, { type: "number", ...form.register('accountNumber'), onKeyDown: (e) => {
|
|
234
|
+
if (['e', 'E', '.', '-', '+', ','].includes(e.key)) {
|
|
235
|
+
e.preventDefault();
|
|
236
|
+
}
|
|
237
|
+
} }), _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) => {
|
|
205
238
|
o.field.onChange(details.value);
|
|
206
239
|
}, allowMouseWheel: true, children: [_jsx(NumberInput.Label, { children: "Enter amount you want to withdraw" }), _jsxs(NumberInput.Control, { children: [_jsx(NumberInput.Input, {}), _jsx(NumberInput.IncrementTrigger, { children: _jsx(ChevronUpIcon, {}) }), _jsx(NumberInput.DecrementTrigger, { children: _jsx(ChevronDownIcon, {}) })] })] }), _jsx(Field.ErrorText, { children: form.formState.errors.amount?.message })] })) }), _jsx(AmountChoices, { value: parseDecimal(form.watch('amount'), 0), onChange: (value) => {
|
|
207
240
|
form.setValue('amount', value.toString(), {
|