@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.cjs CHANGED
@@ -2438,7 +2438,14 @@ var CartUpdateHandler = class extends AbstractUpdateHandler {
2438
2438
  resource.itemShippingAddresses.push(newAddress);
2439
2439
  }
2440
2440
  }
2441
- addLineItem(context, resource, { productId, variantId, sku, quantity = 1 }) {
2441
+ addLineItem(context, resource, {
2442
+ productId,
2443
+ variantId,
2444
+ sku,
2445
+ custom,
2446
+ quantity = 1,
2447
+ addedAt
2448
+ }) {
2442
2449
  let product = null;
2443
2450
  if (productId && variantId) {
2444
2451
  product = this._storage.get(context.projectKey, "product", productId, {});
@@ -2504,6 +2511,7 @@ var CartUpdateHandler = class extends AbstractUpdateHandler {
2504
2511
  }
2505
2512
  resource.lineItems.push({
2506
2513
  id: (0, import_uuid5.v4)(),
2514
+ addedAt: addedAt ? addedAt : (/* @__PURE__ */ new Date()).toISOString(),
2507
2515
  productId: product.id,
2508
2516
  productKey: product.key,
2509
2517
  productSlug: product.masterData.current.slug,
@@ -2522,7 +2530,8 @@ var CartUpdateHandler = class extends AbstractUpdateHandler {
2522
2530
  discountedPricePerQuantity: [],
2523
2531
  lineItemMode: "Standard",
2524
2532
  priceMode: "Platform",
2525
- state: []
2533
+ state: [],
2534
+ custom: createCustomFields(custom, context.projectKey, this._storage)
2526
2535
  });
2527
2536
  }
2528
2537
  resource.totalPrice.centAmount = calculateCartTotalPrice(resource);
@@ -6815,7 +6824,13 @@ var ShippingMethodRepository = class extends AbstractResourceRepository {
6815
6824
  // src/repositories/shopping-list/actions.ts
6816
6825
  var import_uuid11 = require("uuid");
6817
6826
  var ShoppingListUpdateHandler = class extends AbstractUpdateHandler {
6818
- addLineItem(context, resource, { productId, variantId, sku, quantity = 1 }) {
6827
+ addLineItem(context, resource, {
6828
+ productId,
6829
+ variantId,
6830
+ sku,
6831
+ quantity = 1,
6832
+ addedAt
6833
+ }) {
6819
6834
  let product = null;
6820
6835
  if (productId) {
6821
6836
  product = this._storage.get(context.projectKey, "product", productId, {});
@@ -6856,7 +6871,7 @@ var ShoppingListUpdateHandler = class extends AbstractUpdateHandler {
6856
6871
  });
6857
6872
  } else {
6858
6873
  resource.lineItems.push({
6859
- addedAt: (/* @__PURE__ */ new Date()).toISOString(),
6874
+ addedAt: addedAt ? addedAt : (/* @__PURE__ */ new Date()).toISOString(),
6860
6875
  id: (0, import_uuid11.v4)(),
6861
6876
  productId: product.id,
6862
6877
  productSlug: product.masterData.current.slug,