@paypercut/checkout-js 1.1.9 → 1.2.0
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/README.md +10 -0
- package/dist/index.cjs +14 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +11 -2
- package/dist/index.mjs +14 -1
- package/dist/index.mjs.map +1 -1
- package/dist/paypercut-checkout.iife.min.js +1 -1
- package/dist/paypercut-checkout.iife.min.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -120,15 +120,23 @@ 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' | 'processing' | '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
|
*/
|
|
130
137
|
declare enum SdkEvent {
|
|
131
138
|
Loaded = "loaded",
|
|
139
|
+
Processing = "processing",
|
|
132
140
|
Success = "success",
|
|
133
141
|
Error = "error",
|
|
134
142
|
Expired = "expired",
|
|
@@ -137,6 +145,7 @@ declare enum SdkEvent {
|
|
|
137
145
|
ThreeDSError = "threeds_error",
|
|
138
146
|
ThreeDSCanceled = "threeds_canceled",
|
|
139
147
|
ThreeDSStarted = "threeds_started",
|
|
148
|
+
Cancel = "cancel",
|
|
140
149
|
FormValidation = "form_validation"
|
|
141
150
|
}
|
|
142
151
|
/**
|
|
@@ -455,4 +464,4 @@ declare const PaypercutExpressCheckout: ExpressCheckoutStatic;
|
|
|
455
464
|
declare const PaypercutCheckout: PaypercutCheckoutStatic;
|
|
456
465
|
|
|
457
466
|
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 };
|
|
467
|
+
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.
|
|
90
|
+
version: "1.2.0",
|
|
91
91
|
defaultCheckoutOrigin: 'https://buy.paypercut.io',
|
|
92
92
|
defaultApiOrigin: 'https://api.paypercut.io',
|
|
93
93
|
defaultVaultApiUrl: 'https://api.basistheory.com',
|
|
@@ -289,6 +289,7 @@ function validateUIMode(mode) {
|
|
|
289
289
|
var SdkEvent;
|
|
290
290
|
(function (SdkEvent) {
|
|
291
291
|
SdkEvent["Loaded"] = "loaded";
|
|
292
|
+
SdkEvent["Processing"] = "processing";
|
|
292
293
|
SdkEvent["Success"] = "success";
|
|
293
294
|
SdkEvent["Error"] = "error";
|
|
294
295
|
SdkEvent["Expired"] = "expired";
|
|
@@ -297,6 +298,7 @@ var SdkEvent;
|
|
|
297
298
|
SdkEvent["ThreeDSError"] = "threeds_error";
|
|
298
299
|
SdkEvent["ThreeDSCanceled"] = "threeds_canceled";
|
|
299
300
|
SdkEvent["ThreeDSStarted"] = "threeds_started";
|
|
301
|
+
SdkEvent["Cancel"] = "cancel";
|
|
300
302
|
SdkEvent["FormValidation"] = "form_validation";
|
|
301
303
|
})(SdkEvent || (SdkEvent = {}));
|
|
302
304
|
|
|
@@ -1905,6 +1907,11 @@ class CheckoutImpl {
|
|
|
1905
1907
|
case 'CHECKOUT_LOADED':
|
|
1906
1908
|
this.emitter.emit(SdkEvent.Loaded);
|
|
1907
1909
|
break;
|
|
1910
|
+
case 'CHECKOUT_PROCESSING':
|
|
1911
|
+
this.emitter.emit(SdkEvent.Processing, {
|
|
1912
|
+
checkoutId: data.checkoutId,
|
|
1913
|
+
});
|
|
1914
|
+
break;
|
|
1908
1915
|
case 'CHECKOUT_SUCCESS':
|
|
1909
1916
|
const { payment_method = {}, payment = null } = data;
|
|
1910
1917
|
this.emitter.emit(SdkEvent.Success, { payment_method, payment });
|
|
@@ -1913,6 +1920,12 @@ class CheckoutImpl {
|
|
|
1913
1920
|
// Forward error payload (if provided) to SDK consumers
|
|
1914
1921
|
this.emitter.emit(SdkEvent.Error, (data && data.error) ?? data);
|
|
1915
1922
|
break;
|
|
1923
|
+
case 'CHECKOUT_CANCEL':
|
|
1924
|
+
this.emitter.emit(SdkEvent.Cancel, {
|
|
1925
|
+
checkoutId: data.checkoutId,
|
|
1926
|
+
wallet: data.wallet,
|
|
1927
|
+
});
|
|
1928
|
+
break;
|
|
1916
1929
|
case 'CHECKOUT_EXPIRED':
|
|
1917
1930
|
this.emitter.emit(SdkEvent.Expired);
|
|
1918
1931
|
break;
|