@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.cjs CHANGED
@@ -1925,8 +1925,6 @@ var createCustomFields = (draft, projectKey, storage) => {
1925
1925
  return void 0;
1926
1926
  if (!draft.type.typeId)
1927
1927
  return void 0;
1928
- if (!draft.fields)
1929
- return void 0;
1930
1928
  const typeResource = storage.getByResourceIdentifier(
1931
1929
  projectKey,
1932
1930
  draft.type
@@ -1941,7 +1939,7 @@ var createCustomFields = (draft, projectKey, storage) => {
1941
1939
  typeId: draft.type.typeId,
1942
1940
  id: typeResource.id
1943
1941
  },
1944
- fields: draft.fields
1942
+ fields: draft.fields ?? {}
1945
1943
  };
1946
1944
  };
1947
1945
  var createPrice = (draft) => ({
@@ -2517,6 +2515,9 @@ var CartUpdateHandler = class extends AbstractUpdateHandler {
2517
2515
  }
2518
2516
  resource.totalPrice.centAmount = calculateCartTotalPrice(resource);
2519
2517
  }
2518
+ changeTaxRoundingMode(_context, resource, { taxRoundingMode }) {
2519
+ resource.taxRoundingMode = taxRoundingMode;
2520
+ }
2520
2521
  recalculate() {
2521
2522
  }
2522
2523
  removeDiscountCode(context, resource, { discountCode }) {
@@ -2547,6 +2548,10 @@ var CartUpdateHandler = class extends AbstractUpdateHandler {
2547
2548
  }
2548
2549
  resource.totalPrice.centAmount = calculateCartTotalPrice(resource);
2549
2550
  }
2551
+ setAnonymousId(_context, resource, { anonymousId }) {
2552
+ resource.anonymousId = anonymousId;
2553
+ resource.customerId = void 0;
2554
+ }
2550
2555
  setBillingAddress(context, resource, { address }) {
2551
2556
  resource.billingAddress = createAddress(
2552
2557
  address,
@@ -2560,6 +2565,10 @@ var CartUpdateHandler = class extends AbstractUpdateHandler {
2560
2565
  setCustomerEmail(context, resource, { email }) {
2561
2566
  resource.customerEmail = email;
2562
2567
  }
2568
+ setCustomerId(_context, resource, { customerId }) {
2569
+ resource.anonymousId = void 0;
2570
+ resource.customerId = customerId;
2571
+ }
2563
2572
  setCustomField(context, resource, { name, value }) {
2564
2573
  if (!resource.custom) {
2565
2574
  throw new Error("Resource has no custom field");
@@ -4010,6 +4019,7 @@ var OrderRepository = class extends AbstractResourceRepository {
4010
4019
  key: context.storeKey,
4011
4020
  typeId: "store"
4012
4021
  } : void 0,
4022
+ custom: cart.custom,
4013
4023
  lastMessageSequenceNumber: 0
4014
4024
  };
4015
4025
  return this.saveNew(context, resource);