@labdigital/commercetools-mock 1.9.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.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import express from 'express';
2
2
  import * as ctp from '@commercetools/platform-sdk';
3
- import { Project, ResourceIdentifier, QueryParam, AssociateRoleDraft, AssociateRole, AssociateRoleSetNameAction, AssociateRoleSetPermissionsAction, AssociateRoleChangeBuyerAssignableAction, AssociateRoleSetCustomFieldAction, AssociateRoleAddPermissionAction, AssociateRoleRemovePermissionAction, AttributeGroupDraft, AttributeGroup, AttributeGroupSetAttributesAction, AttributeGroupChangeNameAction, AttributeGroupSetDescriptionAction, AttributeGroupSetKeyAction, BusinessUnitDraft, BusinessUnit, BusinessUnitAddAddressAction, BusinessUnitAddAssociateAction, BusinessUnitSetAssociatesAction, BusinessUnitSetContactEmailAction, BusinessUnitSetStoreModeAction, BusinessUnitChangeNameAction, BusinessUnitChangeAddressAction, BusinessUnitAddStoreAction, BusinessUnitChangeParentUnitAction, BusinessUnitChangeStatusAction, CartDraft, Cart, CartAddLineItemAction, CartChangeLineItemQuantityAction, CartRemoveLineItemAction, CartSetBillingAddressAction, CartSetShippingMethodAction, CartSetCountryAction, CartSetCustomerEmailAction, CartSetCustomFieldAction, CartSetCustomTypeAction, CartSetLocaleAction, CartSetShippingAddressAction, LineItemDraft, LineItem, CartDiscountDraft, CartDiscount, CartDiscountUpdateAction, AssetDraft, Asset, CategoryDraft, Category, CategoryChangeAssetNameAction, CategoryChangeSlugAction, CategorySetKeyAction, CategorySetAssetDescriptionAction, CategorySetAssetSourcesAction, CategorySetDescriptionAction, CategorySetMetaDescriptionAction, CategorySetMetaKeywordsAction, CategorySetMetaTitleAction, CategorySetCustomTypeAction, CategorySetCustomFieldAction, CategoryRemoveAssetAction, CategoryAddAssetAction, ChannelDraft, Channel, ChannelUpdateAction, CustomObjectDraft, CustomObject, CustomerDraft, Customer, CustomerChangeEmailAction, CustomerSetAuthenticationModeAction, CustomerSetCustomFieldAction, CustomerGroupDraft, CustomerGroup, CustomerGroupSetKeyAction, CustomerGroupChangeNameAction, CustomerGroupSetCustomTypeAction, CustomerGroupSetCustomFieldAction, DiscountCodeDraft, DiscountCode, DiscountCodeUpdateAction, Extension, ExtensionDraft, ExtensionUpdateAction, InventoryEntryDraft, InventoryEntry, InventoryEntryChangeQuantityAction, InventoryEntrySetExpectedDeliveryAction, InventoryEntrySetCustomFieldAction, InventoryEntrySetCustomTypeAction, InventoryEntrySetRestockableInDaysAction, OrderFromCartDraft, Order, CartReference, OrderImportDraft, OrderAddPaymentAction, OrderChangeOrderStateAction, OrderChangePaymentStateAction, OrderTransitionStateAction, OrderSetBillingAddressAction, OrderSetCustomerEmailAction, OrderSetCustomFieldAction, OrderSetCustomTypeAction, OrderSetLocaleAction, OrderSetOrderNumberAction, OrderSetShippingAddressAction, OrderSetStoreAction, MyOrderFromCartDraft, OrderEditDraft, OrderEdit, OrderEditUpdateAction, PaymentDraft, Payment, TransactionDraft, Transaction, PaymentSetCustomFieldAction, PaymentSetCustomTypeAction, PaymentAddTransactionAction, PaymentChangeTransactionStateAction, PaymentTransitionStateAction, ProductDraft, Product, ProductUpdateAction, ProductDiscountDraft, ProductDiscount, ProductDiscountUpdateAction, ProductProjectionPagedSearchResponse, ProductProjection, FacetResults, TermFacetResult, FilteredFacetResult, RangeFacetResult, ProductSelectionDraft, ProductSelection, ReviewUpdateAction, Review, ProductTypeDraft, ProductType, AttributeDefinitionDraft, AttributeDefinition, ProductTypeUpdateAction, ProjectUpdateAction, QuoteDraft, Quote, QuoteUpdateAction, QuoteRequestDraft, QuoteRequest, QuoteRequestUpdateAction, ReviewDraft, ShippingMethodDraft, ShippingMethod, ShippingMethodUpdateAction, ShoppingListDraft, ShoppingList, StagedQuoteDraft, StagedQuote, StagedQuoteUpdateAction, StandalonePriceDraft, StandalonePrice, ChannelResourceIdentifier, ChannelReference, DiscountedPriceDraft, StandalonePriceChangeActiveAction, StandalonePriceChangeValueAction, StandalonePriceSetDiscountedPriceAction, StateDraft, State, StateUpdateAction, StoreDraft, Store, StoreUpdateAction, SubscriptionDraft, Subscription, TaxCategoryDraft, TaxCategory, TaxCategoryUpdateAction, TypeDraft, Type, TypeUpdateAction, ZoneDraft, Zone, ZoneUpdateAction, BaseResource, UpdateAction } from '@commercetools/platform-sdk';
3
+ import { Project, ResourceIdentifier, QueryParam, AssociateRoleDraft, AssociateRole, AssociateRoleSetNameAction, AssociateRoleSetPermissionsAction, AssociateRoleChangeBuyerAssignableAction, AssociateRoleSetCustomFieldAction, AssociateRoleAddPermissionAction, AssociateRoleRemovePermissionAction, AttributeGroupDraft, AttributeGroup, AttributeGroupSetAttributesAction, AttributeGroupChangeNameAction, AttributeGroupSetDescriptionAction, AttributeGroupSetKeyAction, BusinessUnitDraft, BusinessUnit, BusinessUnitAddAddressAction, BusinessUnitAddAssociateAction, BusinessUnitSetAssociatesAction, BusinessUnitSetContactEmailAction, BusinessUnitSetStoreModeAction, BusinessUnitChangeNameAction, BusinessUnitChangeAddressAction, BusinessUnitAddStoreAction, BusinessUnitChangeParentUnitAction, BusinessUnitChangeStatusAction, CartDraft, Cart, CartAddLineItemAction, CartAddItemShippingAddressAction, CartChangeLineItemQuantityAction, CartRemoveLineItemAction, CartSetBillingAddressAction, CartSetShippingMethodAction, CartSetCountryAction, CartSetCustomerEmailAction, CartSetCustomFieldAction, CartSetCustomTypeAction, CartSetLocaleAction, CartSetLineItemShippingDetailsAction, CartSetShippingAddressAction, CartRemoveDiscountCodeAction, LineItemDraft, LineItem, CartDiscountDraft, CartDiscount, CartDiscountUpdateAction, AssetDraft, Asset, CategoryDraft, Category, CategoryChangeAssetNameAction, CategoryChangeSlugAction, CategorySetKeyAction, CategorySetAssetDescriptionAction, CategorySetAssetSourcesAction, CategorySetDescriptionAction, CategorySetMetaDescriptionAction, CategorySetMetaKeywordsAction, CategorySetMetaTitleAction, CategorySetCustomTypeAction, CategorySetCustomFieldAction, CategoryRemoveAssetAction, CategoryAddAssetAction, ChannelDraft, Channel, ChannelUpdateAction, CustomObjectDraft, CustomObject, CustomerDraft, Customer, CustomerChangeEmailAction, CustomerSetAuthenticationModeAction, CustomerSetCustomFieldAction, CustomerGroupDraft, CustomerGroup, CustomerGroupSetKeyAction, CustomerGroupChangeNameAction, CustomerGroupSetCustomTypeAction, CustomerGroupSetCustomFieldAction, DiscountCodeDraft, DiscountCode, DiscountCodeUpdateAction, Extension, ExtensionDraft, ExtensionUpdateAction, InventoryEntryDraft, InventoryEntry, InventoryEntryChangeQuantityAction, InventoryEntrySetExpectedDeliveryAction, InventoryEntrySetCustomFieldAction, InventoryEntrySetCustomTypeAction, InventoryEntrySetRestockableInDaysAction, OrderFromCartDraft, Order, CartReference, OrderImportDraft, OrderAddPaymentAction, OrderChangeOrderStateAction, OrderChangePaymentStateAction, OrderTransitionStateAction, OrderSetBillingAddressAction, OrderSetCustomerEmailAction, OrderSetCustomFieldAction, OrderSetCustomTypeAction, OrderSetLocaleAction, OrderSetOrderNumberAction, OrderSetShippingAddressAction, OrderSetStoreAction, MyOrderFromCartDraft, OrderEditDraft, OrderEdit, OrderEditUpdateAction, PaymentDraft, Payment, TransactionDraft, Transaction, PaymentSetCustomFieldAction, PaymentSetCustomTypeAction, PaymentAddTransactionAction, PaymentChangeTransactionStateAction, PaymentTransitionStateAction, ProductDraft, Product, ProductUpdateAction, ProductDiscountDraft, ProductDiscount, ProductDiscountUpdateAction, ProductProjectionPagedSearchResponse, ProductProjection, FacetResults, TermFacetResult, FilteredFacetResult, RangeFacetResult, ProductSelectionDraft, ProductSelection, ProductSelectionUpdateAction, ProductTypeDraft, ProductType, AttributeDefinitionDraft, AttributeDefinition, ProductTypeUpdateAction, ProjectUpdateAction, QuoteDraft, Quote, QuoteUpdateAction, QuoteRequestDraft, QuoteRequest, QuoteRequestUpdateAction, ReviewDraft, Review, ReviewUpdateAction, ShippingMethodDraft, ShippingMethod, ShippingMethodUpdateAction, ShoppingListDraft, ShoppingList, StagedQuoteDraft, StagedQuote, StagedQuoteUpdateAction, StandalonePriceDraft, StandalonePrice, ChannelResourceIdentifier, ChannelReference, DiscountedPriceDraft, StandalonePriceChangeActiveAction, StandalonePriceChangeValueAction, StandalonePriceSetDiscountedPriceAction, StateDraft, State, StateUpdateAction, StoreDraft, Store, StoreUpdateAction, SubscriptionDraft, Subscription, TaxCategoryDraft, TaxCategory, TaxCategoryUpdateAction, TypeDraft, Type, TypeUpdateAction, ZoneDraft, Zone, ZoneUpdateAction, BaseResource, UpdateAction } from '@commercetools/platform-sdk';
4
4
 
