@primer-io/primer-js 0.3.12 → 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.
@@ -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",
@@ -191,6 +192,7 @@ declare enum EventTypes {
191
192
  BLUR = "blur",
192
193
  CLICK = "click",
193
194
  CLOSE = "close",
195
+ ENTER = "enter",
194
196
  CONFIRMED_KLARNA_CATEGORY = "CONFIRMED_KLARNA_CATEGORY",
195
197
  CONFIRMED_KLARNA_CATEGORY_ERROR = "CONFIRMED_KLARNA_CATEGORY_ERROR",
196
198
  KLARNA_SESSION_UPDATE = "KLARNA_SESSION_UPDATE",
@@ -231,6 +233,9 @@ export interface ClientSessionAddress {
231
233
  countryCode?: string;
232
234
  postalCode?: string;
233
235
  }
236
+ export type NullableAddress = {
237
+ [K in keyof ClientSessionAddress]?: ClientSessionAddress[K] | null;
238
+ };
234
239
  export interface ClientSession {
235
240
  orderId?: string;
236
241
  currencyCode?: string;
@@ -313,7 +318,7 @@ export interface InputMetadata {
313
318
  touched: boolean;
314
319
  submitted: boolean;
315
320
  }
316
- export interface PaymentMethodConfig {
321
+ export interface PaymentMethodConfig<T = Record<string, unknown>> {
317
322
  id: string;
318
323
  type: PaymentMethodType;
319
324
  name: string;
@@ -326,9 +331,9 @@ export interface PaymentMethodConfig {
326
331
  light: string;
327
332
  };
328
333
  borderWidth: {
329
- colored: number;
330
- dark: number;
331
- light: number;
334
+ colored: number | string;
335
+ dark: number | string;
336
+ light: number | string;
332
337
  };
333
338
  cornerRadius: number;
334
339
  iconPositionRelativeToText?: "START" | "END";
@@ -348,7 +353,7 @@ export interface PaymentMethodConfig {
348
353
  height: number;
349
354
  };
350
355
  };
351
- options: {
356
+ options: T extends Record<string, unknown> ? T : {
352
357
  captureVaultedCardCvv?: boolean;
353
358
  clientId?: string;
354
359
  threeDSecureToken?: string;
@@ -632,6 +637,11 @@ export interface IAchPaymentMethodManager {
632
637
  declineMandate(): Promise<void>;
633
638
  getPaymentMethod(): void;
634
639
  }
640
+ export interface IBlikPaymentMethodManager {
641
+ start(params: {
642
+ blikCode: string;
643
+ }): Promise<void>;
644
+ }
635
645
  export interface HeadlessVaultManager {
636
646
  fetchVaultedPaymentMethods(): Promise<VaultedPaymentMethod[]>;
637
647
  deleteVaultedPaymentMethod(id: string): Promise<void>;
@@ -653,6 +663,21 @@ export interface IAssetsManager {
653
663
  displayName?: string;
654
664
  } | null>;
655
665
  }
666
+ export interface CheckoutModuleConfig {
667
+ type: string;
668
+ options?: Record<string, unknown>;
669
+ }
670
+ export interface ClientConfiguration {
671
+ binDataUrl: string;
672
+ checkoutModules?: CheckoutModuleConfig[];
673
+ clientSession: ClientSession;
674
+ coreUrl: string;
675
+ env: string;
676
+ paymentMethods: PaymentMethodConfig[];
677
+ pciUrl: string;
678
+ primerAccountId: string;
679
+ settleOnAuth?: boolean;
680
+ }
656
681
  export interface HeadlessSDKUtilities {
657
682
  getCardNetworkAsset(network: string): {
658
683
  cardUrl: string;
@@ -674,6 +699,7 @@ export interface HeadlessSDKUtilities {
674
699
  goatCdnUrl: string;
675
700
  } | undefined>;
676
701
  getPaymentMethodConfiguration(paymentMethodType: PaymentMethodType): PaymentMethodConfig | undefined;
702
+ setBillingAddress(address: NullableAddress): Promise<void>;
677
703
  }
678
704
  export interface CardPaymentMethodManagerOptions {
679
705
  onCardMetadataChange?: (metadata: {
@@ -768,6 +794,7 @@ export interface PrimerHeadlessCheckout {
768
794
  getAssetsManager(): IAssetsManager;
769
795
  start: () => Promise<void>;
770
796
  refreshClientSession(): Promise<boolean>;
797
+ getConfiguration(): ClientConfiguration;
771
798
  teardown?: () => void;
772
799
  }
773
800
  export interface HeadlessUniversalCheckoutOptions {
@@ -945,6 +972,27 @@ export interface KlarnaOptions {
945
972
  */
946
973
  export interface PrimerCheckoutOptions {
947
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
+ */
948
996
  locale?: string;
949
997
  apiVersion?: APIVersionOption;
950
998
  /**
@@ -952,40 +1000,239 @@ export interface PrimerCheckoutOptions {
952
1000
  * If not provided, defaults to window.location.hostname.
953
1001
  * This is particularly useful when the checkout is hosted on a different domain
954
1002
  * than the merchant's registered Apple Pay domain.
1003
+ *
1004
+ * @default window.location.hostname
955
1005
  */
956
1006
  merchantDomain?: string;
1007
+ /**
1008
+ * Configuration for card payment method options.
1009
+ * Controls the display and validation of card form fields.
1010
+ */
957
1011
  card?: {
1012
+ /**
1013
+ * Configuration for the cardholder name input field.
1014
+ */
958
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
+ */
959
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
+ */
960
1032
  visible?: boolean;
961
1033
  };
962
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
+ */
963
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
+ */
964
1065
  captureBillingAddress?: boolean;
1066
+ /**
1067
+ * Billing contact field configuration for Apple Pay.
1068
+ */
965
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
+ */
966
1077
  requiredBillingContactFields?: Array<"emailAddress" | "name" | "phoneNumber" | "postalAddress" | "phoneticName">;
967
1078
  };
1079
+ /**
1080
+ * Shipping contact field and method configuration for Apple Pay.
1081
+ */
968
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
+ */
969
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
+ */
970
1098
  requireShippingMethod?: boolean;
971
1099
  };
972
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
+ */
973
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
+ */
974
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
+ */
975
1160
  klarna?: KlarnaOptions;
976
- threeDsOptions?: {
977
- enabled?: boolean;
978
- preferred?: boolean;
979
- };
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
+ */
980
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
+ */
981
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
+ */
982
1191
  showEmptyState?: boolean;
983
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
+ */
984
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
+ */
985
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
+ */
986
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
+ */
987
1226
  merchantName?: string;
988
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
+ */
989
1236
  publishableKey?: string;
990
1237
  } & Record<string, unknown>;
991
1238
  /**
@@ -1023,8 +1270,76 @@ export interface PrimerCheckoutOptions {
1023
1270
  */
1024
1271
  useBuiltInButton?: boolean;
1025
1272
  };
1273
+ /**
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).
1287
+ *
1288
+ * @default true
1289
+ * @remarks Setting to false may result in different cardholder name handling for compatibility
1290
+ */
1026
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
+ */
1027
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)[];
1028
1343
  }
1029
1344
  export type InitializedManager = {
1030
1345
  type: typeof PaymentMethodType.STRIPE_ACH;
@@ -1041,16 +1356,42 @@ export type InitializedManager = {
1041
1356
  } | {
1042
1357
  type: typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY;
1043
1358
  manager: INativePaymentMethodManager;
1359
+ } | {
1360
+ type: typeof PaymentMethodType.ADYEN_BLIK;
1361
+ manager: IBlikPaymentMethodManager;
1044
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;
1045
1367
  export type ManagerByType<T extends PaymentMethodType> = Extract<InitializedManager, {
1046
1368
  type: T;
1047
1369
  }>;
1048
1370
  export interface InitializedManagersMap extends Map<PaymentMethodType, InitializedManager> {
1049
1371
  get<T extends PaymentMethodType>(key: T): ManagerByType<T> | undefined;
1050
1372
  }
1051
- 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>;
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>;
1052
1386
  export type DynamicPaymentMethodTypes = typeof PaymentMethodType.STRIPE_ACH;
1053
- export type NativePaymentMethodTypes = typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY;
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
+ */
1054
1395
  export type RedirectPaymentMethod = {
1055
1396
  type: RedirectPaymentMethodTypes;
1056
1397
  managerType: HeadlessManagerType.REDIRECT;
@@ -1073,6 +1414,9 @@ export type InitializedPaymentMethod = {
1073
1414
  } | {
1074
1415
  type: typeof PaymentMethodType.APPLE_PAY;
1075
1416
  managerType: HeadlessManagerType.NATIVE;
1417
+ } | {
1418
+ type: typeof PaymentMethodType.ADYEN_BLIK;
1419
+ managerType: HeadlessManagerType.BLIK;
1076
1420
  } | RedirectPaymentMethod;
1077
1421
  export type PaymentMethodByType<T extends PaymentMethodType> = Extract<InitializedPaymentMethod, {
1078
1422
  type: T;
@@ -1216,6 +1560,7 @@ declare class PrimerEventsController implements ReactiveController {
1216
1560
  export type AnalyticsContextType = AnalyticsUtils | null;
1217
1561
  export type EventsContextType = PrimerEventsController | null;
1218
1562
  export type HeadlessUtilsContextType = HeadlessSDKUtilities | null;
1563
+ export type ConfigurationContextType = ClientConfiguration | null;
1219
1564
  export type KlarnaCategoriesContextType = {
1220
1565
  categories: KlarnaPaymentMethodCategory[];
1221
1566
  isLoading: boolean;
@@ -1355,6 +1700,7 @@ declare class SDKContextController implements ReactiveController {
1355
1700
  private vaultManagerCvvProvider;
1356
1701
  private clientOptionsContext;
1357
1702
  private headlessUtilsProvider;
1703
+ private configurationProvider;
1358
1704
  private klarnaCategoriesProvider;
1359
1705
  private computedStylesProvider;
1360
1706
  private analyticsProvider;
@@ -1381,6 +1727,8 @@ declare class SDKContextController implements ReactiveController {
1381
1727
  setKlarnaCategories(value: KlarnaCategoriesContextType): void;
1382
1728
  setClientOptions(value: PrimerCheckoutOptions | null): void;
1383
1729
  setHeadlessUtils(value: HeadlessUtilsContextType): void;
1730
+ setConfiguration(value: ConfigurationContextType): void;
1731
+ getConfiguration(): ConfigurationContextType | undefined;
1384
1732
  setAnalyticsUtils(value: AnalyticsContextType): void;
1385
1733
  getAnalyticsUtils(): AnalyticsContextType | undefined;
1386
1734
  setComputedStyles(value: CSSStyleDeclaration): void;
@@ -1987,6 +2335,61 @@ declare global {
1987
2335
  "primer-input": InputComponent;
1988
2336
  }
1989
2337
  }
2338
+ export interface SelectOption {
2339
+ value: string;
2340
+ label: string;
2341
+ }
2342
+ /**
2343
+ * A native select dropdown component
2344
+ *
2345
+ * @element primer-select
2346
+ *
2347
+ * @fires change - Fired when selection changes
2348
+ * @fires input - Fired when input value changes
2349
+ * @fires focus - Fired when select receives focus
2350
+ * @fires blur - Fired when select loses focus
2351
+ */
2352
+ declare class SelectComponent extends LitElement {
2353
+ static styles: import("lit").CSSResult[];
2354
+ /**
2355
+ * The name attribute for the select element
2356
+ */
2357
+ name: string;
2358
+ /**
2359
+ * The id attribute for the select element
2360
+ */
2361
+ id: string;
2362
+ /**
2363
+ * The current value of the select
2364
+ */
2365
+ value: string;
2366
+ /**
2367
+ * Whether the select is disabled
2368
+ */
2369
+ disabled: boolean;
2370
+ /**
2371
+ * Whether the select is in an error state
2372
+ */
2373
+ hasError: boolean;
2374
+ /**
2375
+ * Placeholder text for the select
2376
+ */
2377
+ placeholder: string;
2378
+ /**
2379
+ * Array of options for the select
2380
+ */
2381
+ options: SelectOption[];
2382
+ private handleChange;
2383
+ private handleFocus;
2384
+ private handleBlur;
2385
+ private renderSelectOptions;
2386
+ render(): import("lit-html").TemplateResult<1>;
2387
+ }
2388
+ declare global {
2389
+ interface HTMLElementTagNameMap {
2390
+ "primer-select": SelectComponent;
2391
+ }
2392
+ }
1990
2393
  /**
1991
2394
  * Event detail interface for expanded-changed event
1992
2395
  */
@@ -2271,6 +2674,110 @@ declare global {
2271
2674
  "primer-paypal": PayPalComponent;
2272
2675
  }
2273
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
+ }
2274
2781
  declare class PaymentMethodComponent extends LitElement {
2275
2782
  static styles: import("lit").CSSResult[];
2276
2783
  type: PaymentMethodType | undefined;
@@ -2417,6 +2924,158 @@ declare global {
2417
2924
  "primer-redirect-payment": RedirectPaymentComponent;
2418
2925
  }
2419
2926
  }
2927
+ /**
2928
+ * BillingAddressComponent provides a form for collecting billing address information.
2929
+ *
2930
+ * Configuration is exclusively server-side via SDK Core's checkoutModules. Field visibility
2931
+ * is determined by the BILLING_ADDRESS module in the client session configuration.
2932
+ *
2933
+ * @element primer-billing-address
2934
+ *
2935
+ * @fires primer-billing-address-change - Fired when form data changes
2936
+ * @fires primer-billing-address-submit - Fired when form is submitted
2937
+ */
2938
+ declare class BillingAddressComponent extends LitElement {
2939
+ static styles: import("lit").CSSResult[];
2940
+ /**
2941
+ * Configuration from SDK Core containing checkoutModules configuration
2942
+ */
2943
+ configuration: ConfigurationContextType;
2944
+ /**
2945
+ * Headless SDK utilities for API methods like setBillingAddress
2946
+ */
2947
+ headlessUtils: HeadlessUtilsContextType;
2948
+ /**
2949
+ * Form data state
2950
+ */
2951
+ private formData;
2952
+ /**
2953
+ * Validation errors state
2954
+ */
2955
+ private errors;
2956
+ /**
2957
+ * Tracks which fields have been touched (blurred after focus)
2958
+ */
2959
+ private touchedFields;
2960
+ /**
2961
+ * Tracks which fields are dirty (have had input)
2962
+ */
2963
+ private dirtyFields;
2964
+ /**
2965
+ * Tracks which field is currently focused
2966
+ */
2967
+ private focusedField;
2968
+ /**
2969
+ * Tracks whether the form has been submitted
2970
+ * Errors only show after submit or after field blur
2971
+ */
2972
+ private submitted;
2973
+ /**
2974
+ * List of countries for the select dropdown
2975
+ * Initialize with empty array, will be populated in connectedCallback
2976
+ */
2977
+ private countryOptions;
2978
+ /**
2979
+ * Initialization task that waits for context availability
2980
+ *
2981
+ * Purpose: Ensures configuration and headlessUtils contexts are ready before
2982
+ * attempting field configuration extraction and country initialization
2983
+ *
2984
+ * Lifecycle:
2985
+ * - Task runs when this.configuration or this.headlessUtils changes
2986
+ * - Stays pending (returns initialState) until both contexts are available
2987
+ * - Completes when field config is extracted and countries initialized
2988
+ *
2989
+ * Phase 2: Infrastructure setup with stub methods
2990
+ * Phase 3: Will extract field configuration from checkoutModules
2991
+ * Phase 4: Will coordinate country initialization with Task lifecycle
2992
+ */
2993
+ private _initializationTask;
2994
+ /**
2995
+ * Initialize countries list
2996
+ */
2997
+ connectedCallback(): void;
2998
+ /**
2999
+ * Extract billing address field configuration from SDK Core checkoutModules
3000
+ * @param configuration - Configuration context from SDK Core
3001
+ * @returns Field configuration object
3002
+ */
3003
+ private extractFieldConfig;
3004
+ /**
3005
+ * Initialize country options with two-phase loading:
3006
+ * 1. Synchronously load English countries first
3007
+ * 2. Asynchronously load locale-specific countries
3008
+ *
3009
+ * This preserves the existing behavior where users see English countries
3010
+ * immediately, then see localized names if available.
3011
+ */
3012
+ private initializeCountryOptions;
3013
+ /**
3014
+ * Get billing address field configuration from SDK Core checkoutModules.
3015
+ *
3016
+ * This getter is used during rendering after the initialization task completes.
3017
+ * Configuration is determined by server-side checkoutModules configuration.
3018
+ * If not present, defaults to all fields disabled (form hidden).
3019
+ */
3020
+ private get fieldConfig();
3021
+ /**
3022
+ * Default field configuration (all fields disabled).
3023
+ * When no configuration is provided, the form is hidden.
3024
+ * This matches the legacy SDK behavior where billing address is opt-in.
3025
+ */
3026
+ private get defaultFieldConfig();
3027
+ /**
3028
+ * Check if the form should be visible
3029
+ * According to legacy SDK: form is hidden if postalCode is false
3030
+ */
3031
+ private get shouldShowForm();
3032
+ /**
3033
+ * Handle input change events
3034
+ */
3035
+ private handleInput;
3036
+ /**
3037
+ * Handle focus events
3038
+ */
3039
+ private handleFocus;
3040
+ /**
3041
+ * Handle blur events for validation
3042
+ */
3043
+ private handleBlur;
3044
+ /**
3045
+ * Validate a single field
3046
+ */
3047
+ private validateField;
3048
+ /**
3049
+ * Validate all enabled fields
3050
+ */
3051
+ private validateForm;
3052
+ /**
3053
+ * Public method to validate billing address fields
3054
+ * Called by the parent form (card-form) when submitting
3055
+ * Returns true if billing address is valid
3056
+ * Note: Does NOT call setBillingAddress API - that happens after card validation
3057
+ */
3058
+ validateForSubmission(): Promise<boolean>;
3059
+ /**
3060
+ * Public method to submit billing address to SDK Core
3061
+ * Called by parent form ONLY after both card and billing address validation pass
3062
+ *
3063
+ * Note: headlessUtils is guaranteed to be available when this method is called,
3064
+ * as the component only renders (and becomes interactive) after initialization task completes.
3065
+ */
3066
+ submitToSDK(): Promise<boolean>;
3067
+ /**
3068
+ * Check if field should show error
3069
+ * Matches card input behavior: show errors after submit OR after field is dirty AND touched
3070
+ */
3071
+ private shouldShowError;
3072
+ render(): symbol | import("lit-html").TemplateResult<1> | undefined;
3073
+ }
3074
+ declare global {
3075
+ interface HTMLElementTagNameMap {
3076
+ "primer-billing-address": BillingAddressComponent;
3077
+ }
3078
+ }
2420
3079
  /**
2421
3080
  * Interface for secure htmlContent access
2422
3081
  */
@@ -2430,7 +3089,7 @@ export interface PortalDialogData {
2430
3089
  onOpen?: () => void;
2431
3090
  onContentRendered?: () => void;
2432
3091
  }
2433
- export declare class PortalDialogComponent extends LitElement {
3092
+ declare class PortalDialogComponent extends LitElement {
2434
3093
  static styles: import("lit").CSSResult[];
2435
3094
  size: "flex" | "large";
2436
3095
  showCloseButton: boolean;
@@ -2463,6 +3122,11 @@ export declare class PortalDialogComponent extends LitElement {
2463
3122
  updated(changedProperties: Map<string, unknown>): void;
2464
3123
  render(): import("lit-html").TemplateResult<1>;
2465
3124
  }
3125
+ declare global {
3126
+ interface HTMLElementTagNameMap {
3127
+ "primer-portal-dialog": PortalDialogComponent;
3128
+ }
3129
+ }
2466
3130
  /**
2467
3131
  * Events emitted by the vault manager components
2468
3132
  */
@@ -2904,6 +3568,11 @@ declare class CardFormComponent extends LitElement {
2904
3568
  */
2905
3569
  private hasAssignedContent;
2906
3570
  private selectedCardNetwork;
3571
+ /**
3572
+ * Form-level error message to display
3573
+ * @private
3574
+ */
3575
+ private formErrorMessage;
2907
3576
  /**
2908
3577
  * Flag to track if PAYMENT_METHOD_SELECTION event has been sent
2909
3578
  * @private
@@ -3358,7 +4027,7 @@ declare class CardFormSubmitComponent extends LitElement {
3358
4027
  */
3359
4028
  get buttonText(): string;
3360
4029
  set buttonText(value: string);
3361
- headlessInstance: HeadlessUtilsContextType;
4030
+ headlessUtils: HeadlessUtilsContextType;
3362
4031
  clientOptions: ClientOptionsContextType;
3363
4032
  sdkState: SdkStateContextType;
3364
4033
  cardFormContext: CardFormContext | null;
@@ -3588,6 +4257,8 @@ export declare function loadPrimer(): void;
3588
4257
  export {
3589
4258
  AchPaymentComponent as AchPayment,
3590
4259
  ApplePayComponent as ApplePay,
4260
+ BillingAddressComponent as BillingAddress,
4261
+ BlikComponent as Blik,
3591
4262
  ButtonComponent as Button,
3592
4263
  CardFormComponent as CardForm,
3593
4264
  CardFormSubmitComponent as CardFormSubmit,
@@ -3610,6 +4281,7 @@ export {
3610
4281
  PaymentMethodComponent as PaymentMethod,
3611
4282
  PaymentMethodContainerComponent as PaymentMethodContainer,
3612
4283
  PortalComponent as Portal,
4284
+ PortalDialogComponent as PortalDialog,
3613
4285
  PrimerCheckoutCompleteComponent as PrimerCheckoutComplete,
3614
4286
  PrimerCheckoutErrorComponent as PrimerCheckoutFailure,
3615
4287
  PrimerCheckoutStateComponent as PrimerCheckoutState,
@@ -3617,6 +4289,7 @@ export {
3617
4289
  PrimerKlarnaComponent as PrimerKlarna,
3618
4290
  PrimerMainComponent as PrimerMain,
3619
4291
  RedirectPaymentComponent as RedirectPayment,
4292
+ SelectComponent as Select,
3620
4293
  ShowOtherPaymentsComponent as ShowOtherPayments,
3621
4294
  SpinnerComponent as Spinner,
3622
4295
  VaultCvvInputComponent as VaultCvvInput,