@payrails/web-sdk 5.39.2 → 5.40.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.39.2",
3
+ "version": "5.40.0",
4
4
  "description": "SDK providing tokenization options on the client for merchants",
5
5
  "main": "index.js",
6
6
  "types": "payrails.d.ts",
@@ -767,6 +767,85 @@ button.payrails-generic-button {
767
767
  border: 0;
768
768
  }
769
769
 
770
+ button.payrails-lean-button {
771
+ border: none;
772
+ outline: none;
773
+ box-shadow: none;
774
+ margin: 0;
775
+ text-transform: unset;
776
+ font-size: 16px;
777
+ font-weight: 500;
778
+ }
779
+
780
+ .payrails-lean-button * {
781
+ box-sizing: border-box;
782
+ }
783
+
784
+ .payrails-lean-button .dot-flashing-container {
785
+ width: 100%;
786
+ display: flex;
787
+ justify-content: center;
788
+ align-items: center;
789
+ position: relative;
790
+ }
791
+
792
+ .payrails-lean-button .dot-flashing-text {
793
+ visibility: hidden;
794
+ }
795
+
796
+ .payrails-lean-button .dot-flashing {
797
+ position: absolute;
798
+ left: auto;
799
+ right: auto;
800
+ width: 10px;
801
+ height: 10px;
802
+ border-radius: 5px;
803
+ background-color: currentColor;
804
+ color: currentColor;
805
+ animation: lean-dot-flashing 1s infinite linear alternate;
806
+ animation-delay: 0.5s;
807
+ }
808
+
809
+ .payrails-lean-button .dot-flashing::before,
810
+ .payrails-lean-button .dot-flashing::after {
811
+ content: '';
812
+ display: inline-block;
813
+ position: absolute;
814
+ top: 0;
815
+ }
816
+
817
+ .payrails-lean-button .dot-flashing::before {
818
+ left: -15px;
819
+ width: 10px;
820
+ height: 10px;
821
+ border-radius: 5px;
822
+ background-color: currentColor;
823
+ color: currentColor;
824
+ animation: lean-dot-flashing 1s infinite alternate;
825
+ animation-delay: 0s;
826
+ }
827
+
828
+ .payrails-lean-button .dot-flashing::after {
829
+ left: 15px;
830
+ width: 10px;
831
+ height: 10px;
832
+ border-radius: 5px;
833
+ background-color: currentColor;
834
+ color: currentColor;
835
+ animation: lean-dot-flashing 1s infinite alternate;
836
+ animation-delay: 1s;
837
+ }
838
+
839
+ @keyframes lean-dot-flashing {
840
+ 0% {
841
+ opacity: 1;
842
+ }
843
+ 50%,
844
+ 100% {
845
+ opacity: 0.2;
846
+ }
847
+ }
848
+
770
849
  #payrails-paypal-button-wrapper {
771
850
  min-height: 44px;
772
851
  }
package/payrails.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { FraudProvider } from '@payrails/fraud-sdk';
2
-
3
1
  declare const UI_POSITION_FIELD = "ui:position";
4
2
 
5
3
  type JSONSchemaType = JSONSchemaProperty & {
@@ -89,6 +87,7 @@ declare enum PAYMENT_METHOD_CODES {
89
87
  'PAYPAL' = "payPal",
90
88
  'APPLE_PAY' = "applePay",
91
89
  'GENERIC_REDIRECT' = "genericRedirect",
90
+ 'LEAN' = "lean",
92
91
  'MERCADO_PAGO' = "mercadoPago",
93
92
  'PIX' = "pix",
94
93
  'BANK_ACCOUNT' = "bankAccount",
@@ -344,6 +343,12 @@ interface WorkflowExecutionResponse {
344
343
  orderId?: string;
345
344
  tokenId?: string;
346
345
  };
346
+ paymentId?: string;
347
+ sdkToken?: string;
348
+ appToken?: string;
349
+ successUrl?: string;
350
+ failureUrl?: string;
351
+ sandbox?: boolean;
347
352
  };
348
353
  };
349
354
  redirect?: string;
@@ -585,15 +590,6 @@ interface ReturnInfo {
585
590
  error?: string;
586
591
  pending?: string;
587
592
  }
588
- declare global {
589
- interface Window {
590
- PayrailsData: {
591
- riskIds: {
592
- [key in FraudProvider]?: string;
593
- };
594
- };
595
- }
596
- }
597
593
  interface PayoutResponse {
598
594
  name: 'payout';
599
595
  executedAt: string;
@@ -734,11 +730,6 @@ interface ApplePayButtonOptions extends StoreInstrumentElementOptions {
734
730
  style?: 'white' | 'whiteOutline' | 'black' | 'automatic';
735
731
  } & StoreInstrumentElementOptions['styles'];
736
732
  }
