@payrails/web-sdk 5.23.0 → 5.24.0-RC.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payrails/web-sdk",
3
- "version": "5.23.0",
3
+ "version": "5.24.0-RC.1",
4
4
  "description": "SDK providing tokenization options on the client for merchants",
5
5
  "main": "index.js",
6
6
  "types": "payrails.d.ts",
@@ -148,7 +148,6 @@
148
148
  display: flex;
149
149
  width: 100% !important;
150
150
  gap: 8px;
151
- margin-top: 8px;
152
151
  position: relative;
153
152
  }
154
153
  .payrails-country-select-element {
@@ -726,10 +725,11 @@ button.payrails-generic-button {
726
725
 
727
726
  #payrails-container-wrapper {
728
727
  width: 100%;
729
- height: 90px;
728
+ min-height: 90px;
730
729
  }
731
730
 
732
731
  .with-card-holder #payrails-container-wrapper {
733
732
  width: 100%;
734
- height: 120px;
733
+ height: min-content;
734
+ min-height: 120px;
735
735
  }
package/payrails.d.ts CHANGED
@@ -436,6 +436,7 @@ declare class CollectContainer extends Container {
436
436
  private iframe;
437
437
  constructor(options: any, metaData: any, skyflowElements: any, context: any);
438
438
  create: (input: CollectElementInput$1, options?: any) => CollectElement;
439
+ validate: () => Promise<unknown>;
439
440
  collect: (options?: ICollectOptions$1) => Promise<unknown>;
440
441
  unmount: () => void;
441
442
  }
@@ -476,6 +477,7 @@ declare class ComposableContainer extends Container {
476
477
  on: (eventName: string, handler: any) => void;
477
478
  mount: (domElement: any) => void;
478
479
  unmount: () => void;
480
+ validate: () => Promise<unknown>;
479
481
  collect: (options?: ICollectOptions) => Promise<unknown>;
480
482
  }
481
483
 
@@ -536,6 +538,10 @@ declare enum ElementType {
536
538
  EXPIRATION_DATE = "EXPIRATION_DATE"
537
539
  }
538
540
 
