@primer-io/primer-js 0.0.1 → 0.0.2

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.
@@ -0,0 +1,3234 @@
1
+ export declare function loadPrimer(): Promise<void>;
2
+ export type CardNetwork = {
3
+ displayName: string;
4
+ network: string;
5
+ iconUrl: string;
6
+ };
7
+ export type CardNetworksContext = {
8
+ detectedCardNetwork: CardNetwork | null;
9
+ selectableCardNetworks: CardNetwork[];
10
+ isLoading: boolean;
11
+ };
12
+ /**
13
+ * A CSSResult or native CSSStyleSheet.
14
+ *
15
+ * In browsers that support constructible CSS style sheets, CSSStyleSheet
16
+ * object can be used for styling along side CSSResult from the `css`
17
+ * template tag.
18
+ */
19
+ export type CSSResultOrNative = CSSResult | CSSStyleSheet;
20
+ export type CSSResultArray = Array<CSSResultOrNative | CSSResultArray>;
21
+ /**
22
+ * A single CSSResult, CSSStyleSheet, or an array or nested arrays of those.
23
+ */
24
+ export type CSSResultGroup = CSSResultOrNative | CSSResultArray;
25
+ declare class CSSResult {
26
+ ["_$cssResult$"]: boolean;
27
+ readonly cssText: string;
28
+ private _styleSheet?;
29
+ private _strings;
30
+ private constructor();
31
+ get styleSheet(): CSSStyleSheet | undefined;
32
+ toString(): string;
33
+ }
34
+ /**
35
+ * @license
36
+ * Copyright 2021 Google LLC
37
+ * SPDX-License-Identifier: BSD-3-Clause
38
+ */
39
+ /**
40
+ * An object that can host Reactive Controllers and call their lifecycle
41
+ * callbacks.
42
+ */
43
+ export interface ReactiveControllerHost {
44
+ /**
45
+ * Adds a controller to the host, which sets up the controller's lifecycle
46
+ * methods to be called with the host's lifecycle.
47
+ */
48
+ addController(controller: ReactiveController): void;
49
+ /**
50
+ * Removes a controller from the host.
51
+ */
52
+ removeController(controller: ReactiveController): void;
53
+ /**
54
+ * Requests a host update which is processed asynchronously. The update can
55
+ * be waited on via the `updateComplete` property.
56
+ */
57
+ requestUpdate(): void;
58
+ /**
59
+ * Returns a Promise that resolves when the host has completed updating.
60
+ * The Promise value is a boolean that is `true` if the element completed the
61
+ * update without triggering another update. The Promise result is `false` if
62
+ * a property was set inside `updated()`. If the Promise is rejected, an
63
+ * exception was thrown during the update.
64
+ *
65
+ * @return A promise of a boolean that indicates if the update resolved
66
+ * without triggering another update.
67
+ */
68
+ readonly updateComplete: Promise<boolean>;
69
+ }
70
+ /**
71
+ * A Reactive Controller is an object that enables sub-component code
72
+ * organization and reuse by aggregating the state, behavior, and lifecycle
73
+ * hooks related to a single feature.
74
+ *
75
+ * Controllers are added to a host component, or other object that implements
76
+ * the `ReactiveControllerHost` interface, via the `addController()` method.
77
+ * They can hook their host components's lifecycle by implementing one or more
78
+ * of the lifecycle callbacks, or initiate an update of the host component by
79
+ * calling `requestUpdate()` on the host.
80
+ */
81
+ export interface ReactiveController {
82
+ /**
83
+ * Called when the host is connected to the component tree. For custom
84
+ * element hosts, this corresponds to the `connectedCallback()` lifecycle,
85
+ * which is only called when the component is connected to the document.
86
+ */
87
+ hostConnected?(): void;
88
+ /**
89
+ * Called when the host is disconnected from the component tree. For custom
90
+ * element hosts, this corresponds to the `disconnectedCallback()` lifecycle,
91
+ * which is called the host or an ancestor component is disconnected from the
92
+ * document.
93
+ */
94
+ hostDisconnected?(): void;
95
+ /**
96
+ * Called during the client-side host update, just before the host calls
97
+ * its own update.
98
+ *
99
+ * Code in `update()` can depend on the DOM as it is not called in
100
+ * server-side rendering.
101
+ */
102
+ hostUpdate?(): void;
103
+ /**
104
+ * Called after a host update, just before the host calls firstUpdated and
105
+ * updated. It is not called in server-side rendering.
106
+ *
107
+ */
108
+ hostUpdated?(): void;
109
+ }
110
+ /**
111
+ * Converts property values to and from attribute values.
112
+ */
113
+ export interface ComplexAttributeConverter<Type = unknown, TypeHint = unknown> {
114
+ /**
115
+ * Called to convert an attribute value to a property
116
+ * value.
117
+ */
118
+ fromAttribute?(value: string | null, type?: TypeHint): Type;
119
+ /**
120
+ * Called to convert a property value to an attribute
121
+ * value.
122
+ *
123
+ * It returns unknown instead of string, to be compatible with
124
+ * https://github.com/WICG/trusted-types (and similar efforts).
125
+ */
126
+ toAttribute?(value: Type, type?: TypeHint): unknown;
127
+ }
128
+ export type AttributeConverter<Type = unknown, TypeHint = unknown> = ComplexAttributeConverter<Type> | ((value: string | null, type?: TypeHint) => Type);
129
+ /**
130
+ * Defines options for a property accessor.
131
+ */
132
+ export interface PropertyDeclaration<Type = unknown, TypeHint = unknown> {
133
+ /**
134
+ * When set to `true`, indicates the property is internal private state. The
135
+ * property should not be set by users. When using TypeScript, this property
136
+ * should be marked as `private` or `protected`, and it is also a common
137
+ * practice to use a leading `_` in the name. The property is not added to
138
+ * `observedAttributes`.
139
+ */
140
+ readonly state?: boolean;
141
+ /**
142
+ * Indicates how and whether the property becomes an observed attribute.
143
+ * If the value is `false`, the property is not added to `observedAttributes`.
144
+ * If true or absent, the lowercased property name is observed (e.g. `fooBar`
145
+ * becomes `foobar`). If a string, the string value is observed (e.g
146
+ * `attribute: 'foo-bar'`).
147
+ */
148
+ readonly attribute?: boolean | string;
149
+ /**
150
+ * Indicates the type of the property. This is used only as a hint for the
151
+ * `converter` to determine how to convert the attribute
152
+ * to/from a property.
153
+ */
154
+ readonly type?: TypeHint;
155
+ /**
156
+ * Indicates how to convert the attribute to/from a property. If this value
157
+ * is a function, it is used to convert the attribute value a the property
158
+ * value. If it's an object, it can have keys for `fromAttribute` and
159
+ * `toAttribute`. If no `toAttribute` function is provided and
160
+ * `reflect` is set to `true`, the property value is set directly to the
161
+ * attribute. A default `converter` is used if none is provided; it supports
162
+ * `Boolean`, `String`, `Number`, `Object`, and `Array`. Note,
163
+ * when a property changes and the converter is used to update the attribute,
164
+ * the property is never updated again as a result of the attribute changing,
165
+ * and vice versa.
166
+ */
167
+ readonly converter?: AttributeConverter<Type, TypeHint>;
168
+ /**
169
+ * Indicates if the property should reflect to an attribute.
170
+ * If `true`, when the property is set, the attribute is set using the
171
+ * attribute name determined according to the rules for the `attribute`
172
+ * property option and the value of the property converted using the rules
173
+ * from the `converter` property option.
174
+ */
175
+ readonly reflect?: boolean;
176
+ /**
177
+ * A function that indicates if a property should be considered changed when
178
+ * it is set. The function should take the `newValue` and `oldValue` and
179
+ * return `true` if an update should be requested.
180
+ */
181
+ hasChanged?(value: Type, oldValue: Type): boolean;
182
+ /**
183
+ * Indicates whether an accessor will be created for this property. By
184
+ * default, an accessor will be generated for this property that requests an
185
+ * update when set. If this flag is `true`, no accessor will be created, and
186
+ * it will be the user's responsibility to call
187
+ * `this.requestUpdate(propertyName, oldValue)` to request an update when
188
+ * the property changes.
189
+ */
190
+ readonly noAccessor?: boolean;
191
+ }
192
+ /**
193
+ * Map of properties to PropertyDeclaration options. For each property an
194
+ * accessor is made, and the property is processed according to the
195
+ * PropertyDeclaration options.
196
+ */
197
+ export interface PropertyDeclarations {
198
+ readonly [key: string]: PropertyDeclaration;
199
+ }
200
+ export type PropertyDeclarationMap = Map<PropertyKey, PropertyDeclaration>;
201
+ /**
202
+ * A Map of property keys to values.
203
+ *
204
+ * Takes an optional type parameter T, which when specified as a non-any,
205
+ * non-unknown type, will make the Map more strongly-typed, associating the map
206
+ * keys with their corresponding value type on T.
207
+ *
208
+ * Use `PropertyValues<this>` when overriding ReactiveElement.update() and
209
+ * other lifecycle methods in order to get stronger type-checking on keys
210
+ * and values.
211
+ */
212
+ export type PropertyValues<T = any> = T extends object ? PropertyValueMap<T> : Map<PropertyKey, unknown>;
213
+ /**
214
+ * Do not use, instead prefer {@linkcode PropertyValues}.
215
+ */
216
+ export interface PropertyValueMap<T> extends Map<PropertyKey, unknown> {
217
+ get<K extends keyof T>(k: K): T[K] | undefined;
218
+ set<K extends keyof T>(key: K, value: T[K]): this;
219
+ has<K extends keyof T>(k: K): boolean;
220
+ delete<K extends keyof T>(k: K): boolean;
221
+ }
222
+ /**
223
+ * A string representing one of the supported dev mode warning categories.
224
+ */
225
+ export type WarningKind = "change-in-update" | "migration" | "async-perform-update";
226
+ export type Initializer = (element: ReactiveElement) => void;
227
+ declare global {
228
+ interface SymbolConstructor {
229
+ readonly metadata: unique symbol;
230
+ }
231
+ }
232
+ declare global {
233
+ var litPropertyMetadata: WeakMap<object, Map<PropertyKey, PropertyDeclaration>>;
234
+ }
235
+ declare abstract class ReactiveElement extends HTMLElement implements ReactiveControllerHost {
236
+ /**
237
+ * Read or set all the enabled warning categories for this class.
238
+ *
239
+ * This property is only used in development builds.
240
+ *
241
+ * @nocollapse
242
+ * @category dev-mode
243
+ */
244
+ static enabledWarnings?: WarningKind[];
245
+ /**
246
+ * Enable the given warning category for this class.
247
+ *
248
+ * This method only exists in development builds, so it should be accessed
249
+ * with a guard like:
250
+ *
251
+ * ```ts
252
+ * // Enable for all ReactiveElement subclasses
253
+ * ReactiveElement.enableWarning?.('migration');
254
+ *
255
+ * // Enable for only MyElement and subclasses
256
+ * MyElement.enableWarning?.('migration');
257
+ * ```
258
+ *
259
+ * @nocollapse
260
+ * @category dev-mode
261
+ */
262
+ static enableWarning?: (warningKind: WarningKind) => void;
263
+ /**
264
+ * Disable the given warning category for this class.
265
+ *
266
+ * This method only exists in development builds, so it should be accessed
267
+ * with a guard like:
268
+ *
269
+ * ```ts
270
+ * // Disable for all ReactiveElement subclasses
271
+ * ReactiveElement.disableWarning?.('migration');
272
+ *
273
+ * // Disable for only MyElement and subclasses
274
+ * MyElement.disableWarning?.('migration');
275
+ * ```
276
+ *
277
+ * @nocollapse
278
+ * @category dev-mode
279
+ */
280
+ static disableWarning?: (warningKind: WarningKind) => void;
281
+ /**
282
+ * Adds an initializer function to the class that is called during instance
283
+ * construction.
284
+ *
285
+ * This is useful for code that runs against a `ReactiveElement`
286
+ * subclass, such as a decorator, that needs to do work for each
287
+ * instance, such as setting up a `ReactiveController`.
288
+ *
289
+ * ```ts
290
+ * const myDecorator = (target: typeof ReactiveElement, key: string) => {
291
+ * target.addInitializer((instance: ReactiveElement) => {
292
+ * // This is run during construction of the element
293
+ * new MyController(instance);
294
+ * });
295
+ * }
296
+ * ```
297
+ *
298
+ * Decorating a field will then cause each instance to run an initializer
299
+ * that adds a controller:
300
+ *
301
+ * ```ts
302
+ * class MyElement extends LitElement {
303
+ * @myDecorator foo;
304
+ * }
305
+ * ```
306
+ *
307
+ * Initializers are stored per-constructor. Adding an initializer to a
308
+ * subclass does not add it to a superclass. Since initializers are run in
309
+ * constructors, initializers will run in order of the class hierarchy,
310
+ * starting with superclasses and progressing to the instance's class.
311
+ *
312
+ * @nocollapse
313
+ */
314
+ static addInitializer(initializer: Initializer): void;
315
+ static _initializers?: Initializer[];
316
+ /**
317
+ * Maps attribute names to properties; for example `foobar` attribute to
318
+ * `fooBar` property. Created lazily on user subclasses when finalizing the
319
+ * class.
320
+ * @nocollapse
321
+ */
322
+ private static __attributeToPropertyMap;
323
+ /**
324
+ * Marks class as having been finalized, which includes creating properties
325
+ * from `static properties`, but does *not* include all properties created
326
+ * from decorators.
327
+ * @nocollapse
328
+ */
329
+ protected static finalized: true | undefined;
330
+ /**
331
+ * Memoized list of all element properties, including any superclass
332
+ * properties. Created lazily on user subclasses when finalizing the class.
333
+ *
334
+ * @nocollapse
335
+ * @category properties
336
+ */
337
+ static elementProperties: PropertyDeclarationMap;
338
+ /**
339
+ * User-supplied object that maps property names to `PropertyDeclaration`
340
+ * objects containing options for configuring reactive properties. When
341
+ * a reactive property is set the element will update and render.
342
+ *
343
+ * By default properties are public fields, and as such, they should be
344
+ * considered as primarily settable by element users, either via attribute or
345
+ * the property itself.
346
+ *
347
+ * Generally, properties that are changed by the element should be private or
348
+ * protected fields and should use the `state: true` option. Properties
349
+ * marked as `state` do not reflect from the corresponding attribute
350
+ *
351
+ * However, sometimes element code does need to set a public property. This
352
+ * should typically only be done in response to user interaction, and an event
353
+ * should be fired informing the user; for example, a checkbox sets its
354
+ * `checked` property when clicked and fires a `changed` event. Mutating
355
+ * public properties should typically not be done for non-primitive (object or
356
+ * array) properties. In other cases when an element needs to manage state, a
357
+ * private property set with the `state: true` option should be used. When
358
+ * needed, state properties can be initialized via public properties to
359
+ * facilitate complex interactions.
360
+ * @nocollapse
361
+ * @category properties
362
+ */
363
+ static properties: PropertyDeclarations;
364
+ /**
365
+ * Memoized list of all element styles.
366
+ * Created lazily on user subclasses when finalizing the class.
367
+ * @nocollapse
368
+ * @category styles
369
+ */
370
+ static elementStyles: Array<CSSResultOrNative>;
371
+ /**
372
+ * Array of styles to apply to the element. The styles should be defined
373
+ * using the {@linkcode css} tag function, via constructible stylesheets, or
374
+ * imported from native CSS module scripts.
375
+ *
376
+ * Note on Content Security Policy:
377
+ *
378
+ * Element styles are implemented with `<style>` tags when the browser doesn't
379
+ * support adopted StyleSheets. To use such `<style>` tags with the style-src
380
+ * CSP directive, the style-src value must either include 'unsafe-inline' or
381
+ * `nonce-<base64-value>` with `<base64-value>` replaced be a server-generated
382
+ * nonce.
383
+ *
384
+ * To provide a nonce to use on generated `<style>` elements, set
385
+ * `window.litNonce` to a server-generated nonce in your page's HTML, before
386
+ * loading application code:
387
+ *
388
+ * ```html
389
+ * <script>
390
+ * // Generated and unique per request:
391
+ * window.litNonce = 'a1b2c3d4';
392
+ * </script>
393
+ * ```
394
+ * @nocollapse
395
+ * @category styles
396
+ */
397
+ static styles?: CSSResultGroup;
398
+ /**
399
+ * Returns a list of attributes corresponding to the registered properties.
400
+ * @nocollapse
401
+ * @category attributes
402
+ */
403
+ static get observedAttributes(): string[];
404
+ private __instanceProperties?;
405
+ /**
406
+ * Creates a property accessor on the element prototype if one does not exist
407
+ * and stores a {@linkcode PropertyDeclaration} for the property with the
408
+ * given options. The property setter calls the property's `hasChanged`
409
+ * property option or uses a strict identity check to determine whether or not
410
+ * to request an update.
411
+ *
412
+ * This method may be overridden to customize properties; however,
413
+ * when doing so, it's important to call `super.createProperty` to ensure
414
+ * the property is setup correctly. This method calls
415
+ * `getPropertyDescriptor` internally to get a descriptor to install.
416
+ * To customize what properties do when they are get or set, override
417
+ * `getPropertyDescriptor`. To customize the options for a property,
418
+ * implement `createProperty` like this:
419
+ *
420
+ * ```ts
421
+ * static createProperty(name, options) {
422
+ * options = Object.assign(options, {myOption: true});
423
+ * super.createProperty(name, options);
424
+ * }
425
+ * ```
426
+ *
427
+ * @nocollapse
428
+ * @category properties
429
+ */
430
+ static createProperty(name: PropertyKey, options?: PropertyDeclaration): void;
431
+ /**
432
+ * Returns a property descriptor to be defined on the given named property.
433
+ * If no descriptor is returned, the property will not become an accessor.
434
+ * For example,
435
+ *
436
+ * ```ts
437
+ * class MyElement extends LitElement {
438
+ * static getPropertyDescriptor(name, key, options) {
439
+ * const defaultDescriptor =
440
+ * super.getPropertyDescriptor(name, key, options);
441
+ * const setter = defaultDescriptor.set;
442
+ * return {
443
+ * get: defaultDescriptor.get,
444
+ * set(value) {
445
+ * setter.call(this, value);
446
+ * // custom action.
447
+ * },
448
+ * configurable: true,
449
+ * enumerable: true
450
+ * }
451
+ * }
452
+ * }
453
+ * ```
454
+ *
455
+ * @nocollapse
456
+ * @category properties
457
+ */
458
+ protected static getPropertyDescriptor(name: PropertyKey, key: string | symbol, options: PropertyDeclaration): PropertyDescriptor | undefined;
459
+ /**
460
+ * Returns the property options associated with the given property.
461
+ * These options are defined with a `PropertyDeclaration` via the `properties`
462
+ * object or the `@property` decorator and are registered in
463
+ * `createProperty(...)`.
464
+ *
465
+ * Note, this method should be considered "final" and not overridden. To
466
+ * customize the options for a given property, override
467
+ * {@linkcode createProperty}.
468
+ *
469
+ * @nocollapse
470
+ * @final
471
+ * @category properties
472
+ */
473
+ static getPropertyOptions(name: PropertyKey): PropertyDeclaration<unknown, unknown>;
474
+ static [Symbol.metadata]: object & Record<PropertyKey, unknown>;
475
+ /**
476
+ * Initializes static own properties of the class used in bookkeeping
477
+ * for element properties, initializers, etc.
478
+ *
479
+ * Can be called multiple times by code that needs to ensure these
480
+ * properties exist before using them.
481
+ *
482
+ * This method ensures the superclass is finalized so that inherited
483
+ * property metadata can be copied down.
484
+ * @nocollapse
485
+ */
486
+ private static __prepare;
487
+ /**
488
+ * Finishes setting up the class so that it's ready to be registered
489
+ * as a custom element and instantiated.
490
+ *
491
+ * This method is called by the ReactiveElement.observedAttributes getter.
492
+ * If you override the observedAttributes getter, you must either call
493
+ * super.observedAttributes to trigger finalization, or call finalize()
494
+ * yourself.
495
+ *
496
+ * @nocollapse
497
+ */
498
+ protected static finalize(): void;
499
+ /**
500
+ * Options used when calling `attachShadow`. Set this property to customize
501
+ * the options for the shadowRoot; for example, to create a closed
502
+ * shadowRoot: `{mode: 'closed'}`.
503
+ *
504
+ * Note, these options are used in `createRenderRoot`. If this method
505
+ * is customized, options should be respected if possible.
506
+ * @nocollapse
507
+ * @category rendering
508
+ */
509
+ static shadowRootOptions: ShadowRootInit;
510
+ /**
511
+ * Takes the styles the user supplied via the `static styles` property and
512
+ * returns the array of styles to apply to the element.
513
+ * Override this method to integrate into a style management system.
514
+ *
515
+ * Styles are deduplicated preserving the _last_ instance in the list. This
516
+ * is a performance optimization to avoid duplicated styles that can occur
517
+ * especially when composing via subclassing. The last item is kept to try
518
+ * to preserve the cascade order with the assumption that it's most important
519
+ * that last added styles override previous styles.
520
+ *
521
+ * @nocollapse
522
+ * @category styles
523
+ */
524
+ protected static finalizeStyles(styles?: CSSResultGroup): Array<CSSResultOrNative>;
525
+ /**
526
+ * Node or ShadowRoot into which element DOM should be rendered. Defaults
527
+ * to an open shadowRoot.
528
+ * @category rendering
529
+ */
530
+ readonly renderRoot: HTMLElement | DocumentFragment;
531
+ /**
532
+ * Returns the property name for the given attribute `name`.
533
+ * @nocollapse
534
+ */
535
+ private static __attributeNameForProperty;
536
+ private __updatePromise;
537
+ /**
538
+ * True if there is a pending update as a result of calling `requestUpdate()`.
539
+ * Should only be read.
540
+ * @category updates
541
+ */
542
+ isUpdatePending: boolean;
543
+ /**
544
+ * Is set to `true` after the first update. The element code cannot assume
545
+ * that `renderRoot` exists before the element `hasUpdated`.
546
+ * @category updates
547
+ */
548
+ hasUpdated: boolean;
549
+ /**
550
+ * Properties that should be reflected when updated.
551
+ */
552
+ private __reflectingProperties?;
553
+ /**
554
+ * Name of currently reflecting property
555
+ */
556
+ private __reflectingProperty;
557
+ /**
558
+ * Set of controllers.
559
+ */
560
+ private __controllers?;
561
+ constructor();
562
+ /**
563
+ * Internal only override point for customizing work done when elements
564
+ * are constructed.
565
+ */
566
+ private __initialize;
567
+ /**
568
+ * Registers a `ReactiveController` to participate in the element's reactive
569
+ * update cycle. The element automatically calls into any registered
570
+ * controllers during its lifecycle callbacks.
571
+ *
572
+ * If the element is connected when `addController()` is called, the
573
+ * controller's `hostConnected()` callback will be immediately called.
574
+ * @category controllers
575
+ */
576
+ addController(controller: ReactiveController): void;
577
+ /**
578
+ * Removes a `ReactiveController` from the element.
579
+ * @category controllers
580
+ */
581
+ removeController(controller: ReactiveController): void;
582
+ /**
583
+ * Fixes any properties set on the instance before upgrade time.
584
+ * Otherwise these would shadow the accessor and break these properties.
585
+ * The properties are stored in a Map which is played back after the
586
+ * constructor runs. Note, on very old versions of Safari (<=9) or Chrome
587
+ * (<=41), properties created for native platform properties like (`id` or
588
+ * `name`) may not have default values set in the element constructor. On
589
+ * these browsers native properties appear on instances and therefore their
590
+ * default value will overwrite any element default (e.g. if the element sets
591
+ * this.id = 'id' in the constructor, the 'id' will become '' since this is
592
+ * the native platform default).
593
+ */
594
+ private __saveInstanceProperties;
595
+ /**
596
+ * Returns the node into which the element should render and by default
597
+ * creates and returns an open shadowRoot. Implement to customize where the
598
+ * element's DOM is rendered. For example, to render into the element's
599
+ * childNodes, return `this`.
600
+ *
601
+ * @return Returns a node into which to render.
602
+ * @category rendering
603
+ */
604
+ protected createRenderRoot(): HTMLElement | DocumentFragment;
605
+ /**
606
+ * On first connection, creates the element's renderRoot, sets up
607
+ * element styling, and enables updating.
608
+ * @category lifecycle
609
+ */
610
+ connectedCallback(): void;
611
+ /**
612
+ * Note, this method should be considered final and not overridden. It is
613
+ * overridden on the element instance with a function that triggers the first
614
+ * update.
615
+ * @category updates
616
+ */
617
+ protected enableUpdating(_requestedUpdate: boolean): void;
618
+ /**
619
+ * Allows for `super.disconnectedCallback()` in extensions while
620
+ * reserving the possibility of making non-breaking feature additions
621
+ * when disconnecting at some point in the future.
622
+ * @category lifecycle
623
+ */
624
+ disconnectedCallback(): void;
625
+ /**
626
+ * Synchronizes property values when attributes change.
627
+ *
628
+ * Specifically, when an attribute is set, the corresponding property is set.
629
+ * You should rarely need to implement this callback. If this method is
630
+ * overridden, `super.attributeChangedCallback(name, _old, value)` must be
631
+ * called.
632
+ *
633
+ * See [using the lifecycle callbacks](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks)
634
+ * on MDN for more information about the `attributeChangedCallback`.
635
+ * @category attributes
636
+ */
637
+ attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
638
+ private __propertyToAttribute;
639
+ /**
640
+ * Requests an update which is processed asynchronously. This should be called
641
+ * when an element should update based on some state not triggered by setting
642
+ * a reactive property. In this case, pass no arguments. It should also be
643
+ * called when manually implementing a property setter. In this case, pass the
644
+ * property `name` and `oldValue` to ensure that any configured property
645
+ * options are honored.
646
+ *
647
+ * @param name name of requesting property
648
+ * @param oldValue old value of requesting property
649
+ * @param options property options to use instead of the previously
650
+ * configured options
651
+ * @category updates
652
+ */
653
+ requestUpdate(name?: PropertyKey, oldValue?: unknown, options?: PropertyDeclaration): void;
654
+ /**
655
+ * Sets up the element to asynchronously update.
656
+ */
657
+ private __enqueueUpdate;
658
+ /**
659
+ * Schedules an element update. You can override this method to change the
660
+ * timing of updates by returning a Promise. The update will await the
661
+ * returned Promise, and you should resolve the Promise to allow the update
662
+ * to proceed. If this method is overridden, `super.scheduleUpdate()`
663
+ * must be called.
664
+ *
665
+ * For instance, to schedule updates to occur just before the next frame:
666
+ *
667
+ * ```ts
668
+ * override protected async scheduleUpdate(): Promise<unknown> {
669
+ * await new Promise((resolve) => requestAnimationFrame(() => resolve()));
670
+ * super.scheduleUpdate();
671
+ * }
672
+ * ```
673
+ * @category updates
674
+ */
675
+ protected scheduleUpdate(): void | Promise<unknown>;
676
+ /**
677
+ * Performs an element update. Note, if an exception is thrown during the
678
+ * update, `firstUpdated` and `updated` will not be called.
679
+ *
680
+ * Call `performUpdate()` to immediately process a pending update. This should
681
+ * generally not be needed, but it can be done in rare cases when you need to
682
+ * update synchronously.
683
+ *
684
+ * @category updates
685
+ */
686
+ protected performUpdate(): void;
687
+ /**
688
+ * Invoked before `update()` to compute values needed during the update.
689
+ *
690
+ * Implement `willUpdate` to compute property values that depend on other
691
+ * properties and are used in the rest of the update process.
692
+ *
693
+ * ```ts
694
+ * willUpdate(changedProperties) {
695
+ * // only need to check changed properties for an expensive computation.
696
+ * if (changedProperties.has('firstName') || changedProperties.has('lastName')) {
697
+ * this.sha = computeSHA(`${this.firstName} ${this.lastName}`);
698
+ * }
699
+ * }
700
+ *
701
+ * render() {
702
+ * return html`SHA: ${this.sha}`;
703
+ * }
704
+ * ```
705
+ *
706
+ * @category updates
707
+ */
708
+ protected willUpdate(_changedProperties: PropertyValues): void;
709
+ private __markUpdated;
710
+ /**
711
+ * Returns a Promise that resolves when the element has completed updating.
712
+ * The Promise value is a boolean that is `true` if the element completed the
713
+ * update without triggering another update. The Promise result is `false` if
714
+ * a property was set inside `updated()`. If the Promise is rejected, an
715
+ * exception was thrown during the update.
716
+ *
717
+ * To await additional asynchronous work, override the `getUpdateComplete`
718
+ * method. For example, it is sometimes useful to await a rendered element
719
+ * before fulfilling this Promise. To do this, first await
720
+ * `super.getUpdateComplete()`, then any subsequent state.
721
+ *
722
+ * @return A promise of a boolean that resolves to true if the update completed
723
+ * without triggering another update.
724
+ * @category updates
725
+ */
726
+ get updateComplete(): Promise<boolean>;
727
+ /**
728
+ * Override point for the `updateComplete` promise.
729
+ *
730
+ * It is not safe to override the `updateComplete` getter directly due to a
731
+ * limitation in TypeScript which means it is not possible to call a
732
+ * superclass getter (e.g. `super.updateComplete.then(...)`) when the target
733
+ * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).
734
+ * This method should be overridden instead. For example:
735
+ *
736
+ * ```ts
737
+ * class MyElement extends LitElement {
738
+ * override async getUpdateComplete() {
739
+ * const result = await super.getUpdateComplete();
740
+ * await this._myChild.updateComplete;
741
+ * return result;
742
+ * }
743
+ * }
744
+ * ```
745
+ *
746
+ * @return A promise of a boolean that resolves to true if the update completed
747
+ * without triggering another update.
748
+ * @category updates
749
+ */
750
+ protected getUpdateComplete(): Promise<boolean>;
751
+ /**
752
+ * Controls whether or not `update()` should be called when the element requests
753
+ * an update. By default, this method always returns `true`, but this can be
754
+ * customized to control when to update.
755
+ *
756
+ * @param _changedProperties Map of changed properties with old values
757
+ * @category updates
758
+ */
759
+ protected shouldUpdate(_changedProperties: PropertyValues): boolean;
760
+ /**
761
+ * Updates the element. This method reflects property values to attributes.
762
+ * It can be overridden to render and keep updated element DOM.
763
+ * Setting properties inside this method will *not* trigger
764
+ * another update.
765
+ *
766
+ * @param _changedProperties Map of changed properties with old values
767
+ * @category updates
768
+ */
769
+ protected update(_changedProperties: PropertyValues): void;
770
+ /**
771
+ * Invoked whenever the element is updated. Implement to perform
772
+ * post-updating tasks via DOM APIs, for example, focusing an element.
773
+ *
774
+ * Setting properties inside this method will trigger the element to update
775
+ * again after this update cycle completes.
776
+ *
777
+ * @param _changedProperties Map of changed properties with old values
778
+ * @category updates
779
+ */
780
+ protected updated(_changedProperties: PropertyValues): void;
781
+ /**
782
+ * Invoked when the element is first updated. Implement to perform one time
783
+ * work on the element after update.
784
+ *
785
+ * ```ts
786
+ * firstUpdated() {
787
+ * this.renderRoot.getElementById('my-text-area').focus();
788
+ * }
789
+ * ```
790
+ *
791
+ * Setting properties inside this method will trigger the element to update
792
+ * again after this update cycle completes.
793
+ *
794
+ * @param _changedProperties Map of changed properties with old values
795
+ * @category updates
796
+ */
797
+ protected firstUpdated(_changedProperties: PropertyValues): void;
798
+ }
799
+ declare const HTML_RESULT = 1;
800
+ declare const SVG_RESULT = 2;
801
+ declare const MATHML_RESULT = 3;
802
+ export type ResultType = typeof HTML_RESULT | typeof SVG_RESULT | typeof MATHML_RESULT;
803
+ /**
804
+ * The return type of the template tag functions, {@linkcode html} and
805
+ * {@linkcode svg} when it hasn't been compiled by @lit-labs/compiler.
806
+ *
807
+ * A `TemplateResult` object holds all the information about a template
808
+ * expression required to render it: the template strings, expression values,
809
+ * and type of template (html or svg).
810
+ *
811
+ * `TemplateResult` objects do not create any DOM on their own. To create or
812
+ * update DOM you need to render the `TemplateResult`. See
813
+ * [Rendering](https://lit.dev/docs/components/rendering) for more information.
814
+ *
815
+ */
816
+ export type UncompiledTemplateResult<T extends ResultType = ResultType> = {
817
+ ["_$litType$"]: T;
818
+ strings: TemplateStringsArray;
819
+ values: unknown[];
820
+ };
821
+ /**
822
+ * The return type of the template tag functions, {@linkcode html} and
823
+ * {@linkcode svg}.
824
+ *
825
+ * A `TemplateResult` object holds all the information about a template
826
+ * expression required to render it: the template strings, expression values,
827
+ * and type of template (html or svg).
828
+ *
829
+ * `TemplateResult` objects do not create any DOM on their own. To create or
830
+ * update DOM you need to render the `TemplateResult`. See
831
+ * [Rendering](https://lit.dev/docs/components/rendering) for more information.
832
+ *
833
+ * In Lit 4, this type will be an alias of
834
+ * MaybeCompiledTemplateResult, so that code will get type errors if it assumes
835
+ * that Lit templates are not compiled. When deliberately working with only
836
+ * one, use either {@linkcode CompiledTemplateResult} or
837
+ * {@linkcode UncompiledTemplateResult} explicitly.
838
+ */
839
+ export type TemplateResult<T extends ResultType = ResultType> = UncompiledTemplateResult<T>;
840
+ export type SVGTemplateResult = TemplateResult<typeof SVG_RESULT>;
841
+ declare const nothing: unique symbol;
842
+ /**
843
+ * Object specifying options for controlling lit-html rendering. Note that
844
+ * while `render` may be called multiple times on the same `container` (and
845
+ * `renderBefore` reference node) to efficiently update the rendered content,
846
+ * only the options passed in during the first render are respected during
847
+ * the lifetime of renders to that unique `container` + `renderBefore`
848
+ * combination.
849
+ */
850
+ export interface RenderOptions {
851
+ /**
852
+ * An object to use as the `this` value for event listeners. It's often
853
+ * useful to set this to the host component rendering a template.
854
+ */
855
+ host?: object;
856
+ /**
857
+ * A DOM node before which to render content in the container.
858
+ */
859
+ renderBefore?: ChildNode | null;
860
+ /**
861
+ * Node used for cloning the template (`importNode` will be called on this
862
+ * node). This controls the `ownerDocument` of the rendered DOM, along with
863
+ * any inherited context. Defaults to the global `document`.
864
+ */
865
+ creationScope?: {
866
+ importNode(node: Node, deep?: boolean): Node;
867
+ };
868
+ /**
869
+ * The initial connected state for the top-level part being rendered. If no
870
+ * `isConnected` option is set, `AsyncDirective`s will be connected by
871
+ * default. Set to `false` if the initial render occurs in a disconnected tree
872
+ * and `AsyncDirective`s should see `isConnected === false` for their initial
873
+ * render. The `part.setConnected()` method must be used subsequent to initial
874
+ * render to change the connected state of the part.
875
+ */
876
+ isConnected?: boolean;
877
+ }
878
+ /**
879
+ * @description Defines the API version that the SDK should use.
880
+ * - `"legacy"`: Uses the older API version with existing behaviors.
881
+ * - `"2.4"`: Uses the new API version with updated functionalities.
882
+ *
883
+ * If this value is not set, the SDK will default to the predefined version,
884
+ * ensuring backward compatibility.
885
+ */
886
+ export type APIVersionOption = "legacy" | "2.4";
887
+ declare const PaymentInstrumentType: {
888
+ readonly WORLDPAY_IDEAL: "WORLDPAY_IDEAL";
889
+ readonly AUTOMATED_CLEARING_HOUSE: "AUTOMATED_CLEARING_HOUSE";
890
+ readonly ADYEN_KLARNA: "ADYEN_KLARNA";
891
+ readonly ADYEN_BANCONTACT_CARD: "ADYEN_BANCONTACT_CARD";
892
+ readonly PAY_NL_KAARTDIRECT: "PAY_NL_KAARTDIRECT";
893
+ readonly ADYEN_EPS: "ADYEN_EPS";
894
+ readonly ADYEN_BANCONTACT_PAYCONIQ: "ADYEN_BANCONTACT_PAYCONIQ";
895
+ readonly OMISE_PROMPTPAY: "OMISE_PROMPTPAY";
896
+ readonly OMISE_TRUEMONEY: "OMISE_TRUEMONEY";
897
+ readonly ADYEN_MULTIBANCO: "ADYEN_MULTIBANCO";
898
+ readonly PACYPAY_WECHAT: "PACYPAY_WECHAT";
899
+ readonly PACYPAY_ALIPAY: "PACYPAY_ALIPAY";
900
+ readonly ADYEN_MBWAY: "ADYEN_MBWAY";
901
+ readonly XENDIT_DANA: "XENDIT_DANA";
902
+ readonly XENDIT_SHOPEEPAY: "XENDIT_SHOPEEPAY";
903
+ readonly ADYEN_PAYSHOP: "ADYEN_PAYSHOP";
904
+ readonly ADYEN_PAYTRAIL: "ADYEN_PAYTRAIL";
905
+ readonly CLEARPAY: "CLEARPAY";
906
+ readonly RAPYD_FAST: "RAPYD_FAST";
907
+ readonly RAPYD_PROMPTPAY: "RAPYD_PROMPTPAY";
908
+ readonly RAPYD_GCASH: "RAPYD_GCASH";
909
+ readonly RAPYD_POLI: "RAPYD_POLI";
910
+ readonly RAPYD_GRABPAY: "RAPYD_GRABPAY";
911
+ readonly PRIMER_PAYPAL: "PRIMER_PAYPAL";
912
+ readonly TWOC2P: "TWOC2P";
913
+ readonly NETS: "NETS";
914
+ readonly STRIPE_ACH: "STRIPE_ACH";
915
+ readonly STRIPE_GIROPAY: "STRIPE_GIROPAY";
916
+ readonly MOLLIE_GIROPAY: "MOLLIE_GIROPAY";
917
+ readonly MOLLIE_EPS: "MOLLIE_EPS";
918
+ readonly PAY_NL_EPS: "PAY_NL_EPS";
919
+ readonly PAY_NL_P24: "PAY_NL_P24";
920
+ readonly MOLLIE_P24: "MOLLIE_P24";
921
+ readonly MOLLIE_SOFORT: "MOLLIE_SOFORT";
922
+ readonly COINBASE: "COINBASE";
923
+ readonly OPENNODE: "OPENNODE";
924
+ readonly MOLLIE_GIFT_CARD: "MOLLIE_GIFTCARD";
925
+ readonly XFERS_PAYNOW: "XFERS_PAYNOW";
926
+ readonly CARD: "PAYMENT_CARD";
927
+ readonly APPLE_PAY: "APPLE_PAY";
928
+ readonly GOOGLE_PAY: "GOOGLE_PAY";
929
+ readonly PAYPAL: "PAYPAL_ORDER";
930
+ readonly PAYPAL_VAULTED: "PAYPAL_BILLING_AGREEMENT";
931
+ readonly GO_CARDLESS: "GOCARDLESS";
932
+ readonly PAY_NL_IDEAL: "PAY_NL_IDEAL";
933
+ readonly PAY_NL_SOFORT_BANKING: "PAY_NL_SOFORT_BANKING";
934
+ readonly PAY_NL_BANCONTACT: "PAY_NL_BANCONTACT";
935
+ readonly PAY_NL_PAYPAL: "PAY_NL_PAYPAL";
936
+ readonly PAY_NL_CREDIT_TRANSFER: "PAY_NL_CREDIT_TRANSFER";
937
+ readonly PAY_NL_DIRECT_DEBIT: "PAY_NL_DIRECT_DEBIT";
938
+ readonly PAY_NL_GIROPAY: "PAY_NL_GIROPAY";
939
+ readonly PAY_NL_PAYCONIQ: "PAY_NL_PAYCONIQ";
940
+ readonly HOOLAH: "HOOLAH";
941
+ readonly ADYEN_BLIK: "ADYEN_BLIK";
942
+ readonly ADYEN_VIPPS: "ADYEN_VIPPS";
943
+ readonly ADYEN_GIROPAY: "ADYEN_GIROPAY";
944
+ readonly ADYEN_SOFORT: "ADYEN_SOFORT";
945
+ readonly ADYEN_IDEAL: "ADYEN_IDEAL";
946
+ readonly ADYEN_TRUSTLY: "ADYEN_TRUSTLY";
947
+ readonly ADYEN_ALIPAY: "ADYEN_ALIPAY";
948
+ readonly ADYEN_TWINT: "ADYEN_TWINT";
949
+ readonly ADYEN_MOBILEPAY: "ADYEN_MOBILEPAY";
950
+ readonly MOLLIE_BANCONTACT: "MOLLIE_BANCONTACT";
951
+ readonly MOLLIE_IDEAL: "MOLLIE_IDEAL";
952
+ readonly BUCKAROO_GIROPAY: "BUCKAROO_GIROPAY";
953
+ readonly BUCKAROO_EPS: "BUCKAROO_EPS";
954
+ readonly BUCKAROO_SOFORT: "BUCKAROO_SOFORT";
955
+ readonly BUCKAROO_BANCONTACT: "BUCKAROO_BANCONTACT";
956
+ readonly BUCKAROO_IDEAL: "BUCKAROO_IDEAL";
957
+ readonly ATOME: "ATOME";
958
+ readonly KLARNA_CUSTOMER_TOKEN: "KLARNA_CUSTOMER_TOKEN";
959
+ };
960
+ export type PaymentInstrumentType = (typeof PaymentInstrumentType)[keyof typeof PaymentInstrumentType];
961
+ declare const PaymentMethodType: {
962
+ readonly WORLDPAY_IDEAL: "WORLDPAY_IDEAL";
963
+ readonly STRIPE_ACH: "STRIPE_ACH";
964
+ readonly STRIPE_IDEAL: "STRIPE_IDEAL";
965
+ readonly ADYEN_KLARNA: "ADYEN_KLARNA";
966
+ readonly ADYEN_BANCONTACT_CARD: "ADYEN_BANCONTACT_CARD";
967
+ readonly PAY_NL_KAARTDIRECT: "PAY_NL_KAARTDIRECT";
968
+ readonly ADYEN_EPS: "ADYEN_EPS";
969
+ readonly ADYEN_BANCONTACT_PAYCONIQ: "ADYEN_BANCONTACT_PAYCONIQ";
970
+ readonly OMISE_PROMPTPAY: "OMISE_PROMPTPAY";
971
+ readonly OMISE_TRUEMONEY: "OMISE_TRUEMONEY";
972
+ readonly ADYEN_MULTIBANCO: "ADYEN_MULTIBANCO";
973
+ readonly PACYPAY_WECHAT: "PACYPAY_WECHAT";
974
+ readonly PACYPAY_ALIPAY: "PACYPAY_ALIPAY";
975
+ readonly ADYEN_MBWAY: "ADYEN_MBWAY";
976
+ readonly XENDIT_DANA: "XENDIT_DANA";
977
+ readonly XENDIT_SHOPEEPAY: "XENDIT_SHOPEEPAY";
978
+ readonly ADYEN_PAYSHOP: "ADYEN_PAYSHOP";
979
+ readonly ADYEN_PAYTRAIL: "ADYEN_PAYTRAIL";
980
+ readonly CLEARPAY: "CLEARPAY";
981
+ readonly RAPYD_FAST: "RAPYD_FAST";
982
+ readonly RAPYD_PROMPTPAY: "RAPYD_PROMPTPAY";
983
+ readonly RAPYD_GCASH: "RAPYD_GCASH";
984
+ readonly RAPYD_POLI: "RAPYD_POLI";
985
+ readonly RAPYD_GRABPAY: "RAPYD_GRABPAY";
986
+ readonly PRIMER_PAYPAL: "PRIMER_PAYPAL";
987
+ readonly TWOC2P: "TWOC2P";
988
+ readonly NETS: "NETS";
989
+ readonly STRIPE_GIROPAY: "STRIPE_GIROPAY";
990
+ readonly MOLLIE_GIROPAY: "MOLLIE_GIROPAY";
991
+ readonly MOLLIE_EPS: "MOLLIE_EPS";
992
+ readonly PAY_NL_EPS: "PAY_NL_EPS";
993
+ readonly PAY_NL_P24: "PAY_NL_P24";
994
+ readonly MOLLIE_P24: "MOLLIE_P24";
995
+ readonly MOLLIE_SOFORT: "MOLLIE_SOFORT";
996
+ readonly COINBASE: "COINBASE";
997
+ readonly OPENNODE: "OPENNODE";
998
+ readonly MOLLIE_GIFT_CARD: "MOLLIE_GIFTCARD";
999
+ readonly XFERS_PAYNOW: "XFERS_PAYNOW";
1000
+ readonly PAYMENT_CARD: "PAYMENT_CARD";
1001
+ readonly APPLE_PAY: "APPLE_PAY";
1002
+ readonly GOOGLE_PAY: "GOOGLE_PAY";
1003
+ readonly PAYPAL: "PAYPAL";
1004
+ readonly GO_CARDLESS: "GOCARDLESS";
1005
+ readonly KLARNA: "KLARNA";
1006
+ readonly PAY_NL_IDEAL: "PAY_NL_IDEAL";
1007
+ readonly PAY_NL_SOFORT_BANKING: "PAY_NL_SOFORT_BANKING";
1008
+ readonly PAY_NL_BANCONTACT: "PAY_NL_BANCONTACT";
1009
+ readonly PAY_NL_PAYPAL: "PAY_NL_PAYPAL";
1010
+ readonly PAY_NL_CREDIT_TRANSFER: "PAY_NL_CREDIT_TRANSFER";
1011
+ readonly PAY_NL_DIRECT_DEBIT: "PAY_NL_DIRECT_DEBIT";
1012
+ readonly PAY_NL_GIROPAY: "PAY_NL_GIROPAY";
1013
+ readonly PAY_NL_PAYCONIQ: "PAY_NL_PAYCONIQ";
1014
+ readonly HOOLAH: "HOOLAH";
1015
+ readonly ADYEN_BLIK: "ADYEN_BLIK";
1016
+ readonly ADYEN_MOBILEPAY: "ADYEN_MOBILEPAY";
1017
+ readonly ADYEN_VIPPS: "ADYEN_VIPPS";
1018
+ readonly ADYEN_GIROPAY: "ADYEN_GIROPAY";
1019
+ readonly ADYEN_SOFORT: "ADYEN_SOFORT";
1020
+ readonly ADYEN_IDEAL: "ADYEN_IDEAL";
1021
+ readonly ADYEN_TRUSTLY: "ADYEN_TRUSTLY";
1022
+ readonly ADYEN_ALIPAY: "ADYEN_ALIPAY";
1023
+ readonly ADYEN_TWINT: "ADYEN_TWINT";
1024
+ readonly ADYEN_BANK_TRANSFER: "ADYEN_BANK_TRANSFER";
1025
+ readonly MOLLIE_BANCONTACT: "MOLLIE_BANCONTACT";
1026
+ readonly MOLLIE_IDEAL: "MOLLIE_IDEAL";
1027
+ readonly BUCKAROO_GIROPAY: "BUCKAROO_GIROPAY";
1028
+ readonly BUCKAROO_EPS: "BUCKAROO_EPS";
1029
+ readonly BUCKAROO_SOFORT: "BUCKAROO_SOFORT";
1030
+ readonly BUCKAROO_BANCONTACT: "BUCKAROO_BANCONTACT";
1031
+ readonly BUCKAROO_IDEAL: "BUCKAROO_IDEAL";
1032
+ readonly ATOME: "ATOME";
1033
+ };
1034
+ export type PaymentMethodType = (typeof PaymentMethodType)[keyof typeof PaymentMethodType];
1035
+ declare const TokenType: {
1036
+ readonly SINGLE_USE: "SINGLE_USE";
1037
+ readonly MULTI_USE: "MULTI_USE";
1038
+ };
1039
+ export type TokenType = (typeof TokenType)[keyof typeof TokenType];
1040
+ export type MessageSeverity = "ERROR" | "DEBUG" | "WARN" | "INFO";
1041
+ export interface BorderStyle {
1042
+ borderStyle?: string;
1043
+ borderColor?: number | string;
1044
+ borderWidth?: number | string;
1045
+ }
1046
+ export interface TextAlignmentStyle {
1047
+ textAlign?: string;
1048
+ }
1049
+ export interface TextStyle {
1050
+ color?: string;
1051
+ fontFamily?: string;
1052
+ fontWeight?: string;
1053
+ fontSize?: string;
1054
+ fontSmoothing?: string;
1055
+ lineHeight?: string;
1056
+ textTransform?: string;
1057
+ letterSpacing?: string;
1058
+ }
1059
+ export interface BlockStyle extends BorderStyle {
1060
+ background?: string;
1061
+ borderRadius?: number | string;
1062
+ boxShadow?: string;
1063
+ }
1064
+ export type LogoColor = "DARK" | "LIGHT" | "COLORED";
1065
+ export interface LoadingScreenStyle {
1066
+ color?: string;
1067
+ }
1068
+ export interface BaseInputStyle extends TextStyle, BlockStyle {
1069
+ height?: number | string;
1070
+ paddingHorizontal?: number;
1071
+ }
1072
+ export interface InputStyle extends BaseInputStyle {
1073
+ hover?: BaseInputStyle;
1074
+ focus?: BaseInputStyle;
1075
+ placeholder?: BaseInputStyle;
1076
+ webkitAutofill?: BaseInputStyle;
1077
+ selection?: BaseInputStyle;
1078
+ }
1079
+ export interface BaseSubmitButtonStyle extends TextStyle, BlockStyle {
1080
+ }
1081
+ export interface SubmitButtonStyle extends BaseSubmitButtonStyle {
1082
+ hover?: BaseSubmitButtonStyle;
1083
+ focus?: BaseSubmitButtonStyle;
1084
+ }
1085
+ export interface SubmitButtonStyles {
1086
+ base?: SubmitButtonStyle;
1087
+ disabled?: SubmitButtonStyle;
1088
+ loading?: SubmitButtonStyle;
1089
+ }
1090
+ export interface InputStyles {
1091
+ base?: InputStyle;
1092
+ error?: InputStyle;
1093
+ }
1094
+ export interface BaseSavedPaymentMethodButtonStyle extends TextStyle, BlockStyle {
1095
+ }
1096
+ export interface SavedPaymentMethodButtonStyle extends BaseSavedPaymentMethodButtonStyle {
1097
+ hover?: BaseSavedPaymentMethodButtonStyle;
1098
+ focus?: BaseSavedPaymentMethodButtonStyle;
1099
+ }
1100
+ export interface SavedPaymentMethodButtonStyles {
1101
+ base?: SavedPaymentMethodButtonStyle;
1102
+ selected?: SavedPaymentMethodButtonStyle;
1103
+ }
1104
+ export interface ShowMorePaymentMethodsButtonStyles {
1105
+ base?: TextStyle;
1106
+ disabled?: TextStyle;
1107
+ }
1108
+ export interface DirectDebitMandateStyle {
1109
+ header?: TextStyle;
1110
+ label?: TextStyle;
1111
+ content?: TextStyle;
1112
+ creditorDetails?: TextStyle;
1113
+ }
1114
+ export interface DirectDebitSuccessStyle {
1115
+ icon?: {
1116
+ color?: string;
1117
+ };
1118
+ }
1119
+ export interface PaymentMethodButtonStyle extends BlockStyle {
1120
+ height?: number;
1121
+ minHeight?: number;
1122
+ maxHeight?: number;
1123
+ primaryText?: TextStyle;
1124
+ logoColor?: LogoColor;
1125
+ marginTop?: string;
1126
+ }
1127
+ export interface BackButtonStyle {
1128
+ color?: string;
1129
+ }
1130
+ export interface EditButtonStyle {
1131
+ color?: string;
1132
+ background?: string;
1133
+ }
1134
+ export interface SeparatorStyle {
1135
+ color?: string;
1136
+ }
1137
+ export interface ErrorMessageStyle extends BlockStyle, TextStyle {
1138
+ color?: string;
1139
+ }
1140
+ export interface FormSpacings {
1141
+ betweenLabelAndInput?: string;
1142
+ betweenInputs?: string;
1143
+ }
1144
+ export interface FontFace$1 {
1145
+ fontFamily?: string;
1146
+ src?: string;
1147
+ unicodeRange?: string;
1148
+ fontVariant?: string;
1149
+ fontFeatureSettings?: string;
1150
+ fontVariationSettings?: string;
1151
+ fontStretch?: string;
1152
+ fontWeight?: string;
1153
+ fontStyle?: string;
1154
+ }
1155
+ export interface Stylesheet {
1156
+ href: string;
1157
+ }
1158
+ export interface VaultMenuStyle {
1159
+ editButton?: EditButtonStyle & TextStyle;
1160
+ item?: {
1161
+ label?: TextStyle;
1162
+ actionButton?: TextStyle;
1163
+ confirmButton?: BlockStyle & TextStyle;
1164
+ };
1165
+ }
1166
+ export interface NetworkErrorStyles {
1167
+ button?: {
1168
+ base: BlockStyle & TextStyle;
1169
+ };
1170
+ }
1171
+ export interface ProcessingIndicatorStyle {
1172
+ color?: string;
1173
+ }
1174
+ export interface CheckoutStyle {
1175
+ fontFaces?: Array<FontFace$1>;
1176
+ stylesheets?: Array<Stylesheet>;
1177
+ loadingScreen?: LoadingScreenStyle;
1178
+ input?: InputStyles;
1179
+ inputLabel?: TextStyle;
1180
+ inputErrorText?: TextStyle & TextAlignmentStyle;
1181
+ formSpacings?: FormSpacings;
1182
+ showMorePaymentMethodsButton?: ShowMorePaymentMethodsButtonStyles;
1183
+ networkError?: NetworkErrorStyles;
1184
+ submitButton?: SubmitButtonStyles;
1185
+ vaultTitle?: TextStyle;
1186
+ savedPaymentMethodButton?: SavedPaymentMethodButtonStyles;
1187
+ paymentMethodButton?: PaymentMethodButtonStyle;
1188
+ errorMessage?: ErrorMessageStyle;
1189
+ smallPrint?: TextStyle;
1190
+ directDebit?: {
1191
+ mandate?: DirectDebitMandateStyle;
1192
+ success?: DirectDebitSuccessStyle;
1193
+ };
1194
+ vaultMenu?: VaultMenuStyle;
1195
+ backButton?: BackButtonStyle;
1196
+ separator?: SeparatorStyle;
1197
+ processingIndicator?: ProcessingIndicatorStyle;
1198
+ focusCheckoutOnInit?: boolean;
1199
+ }
1200
+ export interface IVaultedPaymentMethod<T, U extends PaymentInstrumentType> {
1201
+ id: string;
1202
+ analyticsId: string;
1203
+ paymentInstrumentData: T;
1204
+ paymentInstrumentType: U;
1205
+ threeDSecureAuthentication: ThreeDSAuthenticationData | null;
1206
+ vaultData: VaultData | null;
1207
+ userDescription?: string;
1208
+ }
1209
+ export type VaultedPaymentMethod = IVaultedPaymentMethod<any, any>;
1210
+ declare enum ProductType {
1211
+ DIGITAL = "DIGITAL",
1212
+ PHYSICAL = "PHYSICAL",
1213
+ SHIPPING_FEE = "SHIPPING_FEE"
1214
+ }
1215
+ export interface ClientSessionLineItem {
1216
+ amount: number;
1217
+ description: string;
1218
+ discountAmount?: number;
1219
+ itemId: string;
1220
+ name?: string;
1221
+ productType?: ProductType;
1222
+ quantity: number;
1223
+ taxAmount?: number;
1224
+ taxCode?: string;
1225
+ }
1226
+ export interface ClientSessionShipping {
1227
+ amount: number;
1228
+ methodId?: string;
1229
+ methodName?: string;
1230
+ methodDescription?: string;
1231
+ }
1232
+ export interface ClientSessionFeeItem {
1233
+ type?: string;
1234
+ description?: string;
1235
+ amount: number;
1236
+ }
1237
+ export interface ClientSessionAddress {
1238
+ firstName?: string;
1239
+ lastName?: string;
1240
+ addressLine1?: string;
1241
+ addressLine2?: string;
1242
+ city?: string;
1243
+ state?: string;
1244
+ countryCode?: string;
1245
+ postalCode?: string;
1246
+ }
1247
+ export interface ClientSession {
1248
+ orderId?: string;
1249
+ currencyCode?: string;
1250
+ lineItems?: ClientSessionLineItem[];
1251
+ totalAmount?: number;
1252
+ customerId?: string;
1253
+ orderDetails?: {
1254
+ countryCode?: string;
1255
+ shipping?: ClientSessionShipping;
1256
+ fees?: ClientSessionFeeItem[];
1257
+ };
1258
+ customer?: {
1259
+ emailAddress?: string;
1260
+ mobileNumber?: string;
1261
+ firstName?: string;
1262
+ lastName?: string;
1263
+ billingAddress?: ClientSessionAddress;
1264
+ shippingAddress?: ClientSessionAddress;
1265
+ taxId?: string;
1266
+ nationalDocumentId?: string;
1267
+ };
1268
+ paymentMethod?: {
1269
+ options?: Record<string, any>;
1270
+ orderedAllowedCardNetworks?: string[];
1271
+ vaultOnSuccess?: boolean;
1272
+ };
1273
+ }
1274
+ export interface BackgroundColor {
1275
+ colored: string;
1276
+ dark: string;
1277
+ light: string;
1278
+ }
1279
+ export interface IconUrl {
1280
+ colored: string;
1281
+ dark: string;
1282
+ light: string;
1283
+ }
1284
+ declare enum CheckoutUXFlow {
1285
+ CHECKOUT = "CHECKOUT",
1286
+ HEADLESS_CHECKOUT = "HEADLESS_CHECKOUT",
1287
+ MANAGE_PAYMENT_METHODS = "MANAGE_PAYMENT_METHODS"
1288
+ }
1289
+ export type SecureInputOptions = {
1290
+ ariaLabel?: string;
1291
+ container: string;
1292
+ id?: string;
1293
+ name: string;
1294
+ placeholder?: string;
1295
+ placement?: "append" | "prepend";
1296
+ properties?: any;
1297
+ style?: CheckoutStyle;
1298
+ allowedCharactersMap?: Record<string, string>;
1299
+ };
1300
+ export type SecureInputListener = (...args: unknown[]) => void;
1301
+ export type CardSecurityCodeInputOptions = Omit<SecureInputOptions, "allowedCharactersMap" | "name"> & {
1302
+ cardNetwork?: string;
1303
+ name?: string;
1304
+ };
1305
+ export type CvvInput = {
1306
+ frame: HTMLIFrameElement | null;
1307
+ readonly metadata: {
1308
+ readonly errorCode: string | null;
1309
+ readonly error: string | null;
1310
+ readonly valid: boolean;
1311
+ readonly active: boolean;
1312
+ readonly dirty: boolean;
1313
+ readonly touched: boolean;
1314
+ readonly submitted: boolean;
1315
+ };
1316
+ focus(): void;
1317
+ blur(): void;
1318
+ addListener(event: "change" | "blur" | "focus", listener: SecureInputListener): (() => void) | undefined;
1319
+ addEventListener(event: "change" | "blur" | "focus", listener: SecureInputListener): (() => void) | undefined;
1320
+ removeListener(event: "change" | "blur" | "focus", listener: SecureInputListener): void;
1321
+ name: string;
1322
+ valueToken: string;
1323
+ remove: () => void;
1324
+ };
1325
+ export type CvvInputOptions = CardSecurityCodeInputOptions;
1326
+ export interface HeadlessVaultManager {
1327
+ fetchVaultedPaymentMethods(): Promise<VaultedPaymentMethod[]>;
1328
+ deleteVaultedPaymentMethod(id: string): Promise<void>;
1329
+ startPaymentFlow(id: string, data?: {
1330
+ cvv?: string;
1331
+ }): Promise<void>;
1332
+ createCvvInput(options: CvvInputOptions): Promise<CvvInput | null>;
1333
+ }
1334
+ declare enum PaymentFlow {
1335
+ DEFAULT = "DEFAULT",
1336
+ PREFER_VAULT = "PREFER_VAULT"
1337
+ }
1338
+ declare enum ThreeDSecureStatus {
1339
+ SUCCESS = "AUTH_SUCCESS",
1340
+ FAILED = "AUTH_FAILED",
1341
+ SKIPPED = "SKIPPED",
1342
+ CHALLENGE = "CHALLENGE"
1343
+ }
1344
+ declare enum ErrorCode {
1345
+ INITIALIZATION_ERROR = "INITIALIZATION_ERROR",
1346
+ NO_PAYMENT_METHODS = "NO_PAYMENT_METHODS",
1347
+ PRIMER_TEARDOWN = "PRIMER_TEARDOWN",
1348
+ PRIMER_SERVER_ERROR = "PRIMER_SERVER_ERROR",
1349
+ THREE_DS_AUTH_FAILED = "THREE_DS_AUTH_FAILED",
1350
+ TOKENIZATION_ERROR = "TOKENIZATION_ERROR",
1351
+ DUPLICATE_PAYMENT_METHOD_ERROR = "DUPLICATE_PAYMENT_METHOD_ERROR",
1352
+ CARD_NUMBER_ERROR = "CARD_NUMBER_ERROR",
1353
+ PAYMENT_METHOD_NOT_SETUP = "PAYMENT_METHOD_NOT_SETUP",
1354
+ PAYMENT_METHOD_NOT_PROVIDED = "PAYMENT_METHOD_NOT_PROVIDED",
1355
+ PAYMENT_METHOD_NOT_COMPATIBLE = "PAYMENT_METHOD_NOT_COMPATIBLE",
1356
+ RESUME_ERROR = "RESUME_ERROR",
1357
+ VALIDATION_ERROR = "VALIDATION_ERROR",
1358
+ PAYMENT_FAILED = "PAYMENT_FAILED",
1359
+ PAYMENT_CREATION_ABORTED = "PAYMENT_CREATION_ABORTED",
1360
+ PAYMENT_CREATION_DISABLED = "PAYMENT_CREATION_DISABLED",
1361
+ CLIENT_SESSION_UPDATE_ERROR = "CLIENT_SESSION_UPDATE_ERROR",
1362
+ INVALID_ARGUMENT = "INVALID_ARGUMENT",
1363
+ VAULT_FETCH = "VAULT_FETCH",
1364
+ VAULT_DELETE = "VAULT_DELETE",
1365
+ HEADLESS_VAULT_MANAGER_VALIDATION = "HEADLESS_VAULT_MANAGER_VALIDATION",
1366
+ CARD_FORM_VALIDATION_UNEXPECTED_FIELD = "CARD_FORM_VALIDATION_UNEXPECTED_FIELD",
1367
+ MISSING_FIRST_NAME_OR_LAST_NAME = "MISSING_FIRST_NAME_OR_LAST_NAME",
1368
+ MISSING_EMAIL_ADDRESS = "MISSING_EMAIL_ADDRESS",
1369
+ INVALID_FLOW = "INVALID_FLOW"
1370
+ }
1371
+ declare class SDKError extends Error {
1372
+ isReported: boolean;
1373
+ constructor(message: string, isReported?: boolean);
1374
+ static from(error: unknown, isReported?: boolean): SDKError;
1375
+ markAsReported(): void;
1376
+ }
1377
+ export interface ErrorOptions$1<T = any> {
1378
+ message: string;
1379
+ diagnosticsId?: string;
1380
+ severity?: MessageSeverity;
1381
+ errorId?: string;
1382
+ data?: T;
1383
+ isFromDeveloper?: boolean;
1384
+ }
1385
+ declare class PrimerClientError<T = any> extends SDKError {
1386
+ readonly code: ErrorCode;
1387
+ readonly diagnosticsId: string | null;
1388
+ readonly data?: T;
1389
+ readonly isFromDeveloper: boolean;
1390
+ static fromErrorCode(code: ErrorCode, options: ErrorOptions$1): PrimerClientError;
1391
+ constructor(code: ErrorCode, options: ErrorOptions$1<T>);
1392
+ }
1393
+ export interface CardMetadata {
1394
+ /** @deprecated Use onCardNetworksChange instead. */
1395
+ type: CardNetwork$1 | null;
1396
+ /** @deprecated Use onCardNetworksChange instead. */
1397
+ possibleTypes: string[];
1398
+ cvvLength: number;
1399
+ cardNumberLength: number;
1400
+ }
1401
+ export type PaymentMethodData$1 = AdyenMultibancoPaymentData;
1402
+ export type AdyenMultibancoPaymentData = {
1403
+ paymentMethodType: typeof PaymentMethodType.ADYEN_MULTIBANCO;
1404
+ reference: string;
1405
+ expiresAt: string;
1406
+ entity: string;
1407
+ };
1408
+ export interface PositionalConfig {
1409
+ container: string | Element;
1410
+ }
1411
+ export interface ApplePayOptions extends PositionalConfig {
1412
+ buttonType?: "plain" | "buy" | "set-up" | "donate" | "check-out" | "book" | "subscribe";
1413
+ buttonStyle?: "white" | "white-outline" | "black";
1414
+ /**
1415
+ * @deprecated Add `postalAddress` to `billingOptions.requiredBillingContactFields` instead.
1416
+ */
1417
+ captureBillingAddress?: boolean;
1418
+ billingOptions?: ApplePayBillingOptions;
1419
+ shippingOptions?: ApplePayShippingOptions;
1420
+ }
1421
+ export interface ApplePayBillingOptions {
1422
+ requiredBillingContactFields?: RequiredContactFields[];
1423
+ }
1424
+ export interface ApplePayShippingOptions {
1425
+ requiredShippingContactFields?: RequiredContactFields[];
1426
+ requireShippingMethod?: boolean;
1427
+ }
1428
+ export type RequiredContactFields = "emailAddress" | "name" | "phoneNumber" | "postalAddress" | "phoneticName";
1429
+ export interface DirectDebitOptions {
1430
+ customerCountryCode: Alpha2CountryCode;
1431
+ companyName: string;
1432
+ companyAddress: string;
1433
+ customerName?: string;
1434
+ customerEmail?: string;
1435
+ customerAddressLine1?: string;
1436
+ customerAddressLine2?: string;
1437
+ customerCity?: string;
1438
+ customerPostalCode?: string;
1439
+ iban?: string;
1440
+ submitButtonLabels?: {
1441
+ form?: Label;
1442
+ mandate: Label;
1443
+ };
1444
+ }
1445
+ export type GooglePayButtonType =
1446
+ /** @deprecated Set buttonSizeMode to fill instead */
1447
+ "long"
1448
+ /** @deprecated Set buttonSizeMode to static instead */
1449
+ | "short" | "book" | "buy" | "checkout" | "donate" | "order" | "pay" | "plain" | "subscribe";
1450
+ export type GooglePayButtonColor = "default" | "black" | "white";
1451
+ export type GooglePayButtonSizeMode = "fill" | "static";
1452
+ export interface GooglePayShippingAddressParameters {
1453
+ phoneNumberRequired?: boolean;
1454
+ }
1455
+ export interface GooglePayOptions extends PositionalConfig {
1456
+ buttonType?: GooglePayButtonType;
1457
+ buttonColor?: GooglePayButtonColor;
1458
+ buttonSizeMode?: GooglePayButtonSizeMode;
1459
+ onClick?: () => void;
1460
+ captureBillingAddress?: boolean;
1461
+ shippingAddressParameters?: GooglePayShippingAddressParameters;
1462
+ emailRequired?: boolean;
1463
+ requireShippingMethod?: boolean;
1464
+ shadowRoot?: boolean;
1465
+ }
1466
+ export interface PayPalOptions extends PositionalConfig {
1467
+ buttonColor?: "gold" | "blue" | "silver" | "white" | "black";
1468
+ buttonShape?: "pill" | "rect";
1469
+ buttonSize?: "small" | "medium" | "large" | "responsive";
1470
+ buttonHeight?: number;
1471
+ buttonLabel?: "checkout" | "credit" | "pay" | "buynow" | "paypal" | "installment";
1472
+ buttonTagline?: boolean;
1473
+ paymentFlow?: PaymentFlow;
1474
+ onClick?: () => void;
1475
+ }
1476
+ export interface SubmitButtonOptions {
1477
+ amountVisible?: boolean;
1478
+ useBuiltInButton?: boolean;
1479
+ onVisible?: (isVisible: boolean, context: {
1480
+ currentSceneId: string;
1481
+ previousSceneId?: string;
1482
+ }) => void;
1483
+ onContentChange?: (content: string, context: {
1484
+ currentSceneId: string;
1485
+ }) => void;
1486
+ onDisable?: (isDisabled: boolean, context: {
1487
+ currentSceneId: string;
1488
+ }) => void;
1489
+ onLoading?: (isLoading: boolean, context: {
1490
+ currentSceneId: string;
1491
+ }) => void;
1492
+ }
1493
+ export interface ProcessingIndicatorOptions {
1494
+ visible?: boolean;
1495
+ }
1496
+ export interface FormOptions {
1497
+ inputLabelsVisible?: boolean;
1498
+ }
1499
+ export type CardPreferredFlow = "DEDICATED_SCENE" | "EMBEDDED_IN_HOME";
1500
+ export interface CheckoutCardOptions {
1501
+ cardholderName?: {
1502
+ /**
1503
+ * Only works if the cardholder name is visible
1504
+ */
1505
+ required?: boolean;
1506
+ /**
1507
+ * @deprecated Set it on your Dashboard
1508
+ */
1509
+ visible?: boolean;
1510
+ placeholder?: Label;
1511
+ };
1512
+ cardNumber?: {
1513
+ placeholder?: Label;
1514
+ };
1515
+ expiryDate?: {
1516
+ placeholder?: Label;
1517
+ };
1518
+ cvv?: {
1519
+ placeholder?: Label;
1520
+ };
1521
+ preferredFlow?: CardPreferredFlow;
1522
+ }
1523
+ export interface ErrorMessageOptions {
1524
+ disabled?: boolean;
1525
+ onErrorMessageShow?: (message: string) => void;
1526
+ onErrorMessageHide?: () => void;
1527
+ }
1528
+ declare enum SuccessScreenType {
1529
+ PAYMENT_METHOD = "PAYMENT_METHOD",
1530
+ CHECK = "CHECK"
1531
+ }
1532
+ export interface StripeAchCustomerDetails {
1533
+ emailAddress: string;
1534
+ firstName: string;
1535
+ lastName: string;
1536
+ }
1537
+ export interface StripeOptions {
1538
+ publishableKey: string;
1539
+ }
1540
+ export interface StripeOptionsDropInWithFullMandateText extends StripeOptions {
1541
+ mandateData: {
1542
+ fullMandateText: string;
1543
+ merchantName?: never;
1544
+ };
1545
+ }
1546
+ export interface StripeOptionsDropInTextProvidedByPrimer extends StripeOptions {
1547
+ mandateData: {
1548
+ merchantName: string;
1549
+ fullMandateText?: never;
1550
+ };
1551
+ }
1552
+ export type StripeOptionsDropIn = StripeOptionsDropInWithFullMandateText | StripeOptionsDropInTextProvidedByPrimer;
1553
+ type CardNetwork$1 = "american-express" | "diners-club" | "discover" | "elo" | "hiper" | "hipercard" | "interac" | "jcb" | "maestro" | "mastercard" | "mir" | "unionpay" | "private-label" | "visa";
1554
+ export interface CustomizablePaymentMethodButton {
1555
+ logoSrc: string;
1556
+ background: string;
1557
+ logoAlt?: string;
1558
+ text?: string;
1559
+ }
1560
+ export type KlarnaPaymentCategoryType = "pay_now" | "pay_later" | "pay_over_time";
1561
+ export interface KlarnaButtonOptions {
1562
+ text?: string;
1563
+ }
1564
+ export interface AdyenKlarnaOptions {
1565
+ buttonOptions?: KlarnaButtonOptions;
1566
+ }
1567
+ export interface KlarnaOptions {
1568
+ paymentFlow?: PaymentFlow;
1569
+ recurringPaymentDescription?: string;
1570
+ allowedPaymentCategories?: KlarnaPaymentCategoryType[];
1571
+ buttonOptions?: KlarnaButtonOptions;
1572
+ }
1573
+ export type SupportedLocale = string;
1574
+ export type Alpha2CountryCode = string;
1575
+ export type Alpha3CurrencyCode = string;
1576
+ export type Label<T extends Record<string, unknown> = Record<string, unknown>> = string | ((options: {
1577
+ locale: SupportedLocale;
1578
+ } | T) => string);
1579
+ export type ResumeToken = {
1580
+ resumeToken: string;
1581
+ paymentId?: string;
1582
+ };
1583
+ export interface InputValidationError {
1584
+ name: string;
1585
+ error: string;
1586
+ message: string;
1587
+ }
1588
+ export interface Validation {
1589
+ valid: boolean;
1590
+ validationErrors: InputValidationError[];
1591
+ error?: string;
1592
+ }
1593
+ export interface ExternalPayerInfo {
1594
+ externalPayerId: string;
1595
+ firstName?: string;
1596
+ lastName?: string;
1597
+ email?: string;
1598
+ }
1599
+ export interface CustomerAddress {
1600
+ firstName?: string;
1601
+ lastName?: string;
1602
+ addressLine1?: string;
1603
+ addressLine2?: string;
1604
+ addressLine3?: string;
1605
+ city?: string;
1606
+ state?: string;
1607
+ countryCode?: Alpha2CountryCode;
1608
+ postalCode?: string;
1609
+ }
1610
+ export interface MonetaryAmount {
1611
+ value: number | string;
1612
+ currency: Alpha3CurrencyCode;
1613
+ }
1614
+ export interface ThreeDSecureOrderDetails {
1615
+ amount: MonetaryAmount;
1616
+ email: string;
1617
+ billingAddress: CustomerAddress;
1618
+ orderId: string;
1619
+ }
1620
+ export interface ThreeDSVerificationOptions {
1621
+ token: string;
1622
+ container: string;
1623
+ order: ThreeDSecureOrderDetails;
1624
+ testScenario?: string;
1625
+ onChallengeStart?: () => void;
1626
+ onChallengeEnd?: () => void;
1627
+ }
1628
+ export interface ThreeDSAuthenticationData {
1629
+ responseCode: ThreeDSecureStatus;
1630
+ reasonCode?: string;
1631
+ reasonText?: string;
1632
+ protocolVersion: string;
1633
+ challengeIssued: boolean;
1634
+ }
1635
+ export interface VaultData {
1636
+ customerId: string;
1637
+ }
1638
+ export interface PaymentCardDetails {
1639
+ last4Digits: string;
1640
+ cardholderName: string;
1641
+ network: string;
1642
+ }
1643
+ export interface PayPalBillingAgreementDetails {
1644
+ paypalBillingAgreementId: string;
1645
+ externalPayerInfo?: ExternalPayerInfo;
1646
+ shippingAddress?: CustomerAddress;
1647
+ }
1648
+ export interface GoCardlessDetails {
1649
+ gocardlessMandateId: string;
1650
+ }
1651
+ export interface IPaymentMethodToken<T, U extends PaymentInstrumentType> {
1652
+ token: string;
1653
+ analyticsId: string;
1654
+ tokenType: TokenType;
1655
+ paymentInstrumentData: T;
1656
+ paymentInstrumentType: U;
1657
+ threeDSecureAuthentication: ThreeDSAuthenticationData | null;
1658
+ vaultData: VaultData | null;
1659
+ }
1660
+ export type PaymentCardToken = IPaymentMethodToken<PaymentCardDetails, typeof PaymentInstrumentType.CARD>;
1661
+ export type PayPalBillingAgreementToken = IPaymentMethodToken<PayPalBillingAgreementDetails, typeof PaymentInstrumentType.PAYPAL_VAULTED>;
1662
+ export type GoCardlessToken = IPaymentMethodToken<GoCardlessDetails, typeof PaymentInstrumentType.GO_CARDLESS>;
1663
+ export type IdealPayToken = IPaymentMethodToken<Record<string, never>, typeof PaymentInstrumentType.PAY_NL_IDEAL>;
1664
+ export type PaymentMethodToken = PaymentCardToken | PayPalBillingAgreementToken | GoCardlessToken | IdealPayToken | IPaymentMethodToken<any, any>;
1665
+ export type CheckSuccessScreenOptions = {
1666
+ type: SuccessScreenType.CHECK;
1667
+ title: Label;
1668
+ };
1669
+ export type PaymentMethodSuccessScreenOptions = {
1670
+ type: SuccessScreenType.PAYMENT_METHOD;
1671
+ };
1672
+ export type SuccessScreenOptions = /* No success screen will be displayed */ false | /* Show the default success screen of the payment method*/ undefined | CheckSuccessScreenOptions | PaymentMethodSuccessScreenOptions;
1673
+ export type VaultOptions = {
1674
+ visible?: boolean;
1675
+ deletionDisabled?: boolean;
1676
+ };
1677
+ export type TransitionType = "SLIDE_UP" | "SLIDE_DOWN" | "SLIDE_HORIZONTAL";
1678
+ export type SceneTransitionOptions = {
1679
+ type: TransitionType;
1680
+ duration: number;
1681
+ isRtlLocale?: boolean;
1682
+ };
1683
+ export type SceneOptions = {
1684
+ onEntering?: (sceneId: string) => void;
1685
+ transition?: SceneTransitionOptions | false;
1686
+ };
1687
+ export type RedirectOptions = {
1688
+ returnUrl?: string;
1689
+ /**
1690
+ * default: false
1691
+ */
1692
+ forceRedirect?: boolean;
1693
+ };
1694
+ export type AdvancedOptions = {
1695
+ platform?: "STANDALONE" | "MAGENTO";
1696
+ };
1697
+ export type PaymentMethodAction = "PAYMENT_METHOD_SELECTED" | "PAYMENT_METHOD_UNSELECTED";
1698
+ export type PaymentHandling = "AUTO" | "MANUAL";
1699
+ export type Payment = {
1700
+ id: string;
1701
+ orderId: string;
1702
+ paymentMethodData?: PaymentMethodData$1;
1703
+ };
1704
+ export interface onBeforePaymentCreateHandler {
1705
+ continuePaymentCreation: () => void;
1706
+ abortPaymentCreation: () => void;
1707
+ }
1708
+ export interface OnCheckoutFailHandler {
1709
+ showErrorMessage: (errorMessage?: string) => void;
1710
+ }
1711
+ export interface PaymentHandlers {
1712
+ onBeforePaymentCreate?: (data: {
1713
+ paymentMethodType?: PaymentMethodType;
1714
+ }, handler: onBeforePaymentCreateHandler) => void;
1715
+ onPaymentCreationStart?: () => void;
1716
+ onCheckoutComplete?: (data: {
1717
+ payment: Payment | null;
1718
+ }) => void;
1719
+ onCheckoutFail?: (error: PrimerClientError, data: {
1720
+ payment?: Payment;
1721
+ }, handler: OnCheckoutFailHandler | undefined) => void;
1722
+ }
1723
+ export type OnTokenizeShouldStart = (data: {
1724
+ paymentMethodType?: PaymentMethodType;
1725
+ }) => boolean | Promise<boolean>;
1726
+ export type OnTokenizeDidNotStart = (reason: string) => void;
1727
+ export type OnTokenizeStart = () => void;
1728
+ export type OnTokenizeError = (error: PrimerClientError) => void;
1729
+ export interface OnTokenizeSuccessHandler {
1730
+ handleSuccess(): any;
1731
+ handleFailure(errorMessage?: string): any;
1732
+ continueWithNewClientToken(clientToken: string): any;
1733
+ }
1734
+ export type OnTokenizeSuccess = (data: PaymentMethodToken, handler: OnTokenizeSuccessHandler) => void | Promise<void>;
1735
+ export interface OnResumeSuccessHandler {
1736
+ handleSuccess(): any;
1737
+ handleFailure(errorMessage?: string): any;
1738
+ continueWithNewClientToken(clientToken: string): any;
1739
+ }
1740
+ export type OnResumeSuccess = (data: ResumeToken, handler: OnResumeSuccessHandler) => void;
1741
+ export type onResumeError = (error: PrimerClientError) => void;
1742
+ export type OnResumePending = (paymentMethodData: PaymentMethodData$1) => void;
1743
+ export interface TokenizationHandlers {
1744
+ onTokenizeShouldStart?: OnTokenizeShouldStart;
1745
+ onTokenizeDidNotStart?: OnTokenizeDidNotStart;
1746
+ onTokenizeStart?: OnTokenizeStart;
1747
+ onTokenizeSuccess?: OnTokenizeSuccess;
1748
+ onTokenizeError?: OnTokenizeError;
1749
+ onResumeSuccess?: OnResumeSuccess;
1750
+ onResumePending?: OnResumePending;
1751
+ onResumeError?: onResumeError;
1752
+ }
1753
+ export interface PaymentMethodHandlers {
1754
+ onPaymentMethodAction?: (paymentMethodAction: PaymentMethodAction, { paymentMethodType, }: {
1755
+ paymentMethodType: PaymentMethodType | string | null;
1756
+ }) => void;
1757
+ }
1758
+ export interface ClientSessionHandlers {
1759
+ onClientSessionUpdate?: (clientSession: ClientSession) => void;
1760
+ onBeforeClientSessionUpdate?: () => void;
1761
+ }
1762
+ export interface VaultManagerOptions extends WithAllowedCardNetworks {
1763
+ container: string | Element;
1764
+ locale?: SupportedLocale;
1765
+ vaultOnly?: boolean;
1766
+ deletionDisabled?: boolean;
1767
+ style?: CheckoutStyle;
1768
+ scene?: SceneOptions;
1769
+ errorMessage?: ErrorMessageOptions;
1770
+ form?: FormOptions;
1771
+ submitButton?: SubmitButtonOptions;
1772
+ processingIndicator?: ProcessingIndicatorOptions;
1773
+ card?: CheckoutCardOptions;
1774
+ threeDSecure?: ThreeDSVerificationOptions;
1775
+ giftCard?: CustomizablePaymentMethodButton;
1776
+ directDebit?: DirectDebitOptions;
1777
+ paypal?: Omit<PayPalOptions, "container">;
1778
+ onTokenizeShouldStart?: OnTokenizeShouldStart;
1779
+ onTokenizeDidNotStart?: OnTokenizeDidNotStart;
1780
+ onTokenizeStart?: () => void;
1781
+ onTokenizeSuccess?: (data: PaymentMethodToken) => void;
1782
+ onTokenizeError?: (message: PrimerClientError) => void;
1783
+ apiVersion?: APIVersionOption;
1784
+ }
1785
+ export interface UniversalCheckoutOptions extends TokenizationHandlers, PaymentHandlers, PaymentMethodHandlers, ClientSessionHandlers, WithAllowedCardNetworks {
1786
+ uxFlow?: CheckoutUXFlow.CHECKOUT;
1787
+ container: string | Element;
1788
+ locale?: SupportedLocale;
1789
+ style?: CheckoutStyle;
1790
+ scene?: SceneOptions;
1791
+ vault?: VaultOptions;
1792
+ submitButton?: SubmitButtonOptions;
1793
+ processingIndicator?: ProcessingIndicatorOptions;
1794
+ errorMessage?: ErrorMessageOptions;
1795
+ successScreen?: SuccessScreenOptions;
1796
+ form?: FormOptions;
1797
+ allowedPaymentMethods?: PaymentMethodType[];
1798
+ card?: CheckoutCardOptions;
1799
+ redirect?: RedirectOptions;
1800
+ paypal?: Omit<PayPalOptions, "container">;
1801
+ googlePay?: Omit<GooglePayOptions, "container">;
1802
+ applePay?: Omit<ApplePayOptions, "container">;
1803
+ adyenKlarna?: AdyenKlarnaOptions;
1804
+ klarna?: KlarnaOptions;
1805
+ directDebit?: DirectDebitOptions;
1806
+ giftCard?: CustomizablePaymentMethodButton;
1807
+ stripe?: StripeOptionsDropIn;
1808
+ paymentHandling?: PaymentHandling;
1809
+ advanced?: AdvancedOptions;
1810
+ clientSessionCachingEnabled?: boolean;
1811
+ apiVersion?: APIVersionOption;
1812
+ }
1813
+ export interface HeadlessUniversalCheckoutOptions extends TokenizationHandlers, PaymentHandlers, PaymentMethodHandlers, ClientSessionHandlers, WithAllowedCardNetworks {
1814
+ style?: CheckoutStyle;
1815
+ paymentHandling?: PaymentHandling;
1816
+ locale?: SupportedLocale;
1817
+ card?: CheckoutCardOptions;
1818
+ redirect?: RedirectOptions;
1819
+ paypal?: Omit<PayPalOptions, "container">;
1820
+ googlePay?: Omit<GooglePayOptions, "container">;
1821
+ applePay?: Omit<ApplePayOptions, "container">;
1822
+ adyenKlarna?: AdyenKlarnaOptions;
1823
+ klarna?: KlarnaOptions;
1824
+ directDebit?: DirectDebitOptions;
1825
+ giftCard?: CustomizablePaymentMethodButton;
1826
+ stripe?: StripeOptions;
1827
+ onAvailablePaymentMethodsLoad: (paymentMethods: PaymentMethodInfo[]) => void;
1828
+ clientSessionCachingEnabled?: boolean;
1829
+ apiVersion?: APIVersionOption;
1830
+ }
1831
+ export type WithAllowedCardNetworks = {
1832
+ /** @deprecated Use `orderedAllowedCardNetworks` on your Primer Dashboard instead. */
1833
+ allowedCardNetworks?: CardNetwork$1[];
1834
+ };
1835
+ export interface PrimerCheckout {
1836
+ teardown(): void;
1837
+ submit(): void;
1838
+ setPaymentCreationEnabled(isEnabled: boolean): void;
1839
+ setTokenizationEnabled(isEnabled: boolean): void;
1840
+ refreshClientSession(): Promise<boolean>;
1841
+ /**
1842
+ * @deprecated The method should not be used
1843
+ */
1844
+ setClientToken(): Promise<boolean>;
1845
+ }
1846
+ export type EventListener$1 = (event?: Event) => void;
1847
+ declare enum EventTypes {
1848
+ CHANGE = "change",
1849
+ ERROR = "error",
1850
+ FOCUS = "focus",
1851
+ BLUR = "blur",
1852
+ CLICK = "click",
1853
+ CLOSE = "close"
1854
+ }
1855
+ export interface HeadlessHostedInputOptions {
1856
+ placeholder?: string;
1857
+ ariaLabel?: string;
1858
+ style?: CheckoutStyle;
1859
+ }
1860
+ export interface IHeadlessHostedInput {
1861
+ getOptions(): HeadlessHostedInputOptions;
1862
+ setOptions(options: HeadlessHostedInputOptions): void;
1863
+ render(container: string | Element | null, options: HeadlessHostedInputOptions): Promise<void>;
1864
+ addEventListener(event: EventTypes, callback: EventListener$1): void;
1865
+ focus(): void;
1866
+ blur(): void;
1867
+ setDisabled(status: boolean): void;
1868
+ }
1869
+ export interface ICardPaymentMethodManager {
1870
+ createHostedInputs(): {
1871
+ cardNumberInput: IHeadlessHostedInput;
1872
+ expiryInput: IHeadlessHostedInput;
1873
+ cvvInput: IHeadlessHostedInput;
1874
+ };
1875
+ setCardholderName(cardholderName: string): void;
1876
+ removeHostedInputs(): void;
1877
+ submit(values?: CardPaymentMethodSubmitValues): Promise<void>;
1878
+ validate(): Promise<Validation>;
1879
+ reset(): void;
1880
+ }
1881
+ export type CardPaymentMethodSubmitValues = {
1882
+ cardNetwork?: string;
1883
+ };
1884
+ export interface PayPalStyles {
1885
+ buttonColor?: "gold" | "blue" | "silver" | "white" | "black";
1886
+ buttonShape?: "pill" | "rect";
1887
+ buttonSize?: "small" | "medium" | "large" | "responsive";
1888
+ buttonHeight?: number;
1889
+ buttonLabel?: "checkout" | "credit" | "pay" | "buynow" | "paypal" | "installment";
1890
+ buttonTagline?: boolean;
1891
+ }
1892
+ export interface GooglePayStyles {
1893
+ buttonType?: "long" | "short";
1894
+ buttonColor?: "default" | "black" | "white";
1895
+ shadowRoot?: boolean;
1896
+ }
1897
+ export interface ApplePayStyles {
1898
+ buttonType?: "plain" | "buy" | "set-up" | "donate" | "check-out" | "book" | "subscribe";
1899
+ buttonStyle?: "white" | "white-outline" | "black";
1900
+ }
1901
+ export interface HeadlessButtonRenderOptions {
1902
+ style?: GooglePayStyles | PayPalStyles | ApplePayStyles | Record<string, unknown>;
1903
+ }
1904
+ export interface IHeadlessPaymentMethodButton {
1905
+ render(containerId: string | Element, options: HeadlessButtonRenderOptions): Promise<void>;
1906
+ setDisabled(disabled: boolean): Promise<void>;
1907
+ clean(): void;
1908
+ focus(): void;
1909
+ blur(): void;
1910
+ addEventListener(event: EventTypes, callback: EventListener$1): void;
1911
+ }
1912
+ export interface INativePaymentMethodManager {
1913
+ createButton(): IHeadlessPaymentMethodButton;
1914
+ }
1915
+ export interface IRedirectPaymentMethodManager {
1916
+ start(): Promise<void>;
1917
+ addEventListener(event: EventTypes, callback: EventListener$1): void;
1918
+ }
1919
+ export interface IFormWithRedirectPaymentMethodManager<T> {
1920
+ start(): any;
1921
+ submit(data: T): any;
1922
+ }
1923
+ export interface IKlarnaPaymentMethodManager {
1924
+ start(paymentPayload: KlarnaPaymentPayload): Promise<KlarnaPaymentResponse>;
1925
+ renderCategory(renderCategoryDetails: RenderCategoryDetails): Promise<void>;
1926
+ addEventListener(event: EventTypes, callback: EventListener$1): void;
1927
+ getPaymentMethod(): void;
1928
+ }
1929
+ export interface IAchPaymentMethodManager {
1930
+ start(paymentDetails: StripeAchCustomerDetails): Promise<Validation | void>;
1931
+ collectBankAccountDetails(): Promise<void>;
1932
+ confirmMandate(): Promise<void>;
1933
+ declineMandate(): Promise<void>;
1934
+ getPaymentMethod(): void;
1935
+ }
1936
+ declare enum HeadlessManagerType {
1937
+ CARD = "CARD",
1938
+ NATIVE = "NATIVE",
1939
+ REDIRECT = "REDIRECT",
1940
+ FORM_WITH_REDIRECT = "FORM_WITH_REDIRECT",
1941
+ KLARNA = "KLARNA",
1942
+ ACH = "ACH"
1943
+ }
1944
+ export type PaymentMethodInfo = {
1945
+ type: PaymentMethodType;
1946
+ managerType: HeadlessManagerType;
1947
+ };
1948
+ export type ButtonPaymentMethodAsset = {
1949
+ backgroundColor: BackgroundColor;
1950
+ iconUrl: IconUrl;
1951
+ /**
1952
+ * @deprecated The property should not be used. Please use displayName or buttonText instead
1953
+ */
1954
+ paymentMethodName?: string;
1955
+ buttonText?: string;
1956
+ displayName?: string;
1957
+ };
1958
+ export interface IAssetsManager {
1959
+ getCardNetworkAsset(cardNetwork: string): Promise<CardNetworkAsset>;
1960
+ getPaymentMethodAsset(type: PaymentMethodType): Promise<ButtonPaymentMethodAsset | null>;
1961
+ }
1962
+ export type CardNetworkAsset = {
1963
+ cardUrl: string;
1964
+ displayName: string;
1965
+ };
1966
+ export interface CardPaymentMethodManagerOptions {
1967
+ /** @deprecated Use onCardNetworksChange instead. */
1968
+ onCardMetadataChange?: (metadata: CardMetadata) => void;
1969
+ onCardNetworksChange?: (event: CardNetworkChangeEvent) => void;
1970
+ onCardNetworksLoading?: () => void;
1971
+ }
1972
+ export type CardNetworkChangeEvent = {
1973
+ detectedCardNetworks: CardNetworks;
1974
+ selectableCardNetworks?: CardNetworks;
1975
+ source: "REMOTE" | "LOCAL" | "LOCAL_FALLBACK";
1976
+ };
1977
+ export type CardNetworks = {
1978
+ items: CardNetworkDetails[];
1979
+ preferred?: CardNetworkDetails;
1980
+ };
1981
+ export type CardNetworkDetails = CardNetworkInfo & {
1982
+ allowed: boolean;
1983
+ };
1984
+ export type CardNetworkInfo = {
1985
+ displayName: string;
1986
+ network: string;
1987
+ };
1988
+ export type BankIssuer = {
1989
+ id: string;
1990
+ name: string;
1991
+ iconUrl: string;
1992
+ disabled: boolean;
1993
+ };
1994
+ export interface FormWithRedirectConfiguration {
1995
+ bankIssuers?: BankIssuer[];
1996
+ error?: PrimerClientError | Error;
1997
+ }
1998
+ export interface FormWithRedirectPaymentMethodManagerOptions {
1999
+ onConfigurationLoad?: (payload: FormWithRedirectConfiguration) => void;
2000
+ }
2001
+ export interface KlarnaPaymentMethodManagerOptions {
2002
+ onPaymentMethodCategoriesChange?: (paymentMethodCategories: KlarnaPaymentMethodCategory[]) => void;
2003
+ }
2004
+ export interface AchPaymentMethodManagerOptions {
2005
+ onCollectBankAccountDetailsComplete?: () => void;
2006
+ }
2007
+ export type KlarnaPaymentMethodCategory = {
2008
+ id: string;
2009
+ name: string;
2010
+ descriptiveAssetUrl: string;
2011
+ standardAssetUrl: string;
2012
+ };
2013
+ export type KlarnaPaymentPayload = {
2014
+ paymentMethodCategoryId: string;
2015
+ };
2016
+ export type KlarnaPaymentResponse = {
2017
+ outcome: "APPROVED" | "DENIED";
2018
+ };
2019
+ export type RenderCategoryDetails = {
2020
+ containerId: string | Element;
2021
+ paymentMethodCategoryId: string;
2022
+ onHeightChange: (height: number) => void;
2023
+ };
2024
+ export type PaymentMethodManagerOptions = CardPaymentMethodManagerOptions | FormWithRedirectPaymentMethodManagerOptions | KlarnaPaymentMethodManagerOptions;
2025
+ export interface PrimerHeadlessCheckout {
2026
+ createPaymentMethodManager(type: "PAYMENT_CARD", options?: PaymentMethodManagerOptions): Promise<ICardPaymentMethodManager | null>;
2027
+ createPaymentMethodManager(type: "PAYPAL" | "GOOGLE_PAY" | "APPLE_PAY", options?: PaymentMethodManagerOptions): Promise<INativePaymentMethodManager | null>;
2028
+ createPaymentMethodManager(type: "ADYEN_IDEAL", options?: FormWithRedirectPaymentMethodManagerOptions): Promise<IFormWithRedirectPaymentMethodManager<BankIssuer> | null>;
2029
+ createPaymentMethodManager(type: "STRIPE_ACH", options?: AchPaymentMethodManagerOptions): Promise<IAchPaymentMethodManager | null>;
2030
+ createPaymentMethodManager(type: "KLARNA", options?: PaymentMethodManagerOptions): Promise<IKlarnaPaymentMethodManager | null>;
2031
+ createPaymentMethodManager(type: PaymentMethodType, options?: PaymentMethodManagerOptions): Promise<IRedirectPaymentMethodManager | null>;
2032
+ createVaultManager(): HeadlessVaultManager;
2033
+ /**
2034
+ * @deprecated
2035
+ * The options should be set on the `createHeadless` second parameter instead:
2036
+ * ```
2037
+ * Primer.createHeadless('clientToken', options);
2038
+ * ```
2039
+ */
2040
+ configure: (options: Omit<HeadlessUniversalCheckoutOptions, "clientSessionCachingEnabled">) => void;
2041
+ getAssetsManager(): IAssetsManager;
2042
+ start: () => Promise<void>;
2043
+ refreshClientSession(): Promise<boolean>;
2044
+ }
2045
+ export interface PrimerVaultManager {
2046
+ teardown(): void;
2047
+ submit(): void;
2048
+ }
2049
+ declare const Primer: {
2050
+ SDK_VERSION: string;
2051
+ createHeadless: (clientToken: string, options?: HeadlessUniversalCheckoutOptions | undefined) => Promise<Promise<PrimerHeadlessCheckout>>;
2052
+ showUniversalCheckout: (clientToken: string, options?: UniversalCheckoutOptions | undefined) => Promise<Promise<PrimerCheckout>>;
2053
+ showVaultManager: (clientToken: string, options?: VaultManagerOptions | undefined) => Promise<Promise<PrimerVaultManager>>;
2054
+ preloadPrimer: () => Promise<void>;
2055
+ };
2056
+ 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 ? {
2057
+ [K in keyof T as JSONSafe<T[K]> extends never ? never : K]: JSONSafe<T[K]>;
2058
+ } : T;
2059
+ export type PrimerCheckoutOptions = JSONSafe<HeadlessUniversalCheckoutOptions>;
2060
+ declare global {
2061
+ interface Window {
2062
+ Primer: typeof Primer;
2063
+ }
2064
+ }
2065
+ export type InitializedPaymentAssets = {
2066
+ displayName: string;
2067
+ backgroundColor?: BackgroundColor;
2068
+ buttonText: string;
2069
+ iconUrl?: IconUrl;
2070
+ };
2071
+ export type InitializedManager = {
2072
+ type: typeof PaymentMethodType.STRIPE_ACH;
2073
+ manager: IAchPaymentMethodManager;
2074
+ } | {
2075
+ type: typeof PaymentMethodType.PAYMENT_CARD;
2076
+ manager: ICardPaymentMethodManager;
2077
+ } | {
2078
+ type: typeof PaymentMethodType.KLARNA;
2079
+ manager: IKlarnaPaymentMethodManager;
2080
+ } | {
2081
+ type: RedirectPaymentMethodTypes;
2082
+ manager: IRedirectPaymentMethodManager;
2083
+ } | {
2084
+ type: typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY;
2085
+ manager: INativePaymentMethodManager;
2086
+ };
2087
+ export type ManagerByType<T extends PaymentMethodType> = Extract<InitializedManager, {
2088
+ type: T;
2089
+ }>;
2090
+ export interface InitializedManagersMap extends Map<PaymentMethodType, InitializedManager> {
2091
+ get<T extends PaymentMethodType>(key: T): ManagerByType<T> | undefined;
2092
+ }
2093
+ 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>;
2094
+ export type RedirectPaymentMethod = {
2095
+ type: RedirectPaymentMethodTypes;
2096
+ managerType: HeadlessManagerType.REDIRECT;
2097
+ assets: InitializedPaymentAssets;
2098
+ };
2099
+ export type InitializedPaymentMethod = {
2100
+ type: typeof PaymentMethodType.STRIPE_ACH;
2101
+ managerType: HeadlessManagerType.ACH;
2102
+ assets: InitializedPaymentAssets;
2103
+ } | {
2104
+ type: typeof PaymentMethodType.PAYMENT_CARD;
2105
+ managerType: HeadlessManagerType.CARD;
2106
+ assets: null;
2107
+ } | {
2108
+ type: typeof PaymentMethodType.KLARNA;
2109
+ managerType: HeadlessManagerType.KLARNA;
2110
+ assets: InitializedPaymentAssets;
2111
+ } | {
2112
+ type: typeof PaymentMethodType.PAYPAL;
2113
+ managerType: HeadlessManagerType.NATIVE;
2114
+ assets: null;
2115
+ } | {
2116
+ type: typeof PaymentMethodType.GOOGLE_PAY;
2117
+ managerType: HeadlessManagerType.NATIVE;
2118
+ assets: null;
2119
+ } | {
2120
+ type: typeof PaymentMethodType.APPLE_PAY;
2121
+ managerType: HeadlessManagerType.NATIVE;
2122
+ assets: null;
2123
+ } | RedirectPaymentMethod;
2124
+ export type PaymentMethodByType<T extends PaymentMethodType> = Extract<InitializedPaymentMethod, {
2125
+ type: T;
2126
+ }>;
2127
+ export interface InitializedPaymentMethodMap extends Map<PaymentMethodType, InitializedPaymentMethod> {
2128
+ get<T extends PaymentMethodType>(key: T): PaymentMethodByType<T> | undefined;
2129
+ }
2130
+ declare class PaymentsObject {
2131
+ private readonly _methods;
2132
+ constructor(map: InitializedPaymentMethodMap);
2133
+ get<T extends RedirectPaymentMethodTypes>(type: T): RedirectPaymentMethod | undefined;
2134
+ get<T extends (typeof PaymentMethodType)[keyof typeof PaymentMethodType]>(type: T): PaymentMethodByType<T> | undefined;
2135
+ toArray(): InitializedPaymentMethod[];
2136
+ size(): number;
2137
+ }
2138
+ export type SdkStateContext = {
2139
+ isSuccessful: boolean;
2140
+ isProcessing: boolean;
2141
+ error?: Error;
2142
+ isLoading?: boolean;
2143
+ failure?: {
2144
+ code: string;
2145
+ message: string;
2146
+ details?: Record<string, unknown>;
2147
+ };
2148
+ };
2149
+ export interface CardSubmitSuccessPayload {
2150
+ result: unknown;
2151
+ }
2152
+ export interface CardSubmitErrorsPayload {
2153
+ errors: unknown | InputValidationError[];
2154
+ }
2155
+ export interface PrimerEvents {
2156
+ "primer-state-changed": CustomEvent<SdkStateContext>;
2157
+ "primer-payment-methods-updated": CustomEvent<PaymentsObject>;
2158
+ "primer-checkout-initialized": CustomEvent<PrimerHeadlessCheckout>;
2159
+ "primer-card-network-change": CustomEvent<CardNetworksContext>;
2160
+ "primer-card-submit-success": CustomEvent<CardSubmitSuccessPayload>;
2161
+ "primer-card-submit-errors": CustomEvent<CardSubmitErrorsPayload>;
2162
+ }
2163
+ declare class PrimerEventsController implements ReactiveController {
2164
+ host: ReactiveControllerHost & LitElement;
2165
+ constructor(host: ReactiveControllerHost & LitElement);
2166
+ hostConnected(): void;
2167
+ /**
2168
+ * Dispatch a custom event using the unified naming pattern.
2169
+ * Ensures that every event bubbles and crosses shadow DOM boundaries.
2170
+ *
2171
+ * @param type - The event name as defined in PrimerEvents.
2172
+ * @param detail - The payload for the event.
2173
+ */
2174
+ dispatchEvent<K extends keyof PrimerEvents>(type: K, detail: PrimerEvents[K]["detail"]): void;
2175
+ dispatchSdkState(sdkState: SdkStateContext): void;
2176
+ dispatchPaymentMethods(paymentMethods: PaymentsObject): void;
2177
+ dispatchCheckoutInitialized(checkoutInstance: PrimerHeadlessCheckout): void;
2178
+ dispatchCardNetworkChange(network: CardNetworksContext): void;
2179
+ dispatchFormSubmitSuccess(result: unknown): void;
2180
+ dispatchFormSubmitErrors(errors: unknown): void;
2181
+ }
2182
+ declare class SdkStateController implements ReactiveController {
2183
+ host: PrimerCheckoutType;
2184
+ private _state;
2185
+ constructor(host: PrimerCheckoutType);
2186
+ hostConnected(): void;
2187
+ private reducer;
2188
+ private dispatch;
2189
+ startLoading(): void;
2190
+ startProcessing(): void;
2191
+ completeProcessing(): void;
2192
+ completeLoading(): void;
2193
+ setError(error: Error): void;
2194
+ setFailure(code: string, message: string, details?: Record<string, unknown>): void;
2195
+ reset(): void;
2196
+ get state(): SdkStateContext;
2197
+ }
2198
+ export interface PrimerCheckoutType extends ReactiveControllerHost, LitElement {
2199
+ requestUpdate: ReactiveControllerHost["requestUpdate"];
2200
+ customStyles: string;
2201
+ clientToken: string;
2202
+ options: PrimerCheckoutOptions;
2203
+ sdkContextController: SDKContextController;
2204
+ sdkStateController: SdkStateController;
2205
+ primerEventsController: PrimerEventsController;
2206
+ }
2207
+ declare class SDKContextController implements ReactiveController {
2208
+ host: PrimerCheckoutType;
2209
+ private sdkStateProvider;
2210
+ private paymentMethodsProvider;
2211
+ private paymentManagerProvider;
2212
+ private cardNetworksContext;
2213
+ constructor(host: PrimerCheckoutType);
2214
+ hostConnected(): void;
2215
+ /**
2216
+ * Updates the SDK state context.
2217
+ * @param value The new SDK state.
2218
+ */
2219
+ setSdkState(value: SdkStateContext): void;
2220
+ /**
2221
+ * Updates the payment methods context.
2222
+ * @param value The new payment methods data.
2223
+ */
2224
+ setPaymentMethods(value: PaymentsObject): void;
2225
+ /**
2226
+ * Updates the payment manager context.
2227
+ * @param value The new payment manager mapping.
2228
+ */
2229
+ setPaymentManagers(value: InitializedManagersMap): void;
2230
+ setCardNetworks(value: CardNetworksContext): void;
2231
+ }
2232
+ declare class StyleProcessingController implements ReactiveController {
2233
+ host: ReactiveControllerHost & LitElement;
2234
+ private static cssVarCache;
2235
+ constructor(host: ReactiveControllerHost & LitElement);
2236
+ /**
2237
+ * Processes the customStyles JSON string.
2238
+ * Expected JSON contains only CSS variable properties in camelCase.
2239
+ * @param jsonString The JSON string representing custom styles.
2240
+ */
2241
+ processCustomStyles(jsonString: string): void;
2242
+ /**
2243
+ * Validates a CSS property name to ensure it follows expected patterns.
2244
+ * @param property The CSS property name to validate.
2245
+ * @returns boolean True if the property name is considered valid.
2246
+ */
2247
+ private isValidCssProperty;
2248
+ /**
2249
+ * Validates a CSS value to ensure it only contains safe, expected characters.
2250
+ * Allowed characters include alphanumerics, whitespace, and common CSS punctuation.
2251
+ * This helps prevent CSS injection attacks.
2252
+ *
2253
+ * @param value The CSS value to validate.
2254
+ * @returns boolean True if the value is considered valid.
2255
+ */
2256
+ private isValidCssValue;
2257
+ /**
2258
+ * Gets the CSS variable name for a camelCase property key.
2259
+ * Uses caching for performance.
2260
+ *
2261
+ * @param key The camelCase property key
2262
+ * @returns The CSS variable name (kebab-case with -- prefix)
2263
+ */
2264
+ private getCssVarName;
2265
+ /**
2266
+ * Transforms a styles object into CSS variables and applies them to the host element.
2267
+ * Each key (in camelCase) is converted into a kebab-case CSS variable prefixed with '--'.
2268
+ * Only valid CSS properties and values are applied.
2269
+ *
2270
+ * @param styles An object with style keys and corresponding CSS values.
2271
+ */
2272
+ private applyStyles;
2273
+ /**
2274
+ * Removes a specific CSS variable from the host element
2275
+ * @param key The camelCase property key to remove
2276
+ */
2277
+ removeStyle(key: string): void;
2278
+ /**
2279
+ * Removes all custom styles from the host element
2280
+ */
2281
+ clearAllStyles(): void;
2282
+ /**
2283
+ * Optional cleanup when the host is disconnected
2284
+ */
2285
+ hostDisconnected(): void;
2286
+ }
2287
+ declare const sourceLocale = `en`;
2288
+ declare const targetLocales = [
2289
+ `ar`,
2290
+ `bg`,
2291
+ `ca`,
2292
+ `cs`,
2293
+ `da`,
2294
+ `de`,
2295
+ `el`,
2296
+ `en-GB`,
2297
+ `es`,
2298
+ `es-AR`,
2299
+ `es-MX`,
2300
+ `et-EE`,
2301
+ `fi-FI`,
2302
+ `fr`,
2303
+ `he`,
2304
+ `hr`,
2305
+ `hu`,
2306
+ `id`,
2307
+ `it`,
2308
+ `ja`,
2309
+ `ko`,
2310
+ `lt`,
2311
+ `lt-LT`,
2312
+ `lv`,
2313
+ `lv-LV`,
2314
+ `ms`,
2315
+ `nb`,
2316
+ `nl`,
2317
+ `nl_NL`,
2318
+ `pl`,
2319
+ `pt`,
2320
+ `pt-BR`,
2321
+ `ro`,
2322
+ `ru`,
2323
+ `sk`,
2324
+ `sl`,
2325
+ `sr-RS`,
2326
+ `sv`,
2327
+ `th`,
2328
+ `tr`,
2329
+ `uk-UA`,
2330
+ `vi`,
2331
+ `zf`,
2332
+ `zh-CN`,
2333
+ `zh-HK`,
2334
+ `zh-TW`,
2335
+ ] as const;
2336
+ export type LocaleCode = typeof sourceLocale | (typeof targetLocales)[number];
2337
+ declare class PrimerCheckoutComponent extends LitElement implements PrimerCheckoutType {
2338
+ static styles: CSSResult[];
2339
+ customStyles: string;
2340
+ clientToken: string;
2341
+ options: PrimerCheckoutOptions;
2342
+ disableLoader: boolean;
2343
+ defaultSlot: HTMLSlotElement;
2344
+ private hasAssignedContent;
2345
+ locale?: LocaleCode;
2346
+ private onSlotChange;
2347
+ sdkContextController: SDKContextController;
2348
+ sdkStateController: SdkStateController;
2349
+ primerEventsController: PrimerEventsController;
2350
+ styleProcessingController: StyleProcessingController;
2351
+ constructor();
2352
+ attributeChangedCallback(attrName: string, oldVal: string, newVal: string): void;
2353
+ willUpdate(changedProperties: PropertyValues): void;
2354
+ render(): TemplateResult;
2355
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: PrimerCheckoutComponent, ev: HTMLElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
2356
+ addEventListener<K extends keyof ShadowRootEventMap>(type: K, listener: (this: PrimerCheckoutComponent, ev: ShadowRootEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
2357
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: PrimerCheckoutComponent, ev: DocumentEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
2358
+ addEventListener<K extends keyof PrimerEvents>(type: K, listener: (this: PrimerCheckoutComponent, ev: PrimerEvents[K]) => void, options?: boolean | AddEventListenerOptions): void;
2359
+ }
2360
+ /**
2361
+ * Size options for the spinner component
2362
+ */
2363
+ export type SpinnerSize = "small" | "medium" | "large";
2364
+ declare class SpinnerComponent extends LitElement {
2365
+ /**
2366
+ * Color of the spinner
2367
+ * Defaults to the design system loader color
2368
+ */
2369
+ color: string;
2370
+ /**
2371
+ * Size of the spinner
2372
+ * Available values: 'small', 'medium', 'large' or a custom number as string
2373
+ */
2374
+ size: SpinnerSize | string;
2375
+ /**
2376
+ * Whether to use compact mode (minimal margins)
2377
+ * Useful when embedding in inputs
2378
+ */
2379
+ compact: boolean;
2380
+ static styles: CSSResult[];
2381
+ /**
2382
+ * Get the actual size value in pixels
2383
+ */
2384
+ private getSize;
2385
+ render(): TemplateResult<1>;
2386
+ }
2387
+ declare global {
2388
+ interface HTMLElementTagNameMap {
2389
+ "primer-spinner": SpinnerComponent;
2390
+ }
2391
+ }
2392
+ declare class InputWrapperComponent extends LitElement {
2393
+ static styles: CSSResult[];
2394
+ focusWithin: boolean;
2395
+ hasError: boolean;
2396
+ private inputSlot;
2397
+ /**
2398
+ * Event handler for click events on the input slot wrapper.
2399
+ * Does one of the following:
2400
+ * 1. If a primer-input is found inside, focus it directly
2401
+ * 2. Otherwise, dispatch a wrapper-click event for hosted inputs to handle
2402
+ */
2403
+ private handleWrapperClick;
2404
+ /**
2405
+ * Finds the first primer-input element inside the input slot
2406
+ * @returns The primer-input element or null if not found
2407
+ */
2408
+ private findSlottedPrimerInput;
2409
+ render(): TemplateResult<1>;
2410
+ }
2411
+ declare global {
2412
+ interface HTMLElementTagNameMap {
2413
+ "primer-input-wrapper": InputWrapperComponent;
2414
+ }
2415
+ }
2416
+ declare class InputLabelComponent extends LitElement {
2417
+ static styles: CSSResult[];
2418
+ /**
2419
+ * ID of the form control this label is associated with
2420
+ */
2421
+ for: string;
2422
+ /**
2423
+ * Whether the label should appear disabled
2424
+ */
2425
+ disabled: boolean;
2426
+ render(): TemplateResult<1>;
2427
+ }
2428
+ declare global {
2429
+ interface HTMLElementTagNameMap {
2430
+ "primer-input-label": InputLabelComponent;
2431
+ }
2432
+ }
2433
+ declare class ButtonComponent extends LitElement {
2434
+ static styles: CSSResult[];
2435
+ variant: "primary" | "secondary" | "tertiary";
2436
+ disabled: boolean;
2437
+ buttonType: "button" | "submit" | "reset";
2438
+ render(): TemplateResult<1>;
2439
+ }
2440
+ declare global {
2441
+ interface HTMLElementTagNameMap {
2442
+ "primer-button": ButtonComponent;
2443
+ }
2444
+ }
2445
+ declare class InputErrorComponent extends LitElement {
2446
+ static styles: CSSResult[];
2447
+ /**
2448
+ * ID of the form control this error message is associated with
2449
+ */
2450
+ for: string;
2451
+ /**
2452
+ * Whether the error is currently active/visible
2453
+ */
2454
+ active: boolean;
2455
+ render(): TemplateResult<1>;
2456
+ }
2457
+ declare global {
2458
+ interface HTMLElementTagNameMap {
2459
+ "primer-input-error": InputErrorComponent;
2460
+ }
2461
+ }
2462
+ export type IconName = keyof typeof icons;
2463
+ declare const icons: Record<string, SVGTemplateResult>;
2464
+ declare class PrimerIconComponent extends LitElement {
2465
+ static styles: CSSResult[];
2466
+ color: string;
2467
+ size: "lg" | "sm";
2468
+ /** The name of the icon to draw - available names can be found under library.ts file */
2469
+ name?: IconName;
2470
+ render(): TemplateResult<1>;
2471
+ }
2472
+ declare global {
2473
+ interface HTMLElementTagNameMap {
2474
+ "primer-icon": PrimerIconComponent;
2475
+ }
2476
+ }
2477
+ declare class PrimerCheckoutStateComponent extends LitElement {
2478
+ static styles: CSSResult[];
2479
+ type: "complete" | "failure";
2480
+ description?: string;
2481
+ render(): TemplateResult<1>;
2482
+ }
2483
+ declare global {
2484
+ interface HTMLElementTagNameMap {
2485
+ "primer-checkout-state": PrimerCheckoutStateComponent;
2486
+ }
2487
+ }
2488
+ /**
2489
+ * Input types supported by this component
2490
+ */
2491
+ export type InputType = "text" | "password" | "email" | "number" | "tel" | "url" | "search" | "date" | "time" | "datetime-local" | "month" | "week" | "color";
2492
+ /**
2493
+ * Custom events dispatched by this component
2494
+ */
2495
+ export type InputEventMap = {
2496
+ input: CustomEvent<string>;
2497
+ change: CustomEvent<string>;
2498
+ focus: FocusEvent;
2499
+ blur: FocusEvent;
2500
+ invalid: Event;
2501
+ };
2502
+ declare class InputComponent extends LitElement {
2503
+ static styles: CSSResult[];
2504
+ private inputElement;
2505
+ value: string;
2506
+ placeholder: string;
2507
+ disabled: boolean;
2508
+ name: string;
2509
+ type: InputType;
2510
+ required: boolean;
2511
+ readonly: boolean;
2512
+ pattern: string;
2513
+ minlength?: number;
2514
+ maxlength?: number;
2515
+ min: string;
2516
+ max: string;
2517
+ step: string;
2518
+ autocomplete: string;
2519
+ id: string;
2520
+ private hasFocus;
2521
+ private hasError;
2522
+ /**
2523
+ * Handles input events and dispatches a custom event with the current value
2524
+ */
2525
+ private handleInput;
2526
+ /**
2527
+ * Handles change events and dispatches a custom event with the committed value
2528
+ */
2529
+ private handleChange;
2530
+ /**
2531
+ * Handles focus events and updates internal state
2532
+ */
2533
+ private handleFocus;
2534
+ /**
2535
+ * Handles blur events and updates internal state
2536
+ */
2537
+ private handleBlur;
2538
+ /**
2539
+ * Handles invalid events and updates internal state
2540
+ */
2541
+ private handleInvalid;
2542
+ /**
2543
+ * Focus the input element
2544
+ * @param options Optional focus options
2545
+ */
2546
+ focus(options?: FocusOptions): void;
2547
+ /**
2548
+ * Remove focus from the input element
2549
+ */
2550
+ blur(): void;
2551
+ /**
2552
+ * Select all text in the input element
2553
+ */
2554
+ select(): void;
2555
+ /**
2556
+ * Set the selection range of the input element
2557
+ */
2558
+ setSelectionRange(start: number, end: number, direction?: "forward" | "backward" | "none"): void;
2559
+ /**
2560
+ * Get the validity state of the input element
2561
+ */
2562
+ get validity(): ValidityState;
2563
+ /**
2564
+ * Get the validation message of the input element
2565
+ */
2566
+ get validationMessage(): string;
2567
+ /**
2568
+ * Check if the input element is valid
2569
+ */
2570
+ checkValidity(): boolean;
2571
+ /**
2572
+ * Report the validity of the input element
2573
+ */
2574
+ reportValidity(): boolean;
2575
+ render(): TemplateResult<1>;
2576
+ /**
2577
+ * Type safe event dispatcher - allows consumers to use proper types
2578
+ * when listening to events from this component
2579
+ */
2580
+ addEventListener<K extends keyof InputEventMap>(type: K, listener: (ev: InputEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
2581
+ /**
2582
+ * Type safe event dispatcher removal
2583
+ */
2584
+ removeEventListener<K extends keyof InputEventMap>(type: K, listener: (ev: InputEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
2585
+ }
2586
+ declare global {
2587
+ interface HTMLElementTagNameMap {
2588
+ "primer-input": InputComponent;
2589
+ }
2590
+ }
2591
+ declare class PaymentMethodComponent extends LitElement {
2592
+ static styles: CSSResult[];
2593
+ type: PaymentMethodType | undefined;
2594
+ paymentMethods: PaymentsObject | null;
2595
+ render(): TemplateResult<1> | typeof nothing;
2596
+ }
2597
+ declare global {
2598
+ interface HTMLElementTagNameMap {
2599
+ "primer-payment-method": PaymentMethodComponent;
2600
+ }
2601
+ }
2602
+ declare class RedirectPaymentComponent extends LitElement {
2603
+ static styles: CSSResult[];
2604
+ paymentMethod: InitializedPaymentMethod | undefined;
2605
+ paymentManagers: InitializedManagersMap;
2606
+ sdkState: SdkStateContext | undefined;
2607
+ private _paymentMethodManagerTask;
2608
+ startRedirectPayment(): void;
2609
+ render(): symbol | TemplateResult<1> | undefined;
2610
+ }
2611
+ declare global {
2612
+ interface HTMLElementTagNameMap {
2613
+ "primer-redirect-payment": RedirectPaymentComponent;
2614
+ }
2615
+ }
2616
+ declare class PrimerMainComponent extends LitElement {
2617
+ static styles: CSSResult[];
2618
+ private hasAssignedContent;
2619
+ /**
2620
+ * Inline slotchange event listener.
2621
+ * Uses assignedNodes with flatten to detect if the slot has any nodes.
2622
+ */
2623
+ private onSlotChange;
2624
+ paymentMethods: PaymentsObject | null;
2625
+ sdkState: SdkStateContext | undefined;
2626
+ render(): TemplateResult<1>;
2627
+ }
2628
+ declare global {
2629
+ interface HTMLElementTagNameMap {
2630
+ "primer-main": PrimerMainComponent;
2631
+ }
2632
+ }
2633
+ declare class NativePaymentComponent extends LitElement {
2634
+ static styles: CSSResult[];
2635
+ paymentMethod: InitializedPaymentMethod | undefined;
2636
+ paymentManagers: InitializedManagersMap;
2637
+ private _buttonId;
2638
+ private loadManagerTask;
2639
+ constructor();
2640
+ protected updated(changedProperties: PropertyValues): void;
2641
+ render(): symbol | TemplateResult<1> | undefined;
2642
+ }
2643
+ declare global {
2644
+ interface HTMLElementTagNameMap {
2645
+ "primer-native-payment": NativePaymentComponent;
2646
+ }
2647
+ }
2648
+ declare class CardFormComponent extends LitElement {
2649
+ static styles: CSSResult[];
2650
+ /**
2651
+ * Tracks whether custom content has been provided via slot
2652
+ */
2653
+ private hasAssignedContent;
2654
+ private selectedCardNetwork;
2655
+ /**
2656
+ * Payment managers injected from context
2657
+ */
2658
+ paymentManagers: InitializedManagersMap;
2659
+ /**
2660
+ * Context provider for card form data
2661
+ */
2662
+ private readonly cardFormProvider;
2663
+ /**
2664
+ * Events controller for dispatching form events
2665
+ */
2666
+ private readonly eventsController;
2667
+ /**
2668
+ * Task to set up the card form with hosted inputs
2669
+ */
2670
+ private readonly setupCardFormTask;
2671
+ connectedCallback(): void;
2672
+ disconnectedCallback(): void;
2673
+ /**
2674
+ * Handles click events from slotted content.
2675
+ * Supports both native <button> and custom <primer-button> elements.
2676
+ */
2677
+ private handleSlotButtonClick;
2678
+ /**
2679
+ * Handles direct submit events from child components
2680
+ * This is a backup method to catch all possible submission events
2681
+ */
2682
+ private handleDirectSubmit;
2683
+ /**
2684
+ * Determines if a button is a submit button based on its attributes
2685
+ */
2686
+ private isSubmitButton;
2687
+ /**
2688
+ * Handles slot change events to detect custom content
2689
+ */
2690
+ private onSlotChange;
2691
+ /**
2692
+ * Handles the card form submission.
2693
+ * Validates the form and dispatches either a submit success or errors event.
2694
+ */
2695
+ private submitCardPayment;
2696
+ /**
2697
+ * Event handler for form submission
2698
+ * Handles both native form submissions and custom events
2699
+ */
2700
+ private handleFormSubmit;
2701
+ render(): TemplateResult<1> | typeof nothing;
2702
+ }
2703
+ export interface CardFormContext {
2704
+ cardNumberInput: IHeadlessHostedInput;
2705
+ expiryInput: IHeadlessHostedInput;
2706
+ cvvInput: IHeadlessHostedInput;
2707
+ setCardholderName: (val: string) => void;
2708
+ setCardNetwork: (val: string) => void;
2709
+ validate: () => Promise<Validation>;
2710
+ submit: (values?: CardPaymentMethodSubmitValues) => Promise<void>;
2711
+ errors?: Validation["validationErrors"];
2712
+ }
2713
+ /**
2714
+ * A shared type that ensures the host of a HostedInputController contains
2715
+ * the required properties for proper hosted input handling.
2716
+ */
2717
+ export interface HostedInputHost extends ReactiveControllerHost, LitElement {
2718
+ cardFormContext: CardFormContext | null;
2719
+ /** A string for the input placeholder. */
2720
+ placeholder: string;
2721
+ /** An accessible label for the input. */
2722
+ ariaLabel: string;
2723
+ /** The label for the input. */
2724
+ label: string;
2725
+ requestUpdate: ReactiveControllerHost["requestUpdate"];
2726
+ }
2727
+ export interface TaskFunctionOptions {
2728
+ signal: AbortSignal;
2729
+ }
2730
+ export type TaskFunction<D extends ReadonlyArray<unknown>, R = unknown> = (args: D, options: TaskFunctionOptions) => R | typeof initialState | Promise<R | typeof initialState>;
2731
+ export type ArgsFunction<D extends ReadonlyArray<unknown>> = () => D;
2732
+ declare const TaskStatus: {
2733
+ readonly INITIAL: 0;
2734
+ readonly PENDING: 1;
2735
+ readonly COMPLETE: 2;
2736
+ readonly ERROR: 3;
2737
+ };
2738
+ declare const initialState: unique symbol;
2739
+ export type TaskStatus = (typeof TaskStatus)[keyof typeof TaskStatus];
2740
+ export type StatusRenderer<R> = {
2741
+ initial?: () => unknown;
2742
+ pending?: () => unknown;
2743
+ complete?: (value: R) => unknown;
2744
+ error?: (error: unknown) => unknown;
2745
+ };
2746
+ export interface TaskConfig<T extends ReadonlyArray<unknown>, R> {
2747
+ task: TaskFunction<T, R>;
2748
+ args?: ArgsFunction<T>;
2749
+ /**
2750
+ * Determines if the task is run automatically when arguments change after a
2751
+ * host update. Default to `true`.
2752
+ *
2753
+ * If `true`, the task checks arguments during the host update (after
2754
+ * `willUpdate()` and before `update()` in Lit) and runs if they change. For
2755
+ * a task to see argument changes they must be done in `willUpdate()` or
2756
+ * earlier. The host element can see task status changes caused by its own
2757
+ * current update.
2758
+ *
2759
+ * If `'afterUpdate'`, the task checks arguments and runs _after_ the host
2760
+ * update. This means that the task can see host changes done in update, such
2761
+ * as rendered DOM. The host element can not see task status changes caused
2762
+ * by its own update, so the task must trigger a second host update to make
2763
+ * those changes renderable.
2764
+ *
2765
+ * Note: `'afterUpdate'` is unlikely to be SSR compatible in the future.
2766
+ *
2767
+ * If `false`, the task is not run automatically, and must be run with the
2768
+ * {@linkcode run} method.
2769
+ */
2770
+ autoRun?: boolean | "afterUpdate";
2771
+ /**
2772
+ * A function that determines if the current arg and previous args arrays are
2773
+ * equal. If the argsEqual function returns true, the task will not auto-run.
2774
+ *
2775
+ * The default is {@linkcode shallowArrayEquals}. {@linkcode deepArrayEquals}
2776
+ * is also available.
2777
+ */
2778
+ argsEqual?: (oldArgs: T, newArgs: T) => boolean;
2779
+ /**
2780
+ * If initialValue is provided, the task is initialized to the COMPLETE
2781
+ * status and the value is set to initialData.
2782
+ *
2783
+ * Initial args should be coherent with the initialValue, since they are
2784
+ * assumed to be the args that would produce that value. When autoRun is
2785
+ * `true` the task will not auto-run again until the args change.
2786
+ */
2787
+ initialValue?: R;
2788
+ onComplete?: (value: R) => unknown;
2789
+ onError?: (error: unknown) => unknown;
2790
+ }
2791
+ declare class Task<const T extends ReadonlyArray<unknown> = ReadonlyArray<unknown>, const R = unknown> {
2792
+ private _previousArgs?;
2793
+ private _task;
2794
+ private _argsFn?;
2795
+ private _argsEqual;
2796
+ private _callId;
2797
+ private _host;
2798
+ private _value?;
2799
+ private _error?;
2800
+ private _abortController?;
2801
+ private _onComplete?;
2802
+ private _onError?;
2803
+ private _status;
2804
+ /**
2805
+ * Determines if the task is run automatically when arguments change after a
2806
+ * host update. Default to `true`.
2807
+ *
2808
+ * @see {@link TaskConfig.autoRun} for more information.
2809
+ */
2810
+ autoRun: boolean | "afterUpdate";
2811
+ /**
2812
+ * A Promise that resolve when the current task run is complete.
2813
+ *
2814
+ * If a new task run is started while a previous run is pending, the Promise
2815
+ * is kept and only resolved when the new run is completed.
2816
+ */
2817
+ get taskComplete(): Promise<R>;
2818
+ private _resolveTaskComplete?;
2819
+ private _rejectTaskComplete?;
2820
+ private _taskComplete?;
2821
+ constructor(host: ReactiveControllerHost, task: TaskConfig<T, R>);
2822
+ constructor(host: ReactiveControllerHost, task: TaskFunction<T, R>, args?: ArgsFunction<T>);
2823
+ hostUpdate(): void;
2824
+ hostUpdated(): void;
2825
+ private _getArgs;
2826
+ /**
2827
+ * Determines if the task should run when it's triggered because of a
2828
+ * host update, and runs the task if it should.
2829
+ *
2830
+ * A task should run when its arguments change from the previous run, based on
2831
+ * the args equality function.
2832
+ *
2833
+ * This method is side-effectful: it stores the new args as the previous args.
2834
+ */
2835
+ private _performTask;
2836
+ /**
2837
+ * Runs a task manually.
2838
+ *
2839
+ * This can be useful for running tasks in response to events as opposed to
2840
+ * automatically running when host element state changes.
2841
+ *
2842
+ * @param args an optional set of arguments to use for this task run. If args
2843
+ * is not given, the args function is called to get the arguments for
2844
+ * this run.
2845
+ */
2846
+ run(args?: T): Promise<void>;
2847
+ /**
2848
+ * Aborts the currently pending task run by aborting the AbortSignal
2849
+ * passed to the task function.
2850
+ *
2851
+ * Aborting a task does nothing if the task is not running: ie, in the
2852
+ * complete, error, or initial states.
2853
+ *
2854
+ * Aborting a task does not automatically cancel the task function. The task
2855
+ * function must be written to accept the AbortSignal and either forward it
2856
+ * to other APIs like `fetch()`, or handle cancellation manually by using
2857
+ * [`signal.throwIfAborted()`]{@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/throwIfAborted}
2858
+ * or the
2859
+ * [`abort`]{@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/abort_event}
2860
+ * event.
2861
+ *
2862
+ * @param reason The reason for aborting. Passed to
2863
+ * `AbortController.abort()`.
2864
+ */
2865
+ abort(reason?: unknown): void;
2866
+ /**
2867
+ * The result of the previous task run, if it resolved.
2868
+ *
2869
+ * Is `undefined` if the task has not run yet, or if the previous run errored.
2870
+ */
2871
+ get value(): R | undefined;
2872
+ /**
2873
+ * The error from the previous task run, if it rejected.
2874
+ *
2875
+ * Is `undefined` if the task has not run yet, or if the previous run
2876
+ * completed successfully.
2877
+ */
2878
+ get error(): unknown;
2879
+ get status(): TaskStatus;
2880
+ render<T extends StatusRenderer<R>>(renderer: T): MaybeReturnType<T["initial"]> | MaybeReturnType<T["pending"]> | MaybeReturnType<T["complete"]> | MaybeReturnType<T["error"]>;
2881
+ }
2882
+ export type MaybeReturnType<F> = F extends (...args: never[]) => infer R ? R : undefined;
2883
+ /**
2884
+ * Available input types for hosted inputs.
2885
+ */
2886
+ export type HostedInputType = "cardNumber" | "cvv" | "expire" | "cardholderName";
2887
+ /**
2888
+ * Configuration for the hosted input controller.
2889
+ */
2890
+ export interface HostedInputConfig {
2891
+ /** Differentiates the input type. */
2892
+ type: HostedInputType;
2893
+ /** Selector for the container element where the input should be rendered. */
2894
+ containerSelector: string;
2895
+ /**
2896
+ * Optional callback for handling input events (e.g. for CardFormName).
2897
+ */
2898
+ onInput?: (value: string) => void;
2899
+ }
2900
+ /**
2901
+ * Possible input source types that can be returned by getHostedInput
2902
+ */
2903
+ export type InputSource = IHeadlessHostedInput | "cardholderName" | undefined;
2904
+ declare class HostedInputController<T extends HostedInputHost> implements ReactiveController {
2905
+ private _isFocused;
2906
+ private _hostedInput;
2907
+ private _standardInput;
2908
+ private readonly host;
2909
+ private readonly config;
2910
+ /**
2911
+ * Task to set up the hosted input.
2912
+ */
2913
+ readonly setupTask: Task<[
2914
+ InputSource
2915
+ ], boolean | typeof initialState>;
2916
+ constructor(host: T, config: HostedInputConfig);
2917
+ /**
2918
+ * Focuses the input, whether it's a hosted input or standard input
2919
+ */
2920
+ focusInput(): void;
2921
+ /**
2922
+ * Returns the hosted input from the card form context based on the type.
2923
+ * For 'cardholderName', no hosted input is provided so we return a fallback indicator.
2924
+ */
2925
+ private getHostedInput;
2926
+ /**
2927
+ * Sets up the hosted input.
2928
+ * If a hosted input is provided, it renders it into the target container.
2929
+ * Otherwise (e.g. for cardholderName), it creates a standard input element.
2930
+ */
2931
+ private setupHostedInput;
2932
+ /**
2933
+ * Gets the target container element from the host's render root
2934
+ */
2935
+ private getTargetContainer;
2936
+ /**
2937
+ * Sets up a standard input element for non-hosted input types
2938
+ */
2939
+ private setupStandardInput;
2940
+ /**
2941
+ * Sets up event listeners for standard input elements
2942
+ */
2943
+ private setupInputEventListeners;
2944
+ /**
2945
+ * Sets up a hosted iframe input for iframe-based input types
2946
+ */
2947
+ private setupHostedIframeInput;
2948
+ /** Exposes the current focus state. */
2949
+ get isFocused(): boolean;
2950
+ hostConnected(): void;
2951
+ hostDisconnected(): void;
2952
+ }
2953
+ /**
2954
+ * Translation configuration object
2955
+ */
2956
+ export type TranslationConfig = {
2957
+ id: string;
2958
+ defaultMessage: string;
2959
+ };
2960
+ /**
2961
+ * Configuration for abstract input component
2962
+ */
2963
+ export interface InputComponentConfig {
2964
+ /** The component's hosted input type */
2965
+ inputType: HostedInputType;
2966
+ /** ID selector for the container where the input will be rendered */
2967
+ containerSelector: string;
2968
+ /** Error name to match in the card form context */
2969
+ errorName: string;
2970
+ /** Translation keys for default values */
2971
+ translations: {
2972
+ label: TranslationConfig | string;
2973
+ placeholder?: TranslationConfig | string;
2974
+ ariaLabel?: TranslationConfig | string;
2975
+ };
2976
+ /** Optional input handler for non-hosted inputs */
2977
+ onInput?: (value: string) => void;
2978
+ }
2979
+ declare abstract class AbstractCardInputComponent extends LitElement implements HostedInputHost {
2980
+ cardFormContext: CardFormContext | null;
2981
+ /** Tracks which properties were explicitly set by the user */
2982
+ protected readonly _userAssignedProps: Set<string>;
2983
+ /** Internal storage for property values */
2984
+ protected _internalLabel: string;
2985
+ protected _internalPlaceholder: string;
2986
+ protected _internalAriaLabel: string;
2987
+ /** Configuration for this input component */
2988
+ protected abstract readonly config: InputComponentConfig;
2989
+ /** Hosted input controller */
2990
+ protected readonly hostedInputController: HostedInputController<HostedInputHost>;
2991
+ /**
2992
+ * Gets a translated or static string value from the translation config
2993
+ */
2994
+ private getTranslatedValue;
2995
+ /**
2996
+ * The input label text.
2997
+ * Falls back to localized default if not explicitly set.
2998
+ */
2999
+ get label(): string;
3000
+ set label(value: string);
3001
+ /**
3002
+ * The input placeholder text.
3003
+ * Falls back to localized default if not explicitly set.
3004
+ * When explicitly set to empty string, no placeholder will be displayed.
3005
+ */
3006
+ get placeholder(): string;
3007
+ set placeholder(value: string);
3008
+ /**
3009
+ * The input aria-label attribute.
3010
+ * Falls back to localized default if not explicitly set.
3011
+ */
3012
+ get ariaLabel(): string;
3013
+ set ariaLabel(value: string);
3014
+ constructor();
3015
+ /**
3016
+ * Initialize the controller after the component has been constructed
3017
+ * and the config is available
3018
+ */
3019
+ protected childUpdated(): void;
3020
+ /**
3021
+ * Handler for wrapper-click event from InputWrapper component
3022
+ * This is still needed for hosted iframe inputs
3023
+ */
3024
+ private handleWrapperClick;
3025
+ /**
3026
+ * Common rendering logic for all card input components
3027
+ */
3028
+ protected renderInput(): TemplateResult<1> | typeof nothing;
3029
+ }
3030
+ declare class InputCardNumberComponent extends AbstractCardInputComponent {
3031
+ static styles: CSSResult[];
3032
+ /**
3033
+ * Configuration for this input component
3034
+ */
3035
+ protected readonly config: InputComponentConfig;
3036
+ constructor();
3037
+ /**
3038
+ * Handle network selection from the network selector component
3039
+ */
3040
+ private handleNetworkSelected;
3041
+ /**
3042
+ * Override the renderInput method to include the network selector
3043
+ */
3044
+ protected renderInput(): TemplateResult<1> | typeof nothing;
3045
+ render(): TemplateResult<1> | typeof nothing;
3046
+ }
3047
+ declare global {
3048
+ interface HTMLElementTagNameMap {
3049
+ "primer-input-card-number": InputCardNumberComponent;
3050
+ }
3051
+ }
3052
+ declare class InputCvvComponent extends AbstractCardInputComponent {
3053
+ static styles: CSSResult[];
3054
+ protected readonly config: InputComponentConfig;
3055
+ constructor();
3056
+ render(): TemplateResult<1> | typeof nothing;
3057
+ }
3058
+ declare global {
3059
+ interface HTMLElementTagNameMap {
3060
+ "primer-input-cvv": InputCvvComponent;
3061
+ }
3062
+ }
3063
+ declare class InputCardExpiryComponent extends AbstractCardInputComponent {
3064
+ static styles: CSSResult[];
3065
+ protected readonly config: InputComponentConfig;
3066
+ constructor();
3067
+ render(): TemplateResult<1> | typeof nothing;
3068
+ }
3069
+ declare global {
3070
+ interface HTMLElementTagNameMap {
3071
+ "primer-input-card-expiry": InputCardExpiryComponent;
3072
+ }
3073
+ }
3074
+ declare class InputCardHolderNameComponent extends AbstractCardInputComponent {
3075
+ static styles: CSSResult[];
3076
+ protected readonly config: InputComponentConfig;
3077
+ constructor();
3078
+ private handleInput;
3079
+ render(): TemplateResult<1> | typeof nothing;
3080
+ }
3081
+ declare global {
3082
+ interface HTMLElementTagNameMap {
3083
+ "primer-input-card-holder-name": InputCardHolderNameComponent;
3084
+ }
3085
+ }
3086
+ declare class CardFormSubmitComponent extends LitElement {
3087
+ static styles: CSSResult[];
3088
+ private readonly _userAssignedProps;
3089
+ private _internalButtonText;
3090
+ /**
3091
+ * The button text to display.
3092
+ * Falls back to localized default if not explicitly set.
3093
+ */
3094
+ get buttonText(): string;
3095
+ set buttonText(value: string);
3096
+ /**
3097
+ * The button variant to use.
3098
+ * @default "primary"
3099
+ */
3100
+ variant: string;
3101
+ /**
3102
+ * Whether the button is disabled.
3103
+ * @default false
3104
+ */
3105
+ disabled: boolean;
3106
+ private handleClick;
3107
+ render(): TemplateResult<1>;
3108
+ }
3109
+ declare global {
3110
+ interface HTMLElementTagNameMap {
3111
+ "primer-card-form-submit": CardFormSubmitComponent;
3112
+ }
3113
+ }
3114
+ declare class CardNetworkSelectorComponent extends LitElement {
3115
+ static styles: CSSResult[];
3116
+ /**
3117
+ * Card networks context from provider
3118
+ */
3119
+ cardNetworks: CardNetworksContext | null;
3120
+ private selectedCardNetwork;
3121
+ /**
3122
+ * Internal state to track if dropdown is open
3123
+ */
3124
+ private isDropdownOpen;
3125
+ /**
3126
+ * Index of the currently focused network in the dropdown
3127
+ */
3128
+ private focusedNetworkIndex;
3129
+ /**
3130
+ * Tracks if keyboard navigation is being used
3131
+ */
3132
+ private isKeyboardNavigation;
3133
+ /**
3134
+ * Reference to the dropdown button
3135
+ */
3136
+ private buttonRef;
3137
+ /**
3138
+ * Reference to the dropdown container
3139
+ */
3140
+ private dropdownRef;
3141
+ /**
3142
+ * Reference to network option elements
3143
+ */
3144
+ private networkOptionRefs;
3145
+ /**
3146
+ * Toggle the dropdown state
3147
+ */
3148
+ private toggleDropdown;
3149
+ /**
3150
+ * Get selectable networks from context
3151
+ */
3152
+ private getSelectableNetworks;
3153
+ /**
3154
+ * Get detected network from context
3155
+ */
3156
+ private getDetectedNetwork;
3157
+ /**
3158
+ * Get the index of the currently selected network
3159
+ */
3160
+ private getSelectedNetworkIndex;
3161
+ /**
3162
+ * Handle network selection
3163
+ */
3164
+ private selectNetwork;
3165
+ /**
3166
+ * Handle click outside to close dropdown
3167
+ */
3168
+ private handleClickOutside;
3169
+ /**
3170
+ * Handle mouse movement to disable keyboard navigation mode
3171
+ */
3172
+ private handleMouseMove;
3173
+ /**
3174
+ * Handle keydown events for keyboard navigation
3175
+ */
3176
+ private handleKeyDown;
3177
+ /**
3178
+ * Focus the current network option
3179
+ */
3180
+ private focusNetworkOption;
3181
+ /**
3182
+ * Save reference to network option element
3183
+ */
3184
+ private setNetworkOptionRef;
3185
+ /**
3186
+ * Lifecycle: Add document event listener when connected
3187
+ */
3188
+ connectedCallback(): void;
3189
+ /**
3190
+ * Lifecycle: Remove document event listener when disconnected
3191
+ */
3192
+ disconnectedCallback(): void;
3193
+ render(): TemplateResult<1>;
3194
+ }
3195
+ declare global {
3196
+ interface HTMLElementTagNameMap {
3197
+ "primer-card-network-selector": CardNetworkSelectorComponent;
3198
+ }
3199
+ }
3200
+ declare global {
3201
+ interface HTMLElementTagNameMap {
3202
+ "primer-card-form": CardFormComponent;
3203
+ }
3204
+ }
3205
+ declare class PrimerCheckoutCompleteComponent extends LitElement {
3206
+ render(): TemplateResult<1>;
3207
+ }
3208
+ declare global {
3209
+ interface HTMLElementTagNameMap {
3210
+ "primer-checkout-complete": PrimerCheckoutCompleteComponent;
3211
+ }
3212
+ }
3213
+ export interface HeadlessSDKState {
3214
+ isProcessing: boolean;
3215
+ isSuccessful: boolean;
3216
+ isFailure: boolean;
3217
+ error?: Error | undefined;
3218
+ }
3219
+ declare class PrimerCheckoutFailureComponent extends LitElement {
3220
+ sdkState: HeadlessSDKState | undefined;
3221
+ render(): TemplateResult<1>;
3222
+ }
3223
+ declare global {
3224
+ interface HTMLElementTagNameMap {
3225
+ "primer-checkout-failure": PrimerCheckoutFailureComponent;
3226
+ }
3227
+ }
3228
+ declare global {
3229
+ interface HTMLElementTagNameMap {
3230
+ "primer-checkout": PrimerCheckoutComponent;
3231
+ }
3232
+ }
3233
+
3234
+ export {};