@scayle/storefront-nuxt 7.62.0 → 7.62.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,21 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 7.62.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Error pages should be bootstrapped based on the URL where the error occurred
8
+
9
+ This resolves an issue where context properties such as `currentShop` and `availableShops` were not available on the error page.
10
+
11
+ ## 7.62.1
12
+
13
+ ### Patch Changes
14
+
15
+ - Revert breaking change in `handleIDPLoginCallback` signature
16
+ - Updated dependencies
17
+ - @scayle/storefront-core@7.46.1
18
+
3
19
  ## 7.62.0
4
20
 
5
21
  ### Minor Changes
package/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.9.0"
6
6
  },
7
- "version": "7.61.5"
7
+ "version": "7.62.1"
8
8
  }
@@ -6,7 +6,11 @@ export default defineEventHandler(async (event) => {
6
6
  const pathComponents = event.path.split("?")[0].split("/");
7
7
  const method = pathComponents[pathComponents.length - 1];
8
8
  const body = await readBody(event);
9
- const payloadToBeLogged = JSON.stringify(purifySensitiveData(body?.payload));
9
+ const payloadToBeLogged = JSON.stringify(
10
+ purifySensitiveData(
11
+ typeof body?.payload !== "object" ? { [typeof body?.payload]: body?.payload } : body?.payload
12
+ )
13
+ );
10
14
  event.context.$rpcContext.log.space("sfc").debug(`RPC Handler: ${method}, Payload: ${payloadToBeLogged}`);
11
15
  try {
12
16
  return await handler(method, body?.payload, event.context.$rpcContext);
@@ -6,7 +6,7 @@ export declare const useIDP: () => Promise<{
6
6
  fetch: () => Promise<void>;
7
7
  error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
8
8
  status: import("vue").Ref<import("../core/useRpc").Status>;
9
- handleIDPLoginCallback: (params: {
9
+ handleIDPLoginCallback: (params: string | {
10
10
  code: string;
11
11
  }) => Promise<{
12
12
  message: string;
@@ -20,7 +20,7 @@ export declare function useSession(): {
20
20
  success: false;
21
21
  }>;
22
22
  resetPasswordByHash: (params: import("utility-types").Optional<import("@scayle/storefront-core").UpdatePasswordByHashRequest, "shop_id">) => Promise<never>;
23
- loginWithIDP: (params: {
23
+ loginWithIDP: (params: string | {
24
24
  code: string;
25
25
  }) => Promise<{
26
26
  message: string;
@@ -27,10 +27,9 @@ const generateSessionId = (event) => {
27
27
  }
28
28
  return userId ? `${userId}:${randomUUID()}` : randomUUID();
29
29
  };
30
- async function bootstrap(event, url, $shopConfig, $storefrontConfig, apiBasePath, config) {
30
+ async function bootstrap(event, $shopConfig, $storefrontConfig, apiBasePath, config) {
31
31
  const log = event.context.$log;
32
32
  const bootstrapLog = log.space("bootstrap");
33
- bootstrapLog.debug("Bootstrapping request: " + url.toString());
34
33
  const $cache = useCacheStorage(
35
34
  String($shopConfig.shopId),
36
35
  $shopConfig.shopId,
@@ -104,30 +103,37 @@ async function bootstrap(event, url, $shopConfig, $storefrontConfig, apiBasePath
104
103
  event
105
104
  });
106
105
  }
106
+ function getBootstrapPath(event) {
107
+ const url = getRequestURL(event);
108
+ if (url.pathname === "/__nuxt_error") {
109
+ return url.searchParams.get("url") ?? url.pathname;
110
+ }
111
+ return url.pathname;
112
+ }
107
113
  export default defineEventHandler(async (event) => {
108
114
  try {
109
- const url = getRequestURL(event);
110
- if (url.pathname.startsWith("/__nuxt")) {
115
+ const path = getBootstrapPath(event);
116
+ if (path.startsWith("/__nuxt")) {
111
117
  return;
112
118
  }
113
119
  const config = useRuntimeConfig();
114
120
  const $storefrontConfig = config.storefront;
115
- if (url.pathname === `${$storefrontConfig.apiBasePath ?? "/api"}/up`) {
121
+ if (path === `${$storefrontConfig.apiBasePath ?? "/api"}/up`) {
116
122
  return;
117
123
  }
118
124
  const $shopConfig = getShopConfig(event, config);
119
125
  const apiBasePath = ($storefrontConfig.shopSelector === "path" && $shopConfig.path ? `/${$shopConfig.path}` : "") + ($shopConfig.apiBasePath || $storefrontConfig.apiBasePath || "/api");
120
126
  if (!event.context.$rpcContext) {
127
+ event.context.$log.debug("Bootstrapping request: " + path);
121
128
  await bootstrap(
122
129
  event,
123
- url,
124
130
  $shopConfig,
125
131
  $storefrontConfig,
126
132
  apiBasePath,
127
133
  config
128
134
  );
129
135
  }
130
- if ($storefrontConfig.redirects?.enabled && !url.pathname.startsWith(apiBasePath)) {
136
+ if ($storefrontConfig.redirects?.enabled && !path.startsWith(apiBasePath)) {
131
137
  await useRedirects(event);
132
138
  }
133
139
  } catch (e) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "7.62.0",
4
+ "version": "7.62.2",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -62,16 +62,16 @@
62
62
  "dependencies": {
63
63
  "@nuxt/kit": "3.10.3",
64
64
  "@scayle/h3-session": "0.3.5",
65
- "@scayle/storefront-core": "7.46.0",
65
+ "@scayle/storefront-core": "7.46.1",
66
66
  "@scayle/unstorage-compression-driver": "0.1.2",
67
67
  "@vueuse/core": "10.9.0",
68
68
  "consola": "3.2.3",
69
- "core-js": "3.36.0",
69
+ "core-js": "3.36.1",
70
70
  "defu": "6.1.4",
71
71
  "jose": "^5.2.0",
72
72
  "knitwork": "1.0.0",
73
- "nitropack": "2.9.3",
74
- "ofetch": "1.3.3",
73
+ "nitropack": "2.9.4",
74
+ "ofetch": "1.3.4",
75
75
  "radash": "12.1.0",
76
76
  "uncrypto": "0.1.3",
77
77
  "unstorage": "1.10.2",
@@ -81,10 +81,10 @@
81
81
  "devDependencies": {
82
82
  "@nuxt/module-builder": "0.5.5",
83
83
  "@nuxt/schema": "3.10.3",
84
- "@nuxt/test-utils": "3.11.0",
84
+ "@nuxt/test-utils": "3.12.0",
85
85
  "@scayle/eslint-config-storefront": "3.2.6",
86
86
  "@scayle/prettier-config-storefront": "2.0.2",
87
- "@types/node": "20.11.28",
87
+ "@types/node": "20.11.30",
88
88
  "eslint": "8.57.0",
89
89
  "eslint-formatter-gitlab": "5.1.0",
90
90
  "h3": "1.11.1",
@@ -92,8 +92,8 @@
92
92
  "nuxt": "3.10.3",
93
93
  "prettier": "3.0.0",
94
94
  "publint": "0.2.7",
95
- "vitest": "1.3.1",
96
- "vue-tsc": "2.0.6"
95
+ "vitest": "1.4.0",
96
+ "vue-tsc": "2.0.7"
97
97
  },
98
98
  "peerDependencies": {
99
99
  "h3": "^1.10.0",