@payrails/web-sdk 5.16.0-RC.0 → 5.16.0-RC.1
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 +23 -0
- package/payrails.d.ts +44 -1
- package/payrails.js +4 -4
package/package.json
CHANGED
package/payrails-styles.css
CHANGED
|
@@ -122,6 +122,29 @@
|
|
|
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: 48% !important; /* Default width for all children */
|
|
134
|
+
}
|
|
135
|
+
/* Styles for when there's only one child */
|
|
136
|
+
.payrails-address-selector-wrapper > *:first-child:last-child {
|
|
137
|
+
width: 100% !important;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.payrails-address-selector-wrapper > *.hidden {
|
|
141
|
+
display: none;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.payrails-address-selector-wrapper .payrails-error {
|
|
145
|
+
border-color: red;
|
|
146
|
+
}
|
|
147
|
+
|
|
125
148
|
.payrails-payment-installments-dropdown {
|
|
126
149
|
display: flex;
|
|
127
150
|
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
|
}
|
|
@@ -600,6 +604,34 @@ declare const regexes: {
|
|
|
600
604
|
};
|
|
601
605
|
type CardNetwork = keyof typeof regexes;
|
|
602
606
|
|
|
607
|
+
interface IAddress {
|
|
608
|
+
country?: {
|
|
609
|
+
code?: string;
|
|
610
|
+
fullName?: string;
|
|
611
|
+
iso3?: string;
|
|
612
|
+
};
|
|
613
|
+
postalCode?: string;
|
|
614
|
+
}
|
|
615
|
+
interface IOnChange {
|
|
616
|
+
isValid: boolean;
|
|
617
|
+
billingAddress?: IAddress;
|
|
618
|
+
}
|
|
619
|
+
interface AddressSelectorElementOptions extends ElementOptions {
|
|
620
|
+
translations?: {
|
|
621
|
+
COUNTRY_SELECTOR?: string;
|
|
622
|
+
POSTAL_CODE_INPUT?: string;
|
|
623
|
+
};
|
|
624
|
+
styles?: {
|
|
625
|
+
wrapper?: Partial<CSSStyleDeclaration>;
|
|
626
|
+
countrySelector?: Partial<CSSStyleDeclaration>;
|
|
627
|
+
postalCodeInput?: Partial<CSSStyleDeclaration>;
|
|
628
|
+
};
|
|
629
|
+
events?: {
|
|
630
|
+
onBillingAddressChanged?: (address: IAddress) => void;
|
|
631
|
+
onChange?: (e: IOnChange) => void;
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
|
|
603
635
|
interface PaymentInstallmentsElementOptions extends ElementOptions {
|
|
604
636
|
showPaymentInstallmentsDropdown?: boolean;
|
|
605
637
|
installmentOptions?: BaseInstallmentOption[] | null;
|
|
@@ -641,6 +673,7 @@ interface OnChange {
|
|
|
641
673
|
isValid: boolean;
|
|
642
674
|
cardNetwork: CardNetwork | '';
|
|
643
675
|
bin?: string;
|
|
676
|
+
billingAddress?: IAddress;
|
|
644
677
|
}
|
|
645
678
|
interface CardFormOptions extends StoreInstrumentElementOptions {
|
|
646
679
|
showCardHolderName?: boolean;
|
|
@@ -657,13 +690,14 @@ interface CardFormOptions extends StoreInstrumentElementOptions {
|
|
|
657
690
|
storeInstrument?: string;
|
|
658
691
|
paymentInstallments?: string;
|
|
659
692
|
};
|
|
693
|
+
addressSelector?: AddressSelectorElementOptions['translations'];
|
|
660
694
|
};
|
|
661
695
|
events?: {
|
|
662
696
|
onFocus?: () => void;
|
|
663
697
|
onChange?: (e: OnChange) => void;
|
|
664
698
|
onSaveInstrumentCheckboxChanged?: PayrailsSDKEvents['onSaveInstrumentCheckboxChanged'];
|
|
665
699
|
onReady?: () => void;
|
|
666
|
-
};
|
|
700
|
+
} & AddressSelectorElementOptions['events'];
|
|
667
701
|
styles?: {
|
|
668
702
|
wrapper?: Partial<CSSStyleDeclaration>;
|
|
669
703
|
base?: Partial<CSSStyleDeclaration>;
|
|
@@ -677,6 +711,7 @@ interface CardFormOptions extends StoreInstrumentElementOptions {
|
|
|
677
711
|
labels?: {
|
|
678
712
|
[key in ElementType | 'all']?: Partial<CSSStyleDeclaration>;
|
|
679
713
|
};
|
|
714
|
+
addressSelector?: AddressSelectorElementOptions['styles'];
|
|
680
715
|
} & StoreInstrumentElementOptions['styles'] & PaymentInstallmentsElementOptions['styles'];
|
|
681
716
|
}
|
|
682
717
|
declare class CardForm extends PayrailsElementWithStoreInstrumentCheckbox {
|
|
@@ -686,12 +721,14 @@ declare class CardForm extends PayrailsElementWithStoreInstrumentCheckbox {
|
|
|
686
721
|
get isBinLookupEnabled(): boolean;
|
|
687
722
|
private readonly formFields;
|
|
688
723
|
private readonly paymentInstallmentsDropdown;
|
|
724
|
+
private readonly addressComponent;
|
|
689
725
|
private throttledFetchBinLookup;
|
|
690
726
|
private lastBin;
|
|
691
727
|
private lastBinLookup;
|
|
692
728
|
constructor(collectContainer: PayrailsCollectContainer, options?: CardFormOptions | undefined);
|
|
693
729
|
throttledFetchBinLookupIfChanged(): Promise<BinLookupResponse | null>;
|
|
694
730
|
tokenize(opts: TokenizeOptions): Promise<SaveInstrumentResponse>;
|
|
731
|
+
private createAddressSelector;
|
|
695
732
|
show(): void;
|
|
696
733
|
hide(): void;
|
|
697
734
|
private triggerOnReady;
|
|
@@ -706,8 +743,10 @@ declare class CardForm extends PayrailsElementWithStoreInstrumentCheckbox {
|
|
|
706
743
|
storeInstrument: boolean;
|
|
707
744
|
selectedInstallment: number | undefined;
|
|
708
745
|
enrollInstrumentToNetworkOffers: boolean;
|
|
746
|
+
billingInfo: IAddress | undefined;
|
|
709
747
|
}>;
|
|
710
748
|
protected get selectedInstallment(): number | undefined;
|
|
749
|
+
protected get billingAddress(): IAddress | undefined;
|
|
711
750
|
private enforceEnrollInstrumentToNetworkOffersForMasterCard;
|
|
712
751
|
fetchBinLookup(): Promise<string | {
|
|
713
752
|
bin: string;
|
|
@@ -1029,6 +1068,7 @@ interface DropinOptions {
|
|
|
1029
1068
|
};
|
|
1030
1069
|
paypalButton?: PaypalDropinOptions['translations'];
|
|
1031
1070
|
mercadoPago?: GenericRedirectDropinOptions['translations'];
|
|
1071
|
+
addressSelector?: AddressSelectorElementOptions['translations'];
|
|
1032
1072
|
};
|
|
1033
1073
|
styles?: {
|
|
1034
1074
|
[key: string]: any;
|
|
@@ -1041,6 +1081,7 @@ interface DropinOptions {
|
|
|
1041
1081
|
cardPaymentButton?: CardPaymentButtonOptions['styles'];
|
|
1042
1082
|
authSuccess?: Partial<CSSStyleDeclaration>;
|
|
1043
1083
|
authFailed?: Partial<CSSStyleDeclaration>;
|
|
1084
|
+
addressSelector?: AddressSelectorElementOptions['styles'];
|
|
1044
1085
|
mercadoPago?: GenericRedirectDropinOptions['styles'];
|
|
1045
1086
|
};
|
|
1046
1087
|
}
|
|
@@ -1157,6 +1198,7 @@ interface UIEvents {
|
|
|
1157
1198
|
onSaveInstrumentCheckboxChanged?: ({ checked }: {
|
|
1158
1199
|
checked: boolean;
|
|
1159
1200
|
}) => void;
|
|
1201
|
+
onBillingAddressChanged?: (e: any) => void;
|
|
1160
1202
|
}
|
|
1161
1203
|
type onPaymentMethodSelectedParams = {
|
|
1162
1204
|
paymentMethod?: StorablePaymentCompositionOption;
|
|
@@ -1164,6 +1206,7 @@ type onPaymentMethodSelectedParams = {
|
|
|
1164
1206
|
};
|
|
1165
1207
|
interface DropinEvents {
|
|
1166
1208
|
onPaymentOptionSelected?: (e: onPaymentMethodSelectedParams) => void;
|
|
1209
|
+
onBillingAddressChanged?: (e: any) => void;
|
|
1167
1210
|
}
|
|
1168
1211
|
type PayrailsSDKEvents = PaymentEvents & UIEvents & DropinEvents;
|
|
1169
1212
|
interface SdkConfiguration {
|