@akinon/next 1.24.0-rc.6 → 1.24.0
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 +9 -41
- package/api/auth.ts +2 -13
- package/bin/pz-install-plugins.js +0 -0
- package/bin/pz-install-theme.js +0 -0
- package/bin/pz-postbuild.js +0 -0
- package/bin/pz-postdev.js +0 -0
- package/bin/pz-postinstall.js +0 -0
- package/bin/pz-poststart.js +0 -0
- package/bin/pz-prebuild.js +0 -0
- package/bin/pz-predev.js +0 -0
- package/bin/pz-prestart.js +0 -0
- package/data/client/user.ts +0 -12
- package/data/urls.ts +0 -1
- package/package.json +2 -2
- package/sentry/index.ts +14 -20
- package/types/index.ts +0 -6
- package/utils/log.ts +47 -30
package/CHANGELOG.md
CHANGED
|
@@ -1,52 +1,20 @@
|
|
|
1
1
|
# @akinon/next
|
|
2
2
|
|
|
3
|
-
## 1.24.0
|
|
3
|
+
## 1.24.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## 1.24.0-rc.4
|
|
14
|
-
|
|
15
|
-
### Minor Changes
|
|
16
|
-
|
|
17
|
-
- 07927ac: ZERO-2457: Add more events for GTM tracking
|
|
18
|
-
|
|
19
|
-
## 1.24.0-rc.3
|
|
20
|
-
|
|
21
|
-
## 1.24.0-rc.2
|
|
22
|
-
|
|
23
|
-
### Patch Changes
|
|
24
|
-
|
|
25
|
-
- 8c7f5bc: ZERO-2440: Pipeline test
|
|
26
|
-
|
|
27
|
-
## 1.24.0-rc.1
|
|
28
|
-
|
|
29
|
-
### Patch Changes
|
|
30
|
-
|
|
31
|
-
- 9b10323: ZERO-2440: Add type declarations for @akinon/pz-otp modules
|
|
32
|
-
|
|
33
|
-
## 1.24.0-rc.0
|
|
34
|
-
|
|
35
|
-
### Minor Changes
|
|
36
|
-
|
|
37
|
-
- 8bc6085: ZERO-2472: RTK Query Invalidate
|
|
38
|
-
- 02a3c58: ZERO-2460: Breadcrumb checks for undefined values
|
|
39
|
-
- 0181251: ZERO-2440: move otp popup state to redux
|
|
40
|
-
- 07cc81a: Add infinite and more types to pagination
|
|
41
|
-
- 8d6caba: ZERO-2434: enhance error handling and logging in appFetch function
|
|
42
|
-
- b4452e9: ZERO-2463: Refactor Sentry initialization and add Sentry DSN option to settings
|
|
43
|
-
- b2da5e4: Revert ZERO-2435
|
|
7
|
+
- 8bc6085d: ZERO-2472: RTK Query Invalidate
|
|
8
|
+
- 02a3c58b: ZERO-2460: Breadcrumb checks for undefined values
|
|
9
|
+
- 01812512: ZERO-2440: move otp popup state to redux
|
|
10
|
+
- 07cc81a4: ZERO-2388: Add infinite and more types to pagination
|
|
11
|
+
- 8d6caba0: ZERO-2434: enhance error handling and logging in appFetch function
|
|
12
|
+
- 07927acb: ZERO-2457: Add more events for GTM tracking
|
|
44
13
|
|
|
45
14
|
### Patch Changes
|
|
46
15
|
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
- 2e9476c: ZERO-2434: remove error throwing in appFetch
|
|
16
|
+
- 9b103231: ZERO-2440: Add type declarations for @akinon/pz-otp modules
|
|
17
|
+
- 2e9476c7: ZERO-2434: remove error throwing in appFetch
|
|
50
18
|
|
|
51
19
|
## 1.23.0
|
|
52
20
|
|
package/api/auth.ts
CHANGED
|
@@ -199,8 +199,8 @@ const nextAuthOptions = (req: NextApiRequest, res: NextApiResponse) => {
|
|
|
199
199
|
);
|
|
200
200
|
|
|
201
201
|
const localeResults = req.headers.referer
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
.replace(baseUrl, '')
|
|
203
|
+
.match(urlLocaleMatcherRegex);
|
|
204
204
|
|
|
205
205
|
return `${baseUrl}${localeResults?.[0] || ''}${pathnameWithoutLocale}`;
|
|
206
206
|
}
|
|
@@ -220,17 +220,6 @@ const nextAuthOptions = (req: NextApiRequest, res: NextApiResponse) => {
|
|
|
220
220
|
pages: {
|
|
221
221
|
signIn: ROUTES.AUTH,
|
|
222
222
|
error: ROUTES.AUTH
|
|
223
|
-
},
|
|
224
|
-
cookies: {
|
|
225
|
-
sessionToken: {
|
|
226
|
-
name: `__Secure-next-auth.session-token`,
|
|
227
|
-
options: {
|
|
228
|
-
httpOnly: true,
|
|
229
|
-
sameSite: 'none',
|
|
230
|
-
path: '/',
|
|
231
|
-
secure: true
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
223
|
}
|
|
235
224
|
};
|
|
236
225
|
};
|
|
File without changes
|
package/bin/pz-install-theme.js
CHANGED
|
File without changes
|
package/bin/pz-postbuild.js
CHANGED
|
File without changes
|
package/bin/pz-postdev.js
CHANGED
|
File without changes
|
package/bin/pz-postinstall.js
CHANGED
|
File without changes
|
package/bin/pz-poststart.js
CHANGED
|
File without changes
|
package/bin/pz-prebuild.js
CHANGED
|
File without changes
|
package/bin/pz-predev.js
CHANGED
|
File without changes
|
package/bin/pz-prestart.js
CHANGED
|
File without changes
|
package/data/client/user.ts
CHANGED
|
@@ -71,17 +71,6 @@ const userApi = api.injectEndpoints({
|
|
|
71
71
|
body
|
|
72
72
|
})
|
|
73
73
|
}),
|
|
74
|
-
otpLogin: build.mutation<void, { phone: string }>({
|
|
75
|
-
query: ({ phone }) => ({
|
|
76
|
-
url: buildClientRequestUrl(user.otpLogin, {
|
|
77
|
-
contentType: 'application/json'
|
|
78
|
-
}),
|
|
79
|
-
method: 'POST',
|
|
80
|
-
body: {
|
|
81
|
-
phone
|
|
82
|
-
}
|
|
83
|
-
})
|
|
84
|
-
}),
|
|
85
74
|
changeEmailVerification: build.query<void, string>({
|
|
86
75
|
query: (token) => ({
|
|
87
76
|
url: buildClientRequestUrl(user.changeEmailVerification(token), {
|
|
@@ -121,7 +110,6 @@ export const {
|
|
|
121
110
|
useConfirmEmailVerificationQuery,
|
|
122
111
|
useValidateCaptchaMutation,
|
|
123
112
|
useLogoutMutation,
|
|
124
|
-
useOtpLoginMutation,
|
|
125
113
|
useForgotPasswordMutation,
|
|
126
114
|
useGetAnonymousTrackingMutation
|
|
127
115
|
} = userApi;
|
package/data/urls.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akinon/next",
|
|
3
3
|
"description": "Core package for Project Zero Next",
|
|
4
|
-
"version": "1.24.0
|
|
4
|
+
"version": "1.24.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@typescript-eslint/eslint-plugin": "6.7.4",
|
|
33
33
|
"@typescript-eslint/parser": "6.7.4",
|
|
34
34
|
"eslint": "^8.14.0",
|
|
35
|
-
"@akinon/eslint-plugin-projectzero": "1.24.0
|
|
35
|
+
"@akinon/eslint-plugin-projectzero": "1.24.0",
|
|
36
36
|
"eslint-config-prettier": "8.5.0"
|
|
37
37
|
}
|
|
38
38
|
}
|
package/sentry/index.ts
CHANGED
|
@@ -1,33 +1,27 @@
|
|
|
1
1
|
import * as Sentry from '@sentry/nextjs';
|
|
2
|
-
import settings from 'settings';
|
|
3
2
|
|
|
4
3
|
const SENTRY_DSN: string =
|
|
5
|
-
|
|
6
|
-
process.env.SENTRY_DSN ||
|
|
7
|
-
process.env.NEXT_PUBLIC_SENTRY_DSN;
|
|
4
|
+
process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN;
|
|
8
5
|
|
|
9
6
|
export const initSentry = (
|
|
10
7
|
type: 'Server' | 'Client' | 'Edge',
|
|
11
|
-
options: Sentry.BrowserOptions | Sentry.NodeOptions | Sentry.EdgeOptions = {
|
|
12
|
-
dsn: SENTRY_DSN,
|
|
13
|
-
integrations: [],
|
|
14
|
-
tracesSampleRate: 1.0
|
|
15
|
-
}
|
|
8
|
+
options: Sentry.BrowserOptions | Sentry.NodeOptions | Sentry.EdgeOptions = {}
|
|
16
9
|
) => {
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
// TODO: Handle options with ESLint rules
|
|
11
|
+
|
|
12
|
+
// TODO: Remove Zero Project DSN
|
|
13
|
+
|
|
14
|
+
Sentry.init({
|
|
15
|
+
dsn:
|
|
16
|
+
SENTRY_DSN ||
|
|
17
|
+
'https://d8558ef8997543deacf376c7d8d7cf4b@o64293.ingest.sentry.io/4504338423742464',
|
|
19
18
|
initialScope: {
|
|
20
19
|
tags: {
|
|
21
|
-
...((
|
|
22
|
-
options.initialScope as {
|
|
23
|
-
tags?: Record<string, string>;
|
|
24
|
-
}
|
|
25
|
-
)?.tags ?? {}),
|
|
26
20
|
APP_TYPE: 'ProjectZeroNext',
|
|
27
21
|
TYPE: type
|
|
28
22
|
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
},
|
|
24
|
+
tracesSampleRate: 1.0,
|
|
25
|
+
integrations: []
|
|
26
|
+
});
|
|
33
27
|
};
|
package/types/index.ts
CHANGED
|
@@ -71,12 +71,6 @@ export interface Currency {
|
|
|
71
71
|
|
|
72
72
|
export interface Settings {
|
|
73
73
|
commerceUrl: string;
|
|
74
|
-
/**
|
|
75
|
-
* This option allows you to track Sentry events on the client side, in addition to server and edge environments.
|
|
76
|
-
*
|
|
77
|
-
* It overrides process.env.NEXT_PUBLIC_SENTRY_DSN and process.env.SENTRY_DSN.
|
|
78
|
-
*/
|
|
79
|
-
sentryDsn?: string;
|
|
80
74
|
redis: {
|
|
81
75
|
defaultExpirationTime: number;
|
|
82
76
|
};
|
package/utils/log.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { trace } from '@opentelemetry/api';
|
|
2
|
-
|
|
3
1
|
enum LogLevel {
|
|
4
2
|
TRACE = 'trace',
|
|
5
3
|
DEBUG = 'debug',
|
|
@@ -80,42 +78,61 @@ const writeMsg = ({ level, message, payload }: Message) => {
|
|
|
80
78
|
}
|
|
81
79
|
};
|
|
82
80
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
const info: LoggerFn = (message, payload) => {
|
|
82
|
+
writeMsg({
|
|
83
|
+
level: LogLevel.INFO,
|
|
84
|
+
message,
|
|
85
|
+
payload
|
|
86
|
+
});
|
|
87
|
+
};
|
|
86
88
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
const error: LoggerFn = (message, payload) => {
|
|
90
|
+
writeMsg({
|
|
91
|
+
level: LogLevel.ERROR,
|
|
92
|
+
message,
|
|
93
|
+
payload
|
|
91
94
|
});
|
|
95
|
+
};
|
|
92
96
|
|
|
93
|
-
|
|
94
|
-
|
|
97
|
+
const warn: LoggerFn = (message, payload) => {
|
|
98
|
+
writeMsg({
|
|
99
|
+
level: LogLevel.WARN,
|
|
100
|
+
message,
|
|
101
|
+
payload
|
|
102
|
+
});
|
|
103
|
+
};
|
|
95
104
|
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
level,
|
|
105
|
+
const debug: LoggerFn = (message, payload) => {
|
|
106
|
+
writeMsg({
|
|
107
|
+
level: LogLevel.DEBUG,
|
|
99
108
|
message,
|
|
100
|
-
payload
|
|
101
|
-
};
|
|
109
|
+
payload
|
|
110
|
+
});
|
|
111
|
+
};
|
|
102
112
|
|
|
103
|
-
|
|
104
|
-
|
|
113
|
+
const trace: LoggerFn = (message, payload) => {
|
|
114
|
+
writeMsg({
|
|
115
|
+
level: LogLevel.TRACE,
|
|
116
|
+
message,
|
|
117
|
+
payload
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const fatal: LoggerFn = (message, payload) => {
|
|
122
|
+
writeMsg({
|
|
123
|
+
level: LogLevel.FATAL,
|
|
124
|
+
message,
|
|
125
|
+
payload
|
|
126
|
+
});
|
|
105
127
|
};
|
|
106
128
|
|
|
107
|
-
const logger
|
|
108
|
-
trace
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
error: (message, payload) =>
|
|
115
|
-
createLogAndSpan(LogLevel.ERROR, message, payload),
|
|
116
|
-
fatal: (message, payload) =>
|
|
117
|
-
createLogAndSpan(LogLevel.FATAL, message, payload),
|
|
118
|
-
silent: () => {}
|
|
129
|
+
const logger = {
|
|
130
|
+
trace,
|
|
131
|
+
debug,
|
|
132
|
+
info,
|
|
133
|
+
warn,
|
|
134
|
+
error,
|
|
135
|
+
fatal
|
|
119
136
|
};
|
|
120
137
|
|
|
121
138
|
export default logger;
|