@opexa/portal-components 0.0.531 → 0.0.533

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 (84) hide show
  1. package/dist/client/hooks/useSignUpByNameMutation.d.ts +5 -0
  2. package/dist/client/hooks/useSignUpByNameMutation.js +33 -0
  3. package/dist/components/SignIn/SignIn.lazy.d.ts +2 -1
  4. package/dist/components/SignIn/SignIn.lazy.js +1 -1
  5. package/dist/components/SignIn/SignInMethod.js +1 -1
  6. package/dist/components/SignIn/useSignIn.d.ts +6 -4
  7. package/dist/components/SignIn/useSignIn.js +2 -2
  8. package/dist/components/SignUp/SignUp.d.ts +2 -1
  9. package/dist/components/SignUp/SignUp.js +7 -0
  10. package/dist/components/SignUp/SignUpNameAndPassword/SignUpNameAndPassword.lazy.d.ts +22 -0
  11. package/dist/components/SignUp/SignUpNameAndPassword/SignUpNameAndPassword.lazy.js +25 -0
  12. package/dist/components/SignUp/SignUpNameAndPassword/SignUpNameAndPasswordContext.d.ts +6 -0
  13. package/dist/components/SignUp/SignUpNameAndPassword/SignUpNameAndPasswordContext.js +2 -0
  14. package/dist/components/SignUp/SignUpNameAndPassword/SignUpNameAndPasswordForm.d.ts +1 -0
  15. package/dist/components/SignUp/SignUpNameAndPassword/SignUpNameAndPasswordForm.js +283 -0
  16. package/dist/constants/EnvVar.d.ts +1 -1
  17. package/dist/services/account.d.ts +6 -1
  18. package/dist/services/account.js +8 -3
  19. package/dist/ui/AlertDialog/AlertDialog.d.ts +88 -88
  20. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +8 -8
  21. package/dist/ui/Badge/Badge.d.ts +12 -12
  22. package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
  23. package/dist/ui/Badge/badge.recipe.d.ts +3 -3
  24. package/dist/ui/Carousel/Carousel.d.ts +45 -45
  25. package/dist/ui/Carousel/carousel.recipe.d.ts +5 -5
  26. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  27. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  28. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  29. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  30. package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
  31. package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
  32. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  33. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  34. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  35. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  36. package/dist/ui/Dialog/Dialog.d.ts +33 -33
  37. package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
  38. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  39. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  40. package/dist/ui/Menu/Menu.d.ts +306 -306
  41. package/dist/ui/Menu/menu.recipe.d.ts +17 -17
  42. package/dist/ui/NumberInput/NumberInput.d.ts +24 -24
  43. package/dist/ui/NumberInput/numberInput.recipe.d.ts +3 -3
  44. package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
  45. package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
  46. package/dist/ui/Popover/Popover.d.ts +55 -55
  47. package/dist/ui/Popover/popover.recipe.d.ts +5 -5
  48. package/dist/ui/Progress/Progress.d.ts +27 -27
  49. package/dist/ui/Progress/progress.recipe.d.ts +3 -3
  50. package/dist/ui/QrCode/QrCode.d.ts +40 -40
  51. package/dist/ui/QrCode/qrCode.recipe.d.ts +8 -8
  52. package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
  53. package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
  54. package/dist/ui/Select/Select.d.ts +45 -45
  55. package/dist/ui/Select/select.recipe.d.ts +3 -3
  56. package/dist/ui/Table/Table.d.ts +21 -21
  57. package/dist/ui/Table/table.anatomy.d.ts +1 -1
  58. package/dist/ui/Table/table.recipe.d.ts +3 -3
  59. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  60. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  61. package/package.json +1 -1
  62. package/dist/components/AccountInfo/GoogleDisconnect.d.ts +0 -7
  63. package/dist/components/AccountInfo/GoogleDisconnect.js +0 -11
  64. package/dist/components/DigitainLauncher/Loading.d.ts +0 -1
  65. package/dist/components/DigitainLauncher/Loading.js +0 -5
  66. package/dist/components/KYC/BasicInformation.d.ts +0 -1
  67. package/dist/components/KYC/BasicInformation.js +0 -101
  68. package/dist/components/KYC/IdentityVerification.d.ts +0 -1
  69. package/dist/components/KYC/IdentityVerification.js +0 -120
  70. package/dist/components/KYC/Indicator.d.ts +0 -1
  71. package/dist/components/KYC/Indicator.js +0 -8
  72. package/dist/components/KYC/KYC.lazy.d.ts +0 -6
  73. package/dist/components/KYC/KYC.lazy.js +0 -45
  74. package/dist/components/KYC/KYCContext.d.ts +0 -6
  75. package/dist/components/KYC/KYCContext.js +0 -2
  76. package/dist/components/KYC/PersonalInformation.d.ts +0 -1
  77. package/dist/components/KYC/PersonalInformation.js +0 -122
  78. package/dist/components/KYC/useKYC.d.ts +0 -25
  79. package/dist/components/KYC/useKYC.js +0 -38
  80. package/dist/components/PortalProvider/CXDTokenObserver.d.ts +0 -1
  81. package/dist/components/PortalProvider/CXDTokenObserver.js +0 -30
  82. package/dist/icons/LinkBrokenIcon.d.ts +0 -2
  83. package/dist/icons/LinkBrokenIcon.js +0 -4
  84. package/dist/images/responsible-gaming-yellow.png +0 -0
