@bigcommerce/checkout-sdk 1.273.0 → 1.275.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 (32) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/checkout-button.d.ts +168 -101
  3. package/dist/checkout-button.js +1 -1
  4. package/dist/checkout-button.js.map +1 -1
  5. package/dist/checkout-button.umd.js +1 -1
  6. package/dist/checkout-button.umd.js.map +1 -1
  7. package/dist/checkout-sdk.d.ts +525 -447
  8. package/dist/checkout-sdk.js +1 -1
  9. package/dist/checkout-sdk.js.map +1 -1
  10. package/dist/checkout-sdk.umd.js +1 -1
  11. package/dist/checkout-sdk.umd.js.map +1 -1
  12. package/dist/hosted-form.js.map +1 -1
  13. package/dist/hosted-form.umd.js.map +1 -1
  14. package/docs/README.md +40 -4
  15. package/docs/classes/CheckoutButtonInitializer.md +1 -1
  16. package/docs/classes/CheckoutService.md +2 -2
  17. package/docs/enums/AmazonPayV2ButtonColor.md +29 -0
  18. package/docs/interfaces/AmazonPayV2ButtonConfig.md +80 -0
  19. package/docs/interfaces/AmazonPayV2ButtonParams.md +45 -1
  20. package/docs/interfaces/AmazonPayV2CheckoutSessionConfig.md +36 -0
  21. package/docs/interfaces/AmazonPayV2NewButtonParams.md +125 -0
  22. package/docs/interfaces/ApplePayButtonInitializeOptions_2.md +38 -0
  23. package/docs/interfaces/{CheckoutButtonInitializeOptions.md → BaseCheckoutButtonInitializeOptions.md} +26 -26
  24. package/docs/interfaces/{CustomerInitializeOptions.md → BaseCustomerInitializeOptions.md} +25 -31
  25. package/docs/interfaces/{PaymentInitializeOptions.md → BasePaymentInitializeOptions.md} +39 -49
  26. package/docs/interfaces/CheckoutButtonOptions.md +1 -1
  27. package/docs/interfaces/CustomerRequestOptions.md +1 -1
  28. package/docs/interfaces/PaymentRequestOptions.md +1 -1
  29. package/docs/interfaces/WithApplePayButtonInitializeOptions.md +15 -0
  30. package/docs/interfaces/WithApplePayCustomerInitializeOptions.md +18 -0
  31. package/docs/interfaces/WithApplePayPaymentInitializeOptions.md +18 -0
  32. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.275.1](https://github.com/bigcommerce/checkout-sdk-js/compare/v1.275.0...v1.275.1) (2022-08-09)
6
+
7
+ ## [1.275.0](https://github.com/bigcommerce/checkout-sdk-js/compare/v1.274.0...v1.275.0) (2022-08-09)
8
+
9
+
10
+ ### Features
11
+
12
+ * **payment:** INT-6128 AmazonPayV2: Introduce the new API V2 config ([#1502](https://github.com/bigcommerce/checkout-sdk-js/issues/1502)) ([11bbe8b](https://github.com/bigcommerce/checkout-sdk-js/commit/11bbe8b4ec82d063cc13d9fdf3d8f59c282b7109))
13
+
14
+ ## [1.274.0](https://github.com/bigcommerce/checkout-sdk-js/compare/v1.273.0...v1.274.0) (2022-08-08)
15
+
16
+
17
+ ### Features
18
+
19
+ * **checkout:** CHECKOUT-6781 Point to interfaces extracted from integration packages ([d12f024](https://github.com/bigcommerce/checkout-sdk-js/commit/d12f024a3dc53db847900f8e3d87d8c4b88ee031))
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * **payment:** STRIPE-51 set a stored card as default during checkout ([#1498](https://github.com/bigcommerce/checkout-sdk-js/issues/1498)) ([d929a2d](https://github.com/bigcommerce/checkout-sdk-js/commit/d929a2d20cd424a4a88430a8571b7ab5e3dfff3d))
25
+
5
26
  ## [1.273.0](https://github.com/bigcommerce/checkout-sdk-js/compare/v1.272.3...v1.273.0) (2022-08-03)
6
27
 
7
28
 
@@ -24,20 +24,17 @@ declare interface AddressRequestBody {
24
24
  }>;
25
25
  }
26
26
 
27
- /**
28
- * The required config to render the AmazonPayV2 buttton.
29
- */
30
- declare type AmazonPayV2ButtonInitializeOptions = AmazonPayV2ButtonParams;
27
+ declare enum AmazonPayV2ButtonColor {
28
+ Gold = "Gold",
29
+ LightGray = "LightGray",
30
+ DarkGray = "DarkGray"
31
+ }
31
32
 
32
- declare interface AmazonPayV2ButtonParams {
33
+ declare interface AmazonPayV2ButtonConfig {
33
34
  /**
34
35
  * Amazon Pay merchant account identifier.
35
36
  */
36
37
  merchantId: string;
37
- /**
38
- * Configuration for calling the endpoint to Create Checkout Session.
39
- */
40
- createCheckoutSession: AmazonPayV2CheckoutSession;
41
38
  /**
42
39
  * Placement of the Amazon Pay button on your website.
43
40
  */
@@ -50,16 +47,35 @@ declare interface AmazonPayV2ButtonParams {
50
47
  * Product type selected for checkout. Default is 'PayAndShip'.
51
48
  */
52
49
  productType?: AmazonPayV2PayOptions;
50
+ /**
51
+ * Color of the Amazon Pay button.
52
+ */
53
+ buttonColor?: AmazonPayV2ButtonColor;
53
54
  /**
54
55
  * Language used to render the button and text on Amazon Pay hosted pages.
55
56
  */
56
57
  checkoutLanguage?: AmazonPayV2CheckoutLanguage;
57
58
  /**
58
- * Sets button to Sandbox environment. Default is false.
59
+ * Sets button to Sandbox environment. You do not have to set this parameter
60
+ * if your `publicKeyId` has an environment prefix. Default is false.
59
61
  */
60
62
  sandbox?: boolean;
61
63
  }
62
64
 
65
+ /**
66
+ * The required config to render the AmazonPayV2 buttton.
67
+ */
68
+ declare type AmazonPayV2ButtonInitializeOptions = AmazonPayV2ButtonParameters;
69
+
70
+ declare type AmazonPayV2ButtonParameters = AmazonPayV2ButtonParams | AmazonPayV2NewButtonParams;
71
+
72
+ declare interface AmazonPayV2ButtonParams extends AmazonPayV2ButtonConfig {
73
+ /**
74
+ * Configuration for calling the endpoint to Create Checkout Session.
75
+ */
76
+ createCheckoutSession: AmazonPayV2CheckoutSession;
77
+ }
78
+
63
79
  declare enum AmazonPayV2CheckoutLanguage {
64
80
  en_US = "en_US",
65
81
  en_GB = "en_GB",
@@ -85,6 +101,22 @@ declare interface AmazonPayV2CheckoutSession {
85
101
  extractAmazonCheckoutSessionId?: string;
86
102
  }
87
103
 
104
+ declare interface AmazonPayV2CheckoutSessionConfig {
105
+ /**
106
+ * A payload that Amazon Pay will use to create a Checkout Session object.
107
+ */
108
+ payloadJSON: string;
109
+ /**
110
+ * Payload's signature.
111
+ */
112
+ signature: string;
113
+ /**
114
+ * Credential provided by Amazon Pay. You do not have to set this parameter
115
+ * if your `publicKeyId` has an environment prefix.
116
+ */
117
+ publicKeyId?: string;
118
+ }
119
+
88
120
  declare enum AmazonPayV2LedgerCurrency {
89
121
  USD = "USD",
90
122
  EUR = "EUR",
@@ -92,6 +124,18 @@ declare enum AmazonPayV2LedgerCurrency {
92
124
  JPY = "JPY"
93
125
  }
94
126
 
127
+ declare interface AmazonPayV2NewButtonParams extends AmazonPayV2ButtonConfig {
128
+ /**
129
+ * Credential provided by Amazon Pay. You must also set the `sandbox`
130
+ * parameter if your `publicKeyId` does not have an environment prefix.
131
+ */
132
+ publicKeyId?: string;
133
+ /**
134
+ * Create Checkout Session configuration.
135
+ */
136
+ createCheckoutSessionConfig: AmazonPayV2CheckoutSessionConfig;
137
+ }
138
+
95
139
  declare enum AmazonPayV2PayOptions {
96
140
  /** Select this product type if you need the buyer's shipping details. */
97
141
  PayAndShip = "PayAndShip",
@@ -129,103 +173,24 @@ declare interface ApplePayButtonInitializeOptions {
129
173
  onPaymentAuthorize(): void;
130
174
  }
131
175
 
132
- declare interface BraintreeError extends Error {
133
- type: 'CUSTOMER' | 'MERCHANT' | 'NETWORK' | 'INTERNAL' | 'UNKNOWN';
134
- code: string;
135
- details?: unknown;
136
- }
137
-
138
- declare interface BraintreePaypalButtonInitializeOptions {
139
- /**
140
- * The ID of a container which the messaging should be inserted.
141
- */
142
- messagingContainerId?: string;
143
- /**
144
- * A set of styling options for the checkout button.
145
- */
146
- style?: Pick<PaypalButtonStyleOptions, 'layout' | 'size' | 'color' | 'label' | 'shape' | 'tagline' | 'fundingicons' | 'height'>;
147
- /**
148
- * Address to be used for shipping.
149
- * If not provided, it will use the first saved address from the active customer.
150
- */
151
- shippingAddress?: Address | null;
152
- /**
153
- * A callback that gets called if unable to authorize and tokenize payment.
154
- *
155
- * @param error - The error object describing the failure.
156
- */
157
- onAuthorizeError?(error: BraintreeError | StandardError): void;
158
- /**
159
- * A callback that gets called if unable to submit payment.
160
- *
161
- * @param error - The error object describing the failure.
162
- */
163
- onPaymentError?(error: BraintreeError | StandardError): void;
164
- /**
165
- * A callback that gets called on any error instead of submit payment or authorization errors.
166
- *
167
- * @param error - The error object describing the failure.
168
- */
169
- onError?(error: BraintreeError | StandardError): void;
170
- }
171
-
172
- declare interface BraintreePaypalCreditButtonInitializeOptions {
173
- /**
174
- * A set of styling options for the checkout button.
175
- */
176
- style?: Pick<PaypalButtonStyleOptions, 'layout' | 'size' | 'color' | 'label' | 'shape' | 'tagline' | 'fundingicons' | 'height'>;
177
- /**
178
- * Address to be used for shipping.
179
- * If not provided, it will use the first saved address from the active customer.
180
- */
181
- shippingAddress?: Address | null;
182
- /**
183
- * A callback that gets called if unable to authorize and tokenize payment.
184
- *
185
- * @param error - The error object describing the failure.
186
- */
187
- onAuthorizeError?(error: BraintreeError | StandardError): void;
188
- /**
189
- * A callback that gets called if unable to submit payment.
190
- *
191
- * @param error - The error object describing the failure.
192
- */
193
- onPaymentError?(error: BraintreeError | StandardError): void;
176
+ /**
177
+ * A set of options that are required to initialize ApplePay in cart.
178
+ *
179
+ * When ApplePay is initialized, an ApplePay button will be inserted into the
180
+ * DOM. When a customer clicks on it, it will trigger Apple sheet.
181
+ */
182
+ declare interface ApplePayButtonInitializeOptions_2 {
194
183
  /**
195
- * A callback that gets called on any error instead of submit payment or authorization errors.
196
- *
197
- * @param error - The error object describing the failure.
184
+ * The class name of the ApplePay button style.
198
185
  */
199
- onError?(error: BraintreeError | StandardError): void;
200
- }
201
-
202
- declare interface BraintreeVenmoButtonInitializeOptions {
186
+ buttonClassName?: string;
203
187
  /**
204
- * A callback that gets called on any error.
205
- *
206
- * @param error - The error object describing the failure.
188
+ * A callback that gets called when a payment is successfully completed.
207
189
  */
208
- onError?(error: BraintreeError | StandardError): void;
209
- }
210
-
211
- declare enum ButtonColor {
212
- Default = "default",
213
- Black = "black",
214
- White = "white"
215
- }
216
-
217
- declare enum ButtonType {
218
- Long = "long",
219
- Short = "short"
220
- }
221
-
222
- declare class CheckoutButtonErrorSelector {
223
- private _checkoutButton;
224
- getInitializeButtonError(methodId?: CheckoutButtonMethodType): Error | undefined;
225
- getDeinitializeButtonError(methodId?: CheckoutButtonMethodType): Error | undefined;
190
+ onPaymentAuthorize(): void;
226
191
  }
227
192
 
228
- declare interface CheckoutButtonInitializeOptions extends CheckoutButtonOptions {
193
+ declare interface BaseCheckoutButtonInitializeOptions extends CheckoutButtonOptions {
229
194
  /**
230
195
  * The options that are required to initialize the ApplePay payment method.
231
196
  * They can be omitted unless you need to support ApplePay in cart.
@@ -322,6 +287,104 @@ declare interface CheckoutButtonInitializeOptions extends CheckoutButtonOptions
322
287
  paypalcommercevenmo?: PaypalCommerceVenmoButtonInitializeOptions;
323
288
  }
324
289
 
290
+ declare interface BraintreeError extends Error {
291
+ type: 'CUSTOMER' | 'MERCHANT' | 'NETWORK' | 'INTERNAL' | 'UNKNOWN';
292
+ code: string;
293
+ details?: unknown;
294
+ }
295
+
296
+ declare interface BraintreePaypalButtonInitializeOptions {
297
+ /**
298
+ * The ID of a container which the messaging should be inserted.
299
+ */
300
+ messagingContainerId?: string;
301
+ /**
302
+ * A set of styling options for the checkout button.
303
+ */
304
+ style?: Pick<PaypalButtonStyleOptions, 'layout' | 'size' | 'color' | 'label' | 'shape' | 'tagline' | 'fundingicons' | 'height'>;
305
+ /**
306
+ * Address to be used for shipping.
307
+ * If not provided, it will use the first saved address from the active customer.
308
+ */
309
+ shippingAddress?: Address | null;
310
+ /**
311
+ * A callback that gets called if unable to authorize and tokenize payment.
312
+ *
313
+ * @param error - The error object describing the failure.
314
+ */
315
+ onAuthorizeError?(error: BraintreeError | StandardError): void;
316
+ /**
317
+ * A callback that gets called if unable to submit payment.
318
+ *
319
+ * @param error - The error object describing the failure.
320
+ */
321
+ onPaymentError?(error: BraintreeError | StandardError): void;
322
+ /**
323
+ * A callback that gets called on any error instead of submit payment or authorization errors.
324
+ *
325
+ * @param error - The error object describing the failure.
326
+ */
327
+ onError?(error: BraintreeError | StandardError): void;
328
+ }
329
+
330
+ declare interface BraintreePaypalCreditButtonInitializeOptions {
331
+ /**
332
+ * A set of styling options for the checkout button.
333
+ */
334
+ style?: Pick<PaypalButtonStyleOptions, 'layout' | 'size' | 'color' | 'label' | 'shape' | 'tagline' | 'fundingicons' | 'height'>;
335
+ /**
336
+ * Address to be used for shipping.
337
+ * If not provided, it will use the first saved address from the active customer.
338
+ */
339
+ shippingAddress?: Address | null;
340
+ /**
341
+ * A callback that gets called if unable to authorize and tokenize payment.
342
+ *
343
+ * @param error - The error object describing the failure.
344
+ */
345
+ onAuthorizeError?(error: BraintreeError | StandardError): void;
346
+ /**
347
+ * A callback that gets called if unable to submit payment.
348
+ *
349
+ * @param error - The error object describing the failure.
350
+ */
351
+ onPaymentError?(error: BraintreeError | StandardError): void;
352
+ /**
353
+ * A callback that gets called on any error instead of submit payment or authorization errors.
354
+ *
355
+ * @param error - The error object describing the failure.
356
+ */
357
+ onError?(error: BraintreeError | StandardError): void;
358
+ }
359
+
360
+ declare interface BraintreeVenmoButtonInitializeOptions {
361
+ /**
362
+ * A callback that gets called on any error.
363
+ *
364
+ * @param error - The error object describing the failure.
365
+ */
366
+ onError?(error: BraintreeError | StandardError): void;
367
+ }
368
+
369
+ declare enum ButtonColor {
370
+ Default = "default",
371
+ Black = "black",
372
+ White = "white"
373
+ }
374
+
375
+ declare enum ButtonType {
376
+ Long = "long",
377
+ Short = "short"
378
+ }
379
+
380
+ declare class CheckoutButtonErrorSelector {
381
+ private _checkoutButton;
382
+ getInitializeButtonError(methodId?: CheckoutButtonMethodType): Error | undefined;
383
+ getDeinitializeButtonError(methodId?: CheckoutButtonMethodType): Error | undefined;
384
+ }
385
+
386
+ declare type CheckoutButtonInitializeOptions = BaseCheckoutButtonInitializeOptions & WithApplePayButtonInitializeOptions;
387
+
325
388
  declare class CheckoutButtonInitializer {
326
389
  private _store;
327
390
  private _buttonStrategyActionCreator;
@@ -645,6 +708,10 @@ declare enum StyleButtonShape {
645
708
  rect = "rect"
646
709
  }
647
710
 
711
+ declare interface WithApplePayButtonInitializeOptions {
712
+ applepay?: ApplePayButtonInitializeOptions_2;
713
+ }
714
+
648
715
  /**
649
716
  * Creates an instance of `CheckoutButtonInitializer`.
650
717
  *