@scayle/storefront-nuxt 7.62.3 → 7.63.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/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 7.63.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add support for dynamically adding query parameters to the IDP redirect callback URLs to be read back when the user returns from the IDP.
8
+
9
+ ```ts
10
+ const { data: externalIDPRedirects } = await useIDP({
11
+ queryParams: { redirectTo: '/account' },
12
+ })
13
+ ```
14
+
15
+ Please note that `code` and `state` are not supported as these are used by the SCAYLE Authentication API.
16
+
17
+ ### Patch Changes
18
+
19
+ - Avoid querying for redirects on pages matching the `/__nuxt_error` pattern.
20
+ - Updated dependencies
21
+ - @scayle/storefront-core@7.48.0
22
+
23
+ ## 7.62.4
24
+
25
+ ### Patch Changes
26
+
27
+ - Removed direct logging of `vm` in `log.client.ts` to fix a recursive/infinite logging issue, now logging `vm.$options` instead.
28
+ - Updated dependencies
29
+ - @scayle/storefront-core@7.47.0
30
+
3
31
  ## 7.62.3
4
32
 
5
33
  ### Patch Changes
@@ -642,8 +670,8 @@ There is an `unwrap` function exported by this package (>=7.55.0) that can be us
642
670
 
643
671
  ### Minor Changes
644
672
 
645
- - - Add promotion data to the `addItemToBasket` method
646
- - - Add `usePromotions`, `useCurrentPromotions` & `usePromotionsByIds` composables
673
+ - Add promotion data to the `addItemToBasket` method
674
+ - Add `usePromotions`, `useCurrentPromotions` & `usePromotionsByIds` composables
647
675
 
648
676
  ### Patch Changes
649
677
 
@@ -1142,8 +1170,8 @@ There is an `unwrap` function exported by this package (>=7.55.0) that can be us
1142
1170
 
1143
1171
  ### Minor Changes
1144
1172
 
1145
- - - Add possibility to define the session config on application and store level.
1146
- - Add possibility to configure the `domain` attribute of the session cookie
1173
+ - Add possibility to define the session config on application and store level.
1174
+ - Add possibility to configure the `domain` attribute of the session cookie
1147
1175
 
1148
1176
  ## 7.0.0
1149
1177
 
package/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.9.0"
6
6
  },
7
- "version": "7.62.2"
7
+ "version": "7.62.4"
8
8
  }
@@ -1,4 +1,4 @@
1
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<boolean | string[] | import("@scayle/storefront-core").ShopUser | import("@scayle/storefront-core").Product | import("@scayle/storefront-core").BasketResponseData<import("@scayle/storefront-core").Product, import("@scayle/storefront-core").Variant> | {
1
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<boolean | void | string[] | import("@scayle/storefront-core").ShopUser | import("@scayle/storefront-core").Product | import("@scayle/storefront-core").BasketResponseData<import("@scayle/storefront-core").Product, import("@scayle/storefront-core").Variant> | {
2
2
  type: "failure";
3
3
  statusCode: number;
4
4
  basket: import("@scayle/storefront-core").BasketResponseData<import("@scayle/storefront-core").Product, import("@scayle/storefront-core").Variant>;
@@ -23,7 +23,7 @@ declare const _default: import("h3").EventHandler<import("h3").EventHandlerReque
23
23
  unfilteredCount: number;
24
24
  } | {
25
25
  count: number;
26
- } | import("@scayle/storefront-core").TypeaheadSuggestionsEndpointResponseData | import("@aboutyou/backbone/endpoints/shopconfiguration/shopconfiguration").ShopConfigurationResponseData | {
26
+ } | import("@scayle/storefront-core").TypeaheadSuggestionsEndpointResponseData | import("@scayle/storefront-core").SearchV2SuggestionsEndpointResponseData | import("@scayle/storefront-core").SearchEntity | import("@aboutyou/backbone/endpoints/shopconfiguration/shopconfiguration").ShopConfigurationResponseData | {
27
27
  user: import("@scayle/storefront-core").ShopUser | undefined;
28
28
  } | import("@scayle/storefront-core").WishlistResponseData | Response | import("@scayle/storefront-core").ShopUserAddress[] | import("@aboutyou/backbone/endpoints/variants/variantsByIds").VariantDetail[] | import("@aboutyou/backbone").NavigationAllEndpointResponseData | import("@scayle/storefront-core").NavigationTree | {
29
29
  success: true;
@@ -37,5 +37,5 @@ declare const _default: import("h3").EventHandler<import("h3").EventHandlerReque
37
37
  [k: string]: string;
38
38
  } | {
39
39
  message: string;
40
- } | undefined>>;
40
+ } | null>>;
41
41
  export default _default;
