@opexa/portal-components 0.0.921 → 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.
Files changed (46) hide show
  1. package/dist/client/hooks/useUpdateMobileNumber.d.ts +3 -0
  2. package/dist/client/hooks/useUpdateMobileNumber.js +20 -0
  3. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts +2 -2
  4. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts +1 -1
  5. package/dist/components/ResponsibleGaming/ResponsibleGamingV2.lazy.js +1 -1
  6. package/dist/components/TermsOfUse/TermsOfUseV2.lazy.js +1 -1
  7. package/dist/components/TransactionRecords/TableFilters.js +2 -2
  8. package/dist/components/UpdateMobileNumber/UpdateMobileNumber.d.ts +3 -0
  9. package/dist/components/UpdateMobileNumber/UpdateMobileNumber.js +136 -0
  10. package/dist/components/UpdateMobileNumber/index.d.ts +1 -0
  11. package/dist/components/UpdateMobileNumber/index.js +1 -0
  12. package/dist/services/account.d.ts +21 -0
  13. package/dist/services/account.js +11 -1
  14. package/dist/services/queries.d.ts +1 -0
  15. package/dist/services/queries.js +14 -0
  16. package/dist/types/index.d.ts +1 -1
  17. package/dist/ui/AlertDialog/AlertDialog.d.ts +121 -121
  18. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +11 -11
  19. package/dist/ui/Carousel/Carousel.d.ts +45 -45
  20. package/dist/ui/Carousel/carousel.recipe.d.ts +5 -5
  21. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  22. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  23. package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
  24. package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
  25. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  26. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  27. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  28. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  29. package/dist/ui/Dialog/Dialog.d.ts +33 -33
  30. package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
  31. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  32. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  33. package/dist/ui/Menu/Menu.d.ts +90 -90
  34. package/dist/ui/Menu/menu.recipe.d.ts +5 -5
  35. package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
  36. package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
  37. package/dist/ui/Select/Select.d.ts +45 -45
  38. package/dist/ui/Select/select.recipe.d.ts +3 -3
  39. package/dist/ui/Table/Table.d.ts +21 -21
  40. package/dist/ui/Table/table.anatomy.d.ts +1 -1
  41. package/dist/ui/Table/table.recipe.d.ts +3 -3
  42. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  43. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  44. package/dist/utils/mutationKeys.d.ts +1 -0
  45. package/dist/utils/mutationKeys.js +8 -1
  46. package/package.json +1 -1
