@akinon/projectzero 1.92.0-rc.27 → 1.92.0-rc.29
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/CHANGELOG.md +4 -0
- package/app-template/CHANGELOG.md +48 -0
- package/app-template/package.json +20 -20
- package/app-template/src/types/index.ts +57 -3
- package/app-template/src/views/login/index.tsx +11 -10
- package/app-template/src/views/otp-login/index.tsx +11 -6
- package/app-template/src/views/register/index.tsx +15 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# projectzeronext
|
|
2
2
|
|
|
3
|
+
## 1.92.0-rc.29
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [e1aa030d]
|
|
8
|
+
- @akinon/next@1.92.0-rc.29
|
|
9
|
+
- @akinon/pz-akifast@1.92.0-rc.29
|
|
10
|
+
- @akinon/pz-b2b@1.92.0-rc.29
|
|
11
|
+
- @akinon/pz-basket-gift-pack@1.92.0-rc.29
|
|
12
|
+
- @akinon/pz-bkm@1.92.0-rc.29
|
|
13
|
+
- @akinon/pz-checkout-gift-pack@1.92.0-rc.29
|
|
14
|
+
- @akinon/pz-click-collect@1.92.0-rc.29
|
|
15
|
+
- @akinon/pz-credit-payment@1.92.0-rc.29
|
|
16
|
+
- @akinon/pz-gpay@1.92.0-rc.29
|
|
17
|
+
- @akinon/pz-hepsipay@1.92.0-rc.29
|
|
18
|
+
- @akinon/pz-masterpass@1.92.0-rc.29
|
|
19
|
+
- @akinon/pz-one-click-checkout@1.92.0-rc.29
|
|
20
|
+
- @akinon/pz-otp@1.92.0-rc.29
|
|
21
|
+
- @akinon/pz-pay-on-delivery@1.92.0-rc.29
|
|
22
|
+
- @akinon/pz-saved-card@1.92.0-rc.29
|
|
23
|
+
- @akinon/pz-similar-products@1.92.0-rc.29
|
|
24
|
+
- @akinon/pz-tabby-extension@1.92.0-rc.29
|
|
25
|
+
- @akinon/pz-tamara-extension@1.92.0-rc.29
|
|
26
|
+
|
|
27
|
+
## 1.92.0-rc.28
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [b09e5e3d]
|
|
32
|
+
- @akinon/pz-hepsipay@1.92.0-rc.28
|
|
33
|
+
- @akinon/next@1.92.0-rc.28
|
|
34
|
+
- @akinon/pz-akifast@1.92.0-rc.28
|
|
35
|
+
- @akinon/pz-b2b@1.92.0-rc.28
|
|
36
|
+
- @akinon/pz-basket-gift-pack@1.92.0-rc.28
|
|
37
|
+
- @akinon/pz-bkm@1.92.0-rc.28
|
|
38
|
+
- @akinon/pz-checkout-gift-pack@1.92.0-rc.28
|
|
39
|
+
- @akinon/pz-click-collect@1.92.0-rc.28
|
|
40
|
+
- @akinon/pz-credit-payment@1.92.0-rc.28
|
|
41
|
+
- @akinon/pz-gpay@1.92.0-rc.28
|
|
42
|
+
- @akinon/pz-masterpass@1.92.0-rc.28
|
|
43
|
+
- @akinon/pz-one-click-checkout@1.92.0-rc.28
|
|
44
|
+
- @akinon/pz-otp@1.92.0-rc.28
|
|
45
|
+
- @akinon/pz-pay-on-delivery@1.92.0-rc.28
|
|
46
|
+
- @akinon/pz-saved-card@1.92.0-rc.28
|
|
47
|
+
- @akinon/pz-similar-products@1.92.0-rc.28
|
|
48
|
+
- @akinon/pz-tabby-extension@1.92.0-rc.28
|
|
49
|
+
- @akinon/pz-tamara-extension@1.92.0-rc.28
|
|
50
|
+
|
|
3
51
|
## 1.92.0-rc.27
|
|
4
52
|
|
|
5
53
|
### Patch Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "projectzeronext",
|
|
3
|
-
"version": "1.92.0-rc.
|
|
3
|
+
"version": "1.92.0-rc.29",
|
|
4
4
|
"private": true,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -24,24 +24,24 @@
|
|
|
24
24
|
"test:middleware": "jest middleware-matcher.test.ts --bail"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@akinon/next": "1.92.0-rc.
|
|
28
|
-
"@akinon/pz-akifast": "1.92.0-rc.
|
|
29
|
-
"@akinon/pz-b2b": "1.92.0-rc.
|
|
30
|
-
"@akinon/pz-basket-gift-pack": "1.92.0-rc.
|
|
31
|
-
"@akinon/pz-bkm": "1.92.0-rc.
|
|
32
|
-
"@akinon/pz-checkout-gift-pack": "1.92.0-rc.
|
|
33
|
-
"@akinon/pz-click-collect": "1.92.0-rc.
|
|
34
|
-
"@akinon/pz-credit-payment": "1.92.0-rc.
|
|
35
|
-
"@akinon/pz-gpay": "1.92.0-rc.
|
|
36
|
-
"@akinon/pz-hepsipay": "1.92.0-rc.
|
|
37
|
-
"@akinon/pz-masterpass": "1.92.0-rc.
|
|
38
|
-
"@akinon/pz-one-click-checkout": "1.92.0-rc.
|
|
39
|
-
"@akinon/pz-otp": "1.92.0-rc.
|
|
40
|
-
"@akinon/pz-pay-on-delivery": "1.92.0-rc.
|
|
41
|
-
"@akinon/pz-saved-card": "1.92.0-rc.
|
|
42
|
-
"@akinon/pz-similar-products": "1.92.0-rc.
|
|
43
|
-
"@akinon/pz-tabby-extension": "1.92.0-rc.
|
|
44
|
-
"@akinon/pz-tamara-extension": "1.92.0-rc.
|
|
27
|
+
"@akinon/next": "1.92.0-rc.29",
|
|
28
|
+
"@akinon/pz-akifast": "1.92.0-rc.29",
|
|
29
|
+
"@akinon/pz-b2b": "1.92.0-rc.29",
|
|
30
|
+
"@akinon/pz-basket-gift-pack": "1.92.0-rc.29",
|
|
31
|
+
"@akinon/pz-bkm": "1.92.0-rc.29",
|
|
32
|
+
"@akinon/pz-checkout-gift-pack": "1.92.0-rc.29",
|
|
33
|
+
"@akinon/pz-click-collect": "1.92.0-rc.29",
|
|
34
|
+
"@akinon/pz-credit-payment": "1.92.0-rc.29",
|
|
35
|
+
"@akinon/pz-gpay": "1.92.0-rc.29",
|
|
36
|
+
"@akinon/pz-hepsipay": "1.92.0-rc.29",
|
|
37
|
+
"@akinon/pz-masterpass": "1.92.0-rc.29",
|
|
38
|
+
"@akinon/pz-one-click-checkout": "1.92.0-rc.29",
|
|
39
|
+
"@akinon/pz-otp": "1.92.0-rc.29",
|
|
40
|
+
"@akinon/pz-pay-on-delivery": "1.92.0-rc.29",
|
|
41
|
+
"@akinon/pz-saved-card": "1.92.0-rc.29",
|
|
42
|
+
"@akinon/pz-similar-products": "1.92.0-rc.29",
|
|
43
|
+
"@akinon/pz-tabby-extension": "1.92.0-rc.29",
|
|
44
|
+
"@akinon/pz-tamara-extension": "1.92.0-rc.29",
|
|
45
45
|
"@hookform/resolvers": "2.9.0",
|
|
46
46
|
"@next/third-parties": "14.1.0",
|
|
47
47
|
"@react-google-maps/api": "2.17.1",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"yup": "0.32.11"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@akinon/eslint-plugin-projectzero": "1.92.0-rc.
|
|
67
|
+
"@akinon/eslint-plugin-projectzero": "1.92.0-rc.29",
|
|
68
68
|
"@semantic-release/changelog": "6.0.2",
|
|
69
69
|
"@semantic-release/exec": "6.0.3",
|
|
70
70
|
"@semantic-release/git": "10.0.1",
|
|
@@ -1,4 +1,58 @@
|
|
|
1
1
|
export * from '@theme/types/widgets';
|
|
2
|
+
import { SignInOptions } from 'next-auth/react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Form types for authentication
|
|
6
|
+
*/
|
|
7
|
+
export enum FormType {
|
|
8
|
+
login = 'login',
|
|
9
|
+
register = 'register',
|
|
10
|
+
loyaltyRegister = 'loyaltyRegister',
|
|
11
|
+
otpLogin = 'otpLogin'
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Extended SignInOptions with additional form type support for Project Zero Next authentication
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* // For standard login
|
|
20
|
+
* signIn('default', {
|
|
21
|
+
* ...data,
|
|
22
|
+
* formType: FormType.login
|
|
23
|
+
* } as PzSignInOptions);
|
|
24
|
+
*
|
|
25
|
+
* // For standard user registration
|
|
26
|
+
* signIn('default', {
|
|
27
|
+
* ...data,
|
|
28
|
+
* formType: FormType.register
|
|
29
|
+
* } as PzSignInOptions);
|
|
30
|
+
*
|
|
31
|
+
* // For loyalty program registration
|
|
32
|
+
* signIn('default', {
|
|
33
|
+
* ...data,
|
|
34
|
+
* formType: FormType.loyaltyRegister
|
|
35
|
+
* } as PzSignInOptions);
|
|
36
|
+
*
|
|
37
|
+
* // For OTP login
|
|
38
|
+
* signIn('default', {
|
|
39
|
+
* ...data,
|
|
40
|
+
* formType: FormType.otpLogin
|
|
41
|
+
* } as PzSignInOptions);
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export interface PzSignInOptions extends SignInOptions {
|
|
45
|
+
/**
|
|
46
|
+
* Type of the authentication form being submitted
|
|
47
|
+
*
|
|
48
|
+
* Available options:
|
|
49
|
+
* - `FormType.login` - Standard email/password login
|
|
50
|
+
* - `FormType.register` - Standard user registration
|
|
51
|
+
* - `FormType.loyaltyRegister` - Loyalty program registration (use this for loyalty signups)
|
|
52
|
+
* - `FormType.otpLogin` - OTP-based login via SMS
|
|
53
|
+
*/
|
|
54
|
+
formType?: FormType;
|
|
55
|
+
}
|
|
2
56
|
|
|
3
57
|
export type RegisterFormType = {
|
|
4
58
|
email: string;
|
|
@@ -10,14 +64,14 @@ export type RegisterFormType = {
|
|
|
10
64
|
kvkk_confirm: boolean;
|
|
11
65
|
email_allowed: boolean;
|
|
12
66
|
sms_allowed: boolean;
|
|
13
|
-
formType:
|
|
67
|
+
formType: FormType;
|
|
14
68
|
locale: string;
|
|
15
69
|
};
|
|
16
70
|
|
|
17
71
|
export type LoginFormType = {
|
|
18
72
|
email: string;
|
|
19
73
|
password: string;
|
|
20
|
-
formType:
|
|
74
|
+
formType: FormType;
|
|
21
75
|
locale: string;
|
|
22
76
|
};
|
|
23
77
|
|
|
@@ -25,7 +79,7 @@ export type OtpLoginFormType = {
|
|
|
25
79
|
phone: string;
|
|
26
80
|
code?: string;
|
|
27
81
|
locale: string;
|
|
28
|
-
formType:
|
|
82
|
+
formType: FormType;
|
|
29
83
|
};
|
|
30
84
|
|
|
31
85
|
export enum WIDGET_TYPE {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { signIn
|
|
3
|
+
import { signIn } from 'next-auth/react';
|
|
4
4
|
import { useSearchParams } from 'next/navigation';
|
|
5
5
|
import { useState } from 'react';
|
|
6
6
|
import { ROUTES } from '@theme/routes';
|
|
7
|
-
import { LoginFormType } from '@theme/types';
|
|
7
|
+
import { LoginFormType, FormType, PzSignInOptions } from '@theme/types';
|
|
8
8
|
import { Button, Input, Link } from '@theme/components';
|
|
9
9
|
import { SubmitHandler, useForm } from 'react-hook-form';
|
|
10
10
|
import * as yup from 'yup';
|
|
@@ -79,8 +79,9 @@ export const Login = () => {
|
|
|
79
79
|
redirect: false,
|
|
80
80
|
callbackUrl: searchParams.get('callbackUrl') ?? '/',
|
|
81
81
|
captchaValidated,
|
|
82
|
-
...data
|
|
83
|
-
|
|
82
|
+
...data,
|
|
83
|
+
formType: FormType.login
|
|
84
|
+
} as PzSignInOptions);
|
|
84
85
|
|
|
85
86
|
if (loginResponse.error) {
|
|
86
87
|
const errors: AuthError[] = JSON.parse(loginResponse.error);
|
|
@@ -109,25 +110,25 @@ export const Login = () => {
|
|
|
109
110
|
try {
|
|
110
111
|
parsedValue = JSON.parse(item.value);
|
|
111
112
|
} catch {
|
|
112
|
-
parsedValue = [item.value];
|
|
113
|
+
parsedValue = [item.value];
|
|
113
114
|
}
|
|
114
115
|
} else {
|
|
115
|
-
parsedValue = item.value;
|
|
116
|
+
parsedValue = item.value;
|
|
116
117
|
}
|
|
117
118
|
|
|
118
119
|
if (Array.isArray(parsedValue)) {
|
|
119
120
|
setError(item.name as keyof LoginFormType, {
|
|
120
121
|
type: 'custom',
|
|
121
|
-
message: parsedValue.join(', ')
|
|
122
|
+
message: parsedValue.join(', ')
|
|
122
123
|
});
|
|
123
124
|
} else {
|
|
124
125
|
Object.keys(parsedValue).forEach((key) => {
|
|
125
126
|
const fieldName = key as keyof LoginFormType;
|
|
126
127
|
const errorMessages = parsedValue[key] as string[];
|
|
127
|
-
|
|
128
|
+
|
|
128
129
|
setError(fieldName, {
|
|
129
130
|
type: 'custom',
|
|
130
|
-
message: errorMessages.join(', ')
|
|
131
|
+
message: errorMessages.join(', ')
|
|
131
132
|
});
|
|
132
133
|
});
|
|
133
134
|
}
|
|
@@ -161,7 +162,7 @@ export const Login = () => {
|
|
|
161
162
|
method="post"
|
|
162
163
|
onSubmit={handleSubmit(onSubmit)}
|
|
163
164
|
>
|
|
164
|
-
<input type="hidden" value=
|
|
165
|
+
<input type="hidden" value={FormType.login} {...register('formType')} />
|
|
165
166
|
<input type="hidden" value={locale} {...register('locale')} />
|
|
166
167
|
|
|
167
168
|
<div className={clsx(errors.email ? 'mb-8' : 'mb-4')}>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { signIn
|
|
3
|
+
import { signIn } from 'next-auth/react';
|
|
4
4
|
import { useState } from 'react';
|
|
5
|
-
import { OtpLoginFormType } from '@theme/types';
|
|
5
|
+
import { OtpLoginFormType, FormType, PzSignInOptions } from '@theme/types';
|
|
6
6
|
import { Button, Input } from '@theme/components';
|
|
7
7
|
import { SubmitHandler, useForm } from 'react-hook-form';
|
|
8
8
|
import * as yup from 'yup';
|
|
@@ -47,8 +47,9 @@ export const OtpLogin = () => {
|
|
|
47
47
|
const loginResponse = await signIn('default', {
|
|
48
48
|
redirect: false,
|
|
49
49
|
callbackUrl: '/',
|
|
50
|
-
...data
|
|
51
|
-
|
|
50
|
+
...data,
|
|
51
|
+
formType: FormType.otpLogin
|
|
52
|
+
} as PzSignInOptions);
|
|
52
53
|
|
|
53
54
|
if (loginResponse.error) {
|
|
54
55
|
const errors: AuthError[] = JSON.parse(loginResponse.error);
|
|
@@ -100,7 +101,11 @@ export const OtpLogin = () => {
|
|
|
100
101
|
{t('auth.login.title_gsm')}
|
|
101
102
|
</h2>
|
|
102
103
|
<form onSubmit={handleSubmit(onSubmit)}>
|
|
103
|
-
<input
|
|
104
|
+
<input
|
|
105
|
+
type="hidden"
|
|
106
|
+
value={FormType.otpLogin}
|
|
107
|
+
{...register('formType')}
|
|
108
|
+
/>
|
|
104
109
|
<input type="hidden" value={locale} {...register('locale')} />
|
|
105
110
|
|
|
106
111
|
<div className="mb-4">
|
|
@@ -109,7 +114,7 @@ export const OtpLogin = () => {
|
|
|
109
114
|
className="h-14"
|
|
110
115
|
label={t('auth.login.form.phone.placeholder')}
|
|
111
116
|
type="tel"
|
|
112
|
-
format={user_phone_format.replace(
|
|
117
|
+
format={user_phone_format.replace(/9/g, '#')}
|
|
113
118
|
mask="_"
|
|
114
119
|
allowEmptyFormatting={true}
|
|
115
120
|
control={control}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
import { signIn
|
|
5
|
+
import { signIn } from 'next-auth/react';
|
|
6
6
|
import { useState } from 'react';
|
|
7
7
|
import { SubmitHandler, useForm } from 'react-hook-form';
|
|
8
8
|
import { useAppDispatch, useAppSelector } from '@akinon/next/redux/hooks';
|
|
9
|
-
import { RegisterFormType } from '@theme/types';
|
|
9
|
+
import { RegisterFormType, FormType, PzSignInOptions } from '@theme/types';
|
|
10
10
|
import { Button, Checkbox, Icon, Input, Modal } from '@theme/components';
|
|
11
11
|
import * as yup from 'yup';
|
|
12
12
|
import { useCaptcha, useLocalization, useRouter } from '@akinon/next/hooks';
|
|
@@ -125,8 +125,9 @@ export const Register = () => {
|
|
|
125
125
|
redirect: false,
|
|
126
126
|
callbackUrl: '/',
|
|
127
127
|
captchaValidated,
|
|
128
|
-
...data
|
|
129
|
-
|
|
128
|
+
...data,
|
|
129
|
+
formType: FormType.register
|
|
130
|
+
} as PzSignInOptions);
|
|
130
131
|
};
|
|
131
132
|
|
|
132
133
|
const onSubmit: SubmitHandler<RegisterFormType> = async (data) => {
|
|
@@ -143,7 +144,6 @@ export const Register = () => {
|
|
|
143
144
|
if (registerResponse.error) {
|
|
144
145
|
const errors: AuthError[] = JSON.parse(registerResponse.error);
|
|
145
146
|
|
|
146
|
-
|
|
147
147
|
if (errors.find((error) => error.type === 'captcha')) {
|
|
148
148
|
if (await validateCaptcha()) {
|
|
149
149
|
onSubmit(data);
|
|
@@ -171,25 +171,25 @@ export const Register = () => {
|
|
|
171
171
|
try {
|
|
172
172
|
parsedValue = JSON.parse(item.value);
|
|
173
173
|
} catch {
|
|
174
|
-
parsedValue = [item.value];
|
|
174
|
+
parsedValue = [item.value];
|
|
175
175
|
}
|
|
176
176
|
} else {
|
|
177
|
-
parsedValue = item.value;
|
|
177
|
+
parsedValue = item.value;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
if (Array.isArray(parsedValue)) {
|
|
181
181
|
setError(item.name as keyof RegisterFormType, {
|
|
182
182
|
type: 'custom',
|
|
183
|
-
message: parsedValue.join(', ')
|
|
183
|
+
message: parsedValue.join(', ')
|
|
184
184
|
});
|
|
185
185
|
} else {
|
|
186
186
|
Object.keys(parsedValue).forEach((key) => {
|
|
187
187
|
const fieldName = key as keyof RegisterFormType;
|
|
188
188
|
const errorMessages = parsedValue[key] as string[];
|
|
189
|
-
|
|
189
|
+
|
|
190
190
|
setError(fieldName, {
|
|
191
191
|
type: 'custom',
|
|
192
|
-
message: errorMessages.join(', ')
|
|
192
|
+
message: errorMessages.join(', ')
|
|
193
193
|
});
|
|
194
194
|
});
|
|
195
195
|
}
|
|
@@ -247,7 +247,11 @@ export const Register = () => {
|
|
|
247
247
|
</p>
|
|
248
248
|
|
|
249
249
|
<form onSubmit={handleSubmit(onSubmit)} className="flex flex-col gap-4">
|
|
250
|
-
<input
|
|
250
|
+
<input
|
|
251
|
+
type="hidden"
|
|
252
|
+
value={FormType.register}
|
|
253
|
+
{...register('formType')}
|
|
254
|
+
/>
|
|
251
255
|
<input type="hidden" value={locale} {...register('locale')} />
|
|
252
256
|
|
|
253
257
|
<div className={clsx({ 'mb-4': errors.email })}>
|