@@ -0,0 +1,5 @@
1
+ import { type RegisterMemberAccountByNameInput } from '../../services/account';
2
+ import type { Mutation } from '../../types';
3
+ export interface SignUpByNameMutationInput extends Omit<RegisterMemberAccountByNameInput, 'reCAPTCHAResponse' | 'cellxpertCxd'> {
4
+ }
5
+ export declare const useSignUpByNameMutation: Mutation<void, SignUpByNameMutationInput>;
@@ -0,0 +1,33 @@
1
+ import { useMutation } from '@tanstack/react-query';
2
+ import { useReCaptcha } from 'next-recaptcha-v3';
3
+ import { registerMemberAccountByName, } from '../../services/account.js';
4
+ import { getSignUpMutationKey } from '../../utils/mutationKeys.js';
5
+ import { getSession } from '../services/getSession.js';
6
+ import { useCellxpertCxd } from './useCellxpertCxd.js';
7
+ export const useSignUpByNameMutation = (config) => {
8
+ const recaptcha = useReCaptcha();
9
+ const [cellxpertCxd] = useCellxpertCxd();
10
+ return useMutation({
11
+ ...config,
12
+ mutationKey: getSignUpMutationKey(),
13
+ mutationFn: async (input) => {
14
+ const session = await getSession();
15
+ const reCAPTCHAResponse = recaptcha.reCaptchaKey
16
+ ? await recaptcha.executeRecaptcha('submit')
17
+ : '';
18
+ return await registerMemberAccountByName({
19
+ ...input,
20
+ ...(cellxpertCxd && {
21
+ cellxpertCxd: cellxpertCxd.value,
22
+ }),
23
+ reCAPTCHAResponse,
24
+ }, {
25
+ headers: {
26
+ ...(session.domain && {
27
+ Domain: session.domain,
28
+ }),
29
+ },
30
+ });
31
+ },
32
+ });
33
+ };
@@ -1,11 +1,12 @@
1
1
  import { type ImageProps } from 'next/image';
2
2
  import type { ReactNode } from 'react';
3
+ import { type UseSignInProps } from './useSignIn';
3
4
  export interface ClassNameEntries {
4
5
  root?: string;
5
6
  publicPlayProhibitionRoot?: string;
6
7
  publicPlayProhibitionLogoContainer?: string;
7
8
  }
