@scayle/storefront-core 8.48.0 → 8.49.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,56 @@
1
1
  # @scayle/storefront-core
2
2
 
3
+ ## 8.49.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Exported the `sha256` utility function as part of the public API.
8
+
9
+ This function provides a convenient way to calculate SHA256 hashes of strings using the Web Crypto API, returning hexadecimal strings.
10
+ Developers can now use this utility directly instead of implementing their own hashing logic or importing external cryptographic libraries.
11
+
12
+ Example:
13
+
14
+ ```ts
15
+ import { sha256 } from '@scayle/storefront-core'
16
+
17
+ const hash = await sha256('hello')
18
+ console.log(hash) // '2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824'
19
+ ```
20
+
21
+ ### Patch Changes
22
+
23
+ **Dependencies**
24
+
25
+ - Updated dependency to @scayle/storefront-api@18.18.1
26
+ - Updated dependency to @scayle/unstorage-scayle-kv-driver@2.0.7
27
+
28
+ ## 8.48.1
29
+
30
+ ### Patch Changes
31
+
32
+ - Export `SmartSortingKey` constant containing all predefined smart sorting keys for intelligent product sorting. Smart sorting keys provide advanced sorting algorithms that consider multiple factors like discounts, inventory levels, sales performance, and recency to optimize product listings.
33
+
34
+ Available keys:
35
+
36
+ - `SmartSortingKey.SALES_PUSH` - Promotes items with highest discounts and oldest inventory
37
+ - `SmartSortingKey.NEW_ARRIVALS` - Prioritizes recently added products with good availability
38
+ - `SmartSortingKey.BALANCED_OFFERINGS` - Balances recency, availability, discounts, and sales data
39
+ - `SmartSortingKey.INVENTORY_OPTIMIZATION` - Optimizes inventory turnover for high stock products
40
+ - `SmartSortingKey.LUXURY_PROMOTION` - Highlights high-value luxury items with discounts
41
+ - `SmartSortingKey.STOCK_COVERAGE` - Ensures broad variant availability across products
42
+ - `SmartSortingKey.TOPSELLER` - Prioritizes products with strong sales performance
43
+ - `SmartSortingKey.REVENUE_MAX` - Maximizes revenue by prioritizing high revenue products
44
+ - `SmartSortingKey.RECENTLY_POPULAR` - Favors products with high recent sales performance
45
+
46
+ These keys can be used with the `sortingKey` parameter in product queries and are intended to be used with descending sort order to return most relevant results first.
47
+
48
+ For further information on smart product sorting and how to use smart sorting keys, visit: https://scayle.dev/en/core-documentation/the-basics/products/product-sorting
49
+
50
+ **Dependencies**
51
+
52
+ - Updated dependency to @scayle/storefront-api@18.18.1
53
+
3
54
  ## 8.48.0
4
55
 
5
56
  ## 8.47.0
package/dist/index.d.ts CHANGED
@@ -68,4 +68,4 @@ export type RpcMethodParameters<N extends RpcMethodName> = Parameters<RpcMethod<
68
68
  */
69
69
  export type RpcMethodReturnType<N extends RpcMethodName> = ReturnType<RpcMethod<N>>;
70
70
  export type RpcMethodCall = <N extends RpcMethodName, P extends RpcMethodParameters<N>, TResult extends Exclude<Awaited<RpcMethodReturnType<N>>, Response>>(...args: P extends RpcContext ? [N] : [N, P]) => Promise<TResult>;
71
- export { ExistingItemHandling, AddToBasketFailureKind, UpdateBasketItemFailureKind, AddToWishlistFailureKind, PromotionEffectType, FilterTypes, APISortOption, APISortOrder, type Pagination, type ProductSortConfig, type ShopCountryCustomData, } from '@scayle/storefront-api';
71
+ export { ExistingItemHandling, AddToBasketFailureKind, UpdateBasketItemFailureKind, AddToWishlistFailureKind, PromotionEffectType, FilterTypes, APISortOption, APISortOrder, SmartSortingKey, type Pagination, type ProductSortConfig, type ShopCountryCustomData, } from '@scayle/storefront-api';
package/dist/index.mjs CHANGED
@@ -14,5 +14,6 @@ export {
14
14
  PromotionEffectType,
15
15
  FilterTypes,
16
16
  APISortOption,
17
- APISortOrder
17
+ APISortOrder,
18
+ SmartSortingKey
18
19
  } from "@scayle/storefront-api";
@@ -37,7 +37,7 @@ export const getCheckoutToken = defineRpcHandler(async (jwtPayload = {}, context
37
37
  ...customData,
38
38
  ...orderCustomData
39
39
  }
40
- }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"8.48.0"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
40
+ }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"8.49.0"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
41
41
  return {
42
42
  accessToken: refreshedAccessToken,
43
43
  checkoutJwt
@@ -6,3 +6,4 @@ export * from './campaign';
6
6
  export { unwrap } from './response';
7
7
  export { generateBasketKey, generateWishlistKey } from './keys';
8
8
  export { defineRpcHandler } from './rpc';
9
+ export { sha256 } from './hash';
@@ -6,3 +6,4 @@ export * from "./campaign.mjs";
6
6
  export { unwrap } from "./response.mjs";
7
7
  export { generateBasketKey, generateWishlistKey } from "./keys.mjs";
8
8
  export { defineRpcHandler } from "./rpc.mjs";
9
+ export { sha256 } from "./hash.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-core",
3
- "version": "8.48.0",
3
+ "version": "8.49.0",
4
4
  "description": "Collection of essential utilities to work with the Storefront API",
5
5
  "author": "SCAYLE Commerce Engine",
6
6
  "license": "MIT",
@@ -48,29 +48,29 @@
48
48
  "ufo": "^1.5.3",
49
49
  "uncrypto": "^0.1.3",
50
50
  "utility-types": "^3.11.0",
51
- "@scayle/storefront-api": "18.18.0",
51
+ "@scayle/storefront-api": "18.18.1",
52
52
  "@scayle/unstorage-scayle-kv-driver": "2.0.7"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/crypto-js": "4.2.2",
56
- "@types/node": "22.18.13",
56
+ "@types/node": "22.19.0",
57
57
  "@types/webpack-env": "1.18.8",
58
58
  "@vitest/coverage-v8": "3.2.4",
59
59
  "dprint": "0.50.2",
60
60
  "eslint-formatter-gitlab": "6.0.1",
61
- "eslint": "9.38.0",
61
+ "eslint": "9.39.1",
62
62
  "fishery": "2.3.1",
63
63
  "publint": "0.3.15",
64
- "rimraf": "6.0.1",
64
+ "rimraf": "6.1.0",
65
65
  "typescript": "5.9.3",
66
66
  "unbuild": "3.6.1",
67
67
  "unstorage": "1.17.1",
68
68
  "vitest": "3.2.4",
69
- "@scayle/eslint-config-storefront": "4.7.11",
69
+ "@scayle/eslint-config-storefront": "4.7.12",
70
70
  "@scayle/vitest-config-storefront": "1.0.0"
71
71
  },
72
72
  "volta": {
73
- "node": "22.21.0"
73
+ "node": "22.21.1"
74
74
  },
75
75
  "scripts": {
76
76
  "clean": "rimraf ./dist",