@labdigital/commercetools-mock 2.31.0 → 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/dist/index.js CHANGED
@@ -2401,7 +2401,14 @@ var CartUpdateHandler = class extends AbstractUpdateHandler {
2401
2401
  resource.itemShippingAddresses.push(newAddress);
2402
2402
  }
2403
2403
  }
2404
- addLineItem(context, resource, { productId, variantId, sku, quantity = 1 }) {
2404
+ addLineItem(context, resource, {
2405
+ productId,
2406
+ variantId,
2407
+ sku,
2408
+ custom,
2409
+ quantity = 1,
2410
+ addedAt
2411
+ }) {
2405
2412
  let product = null;
2406
2413
  if (productId && variantId) {
2407
2414
  product = this._storage.get(context.projectKey, "product", productId, {});
@@ -2467,6 +2474,7 @@ var CartUpdateHandler = class extends AbstractUpdateHandler {
2467
2474
  }
2468
2475
  resource.lineItems.push({
2469
2476
  id: uuidv45(),
2477
+ addedAt: addedAt ? addedAt : (/* @__PURE__ */ new Date()).toISOString(),
2470
2478
  productId: product.id,
2471
2479
  productKey: product.key,
2472
2480
  productSlug: product.masterData.current.slug,
@@ -2485,7 +2493,8 @@ var CartUpdateHandler = class extends AbstractUpdateHandler {
2485
2493
  discountedPricePerQuantity: [],
2486
2494
  lineItemMode: "Standard",
2487
2495
  priceMode: "Platform",
2488
- state: []
2496
+ state: [],
2497
+ custom: createCustomFields(custom, context.projectKey, this._storage)
2489
2498
  });
2490
2499
  }
2491
2500
  resource.totalPrice.centAmount = calculateCartTotalPrice(resource);
@@ -6778,7 +6787,13 @@ var ShippingMethodRepository = class extends AbstractResourceRepository {
6778
6787
  // src/repositories/shopping-list/actions.ts
6779
6788
  import { v4 as uuidv411 } from "uuid";
6780
6789
  var ShoppingListUpdateHandler = class extends AbstractUpdateHandler {
6781
- addLineItem(context, resource, { productId, variantId, sku, quantity = 1 }) {
6790
+ addLineItem(context, resource, {
6791
+ productId,
6792
+ variantId,
6793
+ sku,
6794
+ quantity = 1,
6795
+ addedAt
6796
+ }) {
6782
6797
  let product = null;
6783
6798
  if (productId) {
6784
6799
  product = this._storage.get(context.projectKey, "product", productId, {});
@@ -6819,7 +6834,7 @@ var ShoppingListUpdateHandler = class extends AbstractUpdateHandler {
6819
6834
  });
6820
6835
  } else {
6821
6836
  resource.lineItems.push({
6822
- addedAt: (/* @__PURE__ */ new Date()).toISOString(),
6837
+ addedAt: addedAt ? addedAt : (/* @__PURE__ */ new Date()).toISOString(),
6823
6838
  id: uuidv411(),
6824
6839
  productId: product.id,
6825
6840
  productSlug: product.masterData.current.slug,