@scayle/storefront-nuxt 7.88.1 → 7.90.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 +40 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +2 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/api/rpcHandler.d.ts +2 -2
- package/dist/runtime/plugin/shop.d.ts +4 -4
- package/dist/runtime/utils/category.d.ts +4 -0
- package/dist/runtime/utils/category.js +20 -0
- package/dist/runtime/utils/seo.d.ts +4 -0
- package/dist/runtime/utils/seo.js +28 -0
- package/dist/runtime/utils/zodSchema.d.ts +426 -426
- package/dist/test-factories/category.d.ts +3 -0
- package/dist/test-factories/category.mjs +18 -0
- package/dist/test-factories/index.d.ts +4 -0
- package/dist/test-factories/index.mjs +4 -0
- package/dist/test-factories/moduleOptions.d.ts +7 -0
- package/dist/test-factories/moduleOptions.mjs +27 -0
- package/dist/test-factories/rpcContext.d.ts +7 -0
- package/dist/test-factories/rpcContext.mjs +57 -0
- package/dist/test-factories/shopConfig.d.ts +3 -0
- package/dist/test-factories/shopConfig.mjs +19 -0
- package/package.json +14 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# @scayle/storefront-nuxt
|
|
2
2
|
|
|
3
|
+
## 7.90.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Fix RPC context test factory `Log` import
|
|
8
|
+
|
|
9
|
+
## 7.89.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- Add `category` test factory and expose all test factories. Moreover, `fishery` has
|
|
14
|
+
been added to the `peerDependencies` as it is main dependency for the test factories.
|
|
15
|
+
They can be used as follows:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { categoryFactory } from '@scayle/storefront-nuxt/test-factories'
|
|
19
|
+
|
|
20
|
+
categoryFactory.build()
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
- Introduce `seo` and `category` utilities within the module and expose them as externals.
|
|
24
|
+
The category utilities consist of various functions that manage category tree-structured data.
|
|
25
|
+
The SEO utilities focus primarily on generating schemas and manipulating URLs for SEO purposes.
|
|
26
|
+
|
|
27
|
+
They are exposed externally and can be used as follows:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { sanitizeCanonicalURL } from '@scayle/storefront-nuxt'
|
|
31
|
+
|
|
32
|
+
sanitizeCanonicalURL('/en/women-2045')
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- Added dependency `schema-dts@1.1.2`
|
|
38
|
+
- Updated dependency `ufo@^1.5.3` to `ufo@^1.5.4`
|
|
39
|
+
**Dependencies**
|
|
40
|
+
|
|
41
|
+
- Updated dependency to @scayle/unstorage-compression-driver@0.1.5
|
|
42
|
+
|
|
3
43
|
## 7.88.1
|
|
4
44
|
|
|
5
45
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { e as AdditionalShopConfig, A as AppKeys, B as BapiConfig, i as CheckoutEvent, C as CheckoutShopConfig, M as ModuleBaseOptions, j as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, d as SapiConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.80aa5060.mjs';
|
|
2
2
|
export { rpcCall } from '../dist/runtime/rpc/rpcCall.js';
|
|
3
3
|
export { extendPromise } from '../dist/runtime/utils/promise.js';
|
|
4
|
+
export * from '../dist/runtime/utils/category.js';
|
|
5
|
+
export * from '../dist/runtime/utils/seo.js';
|
|
4
6
|
export * from '@scayle/storefront-core';
|
|
5
7
|
export { LogLevel } from '@scayle/storefront-core';
|
|
6
8
|
export { unwrap } from '@scayle/storefront-core/dist/utils/response';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { e as AdditionalShopConfig, A as AppKeys, B as BapiConfig, i as CheckoutEvent, C as CheckoutShopConfig, M as ModuleBaseOptions, j as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, d as SapiConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.80aa5060.js';
|
|
2
2
|
export { rpcCall } from '../dist/runtime/rpc/rpcCall.js';
|
|
3
3
|
export { extendPromise } from '../dist/runtime/utils/promise.js';
|
|
4
|
+
export * from '../dist/runtime/utils/category.js';
|
|
5
|
+
export * from '../dist/runtime/utils/seo.js';
|
|
4
6
|
export * from '@scayle/storefront-core';
|
|
5
7
|
export { LogLevel } from '@scayle/storefront-core';
|
|
6
8
|
export { unwrap } from '@scayle/storefront-core/dist/utils/response';
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { rpcCall } from '../dist/runtime/rpc/rpcCall.js';
|
|
2
2
|
export { extendPromise } from '../dist/runtime/utils/promise.js';
|
|
3
|
+
export * from '../dist/runtime/utils/category.js';
|
|
4
|
+
export * from '../dist/runtime/utils/seo.js';
|
|
3
5
|
export * from '@scayle/storefront-core';
|
|
4
6
|
export { unwrap } from '@scayle/storefront-core/dist/utils/response';
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<string | true | string[] | import("@scayle/storefront-core").ShopUser | import("@scayle/storefront-api").Product | import("@scayle/storefront-api").Product[] | {
|
|
1
|
+
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<string | true | string[] | import("@scayle/storefront-core").ShopUser | Response | import("@scayle/storefront-api").Product | import("@scayle/storefront-api").Product[] | {
|
|
2
2
|
count: number;
|
|
3
3
|
} | {
|
|
4
4
|
filters: import("@scayle/storefront-api").FiltersEndpointResponseData;
|
|
@@ -34,7 +34,7 @@ declare const _default: import("h3").EventHandler<import("h3").EventHandlerReque
|
|
|
34
34
|
activeNode: import("@scayle/storefront-api").Category;
|
|
35
35
|
} | import("@scayle/storefront-core").Order | import("@scayle/storefront-api").TypeaheadSuggestionsEndpointResponseData | import("@scayle/storefront-api").SearchV2SuggestionsEndpointResponseData | import("@scayle/storefront-api").SearchEntity | import("@scayle/storefront-api").ShopConfiguration | {
|
|
36
36
|
user: import("@scayle/storefront-core").ShopUser | undefined;
|
|
37
|
-
} | import("@scayle/storefront-api").Wishlist |
|
|
37
|
+
} | import("@scayle/storefront-api").Wishlist | import("@scayle/storefront-core").ShopUserAddress[] | {
|
|
38
38
|
accessToken: string;
|
|
39
39
|
checkoutJwt: string;
|
|
40
40
|
} | import("@scayle/storefront-api").VariantDetail[] | import("@scayle/storefront-api").NavigationAllEndpointResponseData | import("@scayle/storefront-api").NavigationTree | {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
declare const _default: import("nuxt/app").Plugin<{
|
|
2
|
-
currentShop: import("
|
|
3
|
-
availableShops: import("
|
|
2
|
+
currentShop: import("../..").PublicShopConfig;
|
|
3
|
+
availableShops: import("../..").PublicShopConfig[];
|
|
4
4
|
}> & import("nuxt/app").ObjectPlugin<{
|
|
5
|
-
currentShop: import("
|
|
6
|
-
availableShops: import("
|
|
5
|
+
currentShop: import("../..").PublicShopConfig;
|
|
6
|
+
availableShops: import("../..").PublicShopConfig[];
|
|
7
7
|
}>;
|
|
8
8
|
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Category } from '@scayle/storefront-core';
|
|
2
|
+
export declare const getCategoryAncestors: (category: Category, categories?: Category[]) => Category[];
|
|
3
|
+
export declare const isSaleCategory: (category: Category) => boolean;
|
|
4
|
+
export declare const flattenCategoryTree: (categoryTree: Category[]) => Category[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const getCategoryAncestors = (category, categories = []) => {
|
|
2
|
+
if (!category?.parent) {
|
|
3
|
+
return categories;
|
|
4
|
+
}
|
|
5
|
+
return getCategoryAncestors(category.parent, [category.parent, ...categories]);
|
|
6
|
+
};
|
|
7
|
+
export const isSaleCategory = (category) => {
|
|
8
|
+
return category.properties.some(({ name }) => name === "sale");
|
|
9
|
+
};
|
|
10
|
+
export const flattenCategoryTree = (categoryTree) => {
|
|
11
|
+
const flattenedCategoryTreeList = categoryTree.flatMap((categoryNode) => [
|
|
12
|
+
categoryNode,
|
|
13
|
+
...categoryNode.children ? flattenCategoryTree(categoryNode.children) : []
|
|
14
|
+
]);
|
|
15
|
+
return [
|
|
16
|
+
...new Map(
|
|
17
|
+
flattenedCategoryTreeList.map((item) => [item.id, item])
|
|
18
|
+
).values()
|
|
19
|
+
];
|
|
20
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WithContext, BreadcrumbList } from 'schema-dts';
|
|
2
|
+
import type { BreadcrumbItem } from '@scayle/storefront-core';
|
|
3
|
+
export declare const sanitizeCanonicalURL: (url: string, whitelistParams?: string[]) => string;
|
|
4
|
+
export declare const generateCategoryBreadcrumbSchema: (breadcrumbs: BreadcrumbItem[]) => WithContext<BreadcrumbList>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { parseURL, stringifyParsedURL, parseQuery, stringifyQuery } from "ufo";
|
|
2
|
+
const CANONICAL_PARAMS_WHITELIST = ["page"];
|
|
3
|
+
export const sanitizeCanonicalURL = (url, whitelistParams = CANONICAL_PARAMS_WHITELIST) => {
|
|
4
|
+
const parsedURL = parseURL(url);
|
|
5
|
+
if (!parsedURL.search) {
|
|
6
|
+
return url;
|
|
7
|
+
}
|
|
8
|
+
const parsedQuery = parseQuery(parsedURL.search);
|
|
9
|
+
const purifiedQuery = Object.fromEntries(
|
|
10
|
+
Object.entries(parsedQuery).filter(
|
|
11
|
+
([key]) => whitelistParams.includes(key)
|
|
12
|
+
)
|
|
13
|
+
);
|
|
14
|
+
return stringifyParsedURL({
|
|
15
|
+
...parsedURL,
|
|
16
|
+
search: stringifyQuery(purifiedQuery)
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
export const generateCategoryBreadcrumbSchema = (breadcrumbs) => ({
|
|
20
|
+
"@context": "https://schema.org",
|
|
21
|
+
"@type": "BreadcrumbList",
|
|
22
|
+
itemListElement: breadcrumbs.map((item, index) => ({
|
|
23
|
+
"@type": "ListItem",
|
|
24
|
+
position: index + 1,
|
|
25
|
+
name: item.value,
|
|
26
|
+
item: item.to
|
|
27
|
+
}))
|
|
28
|
+
});
|