@bigcommerce/checkout-sdk 1.374.4 → 1.374.5

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.
@@ -6155,6 +6155,81 @@ declare interface PayPalCommerceCreditCustomerInitializeOptions {
6155
6155
  onComplete?(): void;
6156
6156
  }
6157
6157
 
6158
+ /**
6159
+ * A set of options that are required to initialize the PayPal Commerce payment
6160
+ * method for presenting its PayPal button.
6161
+ *
6162
+ * Please note that the minimum version of checkout-sdk is 1.100
6163
+ *
6164
+ * Also, PayPal (also known as PayPal Commerce Platform) requires specific options to initialize the PayPal Smart Payment Button on checkout page that substitutes a standard submit button
6165
+ * ```html
6166
+ * <!-- This is where the PayPal button will be inserted -->
6167
+ * <div id="container"></div>
6168
+ * ```
6169
+ *
6170
+ * ```js
6171
+ * service.initializePayment({
6172
+ * methodId: 'paypalcommercecredit',
6173
+ * paypalcommercecredit: {
6174
+ * container: '#container',
6175
+ * // Callback for submitting payment form that gets called when a buyer approves PayPal payment
6176
+ * submitForm: () => {
6177
+ * // Example function
6178
+ * this.submitOrder(
6179
+ * {
6180
+ * payment: { methodId: 'paypalcommercecredit', }
6181
+ * }
6182
+ * );
6183
+ * },
6184
+ * // Callback is used to define the state of the payment form, validate if it is applicable for submit.
6185
+ * onValidate: (resolve, reject) => {
6186
+ * // Example function
6187
+ * const isValid = this.validatePaymentForm();
6188
+ * if (isValid) {
6189
+ * return resolve();
6190
+ * }
6191
+ * return reject();
6192
+ * },
6193
+ * // Callback that is called right before render of a Smart Payment Button. It gets called when a buyer is eligible for use of the particular PayPal method. This callback can be used to hide the standard submit button.
6194
+ * onRenderButton: () => {
6195
+ * // Example function
6196
+ * this.hidePaymentSubmitButton();
6197
+ * }
6198
+ * },
6199
+ * });
6200
+ * ```
6201
+ */
6202
+ declare interface PayPalCommerceCreditPaymentInitializeOptions {
6203
+ /**
6204
+ * The CSS selector of a container where the payment widget should be inserted into.
6205
+ */
6206
+ container: string;
6207
+ /**
6208
+ * A callback for displaying error popup. This callback requires error object as parameter.
6209
+ */
6210
+ onError?(error: Error): void;
6211
+ /**
6212
+ * A callback right before render Smart Payment Button that gets called when
6213
+ * Smart Payment Button is eligible. This callback can be used to hide the standard submit button.
6214
+ */
6215
+ onRenderButton?(): void;
6216
+ /**
6217
+ * A callback that gets called when a buyer click on Smart Payment Button
6218
+ * and should validate payment form.
6219
+ *
6220
+ * @param resolve - A function, that gets called if form is valid.
6221
+ * @param reject - A function, that gets called if form is not valid.
6222
+ *
6223
+ * @returns reject() or resolve()
6224
+ */
6225
+ onValidate(resolve: () => void, reject: () => void): Promise<void>;
6226
+ /**
6227
+ * A callback for submitting payment form that gets called
6228
+ * when buyer approved PayPal account.
6229
+ */
6230
+ submitForm(): void;
6231
+ }
6232
+
6158
6233
  /**
6159
6234
  * A set of options that are required to initialize the customer step of
6160
6235
  * checkout to support PayPalCommerce.
@@ -6285,7 +6360,7 @@ declare interface PayPalInstrument extends BaseAccountInstrument {
6285
6360
  method: 'paypal';
6286
6361
  }
6287
6362
 
6288
- declare type PaymentInitializeOptions = BasePaymentInitializeOptions & WithAdyenV2PaymentInitializeOptions & WithAdyenV3PaymentInitializeOptions & WithApplePayPaymentInitializeOptions & WithBoltPaymentInitializeOptions & WithCreditCardPaymentInitializeOptions & WithPayPalCommercePaymentInitializeOptions & WithPayPalCommerceCreditCardsPaymentInitializeOptions & WithSquareV2PaymentInitializeOptions;
6363
+ declare type PaymentInitializeOptions = BasePaymentInitializeOptions & WithAdyenV2PaymentInitializeOptions & WithAdyenV3PaymentInitializeOptions & WithApplePayPaymentInitializeOptions & WithBoltPaymentInitializeOptions & WithCreditCardPaymentInitializeOptions & WithPayPalCommercePaymentInitializeOptions & WithPayPalCommerceCreditPaymentInitializeOptions & WithPayPalCommerceCreditCardsPaymentInitializeOptions & WithSquareV2PaymentInitializeOptions;
6289
6364
 
6290
6365
  declare type PaymentInstrument = CardInstrument | AccountInstrument;
6291
6366
 
@@ -7639,6 +7714,11 @@ declare interface WithPayPalCommerceCreditCustomerInitializeOptions {
7639
7714
  paypalcommercecredit?: PayPalCommerceCreditCustomerInitializeOptions;
7640
7715
  }
7641
7716
 
7717
+ declare interface WithPayPalCommerceCreditPaymentInitializeOptions {
7718
+ paypalcommerce?: PayPalCommerceCreditPaymentInitializeOptions;
7719
+ paypalcommercecredit?: PayPalCommerceCreditPaymentInitializeOptions;
7720
+ }
7721
+
7642
7722
  declare interface WithPayPalCommerceCustomerInitializeOptions {
7643
7723
  /**
7644
7724
  * The options that are required to initialize the customer step of checkout