@akinon/next 1.92.0-rc.16 → 1.92.0-rc.18
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 +12 -0
- package/middlewares/complete-gpay.ts +4 -1
- package/middlewares/complete-masterpass.ts +5 -1
- package/middlewares/redirection-payment.ts +4 -1
- package/middlewares/saved-card-redirection.ts +5 -1
- package/middlewares/three-d-redirection.ts +5 -1
- package/package.json +2 -2
- package/utils/redirect.ts +9 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @akinon/next
|
|
2
2
|
|
|
3
|
+
## 1.92.0-rc.18
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b00a90b: ZERO-3436: Preserve query params on redirect
|
|
8
|
+
|
|
9
|
+
## 1.92.0-rc.17
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- e7cd3a5: ZERO-3435: Add Accept-Language to requestHeaders
|
|
14
|
+
|
|
3
15
|
## 1.92.0-rc.16
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -34,6 +34,7 @@ const withCompleteGpay =
|
|
|
34
34
|
const url = req.nextUrl.clone();
|
|
35
35
|
const ip = req.headers.get('x-forwarded-for') ?? '';
|
|
36
36
|
const sessionId = req.cookies.get('osessionid');
|
|
37
|
+
const currentLocale = req.middlewareParams?.rewrites?.locale;
|
|
37
38
|
|
|
38
39
|
if (url.search.indexOf('GPayCompletePage') === -1) {
|
|
39
40
|
return middleware(req, event);
|
|
@@ -45,7 +46,9 @@ const withCompleteGpay =
|
|
|
45
46
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
46
47
|
Cookie: req.headers.get('cookie') ?? '',
|
|
47
48
|
'x-currency': req.cookies.get('pz-currency')?.value ?? '',
|
|
48
|
-
'x-forwarded-for': ip
|
|
49
|
+
'x-forwarded-for': ip,
|
|
50
|
+
'Accept-Language':
|
|
51
|
+
currentLocale ?? req.cookies.get('pz-locale')?.value ?? ''
|
|
49
52
|
};
|
|
50
53
|
|
|
51
54
|
try {
|
|
@@ -4,6 +4,7 @@ import { Buffer } from 'buffer';
|
|
|
4
4
|
import logger from '../utils/log';
|
|
5
5
|
import { getUrlPathWithLocale } from '../utils/localization';
|
|
6
6
|
import { PzNextRequest } from '.';
|
|
7
|
+
import { ServerVariables } from '../utils/server-variables';
|
|
7
8
|
|
|
8
9
|
const streamToString = async (stream: ReadableStream<Uint8Array> | null) => {
|
|
9
10
|
if (stream) {
|
|
@@ -34,6 +35,7 @@ const withCompleteMasterpass =
|
|
|
34
35
|
const url = req.nextUrl.clone();
|
|
35
36
|
const ip = req.headers.get('x-forwarded-for') ?? '';
|
|
36
37
|
const sessionId = req.cookies.get('osessionid');
|
|
38
|
+
const currentLocale = req.middlewareParams?.rewrites?.locale;
|
|
37
39
|
|
|
38
40
|
if (url.search.indexOf('MasterpassCompletePage') === -1) {
|
|
39
41
|
return middleware(req, event);
|
|
@@ -45,7 +47,9 @@ const withCompleteMasterpass =
|
|
|
45
47
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
46
48
|
Cookie: req.headers.get('cookie') ?? '',
|
|
47
49
|
'x-currency': req.cookies.get('pz-currency')?.value ?? '',
|
|
48
|
-
'x-forwarded-for': ip
|
|
50
|
+
'x-forwarded-for': ip,
|
|
51
|
+
'Accept-Language':
|
|
52
|
+
currentLocale ?? req.cookies.get('pz-locale')?.value ?? ''
|
|
49
53
|
};
|
|
50
54
|
|
|
51
55
|
try {
|
|
@@ -35,6 +35,7 @@ const withRedirectionPayment =
|
|
|
35
35
|
const searchParams = new URLSearchParams(url.search);
|
|
36
36
|
const ip = req.headers.get('x-forwarded-for') ?? '';
|
|
37
37
|
const sessionId = req.cookies.get('osessionid');
|
|
38
|
+
const currentLocale = req.middlewareParams?.rewrites?.locale;
|
|
38
39
|
|
|
39
40
|
if (searchParams.get('page') !== 'RedirectionPageCompletePage') {
|
|
40
41
|
return middleware(req, event);
|
|
@@ -46,7 +47,9 @@ const withRedirectionPayment =
|
|
|
46
47
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
47
48
|
Cookie: req.headers.get('cookie') ?? '',
|
|
48
49
|
'x-currency': req.cookies.get('pz-currency')?.value ?? '',
|
|
49
|
-
'x-forwarded-for': ip
|
|
50
|
+
'x-forwarded-for': ip,
|
|
51
|
+
'Accept-Language':
|
|
52
|
+
currentLocale ?? req.cookies.get('pz-locale')?.value ?? ''
|
|
50
53
|
};
|
|
51
54
|
|
|
52
55
|
try {
|
|
@@ -4,6 +4,7 @@ import { Buffer } from 'buffer';
|
|
|
4
4
|
import logger from '../utils/log';
|
|
5
5
|
import { getUrlPathWithLocale } from '../utils/localization';
|
|
6
6
|
import { PzNextRequest } from '.';
|
|
7
|
+
import { ServerVariables } from '../utils/server-variables';
|
|
7
8
|
|
|
8
9
|
const streamToString = async (stream: ReadableStream<Uint8Array> | null) => {
|
|
9
10
|
if (stream) {
|
|
@@ -34,6 +35,7 @@ const withSavedCardRedirection =
|
|
|
34
35
|
const url = req.nextUrl.clone();
|
|
35
36
|
const ip = req.headers.get('x-forwarded-for') ?? '';
|
|
36
37
|
const sessionId = req.cookies.get('osessionid');
|
|
38
|
+
const currentLocale = req.middlewareParams?.rewrites?.locale;
|
|
37
39
|
|
|
38
40
|
if (url.search.indexOf('SavedCardThreeDSecurePage') === -1) {
|
|
39
41
|
return middleware(req, event);
|
|
@@ -45,7 +47,9 @@ const withSavedCardRedirection =
|
|
|
45
47
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
46
48
|
Cookie: req.headers.get('cookie') ?? '',
|
|
47
49
|
'x-currency': req.cookies.get('pz-currency')?.value ?? '',
|
|
48
|
-
'x-forwarded-for': ip
|
|
50
|
+
'x-forwarded-for': ip,
|
|
51
|
+
'Accept-Language':
|
|
52
|
+
currentLocale ?? req.cookies.get('pz-locale')?.value ?? ''
|
|
49
53
|
};
|
|
50
54
|
|
|
51
55
|
try {
|
|
@@ -4,6 +4,7 @@ import { Buffer } from 'buffer';
|
|
|
4
4
|
import logger from '../utils/log';
|
|
5
5
|
import { getUrlPathWithLocale } from '../utils/localization';
|
|
6
6
|
import { PzNextRequest } from '.';
|
|
7
|
+
import { ServerVariables } from '../utils/server-variables';
|
|
7
8
|
|
|
8
9
|
const streamToString = async (stream: ReadableStream<Uint8Array> | null) => {
|
|
9
10
|
if (stream) {
|
|
@@ -34,6 +35,7 @@ const withThreeDRedirection =
|
|
|
34
35
|
const url = req.nextUrl.clone();
|
|
35
36
|
const ip = req.headers.get('x-forwarded-for') ?? '';
|
|
36
37
|
const sessionId = req.cookies.get('osessionid');
|
|
38
|
+
const currentLocale = req.middlewareParams?.rewrites?.locale;
|
|
37
39
|
|
|
38
40
|
if (url.search.indexOf('CreditCardThreeDSecurePage') === -1) {
|
|
39
41
|
return middleware(req, event);
|
|
@@ -45,7 +47,9 @@ const withThreeDRedirection =
|
|
|
45
47
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
46
48
|
Cookie: req.headers.get('cookie') ?? '',
|
|
47
49
|
'x-currency': req.cookies.get('pz-currency')?.value ?? '',
|
|
48
|
-
'x-forwarded-for': ip
|
|
50
|
+
'x-forwarded-for': ip,
|
|
51
|
+
'Accept-Language':
|
|
52
|
+
currentLocale ?? req.cookies.get('pz-locale')?.value ?? ''
|
|
49
53
|
};
|
|
50
54
|
|
|
51
55
|
try {
|
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.92.0-rc.
|
|
4
|
+
"version": "1.92.0-rc.18",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"set-cookie-parser": "2.6.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@akinon/eslint-plugin-projectzero": "1.92.0-rc.
|
|
37
|
+
"@akinon/eslint-plugin-projectzero": "1.92.0-rc.18",
|
|
38
38
|
"@babel/core": "7.26.10",
|
|
39
39
|
"@babel/preset-env": "7.26.9",
|
|
40
40
|
"@babel/preset-typescript": "7.27.0",
|
package/utils/redirect.ts
CHANGED
|
@@ -34,9 +34,16 @@ export const redirect = (path: string, type?: RedirectType) => {
|
|
|
34
34
|
currentLocaleValue = Settings.localization.defaultLocaleValue;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const
|
|
37
|
+
const searchParams = new URLSearchParams(pageUrl.search);
|
|
38
38
|
|
|
39
|
-
const
|
|
39
|
+
const callbackUrl =
|
|
40
|
+
pageUrl.pathname.replace(urlLocaleMatcherRegex, '') +
|
|
41
|
+
(searchParams.toString() ? `?${searchParams.toString()}` : '');
|
|
42
|
+
|
|
43
|
+
const redirectUrlWithLocale = getUrlPathWithLocale(
|
|
44
|
+
path,
|
|
45
|
+
currentLocale?.value
|
|
46
|
+
);
|
|
40
47
|
|
|
41
48
|
const redirectUrl = `${redirectUrlWithLocale}?callbackUrl=${callbackUrl}`;
|
|
42
49
|
|