commerce-sdk-isomorphic 4.0.0 → 4.0.1-preview-shopper-test.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 +61 -3
  2. package/lib/clientConfig.cjs.d.ts +52 -0
  3. package/lib/clientConfig.cjs.js +1 -0
  4. package/lib/clientConfig.d.ts +52 -0
  5. package/lib/clientConfig.js +1 -0
  6. package/lib/config.cjs.d.ts +2 -0
  7. package/lib/config.cjs.js +1 -0
  8. package/lib/config.d.ts +2 -0
  9. package/lib/config.js +1 -0
  10. package/lib/helpers.cjs.d.ts +2225 -0
  11. package/lib/helpers.cjs.js +1 -0
  12. package/lib/helpers.d.ts +2225 -0
  13. package/lib/helpers.js +1 -0
  14. package/lib/index.cjs.d.ts +18 -1
  15. package/lib/index.cjs.js +1 -1
  16. package/lib/index.esm.d.ts +18 -1
  17. package/lib/index.esm.js +1 -1
  18. package/lib/responseError.cjs.d.ts +12 -0
  19. package/lib/responseError.cjs.js +1 -0
  20. package/lib/responseError.d.ts +12 -0
  21. package/lib/responseError.js +1 -0
  22. package/lib/shopperBaskets.cjs.d.ts +10259 -0
  23. package/lib/shopperBaskets.cjs.js +1 -0
  24. package/lib/shopperBaskets.d.ts +10259 -0
  25. package/lib/shopperBaskets.js +1 -0
  26. package/lib/shopperBasketsv2.cjs.d.ts +10453 -0
  27. package/lib/shopperBasketsv2.cjs.js +1 -0
  28. package/lib/shopperBasketsv2.d.ts +10453 -0
  29. package/lib/shopperBasketsv2.js +1 -0
  30. package/lib/shopperConsents.cjs.d.ts +1142 -0
  31. package/lib/shopperConsents.cjs.js +1 -0
  32. package/lib/shopperConsents.d.ts +1142 -0
  33. package/lib/shopperConsents.js +1 -0
  34. package/lib/shopperContext.cjs.d.ts +1401 -0
  35. package/lib/shopperContext.cjs.js +1 -0
  36. package/lib/shopperContext.d.ts +1401 -0
  37. package/lib/shopperContext.js +1 -0
  38. package/lib/shopperCustomers.cjs.d.ts +12185 -0
  39. package/lib/shopperCustomers.cjs.js +1 -0
  40. package/lib/shopperCustomers.d.ts +12185 -0
  41. package/lib/shopperCustomers.js +1 -0
  42. package/lib/shopperExperience.cjs.d.ts +1169 -0
  43. package/lib/shopperExperience.cjs.js +1 -0
  44. package/lib/shopperExperience.d.ts +1169 -0
  45. package/lib/shopperExperience.js +1 -0
  46. package/lib/shopperGiftCertificates.cjs.d.ts +729 -0
  47. package/lib/shopperGiftCertificates.cjs.js +1 -0
  48. package/lib/shopperGiftCertificates.d.ts +729 -0
  49. package/lib/shopperGiftCertificates.js +1 -0
  50. package/lib/shopperLogin.cjs.d.ts +3842 -0
  51. package/lib/shopperLogin.cjs.js +1 -0
  52. package/lib/shopperLogin.d.ts +3842 -0
  53. package/lib/shopperLogin.js +1 -0
  54. package/lib/shopperOrders.cjs.d.ts +5393 -0
  55. package/lib/shopperOrders.cjs.js +1 -0
  56. package/lib/shopperOrders.d.ts +5393 -0
  57. package/lib/shopperOrders.js +1 -0
  58. package/lib/shopperProducts.cjs.d.ts +3479 -0
  59. package/lib/shopperProducts.cjs.js +1 -0
  60. package/lib/shopperProducts.d.ts +3479 -0
  61. package/lib/shopperProducts.js +1 -0
  62. package/lib/shopperPromotions.cjs.d.ts +1001 -0
  63. package/lib/shopperPromotions.cjs.js +1 -0
  64. package/lib/shopperPromotions.d.ts +1001 -0
  65. package/lib/shopperPromotions.js +1 -0
  66. package/lib/shopperSearch.cjs.d.ts +3352 -0
  67. package/lib/shopperSearch.cjs.js +1 -0
  68. package/lib/shopperSearch.d.ts +3352 -0
  69. package/lib/shopperSearch.js +1 -0
  70. package/lib/shopperSeo.cjs.d.ts +769 -0
  71. package/lib/shopperSeo.cjs.js +1 -0
  72. package/lib/shopperSeo.d.ts +769 -0
  73. package/lib/shopperSeo.js +1 -0
  74. package/lib/shopperStores.cjs.d.ts +1289 -0
  75. package/lib/shopperStores.cjs.js +1 -0
  76. package/lib/shopperStores.d.ts +1289 -0
  77. package/lib/shopperStores.js +1 -0
  78. package/lib/templateUrl.cjs.d.ts +76 -0
  79. package/lib/templateUrl.cjs.js +1 -0
  80. package/lib/templateUrl.d.ts +76 -0
  81. package/lib/templateUrl.js +1 -0
  82. package/lib/version.cjs.d.ts +3 -0
  83. package/lib/version.cjs.js +1 -0
  84. package/lib/version.d.ts +3 -0
  85. package/lib/version.js +1 -0
  86. package/package.json +93 -26
