@opexa/portal-components 0.0.532 → 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.
- package/dist/client/hooks/useSignUpByNameMutation.d.ts +1 -1
- package/dist/client/hooks/useSignUpByNameMutation.js +3 -9
- package/dist/components/SignUp/SignUpNameAndPassword/SignUpNameAndPasswordForm.js +8 -13
- package/dist/services/account.d.ts +3 -4
- package/dist/services/account.js +4 -5
- package/dist/services/queries.d.ts +1 -1
- package/dist/services/queries.js +2 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type RegisterMemberAccountByNameInput } from '../../services/account';
|
|
2
2
|
import type { Mutation } from '../../types';
|
|
3
|
-
export interface SignUpByNameMutationInput extends Omit<RegisterMemberAccountByNameInput, '
|
|
3
|
+
export interface SignUpByNameMutationInput extends Omit<RegisterMemberAccountByNameInput, 'reCAPTCHAResponse' | 'cellxpertCxd'> {
|
|
4
4
|
}
|
|
5
5
|
export declare const useSignUpByNameMutation: Mutation<void, SignUpByNameMutationInput>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useMutation } from '@tanstack/react-query';
|
|
2
2
|
import { useReCaptcha } from 'next-recaptcha-v3';
|
|
3
|
-
import { RECAPTCHA_HEADER_KEY } from '../../constants/index.js';
|
|
4
3
|
import { registerMemberAccountByName, } from '../../services/account.js';
|
|
5
4
|
import { getSignUpMutationKey } from '../../utils/mutationKeys.js';
|
|
6
5
|
import { getSession } from '../services/getSession.js';
|
|
@@ -13,22 +12,17 @@ export const useSignUpByNameMutation = (config) => {
|
|
|
13
12
|
mutationKey: getSignUpMutationKey(),
|
|
14
13
|
mutationFn: async (input) => {
|
|
15
14
|
const session = await getSession();
|
|
16
|
-
const
|
|
15
|
+
const reCAPTCHAResponse = recaptcha.reCaptchaKey
|
|
17
16
|
? await recaptcha.executeRecaptcha('submit')
|
|
18
|
-
:
|
|
17
|
+
: '';
|
|
19
18
|
return await registerMemberAccountByName({
|
|
20
19
|
...input,
|
|
21
|
-
...(session.btag && {
|
|
22
|
-
btag: session.btag,
|
|
23
|
-
}),
|
|
24
20
|
...(cellxpertCxd && {
|
|
25
21
|
cellxpertCxd: cellxpertCxd.value,
|
|
26
22
|
}),
|
|
23
|
+
reCAPTCHAResponse,
|
|
27
24
|
}, {
|
|
28
25
|
headers: {
|
|
29
|
-
...(token && {
|
|
30
|
-
[RECAPTCHA_HEADER_KEY]: token,
|
|
31
|
-
}),
|
|
32
26
|
...(session.domain && {
|
|
33
27
|
Domain: session.domain,
|
|
34
28
|
}),
|
|
@@ -5,7 +5,7 @@ import { zodResolver } from '@hookform/resolvers/zod';
|
|
|
5
5
|
import { ObjectId } from '@opexa/object-id';
|
|
6
6
|
import { differenceInYears, format } from 'date-fns';
|
|
7
7
|
import Image from 'next/image';
|
|
8
|
-
import { useRouter
|
|
8
|
+
import { useRouter } from 'next/navigation';
|
|
9
9
|
import { Controller, useForm } from 'react-hook-form';
|
|
10
10
|
import { twMerge } from 'tailwind-merge';
|
|
11
11
|
import { z } from 'zod';
|
|
@@ -24,7 +24,6 @@ import { HelpCircleIcon } from '../../../icons/HelpCircleIcon.js';
|
|
|
24
24
|
import pagcorLogo from '../../../images/pagcor-round-icon.png';
|
|
25
25
|
import responsibleGamingLogo from '../../../images/responsible-gaming-gold.png';
|
|
26
26
|
import { ObjectType } from '../../../services/ObjectType.js';
|
|
27
|
-
import { sha256 } from '../../../services/sha256.js';
|
|
28
27
|
import { Button } from '../../../ui/Button/index.js';
|
|
29
28
|
import { Checkbox } from '../../../ui/Checkbox/index.js';
|
|
30
29
|
import { DatePicker } from '../../../ui/DatePicker/index.js';
|
|
@@ -43,7 +42,6 @@ export function SignUpNameAndPasswordForm() {
|
|
|
43
42
|
itemToString: (item) => `${item.code} - ${item.name}`,
|
|
44
43
|
});
|
|
45
44
|
const router = useRouter();
|
|
46
|
-
const search = useSearchParams();
|
|
47
45
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
48
46
|
kycReminder: ctx.kycReminder,
|
|
49
47
|
signIn: ctx.signIn,
|
|
@@ -129,26 +127,23 @@ export function SignUpNameAndPasswordForm() {
|
|
|
129
127
|
});
|
|
130
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) => {
|
|
131
129
|
const id = ObjectId.generate(ObjectType.MemberAccount).toString();
|
|
132
|
-
const name = data.name;
|
|
133
|
-
const password = await sha256(data.password);
|
|
134
130
|
try {
|
|
135
131
|
await signUpMutation.mutateAsync({
|
|
136
132
|
id,
|
|
137
|
-
name,
|
|
138
|
-
password,
|
|
133
|
+
name: data.name,
|
|
134
|
+
password: data.password,
|
|
139
135
|
realName: `${data.firstName} ${data.lastName}`,
|
|
140
|
-
|
|
136
|
+
dateOfBirth: format(data.birthDay, 'yyyy-MM-dd'),
|
|
141
137
|
branchCode: signUpProps?.branches?.length && data.branchCode
|
|
142
138
|
? data.branchCode
|
|
143
|
-
:
|
|
144
|
-
referralCode: search.get('referralCode') ?? undefined,
|
|
139
|
+
: undefined,
|
|
145
140
|
});
|
|
146
141
|
const pollLogin = createPoll(async () => {
|
|
147
142
|
try {
|
|
148
143
|
await signInMutation.mutateAsync({
|
|
149
144
|
type: 'NAME_AND_PASSWORD',
|
|
150
|
-
name,
|
|
151
|
-
password,
|
|
145
|
+
name: data.name,
|
|
146
|
+
password: data.password,
|
|
152
147
|
});
|
|
153
148
|
return true;
|
|
154
149
|
}
|
|
@@ -173,7 +168,7 @@ export function SignUpNameAndPasswordForm() {
|
|
|
173
168
|
description: error instanceof Error ? error.message : 'Something went wrong',
|
|
174
169
|
});
|
|
175
170
|
}
|
|
176
|
-
}), 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, { 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) => {
|
|
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) => {
|
|
177
172
|
if (!value)
|
|
178
173
|
return;
|
|
179
174
|
form.setValue('birthDay', value, {
|
|
@@ -118,13 +118,12 @@ export interface RegisterMemberAccountByNameMutationVariables {
|
|
|
118
118
|
id: string;
|
|
119
119
|
name: string;
|
|
120
120
|
password: string;
|
|
121
|
-
btag?: string;
|
|
122
|
-
cellxpertCxd?: string;
|
|
123
121
|
realName?: string;
|
|
124
|
-
|
|
122
|
+
dateOfBirth?: string;
|
|
125
123
|
branchCode?: string;
|
|
124
|
+
cellxpertCxd?: string;
|
|
126
125
|
};
|
|
127
|
-
|
|
126
|
+
reCAPTCHAResponse: string;
|
|
128
127
|
}
|
|
129
128
|
export interface RegisterMemberAccountByNameMutation {
|
|
130
129
|
registerMemberAccountByName?: null | RegisterMemberAccountByNameError;
|
package/dist/services/account.js
CHANGED
|
@@ -82,14 +82,13 @@ export const registerMemberAccountByName = async (input, options) => {
|
|
|
82
82
|
input: {
|
|
83
83
|
id: input.id,
|
|
84
84
|
name: input.name,
|
|
85
|
-
password: input.password,
|
|
86
|
-
btag: input.btag,
|
|
87
|
-
cellxpertCxd: input.cellxpertCxd,
|
|
85
|
+
password: await sha256(input.password),
|
|
88
86
|
realName: input.realName,
|
|
89
|
-
|
|
87
|
+
dateOfBirth: input.dateOfBirth,
|
|
90
88
|
branchCode: input.branchCode,
|
|
89
|
+
cellxpertCxd: input.cellxpertCxd,
|
|
91
90
|
},
|
|
92
|
-
|
|
91
|
+
reCAPTCHAResponse: input.reCAPTCHAResponse,
|
|
93
92
|
}, options);
|
|
94
93
|
if (res.registerMemberAccountByName) {
|
|
95
94
|
const error = new Error();
|
|
@@ -71,7 +71,7 @@ export declare const MEMBER = "\n query Member {\n member {\n dateTimeL
|
|
|
71
71
|
export declare const MEMBER_ACCOUNT = "\n query MemberAccount {\n memberAccount: self {\n ... on MemberAccount {\n id\n name\n status\n realName\n emailAddress\n mobileNumber\n birthDay\n verified\n verificationStatus\n nickName\n validId\n mobileNumberVerified\n mobileNumberVerificationRequired\n transactionPassword\n secretAnswerSubmitted\n dateTimeCreated\n dateTimeLastUpdated\n googleId\n facebookId\n cellxpertDetails {\n cxd\n dateTimeLastUpdated\n }\n }\n }\n }\n";
|
|
72
72
|
export declare const MEMBER_VERIFICATION = "\n \n fragment FileFragment on File {\n id\n url\n status\n }\n\n\n query MemberVerification {\n memberAccount: self {\n ... on MemberAccount {\n verification {\n id\n status\n address\n permanentAddress\n sourceOfIncome\n natureOfWork\n nationality\n placeOfBirth\n idFrontImage {\n ...FileFragment\n }\n selfieImage {\n ...FileFragment\n }\n sumsubVerified\n }\n }\n }\n }\n";
|
|
73
73
|
export declare const REGISTER_MEMBER_ACCOUNT = "\n mutation RegisterMemberAccount(\n $input: RegisterMemberAccountInput!\n $referralCode: String\n $verificationCode: String\n $reCAPTCHAResponse: String\n ) {\n registerMemberAccount(\n input: $input\n referralCode: $referralCode\n verificationCode: $verificationCode\n reCAPTCHAResponse: $reCAPTCHAResponse\n ) {\n ... on AccountNameNotAvailableError {\n name: __typename\n message\n }\n ... on InvalidPlatformError {\n name: __typename\n message\n }\n ... on InvalidPlatformError {\n name: __typename\n message\n }\n ... on InvalidReCAPTCHAResponseError {\n name: __typename\n message\n }\n ... on InvalidSMSVerificationCodeError {\n name: __typename\n message\n }\n ... on MinimumAgeRequirementError {\n name: __typename\n message\n }\n ... on MobileNumberNotAvailableError {\n name: __typename\n message\n }\n ... on ReCAPTCHAVerificationFailedError {\n name: __typename\n message\n }\n }\n }\n";
|
|
74
|
-
export declare const REGISTER_MEMBER_ACCOUNT_BY_NAME = "\n mutation RegisterMemberAccountByName(\n $input: RegisterMemberAccountByNameInput!\n $
|
|
74
|
+
export declare const REGISTER_MEMBER_ACCOUNT_BY_NAME = "\n mutation RegisterMemberAccountByName(\n $input: RegisterMemberAccountByNameInput!\n $reCAPTCHAResponse: String!\n ) {\n registerMemberAccountByName(\n input: $input\n reCAPTCHAResponse: $reCAPTCHAResponse\n ) {\n ... on AccountNameNotAvailableError {\n name: __typename\n message\n }\n ... on InvalidPlatformError {\n name: __typename\n message\n }\n ... on InvalidReCAPTCHAResponseError {\n name: __typename\n message\n }\n }\n }\n";
|
|
75
75
|
export declare const REGISTER_MEMBER_ACCOUNT_VIA_MOBILE = "\n mutation RegisterMemberAccountViaMobile(\n $input: RegisterMemberAccountViaMobileInput!\n $referralCode: String\n $reCAPTCHAResponse: String\n $verificationCode: String\n ) {\n registerMemberAccountViaMobile(\n input: $input\n referralCode: $referralCode\n verificationCode: $verificationCode\n reCAPTCHAResponse: $reCAPTCHAResponse\n ) {\n ... on InvalidPlatformError {\n name: __typename\n message\n }\n ... on InvalidReCAPTCHAResponseError {\n name: __typename\n message\n }\n ... on InvalidSMSVerificationCodeError {\n name: __typename\n message\n }\n ... on MobileNumberNotAvailableError {\n name: __typename\n message\n }\n ... on ReCAPTCHAVerificationFailedError {\n name: __typename\n message\n }\n }\n }\n";
|
|
76
76
|
export declare const REGISTER_MEMBER_ACCOUNT__NEXT = "\n mutation RegisterMemberAccount(\n $input: RegisterMemberAccountInput_next!\n $reCAPTCHAResponse: String\n ) {\n registerMemberAccount: registerMemberAccount_next(\n input: $input\n reCAPTCHAResponse: $reCAPTCHAResponse\n ) {\n ... on AccountNameNotAvailableError {\n name: __typename\n message\n }\n ... on InvalidPlatformError {\n name: __typename\n message\n }\n ... on InvalidReCAPTCHAResponseError {\n name: __typename\n message\n }\n ... on InvalidSMSVerificationCodeError {\n name: __typename\n message\n }\n ... on MinimumAgeRequirementError {\n name: __typename\n message\n }\n ... on MobileNumberNotAvailableError {\n name: __typename\n message\n }\n ... on ReCAPTCHAVerificationFailedError {\n name: __typename\n message\n }\n }\n }\n";
|
|
77
77
|
export declare const REGISTER_MAYA_MEMBER_ACCOUNT = "\n mutation RegisterMayaMemberAccount($input: RegisterMayaMemberAccountInput!) {\n registerMayaMemberAccount(input: $input) {\n ... on AccountNameNotAvailableError {\n name: __typename\n message\n }\n }\n }\n";
|
package/dist/services/queries.js
CHANGED
|
@@ -1699,11 +1699,11 @@ export const REGISTER_MEMBER_ACCOUNT = /* GraphQL */ `
|
|
|
1699
1699
|
export const REGISTER_MEMBER_ACCOUNT_BY_NAME = /* GraphQL */ `
|
|
1700
1700
|
mutation RegisterMemberAccountByName(
|
|
1701
1701
|
$input: RegisterMemberAccountByNameInput!
|
|
1702
|
-
$
|
|
1702
|
+
$reCAPTCHAResponse: String!
|
|
1703
1703
|
) {
|
|
1704
1704
|
registerMemberAccountByName(
|
|
1705
1705
|
input: $input
|
|
1706
|
-
|
|
1706
|
+
reCAPTCHAResponse: $reCAPTCHAResponse
|
|
1707
1707
|
) {
|
|
1708
1708
|
... on AccountNameNotAvailableError {
|
|
1709
1709
|
name: __typename
|