@primer-io/primer-js 1.6.3 → 1.7.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/CHANGELOG.md +12 -0
- package/dist/custom-elements.json +288 -238
- package/dist/jsx/index.d.ts +21 -1
- package/dist/primer-loader.d.ts +207 -247
- package/dist/primer-loader.js +41 -41
- package/dist/vscode.html-custom-data.json +13 -1
- package/dist/web-types.json +30 -3
- package/package.json +1 -1
package/dist/primer-loader.d.ts
CHANGED
|
@@ -537,6 +537,17 @@ export interface PaymentRenderButtonOptions {
|
|
|
537
537
|
shadowRoot?: ShadowRoot | null;
|
|
538
538
|
};
|
|
539
539
|
}
|
|
540
|
+
/**
|
|
541
|
+
* Field validation state (mirrors @primer-io/sdk-utils/iframes/types)
|
|
542
|
+
*/
|
|
543
|
+
export interface FieldState {
|
|
544
|
+
valid: boolean;
|
|
545
|
+
dirty: boolean;
|
|
546
|
+
touched: boolean;
|
|
547
|
+
focused: boolean;
|
|
548
|
+
disabled: boolean;
|
|
549
|
+
error: string;
|
|
550
|
+
}
|
|
540
551
|
export interface BaseInputStyle {
|
|
541
552
|
background?: string;
|
|
542
553
|
borderColor?: number | string;
|
|
@@ -680,35 +691,16 @@ export interface TelemetryClient {
|
|
|
680
691
|
dispose(): void;
|
|
681
692
|
}
|
|
682
693
|
declare enum HeadlessManagerType {
|
|
694
|
+
BACKEND_DRIVEN = "BACKEND_DRIVEN",
|
|
683
695
|
BLIK = "BLIK",
|
|
684
696
|
CARD = "CARD",
|
|
685
697
|
NATIVE = "NATIVE",
|
|
686
698
|
REDIRECT = "REDIRECT",
|
|
687
699
|
KLARNA = "KLARNA",
|
|
688
700
|
ADYEN_KLARNA = "ADYEN_KLARNA",
|
|
689
|
-
ACH = "ACH",
|
|
690
701
|
MBWAY = "MBWAY",
|
|
691
702
|
QRCODE = "QRCODE"
|
|
692
703
|
}
|
|
693
|
-
export type PaymentMethodInfo = {
|
|
694
|
-
type: PaymentMethodType;
|
|
695
|
-
managerType: HeadlessManagerType;
|
|
696
|
-
};
|
|
697
|
-
declare enum EventTypes {
|
|
698
|
-
CHANGE = "change",
|
|
699
|
-
ENTER = "ENTER",
|
|
700
|
-
ERROR = "error",
|
|
701
|
-
FOCUS = "focus",
|
|
702
|
-
BLUR = "blur",
|
|
703
|
-
CLICK = "click",
|
|
704
|
-
CLOSE = "close",
|
|
705
|
-
INPUT = "input",
|
|
706
|
-
CONFIRMED_KLARNA_CATEGORY = "CONFIRMED_KLARNA_CATEGORY",
|
|
707
|
-
CONFIRMED_KLARNA_CATEGORY_ERROR = "CONFIRMED_KLARNA_CATEGORY_ERROR",
|
|
708
|
-
KLARNA_SESSION_UPDATE = "KLARNA_SESSION_UPDATE",
|
|
709
|
-
KLARNA_SESSION_REFRESH_ERROR = "KLARNA_SESSION_REFRESH_ERROR"
|
|
710
|
-
}
|
|
711
|
-
type EventListener$1 = (event?: Event) => void;
|
|
712
704
|
export interface PayPalOptionsWithPaypalJsTypes {
|
|
713
705
|
/**
|
|
714
706
|
* Button style configuration with optional per-funding-source overrides.
|
|
@@ -788,41 +780,32 @@ export interface Payment {
|
|
|
788
780
|
[key: string]: unknown;
|
|
789
781
|
};
|
|
790
782
|
}
|
|
791
|
-
export interface HeadlessHostedInputOptions {
|
|
792
|
-
placeholder?: string;
|
|
793
|
-
ariaLabel?: string;
|
|
794
|
-
style?: Record<string, unknown>;
|
|
795
|
-
}
|
|
796
783
|
export interface CardPaymentMethodSubmitValues {
|
|
797
784
|
cardNetwork?: string;
|
|
798
785
|
}
|
|
799
|
-
export interface
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
}
|
|
805
|
-
export interface KlarnaPaymentMethodManagerOptions {
|
|
806
|
-
onPaymentMethodCategoriesChange?: (categories: {
|
|
807
|
-
id: string;
|
|
808
|
-
name: string;
|
|
809
|
-
descriptiveAssetUrl: string;
|
|
810
|
-
standardAssetUrl: string;
|
|
811
|
-
}[]) => void;
|
|
812
|
-
onPaymentMethodAction?: (action: string, data: {
|
|
813
|
-
paymentMethodType: string;
|
|
814
|
-
category: string;
|
|
815
|
-
}) => void;
|
|
786
|
+
export interface KlarnaPaymentCategory {
|
|
787
|
+
name: string;
|
|
788
|
+
identifier: string;
|
|
789
|
+
standardAssetUrl: string;
|
|
790
|
+
descriptiveAssetUrl: string;
|
|
816
791
|
}
|
|
817
|
-
export interface
|
|
792
|
+
export interface KlarnaPaymentMethod {
|
|
793
|
+
type: typeof PaymentMethodType.KLARNA;
|
|
794
|
+
managerType: HeadlessManagerType.KLARNA;
|
|
795
|
+
getCategories: () => KlarnaPaymentCategory[];
|
|
818
796
|
renderCategory: (params: {
|
|
819
797
|
containerId: string | HTMLElement;
|
|
820
798
|
paymentMethodCategoryId: string;
|
|
821
799
|
onHeightChange?: (height: number) => void;
|
|
822
800
|
}) => Promise<void>;
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
801
|
+
/**
|
|
802
|
+
* Set the selected payment category for the payment flow
|
|
803
|
+
*/
|
|
804
|
+
setSelectedCategory: (categoryId: string) => void;
|
|
805
|
+
/**
|
|
806
|
+
* Start the payment flow with the selected category
|
|
807
|
+
*/
|
|
808
|
+
start: () => Promise<void>;
|
|
826
809
|
}
|
|
827
810
|
/**
|
|
828
811
|
* Adyen Klarna payment type option
|
|
@@ -832,25 +815,18 @@ export interface AdyenKlarnaPaymentOption {
|
|
|
832
815
|
label: string;
|
|
833
816
|
}
|
|
834
817
|
/**
|
|
835
|
-
*
|
|
836
|
-
*/
|
|
837
|
-
export interface AdyenKlarnaPaymentMethodManagerOptions {
|
|
838
|
-
/**
|
|
839
|
-
* Callback when payment options change (e.g., Pay Now, Pay Later)
|
|
840
|
-
*/
|
|
841
|
-
onPaymentOptionsChange?: (options: AdyenKlarnaPaymentOption[]) => void;
|
|
842
|
-
}
|
|
843
|
-
/**
|
|
844
|
-
* Adyen Klarna Payment Method Manager
|
|
818
|
+
* Adyen Klarna Payment Method
|
|
845
819
|
*
|
|
846
820
|
* Unlike direct Klarna integration, Adyen Klarna uses a redirect flow
|
|
847
821
|
* with payment type selection (Pay Now, Pay Later, etc.)
|
|
848
822
|
*/
|
|
849
|
-
export interface
|
|
823
|
+
export interface AdyenKlarnaPaymentMethod {
|
|
824
|
+
type: typeof PaymentMethodType.ADYEN_KLARNA;
|
|
825
|
+
managerType: HeadlessManagerType.ADYEN_KLARNA;
|
|
850
826
|
/**
|
|
851
827
|
* Get available payment options
|
|
852
828
|
*/
|
|
853
|
-
|
|
829
|
+
getOptions: () => AdyenKlarnaPaymentOption[];
|
|
854
830
|
/**
|
|
855
831
|
* Select a payment option
|
|
856
832
|
*/
|
|
@@ -860,10 +836,6 @@ export interface AdyenKlarnaPaymentMethodManager {
|
|
|
860
836
|
*/
|
|
861
837
|
start: () => Promise<void>;
|
|
862
838
|
}
|
|
863
|
-
export interface AchPaymentMethodManagerOptions {
|
|
864
|
-
onCollectBankAccountDetailsComplete?: () => void;
|
|
865
|
-
}
|
|
866
|
-
export type PaymentMethodManagerOptions = CardPaymentMethodManagerOptions | KlarnaPaymentMethodManagerOptions | AdyenKlarnaPaymentMethodManagerOptions | AchPaymentMethodManagerOptions | Record<string, unknown>;
|
|
867
839
|
export interface VaultListItem {
|
|
868
840
|
id: string;
|
|
869
841
|
analyticsId: string;
|
|
@@ -1033,29 +1005,13 @@ export interface KlarnaVaultedPaymentMethodSummary extends BaseVaultedPaymentMet
|
|
|
1033
1005
|
};
|
|
1034
1006
|
};
|
|
1035
1007
|
}
|
|
1036
|
-
/**
|
|
1037
|
-
* Vaulted ACH (Automated Clearing House) summary with ACH-specific fields.
|
|
1038
|
-
*/
|
|
1039
|
-
export interface ACHVaultedPaymentMethodSummary extends BaseVaultedPaymentMethodSummary {
|
|
1040
|
-
/** Discriminant for ACH instruments */
|
|
1041
|
-
paymentInstrumentType: "AUTOMATED_CLEARING_HOUSE";
|
|
1042
|
-
/** ACH-specific payment instrument data */
|
|
1043
|
-
paymentInstrumentData?: {
|
|
1044
|
-
/** Last 4 digits of account number */
|
|
1045
|
-
accountNumberLastFourDigits?: string;
|
|
1046
|
-
/** Bank name */
|
|
1047
|
-
bankName?: string;
|
|
1048
|
-
/** Account type (e.g., "CHECKING", "SAVINGS") */
|
|
1049
|
-
accountType?: string;
|
|
1050
|
-
};
|
|
1051
|
-
}
|
|
1052
1008
|
/**
|
|
1053
1009
|
* Generic vaulted payment method summary for payment instruments
|
|
1054
1010
|
* not explicitly modeled with their own interface.
|
|
1055
1011
|
*/
|
|
1056
1012
|
export interface GenericVaultedPaymentMethodSummary extends BaseVaultedPaymentMethodSummary {
|
|
1057
1013
|
/** Discriminant for all other payment instrument types */
|
|
1058
|
-
paymentInstrumentType: Exclude<PaymentInstrumentType, "PAYMENT_CARD" | "PAYPAL_BILLING_AGREEMENT" | "KLARNA_CUSTOMER_TOKEN"
|
|
1014
|
+
paymentInstrumentType: Exclude<PaymentInstrumentType, "PAYMENT_CARD" | "PAYPAL_BILLING_AGREEMENT" | "KLARNA_CUSTOMER_TOKEN">;
|
|
1059
1015
|
/** Generic payment instrument data for unknown/other payment methods */
|
|
1060
1016
|
paymentInstrumentData?: Record<string, unknown>;
|
|
1061
1017
|
}
|
|
@@ -1063,7 +1019,7 @@ export interface GenericVaultedPaymentMethodSummary extends BaseVaultedPaymentMe
|
|
|
1063
1019
|
* Discriminated union of all vaulted payment method summaries.
|
|
1064
1020
|
* Use the paymentInstrumentType field to narrow to specific types.
|
|
1065
1021
|
*/
|
|
1066
|
-
export type VaultedPaymentMethodSummary = CardVaultedPaymentMethodSummary | PayPalVaultedPaymentMethodSummary | KlarnaVaultedPaymentMethodSummary |
|
|
1022
|
+
export type VaultedPaymentMethodSummary = CardVaultedPaymentMethodSummary | PayPalVaultedPaymentMethodSummary | KlarnaVaultedPaymentMethodSummary | GenericVaultedPaymentMethodSummary;
|
|
1067
1023
|
/**
|
|
1068
1024
|
* Approval state of a MANUAL attempt. `REQUIRES_APPROVAL` is pending; `APPROVED`,
|
|
1069
1025
|
* `ABORTED` and `EXPIRED` are terminal.
|
|
@@ -1130,22 +1086,6 @@ export interface BinDataAvailableEvent {
|
|
|
1130
1086
|
status: "complete" | "partial";
|
|
1131
1087
|
firstDigits?: string;
|
|
1132
1088
|
}
|
|
1133
|
-
export interface HostedInput {
|
|
1134
|
-
cleanup: () => void;
|
|
1135
|
-
getOptions: () => HeadlessHostedInputOptions;
|
|
1136
|
-
setOptions: (options: HeadlessHostedInputOptions) => void;
|
|
1137
|
-
render: (container: string | Element, options: HeadlessHostedInputOptions) => Promise<void>;
|
|
1138
|
-
addEventListener: (event: EventTypes, callback: EventListener$1) => void;
|
|
1139
|
-
focus: () => void;
|
|
1140
|
-
blur: () => void;
|
|
1141
|
-
setDisabled: (status: boolean) => void;
|
|
1142
|
-
}
|
|
1143
|
-
export interface HostedInputs {
|
|
1144
|
-
cardNumberInput: HostedInput;
|
|
1145
|
-
cardholderNameInput: HostedInput;
|
|
1146
|
-
expiryInput: HostedInput;
|
|
1147
|
-
cvvInput: HostedInput;
|
|
1148
|
-
}
|
|
1149
1089
|
export interface InputValidationError {
|
|
1150
1090
|
field?: string;
|
|
1151
1091
|
name: string;
|
|
@@ -1157,63 +1097,110 @@ export interface Validation {
|
|
|
1157
1097
|
validationErrors: InputValidationError[];
|
|
1158
1098
|
error?: string;
|
|
1159
1099
|
}
|
|
1160
|
-
export
|
|
1161
|
-
|
|
1162
|
-
|
|
1100
|
+
export type HostedInputEvent = "input" | "focus" | "blur" | "enter";
|
|
1101
|
+
export interface HostedInput {
|
|
1102
|
+
render(containerOrId: string | Element, options?: HostedInputOptions): Promise<void>;
|
|
1103
|
+
remove(): void;
|
|
1104
|
+
focus(): void;
|
|
1105
|
+
getFieldState(): Promise<FieldState> | undefined;
|
|
1106
|
+
addEventListener(event: HostedInputEvent, callback: (data?: unknown) => void): void;
|
|
1107
|
+
setOptions(options: HostedInputOptions): void;
|
|
1108
|
+
setCardholderName(cardholderName: string): void;
|
|
1109
|
+
}
|
|
1110
|
+
export interface CardFormIframes {
|
|
1111
|
+
cardNumber: HostedInput;
|
|
1112
|
+
cardSecurityCode: HostedInput;
|
|
1113
|
+
cardExpiryDate: HostedInput;
|
|
1114
|
+
cardholderName: HostedInput;
|
|
1115
|
+
}
|
|
1116
|
+
export interface CardPaymentMethod {
|
|
1117
|
+
type: typeof PaymentMethodType.PAYMENT_CARD;
|
|
1118
|
+
managerType: HeadlessManagerType.CARD;
|
|
1119
|
+
iframes: CardFormIframes;
|
|
1163
1120
|
submit: (values?: CardPaymentMethodSubmitValues) => Promise<void>;
|
|
1164
1121
|
validate: () => Promise<Validation>;
|
|
1165
|
-
reset: () => void;
|
|
1166
1122
|
setCardholderName: (cardholderName: string) => void;
|
|
1167
1123
|
}
|
|
1168
|
-
export interface
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1124
|
+
export interface MbwayPaymentMethod {
|
|
1125
|
+
type: typeof PaymentMethodType.ADYEN_MBWAY;
|
|
1126
|
+
managerType: HeadlessManagerType.MBWAY;
|
|
1127
|
+
/**
|
|
1128
|
+
* Set the phone number used to confirm the payment in the MB WAY app
|
|
1129
|
+
*/
|
|
1130
|
+
setPhoneNumber(phoneNumber: string): void;
|
|
1131
|
+
/**
|
|
1132
|
+
* Start the payment flow
|
|
1133
|
+
*/
|
|
1134
|
+
start(): Promise<void>;
|
|
1172
1135
|
}
|
|
1173
|
-
export interface
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1136
|
+
export interface BlikPaymentMethod {
|
|
1137
|
+
type: typeof PaymentMethodType.ADYEN_BLIK;
|
|
1138
|
+
managerType: HeadlessManagerType.BLIK;
|
|
1139
|
+
/**
|
|
1140
|
+
* Set the 6-digit OTP code from the user's banking app
|
|
1141
|
+
*/
|
|
1142
|
+
setBlikCode(code: string): void;
|
|
1143
|
+
/**
|
|
1144
|
+
* Start the payment flow
|
|
1145
|
+
*/
|
|
1146
|
+
start(): Promise<void>;
|
|
1177
1147
|
}
|
|
1178
|
-
export interface
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
start(
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1148
|
+
export interface NativePaymentMethod {
|
|
1149
|
+
type: typeof PaymentMethodType.APPLE_PAY | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.PAYPAL;
|
|
1150
|
+
managerType: HeadlessManagerType.NATIVE;
|
|
1151
|
+
/**
|
|
1152
|
+
* Initialize the payment method (e.g. load the external SDK)
|
|
1153
|
+
*/
|
|
1154
|
+
start(): Promise<void>;
|
|
1155
|
+
/**
|
|
1156
|
+
* Render the payment button into the given container
|
|
1157
|
+
*/
|
|
1158
|
+
render(container: HTMLElement, buttonOptions?: PaymentRenderButtonOptions): Promise<void>;
|
|
1159
|
+
setDisabled(disabled: boolean): Promise<void>;
|
|
1160
|
+
}
|
|
1161
|
+
/**
|
|
1162
|
+
* Payment method types that have a surface of their own. Everything else is
|
|
1163
|
+
* driven generically — by a redirect, or by the backend.
|
|
1164
|
+
*/
|
|
1165
|
+
export type SpecializedPaymentMethodType = typeof PaymentMethodType.STRIPE_ACH | typeof PaymentMethodType.PAYMENT_CARD | typeof PaymentMethodType.KLARNA | typeof PaymentMethodType.ADYEN_KLARNA | typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY | typeof PaymentMethodType.ADYEN_BLIK | typeof PaymentMethodType.ADYEN_MBWAY | typeof PaymentMethodType.ADYEN_BANCONTACT_PAYCONIQ | typeof PaymentMethodType.XFERS_PAYNOW | typeof PaymentMethodType.OMISE_PROMPTPAY | typeof PaymentMethodType.RAPYD_PROMPTPAY;
|
|
1166
|
+
export interface RedirectPaymentMethod {
|
|
1167
|
+
type: Exclude<PaymentMethodType, SpecializedPaymentMethodType>;
|
|
1168
|
+
managerType: HeadlessManagerType.REDIRECT;
|
|
1169
|
+
start: () => Promise<void>;
|
|
1196
1170
|
}
|
|
1197
|
-
|
|
1171
|
+
/**
|
|
1172
|
+
* A payment method whose flow is driven by the backend: the SDK executes the
|
|
1173
|
+
* steps the backend sends rather than following a flow hardcoded per method.
|
|
1174
|
+
*
|
|
1175
|
+
* Which surface it renders is up to those steps — today they redirect, so this
|
|
1176
|
+
* looks like {@link RedirectPaymentMethod}, but a step tree can drive other
|
|
1177
|
+
* surfaces, which is why it is a member of its own rather than a redirect.
|
|
1178
|
+
*/
|
|
1179
|
+
export interface BackendDrivenPaymentMethod {
|
|
1180
|
+
type: Exclude<PaymentMethodType, SpecializedPaymentMethodType>;
|
|
1181
|
+
managerType: HeadlessManagerType.BACKEND_DRIVEN;
|
|
1198
1182
|
start: () => Promise<void>;
|
|
1199
1183
|
}
|
|
1200
1184
|
/**
|
|
1201
|
-
* QRCode Payment Method
|
|
1185
|
+
* QRCode Payment Method
|
|
1202
1186
|
*/
|
|
1203
|
-
export interface
|
|
1187
|
+
export interface QRCodePaymentMethod {
|
|
1188
|
+
type: typeof PaymentMethodType.ADYEN_BANCONTACT_PAYCONIQ | typeof PaymentMethodType.OMISE_PROMPTPAY | typeof PaymentMethodType.RAPYD_PROMPTPAY | typeof PaymentMethodType.XFERS_PAYNOW;
|
|
1189
|
+
managerType: HeadlessManagerType.QRCODE;
|
|
1204
1190
|
/**
|
|
1205
|
-
*
|
|
1191
|
+
* Provide a callback for when the QR code is received
|
|
1206
1192
|
* @param params Optional parameters, including onQRCodeReceived callback
|
|
1207
1193
|
*/
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1194
|
+
setOnQRCodeReceived(callback: (qrCode: string) => void): void;
|
|
1195
|
+
/**
|
|
1196
|
+
* Start the payment flow
|
|
1197
|
+
*/
|
|
1198
|
+
start(): Promise<void>;
|
|
1211
1199
|
/**
|
|
1212
1200
|
* Stop the payment flow
|
|
1213
1201
|
*/
|
|
1214
1202
|
stop(): void;
|
|
1215
1203
|
}
|
|
1216
|
-
export type PaymentMethodManager = CardPaymentMethodManager | NativePaymentMethodManager | RedirectPaymentMethodManager | KlarnaPaymentMethodManager | QRCodePaymentMethodManager;
|
|
1217
1204
|
export interface SDKUtilities {
|
|
1218
1205
|
getCardNetworkAsset: (network: string) => {
|
|
1219
1206
|
cardUrl: string;
|
|
@@ -1239,7 +1226,6 @@ export interface SDKUtilities {
|
|
|
1239
1226
|
}
|
|
1240
1227
|
export interface PrimerHeadlessCheckout {
|
|
1241
1228
|
start: () => Promise<void>;
|
|
1242
|
-
createPaymentMethodManager: (type: string, managerOptions?: PaymentMethodManagerOptions) => Promise<PaymentMethodManager | null>;
|
|
1243
1229
|
getSDKUtilities: () => SDKUtilities;
|
|
1244
1230
|
/** Session-bound telemetry, shared with all sdk-core internals via the checkout context */
|
|
1245
1231
|
getTelemetry: () => TelemetryClient;
|
|
@@ -1421,23 +1407,21 @@ export interface CreateHeadlessOptions {
|
|
|
1421
1407
|
*/
|
|
1422
1408
|
forceRedirect?: boolean;
|
|
1423
1409
|
/**
|
|
1424
|
-
*
|
|
1425
|
-
* If false, the payment method will be deselected, allowing the user to select a different payment method.
|
|
1426
|
-
* @default false
|
|
1410
|
+
* @deprecated this flag is no longer used and won't have any effect, will be removed in a future version
|
|
1427
1411
|
*/
|
|
1428
1412
|
resumePaymentOnPopupClosure?: boolean;
|
|
1429
1413
|
};
|
|
1430
1414
|
/**
|
|
1431
1415
|
* Fires once at SDK init with the initial set of available payment methods.
|
|
1432
1416
|
*/
|
|
1433
|
-
onAvailablePaymentMethodsLoad?: (info:
|
|
1417
|
+
onAvailablePaymentMethodsLoad?: (info: InitializedPaymentMethod[]) => void;
|
|
1434
1418
|
/**
|
|
1435
1419
|
* Fires after each successful `refreshClientSession` when the available
|
|
1436
1420
|
* payment methods have changed (added or removed) as a result of the backend
|
|
1437
1421
|
* re-evaluating visibility rules against the updated client session metadata.
|
|
1438
1422
|
* The `info` array reflects the current set in backend order.
|
|
1439
1423
|
*/
|
|
1440
|
-
onAvailablePaymentMethodsRefresh?: (info:
|
|
1424
|
+
onAvailablePaymentMethodsRefresh?: (info: InitializedPaymentMethod[]) => void;
|
|
1441
1425
|
onCheckoutComplete?: (data: {
|
|
1442
1426
|
payment: Payment | null;
|
|
1443
1427
|
}) => void;
|
|
@@ -1475,13 +1459,12 @@ export interface CreateHeadlessOptions {
|
|
|
1475
1459
|
* is resolved. Not fired for a fresh checkout (no attempt in flight).
|
|
1476
1460
|
*/
|
|
1477
1461
|
onCheckoutResume?: () => void;
|
|
1462
|
+
onBinDataAvailable?: (event: BinDataAvailableEvent) => void;
|
|
1463
|
+
onBinDataLoadingChange?: (loading: boolean) => void;
|
|
1464
|
+
onCardNetworksChange?: (event: CardNetworkChangeEvent) => void;
|
|
1465
|
+
onCardNetworksLoading?: () => void;
|
|
1478
1466
|
}
|
|
1479
|
-
export
|
|
1480
|
-
id: string;
|
|
1481
|
-
name: string;
|
|
1482
|
-
descriptiveAssetUrl: string;
|
|
1483
|
-
standardAssetUrl: string;
|
|
1484
|
-
}
|
|
1467
|
+
export type InitializedPaymentMethod = CardPaymentMethod | KlarnaPaymentMethod | AdyenKlarnaPaymentMethod | QRCodePaymentMethod | BlikPaymentMethod | MbwayPaymentMethod | RedirectPaymentMethod | BackendDrivenPaymentMethod | NativePaymentMethod;
|
|
1485
1468
|
export interface CardSecurityCodeInputOptions {
|
|
1486
1469
|
ariaLabel?: string;
|
|
1487
1470
|
container: string | Element | HTMLElement;
|
|
@@ -1637,62 +1620,6 @@ export interface PrimerCheckoutOptions extends Omit<CreateHeadlessOptions, "dial
|
|
|
1637
1620
|
*/
|
|
1638
1621
|
disabledPayments?: boolean;
|
|
1639
1622
|
}
|
|
1640
|
-
/**
|
|
1641
|
-
* Payment methods that use the REDIRECT manager type — i.e. every
|
|
1642
|
-
* PaymentMethodType not handled by a specialized manager (CARD, ACH, KLARNA,
|
|
1643
|
-
* ADYEN_KLARNA, NATIVE, BLIK, MBWAY, QRCODE).
|
|
1644
|
-
*/
|
|
1645
|
-
export type RedirectPaymentMethodTypes = Exclude<PaymentMethodType, typeof PaymentMethodType.STRIPE_ACH | typeof PaymentMethodType.PAYMENT_CARD | typeof PaymentMethodType.KLARNA | typeof PaymentMethodType.ADYEN_KLARNA | typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY | typeof PaymentMethodType.ADYEN_BLIK | typeof PaymentMethodType.ADYEN_MBWAY | typeof PaymentMethodType.ADYEN_BANCONTACT_PAYCONIQ | typeof PaymentMethodType.XFERS_PAYNOW | typeof PaymentMethodType.OMISE_PROMPTPAY | typeof PaymentMethodType.RAPYD_PROMPTPAY>;
|
|
1646
|
-
/**
|
|
1647
|
-
* A payment method that authorizes by redirecting the user to an external page.
|
|
1648
|
-
*/
|
|
1649
|
-
export interface RedirectPaymentMethod {
|
|
1650
|
-
type: RedirectPaymentMethodTypes;
|
|
1651
|
-
managerType: HeadlessManagerType.REDIRECT;
|
|
1652
|
-
manager: RedirectPaymentMethodManager;
|
|
1653
|
-
}
|
|
1654
|
-
export interface NativePaymentMethod {
|
|
1655
|
-
type: typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY;
|
|
1656
|
-
managerType: HeadlessManagerType.NATIVE;
|
|
1657
|
-
manager: NativePaymentMethodManager;
|
|
1658
|
-
}
|
|
1659
|
-
export interface BlikPaymentMethod {
|
|
1660
|
-
type: typeof PaymentMethodType.ADYEN_BLIK;
|
|
1661
|
-
managerType: HeadlessManagerType.BLIK;
|
|
1662
|
-
manager: BlikPaymentMethodManager;
|
|
1663
|
-
}
|
|
1664
|
-
export interface MbwayPaymentMethod {
|
|
1665
|
-
type: typeof PaymentMethodType.ADYEN_MBWAY;
|
|
1666
|
-
managerType: HeadlessManagerType.MBWAY;
|
|
1667
|
-
manager: MbwayPaymentMethodManager;
|
|
1668
|
-
}
|
|
1669
|
-
export interface QRCodePaymentMethod {
|
|
1670
|
-
type: typeof PaymentMethodType.ADYEN_BANCONTACT_PAYCONIQ | typeof PaymentMethodType.OMISE_PROMPTPAY | typeof PaymentMethodType.RAPYD_PROMPTPAY | typeof PaymentMethodType.XFERS_PAYNOW;
|
|
1671
|
-
managerType: HeadlessManagerType.QRCODE;
|
|
1672
|
-
manager: QRCodePaymentMethodManager;
|
|
1673
|
-
}
|
|
1674
|
-
export type InitializedPaymentMethod = {
|
|
1675
|
-
type: typeof PaymentMethodType.STRIPE_ACH;
|
|
1676
|
-
managerType: HeadlessManagerType.ACH;
|
|
1677
|
-
manager: AchPaymentMethodManager;
|
|
1678
|
-
} | {
|
|
1679
|
-
type: typeof PaymentMethodType.PAYMENT_CARD;
|
|
1680
|
-
managerType: HeadlessManagerType.CARD;
|
|
1681
|
-
manager: CardPaymentMethodManager;
|
|
1682
|
-
} | {
|
|
1683
|
-
type: typeof PaymentMethodType.KLARNA;
|
|
1684
|
-
managerType: HeadlessManagerType.KLARNA;
|
|
1685
|
-
manager: KlarnaPaymentMethodManager;
|
|
1686
|
-
} | {
|
|
1687
|
-
type: typeof PaymentMethodType.ADYEN_KLARNA;
|
|
1688
|
-
managerType: HeadlessManagerType.ADYEN_KLARNA;
|
|
1689
|
-
manager: AdyenKlarnaPaymentMethodManager;
|
|
1690
|
-
} | QRCodePaymentMethod | BlikPaymentMethod | MbwayPaymentMethod | RedirectPaymentMethod | NativePaymentMethod;
|
|
1691
|
-
export interface AssetsConfig {
|
|
1692
|
-
backgroundColor: string;
|
|
1693
|
-
name: string;
|
|
1694
|
-
iconUrl: string;
|
|
1695
|
-
}
|
|
1696
1623
|
/**
|
|
1697
1624
|
* Options for initializing the Vault Manager
|
|
1698
1625
|
*/
|
|
@@ -1731,14 +1658,6 @@ export interface VaultManagerItemState {
|
|
|
1731
1658
|
selectedVaultedPaymentMethod: VaultListItem | null;
|
|
1732
1659
|
setSelectedVaultedPaymentMethod: (paymentMethod: VaultListItem | null) => void;
|
|
1733
1660
|
}
|
|
1734
|
-
export type KlarnaCategoriesContextType = {
|
|
1735
|
-
categories: KlarnaPaymentMethodCategory[];
|
|
1736
|
-
isLoading: boolean;
|
|
1737
|
-
};
|
|
1738
|
-
export type AdyenKlarnaOptionsContextType = {
|
|
1739
|
-
options: AdyenKlarnaPaymentOption[];
|
|
1740
|
-
isLoading: boolean;
|
|
1741
|
-
};
|
|
1742
1661
|
export type CardNetwork = {
|
|
1743
1662
|
displayName: string;
|
|
1744
1663
|
network: string;
|
|
@@ -1787,8 +1706,6 @@ export type ContextType = {
|
|
|
1787
1706
|
telemetry?: TelemetryClient;
|
|
1788
1707
|
configuration?: ClientConfiguration;
|
|
1789
1708
|
computedStyles?: CSSStyleDeclaration | null;
|
|
1790
|
-
klarnaCategories: KlarnaCategoriesContextType;
|
|
1791
|
-
adyenKlarnaOptions?: AdyenKlarnaOptionsContextType;
|
|
1792
1709
|
cardNetworks?: CardNetworksContextType;
|
|
1793
1710
|
events?: PrimerEventsController;
|
|
1794
1711
|
clientOptions?: PrimerCheckoutOptions;
|
|
@@ -1815,8 +1732,6 @@ declare class SDKContextController implements ReactiveController {
|
|
|
1815
1732
|
setCardNetworks(value: CardNetworksContextType): void;
|
|
1816
1733
|
setCardNetworksLoadingFalse(): void;
|
|
1817
1734
|
setVaultManager(vaultManager: VaultManagerState): void;
|
|
1818
|
-
setKlarnaCategories(value: KlarnaCategoriesContextType): void;
|
|
1819
|
-
setAdyenKlarnaOptions(value: AdyenKlarnaOptionsContextType): void;
|
|
1820
1735
|
setComputedStyles(value: CSSStyleDeclaration): void;
|
|
1821
1736
|
setVaultManagerCvv(vaultItem: VaultManagerItemState): void;
|
|
1822
1737
|
/**
|
|
@@ -2199,7 +2114,7 @@ export declare class PrimerJS {
|
|
|
2199
2114
|
/**
|
|
2200
2115
|
* Returns the cached list of payment methods.
|
|
2201
2116
|
*/
|
|
2202
|
-
getPaymentMethods():
|
|
2117
|
+
getPaymentMethods(): InitializedPaymentMethod[];
|
|
2203
2118
|
/**
|
|
2204
2119
|
* Internal accessor that returns the initialized payment methods (with their
|
|
2205
2120
|
* managers), used by the refresh path to preserve manager identity across
|
|
@@ -2578,7 +2493,6 @@ declare class HeadlessSdkController implements ReactiveController {
|
|
|
2578
2493
|
string | null,
|
|
2579
2494
|
PrimerCheckoutOptions | null
|
|
2580
2495
|
]) => Promise<PrimerHeadlessCheckout | typeof initialState>;
|
|
2581
|
-
private createManager;
|
|
2582
2496
|
/**
|
|
2583
2497
|
* Updates card networks state and dispatches events
|
|
2584
2498
|
*
|
|
@@ -2688,6 +2602,11 @@ export declare function injectLightTheme(): void;
|
|
|
2688
2602
|
* @returns {void}
|
|
2689
2603
|
*/
|
|
2690
2604
|
export declare function injectDarkTheme(): void;
|
|
2605
|
+
export interface AssetsConfig {
|
|
2606
|
+
backgroundColor: string;
|
|
2607
|
+
name: string;
|
|
2608
|
+
iconUrl: string;
|
|
2609
|
+
}
|
|
2691
2610
|
/**
|
|
2692
2611
|
* Size options for the spinner component
|
|
2693
2612
|
*/
|
|
@@ -3280,10 +3199,13 @@ declare global {
|
|
|
3280
3199
|
"primer-klarna": PrimerKlarnaComponent;
|
|
3281
3200
|
}
|
|
3282
3201
|
}
|
|
3202
|
+
type NativePaymentMethod$1 = Extract<InitializedPaymentMethod, {
|
|
3203
|
+
managerType: HeadlessManagerType.NATIVE;
|
|
3204
|
+
}>;
|
|
3283
3205
|
declare class NativePaymentComponent extends LitElement {
|
|
3284
3206
|
static styles: import("lit").CSSResult[];
|
|
3285
3207
|
type: PaymentMethodType | undefined;
|
|
3286
|
-
paymentMethod: NativePaymentMethod | undefined;
|
|
3208
|
+
paymentMethod: NativePaymentMethod$1 | undefined;
|
|
3287
3209
|
primerContext?: ContextType;
|
|
3288
3210
|
disabled: boolean;
|
|
3289
3211
|
private buttonContainerRef;
|
|
@@ -3293,6 +3215,9 @@ declare class NativePaymentComponent extends LitElement {
|
|
|
3293
3215
|
protected willUpdate(changedProperties: PropertyValues): void;
|
|
3294
3216
|
render(): import("lit-html").TemplateResult<1>;
|
|
3295
3217
|
}
|
|
3218
|
+
type BlikPaymentMethod$1 = Extract<InitializedPaymentMethod, {
|
|
3219
|
+
managerType: HeadlessManagerType.BLIK;
|
|
3220
|
+
}>;
|
|
3296
3221
|
/**
|
|
3297
3222
|
* BLIK Payment Component
|
|
3298
3223
|
*
|
|
@@ -3315,7 +3240,7 @@ declare class NativePaymentComponent extends LitElement {
|
|
|
3315
3240
|
*/
|
|
3316
3241
|
declare class BlikComponent extends LitElement {
|
|
3317
3242
|
static styles: import("lit").CSSResult[];
|
|
3318
|
-
paymentMethod: BlikPaymentMethod | undefined;
|
|
3243
|
+
paymentMethod: BlikPaymentMethod$1 | undefined;
|
|
3319
3244
|
disabled: boolean;
|
|
3320
3245
|
private currentState;
|
|
3321
3246
|
private blikCode;
|
|
@@ -3376,13 +3301,16 @@ declare global {
|
|
|
3376
3301
|
"primer-blik": BlikComponent;
|
|
3377
3302
|
}
|
|
3378
3303
|
}
|
|
3304
|
+
type AdyenKlarnaPaymentMethod$1 = Extract<InitializedPaymentMethod, {
|
|
3305
|
+
managerType: HeadlessManagerType.ADYEN_KLARNA;
|
|
3306
|
+
}>;
|
|
3379
3307
|
declare class AdyenKlarnaComponent extends LitElement {
|
|
3380
3308
|
static styles: import("lit").CSSResult[];
|
|
3381
3309
|
primerContext?: ContextType;
|
|
3382
3310
|
/**
|
|
3383
3311
|
* The payment method from context
|
|
3384
3312
|
*/
|
|
3385
|
-
paymentMethod?:
|
|
3313
|
+
paymentMethod?: AdyenKlarnaPaymentMethod$1;
|
|
3386
3314
|
/**
|
|
3387
3315
|
* Whether the component is disabled
|
|
3388
3316
|
*/
|
|
@@ -3400,7 +3328,6 @@ declare class AdyenKlarnaComponent extends LitElement {
|
|
|
3400
3328
|
*/
|
|
3401
3329
|
private loading;
|
|
3402
3330
|
private paymentInProgress;
|
|
3403
|
-
private get manager();
|
|
3404
3331
|
/**
|
|
3405
3332
|
* Get the Klarna logo URL from the payment method configuration
|
|
3406
3333
|
*/
|
|
@@ -3415,6 +3342,9 @@ declare global {
|
|
|
3415
3342
|
"primer-adyen-klarna": AdyenKlarnaComponent;
|
|
3416
3343
|
}
|
|
3417
3344
|
}
|
|
3345
|
+
type MbwayPaymentMethod$1 = Extract<InitializedPaymentMethod, {
|
|
3346
|
+
managerType: HeadlessManagerType.MBWAY;
|
|
3347
|
+
}>;
|
|
3418
3348
|
/**
|
|
3419
3349
|
* Adyen MB WAY Payment Component
|
|
3420
3350
|
*
|
|
@@ -3424,7 +3354,7 @@ declare global {
|
|
|
3424
3354
|
*/
|
|
3425
3355
|
declare class AdyenMbwayComponent extends LitElement {
|
|
3426
3356
|
static styles: import("lit").CSSResult[];
|
|
3427
|
-
paymentMethod: MbwayPaymentMethod | undefined;
|
|
3357
|
+
paymentMethod: MbwayPaymentMethod$1 | undefined;
|
|
3428
3358
|
disabled: boolean;
|
|
3429
3359
|
private currentState;
|
|
3430
3360
|
private phoneNumber;
|
|
@@ -3447,9 +3377,12 @@ declare global {
|
|
|
3447
3377
|
"primer-adyen-mbway": AdyenMbwayComponent;
|
|
3448
3378
|
}
|
|
3449
3379
|
}
|
|
3380
|
+
type QRCodePaymentMethod$1 = Extract<InitializedPaymentMethod, {
|
|
3381
|
+
managerType: HeadlessManagerType.QRCODE;
|
|
3382
|
+
}>;
|
|
3450
3383
|
declare class QRCodeComponent extends LitElement {
|
|
3451
3384
|
static styles: import("lit").CSSResult[];
|
|
3452
|
-
paymentMethod: QRCodePaymentMethod | undefined;
|
|
3385
|
+
paymentMethod: QRCodePaymentMethod$1 | undefined;
|
|
3453
3386
|
disabled: boolean;
|
|
3454
3387
|
primerContext?: ContextType;
|
|
3455
3388
|
private isExpanded;
|
|
@@ -3470,6 +3403,48 @@ declare global {
|
|
|
3470
3403
|
"primer-qrcode": QRCodeComponent;
|
|
3471
3404
|
}
|
|
3472
3405
|
}
|
|
3406
|
+
declare class PaymentMethodButtonComponent extends LitElement {
|
|
3407
|
+
static styles: import("lit").CSSResult[];
|
|
3408
|
+
type: PaymentMethodType | undefined;
|
|
3409
|
+
disabled: boolean;
|
|
3410
|
+
primerContext?: ContextType;
|
|
3411
|
+
/**
|
|
3412
|
+
* Based on packages/primer-sdk-web/src/payment-methods/Button.tsx
|
|
3413
|
+
* Should be replaced once we align on a better solution across all platforms.
|
|
3414
|
+
*/
|
|
3415
|
+
private _legacyGetButtonLabel;
|
|
3416
|
+
private _getBackgroundColor;
|
|
3417
|
+
private _getIconUrl;
|
|
3418
|
+
private _getIconPosition;
|
|
3419
|
+
private _getTextColor;
|
|
3420
|
+
private _getDisplayName;
|
|
3421
|
+
private _setupTask;
|
|
3422
|
+
private _handleClick;
|
|
3423
|
+
render(): symbol | import("lit-html").TemplateResult<1> | undefined;
|
|
3424
|
+
}
|
|
3425
|
+
declare global {
|
|
3426
|
+
interface HTMLElementTagNameMap {
|
|
3427
|
+
"primer-payment-method-button": PaymentMethodButtonComponent;
|
|
3428
|
+
}
|
|
3429
|
+
}
|
|
3430
|
+
type BackendDrivenPaymentMethod$1 = Extract<InitializedPaymentMethod, {
|
|
3431
|
+
managerType: HeadlessManagerType.BACKEND_DRIVEN;
|
|
3432
|
+
}>;
|
|
3433
|
+
/**
|
|
3434
|
+
* Surface for a payment method whose flow the backend drives through a step
|
|
3435
|
+
* tree. Today every step tree starts by handing off to a third party, so this
|
|
3436
|
+
* renders a button — but unlike a redirect method, what the flow needs of this
|
|
3437
|
+
* component is open-ended: steps can ask for input, render UI, or wait, and
|
|
3438
|
+
* this is where that grows.
|
|
3439
|
+
*/
|
|
3440
|
+
declare class BackendDrivenComponent extends LitElement {
|
|
3441
|
+
static styles: import("lit").CSSResult;
|
|
3442
|
+
paymentMethod: BackendDrivenPaymentMethod$1 | undefined;
|
|
3443
|
+
disabled: boolean;
|
|
3444
|
+
primerContext?: ContextType;
|
|
3445
|
+
private _handleClick;
|
|
3446
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
3447
|
+
}
|
|
3473
3448
|
declare class PaymentMethodComponent extends LitElement {
|
|
3474
3449
|
static styles: import("lit").CSSResult[];
|
|
3475
3450
|
type: PaymentMethodType | undefined;
|
|
@@ -3503,33 +3478,12 @@ declare global {
|
|
|
3503
3478
|
"primer-payment-method-container": PaymentMethodContainerComponent;
|
|
3504
3479
|
}
|
|
3505
3480
|
}
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
disabled: boolean;
|
|
3510
|
-
primerContext?: ContextType;
|
|
3511
|
-
/**
|
|
3512
|
-
* Based on packages/primer-sdk-web/src/payment-methods/Button.tsx
|
|
3513
|
-
* Should be replaced once we align on a better solution across all platforms.
|
|
3514
|
-
*/
|
|
3515
|
-
private _legacyGetButtonLabel;
|
|
3516
|
-
private _getBackgroundColor;
|
|
3517
|
-
private _getIconUrl;
|
|
3518
|
-
private _getIconPosition;
|
|
3519
|
-
private _getTextColor;
|
|
3520
|
-
private _getDisplayName;
|
|
3521
|
-
private _setupTask;
|
|
3522
|
-
private _handleClick;
|
|
3523
|
-
render(): symbol | import("lit-html").TemplateResult<1> | undefined;
|
|
3524
|
-
}
|
|
3525
|
-
declare global {
|
|
3526
|
-
interface HTMLElementTagNameMap {
|
|
3527
|
-
"primer-payment-method-button": PaymentMethodButtonComponent;
|
|
3528
|
-
}
|
|
3529
|
-
}
|
|
3481
|
+
type RedirectPaymentMethod$1 = Extract<InitializedPaymentMethod, {
|
|
3482
|
+
managerType: HeadlessManagerType.REDIRECT;
|
|
3483
|
+
}>;
|
|
3530
3484
|
declare class RedirectPaymentComponent extends LitElement {
|
|
3531
3485
|
static styles: import("lit").CSSResult;
|
|
3532
|
-
paymentMethod: RedirectPaymentMethod | undefined;
|
|
3486
|
+
paymentMethod: RedirectPaymentMethod$1 | undefined;
|
|
3533
3487
|
disabled: boolean;
|
|
3534
3488
|
primerContext?: ContextType;
|
|
3535
3489
|
private _handleClick;
|
|
@@ -3540,6 +3494,11 @@ declare global {
|
|
|
3540
3494
|
"primer-redirect-payment": RedirectPaymentComponent;
|
|
3541
3495
|
}
|
|
3542
3496
|
}
|
|
3497
|
+
declare global {
|
|
3498
|
+
interface HTMLElementTagNameMap {
|
|
3499
|
+
"primer-backend-driven": BackendDrivenComponent;
|
|
3500
|
+
}
|
|
3501
|
+
}
|
|
3543
3502
|
/**
|
|
3544
3503
|
* BillingAddressComponent provides a form for collecting billing address information.
|
|
3545
3504
|
*
|
|
@@ -4993,6 +4952,7 @@ export declare function loadPrimer(): void;
|
|
|
4993
4952
|
|
|
4994
4953
|
export {
|
|
4995
4954
|
AdyenMbwayComponent as AdyenMbway,
|
|
4955
|
+
BackendDrivenComponent as BackendDriven,
|
|
4996
4956
|
BillingAddressComponent as BillingAddress,
|
|
4997
4957
|
BlikComponent as Blik,
|
|
4998
4958
|
ButtonComponent as Button,
|