@primer-io/primer-js 0.1.9 → 0.3.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.
Files changed (60) hide show
  1. package/dist/chunks/{ar.6MRFCKX4.js → ar.KRXB3WQO.js} +1 -1
  2. package/dist/chunks/{bg.HRSMU7Y5.js → bg.6SKJRXIR.js} +1 -1
  3. package/dist/chunks/{ca.3FSHJL7U.js → ca.SANDLFEK.js} +1 -1
  4. package/dist/chunks/chunk.DV3REKZU.js +1 -0
  5. package/dist/chunks/{cs.WAO4WFS3.js → cs.FC4I5M3C.js} +1 -1
  6. package/dist/chunks/{da.4OFYGDVA.js → da.YI32NZ7B.js} +1 -1
  7. package/dist/chunks/{de.3FZS52IN.js → de.7M7UFQB7.js} +1 -1
  8. package/dist/chunks/{el.A4R7VG5T.js → el.XSGTYDZR.js} +1 -1
  9. package/dist/chunks/en-GB.VO4GDE3X.js +1 -0
  10. package/dist/chunks/en.MNFLVOE3.js +1 -0
  11. package/dist/chunks/{es-AR.QKHDL4JV.js → es-AR.TBWVUZEF.js} +1 -1
  12. package/dist/chunks/{es-MX.GG7MJMG2.js → es-MX.6EMWUABR.js} +1 -1
  13. package/dist/chunks/{es.FEZ6BF3S.js → es.XZLDFHYI.js} +1 -1
  14. package/dist/chunks/{et-EE.FJLPTMF3.js → et-EE.JBSFMKZ2.js} +1 -1
  15. package/dist/chunks/{fi-FI.DM5R27A5.js → fi-FI.I75VK2ID.js} +1 -1
  16. package/dist/chunks/{fr.YZV52NTA.js → fr.JBNP6RXT.js} +1 -1
  17. package/dist/chunks/{he.6SCF3XZZ.js → he.PW253QAL.js} +1 -1
  18. package/dist/chunks/{hr.PPDZ7AAS.js → hr.LM4RITYJ.js} +1 -1
  19. package/dist/chunks/{hu.6WOPSGLW.js → hu.JGCKQA6J.js} +1 -1
  20. package/dist/chunks/{id.NS22WGWL.js → id.VBXULDDY.js} +1 -1
  21. package/dist/chunks/{it.42TO3R4G.js → it.7Q6BFLDK.js} +1 -1
  22. package/dist/chunks/{ja.UEGHEUAP.js → ja.QOC76SSC.js} +1 -1
  23. package/dist/chunks/{ko.HTMDY6RY.js → ko.BANZIFNH.js} +1 -1
  24. package/dist/chunks/{lt-LT.4U3GBQTQ.js → lt-LT.Q2SRJOKH.js} +1 -1
  25. package/dist/chunks/{lt.73ME4TDM.js → lt.XMNFEN5T.js} +1 -1
  26. package/dist/chunks/{lv-LV.JRWO2BF6.js → lv-LV.3AJDTMU5.js} +1 -1
  27. package/dist/chunks/{lv.KROS45TV.js → lv.TFPDXNEV.js} +1 -1
  28. package/dist/chunks/{ms.HE3SWJFQ.js → ms.FPTX4NM4.js} +1 -1
  29. package/dist/chunks/{nb.TR6TEKBY.js → nb.CAFSKRQ2.js} +1 -1
  30. package/dist/chunks/{nl.V5QP6OXL.js → nl.7BPSDYTC.js} +1 -1
  31. package/dist/chunks/{nl_NL.FCVWIF3Y.js → nl_NL.6ZVCFPVW.js} +1 -1
  32. package/dist/chunks/{pl.DQZDG7LR.js → pl.RF34QM23.js} +1 -1
  33. package/dist/chunks/{pt-BR.CR4ROBVE.js → pt-BR.AKDHLRUA.js} +1 -1
  34. package/dist/chunks/{pt.JRWVFJPX.js → pt.VBALOWHZ.js} +1 -1
  35. package/dist/chunks/{ro.NRMWYY3F.js → ro.WN7VCF27.js} +1 -1
  36. package/dist/chunks/{ru.OWSKHXVO.js → ru.ICXGVGRR.js} +1 -1
  37. package/dist/chunks/{sk.YGBRNNWT.js → sk.SIP5JIOX.js} +1 -1
  38. package/dist/chunks/{sl.IRTDTNTP.js → sl.R77UEKCA.js} +1 -1
  39. package/dist/chunks/{sr-RS.AWGLHKVE.js → sr-RS.6M2YSTDX.js} +1 -1
  40. package/dist/chunks/{sv.O4BXFGNF.js → sv.33ZY4CDS.js} +1 -1
  41. package/dist/chunks/{th.GZCEBRT2.js → th.M27YUIZC.js} +1 -1
  42. package/dist/chunks/{tr.ZDILMEEO.js → tr.Q2SIY6NA.js} +1 -1
  43. package/dist/chunks/{uk-UA.JUUBOEW3.js → uk-UA.EJZOGSJR.js} +1 -1
  44. package/dist/chunks/{vi.IN7CFTLL.js → vi.3RROGLXM.js} +1 -1
  45. package/dist/chunks/zf.GGWFQ3Y7.js +1 -0
  46. package/dist/chunks/{zh-CN.RBRAS4RP.js → zh-CN.MQHNRMN4.js} +1 -1
  47. package/dist/chunks/{zh-HK.4CK7LBWM.js → zh-HK.WNR7XUSX.js} +1 -1
  48. package/dist/chunks/{zh-TW.374TMWNJ.js → zh-TW.GNCY2PNY.js} +1 -1
  49. package/dist/custom-elements.json +2849 -3555
  50. package/dist/jsx/index.d.ts +85 -87
  51. package/dist/primer-loader.d.ts +933 -2308
  52. package/dist/primer-loader.js +138 -2906
  53. package/dist/primer-react-wrappers.js +121 -2350
  54. package/dist/vscode.html-custom-data.json +54 -30
  55. package/dist/web-types.json +195 -117
  56. package/package.json +7 -3
  57. package/dist/chunks/chunk.I6YWTZRK.js +0 -1
  58. package/dist/chunks/en-GB.ILZ7SXSW.js +0 -1
  59. package/dist/chunks/en.7GZJA7MN.js +0 -1
  60. package/dist/chunks/zf.YT47ULXR.js +0 -1
@@ -1,8 +1,11 @@
1
+ import { Task, initialState } from '@lit/task';
2
+ import { CSSResult, LitElement, PropertyValues, ReactiveController, ReactiveControllerHost, SVGTemplateResult, TemplateResult, nothing } from 'lit';
3
+
1
4
  export type CardNetwork = {
2
5
  displayName: string;
3
6
  network: string;
4
7
  };
