commerce-sdk-isomorphic 5.2.0 → 5.2.1

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,3 +1,4 @@
1
+ /// <reference types="node-fetch" />
1
2
  /*
2
3
  * Copyright (c) 2021, salesforce.com, inc.
3
4
  * All rights reserved.
@@ -97,6 +98,7 @@ interface ClientConfigInit<Params extends BaseUriParameters> {
97
98
  [key: string]: string;
98
99
  }) => Required<FetchOptions>["body"];
99
100
  throwOnBadResponse?: boolean;
101
+ throwOnMaintenanceHeader?: boolean;
100
102
  }
101
103
  /**
102
104
  * Configuration parameters common to Commerce SDK clients
@@ -112,6 +114,7 @@ declare class ClientConfig<Params extends BaseUriParameters> implements ClientCo
112
114
  fetch?: FetchFunction;
113
115
  transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
114
116
  throwOnBadResponse: boolean;
117
+ throwOnMaintenanceHeader: boolean;
115
118
  constructor(config: ClientConfigInit<Params>);
116
119
  static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
117
120
  }
@@ -2943,6 +2946,7 @@ declare namespace ShopperLoginApiTypes {
2943
2946
  [key: string]: string;
2944
2947
  }) => Required<FetchOptions>["body"];
2945
2948
  throwOnBadResponse?: boolean;
2949
+ throwOnMaintenanceHeader?: boolean;
2946
2950
  }
2947
2951
  /**
2948
2952
  * Configuration parameters common to Commerce SDK clients
@@ -2958,6 +2962,7 @@ declare namespace ShopperLoginApiTypes {
2958
2962
  fetch?: FetchFunction;
2959
2963
  transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
2960
2964
  throwOnBadResponse: boolean;
2965
+ throwOnMaintenanceHeader: boolean;
2961
2966
  constructor(config: ClientConfigInit<Params>);
2962
2967
  static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
2963
2968
  }
@@ -10795,6 +10800,7 @@ declare namespace ShopperBasketsApiTypes {
10795
10800
  [key: string]: string;
10796
10801
  }) => Required<FetchOptions>["body"];
10797
10802
  throwOnBadResponse?: boolean;
10803
+ throwOnMaintenanceHeader?: boolean;
10798
10804
  }
10799
10805
  /**
10800
10806
  * Configuration parameters common to Commerce SDK clients
@@ -10810,6 +10816,7 @@ declare namespace ShopperBasketsApiTypes {
10810
10816
  fetch?: FetchFunction;
10811
10817
  transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
10812
10818
  throwOnBadResponse: boolean;
10819
+ throwOnMaintenanceHeader: boolean;
10813
10820
  constructor(config: ClientConfigInit<Params>);
10814
10821
  static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
10815
10822
  }
@@ -21402,6 +21409,7 @@ declare namespace ShopperBasketsV2ApiTypes {
21402
21409
  [key: string]: string;
21403
21410
  }) => Required<FetchOptions>["body"];
21404
21411
  throwOnBadResponse?: boolean;
21412
+ throwOnMaintenanceHeader?: boolean;
21405
21413
  }
21406
21414
  /**
21407
21415
  * Configuration parameters common to Commerce SDK clients
@@ -21417,6 +21425,7 @@ declare namespace ShopperBasketsV2ApiTypes {
21417
21425
  fetch?: FetchFunction;
21418
21426
  transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
21419
21427
  throwOnBadResponse: boolean;
21428
+ throwOnMaintenanceHeader: boolean;
21420
21429
  constructor(config: ClientConfigInit<Params>);
21421
21430
  static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
21422
21431
  }
@@ -28044,6 +28053,7 @@ declare namespace ShopperConfigurationsApiTypes {
28044
28053
  [key: string]: string;
28045
28054
  }) => Required<FetchOptions>["body"];
28046
28055
  throwOnBadResponse?: boolean;
28056
+ throwOnMaintenanceHeader?: boolean;
28047
28057
  }
28048
28058
  /**
28049
28059
  * Configuration parameters common to Commerce SDK clients
@@ -28059,6 +28069,7 @@ declare namespace ShopperConfigurationsApiTypes {
28059
28069
  fetch?: FetchFunction;
28060
28070
  transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
28061
28071
  throwOnBadResponse: boolean;
28072
+ throwOnMaintenanceHeader: boolean;
28062
28073
  constructor(config: ClientConfigInit<Params>);
28063
28074
  static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
28064
28075
  }
@@ -29039,6 +29050,7 @@ declare namespace ShopperConsentsApiTypes {
29039
29050
  [key: string]: string;
29040
29051
  }) => Required<FetchOptions>["body"];
29041
29052
  throwOnBadResponse?: boolean;
29053
+ throwOnMaintenanceHeader?: boolean;
29042
29054
  }
29043
29055
  /**
29044
29056
  * Configuration parameters common to Commerce SDK clients
@@ -29054,6 +29066,7 @@ declare namespace ShopperConsentsApiTypes {
29054
29066
  fetch?: FetchFunction;
29055
29067
  transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
29056
29068
  throwOnBadResponse: boolean;
29069
+ throwOnMaintenanceHeader: boolean;
29057
29070
  constructor(config: ClientConfigInit<Params>);
29058
29071
  static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
29059
29072
  }
@@ -30549,6 +30562,7 @@ declare namespace ShopperContextsApiTypes {
30549
30562
  [key: string]: string;
30550
30563
  }) => Required<FetchOptions>["body"];
30551
30564
  throwOnBadResponse?: boolean;
30565
+ throwOnMaintenanceHeader?: boolean;
30552
30566
  }
30553
30567
  /**
30554
30568
  * Configuration parameters common to Commerce SDK clients
@@ -30564,6 +30578,7 @@ declare namespace ShopperContextsApiTypes {
30564
30578
  fetch?: FetchFunction;
30565
30579
  transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
30566
30580
  throwOnBadResponse: boolean;
30581
+ throwOnMaintenanceHeader: boolean;
30567
30582
  constructor(config: ClientConfigInit<Params>);
30568
30583
  static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
30569
30584
  }
@@ -36732,6 +36747,7 @@ declare namespace ShopperCustomersApiTypes {
36732
36747
  [key: string]: string;
36733
36748
  }) => Required<FetchOptions>["body"];
36734
36749
  throwOnBadResponse?: boolean;
36750
+ throwOnMaintenanceHeader?: boolean;
36735
36751
  }
36736
36752
  /**
36737
36753
  * Configuration parameters common to Commerce SDK clients
@@ -36747,6 +36763,7 @@ declare namespace ShopperCustomersApiTypes {
36747
36763
  fetch?: FetchFunction;
36748
36764
  transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
36749
36765
  throwOnBadResponse: boolean;
36766
+ throwOnMaintenanceHeader: boolean;
36750
36767
  constructor(config: ClientConfigInit<Params>);
36751
36768
  static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
36752
36769
  }
@@ -46653,6 +46670,7 @@ declare namespace ShopperExperienceApiTypes {
46653
46670
  [key: string]: string;
46654
46671
  }) => Required<FetchOptions>["body"];
46655
46672
  throwOnBadResponse?: boolean;
46673
+ throwOnMaintenanceHeader?: boolean;
46656
46674
  }
46657
46675
  /**
46658
46676
  * Configuration parameters common to Commerce SDK clients
@@ -46668,6 +46686,7 @@ declare namespace ShopperExperienceApiTypes {
46668
46686
  fetch?: FetchFunction;
46669
46687
  transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
46670
46688
  throwOnBadResponse: boolean;
46689
+ throwOnMaintenanceHeader: boolean;
46671
46690
  constructor(config: ClientConfigInit<Params>);
46672
46691
  static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
46673
46692
  }
@@ -48747,6 +48766,7 @@ declare namespace ShopperGiftCertificatesApiTypes {
48747
48766
  [key: string]: string;
48748
48767
  }) => Required<FetchOptions>["body"];
48749
48768
  throwOnBadResponse?: boolean;
48769
+ throwOnMaintenanceHeader?: boolean;
48750
48770
  }
48751
48771
  /**
48752
48772
  * Configuration parameters common to Commerce SDK clients
@@ -48762,6 +48782,7 @@ declare namespace ShopperGiftCertificatesApiTypes {
48762
48782
  fetch?: FetchFunction;
48763
48783
  transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
48764
48784
  throwOnBadResponse: boolean;
48785
+ throwOnMaintenanceHeader: boolean;
48765
48786
  constructor(config: ClientConfigInit<Params>);
48766
48787
  static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
48767
48788
  }
@@ -51602,6 +51623,7 @@ declare namespace ShopperOrdersApiTypes {
51602
51623
  [key: string]: string;
51603
51624
  }) => Required<FetchOptions>["body"];
51604
51625
  throwOnBadResponse?: boolean;
51626
+ throwOnMaintenanceHeader?: boolean;
51605
51627
  }
51606
51628
  /**
51607
51629
  * Configuration parameters common to Commerce SDK clients
@@ -51617,6 +51639,7 @@ declare namespace ShopperOrdersApiTypes {
51617
51639
  fetch?: FetchFunction;
51618
51640
  transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
51619
51641
  throwOnBadResponse: boolean;
51642
+ throwOnMaintenanceHeader: boolean;
51620
51643
  constructor(config: ClientConfigInit<Params>);
51621
51644
  static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
51622
51645
  }
@@ -56178,6 +56201,7 @@ declare namespace ShopperPaymentsApiTypes {
56178
56201
  [key: string]: string;
56179
56202
  }) => Required<FetchOptions>["body"];
56180
56203
  throwOnBadResponse?: boolean;
56204
+ throwOnMaintenanceHeader?: boolean;
56181
56205
  }
56182
56206
  /**
56183
56207
  * Configuration parameters common to Commerce SDK clients
@@ -56193,6 +56217,7 @@ declare namespace ShopperPaymentsApiTypes {
56193
56217
  fetch?: FetchFunction;
56194
56218
  transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
56195
56219
  throwOnBadResponse: boolean;
56220
+ throwOnMaintenanceHeader: boolean;
56196
56221
  constructor(config: ClientConfigInit<Params>);
56197
56222
  static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
56198
56223
  }
@@ -57944,6 +57969,7 @@ declare namespace ShopperProductsApiTypes {
57944
57969
  [key: string]: string;
57945
57970
  }) => Required<FetchOptions>["body"];
57946
57971
  throwOnBadResponse?: boolean;
57972
+ throwOnMaintenanceHeader?: boolean;
57947
57973
  }
57948
57974
  /**
57949
57975
  * Configuration parameters common to Commerce SDK clients
@@ -57959,6 +57985,7 @@ declare namespace ShopperProductsApiTypes {
57959
57985
  fetch?: FetchFunction;
57960
57986
  transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
57961
57987
  throwOnBadResponse: boolean;
57988
+ throwOnMaintenanceHeader: boolean;
57962
57989
  constructor(config: ClientConfigInit<Params>);
57963
57990
  static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
57964
57991
  }
@@ -60434,6 +60461,7 @@ declare namespace ShopperPromotionsApiTypes {
60434
60461
  [key: string]: string;
60435
60462
  }) => Required<FetchOptions>["body"];
60436
60463
  throwOnBadResponse?: boolean;
60464
+ throwOnMaintenanceHeader?: boolean;
60437
60465
  }
60438
60466
  /**
60439
60467
  * Configuration parameters common to Commerce SDK clients
@@ -60449,6 +60477,7 @@ declare namespace ShopperPromotionsApiTypes {
60449
60477
  fetch?: FetchFunction;
60450
60478
  transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
60451
60479
  throwOnBadResponse: boolean;
60480
+ throwOnMaintenanceHeader: boolean;
60452
60481
  constructor(config: ClientConfigInit<Params>);
60453
60482
  static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
60454
60483
  }
@@ -62156,6 +62185,7 @@ declare namespace ShopperSearchApiTypes {
62156
62185
  [key: string]: string;
62157
62186
  }) => Required<FetchOptions>["body"];
62158
62187
  throwOnBadResponse?: boolean;
62188
+ throwOnMaintenanceHeader?: boolean;
62159
62189
  }
62160
62190
  /**
62161
62191
  * Configuration parameters common to Commerce SDK clients
@@ -62171,6 +62201,7 @@ declare namespace ShopperSearchApiTypes {
62171
62201
  fetch?: FetchFunction;
62172
62202
  transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
62173
62203
  throwOnBadResponse: boolean;
62204
+ throwOnMaintenanceHeader: boolean;
62174
62205
  constructor(config: ClientConfigInit<Params>);
62175
62206
  static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
62176
62207
  }
@@ -64511,6 +64542,7 @@ declare namespace ShopperSEOApiTypes {
64511
64542
  [key: string]: string;
64512
64543
  }) => Required<FetchOptions>["body"];
64513
64544
  throwOnBadResponse?: boolean;
64545
+ throwOnMaintenanceHeader?: boolean;
64514
64546
  }
64515
64547
  /**
64516
64548
  * Configuration parameters common to Commerce SDK clients
@@ -64526,6 +64558,7 @@ declare namespace ShopperSEOApiTypes {
64526
64558
  fetch?: FetchFunction;
64527
64559
  transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
64528
64560
  throwOnBadResponse: boolean;
64561
+ throwOnMaintenanceHeader: boolean;
64529
64562
  constructor(config: ClientConfigInit<Params>);
64530
64563
  static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
64531
64564
  }
@@ -65355,6 +65388,7 @@ declare namespace ShopperStoresApiTypes {
65355
65388
  [key: string]: string;
65356
65389
  }) => Required<FetchOptions>["body"];
65357
65390
  throwOnBadResponse?: boolean;
65391
+ throwOnMaintenanceHeader?: boolean;
65358
65392
  }
65359
65393
  /**
65360
65394
  * Configuration parameters common to Commerce SDK clients
@@ -65370,6 +65404,7 @@ declare namespace ShopperStoresApiTypes {
65370
65404
  fetch?: FetchFunction;
65371
65405
  transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
65372
65406
  throwOnBadResponse: boolean;
65407
+ throwOnMaintenanceHeader: boolean;
65373
65408
  constructor(config: ClientConfigInit<Params>);
65374
65409
  static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
65375
65410
  }
@@ -66065,6 +66100,33 @@ declare class TemplateURL extends URL {
66065
66100
  */
