@labdigital/commercetools-mock 2.21.2 → 2.22.1

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
@@ -1888,8 +1888,6 @@ var createCustomFields = (draft, projectKey, storage) => {
1888
1888
  return void 0;
1889
1889
  if (!draft.type.typeId)
1890
1890
  return void 0;
1891
- if (!draft.fields)
1892
- return void 0;
1893
1891
  const typeResource = storage.getByResourceIdentifier(
1894
1892
  projectKey,
1895
1893
  draft.type
@@ -1904,7 +1902,7 @@ var createCustomFields = (draft, projectKey, storage) => {
1904
1902
  typeId: draft.type.typeId,
1905
1903
  id: typeResource.id
1906
1904
  },
1907
- fields: draft.fields
1905
+ fields: draft.fields ?? {}
1908
1906
  };
1909
1907
  };
1910
1908
  var createPrice = (draft) => ({
@@ -2480,6 +2478,9 @@ var CartUpdateHandler = class extends AbstractUpdateHandler {
2480
2478
  }
2481
2479
  resource.totalPrice.centAmount = calculateCartTotalPrice(resource);
2482
2480
  }
2481
+ changeTaxRoundingMode(_context, resource, { taxRoundingMode }) {
2482
+ resource.taxRoundingMode = taxRoundingMode;
2483
+ }
2483
2484
  recalculate() {
2484
2485
  }
2485
2486
  removeDiscountCode(context, resource, { discountCode }) {
@@ -2510,6 +2511,10 @@ var CartUpdateHandler = class extends AbstractUpdateHandler {
2510
2511
  }
2511
2512
  resource.totalPrice.centAmount = calculateCartTotalPrice(resource);
2512
2513
  }
2514
+ setAnonymousId(_context, resource, { anonymousId }) {
2515
+ resource.anonymousId = anonymousId;
2516
+ resource.customerId = void 0;
2517
+ }
2513
2518
  setBillingAddress(context, resource, { address }) {
2514
2519
  resource.billingAddress = createAddress(
2515
2520
  address,
@@ -2523,6 +2528,10 @@ var CartUpdateHandler = class extends AbstractUpdateHandler {
2523
2528
  setCustomerEmail(context, resource, { email }) {
2524
2529
  resource.customerEmail = email;
2525
2530
  }
2531
+ setCustomerId(_context, resource, { customerId }) {
2532
+ resource.anonymousId = void 0;
2533
+ resource.customerId = customerId;
2534
+ }
2526
2535
  setCustomField(context, resource, { name, value }) {
2527
2536
  if (!resource.custom) {
2528
2537
  throw new Error("Resource has no custom field");
@@ -3973,6 +3982,7 @@ var OrderRepository = class extends AbstractResourceRepository {
3973
3982
  key: context.storeKey,
3974
3983
  typeId: "store"
3975
3984
  } : void 0,
3985
+ custom: cart.custom,
3976
3986
  lastMessageSequenceNumber: 0
3977
3987
  };
3978
3988
  return this.saveNew(context, resource);