8
- export interface SignInProps {
9
+ export interface SignInProps extends UseSignInProps {
9
10
  logo: ImageProps['src'];
10
11
  pagcorLogo?: ImageProps['src'];
11
12
  responsibleGamingLogo?: ImageProps['src'];
@@ -11,7 +11,7 @@ import { SignInPropsProvider, SignInProvider } from './SignInContext.js';
11
11
  import { SignInForm } from './SignInForm.js';
12
12
  import { useSignIn } from './useSignIn.js';
13
13
  export function SignIn(props) {
14
- const signIn = useSignIn();
14
+ const signIn = useSignIn(props);
15
15
  const signInStore = useGlobalStore(useShallow((ctx) => ctx.signIn));
16
16
  const globalStore = useGlobalStore(useShallow((ctx) => ({
17
17
  termsAndConditions: ctx.termsAndConditions,
@@ -8,7 +8,7 @@ const METHODS = [
8
8
  ];
9
9
  const METHOD_LABEL_MAP = {
10
10
  MOBILE_NUMBER: 'Mobile',
11
- NAME_AND_PASSWORD: 'Username',
11
+ NAME_AND_PASSWORD: 'Name',
12
12
  };
13
13
  export function SignInMethod() {
14
14
  const context = useSignInContext();
@@ -1,10 +1,12 @@
1
- type SignInStep = 1 | 2 | (number & {});
2
- type SignInType = 'NAME_AND_PASSWORD' | 'MOBILE_NUMBER';
1
+ export type SignInStep = 1 | 2 | (number & {});
2
+ export type SignInType = 'NAME_AND_PASSWORD' | 'MOBILE_NUMBER';
3
+ export interface UseSignInProps {
4
+ defaultType?: SignInType;
5
+ }
3
6
  export interface UseSignInReturn {
4
7
  step: SignInStep;
5
8
  setStep: (step: SignInStep) => void;
6
9
  type: SignInType;
7
10
  setType: (type: SignInType) => void;
8
11
  }
9
- export declare function useSignIn(): UseSignInReturn;
10
- export {};
12
+ export declare function useSignIn(props?: UseSignInProps): UseSignInReturn;
@@ -1,7 +1,7 @@
1
1
  import { useState } from 'react';
2
- export function useSignIn() {
2
+ export function useSignIn(props) {
3
3
  const [step, setStep] = useState(1);
4
- const [type, setType] = useState('MOBILE_NUMBER');
4
+ const [type, setType] = useState(props?.defaultType ?? 'MOBILE_NUMBER');
5
5
  return {
6
6
  step,
7
7
  setStep,
@@ -1,4 +1,5 @@
1
1
  import type { SignUpDefaultProps } from './SignUpDefault/SignUpDefault.lazy';
2
2
  import type { SignUpKYCProps } from './SignUpKYC/SignUpKYC.lazy';
3
- export type SignUpProps = SignUpDefaultProps | SignUpKYCProps;
3
+ import type { SignUpNameAndPasswordProps } from './SignUpNameAndPassword/SignUpNameAndPassword.lazy';
4
+ export type SignUpProps = SignUpDefaultProps | SignUpKYCProps | SignUpNameAndPasswordProps;
4
5
  export declare function SignUp(props: SignUpProps): import("react/jsx-runtime").JSX.Element | null;
@@ -11,6 +11,10 @@ const SignUpKYC = dynamic(() => import('./SignUpKYC/SignUpKYC.lazy.js').then((m)
11
11
  ssr: false,
12
12
  loading: () => null,
13
13
  });
14
+ const SignUpNameAndPassword = dynamic(() => import('./SignUpNameAndPassword/SignUpNameAndPassword.lazy.js').then((m) => m.SignUpNameAndPassword), {
15
+ ssr: false,
16
+ loading: () => null,
17
+ });
14
18
  export function SignUp(props) {
15
19
  const touched = useGlobalStore(useShallow((ctx) => ctx.signUp['~touched']));
16
20
  if (!touched) {
@@ -19,6 +23,9 @@ export function SignUp(props) {
19
23
  else if (props.layout === 'kyc') {
20
24
  return _jsx(SignUpKYC, { ...props });
21
25
  }
26
+ else if (props.layout === 'nameAndPassword') {
27
+ return _jsx(SignUpNameAndPassword, { ...props });
28
+ }
22
29
  else {
23
30
  return _jsx(SignUpDefault, { ...props });
24
31
  }
@@ -0,0 +1,22 @@
1
+ import { type ImageProps } from 'next/image';
2
+ import { type ReactNode } from 'react';
3
+ import type { Branch } from '../../../types';
4
+ export interface ClassNameEntries {
5
+ root?: string;
6
+ publicPlayProhibitionRoot?: string;
7
+ publicPlayProhibitionLogoContainer?: string;
8
+ }
9
+ export interface SignUpNameAndPasswordProps {
10
+ layout: 'nameAndPassword';
11
+ logo: ImageProps['src'];
12
+ branches?: Branch[];
13
+ termsAndConditionsUrl?: string;
14
+ responsibleGamingUrl?: string;
15
+ className?: ClassNameEntries;
16
+ children?: ReactNode;
17
+ showPublicPlayProhibition?: boolean;
18
+ pagcorLogo?: ImageProps['src'];
19
+ responsibleGamingLogo?: ImageProps['src'];
20
+ isRegulated?: boolean;
21
+ }
22
+ export declare function SignUpNameAndPassword(props: SignUpNameAndPasswordProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,25 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import Image, {} from 'next/image';
4
+ import { Suspense } from 'react';
5
+ import { twMerge } from 'tailwind-merge';
6
+ import { useShallow } from 'zustand/shallow';
7
+ import { useGlobalStore } from '../../../client/hooks/useGlobalStore.js';
8
+ import { XIcon } from '../../../icons/XIcon.js';
9
+ import { Dialog } from '../../../ui/Dialog/index.js';
10
+ import { Portal } from '../../../ui/Portal/index.js';
11
+ import { SignUpNameAndPasswordPropsProvider } from './SignUpNameAndPasswordContext.js';
12
+ import { SignUpNameAndPasswordForm } from './SignUpNameAndPasswordForm.js';
13
+ export function SignUpNameAndPassword(props) {
14
+ const signUpStore = useGlobalStore(useShallow((ctx) => ctx.signUp));
15
+ const globalStore = useGlobalStore(useShallow((ctx) => ({
16
+ termsAndConditions: ctx.termsAndConditions,
17
+ responsibleGaming: ctx.responsibleGaming,
18
+ })));
19
+ return (_jsx(SignUpNameAndPasswordPropsProvider, { value: props, children: _jsx(Dialog.Root, { open: signUpStore.open, onOpenChange: (details) => {
20
+ signUpStore.setOpen(details.open);
21
+ }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: () => {
22
+ globalStore.termsAndConditions.setAccepted(false);
23
+ globalStore.responsibleGaming.setAccepted(false);
24
+ }, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: twMerge('mx-auto h-full w-full items-start overflow-y-auto bg-bg-primary-alt p-3xl pb-4xl lg:h-auto lg:max-h-[80vh] lg:w-[400px] lg:rounded-xl', 'scrollbar:h-2 scrollbar:w-2 scrollbar-thumb:rounded-full scrollbar-thumb:bg-bg-quaternary scrollbar-track:bg-transparent', props.className?.root), style: { msOverflowStyle: 'none', scrollbarWidth: 'none' }, children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsx(Image, { src: props.logo, alt: "", width: 200, height: 100, className: "mx-auto h-auto w-[120px]", draggable: false }), _jsx(Suspense, { children: _jsx(SignUpNameAndPasswordForm, {}) })] }) })] }) }) }));
25
+ }
@@ -0,0 +1,6 @@
1
+ import type { SignUpNameAndPasswordProps } from './SignUpNameAndPassword.lazy';
2
+ export declare const SignUpNameAndPasswordPropsProvider: (props: {
3
+ value: SignUpNameAndPasswordProps;
4
+ } & {
5
+ children?: import("react").ReactNode | undefined;
6
+ }) => React.ReactNode, useSignUpNameAndPasswordPropsContext: () => SignUpNameAndPasswordProps;
@@ -0,0 +1,2 @@
1
+ import { createContext } from '../../../client/utils/createContext.js';
2
+ export const [SignUpNameAndPasswordPropsProvider, useSignUpNameAndPasswordPropsContext,] = createContext();
@@ -0,0 +1 @@
1
+ export declare function SignUpNameAndPasswordForm(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,283 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { createListCollection, parseDate } from '@ark-ui/react';
4
+ import { zodResolver } from '@hookform/resolvers/zod';
5
+ import { ObjectId } from '@opexa/object-id';
6
+ import { differenceInYears, format } from 'date-fns';
7
+ import Image from 'next/image';
8
+ import { useRouter } from 'next/navigation';
9
+ import { Controller, useForm } from 'react-hook-form';
10
+ import { twMerge } from 'tailwind-merge';
11
+ import { z } from 'zod';
12
+ import { useShallow } from 'zustand/shallow';
13
+ import { useControllableState } from '../../../client/hooks/useControllableState.js';
14
+ import { useGlobalStore } from '../../../client/hooks/useGlobalStore.js';
15
+ import { useSignInMutation } from '../../../client/hooks/useSignInMutation.js';
16
+ import { useSignUpByNameMutation } from '../../../client/hooks/useSignUpByNameMutation.js';
17
+ import { toaster } from '../../../client/utils/toaster.js';
18
+ import { CalendarIcon } from '../../../icons/CalendarIcon.js';
19
+ import { CheckIcon } from '../../../icons/CheckIcon.js';
20
+ import { ChevronDownIcon } from '../../../icons/ChevronDownIcon.js';
21
+ import { ChevronLeftIcon } from '../../../icons/ChevronLeftIcon.js';
22
+ import { ChevronRightIcon } from '../../../icons/ChevronRightIcon.js';
23
+ import { HelpCircleIcon } from '../../../icons/HelpCircleIcon.js';
24
+ import pagcorLogo from '../../../images/pagcor-round-icon.png';
25
+ import responsibleGamingLogo from '../../../images/responsible-gaming-gold.png';
26
+ import { ObjectType } from '../../../services/ObjectType.js';
27
+ import { Button } from '../../../ui/Button/index.js';
28
+ import { Checkbox } from '../../../ui/Checkbox/index.js';
29
+ import { DatePicker } from '../../../ui/DatePicker/index.js';
30
+ import { Field } from '../../../ui/Field/index.js';
31
+ import { Select } from '../../../ui/Select/index.js';
32
+ import { Tooltip } from '../../../ui/Tooltip/index.js';
33
+ import { createPoll } from '../../../utils/createPoll.js';
34
+ import { useSignUpNameAndPasswordPropsContext } from './SignUpNameAndPasswordContext.js';
35
+ export function SignUpNameAndPasswordForm() {
36
+ const signUpProps = useSignUpNameAndPasswordPropsContext();
37
+ const signInMutation = useSignInMutation();
38
+ const signUpMutation = useSignUpByNameMutation();
39
+ const branchCollection = createListCollection({
40
+ items: signUpProps.branches ?? [],
41
+ itemToValue: (item) => item.code,
42
+ itemToString: (item) => `${item.code} - ${item.name}`,
43
+ });
44
+ const router = useRouter();
45
+ const globalStore = useGlobalStore(useShallow((ctx) => ({
46
+ kycReminder: ctx.kycReminder,
47
+ signIn: ctx.signIn,
48
+ signUp: ctx.signUp,
49
+ termsAndConditions: ctx.termsAndConditions,
50
+ responsibleGaming: ctx.responsibleGaming,
51
+ kyc: ctx.kyc,
52
+ })));
53
+ const definition = z.object({
54
+ name: z
55
+ .string()
56
+ .trim()
57
+ .min(5, 'Name must be 5 or more characters')
58
+ .max(100, 'Name must not be more that 100 characters'),
59
+ password: z
60
+ .string()
61
+ .trim()
62
+ .min(8, 'Password must be 8 or more characters')
63
+ .max(100, 'Password must not be more that 100 characters'),
64
+ termsAccepted: z.boolean().superRefine((v, ctx) => {
65
+ if (!v) {
66
+ ctx.addIssue({
67
+ code: z.ZodIssueCode.custom,
68
+ message: 'You must accept the terms and conditions and the responsible gaming guidelines',
69
+ });
70
+ }
71
+ }),
72
+ firstName: z
73
+ .string()
74
+ .regex(/^[a-z ]+$/gi, 'First name must contain only letters')
75
+ .transform((val) => val.trim())
76
+ .refine((val) => val.length >= 2, {
77
+ message: 'First name must be 2 or more characters',
78
+ })
79
+ .refine((val) => val.length <= 50, {
80
+ message: 'First name must not be more than 50 characters',
81
+ }),
82
+ lastName: z
83
+ .string()
84
+ .regex(/^[a-z ]+$/gi, 'Last name must contain only letters')
85
+ .transform((val) => val.trim())
86
+ .refine((val) => val.length >= 2, {
87
+ message: 'Last name must be 2 or more characters',
88
+ })
89
+ .refine((val) => val.length <= 50, {
90
+ message: 'Last name must not be more than 50 characters',
91
+ }),
92
+ birthDay: z
93
+ .date({
94
+ invalid_type_error: 'Date of birth is required',
95
+ required_error: 'Date of birth is required',
96
+ })
97
+ .superRefine((val, ctx) => {
98
+ const now = new Date();
99
+ const age = differenceInYears(now, val);
100
+ if (age < 21) {
101
+ return ctx.addIssue({
102
+ code: z.ZodIssueCode.custom,
103
+ message: 'You must be at least 21 years old',
104
+ });
105
+ }
106
+ }),
107
+ branchCode: (signUpProps?.branches ?? []).length > 0
108
+ ? z.string().min(1, 'Branch is required').trim()
109
+ : z.string().optional(),
110
+ });
111
+ const form = useForm({
112
+ mode: 'all',
113
+ resolver: zodResolver(definition),
114
+ defaultValues: {
115
+ name: '',
116
+ password: '',
117
+ firstName: '',
118
+ lastName: '',
119
+ branchCode: signUpProps?.branches?.length
120
+ ? signUpProps.branches[0]?.code
121
+ : '',
122
+ termsAccepted: globalStore.responsibleGaming.accepted &&
123
+ globalStore.termsAndConditions.accepted
124
+ ? true
125
+ : false,
126
+ },
127
+ });
128
+ return (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mt-xl text-center font-semibold text-lg", children: "Create an account" }), _jsx("p", { className: "mt-xs text-center text-sm text-text-secondary-700", children: "Register instantly and start playing!" }), _jsxs("form", { className: "mt-3xl", autoComplete: "off", onSubmit: form.handleSubmit(async (data) => {
129
+ const id = ObjectId.generate(ObjectType.MemberAccount).toString();
130
+ try {
131
+ await signUpMutation.mutateAsync({
132
+ id,
133
+ name: data.name,
134
+ password: data.password,
135
+ realName: `${data.firstName} ${data.lastName}`,
136
+ dateOfBirth: format(data.birthDay, 'yyyy-MM-dd'),
137
+ branchCode: signUpProps?.branches?.length && data.branchCode
138
+ ? data.branchCode
139
+ : undefined,
140
+ });
141
+ const pollLogin = createPoll(async () => {
142
+ try {
143
+ await signInMutation.mutateAsync({
144
+ type: 'NAME_AND_PASSWORD',
145
+ name: data.name,
146
+ password: data.password,
147
+ });
148
+ return true;
149
+ }
150
+ catch {
151
+ return false;
152
+ }
153
+ }, {
154
+ until: (ok) => ok,
155
+ maxAttempt: 5,
156
+ });
157
+ const ok = await pollLogin();
158
+ if (!ok) {
159
+ globalStore.signIn.setOpen(true);
160
+ return;
161
+ }
162
+ globalStore.signUp.setOpen(false);
163
+ globalStore.kyc.setOpen(true);
164
+ form.reset();
165
+ }
166
+ catch (error) {
167
+ toaster.error({
168
+ description: error instanceof Error ? error.message : 'Something went wrong',
169
+ });
170
+ }
171
+ }), children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.name, className: "mt-xl", children: [_jsx(Field.Label, { children: "Name" }), _jsx(Field.Input, { placeholder: "Enter your name", ...form.register('name') }), _jsx(Field.ErrorText, { children: form.formState.errors.name?.message })] }), _jsxs(Field.Root, { invalid: !!form.formState.errors.password, className: "mt-xl", children: [_jsx(Field.Label, { children: "Password" }), _jsx(Field.Input, { type: "password", placeholder: "Enter your password", ...form.register('password') }), _jsx(Field.ErrorText, { children: form.formState.errors.password?.message })] }), _jsxs(Field.Root, { invalid: !!form.formState.errors.firstName, className: "mt-xl", children: [_jsx(Field.Label, { children: "First Name" }), _jsx(Field.Input, { placeholder: "Enter your first name", ...form.register('firstName') }), _jsx(Field.ErrorText, { children: form.formState.errors.firstName?.message })] }), _jsxs(Field.Root, { invalid: !!form.formState.errors.lastName, className: "mt-xl", children: [_jsx(Field.Label, { children: "Last Name" }), _jsx(Field.Input, { placeholder: "Enter your last name", ...form.register('lastName') }), _jsx(Field.ErrorText, { children: form.formState.errors.lastName?.message })] }), _jsxs(Field.Root, { invalid: !!form.formState.errors.birthDay, className: "mt-xl", children: [_jsx(DateOfBirthField, { value: form.watch('birthDay'), onChange: (value) => {
172
+ if (!value)
173
+ return;
174
+ form.setValue('birthDay', value, {
175
+ shouldDirty: true,
176
+ shouldTouch: true,
177
+ shouldValidate: true,
178
+ });
179
+ }, onBlur: () => {
180
+ form.trigger('birthDay');
181
+ } }), _jsx(Field.ErrorText, { children: form.formState.errors.birthDay?.message })] }), signUpProps.branches && (_jsxs(Field.Root, { invalid: !!form.formState.errors.branchCode, className: "mt-xl", children: [_jsxs(Select.Root, { value: [form.watch('branchCode') ?? ''], onValueChange: (details) => {
182
+ form.setValue('branchCode', details.value?.[0], {
183
+ shouldDirty: true,
184
+ shouldTouch: true,
185
+ shouldValidate: true,
186
+ });
187
+ }, collection: branchCollection, positioning: {
188
+ sameWidth: true,
189
+ placement: 'bottom',
190
+ }, lazyMount: true, unmountOnExit: true, children: [_jsxs(Select.Label, { className: "flex items-center gap-1", children: ["Branch", _jsxs(Tooltip.Root, { openDelay: 0, closeDelay: 100, lazyMount: true, unmountOnExit: true, positioning: {
191
+ placement: 'top',
192
+ }, children: [_jsx(Tooltip.Trigger, { asChild: true, children: _jsx(HelpCircleIcon, { className: "size-4 text-text-nav-item-button-icon" }) }), _jsx(Tooltip.Positioner, { children: _jsxs(Tooltip.Content, { children: [_jsx(Tooltip.Arrow, { children: _jsx(Tooltip.ArrowTip, {}) }), "Choose branch closest to your residence."] }) })] })] }), _jsxs(Select.Trigger, { children: [_jsx(Select.ValueText, {}), _jsx(Select.Indicator, { asChild: true, children: _jsx(ChevronDownIcon, {}) })] }), _jsx(Select.Positioner, { children: _jsx(Select.Content, { children: branchCollection.items.map((item) => {
193
+ const label = branchCollection.stringifyItem(item) ?? '';
194
+ return (_jsx(Select.Item, { item: item, "aria-disabled": item.disabled, className: twMerge(item.disabled && 'text-border-disabled'), children: _jsx("div", { title: label, className: "line-clamp-1", children: label }) }, item.code));
195
+ }) }) })] }), _jsx(Field.ErrorText, { children: form.formState.errors.branchCode?.message })] })), _jsx(Controller, { control: form.control, name: "termsAccepted", render: (o) => (_jsxs(Field.Root, { className: "mt-2xl", invalid: o.fieldState.invalid, children: [_jsxs(Checkbox.Root, { checked: o.field.value, onCheckedChange: (details) => {
196
+ if (details.checked === 'indeterminate')
197
+ return;
198
+ o.field.onChange(details.checked);
199
+ globalStore.termsAndConditions.setAccepted(details.checked);
200
+ globalStore.responsibleGaming.setAccepted(details.checked);
201
+ }, children: [_jsx(Checkbox.Control, { children: _jsx(Checkbox.Indicator, { asChild: true, children: _jsx(CheckIcon, {}) }) }), _jsxs(Checkbox.Label, { children: ["I am at least 21 years of age and I have read and accept the", ' ', _jsx("button", { type: "button", className: "text-brand-400 underline underline-offset-2", onClick: () => {
202
+ if (signUpProps.termsAndConditionsUrl) {
203
+ globalStore.signUp.setOpen(false);
204
+ router.push(signUpProps.termsAndConditionsUrl);
205
+ }
206
+ else {
207
+ globalStore.termsAndConditions.setOpen(true);
208
+ globalStore.termsAndConditions.setNext('SIGN_UP');
209
+ globalStore.signUp.setOpen(false);
210
+ }
211
+ }, children: "Terms and Conditions" }), ' ', "and", ' ', _jsx("button", { type: "button", className: "text-brand-400 underline underline-offset-2", onClick: () => {
212
+ if (signUpProps.responsibleGamingUrl) {
213
+ globalStore.signUp.setOpen(false);
214
+ router.push(signUpProps.responsibleGamingUrl);
215
+ }
216
+ else {
217
+ globalStore.responsibleGaming.setOpen(true);
218
+ globalStore.responsibleGaming.setNext('SIGN_UP');
219
+ globalStore.signUp.setOpen(false);
220
+ }
221
+ }, children: "Responsible Gaming" }), ' ', "guidelines."] }), _jsx(Checkbox.HiddenInput, {})] }), _jsx(Field.ErrorText, { className: "ml-6 text-xs", children: o.fieldState.error?.message })] })) }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: form.formState.isSubmitting, children: signUpProps.isRegulated ? 'Continue' : 'Create Account' })] }), signUpProps.showPublicPlayProhibition && (_jsxs("div", { className: twMerge('mt-3xl text-center text-sm', signUpProps.className?.publicPlayProhibitionRoot), children: ["Prohibition to play in open and public places", _jsxs("div", { className: twMerge('mx-auto mt-5 flex h-13 w-fit items-center justify-center gap-3xl rounded-[60px] bg-[#1D0201] px-5 py-2', signUpProps.className?.publicPlayProhibitionLogoContainer), children: [_jsx(Image, { src: signUpProps.pagcorLogo ?? pagcorLogo, alt: "", draggable: false, height: 62, width: 186, className: "h-10 w-auto" }), _jsx(Image, { src: signUpProps.responsibleGamingLogo ?? responsibleGamingLogo, alt: "", height: 62, width: 186, className: "h-10 w-auto", draggable: false })] })] })), _jsxs("div", { className: "mt-6 flex w-full items-center justify-center gap-xs text-sm", children: [_jsx("span", { className: "text-text-tertiary-600", children: "Already have an account?" }), _jsx("button", { type: "submit", className: "font-semibold text-button-tertiary-fg", onClick: () => {
222
+ globalStore.signUp.setOpen(false);
223
+ globalStore.signIn.setOpen(true);
224
+ }, children: "Log In" })] })] }));
225
+ }
226
+ const DEVICE_TIMEZONE = Intl.DateTimeFormat().resolvedOptions().timeZone;
227
+ function DateOfBirthField(props) {
228
+ const [value, setValue] = useControllableState({
229
+ value: props.value,
230
+ defaultValue: props.defaultValue ?? null,
231
+ onChange: props.onChange,
232
+ });
233
+ // Custom input handler to automatically add slashes
234
+ const handleInput = (e) => {
235
+ const input = e.currentTarget;
236
+ const oldValue = input.value;
237
+ const oldCursorPosition = input.selectionStart ?? 0;
238
+ // Get digits only from the current input value string
239
+ const digitsOnly = input.value.replace(/\D/g, '');
240
+ let formattedValue = '';
241
+ // Format MM/DD/YYYY
242
+ if (digitsOnly.length > 0) {
243
+ formattedValue += digitsOnly.substring(0, 2);
244
+ if (digitsOnly.length > 2) {
245
+ formattedValue += '/' + digitsOnly.substring(2, 4);
246
+ }
247
+ if (digitsOnly.length > 4) {
248
+ formattedValue += '/' + digitsOnly.substring(4, 8);
249
+ }
250
+ }
251
+ formattedValue = formattedValue.substring(0, 10); // Limit length
252
+ if (formattedValue !== oldValue) {
253
+ input.value = formattedValue;
254
+ let newCursorPosition = oldCursorPosition;
255
+ // Calculate the number of slashes before the old cursor position in the old value
256
+ const oldSlashesBeforeCursor = (oldValue.substring(0, oldCursorPosition).match(/\//g) || []).length;
257
+ // Calculate the number of slashes before the new cursor position in the new formatted value
258
+ // We take the substring of the new formatted value up to where the cursor *would* be based on the old digits
259
+ const digitsBeforeOldCursor = oldValue
260
+ .substring(0, oldCursorPosition)
261
+ .replace(/\D/g, '').length;
262
+ const newSlashesBeforeCursor = (formattedValue
263
+ .substring(0, digitsBeforeOldCursor + oldSlashesBeforeCursor)
264
+ .match(/\//g) || []).length;
265
+ // Adjust newCursorPosition based on the difference in slash count
266
+ newCursorPosition += newSlashesBeforeCursor - oldSlashesBeforeCursor;
267
+ // Ensure cursor stays within bounds
268
+ newCursorPosition = Math.min(newCursorPosition, formattedValue.length);
269
+ newCursorPosition = Math.max(0, newCursorPosition);
270
+ setTimeout(() => {
271
+ input.setSelectionRange(newCursorPosition, newCursorPosition);
272
+ }, 0);
273
+ }
274
+ };
275
+ return (_jsxs(DatePicker.Root, { size: "md", variant: "outline", placeholder: "MM/DD/YYYY", lazyMount: true, unmountOnExit: true, fixedWeeks: true, selectionMode: "single", value: value ? [parseDate(value)] : [], onValueChange: (details) => {
276
+ const value = details.value.at(0)?.toDate(DEVICE_TIMEZONE);
277
+ setValue(value ?? null);
278
+ }, children: [_jsx(DatePicker.Label, { children: "Date of Birth" }), _jsxs(DatePicker.Control, { children: [_jsx(DatePicker.Input, { onBlur: props.onBlur, onFocus: props.onFocus, onInput: handleInput }), _jsx(DatePicker.Trigger, { children: _jsx(CalendarIcon, {}) })] }), _jsx(DatePicker.Positioner, { children: _jsxs(DatePicker.Content, { children: [_jsx(DatePicker.View, { view: "day", children: _jsx(DatePicker.Context, { children: (api) => (_jsxs(_Fragment, { children: [_jsxs(DatePicker.ViewControl, { children: [_jsx(DatePicker.PrevTrigger, { children: _jsx(ChevronLeftIcon, {}) }), _jsx(DatePicker.ViewTrigger, { children: _jsx(DatePicker.RangeText, {}) }), _jsx(DatePicker.NextTrigger, { children: _jsx(ChevronRightIcon, {}) })] }), _jsxs(DatePicker.Table, { children: [_jsx(DatePicker.TableHead, { children: _jsx(DatePicker.TableRow, { children: api.weekDays.map((weekDay, id) => (_jsx(DatePicker.TableHeader, { children: weekDay.short.substring(0, 2) }, id))) }) }), _jsx(DatePicker.TableBody, { children: api.weeks.map((week, id) => (_jsx(DatePicker.TableRow, { children: week.map((day, id) => (_jsx(DatePicker.TableCell, { value: day, children: _jsx(DatePicker.TableCellTrigger, { children: day.day }) }, id))) }, id))) })] })] })) }) }), _jsx(DatePicker.View, { view: "month", children: _jsx(DatePicker.Context, { children: (datePicker) => (_jsxs(_Fragment, { children: [_jsxs(DatePicker.ViewControl, { children: [_jsx(DatePicker.PrevTrigger, { children: _jsx(ChevronLeftIcon, {}) }), _jsx(DatePicker.ViewTrigger, { children: _jsx(DatePicker.RangeText, {}) }), _jsx(DatePicker.NextTrigger, { children: _jsx(ChevronRightIcon, {}) })] }), _jsx(DatePicker.Table, { children: _jsx(DatePicker.TableBody, { children: datePicker
279
+ .getMonthsGrid({ columns: 4, format: 'short' })
280
+ .map((months, id) => (_jsx(DatePicker.TableRow, { children: months.map((month, id) => (_jsx(DatePicker.TableCell, { value: month.value, children: _jsx(DatePicker.TableCellTrigger, { className: "w-[4.425rem]", children: month.label }) }, id))) }, id))) }) })] })) }) }), _jsx(DatePicker.View, { view: "year", children: _jsx(DatePicker.Context, { children: (datePicker) => (_jsxs(_Fragment, { children: [_jsxs(DatePicker.ViewControl, { children: [_jsx(DatePicker.PrevTrigger, { children: _jsx(ChevronLeftIcon, {}) }), _jsx(DatePicker.ViewTrigger, { children: _jsx(DatePicker.RangeText, {}) }), _jsx(DatePicker.NextTrigger, { children: _jsx(ChevronRightIcon, {}) })] }), _jsx(DatePicker.Table, { children: _jsx(DatePicker.TableBody, { children: datePicker
281
+ .getYearsGrid({ columns: 4 })
282
+ .map((years, id) => (_jsx(DatePicker.TableRow, { children: years.map((year, id) => (_jsx(DatePicker.TableCell, { value: year.value, children: _jsx(DatePicker.TableCellTrigger, { className: "w-[4.425rem]", children: year.label }) }, id))) }, id))) }) })] })) }) })] }) })] }));
283
+ }
@@ -1,5 +1,5 @@
1
1
  export declare const SITE_ID: string;
2
2
  export declare const PLATFORM_ID: string;
3
3
  export declare const PLATFORM_CODE: string;
4
- export declare const ENVIRONMENT: "development" | "production";
4
+ export declare const ENVIRONMENT: "production" | "development";
5
5
  export declare const INTERNALS__REPORT_WEB_VITALS: boolean;
@@ -118,12 +118,17 @@ export interface RegisterMemberAccountByNameMutationVariables {
118
118
  id: string;
119
119
  name: string;
120
120
  password: string;
121
+ realName?: string;
122
+ dateOfBirth?: string;
123
+ branchCode?: string;
124
+ cellxpertCxd?: string;
121
125
  };
126
+ reCAPTCHAResponse: string;
122
127
  }
123
128
  export interface RegisterMemberAccountByNameMutation {
124
129
  registerMemberAccountByName?: null | RegisterMemberAccountByNameError;
125
130
  }
126
- export type RegisterMemberAccountByNameInput = Simplify<RegisterMemberAccountByNameMutationVariables['input']>;
131
+ export type RegisterMemberAccountByNameInput = Simplify<RegisterMemberAccountByNameMutationVariables['input'] & Omit<RegisterMemberAccountByNameMutationVariables, 'input'>>;
127
132
  export declare const registerMemberAccountByName: (input: RegisterMemberAccountByNameInput, options?: GraphQLRequestOptions) => Promise<void>;
128
133
  export type UpdateMemberAccountError = {
129
134
  name: 'AccountNameNotAvailableError';
@@ -78,12 +78,17 @@ export const registerMemberAccount__next = async (input, options) => {
78
78
  }
79
79
  };
80
80
  export const registerMemberAccountByName = async (input, options) => {
81
- const { password, ...rest } = input;
82
81
  const res = await graphqlRequest(ACCOUNT_GRAPHQL_ENDPOINT, REGISTER_MEMBER_ACCOUNT_BY_NAME, {
83
82
  input: {
84
- password: await sha256(password),
85
- ...rest,
83
+ id: input.id,
84
+ name: input.name,
85
+ password: await sha256(input.password),
86
+ realName: input.realName,
87
+ dateOfBirth: input.dateOfBirth,
88
+ branchCode: input.branchCode,
89
+ cellxpertCxd: input.cellxpertCxd,
86
90
  },
91
+ reCAPTCHAResponse: input.reCAPTCHAResponse,
87
92
  }, options);
88
93
  if (res.registerMemberAccountByName) {
89
94
  const error = new Error();