@rebilly/framepay 5.259.1 → 5.260.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.
Files changed (2) hide show
  1. package/dist/index.d.ts +40 -7
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -44,12 +44,13 @@ export declare class ApplePayElement {
44
44
  on: ApplePayElementBusOn;
45
45
  }
46
46
 
47
- export declare type ApplePayElementBusOn = <T extends keyof ApplePayElementEventMap>(event: T, fn: (...args: ApplePayElementEventMap[T]) => void) => void;
47
+ export declare type ApplePayElementBusOn = WalletElementBusOn;
48
48
 
49
- export declare interface ApplePayElementEventMap {
50
- ready: [];
51
- error: [FramepayError];
52
- }
49
+ /**
50
+ * The Apple Pay element has the events of every wallet element. These names
51
+ * are kept for the published types.
52
+ */
53
+ export declare type ApplePayElementEventMap = WalletElementEventMap;
53
54
 
54
55
  /**
55
56
  * Abstraction layer for the IframeElement set to become a bban account field.
@@ -376,7 +377,12 @@ export declare class FieldNotification {
376
377
  readonly blur: "blur";
377
378
  readonly ready: "ready";
378
379
  readonly clearExternalInvalid: "clear-external-invalid";
380
+ readonly walletReady: "wallet-ready";
381
+ readonly walletError: "wallet-error";
379
382
  };
383
+
384
+
385
+
380
386
  type: FieldNotificationType;
381
387
  content: NotificationContent | FieldError;
382
388
  constructor({ type, content }: NotificationArgs);
@@ -598,6 +604,10 @@ export declare interface GooglePayConfig {
598
604
  /**
599
605
  * Abstraction layer for the IframeElement set to become a Google Pay field.
600
606
  * Used to hide the internal implementation.
607
+ *
608
+ * The button runs in the field frame. The frame tells this element when the
609
+ * button is displayed, or cannot be, and the element emits that as its
610
+ * `ready` and `error`: the same contract as the Apple Pay element.
601
611
  */
602
612
  export declare class GooglePayElement {
603
613
  #private;
@@ -605,7 +615,7 @@ export declare class GooglePayElement {
605
615
  mount(): void;
606
616
  unmount(): void;
607
617
  destroy(): void;
608
- on(eventType: never, _delegate: never): void;
618
+ on: WalletElementBusOn;
609
619
  }
610
620
 
611
621
  export declare type GooglePayToken = object;
@@ -783,8 +793,14 @@ export declare class PayPalElement {
783
793
 
784
794
  mount(): void;
785
795
  unmount(): void;
796
+ /**
797
+ * Remove the button and stop listening for configuration updates. A
798
+ * setup still in progress renders nothing, a payment still open in the
799
+ * PayPal window ends with no token and no error, and a page that still
800
+ * shows the button loses it.
801
+ */
786
802
  destroy(): void;
787
- on(eventType: never, _delegate: never): void;
803
+ on: WalletElementBusOn;
788
804
  }
789
805
 
790
806
  export declare interface PlaceholdersConfig {
@@ -1051,6 +1067,23 @@ export declare interface UpdateableTransactionData {
1051
1067
 
1052
1068
  export declare type ValueOf<T> = T[keyof T];
1053
1069
 
1070
+ export declare type WalletElementBusOn = <T extends keyof WalletElementEventMap>(event: T, fn: (...args: WalletElementEventMap[T]) => void) => void;
1071
+
1072
+ /**
1073
+ * The events of a wallet element: Apple Pay, Google Pay, and PayPal.
1074
+ *
1075
+ * `ready` fires once the wallet button is displayed, so the shopper can press
1076
+ * it. `error` fires with the FramePay error when the button cannot be shown:
1077
+ * the device cannot pay, the SDK did not load, or the configuration is
1078
+ * invalid. Failures after `ready` are not element errors: a token request
1079
+ * that fails surfaces on the global `Framepay.on('error')`, and so does a
1080
+ * canceled Apple Pay payment.
1081
+ */
1082
+ export declare interface WalletElementEventMap {
1083
+ ready: [];
1084
+ error: [FramepayError];
1085
+ }
1086
+
1054
1087
  export declare interface WebskitAutofillStyleConfig {
1055
1088
  fontSize?: FramepayStyleValue;
1056
1089
  webkitTextFillColor?: FramepayStyleValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebilly/framepay",
3
- "version": "5.259.1",
3
+ "version": "5.260.0",
4
4
  "description": "A wrapper to load Rebilly's FramePay library and provide TypeScript types",
5
5
  "type": "module",
6
6
  "repository": {