737
- declare global {
738
- interface Window {
739
- ApplePaySession?: ApplePaySession;
740
- }
741
- }
742
733
  declare class ApplePayButton extends PayrailsElementWithStoreInstrumentCheckbox {
743
734
  protected options: ApplePayButtonOptions;
744
735
  private appleButton;
@@ -1544,6 +1535,58 @@ declare class GooglePayButton extends PayrailsElementWithStoreInstrumentCheckbox
1544
1535
  unmount(): void;
1545
1536
  }
1546
1537
 
1538
+ interface LeanButtonOptions {
1539
+ id?: string;
1540
+ events?: PaymentEvents;
1541
+ translations?: {
1542
+ label?: string;
1543
+ };
1544
+ styles?: {
1545
+ button?: {
1546
+ base?: Partial<CSSStyleDeclaration>;
1547
+ loading?: Partial<CSSStyleDeclaration>;
1548
+ hover?: Partial<CSSStyleDeclaration>;
1549
+ };
1550
+ dialog?: LeanCustomization;
1551
+ };
1552
+ returnInfo?: ReturnInfo;
1553
+ }
1554
+ type LeanCustomization = {
1555
+ themeColor?: string;
1556
+ buttonTextColor?: string;
1557
+ buttonBorderRadius?: string;
1558
+ linkColor?: string;
1559
+ overlayColor?: string;
1560
+ };
1561
+ declare class LeanButton extends PayrailsElement {
1562
+ private static leanSdkClient;
1563
+ private readonly options;
1564
+ private isLoading;
1565
+ private readonly paymentExecutor;
1566
+ private readonly handleClick;
1567
+ private readonly handleMouseEnter;
1568
+ private readonly handleMouseLeave;
1569
+ private readonly handleSessionExpired;
1570
+ constructor(options: LeanButtonOptions);
1571
+ mount(location: string): void;
1572
+ unmount(): void;
1573
+ private static initializeLeanSDK;
1574
+ private static preloadLeanSDK;
1575
+ private static getLeanSDK;
1576
+ static resetLeanSDK(): void;
1577
+ private bindEvents;
1578
+ private unbindEvents;
1579
+ private setStyles;
1580
+ private removeStyles;
1581
+ private triggerLoading;
1582
+ private renderLoadingMarkup;
1583
+ private getConfirmActionParameters;
1584
+ private startLeanCheckout;
1585
+ private handleLeanCheckoutResponse;
1586
+ private toLeanCustomizationPayload;
1587
+ private onClick;
1588
+ }
1589
+
1547
1590
  interface DropinElementEvents extends PaymentEvents {
1548
1591
  onActivate?: () => void;
1549
1592
  onDeactivate?: () => void;
@@ -1658,6 +1701,14 @@ interface GooglePayDropinOptions extends GooglePayButtonOptions {
1658
1701
  events?: GooglePayButtonOptions['events'] & DropinElementEvents;
1659
1702
  }
1660
1703
 
1704
+ interface LeanDropinOptions extends Omit<LeanButtonOptions, 'styles' | 'returnInfo'> {
1705
+ paymentMethod: StorablePaymentCompositionOption;
1706
+ translations?: LeanButtonOptions['translations'];
1707
+ events?: LeanButtonOptions['events'] & DropinElementEvents;
1708
+ styles?: LeanButtonOptions['styles'];
1709
+ elementStyles?: DropinElementStyles;
1710
+ }
1711
+
1661
1712
  interface PaypalButtonOptions extends StoreInstrumentElementOptions {
1662
1713
  events?: PaymentEvents & UIEvents & {
1663
1714
  onPaypalAvailable?: () => void;
@@ -1733,6 +1784,7 @@ declare class Dropin extends PayrailsElement {
1733
1784
  private applePay;
1734
1785
  private cardForm;
1735
1786
  private paypal;
1787
+ private lean;
1736
1788
  private loadingScreen;
1737
1789
  constructor(collectContainer: PayrailsCollectContainer, clientConfig: PayrailsClientOptions, dropinConfig: DropinOptions);
1738
1790
  private get returnInfo();
@@ -1746,6 +1798,7 @@ declare class Dropin extends PayrailsElement {
1746
1798
  private createCreditCardButton;
1747
1799
  private createGooglePayButton;
1748
1800
  private createPayPalButton;
1801
+ private createLeanButton;
1749
1802
  private createCardForm;
1750
1803
  private createApplePayButton;
1751
1804
  private createCardPaymentButton;
@@ -1764,6 +1817,7 @@ interface StorablePaymentMethodConfiguration extends StoreInstrumentElementOptio
1764
1817
  showStoredInstruments?: boolean;
1765
1818
  showPaymentMethodLogo?: boolean;
1766
1819
  }
1820
+ type LeanPaymentMethodConfiguration = Omit<StorablePaymentMethodConfiguration, 'showPaymentMethodLogo'>;
1767
1821
  interface DropinOptions {
1768
1822
  paymentMethodsConfiguration?: {
1769
1823
  [key: string]: any;
@@ -1785,6 +1839,7 @@ interface DropinOptions {
1785
1839
  applePay?: {
1786
1840
  clientDomain?: string;
1787
1841
  } & StorablePaymentMethodConfiguration;
1842
+ lean?: LeanPaymentMethodConfiguration;
1788
1843
  };
1789
1844
  returnInfo?: ReturnInfo;
1790
1845
  events?: PayrailsSDKEvents;
@@ -1802,6 +1857,7 @@ interface DropinOptions {
1802
1857
  mercadoPago?: GenericRedirectDropinOptions['translations'];
1803
1858
  addressSelector?: AddressSelectorElementOptions['translations'];
1804
1859
  applePayButton?: ApplePayDropinOptions['translations'];
1860
+ leanButton?: LeanDropinOptions['translations'];
1805
1861
  errorMessages?: {
1806
1862
  [key in ERROR_RESULT]?: string;
1807
1863
  };
@@ -1813,6 +1869,7 @@ interface DropinOptions {
1813
1869
  googlePayButton?: GooglePayButtonOptions['styles'];
1814
1870
  paypalButton?: PaypalDropinOptions['styles'];
1815
1871
  applePayButton?: ApplePayButtonOptions['styles'];
1872
+ leanButton?: LeanButtonOptions['styles'];
1816
1873
  cardForm?: CardFormOptions['styles'];
1817
1874
  cardPaymentButton?: CardPaymentButtonOptions['styles'];
1818
1875
  authSuccess?: Partial<CSSStyleDeclaration>;
@@ -1941,8 +1998,10 @@ declare class SdkLoader {
1941
1998
  private static readonly scriptMap;
1942
1999
  static load<T = void>(sdk: ThirdPartySDK, params?: PayPalScriptConfig): Promise<T>;
1943
2000
  static reset(): void;
2001
+ static invalidate(sdk: ThirdPartySDK): void;
1944
2002
  static preloadCardForm(): void;
1945
2003
  private static loadScript;
2004
+ private static getScriptKey;
1946
2005
  private static loadPayPalScript;
1947
2006
  private constructor();
1948
2007
  private static logLoadError;
@@ -1956,7 +2015,8 @@ interface PayPalScriptConfig {
1956
2015
  declare enum ThirdPartySDK {
1957
2016
  ApplePay = "https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js",
1958
2017
  GooglePay = "https://pay.google.com/gp/p/js/pay.js",
1959
- PayPal = "paypal-sdk"
2018
+ PayPal = "paypal-sdk",
2019
+ Lean = "https://cdn.leantech.me/link/loader/prod/ae/latest/lean-link-loader.min.js"
1960
2020
  }
1961
2021
 
1962
2022
  interface QueryDefinition<T> {
@@ -1992,6 +2052,7 @@ declare class Payrails {
1992
2052
  private __cardList;
1993
2053
  private __cardPaymentButton;
1994
2054
  private __paypalButton;
2055
+ private __leanButton;
1995
2056
  private __genericRedirectButton;
1996
2057
  private __dynamicElementForm;
1997
2058
  private __dropin;
@@ -2019,6 +2080,7 @@ declare class Payrails {
2019
2080
  getAvailablePaymentMethods(): PaymentMethodCode[];
2020
2081
  paymentButton(options: CardPaymentButtonOptions): CardPaymentButton;
2021
2082
  paypalButton(options?: PaypalButtonOptions): PaypalButton;
2083
+ leanButton(options: LeanButtonOptions): LeanButton;
2022
2084
  genericRedirectButton(options: GenericRedirectButtonOptions): GenericRedirectButton;
2023
2085
  dynamicElement(options: DynamicElementOptions): DynamicElementForm;
2024
2086
  getSavedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
@@ -2134,4 +2196,4 @@ interface PayrailsClientOptions {
2134
2196
  }
2135
2197
 
2136
2198
  export { AuthorizationFailureReasons, ElementType, INTEGRATION_TYPE, PAYMENT_METHOD_CODES, Payrails, PayrailsCollectContainer, PayrailsEnvironment };
2137
- export type { ApplePayButtonOptions, CardFormOptions, CardListOptions, CardPaymentButtonOptions, CollectContainerOptions, DropinOptions, ExecutionMeta, ExecutionMetaCustomer, ExecutionMetaKey, GenericRedirectButtonOptions, GooglePayButtonOptions, InitOptions, PaymentEvents, PaypalButtonOptions, PayrailsAmount, PayrailsClientOptions, PayrailsContainerType, PayrailsSecureField, PayrailsSecureFieldEvent, ReturnInfo, SaveInstrumentResponse, WorkflowExecutionResponse };
2199
+ export type { ApplePayButtonOptions, CardFormOptions, CardListOptions, CardPaymentButtonOptions, CollectContainerOptions, DropinOptions, ExecutionMeta, ExecutionMetaCustomer, ExecutionMetaKey, GenericRedirectButtonOptions, GooglePayButtonOptions, InitOptions, LeanButtonOptions, PaymentEvents, PaypalButtonOptions, PayrailsAmount, PayrailsClientOptions, PayrailsContainerType, PayrailsSecureField, PayrailsSecureFieldEvent, ReturnInfo, SaveInstrumentResponse, WorkflowExecutionResponse };