@payrails/web-sdk 4.0.0 → 4.1.0-RC.3

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",
3
+ "version": "4.1.0-RC.3",
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
  };
@@ -728,9 +730,65 @@ declare class GooglePayButton extends PayrailsElementWithStoreInstrumentCheckbox
728
730
  unmount(): void;
729
731
  }
730
732
 
733
+ interface DropinElementEvents {
734
+ onActivate?: () => void;
735
+ onDeactivate?: () => void;
736
+ }
731
737
  interface DropinElementStyles {
732
738
  base?: Partial<CSSStyleDeclaration>;
733
739
  active?: Partial<CSSStyleDeclaration>;
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 readonly returnLinks?;
768
+ private button;
769
+ constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options: GenericRedirectButtonOptions, returnLinks?: RedirectReturnLinks | undefined);
770
+ private paymentExecutor;
771
+ private onClick;
772
+ private configureButton;
773
+ mount(location: string): void;
774
+ }
775
+
776
+ interface GenericRedirectDropinOptions {
777
+ styles?: {
778
+ button?: GenericRedirectButtonOptions['styles'];
779
+ } & DropinElementStyles;
780
+ translations?: {
781
+ label?: string;
782
+ button?: GenericRedirectButtonOptions['translations'];
783
+ };
784
+ events?: DropinElementEvents;
785
+ }
786
+ declare class GenericRedirectDropin extends DropinElement {
787
+ private sdkConfig;
788
+ private execution;
789
+ private readonly returnLinks?;
790
+ protected component: GenericRedirectButton;
791
+ constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options?: GenericRedirectDropinOptions, returnLinks?: RedirectReturnLinks | undefined);
734
792
  }
735
793
 
736
794
  interface GooglePayDropinOptions extends GooglePayButtonOptions {
@@ -804,8 +862,10 @@ declare class Dropin extends PayrailsElement {
804
862
  private applePay;
805
863
  private cardForm;
806
864
  private paypal;
865
+ private genericRedirect;
807
866
  constructor(collectContainer: PayrailsCollectContainer, clientConfig: PayrailsClientOptions, dropinConfig: DropinOptions, execution: WorkflowExecution, sdkConfig: SdkConfiguration, returnLinks: RedirectReturnLinks);
808
867
  private createStoredInstrumentElement;
868
+ private createGenericRedirectButton;
809
869
  private createCreditCardButton;
810
870
  private createGooglePayButton;
811
871
  private createPayPalButton;
@@ -833,10 +893,7 @@ interface DropinOptions {
833
893
  clientDomain?: string;
834
894
  } & StorablePaymentMethodConfiguration;
835
895
  };
836
- returnInfo?: {
837
- success: string;
838
- error: string;
839
- };
896
+ returnInfo?: RedirectReturnLinks;
840
897
  events?: PayrailsSDKEvents;
841
898
  translations?: {
842
899
  googlePayButton?: GooglePayDropinOptions['translations'];
@@ -847,6 +904,7 @@ interface DropinOptions {
847
904
  fail?: string;
848
905
  };
849
906
  paypalButton?: PaypalDropinOptions['translations'];
907
+ genericRedirect?: GenericRedirectDropinOptions['translations'];
850
908
  };
851
909
  styles?: {
852
910
  element?: DropinElementStyles;
@@ -855,6 +913,7 @@ interface DropinOptions {
855
913
  applePayButton?: ApplePayButtonOptions['styles'];
856
914
  cardForm?: CardFormOptions['styles'];
857
915
  cardPaymentButton?: CardPaymentButtonOptions['styles'];
916
+ genericRedirect?: GenericRedirectDropin['styles'];
858
917
  };
859
918
  }
860
919
 
@@ -898,6 +957,7 @@ declare class Payrails {
898
957
  private __cardPaymentButton;
899
958
  private __fraudNet;
900
959
  private __paypalButton;
960
+ private __genericRedirectButton;
901
961
  static preloadCardForm: () => void;
902
962
  static init(initResponse: InitOptions, options?: PayrailsClientOptions): Payrails;
903
963
  update(amount: PayrailsAmount): void;
@@ -914,6 +974,7 @@ declare class Payrails {
914
974
  getAvailablePaymentMethods(): PAYMENT_METHOD_CODES[];
915
975
  paymentButton(options: CardPaymentButtonOptions): CardPaymentButton;
916
976
  paypalButton(options?: PaypalButtonOptions): PaypalButton;
977
+ genericRedirectButton(options?: GenericRedirectButtonOptions): GenericRedirectButton;
917
978
  getSavedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
918
979
  fraudNet(pageId: FraudNetPageId): FraudNet;
919
980
  private logIntegrationMode;