@akinon/next 1.26.0-rc.9 → 1.27.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 +4 -180
- package/api/auth.ts +0 -11
- package/api/client.ts +3 -15
- package/bin/pz-check-dependencies.js +1 -16
- package/bin/pz-predev.js +0 -1
- package/data/client/user.ts +2 -2
- package/middlewares/default.ts +0 -14
- package/middlewares/index.ts +0 -1
- package/middlewares/pretty-url.ts +0 -2
- package/package.json +3 -8
- package/sentry/index.ts +14 -20
- package/types/index.ts +0 -7
- package/utils/log.ts +3 -3
- package/bin/pz-check-env.js +0 -27
- package/bin/pz-install-extensions.js +0 -27
- package/utils/format-cookie-string.ts +0 -27
- package/utils/redirect.ts +0 -30
package/CHANGELOG.md
CHANGED
|
@@ -1,119 +1,19 @@
|
|
|
1
1
|
# @akinon/next
|
|
2
2
|
|
|
3
|
-
## 1.
|
|
3
|
+
## 1.27.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
- a7e432f: ZERO-2534: Fix for recapthca regex for replacing the special chars.
|
|
9
|
-
- 02fa342: ZERO-2507: Add web vitals endpoint
|
|
7
|
+
- 9b48372: ZERO-2564:fix eslint shortland warning
|
|
10
8
|
- 7e41bdc: BRDG-9158: Remove redirect-three-d page endpoint
|
|
11
|
-
- f0c23bc: ZERO-2135: add custom not found page
|
|
12
9
|
- 1289982: ZERO-2521: Add x-forwarded-for header to requests
|
|
13
|
-
- 3690d3b: ZERO-2485: Check ESLint peerDependency version
|
|
14
|
-
- 40ad73e: ZERO-2504: add cookie filter to api client request
|
|
15
|
-
- b4452e9: ZERO-2463: Refactor Sentry initialization and add Sentry DSN option to settings
|
|
16
|
-
- b2da5e4: Revert ZERO-2435
|
|
17
|
-
- f76f079: ZERO-2493: Add redirect util function
|
|
18
|
-
- d6d2533: ZERO-2560: Add installment count to masterpass payment forms
|
|
19
|
-
- ff89630: ZERO-2498: Add script for env control
|
|
20
|
-
|
|
21
|
-
### Patch Changes
|
|
22
|
-
|
|
23
|
-
- da1e501: ZERO-2296: Fix ROUTES import
|
|
24
|
-
- 073fbd2: ZERO-2503: Add check changeset control script
|
|
25
|
-
- 2e44646: ZERO-2434: Fix category URL in getCategoryDataHandler function
|
|
26
|
-
- 183674f: BRDG-9158: Handle locale prefix
|
|
27
|
-
- 8c7f5bc: ZERO-2440: Pipeline test
|
|
28
|
-
- Updated dependencies [073fbd2]
|
|
29
|
-
- @akinon/eslint-plugin-projectzero@1.26.0-rc.9
|
|
30
|
-
|
|
31
|
-
## 1.26.0-rc.8
|
|
32
|
-
|
|
33
|
-
### Minor Changes
|
|
34
|
-
|
|
35
|
-
- f0c23bc: ZERO-2135: add custom not found page
|
|
36
|
-
|
|
37
|
-
### Patch Changes
|
|
38
|
-
|
|
39
|
-
- @akinon/eslint-plugin-projectzero@1.26.0-rc.8
|
|
40
|
-
|
|
41
|
-
## 1.26.0-rc.7
|
|
42
|
-
|
|
43
|
-
### Patch Changes
|
|
44
|
-
|
|
45
|
-
- @akinon/eslint-plugin-projectzero@1.26.0-rc.7
|
|
46
|
-
|
|
47
|
-
## 1.26.0-rc.6
|
|
48
|
-
|
|
49
|
-
### Minor Changes
|
|
50
|
-
|
|
51
|
-
- 40ad73e: ZERO-2504: add cookie filter to api client request
|
|
52
|
-
|
|
53
|
-
### Patch Changes
|
|
54
|
-
|
|
55
|
-
- @akinon/eslint-plugin-projectzero@1.26.0-rc.6
|
|
56
|
-
|
|
57
|
-
## 1.26.0-rc.5
|
|
58
|
-
|
|
59
|
-
### Patch Changes
|
|
60
|
-
|
|
61
|
-
- @akinon/eslint-plugin-projectzero@1.26.0-rc.5
|
|
62
|
-
|
|
63
|
-
## 1.26.0-rc.4
|
|
64
|
-
|
|
65
|
-
### Patch Changes
|
|
66
|
-
|
|
67
|
-
- @akinon/eslint-plugin-projectzero@1.26.0-rc.4
|
|
68
|
-
|
|
69
|
-
## 1.26.0-rc.3
|
|
70
|
-
|
|
71
|
-
### Minor Changes
|
|
72
|
-
|
|
73
10
|
- d6d2533: ZERO-2560: Add installment count to masterpass payment forms
|
|
74
|
-
- ff89630: ZERO-2498: Add script for env control
|
|
75
|
-
|
|
76
|
-
### Patch Changes
|
|
77
|
-
|
|
78
|
-
- 073fbd2: ZERO-2503: Add check changeset control script
|
|
79
|
-
- Updated dependencies [073fbd2]
|
|
80
|
-
- @akinon/eslint-plugin-projectzero@1.26.0-rc.3
|
|
81
11
|
|
|
82
|
-
## 1.26.0
|
|
83
|
-
|
|
84
|
-
### Patch Changes
|
|
85
|
-
|
|
86
|
-
- @akinon/eslint-plugin-projectzero@1.26.0-rc.2
|
|
87
|
-
|
|
88
|
-
## 1.26.0-rc.1
|
|
89
|
-
|
|
90
|
-
### Minor Changes
|
|
91
|
-
|
|
92
|
-
- a7e432f: ZERO-2534: Fix for recapthca regex for replacing the special chars.
|
|
93
|
-
|
|
94
|
-
### Patch Changes
|
|
95
|
-
|
|
96
|
-
- @akinon/eslint-plugin-projectzero@1.26.0-rc.1
|
|
97
|
-
|
|
98
|
-
## 1.26.0-rc.0
|
|
12
|
+
## 1.26.0
|
|
99
13
|
|
|
100
14
|
### Minor Changes
|
|
101
15
|
|
|
102
|
-
-
|
|
103
|
-
- 7e41bdc: BRDG-9158: Remove redirect-three-d page endpoint
|
|
104
|
-
- 1289982: ZERO-2521: Add x-forwarded-for header to requests
|
|
105
|
-
- 3690d3b: ZERO-2485: Check ESLint peerDependency version
|
|
106
|
-
- b4452e9: ZERO-2463: Refactor Sentry initialization and add Sentry DSN option to settings
|
|
107
|
-
- b2da5e4: Revert ZERO-2435
|
|
108
|
-
- f76f079: ZERO-2493: Add redirect util function
|
|
109
|
-
|
|
110
|
-
### Patch Changes
|
|
111
|
-
|
|
112
|
-
- da1e501: ZERO-2296: Fix ROUTES import
|
|
113
|
-
- 2e44646: ZERO-2434: Fix category URL in getCategoryDataHandler function
|
|
114
|
-
- 183674f: BRDG-9158: Handle locale prefix
|
|
115
|
-
- 8c7f5bc: ZERO-2440: Pipeline test
|
|
116
|
-
- @akinon/eslint-plugin-projectzero@1.26.0-rc.0
|
|
16
|
+
- 02fa342: ZERO-2507: Add web vitals endpoint
|
|
117
17
|
|
|
118
18
|
## 1.25.0
|
|
119
19
|
|
|
@@ -132,83 +32,7 @@
|
|
|
132
32
|
|
|
133
33
|
### Patch Changes
|
|
134
34
|
|
|
135
|
-
- da1e501: ZERO-2296: Fix ROUTES import
|
|
136
|
-
- 2e44646: ZERO-2434: Fix category URL in getCategoryDataHandler function
|
|
137
|
-
- 183674f: BRDG-9158: Handle locale prefix
|
|
138
|
-
- 8c7f5bc: ZERO-2440: Pipeline test
|
|
139
|
-
- @akinon/eslint-plugin-projectzero@1.25.0-rc.5
|
|
140
|
-
|
|
141
|
-
## 1.25.0-rc.4
|
|
142
|
-
|
|
143
|
-
### Patch Changes
|
|
144
|
-
|
|
145
|
-
- 183674f: BRDG-9158: Handle locale prefix
|
|
146
|
-
- @akinon/eslint-plugin-projectzero@1.25.0-rc.4
|
|
147
|
-
|
|
148
|
-
## 1.25.0-rc.3
|
|
149
|
-
|
|
150
|
-
### Minor Changes
|
|
151
|
-
|
|
152
|
-
- 1289982: ZERO-2521: Add x-forwarded-for header to requests
|
|
153
|
-
|
|
154
|
-
### Patch Changes
|
|
155
|
-
|
|
156
|
-
- @akinon/eslint-plugin-projectzero@1.25.0-rc.3
|
|
157
|
-
|
|
158
|
-
## 1.25.0-rc.2
|
|
159
|
-
|
|
160
|
-
### Minor Changes
|
|
161
|
-
|
|
162
|
-
- 7e41bdc: BRDG-9158: Remove redirect-three-d page endpoint
|
|
163
|
-
|
|
164
|
-
### Patch Changes
|
|
165
|
-
|
|
166
|
-
- @akinon/eslint-plugin-projectzero@1.25.0-rc.2
|
|
167
|
-
|
|
168
|
-
## 1.25.0-rc.1
|
|
169
|
-
|
|
170
|
-
### Minor Changes
|
|
171
|
-
|
|
172
|
-
- 6d4aadb: ZERO-2476: Auto install recommendenent extension
|
|
173
|
-
- e20b27f: ZERO-2454:add otp login
|
|
174
|
-
- e0a945e: ZERO-2494:Add LiveCommerce for managing basket and product actions
|
|
175
|
-
- a4674c6: ZERO-2461: add optional chaining for referrer header and add locale value for redirect url
|
|
176
|
-
- 1ec9775: ZERO-2462:add custom span to logs
|
|
177
|
-
- ab5a493: ZERO-2475:add types [key: string]: any; for unknown attributes
|
|
178
|
-
- 3690d3b: ZERO-2485: Check ESLint peerDependency version
|
|
179
|
-
- 92094d4: ZERO-2477: Update Sentry version and add hideSourceMaps option
|
|
180
|
-
- b4452e9: ZERO-2463: Refactor Sentry initialization and add Sentry DSN option to settings
|
|
181
|
-
- b2da5e4: Revert ZERO-2435
|
|
182
|
-
- d3edd3a: ZERO-2499:add style prop in link component
|
|
183
|
-
- f76f079: ZERO-2493: Add redirect util function
|
|
184
|
-
|
|
185
|
-
### Patch Changes
|
|
186
|
-
|
|
187
|
-
- da1e501: ZERO-2296: Fix ROUTES import
|
|
188
35
|
- 95510c7: ZERO-2508: Enable rc branch pipeline and add check-publish-version step
|
|
189
|
-
- 2e44646: ZERO-2434: Fix category URL in getCategoryDataHandler function
|
|
190
|
-
- 8c7f5bc: ZERO-2440: Pipeline test
|
|
191
|
-
- Updated dependencies [95510c7]
|
|
192
|
-
- @akinon/eslint-plugin-projectzero@1.25.0-rc.1
|
|
193
|
-
|
|
194
|
-
## 1.25.0-rc.0
|
|
195
|
-
|
|
196
|
-
### Minor Changes
|
|
197
|
-
|
|
198
|
-
- 6d4aadb: ZERO-2476: Auto install recommendenent extension
|
|
199
|
-
- e20b27f: ZERO-2454:add otp login
|
|
200
|
-
- a4674c6: ZERO-2461: add optional chaining for referrer header and add locale value for redirect url
|
|
201
|
-
- 1ec9775: ZERO-2462:add custom span to logs
|
|
202
|
-
- 3690d3b: ZERO-2485: Check ESLint peerDependency version
|
|
203
|
-
- b4452e9: ZERO-2463: Refactor Sentry initialization and add Sentry DSN option to settings
|
|
204
|
-
- b2da5e4: Revert ZERO-2435
|
|
205
|
-
|
|
206
|
-
### Patch Changes
|
|
207
|
-
|
|
208
|
-
- da1e501: ZERO-2296: Fix ROUTES import
|
|
209
|
-
- 2e44646: ZERO-2434: Fix category URL in getCategoryDataHandler function
|
|
210
|
-
- 8c7f5bc: ZERO-2440: Pipeline test
|
|
211
|
-
- @akinon/eslint-plugin-projectzero@1.25.0-rc.0
|
|
212
36
|
|
|
213
37
|
## 1.24.0
|
|
214
38
|
|
package/api/auth.ts
CHANGED
|
@@ -229,17 +229,6 @@ const nextAuthOptions = (req: NextApiRequest, res: NextApiResponse) => {
|
|
|
229
229
|
pages: {
|
|
230
230
|
signIn: ROUTES.AUTH,
|
|
231
231
|
error: ROUTES.AUTH
|
|
232
|
-
},
|
|
233
|
-
cookies: {
|
|
234
|
-
sessionToken: {
|
|
235
|
-
name: `__Secure-next-auth.session-token`,
|
|
236
|
-
options: {
|
|
237
|
-
httpOnly: true,
|
|
238
|
-
sameSite: 'none',
|
|
239
|
-
path: '/',
|
|
240
|
-
secure: true
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
232
|
}
|
|
244
233
|
};
|
|
245
234
|
};
|
package/api/client.ts
CHANGED
|
@@ -2,8 +2,6 @@ import { ClientRequestOptions } from '../types';
|
|
|
2
2
|
import { NextResponse } from 'next/server';
|
|
3
3
|
import settings from 'settings';
|
|
4
4
|
import logger from '../utils/log';
|
|
5
|
-
import formatCookieString from '../utils/format-cookie-string';
|
|
6
|
-
import cookieParser from 'set-cookie-parser';
|
|
7
5
|
|
|
8
6
|
interface RouteParams {
|
|
9
7
|
params: {
|
|
@@ -133,21 +131,11 @@ async function proxyRequest(...args) {
|
|
|
133
131
|
);
|
|
134
132
|
}
|
|
135
133
|
|
|
136
|
-
const
|
|
137
|
-
const exceptCookieKeys = ['pz-locale', 'pz-currency'];
|
|
138
|
-
|
|
139
|
-
const isExcludedCookie = (name: string) => exceptCookieKeys.includes(name);
|
|
140
|
-
|
|
141
|
-
const filteredCookies = cookieParser
|
|
142
|
-
.parse(setCookieHeaders)
|
|
143
|
-
.filter((cookie) => !isExcludedCookie(cookie.name));
|
|
144
|
-
|
|
134
|
+
const setCookieHeader = request.headers.get('set-cookie');
|
|
145
135
|
const responseHeaders: any = {};
|
|
146
136
|
|
|
147
|
-
if (
|
|
148
|
-
responseHeaders['set-cookie'] =
|
|
149
|
-
.map(formatCookieString)
|
|
150
|
-
.join(', ');
|
|
137
|
+
if (setCookieHeader) {
|
|
138
|
+
responseHeaders['set-cookie'] = setCookieHeader;
|
|
151
139
|
}
|
|
152
140
|
|
|
153
141
|
const statusCode = new RegExp(/^20./).test(request.status.toString())
|
|
@@ -23,21 +23,6 @@ function checkDir() {
|
|
|
23
23
|
|
|
24
24
|
const BASE_DIR = checkDir();
|
|
25
25
|
|
|
26
|
-
function getProjectZeroNextPackagePath() {
|
|
27
|
-
const possiblePaths = [
|
|
28
|
-
path.join(BASE_DIR, 'apps/projectzeronext/package.json'),
|
|
29
|
-
path.join(BASE_DIR, 'package.json')
|
|
30
|
-
];
|
|
31
|
-
|
|
32
|
-
for (const packagePath of possiblePaths) {
|
|
33
|
-
if (fs.existsSync(packagePath)) {
|
|
34
|
-
return packagePath;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
throw new Error('Unable to find package.json in expected locations.');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
26
|
try {
|
|
42
27
|
const akinonNextPackagePath = fs.existsSync(
|
|
43
28
|
path.join(BASE_DIR, 'packages/akinon-next/package.json')
|
|
@@ -49,7 +34,7 @@ try {
|
|
|
49
34
|
fs.readFileSync(akinonNextPackagePath, 'utf8')
|
|
50
35
|
);
|
|
51
36
|
|
|
52
|
-
const projectZeroNextPackagePath =
|
|
37
|
+
const projectZeroNextPackagePath = path.join(BASE_DIR, 'package.json');
|
|
53
38
|
|
|
54
39
|
const projectZeroNextPackage = JSON.parse(
|
|
55
40
|
fs.readFileSync(projectZeroNextPackagePath, 'utf8')
|
package/bin/pz-predev.js
CHANGED
package/data/client/user.ts
CHANGED
|
@@ -22,9 +22,9 @@ const userApi = api.injectEndpoints({
|
|
|
22
22
|
getCaptcha: build.query<GetCaptchaResponse, void>({
|
|
23
23
|
query: () => buildClientRequestUrl(user.captcha),
|
|
24
24
|
transformResponse: (response: { html: string }) => {
|
|
25
|
-
const siteKeyMatch = response.html.match(/sitekey=["|']
|
|
25
|
+
const siteKeyMatch = response.html.match(/sitekey=["|']\w+/gi);
|
|
26
26
|
const csrfTokenMatch = response.html.match(
|
|
27
|
-
/name=['|"]csrfmiddlewaretoken['|"] value=['|"]
|
|
27
|
+
/name=['|"]csrfmiddlewaretoken['|"] value=['|"]\w+/gi
|
|
28
28
|
);
|
|
29
29
|
const siteKey = siteKeyMatch?.[0].replace(/sitekey=["|']/, '') || '';
|
|
30
30
|
const csrfToken =
|
package/middlewares/default.ts
CHANGED
|
@@ -153,7 +153,6 @@ const withPzDefault =
|
|
|
153
153
|
|
|
154
154
|
req.middlewareParams = {
|
|
155
155
|
commerceUrl,
|
|
156
|
-
found: true,
|
|
157
156
|
rewrites: {}
|
|
158
157
|
};
|
|
159
158
|
|
|
@@ -187,19 +186,6 @@ const withPzDefault =
|
|
|
187
186
|
locale.length ? `${locale}/` : ''
|
|
188
187
|
}${currency}${prettyUrl ?? pathnameWithoutLocale}`;
|
|
189
188
|
|
|
190
|
-
if (
|
|
191
|
-
!req.middlewareParams.found &&
|
|
192
|
-
Settings.customNotFoundEnabled
|
|
193
|
-
) {
|
|
194
|
-
let pathname = url.pathname
|
|
195
|
-
.replace(/\/+$/, '')
|
|
196
|
-
.split('/');
|
|
197
|
-
url.pathname = url.pathname.replace(
|
|
198
|
-
pathname.pop(),
|
|
199
|
-
'pz-not-found'
|
|
200
|
-
);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
189
|
Settings.rewrites.forEach((rewrite) => {
|
|
204
190
|
url.pathname = url.pathname.replace(
|
|
205
191
|
rewrite.source,
|
package/middlewares/index.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.
|
|
4
|
+
"version": "1.27.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -25,19 +25,14 @@
|
|
|
25
25
|
"react-redux": "8.1.3",
|
|
26
26
|
"react-string-replace": "1.1.1",
|
|
27
27
|
"redis": "4.5.1",
|
|
28
|
-
"semver": "7.5.4"
|
|
29
|
-
"set-cookie-parser": "2.6.0"
|
|
28
|
+
"semver": "7.5.4"
|
|
30
29
|
},
|
|
31
30
|
"devDependencies": {
|
|
32
|
-
"@akinon/eslint-plugin-projectzero": "1.24.0",
|
|
33
31
|
"@types/react-redux": "7.1.30",
|
|
34
|
-
"@types/set-cookie-parser": "2.4.7",
|
|
35
32
|
"@typescript-eslint/eslint-plugin": "6.7.4",
|
|
36
33
|
"@typescript-eslint/parser": "6.7.4",
|
|
37
34
|
"eslint": "^8.14.0",
|
|
35
|
+
"@akinon/eslint-plugin-projectzero": "1.24.0",
|
|
38
36
|
"eslint-config-prettier": "8.5.0"
|
|
39
|
-
},
|
|
40
|
-
"peerDependencies": {
|
|
41
|
-
"@akinon/eslint-plugin-projectzero": "1.24.0"
|
|
42
37
|
}
|
|
43
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
|
};
|
|
@@ -187,7 +181,6 @@ export interface Settings {
|
|
|
187
181
|
extraPaymentTypes?: string[];
|
|
188
182
|
masterpassJsUrl?: string;
|
|
189
183
|
};
|
|
190
|
-
customNotFoundEnabled: boolean;
|
|
191
184
|
}
|
|
192
185
|
|
|
193
186
|
export interface CacheOptions {
|
package/utils/log.ts
CHANGED
|
@@ -85,9 +85,9 @@ function createCustomSpan({ level, message, payload }: Message) {
|
|
|
85
85
|
const span = tracer.startSpan('custom-operation-log');
|
|
86
86
|
|
|
87
87
|
span.setAttributes({
|
|
88
|
-
level
|
|
89
|
-
message
|
|
90
|
-
payload
|
|
88
|
+
level,
|
|
89
|
+
message,
|
|
90
|
+
payload
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
span.end();
|
package/bin/pz-check-env.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
|
|
5
|
-
const invalidEnvList = [
|
|
6
|
-
{ key: 'NEXT_TELEMETRY_DISABLED', value: 1 },
|
|
7
|
-
{ key: 'OTEL_SDK_DISABLED', value: true }
|
|
8
|
-
];
|
|
9
|
-
|
|
10
|
-
function checkEnv(invalidEnvList) {
|
|
11
|
-
if (!fs.existsSync('.env')) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const envContent = fs.readFileSync('.env', 'utf8');
|
|
16
|
-
|
|
17
|
-
invalidEnvList.forEach(({ key, value }) => {
|
|
18
|
-
const env = `${key}=${value}`;
|
|
19
|
-
|
|
20
|
-
if (envContent.includes(env)) {
|
|
21
|
-
console.error(`Remove the ${key} environment variable`);
|
|
22
|
-
process.exit(1);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
checkEnv(invalidEnvList);
|
|
@@ -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
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export default function formatCookieString(cookieObj: Record<string, any>) {
|
|
2
|
-
const cookieParts = [`${cookieObj.name}=${cookieObj.value}`];
|
|
3
|
-
|
|
4
|
-
if (cookieObj.expires) {
|
|
5
|
-
cookieParts.push(`Expires=${cookieObj.expires.toUTCString()}`);
|
|
6
|
-
}
|
|
7
|
-
if (cookieObj.maxAge) {
|
|
8
|
-
cookieParts.push(`Max-Age=${cookieObj.maxAge}`);
|
|
9
|
-
}
|
|
10
|
-
if (cookieObj.path) {
|
|
11
|
-
cookieParts.push(`Path=${cookieObj.path}`);
|
|
12
|
-
}
|
|
13
|
-
if (cookieObj.domain) {
|
|
14
|
-
cookieParts.push(`Domain=${cookieObj.domain}`);
|
|
15
|
-
}
|
|
16
|
-
if (cookieObj.secure) {
|
|
17
|
-
cookieParts.push('Secure');
|
|
18
|
-
}
|
|
19
|
-
if (cookieObj.httpOnly) {
|
|
20
|
-
cookieParts.push('HttpOnly');
|
|
21
|
-
}
|
|
22
|
-
if (cookieObj.sameSite) {
|
|
23
|
-
cookieParts.push(`SameSite=${cookieObj.sameSite}`);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return cookieParts.join('; ');
|
|
27
|
-
}
|
package/utils/redirect.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { redirect as nextRedirect, RedirectType } from 'next/navigation';
|
|
2
|
-
import Settings from 'settings';
|
|
3
|
-
import { headers } from 'next/headers';
|
|
4
|
-
import { ServerVariables } from '@akinon/next/utils/server-variables';
|
|
5
|
-
import { getUrlPathWithLocale } from '@akinon/next/utils/localization';
|
|
6
|
-
|
|
7
|
-
export const redirect = (path: string, type?: RedirectType) => {
|
|
8
|
-
const nextHeaders = headers();
|
|
9
|
-
const pageUrl = new URL(
|
|
10
|
-
nextHeaders.get('pz-url') ?? process.env.NEXT_PUBLIC_URL
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
const currentLocale = Settings.localization.locales.find(
|
|
14
|
-
(locale) => locale.value === ServerVariables.locale
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
const callbackUrl = pageUrl.pathname;
|
|
18
|
-
const redirectUrlWithLocale = getUrlPathWithLocale(
|
|
19
|
-
path,
|
|
20
|
-
currentLocale.localePath ?? currentLocale.value
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
const redirectUrl = `${redirectUrlWithLocale}?callbackUrl=${callbackUrl}`;
|
|
24
|
-
|
|
25
|
-
if (type) {
|
|
26
|
-
return nextRedirect(redirectUrl, type);
|
|
27
|
-
} else {
|
|
28
|
-
return nextRedirect(redirectUrl);
|
|
29
|
-
}
|
|
30
|
-
};
|