@payrails/web-sdk 5.2.0 → 5.4.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/index.js +5 -4
- package/package.json +1 -1
- package/payrails-styles.css +80 -3
- package/payrails.d.ts +57 -41
package/package.json
CHANGED
package/payrails-styles.css
CHANGED
|
@@ -34,7 +34,9 @@
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
#payrails-card-payment-button .dot-flashing {
|
|
37
|
-
position:
|
|
37
|
+
position: absolute;
|
|
38
|
+
left: auto;
|
|
39
|
+
right: auto;
|
|
38
40
|
width: 10px;
|
|
39
41
|
height: 10px;
|
|
40
42
|
border-radius: 5px;
|
|
@@ -73,11 +75,11 @@
|
|
|
73
75
|
|
|
74
76
|
@keyframes dot-flashing {
|
|
75
77
|
0% {
|
|
76
|
-
|
|
78
|
+
opacity: 1;
|
|
77
79
|
}
|
|
78
80
|
50%,
|
|
79
81
|
100% {
|
|
80
|
-
|
|
82
|
+
opacity: .2;
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
85
|
|
|
@@ -157,6 +159,15 @@
|
|
|
157
159
|
font-weight: bolder;
|
|
158
160
|
}
|
|
159
161
|
|
|
162
|
+
.payment-option-text {
|
|
163
|
+
display: inline-flex;
|
|
164
|
+
align-items: center;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.payment-option-icon {
|
|
168
|
+
width: 24px;
|
|
169
|
+
margin-right: 7px;
|
|
170
|
+
}
|
|
160
171
|
#payrails-dropin-component {
|
|
161
172
|
border-radius: 0;
|
|
162
173
|
box-shadow: none;
|
|
@@ -465,6 +476,72 @@
|
|
|
465
476
|
}
|
|
466
477
|
}
|
|
467
478
|
|
|
479
|
+
.payrails-generic-button * {
|
|
480
|
+
box-sizing: border-box;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
.payrails-generic-button .dot-flashing-container {
|
|
484
|
+
width: 100%;
|
|
485
|
+
display: flex;
|
|
486
|
+
justify-content: center;
|
|
487
|
+
align-items: center;
|
|
488
|
+
position: relative;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
.payrails-generic-button .dot-flashing-text {
|
|
492
|
+
visibility: hidden;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
.payrails-generic-button .dot-flashing {
|
|
496
|
+
position: absolute;
|
|
497
|
+
left: auto;
|
|
498
|
+
right: auto;
|
|
499
|
+
width: 10px;
|
|
500
|
+
height: 10px;
|
|
501
|
+
border-radius: 5px;
|
|
502
|
+
background-color: currentColor;
|
|
503
|
+
color: currentColor;
|
|
504
|
+
animation: dot-flashing 1s infinite linear alternate;
|
|
505
|
+
animation-delay: 0.5s;
|
|
506
|
+
}
|
|
507
|
+
.payrails-generic-button .dot-flashing::before,
|
|
508
|
+
.payrails-generic-button .dot-flashing::after {
|
|
509
|
+
content: '';
|
|
510
|
+
display: inline-block;
|
|
511
|
+
position: absolute;
|
|
512
|
+
top: 0;
|
|
513
|
+
}
|
|
514
|
+
.payrails-generic-button .dot-flashing::before {
|
|
515
|
+
left: -15px;
|
|
516
|
+
width: 10px;
|
|
517
|
+
height: 10px;
|
|
518
|
+
border-radius: 5px;
|
|
519
|
+
background-color: currentColor;
|
|
520
|
+
color: currentColor;
|
|
521
|
+
animation: dot-flashing 1s infinite alternate;
|
|
522
|
+
animation-delay: 0s;
|
|
523
|
+
}
|
|
524
|
+
.payrails-generic-button .dot-flashing::after {
|
|
525
|
+
left: 15px;
|
|
526
|
+
width: 10px;
|
|
527
|
+
height: 10px;
|
|
528
|
+
border-radius: 5px;
|
|
529
|
+
background-color: currentColor;
|
|
530
|
+
color: currentColor;
|
|
531
|
+
animation: dot-flashing 1s infinite alternate;
|
|
532
|
+
animation-delay: 1s;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
@keyframes dot-flashing {
|
|
536
|
+
0% {
|
|
537
|
+
opacity: 1;
|
|
538
|
+
}
|
|
539
|
+
50%,
|
|
540
|
+
100% {
|
|
541
|
+
opacity: .2;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
|
|
468
545
|
#payrails-paypal-button-wrapper {
|
|
469
546
|
min-height: 44px;
|
|
470
547
|
margin: 8px 4px;
|
package/payrails.d.ts
CHANGED
|
@@ -540,12 +540,11 @@ declare class ApplePayButton extends PayrailsElementWithStoreInstrumentCheckbox
|
|
|
540
540
|
private execution;
|
|
541
541
|
protected options: ApplePayButtonOptions;
|
|
542
542
|
private appleButton;
|
|
543
|
-
private loadScript;
|
|
544
543
|
private paymentExecutor;
|
|
544
|
+
static isApplePayAvailable(): Promise<boolean>;
|
|
545
545
|
constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options: ApplePayButtonOptions);
|
|
546
546
|
mount(location: string): void;
|
|
547
547
|
unmount(): void;
|
|
548
|
-
private isApplePayAvailable;
|
|
549
548
|
private mountApplePayButton;
|
|
550
549
|
private createApplePaySession;
|
|
551
550
|
private onApplePayAuthorized;
|
|
@@ -700,11 +699,8 @@ declare enum AuthorizationFailureReasons {
|
|
|
700
699
|
}
|
|
701
700
|
|
|
702
701
|
interface GooglePayButtonOptions extends StoreInstrumentElementOptions {
|
|
703
|
-
environment?:
|
|
704
|
-
merchantInfo?:
|
|
705
|
-
merchantId: string;
|
|
706
|
-
merchantName?: string;
|
|
707
|
-
};
|
|
702
|
+
environment?: PayrailsEnvironment;
|
|
703
|
+
merchantInfo?: google.payments.api.MerchantInfo;
|
|
708
704
|
events?: PaymentEvents & UIEvents & {
|
|
709
705
|
onGooglePayAvailable?: () => void;
|
|
710
706
|
};
|
|
@@ -721,7 +717,9 @@ declare class GooglePayButton extends PayrailsElementWithStoreInstrumentCheckbox
|
|
|
721
717
|
protected options: GooglePayButtonOptions;
|
|
722
718
|
private googleButton;
|
|
723
719
|
private readonly paymentExecutor;
|
|
724
|
-
private
|
|
720
|
+
private static googleSDKClient;
|
|
721
|
+
private static getSDKClient;
|
|
722
|
+
static isGooglePayAvailable(allowedPaymentMethods: google.payments.api.IsReadyToPayPaymentMethodSpecification[], environment?: PayrailsEnvironment, merchantInfo?: google.payments.api.MerchantInfo): Promise<boolean>;
|
|
725
723
|
constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options: GooglePayButtonOptions);
|
|
726
724
|
private sdkLoaded;
|
|
727
725
|
private onLoadPaymentData;
|
|
@@ -737,24 +735,25 @@ interface DropinElementEvents extends PaymentEvents {
|
|
|
737
735
|
interface DropinElementStyles {
|
|
738
736
|
base?: Partial<CSSStyleDeclaration>;
|
|
739
737
|
active?: Partial<CSSStyleDeclaration>;
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
interface ButtonOptions {
|
|
741
|
+
id: string;
|
|
742
|
+
events?: PayrailsSDKEvents & {
|
|
743
|
+
onClick?: () => Promise<void>;
|
|
744
|
+
};
|
|
745
|
+
translations: {
|
|
746
|
+
label: string;
|
|
747
|
+
};
|
|
748
|
+
styles?: {
|
|
749
|
+
base?: Partial<CSSStyleDeclaration>;
|
|
750
|
+
loading?: Partial<CSSStyleDeclaration>;
|
|
751
|
+
hover?: Partial<CSSStyleDeclaration>;
|
|
752
|
+
};
|
|
754
753
|
}
|
|
755
754
|
|
|
756
755
|
interface GenericRedirectButtonOptions {
|
|
757
|
-
styles?:
|
|
756
|
+
styles?: ButtonOptions['styles'];
|
|
758
757
|
translations?: {
|
|
759
758
|
label?: string;
|
|
760
759
|
};
|
|
@@ -762,33 +761,22 @@ interface GenericRedirectButtonOptions {
|
|
|
762
761
|
}
|
|
763
762
|
declare class GenericRedirectButton extends PayrailsElement {
|
|
764
763
|
private sdkConfig;
|
|
765
|
-
private execution;
|
|
766
764
|
protected options: GenericRedirectButtonOptions;
|
|
767
765
|
private readonly returnInfo?;
|
|
768
|
-
private button;
|
|
769
766
|
constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options: GenericRedirectButtonOptions, returnInfo?: ReturnInfo | undefined);
|
|
767
|
+
private buildRedirectButton;
|
|
770
768
|
private paymentExecutor;
|
|
771
769
|
private onClick;
|
|
772
|
-
private configureButton;
|
|
773
770
|
mount(location: string): void;
|
|
774
771
|
}
|
|
775
772
|
|
|
776
773
|
interface GenericRedirectDropinOptions {
|
|
777
|
-
styles?:
|
|
778
|
-
button?: GenericRedirectButtonOptions['styles'];
|
|
779
|
-
} & DropinElementStyles;
|
|
774
|
+
styles?: DropinElementStyles;
|
|
780
775
|
translations?: {
|
|
781
776
|
label?: string;
|
|
782
777
|
button?: GenericRedirectButtonOptions['translations'];
|
|
783
778
|
};
|
|
784
779
|
events?: DropinElementEvents & PaymentEvents;
|
|
785
|
-
}
|
|
786
|
-
declare class MercadoPagoDropin extends DropinElement {
|
|
787
|
-
private sdkConfig;
|
|
788
|
-
private execution;
|
|
789
|
-
private readonly returnInfo?;
|
|
790
|
-
protected component: GenericRedirectButton;
|
|
791
|
-
constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options?: GenericRedirectDropinOptions, returnInfo?: ReturnInfo | undefined);
|
|
792
780
|
}
|
|
793
781
|
|
|
794
782
|
interface GooglePayDropinOptions extends GooglePayButtonOptions {
|
|
@@ -822,11 +810,11 @@ declare class PaypalButton extends PayrailsElementWithStoreInstrumentCheckbox {
|
|
|
822
810
|
fraudNetGuid: string | undefined;
|
|
823
811
|
private paymentExecutor;
|
|
824
812
|
private button;
|
|
825
|
-
private paypalLoader;
|
|
826
813
|
private confirmLink;
|
|
827
814
|
private buttonWrapperId;
|
|
828
815
|
private checkboxWrapperId;
|
|
829
816
|
private loadPaypal;
|
|
817
|
+
private get paypalScriptConfig();
|
|
830
818
|
private createPaypalButton;
|
|
831
819
|
private createPayPalButtonConfig;
|
|
832
820
|
private createBillingAgreementConfig;
|
|
@@ -917,10 +905,32 @@ interface DropinOptions {
|
|
|
917
905
|
applePayButton?: ApplePayButtonOptions['styles'];
|
|
918
906
|
cardForm?: CardFormOptions['styles'];
|
|
919
907
|
cardPaymentButton?: CardPaymentButtonOptions['styles'];
|
|
920
|
-
mercadoPago?:
|
|
908
|
+
mercadoPago?: GenericRedirectDropinOptions['styles'];
|
|
921
909
|
};
|
|
922
910
|
}
|
|
923
911
|
|
|
912
|
+
declare class SdkLoader {
|
|
913
|
+
static load<T = void>(sdk: ThirdPartySDK, params?: PayPalScriptConfig): Promise<T>;
|
|
914
|
+
static reset(): void;
|
|
915
|
+
static preloadCardForm(): void;
|
|
916
|
+
private static loadScript;
|
|
917
|
+
private static loadPayPalScript;
|
|
918
|
+
private static readonly scriptMap;
|
|
919
|
+
private constructor();
|
|
920
|
+
private static logLoadError;
|
|
921
|
+
}
|
|
922
|
+
interface PayPalScriptConfig {
|
|
923
|
+
clientId: string;
|
|
924
|
+
currency: string;
|
|
925
|
+
vault: boolean;
|
|
926
|
+
intent: 'tokenize' | 'capture' | 'authorize';
|
|
927
|
+
}
|
|
928
|
+
declare enum ThirdPartySDK {
|
|
929
|
+
ApplePay = "https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js",
|
|
930
|
+
GooglePay = "https://pay.google.com/gp/p/js/pay.js",
|
|
931
|
+
PayPal = "paypal-sdk"
|
|
932
|
+
}
|
|
933
|
+
|
|
924
934
|
type FraudNetPageId = 'home-page' | 'search-result-page' | 'category-page' | 'product-detail-page' | 'cart-page' | 'inline-cart-page' | 'checkout-page';
|
|
925
935
|
declare class FraudNet implements Mountable {
|
|
926
936
|
private pageId;
|
|
@@ -940,7 +950,7 @@ declare class FraudNet implements Mountable {
|
|
|
940
950
|
}
|
|
941
951
|
|
|
942
952
|
interface PayrailsClientOptions {
|
|
943
|
-
environment?:
|
|
953
|
+
environment?: PayrailsEnvironment;
|
|
944
954
|
events?: {
|
|
945
955
|
onClientInitialized: (execution: WorkflowExecution) => void;
|
|
946
956
|
};
|
|
@@ -962,12 +972,14 @@ declare class Payrails {
|
|
|
962
972
|
private __fraudNet;
|
|
963
973
|
private __paypalButton;
|
|
964
974
|
private __genericRedirectButton;
|
|
965
|
-
static preloadCardForm:
|
|
975
|
+
static preloadCardForm: typeof SdkLoader.preloadCardForm;
|
|
966
976
|
static init(initResponse: InitOptions, options?: PayrailsClientOptions): Payrails;
|
|
967
977
|
update(amount: PayrailsAmount): void;
|
|
968
978
|
collectContainer(containerOptions: CollectContainerOptions): PayrailsCollectContainer;
|
|
969
979
|
googlePayButton(options: GooglePayButtonOptions): GooglePayButton;
|
|
980
|
+
isGooglePayAvailable(merchantInfo: google.payments.api.MerchantInfo): Promise<boolean>;
|
|
970
981
|
applePayButton(options: ApplePayButtonOptions): ApplePayButton;
|
|
982
|
+
isApplePayAvailable(): Promise<boolean>;
|
|
971
983
|
cardList(options?: CardListOptions): CardList;
|
|
972
984
|
cardForm(options?: CardFormOptions): CardForm;
|
|
973
985
|
dropin(options: DropinOptions): Dropin;
|
|
@@ -1029,6 +1041,10 @@ interface SdkConfiguration {
|
|
|
1029
1041
|
interface PayrailsAmount {
|
|
1030
1042
|
value: string;
|
|
1031
1043
|
currency: string;
|
|
1044
|
+
}
|
|
1045
|
+
declare enum PayrailsEnvironment {
|
|
1046
|
+
TEST = "TEST",
|
|
1047
|
+
PRODUCTION = "PRODUCTION"
|
|
1032
1048
|
}
|
|
1033
1049
|
|
|
1034
1050
|
type TokenizedCollectResult = {
|
|
@@ -1112,4 +1128,4 @@ interface TokenizeOptions {
|
|
|
1112
1128
|
storeInstrument?: boolean;
|
|
1113
1129
|
}
|
|
1114
1130
|
|
|
1115
|
-
export { ApplePayButtonOptions, AuthorizationFailureReasons, CardFormOptions, CardListOptions, CardPaymentButtonOptions, DropinOptions, ElementType, GooglePayButtonOptions, InitOptions, PaymentEvents, PaypalButtonOptions, Payrails, PayrailsAmount, PayrailsClientOptions, PayrailsContainerType, PayrailsSecureField, SaveInstrumentResponse, WorkflowExecutionResponse };
|
|
1131
|
+
export { ApplePayButtonOptions, AuthorizationFailureReasons, CardFormOptions, CardListOptions, CardPaymentButtonOptions, DropinOptions, ElementType, GooglePayButtonOptions, InitOptions, PaymentEvents, PaypalButtonOptions, Payrails, PayrailsAmount, PayrailsClientOptions, PayrailsContainerType, PayrailsEnvironment, PayrailsSecureField, SaveInstrumentResponse, WorkflowExecutionResponse };
|