commerce-sdk-isomorphic 4.0.0-nightly-20251030080738 → 4.0.0-nightly-20251101080702
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/helpers.cjs.js +1 -1
- package/lib/helpers.js +1 -1
- package/lib/index.cjs.d.ts +800 -166
- package/lib/index.cjs.js +1 -1
- package/lib/index.esm.d.ts +800 -166
- package/lib/index.esm.js +1 -1
- package/lib/shopperBaskets.cjs.js +1 -1
- package/lib/shopperBaskets.js +1 -1
- package/lib/shopperBasketsv2.cjs.js +1 -1
- package/lib/shopperBasketsv2.js +1 -1
- package/lib/shopperConfigurations.cjs.js +1 -1
- package/lib/shopperConfigurations.js +1 -1
- package/lib/shopperConsents.cjs.d.ts +799 -165
- package/lib/shopperConsents.cjs.js +1 -1
- package/lib/shopperConsents.d.ts +799 -165
- package/lib/shopperConsents.js +1 -1
- package/lib/shopperContext.cjs.js +1 -1
- package/lib/shopperContext.js +1 -1
- package/lib/shopperCustomers.cjs.js +1 -1
- package/lib/shopperCustomers.js +1 -1
- package/lib/shopperExperience.cjs.js +1 -1
- package/lib/shopperExperience.js +1 -1
- package/lib/shopperGiftCertificates.cjs.js +1 -1
- package/lib/shopperGiftCertificates.js +1 -1
- package/lib/shopperLogin.cjs.js +1 -1
- package/lib/shopperLogin.js +1 -1
- package/lib/shopperOrders.cjs.js +1 -1
- package/lib/shopperOrders.js +1 -1
- package/lib/shopperPayments.cjs.js +1 -1
- package/lib/shopperPayments.js +1 -1
- package/lib/shopperProducts.cjs.js +1 -1
- package/lib/shopperProducts.js +1 -1
- package/lib/shopperPromotions.cjs.js +1 -1
- package/lib/shopperPromotions.js +1 -1
- package/lib/shopperSearch.cjs.js +1 -1
- package/lib/shopperSearch.js +1 -1
- package/lib/shopperSeo.cjs.js +1 -1
- package/lib/shopperSeo.js +1 -1
- package/lib/shopperStores.cjs.js +1 -1
- package/lib/shopperStores.js +1 -1
- package/lib/version.cjs.d.ts +1 -1
- package/lib/version.cjs.js +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
package/lib/shopperConsents.d.ts
CHANGED
|
@@ -102,14 +102,33 @@ declare class ClientConfig<Params extends BaseUriParameters> implements ClientCo
|
|
|
102
102
|
constructor(config: ClientConfigInit<Params>);
|
|
103
103
|
static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
|
|
104
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
*
|
|
107
|
+
*/
|
|
108
|
+
type ChannelType = "email" | "sms" | "whatsapp";
|
|
105
109
|
/**
|
|
106
110
|
* The consent status of the subscription as supplied or recorded by this system
|
|
107
111
|
*/
|
|
108
112
|
type ConsentStatus = "opt_in" | "opt_out";
|
|
109
113
|
/**
|
|
114
|
+
* @type SubscriptionStatusEntry: Individual subscription status entry for a specific channel
|
|
115
|
+
*
|
|
116
|
+
* @property channel:
|
|
117
|
+
*
|
|
118
|
+
* @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`
|
|
119
|
+
* - **Min Length:** 3
|
|
120
|
+
* - **Max Length:** 320
|
|
121
|
+
*
|
|
122
|
+
* @property status:
|
|
110
123
|
*
|
|
111
124
|
*/
|
|
112
|
-
type
|
|
125
|
+
type SubscriptionStatusEntry = {
|
|
126
|
+
channel: ChannelType;
|
|
127
|
+
contactPointValue: string;
|
|
128
|
+
status: ConsentStatus;
|
|
129
|
+
} & {
|
|
130
|
+
[key: string]: any;
|
|
131
|
+
};
|
|
113
132
|
/**
|
|
114
133
|
* @type ConsentSubscription:
|
|
115
134
|
*
|
|
@@ -118,41 +137,42 @@ type SubscriptionChannel = "email" | "sms" | "push_notification" | "in_app" | "p
|
|
|
118
137
|
* - **Min Length:** 1
|
|
119
138
|
* - **Max Length:** 255
|
|
120
139
|
*
|
|
121
|
-
* @property
|
|
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:
|
|
140
|
+
* @property channels:
|
|
130
141
|
*
|
|
131
|
-
* @property status
|
|
142
|
+
* @property consentStatus: Array of subscription status entries for different channels
|
|
132
143
|
*
|
|
133
|
-
* @property title:
|
|
144
|
+
* @property title: The localized title of the subscription for shopper displays
|
|
134
145
|
* - **Min Length:** 1
|
|
135
146
|
* - **Max Length:** 255
|
|
136
147
|
*
|
|
137
|
-
* @property subtitle:
|
|
148
|
+
* @property subtitle: The localized subtitle of the subscription for shopper displays, may contain HTML markup
|
|
138
149
|
* - **Min Length:** 1
|
|
139
|
-
* - **Max Length:**
|
|
150
|
+
* - **Max Length:** 2000
|
|
140
151
|
*
|
|
141
152
|
* @property tags:
|
|
142
153
|
*
|
|
154
|
+
* @property consentType: Type of consent subscription
|
|
155
|
+
*
|
|
156
|
+
* @property consentRequired: Whether this subscription is mandatory for the user
|
|
157
|
+
*
|
|
158
|
+
* @property defaultStatus: Default consent status for this subscription
|
|
159
|
+
*
|
|
143
160
|
*/
|
|
144
161
|
type ConsentSubscription = {
|
|
145
162
|
subscriptionId: string;
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
channel: SubscriptionChannel;
|
|
149
|
-
status?: ConsentStatus;
|
|
163
|
+
channels: Set<ChannelType>;
|
|
164
|
+
consentStatus?: Array<SubscriptionStatusEntry>;
|
|
150
165
|
title?: string;
|
|
151
166
|
subtitle?: string;
|
|
152
167
|
tags?: Array<string>;
|
|
168
|
+
consentType?: ConsentSubscriptionConsentTypeEnum;
|
|
169
|
+
consentRequired?: boolean;
|
|
170
|
+
defaultStatus?: ConsentSubscriptionDefaultStatusEnum;
|
|
153
171
|
} & {
|
|
154
172
|
[key: string]: any;
|
|
155
173
|
};
|
|
174
|
+
type ConsentSubscriptionConsentTypeEnum = "marketing" | "legal";
|
|
175
|
+
type ConsentSubscriptionDefaultStatusEnum = "opt_in" | "opt_out";
|
|
156
176
|
/**
|
|
157
177
|
* @type ConsentSubscriptionRequest: Consent subscription update request
|
|
158
178
|
*
|
|
@@ -173,8 +193,80 @@ type ConsentSubscription = {
|
|
|
173
193
|
type ConsentSubscriptionRequest = {
|
|
174
194
|
subscriptionId: string;
|
|
175
195
|
contactPointValue: string;
|
|
176
|
-
channel:
|
|
196
|
+
channel: ChannelType;
|
|
197
|
+
status: ConsentStatus;
|
|
198
|
+
} & {
|
|
199
|
+
[key: string]: any;
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* @type ConsentSubscriptionBulkRequest: Bulk request for updating multiple consent subscriptions
|
|
203
|
+
*
|
|
204
|
+
* @property subscriptions: Array of subscription consent updates to process
|
|
205
|
+
*
|
|
206
|
+
*/
|
|
207
|
+
type ConsentSubscriptionBulkRequest = {
|
|
208
|
+
subscriptions: Array<ConsentSubscriptionRequest>;
|
|
209
|
+
} & {
|
|
210
|
+
[key: string]: any;
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* @type ConsentSubscriptionError: Error details for failed subscription updates
|
|
214
|
+
*
|
|
215
|
+
* @property code: Error code indicating the type of failure
|
|
216
|
+
* - **Max Length:** 100
|
|
217
|
+
*
|
|
218
|
+
* @property message: Human-readable error message
|
|
219
|
+
* - **Max Length:** 500
|
|
220
|
+
*
|
|
221
|
+
* @property details: Additional error details
|
|
222
|
+
*
|
|
223
|
+
*/
|
|
224
|
+
type ConsentSubscriptionError = {
|
|
225
|
+
code: string;
|
|
226
|
+
message: string;
|
|
227
|
+
details?: object;
|
|
228
|
+
} & {
|
|
229
|
+
[key: string]: any;
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* @type ConsentSubscriptionResult: Individual subscription update result with input parameters
|
|
233
|
+
*
|
|
234
|
+
* @property subscriptionId: Identifier for the communication subscription
|
|
235
|
+
* - **Pattern:** /^[a-z0-9]+(?:-[a-z0-9]+)*$/
|
|
236
|
+
* - **Min Length:** 1
|
|
237
|
+
* - **Max Length:** 255
|
|
238
|
+
*
|
|
239
|
+
* @property channel:
|
|
240
|
+
*
|
|
241
|
+
* @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`
|
|
242
|
+
* - **Min Length:** 3
|
|
243
|
+
* - **Max Length:** 320
|
|
244
|
+
*
|
|
245
|
+
* @property status:
|
|
246
|
+
*
|
|
247
|
+
* @property success: Whether the subscription update was successful
|
|
248
|
+
*
|
|
249
|
+
* @property error:
|
|
250
|
+
*
|
|
251
|
+
*/
|
|
252
|
+
type ConsentSubscriptionResult = {
|
|
253
|
+
subscriptionId: string;
|
|
254
|
+
channel: ChannelType;
|
|
255
|
+
contactPointValue: string;
|
|
177
256
|
status: ConsentStatus;
|
|
257
|
+
success: boolean;
|
|
258
|
+
error?: ConsentSubscriptionError;
|
|
259
|
+
} & {
|
|
260
|
+
[key: string]: any;
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* @type ConsentSubscriptionBulkResponse: Bulk response with results for each subscription update request
|
|
264
|
+
*
|
|
265
|
+
* @property results: Results for each subscription update request
|
|
266
|
+
*
|
|
267
|
+
*/
|
|
268
|
+
type ConsentSubscriptionBulkResponse = {
|
|
269
|
+
results: Array<ConsentSubscriptionResult>;
|
|
178
270
|
} & {
|
|
179
271
|
[key: string]: any;
|
|
180
272
|
};
|
|
@@ -189,6 +281,31 @@ type ConsentSubscriptionResponse = {
|
|
|
189
281
|
} & {
|
|
190
282
|
[key: string]: any;
|
|
191
283
|
};
|
|
284
|
+
/**
|
|
285
|
+
* @type ConsentSubscriptionUpdateResponse: Single subscription update response
|
|
286
|
+
*
|
|
287
|
+
* @property subscriptionId: Identifier for the communication subscription
|
|
288
|
+
* - **Pattern:** /^[a-z0-9]+(?:-[a-z0-9]+)*$/
|
|
289
|
+
* - **Min Length:** 1
|
|
290
|
+
* - **Max Length:** 255
|
|
291
|
+
*
|
|
292
|
+
* @property channel:
|
|
293
|
+
*
|
|
294
|
+
* @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`
|
|
295
|
+
* - **Min Length:** 3
|
|
296
|
+
* - **Max Length:** 320
|
|
297
|
+
*
|
|
298
|
+
* @property status:
|
|
299
|
+
*
|
|
300
|
+
*/
|
|
301
|
+
type ConsentSubscriptionUpdateResponse = {
|
|
302
|
+
subscriptionId: string;
|
|
303
|
+
channel: ChannelType;
|
|
304
|
+
contactPointValue: string;
|
|
305
|
+
status: ConsentStatus;
|
|
306
|
+
} & {
|
|
307
|
+
[key: string]: any;
|
|
308
|
+
};
|
|
192
309
|
/**
|
|
193
310
|
* A specialized value indicating the system default values for locales.
|
|
194
311
|
*/
|
|
@@ -221,10 +338,12 @@ type ErrorResponse = {
|
|
|
221
338
|
* 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
339
|
*/
|
|
223
340
|
type LocaleCode$0 = DefaultFallback | string;
|
|
341
|
+
type GetSubscriptionsExpandEnum = "consentStatus";
|
|
224
342
|
type getSubscriptionsQueryParameters = {
|
|
225
343
|
siteId: string;
|
|
226
344
|
locale?: LocaleCode$0;
|
|
227
345
|
tags?: Array<string>;
|
|
346
|
+
expand?: Set<"consentStatus">;
|
|
228
347
|
};
|
|
229
348
|
type getSubscriptionsPathParameters = {
|
|
230
349
|
organizationId: string;
|
|
@@ -236,14 +355,21 @@ type updateSubscriptionQueryParameters = {
|
|
|
236
355
|
type updateSubscriptionPathParameters = {
|
|
237
356
|
organizationId: string;
|
|
238
357
|
};
|
|
358
|
+
type updateSubscriptionsQueryParameters = {
|
|
359
|
+
siteId: string;
|
|
360
|
+
locale?: LocaleCode$0;
|
|
361
|
+
};
|
|
362
|
+
type updateSubscriptionsPathParameters = {
|
|
363
|
+
organizationId: string;
|
|
364
|
+
};
|
|
239
365
|
/**
|
|
240
366
|
* All path parameters that are used by at least one ShopperConsents method.
|
|
241
367
|
*/
|
|
242
|
-
type ShopperConsentsPathParameters = Partial<getSubscriptionsPathParameters & updateSubscriptionPathParameters & {}>;
|
|
368
|
+
type ShopperConsentsPathParameters = Partial<getSubscriptionsPathParameters & updateSubscriptionPathParameters & updateSubscriptionsPathParameters & {}>;
|
|
243
369
|
/**
|
|
244
370
|
* All query parameters that are used by at least one ShopperConsents method.
|
|
245
371
|
*/
|
|
246
|
-
type ShopperConsentsQueryParameters = Partial<getSubscriptionsQueryParameters & updateSubscriptionQueryParameters & {}>;
|
|
372
|
+
type ShopperConsentsQueryParameters = Partial<getSubscriptionsQueryParameters & updateSubscriptionQueryParameters & updateSubscriptionsQueryParameters & {}>;
|
|
247
373
|
/**
|
|
248
374
|
* All parameters that are used by ShopperConsents.
|
|
249
375
|
*/
|
|
@@ -252,18 +378,21 @@ type ShopperConsentsParameters = ShopperConsentsPathParameters & BaseUriParamete
|
|
|
252
378
|
* [Shopper Consents](https://developer.salesforce.com/docs/commerce/commerce-api/references?meta=shopper-consents:Summary)
|
|
253
379
|
* ==================================
|
|
254
380
|
*
|
|
255
|
-
*
|
|
381
|
+
* *[Download API specification](https://developer.salesforce.com/static/commercecloud/commerce-api/shopper-consents/shopper-consents-oas-v1-public.yaml)
|
|
256
382
|
|
|
257
|
-
|
|
383
|
+
# API Overview
|
|
258
384
|
|
|
259
385
|
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
386
|
|
|
261
387
|
## Key Features
|
|
262
388
|
|
|
263
|
-
-
|
|
264
|
-
-
|
|
265
|
-
-
|
|
266
|
-
-
|
|
389
|
+
- **Retrieve communication subscriptions**: Retrieve relevant communication subscription options with rich display information.
|
|
390
|
+
- Communication subscription options can be filtered by one or more qualifying tags.
|
|
391
|
+
- Use the `expand` parameter to conditionally include subscription status.
|
|
392
|
+
- **Update individual subscription consent**: Update consent status for a single subscription with simple request/response pattern.
|
|
393
|
+
- **Bulk subscription updates**: Efficiently manage multiple subscription preferences with a single request.
|
|
394
|
+
- Update 1-50 subscriptions per bulk request.
|
|
395
|
+
- Partial success handling with detailed error reporting for failed updates.
|
|
267
396
|
|
|
268
397
|
## Authentication & Authorization
|
|
269
398
|
|
|
@@ -276,68 +405,98 @@ type ShopperConsentsParameters = ShopperConsentsPathParameters & BaseUriParamete
|
|
|
276
405
|
### Required Scopes
|
|
277
406
|
|
|
278
407
|
- `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.
|
|
408
|
+
- `sfcc.shopper-consents.rw`: Required for creating and modifying communication subscription consent data (POST operations).
|
|
289
409
|
|
|
290
410
|
## Data Model
|
|
291
411
|
|
|
292
412
|
### Subscriptions
|
|
293
413
|
Subscriptions represent a shopper's consent to receive specific types of marketing communications. Each subscription includes:
|
|
294
414
|
|
|
295
|
-
-
|
|
296
|
-
-
|
|
297
|
-
-
|
|
298
|
-
-
|
|
299
|
-
-
|
|
415
|
+
- **Subscription Id**: Descriptive identifier
|
|
416
|
+
- **Channels**: Array of communication methods - Email, SMS, or WhatsApp
|
|
417
|
+
- **Consent Type**: Marketing or legal subscription classification
|
|
418
|
+
- **Consent Required**: Whether the subscription is mandatory for the shopper
|
|
419
|
+
- **Default Status**: Default opt-in or opt-out behavior
|
|
420
|
+
- **Consent Status**: Array of status entries for each channel showing current opt-in or opt-out status (conditionally returned based on expand parameter)
|
|
421
|
+
- **Rich Display Information**:
|
|
422
|
+
- Title: Simple localized string for subscription name
|
|
423
|
+
- Subtitle: Simple localized string with HTML markup support for descriptions
|
|
424
|
+
- Localized content determined by the locale parameter
|
|
425
|
+
- **Tags**: Categorical tags indicating where the subscription option can appear (defaults to empty array, max 10 tags)
|
|
300
426
|
|
|
301
427
|
### Channels
|
|
302
428
|
Channels define the communication methods available for a subscription:
|
|
303
429
|
- `email`: Email communications
|
|
304
430
|
- `sms`: SMS/text messages
|
|
305
|
-
- `whatsapp`: WhatsApp
|
|
431
|
+
- `whatsapp`: WhatsApp messaging
|
|
306
432
|
|
|
307
433
|
### Tags
|
|
308
434
|
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
435
|
- `homepage_banner`: Main website homepage
|
|
310
|
-
- `registration`: Shopper registration
|
|
311
|
-
- `checkout`: Checkout
|
|
312
|
-
- `user_profile`: User profile management
|
|
436
|
+
- `registration`: Shopper registration form
|
|
437
|
+
- `checkout`: Checkout flow
|
|
438
|
+
- `user_profile`: User profile management section
|
|
313
439
|
|
|
314
|
-
|
|
440
|
+
### Default Values
|
|
441
|
+
The API provides sensible defaults for optional fields to simplify integration:
|
|
442
|
+
- **Consent Type**: Defaults to "marketing" for marketing communications
|
|
443
|
+
- **Consent Required**: Defaults to false, making subscriptions optional by default
|
|
444
|
+
- **Default Status**: Defaults to "opt_out" to respect privacy-first principles
|
|
445
|
+
- **Tags**: Defaults to an empty array when not specified
|
|
315
446
|
|
|
316
|
-
|
|
317
|
-
- Make it easy for shoppers to update their preferences.
|
|
318
|
-
- Respect shopper choices immediately.
|
|
447
|
+
## Advanced Features
|
|
319
448
|
|
|
320
|
-
###
|
|
321
|
-
|
|
449
|
+
### Expand Parameter
|
|
450
|
+
The `expand` parameter provides conditional field inclusion:
|
|
451
|
+
- `expand=[]` (default): Returns basic subscription information
|
|
452
|
+
- `expand=["consentStatus"]`: Include consent status information in the response
|
|
453
|
+
- Future expansion may include additional fields
|
|
454
|
+
|
|
455
|
+
### Single Subscription Updates
|
|
456
|
+
Update consent for one subscription at a time:
|
|
457
|
+
- **Endpoint**: `POST /organizations/{organizationId}/subscriptions`
|
|
458
|
+
- **Request**: Requires subscriptionId, contactPointValue, channel, and status
|
|
459
|
+
- **Response**: Returns the same parameters on success (HTTP 200)
|
|
460
|
+
- **Use Case**: Ideal for real-time updates as shoppers interact with individual preferences
|
|
322
461
|
|
|
323
|
-
###
|
|
324
|
-
|
|
325
|
-
-
|
|
326
|
-
-
|
|
462
|
+
### Bulk Operations
|
|
463
|
+
Efficiently manage multiple subscription preferences in a single request:
|
|
464
|
+
- **Endpoint**: `POST /organizations/{organizationId}/subscriptions/actions/bulk`
|
|
465
|
+
- **Request Limits**: 1-50 subscriptions per bulk request
|
|
466
|
+
- **Response Handling**:
|
|
467
|
+
- HTTP 200: All updates successful
|
|
468
|
+
- HTTP 207 Multi-Status: Partial success with detailed error reporting
|
|
469
|
+
- HTTP 400: Request validation failure
|
|
470
|
+
- **Error Isolation**: Failed updates don't affect successful ones
|
|
471
|
+
- **Individual Results**: Each subscription update returns:
|
|
472
|
+
- Original input parameters (subscriptionId, contactPointValue, channel, status)
|
|
473
|
+
- Success/failure status
|
|
474
|
+
- Detailed error information for failed updates
|
|
475
|
+
- No full subscription objects returned for improved performance
|
|
327
476
|
|
|
328
477
|
## Error Handling
|
|
329
478
|
|
|
330
479
|
The API uses standard HTTP status codes and returns detailed error information to help with troubleshooting:
|
|
331
480
|
|
|
332
|
-
- `
|
|
333
|
-
- `
|
|
334
|
-
- `
|
|
335
|
-
|
|
336
|
-
|
|
481
|
+
- `200 OK`: Successful operation (single or bulk with all successes)
|
|
482
|
+
- `207 Multi-Status`: Bulk operation with partial success
|
|
483
|
+
- `400 Bad Request`: Invalid request format, missing required fields, or markup validation errors
|
|
484
|
+
|
|
485
|
+
## Best Practices
|
|
486
|
+
|
|
487
|
+
### User Experience
|
|
488
|
+
- Make it easy for shoppers to update their preferences.
|
|
489
|
+
- Respect shopper choices immediately.
|
|
337
490
|
|
|
338
|
-
|
|
491
|
+
### Implementation Guidelines
|
|
492
|
+
- Implement clear and prominent unsubscribe mechanisms.
|
|
493
|
+
- Validate HTML markup content to prevent XSS vulnerabilities.
|
|
494
|
+
- Handle partial success scenarios gracefully in bulk operations.
|
|
339
495
|
|
|
340
|
-
|
|
496
|
+
### Performance Considerations
|
|
497
|
+
- Use single subscription updates for real-time, interactive preference changes.
|
|
498
|
+
- Use bulk operations when updating multiple subscriptions to reduce API calls and improve performance.
|
|
499
|
+
- Only request status information when needed using the expand parameter to reduce latency.*<br />
|
|
341
500
|
*
|
|
342
501
|
* Simple example:
|
|
343
502
|
*
|
|
@@ -371,6 +530,7 @@ declare class ShopperConsents<ConfigParameters extends ShopperConsentsParameters
|
|
|
371
530
|
static readonly apiPaths: {
|
|
372
531
|
getSubscriptions: string;
|
|
373
532
|
updateSubscription: string;
|
|
533
|
+
updateSubscriptions: string;
|
|
374
534
|
};
|
|
375
535
|
constructor(config: ClientConfigInit<ConfigParameters>);
|
|
376
536
|
static readonly paramKeys: {
|
|
@@ -378,7 +538,8 @@ declare class ShopperConsents<ConfigParameters extends ShopperConsentsParameters
|
|
|
378
538
|
"organizationId",
|
|
379
539
|
"siteId",
|
|
380
540
|
"locale",
|
|
381
|
-
"tags"
|
|
541
|
+
"tags",
|
|
542
|
+
"expand"
|
|
382
543
|
];
|
|
383
544
|
readonly getSubscriptionsRequired: readonly [
|
|
384
545
|
"organizationId",
|
|
@@ -393,9 +554,26 @@ declare class ShopperConsents<ConfigParameters extends ShopperConsentsParameters
|
|
|
393
554
|
"organizationId",
|
|
394
555
|
"siteId"
|
|
395
556
|
];
|
|
557
|
+
readonly updateSubscriptions: readonly [
|
|
558
|
+
"organizationId",
|
|
559
|
+
"siteId",
|
|
560
|
+
"locale"
|
|
561
|
+
];
|
|
562
|
+
readonly updateSubscriptionsRequired: readonly [
|
|
563
|
+
"organizationId",
|
|
564
|
+
"siteId"
|
|
565
|
+
];
|
|
396
566
|
};
|
|
397
567
|
/**
|
|
398
|
-
* Retrieve all
|
|
568
|
+
* Retrieve all subscription preferences for the shopper (authenticated or guest).
|
|
569
|
+
|
|
570
|
+
Use the 'expand' parameter to include additional fields in the response:
|
|
571
|
+
- expand=["consentStatus"]: Include subscription status information
|
|
572
|
+
- expand=[]: Default behavior, excludes status for privacy and performance
|
|
573
|
+
|
|
574
|
+
The expand parameter provides privacy benefits by not exposing sensitive status
|
|
575
|
+
information unless explicitly requested.
|
|
576
|
+
|
|
399
577
|
*
|
|
400
578
|
* If you would like to get a raw Response object use the other getSubscriptions function.
|
|
401
579
|
*
|
|
@@ -405,6 +583,13 @@ declare class ShopperConsents<ConfigParameters extends ShopperConsentsParameters
|
|
|
405
583
|
* @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
584
|
* @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
585
|
* @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.
|
|
586
|
+
* @param options.parameters.expand - Optional parameter to expand response with additional fields.
|
|
587
|
+
Accepts an array of field names to include in the response.
|
|
588
|
+
Currently supports:
|
|
589
|
+
- "consentStatus": Include consent status information in the response
|
|
590
|
+
|
|
591
|
+
Future expansions may include additional fields.
|
|
592
|
+
|
|
408
593
|
* @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
|
|
409
594
|
*
|
|
410
595
|
* @returns A promise of type ConsentSubscriptionResponse.
|
|
@@ -415,13 +600,22 @@ declare class ShopperConsents<ConfigParameters extends ShopperConsentsParameters
|
|
|
415
600
|
siteId: string;
|
|
416
601
|
locale?: LocaleCode$0;
|
|
417
602
|
tags?: Array<string>;
|
|
603
|
+
expand?: Set<GetSubscriptionsExpandEnum>;
|
|
418
604
|
} & QueryParameters, ConfigParameters>;
|
|
419
605
|
headers?: {
|
|
420
606
|
[key: string]: string;
|
|
421
607
|
};
|
|
422
608
|
}>): Promise<ConsentSubscriptionResponse>;
|
|
423
609
|
/**
|
|
424
|
-
* Retrieve all
|
|
610
|
+
* Retrieve all subscription preferences for the shopper (authenticated or guest).
|
|
611
|
+
|
|
612
|
+
Use the 'expand' parameter to include additional fields in the response:
|
|
613
|
+
- expand=["consentStatus"]: Include subscription status information
|
|
614
|
+
- expand=[]: Default behavior, excludes status for privacy and performance
|
|
615
|
+
|
|
616
|
+
The expand parameter provides privacy benefits by not exposing sensitive status
|
|
617
|
+
information unless explicitly requested.
|
|
618
|
+
|
|
425
619
|
*
|
|
426
620
|
* @param options - An object containing the options for this method.
|
|
427
621
|
* @param options.parameters - An object containing the parameters for this method.
|
|
@@ -429,6 +623,13 @@ declare class ShopperConsents<ConfigParameters extends ShopperConsentsParameters
|
|
|
429
623
|
* @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
624
|
* @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
625
|
* @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.
|
|
626
|
+
* @param options.parameters.expand - Optional parameter to expand response with additional fields.
|
|
627
|
+
Accepts an array of field names to include in the response.
|
|
628
|
+
Currently supports:
|
|
629
|
+
- "consentStatus": Include consent status information in the response
|
|
630
|
+
|
|
631
|
+
Future expansions may include additional fields.
|
|
632
|
+
|
|
432
633
|
* @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
|
|
433
634
|
* @param rawResponse - Set to true to return entire Response object instead of DTO.
|
|
434
635
|
*
|
|
@@ -440,13 +641,14 @@ declare class ShopperConsents<ConfigParameters extends ShopperConsentsParameters
|
|
|
440
641
|
siteId: string;
|
|
441
642
|
locale?: LocaleCode$0;
|
|
442
643
|
tags?: Array<string>;
|
|
644
|
+
expand?: Set<GetSubscriptionsExpandEnum>;
|
|
443
645
|
} & QueryParameters, ConfigParameters>;
|
|
444
646
|
headers?: {
|
|
445
647
|
[key: string]: string;
|
|
446
648
|
};
|
|
447
649
|
}>, rawResponse?: T): Promise<T extends true ? Response : ConsentSubscriptionResponse>;
|
|
448
650
|
/**
|
|
449
|
-
* Update the consent status for a
|
|
651
|
+
* Update the consent status for a single subscription.
|
|
450
652
|
*
|
|
451
653
|
* If you would like to get a raw Response object use the other updateSubscription function.
|
|
452
654
|
*
|
|
@@ -458,7 +660,7 @@ declare class ShopperConsents<ConfigParameters extends ShopperConsentsParameters
|
|
|
458
660
|
* @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
|
|
459
661
|
* @param options.body - The data to send as the request body.
|
|
460
662
|
*
|
|
461
|
-
* @returns A promise of type
|
|
663
|
+
* @returns A promise of type ConsentSubscriptionUpdateResponse.
|
|
462
664
|
*/
|
|
463
665
|
updateSubscription(options: RequireParametersUnlessAllAreOptional<{
|
|
464
666
|
parameters?: CompositeParameters<{
|
|
@@ -470,9 +672,9 @@ declare class ShopperConsents<ConfigParameters extends ShopperConsentsParameters
|
|
|
470
672
|
[key: string]: string;
|
|
471
673
|
};
|
|
472
674
|
body: ConsentSubscriptionRequest & CustomRequestBody;
|
|
473
|
-
}>): Promise<
|
|
675
|
+
}>): Promise<ConsentSubscriptionUpdateResponse>;
|
|
474
676
|
/**
|
|
475
|
-
* Update the consent status for a
|
|
677
|
+
* Update the consent status for a single subscription.
|
|
476
678
|
*
|
|
477
679
|
* @param options - An object containing the options for this method.
|
|
478
680
|
* @param options.parameters - An object containing the parameters for this method.
|
|
@@ -483,7 +685,7 @@ declare class ShopperConsents<ConfigParameters extends ShopperConsentsParameters
|
|
|
483
685
|
* @param options.body - The data to send as the request body.
|
|
484
686
|
* @param rawResponse - Set to true to return entire Response object instead of DTO.
|
|
485
687
|
*
|
|
486
|
-
* @returns A promise of type Response if rawResponse is true, a promise of type
|
|
688
|
+
* @returns A promise of type Response if rawResponse is true, a promise of type ConsentSubscriptionUpdateResponse otherwise.
|
|
487
689
|
*/
|
|
488
690
|
updateSubscription<T extends boolean>(options: RequireParametersUnlessAllAreOptional<{
|
|
489
691
|
parameters?: CompositeParameters<{
|
|
@@ -495,7 +697,58 @@ declare class ShopperConsents<ConfigParameters extends ShopperConsentsParameters
|
|
|
495
697
|
[key: string]: string;
|
|
496
698
|
};
|
|
497
699
|
body: ConsentSubscriptionRequest & CustomRequestBody;
|
|
498
|
-
}>, rawResponse?: T): Promise<T extends true ? Response :
|
|
700
|
+
}>, rawResponse?: T): Promise<T extends true ? Response : ConsentSubscriptionUpdateResponse>;
|
|
701
|
+
/**
|
|
702
|
+
* Update the consent status for multiple subscriptions in a single bulk request. Supports 1-50 subscription updates per request with partial success handling.
|
|
703
|
+
*
|
|
704
|
+
* If you would like to get a raw Response object use the other updateSubscriptions function.
|
|
705
|
+
*
|
|
706
|
+
* @param options - An object containing the options for this method.
|
|
707
|
+
* @param options.parameters - An object containing the parameters for this method.
|
|
708
|
+
* @param options.parameters.organizationId - An identifier for the organization the request is being made by
|
|
709
|
+
* @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.
|
|
710
|
+
* @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.
|
|
711
|
+
* @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
|
|
712
|
+
* @param options.body - The data to send as the request body.
|
|
713
|
+
*
|
|
714
|
+
* @returns A promise of type ConsentSubscriptionBulkResponse.
|
|
715
|
+
*/
|
|
716
|
+
updateSubscriptions(options: RequireParametersUnlessAllAreOptional<{
|
|
717
|
+
parameters?: CompositeParameters<{
|
|
718
|
+
organizationId: string;
|
|
719
|
+
siteId: string;
|
|
720
|
+
locale?: LocaleCode$0;
|
|
721
|
+
} & QueryParameters, ConfigParameters>;
|
|
722
|
+
headers?: {
|
|
723
|
+
[key: string]: string;
|
|
724
|
+
};
|
|
725
|
+
body: ConsentSubscriptionBulkRequest & CustomRequestBody;
|
|
726
|
+
}>): Promise<ConsentSubscriptionBulkResponse>;
|
|
727
|
+
/**
|
|
728
|
+
* Update the consent status for multiple subscriptions in a single bulk request. Supports 1-50 subscription updates per request with partial success handling.
|
|
729
|
+
*
|
|
730
|
+
* @param options - An object containing the options for this method.
|
|
731
|
+
* @param options.parameters - An object containing the parameters for this method.
|
|
732
|
+
* @param options.parameters.organizationId - An identifier for the organization the request is being made by
|
|
733
|
+
* @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.
|
|
734
|
+
* @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.
|
|
735
|
+
* @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
|
|
736
|
+
* @param options.body - The data to send as the request body.
|
|
737
|
+
* @param rawResponse - Set to true to return entire Response object instead of DTO.
|
|
738
|
+
*
|
|
739
|
+
* @returns A promise of type Response if rawResponse is true, a promise of type ConsentSubscriptionBulkResponse otherwise.
|
|
740
|
+
*/
|
|
741
|
+
updateSubscriptions<T extends boolean>(options: RequireParametersUnlessAllAreOptional<{
|
|
742
|
+
parameters?: CompositeParameters<{
|
|
743
|
+
organizationId: string;
|
|
744
|
+
siteId: string;
|
|
745
|
+
locale?: LocaleCode$0;
|
|
746
|
+
} & QueryParameters, ConfigParameters>;
|
|
747
|
+
headers?: {
|
|
748
|
+
[key: string]: string;
|
|
749
|
+
};
|
|
750
|
+
body: ConsentSubscriptionBulkRequest & CustomRequestBody;
|
|
751
|
+
}>, rawResponse?: T): Promise<T extends true ? Response : ConsentSubscriptionBulkResponse>;
|
|
499
752
|
}
|
|
500
753
|
declare namespace ShopperConsentsApiTypes {
|
|
501
754
|
/*
|
|
@@ -606,14 +859,33 @@ declare namespace ShopperConsentsApiTypes {
|
|
|
606
859
|
constructor(config: ClientConfigInit<Params>);
|
|
607
860
|
static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
|
|
608
861
|
}
|
|
862
|
+
/**
|
|
863
|
+
*
|
|
864
|
+
*/
|
|
865
|
+
type ChannelType = "email" | "sms" | "whatsapp";
|
|
609
866
|
/**
|
|
610
867
|
* The consent status of the subscription as supplied or recorded by this system
|
|
611
868
|
*/
|
|
612
869
|
type ConsentStatus = "opt_in" | "opt_out";
|
|
613
870
|
/**
|
|
871
|
+
* @type SubscriptionStatusEntry: Individual subscription status entry for a specific channel
|
|
872
|
+
*
|
|
873
|
+
* @property channel:
|
|
874
|
+
*
|
|
875
|
+
* @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`
|
|
876
|
+
* - **Min Length:** 3
|
|
877
|
+
* - **Max Length:** 320
|
|
878
|
+
*
|
|
879
|
+
* @property status:
|
|
614
880
|
*
|
|
615
881
|
*/
|
|
616
|
-
type
|
|
882
|
+
type SubscriptionStatusEntry = {
|
|
883
|
+
channel: ChannelType;
|
|
884
|
+
contactPointValue: string;
|
|
885
|
+
status: ConsentStatus;
|
|
886
|
+
} & {
|
|
887
|
+
[key: string]: any;
|
|
888
|
+
};
|
|
617
889
|
/**
|
|
618
890
|
* @type ConsentSubscription:
|
|
619
891
|
*
|
|
@@ -622,41 +894,42 @@ declare namespace ShopperConsentsApiTypes {
|
|
|
622
894
|
* - **Min Length:** 1
|
|
623
895
|
* - **Max Length:** 255
|
|
624
896
|
*
|
|
625
|
-
* @property
|
|
626
|
-
* - **Min Length:** 19
|
|
627
|
-
* - **Max Length:** 339
|
|
897
|
+
* @property channels:
|
|
628
898
|
*
|
|
629
|
-
* @property
|
|
630
|
-
* - **Min Length:** 3
|
|
631
|
-
* - **Max Length:** 320
|
|
632
|
-
*
|
|
633
|
-
* @property channel:
|
|
634
|
-
*
|
|
635
|
-
* @property status:
|
|
899
|
+
* @property consentStatus: Array of subscription status entries for different channels
|
|
636
900
|
*
|
|
637
|
-
* @property title:
|
|
901
|
+
* @property title: The localized title of the subscription for shopper displays
|
|
638
902
|
* - **Min Length:** 1
|
|
639
903
|
* - **Max Length:** 255
|
|
640
904
|
*
|
|
641
|
-
* @property subtitle:
|
|
905
|
+
* @property subtitle: The localized subtitle of the subscription for shopper displays, may contain HTML markup
|
|
642
906
|
* - **Min Length:** 1
|
|
643
|
-
* - **Max Length:**
|
|
907
|
+
* - **Max Length:** 2000
|
|
644
908
|
*
|
|
645
909
|
* @property tags:
|
|
646
910
|
*
|
|
911
|
+
* @property consentType: Type of consent subscription
|
|
912
|
+
*
|
|
913
|
+
* @property consentRequired: Whether this subscription is mandatory for the user
|
|
914
|
+
*
|
|
915
|
+
* @property defaultStatus: Default consent status for this subscription
|
|
916
|
+
*
|
|
647
917
|
*/
|
|
648
918
|
type ConsentSubscription = {
|
|
649
919
|
subscriptionId: string;
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
channel: SubscriptionChannel;
|
|
653
|
-
status?: ConsentStatus;
|
|
920
|
+
channels: Set<ChannelType>;
|
|
921
|
+
consentStatus?: Array<SubscriptionStatusEntry>;
|
|
654
922
|
title?: string;
|
|
655
923
|
subtitle?: string;
|
|
656
924
|
tags?: Array<string>;
|
|
925
|
+
consentType?: ConsentSubscriptionConsentTypeEnum;
|
|
926
|
+
consentRequired?: boolean;
|
|
927
|
+
defaultStatus?: ConsentSubscriptionDefaultStatusEnum;
|
|
657
928
|
} & {
|
|
658
929
|
[key: string]: any;
|
|
659
930
|
};
|
|
931
|
+
type ConsentSubscriptionConsentTypeEnum = "marketing" | "legal";
|
|
932
|
+
type ConsentSubscriptionDefaultStatusEnum = "opt_in" | "opt_out";
|
|
660
933
|
/**
|
|
661
934
|
* @type ConsentSubscriptionRequest: Consent subscription update request
|
|
662
935
|
*
|
|
@@ -677,8 +950,80 @@ declare namespace ShopperConsentsApiTypes {
|
|
|
677
950
|
type ConsentSubscriptionRequest = {
|
|
678
951
|
subscriptionId: string;
|
|
679
952
|
contactPointValue: string;
|
|
680
|
-
channel:
|
|
953
|
+
channel: ChannelType;
|
|
954
|
+
status: ConsentStatus;
|
|
955
|
+
} & {
|
|
956
|
+
[key: string]: any;
|
|
957
|
+
};
|
|
958
|
+
/**
|
|
959
|
+
* @type ConsentSubscriptionBulkRequest: Bulk request for updating multiple consent subscriptions
|
|
960
|
+
*
|
|
961
|
+
* @property subscriptions: Array of subscription consent updates to process
|
|
962
|
+
*
|
|
963
|
+
*/
|
|
964
|
+
type ConsentSubscriptionBulkRequest = {
|
|
965
|
+
subscriptions: Array<ConsentSubscriptionRequest>;
|
|
966
|
+
} & {
|
|
967
|
+
[key: string]: any;
|
|
968
|
+
};
|
|
969
|
+
/**
|
|
970
|
+
* @type ConsentSubscriptionError: Error details for failed subscription updates
|
|
971
|
+
*
|
|
972
|
+
* @property code: Error code indicating the type of failure
|
|
973
|
+
* - **Max Length:** 100
|
|
974
|
+
*
|
|
975
|
+
* @property message: Human-readable error message
|
|
976
|
+
* - **Max Length:** 500
|
|
977
|
+
*
|
|
978
|
+
* @property details: Additional error details
|
|
979
|
+
*
|
|
980
|
+
*/
|
|
981
|
+
type ConsentSubscriptionError = {
|
|
982
|
+
code: string;
|
|
983
|
+
message: string;
|
|
984
|
+
details?: object;
|
|
985
|
+
} & {
|
|
986
|
+
[key: string]: any;
|
|
987
|
+
};
|
|
988
|
+
/**
|
|
989
|
+
* @type ConsentSubscriptionResult: Individual subscription update result with input parameters
|
|
990
|
+
*
|
|
991
|
+
* @property subscriptionId: Identifier for the communication subscription
|
|
992
|
+
* - **Pattern:** /^[a-z0-9]+(?:-[a-z0-9]+)*$/
|
|
993
|
+
* - **Min Length:** 1
|
|
994
|
+
* - **Max Length:** 255
|
|
995
|
+
*
|
|
996
|
+
* @property channel:
|
|
997
|
+
*
|
|
998
|
+
* @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`
|
|
999
|
+
* - **Min Length:** 3
|
|
1000
|
+
* - **Max Length:** 320
|
|
1001
|
+
*
|
|
1002
|
+
* @property status:
|
|
1003
|
+
*
|
|
1004
|
+
* @property success: Whether the subscription update was successful
|
|
1005
|
+
*
|
|
1006
|
+
* @property error:
|
|
1007
|
+
*
|
|
1008
|
+
*/
|
|
1009
|
+
type ConsentSubscriptionResult = {
|
|
1010
|
+
subscriptionId: string;
|
|
1011
|
+
channel: ChannelType;
|
|
1012
|
+
contactPointValue: string;
|
|
681
1013
|
status: ConsentStatus;
|
|
1014
|
+
success: boolean;
|
|
1015
|
+
error?: ConsentSubscriptionError;
|
|
1016
|
+
} & {
|
|
1017
|
+
[key: string]: any;
|
|
1018
|
+
};
|
|
1019
|
+
/**
|
|
1020
|
+
* @type ConsentSubscriptionBulkResponse: Bulk response with results for each subscription update request
|
|
1021
|
+
*
|
|
1022
|
+
* @property results: Results for each subscription update request
|
|
1023
|
+
*
|
|
1024
|
+
*/
|
|
1025
|
+
type ConsentSubscriptionBulkResponse = {
|
|
1026
|
+
results: Array<ConsentSubscriptionResult>;
|
|
682
1027
|
} & {
|
|
683
1028
|
[key: string]: any;
|
|
684
1029
|
};
|
|
@@ -693,6 +1038,31 @@ declare namespace ShopperConsentsApiTypes {
|
|
|
693
1038
|
} & {
|
|
694
1039
|
[key: string]: any;
|
|
695
1040
|
};
|
|
1041
|
+
/**
|
|
1042
|
+
* @type ConsentSubscriptionUpdateResponse: Single subscription update response
|
|
1043
|
+
*
|
|
1044
|
+
* @property subscriptionId: Identifier for the communication subscription
|
|
1045
|
+
* - **Pattern:** /^[a-z0-9]+(?:-[a-z0-9]+)*$/
|
|
1046
|
+
* - **Min Length:** 1
|
|
1047
|
+
* - **Max Length:** 255
|
|
1048
|
+
*
|
|
1049
|
+
* @property channel:
|
|
1050
|
+
*
|
|
1051
|
+
* @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`
|
|
1052
|
+
* - **Min Length:** 3
|
|
1053
|
+
* - **Max Length:** 320
|
|
1054
|
+
*
|
|
1055
|
+
* @property status:
|
|
1056
|
+
*
|
|
1057
|
+
*/
|
|
1058
|
+
type ConsentSubscriptionUpdateResponse = {
|
|
1059
|
+
subscriptionId: string;
|
|
1060
|
+
channel: ChannelType;
|
|
1061
|
+
contactPointValue: string;
|
|
1062
|
+
status: ConsentStatus;
|
|
1063
|
+
} & {
|
|
1064
|
+
[key: string]: any;
|
|
1065
|
+
};
|
|
696
1066
|
/**
|
|
697
1067
|
* A specialized value indicating the system default values for locales.
|
|
698
1068
|
*/
|
|
@@ -725,10 +1095,12 @@ declare namespace ShopperConsentsApiTypes {
|
|
|
725
1095
|
* 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
1096
|
*/
|
|
727
1097
|
type LocaleCode$0 = DefaultFallback | string;
|
|
1098
|
+
type GetSubscriptionsExpandEnum = "consentStatus";
|
|
728
1099
|
type getSubscriptionsQueryParameters = {
|
|
729
1100
|
siteId: string;
|
|
730
1101
|
locale?: LocaleCode$0;
|
|
731
1102
|
tags?: Array<string>;
|
|
1103
|
+
expand?: Set<"consentStatus">;
|
|
732
1104
|
};
|
|
733
1105
|
type getSubscriptionsPathParameters = {
|
|
734
1106
|
organizationId: string;
|
|
@@ -740,14 +1112,21 @@ declare namespace ShopperConsentsApiTypes {
|
|
|
740
1112
|
type updateSubscriptionPathParameters = {
|
|
741
1113
|
organizationId: string;
|
|
742
1114
|
};
|
|
1115
|
+
type updateSubscriptionsQueryParameters = {
|
|
1116
|
+
siteId: string;
|
|
1117
|
+
locale?: LocaleCode$0;
|
|
1118
|
+
};
|
|
1119
|
+
type updateSubscriptionsPathParameters = {
|
|
1120
|
+
organizationId: string;
|
|
1121
|
+
};
|
|
743
1122
|
/**
|
|
744
1123
|
* All path parameters that are used by at least one ShopperConsents method.
|
|
745
1124
|
*/
|
|
746
|
-
type ShopperConsentsPathParameters = Partial<getSubscriptionsPathParameters & updateSubscriptionPathParameters & {}>;
|
|
1125
|
+
type ShopperConsentsPathParameters = Partial<getSubscriptionsPathParameters & updateSubscriptionPathParameters & updateSubscriptionsPathParameters & {}>;
|
|
747
1126
|
/**
|
|
748
1127
|
* All query parameters that are used by at least one ShopperConsents method.
|
|
749
1128
|
*/
|
|
750
|
-
type ShopperConsentsQueryParameters = Partial<getSubscriptionsQueryParameters & updateSubscriptionQueryParameters & {}>;
|
|
1129
|
+
type ShopperConsentsQueryParameters = Partial<getSubscriptionsQueryParameters & updateSubscriptionQueryParameters & updateSubscriptionsQueryParameters & {}>;
|
|
751
1130
|
/**
|
|
752
1131
|
* All parameters that are used by ShopperConsents.
|
|
753
1132
|
*/
|
|
@@ -756,18 +1135,21 @@ declare namespace ShopperConsentsApiTypes {
|
|
|
756
1135
|
* [Shopper Consents](https://developer.salesforce.com/docs/commerce/commerce-api/references?meta=shopper-consents:Summary)
|
|
757
1136
|
* ==================================
|
|
758
1137
|
*
|
|
759
|
-
*
|
|
1138
|
+
* *[Download API specification](https://developer.salesforce.com/static/commercecloud/commerce-api/shopper-consents/shopper-consents-oas-v1-public.yaml)
|
|
760
1139
|
|
|
761
|
-
|
|
1140
|
+
# API Overview
|
|
762
1141
|
|
|
763
1142
|
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
1143
|
|
|
765
1144
|
## Key Features
|
|
766
1145
|
|
|
767
|
-
-
|
|
768
|
-
-
|
|
769
|
-
-
|
|
770
|
-
-
|
|
1146
|
+
- **Retrieve communication subscriptions**: Retrieve relevant communication subscription options with rich display information.
|
|
1147
|
+
- Communication subscription options can be filtered by one or more qualifying tags.
|
|
1148
|
+
- Use the `expand` parameter to conditionally include subscription status.
|
|
1149
|
+
- **Update individual subscription consent**: Update consent status for a single subscription with simple request/response pattern.
|
|
1150
|
+
- **Bulk subscription updates**: Efficiently manage multiple subscription preferences with a single request.
|
|
1151
|
+
- Update 1-50 subscriptions per bulk request.
|
|
1152
|
+
- Partial success handling with detailed error reporting for failed updates.
|
|
771
1153
|
|
|
772
1154
|
## Authentication & Authorization
|
|
773
1155
|
|
|
@@ -780,68 +1162,98 @@ declare namespace ShopperConsentsApiTypes {
|
|
|
780
1162
|
### Required Scopes
|
|
781
1163
|
|
|
782
1164
|
- `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.
|
|
1165
|
+
- `sfcc.shopper-consents.rw`: Required for creating and modifying communication subscription consent data (POST operations).
|
|
793
1166
|
|
|
794
1167
|
## Data Model
|
|
795
1168
|
|
|
796
1169
|
### Subscriptions
|
|
797
1170
|
Subscriptions represent a shopper's consent to receive specific types of marketing communications. Each subscription includes:
|
|
798
1171
|
|
|
799
|
-
-
|
|
800
|
-
-
|
|
801
|
-
-
|
|
802
|
-
-
|
|
803
|
-
-
|
|
1172
|
+
- **Subscription Id**: Descriptive identifier
|
|
1173
|
+
- **Channels**: Array of communication methods - Email, SMS, or WhatsApp
|
|
1174
|
+
- **Consent Type**: Marketing or legal subscription classification
|
|
1175
|
+
- **Consent Required**: Whether the subscription is mandatory for the shopper
|
|
1176
|
+
- **Default Status**: Default opt-in or opt-out behavior
|
|
1177
|
+
- **Consent Status**: Array of status entries for each channel showing current opt-in or opt-out status (conditionally returned based on expand parameter)
|
|
1178
|
+
- **Rich Display Information**:
|
|
1179
|
+
- Title: Simple localized string for subscription name
|
|
1180
|
+
- Subtitle: Simple localized string with HTML markup support for descriptions
|
|
1181
|
+
- Localized content determined by the locale parameter
|
|
1182
|
+
- **Tags**: Categorical tags indicating where the subscription option can appear (defaults to empty array, max 10 tags)
|
|
804
1183
|
|
|
805
1184
|
### Channels
|
|
806
1185
|
Channels define the communication methods available for a subscription:
|
|
807
1186
|
- `email`: Email communications
|
|
808
1187
|
- `sms`: SMS/text messages
|
|
809
|
-
- `whatsapp`: WhatsApp
|
|
1188
|
+
- `whatsapp`: WhatsApp messaging
|
|
810
1189
|
|
|
811
1190
|
### Tags
|
|
812
1191
|
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
1192
|
- `homepage_banner`: Main website homepage
|
|
814
|
-
- `registration`: Shopper registration
|
|
815
|
-
- `checkout`: Checkout
|
|
816
|
-
- `user_profile`: User profile management
|
|
1193
|
+
- `registration`: Shopper registration form
|
|
1194
|
+
- `checkout`: Checkout flow
|
|
1195
|
+
- `user_profile`: User profile management section
|
|
817
1196
|
|
|
818
|
-
|
|
1197
|
+
### Default Values
|
|
1198
|
+
The API provides sensible defaults for optional fields to simplify integration:
|
|
1199
|
+
- **Consent Type**: Defaults to "marketing" for marketing communications
|
|
1200
|
+
- **Consent Required**: Defaults to false, making subscriptions optional by default
|
|
1201
|
+
- **Default Status**: Defaults to "opt_out" to respect privacy-first principles
|
|
1202
|
+
- **Tags**: Defaults to an empty array when not specified
|
|
819
1203
|
|
|
820
|
-
|
|
821
|
-
- Make it easy for shoppers to update their preferences.
|
|
822
|
-
- Respect shopper choices immediately.
|
|
1204
|
+
## Advanced Features
|
|
823
1205
|
|
|
824
|
-
###
|
|
825
|
-
|
|
1206
|
+
### Expand Parameter
|
|
1207
|
+
The `expand` parameter provides conditional field inclusion:
|
|
1208
|
+
- `expand=[]` (default): Returns basic subscription information
|
|
1209
|
+
- `expand=["consentStatus"]`: Include consent status information in the response
|
|
1210
|
+
- Future expansion may include additional fields
|
|
1211
|
+
|
|
1212
|
+
### Single Subscription Updates
|
|
1213
|
+
Update consent for one subscription at a time:
|
|
1214
|
+
- **Endpoint**: `POST /organizations/{organizationId}/subscriptions`
|
|
1215
|
+
- **Request**: Requires subscriptionId, contactPointValue, channel, and status
|
|
1216
|
+
- **Response**: Returns the same parameters on success (HTTP 200)
|
|
1217
|
+
- **Use Case**: Ideal for real-time updates as shoppers interact with individual preferences
|
|
826
1218
|
|
|
827
|
-
###
|
|
828
|
-
|
|
829
|
-
-
|
|
830
|
-
-
|
|
1219
|
+
### Bulk Operations
|
|
1220
|
+
Efficiently manage multiple subscription preferences in a single request:
|
|
1221
|
+
- **Endpoint**: `POST /organizations/{organizationId}/subscriptions/actions/bulk`
|
|
1222
|
+
- **Request Limits**: 1-50 subscriptions per bulk request
|
|
1223
|
+
- **Response Handling**:
|
|
1224
|
+
- HTTP 200: All updates successful
|
|
1225
|
+
- HTTP 207 Multi-Status: Partial success with detailed error reporting
|
|
1226
|
+
- HTTP 400: Request validation failure
|
|
1227
|
+
- **Error Isolation**: Failed updates don't affect successful ones
|
|
1228
|
+
- **Individual Results**: Each subscription update returns:
|
|
1229
|
+
- Original input parameters (subscriptionId, contactPointValue, channel, status)
|
|
1230
|
+
- Success/failure status
|
|
1231
|
+
- Detailed error information for failed updates
|
|
1232
|
+
- No full subscription objects returned for improved performance
|
|
831
1233
|
|
|
832
1234
|
## Error Handling
|
|
833
1235
|
|
|
834
1236
|
The API uses standard HTTP status codes and returns detailed error information to help with troubleshooting:
|
|
835
1237
|
|
|
836
|
-
- `
|
|
837
|
-
- `
|
|
838
|
-
- `
|
|
839
|
-
- `404 Not Found`: Requested organization or resource not found
|
|
840
|
-
- `500 Internal Server Error`: Unexpected server error
|
|
1238
|
+
- `200 OK`: Successful operation (single or bulk with all successes)
|
|
1239
|
+
- `207 Multi-Status`: Bulk operation with partial success
|
|
1240
|
+
- `400 Bad Request`: Invalid request format, missing required fields, or markup validation errors
|
|
841
1241
|
|
|
842
|
-
##
|
|
1242
|
+
## Best Practices
|
|
1243
|
+
|
|
1244
|
+
### User Experience
|
|
1245
|
+
- Make it easy for shoppers to update their preferences.
|
|
1246
|
+
- Respect shopper choices immediately.
|
|
1247
|
+
|
|
1248
|
+
### Implementation Guidelines
|
|
1249
|
+
- Implement clear and prominent unsubscribe mechanisms.
|
|
1250
|
+
- Validate HTML markup content to prevent XSS vulnerabilities.
|
|
1251
|
+
- Handle partial success scenarios gracefully in bulk operations.
|
|
843
1252
|
|
|
844
|
-
|
|
1253
|
+
### Performance Considerations
|
|
1254
|
+
- Use single subscription updates for real-time, interactive preference changes.
|
|
1255
|
+
- Use bulk operations when updating multiple subscriptions to reduce API calls and improve performance.
|
|
1256
|
+
- Only request status information when needed using the expand parameter to reduce latency.*<br />
|
|
845
1257
|
*
|
|
846
1258
|
* Simple example:
|
|
847
1259
|
*
|
|
@@ -875,6 +1287,7 @@ declare namespace ShopperConsentsApiTypes {
|
|
|
875
1287
|
static readonly apiPaths: {
|
|
876
1288
|
getSubscriptions: string;
|
|
877
1289
|
updateSubscription: string;
|
|
1290
|
+
updateSubscriptions: string;
|
|
878
1291
|
};
|
|
879
1292
|
constructor(config: ClientConfigInit<ConfigParameters>);
|
|
880
1293
|
static readonly paramKeys: {
|
|
@@ -882,7 +1295,8 @@ declare namespace ShopperConsentsApiTypes {
|
|
|
882
1295
|
"organizationId",
|
|
883
1296
|
"siteId",
|
|
884
1297
|
"locale",
|
|
885
|
-
"tags"
|
|
1298
|
+
"tags",
|
|
1299
|
+
"expand"
|
|
886
1300
|
];
|
|
887
1301
|
readonly getSubscriptionsRequired: readonly [
|
|
888
1302
|
"organizationId",
|
|
@@ -897,9 +1311,26 @@ declare namespace ShopperConsentsApiTypes {
|
|
|
897
1311
|
"organizationId",
|
|
898
1312
|
"siteId"
|
|
899
1313
|
];
|
|
1314
|
+
readonly updateSubscriptions: readonly [
|
|
1315
|
+
"organizationId",
|
|
1316
|
+
"siteId",
|
|
1317
|
+
"locale"
|
|
1318
|
+
];
|
|
1319
|
+
readonly updateSubscriptionsRequired: readonly [
|
|
1320
|
+
"organizationId",
|
|
1321
|
+
"siteId"
|
|
1322
|
+
];
|
|
900
1323
|
};
|
|
901
1324
|
/**
|
|
902
|
-
* Retrieve all
|
|
1325
|
+
* Retrieve all subscription preferences for the shopper (authenticated or guest).
|
|
1326
|
+
|
|
1327
|
+
Use the 'expand' parameter to include additional fields in the response:
|
|
1328
|
+
- expand=["consentStatus"]: Include subscription status information
|
|
1329
|
+
- expand=[]: Default behavior, excludes status for privacy and performance
|
|
1330
|
+
|
|
1331
|
+
The expand parameter provides privacy benefits by not exposing sensitive status
|
|
1332
|
+
information unless explicitly requested.
|
|
1333
|
+
|
|
903
1334
|
*
|
|
904
1335
|
* If you would like to get a raw Response object use the other getSubscriptions function.
|
|
905
1336
|
*
|
|
@@ -909,6 +1340,13 @@ declare namespace ShopperConsentsApiTypes {
|
|
|
909
1340
|
* @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
1341
|
* @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
1342
|
* @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.
|
|
1343
|
+
* @param options.parameters.expand - Optional parameter to expand response with additional fields.
|
|
1344
|
+
Accepts an array of field names to include in the response.
|
|
1345
|
+
Currently supports:
|
|
1346
|
+
- "consentStatus": Include consent status information in the response
|
|
1347
|
+
|
|
1348
|
+
Future expansions may include additional fields.
|
|
1349
|
+
|
|
912
1350
|
* @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
|
|
913
1351
|
*
|
|
914
1352
|
* @returns A promise of type ConsentSubscriptionResponse.
|
|
@@ -919,13 +1357,22 @@ declare namespace ShopperConsentsApiTypes {
|
|
|
919
1357
|
siteId: string;
|
|
920
1358
|
locale?: LocaleCode$0;
|
|
921
1359
|
tags?: Array<string>;
|
|
1360
|
+
expand?: Set<GetSubscriptionsExpandEnum>;
|
|
922
1361
|
} & QueryParameters, ConfigParameters>;
|
|
923
1362
|
headers?: {
|
|
924
1363
|
[key: string]: string;
|
|
925
1364
|
};
|
|
926
1365
|
}>): Promise<ConsentSubscriptionResponse>;
|
|
927
1366
|
/**
|
|
928
|
-
* Retrieve all
|
|
1367
|
+
* Retrieve all subscription preferences for the shopper (authenticated or guest).
|
|
1368
|
+
|
|
1369
|
+
Use the 'expand' parameter to include additional fields in the response:
|
|
1370
|
+
- expand=["consentStatus"]: Include subscription status information
|
|
1371
|
+
- expand=[]: Default behavior, excludes status for privacy and performance
|
|
1372
|
+
|
|
1373
|
+
The expand parameter provides privacy benefits by not exposing sensitive status
|
|
1374
|
+
information unless explicitly requested.
|
|
1375
|
+
|
|
929
1376
|
*
|
|
930
1377
|
* @param options - An object containing the options for this method.
|
|
931
1378
|
* @param options.parameters - An object containing the parameters for this method.
|
|
@@ -933,6 +1380,13 @@ declare namespace ShopperConsentsApiTypes {
|
|
|
933
1380
|
* @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
1381
|
* @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
1382
|
* @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.
|
|
1383
|
+
* @param options.parameters.expand - Optional parameter to expand response with additional fields.
|
|
1384
|
+
Accepts an array of field names to include in the response.
|
|
1385
|
+
Currently supports:
|
|
1386
|
+
- "consentStatus": Include consent status information in the response
|
|
1387
|
+
|
|
1388
|
+
Future expansions may include additional fields.
|
|
1389
|
+
|
|
936
1390
|
* @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
|
|
937
1391
|
* @param rawResponse - Set to true to return entire Response object instead of DTO.
|
|
938
1392
|
*
|
|
@@ -944,13 +1398,14 @@ declare namespace ShopperConsentsApiTypes {
|
|
|
944
1398
|
siteId: string;
|
|
945
1399
|
locale?: LocaleCode$0;
|
|
946
1400
|
tags?: Array<string>;
|
|
1401
|
+
expand?: Set<GetSubscriptionsExpandEnum>;
|
|
947
1402
|
} & QueryParameters, ConfigParameters>;
|
|
948
1403
|
headers?: {
|
|
949
1404
|
[key: string]: string;
|
|
950
1405
|
};
|
|
951
1406
|
}>, rawResponse?: T): Promise<T extends true ? Response : ConsentSubscriptionResponse>;
|
|
952
1407
|
/**
|
|
953
|
-
* Update the consent status for a
|
|
1408
|
+
* Update the consent status for a single subscription.
|
|
954
1409
|
*
|
|
955
1410
|
* If you would like to get a raw Response object use the other updateSubscription function.
|
|
956
1411
|
*
|
|
@@ -962,7 +1417,7 @@ declare namespace ShopperConsentsApiTypes {
|
|
|
962
1417
|
* @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
|
|
963
1418
|
* @param options.body - The data to send as the request body.
|
|
964
1419
|
*
|
|
965
|
-
* @returns A promise of type
|
|
1420
|
+
* @returns A promise of type ConsentSubscriptionUpdateResponse.
|
|
966
1421
|
*/
|
|
967
1422
|
updateSubscription(options: RequireParametersUnlessAllAreOptional<{
|
|
968
1423
|
parameters?: CompositeParameters<{
|
|
@@ -974,9 +1429,9 @@ declare namespace ShopperConsentsApiTypes {
|
|
|
974
1429
|
[key: string]: string;
|
|
975
1430
|
};
|
|
976
1431
|
body: ConsentSubscriptionRequest & CustomRequestBody;
|
|
977
|
-
}>): Promise<
|
|
1432
|
+
}>): Promise<ConsentSubscriptionUpdateResponse>;
|
|
978
1433
|
/**
|
|
979
|
-
* Update the consent status for a
|
|
1434
|
+
* Update the consent status for a single subscription.
|
|
980
1435
|
*
|
|
981
1436
|
* @param options - An object containing the options for this method.
|
|
982
1437
|
* @param options.parameters - An object containing the parameters for this method.
|
|
@@ -987,7 +1442,7 @@ declare namespace ShopperConsentsApiTypes {
|
|
|
987
1442
|
* @param options.body - The data to send as the request body.
|
|
988
1443
|
* @param rawResponse - Set to true to return entire Response object instead of DTO.
|
|
989
1444
|
*
|
|
990
|
-
* @returns A promise of type Response if rawResponse is true, a promise of type
|
|
1445
|
+
* @returns A promise of type Response if rawResponse is true, a promise of type ConsentSubscriptionUpdateResponse otherwise.
|
|
991
1446
|
*/
|
|
992
1447
|
updateSubscription<T extends boolean>(options: RequireParametersUnlessAllAreOptional<{
|
|
993
1448
|
parameters?: CompositeParameters<{
|
|
@@ -999,18 +1454,88 @@ declare namespace ShopperConsentsApiTypes {
|
|
|
999
1454
|
[key: string]: string;
|
|
1000
1455
|
};
|
|
1001
1456
|
body: ConsentSubscriptionRequest & CustomRequestBody;
|
|
1002
|
-
}>, rawResponse?: T): Promise<T extends true ? Response :
|
|
1457
|
+
}>, rawResponse?: T): Promise<T extends true ? Response : ConsentSubscriptionUpdateResponse>;
|
|
1458
|
+
/**
|
|
1459
|
+
* Update the consent status for multiple subscriptions in a single bulk request. Supports 1-50 subscription updates per request with partial success handling.
|
|
1460
|
+
*
|
|
1461
|
+
* If you would like to get a raw Response object use the other updateSubscriptions function.
|
|
1462
|
+
*
|
|
1463
|
+
* @param options - An object containing the options for this method.
|
|
1464
|
+
* @param options.parameters - An object containing the parameters for this method.
|
|
1465
|
+
* @param options.parameters.organizationId - An identifier for the organization the request is being made by
|
|
1466
|
+
* @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.
|
|
1467
|
+
* @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.
|
|
1468
|
+
* @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
|
|
1469
|
+
* @param options.body - The data to send as the request body.
|
|
1470
|
+
*
|
|
1471
|
+
* @returns A promise of type ConsentSubscriptionBulkResponse.
|
|
1472
|
+
*/
|
|
1473
|
+
updateSubscriptions(options: RequireParametersUnlessAllAreOptional<{
|
|
1474
|
+
parameters?: CompositeParameters<{
|
|
1475
|
+
organizationId: string;
|
|
1476
|
+
siteId: string;
|
|
1477
|
+
locale?: LocaleCode$0;
|
|
1478
|
+
} & QueryParameters, ConfigParameters>;
|
|
1479
|
+
headers?: {
|
|
1480
|
+
[key: string]: string;
|
|
1481
|
+
};
|
|
1482
|
+
body: ConsentSubscriptionBulkRequest & CustomRequestBody;
|
|
1483
|
+
}>): Promise<ConsentSubscriptionBulkResponse>;
|
|
1484
|
+
/**
|
|
1485
|
+
* Update the consent status for multiple subscriptions in a single bulk request. Supports 1-50 subscription updates per request with partial success handling.
|
|
1486
|
+
*
|
|
1487
|
+
* @param options - An object containing the options for this method.
|
|
1488
|
+
* @param options.parameters - An object containing the parameters for this method.
|
|
1489
|
+
* @param options.parameters.organizationId - An identifier for the organization the request is being made by
|
|
1490
|
+
* @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.
|
|
1491
|
+
* @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.
|
|
1492
|
+
* @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
|
|
1493
|
+
* @param options.body - The data to send as the request body.
|
|
1494
|
+
* @param rawResponse - Set to true to return entire Response object instead of DTO.
|
|
1495
|
+
*
|
|
1496
|
+
* @returns A promise of type Response if rawResponse is true, a promise of type ConsentSubscriptionBulkResponse otherwise.
|
|
1497
|
+
*/
|
|
1498
|
+
updateSubscriptions<T extends boolean>(options: RequireParametersUnlessAllAreOptional<{
|
|
1499
|
+
parameters?: CompositeParameters<{
|
|
1500
|
+
organizationId: string;
|
|
1501
|
+
siteId: string;
|
|
1502
|
+
locale?: LocaleCode$0;
|
|
1503
|
+
} & QueryParameters, ConfigParameters>;
|
|
1504
|
+
headers?: {
|
|
1505
|
+
[key: string]: string;
|
|
1506
|
+
};
|
|
1507
|
+
body: ConsentSubscriptionBulkRequest & CustomRequestBody;
|
|
1508
|
+
}>, rawResponse?: T): Promise<T extends true ? Response : ConsentSubscriptionBulkResponse>;
|
|
1003
1509
|
}
|
|
1004
1510
|
}
|
|
1005
1511
|
declare namespace ShopperConsentsModelTypes {
|
|
1512
|
+
/**
|
|
1513
|
+
*
|
|
1514
|
+
*/
|
|
1515
|
+
type ChannelType = "email" | "sms" | "whatsapp";
|
|
1006
1516
|
/**
|
|
1007
1517
|
* The consent status of the subscription as supplied or recorded by this system
|
|
1008
1518
|
*/
|
|
1009
1519
|
type ConsentStatus = "opt_in" | "opt_out";
|
|
1010
1520
|
/**
|
|
1521
|
+
* @type SubscriptionStatusEntry: Individual subscription status entry for a specific channel
|
|
1522
|
+
*
|
|
1523
|
+
* @property channel:
|
|
1524
|
+
*
|
|
1525
|
+
* @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`
|
|
1526
|
+
* - **Min Length:** 3
|
|
1527
|
+
* - **Max Length:** 320
|
|
1528
|
+
*
|
|
1529
|
+
* @property status:
|
|
1011
1530
|
*
|
|
1012
1531
|
*/
|
|
1013
|
-
type
|
|
1532
|
+
type SubscriptionStatusEntry = {
|
|
1533
|
+
channel: ChannelType;
|
|
1534
|
+
contactPointValue: string;
|
|
1535
|
+
status: ConsentStatus;
|
|
1536
|
+
} & {
|
|
1537
|
+
[key: string]: any;
|
|
1538
|
+
};
|
|
1014
1539
|
/**
|
|
1015
1540
|
* @type ConsentSubscription:
|
|
1016
1541
|
*
|
|
@@ -1019,41 +1544,42 @@ declare namespace ShopperConsentsModelTypes {
|
|
|
1019
1544
|
* - **Min Length:** 1
|
|
1020
1545
|
* - **Max Length:** 255
|
|
1021
1546
|
*
|
|
1022
|
-
* @property
|
|
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:
|
|
1547
|
+
* @property channels:
|
|
1031
1548
|
*
|
|
1032
|
-
* @property status
|
|
1549
|
+
* @property consentStatus: Array of subscription status entries for different channels
|
|
1033
1550
|
*
|
|
1034
|
-
* @property title:
|
|
1551
|
+
* @property title: The localized title of the subscription for shopper displays
|
|
1035
1552
|
* - **Min Length:** 1
|
|
1036
1553
|
* - **Max Length:** 255
|
|
1037
1554
|
*
|
|
1038
|
-
* @property subtitle:
|
|
1555
|
+
* @property subtitle: The localized subtitle of the subscription for shopper displays, may contain HTML markup
|
|
1039
1556
|
* - **Min Length:** 1
|
|
1040
|
-
* - **Max Length:**
|
|
1557
|
+
* - **Max Length:** 2000
|
|
1041
1558
|
*
|
|
1042
1559
|
* @property tags:
|
|
1043
1560
|
*
|
|
1561
|
+
* @property consentType: Type of consent subscription
|
|
1562
|
+
*
|
|
1563
|
+
* @property consentRequired: Whether this subscription is mandatory for the user
|
|
1564
|
+
*
|
|
1565
|
+
* @property defaultStatus: Default consent status for this subscription
|
|
1566
|
+
*
|
|
1044
1567
|
*/
|
|
1045
1568
|
type ConsentSubscription = {
|
|
1046
1569
|
subscriptionId: string;
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
channel: SubscriptionChannel;
|
|
1050
|
-
status?: ConsentStatus;
|
|
1570
|
+
channels: Set<ChannelType>;
|
|
1571
|
+
consentStatus?: Array<SubscriptionStatusEntry>;
|
|
1051
1572
|
title?: string;
|
|
1052
1573
|
subtitle?: string;
|
|
1053
1574
|
tags?: Array<string>;
|
|
1575
|
+
consentType?: ConsentSubscriptionConsentTypeEnum;
|
|
1576
|
+
consentRequired?: boolean;
|
|
1577
|
+
defaultStatus?: ConsentSubscriptionDefaultStatusEnum;
|
|
1054
1578
|
} & {
|
|
1055
1579
|
[key: string]: any;
|
|
1056
1580
|
};
|
|
1581
|
+
type ConsentSubscriptionConsentTypeEnum = "marketing" | "legal";
|
|
1582
|
+
type ConsentSubscriptionDefaultStatusEnum = "opt_in" | "opt_out";
|
|
1057
1583
|
/**
|
|
1058
1584
|
* @type ConsentSubscriptionRequest: Consent subscription update request
|
|
1059
1585
|
*
|
|
@@ -1074,8 +1600,80 @@ declare namespace ShopperConsentsModelTypes {
|
|
|
1074
1600
|
type ConsentSubscriptionRequest = {
|
|
1075
1601
|
subscriptionId: string;
|
|
1076
1602
|
contactPointValue: string;
|
|
1077
|
-
channel:
|
|
1603
|
+
channel: ChannelType;
|
|
1604
|
+
status: ConsentStatus;
|
|
1605
|
+
} & {
|
|
1606
|
+
[key: string]: any;
|
|
1607
|
+
};
|
|
1608
|
+
/**
|
|
1609
|
+
* @type ConsentSubscriptionBulkRequest: Bulk request for updating multiple consent subscriptions
|
|
1610
|
+
*
|
|
1611
|
+
* @property subscriptions: Array of subscription consent updates to process
|
|
1612
|
+
*
|
|
1613
|
+
*/
|
|
1614
|
+
type ConsentSubscriptionBulkRequest = {
|
|
1615
|
+
subscriptions: Array<ConsentSubscriptionRequest>;
|
|
1616
|
+
} & {
|
|
1617
|
+
[key: string]: any;
|
|
1618
|
+
};
|
|
1619
|
+
/**
|
|
1620
|
+
* @type ConsentSubscriptionError: Error details for failed subscription updates
|
|
1621
|
+
*
|
|
1622
|
+
* @property code: Error code indicating the type of failure
|
|
1623
|
+
* - **Max Length:** 100
|
|
1624
|
+
*
|
|
1625
|
+
* @property message: Human-readable error message
|
|
1626
|
+
* - **Max Length:** 500
|
|
1627
|
+
*
|
|
1628
|
+
* @property details: Additional error details
|
|
1629
|
+
*
|
|
1630
|
+
*/
|
|
1631
|
+
type ConsentSubscriptionError = {
|
|
1632
|
+
code: string;
|
|
1633
|
+
message: string;
|
|
1634
|
+
details?: object;
|
|
1635
|
+
} & {
|
|
1636
|
+
[key: string]: any;
|
|
1637
|
+
};
|
|
1638
|
+
/**
|
|
1639
|
+
* @type ConsentSubscriptionResult: Individual subscription update result with input parameters
|
|
1640
|
+
*
|
|
1641
|
+
* @property subscriptionId: Identifier for the communication subscription
|
|
1642
|
+
* - **Pattern:** /^[a-z0-9]+(?:-[a-z0-9]+)*$/
|
|
1643
|
+
* - **Min Length:** 1
|
|
1644
|
+
* - **Max Length:** 255
|
|
1645
|
+
*
|
|
1646
|
+
* @property channel:
|
|
1647
|
+
*
|
|
1648
|
+
* @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`
|
|
1649
|
+
* - **Min Length:** 3
|
|
1650
|
+
* - **Max Length:** 320
|
|
1651
|
+
*
|
|
1652
|
+
* @property status:
|
|
1653
|
+
*
|
|
1654
|
+
* @property success: Whether the subscription update was successful
|
|
1655
|
+
*
|
|
1656
|
+
* @property error:
|
|
1657
|
+
*
|
|
1658
|
+
*/
|
|
1659
|
+
type ConsentSubscriptionResult = {
|
|
1660
|
+
subscriptionId: string;
|
|
1661
|
+
channel: ChannelType;
|
|
1662
|
+
contactPointValue: string;
|
|
1078
1663
|
status: ConsentStatus;
|
|
1664
|
+
success: boolean;
|
|
1665
|
+
error?: ConsentSubscriptionError;
|
|
1666
|
+
} & {
|
|
1667
|
+
[key: string]: any;
|
|
1668
|
+
};
|
|
1669
|
+
/**
|
|
1670
|
+
* @type ConsentSubscriptionBulkResponse: Bulk response with results for each subscription update request
|
|
1671
|
+
*
|
|
1672
|
+
* @property results: Results for each subscription update request
|
|
1673
|
+
*
|
|
1674
|
+
*/
|
|
1675
|
+
type ConsentSubscriptionBulkResponse = {
|
|
1676
|
+
results: Array<ConsentSubscriptionResult>;
|
|
1079
1677
|
} & {
|
|
1080
1678
|
[key: string]: any;
|
|
1081
1679
|
};
|
|
@@ -1090,6 +1688,31 @@ declare namespace ShopperConsentsModelTypes {
|
|
|
1090
1688
|
} & {
|
|
1091
1689
|
[key: string]: any;
|
|
1092
1690
|
};
|
|
1691
|
+
/**
|
|
1692
|
+
* @type ConsentSubscriptionUpdateResponse: Single subscription update response
|
|
1693
|
+
*
|
|
1694
|
+
* @property subscriptionId: Identifier for the communication subscription
|
|
1695
|
+
* - **Pattern:** /^[a-z0-9]+(?:-[a-z0-9]+)*$/
|
|
1696
|
+
* - **Min Length:** 1
|
|
1697
|
+
* - **Max Length:** 255
|
|
1698
|
+
*
|
|
1699
|
+
* @property channel:
|
|
1700
|
+
*
|
|
1701
|
+
* @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`
|
|
1702
|
+
* - **Min Length:** 3
|
|
1703
|
+
* - **Max Length:** 320
|
|
1704
|
+
*
|
|
1705
|
+
* @property status:
|
|
1706
|
+
*
|
|
1707
|
+
*/
|
|
1708
|
+
type ConsentSubscriptionUpdateResponse = {
|
|
1709
|
+
subscriptionId: string;
|
|
1710
|
+
channel: ChannelType;
|
|
1711
|
+
contactPointValue: string;
|
|
1712
|
+
status: ConsentStatus;
|
|
1713
|
+
} & {
|
|
1714
|
+
[key: string]: any;
|
|
1715
|
+
};
|
|
1093
1716
|
/**
|
|
1094
1717
|
* A specialized value indicating the system default values for locales.
|
|
1095
1718
|
*/
|
|
@@ -1126,17 +1749,28 @@ declare namespace ShopperConsentsModelTypes {
|
|
|
1126
1749
|
declare namespace ShopperConsentsTypes {
|
|
1127
1750
|
type ShopperConsentsPathParameters = ShopperConsentsApiTypes.ShopperConsentsPathParameters;
|
|
1128
1751
|
type ShopperConsentsQueryParameters = ShopperConsentsApiTypes.ShopperConsentsQueryParameters;
|
|
1752
|
+
type GetSubscriptionsExpandEnum = ShopperConsentsApiTypes.GetSubscriptionsExpandEnum;
|
|
1129
1753
|
type getSubscriptionsQueryParameters = ShopperConsentsApiTypes.getSubscriptionsQueryParameters;
|
|
1130
1754
|
type getSubscriptionsPathParameters = ShopperConsentsApiTypes.getSubscriptionsPathParameters;
|
|
1131
1755
|
type updateSubscriptionQueryParameters = ShopperConsentsApiTypes.updateSubscriptionQueryParameters;
|
|
1132
1756
|
type updateSubscriptionPathParameters = ShopperConsentsApiTypes.updateSubscriptionPathParameters;
|
|
1757
|
+
type updateSubscriptionsQueryParameters = ShopperConsentsApiTypes.updateSubscriptionsQueryParameters;
|
|
1758
|
+
type updateSubscriptionsPathParameters = ShopperConsentsApiTypes.updateSubscriptionsPathParameters;
|
|
1759
|
+
type ChannelType = ShopperConsentsModelTypes.ChannelType;
|
|
1133
1760
|
type ConsentStatus = ShopperConsentsModelTypes.ConsentStatus;
|
|
1134
1761
|
type ConsentSubscription = ShopperConsentsModelTypes.ConsentSubscription;
|
|
1762
|
+
type ConsentSubscriptionConsentTypeEnum = ShopperConsentsModelTypes.ConsentSubscriptionConsentTypeEnum;
|
|
1763
|
+
type ConsentSubscriptionDefaultStatusEnum = ShopperConsentsModelTypes.ConsentSubscriptionDefaultStatusEnum;
|
|
1764
|
+
type ConsentSubscriptionBulkRequest = ShopperConsentsModelTypes.ConsentSubscriptionBulkRequest;
|
|
1765
|
+
type ConsentSubscriptionBulkResponse = ShopperConsentsModelTypes.ConsentSubscriptionBulkResponse;
|
|
1766
|
+
type ConsentSubscriptionError = ShopperConsentsModelTypes.ConsentSubscriptionError;
|
|
1135
1767
|
type ConsentSubscriptionRequest = ShopperConsentsModelTypes.ConsentSubscriptionRequest;
|
|
1136
1768
|
type ConsentSubscriptionResponse = ShopperConsentsModelTypes.ConsentSubscriptionResponse;
|
|
1769
|
+
type ConsentSubscriptionResult = ShopperConsentsModelTypes.ConsentSubscriptionResult;
|
|
1770
|
+
type ConsentSubscriptionUpdateResponse = ShopperConsentsModelTypes.ConsentSubscriptionUpdateResponse;
|
|
1137
1771
|
type DefaultFallback = ShopperConsentsModelTypes.DefaultFallback;
|
|
1138
1772
|
type ErrorResponse = ShopperConsentsModelTypes.ErrorResponse;
|
|
1139
1773
|
type LocaleCode = ShopperConsentsModelTypes.LocaleCode;
|
|
1140
|
-
type
|
|
1774
|
+
type SubscriptionStatusEntry = ShopperConsentsModelTypes.SubscriptionStatusEntry;
|
|
1141
1775
|
}
|
|
1142
|
-
export { defaultBaseUri, getSubscriptionsQueryParameters, getSubscriptionsPathParameters, updateSubscriptionQueryParameters, updateSubscriptionPathParameters, ShopperConsentsPathParameters, ShopperConsentsQueryParameters, ShopperConsentsParameters, ShopperConsents, ConsentStatus, ConsentSubscription, ConsentSubscriptionRequest, ConsentSubscriptionResponse, DefaultFallback, ErrorResponse, LocaleCode$0 as LocaleCode,
|
|
1776
|
+
export { defaultBaseUri, GetSubscriptionsExpandEnum, getSubscriptionsQueryParameters, getSubscriptionsPathParameters, updateSubscriptionQueryParameters, updateSubscriptionPathParameters, updateSubscriptionsQueryParameters, updateSubscriptionsPathParameters, ShopperConsentsPathParameters, ShopperConsentsQueryParameters, ShopperConsentsParameters, ShopperConsents, ChannelType, ConsentStatus, ConsentSubscription, ConsentSubscriptionConsentTypeEnum, ConsentSubscriptionDefaultStatusEnum, ConsentSubscriptionBulkRequest, ConsentSubscriptionBulkResponse, ConsentSubscriptionError, ConsentSubscriptionRequest, ConsentSubscriptionResponse, ConsentSubscriptionResult, ConsentSubscriptionUpdateResponse, DefaultFallback, ErrorResponse, LocaleCode$0 as LocaleCode, SubscriptionStatusEntry, ShopperConsentsTypes };
|