@payrails/web-sdk 5.16.1 → 5.18.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.16.1",
3
+ "version": "5.18.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
@@ -17,9 +17,10 @@ declare enum PAYMENT_INSTRUMENT_STATUS {
17
17
  'TRANSIENT' = "transient"
18
18
  }
19
19
  declare class WorkflowExecution {
20
- private executionResponse;
21
- constructor(executionResponse: WorkflowExecutionResponse);
22
- get lookup(): {
20
+ private static _response;
21
+ static get response(): WorkflowExecutionResponse;
22
+ static setResponse(response: WorkflowExecutionResponse): typeof WorkflowExecution;
23
+ static get lookup(): {
23
24
  httpCode: number;
24
25
  body: {
25
26
  data: {
@@ -35,24 +36,23 @@ declare class WorkflowExecution {
35
36
  name: "lookup";
36
37
  };
37
38
  } | undefined;
38
- get holderReference(): string;
39
- get savedCreditCards(): StoredPaymentInstrument<CardMetadata>[];
40
- get savedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
41
- get savedGooglePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
42
- get savedApplePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
43
- get paypalConfig(): PayPalConfig;
44
- get googlePayConfig(): GooglePayConfig[];
45
- isPaymentMethodAvailable(paymentMethod: PAYMENT_METHOD_CODES): boolean;
46
- get applePayConfig(): {
39
+ static get holderReference(): string;
40
+ static get savedCreditCards(): StoredPaymentInstrument<CardMetadata>[];
41
+ static get savedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
42
+ static get savedGooglePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
43
+ static get savedApplePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
44
+ static get paypalConfig(): PayPalConfig;
45
+ static get googlePayConfig(): GooglePayConfig[];
46
+ static isPaymentMethodAvailable(paymentMethod: PAYMENT_METHOD_CODES): boolean;
47
+ static get applePayConfig(): {
47
48
  merchantIdentifier: string;
48
49
  supportedNetworks: string[];
49
50
  countryCode: string;
50
51
  merchantCapabilities: ApplePayJS.ApplePayMerchantCapability[];
51
52
  requiredBillingContactFields?: ApplePayJS.ApplePayContactField[];
52
53
  };
53
- get url(): string;
54
- get response(): WorkflowExecutionResponse;
55
- get meta(): {
54
+ static get url(): string;
55
+ static get meta(): {
56
56
  customer?: {
57
57
  country?: {
58
58
  code?: string;
@@ -66,15 +66,15 @@ declare class WorkflowExecution {
66
66
  };
67
67
  };
68
68
  };
69
- get availablePaymentMethods(): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined>[];
70
- get authorizeLink(): string | undefined;
71
- get createSessionLink(): string | undefined;
72
- get storedPaymentInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
73
- getFullPaymentMethodConfig(paymentMethod: PAYMENT_METHOD_CODES): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined> | undefined;
74
- isPaymentInstallmentsEnabled(paymentMethod: PAYMENT_METHOD_CODES): boolean | undefined;
75
- getPaymentInstallmentOptions(paymentMethod: PAYMENT_METHOD_CODES): PaymentInstallmentsConfig;
76
- private getStoredInstrumentForPaymentMethod;
77
- getPaymentMethodForStoredInstrument<T extends CardMetadata | PayPalMetadata>(instrument: StoredPaymentInstrument<T>): {
69
+ static get availablePaymentMethods(): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined>[];
70
+ static get authorizeLink(): string | undefined;
71
+ static get createSessionLink(): string | undefined;
72
+ static get storedPaymentInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
73
+ static getFullPaymentMethodConfig(paymentMethod: PAYMENT_METHOD_CODES): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined> | undefined;
74
+ static isPaymentInstallmentsEnabled(paymentMethod: PAYMENT_METHOD_CODES): boolean | undefined;
75
+ static getPaymentInstallmentOptions(paymentMethod: PAYMENT_METHOD_CODES): PaymentInstallmentsConfig;
76
+ private static getStoredInstrumentForPaymentMethod;
77
+ static getPaymentMethodForStoredInstrument<T extends CardMetadata | PayPalMetadata>(instrument: StoredPaymentInstrument<T>): {
78
78
  id: string;
79
79
  description?: string;
80
80
  status: PAYMENT_INSTRUMENT_STATUS;
@@ -88,7 +88,7 @@ declare class WorkflowExecution {
88
88
  };
89
89
  paymentMethodCode: PAYMENT_METHOD_CODES;
90
90
  } | undefined;
91
- getPaymentMethodConfig(paymentMethod: StorablePaymentCompositionOption): {
91
+ static getPaymentMethodConfig(paymentMethod: StorablePaymentCompositionOption): {
92
92
  id: string;
93
93
  description?: string;
94
94
  status: PAYMENT_INSTRUMENT_STATUS;
@@ -502,14 +502,6 @@ declare class Skyflow {
502
502
  static get ValidationRuleType(): typeof ValidationRuleType;
503
503
  }
504
504
 
505
- declare enum ElementType {
506
- CARD_NUMBER = "CARD_NUMBER",
507
- CARDHOLDER_NAME = "CARDHOLDER_NAME",
508
- CVV = "CVV",
509
- EXPIRATION_MONTH = "EXPIRATION_MONTH",
510
- EXPIRATION_YEAR = "EXPIRATION_YEAR"
511
- }
512
-
513
505
  interface Mountable {
514
506
  mount(selector: string | PayrailsElement): void;
515
507
  unmount(): void;
@@ -619,12 +611,11 @@ declare global {
619
611
  }
620
612
  declare class ApplePayButton extends PayrailsElementWithStoreInstrumentCheckbox {
621
613
  private sdkConfig;
622
- private execution;
623
614
  protected options: ApplePayButtonOptions;
624
615
  private appleButton;
625
616
  private paymentExecutor;
626
617
  static isApplePayAvailable(): Promise<boolean>;
627
- constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options: ApplePayButtonOptions);
618
+ constructor(sdkConfig: SdkConfiguration, options: ApplePayButtonOptions);
628
619
  mount(location: string): void;
629
620
  unmount(): void;
630
621
  private mountApplePayButton;
@@ -645,6 +636,15 @@ declare const regexes: {
645
636
  };
646
637
  type CardNetwork = keyof typeof regexes;
647
638
 
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
648
  interface PaymentInstallmentsElementOptions extends ElementOptions {
649
649
  showPaymentInstallmentsDropdown?: boolean;
650
650
  installmentOptions?: BaseInstallmentOption[] | null;
@@ -690,8 +690,8 @@ interface OnChange {
690
690
  }
691
691
  interface CardFormOptions extends StoreInstrumentElementOptions {
692
692
  showCardHolderName?: boolean;
693
+ showSingleExpiryDateField?: boolean;
693
694
  enrollInstrumentToNetworkOffers?: boolean;
694
- execution?: WorkflowExecution;
695
695
  translations?: {
696
696
  placeholders?: {
697
697
  [key in ElementType]?: string;
@@ -751,8 +751,8 @@ declare class CardForm extends PayrailsElementWithStoreInstrumentCheckbox {
751
751
  get cardNetwork(): "" | "visa" | "mastercard" | "amex" | "diners" | "discover" | "jcb" | "hipercard" | "unionpay" | "maestro";
752
752
  onChange(): void;
753
753
  private updateInstallments;
754
- collectValues(): Promise<{
755
- cardData: EncryptedCollectResult | TokenizedCollectResult;
754
+ collectValues<T extends TokenizedCollectResult | EncryptedCollectResult = EncryptedCollectResult>(): Promise<{
755
+ cardData: T;
756
756
  storeInstrument: boolean;
757
757
  selectedInstallment: number | undefined;
758
758
  enrollInstrumentToNetworkOffers: boolean;
@@ -783,9 +783,8 @@ interface CardListOptions {
783
783
  onCardChange: (selectedCard: StoredPaymentInstrument<CardMetadata>) => void;
784
784
  }
785
785
  declare class CardList extends PayrailsElement {
786
- private readonly workflowExecution;
787
786
  private listItems;
788
- constructor(workflowExecution: WorkflowExecution, options?: CardListOptions);
787
+ constructor(options?: CardListOptions);
789
788
  reset(): void;
790
789
  }
791
790
 
@@ -822,15 +821,14 @@ interface CardPaymentButtonOptions {
822
821
  }
823
822
  declare class CardPaymentButton extends PayrailsElement {
824
823
  private readonly sdkConfig;
825
- private readonly execution;
826
824
  private readonly options;
827
825
  private readonly returnInfo?;
828
826
  selectedInstrument: StoredPaymentInstrument | null;
829
827
  paymentInstallmentElement: PayrailsElementWithPaymentInstallmentsDropdown | null;
830
828
  get bin(): string | undefined;
831
- private paymentExecutor;
829
+ private readonly paymentExecutor;
832
830
  private cardForm;
833
- constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options: CardPaymentButtonOptions, returnInfo?: ReturnInfo | undefined);
831
+ constructor(sdkConfig: SdkConfiguration, options: CardPaymentButtonOptions, returnInfo?: ReturnInfo | undefined);
834
832
  setDisabled(isDisabled: boolean): void;
835
833
  setSavedCreditCard(savedCard: StoredPaymentInstrument<CardMetadata>): void;
836
834
  setSavedInstrument(savedInstrument: StoredPaymentInstrument): void;
@@ -838,7 +836,7 @@ declare class CardPaymentButton extends PayrailsElement {
838
836
  private removeStyles;
839
837
  setLabel(label: string): void;
840
838
  setCardForm(cardForm: CardForm): void;
841
- setPaymentInstallmentsDropdown(paymentInsallmentsDropdown: PayrailsElementWithPaymentInstallmentsDropdown): void;
839
+ setPaymentInstallmentsDropdown(paymentInstallmentsDropdown: PayrailsElementWithPaymentInstallmentsDropdown): void;
842
840
  triggerLoading(isLoading: boolean): void;
843
841
  private onAuthorizationFailed;
844
842
  private onPay;
@@ -870,14 +868,13 @@ interface GooglePayButtonOptions extends StoreInstrumentElementOptions {
870
868
  }
871
869
  declare class GooglePayButton extends PayrailsElementWithStoreInstrumentCheckbox {
872
870
  private sdkConfig;
873
- private execution;
874
871
  protected options: GooglePayButtonOptions;
875
872
  private googleButton;
876
873
  private readonly paymentExecutor;
877
874
  private static googleSDKClient;
878
875
  private static getSDKClient;
879
876
  static isGooglePayAvailable(allowedPaymentMethods: google.payments.api.IsReadyToPayPaymentMethodSpecification[], environment?: PayrailsEnvironment, merchantInfo?: google.payments.api.MerchantInfo): Promise<boolean>;
880
- constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options: GooglePayButtonOptions);
877
+ constructor(sdkConfig: SdkConfiguration, options: GooglePayButtonOptions);
881
878
  private sdkLoaded;
882
879
  private onLoadPaymentData;
883
880
  private authorize;
@@ -921,10 +918,9 @@ interface GenericRedirectButtonOptions {
921
918
  }
922
919
  declare class GenericRedirectButton extends PayrailsElement {
923
920
  private sdkConfig;
924
- private execution;
925
921
  protected options: GenericRedirectButtonOptions;
926
922
  private readonly returnInfo?;
927
- constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options: GenericRedirectButtonOptions, returnInfo?: ReturnInfo | undefined);
923
+ constructor(sdkConfig: SdkConfiguration, options: GenericRedirectButtonOptions, returnInfo?: ReturnInfo | undefined);
928
924
  private popup;
929
925
  private buildRedirectButton;
930
926
  private readonly paymentExecutor;
@@ -976,9 +972,8 @@ interface PaypalButtonOptions extends StoreInstrumentElementOptions {
976
972
  }
977
973
  declare class PaypalButton extends PayrailsElementWithStoreInstrumentCheckbox {
978
974
  private sdkConfig;
979
- private execution;
980
975
  protected options?: PaypalButtonOptions | undefined;
981
- constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options?: PaypalButtonOptions | undefined);
976
+ constructor(sdkConfig: SdkConfiguration, options?: PaypalButtonOptions | undefined);
982
977
  fraudNetGuid: string | undefined;
983
978
  private paymentExecutor;
984
979
  private button;
@@ -1014,7 +1009,6 @@ declare class Dropin extends PayrailsElement {
1014
1009
  private collectContainer;
1015
1010
  private readonly clientConfig;
1016
1011
  private readonly dropinConfig;
1017
- private readonly execution;
1018
1012
  private readonly sdkConfig;
1019
1013
  private cardPaymentButton;
1020
1014
  private creditCard;
@@ -1022,8 +1016,7 @@ declare class Dropin extends PayrailsElement {
1022
1016
  private applePay;
1023
1017
  private cardForm;
1024
1018
  private paypal;
1025
- private paymentInstallmentsDropdown;
1026
- constructor(collectContainer: PayrailsCollectContainer, clientConfig: PayrailsClientOptions, dropinConfig: DropinOptions, execution: WorkflowExecution, sdkConfig: SdkConfiguration);
1019
+ constructor(collectContainer: PayrailsCollectContainer, clientConfig: PayrailsClientOptions, dropinConfig: DropinOptions, sdkConfig: SdkConfiguration);
1027
1020
  private isHppIntegration;
1028
1021
  private createStoredInstrumentElement;
1029
1022
  private createInstallmentsDropdown;
@@ -1058,6 +1051,7 @@ interface DropinOptions {
1058
1051
  cards?: {
1059
1052
  showCardHolderName?: boolean;
1060
1053
  showExistingCards?: boolean;
1054
+ showSingleExpiryDateField?: boolean;
1061
1055
  } & StorablePaymentMethodConfiguration;
1062
1056
  payPal?: StorablePaymentMethodConfiguration;
1063
1057
  googlePay?: StorablePaymentMethodConfiguration & {
@@ -1127,9 +1121,8 @@ declare enum ThirdPartySDK {
1127
1121
  type FraudNetPageId = 'home-page' | 'search-result-page' | 'category-page' | 'product-detail-page' | 'cart-page' | 'inline-cart-page' | 'checkout-page';
1128
1122
  declare class FraudNet implements Mountable {
1129
1123
  private pageId;
1130
- private execution;
1131
1124
  private environment;
1132
- constructor(pageId: FraudNetPageId, execution: WorkflowExecution, environment: PayrailsClientOptions['environment']);
1125
+ constructor(pageId: FraudNetPageId, environment: PayrailsClientOptions['environment']);
1133
1126
  readonly guid: any;
1134
1127
  mount(): void;
1135
1128
  unmount(): void;
@@ -1137,14 +1130,13 @@ declare class FraudNet implements Mountable {
1137
1130
  private readonly fnclsVal;
1138
1131
  private readonly configId;
1139
1132
  private readonly scriptId;
1140
- private get payPalConfig();
1141
1133
  private createFraudnetConfig;
1142
1134
  }
1143
1135
 
1144
1136
  interface PayrailsClientOptions {
1145
1137
  environment?: PayrailsEnvironment;
1146
1138
  events?: {
1147
- onClientInitialized: (execution?: WorkflowExecution) => void;
1139
+ onClientInitialized: (execution?: typeof WorkflowExecution) => void;
1148
1140
  };
1149
1141
  redirectFor3DS?: boolean;
1150
1142
  returnInfo?: ReturnInfo;
@@ -1156,7 +1148,6 @@ interface PayrailsClientOptions {
1156
1148
  declare class Payrails {
1157
1149
  private sdkConfiguration;
1158
1150
  private vaultClient;
1159
- private execution;
1160
1151
  private options?;
1161
1152
  private __container;
1162
1153
  private __cardForm;
@@ -1187,7 +1178,6 @@ declare class Payrails {
1187
1178
  genericRedirectButton(options: GenericRedirectButtonOptions): GenericRedirectButton;
1188
1179
  getSavedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
1189
1180
  fraudNet(pageId: FraudNetPageId): FraudNet;
1190
- private get safeExecution();
1191
1181
  private logIntegrationMode;
1192
1182
  private constructor();
1193
1183
  private getContainerLayout;
@@ -1332,7 +1322,7 @@ declare class PayrailsCollectContainer implements Mountable {
1332
1322
  createCollectElement(options: CollectElementOptions): PayrailsSecureField;
1333
1323
  mount(selector: string): void;
1334
1324
  unmount(): void;
1335
- collect(): Promise<TokenizedCollectResult | EncryptedCollectResult>;
1325
+ collect<T extends EncryptedCollectResult | TokenizedCollectResult = EncryptedCollectResult>(): Promise<T>;
1336
1326
  private collectSkyflowData;
1337
1327
  private collectPayrailsData;
1338
1328
  tokenize(opts: TokenizeOptions): Promise<SaveInstrumentResponse>;