commerce-sdk-isomorphic 4.1.0 → 4.2.0

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