@rebilly/framepay 1.2.0 → 1.2.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 +29 -811
  2. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -3,7 +3,6 @@
3
3
 
4
4
  import type { coreComponents } from 'rebilly-js-sdk/types';
5
5
  import type Emitter from 'component-emitter';
6
- import Postmate from 'popostmate';
7
6
  import type { reportsComponents } from 'rebilly-js-sdk/types';
8
7
 
9
8
  export declare interface AddressData {
@@ -15,7 +14,7 @@ export declare type AllPossibleRuntimePluginReturnTypes = {
15
14
  };
16
15
 
17
16
  export declare class ApplePay extends PaymentMethod {
18
- applePayValidationRequest: DigitalWalletValidationRequest;
17
+ #private;
19
18
  ApplePayMarkIcon: string;
20
19
  constructor(framepayInstance: FramePay, applePayValidationRequest: DigitalWalletValidationRequest);
21
20
  mount(target: HTMLElement | string): ApplePayElement;
@@ -29,130 +28,23 @@ export declare interface ApplePayConfig {
29
28
 
30
29
  export declare class ApplePayElement {
31
30
  #private;
32
- htmlTargetElement: HTMLElement;
33
- element: {
34
- name: string;
35
- };
36
- controllerFrame: ControllerFrame;
37
- applePayButton: HTMLButtonElement;
38
- applePayValidationRequest: DigitalWalletValidationRequest;
39
- constructor({ element, controllerFrame, framepayBus, applePayValidationRequest, }: ApplePayElementParams);
40
- applyStyles({ buttonColor, buttonType, buttonLanguage, }: ApplePayElementConfig['displayOptions']): void;
41
- setupApplePay(): Promise<void>;
31
+
42
32
  mount(): void;
43
- onUpdateConfiguration(): Promise<void>;
44
33
  unmount(): void;
45
34
  destroy(): void;
46
35
  on(eventType: string): void;
47
36
  }
48
37
 
49
- export declare type ApplePayElementConfig = ReturnType<typeof makeApplePayConfig>;
50
-
51
- export declare interface ApplePayElementParams {
52
- element: HTMLElement;
53
- controllerFrame: ControllerFrame;
54
- framepayBus: EmitterInstance;
55
- applePayValidationRequest: DigitalWalletValidationRequest;
56
- }
57
-
58
38
  /**
59
39
  * Abstraction layer for the base element set to become a bban account field.
60
40
  * Used to hide the internal implementation.
61
41
  */
62
42
  export declare class BankElement {
63
- element: BaseElement | null;
64
- sourceReplaceNames: Partial<{
65
- bankAccountType: string;
66
- bankAccountNumber: string;
67
- bankRoutingNumber: string;
68
- bic: string;
69
- bankName: string;
70
- } & {
71
- accountType: string;
72
- accountNumber: string;
73
- routingNumber: string;
74
- bic: string;
75
- bankName: string;
76
- } & {
77
- bic: string;
78
- bankName: string;
79
- }>;
80
- elementParams: {
81
- element: HTMLElement;
82
- fieldType: string;
83
- controllerFrame: ControllerFrame;
84
- };
85
- constructor({ element, fieldType, controllerFrame, sourceReplaceNames, }: BankElementParams);
86
- /**
87
- * Create new BaseElement instance with constructor params
88
- *
89
- * @returns {BaseElement}
90
- */
91
- createElement(): void;
92
- mount(): void;
93
- unmount(): void;
94
- destroy(): void;
95
- on<T extends keyof BaseElementEventMap>(eventType: T, delegate: (...args: BaseElementEventMap[T]) => void): void;
96
- }
97
-
98
- export declare interface BankElementParams {
99
- element: HTMLElement;
100
- fieldType: string;
101
- controllerFrame: ControllerFrame;
102
- sourceReplaceNames: BankElementSourceReplaceNames;
103
- }
104
-
105
- export declare type BankElementSourceReplaceNames = Partial<typeof PUBLIC_FIELD_SOURCE_NAMES_REPLACE_MAP.bankAccount & typeof PUBLIC_FIELD_SOURCE_NAMES_REPLACE_MAP.bban & typeof PUBLIC_FIELD_SOURCE_NAMES_REPLACE_MAP.iban>;
106
-
107
- export declare class BaseElement {
108
43
  #private;
109
- element: HTMLElement;
110
- fieldType: string;
111
- controllerFrame: ControllerFrame;
112
- name: string;
113
- mounted: boolean;
114
- destroyed: boolean;
115
- initialized: boolean;
116
- frameRegistration: FrameRegistration | null;
117
- configurationVersion: number;
118
- wrapperEl: HTMLDivElement | null;
119
- /**
120
- * @param params
121
- * @param params.element target element to mount to
122
- */
123
- constructor({ element, fieldType, controllerFrame, prefix, }: {
124
- element: HTMLElement;
125
- fieldType: string | null;
126
- controllerFrame: ControllerFrame;
127
- prefix: string;
128
- });
129
- /**
130
- * Based on the message content type apply different styles to the element wrapper
131
- */
132
- applyElementStyle(fieldNotification: FieldNotification): void;
133
- /**
134
- * Filter relayed messages from the element and emit them on the exposed bus
135
- * for use by the user.
136
- */
137
- filterAndEmit(fieldNotification: FieldNotification): void;
138
- getLabel(): false | Element;
139
- detectLabel(): void;
44
+
140
45
  mount(): void;
141
- /**
142
- * Unmount the card element.
143
- * Note: This destroys the iframe, as you cannot unmount and remount
144
- * an iframe without the contents of that iframe being destroyed and
145
- * reloaded on new mount.
146
- * See: https://stackoverflow.com/questions/8318264/how-to-move-an-iframe-in-the-dom-without-losing-its-state
147
- */
148
46
  unmount(): void;
149
- /**
150
- * Destroy the card element
151
- */
152
47
  destroy(): void;
153
- /**
154
- * Allow the user to plug into the change event.
155
- */
156
48
  on<T extends keyof BaseElementEventMap>(eventType: T, delegate: (...args: BaseElementEventMap[T]) => void): void;
157
49
  }
158
50
 
@@ -314,30 +206,15 @@ export declare type CardCvvType = ValueOf<typeof CARD_CVV_TYPES>;
314
206
  * Used to hide the internal implementation.
315
207
  */
316
208
  export declare class CardElement {
317
- element: GroupFabric | BaseElement | null;
318
- group: GroupFabric | null;
319
- elementParams: {
320
- element: HTMLElement;
321
- fieldType: string;
322
- controllerFrame: ControllerFrame;
323
- };
324
- constructor({ element, fieldType, controllerFrame }: CardElementParams);
325
- /**
326
- * Create new BaseElement instance with constructor params
327
- */
328
- createElement(): void;
209
+ #private;
210
+
211
+
329
212
  mount(): void;
330
213
  unmount(): void;
331
214
  destroy(): void;
332
215
  on<T extends keyof BaseElementEventMap>(eventType: T, delegate: (...args: BaseElementEventMap[T]) => void): void;
333
216
  }
334
217
 
335
- export declare interface CardElementParams {
336
- element: HTMLElement;
337
- fieldType: string;
338
- controllerFrame: ControllerFrame;
339
- }
340
-
341
218
  export declare type CardExpirationType = ValueOf<typeof CARD_EXPIRATION_TYPES>;
342
219
 
343
220
  export declare interface ClassesConfig {
@@ -354,171 +231,6 @@ export declare interface ClassesConfig {
354
231
  googlePay?: string;
355
232
  }
356
233
 
357
- export declare interface Configuration {
358
- publishableKey?: string;
359
- applePay: ApplePayConfig;
360
- bban?: unknown;
361
- card: CardConfig;
362
- classes: ClassesConfig;
363
- googlePay: GooglePayConfig;
364
- i18n: I18nConfig;
365
- icon: IconConfig;
366
- isParamountBankAccount?: boolean;
367
- kountAccountId?: string | null;
368
- locale: string;
369
- methods: 'auto' | ReadyToPayObject[];
370
- organizationId: string;
371
- paypal: PaypalConfig;
372
- placeholders: PlaceholdersConfig;
373
- riskMetadata: RiskMetadata;
374
- sandbox: boolean;
375
- style: StyleConfig;
376
- transactionData?: TransactionData;
377
- websiteId: string;
378
- samsungPay: SamsungPayConfig;
379
- }
380
-
381
- /**
382
- * Controller contained within the remote controller iframe
383
- */
384
- export declare class Controller {
385
- private parentRef;
386
- private firstRegisteredMethod;
387
- private registeredMethods;
388
- private tokenRequest;
389
- private model;
390
- private googlePayToken;
391
- private resolveHandleBillingUpdateFromMerchantPromise;
392
- private resolveHandleShippingUpdateFromMerchantPromise;
393
- constructor(tokenRequest?: TokenRequest);
394
- /**
395
- * Check whether the controller was setup to target sandbox
396
- */
397
- isSandboxMode(): boolean;
398
- /**
399
- * Returns RebillyField list in the registered remote frames
400
- */
401
- getRemoteFields(method?: string): {
402
- fields: Field[];
403
- missing: [string, string][];
404
- };
405
- askParentToCreateRebillyToken(googlePayTransactionContent: GooglePayTransactionContent): void;
406
- resolveHandleBillingUpdateFromMerchant(newTransactionData: ControllerTransactionData): void;
407
- requestHandleBillingUpdateFromMerchant(billingContact: BillingContact): Promise<ControllerTransactionData>;
408
- resolveHandleShippingUpdateFromMerchant(newTransactionData: ControllerTransactionData): void;
409
- requestHandleShippingUpdateFromMerchant(shippingData: ShippingUpdateShippingData, eventType: 'address' | 'option'): Promise<ControllerTransactionData>;
410
- /**
411
- * Remote sibling frame registration. A remote sibling frame is a field that
412
- * is on the same origin as this controller and allows us to collect its data.
413
- */
414
- registerSiblingFrame(registration: FrameRegistration): void;
415
- /**
416
- * Remote sibling frame unregistration. A remote sibling frame is a field
417
- * that is on the same origin as the controller and allows us to collect its data.
418
- * The field should be unregistered in unmount method see {@link base-element.unmount}
419
- */
420
- unregisterSiblingFrame(registration: FrameRegistration): void;
421
- /**
422
- * Updates the controller frames configuration and all registered remote elements
423
- */
424
- updateConfiguration(newConfiguration: RawConfiguration): void;
425
- /**
426
- * Request the field validation (revalidate all fields)
427
- *
428
- * @param data - some shared data from field which requested the global validation
429
- */
430
- requestFieldValidation(data: FieldValidationParams): void;
431
- /**
432
- * Request the field input focus
433
- */
434
- requestFieldFocus({ frame, target }: {
435
- frame: string;
436
- target: string;
437
- }): void;
438
- /**
439
- * Notify all the other remote fields of a new value
440
- */
441
- publishFieldValueToOtherFields({ origin, source, value, }: {
442
- origin: string;
443
- source: string;
444
- value: string;
445
- }): void;
446
- sendTokenRequest({ xsrfToken, data, }: {
447
- xsrfToken?: string | null;
448
- data: TokenRequestPayload;
449
- }): Promise<TokenData>;
450
- /**
451
- * Request the payment token directly, without fetching data from remote frames.
452
- * This is used for payment methods that do not require a separate frame (like
453
- * Apple Pay, Paypal, Plaid, Klarna).
454
- */
455
- requestTokenWithoutRemoteFieldData(data: PrepareDigitalWalletPayloadArgs): Promise<TokenData>;
456
- /**
457
- * Request the field data from all remote frames and generate a token request
458
- * using their responses. Returns a promise that resolves with the payment token
459
- * to be consumed by the merchant context.
460
- */
461
- requestToken({ xsrfToken, ...otherData }?: {
462
- xsrfToken?: string | null;
463
- [key: string]: any;
464
- }): Promise<TokenData>;
465
- }
466
-
467
- export declare class ControllerFrame {
468
- #private;
469
- name: string;
470
- plugins: PluginsManager;
471
- sandbox: boolean;
472
- authorizationToken: string;
473
- configuration: Configuration;
474
- controllerFrameBus: EmitterInstance;
475
- isRemoteReady: boolean;
476
- queuedMessages: Array<MessageDelegate>;
477
- registeredFieldTypes: Set<string>;
478
- constructor({ authorizationToken, pluginManager, sandbox, }: ControllerFrameParams);
479
- /**
480
- * If the remote controller is ready run the delegate instantly otherwise
481
- * queue it until the remote is ready.
482
- */
483
- queueMessage(delegate: MessageDelegate): void;
484
- /**
485
- * Handle the request from the controller frame, that we should request the google
486
- * pay token. This request ends up being fed back to the controller frame.
487
- */
488
- handleRequestRebillyTokenCreationFromGooglePay(content: MerchantGooglePayTransactionContent): Promise<void>;
489
- handleShippingOptionChangedEvent(shippingData: ShippingData): void;
490
- handleShippingAddressChangedEvent(shippingData: AddressData): void;
491
- handleBillingAddressChangedEvent(billingContact: BillingContact): void;
492
- /**
493
- * Register another frame that will communicate with the controller
494
- */
495
- registerSiblingFrame(registration: FrameRegistration): void;
496
- /**
497
- * Unregister a sibling frame that was previously ready to communicate
498
- * with the controller.
499
- */
500
- unregisterSiblingFrame(registration: FrameRegistration): void;
501
- setupFrame({ authorizationToken }: {
502
- authorizationToken: string;
503
- }): void;
504
- /**
505
- * Request the payment instrument token from the controller frame and
506
- * provide it with the payload found in the merchant's page.
507
- */
508
- requestToken(...payload: Parameters<Controller['requestToken']>): ReturnType<Controller['requestToken']>;
509
- requestTokenWithoutRemoteFieldData(digitalWalletPayload: Omit<PrepareDigitalWalletPayloadArgs, 'fieldType'>, fieldType: string): ReturnType<Controller['requestTokenWithoutRemoteFieldData']>;
510
- /**
511
- * Update configuration in the iframes
512
- */
513
- updateConfiguration(configuration: RawConfiguration): Promise<void>;
514
- }
515
-
516
- export declare interface ControllerFrameParams {
517
- authorizationToken: string;
518
- pluginManager: PluginsManager;
519
- sandbox: boolean;
520
- }
521
-
522
234
  export declare interface ControllerTransactionData extends Omit<TransactionData, 'amount'> {
523
235
  amount?: string;
524
236
  shippingOptions?: ShippingOptionItem[] & {
@@ -535,7 +247,7 @@ export declare interface ControllerTransactionData extends Omit<TransactionData,
535
247
  export declare type CreatedDelegate<T> = () => T | Promise<T>;
536
248
 
537
249
  export declare class DigitalWalletValidationRequest {
538
- private type;
250
+ #private;
539
251
  /**
540
252
  * Prepare the digital wallet validation request with the provided dependencies and config.
541
253
  */
@@ -552,49 +264,8 @@ export declare class DigitalWalletValidationRequest {
552
264
  post({ data, authorizationToken, organizationId, xsrfToken, sandbox, }: PostArgs): Promise<coreComponents['schemas']['ApplePayValidation']>;
553
265
  }
554
266
 
555
- export declare class DropDownElement {
556
- element: BaseElement;
557
- wrapper: {
558
- node: HTMLDivElement;
559
- attrs: {
560
- style: string;
561
- };
562
- };
563
- fieldType: string;
564
- positionTimer: ReturnType<typeof setTimeout>;
565
- constructor({ attrs, element, fieldType, controllerFrame, open, close, }: DropDownElementParams);
566
- setPosition(immediately: boolean): void;
567
- mount(): void;
568
- unmount(): void;
569
- destroy(): void;
570
- on<T extends keyof BaseElementEventMap>(eventType: T, delegate: (...args: BaseElementEventMap[T]) => void): void;
571
- }
572
-
573
- export declare interface DropDownElementParams {
574
- attrs: {
575
- style: string;
576
- };
577
- element: HTMLElement;
578
- fieldType: string;
579
- controllerFrame: ControllerFrame;
580
- open: string;
581
- close: string;
582
- }
583
-
584
267
  export declare type EmitterInstance = typeof Emitter.prototype;
585
268
 
586
- /**
587
- * We need to cache ready/error events callback because
588
- * it can happen that the user(merchant) registers the callback after
589
- * the event (ready/error) has been fired
590
- */
591
- export declare function EventsCache(bus: EmitterInstance, eventNamesToCache: string[]): EventsCacheResult;
592
-
593
- export declare interface EventsCacheResult {
594
- hasCached(eventName: string): boolean;
595
- getCachedPayload(eventName: string): object | undefined;
596
- }
597
-
598
269
  export declare type ExternalPayload = {
599
270
  leadSource?: Record<string, string>;
600
271
  };
@@ -620,67 +291,6 @@ export declare interface ExtraData {
620
291
 
621
292
  export declare type ExtraPayPalConfigs = Record<(typeof supportedExtraPayPalConfigs)[number], (data?: unknown) => void>;
622
293
 
623
- export declare class Field {
624
- parentRef: FieldPostmateChildAPI | null;
625
- isValid: boolean;
626
- fieldErrors: FieldError[];
627
- model: FieldPostmateModel | null;
628
- mountingPoint: HTMLDivElement | null;
629
- style: Configuration['style'] | null;
630
- fieldConfig: FieldConfig | null;
631
- fieldBus: EmitterInstance | null;
632
- renderer: Renderer | null;
633
- fieldData: FieldData;
634
- get controller(): Controller;
635
- constructor();
636
- /**
637
- * Update the configuration with the object provided and render any changes.
638
- */
639
- updateConfiguration(newConfig: Configuration): void;
640
- /**
641
- * Request the field input frame focus
642
- *
643
- * @param target - target frame name
644
- */
645
- requestFocus({ target }?: {
646
- target?: string;
647
- }): void;
648
- requestValidation(params: FieldValidationParams): void;
649
- /**
650
- * Secondary field update callback
651
- * Will called on each secondary field update
652
- * see controller.publishUpdate
653
- */
654
- receiveUpdate(params: FieldReceiveUpdateParams): void;
655
- registerBus(): void;
656
- setupField(): void;
657
- getFieldData(): Promise<{
658
- isValid: boolean;
659
- errors?: FieldError[];
660
- data?: FieldData;
661
- }>;
662
- setElementValue({ fieldType, value, }: {
663
- fieldType: string;
664
- value: string;
665
- }): void;
666
- invalidateField(errorMessage: FieldError): FieldError[];
667
- revalidateField(): void;
668
- /**
669
- * Emit a message to the base-element instance that generated this field
670
- * via the `mount` method. This is INSECURE and will send and event to
671
- * the merchant scope. DO NOT SHARE SENSITIVE INFORMATION HERE.
672
- */
673
- insecureEmitMessageToMerchantScope({ interaction, fieldType, error, completed, }: {
674
- interaction?: ValueOf<typeof FieldNotification.TYPES>;
675
- fieldType: string;
676
- error?: false | FramepayError | string;
677
- completed?: boolean;
678
- }): void;
679
- requestRebillyTokenCreationFromGooglePay({ transactionData, tokenData, shipping, email, }: GooglePayTransactionContent): void;
680
- requestHandleShippingUpdateFromMerchant(...args: Parameters<Controller['requestHandleShippingUpdateFromMerchant']>): Promise<ControllerTransactionData>;
681
- injectStyle(): void;
682
- }
683
-
684
294
  /**
685
295
  * Internal field name ids
686
296
  * each field with some unique functionality have unique id
@@ -728,15 +338,6 @@ export declare const FIELD_TYPES: {
728
338
  secondary: string;
729
339
  };
730
340
 
731
- export declare interface FieldConfig {
732
- icon?: IconConfig;
733
- isParamountBankAccount?: boolean;
734
- }
735
-
736
- export declare type FieldData = {
737
- [key: string]: string;
738
- };
739
-
740
341
  export declare type FieldError = string | FramepayError;
741
342
 
742
343
  /**
@@ -760,25 +361,6 @@ export declare class FieldNotification {
760
361
 
761
362
  export declare type FieldNotificationType = ValueOf<typeof FieldNotification.TYPES>;
762
363
 
763
- export declare interface FieldPostmateChildAPI extends Postmate.ChildAPI {
764
- model: FieldPostmateModel;
765
- }
766
-
767
- export declare interface FieldPostmateModel {
768
- config: Configuration | null;
769
- requestFocus: Field['requestFocus'];
770
- controllerFrameName: string | null;
771
- name: string | null;
772
- instanceId: string | null;
773
- fieldType: keyof typeof FIELD_TYPES | null;
774
- }
775
-
776
- export declare interface FieldReceiveUpdateParams {
777
- origin: string;
778
- source: string;
779
- value: string;
780
- }
781
-
782
364
  export declare type FieldType = 'googlePay' | 'applePay' | 'plaid' | 'paypal' | 'klarna';
783
365
 
784
366
  export declare interface FieldValidationParams {
@@ -792,16 +374,10 @@ export declare interface FieldValidationParams {
792
374
  }
793
375
 
794
376
  export declare class FramePay {
795
- ControllerFrame: typeof ControllerFrame;
796
- getPlugins: (configuration: Configuration) => PluginsManager;
797
- controllerFrame: ControllerFrame | null;
798
- authorizationToken: string;
377
+ #private;
378
+ locales: Record<string, string>;
799
379
  version: string;
800
380
  initialized: boolean;
801
- framepayBus: EmitterInstance;
802
- eventsCache: ReturnType<typeof EventsCache>;
803
- plugins: PluginsManager;
804
- locales: Record<string, string>;
805
381
  errorCodes: {
806
382
  initialized: string;
807
383
  notInitialized: string;
@@ -861,9 +437,6 @@ export declare class FramePay {
861
437
  invalidMethodsConfiguration: string;
862
438
  unservicableShippingAddress: string;
863
439
  };
864
- setInitializedToFalseOnError: ({ code }: {
865
- code: string;
866
- }) => void;
867
440
  card: Card;
868
441
  bban: Bban;
869
442
  iban: Iban;
@@ -874,15 +447,19 @@ export declare class FramePay {
874
447
  plaid: Plaid;
875
448
  klarna: Klarna;
876
449
  bankAccount: Bban;
877
- constructor({ ControllerFrame, Card, Bban, Iban, GooglePay, ApplePay, SamsungPay, PayPal, Plaid, Klarna, getPlugins, ApplePayValidationRequest, }: FramepayParams);
450
+
451
+
452
+
453
+
454
+
455
+
456
+
457
+
458
+
878
459
  /**
879
460
  * Initialize FramePay and inject a controller in the page.
880
461
  */
881
462
  initialize({ publishableKey, jwt, ...configuration }?: FramepayInitializeParams): Promise<void>;
882
- private manageRemoteFramesLoadingEvents;
883
- private manageGooglePayTokenResult;
884
- private manageBillingEvent;
885
- private manageShippingEvents;
886
463
  /**
887
464
  * Trigger an update of current and future mounted element configuration.
888
465
  */
@@ -929,49 +506,8 @@ export declare interface FramepayInitializeParams extends RawConfiguration {
929
506
  jwt?: string;
930
507
  }
931
508
 
932
- export declare interface FramepayParams {
933
- ControllerFrame: typeof ControllerFrame;
934
- Card: typeof Card;
935
- Bban: typeof Bban;
936
- Iban: typeof Iban;
937
- GooglePay: typeof GooglePay;
938
- ApplePay: typeof ApplePay;
939
- SamsungPay: typeof SamsungPay;
940
- PayPal: typeof PayPal;
941
- Plaid: typeof Plaid;
942
- Klarna: typeof Klarna;
943
- getPlugins: typeof getPlugins;
944
- ApplePayValidationRequest: DigitalWalletValidationRequest;
945
- }
946
-
947
509
  export declare type FramepayStyleValue = string | boolean | null;
948
510
 
949
- export declare class FrameRegistration {
950
- fieldType: string;
951
- name: string;
952
- /**
953
- * Generate a registration for a frame to be passed onto
954
- * the controller.
955
- * Simple structure for IDE usage.
956
- */
957
- constructor({ fieldType, name }: {
958
- fieldType: string;
959
- name: string;
960
- });
961
- }
962
-
963
- export declare interface GeneratorParams extends MainContainer {
964
- make?: MakeFn;
965
- fieldBus?: EmitterInstance;
966
- fieldType?: string;
967
- combined?: boolean;
968
- fieldConfig?: FieldConfig;
969
- mountingPoint?: HTMLElement;
970
- baseField?: Field;
971
- }
972
-
973
- export declare const getPlugins: (configuration: Configuration) => PluginsManager;
974
-
975
511
  export declare class GooglePay extends PaymentMethod {
976
512
  GooglePayMarkIcon: string;
977
513
  mount(target: HTMLElement | string): GooglePayElement;
@@ -991,20 +527,8 @@ export declare interface GooglePayConfig {
991
527
  * Used to hide the internal implementation.
992
528
  */
993
529
  export declare class GooglePayElement {
994
- element: BaseElement | null;
995
- elementParams: {
996
- element: HTMLElement;
997
- fieldType: string;
998
- controllerFrame: ControllerFrame;
999
- };
1000
- constructor({ element, controllerFrame, }: {
1001
- element: HTMLElement;
1002
- controllerFrame: ControllerFrame;
1003
- });
1004
- /**
1005
- * Returns new BaseElement instance with constructor params
1006
- */
1007
- createElement(): void;
530
+ #private;
531
+
1008
532
  mount(): void;
1009
533
  unmount(): void;
1010
534
  destroy(): void;
@@ -1028,27 +552,6 @@ export declare interface GooglePayTransactionContent {
1028
552
  email: string;
1029
553
  }
1030
554
 
1031
- export declare class GroupFabric {
1032
- elements: (BaseElement | DropDownElement)[];
1033
- events: {};
1034
- constructor({ elements }: GroupFabricParams);
1035
- /**
1036
- * Create and append the group dom element (wrapper) of the group elements
1037
- * @see methods/card-element.js
1038
- *
1039
- * @param parent - the element which was passed to the element.mount(argument)
1040
- */
1041
- static appendGroupContainer(parent: HTMLElement): HTMLDivElement;
1042
- mount(): void;
1043
- unmount(): void;
1044
- destroy(): void;
1045
- on<T extends keyof BaseElementEventMap>(eventType: T, delegate: (...args: BaseElementEventMap[T]) => void): void;
1046
- }
1047
-
1048
- export declare interface GroupFabricParams {
1049
- elements: (BaseElement | DropDownElement)[];
1050
- }
1051
-
1052
555
  export declare interface I18nConfig {
1053
556
  [locale: string]: {
1054
557
  validations: Partial<I18nValidations>;
@@ -1091,34 +594,14 @@ export declare class Iban extends PaymentMethod {
1091
594
  * Used to hide the internal implementation.
1092
595
  */
1093
596
  export declare class IbanElement {
1094
- element: BaseElement | null;
1095
- elementParams: {
1096
- element: HTMLElement;
1097
- fieldType: string;
1098
- controllerFrame: ControllerFrame;
1099
- };
1100
- sourceReplaceNames: Partial<{
1101
- bic: string;
1102
- bankName: string;
1103
- }>;
1104
- constructor({ element, fieldType, sourceReplaceNames, controllerFrame, }: IbanElementParams);
1105
- /**
1106
- * Returns new BaseElement instance with constructor params
1107
- */
1108
- createElement(): void;
597
+ #private;
598
+
1109
599
  mount(): void;
1110
600
  unmount(): void;
1111
601
  destroy(): void;
1112
602
  on<T extends keyof BaseElementEventMap>(eventType: T, delegate: (...args: BaseElementEventMap[T]) => void): void;
1113
603
  }
1114
604
 
1115
- export declare interface IbanElementParams {
1116
- element: HTMLElement;
1117
- fieldType: string;
1118
- sourceReplaceNames: IbanElementSourceReplaceNames;
1119
- controllerFrame: ControllerFrame;
1120
- }
1121
-
1122
605
  export declare type IbanElementSourceReplaceNames = Partial<typeof PUBLIC_FIELD_SOURCE_NAMES_REPLACE_MAP.iban>;
1123
606
 
1124
607
  export declare type IbanFieldType = keyof IbanSourceMap | 'iban';
@@ -1139,29 +622,10 @@ export declare class Klarna extends PaymentMethod {
1139
622
  mount(target?: HTMLElement | string): KlarnaElement;
1140
623
  }
1141
624
 
1142
- export declare interface KlarnaConfig {
1143
- clientToken: string;
1144
- sessionId: string;
1145
- }
1146
-
1147
625
  export declare class KlarnaElement {
1148
626
  #private;
1149
- klarnaInstance: null;
1150
- htmlTargetElement: HTMLElement;
1151
- element: {
1152
- name: string;
1153
- };
1154
- controllerFrame: ControllerFrame;
1155
- klarnaContainer: HTMLDivElement;
1156
- constructor({ element, controllerFrame, framepayBus, }: {
1157
- element: HTMLElement;
1158
- controllerFrame: ControllerFrame;
1159
- framepayBus: EmitterInstance;
1160
- });
1161
- static getConfig(): KlarnaConfig;
1162
- setupKlarna(): Promise<void>;
627
+
1163
628
  mount(): void;
1164
- onUpdateConfiguration(): Promise<void>;
1165
629
  unmount(): void;
1166
630
  on(eventType: never): void;
1167
631
  }
@@ -1180,82 +644,6 @@ export declare interface LineItem {
1180
644
 
1181
645
  export declare function loadFramepay({ scriptLink, styleLink, }?: Partial<Options>): Promise<FramePay>;
1182
646
 
1183
- export declare interface MainContainer {
1184
- mainContainer?: HTMLElement;
1185
- }
1186
-
1187
- /**
1188
- * Generate an element using a tag name and optionally a set of classes,
1189
- * style and other attributes.
1190
- */
1191
- export declare function make<T extends keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap>(tag: T, { cssClasses, style, attrs, textContent, }?: MakeParams): HTMLElement;
1192
-
1193
- /**
1194
- * Returns the Apple Pay field specific configuration based
1195
- * on the full FramePay configuration
1196
- */
1197
- export declare const makeApplePayConfig: (configuration: RawConfiguration) => {
1198
- organizationId: string;
1199
- displayName: string;
1200
- domainName: string;
1201
- allowedCardBrands: string[];
1202
- countryCode: string;
1203
- currency: string;
1204
- amount: number;
1205
- label: string;
1206
- displayOptions: ApplePayConfig;
1207
- shippingConfiguration: {
1208
- requiredShippingContactFields: ApplePayJS.ApplePayContactField[];
1209
- shippingMethods?: ShippingOptionItem[];
1210
- };
1211
- lineItems: LineItem[];
1212
- };
1213
-
1214
- export declare type MakeAttrs = Record<string, string | boolean>;
1215
-
1216
- export declare type MakeFn = typeof make;
1217
-
1218
- export declare interface MakeParams {
1219
- make?: MakeFn;
1220
- type?: keyof HTMLElementTagNameMap;
1221
- cssClasses?: string | string[];
1222
- style?: Record<string, string>;
1223
- attrs?: MakeAttrs;
1224
- textContent?: string;
1225
- placeholder?: {
1226
- type?: string;
1227
- attrs?: MakeAttrs;
1228
- cssClasses?: string[];
1229
- textContent?: string;
1230
- };
1231
- options?: string[];
1232
- value?: string;
1233
- mountingPoint?: HTMLElement;
1234
- }
1235
-
1236
- /**
1237
- * Returns the Samsung Pay configuration based
1238
- * on the full FramePay configuration
1239
- */
1240
- export declare const makeSamsungPayConfig: (configuration: RawConfiguration) => {
1241
- organizationId: string;
1242
- displayName: string;
1243
- domainName: string;
1244
- allowedCardBrands: string[];
1245
- countryCode: string;
1246
- currency: string;
1247
- amount: number;
1248
- label: string;
1249
- displayOptions: SamsungPayConfig;
1250
- lineItems: LineItem[];
1251
- sandbox: boolean;
1252
- };
1253
-
1254
- export declare interface MerchantGooglePayTransactionContent extends Omit<GooglePayTransactionContent, 'tokenData'> {
1255
- }
1256
-
1257
- export declare type MessageDelegate = () => void;
1258
-
1259
647
  export declare interface NotificationArgs {
1260
648
  type: FieldNotificationType;
1261
649
  content?: NotificationContent | FieldError;
@@ -1279,7 +667,7 @@ export declare class PaymentMethod {
1279
667
  /**
1280
668
  * Find target HTML element
1281
669
  */
1282
- static findTarget(target?: HTMLElement | string): HTMLElement;
670
+ protected static findTarget(target?: HTMLElement | string): HTMLElement;
1283
671
  }
1284
672
 
1285
673
  export declare interface PaymentMethodOptions {
@@ -1300,29 +688,13 @@ export declare interface PaypalConfig {
1300
688
 
1301
689
  export declare class PayPalElement {
1302
690
  #private;
1303
- htmlTargetElement: HTMLElement;
1304
- element: {
1305
- name: string;
1306
- };
1307
- controllerFrame: ControllerFrame;
1308
- extraData: ExtraPayPalConfigs;
1309
- paypalButton: HTMLDivElement;
1310
- constructor({ element, controllerFrame, extraData, framepayBus, }: PayPalElementConstructorArgs);
1311
- setupPayPal(): Promise<void>;
691
+
1312
692
  mount(): void;
1313
- onUpdateConfiguration(): Promise<void>;
1314
693
  unmount(): void;
1315
694
  destroy(): void;
1316
695
  on(eventType: never, _delegate: never): void;
1317
696
  }
1318
697
 
1319
- export declare interface PayPalElementConstructorArgs {
1320
- element: HTMLElement;
1321
- controllerFrame: ControllerFrame;
1322
- extraData: ExtraPayPalConfigs;
1323
- framepayBus: EmitterInstance;
1324
- }
1325
-
1326
698
  export declare interface PlaceholdersConfig {
1327
699
  bban?: BbanConfig;
1328
700
  bankAccount?: BbanConfig;
@@ -1359,84 +731,18 @@ export declare class Plaid extends PaymentMethod {
1359
731
 
1360
732
  export declare class PlaidElement {
1361
733
  #private;
1362
- htmlTargetElement: HTMLElement;
1363
- element: {
1364
- name: string;
1365
- };
1366
- controllerFrame: ControllerFrame;
1367
- form: HTMLElement;
1368
- plaidButton: HTMLButtonElement;
1369
- extraData: ExtraData;
1370
- constructor({ element, controllerFrame, form, extraData, framepayBus, }: PlaidElementContructorArgs);
1371
- loadPlaid(configuration: PlaidElementConfig): Promise<void>;
1372
- setupPlaid(): void;
734
+
1373
735
  mount(): void;
1374
- onUpdateConfiguration(): Promise<void>;
1375
736
  unmount(): void;
1376
737
  destroy(): void;
1377
738
  on(eventType: never, _delegate: never): void;
1378
739
  }
1379
740
 
1380
- export declare interface PlaidElementConfig {
1381
- sandbox: boolean;
1382
- plaidLinkToken: string;
1383
- }
1384
-
1385
- export declare interface PlaidElementContructorArgs {
1386
- element: HTMLElement;
1387
- controllerFrame: ControllerFrame;
1388
- form: HTMLElement;
1389
- extraData: ExtraData;
1390
- framepayBus: EmitterInstance;
1391
- }
1392
-
1393
741
  export declare interface PlaidOptions {
1394
742
  form: HTMLElement;
1395
743
  extraData?: ExtraData;
1396
744
  }
1397
745
 
1398
- /**
1399
- * Helper class for uniform plugin behavior and structure.
1400
- */
1401
- declare class Plugin_2<T> {
1402
- created: CreatedDelegate<T> | null;
1403
- runtime: RuntimeDelegate<T> | null;
1404
- payload: T | null;
1405
- /**
1406
- * Create a plugin with the provided callbacks for initialization and runtime.
1407
- * @param args.created runs when the plugin is initialized
1408
- * @param args.runtime runs when `createToken` is triggered
1409
- */
1410
- constructor({ created, runtime, }: {
1411
- created?: CreatedDelegate<T>;
1412
- runtime?: RuntimeDelegate<T>;
1413
- });
1414
- /**
1415
- * Runs when the plugin instance is created at the time
1416
- * the page loads. If a `created` delegate was defined in the plugin
1417
- * it will run at this time and whatever value returned will be cached
1418
- * into the instance payload.
1419
- */
1420
- initialize(): void;
1421
- /**
1422
- * Runs the async plugin `runtime` delegate if present and returns the
1423
- * cached payload.
1424
- * @param externalPayload Defines the payload provided as `extraData` by the user
1425
- */
1426
- run(externalPayload: ExternalPayload): T | Promise<T>;
1427
- }
1428
- export { Plugin_2 as Plugin }
1429
-
1430
- export declare class PluginsManager {
1431
- private plugins;
1432
- constructor(plugins?: Plugin_2<unknown>[]);
1433
- /**
1434
- * Resolve all async payloads from plugins.
1435
- * @param externalPayload Defines the payload provided as `extraData` by the user
1436
- */
1437
- getPayloads(externalPayload: ExternalPayload): Promise<AllPossibleRuntimePluginReturnTypes>;
1438
- }
1439
-
1440
746
  export declare interface PostArgs {
1441
747
  data: object;
1442
748
  organizationId: string;
@@ -1464,35 +770,6 @@ export declare interface PrepareDigitalWalletPayloadArgs {
1464
770
  fieldType: FieldType;
1465
771
  }
1466
772
 
1467
- /**
1468
- * Out clients want to use the friendly names like "bic", "bankName", "cvv"
1469
- * but in the internal functionality we should use id "bbanBic", "ibanBic", "cardCvv"
1470
- *
1471
- * to able clients to use friendly ids we should make some override
1472
- *
1473
- * client names -> internal names (mount method)
1474
- * internal names -> client names (method listeners, like change event source property)
1475
- *
1476
- *
1477
- * {
1478
- * [root-field-category-like iban or bban] : {
1479
- * [public-field-id] : 'internal-field-id'
1480
- * }
1481
- * }
1482
- *
1483
- * by default method use passed value as fallback
1484
- * (if the method haven't any overrides in the replace map)
1485
- * that needs for some system fields like dropdowns and etc.
1486
- *
1487
- * so don't worry about system fields (we don't need to implement replace_map for system fields)
1488
- *
1489
- * that also means if you will use something like Framepay.bban.mount('...', 'bbanAccountType')
1490
- * this method will work (the fallback value of field type will be as passed value)
1491
- *
1492
- * but clients should use only correct and friendly names like Framepay.bban.mount('...', 'bic')
1493
- *
1494
- * see details in methods/*.js (how works mount method)
1495
- */
1496
773
  export declare const PUBLIC_FIELD_SOURCE_NAMES_REPLACE_MAP: {
1497
774
  bankAccount: {
1498
775
  bankAccountType: string;
@@ -1550,47 +827,6 @@ export declare interface ReadyToPayObject {
1550
827
  feature?: Record<string, string>;
1551
828
  }
1552
829
 
1553
- export declare interface RenderableField {
1554
- mainContainer: HTMLElement;
1555
- fieldType: string;
1556
- update: (generatorParams: GeneratorParams, { fieldType, mainContainer, }: {
1557
- fieldType: string;
1558
- mainContainer: HTMLElement;
1559
- }) => void;
1560
- }
1561
-
1562
- export declare class Renderer {
1563
- #private;
1564
- fieldType: string;
1565
- fieldBus: EmitterInstance;
1566
- mountingPoint: HTMLDivElement | null;
1567
- fieldConfig: FieldConfig | null;
1568
- baseField: Field;
1569
- mainForm: HTMLElement | null;
1570
- field: RenderableField | RenderableField[] | null;
1571
- constructor({ fieldType, fieldBus, mountingPoint, fieldConfig, baseField, }: RendererConstructorParams);
1572
- static make: typeof make;
1573
- /**
1574
- * Update the rendering of the elements based on the configuration object.
1575
- */
1576
- update({ fieldConfig }: {
1577
- fieldConfig: FieldConfig;
1578
- }): void;
1579
- /**
1580
- * Render the field element and fork the rendering logic based
1581
- * on the provided type at instantiation.
1582
- */
1583
- render(): void;
1584
- }
1585
-
1586
- export declare interface RendererConstructorParams {
1587
- fieldType: string;
1588
- fieldBus: EmitterInstance;
1589
- mountingPoint: HTMLDivElement | null;
1590
- fieldConfig: FieldConfig | null;
1591
- baseField: Field;
1592
- }
1593
-
1594
830
  export declare interface RiskMetadata {
1595
831
  browserData?: {
1596
832
  colorDepth: string;
@@ -1618,32 +854,14 @@ export declare interface SamsungPayConfig {
1618
854
  }
1619
855
 
1620
856
  export declare class SamsungPayElement {
1621
- element: BaseElement | null;
1622
- elementParams: {
1623
- element: HTMLElement;
1624
- fieldType: string;
1625
- controllerFrame: ControllerFrame;
1626
- };
1627
- htmlTargetElement: HTMLElement;
1628
- framepayBus: EmitterInstance;
1629
- controllerFrame: ControllerFrame;
1630
- samsungPayButton: HTMLButtonElement;
1631
- constructor({ element, controllerFrame, framepayBus, }: {
1632
- element: HTMLElement;
1633
- controllerFrame: ControllerFrame;
1634
- framepayBus: EmitterInstance;
1635
- });
1636
- applyStyles(buttonColor?: SamsungPayElementConfig['displayOptions']['buttonColor']): void;
1637
- setupSamsungPay(): Promise<void>;
857
+ #private;
858
+
1638
859
  mount(): void;
1639
860
  unmount(): void;
1640
861
  destroy(): void;
1641
- onUpdateConfiguration(): Promise<void>;
1642
- on(): void;
862
+ on(eventType: never, _delegate: never): void;
1643
863
  }
1644
864
 
1645
- export declare type SamsungPayElementConfig = ReturnType<typeof makeSamsungPayConfig>;
1646
-
1647
865
  export declare interface SelectionStyleConfig {
1648
866
  background?: FramepayStyleValue;
1649
867
  backgroundColor?: FramepayStyleValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebilly/framepay",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "A wrapper to load Rebilly's FramePay library and provide TypeScript types",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -38,7 +38,7 @@
38
38
  "@rebilly/eslint-config": "*",
39
39
  "@rebilly/framepay-app": "*",
40
40
  "typescript": "^5.4.5",
41
- "vite": "^5.4.9",
41
+ "vite": "^5.4.11",
42
42
  "vite-plugin-dts": "^4.2.4"
43
43
  }
44
44
  }