commerce-sdk-isomorphic 4.1.0 → 4.2.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.
Files changed (86) hide show
  1. package/README.md +1 -114
  2. package/lib/index.cjs.d.ts +1320 -169
  3. package/lib/index.cjs.js +1 -1
  4. package/lib/index.esm.d.ts +1320 -169
  5. package/lib/index.esm.js +1 -1
  6. package/package.json +24 -91
  7. package/lib/clientConfig.cjs.d.ts +0 -54
  8. package/lib/clientConfig.cjs.js +0 -1
  9. package/lib/clientConfig.d.ts +0 -54
  10. package/lib/clientConfig.js +0 -1
  11. package/lib/config.cjs.d.ts +0 -2
  12. package/lib/config.cjs.js +0 -1
  13. package/lib/config.d.ts +0 -2
  14. package/lib/config.js +0 -1
  15. package/lib/helpers.cjs.d.ts +0 -2225
  16. package/lib/helpers.cjs.js +0 -1
  17. package/lib/helpers.d.ts +0 -2225
  18. package/lib/helpers.js +0 -1
  19. package/lib/responseError.cjs.d.ts +0 -12
  20. package/lib/responseError.cjs.js +0 -1
  21. package/lib/responseError.d.ts +0 -12
  22. package/lib/responseError.js +0 -1
  23. package/lib/shopperBaskets.cjs.d.ts +0 -10264
  24. package/lib/shopperBaskets.cjs.js +0 -1
  25. package/lib/shopperBaskets.d.ts +0 -10264
  26. package/lib/shopperBaskets.js +0 -1
  27. package/lib/shopperBasketsv2.cjs.d.ts +0 -10458
  28. package/lib/shopperBasketsv2.cjs.js +0 -1
  29. package/lib/shopperBasketsv2.d.ts +0 -10458
  30. package/lib/shopperBasketsv2.js +0 -1
  31. package/lib/shopperConsents.cjs.d.ts +0 -1147
  32. package/lib/shopperConsents.cjs.js +0 -1
  33. package/lib/shopperConsents.d.ts +0 -1147
  34. package/lib/shopperConsents.js +0 -1
  35. package/lib/shopperContext.cjs.d.ts +0 -1406
  36. package/lib/shopperContext.cjs.js +0 -1
  37. package/lib/shopperContext.d.ts +0 -1406
  38. package/lib/shopperContext.js +0 -1
  39. package/lib/shopperCustomers.cjs.d.ts +0 -12190
  40. package/lib/shopperCustomers.cjs.js +0 -1
  41. package/lib/shopperCustomers.d.ts +0 -12190
  42. package/lib/shopperCustomers.js +0 -1
  43. package/lib/shopperExperience.cjs.d.ts +0 -1174
  44. package/lib/shopperExperience.cjs.js +0 -1
  45. package/lib/shopperExperience.d.ts +0 -1174
  46. package/lib/shopperExperience.js +0 -1
  47. package/lib/shopperGiftCertificates.cjs.d.ts +0 -734
  48. package/lib/shopperGiftCertificates.cjs.js +0 -1
  49. package/lib/shopperGiftCertificates.d.ts +0 -734
  50. package/lib/shopperGiftCertificates.js +0 -1
  51. package/lib/shopperLogin.cjs.d.ts +0 -3847
  52. package/lib/shopperLogin.cjs.js +0 -1
  53. package/lib/shopperLogin.d.ts +0 -3847
  54. package/lib/shopperLogin.js +0 -1
  55. package/lib/shopperOrders.cjs.d.ts +0 -5398
  56. package/lib/shopperOrders.cjs.js +0 -1
  57. package/lib/shopperOrders.d.ts +0 -5398
  58. package/lib/shopperOrders.js +0 -1
  59. package/lib/shopperProducts.cjs.d.ts +0 -3484
  60. package/lib/shopperProducts.cjs.js +0 -1
  61. package/lib/shopperProducts.d.ts +0 -3484
  62. package/lib/shopperProducts.js +0 -1
  63. package/lib/shopperPromotions.cjs.d.ts +0 -1006
  64. package/lib/shopperPromotions.cjs.js +0 -1
  65. package/lib/shopperPromotions.d.ts +0 -1006
  66. package/lib/shopperPromotions.js +0 -1
  67. package/lib/shopperSearch.cjs.d.ts +0 -3357
  68. package/lib/shopperSearch.cjs.js +0 -1
  69. package/lib/shopperSearch.d.ts +0 -3357
  70. package/lib/shopperSearch.js +0 -1
  71. package/lib/shopperSeo.cjs.d.ts +0 -774
  72. package/lib/shopperSeo.cjs.js +0 -1
  73. package/lib/shopperSeo.d.ts +0 -774
  74. package/lib/shopperSeo.js +0 -1
  75. package/lib/shopperStores.cjs.d.ts +0 -1294
  76. package/lib/shopperStores.cjs.js +0 -1
  77. package/lib/shopperStores.d.ts +0 -1294
  78. package/lib/shopperStores.js +0 -1
  79. package/lib/templateUrl.cjs.d.ts +0 -76
  80. package/lib/templateUrl.cjs.js +0 -1
  81. package/lib/templateUrl.d.ts +0 -76
  82. package/lib/templateUrl.js +0 -1
  83. package/lib/version.cjs.d.ts +0 -3
  84. package/lib/version.cjs.js +0 -1
  85. package/lib/version.d.ts +0 -3
  86. package/lib/version.js +0 -1
