@payrails/web-sdk 4.0.0-RC.1 → 4.1.0-RC.2

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": "4.0.0-RC.1",
3
+ "version": "4.1.0-RC.2",
4
4
  "description": "SDK providing tokenization options on the client for merchants",
5
5
  "main": "index.js",
6
6
  "types": "payrails.d.ts",
@@ -33,35 +33,6 @@
33
33
  cursor: not-allowed;
34
34
  }
35
35
 
36
- /* The Modal (background) */
37
- #payrails-3ds-popup-background {
38
- position: fixed;
39
- z-index: 10000;
40
- left: 0;
41
- top: 0;
42
- width: 100%;
43
- height: 100%;
44
- overflow: auto;
45
- background-color: rgb(0, 0, 0);
46
- background-color: rgba(0, 0, 0, 0.4);
47
- display: flex;
48
- align-content: center;
49
- }
50
-
51
- /* Modal Content/Box */
52
- #payrails-3ds-challenge {
53
- background-color: #fefefe;
54
- margin: 15% auto;
55
- padding: 0;
56
- overflow: hidden;
57
- border: 1px solid #888;
58
- border-radius: 4px;
59
- }
60
-
61
- #payrails-3ds-frame {
62
- border: 0;
63
- }
64
-
65
36
  #payrails-card-payment-button .dot-flashing {
66
37
  position: relative;
67
38
  width: 10px;
@@ -110,6 +81,33 @@
110
81
  }
111
82
  }
112
83
 
84
+ #payrails-popup {
85
+ background-color: #fefefe;
86
+ margin: auto;
87
+ padding: 0;
88
+ overflow: hidden;
89
+ border: 1px solid #888;
90
+ border-radius: 4px;
91
+ }
92
+
93
+ #payrails-popup-background {
94
+ position: fixed;
95
+ z-index: 10000;
96
+ left: 0;
97
+ top: 0;
98
+ width: 100%;
99
+ height: 100%;
100
+ overflow: auto;
101
+ background-color: rgb(0, 0, 0);
102
+ background-color: rgba(0, 0, 0, 0.4);
103
+ display: flex;
104
+ align-content: center;
105
+ }
106
+
107
+ #payrails-frame {
108
+ border: 0;
109
+ }
110
+
113
111
  .payrails-store-instrument-checkbox {
114
112
  margin-right: 4px;
115
113
  }
package/payrails.d.ts CHANGED
@@ -4,7 +4,8 @@ declare enum PAYMENT_METHOD_CODES {
4
4
  'CARD' = "card",
5
5
  'GOOGLE_PAY' = "googlePay",
6
6
  'PAYPAL' = "payPal",
7
- 'APPLE_PAY' = "applePay"
7
+ 'APPLE_PAY' = "applePay",
8
+ 'GENERIC_REDIRECT' = "genericRedirect"
8
9
  }
9
10
  declare enum PAYMENT_INSTRUMENT_STATUS {
10
11
  'ENABLED' = "enabled",
@@ -122,6 +123,7 @@ interface WorkflowExecutionResponse {
122
123
  };
123
124
  };
124
125
  };
126
+ redirect?: string;
125
127
  '3ds'?: string;
126
128
  self: string;
127
129
  };
@@ -473,7 +475,7 @@ interface Mountable {
473
475
  }
474
476
  interface ElementOptions {
475
477
  id?: string;
476
- className?: string;
478
+ className?: string | string[];
477
479
  styles?: Partial<CSSStyleDeclaration>;
478
480
  }
479
481
  declare class PayrailsElement implements Mountable {
@@ -498,6 +500,7 @@ interface StoreInstrumentElementOptions extends ElementOptions {
498
500
  };
499
501
  styles?: {
500
502
  storeInstrumentCheckbox?: Partial<CSSStyleDeclaration>;
503
+ storeInsrtumentCheckboxClassName?: string;
501
504
  };
502
505
  events?: PayrailsSDKEvents;
503
506
  }
