@scayle/storefront-nuxt 7.75.0 → 7.75.1

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,12 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 7.75.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Add `immediate` option to `useUser` and deprecate `autoFetch`
8
+ - Log warning when deprecated `autoFetch` option is used
9
+
3
10
  ## 7.75.0
4
11
 
5
12
  ### Minor Changes
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
- "version": "7.74.0",
3
+ "version": "7.75.0",
4
4
  "configKey": "storefront",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.9.0"
package/dist/module.mjs CHANGED
@@ -64,7 +64,7 @@ export default {
64
64
  }`;
65
65
  }
66
66
  const PACKAGE_NAME = "@scayle/storefront-nuxt";
67
- const PACKAGE_VERSION = "7.74.0";
67
+ const PACKAGE_VERSION = "7.75.0";
68
68
  const logger = createConsola({
69
69
  fancy: true,
70
70
  formatOptions: {
@@ -15,8 +15,13 @@ export function useRpc(method, key, params, options) {
15
15
  const currentShop = useCurrentShop();
16
16
  const log = useCoreLog("rpc");
17
17
  const nuxtApp = useNuxtApp();
18
- if (options && options.autoFetch !== void 0 && options.immediate === void 0) {
19
- options.immediate = options.autoFetch;
18
+ if (options && options.autoFetch !== void 0) {
19
+ log.warn("autoFetch is disabled; use immediate instead");
20
+ if (options.immediate === void 0) {
21
+ options.immediate = options.autoFetch;
22
+ } else {
23
+ log.warn("autoFetch will be ignored because immediate was specified");
24
+ }
20
25
  }
21
26
  const asyncData = useAsyncData(
22
27
  key,
@@ -1,8 +1,12 @@
1
- import type { ShopUser, UpdatePasswordParams, UseUserParams } from '@scayle/storefront-core';
2
- export type ExtendedUseUserParams = UseUserParams & {
1
+ import type { ShopUser, UpdatePasswordParams } from '@scayle/storefront-core';
2
+ export type ExtendedUseUserParams = {
3
+ key?: string;
4
+ /** @deprecated use immediate instead */
5
+ autoFetch?: boolean;
6
+ immediate?: boolean;
3
7
  lazy?: boolean;
4
8
  };
5
- export declare function useUser({ autoFetch, lazy, key, }?: ExtendedUseUserParams): {
9
+ export declare function useUser(options?: ExtendedUseUserParams): {
6
10
  user: import("vue").ComputedRef<ShopUser | undefined>;
7
11
  isLoggedIn: import("vue").ComputedRef<boolean>;
8
12
  customerType: import("vue").ComputedRef<"guest" | "new" | "existing">;
@@ -6,20 +6,29 @@ import { extendPromise } from "../../utils/promise.mjs";
6
6
  import { useRpc } from "./useRpc.mjs";
7
7
  import { useCurrentShop } from "./useCurrentShop.mjs";
8
8
  import { toValue } from "#imports";
9
- export function useUser({
10
- autoFetch = true,
11
- lazy = false,
12
- key = "useUser"
13
- } = {}) {
9
+ export function useUser(options = {}) {
14
10
  const nuxtApp = useNuxtApp();
15
11
  const shop = useCurrentShop();
16
12
  const log = useCoreLog("useUser");
13
+ if (options && options.autoFetch !== void 0) {
14
+ log.warn("autoFetch is disabled; use immediate instead");
15
+ if (options.immediate === void 0) {
16
+ options.immediate = options.autoFetch;
17
+ } else {
18
+ log.warn("autoFetch will be ignored because immediate was specified");
19
+ }
20
+ }
21
+ const {
22
+ immediate = true,
23
+ lazy = false,
24
+ key = "useUser"
25
+ } = options;
17
26
  const asyncDataPromise = useRpc(
18
27
  "getUser",
19
28
  key,
20
29
  void 0,
21
30
  {
22
- autoFetch,
31
+ immediate,
23
32
  lazy,
24
33
  server: false,
25
34
  dedupe: "defer",
@@ -38,7 +38,7 @@ export function useFacet({
38
38
  path: currentPath.value,
39
39
  includeHidden: params.with?.product?.categories?.includeHidden || void 0
40
40
  }),
41
- options: { autoFetch: false },
41
+ options: { immediate: false },
42
42
  key: `${key}-categories`
43
43
  });
44
44
  const productsPromise = useProducts({
@@ -55,7 +55,7 @@ export function useFacet({
55
55
  cache: currentCacheParams.value,
56
56
  orFiltersOperator: currentOrFiltersOperator.value
57
57
  }),
58
- options: { autoFetch: false },
58
+ options: { immediate: false },
59
59
  key: `${key}-products`
60
60
  });
61
61
  const productsCountPromise = useProductsCount({
@@ -67,7 +67,7 @@ export function useFacet({
67
67
  where: productCountWhere.value,
68
68
  orFiltersOperator: currentOrFiltersOperator.value
69
69
  }),
70
- options: { autoFetch: false },
70
+ options: { immediate: false },
71
71
  key: `${key}-productCount`
72
72
  });
73
73
  const filtersPromise = useFilters({
@@ -79,7 +79,7 @@ export function useFacet({
79
79
  where: currentWhereCondition.value,
80
80
  orFiltersOperator: currentOrFiltersOperator.value
81
81
  }),
82
- options: { autoFetch: false },
82
+ options: { immediate: false },
83
83
  key: `${key}-filters`
84
84
  });
85
85
  const {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "7.75.0",
4
+ "version": "7.75.1",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",