@@ -0,0 +1,3 @@
1
+ import { type UpdateMobileNumberInput } from '../../services/account';
2
+ import type { Mutation } from '../../types';
3
+ export declare const useUpdateMobileNumber: Mutation<void, UpdateMobileNumberInput>;
@@ -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
+ };
@@ -1,7 +1,7 @@
1
1
  export declare const OnlineBankDepositContext: (props: {
2
2
  value: {
3
3
  view: "form" | "vca";
4
- status: "failed" | "waiting" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
4
+ status: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
5
5
  verify: () => void;
6
6
  reset: () => void;
7
7
  deposit: import("../../../../types").Deposit | null;
@@ -14,7 +14,7 @@ export declare const OnlineBankDepositContext: (props: {
14
14
  children?: import("react").ReactNode | undefined;
15
15
  }) => React.ReactNode, useOnlineBankDepositContext: () => {
16
16
  view: "form" | "vca";
17
- status: "failed" | "waiting" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
17
+ status: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
18
18
  verify: () => void;
19
19
  reset: () => void;
20
20
  deposit: import("../../../../types").Deposit | null;
@@ -2,7 +2,7 @@ import type { Deposit } from '../../../../types';
2
2
  export type UseOnlineBankDepositReturn = ReturnType<typeof useOnlineBankDeposit>;
3
3
  export declare function useOnlineBankDeposit(): {
4
4
  view: "form" | "vca";
5
- status: "failed" | "waiting" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
5
+ status: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
6
6
  verify: () => void;
7
7
  reset: () => void;
8
8
  deposit: Deposit | null;
@@ -44,7 +44,7 @@ export function ResponsibleGamingV2(props) {
44
44
  globalStore.disclaimer.setOpen(true);
45
45
  }
46
46
  globalStore.responsibleGaming.setNext(null);
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-[#021C25] 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-[#021C25] scrollbar-thumb:bg-bg-quaternary scrollbar-track:bg-bg-primary p-3 pr-4 sm:mt-xs sm:p-4", onScroll: (e) => {
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
48
  const { scrollTop, scrollHeight, clientHeight } = e.currentTarget;
49
49
  const atBottom = Math.abs(scrollHeight - clientHeight - scrollTop) < 1;
50
50
  setIsAtBottom(atBottom);
@@ -44,7 +44,7 @@ export function TermsOfUseV2({ logo, siteName, content, ...props }) {
44
44
  globalStore.disclaimer.setOpen(true);
45
45
  }
46
46
  globalStore.termsOfUse.setNext(null);
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: 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-[#021C25] 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-[#021C25] scrollbar-thumb:bg-bg-quaternary scrollbar-track:bg-bg-primary p-3 pr-4 sm:mt-xs sm:p-4", onScroll: (e) => {
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
48
  const { scrollTop, scrollHeight, clientHeight } = e.currentTarget;
49
49
  if (Math.abs(scrollHeight - clientHeight - scrollTop) < 1) {
50
50
  setHasReachedBottom(true);
@@ -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
- AURIX_PAY_QRPH: 'Aurix QRPH',
45
+ AURIX_PAY_QR_PH: 'Aurix QRPH',
46
46
  AURIX_PAY_GCASH: 'Aurix GCash',
47
- AURIX_PAY_PAYMAYA: 'Aurix Maya',
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,3 @@
1
+ export declare function UpdateMobileNumber({ onClose }: {
2
+ onClose?: () => void;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -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';
@@ -231,6 +231,27 @@ export interface VerifyMobileNumberMutationVariables {
231
231
  };
232
232
  }
233
233
  export declare const verifyMobileNumber: (verificationCode: string, options?: GraphQLRequestOptions) => Promise<void>;
234
+ export type UpdateMobileNumberError = {
235
+ name: 'InvalidSMSVerificationCodeError';
236
+ message: string;
237
+ } | {
238
+ name: 'MobileNumberNotAvailableError';
239
+ message: string;
240
+ };
241
+ export interface UpdateMobileNumberMutation {
242
+ updateMobileNumber?: null | UpdateMobileNumberError;
243
+ }
244
+ export type UpdateMobileNumberInput = {
245
+ mobileNumber: string;
246
+ verificationCode: string;
247
+ };
248
+ export interface UpdateMobileNumberMutationVariables {
249
+ input: {
250
+ mobileNumber: string;
251
+ verificationCode: string;
252
+ };
253
+ }
254
+ export declare const updateMobileNumber: (mobileNumber: string, verificationCode: string, options?: GraphQLRequestOptions) => Promise<void>;
234
255
  export type CreateMemberVerificationError = {
235
256
  name: 'FileDoesNotExistError';
236
257
  message: string;
@@ -1,7 +1,7 @@
1
1
  import { cache } from 'react';
2
2
  import { ACCOUNT_GRAPHQL_ENDPOINT } from '../constants/index.js';
3
3
  import { graphqlRequest } from './graphqlRequest.js';
4
- import { ANNOUNCEMENTS, APPROVE_MEMBER_VERIFICATION__NEXT, CREATE_MEMBER_VERIFICATION, CREATE_MEMBER_VERIFICATION__NEXT, DELETE_MEMBER_ACCOUNT, FACEBOOK_CLIENT_ID, GENERATE_SUMSUB_VERIFICATION_TOKEN, GOOGLE_CLIENT_ID, MEMBER_ACCOUNT, MEMBER_VERIFICATION, PAYMENT_SETTINGS, POINTS_CLUB_SETTINGS, PROFILE_COMPLETION, REFERRAL_CODE, REGISTER_MAYA_MEMBER_ACCOUNT, REGISTER_MEMBER_ACCOUNT, REGISTER_MEMBER_ACCOUNT__NEXT, REGISTER_MEMBER_ACCOUNT_BY_MOBILE_NUMBER, REGISTER_MEMBER_ACCOUNT_BY_NAME, REGISTER_MEMBER_ACCOUNT_VIA_MOBILE, REQUIRE_FIRST_DEPOSIT, RESET_PASSWORD, UNLINK_FACEBOOK, UNLINK_GOOGLE, UPDATE_MEMBER_ACCOUNT, UPDATE_MEMBER_VERIFICATION, UPDATE_MEMBER_VERIFICATION__NEXT, UPDATE_REFERRAL_CODE, VERIFY_MOBILE_NUMBER, } from './queries.js';
4
+ import { ANNOUNCEMENTS, APPROVE_MEMBER_VERIFICATION__NEXT, CREATE_MEMBER_VERIFICATION, CREATE_MEMBER_VERIFICATION__NEXT, DELETE_MEMBER_ACCOUNT, FACEBOOK_CLIENT_ID, GENERATE_SUMSUB_VERIFICATION_TOKEN, GOOGLE_CLIENT_ID, MEMBER_ACCOUNT, MEMBER_VERIFICATION, PAYMENT_SETTINGS, POINTS_CLUB_SETTINGS, PROFILE_COMPLETION, REFERRAL_CODE, REGISTER_MAYA_MEMBER_ACCOUNT, REGISTER_MEMBER_ACCOUNT, REGISTER_MEMBER_ACCOUNT__NEXT, REGISTER_MEMBER_ACCOUNT_BY_MOBILE_NUMBER, REGISTER_MEMBER_ACCOUNT_BY_NAME, REGISTER_MEMBER_ACCOUNT_VIA_MOBILE, REQUIRE_FIRST_DEPOSIT, RESET_PASSWORD, UNLINK_FACEBOOK, UNLINK_GOOGLE, UPDATE_MEMBER_ACCOUNT, UPDATE_MEMBER_VERIFICATION, UPDATE_MEMBER_VERIFICATION__NEXT, UPDATE_MOBILE_NUMBER, UPDATE_REFERRAL_CODE, VERIFY_MOBILE_NUMBER, } from './queries.js';
5
5
  import { sha256 } from './sha256.js';
6
6
  export const getMemberAccount = cache(async (options) => {
7
7
  const res = await graphqlRequest(ACCOUNT_GRAPHQL_ENDPOINT, MEMBER_ACCOUNT, undefined, options);
@@ -166,6 +166,16 @@ export const verifyMobileNumber = async (verificationCode, options) => {
166
166
  throw error;
167
167
  }
168
168
  };
169
+ export const updateMobileNumber = async (mobileNumber, verificationCode, options) => {
170
+ const res = await graphqlRequest(ACCOUNT_GRAPHQL_ENDPOINT, UPDATE_MOBILE_NUMBER, { input: { mobileNumber, verificationCode } }, options);
171
+ if (res.updateMobileNumber) {
172
+ const error = new Error();
173
+ error.name = res.updateMobileNumber.name;
174
+ error.message = ERROR_CODES_MESSAGE_MAP[res.updateMobileNumber.name];
175
+ Error.captureStackTrace?.(error, updateMobileNumber);
176
+ throw error;
177
+ }
178
+ };
169
179
  export const createMemberVerification = async (input, options) => {
170
180
  const res = await graphqlRequest(ACCOUNT_GRAPHQL_ENDPOINT, CREATE_MEMBER_VERIFICATION, { input }, options);
171
181
  if (res.createMemberVerification) {
@@ -88,6 +88,7 @@ export declare const UPDATE_MEMBER_ACCOUNT = "\n mutation UpdateMemberAccount($
88
88
  export declare const RESET_PASSWORD = "\n mutation ResetPassword(\n $input: ResetPasswordInput!\n $verificationCode: String\n ) {\n resetPassword(input: $input, verificationCode: $verificationCode) {\n ... on AccountNotFoundError {\n name: __typename\n message\n }\n ... on InvalidVerificationCodeError {\n name: __typename\n message\n }\n }\n }\n";
89
89
  export declare const DELETE_MEMBER_ACCOUNT = "\n mutation DeleteMemberAccount($input: DeleteMemberAccountInput!) {\n deleteMemberAccount(input: $input)\n }\n";
90
90
  export declare const VERIFY_MOBILE_NUMBER = "\n mutation VerifyMobileNumber($input: VerifyMobileNumberInput!) {\n verifyMobileNumber(input: $input) {\n ... on InvalidSMSVerificationCodeError {\n name: __typename\n message\n }\n ... on MobileNumberAlreadyVerifiedError {\n name: __typename\n message\n }\n }\n }\n";
91
+ export declare const UPDATE_MOBILE_NUMBER = "\n mutation UpdateMobileNumber($input: UpdateMobileNumberInput!) {\n updateMobileNumber(input: $input) {\n ... on InvalidSMSVerificationCodeError {\n name: __typename\n message\n }\n ... on MobileNumberNotAvailableError {\n name: __typename\n message\n }\n }\n }\n";
91
92
  export declare const CREATE_MEMBER_VERIFICATION = "\n mutation CreateMemberVerification($input: CreateMemberVerificationInput!) {\n createMemberVerification(input: $input) {\n ... on FileDoesNotExistError {\n name: __typename\n message\n }\n ... on FileNotReadyError {\n name: __typename\n message\n }\n ... on MemberVerificationAlreadyExistsError {\n name: __typename\n message\n }\n }\n }\n";
92
93
  export declare const CREATE_MEMBER_VERIFICATION__NEXT = "\n mutation CreateMemberVerification(\n $input: CreateMemberVerificationInput_next!\n ) {\n createMemberVerification: createMemberVerification_next(input: $input) {\n ... on FileDoesNotExistError {\n name: __typename\n message\n }\n ... on FileNotReadyError {\n name: __typename\n message\n }\n ... on MemberVerificationAlreadyExistsError {\n name: __typename\n message\n }\n }\n }\n";
93
94
  export declare const UPDATE_MEMBER_VERIFICATION = "\n mutation UpdateMemberVerification($input: UpdateMemberVerificationInput!) {\n updateMemberVerification(input: $input) {\n ... on FileDoesNotExistError {\n name: __typename\n message\n }\n ... on FileNotReadyError {\n name: __typename\n message\n }\n ... on MemberVerificationAlreadyApprovedError {\n name: __typename\n message\n }\n ... on MemberVerificationDoesNotExistError {\n name: __typename\n message\n }\n }\n }\n";
@@ -2375,6 +2375,20 @@ export const VERIFY_MOBILE_NUMBER = /* GraphQL */ `
2375
2375
  }
2376
2376
  }
2377
2377
  `;
2378
+ export const UPDATE_MOBILE_NUMBER = /* GraphQL */ `
2379
+ mutation UpdateMobileNumber($input: UpdateMobileNumberInput!) {
2380
+ updateMobileNumber(input: $input) {
2381
+ ... on InvalidSMSVerificationCodeError {
2382
+ name: __typename
2383
+ message
2384
+ }
2385
+ ... on MobileNumberNotAvailableError {
2386
+ name: __typename
2387
+ message
2388
+ }
2389
+ }
2390
+ }
2391
+ `;
2378
2392
  export const CREATE_MEMBER_VERIFICATION = /* GraphQL */ `
2379
2393
  mutation CreateMemberVerification($input: CreateMemberVerificationInput!) {
2380
2394
  createMemberVerification(input: $input) {
@@ -255,7 +255,7 @@ export interface LatestBetRecord {
255
255
  dateTimeSettled: string;
256
256
  dateTimeCreated: string;
257
257
  }
258
- export type DepositType = 'BANK' | 'GCASH' | 'MANUAL' | 'MAYA' | 'MAYA_APP' | 'MAYA_WEBPAY' | 'QR_PH' | 'ONLINE_BANK' | 'MANUAL_BANK' | 'MANUAL_UPI' | 'PISO_PAY_CHECKOUT' | 'AIO_GCASH' | 'AIO_PAY_MAYA' | 'AIO_GRAB_PAY' | 'AIO_PALAWAN_PAY' | 'LIBANGAN_PAY_IN' | 'AURIX_PAY_QRPH' | 'AURIX_PAY_GCASH' | 'AURIX_PAY_PAYMAYA' | 'AURIX_PAY_GRAB_PAY' | 'TEST';
258
+ export type DepositType = 'BANK' | 'GCASH' | 'MANUAL' | 'MAYA' | 'MAYA_APP' | 'MAYA_WEBPAY' | 'QR_PH' | 'ONLINE_BANK' | 'MANUAL_BANK' | 'MANUAL_UPI' | 'PISO_PAY_CHECKOUT' | 'AIO_GCASH' | 'AIO_PAY_MAYA' | 'AIO_GRAB_PAY' | 'AIO_PALAWAN_PAY' | 'LIBANGAN_PAY_IN' | 'AURIX_PAY_QR_PH' | 'AURIX_PAY_GCASH' | 'AURIX_PAY_PAY_MAYA' | 'AURIX_PAY_GRAB_PAY' | 'TEST';
259
259
  export type DepositStatus = 'PENDING' | 'ACCEPTED' | 'APPROVED' | 'REJECTED' | 'CONFIRMED' | 'CANCELLED' | 'FAILED';
260
260
  export type KnownDepositError = 'INSUFFICIENT_BALANCE' | 'DEPOSIT_CREATION_REQUEST_FAILED' | 'DEPOSIT_EXECUTION_REQUEST_FAILED' | 'REQUEST_SESSION_EXPIRED' | 'REQUEST_TIMEOUT' | 'SYSTEM_CANCELLATION' | 'UNEXPECTED_ERROR' | 'FAILED_TO_PROCESS_PAYMENT' | 'MINIMUM_DEPOSIT_AMOUNT_NOT_MET' | 'UNTOUCHED';
261
261
  export interface DepositRecord {