commerce-sdk-isomorphic 4.0.0 → 4.0.1-preview-shopper-test.0

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