@scayle/storefront-core 8.51.0 → 8.53.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,29 @@
1
1
  # @scayle/storefront-core
2
2
 
3
+ ## 8.53.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Added support for promotions on order items by introducing the `OrderItemPromotion` interface and extending the `OrderItem` type with an optional `promotions` field.
8
+
9
+ This enables developers to access promotion information (`id`, `name`, and `version`) directly from order items, improving visibility into which promotions were applied to each item in an order.
10
+ Additionally, the `appliedReductions` array within the order item price now includes an optional `id` field, allowing for better tracking and identification of specific discount reductions.
11
+
12
+ For further details, see the [Order API](https://scayle.dev/en/api-guides/storefront-api/resources/orders).
13
+
14
+ ## 8.52.0
15
+
16
+ ### Minor Changes
17
+
18
+ - Extended the `OrderItem` type to support `'promotion'` as a valid category in `appliedReductions`, enabling proper type checking for promotion-based discounts in order items.
19
+
20
+ ### Patch Changes
21
+
22
+ **Dependencies**
23
+
24
+ - Updated dependency to @scayle/storefront-api@18.18.1
25
+ - Updated dependency to @scayle/unstorage-scayle-kv-driver@2.0.8
26
+
3
27
  ## 8.51.0
4
28
 
5
29
  ### Minor Changes
@@ -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.51.0"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
40
+ }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"8.53.0"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
41
41
  return {
42
42
  accessToken: refreshedAccessToken,
43
43
  checkoutJwt
@@ -105,6 +105,11 @@ export type OrderStatus = 'order_open' | 'payment_pending' | 'payment_reserved'
105
105
  export type OrderStatusCode = 'order_created' | 'order_open' | 'order_pended' | 'order_confirmed' | 'order_delegated' | 'order_shipped' | 'order_invoiced' | 'order_aborted' | 'order_cancelled' | 'order_imported' | 'order_invoice_error';
106
106
  export type BillingStatusCode = 'billing_open' | 'billing_pending' | 'billing_payment_pending' | 'billing_completed' | 'billing_payment_cancelled' | 'billing_partially_refunded' | 'billing_refunded';
107
107
  export type ShippingStatusCode = 'shipping_open' | 'shipping_not_deliverable' | 'shipping_ordered' | 'shipping_delivered' | 'shipping_cancelled' | 'shipping_undeliverable' | 'shipping_returned' | 'shipping_partially_returned' | 'shipping_partially_undeliverable';
108
+ export interface OrderItemPromotion {
109
+ id: string;
110
+ name: string;
111
+ version: string;
112
+ }
108
113
  export interface OrderItem<Product = Record<string, unknown>, Variant = Record<string, unknown>> {
109
114
  id?: string;
110
115
  /**
@@ -172,9 +177,10 @@ export interface OrderItem<Product = Record<string, unknown>, Variant = Record<s
172
177
  */
173
178
  relative: number;
174
179
  };
175
- category: 'sale' | 'campaign' | 'voucher';
180
+ category: 'sale' | 'campaign' | 'voucher' | 'promotion';
176
181
  code?: string;
177
182
  type: 'relative' | 'absolute';
183
+ id?: string;
178
184
  }[];
179
185
  overrideWithoutTax?: number;
180
186
  overrideWithTax?: number;
@@ -217,6 +223,10 @@ export interface OrderItem<Product = Record<string, unknown>, Variant = Record<s
217
223
  warehousePackageGroupId?: null | number;
218
224
  createdAt: string;
219
225
  updatedAt: string;
226
+ /**
227
+ * Promotions applied to the order item.
228
+ */
229
+ promotions?: OrderItemPromotion[];
220
230
  }
221
231
  export interface Order<Product = Record<string, unknown>, Variant = Record<string, unknown>> {
222
232
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-core",
3
- "version": "8.51.0",
3
+ "version": "8.53.0",
4
4
  "description": "Collection of essential utilities to work with the Storefront API",
5
5
  "author": "SCAYLE Commerce Engine",
6
6
  "license": "MIT",
@@ -53,9 +53,9 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/crypto-js": "4.2.2",
56
- "@types/node": "22.19.0",
56
+ "@types/node": "22.19.1",
57
57
  "@types/webpack-env": "1.18.8",
58
- "@vitest/coverage-v8": "3.2.4",
58
+ "@vitest/coverage-v8": "4.0.10",
59
59
  "dprint": "0.50.2",
60
60
  "eslint-formatter-gitlab": "6.0.1",
61
61
  "eslint": "9.39.1",
@@ -65,8 +65,8 @@
65
65
  "typescript": "5.9.3",
66
66
  "unbuild": "3.6.1",
67
67
  "unstorage": "1.17.2",
68
- "vitest": "3.2.4",
69
- "@scayle/eslint-config-storefront": "4.7.12",
68
+ "vitest": "4.0.10",
69
+ "@scayle/eslint-config-storefront": "4.7.13",
70
70
  "@scayle/vitest-config-storefront": "1.0.0"
71
71
  },
72
72
  "volta": {