@payrails/web-sdk 5.37.4 → 5.37.5

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.37.4",
3
+ "version": "5.37.5",
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,6 +1,6 @@
1
- import * as _payrails_iframe_event_bus from '@payrails/iframe-event-bus';
2
1
  import { LogLevel as LogLevel$1 } from '@payrails/logger';
3
2
  import { FraudProvider } from '@payrails/fraud-sdk';
3
+ import * as _payrails_iframe_event_bus from '@payrails/iframe-event-bus';
4
4
 
5
5
  declare const UI_POSITION_FIELD = "ui:position";
6
6
 
@@ -486,16 +486,218 @@ interface SaveInstrumentResponse {
486
486
  futureUsage?: string;
487
487
  }
488
488
 
489
- interface BinLookupResponse {
490
- bin: string;
491
- network: string;
492
- issuer?: string;
493
- issuerCountry?: {
489
+ interface SdkConfiguration {
490
+ token: string;
491
+ amount: PayrailsAmount;
492
+ holderReference: string;
493
+ links?: {
494
+ binLookup?: Links;
495
+ instrumentDelete?: Links;
496
+ instrumentUpdate?: Links;
497
+ };
498
+ type?: 'tokenization' | 'dropIn' | 'secureFields';
499
+ vaultConfiguration: {
500
+ cardTableName: string;
501
+ token: string;
502
+ vaultId: string;
503
+ vaultUrl: string;
504
+ providerId: string;
505
+ providerConfigId: string;
506
+ vaultType: 'Payrails' | 'Test';
507
+ encryptionPublicKey?: string;
508
+ links: {
509
+ saveInstrument: {
510
+ href: string;
511
+ };
512
+ };
513
+ };
514
+ execution?: WorkflowExecutionResponse;
515
+ }
516
+ interface PayrailsAmount {
517
+ value: string;
518
+ currency: string;
519
+ }
520
+ interface LookupUpdateOptions {
521
+ value: string;
522
+ currency: string;
523
+ installmentConfig?: InstallmentUpdateConfig | null;
524
+ }
525
+ interface Links {
526
+ method: 'GET' | 'POST';
527
+ href: string;
528
+ }
529
+
530
+ interface ReturnInfo {
531
+ success?: string;
532
+ cancel?: string;
533
+ error?: string;
534
+ pending?: string;
535
+ }
536
+ declare global {
537
+ interface Window {
538
+ PayrailsData: {
539
+ riskIds: {
540
+ [key in FraudProvider]?: string;
541
+ };
542
+ };
543
+ }
544
+ }
545
+ interface PayoutResponse {
546
+ name: 'payout';
547
+ executedAt: string;
548
+ workspaceId: string;
549
+ actionId: string;
550
+ links: {
551
+ execution: string;
552
+ };
553
+ }
554
+ type PayoutComposition = Array<{
555
+ integrationType: string;
556
+ amount: PayrailsAmount;
557
+ paymentMethodCode: PAYMENT_METHOD_CODES;
558
+ paymentInstrumentId?: string;
559
+ }>;
560
+ interface PayoutReqBody {
561
+ amount: PayrailsAmount;
562
+ payoutComposition: PayoutComposition;
563
+ }
564
+ type ERROR_RESULT = 'Unknown' | 'UnexpectedProviderResponse' | 'ProviderUnknownError' | 'ProviderConnectionError' | 'Timeout' | 'ProviderTimeout' | 'GenericRejection' | 'DuplicateOperation' | 'OperationNotAllowed' | 'NetworkTransactionReferenceRejected' | 'PayerCanceled' | 'LimitExceeded' | 'InstrumentNotAllowed' | 'InvalidInstrument' | 'InsufficientBalance' | 'BlockedInstrument' | 'ExpiredInstrument' | 'ValidationError' | 'ParamsError' | 'ProviderConfigError' | 'InvalidSignature' | 'InternalServerError' | 'AuthenticationError' | 'PaymentMethodNotSupported' | 'PayerAuthenticationRequired' | 'PayerAuthenticationFailed' | 'FraudRisk';
565
+
566
+ interface Mountable {
567
+ mount(selector: string | PayrailsElement): void;
568
+ unmount(): void;
569
+ }
570
+ interface ElementOptions {
571
+ id?: string;
572
+ dataTestId?: string;
573
+ className?: string | string[];
574
+ styles?: Partial<CSSStyleDeclaration>;
575
+ }
576
+ declare class PayrailsElement implements Mountable {
577
+ protected element: HTMLElement;
578
+ protected subElements: Array<Mountable>;
579
+ readonly id: string | undefined;
580
+ readonly dataTestId: string | undefined;
581
+ protected eventBus: _payrails_iframe_event_bus.IframeEventBus;
582
+ constructor(elementType: string, { id, className, dataTestId }?: ElementOptions);
583
+ get parentElement(): HTMLElement | null;
584
+ get selector(): string;
585
+ mount(location: string): void;
586
+ protected clean(): void;
587
+ unmount(): void;
588
+ }
589
+
590
+ interface IAddress {
591
+ country?: {
494
592
  code?: string;
495
- name?: string;
593
+ fullName?: string;
496
594
  iso3?: string;
497
595
  };
498
- type?: string;
596
+ postalCode?: string;
597
+ }
598
+ interface IOnChange {
599
+ isValid: boolean;
600
+ billingAddress?: IAddress;
601
+ }
602
+ interface AddressSelectorElementOptions extends ElementOptions {
603
+ translations?: {
604
+ labels?: {
605
+ countrySelector?: string;
606
+ postalCodeInput?: string;
607
+ };
608
+ placeholders?: {
609
+ postalCodeInput?: string;
610
+ countrySelector?: string;
611
+ };
612
+ };
613
+ styles?: {
614
+ wrapper?: Partial<CSSStyleDeclaration>;
615
+ countrySelector?: {
616
+ wrapper?: Partial<CSSStyleDeclaration>;
617
+ element?: Partial<CSSStyleDeclaration>;
618
+ label?: Partial<CSSStyleDeclaration>;
619
+ };
620
+ postalCodeInput?: {
621
+ wrapper?: Partial<CSSStyleDeclaration>;
622
+ element?: Partial<CSSStyleDeclaration>;
623
+ label?: Partial<CSSStyleDeclaration>;
624
+ };
625
+ };
626
+ events?: {
627
+ onBillingAddressChanged?: (e: IOnChange) => void;
628
+ };
629
+ }
630
+
631
+ interface StoreInstrumentElementOptions extends ElementOptions {
632
+ showStoreInstrumentCheckbox?: boolean;
633
+ alwaysStoreInstrument?: boolean;
634
+ defaultStoreInstrumentState?: 'checked' | 'unchecked';
635
+ translations?: {
636
+ labels?: {
637
+ storeInstrument?: string;
638
+ saveInstrument?: string;
639
+ };
640
+ };
641
+ styles?: {
642
+ storeInstrumentCheckbox?: Partial<CSSStyleDeclaration>;
643
+ };
644
+ events?: PayrailsSDKEvents;
645
+ }
646
+ declare class StoreInstrumentCheckbox extends PayrailsElement {
647
+ private options;
648
+ constructor(options: StoreInstrumentElementOptions);
649
+ get isChecked(): boolean;
650
+ private createHTML;
651
+ private applyStyles;
652
+ private addListeners;
653
+ }
654
+ declare abstract class PayrailsElementWithStoreInstrumentCheckbox extends PayrailsElement {
655
+ protected options?: StoreInstrumentElementOptions | undefined;
656
+ protected storeInstrumentCheckbox: StoreInstrumentCheckbox | null;
657
+ protected constructor(elementType: string, options?: StoreInstrumentElementOptions | undefined);
658
+ protected get shouldStoreInstrument(): boolean;
659
+ }
660
+
661
+ interface ApplePayButtonOptions extends StoreInstrumentElementOptions {
662
+ clientDomain?: string;
663
+ showPaymentMethodLogo?: boolean;
664
+ abortAfterAuthorizeFailed?: boolean;
665
+ translations?: {
666
+ labels?: {
667
+ storeInstrument?: string;
668
+ saveInstrument?: string;
669
+ paymentScreenLabel?: string;
670
+ };
671
+ };
672
+ events?: PaymentEvents & {
673
+ onApplePayAvailable?: () => void;
674
+ };
675
+ styles?: {
676
+ type?: 'plain' | 'buy' | 'addMoney' | 'book' | 'checkout' | 'continue' | 'contribute' | 'donate' | 'inStore' | 'order' | 'reload' | 'rent' | 'setUp' | 'subscribe' | 'support' | 'tip' | 'topUp';
677
+ style?: 'white' | 'whiteOutline' | 'black' | 'automatic';
678
+ } & StoreInstrumentElementOptions['styles'];
679
+ }
680
+ declare global {
681
+ interface Window {
682
+ ApplePaySession?: ApplePaySession;
683
+ }
684
+ }
685
+ declare class ApplePayButton extends PayrailsElementWithStoreInstrumentCheckbox {
686
+ protected options: ApplePayButtonOptions;
687
+ private appleButton;
688
+ private paymentExecutor;
689
+ private action;
690
+ private isProcessing;
691
+ static isApplePayAvailable(): Promise<boolean>;
692
+ constructor(options: ApplePayButtonOptions);
693
+ mount(location: string): void;
694
+ unmount(): void;
695
+ private mountApplePayButton;
696
+ private onAuthorizeFailedHandler;
697
+ private createApplePaySession;
698
+ private onApplePayAuthorized;
699
+ private doAuthorizedPayment;
700
+ private doTokenize;
499
701
  }
500
702
 
501
703
  declare enum RedactionType {
@@ -674,6 +876,32 @@ interface FontDescriptor {
674
876
  display?: string;
675
877
  }
676
878
 
879
+ declare const regexes: {
880
+ visa: RegExp;
881
+ mastercard: RegExp;
882
+ amex: RegExp;
883
+ diners_club: RegExp;
884
+ discover: RegExp;
885
+ jcb: RegExp;
886
+ hipercard: RegExp;
887
+ unionpay: RegExp;
888
+ maestro: RegExp;
889
+ elo: RegExp;
890
+ };
891
+ type CardNetwork = keyof typeof regexes;
892
+
893
+ interface BinLookupResponse {
894
+ bin: string;
895
+ network: string;
896
+ issuer?: string;
897
+ issuerCountry?: {
898
+ code?: string;
899
+ name?: string;
900
+ iso3?: string;
901
+ };
902
+ type?: string;
903
+ }
904
+
677
905
  declare class ComposableElement {
678
906
  #private;
679
907
  type: string;
@@ -839,30 +1067,6 @@ declare class Skyflow {
839
1067
  static get ValidationRuleType(): typeof ValidationRuleType;
840
1068
  }
841
1069
 
842
- interface Mountable {
843
- mount(selector: string | PayrailsElement): void;
844
- unmount(): void;
845
- }
846
- interface ElementOptions {
847
- id?: string;
848
- dataTestId?: string;
849
- className?: string | string[];
850
- styles?: Partial<CSSStyleDeclaration>;
851
- }
852
- declare class PayrailsElement implements Mountable {
853
- protected element: HTMLElement;
854
- protected subElements: Array<Mountable>;
855
- readonly id: string | undefined;
856
- readonly dataTestId: string | undefined;
857
- protected eventBus: _payrails_iframe_event_bus.IframeEventBus;
858
- constructor(elementType: string, { id, className, dataTestId }?: ElementOptions);
859
- get parentElement(): HTMLElement | null;
860
- get selector(): string;
861
- mount(location: string): void;
862
- protected clean(): void;
863
- unmount(): void;
864
- }
865
-
866
1070
  interface TokenizeOptions {
867
1071
  futureUsage?: FutureUsages;
868
1072
  storeInstrument?: boolean;
@@ -972,61 +1176,6 @@ declare class PayrailsCollectContainer implements Mountable {
972
1176
  }>;
973
1177
  }
974
1178
 
975
- interface IAddress {
976
- country?: {
977
- code?: string;
978
- fullName?: string;
979
- iso3?: string;
980
- };
981
- postalCode?: string;
982
- }
983
- interface IOnChange {
984
- isValid: boolean;
985
- billingAddress?: IAddress;
986
- }
987
- interface AddressSelectorElementOptions extends ElementOptions {
988
- translations?: {
989
- labels?: {
990
- countrySelector?: string;
991
- postalCodeInput?: string;
992
- };
993
- placeholders?: {
994
- postalCodeInput?: string;
995
- countrySelector?: string;
996
- };
997
- };
998
- styles?: {
999
- wrapper?: Partial<CSSStyleDeclaration>;
1000
- countrySelector?: {
1001
- wrapper?: Partial<CSSStyleDeclaration>;
1002
- element?: Partial<CSSStyleDeclaration>;
1003
- label?: Partial<CSSStyleDeclaration>;
1004
- };
1005
- postalCodeInput?: {
1006
- wrapper?: Partial<CSSStyleDeclaration>;
1007
- element?: Partial<CSSStyleDeclaration>;
1008
- label?: Partial<CSSStyleDeclaration>;
1009
- };
1010
- };
1011
- events?: {
1012
- onBillingAddressChanged?: (e: IOnChange) => void;
1013
- };
1014
- }
1015
-
1016
- declare const regexes: {
1017
- visa: RegExp;
1018
- mastercard: RegExp;
1019
- amex: RegExp;
1020
- diners_club: RegExp;
1021
- discover: RegExp;
1022
- jcb: RegExp;
1023
- hipercard: RegExp;
1024
- unionpay: RegExp;
1025
- maestro: RegExp;
1026
- elo: RegExp;
1027
- };
1028
- type CardNetwork = keyof typeof regexes;
1029
-
1030
1179
  interface PaymentInstallmentsElementOptions extends ElementOptions {
1031
1180
  showPaymentInstallmentsDropdown?: boolean;
1032
1181
  installmentConfig?: {
@@ -1070,36 +1219,6 @@ declare class PayrailsElementWithPaymentInstallmentsDropdown extends PayrailsEle
1070
1219
  setDisabled(state: boolean): void;
1071
1220
  }
1072
1221
 
1073
- interface StoreInstrumentElementOptions extends ElementOptions {
1074
- showStoreInstrumentCheckbox?: boolean;
1075
- alwaysStoreInstrument?: boolean;
1076
- defaultStoreInstrumentState?: 'checked' | 'unchecked';
1077
- translations?: {
1078
- labels?: {
1079
- storeInstrument?: string;
1080
- saveInstrument?: string;
1081
- };
1082
- };
1083
- styles?: {
1084
- storeInstrumentCheckbox?: Partial<CSSStyleDeclaration>;
1085
- };
1086
- events?: PayrailsSDKEvents;
1087
- }
1088
- declare class StoreInstrumentCheckbox extends PayrailsElement {
1089
- private options;
1090
- constructor(options: StoreInstrumentElementOptions);
1091
- get isChecked(): boolean;
1092
- private createHTML;
1093
- private applyStyles;
1094
- private addListeners;
1095
- }
1096
- declare abstract class PayrailsElementWithStoreInstrumentCheckbox extends PayrailsElement {
1097
- protected options?: StoreInstrumentElementOptions | undefined;
1098
- protected storeInstrumentCheckbox: StoreInstrumentCheckbox | null;
1099
- protected constructor(elementType: string, options?: StoreInstrumentElementOptions | undefined);
1100
- protected get shouldStoreInstrument(): boolean;
1101
- }
1102
-
1103
1222
  interface OnChange {
1104
1223
  isValid: boolean;
1105
1224
  cardNetwork: CardNetwork | '';
@@ -1241,83 +1360,6 @@ declare class CardList extends PayrailsElement {
1241
1360
  reset(): void;
1242
1361
  }
1243
1362
 
1244
- interface SdkConfiguration {
1245
- token: string;
1246
- amount: PayrailsAmount;
1247
- holderReference: string;
1248
- links?: {
1249
- binLookup?: Links;
1250
- instrumentDelete?: Links;
1251
- instrumentUpdate?: Links;
1252
- };
1253
- type?: 'tokenization' | 'dropIn' | 'secureFields';
1254
- vaultConfiguration: {
1255
- cardTableName: string;
1256
- token: string;
1257
- vaultId: string;
1258
- vaultUrl: string;
1259
- providerId: string;
1260
- providerConfigId: string;
1261
- vaultType: 'Payrails' | 'Test';
1262
- encryptionPublicKey?: string;
1263
- links: {
1264
- saveInstrument: {
1265
- href: string;
1266
- };
1267
- };
1268
- };
1269
- execution?: WorkflowExecutionResponse;
1270
- }
1271
- interface PayrailsAmount {
1272
- value: string;
1273
- currency: string;
1274
- }
1275
- interface LookupUpdateOptions {
1276
- value: string;
1277
- currency: string;
1278
- installmentConfig?: InstallmentUpdateConfig | null;
1279
- }
1280
- interface Links {
1281
- method: 'GET' | 'POST';
1282
- href: string;
1283
- }
1284
-
1285
- interface ReturnInfo {
1286
- success?: string;
1287
- cancel?: string;
1288
- error?: string;
1289
- pending?: string;
1290
- }
1291
- declare global {
1292
- interface Window {
1293
- PayrailsData: {
1294
- riskIds: {
1295
- [key in FraudProvider]?: string;
1296
- };
1297
- };
1298
- }
1299
- }
1300
- interface PayoutResponse {
1301
- name: 'payout';
1302
- executedAt: string;
1303
- workspaceId: string;
1304
- actionId: string;
1305
- links: {
1306
- execution: string;
1307
- };
1308
- }
1309
- type PayoutComposition = Array<{
1310
- integrationType: string;
1311
- amount: PayrailsAmount;
1312
- paymentMethodCode: PAYMENT_METHOD_CODES;
1313
- paymentInstrumentId?: string;
1314
- }>;
1315
- interface PayoutReqBody {
1316
- amount: PayrailsAmount;
1317
- payoutComposition: PayoutComposition;
1318
- }
1319
- type ERROR_RESULT = 'Unknown' | 'UnexpectedProviderResponse' | 'ProviderUnknownError' | 'ProviderConnectionError' | 'Timeout' | 'ProviderTimeout' | 'GenericRejection' | 'DuplicateOperation' | 'OperationNotAllowed' | 'NetworkTransactionReferenceRejected' | 'PayerCanceled' | 'LimitExceeded' | 'InstrumentNotAllowed' | 'InvalidInstrument' | 'InsufficientBalance' | 'BlockedInstrument' | 'ExpiredInstrument' | 'ValidationError' | 'ParamsError' | 'ProviderConfigError' | 'InvalidSignature' | 'InternalServerError' | 'AuthenticationError' | 'PaymentMethodNotSupported' | 'PayerAuthenticationRequired' | 'PayerAuthenticationFailed' | 'FraudRisk';
1320
-
1321
1363
  interface CardPaymentButtonOptions {
1322
1364
  events?: PayrailsSDKEvents & {
1323
1365
  onStateChanged?: (state: 'enabled' | 'disabled') => void;
@@ -1864,16 +1906,6 @@ interface PublicSharedState {
1864
1906
  instrument: StoredPaymentInstrument | null;
1865
1907
  }
1866
1908
 
1867
- interface PayrailsClientOptions {
1868
- environment?: PayrailsEnvironment;
1869
- events?: ClientEvents;
1870
- redirectFor3DS?: boolean;
1871
- returnInfo?: ReturnInfo;
1872
- telemetry?: {
1873
- enabled?: boolean;
1874
- logLevel?: LogLevel$1;
1875
- };
1876
- }
1877
1909
  declare class Payrails {
1878
1910
  private vaultClient;
1879
1911
  private options?;
@@ -1885,7 +1917,6 @@ declare class Payrails {
1885
1917
  private __genericRedirectButton;
1886
1918
  private __dynamicElementForm;
1887
1919
  private __dropin;
1888
- private __sharedState;
1889
1920
  static preloadCardForm: typeof SdkLoader.preloadCardForm;
1890
1921
  static init(initResponse: InitOptions, options?: PayrailsClientOptions): Payrails;
1891
1922
  update(updateOptions: LookupUpdateOptions): void;
@@ -2011,46 +2042,16 @@ declare enum PayrailsEnvironment {
2011
2042
  PRODUCTION = "PRODUCTION"
2012
2043
  }
2013
2044
 
2014
- interface ApplePayButtonOptions extends StoreInstrumentElementOptions {
2015
- clientDomain?: string;
2016
- showPaymentMethodLogo?: boolean;
2017
- abortAfterAuthorizeFailed?: boolean;
2018
- translations?: {
2019
- labels?: {
2020
- storeInstrument?: string;
2021
- saveInstrument?: string;
2022
- paymentScreenLabel?: string;
2023
- };
2024
- };
2025
- events?: PaymentEvents & {
2026
- onApplePayAvailable?: () => void;
2045
+ interface PayrailsClientOptions {
2046
+ environment?: PayrailsEnvironment;
2047
+ events?: ClientEvents;
2048
+ redirectFor3DS?: boolean;
2049
+ returnInfo?: ReturnInfo;
2050
+ telemetry?: {
2051
+ enabled?: boolean;
2052
+ logLevel?: LogLevel$1;
2053
+ collectMetadata?: boolean;
2027
2054
  };
2028
- styles?: {
2029
- type?: 'plain' | 'buy' | 'addMoney' | 'book' | 'checkout' | 'continue' | 'contribute' | 'donate' | 'inStore' | 'order' | 'reload' | 'rent' | 'setUp' | 'subscribe' | 'support' | 'tip' | 'topUp';
2030
- style?: 'white' | 'whiteOutline' | 'black' | 'automatic';
2031
- } & StoreInstrumentElementOptions['styles'];
2032
- }
2033
- declare global {
2034
- interface Window {
2035
- ApplePaySession?: ApplePaySession;
2036
- }
2037
- }
2038
- declare class ApplePayButton extends PayrailsElementWithStoreInstrumentCheckbox {
2039
- protected options: ApplePayButtonOptions;
2040
- private appleButton;
2041
- private paymentExecutor;
2042
- private action;
2043
- private isProcessing;
2044
- static isApplePayAvailable(): Promise<boolean>;
2045
- constructor(options: ApplePayButtonOptions);
2046
- mount(location: string): void;
2047
- unmount(): void;
2048
- private mountApplePayButton;
2049
- private onAuthorizeFailedHandler;
2050
- private createApplePaySession;
2051
- private onApplePayAuthorized;
2052
- private doAuthorizedPayment;
2053
- private doTokenize;
2054
2055
  }
2055
2056
 
2056
2057
  export { AuthorizationFailureReasons, ElementType, INTEGRATION_TYPE, PAYMENT_METHOD_CODES, Payrails, PayrailsEnvironment };