@payrails/web-sdk 5.39.0 → 5.39.2-RC.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/README.md +4 -0
- package/index.js +4 -4
- package/package.json +1 -1
- package/payrails-styles.css +11 -11
- package/payrails.d.ts +123 -7
- package/payrails.js +4 -4
package/package.json
CHANGED
package/payrails-styles.css
CHANGED
|
@@ -6,6 +6,17 @@
|
|
|
6
6
|
align-items: center;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
.payrails-container-wrapper {
|
|
10
|
+
width: 100%;
|
|
11
|
+
min-height: 90px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.with-card-holder .payrails-container-wrapper {
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: min-content;
|
|
17
|
+
min-height: 120px;
|
|
18
|
+
}
|
|
19
|
+
|
|
9
20
|
#payrails-card-payment-button {
|
|
10
21
|
display: flex;
|
|
11
22
|
flex-direction: row;
|
|
@@ -879,14 +890,3 @@ button.payrails-generic-button {
|
|
|
879
890
|
background-color: unset;
|
|
880
891
|
color: unset;
|
|
881
892
|
}
|
|
882
|
-
|
|
883
|
-
.payrails-container-wrapper {
|
|
884
|
-
width: 100%;
|
|
885
|
-
min-height: 90px;
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
.with-card-holder .payrails-container-wrapper {
|
|
889
|
-
width: 100%;
|
|
890
|
-
height: min-content;
|
|
891
|
-
min-height: 120px;
|
|
892
|
-
}
|
package/payrails.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { LogLevel as LogLevel$1 } from '@payrails/logger';
|
|
2
1
|
import { FraudProvider } from '@payrails/fraud-sdk';
|
|
3
|
-
import * as _payrails_iframe_event_bus from '@payrails/iframe-event-bus';
|
|
4
2
|
|
|
5
3
|
declare const UI_POSITION_FIELD = "ui:position";
|
|
6
4
|
|
|
@@ -91,6 +89,7 @@ declare enum PAYMENT_METHOD_CODES {
|
|
|
91
89
|
'PAYPAL' = "payPal",
|
|
92
90
|
'APPLE_PAY' = "applePay",
|
|
93
91
|
'GENERIC_REDIRECT' = "genericRedirect",
|
|
92
|
+
'LEAN' = "lean",
|
|
94
93
|
'MERCADO_PAGO' = "mercadoPago",
|
|
95
94
|
'PIX' = "pix",
|
|
96
95
|
'BANK_ACCOUNT' = "bankAccount",
|
|
@@ -346,6 +345,12 @@ interface WorkflowExecutionResponse {
|
|
|
346
345
|
orderId?: string;
|
|
347
346
|
tokenId?: string;
|
|
348
347
|
};
|
|
348
|
+
paymentId?: string;
|
|
349
|
+
sdkToken?: string;
|
|
350
|
+
app_token?: string;
|
|
351
|
+
successUrl?: string;
|
|
352
|
+
failureUrl?: string;
|
|
353
|
+
sandbox?: boolean;
|
|
349
354
|
};
|
|
350
355
|
};
|
|
351
356
|
redirect?: string;
|
|
@@ -617,6 +622,11 @@ interface PayoutReqBody {
|
|
|
617
622
|
}
|
|
618
623
|
type ERROR_RESULT = 'Unknown' | 'UnexpectedProviderResponse' | 'ProviderUnknownError' | 'ProviderConnectionError' | 'Timeout' | 'ProviderTimeout' | 'GenericRejection' | 'DuplicateOperation' | 'OperationNotAllowed' | 'NetworkTransactionReferenceRejected' | 'PayerCanceled' | 'LimitExceeded' | 'InstrumentNotAllowed' | 'InvalidInstrument' | 'InsufficientBalance' | 'BlockedInstrument' | 'ExpiredInstrument' | 'ValidationError' | 'ParamsError' | 'ProviderConfigError' | 'InvalidSignature' | 'InternalServerError' | 'AuthenticationError' | 'PaymentMethodNotSupported' | 'PayerAuthenticationRequired' | 'PayerAuthenticationFailed' | 'FraudRisk';
|
|
619
624
|
|
|
625
|
+
type IframeEventBusLike = {
|
|
626
|
+
emit: (...args: any[]) => unknown;
|
|
627
|
+
on: (...args: any[]) => unknown;
|
|
628
|
+
off?: (...args: any[]) => unknown;
|
|
629
|
+
};
|
|
620
630
|
interface Mountable {
|
|
621
631
|
mount(selector: string | PayrailsElement): void;
|
|
622
632
|
unmount(): void;
|
|
@@ -632,7 +642,7 @@ declare class PayrailsElement implements Mountable {
|
|
|
632
642
|
protected subElements: Array<Mountable>;
|
|
633
643
|
readonly id: string | undefined;
|
|
634
644
|
readonly dataTestId: string | undefined;
|
|
635
|
-
protected eventBus:
|
|
645
|
+
protected eventBus: IframeEventBusLike;
|
|
636
646
|
constructor(elementType: string, { id, className, dataTestId }?: ElementOptions);
|
|
637
647
|
get parentElement(): HTMLElement | null;
|
|
638
648
|
get selector(): string;
|
|
@@ -1361,6 +1371,7 @@ declare class CardForm extends PayrailsElementWithStoreInstrumentCheckbox {
|
|
|
1361
1371
|
update(options: Partial<Pick<CardFormOptions, 'styles' | 'translations' | 'events'>>): void;
|
|
1362
1372
|
updateInstallmentConfig(installmentConfig?: InstallmentUpdateConfig): void;
|
|
1363
1373
|
private createFormField;
|
|
1374
|
+
private isFieldRequired;
|
|
1364
1375
|
private initializeCustomLayout;
|
|
1365
1376
|
private hasFieldBeenUsed;
|
|
1366
1377
|
private initializeDefaultLayout;
|
|
@@ -1540,6 +1551,92 @@ declare class GooglePayButton extends PayrailsElementWithStoreInstrumentCheckbox
|
|
|
1540
1551
|
unmount(): void;
|
|
1541
1552
|
}
|
|
1542
1553
|
|
|
1554
|
+
interface LeanButtonOptions {
|
|
1555
|
+
id?: string;
|
|
1556
|
+
events?: PaymentEvents;
|
|
1557
|
+
translations?: {
|
|
1558
|
+
label?: string;
|
|
1559
|
+
};
|
|
1560
|
+
styles?: {
|
|
1561
|
+
button?: {
|
|
1562
|
+
base?: Partial<CSSStyleDeclaration>;
|
|
1563
|
+
loading?: Partial<CSSStyleDeclaration>;
|
|
1564
|
+
hover?: Partial<CSSStyleDeclaration>;
|
|
1565
|
+
};
|
|
1566
|
+
dialog?: LeanCustomization;
|
|
1567
|
+
};
|
|
1568
|
+
returnInfo?: ReturnInfo;
|
|
1569
|
+
}
|
|
1570
|
+
type LeanCallbackResponse = {
|
|
1571
|
+
status?: string;
|
|
1572
|
+
message?: string;
|
|
1573
|
+
last_api_response?: string;
|
|
1574
|
+
exit_point?: string;
|
|
1575
|
+
secondary_status?: string;
|
|
1576
|
+
bank?: {
|
|
1577
|
+
bank_identifier?: string;
|
|
1578
|
+
is_supported?: boolean;
|
|
1579
|
+
};
|
|
1580
|
+
};
|
|
1581
|
+
type LeanCheckoutPayload = {
|
|
1582
|
+
app_token: string;
|
|
1583
|
+
access_token: string;
|
|
1584
|
+
payment_intent_id: string;
|
|
1585
|
+
success_redirect_url: string;
|
|
1586
|
+
fail_redirect_url: string;
|
|
1587
|
+
sandbox?: boolean;
|
|
1588
|
+
bank_identifier?: string;
|
|
1589
|
+
customization?: LeanCustomizationPayload;
|
|
1590
|
+
callback: (response: LeanCallbackResponse) => void;
|
|
1591
|
+
};
|
|
1592
|
+
type LeanCustomization = {
|
|
1593
|
+
themeColor?: string;
|
|
1594
|
+
buttonTextColor?: string;
|
|
1595
|
+
buttonBorderRadius?: string;
|
|
1596
|
+
linkColor?: string;
|
|
1597
|
+
overlayColor?: string;
|
|
1598
|
+
};
|
|
1599
|
+
type LeanCustomizationPayload = {
|
|
1600
|
+
theme_color?: string;
|
|
1601
|
+
button_text_color?: string;
|
|
1602
|
+
button_border_radius?: string;
|
|
1603
|
+
link_color?: string;
|
|
1604
|
+
overlay_color?: string;
|
|
1605
|
+
};
|
|
1606
|
+
declare global {
|
|
1607
|
+
interface Window {
|
|
1608
|
+
Lean?: {
|
|
1609
|
+
checkout: (payload: LeanCheckoutPayload) => void;
|
|
1610
|
+
};
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
declare class LeanButton extends PayrailsElement {
|
|
1614
|
+
private static leanSdkClient;
|
|
1615
|
+
private readonly options;
|
|
1616
|
+
private isLoading;
|
|
1617
|
+
private readonly paymentExecutor;
|
|
1618
|
+
private readonly handleClick;
|
|
1619
|
+
private readonly handleMouseEnter;
|
|
1620
|
+
private readonly handleMouseLeave;
|
|
1621
|
+
private readonly handleSessionExpired;
|
|
1622
|
+
constructor(options: LeanButtonOptions);
|
|
1623
|
+
mount(location: string): void;
|
|
1624
|
+
unmount(): void;
|
|
1625
|
+
private static getLeanSDK;
|
|
1626
|
+
static resetLeanSDK(): void;
|
|
1627
|
+
private bindEvents;
|
|
1628
|
+
private unbindEvents;
|
|
1629
|
+
private setStyles;
|
|
1630
|
+
private removeStyles;
|
|
1631
|
+
private triggerLoading;
|
|
1632
|
+
private renderLoadingMarkup;
|
|
1633
|
+
private getConfirmActionParameters;
|
|
1634
|
+
private startLeanCheckout;
|
|
1635
|
+
private handleLeanCheckoutResponse;
|
|
1636
|
+
private toLeanCustomizationPayload;
|
|
1637
|
+
private onClick;
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1543
1640
|
interface DropinElementEvents extends PaymentEvents {
|
|
1544
1641
|
onActivate?: () => void;
|
|
1545
1642
|
onDeactivate?: () => void;
|
|
@@ -1654,6 +1751,15 @@ interface GooglePayDropinOptions extends GooglePayButtonOptions {
|
|
|
1654
1751
|
events?: GooglePayButtonOptions['events'] & DropinElementEvents;
|
|
1655
1752
|
}
|
|
1656
1753
|
|
|
1754
|
+
interface LeanDropinOptions extends Omit<LeanButtonOptions, 'styles'> {
|
|
1755
|
+
paymentMethod: StorablePaymentCompositionOption;
|
|
1756
|
+
translations?: LeanButtonOptions['translations'];
|
|
1757
|
+
events?: LeanButtonOptions['events'] & DropinElementEvents;
|
|
1758
|
+
styles?: LeanButtonOptions['styles'];
|
|
1759
|
+
elementStyles?: DropinElementStyles;
|
|
1760
|
+
returnInfo?: ReturnInfo;
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1657
1763
|
interface PaypalButtonOptions extends StoreInstrumentElementOptions {
|
|
1658
1764
|
events?: PaymentEvents & UIEvents & {
|
|
1659
1765
|
onPaypalAvailable?: () => void;
|
|
@@ -1729,6 +1835,7 @@ declare class Dropin extends PayrailsElement {
|
|
|
1729
1835
|
private applePay;
|
|
1730
1836
|
private cardForm;
|
|
1731
1837
|
private paypal;
|
|
1838
|
+
private lean;
|
|
1732
1839
|
private loadingScreen;
|
|
1733
1840
|
constructor(collectContainer: PayrailsCollectContainer, clientConfig: PayrailsClientOptions, dropinConfig: DropinOptions);
|
|
1734
1841
|
private get returnInfo();
|
|
@@ -1742,6 +1849,7 @@ declare class Dropin extends PayrailsElement {
|
|
|
1742
1849
|
private createCreditCardButton;
|
|
1743
1850
|
private createGooglePayButton;
|
|
1744
1851
|
private createPayPalButton;
|
|
1852
|
+
private createLeanButton;
|
|
1745
1853
|
private createCardForm;
|
|
1746
1854
|
private createApplePayButton;
|
|
1747
1855
|
private createCardPaymentButton;
|
|
@@ -1760,6 +1868,7 @@ interface StorablePaymentMethodConfiguration extends StoreInstrumentElementOptio
|
|
|
1760
1868
|
showStoredInstruments?: boolean;
|
|
1761
1869
|
showPaymentMethodLogo?: boolean;
|
|
1762
1870
|
}
|
|
1871
|
+
type LeanPaymentMethodConfiguration = Omit<StorablePaymentMethodConfiguration, 'showPaymentMethodLogo'>;
|
|
1763
1872
|
interface DropinOptions {
|
|
1764
1873
|
paymentMethodsConfiguration?: {
|
|
1765
1874
|
[key: string]: any;
|
|
@@ -1781,6 +1890,7 @@ interface DropinOptions {
|
|
|
1781
1890
|
applePay?: {
|
|
1782
1891
|
clientDomain?: string;
|
|
1783
1892
|
} & StorablePaymentMethodConfiguration;
|
|
1893
|
+
lean?: LeanPaymentMethodConfiguration;
|
|
1784
1894
|
};
|
|
1785
1895
|
returnInfo?: ReturnInfo;
|
|
1786
1896
|
events?: PayrailsSDKEvents;
|
|
@@ -1798,6 +1908,7 @@ interface DropinOptions {
|
|
|
1798
1908
|
mercadoPago?: GenericRedirectDropinOptions['translations'];
|
|
1799
1909
|
addressSelector?: AddressSelectorElementOptions['translations'];
|
|
1800
1910
|
applePayButton?: ApplePayDropinOptions['translations'];
|
|
1911
|
+
leanButton?: LeanDropinOptions['translations'];
|
|
1801
1912
|
errorMessages?: {
|
|
1802
1913
|
[key in ERROR_RESULT]?: string;
|
|
1803
1914
|
};
|
|
@@ -1809,6 +1920,7 @@ interface DropinOptions {
|
|
|
1809
1920
|
googlePayButton?: GooglePayButtonOptions['styles'];
|
|
1810
1921
|
paypalButton?: PaypalDropinOptions['styles'];
|
|
1811
1922
|
applePayButton?: ApplePayButtonOptions['styles'];
|
|
1923
|
+
leanButton?: LeanButtonOptions['styles'];
|
|
1812
1924
|
cardForm?: CardFormOptions['styles'];
|
|
1813
1925
|
cardPaymentButton?: CardPaymentButtonOptions['styles'];
|
|
1814
1926
|
authSuccess?: Partial<CSSStyleDeclaration>;
|
|
@@ -1952,7 +2064,8 @@ interface PayPalScriptConfig {
|
|
|
1952
2064
|
declare enum ThirdPartySDK {
|
|
1953
2065
|
ApplePay = "https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js",
|
|
1954
2066
|
GooglePay = "https://pay.google.com/gp/p/js/pay.js",
|
|
1955
|
-
PayPal = "paypal-sdk"
|
|
2067
|
+
PayPal = "paypal-sdk",
|
|
2068
|
+
Lean = "https://cdn.leantech.me/link/loader/prod/ae/latest/lean-link-loader.min.js"
|
|
1956
2069
|
}
|
|
1957
2070
|
|
|
1958
2071
|
interface QueryDefinition<T> {
|
|
@@ -1988,6 +2101,7 @@ declare class Payrails {
|
|
|
1988
2101
|
private __cardList;
|
|
1989
2102
|
private __cardPaymentButton;
|
|
1990
2103
|
private __paypalButton;
|
|
2104
|
+
private __leanButton;
|
|
1991
2105
|
private __genericRedirectButton;
|
|
1992
2106
|
private __dynamicElementForm;
|
|
1993
2107
|
private __dropin;
|
|
@@ -2015,6 +2129,7 @@ declare class Payrails {
|
|
|
2015
2129
|
getAvailablePaymentMethods(): PaymentMethodCode[];
|
|
2016
2130
|
paymentButton(options: CardPaymentButtonOptions): CardPaymentButton;
|
|
2017
2131
|
paypalButton(options?: PaypalButtonOptions): PaypalButton;
|
|
2132
|
+
leanButton(options: LeanButtonOptions): LeanButton;
|
|
2018
2133
|
genericRedirectButton(options: GenericRedirectButtonOptions): GenericRedirectButton;
|
|
2019
2134
|
dynamicElement(options: DynamicElementOptions): DynamicElementForm;
|
|
2020
2135
|
getSavedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
|
|
@@ -2116,6 +2231,7 @@ declare enum PayrailsEnvironment {
|
|
|
2116
2231
|
PRODUCTION = "PRODUCTION"
|
|
2117
2232
|
}
|
|
2118
2233
|
|
|
2234
|
+
type TelemetryLogLevel = 'debug' | 'error';
|
|
2119
2235
|
interface PayrailsClientOptions {
|
|
2120
2236
|
environment?: PayrailsEnvironment;
|
|
2121
2237
|
events?: ClientEvents;
|
|
@@ -2123,10 +2239,10 @@ interface PayrailsClientOptions {
|
|
|
2123
2239
|
returnInfo?: ReturnInfo;
|
|
2124
2240
|
telemetry?: {
|
|
2125
2241
|
enabled?: boolean;
|
|
2126
|
-
logLevel?:
|
|
2242
|
+
logLevel?: TelemetryLogLevel;
|
|
2127
2243
|
collectMetadata?: boolean;
|
|
2128
2244
|
};
|
|
2129
2245
|
}
|
|
2130
2246
|
|
|
2131
|
-
export { AuthorizationFailureReasons, ElementType, INTEGRATION_TYPE, PAYMENT_METHOD_CODES, Payrails, PayrailsEnvironment };
|
|
2132
|
-
export type { ApplePayButtonOptions, CardFormOptions, CardListOptions, CardPaymentButtonOptions, DropinOptions, ExecutionMeta, ExecutionMetaCustomer, ExecutionMetaKey, GenericRedirectButtonOptions, GooglePayButtonOptions, InitOptions, PaymentEvents, PaypalButtonOptions, PayrailsAmount, PayrailsClientOptions, PayrailsContainerType, PayrailsSecureField, PayrailsSecureFieldEvent, ReturnInfo, SaveInstrumentResponse, WorkflowExecutionResponse };
|
|
2247
|
+
export { AuthorizationFailureReasons, ElementType, INTEGRATION_TYPE, PAYMENT_METHOD_CODES, Payrails, PayrailsCollectContainer, PayrailsEnvironment };
|
|
2248
|
+
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 };
|