@labdigital/commercetools-mock 1.10.0 → 1.11.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
@@ -2189,6 +2189,16 @@ var CartRepository = class extends AbstractResourceRepository {
2189
2189
  }
2190
2190
  resource.totalPrice.centAmount = calculateCartTotalPrice(resource);
2191
2191
  },
2192
+ addItemShippingAddress: (context, resource, { action, address }) => {
2193
+ const newAddress = createAddress(
2194
+ address,
2195
+ context.projectKey,
2196
+ this._storage
2197
+ );
2198
+ if (newAddress) {
2199
+ resource.itemShippingAddresses.push(newAddress);
2200
+ }
2201
+ },
2192
2202
  changeLineItemQuantity: (context, resource, { lineItemId, lineItemKey, quantity }) => {
2193
2203
  let lineItem;
2194
2204
  if (lineItemId) {
@@ -2312,6 +2322,26 @@ var CartRepository = class extends AbstractResourceRepository {
2312
2322
  setLocale: (context, resource, { locale }) => {
2313
2323
  resource.locale = locale;
2314
2324
  },
2325
+ setLineItemShippingDetails: (context, resource, {
2326
+ action,
2327
+ shippingDetails,
2328
+ lineItemId,
2329
+ lineItemKey
2330
+ }) => {
2331
+ const lineItem = resource.lineItems.find(
2332
+ (x) => lineItemId && x.id === lineItemId || lineItemKey && x.key === lineItemKey
2333
+ );
2334
+ if (!lineItem) {
2335
+ throw new CommercetoolsError({
2336
+ code: "General",
2337
+ message: lineItemKey ? `A line item with key '${lineItemKey}' not found.` : `A line item with ID '${lineItemId}' not found.`
2338
+ });
2339
+ }
2340
+ lineItem.shippingDetails = {
2341
+ ...shippingDetails,
2342
+ valid: true
2343
+ };
2344
+ },
2315
2345
  setShippingAddress: (context, resource, { address }) => {
2316
2346
  if (!address) {
2317
2347
  resource.shippingAddress = void 0;
@@ -4679,6 +4709,7 @@ var ProductSelectionRepository = class extends AbstractResourceRepository {
4679
4709
  const resource = {
4680
4710
  ...getBaseResourceProperties(),
4681
4711
  productCount: 0,
4712
+ key: draft.key,
4682
4713
  name: draft.name,
4683
4714
  type: "individual",
4684
4715
  mode: "Individual"
@@ -4686,7 +4717,11 @@ var ProductSelectionRepository = class extends AbstractResourceRepository {
4686
4717
  this.saveNew(context, resource);
4687
4718
  return resource;
4688
4719
  }
4689
- actions = {};
4720
+ actions = {
4721
+ changeName: (context, resource, { name }) => {
4722
+ resource.name = name;
4723
+ }
4724
+ };
4690
4725
  };
4691
4726
 
4692
4727
  // src/repositories/product-type.ts
@@ -5686,6 +5721,18 @@ var AssociateRoleServices = class extends AbstractService {
5686
5721
  }
5687
5722
  };
5688
5723
 
5724
+ // src/services/attribute-group.ts
5725
+ var AttributeGroupService = class extends AbstractService {
5726
+ repository;
5727
+ constructor(parent, repository) {
5728
+ super(parent);
5729
+ this.repository = repository;
5730
+ }
5731
+ getBasePath() {
5732
+ return "attribute-groups";
5733
+ }
5734
+ };
5735
+
5689
5736
  // src/services/business-units.ts
5690
5737
  var BusinessUnitServices = class extends AbstractService {
5691
5738
  repository;
@@ -5698,6 +5745,18 @@ var BusinessUnitServices = class extends AbstractService {
5698
5745
  }
5699
5746
  };
5700
5747
 
5748
+ // src/services/cart-discount.ts
5749
+ var CartDiscountService = class extends AbstractService {
5750
+ repository;
5751
+ constructor(parent, repository) {
5752
+ super(parent);
5753
+ this.repository = repository;
5754
+ }
5755
+ getBasePath() {
5756
+ return "cart-discounts";
5757
+ }
5758
+ };
5759
+
5701
5760
  // src/services/cart.ts
5702
5761
  var CartService = class extends AbstractService {
5703
5762
  repository;
@@ -5736,18 +5795,6 @@ var CartService = class extends AbstractService {
5736
5795
  }
5737
5796
  };
5738
5797
 
5739
- // src/services/cart-discount.ts
5740
- var CartDiscountService = class extends AbstractService {
5741
- repository;
5742
- constructor(parent, repository) {
5743
- super(parent);
5744
- this.repository = repository;
5745
- }
5746
- getBasePath() {
5747
- return "cart-discounts";
5748
- }
5749
- };
5750
-
5751
5798
  // src/services/category.ts
5752
5799
  var CategoryServices = class extends AbstractService {
5753
5800
  repository;
@@ -5824,6 +5871,18 @@ var CustomObjectService = class extends AbstractService {
5824
5871
  }
5825
5872
  };
5826
5873
 
5874
+ // src/services/customer-group.ts
5875
+ var CustomerGroupService = class extends AbstractService {
5876
+ repository;
5877
+ constructor(parent, repository) {
5878
+ super(parent);
5879
+ this.repository = repository;
5880
+ }
5881
+ getBasePath() {
5882
+ return "customer-groups";
5883
+ }
5884
+ };
5885
+
5827
5886
  // src/services/customer.ts
5828
5887
  var import_uuid8 = require("uuid");
5829
5888
  var CustomerService = class extends AbstractService {
@@ -5855,18 +5914,6 @@ var CustomerService = class extends AbstractService {
5855
5914
  }
5856
5915
  };
5857
5916
 
5858
- // src/services/customer-group.ts
5859
- var CustomerGroupService = class extends AbstractService {
5860
- repository;
5861
- constructor(parent, repository) {
5862
- super(parent);
5863
- this.repository = repository;
5864
- }
5865
- getBasePath() {
5866
- return "customer-groups";
5867
- }
5868
- };
5869
-
5870
5917
  // src/services/discount-code.ts
5871
5918
  var DiscountCodeService = class extends AbstractService {
5872
5919
  repository;
@@ -6075,18 +6122,6 @@ var PaymentService = class extends AbstractService {
6075
6122
  }
6076
6123
  };
6077
6124
 
6078
- // src/services/product.ts
6079
- var ProductService = class extends AbstractService {
6080
- repository;
6081
- constructor(parent, repository) {
6082
- super(parent);
6083
- this.repository = repository;
6084
- }
6085
- getBasePath() {
6086
- return "products";
6087
- }
6088
- };
6089
-
6090
6125
  // src/services/product-discount.ts
6091
6126
  var ProductDiscountService = class extends AbstractService {
6092
6127
  repository;
@@ -6149,6 +6184,18 @@ var ProductProjectionService = class extends AbstractService {
6149
6184
  }
6150
6185
  };
6151
6186
 
6187
+ // src/services/product-selection.ts
6188
+ var ProductSelectionService = class extends AbstractService {
6189
+ repository;
6190
+ constructor(parent, repository) {
6191
+ super(parent);
6192
+ this.repository = repository;
6193
+ }
6194
+ getBasePath() {
6195
+ return "product-selections";
6196
+ }
6197
+ };
6198
+
6152
6199
  // src/services/product-type.ts
6153
6200
  var ProductTypeService = class extends AbstractService {
6154
6201
  repository;
@@ -6161,6 +6208,18 @@ var ProductTypeService = class extends AbstractService {
6161
6208
  }
6162
6209
  };
6163
6210
 
6211
+ // src/services/product.ts
6212
+ var ProductService = class extends AbstractService {
6213
+ repository;
6214
+ constructor(parent, repository) {
6215
+ super(parent);
6216
+ this.repository = repository;
6217
+ }
6218
+ getBasePath() {
6219
+ return "products";
6220
+ }
6221
+ };
6222
+
6164
6223
  // src/services/shipping-method.ts
6165
6224
  var ShippingMethodService = class extends AbstractService {
6166
6225
  repository;
@@ -6273,18 +6332,6 @@ var ZoneService = class extends AbstractService {
6273
6332
  }
6274
6333
  };
6275
6334
 
6276
- // src/services/attribute-group.ts
6277
- var AttributeGroupService = class extends AbstractService {
6278
- repository;
6279
- constructor(parent, repository) {
6280
- super(parent);
6281
- this.repository = repository;
6282
- }
6283
- getBasePath() {
6284
- return "attribute-groups";
6285
- }
6286
- };
6287
-
6288
6335
  // src/services/index.ts
6289
6336
  var createServices = (router, repos) => ({
6290
6337
  "associate-role": new AssociateRoleServices(router, repos["associate-role"]),
@@ -6329,6 +6376,10 @@ var createServices = (router, repos) => ({
6329
6376
  router,
6330
6377
  repos["product-projection"]
6331
6378
  ),
6379
+ "product-selection": new ProductSelectionService(
6380
+ router,
6381
+ repos["product-selection"]
6382
+ ),
6332
6383
  "shopping-list": new ShoppingListService(router, repos["shopping-list"]),
6333
6384
  state: new StateService(router, repos["state"]),
6334
6385
  store: new StoreService(router, repos["store"]),