@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 +7 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/composables/core/useRpc.mjs +7 -2
- package/dist/runtime/composables/core/useUser.d.ts +7 -3
- package/dist/runtime/composables/core/useUser.mjs +15 -6
- package/dist/runtime/composables/storefront/useFacet.mjs +4 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -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
|
|
19
|
-
|
|
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
|
|
2
|
-
export type ExtendedUseUserParams =
|
|
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(
|
|
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
|
-
|
|
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: {
|
|
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: {
|
|
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: {
|
|
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: {
|
|
82
|
+
options: { immediate: false },
|
|
83
83
|
key: `${key}-filters`
|
|
84
84
|
});
|
|
85
85
|
const {
|
package/package.json
CHANGED