@@ -589,7 +592,6 @@ interface CardFormOptions extends StoreInstrumentElementOptions {
589
592
  wrapper?: Partial<CSSStyleDeclaration>;
590
593
  base?: Partial<CSSStyleDeclaration>;
591
594
  storeCardCheckbox?: Partial<CSSStyleDeclaration>;
592
- storeInstrumentCheckbox?: Partial<CSSStyleDeclaration>;
593
595
  errorTextStyles?: {
594
596
  base: Partial<CSSStyleDeclaration>;
595
597
  };
@@ -599,7 +601,7 @@ interface CardFormOptions extends StoreInstrumentElementOptions {
599
601
  labels?: {
600
602
  [key in ElementType | 'all']?: Partial<CSSStyleDeclaration>;
601
603
  };
602
- };
604
+ } & StoreInstrumentElementOptions['styles'];
603
605
  }
604
606
  declare class CardForm extends PayrailsElementWithStoreInstrumentCheckbox {
605
607
  private readonly collectContainer;
@@ -710,8 +712,7 @@ interface GooglePayButtonOptions extends StoreInstrumentElementOptions {
710
712
  buttonType?: google.payments.api.ButtonType;
711
713
  buttonSizeMode?: google.payments.api.ButtonSizeMode;
712
714
  buttonLocale?: string;
713
- storeInstrumentCheckbox?: Partial<CSSStyleDeclaration>;
714
- };
715
+ } & StoreInstrumentElementOptions['styles'];
715
716
  }
716
717
  declare class GooglePayButton extends PayrailsElementWithStoreInstrumentCheckbox {
717
718
  private sdkConfig;
@@ -728,9 +729,64 @@ declare class GooglePayButton extends PayrailsElementWithStoreInstrumentCheckbox
728
729
  unmount(): void;
729
730
  }
730
731
 
732
+ interface DropinElementEvents {
733
+ onActivate?: () => void;
734
+ onDeactivate?: () => void;
735
+ }
731
736
  interface DropinElementStyles {
732
737
  base?: Partial<CSSStyleDeclaration>;
733
738
  active?: Partial<CSSStyleDeclaration>;
739
+ className?: string;
740
+ }
741
+ declare abstract class DropinElement extends PayrailsElement {
742
+ protected events?: DropinElementEvents | undefined;
743
+ protected styles?: DropinElementStyles | undefined;
744
+ protected abstract component: PayrailsElement;
745
+ protected isActive: boolean;
746
+ input: HTMLInputElement;
747
+ protected label: HTMLLabelElement;
748
+ protected constructor(id: string, label: string, events?: DropinElementEvents | undefined, styles?: DropinElementStyles | undefined);
749
+ get identifier(): string;
750
+ deactivate(): void;
751
+ protected applyBaseStyles(): void;
752
+ protected applyActiveStyles(): void;
753
+ activate(): void;
754
+ }
755
+
756
+ interface GenericRedirectButtonOptions {
757
+ styles?: Partial<CSSStyleDeclaration>;
758
+ translations?: {
759
+ label?: string;
760
+ };
761
+ events?: PaymentEvents;
762
+ }
763
+ declare class GenericRedirectButton extends PayrailsElement {
764
+ private sdkConfig;
765
+ private execution;
766
+ protected options: GenericRedirectButtonOptions;
767
+ private button;
768
+ constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options: GenericRedirectButtonOptions);
769
+ private paymentExecutor;
770
+ private onClick;
771
+ private configureButton;
772
+ mount(location: string): void;
773
+ }
774
+
775
+ interface GenericRedirectDropinOptions {
776
+ styles?: {
777
+ button?: GenericRedirectButtonOptions['styles'];
778
+ } & DropinElementStyles;
779
+ translations?: {
780
+ label?: string;
781
+ button?: GenericRedirectButtonOptions['translations'];
782
+ };
783
+ events?: DropinElementEvents;
784
+ }
785
+ declare class GenericRedirectDropin extends DropinElement {
786
+ private sdkConfig;
787
+ private execution;
788
+ protected component: GenericRedirectButton;
789
+ constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options?: GenericRedirectDropinOptions);
734
790
  }
