@gradientedge/commercetools-utils 4.13.0 → 4.15.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.
@@ -2,7 +2,7 @@ import { AxiosInstance } from 'axios';
2
2
  import { CommercetoolsApiConfig, CommercetoolsRetryConfig } from './types';
3
3
  import { CommercetoolsAuth } from '../';
4
4
  import { RegionEndpoints } from '../types';
5
- import type { Cart, CartDiscount, CartDiscountPagedQueryResponse, CartDraft, CartPagedQueryResponse, CartUpdateAction, Category, CategoryDraft, CategoryPagedQueryResponse, CategoryUpdate, Channel, ChannelPagedQueryResponse, Customer, CustomerCreatePasswordResetToken, CustomerDraft, CustomerGroup, CustomerGroupDraft, CustomerGroupPagedQueryResponse, CustomerGroupUpdate, CustomerPagedQueryResponse, CustomerResetPassword, CustomerSignin, CustomerSignInResult, CustomerToken, CustomerUpdate, CustomObject, CustomObjectDraft, DiscountCode, GraphQLRequest, GraphQLResponse, MyCartDraft, MyCustomerDraft, MyPayment, MyPaymentDraft, MyPaymentPagedQueryResponse, MyPaymentUpdate, Order, OrderImportDraft, OrderPagedQueryResponse, OrderUpdate, Payment, PaymentPagedQueryResponse, PaymentUpdate, Product, ProductDraft, ProductProjection, ProductProjectionPagedQueryResponse, ProductsInStorePagedQueryResponse, ProductSelection, ProductSelectionDraft, ProductSelectionPagedQueryResponse, ProductSelectionUpdateAction, ProductType, ProductUpdate, ShippingMethod, ShippingMethodPagedQueryResponse, Store, StoreDraft, StorePagedQueryResponse, StoreUpdate, Type } from '../models';
5
+ import type { Cart, CartDiscount, CartDiscountPagedQueryResponse, CartDraft, CartPagedQueryResponse, CartUpdateAction, Category, CategoryDraft, CategoryPagedQueryResponse, CategoryUpdate, Channel, ChannelPagedQueryResponse, Customer, CustomerCreatePasswordResetToken, CustomerDraft, CustomerGroup, CustomerGroupDraft, CustomerGroupPagedQueryResponse, CustomerGroupUpdate, CustomerPagedQueryResponse, CustomerResetPassword, CustomerSignin, CustomerSignInResult, CustomerToken, CustomerUpdate, CustomObject, CustomObjectDraft, DiscountCode, GraphQLRequest, GraphQLResponse, MyCartDraft, MyCartUpdateAction, MyCustomerDraft, MyPayment, MyPaymentDraft, MyPaymentPagedQueryResponse, MyPaymentUpdate, Order, OrderImportDraft, OrderPagedQueryResponse, OrderUpdate, Payment, PaymentPagedQueryResponse, PaymentUpdate, Product, ProductDraft, ProductProjection, ProductProjectionPagedQueryResponse, ProductsInStorePagedQueryResponse, ProductSelection, ProductSelectionDraft, ProductSelectionPagedQueryResponse, ProductSelectionUpdateAction, ProductType, ProductUpdate, ShippingMethod, ShippingMethodPagedQueryResponse, Store, StoreDraft, StorePagedQueryResponse, StoreUpdate, Type } from '../models';
6
6
  export interface FetchOptions<T = Record<string, any>> {
7
7
  path: string;
8
8
  headers?: Record<string, string>;
@@ -157,7 +157,7 @@ export declare class CommercetoolsApi {
157
157
  }): Promise<Cart>;
158
158
  updateMyActiveCart(options: CommonStoreEnabledRequestOptions & {
159
159
  accessToken: string;
160
- actions: CartUpdateAction[];
160
+ actions: MyCartUpdateAction[];
161
161
  }): Promise<Cart>;
