@commercelayer/sdk 6.3.0 → 6.5.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/README.md CHANGED
@@ -20,9 +20,12 @@ A JavaScript Library wrapper that makes it quick and easy to interact with the [
20
20
  - [Installation](#installation)
21
21
  - [Authentication](#authentication)
22
22
  - [Import](#import)
23
+ - [Options](#options)
23
24
  - [SDK usage](#sdk-usage)
24
25
  - [Overriding credentials](#overriding-credentials)
25
26
  - [Handling validation errors](#handling-validation-errors)
27
+ - [Using interceptors](#using-interceptors)
28
+ - [Refreshing access token](#refreshing-access-token)
26
29
  - [Contributors guide](#contributors-guide)
27
30
  - [Need help?](#need-help)
28
31
  - [License](#license)
@@ -66,6 +69,37 @@ const cl = CommerceLayer({
66
69
  })
67
70
  ```
68
71
 
72
+ ### Options
73
+
74
+ When instantiating a new SDK client you can pass some options to initialize it:
75
+
76
+ ```javascript
77
+ {
78
+ organization: string // The organization slug
79
+ accessToken: string // A valid API access token
80
+ timeout?: number // A custom request timout (<= 15 secs [default])
81
+ headers?: RequestHeaders // Custom request headers
82
+ userAgent?: string // Custom user-agent useful in certaing contexts but often not allowed by browsers
83
+ fetch?: Fetch // A specific fetch implementation
84
+ refreshToken?: RefreshToken // A function responsible for token refresh
85
+ }
86
+ ```
87
+
88
+ Same options can be changed after SDK initialization or passed at runtime while executing an API call:
89
+
90
+ ```javascript
91
+ const options = { ... }
92
+
93
+ // Instantiate the client using desired options
94
+ const cl = CommerceLayer(options)
95
+
96
+ // Change configuration after client cteation
97
+ cl.config(options)
98
+
99
+ // Use runtime configuration without persisting settings
100
+ cl.customers.list({}, options)
101
+ ```
102
+
69
103
  ## SDK usage
70
104
 
71
105
  The JavaScript SDK is a wrapper around Commerce Layer API which means you would still be making API requests but with a different syntax. For now, we don't have comprehensive SDK documentation for every single resource our API supports (about 400+ endpoints), hence you will need to rely on our comprehensive [API Reference](https://docs.commercelayer.io/core/v/api-reference) as you go about using this SDK. So for example, if you want to create an order, take a look at the [Order object](https://docs.commercelayer.io/core/v/api-reference/orders/object) or the [Create an order](https://docs.commercelayer.io/core/v/api-reference/orders/create) documentation to see the required attributes and/or relationships. The same goes for every other supported resource.
@@ -388,6 +422,76 @@ Commerce Layer API returns specific errors (with extra information) on each attr
388
422
 
389
423
  ℹ️ Check our API reference for more information about the [errors](https://docs.commercelayer.io/developers/handling-errors) returned by the API.
390
424
 
425
+ ## Using interceptors
426
+
427
+ You can use interceptors to intercept SDK messages and modify them on the fly before the request is sent to the API or before the response is parsed and returned by the client. You can also access the error object before it is thrown by the SDK.
428
+
429
+ Interceptors are special functions that are able to handle SDK messages and return a (eventually) modified version of them for use by the client.
430
+
431
+ ```javascript
432
+ const requestInterceptor = (request: RequestObj): RequestObj => {
433
+ console.log(request)
434
+ return request
435
+ }
436
+
437
+ const responseInterceptor = (response: ResponseObj): ResponseObj => {
438
+ console.log(response)
439
+ return response
440
+ }
441
+
442
+ const errorInterceptor = (error: ErrorObj): ErrorObj => {
443
+ console.log(error)
444
+ return error
445
+ }
446
+ ```
447
+
448
+ Here an example of how to use them:
449
+
450
+ ```javascript
451
+ // Add the interceptors (only one or all if needed)
452
+ cl.addRequestInterceptor(requestInterceptor)
453
+ cl.addResponseInterceptor(responseInterceptor, errorInterceptor)
454
+
455
+ const customers = await cl.customers.list()
456
+
457
+ // Remove interceptors
458
+ // Tt is possible to remove only a specific interceptor: cl.removeInterceptor('request')
459
+ cl.removeInterceptors()
460
+ ```
461
+
462
+ #### Raw Response Reader
463
+
464
+ The *RawResponseReader* is a special interceptor that allows to catch the original message coming frome the API before it is parsed and translated in SDK objects.
465
+
466
+ ```javascript
467
+ // Add a RawResponseReader capable of capturing also response headers
468
+ const rrr = cl.addRawResponseReader({ headers: true })
469
+
470
+ const customers = await cl.customers.list()
471
+
472
+ cl.removeRawResponseReader()
473
+
474
+ console.log(rrr.rawResponse)
475
+ console.log(rrr.headers)
476
+ ```
477
+
478
+ ## Refreshing access token
479
+
480
+ It is possible that you are using an access token that is about to expire especially if it has been used for many API calls.
481
+ In this case you can define a special function that takes care of refreshing the token when a call fails because it has expired.
482
+
483
+ ```javascript
484
+ async function myRefreshTokenFunction(espiredToken: string): Promise<string> {
485
+ // Get a new access token using for example our js-auth library
486
+ return (await getAccessToken()).accessToken
487
+ }
488
+
489
+ cl.config({ refreshToken: myRefreshTokenFunction })
490
+
491
+ // If needed you can later retrieve the new access token
492
+ const newToken = cl.currentAccessToken
493
+ ```
494
+
391
495
  ## Contributors guide
392
496
 
393
497
  1. Fork [this repository](https://github.com/commercelayer/commercelayer-sdk) (learn how to do this [here](https://help.github.com/articles/fork-a-repo)).
package/lib/index.d.mts CHANGED
@@ -47,12 +47,14 @@ type RawResponseReader = {
47
47
 
48
48
  type RequestParams = Record<string, string | number | boolean>;
49
49
  type RequestHeaders = Record<string, string>;
50
+ type RefreshToken = (expiredToken: string) => Promise<string>;
50
51
  type RequestConfig = {
51
52
  timeout?: number;
52
53
  params?: RequestParams;
53
54
  headers?: RequestHeaders;
54
55
  userAgent?: string;
55
56
  fetch?: Fetch;
57
+ refreshToken?: RefreshToken;
56
58
  };
57
59
  type ApiConfig = {
58
60
  organization: string;
@@ -72,6 +74,7 @@ declare class ApiClient {
72
74
  userAgent(userAgent: string): this;
73
75
  request(method: Method, path: string, body?: any, options?: ApiClientConfig): Promise<FetchResponse>;
74
76
  private customHeaders;
77
+ get currentAccessToken(): string;
75
78
  }
76
79
 
77
80
  type CreateArrayWithLengthX<LENGTH extends number, ACC extends unknown[] = []> = ACC['length'] extends LENGTH ? ACC : CreateArrayWithLengthX<LENGTH, [...ACC, 1]>;
@@ -4946,6 +4949,11 @@ interface GiftCard extends Resource {
4946
4949
  * @example ```"[object Object],[object Object]"```
4947
4950
  */
4948
4951
  balance_log: Array<Record<string, any>>;
4952
+ /**
4953
+ * The gift card usage log. Tracks all the gift card usage actions by orders..
4954
+ * @example ```"[object Object]"```
4955
+ */
4956
+ usage_log: Record<string, any>;
4949
4957
  /**
4950
4958
  * Indicates if the gift card can be used only one..
4951
4959
  */
@@ -8482,6 +8490,11 @@ interface OrderUpdate extends ResourceUpdate {
8482
8490
  * @example ```"true"```
8483
8491
  */
8484
8492
  _refund?: boolean | null;
8493
+ /**
8494
+ * Send this attribute if you want to mark as fulfilled a shipped/delivered order..
8495
+ * @example ```"true"```
8496
+ */
8497
+ _fulfill?: boolean | null;
8485
8498
  /**
8486
8499
  * Send this attribute if you want to force tax calculation for this order (a tax calculator must be associated to the order's market)..
8487
8500
  * @example ```"true"```
@@ -8626,6 +8639,7 @@ declare class Orders extends ApiResource<Order> {
8626
8639
  _authorization_amount_cents(id: string | Order, triggerValue: number, params?: QueryParamsRetrieve<Order>, options?: ResourcesConfig): Promise<Order>;
8627
8640
  _capture(id: string | Order, params?: QueryParamsRetrieve<Order>, options?: ResourcesConfig): Promise<Order>;
8628
8641
  _refund(id: string | Order, params?: QueryParamsRetrieve<Order>, options?: ResourcesConfig): Promise<Order>;
8642
+ _fulfill(id: string | Order, params?: QueryParamsRetrieve<Order>, options?: ResourcesConfig): Promise<Order>;
8629
8643
  _update_taxes(id: string | Order, params?: QueryParamsRetrieve<Order>, options?: ResourcesConfig): Promise<Order>;
8630
8644
  _nullify_payment_source(id: string | Order, params?: QueryParamsRetrieve<Order>, options?: ResourcesConfig): Promise<Order>;
8631
8645
  _billing_address_clone_id(id: string | Order, triggerValue: string, params?: QueryParamsRetrieve<Order>, options?: ResourcesConfig): Promise<Order>;
@@ -9944,15 +9958,15 @@ type ShipmentSort = Pick<Shipment, 'id' | 'number' | 'status' | 'cost_amount_cen
9944
9958
  interface Shipment extends Resource {
9945
9959
  readonly type: ShipmentType;
9946
9960
  /**
9947
- * Unique identifier for the shipment.
9961
+ * Unique identifier for the shipment..
9948
9962
  * @example ```"#1234/S/001"```
9949
9963
  */
9950
- number?: string | null;
9964
+ number: string;
9951
9965
  /**
9952
- * The shipment status, one of 'draft', 'upcoming', 'cancelled', 'on_hold', 'picking', 'packing', 'ready_to_ship', or 'shipped'..
9966
+ * The shipment status, one of 'draft', 'upcoming', 'cancelled', 'on_hold', 'picking', 'packing', 'ready_to_ship', 'shipped', or 'delivered'..
9953
9967
  * @example ```"draft"```
9954
9968
  */
9955
- status: 'draft' | 'upcoming' | 'cancelled' | 'on_hold' | 'picking' | 'packing' | 'ready_to_ship' | 'shipped';
9969
+ status: 'draft' | 'upcoming' | 'cancelled' | 'on_hold' | 'picking' | 'packing' | 'ready_to_ship' | 'shipped' | 'delivered';
9956
9970
  /**
9957
9971
  * The international 3-letter currency code as defined by the ISO 4217 standard, automatically inherited from the associated order..
9958
9972
  * @example ```"EUR"```
@@ -10081,6 +10095,11 @@ interface ShipmentCreate extends ResourceCreate {
10081
10095
  tags?: TagRel$3[] | null;
10082
10096
  }
10083
10097
  interface ShipmentUpdate extends ResourceUpdate {
10098
+ /**
10099
+ * Unique identifier for the shipment..
10100
+ * @example ```"#1234/S/001"```
10101
+ */
10102
+ number?: string | null;
10084
10103
  /**
10085
10104
  * Send this attribute if you want to mark this shipment as upcoming..
10086
10105
  * @example ```"true"```
@@ -10111,6 +10130,11 @@ interface ShipmentUpdate extends ResourceUpdate {
10111
10130
  * @example ```"true"```
10112
10131
  */
10113
10132
  _ship?: boolean | null;
10133
+ /**
10134
+ * Send this attribute if you want to mark this shipment as delivered..
10135
+ * @example ```"true"```
10136
+ */
10137
+ _deliver?: boolean | null;
10114
10138
  /**
10115
10139
  * Send this attribute if you want to automatically reserve the stock for each of the associated stock line item. Can be done only when fulfillment is in progress..
10116
10140
  * @example ```"true"```
@@ -10176,6 +10200,7 @@ declare class Shipments extends ApiResource<Shipment> {
10176
10200
  _packing(id: string | Shipment, params?: QueryParamsRetrieve<Shipment>, options?: ResourcesConfig): Promise<Shipment>;
10177
10201
  _ready_to_ship(id: string | Shipment, params?: QueryParamsRetrieve<Shipment>, options?: ResourcesConfig): Promise<Shipment>;
10178
10202
  _ship(id: string | Shipment, params?: QueryParamsRetrieve<Shipment>, options?: ResourcesConfig): Promise<Shipment>;
10203
+ _deliver(id: string | Shipment, params?: QueryParamsRetrieve<Shipment>, options?: ResourcesConfig): Promise<Shipment>;
10179
10204
  _reserve_stock(id: string | Shipment, params?: QueryParamsRetrieve<Shipment>, options?: ResourcesConfig): Promise<Shipment>;
10180
10205
  _release_stock(id: string | Shipment, params?: QueryParamsRetrieve<Shipment>, options?: ResourcesConfig): Promise<Shipment>;
10181
10206
  _decrement_stock(id: string | Shipment, params?: QueryParamsRetrieve<Shipment>, options?: ResourcesConfig): Promise<Shipment>;
@@ -14982,7 +15007,8 @@ declare enum ErrorType {
14982
15007
  RESPONSE = "response",// Error response from API
14983
15008
  CANCEL = "cancel",// Forced request abort using interceptor
14984
15009
  PARSE = "parse",// Error parsing API resource
14985
- TIMEOUT = "timeout"
15010
+ TIMEOUT = "timeout",// Timeout error
15011
+ TOKEN_REFRESH = "token-refresh"
14986
15012
  }
14987
15013
  declare class SdkError extends Error {
14988
15014
  static NAME: string;
@@ -15010,7 +15036,7 @@ type CommerceLayerInitConfig = SdkConfig & ResourcesInitConfig;
15010
15036
  type CommerceLayerConfig = Partial<CommerceLayerInitConfig>;
15011
15037
  declare class CommerceLayerClient {
15012
15038
  #private;
15013
- readonly openApiSchemaVersion = "5.3.2";
15039
+ readonly openApiSchemaVersion = "5.3.3";
15014
15040
  constructor(config: CommerceLayerInitConfig);
15015
15041
  get addresses(): Addresses;
15016
15042
  get adjustments(): Adjustments;
@@ -15135,6 +15161,7 @@ declare class CommerceLayerClient {
15135
15161
  get webhooks(): Webhooks;
15136
15162
  get wire_transfers(): WireTransfers;
15137
15163
  get currentOrganization(): string;
15164
+ get currentAccessToken(): string;
15138
15165
  private get interceptors();
15139
15166
  private localConfig;
15140
15167
  config(config: CommerceLayerConfig): this;
@@ -15145,6 +15172,7 @@ declare class CommerceLayerClient {
15145
15172
  addRequestInterceptor(onSuccess?: RequestInterceptor, onFailure?: ErrorInterceptor): number;
15146
15173
  addResponseInterceptor(onSuccess?: ResponseInterceptor, onFailure?: ErrorInterceptor): number;
15147
15174
  removeInterceptor(type: InterceptorType, id?: number): void;
15175
+ removeInterceptors(): void;
15148
15176
  addRawResponseReader(options?: {
15149
15177
  headers: boolean;
15150
15178
  }): RawResponseReader;
@@ -15159,6 +15187,7 @@ declare const CommerceLayerStatic: {
15159
15187
  isSdkError: (error: unknown) => error is SdkError;
15160
15188
  isApiError: (error: unknown) => error is ApiError;
15161
15189
  init: (config: CommerceLayerInitConfig) => CommerceLayerClient;
15190
+ isTokenExpired: (token: string) => boolean;
15162
15191
  readonly schemaVersion: string;
15163
15192
  };
15164
15193
 
package/lib/index.d.ts CHANGED
@@ -47,12 +47,14 @@ type RawResponseReader = {
47
47
 
48
48
  type RequestParams = Record<string, string | number | boolean>;
49
49
  type RequestHeaders = Record<string, string>;
50
+ type RefreshToken = (expiredToken: string) => Promise<string>;
50
51
  type RequestConfig = {
51
52
  timeout?: number;
52
53
  params?: RequestParams;
53
54
  headers?: RequestHeaders;
54
55
  userAgent?: string;
55
56
  fetch?: Fetch;
57
+ refreshToken?: RefreshToken;
56
58
  };
57
59
  type ApiConfig = {
58
60
  organization: string;
@@ -72,6 +74,7 @@ declare class ApiClient {
72
74
  userAgent(userAgent: string): this;
73
75
  request(method: Method, path: string, body?: any, options?: ApiClientConfig): Promise<FetchResponse>;
74
76
  private customHeaders;
77
+ get currentAccessToken(): string;
75
78
  }
76
79
 
77
80
  type CreateArrayWithLengthX<LENGTH extends number, ACC extends unknown[] = []> = ACC['length'] extends LENGTH ? ACC : CreateArrayWithLengthX<LENGTH, [...ACC, 1]>;
@@ -4946,6 +4949,11 @@ interface GiftCard extends Resource {
4946
4949
  * @example ```"[object Object],[object Object]"```
4947
4950
  */
4948
4951
  balance_log: Array<Record<string, any>>;
4952
+ /**
4953
+ * The gift card usage log. Tracks all the gift card usage actions by orders..
4954
+ * @example ```"[object Object]"```
4955
+ */
4956
+ usage_log: Record<string, any>;
4949
4957
  /**
4950
4958
  * Indicates if the gift card can be used only one..
4951
4959
  */
@@ -8482,6 +8490,11 @@ interface OrderUpdate extends ResourceUpdate {
8482
8490
  * @example ```"true"```
8483
8491
  */
8484
8492
  _refund?: boolean | null;
8493
+ /**
8494
+ * Send this attribute if you want to mark as fulfilled a shipped/delivered order..
8495
+ * @example ```"true"```
8496
+ */
8497
+ _fulfill?: boolean | null;
8485
8498
  /**
8486
8499
  * Send this attribute if you want to force tax calculation for this order (a tax calculator must be associated to the order's market)..
8487
8500
  * @example ```"true"```
@@ -8626,6 +8639,7 @@ declare class Orders extends ApiResource<Order> {
8626
8639
  _authorization_amount_cents(id: string | Order, triggerValue: number, params?: QueryParamsRetrieve<Order>, options?: ResourcesConfig): Promise<Order>;
8627
8640
  _capture(id: string | Order, params?: QueryParamsRetrieve<Order>, options?: ResourcesConfig): Promise<Order>;
8628
8641
  _refund(id: string | Order, params?: QueryParamsRetrieve<Order>, options?: ResourcesConfig): Promise<Order>;
8642
+ _fulfill(id: string | Order, params?: QueryParamsRetrieve<Order>, options?: ResourcesConfig): Promise<Order>;
8629
8643
  _update_taxes(id: string | Order, params?: QueryParamsRetrieve<Order>, options?: ResourcesConfig): Promise<Order>;
8630
8644
  _nullify_payment_source(id: string | Order, params?: QueryParamsRetrieve<Order>, options?: ResourcesConfig): Promise<Order>;
8631
8645
  _billing_address_clone_id(id: string | Order, triggerValue: string, params?: QueryParamsRetrieve<Order>, options?: ResourcesConfig): Promise<Order>;
@@ -9944,15 +9958,15 @@ type ShipmentSort = Pick<Shipment, 'id' | 'number' | 'status' | 'cost_amount_cen
9944
9958
  interface Shipment extends Resource {
9945
9959
  readonly type: ShipmentType;
9946
9960
  /**
9947
- * Unique identifier for the shipment.
9961
+ * Unique identifier for the shipment..
9948
9962
  * @example ```"#1234/S/001"```
9949
9963
  */
9950
- number?: string | null;
9964
+ number: string;
9951
9965
  /**
9952
- * The shipment status, one of 'draft', 'upcoming', 'cancelled', 'on_hold', 'picking', 'packing', 'ready_to_ship', or 'shipped'..
9966
+ * The shipment status, one of 'draft', 'upcoming', 'cancelled', 'on_hold', 'picking', 'packing', 'ready_to_ship', 'shipped', or 'delivered'..
9953
9967
  * @example ```"draft"```
9954
9968
  */
9955
- status: 'draft' | 'upcoming' | 'cancelled' | 'on_hold' | 'picking' | 'packing' | 'ready_to_ship' | 'shipped';
9969
+ status: 'draft' | 'upcoming' | 'cancelled' | 'on_hold' | 'picking' | 'packing' | 'ready_to_ship' | 'shipped' | 'delivered';
9956
9970
  /**
9957
9971
  * The international 3-letter currency code as defined by the ISO 4217 standard, automatically inherited from the associated order..
9958
9972
  * @example ```"EUR"```
@@ -10081,6 +10095,11 @@ interface ShipmentCreate extends ResourceCreate {
10081
10095
  tags?: TagRel$3[] | null;
10082
10096
  }
10083
10097
  interface ShipmentUpdate extends ResourceUpdate {
10098
+ /**
10099
+ * Unique identifier for the shipment..
10100
+ * @example ```"#1234/S/001"```
10101
+ */
10102
+ number?: string | null;
10084
10103
  /**
10085
10104
  * Send this attribute if you want to mark this shipment as upcoming..
10086
10105
  * @example ```"true"```
@@ -10111,6 +10130,11 @@ interface ShipmentUpdate extends ResourceUpdate {
10111
10130
  * @example ```"true"```
10112
10131
  */
10113
10132
  _ship?: boolean | null;
10133
+ /**
10134
+ * Send this attribute if you want to mark this shipment as delivered..
10135
+ * @example ```"true"```
10136
+ */
10137
+ _deliver?: boolean | null;
10114
10138
  /**
10115
10139
  * Send this attribute if you want to automatically reserve the stock for each of the associated stock line item. Can be done only when fulfillment is in progress..
10116
10140
  * @example ```"true"```
@@ -10176,6 +10200,7 @@ declare class Shipments extends ApiResource<Shipment> {
10176
10200
  _packing(id: string | Shipment, params?: QueryParamsRetrieve<Shipment>, options?: ResourcesConfig): Promise<Shipment>;
10177
10201
  _ready_to_ship(id: string | Shipment, params?: QueryParamsRetrieve<Shipment>, options?: ResourcesConfig): Promise<Shipment>;
10178
10202
  _ship(id: string | Shipment, params?: QueryParamsRetrieve<Shipment>, options?: ResourcesConfig): Promise<Shipment>;
10203
+ _deliver(id: string | Shipment, params?: QueryParamsRetrieve<Shipment>, options?: ResourcesConfig): Promise<Shipment>;
10179
10204
  _reserve_stock(id: string | Shipment, params?: QueryParamsRetrieve<Shipment>, options?: ResourcesConfig): Promise<Shipment>;
10180
10205
  _release_stock(id: string | Shipment, params?: QueryParamsRetrieve<Shipment>, options?: ResourcesConfig): Promise<Shipment>;
10181
10206
  _decrement_stock(id: string | Shipment, params?: QueryParamsRetrieve<Shipment>, options?: ResourcesConfig): Promise<Shipment>;
@@ -14982,7 +15007,8 @@ declare enum ErrorType {
14982
15007
  RESPONSE = "response",// Error response from API
14983
15008
  CANCEL = "cancel",// Forced request abort using interceptor
14984
15009
  PARSE = "parse",// Error parsing API resource
14985
- TIMEOUT = "timeout"
15010
+ TIMEOUT = "timeout",// Timeout error
15011
+ TOKEN_REFRESH = "token-refresh"
14986
15012
  }
14987
15013
  declare class SdkError extends Error {
14988
15014
  static NAME: string;
@@ -15010,7 +15036,7 @@ type CommerceLayerInitConfig = SdkConfig & ResourcesInitConfig;
15010
15036
  type CommerceLayerConfig = Partial<CommerceLayerInitConfig>;
15011
15037
  declare class CommerceLayerClient {
15012
15038
  #private;
15013
- readonly openApiSchemaVersion = "5.3.2";
15039
+ readonly openApiSchemaVersion = "5.3.3";
15014
15040
  constructor(config: CommerceLayerInitConfig);
15015
15041
  get addresses(): Addresses;
15016
15042
  get adjustments(): Adjustments;
@@ -15135,6 +15161,7 @@ declare class CommerceLayerClient {
15135
15161
  get webhooks(): Webhooks;
15136
15162
  get wire_transfers(): WireTransfers;
15137
15163
  get currentOrganization(): string;
15164
+ get currentAccessToken(): string;
15138
15165
  private get interceptors();
15139
15166
  private localConfig;
15140
15167
  config(config: CommerceLayerConfig): this;
@@ -15145,6 +15172,7 @@ declare class CommerceLayerClient {
15145
15172
  addRequestInterceptor(onSuccess?: RequestInterceptor, onFailure?: ErrorInterceptor): number;
15146
15173
  addResponseInterceptor(onSuccess?: ResponseInterceptor, onFailure?: ErrorInterceptor): number;
15147
15174
  removeInterceptor(type: InterceptorType, id?: number): void;
15175
+ removeInterceptors(): void;
15148
15176
  addRawResponseReader(options?: {
15149
15177
  headers: boolean;
15150
15178
  }): RawResponseReader;
@@ -15159,6 +15187,7 @@ declare const CommerceLayerStatic: {
15159
15187
  isSdkError: (error: unknown) => error is SdkError;
15160
15188
  isApiError: (error: unknown) => error is ApiError;
15161
15189
  init: (config: CommerceLayerInitConfig) => CommerceLayerClient;
15190
+ isTokenExpired: (token: string) => boolean;
15162
15191
  readonly schemaVersion: string;
15163
15192
  };
15164
15193