@scayle/storefront-nuxt 7.61.3 → 7.61.5
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 +17 -0
- package/dist/module.json +1 -1
- package/dist/runtime/api/rpcHandler.d.ts +40 -1
- package/dist/runtime/composables/core/useIDP.d.ts +1 -1
- package/dist/runtime/composables/core/useRpc.d.ts +1 -1
- package/dist/runtime/composables/core/useRpc.mjs +11 -4
- package/dist/runtime/composables/core/useSession.d.ts +13 -7
- package/dist/runtime/composables/storefront/useBasket.d.ts +13 -2
- package/dist/runtime/composables/storefront/useBasket.mjs +3 -2
- package/dist/runtime/composables/storefront/useBrand.d.ts +1 -1
- package/dist/runtime/composables/storefront/useBrands.d.ts +1 -1
- package/dist/runtime/composables/storefront/useCategories.d.ts +6 -3
- package/dist/runtime/composables/storefront/useCategoryByPath.d.ts +1 -5
- package/dist/runtime/composables/storefront/useCurrentPromotions.d.ts +1 -1
- package/dist/runtime/composables/storefront/useFacet.d.ts +8 -6
- package/dist/runtime/composables/storefront/useFilters.d.ts +4 -1
- package/dist/runtime/composables/storefront/useNavigationTree.d.ts +1 -1
- package/dist/runtime/composables/storefront/useNavigationTrees.d.ts +1 -1
- package/dist/runtime/composables/storefront/useProduct.d.ts +1 -1
- package/dist/runtime/composables/storefront/useProducts.d.ts +4 -1
- package/dist/runtime/composables/storefront/useProductsByIds.d.ts +1 -1
- package/dist/runtime/composables/storefront/useProductsCount.d.ts +3 -1
- package/dist/runtime/composables/storefront/usePromotions.d.ts +1 -1
- package/dist/runtime/composables/storefront/usePromotionsByIds.d.ts +1 -1
- package/dist/runtime/composables/storefront/useShopConfiguration.d.ts +1 -1
- package/dist/runtime/composables/storefront/useUserAddresses.d.ts +1 -1
- package/dist/runtime/composables/storefront/useVariant.d.ts +1 -1
- package/dist/runtime/composables/storefront/useWishlist.d.ts +1 -1
- package/dist/runtime/composables/storefront/useWishlist.mjs +3 -2
- package/dist/runtime/server/middleware/bootstrap.mjs +28 -24
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @scayle/storefront-nuxt
|
|
2
2
|
|
|
3
|
+
## 7.61.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Log errors that occur when attaching the session in bootstrap
|
|
8
|
+
- Update the type of `data` returned by `useRpc` to indicate that it may be undefined. Note: This may cause new typechecking errors. These cases should be corrected to handle `undefined`. It was always possible for `data` to be `undefined`, but the types did not represent that.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @scayle/storefront-core@7.45.0
|
|
11
|
+
|
|
12
|
+
## 7.61.4
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Fix the type of unitialized data in `useBasket` and `useWishlist`
|
|
17
|
+
|
|
18
|
+
When the request for the basket/wishlist has not completed or has failed, the `data` property is `undefined`. In the previous release this was inadvertently changed to `null`. Now it is once again `undefined`.
|
|
19
|
+
|
|
3
20
|
## 7.61.3
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/module.json
CHANGED
|
@@ -1,2 +1,41 @@
|
|
|
1
|
-
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<
|
|
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> | {
|
|
2
|
+
type: "failure";
|
|
3
|
+
statusCode: number;
|
|
4
|
+
basket: import("@scayle/storefront-core").BasketResponseData<import("@scayle/storefront-core").Product, import("@scayle/storefront-core").Variant>;
|
|
5
|
+
} | {
|
|
6
|
+
readonly type: "success";
|
|
7
|
+
readonly basket: import("@scayle/storefront-core").BasketResponseData<import("@scayle/storefront-core").Product, import("@scayle/storefront-core").Variant>;
|
|
8
|
+
} | {
|
|
9
|
+
readonly type: "failure";
|
|
10
|
+
readonly basket: import("@scayle/storefront-core").BasketResponseData<import("@scayle/storefront-core").Product, import("@scayle/storefront-core").Variant>;
|
|
11
|
+
readonly errors: import("@aboutyou/backbone/helpers/BapiClient").AddOrUpdateItemError[];
|
|
12
|
+
} | import("@scayle/storefront-core").BrandsEndpointResponseData | import("@scayle/storefront-core").Brand | {
|
|
13
|
+
categories: import("@scayle/storefront-core").Category[];
|
|
14
|
+
activeNode: undefined;
|
|
15
|
+
} | import("@scayle/storefront-core").Category | {
|
|
16
|
+
categories: import("@scayle/storefront-core").Category;
|
|
17
|
+
activeNode: import("@scayle/storefront-core").Category;
|
|
18
|
+
} | import("@scayle/storefront-core").Order | import("@scayle/storefront-core").Product[] | {
|
|
19
|
+
products: import("@scayle/storefront-core").Product[];
|
|
20
|
+
pagination: import("@aboutyou/backbone/endpoints/products/productsByIds").Pagination;
|
|
21
|
+
} | {
|
|
22
|
+
filters: import("@aboutyou/backbone").FiltersEndpointResponseData;
|
|
23
|
+
unfilteredCount: number;
|
|
24
|
+
} | {
|
|
25
|
+
count: number;
|
|
26
|
+
} | import("@scayle/storefront-core").TypeaheadSuggestionsEndpointResponseData | import("@aboutyou/backbone/endpoints/shopconfiguration/shopconfiguration").ShopConfigurationResponseData | {
|
|
27
|
+
user: import("@scayle/storefront-core").ShopUser | undefined;
|
|
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
|
+
success: true;
|
|
30
|
+
} | {
|
|
31
|
+
success: false;
|
|
32
|
+
} | {
|
|
33
|
+
result: true;
|
|
34
|
+
} | {
|
|
35
|
+
result: false;
|
|
36
|
+
} | import("@scayle/storefront-core").PromotionsResponseData | {
|
|
37
|
+
[k: string]: string;
|
|
38
|
+
} | {
|
|
39
|
+
message: string;
|
|
40
|
+
} | undefined>>;
|
|
2
41
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const useIDP: () => Promise<{
|
|
2
2
|
data: import("vue").Ref<{
|
|
3
3
|
[k: string]: string;
|
|
4
|
-
}>;
|
|
4
|
+
} | undefined>;
|
|
5
5
|
fetching: import("vue").Ref<boolean>;
|
|
6
6
|
fetch: () => Promise<void>;
|
|
7
7
|
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
@@ -8,7 +8,7 @@ export interface RpcOptions {
|
|
|
8
8
|
}
|
|
9
9
|
export type Status = 'idle' | 'pending' | 'success' | 'error';
|
|
10
10
|
export declare const useRpc: <N extends RpcMethodName, P extends RpcMethodParameters<N>, TResult extends Exclude<Awaited<RpcMethodReturnType<N>>, Response>, TParams = P extends RpcContext ? undefined : P>(method: N, key: string, params?: any, options?: RpcOptions) => Promise<{
|
|
11
|
-
data: import("vue").Ref<TResult>;
|
|
11
|
+
data: import("vue").Ref<TResult | undefined>;
|
|
12
12
|
fetching: import("vue").Ref<boolean>;
|
|
13
13
|
fetch: () => Promise<void>;
|
|
14
14
|
error: import("vue").Ref<NuxtError<unknown> | undefined>;
|
|
@@ -21,13 +21,17 @@ export const useRpc = async (method, key, params, options = { autoFetch: true, l
|
|
|
21
21
|
const nuxtApp = useNuxtApp();
|
|
22
22
|
const isAutoFetchEnabled = options?.autoFetch ?? true;
|
|
23
23
|
log.debug(`useRpc: ${method}`);
|
|
24
|
-
const
|
|
25
|
-
const
|
|
24
|
+
const keyPrefix = `${method}-${key}`;
|
|
25
|
+
const data = useState(
|
|
26
|
+
`${keyPrefix}-data`,
|
|
27
|
+
() => void 0
|
|
28
|
+
);
|
|
29
|
+
const fetching = useState(`${keyPrefix}-fetching`, () => false);
|
|
26
30
|
const error = useState(
|
|
27
|
-
`${
|
|
31
|
+
`${keyPrefix}-error`,
|
|
28
32
|
() => void 0
|
|
29
33
|
);
|
|
30
|
-
const status = useState(`${
|
|
34
|
+
const status = useState(`${keyPrefix}-status`, () => "idle");
|
|
31
35
|
const fetch = async () => {
|
|
32
36
|
try {
|
|
33
37
|
status.value = "pending";
|
|
@@ -62,6 +66,9 @@ export const useRpc = async (method, key, params, options = { autoFetch: true, l
|
|
|
62
66
|
options.lazy ? fetch() : await fetch();
|
|
63
67
|
}
|
|
64
68
|
}
|
|
69
|
+
if (data.value === void 0 && error.value) {
|
|
70
|
+
throw createError(error.value);
|
|
71
|
+
}
|
|
65
72
|
return {
|
|
66
73
|
data,
|
|
67
74
|
fetching,
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
export declare function useSession(): {
|
|
2
|
-
login: (params: import("utility-types").Optional<import("@scayle/storefront-core").LoginRequest, "shop_id">) => Promise<
|
|
3
|
-
register: (params: import("utility-types").Optional<import("@scayle/storefront-core").RegisterRequest, "shop_id">) => Promise<
|
|
4
|
-
guestLogin: (params: import("utility-types").Optional<import("@scayle/storefront-core").GuestRequest, "shop_id">) => Promise<
|
|
2
|
+
login: (params: import("utility-types").Optional<import("@scayle/storefront-core").LoginRequest, "shop_id">) => Promise<never>;
|
|
3
|
+
register: (params: import("utility-types").Optional<import("@scayle/storefront-core").RegisterRequest, "shop_id">) => Promise<never>;
|
|
4
|
+
guestLogin: (params: import("utility-types").Optional<import("@scayle/storefront-core").GuestRequest, "shop_id">) => Promise<never>;
|
|
5
5
|
refreshToken: () => Promise<{
|
|
6
|
-
success:
|
|
6
|
+
success: true;
|
|
7
|
+
} | {
|
|
8
|
+
success: false;
|
|
7
9
|
}>;
|
|
8
10
|
revokeToken: () => Promise<{
|
|
9
|
-
result:
|
|
11
|
+
result: true;
|
|
12
|
+
} | {
|
|
13
|
+
result: false;
|
|
10
14
|
}>;
|
|
11
15
|
forgetPassword: (params: {
|
|
12
16
|
email: string;
|
|
13
17
|
}) => Promise<{
|
|
14
|
-
success:
|
|
18
|
+
success: true;
|
|
19
|
+
} | {
|
|
20
|
+
success: false;
|
|
15
21
|
}>;
|
|
16
|
-
resetPasswordByHash: (params: import("utility-types").Optional<import("@scayle/storefront-core").UpdatePasswordByHashRequest, "shop_id">) => Promise<
|
|
22
|
+
resetPasswordByHash: (params: import("utility-types").Optional<import("@scayle/storefront-core").UpdatePasswordByHashRequest, "shop_id">) => Promise<never>;
|
|
17
23
|
loginWithIDP: (params: {
|
|
18
24
|
code: string;
|
|
19
25
|
}) => Promise<{
|
|
@@ -6,7 +6,7 @@ type UseBasketOptions = Partial<{
|
|
|
6
6
|
key: string;
|
|
7
7
|
}>;
|
|
8
8
|
export declare function useBasket({ params, key, }?: UseBasketOptions): Promise<{
|
|
9
|
-
data: import("vue").Ref<BasketResponseData<import("@scayle/storefront-core").Product, import("@scayle/storefront-core").Variant> |
|
|
9
|
+
data: import("vue").Ref<BasketResponseData<import("@scayle/storefront-core").Product, import("@scayle/storefront-core").Variant> | undefined>;
|
|
10
10
|
items: import("vue").ComputedRef<import("@scayle/storefront-core").BasketItem<import("@scayle/storefront-core").Product, import("@scayle/storefront-core").Variant>[] | undefined>;
|
|
11
11
|
cost: import("vue").ComputedRef<import("@scayle/storefront-core").BasketTotalPrice | undefined>;
|
|
12
12
|
key: import("vue").ComputedRef<import("@aboutyou/backbone").BasketKey | undefined>;
|
|
@@ -46,7 +46,18 @@ export declare function useBasket({ params, key, }?: UseBasketOptions): Promise<
|
|
|
46
46
|
mergeBaskets: (args: {
|
|
47
47
|
fromBasketKey: string;
|
|
48
48
|
toBasketKey: string;
|
|
49
|
-
}) => Promise<
|
|
49
|
+
}) => Promise<{
|
|
50
|
+
type: "failure";
|
|
51
|
+
statusCode: number;
|
|
52
|
+
basket: BasketResponseData<import("@scayle/storefront-core").Product, import("@scayle/storefront-core").Variant>;
|
|
53
|
+
} | {
|
|
54
|
+
readonly type: "success";
|
|
55
|
+
readonly basket: BasketResponseData<import("@scayle/storefront-core").Product, import("@scayle/storefront-core").Variant>;
|
|
56
|
+
} | {
|
|
57
|
+
readonly type: "failure";
|
|
58
|
+
readonly basket: BasketResponseData<import("@scayle/storefront-core").Product, import("@scayle/storefront-core").Variant>;
|
|
59
|
+
readonly errors: import("@aboutyou/backbone/helpers/BapiClient").AddOrUpdateItemError[];
|
|
60
|
+
} | undefined>;
|
|
50
61
|
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
|
|
51
62
|
status: import("vue").Ref<import("nuxt/dist/app/composables/asyncData").AsyncDataRequestStatus>;
|
|
52
63
|
}>;
|
|
@@ -44,8 +44,9 @@ export async function useBasket({
|
|
|
44
44
|
watch: [toRef(params)],
|
|
45
45
|
dedupe: "defer",
|
|
46
46
|
getCachedData: (key2) => {
|
|
47
|
-
return toValue(nuxtApp._asyncData[key2]?.data);
|
|
48
|
-
}
|
|
47
|
+
return toValue(nuxtApp._asyncData[key2]?.data) ?? void 0;
|
|
48
|
+
},
|
|
49
|
+
default: () => void 0
|
|
49
50
|
}
|
|
50
51
|
);
|
|
51
52
|
useEventListener(
|
|
@@ -7,7 +7,7 @@ type Options = Partial<{
|
|
|
7
7
|
key: string;
|
|
8
8
|
}>;
|
|
9
9
|
export declare function useBrand({ params, options, key, }?: Options): Promise<{
|
|
10
|
-
data: import("vue").Ref<import("@scayle/storefront-core").Brand>;
|
|
10
|
+
data: import("vue").Ref<import("@scayle/storefront-core").Brand | undefined>;
|
|
11
11
|
fetching: import("vue").Ref<boolean>;
|
|
12
12
|
fetch: () => Promise<void>;
|
|
13
13
|
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
@@ -7,7 +7,7 @@ type Options = Partial<{
|
|
|
7
7
|
key: string;
|
|
8
8
|
}>;
|
|
9
9
|
export declare function useBrands({ params, options, key, }?: Options): Promise<{
|
|
10
|
-
data: import("vue").Ref<import("@scayle/storefront-core").BrandsEndpointResponseData>;
|
|
10
|
+
data: import("vue").Ref<import("@scayle/storefront-core").BrandsEndpointResponseData | undefined>;
|
|
11
11
|
fetching: import("vue").Ref<boolean>;
|
|
12
12
|
fetch: () => Promise<void>;
|
|
13
13
|
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
@@ -8,9 +8,12 @@ type Options = Partial<{
|
|
|
8
8
|
}>;
|
|
9
9
|
export declare function useCategories({ params, options, key, }?: Options): Promise<{
|
|
10
10
|
data: import("vue").Ref<{
|
|
11
|
-
categories: import("@scayle/storefront-core").Category
|
|
12
|
-
activeNode:
|
|
13
|
-
}
|
|
11
|
+
categories: import("@scayle/storefront-core").Category[];
|
|
12
|
+
activeNode: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
categories: import("@scayle/storefront-core").Category;
|
|
15
|
+
activeNode: import("@scayle/storefront-core").Category;
|
|
16
|
+
} | undefined>;
|
|
14
17
|
fetching: import("vue").Ref<boolean>;
|
|
15
18
|
fetch: () => Promise<void>;
|
|
16
19
|
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
@@ -7,11 +7,7 @@ type Options = {
|
|
|
7
7
|
key: string;
|
|
8
8
|
};
|
|
9
9
|
export declare function useCategoryByPath({ params, options, key, }: Options): Promise<{
|
|
10
|
-
data: import("vue").Ref<
|
|
11
|
-
path: string;
|
|
12
|
-
children?: number | undefined;
|
|
13
|
-
includeHidden?: true | undefined;
|
|
14
|
-
} | import("@scayle/storefront-core").Category>;
|
|
10
|
+
data: import("vue").Ref<import("@scayle/storefront-core").Category | undefined>;
|
|
15
11
|
fetching: import("vue").Ref<boolean>;
|
|
16
12
|
fetch: () => Promise<void>;
|
|
17
13
|
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
@@ -7,7 +7,7 @@ type Options = Partial<{
|
|
|
7
7
|
key: string;
|
|
8
8
|
}>;
|
|
9
9
|
export declare function useCurrentPromotions({ params, options, key, }?: Options): Promise<{
|
|
10
|
-
data: import("vue").Ref<import("@scayle/storefront-core").PromotionsResponseData>;
|
|
10
|
+
data: import("vue").Ref<import("@scayle/storefront-core").PromotionsResponseData | undefined>;
|
|
11
11
|
fetching: import("vue").Ref<boolean>;
|
|
12
12
|
fetch: () => Promise<void>;
|
|
13
13
|
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
@@ -12,23 +12,25 @@ type Options = Partial<{
|
|
|
12
12
|
key: string;
|
|
13
13
|
}>;
|
|
14
14
|
export declare function useFacet({ key, params, }?: Options): Promise<{
|
|
15
|
-
filters: import("vue").ComputedRef<import("@aboutyou/backbone").FiltersEndpointResponseData>;
|
|
15
|
+
filters: import("vue").ComputedRef<import("@aboutyou/backbone").FiltersEndpointResponseData | undefined>;
|
|
16
16
|
filtersFetching: import("vue").Ref<boolean>;
|
|
17
|
-
unfilteredCount: import("vue").ComputedRef<number>;
|
|
17
|
+
unfilteredCount: import("vue").ComputedRef<number | undefined>;
|
|
18
18
|
filterStatus: import("vue").Ref<import("../core/useRpc").Status>;
|
|
19
19
|
filterError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
20
|
-
productCountData: import("vue").Ref<
|
|
20
|
+
productCountData: import("vue").Ref<{
|
|
21
|
+
count: number;
|
|
22
|
+
} | undefined>;
|
|
21
23
|
refreshProductCount: ({ where, }?: FilterParams) => Promise<void>;
|
|
22
24
|
productCountFetching: import("vue").Ref<boolean>;
|
|
23
25
|
productCountError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
24
26
|
productCountStatus: import("vue").Ref<import("../core/useRpc").Status>;
|
|
25
|
-
products: import("vue").ComputedRef<import("@scayle/storefront-core").Product[]>;
|
|
26
|
-
pagination: import("vue").ComputedRef<import("@
|
|
27
|
+
products: import("vue").ComputedRef<import("@scayle/storefront-core").Product[] | undefined>;
|
|
28
|
+
pagination: import("vue").ComputedRef<import("@aboutyou/backbone/endpoints/products/productsByIds").Pagination | undefined>;
|
|
27
29
|
productsFetching: import("vue").Ref<boolean>;
|
|
28
30
|
filterProducts: ({ where, page, sort, orFiltersOperator, }: FilterParams) => Promise<void>;
|
|
29
31
|
productError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
30
32
|
productStatus: import("vue").Ref<import("../core/useRpc").Status>;
|
|
31
|
-
categories: import("vue").ComputedRef<import("@scayle/storefront-core").Category | import("@scayle/storefront-core").Category[]>;
|
|
33
|
+
categories: import("vue").ComputedRef<import("@scayle/storefront-core").Category | import("@scayle/storefront-core").Category[] | undefined>;
|
|
32
34
|
selectedCategory: import("vue").ComputedRef<import("@scayle/storefront-core").Category | undefined>;
|
|
33
35
|
categoriesFetching: import("vue").Ref<boolean>;
|
|
34
36
|
categoriesError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
@@ -7,7 +7,10 @@ type Options = Partial<{
|
|
|
7
7
|
key: string;
|
|
8
8
|
}>;
|
|
9
9
|
export declare function useFilters({ params, options, key, }?: Options): Promise<{
|
|
10
|
-
data: import("vue").Ref<
|
|
10
|
+
data: import("vue").Ref<{
|
|
11
|
+
filters: import("@aboutyou/backbone").FiltersEndpointResponseData;
|
|
12
|
+
unfilteredCount: number;
|
|
13
|
+
} | undefined>;
|
|
11
14
|
fetching: import("vue").Ref<boolean>;
|
|
12
15
|
fetch: () => Promise<void>;
|
|
13
16
|
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
@@ -7,7 +7,7 @@ type Options = Partial<{
|
|
|
7
7
|
key: string;
|
|
8
8
|
}>;
|
|
9
9
|
export declare function useNavigationTree({ params, options, key, }?: Options): Promise<{
|
|
10
|
-
data: import("vue").Ref<import("@scayle/storefront-core").NavigationTree>;
|
|
10
|
+
data: import("vue").Ref<import("@scayle/storefront-core").NavigationTree | undefined>;
|
|
11
11
|
fetching: import("vue").Ref<boolean>;
|
|
12
12
|
fetch: () => Promise<void>;
|
|
13
13
|
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
@@ -7,7 +7,7 @@ type Options = Partial<{
|
|
|
7
7
|
key: string;
|
|
8
8
|
}>;
|
|
9
9
|
export declare function useNavigationTrees({ params, options, key, }?: Options): Promise<{
|
|
10
|
-
data: import("vue").Ref<import("@aboutyou/backbone").NavigationAllEndpointResponseData>;
|
|
10
|
+
data: import("vue").Ref<import("@aboutyou/backbone").NavigationAllEndpointResponseData | undefined>;
|
|
11
11
|
fetching: import("vue").Ref<boolean>;
|
|
12
12
|
fetch: () => Promise<void>;
|
|
13
13
|
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
@@ -7,7 +7,7 @@ type Options = Partial<{
|
|
|
7
7
|
key: string;
|
|
8
8
|
}>;
|
|
9
9
|
export declare function useProduct({ params, options, key, }?: Options): Promise<{
|
|
10
|
-
data: import("vue").Ref<import("@scayle/storefront-core").Product>;
|
|
10
|
+
data: import("vue").Ref<import("@scayle/storefront-core").Product | undefined>;
|
|
11
11
|
fetching: import("vue").Ref<boolean>;
|
|
12
12
|
fetch: () => Promise<void>;
|
|
13
13
|
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
@@ -7,7 +7,10 @@ type Options = Partial<{
|
|
|
7
7
|
key: string;
|
|
8
8
|
}>;
|
|
9
9
|
export declare function useProducts({ params, options, key, }?: Options): Promise<{
|
|
10
|
-
data: import("vue").Ref<
|
|
10
|
+
data: import("vue").Ref<{
|
|
11
|
+
products: import("@scayle/storefront-core").Product[];
|
|
12
|
+
pagination: import("@aboutyou/backbone/endpoints/products/productsByIds").Pagination;
|
|
13
|
+
} | undefined>;
|
|
11
14
|
fetching: import("vue").Ref<boolean>;
|
|
12
15
|
fetch: () => Promise<void>;
|
|
13
16
|
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
@@ -7,7 +7,7 @@ type Options = Partial<{
|
|
|
7
7
|
key: string;
|
|
8
8
|
}>;
|
|
9
9
|
export declare function useProductsByIds({ params, options, key, }?: Options): Promise<{
|
|
10
|
-
data: import("vue").Ref<import("@scayle/storefront-core").Product[]>;
|
|
10
|
+
data: import("vue").Ref<import("@scayle/storefront-core").Product[] | undefined>;
|
|
11
11
|
fetching: import("vue").Ref<boolean>;
|
|
12
12
|
fetch: () => Promise<void>;
|
|
13
13
|
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
@@ -7,7 +7,9 @@ type Options = Partial<{
|
|
|
7
7
|
key: string;
|
|
8
8
|
}>;
|
|
9
9
|
export declare function useProductsCount({ params, options, key, }?: Options): Promise<{
|
|
10
|
-
data: import("vue").Ref<
|
|
10
|
+
data: import("vue").Ref<{
|
|
11
|
+
count: number;
|
|
12
|
+
} | undefined>;
|
|
11
13
|
fetching: import("vue").Ref<boolean>;
|
|
12
14
|
fetch: () => Promise<void>;
|
|
13
15
|
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
@@ -7,7 +7,7 @@ type Options = Partial<{
|
|
|
7
7
|
key: string;
|
|
8
8
|
}>;
|
|
9
9
|
export declare function usePromotions({ params, options, key, }?: Options): Promise<{
|
|
10
|
-
data: import("vue").Ref<import("@scayle/storefront-core").PromotionsResponseData>;
|
|
10
|
+
data: import("vue").Ref<import("@scayle/storefront-core").PromotionsResponseData | undefined>;
|
|
11
11
|
fetching: import("vue").Ref<boolean>;
|
|
12
12
|
fetch: () => Promise<void>;
|
|
13
13
|
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
@@ -7,7 +7,7 @@ type Options = Partial<{
|
|
|
7
7
|
key: string;
|
|
8
8
|
}>;
|
|
9
9
|
export declare function usePromotionsByIds({ params, options, key, }?: Options): Promise<{
|
|
10
|
-
data: import("vue").Ref<import("@scayle/storefront-core").PromotionsResponseData>;
|
|
10
|
+
data: import("vue").Ref<import("@scayle/storefront-core").PromotionsResponseData | undefined>;
|
|
11
11
|
fetching: import("vue").Ref<boolean>;
|
|
12
12
|
fetch: () => Promise<void>;
|
|
13
13
|
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
@@ -4,7 +4,7 @@ type Options = Partial<{
|
|
|
4
4
|
key: string;
|
|
5
5
|
}>;
|
|
6
6
|
export declare function useShopConfiguration({ options, key, }?: Options): Promise<{
|
|
7
|
-
data: import("vue").Ref<import("@aboutyou/backbone/endpoints/shopconfiguration/shopconfiguration").ShopConfigurationResponseData>;
|
|
7
|
+
data: import("vue").Ref<import("@aboutyou/backbone/endpoints/shopconfiguration/shopconfiguration").ShopConfigurationResponseData | undefined>;
|
|
8
8
|
fetching: import("vue").Ref<boolean>;
|
|
9
9
|
fetch: () => Promise<void>;
|
|
10
10
|
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
@@ -4,7 +4,7 @@ type Options = Partial<{
|
|
|
4
4
|
key: string;
|
|
5
5
|
}>;
|
|
6
6
|
export declare function useUserAddresses({ options, key, }?: Options): Promise<{
|
|
7
|
-
data: import("vue").Ref<import("@scayle/storefront-core").ShopUserAddress[]>;
|
|
7
|
+
data: import("vue").Ref<import("@scayle/storefront-core").ShopUserAddress[] | undefined>;
|
|
8
8
|
fetching: import("vue").Ref<boolean>;
|
|
9
9
|
fetch: () => Promise<void>;
|
|
10
10
|
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
@@ -7,7 +7,7 @@ type Options = Partial<{
|
|
|
7
7
|
key: string;
|
|
8
8
|
}>;
|
|
9
9
|
export declare function useVariant({ params, options, key, }?: Options): Promise<{
|
|
10
|
-
data: import("vue").Ref<import("@aboutyou/backbone/endpoints/variants/variantsByIds").VariantDetail[]>;
|
|
10
|
+
data: import("vue").Ref<import("@aboutyou/backbone/endpoints/variants/variantsByIds").VariantDetail[] | undefined>;
|
|
11
11
|
fetching: import("vue").Ref<boolean>;
|
|
12
12
|
fetch: () => Promise<void>;
|
|
13
13
|
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
@@ -5,7 +5,7 @@ type Options = Partial<{
|
|
|
5
5
|
key: string;
|
|
6
6
|
}>;
|
|
7
7
|
export declare function useWishlist({ params, key, }?: Options): Promise<{
|
|
8
|
-
data: import("vue").Ref<WishlistResponseData |
|
|
8
|
+
data: import("vue").Ref<WishlistResponseData | undefined>;
|
|
9
9
|
count: import("vue").ComputedRef<number | undefined>;
|
|
10
10
|
items: import("vue").ComputedRef<WishlistItem[] | undefined>;
|
|
11
11
|
products: import("vue").ComputedRef<Product[]>;
|
|
@@ -29,8 +29,9 @@ export async function useWishlist({
|
|
|
29
29
|
watch: [toRef(params)],
|
|
30
30
|
dedupe: "defer",
|
|
31
31
|
getCachedData: (key2) => {
|
|
32
|
-
return toValue(nuxtApp._asyncData[key2]?.data);
|
|
33
|
-
}
|
|
32
|
+
return toValue(nuxtApp._asyncData[key2]?.data) ?? void 0;
|
|
33
|
+
},
|
|
34
|
+
default: () => void 0
|
|
34
35
|
}
|
|
35
36
|
);
|
|
36
37
|
const addItem = async (item) => {
|
|
@@ -19,6 +19,14 @@ const getShopConfig = (event, config) => {
|
|
|
19
19
|
);
|
|
20
20
|
return $shopConfig;
|
|
21
21
|
};
|
|
22
|
+
const generateSessionId = (event) => {
|
|
23
|
+
let userId;
|
|
24
|
+
if (event?.context.session?.data?.accessToken) {
|
|
25
|
+
const payload = decodeJwt(event?.context.session?.data?.accessToken);
|
|
26
|
+
userId = payload.customerId;
|
|
27
|
+
}
|
|
28
|
+
return userId ? `${userId}:${randomUUID()}` : randomUUID();
|
|
29
|
+
};
|
|
22
30
|
async function bootstrap(event, url, $shopConfig, $storefrontConfig, apiBasePath, config) {
|
|
23
31
|
const log = event.context.$log;
|
|
24
32
|
const bootstrapLog = log.space("bootstrap");
|
|
@@ -44,31 +52,27 @@ async function bootstrap(event, url, $shopConfig, $storefrontConfig, apiBasePath
|
|
|
44
52
|
$shopConfig.shopId,
|
|
45
53
|
log
|
|
46
54
|
);
|
|
47
|
-
const generateSessionId = (event2) => {
|
|
48
|
-
let userId;
|
|
49
|
-
if (event2?.context.session?.data?.accessToken) {
|
|
50
|
-
const payload = decodeJwt(event2?.context.session?.data?.accessToken);
|
|
51
|
-
userId = payload.customerId;
|
|
52
|
-
}
|
|
53
|
-
return userId ? `${userId}:${randomUUID()}` : randomUUID();
|
|
54
|
-
};
|
|
55
55
|
bootstrapLog.debug("Attaching session to request");
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
56
|
+
try {
|
|
57
|
+
await useSession(event, {
|
|
58
|
+
...sessionConfig,
|
|
59
|
+
store: sessionStorage,
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
genid: generateSessionId,
|
|
62
|
+
saveUninitialized: true,
|
|
63
|
+
cookie: {
|
|
64
|
+
maxAge: sessionConfig?.maxAge,
|
|
65
|
+
// secure: sessionConfig.isHttps, TODO
|
|
66
|
+
sameSite: sessionConfig.sameSite,
|
|
67
|
+
domain: sessionConfig?.domain,
|
|
68
|
+
path: $storefrontConfig.shopSelector === "path" && $shopConfig.path ? `/${$shopConfig.path}` : void 0
|
|
69
|
+
},
|
|
70
|
+
name: sessionConfig?.cookieName ?? "$session",
|
|
71
|
+
secret: sessionConfig?.secret ?? "current-secret"
|
|
72
|
+
});
|
|
73
|
+
} catch (e) {
|
|
74
|
+
bootstrapLog.error("Error attaching session: ", e);
|
|
75
|
+
}
|
|
72
76
|
event.context.$currentShop = getPublicShopData(
|
|
73
77
|
$shopConfig,
|
|
74
78
|
$shopConfig.shopId,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.61.
|
|
4
|
+
"version": "7.61.5",
|
|
5
5
|
"description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
|
|
6
6
|
"author": "SCAYLE Commerce Engine",
|
|
7
7
|
"license": "MIT",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@nuxt/kit": "3.10.3",
|
|
64
64
|
"@scayle/h3-session": "0.3.5",
|
|
65
|
-
"@scayle/storefront-core": "7.
|
|
65
|
+
"@scayle/storefront-core": "7.45.0",
|
|
66
66
|
"@scayle/unstorage-compression-driver": "0.1.2",
|
|
67
67
|
"@vueuse/core": "10.9.0",
|
|
68
68
|
"consola": "3.2.3",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"defu": "6.1.4",
|
|
71
71
|
"jose": "^5.2.0",
|
|
72
72
|
"knitwork": "1.0.0",
|
|
73
|
-
"nitropack": "2.9.
|
|
73
|
+
"nitropack": "2.9.3",
|
|
74
74
|
"ofetch": "1.3.3",
|
|
75
75
|
"radash": "12.1.0",
|
|
76
76
|
"uncrypto": "0.1.3",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"@nuxt/test-utils": "3.11.0",
|
|
85
85
|
"@scayle/eslint-config-storefront": "3.2.6",
|
|
86
86
|
"@scayle/prettier-config-storefront": "2.0.2",
|
|
87
|
-
"@types/node": "20.11.
|
|
87
|
+
"@types/node": "20.11.28",
|
|
88
88
|
"eslint": "8.57.0",
|
|
89
89
|
"eslint-formatter-gitlab": "5.1.0",
|
|
90
90
|
"h3": "1.11.1",
|