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,1174 +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/experience/shopper-experience/v1";
15
- /**
16
- * Makes a type easier to read.
17
- */
18
- type Prettify<T> = NonNullable<{
19
- [K in keyof T]: T[K];
20
- }>;
21
- /**
22
- * Generates the types required on a method, based on those provided in the config.
23
- */
24
- type CompositeParameters<MethodParameters extends Record<string, unknown>, ConfigParameters extends Record<string, unknown>> = Prettify<Omit<MethodParameters, keyof ConfigParameters> & Partial<MethodParameters>>;
25
- /**
26
- * If an object has a `parameters` property, and the `parameters` object has required properties,
27
- * then the `parameters` property on the root object is marked as required.
28
- */
29
- type RequireParametersUnlessAllAreOptional<T extends {
30
- parameters?: Record<string, unknown>;
31
- }> = Record<string, never> extends NonNullable<T["parameters"]> ? T : Prettify<T & Required<Pick<T, "parameters">>>;
32
- /**
33
- * Template parameters used in the base URI of all API endpoints. `version` will default to `"v1"`
34
- * if not specified.
35
- */
36
- interface BaseUriParameters {
37
- shortCode: string;
38
- }
39
- type LocaleCode = {
40
- [key: string]: any;
41
- };
42
- /**
43
- * Generic interface for path parameters.
44
- */
45
- interface PathParameters {
46
- [key: string]: string | number | boolean;
47
- }
48
- /**
49
- * Generic interface for query parameters.
50
- */
51
- interface QueryParameters {
52
- [key: string]: string | number | boolean | string[] | number[] | LocaleCode;
53
- }
54
- /**
55
- * Alias for `RequestInit` from TypeScript's DOM lib, to more clearly differentiate
56
- * it from the `RequestInit` provided by node-fetch.
57
- */
58
- type BrowserRequestInit = RequestInit;
59
- /**
60
- * Any properties supported in either the browser or node are accepted.
61
- * Using the right properties in the right context is left to the user.
62
- */
63
- type FetchOptions = NodeRequestInit & BrowserRequestInit;
64
- type FetchFunction = (input: RequestInfo, init?: FetchOptions | undefined) => Promise<Response>;
65
- /**
66
- * Base options that can be passed to the `ClientConfig` class.
67
- */
68
- interface ClientConfigInit<Params extends BaseUriParameters> {
69
- baseUri?: string;
70
- proxy?: string;
71
- headers?: {
72
- [key: string]: string;
73
- };
74
- parameters: Params;
75
- fetchOptions?: FetchOptions;
76
- fetch?: FetchFunction;
77
- transformRequest?: (data: unknown, headers: {
78
- [key: string]: string;
79
- }) => Required<FetchOptions>["body"];
80
- throwOnBadResponse?: boolean;
81
- }
82
- /**
83
- * Configuration parameters common to Commerce SDK clients
84
- */
85
- declare class ClientConfig<Params extends BaseUriParameters> implements ClientConfigInit<Params> {
86
- baseUri?: string;
87
- proxy?: string;
88
- headers: {
89
- [key: string]: string;
90
- };
91
- parameters: Params;
92
- fetchOptions: FetchOptions;
93
- fetch?: FetchFunction;
94
- transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
95
- throwOnBadResponse: boolean;
96
- constructor(config: ClientConfigInit<Params>);
97
- static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
98
- }
99
- /**
100
- * @type Region:
101
- *
102
- * @property id: Region identifier.
103
- * - **Max Length:** 256
104
- *
105
- * @property components: The components in the region.
106
- *
107
- */
108
- type Region = {
109
- id: string;
110
- components?: Array<Component>;
111
- } & {
112
- [key: string]: any;
113
- };
114
- /**
115
- * @type Component:
116
- *
117
- * @property id: Component identifier.
118
- * - **Max Length:** 256
119
- *
120
- * @property typeId: Component type identifier.
121
- * - **Max Length:** 256
122
- *
123
- * @property data: The configuration data assigned to the component.
124
- *
125
- * @property custom: Any custom data added by the custom code for this component.
126
- *
127
- * @property regions: The regions (and their assigned components) for the component.
128
- *
129
- */
130
- type Component = {
131
- id: string;
132
- typeId: string;
133
- data?: object;
134
- custom?: object;
135
- regions?: Array<Region>;
136
- } & {
137
- [key: string]: any;
138
- };
139
- /**
140
- * A specialized value indicating the system default values for locales.
141
- */
142
- type DefaultFallback = "default";
143
- /**
144
- * @type ErrorResponse:
145
- *
146
- * @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
147
- * - **Max Length:** 256
148
- *
149
- * @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.
150
- * - **Max Length:** 2048
151
- *
152
- * @property detail: A human-readable explanation specific to this occurrence of the problem.
153
- *
154
- * @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.
155
- * - **Max Length:** 2048
156
- *
157
- */
158
- type ErrorResponse = {
159
- title: string;
160
- type: string;
161
- detail: string;
162
- instance?: string;
163
- } & {
164
- [key: string]: any;
165
- };
166
- /**
167
- * @type LocaleCode
168
- * 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.
169
- */
170
- type LocaleCode$0 = DefaultFallback | string;
171
- /**
172
- * @type Page:
173
- *
174
- * @property id: Page identifier.
175
- * - **Max Length:** 256
176
- *
177
- * @property typeId: Page type identifier.
178
- * - **Max Length:** 256
179
- *
180
- * @property aspectTypeId: The aspect type assigned to the page.
181
- * - **Max Length:** 256
182
- *
183
- * @property name: Display name of the page.
184
- * - **Max Length:** 4000
185
- *
186
- * @property description: Description of the page.
187
- * - **Max Length:** 4000
188
- *
189
- * @property pageTitle: The SEO title of the page.
190
- * - **Max Length:** 4000
191
- *
192
- * @property pageDescription: The SEO description of the page.
193
- * - **Max Length:** 4000
194
- *
195
- * @property pageKeywords: The SEO keywords of the page.
196
- * - **Max Length:** 4000
197
- *
198
- * @property data: The configuration data assigned to the page.
199
- *
200
- * @property custom: Any custom data added by the custom code for the page type.
201
- *
202
- * @property regions: The regions (and their assigned components) for the page.
203
- *
204
- */
205
- type Page = {
206
- id: string;
207
- typeId: string;
208
- aspectTypeId?: string;
209
- name?: string;
210
- description?: string;
211
- pageTitle?: string;
212
- pageDescription?: string;
213
- pageKeywords?: string;
214
- data?: object;
215
- custom?: object;
216
- regions?: Array<Region>;
217
- } & {
218
- [key: string]: any;
219
- };
220
- /**
221
- * @type PageResult:
222
- *
223
- * @property data: List of pages.
224
- *
225
- */
226
- type PageResult = {
227
- data: Array<Page>;
228
- } & {
229
- [key: string]: any;
230
- };
231
- type getPageQueryParameters = {
232
- aspectAttributes?: string;
233
- parameters?: string;
234
- siteId: string;
235
- locale?: LocaleCode$0;
236
- };
237
- type getPagePathParameters = {
238
- pageId: string;
239
- organizationId: string;
240
- };
241
- type getPagesQueryParameters = {
242
- categoryId?: string;
243
- productId?: string;
244
- aspectTypeId: string;
245
- aspectAttributes?: string;
246
- parameters?: string;
247
- siteId: string;
248
- locale?: LocaleCode$0;
249
- };
250
- type getPagesPathParameters = {
251
- organizationId: string;
252
- };
253
- /**
254
- * All path parameters that are used by at least one ShopperExperience method.
255
- */
256
- type ShopperExperiencePathParameters = Partial<getPagePathParameters & getPagesPathParameters & {}>;
257
- /**
258
- * All query parameters that are used by at least one ShopperExperience method.
259
- */
260
- type ShopperExperienceQueryParameters = Partial<getPageQueryParameters & getPagesQueryParameters & {}>;
261
- /**
262
- * All parameters that are used by ShopperExperience.
263
- */
264
- type ShopperExperienceParameters = ShopperExperiencePathParameters & BaseUriParameters & ShopperExperienceQueryParameters;
265
- /**
266
- * [Shopper Experience](https://developer.salesforce.com/docs/commerce/commerce-api/references?meta=shopper-experience:Summary)
267
- * ==================================
268
- *
269
- * *Use the Shopper Experience API to look up page information for pages that are created in Page Designer.
270
-
271
- Responses include the following:
272
-
273
- - The entire component hierarchy of the page at design time.
274
- - All merchant data provided at design time.
275
- - Server-side scripting data provided at run time.
276
-
277
- Both the page and components contain the values of all native and custom attributes that have been populated during page authoring.
278
-
279
- Only visible pages are returned. Because the visibility of components is driven by rules (scheduling or customer groups, for example), these rules are subject to evaluation when assembling the component hierarchy in the response. Only components that are visible for the current customer context appear in the response. The same rules apply to the page itself, which is only be processed and returned if it is visible.
280
-
281
- **Important**: Currently, the Shopper Experience API can’t be used when the [storefront password protection](https://documentation.b2c.commercecloud.salesforce.com/DOC1/index.jsp?topic=%2Fcom.demandware.dochelp%2Fcontent%2Fb2c_commerce%2Ftopics%2Fpermissions%2Fb2c_storefront_password_protection.html&resultof=%22%73%74%6f%72%65%66%72%6f%6e%74%22%20%22%70%72%6f%74%65%63%74%69%6f%6e%22%20%22%70%72%6f%74%65%63%74%22%20) feature is enabled.
282
-
283
- ## Authentication & Authorization
284
-
285
- The Shopper Experience API requires a shopper access token from the Shopper Login and API Access Service (SLAS).
286
-
287
- For details on how to request a shopper access token from SLAS, see the guest user flows for [public clients](https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas-public-client.html#guest-user) and [private clients](https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas-private-client.html#guest-user) in the SLAS guides.
288
-
289
- You must include the relevant scope(s) in the client ID used to generate the SLAS token. For details, see the [Authorization Scopes Catalog.](https://developer.salesforce.com/docs/commerce/commerce-api/guide/auth-z-scope-catalog.html).*<br />
290
- *
291
- * Simple example:
292
- *
293
- * ```typescript
294
- * import { ShopperExperience } from "commerce-sdk-isomorphic";
295
- *
296
- * const clientConfig = {
297
- * parameters: {
298
- * clientId: "XXXXXX",
299
- * organizationId: "XXXX",
300
- * shortCode: "XXX",
301
- * siteId: "XX"
302
- * }
303
- * };
304
- * const shopperExperienceClient = new ShopperExperience(clientConfig);
305
- * ```
306
- *
307
- * <span style="font-size:.7em; display:block; text-align: right">
308
- * API Version: 0.0.33<br />
309
- * Last Updated: <br />
310
- * </span>
311
- *
312
- *
313
- */
314
- declare class ShopperExperience<ConfigParameters extends ShopperExperienceParameters & Record<string, unknown>> {
315
- // baseUri is not required on ClientConfig, but we know that we provide one in the class constructor
316
- clientConfig: ClientConfig<ConfigParameters> & {
317
- baseUri: string;
318
- };
319
- static readonly defaultBaseUri = "https://{shortCode}.api.commercecloud.salesforce.com/experience/shopper-experience/v1";
320
- static readonly apiPaths: {
321
- getPage: string;
322
- getPages: string;
323
- };
324
- constructor(config: ClientConfigInit<ConfigParameters>);
325
- static readonly paramKeys: {
326
- readonly getPage: readonly [
327
- "pageId",
328
- "organizationId",
329
- "siteId",
330
- "aspectAttributes",
331
- "parameters",
332
- "locale"
333
- ];
334
- readonly getPageRequired: readonly [
335
- "pageId",
336
- "organizationId",
337
- "siteId"
338
- ];
339
- readonly getPages: readonly [
340
- "organizationId",
341
- "aspectTypeId",
342
- "siteId",
343
- "categoryId",
344
- "productId",
345
- "aspectAttributes",
346
- "parameters",
347
- "locale"
348
- ];
349
- readonly getPagesRequired: readonly [
350
- "organizationId",
351
- "aspectTypeId",
352
- "siteId"
353
- ];
354
- };
355
- /**
356
- * Get a Page Designer page for a specific page ID. The results apply the visibility rules for the page's components, such as personalization or scheduled visibility.
357
-
358
- **Important**:
359
- - Currently, you can't use the Shopper Experience API when the [storefront password protection](https://documentation.b2c.commercecloud.salesforce.com/DOC1/index.jsp?topic=%2Fcom.demandware.dochelp%2Fcontent%2Fb2c_commerce%2Ftopics%2Fpermissions%2Fb2c_storefront_password_protection.html&resultof=%22%73%74%6f%72%65%66%72%6f%6e%74%22%20%22%70%72%6f%74%65%63%74%69%6f%6e%22%20%22%70%72%6f%74%65%63%74%22%20) feature is enabled.
360
- - Because this resource uses the GET method, you must not pass sensitive data, for example: payment card information, and must not perform transactional processes within the server-side scripts that are run for the page and components.
361
- - Be aware that pagecache during fingerprint calculation will only be leveraged for pages and their components that don't use visibility rules. Furthermore the pagecaching of the actual response assembly solely depends on the response instrumentation with the serverside page type and component type script implementations. For more details also see the [Page Designer Caching Guide](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-dev-for-page-designer.html#page-caching).
362
- *
363
- * If you would like to get a raw Response object use the other getPage function.
364
- *
365
- * @param options - An object containing the options for this method.
366
- * @param options.parameters - An object containing the parameters for this method.
367
- * @param options.parameters.pageId - Identifier for the requested page.
368
- * @param options.parameters.organizationId - An identifier for the organization the request is being made by
369
- * @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.
370
- * @param options.parameters.aspectAttributes - A JSON representation of aspect attributes. Each aspect attribute is a key/value pair. Aspect attributes serve as a runtime parameter contract between caller (for example, this API or the DWScript API) and callee (the page). This parameter must not contain more than 256 characters after URL decoding.
371
- * @param options.parameters.parameters - A free-form definition of parameters that influences the page rendering according to its implementation. This parameter must not contain more than 256 characters after URL decoding.
372
- * @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.
373
- * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
374
- *
375
- * @returns A promise of type Page.
376
- */
377
- getPage(options?: RequireParametersUnlessAllAreOptional<{
378
- parameters?: CompositeParameters<{
379
- pageId: string;
380
- organizationId: string;
381
- siteId: string;
382
- aspectAttributes?: string;
383
- parameters?: string;
384
- locale?: LocaleCode$0;
385
- } & QueryParameters, ConfigParameters>;
386
- headers?: {
387
- [key: string]: string;
388
- };
389
- }>): Promise<Page>;
390
- /**
391
- * Get a Page Designer page for a specific page ID. The results apply the visibility rules for the page's components, such as personalization or scheduled visibility.
392
-
393
- **Important**:
394
- - Currently, you can't use the Shopper Experience API when the [storefront password protection](https://documentation.b2c.commercecloud.salesforce.com/DOC1/index.jsp?topic=%2Fcom.demandware.dochelp%2Fcontent%2Fb2c_commerce%2Ftopics%2Fpermissions%2Fb2c_storefront_password_protection.html&resultof=%22%73%74%6f%72%65%66%72%6f%6e%74%22%20%22%70%72%6f%74%65%63%74%69%6f%6e%22%20%22%70%72%6f%74%65%63%74%22%20) feature is enabled.
395
- - Because this resource uses the GET method, you must not pass sensitive data, for example: payment card information, and must not perform transactional processes within the server-side scripts that are run for the page and components.
396
- - Be aware that pagecache during fingerprint calculation will only be leveraged for pages and their components that don't use visibility rules. Furthermore the pagecaching of the actual response assembly solely depends on the response instrumentation with the serverside page type and component type script implementations. For more details also see the [Page Designer Caching Guide](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-dev-for-page-designer.html#page-caching).
397
- *
398
- * @param options - An object containing the options for this method.
399
- * @param options.parameters - An object containing the parameters for this method.
400
- * @param options.parameters.pageId - Identifier for the requested page.
401
- * @param options.parameters.organizationId - An identifier for the organization the request is being made by
402
- * @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.
403
- * @param options.parameters.aspectAttributes - A JSON representation of aspect attributes. Each aspect attribute is a key/value pair. Aspect attributes serve as a runtime parameter contract between caller (for example, this API or the DWScript API) and callee (the page). This parameter must not contain more than 256 characters after URL decoding.
404
- * @param options.parameters.parameters - A free-form definition of parameters that influences the page rendering according to its implementation. This parameter must not contain more than 256 characters after URL decoding.
405
- * @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.
406
- * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
407
- * @param rawResponse - Set to true to return entire Response object instead of DTO.
408
- *
409
- * @returns A promise of type Response if rawResponse is true, a promise of type Page otherwise.
410
- */
411
- getPage<T extends boolean>(options?: RequireParametersUnlessAllAreOptional<{
412
- parameters?: CompositeParameters<{
413
- pageId: string;
414
- organizationId: string;
415
- siteId: string;
416
- aspectAttributes?: string;
417
- parameters?: string;
418
- locale?: LocaleCode$0;
419
- } & QueryParameters, ConfigParameters>;
420
- headers?: {
421
- [key: string]: string;
422
- };
423
- }>, rawResponse?: T): Promise<T extends true ? Response : Page>;
424
- /**
425
- * Get Page Designer pages. The results apply the visibility rules for each page's components, such as personalization or scheduled visibility.
426
-
427
- You must provide the `aspectTypeId` along with either a `categoryId` or a `productId`. Since you can only create one page-to-product or page-to-category assignment per aspect type, the result contains at most one element.
428
-
429
- **Important**:
430
- - Currently, you can't use the Shopper Experience API when the [storefront password protection](https://documentation.b2c.commercecloud.salesforce.com/DOC1/index.jsp?topic=%2Fcom.demandware.dochelp%2Fcontent%2Fb2c_commerce%2Ftopics%2Fpermissions%2Fb2c_storefront_password_protection.html&resultof=%22%73%74%6f%72%65%66%72%6f%6e%74%22%20%22%70%72%6f%74%65%63%74%69%6f%6e%22%20%22%70%72%6f%74%65%63%74%22%20) feature is enabled.
431
- - Because this resource uses the GET method, you must not pass sensitive data, for example: payment card information, and must not perform transactional processes within the server-side scripts that are run for the page and components.
432
- - Be aware that pagecache during fingerprint calculation will only be leveraged for pages and their components that don't use visibility rules. Furthermore the pagecaching of the actual response assembly solely depends on the response instrumentation with the serverside page type and component type script implementations. For more details also see the [Page Designer Caching Guide](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-dev-for-page-designer.html#page-caching).
433
- *
434
- * If you would like to get a raw Response object use the other getPages function.
435
- *
436
- * @param options - An object containing the options for this method.
437
- * @param options.parameters - An object containing the parameters for this method.
438
- * @param options.parameters.organizationId - An identifier for the organization the request is being made by
439
- * @param options.parameters.aspectTypeId - Aspect type identifier that is used for searching the page assignment in conjunction with either the `productId` or `categoryId`.
440
- * @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.
441
- * @param options.parameters.categoryId - Category identifier that is used for searching the page assignment. Must be provided if no `productId` is provided.
442
- * @param options.parameters.productId - Product identifier that is used for searching the page assignment. Must be provided if no `categoryId` is provided.
443
- * @param options.parameters.aspectAttributes - A JSON representation of aspect attributes. Each aspect attribute is a key/value pair. Aspect attributes serve as a runtime parameter contract between caller (for example, this API or the DWScript API) and callee (the page). This parameter must not contain more than 256 characters after URL decoding.
444
- * @param options.parameters.parameters - A free-form definition of parameters that influences the page rendering according to its implementation. This parameter must not contain more than 256 characters after URL decoding.
445
- * @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.
446
- * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
447
- *
448
- * @returns A promise of type PageResult.
449
- */
450
- getPages(options?: RequireParametersUnlessAllAreOptional<{
451
- parameters?: CompositeParameters<{
452
- organizationId: string;
453
- aspectTypeId: string;
454
- siteId: string;
455
- categoryId?: string;
456
- productId?: string;
457
- aspectAttributes?: string;
458
- parameters?: string;
459
- locale?: LocaleCode$0;
460
- } & QueryParameters, ConfigParameters>;
461
- headers?: {
462
- [key: string]: string;
463
- };
464
- }>): Promise<PageResult>;
465
- /**
466
- * Get Page Designer pages. The results apply the visibility rules for each page's components, such as personalization or scheduled visibility.
467
-
468
- You must provide the `aspectTypeId` along with either a `categoryId` or a `productId`. Since you can only create one page-to-product or page-to-category assignment per aspect type, the result contains at most one element.
469
-
470
- **Important**:
471
- - Currently, you can't use the Shopper Experience API when the [storefront password protection](https://documentation.b2c.commercecloud.salesforce.com/DOC1/index.jsp?topic=%2Fcom.demandware.dochelp%2Fcontent%2Fb2c_commerce%2Ftopics%2Fpermissions%2Fb2c_storefront_password_protection.html&resultof=%22%73%74%6f%72%65%66%72%6f%6e%74%22%20%22%70%72%6f%74%65%63%74%69%6f%6e%22%20%22%70%72%6f%74%65%63%74%22%20) feature is enabled.
472
- - Because this resource uses the GET method, you must not pass sensitive data, for example: payment card information, and must not perform transactional processes within the server-side scripts that are run for the page and components.
473
- - Be aware that pagecache during fingerprint calculation will only be leveraged for pages and their components that don't use visibility rules. Furthermore the pagecaching of the actual response assembly solely depends on the response instrumentation with the serverside page type and component type script implementations. For more details also see the [Page Designer Caching Guide](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-dev-for-page-designer.html#page-caching).
474
- *
475
- * @param options - An object containing the options for this method.
476
- * @param options.parameters - An object containing the parameters for this method.
477
- * @param options.parameters.organizationId - An identifier for the organization the request is being made by
478
- * @param options.parameters.aspectTypeId - Aspect type identifier that is used for searching the page assignment in conjunction with either the `productId` or `categoryId`.
479
- * @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.
480
- * @param options.parameters.categoryId - Category identifier that is used for searching the page assignment. Must be provided if no `productId` is provided.
481
- * @param options.parameters.productId - Product identifier that is used for searching the page assignment. Must be provided if no `categoryId` is provided.
482
- * @param options.parameters.aspectAttributes - A JSON representation of aspect attributes. Each aspect attribute is a key/value pair. Aspect attributes serve as a runtime parameter contract between caller (for example, this API or the DWScript API) and callee (the page). This parameter must not contain more than 256 characters after URL decoding.
483
- * @param options.parameters.parameters - A free-form definition of parameters that influences the page rendering according to its implementation. This parameter must not contain more than 256 characters after URL decoding.
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 rawResponse - Set to true to return entire Response object instead of DTO.
487
- *
488
- * @returns A promise of type Response if rawResponse is true, a promise of type PageResult otherwise.
489
- */
490
- getPages<T extends boolean>(options?: RequireParametersUnlessAllAreOptional<{
491
- parameters?: CompositeParameters<{
492
- organizationId: string;
493
- aspectTypeId: string;
494
- siteId: string;
495
- categoryId?: string;
496
- productId?: string;
497
- aspectAttributes?: string;
498
- parameters?: string;
499
- locale?: LocaleCode$0;
500
- } & QueryParameters, ConfigParameters>;
501
- headers?: {
502
- [key: string]: string;
503
- };
504
- }>, rawResponse?: T): Promise<T extends true ? Response : PageResult>;
505
- }
506
- declare namespace ShopperExperienceApiTypes {
507
- /*
508
- * Copyright (c) 2023, Salesforce, Inc.
509
- * All rights reserved.
510
- * SPDX-License-Identifier: BSD-3-Clause
511
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
512
- */
513
- /**
514
- * Makes a type easier to read.
515
- */
516
- type Prettify<T> = NonNullable<{
517
- [K in keyof T]: T[K];
518
- }>;
519
- /**
520
- * Generates the types required on a method, based on those provided in the config.
521
- */
522
- type CompositeParameters<MethodParameters extends Record<string, unknown>, ConfigParameters extends Record<string, unknown>> = Prettify<Omit<MethodParameters, keyof ConfigParameters> & Partial<MethodParameters>>;
523
- /**
524
- * If an object has a `parameters` property, and the `parameters` object has required properties,
525
- * then the `parameters` property on the root object is marked as required.
526
- */
527
- type RequireParametersUnlessAllAreOptional<T extends {
528
- parameters?: Record<string, unknown>;
529
- }> = Record<string, never> extends NonNullable<T["parameters"]> ? T : Prettify<T & Required<Pick<T, "parameters">>>;
530
- /**
531
- * Template parameters used in the base URI of all API endpoints. `version` will default to `"v1"`
532
- * if not specified.
533
- */
534
- interface BaseUriParameters {
535
- shortCode: string;
536
- }
537
- type LocaleCode = {
538
- [key: string]: any;
539
- };
540
- /**
541
- * Generic interface for path parameters.
542
- */
543
- interface PathParameters {
544
- [key: string]: string | number | boolean;
545
- }
546
- /**
547
- * Generic interface for query parameters.
548
- */
549
- interface QueryParameters {
550
- [key: string]: string | number | boolean | string[] | number[] | LocaleCode;
551
- }
552
- /**
553
- * Generic interface for all parameter types.
554
- */
555
- type UrlParameters = PathParameters | QueryParameters;
556
- /**
557
- * Custom query parameter type with any string prefixed with `c_` as the key and the allowed
558
- * types for query parameters for the value.
559
- */
560
- type CustomQueryParameters = {
561
- [key in `c_${string}`]: string | number | boolean | string[] | number[];
562
- };
563
- /**
564
- * Custom body request type with any string prefixed with `c_` as the key and the allowed
565
- * types for the value.
566
- */
567
- type CustomRequestBody = {
568
- [key in `c_${string}`]: string | number | boolean | string[] | number[] | {
569
- [key: string]: unknown;
570
- };
571
- };
572
- /**
573
- * Alias for `RequestInit` from TypeScript's DOM lib, to more clearly differentiate
574
- * it from the `RequestInit` provided by node-fetch.
575
- */
576
- type BrowserRequestInit = RequestInit;
577
- /**
578
- * Any properties supported in either the browser or node are accepted.
579
- * Using the right properties in the right context is left to the user.
580
- */
581
- type FetchOptions = NodeRequestInit & BrowserRequestInit;
582
- type FetchFunction = (input: RequestInfo, init?: FetchOptions | undefined) => Promise<Response>;
583
- /**
584
- * Base options that can be passed to the `ClientConfig` class.
585
- */
586
- interface ClientConfigInit<Params extends BaseUriParameters> {
587
- baseUri?: string;
588
- proxy?: string;
589
- headers?: {
590
- [key: string]: string;
591
- };
592
- parameters: Params;
593
- fetchOptions?: FetchOptions;
594
- fetch?: FetchFunction;
595
- transformRequest?: (data: unknown, headers: {
596
- [key: string]: string;
597
- }) => Required<FetchOptions>["body"];
598
- throwOnBadResponse?: boolean;
599
- }
600
- /**
601
- * Configuration parameters common to Commerce SDK clients
602
- */
603
- class ClientConfig<Params extends BaseUriParameters> implements ClientConfigInit<Params> {
604
- baseUri?: string;
605
- proxy?: string;
606
- headers: {
607
- [key: string]: string;
608
- };
609
- parameters: Params;
610
- fetchOptions: FetchOptions;
611
- fetch?: FetchFunction;
612
- transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
613
- throwOnBadResponse: boolean;
614
- constructor(config: ClientConfigInit<Params>);
615
- static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
616
- }
617
- /**
618
- * @type Region:
619
- *
620
- * @property id: Region identifier.
621
- * - **Max Length:** 256
622
- *
623
- * @property components: The components in the region.
624
- *
625
- */
626
- type Region = {
627
- id: string;
628
- components?: Array<Component>;
629
- } & {
630
- [key: string]: any;
631
- };
632
- /**
633
- * @type Component:
634
- *
635
- * @property id: Component identifier.
636
- * - **Max Length:** 256
637
- *
638
- * @property typeId: Component type identifier.
639
- * - **Max Length:** 256
640
- *
641
- * @property data: The configuration data assigned to the component.
642
- *
643
- * @property custom: Any custom data added by the custom code for this component.
644
- *
645
- * @property regions: The regions (and their assigned components) for the component.
646
- *
647
- */
648
- type Component = {
649
- id: string;
650
- typeId: string;
651
- data?: object;
652
- custom?: object;
653
- regions?: Array<Region>;
654
- } & {
655
- [key: string]: any;
656
- };
657
- /**
658
- * A specialized value indicating the system default values for locales.
659
- */
660
- type DefaultFallback = "default";
661
- /**
662
- * @type ErrorResponse:
663
- *
664
- * @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
665
- * - **Max Length:** 256
666
- *
667
- * @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.
668
- * - **Max Length:** 2048
669
- *
670
- * @property detail: A human-readable explanation specific to this occurrence of the problem.
671
- *
672
- * @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.
673
- * - **Max Length:** 2048
674
- *
675
- */
676
- type ErrorResponse = {
677
- title: string;
678
- type: string;
679
- detail: string;
680
- instance?: string;
681
- } & {
682
- [key: string]: any;
683
- };
684
- /**
685
- * @type LocaleCode
686
- * 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.
687
- */
688
- type LocaleCode$0 = DefaultFallback | string;
689
- /**
690
- * @type Page:
691
- *
692
- * @property id: Page identifier.
693
- * - **Max Length:** 256
694
- *
695
- * @property typeId: Page type identifier.
696
- * - **Max Length:** 256
697
- *
698
- * @property aspectTypeId: The aspect type assigned to the page.
699
- * - **Max Length:** 256
700
- *
701
- * @property name: Display name of the page.
702
- * - **Max Length:** 4000
703
- *
704
- * @property description: Description of the page.
705
- * - **Max Length:** 4000
706
- *
707
- * @property pageTitle: The SEO title of the page.
708
- * - **Max Length:** 4000
709
- *
710
- * @property pageDescription: The SEO description of the page.
711
- * - **Max Length:** 4000
712
- *
713
- * @property pageKeywords: The SEO keywords of the page.
714
- * - **Max Length:** 4000
715
- *
716
- * @property data: The configuration data assigned to the page.
717
- *
718
- * @property custom: Any custom data added by the custom code for the page type.
719
- *
720
- * @property regions: The regions (and their assigned components) for the page.
721
- *
722
- */
723
- type Page = {
724
- id: string;
725
- typeId: string;
726
- aspectTypeId?: string;
727
- name?: string;
728
- description?: string;
729
- pageTitle?: string;
730
- pageDescription?: string;
731
- pageKeywords?: string;
732
- data?: object;
733
- custom?: object;
734
- regions?: Array<Region>;
735
- } & {
736
- [key: string]: any;
737
- };
738
- /**
739
- * @type PageResult:
740
- *
741
- * @property data: List of pages.
742
- *
743
- */
744
- type PageResult = {
745
- data: Array<Page>;
746
- } & {
747
- [key: string]: any;
748
- };
749
- type getPageQueryParameters = {
750
- aspectAttributes?: string;
751
- parameters?: string;
752
- siteId: string;
753
- locale?: LocaleCode$0;
754
- };
755
- type getPagePathParameters = {
756
- pageId: string;
757
- organizationId: string;
758
- };
759
- type getPagesQueryParameters = {
760
- categoryId?: string;
761
- productId?: string;
762
- aspectTypeId: string;
763
- aspectAttributes?: string;
764
- parameters?: string;
765
- siteId: string;
766
- locale?: LocaleCode$0;
767
- };
768
- type getPagesPathParameters = {
769
- organizationId: string;
770
- };
771
- /**
772
- * All path parameters that are used by at least one ShopperExperience method.
773
- */
774
- type ShopperExperiencePathParameters = Partial<getPagePathParameters & getPagesPathParameters & {}>;
775
- /**
776
- * All query parameters that are used by at least one ShopperExperience method.
777
- */
778
- type ShopperExperienceQueryParameters = Partial<getPageQueryParameters & getPagesQueryParameters & {}>;
779
- /**
780
- * All parameters that are used by ShopperExperience.
781
- */
782
- type ShopperExperienceParameters = ShopperExperiencePathParameters & BaseUriParameters & ShopperExperienceQueryParameters;
783
- /**
784
- * [Shopper Experience](https://developer.salesforce.com/docs/commerce/commerce-api/references?meta=shopper-experience:Summary)
785
- * ==================================
786
- *
787
- * *Use the Shopper Experience API to look up page information for pages that are created in Page Designer.
788
-
789
- Responses include the following:
790
-
791
- - The entire component hierarchy of the page at design time.
792
- - All merchant data provided at design time.
793
- - Server-side scripting data provided at run time.
794
-
795
- Both the page and components contain the values of all native and custom attributes that have been populated during page authoring.
796
-
797
- Only visible pages are returned. Because the visibility of components is driven by rules (scheduling or customer groups, for example), these rules are subject to evaluation when assembling the component hierarchy in the response. Only components that are visible for the current customer context appear in the response. The same rules apply to the page itself, which is only be processed and returned if it is visible.
798
-
799
- **Important**: Currently, the Shopper Experience API can’t be used when the [storefront password protection](https://documentation.b2c.commercecloud.salesforce.com/DOC1/index.jsp?topic=%2Fcom.demandware.dochelp%2Fcontent%2Fb2c_commerce%2Ftopics%2Fpermissions%2Fb2c_storefront_password_protection.html&resultof=%22%73%74%6f%72%65%66%72%6f%6e%74%22%20%22%70%72%6f%74%65%63%74%69%6f%6e%22%20%22%70%72%6f%74%65%63%74%22%20) feature is enabled.
800
-
801
- ## Authentication & Authorization
802
-
803
- The Shopper Experience API requires a shopper access token from the Shopper Login and API Access Service (SLAS).
804
-
805
- For details on how to request a shopper access token from SLAS, see the guest user flows for [public clients](https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas-public-client.html#guest-user) and [private clients](https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas-private-client.html#guest-user) in the SLAS guides.
806
-
807
- You must include the relevant scope(s) in the client ID used to generate the SLAS token. For details, see the [Authorization Scopes Catalog.](https://developer.salesforce.com/docs/commerce/commerce-api/guide/auth-z-scope-catalog.html).*<br />
808
- *
809
- * Simple example:
810
- *
811
- * ```typescript
812
- * import { ShopperExperience } from "commerce-sdk-isomorphic";
813
- *
814
- * const clientConfig = {
815
- * parameters: {
816
- * clientId: "XXXXXX",
817
- * organizationId: "XXXX",
818
- * shortCode: "XXX",
819
- * siteId: "XX"
820
- * }
821
- * };
822
- * const shopperExperienceClient = new ShopperExperience(clientConfig);
823
- * ```
824
- *
825
- * <span style="font-size:.7em; display:block; text-align: right">
826
- * API Version: 0.0.33<br />
827
- * Last Updated: <br />
828
- * </span>
829
- *
830
- *
831
- */
832
- class ShopperExperience<ConfigParameters extends ShopperExperienceParameters & Record<string, unknown>> {
833
- // baseUri is not required on ClientConfig, but we know that we provide one in the class constructor
834
- clientConfig: ClientConfig<ConfigParameters> & {
835
- baseUri: string;
836
- };
837
- static readonly defaultBaseUri = "https://{shortCode}.api.commercecloud.salesforce.com/experience/shopper-experience/v1";
838
- static readonly apiPaths: {
839
- getPage: string;
840
- getPages: string;
841
- };
842
- constructor(config: ClientConfigInit<ConfigParameters>);
843
- static readonly paramKeys: {
844
- readonly getPage: readonly [
845
- "pageId",
846
- "organizationId",
847
- "siteId",
848
- "aspectAttributes",
849
- "parameters",
850
- "locale"
851
- ];
852
- readonly getPageRequired: readonly [
853
- "pageId",
854
- "organizationId",
855
- "siteId"
856
- ];
857
- readonly getPages: readonly [
858
- "organizationId",
859
- "aspectTypeId",
860
- "siteId",
861
- "categoryId",
862
- "productId",
863
- "aspectAttributes",
864
- "parameters",
865
- "locale"
866
- ];
867
- readonly getPagesRequired: readonly [
868
- "organizationId",
869
- "aspectTypeId",
870
- "siteId"
871
- ];
872
- };
873
- /**
874
- * Get a Page Designer page for a specific page ID. The results apply the visibility rules for the page's components, such as personalization or scheduled visibility.
875
-
876
- **Important**:
877
- - Currently, you can't use the Shopper Experience API when the [storefront password protection](https://documentation.b2c.commercecloud.salesforce.com/DOC1/index.jsp?topic=%2Fcom.demandware.dochelp%2Fcontent%2Fb2c_commerce%2Ftopics%2Fpermissions%2Fb2c_storefront_password_protection.html&resultof=%22%73%74%6f%72%65%66%72%6f%6e%74%22%20%22%70%72%6f%74%65%63%74%69%6f%6e%22%20%22%70%72%6f%74%65%63%74%22%20) feature is enabled.
878
- - Because this resource uses the GET method, you must not pass sensitive data, for example: payment card information, and must not perform transactional processes within the server-side scripts that are run for the page and components.
879
- - Be aware that pagecache during fingerprint calculation will only be leveraged for pages and their components that don't use visibility rules. Furthermore the pagecaching of the actual response assembly solely depends on the response instrumentation with the serverside page type and component type script implementations. For more details also see the [Page Designer Caching Guide](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-dev-for-page-designer.html#page-caching).
880
- *
881
- * If you would like to get a raw Response object use the other getPage function.
882
- *
883
- * @param options - An object containing the options for this method.
884
- * @param options.parameters - An object containing the parameters for this method.
885
- * @param options.parameters.pageId - Identifier for the requested page.
886
- * @param options.parameters.organizationId - An identifier for the organization the request is being made by
887
- * @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.
888
- * @param options.parameters.aspectAttributes - A JSON representation of aspect attributes. Each aspect attribute is a key/value pair. Aspect attributes serve as a runtime parameter contract between caller (for example, this API or the DWScript API) and callee (the page). This parameter must not contain more than 256 characters after URL decoding.
889
- * @param options.parameters.parameters - A free-form definition of parameters that influences the page rendering according to its implementation. This parameter must not contain more than 256 characters after URL decoding.
890
- * @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.
891
- * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
892
- *
893
- * @returns A promise of type Page.
894
- */
895
- getPage(options?: RequireParametersUnlessAllAreOptional<{
896
- parameters?: CompositeParameters<{
897
- pageId: string;
898
- organizationId: string;
899
- siteId: string;
900
- aspectAttributes?: string;
901
- parameters?: string;
902
- locale?: LocaleCode$0;
903
- } & QueryParameters, ConfigParameters>;
904
- headers?: {
905
- [key: string]: string;
906
- };
907
- }>): Promise<Page>;
908
- /**
909
- * Get a Page Designer page for a specific page ID. The results apply the visibility rules for the page's components, such as personalization or scheduled visibility.
910
-
911
- **Important**:
912
- - Currently, you can't use the Shopper Experience API when the [storefront password protection](https://documentation.b2c.commercecloud.salesforce.com/DOC1/index.jsp?topic=%2Fcom.demandware.dochelp%2Fcontent%2Fb2c_commerce%2Ftopics%2Fpermissions%2Fb2c_storefront_password_protection.html&resultof=%22%73%74%6f%72%65%66%72%6f%6e%74%22%20%22%70%72%6f%74%65%63%74%69%6f%6e%22%20%22%70%72%6f%74%65%63%74%22%20) feature is enabled.
913
- - Because this resource uses the GET method, you must not pass sensitive data, for example: payment card information, and must not perform transactional processes within the server-side scripts that are run for the page and components.
914
- - Be aware that pagecache during fingerprint calculation will only be leveraged for pages and their components that don't use visibility rules. Furthermore the pagecaching of the actual response assembly solely depends on the response instrumentation with the serverside page type and component type script implementations. For more details also see the [Page Designer Caching Guide](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-dev-for-page-designer.html#page-caching).
915
- *
916
- * @param options - An object containing the options for this method.
917
- * @param options.parameters - An object containing the parameters for this method.
918
- * @param options.parameters.pageId - Identifier for the requested page.
919
- * @param options.parameters.organizationId - An identifier for the organization the request is being made by
920
- * @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.
921
- * @param options.parameters.aspectAttributes - A JSON representation of aspect attributes. Each aspect attribute is a key/value pair. Aspect attributes serve as a runtime parameter contract between caller (for example, this API or the DWScript API) and callee (the page). This parameter must not contain more than 256 characters after URL decoding.
922
- * @param options.parameters.parameters - A free-form definition of parameters that influences the page rendering according to its implementation. This parameter must not contain more than 256 characters after URL decoding.
923
- * @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.
924
- * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
925
- * @param rawResponse - Set to true to return entire Response object instead of DTO.
926
- *
927
- * @returns A promise of type Response if rawResponse is true, a promise of type Page otherwise.
928
- */
929
- getPage<T extends boolean>(options?: RequireParametersUnlessAllAreOptional<{
930
- parameters?: CompositeParameters<{
931
- pageId: string;
932
- organizationId: string;
933
- siteId: string;
934
- aspectAttributes?: string;
935
- parameters?: string;
936
- locale?: LocaleCode$0;
937
- } & QueryParameters, ConfigParameters>;
938
- headers?: {
939
- [key: string]: string;
940
- };
941
- }>, rawResponse?: T): Promise<T extends true ? Response : Page>;
942
- /**
943
- * Get Page Designer pages. The results apply the visibility rules for each page's components, such as personalization or scheduled visibility.
944
-
945
- You must provide the `aspectTypeId` along with either a `categoryId` or a `productId`. Since you can only create one page-to-product or page-to-category assignment per aspect type, the result contains at most one element.
946
-
947
- **Important**:
948
- - Currently, you can't use the Shopper Experience API when the [storefront password protection](https://documentation.b2c.commercecloud.salesforce.com/DOC1/index.jsp?topic=%2Fcom.demandware.dochelp%2Fcontent%2Fb2c_commerce%2Ftopics%2Fpermissions%2Fb2c_storefront_password_protection.html&resultof=%22%73%74%6f%72%65%66%72%6f%6e%74%22%20%22%70%72%6f%74%65%63%74%69%6f%6e%22%20%22%70%72%6f%74%65%63%74%22%20) feature is enabled.
949
- - Because this resource uses the GET method, you must not pass sensitive data, for example: payment card information, and must not perform transactional processes within the server-side scripts that are run for the page and components.
950
- - Be aware that pagecache during fingerprint calculation will only be leveraged for pages and their components that don't use visibility rules. Furthermore the pagecaching of the actual response assembly solely depends on the response instrumentation with the serverside page type and component type script implementations. For more details also see the [Page Designer Caching Guide](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-dev-for-page-designer.html#page-caching).
951
- *
952
- * If you would like to get a raw Response object use the other getPages function.
953
- *
954
- * @param options - An object containing the options for this method.
955
- * @param options.parameters - An object containing the parameters for this method.
956
- * @param options.parameters.organizationId - An identifier for the organization the request is being made by
957
- * @param options.parameters.aspectTypeId - Aspect type identifier that is used for searching the page assignment in conjunction with either the `productId` or `categoryId`.
958
- * @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.
959
- * @param options.parameters.categoryId - Category identifier that is used for searching the page assignment. Must be provided if no `productId` is provided.
960
- * @param options.parameters.productId - Product identifier that is used for searching the page assignment. Must be provided if no `categoryId` is provided.
961
- * @param options.parameters.aspectAttributes - A JSON representation of aspect attributes. Each aspect attribute is a key/value pair. Aspect attributes serve as a runtime parameter contract between caller (for example, this API or the DWScript API) and callee (the page). This parameter must not contain more than 256 characters after URL decoding.
962
- * @param options.parameters.parameters - A free-form definition of parameters that influences the page rendering according to its implementation. This parameter must not contain more than 256 characters after URL decoding.
963
- * @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.
964
- * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
965
- *
966
- * @returns A promise of type PageResult.
967
- */
968
- getPages(options?: RequireParametersUnlessAllAreOptional<{
969
- parameters?: CompositeParameters<{
970
- organizationId: string;
971
- aspectTypeId: string;
972
- siteId: string;
973
- categoryId?: string;
974
- productId?: string;
975
- aspectAttributes?: string;
976
- parameters?: string;
977
- locale?: LocaleCode$0;
978
- } & QueryParameters, ConfigParameters>;
979
- headers?: {
980
- [key: string]: string;
981
- };
982
- }>): Promise<PageResult>;
983
- /**
984
- * Get Page Designer pages. The results apply the visibility rules for each page's components, such as personalization or scheduled visibility.
985
-
986
- You must provide the `aspectTypeId` along with either a `categoryId` or a `productId`. Since you can only create one page-to-product or page-to-category assignment per aspect type, the result contains at most one element.
987
-
988
- **Important**:
989
- - Currently, you can't use the Shopper Experience API when the [storefront password protection](https://documentation.b2c.commercecloud.salesforce.com/DOC1/index.jsp?topic=%2Fcom.demandware.dochelp%2Fcontent%2Fb2c_commerce%2Ftopics%2Fpermissions%2Fb2c_storefront_password_protection.html&resultof=%22%73%74%6f%72%65%66%72%6f%6e%74%22%20%22%70%72%6f%74%65%63%74%69%6f%6e%22%20%22%70%72%6f%74%65%63%74%22%20) feature is enabled.
990
- - Because this resource uses the GET method, you must not pass sensitive data, for example: payment card information, and must not perform transactional processes within the server-side scripts that are run for the page and components.
991
- - Be aware that pagecache during fingerprint calculation will only be leveraged for pages and their components that don't use visibility rules. Furthermore the pagecaching of the actual response assembly solely depends on the response instrumentation with the serverside page type and component type script implementations. For more details also see the [Page Designer Caching Guide](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-dev-for-page-designer.html#page-caching).
992
- *
993
- * @param options - An object containing the options for this method.
994
- * @param options.parameters - An object containing the parameters for this method.
995
- * @param options.parameters.organizationId - An identifier for the organization the request is being made by
996
- * @param options.parameters.aspectTypeId - Aspect type identifier that is used for searching the page assignment in conjunction with either the `productId` or `categoryId`.
997
- * @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.
998
- * @param options.parameters.categoryId - Category identifier that is used for searching the page assignment. Must be provided if no `productId` is provided.
999
- * @param options.parameters.productId - Product identifier that is used for searching the page assignment. Must be provided if no `categoryId` is provided.
1000
- * @param options.parameters.aspectAttributes - A JSON representation of aspect attributes. Each aspect attribute is a key/value pair. Aspect attributes serve as a runtime parameter contract between caller (for example, this API or the DWScript API) and callee (the page). This parameter must not contain more than 256 characters after URL decoding.
1001
- * @param options.parameters.parameters - A free-form definition of parameters that influences the page rendering according to its implementation. This parameter must not contain more than 256 characters after URL decoding.
1002
- * @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.
1003
- * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
1004
- * @param rawResponse - Set to true to return entire Response object instead of DTO.
1005
- *
1006
- * @returns A promise of type Response if rawResponse is true, a promise of type PageResult otherwise.
1007
- */
1008
- getPages<T extends boolean>(options?: RequireParametersUnlessAllAreOptional<{
1009
- parameters?: CompositeParameters<{
1010
- organizationId: string;
1011
- aspectTypeId: string;
1012
- siteId: string;
1013
- categoryId?: string;
1014
- productId?: string;
1015
- aspectAttributes?: string;
1016
- parameters?: string;
1017
- locale?: LocaleCode$0;
1018
- } & QueryParameters, ConfigParameters>;
1019
- headers?: {
1020
- [key: string]: string;
1021
- };
1022
- }>, rawResponse?: T): Promise<T extends true ? Response : PageResult>;
1023
- }
1024
- }
1025
- declare namespace ShopperExperienceModelTypes {
1026
- /**
1027
- * @type Region:
1028
- *
1029
- * @property id: Region identifier.
1030
- * - **Max Length:** 256
1031
- *
1032
- * @property components: The components in the region.
1033
- *
1034
- */
1035
- type Region = {
1036
- id: string;
1037
- components?: Array<Component>;
1038
- } & {
1039
- [key: string]: any;
1040
- };
1041
- /**
1042
- * @type Component:
1043
- *
1044
- * @property id: Component identifier.
1045
- * - **Max Length:** 256
1046
- *
1047
- * @property typeId: Component type identifier.
1048
- * - **Max Length:** 256
1049
- *
1050
- * @property data: The configuration data assigned to the component.
1051
- *
1052
- * @property custom: Any custom data added by the custom code for this component.
1053
- *
1054
- * @property regions: The regions (and their assigned components) for the component.
1055
- *
1056
- */
1057
- type Component = {
1058
- id: string;
1059
- typeId: string;
1060
- data?: object;
1061
- custom?: object;
1062
- regions?: Array<Region>;
1063
- } & {
1064
- [key: string]: any;
1065
- };
1066
- /**
1067
- * A specialized value indicating the system default values for locales.
1068
- */
1069
- type DefaultFallback = "default";
1070
- /**
1071
- * @type ErrorResponse:
1072
- *
1073
- * @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
1074
- * - **Max Length:** 256
1075
- *
1076
- * @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.
1077
- * - **Max Length:** 2048
1078
- *
1079
- * @property detail: A human-readable explanation specific to this occurrence of the problem.
1080
- *
1081
- * @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.
1082
- * - **Max Length:** 2048
1083
- *
1084
- */
1085
- type ErrorResponse = {
1086
- title: string;
1087
- type: string;
1088
- detail: string;
1089
- instance?: string;
1090
- } & {
1091
- [key: string]: any;
1092
- };
1093
- /**
1094
- * @type LocaleCode
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.
1096
- */
1097
- type LocaleCode = DefaultFallback | string;
1098
- /**
1099
- * @type Page:
1100
- *
1101
- * @property id: Page identifier.
1102
- * - **Max Length:** 256
1103
- *
1104
- * @property typeId: Page type identifier.
1105
- * - **Max Length:** 256
1106
- *
1107
- * @property aspectTypeId: The aspect type assigned to the page.
1108
- * - **Max Length:** 256
1109
- *
1110
- * @property name: Display name of the page.
1111
- * - **Max Length:** 4000
1112
- *
1113
- * @property description: Description of the page.
1114
- * - **Max Length:** 4000
1115
- *
1116
- * @property pageTitle: The SEO title of the page.
1117
- * - **Max Length:** 4000
1118
- *
1119
- * @property pageDescription: The SEO description of the page.
1120
- * - **Max Length:** 4000
1121
- *
1122
- * @property pageKeywords: The SEO keywords of the page.
1123
- * - **Max Length:** 4000
1124
- *
1125
- * @property data: The configuration data assigned to the page.
1126
- *
1127
- * @property custom: Any custom data added by the custom code for the page type.
1128
- *
1129
- * @property regions: The regions (and their assigned components) for the page.
1130
- *
1131
- */
1132
- type Page = {
1133
- id: string;
1134
- typeId: string;
1135
- aspectTypeId?: string;
1136
- name?: string;
1137
- description?: string;
1138
- pageTitle?: string;
1139
- pageDescription?: string;
1140
- pageKeywords?: string;
1141
- data?: object;
1142
- custom?: object;
1143
- regions?: Array<Region>;
1144
- } & {
1145
- [key: string]: any;
1146
- };
1147
- /**
1148
- * @type PageResult:
1149
- *
1150
- * @property data: List of pages.
1151
- *
1152
- */
1153
- type PageResult = {
1154
- data: Array<Page>;
1155
- } & {
1156
- [key: string]: any;
1157
- };
1158
- }
1159
- declare namespace ShopperExperienceTypes {
1160
- type ShopperExperiencePathParameters = ShopperExperienceApiTypes.ShopperExperiencePathParameters;
1161
- type ShopperExperienceQueryParameters = ShopperExperienceApiTypes.ShopperExperienceQueryParameters;
1162
- type getPageQueryParameters = ShopperExperienceApiTypes.getPageQueryParameters;
1163
- type getPagePathParameters = ShopperExperienceApiTypes.getPagePathParameters;
1164
- type getPagesQueryParameters = ShopperExperienceApiTypes.getPagesQueryParameters;
1165
- type getPagesPathParameters = ShopperExperienceApiTypes.getPagesPathParameters;
1166
- type Component = ShopperExperienceModelTypes.Component;
1167
- type DefaultFallback = ShopperExperienceModelTypes.DefaultFallback;
1168
- type ErrorResponse = ShopperExperienceModelTypes.ErrorResponse;
1169
- type LocaleCode = ShopperExperienceModelTypes.LocaleCode;
1170
- type Page = ShopperExperienceModelTypes.Page;
1171
- type PageResult = ShopperExperienceModelTypes.PageResult;
1172
- type Region = ShopperExperienceModelTypes.Region;
1173
- }
1174
- export { defaultBaseUri, getPageQueryParameters, getPagePathParameters, getPagesQueryParameters, getPagesPathParameters, ShopperExperiencePathParameters, ShopperExperienceQueryParameters, ShopperExperienceParameters, ShopperExperience, Component, DefaultFallback, ErrorResponse, LocaleCode$0 as LocaleCode, Page, PageResult, Region, ShopperExperienceTypes };