66066
66101
  static renderTemplateUri(template: string, parameters?: PathParameters): string;
66067
66102
  }
66103
+ /**
66104
+ * Extends the Error class with the the error being a combination of status code
66105
+ * and text retrieved from the response.
66106
+ *
66107
+ * @class ResponseError
66108
+ * @extends Error
66109
+ */
66110
+ declare class ResponseError extends Error {
66111
+ response: Response;
66112
+ constructor(response: Response);
66113
+ }
66114
+ /**
66115
+ * Error thrown when the sfdc_maintenance header is detected in a response
66116
+ * and throwOnMaintenanceHeader is enabled in client configuration.
66117
+ *
66118
+ * @class MaintenanceError
66119
+ * @extends Error
66120
+ */
66121
+ declare class MaintenanceError extends Error {
66122
+ readonly response: Response | import("node-fetch").Response;
66123
+ readonly maintenanceType: "system" | "site";
66124
+ readonly status = 503;
66125
+ constructor(response: Response | import("node-fetch").Response, maintenanceType: "system" | "site");
66126
+ }
66127
+ declare module MaintenanceErrorWrapper {
66128
+ export { MaintenanceError };
66129
+ }
66068
66130
  declare namespace helpers {
66069
66131
  /*
66070
66132
  * Copyright (c) 2023, Salesforce, Inc.
@@ -66161,6 +66223,7 @@ declare namespace helpers {
66161
66223
  [key: string]: string;
66162
66224
  }) => Required<FetchOptions>["body"];
66163
66225
  throwOnBadResponse?: boolean;
66226
+ throwOnMaintenanceHeader?: boolean;
66164
66227
  }
66165
66228
  /**
66166
66229
  * Configuration parameters common to Commerce SDK clients
@@ -66176,6 +66239,7 @@ declare namespace helpers {
66176
66239
  fetch?: FetchFunction;
66177
66240
  transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
66178
66241
  throwOnBadResponse: boolean;
66242
+ throwOnMaintenanceHeader: boolean;
66179
66243
  constructor(config: ClientConfigInit<Params>);
66180
66244
  static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
66181
66245
  }
@@ -69330,6 +69394,26 @@ declare namespace helpers {
69330
69394
  clientConfig: ClientConfigInit<CustomParams>;
69331
69395
  rawResponse?: boolean | undefined;
69332
69396
  }) => Promise<Response | unknown>;
69397
+ /*
69398
+ * Copyright (c) 2025, salesforce.com, inc.
69399
+ * All rights reserved.
69400
+ * SPDX-License-Identifier: BSD-3-Clause
69401
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
69402
+ */
69403
+ /**
69404
+ * Error thrown when the sfdc_maintenance header is detected in a response
69405
+ * and throwOnMaintenanceHeader is enabled in client configuration.
69406
+ *
69407
+ * @class MaintenanceError
69408
+ * @extends Error
69409
+ */
69410
+ class MaintenanceError extends Error {
69411
+ readonly response: Response | import("node-fetch").Response;
69412
+ readonly maintenanceType: "system" | "site";
69413
+ readonly status = 503;
69414
+ constructor(response: Response | import("node-fetch").Response, maintenanceType: "system" | "site");
69415
+ }
69416
+ import __default = MaintenanceErrorWrapper.MaintenanceError;
69333
69417
  /**
69334
69418
  * A wrapper function around fetch designed for making requests using the SDK
69335
69419
  * @param url - The url of the resource that you wish to fetch
@@ -69361,5 +69445,5 @@ declare namespace helpers {
69361
69445
  */
69362
69446
  const encodeSCAPISpecialCharacters: (str: string) => string;
69363
69447
  }
