@labdigital/commercetools-mock 2.31.1 → 2.31.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labdigital/commercetools-mock",
3
- "version": "2.31.1",
3
+ "version": "2.31.2",
4
4
  "license": "MIT",
5
5
  "author": "Michael van Tellingen",
6
6
  "type": "module",
@@ -73,7 +73,14 @@ export class CartUpdateHandler
73
73
  addLineItem(
74
74
  context: RepositoryContext,
75
75
  resource: Writable<Cart>,
76
- { productId, variantId, sku, custom, quantity = 1 }: CartAddLineItemAction,
76
+ {
77
+ productId,
78
+ variantId,
79
+ sku,
80
+ custom,
81
+ quantity = 1,
82
+ addedAt,
83
+ }: CartAddLineItemAction,
77
84
  ) {
78
85
  let product: Product | null = null;
79
86
 
@@ -157,6 +164,7 @@ export class CartUpdateHandler
157
164
  }
158
165
  resource.lineItems.push({
159
166
  id: uuidv4(),
167
+ addedAt: addedAt ? addedAt : new Date().toISOString(),
160
168
  productId: product.id,
161
169
  productKey: product.key,
162
170
  productSlug: product.masterData.current.slug,
@@ -36,7 +36,13 @@ export class ShoppingListUpdateHandler
36
36
  addLineItem(
37
37
  context: RepositoryContext,
38
38
  resource: Writable<ShoppingList>,
39
- { productId, variantId, sku, quantity = 1 }: ShoppingListAddLineItemAction,
39
+ {
40
+ productId,
41
+ variantId,
42
+ sku,
43
+ quantity = 1,
44
+ addedAt,
45
+ }: ShoppingListAddLineItemAction,
40
46
  ) {
41
47
  let product: Product | null = null;
42
48
 
@@ -90,7 +96,7 @@ export class ShoppingListUpdateHandler
90
96
  } else {
91
97
  // add line item
92
98
  resource.lineItems.push({
93
- addedAt: new Date().toISOString(),
99
+ addedAt: addedAt ? addedAt : new Date().toISOString(),
94
100
  id: uuidv4(),
95
101
  productId: product.id,
96
102
  productSlug: product.masterData.current.slug,