541
+ type ValidateCardFormResult = {
542
+ isValid: boolean;
543
+ errors: string;
544
+ };
539
545
  interface EncryptedCollectResult {
540
546
  vaultProviderConfigId: string;
541
547
  encryptedData: string;
@@ -597,6 +603,7 @@ declare class PayrailsCollectContainer implements Mountable {
597
603
  createCollectElement(options: CollectElementOptions): PayrailsSecureField;
598
604
  mount(selector: string): void;
599
605
  unmount(): void;
606
+ validate(): Promise<ValidateCardFormResult>;
600
607
  collect(): Promise<EncryptedCollectResult>;
601
608
  private collectPayrailsData;
602
609
  tokenize(opts: TokenizeOptions): Promise<SaveInstrumentResponse>;
@@ -707,6 +714,7 @@ declare class PayrailsElementWithPaymentInstallmentsDropdown extends PayrailsEle
707
714
  interface StoreInstrumentElementOptions extends ElementOptions {
708
715
  showStoreInstrumentCheckbox?: boolean;
709
716
  alwaysStoreInstrument?: boolean;
717
+ defaultStoreInstrumentState?: 'checked' | 'unchecked';
710
718
  translations?: {
711
719
  labels?: {
712
720
  storeInstrument?: string;
@@ -739,10 +747,13 @@ interface OnChange {
739
747
  bin?: string;
740
748
  billingAddress?: IAddress;
741
749
  }
750
+ type cardFormField = keyof typeof ElementType;
751
+ type CardFormLayout = cardFormField[][];
742
752
  interface CardFormOptions extends StoreInstrumentElementOptions {
743
753
  showCardHolderName?: boolean;
744
754
  showSingleExpiryDateField?: boolean;
745
755
  enrollInstrumentToNetworkOffers?: boolean;
756
+ layout?: CardFormLayout;
746
757
  translations?: {
747
758
  placeholders?: {
748
759
  [key in ElementType]?: string;
@@ -754,6 +765,11 @@ interface CardFormOptions extends StoreInstrumentElementOptions {
754
765
  storeInstrument?: string;
755
766
  paymentInstallments?: string;
756
767
  };
768
+ error?: {
769
+ default?: {
770
+ [key in ElementType]?: string;
771
+ };
772
+ };
757
773
  addressSelector?: AddressSelectorElementOptions['translations'];
758
774
  };
759
775
  events?: {
@@ -790,7 +806,13 @@ declare class CardForm extends PayrailsElementWithStoreInstrumentCheckbox {
790
806
  private lastBin;
791
807
  private lastBinLookup;
792
808
  constructor(collectContainer: PayrailsCollectContainer, options?: CardFormOptions | undefined);
793
- throttledFetchBinLookupIfChanged(): Promise<BinLookupResponse | null>;
809
+ private initializeFormFields;
810
+ getErrorTextStyles(errorTextStyles: any): any;
811
+ private createFormField;
812
+ private initializeCustomLayout;
813
+ private hasFieldBeenUsed;
814
+ private initializeDefaultLayout;
815
+ private throttledFetchBinLookupIfChanged;
794
816
  tokenize(opts: TokenizeOptions): Promise<SaveInstrumentResponse>;
795
817
  private createAddressSelector;
796
818
  show(): void;
@@ -798,6 +820,10 @@ declare class CardForm extends PayrailsElementWithStoreInstrumentCheckbox {
798
820
  private triggerOnReady;
799
821
  private prepareLabelStyles;
800
822
  private prepareInputStyles;
823
+ validate(): Promise<{
824
+ isValid: boolean;
825
+ errors: string;
826
+ }>;
801
827
  get isValid(): boolean;
802
828
  get cardNetwork(): "" | "visa" | "mastercard" | "amex" | "diners" | "discover" | "jcb" | "hipercard" | "unionpay" | "maestro";
803
829
  onChange(): void;
@@ -871,6 +897,7 @@ interface CardPaymentButtonOptions {
871
897
  label: string;
872
898
  };
873
899
  redirectFor3DS?: boolean;
900
+ disabledByDefault?: boolean;
874
901
  styles?: {
875
902
  base?: Partial<CSSStyleDeclaration>;
876
903
  disabled?: Partial<CSSStyleDeclaration>;
@@ -886,6 +913,7 @@ declare class CardPaymentButton extends PayrailsElement {
886
913
  get bin(): string | undefined;
887
914
  private readonly paymentExecutor;
888
915
  private cardForm;
916
+ disabledByDefault: boolean;
889
917
  constructor(options: CardPaymentButtonOptions, returnInfo?: ReturnInfo | undefined);
890
918
  setDisabled(isDisabled: boolean): void;
891
919
  setSavedCreditCard(savedCard: StoredPaymentInstrument<CardMetadata>): void;
@@ -1069,6 +1097,9 @@ interface PaypalButtonOptions extends StoreInstrumentElementOptions {
1069
1097
  declare class PaypalButton extends PayrailsElementWithStoreInstrumentCheckbox {
1070
1098
  protected options?: PaypalButtonOptions | undefined;
1071
1099
  private static instance;
1100
+ private renderDebounceTimeout;
1101
+ private currentAbortController;
1102
+ private isRendering;
1072
1103
  constructor(options?: PaypalButtonOptions | undefined);
1073
1104
  private paymentExecutor;
1074
1105
  private button;
@@ -1076,6 +1107,7 @@ declare class PaypalButton extends PayrailsElementWithStoreInstrumentCheckbox {
1076
1107
  private buttonWrapperId;
1077
1108
  private checkboxWrapperId;
1078
1109
  private loadPaypal;
1110
+ private debouncedRender;
1079
1111
  private get paypalScriptConfig();
1080
1112
  private createPaypalButton;
1081
1113
  private createPayPalButtonConfig;
@@ -1150,6 +1182,8 @@ interface DropinOptions {
1150
1182
  showCardHolderName?: boolean;
1151
1183
  showExistingCards?: boolean;
1152
1184
  showSingleExpiryDateField?: boolean;
1185
+ layout?: CardFormLayout;
1186
+ disablePaymentButton?: boolean;
1153
1187
  } & StorablePaymentMethodConfiguration;
1154
1188
  payPal?: StorablePaymentMethodConfiguration;
1155
1189
  googlePay?: StorablePaymentMethodConfiguration & {