5
5
  type GetParams$1 = {
6
6
  expand?: string[];
@@ -80,6 +80,7 @@ declare class CartRepository extends AbstractResourceRepository<'cart'> {
80
80
  getActiveCart(projectKey: string): Cart | undefined;
81
81
  actions: {
82
82
  addLineItem: (context: RepositoryContext, resource: Writable<Cart>, { productId, variantId, sku, quantity }: CartAddLineItemAction) => void;
83
+ addItemShippingAddress: (context: RepositoryContext, resource: Writable<Cart>, { action, address }: CartAddItemShippingAddressAction) => void;
83
84
  changeLineItemQuantity: (context: RepositoryContext, resource: Writable<Cart>, { lineItemId, lineItemKey, quantity }: CartChangeLineItemQuantityAction) => void;
84
85
  removeLineItem: (context: RepositoryContext, resource: Writable<Cart>, { lineItemId, quantity }: CartRemoveLineItemAction) => void;
85
86
  setBillingAddress: (context: RepositoryContext, resource: Writable<Cart>, { address }: CartSetBillingAddressAction) => void;
@@ -89,7 +90,9 @@ declare class CartRepository extends AbstractResourceRepository<'cart'> {
89
90
  setCustomField: (context: RepositoryContext, resource: Cart, { name, value }: CartSetCustomFieldAction) => void;
90
91
  setCustomType: (context: RepositoryContext, resource: Writable<Cart>, { type, fields }: CartSetCustomTypeAction) => void;
91
92
  setLocale: (context: RepositoryContext, resource: Writable<Cart>, { locale }: CartSetLocaleAction) => void;
93
+ setLineItemShippingDetails: (context: RepositoryContext, resource: Writable<Cart>, { action, shippingDetails, lineItemId, lineItemKey, }: CartSetLineItemShippingDetailsAction) => void;
92
94
  setShippingAddress: (context: RepositoryContext, resource: Writable<Cart>, { address }: CartSetShippingAddressAction) => void;
95
+ removeDiscountCode: (context: RepositoryContext, resource: Writable<Cart>, { discountCode }: CartRemoveDiscountCodeAction) => void;
93
96
  };
94
97
  draftLineItemtoLineItem: (projectKey: string, draftLineItem: LineItemDraft, currency: string, country: string | undefined) => LineItem;
95
98
  }
@@ -330,7 +333,7 @@ declare class ProductProjectionRepository extends AbstractResourceRepository<'pr
330
333
  declare class ProductSelectionRepository extends AbstractResourceRepository<'product-selection'> {
331
334
  getTypeId(): "product-selection";
332
335
  create(context: RepositoryContext, draft: ProductSelectionDraft): ProductSelection;
333
- actions: Partial<Record<ReviewUpdateAction['action'], (context: RepositoryContext, resource: Writable<Review>, action: any) => void>>;
336
+ actions: Partial<Record<ProductSelectionUpdateAction['action'], (context: RepositoryContext, resource: Writable<ProductSelection>, action: any) => void>>;
334
337
  }
335
338
 
336
339
  declare class ProductTypeRepository extends AbstractResourceRepository<'product-type'> {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import express from 'express';
2
2
  import * as ctp from '@commercetools/platform-sdk';
3
- import { Project, ResourceIdentifier, QueryParam, AssociateRoleDraft, AssociateRole, AssociateRoleSetNameAction, AssociateRoleSetPermissionsAction, AssociateRoleChangeBuyerAssignableAction, AssociateRoleSetCustomFieldAction, AssociateRoleAddPermissionAction, AssociateRoleRemovePermissionAction, AttributeGroupDraft, AttributeGroup, AttributeGroupSetAttributesAction, AttributeGroupChangeNameAction, AttributeGroupSetDescriptionAction, AttributeGroupSetKeyAction, BusinessUnitDraft, BusinessUnit, BusinessUnitAddAddressAction, BusinessUnitAddAssociateAction, BusinessUnitSetAssociatesAction, BusinessUnitSetContactEmailAction, BusinessUnitSetStoreModeAction, BusinessUnitChangeNameAction, BusinessUnitChangeAddressAction, BusinessUnitAddStoreAction, BusinessUnitChangeParentUnitAction, BusinessUnitChangeStatusAction, CartDraft, Cart, CartAddLineItemAction, CartChangeLineItemQuantityAction, CartRemoveLineItemAction, CartSetBillingAddressAction, CartSetShippingMethodAction, CartSetCountryAction, CartSetCustomerEmailAction, CartSetCustomFieldAction, CartSetCustomTypeAction, CartSetLocaleAction, CartSetShippingAddressAction, LineItemDraft, LineItem, CartDiscountDraft, CartDiscount, CartDiscountUpdateAction, AssetDraft, Asset, CategoryDraft, Category, CategoryChangeAssetNameAction, CategoryChangeSlugAction, CategorySetKeyAction, CategorySetAssetDescriptionAction, CategorySetAssetSourcesAction, CategorySetDescriptionAction, CategorySetMetaDescriptionAction, CategorySetMetaKeywordsAction, CategorySetMetaTitleAction, CategorySetCustomTypeAction, CategorySetCustomFieldAction, CategoryRemoveAssetAction, CategoryAddAssetAction, ChannelDraft, Channel, ChannelUpdateAction, CustomObjectDraft, CustomObject, CustomerDraft, Customer, CustomerChangeEmailAction, CustomerSetAuthenticationModeAction, CustomerSetCustomFieldAction, CustomerGroupDraft, CustomerGroup, CustomerGroupSetKeyAction, CustomerGroupChangeNameAction, CustomerGroupSetCustomTypeAction, CustomerGroupSetCustomFieldAction, DiscountCodeDraft, DiscountCode, DiscountCodeUpdateAction, Extension, ExtensionDraft, ExtensionUpdateAction, InventoryEntryDraft, InventoryEntry, InventoryEntryChangeQuantityAction, InventoryEntrySetExpectedDeliveryAction, InventoryEntrySetCustomFieldAction, InventoryEntrySetCustomTypeAction, InventoryEntrySetRestockableInDaysAction, OrderFromCartDraft, Order, CartReference, OrderImportDraft, OrderAddPaymentAction, OrderChangeOrderStateAction, OrderChangePaymentStateAction, OrderTransitionStateAction, OrderSetBillingAddressAction, OrderSetCustomerEmailAction, OrderSetCustomFieldAction, OrderSetCustomTypeAction, OrderSetLocaleAction, OrderSetOrderNumberAction, OrderSetShippingAddressAction, OrderSetStoreAction, MyOrderFromCartDraft, OrderEditDraft, OrderEdit, OrderEditUpdateAction, PaymentDraft, Payment, TransactionDraft, Transaction, PaymentSetCustomFieldAction, PaymentSetCustomTypeAction, PaymentAddTransactionAction, PaymentChangeTransactionStateAction, PaymentTransitionStateAction, ProductDraft, Product, ProductUpdateAction, ProductDiscountDraft, ProductDiscount, ProductDiscountUpdateAction, ProductProjectionPagedSearchResponse, ProductProjection, FacetResults, TermFacetResult, FilteredFacetResult, RangeFacetResult, ProductSelectionDraft, ProductSelection, ReviewUpdateAction, Review, ProductTypeDraft, ProductType, AttributeDefinitionDraft, AttributeDefinition, ProductTypeUpdateAction, ProjectUpdateAction, QuoteDraft, Quote, QuoteUpdateAction, QuoteRequestDraft, QuoteRequest, QuoteRequestUpdateAction, ReviewDraft, ShippingMethodDraft, ShippingMethod, ShippingMethodUpdateAction, ShoppingListDraft, ShoppingList, StagedQuoteDraft, StagedQuote, StagedQuoteUpdateAction, StandalonePriceDraft, StandalonePrice, ChannelResourceIdentifier, ChannelReference, DiscountedPriceDraft, StandalonePriceChangeActiveAction, StandalonePriceChangeValueAction, StandalonePriceSetDiscountedPriceAction, StateDraft, State, StateUpdateAction, StoreDraft, Store, StoreUpdateAction, SubscriptionDraft, Subscription, TaxCategoryDraft, TaxCategory, TaxCategoryUpdateAction, TypeDraft, Type, TypeUpdateAction, ZoneDraft, Zone, ZoneUpdateAction, BaseResource, UpdateAction } from '@commercetools/platform-sdk';
3
+ import { Project, ResourceIdentifier, QueryParam, AssociateRoleDraft, AssociateRole, AssociateRoleSetNameAction, AssociateRoleSetPermissionsAction, AssociateRoleChangeBuyerAssignableAction, AssociateRoleSetCustomFieldAction, AssociateRoleAddPermissionAction, AssociateRoleRemovePermissionAction, AttributeGroupDraft, AttributeGroup, AttributeGroupSetAttributesAction, AttributeGroupChangeNameAction, AttributeGroupSetDescriptionAction, AttributeGroupSetKeyAction, BusinessUnitDraft, BusinessUnit, BusinessUnitAddAddressAction, BusinessUnitAddAssociateAction, BusinessUnitSetAssociatesAction, BusinessUnitSetContactEmailAction, BusinessUnitSetStoreModeAction, BusinessUnitChangeNameAction, BusinessUnitChangeAddressAction, BusinessUnitAddStoreAction, BusinessUnitChangeParentUnitAction, BusinessUnitChangeStatusAction, CartDraft, Cart, CartAddLineItemAction, CartAddItemShippingAddressAction, CartChangeLineItemQuantityAction, CartRemoveLineItemAction, CartSetBillingAddressAction, CartSetShippingMethodAction, CartSetCountryAction, CartSetCustomerEmailAction, CartSetCustomFieldAction, CartSetCustomTypeAction, CartSetLocaleAction, CartSetLineItemShippingDetailsAction, CartSetShippingAddressAction, CartRemoveDiscountCodeAction, LineItemDraft, LineItem, CartDiscountDraft, CartDiscount, CartDiscountUpdateAction, AssetDraft, Asset, CategoryDraft, Category, CategoryChangeAssetNameAction, CategoryChangeSlugAction, CategorySetKeyAction, CategorySetAssetDescriptionAction, CategorySetAssetSourcesAction, CategorySetDescriptionAction, CategorySetMetaDescriptionAction, CategorySetMetaKeywordsAction, CategorySetMetaTitleAction, CategorySetCustomTypeAction, CategorySetCustomFieldAction, CategoryRemoveAssetAction, CategoryAddAssetAction, ChannelDraft, Channel, ChannelUpdateAction, CustomObjectDraft, CustomObject, CustomerDraft, Customer, CustomerChangeEmailAction, CustomerSetAuthenticationModeAction, CustomerSetCustomFieldAction, CustomerGroupDraft, CustomerGroup, CustomerGroupSetKeyAction, CustomerGroupChangeNameAction, CustomerGroupSetCustomTypeAction, CustomerGroupSetCustomFieldAction, DiscountCodeDraft, DiscountCode, DiscountCodeUpdateAction, Extension, ExtensionDraft, ExtensionUpdateAction, InventoryEntryDraft, InventoryEntry, InventoryEntryChangeQuantityAction, InventoryEntrySetExpectedDeliveryAction, InventoryEntrySetCustomFieldAction, InventoryEntrySetCustomTypeAction, InventoryEntrySetRestockableInDaysAction, OrderFromCartDraft, Order, CartReference, OrderImportDraft, OrderAddPaymentAction, OrderChangeOrderStateAction, OrderChangePaymentStateAction, OrderTransitionStateAction, OrderSetBillingAddressAction, OrderSetCustomerEmailAction, OrderSetCustomFieldAction, OrderSetCustomTypeAction, OrderSetLocaleAction, OrderSetOrderNumberAction, OrderSetShippingAddressAction, OrderSetStoreAction, MyOrderFromCartDraft, OrderEditDraft, OrderEdit, OrderEditUpdateAction, PaymentDraft, Payment, TransactionDraft, Transaction, PaymentSetCustomFieldAction, PaymentSetCustomTypeAction, PaymentAddTransactionAction, PaymentChangeTransactionStateAction, PaymentTransitionStateAction, ProductDraft, Product, ProductUpdateAction, ProductDiscountDraft, ProductDiscount, ProductDiscountUpdateAction, ProductProjectionPagedSearchResponse, ProductProjection, FacetResults, TermFacetResult, FilteredFacetResult, RangeFacetResult, ProductSelectionDraft, ProductSelection, ProductSelectionUpdateAction, ProductTypeDraft, ProductType, AttributeDefinitionDraft, AttributeDefinition, ProductTypeUpdateAction, ProjectUpdateAction, QuoteDraft, Quote, QuoteUpdateAction, QuoteRequestDraft, QuoteRequest, QuoteRequestUpdateAction, ReviewDraft, Review, ReviewUpdateAction, ShippingMethodDraft, ShippingMethod, ShippingMethodUpdateAction, ShoppingListDraft, ShoppingList, StagedQuoteDraft, StagedQuote, StagedQuoteUpdateAction, StandalonePriceDraft, StandalonePrice, ChannelResourceIdentifier, ChannelReference, DiscountedPriceDraft, StandalonePriceChangeActiveAction, StandalonePriceChangeValueAction, StandalonePriceSetDiscountedPriceAction, StateDraft, State, StateUpdateAction, StoreDraft, Store, StoreUpdateAction, SubscriptionDraft, Subscription, TaxCategoryDraft, TaxCategory, TaxCategoryUpdateAction, TypeDraft, Type, TypeUpdateAction, ZoneDraft, Zone, ZoneUpdateAction, BaseResource, UpdateAction } from '@commercetools/platform-sdk';
4
4
 
5
5
  type GetParams$1 = {
6
6
  expand?: string[];
@@ -80,6 +80,7 @@ declare class CartRepository extends AbstractResourceRepository<'cart'> {
80
80
  getActiveCart(projectKey: string): Cart | undefined;
81
81
  actions: {
82
82
  addLineItem: (context: RepositoryContext, resource: Writable<Cart>, { productId, variantId, sku, quantity }: CartAddLineItemAction) => void;
83
+ addItemShippingAddress: (context: RepositoryContext, resource: Writable<Cart>, { action, address }: CartAddItemShippingAddressAction) => void;
83
84
  changeLineItemQuantity: (context: RepositoryContext, resource: Writable<Cart>, { lineItemId, lineItemKey, quantity }: CartChangeLineItemQuantityAction) => void;
84
85
  removeLineItem: (context: RepositoryContext, resource: Writable<Cart>, { lineItemId, quantity }: CartRemoveLineItemAction) => void;
85
86
  setBillingAddress: (context: RepositoryContext, resource: Writable<Cart>, { address }: CartSetBillingAddressAction) => void;
@@ -89,7 +90,9 @@ declare class CartRepository extends AbstractResourceRepository<'cart'> {
89
90
  setCustomField: (context: RepositoryContext, resource: Cart, { name, value }: CartSetCustomFieldAction) => void;
90
91
  setCustomType: (context: RepositoryContext, resource: Writable<Cart>, { type, fields }: CartSetCustomTypeAction) => void;
91
92
  setLocale: (context: RepositoryContext, resource: Writable<Cart>, { locale }: CartSetLocaleAction) => void;
93
+ setLineItemShippingDetails: (context: RepositoryContext, resource: Writable<Cart>, { action, shippingDetails, lineItemId, lineItemKey, }: CartSetLineItemShippingDetailsAction) => void;
92
94
  setShippingAddress: (context: RepositoryContext, resource: Writable<Cart>, { address }: CartSetShippingAddressAction) => void;
95
+ removeDiscountCode: (context: RepositoryContext, resource: Writable<Cart>, { discountCode }: CartRemoveDiscountCodeAction) => void;
93
96
  };
94
97
  draftLineItemtoLineItem: (projectKey: string, draftLineItem: LineItemDraft, currency: string, country: string | undefined) => LineItem;
95
98
  }
@@ -330,7 +333,7 @@ declare class ProductProjectionRepository extends AbstractResourceRepository<'pr
330
333
  declare class ProductSelectionRepository extends AbstractResourceRepository<'product-selection'> {
331
334
  getTypeId(): "product-selection";
332
335
  create(context: RepositoryContext, draft: ProductSelectionDraft): ProductSelection;
333
- actions: Partial<Record<ReviewUpdateAction['action'], (context: RepositoryContext, resource: Writable<Review>, action: any) => void>>;
336
+ actions: Partial<Record<ProductSelectionUpdateAction['action'], (context: RepositoryContext, resource: Writable<ProductSelection>, action: any) => void>>;
334
337
  }
335
338
 
336
339
  declare class ProductTypeRepository extends AbstractResourceRepository<'product-type'> {
package/dist/index.js CHANGED
@@ -2152,6 +2152,16 @@ var CartRepository = class extends AbstractResourceRepository {
2152
2152
  }
2153
2153
  resource.totalPrice.centAmount = calculateCartTotalPrice(resource);
2154
2154
  },
2155
+ addItemShippingAddress: (context, resource, { action, address }) => {
2156
+ const newAddress = createAddress(
2157
+ address,
2158
+ context.projectKey,
2159
+ this._storage
2160
+ );
2161
+ if (newAddress) {
2162
+ resource.itemShippingAddresses.push(newAddress);
2163
+ }
2164
+ },
2155
2165
  changeLineItemQuantity: (context, resource, { lineItemId, lineItemKey, quantity }) => {
2156
2166
  let lineItem;
2157
2167
  if (lineItemId) {
@@ -2275,6 +2285,26 @@ var CartRepository = class extends AbstractResourceRepository {
2275
2285
  setLocale: (context, resource, { locale }) => {
2276
2286
  resource.locale = locale;
2277
2287
  },
2288
+ setLineItemShippingDetails: (context, resource, {
2289
+ action,
2290
+ shippingDetails,
2291
+ lineItemId,
2292
+ lineItemKey
2293
+ }) => {
2294
+ const lineItem = resource.lineItems.find(
2295
+ (x) => lineItemId && x.id === lineItemId || lineItemKey && x.key === lineItemKey
2296
+ );
2297
+ if (!lineItem) {
2298
+ throw new CommercetoolsError({
2299
+ code: "General",
2300
+ message: lineItemKey ? `A line item with key '${lineItemKey}' not found.` : `A line item with ID '${lineItemId}' not found.`
2301
+ });
2302
+ }
2303
+ lineItem.shippingDetails = {
2304
+ ...shippingDetails,
2305
+ valid: true
2306
+ };
2307
+ },
2278
2308
  setShippingAddress: (context, resource, { address }) => {
2279
2309
  if (!address) {
2280
2310
  resource.shippingAddress = void 0;
@@ -2292,6 +2322,11 @@ var CartRepository = class extends AbstractResourceRepository {
2292
2322
  ...address,
2293
2323
  custom
2294
2324
  };
2325
+ },
2326
+ removeDiscountCode: (context, resource, { discountCode }) => {
2327
+ resource.discountCodes = resource.discountCodes.filter(
2328
+ (code) => code.discountCode.id !== discountCode.id
2329
+ );
2295
2330
  }
2296
2331
  };
2297
2332
  draftLineItemtoLineItem = (projectKey, draftLineItem, currency, country) => {
@@ -4637,6 +4672,7 @@ var ProductSelectionRepository = class extends AbstractResourceRepository {
4637
4672
  const resource = {
4638
4673
  ...getBaseResourceProperties(),
4639
4674
  productCount: 0,
4675
+ key: draft.key,
4640
4676
  name: draft.name,
4641
4677
  type: "individual",
4642
4678
  mode: "Individual"
@@ -4644,7 +4680,11 @@ var ProductSelectionRepository = class extends AbstractResourceRepository {
4644
4680
  this.saveNew(context, resource);
4645
4681
  return resource;
4646
4682
  }
4647
- actions = {};
4683
+ actions = {
4684
+ changeName: (context, resource, { name }) => {
4685
+ resource.name = name;
4686
+ }
4687
+ };
4648
4688
  };
4649
4689
 
4650
4690
  // src/repositories/product-type.ts
@@ -5644,6 +5684,18 @@ var AssociateRoleServices = class extends AbstractService {
5644
5684
  }
5645
5685
  };
5646
5686
 
5687
+ // src/services/attribute-group.ts
5688
+ var AttributeGroupService = class extends AbstractService {
5689
+ repository;
5690
+ constructor(parent, repository) {
5691
+ super(parent);
5692
+ this.repository = repository;
5693
+ }
5694
+ getBasePath() {
5695
+ return "attribute-groups";
5696
+ }
5697
+ };
5698
+
5647
5699
  // src/services/business-units.ts
5648
5700
  var BusinessUnitServices = class extends AbstractService {
5649
5701
  repository;
@@ -5656,6 +5708,18 @@ var BusinessUnitServices = class extends AbstractService {
5656
5708
  }
5657
5709
  };
5658
5710
 
5711
+ // src/services/cart-discount.ts
5712
+ var CartDiscountService = class extends AbstractService {
5713
+ repository;
5714
+ constructor(parent, repository) {
5715
+ super(parent);
5716
+ this.repository = repository;
5717
+ }
5718
+ getBasePath() {
5719
+ return "cart-discounts";
5720
+ }
5721
+ };
5722
+
5659
5723
  // src/services/cart.ts
5660
5724
  var CartService = class extends AbstractService {
5661
5725
  repository;
@@ -5694,18 +5758,6 @@ var CartService = class extends AbstractService {
5694
5758
  }
5695
5759
  };
5696
5760
 
5697
- // src/services/cart-discount.ts
5698
- var CartDiscountService = class extends AbstractService {
5699
- repository;
5700
- constructor(parent, repository) {
5701
- super(parent);
5702
- this.repository = repository;
5703
- }
5704
- getBasePath() {
5705
- return "cart-discounts";
5706
- }
5707
- };
5708
-
5709
5761
  // src/services/category.ts
5710
5762
  var CategoryServices = class extends AbstractService {
5711
5763
  repository;
@@ -5782,6 +5834,18 @@ var CustomObjectService = class extends AbstractService {
5782
5834
  }
5783
5835
  };
5784
5836
 
5837
+ // src/services/customer-group.ts
5838
+ var CustomerGroupService = class extends AbstractService {
5839
+ repository;
5840
+ constructor(parent, repository) {
5841
+ super(parent);
5842
+ this.repository = repository;
5843
+ }
5844
+ getBasePath() {
5845
+ return "customer-groups";
5846
+ }
5847
+ };
5848
+
5785
5849
  // src/services/customer.ts
5786
5850
  import { v4 as uuidv48 } from "uuid";
5787
5851
  var CustomerService = class extends AbstractService {
@@ -5813,18 +5877,6 @@ var CustomerService = class extends AbstractService {
5813
5877
  }
5814
5878
  };
5815
5879
 
5816
- // src/services/customer-group.ts
5817
- var CustomerGroupService = class extends AbstractService {
5818
- repository;
5819
- constructor(parent, repository) {
5820
- super(parent);
5821
- this.repository = repository;
5822
- }
5823
- getBasePath() {
5824
- return "customer-groups";
5825
- }
5826
- };
5827
-
5828
5880
  // src/services/discount-code.ts
5829
5881
  var DiscountCodeService = class extends AbstractService {
5830
5882
  repository;
@@ -6033,18 +6085,6 @@ var PaymentService = class extends AbstractService {
6033
6085
  }
6034
6086
  };
6035
6087
 
6036
- // src/services/product.ts
6037
- var ProductService = class extends AbstractService {
6038
- repository;
6039
- constructor(parent, repository) {
6040
- super(parent);
6041
- this.repository = repository;
6042
- }
6043
- getBasePath() {
6044
- return "products";
6045
- }
6046
- };
6047
-
6048
6088
  // src/services/product-discount.ts
6049
6089
  var ProductDiscountService = class extends AbstractService {
6050
6090
  repository;
@@ -6107,6 +6147,18 @@ var ProductProjectionService = class extends AbstractService {
6107
6147
  }
6108
6148
  };
6109
6149
 
6150
+ // src/services/product-selection.ts
6151
+ var ProductSelectionService = class extends AbstractService {
6152
+ repository;
6153
+ constructor(parent, repository) {
6154
+ super(parent);
6155
+ this.repository = repository;
6156
+ }
6157
+ getBasePath() {
6158
+ return "product-selections";
6159
+ }
6160
+ };
6161
+
6110
6162
  // src/services/product-type.ts
6111
6163
  var ProductTypeService = class extends AbstractService {
6112
6164
  repository;
@@ -6119,6 +6171,18 @@ var ProductTypeService = class extends AbstractService {
6119
6171
  }
6120
6172
  };
6121
6173
 
6174
+ // src/services/product.ts
6175
+ var ProductService = class extends AbstractService {
6176
+ repository;
6177
+ constructor(parent, repository) {
6178
+ super(parent);
6179
+ this.repository = repository;
6180
+ }
6181
+ getBasePath() {
6182
+ return "products";
6183
+ }
6184
+ };
6185
+
6122
6186
  // src/services/shipping-method.ts
6123
6187
  var ShippingMethodService = class extends AbstractService {
6124
6188
  repository;
@@ -6231,18 +6295,6 @@ var ZoneService = class extends AbstractService {
6231
6295
  }
6232
6296
  };
6233
6297
 
6234
- // src/services/attribute-group.ts
6235
- var AttributeGroupService = class extends AbstractService {
6236
- repository;
6237
- constructor(parent, repository) {
6238
- super(parent);
6239
- this.repository = repository;
6240
- }
6241
- getBasePath() {
6242
- return "attribute-groups";
6243
- }
6244
- };
6245
-
6246
6298
  // src/services/index.ts
6247
6299
  var createServices = (router, repos) => ({
6248
6300
  "associate-role": new AssociateRoleServices(router, repos["associate-role"]),
@@ -6287,6 +6339,10 @@ var createServices = (router, repos) => ({
6287
6339
  router,
6288
6340
  repos["product-projection"]
6289
6341
  ),
6342
+ "product-selection": new ProductSelectionService(
6343
+ router,
6344
+ repos["product-selection"]
6345
+ ),
6290
6346
  "shopping-list": new ShoppingListService(router, repos["shopping-list"]),
6291
6347
  state: new StateService(router, repos["state"]),
6292
6348
  store: new StoreService(router, repos["store"]),