@rebilly/framepay 1.0.1

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.
@@ -0,0 +1,1790 @@
1
+ /// <reference types="applepayjs" />
2
+ /// <reference types="googlepay" />
3
+
4
+ import type { coreComponents } from 'rebilly-js-sdk/types';
5
+ import type Emitter from 'component-emitter';
6
+ import Postmate from 'popostmate';
7
+ import type { reportsComponents } from 'rebilly-js-sdk/types';
8
+
9
+ export declare interface AddressData {
10
+ countryCode?: string;
11
+ }
12
+
13
+ export declare type AllPossibleRuntimePluginReturnTypes = {
14
+ leadSources?: LeadSourceResult;
15
+ };
16
+
17
+ export declare class ApplePay extends PaymentMethod {
18
+ applePayValidationRequest: DigitalWalletValidationRequest;
19
+ ApplePayMarkIcon: string;
20
+ constructor(framepayInstance: FramePay, applePayValidationRequest: DigitalWalletValidationRequest);
21
+ mount(target: HTMLElement | string): ApplePayElement;
22
+ }
23
+
24
+ export declare interface ApplePayConfig {
25
+ buttonColor?: string;
26
+ buttonLanguage?: string;
27
+ buttonType?: string;
28
+ }
29
+
30
+ export declare class ApplePayElement {
31
+ #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>;
42
+ mount(): void;
43
+ onUpdateConfiguration(): Promise<void>;
44
+ unmount(): void;
45
+ destroy(): void;
46
+ on(eventType: string): void;
47
+ }
48
+
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
+ /**
59
+ * Abstraction layer for the base element set to become a bban account field.
60
+ * Used to hide the internal implementation.
61
+ */
62
+ 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
+ #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;
140
+ 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
+ unmount(): void;
149
+ /**
150
+ * Destroy the card element
151
+ */
152
+ destroy(): void;
153
+ /**
154
+ * Allow the user to plug into the change event.
155
+ */
156
+ on<T extends keyof BaseElementEventMap>(eventType: T, delegate: (...args: BaseElementEventMap[T]) => void): void;
157
+ }
158
+
159
+ export declare interface BaseElementEventMap {
160
+ [FieldNotification.TYPES.ready]: [];
161
+ [FieldNotification.TYPES.focus]: [{
162
+ content: string;
163
+ }];
164
+ [FieldNotification.TYPES.error]: [FramepayError];
165
+ [FieldNotification.TYPES.valid]: [
166
+ {
167
+ valid: boolean;
168
+ source: string;
169
+ completed?: boolean;
170
+ }
171
+ ];
172
+ [FieldNotification.TYPES.blur]: [{
173
+ content: string;
174
+ }];
175
+ [FieldNotification.TYPES.autoFillStart]: [];
176
+ [FieldNotification.TYPES.autoFillCancel]: [];
177
+ change: [
178
+ {
179
+ error: NotificationContent | FieldError;
180
+ source: string;
181
+ completed?: boolean;
182
+ valid?: boolean;
183
+ }
184
+ ];
185
+ }
186
+
187
+ export declare interface BaseStyleDeclaration {
188
+ color?: FramepayStyleValue;
189
+ fontFamily?: FramepayStyleValue;
190
+ fontSize?: FramepayStyleValue;
191
+ fontStyle?: FramepayStyleValue;
192
+ fontVariant?: FramepayStyleValue;
193
+ fontStretch?: FramepayStyleValue;
194
+ fontWeight?: FramepayStyleValue;
195
+ fontFeatureSettings?: FramepayStyleValue;
196
+ fontKerning?: FramepayStyleValue;
197
+ webkitFontSmoothing?: FramepayStyleValue;
198
+ mozOsxFontSmoothing?: FramepayStyleValue;
199
+ letterSpacing?: FramepayStyleValue;
200
+ lineHeight?: FramepayStyleValue;
201
+ textDecoration?: FramepayStyleValue;
202
+ textShadow?: FramepayStyleValue;
203
+ textTransform?: FramepayStyleValue;
204
+ textAlign?: FramepayStyleValue;
205
+ textRendering?: FramepayStyleValue;
206
+ }
207
+
208
+ export declare class Bban extends PaymentMethod {
209
+ mount(target: HTMLElement | string, fieldType: BbanFieldType): BankElement;
210
+ }
211
+
212
+ export declare interface BbanConfig {
213
+ bicPlaceholder?: string;
214
+ bankNamePlaceholder?: string;
215
+ accountNumber?: string | null;
216
+ routingNumber?: string | null;
217
+ type?: {
218
+ savings?: string | null;
219
+ checking?: string | null;
220
+ other?: string | null;
221
+ };
222
+ }
223
+
224
+ export declare type BbanFieldType = keyof BbanSourceMap;
225
+
226
+ export declare type BbanSourceMap = Partial<typeof PUBLIC_FIELD_SOURCE_NAMES_REPLACE_MAP.bankAccount & typeof PUBLIC_FIELD_SOURCE_NAMES_REPLACE_MAP.bban>;
227
+
228
+ export declare type BillingAddressChangedHandler = (billingContact: BillingContact, updateTransaction: (newTransactionData: UpdateableTransactionData) => void) => void;
229
+
230
+ export declare interface BillingContact {
231
+ addressLines?: string[];
232
+ administrativeArea?: string;
233
+ country?: string;
234
+ countryCode?: string;
235
+ familyName?: string;
236
+ givenName?: string;
237
+ locality?: string;
238
+ postalCode?: string;
239
+ subAdministrativeArea?: string;
240
+ subLocality?: string;
241
+ }
242
+
243
+ export declare interface ButtonStyleConfig {
244
+ base?: ButtonStyleDeclaration;
245
+ focus?: ButtonStyleDeclaration;
246
+ active?: ButtonStyleDeclaration;
247
+ }
248
+
249
+ export declare interface ButtonStyleDeclaration {
250
+ background?: FramepayStyleValue;
251
+ borderColor?: FramepayStyleValue;
252
+ borderRadius?: FramepayStyleValue;
253
+ borderStyle?: FramepayStyleValue;
254
+ borderWidth?: FramepayStyleValue;
255
+ color?: FramepayStyleValue;
256
+ fontFamily?: FramepayStyleValue;
257
+ fontFeatureSettings?: FramepayStyleValue;
258
+ fontKerning?: FramepayStyleValue;
259
+ fontSize?: FramepayStyleValue;
260
+ fontStretch?: FramepayStyleValue;
261
+ fontStyle?: FramepayStyleValue;
262
+ fontVariant?: FramepayStyleValue;
263
+ fontWeight?: FramepayStyleValue;
264
+ letterSpacing?: FramepayStyleValue;
265
+ lineHeight?: FramepayStyleValue;
266
+ mozOsxFontSmoothing?: FramepayStyleValue;
267
+ textAlign?: FramepayStyleValue;
268
+ textDecoration?: FramepayStyleValue;
269
+ textRendering?: FramepayStyleValue;
270
+ textShadow?: FramepayStyleValue;
271
+ textTransform?: FramepayStyleValue;
272
+ webkitFontSmoothing?: FramepayStyleValue;
273
+ ':hover'?: ButtonStyleDeclaration;
274
+ }
275
+
276
+ export declare class Card extends PaymentMethod {
277
+ Brands: typeof SupportedCardBrands;
278
+ mount(target: HTMLElement | string, fieldType?: string): CardElement;
279
+ }
280
+
281
+ export declare const CARD_CVV_TYPES: {
282
+ readonly password: "password";
283
+ readonly text: "text";
284
+ };
285
+
286
+ export declare const CARD_EXPIRATION_TYPES: {
287
+ readonly dropdown: "dropdown";
288
+ readonly text: "text";
289
+ readonly hidden: "hidden";
290
+ };
291
+
292
+ export declare interface CardConfig {
293
+ number?: {
294
+ mask: string;
295
+ };
296
+ expiry?: {
297
+ type: CardExpirationType;
298
+ };
299
+ expiration?: {
300
+ type: CardExpirationType;
301
+ };
302
+ cvv?: {
303
+ type: CardCvvType;
304
+ };
305
+ brands?: {
306
+ allowed?: string[] | null;
307
+ };
308
+ }
309
+
310
+ export declare type CardCvvType = ValueOf<typeof CARD_CVV_TYPES>;
311
+
312
+ /**
313
+ * Abstraction layer for the base element set to become a payment card field.
314
+ * Used to hide the internal implementation.
315
+ */
316
+ 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;
329
+ mount(): void;
330
+ unmount(): void;
331
+ destroy(): void;
332
+ on<T extends keyof BaseElementEventMap>(eventType: T, delegate: (...args: BaseElementEventMap[T]) => void): void;
333
+ }
334
+
335
+ export declare interface CardElementParams {
336
+ element: HTMLElement;
337
+ fieldType: string;
338
+ controllerFrame: ControllerFrame;
339
+ }
340
+
341
+ export declare type CardExpirationType = ValueOf<typeof CARD_EXPIRATION_TYPES>;
342
+
343
+ export declare interface ClassesConfig {
344
+ base?: string;
345
+ focus?: string;
346
+ group?: string;
347
+ dropdown?: string;
348
+ secondary?: string;
349
+ buttons?: string;
350
+ webkitAutofill?: string;
351
+ valid?: string;
352
+ invalid?: string;
353
+ input?: string;
354
+ googlePay?: string;
355
+ }
356
+
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
+ export declare interface ControllerTransactionData extends Omit<TransactionData, 'amount'> {
523
+ amount?: string;
524
+ shippingOptions?: ShippingOptionItem[] & {
525
+ options?: ShippingOptionItem[];
526
+ defaultSelectedOptionId?: string;
527
+ };
528
+ status?: string;
529
+ details: {
530
+ reason?: google.payments.api.ErrorReason;
531
+ message?: string;
532
+ };
533
+ }
534
+
535
+ export declare type CreatedDelegate<T> = () => T | Promise<T>;
536
+
537
+ export declare class DigitalWalletValidationRequest {
538
+ private type;
539
+ /**
540
+ * Prepare the digital wallet validation request with the provided dependencies and config.
541
+ */
542
+ constructor({ type }: {
543
+ type: string;
544
+ });
545
+ /**
546
+ * Post to the `/digital-wallets/validation` endpoint with the provided data
547
+ * and return a Promise that will resolve with the response data
548
+ * or reject with the error object.
549
+ * @param args.sandbox - whether the request is to be triggered in sandbox mode
550
+ * @returns Rebilly BE validation response
551
+ */
552
+ post({ data, authorizationToken, organizationId, xsrfToken, sandbox, }: PostArgs): Promise<coreComponents['schemas']['ApplePayValidation']>;
553
+ }
554
+
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
+ export declare type EmitterInstance = typeof Emitter.prototype;
585
+
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
+ export declare type ExternalPayload = {
599
+ leadSource?: Record<string, string>;
600
+ };
601
+
602
+ export declare interface ExtraData {
603
+ method?: string;
604
+ leadSource?: {
605
+ content?: string;
606
+ medium?: string;
607
+ source?: string;
608
+ campaign?: string;
609
+ affiliate?: string;
610
+ };
611
+ billingAddress?: reportsComponents['schemas']['ContactObject'] & {
612
+ fullName?: string;
613
+ };
614
+ shippingDetails?: {
615
+ address?: ApplePayJS.ApplePayPaymentContact;
616
+ option?: ShippingOptionItem;
617
+ };
618
+ [key: string]: string | object | undefined;
619
+ }
620
+
621
+ export declare type ExtraPayPalConfigs = Record<(typeof supportedExtraPayPalConfigs)[number], (data?: unknown) => void>;
622
+
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
+ /**
685
+ * Internal field name ids
686
+ * each field with some unique functionality have unique id
687
+ *
688
+ * like "cardNumber" or "cardCvv" or "card"
689
+ * cardNumber - only card number
690
+ * cardCvv - only card cvv
691
+ * card - combined field with cardNumber/cvv and expiration
692
+ *
693
+ *
694
+ * To get the info about supported fields please take a look at
695
+ *
696
+ * This is not the api-fields, this is the UI fields,
697
+ * But, the fields list based on the API (card -> number + expiration + month)
698
+ *
699
+ * https://rebilly.github.io/RebillyAPI/#operation/PostToken
700
+ */
701
+ export declare const FIELD_TYPES: {
702
+ card: string;
703
+ cardNumber: string;
704
+ khelocardNumber: string;
705
+ cardExpiration: string;
706
+ cardExpirationMonth: string;
707
+ cardExpirationYear: string;
708
+ cardCvv: string;
709
+ bban: string;
710
+ bbanAccountType: string;
711
+ bbanAccountNumber: string;
712
+ bbanRoutingNumber: string;
713
+ bbanBic: string;
714
+ bbanBankName: string;
715
+ iban: string;
716
+ ibanNumber: string;
717
+ ibanBic: string;
718
+ ibanBankName: string;
719
+ cardExpirationMonthList: string;
720
+ cardExpirationYearList: string;
721
+ digitalWallet: string;
722
+ applePay: string;
723
+ googlePay: string;
724
+ samsungPay: string;
725
+ paypal: string;
726
+ plaid: string;
727
+ klarna: string;
728
+ secondary: string;
729
+ };
730
+
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
+ export declare type FieldError = string | FramepayError;
741
+
742
+ /**
743
+ * Structure defining a message sent from a field instance to its mounting element.
744
+ * Used as the content of a Message sent with postMessage.
745
+ */
746
+ export declare class FieldNotification {
747
+ static TYPES: {
748
+ readonly focus: "focus";
749
+ readonly error: "error";
750
+ readonly valid: "valid";
751
+ readonly blur: "blur";
752
+ readonly ready: "ready";
753
+ readonly autoFillStart: "auto-fill-start";
754
+ readonly autoFillCancel: "auto-fill-cancel";
755
+ };
756
+ type: FieldNotificationType;
757
+ content: NotificationContent | FieldError;
758
+ constructor({ type, content }: NotificationArgs);
759
+ }
760
+
761
+ export declare type FieldNotificationType = ValueOf<typeof FieldNotification.TYPES>;
762
+
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
+ export declare type FieldType = 'googlePay' | 'applePay' | 'plaid' | 'paypal' | 'klarna';
783
+
784
+ export declare interface FieldValidationParams {
785
+ form?: HTMLFormElement;
786
+ from?: string;
787
+ force?: boolean;
788
+ source?: keyof typeof FIELD_TYPES;
789
+ card?: {
790
+ panType: null | string;
791
+ };
792
+ }
793
+
794
+ export declare class FramePay {
795
+ ControllerFrame: typeof ControllerFrame;
796
+ getPlugins: (configuration: Configuration) => PluginsManager;
797
+ controllerFrame: ControllerFrame | null;
798
+ authorizationToken: string;
799
+ version: string;
800
+ initialized: boolean;
801
+ framepayBus: EmitterInstance;
802
+ eventsCache: ReturnType<typeof EventsCache>;
803
+ plugins: PluginsManager;
804
+ locales: Record<string, string>;
805
+ errorCodes: {
806
+ initialized: string;
807
+ notInitialized: string;
808
+ noAPIKey: string;
809
+ badAPIKey: string;
810
+ invalidJwt: string;
811
+ multipleAuthorizationTokens: string;
812
+ mountPointNotFound: string;
813
+ networkError: string;
814
+ alreadyMounted: string;
815
+ invalidTokenForm: string;
816
+ unexpectedError: string;
817
+ apiError: string;
818
+ nonExistingAPIKey: string;
819
+ apiValidation: string;
820
+ nameRequired: string;
821
+ declinedBrandMessageTwoAlternatives: string;
822
+ declinedBrandMessageMultipleAlternatives: string;
823
+ organizationIdMissing: string;
824
+ transactionDataMissing: string;
825
+ merchantDataMissing: string;
826
+ unsupportedCardNetwork: string;
827
+ notReadyToPay: string;
828
+ googlePayDisplayOptions: string;
829
+ applePayDisplayOptions: string;
830
+ samsungPayDisplayOptions: string;
831
+ paypalDisplayOptions: string;
832
+ googlePay: string;
833
+ applePay: string;
834
+ samsungPay: string;
835
+ paypal: string;
836
+ plaid: string;
837
+ klarna: string;
838
+ invalidCountryCode: string;
839
+ invalidCurrencyCode: string;
840
+ invalidPaymentCard: string;
841
+ incompleteCvv: string;
842
+ invalidCardNumber: string;
843
+ invalidExpirationYearInPast: string;
844
+ invalidExpirationYearInFuture: string;
845
+ invalidExpirationMonth: string;
846
+ invalidExpiration: string;
847
+ unsupportedCardBin: string;
848
+ unsupportedCardBrand: string;
849
+ unavailableCardBrand: string;
850
+ invalidBbanAccount: string;
851
+ incompleteRoutingNumber: string;
852
+ invalidLengthRoutingNumber: string;
853
+ incompleteAccountNumber: string;
854
+ invalidLengthAccountNumber: string;
855
+ invalidMaxLengthAccountNumber: string;
856
+ invalidIBANNumber: string;
857
+ invalidIBANCountry: string;
858
+ unsupportedIBANCountry: string;
859
+ incompleteIBANNumber: string;
860
+ invalidCustomerFormValues: string;
861
+ invalidMethodsConfiguration: string;
862
+ unservicableShippingAddress: string;
863
+ };
864
+ setInitializedToFalseOnError: ({ code }: {
865
+ code: string;
866
+ }) => void;
867
+ card: Card;
868
+ bban: Bban;
869
+ iban: Iban;
870
+ googlePay: GooglePay;
871
+ applePay: ApplePay;
872
+ paypal: PayPal;
873
+ samsungPay: SamsungPay;
874
+ plaid: Plaid;
875
+ klarna: Klarna;
876
+ bankAccount: Bban;
877
+ constructor({ ControllerFrame, Card, Bban, Iban, GooglePay, ApplePay, SamsungPay, PayPal, Plaid, Klarna, getPlugins, ApplePayValidationRequest, }: FramepayParams);
878
+ /**
879
+ * Initialize FramePay and inject a controller in the page.
880
+ */
881
+ initialize({ publishableKey, jwt, ...configuration }?: FramepayInitializeParams): Promise<void>;
882
+ private manageRemoteFramesLoadingEvents;
883
+ private manageGooglePayTokenResult;
884
+ private manageBillingEvent;
885
+ private manageShippingEvents;
886
+ /**
887
+ * Trigger an update of current and future mounted element configuration.
888
+ */
889
+ update(configuration?: RawConfiguration): Promise<void>;
890
+ /**
891
+ * Create a token for the provided form and elements within (card, bban account, etc.).
892
+ */
893
+ createToken(form: Element | object | null, { xsrfToken, ...extraData }?: {
894
+ xsrfToken?: string;
895
+ } & ExtraData): Promise<TokenData>;
896
+ /**
897
+ * Subscribe to a global event
898
+ * @param eventType The event type to subscribe to
899
+ * @param delegate The delegate to run when the event is fired
900
+ */
901
+ on<T extends keyof FramepayEventMap>(eventType: T, delegate: (...args: FramepayEventMap[T]) => void): void;
902
+ /**
903
+ * Unsubscribe from a global event
904
+ * @param eventType The event type to unsubscribe from
905
+ * @param delegate The delegate to unsubscribe
906
+ */
907
+ off<T extends keyof FramepayEventMap>(eventType: T, delegate: (...args: FramepayEventMap[T]) => void): void;
908
+ }
909
+
910
+ export declare interface FramepayError {
911
+ code: string;
912
+ type?: string;
913
+ message?: string;
914
+ details?: string | string[];
915
+ invalidFields?: InvalidField[];
916
+ }
917
+
918
+ export declare interface FramepayEventMap {
919
+ ready: [];
920
+ error: [FramepayError];
921
+ 'token-ready': [TokenData, ExtraData];
922
+ 'shipping-address-changed': Parameters<ShippingAddressChangedHandler>;
923
+ 'shipping-option-changed': Parameters<ShippingOptionsChangedHandler>;
924
+ 'billing-address-changed': Parameters<BillingAddressChangedHandler>;
925
+ }
926
+
927
+ export declare interface FramepayInitializeParams extends RawConfiguration {
928
+ publishableKey?: string;
929
+ jwt?: string;
930
+ }
931
+
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
+ export declare type FramepayStyleValue = string | boolean | null;
948
+
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
+ export declare class GooglePay extends PaymentMethod {
976
+ GooglePayMarkIcon: string;
977
+ mount(target: HTMLElement | string): GooglePayElement;
978
+ }
979
+
980
+ export declare interface GooglePayConfig {
981
+ buttonColor?: google.payments.api.ButtonColor | null;
982
+ buttonHeight?: string | null;
983
+ buttonLocale?: string | null;
984
+ buttonSizeMode?: google.payments.api.ButtonSizeMode | null;
985
+ buttonType?: google.payments.api.ButtonType | null;
986
+ shippingAddressRequired?: boolean;
987
+ }
988
+
989
+ /**
990
+ * Abstraction layer for the base element set to become a Google Pay field.
991
+ * Used to hide the internal implementation.
992
+ */
993
+ 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;
1008
+ mount(): void;
1009
+ unmount(): void;
1010
+ destroy(): void;
1011
+ on(eventType: never, _delegate: never): void;
1012
+ }
1013
+
1014
+ export declare type GooglePayToken = object;
1015
+
1016
+ export declare interface GooglePayTransactionContent {
1017
+ tokenData: GooglePayToken;
1018
+ transactionData: {
1019
+ amount: number;
1020
+ currency: string;
1021
+ countryCode: string;
1022
+ label: string;
1023
+ };
1024
+ shipping: {
1025
+ address: google.payments.api.Address;
1026
+ option: google.payments.api.SelectionOptionData;
1027
+ };
1028
+ email: string;
1029
+ }
1030
+
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
+ export declare interface I18nConfig {
1053
+ [locale: string]: {
1054
+ validations: Partial<I18nValidations>;
1055
+ };
1056
+ }
1057
+
1058
+ export declare interface I18nValidations {
1059
+ 'declined-brand-multiple-alternatives': string | null;
1060
+ 'declined-brand-two-alternatives': string | null;
1061
+ 'fullname-required': string | null;
1062
+ 'incomplete-account-number': string | null;
1063
+ 'incomplete-cvv': string | null;
1064
+ 'incomplete-iban-number': string | null;
1065
+ 'incomplete-routing-number': string | null;
1066
+ 'invalid-bban-account': string | null;
1067
+ 'invalid-expiration': string | null;
1068
+ 'invalid-expiration-month': string | null;
1069
+ 'invalid-expiration-year-in-future': string | null;
1070
+ 'invalid-expiration-year-in-past': string | null;
1071
+ 'invalid-iban-country': string | null;
1072
+ 'invalid-iban-number': string | null;
1073
+ 'invalid-length-account-number': string | null;
1074
+ 'invalid-length-routing-number': string | null;
1075
+ 'invalid-max-length-account-number': string | null;
1076
+ 'invalid-number': string | null;
1077
+ 'invalid-payment-card': string | null;
1078
+ 'unavailable-card-brand': string | null;
1079
+ 'unexpected-error': string | null;
1080
+ 'unservicable-shipping-address': string | null;
1081
+ 'unsupported-card-bin': string | null;
1082
+ 'unsupported-iban-country': string | null;
1083
+ }
1084
+
1085
+ export declare class Iban extends PaymentMethod {
1086
+ mount(target: HTMLElement | string, fieldType?: IbanFieldType): IbanElement;
1087
+ }
1088
+
1089
+ /**
1090
+ * Abstraction layer for the base element set to become a bban account field.
1091
+ * Used to hide the internal implementation.
1092
+ */
1093
+ 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;
1109
+ mount(): void;
1110
+ unmount(): void;
1111
+ destroy(): void;
1112
+ on<T extends keyof BaseElementEventMap>(eventType: T, delegate: (...args: BaseElementEventMap[T]) => void): void;
1113
+ }
1114
+
1115
+ export declare interface IbanElementParams {
1116
+ element: HTMLElement;
1117
+ fieldType: string;
1118
+ sourceReplaceNames: IbanElementSourceReplaceNames;
1119
+ controllerFrame: ControllerFrame;
1120
+ }
1121
+
1122
+ export declare type IbanElementSourceReplaceNames = Partial<typeof PUBLIC_FIELD_SOURCE_NAMES_REPLACE_MAP.iban>;
1123
+
1124
+ export declare type IbanFieldType = keyof IbanSourceMap | 'iban';
1125
+
1126
+ export declare type IbanSourceMap = Partial<typeof PUBLIC_FIELD_SOURCE_NAMES_REPLACE_MAP.iban>;
1127
+
1128
+ export declare interface IconConfig {
1129
+ display?: boolean;
1130
+ color?: string;
1131
+ }
1132
+
1133
+ export declare interface InvalidField {
1134
+ field?: string;
1135
+ message: string;
1136
+ }
1137
+
1138
+ export declare class Klarna extends PaymentMethod {
1139
+ mount(target?: HTMLElement | string): KlarnaElement;
1140
+ }
1141
+
1142
+ export declare interface KlarnaConfig {
1143
+ clientToken: string;
1144
+ sessionId: string;
1145
+ }
1146
+
1147
+ export declare class KlarnaElement {
1148
+ #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>;
1163
+ mount(): void;
1164
+ onUpdateConfiguration(): Promise<void>;
1165
+ unmount(): void;
1166
+ on(eventType: never): void;
1167
+ }
1168
+
1169
+ export declare type LeadSource = coreComponents['schemas']['LeadSource'];
1170
+
1171
+ export declare type LeadSourceResult = {
1172
+ leadSource: LeadSource;
1173
+ };
1174
+
1175
+ export declare interface LineItem {
1176
+ label: string;
1177
+ amount: string;
1178
+ status?: string;
1179
+ }
1180
+
1181
+ export declare function loadFramepay({ scriptLink, styleLink, }?: Partial<Options>): Promise<FramePay>;
1182
+
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
+ export declare interface NotificationArgs {
1260
+ type: FieldNotificationType;
1261
+ content?: NotificationContent | FieldError;
1262
+ }
1263
+
1264
+ export declare interface NotificationContent {
1265
+ completed: boolean;
1266
+ details: string[];
1267
+ message: string;
1268
+ }
1269
+
1270
+ declare interface Options {
1271
+ scriptLink?: string;
1272
+ styleLink?: string;
1273
+ }
1274
+
1275
+ export declare class PaymentMethod {
1276
+ protected parent: FramePay;
1277
+ protected options: PaymentMethodOptions;
1278
+ constructor(framePay: FramePay, options?: PaymentMethodOptions);
1279
+ /**
1280
+ * Find target HTML element
1281
+ */
1282
+ static findTarget(target?: HTMLElement | string): HTMLElement;
1283
+ }
1284
+
1285
+ export declare interface PaymentMethodOptions {
1286
+ isBankAccountOldField?: boolean;
1287
+ }
1288
+
1289
+ export declare class PayPal extends PaymentMethod {
1290
+ mount(target?: HTMLElement | string, { extraData }?: {
1291
+ extraData?: ExtraPayPalConfigs;
1292
+ }): PayPalElement;
1293
+ }
1294
+
1295
+ export declare interface PaypalConfig {
1296
+ buttonColor?: string;
1297
+ buttonHeight?: string | number;
1298
+ buttonShape?: string;
1299
+ }
1300
+
1301
+ export declare class PayPalElement {
1302
+ #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>;
1312
+ mount(): void;
1313
+ onUpdateConfiguration(): Promise<void>;
1314
+ unmount(): void;
1315
+ destroy(): void;
1316
+ on(eventType: never, _delegate: never): void;
1317
+ }
1318
+
1319
+ export declare interface PayPalElementConstructorArgs {
1320
+ element: HTMLElement;
1321
+ controllerFrame: ControllerFrame;
1322
+ extraData: ExtraPayPalConfigs;
1323
+ framepayBus: EmitterInstance;
1324
+ }
1325
+
1326
+ export declare interface PlaceholdersConfig {
1327
+ bban?: BbanConfig;
1328
+ bankAccount?: BbanConfig;
1329
+ card?: {
1330
+ number?: string | null;
1331
+ expiration?: string | null;
1332
+ cvv?: string | null;
1333
+ expirationSeparator?: string | null;
1334
+ expirationMonth?: string | null;
1335
+ expirationYear?: string | null;
1336
+ expiry?: string | null;
1337
+ expiryMoth?: string | null;
1338
+ expiryYear?: string | null;
1339
+ expirySeparator?: string | null;
1340
+ };
1341
+ iban?: {
1342
+ bicTitle?: string | null;
1343
+ bicPlaceholder?: string | null;
1344
+ bankNameTitle?: string | null;
1345
+ bankNamePlaceholder?: string | null;
1346
+ accountNumber?: string | null;
1347
+ };
1348
+ }
1349
+
1350
+ export declare interface PlaceholderStyleConfig extends BaseStyleDeclaration {
1351
+ wordSpacing?: FramepayStyleValue;
1352
+ opacity?: FramepayStyleValue;
1353
+ content?: FramepayStyleValue;
1354
+ }
1355
+
1356
+ export declare class Plaid extends PaymentMethod {
1357
+ mount(target: HTMLElement | string, { form, extraData }: PlaidOptions): PlaidElement;
1358
+ }
1359
+
1360
+ export declare class PlaidElement {
1361
+ #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;
1373
+ mount(): void;
1374
+ onUpdateConfiguration(): Promise<void>;
1375
+ unmount(): void;
1376
+ destroy(): void;
1377
+ on(eventType: never, _delegate: never): void;
1378
+ }
1379
+
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
+ export declare interface PlaidOptions {
1394
+ form: HTMLElement;
1395
+ extraData?: ExtraData;
1396
+ }
1397
+
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
+ export declare interface PostArgs {
1441
+ data: object;
1442
+ organizationId: string;
1443
+ authorizationToken: string;
1444
+ xsrfToken?: string;
1445
+ sandbox: boolean;
1446
+ }
1447
+
1448
+ export declare type PostTokenData = object;
1449
+
1450
+ export declare interface PrepareDigitalWalletPayloadArgs {
1451
+ transactionData?: {
1452
+ amount: number;
1453
+ currency: string;
1454
+ label: string;
1455
+ };
1456
+ riskMetadata?: RiskMetadata;
1457
+ leadSource?: LeadSource;
1458
+ googlePayToken?: GooglePayToken;
1459
+ payPalMerchantSessionId?: string;
1460
+ tokenData?: PostTokenData;
1461
+ formData?: {
1462
+ billingAddress?: object;
1463
+ };
1464
+ fieldType: FieldType;
1465
+ }
1466
+
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
+ export declare const PUBLIC_FIELD_SOURCE_NAMES_REPLACE_MAP: {
1497
+ bankAccount: {
1498
+ bankAccountType: string;
1499
+ bankAccountNumber: string;
1500
+ bankRoutingNumber: string;
1501
+ bic: string;
1502
+ bankName: string;
1503
+ };
1504
+ bban: {
1505
+ accountType: string;
1506
+ accountNumber: string;
1507
+ routingNumber: string;
1508
+ bic: string;
1509
+ bankName: string;
1510
+ };
1511
+ iban: {
1512
+ bic: string;
1513
+ bankName: string;
1514
+ };
1515
+ digitalWallet: {
1516
+ applePay: string;
1517
+ googlePay: string;
1518
+ samsungPay: string;
1519
+ };
1520
+ };
1521
+
1522
+ export declare interface RawConfiguration {
1523
+ publishableKey?: string;
1524
+ applePay?: ApplePayConfig;
1525
+ bankAccount?: unknown;
1526
+ bban?: unknown;
1527
+ card?: CardConfig;
1528
+ classes?: ClassesConfig;
1529
+ googlePay?: GooglePayConfig;
1530
+ i18n?: I18nConfig;
1531
+ icon?: IconConfig;
1532
+ isParamountBankAccount?: boolean;
1533
+ kountAccountId?: string;
1534
+ locale?: string;
1535
+ methods?: 'auto' | ReadyToPayObject[];
1536
+ organizationId?: string;
1537
+ paypal?: PaypalConfig;
1538
+ placeholders?: PlaceholdersConfig;
1539
+ sandbox?: boolean;
1540
+ style?: StyleConfig;
1541
+ transactionData?: TransactionData;
1542
+ websiteId?: string;
1543
+ samsungPay?: SamsungPayConfig;
1544
+ }
1545
+
1546
+ export declare interface ReadyToPayObject {
1547
+ method: string;
1548
+ filters?: string[];
1549
+ brands?: string[];
1550
+ feature?: Record<string, string>;
1551
+ }
1552
+
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
+ export declare interface RiskMetadata {
1595
+ browserData?: {
1596
+ colorDepth: string;
1597
+ isJavaEnabled: string;
1598
+ language: string;
1599
+ screenHeight: string;
1600
+ screenWidth: string;
1601
+ timeZoneOffset: string;
1602
+ };
1603
+ extraData?: {
1604
+ kountFraudSessionId?: string;
1605
+ payPalMerchantSessionId?: string;
1606
+ };
1607
+ fingerprint?: string;
1608
+ }
1609
+
1610
+ export declare type RuntimeDelegate<T> = (externalPayload: ExternalPayload) => T | Promise<T>;
1611
+
1612
+ export declare class SamsungPay extends PaymentMethod {
1613
+ mount(target: HTMLElement | string): SamsungPayElement;
1614
+ }
1615
+
1616
+ export declare interface SamsungPayConfig {
1617
+ buttonColor?: 'white' | 'black';
1618
+ }
1619
+
1620
+ 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>;
1638
+ mount(): void;
1639
+ unmount(): void;
1640
+ destroy(): void;
1641
+ onUpdateConfiguration(): Promise<void>;
1642
+ on(): void;
1643
+ }
1644
+
1645
+ export declare type SamsungPayElementConfig = ReturnType<typeof makeSamsungPayConfig>;
1646
+
1647
+ export declare interface SelectionStyleConfig {
1648
+ background?: FramepayStyleValue;
1649
+ backgroundColor?: FramepayStyleValue;
1650
+ color?: FramepayStyleValue;
1651
+ textShadow?: FramepayStyleValue;
1652
+ }
1653
+
1654
+ export declare type ShippingAddressChangedHandler = (shippingData: AddressData, updateTransaction: (newTransactionData: ShippingAddressUpdatableTransactionData) => void) => void;
1655
+
1656
+ export declare interface ShippingAddressUpdatableTransactionData extends Partial<UpdateableTransactionData> {
1657
+ status: 'success' | 'fail';
1658
+ shippingOptions?: ShippingOptionItem[];
1659
+ }
1660
+
1661
+ export declare interface ShippingData {
1662
+ id: string;
1663
+ label: string;
1664
+ description: string;
1665
+ amount: number;
1666
+ }
1667
+
1668
+ export declare interface ShippingOptionItem {
1669
+ id: string;
1670
+ label: string;
1671
+ description: string;
1672
+ amount: number;
1673
+ }
1674
+
1675
+ export declare interface ShippingOptions {
1676
+ defaultSelectedOptionId?: string | null;
1677
+ options?: ShippingOptionItem[];
1678
+ shippingOptionParameters?: {
1679
+ defaultSelectedOptionId: string | null;
1680
+ shippingOptions: ShippingOptionItem[];
1681
+ };
1682
+ }
1683
+
1684
+ export declare type ShippingOptionsChangedHandler = (shippingData: ShippingData, updateTransaction: (newTransactionData: UpdateableTransactionData) => void) => void;
1685
+
1686
+ export declare interface ShippingUpdateShippingData {
1687
+ amount?: string;
1688
+ countryCode?: string;
1689
+ postalCode?: string;
1690
+ locality?: string;
1691
+ administrativeArea?: string;
1692
+ }
1693
+
1694
+ export declare interface StyleConfig {
1695
+ base?: StyleDeclaration;
1696
+ focus?: StyleDeclaration;
1697
+ valid?: StyleDeclaration;
1698
+ invalid?: StyleDeclaration;
1699
+ buttons?: ButtonStyleConfig;
1700
+ }
1701
+
1702
+ export declare interface StyleDeclaration extends BaseStyleDeclaration {
1703
+ ':focus'?: BaseStyleDeclaration;
1704
+ ':hover'?: BaseStyleDeclaration;
1705
+ ':disabled'?: BaseStyleDeclaration;
1706
+ ':webkitAutofill'?: WebskitAutofillStyleConfig;
1707
+ '::placeholder'?: PlaceholderStyleConfig;
1708
+ '::selection'?: SelectionStyleConfig;
1709
+ }
1710
+
1711
+ /**
1712
+ * Public FramePay constant Framepay.card.Brands
1713
+ */
1714
+ export declare const SupportedCardBrands: Record<string, string>;
1715
+
1716
+ export declare const supportedExtraPayPalConfigs: string[];
1717
+
1718
+ export declare interface TokenData {
1719
+ id: string;
1720
+ paymentInstrument: object;
1721
+ }
1722
+
1723
+ export declare class TokenRequest {
1724
+ /**
1725
+ * Post to the `/tokens` endpoint with the provided data and return a Promise
1726
+ * that will resolve with the response data or reject with the error object.
1727
+ *
1728
+ * @param sandbox define whether the request is to be triggered in sandbox mode
1729
+ */
1730
+ post({ data, authorizationToken, organizationId, xsrfToken, sandbox, }: {
1731
+ data: TokenRequestPayload & {
1732
+ [key: string]: any;
1733
+ };
1734
+ authorizationToken: string;
1735
+ organizationId: string;
1736
+ xsrfToken: string;
1737
+ sandbox: boolean;
1738
+ }): Promise<TokenData>;
1739
+ }
1740
+
1741
+ export declare interface TokenRequestPayload {
1742
+ method?: string;
1743
+ paymentInstrument?: {
1744
+ type?: string;
1745
+ amount?: string;
1746
+ currency?: string;
1747
+ descriptor?: string;
1748
+ payload?: PostTokenData;
1749
+ expMonth?: string;
1750
+ expYear?: string;
1751
+ };
1752
+ billingAddress?: reportsComponents['schemas']['ContactObject'];
1753
+ riskMetadata?: RiskMetadata;
1754
+ leadSource?: LeadSource;
1755
+ cardExpiry?: {
1756
+ expMonth?: string;
1757
+ expYear?: string;
1758
+ };
1759
+ }
1760
+
1761
+ export declare interface TransactionData {
1762
+ amount: number | null;
1763
+ currency: string | null;
1764
+ label?: string | null;
1765
+ requestShipping?: boolean;
1766
+ shippingOptions?: ShippingOptions;
1767
+ lineItems?: LineItem[];
1768
+ }
1769
+
1770
+ export declare interface UpdateableTransactionData {
1771
+ amount: number;
1772
+ lineItems?: LineItem[];
1773
+ }
1774
+
1775
+ export declare type ValueOf<T> = T[keyof T];
1776
+
1777
+ export declare interface WebskitAutofillStyleConfig {
1778
+ fontSize?: FramepayStyleValue;
1779
+ webkitTextFillColor?: FramepayStyleValue;
1780
+ }
1781
+
1782
+ export { }
1783
+
1784
+
1785
+ declare global {
1786
+ interface Window {
1787
+ Rebilly: FramePay;
1788
+ Framepay: FramePay;
1789
+ }
1790
+ }