@bigcommerce/checkout-sdk 1.374.3 → 1.374.4

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.
@@ -6177,6 +6177,81 @@ declare interface PayPalCommerceCustomerInitializeOptions {
6177
6177
  onComplete?(): void;
6178
6178
  }
6179
6179
 
6180
+ /**
6181
+ * A set of options that are required to initialize the PayPal Commerce payment
6182
+ * method for presenting its PayPal button.
6183
+ *
6184
+ * Please note that the minimum version of checkout-sdk is 1.100
6185
+ *
6186
+ * 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
6187
+ * ```html
6188
+ * <!-- This is where the PayPal button will be inserted -->
6189
+ * <div id="container"></div>
6190
+ * ```
6191
+ *
6192
+ * ```js
6193
+ * service.initializePayment({
6194
+ * methodId: 'paypalcommerce',
6195
+ * paypalcommerce: {
6196
+ * container: '#container',
6197
+ * // Callback for submitting payment form that gets called when a buyer approves PayPal payment
6198
+ * submitForm: () => {
6199
+ * // Example function
6200
+ * this.submitOrder(
6201
+ * {
6202
+ * payment: { methodId: 'paypalcommerce', }
6203
+ * }
6204
+ * );
6205
+ * },
6206
+ * // Callback is used to define the state of the payment form, validate if it is applicable for submit.
6207
+ * onValidate: (resolve, reject) => {
6208
+ * // Example function
6209
+ * const isValid = this.validatePaymentForm();
6210
+ * if (isValid) {
6211
+ * return resolve();
6212
+ * }
6213
+ * return reject();
6214
+ * },
6215
+ * // 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.
6216
+ * onRenderButton: () => {
6217
+ * // Example function
6218
+ * this.hidePaymentSubmitButton();
6219
+ * }
6220
+ * },
6221
+ * });
6222
+ * ```
6223
+ */
6224
+ declare interface PayPalCommercePaymentInitializeOptions {
6225
+ /**
6226
+ * The CSS selector of a container where the payment widget should be inserted into.
6227
+ */
6228
+ container: string;
6229
+ /**
6230
+ * A callback for displaying error popup. This callback requires error object as parameter.
6231
+ */
6232
+ onError?(error: Error): void;
6233
+ /**
6234
+ * A callback right before render Smart Payment Button that gets called when
6235
+ * Smart Payment Button is eligible. This callback can be used to hide the standard submit button.
6236
+ */
6237
+ onRenderButton?(): void;
6238
+ /**
6239
+ * A callback that gets called when a buyer click on Smart Payment Button
6240
+ * and should validate payment form.
6241
+ *
6242
+ * @param resolve - A function, that gets called if form is valid.
6243
+ * @param reject - A function, that gets called if form is not valid.
6244
+ *
6245
+ * @returns reject() or resolve()
6246
+ */
6247
+ onValidate(resolve: () => void, reject: () => void): Promise<void>;
6248
+ /**
6249
+ * A callback for submitting payment form that gets called
6250
+ * when buyer approved PayPal account.
6251
+ */
6252
+ submitForm(): void;
6253
+ }
6254
+
6180
6255
  declare interface PayPalCommerceVenmoButtonInitializeOptions {
6181
6256
  /**
6182
6257
  * A set of styling options for the checkout button.
@@ -6210,7 +6285,7 @@ declare interface PayPalInstrument extends BaseAccountInstrument {
6210
6285
  method: 'paypal';
6211
6286
  }
6212
6287
 
6213
- declare type PaymentInitializeOptions = BasePaymentInitializeOptions & WithAdyenV2PaymentInitializeOptions & WithAdyenV3PaymentInitializeOptions & WithApplePayPaymentInitializeOptions & WithBoltPaymentInitializeOptions & WithCreditCardPaymentInitializeOptions & WithPayPalCommerceCreditCardsPaymentInitializeOptions & WithSquareV2PaymentInitializeOptions;
6288
+ declare type PaymentInitializeOptions = BasePaymentInitializeOptions & WithAdyenV2PaymentInitializeOptions & WithAdyenV3PaymentInitializeOptions & WithApplePayPaymentInitializeOptions & WithBoltPaymentInitializeOptions & WithCreditCardPaymentInitializeOptions & WithPayPalCommercePaymentInitializeOptions & WithPayPalCommerceCreditCardsPaymentInitializeOptions & WithSquareV2PaymentInitializeOptions;
6214
6289
 
6215
6290
  declare type PaymentInstrument = CardInstrument | AccountInstrument;
6216
6291
 
@@ -7572,6 +7647,10 @@ declare interface WithPayPalCommerceCustomerInitializeOptions {
7572
7647
  paypalcommerce?: PayPalCommerceCustomerInitializeOptions;
7573
7648
  }
7574
7649
 
7650
+ declare interface WithPayPalCommercePaymentInitializeOptions {
7651
+ paypalcommerce?: PayPalCommercePaymentInitializeOptions;
7652
+ }
7653
+
7575
7654
  declare interface WithPayPalCommerceVenmoButtonInitializeOptions {
7576
7655
  paypalcommercevenmo?: PayPalCommerceVenmoButtonInitializeOptions;
7577
7656
  }