@@ -0,0 +1,1142 @@
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/shopper/shopper-consents/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
+ * Custom body request type with any string prefixed with `c_` as the key and the allowed
56
+ * types for the value.
57
+ */
58
+ type CustomRequestBody = {
59
+ [key in `c_${string}`]: string | number | boolean | string[] | number[] | {
60
+ [key: string]: unknown;
61
+ };
62
+ };
63
+ /**
64
+ * Alias for `RequestInit` from TypeScript's DOM lib, to more clearly differentiate
65
+ * it from the `RequestInit` provided by node-fetch.
66
+ */
67
+ type BrowserRequestInit = RequestInit;
68
+ /**
69
+ * Any properties supported in either the browser or node are accepted.
70
+ * Using the right properties in the right context is left to the user.
71
+ */
72
+ type FetchOptions = NodeRequestInit & BrowserRequestInit;
73
+ /**
74
+ * Base options that can be passed to the `ClientConfig` class.
75
+ */
76
+ interface ClientConfigInit<Params extends BaseUriParameters> {
77
+ baseUri?: string;
78
+ proxy?: string;
79
+ headers?: {
80
+ [key: string]: string;
81
+ };
82
+ parameters: Params;
83
+ fetchOptions?: FetchOptions;
84
+ transformRequest?: (data: unknown, headers: {
85
+ [key: string]: string;
86
+ }) => Required<FetchOptions>["body"];
87
+ throwOnBadResponse?: boolean;
88
+ }
89
+ /**
90
+ * Configuration parameters common to Commerce SDK clients
91
+ */
92
+ declare class ClientConfig<Params extends BaseUriParameters> implements ClientConfigInit<Params> {
93
+ baseUri?: string;
94
+ proxy?: string;
95
+ headers: {
96
+ [key: string]: string;
97
+ };
98
+ parameters: Params;
99
+ fetchOptions: FetchOptions;
100
+ transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
101
+ throwOnBadResponse: boolean;
102
+ constructor(config: ClientConfigInit<Params>);
103
+ static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
104
+ }
105
+ /**
106
+ * The consent status of the subscription as supplied or recorded by this system
107
+ */
108
+ type ConsentStatus = "opt_in" | "opt_out";
109
+ /**
110
+ *
111
+ */
112
+ type SubscriptionChannel = "email" | "sms" | "push_notification" | "in_app" | "postal_mail" | "whatsapp";
113
+ /**
114
+ * @type ConsentSubscription:
115
+ *
116
+ * @property subscriptionId: Identifier for the communication subscription
117
+ * - **Pattern:** /^[a-z0-9]+(?:-[a-z0-9]+)*$/
118
+ * - **Min Length:** 1
119
+ * - **Max Length:** 255
120
+ *
121
+ * @property consentId: Identifier for the shopper communication subscription consent -- formatted as `<contactPointValue>#<communicationSubscriptionChannelId>`
122
+ * - **Min Length:** 19
123
+ * - **Max Length:** 339
124
+ *
125
+ * @property contactPointValue: The customer\'s contact point value, polymorphic based on the channel type as below: - `sms` - Subject\'s phone number in E.164 format, ex: `+1 424 535 3546` - `email` - Subject\'s email address in RFC 5321 & RFC 5322 format, ex: `jack.sparrow@salesforce.com`
126
+ * - **Min Length:** 3
127
+ * - **Max Length:** 320
128
+ *
129
+ * @property channel:
130
+ *
131
+ * @property status:
132
+ *
133
+ * @property title:
134
+ * - **Min Length:** 1
135
+ * - **Max Length:** 255
136
+ *
137
+ * @property subtitle:
138
+ * - **Min Length:** 1
139
+ * - **Max Length:** 255
140
+ *
141
+ * @property tags:
142
+ *
143
+ */
144
+ type ConsentSubscription = {
145
+ subscriptionId: string;
146
+ consentId?: string;
147
+ contactPointValue?: string;
148
+ channel: SubscriptionChannel;
149
+ status?: ConsentStatus;
150
+ title?: string;
151
+ subtitle?: string;
152
+ tags?: Array<string>;
153
+ } & {
154
+ [key: string]: any;
155
+ };
156
+ /**
157
+ * @type ConsentSubscriptionRequest: Consent subscription update request
158
+ *
159
+ * @property subscriptionId: Identifier for the communication subscription
160
+ * - **Pattern:** /^[a-z0-9]+(?:-[a-z0-9]+)*$/
161
+ * - **Min Length:** 1
162
+ * - **Max Length:** 255
163
+ *
164
+ * @property contactPointValue: The customer\'s contact point value, polymorphic based on the channel type as below: - `sms` - Subject\'s phone number in E.164 format, ex: `+1 424 535 3546` - `email` - Subject\'s email address in RFC 5321 & RFC 5322 format, ex: `jack.sparrow@salesforce.com`
165
+ * - **Min Length:** 3
166
+ * - **Max Length:** 320
167
+ *
168
+ * @property channel:
169
+ *
170
+ * @property status:
171
+ *
172
+ */
173
+ type ConsentSubscriptionRequest = {
174
+ subscriptionId: string;
175
+ contactPointValue: string;
176
+ channel: SubscriptionChannel;
177
+ status: ConsentStatus;
178
+ } & {
179
+ [key: string]: any;
180
+ };
181
+ /**
182
+ * @type ConsentSubscriptionResponse: Collection wrapper of consent subscriptions
183
+ *
184
+ * @property data:
185
+ *
186
+ */
187
+ type ConsentSubscriptionResponse = {
188
+ data: Array<ConsentSubscription>;
189
+ } & {
190
+ [key: string]: any;
191
+ };
192
+ /**
193
+ * A specialized value indicating the system default values for locales.
194
+ */
195
+ type DefaultFallback = "default";
196
+ /**
197
+ * @type ErrorResponse:
198
+ *
199
+ * @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
200
+ * - **Max Length:** 256
201
+ *
202
+ * @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.
203
+ * - **Max Length:** 2048
204
+ *
205
+ * @property detail: A human-readable explanation specific to this occurrence of the problem.
206
+ *
207
+ * @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.
208
+ * - **Max Length:** 2048
209
+ *
210
+ */
211
+ type ErrorResponse = {
212
+ title: string;
213
+ type: string;
214
+ detail: string;
215
+ instance?: string;
216
+ } & {
217
+ [key: string]: any;
218
+ };
219
+ /**
220
+ * @type LocaleCode
221
+ * 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.
222
+ */
223
+ type LocaleCode$0 = DefaultFallback | string;
224
+ type getSubscriptionsQueryParameters = {
225
+ siteId: string;
226
+ locale?: LocaleCode$0;
227
+ tags?: Array<string>;
228
+ };
229
+ type getSubscriptionsPathParameters = {
230
+ organizationId: string;
231
+ };
232
+ type updateSubscriptionQueryParameters = {
233
+ siteId: string;
234
+ locale?: LocaleCode$0;
235
+ };
236
+ type updateSubscriptionPathParameters = {
237
+ organizationId: string;
238
+ };
239
+ /**
240
+ * All path parameters that are used by at least one ShopperConsents method.
241
+ */
242
+ type ShopperConsentsPathParameters = Partial<getSubscriptionsPathParameters & updateSubscriptionPathParameters & {}>;
243
+ /**
244
+ * All query parameters that are used by at least one ShopperConsents method.
245
+ */
246
+ type ShopperConsentsQueryParameters = Partial<getSubscriptionsQueryParameters & updateSubscriptionQueryParameters & {}>;
247
+ /**
248
+ * All parameters that are used by ShopperConsents.
249
+ */
250
+ type ShopperConsentsParameters = ShopperConsentsPathParameters & BaseUriParameters & ShopperConsentsQueryParameters;
251
+ /**
252
+ * [Shopper Consents](https://developer.salesforce.com/docs/commerce/commerce-api/references?meta=shopper-consents:Summary)
253
+ * ==================================
254
+ *
255
+ * *# Shopper Consent
256
+
257
+ ## API Overview
258
+
259
+ The Shopper Consent API offers a centralized method for managing shopper consent. With this API, shoppers can view and update subscription preferences for marketing communications across various channels. This API controls how and where shoppers receive marketing messages while ensuring compliance with privacy regulations.
260
+
261
+ ## Key Features
262
+
263
+ - Multi-Channel Support: Manage communication subscriptions across email, SMS, push notifications, in-app messages, and postal mail.
264
+ - Organization-Based Management: Isolate consent preferences by organization for multi-tenant environments.
265
+ - Real-Time Updates: Instantly create and retrieve subscription preferences.
266
+ - Compliance Ready: Built with privacy regulations and consent-management best practices in mind.
267
+
268
+ ## Authentication & Authorization
269
+
270
+ The Shopper Consent API requires a JSON Web Token acquired using the Shopper Consent endpoint:
271
+ ```
272
+ https://{{shortcode}}.api.commercecloud.salesforce.com/customer/shopper-customers/v1/organizations/{{organizationId}}/customers/actions/login
273
+ ```
274
+ You must include the relevant scope(s) in the client ID used to generate the SLAS token.
275
+
276
+ ### Required Scopes
277
+
278
+ - `sfcc.shopper-consents`: Required for reading communication subscription data (GET operations).
279
+ - `sfcc.shopper-consents.rw`: Required for creating and modifying communication subscription data (POST operations).
280
+
281
+ ## Use Cases
282
+
283
+ ### Shopper Subscription Management
284
+ - Retrieve communication subscriptions: Retrieve relevant communication subscription options with display information.
285
+ - Guest shoppers can retrieve communication subscriptions options without pre-defined shopper credentials, for example: email address, phone number.
286
+ - Authenticated shoppers can retrieve communication subscription options available to their shopper credentials.
287
+ - Communication subscription options can be filtered by one or more qualifying tags.
288
+ - Update communication subscription consent preferences.
289
+
290
+ ## Data Model
291
+
292
+ ### Subscriptions
293
+ Subscriptions represent a shopper's consent to receive specific types of marketing communications. Each subscription includes:
294
+
295
+ - Identifier: Descriptive identifier
296
+ - Consent Status: Opt-in or opt-out
297
+ - Display Information: Title, subtitle, and description for customer-facing interfaces
298
+ - Tags: Categorical tags indicating where the subscription option can appear
299
+ - Channels: Supported communication methods, such as email, SMS, push notification
300
+
301
+ ### Channels
302
+ Channels define the communication methods available for a subscription:
303
+ - `email`: Email communications
304
+ - `sms`: SMS/text messages
305
+ - `whatsapp`: WhatsApp
306
+
307
+ ### Tags
308
+ Tags indicate where subscription options are displayed in your shopper experience. Tags are also accepted as optional filtering parameters in the retrieval of shopper consent subscriptions. For example:
309
+ - `homepage_banner`: Main website homepage
310
+ - `registration`: Shopper registration process
311
+ - `checkout`: Checkout process
312
+ - `user_profile`: User profile management area
313
+
314
+ ## Best Practices
315
+
316
+ ### User Experience
317
+ - Make it easy for shoppers to update their preferences.
318
+ - Respect shopper choices immediately.
319
+
320
+ ### Implementation Guidelines
321
+ - Implement clear and prominent unsubscribe mechanisms.
322
+
323
+ ### Compliance Considerations
324
+ - Ensure consent is freely given, specific, informed, and unambiguous.
325
+ - Implement proper data retention and deletion policies.
326
+ - Provide easy access to consent history and preferences.
327
+
328
+ ## Error Handling
329
+
330
+ The API uses standard HTTP status codes and returns detailed error information to help with troubleshooting:
331
+
332
+ - `400 Bad Request`: Invalid request format or missing required fields
333
+ - `401 Unauthorized`: Invalid or missing authentication token
334
+ - `403 Forbidden`: Insufficient permissions for the requested operation
335
+ - `404 Not Found`: Requested organization or resource not found
336
+ - `500 Internal Server Error`: Unexpected server error
337
+
338
+ ## Rate Limits
339
+
340
+ To ensure fair usage and system stability, the Shopper Consent API implements rate limiting. Refer to the response headers for current rate limit status and adjust your integration accordingly.*<br />
341
+ *
342
+ * Simple example:
343
+ *
344
+ * ```typescript
345
+ * import { ShopperConsents } from "commerce-sdk-isomorphic";
346
+ *
347
+ * const clientConfig = {
348
+ * parameters: {
349
+ * clientId: "XXXXXX",
350
+ * organizationId: "XXXX",
351
+ * shortCode: "XXX",
352
+ * siteId: "XX"
353
+ * }
354
+ * };
355
+ * const shopperConsentsClient = new ShopperConsents(clientConfig);
356
+ * ```
357
+ *
358
+ * <span style="font-size:.7em; display:block; text-align: right">
359
+ * API Version: 0.0.33<br />
360
+ * Last Updated: <br />
361
+ * </span>
362
+ *
363
+ *
364
+ */
365
+ declare class ShopperConsents<ConfigParameters extends ShopperConsentsParameters & Record<string, unknown>> {
366
+ // baseUri is not required on ClientConfig, but we know that we provide one in the class constructor
367
+ clientConfig: ClientConfig<ConfigParameters> & {
368
+ baseUri: string;
369
+ };
370
+ static readonly defaultBaseUri = "https://{shortCode}.api.commercecloud.salesforce.com/shopper/shopper-consents/v1";
371
+ static readonly apiPaths: {
372
+ getSubscriptions: string;
373
+ updateSubscription: string;
374
+ };
375
+ constructor(config: ClientConfigInit<ConfigParameters>);
376
+ static readonly paramKeys: {
377
+ readonly getSubscriptions: readonly [
378
+ "organizationId",
379
+ "siteId",
380
+ "locale",
381
+ "tags"
382
+ ];
383
+ readonly getSubscriptionsRequired: readonly [
384
+ "organizationId",
385
+ "siteId"
386
+ ];
387
+ readonly updateSubscription: readonly [
388
+ "organizationId",
389
+ "siteId",
390
+ "locale"
391
+ ];
392
+ readonly updateSubscriptionRequired: readonly [
393
+ "organizationId",
394
+ "siteId"
395
+ ];
396
+ };
397
+ /**
398
+ * Retrieve all subcription preferences for the shopper (authenticated or guest)
399
+ *
400
+ * If you would like to get a raw Response object use the other getSubscriptions function.
401
+ *
402
+ * @param options - An object containing the options for this method.
403
+ * @param options.parameters - An object containing the parameters for this method.
404
+ * @param options.parameters.organizationId - An identifier for the organization the request is being made by
405
+ * @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.
406
+ * @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.
407
+ * @param options.parameters.tags - Optional parameter of 0 or more query string values which act as a filtering criteria. Multiple values are treated with `OR` logic, and absence of a value indicates no filtering by tag is desired.
408
+ * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
409
+ *
410
+ * @returns A promise of type ConsentSubscriptionResponse.
411
+ */
412
+ getSubscriptions(options?: RequireParametersUnlessAllAreOptional<{
413
+ parameters?: CompositeParameters<{
414
+ organizationId: string;
415
+ siteId: string;
416
+ locale?: LocaleCode$0;
417
+ tags?: Array<string>;
418
+ } & QueryParameters, ConfigParameters>;
419
+ headers?: {
420
+ [key: string]: string;
421
+ };
422
+ }>): Promise<ConsentSubscriptionResponse>;
423
+ /**
424
+ * Retrieve all subcription preferences for the shopper (authenticated or guest)
425
+ *
426
+ * @param options - An object containing the options for this method.
427
+ * @param options.parameters - An object containing the parameters for this method.
428
+ * @param options.parameters.organizationId - An identifier for the organization the request is being made by
429
+ * @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.
430
+ * @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.
431
+ * @param options.parameters.tags - Optional parameter of 0 or more query string values which act as a filtering criteria. Multiple values are treated with `OR` logic, and absence of a value indicates no filtering by tag is desired.
432
+ * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
433
+ * @param rawResponse - Set to true to return entire Response object instead of DTO.
434
+ *
435
+ * @returns A promise of type Response if rawResponse is true, a promise of type ConsentSubscriptionResponse otherwise.
436
+ */
437
+ getSubscriptions<T extends boolean>(options?: RequireParametersUnlessAllAreOptional<{
438
+ parameters?: CompositeParameters<{
439
+ organizationId: string;
440
+ siteId: string;
441
+ locale?: LocaleCode$0;
442
+ tags?: Array<string>;
443
+ } & QueryParameters, ConfigParameters>;
444
+ headers?: {
445
+ [key: string]: string;
446
+ };
447
+ }>, rawResponse?: T): Promise<T extends true ? Response : ConsentSubscriptionResponse>;
448
+ /**
449
+ * Update the consent status for a given subscription.
450
+ *
451
+ * If you would like to get a raw Response object use the other updateSubscription function.
452
+ *
453
+ * @param options - An object containing the options for this method.
454
+ * @param options.parameters - An object containing the parameters for this method.
455
+ * @param options.parameters.organizationId - An identifier for the organization the request is being made by
456
+ * @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.
457
+ * @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.
458
+ * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
459
+ * @param options.body - The data to send as the request body.
460
+ *
461
+ * @returns A promise of type ConsentSubscription.
462
+ */
463
+ updateSubscription(options: RequireParametersUnlessAllAreOptional<{
464
+ parameters?: CompositeParameters<{
465
+ organizationId: string;
466
+ siteId: string;
467
+ locale?: LocaleCode$0;
468
+ } & QueryParameters, ConfigParameters>;
469
+ headers?: {
470
+ [key: string]: string;
471
+ };
472
+ body: ConsentSubscriptionRequest & CustomRequestBody;
473
+ }>): Promise<ConsentSubscription>;
474
+ /**
475
+ * Update the consent status for a given subscription.
476
+ *
477
+ * @param options - An object containing the options for this method.
478
+ * @param options.parameters - An object containing the parameters for this method.
479
+ * @param options.parameters.organizationId - An identifier for the organization the request is being made by
480
+ * @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.
481
+ * @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.
482
+ * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
483
+ * @param options.body - The data to send as the request body.
484
+ * @param rawResponse - Set to true to return entire Response object instead of DTO.
485
+ *
486
+ * @returns A promise of type Response if rawResponse is true, a promise of type ConsentSubscription otherwise.
487
+ */
488
+ updateSubscription<T extends boolean>(options: RequireParametersUnlessAllAreOptional<{
489
+ parameters?: CompositeParameters<{
490
+ organizationId: string;
491
+ siteId: string;
492
+ locale?: LocaleCode$0;
493
+ } & QueryParameters, ConfigParameters>;
494
+ headers?: {
495
+ [key: string]: string;
496
+ };
497
+ body: ConsentSubscriptionRequest & CustomRequestBody;
498
+ }>, rawResponse?: T): Promise<T extends true ? Response : ConsentSubscription>;
499
+ }
500
+ declare namespace ShopperConsentsApiTypes {
501
+ /*
502
+ * Copyright (c) 2023, Salesforce, Inc.
503
+ * All rights reserved.
504
+ * SPDX-License-Identifier: BSD-3-Clause
505
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
506
+ */
507
+ /**
508
+ * Makes a type easier to read.
509
+ */
510
+ type Prettify<T> = NonNullable<{
511
+ [K in keyof T]: T[K];
512
+ }>;
513
+ /**
514
+ * Generates the types required on a method, based on those provided in the config.
515
+ */
516
+ type CompositeParameters<MethodParameters extends Record<string, unknown>, ConfigParameters extends Record<string, unknown>> = Prettify<Omit<MethodParameters, keyof ConfigParameters> & Partial<MethodParameters>>;
517
+ /**
518
+ * If an object has a `parameters` property, and the `parameters` object has required properties,
519
+ * then the `parameters` property on the root object is marked as required.
520
+ */
521
+ type RequireParametersUnlessAllAreOptional<T extends {
522
+ parameters?: Record<string, unknown>;
523
+ }> = Record<string, never> extends NonNullable<T["parameters"]> ? T : Prettify<T & Required<Pick<T, "parameters">>>;
524
+ /**
525
+ * Template parameters used in the base URI of all API endpoints. `version` will default to `"v1"`
526
+ * if not specified.
527
+ */
528
+ interface BaseUriParameters {
529
+ shortCode: string;
530
+ }
531
+ type LocaleCode = {
532
+ [key: string]: any;
533
+ };
534
+ /**
535
+ * Generic interface for path parameters.
536
+ */
537
+ interface PathParameters {
538
+ [key: string]: string | number | boolean;
539
+ }
540
+ /**
541
+ * Generic interface for query parameters.
542
+ */
543
+ interface QueryParameters {
544
+ [key: string]: string | number | boolean | string[] | number[] | LocaleCode;
545
+ }
546
+ /**
547
+ * Generic interface for all parameter types.
548
+ */
549
+ type UrlParameters = PathParameters | QueryParameters;
550
+ /**
551
+ * Custom query parameter type with any string prefixed with `c_` as the key and the allowed
552
+ * types for query parameters for the value.
553
+ */
554
+ type CustomQueryParameters = {
555
+ [key in `c_${string}`]: string | number | boolean | string[] | number[];
556
+ };
557
+ /**
558
+ * Custom body request type with any string prefixed with `c_` as the key and the allowed
559
+ * types for the value.
560
+ */
561
+ type CustomRequestBody = {
562
+ [key in `c_${string}`]: string | number | boolean | string[] | number[] | {
563
+ [key: string]: unknown;
564
+ };
565
+ };
566
+ /**
567
+ * Alias for `RequestInit` from TypeScript's DOM lib, to more clearly differentiate
568
+ * it from the `RequestInit` provided by node-fetch.
569
+ */
570
+ type BrowserRequestInit = RequestInit;
571
+ /**
572
+ * Any properties supported in either the browser or node are accepted.
573
+ * Using the right properties in the right context is left to the user.
574
+ */
575
+ type FetchOptions = NodeRequestInit & BrowserRequestInit;
576
+ /**
577
+ * Base options that can be passed to the `ClientConfig` class.
578
+ */
579
+ interface ClientConfigInit<Params extends BaseUriParameters> {
580
+ baseUri?: string;
581
+ proxy?: string;
582
+ headers?: {
583
+ [key: string]: string;
584
+ };
585
+ parameters: Params;
586
+ fetchOptions?: FetchOptions;
587
+ transformRequest?: (data: unknown, headers: {
588
+ [key: string]: string;
589
+ }) => Required<FetchOptions>["body"];
590
+ throwOnBadResponse?: boolean;
591
+ }
592
+ type FetchFunction = (input: RequestInfo, init?: FetchOptions | undefined) => Promise<Response>;
593
+ /**
594
+ * Configuration parameters common to Commerce SDK clients
595
+ */
596
+ class ClientConfig<Params extends BaseUriParameters> implements ClientConfigInit<Params> {
597
+ baseUri?: string;
598
+ proxy?: string;
599
+ headers: {
600
+ [key: string]: string;
601
+ };
602
+ parameters: Params;
603
+ fetchOptions: FetchOptions;
604
+ transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
605
+ throwOnBadResponse: boolean;
606
+ constructor(config: ClientConfigInit<Params>);
607
+ static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
608
+ }
609
+ /**
610
+ * The consent status of the subscription as supplied or recorded by this system
611
+ */
612
+ type ConsentStatus = "opt_in" | "opt_out";
613
+ /**
614
+ *
615
+ */
616
+ type SubscriptionChannel = "email" | "sms" | "push_notification" | "in_app" | "postal_mail" | "whatsapp";
617
+ /**
618
+ * @type ConsentSubscription:
619
+ *
620
+ * @property subscriptionId: Identifier for the communication subscription
621
+ * - **Pattern:** /^[a-z0-9]+(?:-[a-z0-9]+)*$/
622
+ * - **Min Length:** 1
623
+ * - **Max Length:** 255
624
+ *
625
+ * @property consentId: Identifier for the shopper communication subscription consent -- formatted as `<contactPointValue>#<communicationSubscriptionChannelId>`
626
+ * - **Min Length:** 19
627
+ * - **Max Length:** 339
628
+ *
629
+ * @property contactPointValue: The customer\'s contact point value, polymorphic based on the channel type as below: - `sms` - Subject\'s phone number in E.164 format, ex: `+1 424 535 3546` - `email` - Subject\'s email address in RFC 5321 & RFC 5322 format, ex: `jack.sparrow@salesforce.com`
630
+ * - **Min Length:** 3
631
+ * - **Max Length:** 320
632
+ *
633
+ * @property channel:
634
+ *
635
+ * @property status:
636
+ *
637
+ * @property title:
638
+ * - **Min Length:** 1
639
+ * - **Max Length:** 255
640
+ *
641
+ * @property subtitle:
642
+ * - **Min Length:** 1
643
+ * - **Max Length:** 255
644
+ *
645
+ * @property tags:
646
+ *
647
+ */
648
+ type ConsentSubscription = {
649
+ subscriptionId: string;
650
+ consentId?: string;
651
+ contactPointValue?: string;
652
+ channel: SubscriptionChannel;
653
+ status?: ConsentStatus;
654
+ title?: string;
655
+ subtitle?: string;
656
+ tags?: Array<string>;
657
+ } & {
658
+ [key: string]: any;
659
+ };
660
+ /**
661
+ * @type ConsentSubscriptionRequest: Consent subscription update request
662
+ *
663
+ * @property subscriptionId: Identifier for the communication subscription
664
+ * - **Pattern:** /^[a-z0-9]+(?:-[a-z0-9]+)*$/
665
+ * - **Min Length:** 1
666
+ * - **Max Length:** 255
667
+ *
668
+ * @property contactPointValue: The customer\'s contact point value, polymorphic based on the channel type as below: - `sms` - Subject\'s phone number in E.164 format, ex: `+1 424 535 3546` - `email` - Subject\'s email address in RFC 5321 & RFC 5322 format, ex: `jack.sparrow@salesforce.com`
669
+ * - **Min Length:** 3
670
+ * - **Max Length:** 320
671
+ *
672
+ * @property channel:
673
+ *
674
+ * @property status:
675
+ *
676
+ */
677
+ type ConsentSubscriptionRequest = {
678
+ subscriptionId: string;
679
+ contactPointValue: string;
680
+ channel: SubscriptionChannel;
681
+ status: ConsentStatus;
682
+ } & {
683
+ [key: string]: any;
684
+ };
685
+ /**
686
+ * @type ConsentSubscriptionResponse: Collection wrapper of consent subscriptions
687
+ *
688
+ * @property data:
689
+ *
690
+ */
691
+ type ConsentSubscriptionResponse = {
692
+ data: Array<ConsentSubscription>;
693
+ } & {
694
+ [key: string]: any;
695
+ };
696
+ /**
697
+ * A specialized value indicating the system default values for locales.
698
+ */
699
+ type DefaultFallback = "default";
700
+ /**
701
+ * @type ErrorResponse:
702
+ *
703
+ * @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
704
+ * - **Max Length:** 256
705
+ *
706
+ * @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.
707
+ * - **Max Length:** 2048
708
+ *
709
+ * @property detail: A human-readable explanation specific to this occurrence of the problem.
710
+ *
711
+ * @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.
712
+ * - **Max Length:** 2048
713
+ *
714
+ */
715
+ type ErrorResponse = {
716
+ title: string;
717
+ type: string;
718
+ detail: string;
719
+ instance?: string;
720
+ } & {
721
+ [key: string]: any;
722
+ };
723
+ /**
724
+ * @type LocaleCode
725
+ * 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.
726
+ */
727
+ type LocaleCode$0 = DefaultFallback | string;
728
+ type getSubscriptionsQueryParameters = {
729
+ siteId: string;
730
+ locale?: LocaleCode$0;
731
+ tags?: Array<string>;
732
+ };
733
+ type getSubscriptionsPathParameters = {
734
+ organizationId: string;
735
+ };
736
+ type updateSubscriptionQueryParameters = {
737
+ siteId: string;
738
+ locale?: LocaleCode$0;
739
+ };
740
+ type updateSubscriptionPathParameters = {
741
+ organizationId: string;
742
+ };
743
+ /**
744
+ * All path parameters that are used by at least one ShopperConsents method.
745
+ */
746
+ type ShopperConsentsPathParameters = Partial<getSubscriptionsPathParameters & updateSubscriptionPathParameters & {}>;
747
+ /**
748
+ * All query parameters that are used by at least one ShopperConsents method.
749
+ */
750
+ type ShopperConsentsQueryParameters = Partial<getSubscriptionsQueryParameters & updateSubscriptionQueryParameters & {}>;
751
+ /**
752
+ * All parameters that are used by ShopperConsents.
753
+ */
754
+ type ShopperConsentsParameters = ShopperConsentsPathParameters & BaseUriParameters & ShopperConsentsQueryParameters;
755
+ /**
756
+ * [Shopper Consents](https://developer.salesforce.com/docs/commerce/commerce-api/references?meta=shopper-consents:Summary)
757
+ * ==================================
758
+ *
759
+ * *# Shopper Consent
760
+
761
+ ## API Overview
762
+
763
+ The Shopper Consent API offers a centralized method for managing shopper consent. With this API, shoppers can view and update subscription preferences for marketing communications across various channels. This API controls how and where shoppers receive marketing messages while ensuring compliance with privacy regulations.
764
+
765
+ ## Key Features
766
+
767
+ - Multi-Channel Support: Manage communication subscriptions across email, SMS, push notifications, in-app messages, and postal mail.
768
+ - Organization-Based Management: Isolate consent preferences by organization for multi-tenant environments.
769
+ - Real-Time Updates: Instantly create and retrieve subscription preferences.
770
+ - Compliance Ready: Built with privacy regulations and consent-management best practices in mind.
771
+
772
+ ## Authentication & Authorization
773
+
774
+ The Shopper Consent API requires a JSON Web Token acquired using the Shopper Consent endpoint:
775
+ ```
776
+ https://{{shortcode}}.api.commercecloud.salesforce.com/customer/shopper-customers/v1/organizations/{{organizationId}}/customers/actions/login
777
+ ```
778
+ You must include the relevant scope(s) in the client ID used to generate the SLAS token.
779
+
780
+ ### Required Scopes
781
+
782
+ - `sfcc.shopper-consents`: Required for reading communication subscription data (GET operations).
783
+ - `sfcc.shopper-consents.rw`: Required for creating and modifying communication subscription data (POST operations).
784
+
785
+ ## Use Cases
786
+
787
+ ### Shopper Subscription Management
788
+ - Retrieve communication subscriptions: Retrieve relevant communication subscription options with display information.
789
+ - Guest shoppers can retrieve communication subscriptions options without pre-defined shopper credentials, for example: email address, phone number.
790
+ - Authenticated shoppers can retrieve communication subscription options available to their shopper credentials.
791
+ - Communication subscription options can be filtered by one or more qualifying tags.
792
+ - Update communication subscription consent preferences.
793
+
794
+ ## Data Model
795
+
796
+ ### Subscriptions
797
+ Subscriptions represent a shopper's consent to receive specific types of marketing communications. Each subscription includes:
798
+
799
+ - Identifier: Descriptive identifier
800
+ - Consent Status: Opt-in or opt-out
801
+ - Display Information: Title, subtitle, and description for customer-facing interfaces
802
+ - Tags: Categorical tags indicating where the subscription option can appear
803
+ - Channels: Supported communication methods, such as email, SMS, push notification
804
+
805
+ ### Channels
806
+ Channels define the communication methods available for a subscription:
807
+ - `email`: Email communications
808
+ - `sms`: SMS/text messages
809
+ - `whatsapp`: WhatsApp
810
+
811
+ ### Tags
812
+ Tags indicate where subscription options are displayed in your shopper experience. Tags are also accepted as optional filtering parameters in the retrieval of shopper consent subscriptions. For example:
813
+ - `homepage_banner`: Main website homepage
814
+ - `registration`: Shopper registration process
815
+ - `checkout`: Checkout process
816
+ - `user_profile`: User profile management area
817
+
818
+ ## Best Practices
819
+
820
+ ### User Experience
821
+ - Make it easy for shoppers to update their preferences.
822
+ - Respect shopper choices immediately.
823
+
824
+ ### Implementation Guidelines
825
+ - Implement clear and prominent unsubscribe mechanisms.
826
+
827
+ ### Compliance Considerations
828
+ - Ensure consent is freely given, specific, informed, and unambiguous.
829
+ - Implement proper data retention and deletion policies.
830
+ - Provide easy access to consent history and preferences.
831
+
832
+ ## Error Handling
833
+
834
+ The API uses standard HTTP status codes and returns detailed error information to help with troubleshooting:
835
+
836
+ - `400 Bad Request`: Invalid request format or missing required fields
837
+ - `401 Unauthorized`: Invalid or missing authentication token
838
+ - `403 Forbidden`: Insufficient permissions for the requested operation
839
+ - `404 Not Found`: Requested organization or resource not found
840
+ - `500 Internal Server Error`: Unexpected server error
841
+
842
+ ## Rate Limits
843
+
844
+ To ensure fair usage and system stability, the Shopper Consent API implements rate limiting. Refer to the response headers for current rate limit status and adjust your integration accordingly.*<br />
845
+ *
846
+ * Simple example:
847
+ *
848
+ * ```typescript
849
+ * import { ShopperConsents } from "commerce-sdk-isomorphic";
850
+ *
851
+ * const clientConfig = {
852
+ * parameters: {
853
+ * clientId: "XXXXXX",
854
+ * organizationId: "XXXX",
855
+ * shortCode: "XXX",
856
+ * siteId: "XX"
857
+ * }
858
+ * };
859
+ * const shopperConsentsClient = new ShopperConsents(clientConfig);
860
+ * ```
861
+ *
862
+ * <span style="font-size:.7em; display:block; text-align: right">
863
+ * API Version: 0.0.33<br />
864
+ * Last Updated: <br />
865
+ * </span>
866
+ *
867
+ *
868
+ */
869
+ class ShopperConsents<ConfigParameters extends ShopperConsentsParameters & Record<string, unknown>> {
870
+ // baseUri is not required on ClientConfig, but we know that we provide one in the class constructor
871
+ clientConfig: ClientConfig<ConfigParameters> & {
872
+ baseUri: string;
873
+ };
874
+ static readonly defaultBaseUri = "https://{shortCode}.api.commercecloud.salesforce.com/shopper/shopper-consents/v1";
875
+ static readonly apiPaths: {
876
+ getSubscriptions: string;
877
+ updateSubscription: string;
878
+ };
879
+ constructor(config: ClientConfigInit<ConfigParameters>);
880
+ static readonly paramKeys: {
881
+ readonly getSubscriptions: readonly [
882
+ "organizationId",
883
+ "siteId",
884
+ "locale",
885
+ "tags"
886
+ ];
887
+ readonly getSubscriptionsRequired: readonly [
888
+ "organizationId",
889
+ "siteId"
890
+ ];
891
+ readonly updateSubscription: readonly [
892
+ "organizationId",
893
+ "siteId",
894
+ "locale"
895
+ ];
896
+ readonly updateSubscriptionRequired: readonly [
897
+ "organizationId",
898
+ "siteId"
899
+ ];
900
+ };
901
+ /**
902
+ * Retrieve all subcription preferences for the shopper (authenticated or guest)
903
+ *
904
+ * If you would like to get a raw Response object use the other getSubscriptions function.
905
+ *
906
+ * @param options - An object containing the options for this method.
907
+ * @param options.parameters - An object containing the parameters for this method.
908
+ * @param options.parameters.organizationId - An identifier for the organization the request is being made by
909
+ * @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.
910
+ * @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.
911
+ * @param options.parameters.tags - Optional parameter of 0 or more query string values which act as a filtering criteria. Multiple values are treated with `OR` logic, and absence of a value indicates no filtering by tag is desired.
912
+ * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
913
+ *
914
+ * @returns A promise of type ConsentSubscriptionResponse.
915
+ */
916
+ getSubscriptions(options?: RequireParametersUnlessAllAreOptional<{
917
+ parameters?: CompositeParameters<{
918
+ organizationId: string;
919
+ siteId: string;
920
+ locale?: LocaleCode$0;
921
+ tags?: Array<string>;
922
+ } & QueryParameters, ConfigParameters>;
923
+ headers?: {
924
+ [key: string]: string;
925
+ };
926
+ }>): Promise<ConsentSubscriptionResponse>;
927
+ /**
928
+ * Retrieve all subcription preferences for the shopper (authenticated or guest)
929
+ *
930
+ * @param options - An object containing the options for this method.
931
+ * @param options.parameters - An object containing the parameters for this method.
932
+ * @param options.parameters.organizationId - An identifier for the organization the request is being made by
933
+ * @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.
934
+ * @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.
935
+ * @param options.parameters.tags - Optional parameter of 0 or more query string values which act as a filtering criteria. Multiple values are treated with `OR` logic, and absence of a value indicates no filtering by tag is desired.
936
+ * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
937
+ * @param rawResponse - Set to true to return entire Response object instead of DTO.
938
+ *
939
+ * @returns A promise of type Response if rawResponse is true, a promise of type ConsentSubscriptionResponse otherwise.
940
+ */
941
+ getSubscriptions<T extends boolean>(options?: RequireParametersUnlessAllAreOptional<{
942
+ parameters?: CompositeParameters<{
943
+ organizationId: string;
944
+ siteId: string;
945
+ locale?: LocaleCode$0;
946
+ tags?: Array<string>;
947
+ } & QueryParameters, ConfigParameters>;
948
+ headers?: {
949
+ [key: string]: string;
950
+ };
951
+ }>, rawResponse?: T): Promise<T extends true ? Response : ConsentSubscriptionResponse>;
952
+ /**
953
+ * Update the consent status for a given subscription.
954
+ *
955
+ * If you would like to get a raw Response object use the other updateSubscription function.
956
+ *
957
+ * @param options - An object containing the options for this method.
958
+ * @param options.parameters - An object containing the parameters for this method.
959
+ * @param options.parameters.organizationId - An identifier for the organization the request is being made by
960
+ * @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.
961
+ * @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.
962
+ * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
963
+ * @param options.body - The data to send as the request body.
964
+ *
965
+ * @returns A promise of type ConsentSubscription.
966
+ */
967
+ updateSubscription(options: RequireParametersUnlessAllAreOptional<{
968
+ parameters?: CompositeParameters<{
969
+ organizationId: string;
970
+ siteId: string;
971
+ locale?: LocaleCode$0;
972
+ } & QueryParameters, ConfigParameters>;
973
+ headers?: {
974
+ [key: string]: string;
975
+ };
976
+ body: ConsentSubscriptionRequest & CustomRequestBody;
977
+ }>): Promise<ConsentSubscription>;
978
+ /**
979
+ * Update the consent status for a given subscription.
980
+ *
981
+ * @param options - An object containing the options for this method.
982
+ * @param options.parameters - An object containing the parameters for this method.
983
+ * @param options.parameters.organizationId - An identifier for the organization the request is being made by
984
+ * @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.
985
+ * @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.
986
+ * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
987
+ * @param options.body - The data to send as the request body.
988
+ * @param rawResponse - Set to true to return entire Response object instead of DTO.
989
+ *
990
+ * @returns A promise of type Response if rawResponse is true, a promise of type ConsentSubscription otherwise.
991
+ */
992
+ updateSubscription<T extends boolean>(options: RequireParametersUnlessAllAreOptional<{
993
+ parameters?: CompositeParameters<{
994
+ organizationId: string;
995
+ siteId: string;
996
+ locale?: LocaleCode$0;
997
+ } & QueryParameters, ConfigParameters>;
998
+ headers?: {
999
+ [key: string]: string;
1000
+ };
1001
+ body: ConsentSubscriptionRequest & CustomRequestBody;
1002
+ }>, rawResponse?: T): Promise<T extends true ? Response : ConsentSubscription>;
1003
+ }
1004
+ }
1005
+ declare namespace ShopperConsentsModelTypes {
1006
+ /**
1007
+ * The consent status of the subscription as supplied or recorded by this system
1008
+ */
1009
+ type ConsentStatus = "opt_in" | "opt_out";
1010
+ /**
1011
+ *
1012
+ */
1013
+ type SubscriptionChannel = "email" | "sms" | "push_notification" | "in_app" | "postal_mail" | "whatsapp";
1014
+ /**
1015
+ * @type ConsentSubscription:
1016
+ *
1017
+ * @property subscriptionId: Identifier for the communication subscription
1018
+ * - **Pattern:** /^[a-z0-9]+(?:-[a-z0-9]+)*$/
1019
+ * - **Min Length:** 1
1020
+ * - **Max Length:** 255
1021
+ *
1022
+ * @property consentId: Identifier for the shopper communication subscription consent -- formatted as `<contactPointValue>#<communicationSubscriptionChannelId>`
1023
+ * - **Min Length:** 19
1024
+ * - **Max Length:** 339
1025
+ *
1026
+ * @property contactPointValue: The customer\'s contact point value, polymorphic based on the channel type as below: - `sms` - Subject\'s phone number in E.164 format, ex: `+1 424 535 3546` - `email` - Subject\'s email address in RFC 5321 & RFC 5322 format, ex: `jack.sparrow@salesforce.com`
1027
+ * - **Min Length:** 3
1028
+ * - **Max Length:** 320
1029
+ *
1030
+ * @property channel:
1031
+ *
1032
+ * @property status:
1033
+ *
1034
+ * @property title:
1035
+ * - **Min Length:** 1
1036
+ * - **Max Length:** 255
1037
+ *
1038
+ * @property subtitle:
1039
+ * - **Min Length:** 1
1040
+ * - **Max Length:** 255
1041
+ *
1042
+ * @property tags:
1043
+ *
1044
+ */
1045
+ type ConsentSubscription = {
1046
+ subscriptionId: string;
1047
+ consentId?: string;
1048
+ contactPointValue?: string;
1049
+ channel: SubscriptionChannel;
1050
+ status?: ConsentStatus;
1051
+ title?: string;
1052
+ subtitle?: string;
1053
+ tags?: Array<string>;
1054
+ } & {
1055
+ [key: string]: any;
1056
+ };
1057
+ /**
1058
+ * @type ConsentSubscriptionRequest: Consent subscription update request
1059
+ *
1060
+ * @property subscriptionId: Identifier for the communication subscription
1061
+ * - **Pattern:** /^[a-z0-9]+(?:-[a-z0-9]+)*$/
1062
+ * - **Min Length:** 1
1063
+ * - **Max Length:** 255
1064
+ *
1065
+ * @property contactPointValue: The customer\'s contact point value, polymorphic based on the channel type as below: - `sms` - Subject\'s phone number in E.164 format, ex: `+1 424 535 3546` - `email` - Subject\'s email address in RFC 5321 & RFC 5322 format, ex: `jack.sparrow@salesforce.com`
1066
+ * - **Min Length:** 3
1067
+ * - **Max Length:** 320
1068
+ *
1069
+ * @property channel:
1070
+ *
1071
+ * @property status:
1072
+ *
1073
+ */
1074
+ type ConsentSubscriptionRequest = {
1075
+ subscriptionId: string;
1076
+ contactPointValue: string;
1077
+ channel: SubscriptionChannel;
1078
+ status: ConsentStatus;
1079
+ } & {
1080
+ [key: string]: any;
1081
+ };
1082
+ /**
1083
+ * @type ConsentSubscriptionResponse: Collection wrapper of consent subscriptions
1084
+ *
1085
+ * @property data:
1086
+ *
1087
+ */
1088
+ type ConsentSubscriptionResponse = {
1089
+ data: Array<ConsentSubscription>;
1090
+ } & {
1091
+ [key: string]: any;
1092
+ };
1093
+ /**
1094
+ * A specialized value indicating the system default values for locales.
1095
+ */
1096
+ type DefaultFallback = "default";
1097
+ /**
1098
+ * @type ErrorResponse:
1099
+ *
1100
+ * @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
1101
+ * - **Max Length:** 256
1102
+ *
1103
+ * @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.
1104
+ * - **Max Length:** 2048
1105
+ *
1106
+ * @property detail: A human-readable explanation specific to this occurrence of the problem.
1107
+ *
1108
+ * @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.
1109
+ * - **Max Length:** 2048
1110
+ *
1111
+ */
1112
+ type ErrorResponse = {
1113
+ title: string;
1114
+ type: string;
1115
+ detail: string;
1116
+ instance?: string;
1117
+ } & {
1118
+ [key: string]: any;
1119
+ };
1120
+ /**
1121
+ * @type LocaleCode
1122
+ * 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.
1123
+ */
1124
+ type LocaleCode = DefaultFallback | string;
1125
+ }
1126
+ declare namespace ShopperConsentsTypes {
1127
+ type ShopperConsentsPathParameters = ShopperConsentsApiTypes.ShopperConsentsPathParameters;
1128
+ type ShopperConsentsQueryParameters = ShopperConsentsApiTypes.ShopperConsentsQueryParameters;
1129
+ type getSubscriptionsQueryParameters = ShopperConsentsApiTypes.getSubscriptionsQueryParameters;
1130
+ type getSubscriptionsPathParameters = ShopperConsentsApiTypes.getSubscriptionsPathParameters;
1131
+ type updateSubscriptionQueryParameters = ShopperConsentsApiTypes.updateSubscriptionQueryParameters;
1132
+ type updateSubscriptionPathParameters = ShopperConsentsApiTypes.updateSubscriptionPathParameters;
1133
+ type ConsentStatus = ShopperConsentsModelTypes.ConsentStatus;
1134
+ type ConsentSubscription = ShopperConsentsModelTypes.ConsentSubscription;
1135
+ type ConsentSubscriptionRequest = ShopperConsentsModelTypes.ConsentSubscriptionRequest;
1136
+ type ConsentSubscriptionResponse = ShopperConsentsModelTypes.ConsentSubscriptionResponse;
1137
+ type DefaultFallback = ShopperConsentsModelTypes.DefaultFallback;
1138
+ type ErrorResponse = ShopperConsentsModelTypes.ErrorResponse;
1139
+ type LocaleCode = ShopperConsentsModelTypes.LocaleCode;
1140
+ type SubscriptionChannel = ShopperConsentsModelTypes.SubscriptionChannel;
1141
+ }
1142
+ export { defaultBaseUri, getSubscriptionsQueryParameters, getSubscriptionsPathParameters, updateSubscriptionQueryParameters, updateSubscriptionPathParameters, ShopperConsentsPathParameters, ShopperConsentsQueryParameters, ShopperConsentsParameters, ShopperConsents, ConsentStatus, ConsentSubscription, ConsentSubscriptionRequest, ConsentSubscriptionResponse, DefaultFallback, ErrorResponse, LocaleCode$0 as LocaleCode, SubscriptionChannel, ShopperConsentsTypes };