@opexa/portal-components 0.0.256 → 0.0.258
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/SignIn/MobileNumberSignIn.js +11 -7
- package/dist/components/SignIn/NameAndPasswordSignIn.js +11 -6
- package/dist/components/SignIn/SignIn.lazy.d.ts +3 -0
- package/dist/components/SignUp/SignUpDefault/SignUp.lazy.d.ts +4 -0
- package/dist/components/SignUp/SignUpDefault/SignUp.lazy.js +1 -1
- package/dist/components/SignUp/SignUpDefault/SignUpForm.js +10 -6
- package/dist/components/SignUp/SignUpKYC/SignUpFormKYC.js +16 -8
- package/dist/components/SignUp/SignUpKYC/SignUpKYC.lazy.d.ts +4 -0
- package/dist/components/SignUp/SignUpKYC/SignUpKYC.lazy.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
3
|
-
import
|
|
4
|
-
import { useRef } from 'react';
|
|
3
|
+
import { useRef, useState } from 'react';
|
|
5
4
|
import { Controller, useForm } from 'react-hook-form';
|
|
6
5
|
import { z } from 'zod';
|
|
7
6
|
import { useShallow } from 'zustand/shallow';
|
|
@@ -18,6 +17,8 @@ import { Button } from '../../ui/Button/index.js';
|
|
|
18
17
|
import { Checkbox } from '../../ui/Checkbox/index.js';
|
|
19
18
|
import { Field } from '../../ui/Field/index.js';
|
|
20
19
|
import { PinInput } from '../../ui/PinInput/index.js';
|
|
20
|
+
import { ResponsibleGaming } from '../Disclaimer/ResponsibleGaming.js';
|
|
21
|
+
import { TermsOfUse } from '../Disclaimer/TermsOfUse.js';
|
|
21
22
|
import { useSignInContext, useSignInPropsContext } from './SignInContext.js';
|
|
22
23
|
import { getFriendlyErrorMessage } from './utils.js';
|
|
23
24
|
export function MobileNumberSignIn(props) {
|
|
@@ -122,7 +123,9 @@ export function MobileNumberSignIn(props) {
|
|
|
122
123
|
duration: 1000 * 60,
|
|
123
124
|
});
|
|
124
125
|
const form2Ref = useRef(null);
|
|
125
|
-
|
|
126
|
+
const [isTermsOfUseOpen, setTermsOfUseOpen] = useState(false);
|
|
127
|
+
const [isResponsibleGamingOpen, setResponsibleGamingOpen] = useState(false);
|
|
128
|
+
return (_jsxs(_Fragment, { children: [_jsx(TermsOfUse, { termsOfUseContent: signInProps.termsOfUseContent ?? 'Terms of Use content', siteName: signInProps.siteName ?? 'Site', logo: signInProps.logo, open: isTermsOfUseOpen, onCloseAction: () => setTermsOfUseOpen(false), responsibleGamingLogo: signInProps.responsibleGamingLogo }), _jsx(ResponsibleGaming, { responsibleGamingContent: signInProps.responsibleGamingContent ?? 'Responsible Gaming content', logo: signInProps.logo, open: isResponsibleGamingOpen, onCloseAction: () => setResponsibleGamingOpen(false), responsibleGamingLogo: signInProps.responsibleGamingLogo }), context.step === 1 && (_jsxs(_Fragment, { children: [_jsxs("form", { className: "mt-3xl", onSubmit: step1Form.handleSubmit(async (data) => {
|
|
126
129
|
sendVerificationCodeMutation.mutate({
|
|
127
130
|
channel: 'SMS',
|
|
128
131
|
recipient: mobileNumberParser.format(data.mobileNumber),
|
|
@@ -132,10 +135,11 @@ export function MobileNumberSignIn(props) {
|
|
|
132
135
|
paddingLeft: `calc(2.75rem + ${localeInfo.mobileNumber.areaCode.length}ch)`,
|
|
133
136
|
}, ...step1Form.register('mobileNumber') })] }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.mobileNumber?.message })] }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: step1Form.formState.isSubmitting, children: "Log In" }), _jsx(Controller, { control: step1Form.control, name: "termsAccepted", render: (o) => (_jsxs(Field.Root, { invalid: o.fieldState.invalid, className: "mt-xl", children: [_jsxs(Checkbox.Root, { checked: o.field.value, onCheckedChange: (details) => {
|
|
134
137
|
o.field.onChange(details.checked);
|
|
135
|
-
}, 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 accept the", ' ', _jsx(
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
}, 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: () => {
|
|
139
|
+
setTermsOfUseOpen(true);
|
|
140
|
+
}, children: "Terms and Conditions" }), ' ', "and", ' ', _jsx("button", { type: "button", className: "text-brand-400 underline underline-offset-2", onClick: () => {
|
|
141
|
+
setResponsibleGamingOpen(true);
|
|
142
|
+
}, children: "Responsible Gaming" }), ' ', "guidelines."] }), _jsx(Checkbox.HiddenInput, {})] }), _jsx(Field.ErrorText, { className: "ml-6 text-xs", children: o.fieldState.error?.message })] })) })] }), _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: "Don't have an account?" }), _jsx("button", { type: "submit", className: "text-button-tertiary-fg font-semibold", onClick: () => {
|
|
139
143
|
globalStore.signIn.setOpen(false);
|
|
140
144
|
globalStore.signUp.setOpen(true);
|
|
141
145
|
}, children: "Sign up" })] })] })), context.step === 2 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mt-xl text-center text-lg font-semibold", children: "Check your Phone" }), _jsxs("p", { className: "text-text-secondary-700 mt-xs text-center text-sm", children: ["We\u2019ve sent a verification code to your mobile number", ' ', _jsx("span", { className: "font-semibold", children: mobileNumberParser.format(step1Form.getValues('mobileNumber')) }), ' ', "via text"] }), _jsxs("form", { ref: form2Ref, className: "mt-5", onSubmit: step2Form.handleSubmit(async ({ verificationCode }) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useDialogContext } from '@ark-ui/react/dialog';
|
|
3
3
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
4
|
-
import
|
|
4
|
+
import { useState } from 'react';
|
|
5
5
|
import { Controller, useForm } from 'react-hook-form';
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
import { useShallow } from 'zustand/shallow';
|
|
@@ -17,6 +17,8 @@ import { Button } from '../../ui/Button/index.js';
|
|
|
17
17
|
import { Checkbox } from '../../ui/Checkbox/index.js';
|
|
18
18
|
import { Field } from '../../ui/Field/index.js';
|
|
19
19
|
import { PasswordInput } from '../../ui/PasswordInput/index.js';
|
|
20
|
+
import { ResponsibleGaming } from '../Disclaimer/ResponsibleGaming.js';
|
|
21
|
+
import { TermsOfUse } from '../Disclaimer/TermsOfUse.js';
|
|
20
22
|
import { useSignInContext, useSignInPropsContext } from './SignInContext.js';
|
|
21
23
|
import { getFriendlyErrorMessage } from './utils.js';
|
|
22
24
|
export function NameAndPasswordSignIn(props) {
|
|
@@ -111,7 +113,9 @@ export function NameAndPasswordSignIn(props) {
|
|
|
111
113
|
])
|
|
112
114
|
.parse(signInMutation.data.secretQuestion)
|
|
113
115
|
: null;
|
|
114
|
-
|
|
116
|
+
const [isTermsOfUseOpen, setTermsOfUseOpen] = useState(false);
|
|
117
|
+
const [isResponsibleGamingOpen, setResponsibleGamingOpen] = useState(false);
|
|
118
|
+
return (_jsxs(_Fragment, { children: [_jsx(TermsOfUse, { termsOfUseContent: signInProps.termsOfUseContent ?? 'Terms of Use content', siteName: signInProps.siteName ?? 'Site', logo: signInProps.logo, open: isTermsOfUseOpen, onCloseAction: () => setTermsOfUseOpen(false), responsibleGamingLogo: signInProps.responsibleGamingLogo }), _jsx(ResponsibleGaming, { responsibleGamingContent: signInProps.responsibleGamingContent ?? 'Responsible Gaming content', logo: signInProps.logo, open: isResponsibleGamingOpen, onCloseAction: () => setResponsibleGamingOpen(false), responsibleGamingLogo: signInProps.responsibleGamingLogo }), _jsxs("form", { className: "mt-3xl", onSubmit: form.handleSubmit((data) => {
|
|
115
119
|
if (!signInMutation.data) {
|
|
116
120
|
signInMutation.mutate({
|
|
117
121
|
type: 'NAME_AND_PASSWORD',
|
|
@@ -136,10 +140,11 @@ export function NameAndPasswordSignIn(props) {
|
|
|
136
140
|
dialog.setOpen(false);
|
|
137
141
|
}, children: "Forgot Password" }) })] }) }), signInMutation.data && (_jsxs(Field.Root, { invalid: !!form.formState.errors.secretAnswer, className: "mt-xl", children: [_jsx(Field.Label, { children: secretQuestion }), _jsx(Field.Input, { placeholder: "Answer the security question", ...form.register('secretAnswer') }), _jsx(Field.ErrorText, { children: form.formState.errors.secretAnswer?.message })] })), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: signInMutation.isPending || authenticateMutation.isPending, children: "Log In" }), _jsx(Controller, { control: form.control, name: "termsAccepted", render: (o) => (_jsxs(Field.Root, { invalid: o.fieldState.invalid, className: "mt-xl", children: [_jsxs(Checkbox.Root, { checked: o.field.value, onCheckedChange: (details) => {
|
|
138
142
|
o.field.onChange(details.checked);
|
|
139
|
-
}, 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 accept the", ' ', _jsx(
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
+
}, 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: () => {
|
|
144
|
+
setTermsOfUseOpen(true);
|
|
145
|
+
}, children: "Terms and Conditions" }), ' ', "and", ' ', _jsx("button", { type: "button", className: "text-brand-400 underline underline-offset-2", onClick: () => {
|
|
146
|
+
setResponsibleGamingOpen(true);
|
|
147
|
+
}, children: "Responsible Gaming" }), ' ', "guidelines."] }), _jsx(Checkbox.HiddenInput, {})] }), _jsx(Field.ErrorText, { className: "ml-6 text-xs", children: o.fieldState.error?.message })] })) })] }), _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: "Don't have an account?" }), _jsx("button", { type: "submit", className: "text-button-tertiary-fg font-semibold", onClick: () => {
|
|
143
148
|
dialog.setOpen(false);
|
|
144
149
|
globalStore.signUp.setOpen(true);
|
|
145
150
|
}, children: "Sign up" })] })] }));
|
|
@@ -5,6 +5,9 @@ export interface SignInProps {
|
|
|
5
5
|
className?: string;
|
|
6
6
|
/** @default '/terms-and-conditions' */
|
|
7
7
|
termsAndConditionsUrl?: string;
|
|
8
|
+
termsOfUseContent?: ReactNode;
|
|
9
|
+
responsibleGamingContent?: ReactNode;
|
|
10
|
+
responsibleGamingLogo?: ImageProps['src'];
|
|
8
11
|
children?: ReactNode;
|
|
9
12
|
siteName?: string;
|
|
10
13
|
}
|
|
@@ -6,6 +6,10 @@ export interface SignUpProps {
|
|
|
6
6
|
children?: ReactNode;
|
|
7
7
|
/** @default "/terms-and-conditions" */
|
|
8
8
|
termsAndConditionsUrl?: string;
|
|
9
|
+
termsOfUseContent?: ReactNode;
|
|
10
|
+
responsibleGamingContent?: ReactNode;
|
|
11
|
+
responsibleGamingLogo?: ImageProps['src'];
|
|
12
|
+
siteName?: string;
|
|
9
13
|
className?: string;
|
|
10
14
|
branches?: Branch[];
|
|
11
15
|
layout: 'default';
|
|
@@ -14,5 +14,5 @@ export function SignUp(props) {
|
|
|
14
14
|
const signUpStore = useGlobalStore(useShallow((ctx) => ctx.signUp));
|
|
15
15
|
return (_jsx(SignUpPropsProvider, { value: props, children: _jsx(Dialog.Root, { open: signUpStore.open, onOpenChange: (details) => {
|
|
16
16
|
signUpStore.setOpen(details.open);
|
|
17
|
-
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: twMerge('bg-bg-primary-alt mx-auto h-full w-full items-start p-3xl pb-4xl lg:h-auto lg:w-[400px] lg:rounded-xl
|
|
17
|
+
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: twMerge('bg-bg-primary-alt mx-auto h-full w-full items-start overflow-y-auto p-3xl pb-4xl lg:h-auto lg:w-[400px] lg:rounded-xl', props.className), 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(SignUpForm, {}) })] }) })] }) }) }));
|
|
18
18
|
}
|
|
@@ -4,7 +4,6 @@ import { createListCollection, parseDate } from '@ark-ui/react';
|
|
|
4
4
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
5
5
|
import { ObjectId } from '@opexa/object-id';
|
|
6
6
|
import { differenceInYears, format } from 'date-fns';
|
|
7
|
-
import Link from 'next/link';
|
|
8
7
|
import { useSearchParams } from 'next/navigation';
|
|
9
8
|
import { useRef, useState } from 'react';
|
|
10
9
|
import { Controller, useForm } from 'react-hook-form';
|
|
@@ -38,6 +37,8 @@ import { PinInput } from '../../../ui/PinInput/index.js';
|
|
|
38
37
|
import { Select } from '../../../ui/Select/index.js';
|
|
39
38
|
import { Tooltip } from '../../../ui/Tooltip/index.js';
|
|
40
39
|
import { createPoll } from '../../../utils/createPoll.js';
|
|
40
|
+
import { ResponsibleGaming } from '../../Disclaimer/ResponsibleGaming.js';
|
|
41
|
+
import { TermsOfUse } from '../../Disclaimer/TermsOfUse.js';
|
|
41
42
|
import { useSignUpPropsContext } from './SignUpContext.js';
|
|
42
43
|
export function SignUpForm() {
|
|
43
44
|
const signUpProps = useSignUpPropsContext();
|
|
@@ -134,7 +135,9 @@ export function SignUpForm() {
|
|
|
134
135
|
const form2Ref = useRef(null);
|
|
135
136
|
const birthDay = step1Form.watch('birthDay');
|
|
136
137
|
const branchCode = step1Form.watch('branchCode', '');
|
|
137
|
-
|
|
138
|
+
const [isTermsOfUseOpen, setTermsOfUseOpen] = useState(false);
|
|
139
|
+
const [isResponsibleGamingOpen, setResponsibleGamingOpen] = useState(false);
|
|
140
|
+
return (_jsxs(_Fragment, { children: [_jsx(TermsOfUse, { termsOfUseContent: signUpProps.termsOfUseContent ?? 'Terms of Use content', siteName: signUpProps.siteName ?? 'Site', logo: signUpProps.logo, open: isTermsOfUseOpen, onCloseAction: () => setTermsOfUseOpen(false), responsibleGamingLogo: signUpProps.responsibleGamingLogo }), _jsx(ResponsibleGaming, { responsibleGamingContent: signUpProps.responsibleGamingContent ?? 'Responsible Gaming content', logo: signUpProps.logo, open: isResponsibleGamingOpen, onCloseAction: () => setResponsibleGamingOpen(false), responsibleGamingLogo: signUpProps.responsibleGamingLogo }), step === 1 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mt-xl text-center text-lg font-semibold", children: "Create an account" }), _jsx("p", { className: "text-text-secondary-700 mt-xs text-center text-sm", children: "Register instantly and start playing!" }), _jsxs("form", { className: "mt-3xl", autoComplete: "off", onSubmit: step1Form.handleSubmit(async (data) => {
|
|
138
141
|
try {
|
|
139
142
|
await sendVerificationCodeMutation.mutateAsync({
|
|
140
143
|
channel: 'SMS',
|
|
@@ -180,10 +183,11 @@ export function SignUpForm() {
|
|
|
180
183
|
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));
|
|
181
184
|
}) }) })] }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.branchCode?.message })] }), _jsx(Controller, { control: step1Form.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) => {
|
|
182
185
|
o.field.onChange(details.checked);
|
|
183
|
-
}, 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 accept the", ' ', _jsx(
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
186
|
+
}, 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: () => {
|
|
187
|
+
setTermsOfUseOpen(true);
|
|
188
|
+
}, children: "Terms and Conditions" }), ' ', "and", ' ', _jsx("button", { type: "button", className: "text-brand-400 underline underline-offset-2", onClick: () => {
|
|
189
|
+
setResponsibleGamingOpen(true);
|
|
190
|
+
}, 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: step1Form.formState.isSubmitting, children: "Create Account" })] }), _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: "text-button-tertiary-fg font-semibold", onClick: () => {
|
|
187
191
|
globalStore.signUp.setOpen(false);
|
|
188
192
|
globalStore.signIn.setOpen(true);
|
|
189
193
|
}, children: "Log In" })] })] })), step === 2 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mt-xl text-center text-lg font-semibold", children: "Check your Phone" }), _jsxs("p", { className: "text-text-secondary-700 mt-xs text-center text-sm", children: ["We\u2019ve sent a verification code to your mobile number", ' ', _jsx("span", { className: "font-semibold", children: mobileNumberParser.format(step1Form.getValues('mobileNumber')) }), ' ', "via text"] }), _jsxs("form", { ref: form2Ref, className: "mt-5", onSubmit: step2Form.handleSubmit(async ({ verificationCode }) => {
|
|
@@ -6,7 +6,6 @@ import { zodResolver } from '@hookform/resolvers/zod';
|
|
|
6
6
|
import { ObjectId } from '@opexa/object-id';
|
|
7
7
|
import { differenceInYears, format } from 'date-fns';
|
|
8
8
|
import Image from 'next/image';
|
|
9
|
-
import Link from 'next/link';
|
|
10
9
|
import { useSearchParams } from 'next/navigation';
|
|
11
10
|
import { useEffect, useRef, useState } from 'react';
|
|
12
11
|
import { Controller, useForm } from 'react-hook-form';
|
|
@@ -49,6 +48,8 @@ import { Select } from '../../../ui/Select/index.js';
|
|
|
49
48
|
import { createPoll } from '../../../utils/createPoll.js';
|
|
50
49
|
import { getQueryClient } from '../../../utils/getQueryClient.js';
|
|
51
50
|
import { getMemberVerificationQueryKey } from '../../../utils/queryKeys.js';
|
|
51
|
+
import { ResponsibleGaming } from '../../Disclaimer/ResponsibleGaming.js';
|
|
52
|
+
import { TermsOfUse } from '../../Disclaimer/TermsOfUse.js';
|
|
52
53
|
import ImageUploader from './ImageUploader.js';
|
|
53
54
|
import { useSignUpKYCPropsContext } from './SignUpKYCContext.js';
|
|
54
55
|
export function SignUpFormKYC() {
|
|
@@ -104,17 +105,20 @@ export function SignUpFormKYC() {
|
|
|
104
105
|
firstName: z
|
|
105
106
|
.string()
|
|
106
107
|
.min(2, 'First name must be 2 or more characters')
|
|
107
|
-
.max(
|
|
108
|
+
.max(20, 'First name must not be more than 50 characters')
|
|
109
|
+
.regex(/\S/, 'First name cannot be empty or contain only spaces')
|
|
108
110
|
.trim(),
|
|
109
111
|
middleName: z
|
|
110
112
|
.string()
|
|
111
113
|
.min(2, 'Middle name must be 2 or more characters')
|
|
112
|
-
.max(
|
|
114
|
+
.max(20, 'Middle name must not be more than 50 characters')
|
|
115
|
+
.regex(/\S/, 'Middle name cannot be empty or contain only spaces')
|
|
113
116
|
.trim(),
|
|
114
117
|
lastName: z
|
|
115
118
|
.string()
|
|
116
119
|
.min(2, 'Last name must be 2 or more characters')
|
|
117
|
-
.max(
|
|
120
|
+
.max(20, 'Last name must not be more than 50 characters')
|
|
121
|
+
.regex(/\S/, 'Last name cannot be empty or contain only spaces')
|
|
118
122
|
.trim(),
|
|
119
123
|
birthDay: z
|
|
120
124
|
.date({
|
|
@@ -182,6 +186,8 @@ export function SignUpFormKYC() {
|
|
|
182
186
|
const form2Ref = useRef(null);
|
|
183
187
|
const birthDay = step1Form.watch('birthDay');
|
|
184
188
|
const branchCode = step1Form.watch('branchCode', '');
|
|
189
|
+
const [isTermsOfUseOpen, setTermsOfUseOpen] = useState(false);
|
|
190
|
+
const [isResponsibleGamingOpen, setResponsibleGamingOpen] = useState(false);
|
|
185
191
|
useEffect(() => {
|
|
186
192
|
if (props.frontImage) {
|
|
187
193
|
step1Form.setValue('frontImage', props.frontImage);
|
|
@@ -220,7 +226,7 @@ export function SignUpFormKYC() {
|
|
|
220
226
|
const memberVerification = useMemberVerificationQuery();
|
|
221
227
|
const memberId = memberVerification.data?.id;
|
|
222
228
|
const { mutate: uploadImageFile } = useUploadImageFileMutation();
|
|
223
|
-
return (_jsxs(_Fragment, { children: [step === 1 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mt-xl text-center text-lg font-semibold", children: "Create an account" }), _jsx("p", { className: "text-text-secondary-700 mt-xs text-center text-sm", children: "Register instantly and start playing!" }), _jsxs("form", { className: "mt-3xl", autoComplete: "off", onSubmit: step1Form.handleSubmit(async (data) => {
|
|
229
|
+
return (_jsxs(_Fragment, { children: [_jsx(TermsOfUse, { termsOfUseContent: props.termsOfUseContent ?? 'Terms of Use content', siteName: props.siteName ?? 'Site', logo: props.logo, open: isTermsOfUseOpen, onCloseAction: () => setTermsOfUseOpen(false), responsibleGamingLogo: props.responsibleGamingLogo }), _jsx(ResponsibleGaming, { responsibleGamingContent: props.responsibleGamingContent ?? 'Responsible Gaming content', logo: props.logo, open: isResponsibleGamingOpen, onCloseAction: () => setResponsibleGamingOpen(false), responsibleGamingLogo: props.responsibleGamingLogo }), step === 1 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mt-xl text-center text-lg font-semibold", children: "Create an account" }), _jsx("p", { className: "text-text-secondary-700 mt-xs text-center text-sm", children: "Register instantly and start playing!" }), _jsxs("form", { className: "mt-3xl", autoComplete: "off", onSubmit: step1Form.handleSubmit(async (data) => {
|
|
224
230
|
try {
|
|
225
231
|
await sendVerificationCodeMutation.mutateAsync({
|
|
226
232
|
channel: 'SMS',
|
|
@@ -270,9 +276,11 @@ export function SignUpFormKYC() {
|
|
|
270
276
|
props.setSelfieImage(file);
|
|
271
277
|
} }, "selfie-image-upload"), _jsx(Field.ErrorText, { children: step1Form.formState.errors.selfieImage?.message })] }), _jsxs("div", { className: "mt-xl text-center text-sm", children: ["Prohibition to play in open and public places", _jsxs("div", { className: "mt-5 flex items-center justify-center gap-3xl", children: [_jsx("div", { className: "flex size-5xl items-center justify-center overflow-hidden rounded-full bg-white", children: _jsx(Image, { src: pagcorLogo, alt: "", draggable: false, height: 62, width: 186, className: "h-9.5 w-auto object-contain" }) }), _jsx(Image, { src: responsibleGamingLogo, alt: "", height: 62, width: 186, className: "h-10 w-auto", draggable: false })] })] }), _jsx(Controller, { control: step1Form.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) => {
|
|
272
278
|
o.field.onChange(details.checked);
|
|
273
|
-
}, 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 accept the", ' ', _jsx(
|
|
274
|
-
|
|
275
|
-
},
|
|
279
|
+
}, 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: () => {
|
|
280
|
+
setTermsOfUseOpen(true);
|
|
281
|
+
}, children: "Terms and Conditions" }), ' ', "and", ' ', _jsx("button", { type: "button", className: "text-brand-400 underline underline-offset-2", onClick: () => {
|
|
282
|
+
setResponsibleGamingOpen(true);
|
|
283
|
+
}, 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: step1Form.formState.isSubmitting, children: "Create Account" })] }), _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: "text-button-tertiary-fg font-semibold", onClick: () => {
|
|
276
284
|
dialog.setOpen(false);
|
|
277
285
|
signInStore.setOpen(true);
|
|
278
286
|
}, children: "Log In" })] })] })), step === 2 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mt-xl text-center text-lg font-semibold", children: "Check your Phone" }), _jsxs("p", { className: "text-text-secondary-700 mt-xs text-center text-sm", children: ["We\u2019ve sent a verification code to your mobile number", ' ', _jsx("span", { className: "font-semibold", children: mobileNumberParser.format(step1Form.getValues('mobileNumber')) }), ' ', "via text"] }), _jsxs("form", { ref: form2Ref, className: "mt-5", onSubmit: step2Form.handleSubmit(async ({ verificationCode }) => {
|
|
@@ -6,6 +6,10 @@ export interface SignUpKYCProps {
|
|
|
6
6
|
children?: ReactNode;
|
|
7
7
|
/** @default "/terms-and-conditions" */
|
|
8
8
|
termsAndConditionsUrl?: string;
|
|
9
|
+
termsOfUseContent?: ReactNode;
|
|
10
|
+
responsibleGamingContent?: ReactNode;
|
|
11
|
+
responsibleGamingLogo?: ImageProps['src'];
|
|
12
|
+
siteName?: string;
|
|
9
13
|
className?: string;
|
|
10
14
|
branches?: Branch[];
|
|
11
15
|
layout: 'kyc';
|
|
@@ -22,5 +22,5 @@ export function SignUpKYC(props) {
|
|
|
22
22
|
};
|
|
23
23
|
return (_jsx(SignUpKYCPropsProvider, { value: value, children: _jsx(Dialog.Root, { open: signUpStore.open, onOpenChange: (details) => {
|
|
24
24
|
signUpStore.setOpen(details.open);
|
|
25
|
-
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsx(Dialog.Content, { className: twMerge('bg-bg-primary-alt z-banner mx-auto flex h-full w-full flex-col items-start overflow-y-auto p-3xl pb-4xl lg:h-auto lg:w-fit lg:rounded-xl
|
|
25
|
+
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsx(Dialog.Content, { className: twMerge('bg-bg-primary-alt z-banner mx-auto flex h-full w-full flex-col items-start overflow-y-auto p-3xl pb-4xl lg:h-auto lg:w-fit lg:rounded-xl', props.className), children: _jsxs("div", { className: "h-full w-full lg:w-[400px]", children: [_jsx(CaptureIdDocument, {}), _jsx(CaptureSelfie, {}), _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(SignUpFormKYC, {}) })] }) }) })] }) }) }));
|
|
26
26
|
}
|