@graphcommerce/next-config 10.1.0-canary.40 → 10.1.0-canary.41
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/dist/index.js +11 -0
- package/package.json +2 -2
- package/src/withGraphCommerce.ts +25 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 10.1.0-canary.41
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2660](https://github.com/graphcommerce-org/graphcommerce/pull/2660) [`84e23e2`](https://github.com/graphcommerce-org/graphcommerce/commit/84e23e2408011fa4a6b0803843f01d96627f148f) - Redirect the Magento frontend account URLs that end up in transactional emails to their GraphCommerce equivalents.
|
|
8
|
+
|
|
9
|
+
Magento renders links from `base_link_url`, which on a headless setup points at the GraphCommerce storefront. Every stock email template contains a `customer/account/` link ("Sign in to your account"), and gated Magento routes 302 to `customer/account/login` — none of which GraphCommerce serves, so customers landed on a 404.
|
|
10
|
+
|
|
11
|
+
`withGraphCommerce` now adds permanent redirects for `/customer/account`, `/customer/account/index`, `/customer/account/login`, `/customer/account/create` and `/sales/order/history`. They are exact matches on purpose: a redirect wins over a filesystem route, and `/customer/account/confirm` and `/customer/account/createPassword` are real pages in the examples — the two that carry Magento's confirmation `key` and reset `rp_token`. A `/customer/account/:path*` catch-all would make both unreachable.
|
|
12
|
+
|
|
13
|
+
This restores the `/customer/account` redirect that was dropped as collateral in "Remove redirects for `/product/$type/[url]` routes". ([@paales](https://github.com/paales))
|
|
14
|
+
|
|
3
15
|
## 10.1.0-canary.40
|
|
4
16
|
|
|
5
17
|
## 10.1.0-canary.39
|
package/dist/index.js
CHANGED
|
@@ -1679,6 +1679,17 @@ function withGraphCommerce(nextConfig, cwd = process.cwd()) {
|
|
|
1679
1679
|
...nextConfig.images?.remotePatterns ?? []
|
|
1680
1680
|
].filter((v) => !!v)
|
|
1681
1681
|
},
|
|
1682
|
+
redirects: async () => {
|
|
1683
|
+
const redirects = await nextConfig.redirects?.() ?? [];
|
|
1684
|
+
redirects.push(
|
|
1685
|
+
{ source: "/customer/account", destination: "/account", permanent: true },
|
|
1686
|
+
{ source: "/customer/account/index", destination: "/account", permanent: true },
|
|
1687
|
+
{ source: "/customer/account/login", destination: "/account/signin", permanent: true },
|
|
1688
|
+
{ source: "/customer/account/create", destination: "/account/signin", permanent: true },
|
|
1689
|
+
{ source: "/sales/order/history", destination: "/account/orders", permanent: true }
|
|
1690
|
+
);
|
|
1691
|
+
return redirects;
|
|
1692
|
+
},
|
|
1682
1693
|
rewrites: async () => {
|
|
1683
1694
|
let rewrites = await nextConfig.rewrites?.() ?? [];
|
|
1684
1695
|
if (Array.isArray(rewrites)) {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/next-config",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "10.1.0-canary.
|
|
5
|
+
"version": "10.1.0-canary.41",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"@apollo/client": "*",
|
|
66
|
-
"@graphcommerce/prettier-config-pwa": "^10.1.0-canary.
|
|
66
|
+
"@graphcommerce/prettier-config-pwa": "^10.1.0-canary.41",
|
|
67
67
|
"@lingui/loader": "*",
|
|
68
68
|
"@lingui/macro": "*",
|
|
69
69
|
"@lingui/react": "*",
|
package/src/withGraphCommerce.ts
CHANGED
|
@@ -102,6 +102,31 @@ export function withGraphCommerce(nextConfig: NextConfig, cwd: string = process.
|
|
|
102
102
|
...(nextConfig.images?.remotePatterns ?? []),
|
|
103
103
|
].filter((v) => !!v),
|
|
104
104
|
},
|
|
105
|
+
redirects: async () => {
|
|
106
|
+
const redirects = (await nextConfig.redirects?.()) ?? []
|
|
107
|
+
|
|
108
|
+
// Magento builds its own frontend URLs from `base_link_url`, which on a
|
|
109
|
+
// headless setup points at the GraphCommerce storefront. Those URLs end up
|
|
110
|
+
// in transactional emails ("Sign in to your account" links every stock
|
|
111
|
+
// email template renders) and in the 302 Location of gated Magento routes,
|
|
112
|
+
// but GraphCommerce doesn't serve them, so they 404.
|
|
113
|
+
//
|
|
114
|
+
// A redirect wins over a filesystem route, so every source below must be
|
|
115
|
+
// a path GraphCommerce does *not* serve. Two Magento paths are real pages
|
|
116
|
+
// in the examples — /customer/account/confirm and
|
|
117
|
+
// /customer/account/createPassword, the ones carrying the confirmation
|
|
118
|
+
// `key` and the reset `rp_token` — so these stay exact matches. A
|
|
119
|
+
// `/customer/account/:path*` catch-all would make both unreachable.
|
|
120
|
+
redirects.push(
|
|
121
|
+
{ source: '/customer/account', destination: '/account', permanent: true },
|
|
122
|
+
{ source: '/customer/account/index', destination: '/account', permanent: true },
|
|
123
|
+
{ source: '/customer/account/login', destination: '/account/signin', permanent: true },
|
|
124
|
+
{ source: '/customer/account/create', destination: '/account/signin', permanent: true },
|
|
125
|
+
{ source: '/sales/order/history', destination: '/account/orders', permanent: true },
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
return redirects
|
|
129
|
+
},
|
|
105
130
|
rewrites: async () => {
|
|
106
131
|
let rewrites = (await nextConfig.rewrites?.()) ?? []
|
|
107
132
|
|