@akinon/next 1.14.0 → 1.15.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/.editorconfig +7 -7
- package/.eslintrc.js +40 -40
- package/.gitattributes +15 -0
- package/.prettierrc +13 -13
- package/CHANGELOG.md +14 -0
- package/api/auth.ts +231 -231
- package/api/cache.ts +44 -44
- package/api/client.ts +174 -174
- package/api/logout.ts +42 -42
- package/bin/pz-check-dependencies.js +98 -98
- package/bin/pz-install-plugins.js +33 -33
- package/bin/pz-install-theme.js +58 -58
- package/bin/pz-postbuild.js +1 -1
- package/bin/pz-postdev.js +1 -1
- package/bin/pz-postinstall.js +6 -6
- package/bin/pz-poststart.js +1 -1
- package/bin/pz-prebuild.js +4 -4
- package/bin/pz-predev.js +4 -4
- package/bin/pz-prestart.js +1 -1
- package/bin/run-script.js +44 -44
- package/components/accordion.tsx +52 -52
- package/components/button.tsx +46 -46
- package/components/client-root.tsx +19 -19
- package/components/icon.tsx +18 -18
- package/components/image.tsx +133 -133
- package/components/index.ts +1 -0
- package/components/input.tsx +110 -110
- package/components/lazy-component.tsx +33 -33
- package/components/loader-spinner.tsx +23 -23
- package/components/mobile-app-toggler.tsx +26 -26
- package/components/modal.tsx +66 -0
- package/components/oauth-login.tsx +24 -24
- package/components/plugin-module.tsx +5 -0
- package/components/price.tsx +55 -55
- package/components/pz-providers.tsx +24 -24
- package/components/pz-root.tsx +21 -21
- package/components/radio.tsx +18 -18
- package/components/react-portal.tsx +45 -45
- package/components/redirect-three-d/content/index.tsx +74 -74
- package/components/redirect-three-d/index.tsx +17 -17
- package/components/selected-payment-option-view.tsx +1 -1
- package/components/trans.tsx +39 -39
- package/data/client/account.ts +208 -208
- package/data/client/api.ts +85 -85
- package/data/client/basket.ts +82 -82
- package/data/client/misc.ts +101 -101
- package/data/client/product.ts +89 -89
- package/data/client/user.ts +99 -99
- package/data/client/wishlist.ts +118 -118
- package/data/server/category.ts +132 -132
- package/data/server/flatpage.ts +21 -21
- package/data/server/form.ts +22 -22
- package/data/server/index.ts +10 -10
- package/data/server/landingpage.ts +24 -24
- package/data/server/list.ts +67 -67
- package/data/server/menu.ts +35 -35
- package/data/server/product.ts +86 -86
- package/data/server/seo.ts +48 -48
- package/data/server/special-page.ts +47 -47
- package/data/server/widget.ts +27 -27
- package/data/urls.ts +221 -221
- package/hocs/client/index.ts +1 -1
- package/hocs/client/with-segment-defaults.tsx +25 -25
- package/hocs/server/index.ts +1 -1
- package/hocs/server/with-segment-defaults.tsx +85 -85
- package/hooks/index.ts +10 -10
- package/hooks/use-captcha.tsx +76 -76
- package/hooks/use-common-product-attributes.ts +36 -36
- package/hooks/use-debounce.ts +20 -20
- package/hooks/use-localization.ts +78 -78
- package/hooks/use-media-query.ts +36 -36
- package/hooks/use-mobile-iframe-handler.ts +23 -23
- package/hooks/use-on-click-outside.tsx +28 -28
- package/hooks/use-payment-options.ts +3 -1
- package/hooks/use-router.ts +45 -45
- package/hooks/use-translation.ts +14 -14
- package/lib/cache.ts +215 -215
- package/localization/index.ts +5 -5
- package/localization/provider.tsx +58 -58
- package/middlewares/complete-gpay.ts +159 -0
- package/middlewares/currency.ts +100 -100
- package/middlewares/default.ts +259 -256
- package/middlewares/index.ts +31 -29
- package/middlewares/locale.ts +68 -68
- package/middlewares/oauth-login.ts +79 -79
- package/middlewares/pretty-url.ts +104 -104
- package/middlewares/redirection-payment.ts +160 -160
- package/middlewares/three-d-redirection.ts +159 -159
- package/middlewares/url-redirection.ts +65 -65
- package/package.json +2 -2
- package/plugins.js +1 -0
- package/redux/hooks.ts +7 -7
- package/redux/middlewares/index.ts +50 -50
- package/redux/reducers/checkout.ts +184 -184
- package/redux/reducers/config.ts +28 -28
- package/redux/reducers/header.ts +59 -59
- package/redux/reducers/root.ts +61 -61
- package/sentry/index.ts +27 -27
- package/tailwind/rtl.js +137 -137
- package/types/commerce/account.ts +64 -64
- package/types/commerce/address.ts +94 -94
- package/types/commerce/basket.ts +43 -43
- package/types/commerce/category.ts +114 -114
- package/types/commerce/checkout.ts +143 -143
- package/types/commerce/flatpage.ts +7 -7
- package/types/commerce/form.ts +66 -66
- package/types/commerce/index.ts +12 -12
- package/types/commerce/landingpage.ts +7 -7
- package/types/commerce/misc.ts +127 -127
- package/types/commerce/order.ts +119 -119
- package/types/commerce/product.ts +109 -109
- package/types/commerce/widget.ts +28 -28
- package/types/gtm.ts +16 -16
- package/types/index.ts +274 -274
- package/types/metadata.ts +7 -7
- package/types/next-auth.d.ts +24 -24
- package/utils/app-fetch.ts +69 -69
- package/utils/deep-merge.js +24 -24
- package/utils/image-loader.ts +31 -31
- package/utils/index.ts +150 -150
- package/utils/localization.ts +29 -29
- package/utils/log.ts +138 -138
- package/utils/menu-generator.ts +27 -27
- package/utils/mobile-3d-iframe.ts +77 -77
- package/utils/server-translation.ts +57 -57
- package/utils/server-variables.ts +9 -9
- package/with-pz-config.js +94 -94
package/middlewares/default.ts
CHANGED
|
@@ -1,256 +1,259 @@
|
|
|
1
|
-
import { NextFetchEvent, NextMiddleware, NextResponse } from 'next/server';
|
|
2
|
-
import Settings from 'settings';
|
|
3
|
-
import {
|
|
4
|
-
PzNextRequest,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
req.nextUrl.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
//
|
|
159
|
-
if (
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
1
|
+
import { NextFetchEvent, NextMiddleware, NextResponse } from 'next/server';
|
|
2
|
+
import Settings from 'settings';
|
|
3
|
+
import {
|
|
4
|
+
PzNextRequest,
|
|
5
|
+
withCompleteGpay,
|
|
6
|
+
withOauthLogin,
|
|
7
|
+
withPrettyUrl,
|
|
8
|
+
withRedirectionPayment,
|
|
9
|
+
withThreeDRedirection,
|
|
10
|
+
withUrlRedirection
|
|
11
|
+
} from '.';
|
|
12
|
+
import { urlLocaleMatcherRegex } from '../utils';
|
|
13
|
+
import withCurrency from './currency';
|
|
14
|
+
import withLocale from './locale';
|
|
15
|
+
import logger from '../utils/log';
|
|
16
|
+
import { user } from '../data/urls';
|
|
17
|
+
import { getUrlPathWithLocale } from '../utils/localization';
|
|
18
|
+
|
|
19
|
+
const withPzDefault =
|
|
20
|
+
(middleware: NextMiddleware) =>
|
|
21
|
+
async (req: PzNextRequest, event: NextFetchEvent) => {
|
|
22
|
+
const url = req.nextUrl.clone();
|
|
23
|
+
const commerceUrl = encodeURIComponent(decodeURI(Settings.commerceUrl)); // encodeURI doesn't work as expected in middleware
|
|
24
|
+
const searchParams = new URLSearchParams(url.search);
|
|
25
|
+
const ip = req.headers.get('x-forwarded-for') ?? '';
|
|
26
|
+
|
|
27
|
+
logger.debug('withPzDefault', {
|
|
28
|
+
url: url.href,
|
|
29
|
+
middlewareParams: req.middlewareParams,
|
|
30
|
+
ip
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// Support legacy ?format=json query param
|
|
34
|
+
if (searchParams.has('json') || searchParams.get('format') === 'json') {
|
|
35
|
+
try {
|
|
36
|
+
searchParams.set('format', 'json');
|
|
37
|
+
|
|
38
|
+
const request = await fetch(
|
|
39
|
+
`${encodeURI(Settings.commerceUrl)}${url.pathname.replace(
|
|
40
|
+
urlLocaleMatcherRegex,
|
|
41
|
+
''
|
|
42
|
+
)}?${searchParams.toString()}`,
|
|
43
|
+
{
|
|
44
|
+
next: {
|
|
45
|
+
revalidate: 0
|
|
46
|
+
},
|
|
47
|
+
headers: {
|
|
48
|
+
Cookie: req.headers.get('cookie') || '',
|
|
49
|
+
Accept: 'application/json',
|
|
50
|
+
'X-Requested-With': 'XMLHttpRequest'
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
return NextResponse.json(await request.json());
|
|
56
|
+
} catch (error) {
|
|
57
|
+
logger.error('?format=json error', {
|
|
58
|
+
error,
|
|
59
|
+
ip
|
|
60
|
+
});
|
|
61
|
+
return NextResponse.next();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (url.pathname === '/healthz') {
|
|
66
|
+
return NextResponse.json({ status: 'ok' });
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (req.nextUrl.pathname.startsWith('/.well-known')) {
|
|
70
|
+
const url = new URL(`${Settings.commerceUrl}${req.nextUrl.pathname}`);
|
|
71
|
+
const req_ = await fetch(url.toString());
|
|
72
|
+
|
|
73
|
+
if (req_.ok) {
|
|
74
|
+
return NextResponse.rewrite(url);
|
|
75
|
+
} else {
|
|
76
|
+
return NextResponse.next();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (req.nextUrl.pathname.includes('/orders/hooks/')) {
|
|
81
|
+
return NextResponse.rewrite(
|
|
82
|
+
new URL(
|
|
83
|
+
`${Settings.commerceUrl}${req.nextUrl.pathname.replace(
|
|
84
|
+
urlLocaleMatcherRegex,
|
|
85
|
+
''
|
|
86
|
+
)}`
|
|
87
|
+
)
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (req.nextUrl.pathname.startsWith('/orders/redirection/')) {
|
|
92
|
+
return NextResponse.rewrite(
|
|
93
|
+
new URL(`${encodeURI(Settings.commerceUrl)}/orders/redirection/`)
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// If commerce redirects to /orders/checkout/ without locale
|
|
98
|
+
if (
|
|
99
|
+
req.nextUrl.pathname.match(new RegExp('^/orders/checkout/$')) &&
|
|
100
|
+
req.nextUrl.searchParams.size === 0 &&
|
|
101
|
+
getUrlPathWithLocale(
|
|
102
|
+
'/orders/checkout/',
|
|
103
|
+
req.cookies.get('pz-locale')?.value
|
|
104
|
+
) !== req.nextUrl.pathname
|
|
105
|
+
) {
|
|
106
|
+
const redirectUrlWithLocale = `${url.origin}${getUrlPathWithLocale(
|
|
107
|
+
'/orders/checkout/',
|
|
108
|
+
req.cookies.get('pz-locale')?.value
|
|
109
|
+
)}`;
|
|
110
|
+
|
|
111
|
+
return NextResponse.redirect(redirectUrlWithLocale, 303);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
req.middlewareParams = {
|
|
115
|
+
commerceUrl,
|
|
116
|
+
rewrites: {}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
return withOauthLogin(
|
|
120
|
+
withLocale(
|
|
121
|
+
withCurrency(
|
|
122
|
+
withPrettyUrl(
|
|
123
|
+
withRedirectionPayment(
|
|
124
|
+
withThreeDRedirection(
|
|
125
|
+
withUrlRedirection(
|
|
126
|
+
withCompleteGpay(
|
|
127
|
+
async (req: PzNextRequest, event: NextFetchEvent) => {
|
|
128
|
+
let middlewareResult: NextResponse | void =
|
|
129
|
+
NextResponse.next();
|
|
130
|
+
|
|
131
|
+
try {
|
|
132
|
+
const { locale, prettyUrl, currency } =
|
|
133
|
+
req.middlewareParams.rewrites;
|
|
134
|
+
const { defaultLocaleValue } = Settings.localization;
|
|
135
|
+
const url = req.nextUrl.clone();
|
|
136
|
+
const pathnameWithoutLocale = url.pathname.replace(
|
|
137
|
+
urlLocaleMatcherRegex,
|
|
138
|
+
''
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
url.basePath = `/${commerceUrl}`;
|
|
142
|
+
url.pathname = `/${
|
|
143
|
+
locale.length ? `${locale}/` : ''
|
|
144
|
+
}${currency}${prettyUrl ?? pathnameWithoutLocale}`;
|
|
145
|
+
|
|
146
|
+
Settings.rewrites.forEach((rewrite) => {
|
|
147
|
+
url.pathname = url.pathname.replace(
|
|
148
|
+
rewrite.source,
|
|
149
|
+
rewrite.destination
|
|
150
|
+
);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
middlewareResult = (await middleware(
|
|
154
|
+
req,
|
|
155
|
+
event
|
|
156
|
+
)) as NextResponse | void;
|
|
157
|
+
|
|
158
|
+
// if middleware.ts has a return value for current url
|
|
159
|
+
if (middlewareResult instanceof NextResponse) {
|
|
160
|
+
// pz-override-response header is used to prevent 404 page for custom responses.
|
|
161
|
+
if (
|
|
162
|
+
middlewareResult.headers.get(
|
|
163
|
+
'pz-override-response'
|
|
164
|
+
) !== 'true'
|
|
165
|
+
) {
|
|
166
|
+
middlewareResult.headers.set(
|
|
167
|
+
'x-middleware-rewrite',
|
|
168
|
+
url.href
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
} else {
|
|
172
|
+
// if middleware.ts doesn't have a return value.
|
|
173
|
+
// e.g. NextResponse.next() doesn't exist in middleware.ts
|
|
174
|
+
|
|
175
|
+
middlewareResult = NextResponse.rewrite(url);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (!url.pathname.startsWith(`/${currency}/orders`)) {
|
|
179
|
+
middlewareResult.cookies.set(
|
|
180
|
+
'pz-locale',
|
|
181
|
+
locale?.length > 0 ? locale : defaultLocaleValue,
|
|
182
|
+
{
|
|
183
|
+
sameSite: 'none',
|
|
184
|
+
secure: true,
|
|
185
|
+
expires: new Date(
|
|
186
|
+
Date.now() + 1000 * 60 * 60 * 24 * 7
|
|
187
|
+
) // 7 days
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
middlewareResult.cookies.set('pz-currency', currency, {
|
|
192
|
+
sameSite: 'none',
|
|
193
|
+
secure: true,
|
|
194
|
+
expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 7) // 7 days
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
if (
|
|
198
|
+
req.cookies.get('pz-locale') &&
|
|
199
|
+
req.cookies.get('pz-locale').value !== locale
|
|
200
|
+
) {
|
|
201
|
+
logger.debug('Locale changed', {
|
|
202
|
+
locale,
|
|
203
|
+
oldLocale: req.cookies.get('pz-locale')?.value,
|
|
204
|
+
ip
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
middlewareResult.headers.set(
|
|
209
|
+
'pz-url',
|
|
210
|
+
req.nextUrl.toString()
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
if (req.cookies.get('pz-set-currency')) {
|
|
214
|
+
middlewareResult.cookies.delete('pz-set-currency');
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (process.env.ACC_APP_VERSION) {
|
|
218
|
+
middlewareResult.headers.set(
|
|
219
|
+
'acc-app-version',
|
|
220
|
+
process.env.ACC_APP_VERSION
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Set CSRF token if not set
|
|
225
|
+
try {
|
|
226
|
+
const url = `${Settings.commerceUrl}${user.csrfToken}`;
|
|
227
|
+
|
|
228
|
+
if (!req.cookies.get('csrftoken')) {
|
|
229
|
+
const { csrf_token } = await (
|
|
230
|
+
await fetch(url)
|
|
231
|
+
).json();
|
|
232
|
+
middlewareResult.cookies.set('csrftoken', csrf_token);
|
|
233
|
+
}
|
|
234
|
+
} catch (error) {
|
|
235
|
+
logger.error('CSRF Error', {
|
|
236
|
+
error,
|
|
237
|
+
ip
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
} catch (error) {
|
|
241
|
+
logger.error('withPzDefault Error', {
|
|
242
|
+
error,
|
|
243
|
+
ip
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return middlewareResult;
|
|
248
|
+
}
|
|
249
|
+
)
|
|
250
|
+
)
|
|
251
|
+
)
|
|
252
|
+
)
|
|
253
|
+
)
|
|
254
|
+
)
|
|
255
|
+
)
|
|
256
|
+
)(req, event);
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
export default withPzDefault;
|
package/middlewares/index.ts
CHANGED
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
import withPzDefault from './default';
|
|
2
|
-
import withPrettyUrl from './pretty-url';
|
|
3
|
-
import withThreeDRedirection from './three-d-redirection';
|
|
4
|
-
import withRedirectionPayment from './redirection-payment';
|
|
5
|
-
import withLocale from './locale';
|
|
6
|
-
import withOauthLogin from './oauth-login';
|
|
7
|
-
import withUrlRedirection from './url-redirection';
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
1
|
+
import withPzDefault from './default';
|
|
2
|
+
import withPrettyUrl from './pretty-url';
|
|
3
|
+
import withThreeDRedirection from './three-d-redirection';
|
|
4
|
+
import withRedirectionPayment from './redirection-payment';
|
|
5
|
+
import withLocale from './locale';
|
|
6
|
+
import withOauthLogin from './oauth-login';
|
|
7
|
+
import withUrlRedirection from './url-redirection';
|
|
8
|
+
import withCompleteGpay from './complete-gpay';
|
|
9
|
+
import { NextRequest } from 'next/server';
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
withPzDefault,
|
|
13
|
+
withPrettyUrl,
|
|
14
|
+
withThreeDRedirection,
|
|
15
|
+
withRedirectionPayment,
|
|
16
|
+
withLocale,
|
|
17
|
+
withOauthLogin,
|
|
18
|
+
withUrlRedirection,
|
|
19
|
+
withCompleteGpay
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export interface PzNextRequest extends NextRequest {
|
|
23
|
+
middlewareParams: {
|
|
24
|
+
commerceUrl: string;
|
|
25
|
+
rewrites: {
|
|
26
|
+
locale?: string;
|
|
27
|
+
prettyUrl?: string;
|
|
28
|
+
currency?: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
}
|