@primer-io/primer-js 1.6.3 → 1.8.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.
@@ -1,7 +1,6 @@
1
1
  import { ContextProvider } from '@lit/context';
2
2
  import { Task, initialState } from '@lit/task';
3
- import { PayPalButtonStyle } from '@paypal/paypal-js';
4
- import { FUNDING_SOURCE } from '@paypal/paypal-js/types/components/funding-eligibility';
3
+ import { FUNDING_SOURCE, PayPalButtonStyle } from '@paypal/paypal-js';
5
4
  import { CSSResult, LitElement, PropertyValues, ReactiveController, ReactiveControllerHost, SVGTemplateResult, TemplateResult, nothing } from 'lit';
6
5
 
7
6
  declare global {
@@ -268,7 +267,9 @@ export interface GooglePayClientOptions {
268
267
  */
269
268
  captureBillingAddress?: boolean;
270
269
  /**
271
- * When true, requests shipping address from Google Pay and updates client session.
270
+ * When true, requests shipping address from Google Pay and updates client
271
+ * session. Register `onShippingAddressChange` to supply shipping options
272
+ * for display in the sheet.
272
273
  */
273
274
  captureShippingAddress?: boolean;
274
275
  /**
@@ -281,10 +282,9 @@ export interface GooglePayClientOptions {
281
282
  */
282
283
  emailRequired?: boolean;
283
284
  /**
284
- * When true, enables shipping method selection in the Google Pay payment sheet.
285
- * Shipping methods are read from the SHIPPING checkout module in the client configuration.
286
- * When the user selects a shipping option, the SDK will call selectShippingMethod()
287
- * on the client session API to update the order on the backend.
285
+ * When true, enables shipping method selection in the Google Pay payment
286
+ * sheet. Register `onShippingAddressChange` to supply the option list and
287
+ * `onShippingOptionChange` to commit the shopper's selection.
288
288
  */
289
289
  requireShippingMethod?: boolean;
290
290
  /**
@@ -371,29 +371,15 @@ export interface BillingAddressCheckoutModule {
371
371
  type: "BILLING_ADDRESS";
372
372
  options: BillingAddressModuleOptions;
373
373
  }
374
- /**
375
- * Shipping method for express checkout flows (Google Pay, Apple Pay).
376
- */
377
- export interface ShippingMethod {
378
- /** Unique identifier for the shipping method */
379
- id: string;
380
- /** Display name for the shipping method */
381
- name: string;
382
- /** Description (e.g., "5-7 business days") */
383
- description: string;
384
- /** Shipping cost in minor units */
385
- amount: number;
386
- /** Type of shipping method */
387
- type?: "shipping" | "pickup";
388
- }
389
374
  /**
390
375
  * Shipping checkout module options
391
376
  */
392
377
  export interface ShippingModuleOptions {
393
- /** Available shipping methods */
394
- shippingMethods: ShippingMethod[];
378
+ /** Available shipping methods (legacy `shippingMethodsUrl` path only) */
379
+ shippingMethods: ShippingOption[];
395
380
  /** Currently selected shipping method ID */
396
381
  selectedShippingMethod?: string;
382
+ callbackMode?: boolean;
397
383
  }
398
384
  /**
399
385
  * Shipping checkout module
@@ -407,6 +393,20 @@ export interface ShippingCheckoutModule {
407
393
  * Supports billing address and shipping modules
408
394
  */
409
395
  export type CheckoutModuleConfig = BillingAddressCheckoutModule | ShippingCheckoutModule;
396
+ /**
397
+ * A shipping option offered to the shopper inside an Express Checkout
398
+ * (Apple Pay / Google Pay) payment sheet — either the legacy
399
+ * `shippingMethodsUrl`-resolved list (read from `ShippingCheckoutModule`),
400
+ * or merchant-supplied via the newer event-driven flow: returned via the
401
+ * `setShippingOptions` handler on `onShippingAddressChange`, and passed back
402
+ * via `onShippingOptionChange` once the shopper selects one.
403
+ */
404
+ export interface ShippingOption {
405
+ amount: number;
406
+ id: string;
407
+ name: string;
408
+ description: string;
409
+ }
410
410
  export type ApprovalMode = "AUTO" | "MANUAL";
411
411
  export interface ClientSession {
412
412
  clientSessionId: string;
@@ -537,6 +537,17 @@ export interface PaymentRenderButtonOptions {
537
537
  shadowRoot?: ShadowRoot | null;
538
538
  };
539
539
  }
540
+ /**
541
+ * Field validation state (mirrors @primer-io/sdk-utils/iframes/types)
542
+ */
543
+ export interface FieldState {
544
+ valid: boolean;
545
+ dirty: boolean;
546
+ touched: boolean;
547
+ focused: boolean;
548
+ disabled: boolean;
549
+ error: string;
550
+ }
540
551
  export interface BaseInputStyle {
541
552
  background?: string;
542
553
  borderColor?: number | string;
@@ -680,35 +691,16 @@ export interface TelemetryClient {
680
691
  dispose(): void;
681
692
  }
682
693
  declare enum HeadlessManagerType {
694
+ BACKEND_DRIVEN = "BACKEND_DRIVEN",
683
695
  BLIK = "BLIK",
684
696
  CARD = "CARD",
685
697
  NATIVE = "NATIVE",
686
698
  REDIRECT = "REDIRECT",
687
699
  KLARNA = "KLARNA",
688
700
  ADYEN_KLARNA = "ADYEN_KLARNA",
689
- ACH = "ACH",
690
701
  MBWAY = "MBWAY",
691
702
  QRCODE = "QRCODE"
692
703
  }
693
- export type PaymentMethodInfo = {
694
- type: PaymentMethodType;
695
- managerType: HeadlessManagerType;
696
- };
697
- declare enum EventTypes {
698
- CHANGE = "change",
699
- ENTER = "ENTER",
700
- ERROR = "error",
701
- FOCUS = "focus",
702
- BLUR = "blur",
703
- CLICK = "click",
704
- CLOSE = "close",
705
- INPUT = "input",
706
- CONFIRMED_KLARNA_CATEGORY = "CONFIRMED_KLARNA_CATEGORY",
707
- CONFIRMED_KLARNA_CATEGORY_ERROR = "CONFIRMED_KLARNA_CATEGORY_ERROR",
708
- KLARNA_SESSION_UPDATE = "KLARNA_SESSION_UPDATE",
709
- KLARNA_SESSION_REFRESH_ERROR = "KLARNA_SESSION_REFRESH_ERROR"
710
- }
711
- type EventListener$1 = (event?: Event) => void;
712
704
  export interface PayPalOptionsWithPaypalJsTypes {
713
705
  /**
714
706
  * Button style configuration with optional per-funding-source overrides.
@@ -730,6 +722,51 @@ export interface PayPalOptionsWithPaypalJsTypes {
730
722
  enableFunding?: FUNDING_SOURCE[];
731
723
  integrationDate?: string;
732
724
  debug?: boolean;
725
+ /**
726
+ * PayPal App Switch configuration.
727
+ *
728
+ * When enabled, tapping the PayPal button attempts to open the PayPal app
729
+ * (falling back to the web flow when unavailable), and the buyer is
730
+ * returned to complete checkout. The SDK uses your `returnUrl` as the PayPal
731
+ * order/billing-agreement return and cancel URLs, and resumes the pending
732
+ * session on return.
733
+ */
734
+ appSwitch?: {
735
+ /**
736
+ * Whether App Switch is enabled.
737
+ * @default false
738
+ */
739
+ enabled?: boolean;
740
+ /**
741
+ * The full URL PayPal returns and cancels to after the app switch.
742
+ * **Required when App Switch is enabled**, and PayPal requires it to be the
743
+ * same URL the SDK was initialized on. The SDK appends `?clientToken=…` so
744
+ * that page can resume the pending session.
745
+ */
746
+ returnUrl?: string;
747
+ /**
748
+ * Host-app bridge for checkout embedded in a native app's webview, where
749
+ * PayPal's in-browser App Switch cannot return. The SDK hands the approval
750
+ * deep link to the host app, which opens it and calls `resumeAppSwitch()`
751
+ * on the native return.
752
+ */
753
+ hostApp?: {
754
+ /** Return the host native app's return deep link, OS, and OS version. */
755
+ getContext: () => Promise<{
756
+ appUrl: string;
757
+ osType: "IOS" | "ANDROID" | "OTHER";
758
+ /** Host OS version, e.g. "14". */
759
+ osVersion?: string;
760
+ }>;
761
+ /**
762
+ * Open the PayPal approval deep link. The native return appends
763
+ * `/success` or `/cancel` to the return URL and carries the `token`
764
+ * (order id) on both — route by path: `resumeAppSwitch(token)` on
765
+ * success, `cancelAppSwitch()` on cancel.
766
+ */
767
+ openApprovalUrl: (approvalUrl: string) => void | Promise<void>;
768
+ };
769
+ };
733
770
  }
734
771
  export interface LegacyApplePayOptions {
735
772
  /**
@@ -777,6 +814,11 @@ export interface ApplePayClientOptions {
777
814
  * @see https://developer.apple.com/documentation/applepayontheweb/applepaypaymentrequest/requiredshippingcontactfields
778
815
  */
779
816
  requiredShippingContactFields?: ("postalAddress" | "name" | "phoneticName" | "phone" | "email")[];
817
+ /**
818
+ * When true, enables shipping method selection in the Apple Pay sheet.
819
+ * Register `onShippingAddressChange` to supply the option list and
820
+ * `onShippingOptionChange` to commit the shopper's selection.
821
+ */
780
822
  requireShippingMethod?: boolean;
781
823
  };
782
824
  }
@@ -788,41 +830,32 @@ export interface Payment {
788
830
  [key: string]: unknown;
789
831
  };
790
832
  }
791
- export interface HeadlessHostedInputOptions {
792
- placeholder?: string;
793
- ariaLabel?: string;
794
- style?: Record<string, unknown>;
795
- }
796
833
  export interface CardPaymentMethodSubmitValues {
797
834
  cardNetwork?: string;
798
835
  }
799
- export interface CardPaymentMethodManagerOptions {
800
- onBinDataAvailable?: (event: BinDataAvailableEvent) => void;
801
- onBinDataLoadingChange?: (loading: boolean) => void;
802
- onCardNetworksChange?: (event: CardNetworkChangeEvent) => void;
803
- onCardNetworksLoading?: () => void;
804
- }
805
- export interface KlarnaPaymentMethodManagerOptions {
806
- onPaymentMethodCategoriesChange?: (categories: {
807
- id: string;
808
- name: string;
809
- descriptiveAssetUrl: string;
810
- standardAssetUrl: string;
811
- }[]) => void;
812
- onPaymentMethodAction?: (action: string, data: {
813
- paymentMethodType: string;
814
- category: string;
815
- }) => void;
836
+ export interface KlarnaPaymentCategory {
837
+ name: string;
838
+ identifier: string;
839
+ standardAssetUrl: string;
840
+ descriptiveAssetUrl: string;
816
841
  }
817
- export interface KlarnaPaymentMethodManager {
842
+ export interface KlarnaPaymentMethod {
843
+ type: typeof PaymentMethodType.KLARNA;
844
+ managerType: HeadlessManagerType.KLARNA;
845
+ getCategories: () => KlarnaPaymentCategory[];
818
846
  renderCategory: (params: {
819
847
  containerId: string | HTMLElement;
820
848
  paymentMethodCategoryId: string;
821
849
  onHeightChange?: (height: number) => void;
822
850
  }) => Promise<void>;
823
- start: (params: {
824
- paymentMethodCategoryId: string;
825
- }) => Promise<void>;
851
+ /**
852
+ * Set the selected payment category for the payment flow
853
+ */
854
+ setSelectedCategory: (categoryId: string) => void;
855
+ /**
856
+ * Start the payment flow with the selected category
857
+ */
858
+ start: () => Promise<void>;
826
859
  }
827
860
  /**
828
861
  * Adyen Klarna payment type option
@@ -832,25 +865,18 @@ export interface AdyenKlarnaPaymentOption {
832
865
  label: string;
833
866
  }
834
867
  /**
835
- * Options for creating an Adyen Klarna payment method manager
836
- */
837
- export interface AdyenKlarnaPaymentMethodManagerOptions {
838
- /**
839
- * Callback when payment options change (e.g., Pay Now, Pay Later)
840
- */
841
- onPaymentOptionsChange?: (options: AdyenKlarnaPaymentOption[]) => void;
842
- }
843
- /**
844
- * Adyen Klarna Payment Method Manager
868
+ * Adyen Klarna Payment Method
845
869
  *
846
870
  * Unlike direct Klarna integration, Adyen Klarna uses a redirect flow
847
871
  * with payment type selection (Pay Now, Pay Later, etc.)
848
872
  */
849
- export interface AdyenKlarnaPaymentMethodManager {
873
+ export interface AdyenKlarnaPaymentMethod {
874
+ type: typeof PaymentMethodType.ADYEN_KLARNA;
875
+ managerType: HeadlessManagerType.ADYEN_KLARNA;
850
876
  /**
851
877
  * Get available payment options
852
878
  */
853
- getPaymentOptions: () => AdyenKlarnaPaymentOption[];
879
+ getOptions: () => AdyenKlarnaPaymentOption[];
854
880
  /**
855
881
  * Select a payment option
856
882
  */
@@ -860,10 +886,6 @@ export interface AdyenKlarnaPaymentMethodManager {
860
886
  */
861
887
  start: () => Promise<void>;
862
888
  }
863
- export interface AchPaymentMethodManagerOptions {
864
- onCollectBankAccountDetailsComplete?: () => void;
865
- }
866
- export type PaymentMethodManagerOptions = CardPaymentMethodManagerOptions | KlarnaPaymentMethodManagerOptions | AdyenKlarnaPaymentMethodManagerOptions | AchPaymentMethodManagerOptions | Record<string, unknown>;
867
889
  export interface VaultListItem {
868
890
  id: string;
869
891
  analyticsId: string;
@@ -1033,29 +1055,13 @@ export interface KlarnaVaultedPaymentMethodSummary extends BaseVaultedPaymentMet
1033
1055
  };
1034
1056
  };
1035
1057
  }
1036
- /**
1037
- * Vaulted ACH (Automated Clearing House) summary with ACH-specific fields.
1038
- */
1039
- export interface ACHVaultedPaymentMethodSummary extends BaseVaultedPaymentMethodSummary {
1040
- /** Discriminant for ACH instruments */
1041
- paymentInstrumentType: "AUTOMATED_CLEARING_HOUSE";
1042
- /** ACH-specific payment instrument data */
1043
- paymentInstrumentData?: {
1044
- /** Last 4 digits of account number */
1045
- accountNumberLastFourDigits?: string;
1046
- /** Bank name */
1047
- bankName?: string;
1048
- /** Account type (e.g., "CHECKING", "SAVINGS") */
1049
- accountType?: string;
1050
- };
1051
- }
1052
1058
  /**
1053
1059
  * Generic vaulted payment method summary for payment instruments
1054
1060
  * not explicitly modeled with their own interface.
1055
1061
  */
1056
1062
  export interface GenericVaultedPaymentMethodSummary extends BaseVaultedPaymentMethodSummary {
1057
1063
  /** Discriminant for all other payment instrument types */
1058
- paymentInstrumentType: Exclude<PaymentInstrumentType, "PAYMENT_CARD" | "PAYPAL_BILLING_AGREEMENT" | "KLARNA_CUSTOMER_TOKEN" | "AUTOMATED_CLEARING_HOUSE">;
1064
+ paymentInstrumentType: Exclude<PaymentInstrumentType, "PAYMENT_CARD" | "PAYPAL_BILLING_AGREEMENT" | "KLARNA_CUSTOMER_TOKEN">;
1059
1065
  /** Generic payment instrument data for unknown/other payment methods */
1060
1066
  paymentInstrumentData?: Record<string, unknown>;
1061
1067
  }
@@ -1063,7 +1069,7 @@ export interface GenericVaultedPaymentMethodSummary extends BaseVaultedPaymentMe
1063
1069
  * Discriminated union of all vaulted payment method summaries.
1064
1070
  * Use the paymentInstrumentType field to narrow to specific types.
1065
1071
  */
1066
- export type VaultedPaymentMethodSummary = CardVaultedPaymentMethodSummary | PayPalVaultedPaymentMethodSummary | KlarnaVaultedPaymentMethodSummary | ACHVaultedPaymentMethodSummary | GenericVaultedPaymentMethodSummary;
1072
+ export type VaultedPaymentMethodSummary = CardVaultedPaymentMethodSummary | PayPalVaultedPaymentMethodSummary | KlarnaVaultedPaymentMethodSummary | GenericVaultedPaymentMethodSummary;
1067
1073
  /**
1068
1074
  * Approval state of a MANUAL attempt. `REQUIRES_APPROVAL` is pending; `APPROVED`,
1069
1075
  * `ABORTED` and `EXPIRED` are terminal.
@@ -1130,22 +1136,6 @@ export interface BinDataAvailableEvent {
1130
1136
  status: "complete" | "partial";
1131
1137
  firstDigits?: string;
1132
1138
  }
1133
- export interface HostedInput {
1134
- cleanup: () => void;
1135
- getOptions: () => HeadlessHostedInputOptions;
1136
- setOptions: (options: HeadlessHostedInputOptions) => void;
1137
- render: (container: string | Element, options: HeadlessHostedInputOptions) => Promise<void>;
1138
- addEventListener: (event: EventTypes, callback: EventListener$1) => void;
1139
- focus: () => void;
1140
- blur: () => void;
1141
- setDisabled: (status: boolean) => void;
1142
- }
1143
- export interface HostedInputs {
1144
- cardNumberInput: HostedInput;
1145
- cardholderNameInput: HostedInput;
1146
- expiryInput: HostedInput;
1147
- cvvInput: HostedInput;
1148
- }
1149
1139
  export interface InputValidationError {
1150
1140
  field?: string;
1151
1141
  name: string;
@@ -1157,63 +1147,129 @@ export interface Validation {
1157
1147
  validationErrors: InputValidationError[];
1158
1148
  error?: string;
1159
1149
  }
1160
- export interface CardPaymentMethodManager {
1161
- createHostedInputs: () => HostedInputs;
1162
- removeHostedInputs: () => void;
1150
+ export type HostedInputEvent = "input" | "focus" | "blur" | "enter";
1151
+ export interface HostedInput {
1152
+ render(containerOrId: string | Element, options?: HostedInputOptions): Promise<void>;
1153
+ remove(): void;
1154
+ focus(): void;
1155
+ getFieldState(): Promise<FieldState> | undefined;
1156
+ addEventListener(event: HostedInputEvent, callback: (data?: unknown) => void): void;
1157
+ setOptions(options: HostedInputOptions): void;
1158
+ setCardholderName(cardholderName: string): void;
1159
+ }
1160
+ export interface CardFormIframes {
1161
+ cardNumber: HostedInput;
1162
+ cardSecurityCode: HostedInput;
1163
+ cardExpiryDate: HostedInput;
1164
+ cardholderName: HostedInput;
1165
+ }
1166
+ export interface CardPaymentMethod {
1167
+ type: typeof PaymentMethodType.PAYMENT_CARD;
1168
+ managerType: HeadlessManagerType.CARD;
1169
+ iframes: CardFormIframes;
1163
1170
  submit: (values?: CardPaymentMethodSubmitValues) => Promise<void>;
1164
1171
  validate: () => Promise<Validation>;
1165
- reset: () => void;
1166
1172
  setCardholderName: (cardholderName: string) => void;
1167
1173
  }
1168
- export interface MbwayPaymentMethodManager {
1169
- start(params: {
1170
- phoneNumber: string;
1171
- }): Promise<void>;
1174
+ export interface MbwayPaymentMethod {
1175
+ type: typeof PaymentMethodType.ADYEN_MBWAY;
1176
+ managerType: HeadlessManagerType.MBWAY;
1177
+ /**
1178
+ * Set the phone number used to confirm the payment in the MB WAY app
1179
+ */
1180
+ setPhoneNumber(phoneNumber: string): void;
1181
+ /**
1182
+ * Start the payment flow
1183
+ */
1184
+ start(): Promise<void>;
1172
1185
  }
1173
- export interface BlikPaymentMethodManager {
1174
- start(params: {
1175
- blikCode: string;
1176
- }): Promise<void>;
1186
+ export interface BlikPaymentMethod {
1187
+ type: typeof PaymentMethodType.ADYEN_BLIK;
1188
+ managerType: HeadlessManagerType.BLIK;
1189
+ /**
1190
+ * Set the 6-digit OTP code from the user's banking app
1191
+ */
1192
+ setBlikCode(code: string): void;
1193
+ /**
1194
+ * Start the payment flow
1195
+ */
1196
+ start(): Promise<void>;
1177
1197
  }
1178
- export interface StripeAchCustomerDetails {
1179
- emailAddress: string;
1180
- firstName: string;
1181
- lastName: string;
1182
- }
1183
- export interface AchPaymentMethodManager {
1184
- start(paymentDetails: StripeAchCustomerDetails): Promise<Validation | void>;
1185
- setAndValidate(paymentDetails: StripeAchCustomerDetails): Promise<Validation>;
1186
- collectBankAccountDetails(): Promise<void>;
1187
- confirmMandate(): Promise<void>;
1188
- declineMandate(): Promise<void>;
1189
- getPaymentMethod(): void;
1190
- }
1191
- export interface NativePaymentMethodManager {
1192
- createButton: () => {
1193
- render: (container: HTMLElement, buttonOptions?: PaymentRenderButtonOptions) => Promise<void>;
1194
- setDisabled(disabled: boolean): Promise<void>;
1195
- };
1198
+ /**
1199
+ * A payment method rendered as a branded button by an external SDK.
1200
+ */
1201
+ export interface NativePaymentMethod {
1202
+ type: typeof PaymentMethodType.APPLE_PAY | typeof PaymentMethodType.GOOGLE_PAY;
1203
+ managerType: HeadlessManagerType.NATIVE;
1204
+ /**
1205
+ * Initialize the payment method (e.g. load the external SDK)
1206
+ */
1207
+ start(): Promise<void>;
1208
+ /**
1209
+ * Render the payment button into the given container
1210
+ */
1211
+ render(container: HTMLElement, buttonOptions?: PaymentRenderButtonOptions): Promise<void>;
1212
+ setDisabled(disabled: boolean): Promise<void>;
1213
+ }
1214
+ /**
1215
+ * PayPal renders like the other native methods, plus the host-app App Switch
1216
+ * entry points. Both warn and do nothing unless `paypal.appSwitch.hostApp` is
1217
+ * configured.
1218
+ */
1219
+ export interface PayPalPaymentMethod {
1220
+ type: typeof PaymentMethodType.PAYPAL;
1221
+ managerType: HeadlessManagerType.NATIVE;
1222
+ start(): Promise<void>;
1223
+ render(container: HTMLElement, buttonOptions?: PaymentRenderButtonOptions): Promise<void>;
1224
+ setDisabled(disabled: boolean): Promise<void>;
1225
+ /** Finishes the payment after the buyer returns, with the `orderId` the host app captured. */
1226
+ resumeAppSwitch(orderId: string): Promise<void>;
1227
+ /** Propagates a user cancellation when the buyer returns without approving. */
1228
+ cancelAppSwitch(): Promise<void>;
1196
1229
  }
1197
- export interface RedirectPaymentMethodManager {
1230
+ /**
1231
+ * Payment method types that have a surface of their own. Everything else is
1232
+ * driven generically — by a redirect, or by the backend.
1233
+ */
1234
+ 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;
1235
+ export interface RedirectPaymentMethod {
1236
+ type: Exclude<PaymentMethodType, SpecializedPaymentMethodType>;
1237
+ managerType: HeadlessManagerType.REDIRECT;
1198
1238
  start: () => Promise<void>;
1199
1239
  }
1200
1240
  /**
1201
- * QRCode Payment Method Manager
1241
+ * A payment method whose flow is driven by the backend: the SDK executes the
1242
+ * steps the backend sends rather than following a flow hardcoded per method.
1243
+ *
1244
+ * Which surface it renders is up to those steps — today they redirect, so this
1245
+ * looks like {@link RedirectPaymentMethod}, but a step tree can drive other
1246
+ * surfaces, which is why it is a member of its own rather than a redirect.
1247
+ */
1248
+ export interface BackendDrivenPaymentMethod {
1249
+ type: Exclude<PaymentMethodType, SpecializedPaymentMethodType>;
1250
+ managerType: HeadlessManagerType.BACKEND_DRIVEN;
1251
+ start: () => Promise<void>;
1252
+ }
1253
+ /**
1254
+ * QRCode Payment Method
1202
1255
  */
1203
- export interface QRCodePaymentMethodManager {
1256
+ export interface QRCodePaymentMethod {
1257
+ type: typeof PaymentMethodType.ADYEN_BANCONTACT_PAYCONIQ | typeof PaymentMethodType.OMISE_PROMPTPAY | typeof PaymentMethodType.RAPYD_PROMPTPAY | typeof PaymentMethodType.XFERS_PAYNOW;
1258
+ managerType: HeadlessManagerType.QRCODE;
1204
1259
  /**
1205
- * Start the payment flow, optionally providing a callback for when the QR code is received
1260
+ * Provide a callback for when the QR code is received
1206
1261
  * @param params Optional parameters, including onQRCodeReceived callback
1207
1262
  */
1208
- start(params?: {
1209
- onQRCodeReceived?: (qrCode: string) => void;
1210
- }): Promise<void>;
1263
+ setOnQRCodeReceived(callback: (qrCode: string) => void): void;
1264
+ /**
1265
+ * Start the payment flow
1266
+ */
1267
+ start(): Promise<void>;
1211
1268
  /**
1212
1269
  * Stop the payment flow
1213
1270
  */
1214
1271
  stop(): void;
1215
1272
  }
1216
- export type PaymentMethodManager = CardPaymentMethodManager | NativePaymentMethodManager | RedirectPaymentMethodManager | KlarnaPaymentMethodManager | QRCodePaymentMethodManager;
1217
1273
  export interface SDKUtilities {
1218
1274
  getCardNetworkAsset: (network: string) => {
1219
1275
  cardUrl: string;
@@ -1239,7 +1295,6 @@ export interface SDKUtilities {
1239
1295
  }
1240
1296
  export interface PrimerHeadlessCheckout {
1241
1297
  start: () => Promise<void>;
1242
- createPaymentMethodManager: (type: string, managerOptions?: PaymentMethodManagerOptions) => Promise<PaymentMethodManager | null>;
1243
1298
  getSDKUtilities: () => SDKUtilities;
1244
1299
  /** Session-bound telemetry, shared with all sdk-core internals via the checkout context */
1245
1300
  getTelemetry: () => TelemetryClient;
@@ -1421,23 +1476,21 @@ export interface CreateHeadlessOptions {
1421
1476
  */
1422
1477
  forceRedirect?: boolean;
1423
1478
  /**
1424
- * Whether to try resuming the payment when the redirect popup is closed by the user.
1425
- * If false, the payment method will be deselected, allowing the user to select a different payment method.
1426
- * @default false
1479
+ * @deprecated this flag is no longer used and won't have any effect, will be removed in a future version
1427
1480
  */
1428
1481
  resumePaymentOnPopupClosure?: boolean;
1429
1482
  };
1430
1483
  /**
1431
1484
  * Fires once at SDK init with the initial set of available payment methods.
1432
1485
  */
1433
- onAvailablePaymentMethodsLoad?: (info: PaymentMethodInfo[]) => void;
1486
+ onAvailablePaymentMethodsLoad?: (info: InitializedPaymentMethod[]) => void;
1434
1487
  /**
1435
1488
  * Fires after each successful `refreshClientSession` when the available
1436
1489
  * payment methods have changed (added or removed) as a result of the backend
1437
1490
  * re-evaluating visibility rules against the updated client session metadata.
1438
1491
  * The `info` array reflects the current set in backend order.
1439
1492
  */
1440
- onAvailablePaymentMethodsRefresh?: (info: PaymentMethodInfo[]) => void;
1493
+ onAvailablePaymentMethodsRefresh?: (info: InitializedPaymentMethod[]) => void;
1441
1494
  onCheckoutComplete?: (data: {
1442
1495
  payment: Payment | null;
1443
1496
  }) => void;
@@ -1475,13 +1528,67 @@ export interface CreateHeadlessOptions {
1475
1528
  * is resolved. Not fired for a fresh checkout (no attempt in flight).
1476
1529
  */
1477
1530
  onCheckoutResume?: () => void;
1531
+ /**
1532
+ * Express Checkout (Apple Pay / Google Pay): invoked when the shopper
1533
+ * changes/enters their shipping address inside the native payment sheet.
1534
+ * The merchant computes shipping options for that address and calls
1535
+ * `setShippingOptions` with the result; the SDK displays them in the
1536
+ * sheet. Display-only — the SDK does not persist the list.
1537
+ *
1538
+ * Required for `captureShippingAddress`/`requireShippingMethod` (Google
1539
+ * Pay) or `shippingOptions.requireShippingMethod` (Apple Pay) to show any
1540
+ * shipping options. If not registered, no options are shown and a warning
1541
+ * is logged.
1542
+ *
1543
+ * Must call `setShippingOptions` within 20 seconds or the payment attempt
1544
+ * fails with a `REQUEST_TIMEOUT` error. If integrating via
1545
+ * `addEventListener('primer:shipping-address-change', ...)` instead of
1546
+ * this callback, call `event.preventDefault()` synchronously to signal you
1547
+ * will respond asynchronously — otherwise the SDK assumes nothing is
1548
+ * listening, logs a warning, and your later response is ignored.
1549
+ *
1550
+ * Not invoked at all if a legacy `shippingMethodsUrl`-configured `SHIPPING`
1551
+ * checkout module is present on the client session — that legacy,
1552
+ * server-resolved flow takes priority silently (a warning is logged, but
1553
+ * this callback is simply never called). The two are mutually exclusive;
1554
+ * remove the `shippingMethodsUrl` configuration to use this callback.
1555
+ */
1556
+ onShippingAddressChange?: (data: {
1557
+ paymentMethodType: PaymentMethodType;
1558
+ shippingAddress: NullableAddress;
1559
+ }, handler: {
1560
+ setShippingOptions: (options: ShippingOption[]) => void;
1561
+ }) => void;
1562
+ /**
1563
+ * Express Checkout (Apple Pay / Google Pay): invoked when the shopper
1564
+ * selects one of the shipping options supplied via
1565
+ * `onShippingAddressChange`. The merchant's backend should PATCH the
1566
+ * client session with the authoritative shipping amount (+ tax) before
1567
+ * calling `continue()` to acknowledge. Payment authorization is gated on
1568
+ * this ack.
1569
+ *
1570
+ * Must call `continue()` within 20 seconds or the payment attempt fails
1571
+ * with a `REQUEST_TIMEOUT` error. If integrating via
1572
+ * `addEventListener('primer:shipping-option-change', ...)` instead of
1573
+ * this callback, call `event.preventDefault()` synchronously to signal you
1574
+ * will respond asynchronously — otherwise the SDK assumes nothing is
1575
+ * listening, logs a warning, and your later response is ignored.
1576
+ *
1577
+ * Not invoked at all if a legacy `shippingMethodsUrl`-configured `SHIPPING`
1578
+ * checkout module is present — see `onShippingAddressChange`.
1579
+ */
1580
+ onShippingOptionChange?: (data: {
1581
+ paymentMethodType: PaymentMethodType;
1582
+ selectedShippingOption: ShippingOption;
1583
+ }, handler: {
1584
+ continue: () => void;
1585
+ }) => void;
1586
+ onBinDataAvailable?: (event: BinDataAvailableEvent) => void;
1587
+ onBinDataLoadingChange?: (loading: boolean) => void;
1588
+ onCardNetworksChange?: (event: CardNetworkChangeEvent) => void;
1589
+ onCardNetworksLoading?: () => void;
1478
1590
  }
1479
- export interface KlarnaPaymentMethodCategory {
1480
- id: string;
1481
- name: string;
1482
- descriptiveAssetUrl: string;
1483
- standardAssetUrl: string;
1484
- }
1591
+ export type InitializedPaymentMethod = CardPaymentMethod | KlarnaPaymentMethod | AdyenKlarnaPaymentMethod | QRCodePaymentMethod | BlikPaymentMethod | MbwayPaymentMethod | RedirectPaymentMethod | BackendDrivenPaymentMethod | NativePaymentMethod | PayPalPaymentMethod;
1485
1592
  export interface CardSecurityCodeInputOptions {
1486
1593
  ariaLabel?: string;
1487
1594
  container: string | Element | HTMLElement;
@@ -1502,7 +1609,7 @@ export interface InputMetadata {
1502
1609
  touched: boolean;
1503
1610
  submitted: boolean;
1504
1611
  }
1505
- export interface PrimerCheckoutOptions extends Omit<CreateHeadlessOptions, "dialogProvider"> {
1612
+ export interface PrimerCheckoutOptions extends Omit<CreateHeadlessOptions, "dialogProvider" | "onShippingAddressChange" | "onShippingOptionChange"> {
1506
1613
  giftCard?: {
1507
1614
  logoSrc: string;
1508
1615
  background: string;
@@ -1637,62 +1744,6 @@ export interface PrimerCheckoutOptions extends Omit<CreateHeadlessOptions, "dial
1637
1744
  */
1638
1745
  disabledPayments?: boolean;
1639
1746
  }
1640
- /**
1641
- * Payment methods that use the REDIRECT manager type — i.e. every
1642
- * PaymentMethodType not handled by a specialized manager (CARD, ACH, KLARNA,
1643
- * ADYEN_KLARNA, NATIVE, BLIK, MBWAY, QRCODE).
1644
- */
1645
- export type RedirectPaymentMethodTypes = Exclude<PaymentMethodType, typeof PaymentMethodType.STRIPE_ACH | typeof PaymentMethodType.PAYMENT_CARD | typeof PaymentMethodType.KLARNA | typeof PaymentMethodType.ADYEN_KLARNA | typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY | typeof PaymentMethodType.ADYEN_BLIK | typeof PaymentMethodType.ADYEN_MBWAY | typeof PaymentMethodType.ADYEN_BANCONTACT_PAYCONIQ | typeof PaymentMethodType.XFERS_PAYNOW | typeof PaymentMethodType.OMISE_PROMPTPAY | typeof PaymentMethodType.RAPYD_PROMPTPAY>;
1646
- /**
1647
- * A payment method that authorizes by redirecting the user to an external page.
1648
- */
1649
- export interface RedirectPaymentMethod {
1650
- type: RedirectPaymentMethodTypes;
1651
- managerType: HeadlessManagerType.REDIRECT;
1652
- manager: RedirectPaymentMethodManager;
1653
- }
1654
- export interface NativePaymentMethod {
1655
- type: typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY;
1656
- managerType: HeadlessManagerType.NATIVE;
1657
- manager: NativePaymentMethodManager;
1658
- }
1659
- export interface BlikPaymentMethod {
1660
- type: typeof PaymentMethodType.ADYEN_BLIK;
1661
- managerType: HeadlessManagerType.BLIK;
1662
- manager: BlikPaymentMethodManager;
1663
- }
1664
- export interface MbwayPaymentMethod {
1665
- type: typeof PaymentMethodType.ADYEN_MBWAY;
1666
- managerType: HeadlessManagerType.MBWAY;
1667
- manager: MbwayPaymentMethodManager;
1668
- }
1669
- export interface QRCodePaymentMethod {
1670
- type: typeof PaymentMethodType.ADYEN_BANCONTACT_PAYCONIQ | typeof PaymentMethodType.OMISE_PROMPTPAY | typeof PaymentMethodType.RAPYD_PROMPTPAY | typeof PaymentMethodType.XFERS_PAYNOW;
1671
- managerType: HeadlessManagerType.QRCODE;
1672
- manager: QRCodePaymentMethodManager;
1673
- }
1674
- export type InitializedPaymentMethod = {
1675
- type: typeof PaymentMethodType.STRIPE_ACH;
1676
- managerType: HeadlessManagerType.ACH;
1677
- manager: AchPaymentMethodManager;
1678
- } | {
1679
- type: typeof PaymentMethodType.PAYMENT_CARD;
1680
- managerType: HeadlessManagerType.CARD;
1681
- manager: CardPaymentMethodManager;
1682
- } | {
1683
- type: typeof PaymentMethodType.KLARNA;
1684
- managerType: HeadlessManagerType.KLARNA;
1685
- manager: KlarnaPaymentMethodManager;
1686
- } | {
1687
- type: typeof PaymentMethodType.ADYEN_KLARNA;
1688
- managerType: HeadlessManagerType.ADYEN_KLARNA;
1689
- manager: AdyenKlarnaPaymentMethodManager;
1690
- } | QRCodePaymentMethod | BlikPaymentMethod | MbwayPaymentMethod | RedirectPaymentMethod | NativePaymentMethod;
1691
- export interface AssetsConfig {
1692
- backgroundColor: string;
1693
- name: string;
1694
- iconUrl: string;
1695
- }
1696
1747
  /**
1697
1748
  * Options for initializing the Vault Manager
1698
1749
  */
@@ -1731,14 +1782,6 @@ export interface VaultManagerItemState {
1731
1782
  selectedVaultedPaymentMethod: VaultListItem | null;
1732
1783
  setSelectedVaultedPaymentMethod: (paymentMethod: VaultListItem | null) => void;
1733
1784
  }
1734
- export type KlarnaCategoriesContextType = {
1735
- categories: KlarnaPaymentMethodCategory[];
1736
- isLoading: boolean;
1737
- };
1738
- export type AdyenKlarnaOptionsContextType = {
1739
- options: AdyenKlarnaPaymentOption[];
1740
- isLoading: boolean;
1741
- };
1742
1785
  export type CardNetwork = {
1743
1786
  displayName: string;
1744
1787
  network: string;
@@ -1761,11 +1804,17 @@ export type SdkState = {
1761
1804
  */
1762
1805
  isProcessing: boolean;
1763
1806
  /**
1764
- * SDK/component initialization errors.
1765
- * This represents errors from the Primer JS layer itself (e.g., configuration errors,
1766
- * component initialization failures), not payment processing errors.
1767
- */
1768
- primerJsError: Error | null;
1807
+ * SDK initialization errors — never payment-processing failures (those go
1808
+ * to `paymentFailure`). The error thrown during initialization is kept
1809
+ * as-is; common codes:
1810
+ * - `INVALID_CLIENT_TOKEN`: the client token is malformed, expired, or was
1811
+ * rejected generate a new one
1812
+ * - `INITIALIZATION_ERROR`: any other initialization failure (e.g. the
1813
+ * configuration failed to load)
1814
+ * `origin` says who should act on it ('network' marks retryable failures);
1815
+ * the underlying cause is nested in `error`.
1816
+ */
1817
+ primerJsError: SdkError | null;
1769
1818
  isLoading: boolean;
1770
1819
  /**
1771
1820
  * Payment processing failure information.
@@ -1787,8 +1836,6 @@ export type ContextType = {
1787
1836
  telemetry?: TelemetryClient;
1788
1837
  configuration?: ClientConfiguration;
1789
1838
  computedStyles?: CSSStyleDeclaration | null;
1790
- klarnaCategories: KlarnaCategoriesContextType;
1791
- adyenKlarnaOptions?: AdyenKlarnaOptionsContextType;
1792
1839
  cardNetworks?: CardNetworksContextType;
1793
1840
  events?: PrimerEventsController;
1794
1841
  clientOptions?: PrimerCheckoutOptions;
@@ -1815,8 +1862,6 @@ declare class SDKContextController implements ReactiveController {
1815
1862
  setCardNetworks(value: CardNetworksContextType): void;
1816
1863
  setCardNetworksLoadingFalse(): void;
1817
1864
  setVaultManager(vaultManager: VaultManagerState): void;
1818
- setKlarnaCategories(value: KlarnaCategoriesContextType): void;
1819
- setAdyenKlarnaOptions(value: AdyenKlarnaOptionsContextType): void;
1820
1865
  setComputedStyles(value: CSSStyleDeclaration): void;
1821
1866
  setVaultManagerCvv(vaultItem: VaultManagerItemState): void;
1822
1867
  /**
@@ -2199,14 +2244,7 @@ export declare class PrimerJS {
2199
2244
  /**
2200
2245
  * Returns the cached list of payment methods.
2201
2246
  */
2202
- getPaymentMethods(): PaymentMethodInfo[];
2203
- /**
2204
- * Internal accessor that returns the initialized payment methods (with their
2205
- * managers), used by the refresh path to preserve manager identity across
2206
- * client-session refreshes.
2207
- * @internal
2208
- */
2209
- getInitializedPaymentMethods(): InitializedPaymentMethod[];
2247
+ getPaymentMethods(): InitializedPaymentMethod[];
2210
2248
  /**
2211
2249
  * Internal method to handle the onPaymentStart callback
2212
2250
  * @internal - This is only used internally by the SDK
@@ -2235,6 +2273,29 @@ export declare class PrimerJS {
2235
2273
  * ```
2236
2274
  */
2237
2275
  setCardholderName(cardholderName: string): void;
2276
+ /**
2277
+ * PayPal host-app App Switch: finishes the payment after the buyer returns
2278
+ * from the PayPal app, with the `orderId` the host app read from the return
2279
+ * deep link's `token` param. The outcome arrives through the usual
2280
+ * onCheckoutComplete/onCheckoutFail callbacks.
2281
+ *
2282
+ * Does not need the PayPal button to have rendered.
2283
+ *
2284
+ * @example
2285
+ * ```typescript
2286
+ * const checkout = document.querySelector('primer-checkout');
2287
+ * await checkout.primerJS?.resumeAppSwitch(orderIdFromDeepLink);
2288
+ * ```
2289
+ */
2290
+ resumeAppSwitch(orderId: string): Promise<void>;
2291
+ /** PayPal host-app App Switch: cancels when the buyer returns without approving. */
2292
+ cancelAppSwitch(): Promise<void>;
2293
+ /**
2294
+ * Warns rather than throwing when PayPal is absent: the host app calls these
2295
+ * on a deep-link return, where whether PayPal is in the session is not its
2296
+ * business.
2297
+ */
2298
+ private findPayPalMethod;
2238
2299
  }
2239
2300
  export interface CardSubmitResult {
2240
2301
  success?: boolean;
@@ -2308,6 +2369,18 @@ export interface PrimerEvents {
2308
2369
  "primer:payment-approval-required": CustomEvent<PaymentApprovalRequiredData & {
2309
2370
  timestamp: number;
2310
2371
  }>;
2372
+ "primer:shipping-address-change": CustomEvent<{
2373
+ paymentMethodType: PaymentMethodType;
2374
+ shippingAddress: NullableAddress;
2375
+ setShippingOptions: (options: ShippingOption[]) => void;
2376
+ timestamp: number;
2377
+ }>;
2378
+ "primer:shipping-option-change": CustomEvent<{
2379
+ paymentMethodType: PaymentMethodType;
2380
+ selectedShippingOption: ShippingOption;
2381
+ continue: () => void;
2382
+ timestamp: number;
2383
+ }>;
2311
2384
  "primer:vault-methods-update": CustomEvent<{
2312
2385
  vaultedPayments: VaultedPaymentMethodSummary[];
2313
2386
  cvvRecapture: boolean;
@@ -2387,6 +2460,26 @@ declare class PrimerEventsController {
2387
2460
  * backend to call /approve or /abort, and continueFlow() to resume the SDK.
2388
2461
  */
2389
2462
  dispatchPaymentApprovalRequired(detail: PaymentApprovalRequiredData): void;
2463
+ /**
2464
+ * @returns true if a listener called `preventDefault()` or
2465
+ * `setShippingOptions` synchronously; false if nothing is listening, so
2466
+ * the caller can resolve on its own rather than waiting out its timeout.
2467
+ */
2468
+ dispatchShippingAddressChange(detail: {
2469
+ paymentMethodType: PaymentMethodType;
2470
+ shippingAddress: NullableAddress;
2471
+ setShippingOptions: (options: ShippingOption[]) => void;
2472
+ }): boolean;
2473
+ /**
2474
+ * @returns true if a listener called `preventDefault()` or `continue()`
2475
+ * synchronously; false if nothing is listening, so the caller can resolve
2476
+ * on its own rather than waiting out its timeout.
2477
+ */
2478
+ dispatchShippingOptionChange(detail: {
2479
+ paymentMethodType: PaymentMethodType;
2480
+ selectedShippingOption: ShippingOption;
2481
+ continue: () => void;
2482
+ }): boolean;
2390
2483
  /**
2391
2484
  * Dispatch vault methods update event.
2392
2485
  * Called when vaulted payment methods are loaded or updated.
@@ -2545,8 +2638,6 @@ declare class HeadlessSdkController implements ReactiveController {
2545
2638
  host: PrimerCheckoutType;
2546
2639
  private currentSdkInstance;
2547
2640
  private primerJS;
2548
- private loadingTimeout;
2549
- private isDisconnected;
2550
2641
  /**
2551
2642
  * Session-bound telemetry of the current SDK instance. Held here (in
2552
2643
  * addition to the Lit context) so teardown paths can still emit
@@ -2557,8 +2648,6 @@ declare class HeadlessSdkController implements ReactiveController {
2557
2648
  get primerJSInstance(): PrimerJS | null;
2558
2649
  hostConnected(): void;
2559
2650
  hostDisconnected(): void;
2560
- private setupLoadingTimeout;
2561
- private clearLoadingTimeout;
2562
2651
  private cleanupResources;
2563
2652
  /**
2564
2653
  * Datadog error reporting that works across the whole lifecycle: uses the
@@ -2574,11 +2663,23 @@ declare class HeadlessSdkController implements ReactiveController {
2574
2663
  * synchronously read state see `isProcessing: true`.
2575
2664
  */
2576
2665
  private handlePaymentApprovalRequired;
2666
+ /**
2667
+ * Bridges sdk-core's shipping-address-change callback to the
2668
+ * primer:shipping-address-change DOM event, auto-resolving with no
2669
+ * options so sdk-core's promise doesn't time out if nothing responds.
2670
+ */
2671
+ private handleShippingAddressChange;
2672
+ /**
2673
+ * Express Checkout (Apple Pay / Google Pay): sdk-core invokes this when the
2674
+ * shopper selects one of the shipping options previously supplied via
2675
+ * onShippingAddressChange. Same bridge/auto-resolve shape as
2676
+ * handleShippingAddressChange above.
2677
+ */
2678
+ private handleShippingOptionChange;
2577
2679
  initializeHeadless(): ([clientToken, options]: readonly [
2578
2680
  string | null,
2579
2681
  PrimerCheckoutOptions | null
2580
2682
  ]) => Promise<PrimerHeadlessCheckout | typeof initialState>;
2581
- private createManager;
2582
2683
  /**
2583
2684
  * Updates card networks state and dispatches events
2584
2685
  *
@@ -2598,8 +2699,6 @@ declare class HeadlessSdkController implements ReactiveController {
2598
2699
  * 2. Setting the CSS custom property --primer-loader-disabled: 1
2599
2700
  */
2600
2701
  export declare class PrimerCheckoutComponent extends LitElement implements PrimerCheckoutType {
2601
- set jsInitialized(value: boolean);
2602
- get jsInitialized(): boolean;
2603
2702
  get primerJS(): PrimerJS | undefined;
2604
2703
  static styles: CSSResult[];
2605
2704
  customStyles: string;
@@ -2611,11 +2710,9 @@ export declare class PrimerCheckoutComponent extends LitElement implements Prime
2611
2710
  * This is used to control the CSS-only loader visibility
2612
2711
  * @private
2613
2712
  */
2614
- private _jsInitialized;
2713
+ private jsInitialized;
2615
2714
  defaultSlot: HTMLSlotElement;
2616
- private previousLoadingState;
2617
2715
  private hasAssignedContent;
2618
- private _loadingTimeoutId;
2619
2716
  private _eventListenerController;
2620
2717
  private _classObserver;
2621
2718
  locale: LocaleCode;
@@ -2627,7 +2724,7 @@ export declare class PrimerCheckoutComponent extends LitElement implements Prime
2627
2724
  headlessSdkController: HeadlessSdkController;
2628
2725
  constructor();
2629
2726
  connectedCallback(): void;
2630
- attributeChangedCallback(attrName: string, oldVal: string, newVal: string): void;
2727
+ attributeChangedCallback(attrName: "custom-styles" | (string & {}), oldVal: string, newVal: string): void;
2631
2728
  disconnectedCallback(): void;
2632
2729
  willUpdate(changedProperties: PropertyValues): void;
2633
2730
  updated(): void;
@@ -2646,11 +2743,6 @@ export declare class PrimerCheckoutComponent extends LitElement implements Prime
2646
2743
  * Uses AbortController signal to prevent circular event loops more safely
2647
2744
  */
2648
2745
  private handleExternalShowOtherPaymentsToggle;
2649
- /**
2650
- * Check if the loading state has changed and update the CSS loader visibility accordingly.
2651
- * This method is called after each update cycle to detect when loading is complete.
2652
- */
2653
- private checkLoadingStateChange;
2654
2746
  render(): TemplateResult;
2655
2747
  addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: PrimerCheckoutComponent, ev: HTMLElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
2656
2748
  addEventListener<K extends keyof ShadowRootEventMap>(type: K, listener: (this: PrimerCheckoutComponent, ev: ShadowRootEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
@@ -2688,6 +2780,11 @@ export declare function injectLightTheme(): void;
2688
2780
  * @returns {void}
2689
2781
  */
2690
2782
  export declare function injectDarkTheme(): void;
2783
+ export interface AssetsConfig {
2784
+ backgroundColor: string;
2785
+ name: string;
2786
+ iconUrl: string;
2787
+ }
2691
2788
  /**
2692
2789
  * Size options for the spinner component
2693
2790
  */
@@ -3280,10 +3377,13 @@ declare global {
3280
3377
  "primer-klarna": PrimerKlarnaComponent;
3281
3378
  }
3282
3379
  }
3380
+ type NativePaymentMethod$1 = Extract<InitializedPaymentMethod, {
3381
+ managerType: HeadlessManagerType.NATIVE;
3382
+ }>;
3283
3383
  declare class NativePaymentComponent extends LitElement {
3284
3384
  static styles: import("lit").CSSResult[];
3285
3385
  type: PaymentMethodType | undefined;
3286
- paymentMethod: NativePaymentMethod | undefined;
3386
+ paymentMethod: NativePaymentMethod$1 | undefined;
3287
3387
  primerContext?: ContextType;
3288
3388
  disabled: boolean;
3289
3389
  private buttonContainerRef;
@@ -3293,6 +3393,9 @@ declare class NativePaymentComponent extends LitElement {
3293
3393
  protected willUpdate(changedProperties: PropertyValues): void;
3294
3394
  render(): import("lit-html").TemplateResult<1>;
3295
3395
  }
3396
+ type BlikPaymentMethod$1 = Extract<InitializedPaymentMethod, {
3397
+ managerType: HeadlessManagerType.BLIK;
3398
+ }>;
3296
3399
  /**
3297
3400
  * BLIK Payment Component
3298
3401
  *
@@ -3315,7 +3418,7 @@ declare class NativePaymentComponent extends LitElement {
3315
3418
  */
3316
3419
  declare class BlikComponent extends LitElement {
3317
3420
  static styles: import("lit").CSSResult[];
3318
- paymentMethod: BlikPaymentMethod | undefined;
3421
+ paymentMethod: BlikPaymentMethod$1 | undefined;
3319
3422
  disabled: boolean;
3320
3423
  private currentState;
3321
3424
  private blikCode;
@@ -3376,13 +3479,16 @@ declare global {
3376
3479
  "primer-blik": BlikComponent;
3377
3480
  }
3378
3481
  }
3482
+ type AdyenKlarnaPaymentMethod$1 = Extract<InitializedPaymentMethod, {
3483
+ managerType: HeadlessManagerType.ADYEN_KLARNA;
3484
+ }>;
3379
3485
  declare class AdyenKlarnaComponent extends LitElement {
3380
3486
  static styles: import("lit").CSSResult[];
3381
3487
  primerContext?: ContextType;
3382
3488
  /**
3383
3489
  * The payment method from context
3384
3490
  */
3385
- paymentMethod?: InitializedPaymentMethod;
3491
+ paymentMethod?: AdyenKlarnaPaymentMethod$1;
3386
3492
  /**
3387
3493
  * Whether the component is disabled
3388
3494
  */
@@ -3400,7 +3506,6 @@ declare class AdyenKlarnaComponent extends LitElement {
3400
3506
  */
3401
3507
  private loading;
3402
3508
  private paymentInProgress;
3403
- private get manager();
3404
3509
  /**
3405
3510
  * Get the Klarna logo URL from the payment method configuration
3406
3511
  */
@@ -3415,6 +3520,9 @@ declare global {
3415
3520
  "primer-adyen-klarna": AdyenKlarnaComponent;
3416
3521
  }
3417
3522
  }
3523
+ type MbwayPaymentMethod$1 = Extract<InitializedPaymentMethod, {
3524
+ managerType: HeadlessManagerType.MBWAY;
3525
+ }>;
3418
3526
  /**
3419
3527
  * Adyen MB WAY Payment Component
3420
3528
  *
@@ -3424,7 +3532,7 @@ declare global {
3424
3532
  */
3425
3533
  declare class AdyenMbwayComponent extends LitElement {
3426
3534
  static styles: import("lit").CSSResult[];
3427
- paymentMethod: MbwayPaymentMethod | undefined;
3535
+ paymentMethod: MbwayPaymentMethod$1 | undefined;
3428
3536
  disabled: boolean;
3429
3537
  private currentState;
3430
3538
  private phoneNumber;
@@ -3447,9 +3555,12 @@ declare global {
3447
3555
  "primer-adyen-mbway": AdyenMbwayComponent;
3448
3556
  }
3449
3557
  }
3558
+ type QRCodePaymentMethod$1 = Extract<InitializedPaymentMethod, {
3559
+ managerType: HeadlessManagerType.QRCODE;
3560
+ }>;
3450
3561
  declare class QRCodeComponent extends LitElement {
3451
3562
  static styles: import("lit").CSSResult[];
3452
- paymentMethod: QRCodePaymentMethod | undefined;
3563
+ paymentMethod: QRCodePaymentMethod$1 | undefined;
3453
3564
  disabled: boolean;
3454
3565
  primerContext?: ContextType;
3455
3566
  private isExpanded;
@@ -3470,6 +3581,48 @@ declare global {
3470
3581
  "primer-qrcode": QRCodeComponent;
3471
3582
  }
3472
3583
  }
3584
+ declare class PaymentMethodButtonComponent extends LitElement {
3585
+ static styles: import("lit").CSSResult[];
3586
+ type: PaymentMethodType | undefined;
3587
+ disabled: boolean;
3588
+ primerContext?: ContextType;
3589
+ /**
3590
+ * Based on packages/primer-sdk-web/src/payment-methods/Button.tsx
3591
+ * Should be replaced once we align on a better solution across all platforms.
3592
+ */
3593
+ private _legacyGetButtonLabel;
3594
+ private _getBackgroundColor;
3595
+ private _getIconUrl;
3596
+ private _getIconPosition;
3597
+ private _getTextColor;
3598
+ private _getDisplayName;
3599
+ private _setupTask;
3600
+ private _handleClick;
3601
+ render(): symbol | import("lit-html").TemplateResult<1> | undefined;
3602
+ }
3603
+ declare global {
3604
+ interface HTMLElementTagNameMap {
3605
+ "primer-payment-method-button": PaymentMethodButtonComponent;
3606
+ }
3607
+ }
3608
+ type BackendDrivenPaymentMethod$1 = Extract<InitializedPaymentMethod, {
3609
+ managerType: HeadlessManagerType.BACKEND_DRIVEN;
3610
+ }>;
3611
+ /**
3612
+ * Surface for a payment method whose flow the backend drives through a step
3613
+ * tree. Today every step tree starts by handing off to a third party, so this
3614
+ * renders a button — but unlike a redirect method, what the flow needs of this
3615
+ * component is open-ended: steps can ask for input, render UI, or wait, and
3616
+ * this is where that grows.
3617
+ */
3618
+ declare class BackendDrivenComponent extends LitElement {
3619
+ static styles: import("lit").CSSResult;
3620
+ paymentMethod: BackendDrivenPaymentMethod$1 | undefined;
3621
+ disabled: boolean;
3622
+ primerContext?: ContextType;
3623
+ private _handleClick;
3624
+ render(): import("lit-html").TemplateResult<1>;
3625
+ }
3473
3626
  declare class PaymentMethodComponent extends LitElement {
3474
3627
  static styles: import("lit").CSSResult[];
3475
3628
  type: PaymentMethodType | undefined;
@@ -3503,33 +3656,12 @@ declare global {
3503
3656
  "primer-payment-method-container": PaymentMethodContainerComponent;
3504
3657
  }
3505
3658
  }
3506
- declare class PaymentMethodButtonComponent extends LitElement {
3507
- static styles: import("lit").CSSResult[];
3508
- type: PaymentMethodType | undefined;
3509
- disabled: boolean;
3510
- primerContext?: ContextType;
3511
- /**
3512
- * Based on packages/primer-sdk-web/src/payment-methods/Button.tsx
3513
- * Should be replaced once we align on a better solution across all platforms.
3514
- */
3515
- private _legacyGetButtonLabel;
3516
- private _getBackgroundColor;
3517
- private _getIconUrl;
3518
- private _getIconPosition;
3519
- private _getTextColor;
3520
- private _getDisplayName;
3521
- private _setupTask;
3522
- private _handleClick;
3523
- render(): symbol | import("lit-html").TemplateResult<1> | undefined;
3524
- }
3525
- declare global {
3526
- interface HTMLElementTagNameMap {
3527
- "primer-payment-method-button": PaymentMethodButtonComponent;
3528
- }
3529
- }
3659
+ type RedirectPaymentMethod$1 = Extract<InitializedPaymentMethod, {
3660
+ managerType: HeadlessManagerType.REDIRECT;
3661
+ }>;
3530
3662
  declare class RedirectPaymentComponent extends LitElement {
3531
3663
  static styles: import("lit").CSSResult;
3532
- paymentMethod: RedirectPaymentMethod | undefined;
3664
+ paymentMethod: RedirectPaymentMethod$1 | undefined;
3533
3665
  disabled: boolean;
3534
3666
  primerContext?: ContextType;
3535
3667
  private _handleClick;
@@ -3540,6 +3672,11 @@ declare global {
3540
3672
  "primer-redirect-payment": RedirectPaymentComponent;
3541
3673
  }
3542
3674
  }
3675
+ declare global {
3676
+ interface HTMLElementTagNameMap {
3677
+ "primer-backend-driven": BackendDrivenComponent;
3678
+ }
3679
+ }
3543
3680
  /**
3544
3681
  * BillingAddressComponent provides a form for collecting billing address information.
3545
3682
  *
@@ -4993,6 +5130,7 @@ export declare function loadPrimer(): void;
4993
5130
 
4994
5131
  export {
4995
5132
  AdyenMbwayComponent as AdyenMbway,
5133
+ BackendDrivenComponent as BackendDriven,
4996
5134
  BillingAddressComponent as BillingAddress,
4997
5135
  BlikComponent as Blik,
4998
5136
  ButtonComponent as Button,