@scayle/storefront-nuxt 7.62.1 → 7.62.3
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 +14 -0
- package/dist/module.json +1 -1
- package/dist/runtime/composables/storefront/useBasket.d.ts +1 -1
- package/dist/runtime/composables/storefront/useBasket.mjs +4 -4
- package/dist/runtime/composables/storefront/useFacet.mjs +79 -72
- package/dist/runtime/composables/storefront/useWishlist.d.ts +1 -1
- package/dist/runtime/server/middleware/bootstrap.mjs +13 -7
- package/package.json +9 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @scayle/storefront-nuxt
|
|
2
2
|
|
|
3
|
+
## 7.62.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Ensure composables are not called asynchronously in `useBasket` and `useFacet`
|
|
8
|
+
|
|
9
|
+
## 7.62.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Error pages should be bootstrapped based on the URL where the error occurred
|
|
14
|
+
|
|
15
|
+
This resolves an issue where context properties such as `currentShop` and `availableShops` were not available on the error page.
|
|
16
|
+
|
|
3
17
|
## 7.62.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/module.json
CHANGED
|
@@ -59,6 +59,6 @@ export declare function useBasket({ params, key, }?: UseBasketOptions): Promise<
|
|
|
59
59
|
readonly errors: import("@aboutyou/backbone/helpers/BapiClient").AddOrUpdateItemError[];
|
|
60
60
|
} | undefined>;
|
|
61
61
|
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
|
|
62
|
-
status: import("vue").Ref<import("nuxt/
|
|
62
|
+
status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
|
|
63
63
|
}>;
|
|
64
64
|
export {};
|
|
@@ -29,6 +29,10 @@ export async function useBasket({
|
|
|
29
29
|
} = {}) {
|
|
30
30
|
const nuxtApp = useNuxtApp();
|
|
31
31
|
const shop = useCurrentShop();
|
|
32
|
+
useEventListener(
|
|
33
|
+
"message",
|
|
34
|
+
(event) => onCheckoutUpdate(event, fetching.value, fetch)
|
|
35
|
+
);
|
|
32
36
|
const {
|
|
33
37
|
data,
|
|
34
38
|
pending: fetching,
|
|
@@ -49,10 +53,6 @@ export async function useBasket({
|
|
|
49
53
|
default: () => void 0
|
|
50
54
|
}
|
|
51
55
|
);
|
|
52
|
-
useEventListener(
|
|
53
|
-
"message",
|
|
54
|
-
(event) => onCheckoutUpdate(event, fetching.value, fetch)
|
|
55
|
-
);
|
|
56
56
|
const addItem = async ({
|
|
57
57
|
variantId,
|
|
58
58
|
promotionId,
|
|
@@ -28,81 +28,88 @@ export async function useFacet({
|
|
|
28
28
|
const productCountWhere = useState(
|
|
29
29
|
`${key}-productCountWhereCondition`
|
|
30
30
|
);
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
31
|
+
const [
|
|
32
|
+
{
|
|
33
|
+
data: categoryData,
|
|
34
|
+
fetch: refreshCategories,
|
|
35
|
+
fetching: categoriesFetching,
|
|
36
|
+
error: categoriesError,
|
|
37
|
+
status: categoriesStatus
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
data: productData,
|
|
41
|
+
fetch: _refreshProducts,
|
|
42
|
+
fetching: productsFetching,
|
|
43
|
+
error: productError,
|
|
44
|
+
status: productStatus
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
data: productCountData,
|
|
48
|
+
fetch: _refreshProductCount,
|
|
49
|
+
fetching: productCountFetching,
|
|
50
|
+
error: productCountError,
|
|
51
|
+
status: productCountStatus
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
data: filterData,
|
|
55
|
+
fetch: refreshFilters,
|
|
56
|
+
fetching: filtersFetching,
|
|
57
|
+
error: filterError,
|
|
58
|
+
status: filterStatus
|
|
59
|
+
}
|
|
60
|
+
] = await Promise.all([
|
|
61
|
+
useCategories({
|
|
62
|
+
params: () => ({
|
|
63
|
+
path: currentPath.value,
|
|
64
|
+
includeHidden: params.with?.product?.categories?.includeHidden || void 0
|
|
65
|
+
}),
|
|
66
|
+
options: { autoFetch: false },
|
|
67
|
+
key: `${key}-categories`
|
|
66
68
|
}),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
orFiltersOperator: currentOrFiltersOperator.value
|
|
69
|
+
useProducts({
|
|
70
|
+
params: () => ({
|
|
71
|
+
page: currentPage.value,
|
|
72
|
+
perPage: currentPerPage.value,
|
|
73
|
+
with: params.with?.product,
|
|
74
|
+
category: currentPath.value,
|
|
75
|
+
includeSoldOut: params.includeSoldOut,
|
|
76
|
+
includeSellableForFree: params.includeSellableForFree,
|
|
77
|
+
where: currentWhereCondition.value,
|
|
78
|
+
sort: currentSorting.value,
|
|
79
|
+
pricePromotionKey: currentPricePromotionKey.value,
|
|
80
|
+
cache: currentCacheParams.value,
|
|
81
|
+
orFiltersOperator: currentOrFiltersOperator.value
|
|
82
|
+
}),
|
|
83
|
+
options: { autoFetch: false },
|
|
84
|
+
key: `${key}-products`
|
|
84
85
|
}),
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
category: currentPath.value,
|
|
97
|
-
includedFilters: params.includedFilters,
|
|
98
|
-
includeSoldOut: params.includeSoldOut,
|
|
99
|
-
includeSellableForFree: params.includeSellableForFree,
|
|
100
|
-
where: currentWhereCondition.value,
|
|
101
|
-
orFiltersOperator: currentOrFiltersOperator.value
|
|
86
|
+
useProductsCount({
|
|
87
|
+
params: () => ({
|
|
88
|
+
category: currentPath.value,
|
|
89
|
+
includedFilters: params.includedFilters,
|
|
90
|
+
includeSoldOut: params.includeSoldOut,
|
|
91
|
+
includeSellableForFree: params.includeSellableForFree,
|
|
92
|
+
where: productCountWhere.value,
|
|
93
|
+
orFiltersOperator: currentOrFiltersOperator.value
|
|
94
|
+
}),
|
|
95
|
+
options: { autoFetch: false },
|
|
96
|
+
key: `${key}-productCount`
|
|
102
97
|
}),
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
98
|
+
useFilters({
|
|
99
|
+
params: () => ({
|
|
100
|
+
category: currentPath.value,
|
|
101
|
+
includedFilters: params.includedFilters,
|
|
102
|
+
includeSoldOut: params.includeSoldOut,
|
|
103
|
+
includeSellableForFree: params.includeSellableForFree,
|
|
104
|
+
where: currentWhereCondition.value,
|
|
105
|
+
orFiltersOperator: currentOrFiltersOperator.value
|
|
106
|
+
}),
|
|
107
|
+
options: { autoFetch: false },
|
|
108
|
+
key: `${key}-filters`
|
|
109
|
+
})
|
|
110
|
+
]);
|
|
111
|
+
const categories = computed(() => categoryData.value?.categories);
|
|
112
|
+
const selectedCategory = computed(() => categoryData.value?.activeNode);
|
|
106
113
|
const pagination = computed(() => productData.value?.pagination);
|
|
107
114
|
const products = computed(() => productData.value?.products);
|
|
108
115
|
const filters = computed(() => filterData.value?.filters);
|
|
@@ -41,6 +41,6 @@ export declare function useWishlist({ params, key, }?: Options): Promise<{
|
|
|
41
41
|
productId: number;
|
|
42
42
|
}) => boolean;
|
|
43
43
|
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
|
|
44
|
-
status: import("vue").Ref<import("nuxt/
|
|
44
|
+
status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
|
|
45
45
|
}>;
|
|
46
46
|
export {};
|
|
@@ -27,10 +27,9 @@ const generateSessionId = (event) => {
|
|
|
27
27
|
}
|
|
28
28
|
return userId ? `${userId}:${randomUUID()}` : randomUUID();
|
|
29
29
|
};
|
|
30
|
-
async function bootstrap(event,
|
|
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
|
|
110
|
-
if (
|
|
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 (
|
|
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 && !
|
|
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.
|
|
4
|
+
"version": "7.62.3",
|
|
5
5
|
"description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
|
|
6
6
|
"author": "SCAYLE Commerce Engine",
|
|
7
7
|
"license": "MIT",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"test:watch": "vitest watch"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@nuxt/kit": "3.
|
|
63
|
+
"@nuxt/kit": "3.11.1",
|
|
64
64
|
"@scayle/h3-session": "0.3.5",
|
|
65
65
|
"@scayle/storefront-core": "7.46.1",
|
|
66
66
|
"@scayle/unstorage-compression-driver": "0.1.2",
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"defu": "6.1.4",
|
|
71
71
|
"jose": "^5.2.0",
|
|
72
72
|
"knitwork": "1.0.0",
|
|
73
|
-
"nitropack": "2.9.
|
|
74
|
-
"ofetch": "1.3.
|
|
73
|
+
"nitropack": "2.9.5",
|
|
74
|
+
"ofetch": "1.3.4",
|
|
75
75
|
"radash": "12.1.0",
|
|
76
76
|
"uncrypto": "0.1.3",
|
|
77
77
|
"unstorage": "1.10.2",
|
|
@@ -80,16 +80,17 @@
|
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@nuxt/module-builder": "0.5.5",
|
|
83
|
-
"@nuxt/schema": "3.
|
|
83
|
+
"@nuxt/schema": "3.11.1",
|
|
84
84
|
"@nuxt/test-utils": "3.12.0",
|
|
85
85
|
"@scayle/eslint-config-storefront": "3.2.6",
|
|
86
|
+
"@scayle/eslint-plugin-vue-composable": "0.1.1",
|
|
86
87
|
"@scayle/prettier-config-storefront": "2.0.2",
|
|
87
88
|
"@types/node": "20.11.30",
|
|
88
89
|
"eslint": "8.57.0",
|
|
89
90
|
"eslint-formatter-gitlab": "5.1.0",
|
|
90
91
|
"h3": "1.11.1",
|
|
91
92
|
"node-mocks-http": "1.14.1",
|
|
92
|
-
"nuxt": "3.
|
|
93
|
+
"nuxt": "3.11.1",
|
|
93
94
|
"prettier": "3.0.0",
|
|
94
95
|
"publint": "0.2.7",
|
|
95
96
|
"vitest": "1.4.0",
|
|
@@ -104,8 +105,8 @@
|
|
|
104
105
|
"resolutions": {
|
|
105
106
|
"h3": "1.11.1",
|
|
106
107
|
"vue": "3.4.21",
|
|
107
|
-
"@nuxt/kit": "3.
|
|
108
|
-
"@nuxt/schema": "3.
|
|
108
|
+
"@nuxt/kit": "3.11.1",
|
|
109
|
+
"@nuxt/schema": "3.11.1"
|
|
109
110
|
},
|
|
110
111
|
"volta": {
|
|
111
112
|
"node": "20.11.1"
|