commerce-sdk-isomorphic 4.0.1-preview-shopper-configurations.0 → 4.0.1

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 (90) hide show
  1. package/README.md +3 -61
  2. package/lib/index.cjs.d.ts +6 -748
  3. package/lib/index.cjs.js +1 -1
  4. package/lib/index.esm.d.ts +6 -748
  5. package/lib/index.esm.js +1 -1
  6. package/package.json +27 -94
  7. package/lib/clientConfig.cjs.d.ts +0 -52
  8. package/lib/clientConfig.cjs.js +0 -1
  9. package/lib/clientConfig.d.ts +0 -52
  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 -10259
  24. package/lib/shopperBaskets.cjs.js +0 -1
  25. package/lib/shopperBaskets.d.ts +0 -10259
  26. package/lib/shopperBaskets.js +0 -1
  27. package/lib/shopperBasketsv2.cjs.d.ts +0 -10453
  28. package/lib/shopperBasketsv2.cjs.js +0 -1
  29. package/lib/shopperBasketsv2.d.ts +0 -10453
  30. package/lib/shopperBasketsv2.js +0 -1
  31. package/lib/shopperConfigurations.cjs.d.ts +0 -601
  32. package/lib/shopperConfigurations.cjs.js +0 -1
  33. package/lib/shopperConfigurations.d.ts +0 -601
  34. package/lib/shopperConfigurations.js +0 -1
  35. package/lib/shopperConsents.cjs.d.ts +0 -1142
  36. package/lib/shopperConsents.cjs.js +0 -1
  37. package/lib/shopperConsents.d.ts +0 -1142
  38. package/lib/shopperConsents.js +0 -1
  39. package/lib/shopperContext.cjs.d.ts +0 -1401
  40. package/lib/shopperContext.cjs.js +0 -1
  41. package/lib/shopperContext.d.ts +0 -1401
  42. package/lib/shopperContext.js +0 -1
  43. package/lib/shopperCustomers.cjs.d.ts +0 -12425
  44. package/lib/shopperCustomers.cjs.js +0 -1
  45. package/lib/shopperCustomers.d.ts +0 -12425
  46. package/lib/shopperCustomers.js +0 -1
  47. package/lib/shopperExperience.cjs.d.ts +0 -1169
  48. package/lib/shopperExperience.cjs.js +0 -1
  49. package/lib/shopperExperience.d.ts +0 -1169
  50. package/lib/shopperExperience.js +0 -1
  51. package/lib/shopperGiftCertificates.cjs.d.ts +0 -729
  52. package/lib/shopperGiftCertificates.cjs.js +0 -1
  53. package/lib/shopperGiftCertificates.d.ts +0 -729
  54. package/lib/shopperGiftCertificates.js +0 -1
  55. package/lib/shopperLogin.cjs.d.ts +0 -3842
  56. package/lib/shopperLogin.cjs.js +0 -1
  57. package/lib/shopperLogin.d.ts +0 -3842
  58. package/lib/shopperLogin.js +0 -1
  59. package/lib/shopperOrders.cjs.d.ts +0 -5393
  60. package/lib/shopperOrders.cjs.js +0 -1
  61. package/lib/shopperOrders.d.ts +0 -5393
  62. package/lib/shopperOrders.js +0 -1
  63. package/lib/shopperProducts.cjs.d.ts +0 -3479
  64. package/lib/shopperProducts.cjs.js +0 -1
  65. package/lib/shopperProducts.d.ts +0 -3479
  66. package/lib/shopperProducts.js +0 -1
  67. package/lib/shopperPromotions.cjs.d.ts +0 -1001
  68. package/lib/shopperPromotions.cjs.js +0 -1
  69. package/lib/shopperPromotions.d.ts +0 -1001
  70. package/lib/shopperPromotions.js +0 -1
  71. package/lib/shopperSearch.cjs.d.ts +0 -3352
  72. package/lib/shopperSearch.cjs.js +0 -1
  73. package/lib/shopperSearch.d.ts +0 -3352
  74. package/lib/shopperSearch.js +0 -1
  75. package/lib/shopperSeo.cjs.d.ts +0 -769
  76. package/lib/shopperSeo.cjs.js +0 -1
  77. package/lib/shopperSeo.d.ts +0 -769
  78. package/lib/shopperSeo.js +0 -1
  79. package/lib/shopperStores.cjs.d.ts +0 -1289
  80. package/lib/shopperStores.cjs.js +0 -1
  81. package/lib/shopperStores.d.ts +0 -1289
  82. package/lib/shopperStores.js +0 -1
  83. package/lib/templateUrl.cjs.d.ts +0 -76
  84. package/lib/templateUrl.cjs.js +0 -1
  85. package/lib/templateUrl.d.ts +0 -76
  86. package/lib/templateUrl.js +0 -1
  87. package/lib/version.cjs.d.ts +0 -3
  88. package/lib/version.cjs.js +0 -1
  89. package/lib/version.d.ts +0 -3
  90. package/lib/version.js +0 -1
