@scayle/storefront-core 8.59.0 → 8.59.2

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,58 @@
1
1
  # @scayle/storefront-core
2
2
 
3
+ ## 8.59.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Deprecated the `slugify` and `getProductPath` functions in `productHelpers.ts` due to compatibility issues with Nuxt 4.
8
+
9
+ To maintain compatibility with Nuxt 4, these functions have been deprecated. Developers should migrate to using `useRouteHelpers().slugify()` instead. Additionally, the `slugify` package must be added as a direct dependency in your Storefront Application.
10
+
11
+ **Migration:**
12
+
13
+ ```ts
14
+ import baseSlugify from 'slugify'
15
+
16
+ const slugify = (url: string | undefined): string => {
17
+ return baseSlugify(url ?? '', {
18
+ lower: true,
19
+ remove: /[*+~.()'"!:@/#?]/g,
20
+ })
21
+ }
22
+
23
+ const localePath = useLocalePath()
24
+
25
+ const getProductDetailRoute = (
26
+ id: number,
27
+ name?: string,
28
+ locale?: Locale,
29
+ ): string => {
30
+ return localePath(
31
+ {
32
+ name: 'p-productName-id',
33
+ params: {
34
+ productName: slugify(name),
35
+ id: `${id}`,
36
+ },
37
+ },
38
+ locale,
39
+ )
40
+ }
41
+ ```
42
+
43
+ ## 8.59.1
44
+
45
+ ### Patch Changes
46
+
47
+ - Fixed import compatibility issue with the `slugify` package in `productHelpers.ts` to support both ESM and CommonJS module formats.
48
+
49
+ The import was changed from a default import to a namespace import with a fallback, ensuring the `baseSlugify` function works correctly across different module systems and build configurations.
50
+
51
+ **Dependencies**
52
+
53
+ - Updated dependency to @scayle/storefront-api@18.21.0
54
+ - Updated dependency to @scayle/unstorage-scayle-kv-driver@2.0.10
55
+
3
56
  ## 8.59.0
4
57
 
5
58
  ### Minor Changes
@@ -4,6 +4,8 @@ interface Route {
4
4
  path?: string;
5
5
  }
6
6
  /**
7
+ * @deprecated This function will be removed in the next major version. This function has known compatibility issues with Nuxt 4. Please use `slugify()` from the `slugify` package directly in your Storefront Application.
8
+ *
7
9
  * Generates a slug from a given URL string.
8
10
  *
9
11
  * @param url The URL string to slugify.
@@ -164,6 +166,8 @@ export declare const isVariantInStock: (variants: Variant[], size: Value, sizeAt
164
166
  */
165
167
  export declare const getAttribute: (product: Product, key: string) => string | undefined;
166
168
  /**
169
+ * @deprecated Will be removed in the next major version. Please use `useRouteHelpers().getProductDetailRoute()` instead.
170
+ *
167
171
  * Generates the product path based on product name and id
168
172
  *
169
173
  * @param product The product object
@@ -1,9 +1,10 @@
1
1
  import { getFirstAttributeValue } from "@scayle/storefront-api";
2
- import baseSlugify from "slugify";
2
+ import * as slugifyPackage from "slugify";
3
3
  import { ProductImageType } from "../constants/product.mjs";
4
4
  import { getAttributeValue, getAttributeValueTuples } from "./attributeHelpers.mjs";
5
5
  import { getImageFromList } from "./imageHelpers.mjs";
6
6
  import { flattenDeep } from "./arrayHelpers.mjs";
7
+ const baseSlugify = slugifyPackage.default || slugifyPackage;
7
8
  export const slugify = (url) => {
8
9
  return baseSlugify(url ?? "", {
9
10
  lower: true,
@@ -40,7 +40,7 @@ export const getCheckoutToken = defineRpcHandler(async (jwtPayload = {}, context
40
40
  ...customData,
41
41
  ...orderCustomData
42
42
  }
43
- }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"8.59.0"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
43
+ }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"8.59.2"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
44
44
  return {
45
45
  accessToken: refreshedAccessToken,
46
46
  checkoutJwt
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-core",
3
- "version": "8.59.0",
3
+ "version": "8.59.2",
4
4
  "description": "Collection of essential utilities to work with the Storefront API",
5
5
  "author": "SCAYLE Commerce Engine",
6
6
  "license": "MIT",
@@ -60,14 +60,14 @@
60
60
  "eslint-formatter-gitlab": "7.0.1",
61
61
  "eslint": "9.39.2",
62
62
  "fishery": "2.4.0",
63
- "publint": "0.3.16",
63
+ "publint": "0.3.17",
64
64
  "rimraf": "6.1.2",
65
65
  "typescript": "5.9.3",
66
66
  "unbuild": "3.6.1",
67
67
  "unstorage": "1.17.4",
68
68
  "vitest": "4.0.17",
69
- "@scayle/vitest-config-storefront": "1.0.0",
70
- "@scayle/eslint-config-storefront": "4.7.21"
69
+ "@scayle/eslint-config-storefront": "4.7.22",
70
+ "@scayle/vitest-config-storefront": "1.0.0"
71
71
  },
72
72
  "scripts": {
73
73
  "clean": "rimraf ./dist",