@paypercut/checkout-js 1.1.10 → 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 CHANGED
@@ -276,6 +276,7 @@ Subscribe to events using the `on()` method. You can use string event names or t
276
276
  | Event | Enum | Description | Payload |
277
277
  |-------|------|-------------|---------|
278
278
  | `loaded` | `SdkEvent.Loaded` | Checkout iframe has finished loading | `void` |
279
+ | `processing` | `SdkEvent.Processing` | Payment processing has started inside the hosted checkout | `{ checkoutId: string }` |
279
280
  | `success` | `SdkEvent.Success` | Payment completed successfully | `PaymentSuccessPayload` |
280
281
  | `error` | `SdkEvent.Error` | Terminal failure (tokenize, confirm, or 3DS) | `ApiErrorPayload` |
281
282
  | `expired` | `SdkEvent.Expired` | Checkout session expired | `void` |
@@ -295,6 +296,10 @@ checkout.on('loaded', () => {
295
296
  console.log('Checkout loaded');
296
297
  });
297
298
 
299
+ checkout.on('processing', ({ checkoutId }) => {
300
+ console.log('Payment processing started for checkout:', checkoutId);
301
+ });
302
+
298
303
  checkout.on('success', (payload) => {
299
304
  // PaymentSuccessPayload
300
305
  console.log('Payment successful');
@@ -323,6 +328,10 @@ checkout.on(SdkEvent.Loaded, () => {
323
328
  console.log('Checkout loaded');
324
329
  });
325
330
 
331
+ checkout.on(SdkEvent.Processing, ({ checkoutId }) => {
332
+ console.log('Payment processing started for checkout:', checkoutId);
333
+ });
334
+
326
335
  checkout.on(SdkEvent.Success, (payload) => {
327
336
  console.log('Payment successful', payload.payment_method);
328
337
  });
@@ -413,6 +422,7 @@ checkout.on('error', (err) => {
413
422
  ### Notes
414
423
 
415
424
  - `error`: the SDK forwards a normalized `ApiErrorPayload` when provided by Hosted Checkout.
425
+ - `processing`: non-terminal event. Use it to disable close buttons or show "do not close" messaging, then clear that UI on `success`, `error`, `cancel`, or `expired`.
416
426
  - `threeds_error`: forwards `payload.error` when available; otherwise the raw message data.
417
427
  - `three![img.png](img.png)ds_*` non-error events: payload is forwarded as-is from Hosted Checkout (shape may evolve).
418
428
 
package/dist/index.cjs CHANGED
@@ -91,7 +91,7 @@ class Emitter {
91
91
  * Production configuration (for merchants)
92
92
  */
93
93
  const productionConfig = {
94
- version: "1.1.10",
94
+ version: "1.2.0",
95
95
  defaultCheckoutOrigin: 'https://buy.paypercut.io',
96
96
  defaultApiOrigin: 'https://api.paypercut.io',
97
97
  defaultVaultApiUrl: 'https://api.basistheory.com',
@@ -293,6 +293,7 @@ function validateUIMode(mode) {
293
293
  exports.SdkEvent = void 0;
294
294
  (function (SdkEvent) {
295
295
  SdkEvent["Loaded"] = "loaded";
296
+ SdkEvent["Processing"] = "processing";
296
297
  SdkEvent["Success"] = "success";
297
298
  SdkEvent["Error"] = "error";
298
299
  SdkEvent["Expired"] = "expired";
@@ -1910,6 +1911,11 @@ class CheckoutImpl {
1910
1911
  case 'CHECKOUT_LOADED':
1911
1912
  this.emitter.emit(exports.SdkEvent.Loaded);
1912
1913
  break;
1914
+ case 'CHECKOUT_PROCESSING':
1915
+ this.emitter.emit(exports.SdkEvent.Processing, {
1916
+ checkoutId: data.checkoutId,
1917
+ });
1918
+ break;
1913
1919
  case 'CHECKOUT_SUCCESS':
1914
1920
  const { payment_method = {}, payment = null } = data;
1915
1921
  this.emitter.emit(exports.SdkEvent.Success, { payment_method, payment });