@akinon/next 1.59.0-rc.0 → 1.59.0-rc.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 +6 -0
- package/middlewares/default.ts +19 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/middlewares/default.ts
CHANGED
|
@@ -157,6 +157,25 @@ const withPzDefault =
|
|
|
157
157
|
return NextResponse.redirect(redirectUrlWithLocale, 303);
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
+
// Dynamically handle any payment gateway without specifying names
|
|
161
|
+
const paymentGatewayRegex = new RegExp('^/payment-gateway/([^/]+)/$');
|
|
162
|
+
const gatewayMatch = req.nextUrl.pathname.match(paymentGatewayRegex);
|
|
163
|
+
|
|
164
|
+
if (
|
|
165
|
+
gatewayMatch && // Check if the URL matches the /payment-gateway/<gateway> pattern
|
|
166
|
+
getUrlPathWithLocale(
|
|
167
|
+
`/payment-gateway/${gatewayMatch[1]}/`,
|
|
168
|
+
req.cookies.get('pz-locale')?.value
|
|
169
|
+
) !== req.nextUrl.pathname
|
|
170
|
+
) {
|
|
171
|
+
const redirectUrlWithLocale = `${url.origin}${getUrlPathWithLocale(
|
|
172
|
+
`/payment-gateway/${gatewayMatch[1]}/`,
|
|
173
|
+
req.cookies.get('pz-locale')?.value
|
|
174
|
+
)}?${req.nextUrl.searchParams.toString()}`;
|
|
175
|
+
|
|
176
|
+
return NextResponse.redirect(redirectUrlWithLocale);
|
|
177
|
+
}
|
|
178
|
+
|
|
160
179
|
if (req.nextUrl.pathname.startsWith('/orders/checkout-provider/')) {
|
|
161
180
|
try {
|
|
162
181
|
const data = await req.json();
|
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.59.0-rc.
|
|
4
|
+
"version": "1.59.0-rc.1",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"set-cookie-parser": "2.6.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@akinon/eslint-plugin-projectzero": "1.59.0-rc.
|
|
33
|
+
"@akinon/eslint-plugin-projectzero": "1.59.0-rc.1",
|
|
34
34
|
"@types/react-redux": "7.1.30",
|
|
35
35
|
"@types/set-cookie-parser": "2.4.7",
|
|
36
36
|
"@typescript-eslint/eslint-plugin": "6.7.4",
|