@opexa/portal-components 0.0.917 → 0.0.920
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/AccountInfo/AccountInfo.d.ts +1 -0
- package/dist/components/AccountInfo/AccountInfo.js +4 -3
- package/dist/components/AccountInfo/icons/PhoneIcon.d.ts +2 -0
- package/dist/components/AccountInfo/icons/PhoneIcon.js +5 -0
- package/dist/components/DepositWithdrawal/Withdrawal/Withdrawal.js +30 -12
- package/package.json +1 -1
|
@@ -37,6 +37,7 @@ import { IconButton } from '../../ui/IconButton/index.js';
|
|
|
37
37
|
import { Portal } from '../../ui/Portal/index.js';
|
|
38
38
|
import { getQueryClient } from '../../utils/getQueryClient.js';
|
|
39
39
|
import { getAccountQueryKey, getProfileCompletionQueryKey, } from '../../utils/queryKeys.js';
|
|
40
|
+
import PhoneIcon from './icons/PhoneIcon.js';
|
|
40
41
|
const accountSchema = z.object({
|
|
41
42
|
name: z
|
|
42
43
|
.string()
|
|
@@ -45,7 +46,7 @@ const accountSchema = z.object({
|
|
|
45
46
|
.regex(/^[a-zA-Z0-9]+$/, 'Username can only contain letters and numbers'),
|
|
46
47
|
});
|
|
47
48
|
export function AccountInfo(props) {
|
|
48
|
-
return (_jsxs("div", { className: twMerge('space-y-3xl', props.className), children: [_jsx(ProfileInfo, { avatar: props.avatar }), _jsx(ContactInfo, {}), _jsx(PersonalInfo, { shouldShowBranchCode: props.shouldShowBranchCode, branchCodes: props.branchCodes }), _jsx(SSO, { google: props.googleSso, facebook: props.facebookSso })] }));
|
|
49
|
+
return (_jsxs("div", { className: twMerge('space-y-3xl', props.className), children: [_jsx(ProfileInfo, { avatar: props.avatar }), _jsx(ContactInfo, { variant: props.variant }), _jsx(PersonalInfo, { shouldShowBranchCode: props.shouldShowBranchCode, branchCodes: props.branchCodes }), _jsx(SSO, { google: props.googleSso, facebook: props.facebookSso })] }));
|
|
49
50
|
}
|
|
50
51
|
function ProfileInfo({ avatar }) {
|
|
51
52
|
const [edit, setEdit] = useState(false);
|
|
@@ -155,7 +156,7 @@ function PersonalInfo(props) {
|
|
|
155
156
|
});
|
|
156
157
|
}), children: [_jsxs("div", { className: "px-4 py-5 lg:px-3xl lg:py-5", children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.realName, readOnly: !!account?.realName, children: [_jsx(Field.Label, { children: "Full name" }), _jsx(Field.Input, { ...form.register('realName') }), _jsx(Field.ErrorText, { children: form.formState.errors.realName?.message })] }), _jsxs(Field.Root, { className: "mt-6", invalid: !!form.formState.errors.birthDay, readOnly: !!account?.birthDay, children: [_jsx(Field.Label, { children: "Date of birth" }), _jsx(Field.Input, { type: "date", ...form.register('birthDay'), className: twMerge('h-full py-2.5', account?.birthDay && 'pointer-events-none') }), _jsx(Field.ErrorText, { children: form.formState.errors.birthDay?.message })] }), props.shouldShowBranchCode && (_jsxs(Field.Root, { className: "mt-6", invalid: !!form.formState.errors.birthDay, readOnly: !!account?.birthDay, children: [_jsx(Field.Label, { children: "Branch Code" }), _jsx(Field.Input, { type: "text", disabled: true, value: displayBranchName ?? account?.branchCode ?? '' })] }))] }), form.formState.isDirty && (_jsxs("div", { className: "flex justify-end gap-lg border-border-secondary border-t px-xl py-lg lg:px-3xl lg:py-xl", children: [_jsx(Button, { size: "sm", variant: "outline", fullWidth: false, disabled: updateAccountMutation.isPending, onClick: () => form.reset(), children: "Cancel" }), _jsx(Button, { type: "submit", size: "sm", fullWidth: false, disabled: !form.formState.isValid || updateAccountMutation.isPending, children: "Save Changes" })] }))] })] }));
|
|
157
158
|
}
|
|
158
|
-
function ContactInfo() {
|
|
159
|
+
function ContactInfo({ variant }) {
|
|
159
160
|
const localeInfo = useLocaleInfo();
|
|
160
161
|
const accountQuery = useAccountQuery();
|
|
161
162
|
const profileCompletionQuery = useProfileCompletionQuery();
|
|
@@ -215,7 +216,7 @@ function ContactInfo() {
|
|
|
215
216
|
? format(data.mobileNumber)
|
|
216
217
|
: undefined,
|
|
217
218
|
});
|
|
218
|
-
}), children: [_jsxs("div", { className: "px-xl py-5 lg:px-3xl lg:py-5", children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.mobileNumber, children: [_jsx(Field.Label, { children: "Mobile Number" }), _jsxs("div", { className: "relative", children: [_jsx(localeInfo.country.flag, { className: "-translate-y-1/2 pointer-events-none absolute top-1/2 left-3.5 size-5" }), _jsx(Field.Input, { className: "pl-10.5", readOnly: account?.mobileNumber != null, ...form.register('mobileNumber') })] }), _jsx(Field.ErrorText, { children: form.formState.errors.mobileNumber?.message })] }), _jsxs(Field.Root, { className: "mt-6", invalid: !!form.formState.errors.emailAddress, children: [_jsx(Field.Label, { children: "Email address" }), _jsx(Field.Input, { ...form.register('emailAddress') }), _jsx(Field.ErrorText, { children: form.formState.errors.emailAddress?.message })] })] }), form.formState.isDirty && (_jsxs("div", { className: "flex justify-end gap-lg border-border-secondary border-t px-xl py-lg lg:px-3xl lg:py-xl", children: [_jsx(Button, { size: "sm", variant: "outline", fullWidth: false, disabled: updateAccountMutation.isPending, onClick: () => form.reset(), children: "Cancel" }), _jsx(Button, { type: "submit", size: "sm", fullWidth: false, disabled: updateAccountMutation.isPending || !form.formState.isValid, children: "Save Changes" })] }))] })] }));
|
|
219
|
+
}), children: [_jsxs("div", { className: "px-xl py-5 lg:px-3xl lg:py-5", children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.mobileNumber, children: [_jsx(Field.Label, { children: "Mobile Number" }), _jsxs("div", { className: "relative", children: [variant === 'ofwin' ? (_jsx(PhoneIcon, {})) : (_jsx(localeInfo.country.flag, { className: "-translate-y-1/2 pointer-events-none absolute top-1/2 left-3.5 size-5" })), _jsx(Field.Input, { className: "pl-10.5", readOnly: account?.mobileNumber != null, ...form.register('mobileNumber') })] }), _jsx(Field.ErrorText, { children: form.formState.errors.mobileNumber?.message })] }), _jsxs(Field.Root, { className: "mt-6", invalid: !!form.formState.errors.emailAddress, children: [_jsx(Field.Label, { children: "Email address" }), _jsx(Field.Input, { ...form.register('emailAddress') }), _jsx(Field.ErrorText, { children: form.formState.errors.emailAddress?.message })] })] }), form.formState.isDirty && (_jsxs("div", { className: "flex justify-end gap-lg border-border-secondary border-t px-xl py-lg lg:px-3xl lg:py-xl", children: [_jsx(Button, { size: "sm", variant: "outline", fullWidth: false, disabled: updateAccountMutation.isPending, onClick: () => form.reset(), children: "Cancel" }), _jsx(Button, { type: "submit", size: "sm", fullWidth: false, disabled: updateAccountMutation.isPending || !form.formState.isValid, children: "Save Changes" })] }))] })] }));
|
|
219
220
|
}
|
|
220
221
|
function SSO({ google, facebook }) {
|
|
221
222
|
const googleClientIdQuery = useGoogleClientIdQuery({ enabled: !!google });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
const PhoneIcon = () => {
|
|
3
|
+
return (_jsx("svg", { width: "100%", height: "100%", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "-translate-y-1/2 pointer-events-none absolute top-1/2 left-3.5 size-5", children: _jsx("path", { d: "M12 17.5H12.01M8.2 22H15.8C16.9201 22 17.4802 22 17.908 21.782C18.2843 21.5903 18.5903 21.2843 18.782 20.908C19 20.4802 19 19.9201 19 18.8V5.2C19 4.07989 19 3.51984 18.782 3.09202C18.5903 2.71569 18.2843 2.40973 17.908 2.21799C17.4802 2 16.9201 2 15.8 2H8.2C7.0799 2 6.51984 2 6.09202 2.21799C5.71569 2.40973 5.40973 2.71569 5.21799 3.09202C5 3.51984 5 4.0799 5 5.2V18.8C5 19.9201 5 20.4802 5.21799 20.908C5.40973 21.2843 5.71569 21.5903 6.09202 21.782C6.51984 22 7.07989 22 8.2 22ZM12.5 17.5C12.5 17.7761 12.2761 18 12 18C11.7239 18 11.5 17.7761 11.5 17.5C11.5 17.2239 11.7239 17 12 17C12.2761 17 12.5 17.2239 12.5 17.5Z", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
|
|
4
|
+
};
|
|
5
|
+
export default PhoneIcon;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { lazy, Suspense, useEffect, useState } from 'react';
|
|
3
3
|
import { useShallow } from 'zustand/shallow';
|
|
4
4
|
import { useFeatureFlag } from '../../../client/hooks/useFeatureFlag.js';
|
|
5
5
|
import { useGlobalStore } from '../../../client/hooks/useGlobalStore.js';
|
|
@@ -15,15 +15,33 @@ import { onMobileDevice } from '../../../utils/onMobileDevice.js';
|
|
|
15
15
|
import { parseDecimal } from '../../../utils/parseDecimal.js';
|
|
16
16
|
import { useDepositWithdrawalPropsContext } from '../DepositWithdrawalContext.js';
|
|
17
17
|
import { PaymentMethods } from '../PaymentMethods.js';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
const GCashStandardCashInWithdrawal = lazy(() => import('./GCashStandardCashInWithdrawal/GCashStandardCashInWithdrawal.js').then((m) => ({
|
|
19
|
+
default: m.GCashStandardCashInWithdrawal,
|
|
20
|
+
})));
|
|
21
|
+
const GCashWithdrawal = lazy(() => import('./GCashWithdrawal/GCashWithdrawal.js').then((m) => ({
|
|
22
|
+
default: m.GCashWithdrawal,
|
|
23
|
+
})));
|
|
24
|
+
const InstapayGCashWithdrawal = lazy(() => import('./InstapayGCashWithdrawal/InstapayGcashWithdrawal.js').then((m) => ({
|
|
25
|
+
default: m.InstapayGCashWithdrawal,
|
|
26
|
+
})));
|
|
27
|
+
const InstapayPaymayaWithdrawal = lazy(() => import('./InstapayPaymayaWithdrawal/InstapayPaymayaWithdrawal.js').then((m) => ({
|
|
28
|
+
default: m.InstapayPaymayaWithdrawal,
|
|
29
|
+
})));
|
|
30
|
+
const InstapayWithdrawal = lazy(() => import('./InstapayWithdrawal/InstapayWithdrawal.js').then((m) => ({
|
|
31
|
+
default: m.InstapayWithdrawal,
|
|
32
|
+
})));
|
|
33
|
+
const MayaAppWithdrawal = lazy(() => import('./MayaAppWithdrawal/MayaAppWithdrawal.js').then((m) => ({
|
|
34
|
+
default: m.MayaAppWithdrawal,
|
|
35
|
+
})));
|
|
36
|
+
const MayaWithdrawal = lazy(() => import('./MayaWithdrawal/MayaWithdrawal.js').then((m) => ({
|
|
37
|
+
default: m.MayaWithdrawal,
|
|
38
|
+
})));
|
|
39
|
+
const PisoPayWithdrawal = lazy(() => import('./PisoPayWithdrawal/PisoPayWithdrawal.js').then((m) => ({
|
|
40
|
+
default: m.PisoPayWithdrawal,
|
|
41
|
+
})));
|
|
42
|
+
const VentajaWithdrawal = lazy(() => import('./VentajaWithdrawal/VentajaWithdrawal.js').then((m) => ({
|
|
43
|
+
default: m.VentajaWithdrawal,
|
|
44
|
+
})));
|
|
27
45
|
export function Withdrawal() {
|
|
28
46
|
const { onMaya } = useMayaAuth();
|
|
29
47
|
const { allowUnverifiedAccounts } = useDepositWithdrawalPropsContext();
|
|
@@ -120,7 +138,7 @@ export function Withdrawal() {
|
|
|
120
138
|
if (enabledPaymentMethods.length <= 0) {
|
|
121
139
|
return _jsx(NoAvailablePaymentMethods, {});
|
|
122
140
|
}
|
|
123
|
-
return (_jsxs(_Fragment, { children: [enabledPaymentMethods.length > 1 && (_jsx(PaymentMethods, { value: paymentMethod, onChange: setPaymentMethod, options: enabledPaymentMethods })), paymentMethod === 'GCASH' && _jsx(GCashWithdrawal, {}), paymentMethod === 'MAYA' && _jsx(MayaWithdrawal, {}), paymentMethod === 'MAYA_APP' && _jsx(MayaAppWithdrawal, {}), paymentMethod === 'INSTAPAY' && _jsx(InstapayWithdrawal, {}), paymentMethod === 'INSTAPAY_GCASH' && _jsx(InstapayGCashWithdrawal, {}), paymentMethod === 'INSTAPAY_PAYMAYA' && _jsx(InstapayPaymayaWithdrawal, {}), paymentMethod === 'VENTAJA_DISBURSEMENT' && _jsx(VentajaWithdrawal, {}), paymentMethod === 'PISO_PAY' && _jsx(PisoPayWithdrawal, {}), paymentMethod === 'GCASH_STANDARD_CASH_IN' && (_jsx(GCashStandardCashInWithdrawal, {}))] }));
|
|
141
|
+
return (_jsxs(_Fragment, { children: [enabledPaymentMethods.length > 1 && (_jsx(PaymentMethods, { value: paymentMethod, onChange: setPaymentMethod, options: enabledPaymentMethods })), _jsxs(Suspense, { fallback: _jsx(SpinnerIcon, { className: "mx-auto size-6" }), children: [paymentMethod === 'GCASH' && _jsx(GCashWithdrawal, {}), paymentMethod === 'MAYA' && _jsx(MayaWithdrawal, {}), paymentMethod === 'MAYA_APP' && _jsx(MayaAppWithdrawal, {}), paymentMethod === 'INSTAPAY' && _jsx(InstapayWithdrawal, {}), paymentMethod === 'INSTAPAY_GCASH' && _jsx(InstapayGCashWithdrawal, {}), paymentMethod === 'INSTAPAY_PAYMAYA' && _jsx(InstapayPaymayaWithdrawal, {}), paymentMethod === 'VENTAJA_DISBURSEMENT' && _jsx(VentajaWithdrawal, {}), paymentMethod === 'PISO_PAY' && _jsx(PisoPayWithdrawal, {}), paymentMethod === 'GCASH_STANDARD_CASH_IN' && (_jsx(GCashStandardCashInWithdrawal, {}))] })] }));
|
|
124
142
|
}
|
|
125
143
|
function AccountVerificationRequired() {
|
|
126
144
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|