@labdigital/commercetools-mock 2.21.2 → 2.22.0

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) => ({
@@ -2510,6 +2508,10 @@ var CartUpdateHandler = class extends AbstractUpdateHandler {
2510
2508
  }
2511
2509
  resource.totalPrice.centAmount = calculateCartTotalPrice(resource);
2512
2510
  }
2511
+ setAnonymousId(_context, resource, { anonymousId }) {
2512
+ resource.anonymousId = anonymousId;
2513
+ resource.customerId = void 0;
2514
+ }
2513
2515
  setBillingAddress(context, resource, { address }) {
2514
2516
  resource.billingAddress = createAddress(
2515
2517
  address,
@@ -2523,6 +2525,10 @@ var CartUpdateHandler = class extends AbstractUpdateHandler {
2523
2525
  setCustomerEmail(context, resource, { email }) {
2524
2526
  resource.customerEmail = email;
2525
2527
  }
2528
+ setCustomerId(_context, resource, { customerId }) {
2529
+ resource.anonymousId = void 0;
2530
+ resource.customerId = customerId;
2531
+ }
2526
2532
  setCustomField(context, resource, { name, value }) {
2527
2533
  if (!resource.custom) {
2528
2534
  throw new Error("Resource has no custom field");
@@ -3973,6 +3979,7 @@ var OrderRepository = class extends AbstractResourceRepository {
3973
3979
  key: context.storeKey,
3974
3980
  typeId: "store"
3975
3981
  } : void 0,
3982
+ custom: cart.custom,
3976
3983
  lastMessageSequenceNumber: 0
3977
3984
  };
3978
3985
  return this.saveNew(context, resource);