@payrails/web-sdk 5.24.0-RC.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.24.0-RC.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>;
@@ -740,10 +747,13 @@ interface OnChange {
740
747
  bin?: string;
741
748
  billingAddress?: IAddress;
742
749
  }
750
+ type cardFormField = keyof typeof ElementType;
751
+ type CardFormLayout = cardFormField[][];
743
752
  interface CardFormOptions extends StoreInstrumentElementOptions {
744
753
  showCardHolderName?: boolean;
745
754
  showSingleExpiryDateField?: boolean;
746
755
  enrollInstrumentToNetworkOffers?: boolean;
756
+ layout?: CardFormLayout;
747
757
  translations?: {
748
758
  placeholders?: {
749
759
  [key in ElementType]?: string;
@@ -755,6 +765,11 @@ interface CardFormOptions extends StoreInstrumentElementOptions {
755
765
  storeInstrument?: string;
756
766
  paymentInstallments?: string;
757
767
  };
768
+ error?: {
769
+ default?: {
770
+ [key in ElementType]?: string;
771
+ };
772
+ };
758
773
  addressSelector?: AddressSelectorElementOptions['translations'];
759
774
  };
760
775
  events?: {
@@ -791,7 +806,13 @@ declare class CardForm extends PayrailsElementWithStoreInstrumentCheckbox {
791
806
  private lastBin;
792
807
  private lastBinLookup;
793
808
  constructor(collectContainer: PayrailsCollectContainer, options?: CardFormOptions | undefined);
794
- 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;
795
816
  tokenize(opts: TokenizeOptions): Promise<SaveInstrumentResponse>;
796
817
  private createAddressSelector;
797
818
  show(): void;
@@ -799,6 +820,10 @@ declare class CardForm extends PayrailsElementWithStoreInstrumentCheckbox {
799
820
  private triggerOnReady;
800
821
  private prepareLabelStyles;
801
822
  private prepareInputStyles;
823
+ validate(): Promise<{
824
+ isValid: boolean;
825
+ errors: string;
826
+ }>;
802
827
  get isValid(): boolean;
803
828
  get cardNetwork(): "" | "visa" | "mastercard" | "amex" | "diners" | "discover" | "jcb" | "hipercard" | "unionpay" | "maestro";
804
829
  onChange(): void;
@@ -872,6 +897,7 @@ interface CardPaymentButtonOptions {
872
897
  label: string;
873
898
  };
874
899
  redirectFor3DS?: boolean;
900
+ disabledByDefault?: boolean;
875
901
  styles?: {
876
902
  base?: Partial<CSSStyleDeclaration>;
877
903
  disabled?: Partial<CSSStyleDeclaration>;
@@ -887,6 +913,7 @@ declare class CardPaymentButton extends PayrailsElement {
887
913
  get bin(): string | undefined;
888
914
  private readonly paymentExecutor;
889
915
  private cardForm;
916
+ disabledByDefault: boolean;
890
917
  constructor(options: CardPaymentButtonOptions, returnInfo?: ReturnInfo | undefined);
891
918
  setDisabled(isDisabled: boolean): void;
892
919
  setSavedCreditCard(savedCard: StoredPaymentInstrument<CardMetadata>): void;
@@ -1155,6 +1182,8 @@ interface DropinOptions {
1155
1182
  showCardHolderName?: boolean;
1156
1183
  showExistingCards?: boolean;
1157
1184
  showSingleExpiryDateField?: boolean;
1185
+ layout?: CardFormLayout;
1186
+ disablePaymentButton?: boolean;
1158
1187
  } & StorablePaymentMethodConfiguration;
1159
1188
  payPal?: StorablePaymentMethodConfiguration;
1160
1189
  googlePay?: StorablePaymentMethodConfiguration & {