@gradientedge/commercetools-utils 4.18.0 → 4.21.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.
@@ -1,4 +1,4 @@
1
- import { CartDiscountReference } from './cart-discount';
1
+ import { CartDiscountReference, CartDiscountTarget, CartDiscountValue, CartDiscountValueDraft } from './cart-discount';
2
2
  import { ChannelReference, ChannelResourceIdentifier } from './channel';
3
3
  import { Address, BaseAddress, BaseResource, CreatedBy, LastModifiedBy, LocalizedString, Money, Price, TypedMoney } from './common';
4
4
  import { CustomerGroupReference, CustomerGroupResourceIdentifier } from './customer-group';
@@ -38,6 +38,7 @@ export interface Cart extends BaseResource {
38
38
  readonly customerGroup?: CustomerGroupReference;
39
39
  readonly country?: string;
40
40
  readonly shippingInfo?: ShippingInfo;
41
+ readonly directDiscounts?: DirectDiscount[];
41
42
  readonly discountCodes?: DiscountCodeInfo[];
42
43
  readonly custom?: CustomFields;
43
44
  readonly paymentInfo?: PaymentInfo;
@@ -99,7 +100,7 @@ export interface CartUpdate {
99
100
  readonly version: number;
100
101
  readonly actions: CartUpdateAction[];
101
102
  }
102
- export declare type CartUpdateAction = CartAddCustomLineItemAction | CartAddDiscountCodeAction | CartAddItemShippingAddressAction | CartAddLineItemAction | CartAddPaymentAction | CartAddShoppingListAction | CartApplyDeltaToCustomLineItemShippingDetailsTargetsAction | CartApplyDeltaToLineItemShippingDetailsTargetsAction | CartChangeCustomLineItemMoneyAction | CartChangeCustomLineItemQuantityAction | CartChangeLineItemQuantityAction | CartChangeTaxCalculationModeAction | CartChangeTaxModeAction | CartChangeTaxRoundingModeAction | CartRecalculateAction | CartRemoveCustomLineItemAction | CartRemoveDiscountCodeAction | CartRemoveItemShippingAddressAction | CartRemoveLineItemAction | CartRemovePaymentAction | CartSetAnonymousIdAction | CartSetBillingAddressAction | CartSetBillingAddressCustomFieldAction | CartSetBillingAddressCustomTypeAction | CartSetCartTotalTaxAction | CartSetCountryAction | CartSetCustomFieldAction | CartSetCustomLineItemCustomFieldAction | CartSetCustomLineItemCustomTypeAction | CartSetCustomLineItemShippingDetailsAction | CartSetCustomLineItemTaxAmountAction | CartSetCustomLineItemTaxRateAction | CartSetCustomShippingMethodAction | CartSetCustomTypeAction | CartSetCustomerEmailAction | CartSetCustomerGroupAction | CartSetCustomerIdAction | CartSetDeleteDaysAfterLastModificationAction | CartSetDeliveryAddressCustomFieldAction | CartSetDeliveryAddressCustomTypeAction | CartSetItemShippingAddressCustomFieldAction | CartSetItemShippingAddressCustomTypeAction | CartSetKeyAction | CartSetLineItemCustomFieldAction | CartSetLineItemCustomTypeAction | CartSetLineItemDistributionChannelAction | CartSetLineItemPriceAction | CartSetLineItemShippingDetailsAction | CartSetLineItemSupplyChannelAction | CartSetLineItemTaxAmountAction | CartSetLineItemTaxRateAction | CartSetLineItemTotalPriceAction | CartSetLocaleAction | CartSetShippingAddressAction | CartSetShippingAddressCustomFieldAction | CartSetShippingAddressCustomTypeAction | CartSetShippingMethodAction | CartSetShippingMethodTaxAmountAction | CartSetShippingMethodTaxRateAction | CartSetShippingRateInputAction | CartUpdateItemShippingAddressAction;
103
+ export declare type CartUpdateAction = CartAddCustomLineItemAction | CartAddDiscountCodeAction | CartAddItemShippingAddressAction | CartAddLineItemAction | CartAddPaymentAction | CartAddShoppingListAction | CartApplyDeltaToCustomLineItemShippingDetailsTargetsAction | CartApplyDeltaToLineItemShippingDetailsTargetsAction | CartChangeCustomLineItemMoneyAction | CartChangeCustomLineItemQuantityAction | CartChangeLineItemQuantityAction | CartChangeTaxCalculationModeAction | CartChangeTaxModeAction | CartChangeTaxRoundingModeAction | CartRecalculateAction | CartRemoveCustomLineItemAction | CartRemoveDiscountCodeAction | CartRemoveItemShippingAddressAction | CartRemoveLineItemAction | CartRemovePaymentAction | CartSetAnonymousIdAction | CartSetBillingAddressAction | CartSetBillingAddressCustomFieldAction | CartSetBillingAddressCustomTypeAction | CartSetCartTotalTaxAction | CartSetCountryAction | CartSetCustomFieldAction | CartSetCustomLineItemCustomFieldAction | CartSetCustomLineItemCustomTypeAction | CartSetCustomLineItemShippingDetailsAction | CartSetCustomLineItemTaxAmountAction | CartSetCustomLineItemTaxRateAction | CartSetCustomShippingMethodAction | CartSetCustomTypeAction | CartSetCustomerEmailAction | CartSetCustomerGroupAction | CartSetCustomerIdAction | CartSetDeleteDaysAfterLastModificationAction | CartSetDeliveryAddressCustomFieldAction | CartSetDeliveryAddressCustomTypeAction | CartSetDirectDiscountsAction | CartSetItemShippingAddressCustomFieldAction | CartSetItemShippingAddressCustomTypeAction | CartSetKeyAction | CartSetLineItemCustomFieldAction | CartSetLineItemCustomTypeAction | CartSetLineItemDistributionChannelAction | CartSetLineItemPriceAction | CartSetLineItemShippingDetailsAction | CartSetLineItemSupplyChannelAction | CartSetLineItemTaxAmountAction | CartSetLineItemTaxRateAction | CartSetLineItemTotalPriceAction | CartSetLocaleAction | CartSetShippingAddressAction | CartSetShippingAddressCustomFieldAction | CartSetShippingAddressCustomTypeAction | CartSetShippingMethodAction | CartSetShippingMethodTaxAmountAction | CartSetShippingMethodTaxRateAction | CartSetShippingRateInputAction | CartUpdateItemShippingAddressAction;
103
104
  export interface CustomLineItem {
104
105
  readonly id: string;
105
106
  readonly name: LocalizedString;
@@ -125,6 +126,15 @@ export interface CustomLineItemDraft {
125
126
  readonly custom?: CustomFieldsDraft;
126
127
  readonly shippingDetails?: ItemShippingDetailsDraft;
127
128
  }
129
+ export interface DirectDiscount {
130
+ id: string;
131
+ value: CartDiscountValue;
132
+ target?: CartDiscountTarget;
133
+ }
134
+ export interface DirectDiscountDraft {
135
+ value: CartDiscountValueDraft;
136
+ target?: CartDiscountTarget;
137
+ }
128
138
  export interface DiscountCodeInfo {
129
139
  readonly discountCode: DiscountCodeReference;
130
140
  readonly state: DiscountCodeState;
@@ -483,6 +493,10 @@ export interface CartSetDeliveryAddressCustomTypeAction {
483
493
  readonly type?: TypeResourceIdentifier;
484
494
  readonly fields?: FieldContainer;
485
495
  }
496
+ export interface CartSetDirectDiscountsAction {
497
+ readonly action: 'setDirectDiscounts';
498
+ readonly discounts: DirectDiscountDraft[];
499
+ }
486
500
  export interface CartSetItemShippingAddressCustomFieldAction {
487
501
  readonly action: 'setItemShippingAddressCustomField';
488
502
  readonly addressKey: string;
@@ -0,0 +1,6 @@
1
+ import { Attribute } from '../models';
2
+ export interface GetAttributeValueParams {
3
+ attributes: Attribute[] | null | undefined;
4
+ name: string;
5
+ }
6
+ export declare function getAttributeValue<T = any>(options: GetAttributeValueParams): T | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/commercetools-utils",
3
- "version": "4.18.0",
3
+ "version": "4.21.0",
4
4
  "description": "Provide utility classes and functions for interacting with the commercetools API",
5
5
  "main": "./dist/ge-commercetools-utils-node.cjs.js",
6
6
  "module": "./dist/ge-commercetools-utils-node.esm.js",