@rebilly/framepay 1.66.0 → 1.66.2

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 +47 -17
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { coreComponents } from 'rebilly-js-sdk/types';
2
- import type Emitter from 'component-emitter';
2
+ import EventEmitter from 'eventemitter3';
3
3
  import type { reportsComponents } from 'rebilly-js-sdk/types';
4
4
 
5
5
  export declare interface AddressData {
@@ -43,7 +43,7 @@ export declare class BankElement {
43
43
  unmount(): void;
44
44
  destroy(): void;
45
45
  focus(): void;
46
- on<T extends keyof IframeElementEventMap>(eventType: T, delegate: (...args: IframeElementEventMap[T]) => void): void;
46
+ on: IframeElementBusOn;
47
47
  }
48
48
 
49
49
  export declare interface BaseStyleDeclaration {
@@ -87,6 +87,11 @@ export declare type BbanFieldType = keyof BbanSourceMap;
87
87
 
88
88
  export declare type BbanSourceMap = Partial<typeof PUBLIC_FIELD_SOURCE_NAMES_REPLACE_MAP.bankAccount & typeof PUBLIC_FIELD_SOURCE_NAMES_REPLACE_MAP.bban>;
89
89
 
90
+ export declare interface BillingAddressChangedEvent {
91
+ billingContact: BillingContact;
92
+ onBillingAddressUpdated: (newTransactionData: ShippingAddressUpdatableTransactionData) => void;
93
+ }
94
+
90
95
  export declare type BillingAddressChangedHandler = (billingContact: BillingContact, updateTransaction: (newTransactionData: UpdateableTransactionData) => void) => void;
91
96
 
92
97
  export declare interface BillingContact {
@@ -193,7 +198,7 @@ export declare class CardElement {
193
198
  target?: string;
194
199
  }): void;
195
200
  destroy(): void;
196
- on<T extends keyof IframeElementEventMap>(eventType: T, delegate: (...args: IframeElementEventMap[T]) => void): void;
201
+ on: IframeElementBusOn;
197
202
  }
198
203
 
199
204
  export declare type CardExpirationType = ValueOf<typeof CARD_EXPIRATION_TYPES>;
@@ -285,8 +290,6 @@ export declare const ELEMENT_TYPES: {
285
290
 
286
291
  export declare type ElementType = (typeof ELEMENT_TYPES)[keyof typeof ELEMENT_TYPES];
287
292
 
288
- export declare type EmitterInstance = typeof Emitter.prototype;
289
-
290
293
  export declare type ExternalPayload = {
291
294
  leadSource?: Record<string, string>;
292
295
  };
@@ -304,8 +307,8 @@ export declare interface ExtraData {
304
307
  fullName?: string;
305
308
  };
306
309
  shippingDetails?: {
307
- address?: ApplePayJS.ApplePayPaymentContact;
308
- option?: ShippingOptionItem;
310
+ address?: ApplePayJS.ApplePayPaymentContact | google.payments.api.Address;
311
+ option?: ShippingOptionItem | google.payments.api.SelectionOptionData;
309
312
  };
310
313
  [key: string]: string | object | undefined;
311
314
  }
@@ -496,15 +499,29 @@ export declare class FramePay {
496
499
  * @param eventType The event type to subscribe to
497
500
  * @param delegate The delegate to run when the event is fired
498
501
  */
499
- on<T extends keyof FramepayEventMap>(eventType: T, delegate: (...args: FramepayEventMap[T]) => void): void;
502
+ on: FramepayBusOn;
500
503
  /**
501
504
  * Unsubscribe from a global event
502
505
  * @param eventType The event type to unsubscribe from
503
506
  * @param delegate The delegate to unsubscribe
504
507
  */
505
- off<T extends keyof FramepayEventMap>(eventType: T, delegate: (...args: FramepayEventMap[T]) => void): void;
508
+ off: FramepayBusOff;
506
509
  }
507
510
 
511
+ export declare const FRAMEPAY_EVENTS: {
512
+ readonly ready: "ready";
513
+ readonly error: "error";
514
+ readonly tokenReady: "token-ready";
515
+ readonly shippingAddressChanged: "shipping-address-changed";
516
+ readonly shippingOptionChanged: "shipping-option-changed";
517
+ readonly billingAddressChanged: "billing-address-changed";
518
+ readonly configurationUpdated: "configuration-updated";
519
+ };
520
+
521
+ export declare type FramepayBusOff = <T extends keyof FramepayEventMap>(event: T, fn: (...args: EventEmitter.ArgumentMap<FramepayEventMap>[T]) => void) => void;
522
+
523
+ export declare type FramepayBusOn = <T extends keyof FramepayEventMap>(event: T, fn: (...args: EventEmitter.ArgumentMap<FramepayEventMap>[T]) => void) => void;
524
+
508
525
  export declare interface FramepayError {
509
526
  code: string;
510
527
  type?: string;
@@ -514,12 +531,13 @@ export declare interface FramepayError {
514
531
  }
515
532
 
516
533
  export declare interface FramepayEventMap {
517
- ready: [];
518
- error: [FramepayError];
519
- 'token-ready': [TokenData, ExtraData];
520
- 'shipping-address-changed': Parameters<ShippingAddressChangedHandler>;
521
- 'shipping-option-changed': Parameters<ShippingOptionsChangedHandler>;
522
- 'billing-address-changed': Parameters<BillingAddressChangedHandler>;
534
+ [FRAMEPAY_EVENTS.configurationUpdated]: [];
535
+ [FRAMEPAY_EVENTS.ready]: [];
536
+ [FRAMEPAY_EVENTS.error]: [FramepayError];
537
+ [FRAMEPAY_EVENTS.tokenReady]: [TokenData, ExtraData?];
538
+ [FRAMEPAY_EVENTS.shippingAddressChanged]: Parameters<ShippingAddressChangedHandler>;
539
+ [FRAMEPAY_EVENTS.shippingOptionChanged]: Parameters<ShippingOptionsChangedHandler>;
540
+ [FRAMEPAY_EVENTS.billingAddressChanged]: Parameters<BillingAddressChangedHandler>;
523
541
  }
524
542
 
525
543
  export declare interface FramepayInitializeParams extends Configuration {
@@ -621,7 +639,7 @@ export declare class IbanElement {
621
639
  unmount(): void;
622
640
  destroy(): void;
623
641
  focus(): void;
624
- on<T extends keyof IframeElementEventMap>(eventType: T, delegate: (...args: IframeElementEventMap[T]) => void): void;
642
+ on: IframeElementBusOn;
625
643
  }
626
644
 
627
645
  export declare type IbanElementSourceReplaceNames = Partial<typeof PUBLIC_FIELD_SOURCE_NAMES_REPLACE_MAP.iban>;
@@ -635,6 +653,8 @@ export declare interface IconConfig {
635
653
  color?: string;
636
654
  }
637
655
 
656
+ export declare type IframeElementBusOn = <T extends keyof IframeElementEventMap>(event: T, fn: (...args: EventEmitter.ArgumentMap<IframeElementEventMap>[T]) => void) => void;
657
+
638
658
  export declare interface IframeElementEventMap {
639
659
  [FieldNotification.TYPES.ready]: [];
640
660
  [FieldNotification.TYPES.focus]: [{
@@ -655,7 +675,7 @@ export declare interface IframeElementEventMap {
655
675
  [FieldNotification.TYPES.autoFillCancel]: [];
656
676
  change: [
657
677
  {
658
- error: NotificationContent | FieldError;
678
+ error?: NotificationContent | FieldError;
659
679
  source: string;
660
680
  completed?: boolean;
661
681
  valid?: boolean;
@@ -895,6 +915,11 @@ export declare interface SelectionStyleConfig {
895
915
  textShadow?: FramepayStyleValue;
896
916
  }
897
917
 
918
+ export declare interface ShippingAddressChangedEvent {
919
+ shippingData: AddressData;
920
+ onShippingAddressUpdated: (newTransactionData: ShippingAddressUpdatableTransactionData) => void;
921
+ }
922
+
898
923
  export declare type ShippingAddressChangedHandler = (shippingData: AddressData, updateTransaction: (newTransactionData: ShippingAddressUpdatableTransactionData) => void) => void;
899
924
 
900
925
  export declare interface ShippingAddressUpdatableTransactionData extends Partial<UpdateableTransactionData> {
@@ -925,6 +950,11 @@ export declare interface ShippingOptions {
925
950
  };
926
951
  }
927
952
 
953
+ export declare interface ShippingOptionsChangedEvent {
954
+ shippingData: ShippingData;
955
+ onShippingOptionUpdated: (newTransactionData: UpdateableTransactionData) => void;
956
+ }
957
+
928
958
  export declare type ShippingOptionsChangedHandler = (shippingData: ShippingData, updateTransaction: (newTransactionData: UpdateableTransactionData) => void) => void;
929
959
 
930
960
  export declare interface ShippingUpdateShippingData {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebilly/framepay",
3
- "version": "1.66.0",
3
+ "version": "1.66.2",
4
4
  "description": "A wrapper to load Rebilly's FramePay library and provide TypeScript types",
5
5
  "type": "module",
6
6
  "license": "MIT",