@@ -1,4 +1,6 @@
1
- export declare const useIDP: () => Promise<{
1
+ import { type MaybeRefOrGetter } from 'vue';
2
+ import type { RpcMethodParameters } from '@scayle/storefront-core';
3
+ export declare const useIDP: (params?: MaybeRefOrGetter<RpcMethodParameters<'getExternalIdpRedirect'>>) => Promise<{
2
4
  data: import("vue").Ref<{
3
5
  [k: string]: string;
4
6
  } | undefined>;
@@ -3,12 +3,13 @@ import { useRpc } from "../core/useRpc.mjs";
3
3
  import { rpcCall } from "./../../rpc/rpcCall.mjs";
4
4
  import { useCurrentShop } from "./useCurrentShop.mjs";
5
5
  import { toValue } from "#imports";
6
- export const useIDP = async () => {
6
+ export const useIDP = async (params = {}) => {
7
7
  const nuxtApp = useNuxtApp();
8
8
  const shop = useCurrentShop();
9
9
  const { data, fetching, fetch, error, status } = await useRpc(
10
10
  "getExternalIdpRedirect",
11
- "getExternalIdpRedirect"
11
+ `getExternalIdpRedirect-${JSON.stringify(toValue(params))}`,
12
+ params
12
13
  );
13
14
  const handleIDPLoginCallback = rpcCall(
14
15
  nuxtApp,
@@ -18,7 +18,7 @@ export declare function useBasket({ params, key, }?: UseBasketOptions): Promise<
18
18
  count: import("vue").ComputedRef<number | undefined>;
19
19
  countWithoutSoldOutItems: import("vue").ComputedRef<number | undefined>;
20
20
  addItem: ({ variantId, promotionId, quantity, existingItemHandling, displayData, customData, itemGroup, }: AddOrUpdateItemType & {
21
- existingItemHandling?: 0 | 1 | 2 | 3 | undefined;
21
+ existingItemHandling?: ExistingItemHandling;
22
22
  }) => Promise<void>;
23
23
  addItems: (items: AddOrUpdateItemType[], existingItemHandling?: 1) => Promise<void>;
24
24
  removeItem: (item: {
@@ -20,9 +20,17 @@ export default defineNuxtPlugin((nuxtApp) => {
20
20
  });
21
21
  function addClientSideErrorHandling(log, app) {
22
22
  app.config.warnHandler = (msg, vm, trace) => {
23
- log.space("warnHandler").warn(msg, { vm, trace });
23
+ log.space("warnHandler").warn(msg, {
24
+ vmOptions: vm?.$options,
25
+ trace,
26
+ component: vm?.$options.__name
27
+ });
24
28
  };
25
29
  app.config.errorHandler = (error, vm, info) => {
26
- log.space("errorHandler").error(error, { vm, info, component: vm?.$options.__name });
30
+ log.space("errorHandler").error(error, {
31
+ vmOptions: vm?.$options,
32
+ info,
33
+ component: vm?.$options.__name
34
+ });
27
35
  };
28
36
  }
@@ -105,14 +105,12 @@ async function bootstrap(event, $shopConfig, $storefrontConfig, apiBasePath, con
105
105
  }
106
106
  function getBootstrapPath(event) {
107
107
  const url = getRequestURL(event);
108
- if (url.pathname === "/__nuxt_error") {
109
- return url.searchParams.get("url") ?? url.pathname;
110
- }
111
- return url.pathname;
108
+ const path = url.pathname === "/__nuxt_error" ? url.searchParams.get("url") ?? url.pathname : url.pathname;
109
+ return { path, originalPath: url.pathname };
112
110
  }
113
111
  export default defineEventHandler(async (event) => {
114
112
  try {
115
- const path = getBootstrapPath(event);
113
+ const { path, originalPath } = getBootstrapPath(event);
116
114
  if (path.startsWith("/__nuxt")) {
117
115
  return;
118
116
  }
@@ -133,7 +131,7 @@ export default defineEventHandler(async (event) => {
133
131
  config
134
132
  );
135
133
  }
136
- if ($storefrontConfig.redirects?.enabled && !path.startsWith(apiBasePath)) {
134
+ if ($storefrontConfig.redirects?.enabled && !path.startsWith(apiBasePath) && originalPath !== "/__nuxt_error") {
137
135
  await useRedirects(event);
138
136
  }
139
137
  } catch (e) {
@@ -18,7 +18,9 @@ async function fetchRedirectWithCache(sourceUrl, bapiClient, redirectCache, log)
18
18
  try {
19
19
  bapiResult = await bapiClient.redirects.post(sourceUrl);
20
20
  } catch (error) {
21
- log.error(`Error: Failed to fetch redirects ... ${error}`);
21
+ log.error(
22
+ `Error: Failed to fetch redirects ... ${error} for sourceURL: ${sourceUrl}`
23
+ );
22
24
  return null;
23
25
  }
24
26
  const isValidRedirect = (redirect) => {
@@ -67,17 +69,17 @@ export async function useRedirects(event) {
67
69
  log.info(`There are multiple valid redirects for: ${url.toString()}`);
68
70
  }
69
71
  const redirect = relativeRedirect ?? absoluteRedirect;
72
+ if (!redirect) {
73
+ log.debug(`There are no valid redirects for: ${url.toString()}`);
74
+ return;
75
+ }
70
76
  try {
71
- if (redirect?.target) {
72
- log.debug(`Redirecting to ${redirect.target}`);
73
- await sendRedirect(
74
- event,
75
- getTargetLocation(url, redirect.target, queryParamWhitelist),
76
- redirect.statusCode
77
- );
78
- } else {
79
- log.debug(`No redirect found`);
80
- }
77
+ log.debug(`Redirecting to ${redirect.target}`);
78
+ await sendRedirect(
79
+ event,
80
+ getTargetLocation(url, redirect.target, queryParamWhitelist),
81
+ redirect.statusCode
82
+ );
81
83
  } catch (error) {
82
84
  log.error(`Error: Failed to execute redirect ... ${error}`);
83
85
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "7.62.3",
4
+ "version": "7.63.0",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -62,15 +62,15 @@
62
62
  "dependencies": {
63
63
  "@nuxt/kit": "3.11.1",
64
64
  "@scayle/h3-session": "0.3.5",
65
- "@scayle/storefront-core": "7.46.1",
65
+ "@scayle/storefront-core": "7.48.0",
66
66
  "@scayle/unstorage-compression-driver": "0.1.2",
67
67
  "@vueuse/core": "10.9.0",
68
68
  "consola": "3.2.3",
69
69
  "core-js": "3.36.1",
70
70
  "defu": "6.1.4",
71
71
  "jose": "^5.2.0",
72
- "knitwork": "1.0.0",
73
- "nitropack": "2.9.5",
72
+ "knitwork": "1.1.0",
73
+ "nitropack": "2.9.6",
74
74
  "ofetch": "1.3.4",
75
75
  "radash": "12.1.0",
76
76
  "uncrypto": "0.1.3",
@@ -85,7 +85,7 @@
85
85
  "@scayle/eslint-config-storefront": "3.2.6",
86
86
  "@scayle/eslint-plugin-vue-composable": "0.1.1",
87
87
  "@scayle/prettier-config-storefront": "2.0.2",
88
- "@types/node": "20.11.30",
88
+ "@types/node": "20.12.5",
89
89
  "eslint": "8.57.0",
90
90
  "eslint-formatter-gitlab": "5.1.0",
91
91
  "h3": "1.11.1",
@@ -109,6 +109,6 @@
109
109
  "@nuxt/schema": "3.11.1"
110
110
  },
111
111
  "volta": {
112
- "node": "20.11.1"
112
+ "node": "20.12.1"
113
113
  }
114
114
  }