162
162
  createMyOrderFromActiveCart(options: CommonStoreEnabledRequestOptions & {
163
163
  accessToken: string;
@@ -197,6 +197,11 @@ export declare class CommercetoolsApi {
197
197
  queryMyPayments(options: CommonRequestOptions & {
198
198
  accessToken: string;
199
199
  }): Promise<MyPaymentPagedQueryResponse>;
200
+ deleteMyPaymentById(options: CommonRequestOptions & {
201
+ id: string;
202
+ version: number;
203
+ accessToken: string;
204
+ }): Promise<MyPayment>;
200
205
  getMyOrderById(options: CommonStoreEnabledRequestOptions & {
201
206
  id: string;
202
207
  accessToken: string;
@@ -262,11 +262,13 @@ export interface TaxPortionDraft {
262
262
  export interface TaxedItemPrice {
263
263
  readonly totalNet: TypedMoney;
264
264
  readonly totalGross: TypedMoney;
265
+ readonly totalTax?: TypedMoney;
265
266
  }
266
267
  export interface TaxedPrice {
267
268
  readonly totalNet: TypedMoney;
268
269
  readonly totalGross: TypedMoney;
269
270
  readonly taxPortions: TaxPortion[];
271
+ readonly totalTax?: TypedMoney;
270
272
  }
271
273
  export interface TaxedPriceDraft {
272
274
  readonly totalNet: Money;
@@ -205,14 +205,14 @@ export interface ScopedPrice {
205
205
  export declare type TypedMoney = CentPrecisionMoney | HighPrecisionMoney;
206
206
  export interface CentPrecisionMoney {
207
207
  readonly type: 'centPrecision';
208
- readonly currencyCode: string;
209
208
  readonly centAmount: number;
209
+ readonly currencyCode: string;
210
210
  readonly fractionDigits: number;
211
211
  }
212
212
  export interface HighPrecisionMoney {
213
213
  readonly type: 'highPrecision';
214
- readonly currencyCode: string;
215
214
  readonly centAmount: number;
215
+ readonly currencyCode: string;
216
216
  readonly fractionDigits: number;
217
217
  readonly preciseAmount: number;
218
218
  }
@@ -225,7 +225,7 @@ export interface CentPrecisionMoneyDraft {
225
225
  }
226
226
  export interface HighPrecisionMoneyDraft {
227
227
  readonly type: 'highPrecision';
228
- readonly centAmount: number;
228
+ readonly centAmount?: number;
229
229
  readonly currencyCode: string;
230
230
  readonly fractionDigits?: number;
231
231
  readonly preciseAmount: number;
@@ -31,9 +31,9 @@ export interface ExtensionInput {
31
31
  }
32
32
  export interface ExtensionPagedQueryResponse {
33
33
  readonly limit: number;
34
+ readonly offset: number;
34
35
  readonly count: number;
35
36
  readonly total?: number;
36
- readonly offset: number;
37
37
  readonly results: Extension[];
38
38
  }
39
39
  export declare type ExtensionResourceTypeId = 'cart' | 'customer' | 'order' | 'payment';
@@ -8,6 +8,7 @@ export interface InventoryEntry extends BaseResource {
8
8
  readonly lastModifiedAt: string;
9
9
  readonly lastModifiedBy?: LastModifiedBy;
10
10
  readonly createdBy?: CreatedBy;
11
+ readonly key?: string;
11
12
  readonly sku: string;
12
13
  readonly supplyChannel?: ChannelReference;
13
14
  readonly quantityOnStock: number;
@@ -18,6 +19,7 @@ export interface InventoryEntry extends BaseResource {
18
19
  }
19
20
  export interface InventoryEntryDraft {
20
21
  readonly sku: string;
22
+ readonly key?: string;
21
23
  readonly supplyChannel?: ChannelResourceIdentifier;
22
24
  readonly quantityOnStock: number;
23
25
  readonly restockableInDays?: number;
@@ -38,7 +40,7 @@ export interface InventoryEntryUpdate {
38
40
  readonly version: number;
39
41
  readonly actions: InventoryEntryUpdateAction[];
40
42
  }
41
- export declare type InventoryEntryUpdateAction = InventoryEntryAddQuantityAction | InventoryEntryChangeQuantityAction | InventoryEntryRemoveQuantityAction | InventoryEntrySetCustomFieldAction | InventoryEntrySetCustomTypeAction | InventoryEntrySetExpectedDeliveryAction | InventoryEntrySetRestockableInDaysAction | InventoryEntrySetSupplyChannelAction;
43
+ export declare type InventoryEntryUpdateAction = InventoryEntryAddQuantityAction | InventoryEntryChangeQuantityAction | InventoryEntryRemoveQuantityAction | InventoryEntrySetCustomFieldAction | InventoryEntrySetCustomTypeAction | InventoryEntrySetExpectedDeliveryAction | InventoryEntrySetKeyAction | InventoryEntrySetRestockableInDaysAction | InventoryEntrySetSupplyChannelAction;
42
44
  export interface InventoryPagedQueryResponse {
43
45
  readonly limit: number;
44
46
  readonly count: number;
@@ -72,6 +74,10 @@ export interface InventoryEntrySetExpectedDeliveryAction {
72
74
  readonly action: 'setExpectedDelivery';
73
75
  readonly expectedDelivery?: string;
74
76
  }
77
+ export interface InventoryEntrySetKeyAction {
78
+ readonly action: 'setKey';
79
+ readonly key?: string;
80
+ }
75
81
  export interface InventoryEntrySetRestockableInDaysAction {
76
82
  readonly action: 'setRestockableInDays';
77
83
  readonly restockableInDays?: number;
@@ -1,8 +1,9 @@
1
- import { DiscountCodeInfo, ExternalLineItemTotalPrice, ExternalTaxRateDraft, InventoryMode, ItemShippingDetailsDraft, ItemShippingTarget, TaxMode } from './cart';
1
+ import { CartReference, DiscountCodeInfo, ExternalLineItemTotalPrice, ExternalTaxRateDraft, InventoryMode, ItemShippingDetailsDraft, ItemShippingTarget, TaxMode } from './cart';
2
2
  import { ChannelResourceIdentifier } from './channel';
3
3
  import { BaseAddress, LocalizedString, Money, TypedMoney } from './common';
4
4
  import { CustomerReference } from './customer';
5
5
  import { DiscountCodeReference } from './discount-code';
6
+ import { OrderReference } from './order';
6
7
  import { PaymentMethodInfo, PaymentResourceIdentifier, Transaction, TransactionDraft, TransactionType } from './payment';
7
8
  import { ShippingMethodResourceIdentifier } from './shipping-method';
8
9
  import { ShoppingListLineItemDraft, TextLineItemDraft } from './shopping-list';
@@ -43,7 +44,7 @@ export interface MyCustomerDraft {
43
44
  readonly addresses?: BaseAddress[];
44
45
  readonly defaultShippingAddress?: number;
45
46
  readonly defaultBillingAddress?: number;
46
- readonly custom?: CustomFields;
47
+ readonly custom?: CustomFieldsDraft;
47
48
  readonly locale?: string;
48
49
  readonly stores?: StoreResourceIdentifier[];
49
50
  }
@@ -114,7 +115,10 @@ export interface MyTransactionDraft {
114
115
  readonly type: TransactionType;
115
116
  readonly amount: Money;
116
117
  readonly interactionId?: string;
117
- readonly custom?: CustomFields;
118
+ readonly custom?: CustomFieldsDraft;
119
+ }
120
+ export interface ReplicaMyCartDraft {
121
+ readonly reference: CartReference | OrderReference;
118
122
  }
119
123
  export interface MyCartAddDiscountCodeAction {
120
124
  readonly action: 'addDiscountCode';
@@ -128,7 +128,7 @@ export interface StagedOrderAddDeliveryAction {
128
128
  readonly items?: DeliveryItem[];
129
129
  readonly address?: BaseAddress;
130
130
  readonly parcels?: ParcelDraft[];
131
- readonly custom?: CustomFields;
131
+ readonly custom?: CustomFieldsDraft;
132
132
  }
133
133
  export interface StagedOrderAddDiscountCodeAction {
134
134
  readonly action: 'addDiscountCode';
@@ -108,6 +108,7 @@ export interface OrderFromCartDraft {
108
108
  readonly shipmentState?: ShipmentState;
109
109
  readonly orderState?: OrderState;
110
110
  readonly state?: StateResourceIdentifier;
111
+ readonly custom?: CustomFieldsDraft;
111
112
  }
112
113
  export interface OrderImportDraft {
113
114
  readonly orderNumber?: string;
@@ -122,9 +123,11 @@ export interface OrderImportDraft {
122
123
  readonly customerGroup?: CustomerGroupResourceIdentifier;
123
124
  readonly country?: string;
124
125
  readonly orderState?: OrderState;
126
+ readonly state?: StateReference;
125
127
  readonly shipmentState?: ShipmentState;
126
128
  readonly paymentState?: PaymentState;
127
129
  readonly shippingInfo?: ShippingInfoImportDraft;
130
+ readonly paymentInfo?: PaymentInfo;
128
131
  readonly completedAt?: string;
129
132
  readonly custom?: CustomFieldsDraft;
130
133
  readonly inventoryMode?: InventoryMode;
@@ -1,3 +1,4 @@
1
+ import { LastModifiedBy } from './common';
1
2
  import { MessagesConfiguration, MessagesConfigurationDraft } from './message';
2
3
  import { CustomFieldLocalizedEnumValue } from './type';
3
4
  export interface CartsConfiguration {
@@ -37,8 +38,8 @@ export interface SearchIndexingConfiguration {
37
38
  export declare type SearchIndexingConfigurationStatus = 'Activated' | 'Deactivated' | 'Indexing';
38
39
  export interface SearchIndexingConfigurationValues {
39
40
  readonly status?: SearchIndexingConfigurationStatus;
40
- readonly lastModifiedAt: string;
41
- readonly lastModifiedBy?: string;
41
+ readonly lastModifiedAt?: string;
42
+ readonly lastModifiedBy?: LastModifiedBy;
42
43
  }
43
44
  export declare type ShippingRateInputType = CartClassificationType | CartScoreType | CartValueType;
44
45
  export interface CartClassificationType {
@@ -66,7 +66,8 @@ export interface StoreAddDistributionChannelAction {
66
66
  }
67
67
  export interface StoreAddProductSelectionAction {
68
68
  readonly action: 'addProductSelection';
69
- readonly productSelection: ProductSelectionSettingDraft;
69
+ readonly productSelection: ProductSelectionResourceIdentifier;
70
+ readonly active?: boolean;
70
71
  }
71
72
  export interface StoreAddSupplyChannelAction {
72
73
  readonly action: 'addSupplyChannel';
@@ -67,7 +67,7 @@ export interface CustomFieldStringType {
67
67
  export interface CustomFieldTimeType {
68
68
  readonly name: 'Time';
69
69
  }
70
- export declare type ResourceTypeId = 'address' | 'asset' | 'cart-discount' | 'category' | 'channel' | 'custom-line-item' | 'customer' | 'customer-group' | 'discount-code' | 'inventory-entry' | 'line-item' | 'order' | 'order-delivery' | 'order-edit' | 'payment' | 'payment-interface-interaction' | 'product-price' | 'product-selection' | 'review' | 'shipping-method' | 'shopping-list' | 'shopping-list-text-line-item' | 'store' | 'transaction';
70
+ export declare type ResourceTypeId = 'address' | 'asset' | 'cart-discount' | 'category' | 'channel' | 'custom-line-item' | 'customer' | 'customer-group' | 'discount-code' | 'inventory-entry' | 'line-item' | 'order' | 'order-delivery' | 'order-edit' | 'order-parcel' | 'order-return-item' | 'payment' | 'payment-interface-interaction' | 'product-price' | 'product-selection' | 'review' | 'shipping-method' | 'shopping-list' | 'shopping-list-text-line-item' | 'store' | 'transaction';
71
71
  export interface Type extends BaseResource {
72
72
  readonly id: string;
73
73
  readonly version: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/commercetools-utils",
3
- "version": "4.13.0",
3
+ "version": "4.15.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",
@@ -55,44 +55,43 @@
55
55
  },
56
56
  "homepage": "https://github.com/gradientedge/commercetools-utils#readme",
57
57
  "devDependencies": {
58
- "@sinonjs/fake-timers": "^9.1.1",
59
- "@types/jest": "^27.4.1",
60
- "@types/json-stringify-safe": "^5.0.0",
61
- "@types/lodash": "^4.14.179",
62
- "@types/lodash.clonedeep": "^4.5.6",
63
- "@types/node": "17.0.21",
64
- "@types/node-fetch": "^3.0.2",
65
- "@types/qs": "^6.9.7",
66
- "@types/sinonjs__fake-timers": "^8.1.1",
67
- "@types/traverse": "^0.6.32",
68
- "@typescript-eslint/eslint-plugin": "^5.14.0",
69
- "@typescript-eslint/parser": "^5.14.0",
70
- "codecov": "^3.8.3",
71
- "commitizen": "^4.2.4",
72
- "cz-conventional-changelog": "^3.3.0",
73
- "eslint": "^8.11.0",
74
- "eslint-config-prettier": "^8.5.0",
75
- "husky": "^7.0.4",
76
- "jest": "^27.5.1",
77
- "jest-matcher-specific-error": "^1.0.0",
78
- "jest-mock": "^27.5.1",
79
- "nock": "^13.2.4",
80
- "prettier": "^2.5.1",
81
- "rimraf": "^3.0.2",
82
- "semantic-release": "^19.0.2",
83
- "ts-jest": "^27.1.3",
84
- "ts-node": "^10.7.0",
85
- "typedoc": "^0.22.13",
86
- "typescript": "~4.6.2",
87
- "webpack": "^5.70.0",
88
- "webpack-cli": "^4.9.2"
58
+ "@sinonjs/fake-timers": "9.1.2",
59
+ "@types/jest": "27.4.1",
60
+ "@types/json-stringify-safe": "5.0.0",
61
+ "@types/lodash": "4.14.181",
62
+ "@types/lodash.clonedeep": "4.5.6",
63
+ "@types/node": "17.0.24",
64
+ "@types/qs": "6.9.7",
65
+ "@types/sinonjs__fake-timers": "8.1.2",
66
+ "@types/traverse": "0.6.32",
67
+ "@typescript-eslint/eslint-plugin": "5.19.0",
68
+ "@typescript-eslint/parser": "5.19.0",
69
+ "codecov": "3.8.3",
70
+ "commitizen": "4.2.4",
71
+ "cz-conventional-changelog": "3.3.0",
72
+ "eslint": "8.13.0",
73
+ "eslint-config-prettier": "8.5.0",
74
+ "husky": "7.0.4",
75
+ "jest": "27.5.1",
76
+ "jest-matcher-specific-error": "1.0.0",
77
+ "jest-mock": "27.5.1",
78
+ "nock": "13.2.4",
79
+ "prettier": "2.6.2",
80
+ "rimraf": "3.0.2",
81
+ "semantic-release": "19.0.2",
82
+ "ts-jest": "27.1.4",
83
+ "ts-node": "10.7.0",
84
+ "typedoc": "0.22.15",
85
+ "typescript": "~4.6.3",
86
+ "webpack": "5.72.0",
87
+ "webpack-cli": "4.9.2"
89
88
  },
90
89
  "dependencies": {
91
- "axios": "^0.26.1",
92
- "json-stringify-safe": "^5.0.1",
93
- "lodash.clonedeep": "^4.5.0",
94
- "qs": "^6.10.3",
95
- "traverse": "^0.6.6"
90
+ "axios": "0.26.1",
91
+ "json-stringify-safe": "5.0.1",
92
+ "lodash.clonedeep": "4.5.0",
93
+ "qs": "6.10.3",
94
+ "traverse": "0.6.6"
96
95
  },
97
96
  "config": {
98
97
  "commitizen": {