69364
- export { ShopperLogin, ShopperBaskets, ShopperBasketsV2, ShopperConfigurations, ShopperConsents, ShopperContexts, ShopperCustomers, ShopperExperience, ShopperGiftCertificates, ShopperOrders, ShopperPayments, ShopperProducts, ShopperPromotions, ShopperSearch, ShopperSEO, ShopperStores, ClientConfig, TemplateURL, helpers };
69448
+ export { ShopperLogin, ShopperBaskets, ShopperBasketsV2, ShopperConfigurations, ShopperConsents, ShopperContexts, ShopperCustomers, ShopperExperience, ShopperGiftCertificates, ShopperOrders, ShopperPayments, ShopperProducts, ShopperPromotions, ShopperSearch, ShopperSEO, ShopperStores, ClientConfig, TemplateURL, ResponseError, MaintenanceError, helpers };
69365
69449
  export type { ShopperLoginTypes, ShopperBasketsTypes, ShopperBasketsV2Types, ShopperConfigurationsTypes, ShopperConsentsTypes, ShopperContextsTypes, ShopperCustomersTypes, ShopperExperienceTypes, ShopperGiftCertificatesTypes, ShopperOrdersTypes, ShopperPaymentsTypes, ShopperProductsTypes, ShopperPromotionsTypes, ShopperSearchTypes, ShopperSEOTypes, ShopperStoresTypes, ClientConfigInit, FetchFunction, FetchOptions };