@labdigital/commercetools-mock 2.27.0 → 2.28.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.cjs CHANGED
@@ -1540,6 +1540,7 @@ var InMemoryStorage = class extends AbstractStorage {
1540
1540
  "product-selection": /* @__PURE__ */ new Map(),
1541
1541
  "product-type": /* @__PURE__ */ new Map(),
1542
1542
  "product-projection": /* @__PURE__ */ new Map(),
1543
+ "product-tailoring": /* @__PURE__ */ new Map(),
1543
1544
  "review": /* @__PURE__ */ new Map(),
1544
1545
  "shipping-method": /* @__PURE__ */ new Map(),
1545
1546
  "staged-quote": /* @__PURE__ */ new Map(),
@@ -1924,6 +1925,22 @@ var AbstractUpdateHandler = class {
1924
1925
  }
1925
1926
  };
1926
1927
 
1928
+ // src/repositories/product-tailoring.ts
1929
+ var ProductTailoringRepository = class extends AbstractResourceRepository {
1930
+ constructor(storage) {
1931
+ super("product-tailoring", storage);
1932
+ this.actions = new ProductTailoringUpdateHandler(this._storage);
1933
+ }
1934
+ create(context, draft) {
1935
+ throw new Error("Create method for product-tailoring not implemented.");
1936
+ }
1937
+ };
1938
+ var ProductTailoringUpdateHandler = class extends AbstractUpdateHandler {
1939
+ setSlug() {
1940
+ throw new Error("SetSlug method for product-tailoring not implemented.");
1941
+ }
1942
+ };
1943
+
1927
1944
  // src/repositories/helpers.ts
1928
1945
  var import_uuid4 = require("uuid");
1929
1946
  var createAddress = (base, projectKey, storage) => {
@@ -2247,6 +2264,18 @@ var BusinessUnitRepository = class extends AbstractResourceRepository {
2247
2264
  this.actions = new BusinessUnitUpdateHandler(this._storage);
2248
2265
  }
2249
2266
  create(context, draft) {
2267
+ const addresses = draft.addresses?.map((address) => ({
2268
+ ...address,
2269
+ id: generateRandomString(5)
2270
+ })) ?? [];
2271
+ const defaultBillingAddressId = addresses.length > 0 && draft.defaultBillingAddress !== void 0 ? addresses[draft.defaultBillingAddress].id : void 0;
2272
+ const defaultShippingAddressId = addresses.length > 0 && draft.defaultShippingAddress !== void 0 ? addresses[draft.defaultShippingAddress].id : void 0;
2273
+ const shippingAddressIds = draft.shippingAddresses?.map(
2274
+ (i) => addresses[i].id
2275
+ );
2276
+ const billingAddressIds = draft.billingAddresses?.map(
2277
+ (i) => addresses[i].id
2278
+ );
2250
2279
  const resource = {
2251
2280
  ...getBaseResourceProperties(),
2252
2281
  key: draft.key,
@@ -2257,18 +2286,18 @@ var BusinessUnitRepository = class extends AbstractResourceRepository {
2257
2286
  storeMode: draft.storeMode,
2258
2287
  name: draft.name,
2259
2288
  contactEmail: draft.contactEmail,
2260
- addresses: draft.addresses?.map(
2261
- (a) => createAddress(a, context.projectKey, this._storage)
2262
- ),
2289
+ addresses,
2263
2290
  custom: createCustomFields(
2264
2291
  draft.custom,
2265
2292
  context.projectKey,
2266
2293
  this._storage
2267
2294
  ),
2268
- shippingAddressIds: draft.shippingAddresses,
2269
- defaultShippingAddressId: draft.defaultShippingAddress,
2270
- billingAddressIds: draft.billingAddresses,
2295
+ shippingAddressIds,
2296
+ billingAddressIds,
2297
+ defaultShippingAddressId,
2298
+ defaultBillingAddressId,
2271
2299
  associateMode: draft.associateMode,
2300
+ approvalRuleMode: draft.approvalRuleMode,
2272
2301
  associates: draft.associates?.map(
2273
2302
  (a) => createAssociate(a, context.projectKey, this._storage)
2274
2303
  )
@@ -2342,6 +2371,9 @@ var BusinessUnitUpdateHandler = class extends AbstractUpdateHandler {
2342
2371
  resource.addresses.push(newAddress);
2343
2372
  }
2344
2373
  }
2374
+ changeApprovalRuleMode(context, resource, { approvalRuleMode }) {
2375
+ resource.approvalRuleMode = approvalRuleMode;
2376
+ }
2345
2377
  changeAssociateMode(context, resource, { associateMode }) {
2346
2378
  resource.associateMode = associateMode;
2347
2379
  }
@@ -2641,10 +2673,12 @@ var CartUpdateHandler = class extends AbstractUpdateHandler {
2641
2673
  }
2642
2674
  }
2643
2675
  setDirectDiscounts(context, resource, { discounts }) {
2644
- resource.directDiscounts = discounts.map((discount) => ({
2645
- ...discount,
2646
- id: (0, import_uuid5.v4)()
2647
- }));
2676
+ resource.directDiscounts = discounts.map(
2677
+ (discount) => ({
2678
+ ...discount,
2679
+ id: (0, import_uuid5.v4)()
2680
+ })
2681
+ );
2648
2682
  }
2649
2683
  setLineItemShippingDetails(context, resource, {
2650
2684
  action,
@@ -3454,7 +3488,8 @@ var CustomerRepository = class extends AbstractResourceRepository {
3454
3488
  draft.custom,
3455
3489
  context.projectKey,
3456
3490
  this._storage
3457
- )
3491
+ ),
3492
+ stores: []
3458
3493
  };
3459
3494
  return this.saveNew(context, resource);
3460
3495
  }
@@ -6249,6 +6284,9 @@ var ShippingMethodUpdateHandler = class extends AbstractUpdateHandler {
6249
6284
  shippingRates: []
6250
6285
  });
6251
6286
  }
6287
+ changeActive(_context, resource, { active }) {
6288
+ resource.active = active;
6289
+ }
6252
6290
  changeIsDefault(_context, resource, { isDefault }) {
6253
6291
  resource.isDefault = isDefault;
6254
6292
  }
@@ -6318,6 +6356,7 @@ var ShippingMethodRepository = class extends AbstractResourceRepository {
6318
6356
  const resource = {
6319
6357
  ...getBaseResourceProperties(),
6320
6358
  ...draft,
6359
+ active: draft.active ?? true,
6321
6360
  taxCategory: getReferenceFromResourceIdentifier(
6322
6361
  draft.taxCategory,
6323
6362
  context.projectKey,
@@ -7134,6 +7173,7 @@ var createRepositories = (storage) => ({
7134
7173
  "product-discount": new ProductDiscountRepository(storage),
7135
7174
  "product-projection": new ProductProjectionRepository(storage),
7136
7175
  "product-selection": new ProductSelectionRepository(storage),
7176
+ "product-tailoring": new ProductTailoringRepository(storage),
7137
7177
  "project": new ProjectRepository(storage),
7138
7178
  "review": new ReviewRepository(storage),
7139
7179
  "quote": new QuoteRepository(storage),