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