@primer-io/primer-js 1.6.2 → 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.
@@ -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;
@@ -660,11 +671,7 @@ export interface TelemetryClient {
660
671
  }): void;
661
672
  };
662
673
  readonly remoteLog: {
663
- log(messageOrError: unknown, config?: {
664
- metadata?: Record<string, unknown>;
665
- status?: "error" | "warn" | "info";
666
- }): void;
667
- error(messageOrError: unknown, config?: {
674
+ log(message: string, config?: {
668
675
  metadata?: Record<string, unknown>;
669
676
  status?: "error" | "warn" | "info";
670
677
  }): void;
@@ -684,35 +691,16 @@ export interface TelemetryClient {
684
691
  dispose(): void;
685
692
  }
686
693
  declare enum HeadlessManagerType {
694
+ BACKEND_DRIVEN = "BACKEND_DRIVEN",
687
695
  BLIK = "BLIK",
688
696
  CARD = "CARD",
689
697
  NATIVE = "NATIVE",
690
698
  REDIRECT = "REDIRECT",
691
699
  KLARNA = "KLARNA",
692
700
  ADYEN_KLARNA = "ADYEN_KLARNA",
693
- ACH = "ACH",
694
701
  MBWAY = "MBWAY",
695
702
  QRCODE = "QRCODE"
696
703
  }
697
- export type PaymentMethodInfo = {
698
- type: PaymentMethodType;
699
- managerType: HeadlessManagerType;
700
- };
701
- declare enum EventTypes {
702
- CHANGE = "change",
703
- ENTER = "ENTER",
704
- ERROR = "error",
705
- FOCUS = "focus",
706
- BLUR = "blur",
707
- CLICK = "click",
708
- CLOSE = "close",
709
- INPUT = "input",
710
- CONFIRMED_KLARNA_CATEGORY = "CONFIRMED_KLARNA_CATEGORY",
711
- CONFIRMED_KLARNA_CATEGORY_ERROR = "CONFIRMED_KLARNA_CATEGORY_ERROR",
712
- KLARNA_SESSION_UPDATE = "KLARNA_SESSION_UPDATE",
713
- KLARNA_SESSION_REFRESH_ERROR = "KLARNA_SESSION_REFRESH_ERROR"
714
- }
715
- type EventListener$1 = (event?: Event) => void;
716
704
  export interface PayPalOptionsWithPaypalJsTypes {
717
705
  /**
718
706
  * Button style configuration with optional per-funding-source overrides.
@@ -792,41 +780,32 @@ export interface Payment {
792
780
  [key: string]: unknown;
793
781
  };
794
782
  }
795
- export interface HeadlessHostedInputOptions {
796
- placeholder?: string;
797
- ariaLabel?: string;
798
- style?: Record<string, unknown>;
799
- }
800
783
  export interface CardPaymentMethodSubmitValues {
801
784
  cardNetwork?: string;
802
785
  }
803
- export interface CardPaymentMethodManagerOptions {
804
- onBinDataAvailable?: (event: BinDataAvailableEvent) => void;
805
- onBinDataLoadingChange?: (loading: boolean) => void;
806
- onCardNetworksChange?: (event: CardNetworkChangeEvent) => void;
807
- onCardNetworksLoading?: () => void;
808
- }
809
- export interface KlarnaPaymentMethodManagerOptions {
810
- onPaymentMethodCategoriesChange?: (categories: {
811
- id: string;
812
- name: string;
813
- descriptiveAssetUrl: string;
814
- standardAssetUrl: string;
815
- }[]) => void;
816
- onPaymentMethodAction?: (action: string, data: {
817
- paymentMethodType: string;
818
- category: string;
819
- }) => void;
786
+ export interface KlarnaPaymentCategory {
787
+ name: string;
788
+ identifier: string;
789
+ standardAssetUrl: string;
790
+ descriptiveAssetUrl: string;
820
791
  }
821
- export interface KlarnaPaymentMethodManager {
792
+ export interface KlarnaPaymentMethod {
793
+ type: typeof PaymentMethodType.KLARNA;
794
+ managerType: HeadlessManagerType.KLARNA;
795
+ getCategories: () => KlarnaPaymentCategory[];
822
796
  renderCategory: (params: {
823
797
  containerId: string | HTMLElement;
824
798
  paymentMethodCategoryId: string;
825
799
  onHeightChange?: (height: number) => void;
826
800
  }) => Promise<void>;
827
- start: (params: {
828
- paymentMethodCategoryId: string;
829
- }) => Promise<void>;
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>;
830
809
  }
831
810
  /**
832
811
  * Adyen Klarna payment type option
@@ -836,25 +815,18 @@ export interface AdyenKlarnaPaymentOption {
836
815
  label: string;
837
816
  }
838
817
  /**
839
- * Options for creating an Adyen Klarna payment method manager
840
- */
841
- export interface AdyenKlarnaPaymentMethodManagerOptions {
842
- /**
843
- * Callback when payment options change (e.g., Pay Now, Pay Later)
844
- */
845
- onPaymentOptionsChange?: (options: AdyenKlarnaPaymentOption[]) => void;
846
- }
847
- /**
848
- * Adyen Klarna Payment Method Manager
818
+ * Adyen Klarna Payment Method
849
819
  *
850
820
  * Unlike direct Klarna integration, Adyen Klarna uses a redirect flow
851
821
  * with payment type selection (Pay Now, Pay Later, etc.)
852
822
  */
853
- export interface AdyenKlarnaPaymentMethodManager {
823
+ export interface AdyenKlarnaPaymentMethod {
824
+ type: typeof PaymentMethodType.ADYEN_KLARNA;
825
+ managerType: HeadlessManagerType.ADYEN_KLARNA;
854
826
  /**
855
827
  * Get available payment options
856
828
  */
857
- getPaymentOptions: () => AdyenKlarnaPaymentOption[];
829
+ getOptions: () => AdyenKlarnaPaymentOption[];
858
830
  /**
859
831
  * Select a payment option
860
832
  */
@@ -864,10 +836,6 @@ export interface AdyenKlarnaPaymentMethodManager {
864
836
  */
865
837
  start: () => Promise<void>;
866
838
  }
867
- export interface AchPaymentMethodManagerOptions {
868
- onCollectBankAccountDetailsComplete?: () => void;
869
- }
870
- export type PaymentMethodManagerOptions = CardPaymentMethodManagerOptions | KlarnaPaymentMethodManagerOptions | AdyenKlarnaPaymentMethodManagerOptions | AchPaymentMethodManagerOptions | Record<string, unknown>;
871
839
  export interface VaultListItem {
872
840
  id: string;
873
841
  analyticsId: string;
@@ -1037,29 +1005,13 @@ export interface KlarnaVaultedPaymentMethodSummary extends BaseVaultedPaymentMet
1037
1005
  };
1038
1006
  };
1039
1007
  }
1040
- /**
1041
- * Vaulted ACH (Automated Clearing House) summary with ACH-specific fields.
1042
- */
1043
- export interface ACHVaultedPaymentMethodSummary extends BaseVaultedPaymentMethodSummary {
1044
- /** Discriminant for ACH instruments */
1045
- paymentInstrumentType: "AUTOMATED_CLEARING_HOUSE";
1046
- /** ACH-specific payment instrument data */
1047
- paymentInstrumentData?: {
1048
- /** Last 4 digits of account number */
1049
- accountNumberLastFourDigits?: string;
1050
- /** Bank name */
1051
- bankName?: string;
1052
- /** Account type (e.g., "CHECKING", "SAVINGS") */
1053
- accountType?: string;
1054
- };
1055
- }
1056
1008
  /**
1057
1009
  * Generic vaulted payment method summary for payment instruments
1058
1010
  * not explicitly modeled with their own interface.
1059
1011
  */
1060
1012
  export interface GenericVaultedPaymentMethodSummary extends BaseVaultedPaymentMethodSummary {
1061
1013
  /** Discriminant for all other payment instrument types */
1062
- paymentInstrumentType: Exclude<PaymentInstrumentType, "PAYMENT_CARD" | "PAYPAL_BILLING_AGREEMENT" | "KLARNA_CUSTOMER_TOKEN" | "AUTOMATED_CLEARING_HOUSE">;
1014
+ paymentInstrumentType: Exclude<PaymentInstrumentType, "PAYMENT_CARD" | "PAYPAL_BILLING_AGREEMENT" | "KLARNA_CUSTOMER_TOKEN">;
1063
1015
  /** Generic payment instrument data for unknown/other payment methods */
1064
1016
  paymentInstrumentData?: Record<string, unknown>;
1065
1017
  }
@@ -1067,7 +1019,7 @@ export interface GenericVaultedPaymentMethodSummary extends BaseVaultedPaymentMe
1067
1019
  * Discriminated union of all vaulted payment method summaries.
1068
1020
  * Use the paymentInstrumentType field to narrow to specific types.
1069
1021
  */
1070
- export type VaultedPaymentMethodSummary = CardVaultedPaymentMethodSummary | PayPalVaultedPaymentMethodSummary | KlarnaVaultedPaymentMethodSummary | ACHVaultedPaymentMethodSummary | GenericVaultedPaymentMethodSummary;
1022
+ export type VaultedPaymentMethodSummary = CardVaultedPaymentMethodSummary | PayPalVaultedPaymentMethodSummary | KlarnaVaultedPaymentMethodSummary | GenericVaultedPaymentMethodSummary;
1071
1023
  /**
1072
1024
  * Approval state of a MANUAL attempt. `REQUIRES_APPROVAL` is pending; `APPROVED`,
1073
1025
  * `ABORTED` and `EXPIRED` are terminal.
@@ -1134,22 +1086,6 @@ export interface BinDataAvailableEvent {
1134
1086
  status: "complete" | "partial";
1135
1087
  firstDigits?: string;
1136
1088
  }
1137
- export interface HostedInput {
1138
- cleanup: () => void;
1139
- getOptions: () => HeadlessHostedInputOptions;
1140
- setOptions: (options: HeadlessHostedInputOptions) => void;
1141
- render: (container: string | Element, options: HeadlessHostedInputOptions) => Promise<void>;
1142
- addEventListener: (event: EventTypes, callback: EventListener$1) => void;
1143
- focus: () => void;
1144
- blur: () => void;
1145
- setDisabled: (status: boolean) => void;
1146
- }
1147
- export interface HostedInputs {
1148
- cardNumberInput: HostedInput;
1149
- cardholderNameInput: HostedInput;
1150
- expiryInput: HostedInput;
1151
- cvvInput: HostedInput;
1152
- }
1153
1089
  export interface InputValidationError {
1154
1090
  field?: string;
1155
1091
  name: string;
@@ -1161,63 +1097,110 @@ export interface Validation {
1161
1097
  validationErrors: InputValidationError[];
1162
1098
  error?: string;
1163
1099
  }
1164
- export interface CardPaymentMethodManager {
1165
- createHostedInputs: () => HostedInputs;
1166
- removeHostedInputs: () => void;
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;
1167
1120
  submit: (values?: CardPaymentMethodSubmitValues) => Promise<void>;
1168
1121
  validate: () => Promise<Validation>;
1169
- reset: () => void;
1170
1122
  setCardholderName: (cardholderName: string) => void;
1171
1123
  }
1172
- export interface MbwayPaymentMethodManager {
1173
- start(params: {
1174
- phoneNumber: string;
1175
- }): Promise<void>;
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>;
1176
1135
  }
1177
- export interface BlikPaymentMethodManager {
1178
- start(params: {
1179
- blikCode: string;
1180
- }): Promise<void>;
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>;
1181
1147
  }
1182
- export interface StripeAchCustomerDetails {
1183
- emailAddress: string;
1184
- firstName: string;
1185
- lastName: string;
1186
- }
1187
- export interface AchPaymentMethodManager {
1188
- start(paymentDetails: StripeAchCustomerDetails): Promise<Validation | void>;
1189
- setAndValidate(paymentDetails: StripeAchCustomerDetails): Promise<Validation>;
1190
- collectBankAccountDetails(): Promise<void>;
1191
- confirmMandate(): Promise<void>;
1192
- declineMandate(): Promise<void>;
1193
- getPaymentMethod(): void;
1194
- }
1195
- export interface NativePaymentMethodManager {
1196
- createButton: () => {
1197
- render: (container: HTMLElement, buttonOptions?: PaymentRenderButtonOptions) => Promise<void>;
1198
- setDisabled(disabled: boolean): Promise<void>;
1199
- };
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>;
1200
1170
  }
1201
- export interface RedirectPaymentMethodManager {
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;
1202
1182
  start: () => Promise<void>;
1203
1183
  }
1204
1184
  /**
1205
- * QRCode Payment Method Manager
1185
+ * QRCode Payment Method
1206
1186
  */
1207
- export interface QRCodePaymentMethodManager {
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;
1208
1190
  /**
1209
- * Start the payment flow, optionally providing a callback for when the QR code is received
1191
+ * Provide a callback for when the QR code is received
1210
1192
  * @param params Optional parameters, including onQRCodeReceived callback
1211
1193
  */
1212
- start(params?: {
1213
- onQRCodeReceived?: (qrCode: string) => void;
1214
- }): Promise<void>;
1194
+ setOnQRCodeReceived(callback: (qrCode: string) => void): void;
1195
+ /**
1196
+ * Start the payment flow
1197
+ */
1198
+ start(): Promise<void>;
1215
1199
  /**
1216
1200
  * Stop the payment flow
1217
1201
  */
1218
1202
  stop(): void;
1219
1203
  }
1220
- export type PaymentMethodManager = CardPaymentMethodManager | NativePaymentMethodManager | RedirectPaymentMethodManager | KlarnaPaymentMethodManager | QRCodePaymentMethodManager;
1221
1204
  export interface SDKUtilities {
1222
1205
  getCardNetworkAsset: (network: string) => {
1223
1206
  cardUrl: string;
@@ -1243,7 +1226,6 @@ export interface SDKUtilities {
1243
1226
  }
1244
1227
  export interface PrimerHeadlessCheckout {
1245
1228
  start: () => Promise<void>;
1246
- createPaymentMethodManager: (type: string, managerOptions?: PaymentMethodManagerOptions) => Promise<PaymentMethodManager | null>;
1247
1229
  getSDKUtilities: () => SDKUtilities;
1248
1230
  /** Session-bound telemetry, shared with all sdk-core internals via the checkout context */
1249
1231
  getTelemetry: () => TelemetryClient;
@@ -1425,23 +1407,21 @@ export interface CreateHeadlessOptions {
1425
1407
  */
1426
1408
  forceRedirect?: boolean;
1427
1409
  /**
1428
- * Whether to try resuming the payment when the redirect popup is closed by the user.
1429
- * If false, the payment method will be deselected, allowing the user to select a different payment method.
1430
- * @default false
1410
+ * @deprecated this flag is no longer used and won't have any effect, will be removed in a future version
1431
1411
  */
1432
1412
  resumePaymentOnPopupClosure?: boolean;
1433
1413
  };
1434
1414
  /**
1435
1415
  * Fires once at SDK init with the initial set of available payment methods.
1436
1416
  */
1437
- onAvailablePaymentMethodsLoad?: (info: PaymentMethodInfo[]) => void;
1417
+ onAvailablePaymentMethodsLoad?: (info: InitializedPaymentMethod[]) => void;
1438
1418
  /**
1439
1419
  * Fires after each successful `refreshClientSession` when the available
1440
1420
  * payment methods have changed (added or removed) as a result of the backend
1441
1421
  * re-evaluating visibility rules against the updated client session metadata.
1442
1422
  * The `info` array reflects the current set in backend order.
1443
1423
  */
1444
- onAvailablePaymentMethodsRefresh?: (info: PaymentMethodInfo[]) => void;
1424
+ onAvailablePaymentMethodsRefresh?: (info: InitializedPaymentMethod[]) => void;
1445
1425
  onCheckoutComplete?: (data: {
1446
1426
  payment: Payment | null;
1447
1427
  }) => void;
@@ -1479,13 +1459,12 @@ export interface CreateHeadlessOptions {
1479
1459
  * is resolved. Not fired for a fresh checkout (no attempt in flight).
1480
1460
  */
1481
1461
  onCheckoutResume?: () => void;
1462
+ onBinDataAvailable?: (event: BinDataAvailableEvent) => void;
1463
+ onBinDataLoadingChange?: (loading: boolean) => void;
1464
+ onCardNetworksChange?: (event: CardNetworkChangeEvent) => void;
1465
+ onCardNetworksLoading?: () => void;
1482
1466
  }
1483
- export interface KlarnaPaymentMethodCategory {
1484
- id: string;
1485
- name: string;
1486
- descriptiveAssetUrl: string;
1487
- standardAssetUrl: string;
1488
- }
1467
+ export type InitializedPaymentMethod = CardPaymentMethod | KlarnaPaymentMethod | AdyenKlarnaPaymentMethod | QRCodePaymentMethod | BlikPaymentMethod | MbwayPaymentMethod | RedirectPaymentMethod | BackendDrivenPaymentMethod | NativePaymentMethod;
1489
1468
  export interface CardSecurityCodeInputOptions {
1490
1469
  ariaLabel?: string;
1491
1470
  container: string | Element | HTMLElement;
@@ -1641,62 +1620,6 @@ export interface PrimerCheckoutOptions extends Omit<CreateHeadlessOptions, "dial
1641
1620
  */
1642
1621
  disabledPayments?: boolean;
1643
1622
  }
1644
- /**
1645
- * Payment methods that use the REDIRECT manager type — i.e. every
1646
- * PaymentMethodType not handled by a specialized manager (CARD, ACH, KLARNA,
1647
- * ADYEN_KLARNA, NATIVE, BLIK, MBWAY, QRCODE).
1648
- */
1649
- 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>;
1650
- /**
1651
- * A payment method that authorizes by redirecting the user to an external page.
1652
- */
1653
- export interface RedirectPaymentMethod {
1654
- type: RedirectPaymentMethodTypes;
1655
- managerType: HeadlessManagerType.REDIRECT;
1656
- manager: RedirectPaymentMethodManager;
1657
- }
1658
- export interface NativePaymentMethod {
1659
- type: typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY;
1660
- managerType: HeadlessManagerType.NATIVE;
1661
- manager: NativePaymentMethodManager;
1662
- }
1663
- export interface BlikPaymentMethod {
1664
- type: typeof PaymentMethodType.ADYEN_BLIK;
1665
- managerType: HeadlessManagerType.BLIK;
1666
- manager: BlikPaymentMethodManager;
1667
- }
1668
- export interface MbwayPaymentMethod {
1669
- type: typeof PaymentMethodType.ADYEN_MBWAY;
1670
- managerType: HeadlessManagerType.MBWAY;
1671
- manager: MbwayPaymentMethodManager;
1672
- }
1673
- export interface QRCodePaymentMethod {
1674
- type: typeof PaymentMethodType.ADYEN_BANCONTACT_PAYCONIQ | typeof PaymentMethodType.OMISE_PROMPTPAY | typeof PaymentMethodType.RAPYD_PROMPTPAY | typeof PaymentMethodType.XFERS_PAYNOW;
1675
- managerType: HeadlessManagerType.QRCODE;
1676
- manager: QRCodePaymentMethodManager;
1677
- }
1678
- export type InitializedPaymentMethod = {
1679
- type: typeof PaymentMethodType.STRIPE_ACH;
1680
- managerType: HeadlessManagerType.ACH;
1681
- manager: AchPaymentMethodManager;
1682
- } | {
1683
- type: typeof PaymentMethodType.PAYMENT_CARD;
1684
- managerType: HeadlessManagerType.CARD;
1685
- manager: CardPaymentMethodManager;
1686
- } | {
1687
- type: typeof PaymentMethodType.KLARNA;
1688
- managerType: HeadlessManagerType.KLARNA;
1689
- manager: KlarnaPaymentMethodManager;
1690
- } | {
1691
- type: typeof PaymentMethodType.ADYEN_KLARNA;
1692
- managerType: HeadlessManagerType.ADYEN_KLARNA;
1693
- manager: AdyenKlarnaPaymentMethodManager;
1694
- } | QRCodePaymentMethod | BlikPaymentMethod | MbwayPaymentMethod | RedirectPaymentMethod | NativePaymentMethod;
1695
- export interface AssetsConfig {
1696
- backgroundColor: string;
1697
- name: string;
1698
- iconUrl: string;
1699
- }
1700
1623
  /**
1701
1624
  * Options for initializing the Vault Manager
1702
1625
  */
@@ -1735,14 +1658,6 @@ export interface VaultManagerItemState {
1735
1658
  selectedVaultedPaymentMethod: VaultListItem | null;
1736
1659
  setSelectedVaultedPaymentMethod: (paymentMethod: VaultListItem | null) => void;
1737
1660
  }
1738
- export type KlarnaCategoriesContextType = {
1739
- categories: KlarnaPaymentMethodCategory[];
1740
- isLoading: boolean;
1741
- };
1742
- export type AdyenKlarnaOptionsContextType = {
1743
- options: AdyenKlarnaPaymentOption[];
1744
- isLoading: boolean;
1745
- };
1746
1661
  export type CardNetwork = {
1747
1662
  displayName: string;
1748
1663
  network: string;
@@ -1791,14 +1706,13 @@ export type ContextType = {
1791
1706
  telemetry?: TelemetryClient;
1792
1707
  configuration?: ClientConfiguration;
1793
1708
  computedStyles?: CSSStyleDeclaration | null;
1794
- klarnaCategories: KlarnaCategoriesContextType;
1795
- adyenKlarnaOptions?: AdyenKlarnaOptionsContextType;
1796
1709
  cardNetworks?: CardNetworksContextType;
1797
1710
  events?: PrimerEventsController;
1798
1711
  clientOptions?: PrimerCheckoutOptions;
1799
1712
  paymentMethods: InitializedPaymentMethod[];
1800
1713
  headlessUtils?: SDKUtilities;
1801
1714
  sdkState: SdkState;
1715
+ setProcessing?: (isProcessing: boolean) => void;
1802
1716
  vaultManager?: VaultManagerState;
1803
1717
  vaultItem?: VaultManagerItemState;
1804
1718
  };
@@ -1818,8 +1732,6 @@ declare class SDKContextController implements ReactiveController {
1818
1732
  setCardNetworks(value: CardNetworksContextType): void;
1819
1733
  setCardNetworksLoadingFalse(): void;
1820
1734
  setVaultManager(vaultManager: VaultManagerState): void;
1821
- setKlarnaCategories(value: KlarnaCategoriesContextType): void;
1822
- setAdyenKlarnaOptions(value: AdyenKlarnaOptionsContextType): void;
1823
1735
  setComputedStyles(value: CSSStyleDeclaration): void;
1824
1736
  setVaultManagerCvv(vaultItem: VaultManagerItemState): void;
1825
1737
  /**
@@ -2202,7 +2114,7 @@ export declare class PrimerJS {
2202
2114
  /**
2203
2115
  * Returns the cached list of payment methods.
2204
2116
  */
2205
- getPaymentMethods(): PaymentMethodInfo[];
2117
+ getPaymentMethods(): InitializedPaymentMethod[];
2206
2118
  /**
2207
2119
  * Internal accessor that returns the initialized payment methods (with their
2208
2120
  * managers), used by the refresh path to preserve manager identity across
@@ -2581,7 +2493,6 @@ declare class HeadlessSdkController implements ReactiveController {
2581
2493
  string | null,
2582
2494
  PrimerCheckoutOptions | null
2583
2495
  ]) => Promise<PrimerHeadlessCheckout | typeof initialState>;
2584
- private createManager;
2585
2496
  /**
2586
2497
  * Updates card networks state and dispatches events
2587
2498
  *
@@ -2691,6 +2602,11 @@ export declare function injectLightTheme(): void;
2691
2602
  * @returns {void}
2692
2603
  */
2693
2604
  export declare function injectDarkTheme(): void;
2605
+ export interface AssetsConfig {
2606
+ backgroundColor: string;
2607
+ name: string;
2608
+ iconUrl: string;
2609
+ }
2694
2610
  /**
2695
2611
  * Size options for the spinner component
2696
2612
  */
@@ -3283,10 +3199,13 @@ declare global {
3283
3199
  "primer-klarna": PrimerKlarnaComponent;
3284
3200
  }
3285
3201
  }
3202
+ type NativePaymentMethod$1 = Extract<InitializedPaymentMethod, {
3203
+ managerType: HeadlessManagerType.NATIVE;
3204
+ }>;
3286
3205
  declare class NativePaymentComponent extends LitElement {
3287
3206
  static styles: import("lit").CSSResult[];
3288
3207
  type: PaymentMethodType | undefined;
3289
- paymentMethod: NativePaymentMethod | undefined;
3208
+ paymentMethod: NativePaymentMethod$1 | undefined;
3290
3209
  primerContext?: ContextType;
3291
3210
  disabled: boolean;
3292
3211
  private buttonContainerRef;
@@ -3296,6 +3215,9 @@ declare class NativePaymentComponent extends LitElement {
3296
3215
  protected willUpdate(changedProperties: PropertyValues): void;
3297
3216
  render(): import("lit-html").TemplateResult<1>;
3298
3217
  }
3218
+ type BlikPaymentMethod$1 = Extract<InitializedPaymentMethod, {
3219
+ managerType: HeadlessManagerType.BLIK;
3220
+ }>;
3299
3221
  /**
3300
3222
  * BLIK Payment Component
3301
3223
  *
@@ -3318,7 +3240,7 @@ declare class NativePaymentComponent extends LitElement {
3318
3240
  */
3319
3241
  declare class BlikComponent extends LitElement {
3320
3242
  static styles: import("lit").CSSResult[];
3321
- paymentMethod: BlikPaymentMethod | undefined;
3243
+ paymentMethod: BlikPaymentMethod$1 | undefined;
3322
3244
  disabled: boolean;
3323
3245
  private currentState;
3324
3246
  private blikCode;
@@ -3379,13 +3301,16 @@ declare global {
3379
3301
  "primer-blik": BlikComponent;
3380
3302
  }
3381
3303
  }
3304
+ type AdyenKlarnaPaymentMethod$1 = Extract<InitializedPaymentMethod, {
3305
+ managerType: HeadlessManagerType.ADYEN_KLARNA;
3306
+ }>;
3382
3307
  declare class AdyenKlarnaComponent extends LitElement {
3383
3308
  static styles: import("lit").CSSResult[];
3384
3309
  primerContext?: ContextType;
3385
3310
  /**
3386
3311
  * The payment method from context
3387
3312
  */
3388
- paymentMethod?: InitializedPaymentMethod;
3313
+ paymentMethod?: AdyenKlarnaPaymentMethod$1;
3389
3314
  /**
3390
3315
  * Whether the component is disabled
3391
3316
  */
@@ -3403,7 +3328,6 @@ declare class AdyenKlarnaComponent extends LitElement {
3403
3328
  */
3404
3329
  private loading;
3405
3330
  private paymentInProgress;
3406
- private get manager();
3407
3331
  /**
3408
3332
  * Get the Klarna logo URL from the payment method configuration
3409
3333
  */
@@ -3418,6 +3342,9 @@ declare global {
3418
3342
  "primer-adyen-klarna": AdyenKlarnaComponent;
3419
3343
  }
3420
3344
  }
3345
+ type MbwayPaymentMethod$1 = Extract<InitializedPaymentMethod, {
3346
+ managerType: HeadlessManagerType.MBWAY;
3347
+ }>;
3421
3348
  /**
3422
3349
  * Adyen MB WAY Payment Component
3423
3350
  *
@@ -3427,7 +3354,7 @@ declare global {
3427
3354
  */
3428
3355
  declare class AdyenMbwayComponent extends LitElement {
3429
3356
  static styles: import("lit").CSSResult[];
3430
- paymentMethod: MbwayPaymentMethod | undefined;
3357
+ paymentMethod: MbwayPaymentMethod$1 | undefined;
3431
3358
  disabled: boolean;
3432
3359
  private currentState;
3433
3360
  private phoneNumber;
@@ -3450,9 +3377,12 @@ declare global {
3450
3377
  "primer-adyen-mbway": AdyenMbwayComponent;
3451
3378
  }
3452
3379
  }
3380
+ type QRCodePaymentMethod$1 = Extract<InitializedPaymentMethod, {
3381
+ managerType: HeadlessManagerType.QRCODE;
3382
+ }>;
3453
3383
  declare class QRCodeComponent extends LitElement {
3454
3384
  static styles: import("lit").CSSResult[];
3455
- paymentMethod: QRCodePaymentMethod | undefined;
3385
+ paymentMethod: QRCodePaymentMethod$1 | undefined;
3456
3386
  disabled: boolean;
3457
3387
  primerContext?: ContextType;
3458
3388
  private isExpanded;
@@ -3473,6 +3403,48 @@ declare global {
3473
3403
  "primer-qrcode": QRCodeComponent;
3474
3404
  }
3475
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
+ }
3476
3448
  declare class PaymentMethodComponent extends LitElement {
3477
3449
  static styles: import("lit").CSSResult[];
3478
3450
  type: PaymentMethodType | undefined;
@@ -3506,40 +3478,25 @@ declare global {
3506
3478
  "primer-payment-method-container": PaymentMethodContainerComponent;
3507
3479
  }
3508
3480
  }
3509
- declare class PaymentMethodButtonComponent extends LitElement {
3510
- static styles: import("lit").CSSResult[];
3511
- type: PaymentMethodType | undefined;
3481
+ type RedirectPaymentMethod$1 = Extract<InitializedPaymentMethod, {
3482
+ managerType: HeadlessManagerType.REDIRECT;
3483
+ }>;
3484
+ declare class RedirectPaymentComponent extends LitElement {
3485
+ static styles: import("lit").CSSResult;
3486
+ paymentMethod: RedirectPaymentMethod$1 | undefined;
3512
3487
  disabled: boolean;
3513
3488
  primerContext?: ContextType;
3514
- /**
3515
- * Based on packages/primer-sdk-web/src/payment-methods/Button.tsx
3516
- * Should be replaced once we align on a better solution across all platforms.
3517
- */
3518
- private _legacyGetButtonLabel;
3519
- private _getBackgroundColor;
3520
- private _getIconUrl;
3521
- private _getIconPosition;
3522
- private _getTextColor;
3523
- private _getDisplayName;
3524
- private _setupTask;
3525
3489
  private _handleClick;
3526
- render(): symbol | import("lit-html").TemplateResult<1> | undefined;
3490
+ render(): import("lit-html").TemplateResult<1>;
3527
3491
  }
3528
3492
  declare global {
3529
3493
  interface HTMLElementTagNameMap {
3530
- "primer-payment-method-button": PaymentMethodButtonComponent;
3494
+ "primer-redirect-payment": RedirectPaymentComponent;
3531
3495
  }
3532
3496
  }
3533
- declare class RedirectPaymentComponent extends LitElement {
3534
- static styles: import("lit").CSSResult;
3535
- paymentMethod: RedirectPaymentMethod | undefined;
3536
- disabled: boolean;
3537
- private _handleClick;
3538
- render(): import("lit-html").TemplateResult<1>;
3539
- }
3540
3497
  declare global {
3541
3498
  interface HTMLElementTagNameMap {
3542
- "primer-redirect-payment": RedirectPaymentComponent;
3499
+ "primer-backend-driven": BackendDrivenComponent;
3543
3500
  }
3544
3501
  }
3545
3502
  /**
@@ -4995,6 +4952,7 @@ export declare function loadPrimer(): void;
4995
4952
 
4996
4953
  export {
4997
4954
  AdyenMbwayComponent as AdyenMbway,
4955
+ BackendDrivenComponent as BackendDriven,
4998
4956
  BillingAddressComponent as BillingAddress,
4999
4957
  BlikComponent as Blik,
5000
4958
  ButtonComponent as Button,