@paypercut/checkout-js 1.1.8 → 1.1.10

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.
package/dist/index.d.ts CHANGED
@@ -120,10 +120,17 @@ interface PaypercutCheckoutOptions {
120
120
  * Wallet type for form validation
121
121
  */
122
122
  type WalletType = 'apple_pay' | 'google_pay';
123
+ /**
124
+ * Wallet/checkout cancellation event payload
125
+ */
126
+ interface CancelPayload {
127
+ checkoutId: string;
128
+ wallet?: WalletType;
129
+ }
123
130
  /**
124
131
  * Event names that can be emitted by the checkout
125
132
  */
126
- type EventName = 'loaded' | 'success' | 'error' | 'expired' | 'resize' | 'threeds_complete' | 'threeds_error' | 'threeds_canceled' | 'threeds_started' | 'form_validation';
133
+ type EventName = 'loaded' | 'success' | 'error' | 'expired' | 'resize' | 'threeds_complete' | 'threeds_error' | 'threeds_canceled' | 'threeds_started' | 'cancel' | 'form_validation';
127
134
  /**
128
135
  * Preferred enum for SDK event names (use instead of hardcoded strings)
129
136
  */
@@ -137,6 +144,7 @@ declare enum SdkEvent {
137
144
  ThreeDSError = "threeds_error",
138
145
  ThreeDSCanceled = "threeds_canceled",
139
146
  ThreeDSStarted = "threeds_started",
147
+ Cancel = "cancel",
140
148
  FormValidation = "form_validation"
141
149
  }
142
150
  /**
@@ -455,4 +463,4 @@ declare const PaypercutExpressCheckout: ExpressCheckoutStatic;
455
463
  declare const PaypercutCheckout: PaypercutCheckoutStatic;
456
464
 
457
465
  export { ExpressSdkEvent, LOCALES, PaymentMethod, PaypercutCheckout, PaypercutExpressCheckout, SdkEvent, UIMode, WalletOption, PaypercutCheckout as default };
458
- export type { ApplePayButtonStyle, CheckoutInstance, EventName, ExpressBillingDetails, ExpressButtonOptions, ExpressButtonType, ExpressCheckoutInstance, ExpressCheckoutOptions, ExpressCheckoutShippingOption, ExpressCheckoutUpdateOptions, ExpressEventName, ExpressPaymentMethodCreatedEvent, ExpressPaymentMethodFailedEvent, ExpressSessionStartEvent, ExpressShippingAddress, ExpressShippingDetails, ExpressTokenPayload, FormValidationError, GooglePayButtonColor, LineItem, Locale, PaypercutCheckoutOptions, PaypercutCheckoutStatic, ShippingAddressChangeEvent, ShippingOptionChangeEvent, WalletType };
466
+ export type { ApplePayButtonStyle, CancelPayload, CheckoutInstance, EventName, ExpressBillingDetails, ExpressButtonOptions, ExpressButtonType, ExpressCheckoutInstance, ExpressCheckoutOptions, ExpressCheckoutShippingOption, ExpressCheckoutUpdateOptions, ExpressEventName, ExpressPaymentMethodCreatedEvent, ExpressPaymentMethodFailedEvent, ExpressSessionStartEvent, ExpressShippingAddress, ExpressShippingDetails, ExpressTokenPayload, FormValidationError, GooglePayButtonColor, LineItem, Locale, PaypercutCheckoutOptions, PaypercutCheckoutStatic, ShippingAddressChangeEvent, ShippingOptionChangeEvent, WalletType };
package/dist/index.mjs CHANGED
@@ -87,7 +87,7 @@ class Emitter {
87
87
  * Production configuration (for merchants)
88
88
  */
89
89
  const productionConfig = {
90
- version: "1.1.8",
90
+ version: "1.1.10",
91
91
  defaultCheckoutOrigin: 'https://buy.paypercut.io',
92
92
  defaultApiOrigin: 'https://api.paypercut.io',
93
93
  defaultVaultApiUrl: 'https://api.basistheory.com',
@@ -297,6 +297,7 @@ var SdkEvent;
297
297
  SdkEvent["ThreeDSError"] = "threeds_error";
298
298
  SdkEvent["ThreeDSCanceled"] = "threeds_canceled";
299
299
  SdkEvent["ThreeDSStarted"] = "threeds_started";
300
+ SdkEvent["Cancel"] = "cancel";
300
301
  SdkEvent["FormValidation"] = "form_validation";
301
302
  })(SdkEvent || (SdkEvent = {}));
302
303
 
@@ -1906,13 +1907,19 @@ class CheckoutImpl {
1906
1907
  this.emitter.emit(SdkEvent.Loaded);
1907
1908
  break;
1908
1909
  case 'CHECKOUT_SUCCESS':
1909
- const { payment_method = {} } = data;
1910
- this.emitter.emit(SdkEvent.Success, { payment_method });
1910
+ const { payment_method = {}, payment = null } = data;
1911
+ this.emitter.emit(SdkEvent.Success, { payment_method, payment });
1911
1912
  break;
1912
1913
  case 'CHECKOUT_ERROR':
1913
1914
  // Forward error payload (if provided) to SDK consumers
1914
1915
  this.emitter.emit(SdkEvent.Error, (data && data.error) ?? data);
1915
1916
  break;
1917
+ case 'CHECKOUT_CANCEL':
1918
+ this.emitter.emit(SdkEvent.Cancel, {
1919
+ checkoutId: data.checkoutId,
1920
+ wallet: data.wallet,
1921
+ });
1922
+ break;
1916
1923
  case 'CHECKOUT_EXPIRED':
1917
1924
  this.emitter.emit(SdkEvent.Expired);
1918
1925
  break;