@@ -1,729 +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/pricing/shopper-gift-certificates/v1";
15
- /**
16
- * Makes a type easier to read.
17
- */
18
- type Prettify<T> = NonNullable<{
19
- [K in keyof T]: T[K];
20
- }>;
21
- /**
22
- * Generates the types required on a method, based on those provided in the config.
23
- */
24
- type CompositeParameters<MethodParameters extends Record<string, unknown>, ConfigParameters extends Record<string, unknown>> = Prettify<Omit<MethodParameters, keyof ConfigParameters> & Partial<MethodParameters>>;
25
- /**
26
- * If an object has a `parameters` property, and the `parameters` object has required properties,
27
- * then the `parameters` property on the root object is marked as required.
28
- */
29
- type RequireParametersUnlessAllAreOptional<T extends {
30
- parameters?: Record<string, unknown>;
31
- }> = Record<string, never> extends NonNullable<T["parameters"]> ? T : Prettify<T & Required<Pick<T, "parameters">>>;
32
- /**
33
- * Template parameters used in the base URI of all API endpoints. `version` will default to `"v1"`
34
- * if not specified.
35
- */
36
- interface BaseUriParameters {
37
- shortCode: string;
38
- }
39
- type LocaleCode = {
40
- [key: string]: any;
41
- };
42
- /**
43
- * Generic interface for path parameters.
44
- */
45
- interface PathParameters {
46
- [key: string]: string | number | boolean;
47
- }
48
- /**
49
- * Generic interface for query parameters.
50
- */
51
- interface QueryParameters {
52
- [key: string]: string | number | boolean | string[] | number[] | LocaleCode;
53
- }
54
- /**
55
- * Custom body request type with any string prefixed with `c_` as the key and the allowed
56
- * types for the value.
57
- */
58
- type CustomRequestBody = {
59
- [key in `c_${string}`]: string | number | boolean | string[] | number[] | {
60
- [key: string]: unknown;
61
- };
62
- };
63
- /**
64
- * Alias for `RequestInit` from TypeScript's DOM lib, to more clearly differentiate
65
- * it from the `RequestInit` provided by node-fetch.
66
- */
67
- type BrowserRequestInit = RequestInit;
68
- /**
69
- * Any properties supported in either the browser or node are accepted.
70
- * Using the right properties in the right context is left to the user.
71
- */
72
- type FetchOptions = NodeRequestInit & BrowserRequestInit;
73
- /**
74
- * Base options that can be passed to the `ClientConfig` class.
75
- */
76
- interface ClientConfigInit<Params extends BaseUriParameters> {
77
- baseUri?: string;
78
- proxy?: string;
79
- headers?: {
80
- [key: string]: string;
81
- };
82
- parameters: Params;
83
- fetchOptions?: FetchOptions;
84
- transformRequest?: (data: unknown, headers: {
85
- [key: string]: string;
86
- }) => Required<FetchOptions>["body"];
87
- throwOnBadResponse?: boolean;
88
- }
89
- /**
90
- * Configuration parameters common to Commerce SDK clients
91
- */
92
- declare class ClientConfig<Params extends BaseUriParameters> implements ClientConfigInit<Params> {
93
- baseUri?: string;
94
- proxy?: string;
95
- headers: {
96
- [key: string]: string;
97
- };
98
- parameters: Params;
99
- fetchOptions: FetchOptions;
100
- transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
101
- throwOnBadResponse: boolean;
102
- constructor(config: ClientConfigInit<Params>);
103
- static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
104
- }
105
- /**
106
- * @type ErrorResponse:
107
- *
108
- * @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
109
- * - **Max Length:** 256
110
- *
111
- * @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.
112
- * - **Max Length:** 2048
113
- *
114
- * @property detail: A human-readable explanation specific to this occurrence of the problem.
115
- *
116
- * @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.
117
- * - **Max Length:** 2048
118
- *
119
- */
120
- type ErrorResponse = {
121
- title: string;
122
- type: string;
123
- detail: string;
124
- instance?: string;
125
- } & {
126
- [key: string]: any;
127
- };
128
- /**
129
- * @type GiftCertificate: Document representing a gift certificate.
130
- *
131
- * @property amount: The gift certificate original amount.
132
- *
133
- * @property balance: The gift certificate remaining balance.
134
- *
135
- * @property description: The gift certificate description.
136
- *
137
- * @property enabled: Is the gift certificate is enabled?
138
- *
139
- * @property maskedGiftCertificateCode: The masked gift certificate code.
140
- *
141
- * @property merchantId: The merchant ID.
142
- *
143
- * @property message: The message.
144
- *
145
- * @property recipientEmail: The recipient email.
146
- *
147
- * @property recipientName: The recipient name.
148
- *
149
- * @property senderName: The sender name.
150
- *
151
- * @property status: The gift certificate status.
152
- *
153
- */
154
- type GiftCertificate = {
155
- amount: number;
156
- balance: number;
157
- description?: string;
158
- enabled: boolean;
159
- maskedGiftCertificateCode: string;
160
- merchantId: string;
161
- message?: string;
162
- recipientEmail: string;
163
- recipientName: string;
164
- senderName: string;
165
- status: GiftCertificateStatusEnum;
166
- } & {
167
- [key: string]: any;
168
- };
169
- type GiftCertificateStatusEnum = "pending" | "issued" | "partially_redeemed" | "redeemed";
170
- /**
171
- * @type GiftCertificateRequest: Document representing a gift certificate request data.
172
- *
173
- * @property giftCertificateCode: The gift certificate code.
174
- *
175
- */
176
- type GiftCertificateRequest = {
177
- giftCertificateCode: string;
178
- } & {
179
- [key: string]: any;
180
- };
181
- type getGiftCertificateQueryParameters = {
182
- siteId: string;
183
- };
184
- type getGiftCertificatePathParameters = {
185
- organizationId: string;
186
- };
187
- /**
188
- * All path parameters that are used by at least one ShopperGiftCertificates method.
189
- */
190
- type ShopperGiftCertificatesPathParameters = Partial<getGiftCertificatePathParameters & {}>;
191
- /**
192
- * All query parameters that are used by at least one ShopperGiftCertificates method.
193
- */
194
- type ShopperGiftCertificatesQueryParameters = Partial<getGiftCertificateQueryParameters & {}>;
195
- /**
196
- * All parameters that are used by ShopperGiftCertificates.
197
- */
198
- type ShopperGiftCertificatesParameters = ShopperGiftCertificatesPathParameters & BaseUriParameters & ShopperGiftCertificatesQueryParameters;
199
- /**
200
- * [Shopper Gift Certificates](https://developer.salesforce.com/docs/commerce/commerce-api/references?meta=shopper-gift-certificates:Summary)
201
- * ==================================
202
- *
203
- * *# API Overview
204
-
205
- Use the Shopper Gift Certificates API to obtain gift certificate details.
206
-
207
- ## Authentication & Authorization
208
-
209
- The Shopper Gift Certificates API requires a JSON Web Token acquired via the Shopper Customers endpoint:
210
-
211
- ```
212
- https://{{shortCode}}.api.commercecloud.salesforce.com/customer/shopper-customers/v1/organizations/{{organizationId}}/customers/actions/login
213
- ```
214
-
215
- You must include the relevant scope(s) in the client ID used to generate the SLAS token. For details, see [Authorization Scopes Catalog.](https://developer.salesforce.com/docs/commerce/commerce-api/guide/auth-z-scope-catalog.html)
216
-
217
- ## Use Cases
218
-
219
- ### Retrieve Existing Gift Certificate Details
220
-
221
- A shopper who received a code identifying a gift certificate can use the gift certificate code to query information, such as the status or remaining balance.
222
-
223
- ### Use Hooks
224
-
225
- For details working with hooks, see [Extensibility with Hooks.](https://developer.salesforce.com/docs/commerce/commerce-api/guide/extensibility_via_hooks.html)*<br />
226
- *
227
- * Simple example:
228
- *
229
- * ```typescript
230
- * import { ShopperGiftCertificates } from "commerce-sdk-isomorphic";
231
- *
232
- * const clientConfig = {
233
- * parameters: {
234
- * clientId: "XXXXXX",
235
- * organizationId: "XXXX",
236
- * shortCode: "XXX",
237
- * siteId: "XX"
238
- * }
239
- * };
240
- * const shopperGiftCertificatesClient = new ShopperGiftCertificates(clientConfig);
241
- * ```
242
- *
243
- * <span style="font-size:.7em; display:block; text-align: right">
244
- * API Version: 0.0.33<br />
245
- * Last Updated: <br />
246
- * </span>
247
- *
248
- *
249
- */
250
- declare class ShopperGiftCertificates<ConfigParameters extends ShopperGiftCertificatesParameters & Record<string, unknown>> {
251
- // baseUri is not required on ClientConfig, but we know that we provide one in the class constructor
252
- clientConfig: ClientConfig<ConfigParameters> & {
253
- baseUri: string;
254
- };
255
- static readonly defaultBaseUri = "https://{shortCode}.api.commercecloud.salesforce.com/pricing/shopper-gift-certificates/v1";
256
- static readonly apiPaths: {
257
- getGiftCertificate: string;
258
- };
259
- constructor(config: ClientConfigInit<ConfigParameters>);
260
- static readonly paramKeys: {
261
- readonly getGiftCertificate: readonly [
262
- "organizationId",
263
- "siteId"
264
- ];
265
- readonly getGiftCertificateRequired: readonly [
266
- "organizationId",
267
- "siteId"
268
- ];
269
- };
270
- /**
271
- *
272
- *
273
- * If you would like to get a raw Response object use the other getGiftCertificate function.
274
- *
275
- * @param options - An object containing the options for this method.
276
- * @param options.parameters - An object containing the parameters for this method.
277
- * @param options.parameters.organizationId - An identifier for the organization the request is being made by
278
- * @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.
279
- * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
280
- * @param options.body - The data to send as the request body.
281
- *
282
- * @returns A promise of type GiftCertificate.
283
- */
284
- getGiftCertificate(options: RequireParametersUnlessAllAreOptional<{
285
- parameters?: CompositeParameters<{
286
- organizationId: string;
287
- siteId: string;
288
- } & QueryParameters, ConfigParameters>;
289
- headers?: {
290
- [key: string]: string;
291
- };
292
- body: GiftCertificateRequest & CustomRequestBody;
293
- }>): Promise<GiftCertificate>;
294
- /**
295
- *
296
- *
297
- * @param options - An object containing the options for this method.
298
- * @param options.parameters - An object containing the parameters for this method.
299
- * @param options.parameters.organizationId - An identifier for the organization the request is being made by
300
- * @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.
301
- * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
302
- * @param options.body - The data to send as the request body.
303
- * @param rawResponse - Set to true to return entire Response object instead of DTO.
304
- *
305
- * @returns A promise of type Response if rawResponse is true, a promise of type GiftCertificate otherwise.
306
- */
307
- getGiftCertificate<T extends boolean>(options: RequireParametersUnlessAllAreOptional<{
308
- parameters?: CompositeParameters<{
309
- organizationId: string;
310
- siteId: string;
311
- } & QueryParameters, ConfigParameters>;
312
- headers?: {
313
- [key: string]: string;
314
- };
315
- body: GiftCertificateRequest & CustomRequestBody;
316
- }>, rawResponse?: T): Promise<T extends true ? Response : GiftCertificate>;
317
- }
318
- declare namespace ShopperGiftCertificatesApiTypes {
319
- /*
320
- * Copyright (c) 2023, Salesforce, Inc.
321
- * All rights reserved.
322
- * SPDX-License-Identifier: BSD-3-Clause
323
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
324
- */
325
- /**
326
- * Makes a type easier to read.
327
- */
328
- type Prettify<T> = NonNullable<{
329
- [K in keyof T]: T[K];
330
- }>;
331
- /**
332
- * Generates the types required on a method, based on those provided in the config.
333
- */
334
- type CompositeParameters<MethodParameters extends Record<string, unknown>, ConfigParameters extends Record<string, unknown>> = Prettify<Omit<MethodParameters, keyof ConfigParameters> & Partial<MethodParameters>>;
335
- /**
336
- * If an object has a `parameters` property, and the `parameters` object has required properties,
337
- * then the `parameters` property on the root object is marked as required.
338
- */
339
- type RequireParametersUnlessAllAreOptional<T extends {
340
- parameters?: Record<string, unknown>;
341
- }> = Record<string, never> extends NonNullable<T["parameters"]> ? T : Prettify<T & Required<Pick<T, "parameters">>>;
342
- /**
343
- * Template parameters used in the base URI of all API endpoints. `version` will default to `"v1"`
344
- * if not specified.
345
- */
346
- interface BaseUriParameters {
347
- shortCode: string;
348
- }
349
- type LocaleCode = {
350
- [key: string]: any;
351
- };
352
- /**
353
- * Generic interface for path parameters.
354
- */
355
- interface PathParameters {
356
- [key: string]: string | number | boolean;
357
- }
358
- /**
359
- * Generic interface for query parameters.
360
- */
361
- interface QueryParameters {
362
- [key: string]: string | number | boolean | string[] | number[] | LocaleCode;
363
- }
364
- /**
365
- * Generic interface for all parameter types.
366
- */
367
- type UrlParameters = PathParameters | QueryParameters;
368
- /**
369
- * Custom query parameter type with any string prefixed with `c_` as the key and the allowed
370
- * types for query parameters for the value.
371
- */
372
- type CustomQueryParameters = {
373
- [key in `c_${string}`]: string | number | boolean | string[] | number[];
374
- };
375
- /**
376
- * Custom body request type with any string prefixed with `c_` as the key and the allowed
377
- * types for the value.
378
- */
379
- type CustomRequestBody = {
380
- [key in `c_${string}`]: string | number | boolean | string[] | number[] | {
381
- [key: string]: unknown;
382
- };
383
- };
384
- /**
385
- * Alias for `RequestInit` from TypeScript's DOM lib, to more clearly differentiate
386
- * it from the `RequestInit` provided by node-fetch.
387
- */
388
- type BrowserRequestInit = RequestInit;
389
- /**
390
- * Any properties supported in either the browser or node are accepted.
391
- * Using the right properties in the right context is left to the user.
392
- */
393
- type FetchOptions = NodeRequestInit & BrowserRequestInit;
394
- /**
395
- * Base options that can be passed to the `ClientConfig` class.
396
- */
397
- interface ClientConfigInit<Params extends BaseUriParameters> {
398
- baseUri?: string;
399
- proxy?: string;
400
- headers?: {
401
- [key: string]: string;
402
- };
403
- parameters: Params;
404
- fetchOptions?: FetchOptions;
405
- transformRequest?: (data: unknown, headers: {
406
- [key: string]: string;
407
- }) => Required<FetchOptions>["body"];
408
- throwOnBadResponse?: boolean;
409
- }
410
- type FetchFunction = (input: RequestInfo, init?: FetchOptions | undefined) => Promise<Response>;
411
- /**
412
- * Configuration parameters common to Commerce SDK clients
413
- */
414
- class ClientConfig<Params extends BaseUriParameters> implements ClientConfigInit<Params> {
415
- baseUri?: string;
416
- proxy?: string;
417
- headers: {
418
- [key: string]: string;
419
- };
420
- parameters: Params;
421
- fetchOptions: FetchOptions;
422
- transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
423
- throwOnBadResponse: boolean;
424
- constructor(config: ClientConfigInit<Params>);
425
- static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
426
- }
427
- /**
428
- * @type ErrorResponse:
429
- *
430
- * @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
431
- * - **Max Length:** 256
432
- *
433
- * @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.
434
- * - **Max Length:** 2048
435
- *
436
- * @property detail: A human-readable explanation specific to this occurrence of the problem.
437
- *
438
- * @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.
439
- * - **Max Length:** 2048
440
- *
441
- */
442
- type ErrorResponse = {
443
- title: string;
444
- type: string;
445
- detail: string;
446
- instance?: string;
447
- } & {
448
- [key: string]: any;
449
- };
450
- /**
451
- * @type GiftCertificate: Document representing a gift certificate.
452
- *
453
- * @property amount: The gift certificate original amount.
454
- *
455
- * @property balance: The gift certificate remaining balance.
456
- *
457
- * @property description: The gift certificate description.
458
- *
459
- * @property enabled: Is the gift certificate is enabled?
460
- *
461
- * @property maskedGiftCertificateCode: The masked gift certificate code.
462
- *
463
- * @property merchantId: The merchant ID.
464
- *
465
- * @property message: The message.
466
- *
467
- * @property recipientEmail: The recipient email.
468
- *
469
- * @property recipientName: The recipient name.
470
- *
471
- * @property senderName: The sender name.
472
- *
473
- * @property status: The gift certificate status.
474
- *
475
- */
476
- type GiftCertificate = {
477
- amount: number;
478
- balance: number;
479
- description?: string;
480
- enabled: boolean;
481
- maskedGiftCertificateCode: string;
482
- merchantId: string;
483
- message?: string;
484
- recipientEmail: string;
485
- recipientName: string;
486
- senderName: string;
487
- status: GiftCertificateStatusEnum;
488
- } & {
489
- [key: string]: any;
490
- };
491
- type GiftCertificateStatusEnum = "pending" | "issued" | "partially_redeemed" | "redeemed";
492
- /**
493
- * @type GiftCertificateRequest: Document representing a gift certificate request data.
494
- *
495
- * @property giftCertificateCode: The gift certificate code.
496
- *
497
- */
498
- type GiftCertificateRequest = {
499
- giftCertificateCode: string;
500
- } & {
501
- [key: string]: any;
502
- };
503
- type getGiftCertificateQueryParameters = {
504
- siteId: string;
505
- };
506
- type getGiftCertificatePathParameters = {
507
- organizationId: string;
508
- };
509
- /**
510
- * All path parameters that are used by at least one ShopperGiftCertificates method.
511
- */
512
- type ShopperGiftCertificatesPathParameters = Partial<getGiftCertificatePathParameters & {}>;
513
- /**
514
- * All query parameters that are used by at least one ShopperGiftCertificates method.
515
- */
516
- type ShopperGiftCertificatesQueryParameters = Partial<getGiftCertificateQueryParameters & {}>;
517
- /**
518
- * All parameters that are used by ShopperGiftCertificates.
519
- */
520
- type ShopperGiftCertificatesParameters = ShopperGiftCertificatesPathParameters & BaseUriParameters & ShopperGiftCertificatesQueryParameters;
521
- /**
522
- * [Shopper Gift Certificates](https://developer.salesforce.com/docs/commerce/commerce-api/references?meta=shopper-gift-certificates:Summary)
523
- * ==================================
524
- *
525
- * *# API Overview
526
-
527
- Use the Shopper Gift Certificates API to obtain gift certificate details.
528
-
529
- ## Authentication & Authorization
530
-
531
- The Shopper Gift Certificates API requires a JSON Web Token acquired via the Shopper Customers endpoint:
532
-
533
- ```
534
- https://{{shortCode}}.api.commercecloud.salesforce.com/customer/shopper-customers/v1/organizations/{{organizationId}}/customers/actions/login
535
- ```
536
-
537
- You must include the relevant scope(s) in the client ID used to generate the SLAS token. For details, see [Authorization Scopes Catalog.](https://developer.salesforce.com/docs/commerce/commerce-api/guide/auth-z-scope-catalog.html)
538
-
539
- ## Use Cases
540
-
541
- ### Retrieve Existing Gift Certificate Details
542
-
543
- A shopper who received a code identifying a gift certificate can use the gift certificate code to query information, such as the status or remaining balance.
544
-
545
- ### Use Hooks
546
-
547
- For details working with hooks, see [Extensibility with Hooks.](https://developer.salesforce.com/docs/commerce/commerce-api/guide/extensibility_via_hooks.html)*<br />
548
- *
549
- * Simple example:
550
- *
551
- * ```typescript
552
- * import { ShopperGiftCertificates } from "commerce-sdk-isomorphic";
553
- *
554
- * const clientConfig = {
555
- * parameters: {
556
- * clientId: "XXXXXX",
557
- * organizationId: "XXXX",
558
- * shortCode: "XXX",
559
- * siteId: "XX"
560
- * }
561
- * };
562
- * const shopperGiftCertificatesClient = new ShopperGiftCertificates(clientConfig);
563
- * ```
564
- *
565
- * <span style="font-size:.7em; display:block; text-align: right">
566
- * API Version: 0.0.33<br />
567
- * Last Updated: <br />
568
- * </span>
569
- *
570
- *
571
- */
572
- class ShopperGiftCertificates<ConfigParameters extends ShopperGiftCertificatesParameters & Record<string, unknown>> {
573
- // baseUri is not required on ClientConfig, but we know that we provide one in the class constructor
574
- clientConfig: ClientConfig<ConfigParameters> & {
575
- baseUri: string;
576
- };
577
- static readonly defaultBaseUri = "https://{shortCode}.api.commercecloud.salesforce.com/pricing/shopper-gift-certificates/v1";
578
- static readonly apiPaths: {
579
- getGiftCertificate: string;
580
- };
581
- constructor(config: ClientConfigInit<ConfigParameters>);
582
- static readonly paramKeys: {
583
- readonly getGiftCertificate: readonly [
584
- "organizationId",
585
- "siteId"
586
- ];
587
- readonly getGiftCertificateRequired: readonly [
588
- "organizationId",
589
- "siteId"
590
- ];
591
- };
592
- /**
593
- *
594
- *
595
- * If you would like to get a raw Response object use the other getGiftCertificate function.
596
- *
597
- * @param options - An object containing the options for this method.
598
- * @param options.parameters - An object containing the parameters for this method.
599
- * @param options.parameters.organizationId - An identifier for the organization the request is being made by
600
- * @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.
601
- * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
602
- * @param options.body - The data to send as the request body.
603
- *
604
- * @returns A promise of type GiftCertificate.
605
- */
606
- getGiftCertificate(options: RequireParametersUnlessAllAreOptional<{
607
- parameters?: CompositeParameters<{
608
- organizationId: string;
609
- siteId: string;
610
- } & QueryParameters, ConfigParameters>;
611
- headers?: {
612
- [key: string]: string;
613
- };
614
- body: GiftCertificateRequest & CustomRequestBody;
615
- }>): Promise<GiftCertificate>;
616
- /**
617
- *
618
- *
619
- * @param options - An object containing the options for this method.
620
- * @param options.parameters - An object containing the parameters for this method.
621
- * @param options.parameters.organizationId - An identifier for the organization the request is being made by
622
- * @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.
623
- * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
624
- * @param options.body - The data to send as the request body.
625
- * @param rawResponse - Set to true to return entire Response object instead of DTO.
626
- *
627
- * @returns A promise of type Response if rawResponse is true, a promise of type GiftCertificate otherwise.
628
- */
629
- getGiftCertificate<T extends boolean>(options: RequireParametersUnlessAllAreOptional<{
630
- parameters?: CompositeParameters<{
631
- organizationId: string;
632
- siteId: string;
633
- } & QueryParameters, ConfigParameters>;
634
- headers?: {
635
- [key: string]: string;
636
- };
637
- body: GiftCertificateRequest & CustomRequestBody;
638
- }>, rawResponse?: T): Promise<T extends true ? Response : GiftCertificate>;
639
- }
640
- }
641
- declare namespace ShopperGiftCertificatesModelTypes {
642
- /**
643
- * @type ErrorResponse:
644
- *
645
- * @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
646
- * - **Max Length:** 256
647
- *
648
- * @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.
649
- * - **Max Length:** 2048
650
- *
651
- * @property detail: A human-readable explanation specific to this occurrence of the problem.
652
- *
653
- * @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.
654
- * - **Max Length:** 2048
655
- *
656
- */
657
- type ErrorResponse = {
658
- title: string;
659
- type: string;
660
- detail: string;
661
- instance?: string;
662
- } & {
663
- [key: string]: any;
664
- };
665
- /**
666
- * @type GiftCertificate: Document representing a gift certificate.
667
- *
668
- * @property amount: The gift certificate original amount.
669
- *
670
- * @property balance: The gift certificate remaining balance.
671
- *
672
- * @property description: The gift certificate description.
673
- *
674
- * @property enabled: Is the gift certificate is enabled?
675
- *
676
- * @property maskedGiftCertificateCode: The masked gift certificate code.
677
- *
678
- * @property merchantId: The merchant ID.
679
- *
680
- * @property message: The message.
681
- *
682
- * @property recipientEmail: The recipient email.
683
- *
684
- * @property recipientName: The recipient name.
685
- *
686
- * @property senderName: The sender name.
687
- *
688
- * @property status: The gift certificate status.
689
- *
690
- */
691
- type GiftCertificate = {
692
- amount: number;
693
- balance: number;
694
- description?: string;
695
- enabled: boolean;
696
- maskedGiftCertificateCode: string;
697
- merchantId: string;
698
- message?: string;
699
- recipientEmail: string;
700
- recipientName: string;
701
- senderName: string;
702
- status: GiftCertificateStatusEnum;
703
- } & {
704
- [key: string]: any;
705
- };
706
- type GiftCertificateStatusEnum = "pending" | "issued" | "partially_redeemed" | "redeemed";
707
- /**
708
- * @type GiftCertificateRequest: Document representing a gift certificate request data.
709
- *
710
- * @property giftCertificateCode: The gift certificate code.
711
- *
712
- */
713
- type GiftCertificateRequest = {
714
- giftCertificateCode: string;
715
- } & {
716
- [key: string]: any;
717
- };
718
- }
719
- declare namespace ShopperGiftCertificatesTypes {
720
- type ShopperGiftCertificatesPathParameters = ShopperGiftCertificatesApiTypes.ShopperGiftCertificatesPathParameters;
721
- type ShopperGiftCertificatesQueryParameters = ShopperGiftCertificatesApiTypes.ShopperGiftCertificatesQueryParameters;
722
- type getGiftCertificateQueryParameters = ShopperGiftCertificatesApiTypes.getGiftCertificateQueryParameters;
723
- type getGiftCertificatePathParameters = ShopperGiftCertificatesApiTypes.getGiftCertificatePathParameters;
724
- type ErrorResponse = ShopperGiftCertificatesModelTypes.ErrorResponse;
725
- type GiftCertificate = ShopperGiftCertificatesModelTypes.GiftCertificate;
726
- type GiftCertificateStatusEnum = ShopperGiftCertificatesModelTypes.GiftCertificateStatusEnum;
727
- type GiftCertificateRequest = ShopperGiftCertificatesModelTypes.GiftCertificateRequest;
728
- }
729
- export { defaultBaseUri, getGiftCertificateQueryParameters, getGiftCertificatePathParameters, ShopperGiftCertificatesPathParameters, ShopperGiftCertificatesQueryParameters, ShopperGiftCertificatesParameters, ShopperGiftCertificates, ErrorResponse, GiftCertificate, GiftCertificateStatusEnum, GiftCertificateRequest, ShopperGiftCertificatesTypes };