@akinon/next 1.25.0-rc.1 → 1.25.0-rc.2

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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # @akinon/next
2
2
 
3
+ ## 1.25.0-rc.2
4
+
5
+ ### Minor Changes
6
+
7
+ - 7e41bdc: BRDG-9158: Remove redirect-three-d page endpoint
8
+
9
+ ### Patch Changes
10
+
11
+ - @akinon/eslint-plugin-projectzero@1.25.0-rc.2
12
+
3
13
  ## 1.25.0-rc.1
4
14
 
5
15
  ### Minor Changes
@@ -97,6 +97,12 @@ const withPzDefault =
97
97
  );
98
98
  }
99
99
 
100
+ if (req.nextUrl.pathname.startsWith('/orders/redirect-three-d')) {
101
+ return NextResponse.rewrite(
102
+ new URL(`${encodeURI(Settings.commerceUrl)}/orders/redirect-three-d/`)
103
+ );
104
+ }
105
+
100
106
  // If commerce redirects to /orders/checkout/ without locale
101
107
  if (
102
108
  req.nextUrl.pathname.match(new RegExp('^/orders/checkout/$')) &&
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.25.0-rc.1",
4
+ "version": "1.25.0-rc.2",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -1,74 +0,0 @@
1
- 'use client';
2
-
3
- import { useEffect, useState } from 'react';
4
- import { ROUTES } from 'routes';
5
- import { useGet3dRedirectFormQuery } from '@akinon/next/data/client/checkout';
6
- import { LoaderSpinner } from 'components';
7
- import { useLocalization } from '../../../hooks/use-localization';
8
- import { getUrlPathWithLocale } from '../../../utils/localization';
9
- import { useSearchParams } from 'next/navigation';
10
-
11
- interface RedirectThreeDContentProps {
12
- sessionId: string;
13
- }
14
-
15
- export default function RedirectThreeDContent({
16
- sessionId
17
- }: RedirectThreeDContentProps) {
18
- const searchParams = useSearchParams();
19
- const { data } = useGet3dRedirectFormQuery();
20
- const [error, setError] = useState(null);
21
- const { locale } = useLocalization();
22
-
23
- useEffect(() => {
24
- if (data) {
25
- const fragment = document.createElement('fragment');
26
- fragment.innerHTML = data.result;
27
-
28
- const form = fragment.querySelector('form');
29
-
30
- // a way to determine if response includes a redirection form or not
31
- if (fragment.querySelector('link[rel="canonical"]') || !form) {
32
- setError('Redirecting to checkout page. Please wait...');
33
-
34
- setTimeout(() => {
35
- let checkoutUrl = `${ROUTES.CHECKOUT}`;
36
-
37
- // iframe param is used to prevent header and footer rendering
38
- if (searchParams.get('iframe') === 'true') {
39
- checkoutUrl = `${checkoutUrl}?iframe=true`;
40
- }
41
-
42
- // Use `window.location.href` instead of `router.push`
43
- // to capture the url change event in iframe
44
- location.href = getUrlPathWithLocale(checkoutUrl, locale);
45
- }, 3000);
46
- return;
47
- }
48
-
49
- const pzParamsInput = document.createElement('input');
50
- pzParamsInput.setAttribute('type', 'hidden');
51
- pzParamsInput.setAttribute('name', 'pzparams');
52
- pzParamsInput.setAttribute(
53
- 'value',
54
- encodeURIComponent(
55
- JSON.stringify({
56
- session: sessionId,
57
- locale
58
- })
59
- )
60
- );
61
- form.appendChild(pzParamsInput);
62
-
63
- form.style.display = 'none';
64
- document.body.appendChild(form);
65
- form.submit();
66
- }
67
- }, [data]);
68
-
69
- return (
70
- <div className="flex items-center justify-center py-20">
71
- {error ?? <LoaderSpinner />}
72
- </div>
73
- );
74
- }
@@ -1,17 +0,0 @@
1
- import { cookies } from 'next/headers';
2
- import { redirect } from 'next/navigation';
3
- import RedirectThreeDContent from './content';
4
- import { ROUTES } from 'routes';
5
-
6
- const RedirectThreeD = async () => {
7
- const nextCookies = cookies();
8
- const sessionId = await nextCookies.get('osessionid')?.value;
9
-
10
- if (!sessionId) {
11
- return redirect(ROUTES.CHECKOUT);
12
- }
13
-
14
- return <RedirectThreeDContent sessionId={sessionId} />;
15
- };
16
-
17
- export default RedirectThreeD;