735
791
 
736
792
  interface GooglePayDropinOptions extends GooglePayButtonOptions {
@@ -754,8 +810,7 @@ interface PaypalButtonOptions extends StoreInstrumentElementOptions {
754
810
  label?: 'paypal' | 'checkout' | 'buynow' | 'pay' | 'installment' | 'subscribe' | 'donate';
755
811
  shape?: 'rect' | 'pill';
756
812
  tagline?: boolean;
757
- storeInstrumentCheckbox?: Partial<CSSStyleDeclaration>;
758
- };
813
+ } & StoreInstrumentElementOptions['styles'];
759
814
  }
760
815
  declare class PaypalButton extends PayrailsElementWithStoreInstrumentCheckbox {
761
816
  private sdkConfig;
@@ -804,8 +859,10 @@ declare class Dropin extends PayrailsElement {
804
859
  private applePay;
805
860
  private cardForm;
806
861
  private paypal;
862
+ private genericRedirect;
807
863
  constructor(collectContainer: PayrailsCollectContainer, clientConfig: PayrailsClientOptions, dropinConfig: DropinOptions, execution: WorkflowExecution, sdkConfig: SdkConfiguration, returnLinks: RedirectReturnLinks);
808
864
  private createStoredInstrumentElement;
865
+ private createGenericRedirectButton;
809
866
  private createCreditCardButton;
810
867
  private createGooglePayButton;
811
868
  private createPayPalButton;
@@ -815,6 +872,7 @@ declare class Dropin extends PayrailsElement {
815
872
  private onAuthorizeSuccess;
816
873
  private onAuthorizeFailed;
817
874
  private isStoredInstrumentEnabled;
875
+ private applyStyles;
818
876
  }
819
877
  interface StorablePaymentMethodConfiguration extends StoreInstrumentElementOptions {
820
878
  showStoredInstruments?: boolean;
@@ -847,14 +905,20 @@ interface DropinOptions {
847
905
  fail?: string;
848
906
  };
849
907
  paypalButton?: PaypalDropinOptions['translations'];
908
+ genericRedirect?: GenericRedirectDropinOptions['translations'];
850
909
  };
851
910
  styles?: {
911
+ container?: {
912
+ styles?: Partial<CSSStyleDeclaration>;
913
+ className?: string;
914
+ };
852
915
  element?: DropinElementStyles;
853
916
  googlePayButton?: GooglePayButtonOptions['styles'];
854
917
  paypalButton?: PaypalDropinOptions['styles'];
855
918
  applePayButton?: ApplePayButtonOptions['styles'];
856
919
  cardForm?: CardFormOptions['styles'];
857
920
  cardPaymentButton?: CardPaymentButtonOptions['styles'];
921
+ genericRedirect?: GenericRedirectDropin['styles'];
858
922
  };
859
923
  }
860
924
 
@@ -898,6 +962,7 @@ declare class Payrails {
898
962
  private __cardPaymentButton;
899
963
  private __fraudNet;
900
964
  private __paypalButton;
965
+ private __genericRedirectButton;
901
966
  static preloadCardForm: () => void;
902
967
  static init(initResponse: InitOptions, options?: PayrailsClientOptions): Payrails;
903
968
  update(amount: PayrailsAmount): void;
@@ -914,6 +979,7 @@ declare class Payrails {
914
979
  getAvailablePaymentMethods(): PAYMENT_METHOD_CODES[];
915
980
  paymentButton(options: CardPaymentButtonOptions): CardPaymentButton;
916
981
  paypalButton(options?: PaypalButtonOptions): PaypalButton;
982
+ genericRedirectButton(options?: GenericRedirectButtonOptions): GenericRedirectButton;
917
983
  getSavedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
918
984
  fraudNet(pageId: FraudNetPageId): FraudNet;
919
985
  private logIntegrationMode;