@payrails/web-sdk 5.18.2 → 5.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payrails/web-sdk",
3
- "version": "5.18.2",
3
+ "version": "5.20.0",
4
4
  "description": "SDK providing tokenization options on the client for merchants",
5
5
  "main": "index.js",
6
6
  "types": "payrails.d.ts",
package/payrails.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as _payrails_iframe_event_bus from '@payrails/iframe-event-bus';
1
2
  import { LogLevel as LogLevel$1 } from '@payrails/logger';
2
3
  import { FraudProvider } from '@payrails/fraud-sdk';
3
4
 
@@ -70,6 +71,7 @@ declare class WorkflowExecution {
70
71
  static get authorizeLink(): string | undefined;
71
72
  static get createSessionLink(): string | undefined;
72
73
  static get storedPaymentInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
74
+ static get storedDropinInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
73
75
  static getFullPaymentMethodConfig(paymentMethod: PAYMENT_METHOD_CODES): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined> | undefined;
74
76
  static isPaymentInstallmentsEnabled(paymentMethod: PAYMENT_METHOD_CODES): boolean | undefined;
75
77
  static getPaymentInstallmentOptions(paymentMethod: PAYMENT_METHOD_CODES): PaymentInstallmentsConfig;
@@ -515,6 +517,7 @@ declare class PayrailsElement implements Mountable {
515
517
  protected element: HTMLElement;
516
518
  protected subElements: Array<Mountable>;
517
519
  readonly id: string | undefined;
520
+ protected eventBus: _payrails_iframe_event_bus.IframeEventBus;
518
521
  constructor(elementType: string, { id, className }?: ElementOptions);
519
522
  get parentElement(): HTMLElement | null;
520
523
  get selector(): string;
@@ -523,6 +526,92 @@ declare class PayrailsElement implements Mountable {
523
526
  unmount(): void;
524
527
  }
525
528
 
529
+ declare enum ElementType {
530
+ CARD_NUMBER = "CARD_NUMBER",
531
+ CARDHOLDER_NAME = "CARDHOLDER_NAME",
532
+ CVV = "CVV",
533
+ EXPIRATION_MONTH = "EXPIRATION_MONTH",
534
+ EXPIRATION_YEAR = "EXPIRATION_YEAR",
535
+ EXPIRATION_DATE = "EXPIRATION_DATE"
536
+ }
537
+
538
+ interface EncryptedCollectResult {
539
+ vaultProviderConfigId: string;
540
+ encryptedData: string;
541
+ }
542
+ interface CollectElementOptions {
543
+ type: ElementType;
544
+ label?: string;
545
+ placeholder?: string;
546
+ altText?: string;
547
+ format?: string;
548
+ inputStyles?: object;
549
+ labelStyles?: object;
550
+ errorTextStyles?: object;
551
+ required?: boolean;
552
+ enableCardIcon?: boolean;
553
+ }
554
+ type PayrailsContainerType = 'COLLECT' | 'COMPOSABLE';
555
+ interface CollectContainerOptions {
556
+ layout?: number[];
557
+ cardTableName?: string;
558
+ containerType?: PayrailsContainerType;
559
+ styles?: {
560
+ base?: Partial<CSSStyleDeclaration>;
561
+ };
562
+ errorTextStyles?: {
563
+ base?: Partial<CSSStyleDeclaration>;
564
+ };
565
+ }
566
+ type PayrailsSecureFieldEvent = 'CHANGE' | 'FOCUS' | 'BLUR' | 'READY' | 'SUBMIT';
567
+ interface PayrailsSecureField {
568
+ on(eventName: PayrailsSecureFieldEvent, handler: any): void;
569
+ mount?: (domElement: any) => void;
570
+ unmount?: () => void;
571
+ getState?: () => {
572
+ isEmpty: boolean;
573
+ isComplete: boolean;
574
+ isValid: boolean;
575
+ isFocused: boolean;
576
+ value: unknown;
577
+ required: boolean;
578
+ };
579
+ isValidElement?: () => boolean;
580
+ setError?: (clientErrorText: string) => void;
581
+ resetError?: () => void;
582
+ setValue?: (elementValue: string) => void;
583
+ clearValue?: () => void;
584
+ }
585
+ declare class PayrailsCollectContainer implements Mountable {
586
+ bin: string;
587
+ isBinLookupEnabled: boolean;
588
+ readonly id = "payrails-container-wrapper";
589
+ private static instance;
590
+ private readonly __container;
591
+ private element;
592
+ private readonly cardTableName;
593
+ private readonly containerType;
594
+ constructor(__client: Skyflow, options: CollectContainerOptions);
595
+ static init(vaultClient: Skyflow, options: CollectContainerOptions): PayrailsCollectContainer;
596
+ createCollectElement(options: CollectElementOptions): PayrailsSecureField;
597
+ mount(selector: string): void;
598
+ unmount(): void;
599
+ collect(): Promise<EncryptedCollectResult>;
600
+ private collectPayrailsData;
601
+ tokenize(opts: TokenizeOptions): Promise<SaveInstrumentResponse>;
602
+ private constructSaveInstrumentBody;
603
+ private attachCustomEventHandler;
604
+ private formatBin;
605
+ private get elementToFieldMap();
606
+ fetchBinLookup: (bin: string) => Promise<string | BinLookupResponse | {
607
+ bin: string;
608
+ }>;
609
+ }
610
+ interface TokenizeOptions {
611
+ futureUsage?: 'CardOnFile' | 'Subscription' | 'UnscheduledCardOnFile';
612
+ storeInstrument?: boolean;
613
+ }
614
+
526
615
  interface IAddress {
527
616
  country?: {
528
617
  code?: string;
@@ -564,65 +653,6 @@ interface AddressSelectorElementOptions extends ElementOptions {
564
653
  };
565
654
  }
566
655
 
567
- interface StoreInstrumentElementOptions extends ElementOptions {
568
- showStoreInstrumentCheckbox?: boolean;
569
- alwaysStoreInstrument?: boolean;
570
- translations?: {
571
- labels?: {
572
- storeInstrument?: string;
573
- saveInstrument?: string;
574
- };
575
- };
576
- styles?: {
577
- storeInstrumentCheckbox?: Partial<CSSStyleDeclaration>;
578
- };
579
- events?: PayrailsSDKEvents;
580
- }
581
- declare class StoreInstrumentCheckbox extends PayrailsElement {
582
- private options;
583
- constructor(options: StoreInstrumentElementOptions);
584
- get isChecked(): boolean;
585
- private createHTML;
586
- private applyStyles;
587
- private addListeners;
588
- }
589
- declare abstract class PayrailsElementWithStoreInstrumentCheckbox extends PayrailsElement {
590
- protected options?: StoreInstrumentElementOptions | undefined;
591
- protected storeInstrumentCheckbox: StoreInstrumentCheckbox | null;
592
- protected constructor(elementType: string, options?: StoreInstrumentElementOptions | undefined);
593
- protected get shouldStoreInstrument(): boolean;
594
- }
595
-
596
- interface ApplePayButtonOptions extends StoreInstrumentElementOptions {
597
- clientDomain?: string;
598
- showPaymentMethodLogo?: boolean;
599
- events?: PaymentEvents & {
600
- onApplePayAvailable?: () => void;
601
- };
602
- styles?: {
603
- type?: 'plain' | 'buy' | 'addMoney' | 'book' | 'checkout' | 'continue' | 'contribute' | 'donate' | 'inStore' | 'order' | 'reload' | 'rent' | 'setUp' | 'subscribe' | 'support' | 'tip' | 'topUp';
604
- style?: 'white' | 'whiteOutline' | 'black' | 'automatic';
605
- } & StoreInstrumentElementOptions['styles'];
606
- }
607
- declare global {
608
- interface Window {
609
- ApplePaySession?: ApplePaySession;
610
- }
611
- }
612
- declare class ApplePayButton extends PayrailsElementWithStoreInstrumentCheckbox {
613
- private sdkConfig;
614
- protected options: ApplePayButtonOptions;
615
- private appleButton;
616
- private paymentExecutor;
617
- static isApplePayAvailable(): Promise<boolean>;
618
- constructor(sdkConfig: SdkConfiguration, options: ApplePayButtonOptions);
619
- mount(location: string): void;
620
- unmount(): void;
621
- private mountApplePayButton;
622
- private createApplePaySession;
623
- private onApplePayAuthorized;
624
- }
625
-
626
656
  declare const regexes: {
627
657
  visa: RegExp;
628
658
  mastercard: RegExp;
@@ -636,15 +666,6 @@ declare const regexes: {
636
666
  };
637
667
  type CardNetwork = keyof typeof regexes;
638
668
 
639
- declare enum ElementType {
640
- CARD_NUMBER = "CARD_NUMBER",
641
- CARDHOLDER_NAME = "CARDHOLDER_NAME",
642
- CVV = "CVV",
643
- EXPIRATION_MONTH = "EXPIRATION_MONTH",
644
- EXPIRATION_YEAR = "EXPIRATION_YEAR",
645
- EXPIRATION_DATE = "EXPIRATION_DATE"
646
- }
647
-
648
669
  interface PaymentInstallmentsElementOptions extends ElementOptions {
649
670
  showPaymentInstallmentsDropdown?: boolean;
650
671
  installmentOptions?: BaseInstallmentOption[] | null;
@@ -682,6 +703,35 @@ declare class PayrailsElementWithPaymentInstallmentsDropdown extends PayrailsEle
682
703
  setDisabled(state: boolean): void;
683
704
  }
684
705
 
706
+ interface StoreInstrumentElementOptions extends ElementOptions {
707
+ showStoreInstrumentCheckbox?: boolean;
708
+ alwaysStoreInstrument?: boolean;
709
+ translations?: {
710
+ labels?: {
711
+ storeInstrument?: string;
712
+ saveInstrument?: string;
713
+ };
714
+ };
715
+ styles?: {
716
+ storeInstrumentCheckbox?: Partial<CSSStyleDeclaration>;
717
+ };
718
+ events?: PayrailsSDKEvents;
719
+ }
720
+ declare class StoreInstrumentCheckbox extends PayrailsElement {
721
+ private options;
722
+ constructor(options: StoreInstrumentElementOptions);
723
+ get isChecked(): boolean;
724
+ private createHTML;
725
+ private applyStyles;
726
+ private addListeners;
727
+ }
728
+ declare abstract class PayrailsElementWithStoreInstrumentCheckbox extends PayrailsElement {
729
+ protected options?: StoreInstrumentElementOptions | undefined;
730
+ protected storeInstrumentCheckbox: StoreInstrumentCheckbox | null;
731
+ protected constructor(elementType: string, options?: StoreInstrumentElementOptions | undefined);
732
+ protected get shouldStoreInstrument(): boolean;
733
+ }
734
+
685
735
  interface OnChange {
686
736
  isValid: boolean;
687
737
  cardNetwork: CardNetwork | '';
@@ -751,8 +801,8 @@ declare class CardForm extends PayrailsElementWithStoreInstrumentCheckbox {
751
801
  get cardNetwork(): "" | "visa" | "mastercard" | "amex" | "diners" | "discover" | "jcb" | "hipercard" | "unionpay" | "maestro";
752
802
  onChange(): void;
753
803
  private updateInstallments;
754
- collectValues<T extends TokenizedCollectResult | EncryptedCollectResult = EncryptedCollectResult>(): Promise<{
755
- cardData: T;
804
+ collectValues(): Promise<{
805
+ cardData: EncryptedCollectResult;
756
806
  storeInstrument: boolean;
757
807
  selectedInstallment: number | undefined;
758
808
  enrollInstrumentToNetworkOffers: boolean;
@@ -788,6 +838,15 @@ declare class CardList extends PayrailsElement {
788
838
  reset(): void;
789
839
  }
790
840
 
841
+ interface InitOptions {
842
+ version: string;
843
+ data: string;
844
+ }
845
+ interface PayrailsAmount {
846
+ value: string;
847
+ currency: string;
848
+ }
849
+
791
850
  interface ReturnInfo {
792
851
  success?: string;
793
852
  cancel?: string;
@@ -820,7 +879,6 @@ interface CardPaymentButtonOptions {
820
879
  };
821
880
  }
822
881
  declare class CardPaymentButton extends PayrailsElement {
823
- private readonly sdkConfig;
824
882
  private readonly options;
825
883
  private readonly returnInfo?;
826
884
  selectedInstrument: StoredPaymentInstrument | null;
@@ -828,7 +886,7 @@ declare class CardPaymentButton extends PayrailsElement {
828
886
  get bin(): string | undefined;
829
887
  private readonly paymentExecutor;
830
888
  private cardForm;
831
- constructor(sdkConfig: SdkConfiguration, options: CardPaymentButtonOptions, returnInfo?: ReturnInfo | undefined);
889
+ constructor(options: CardPaymentButtonOptions, returnInfo?: ReturnInfo | undefined);
832
890
  setDisabled(isDisabled: boolean): void;
833
891
  setSavedCreditCard(savedCard: StoredPaymentInstrument<CardMetadata>): void;
834
892
  setSavedInstrument(savedInstrument: StoredPaymentInstrument): void;
@@ -840,7 +898,6 @@ declare class CardPaymentButton extends PayrailsElement {
840
898
  triggerLoading(isLoading: boolean): void;
841
899
  private onAuthorizationFailed;
842
900
  private onPay;
843
- private constructTokenizedPayment;
844
901
  private constructEncryptedPayment;
845
902
  private handleAuthorizationResult;
846
903
  }
@@ -851,6 +908,16 @@ declare enum AuthorizationFailureReasons {
851
908
  UNKNOWN_ERROR = "UNKNOWN_ERROR"
852
909
  }
853
910
 
911
+ interface AuthFailedMsgOptions {
912
+ translations?: {
913
+ label?: string;
914
+ };
915
+ styles?: Partial<CSSStyleDeclaration>;
916
+ configuration?: {
917
+ autoHideTTL?: number;
918
+ };
919
+ }
920
+
854
921
  interface GooglePayButtonOptions extends StoreInstrumentElementOptions {
855
922
  environment?: PayrailsEnvironment;
856
923
  merchantInfo?: google.payments.api.MerchantInfo;
@@ -867,14 +934,13 @@ interface GooglePayButtonOptions extends StoreInstrumentElementOptions {
867
934
  } & StoreInstrumentElementOptions['styles'];
868
935
  }
869
936
  declare class GooglePayButton extends PayrailsElementWithStoreInstrumentCheckbox {
870
- private sdkConfig;
871
937
  protected options: GooglePayButtonOptions;
872
938
  private googleButton;
873
939
  private readonly paymentExecutor;
874
940
  private static googleSDKClient;
875
941
  private static getSDKClient;
876
942
  static isGooglePayAvailable(allowedPaymentMethods: google.payments.api.IsReadyToPayPaymentMethodSpecification[], environment?: PayrailsEnvironment, merchantInfo?: google.payments.api.MerchantInfo): Promise<boolean>;
877
- constructor(sdkConfig: SdkConfiguration, options: GooglePayButtonOptions);
943
+ constructor(options: GooglePayButtonOptions);
878
944
  private sdkLoaded;
879
945
  private onLoadPaymentData;
880
946
  private authorize;
@@ -893,6 +959,28 @@ interface DropinElementStyles {
893
959
  active?: Partial<CSSStyleDeclaration>;
894
960
  }
895
961
 
962
+ interface ApplePayDropinOptions extends ApplePayButtonOptions {
963
+ translations?: {
964
+ labels?: {
965
+ label?: string;
966
+ storeInstrument?: string;
967
+ };
968
+ };
969
+ events?: ApplePayButtonOptions['events'] & DropinElementEvents;
970
+ styles?: DropinElementStyles & ApplePayButtonOptions['styles'];
971
+ }
972
+
973
+ interface CrediCardDropinOptions {
974
+ showPaymentMethodLogo?: boolean;
975
+ styles?: DropinElementStyles;
976
+ events?: DropinElementEvents;
977
+ translations?: {
978
+ labels?: {
979
+ label?: string;
980
+ };
981
+ } & CardFormOptions['translations'];
982
+ }
983
+
896
984
  interface ButtonOptions {
897
985
  id: string;
898
986
  events?: PayrailsSDKEvents & {
@@ -917,10 +1005,9 @@ interface GenericRedirectButtonOptions {
917
1005
  paymentMethod: BasePaymentMethodConfig;
918
1006
  }
919
1007
  declare class GenericRedirectButton extends PayrailsElement {
920
- private sdkConfig;
921
1008
  protected options: GenericRedirectButtonOptions;
922
1009
  private readonly returnInfo?;
923
- constructor(sdkConfig: SdkConfiguration, options: GenericRedirectButtonOptions, returnInfo?: ReturnInfo | undefined);
1010
+ constructor(options: GenericRedirectButtonOptions, returnInfo?: ReturnInfo | undefined);
924
1011
  private popup;
925
1012
  private buildRedirectButton;
926
1013
  private readonly paymentExecutor;
@@ -971,9 +1058,8 @@ interface PaypalButtonOptions extends StoreInstrumentElementOptions {
971
1058
  } & StoreInstrumentElementOptions['styles'];
972
1059
  }
973
1060
  declare class PaypalButton extends PayrailsElementWithStoreInstrumentCheckbox {
974
- private sdkConfig;
975
1061
  protected options?: PaypalButtonOptions | undefined;
976
- constructor(sdkConfig: SdkConfiguration, options?: PaypalButtonOptions | undefined);
1062
+ constructor(options?: PaypalButtonOptions | undefined);
977
1063
  fraudNetGuid: string | undefined;
978
1064
  private paymentExecutor;
979
1065
  private button;
@@ -985,6 +1071,7 @@ declare class PaypalButton extends PayrailsElementWithStoreInstrumentCheckbox {
985
1071
  private createPaypalButton;
986
1072
  private createPayPalButtonConfig;
987
1073
  private createBillingAgreementConfig;
1074
+ private onCancel;
988
1075
  private createOneTimeOrderConfig;
989
1076
  private createBaseConfig;
990
1077
  private createOneTimeOrder;
@@ -1009,14 +1096,13 @@ declare class Dropin extends PayrailsElement {
1009
1096
  private collectContainer;
1010
1097
  private readonly clientConfig;
1011
1098
  private readonly dropinConfig;
1012
- private readonly sdkConfig;
1013
1099
  private cardPaymentButton;
1014
1100
  private creditCard;
1015
1101
  private googlePay;
1016
1102
  private applePay;
1017
1103
  private cardForm;
1018
1104
  private paypal;
1019
- constructor(collectContainer: PayrailsCollectContainer, clientConfig: PayrailsClientOptions, dropinConfig: DropinOptions, sdkConfig: SdkConfiguration);
1105
+ constructor(collectContainer: PayrailsCollectContainer, clientConfig: PayrailsClientOptions, dropinConfig: DropinOptions);
1020
1106
  private isHppIntegration;
1021
1107
  private createStoredInstrumentElement;
1022
1108
  private createInstallmentsDropdown;
@@ -1067,7 +1153,7 @@ interface DropinOptions {
1067
1153
  [key: string]: any;
1068
1154
  googlePayButton?: GooglePayDropinOptions['translations'];
1069
1155
  cardPaymentButton?: CardPaymentButtonOptions['translations'];
1070
- cardForm?: CardFormOptions['translations'];
1156
+ cardForm?: CrediCardDropinOptions['translations'];
1071
1157
  paymentResult?: {
1072
1158
  success?: string;
1073
1159
  fail?: string;
@@ -1076,6 +1162,7 @@ interface DropinOptions {
1076
1162
  paypalButton?: PaypalDropinOptions['translations'];
1077
1163
  mercadoPago?: GenericRedirectDropinOptions['translations'];
1078
1164
  addressSelector?: AddressSelectorElementOptions['translations'];
1165
+ applePayButton?: ApplePayDropinOptions['translations'];
1079
1166
  };
1080
1167
  styles?: {
1081
1168
  [key: string]: any;
@@ -1091,6 +1178,9 @@ interface DropinOptions {
1091
1178
  addressSelector?: AddressSelectorElementOptions['styles'];
1092
1179
  mercadoPago?: GenericRedirectDropinOptions['styles'];
1093
1180
  };
1181
+ configuration?: {
1182
+ authFailMsg?: AuthFailedMsgOptions['configuration'];
1183
+ };
1094
1184
  }
1095
1185
  interface ContainerStyles {
1096
1186
  styles?: Partial<CSSStyleDeclaration>;
@@ -1135,9 +1225,7 @@ declare class FraudNet implements Mountable {
1135
1225
 
1136
1226
  interface PayrailsClientOptions {
1137
1227
  environment?: PayrailsEnvironment;
1138
- events?: {
1139
- onClientInitialized: (execution?: typeof WorkflowExecution) => void;
1140
- };
1228
+ events?: ClientEvents;
1141
1229
  redirectFor3DS?: boolean;
1142
1230
  returnInfo?: ReturnInfo;
1143
1231
  telemetry?: {
@@ -1146,7 +1234,6 @@ interface PayrailsClientOptions {
1146
1234
  };
1147
1235
  }
1148
1236
  declare class Payrails {
1149
- private sdkConfiguration;
1150
1237
  private vaultClient;
1151
1238
  private options?;
1152
1239
  private __container;
@@ -1183,9 +1270,9 @@ declare class Payrails {
1183
1270
  private getContainerLayout;
1184
1271
  binLookup(): Promise<any>;
1185
1272
  }
1186
- interface InitOptions {
1187
- version: string;
1188
- data: string;
1273
+ interface ClientEvents {
1274
+ onClientInitialized?: (execution?: typeof WorkflowExecution) => void;
1275
+ onSessionExpired?: () => Promise<InitOptions>;
1189
1276
  }
1190
1277
  interface PaymentEvents {
1191
1278
  onAuthorizeSuccess?: (e?: any) => void;
@@ -1214,129 +1301,38 @@ interface DropinEvents {
1214
1301
  onPaymentOptionSelected?: (e: onPaymentMethodSelectedParams) => void;
1215
1302
  }
1216
1303
  type PayrailsSDKEvents = PaymentEvents & UIEvents & DropinEvents;
1217
- interface SdkConfiguration {
1218
- token: string;
1219
- amount: PayrailsAmount;
1220
- holderReference: string;
1221
- usePayrailsFrames: boolean;
1222
- links?: {
1223
- binLookup?: {
1224
- method: 'GET' | 'POST';
1225
- href: string;
1226
- };
1227
- };
1228
- vaultConfiguration: {
1229
- cardTableName: string;
1230
- token: string;
1231
- vaultId: string;
1232
- vaultUrl: string;
1233
- providerId: string;
1234
- providerConfigId: string;
1235
- vaultType: 'Skyflow' | 'Payrails' | 'Test';
1236
- encryptionPublicKey?: string;
1237
- links: {
1238
- saveInstrument: {
1239
- href: string;
1240
- };
1241
- };
1242
- };
1243
- execution?: WorkflowExecutionResponse;
1244
- }
1245
- interface PayrailsAmount {
1246
- value: string;
1247
- currency: string;
1248
- }
1249
1304
  declare enum PayrailsEnvironment {
1250
1305
  TEST = "TEST",
1251
1306
  PRODUCTION = "PRODUCTION"
1252
1307
  }
1253
1308
 
1254
- type TokenizedCollectResult = {
1255
- skyflow_id?: string;
1256
- card_number?: string;
1257
- cardholder_name?: string;
1258
- expiry_month?: string;
1259
- expiry_year?: string;
1260
- security_code: string;
1261
- instrumentId?: string;
1262
- };
1263
- interface EncryptedCollectResult {
1264
- vaultProviderConfigId: string;
1265
- encryptedData: string;
1266
- }
1267
- interface CollectElementOptions {
1268
- type: ElementType;
1269
- label?: string;
1270
- placeholder?: string;
1271
- altText?: string;
1272
- format?: string;
1273
- inputStyles?: object;
1274
- labelStyles?: object;
1275
- errorTextStyles?: object;
1276
- required?: boolean;
1277
- enableCardIcon?: boolean;
1278
- }
1279
- type PayrailsContainerType = 'COLLECT' | 'COMPOSABLE';
1280
- interface CollectContainerOptions {
1281
- layout?: number[];
1282
- cardTableName?: string;
1283
- containerType?: PayrailsContainerType;
1284
- styles?: {
1285
- base?: Partial<CSSStyleDeclaration>;
1286
- };
1287
- errorTextStyles?: {
1288
- base?: Partial<CSSStyleDeclaration>;
1309
+ interface ApplePayButtonOptions extends StoreInstrumentElementOptions {
1310
+ clientDomain?: string;
1311
+ showPaymentMethodLogo?: boolean;
1312
+ events?: PaymentEvents & {
1313
+ onApplePayAvailable?: () => void;
1289
1314
  };
1315
+ styles?: {
1316
+ type?: 'plain' | 'buy' | 'addMoney' | 'book' | 'checkout' | 'continue' | 'contribute' | 'donate' | 'inStore' | 'order' | 'reload' | 'rent' | 'setUp' | 'subscribe' | 'support' | 'tip' | 'topUp';
1317
+ style?: 'white' | 'whiteOutline' | 'black' | 'automatic';
1318
+ } & StoreInstrumentElementOptions['styles'];
1290
1319
  }
1291
- type PayrailsSecureFieldEvent = 'CHANGE' | 'FOCUS' | 'BLUR' | 'READY' | 'SUBMIT';
1292
- interface PayrailsSecureField {
1293
- on(eventName: PayrailsSecureFieldEvent, handler: any): void;
1294
- mount?: (domElement: any) => void;
1295
- unmount?: () => void;
1296
- getState?: () => {
1297
- isEmpty: boolean;
1298
- isComplete: boolean;
1299
- isValid: boolean;
1300
- isFocused: boolean;
1301
- value: unknown;
1302
- required: boolean;
1303
- };
1304
- isValidElement?: () => boolean;
1305
- setError?: (clientErrorText: string) => void;
1306
- resetError?: () => void;
1307
- setValue?: (elementValue: string) => void;
1308
- clearValue?: () => void;
1320
+ declare global {
1321
+ interface Window {
1322
+ ApplePaySession?: ApplePaySession;
1323
+ }
1309
1324
  }
1310
- declare class PayrailsCollectContainer implements Mountable {
1311
- private sdkConfig;
1312
- bin: string;
1313
- isBinLookupEnabled: boolean;
1314
- readonly id = "payrails-container-wrapper";
1315
- private static instance;
1316
- private readonly __container;
1317
- private element;
1318
- private readonly cardTableName;
1319
- private readonly containerType;
1320
- constructor(__client: Skyflow, options: CollectContainerOptions, sdkConfig: SdkConfiguration);
1321
- static init(vaultClient: Skyflow, options: CollectContainerOptions, sdkConfig: SdkConfiguration): PayrailsCollectContainer;
1322
- createCollectElement(options: CollectElementOptions): PayrailsSecureField;
1323
- mount(selector: string): void;
1325
+ declare class ApplePayButton extends PayrailsElementWithStoreInstrumentCheckbox {
1326
+ protected options: ApplePayButtonOptions;
1327
+ private appleButton;
1328
+ private paymentExecutor;
1329
+ static isApplePayAvailable(): Promise<boolean>;
1330
+ constructor(options: ApplePayButtonOptions);
1331
+ mount(location: string): void;
1324
1332
  unmount(): void;
1325
- collect<T extends EncryptedCollectResult | TokenizedCollectResult = EncryptedCollectResult>(): Promise<T>;
1326
- private collectSkyflowData;
1327
- private collectPayrailsData;
1328
- tokenize(opts: TokenizeOptions): Promise<SaveInstrumentResponse>;
1329
- private constructSaveInstrumentBody;
1330
- private attachCustomEventHandler;
1331
- private formatBin;
1332
- private get elementToFieldMap();
1333
- fetchBinLookup: (bin: string) => Promise<string | BinLookupResponse | {
1334
- bin: string;
1335
- }>;
1336
- }
1337
- interface TokenizeOptions {
1338
- futureUsage?: 'CardOnFile' | 'Subscription' | 'UnscheduledCardOnFile';
1339
- storeInstrument?: boolean;
1333
+ private mountApplePayButton;
1334
+ private createApplePaySession;
1335
+ private onApplePayAuthorized;
1340
1336
  }
1341
1337
 
1342
1338
  export { ApplePayButtonOptions, AuthorizationFailureReasons, CardFormOptions, CardListOptions, CardPaymentButtonOptions, DropinOptions, ElementType, GooglePayButtonOptions, INTEGRATION_TYPE, InitOptions, PAYMENT_METHOD_CODES, PaymentEvents, PaypalButtonOptions, Payrails, PayrailsAmount, PayrailsClientOptions, PayrailsContainerType, PayrailsEnvironment, PayrailsSecureField, PayrailsSecureFieldEvent, SaveInstrumentResponse, WorkflowExecutionResponse };