5
- export type CardNetworksContext = {
8
+ export type CardNetworksContextType = {
6
9
  detectedCardNetwork: CardNetwork | null;
7
10
  selectableCardNetworks: CardNetwork[];
8
11
  isLoading: boolean;
@@ -18,1028 +21,7 @@ export type SdkState = {
18
21
  details?: Record<string, unknown>;
19
22
  } | null;
20
23
  };
21
- export type SdkStateContext = SdkState | null;
22
- /**
23
- * A CSSResult or native CSSStyleSheet.
24
- *
25
- * In browsers that support constructible CSS style sheets, CSSStyleSheet
26
- * object can be used for styling along side CSSResult from the `css`
27
- * template tag.
28
- */
29
- export type CSSResultOrNative = CSSResult | CSSStyleSheet;
30
- export type CSSResultArray = Array<CSSResultOrNative | CSSResultArray>;
31
- /**
32
- * A single CSSResult, CSSStyleSheet, or an array or nested arrays of those.
33
- */
34
- export type CSSResultGroup = CSSResultOrNative | CSSResultArray;
35
- declare class CSSResult {
36
- ["_$cssResult$"]: boolean;
37
- readonly cssText: string;
38
- private _styleSheet?;
39
- private _strings;
40
- private constructor();
41
- get styleSheet(): CSSStyleSheet | undefined;
42
- toString(): string;
43
- }
44
- /**
45
- * @license
46
- * Copyright 2021 Google LLC
47
- * SPDX-License-Identifier: BSD-3-Clause
48
- */
49
- /**
50
- * An object that can host Reactive Controllers and call their lifecycle
51
- * callbacks.
52
- */
53
- export interface ReactiveControllerHost {
54
- /**
55
- * Adds a controller to the host, which sets up the controller's lifecycle
56
- * methods to be called with the host's lifecycle.
57
- */
58
- addController(controller: ReactiveController): void;
59
- /**
60
- * Removes a controller from the host.
61
- */
62
- removeController(controller: ReactiveController): void;
63
- /**
64
- * Requests a host update which is processed asynchronously. The update can
65
- * be waited on via the `updateComplete` property.
66
- */
67
- requestUpdate(): void;
68
- /**
69
- * Returns a Promise that resolves when the host has completed updating.
70
- * The Promise value is a boolean that is `true` if the element completed the
71
- * update without triggering another update. The Promise result is `false` if
72
- * a property was set inside `updated()`. If the Promise is rejected, an
73
- * exception was thrown during the update.
74
- *
75
- * @return A promise of a boolean that indicates if the update resolved
76
- * without triggering another update.
77
- */
78
- readonly updateComplete: Promise<boolean>;
79
- }
80
- /**
81
- * A Reactive Controller is an object that enables sub-component code
82
- * organization and reuse by aggregating the state, behavior, and lifecycle
83
- * hooks related to a single feature.
84
- *
85
- * Controllers are added to a host component, or other object that implements
86
- * the `ReactiveControllerHost` interface, via the `addController()` method.
87
- * They can hook their host components's lifecycle by implementing one or more
88
- * of the lifecycle callbacks, or initiate an update of the host component by
89
- * calling `requestUpdate()` on the host.
90
- */
91
- export interface ReactiveController {
92
- /**
93
- * Called when the host is connected to the component tree. For custom
94
- * element hosts, this corresponds to the `connectedCallback()` lifecycle,
95
- * which is only called when the component is connected to the document.
96
- */
97
- hostConnected?(): void;
98
- /**
99
- * Called when the host is disconnected from the component tree. For custom
100
- * element hosts, this corresponds to the `disconnectedCallback()` lifecycle,
101
- * which is called the host or an ancestor component is disconnected from the
102
- * document.
103
- */
104
- hostDisconnected?(): void;
105
- /**
106
- * Called during the client-side host update, just before the host calls
107
- * its own update.
108
- *
109
- * Code in `update()` can depend on the DOM as it is not called in
110
- * server-side rendering.
111
- */
112
- hostUpdate?(): void;
113
- /**
114
- * Called after a host update, just before the host calls firstUpdated and
115
- * updated. It is not called in server-side rendering.
116
- *
117
- */
118
- hostUpdated?(): void;
119
- }
120
- /**
121
- * Converts property values to and from attribute values.
122
- */
123
- export interface ComplexAttributeConverter<Type = unknown, TypeHint = unknown> {
124
- /**
125
- * Called to convert an attribute value to a property
126
- * value.
127
- */
128
- fromAttribute?(value: string | null, type?: TypeHint): Type;
129
- /**
130
- * Called to convert a property value to an attribute
131
- * value.
132
- *
133
- * It returns unknown instead of string, to be compatible with
134
- * https://github.com/WICG/trusted-types (and similar efforts).
135
- */
136
- toAttribute?(value: Type, type?: TypeHint): unknown;
137
- }
138
- export type AttributeConverter<Type = unknown, TypeHint = unknown> = ComplexAttributeConverter<Type> | ((value: string | null, type?: TypeHint) => Type);
139
- /**
140
- * Defines options for a property accessor.
141
- */
142
- export interface PropertyDeclaration<Type = unknown, TypeHint = unknown> {
143
- /**
144
- * When set to `true`, indicates the property is internal private state. The
145
- * property should not be set by users. When using TypeScript, this property
146
- * should be marked as `private` or `protected`, and it is also a common
147
- * practice to use a leading `_` in the name. The property is not added to
148
- * `observedAttributes`.
149
- */
150
- readonly state?: boolean;
151
- /**
152
- * Indicates how and whether the property becomes an observed attribute.
153
- * If the value is `false`, the property is not added to `observedAttributes`.
154
- * If true or absent, the lowercased property name is observed (e.g. `fooBar`
155
- * becomes `foobar`). If a string, the string value is observed (e.g
156
- * `attribute: 'foo-bar'`).
157
- */
158
- readonly attribute?: boolean | string;
159
- /**
160
- * Indicates the type of the property. This is used only as a hint for the
161
- * `converter` to determine how to convert the attribute
162
- * to/from a property.
163
- */
164
- readonly type?: TypeHint;
165
- /**
166
- * Indicates how to convert the attribute to/from a property. If this value
167
- * is a function, it is used to convert the attribute value a the property
168
- * value. If it's an object, it can have keys for `fromAttribute` and
169
- * `toAttribute`. If no `toAttribute` function is provided and
170
- * `reflect` is set to `true`, the property value is set directly to the
171
- * attribute. A default `converter` is used if none is provided; it supports
172
- * `Boolean`, `String`, `Number`, `Object`, and `Array`. Note,
173
- * when a property changes and the converter is used to update the attribute,
174
- * the property is never updated again as a result of the attribute changing,
175
- * and vice versa.
176
- */
177
- readonly converter?: AttributeConverter<Type, TypeHint>;
178
- /**
179
- * Indicates if the property should reflect to an attribute.
180
- * If `true`, when the property is set, the attribute is set using the
181
- * attribute name determined according to the rules for the `attribute`
182
- * property option and the value of the property converted using the rules
183
- * from the `converter` property option.
184
- */
185
- readonly reflect?: boolean;
186
- /**
187
- * A function that indicates if a property should be considered changed when
188
- * it is set. The function should take the `newValue` and `oldValue` and
189
- * return `true` if an update should be requested.
190
- */
191
- hasChanged?(value: Type, oldValue: Type): boolean;
192
- /**
193
- * Indicates whether an accessor will be created for this property. By
194
- * default, an accessor will be generated for this property that requests an
195
- * update when set. If this flag is `true`, no accessor will be created, and
196
- * it will be the user's responsibility to call
197
- * `this.requestUpdate(propertyName, oldValue)` to request an update when
198
- * the property changes.
199
- */
200
- readonly noAccessor?: boolean;
201
- }
202
- /**
203
- * Map of properties to PropertyDeclaration options. For each property an
204
- * accessor is made, and the property is processed according to the
205
- * PropertyDeclaration options.
206
- */
207
- export interface PropertyDeclarations {
208
- readonly [key: string]: PropertyDeclaration;
209
- }
210
- export type PropertyDeclarationMap = Map<PropertyKey, PropertyDeclaration>;
211
- /**
212
- * A Map of property keys to values.
213
- *
214
- * Takes an optional type parameter T, which when specified as a non-any,
215
- * non-unknown type, will make the Map more strongly-typed, associating the map
216
- * keys with their corresponding value type on T.
217
- *
218
- * Use `PropertyValues<this>` when overriding ReactiveElement.update() and
219
- * other lifecycle methods in order to get stronger type-checking on keys
220
- * and values.
221
- */
222
- export type PropertyValues<T = any> = T extends object ? PropertyValueMap<T> : Map<PropertyKey, unknown>;
223
- /**
224
- * Do not use, instead prefer {@linkcode PropertyValues}.
225
- */
226
- export interface PropertyValueMap<T> extends Map<PropertyKey, unknown> {
227
- get<K extends keyof T>(k: K): T[K] | undefined;
228
- set<K extends keyof T>(key: K, value: T[K]): this;
229
- has<K extends keyof T>(k: K): boolean;
230
- delete<K extends keyof T>(k: K): boolean;
231
- }
232
- /**
233
- * A string representing one of the supported dev mode warning categories.
234
- */
235
- export type WarningKind = "change-in-update" | "migration" | "async-perform-update";
236
- export type Initializer = (element: ReactiveElement) => void;
237
- declare global {
238
- interface SymbolConstructor {
239
- readonly metadata: unique symbol;
240
- }
241
- }
242
- declare global {
243
- var litPropertyMetadata: WeakMap<object, Map<PropertyKey, PropertyDeclaration>>;
244
- }
245
- declare abstract class ReactiveElement extends HTMLElement implements ReactiveControllerHost {
246
- /**
247
- * Read or set all the enabled warning categories for this class.
248
- *
249
- * This property is only used in development builds.
250
- *
251
- * @nocollapse
252
- * @category dev-mode
253
- */
254
- static enabledWarnings?: WarningKind[];
255
- /**
256
- * Enable the given warning category for this class.
257
- *
258
- * This method only exists in development builds, so it should be accessed
259
- * with a guard like:
260
- *
261
- * ```ts
262
- * // Enable for all ReactiveElement subclasses
263
- * ReactiveElement.enableWarning?.('migration');
264
- *
265
- * // Enable for only MyElement and subclasses
266
- * MyElement.enableWarning?.('migration');
267
- * ```
268
- *
269
- * @nocollapse
270
- * @category dev-mode
271
- */
272
- static enableWarning?: (warningKind: WarningKind) => void;
273
- /**
274
- * Disable the given warning category for this class.
275
- *
276
- * This method only exists in development builds, so it should be accessed
277
- * with a guard like:
278
- *
279
- * ```ts
280
- * // Disable for all ReactiveElement subclasses
281
- * ReactiveElement.disableWarning?.('migration');
282
- *
283
- * // Disable for only MyElement and subclasses
284
- * MyElement.disableWarning?.('migration');
285
- * ```
286
- *
287
- * @nocollapse
288
- * @category dev-mode
289
- */
290
- static disableWarning?: (warningKind: WarningKind) => void;
291
- /**
292
- * Adds an initializer function to the class that is called during instance
293
- * construction.
294
- *
295
- * This is useful for code that runs against a `ReactiveElement`
296
- * subclass, such as a decorator, that needs to do work for each
297
- * instance, such as setting up a `ReactiveController`.
298
- *
299
- * ```ts
300
- * const myDecorator = (target: typeof ReactiveElement, key: string) => {
301
- * target.addInitializer((instance: ReactiveElement) => {
302
- * // This is run during construction of the element
303
- * new MyController(instance);
304
- * });
305
- * }
306
- * ```
307
- *
308
- * Decorating a field will then cause each instance to run an initializer
309
- * that adds a controller:
310
- *
311
- * ```ts
312
- * class MyElement extends LitElement {
313
- * @myDecorator foo;
314
- * }
315
- * ```
316
- *
317
- * Initializers are stored per-constructor. Adding an initializer to a
318
- * subclass does not add it to a superclass. Since initializers are run in
319
- * constructors, initializers will run in order of the class hierarchy,
320
- * starting with superclasses and progressing to the instance's class.
321
- *
322
- * @nocollapse
323
- */
324
- static addInitializer(initializer: Initializer): void;
325
- static _initializers?: Initializer[];
326
- /**
327
- * Maps attribute names to properties; for example `foobar` attribute to
328
- * `fooBar` property. Created lazily on user subclasses when finalizing the
329
- * class.
330
- * @nocollapse
331
- */
332
- private static __attributeToPropertyMap;
333
- /**
334
- * Marks class as having been finalized, which includes creating properties
335
- * from `static properties`, but does *not* include all properties created
336
- * from decorators.
337
- * @nocollapse
338
- */
339
- protected static finalized: true | undefined;
340
- /**
341
- * Memoized list of all element properties, including any superclass
342
- * properties. Created lazily on user subclasses when finalizing the class.
343
- *
344
- * @nocollapse
345
- * @category properties
346
- */
347
- static elementProperties: PropertyDeclarationMap;
348
- /**
349
- * User-supplied object that maps property names to `PropertyDeclaration`
350
- * objects containing options for configuring reactive properties. When
351
- * a reactive property is set the element will update and render.
352
- *
353
- * By default properties are public fields, and as such, they should be
354
- * considered as primarily settable by element users, either via attribute or
355
- * the property itself.
356
- *
357
- * Generally, properties that are changed by the element should be private or
358
- * protected fields and should use the `state: true` option. Properties
359
- * marked as `state` do not reflect from the corresponding attribute
360
- *
361
- * However, sometimes element code does need to set a public property. This
362
- * should typically only be done in response to user interaction, and an event
363
- * should be fired informing the user; for example, a checkbox sets its
364
- * `checked` property when clicked and fires a `changed` event. Mutating
365
- * public properties should typically not be done for non-primitive (object or
366
- * array) properties. In other cases when an element needs to manage state, a
367
- * private property set with the `state: true` option should be used. When
368
- * needed, state properties can be initialized via public properties to
369
- * facilitate complex interactions.
370
- * @nocollapse
371
- * @category properties
372
- */
373
- static properties: PropertyDeclarations;
374
- /**
375
- * Memoized list of all element styles.
376
- * Created lazily on user subclasses when finalizing the class.
377
- * @nocollapse
378
- * @category styles
379
- */
380
- static elementStyles: Array<CSSResultOrNative>;
381
- /**
382
- * Array of styles to apply to the element. The styles should be defined
383
- * using the {@linkcode css} tag function, via constructible stylesheets, or
384
- * imported from native CSS module scripts.
385
- *
386
- * Note on Content Security Policy:
387
- *
388
- * Element styles are implemented with `<style>` tags when the browser doesn't
389
- * support adopted StyleSheets. To use such `<style>` tags with the style-src
390
- * CSP directive, the style-src value must either include 'unsafe-inline' or
391
- * `nonce-<base64-value>` with `<base64-value>` replaced be a server-generated
392
- * nonce.
393
- *
394
- * To provide a nonce to use on generated `<style>` elements, set
395
- * `window.litNonce` to a server-generated nonce in your page's HTML, before
396
- * loading application code:
397
- *
398
- * ```html
399
- * <script>
400
- * // Generated and unique per request:
401
- * window.litNonce = 'a1b2c3d4';
402
- * </script>
403
- * ```
404
- * @nocollapse
405
- * @category styles
406
- */
407
- static styles?: CSSResultGroup;
408
- /**
409
- * Returns a list of attributes corresponding to the registered properties.
410
- * @nocollapse
411
- * @category attributes
412
- */
413
- static get observedAttributes(): string[];
414
- private __instanceProperties?;
415
- /**
416
- * Creates a property accessor on the element prototype if one does not exist
417
- * and stores a {@linkcode PropertyDeclaration} for the property with the
418
- * given options. The property setter calls the property's `hasChanged`
419
- * property option or uses a strict identity check to determine whether or not
420
- * to request an update.
421
- *
422
- * This method may be overridden to customize properties; however,
423
- * when doing so, it's important to call `super.createProperty` to ensure
424
- * the property is setup correctly. This method calls
425
- * `getPropertyDescriptor` internally to get a descriptor to install.
426
- * To customize what properties do when they are get or set, override
427
- * `getPropertyDescriptor`. To customize the options for a property,
428
- * implement `createProperty` like this:
429
- *
430
- * ```ts
431
- * static createProperty(name, options) {
432
- * options = Object.assign(options, {myOption: true});
433
- * super.createProperty(name, options);
434
- * }
435
- * ```
436
- *
437
- * @nocollapse
438
- * @category properties
439
- */
440
- static createProperty(name: PropertyKey, options?: PropertyDeclaration): void;
441
- /**
442
- * Returns a property descriptor to be defined on the given named property.
443
- * If no descriptor is returned, the property will not become an accessor.
444
- * For example,
445
- *
446
- * ```ts
447
- * class MyElement extends LitElement {
448
- * static getPropertyDescriptor(name, key, options) {
449
- * const defaultDescriptor =
450
- * super.getPropertyDescriptor(name, key, options);
451
- * const setter = defaultDescriptor.set;
452
- * return {
453
- * get: defaultDescriptor.get,
454
- * set(value) {
455
- * setter.call(this, value);
456
- * // custom action.
457
- * },
458
- * configurable: true,
459
- * enumerable: true
460
- * }
461
- * }
462
- * }
463
- * ```
464
- *
465
- * @nocollapse
466
- * @category properties
467
- */
468
- protected static getPropertyDescriptor(name: PropertyKey, key: string | symbol, options: PropertyDeclaration): PropertyDescriptor | undefined;
469
- /**
470
- * Returns the property options associated with the given property.
471
- * These options are defined with a `PropertyDeclaration` via the `properties`
472
- * object or the `@property` decorator and are registered in
473
- * `createProperty(...)`.
474
- *
475
- * Note, this method should be considered "final" and not overridden. To
476
- * customize the options for a given property, override
477
- * {@linkcode createProperty}.
478
- *
479
- * @nocollapse
480
- * @final
481
- * @category properties
482
- */
483
- static getPropertyOptions(name: PropertyKey): PropertyDeclaration<unknown, unknown>;
484
- static [Symbol.metadata]: object & Record<PropertyKey, unknown>;
485
- /**
486
- * Initializes static own properties of the class used in bookkeeping
487
- * for element properties, initializers, etc.
488
- *
489
- * Can be called multiple times by code that needs to ensure these
490
- * properties exist before using them.
491
- *
492
- * This method ensures the superclass is finalized so that inherited
493
- * property metadata can be copied down.
494
- * @nocollapse
495
- */
496
- private static __prepare;
497
- /**
498
- * Finishes setting up the class so that it's ready to be registered
499
- * as a custom element and instantiated.
500
- *
501
- * This method is called by the ReactiveElement.observedAttributes getter.
502
- * If you override the observedAttributes getter, you must either call
503
- * super.observedAttributes to trigger finalization, or call finalize()
504
- * yourself.
505
- *
506
- * @nocollapse
507
- */
508
- protected static finalize(): void;
509
- /**
510
- * Options used when calling `attachShadow`. Set this property to customize
511
- * the options for the shadowRoot; for example, to create a closed
512
- * shadowRoot: `{mode: 'closed'}`.
513
- *
514
- * Note, these options are used in `createRenderRoot`. If this method
515
- * is customized, options should be respected if possible.
516
- * @nocollapse
517
- * @category rendering
518
- */
519
- static shadowRootOptions: ShadowRootInit;
520
- /**
521
- * Takes the styles the user supplied via the `static styles` property and
522
- * returns the array of styles to apply to the element.
523
- * Override this method to integrate into a style management system.
524
- *
525
- * Styles are deduplicated preserving the _last_ instance in the list. This
526
- * is a performance optimization to avoid duplicated styles that can occur
527
- * especially when composing via subclassing. The last item is kept to try
528
- * to preserve the cascade order with the assumption that it's most important
529
- * that last added styles override previous styles.
530
- *
531
- * @nocollapse
532
- * @category styles
533
- */
534
- protected static finalizeStyles(styles?: CSSResultGroup): Array<CSSResultOrNative>;
535
- /**
536
- * Node or ShadowRoot into which element DOM should be rendered. Defaults
537
- * to an open shadowRoot.
538
- * @category rendering
539
- */
540
- readonly renderRoot: HTMLElement | DocumentFragment;
541
- /**
542
- * Returns the property name for the given attribute `name`.
543
- * @nocollapse
544
- */
545
- private static __attributeNameForProperty;
546
- private __updatePromise;
547
- /**
548
- * True if there is a pending update as a result of calling `requestUpdate()`.
549
- * Should only be read.
550
- * @category updates
551
- */
552
- isUpdatePending: boolean;
553
- /**
554
- * Is set to `true` after the first update. The element code cannot assume
555
- * that `renderRoot` exists before the element `hasUpdated`.
556
- * @category updates
557
- */
558
- hasUpdated: boolean;
559
- /**
560
- * Properties that should be reflected when updated.
561
- */
562
- private __reflectingProperties?;
563
- /**
564
- * Name of currently reflecting property
565
- */
566
- private __reflectingProperty;
567
- /**
568
- * Set of controllers.
569
- */
570
- private __controllers?;
571
- constructor();
572
- /**
573
- * Internal only override point for customizing work done when elements
574
- * are constructed.
575
- */
576
- private __initialize;
577
- /**
578
- * Registers a `ReactiveController` to participate in the element's reactive
579
- * update cycle. The element automatically calls into any registered
580
- * controllers during its lifecycle callbacks.
581
- *
582
- * If the element is connected when `addController()` is called, the
583
- * controller's `hostConnected()` callback will be immediately called.
584
- * @category controllers
585
- */
586
- addController(controller: ReactiveController): void;
587
- /**
588
- * Removes a `ReactiveController` from the element.
589
- * @category controllers
590
- */
591
- removeController(controller: ReactiveController): void;
592
- /**
593
- * Fixes any properties set on the instance before upgrade time.
594
- * Otherwise these would shadow the accessor and break these properties.
595
- * The properties are stored in a Map which is played back after the
596
- * constructor runs. Note, on very old versions of Safari (<=9) or Chrome
597
- * (<=41), properties created for native platform properties like (`id` or
598
- * `name`) may not have default values set in the element constructor. On
599
- * these browsers native properties appear on instances and therefore their
600
- * default value will overwrite any element default (e.g. if the element sets
601
- * this.id = 'id' in the constructor, the 'id' will become '' since this is
602
- * the native platform default).
603
- */
604
- private __saveInstanceProperties;
605
- /**
606
- * Returns the node into which the element should render and by default
607
- * creates and returns an open shadowRoot. Implement to customize where the
608
- * element's DOM is rendered. For example, to render into the element's
609
- * childNodes, return `this`.
610
- *
611
- * @return Returns a node into which to render.
612
- * @category rendering
613
- */
614
- protected createRenderRoot(): HTMLElement | DocumentFragment;
615
- /**
616
- * On first connection, creates the element's renderRoot, sets up
617
- * element styling, and enables updating.
618
- * @category lifecycle
619
- */
620
- connectedCallback(): void;
621
- /**
622
- * Note, this method should be considered final and not overridden. It is
623
- * overridden on the element instance with a function that triggers the first
624
- * update.
625
- * @category updates
626
- */
627
- protected enableUpdating(_requestedUpdate: boolean): void;
628
- /**
629
- * Allows for `super.disconnectedCallback()` in extensions while
630
- * reserving the possibility of making non-breaking feature additions
631
- * when disconnecting at some point in the future.
632
- * @category lifecycle
633
- */
634
- disconnectedCallback(): void;
635
- /**
636
- * Synchronizes property values when attributes change.
637
- *
638
- * Specifically, when an attribute is set, the corresponding property is set.
639
- * You should rarely need to implement this callback. If this method is
640
- * overridden, `super.attributeChangedCallback(name, _old, value)` must be
641
- * called.
642
- *
643
- * See [using the lifecycle callbacks](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks)
644
- * on MDN for more information about the `attributeChangedCallback`.
645
- * @category attributes
646
- */
647
- attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
648
- private __propertyToAttribute;
649
- /**
650
- * Requests an update which is processed asynchronously. This should be called
651
- * when an element should update based on some state not triggered by setting
652
- * a reactive property. In this case, pass no arguments. It should also be
653
- * called when manually implementing a property setter. In this case, pass the
654
- * property `name` and `oldValue` to ensure that any configured property
655
- * options are honored.
656
- *
657
- * @param name name of requesting property
658
- * @param oldValue old value of requesting property
659
- * @param options property options to use instead of the previously
660
- * configured options
661
- * @category updates
662
- */
663
- requestUpdate(name?: PropertyKey, oldValue?: unknown, options?: PropertyDeclaration): void;
664
- /**
665
- * Sets up the element to asynchronously update.
666
- */
667
- private __enqueueUpdate;
668
- /**
669
- * Schedules an element update. You can override this method to change the
670
- * timing of updates by returning a Promise. The update will await the
671
- * returned Promise, and you should resolve the Promise to allow the update
672
- * to proceed. If this method is overridden, `super.scheduleUpdate()`
673
- * must be called.
674
- *
675
- * For instance, to schedule updates to occur just before the next frame:
676
- *
677
- * ```ts
678
- * override protected async scheduleUpdate(): Promise<unknown> {
679
- * await new Promise((resolve) => requestAnimationFrame(() => resolve()));
680
- * super.scheduleUpdate();
681
- * }
682
- * ```
683
- * @category updates
684
- */
685
- protected scheduleUpdate(): void | Promise<unknown>;
686
- /**
687
- * Performs an element update. Note, if an exception is thrown during the
688
- * update, `firstUpdated` and `updated` will not be called.
689
- *
690
- * Call `performUpdate()` to immediately process a pending update. This should
691
- * generally not be needed, but it can be done in rare cases when you need to
692
- * update synchronously.
693
- *
694
- * @category updates
695
- */
696
- protected performUpdate(): void;
697
- /**
698
- * Invoked before `update()` to compute values needed during the update.
699
- *
700
- * Implement `willUpdate` to compute property values that depend on other
701
- * properties and are used in the rest of the update process.
702
- *
703
- * ```ts
704
- * willUpdate(changedProperties) {
705
- * // only need to check changed properties for an expensive computation.
706
- * if (changedProperties.has('firstName') || changedProperties.has('lastName')) {
707
- * this.sha = computeSHA(`${this.firstName} ${this.lastName}`);
708
- * }
709
- * }
710
- *
711
- * render() {
712
- * return html`SHA: ${this.sha}`;
713
- * }
714
- * ```
715
- *
716
- * @category updates
717
- */
718
- protected willUpdate(_changedProperties: PropertyValues): void;
719
- private __markUpdated;
720
- /**
721
- * Returns a Promise that resolves when the element has completed updating.
722
- * The Promise value is a boolean that is `true` if the element completed the
723
- * update without triggering another update. The Promise result is `false` if
724
- * a property was set inside `updated()`. If the Promise is rejected, an
725
- * exception was thrown during the update.
726
- *
727
- * To await additional asynchronous work, override the `getUpdateComplete`
728
- * method. For example, it is sometimes useful to await a rendered element
729
- * before fulfilling this Promise. To do this, first await
730
- * `super.getUpdateComplete()`, then any subsequent state.
731
- *
732
- * @return A promise of a boolean that resolves to true if the update completed
733
- * without triggering another update.
734
- * @category updates
735
- */
736
- get updateComplete(): Promise<boolean>;
737
- /**
738
- * Override point for the `updateComplete` promise.
739
- *
740
- * It is not safe to override the `updateComplete` getter directly due to a
741
- * limitation in TypeScript which means it is not possible to call a
742
- * superclass getter (e.g. `super.updateComplete.then(...)`) when the target
743
- * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).
744
- * This method should be overridden instead. For example:
745
- *
746
- * ```ts
747
- * class MyElement extends LitElement {
748
- * override async getUpdateComplete() {
749
- * const result = await super.getUpdateComplete();
750
- * await this._myChild.updateComplete;
751
- * return result;
752
- * }
753
- * }
754
- * ```
755
- *
756
- * @return A promise of a boolean that resolves to true if the update completed
757
- * without triggering another update.
758
- * @category updates
759
- */
760
- protected getUpdateComplete(): Promise<boolean>;
761
- /**
762
- * Controls whether or not `update()` should be called when the element requests
763
- * an update. By default, this method always returns `true`, but this can be
764
- * customized to control when to update.
765
- *
766
- * @param _changedProperties Map of changed properties with old values
767
- * @category updates
768
- */
769
- protected shouldUpdate(_changedProperties: PropertyValues): boolean;
770
- /**
771
- * Updates the element. This method reflects property values to attributes.
772
- * It can be overridden to render and keep updated element DOM.
773
- * Setting properties inside this method will *not* trigger
774
- * another update.
775
- *
776
- * @param _changedProperties Map of changed properties with old values
777
- * @category updates
778
- */
779
- protected update(_changedProperties: PropertyValues): void;
780
- /**
781
- * Invoked whenever the element is updated. Implement to perform
782
- * post-updating tasks via DOM APIs, for example, focusing an element.
783
- *
784
- * Setting properties inside this method will trigger the element to update
785
- * again after this update cycle completes.
786
- *
787
- * @param _changedProperties Map of changed properties with old values
788
- * @category updates
789
- */
790
- protected updated(_changedProperties: PropertyValues): void;
791
- /**
792
- * Invoked when the element is first updated. Implement to perform one time
793
- * work on the element after update.
794
- *
795
- * ```ts
796
- * firstUpdated() {
797
- * this.renderRoot.getElementById('my-text-area').focus();
798
- * }
799
- * ```
800
- *
801
- * Setting properties inside this method will trigger the element to update
802
- * again after this update cycle completes.
803
- *
804
- * @param _changedProperties Map of changed properties with old values
805
- * @category updates
806
- */
807
- protected firstUpdated(_changedProperties: PropertyValues): void;
808
- }
809
- declare const HTML_RESULT = 1;
810
- declare const SVG_RESULT = 2;
811
- declare const MATHML_RESULT = 3;
812
- export type ResultType = typeof HTML_RESULT | typeof SVG_RESULT | typeof MATHML_RESULT;
813
- /**
814
- * The return type of the template tag functions, {@linkcode html} and
815
- * {@linkcode svg} when it hasn't been compiled by @lit-labs/compiler.
816
- *
817
- * A `TemplateResult` object holds all the information about a template
818
- * expression required to render it: the template strings, expression values,
819
- * and type of template (html or svg).
820
- *
821
- * `TemplateResult` objects do not create any DOM on their own. To create or
822
- * update DOM you need to render the `TemplateResult`. See
823
- * [Rendering](https://lit.dev/docs/components/rendering) for more information.
824
- *
825
- */
826
- export type UncompiledTemplateResult<T extends ResultType = ResultType> = {
827
- ["_$litType$"]: T;
828
- strings: TemplateStringsArray;
829
- values: unknown[];
830
- };
831
- /**
832
- * The return type of the template tag functions, {@linkcode html} and
833
- * {@linkcode svg}.
834
- *
835
- * A `TemplateResult` object holds all the information about a template
836
- * expression required to render it: the template strings, expression values,
837
- * and type of template (html or svg).
838
- *
839
- * `TemplateResult` objects do not create any DOM on their own. To create or
840
- * update DOM you need to render the `TemplateResult`. See
841
- * [Rendering](https://lit.dev/docs/components/rendering) for more information.
842
- *
843
- * In Lit 4, this type will be an alias of
844
- * MaybeCompiledTemplateResult, so that code will get type errors if it assumes
845
- * that Lit templates are not compiled. When deliberately working with only
846
- * one, use either {@linkcode CompiledTemplateResult} or
847
- * {@linkcode UncompiledTemplateResult} explicitly.
848
- */
849
- export type TemplateResult<T extends ResultType = ResultType> = UncompiledTemplateResult<T>;
850
- export type SVGTemplateResult = TemplateResult<typeof SVG_RESULT>;
851
- declare const nothing: unique symbol;
852
- /**
853
- * Object specifying options for controlling lit-html rendering. Note that
854
- * while `render` may be called multiple times on the same `container` (and
855
- * `renderBefore` reference node) to efficiently update the rendered content,
856
- * only the options passed in during the first render are respected during
857
- * the lifetime of renders to that unique `container` + `renderBefore`
858
- * combination.
859
- */
860
- export interface RenderOptions {
861
- /**
862
- * An object to use as the `this` value for event listeners. It's often
863
- * useful to set this to the host component rendering a template.
864
- */
865
- host?: object;
866
- /**
867
- * A DOM node before which to render content in the container.
868
- */
869
- renderBefore?: ChildNode | null;
870
- /**
871
- * Node used for cloning the template (`importNode` will be called on this
872
- * node). This controls the `ownerDocument` of the rendered DOM, along with
873
- * any inherited context. Defaults to the global `document`.
874
- */
875
- creationScope?: {
876
- importNode(node: Node, deep?: boolean): Node;
877
- };
878
- /**
879
- * The initial connected state for the top-level part being rendered. If no
880
- * `isConnected` option is set, `AsyncDirective`s will be connected by
881
- * default. Set to `false` if the initial render occurs in a disconnected tree
882
- * and `AsyncDirective`s should see `isConnected === false` for their initial
883
- * render. The `part.setConnected()` method must be used subsequent to initial
884
- * render to change the connected state of the part.
885
- */
886
- isConnected?: boolean;
887
- }
888
- /**
889
- * @description Defines the API version that the SDK should use.
890
- * - `"legacy"`: Uses the older API version with existing behaviors.
891
- * - `"2.4"`: Uses the new API version with updated functionalities.
892
- *
893
- * If this value is not set, the SDK will default to the predefined version,
894
- * ensuring backward compatibility.
895
- */
896
- export type APIVersionOption = "legacy" | "2.4";
897
- declare enum ImplementationType {
898
- WEB_REDIRECT = "WEB_REDIRECT",
899
- NATIVE_SDK = "NATIVE_SDK"
900
- }
901
- declare enum ProductType {
902
- DIGITAL = "DIGITAL",
903
- PHYSICAL = "PHYSICAL",
904
- SHIPPING_FEE = "SHIPPING_FEE"
905
- }
906
- export interface ClientSessionLineItem {
907
- amount: number;
908
- description: string;
909
- discountAmount?: number;
910
- itemId: string;
911
- name?: string;
912
- productType?: ProductType;
913
- quantity: number;
914
- taxAmount?: number;
915
- taxCode?: string;
916
- }
917
- export interface ClientSessionShipping {
918
- amount: number;
919
- methodId?: string;
920
- methodName?: string;
921
- methodDescription?: string;
922
- }
923
- export interface ClientSessionFeeItem {
924
- type?: string;
925
- description?: string;
926
- amount: number;
927
- }
928
- export interface ClientSessionAddress {
929
- firstName?: string;
930
- lastName?: string;
931
- addressLine1?: string;
932
- addressLine2?: string;
933
- city?: string;
934
- state?: string;
935
- countryCode?: string;
936
- postalCode?: string;
937
- }
938
- export interface ClientSession {
939
- orderId?: string;
940
- currencyCode?: string;
941
- lineItems?: ClientSessionLineItem[];
942
- totalAmount?: number;
943
- customerId?: string;
944
- orderDetails?: {
945
- countryCode?: string;
946
- shipping?: ClientSessionShipping;
947
- fees?: ClientSessionFeeItem[];
948
- };
949
- customer?: {
950
- emailAddress?: string;
951
- mobileNumber?: string;
952
- firstName?: string;
953
- lastName?: string;
954
- billingAddress?: ClientSessionAddress;
955
- shippingAddress?: ClientSessionAddress;
956
- taxId?: string;
957
- nationalDocumentId?: string;
958
- };
959
- paymentMethod?: {
960
- options?: Record<string, any>;
961
- orderedAllowedCardNetworks?: string[];
962
- vaultOnSuccess?: boolean;
963
- };
964
- }
965
- export interface PaymentMethodDisplayMetadata {
966
- button: {
967
- backgroundColor: BackgroundColor;
968
- borderColor: BorderColor;
969
- borderWidth: BorderWidth;
970
- cornerRadius: number;
971
- iconPositionRelativeToText?: "START" | "END";
972
- iconUrl: IconUrl;
973
- text?: string;
974
- textColor?: TextColor;
975
- };
976
- overlay: {
977
- logo: IconUrl;
978
- backgroundColor: BackgroundColor;
979
- };
980
- popup: {
981
- width: number;
982
- height: number;
983
- };
984
- }
985
- export interface BackgroundColor {
986
- colored: string;
987
- dark: string;
988
- light: string;
989
- }
990
- export interface BorderColor {
991
- dark: string;
992
- light: string;
993
- }
994
- export interface BorderWidth {
995
- colored: number;
996
- dark: number;
997
- light: number;
998
- }
999
- export interface IconUrl {
1000
- colored: string;
1001
- dark: string;
1002
- light: string;
1003
- }
1004
- export interface TextColor {
1005
- dark: string;
1006
- light: string;
1007
- }
1008
- export interface PaymentMethodConfig {
1009
- id: string;
1010
- type: PaymentMethodType;
1011
- name: string;
1012
- implementationType: ImplementationType;
1013
- displayMetadata: PaymentMethodDisplayMetadata;
1014
- options: {
1015
- captureVaultedCardCvv?: boolean;
1016
- clientId?: string;
1017
- threeDSecureToken?: string;
1018
- threeDSecureInitUrl?: string;
1019
- threeDSecureProvider?: string;
1020
- threeDSecureEnabled?: boolean;
1021
- };
1022
- forceRedirect?: boolean;
1023
- }
1024
- export type GoatBrand = {
1025
- assets: {
1026
- icon: string;
1027
- };
1028
- colors: {
1029
- background: string;
1030
- main: string;
1031
- };
1032
- description: string | null;
1033
- is_primer_app: boolean;
1034
- name: string;
1035
- website: string | null;
1036
- };
1037
- export type GoatBrandWithCdn = GoatBrand & {
1038
- /**
1039
- * The full CDN URL that can be used directly in applications
1040
- */
1041
- goatCdnUrl: string;
1042
- };
24
+ export type SdkStateContextType = SdkState | null;
1043
25
  declare const PaymentInstrumentType: {
1044
26
  readonly WORLDPAY_IDEAL: "WORLDPAY_IDEAL";
1045
27
  readonly AUTOMATED_CLEARING_HOUSE: "AUTOMATED_CLEARING_HOUSE";
@@ -1188,179 +170,213 @@ declare const PaymentMethodType: {
1188
170
  readonly ATOME: "ATOME";
1189
171
  };
1190
172
  export type PaymentMethodType = (typeof PaymentMethodType)[keyof typeof PaymentMethodType];
1191
- declare const TokenType: {
1192
- readonly SINGLE_USE: "SINGLE_USE";
1193
- readonly MULTI_USE: "MULTI_USE";
1194
- };
1195
- export type TokenType = (typeof TokenType)[keyof typeof TokenType];
1196
- export type MessageSeverity = "ERROR" | "DEBUG" | "WARN" | "INFO";
1197
- export interface BorderStyle {
1198
- borderStyle?: string;
1199
- borderColor?: number | string;
1200
- borderWidth?: number | string;
1201
- }
1202
- export interface TextAlignmentStyle {
1203
- textAlign?: string;
1204
- }
1205
- export interface TextStyle {
1206
- color?: string;
1207
- fontFamily?: string;
1208
- fontWeight?: string;
1209
- fontSize?: string;
1210
- fontSmoothing?: string;
1211
- lineHeight?: string;
1212
- textTransform?: string;
1213
- letterSpacing?: string;
1214
- }
1215
- export interface BlockStyle extends BorderStyle {
1216
- background?: string;
1217
- borderRadius?: number | string;
1218
- boxShadow?: string;
1219
- }
1220
- export type LogoColor = "DARK" | "LIGHT" | "COLORED";
1221
- export interface LoadingScreenStyle {
1222
- color?: string;
1223
- }
1224
- export interface BaseInputStyle extends TextStyle, BlockStyle {
1225
- height?: number | string;
1226
- paddingHorizontal?: number;
1227
- }
1228
- export interface InputStyle extends BaseInputStyle {
1229
- hover?: BaseInputStyle;
1230
- focus?: BaseInputStyle;
1231
- placeholder?: BaseInputStyle;
1232
- webkitAutofill?: BaseInputStyle;
1233
- selection?: BaseInputStyle;
1234
- }
1235
- export interface BaseSubmitButtonStyle extends TextStyle, BlockStyle {
1236
- }
1237
- export interface SubmitButtonStyle extends BaseSubmitButtonStyle {
1238
- hover?: BaseSubmitButtonStyle;
1239
- focus?: BaseSubmitButtonStyle;
1240
- }
1241
- export interface SubmitButtonStyles {
1242
- base?: SubmitButtonStyle;
1243
- disabled?: SubmitButtonStyle;
1244
- loading?: SubmitButtonStyle;
173
+ export type APIVersionOption = "legacy" | "2.4";
174
+ declare enum HeadlessManagerType {
175
+ CARD = "CARD",
176
+ NATIVE = "NATIVE",
177
+ REDIRECT = "REDIRECT",
178
+ KLARNA = "KLARNA",
179
+ ACH = "ACH"
1245
180
  }
1246
- export interface InputStyles {
1247
- base?: InputStyle;
1248
- error?: InputStyle;
181
+ declare enum EventTypes {
182
+ CHANGE = "change",
183
+ ERROR = "error",
184
+ FOCUS = "focus",
185
+ BLUR = "blur",
186
+ CLICK = "click",
187
+ CLOSE = "close",
188
+ CONFIRMED_KLARNA_CATEGORY = "CONFIRMED_KLARNA_CATEGORY",
189
+ CONFIRMED_KLARNA_CATEGORY_ERROR = "CONFIRMED_KLARNA_CATEGORY_ERROR",
190
+ KLARNA_SESSION_UPDATE = "KLARNA_SESSION_UPDATE",
191
+ KLARNA_SESSION_REFRESH_ERROR = "KLARNA_SESSION_REFRESH_ERROR"
192
+ }
193
+ export interface BasePaymentInstrumentData {
194
+ [key: string]: unknown;
195
+ }
196
+ export interface ClientSessionLineItem {
197
+ amount: number;
198
+ description: string;
199
+ discountAmount?: number;
200
+ itemId: string;
201
+ name?: string;
202
+ productType?: "DIGITAL" | "PHYSICAL" | "SHIPPING_FEE";
203
+ quantity: number;
204
+ taxAmount?: number;
205
+ taxCode?: string;
206
+ }
207
+ export interface ClientSessionShipping {
208
+ amount: number;
209
+ methodId?: string;
210
+ methodName?: string;
211
+ methodDescription?: string;
212
+ }
213
+ export interface ClientSessionFeeItem {
214
+ type?: string;
215
+ description?: string;
216
+ amount: number;
217
+ }
218
+ export interface ClientSessionAddress {
219
+ firstName?: string;
220
+ lastName?: string;
221
+ addressLine1?: string;
222
+ addressLine2?: string;
223
+ city?: string;
224
+ state?: string;
225
+ countryCode?: string;
226
+ postalCode?: string;
227
+ }
228
+ export interface ClientSession {
229
+ orderId?: string;
230
+ currencyCode?: string;
231
+ lineItems?: ClientSessionLineItem[];
232
+ totalAmount?: number;
233
+ customerId?: string;
234
+ orderDetails?: {
235
+ countryCode?: string;
236
+ shipping?: ClientSessionShipping;
237
+ fees?: ClientSessionFeeItem[];
238
+ };
239
+ customer?: {
240
+ emailAddress?: string;
241
+ mobileNumber?: string;
242
+ firstName?: string;
243
+ lastName?: string;
244
+ billingAddress?: ClientSessionAddress;
245
+ shippingAddress?: ClientSessionAddress;
246
+ taxId?: string;
247
+ nationalDocumentId?: string;
248
+ };
249
+ paymentMethod?: {
250
+ options?: Record<string, unknown>;
251
+ orderedAllowedCardNetworks?: string[];
252
+ vaultOnSuccess?: boolean;
253
+ };
254
+ }
255
+ export interface BackgroundColor {
256
+ colored: string;
257
+ dark: string;
258
+ light: string;
1249
259
  }
1250
- export interface BaseSavedPaymentMethodButtonStyle extends TextStyle, BlockStyle {
260
+ export interface IconUrl {
261
+ colored: string;
262
+ dark: string;
263
+ light: string;
1251
264
  }
1252
- export interface SavedPaymentMethodButtonStyle extends BaseSavedPaymentMethodButtonStyle {
1253
- hover?: BaseSavedPaymentMethodButtonStyle;
1254
- focus?: BaseSavedPaymentMethodButtonStyle;
265
+ export interface InputStyles {
266
+ base?: {
267
+ color?: string;
268
+ fontFamily?: string;
269
+ fontSize?: string;
270
+ fontWeight?: string;
271
+ lineHeight?: string;
272
+ letterSpacing?: string;
273
+ textTransform?: string;
274
+ background?: string;
275
+ borderRadius?: number | string;
276
+ borderColor?: string | number;
277
+ borderWidth?: string | number;
278
+ borderStyle?: string;
279
+ boxShadow?: string;
280
+ height?: number | string;
281
+ paddingHorizontal?: number;
282
+ hover?: Record<string, unknown>;
283
+ focus?: Record<string, unknown>;
284
+ placeholder?: Record<string, unknown>;
285
+ webkitAutofill?: Record<string, unknown>;
286
+ selection?: Record<string, unknown>;
287
+ };
288
+ error?: Record<string, unknown>;
1255
289
  }
1256
- export interface SavedPaymentMethodButtonStyles {
1257
- base?: SavedPaymentMethodButtonStyle;
1258
- selected?: SavedPaymentMethodButtonStyle;
290
+ export interface InputValidationError {
291
+ field?: string;
292
+ name: string;
293
+ error: string;
294
+ message: string;
1259
295
  }
1260
- export interface ShowMorePaymentMethodsButtonStyles {
1261
- base?: TextStyle;
1262
- disabled?: TextStyle;
296
+ export interface Validation {
297
+ valid: boolean;
298
+ validationErrors: InputValidationError[];
299
+ error?: string;
1263
300
  }
1264
- export interface DirectDebitMandateStyle {
1265
- header?: TextStyle;
1266
- label?: TextStyle;
1267
- content?: TextStyle;
1268
- creditorDetails?: TextStyle;
301
+ export interface InputMetadata {
302
+ errorCode: string | null;
303
+ error: string | null;
304
+ valid: boolean;
305
+ active: boolean;
306
+ dirty: boolean;
307
+ touched: boolean;
308
+ submitted: boolean;
1269
309
  }
1270
- export interface DirectDebitSuccessStyle {
1271
- icon?: {
1272
- color?: string;
310
+ export interface PaymentMethodConfig {
311
+ id: string;
312
+ type: PaymentMethodType;
313
+ name: string;
314
+ implementationType: "WEB_REDIRECT" | "NATIVE_SDK";
315
+ displayMetadata: {
316
+ button: {
317
+ backgroundColor: BackgroundColor;
318
+ borderColor: {
319
+ dark: string;
320
+ light: string;
321
+ };
322
+ borderWidth: {
323
+ colored: number;
324
+ dark: number;
325
+ light: number;
326
+ };
327
+ cornerRadius: number;
328
+ iconPositionRelativeToText?: "START" | "END";
329
+ iconUrl: IconUrl;
330
+ text?: string;
331
+ textColor?: {
332
+ dark: string;
333
+ light: string;
334
+ };
335
+ };
336
+ overlay: {
337
+ logo: IconUrl;
338
+ backgroundColor: BackgroundColor;
339
+ };
340
+ popup: {
341
+ width: number;
342
+ height: number;
343
+ };
1273
344
  };
1274
- }
1275
- export interface PaymentMethodButtonStyle extends BlockStyle {
1276
- height?: number;
1277
- minHeight?: number;
1278
- maxHeight?: number;
1279
- primaryText?: TextStyle;
1280
- logoColor?: LogoColor;
1281
- marginTop?: string;
1282
- }
1283
- export interface BackButtonStyle {
1284
- color?: string;
1285
- }
1286
- export interface EditButtonStyle {
1287
- color?: string;
1288
- background?: string;
1289
- }
1290
- export interface SeparatorStyle {
1291
- color?: string;
1292
- }
1293
- export interface ErrorMessageStyle extends BlockStyle, TextStyle {
1294
- color?: string;
1295
- }
1296
- export interface FormSpacings {
1297
- betweenLabelAndInput?: string;
1298
- betweenInputs?: string;
1299
- }
1300
- export interface FontFace$1 {
1301
- fontFamily?: string;
1302
- src?: string;
1303
- unicodeRange?: string;
1304
- fontVariant?: string;
1305
- fontFeatureSettings?: string;
1306
- fontVariationSettings?: string;
1307
- fontStretch?: string;
1308
- fontWeight?: string;
1309
- fontStyle?: string;
1310
- }
1311
- export interface Stylesheet {
1312
- href: string;
1313
- }
1314
- export interface VaultMenuStyle {
1315
- editButton?: EditButtonStyle & TextStyle;
1316
- item?: {
1317
- label?: TextStyle;
1318
- actionButton?: TextStyle;
1319
- confirmButton?: BlockStyle & TextStyle;
345
+ options: {
346
+ captureVaultedCardCvv?: boolean;
347
+ clientId?: string;
348
+ threeDSecureToken?: string;
349
+ threeDSecureInitUrl?: string;
350
+ threeDSecureProvider?: string;
351
+ threeDSecureEnabled?: boolean;
1320
352
  };
353
+ forceRedirect?: boolean;
1321
354
  }
1322
- export interface NetworkErrorStyles {
1323
- button?: {
1324
- base: BlockStyle & TextStyle;
1325
- };
355
+ export interface PaymentMethodInfo {
356
+ type: PaymentMethodType;
357
+ managerType: HeadlessManagerType;
1326
358
  }
1327
- export interface ProcessingIndicatorStyle {
1328
- color?: string;
359
+ export type CardNetworkType = "american-express" | "diners-club" | "discover" | "elo" | "hiper" | "hipercard" | "interac" | "jcb" | "maestro" | "mastercard" | "mir" | "unionpay" | "private-label" | "visa";
360
+ export interface CardNetworkDetails {
361
+ displayName: string;
362
+ network: string;
363
+ allowed: boolean;
1329
364
  }
1330
- export interface CheckoutStyle {
1331
- fontFaces?: Array<FontFace$1>;
1332
- stylesheets?: Array<Stylesheet>;
1333
- loadingScreen?: LoadingScreenStyle;
1334
- input?: InputStyles;
1335
- inputLabel?: TextStyle;
1336
- inputErrorText?: TextStyle & TextAlignmentStyle;
1337
- formSpacings?: FormSpacings;
1338
- showMorePaymentMethodsButton?: ShowMorePaymentMethodsButtonStyles;
1339
- networkError?: NetworkErrorStyles;
1340
- submitButton?: SubmitButtonStyles;
1341
- vaultTitle?: TextStyle;
1342
- savedPaymentMethodButton?: SavedPaymentMethodButtonStyles;
1343
- paymentMethodButton?: PaymentMethodButtonStyle;
1344
- errorMessage?: ErrorMessageStyle;
1345
- smallPrint?: TextStyle;
1346
- directDebit?: {
1347
- mandate?: DirectDebitMandateStyle;
1348
- success?: DirectDebitSuccessStyle;
365
+ export interface CardNetworkChangeEvent {
366
+ detectedCardNetworks: {
367
+ items: CardNetworkDetails[];
368
+ preferred?: CardNetworkDetails;
1349
369
  };
1350
- vaultMenu?: VaultMenuStyle;
1351
- backButton?: BackButtonStyle;
1352
- separator?: SeparatorStyle;
1353
- processingIndicator?: ProcessingIndicatorStyle;
1354
- focusCheckoutOnInit?: boolean;
1355
- }
1356
- declare enum CheckoutUXFlow {
1357
- CHECKOUT = "CHECKOUT",
1358
- HEADLESS_CHECKOUT = "HEADLESS_CHECKOUT",
1359
- MANAGE_PAYMENT_METHODS = "MANAGE_PAYMENT_METHODS"
370
+ selectableCardNetworks?: {
371
+ items: CardNetworkDetails[];
372
+ preferred?: CardNetworkDetails;
373
+ };
374
+ source: "REMOTE" | "LOCAL" | "LOCAL_FALLBACK";
1360
375
  }
1361
- export interface BasePaymentInstrumentData {
1362
- [key: string]: unknown;
376
+ export interface CardPaymentMethodSubmitValues {
377
+ cardNetwork?: string;
1363
378
  }
379
+ export type CardPreferredFlow = "DEDICATED_SCENE" | "EMBEDDED_IN_HOME";
1364
380
  export interface PaymentCardInstrumentData extends BasePaymentInstrumentData {
1365
381
  last4Digits: string;
1366
382
  first6Digits: string;
@@ -1439,600 +455,117 @@ export type PayPalVaultedMethod = IVaultedPaymentMethod<PayPalInstrumentData, ty
1439
455
  export type KlarnaVaultedMethod = IVaultedPaymentMethod<KlarnaInstrumentData, typeof PaymentInstrumentType.KLARNA_CUSTOMER_TOKEN, typeof PaymentMethodType.KLARNA>;
1440
456
  export type ACHVaultedMethod = IVaultedPaymentMethod<ACHInstrumentData, typeof PaymentInstrumentType.AUTOMATED_CLEARING_HOUSE, typeof PaymentMethodType.STRIPE_ACH>;
1441
457
  export type VaultedPaymentMethod = PaymentCardVaultedMethod | PayPalVaultedMethod | KlarnaVaultedMethod | ACHVaultedMethod | IVaultedPaymentMethod;
1442
- export type SecureInputOptions = {
458
+ export interface CardSecurityCodeInputOptions {
1443
459
  ariaLabel?: string;
1444
460
  container: string | Element | HTMLElement;
1445
461
  id?: string;
1446
- name: string;
1447
- placeholder?: string;
1448
- placement?: "append" | "prepend";
1449
- properties?: any;
1450
- style?: CheckoutStyle;
1451
- allowedCharactersMap?: Record<string, string>;
1452
- };
1453
- export type SecureInputListener = (...args: unknown[]) => void;
1454
- export type CardSecurityCodeInputOptions = Omit<SecureInputOptions, "allowedCharactersMap" | "name"> & {
1455
- cardNetwork?: string;
1456
- name?: string;
1457
- };
1458
- export type CvvInput = {
1459
- frame: HTMLIFrameElement | null;
1460
- readonly metadata: {
1461
- readonly errorCode: string | null;
1462
- readonly error: string | null;
1463
- readonly valid: boolean;
1464
- readonly active: boolean;
1465
- readonly dirty: boolean;
1466
- readonly touched: boolean;
1467
- readonly submitted: boolean;
1468
- };
1469
- focus(): void;
1470
- blur(): void;
1471
- addListener(event: "change" | "blur" | "focus", listener: SecureInputListener): (() => void) | undefined;
1472
- addEventListener(event: "change" | "blur" | "focus", listener: SecureInputListener): (() => void) | undefined;
1473
- removeListener(event: "change" | "blur" | "focus", listener: SecureInputListener): void;
1474
- name: string;
1475
- valueToken: string;
1476
- remove: () => void;
1477
- };
1478
- export type CvvInputOptions = CardSecurityCodeInputOptions;
1479
- export interface HeadlessVaultManager {
1480
- fetchVaultedPaymentMethods(): Promise<VaultedPaymentMethod[]>;
1481
- deleteVaultedPaymentMethod(id: string): Promise<void>;
1482
- startPaymentFlow(id: string, data?: {
1483
- cvv?: string;
1484
- }): Promise<void>;
1485
- createCvvInput(options: CvvInputOptions): Promise<CvvInput | null>;
1486
- }
1487
- declare enum PaymentFlow {
1488
- DEFAULT = "DEFAULT",
1489
- PREFER_VAULT = "PREFER_VAULT"
1490
- }
1491
- declare enum ThreeDSecureStatus {
1492
- SUCCESS = "AUTH_SUCCESS",
1493
- FAILED = "AUTH_FAILED",
1494
- SKIPPED = "SKIPPED",
1495
- CHALLENGE = "CHALLENGE"
1496
- }
1497
- declare enum ErrorCode {
1498
- INITIALIZATION_ERROR = "INITIALIZATION_ERROR",
1499
- NO_PAYMENT_METHODS = "NO_PAYMENT_METHODS",
1500
- PRIMER_TEARDOWN = "PRIMER_TEARDOWN",
1501
- PRIMER_SERVER_ERROR = "PRIMER_SERVER_ERROR",
1502
- THREE_DS_AUTH_FAILED = "THREE_DS_AUTH_FAILED",
1503
- TOKENIZATION_ERROR = "TOKENIZATION_ERROR",
1504
- DUPLICATE_PAYMENT_METHOD_ERROR = "DUPLICATE_PAYMENT_METHOD_ERROR",
1505
- CARD_NUMBER_ERROR = "CARD_NUMBER_ERROR",
1506
- PAYMENT_METHOD_NOT_SETUP = "PAYMENT_METHOD_NOT_SETUP",
1507
- PAYMENT_METHOD_NOT_PROVIDED = "PAYMENT_METHOD_NOT_PROVIDED",
1508
- PAYMENT_METHOD_NOT_COMPATIBLE = "PAYMENT_METHOD_NOT_COMPATIBLE",
1509
- RESUME_ERROR = "RESUME_ERROR",
1510
- VALIDATION_ERROR = "VALIDATION_ERROR",
1511
- PAYMENT_FAILED = "PAYMENT_FAILED",
1512
- PAYMENT_CREATION_ABORTED = "PAYMENT_CREATION_ABORTED",
1513
- PAYMENT_CREATION_DISABLED = "PAYMENT_CREATION_DISABLED",
1514
- CLIENT_SESSION_UPDATE_ERROR = "CLIENT_SESSION_UPDATE_ERROR",
1515
- INVALID_ARGUMENT = "INVALID_ARGUMENT",
1516
- VAULT_FETCH = "VAULT_FETCH",
1517
- VAULT_DELETE = "VAULT_DELETE",
1518
- HEADLESS_VAULT_MANAGER_VALIDATION = "HEADLESS_VAULT_MANAGER_VALIDATION",
1519
- CARD_FORM_VALIDATION_UNEXPECTED_FIELD = "CARD_FORM_VALIDATION_UNEXPECTED_FIELD",
1520
- MISSING_FIRST_NAME_OR_LAST_NAME = "MISSING_FIRST_NAME_OR_LAST_NAME",
1521
- MISSING_EMAIL_ADDRESS = "MISSING_EMAIL_ADDRESS",
1522
- INVALID_FLOW = "INVALID_FLOW"
1523
- }
1524
- declare class SDKError extends Error {
1525
- isReported: boolean;
1526
- constructor(message: string, isReported?: boolean);
1527
- static from(error: unknown, isReported?: boolean): SDKError;
1528
- markAsReported(): void;
1529
- }
1530
- export interface ErrorOptions$1<T = any> {
1531
- message: string;
1532
- diagnosticsId?: string;
1533
- severity?: MessageSeverity;
1534
- errorId?: string;
1535
- data?: T;
1536
- isFromDeveloper?: boolean;
1537
- }
1538
- declare class PrimerClientError<T = any> extends SDKError {
1539
- readonly code: ErrorCode;
1540
- readonly diagnosticsId: string | null;
1541
- readonly data?: T;
1542
- readonly isFromDeveloper: boolean;
1543
- static fromErrorCode(code: ErrorCode, options: ErrorOptions$1): PrimerClientError;
1544
- constructor(code: ErrorCode, options: ErrorOptions$1<T>);
1545
- }
1546
- export interface CardMetadata {
1547
- /** @deprecated Use onCardNetworksChange instead. */
1548
- type: CardNetwork$1 | null;
1549
- /** @deprecated Use onCardNetworksChange instead. */
1550
- possibleTypes: string[];
1551
- cvvLength: number;
1552
- cardNumberLength: number;
1553
- }
1554
- export interface PositionalConfig {
1555
- container: string | Element;
1556
- }
1557
- export interface ApplePayOptions extends PositionalConfig {
1558
- buttonType?: "plain" | "buy" | "set-up" | "donate" | "check-out" | "book" | "subscribe";
1559
- buttonStyle?: "white" | "white-outline" | "black";
1560
- /**
1561
- * @deprecated Add `postalAddress` to `billingOptions.requiredBillingContactFields` instead.
1562
- */
1563
- captureBillingAddress?: boolean;
1564
- billingOptions?: ApplePayBillingOptions;
1565
- shippingOptions?: ApplePayShippingOptions;
1566
- }
1567
- export interface ApplePayBillingOptions {
1568
- requiredBillingContactFields?: RequiredContactFields[];
1569
- }
1570
- export interface ApplePayShippingOptions {
1571
- requiredShippingContactFields?: RequiredContactFields[];
1572
- requireShippingMethod?: boolean;
1573
- }
1574
- export type RequiredContactFields = "emailAddress" | "name" | "phoneNumber" | "postalAddress" | "phoneticName";
1575
- export interface DirectDebitOptions {
1576
- customerCountryCode: Alpha2CountryCode;
1577
- companyName: string;
1578
- companyAddress: string;
1579
- customerName?: string;
1580
- customerEmail?: string;
1581
- customerAddressLine1?: string;
1582
- customerAddressLine2?: string;
1583
- customerCity?: string;
1584
- customerPostalCode?: string;
1585
- iban?: string;
1586
- submitButtonLabels?: {
1587
- form?: Label;
1588
- mandate: Label;
1589
- };
1590
- }
1591
- export type GooglePayButtonType =
1592
- /** @deprecated Set buttonSizeMode to fill instead */
1593
- "long"
1594
- /** @deprecated Set buttonSizeMode to static instead */
1595
- | "short" | "book" | "buy" | "checkout" | "donate" | "order" | "pay" | "plain" | "subscribe";
1596
- export type GooglePayButtonColor = "default" | "black" | "white";
1597
- export type GooglePayButtonSizeMode = "fill" | "static";
1598
- export interface GooglePayShippingAddressParameters {
1599
- phoneNumberRequired?: boolean;
1600
- }
1601
- export interface GooglePayOptions extends PositionalConfig {
1602
- buttonType?: GooglePayButtonType;
1603
- buttonColor?: GooglePayButtonColor;
1604
- buttonSizeMode?: GooglePayButtonSizeMode;
1605
- onClick?: () => void;
1606
- captureBillingAddress?: boolean;
1607
- shippingAddressParameters?: GooglePayShippingAddressParameters;
1608
- emailRequired?: boolean;
1609
- requireShippingMethod?: boolean;
1610
- shadowRoot?: boolean;
1611
- }
1612
- export interface PayPalOptions extends PositionalConfig {
1613
- buttonColor?: "gold" | "blue" | "silver" | "white" | "black";
1614
- buttonShape?: "pill" | "rect";
1615
- buttonSize?: "small" | "medium" | "large" | "responsive";
1616
- buttonHeight?: number;
1617
- buttonLabel?: "checkout" | "credit" | "pay" | "buynow" | "paypal" | "installment";
1618
- buttonTagline?: boolean;
1619
- paymentFlow?: PaymentFlow;
1620
- onClick?: () => void;
1621
- }
1622
- export interface SubmitButtonOptions {
1623
- amountVisible?: boolean;
1624
- useBuiltInButton?: boolean;
1625
- onVisible?: (isVisible: boolean, context: {
1626
- currentSceneId: string;
1627
- previousSceneId?: string;
1628
- }) => void;
1629
- onContentChange?: (content: string, context: {
1630
- currentSceneId: string;
1631
- }) => void;
1632
- onDisable?: (isDisabled: boolean, context: {
1633
- currentSceneId: string;
1634
- }) => void;
1635
- onLoading?: (isLoading: boolean, context: {
1636
- currentSceneId: string;
1637
- }) => void;
1638
- }
1639
- export interface ProcessingIndicatorOptions {
1640
- visible?: boolean;
1641
- }
1642
- export interface FormOptions {
1643
- inputLabelsVisible?: boolean;
1644
- }
1645
- export type CardPreferredFlow = "DEDICATED_SCENE" | "EMBEDDED_IN_HOME";
1646
- export interface CheckoutCardOptions {
1647
- cardholderName?: {
1648
- /**
1649
- * Only works if the cardholder name is visible
1650
- */
1651
- required?: boolean;
1652
- /**
1653
- * @deprecated Set it on your Dashboard
1654
- */
1655
- visible?: boolean;
1656
- placeholder?: Label;
1657
- };
1658
- cardNumber?: {
1659
- placeholder?: Label;
1660
- };
1661
- expiryDate?: {
1662
- placeholder?: Label;
1663
- };
1664
- cvv?: {
1665
- placeholder?: Label;
1666
- };
1667
- preferredFlow?: CardPreferredFlow;
1668
- }
1669
- export interface ErrorMessageOptions {
1670
- disabled?: boolean;
1671
- onErrorMessageShow?: (message: string) => void;
1672
- onErrorMessageHide?: () => void;
1673
- }
1674
- declare enum SuccessScreenType {
1675
- PAYMENT_METHOD = "PAYMENT_METHOD",
1676
- CHECK = "CHECK"
1677
- }
1678
- export interface StripeAchCustomerDetails {
1679
- emailAddress: string;
1680
- firstName: string;
1681
- lastName: string;
1682
- }
1683
- export interface StripeOptions {
1684
- publishableKey: string;
1685
- }
1686
- export interface StripeOptionsDropInWithFullMandateText extends StripeOptions {
1687
- mandateData: {
1688
- fullMandateText: string;
1689
- merchantName?: never;
1690
- };
1691
- }
1692
- export interface StripeOptionsDropInTextProvidedByPrimer extends StripeOptions {
1693
- mandateData: {
1694
- merchantName: string;
1695
- fullMandateText?: never;
1696
- };
1697
- }
1698
- export type StripeOptionsDropIn = StripeOptionsDropInWithFullMandateText | StripeOptionsDropInTextProvidedByPrimer;
1699
- type CardNetwork$1 = "american-express" | "diners-club" | "discover" | "elo" | "hiper" | "hipercard" | "interac" | "jcb" | "maestro" | "mastercard" | "mir" | "unionpay" | "private-label" | "visa";
1700
- export interface CustomizablePaymentMethodButton {
1701
- logoSrc: string;
1702
- background: string;
1703
- logoAlt?: string;
1704
- text?: string;
1705
- }
1706
- export type KlarnaPaymentCategoryType = "pay_now" | "pay_later" | "pay_over_time";
1707
- export interface KlarnaButtonOptions {
1708
- text?: string;
1709
- }
1710
- export interface AdyenKlarnaOptions {
1711
- buttonOptions?: KlarnaButtonOptions;
1712
- }
1713
- export interface KlarnaOptions {
1714
- paymentFlow?: PaymentFlow;
1715
- recurringPaymentDescription?: string;
1716
- allowedPaymentCategories?: KlarnaPaymentCategoryType[];
1717
- buttonOptions?: KlarnaButtonOptions;
1718
- }
1719
- export type SupportedLocale = string;
1720
- export type Alpha2CountryCode = string;
1721
- export type Alpha3CurrencyCode = string;
1722
- export type Label<T extends Record<string, unknown> = Record<string, unknown>> = string | ((options: {
1723
- locale: SupportedLocale;
1724
- } | T) => string);
1725
- export type ResumeToken = {
1726
- resumeToken: string;
1727
- paymentId?: string;
1728
- };
1729
- export interface InputValidationError {
1730
- field?: string;
1731
- name: string;
1732
- error: string;
1733
- message: string;
1734
- }
1735
- export interface Validation {
1736
- valid: boolean;
1737
- validationErrors: InputValidationError[];
1738
- error?: string;
1739
- }
1740
- export interface InputMetadata {
1741
- errorCode: string | null;
1742
- error: string | null;
1743
- valid: boolean;
1744
- active: boolean;
1745
- dirty: boolean;
1746
- touched: boolean;
1747
- submitted: boolean;
1748
- }
1749
- export interface ExternalPayerInfo {
1750
- externalPayerId: string;
1751
- firstName?: string;
1752
- lastName?: string;
1753
- email?: string;
1754
- }
1755
- export interface CustomerAddress {
1756
- firstName?: string;
1757
- lastName?: string;
1758
- addressLine1?: string;
1759
- addressLine2?: string;
1760
- addressLine3?: string;
1761
- city?: string;
1762
- state?: string;
1763
- countryCode?: Alpha2CountryCode;
1764
- postalCode?: string;
1765
- }
1766
- export interface MonetaryAmount {
1767
- value: number | string;
1768
- currency: Alpha3CurrencyCode;
1769
- }
1770
- export interface ThreeDSecureOrderDetails {
1771
- amount: MonetaryAmount;
1772
- email: string;
1773
- billingAddress: CustomerAddress;
1774
- orderId: string;
1775
- }
1776
- export interface ThreeDSVerificationOptions {
1777
- token: string;
1778
- container: string;
1779
- order: ThreeDSecureOrderDetails;
1780
- testScenario?: string;
1781
- onChallengeStart?: () => void;
1782
- onChallengeEnd?: () => void;
1783
- }
1784
- export interface ThreeDSAuthenticationData {
1785
- responseCode: ThreeDSecureStatus;
1786
- reasonCode?: string;
1787
- reasonText?: string;
1788
- protocolVersion: string;
1789
- challengeIssued: boolean;
1790
- }
1791
- export interface VaultData {
1792
- customerId: string;
1793
- }
1794
- export type PaymentCardDetails = {
1795
- last4Digits: string;
1796
- cardholderName: string;
1797
- network: string;
1798
- };
1799
- export type PayPalBillingAgreementDetails = {
1800
- paypalBillingAgreementId: string;
1801
- externalPayerInfo?: ExternalPayerInfo;
1802
- shippingAddress?: CustomerAddress;
1803
- };
1804
- export type GoCardlessDetails = {
1805
- gocardlessMandateId: string;
1806
- };
1807
- export type BasePaymentInstrumentData$1 = Record<string, unknown>;
1808
- export interface IPaymentMethodToken<T extends BasePaymentInstrumentData$1 = BasePaymentInstrumentData$1, U extends PaymentInstrumentType = PaymentInstrumentType> {
1809
- token: string;
1810
- analyticsId: string;
1811
- tokenType: TokenType;
1812
- paymentInstrumentData: T;
1813
- paymentInstrumentType: U;
1814
- threeDSecureAuthentication: ThreeDSAuthenticationData | null;
1815
- vaultData: VaultData | null;
1816
- }
1817
- export type UnknownPaymentMethodToken = IPaymentMethodToken<BasePaymentInstrumentData$1, PaymentInstrumentType>;
1818
- export type PaymentCardToken = IPaymentMethodToken<PaymentCardDetails, typeof PaymentInstrumentType.CARD>;
1819
- export type PayPalBillingAgreementToken = IPaymentMethodToken<PayPalBillingAgreementDetails, typeof PaymentInstrumentType.PAYPAL_VAULTED>;
1820
- export type GoCardlessToken = IPaymentMethodToken<GoCardlessDetails, typeof PaymentInstrumentType.GO_CARDLESS>;
1821
- export type IdealPayToken = IPaymentMethodToken<Record<string, never>, typeof PaymentInstrumentType.PAY_NL_IDEAL>;
1822
- export type PaymentMethodToken = PaymentCardToken | PayPalBillingAgreementToken | GoCardlessToken | IdealPayToken | UnknownPaymentMethodToken;
1823
- export type CheckSuccessScreenOptions = {
1824
- type: SuccessScreenType.CHECK;
1825
- title: Label;
1826
- };
1827
- export type PaymentMethodSuccessScreenOptions = {
1828
- type: SuccessScreenType.PAYMENT_METHOD;
1829
- };
1830
- export type SuccessScreenOptions = /* No success screen will be displayed */ false | /* Show the default success screen of the payment method*/ undefined | CheckSuccessScreenOptions | PaymentMethodSuccessScreenOptions;
1831
- export type VaultOptions = {
1832
- visible?: boolean;
1833
- deletionDisabled?: boolean;
1834
- };
1835
- export type TransitionType = "SLIDE_UP" | "SLIDE_DOWN" | "SLIDE_HORIZONTAL";
1836
- export type SceneTransitionOptions = {
1837
- type: TransitionType;
1838
- duration: number;
1839
- isRtlLocale?: boolean;
1840
- };
1841
- export type SceneOptions = {
1842
- onEntering?: (sceneId: string) => void;
1843
- transition?: SceneTransitionOptions | false;
1844
- };
1845
- export type RedirectOptions = {
1846
- returnUrl?: string;
1847
- /**
1848
- * default: false
1849
- */
1850
- forceRedirect?: boolean;
1851
- };
1852
- export type AdvancedOptions = {
1853
- platform?: "STANDALONE" | "MAGENTO";
1854
- };
1855
- export type PaymentMethodAction = "PAYMENT_METHOD_SELECTED" | "PAYMENT_METHOD_UNSELECTED";
1856
- export type PaymentHandling = "AUTO" | "MANUAL";
1857
- export type PaymentMethodData$1 = AdyenMultibancoPaymentData;
1858
- export type AdyenMultibancoPaymentData = {
1859
- paymentMethodType: typeof PaymentMethodType.ADYEN_MULTIBANCO;
1860
- reference: string;
1861
- expiresAt: string;
1862
- entity: string;
1863
- };
1864
- export type Payment = {
1865
- id: string;
1866
- orderId: string;
1867
- paymentMethodData?: PaymentMethodData$1;
1868
- };
1869
- export interface onBeforePaymentCreateHandler {
1870
- continuePaymentCreation: () => void;
1871
- abortPaymentCreation: () => void;
1872
- }
1873
- export interface OnCheckoutFailHandler {
1874
- showErrorMessage: (errorMessage?: string) => void;
1875
- }
1876
- export interface PaymentHandlers {
1877
- onBeforePaymentCreate?: (data: {
1878
- paymentMethodType?: PaymentMethodType;
1879
- }, handler: onBeforePaymentCreateHandler) => void;
1880
- onPaymentCreationStart?: () => void;
1881
- onCheckoutComplete?: (data: {
1882
- payment: Payment | null;
1883
- }) => void;
1884
- onCheckoutFail?: (error: PrimerClientError, data: {
1885
- payment?: Payment;
1886
- }, handler: OnCheckoutFailHandler | undefined) => void;
1887
- }
1888
- export type OnTokenizeShouldStart = (data: {
1889
- paymentMethodType?: PaymentMethodType;
1890
- }) => boolean | Promise<boolean>;
1891
- export type OnTokenizeDidNotStart = (reason: string) => void;
1892
- export type OnTokenizeStart = () => void;
1893
- export type OnTokenizeError = (error: PrimerClientError) => void;
1894
- export interface OnTokenizeSuccessHandler {
1895
- handleSuccess(): any;
1896
- handleFailure(errorMessage?: string): any;
1897
- continueWithNewClientToken(clientToken: string): any;
1898
- }
1899
- export type OnTokenizeSuccess = (data: PaymentMethodToken, handler: OnTokenizeSuccessHandler) => void | Promise<void>;
1900
- export interface OnResumeSuccessHandler {
1901
- handleSuccess(): any;
1902
- handleFailure(errorMessage?: string): any;
1903
- continueWithNewClientToken(clientToken: string): any;
1904
- }
1905
- export type OnResumeSuccess = (data: ResumeToken, handler: OnResumeSuccessHandler) => void;
1906
- export type onResumeError = (error: PrimerClientError) => void;
1907
- export type OnResumePending = (paymentMethodData: PaymentMethodData$1) => void;
1908
- export interface TokenizationHandlers {
1909
- onTokenizeShouldStart?: OnTokenizeShouldStart;
1910
- onTokenizeDidNotStart?: OnTokenizeDidNotStart;
1911
- onTokenizeStart?: OnTokenizeStart;
1912
- onTokenizeSuccess?: OnTokenizeSuccess;
1913
- onTokenizeError?: OnTokenizeError;
1914
- onResumeSuccess?: OnResumeSuccess;
1915
- onResumePending?: OnResumePending;
1916
- onResumeError?: onResumeError;
1917
- }
1918
- export interface PaymentMethodHandlers {
1919
- onPaymentMethodAction?: (paymentMethodAction: PaymentMethodAction, { paymentMethodType, }: {
1920
- paymentMethodType: PaymentMethodType | string | null;
1921
- }) => void;
462
+ name?: string;
463
+ placeholder?: string;
464
+ placement?: "append" | "prepend";
465
+ properties?: unknown;
466
+ style?: CheckoutStyle;
467
+ cardNetwork?: string;
1922
468
  }
1923
- export interface ClientSessionHandlers {
1924
- onClientSessionUpdate?: (clientSession: ClientSession) => void;
1925
- onBeforeClientSessionUpdate?: () => void;
469
+ export interface CvvInput {
470
+ frame: HTMLIFrameElement | null;
471
+ readonly metadata: {
472
+ readonly errorCode: string | null;
473
+ readonly error: string | null;
474
+ readonly valid: boolean;
475
+ readonly active: boolean;
476
+ readonly dirty: boolean;
477
+ readonly touched: boolean;
478
+ readonly submitted: boolean;
479
+ };
480
+ focus(): void;
481
+ blur(): void;
482
+ addListener(event: "change" | "blur" | "focus", listener: (...args: unknown[]) => void): (() => void) | undefined;
483
+ addEventListener(event: "change" | "blur" | "focus", listener: (...args: unknown[]) => void): (() => void) | undefined;
484
+ removeListener(event: "change" | "blur" | "focus", listener: (...args: unknown[]) => void): void;
485
+ name: string;
486
+ valueToken: string;
487
+ remove: () => void;
1926
488
  }
1927
- export interface VaultManagerOptions extends WithAllowedCardNetworks {
1928
- uxFlow?: CheckoutUXFlow.MANAGE_PAYMENT_METHODS;
1929
- container: string | Element;
1930
- locale?: SupportedLocale;
1931
- vaultOnly?: boolean;
1932
- deletionDisabled?: boolean;
1933
- style?: CheckoutStyle;
1934
- scene?: SceneOptions;
1935
- errorMessage?: ErrorMessageOptions;
1936
- form?: FormOptions;
1937
- submitButton?: SubmitButtonOptions;
1938
- processingIndicator?: ProcessingIndicatorOptions;
1939
- card?: CheckoutCardOptions;
1940
- threeDSecure?: ThreeDSVerificationOptions;
1941
- giftCard?: CustomizablePaymentMethodButton;
1942
- googlePay?: Omit<GooglePayOptions, "container">;
1943
- directDebit?: DirectDebitOptions;
1944
- stripe?: StripeOptionsDropIn;
1945
- paypal?: Omit<PayPalOptions, "container">;
1946
- onTokenizeShouldStart?: OnTokenizeShouldStart;
1947
- onTokenizeDidNotStart?: OnTokenizeDidNotStart;
1948
- onTokenizeStart?: () => void;
1949
- onTokenizeSuccess?: (data: PaymentMethodToken) => void;
1950
- onTokenizeError?: (message: PrimerClientError) => void;
1951
- apiVersion?: APIVersionOption;
489
+ export interface Payment {
490
+ id: string;
491
+ orderId: string;
492
+ paymentMethodData?: {
493
+ paymentMethodType: PaymentMethodType;
494
+ reference?: string;
495
+ expiresAt?: string;
496
+ entity?: string;
497
+ };
1952
498
  }
1953
- export interface UniversalCheckoutOptions extends TokenizationHandlers, PaymentHandlers, PaymentMethodHandlers, ClientSessionHandlers, WithAllowedCardNetworks {
1954
- uxFlow?: CheckoutUXFlow.CHECKOUT;
1955
- container: string | Element;
1956
- locale?: SupportedLocale;
1957
- style?: CheckoutStyle;
1958
- scene?: SceneOptions;
1959
- vault?: VaultOptions;
1960
- submitButton?: SubmitButtonOptions;
1961
- processingIndicator?: ProcessingIndicatorOptions;
1962
- errorMessage?: ErrorMessageOptions;
1963
- successScreen?: SuccessScreenOptions;
1964
- form?: FormOptions;
1965
- allowedPaymentMethods?: PaymentMethodType[];
1966
- card?: CheckoutCardOptions;
1967
- redirect?: RedirectOptions;
1968
- paypal?: Omit<PayPalOptions, "container">;
1969
- googlePay?: Omit<GooglePayOptions, "container">;
1970
- applePay?: Omit<ApplePayOptions, "container">;
1971
- adyenKlarna?: AdyenKlarnaOptions;
1972
- klarna?: KlarnaOptions;
1973
- directDebit?: DirectDebitOptions;
1974
- giftCard?: CustomizablePaymentMethodButton;
1975
- stripe?: StripeOptionsDropIn;
1976
- paymentHandling?: PaymentHandling;
1977
- advanced?: AdvancedOptions;
1978
- clientSessionCachingEnabled?: boolean;
1979
- apiVersion?: APIVersionOption;
499
+ export interface KlarnaPaymentMethodCategory {
500
+ id: string;
501
+ name: string;
502
+ descriptiveAssetUrl: string;
503
+ standardAssetUrl: string;
1980
504
  }
1981
- export interface HeadlessUniversalCheckoutOptions extends TokenizationHandlers, PaymentHandlers, PaymentMethodHandlers, ClientSessionHandlers, WithAllowedCardNetworks {
1982
- style?: CheckoutStyle;
1983
- paymentHandling?: PaymentHandling;
1984
- locale?: SupportedLocale;
1985
- card?: CheckoutCardOptions;
1986
- redirect?: RedirectOptions;
1987
- paypal?: Omit<PayPalOptions, "container">;
1988
- googlePay?: Omit<GooglePayOptions, "container">;
1989
- applePay?: Omit<ApplePayOptions, "container">;
1990
- adyenKlarna?: AdyenKlarnaOptions;
1991
- klarna?: KlarnaOptions;
1992
- directDebit?: DirectDebitOptions;
1993
- giftCard?: CustomizablePaymentMethodButton;
1994
- stripe?: StripeOptions;
1995
- onAvailablePaymentMethodsLoad: (paymentMethods: PaymentMethodInfo[]) => void;
1996
- clientSessionCachingEnabled?: boolean;
1997
- apiVersion?: APIVersionOption;
505
+ export interface StripeAchCustomerDetails {
506
+ emailAddress: string;
507
+ firstName: string;
508
+ lastName: string;
1998
509
  }
1999
- export type WithAllowedCardNetworks = {
2000
- /** @deprecated Use `orderedAllowedCardNetworks` on your Primer Dashboard instead. */
2001
- allowedCardNetworks?: CardNetwork$1[];
2002
- };
2003
- export interface PrimerCheckout {
2004
- teardown(): void;
2005
- submit(): void;
2006
- setPaymentCreationEnabled(isEnabled: boolean): void;
2007
- setTokenizationEnabled(isEnabled: boolean): void;
2008
- refreshClientSession(): Promise<boolean>;
2009
- /**
2010
- * @deprecated The method should not be used
2011
- */
2012
- setClientToken(): Promise<boolean>;
510
+ export interface PrimerClientErrorOptions<T = unknown> {
511
+ message: string;
512
+ diagnosticsId?: string;
513
+ severity?: "ERROR" | "DEBUG" | "WARN" | "INFO";
514
+ errorId?: string;
515
+ data?: T;
516
+ isFromDeveloper?: boolean;
2013
517
  }
2014
- export type EventListener$1 = (event?: Event) => void;
2015
- declare enum EventTypes {
2016
- CHANGE = "change",
2017
- ERROR = "error",
2018
- FOCUS = "focus",
2019
- BLUR = "blur",
2020
- CLICK = "click",
2021
- CLOSE = "close",
2022
- CONFIRMED_KLARNA_CATEGORY = "CONFIRMED_KLARNA_CATEGORY",
2023
- CONFIRMED_KLARNA_CATEGORY_ERROR = "CONFIRMED_KLARNA_CATEGORY_ERROR",
2024
- KLARNA_SESSION_UPDATE = "KLARNA_SESSION_UPDATE",
2025
- KLARNA_SESSION_REFRESH_ERROR = "KLARNA_SESSION_REFRESH_ERROR"
518
+ declare enum ErrorCode {
519
+ INITIALIZATION_ERROR = "INITIALIZATION_ERROR",
520
+ NO_PAYMENT_METHODS = "NO_PAYMENT_METHODS",
521
+ PRIMER_TEARDOWN = "PRIMER_TEARDOWN",
522
+ PRIMER_SERVER_ERROR = "PRIMER_SERVER_ERROR",
523
+ THREE_DS_AUTH_FAILED = "THREE_DS_AUTH_FAILED",
524
+ TOKENIZATION_ERROR = "TOKENIZATION_ERROR",
525
+ DUPLICATE_PAYMENT_METHOD_ERROR = "DUPLICATE_PAYMENT_METHOD_ERROR",
526
+ CARD_NUMBER_ERROR = "CARD_NUMBER_ERROR",
527
+ PAYMENT_METHOD_NOT_SETUP = "PAYMENT_METHOD_NOT_SETUP",
528
+ PAYMENT_METHOD_NOT_PROVIDED = "PAYMENT_METHOD_NOT_PROVIDED",
529
+ PAYMENT_METHOD_NOT_COMPATIBLE = "PAYMENT_METHOD_NOT_COMPATIBLE",
530
+ RESUME_ERROR = "RESUME_ERROR",
531
+ VALIDATION_ERROR = "VALIDATION_ERROR",
532
+ PAYMENT_FAILED = "PAYMENT_FAILED",
533
+ PAYMENT_CREATION_ABORTED = "PAYMENT_CREATION_ABORTED",
534
+ PAYMENT_CREATION_DISABLED = "PAYMENT_CREATION_DISABLED",
535
+ CLIENT_SESSION_UPDATE_ERROR = "CLIENT_SESSION_UPDATE_ERROR",
536
+ INVALID_ARGUMENT = "INVALID_ARGUMENT",
537
+ VAULT_FETCH = "VAULT_FETCH",
538
+ VAULT_DELETE = "VAULT_DELETE",
539
+ HEADLESS_VAULT_MANAGER_VALIDATION = "HEADLESS_VAULT_MANAGER_VALIDATION",
540
+ CARD_FORM_VALIDATION_UNEXPECTED_FIELD = "CARD_FORM_VALIDATION_UNEXPECTED_FIELD",
541
+ MISSING_FIRST_NAME_OR_LAST_NAME = "MISSING_FIRST_NAME_OR_LAST_NAME",
542
+ MISSING_EMAIL_ADDRESS = "MISSING_EMAIL_ADDRESS",
543
+ INVALID_FLOW = "INVALID_FLOW"
2026
544
  }
2027
- export interface HeadlessHostedInputOptions {
2028
- placeholder?: string;
2029
- ariaLabel?: string;
2030
- style?: CheckoutStyle;
545
+ declare class PrimerClientError<T = unknown> extends Error {
546
+ readonly code: ErrorCode;
547
+ readonly diagnosticsId: string | null;
548
+ readonly data?: T;
549
+ readonly isFromDeveloper: boolean;
550
+ constructor(code: ErrorCode, options: PrimerClientErrorOptions<T>);
551
+ static fromErrorCode(code: ErrorCode, options: PrimerClientErrorOptions): PrimerClientError;
2031
552
  }
2032
553
  export interface IHeadlessHostedInput {
2033
- getOptions(): HeadlessHostedInputOptions;
2034
- setOptions(options: HeadlessHostedInputOptions): void;
2035
- render(container: string | Element | null, options: HeadlessHostedInputOptions): Promise<void>;
554
+ getOptions(): {
555
+ placeholder?: string;
556
+ ariaLabel?: string;
557
+ style?: CheckoutStyle;
558
+ };
559
+ setOptions(options: {
560
+ placeholder?: string;
561
+ ariaLabel?: string;
562
+ style?: CheckoutStyle;
563
+ }): void;
564
+ render(container: string | Element | null, options: {
565
+ placeholder?: string;
566
+ ariaLabel?: string;
567
+ style?: CheckoutStyle;
568
+ }): Promise<void>;
2036
569
  addEventListener(event: EventTypes, callback: EventListener$1): void;
2037
570
  focus(): void;
2038
571
  blur(): void;
@@ -2050,32 +583,10 @@ export interface ICardPaymentMethodManager {
2050
583
  validate(): Promise<Validation>;
2051
584
  reset(): void;
2052
585
  }
2053
- export type CardPaymentMethodSubmitValues = {
2054
- cardNetwork?: string;
2055
- };
2056
- export interface PayPalStyles {
2057
- buttonColor?: "gold" | "blue" | "silver" | "white" | "black";
2058
- buttonShape?: "pill" | "rect";
2059
- buttonSize?: "small" | "medium" | "large" | "responsive";
2060
- buttonHeight?: number;
2061
- buttonLabel?: "checkout" | "credit" | "pay" | "buynow" | "paypal" | "installment";
2062
- buttonTagline?: boolean;
2063
- }
2064
- export interface GooglePayStyles {
2065
- buttonType?: "long" | "short";
2066
- buttonColor?: "default" | "black" | "white";
2067
- shadowRoot?: boolean;
2068
- }
2069
- export interface ApplePayStyles {
2070
- buttonType?: "plain" | "buy" | "set-up" | "donate" | "check-out" | "book" | "subscribe";
2071
- buttonHeight?: number;
2072
- buttonStyle?: "white" | "white-outline" | "black";
2073
- }
2074
- export interface HeadlessButtonRenderOptions {
2075
- style?: GooglePayStyles | PayPalStyles | ApplePayStyles | Record<string, unknown>;
2076
- }
2077
586
  export interface IHeadlessPaymentMethodButton {
2078
- render(containerId: string | Element, options: HeadlessButtonRenderOptions): Promise<void>;
587
+ render(containerId: string | Element, options: {
588
+ style?: Record<string, unknown>;
589
+ }): Promise<void>;
2079
590
  setDisabled(disabled: boolean): Promise<void>;
2080
591
  clean(): void;
2081
592
  focus(): void;
@@ -2090,8 +601,16 @@ export interface IRedirectPaymentMethodManager {
2090
601
  addEventListener(event: EventTypes, callback: EventListener$1): void;
2091
602
  }
2092
603
  export interface IKlarnaPaymentMethodManager {
2093
- start(paymentPayload: KlarnaPaymentPayload): Promise<KlarnaPaymentResponse>;
2094
- renderCategory(renderCategoryDetails: RenderCategoryDetails): Promise<void>;
604
+ start(paymentPayload: {
605
+ paymentMethodCategoryId: string;
606
+ }): Promise<{
607
+ outcome: "APPROVED" | "DENIED";
608
+ }>;
609
+ renderCategory(renderCategoryDetails: {
610
+ containerId: string | Element;
611
+ paymentMethodCategoryId: string;
612
+ onHeightChange: (height: number) => void;
613
+ }): Promise<void>;
2095
614
  addEventListener(event: EventTypes, callback: EventListener$1): void;
2096
615
  getPaymentMethod(): void;
2097
616
  }
@@ -2103,70 +622,59 @@ export interface IAchPaymentMethodManager {
2103
622
  declineMandate(): Promise<void>;
2104
623
  getPaymentMethod(): void;
2105
624
  }
2106
- declare enum HeadlessManagerType {
2107
- CARD = "CARD",
2108
- NATIVE = "NATIVE",
2109
- REDIRECT = "REDIRECT",
2110
- KLARNA = "KLARNA",
2111
- ACH = "ACH"
625
+ export interface HeadlessVaultManager {
626
+ fetchVaultedPaymentMethods(): Promise<VaultedPaymentMethod[]>;
627
+ deleteVaultedPaymentMethod(id: string): Promise<void>;
628
+ startPaymentFlow(id: string, data?: {
629
+ cvv?: string;
630
+ }): Promise<void>;
631
+ createCvvInput(options: CardSecurityCodeInputOptions): Promise<CvvInput | null>;
2112
632
  }
2113
- export type PaymentMethodInfo = {
2114
- type: PaymentMethodType;
2115
- managerType: HeadlessManagerType;
2116
- };
2117
- export type ButtonPaymentMethodAsset = {
2118
- backgroundColor: BackgroundColor;
2119
- iconUrl: IconUrl;
2120
- /**
2121
- * @deprecated The property should not be used. Please use displayName or buttonText instead
2122
- */
2123
- paymentMethodName?: string;
2124
- buttonText?: string;
2125
- displayName?: string;
2126
- };
2127
633
  export interface IAssetsManager {
2128
- getCardNetworkAsset(cardNetwork: string): Promise<CardNetworkAsset>;
2129
- getPaymentMethodAsset(type: PaymentMethodType): Promise<ButtonPaymentMethodAsset | null>;
634
+ getCardNetworkAsset(cardNetwork: string): Promise<{
635
+ cardUrl: string;
636
+ displayName: string;
637
+ }>;
638
+ getPaymentMethodAsset(type: PaymentMethodType): Promise<{
639
+ backgroundColor: BackgroundColor;
640
+ iconUrl: IconUrl;
641
+ paymentMethodName?: string;
642
+ buttonText?: string;
643
+ displayName?: string;
644
+ } | null>;
645
+ }
646
+ export interface HeadlessSDKUtilities {
647
+ getCardNetworkAsset(network: string): {
648
+ cardUrl: string;
649
+ displayName: string;
650
+ };
651
+ getUIOrderAmount(): string | null;
652
+ getCDNAssets(paymentMethodType: PaymentMethodType): Promise<{
653
+ assets: {
654
+ icon: string;
655
+ };
656
+ colors: {
657
+ background: string;
658
+ main: string;
659
+ };
660
+ description: string | null;
661
+ is_primer_app: boolean;
662
+ name: string;
663
+ website: string | null;
664
+ goatCdnUrl: string;
665
+ } | undefined>;
666
+ getPaymentMethodConfiguration(paymentMethodType: PaymentMethodType): PaymentMethodConfig | undefined;
2130
667
  }
2131
- export type CardNetworkAsset = {
2132
- cardUrl: string;
2133
- displayName: string;
2134
- };
2135
668
  export interface CardPaymentMethodManagerOptions {
2136
- /** @deprecated Use onCardNetworksChange instead. */
2137
- onCardMetadataChange?: (metadata: CardMetadata) => void;
669
+ onCardMetadataChange?: (metadata: {
670
+ type: CardNetworkType | null;
671
+ possibleTypes: string[];
672
+ cvvLength: number;
673
+ cardNumberLength: number;
674
+ }) => void;
2138
675
  onCardNetworksChange?: (event: CardNetworkChangeEvent) => void;
2139
676
  onCardNetworksLoading?: () => void;
2140
677
  }
2141
- export type CardNetworkChangeEvent = {
2142
- detectedCardNetworks: CardNetworks;
2143
- selectableCardNetworks?: CardNetworks;
2144
- source: "REMOTE" | "LOCAL" | "LOCAL_FALLBACK";
2145
- };
2146
- export type CardNetworks = {
2147
- items: CardNetworkDetails[];
2148
- preferred?: CardNetworkDetails;
2149
- };
2150
- export type CardNetworkDetails = CardNetworkInfo & {
2151
- allowed: boolean;
2152
- };
2153
- export type CardNetworkInfo = {
2154
- displayName: string;
2155
- network: string;
2156
- };
2157
- export type BankIssuer = {
2158
- id: string;
2159
- name: string;
2160
- iconUrl: string;
2161
- disabled: boolean;
2162
- };
2163
- export interface FormWithRedirectConfiguration {
2164
- bankIssuers?: BankIssuer[];
2165
- error?: PrimerClientError | Error;
2166
- }
2167
- export interface FormWithRedirectPaymentMethodManagerOptions {
2168
- onConfigurationLoad?: (payload: FormWithRedirectConfiguration) => void;
2169
- }
2170
678
  export interface KlarnaPaymentMethodManagerOptions {
2171
679
  onPaymentMethodCategoriesChange?: (paymentMethodCategories: KlarnaPaymentMethodCategory[]) => void;
2172
680
  onPaymentMethodAction?: (action: string, data: {
@@ -2177,33 +685,58 @@ export interface KlarnaPaymentMethodManagerOptions {
2177
685
  export interface AchPaymentMethodManagerOptions {
2178
686
  onCollectBankAccountDetailsComplete?: () => void;
2179
687
  }
2180
- export type KlarnaPaymentMethodCategory = {
2181
- id: string;
2182
- name: string;
2183
- descriptiveAssetUrl: string;
2184
- standardAssetUrl: string;
2185
- };
2186
- export type KlarnaPaymentPayload = {
2187
- paymentMethodCategoryId: string;
2188
- };
2189
- export type KlarnaPaymentResponse = {
2190
- outcome: "APPROVED" | "DENIED";
2191
- };
2192
- export type RenderCategoryDetails = {
2193
- containerId: string | Element;
2194
- paymentMethodCategoryId: string;
2195
- onHeightChange: (height: number) => void;
2196
- };
2197
- export interface HeadlessSDKUtilities {
2198
- getCardNetworkAsset(network: string): {
2199
- cardUrl: string;
2200
- displayName: string;
688
+ export type PaymentMethodManagerOptions = CardPaymentMethodManagerOptions | KlarnaPaymentMethodManagerOptions | AchPaymentMethodManagerOptions;
689
+ export interface CheckoutStyle {
690
+ fontFaces?: Array<{
691
+ fontFamily?: string;
692
+ src?: string;
693
+ unicodeRange?: string;
694
+ fontVariant?: string;
695
+ fontFeatureSettings?: string;
696
+ fontVariationSettings?: string;
697
+ fontStretch?: string;
698
+ fontWeight?: string;
699
+ fontStyle?: string;
700
+ }>;
701
+ stylesheets?: Array<{
702
+ href: string;
703
+ }>;
704
+ loadingScreen?: {
705
+ color?: string;
2201
706
  };
2202
- getUIOrderAmount(): string | null;
2203
- getCDNAssets(paymentMethodType: PaymentMethodType): Promise<GoatBrandWithCdn | undefined>;
2204
- getPaymentMethodConfiguration(paymentMethodType: PaymentMethodType): PaymentMethodConfig | undefined;
707
+ input?: InputStyles;
708
+ inputLabel?: Record<string, unknown>;
709
+ inputErrorText?: Record<string, unknown>;
710
+ formSpacings?: {
711
+ betweenLabelAndInput?: string;
712
+ betweenInputs?: string;
713
+ };
714
+ showMorePaymentMethodsButton?: Record<string, unknown>;
715
+ networkError?: Record<string, unknown>;
716
+ submitButton?: Record<string, unknown>;
717
+ vaultTitle?: Record<string, unknown>;
718
+ savedPaymentMethodButton?: Record<string, unknown>;
719
+ paymentMethodButton?: Record<string, unknown>;
720
+ errorMessage?: Record<string, unknown>;
721
+ smallPrint?: Record<string, unknown>;
722
+ directDebit?: Record<string, unknown>;
723
+ vaultMenu?: Record<string, unknown>;
724
+ backButton?: Record<string, unknown>;
725
+ separator?: Record<string, unknown>;
726
+ processingIndicator?: Record<string, unknown>;
727
+ focusCheckoutOnInit?: boolean;
728
+ }
729
+ export interface ThreeDSAuthenticationData {
730
+ responseCode: "AUTH_SUCCESS" | "AUTH_FAILED" | "SKIPPED" | "CHALLENGE";
731
+ reasonCode?: string;
732
+ reasonText?: string;
733
+ protocolVersion: string;
734
+ challengeIssued: boolean;
735
+ }
736
+ export interface VaultData {
737
+ customerId: string;
2205
738
  }
2206
- export type PaymentMethodManagerOptions = CardPaymentMethodManagerOptions | FormWithRedirectPaymentMethodManagerOptions | KlarnaPaymentMethodManagerOptions;
739
+ type EventListener$1 = (event?: Event) => void;
2207
740
  export interface PrimerHeadlessCheckout {
2208
741
  createPaymentMethodManager(type: "PAYMENT_CARD", options?: PaymentMethodManagerOptions): Promise<ICardPaymentMethodManager | null>;
2209
742
  createPaymentMethodManager(type: "PAYPAL" | "GOOGLE_PAY" | "APPLE_PAY", options?: PaymentMethodManagerOptions): Promise<INativePaymentMethodManager | null>;
@@ -2212,173 +745,280 @@ export interface PrimerHeadlessCheckout {
2212
745
  createPaymentMethodManager(type: PaymentMethodType, options?: PaymentMethodManagerOptions): Promise<IRedirectPaymentMethodManager | null>;
2213
746
  createVaultManager(): HeadlessVaultManager;
2214
747
  getSDKUtilities(): HeadlessSDKUtilities;
2215
- /**
2216
- * @deprecated
2217
- * The options should be set on the `createHeadless` second parameter instead:
2218
- * ```
2219
- * Primer.createHeadless('clientToken', options);
2220
- * ```
2221
- */
2222
748
  configure: (options: Omit<HeadlessUniversalCheckoutOptions, "clientSessionCachingEnabled">) => void;
2223
749
  getAssetsManager(): IAssetsManager;
2224
750
  start: () => Promise<void>;
2225
751
  refreshClientSession(): Promise<boolean>;
2226
752
  }
2227
- export interface PrimerVaultManager {
2228
- teardown(): void;
2229
- submit(): void;
753
+ export interface HeadlessUniversalCheckoutOptions {
754
+ style?: CheckoutStyle;
755
+ paymentHandling?: "AUTO" | "MANUAL";
756
+ locale?: string;
757
+ card?: {
758
+ cardholderName?: {
759
+ required?: boolean;
760
+ visible?: boolean;
761
+ placeholder?: string;
762
+ };
763
+ cardNumber?: {
764
+ placeholder?: string;
765
+ };
766
+ expiryDate?: {
767
+ placeholder?: string;
768
+ };
769
+ cvv?: {
770
+ placeholder?: string;
771
+ };
772
+ preferredFlow?: CardPreferredFlow;
773
+ };
774
+ redirect?: {
775
+ returnUrl?: string;
776
+ forceRedirect?: boolean;
777
+ };
778
+ paypal?: PayPalOptions;
779
+ googlePay?: GooglePayOptions;
780
+ applePay?: ApplePayOptions;
781
+ adyenKlarna?: {
782
+ buttonOptions?: {
783
+ text?: string;
784
+ };
785
+ };
786
+ klarna?: KlarnaOptions;
787
+ directDebit?: {
788
+ customerCountryCode: string;
789
+ companyName: string;
790
+ companyAddress: string;
791
+ customerName?: string;
792
+ customerEmail?: string;
793
+ customerAddressLine1?: string;
794
+ customerAddressLine2?: string;
795
+ customerCity?: string;
796
+ customerPostalCode?: string;
797
+ iban?: string;
798
+ submitButtonLabels?: {
799
+ form?: string;
800
+ mandate: string;
801
+ };
802
+ };
803
+ giftCard?: {
804
+ logoSrc: string;
805
+ background: string;
806
+ logoAlt?: string;
807
+ text?: string;
808
+ };
809
+ stripe?: {
810
+ publishableKey?: string;
811
+ mandateData?: {
812
+ fullMandateText?: string;
813
+ merchantName?: string;
814
+ };
815
+ } & Record<string, unknown>;
816
+ onAvailablePaymentMethodsLoad: (paymentMethods: PaymentMethodInfo[]) => void;
817
+ clientSessionCachingEnabled?: boolean;
818
+ apiVersion?: APIVersionOption;
819
+ onCheckoutComplete?: (data: {
820
+ payment: Payment | null;
821
+ }) => void;
822
+ onCheckoutFail?: (error: PrimerClientError, data: {
823
+ payment?: Payment;
824
+ }, handler?: {
825
+ showErrorMessage: (errorMessage?: string) => void;
826
+ }) => void;
827
+ onBeforePaymentCreate?: (data: {
828
+ paymentMethodType?: PaymentMethodType;
829
+ }, handler: {
830
+ continuePaymentCreation: () => void;
831
+ abortPaymentCreation: () => void;
832
+ }) => void;
833
+ onPaymentCreationStart?: () => void;
834
+ onPaymentMethodAction?: (data: "PAYMENT_METHOD_SELECTED" | "PAYMENT_METHOD_UNSELECTED", handler: {
835
+ paymentMethodType: PaymentMethodType | null;
836
+ }) => void;
837
+ onClientSessionUpdate?: (clientSession: ClientSession) => void;
838
+ onBeforeClientSessionUpdate?: () => void;
839
+ onTokenizeShouldStart?: (data: {
840
+ paymentMethodType?: PaymentMethodType;
841
+ }) => boolean | Promise<boolean>;
842
+ onTokenizeDidNotStart?: (reason: string) => void;
843
+ onTokenizeStart?: () => void;
844
+ onTokenizeSuccess?: (data: PaymentMethodToken, handler: {
845
+ handleSuccess(): unknown;
846
+ handleFailure(errorMessage?: string): unknown;
847
+ continueWithNewClientToken(clientToken: string): unknown;
848
+ }) => void | Promise<void>;
849
+ onTokenizeError?: (error: PrimerClientError) => void;
850
+ onResumeSuccess?: (data: {
851
+ resumeToken: string;
852
+ paymentId?: string;
853
+ }, handler: {
854
+ handleSuccess(): unknown;
855
+ handleFailure(errorMessage?: string): unknown;
856
+ continueWithNewClientToken(clientToken: string): unknown;
857
+ }) => void;
858
+ onResumePending?: (paymentMethodData: {
859
+ paymentMethodType: PaymentMethodType;
860
+ reference?: string;
861
+ expiresAt?: string;
862
+ entity?: string;
863
+ }) => void;
864
+ onResumeError?: (error: PrimerClientError) => void;
865
+ }
866
+ export interface PaymentMethodToken {
867
+ token: string;
868
+ analyticsId: string;
869
+ tokenType: "SINGLE_USE" | "MULTI_USE";
870
+ paymentInstrumentData: BasePaymentInstrumentData;
871
+ paymentInstrumentType: PaymentInstrumentType;
872
+ threeDSecureAuthentication: ThreeDSAuthenticationData | null;
873
+ vaultData: VaultData | null;
874
+ }
875
+ export interface ApplePayOptions {
876
+ container?: string | Element;
877
+ buttonType?: "plain" | "buy" | "set-up" | "donate" | "check-out" | "book" | "subscribe";
878
+ buttonStyle?: "white" | "white-outline" | "black";
879
+ captureBillingAddress?: boolean;
880
+ billingOptions?: {
881
+ requiredBillingContactFields?: Array<"emailAddress" | "name" | "phoneNumber" | "postalAddress" | "phoneticName">;
882
+ };
883
+ shippingOptions?: {
884
+ requiredShippingContactFields?: Array<"emailAddress" | "name" | "phoneNumber" | "postalAddress" | "phoneticName">;
885
+ requireShippingMethod?: boolean;
886
+ };
887
+ }
888
+ export interface GooglePayOptions {
889
+ container?: string | Element;
890
+ buttonType?: "long" | "short" | "book" | "buy" | "checkout" | "donate" | "order" | "pay" | "plain" | "subscribe";
891
+ buttonColor?: "default" | "black" | "white";
892
+ buttonSizeMode?: "fill" | "static";
893
+ onClick?: () => void;
894
+ captureBillingAddress?: boolean;
895
+ shippingAddressParameters?: {
896
+ phoneNumberRequired?: boolean;
897
+ };
898
+ emailRequired?: boolean;
899
+ requireShippingMethod?: boolean;
900
+ shadowRoot?: boolean;
2230
901
  }
2231
- declare const Primer: {
2232
- SDK_VERSION: string;
2233
- createHeadless: (clientToken: string, options?: HeadlessUniversalCheckoutOptions | undefined) => Promise<Promise<PrimerHeadlessCheckout>>;
2234
- showUniversalCheckout: (clientToken: string, options?: UniversalCheckoutOptions | undefined) => Promise<Promise<PrimerCheckout>>;
2235
- showVaultManager: (clientToken: string, options?: VaultManagerOptions | undefined) => Promise<Promise<PrimerVaultManager>>;
2236
- preloadPrimer: () => Promise<void>;
2237
- };
2238
- export type JSONSafe<T> = T extends (...args: any[]) => any ? never : T extends symbol ? never : T extends bigint ? never : T extends Array<infer U> ? JSONSafe<U>[] : T extends object ? {
2239
- [K in keyof T as JSONSafe<T[K]> extends never ? never : K]: JSONSafe<T[K]>;
2240
- } : T;
2241
- export type PrimerCheckoutOptions = JSONSafe<HeadlessUniversalCheckoutOptions> & {
902
+ export interface PayPalOptions {
903
+ container?: string | Element;
904
+ buttonColor?: "gold" | "blue" | "silver" | "white" | "black";
905
+ buttonShape?: "pill" | "rect";
906
+ buttonSize?: "small" | "medium" | "large" | "responsive";
907
+ buttonHeight?: number;
908
+ buttonLabel?: "checkout" | "credit" | "pay" | "buynow" | "paypal" | "installment";
909
+ buttonTagline?: boolean;
910
+ paymentFlow?: "DEFAULT" | "PREFER_VAULT";
911
+ onClick?: () => void;
912
+ }
913
+ export interface KlarnaOptions {
914
+ paymentFlow?: "DEFAULT" | "PREFER_VAULT";
915
+ recurringPaymentDescription?: string;
916
+ allowedPaymentCategories?: Array<"pay_now" | "pay_later" | "pay_over_time">;
917
+ buttonOptions?: {
918
+ text?: string;
919
+ };
920
+ }
921
+ /**
922
+ * PrimerCheckoutOptions defines the configuration options for the Primer checkout.
923
+ * This is an explicit definition of the options rather than a mapped type to make
924
+ * the type more predictable and easier to maintain.
925
+ */
926
+ export interface PrimerCheckoutOptions {
927
+ clientToken?: string;
928
+ locale?: string;
929
+ apiVersion?: APIVersionOption;
930
+ card?: {
931
+ cardholderName?: {
932
+ required?: boolean;
933
+ };
934
+ };
935
+ applePay?: Omit<ApplePayOptions, "container"> & {
936
+ captureBillingAddress?: boolean;
937
+ billingOptions?: {
938
+ requiredBillingContactFields?: Array<"emailAddress" | "name" | "phoneNumber" | "postalAddress" | "phoneticName">;
939
+ };
940
+ shippingOptions?: {
941
+ requiredShippingContactFields?: Array<"emailAddress" | "name" | "phoneNumber" | "postalAddress" | "phoneticName">;
942
+ requireShippingMethod?: boolean;
943
+ };
944
+ };
945
+ googlePay?: Omit<GooglePayOptions, "container">;
946
+ paypal?: Omit<PayPalOptions, "container">;
947
+ klarna?: KlarnaOptions;
948
+ threeDsOptions?: {
949
+ enabled?: boolean;
950
+ preferred?: boolean;
951
+ };
2242
952
  vault?: {
2243
953
  enabled: boolean;
954
+ showEmptyState?: boolean;
2244
955
  };
956
+ stripe?: {
957
+ mandateData: {
958
+ fullMandateText?: string;
959
+ merchantName?: string;
960
+ };
961
+ publishableKey?: string;
962
+ } & Record<string, unknown>;
2245
963
  submitButton?: {
2246
964
  amountVisible?: boolean;
2247
965
  };
2248
- stripe?: UniversalCheckoutOptions["stripe"];
2249
- };
2250
- declare global {
2251
- interface Window {
2252
- Primer: typeof Primer;
2253
- }
966
+ sdkCore?: boolean;
967
+ disabledPayments?: boolean;
2254
968
  }
2255
- declare const PaymentMethodType$1: {
2256
- readonly WORLDPAY_IDEAL: "WORLDPAY_IDEAL";
2257
- readonly STRIPE_ACH: "STRIPE_ACH";
2258
- readonly STRIPE_IDEAL: "STRIPE_IDEAL";
2259
- readonly ADYEN_KLARNA: "ADYEN_KLARNA";
2260
- readonly ADYEN_BANCONTACT_CARD: "ADYEN_BANCONTACT_CARD";
2261
- readonly PAY_NL_KAARTDIRECT: "PAY_NL_KAARTDIRECT";
2262
- readonly ADYEN_EPS: "ADYEN_EPS";
2263
- readonly ADYEN_BANCONTACT_PAYCONIQ: "ADYEN_BANCONTACT_PAYCONIQ";
2264
- readonly OMISE_PROMPTPAY: "OMISE_PROMPTPAY";
2265
- readonly OMISE_TRUEMONEY: "OMISE_TRUEMONEY";
2266
- readonly ADYEN_MULTIBANCO: "ADYEN_MULTIBANCO";
2267
- readonly PACYPAY_WECHAT: "PACYPAY_WECHAT";
2268
- readonly PACYPAY_ALIPAY: "PACYPAY_ALIPAY";
2269
- readonly ADYEN_MBWAY: "ADYEN_MBWAY";
2270
- readonly XENDIT_DANA: "XENDIT_DANA";
2271
- readonly XENDIT_SHOPEEPAY: "XENDIT_SHOPEEPAY";
2272
- readonly ADYEN_PAYSHOP: "ADYEN_PAYSHOP";
2273
- readonly ADYEN_PAYTRAIL: "ADYEN_PAYTRAIL";
2274
- readonly CLEARPAY: "CLEARPAY";
2275
- readonly RAPYD_FAST: "RAPYD_FAST";
2276
- readonly RAPYD_PROMPTPAY: "RAPYD_PROMPTPAY";
2277
- readonly RAPYD_GCASH: "RAPYD_GCASH";
2278
- readonly RAPYD_POLI: "RAPYD_POLI";
2279
- readonly RAPYD_GRABPAY: "RAPYD_GRABPAY";
2280
- readonly PRIMER_PAYPAL: "PRIMER_PAYPAL";
2281
- readonly TWOC2P: "TWOC2P";
2282
- readonly NETS: "NETS";
2283
- readonly STRIPE_GIROPAY: "STRIPE_GIROPAY";
2284
- readonly MOLLIE_GIROPAY: "MOLLIE_GIROPAY";
2285
- readonly MOLLIE_EPS: "MOLLIE_EPS";
2286
- readonly PAY_NL_EPS: "PAY_NL_EPS";
2287
- readonly PAY_NL_P24: "PAY_NL_P24";
2288
- readonly MOLLIE_P24: "MOLLIE_P24";
2289
- readonly MOLLIE_SOFORT: "MOLLIE_SOFORT";
2290
- readonly COINBASE: "COINBASE";
2291
- readonly OPENNODE: "OPENNODE";
2292
- readonly MOLLIE_GIFT_CARD: "MOLLIE_GIFTCARD";
2293
- readonly XFERS_PAYNOW: "XFERS_PAYNOW";
2294
- readonly PAYMENT_CARD: "PAYMENT_CARD";
2295
- readonly APPLE_PAY: "APPLE_PAY";
2296
- readonly GOOGLE_PAY: "GOOGLE_PAY";
2297
- readonly PAYPAL: "PAYPAL";
2298
- readonly GO_CARDLESS: "GOCARDLESS";
2299
- readonly KLARNA: "KLARNA";
2300
- readonly PAY_NL_IDEAL: "PAY_NL_IDEAL";
2301
- readonly PAY_NL_SOFORT_BANKING: "PAY_NL_SOFORT_BANKING";
2302
- readonly PAY_NL_BANCONTACT: "PAY_NL_BANCONTACT";
2303
- readonly PAY_NL_PAYPAL: "PAY_NL_PAYPAL";
2304
- readonly PAY_NL_CREDIT_TRANSFER: "PAY_NL_CREDIT_TRANSFER";
2305
- readonly PAY_NL_DIRECT_DEBIT: "PAY_NL_DIRECT_DEBIT";
2306
- readonly PAY_NL_GIROPAY: "PAY_NL_GIROPAY";
2307
- readonly PAY_NL_PAYCONIQ: "PAY_NL_PAYCONIQ";
2308
- readonly HOOLAH: "HOOLAH";
2309
- readonly ADYEN_BLIK: "ADYEN_BLIK";
2310
- readonly ADYEN_MOBILEPAY: "ADYEN_MOBILEPAY";
2311
- readonly ADYEN_VIPPS: "ADYEN_VIPPS";
2312
- readonly ADYEN_GIROPAY: "ADYEN_GIROPAY";
2313
- readonly ADYEN_SOFORT: "ADYEN_SOFORT";
2314
- readonly ADYEN_IDEAL: "ADYEN_IDEAL";
2315
- readonly ADYEN_TRUSTLY: "ADYEN_TRUSTLY";
2316
- readonly ADYEN_ALIPAY: "ADYEN_ALIPAY";
2317
- readonly ADYEN_TWINT: "ADYEN_TWINT";
2318
- readonly ADYEN_BANK_TRANSFER: "ADYEN_BANK_TRANSFER";
2319
- readonly MOLLIE_BANCONTACT: "MOLLIE_BANCONTACT";
2320
- readonly MOLLIE_IDEAL: "MOLLIE_IDEAL";
2321
- readonly BUCKAROO_GIROPAY: "BUCKAROO_GIROPAY";
2322
- readonly BUCKAROO_EPS: "BUCKAROO_EPS";
2323
- readonly BUCKAROO_SOFORT: "BUCKAROO_SOFORT";
2324
- readonly BUCKAROO_BANCONTACT: "BUCKAROO_BANCONTACT";
2325
- readonly BUCKAROO_IDEAL: "BUCKAROO_IDEAL";
2326
- readonly ATOME: "ATOME";
2327
- };
2328
- type PaymentMethodType$1 = (typeof PaymentMethodType$1)[keyof typeof PaymentMethodType$1];
2329
969
  export type InitializedManager = {
2330
- type: typeof PaymentMethodType$1.STRIPE_ACH;
970
+ type: typeof PaymentMethodType.STRIPE_ACH;
2331
971
  manager: IAchPaymentMethodManager;
2332
972
  } | {
2333
- type: typeof PaymentMethodType$1.PAYMENT_CARD;
973
+ type: typeof PaymentMethodType.PAYMENT_CARD;
2334
974
  manager: ICardPaymentMethodManager;
2335
975
  } | {
2336
- type: typeof PaymentMethodType$1.KLARNA;
976
+ type: typeof PaymentMethodType.KLARNA;
2337
977
  manager: IKlarnaPaymentMethodManager;
2338
978
  } | {
2339
979
  type: RedirectPaymentMethodTypes;
2340
980
  manager: IRedirectPaymentMethodManager;
2341
981
  } | {
2342
- type: typeof PaymentMethodType$1.PAYPAL | typeof PaymentMethodType$1.GOOGLE_PAY | typeof PaymentMethodType$1.APPLE_PAY;
982
+ type: typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY;
2343
983
  manager: INativePaymentMethodManager;
2344
984
  };
2345
- export type ManagerByType<T extends PaymentMethodType$1> = Extract<InitializedManager, {
985
+ export type ManagerByType<T extends PaymentMethodType> = Extract<InitializedManager, {
2346
986
  type: T;
2347
987
  }>;
2348
- export interface InitializedManagersMap extends Map<PaymentMethodType$1, InitializedManager> {
2349
- get<T extends PaymentMethodType$1>(key: T): ManagerByType<T> | undefined;
988
+ export interface InitializedManagersMap extends Map<PaymentMethodType, InitializedManager> {
989
+ get<T extends PaymentMethodType>(key: T): ManagerByType<T> | undefined;
2350
990
  }
2351
- export type RedirectPaymentMethodTypes = Exclude<PaymentMethodType$1, typeof PaymentMethodType$1.STRIPE_ACH | typeof PaymentMethodType$1.PAYMENT_CARD | typeof PaymentMethodType$1.KLARNA | typeof PaymentMethodType$1.PAYPAL | typeof PaymentMethodType$1.GOOGLE_PAY | typeof PaymentMethodType$1.APPLE_PAY>;
2352
- export type DynamicPaymentMethodTypes = typeof PaymentMethodType$1.STRIPE_ACH;
2353
- export type NativePaymentMethodTypes = typeof PaymentMethodType$1.PAYPAL | typeof PaymentMethodType$1.GOOGLE_PAY | typeof PaymentMethodType$1.APPLE_PAY;
991
+ 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>;
992
+ export type DynamicPaymentMethodTypes = typeof PaymentMethodType.STRIPE_ACH;
993
+ export type NativePaymentMethodTypes = typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY;
2354
994
  export type RedirectPaymentMethod = {
2355
995
  type: RedirectPaymentMethodTypes;
2356
996
  managerType: HeadlessManagerType.REDIRECT;
2357
997
  };
2358
998
  export type InitializedPaymentMethod = {
2359
- type: typeof PaymentMethodType$1.STRIPE_ACH;
999
+ type: typeof PaymentMethodType.STRIPE_ACH;
2360
1000
  managerType: HeadlessManagerType.ACH;
2361
1001
  } | {
2362
- type: typeof PaymentMethodType$1.PAYMENT_CARD;
1002
+ type: typeof PaymentMethodType.PAYMENT_CARD;
2363
1003
  managerType: HeadlessManagerType.CARD;
2364
1004
  } | {
2365
- type: typeof PaymentMethodType$1.KLARNA;
1005
+ type: typeof PaymentMethodType.KLARNA;
2366
1006
  managerType: HeadlessManagerType.KLARNA;
2367
1007
  } | {
2368
- type: typeof PaymentMethodType$1.PAYPAL;
1008
+ type: typeof PaymentMethodType.PAYPAL;
2369
1009
  managerType: HeadlessManagerType.NATIVE;
2370
1010
  } | {
2371
- type: typeof PaymentMethodType$1.GOOGLE_PAY;
1011
+ type: typeof PaymentMethodType.GOOGLE_PAY;
2372
1012
  managerType: HeadlessManagerType.NATIVE;
2373
1013
  } | {
2374
- type: typeof PaymentMethodType$1.APPLE_PAY;
1014
+ type: typeof PaymentMethodType.APPLE_PAY;
2375
1015
  managerType: HeadlessManagerType.NATIVE;
2376
1016
  } | RedirectPaymentMethod;
2377
- export type PaymentMethodByType<T extends PaymentMethodType$1> = Extract<InitializedPaymentMethod, {
1017
+ export type PaymentMethodByType<T extends PaymentMethodType> = Extract<InitializedPaymentMethod, {
2378
1018
  type: T;
2379
1019
  }>;
2380
- export interface InitializedPaymentMethodMap extends Map<PaymentMethodType$1, InitializedPaymentMethod> {
2381
- get<T extends PaymentMethodType$1>(key: T): PaymentMethodByType<T> | undefined;
1020
+ export interface InitializedPaymentMethodMap extends Map<PaymentMethodType, InitializedPaymentMethod> {
1021
+ get<T extends PaymentMethodType>(key: T): PaymentMethodByType<T> | undefined;
2382
1022
  }
2383
1023
  export interface AssetsConfig {
2384
1024
  backgroundColor: string;
@@ -2389,35 +1029,90 @@ export declare class InitializedPayments {
2389
1029
  private readonly _methods;
2390
1030
  constructor(map: InitializedPaymentMethodMap);
2391
1031
  get<T extends RedirectPaymentMethodTypes>(type: T): RedirectPaymentMethod | undefined;
2392
- get<T extends (typeof PaymentMethodType$1)[keyof typeof PaymentMethodType$1]>(type: T): PaymentMethodByType<T> | undefined;
1032
+ get<T extends (typeof PaymentMethodType)[keyof typeof PaymentMethodType]>(type: T): PaymentMethodByType<T> | undefined;
2393
1033
  toArray(): InitializedPaymentMethod[];
2394
1034
  size(): number;
2395
1035
  }
2396
- export interface OnCheckoutCompletePayload {
1036
+ export interface PaymentData {
1037
+ paymentMethodType: string;
1038
+ }
1039
+ export interface PrepareHandler {
1040
+ continuePaymentCreation: () => void;
1041
+ abortPaymentCreation: () => void;
1042
+ }
1043
+ export interface PaymentCompleteData {
2397
1044
  payment: Payment | null;
1045
+ status: "success" | "pending" | "error";
1046
+ error?: PrimerClientError;
2398
1047
  }
2399
- export interface OnCheckoutFailurePayload {
2400
- error: PrimerClientError;
2401
- payment?: Payment;
1048
+ /**
1049
+ * PrimerJS is a wrapper class that provides a stable API for interfacing with the Primer SDK
1050
+ * while hiding direct access to the legacy headless instance.
1051
+ */
1052
+ export declare class PrimerJS {
1053
+ private headlessInstance;
1054
+ private paymentMethods;
1055
+ onPaymentStart?: () => void;
1056
+ onPaymentPrepare?: (data: PaymentData, handler: PrepareHandler) => void;
1057
+ onPaymentComplete?: (data: PaymentCompleteData) => void;
1058
+ constructor(headlessInstance: PrimerHeadlessCheckout);
1059
+ /**
1060
+ * Set the initialized payment methods
1061
+ * @internal - This is only used internally by the SDK
1062
+ */
1063
+ setPaymentMethods(methods: InitializedPayments): void;
1064
+ /**
1065
+ * Refetches a new client session from merchant backend.
1066
+ */
1067
+ refreshSession(): Promise<void>;
1068
+ /**
1069
+ * Returns the cached list of payment methods.
1070
+ */
1071
+ getPaymentMethods(): PaymentMethodInfo[];
1072
+ /**
1073
+ * Internal method to handle the onPaymentStart callback
1074
+ * @internal - This is only used internally by the SDK
1075
+ */
1076
+ handlePaymentStart(): void;
1077
+ /**
1078
+ * Internal method to handle the onBeforePaymentCreate callback and transform it to onPaymentPrepare
1079
+ * @internal - This is only used internally by the SDK
1080
+ */
1081
+ handleBeforePaymentCreate(data: PaymentData, originalHandler: {
1082
+ continuePaymentCreation: () => void;
1083
+ abortPaymentCreation: () => void;
1084
+ }): void;
1085
+ /**
1086
+ * Internal method to handle payment completion (success)
1087
+ * @internal - This is only used internally by the SDK
1088
+ */
1089
+ handlePaymentComplete(payment: Payment | null): void;
1090
+ /**
1091
+ * Internal method to handle payment failure
1092
+ * @internal - This is only used internally by the SDK
1093
+ */
1094
+ handlePaymentFailure(error: PrimerClientError, payment?: Payment): void;
2402
1095
  }
2403
1096
  export interface CardSubmitSuccessPayload {
2404
1097
  result: unknown;
2405
1098
  }
2406
1099
  export interface CardSubmitErrorsPayload {
2407
- errors: unknown | InputValidationError[];
1100
+ errors: unknown;
1101
+ }
1102
+ export interface CardSubmitPayload {
1103
+ source?: string;
2408
1104
  }
2409
1105
  export interface PrimeAchErrorPayload {
2410
1106
  error: Error;
2411
1107
  }
2412
1108
  export interface PrimerEvents {
2413
- "primer-state-changed": CustomEvent<SdkStateContext>;
2414
- "primer-oncheckout-complete": CustomEvent<OnCheckoutCompletePayload>;
2415
- "primer-oncheckout-failure": CustomEvent<OnCheckoutFailurePayload>;
2416
- "primer-payment-methods-updated": CustomEvent<InitializedPayments>;
2417
- "primer-checkout-initialized": CustomEvent<PrimerHeadlessCheckout>;
2418
- "primer-card-network-change": CustomEvent<CardNetworksContext>;
2419
- "primer-card-submit-success": CustomEvent<CardSubmitSuccessPayload>;
2420
- "primer-card-submit-errors": CustomEvent<CardSubmitErrorsPayload>;
1109
+ "primer:state-change": CustomEvent<SdkStateContextType>;
1110
+ "primer:methods-update": CustomEvent<InitializedPayments>;
1111
+ "primer:ready": CustomEvent<PrimerJS>;
1112
+ "primer:card-network-change": CustomEvent<CardNetworksContextType>;
1113
+ "primer:card-submit": CustomEvent<CardSubmitPayload>;
1114
+ "primer:card-success": CustomEvent<CardSubmitSuccessPayload>;
1115
+ "primer:card-error": CustomEvent<CardSubmitErrorsPayload>;
2421
1116
  "primer-ach-error": CustomEvent<PrimeAchErrorPayload>;
2422
1117
  "primer-ach-bank-details-collected": CustomEvent;
2423
1118
  "primer-ach-mandate-confirmed": CustomEvent;
@@ -2435,17 +1130,16 @@ declare class PrimerEventsController implements ReactiveController {
2435
1130
  * @param detail - The payload for the event.
2436
1131
  */
2437
1132
  dispatchEvent<K extends keyof PrimerEvents>(type: K, detail: PrimerEvents[K]["detail"]): void;
2438
- dispatchSdkState(sdkState: SdkStateContext): void;
1133
+ dispatchSdkState(sdkState: SdkStateContextType): void;
2439
1134
  dispatchPaymentMethods(paymentMethods: InitializedPayments): void;
2440
- dispatchCheckoutInitialized(checkoutInstance: PrimerHeadlessCheckout): void;
2441
- dispatchCardNetworkChange(network: CardNetworksContext): void;
2442
- dispatchOnCheckoutComplete(payment: Payment | null): void;
2443
- dispatchOnCheckoutFailure(error: PrimerClientError, payment?: Payment): void;
1135
+ dispatchCheckoutInitialized(checkoutInstance: PrimerJS): void;
1136
+ dispatchCardNetworkChange(network: CardNetworksContextType): void;
1137
+ dispatchCardSubmit(source?: string): void;
2444
1138
  dispatchFormSubmitSuccess(result: unknown): void;
2445
1139
  dispatchFormSubmitErrors(errors: unknown): void;
2446
1140
  }
2447
- export type HeadlessUnitilsContext = HeadlessSDKUtilities | null;
2448
- export type KlarnaCategoriesContext = {
1141
+ export type HeadlessUnitilsContextType = HeadlessSDKUtilities | null;
1142
+ export type KlarnaCategoriesContextType = {
2449
1143
  categories: KlarnaPaymentMethodCategory[];
2450
1144
  isLoading: boolean;
2451
1145
  };
@@ -2486,6 +1180,7 @@ declare class CompositeStateController<Host extends ReactiveControllerHost> impl
2486
1180
  export interface VaultManagerInitOptions {
2487
1181
  vaultEnabled?: boolean;
2488
1182
  captureVaultedCardCvv?: boolean;
1183
+ showEmptyState?: boolean;
2489
1184
  }
2490
1185
  /**
2491
1186
  * Core state interface for vault manager
@@ -2497,6 +1192,7 @@ export interface VaultManagerState {
2497
1192
  isUpdating: boolean;
2498
1193
  vaultedPaymentMethods: VaultedPaymentMethod[];
2499
1194
  cvvRecapture: boolean;
1195
+ showEmptyState: boolean;
2500
1196
  createCvvInput: ((options: CardSecurityCodeInputOptions) => Promise<CvvInput | null>) | null;
2501
1197
  deleteVaultedPaymentMethod: (paymentMethodId: string) => Promise<void>;
2502
1198
  startVaultedPaymentFlow: (options?: {
@@ -2540,7 +1236,7 @@ declare class VaultManagerController extends CompositeStateController<PrimerChec
2540
1236
  * Fetch vaulted payment methods from the server
2541
1237
  */
2542
1238
  fetchVaultedPaymentMethods(initialLoad?: boolean): Promise<VaultedPaymentMethod[]>;
2543
- createCvvInput(options: CardSecurityCodeInputOptions): Promise<CvvInput | null>;
1239
+ createCvvInput: (options: CardSecurityCodeInputOptions) => Promise<CvvInput | null>;
2544
1240
  /**
2545
1241
  * Delete a vaulted payment method by ID
2546
1242
  */
@@ -2564,13 +1260,13 @@ declare class VaultManagerController extends CompositeStateController<PrimerChec
2564
1260
  * Context for core vault manager functionality
2565
1261
  * Contains properties that don't change frequently and relate to vault functionality
2566
1262
  */
2567
- export type VaultManagerContext = VaultManagerState | null;
1263
+ export type VaultManagerContextType = VaultManagerState | null;
2568
1264
  /**
2569
1265
  * Context for vault manager CVV-specific state
2570
1266
  * Contains properties specifically related to CVV input functionality
2571
1267
  * Further separated to minimize re-renders related to frequently changing CVV input state
2572
1268
  */
2573
- export type VaultItemContext = VaultManagerItemState | null;
1269
+ export type VaultItemContextType = VaultManagerItemState | null;
2574
1270
  declare class SDKContextController implements ReactiveController {
2575
1271
  host: PrimerCheckoutType;
2576
1272
  private sdkStateProvider;
@@ -2589,7 +1285,7 @@ declare class SDKContextController implements ReactiveController {
2589
1285
  * Updates the SDK state context.
2590
1286
  * @param value The new SDK state.
2591
1287
  */
2592
- setSdkState(value: SdkStateContext): void;
1288
+ setSdkState(value: SdkStateContextType): void;
2593
1289
  /**
2594
1290
  * Updates the payment methods context.
2595
1291
  * @param value The new payment methods data.
@@ -2600,13 +1296,13 @@ declare class SDKContextController implements ReactiveController {
2600
1296
  * @param value The new payment manager mapping.
2601
1297
  */
2602
1298
  setPaymentManagers(value: InitializedManagersMap): void;
2603
- setCardNetworks(value: CardNetworksContext): void;
2604
- setVaultManager(value: VaultManagerContext): void;
2605
- setKlarnaCategories(value: KlarnaCategoriesContext): void;
1299
+ setCardNetworks(value: CardNetworksContextType): void;
1300
+ setVaultManager(value: VaultManagerContextType): void;
1301
+ setKlarnaCategories(value: KlarnaCategoriesContextType): void;
2606
1302
  setClientOptions(value: PrimerCheckoutOptions | null): void;
2607
- setHeadlessUtils(value: HeadlessUnitilsContext): void;
1303
+ setHeadlessUtils(value: HeadlessUnitilsContextType): void;
2608
1304
  setComputedStyles(value: CSSStyleDeclaration): void;
2609
- setVaultManagerCvv(value: VaultItemContext): void;
1305
+ setVaultManagerCvv(value: VaultItemContextType): void;
2610
1306
  }
2611
1307
  export type SdkStateAction = {
2612
1308
  type: "START_PROCESSING";
@@ -2646,6 +1342,10 @@ declare class SdkStateController extends ReactiveStateController<PrimerCheckoutT
2646
1342
  resetError(): void;
2647
1343
  forceCompleteLoading(): void;
2648
1344
  }
1345
+ /**
1346
+ * PrimerCheckoutType defines the interface for the primer-checkout component implementation.
1347
+ * This includes both the properties and controllers needed for internal functionality.
1348
+ */
2649
1349
  export interface PrimerCheckoutType extends ReactiveControllerHost, LitElement {
2650
1350
  requestUpdate: ReactiveControllerHost["requestUpdate"];
2651
1351
  customStyles: string;
@@ -2676,7 +1376,7 @@ declare class CardNetworkController implements ReactiveController {
2676
1376
  *
2677
1377
  * @param event - The card network change event
2678
1378
  */
2679
- processCardNetworkChangeEvent(event: CardNetworkChangeEvent): Promise<void>;
1379
+ processCardNetworkChangeEvent(event: CardNetworkChangeEvent): void;
2680
1380
  }
2681
1381
  declare class StyleProcessingController implements ReactiveController {
2682
1382
  host: ReactiveControllerHost & LitElement;
@@ -2783,6 +1483,16 @@ declare const targetLocales = [
2783
1483
  `zh-TW`,
2784
1484
  ] as const;
2785
1485
  export type LocaleCode = typeof sourceLocale | (typeof targetLocales)[number];
1486
+ declare global {
1487
+ interface HTMLElementTagNameMap {
1488
+ "primer-checkout": PrimerCheckoutComponent;
1489
+ }
1490
+ type PublicPrimerEvents = Omit<PrimerEvents, "primer-ach-error" | "primer-ach-bank-details-collected" | "primer-ach-mandate-confirmed" | "primer-ach-mandate-declined">;
1491
+ interface DocumentEventMap extends PublicPrimerEvents {
1492
+ }
1493
+ interface HTMLElementEventMap extends PublicPrimerEvents {
1494
+ }
1495
+ }
2786
1496
  declare class AchPaymentEventsController implements ReactiveController {
2787
1497
  host: PrimerCheckoutComponent;
2788
1498
  constructor(host: PrimerCheckoutComponent);
@@ -2808,6 +1518,7 @@ export declare class PrimerCheckoutComponent extends LitElement implements Prime
2808
1518
  customStyles: string;
2809
1519
  clientToken: string;
2810
1520
  options: PrimerCheckoutOptions;
1521
+ disableLoader: boolean;
2811
1522
  /**
2812
1523
  * Whether the component has completed initialization and loading
2813
1524
  * This is used to control the CSS-only loader visibility
@@ -2892,18 +1603,18 @@ declare class SpinnerComponent extends LitElement {
2892
1603
  * Size of the spinner
2893
1604
  * Available values: 'small', 'medium', 'large' or a custom number as string
2894
1605
  */
2895
- size: SpinnerSize | string;
1606
+ size: SpinnerSize;
2896
1607
  /**
2897
1608
  * Whether to use compact mode (minimal margins)
2898
1609
  * Useful when embedding in inputs
2899
1610
  */
2900
1611
  compact: boolean;
2901
- static styles: CSSResult[];
1612
+ static styles: import("lit").CSSResult[];
2902
1613
  /**
2903
1614
  * Get the actual size value in pixels
2904
1615
  */
2905
1616
  private getSize;
2906
- render(): TemplateResult<1>;
1617
+ render(): import("lit-html").TemplateResult<1>;
2907
1618
  }
2908
1619
  declare global {
2909
1620
  interface HTMLElementTagNameMap {
@@ -2920,7 +1631,7 @@ declare global {
2920
1631
  * - Sets proper cursor styling to indicate text input functionality
2921
1632
  */
2922
1633
  declare class InputWrapperComponent extends LitElement {
2923
- static styles: CSSResult[];
1634
+ static styles: import("lit").CSSResult[];
2924
1635
  focusWithin: boolean;
2925
1636
  hasError: boolean;
2926
1637
  private inputSlot;
@@ -2936,7 +1647,7 @@ declare class InputWrapperComponent extends LitElement {
2936
1647
  * @returns The primer-input element or null if not found
2937
1648
  */
2938
1649
  private findSlottedPrimerInput;
2939
- render(): TemplateResult<1>;
1650
+ render(): import("lit-html").TemplateResult<1>;
2940
1651
  }
2941
1652
  declare global {
2942
1653
  interface HTMLElementTagNameMap {
@@ -2950,7 +1661,7 @@ declare global {
2950
1661
  * @slot - Default slot for label text content
2951
1662
  */
2952
1663
  declare class InputLabelComponent extends LitElement {
2953
- static styles: CSSResult[];
1664
+ static styles: import("lit").CSSResult[];
2954
1665
  /**
2955
1666
  * ID of the form control this label is associated with
2956
1667
  */
@@ -2959,7 +1670,7 @@ declare class InputLabelComponent extends LitElement {
2959
1670
  * Whether the label should appear disabled
2960
1671
  */
2961
1672
  disabled: boolean;
2962
- render(): TemplateResult<1>;
1673
+ render(): import("lit-html").TemplateResult<1>;
2963
1674
  }
2964
1675
  declare global {
2965
1676
  interface HTMLElementTagNameMap {
@@ -2971,7 +1682,7 @@ declare global {
2971
1682
  */
2972
1683
  export type ButtonSelectionState = "default" | "checked";
2973
1684
  declare class ButtonComponent extends LitElement {
2974
- static styles: CSSResult[];
1685
+ static styles: import("lit").CSSResult[];
2975
1686
  variant: "primary" | "secondary" | "tertiary";
2976
1687
  disabled: boolean;
2977
1688
  /**
@@ -2990,6 +1701,10 @@ declare class ButtonComponent extends LitElement {
2990
1701
  * Indicates if this button is selectable/checkable
2991
1702
  */
2992
1703
  selectable: boolean;
1704
+ /**
1705
+ * Indicates if wraps the slot in a flex container
1706
+ */
1707
+ flex: boolean;
2993
1708
  /**
2994
1709
  * Event handler for button click
2995
1710
  * If selectable, it will toggle between checked and default states
@@ -3003,7 +1718,7 @@ declare class ButtonComponent extends LitElement {
3003
1718
  * Renders the spinner when in loading state
3004
1719
  */
3005
1720
  private renderSpinner;
3006
- render(): TemplateResult<1>;
1721
+ render(): import("lit-html").TemplateResult<1>;
3007
1722
  }
3008
1723
  declare global {
3009
1724
  interface HTMLElementTagNameMap {
@@ -3017,7 +1732,7 @@ declare global {
3017
1732
  * @slot - Default slot for error message content
3018
1733
  */
3019
1734
  declare class InputErrorComponent extends LitElement {
3020
- static styles: CSSResult[];
1735
+ static styles: import("lit").CSSResult[];
3021
1736
  /**
3022
1737
  * ID of the form control this error message is associated with
3023
1738
  */
@@ -3026,7 +1741,7 @@ declare class InputErrorComponent extends LitElement {
3026
1741
  * Whether the error is currently active/visible
3027
1742
  */
3028
1743
  active: boolean;
3029
- render(): TemplateResult<1>;
1744
+ render(): import("lit-html").TemplateResult<1>;
3030
1745
  }
3031
1746
  declare global {
3032
1747
  interface HTMLElementTagNameMap {
@@ -3036,12 +1751,12 @@ declare global {
3036
1751
  export type IconName = keyof typeof icons;
3037
1752
  declare const icons: Record<string, SVGTemplateResult>;
3038
1753
  declare class PrimerIconComponent extends LitElement {
3039
- static styles: CSSResult[];
1754
+ static styles: import("lit").CSSResult[];
3040
1755
  color: string;
3041
1756
  size: "lg" | "md" | "sm";
3042
1757
  /** The name of the icon to draw - available names can be found under library.ts file */
3043
1758
  name?: IconName;
3044
- render(): TemplateResult<1>;
1759
+ render(): import("lit-html").TemplateResult<1>;
3045
1760
  }
3046
1761
  declare global {
3047
1762
  interface HTMLElementTagNameMap {
@@ -3049,10 +1764,10 @@ declare global {
3049
1764
  }
3050
1765
  }
3051
1766
  declare class PrimerCheckoutStateComponent extends LitElement {
3052
- static styles: CSSResult[];
1767
+ static styles: import("lit").CSSResult[];
3053
1768
  type: "complete" | "failure";
3054
1769
  description?: string;
3055
- render(): TemplateResult<1>;
1770
+ render(): import("lit-html").TemplateResult<1>;
3056
1771
  }
3057
1772
  declare global {
3058
1773
  interface HTMLElementTagNameMap {
@@ -3088,7 +1803,7 @@ export type InputEventMap = {
3088
1803
  * @csspart input - The native input element
3089
1804
  */
3090
1805
  declare class InputComponent extends LitElement {
3091
- static styles: CSSResult[];
1806
+ static styles: import("lit").CSSResult[];
3092
1807
  private inputElement;
3093
1808
  value: string;
3094
1809
  placeholder: string;
@@ -3104,7 +1819,9 @@ declare class InputComponent extends LitElement {
3104
1819
  max: string;
3105
1820
  step: string;
3106
1821
  autocomplete: string;
3107
- id: string;
1822
+ private _id;
1823
+ get id(): string;
1824
+ set id(value: string);
3108
1825
  private hasFocus;
3109
1826
  private hasError;
3110
1827
  /**
@@ -3160,7 +1877,7 @@ declare class InputComponent extends LitElement {
3160
1877
  * Report the validity of the input element
3161
1878
  */
3162
1879
  reportValidity(): boolean;
3163
- render(): TemplateResult<1>;
1880
+ render(): import("lit-html").TemplateResult<1>;
3164
1881
  /**
3165
1882
  * Type safe event dispatcher - allows consumers to use proper types
3166
1883
  * when listening to events from this component
@@ -3191,7 +1908,7 @@ export type ButtonVariant = "primary" | "secondary" | "tertiary";
3191
1908
  * Uses CSS Grid for smooth animation and incorporates the primary button.
3192
1909
  */
3193
1910
  declare class CollapsableComponent extends LitElement {
3194
- static styles: CSSResult[];
1911
+ static styles: import("lit").CSSResult[];
3195
1912
  /**
3196
1913
  * The header text for the collapsable
3197
1914
  */
@@ -3240,7 +1957,7 @@ declare class CollapsableComponent extends LitElement {
3240
1957
  * Collapse the collapsable programmatically
3241
1958
  */
3242
1959
  collapse(): void;
3243
- render(): TemplateResult<1>;
1960
+ render(): import("lit-html").TemplateResult<1>;
3244
1961
  }
3245
1962
  declare global {
3246
1963
  interface HTMLElementTagNameMap {
@@ -3265,7 +1982,8 @@ declare global {
3265
1982
  * @csspart error-content - The error text content
3266
1983
  */
3267
1984
  declare class ErrorMessageComponent extends LitElement {
3268
- static styles: CSSResult[];
1985
+ static styles: import("lit").CSSResult[];
1986
+ constructor();
3269
1987
  /**
3270
1988
  * The error message text to display
3271
1989
  */
@@ -3278,7 +1996,9 @@ declare class ErrorMessageComponent extends LitElement {
3278
1996
  * Accessibility role for the error message
3279
1997
  * Defaults to "alert" for proper screen reader announcements
3280
1998
  */
3281
- role: string;
1999
+ private _role;
2000
+ get role(): string;
2001
+ set role(value: string);
3282
2002
  /**
3283
2003
  * Internal state to track animation state
3284
2004
  * This helps manage proper animations with DOM presence/absence
@@ -3289,7 +2009,7 @@ declare class ErrorMessageComponent extends LitElement {
3289
2009
  * Handle visibility changes with proper animation timing
3290
2010
  */
3291
2011
  private handleVisibilityChange;
3292
- render(): typeof nothing | TemplateResult<1>;
2012
+ render(): typeof nothing | import("lit-html").TemplateResult<1>;
3293
2013
  }
3294
2014
  declare global {
3295
2015
  interface HTMLElementTagNameMap {
@@ -3297,8 +2017,9 @@ declare global {
3297
2017
  }
3298
2018
  }
3299
2019
  declare class PortalComponent extends LitElement {
3300
- static styles: CSSResult[];
3301
- id: string;
2020
+ static styles: import("lit").CSSResult[];
2021
+ private _id;
2022
+ get id(): string;
3302
2023
  getContainer(): HTMLDivElement;
3303
2024
  /**
3304
2025
  * Proxies the events sent from the portalled content and
@@ -3310,7 +2031,7 @@ declare class PortalComponent extends LitElement {
3310
2031
  private _setupEventListeners;
3311
2032
  disconnectedCallback(): void;
3312
2033
  private _handleSlotChange;
3313
- render(): TemplateResult<1>;
2034
+ render(): import("lit-html").TemplateResult<1>;
3314
2035
  }
3315
2036
  declare global {
3316
2037
  interface HTMLElementTagNameMap {
@@ -3318,9 +2039,9 @@ declare global {
3318
2039
  }
3319
2040
  }
3320
2041
  declare class DialogComponent extends LitElement {
3321
- static styles: CSSResult[];
2042
+ static styles: import("lit").CSSResult[];
3322
2043
  private _handleCloseClick;
3323
- render(): TemplateResult<1>;
2044
+ render(): import("lit-html").TemplateResult<1>;
3324
2045
  }
3325
2046
  declare global {
3326
2047
  interface HTMLElementTagNameMap {
@@ -3337,43 +2058,45 @@ declare global {
3337
2058
  * [ Continue with Klarna ] --> opens a Klarna popup
3338
2059
  */
3339
2060
  declare class PrimerKlarnaComponent extends LitElement {
3340
- static styles: CSSResult[];
2061
+ static styles: import("lit").CSSResult[];
3341
2062
  paymentManagers: InitializedManagersMap;
3342
- sdkState: SdkStateContext;
3343
- headlessUtils: HeadlessUnitilsContext;
3344
- klarnaCategories: KlarnaCategoriesContext | null;
2063
+ sdkState: SdkStateContextType;
2064
+ headlessUtils: HeadlessUnitilsContextType;
2065
+ klarnaCategories: KlarnaCategoriesContextType | null;
2066
+ disabled: boolean;
3345
2067
  private selectedCategory;
3346
2068
  private isExpanded;
3347
2069
  private headerAriaLabel;
3348
2070
  private klarnaContainer;
3349
2071
  private _paymentMethodManagerTask;
3350
- toggleExpand(): void;
2072
+ toggleExpand: () => void;
3351
2073
  startKlarnaPayment(): Promise<void>;
3352
2074
  renderSelectedCategory(): Promise<void>;
3353
2075
  selectCategory(category: string): void;
3354
2076
  updated(changedProperties: Map<string, unknown>): void;
3355
- renderCategorySelection(): TemplateResult<1>;
3356
- renderExpandedContent(): TemplateResult<1>;
3357
- render(): typeof nothing | TemplateResult<1> | undefined;
2077
+ renderCategorySelection(): import("lit-html").TemplateResult<1>;
2078
+ renderExpandedContent(): import("lit-html").TemplateResult<1>;
2079
+ render(): typeof nothing | import("lit-html").TemplateResult<1> | undefined;
3358
2080
  }
3359
2081
  declare global {
3360
2082
  interface HTMLElementTagNameMap {
3361
2083
  "primer-klarna": PrimerKlarnaComponent;
3362
2084
  }
3363
2085
  }
3364
- export type PaymentMethodsContext = InitializedPayments | null;
2086
+ export type PaymentMethodsContextType = InitializedPayments | null;
3365
2087
  declare class PaymentMethodComponent extends LitElement {
3366
- static styles: CSSResult[];
3367
- type: PaymentMethodType$1 | undefined;
3368
- paymentMethods: PaymentMethodsContext;
3369
- render(): typeof nothing | TemplateResult<1>;
2088
+ static styles: import("lit").CSSResult[];
2089
+ type: PaymentMethodType | undefined;
2090
+ disabled: boolean;
2091
+ paymentMethods: PaymentMethodsContextType;
2092
+ render(): typeof nothing | import("lit-html").TemplateResult<1>;
3370
2093
  }
3371
2094
  declare global {
3372
2095
  interface HTMLElementTagNameMap {
3373
2096
  "primer-payment-method": PaymentMethodComponent;
3374
2097
  }
3375
2098
  }
3376
- export type ClientOptionsContext = PrimerCheckoutOptions | null;
2099
+ export type ClientOptionsContextType = PrimerCheckoutOptions | null;
3377
2100
  export type AchField = "firstName" | "lastName" | "emailAddress";
3378
2101
  export interface AchFormState {
3379
2102
  value: string;
@@ -3405,12 +2128,12 @@ declare class AchPaymentFormControler implements ReactiveController {
3405
2128
  hostDisconnected(): void;
3406
2129
  }
3407
2130
  declare class AchPaymentComponent extends LitElement {
3408
- static styles: CSSResult[];
2131
+ static styles: import("lit").CSSResult[];
3409
2132
  protected readonly formController: AchPaymentFormControler;
3410
2133
  paymentMethod: InitializedPaymentMethod | undefined;
3411
2134
  paymentManagers: InitializedManagersMap;
3412
- sdkState: SdkStateContext | undefined;
3413
- clientOptions: ClientOptionsContext | undefined;
2135
+ sdkState: SdkStateContextType | undefined;
2136
+ clientOptions: ClientOptionsContextType | undefined;
3414
2137
  screen: "form" | "mandate";
3415
2138
  private isSubmitting;
3416
2139
  private _paymentMethodManagerTask;
@@ -3431,11 +2154,11 @@ declare global {
3431
2154
  }
3432
2155
  }
3433
2156
  declare class DynamicPaymentComponent extends LitElement {
3434
- static styles: CSSResult[];
2157
+ static styles: import("lit").CSSResult[];
3435
2158
  paymentMethod: InitializedPaymentMethod | undefined;
3436
2159
  paymentManagers: InitializedManagersMap;
3437
- sdkState: SdkStateContext;
3438
- headlessUtils: HeadlessUnitilsContext;
2160
+ sdkState: SdkStateContextType;
2161
+ headlessUtils: HeadlessUnitilsContextType;
3439
2162
  open: boolean;
3440
2163
  private _paymentMethodManagerTask;
3441
2164
  private _getAssetsTask;
@@ -3447,8 +2170,8 @@ declare class DynamicPaymentComponent extends LitElement {
3447
2170
  private _legacyGetButtonLabel;
3448
2171
  private _setupTasks;
3449
2172
  start(): void;
3450
- renderDialog(): typeof nothing | TemplateResult<1>;
3451
- render(): symbol | TemplateResult<1> | undefined;
2173
+ renderDialog(): typeof nothing | import("lit-html").TemplateResult<1>;
2174
+ render(): symbol | import("lit-html").TemplateResult<1> | undefined;
3452
2175
  }
3453
2176
  declare global {
3454
2177
  interface HTMLElementTagNameMap {
@@ -3456,11 +2179,12 @@ declare global {
3456
2179
  }
3457
2180
  }
3458
2181
  declare class RedirectPaymentComponent extends LitElement {
3459
- static styles: CSSResult[];
2182
+ static styles: import("lit").CSSResult[];
3460
2183
  paymentMethod: InitializedPaymentMethod | undefined;
2184
+ disabled: boolean;
3461
2185
  paymentManagers: InitializedManagersMap;
3462
- sdkState: SdkStateContext;
3463
- headlessUtils: HeadlessUnitilsContext;
2186
+ sdkState: SdkStateContextType;
2187
+ headlessUtils: HeadlessUnitilsContextType;
3464
2188
  private _paymentMethodManagerTask;
3465
2189
  /**
3466
2190
  * Based on packages/primer-sdk-web/src/payment-methods/Button.tsx
@@ -3470,7 +2194,7 @@ declare class RedirectPaymentComponent extends LitElement {
3470
2194
  private _getAssetsTask;
3471
2195
  private _setupTasks;
3472
2196
  startRedirectPayment(): void;
3473
- render(): symbol | TemplateResult<1> | undefined;
2197
+ render(): symbol | import("lit-html").TemplateResult<1> | undefined;
3474
2198
  }
3475
2199
  declare global {
3476
2200
  interface HTMLElementTagNameMap {
@@ -3487,7 +2211,7 @@ export interface VaultManagerEvents {
3487
2211
  toggleEditMode: CustomEvent<boolean>;
3488
2212
  closeError: CustomEvent<void>;
3489
2213
  vaultPaymentError: CustomEvent<{
3490
- error: Error | unknown;
2214
+ error: unknown;
3491
2215
  }>;
3492
2216
  }
3493
2217
  /**
@@ -3505,11 +2229,13 @@ export interface VaultManagerEventMap {
3505
2229
  * VaultManagerComponent - displays and manages saved payment methods
3506
2230
  */
3507
2231
  declare class VaultManagerComponent extends LitElement {
3508
- static styles: CSSResult[];
2232
+ static styles: import("lit").CSSResult[];
3509
2233
  constructor();
3510
2234
  addEventListener: <K extends keyof VaultManagerEventMap>(type: K, listener: (ev: VaultManagerEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void;
3511
2235
  removeEventListener: <K extends keyof VaultManagerEventMap>(type: K, listener: (ev: VaultManagerEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void;
3512
- vaultManagerContext: VaultManagerContext;
2236
+ vaultManagerContext: VaultManagerContextType;
2237
+ vaultItemContext: VaultItemContextType;
2238
+ headlessUtils: HeadlessUnitilsContextType;
3513
2239
  /**
3514
2240
  * Whether we're in edit mode
3515
2241
  */
@@ -3530,6 +2256,10 @@ declare class VaultManagerComponent extends LitElement {
3530
2256
  * Animation duration override
3531
2257
  */
3532
2258
  animationDuration: number;
2259
+ /**
2260
+ * Asset config for the payment method being deleted
2261
+ */
2262
+ private deleteAssetConfig;
3533
2263
  /**
3534
2264
  * Get base animation configuration with current settings
3535
2265
  */
@@ -3581,7 +2311,7 @@ declare class VaultManagerComponent extends LitElement {
3581
2311
  /**
3582
2312
  * Main render method
3583
2313
  */
3584
- render(): typeof nothing | TemplateResult<1>;
2314
+ render(): typeof nothing | import("lit-html").TemplateResult<1>;
3585
2315
  }
3586
2316
  /**
3587
2317
  * VaultPaymentMethodItemComponent - displays a single payment method
@@ -3591,7 +2321,7 @@ declare class VaultManagerComponent extends LitElement {
3591
2321
  * Always renders the primer-button for consistent UI and improved accessibility
3592
2322
  */
3593
2323
  declare class VaultPaymentMethodItemComponent extends LitElement {
3594
- static styles: CSSResult[];
2324
+ static styles: import("lit").CSSResult[];
3595
2325
  /**
3596
2326
  * Strongly typed event declarations
3597
2327
  */
@@ -3600,9 +2330,9 @@ declare class VaultPaymentMethodItemComponent extends LitElement {
3600
2330
  /**
3601
2331
  * Consume the vault manager context
3602
2332
  */
3603
- vaultManagerContext: VaultManagerContext;
3604
- vaultItemContext: VaultItemContext;
3605
- headlessUtils: HeadlessUnitilsContext;
2333
+ vaultManagerContext: VaultManagerContextType;
2334
+ vaultItemContext: VaultItemContextType;
2335
+ headlessUtils: HeadlessUnitilsContextType;
3606
2336
  /**
3607
2337
  * The payment method to display
3608
2338
  */
@@ -3625,14 +2355,10 @@ declare class VaultPaymentMethodItemComponent extends LitElement {
3625
2355
  * Dispatch delete event
3626
2356
  */
3627
2357
  private handleDeleteClick;
3628
- /**
3629
- * Builds the common content template shared between modes
3630
- */
3631
- private renderPaymentMethodContent;
3632
2358
  /**
3633
2359
  * Render method
3634
2360
  */
3635
- render(): symbol | TemplateResult<1> | undefined;
2361
+ render(): symbol | import("lit-html").TemplateResult<1> | undefined;
3636
2362
  }
3637
2363
  declare global {
3638
2364
  interface HTMLElementTagNameMap {
@@ -3643,7 +2369,7 @@ declare global {
3643
2369
  * VaultManagerHeaderComponent - displays the header for the vault manager
3644
2370
  */
3645
2371
  declare class VaultManagerHeaderComponent extends LitElement {
3646
- static styles: CSSResult[];
2372
+ static styles: import("lit").CSSResult[];
3647
2373
  /**
3648
2374
  * Strongly typed event declarations
3649
2375
  */
@@ -3664,7 +2390,7 @@ declare class VaultManagerHeaderComponent extends LitElement {
3664
2390
  /**
3665
2391
  * Render method
3666
2392
  */
3667
- protected render(): TemplateResult<1>;
2393
+ protected render(): import("lit-html").TemplateResult<1>;
3668
2394
  }
3669
2395
  declare global {
3670
2396
  interface HTMLElementTagNameMap {
@@ -3675,7 +2401,7 @@ declare global {
3675
2401
  * VaultDeleteConfirmationComponent - displays confirmation UI for deleting a payment method
3676
2402
  */
3677
2403
  declare class VaultDeleteConfirmationComponent extends LitElement {
3678
- static styles: CSSResult[];
2404
+ static styles: import("lit").CSSResult[];
3679
2405
  /**
3680
2406
  * Strongly typed event declarations
3681
2407
  */
@@ -3696,7 +2422,7 @@ declare class VaultDeleteConfirmationComponent extends LitElement {
3696
2422
  /**
3697
2423
  * Consume the vault manager context to access payment method info
3698
2424
  */
3699
- vaultManager: VaultManagerContext;
2425
+ vaultManager: VaultManagerContextType;
3700
2426
  /**
3701
2427
  * Handle confirm click
3702
2428
  */
@@ -3708,7 +2434,7 @@ declare class VaultDeleteConfirmationComponent extends LitElement {
3708
2434
  /**
3709
2435
  * Render method
3710
2436
  */
3711
- protected render(): TemplateResult<1>;
2437
+ protected render(): import("lit-html").TemplateResult<1>;
3712
2438
  }
3713
2439
  declare global {
3714
2440
  interface HTMLElementTagNameMap {
@@ -3719,11 +2445,11 @@ declare global {
3719
2445
  * VaultEmptyStateComponent - displays when no payment methods are available
3720
2446
  */
3721
2447
  declare class VaultEmptyStateComponent extends LitElement {
3722
- static styles: CSSResult[];
2448
+ static styles: import("lit").CSSResult[];
3723
2449
  /**
3724
2450
  * Render method
3725
2451
  */
3726
- protected render(): TemplateResult<1>;
2452
+ protected render(): import("lit-html").TemplateResult<1>;
3727
2453
  }
3728
2454
  declare global {
3729
2455
  interface HTMLElementTagNameMap {
@@ -3734,7 +2460,7 @@ declare global {
3734
2460
  * VaultErrorMessageComponent - displays error messages with improved visuals
3735
2461
  */
3736
2462
  declare class VaultErrorMessageComponent extends LitElement {
3737
- static styles: CSSResult[];
2463
+ static styles: import("lit").CSSResult[];
3738
2464
  /**
3739
2465
  * Strongly typed event declarations
3740
2466
  */
@@ -3751,7 +2477,7 @@ declare class VaultErrorMessageComponent extends LitElement {
3751
2477
  /**
3752
2478
  * Render method
3753
2479
  */
3754
- protected render(): TemplateResult<1>;
2480
+ protected render(): import("lit-html").TemplateResult<1>;
3755
2481
  }
3756
2482
  declare global {
3757
2483
  interface HTMLElementTagNameMap {
@@ -3764,7 +2490,7 @@ declare global {
3764
2490
  * Integrates with the vault manager context to handle payment submission.
3765
2491
  */
3766
2492
  declare class VaultPaymentSubmitComponent extends LitElement {
3767
- static styles: CSSResult[];
2493
+ static styles: import("lit").CSSResult[];
3768
2494
  private readonly _userAssignedProps;
3769
2495
  private _internalButtonText;
3770
2496
  /**
@@ -3773,10 +2499,10 @@ declare class VaultPaymentSubmitComponent extends LitElement {
3773
2499
  */
3774
2500
  get buttonText(): string;
3775
2501
  set buttonText(value: string);
3776
- headlessInstance: HeadlessUnitilsContext;
3777
- sdkState: SdkStateContext;
3778
- vaultItemContext: VaultItemContext;
3779
- vaultManager: VaultManagerContext;
2502
+ headlessInstance: HeadlessUnitilsContextType;
2503
+ sdkState: SdkStateContextType;
2504
+ vaultItemContext: VaultItemContextType;
2505
+ vaultManager: VaultManagerContextType;
3780
2506
  clientOptions: PrimerCheckoutOptions | null;
3781
2507
  /**
3782
2508
  * The button variant to use.
@@ -3799,7 +2525,7 @@ declare class VaultPaymentSubmitComponent extends LitElement {
3799
2525
  * Computed property to determine if the button should be disabled
3800
2526
  */
3801
2527
  private get isButtonDisabled();
3802
- render(): TemplateResult<1>;
2528
+ render(): import("lit-html").TemplateResult<1>;
3803
2529
  }
3804
2530
  declare global {
3805
2531
  interface HTMLElementTagNameMap {
@@ -3812,22 +2538,23 @@ declare global {
3812
2538
  * Uses dedicated CVV context to minimize re-renders
3813
2539
  */
3814
2540
  declare class VaultCvvInputComponent extends LitElement {
3815
- static styles: CSSResult[];
2541
+ static styles: import("lit").CSSResult[];
3816
2542
  /**
3817
2543
  * Form context for checking form dirty state
3818
2544
  */
3819
- vaultManagerFormContext: VaultManagerContext;
2545
+ vaultManagerFormContext: VaultManagerContextType;
3820
2546
  /**
3821
2547
  * CVV-specific context for dedicated CVV handling
3822
2548
  * Separated to minimize re-renders on frequent CVV input changes
3823
2549
  */
3824
- vaultManagerCvvContext: VaultItemContext;
2550
+ vaultManagerCvvContext: VaultItemContextType;
3825
2551
  computedStyles: CSSStyleDeclaration | null;
3826
2552
  paymentMethod: PaymentCardVaultedMethod | null;
3827
2553
  private cvvError;
3828
2554
  private cvvInputIsDirty;
3829
2555
  private cvvInputIsBlurred;
3830
2556
  private cvvInput;
2557
+ private isFocused;
3831
2558
  /**
3832
2559
  * Unique ID for the CVV input container
3833
2560
  */
@@ -3840,16 +2567,62 @@ declare class VaultCvvInputComponent extends LitElement {
3840
2567
  */
3841
2568
  onCvvInputChange(): void;
3842
2569
  onBlur(): void;
2570
+ onFocus(): void;
3843
2571
  /**
3844
2572
  * Main render method
3845
2573
  */
3846
- protected render(): symbol | TemplateResult<1> | undefined;
2574
+ protected render(): symbol | import("lit-html").TemplateResult<1> | undefined;
3847
2575
  }
3848
2576
  declare global {
3849
2577
  interface HTMLElementTagNameMap {
3850
2578
  "primer-vault-cvv-input": VaultCvvInputComponent;
3851
2579
  }
3852
2580
  }
2581
+ export interface CardPaymentMethodDisplay {
2582
+ type: "card";
2583
+ cardholderName: string;
2584
+ last4: string;
2585
+ expiresDate: string;
2586
+ network: string;
2587
+ description: string;
2588
+ }
2589
+ export interface OtherPaymentMethodDisplay {
2590
+ type: "other";
2591
+ fullName?: string;
2592
+ paymentMethodType?: "ACH" | "PayPal" | "Klarna";
2593
+ email?: string;
2594
+ last4?: string;
2595
+ bankName?: string;
2596
+ accountType?: string;
2597
+ description: string;
2598
+ }
2599
+ export type AssetConfig = ({
2600
+ icon: string;
2601
+ } & CardPaymentMethodDisplay & {
2602
+ shouldShowCVV: boolean;
2603
+ }) | ({
2604
+ icon: string;
2605
+ } & OtherPaymentMethodDisplay & {
2606
+ shouldShowCVV: boolean;
2607
+ });
2608
+ /**
2609
+ * PaymentMethodContentComponent - renders payment method information with icon and details
2610
+ * This component encapsulates the display logic and styles for payment method content
2611
+ * so it can be reused across different containers without style conflicts
2612
+ */
2613
+ export declare class PaymentMethodContentComponent extends LitElement {
2614
+ static styles: import("lit").CSSResult[];
2615
+ /**
2616
+ * The asset configuration containing icon and display data
2617
+ */
2618
+ assetConfig: AssetConfig | null;
2619
+ render(): typeof nothing | import("lit-html").TemplateResult<1>;
2620
+ }
2621
+ declare global {
2622
+ interface HTMLElementTagNameMap {
2623
+ "primer-payment-method-content": PaymentMethodContentComponent;
2624
+ }
2625
+ }
3853
2626
  declare global {
3854
2627
  interface HTMLElementTagNameMap {
3855
2628
  "primer-vault-manager": VaultManagerComponent;
@@ -3860,8 +2633,9 @@ declare global {
3860
2633
  * It handles form submission, validation, and provides context to child components.
3861
2634
  */
3862
2635
  declare class CardFormComponent extends LitElement {
3863
- static styles: CSSResult[];
2636
+ static styles: import("lit").CSSResult[];
3864
2637
  hideLabels: boolean;
2638
+ disabled: boolean;
3865
2639
  updated(changedProperties: Map<string, unknown>): void;
3866
2640
  /**
3867
2641
  * Tracks whether custom content has been provided via slot
@@ -3914,10 +2688,11 @@ declare class CardFormComponent extends LitElement {
3914
2688
  * Handles both native form submissions and custom events
3915
2689
  */
3916
2690
  private handleFormSubmit;
3917
- render(): typeof nothing | TemplateResult<1>;
2691
+ render(): typeof nothing | import("lit-html").TemplateResult<1>;
3918
2692
  }
3919
2693
  export interface CardFormContext {
3920
2694
  cardNumberInput: IHeadlessHostedInput;
2695
+ cardHolderNameInput?: IHeadlessHostedInput;
3921
2696
  expiryInput: IHeadlessHostedInput;
3922
2697
  cvvInput: IHeadlessHostedInput;
3923
2698
  setCardholderName: (val: string) => void;
@@ -3926,6 +2701,7 @@ export interface CardFormContext {
3926
2701
  submit: (values?: CardPaymentMethodSubmitValues) => Promise<void>;
3927
2702
  errors?: Validation["validationErrors"];
3928
2703
  hideLabels?: boolean;
2704
+ disabled?: boolean;
3929
2705
  }
3930
2706
  /**
3931
2707
  * A shared type that ensures the host of a HostedInputController contains
@@ -3942,162 +2718,6 @@ export interface HostedInputHost extends ReactiveControllerHost, LitElement {
3942
2718
  label: string;
3943
2719
  requestUpdate: ReactiveControllerHost["requestUpdate"];
3944
2720
  }
3945
- export interface TaskFunctionOptions {
3946
- signal: AbortSignal;
3947
- }
3948
- export type TaskFunction<D extends ReadonlyArray<unknown>, R = unknown> = (args: D, options: TaskFunctionOptions) => R | typeof initialState | Promise<R | typeof initialState>;
3949
- export type ArgsFunction<D extends ReadonlyArray<unknown>> = () => D;
3950
- declare const TaskStatus: {
3951
- readonly INITIAL: 0;
3952
- readonly PENDING: 1;
3953
- readonly COMPLETE: 2;
3954
- readonly ERROR: 3;
3955
- };
3956
- declare const initialState: unique symbol;
3957
- export type TaskStatus = (typeof TaskStatus)[keyof typeof TaskStatus];
3958
- export type StatusRenderer<R> = {
3959
- initial?: () => unknown;
3960
- pending?: () => unknown;
3961
- complete?: (value: R) => unknown;
3962
- error?: (error: unknown) => unknown;
3963
- };
3964
- export interface TaskConfig<T extends ReadonlyArray<unknown>, R> {
3965
- task: TaskFunction<T, R>;
3966
- args?: ArgsFunction<T>;
3967
- /**
3968
- * Determines if the task is run automatically when arguments change after a
3969
- * host update. Default to `true`.
3970
- *
3971
- * If `true`, the task checks arguments during the host update (after
3972
- * `willUpdate()` and before `update()` in Lit) and runs if they change. For
3973
- * a task to see argument changes they must be done in `willUpdate()` or
3974
- * earlier. The host element can see task status changes caused by its own
3975
- * current update.
3976
- *
3977
- * If `'afterUpdate'`, the task checks arguments and runs _after_ the host
3978
- * update. This means that the task can see host changes done in update, such
3979
- * as rendered DOM. The host element can not see task status changes caused
3980
- * by its own update, so the task must trigger a second host update to make
3981
- * those changes renderable.
3982
- *
3983
- * Note: `'afterUpdate'` is unlikely to be SSR compatible in the future.
3984
- *
3985
- * If `false`, the task is not run automatically, and must be run with the
3986
- * {@linkcode run} method.
3987
- */
3988
- autoRun?: boolean | "afterUpdate";
3989
- /**
3990
- * A function that determines if the current arg and previous args arrays are
3991
- * equal. If the argsEqual function returns true, the task will not auto-run.
3992
- *
3993
- * The default is {@linkcode shallowArrayEquals}. {@linkcode deepArrayEquals}
3994
- * is also available.
3995
- */
3996
- argsEqual?: (oldArgs: T, newArgs: T) => boolean;
3997
- /**
3998
- * If initialValue is provided, the task is initialized to the COMPLETE
3999
- * status and the value is set to initialData.
4000
- *
4001
- * Initial args should be coherent with the initialValue, since they are
4002
- * assumed to be the args that would produce that value. When autoRun is
4003
- * `true` the task will not auto-run again until the args change.
4004
- */
4005
- initialValue?: R;
4006
- onComplete?: (value: R) => unknown;
4007
- onError?: (error: unknown) => unknown;
4008
- }
4009
- declare class Task<const T extends ReadonlyArray<unknown> = ReadonlyArray<unknown>, const R = unknown> {
4010
- private _previousArgs?;
4011
- private _task;
4012
- private _argsFn?;
4013
- private _argsEqual;
4014
- private _callId;
4015
- private _host;
4016
- private _value?;
4017
- private _error?;
4018
- private _abortController?;
4019
- private _onComplete?;
4020
- private _onError?;
4021
- private _status;
4022
- /**
4023
- * Determines if the task is run automatically when arguments change after a
4024
- * host update. Default to `true`.
4025
- *
4026
- * @see {@link TaskConfig.autoRun} for more information.
4027
- */
4028
- autoRun: boolean | "afterUpdate";
4029
- /**
4030
- * A Promise that resolve when the current task run is complete.
4031
- *
4032
- * If a new task run is started while a previous run is pending, the Promise
4033
- * is kept and only resolved when the new run is completed.
4034
- */
4035
- get taskComplete(): Promise<R>;
4036
- private _resolveTaskComplete?;
4037
- private _rejectTaskComplete?;
4038
- private _taskComplete?;
4039
- constructor(host: ReactiveControllerHost, task: TaskConfig<T, R>);
4040
- constructor(host: ReactiveControllerHost, task: TaskFunction<T, R>, args?: ArgsFunction<T>);
4041
- hostUpdate(): void;
4042
- hostUpdated(): void;
4043
- private _getArgs;
4044
- /**
4045
- * Determines if the task should run when it's triggered because of a
4046
- * host update, and runs the task if it should.
4047
- *
4048
- * A task should run when its arguments change from the previous run, based on
4049
- * the args equality function.
4050
- *
4051
- * This method is side-effectful: it stores the new args as the previous args.
4052
- */
4053
- private _performTask;
4054
- /**
4055
- * Runs a task manually.
4056
- *
4057
- * This can be useful for running tasks in response to events as opposed to
4058
- * automatically running when host element state changes.
4059
- *
4060
- * @param args an optional set of arguments to use for this task run. If args
4061
- * is not given, the args function is called to get the arguments for
4062
- * this run.
4063
- */
4064
- run(args?: T): Promise<void>;
4065
- /**
4066
- * Aborts the currently pending task run by aborting the AbortSignal
4067
- * passed to the task function.
4068
- *
4069
- * Aborting a task does nothing if the task is not running: ie, in the
4070
- * complete, error, or initial states.
4071
- *
4072
- * Aborting a task does not automatically cancel the task function. The task
4073
- * function must be written to accept the AbortSignal and either forward it
4074
- * to other APIs like `fetch()`, or handle cancellation manually by using
4075
- * [`signal.throwIfAborted()`]{@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/throwIfAborted}
4076
- * or the
4077
- * [`abort`]{@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/abort_event}
4078
- * event.
4079
- *
4080
- * @param reason The reason for aborting. Passed to
4081
- * `AbortController.abort()`.
4082
- */
4083
- abort(reason?: unknown): void;
4084
- /**
4085
- * The result of the previous task run, if it resolved.
4086
- *
4087
- * Is `undefined` if the task has not run yet, or if the previous run errored.
4088
- */
4089
- get value(): R | undefined;
4090
- /**
4091
- * The error from the previous task run, if it rejected.
4092
- *
4093
- * Is `undefined` if the task has not run yet, or if the previous run
4094
- * completed successfully.
4095
- */
4096
- get error(): unknown;
4097
- get status(): TaskStatus;
4098
- render<T extends StatusRenderer<R>>(renderer: T): MaybeReturnType<T["initial"]> | MaybeReturnType<T["pending"]> | MaybeReturnType<T["complete"]> | MaybeReturnType<T["error"]>;
4099
- }
4100
- export type MaybeReturnType<F> = F extends (...args: never[]) => infer R ? R : undefined;
4101
2721
  /**
4102
2722
  * Available input types for hosted inputs.
4103
2723
  */
@@ -4256,13 +2876,13 @@ declare abstract class AbstractCardInputComponent extends LitElement implements
4256
2876
  /**
4257
2877
  * Common rendering logic for all card input components
4258
2878
  */
4259
- protected renderInput(): typeof nothing | TemplateResult<1>;
2879
+ protected renderInput(): typeof nothing | import("lit-html").TemplateResult<1>;
4260
2880
  }
4261
2881
  /**
4262
2882
  * Card number input component with dynamic card network detection and selection
4263
2883
  */
4264
2884
  declare class InputCardNumberComponent extends AbstractCardInputComponent {
4265
- static styles: CSSResult[];
2885
+ static styles: import("lit").CSSResult[];
4266
2886
  /**
4267
2887
  * Configuration for this input component
4268
2888
  */
@@ -4275,8 +2895,8 @@ declare class InputCardNumberComponent extends AbstractCardInputComponent {
4275
2895
  /**
4276
2896
  * Override the renderInput method to include the network selector
4277
2897
  */
4278
- protected renderInput(): typeof nothing | TemplateResult<1>;
4279
- render(): typeof nothing | TemplateResult<1>;
2898
+ protected renderInput(): typeof nothing | import("lit-html").TemplateResult<1>;
2899
+ render(): typeof nothing | import("lit-html").TemplateResult<1>;
4280
2900
  }
4281
2901
  declare global {
4282
2902
  interface HTMLElementTagNameMap {
@@ -4284,10 +2904,10 @@ declare global {
4284
2904
  }
4285
2905
  }
4286
2906
  declare class InputCvvComponent extends AbstractCardInputComponent {
4287
- static styles: CSSResult[];
2907
+ static styles: import("lit").CSSResult[];
4288
2908
  protected readonly config: InputComponentConfig;
4289
2909
  constructor();
4290
- render(): typeof nothing | TemplateResult<1>;
2910
+ render(): typeof import("lit-html").nothing | import("lit-html").TemplateResult<1>;
4291
2911
  }
4292
2912
  declare global {
4293
2913
  interface HTMLElementTagNameMap {
@@ -4295,10 +2915,10 @@ declare global {
4295
2915
  }
4296
2916
  }
4297
2917
  declare class InputCardExpiryComponent extends AbstractCardInputComponent {
4298
- static styles: CSSResult[];
2918
+ static styles: import("lit").CSSResult[];
4299
2919
  protected readonly config: InputComponentConfig;
4300
2920
  constructor();
4301
- render(): typeof nothing | TemplateResult<1>;
2921
+ render(): typeof import("lit-html").nothing | import("lit-html").TemplateResult<1>;
4302
2922
  }
4303
2923
  declare global {
4304
2924
  interface HTMLElementTagNameMap {
@@ -4306,11 +2926,11 @@ declare global {
4306
2926
  }
4307
2927
  }
4308
2928
  declare class InputCardHolderNameComponent extends AbstractCardInputComponent {
4309
- static styles: CSSResult[];
2929
+ static styles: import("lit").CSSResult[];
4310
2930
  protected readonly config: InputComponentConfig;
4311
2931
  constructor();
4312
2932
  private handleInput;
4313
- render(): typeof nothing | TemplateResult<1>;
2933
+ render(): typeof import("lit-html").nothing | import("lit-html").TemplateResult<1>;
4314
2934
  }
4315
2935
  declare global {
4316
2936
  interface HTMLElementTagNameMap {
@@ -4322,7 +2942,7 @@ declare global {
4322
2942
  * Provides a consistent submit button with translation support.
4323
2943
  */
4324
2944
  declare class CardFormSubmitComponent extends LitElement {
4325
- static styles: CSSResult[];
2945
+ static styles: import("lit").CSSResult[];
4326
2946
  private readonly _userAssignedProps;
4327
2947
  private _internalButtonText;
4328
2948
  /**
@@ -4331,9 +2951,10 @@ declare class CardFormSubmitComponent extends LitElement {
4331
2951
  */
4332
2952
  get buttonText(): string;
4333
2953
  set buttonText(value: string);
4334
- headlessInstance: HeadlessUnitilsContext;
4335
- clientOptions: ClientOptionsContext;
4336
- sdkState: SdkStateContext;
2954
+ headlessInstance: HeadlessUnitilsContextType;
2955
+ clientOptions: ClientOptionsContextType;
2956
+ sdkState: SdkStateContextType;
2957
+ cardFormContext: CardFormContext | null;
4337
2958
  /**
4338
2959
  * The button variant to use.
4339
2960
  * @default "primary"
@@ -4345,7 +2966,7 @@ declare class CardFormSubmitComponent extends LitElement {
4345
2966
  */
4346
2967
  disabled: boolean;
4347
2968
  private handleClick;
4348
- render(): TemplateResult<1>;
2969
+ render(): import("lit-html").TemplateResult<1>;
4349
2970
  }
4350
2971
  declare global {
4351
2972
  interface HTMLElementTagNameMap {
@@ -4359,12 +2980,12 @@ declare global {
4359
2980
  * @fires network-selected - Dispatched when a network is selected with the network name as detail
4360
2981
  */
4361
2982
  declare class CardNetworkSelectorComponent extends LitElement {
4362
- static styles: CSSResult[];
2983
+ static styles: import("lit").CSSResult[];
4363
2984
  /**
4364
2985
  * Card networks context from provider
4365
2986
  */
4366
- cardNetworks: CardNetworksContext;
4367
- headlessUtils: HeadlessUnitilsContext;
2987
+ cardNetworks: CardNetworksContextType;
2988
+ headlessUtils: HeadlessUnitilsContextType;
4368
2989
  private selectedCardNetwork;
4369
2990
  /**
4370
2991
  * Internal state to track if dropdown is open
@@ -4445,7 +3066,7 @@ declare class CardNetworkSelectorComponent extends LitElement {
4445
3066
  * Lifecycle: Remove all event listeners when disconnected
4446
3067
  */
4447
3068
  disconnectedCallback(): void;
4448
- render(): TemplateResult<1>;
3069
+ render(): import("lit-html").TemplateResult<1>;
4449
3070
  }
4450
3071
  declare global {
4451
3072
  interface HTMLElementTagNameMap {
@@ -4462,12 +3083,12 @@ declare global {
4462
3083
  * Utilizes the collapsable component for smooth transitions
4463
3084
  */
4464
3085
  declare class ShowOtherPaymentsComponent extends LitElement {
4465
- static styles: CSSResult[];
3086
+ static styles: import("lit").CSSResult[];
4466
3087
  /**
4467
3088
  * Consume the vault manager context to interact with vault state
4468
3089
  */
4469
- vaultManager: VaultManagerContext;
4470
- render(): typeof nothing | TemplateResult<1>;
3090
+ vaultManager: VaultManagerContextType;
3091
+ render(): typeof nothing | import("lit-html").TemplateResult<1>;
4471
3092
  }
4472
3093
  declare global {
4473
3094
  interface HTMLElementTagNameMap {
@@ -4479,13 +3100,16 @@ declare global {
4479
3100
  * with proper height calculations based on design system variables.
4480
3101
  */
4481
3102
  declare class NativePaymentComponent extends LitElement {
4482
- static styles: CSSResult[];
3103
+ static styles: import("lit").CSSResult[];
4483
3104
  paymentMethod: InitializedPaymentMethod | undefined;
4484
3105
  paymentManagers: InitializedManagersMap;
4485
3106
  computedStyles: CSSStyleDeclaration | null;
3107
+ disabled: boolean;
4486
3108
  private _buttonId;
4487
3109
  private loadManagerTask;
3110
+ private nativeButtonTask;
4488
3111
  constructor();
3112
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
4489
3113
  /**
4490
3114
  * Calculates the button height based on CSS variables
4491
3115
  * Mirrors the calculation used in the host styles
@@ -4496,7 +3120,13 @@ declare class NativePaymentComponent extends LitElement {
4496
3120
  */
4497
3121
  private createRenderOptions;
4498
3122
  protected updated(changedProperties: PropertyValues): void;
4499
- render(): symbol | TemplateResult<1> | undefined;
3123
+ /**
3124
+ * Updates the disabled overlay based on the current disabled state
3125
+ */
3126
+ private updateDisabledOverlay;
3127
+ private updateGooglePayOverlay;
3128
+ private updateRegularOverlay;
3129
+ render(): symbol | import("lit-html").TemplateResult<1> | undefined;
4500
3130
  }
4501
3131
  declare global {
4502
3132
  interface HTMLElementTagNameMap {
@@ -4504,7 +3134,7 @@ declare global {
4504
3134
  }
4505
3135
  }
4506
3136
  declare class PrimerCheckoutCompleteComponent extends LitElement {
4507
- render(): TemplateResult<1>;
3137
+ render(): import("lit-html").TemplateResult<1>;
4508
3138
  }
4509
3139
  declare global {
4510
3140
  interface HTMLElementTagNameMap {
@@ -4512,8 +3142,8 @@ declare global {
4512
3142
  }
4513
3143
  }
4514
3144
  declare class PrimerCheckoutErrorComponent extends LitElement {
4515
- sdkState: SdkStateContext;
4516
- render(): TemplateResult<1>;
3145
+ sdkState: SdkStateContextType;
3146
+ render(): import("lit-html").TemplateResult<1>;
4517
3147
  }
4518
3148
  declare global {
4519
3149
  interface HTMLElementTagNameMap {
@@ -4529,12 +3159,12 @@ declare global {
4529
3159
  * and how they are displayed based on the current SDK state.
4530
3160
  */
4531
3161
  declare class ErrorMessageContainerComponent extends LitElement {
4532
- static styles: CSSResult[];
3162
+ static styles: import("lit").CSSResult[];
4533
3163
  /**
4534
3164
  * Consume the SDK state context
4535
3165
  * This automatically subscribes to changes in the SDK state
4536
3166
  */
4537
- protected sdkState?: SdkStateContext;
3167
+ protected sdkState?: SdkStateContextType;
4538
3168
  showProcessingErrors: boolean;
4539
3169
  /**
4540
3170
  * Determine if an error should be shown
@@ -4543,7 +3173,7 @@ declare class ErrorMessageContainerComponent extends LitElement {
4543
3173
  * @returns Boolean indicating whether an error should be shown
4544
3174
  */
4545
3175
  private get shouldShowError();
4546
- render(): typeof nothing | TemplateResult<1>;
3176
+ render(): typeof nothing | import("lit-html").TemplateResult<1>;
4547
3177
  }
4548
3178
  declare global {
4549
3179
  interface HTMLElementTagNameMap {
@@ -4551,16 +3181,17 @@ declare global {
4551
3181
  }
4552
3182
  }
4553
3183
  declare class PrimerMainComponent extends LitElement {
4554
- static styles: CSSResult[];
3184
+ static styles: import("lit").CSSResult[];
4555
3185
  private hasAssignedContent;
4556
3186
  /**
4557
3187
  * Inline slotchange event listener.
4558
3188
  * Uses assignedNodes with flatten to detect if the slot has any nodes.
4559
3189
  */
4560
3190
  private onSlotChange;
4561
- paymentMethods: PaymentMethodsContext;
4562
- sdkState: SdkStateContext;
4563
- render(): TemplateResult<1>;
3191
+ paymentMethods: PaymentMethodsContextType;
3192
+ sdkState: SdkStateContextType;
3193
+ clientOptions: ClientOptionsContextType;
3194
+ render(): import("lit-html").TemplateResult<1>;
4564
3195
  }
4565
3196
  declare global {
4566
3197
  interface HTMLElementTagNameMap {
@@ -4569,14 +3200,8 @@ declare global {
4569
3200
  }
4570
3201
  /**
4571
3202
  * Main function to load the Primer SDK with all required dependencies and styles
4572
- * @returns {Promise<void>} A promise that resolves when loading is complete
4573
3203
  */
4574
- export declare function loadPrimer(): Promise<void>;
4575
- declare global {
4576
- interface HTMLElementTagNameMap {
4577
- "primer-checkout": PrimerCheckoutComponent;
4578
- }
4579
- }
3204
+ export declare function loadPrimer(): void;
4580
3205
 
4581
3206
  export {
4582
3207
  AchPaymentComponent as AchPayment,