@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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
- "version": "7.88.1",
3
+ "version": "7.90.0",
4
4
  "configKey": "storefront",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.9.0"
package/dist/module.mjs CHANGED
@@ -48,7 +48,7 @@ export default {
48
48
  }`;
49
49
  }
50
50
  const PACKAGE_NAME = "@scayle/storefront-nuxt";
51
- const PACKAGE_VERSION = "7.88.1";
51
+ const PACKAGE_VERSION = "7.90.0";
52
52
  const logger = createConsola({
53
53
  fancy: true,
54
54
  formatOptions: {
@@ -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 | Response | import("@scayle/storefront-core").ShopUserAddress[] | {
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("../../module").PublicShopConfig;
3
- availableShops: import("../../module").PublicShopConfig[];
2
+ currentShop: import("../..").PublicShopConfig;
3
+ availableShops: import("../..").PublicShopConfig[];
4
4
  }> & import("nuxt/app").ObjectPlugin<{
5
- currentShop: import("../../module").PublicShopConfig;
6
- availableShops: import("../../module").PublicShopConfig[];
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
+ });