@akinon/next 2.0.141-rc.0 → 2.0.141
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 +1 -38
- package/api/auth.ts +20 -97
- package/bin/pz-generate-routes.js +1 -4
- package/components/plugin-module.tsx +1 -0
- package/data/client/checkout.ts +1 -0
- package/data/client/user.ts +1 -6
- package/data/client/wishlist.ts +0 -22
- package/data/server/category.ts +2 -14
- package/data/server/list.ts +1 -13
- package/data/server/product.ts +0 -10
- package/data/server/special-page.ts +1 -14
- package/data/server/widget.ts +1 -14
- package/data/urls.ts +4 -13
- package/hooks/index.ts +0 -1
- package/hooks/use-captcha.tsx +1 -1
- package/middlewares/default.ts +247 -254
- package/middlewares/pretty-url.ts +1 -3
- package/package.json +2 -2
- package/plugins.d.ts +0 -10
- package/plugins.js +0 -1
- package/redux/middlewares/checkout.ts +2 -44
- package/redux/middlewares/pre-order/installment-option.ts +1 -9
- package/types/index.ts +9 -20
- package/utils/csrf.ts +1 -1
- package/with-pz-config.js +1 -6
- package/api/client-env.ts +0 -78
- package/hooks/use-client-env.ts +0 -265
- package/utils/payload-optimizer.ts +0 -481
package/middlewares/default.ts
CHANGED
|
@@ -18,11 +18,7 @@ import {
|
|
|
18
18
|
withBfcacheHeaders
|
|
19
19
|
} from '.';
|
|
20
20
|
import { getCsrfCookieFlags, urlLocaleMatcherRegex } from '../utils';
|
|
21
|
-
import {
|
|
22
|
-
getPzSegmentsConfig,
|
|
23
|
-
encodePzValue,
|
|
24
|
-
isLegacyMode
|
|
25
|
-
} from '../utils/pz-segments';
|
|
21
|
+
import { getPzSegmentsConfig, encodePzValue, isLegacyMode } from '../utils/pz-segments';
|
|
26
22
|
import withCurrency from './currency';
|
|
27
23
|
import withLocale from './locale';
|
|
28
24
|
import logger from '../utils/log';
|
|
@@ -347,98 +343,98 @@ const withPzDefault =
|
|
|
347
343
|
req: PzNextRequest,
|
|
348
344
|
event: NextFetchEvent
|
|
349
345
|
) => {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
middlewareResult = (await middleware(
|
|
366
|
-
req,
|
|
367
|
-
event
|
|
368
|
-
)) as NextResponse | void;
|
|
369
|
-
|
|
370
|
-
let customRewriteUrlDiff = '';
|
|
346
|
+
let middlewareResult: NextResponse | void =
|
|
347
|
+
NextResponse.next();
|
|
348
|
+
|
|
349
|
+
try {
|
|
350
|
+
const { locale, prettyUrl, currency } =
|
|
351
|
+
req.middlewareParams.rewrites;
|
|
352
|
+
const { defaultLocaleValue } =
|
|
353
|
+
Settings.localization;
|
|
354
|
+
const url = req.nextUrl.clone();
|
|
355
|
+
const pathnameWithoutLocale =
|
|
356
|
+
url.pathname.replace(
|
|
357
|
+
urlLocaleMatcherRegex,
|
|
358
|
+
''
|
|
359
|
+
);
|
|
371
360
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
361
|
+
middlewareResult = (await middleware(
|
|
362
|
+
req,
|
|
363
|
+
event
|
|
364
|
+
)) as NextResponse | void;
|
|
365
|
+
|
|
366
|
+
let customRewriteUrlDiff = '';
|
|
367
|
+
|
|
368
|
+
if (
|
|
369
|
+
middlewareResult instanceof
|
|
370
|
+
NextResponse &&
|
|
371
|
+
middlewareResult.headers.get(
|
|
372
|
+
'pz-override-response'
|
|
373
|
+
) &&
|
|
374
|
+
middlewareResult.headers.get(
|
|
375
|
+
'x-middleware-rewrite'
|
|
376
|
+
)
|
|
377
|
+
) {
|
|
378
|
+
const rewriteUrl = new URL(
|
|
378
379
|
middlewareResult.headers.get(
|
|
379
380
|
'x-middleware-rewrite'
|
|
380
381
|
)
|
|
381
|
-
)
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
382
|
+
);
|
|
383
|
+
const originalUrl = new URL(req.url);
|
|
384
|
+
customRewriteUrlDiff =
|
|
385
|
+
rewriteUrl.pathname.replace(
|
|
386
|
+
originalUrl.pathname,
|
|
387
|
+
''
|
|
386
388
|
);
|
|
387
|
-
|
|
388
|
-
customRewriteUrlDiff =
|
|
389
|
-
rewriteUrl.pathname.replace(
|
|
390
|
-
originalUrl.pathname,
|
|
391
|
-
''
|
|
392
|
-
);
|
|
393
|
-
}
|
|
389
|
+
}
|
|
394
390
|
|
|
395
|
-
|
|
391
|
+
let ordersPrefix: string;
|
|
396
392
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
393
|
+
if (isLegacyMode(Settings)) {
|
|
394
|
+
url.basePath = `/${commerceUrl}`;
|
|
395
|
+
url.pathname =
|
|
396
|
+
`/${locale.length ? `${locale}/` : ''}${currency}/${customRewriteUrlDiff}${
|
|
397
|
+
prettyUrl ?? pathnameWithoutLocale
|
|
398
|
+
}`.replace(/\/+/g, '/');
|
|
399
|
+
ordersPrefix = `/${currency}/orders`;
|
|
400
|
+
} else {
|
|
401
|
+
const pzConfig =
|
|
402
|
+
getPzSegmentsConfig(Settings);
|
|
403
|
+
const fullUrlPath =
|
|
404
|
+
`${customRewriteUrlDiff}${
|
|
402
405
|
prettyUrl ?? pathnameWithoutLocale
|
|
403
406
|
}`.replace(/\/+/g, '/');
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
string
|
|
436
|
-
> = {
|
|
437
|
-
locale: resolvedLocale,
|
|
438
|
-
currency,
|
|
439
|
-
url: encodeURIComponent(fullUrl),
|
|
440
|
-
...Object.fromEntries(
|
|
441
|
-
customSegments.map((seg) => [
|
|
407
|
+
const fullUrl = `${req.nextUrl.origin}${fullUrlPath}`;
|
|
408
|
+
const resolvedLocale =
|
|
409
|
+
locale?.length > 0
|
|
410
|
+
? locale
|
|
411
|
+
: Settings.localization
|
|
412
|
+
.defaultLocaleValue;
|
|
413
|
+
const resolveContext = {
|
|
414
|
+
req,
|
|
415
|
+
event,
|
|
416
|
+
url,
|
|
417
|
+
locale: resolvedLocale,
|
|
418
|
+
currency,
|
|
419
|
+
pathname: pathnameWithoutLocale
|
|
420
|
+
};
|
|
421
|
+
const customSegments = pzConfig.segments
|
|
422
|
+
.filter(
|
|
423
|
+
(seg) =>
|
|
424
|
+
seg.name !== 'locale' &&
|
|
425
|
+
seg.name !== 'currency' &&
|
|
426
|
+
seg.name !== 'url'
|
|
427
|
+
);
|
|
428
|
+
const segmentValues: Record<
|
|
429
|
+
string,
|
|
430
|
+
string
|
|
431
|
+
> = {
|
|
432
|
+
locale: resolvedLocale,
|
|
433
|
+
currency,
|
|
434
|
+
url: encodeURIComponent(fullUrl),
|
|
435
|
+
...Object.fromEntries(
|
|
436
|
+
customSegments
|
|
437
|
+
.map((seg) => [
|
|
442
438
|
seg.name,
|
|
443
439
|
req.middlewareParams.rewrites[
|
|
444
440
|
seg.name
|
|
@@ -447,121 +443,105 @@ const withPzDefault =
|
|
|
447
443
|
? seg.resolve(resolveContext)
|
|
448
444
|
: '')
|
|
449
445
|
])
|
|
450
|
-
|
|
451
|
-
|
|
446
|
+
)
|
|
447
|
+
};
|
|
452
448
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
449
|
+
const pzValue = encodePzValue(
|
|
450
|
+
segmentValues,
|
|
451
|
+
pzConfig
|
|
452
|
+
);
|
|
453
|
+
|
|
454
|
+
url.pathname =
|
|
455
|
+
`/${pzValue}/${fullUrlPath}`.replace(
|
|
456
|
+
/\/+/g,
|
|
457
|
+
'/'
|
|
456
458
|
);
|
|
459
|
+
ordersPrefix = `/${pzValue}/orders`;
|
|
460
|
+
}
|
|
457
461
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
462
|
+
if (
|
|
463
|
+
Settings.usePrettyUrlRoute &&
|
|
464
|
+
url.searchParams.toString().length > 0 &&
|
|
465
|
+
!Object.entries(ROUTES).find(
|
|
466
|
+
([, value]) =>
|
|
467
|
+
new RegExp(`^${value}/?$`).test(
|
|
468
|
+
pathnameWithoutLocale
|
|
469
|
+
)
|
|
470
|
+
)
|
|
471
|
+
) {
|
|
472
|
+
url.pathname =
|
|
473
|
+
url.pathname +
|
|
474
|
+
(/\/$/.test(url.pathname) ? '' : '/') +
|
|
475
|
+
`searchparams|${encodeURIComponent(
|
|
476
|
+
url.searchParams.toString()
|
|
477
|
+
)}`;
|
|
478
|
+
}
|
|
465
479
|
|
|
480
|
+
Settings.rewrites.forEach((rewrite) => {
|
|
481
|
+
url.pathname = url.pathname.replace(
|
|
482
|
+
rewrite.source,
|
|
483
|
+
rewrite.destination
|
|
484
|
+
);
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
// if middleware.ts has a return value for current url
|
|
488
|
+
if (
|
|
489
|
+
middlewareResult instanceof NextResponse
|
|
490
|
+
) {
|
|
491
|
+
// pz-override-response header is used to prevent 404 page for custom responses.
|
|
466
492
|
if (
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
!Object.entries(ROUTES).find(
|
|
471
|
-
([, value]) =>
|
|
472
|
-
new RegExp(`^${value}/?$`).test(
|
|
473
|
-
pathnameWithoutLocale
|
|
474
|
-
)
|
|
475
|
-
)
|
|
493
|
+
middlewareResult.headers.get(
|
|
494
|
+
'pz-override-response'
|
|
495
|
+
) !== 'true'
|
|
476
496
|
) {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
? ''
|
|
481
|
-
: '/') +
|
|
482
|
-
`searchparams|${encodeURIComponent(
|
|
483
|
-
url.searchParams.toString()
|
|
484
|
-
)}`;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
Settings.rewrites.forEach((rewrite) => {
|
|
488
|
-
url.pathname = url.pathname.replace(
|
|
489
|
-
rewrite.source,
|
|
490
|
-
rewrite.destination
|
|
497
|
+
middlewareResult.headers.set(
|
|
498
|
+
'x-middleware-rewrite',
|
|
499
|
+
url.href
|
|
491
500
|
);
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
middlewareResult
|
|
501
|
+
} else if (
|
|
502
|
+
middlewareResult.headers.get(
|
|
503
|
+
'x-middleware-rewrite'
|
|
504
|
+
) &&
|
|
505
|
+
middlewareResult.headers.get(
|
|
506
|
+
'pz-override-response'
|
|
507
|
+
) === 'true'
|
|
497
508
|
) {
|
|
498
|
-
// pz-override-response header is used to prevent 404 page for custom responses.
|
|
499
|
-
if (
|
|
500
|
-
middlewareResult.headers.get(
|
|
501
|
-
'pz-override-response'
|
|
502
|
-
) !== 'true'
|
|
503
|
-
) {
|
|
504
|
-
middlewareResult.headers.set(
|
|
505
|
-
'x-middleware-rewrite',
|
|
506
|
-
url.href
|
|
507
|
-
);
|
|
508
|
-
} else if (
|
|
509
|
-
middlewareResult.headers.get(
|
|
510
|
-
'x-middleware-rewrite'
|
|
511
|
-
) &&
|
|
512
|
-
middlewareResult.headers.get(
|
|
513
|
-
'pz-override-response'
|
|
514
|
-
) === 'true'
|
|
515
|
-
) {
|
|
516
|
-
middlewareResult =
|
|
517
|
-
NextResponse.rewrite(url);
|
|
518
|
-
}
|
|
519
|
-
} else {
|
|
520
|
-
// if middleware.ts doesn't have a return value.
|
|
521
|
-
// e.g. NextResponse.next() doesn't exist in middleware.ts
|
|
522
|
-
|
|
523
509
|
middlewareResult =
|
|
524
510
|
NextResponse.rewrite(url);
|
|
525
511
|
}
|
|
512
|
+
} else {
|
|
513
|
+
// if middleware.ts doesn't have a return value.
|
|
514
|
+
// e.g. NextResponse.next() doesn't exist in middleware.ts
|
|
526
515
|
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
const fallbackHost =
|
|
531
|
-
req.headers.get('x-forwarded-host') ||
|
|
532
|
-
req.headers.get('host');
|
|
533
|
-
const hostname =
|
|
534
|
-
process.env.NEXT_PUBLIC_URL ||
|
|
535
|
-
`https://${fallbackHost}`;
|
|
536
|
-
const rootHostname =
|
|
537
|
-
localeUrlStrategy ===
|
|
538
|
-
LocaleUrlStrategy.Subdomain
|
|
539
|
-
? getRootHostname(hostname)
|
|
540
|
-
: null;
|
|
541
|
-
|
|
542
|
-
if (
|
|
543
|
-
!url.pathname.startsWith(ordersPrefix)
|
|
544
|
-
) {
|
|
545
|
-
middlewareResult.cookies.set(
|
|
546
|
-
'pz-locale',
|
|
547
|
-
locale?.length > 0
|
|
548
|
-
? locale
|
|
549
|
-
: defaultLocaleValue,
|
|
550
|
-
{
|
|
551
|
-
domain: rootHostname,
|
|
552
|
-
sameSite: 'none',
|
|
553
|
-
secure: true,
|
|
554
|
-
expires: new Date(
|
|
555
|
-
Date.now() +
|
|
556
|
-
1000 * 60 * 60 * 24 * 7
|
|
557
|
-
) // 7 days
|
|
558
|
-
}
|
|
559
|
-
);
|
|
560
|
-
}
|
|
516
|
+
middlewareResult =
|
|
517
|
+
NextResponse.rewrite(url);
|
|
518
|
+
}
|
|
561
519
|
|
|
520
|
+
const { localeUrlStrategy } =
|
|
521
|
+
Settings.localization;
|
|
522
|
+
|
|
523
|
+
const fallbackHost =
|
|
524
|
+
req.headers.get('x-forwarded-host') ||
|
|
525
|
+
req.headers.get('host');
|
|
526
|
+
const hostname =
|
|
527
|
+
process.env.NEXT_PUBLIC_URL ||
|
|
528
|
+
`https://${fallbackHost}`;
|
|
529
|
+
const rootHostname =
|
|
530
|
+
localeUrlStrategy ===
|
|
531
|
+
LocaleUrlStrategy.Subdomain
|
|
532
|
+
? getRootHostname(hostname)
|
|
533
|
+
: null;
|
|
534
|
+
|
|
535
|
+
if (
|
|
536
|
+
!url.pathname.startsWith(
|
|
537
|
+
ordersPrefix
|
|
538
|
+
)
|
|
539
|
+
) {
|
|
562
540
|
middlewareResult.cookies.set(
|
|
563
|
-
'pz-
|
|
564
|
-
|
|
541
|
+
'pz-locale',
|
|
542
|
+
locale?.length > 0
|
|
543
|
+
? locale
|
|
544
|
+
: defaultLocaleValue,
|
|
565
545
|
{
|
|
566
546
|
domain: rootHostname,
|
|
567
547
|
sameSite: 'none',
|
|
@@ -571,89 +551,102 @@ const withPzDefault =
|
|
|
571
551
|
) // 7 days
|
|
572
552
|
}
|
|
573
553
|
);
|
|
554
|
+
}
|
|
574
555
|
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
});
|
|
556
|
+
middlewareResult.cookies.set(
|
|
557
|
+
'pz-currency',
|
|
558
|
+
currency,
|
|
559
|
+
{
|
|
560
|
+
domain: rootHostname,
|
|
561
|
+
sameSite: 'none',
|
|
562
|
+
secure: true,
|
|
563
|
+
expires: new Date(
|
|
564
|
+
Date.now() + 1000 * 60 * 60 * 24 * 7
|
|
565
|
+
) // 7 days
|
|
586
566
|
}
|
|
567
|
+
);
|
|
568
|
+
|
|
569
|
+
if (
|
|
570
|
+
req.cookies.get('pz-locale') &&
|
|
571
|
+
req.cookies.get('pz-locale').value !==
|
|
572
|
+
locale
|
|
573
|
+
) {
|
|
574
|
+
logger.debug('Locale changed', {
|
|
575
|
+
locale,
|
|
576
|
+
oldLocale:
|
|
577
|
+
req.cookies.get('pz-locale')?.value,
|
|
578
|
+
ip
|
|
579
|
+
});
|
|
580
|
+
}
|
|
587
581
|
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
582
|
+
middlewareResult.headers.set(
|
|
583
|
+
'pz-url',
|
|
584
|
+
req.nextUrl.toString()
|
|
585
|
+
);
|
|
586
|
+
|
|
587
|
+
if (req.cookies.get('pz-set-currency')) {
|
|
588
|
+
middlewareResult.cookies.delete(
|
|
589
|
+
'pz-set-currency'
|
|
591
590
|
);
|
|
591
|
+
}
|
|
592
592
|
|
|
593
|
-
|
|
593
|
+
if (
|
|
594
|
+
req.cookies.get('pz-post-checkout-flow')
|
|
595
|
+
) {
|
|
596
|
+
if (
|
|
597
|
+
pathnameWithoutLocale.startsWith(
|
|
598
|
+
'/orders/completed/'
|
|
599
|
+
) ||
|
|
600
|
+
pathnameWithoutLocale.startsWith(
|
|
601
|
+
'/basket'
|
|
602
|
+
)
|
|
603
|
+
) {
|
|
594
604
|
middlewareResult.cookies.delete(
|
|
595
|
-
'pz-
|
|
605
|
+
'pz-post-checkout-flow'
|
|
596
606
|
);
|
|
597
607
|
}
|
|
608
|
+
}
|
|
598
609
|
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
) ||
|
|
606
|
-
pathnameWithoutLocale.startsWith(
|
|
607
|
-
'/basket'
|
|
608
|
-
)
|
|
609
|
-
) {
|
|
610
|
-
middlewareResult.cookies.delete(
|
|
611
|
-
'pz-post-checkout-flow'
|
|
612
|
-
);
|
|
613
|
-
}
|
|
614
|
-
}
|
|
610
|
+
if (process.env.ACC_APP_VERSION) {
|
|
611
|
+
middlewareResult.headers.set(
|
|
612
|
+
'acc-app-version',
|
|
613
|
+
process.env.ACC_APP_VERSION
|
|
614
|
+
);
|
|
615
|
+
}
|
|
615
616
|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
process.env.ACC_APP_VERSION
|
|
620
|
-
);
|
|
621
|
-
}
|
|
617
|
+
// Set CSRF token if not set
|
|
618
|
+
try {
|
|
619
|
+
const url = `${Settings.commerceUrl}${user.csrfToken}`;
|
|
622
620
|
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
domain: rootHostname,
|
|
637
|
-
...getCsrfCookieFlags()
|
|
638
|
-
}
|
|
639
|
-
);
|
|
640
|
-
}
|
|
641
|
-
} catch (error) {
|
|
642
|
-
logger.error('CSRF Error', {
|
|
643
|
-
error,
|
|
644
|
-
ip
|
|
645
|
-
});
|
|
621
|
+
if (!req.cookies.get('csrftoken')) {
|
|
622
|
+
const { csrf_token } = await (
|
|
623
|
+
await fetch(url)
|
|
624
|
+
).json();
|
|
625
|
+
middlewareResult.cookies.set(
|
|
626
|
+
'csrftoken',
|
|
627
|
+
csrf_token,
|
|
628
|
+
{
|
|
629
|
+
path: '/',
|
|
630
|
+
domain: rootHostname,
|
|
631
|
+
...getCsrfCookieFlags()
|
|
632
|
+
}
|
|
633
|
+
);
|
|
646
634
|
}
|
|
647
635
|
} catch (error) {
|
|
648
|
-
logger.error('
|
|
636
|
+
logger.error('CSRF Error', {
|
|
649
637
|
error,
|
|
650
638
|
ip
|
|
651
639
|
});
|
|
652
640
|
}
|
|
653
|
-
|
|
654
|
-
|
|
641
|
+
} catch (error) {
|
|
642
|
+
logger.error('withPzDefault Error', {
|
|
643
|
+
error,
|
|
644
|
+
ip
|
|
645
|
+
});
|
|
655
646
|
}
|
|
656
|
-
|
|
647
|
+
|
|
648
|
+
return middlewareResult;
|
|
649
|
+
})
|
|
657
650
|
)
|
|
658
651
|
)
|
|
659
652
|
)
|
|
@@ -86,9 +86,7 @@ const withPrettyUrl =
|
|
|
86
86
|
const matchedLanguagePrefix = url.pathname.match(
|
|
87
87
|
urlLocaleMatcherRegex
|
|
88
88
|
)?.[0];
|
|
89
|
-
const prettyUrlPathname = matchedLanguagePrefix
|
|
90
|
-
? url.pathname.replace(matchedLanguagePrefix, '')
|
|
91
|
-
: url.pathname;
|
|
89
|
+
const prettyUrlPathname = url.pathname.replace(matchedLanguagePrefix, '');
|
|
92
90
|
const isValidPrettyUrlPath = (pathname: string) => {
|
|
93
91
|
return (
|
|
94
92
|
new RegExp(/^\/[a-zA-Z0-9/]+(?:-[a-zA-Z0-9/]+)*$/).test(pathname) &&
|
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": "2.0.141
|
|
4
|
+
"version": "2.0.141",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"set-cookie-parser": "2.6.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@akinon/eslint-plugin-projectzero": "2.0.141
|
|
39
|
+
"@akinon/eslint-plugin-projectzero": "2.0.141",
|
|
40
40
|
"@babel/core": "7.26.10",
|
|
41
41
|
"@babel/preset-env": "7.26.9",
|
|
42
42
|
"@babel/preset-typescript": "7.27.0",
|
package/plugins.d.ts
CHANGED
|
@@ -37,16 +37,6 @@ declare module '@akinon/pz-cybersource-uc/src/redux/middleware' {
|
|
|
37
37
|
export default middleware as any;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
declare module '@akinon/pz-apple-pay' {}
|
|
41
|
-
|
|
42
|
-
declare module '@akinon/pz-similar-products' {
|
|
43
|
-
export const SimilarProductsModal: any;
|
|
44
|
-
export const SimilarProductsFilterSidebar: any;
|
|
45
|
-
export const SimilarProductsResultsGrid: any;
|
|
46
|
-
export const SimilarProductsPlugin: any;
|
|
47
|
-
export const SimilarProductsButtonPlugin: any;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
40
|
declare module '@akinon/pz-cybersource-uc/src/redux/reducer' {
|
|
51
41
|
export default reducer as any;
|
|
52
42
|
}
|