@primer-io/primer-js 0.4.0 → 0.5.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 +6 -0
- package/README.md +83 -101
- package/dist/custom-elements.json +1445 -1137
- package/dist/jsx/index.d.ts +27 -0
- package/dist/primer-loader.d.ts +438 -10
- package/dist/primer-loader.js +10 -10
- package/dist/vscode.html-custom-data.json +17 -0
- package/dist/web-types.json +53 -1
- package/package.json +2 -2
package/dist/jsx/index.d.ts
CHANGED
|
@@ -313,6 +313,19 @@ export type BillingAddressComponentProps = {
|
|
|
313
313
|
"onprimer-billing-address-submit"?: (e: CustomEvent<CustomEvent>) => void;
|
|
314
314
|
};
|
|
315
315
|
|
|
316
|
+
export type BlikComponentProps = {
|
|
317
|
+
/** Payment method configuration */
|
|
318
|
+
paymentMethod?: InitializedPaymentMethod;
|
|
319
|
+
/** Disables component interaction when true */
|
|
320
|
+
disabled?: boolean;
|
|
321
|
+
/** */
|
|
322
|
+
paymentManagers?: InitializedManagersMap;
|
|
323
|
+
/** Dispatched on successful payment */
|
|
324
|
+
"onprimer-payment-success"?: (e: CustomEvent<never>) => void;
|
|
325
|
+
/** Dispatched on payment error */
|
|
326
|
+
"onprimer-payment-error"?: (e: CustomEvent<never>) => void;
|
|
327
|
+
};
|
|
328
|
+
|
|
316
329
|
export type CardFormComponentProps = {
|
|
317
330
|
/** */
|
|
318
331
|
"hide-labels"?: boolean;
|
|
@@ -926,6 +939,20 @@ export type CustomElements = {
|
|
|
926
939
|
*/
|
|
927
940
|
"primer-billing-address": Partial<BillingAddressComponentProps & BaseProps & BaseEvents>;
|
|
928
941
|
|
|
942
|
+
/**
|
|
943
|
+
* BLIK Payment Component
|
|
944
|
+
*
|
|
945
|
+
* Consolidated component handling BLIK payment flow from button click through
|
|
946
|
+
* payment completion. Uses a 4-state machine for managing the user experience.
|
|
947
|
+
* ---
|
|
948
|
+
*
|
|
949
|
+
*
|
|
950
|
+
* ### **Events:**
|
|
951
|
+
* - **primer-payment-success** - Dispatched on successful payment
|
|
952
|
+
* - **primer-payment-error** - Dispatched on payment error
|
|
953
|
+
*/
|
|
954
|
+
"primer-blik": Partial<BlikComponentProps & BaseProps & BaseEvents>;
|
|
955
|
+
|
|
929
956
|
/**
|
|
930
957
|
* CardFormComponent serves as a container for card input components.
|
|
931
958
|
* It handles form submission, validation, and provides context to child components.
|
package/dist/primer-loader.d.ts
CHANGED
|
@@ -182,7 +182,8 @@ declare enum HeadlessManagerType {
|
|
|
182
182
|
NATIVE = "NATIVE",
|
|
183
183
|
REDIRECT = "REDIRECT",
|
|
184
184
|
KLARNA = "KLARNA",
|
|
185
|
-
ACH = "ACH"
|
|
185
|
+
ACH = "ACH",
|
|
186
|
+
BLIK = "BLIK"
|
|
186
187
|
}
|
|
187
188
|
declare enum EventTypes {
|
|
188
189
|
CHANGE = "change",
|
|
@@ -636,6 +637,11 @@ export interface IAchPaymentMethodManager {
|
|
|
636
637
|
declineMandate(): Promise<void>;
|
|
637
638
|
getPaymentMethod(): void;
|
|
638
639
|
}
|
|
640
|
+
export interface IBlikPaymentMethodManager {
|
|
641
|
+
start(params: {
|
|
642
|
+
blikCode: string;
|
|
643
|
+
}): Promise<void>;
|
|
644
|
+
}
|
|
639
645
|
export interface HeadlessVaultManager {
|
|
640
646
|
fetchVaultedPaymentMethods(): Promise<VaultedPaymentMethod[]>;
|
|
641
647
|
deleteVaultedPaymentMethod(id: string): Promise<void>;
|
|
@@ -966,6 +972,27 @@ export interface KlarnaOptions {
|
|
|
966
972
|
*/
|
|
967
973
|
export interface PrimerCheckoutOptions {
|
|
968
974
|
clientToken?: string;
|
|
975
|
+
/**
|
|
976
|
+
* Sets the localization language for SDK UI text, validation messages, and country names.
|
|
977
|
+
*
|
|
978
|
+
* Supports standard locale codes in the format `language-COUNTRY` (e.g., `'en-US'`, `'fr-FR'`).
|
|
979
|
+
* If an unsupported locale is provided, falls back to `'en-GB'` with a console warning.
|
|
980
|
+
*
|
|
981
|
+
* Supported locales: `ar`, `bg`, `ca`, `cs`, `da`, `de`, `el`, `en-GB`, `es`, `es-AR`, `es-MX`,
|
|
982
|
+
* `et-EE`, `fi-FI`, `fr`, `he`, `hr`, `hu`, `id`, `it`, `ja`, `ko`, `lt`, `lt-LT`, `lv`, `lv-LV`,
|
|
983
|
+
* `ms`, `nb`, `nl`, `nl_NL`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sk`, `sl`, `sr-RS`, `sv`, `th`,
|
|
984
|
+
* `tr`, `uk-UA`, `vi`, `zh`, `zh-TW`
|
|
985
|
+
*
|
|
986
|
+
* @default 'en-GB'
|
|
987
|
+
* @example
|
|
988
|
+
* ```typescript
|
|
989
|
+
* // French localization
|
|
990
|
+
* { locale: 'fr-FR' }
|
|
991
|
+
*
|
|
992
|
+
* // Spanish (Mexico)
|
|
993
|
+
* { locale: 'es-MX' }
|
|
994
|
+
* ```
|
|
995
|
+
*/
|
|
969
996
|
locale?: string;
|
|
970
997
|
apiVersion?: APIVersionOption;
|
|
971
998
|
/**
|
|
@@ -973,40 +1000,239 @@ export interface PrimerCheckoutOptions {
|
|
|
973
1000
|
* If not provided, defaults to window.location.hostname.
|
|
974
1001
|
* This is particularly useful when the checkout is hosted on a different domain
|
|
975
1002
|
* than the merchant's registered Apple Pay domain.
|
|
1003
|
+
*
|
|
1004
|
+
* @default window.location.hostname
|
|
976
1005
|
*/
|
|
977
1006
|
merchantDomain?: string;
|
|
1007
|
+
/**
|
|
1008
|
+
* Configuration for card payment method options.
|
|
1009
|
+
* Controls the display and validation of card form fields.
|
|
1010
|
+
*/
|
|
978
1011
|
card?: {
|
|
1012
|
+
/**
|
|
1013
|
+
* Configuration for the cardholder name input field.
|
|
1014
|
+
*/
|
|
979
1015
|
cardholderName?: {
|
|
1016
|
+
/**
|
|
1017
|
+
* Whether the cardholder name field is required for form validation.
|
|
1018
|
+
* When true, form submission is blocked until a valid name is entered.
|
|
1019
|
+
*
|
|
1020
|
+
* Note: When using legacy SDK (`sdkCore: false`) with `visible: false`,
|
|
1021
|
+
* this is automatically set to `false` for compatibility.
|
|
1022
|
+
*
|
|
1023
|
+
* @default false
|
|
1024
|
+
*/
|
|
980
1025
|
required?: boolean;
|
|
1026
|
+
/**
|
|
1027
|
+
* Whether the cardholder name field is visible in the card form.
|
|
1028
|
+
* When false, the field is hidden and not included in validation.
|
|
1029
|
+
*
|
|
1030
|
+
* @default true
|
|
1031
|
+
*/
|
|
981
1032
|
visible?: boolean;
|
|
982
1033
|
};
|
|
983
1034
|
};
|
|
1035
|
+
/**
|
|
1036
|
+
* Configuration options for Apple Pay button and payment flow.
|
|
1037
|
+
*
|
|
1038
|
+
* Controls button appearance, billing/shipping contact field collection,
|
|
1039
|
+
* and shipping method requirements. The SDK manages button rendering automatically,
|
|
1040
|
+
* so the `container` property is omitted from this configuration.
|
|
1041
|
+
*
|
|
1042
|
+
* @see ApplePayOptions - Full type definition in compatibility-types.ts
|
|
1043
|
+
* @example
|
|
1044
|
+
* ```typescript
|
|
1045
|
+
* applePay: {
|
|
1046
|
+
* buttonStyle: 'black',
|
|
1047
|
+
* buttonType: 'buy',
|
|
1048
|
+
* billingOptions: {
|
|
1049
|
+
* requiredBillingContactFields: ['postalAddress', 'emailAddress']
|
|
1050
|
+
* },
|
|
1051
|
+
* shippingOptions: {
|
|
1052
|
+
* requiredShippingContactFields: ['postalAddress', 'name'],
|
|
1053
|
+
* requireShippingMethod: true
|
|
1054
|
+
* }
|
|
1055
|
+
* }
|
|
1056
|
+
* ```
|
|
1057
|
+
*/
|
|
984
1058
|
applePay?: Omit<ApplePayOptions, "container"> & {
|
|
1059
|
+
/**
|
|
1060
|
+
* @deprecated Use `billingOptions.requiredBillingContactFields: ['postalAddress']` instead.
|
|
1061
|
+
*
|
|
1062
|
+
* Legacy option to capture billing address for Apple Pay.
|
|
1063
|
+
* This property is maintained for backward compatibility.
|
|
1064
|
+
*/
|
|
985
1065
|
captureBillingAddress?: boolean;
|
|
1066
|
+
/**
|
|
1067
|
+
* Billing contact field configuration for Apple Pay.
|
|
1068
|
+
*/
|
|
986
1069
|
billingOptions?: {
|
|
1070
|
+
/**
|
|
1071
|
+
* Array of billing contact fields required for checkout.
|
|
1072
|
+
*
|
|
1073
|
+
* Valid values: `'emailAddress'`, `'name'`, `'phoneNumber'`, `'postalAddress'`, `'phoneticName'`
|
|
1074
|
+
*
|
|
1075
|
+
* @example ['postalAddress', 'emailAddress']
|
|
1076
|
+
*/
|
|
987
1077
|
requiredBillingContactFields?: Array<"emailAddress" | "name" | "phoneNumber" | "postalAddress" | "phoneticName">;
|
|
988
1078
|
};
|
|
1079
|
+
/**
|
|
1080
|
+
* Shipping contact field and method configuration for Apple Pay.
|
|
1081
|
+
*/
|
|
989
1082
|
shippingOptions?: {
|
|
1083
|
+
/**
|
|
1084
|
+
* Array of shipping contact fields required for checkout.
|
|
1085
|
+
*
|
|
1086
|
+
* Valid values: `'emailAddress'`, `'name'`, `'phoneNumber'`, `'postalAddress'`, `'phoneticName'`
|
|
1087
|
+
*
|
|
1088
|
+
* @example ['postalAddress', 'name', 'phoneNumber']
|
|
1089
|
+
*/
|
|
990
1090
|
requiredShippingContactFields?: Array<"emailAddress" | "name" | "phoneNumber" | "postalAddress" | "phoneticName">;
|
|
1091
|
+
/**
|
|
1092
|
+
* Whether to require shipping method selection during Apple Pay checkout.
|
|
1093
|
+
*
|
|
1094
|
+
* When true, customer must select a shipping method before completing payment.
|
|
1095
|
+
*
|
|
1096
|
+
* @default false
|
|
1097
|
+
*/
|
|
991
1098
|
requireShippingMethod?: boolean;
|
|
992
1099
|
};
|
|
993
1100
|
};
|
|
1101
|
+
/**
|
|
1102
|
+
* Configuration options for Google Pay button and payment flow.
|
|
1103
|
+
*
|
|
1104
|
+
* Controls button appearance, billing/shipping address collection,
|
|
1105
|
+
* and email requirements. The SDK manages button rendering automatically,
|
|
1106
|
+
* so the `container` property is omitted from this configuration.
|
|
1107
|
+
*
|
|
1108
|
+
* @see GooglePayOptions - Full type definition in compatibility-types.ts
|
|
1109
|
+
* @example
|
|
1110
|
+
* ```typescript
|
|
1111
|
+
* googlePay: {
|
|
1112
|
+
* buttonType: 'buy',
|
|
1113
|
+
* buttonColor: 'black',
|
|
1114
|
+
* captureBillingAddress: true,
|
|
1115
|
+
* emailRequired: true,
|
|
1116
|
+
* shippingAddressParameters: {
|
|
1117
|
+
* phoneNumberRequired: true
|
|
1118
|
+
* }
|
|
1119
|
+
* }
|
|
1120
|
+
* ```
|
|
1121
|
+
*/
|
|
994
1122
|
googlePay?: Omit<GooglePayOptions, "container">;
|
|
1123
|
+
/**
|
|
1124
|
+
* Configuration options for PayPal button and payment flow.
|
|
1125
|
+
*
|
|
1126
|
+
* Controls button styling, size, and payment flow behavior.
|
|
1127
|
+
* The SDK manages button rendering automatically, so the `container`
|
|
1128
|
+
* property is omitted from this configuration.
|
|
1129
|
+
*
|
|
1130
|
+
* @see PayPalOptions - Full type definition in compatibility-types.ts
|
|
1131
|
+
* @example
|
|
1132
|
+
* ```typescript
|
|
1133
|
+
* paypal: {
|
|
1134
|
+
* buttonColor: 'gold',
|
|
1135
|
+
* buttonShape: 'pill',
|
|
1136
|
+
* buttonLabel: 'pay',
|
|
1137
|
+
* paymentFlow: 'PREFER_VAULT'
|
|
1138
|
+
* }
|
|
1139
|
+
* ```
|
|
1140
|
+
*/
|
|
995
1141
|
paypal?: Omit<PayPalOptions, "container">;
|
|
1142
|
+
/**
|
|
1143
|
+
* Configuration options for Klarna payment method.
|
|
1144
|
+
*
|
|
1145
|
+
* Controls payment flow, allowed payment categories (pay now/later/over time),
|
|
1146
|
+
* and button customization for Klarna installment payments.
|
|
1147
|
+
*
|
|
1148
|
+
* @see KlarnaOptions - Full type definition in compatibility-types.ts
|
|
1149
|
+
* @example
|
|
1150
|
+
* ```typescript
|
|
1151
|
+
* klarna: {
|
|
1152
|
+
* paymentFlow: 'DEFAULT',
|
|
1153
|
+
* allowedPaymentCategories: ['pay_now', 'pay_later'],
|
|
1154
|
+
* buttonOptions: {
|
|
1155
|
+
* text: 'Pay with Klarna'
|
|
1156
|
+
* }
|
|
1157
|
+
* }
|
|
1158
|
+
* ```
|
|
1159
|
+
*/
|
|
996
1160
|
klarna?: KlarnaOptions;
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1161
|
+
/**
|
|
1162
|
+
* Configuration for payment method vaulting (save for later use).
|
|
1163
|
+
*
|
|
1164
|
+
* Enables customers to save payment methods for future transactions.
|
|
1165
|
+
* Vaulted methods are displayed in the checkout for quick selection.
|
|
1166
|
+
*/
|
|
1001
1167
|
vault?: {
|
|
1168
|
+
/**
|
|
1169
|
+
* Whether vaulting functionality is enabled.
|
|
1170
|
+
*
|
|
1171
|
+
* When true:
|
|
1172
|
+
* - Customers can save payment methods during checkout
|
|
1173
|
+
* - Previously saved methods are displayed for selection
|
|
1174
|
+
* - CVV re-capture may be required for vaulted cards (configurable)
|
|
1175
|
+
*
|
|
1176
|
+
* When false:
|
|
1177
|
+
* - Vaulting UI is hidden
|
|
1178
|
+
* - Only new payment methods can be used
|
|
1179
|
+
*
|
|
1180
|
+
* Note: This property is required (not optional).
|
|
1181
|
+
*/
|
|
1002
1182
|
enabled: boolean;
|
|
1183
|
+
/**
|
|
1184
|
+
* Whether to show the vault UI when no payment methods are vaulted.
|
|
1185
|
+
*
|
|
1186
|
+
* When true, displays a message encouraging customers to save a payment method.
|
|
1187
|
+
* When false, hides the vault section entirely when empty.
|
|
1188
|
+
*
|
|
1189
|
+
* @default false
|
|
1190
|
+
*/
|
|
1003
1191
|
showEmptyState?: boolean;
|
|
1004
1192
|
};
|
|
1193
|
+
/**
|
|
1194
|
+
* Configuration options for Stripe ACH payment method.
|
|
1195
|
+
*
|
|
1196
|
+
* Provides Stripe-specific settings for ACH bank account payments,
|
|
1197
|
+
* including mandate text and authorization requirements.
|
|
1198
|
+
*
|
|
1199
|
+
* Note: Only applicable when Stripe ACH is enabled as a payment method.
|
|
1200
|
+
*/
|
|
1005
1201
|
stripe?: {
|
|
1202
|
+
/**
|
|
1203
|
+
* Mandate data for ACH authorization and compliance.
|
|
1204
|
+
*
|
|
1205
|
+
* ACH payments require customer authorization (mandate) for bank account debits.
|
|
1206
|
+
* This configuration controls the mandate text displayed to customers.
|
|
1207
|
+
*/
|
|
1006
1208
|
mandateData: {
|
|
1209
|
+
/**
|
|
1210
|
+
* Custom mandate text for ACH authorization.
|
|
1211
|
+
*
|
|
1212
|
+
* When provided, overrides default mandate language.
|
|
1213
|
+
* Must comply with ACH authorization requirements.
|
|
1214
|
+
*
|
|
1215
|
+
* @example "I authorize [Merchant Name] to debit my bank account for the amount shown."
|
|
1216
|
+
*/
|
|
1007
1217
|
fullMandateText?: string;
|
|
1218
|
+
/**
|
|
1219
|
+
* Merchant name displayed in the mandate authorization text.
|
|
1220
|
+
*
|
|
1221
|
+
* Used in default mandate language when `fullMandateText` is not provided.
|
|
1222
|
+
* Should match the legal business name for compliance.
|
|
1223
|
+
*
|
|
1224
|
+
* @example "Acme Corporation Inc."
|
|
1225
|
+
*/
|
|
1008
1226
|
merchantName?: string;
|
|
1009
1227
|
};
|
|
1228
|
+
/**
|
|
1229
|
+
* Stripe publishable API key for client-side operations.
|
|
1230
|
+
*
|
|
1231
|
+
* Required for Stripe ACH functionality. Obtain from Stripe Dashboard.
|
|
1232
|
+
* Use the publishable key (starts with `pk_`), not the secret key.
|
|
1233
|
+
*
|
|
1234
|
+
* @example "pk_test_51H..."
|
|
1235
|
+
*/
|
|
1010
1236
|
publishableKey?: string;
|
|
1011
1237
|
} & Record<string, unknown>;
|
|
1012
1238
|
/**
|
|
@@ -1045,13 +1271,75 @@ export interface PrimerCheckoutOptions {
|
|
|
1045
1271
|
useBuiltInButton?: boolean;
|
|
1046
1272
|
};
|
|
1047
1273
|
/**
|
|
1048
|
-
*
|
|
1274
|
+
* Controls which SDK engine is used for payment processing.
|
|
1275
|
+
*
|
|
1276
|
+
* - `true` or `undefined`: Uses SDK Core engine (recommended) - modern architecture with better performance
|
|
1277
|
+
* - `false`: Uses legacy SDK engine (primer-sdk-web) - maintained for backward compatibility only
|
|
1278
|
+
*
|
|
1279
|
+
* SDK Core provides:
|
|
1280
|
+
* - Improved performance and reliability
|
|
1281
|
+
* - Better error handling and validation
|
|
1282
|
+
* - Newer payment method features
|
|
1283
|
+
* - Active development and feature updates
|
|
1284
|
+
*
|
|
1285
|
+
* Legacy SDK is maintained for backward compatibility but receives only critical bug fixes.
|
|
1286
|
+
* New integrations should use SDK Core (leave this option undefined or set to true).
|
|
1049
1287
|
*
|
|
1050
1288
|
* @default true
|
|
1051
|
-
* @remarks
|
|
1289
|
+
* @remarks Setting to false may result in different cardholder name handling for compatibility
|
|
1052
1290
|
*/
|
|
1053
1291
|
sdkCore?: boolean;
|
|
1292
|
+
/**
|
|
1293
|
+
* Globally disables all payment method interactions in drop-in mode.
|
|
1294
|
+
*
|
|
1295
|
+
* When true, all payment method buttons and forms are rendered but disabled,
|
|
1296
|
+
* creating a display-only preview mode. Useful for showing checkout UI without
|
|
1297
|
+
* allowing actual transactions (e.g., design previews, demos, screenshots).
|
|
1298
|
+
*
|
|
1299
|
+
* When false or undefined, payment methods are fully interactive.
|
|
1300
|
+
*
|
|
1301
|
+
* Note: This only affects drop-in mode. Does not apply to headless implementations.
|
|
1302
|
+
*
|
|
1303
|
+
* @default false
|
|
1304
|
+
* @example
|
|
1305
|
+
* ```typescript
|
|
1306
|
+
* // Preview mode - show UI but prevent interactions
|
|
1307
|
+
* { disabledPayments: true }
|
|
1308
|
+
*
|
|
1309
|
+
* // Normal mode - fully interactive checkout
|
|
1310
|
+
* { disabledPayments: false }
|
|
1311
|
+
* ```
|
|
1312
|
+
*/
|
|
1054
1313
|
disabledPayments?: boolean;
|
|
1314
|
+
/**
|
|
1315
|
+
* Specifies which payment methods are enabled and displayed in the checkout.
|
|
1316
|
+
*
|
|
1317
|
+
* By default, only `PaymentMethodType.PAYMENT_CARD` is enabled.
|
|
1318
|
+
* Configure this to enable specific payment methods for your checkout flow.
|
|
1319
|
+
*
|
|
1320
|
+
* Available payment methods include: `PAYMENT_CARD`, `APPLE_PAY`, `GOOGLE_PAY`,
|
|
1321
|
+
* `PAYPAL`, `KLARNA`, `ADYEN_BLIK`, and many regional payment options.
|
|
1322
|
+
*
|
|
1323
|
+
* @default [PaymentMethodType.PAYMENT_CARD]
|
|
1324
|
+
* @see PaymentMethodType - Full enum of available payment method types
|
|
1325
|
+
* @example
|
|
1326
|
+
* ```typescript
|
|
1327
|
+
* // Enable card and digital wallets
|
|
1328
|
+
* enabledPaymentMethods: [
|
|
1329
|
+
* PaymentMethodType.PAYMENT_CARD,
|
|
1330
|
+
* PaymentMethodType.APPLE_PAY,
|
|
1331
|
+
* PaymentMethodType.GOOGLE_PAY,
|
|
1332
|
+
* PaymentMethodType.PAYPAL
|
|
1333
|
+
* ]
|
|
1334
|
+
*
|
|
1335
|
+
* // Enable card and BLIK (Poland)
|
|
1336
|
+
* enabledPaymentMethods: [
|
|
1337
|
+
* PaymentMethodType.PAYMENT_CARD,
|
|
1338
|
+
* PaymentMethodType.ADYEN_BLIK
|
|
1339
|
+
* ]
|
|
1340
|
+
* ```
|
|
1341
|
+
*/
|
|
1342
|
+
enabledPaymentMethods?: typeof PaymentMethodType.PAYMENT_CARD | (typeof PaymentMethodType.ADYEN_BLIK)[];
|
|
1055
1343
|
}
|
|
1056
1344
|
export type InitializedManager = {
|
|
1057
1345
|
type: typeof PaymentMethodType.STRIPE_ACH;
|
|
@@ -1068,16 +1356,42 @@ export type InitializedManager = {
|
|
|
1068
1356
|
} | {
|
|
1069
1357
|
type: typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY;
|
|
1070
1358
|
manager: INativePaymentMethodManager;
|
|
1359
|
+
} | {
|
|
1360
|
+
type: typeof PaymentMethodType.ADYEN_BLIK;
|
|
1361
|
+
manager: IBlikPaymentMethodManager;
|
|
1071
1362
|
};
|
|
1363
|
+
/**
|
|
1364
|
+
* Native payment method types (sent with managerType: 'NATIVE' from server)
|
|
1365
|
+
*/
|
|
1366
|
+
export type NativePaymentMethodTypes = typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY | typeof PaymentMethodType.ADYEN_BLIK;
|
|
1072
1367
|
export type ManagerByType<T extends PaymentMethodType> = Extract<InitializedManager, {
|
|
1073
1368
|
type: T;
|
|
1074
1369
|
}>;
|
|
1075
1370
|
export interface InitializedManagersMap extends Map<PaymentMethodType, InitializedManager> {
|
|
1076
1371
|
get<T extends PaymentMethodType>(key: T): ManagerByType<T> | undefined;
|
|
1077
1372
|
}
|
|
1078
|
-
|
|
1373
|
+
/**
|
|
1374
|
+
* Payment methods that use the REDIRECT manager type.
|
|
1375
|
+
*
|
|
1376
|
+
* This type excludes payment methods with specialized manager types:
|
|
1377
|
+
* - STRIPE_ACH: Uses ACH manager
|
|
1378
|
+
* - PAYMENT_CARD: Uses CARD manager
|
|
1379
|
+
* - KLARNA: Uses KLARNA manager
|
|
1380
|
+
* - PAYPAL, GOOGLE_PAY, APPLE_PAY: Use NATIVE manager
|
|
1381
|
+
* - ADYEN_BLIK: Uses BLIK manager
|
|
1382
|
+
*
|
|
1383
|
+
* All other payment methods use the REDIRECT manager by default.
|
|
1384
|
+
*/
|
|
1385
|
+
export type RedirectPaymentMethodTypes = Exclude<PaymentMethodType, typeof PaymentMethodType.STRIPE_ACH | typeof PaymentMethodType.PAYMENT_CARD | typeof PaymentMethodType.KLARNA | typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY | typeof PaymentMethodType.ADYEN_BLIK>;
|
|
1079
1386
|
export type DynamicPaymentMethodTypes = typeof PaymentMethodType.STRIPE_ACH;
|
|
1080
|
-
|
|
1387
|
+
/**
|
|
1388
|
+
* Represents a payment method that uses the REDIRECT manager.
|
|
1389
|
+
*
|
|
1390
|
+
* REDIRECT payment methods typically involve redirecting the user to an external
|
|
1391
|
+
* page for authorization. However, some REDIRECT payment methods (like BLIK)
|
|
1392
|
+
* use custom inline UI components while still being classified as REDIRECT type
|
|
1393
|
+
* due to their flow characteristics (status polling, external authorization).
|
|
1394
|
+
*/
|
|
1081
1395
|
export type RedirectPaymentMethod = {
|
|
1082
1396
|
type: RedirectPaymentMethodTypes;
|
|
1083
1397
|
managerType: HeadlessManagerType.REDIRECT;
|
|
@@ -1100,6 +1414,9 @@ export type InitializedPaymentMethod = {
|
|
|
1100
1414
|
} | {
|
|
1101
1415
|
type: typeof PaymentMethodType.APPLE_PAY;
|
|
1102
1416
|
managerType: HeadlessManagerType.NATIVE;
|
|
1417
|
+
} | {
|
|
1418
|
+
type: typeof PaymentMethodType.ADYEN_BLIK;
|
|
1419
|
+
managerType: HeadlessManagerType.BLIK;
|
|
1103
1420
|
} | RedirectPaymentMethod;
|
|
1104
1421
|
export type PaymentMethodByType<T extends PaymentMethodType> = Extract<InitializedPaymentMethod, {
|
|
1105
1422
|
type: T;
|
|
@@ -2357,6 +2674,110 @@ declare global {
|
|
|
2357
2674
|
"primer-paypal": PayPalComponent;
|
|
2358
2675
|
}
|
|
2359
2676
|
}
|
|
2677
|
+
/**
|
|
2678
|
+
* BLIK Payment Component
|
|
2679
|
+
*
|
|
2680
|
+
* Consolidated component handling BLIK payment flow from button click through
|
|
2681
|
+
* payment completion. Uses a 4-state machine for managing the user experience.
|
|
2682
|
+
*
|
|
2683
|
+
* @element primer-blik
|
|
2684
|
+
*
|
|
2685
|
+
* @property {InitializedPaymentMethod} paymentMethod - Payment method configuration
|
|
2686
|
+
* @property {boolean} disabled - Disables component interaction when true
|
|
2687
|
+
*
|
|
2688
|
+
* @fires primer-payment-success - Dispatched on successful payment
|
|
2689
|
+
* @fires primer-payment-error - Dispatched on payment error
|
|
2690
|
+
*
|
|
2691
|
+
* @example
|
|
2692
|
+
* ```html
|
|
2693
|
+
* <primer-blik .paymentMethod=${blikMethod}></primer-blik>
|
|
2694
|
+
* <primer-blik disabled></primer-blik>
|
|
2695
|
+
* ```
|
|
2696
|
+
*/
|
|
2697
|
+
declare class BlikComponent extends LitElement {
|
|
2698
|
+
static styles: import("lit").CSSResult[];
|
|
2699
|
+
paymentMethod: InitializedPaymentMethod | undefined;
|
|
2700
|
+
disabled: boolean;
|
|
2701
|
+
paymentManagers: InitializedManagersMap;
|
|
2702
|
+
private currentState;
|
|
2703
|
+
private blikCode;
|
|
2704
|
+
private errorMessage;
|
|
2705
|
+
private pollingDuration;
|
|
2706
|
+
private pollingTimer;
|
|
2707
|
+
/**
|
|
2708
|
+
* Manager loading task
|
|
2709
|
+
* Validates BLIK manager exists before allowing payment flow
|
|
2710
|
+
*
|
|
2711
|
+
* This Task provides reactive validation of manager availability:
|
|
2712
|
+
* - Automatically re-runs when paymentMethod or paymentManagers change
|
|
2713
|
+
* - Provides type-safe access to the BLIK manager
|
|
2714
|
+
* - Enables early error detection before user interaction
|
|
2715
|
+
*
|
|
2716
|
+
* Unlike native payment methods (Apple Pay, Google Pay, PayPal) which use a
|
|
2717
|
+
* two-task pattern (manager loading + button rendering), BLIK only needs the
|
|
2718
|
+
* manager loading task because it renders its own UI via Lit templates.
|
|
2719
|
+
*/
|
|
2720
|
+
private loadManagerTask;
|
|
2721
|
+
/**
|
|
2722
|
+
* Handles button click to toggle between collapsed and expanded states
|
|
2723
|
+
*/
|
|
2724
|
+
private handleButtonClick;
|
|
2725
|
+
/**
|
|
2726
|
+
* Handles collapsing the form back to button-only view
|
|
2727
|
+
* Resets form state when user clicks button to collapse
|
|
2728
|
+
*/
|
|
2729
|
+
private handleCollapse;
|
|
2730
|
+
/**
|
|
2731
|
+
* Handles input changes, validates numeric input, and auto-submits on 6 digits
|
|
2732
|
+
*/
|
|
2733
|
+
private handleInput;
|
|
2734
|
+
/**
|
|
2735
|
+
* Handles retry button click
|
|
2736
|
+
*/
|
|
2737
|
+
private handleRetry;
|
|
2738
|
+
/**
|
|
2739
|
+
* Starts polling timer to track payment duration
|
|
2740
|
+
*/
|
|
2741
|
+
private startPollingTimer;
|
|
2742
|
+
/**
|
|
2743
|
+
* Stops and resets polling timer
|
|
2744
|
+
*/
|
|
2745
|
+
private stopPollingTimer;
|
|
2746
|
+
/**
|
|
2747
|
+
* Validates and submits the BLIK code
|
|
2748
|
+
*/
|
|
2749
|
+
private submitBlikCode;
|
|
2750
|
+
/**
|
|
2751
|
+
* Renders the collapsed button state
|
|
2752
|
+
*/
|
|
2753
|
+
private renderCollapsed;
|
|
2754
|
+
/**
|
|
2755
|
+
* Renders the expanded input state
|
|
2756
|
+
*/
|
|
2757
|
+
private renderExpandedInput;
|
|
2758
|
+
/**
|
|
2759
|
+
* Renders the loading state
|
|
2760
|
+
*/
|
|
2761
|
+
private renderLoading;
|
|
2762
|
+
/**
|
|
2763
|
+
* Renders the error state
|
|
2764
|
+
*/
|
|
2765
|
+
private renderError;
|
|
2766
|
+
/**
|
|
2767
|
+
* Renders the appropriate expanded state based on current state
|
|
2768
|
+
*/
|
|
2769
|
+
private renderExpandedState;
|
|
2770
|
+
/**
|
|
2771
|
+
* Cleanup timer on disconnect
|
|
2772
|
+
*/
|
|
2773
|
+
disconnectedCallback(): void;
|
|
2774
|
+
render(): TemplateResult;
|
|
2775
|
+
}
|
|
2776
|
+
declare global {
|
|
2777
|
+
interface HTMLElementTagNameMap {
|
|
2778
|
+
"primer-blik": BlikComponent;
|
|
2779
|
+
}
|
|
2780
|
+
}
|
|
2360
2781
|
declare class PaymentMethodComponent extends LitElement {
|
|
2361
2782
|
static styles: import("lit").CSSResult[];
|
|
2362
2783
|
type: PaymentMethodType | undefined;
|
|
@@ -2668,7 +3089,7 @@ export interface PortalDialogData {
|
|
|
2668
3089
|
onOpen?: () => void;
|
|
2669
3090
|
onContentRendered?: () => void;
|
|
2670
3091
|
}
|
|
2671
|
-
|
|
3092
|
+
declare class PortalDialogComponent extends LitElement {
|
|
2672
3093
|
static styles: import("lit").CSSResult[];
|
|
2673
3094
|
size: "flex" | "large";
|
|
2674
3095
|
showCloseButton: boolean;
|
|
@@ -2701,6 +3122,11 @@ export declare class PortalDialogComponent extends LitElement {
|
|
|
2701
3122
|
updated(changedProperties: Map<string, unknown>): void;
|
|
2702
3123
|
render(): import("lit-html").TemplateResult<1>;
|
|
2703
3124
|
}
|
|
3125
|
+
declare global {
|
|
3126
|
+
interface HTMLElementTagNameMap {
|
|
3127
|
+
"primer-portal-dialog": PortalDialogComponent;
|
|
3128
|
+
}
|
|
3129
|
+
}
|
|
2704
3130
|
/**
|
|
2705
3131
|
* Events emitted by the vault manager components
|
|
2706
3132
|
*/
|
|
@@ -3832,6 +4258,7 @@ export {
|
|
|
3832
4258
|
AchPaymentComponent as AchPayment,
|
|
3833
4259
|
ApplePayComponent as ApplePay,
|
|
3834
4260
|
BillingAddressComponent as BillingAddress,
|
|
4261
|
+
BlikComponent as Blik,
|
|
3835
4262
|
ButtonComponent as Button,
|
|
3836
4263
|
CardFormComponent as CardForm,
|
|
3837
4264
|
CardFormSubmitComponent as CardFormSubmit,
|
|
@@ -3854,6 +4281,7 @@ export {
|
|
|
3854
4281
|
PaymentMethodComponent as PaymentMethod,
|
|
3855
4282
|
PaymentMethodContainerComponent as PaymentMethodContainer,
|
|
3856
4283
|
PortalComponent as Portal,
|
|
4284
|
+
PortalDialogComponent as PortalDialog,
|
|
3857
4285
|
PrimerCheckoutCompleteComponent as PrimerCheckoutComplete,
|
|
3858
4286
|
PrimerCheckoutErrorComponent as PrimerCheckoutFailure,
|
|
3859
4287
|
PrimerCheckoutStateComponent as PrimerCheckoutState,
|