@payrails/web-sdk 5.16.1 → 5.17.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.17.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,14 @@ 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
+ }
646
+
648
647
  interface PaymentInstallmentsElementOptions extends ElementOptions {
649
648
  showPaymentInstallmentsDropdown?: boolean;
650
649
  installmentOptions?: BaseInstallmentOption[] | null;
@@ -691,7 +690,6 @@ interface OnChange {
691
690
  interface CardFormOptions extends StoreInstrumentElementOptions {
692
691
  showCardHolderName?: boolean;
693
692
  enrollInstrumentToNetworkOffers?: boolean;
694
- execution?: WorkflowExecution;
695
693
  translations?: {
696
694
  placeholders?: {
697
695
  [key in ElementType]?: string;
@@ -751,8 +749,8 @@ declare class CardForm extends PayrailsElementWithStoreInstrumentCheckbox {
751
749
  get cardNetwork(): "" | "visa" | "mastercard" | "amex" | "diners" | "discover" | "jcb" | "hipercard" | "unionpay" | "maestro";
752
750
  onChange(): void;
753
751
  private updateInstallments;
754
- collectValues(): Promise<{
755
- cardData: EncryptedCollectResult | TokenizedCollectResult;
752
+ collectValues<T extends TokenizedCollectResult | EncryptedCollectResult = EncryptedCollectResult>(): Promise<{
753
+ cardData: T;
756
754
  storeInstrument: boolean;
757
755
  selectedInstallment: number | undefined;
758
756
  enrollInstrumentToNetworkOffers: boolean;
@@ -783,9 +781,8 @@ interface CardListOptions {
783
781
  onCardChange: (selectedCard: StoredPaymentInstrument<CardMetadata>) => void;
784
782
  }
785
783
  declare class CardList extends PayrailsElement {
786
- private readonly workflowExecution;
787
784
  private listItems;
788
- constructor(workflowExecution: WorkflowExecution, options?: CardListOptions);
785
+ constructor(options?: CardListOptions);
789
786
  reset(): void;
790
787
  }
791
788
 
@@ -822,15 +819,14 @@ interface CardPaymentButtonOptions {
822
819
  }
823
820
  declare class CardPaymentButton extends PayrailsElement {
824
821
  private readonly sdkConfig;
825
- private readonly execution;
826
822
  private readonly options;
827
823
  private readonly returnInfo?;
828
824
  selectedInstrument: StoredPaymentInstrument | null;
829
825
  paymentInstallmentElement: PayrailsElementWithPaymentInstallmentsDropdown | null;
830
826
  get bin(): string | undefined;
831
- private paymentExecutor;
827
+ private readonly paymentExecutor;
832
828
  private cardForm;
833
- constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options: CardPaymentButtonOptions, returnInfo?: ReturnInfo | undefined);
829
+ constructor(sdkConfig: SdkConfiguration, options: CardPaymentButtonOptions, returnInfo?: ReturnInfo | undefined);
834
830
  setDisabled(isDisabled: boolean): void;
835
831
  setSavedCreditCard(savedCard: StoredPaymentInstrument<CardMetadata>): void;
836
832
  setSavedInstrument(savedInstrument: StoredPaymentInstrument): void;
@@ -838,7 +834,7 @@ declare class CardPaymentButton extends PayrailsElement {
838
834
  private removeStyles;
839
835
  setLabel(label: string): void;
840
836
  setCardForm(cardForm: CardForm): void;
841
- setPaymentInstallmentsDropdown(paymentInsallmentsDropdown: PayrailsElementWithPaymentInstallmentsDropdown): void;
837
+ setPaymentInstallmentsDropdown(paymentInstallmentsDropdown: PayrailsElementWithPaymentInstallmentsDropdown): void;
842
838
  triggerLoading(isLoading: boolean): void;
843
839
  private onAuthorizationFailed;
844
840
  private onPay;
@@ -870,14 +866,13 @@ interface GooglePayButtonOptions extends StoreInstrumentElementOptions {
870
866
  }
871
867
  declare class GooglePayButton extends PayrailsElementWithStoreInstrumentCheckbox {
872
868
  private sdkConfig;
873
- private execution;
874
869
  protected options: GooglePayButtonOptions;
875
870
  private googleButton;
876
871
  private readonly paymentExecutor;
877
872
  private static googleSDKClient;
878
873
  private static getSDKClient;
879
874
  static isGooglePayAvailable(allowedPaymentMethods: google.payments.api.IsReadyToPayPaymentMethodSpecification[], environment?: PayrailsEnvironment, merchantInfo?: google.payments.api.MerchantInfo): Promise<boolean>;
880
- constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options: GooglePayButtonOptions);
875
+ constructor(sdkConfig: SdkConfiguration, options: GooglePayButtonOptions);
881
876
  private sdkLoaded;
882
877
  private onLoadPaymentData;
883
878
  private authorize;
@@ -921,10 +916,9 @@ interface GenericRedirectButtonOptions {
921
916
  }
922
917
  declare class GenericRedirectButton extends PayrailsElement {
923
918
  private sdkConfig;
924
- private execution;
925
919
  protected options: GenericRedirectButtonOptions;
926
920
  private readonly returnInfo?;
927
- constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options: GenericRedirectButtonOptions, returnInfo?: ReturnInfo | undefined);
921
+ constructor(sdkConfig: SdkConfiguration, options: GenericRedirectButtonOptions, returnInfo?: ReturnInfo | undefined);
928
922
  private popup;
929
923
  private buildRedirectButton;
930
924
  private readonly paymentExecutor;
@@ -976,9 +970,8 @@ interface PaypalButtonOptions extends StoreInstrumentElementOptions {
976
970
  }
977
971
  declare class PaypalButton extends PayrailsElementWithStoreInstrumentCheckbox {
978
972
  private sdkConfig;
979
- private execution;
980
973
  protected options?: PaypalButtonOptions | undefined;
981
- constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options?: PaypalButtonOptions | undefined);
974
+ constructor(sdkConfig: SdkConfiguration, options?: PaypalButtonOptions | undefined);
982
975
  fraudNetGuid: string | undefined;
983
976
  private paymentExecutor;
984
977
  private button;
@@ -1014,7 +1007,6 @@ declare class Dropin extends PayrailsElement {
1014
1007
  private collectContainer;
1015
1008
  private readonly clientConfig;
1016
1009
  private readonly dropinConfig;
1017
- private readonly execution;
1018
1010
  private readonly sdkConfig;
1019
1011
  private cardPaymentButton;
1020
1012
  private creditCard;
@@ -1022,8 +1014,7 @@ declare class Dropin extends PayrailsElement {
1022
1014
  private applePay;
1023
1015
  private cardForm;
1024
1016
  private paypal;
1025
- private paymentInstallmentsDropdown;
1026
- constructor(collectContainer: PayrailsCollectContainer, clientConfig: PayrailsClientOptions, dropinConfig: DropinOptions, execution: WorkflowExecution, sdkConfig: SdkConfiguration);
1017
+ constructor(collectContainer: PayrailsCollectContainer, clientConfig: PayrailsClientOptions, dropinConfig: DropinOptions, sdkConfig: SdkConfiguration);
1027
1018
  private isHppIntegration;
1028
1019
  private createStoredInstrumentElement;
1029
1020
  private createInstallmentsDropdown;
@@ -1127,9 +1118,8 @@ declare enum ThirdPartySDK {
1127
1118
  type FraudNetPageId = 'home-page' | 'search-result-page' | 'category-page' | 'product-detail-page' | 'cart-page' | 'inline-cart-page' | 'checkout-page';
1128
1119
  declare class FraudNet implements Mountable {
1129
1120
  private pageId;
1130
- private execution;
1131
1121
  private environment;
1132
- constructor(pageId: FraudNetPageId, execution: WorkflowExecution, environment: PayrailsClientOptions['environment']);
1122
+ constructor(pageId: FraudNetPageId, environment: PayrailsClientOptions['environment']);
1133
1123
  readonly guid: any;
1134
1124
  mount(): void;
1135
1125
  unmount(): void;
@@ -1137,7 +1127,6 @@ declare class FraudNet implements Mountable {
1137
1127
  private readonly fnclsVal;
1138
1128
  private readonly configId;
1139
1129
  private readonly scriptId;
1140
- private get payPalConfig();
1141
1130
  private createFraudnetConfig;
1142
1131
  }
1143
1132
 
@@ -1156,7 +1145,6 @@ interface PayrailsClientOptions {
1156
1145
  declare class Payrails {
1157
1146
  private sdkConfiguration;
1158
1147
  private vaultClient;
1159
- private execution;
1160
1148
  private options?;
1161
1149
  private __container;
1162
1150
  private __cardForm;
@@ -1187,7 +1175,6 @@ declare class Payrails {
1187
1175
  genericRedirectButton(options: GenericRedirectButtonOptions): GenericRedirectButton;
1188
1176
  getSavedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
1189
1177
  fraudNet(pageId: FraudNetPageId): FraudNet;
1190
- private get safeExecution();
1191
1178
  private logIntegrationMode;
1192
1179
  private constructor();
1193
1180
  private getContainerLayout;
@@ -1332,7 +1319,7 @@ declare class PayrailsCollectContainer implements Mountable {
1332
1319
  createCollectElement(options: CollectElementOptions): PayrailsSecureField;
1333
1320
  mount(selector: string): void;
1334
1321
  unmount(): void;
1335
- collect(): Promise<TokenizedCollectResult | EncryptedCollectResult>;
1322
+ collect<T extends EncryptedCollectResult | TokenizedCollectResult = EncryptedCollectResult>(): Promise<T>;
1336
1323
  private collectSkyflowData;
1337
1324
  private collectPayrailsData;
1338
1325
  tokenize(opts: TokenizeOptions): Promise<SaveInstrumentResponse>;