@payrails/web-sdk 5.16.0-RC.0 → 5.16.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 +4 -4
- package/package.json +1 -1
- package/payrails-styles.css +38 -0
- package/payrails.d.ts +59 -1
- package/payrails.js +4 -4
package/package.json
CHANGED
package/payrails-styles.css
CHANGED
|
@@ -122,6 +122,44 @@
|
|
|
122
122
|
margin-bottom: 4px;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
.payrails-address-selector-wrapper {
|
|
126
|
+
display: flex;
|
|
127
|
+
flex-wrap: wrap;
|
|
128
|
+
gap: 8px;
|
|
129
|
+
width: 100%;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.payrails-address-selector-wrapper > * {
|
|
133
|
+
width: 100% !important; /* Default width for all children */
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.payrails-address-selector-wrapper > *.hidden {
|
|
137
|
+
display: none;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.payrails-address-selector-wrapper .error {
|
|
141
|
+
border: 1px solid;
|
|
142
|
+
border-color: #f25226;
|
|
143
|
+
background-color: #f9e1e1;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.payrails-country-selector-wrapper,
|
|
147
|
+
.payrails-postal-code-wrapper {
|
|
148
|
+
display: flex;
|
|
149
|
+
width: 100% !important;
|
|
150
|
+
gap: 8px;
|
|
151
|
+
margin-top: 8px;
|
|
152
|
+
position: relative;
|
|
153
|
+
}
|
|
154
|
+
.payrails-country-select-element {
|
|
155
|
+
appearance: none;
|
|
156
|
+
-webkit-appearance: none;
|
|
157
|
+
-moz-appearance: none;
|
|
158
|
+
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
|
|
159
|
+
background-repeat: no-repeat;
|
|
160
|
+
background-position: right 8px center;
|
|
161
|
+
}
|
|
162
|
+
|
|
125
163
|
.payrails-payment-installments-dropdown {
|
|
126
164
|
display: flex;
|
|
127
165
|
flex-wrap: wrap;
|
package/payrails.d.ts
CHANGED
|
@@ -70,6 +70,7 @@ declare class WorkflowExecution {
|
|
|
70
70
|
get authorizeLink(): string | undefined;
|
|
71
71
|
get createSessionLink(): string | undefined;
|
|
72
72
|
get storedPaymentInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
|
|
73
|
+
getFullPaymentMethodConfig(paymentMethod: PAYMENT_METHOD_CODES): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined> | undefined;
|
|
73
74
|
isPaymentInstallmentsEnabled(paymentMethod: PAYMENT_METHOD_CODES): boolean | undefined;
|
|
74
75
|
getPaymentInstallmentOptions(paymentMethod: PAYMENT_METHOD_CODES): PaymentInstallmentsConfig;
|
|
75
76
|
private getStoredInstrumentForPaymentMethod;
|
|
@@ -83,6 +84,7 @@ declare class WorkflowExecution {
|
|
|
83
84
|
flow?: PAYMENT_CLIENT_FLOW;
|
|
84
85
|
supportsInstallments?: boolean;
|
|
85
86
|
installments?: PaymentInstallmentsConfig;
|
|
87
|
+
supportsBillingInfo?: boolean;
|
|
86
88
|
};
|
|
87
89
|
paymentMethodCode: PAYMENT_METHOD_CODES;
|
|
88
90
|
} | undefined;
|
|
@@ -96,6 +98,7 @@ declare class WorkflowExecution {
|
|
|
96
98
|
flow?: PAYMENT_CLIENT_FLOW;
|
|
97
99
|
supportsInstallments?: boolean;
|
|
98
100
|
installments?: PaymentInstallmentsConfig;
|
|
101
|
+
supportsBillingInfo?: boolean;
|
|
99
102
|
};
|
|
100
103
|
paymentMethodCode: PAYMENT_METHOD_CODES;
|
|
101
104
|
};
|
|
@@ -182,6 +185,7 @@ interface StorablePaymentCompositionOption<I = CardMetadata | PayPalMetadata, C
|
|
|
182
185
|
flow?: PAYMENT_CLIENT_FLOW;
|
|
183
186
|
supportsInstallments?: boolean;
|
|
184
187
|
installments?: PaymentInstallmentsConfig;
|
|
188
|
+
supportsBillingInfo?: boolean;
|
|
185
189
|
};
|
|
186
190
|
paymentInstruments?: Array<StoredPaymentInstrument<I>>;
|
|
187
191
|
}
|
|
@@ -527,6 +531,47 @@ declare class PayrailsElement implements Mountable {
|
|
|
527
531
|
unmount(): void;
|
|
528
532
|
}
|
|
529
533
|
|
|
534
|
+
interface IAddress {
|
|
535
|
+
country?: {
|
|
536
|
+
code?: string;
|
|
537
|
+
fullName?: string;
|
|
538
|
+
iso3?: string;
|
|
539
|
+
};
|
|
540
|
+
postalCode?: string;
|
|
541
|
+
}
|
|
542
|
+
interface IOnChange {
|
|
543
|
+
isValid: boolean;
|
|
544
|
+
billingAddress?: IAddress;
|
|
545
|
+
}
|
|
546
|
+
interface AddressSelectorElementOptions extends ElementOptions {
|
|
547
|
+
translations?: {
|
|
548
|
+
labels?: {
|
|
549
|
+
countrySelector?: string;
|
|
550
|
+
postalCodeInput?: string;
|
|
551
|
+
};
|
|
552
|
+
placeholders?: {
|
|
553
|
+
postalCodeInput?: string;
|
|
554
|
+
countrySelector?: string;
|
|
555
|
+
};
|
|
556
|
+
};
|
|
557
|
+
styles?: {
|
|
558
|
+
wrapper?: Partial<CSSStyleDeclaration>;
|
|
559
|
+
countrySelector?: {
|
|
560
|
+
wrapper?: Partial<CSSStyleDeclaration>;
|
|
561
|
+
element?: Partial<CSSStyleDeclaration>;
|
|
562
|
+
label?: Partial<CSSStyleDeclaration>;
|
|
563
|
+
};
|
|
564
|
+
postalCodeInput?: {
|
|
565
|
+
wrapper?: Partial<CSSStyleDeclaration>;
|
|
566
|
+
element?: Partial<CSSStyleDeclaration>;
|
|
567
|
+
label?: Partial<CSSStyleDeclaration>;
|
|
568
|
+
};
|
|
569
|
+
};
|
|
570
|
+
events?: {
|
|
571
|
+
onBillingAddressChanged?: (e: IOnChange) => void;
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
|
|
530
575
|
interface StoreInstrumentElementOptions extends ElementOptions {
|
|
531
576
|
showStoreInstrumentCheckbox?: boolean;
|
|
532
577
|
alwaysStoreInstrument?: boolean;
|
|
@@ -641,6 +686,7 @@ interface OnChange {
|
|
|
641
686
|
isValid: boolean;
|
|
642
687
|
cardNetwork: CardNetwork | '';
|
|
643
688
|
bin?: string;
|
|
689
|
+
billingAddress?: IAddress;
|
|
644
690
|
}
|
|
645
691
|
interface CardFormOptions extends StoreInstrumentElementOptions {
|
|
646
692
|
showCardHolderName?: boolean;
|
|
@@ -657,13 +703,14 @@ interface CardFormOptions extends StoreInstrumentElementOptions {
|
|
|
657
703
|
storeInstrument?: string;
|
|
658
704
|
paymentInstallments?: string;
|
|
659
705
|
};
|
|
706
|
+
addressSelector?: AddressSelectorElementOptions['translations'];
|
|
660
707
|
};
|
|
661
708
|
events?: {
|
|
662
709
|
onFocus?: () => void;
|
|
663
710
|
onChange?: (e: OnChange) => void;
|
|
664
711
|
onSaveInstrumentCheckboxChanged?: PayrailsSDKEvents['onSaveInstrumentCheckboxChanged'];
|
|
665
712
|
onReady?: () => void;
|
|
666
|
-
};
|
|
713
|
+
} & AddressSelectorElementOptions['events'];
|
|
667
714
|
styles?: {
|
|
668
715
|
wrapper?: Partial<CSSStyleDeclaration>;
|
|
669
716
|
base?: Partial<CSSStyleDeclaration>;
|
|
@@ -677,6 +724,7 @@ interface CardFormOptions extends StoreInstrumentElementOptions {
|
|
|
677
724
|
labels?: {
|
|
678
725
|
[key in ElementType | 'all']?: Partial<CSSStyleDeclaration>;
|
|
679
726
|
};
|
|
727
|
+
addressSelector?: AddressSelectorElementOptions['styles'];
|
|
680
728
|
} & StoreInstrumentElementOptions['styles'] & PaymentInstallmentsElementOptions['styles'];
|
|
681
729
|
}
|
|
682
730
|
declare class CardForm extends PayrailsElementWithStoreInstrumentCheckbox {
|
|
@@ -686,12 +734,14 @@ declare class CardForm extends PayrailsElementWithStoreInstrumentCheckbox {
|
|
|
686
734
|
get isBinLookupEnabled(): boolean;
|
|
687
735
|
private readonly formFields;
|
|
688
736
|
private readonly paymentInstallmentsDropdown;
|
|
737
|
+
private readonly addressComponent;
|
|
689
738
|
private throttledFetchBinLookup;
|
|
690
739
|
private lastBin;
|
|
691
740
|
private lastBinLookup;
|
|
692
741
|
constructor(collectContainer: PayrailsCollectContainer, options?: CardFormOptions | undefined);
|
|
693
742
|
throttledFetchBinLookupIfChanged(): Promise<BinLookupResponse | null>;
|
|
694
743
|
tokenize(opts: TokenizeOptions): Promise<SaveInstrumentResponse>;
|
|
744
|
+
private createAddressSelector;
|
|
695
745
|
show(): void;
|
|
696
746
|
hide(): void;
|
|
697
747
|
private triggerOnReady;
|
|
@@ -706,8 +756,10 @@ declare class CardForm extends PayrailsElementWithStoreInstrumentCheckbox {
|
|
|
706
756
|
storeInstrument: boolean;
|
|
707
757
|
selectedInstallment: number | undefined;
|
|
708
758
|
enrollInstrumentToNetworkOffers: boolean;
|
|
759
|
+
billingInfo: IAddress | undefined;
|
|
709
760
|
}>;
|
|
710
761
|
protected get selectedInstallment(): number | undefined;
|
|
762
|
+
protected get billingAddress(): IAddress | undefined;
|
|
711
763
|
private enforceEnrollInstrumentToNetworkOffersForMasterCard;
|
|
712
764
|
fetchBinLookup(): Promise<string | {
|
|
713
765
|
bin: string;
|
|
@@ -1029,6 +1081,7 @@ interface DropinOptions {
|
|
|
1029
1081
|
};
|
|
1030
1082
|
paypalButton?: PaypalDropinOptions['translations'];
|
|
1031
1083
|
mercadoPago?: GenericRedirectDropinOptions['translations'];
|
|
1084
|
+
addressSelector?: AddressSelectorElementOptions['translations'];
|
|
1032
1085
|
};
|
|
1033
1086
|
styles?: {
|
|
1034
1087
|
[key: string]: any;
|
|
@@ -1041,6 +1094,7 @@ interface DropinOptions {
|
|
|
1041
1094
|
cardPaymentButton?: CardPaymentButtonOptions['styles'];
|
|
1042
1095
|
authSuccess?: Partial<CSSStyleDeclaration>;
|
|
1043
1096
|
authFailed?: Partial<CSSStyleDeclaration>;
|
|
1097
|
+
addressSelector?: AddressSelectorElementOptions['styles'];
|
|
1044
1098
|
mercadoPago?: GenericRedirectDropinOptions['styles'];
|
|
1045
1099
|
};
|
|
1046
1100
|
}
|
|
@@ -1157,6 +1211,10 @@ interface UIEvents {
|
|
|
1157
1211
|
onSaveInstrumentCheckboxChanged?: ({ checked }: {
|
|
1158
1212
|
checked: boolean;
|
|
1159
1213
|
}) => void;
|
|
1214
|
+
onBillingAddressChanged?: (e: {
|
|
1215
|
+
isValid: boolean;
|
|
1216
|
+
billingAddress?: IAddress;
|
|
1217
|
+
}) => void;
|
|
1160
1218
|
}
|
|
1161
1219
|
type onPaymentMethodSelectedParams = {
|
|
1162
1220
|
paymentMethod?: StorablePaymentCompositionOption;
|