@bigcommerce/checkout-sdk 1.374.3 → 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.
@@ -6177,6 +6252,81 @@ declare interface PayPalCommerceCustomerInitializeOptions {
6177
6252
  onComplete?(): void;
6178
6253
  }
6179
6254
 
6255
+ /**
6256
+ * A set of options that are required to initialize the PayPal Commerce payment
6257
+ * method for presenting its PayPal button.
6258
+ *
6259
+ * Please note that the minimum version of checkout-sdk is 1.100
6260
+ *
6261
+ * 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
6262
+ * ```html
6263
+ * <!-- This is where the PayPal button will be inserted -->
6264
+ * <div id="container"></div>
6265
+ * ```
6266
+ *
6267
+ * ```js
6268
+ * service.initializePayment({
6269
+ * methodId: 'paypalcommerce',
6270
+ * paypalcommerce: {
6271
+ * container: '#container',
6272
+ * // Callback for submitting payment form that gets called when a buyer approves PayPal payment
6273
+ * submitForm: () => {
6274
+ * // Example function
6275
+ * this.submitOrder(
6276
+ * {
6277
+ * payment: { methodId: 'paypalcommerce', }
6278
+ * }
6279
+ * );
6280
+ * },
6281
+ * // Callback is used to define the state of the payment form, validate if it is applicable for submit.
6282
+ * onValidate: (resolve, reject) => {
6283
+ * // Example function
6284
+ * const isValid = this.validatePaymentForm();
6285
+ * if (isValid) {
6286
+ * return resolve();
6287
+ * }
6288
+ * return reject();
6289
+ * },
6290
+ * // 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.
6291
+ * onRenderButton: () => {
6292
+ * // Example function
6293
+ * this.hidePaymentSubmitButton();
6294
+ * }
6295
+ * },
6296
+ * });
6297
+ * ```
6298
+ */
6299
+ declare interface PayPalCommercePaymentInitializeOptions {
6300
+ /**
6301
+ * The CSS selector of a container where the payment widget should be inserted into.
6302
+ */
6303
+ container: string;
6304
+ /**
6305
+ * A callback for displaying error popup. This callback requires error object as parameter.
6306
+ */
6307
+ onError?(error: Error): void;
6308
+ /**
6309
+ * A callback right before render Smart Payment Button that gets called when
6310
+ * Smart Payment Button is eligible. This callback can be used to hide the standard submit button.
6311
+ */
6312
+ onRenderButton?(): void;
6313
+ /**
6314
+ * A callback that gets called when a buyer click on Smart Payment Button
6315
+ * and should validate payment form.
6316
+ *
6317
+ * @param resolve - A function, that gets called if form is valid.
6318
+ * @param reject - A function, that gets called if form is not valid.
6319
+ *
6320
+ * @returns reject() or resolve()
6321
+ */
6322
+ onValidate(resolve: () => void, reject: () => void): Promise<void>;
6323
+ /**
6324
+ * A callback for submitting payment form that gets called
6325
+ * when buyer approved PayPal account.
6326
+ */
6327
+ submitForm(): void;
6328
+ }
6329
+
6180
6330
  declare interface PayPalCommerceVenmoButtonInitializeOptions {
6181
6331
  /**
6182
6332
  * A set of styling options for the checkout button.
@@ -6210,7 +6360,7 @@ declare interface PayPalInstrument extends BaseAccountInstrument {
6210
6360
  method: 'paypal';
6211
6361
  }
6212
6362
 
6213
- declare type PaymentInitializeOptions = BasePaymentInitializeOptions & WithAdyenV2PaymentInitializeOptions & WithAdyenV3PaymentInitializeOptions & WithApplePayPaymentInitializeOptions & WithBoltPaymentInitializeOptions & WithCreditCardPaymentInitializeOptions & WithPayPalCommerceCreditCardsPaymentInitializeOptions & WithSquareV2PaymentInitializeOptions;
6363
+ declare type PaymentInitializeOptions = BasePaymentInitializeOptions & WithAdyenV2PaymentInitializeOptions & WithAdyenV3PaymentInitializeOptions & WithApplePayPaymentInitializeOptions & WithBoltPaymentInitializeOptions & WithCreditCardPaymentInitializeOptions & WithPayPalCommercePaymentInitializeOptions & WithPayPalCommerceCreditPaymentInitializeOptions & WithPayPalCommerceCreditCardsPaymentInitializeOptions & WithSquareV2PaymentInitializeOptions;
6214
6364
 
6215
6365
  declare type PaymentInstrument = CardInstrument | AccountInstrument;
6216
6366
 
@@ -7564,6 +7714,11 @@ declare interface WithPayPalCommerceCreditCustomerInitializeOptions {
7564
7714
  paypalcommercecredit?: PayPalCommerceCreditCustomerInitializeOptions;
7565
7715
  }
7566
7716
 
7717
+ declare interface WithPayPalCommerceCreditPaymentInitializeOptions {
7718
+ paypalcommerce?: PayPalCommerceCreditPaymentInitializeOptions;
7719
+ paypalcommercecredit?: PayPalCommerceCreditPaymentInitializeOptions;
7720
+ }
7721
+
7567
7722
  declare interface WithPayPalCommerceCustomerInitializeOptions {
7568
7723
  /**
7569
7724
  * The options that are required to initialize the customer step of checkout
@@ -7572,6 +7727,10 @@ declare interface WithPayPalCommerceCustomerInitializeOptions {
7572
7727
  paypalcommerce?: PayPalCommerceCustomerInitializeOptions;
7573
7728
  }
7574
7729
 
7730
+ declare interface WithPayPalCommercePaymentInitializeOptions {
7731
+ paypalcommerce?: PayPalCommercePaymentInitializeOptions;
7732
+ }
7733
+
7575
7734
  declare interface WithPayPalCommerceVenmoButtonInitializeOptions {
7576
7735
  paypalcommercevenmo?: PayPalCommerceVenmoButtonInitializeOptions;
7577
7736
  }