@opexa/portal-components 0.0.920 → 0.0.922
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/hooks/useUpdateMobileNumber.d.ts +3 -0
- package/dist/client/hooks/useUpdateMobileNumber.js +20 -0
- package/dist/components/AccountInfo/AccountInfo.js +5 -3
- package/dist/components/AccountSecurity/AccountSecurity.js +6 -3
- package/dist/components/AccountVerification/AccountVerification.js +1 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositContext.d.ts +4 -4
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/useQRPHDeposit.d.ts +2 -2
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositContext.d.ts +4 -4
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/useOnlineBankDeposit.d.ts +2 -2
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositContext.d.ts +4 -4
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/useQRPHDeposit.d.ts +2 -2
- package/dist/components/KYC/KYCVerificationStatus.lazy.js +4 -7
- package/dist/components/ResponsibleGaming/ResponsibleGamingV2.lazy.js +37 -14
- package/dist/components/TermsOfUse/TermsOfUseV2.lazy.js +35 -14
- package/dist/components/TransactionRecords/TableFilters.js +2 -2
- package/dist/components/UpdateMobileNumber/UpdateMobileNumber.d.ts +3 -0
- package/dist/components/UpdateMobileNumber/UpdateMobileNumber.js +136 -0
- package/dist/components/UpdateMobileNumber/index.d.ts +1 -0
- package/dist/components/UpdateMobileNumber/index.js +1 -0
- package/dist/icons/ScrollToBottomIcon.js +1 -1
- package/dist/icons/ScrollToTopIcon.d.ts +2 -0
- package/dist/icons/ScrollToTopIcon.js +4 -0
- package/dist/images/alert-circle-icon.png +0 -0
- package/dist/schemas/forgotPasswordSchema.d.ts +4 -4
- package/dist/services/account.d.ts +21 -0
- package/dist/services/account.js +11 -1
- package/dist/services/queries.d.ts +1 -0
- package/dist/services/queries.js +14 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/ui/AlertDialog/AlertDialog.d.ts +154 -154
- package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +14 -14
- package/dist/ui/Badge/Badge.d.ts +12 -12
- package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
- package/dist/ui/Badge/badge.recipe.d.ts +3 -3
- package/dist/ui/Carousel/Carousel.d.ts +45 -45
- package/dist/ui/Carousel/carousel.recipe.d.ts +5 -5
- package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
- package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
- package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
- package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
- package/dist/ui/Combobox/Combobox.d.ts +42 -42
- package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
- package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
- package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
- package/dist/ui/Dialog/Dialog.d.ts +33 -33
- package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
- package/dist/ui/Drawer/Drawer.d.ts +33 -33
- package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
- package/dist/ui/Menu/Menu.d.ts +252 -252
- package/dist/ui/Menu/menu.recipe.d.ts +14 -14
- package/dist/ui/Popover/Popover.d.ts +88 -88
- package/dist/ui/Popover/popover.recipe.d.ts +8 -8
- package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
- package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
- package/dist/ui/Select/Select.d.ts +45 -45
- package/dist/ui/Select/select.recipe.d.ts +3 -3
- package/dist/ui/Table/Table.d.ts +21 -21
- package/dist/ui/Table/table.anatomy.d.ts +1 -1
- package/dist/ui/Table/table.recipe.d.ts +3 -3
- package/dist/ui/Tabs/Tabs.d.ts +15 -15
- package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
- package/dist/utils/mutationKeys.d.ts +1 -0
- package/dist/utils/mutationKeys.js +8 -1
- package/package.json +1 -1
- package/dist/components/Banner/Banner.client.d.ts +0 -12
- package/dist/components/Banner/Banner.client.js +0 -49
- package/dist/components/DepositWithdrawal/AiOPaymentMethods.d.ts +0 -11
- package/dist/components/DepositWithdrawal/AiOPaymentMethods.js +0 -55
- package/dist/components/DigitainLauncher/Loading.d.ts +0 -1
- package/dist/components/DigitainLauncher/Loading.js +0 -5
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +0 -184
- package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +0 -184
- package/dist/components/KYC/BasicInformation.d.ts +0 -1
- package/dist/components/KYC/BasicInformation.js +0 -101
- package/dist/components/KYC/IdentityVerification.d.ts +0 -1
- package/dist/components/KYC/IdentityVerification.js +0 -120
- package/dist/components/KYC/Indicator.d.ts +0 -1
- package/dist/components/KYC/Indicator.js +0 -8
- package/dist/components/KYC/KYC.lazy.d.ts +0 -6
- package/dist/components/KYC/KYC.lazy.js +0 -45
- package/dist/components/KYC/KYCContext.d.ts +0 -6
- package/dist/components/KYC/KYCContext.js +0 -2
- package/dist/components/KYC/PersonalInformation.d.ts +0 -1
- package/dist/components/KYC/PersonalInformation.js +0 -122
- package/dist/components/KYC/useKYC.d.ts +0 -25
- package/dist/components/KYC/useKYC.js +0 -38
- package/dist/components/PortalProvider/CXDTokenObserver.d.ts +0 -1
- package/dist/components/PortalProvider/CXDTokenObserver.js +0 -30
- package/dist/components/PortalProvider/LinkGoogleAccountObserver.d.ts +0 -1
- package/dist/components/PortalProvider/LinkGoogleAccountObserver.js +0 -29
- package/dist/components/SessionWatcher/SessionWatcher.d.ts +0 -1
- package/dist/components/SessionWatcher/SessionWatcher.js +0 -20
- package/dist/components/SessionWatcher/index.d.ts +0 -1
- package/dist/components/SessionWatcher/index.js +0 -1
- package/dist/components/SignIn/utils.d.ts +0 -8
- package/dist/components/SignIn/utils.js +0 -26
- package/dist/constants/Branches.d.ts +0 -2
- package/dist/constants/Branches.js +0 -42
- package/dist/images/responsible-gaming-yellow.png +0 -0
- package/dist/third-parties/FacebookPixel/FacebookPixel.d.ts +0 -4
- package/dist/third-parties/FacebookPixel/FacebookPixel.js +0 -4
- package/dist/third-parties/FacebookPixel/api.d.ts +0 -0
- package/dist/third-parties/FacebookPixel/api.js +0 -1
- package/dist/third-parties/FacebookPixel/index.d.ts +0 -1
- package/dist/third-parties/FacebookPixel/index.js +0 -1
- package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.d.ts +0 -4
- package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.js +0 -4
- package/dist/third-parties/GoogleRecaptcha/api.d.ts +0 -0
- package/dist/third-parties/GoogleRecaptcha/api.js +0 -1
- package/dist/third-parties/GoogleRecaptcha/index.d.ts +0 -1
- package/dist/third-parties/GoogleRecaptcha/index.js +0 -1
- package/dist/third-parties/index.d.ts +0 -2
- package/dist/third-parties/index.js +0 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useMutation } from '@tanstack/react-query';
|
|
2
|
+
import invariant from 'tiny-invariant';
|
|
3
|
+
import { updateMobileNumber, } from '../../services/account.js';
|
|
4
|
+
import { getUpdateMobileNumberMutationKey } from '../../utils/mutationKeys.js';
|
|
5
|
+
import { getSession } from '../services/getSession.js';
|
|
6
|
+
export const useUpdateMobileNumber = (config) => {
|
|
7
|
+
return useMutation({
|
|
8
|
+
...config,
|
|
9
|
+
mutationKey: getUpdateMobileNumberMutationKey(),
|
|
10
|
+
mutationFn: async (input) => {
|
|
11
|
+
const session = await getSession();
|
|
12
|
+
invariant(session.status === 'authenticated');
|
|
13
|
+
await updateMobileNumber(input.verificationCode, input.mobileNumber, {
|
|
14
|
+
headers: {
|
|
15
|
+
Authorization: `Bearer ${session.token}`,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
};
|
|
@@ -29,6 +29,7 @@ import { FacebookIcon } from '../../icons/FacebookIcon.js';
|
|
|
29
29
|
import { GoogleIcon } from '../../icons/GoogleIcon.js';
|
|
30
30
|
import { LinkBroken02Icon } from '../../icons/LinkBroken02Icon.js';
|
|
31
31
|
import { XIcon } from '../../icons/XIcon.js';
|
|
32
|
+
import AlertCircleIconImage from '../../images/alert-circle-icon.png';
|
|
32
33
|
import avatarPlaceholder from '../../images/placeholder-avatar.png';
|
|
33
34
|
import { Button } from '../../ui/Button/index.js';
|
|
34
35
|
import { Dialog } from '../../ui/Dialog/index.js';
|
|
@@ -204,9 +205,7 @@ function ContactInfo({ variant }) {
|
|
|
204
205
|
});
|
|
205
206
|
}
|
|
206
207
|
}, [account, form, parse]);
|
|
207
|
-
return (_jsxs("div", { children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h2", { className: "grow font-semibold text-sm text-text-secondary-700", children: "Contact Info" }), _jsx(ark.svg, { asChild: true, className:
|
|
208
|
-
? 'text-text-success-primary'
|
|
209
|
-
: 'text-text-warning-primary'), children: profileCompletion?.personalInformation ? (_jsx(CheckVerified02Icon, {})) : (_jsx(AlertCircleIcon, {})) })] }), _jsxs("form", { className: "mt-5 rounded-xl border border-border-secondary bg-bg-primary-alt shadow-xs", onSubmit: form.handleSubmit((data) => {
|
|
208
|
+
return (_jsxs("div", { children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h2", { className: "grow font-semibold text-sm text-text-secondary-700", children: "Contact Info" }), profileCompletion?.personalInformation ? (_jsx(ark.svg, { asChild: true, className: "size-6 text-text-success-primary", children: _jsx(CheckVerified02Icon, {}) })) : (_jsxs("div", { className: "flex items-center gap-1 rounded-sm border border-[#93370d] bg-[#4e1d09] px-sm py-xs", children: [_jsx(AlertCircleIcon, { className: "h-5 w-5 text-[#FEC84B]" }), _jsx("span", { className: "m-0 text-[#FEC84B] text-xs", children: "Not Set" })] }))] }), _jsx(AlertWarning, { title: "Please add an email address to your account to receive important notifications.", className: "my-3" }), _jsxs("form", { className: "rounded-xl border border-border-secondary bg-bg-primary-alt shadow-xs", onSubmit: form.handleSubmit((data) => {
|
|
210
209
|
updateAccountMutation.mutate({
|
|
211
210
|
emailAddress: data.emailAddress && account?.emailAddress !== data.emailAddress
|
|
212
211
|
? data.emailAddress
|
|
@@ -316,3 +315,6 @@ function UnlinkGoogleAccount() {
|
|
|
316
315
|
unlinkGoogleMutation.mutate(account.id);
|
|
317
316
|
}, children: "Disconnect" })] })) })] }) })] })] }));
|
|
318
317
|
}
|
|
318
|
+
function AlertWarning({ title, className, }) {
|
|
319
|
+
return (_jsxs("div", { className: twMerge('flex items-center gap-2 rounded-xl border border-border-secondary bg-bg-primary-alt p-xl', className), children: [_jsx(Image, { src: AlertCircleIconImage, alt: "Alert", className: "w-10 object-contain", draggable: false }), _jsx("p", { className: "font-semibold text-sm text-text-tertiary-600", children: title })] }));
|
|
320
|
+
}
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { createListCollection } from '@ark-ui/react/collection';
|
|
4
4
|
import { ark } from '@ark-ui/react/factory';
|
|
5
5
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
6
|
+
import Image from 'next/image';
|
|
6
7
|
import { useForm } from 'react-hook-form';
|
|
7
8
|
import { twMerge } from 'tailwind-merge';
|
|
8
9
|
import { z } from 'zod';
|
|
@@ -16,6 +17,7 @@ import { CheckVerified02Icon } from '../../icons/CheckVerified02Icon.js';
|
|
|
16
17
|
import { ChevronDownIcon } from '../../icons/ChevronDownIcon.js';
|
|
17
18
|
import { EyeIcon } from '../../icons/EyeIcon.js';
|
|
18
19
|
import { EyeOffIcon } from '../../icons/EyeOffIcon.js';
|
|
20
|
+
import AlertCircleIconImage from '../../images/alert-circle-icon.png';
|
|
19
21
|
import { Button } from '../../ui/Button/index.js';
|
|
20
22
|
import { Field } from '../../ui/Field/index.js';
|
|
21
23
|
import { PasswordInput } from '../../ui/PasswordInput/index.js';
|
|
@@ -158,14 +160,15 @@ function TransactionPassword() {
|
|
|
158
160
|
confirmPassword: '',
|
|
159
161
|
},
|
|
160
162
|
});
|
|
161
|
-
return (_jsxs("div", { children: [_jsxs("div", { className: "flex items-start gap-8", children: [_jsxs("div", { className: "grow", children: [_jsx("h2", { className: "font-semibold text-sm text-text-secondary-700", children: "Transaction password" }), _jsx("p", { className: "text-sm text-text-tertiary-600", children: "The transaction password secures and confirms your wallet withdrawals." })] }), _jsx(ark.svg, { asChild: true, className:
|
|
162
|
-
? 'text-text-success-primary'
|
|
163
|
-
: 'text-text-warning-primary'), children: profileCompletion?.transactionPassword ? (_jsx(CheckVerified02Icon, {})) : (_jsx(AlertCircleIcon, {})) })] }), _jsxs("form", { className: "mt-5 rounded-xl border border-border-secondary bg-bg-primary-alt shadow-xs", onSubmit: form.handleSubmit((data) => {
|
|
163
|
+
return (_jsxs("div", { children: [_jsxs("div", { className: "flex items-start gap-8", children: [_jsxs("div", { className: "grow", children: [_jsx("h2", { className: "font-semibold text-sm text-text-secondary-700", children: "Transaction password" }), _jsx("p", { className: "text-sm text-text-tertiary-600", children: "The transaction password secures and confirms your wallet withdrawals." })] }), profileCompletion?.personalInformation ? (_jsx(ark.svg, { asChild: true, className: "size-6 text-text-success-primary", children: _jsx(CheckVerified02Icon, {}) })) : (_jsxs("div", { className: "flex items-center gap-1 rounded-sm border border-[#93370d] bg-[#4e1d09] px-sm py-xs", children: [_jsx(AlertCircleIcon, { className: "h-5 w-5 text-[#FEC84B]" }), _jsx("span", { className: "m-0 text-nowrap text-[#FEC84B] text-xs", children: "Not Set" })] }))] }), _jsx(AlertWarning, { title: "Please set your transaction password. This is required when making withdrawals and helps secure your account.", className: "my-3" }), _jsxs("form", { className: "mt-5 rounded-xl border border-border-secondary bg-bg-primary-alt shadow-xs", onSubmit: form.handleSubmit((data) => {
|
|
164
164
|
updateAccountMutation.mutate({
|
|
165
165
|
transactionPassword: data.password,
|
|
166
166
|
});
|
|
167
167
|
}), children: [_jsxs("div", { className: "px-xl py-5 lg:px-3xl lg:py-5", children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.password, children: [_jsxs(PasswordInput.Root, { children: [_jsx(PasswordInput.Label, { children: "Password" }), _jsxs(PasswordInput.Control, { children: [_jsx(PasswordInput.Input, { ...form.register('password') }), _jsx(PasswordInput.VisibilityTrigger, { children: _jsx(PasswordInput.Indicator, { fallback: _jsx(EyeOffIcon, {}), asChild: true, children: _jsx(EyeIcon, {}) }) })] })] }), _jsx(Field.ErrorText, { children: form.formState.errors.password?.message })] }), _jsxs(Field.Root, { className: "mt-6", invalid: !!form.formState.errors.confirmPassword, children: [_jsxs(PasswordInput.Root, { children: [_jsx(PasswordInput.Label, { children: "Confirm Password" }), _jsxs(PasswordInput.Control, { children: [_jsx(PasswordInput.Input, { ...form.register('confirmPassword') }), _jsx(PasswordInput.VisibilityTrigger, { children: _jsx(PasswordInput.Indicator, { fallback: _jsx(EyeOffIcon, {}), asChild: true, children: _jsx(EyeIcon, {}) }) })] })] }), _jsx(Field.ErrorText, { children: form.formState.errors.confirmPassword?.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: !form.formState.isValid || updateAccountMutation.isPending, children: "Save Changes" })] }))] })] }));
|
|
168
168
|
}
|
|
169
|
+
function AlertWarning({ title, className, }) {
|
|
170
|
+
return (_jsxs("div", { className: twMerge('flex items-center gap-2 rounded-xl border border-border-secondary bg-bg-primary-alt p-xl', className), children: [_jsx(Image, { src: AlertCircleIconImage, alt: "Alert", className: "w-10 object-contain", draggable: false }), _jsx("p", { className: "font-semibold text-sm text-text-tertiary-600", children: title })] }));
|
|
171
|
+
}
|
|
169
172
|
const secretQuestionCollection = createListCollection({
|
|
170
173
|
items: SECRET_QUESTIONS,
|
|
171
174
|
itemToValue: (item) => item,
|
|
@@ -53,7 +53,7 @@ function Status__Missing() {
|
|
|
53
53
|
return (_jsxs("div", { className: "mt-6 flex flex-col gap-2 rounded-xl border border-border-primary bg-bg-primary-alt p-xl shadow-xs lg:flex-row", children: [_jsx("div", { className: "flex size-[2.1875rem] items-center justify-center rounded-full border-2 border-text-warning-primary/10", children: _jsx("div", { className: "flex size-[1.666625rem] items-center justify-center rounded-full border-2 border-text-warning-primary/30", children: _jsx(AlertCircleIcon, { className: "size-5 text-text-warning-primary" }) }) }), _jsx("p", { className: "max-w-[800px] text-sm text-text-tertiary-600", children: "To serve you better and unlock all features, please provide valid identification documents. This helps protect your account and makes recovery easier if ever needed." })] }));
|
|
54
54
|
}
|
|
55
55
|
function Status__Pending() {
|
|
56
|
-
return (_jsxs("div", { className: "mt-6 flex flex-col gap-2 rounded-xl border border-border-primary bg-bg-primary-alt p-xl shadow-xs lg:flex-row", children: [_jsx("div", { className: "flex size-[2.1875rem] items-center justify-center rounded-full border-2 border-text-warning-primary/10", children: _jsx("div", { className: "flex size-[1.666625rem] items-center justify-center rounded-full border-2 border-text-warning-primary/30", children: _jsx(FileSearch02Icon, { className: "size-5 text-text-warning-primary" }) }) }), _jsxs("div", { children: [_jsx("h2", { className: "font-semibold text-sm text-text-secondary-700", children: "Under review" }), _jsx("p", { className: "mt-xs text-sm text-text-tertiary-600", children: "
|
|
56
|
+
return (_jsxs("div", { className: "mt-6 flex flex-col gap-2 rounded-xl border border-border-primary bg-bg-primary-alt p-xl shadow-xs lg:flex-row", children: [_jsx("div", { className: "flex size-[2.1875rem] items-center justify-center rounded-full border-2 border-text-warning-primary/10", children: _jsx("div", { className: "flex size-[1.666625rem] items-center justify-center rounded-full border-2 border-text-warning-primary/30", children: _jsx(FileSearch02Icon, { className: "size-5 text-text-warning-primary" }) }) }), _jsxs("div", { children: [_jsx("h2", { className: "font-semibold text-sm text-text-secondary-700", children: "Under review" }), _jsx("p", { className: "mt-xs text-sm text-text-tertiary-600", children: "Your documents have been successfully submitted and are currently under review. This process may take some time. You will be notified once verification is complete." })] })] }));
|
|
57
57
|
}
|
|
58
58
|
function Status__Success() {
|
|
59
59
|
return (_jsxs("div", { className: "mt-6 flex flex-col gap-2 rounded-xl border border-border-primary bg-bg-primary-alt p-xl shadow-xs lg:flex-row", children: [_jsx("div", { className: "flex size-[2.1875rem] items-center justify-center rounded-full border-2 border-text-success-primary/10", children: _jsx("div", { className: "flex size-[1.666625rem] items-center justify-center rounded-full border-2 border-text-success-primary/30", children: _jsx(FileCheck02Icon, { className: "size-5 text-text-success-primary" }) }) }), _jsxs("div", { children: [_jsx("h2", { className: "font-semibold text-sm text-text-secondary-700", children: "Verification successful" }), _jsx("p", { className: "mt-xs text-sm text-text-tertiary-600", children: "Your account has been successfully verified. You now have full access to all features and improved account security." })] })] }));
|
package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositContext.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const QRPHDepositContext: (props: {
|
|
2
2
|
value: {
|
|
3
|
-
view: "
|
|
4
|
-
status: "waiting" | "
|
|
3
|
+
view: "qrCode" | "form";
|
|
4
|
+
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
5
5
|
verify: () => void;
|
|
6
6
|
reset: () => void;
|
|
7
7
|
deposit: import("../../../../types").Deposit | null;
|
|
@@ -13,8 +13,8 @@ export declare const QRPHDepositContext: (props: {
|
|
|
13
13
|
} & {
|
|
14
14
|
children?: import("react").ReactNode | undefined;
|
|
15
15
|
}) => React.ReactNode, useQRPHDepositContext: () => {
|
|
16
|
-
view: "
|
|
17
|
-
status: "waiting" | "
|
|
16
|
+
view: "qrCode" | "form";
|
|
17
|
+
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
18
18
|
verify: () => void;
|
|
19
19
|
reset: () => void;
|
|
20
20
|
deposit: import("../../../../types").Deposit | null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Deposit } from '../../../../types';
|
|
2
2
|
export type UseQRPHDepositReturn = ReturnType<typeof useQRPHDeposit>;
|
|
3
3
|
export declare function useQRPHDeposit(): {
|
|
4
|
-
view: "
|
|
5
|
-
status: "waiting" | "
|
|
4
|
+
view: "qrCode" | "form";
|
|
5
|
+
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
6
6
|
verify: () => void;
|
|
7
7
|
reset: () => void;
|
|
8
8
|
deposit: Deposit | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const OnlineBankDepositContext: (props: {
|
|
2
2
|
value: {
|
|
3
|
-
view: "
|
|
4
|
-
status: "waiting" | "
|
|
3
|
+
view: "vca" | "form";
|
|
4
|
+
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
5
5
|
verify: () => void;
|
|
6
6
|
reset: () => void;
|
|
7
7
|
deposit: import("../../../../types").Deposit | null;
|
|
@@ -13,8 +13,8 @@ export declare const OnlineBankDepositContext: (props: {
|
|
|
13
13
|
} & {
|
|
14
14
|
children?: import("react").ReactNode | undefined;
|
|
15
15
|
}) => React.ReactNode, useOnlineBankDepositContext: () => {
|
|
16
|
-
view: "
|
|
17
|
-
status: "waiting" | "
|
|
16
|
+
view: "vca" | "form";
|
|
17
|
+
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
18
18
|
verify: () => void;
|
|
19
19
|
reset: () => void;
|
|
20
20
|
deposit: import("../../../../types").Deposit | null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Deposit } from '../../../../types';
|
|
2
2
|
export type UseOnlineBankDepositReturn = ReturnType<typeof useOnlineBankDeposit>;
|
|
3
3
|
export declare function useOnlineBankDeposit(): {
|
|
4
|
-
view: "
|
|
5
|
-
status: "waiting" | "
|
|
4
|
+
view: "vca" | "form";
|
|
5
|
+
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
6
6
|
verify: () => void;
|
|
7
7
|
reset: () => void;
|
|
8
8
|
deposit: Deposit | null;
|
package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositContext.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const QRPHDepositContext: (props: {
|
|
2
2
|
value: {
|
|
3
|
-
view: "
|
|
4
|
-
status: "waiting" | "
|
|
3
|
+
view: "qrCode" | "form";
|
|
4
|
+
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
5
5
|
verify: () => void;
|
|
6
6
|
reset: () => void;
|
|
7
7
|
deposit: import("../../../../types").Deposit | null;
|
|
@@ -13,8 +13,8 @@ export declare const QRPHDepositContext: (props: {
|
|
|
13
13
|
} & {
|
|
14
14
|
children?: import("react").ReactNode | undefined;
|
|
15
15
|
}) => React.ReactNode, useQRPHDepositContext: () => {
|
|
16
|
-
view: "
|
|
17
|
-
status: "waiting" | "
|
|
16
|
+
view: "qrCode" | "form";
|
|
17
|
+
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
18
18
|
verify: () => void;
|
|
19
19
|
reset: () => void;
|
|
20
20
|
deposit: import("../../../../types").Deposit | null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Deposit } from '../../../../types';
|
|
2
2
|
export type UseQRPHDepositReturn = ReturnType<typeof useQRPHDeposit>;
|
|
3
3
|
export declare function useQRPHDeposit(): {
|
|
4
|
-
view: "
|
|
5
|
-
status: "waiting" | "
|
|
4
|
+
view: "qrCode" | "form";
|
|
5
|
+
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
6
6
|
verify: () => void;
|
|
7
7
|
reset: () => void;
|
|
8
8
|
deposit: Deposit | null;
|
|
@@ -19,18 +19,15 @@ export function KYCVerificationStatus() {
|
|
|
19
19
|
const icons = status === 'PENDING' ? bellIcon : alertIcon;
|
|
20
20
|
return (_jsx(Dialog.Root, { open: globalStore.kycVerificationStatus.open, onOpenChange: (details) => {
|
|
21
21
|
globalStore.kycVerificationStatus.setOpen(details.open);
|
|
22
|
-
}, closeOnEscape: false, closeOnInteractOutside: false, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+3)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+4)] flex items-center justify-center", children: _jsx(Dialog.Content, { className: "mx-auto h-fit w-[450px] overflow-y-auto rounded-lg bg-bg-primary", children: _jsxs("div", { className: "p-3xl text-center", children: [_jsx("div", { className: "mb-3xl grid h-[200px] w-full place-items-center rounded-xl bg-radial from-40% from-button-primary-bg to-bg-brand-solid", children: _jsx(Image, { src: icons, alt: "icon", className: "w-60 object-contain", draggable: false, width: 120, height: 120 }) }), _jsxs("h1", { className: "font-semibold text-lg text-white", children: [status === 'PENDING' && 'Verification in Progress', status === 'REJECTED' && 'Verification Rejected', status === 'UNVERIFIED'
|
|
23
|
-
(status === 'CREATED' && 'Verification Required')] }), _jsxs("p", { className: "mb-4xl text-[#94969C] text-base", children: [status === 'PENDING' &&
|
|
22
|
+
}, closeOnEscape: false, closeOnInteractOutside: false, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+3)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+4)] flex items-center justify-center", children: _jsx(Dialog.Content, { className: "mx-auto h-fit w-[450px] overflow-y-auto rounded-lg bg-bg-primary", children: _jsxs("div", { className: "p-3xl text-center", children: [_jsx("div", { className: "mb-3xl grid h-[200px] w-full place-items-center rounded-xl bg-radial from-40% from-button-primary-bg to-bg-brand-solid", children: _jsx(Image, { src: icons, alt: "icon", className: "w-60 object-contain", draggable: false, width: 120, height: 120 }) }), _jsxs("h1", { className: "font-semibold text-lg text-white", children: [status === 'PENDING' && 'Verification in Progress', status === 'REJECTED' && 'Verification Rejected', status === 'UNVERIFIED' && 'Verification Required'] }), _jsxs("p", { className: "mb-4xl text-[#94969C] text-base", children: [status === 'PENDING' &&
|
|
24
23
|
`Your account verification is still under review. Please wait
|
|
25
24
|
until it's approved before you can continue playing or
|
|
26
25
|
depositing.`, status === 'REJECTED' &&
|
|
27
|
-
'Your account verification was not approved. Please resubmit your verification to regain full access.', status === 'UNVERIFIED'
|
|
28
|
-
(status === '
|
|
29
|
-
'Your account is not yet verified. Please complete the verification process to continue playing or depositing.')] }), _jsxs(Button, { variant: "solid", className: twMerge('mb-2 w-full', status === 'PENDING' && 'hidden'), onClick: () => {
|
|
26
|
+
'Your account verification was not approved. Please resubmit your verification to regain full access.', status === 'UNVERIFIED' &&
|
|
27
|
+
'Your account is not yet verified. Please complete the verification process to continue playing or depositing.'] }), _jsxs(Button, { variant: "solid", className: twMerge('mb-2 w-full', status === 'PENDING' && 'hidden'), onClick: () => {
|
|
30
28
|
globalStore.kycVerificationStatus.setOpen(false);
|
|
31
29
|
globalStore.kyc.setOpen(true);
|
|
32
|
-
}, children: [status === 'REJECTED' && 'Resubmit Verification', status === 'UNVERIFIED'
|
|
33
|
-
(status === 'CREATED' && 'Verify Now')] }), _jsx(Button, { type: "button", variant: "outline", onClick: () => {
|
|
30
|
+
}, children: [status === 'REJECTED' && 'Resubmit Verification', status === 'UNVERIFIED' && 'Verify Now'] }), _jsx(Button, { type: "button", variant: "outline", onClick: () => {
|
|
34
31
|
globalStore.kycVerificationStatus.setOpen(false);
|
|
35
32
|
}, children: "Close" })] }) }) })] }) }));
|
|
36
33
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Image, {} from 'next/image';
|
|
3
|
-
import { useRef } from 'react';
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
4
|
import { twMerge } from 'tailwind-merge';
|
|
5
5
|
import { useShallow } from 'zustand/shallow';
|
|
6
6
|
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
7
7
|
import { ScrollToBottomIcon } from '../../icons/ScrollToBottomIcon.js';
|
|
8
|
-
import
|
|
9
|
-
import pagcorLogo from '../../images/pagcor.png';
|
|
10
|
-
import responsibleGamingLogo from '../../images/responsible-gaming.png';
|
|
8
|
+
import { ScrollToTopIcon } from '../../icons/ScrollToTopIcon.js';
|
|
11
9
|
import { Button } from '../../ui/Button/index.js';
|
|
12
10
|
import { Dialog } from '../../ui/Dialog/index.js';
|
|
13
11
|
import { Portal } from '../../ui/Portal/index.js';
|
|
14
12
|
export function ResponsibleGamingV2(props) {
|
|
13
|
+
const [hasReachedBottom, setHasReachedBottom] = useState(false);
|
|
14
|
+
const [isAtBottom, setIsAtBottom] = useState(false);
|
|
15
15
|
const scrollableContentRef = useRef(null);
|
|
16
16
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
17
17
|
signIn: ctx.signIn,
|
|
@@ -19,6 +19,16 @@ export function ResponsibleGamingV2(props) {
|
|
|
19
19
|
disclaimer: ctx.disclaimer,
|
|
20
20
|
responsibleGaming: ctx.responsibleGaming,
|
|
21
21
|
})));
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (scrollableContentRef.current) {
|
|
24
|
+
const { scrollHeight, clientHeight } = scrollableContentRef.current;
|
|
25
|
+
const atBottom = scrollHeight <= clientHeight;
|
|
26
|
+
setIsAtBottom(atBottom);
|
|
27
|
+
if (atBottom) {
|
|
28
|
+
setHasReachedBottom(true);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}, []);
|
|
22
32
|
return (_jsx(Dialog.Root, { open: globalStore.responsibleGaming.open, onOpenChange: (details) => {
|
|
23
33
|
globalStore.responsibleGaming.setOpen(details.open);
|
|
24
34
|
if (!details.open)
|
|
@@ -34,14 +44,27 @@ export function ResponsibleGamingV2(props) {
|
|
|
34
44
|
globalStore.disclaimer.setOpen(true);
|
|
35
45
|
}
|
|
36
46
|
globalStore.responsibleGaming.setNext(null);
|
|
37
|
-
}, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "z-popover" }), _jsx(Dialog.Positioner, { className: "z-popover", children: _jsxs(Dialog.Content, { className: twMerge('relative flex h-full w-full flex-col items-start overflow-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
}, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "z-popover" }), _jsx(Dialog.Positioner, { className: "z-popover", children: _jsxs(Dialog.Content, { className: twMerge('relative flex h-full w-full flex-col items-start overflow-hidden p-4 sm:p-6 lg:mx-auto lg:max-h-[90vh] lg:w-[500px] lg:p-3xl', 'scrollbar:h-2 scrollbar:w-2 scrollbar-thumb:rounded-full scrollbar-thumb:bg-bg-quaternary scrollbar-track:bg-transparent'), children: [_jsx(Image, { src: props.logo, alt: "", width: 250, height: 150, className: "mx-auto h-auto w-20 sm:w-24 lg:w-[7.5rem]", draggable: false }), _jsxs("div", { className: "relative flex h-full w-full flex-col overflow-hidden", children: [_jsx(Dialog.Title, { className: "my-3 text-center font-semibold text-brand-400 sm:mt-6 sm:text-lg lg:my-xl lg:text-2xl", children: "Responsible Gaming Guidelines" }), _jsx("div", { className: "flex min-h-0 flex-1 flex-col rounded-md bg-bg-primary-alt px-2 py-2", children: _jsxs("div", { ref: scrollableContentRef, className: "mt-2 scrollbar:h-2 scrollbar:w-2 flex-1 overflow-y-auto scrollbar-thumb:rounded-full scrollbar-track:rounded-full bg-bg-primary-alt scrollbar-thumb:bg-bg-quaternary scrollbar-track:bg-bg-primary p-3 pr-4 sm:mt-xs sm:p-4", onScroll: (e) => {
|
|
48
|
+
const { scrollTop, scrollHeight, clientHeight } = e.currentTarget;
|
|
49
|
+
const atBottom = Math.abs(scrollHeight - clientHeight - scrollTop) < 1;
|
|
50
|
+
setIsAtBottom(atBottom);
|
|
51
|
+
if (atBottom) {
|
|
52
|
+
setHasReachedBottom(true);
|
|
53
|
+
}
|
|
54
|
+
}, children: [_jsx(Dialog.Description, { className: "text-xs leading-relaxed sm:text-sm sm:leading-2xl", children: props.content }), _jsx(Button, { type: "button", className: twMerge('absolute right-6 bottom-7 z-10 size-10 rounded-lg transition-colors duration-75 ease-in-out sm:right-6 sm:bottom-6 lg:right-8 lg:bottom-8', isAtBottom
|
|
55
|
+
? 'border border-[#CECFD2] bg-bg-secondary'
|
|
56
|
+
: 'bg-bg-brand-secondary'), onClick: () => {
|
|
57
|
+
if (scrollableContentRef.current) {
|
|
58
|
+
scrollableContentRef.current.scrollTo({
|
|
59
|
+
top: isAtBottom
|
|
60
|
+
? 0
|
|
61
|
+
: scrollableContentRef.current.scrollHeight,
|
|
62
|
+
behavior: 'smooth',
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}, children: isAtBottom ? _jsx(ScrollToTopIcon, {}) : _jsx(ScrollToBottomIcon, {}) })] }) })] }), _jsx(Dialog.Context, { children: (api) => (_jsx(Button, { type: "button", className: twMerge('mt-4 w-full py-2 text-sm sm:py-2.5 sm:text-base', hasReachedBottom
|
|
66
|
+
? 'bg-bg-brand-secondary'
|
|
67
|
+
: 'bg-bg-disabled text-text-disabled'), onClick: () => {
|
|
68
|
+
api.setOpen(false);
|
|
69
|
+
}, disabled: !hasReachedBottom, children: "I Agree" })) })] }) })] }) }));
|
|
47
70
|
}
|
|
@@ -1,24 +1,34 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Image, {} from 'next/image';
|
|
3
|
-
import { useRef } from 'react';
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
4
|
import { twMerge } from 'tailwind-merge';
|
|
5
5
|
import { useShallow } from 'zustand/shallow';
|
|
6
6
|
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
7
7
|
import { ScrollToBottomIcon } from '../../icons/ScrollToBottomIcon.js';
|
|
8
|
-
import
|
|
9
|
-
import pagcorLogo from '../../images/pagcor.png';
|
|
10
|
-
import responsibleGamingLogo from '../../images/responsible-gaming.png';
|
|
8
|
+
import { ScrollToTopIcon } from '../../icons/ScrollToTopIcon.js';
|
|
11
9
|
import { Button } from '../../ui/Button/index.js';
|
|
12
10
|
import { Dialog } from '../../ui/Dialog/index.js';
|
|
13
11
|
import { Portal } from '../../ui/Portal/index.js';
|
|
14
12
|
export function TermsOfUseV2({ logo, siteName, content, ...props }) {
|
|
15
13
|
const scrollableContentRef = useRef(null);
|
|
14
|
+
const [hasReachedBottom, setHasReachedBottom] = useState(false);
|
|
15
|
+
const [isAtBottom, setIsAtBottom] = useState(false);
|
|
16
16
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
17
17
|
signIn: ctx.signIn,
|
|
18
18
|
signUp: ctx.signUp,
|
|
19
19
|
disclaimer: ctx.disclaimer,
|
|
20
20
|
termsOfUse: ctx.termsOfUse,
|
|
21
21
|
})));
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (scrollableContentRef.current) {
|
|
24
|
+
const { scrollHeight, clientHeight } = scrollableContentRef.current;
|
|
25
|
+
const atBottom = scrollHeight <= clientHeight;
|
|
26
|
+
setIsAtBottom(atBottom);
|
|
27
|
+
if (atBottom) {
|
|
28
|
+
setHasReachedBottom(true);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}, []);
|
|
22
32
|
return (_jsx(Dialog.Root, { open: globalStore.termsOfUse.open, onOpenChange: (details) => {
|
|
23
33
|
globalStore.termsOfUse.setOpen(details.open);
|
|
24
34
|
if (!details.open)
|
|
@@ -34,14 +44,25 @@ export function TermsOfUseV2({ logo, siteName, content, ...props }) {
|
|
|
34
44
|
globalStore.disclaimer.setOpen(true);
|
|
35
45
|
}
|
|
36
46
|
globalStore.termsOfUse.setNext(null);
|
|
37
|
-
}, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "z-popover" }), _jsx(Dialog.Positioner, { className: "z-popover", children: _jsxs(Dialog.Content, { className: twMerge('relative flex h-full w-full flex-col items-start overflow-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
}, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "z-popover" }), _jsx(Dialog.Positioner, { className: "z-popover", children: _jsxs(Dialog.Content, { className: twMerge('relative flex h-full w-full flex-col items-start overflow-hidden bg-bg-primary p-4 sm:p-6 lg:mx-auto lg:max-h-[90vh] lg:w-[500px] lg:p-3xl', 'scrollbar:h-2 scrollbar:w-2 scrollbar-thumb:rounded-full scrollbar-thumb:bg-bg-quaternary scrollbar-track:bg-transparent'), children: [_jsx(Image, { src: logo, alt: "", width: 250, height: 150, className: "mx-auto h-auto w-20 sm:w-24 lg:w-[7.5rem]", draggable: false }), _jsxs("div", { className: "relative flex h-full w-full flex-col overflow-hidden", children: [_jsx(Dialog.Title, { className: "my-3 text-center font-semibold text-brand-400 sm:mt-6 sm:text-lg lg:my-xl lg:text-2xl", children: "Terms of Use" }), _jsx("div", { className: "flex min-h-0 flex-1 flex-col rounded-md bg-bg-primary-alt px-2 py-2", children: _jsxs("div", { ref: scrollableContentRef, className: "mt-2 scrollbar:h-2 scrollbar:w-2 flex-1 overflow-y-auto scrollbar-thumb:rounded-full scrollbar-track:rounded-full bg-bg-primary-alt scrollbar-thumb:bg-bg-quaternary scrollbar-track:bg-bg-primary p-3 pr-4 sm:mt-xs sm:p-4", onScroll: (e) => {
|
|
48
|
+
const { scrollTop, scrollHeight, clientHeight } = e.currentTarget;
|
|
49
|
+
if (Math.abs(scrollHeight - clientHeight - scrollTop) < 1) {
|
|
50
|
+
setHasReachedBottom(true);
|
|
51
|
+
}
|
|
52
|
+
}, children: [_jsx(Dialog.Description, { className: "text-xs leading-relaxed sm:text-sm sm:leading-2xl", children: content }), _jsx(Button, { type: "button", className: twMerge('absolute right-6 bottom-7 z-10 size-10 rounded-lg transition-colors duration-75 ease-in-out sm:right-6 sm:bottom-6 lg:right-8 lg:bottom-8', isAtBottom
|
|
53
|
+
? 'border border-[#CECFD2] bg-bg-secondary'
|
|
54
|
+
: 'bg-bg-brand-secondary'), onClick: () => {
|
|
55
|
+
if (scrollableContentRef.current) {
|
|
56
|
+
scrollableContentRef.current.scrollTo({
|
|
57
|
+
top: isAtBottom
|
|
58
|
+
? 0
|
|
59
|
+
: scrollableContentRef.current.scrollHeight,
|
|
60
|
+
behavior: 'smooth',
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}, children: isAtBottom ? _jsx(ScrollToTopIcon, {}) : _jsx(ScrollToBottomIcon, {}) })] }) })] }), _jsx(Dialog.Context, { children: (api) => (_jsx(Button, { type: "button", className: twMerge('mt-4 flex-1 py-2 text-sm sm:py-2.5 sm:text-base', hasReachedBottom
|
|
64
|
+
? 'bg-bg-brand-secondary'
|
|
65
|
+
: 'bg-bg-disabled text-text-disabled'), onClick: () => {
|
|
66
|
+
api.setOpen(false);
|
|
67
|
+
}, disabled: !hasReachedBottom, children: "Accept" })) })] }) })] }) }));
|
|
47
68
|
}
|
|
@@ -42,9 +42,9 @@ const DEPOSIT_TYPES_MAP = {
|
|
|
42
42
|
AIO_PAY_MAYA: 'AiO Maya',
|
|
43
43
|
AIO_GRAB_PAY: 'AiO Grab Pay',
|
|
44
44
|
AIO_PALAWAN_PAY: 'AiO Palawan Pay',
|
|
45
|
-
|
|
45
|
+
AURIX_PAY_QR_PH: 'Aurix QRPH',
|
|
46
46
|
AURIX_PAY_GCASH: 'Aurix GCash',
|
|
47
|
-
|
|
47
|
+
AURIX_PAY_PAY_MAYA: 'Aurix Maya',
|
|
48
48
|
AURIX_PAY_GRAB_PAY: 'Aurix GrabPay',
|
|
49
49
|
MAYA_WEBPAY: 'Maya WebPay',
|
|
50
50
|
TEST: 'Test',
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
4
|
+
import Image from 'next/image';
|
|
5
|
+
import { useRef, useState } from 'react';
|
|
6
|
+
import { Controller, useForm } from 'react-hook-form';
|
|
7
|
+
import z from 'zod';
|
|
8
|
+
import { useCooldown } from '../../client/hooks/useCooldown.js';
|
|
9
|
+
import { useLocaleInfo } from '../../client/hooks/useLocaleInfo.js';
|
|
10
|
+
import { useMobileNumberParser } from '../../client/hooks/useMobileNumberParser.js';
|
|
11
|
+
import { useSendVerificationCodeMutation } from '../../client/hooks/useSendVerificationCodeMutation.js';
|
|
12
|
+
import { useUpdateMobileNumber } from '../../client/hooks/useUpdateMobileNumber.js';
|
|
13
|
+
import { toaster } from '../../client/utils/toaster.js';
|
|
14
|
+
import { ArrowLeftIcon } from '../../icons/ArrowLeftIcon.js';
|
|
15
|
+
import inplayLogo from '../../images/inplay-logo.png';
|
|
16
|
+
import lightBg from '../../images/light-bg.png';
|
|
17
|
+
import { Button } from '../../ui/Button/index.js';
|
|
18
|
+
import { Dialog } from '../../ui/Dialog/index.js';
|
|
19
|
+
import { Field } from '../../ui/Field/index.js';
|
|
20
|
+
import { PinInput } from '../../ui/PinInput/index.js';
|
|
21
|
+
import { Portal } from '../../ui/Portal/index.js';
|
|
22
|
+
export function UpdateMobileNumber({ onClose }) {
|
|
23
|
+
const [step, setStep] = useState(1);
|
|
24
|
+
const sendVerificationCodeMutation = useSendVerificationCodeMutation({
|
|
25
|
+
onSuccess: () => {
|
|
26
|
+
setStep(2);
|
|
27
|
+
cooldown.start();
|
|
28
|
+
},
|
|
29
|
+
onError: (err) => {
|
|
30
|
+
toaster.error({
|
|
31
|
+
title: 'Sign In Failed',
|
|
32
|
+
description: err.message,
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
const updateMobileNumberMutation = useUpdateMobileNumber({
|
|
37
|
+
onSuccess: async () => {
|
|
38
|
+
step1Form.reset();
|
|
39
|
+
step2Form.reset();
|
|
40
|
+
setStep(1);
|
|
41
|
+
toaster.success({
|
|
42
|
+
title: 'Verification Successful',
|
|
43
|
+
description: 'Your mobile number has been verified.',
|
|
44
|
+
});
|
|
45
|
+
onClose?.();
|
|
46
|
+
},
|
|
47
|
+
onError: (err) => {
|
|
48
|
+
const errorMessage = err.name === 'Forbidden'
|
|
49
|
+
? 'Please enter the correct verification code'
|
|
50
|
+
: err.message;
|
|
51
|
+
toaster.error({
|
|
52
|
+
title: 'Sign In Failed',
|
|
53
|
+
description: errorMessage,
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
const localeInfo = useLocaleInfo();
|
|
58
|
+
const mobileNumberParser = useMobileNumberParser();
|
|
59
|
+
const Step1Definition = z.object({
|
|
60
|
+
mobileNumber: z
|
|
61
|
+
.string()
|
|
62
|
+
.min(1, 'Mobile number is required')
|
|
63
|
+
.superRefine((v, ctx) => {
|
|
64
|
+
if (!mobileNumberParser.validate(v)) {
|
|
65
|
+
ctx.addIssue({
|
|
66
|
+
code: z.ZodIssueCode.custom,
|
|
67
|
+
message: 'Invalid mobile number',
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}),
|
|
71
|
+
});
|
|
72
|
+
const Step2Definition = z.object({
|
|
73
|
+
verificationCode: z.array(z.string()).superRefine((val, ctx) => {
|
|
74
|
+
if (val.length !== 6 || val.some((v) => v.length !== 1)) {
|
|
75
|
+
ctx.addIssue({
|
|
76
|
+
code: z.ZodIssueCode.custom,
|
|
77
|
+
message: 'Please enter your 6-digit verification code.',
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}),
|
|
81
|
+
});
|
|
82
|
+
const step1Form = useForm({
|
|
83
|
+
resolver: zodResolver(Step1Definition),
|
|
84
|
+
defaultValues: {
|
|
85
|
+
mobileNumber: '',
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
const step2Form = useForm({
|
|
89
|
+
resolver: zodResolver(Step2Definition),
|
|
90
|
+
defaultValues: {
|
|
91
|
+
verificationCode: Array.from({ length: 6 }).fill(''),
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
const cooldown = useCooldown({
|
|
95
|
+
max: 60,
|
|
96
|
+
duration: 1000 * 60,
|
|
97
|
+
});
|
|
98
|
+
const formRef = useRef(null);
|
|
99
|
+
return (_jsx(Dialog.Root, { open: true, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { className: "flex items-center", children: _jsxs(Dialog.Content, { className: "flex w-[375px] flex-col items-center space-y-4 rounded-xl bg-[#111827] p-6 text-center", style: {
|
|
100
|
+
backgroundImage: `url(${lightBg.src})`,
|
|
101
|
+
}, children: [_jsx(Image, { src: inplayLogo, alt: "inplay logo", width: 82, height: 34, className: "h-auto w-[82px]" }), _jsxs("div", { children: [step === 1 && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "font-bold text-sm", children: ["Get ", _jsx("span", { className: "text-[#F05127]", children: "\u20B150 Bonus" }), " when you verify your account and play."] }), _jsxs("form", { className: "mt-3xl", onSubmit: step1Form.handleSubmit(async (data) => {
|
|
102
|
+
sendVerificationCodeMutation.mutateAsync({
|
|
103
|
+
channel: 'SMS',
|
|
104
|
+
recipient: mobileNumberParser.format(data.mobileNumber),
|
|
105
|
+
strict: true,
|
|
106
|
+
});
|
|
107
|
+
}), children: [_jsxs(Field.Root, { invalid: !!step1Form.formState.errors.mobileNumber, className: "text-left", children: [_jsx(Field.Label, { children: "Mobile Number" }), _jsxs("div", { className: "relative", children: [_jsx("div", { className: "-translate-y-1/2 absolute top-1/2 left-3.5 flex shrink-0 items-center gap-md", children: _jsx("span", { className: "text-text-placeholder", children: localeInfo.mobileNumber.areaCode }) }), _jsx(Field.Input, { style: {
|
|
108
|
+
paddingLeft: `calc(1.25rem + ${localeInfo.mobileNumber.areaCode.length}ch)`,
|
|
109
|
+
}, ...step1Form.register('mobileNumber') })] }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.mobileNumber?.message })] }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: step1Form.formState.isSubmitting, children: "Send Code" })] })] })), step === 2 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mt-xl text-center font-semibold text-lg", children: "Check your Phone" }), _jsxs("p", { className: "mt-xs text-center text-sm text-text-secondary-700", children: ["We\u2019ve sent a verification code to your mobile number", ' ', _jsx("span", { className: "font-semibold text-[#F05127]", children: mobileNumberParser.format(step1Form.getValues('mobileNumber')) }), ' ', "via text"] }), _jsxs("form", { ref: formRef, className: "mt-5", onSubmit: step2Form.handleSubmit(async ({ verificationCode }) => {
|
|
110
|
+
updateMobileNumberMutation.mutateAsync({
|
|
111
|
+
mobileNumber: mobileNumberParser.format(step1Form.getValues('mobileNumber')),
|
|
112
|
+
verificationCode: verificationCode.join(''),
|
|
113
|
+
});
|
|
114
|
+
}), children: [_jsx(Controller, { name: "verificationCode", control: step2Form.control, render: (o) => (_jsxs(Field.Root, { invalid: o.fieldState.invalid, children: [_jsxs(PinInput.Root, { placeholder: "0", onKeyDown: (e) => {
|
|
115
|
+
if (e.key === 'Backspace') {
|
|
116
|
+
step2Form.reset();
|
|
117
|
+
}
|
|
118
|
+
}, value: o.field.value, onValueChange: (details) => {
|
|
119
|
+
o.field.onChange(details.value);
|
|
120
|
+
o.field.onBlur();
|
|
121
|
+
}, otp: true, onValueComplete: () => {
|
|
122
|
+
formRef.current?.requestSubmit();
|
|
123
|
+
}, blurOnComplete: true, readOnly: step2Form.formState.isSubmitting, type: "numeric", children: [_jsxs(PinInput.Control, { className: "grid-cols-[1fr_1fr_1fr_auto_1fr_1fr_1fr] items-center gap-md", children: [_jsx(PinInput.Input, { index: 0 }), _jsx(PinInput.Input, { index: 1 }), _jsx(PinInput.Input, { index: 2 }), _jsx("span", { className: "font-medium text-2xl text-text-placeholder-subtle", children: "\u2013" }), _jsx(PinInput.Input, { index: 3 }), _jsx(PinInput.Input, { index: 4 }), _jsx(PinInput.Input, { index: 5 })] }), _jsx(PinInput.HiddenInput, {})] }), _jsx(Field.ErrorText, { children: o.fieldState.error?.message })] })) }), _jsx(Button, { type: "submit", className: "mt-4xl", disabled: step2Form.formState.isSubmitting, children: "Verify" }), _jsxs("div", { className: "mt-4 flex w-full items-center justify-center gap-xs text-xs", children: [_jsx("span", { className: "text-[#9CA3AF]", children: "Didn't receive the code?" }), _jsx("button", { type: "button", className: "font-semibold text-[#C084FC]", disabled: cooldown.cooling, onClick: async () => {
|
|
124
|
+
await sendVerificationCodeMutation.mutateAsync({
|
|
125
|
+
channel: 'SMS',
|
|
126
|
+
recipient: mobileNumberParser.format(step1Form.getValues('mobileNumber')),
|
|
127
|
+
});
|
|
128
|
+
cooldown.start();
|
|
129
|
+
}, children: cooldown.cooling
|
|
130
|
+
? `Resend in ${cooldown.countdown}s`
|
|
131
|
+
: 'Resend' })] }), _jsx("button", { type: "button", className: "absolute top-0 left-6 mx-auto mt-3xl flex h-8 w-8 items-center gap-1 rounded-full bg-[#1f2638] font-semibold text-sm text-text-tertiary-600", onClick: () => {
|
|
132
|
+
setStep(1);
|
|
133
|
+
step2Form.reset();
|
|
134
|
+
cooldown.stop();
|
|
135
|
+
}, children: _jsx(ArrowLeftIcon, { className: "mx-auto size-5" }) })] })] }))] })] }) })] }) }));
|
|
136
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './UpdateMobileNumber';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './UpdateMobileNumber.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
export function ScrollToBottomIcon(props) {
|
|
3
|
-
return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "10", height: "12", fill: "none", viewBox: "0 0 10 12", ...props, children: _jsx("path", { stroke: "#
|
|
3
|
+
return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "10", height: "12", fill: "none", viewBox: "0 0 10 12", ...props, children: _jsx("path", { stroke: "#fff", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.667", d: "M.833 6.833 5 11l4.167-4.167M.833 1 5 5.167 9.167 1" }) }));
|
|
4
4
|
}
|