@@ -1,1006 +0,0 @@
1
- /*
2
- * Copyright (c) 2021, salesforce.com, inc.
3
- * All rights reserved.
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
- */
7
- import { RequestInit as NodeRequestInit } from "node-fetch";
8
- /*
9
- * Copyright (c) 2025, Salesforce, Inc.
10
- * All rights reserved.
11
- * SPDX-License-Identifier: BSD-3-Clause
12
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
13
- */
14
- declare const defaultBaseUri = "https://{shortCode}.api.commercecloud.salesforce.com/pricing/shopper-promotions/v1";
15
- /**
16
- * Makes a type easier to read.
17
- */
18
- type Prettify<T> = NonNullable<{
19
- [K in keyof T]: T[K];
20
- }>;
21
- /**
22
- * Generates the types required on a method, based on those provided in the config.
23
- */
24
- type CompositeParameters<MethodParameters extends Record<string, unknown>, ConfigParameters extends Record<string, unknown>> = Prettify<Omit<MethodParameters, keyof ConfigParameters> & Partial<MethodParameters>>;
25
- /**
26
- * If an object has a `parameters` property, and the `parameters` object has required properties,
27
- * then the `parameters` property on the root object is marked as required.
28
- */
29
- type RequireParametersUnlessAllAreOptional<T extends {
30
- parameters?: Record<string, unknown>;
31
- }> = Record<string, never> extends NonNullable<T["parameters"]> ? T : Prettify<T & Required<Pick<T, "parameters">>>;
32
- /**
33
- * Template parameters used in the base URI of all API endpoints. `version` will default to `"v1"`
34
- * if not specified.
35
- */
36
- interface BaseUriParameters {
37
- shortCode: string;
38
- }
39
- type LocaleCode = {
40
- [key: string]: any;
41
- };
42
- /**
43
- * Generic interface for path parameters.
44
- */
45
- interface PathParameters {
46
- [key: string]: string | number | boolean;
47
- }
48
- /**
49
- * Generic interface for query parameters.
50
- */
51
- interface QueryParameters {
52
- [key: string]: string | number | boolean | string[] | number[] | LocaleCode;
53
- }
54
- /**
55
- * Alias for `RequestInit` from TypeScript's DOM lib, to more clearly differentiate
56
- * it from the `RequestInit` provided by node-fetch.
57
- */
58
- type BrowserRequestInit = RequestInit;
59
- /**
60
- * Any properties supported in either the browser or node are accepted.
61
- * Using the right properties in the right context is left to the user.
62
- */
63
- type FetchOptions = NodeRequestInit & BrowserRequestInit;
64
- type FetchFunction = (input: RequestInfo, init?: FetchOptions | undefined) => Promise<Response>;
65
- /**
66
- * Base options that can be passed to the `ClientConfig` class.
67
- */
68
- interface ClientConfigInit<Params extends BaseUriParameters> {
69
- baseUri?: string;
70
- proxy?: string;
71
- headers?: {
72
- [key: string]: string;
73
- };
74
- parameters: Params;
75
- fetchOptions?: FetchOptions;
76
- fetch?: FetchFunction;
77
- transformRequest?: (data: unknown, headers: {
78
- [key: string]: string;
79
- }) => Required<FetchOptions>["body"];
80
- throwOnBadResponse?: boolean;
81
- }
82
- /**
83
- * Configuration parameters common to Commerce SDK clients
84
- */
85
- declare class ClientConfig<Params extends BaseUriParameters> implements ClientConfigInit<Params> {
86
- baseUri?: string;
87
- proxy?: string;
88
- headers: {
89
- [key: string]: string;
90
- };
91
- parameters: Params;
92
- fetchOptions: FetchOptions;
93
- fetch?: FetchFunction;
94
- transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
95
- throwOnBadResponse: boolean;
96
- constructor(config: ClientConfigInit<Params>);
97
- static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
98
- }
99
- /**
100
- * A specialized value indicating the system default values for locales.
101
- */
102
- type DefaultFallback = "default";
103
- /**
104
- * @type ErrorResponse:
105
- *
106
- * @property title: A short, human-readable summary of the problem type. It will not change from occurrence to occurrence of the problem, except for purposes of localization
107
- * - **Max Length:** 256
108
- *
109
- * @property type: A URI reference [RFC3986] that identifies the problem type. This specification encourages that, when dereferenced, it provide human-readable documentation for the problem type (e.g., using HTML [W3C.REC-html5-20141028]). When this member is not present, its value is assumed to be \"about:blank\". It accepts relative URIs; this means that they must be resolved relative to the document\'s base URI, as per [RFC3986], Section 5.
110
- * - **Max Length:** 2048
111
- *
112
- * @property detail: A human-readable explanation specific to this occurrence of the problem.
113
- *
114
- * @property instance: A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced. It accepts relative URIs; this means that they must be resolved relative to the document\'s base URI, as per [RFC3986], Section 5.
115
- * - **Max Length:** 2048
116
- *
117
- */
118
- type ErrorResponse = {
119
- title: string;
120
- type: string;
121
- detail: string;
122
- instance?: string;
123
- } & {
124
- [key: string]: any;
125
- };
126
- /**
127
- * @type LocaleCode
128
- * A descriptor for a geographical region by both a language and country code. By combining these two, regional differences in a language can be addressed, such as with the request header parameter `Accept-Language` following [RFC 2616](https://tools.ietf.org/html/rfc2616) & [RFC 1766](https://tools.ietf.org/html/rfc1766). This can also just refer to a language code, also RFC 2616/1766 compliant, as a default if there is no specific match for a country. Finally, can also be used to define default behavior if there is no locale specified.
129
- */
130
- type LocaleCode$0 = DefaultFallback | string;
131
- /**
132
- * @type Promotion: Document representing a promotion.
133
- *
134
- * @property calloutMsg: The localized call-out message of the promotion.
135
- *
136
- * @property currency: The currency that a promotion can be applied to. A null value means that the promotion applies to all allowed currencies.
137
- *
138
- * @property details: The localized detailed description of the promotion.
139
- *
140
- * @property endDate: The end date of the promotion. This property follows the ISO8601 date time format: yyyy-MM-dd\'T\'HH:mmZ . The time zone of the date time is always UTC.
141
- *
142
- * @property id: The unique ID of the promotion.
143
- *
144
- * @property image: The URL to the promotion image.
145
- *
146
- * @property name: The localized name of the promotion.
147
- *
148
- * @property startDate: The start date of the promotion. This property follows the ISO8601 date time format: yyyy-MM-dd\'T\'HH:mmZ. The time zone of the date time is always UTC.
149
- *
150
- */
151
- type Promotion = {
152
- calloutMsg?: string;
153
- currency?: string;
154
- details?: string;
155
- endDate?: string;
156
- id: string;
157
- image?: string;
158
- name?: string;
159
- startDate?: string;
160
- } & {
161
- [key: string]: any;
162
- };
163
- /**
164
- * @type PromotionResult: Result document containing an array of promotions.
165
- *
166
- * @property data: The array of promotion documents.
167
- *
168
- * @property limit: Maximum records to retrieve per request, not to exceed the maximum defined. A limit must be at least 1 so at least one record is returned (if any match the criteria).
169
- *
170
- * @property total: The total number of hits that match the search\'s criteria. This can be greater than the number of results returned as search results are pagenated.
171
- *
172
- */
173
- type PromotionResult = {
174
- data: Array<Promotion>;
175
- limit: number;
176
- total: number;
177
- } & {
178
- [key: string]: any;
179
- };
180
- /**
181
- * @type ResultBase: Schema defining generic list result. Each response schema of a resource requiring a list response should extend this schema. Additionally it needs to be defined what data is returned.
182
- *
183
- * @property limit: Maximum records to retrieve per request, not to exceed the maximum defined. A limit must be at least 1 so at least one record is returned (if any match the criteria).
184
- *
185
- * @property total: The total number of hits that match the search\'s criteria. This can be greater than the number of results returned as search results are pagenated.
186
- *
187
- */
188
- type ResultBase = {
189
- limit: number;
190
- total: number;
191
- } & {
192
- [key: string]: any;
193
- };
194
- type getPromotionsQueryParameters = {
195
- siteId: string;
196
- ids: Array<string>;
197
- locale?: LocaleCode$0;
198
- };
199
- type getPromotionsPathParameters = {
200
- organizationId: string;
201
- };
202
- type getPromotionsForCampaignQueryParameters = {
203
- siteId: string;
204
- startDate?: string;
205
- endDate?: string;
206
- currency?: string;
207
- };
208
- type getPromotionsForCampaignPathParameters = {
209
- campaignId: string;
210
- organizationId: string;
211
- };
212
- /**
213
- * All path parameters that are used by at least one ShopperPromotions method.
214
- */
215
- type ShopperPromotionsPathParameters = Partial<getPromotionsPathParameters & getPromotionsForCampaignPathParameters & {}>;
216
- /**
217
- * All query parameters that are used by at least one ShopperPromotions method.
218
- */
219
- type ShopperPromotionsQueryParameters = Partial<getPromotionsQueryParameters & getPromotionsForCampaignQueryParameters & {}>;
220
- /**
221
- * All parameters that are used by ShopperPromotions.
222
- */
223
- type ShopperPromotionsParameters = ShopperPromotionsPathParameters & BaseUriParameters & ShopperPromotionsQueryParameters;
224
- /**
225
- * [Shopper Promotions](https://developer.salesforce.com/docs/commerce/commerce-api/references?meta=shopper-promotions:Summary)
226
- * ==================================
227
- *
228
- * *# API Overview
229
-
230
- Retrieve information about active promotions within the context of a shopper and a site. You can use this API to retrieve promotions that you configured in the commerce platform by searching for specific promotion IDs or by searching for promotions associated with a campaign.
231
-
232
- Caching is provided for the Shopper Promotions API. For details, see [Server-Side Web-Tier Caching.](https://developer.salesforce.com/docs/commerce/commerce-api/guide/server-side-web-tier-caching.html)
233
-
234
- ## Authentication & Authorization
235
-
236
- The Shopper Promotions API requires a JSON Web Token acquired via the Shopper Customers endpoint:
237
-
238
- ```
239
- https://{{shortcode}}.api.commercecloud.salesforce.com/customer/shopper-customers/v1/organizations/{{organizationId}}/customers/actions/login
240
- ```
241
-
242
- You must include the relevant scope(s) in the client ID used to generate the SLAS token. For details, see [Authorization Scopes Catalog.](https://developer.salesforce.com/docs/commerce/commerce-api/guide/auth-z-scope-catalog.html)
243
-
244
- ## Use Cases
245
-
246
- ### Get Promotion by Promotion ID
247
-
248
- Use the Shopper Promotions API to find promotion information by the promotion ID.
249
-
250
- For example, a customer who is browsing on a commerce shopping app built using Commerce Cloud APIs can see the details about the applied promotions in the cart.
251
-
252
- ### Get Promotion by Campaign ID
253
-
254
- Use the Shopper Promotions API to find promotion information by the campaign ID.
255
-
256
- For example, a customer who is browsing on a commerce shopping app built using Commerce Cloud APIs can see the possible promotions that can be applied in the cart.
257
-
258
- ### Use Hooks
259
-
260
- For details working with hooks, see [Extensibility with Hooks.](https://developer.salesforce.com/docs/commerce/commerce-api/guide/extensibility_via_hooks.html)*<br />
261
- *
262
- * Simple example:
263
- *
264
- * ```typescript
265
- * import { ShopperPromotions } from "commerce-sdk-isomorphic";
266
- *
267
- * const clientConfig = {
268
- * parameters: {
269
- * clientId: "XXXXXX",
270
- * organizationId: "XXXX",
271
- * shortCode: "XXX",
272
- * siteId: "XX"
273
- * }
274
- * };
275
- * const shopperPromotionsClient = new ShopperPromotions(clientConfig);
276
- * ```
277
- *
278
- * <span style="font-size:.7em; display:block; text-align: right">
279
- * API Version: 0.0.33<br />
280
- * Last Updated: <br />
281
- * </span>
282
- *
283
- *
284
- */
285
- declare class ShopperPromotions<ConfigParameters extends ShopperPromotionsParameters & Record<string, unknown>> {
286
- // baseUri is not required on ClientConfig, but we know that we provide one in the class constructor
287
- clientConfig: ClientConfig<ConfigParameters> & {
288
- baseUri: string;
289
- };
290
- static readonly defaultBaseUri = "https://{shortCode}.api.commercecloud.salesforce.com/pricing/shopper-promotions/v1";
291
- static readonly apiPaths: {
292
- getPromotions: string;
293
- getPromotionsForCampaign: string;
294
- };
295
- constructor(config: ClientConfigInit<ConfigParameters>);
296
- static readonly paramKeys: {
297
- readonly getPromotions: readonly [
298
- "organizationId",
299
- "siteId",
300
- "ids",
301
- "locale"
302
- ];
303
- readonly getPromotionsRequired: readonly [
304
- "organizationId",
305
- "siteId",
306
- "ids"
307
- ];
308
- readonly getPromotionsForCampaign: readonly [
309
- "campaignId",
310
- "organizationId",
311
- "siteId",
312
- "startDate",
313
- "endDate",
314
- "currency"
315
- ];
316
- readonly getPromotionsForCampaignRequired: readonly [
317
- "campaignId",
318
- "organizationId",
319
- "siteId"
320
- ];
321
- };
322
- /**
323
- * In the request URL, you can specify up to 50 IDs. If you specify an ID that contains either parentheses or the separator characters, you must URL encode these characters.
324
- Each request returns only enabled promotions as the server does not consider promotion qualifiers or schedules.
325
- *
326
- * If you would like to get a raw Response object use the other getPromotions function.
327
- *
328
- * @param options - An object containing the options for this method.
329
- * @param options.parameters - An object containing the parameters for this method.
330
- * @param options.parameters.organizationId - An identifier for the organization the request is being made by
331
- * @param options.parameters.siteId - The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
332
- * @param options.parameters.ids -
333
- * @param options.parameters.locale - A descriptor for a geographical region by both a language and country code. By combining these two, regional differences in a language can be addressed, such as with the request header parameter `Accept-Language` following [RFC 2616](https://tools.ietf.org/html/rfc2616) & [RFC 1766](https://tools.ietf.org/html/rfc1766). This can also just refer to a language code, also RFC 2616/1766 compliant, as a default if there is no specific match for a country. Finally, can also be used to define default behavior if there is no locale specified.
334
- * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
335
- *
336
- * @returns A promise of type PromotionResult.
337
- */
338
- getPromotions(options?: RequireParametersUnlessAllAreOptional<{
339
- parameters?: CompositeParameters<{
340
- organizationId: string;
341
- siteId: string;
342
- ids: Array<string>;
343
- locale?: LocaleCode$0;
344
- } & QueryParameters, ConfigParameters>;
345
- headers?: {
346
- [key: string]: string;
347
- };
348
- }>): Promise<PromotionResult>;
349
- /**
350
- * In the request URL, you can specify up to 50 IDs. If you specify an ID that contains either parentheses or the separator characters, you must URL encode these characters.
351
- Each request returns only enabled promotions as the server does not consider promotion qualifiers or schedules.
352
- *
353
- * @param options - An object containing the options for this method.
354
- * @param options.parameters - An object containing the parameters for this method.
355
- * @param options.parameters.organizationId - An identifier for the organization the request is being made by
356
- * @param options.parameters.siteId - The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
357
- * @param options.parameters.ids -
358
- * @param options.parameters.locale - A descriptor for a geographical region by both a language and country code. By combining these two, regional differences in a language can be addressed, such as with the request header parameter `Accept-Language` following [RFC 2616](https://tools.ietf.org/html/rfc2616) & [RFC 1766](https://tools.ietf.org/html/rfc1766). This can also just refer to a language code, also RFC 2616/1766 compliant, as a default if there is no specific match for a country. Finally, can also be used to define default behavior if there is no locale specified.
359
- * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
360
- * @param rawResponse - Set to true to return entire Response object instead of DTO.
361
- *
362
- * @returns A promise of type Response if rawResponse is true, a promise of type PromotionResult otherwise.
363
- */
364
- getPromotions<T extends boolean>(options?: RequireParametersUnlessAllAreOptional<{
365
- parameters?: CompositeParameters<{
366
- organizationId: string;
367
- siteId: string;
368
- ids: Array<string>;
369
- locale?: LocaleCode$0;
370
- } & QueryParameters, ConfigParameters>;
371
- headers?: {
372
- [key: string]: string;
373
- };
374
- }>, rawResponse?: T): Promise<T extends true ? Response : PromotionResult>;
375
- /**
376
- * Retrieves promotion information using filter criteria. In the request URL, you must provide a campaign_id parameter, and you can optionally specify a date
377
- range by providing start_date and end_date parameters. Both parameters are required to specify a date range, and
378
- omitting one causes the server to return a MissingParameterException fault. Each request returns only enabled
379
- promotions, since the server does not consider promotion qualifiers or schedules.
380
- *
381
- * If you would like to get a raw Response object use the other getPromotionsForCampaign function.
382
- *
383
- * @param options - An object containing the options for this method.
384
- * @param options.parameters - An object containing the parameters for this method.
385
- * @param options.parameters.campaignId - Find the promotions assigned to this campaign (mandatory).
386
- * @param options.parameters.organizationId - An identifier for the organization the request is being made by
387
- * @param options.parameters.siteId - The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
388
- * @param options.parameters.startDate - The start date of the promotion in ISO8601 date time format: yyyy-MM-dd'T'HH:mmZ
389
- * @param options.parameters.endDate - The end date of the promotion in ISO8601 date time format: yyyy-MM-dd'T'HH:mmZ
390
- * @param options.parameters.currency - The currency mnemonic specified for price. This parameter is effective only for product suggestions.
391
- * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
392
- *
393
- * @returns A promise of type PromotionResult.
394
- */
395
- getPromotionsForCampaign(options?: RequireParametersUnlessAllAreOptional<{
396
- parameters?: CompositeParameters<{
397
- campaignId: string;
398
- organizationId: string;
399
- siteId: string;
400
- startDate?: string;
401
- endDate?: string;
402
- currency?: string;
403
- } & QueryParameters, ConfigParameters>;
404
- headers?: {
405
- [key: string]: string;
406
- };
407
- }>): Promise<PromotionResult>;
408
- /**
409
- * Retrieves promotion information using filter criteria. In the request URL, you must provide a campaign_id parameter, and you can optionally specify a date
410
- range by providing start_date and end_date parameters. Both parameters are required to specify a date range, and
411
- omitting one causes the server to return a MissingParameterException fault. Each request returns only enabled
412
- promotions, since the server does not consider promotion qualifiers or schedules.
413
- *
414
- * @param options - An object containing the options for this method.
415
- * @param options.parameters - An object containing the parameters for this method.
416
- * @param options.parameters.campaignId - Find the promotions assigned to this campaign (mandatory).
417
- * @param options.parameters.organizationId - An identifier for the organization the request is being made by
418
- * @param options.parameters.siteId - The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
419
- * @param options.parameters.startDate - The start date of the promotion in ISO8601 date time format: yyyy-MM-dd'T'HH:mmZ
420
- * @param options.parameters.endDate - The end date of the promotion in ISO8601 date time format: yyyy-MM-dd'T'HH:mmZ
421
- * @param options.parameters.currency - The currency mnemonic specified for price. This parameter is effective only for product suggestions.
422
- * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
423
- * @param rawResponse - Set to true to return entire Response object instead of DTO.
424
- *
425
- * @returns A promise of type Response if rawResponse is true, a promise of type PromotionResult otherwise.
426
- */
427
- getPromotionsForCampaign<T extends boolean>(options?: RequireParametersUnlessAllAreOptional<{
428
- parameters?: CompositeParameters<{
429
- campaignId: string;
430
- organizationId: string;
431
- siteId: string;
432
- startDate?: string;
433
- endDate?: string;
434
- currency?: string;
435
- } & QueryParameters, ConfigParameters>;
436
- headers?: {
437
- [key: string]: string;
438
- };
439
- }>, rawResponse?: T): Promise<T extends true ? Response : PromotionResult>;
440
- }
441
- declare namespace ShopperPromotionsApiTypes {
442
- /*
443
- * Copyright (c) 2023, Salesforce, Inc.
444
- * All rights reserved.
445
- * SPDX-License-Identifier: BSD-3-Clause
446
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
447
- */
448
- /**
449
- * Makes a type easier to read.
450
- */
451
- type Prettify<T> = NonNullable<{
452
- [K in keyof T]: T[K];
453
- }>;
454
- /**
455
- * Generates the types required on a method, based on those provided in the config.
456
- */
457
- type CompositeParameters<MethodParameters extends Record<string, unknown>, ConfigParameters extends Record<string, unknown>> = Prettify<Omit<MethodParameters, keyof ConfigParameters> & Partial<MethodParameters>>;
458
- /**
459
- * If an object has a `parameters` property, and the `parameters` object has required properties,
460
- * then the `parameters` property on the root object is marked as required.
461
- */
462
- type RequireParametersUnlessAllAreOptional<T extends {
463
- parameters?: Record<string, unknown>;
464
- }> = Record<string, never> extends NonNullable<T["parameters"]> ? T : Prettify<T & Required<Pick<T, "parameters">>>;
465
- /**
466
- * Template parameters used in the base URI of all API endpoints. `version` will default to `"v1"`
467
- * if not specified.
468
- */
469
- interface BaseUriParameters {
470
- shortCode: string;
471
- }
472
- type LocaleCode = {
473
- [key: string]: any;
474
- };
475
- /**
476
- * Generic interface for path parameters.
477
- */
478
- interface PathParameters {
479
- [key: string]: string | number | boolean;
480
- }
481
- /**
482
- * Generic interface for query parameters.
483
- */
484
- interface QueryParameters {
485
- [key: string]: string | number | boolean | string[] | number[] | LocaleCode;
486
- }
487
- /**
488
- * Generic interface for all parameter types.
489
- */
490
- type UrlParameters = PathParameters | QueryParameters;
491
- /**
492
- * Custom query parameter type with any string prefixed with `c_` as the key and the allowed
493
- * types for query parameters for the value.
494
- */
495
- type CustomQueryParameters = {
496
- [key in `c_${string}`]: string | number | boolean | string[] | number[];
497
- };
498
- /**
499
- * Custom body request type with any string prefixed with `c_` as the key and the allowed
500
- * types for the value.
501
- */
502
- type CustomRequestBody = {
503
- [key in `c_${string}`]: string | number | boolean | string[] | number[] | {
504
- [key: string]: unknown;
505
- };
506
- };
507
- /**
508
- * Alias for `RequestInit` from TypeScript's DOM lib, to more clearly differentiate
509
- * it from the `RequestInit` provided by node-fetch.
510
- */
511
- type BrowserRequestInit = RequestInit;
512
- /**
513
- * Any properties supported in either the browser or node are accepted.
514
- * Using the right properties in the right context is left to the user.
515
- */
516
- type FetchOptions = NodeRequestInit & BrowserRequestInit;
517
- type FetchFunction = (input: RequestInfo, init?: FetchOptions | undefined) => Promise<Response>;
518
- /**
519
- * Base options that can be passed to the `ClientConfig` class.
520
- */
521
- interface ClientConfigInit<Params extends BaseUriParameters> {
522
- baseUri?: string;
523
- proxy?: string;
524
- headers?: {
525
- [key: string]: string;
526
- };
527
- parameters: Params;
528
- fetchOptions?: FetchOptions;
529
- fetch?: FetchFunction;
530
- transformRequest?: (data: unknown, headers: {
531
- [key: string]: string;
532
- }) => Required<FetchOptions>["body"];
533
- throwOnBadResponse?: boolean;
534
- }
535
- /**
536
- * Configuration parameters common to Commerce SDK clients
537
- */
538
- class ClientConfig<Params extends BaseUriParameters> implements ClientConfigInit<Params> {
539
- baseUri?: string;
540
- proxy?: string;
541
- headers: {
542
- [key: string]: string;
543
- };
544
- parameters: Params;
545
- fetchOptions: FetchOptions;
546
- fetch?: FetchFunction;
547
- transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
548
- throwOnBadResponse: boolean;
549
- constructor(config: ClientConfigInit<Params>);
550
- static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
551
- }
552
- /**
553
- * A specialized value indicating the system default values for locales.
554
- */
555
- type DefaultFallback = "default";
556
- /**
557
- * @type ErrorResponse:
558
- *
559
- * @property title: A short, human-readable summary of the problem type. It will not change from occurrence to occurrence of the problem, except for purposes of localization
560
- * - **Max Length:** 256
561
- *
562
- * @property type: A URI reference [RFC3986] that identifies the problem type. This specification encourages that, when dereferenced, it provide human-readable documentation for the problem type (e.g., using HTML [W3C.REC-html5-20141028]). When this member is not present, its value is assumed to be \"about:blank\". It accepts relative URIs; this means that they must be resolved relative to the document\'s base URI, as per [RFC3986], Section 5.
563
- * - **Max Length:** 2048
564
- *
565
- * @property detail: A human-readable explanation specific to this occurrence of the problem.
566
- *
567
- * @property instance: A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced. It accepts relative URIs; this means that they must be resolved relative to the document\'s base URI, as per [RFC3986], Section 5.
568
- * - **Max Length:** 2048
569
- *
570
- */
571
- type ErrorResponse = {
572
- title: string;
573
- type: string;
574
- detail: string;
575
- instance?: string;
576
- } & {
577
- [key: string]: any;
578
- };
579
- /**
580
- * @type LocaleCode
581
- * A descriptor for a geographical region by both a language and country code. By combining these two, regional differences in a language can be addressed, such as with the request header parameter `Accept-Language` following [RFC 2616](https://tools.ietf.org/html/rfc2616) & [RFC 1766](https://tools.ietf.org/html/rfc1766). This can also just refer to a language code, also RFC 2616/1766 compliant, as a default if there is no specific match for a country. Finally, can also be used to define default behavior if there is no locale specified.
582
- */
583
- type LocaleCode$0 = DefaultFallback | string;
584
- /**
585
- * @type Promotion: Document representing a promotion.
586
- *
587
- * @property calloutMsg: The localized call-out message of the promotion.
588
- *
589
- * @property currency: The currency that a promotion can be applied to. A null value means that the promotion applies to all allowed currencies.
590
- *
591
- * @property details: The localized detailed description of the promotion.
592
- *
593
- * @property endDate: The end date of the promotion. This property follows the ISO8601 date time format: yyyy-MM-dd\'T\'HH:mmZ . The time zone of the date time is always UTC.
594
- *
595
- * @property id: The unique ID of the promotion.
596
- *
597
- * @property image: The URL to the promotion image.
598
- *
599
- * @property name: The localized name of the promotion.
600
- *
601
- * @property startDate: The start date of the promotion. This property follows the ISO8601 date time format: yyyy-MM-dd\'T\'HH:mmZ. The time zone of the date time is always UTC.
602
- *
603
- */
604
- type Promotion = {
605
- calloutMsg?: string;
606
- currency?: string;
607
- details?: string;
608
- endDate?: string;
609
- id: string;
610
- image?: string;
611
- name?: string;
612
- startDate?: string;
613
- } & {
614
- [key: string]: any;
615
- };
616
- /**
617
- * @type PromotionResult: Result document containing an array of promotions.
618
- *
619
- * @property data: The array of promotion documents.
620
- *
621
- * @property limit: Maximum records to retrieve per request, not to exceed the maximum defined. A limit must be at least 1 so at least one record is returned (if any match the criteria).
622
- *
623
- * @property total: The total number of hits that match the search\'s criteria. This can be greater than the number of results returned as search results are pagenated.
624
- *
625
- */
626
- type PromotionResult = {
627
- data: Array<Promotion>;
628
- limit: number;
629
- total: number;
630
- } & {
631
- [key: string]: any;
632
- };
633
- /**
634
- * @type ResultBase: Schema defining generic list result. Each response schema of a resource requiring a list response should extend this schema. Additionally it needs to be defined what data is returned.
635
- *
636
- * @property limit: Maximum records to retrieve per request, not to exceed the maximum defined. A limit must be at least 1 so at least one record is returned (if any match the criteria).
637
- *
638
- * @property total: The total number of hits that match the search\'s criteria. This can be greater than the number of results returned as search results are pagenated.
639
- *
640
- */
641
- type ResultBase = {
642
- limit: number;
643
- total: number;
644
- } & {
645
- [key: string]: any;
646
- };
647
- type getPromotionsQueryParameters = {
648
- siteId: string;
649
- ids: Array<string>;
650
- locale?: LocaleCode$0;
651
- };
652
- type getPromotionsPathParameters = {
653
- organizationId: string;
654
- };
655
- type getPromotionsForCampaignQueryParameters = {
656
- siteId: string;
657
- startDate?: string;
658
- endDate?: string;
659
- currency?: string;
660
- };
661
- type getPromotionsForCampaignPathParameters = {
662
- campaignId: string;
663
- organizationId: string;
664
- };
665
- /**
666
- * All path parameters that are used by at least one ShopperPromotions method.
667
- */
668
- type ShopperPromotionsPathParameters = Partial<getPromotionsPathParameters & getPromotionsForCampaignPathParameters & {}>;
669
- /**
670
- * All query parameters that are used by at least one ShopperPromotions method.
671
- */
672
- type ShopperPromotionsQueryParameters = Partial<getPromotionsQueryParameters & getPromotionsForCampaignQueryParameters & {}>;
673
- /**
674
- * All parameters that are used by ShopperPromotions.
675
- */
676
- type ShopperPromotionsParameters = ShopperPromotionsPathParameters & BaseUriParameters & ShopperPromotionsQueryParameters;
677
- /**
678
- * [Shopper Promotions](https://developer.salesforce.com/docs/commerce/commerce-api/references?meta=shopper-promotions:Summary)
679
- * ==================================
680
- *
681
- * *# API Overview
682
-
683
- Retrieve information about active promotions within the context of a shopper and a site. You can use this API to retrieve promotions that you configured in the commerce platform by searching for specific promotion IDs or by searching for promotions associated with a campaign.
684
-
685
- Caching is provided for the Shopper Promotions API. For details, see [Server-Side Web-Tier Caching.](https://developer.salesforce.com/docs/commerce/commerce-api/guide/server-side-web-tier-caching.html)
686
-
687
- ## Authentication & Authorization
688
-
689
- The Shopper Promotions API requires a JSON Web Token acquired via the Shopper Customers endpoint:
690
-
691
- ```
692
- https://{{shortcode}}.api.commercecloud.salesforce.com/customer/shopper-customers/v1/organizations/{{organizationId}}/customers/actions/login
693
- ```
694
-
695
- You must include the relevant scope(s) in the client ID used to generate the SLAS token. For details, see [Authorization Scopes Catalog.](https://developer.salesforce.com/docs/commerce/commerce-api/guide/auth-z-scope-catalog.html)
696
-
697
- ## Use Cases
698
-
699
- ### Get Promotion by Promotion ID
700
-
701
- Use the Shopper Promotions API to find promotion information by the promotion ID.
702
-
703
- For example, a customer who is browsing on a commerce shopping app built using Commerce Cloud APIs can see the details about the applied promotions in the cart.
704
-
705
- ### Get Promotion by Campaign ID
706
-
707
- Use the Shopper Promotions API to find promotion information by the campaign ID.
708
-
709
- For example, a customer who is browsing on a commerce shopping app built using Commerce Cloud APIs can see the possible promotions that can be applied in the cart.
710
-
711
- ### Use Hooks
712
-
713
- For details working with hooks, see [Extensibility with Hooks.](https://developer.salesforce.com/docs/commerce/commerce-api/guide/extensibility_via_hooks.html)*<br />
714
- *
715
- * Simple example:
716
- *
717
- * ```typescript
718
- * import { ShopperPromotions } from "commerce-sdk-isomorphic";
719
- *
720
- * const clientConfig = {
721
- * parameters: {
722
- * clientId: "XXXXXX",
723
- * organizationId: "XXXX",
724
- * shortCode: "XXX",
725
- * siteId: "XX"
726
- * }
727
- * };
728
- * const shopperPromotionsClient = new ShopperPromotions(clientConfig);
729
- * ```
730
- *
731
- * <span style="font-size:.7em; display:block; text-align: right">
732
- * API Version: 0.0.33<br />
733
- * Last Updated: <br />
734
- * </span>
735
- *
736
- *
737
- */
738
- class ShopperPromotions<ConfigParameters extends ShopperPromotionsParameters & Record<string, unknown>> {
739
- // baseUri is not required on ClientConfig, but we know that we provide one in the class constructor
740
- clientConfig: ClientConfig<ConfigParameters> & {
741
- baseUri: string;
742
- };
743
- static readonly defaultBaseUri = "https://{shortCode}.api.commercecloud.salesforce.com/pricing/shopper-promotions/v1";
744
- static readonly apiPaths: {
745
- getPromotions: string;
746
- getPromotionsForCampaign: string;
747
- };
748
- constructor(config: ClientConfigInit<ConfigParameters>);
749
- static readonly paramKeys: {
750
- readonly getPromotions: readonly [
751
- "organizationId",
752
- "siteId",
753
- "ids",
754
- "locale"
755
- ];
756
- readonly getPromotionsRequired: readonly [
757
- "organizationId",
758
- "siteId",
759
- "ids"
760
- ];
761
- readonly getPromotionsForCampaign: readonly [
762
- "campaignId",
763
- "organizationId",
764
- "siteId",
765
- "startDate",
766
- "endDate",
767
- "currency"
768
- ];
769
- readonly getPromotionsForCampaignRequired: readonly [
770
- "campaignId",
771
- "organizationId",
772
- "siteId"
773
- ];
774
- };
775
- /**
776
- * In the request URL, you can specify up to 50 IDs. If you specify an ID that contains either parentheses or the separator characters, you must URL encode these characters.
777
- Each request returns only enabled promotions as the server does not consider promotion qualifiers or schedules.
778
- *
779
- * If you would like to get a raw Response object use the other getPromotions function.
780
- *
781
- * @param options - An object containing the options for this method.
782
- * @param options.parameters - An object containing the parameters for this method.
783
- * @param options.parameters.organizationId - An identifier for the organization the request is being made by
784
- * @param options.parameters.siteId - The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
785
- * @param options.parameters.ids -
786
- * @param options.parameters.locale - A descriptor for a geographical region by both a language and country code. By combining these two, regional differences in a language can be addressed, such as with the request header parameter `Accept-Language` following [RFC 2616](https://tools.ietf.org/html/rfc2616) & [RFC 1766](https://tools.ietf.org/html/rfc1766). This can also just refer to a language code, also RFC 2616/1766 compliant, as a default if there is no specific match for a country. Finally, can also be used to define default behavior if there is no locale specified.
787
- * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
788
- *
789
- * @returns A promise of type PromotionResult.
790
- */
791
- getPromotions(options?: RequireParametersUnlessAllAreOptional<{
792
- parameters?: CompositeParameters<{
793
- organizationId: string;
794
- siteId: string;
795
- ids: Array<string>;
796
- locale?: LocaleCode$0;
797
- } & QueryParameters, ConfigParameters>;
798
- headers?: {
799
- [key: string]: string;
800
- };
801
- }>): Promise<PromotionResult>;
802
- /**
803
- * In the request URL, you can specify up to 50 IDs. If you specify an ID that contains either parentheses or the separator characters, you must URL encode these characters.
804
- Each request returns only enabled promotions as the server does not consider promotion qualifiers or schedules.
805
- *
806
- * @param options - An object containing the options for this method.
807
- * @param options.parameters - An object containing the parameters for this method.
808
- * @param options.parameters.organizationId - An identifier for the organization the request is being made by
809
- * @param options.parameters.siteId - The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
810
- * @param options.parameters.ids -
811
- * @param options.parameters.locale - A descriptor for a geographical region by both a language and country code. By combining these two, regional differences in a language can be addressed, such as with the request header parameter `Accept-Language` following [RFC 2616](https://tools.ietf.org/html/rfc2616) & [RFC 1766](https://tools.ietf.org/html/rfc1766). This can also just refer to a language code, also RFC 2616/1766 compliant, as a default if there is no specific match for a country. Finally, can also be used to define default behavior if there is no locale specified.
812
- * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
813
- * @param rawResponse - Set to true to return entire Response object instead of DTO.
814
- *
815
- * @returns A promise of type Response if rawResponse is true, a promise of type PromotionResult otherwise.
816
- */
817
- getPromotions<T extends boolean>(options?: RequireParametersUnlessAllAreOptional<{
818
- parameters?: CompositeParameters<{
819
- organizationId: string;
820
- siteId: string;
821
- ids: Array<string>;
822
- locale?: LocaleCode$0;
823
- } & QueryParameters, ConfigParameters>;
824
- headers?: {
825
- [key: string]: string;
826
- };
827
- }>, rawResponse?: T): Promise<T extends true ? Response : PromotionResult>;
828
- /**
829
- * Retrieves promotion information using filter criteria. In the request URL, you must provide a campaign_id parameter, and you can optionally specify a date
830
- range by providing start_date and end_date parameters. Both parameters are required to specify a date range, and
831
- omitting one causes the server to return a MissingParameterException fault. Each request returns only enabled
832
- promotions, since the server does not consider promotion qualifiers or schedules.
833
- *
834
- * If you would like to get a raw Response object use the other getPromotionsForCampaign function.
835
- *
836
- * @param options - An object containing the options for this method.
837
- * @param options.parameters - An object containing the parameters for this method.
838
- * @param options.parameters.campaignId - Find the promotions assigned to this campaign (mandatory).
839
- * @param options.parameters.organizationId - An identifier for the organization the request is being made by
840
- * @param options.parameters.siteId - The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
841
- * @param options.parameters.startDate - The start date of the promotion in ISO8601 date time format: yyyy-MM-dd'T'HH:mmZ
842
- * @param options.parameters.endDate - The end date of the promotion in ISO8601 date time format: yyyy-MM-dd'T'HH:mmZ
843
- * @param options.parameters.currency - The currency mnemonic specified for price. This parameter is effective only for product suggestions.
844
- * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
845
- *
846
- * @returns A promise of type PromotionResult.
847
- */
848
- getPromotionsForCampaign(options?: RequireParametersUnlessAllAreOptional<{
849
- parameters?: CompositeParameters<{
850
- campaignId: string;
851
- organizationId: string;
852
- siteId: string;
853
- startDate?: string;
854
- endDate?: string;
855
- currency?: string;
856
- } & QueryParameters, ConfigParameters>;
857
- headers?: {
858
- [key: string]: string;
859
- };
860
- }>): Promise<PromotionResult>;
861
- /**
862
- * Retrieves promotion information using filter criteria. In the request URL, you must provide a campaign_id parameter, and you can optionally specify a date
863
- range by providing start_date and end_date parameters. Both parameters are required to specify a date range, and
864
- omitting one causes the server to return a MissingParameterException fault. Each request returns only enabled
865
- promotions, since the server does not consider promotion qualifiers or schedules.
866
- *
867
- * @param options - An object containing the options for this method.
868
- * @param options.parameters - An object containing the parameters for this method.
869
- * @param options.parameters.campaignId - Find the promotions assigned to this campaign (mandatory).
870
- * @param options.parameters.organizationId - An identifier for the organization the request is being made by
871
- * @param options.parameters.siteId - The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
872
- * @param options.parameters.startDate - The start date of the promotion in ISO8601 date time format: yyyy-MM-dd'T'HH:mmZ
873
- * @param options.parameters.endDate - The end date of the promotion in ISO8601 date time format: yyyy-MM-dd'T'HH:mmZ
874
- * @param options.parameters.currency - The currency mnemonic specified for price. This parameter is effective only for product suggestions.
875
- * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
876
- * @param rawResponse - Set to true to return entire Response object instead of DTO.
877
- *
878
- * @returns A promise of type Response if rawResponse is true, a promise of type PromotionResult otherwise.
879
- */
880
- getPromotionsForCampaign<T extends boolean>(options?: RequireParametersUnlessAllAreOptional<{
881
- parameters?: CompositeParameters<{
882
- campaignId: string;
883
- organizationId: string;
884
- siteId: string;
885
- startDate?: string;
886
- endDate?: string;
887
- currency?: string;
888
- } & QueryParameters, ConfigParameters>;
889
- headers?: {
890
- [key: string]: string;
891
- };
892
- }>, rawResponse?: T): Promise<T extends true ? Response : PromotionResult>;
893
- }
894
- }
895
- declare namespace ShopperPromotionsModelTypes {
896
- /**
897
- * A specialized value indicating the system default values for locales.
898
- */
899
- type DefaultFallback = "default";
900
- /**
901
- * @type ErrorResponse:
902
- *
903
- * @property title: A short, human-readable summary of the problem type. It will not change from occurrence to occurrence of the problem, except for purposes of localization
904
- * - **Max Length:** 256
905
- *
906
- * @property type: A URI reference [RFC3986] that identifies the problem type. This specification encourages that, when dereferenced, it provide human-readable documentation for the problem type (e.g., using HTML [W3C.REC-html5-20141028]). When this member is not present, its value is assumed to be \"about:blank\". It accepts relative URIs; this means that they must be resolved relative to the document\'s base URI, as per [RFC3986], Section 5.
907
- * - **Max Length:** 2048
908
- *
909
- * @property detail: A human-readable explanation specific to this occurrence of the problem.
910
- *
911
- * @property instance: A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced. It accepts relative URIs; this means that they must be resolved relative to the document\'s base URI, as per [RFC3986], Section 5.
912
- * - **Max Length:** 2048
913
- *
914
- */
915
- type ErrorResponse = {
916
- title: string;
917
- type: string;
918
- detail: string;
919
- instance?: string;
920
- } & {
921
- [key: string]: any;
922
- };
923
- /**
924
- * @type LocaleCode
925
- * A descriptor for a geographical region by both a language and country code. By combining these two, regional differences in a language can be addressed, such as with the request header parameter `Accept-Language` following [RFC 2616](https://tools.ietf.org/html/rfc2616) & [RFC 1766](https://tools.ietf.org/html/rfc1766). This can also just refer to a language code, also RFC 2616/1766 compliant, as a default if there is no specific match for a country. Finally, can also be used to define default behavior if there is no locale specified.
926
- */
927
- type LocaleCode = DefaultFallback | string;
928
- /**
929
- * @type Promotion: Document representing a promotion.
930
- *
931
- * @property calloutMsg: The localized call-out message of the promotion.
932
- *
933
- * @property currency: The currency that a promotion can be applied to. A null value means that the promotion applies to all allowed currencies.
934
- *
935
- * @property details: The localized detailed description of the promotion.
936
- *
937
- * @property endDate: The end date of the promotion. This property follows the ISO8601 date time format: yyyy-MM-dd\'T\'HH:mmZ . The time zone of the date time is always UTC.
938
- *
939
- * @property id: The unique ID of the promotion.
940
- *
941
- * @property image: The URL to the promotion image.
942
- *
943
- * @property name: The localized name of the promotion.
944
- *
945
- * @property startDate: The start date of the promotion. This property follows the ISO8601 date time format: yyyy-MM-dd\'T\'HH:mmZ. The time zone of the date time is always UTC.
946
- *
947
- */
948
- type Promotion = {
949
- calloutMsg?: string;
950
- currency?: string;
951
- details?: string;
952
- endDate?: string;
953
- id: string;
954
- image?: string;
955
- name?: string;
956
- startDate?: string;
957
- } & {
958
- [key: string]: any;
959
- };
960
- /**
961
- * @type PromotionResult: Result document containing an array of promotions.
962
- *
963
- * @property data: The array of promotion documents.
964
- *
965
- * @property limit: Maximum records to retrieve per request, not to exceed the maximum defined. A limit must be at least 1 so at least one record is returned (if any match the criteria).
966
- *
967
- * @property total: The total number of hits that match the search\'s criteria. This can be greater than the number of results returned as search results are pagenated.
968
- *
969
- */
970
- type PromotionResult = {
971
- data: Array<Promotion>;
972
- limit: number;
973
- total: number;
974
- } & {
975
- [key: string]: any;
976
- };
977
- /**
978
- * @type ResultBase: Schema defining generic list result. Each response schema of a resource requiring a list response should extend this schema. Additionally it needs to be defined what data is returned.
979
- *
980
- * @property limit: Maximum records to retrieve per request, not to exceed the maximum defined. A limit must be at least 1 so at least one record is returned (if any match the criteria).
981
- *
982
- * @property total: The total number of hits that match the search\'s criteria. This can be greater than the number of results returned as search results are pagenated.
983
- *
984
- */
985
- type ResultBase = {
986
- limit: number;
987
- total: number;
988
- } & {
989
- [key: string]: any;
990
- };
991
- }
992
- declare namespace ShopperPromotionsTypes {
993
- type ShopperPromotionsPathParameters = ShopperPromotionsApiTypes.ShopperPromotionsPathParameters;
994
- type ShopperPromotionsQueryParameters = ShopperPromotionsApiTypes.ShopperPromotionsQueryParameters;
995
- type getPromotionsQueryParameters = ShopperPromotionsApiTypes.getPromotionsQueryParameters;
996
- type getPromotionsPathParameters = ShopperPromotionsApiTypes.getPromotionsPathParameters;
997
- type getPromotionsForCampaignQueryParameters = ShopperPromotionsApiTypes.getPromotionsForCampaignQueryParameters;
998
- type getPromotionsForCampaignPathParameters = ShopperPromotionsApiTypes.getPromotionsForCampaignPathParameters;
999
- type DefaultFallback = ShopperPromotionsModelTypes.DefaultFallback;
1000
- type ErrorResponse = ShopperPromotionsModelTypes.ErrorResponse;
1001
- type LocaleCode = ShopperPromotionsModelTypes.LocaleCode;
1002
- type Promotion = ShopperPromotionsModelTypes.Promotion;
1003
- type PromotionResult = ShopperPromotionsModelTypes.PromotionResult;
1004
- type ResultBase = ShopperPromotionsModelTypes.ResultBase;
1005
- }
1006
- export { defaultBaseUri, getPromotionsQueryParameters, getPromotionsPathParameters, getPromotionsForCampaignQueryParameters, getPromotionsForCampaignPathParameters, ShopperPromotionsPathParameters, ShopperPromotionsQueryParameters, ShopperPromotionsParameters, ShopperPromotions, DefaultFallback, ErrorResponse, LocaleCode$0 as LocaleCode, Promotion, PromotionResult, ResultBase, ShopperPromotionsTypes };