@akinon/next 1.24.0-rc.7 → 1.24.1
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 +11 -44
- package/api/auth.ts +2 -13
- package/bin/pz-check-dependencies.js +1 -62
- 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 -2
- 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/bin/pz-install-extensions.js +0 -27
package/CHANGELOG.md
CHANGED
|
@@ -1,59 +1,26 @@
|
|
|
1
1
|
# @akinon/next
|
|
2
2
|
|
|
3
|
-
## 1.24.
|
|
4
|
-
|
|
5
|
-
### Minor Changes
|
|
6
|
-
|
|
7
|
-
- 6d4aadb9: ZERO-2476: Auto install recommendenent extension
|
|
8
|
-
- 3690d3bd: ZERO-2485: Eslint version dynamically adds as a peerdependinciey and checks the version
|
|
9
|
-
|
|
10
|
-
## 1.24.0-rc.6
|
|
11
|
-
|
|
12
|
-
### Minor Changes
|
|
13
|
-
|
|
14
|
-
- e20b27f: ZERO-2454:add otp login
|
|
15
|
-
- a4674c6: ZERO-2461: add optional chaining for referrer header and add locale value for redirect url
|
|
16
|
-
- 1ec9775: ZERO-2462:add custom span to logs
|
|
17
|
-
|
|
18
|
-
## 1.24.0-rc.5
|
|
19
|
-
|
|
20
|
-
## 1.24.0-rc.4
|
|
21
|
-
|
|
22
|
-
### Minor Changes
|
|
23
|
-
|
|
24
|
-
- 07927ac: ZERO-2457: Add more events for GTM tracking
|
|
25
|
-
|
|
26
|
-
## 1.24.0-rc.3
|
|
27
|
-
|
|
28
|
-
## 1.24.0-rc.2
|
|
29
|
-
|
|
30
|
-
### Patch Changes
|
|
31
|
-
|
|
32
|
-
- 8c7f5bc: ZERO-2440: Pipeline test
|
|
33
|
-
|
|
34
|
-
## 1.24.0-rc.1
|
|
3
|
+
## 1.24.1
|
|
35
4
|
|
|
36
5
|
### Patch Changes
|
|
37
6
|
|
|
38
|
-
-
|
|
7
|
+
- 95510c7: ZERO-2508: Enable rc branch pipeline and add check-publish-version step
|
|
39
8
|
|
|
40
|
-
## 1.24.0
|
|
9
|
+
## 1.24.0
|
|
41
10
|
|
|
42
11
|
### Minor Changes
|
|
43
12
|
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
- b2da5e4: Revert ZERO-2435
|
|
13
|
+
- 8bc6085d: ZERO-2472: RTK Query Invalidate
|
|
14
|
+
- 02a3c58b: ZERO-2460: Breadcrumb checks for undefined values
|
|
15
|
+
- 01812512: ZERO-2440: move otp popup state to redux
|
|
16
|
+
- 07cc81a4: ZERO-2388: Add infinite and more types to pagination
|
|
17
|
+
- 8d6caba0: ZERO-2434: enhance error handling and logging in appFetch function
|
|
18
|
+
- 07927acb: ZERO-2457: Add more events for GTM tracking
|
|
51
19
|
|
|
52
20
|
### Patch Changes
|
|
53
21
|
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
- 2e9476c: ZERO-2434: remove error throwing in appFetch
|
|
22
|
+
- 9b103231: ZERO-2440: Add type declarations for @akinon/pz-otp modules
|
|
23
|
+
- 2e9476c7: ZERO-2434: remove error throwing in appFetch
|
|
57
24
|
|
|
58
25
|
## 1.23.0
|
|
59
26
|
|
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
|
};
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const semver = require('semver');
|
|
6
|
-
const { execSync } = require('child_process');
|
|
7
6
|
|
|
8
7
|
function checkDir() {
|
|
9
8
|
let currentDir = __dirname;
|
|
@@ -22,50 +21,8 @@ function checkDir() {
|
|
|
22
21
|
return path.resolve(__dirname, '../../../../');
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
function getCurrentBranchName() {
|
|
26
|
-
try {
|
|
27
|
-
return execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
|
|
28
|
-
} catch (error) {
|
|
29
|
-
console.error(`Error fetching current branch name: ${error}`);
|
|
30
|
-
process.exit(1);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function fetchLatestPackageVersion(packageName) {
|
|
35
|
-
const currentBranch = getCurrentBranchName();
|
|
36
|
-
let npmShowCommand = `npm show ${packageName} version`;
|
|
37
|
-
|
|
38
|
-
if (currentBranch === 'rc') {
|
|
39
|
-
npmShowCommand = `npm show ${packageName}@rc version`;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
try {
|
|
43
|
-
return execSync(npmShowCommand).toString().trim();
|
|
44
|
-
} catch (error) {
|
|
45
|
-
console.error(
|
|
46
|
-
`Error fetching latest version for package ${packageName}: ${error}`
|
|
47
|
-
);
|
|
48
|
-
process.exit(1);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
24
|
const BASE_DIR = checkDir();
|
|
53
25
|
|
|
54
|
-
function getProjectZeroNextPackagePath() {
|
|
55
|
-
const possiblePaths = [
|
|
56
|
-
path.join(BASE_DIR, 'apps/projectzeronext/package.json'),
|
|
57
|
-
path.join(BASE_DIR, 'package.json')
|
|
58
|
-
];
|
|
59
|
-
|
|
60
|
-
for (const packagePath of possiblePaths) {
|
|
61
|
-
if (fs.existsSync(packagePath)) {
|
|
62
|
-
return packagePath;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
throw new Error('Unable to find package.json in expected locations.');
|
|
67
|
-
}
|
|
68
|
-
|
|
69
26
|
try {
|
|
70
27
|
const akinonNextPackagePath = fs.existsSync(
|
|
71
28
|
path.join(BASE_DIR, 'packages/akinon-next/package.json')
|
|
@@ -77,30 +34,12 @@ try {
|
|
|
77
34
|
fs.readFileSync(akinonNextPackagePath, 'utf8')
|
|
78
35
|
);
|
|
79
36
|
|
|
80
|
-
const projectZeroNextPackagePath =
|
|
37
|
+
const projectZeroNextPackagePath = path.join(BASE_DIR, 'package.json');
|
|
81
38
|
|
|
82
39
|
const projectZeroNextPackage = JSON.parse(
|
|
83
40
|
fs.readFileSync(projectZeroNextPackagePath, 'utf8')
|
|
84
41
|
);
|
|
85
42
|
|
|
86
|
-
const eslintPluginLatestVersion = fetchLatestPackageVersion(
|
|
87
|
-
'@akinon/eslint-plugin-projectzero'
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
akinonNextPackage.peerDependencies = {
|
|
91
|
-
...akinonNextPackage.peerDependencies,
|
|
92
|
-
'@akinon/eslint-plugin-projectzero': `${eslintPluginLatestVersion}`
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
fs.writeFileSync(
|
|
96
|
-
akinonNextPackagePath,
|
|
97
|
-
JSON.stringify(akinonNextPackage, null, 2) + '\n'
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
console.log(
|
|
101
|
-
'@akinon/next peerDependencies updated with the latest @akinon/eslint-plugin-projectzero version'
|
|
102
|
-
);
|
|
103
|
-
|
|
104
43
|
const { peerDependencies } = akinonNextPackage;
|
|
105
44
|
|
|
106
45
|
let hasErrors = false;
|
|
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
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.
|
|
4
|
+
"version": "1.24.1",
|
|
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;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const { execSync } = require('child_process');
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
|
|
5
|
-
function findBaseDir() {
|
|
6
|
-
let currentDir = __dirname;
|
|
7
|
-
while (currentDir !== path.resolve(currentDir, '..')) {
|
|
8
|
-
if (fs.existsSync(path.join(currentDir, 'turbo.json'))) {
|
|
9
|
-
return currentDir;
|
|
10
|
-
}
|
|
11
|
-
currentDir = path.resolve(currentDir, '..');
|
|
12
|
-
}
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const BASE_DIR = findBaseDir();
|
|
17
|
-
|
|
18
|
-
if (BASE_DIR) {
|
|
19
|
-
const extensions = ['bilal-akinon.pznext'];
|
|
20
|
-
extensions.forEach((extension) => {
|
|
21
|
-
try {
|
|
22
|
-
execSync(`code --install-extension ${extension}`, { stdio: 'inherit' });
|
|
23
|
-
} catch (error) {
|
|
24
|
-
console.error(`Error installing ${extension}:`);
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|