@primer-io/checkout-web 2.31.1 → 2.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/Primer.js +1 -1
- package/dist/index.d.ts +995 -112
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,23 +1,11 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v6.9.0
|
|
2
2
|
|
|
3
|
+
import { Translator } from '@eo-locale/core';
|
|
4
|
+
import { Draft } from 'immer';
|
|
5
|
+
import { JSX } from 'preact';
|
|
6
|
+
import { Action, Listener, Store as IStore, Unsubscribe } from 'unistore';
|
|
7
|
+
|
|
3
8
|
export declare const preloadPrimer: () => Promise<void>;
|
|
4
|
-
export declare enum CheckoutUXFlow {
|
|
5
|
-
CHECKOUT = "CHECKOUT",
|
|
6
|
-
EXPRESS_CHECKOUT = "EXPRESS_CHECKOUT",
|
|
7
|
-
HEADLESS_CHECKOUT = "HEADLESS_CHECKOUT",
|
|
8
|
-
MANAGE_PAYMENT_METHODS = "MANAGE_PAYMENT_METHODS",
|
|
9
|
-
SINGLE_PAYMENT_METHOD_CHECKOUT = "SINGLE_PAYMENT_METHOD_CHECKOUT"
|
|
10
|
-
}
|
|
11
|
-
export declare enum PaymentFlow {
|
|
12
|
-
DEFAULT = "DEFAULT",
|
|
13
|
-
PREFER_VAULT = "PREFER_VAULT"
|
|
14
|
-
}
|
|
15
|
-
export declare enum ThreeDSecureStatus {
|
|
16
|
-
SUCCESS = "AUTH_SUCCESS",
|
|
17
|
-
FAILED = "AUTH_FAILED",
|
|
18
|
-
SKIPPED = "SKIPPED",
|
|
19
|
-
CHALLENGE = "CHALLENGE"
|
|
20
|
-
}
|
|
21
9
|
export declare enum PaymentInstrumentType {
|
|
22
10
|
WORLDPAY_IDEAL = "WORLDPAY_IDEAL",
|
|
23
11
|
ADYEN_KLARNA = "ADYEN_KLARNA",
|
|
@@ -161,51 +149,335 @@ export declare enum TokenType {
|
|
|
161
149
|
SINGLE_USE = "SINGLE_USE",
|
|
162
150
|
MULTI_USE = "MULTI_USE"
|
|
163
151
|
}
|
|
152
|
+
declare enum PaymentIntent {
|
|
153
|
+
adyenKlarna = "ADYEN_KLARNA",
|
|
154
|
+
applePay = "APPLE_PAY",
|
|
155
|
+
googlePay = "GOOGLE_PAY",
|
|
156
|
+
paypal = "PAYPAL",
|
|
157
|
+
directDebit = "DIRECT_DEBIT",
|
|
158
|
+
paymentCard = "PAYMENT_CARD",
|
|
159
|
+
klarna = "KLARNA",
|
|
160
|
+
mollieGiftCard = "MOLLIE_GIFT_CARD",
|
|
161
|
+
netsPayByCard = "NETS_PAY_BY_CARD",
|
|
162
|
+
payNlKaartdirect = "PAY_NL_KAARTDIRECT"
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* @deprecated The method should be removed in the next PR
|
|
166
|
+
*/
|
|
167
|
+
export interface AnalyticsData extends Record<string, any> {
|
|
168
|
+
sdkEnvironment?: string;
|
|
169
|
+
paymentIntent?: PaymentIntent;
|
|
170
|
+
paymentMethod?: PaymentInstrumentType;
|
|
171
|
+
amount?: number;
|
|
172
|
+
currency?: string;
|
|
173
|
+
sdkVersion?: string;
|
|
174
|
+
isVault?: boolean;
|
|
175
|
+
uxFlow?: string;
|
|
176
|
+
sessionId?: string;
|
|
177
|
+
}
|
|
178
|
+
export interface CrashEventProperties {
|
|
179
|
+
stacktrace: string;
|
|
180
|
+
}
|
|
181
|
+
export type MessageSeverity = "ERROR" | "DEBUG" | "WARN" | "INFO";
|
|
182
|
+
export interface MessageEventProperties {
|
|
183
|
+
messageType: string;
|
|
184
|
+
message: string;
|
|
185
|
+
severity?: MessageSeverity;
|
|
186
|
+
diagnosticId?: string;
|
|
187
|
+
[k: string]: string | number | undefined;
|
|
188
|
+
}
|
|
189
|
+
declare enum NetworkCallType {
|
|
190
|
+
REQUEST_START = "REQUEST_START",
|
|
191
|
+
REQUEST_END = "REQUEST_END"
|
|
192
|
+
}
|
|
193
|
+
export type NetworkEventProperties = {
|
|
194
|
+
id: string;
|
|
195
|
+
url: string;
|
|
196
|
+
method: string;
|
|
197
|
+
errorBody?: string;
|
|
198
|
+
responseCode?: number;
|
|
199
|
+
callType: NetworkCallType;
|
|
200
|
+
};
|
|
201
|
+
declare enum TimerType {
|
|
202
|
+
START = "START",
|
|
203
|
+
END = "END"
|
|
204
|
+
}
|
|
205
|
+
export interface TimerEventProperties {
|
|
206
|
+
id: string;
|
|
207
|
+
timerType: TimerType;
|
|
208
|
+
}
|
|
209
|
+
export interface SdkFunctionEventProperties {
|
|
210
|
+
name: string;
|
|
211
|
+
params?: unknown[];
|
|
212
|
+
module?: string;
|
|
213
|
+
}
|
|
214
|
+
export type V1EventProperties = {
|
|
215
|
+
data?: AnalyticsData;
|
|
216
|
+
event: string;
|
|
217
|
+
};
|
|
218
|
+
export type Analytics = {
|
|
219
|
+
crashEvent(properties: CrashEventProperties): Promise<void>;
|
|
220
|
+
messageEvent(properties: MessageEventProperties): Promise<void>;
|
|
221
|
+
networkCallEvent(properties: NetworkEventProperties): Promise<void>;
|
|
222
|
+
sdkFunctionEvent(properties: SdkFunctionEventProperties): Promise<void>;
|
|
223
|
+
timerEvent(properties: TimerEventProperties): Promise<void>;
|
|
224
|
+
v1Event(properties: V1EventProperties): Promise<void>;
|
|
225
|
+
};
|
|
164
226
|
export type Nullable<T> = T | null;
|
|
165
|
-
export
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
227
|
+
export interface IFrameMessagePayloadMeta {
|
|
228
|
+
source: string;
|
|
229
|
+
destination: string | null;
|
|
230
|
+
name?: string;
|
|
231
|
+
id?: string;
|
|
232
|
+
replyTo?: string;
|
|
233
|
+
[x: string]: unknown;
|
|
234
|
+
}
|
|
235
|
+
export interface IFrameInputMessagePayload<T = unknown> {
|
|
236
|
+
type: string;
|
|
237
|
+
meta?: Partial<IFrameMessagePayloadMeta>;
|
|
238
|
+
payload?: T;
|
|
239
|
+
}
|
|
240
|
+
export interface IFrameMessagePayload<T = unknown> {
|
|
241
|
+
type: string;
|
|
242
|
+
meta: IFrameMessagePayloadMeta;
|
|
243
|
+
payload: T;
|
|
244
|
+
}
|
|
245
|
+
export interface Observer {
|
|
246
|
+
(event: IFrameMessagePayload): void;
|
|
247
|
+
}
|
|
248
|
+
declare class Observable {
|
|
249
|
+
private observers;
|
|
250
|
+
constructor();
|
|
251
|
+
onEvent(event: IFrameMessagePayload): void;
|
|
252
|
+
on(type: string, observer: Observer): void;
|
|
253
|
+
once(type: string, observer: Observer): void;
|
|
254
|
+
notify(event: IFrameMessagePayload): void;
|
|
255
|
+
}
|
|
256
|
+
declare class IFrameMessageBus extends Observable {
|
|
257
|
+
private frames;
|
|
258
|
+
constructor();
|
|
259
|
+
onEvent(event: IFrameMessagePayload): void;
|
|
260
|
+
add(iframe: HTMLIFrameElement): void;
|
|
261
|
+
publish(name: string, event: IFrameInputMessagePayload): void;
|
|
262
|
+
rpc(name: string, evt: IFrameInputMessagePayload): Promise<IFrameMessagePayload>;
|
|
263
|
+
}
|
|
264
|
+
export type IFramePlacement = "append" | "prepend";
|
|
265
|
+
export interface IFrameFactoryOptions {
|
|
266
|
+
messageBus: IFrameMessageBus;
|
|
267
|
+
assetsUrl: string;
|
|
268
|
+
}
|
|
269
|
+
export interface CreateIFrameOptions {
|
|
270
|
+
filename: string;
|
|
271
|
+
container: string | Element;
|
|
272
|
+
placement?: IFramePlacement;
|
|
273
|
+
payload?: unknown;
|
|
274
|
+
meta: {
|
|
275
|
+
name: string;
|
|
276
|
+
id?: string;
|
|
277
|
+
ariaLabel?: string;
|
|
278
|
+
placeholder?: string;
|
|
279
|
+
css?: string;
|
|
280
|
+
stylesheets?: string[];
|
|
281
|
+
allowedCardNetworks?: CardNetwork[];
|
|
282
|
+
};
|
|
283
|
+
style?: Record<string, string>;
|
|
284
|
+
onReady?: () => void;
|
|
285
|
+
}
|
|
286
|
+
declare class IFrameFactory {
|
|
287
|
+
private id;
|
|
288
|
+
private messageBus;
|
|
289
|
+
private assetsUrl;
|
|
290
|
+
constructor({ messageBus, assetsUrl }: IFrameFactoryOptions);
|
|
291
|
+
create({ filename, container, meta, payload, placement, style, onReady, }: CreateIFrameOptions): HTMLIFrameElement | null;
|
|
292
|
+
}
|
|
293
|
+
declare enum HttpMethod {
|
|
294
|
+
GET = "get",
|
|
295
|
+
POST = "post",
|
|
296
|
+
DELETE = "delete",
|
|
297
|
+
PATCH = "PATCH"
|
|
298
|
+
}
|
|
299
|
+
export interface ApiConfig {
|
|
300
|
+
accessToken: string;
|
|
301
|
+
analytics: Analytics;
|
|
302
|
+
coreUrl: string;
|
|
303
|
+
iframes: IFrameFactory;
|
|
304
|
+
pciUrl: string;
|
|
305
|
+
checkoutSessionId: string;
|
|
306
|
+
}
|
|
307
|
+
export interface RequestOptions {
|
|
308
|
+
maxAttempts?: number;
|
|
309
|
+
apiVersion?: string;
|
|
310
|
+
isAnalytics?: boolean;
|
|
311
|
+
}
|
|
312
|
+
export interface APIRequestOptions {
|
|
313
|
+
method: HttpMethod;
|
|
314
|
+
url: string;
|
|
315
|
+
body?: unknown;
|
|
316
|
+
options?: RequestOptions;
|
|
317
|
+
}
|
|
318
|
+
export interface ValidationError {
|
|
319
|
+
description: string;
|
|
320
|
+
path: string;
|
|
187
321
|
}
|
|
188
|
-
export interface
|
|
322
|
+
export interface ValidationErrorDetail {
|
|
323
|
+
model: string;
|
|
324
|
+
errors: ValidationError[];
|
|
325
|
+
}
|
|
326
|
+
export interface APIErrorShape {
|
|
189
327
|
message: string;
|
|
328
|
+
validationErrors: ValidationErrorDetail[];
|
|
190
329
|
diagnosticsId?: string;
|
|
191
330
|
errorId?: string;
|
|
192
|
-
data?: any;
|
|
193
|
-
isFromDeveloper?: boolean;
|
|
194
331
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
332
|
+
export interface APIResponse<T = unknown> {
|
|
333
|
+
error: Nullable<APIErrorShape>;
|
|
334
|
+
data: Nullable<T>;
|
|
335
|
+
status: Nullable<number>;
|
|
336
|
+
}
|
|
337
|
+
declare class Api {
|
|
338
|
+
private messageBus;
|
|
339
|
+
isReady: Promise<void>;
|
|
340
|
+
private checkoutSessionId;
|
|
341
|
+
constructor(messageBus: IFrameMessageBus, { accessToken, coreUrl, iframes, pciUrl, checkoutSessionId }: ApiConfig);
|
|
342
|
+
setAccessToken(accessToken: string): void;
|
|
343
|
+
request<T>(payload: APIRequestOptions): Promise<APIResponse<T>>;
|
|
344
|
+
post<T = unknown, U = unknown>(url: string, body: T, options?: RequestOptions): Promise<APIResponse<U>>;
|
|
345
|
+
get<T>(url: string, options?: RequestOptions): Promise<APIResponse<T>>;
|
|
346
|
+
delete<T>(url: string, options?: RequestOptions): Promise<APIResponse<T>>;
|
|
347
|
+
patch<T = unknown, U = unknown>(url: string, body: T, options?: RequestOptions): Promise<APIResponse<U>>;
|
|
348
|
+
}
|
|
349
|
+
export interface IVaultedPaymentMethod<T, U extends PaymentInstrumentType> {
|
|
350
|
+
id: string;
|
|
351
|
+
analyticsId: string;
|
|
352
|
+
paymentInstrumentData: T;
|
|
353
|
+
paymentInstrumentType: U;
|
|
354
|
+
threeDSecureAuthentication: ThreeDSAuthenticationData | null;
|
|
355
|
+
vaultData: VaultData | null;
|
|
356
|
+
userDescription?: string;
|
|
203
357
|
}
|
|
204
|
-
export
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
358
|
+
export type VaultedPaymentMethod = IVaultedPaymentMethod<any, any>;
|
|
359
|
+
export interface VaultServices {
|
|
360
|
+
api: Api;
|
|
361
|
+
analytics: Analytics;
|
|
362
|
+
}
|
|
363
|
+
declare class Vault {
|
|
364
|
+
private api;
|
|
365
|
+
private analytics;
|
|
366
|
+
constructor(services: VaultServices);
|
|
367
|
+
fetch(): Promise<VaultedPaymentMethod[]>;
|
|
368
|
+
delete(id: string | null): Promise<void>;
|
|
369
|
+
}
|
|
370
|
+
export type InternalFlowOptions = (UniversalCheckoutOptions | VaultManagerOptions | SinglePaymentMethodCheckoutOptions) & HeadlessUniversalCheckoutOptions & {
|
|
371
|
+
uxFlow?: string;
|
|
372
|
+
};
|
|
373
|
+
export interface ErrorMonitoring {
|
|
374
|
+
captureException(error: Error): any;
|
|
375
|
+
}
|
|
376
|
+
declare class ScriptLoader {
|
|
377
|
+
private scripts;
|
|
378
|
+
private timeoutMilliseconds;
|
|
379
|
+
constructor();
|
|
380
|
+
load(src: string, options?: {
|
|
381
|
+
/** https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin */
|
|
382
|
+
crossOrigin?: "" | "use-credentials";
|
|
383
|
+
customAttributes?: Record<string, string>;
|
|
384
|
+
}): Promise<boolean>;
|
|
385
|
+
}
|
|
386
|
+
export interface PackageDeclaration {
|
|
387
|
+
type: string;
|
|
388
|
+
version: string;
|
|
389
|
+
name: string;
|
|
390
|
+
entryPoints: Record<string, string>;
|
|
391
|
+
getScenePath?: (sceneId: string) => string | null;
|
|
392
|
+
PaymentMethod?: new (...args: unknown[]) => void;
|
|
393
|
+
}
|
|
394
|
+
export interface BaseModule {
|
|
395
|
+
default: unknown;
|
|
396
|
+
}
|
|
397
|
+
declare enum ModuleStatus {
|
|
398
|
+
UNINITIALIZED = 0,
|
|
399
|
+
LOADING = 1,
|
|
400
|
+
READY = 2,
|
|
401
|
+
ERROR = 3
|
|
402
|
+
}
|
|
403
|
+
export interface ModuleKey {
|
|
404
|
+
entryPoint: string;
|
|
405
|
+
scope: string;
|
|
406
|
+
path: string;
|
|
407
|
+
}
|
|
408
|
+
export interface ModuleKeyDescriptor {
|
|
409
|
+
remotePath: string;
|
|
410
|
+
entryFile?: string;
|
|
411
|
+
scope: string;
|
|
412
|
+
path: string;
|
|
413
|
+
}
|
|
414
|
+
export interface PackageKey {
|
|
415
|
+
remotePath: string;
|
|
416
|
+
entryFile?: string;
|
|
417
|
+
scope: string;
|
|
418
|
+
}
|
|
419
|
+
export interface ModuleLoadCallback {
|
|
420
|
+
(moduleDescriptor: ModuleDescriptor): void;
|
|
421
|
+
}
|
|
422
|
+
export interface ModuleDescriptor {
|
|
423
|
+
key: ModuleKey;
|
|
424
|
+
status: ModuleStatus;
|
|
425
|
+
callbacks: Array<ModuleLoadCallback>;
|
|
426
|
+
module: BaseModule | null;
|
|
427
|
+
}
|
|
428
|
+
export interface IModuleLoader {
|
|
429
|
+
loadModule(key: ModuleKey): Promise<ModuleDescriptor>;
|
|
430
|
+
}
|
|
431
|
+
export interface IModule {
|
|
432
|
+
import(exportName?: string): Promise<unknown>;
|
|
433
|
+
}
|
|
434
|
+
export interface IPackage {
|
|
435
|
+
key: PackageKey;
|
|
436
|
+
getDeclaration(): Promise<PackageDeclaration>;
|
|
437
|
+
getModule(string: any): IModule;
|
|
438
|
+
}
|
|
439
|
+
export interface IModuleFactory {
|
|
440
|
+
getPackage(packageKey: PackageKey): IPackage;
|
|
441
|
+
getModule(keyDescriptor: ModuleKeyDescriptor): IModule;
|
|
442
|
+
}
|
|
443
|
+
export interface ModuleOptions {
|
|
444
|
+
key: ModuleKey;
|
|
445
|
+
moduleLoader: IModuleLoader;
|
|
446
|
+
}
|
|
447
|
+
declare class Module implements IModule {
|
|
448
|
+
readonly key: ModuleKey;
|
|
449
|
+
readonly status: ModuleStatus;
|
|
450
|
+
private moduleLoader;
|
|
451
|
+
constructor({ key, moduleLoader }: ModuleOptions);
|
|
452
|
+
import(exportName?: string): Promise<unknown>;
|
|
453
|
+
}
|
|
454
|
+
export type Props = {
|
|
455
|
+
moduleFactory: IModuleFactory;
|
|
456
|
+
key: PackageKey;
|
|
457
|
+
};
|
|
458
|
+
declare class Package implements IPackage {
|
|
459
|
+
readonly key: PackageKey;
|
|
460
|
+
private moduleFactory;
|
|
461
|
+
private declarationModule;
|
|
462
|
+
private declarationPromise;
|
|
463
|
+
constructor({ moduleFactory, key }: Props);
|
|
464
|
+
getDeclaration(): Promise<PackageDeclaration>;
|
|
465
|
+
getModule(path: string): IModule;
|
|
466
|
+
}
|
|
467
|
+
declare class ModuleFactory implements IModuleFactory {
|
|
468
|
+
private moduleLoader;
|
|
469
|
+
private modules;
|
|
470
|
+
private packages;
|
|
471
|
+
constructor(scriptLoader: ScriptLoader);
|
|
472
|
+
getPackages(): Package[];
|
|
473
|
+
getModule(keyDescriptor: ModuleKeyDescriptor): Module;
|
|
474
|
+
getPackage(key: PackageKey): any;
|
|
475
|
+
private findModule;
|
|
476
|
+
private findPackage;
|
|
477
|
+
}
|
|
478
|
+
declare enum ImplementationType {
|
|
479
|
+
WEB_REDIRECT = "WEB_REDIRECT",
|
|
480
|
+
NATIVE_SDK = "NATIVE_SDK"
|
|
209
481
|
}
|
|
210
482
|
declare enum ProductType {
|
|
211
483
|
DIGITAL = "DIGITAL",
|
|
@@ -221,6 +493,16 @@ export interface ClientSessionLineItem {
|
|
|
221
493
|
taxAmount?: number;
|
|
222
494
|
taxCode?: string;
|
|
223
495
|
}
|
|
496
|
+
export interface ClientSessionOrder {
|
|
497
|
+
countryCode?: string;
|
|
498
|
+
currencyCode?: string;
|
|
499
|
+
fees?: ClientSessionFeeItem[];
|
|
500
|
+
lineItems?: ClientSessionLineItem[];
|
|
501
|
+
merchantAmount?: number;
|
|
502
|
+
orderId?: string;
|
|
503
|
+
shipping?: ClientSessionShipping;
|
|
504
|
+
totalOrderAmount: number;
|
|
505
|
+
}
|
|
224
506
|
export interface ClientSessionShipping {
|
|
225
507
|
amount: number;
|
|
226
508
|
methodId?: string;
|
|
@@ -232,6 +514,16 @@ export interface ClientSessionFeeItem {
|
|
|
232
514
|
description?: string;
|
|
233
515
|
amount: number;
|
|
234
516
|
}
|
|
517
|
+
export interface ClientSessionCustomer {
|
|
518
|
+
customerId?: string;
|
|
519
|
+
emailAddress?: string;
|
|
520
|
+
mobileNumber?: string;
|
|
521
|
+
firstName?: string;
|
|
522
|
+
lastName?: string;
|
|
523
|
+
billingAddress?: ClientSessionAddress;
|
|
524
|
+
shippingAddress?: ClientSessionAddress;
|
|
525
|
+
taxId?: string;
|
|
526
|
+
}
|
|
235
527
|
export interface ClientSessionAddress {
|
|
236
528
|
firstName?: string;
|
|
237
529
|
lastName?: string;
|
|
@@ -242,6 +534,19 @@ export interface ClientSessionAddress {
|
|
|
242
534
|
countryCode?: string;
|
|
243
535
|
postalCode?: string;
|
|
244
536
|
}
|
|
537
|
+
export interface ClientSessionPaymentMethodOptions {
|
|
538
|
+
options?: PaymentMethodOption[];
|
|
539
|
+
vaultOnSuccess: boolean;
|
|
540
|
+
}
|
|
541
|
+
export interface PaymentMethodOption {
|
|
542
|
+
type: string;
|
|
543
|
+
surcharge?: number;
|
|
544
|
+
networks?: CardNetworkOption[];
|
|
545
|
+
}
|
|
546
|
+
export interface CardNetworkOption {
|
|
547
|
+
type: string;
|
|
548
|
+
surcharge?: number;
|
|
549
|
+
}
|
|
245
550
|
export interface ClientSession {
|
|
246
551
|
orderId?: string;
|
|
247
552
|
currencyCode?: string;
|
|
@@ -268,70 +573,218 @@ export interface ClientSession {
|
|
|
268
573
|
options?: Record<string, any>;
|
|
269
574
|
};
|
|
270
575
|
}
|
|
271
|
-
export
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
576
|
+
export interface InternalClientSession {
|
|
577
|
+
clientSessionId: string;
|
|
578
|
+
customer: ClientSessionCustomer | null;
|
|
579
|
+
paymentMethod: ClientSessionPaymentMethodOptions;
|
|
580
|
+
order: ClientSessionOrder;
|
|
581
|
+
}
|
|
582
|
+
export interface PaymentMethodDisplayMetadata {
|
|
583
|
+
button: {
|
|
584
|
+
backgroundColor: BackgroundColor;
|
|
585
|
+
borderColor: BorderColor;
|
|
586
|
+
borderWidth: BorderWidth;
|
|
587
|
+
cornerRadius: number;
|
|
588
|
+
iconPositionRelativeToText?: "START" | "END";
|
|
589
|
+
iconUrl: IconUrl;
|
|
590
|
+
text?: string;
|
|
591
|
+
textColor?: TextColor;
|
|
592
|
+
};
|
|
593
|
+
overlay: {
|
|
594
|
+
logo: IconUrl;
|
|
595
|
+
backgroundColor: BackgroundColor;
|
|
596
|
+
};
|
|
597
|
+
popup: {
|
|
598
|
+
width: number;
|
|
599
|
+
height: number;
|
|
600
|
+
};
|
|
601
|
+
}
|
|
278
602
|
export interface BackgroundColor {
|
|
279
603
|
colored: string;
|
|
280
604
|
dark: string;
|
|
281
605
|
light: string;
|
|
282
606
|
}
|
|
607
|
+
export interface BorderColor {
|
|
608
|
+
dark: string;
|
|
609
|
+
light: string;
|
|
610
|
+
}
|
|
611
|
+
export interface BorderWidth {
|
|
612
|
+
colored: number;
|
|
613
|
+
dark: number;
|
|
614
|
+
light: number;
|
|
615
|
+
}
|
|
283
616
|
export interface IconUrl {
|
|
284
617
|
colored: string;
|
|
285
618
|
dark: string;
|
|
286
619
|
light: string;
|
|
287
620
|
}
|
|
288
|
-
export interface
|
|
289
|
-
|
|
621
|
+
export interface TextColor {
|
|
622
|
+
dark: string;
|
|
623
|
+
light: string;
|
|
290
624
|
}
|
|
291
|
-
export interface
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
625
|
+
export interface PaymentMethodConfig {
|
|
626
|
+
id: string;
|
|
627
|
+
type: PaymentMethodType;
|
|
628
|
+
name: string;
|
|
629
|
+
implementationType: ImplementationType;
|
|
630
|
+
displayMetadata: PaymentMethodDisplayMetadata;
|
|
631
|
+
options: {
|
|
632
|
+
threeDSecureToken?: string;
|
|
633
|
+
threeDSecureInitUrl?: string;
|
|
634
|
+
threeDSecureProvider?: string;
|
|
635
|
+
threeDSecureEnabled?: boolean;
|
|
636
|
+
} | any;
|
|
637
|
+
}
|
|
638
|
+
export interface CheckoutModuleConfig extends Record<string, any> {
|
|
639
|
+
type: string;
|
|
640
|
+
options?: Record<string, any>;
|
|
641
|
+
}
|
|
642
|
+
export interface ClientSessionInfo {
|
|
643
|
+
modulesUrl: string;
|
|
644
|
+
paymentFlow: PaymentFlow;
|
|
645
|
+
paymentMethods: PaymentMethodConfig[];
|
|
646
|
+
checkoutModules: CheckoutModuleConfig[];
|
|
647
|
+
threeDSecureToken: string | null;
|
|
648
|
+
threeDSecureInitUrl: string | null;
|
|
649
|
+
threeDSecureProvider: string | null;
|
|
650
|
+
threeDSecureEnabled: boolean;
|
|
651
|
+
clientSession: InternalClientSession;
|
|
652
|
+
env: string;
|
|
653
|
+
production: boolean;
|
|
654
|
+
isTeardown: boolean;
|
|
655
|
+
}
|
|
656
|
+
export interface ClientConfiguration {
|
|
657
|
+
checkoutModules: CheckoutModuleConfig[];
|
|
658
|
+
clientSession: InternalClientSession;
|
|
659
|
+
coreUrl: string;
|
|
660
|
+
env: string;
|
|
661
|
+
paymentMethods: PaymentMethodConfig[];
|
|
662
|
+
pciUrl: string;
|
|
663
|
+
primerAccountId: string;
|
|
664
|
+
}
|
|
665
|
+
declare enum ClientTokenIntent {
|
|
666
|
+
CHECKOUT = "CHECKOUT",
|
|
667
|
+
THREEDS_AUTHENTICATION = "3DS_AUTHENTICATION",
|
|
668
|
+
PROCESSOR_3DS = "PROCESSOR_3DS",
|
|
669
|
+
REDIRECTION_END = "REDIRECTION_END"
|
|
670
|
+
}
|
|
671
|
+
export type CommonClientToken = {
|
|
672
|
+
configurationUrl: string;
|
|
673
|
+
analyticsUrl?: string;
|
|
674
|
+
analyticsUrlV2: string;
|
|
675
|
+
accessToken: string;
|
|
676
|
+
paymentFlow: PaymentFlow;
|
|
677
|
+
exp: number;
|
|
678
|
+
};
|
|
679
|
+
export type IntentClientToken = {
|
|
680
|
+
intent: ClientTokenIntent.CHECKOUT | undefined;
|
|
681
|
+
} | {
|
|
682
|
+
intent: ClientTokenIntent.THREEDS_AUTHENTICATION;
|
|
683
|
+
tokenId: string;
|
|
684
|
+
threeDSProvider: string;
|
|
685
|
+
threeDSToken: string;
|
|
686
|
+
threeDSInitUrl: string;
|
|
687
|
+
} | {
|
|
688
|
+
intent: ClientTokenIntent.REDIRECTION_END;
|
|
689
|
+
paymentId: string;
|
|
690
|
+
resumeToken: string;
|
|
691
|
+
} | ({
|
|
692
|
+
intent: string;
|
|
693
|
+
} & Record<string, unknown>);
|
|
694
|
+
export type DecodedClientToken = CommonClientToken & IntentClientToken;
|
|
695
|
+
export type NewClientTokenListener = (decodedClientToken: DecodedClientToken) => void;
|
|
696
|
+
export interface IClientTokenHandler {
|
|
697
|
+
processClientToken(clientToken: string): DecodedClientToken;
|
|
698
|
+
getOriginalClientToken(): string | undefined;
|
|
699
|
+
getCurrentClientToken(): string | undefined;
|
|
700
|
+
getCurrentDecodedClientToken(): DecodedClientToken | undefined;
|
|
701
|
+
addNewClientTokenListener(listener: NewClientTokenListener): any;
|
|
702
|
+
removeNewClientTokenListener(listener: NewClientTokenListener): any;
|
|
703
|
+
}
|
|
704
|
+
declare class ClientConfigurationHandler {
|
|
705
|
+
private config;
|
|
706
|
+
private checkoutSessionId;
|
|
707
|
+
constructor(config: ClientConfiguration, checkoutSessionId: string);
|
|
708
|
+
fetchClientConfiguration({ accessToken, configurationUrl, }: Pick<DecodedClientToken, "accessToken" | "configurationUrl">): Promise<ClientConfiguration>;
|
|
709
|
+
getCurrentClientConfiguration(): ClientConfiguration;
|
|
710
|
+
}
|
|
711
|
+
export interface LongPollServices {
|
|
712
|
+
api: Api;
|
|
713
|
+
}
|
|
714
|
+
export interface LongPollOptions<T> {
|
|
715
|
+
url: string;
|
|
716
|
+
timeout: number;
|
|
717
|
+
pollInterval: number;
|
|
718
|
+
predicate(response: T): boolean;
|
|
719
|
+
}
|
|
720
|
+
declare class LongPoll {
|
|
721
|
+
private api;
|
|
722
|
+
private isStarted;
|
|
723
|
+
constructor(services: LongPollServices);
|
|
724
|
+
start<T>(options: LongPollOptions<T>): Promise<T | null>;
|
|
725
|
+
stop(): void;
|
|
726
|
+
private request;
|
|
727
|
+
private tick;
|
|
728
|
+
}
|
|
729
|
+
export interface NodeLike {
|
|
730
|
+
id: string;
|
|
295
731
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
mandate: Label;
|
|
732
|
+
declare enum SceneStage {
|
|
733
|
+
Init = "init",
|
|
734
|
+
Mounting = "mounting",
|
|
735
|
+
Entering = "entering",
|
|
736
|
+
Entered = "entered",
|
|
737
|
+
Exiting = "exiting",
|
|
738
|
+
Exited = "exited"
|
|
739
|
+
}
|
|
740
|
+
export type SceneState = {
|
|
741
|
+
stage: SceneStage;
|
|
742
|
+
promise: {
|
|
743
|
+
resolve: () => void;
|
|
744
|
+
reject: () => void;
|
|
310
745
|
};
|
|
746
|
+
};
|
|
747
|
+
export interface IBaseState extends Record<string, any> {
|
|
748
|
+
}
|
|
749
|
+
export interface IBaseStore {
|
|
750
|
+
getState(): IBaseState;
|
|
751
|
+
subscribe(listener: any): any;
|
|
752
|
+
}
|
|
753
|
+
declare class BaseStore<K extends IBaseState> implements IBaseStore {
|
|
754
|
+
readonly stateType: K;
|
|
755
|
+
readonly state: IStore<K>;
|
|
756
|
+
readonly subStores: Record<string, IBaseStore>;
|
|
757
|
+
private eventHandlers;
|
|
758
|
+
constructor(defaultState: K);
|
|
759
|
+
setState<U extends keyof K>(update: Pick<K, U>, overwrite?: boolean, action?: Action<K>): void;
|
|
760
|
+
produceState(recipe: (draft: Draft<K>) => Pick<K, never> | void): void;
|
|
761
|
+
subscribe(f: Listener<K>): Unsubscribe;
|
|
762
|
+
unsubscribe(f: Listener<K>): void;
|
|
763
|
+
getState(): K;
|
|
764
|
+
registerStore<U extends IBaseStore>(id: string, store: U): void;
|
|
765
|
+
getStore<U extends IBaseStore>(id: string): U | undefined;
|
|
766
|
+
protected registerEventHandler<T extends IBaseStore>(eventId: string, eventHandler: (store: T) => any): void;
|
|
767
|
+
protected registerEventHandlers<T extends IBaseStore>(eventHandlers: Record<string, (store: T) => any>): void;
|
|
768
|
+
on(eventName: string, listener: () => void): void;
|
|
769
|
+
off(eventName: string, listener: () => void): void;
|
|
770
|
+
}
|
|
771
|
+
declare enum SceneEnum {
|
|
772
|
+
LOADING = "Loading",
|
|
773
|
+
THREE_DS = "UniversalCheckout/3ds",
|
|
774
|
+
CHOOSE_PAYMENT_METHOD = "UniversalCheckout/Home",
|
|
775
|
+
MANAGE_PAYMENT_METHODS = "VaultManager/Home",
|
|
776
|
+
DIRECT_DEBIT_FORM = "DirectDebit/Form",
|
|
777
|
+
DIRECT_DEBIT_MANDATE = "DirectDebit/Mandate",
|
|
778
|
+
CREDIT_CARD_FORM = "CreditCard/Form",
|
|
779
|
+
SUCCESS_PAYMENT_METHOD = "UniversalCheckout/Success/PaymentMethod",
|
|
780
|
+
SUCCESS_CHECK = "UniversalCheckout/Success/Check"
|
|
311
781
|
}
|
|
312
|
-
export
|
|
313
|
-
|
|
314
|
-
"
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
export type GooglePayButtonSizeMode = "fill" | "static";
|
|
319
|
-
export interface GooglePayOptions extends PositionalConfig {
|
|
320
|
-
buttonType?: GooglePayButtonType;
|
|
321
|
-
buttonColor?: GooglePayButtonColor;
|
|
322
|
-
buttonSizeMode?: GooglePayButtonSizeMode;
|
|
323
|
-
onClick?: () => void;
|
|
324
|
-
captureBillingAddress?: boolean;
|
|
325
|
-
}
|
|
326
|
-
export interface PayPalOptions extends PositionalConfig {
|
|
327
|
-
buttonColor?: "gold" | "blue" | "silver" | "white" | "black";
|
|
328
|
-
buttonShape?: "pill" | "rect";
|
|
329
|
-
buttonSize?: "small" | "medium" | "large" | "responsive";
|
|
330
|
-
buttonHeight?: number;
|
|
331
|
-
buttonLabel?: "checkout" | "credit" | "pay" | "buynow" | "paypal" | "installment";
|
|
332
|
-
buttonTagline?: boolean;
|
|
333
|
-
paymentFlow?: PaymentFlow;
|
|
334
|
-
onClick?: () => void;
|
|
782
|
+
export declare enum CheckoutUXFlow {
|
|
783
|
+
CHECKOUT = "CHECKOUT",
|
|
784
|
+
EXPRESS_CHECKOUT = "EXPRESS_CHECKOUT",
|
|
785
|
+
HEADLESS_CHECKOUT = "HEADLESS_CHECKOUT",
|
|
786
|
+
MANAGE_PAYMENT_METHODS = "MANAGE_PAYMENT_METHODS",
|
|
787
|
+
SINGLE_PAYMENT_METHOD_CHECKOUT = "SINGLE_PAYMENT_METHOD_CHECKOUT"
|
|
335
788
|
}
|
|
336
789
|
export interface BorderStyle {
|
|
337
790
|
borderStyle?: string;
|
|
@@ -458,6 +911,27 @@ export interface VaultMenuStyle {
|
|
|
458
911
|
confirmButton?: BlockStyle & TextStyle;
|
|
459
912
|
};
|
|
460
913
|
}
|
|
914
|
+
export interface SceneTransition {
|
|
915
|
+
opacity?: string | number;
|
|
916
|
+
transform?: string;
|
|
917
|
+
transition?: string;
|
|
918
|
+
}
|
|
919
|
+
export interface SceneTransitionEventStyle {
|
|
920
|
+
enter?: SceneTransition;
|
|
921
|
+
entering?: SceneTransition;
|
|
922
|
+
exit?: SceneTransition;
|
|
923
|
+
exiting?: SceneTransition;
|
|
924
|
+
}
|
|
925
|
+
export interface SceneTransitionStyle extends SceneTransitionEventStyle {
|
|
926
|
+
content: {
|
|
927
|
+
transition?: string;
|
|
928
|
+
};
|
|
929
|
+
push?: SceneTransitionEventStyle;
|
|
930
|
+
pop?: SceneTransitionEventStyle;
|
|
931
|
+
}
|
|
932
|
+
export interface InternalStyle {
|
|
933
|
+
scene?: SceneTransitionStyle;
|
|
934
|
+
}
|
|
461
935
|
export interface NetworkErrorStyles {
|
|
462
936
|
button?: {
|
|
463
937
|
base: BlockStyle & TextStyle;
|
|
@@ -492,6 +966,414 @@ export interface CheckoutStyle {
|
|
|
492
966
|
processingIndicator?: ProcessingIndicatorStyle;
|
|
493
967
|
focusCheckoutOnInit?: boolean;
|
|
494
968
|
}
|
|
969
|
+
export interface IStyleManagerOptions {
|
|
970
|
+
isRtlLocale?: boolean;
|
|
971
|
+
}
|
|
972
|
+
export interface IStyleManager {
|
|
973
|
+
setStyle(style?: CheckoutStyle, internalStyle?: InternalStyle, options?: IStyleManagerOptions): void;
|
|
974
|
+
getStyle(): CheckoutStyle | undefined;
|
|
975
|
+
getHostedFieldStyle(): string | null;
|
|
976
|
+
getApmButtonStyle(): PaymentMethodButtonStyle | null;
|
|
977
|
+
}
|
|
978
|
+
export type PaymentMethodSpecs = {
|
|
979
|
+
key: string;
|
|
980
|
+
buttonManagedByPaymentMethod: boolean;
|
|
981
|
+
canVault: boolean;
|
|
982
|
+
hasExportedButtonOptions: boolean;
|
|
983
|
+
homeScene?: string;
|
|
984
|
+
implementationType?: ImplementationType;
|
|
985
|
+
};
|
|
986
|
+
declare class BasePaymentMethod {
|
|
987
|
+
static specs: PaymentMethodSpecs;
|
|
988
|
+
readonly type: PaymentMethodType;
|
|
989
|
+
displayName: string;
|
|
990
|
+
container: Element | null;
|
|
991
|
+
remoteConfig: any;
|
|
992
|
+
protected options: Record<string, any> | undefined;
|
|
993
|
+
protected constructor(type: PaymentMethodType, name: string);
|
|
994
|
+
static create: (_context: any, _options: Record<string, any>, _remoteConfig: any, _styleManager?: IStyleManager) => BasePaymentMethod;
|
|
995
|
+
get specs(): PaymentMethodSpecs;
|
|
996
|
+
setOption(key: any, value: any): void;
|
|
997
|
+
setupAndValidate(): Promise<boolean>;
|
|
998
|
+
mount(): Promise<boolean>;
|
|
999
|
+
tokenize(options?: any): Promise<void>;
|
|
1000
|
+
validate(): Promise<Validation>;
|
|
1001
|
+
setDisabled(disabled: boolean): Promise<void>;
|
|
1002
|
+
focus(): void;
|
|
1003
|
+
blur(): void;
|
|
1004
|
+
getPaymentElement(): Element | null;
|
|
1005
|
+
getStore(): IBaseStore | undefined;
|
|
1006
|
+
}
|
|
1007
|
+
export interface ITranslation {
|
|
1008
|
+
_(key: string, options?: {
|
|
1009
|
+
defaultMessage: string;
|
|
1010
|
+
} & Record<string, unknown>): any;
|
|
1011
|
+
}
|
|
1012
|
+
declare class Translation implements ITranslation {
|
|
1013
|
+
private translator;
|
|
1014
|
+
private defaultTranslation?;
|
|
1015
|
+
constructor(translator?: Translator, defaultTranslation?: TranslationUnit);
|
|
1016
|
+
_(key: string, options?: {
|
|
1017
|
+
defaultMessage?: string;
|
|
1018
|
+
} & Record<string, unknown>): string;
|
|
1019
|
+
}
|
|
1020
|
+
export type TranslationUnit = Translation & Record<string, any>;
|
|
1021
|
+
export interface IClientSessionStore {
|
|
1022
|
+
setClientSession(clientSession: InternalClientSession): any;
|
|
1023
|
+
getClientSession(): InternalClientSession | null;
|
|
1024
|
+
}
|
|
1025
|
+
export type OptionStoreListenerEventName = "options.purchaseInfo" | "options.customerDetails" | "options.businessDetails" | "options.orderDetails";
|
|
1026
|
+
export type OrderDetailsWithInitiator = {
|
|
1027
|
+
orderDetails: ClientSessionOrder | null;
|
|
1028
|
+
orderDetailsInitiator: string | null;
|
|
1029
|
+
};
|
|
1030
|
+
export interface IOptionStoreSetter {
|
|
1031
|
+
setPurchaseInfo(purchaseInfo: PurchaseInformation | VaultInformation | null): any;
|
|
1032
|
+
setCustomerDetails(customerDetails: ClientSessionCustomer | null, initiator: string | null): any;
|
|
1033
|
+
setBusinessDetails(businessDetails: BusinessDetails | null, initiator: string | null): any;
|
|
1034
|
+
setOrderDetails(orderDetails: ClientSessionOrder | null, initiator: string | null): any;
|
|
1035
|
+
}
|
|
1036
|
+
export interface IOptionStoreListener {
|
|
1037
|
+
getPurchaseInfo(): PurchaseInformation | VaultInformation | null;
|
|
1038
|
+
getCustomerDetails(): ClientSessionCustomer | null;
|
|
1039
|
+
getBusinessDetails(): BusinessDetails | null;
|
|
1040
|
+
getOrderDetails(): OrderDetailsWithInitiator;
|
|
1041
|
+
on(eventName: OptionStoreListenerEventName, listener: () => void): any;
|
|
1042
|
+
off(eventName: OptionStoreListenerEventName, listener: () => void): any;
|
|
1043
|
+
}
|
|
1044
|
+
export interface ICheckoutState extends IBaseState {
|
|
1045
|
+
isLoading: boolean;
|
|
1046
|
+
isProcessing: boolean;
|
|
1047
|
+
locale: SupportedLocale;
|
|
1048
|
+
tokens: VaultedPaymentMethod[];
|
|
1049
|
+
translation: TranslationUnit;
|
|
1050
|
+
currentToken: PaymentMethodToken | null;
|
|
1051
|
+
scene: {
|
|
1052
|
+
onEntering?: (sceneId: string) => void;
|
|
1053
|
+
transition: SceneTransitionOptions | false;
|
|
1054
|
+
};
|
|
1055
|
+
apms: {
|
|
1056
|
+
selected: string | null;
|
|
1057
|
+
items: NodeLike[];
|
|
1058
|
+
};
|
|
1059
|
+
vault: {
|
|
1060
|
+
selected: string | null;
|
|
1061
|
+
items: VaultListItem[];
|
|
1062
|
+
};
|
|
1063
|
+
options: {
|
|
1064
|
+
purchaseInfo: PurchaseInformation | VaultInformation | null;
|
|
1065
|
+
customerDetails: CustomerDetails | null;
|
|
1066
|
+
businessDetails: BusinessDetails | null;
|
|
1067
|
+
orderDetails: ClientSessionOrder | null;
|
|
1068
|
+
orderDetailsInitiator: string | null;
|
|
1069
|
+
showSavePaymentMethod: boolean;
|
|
1070
|
+
};
|
|
1071
|
+
isTokenizationEnabled: boolean;
|
|
1072
|
+
clientSession: InternalClientSession | null;
|
|
1073
|
+
clientSessionInfo: ClientSessionInfo | null;
|
|
1074
|
+
sceneStates: Partial<Record<SceneEnum, SceneState>>;
|
|
1075
|
+
sceneAction?: string;
|
|
1076
|
+
selectedVaultedPaymentMethod?: string;
|
|
1077
|
+
error: {
|
|
1078
|
+
message: string | null;
|
|
1079
|
+
hideOnScreenEntered: boolean;
|
|
1080
|
+
};
|
|
1081
|
+
smallPrint: {
|
|
1082
|
+
message: string | null;
|
|
1083
|
+
};
|
|
1084
|
+
paymentMethods: Record<string, BasePaymentMethod>;
|
|
1085
|
+
checkoutModules: any[];
|
|
1086
|
+
submitButton: {
|
|
1087
|
+
isDisabled: boolean;
|
|
1088
|
+
isVisible: boolean;
|
|
1089
|
+
message: string;
|
|
1090
|
+
canDisplayAmount: boolean;
|
|
1091
|
+
};
|
|
1092
|
+
form: {
|
|
1093
|
+
inputLabelsVisible: boolean;
|
|
1094
|
+
};
|
|
1095
|
+
card: {
|
|
1096
|
+
flow: CardPreferredFlow;
|
|
1097
|
+
};
|
|
1098
|
+
}
|
|
1099
|
+
declare class CheckoutStore extends BaseStore<ICheckoutState> implements IOptionStoreSetter, IOptionStoreListener, IClientSessionStore {
|
|
1100
|
+
private submitButtonEventListener;
|
|
1101
|
+
private vault;
|
|
1102
|
+
private options;
|
|
1103
|
+
constructor(defaultState: ICheckoutState, options: UniversalCheckoutOptions | VaultManagerOptions | SinglePaymentMethodCheckoutOptions);
|
|
1104
|
+
setVault(vault: Vault): void;
|
|
1105
|
+
setIsLoading(isLoading: boolean): void;
|
|
1106
|
+
setIsProcessing(isProcessing: boolean): void;
|
|
1107
|
+
setLocale(locale: SupportedLocale): void;
|
|
1108
|
+
getLocale(): SupportedLocale;
|
|
1109
|
+
getIsRtlLocale(): boolean;
|
|
1110
|
+
setIsTokenizationEnabled(isEnabled: boolean): void;
|
|
1111
|
+
getIsTokenizationEnabled(): boolean;
|
|
1112
|
+
setScene(scene: string, action?: string): Promise<void>;
|
|
1113
|
+
setSceneTransition(transitionOptions: SceneTransitionOptions | false | undefined): void;
|
|
1114
|
+
handleSceneEntering(scene: string): void;
|
|
1115
|
+
handleSceneEntered(scene: string): void;
|
|
1116
|
+
handleSceneExited(scene: string): void;
|
|
1117
|
+
handleSceneMounted(scene: string): void;
|
|
1118
|
+
getCurrentScene(): string;
|
|
1119
|
+
setCurrentToken(token: PaymentMethodToken | null): void;
|
|
1120
|
+
triggerSubmitButtonClick(): void;
|
|
1121
|
+
addSubmitButtonClickListener(listener: EventListener | EventListenerObject | null): void;
|
|
1122
|
+
removeSubmitButtonClickListener(listener: EventListener | EventListenerObject | null): void;
|
|
1123
|
+
setSubmitButtonDisabled(disabled: boolean): void;
|
|
1124
|
+
setSubmitButtonVisible(isVisible: boolean): void;
|
|
1125
|
+
setSubmitButtonContent(content: string): void;
|
|
1126
|
+
setSubmitButtonCanDisplayAmount(isVisible: boolean): void;
|
|
1127
|
+
setCardFlow(flow: CardPreferredFlow): void;
|
|
1128
|
+
setInputLabelsVisible(visible: boolean): void;
|
|
1129
|
+
setErrorMessage(content: string | null): void;
|
|
1130
|
+
setHideErrorMessageOnSceneEntered(hideOnSceneEntered: boolean): void;
|
|
1131
|
+
addAPM(apm: NodeLike): void;
|
|
1132
|
+
setPaymentMethods(paymentMethods: Record<string, BasePaymentMethod>): void;
|
|
1133
|
+
setSelectedPaymentMethod(paymentMethodType: PaymentMethodType | string | null): void;
|
|
1134
|
+
setCheckoutModules(checkoutModules: any): void;
|
|
1135
|
+
getCheckoutModules(): any[];
|
|
1136
|
+
getCheckoutModuleWithType<CheckoutModule>(type: string): CheckoutModule | undefined;
|
|
1137
|
+
selectFirstVault(): void;
|
|
1138
|
+
addVault(vault: VaultedPaymentMethod): VaultListItem | null;
|
|
1139
|
+
selectVault(id: string | null): void;
|
|
1140
|
+
getSelectedVaultItem(): VaultListItem | undefined;
|
|
1141
|
+
removeVault(id: string): Promise<void>;
|
|
1142
|
+
setSmallPrintMessage(message: string | null): void;
|
|
1143
|
+
setTranslation(translation: TranslationUnit): void;
|
|
1144
|
+
setShowSavedPaymentMethods(show: boolean): void;
|
|
1145
|
+
setPurchaseInfo(purchaseInfo: PurchaseInformation | null): void;
|
|
1146
|
+
setCustomerDetails(customerDetails: CustomerDetails | null, orderDetailsInitiator: string | null): void;
|
|
1147
|
+
setBusinessDetails(businessDetails: BusinessDetails | null, orderDetailsInitiator: string | null): void;
|
|
1148
|
+
setOrderDetails(orderDetails: ClientSessionOrder | null, orderDetailsInitiator: string | null): void;
|
|
1149
|
+
setClientSession(clientSession: InternalClientSession): void;
|
|
1150
|
+
setClientSessionInfo(clientSessionInfo: ClientSessionInfo): void;
|
|
1151
|
+
setIsTeardown(isTeardown: boolean): void;
|
|
1152
|
+
getIsTeardown(): boolean | undefined;
|
|
1153
|
+
getPurchaseInfo(): PurchaseInformation | VaultInformation | null;
|
|
1154
|
+
getCustomerDetails(): CustomerDetails | null;
|
|
1155
|
+
getBusinessDetails(): BusinessDetails | null;
|
|
1156
|
+
getOrderDetails(): {
|
|
1157
|
+
orderDetails: ClientSessionOrder | null;
|
|
1158
|
+
orderDetailsInitiator: string | null;
|
|
1159
|
+
};
|
|
1160
|
+
getClientSession(): InternalClientSession | null;
|
|
1161
|
+
get hasAPMs(): boolean;
|
|
1162
|
+
get selectedAPM(): string | null;
|
|
1163
|
+
get hasVault(): boolean;
|
|
1164
|
+
get hasCard(): boolean;
|
|
1165
|
+
get hasCreditCardScene(): boolean;
|
|
1166
|
+
get hasDirectDebit(): boolean;
|
|
1167
|
+
get hasSurcharge(): boolean;
|
|
1168
|
+
get hasCardSurcharge(): boolean;
|
|
1169
|
+
get selectedVault(): string | null;
|
|
1170
|
+
get savePaymentMethodVisible(): boolean;
|
|
1171
|
+
get hasClientSession(): boolean;
|
|
1172
|
+
get hasSelectedPaymentMethod(): PaymentMethodType | string | null;
|
|
1173
|
+
get currentCardNetwork(): string | null;
|
|
1174
|
+
get UIOrderAmount(): string | null;
|
|
1175
|
+
get selectedPaymentMethod(): PaymentMethodType | string | null;
|
|
1176
|
+
getSelectedVaultToken(): VaultedPaymentMethod | null;
|
|
1177
|
+
getAllAPMs(): NodeLike[];
|
|
1178
|
+
getAllVaulted(): VaultListItem[];
|
|
1179
|
+
getTranslations(): Translation & Record<string, string>;
|
|
1180
|
+
getPaymentMethodWithType<T extends BasePaymentMethod>(paymentMethodType: string): T | undefined;
|
|
1181
|
+
getPaymentMethodStoreWithType<T extends IBaseStore>(paymentMethodType: string): T | undefined;
|
|
1182
|
+
getPaymentMethods(): Record<string, BasePaymentMethod>;
|
|
1183
|
+
hasVaultedToken(token: PaymentMethodToken): boolean;
|
|
1184
|
+
}
|
|
1185
|
+
export interface ClientContext {
|
|
1186
|
+
clientTokenHandler: IClientTokenHandler;
|
|
1187
|
+
clientConfigurationHandler: ClientConfigurationHandler;
|
|
1188
|
+
iframes: IFrameFactory;
|
|
1189
|
+
messageBus: IFrameMessageBus;
|
|
1190
|
+
api: Api;
|
|
1191
|
+
longPoll: LongPoll;
|
|
1192
|
+
analytics: Analytics;
|
|
1193
|
+
errorMonitoring: ErrorMonitoring;
|
|
1194
|
+
scriptLoader: ScriptLoader;
|
|
1195
|
+
session: ClientSessionInfo;
|
|
1196
|
+
moduleFactory: ModuleFactory;
|
|
1197
|
+
clientOptions: InternalFlowOptions;
|
|
1198
|
+
store: CheckoutStore;
|
|
1199
|
+
}
|
|
1200
|
+
declare class BaseClientContext implements ClientContext {
|
|
1201
|
+
clientTokenHandler: IClientTokenHandler;
|
|
1202
|
+
clientConfigurationHandler: ClientConfigurationHandler;
|
|
1203
|
+
iframes: IFrameFactory;
|
|
1204
|
+
messageBus: IFrameMessageBus;
|
|
1205
|
+
api: Api;
|
|
1206
|
+
longPoll: LongPoll;
|
|
1207
|
+
analytics: Analytics;
|
|
1208
|
+
errorMonitoring: ErrorMonitoring;
|
|
1209
|
+
scriptLoader: ScriptLoader;
|
|
1210
|
+
moduleFactory: ModuleFactory;
|
|
1211
|
+
clientOptions: InternalFlowOptions;
|
|
1212
|
+
store: CheckoutStore;
|
|
1213
|
+
/**
|
|
1214
|
+
* @deprecated use context.store instead
|
|
1215
|
+
*/
|
|
1216
|
+
get session(): ClientSessionInfo;
|
|
1217
|
+
}
|
|
1218
|
+
export type SecureInputOptions = {
|
|
1219
|
+
ariaLabel?: string;
|
|
1220
|
+
container: string;
|
|
1221
|
+
id?: string;
|
|
1222
|
+
name: string;
|
|
1223
|
+
placeholder?: string;
|
|
1224
|
+
placement?: "append" | "prepend";
|
|
1225
|
+
properties?: JSX.IntrinsicElements["input"];
|
|
1226
|
+
style?: CheckoutStyle;
|
|
1227
|
+
allowedCharactersMap?: Record<string, string>;
|
|
1228
|
+
};
|
|
1229
|
+
export type SecureInputListener = (...args: unknown[]) => void;
|
|
1230
|
+
export type CardSecurityCodeInputOptions = Omit<SecureInputOptions, "allowedCharactersMap" | "name"> & {
|
|
1231
|
+
cardNetwork?: string;
|
|
1232
|
+
name?: string;
|
|
1233
|
+
};
|
|
1234
|
+
export type CvvInput = {
|
|
1235
|
+
frame: HTMLIFrameElement | null;
|
|
1236
|
+
readonly metadata: {
|
|
1237
|
+
readonly errorCode: string | null;
|
|
1238
|
+
readonly error: string | null;
|
|
1239
|
+
readonly valid: boolean;
|
|
1240
|
+
readonly active: boolean;
|
|
1241
|
+
readonly dirty: boolean;
|
|
1242
|
+
readonly touched: boolean;
|
|
1243
|
+
readonly submitted: boolean;
|
|
1244
|
+
};
|
|
1245
|
+
focus(): void;
|
|
1246
|
+
blur(): void;
|
|
1247
|
+
addListener(event: "change" | "blur" | "focus", listener: SecureInputListener): (() => void) | undefined;
|
|
1248
|
+
removeListener(event: "change" | "blur" | "focus", listener: SecureInputListener): void;
|
|
1249
|
+
name: string;
|
|
1250
|
+
valueToken: string;
|
|
1251
|
+
remove: () => void;
|
|
1252
|
+
};
|
|
1253
|
+
export type CvvInputOptions = CardSecurityCodeInputOptions;
|
|
1254
|
+
export type HeadlessVaultManager = ReturnType<typeof createHeadlessVaultManager>;
|
|
1255
|
+
declare function createHeadlessVaultManager(context: ClientContext): {
|
|
1256
|
+
fetchVaultedPaymentMethods(): Promise<VaultedPaymentMethod[]>;
|
|
1257
|
+
deleteVaultedPaymentMethod(id: string): Promise<void>;
|
|
1258
|
+
startPaymentFlow(id: string, data?: {
|
|
1259
|
+
cvv?: string;
|
|
1260
|
+
}): Promise<void>;
|
|
1261
|
+
createCvvInput(options: CvvInputOptions): Promise<CvvInput | null>;
|
|
1262
|
+
};
|
|
1263
|
+
export declare enum PaymentFlow {
|
|
1264
|
+
DEFAULT = "DEFAULT",
|
|
1265
|
+
PREFER_VAULT = "PREFER_VAULT"
|
|
1266
|
+
}
|
|
1267
|
+
export declare enum ThreeDSecureStatus {
|
|
1268
|
+
SUCCESS = "AUTH_SUCCESS",
|
|
1269
|
+
FAILED = "AUTH_FAILED",
|
|
1270
|
+
SKIPPED = "SKIPPED",
|
|
1271
|
+
CHALLENGE = "CHALLENGE"
|
|
1272
|
+
}
|
|
1273
|
+
export declare enum ErrorCode {
|
|
1274
|
+
INITIALIZATION_ERROR = "INITIALIZATION_ERROR",
|
|
1275
|
+
NO_PAYMENT_METHODS = "NO_PAYMENT_METHODS",
|
|
1276
|
+
PRIMER_TEARDOWN = "PRIMER_TEARDOWN",
|
|
1277
|
+
PRIMER_SERVER_ERROR = "PRIMER_SERVER_ERROR",
|
|
1278
|
+
THREE_DS_SETUP_ERROR = "THREE_DS_SETUP_ERROR",
|
|
1279
|
+
THREE_DS_AUTH_FAILED = "THREE_DS_AUTH_FAILED",
|
|
1280
|
+
THREE_DS_NEGOTIATION_ERROR = "THREE_DS_NEGOTIATION_ERROR",
|
|
1281
|
+
TOKENIZATION_ERROR = "TOKENIZATION_ERROR",
|
|
1282
|
+
DUPLICATE_PAYMENT_METHOD_ERROR = "DUPLICATE_PAYMENT_METHOD_ERROR",
|
|
1283
|
+
CARD_NUMBER_ERROR = "CARD_NUMBER_ERROR",
|
|
1284
|
+
PAYMENT_METHOD_NOT_SETUP = "PAYMENT_METHOD_NOT_SETUP",
|
|
1285
|
+
PAYMENT_METHOD_NOT_PROVIDED = "PAYMENT_METHOD_NOT_SETUP",
|
|
1286
|
+
PAYMENT_METHOD_NOT_COMPATIBLE = "PAYMENT_METHOD_NOT_COMPATIBLE",
|
|
1287
|
+
RESUME_ERROR = "RESUME_ERROR",
|
|
1288
|
+
TAX_ERROR = "TAX_ERROR",
|
|
1289
|
+
VALIDATION_ERROR = "VALIDATION_ERROR",
|
|
1290
|
+
PAYMENT_FAILED = "PAYMENT_FAILED",
|
|
1291
|
+
PAYMENT_CREATION_ABORTED = "PAYMENT_CREATION_ABORTED",
|
|
1292
|
+
PAYMENT_CREATION_DISABLED = "PAYMENT_CREATION_DISABLED",
|
|
1293
|
+
CLIENT_SESSION_UPDATE_ERROR = "CLIENT_SESSION_UPDATE_ERROR",
|
|
1294
|
+
INVALID_ARGUMENT = "INVALID_ARGUMENT",
|
|
1295
|
+
VAULT_FETCH = "VAULT_FETCH",
|
|
1296
|
+
VAULT_DELETE = "VAULT_DELETE",
|
|
1297
|
+
HEADLESS_VAULT_MANAGER_VALIDATION = "HEADLESS_VAULT_MANAGER_VALIDATION"
|
|
1298
|
+
}
|
|
1299
|
+
export interface ErrorOptions {
|
|
1300
|
+
message: string;
|
|
1301
|
+
severity?: MessageSeverity;
|
|
1302
|
+
diagnosticsId?: string;
|
|
1303
|
+
errorId?: string;
|
|
1304
|
+
data?: any;
|
|
1305
|
+
isFromDeveloper?: boolean;
|
|
1306
|
+
}
|
|
1307
|
+
declare class PrimerClientError extends Error {
|
|
1308
|
+
code: ErrorCode;
|
|
1309
|
+
message: string;
|
|
1310
|
+
diagnosticsId: Nullable<string>;
|
|
1311
|
+
data?: any;
|
|
1312
|
+
isFromDeveloper: boolean;
|
|
1313
|
+
static fromErrorCode(code: ErrorCode, options: ErrorOptions, analytics?: Analytics): PrimerClientError;
|
|
1314
|
+
constructor(code: ErrorCode, options: ErrorOptions, analytics?: Analytics);
|
|
1315
|
+
}
|
|
1316
|
+
export interface CardMetadata {
|
|
1317
|
+
type: CardNetwork | null;
|
|
1318
|
+
possibleTypes: string[];
|
|
1319
|
+
cvvLength: number;
|
|
1320
|
+
cardNumberLength: number;
|
|
1321
|
+
}
|
|
1322
|
+
export type PaymentMethodData = AdyenMultibancoPaymentData;
|
|
1323
|
+
export type AdyenMultibancoPaymentData = {
|
|
1324
|
+
paymentMethodType: PaymentMethodType.ADYEN_MULTIBANCO;
|
|
1325
|
+
reference: string;
|
|
1326
|
+
expiresAt: string;
|
|
1327
|
+
entity: string;
|
|
1328
|
+
};
|
|
1329
|
+
export interface PositionalConfig {
|
|
1330
|
+
container: string;
|
|
1331
|
+
}
|
|
1332
|
+
export interface ApplePayOptions extends PositionalConfig {
|
|
1333
|
+
buttonType?: "plain" | "buy" | "set-up" | "donate" | "check-out" | "book" | "subscribe";
|
|
1334
|
+
buttonStyle?: "white" | "white-outline" | "black";
|
|
1335
|
+
captureBillingAddress?: boolean;
|
|
1336
|
+
}
|
|
1337
|
+
export interface DirectDebitOptions {
|
|
1338
|
+
customerCountryCode: Alpha2CountryCode;
|
|
1339
|
+
companyName: string;
|
|
1340
|
+
companyAddress: string;
|
|
1341
|
+
customerName?: string;
|
|
1342
|
+
customerEmail?: string;
|
|
1343
|
+
customerAddressLine1?: string;
|
|
1344
|
+
customerAddressLine2?: string;
|
|
1345
|
+
customerCity?: string;
|
|
1346
|
+
customerPostalCode?: string;
|
|
1347
|
+
iban?: string;
|
|
1348
|
+
submitButtonLabels?: {
|
|
1349
|
+
form?: Label;
|
|
1350
|
+
mandate: Label;
|
|
1351
|
+
};
|
|
1352
|
+
}
|
|
1353
|
+
export type GooglePayButtonType =
|
|
1354
|
+
/** @deprecated Set buttonSizeMode to fill instead */
|
|
1355
|
+
"long"
|
|
1356
|
+
/** @deprecated Set buttonSizeMode to static instead */
|
|
1357
|
+
| "short" | "book" | "buy" | "checkout" | "donate" | "order" | "pay" | "plain" | "subscribe";
|
|
1358
|
+
export type GooglePayButtonColor = "default" | "black" | "white";
|
|
1359
|
+
export type GooglePayButtonSizeMode = "fill" | "static";
|
|
1360
|
+
export interface GooglePayOptions extends PositionalConfig {
|
|
1361
|
+
buttonType?: GooglePayButtonType;
|
|
1362
|
+
buttonColor?: GooglePayButtonColor;
|
|
1363
|
+
buttonSizeMode?: GooglePayButtonSizeMode;
|
|
1364
|
+
onClick?: () => void;
|
|
1365
|
+
captureBillingAddress?: boolean;
|
|
1366
|
+
}
|
|
1367
|
+
export interface PayPalOptions extends PositionalConfig {
|
|
1368
|
+
buttonColor?: "gold" | "blue" | "silver" | "white" | "black";
|
|
1369
|
+
buttonShape?: "pill" | "rect";
|
|
1370
|
+
buttonSize?: "small" | "medium" | "large" | "responsive";
|
|
1371
|
+
buttonHeight?: number;
|
|
1372
|
+
buttonLabel?: "checkout" | "credit" | "pay" | "buynow" | "paypal" | "installment";
|
|
1373
|
+
buttonTagline?: boolean;
|
|
1374
|
+
paymentFlow?: PaymentFlow;
|
|
1375
|
+
onClick?: () => void;
|
|
1376
|
+
}
|
|
495
1377
|
export interface TransitionDurationOptions {
|
|
496
1378
|
enter?: number;
|
|
497
1379
|
exit?: number;
|
|
@@ -599,7 +1481,7 @@ export interface KlarnaOptions {
|
|
|
599
1481
|
export type SupportedLocale = string;
|
|
600
1482
|
export type Alpha2CountryCode = string;
|
|
601
1483
|
export type Alpha3CurrencyCode = string;
|
|
602
|
-
export type ElementOrID =
|
|
1484
|
+
export type ElementOrID = string | HTMLElement | null;
|
|
603
1485
|
export type ValidationErrorType = "required" | "invalid";
|
|
604
1486
|
export type Label<T extends Record<string, unknown> = Record<string, unknown>> = string | ((options: {
|
|
605
1487
|
locale: SupportedLocale;
|
|
@@ -728,8 +1610,8 @@ export interface IPaymentMethodToken<T, U extends PaymentInstrumentType> {
|
|
|
728
1610
|
tokenType: TokenType;
|
|
729
1611
|
paymentInstrumentData: T;
|
|
730
1612
|
paymentInstrumentType: U;
|
|
731
|
-
threeDSecureAuthentication:
|
|
732
|
-
vaultData:
|
|
1613
|
+
threeDSecureAuthentication: ThreeDSAuthenticationData | null;
|
|
1614
|
+
vaultData: VaultData | null;
|
|
733
1615
|
}
|
|
734
1616
|
export type BaseAmountChange = {
|
|
735
1617
|
totalAmount: number;
|
|
@@ -746,7 +1628,7 @@ export type IdealPayToken = IPaymentMethodToken<Record<string, never>, PaymentIn
|
|
|
746
1628
|
export type PaymentMethodToken = PaymentCardToken | PayPalBillingAgreementToken | GoCardlessToken | IdealPayToken | IPaymentMethodToken<any, any>;
|
|
747
1629
|
export interface ThreeDSVerificationResult<T extends ThreeDSecureStatus> {
|
|
748
1630
|
status: T;
|
|
749
|
-
error:
|
|
1631
|
+
error: PrimerClientError | null;
|
|
750
1632
|
data: PaymentMethodToken;
|
|
751
1633
|
resumeToken: string;
|
|
752
1634
|
}
|
|
@@ -868,7 +1750,7 @@ export interface TokenizationHandlers {
|
|
|
868
1750
|
}
|
|
869
1751
|
export interface PaymentMethodHandlers {
|
|
870
1752
|
onPaymentMethodAction?: (paymentMethodAction: PaymentMethodAction, { paymentMethodType, }: {
|
|
871
|
-
paymentMethodType:
|
|
1753
|
+
paymentMethodType: PaymentMethodType | string | null;
|
|
872
1754
|
}) => void;
|
|
873
1755
|
}
|
|
874
1756
|
export interface ClientSessionHandlers {
|
|
@@ -1068,8 +1950,9 @@ export interface PrimerHeadlessCheckout {
|
|
|
1068
1950
|
createPaymentMethodManager(type: "PAYMENT_CARD", options?: PaymentMethodManagerOptions): Promise<ICardPaymentMethodManager | null>;
|
|
1069
1951
|
createPaymentMethodManager(type: PaymentMethodType.PAYPAL | "PAYPAL" | "GOOGLE_PAY" | "APPLE_PAY", options?: PaymentMethodManagerOptions): Promise<INativePaymentMethodManager | null>;
|
|
1070
1952
|
createPaymentMethodManager(type: PaymentMethodType, options?: PaymentMethodManagerOptions): Promise<IRedirectPaymentMethodManager | null>;
|
|
1071
|
-
|
|
1953
|
+
createVaultManager(): HeadlessVaultManager;
|
|
1072
1954
|
configure: (options: HeadlessUniversalCheckoutOptions) => void;
|
|
1955
|
+
getAssetsManager(): IAssetsManager;
|
|
1073
1956
|
start: () => void;
|
|
1074
1957
|
}
|
|
1075
1958
|
export interface PrimerSinglePaymentMethodCheckout {
|
|
@@ -1097,7 +1980,7 @@ export declare const Primer: {
|
|
|
1097
1980
|
SDK_VERSION: string;
|
|
1098
1981
|
createHeadless: (clientToken: string) => Promise<PrimerHeadlessCheckout>;
|
|
1099
1982
|
showExpressCheckout: (clientToken: string, options: any) => Promise<PrimerCheckout>;
|
|
1100
|
-
showUniversalCheckout: (clientToken: string, options:
|
|
1983
|
+
showUniversalCheckout: (clientToken: string, options: UniversalCheckoutOptions | SinglePaymentMethodCheckoutOptions) => Promise<PrimerCheckout>;
|
|
1101
1984
|
showVaultManager: (clientToken: string, options: VaultManagerOptions) => Promise<PrimerVaultManager>;
|
|
1102
1985
|
};
|
|
1103
1986
|
|