@paydock/client-sdk 1.145.0-beta → 1.148.0-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +129 -1
  2. package/bundles/index.cjs +935 -103
  3. package/bundles/index.cjs.d.ts +629 -336
  4. package/bundles/index.mjs +935 -104
  5. package/bundles/index.mjs.d.ts +629 -336
  6. package/bundles/types/api/api-base.d.ts +6 -0
  7. package/bundles/types/api/api-base.d.ts.map +1 -1
  8. package/bundles/types/api/api-charge-internal.d.ts +4 -3
  9. package/bundles/types/api/api-charge-internal.d.ts.map +1 -1
  10. package/bundles/types/canvas-3ds/canvas-3ds-event-map.d.ts +65 -0
  11. package/bundles/types/canvas-3ds/canvas-3ds-event-map.d.ts.map +1 -1
  12. package/bundles/types/canvas-3ds/canvas-3ds.d.ts +34 -5
  13. package/bundles/types/canvas-3ds/canvas-3ds.d.ts.map +1 -1
  14. package/bundles/types/canvas-3ds/index.d.ts +1 -1
  15. package/bundles/types/canvas-3ds/index.d.ts.map +1 -1
  16. package/bundles/types/canvas-3ds/services/gpayments-service.d.ts +151 -2
  17. package/bundles/types/canvas-3ds/services/gpayments-service.d.ts.map +1 -1
  18. package/bundles/types/canvas-3ds/services/standalone3ds-service.d.ts +16 -0
  19. package/bundles/types/canvas-3ds/services/standalone3ds-service.d.ts.map +1 -1
  20. package/bundles/types/components/iframe-event.d.ts +4 -3
  21. package/bundles/types/components/iframe-event.d.ts.map +1 -1
  22. package/bundles/types/components/iframe.d.ts +5 -0
  23. package/bundles/types/components/iframe.d.ts.map +1 -1
  24. package/bundles/types/components/param.d.ts +19 -0
  25. package/bundles/types/components/param.d.ts.map +1 -1
  26. package/bundles/types/index-cba.d.ts +1 -1
  27. package/bundles/types/index-cba.d.ts.map +1 -1
  28. package/bundles/types/index.d.ts +2 -2
  29. package/bundles/types/index.d.ts.map +1 -1
  30. package/bundles/types/widget/multi-widget.d.ts +19 -0
  31. package/bundles/types/widget/multi-widget.d.ts.map +1 -1
  32. package/bundles/widget.umd.js +935 -103
  33. package/bundles/widget.umd.js.d.ts +629 -336
  34. package/bundles/widget.umd.js.min.d.ts +629 -336
  35. package/bundles/widget.umd.min.js +1 -1
  36. package/docs/api-canvas3ds.md +41 -8
  37. package/docs/api-checkout-button.md +15 -0
  38. package/docs/api-ps-widget.md +15 -0
  39. package/docs/api-widget.md +15 -0
  40. package/docs/canvas3ds-examples.md +43 -1
  41. package/docs/widget-examples.md +41 -0
  42. package/package.json +20 -11
  43. package/slate.md +84 -1
@@ -259,6 +259,24 @@ declare const SUPPORTED_CARD_TYPES: {
259
259
  EFTPOS_WHITE: string;
260
260
  UNIONPAY: string;
261
261
  };
262
+ /**
263
+ * Card schemes the widget is able to resolve from a card number, and therefore the only values
264
+ * `setAllowedCardSchemes` accepts. This is a separate vocabulary from SUPPORTED_CARD_TYPES, which drives the
265
+ * card icons: it omits the icon-only variants `visa_white` / `eftpos_white`, and the `laser` / `maestro`
266
+ * identifiers the widget can never resolve — allowing those would be configuration that can never match.
267
+ */
268
+ declare const CARD_SCHEME: {
269
+ AMEX: string;
270
+ AUSBC: string;
271
+ DINERS: string;
272
+ DISCOVER: string;
273
+ EFTPOS: string;
274
+ JAPCB: string;
275
+ MASTERCARD: string;
276
+ SOLO: string;
277
+ UNIONPAY: string;
278
+ VISA: string;
279
+ };
262
280
  interface IIcons {
263
281
  paypal_checkout_button?: string;
264
282
  afterpay_checkout_button?: string;
@@ -362,6 +380,7 @@ interface IParams extends IStyles$1, ITexts, ICommonParams {
362
380
  ref_id?: string;
363
381
  supported_card_types?: string;
364
382
  validate_card_types?: boolean;
383
+ allowed_card_schemes?: string;
365
384
  fields_validation?: boolean;
366
385
  hidden_elements?: string;
367
386
  icons?: string;
@@ -767,10 +786,15 @@ declare class Configuration {
767
786
  declare class IFrame {
768
787
  protected container: Container;
769
788
  constructor(container: Container);
789
+ /**
790
+ * @param options.onLoad Called on every `load` of the iframe (initial document and each
791
+ * subsequent navigation). Attached before `src` is set so a fast load is never missed.
792
+ */
770
793
  load(link: string, options?: {
771
794
  title?: string;
772
795
  attributes?: Record<string, string>;
773
796
  styles?: Record<string, string>;
797
+ onLoad?: (event: Event) => void;
774
798
  }, iframeClass?: string): void;
775
799
  loadFromHtml(content: string, options?: {
776
800
  title?: string;
@@ -842,15 +866,16 @@ declare const EVENT$3: {
842
866
  type EventTypes = typeof EVENT$3[keyof typeof EVENT$3];
843
867
  interface Listener {
844
868
  event: string;
845
- listener: (event: any) => void;
869
+ /** `origin` is the `MessageEvent.origin` of the postMessage that carried the data (undefined for direct `emit`). */
870
+ listener: (event: any, origin?: string) => void;
846
871
  widget_id: string;
847
872
  }
848
873
  declare type Listeners = Listener[];
849
874
  declare class IFrameEvent {
850
875
  protected listeners: Listeners;
851
876
  constructor(subject: Window | null);
852
- emit(data: IEventData$1): void;
853
- on<T>(eventName: string, widgetId: string, cb: (data: T) => void): void;
877
+ emit(data: IEventData$1, origin?: string): void;
878
+ on<T>(eventName: string, widgetId: string, cb: (data: T, origin?: string) => void): void;
854
879
  clear(): void;
855
880
  private subscribe;
856
881
  }
@@ -1206,6 +1231,25 @@ declare class MultiWidget {
1206
1231
  * @param {boolean} validateCardNumberInput - [validateCardNumberInput=false] - using this param you allow validation for card number input on supported card types
1207
1232
  */
1208
1233
  setSupportedCardIcons(elements: string[], validateCardNumberInput?: boolean): void;
1234
+ /**
1235
+ * Current method restricts which card schemes the card number input accepts, without changing which card
1236
+ * icons the widget displays. Scheme identifiers are matched case-insensitively and ignoring surrounding
1237
+ * whitespace; unsupported identifiers are ignored with a warning, so a list in which every identifier is
1238
+ * unsupported applies no restriction at all.
1239
+ *
1240
+ * Takes precedence over setSupportedCardIcons: when a non-empty list is supplied here, it is the only list
1241
+ * used for validation and the validateCardNumberInput flag of setSupportedCardIcons no longer affects it.
1242
+ * Calling this method more than once replaces the previous list rather than merging with it.
1243
+ *
1244
+ * Must be called before load().
1245
+ *
1246
+ * @example
1247
+ *
1248
+ * widget.setAllowedCardSchemes(['visa', 'mastercard']);
1249
+ *
1250
+ * @param {string[]} schemes - [CARD_SCHEME]{@link CARD_SCHEME}
1251
+ */
1252
+ setAllowedCardSchemes(schemes: string[]): void;
1209
1253
  /**
1210
1254
  * Current method can hide prevent the widget from showing the error messages
1211
1255
  *
@@ -2171,6 +2215,12 @@ declare class ApiBase {
2171
2215
  * @param {string} [alias] - Own domain alias
2172
2216
  */
2173
2217
  setEnv(env: string, alias?: string): ApiBase;
2218
+ /**
2219
+ * Origin (`scheme://host[:port]`) of the API this client talks to, for the current env/alias.
2220
+ * Used to validate the `origin` of postMessages the API itself sends to the page.
2221
+ */
2222
+ getApiOrigin(): string;
2223
+ static toOrigin(url: string): string;
2174
2224
  requestObservable<Req extends object, Res>(method: 'GET' | 'POST', url: string, requestBody: Req): Observable<Res>;
2175
2225
  private makeRequest;
2176
2226
  private onRequestLoad;
@@ -2267,350 +2317,116 @@ declare class Api extends ApiBase {
2267
2317
  }
2268
2318
 
2269
2319
  /**
2270
- * Decoded payload of the Standalone 3DS charge token (the JWT body) the SDK
2271
- * receives in `Canvas3ds`'s constructor when the token format is `standalone_3ds`.
2272
- *
2273
- * This shape is set by the Paydock backend when minting the token. Integrators
2274
- * who decode the token themselves can use this interface to type the result.
2320
+ * Canonical shared response shapes used by both Charge and Checkout internal APIs.
2321
+ * Extracted here to remove the prior duplicated definitions in
2322
+ * api-charge-internal.ts and api-checkout-internal.ts.
2275
2323
  */
2276
- interface ITokenStandalone3DS {
2277
- /** Optional merchant-side correlation identifier carried through from the original charge request. */
2278
- external_id?: string;
2279
- /** URL of the first iframe the SDK loads to bootstrap the 3DS provider's authentication flow. */
2280
- initialization_url: string;
2281
- /**
2282
- * @deprecated No longer read by the Standalone 3DS flow. The field is kept
2283
- * on the interface for backwards compatibility with tokens minted by older
2284
- * API versions; it will be removed in a future major release. Prefer
2285
- * `initialization_url` + `secondary_url`.
2286
- */
2287
- authorization_url?: string;
2288
- /** Optional URL of a secondary iframe used by some providers (e.g. GPayments) for monitoring/polling alongside the main flow. */
2289
- secondary_url?: string;
2290
- /** The Paydock 3DS charge identifier this token authorizes. Echoed back in every event payload emitted during the flow. */
2291
- charge_3ds_id: string;
2292
- /** Identifier of the 3DS gateway the SDK should delegate to. Currently only `'GPayments'` is handled; other values fall through. */
2293
- service_type: string;
2294
- }
2295
- declare class Standalone3dsService {
2296
- protected container: Container;
2297
- protected eventEmitter: EventEmitter;
2298
- protected env: string;
2299
- protected alias: string;
2300
- constructor(container: Container, eventEmitter: any);
2301
- load(token: string, options: {
2302
- title: string;
2303
- }): void;
2304
- setEnv(env: string, alias?: string): void;
2324
+ interface HandleResponseInterface {
2325
+ status: string;
2326
+ error: string;
2327
+ result: {
2328
+ reference: string;
2329
+ reference_2: string;
2330
+ identifier: string;
2331
+ identifier_2: string;
2332
+ identifier_3: string;
2333
+ identifier_4: string;
2334
+ identifier_5: string;
2335
+ type: string;
2336
+ status: string;
2337
+ status_2: string;
2338
+ status_code: string;
2339
+ ref_token: string;
2340
+ cancellation: string;
2341
+ count: string;
2342
+ version: string;
2343
+ whitelist: {
2344
+ status: string;
2345
+ source: string;
2346
+ };
2347
+ result: string;
2348
+ };
2305
2349
  }
2306
-
2307
- /**
2308
- * Payload emitted by the Standalone 3DS flow for auth-related events
2309
- * (chargeAuthSuccess, chargeAuthReject, chargeAuthChallenge, chargeAuthDecoupled).
2310
- */
2311
- interface Canvas3dsAuthPayload {
2312
- /** The Paydock 3DS charge identifier (e.g. `'chrg_3ds_xxxxx'`) used to correlate the authentication with the underlying charge. */
2313
- charge_3ds_id: string;
2314
- /** Authentication outcome status reported by the 3DS provider (e.g. `'authenticated'`, `'rejected'`, `'pending'`). */
2350
+ interface ProcessAuthenticationResponse {
2315
2351
  status: string;
2316
- /** Optional result details. Present when the 3DS provider returns additional context for the outcome. */
2352
+ error?: string;
2317
2353
  result?: {
2318
- /** Human-readable description of the outcome (e.g. `'frictionless'`). */
2354
+ challenge: string;
2355
+ challenge_url: string;
2356
+ decoupled_challenge: boolean;
2357
+ frictionless: boolean;
2358
+ identifier: string;
2359
+ identifier_3: string;
2360
+ identifier_4: string;
2361
+ reference: string;
2362
+ reference_2: string;
2363
+ secondary_url: string;
2364
+ skipped: boolean;
2365
+ status: string;
2366
+ type: string;
2367
+ version: string;
2319
2368
  description?: string;
2320
2369
  };
2321
2370
  }
2322
- /**
2323
- * Payload emitted by the Standalone 3DS flow for error events.
2324
- * `error` is intentionally `unknown` — upstream emitters do not guarantee a shape.
2325
- */
2326
- interface Canvas3dsErrorPayload {
2327
- /** The Paydock 3DS charge identifier associated with the failed authentication attempt. */
2328
- charge_3ds_id: string;
2329
- /** The underlying error. Typed as `unknown` to force the consumer to narrow it before use. */
2330
- error: unknown;
2371
+
2372
+ declare class ApiChargeInternal {
2373
+ protected api: ApiInternal;
2374
+ constructor(api: ApiInternal);
2375
+ walletCapture(payload: WalletCaptureBody): Promise<WalletCaptureResponse>;
2376
+ walletCallback(payload: WalletCallbackBody): Promise<WalletCallbackResponse>;
2377
+ /** Two-step mode: runs the deferred Standalone 3DS authentication (AReq). Charge-token auth, like `standalone3dsHandle`. */
2378
+ standalone3dsProcess(payload: Standalone3dsProcessBody): Promise<ProcessAuthenticationResponse>;
2379
+ standalone3dsHandle(): Promise<HandleResponseInterface>;
2331
2380
  }
2332
- /**
2333
- * Payload emitted by the iframe-based 3DS flow for auth-related events
2334
- * (`chargeAuth`, `chargeAuthSuccess`, `chargeAuthReject`).
2335
- *
2336
- * Extends `IEventData` with optional 3DS-specific fields that the widget
2337
- * merges into the message envelope for charge correlation.
2338
- */
2339
- interface Canvas3dsChargeAuthEventPayload extends IEventData$1 {
2340
- /** The Paydock 3DS charge identifier. Present when the widget correlates the event with a charge. */
2341
- charge_3ds_id?: string;
2342
- /** Authentication outcome status reported by the widget (e.g. `'authenticated'`, `'server_error'`). */
2343
- status?: string;
2344
- /** Optional result details forwarded from the 3DS provider. */
2345
- result?: {
2346
- /** Human-readable description of the outcome (e.g. `'frictionless'`). */
2347
- description?: string;
2381
+ interface WalletCaptureResponse {
2382
+ id: string;
2383
+ amount: number;
2384
+ currency: string;
2385
+ status: string;
2386
+ }
2387
+ interface WalletCaptureBody {
2388
+ payment_method_id?: string;
2389
+ customer?: {
2390
+ payment_source?: {
2391
+ type?: string;
2392
+ card_name?: string;
2393
+ card_scheme?: string;
2394
+ card_number_last4?: string;
2395
+ expire_month?: number;
2396
+ expire_year?: number;
2397
+ address_line1?: string;
2398
+ address_line2?: string;
2399
+ address_city?: string;
2400
+ address_postcode?: string;
2401
+ address_state?: string;
2402
+ address_country?: string;
2403
+ external_payer_id?: string;
2404
+ ref_token?: string;
2405
+ wallet_express?: boolean;
2406
+ };
2348
2407
  };
2349
2408
  }
2350
- /**
2351
- * Payload emitted by the iframe-based 3DS flow for error events.
2352
- * Extends `IEventData` with optional 3DS-specific fields for charge correlation.
2353
- */
2354
- interface Canvas3dsErrorEventPayload extends IEventData$1 {
2355
- /** The Paydock 3DS charge identifier associated with the error. */
2356
- charge_3ds_id?: string;
2409
+ interface WalletCallbackBody {
2410
+ request_type: string;
2357
2411
  }
2358
- /**
2359
- * Maps Canvas3ds event names to their callback data types.
2360
- *
2361
- * Events that can fire from both the iframe (html/url) and standalone flows
2362
- * use a union to accommodate both shapes. Standalone-only and iframe-only events
2363
- * use a single payload type.
2364
- */
2365
- interface Canvas3dsEventMap {
2366
- /** Successful authentication. Standalone path emits `Canvas3dsAuthPayload`; iframe path emits `Canvas3dsChargeAuthEventPayload`. Narrow with `'event' in data` for iframe vs standalone. */
2367
- chargeAuthSuccess: Canvas3dsAuthPayload | Canvas3dsChargeAuthEventPayload;
2368
- /** Rejected authentication. Same dual-emit pattern as `chargeAuthSuccess`. */
2369
- chargeAuthReject: Canvas3dsAuthPayload | Canvas3dsChargeAuthEventPayload;
2370
- /** Authentication or processing error. Standalone path emits `Canvas3dsErrorPayload`; iframe path emits `Canvas3dsErrorEventPayload`. */
2371
- error: Canvas3dsErrorPayload | Canvas3dsErrorEventPayload;
2372
- /** Challenge required — issuer demands user interaction (OTP, biometric, etc.). Standalone-only. */
2373
- chargeAuthChallenge: Canvas3dsAuthPayload;
2374
- /** Decoupled authentication — issuer will authenticate out-of-band and notify later. Standalone-only. */
2375
- chargeAuthDecoupled: Canvas3dsAuthPayload;
2376
- /** Iframe-path authentication event. Extends `IEventData` with optional 3DS correlation fields (`charge_3ds_id`, `status`). */
2377
- chargeAuth: Canvas3dsChargeAuthEventPayload;
2378
- /** User cancelled the authentication flow before completion. Iframe-only. */
2379
- chargeAuthCancelled: IEventData$1;
2380
- /** Additional data collection step completed successfully. Iframe-only. */
2381
- additionalDataCollectSuccess: IEventData$1;
2382
- /** Additional data collection step was rejected. Iframe-only. */
2383
- additionalDataCollectReject: IEventData$1;
2412
+ interface Standalone3dsProcessBody {
2413
+ charge_3ds_id: string;
2414
+ }
2415
+ interface WalletCallbackResponse {
2416
+ id: string;
2417
+ status: string;
2418
+ callback_method: string;
2419
+ callback_rel: string;
2420
+ callback_url: string;
2384
2421
  }
2385
- /** Union of all known Canvas3ds event names. */
2386
- type Canvas3dsEventName = keyof Canvas3dsEventMap;
2387
- /**
2388
- * Public, tree-shakeable alias for the internal `TOKEN_FORMAT` enum in canvas-3ds.ts.
2389
- * Mirrors the string values of that enum without exposing the private enum itself.
2390
- */
2391
- declare const Canvas3dsTokenFormat: {
2392
- /** Token whose `content` is a complete HTML page. The SDK renders it inside an iframe. */
2393
- readonly HTML: "html";
2394
- /** Token whose `content` is a URL. The SDK loads it inside an iframe. */
2395
- readonly URL: "url";
2396
- /** Token whose `content` describes a standalone 3DS service (e.g. GPayments). The SDK delegates to that service's flow. */
2397
- readonly STANDALONE_3DS: "standalone_3ds";
2398
- };
2399
- type Canvas3dsTokenFormat = (typeof Canvas3dsTokenFormat)[keyof typeof Canvas3dsTokenFormat];
2400
2422
 
2401
- /**
2402
- * List of available token's content formats
2403
- * @enum TOKEN_FORMAT
2404
- *
2405
- * @type {object}
2406
- * @param {string} HTML=html
2407
- */
2408
- declare enum TOKEN_FORMAT {
2409
- HTML = "html",
2410
- URL = "url",
2411
- STANDALONE_3DS = "standalone_3ds"
2412
- }
2413
- /**
2414
- * List of available event's name
2415
- * @const EVENT
2416
- *
2417
- * @type {object}
2418
- * @param {string} CHARGE_AUTH_SUCCESS=chargeAuthSuccess
2419
- * @param {string} CHARGE_AUTH_REJECT=chargeAuthReject
2420
- * @param {string} ADDITIONAL_DATA_SUCCESS=additionalDataCollectSuccess
2421
- * @param {string} ADDITIONAL_DATA_REJECT=additionalDataCollectReject
2422
- * @param {string} CHARGE_AUTH=chargeAuth
2423
- */
2424
- /**
2425
- * List of available event's name for Standalone 3ds flow
2426
- * @const STANDALONE_3DS_EVENT
2427
- *
2428
- * @type {object}
2429
- * @param {string} CHARGE_AUTH_SUCCESS=chargeAuthSuccess
2430
- * @param {string} CHARGE_AUTH_REJECT=chargeAuthReject
2431
- * @param {string} CHARGE_AUTH_DECOUPLED=chargeAuthDecoupled
2432
- * @param {string} CHARGE_AUTH_CHALLENGE=chargeAuthChallenge
2433
- * @param {string} CHARGE_AUTH_INFO=chargeAuthInfo
2434
- * @param {string} ERROR=error
2435
- */
2436
- /**
2437
- * Class Canvas3ds include method for working on html
2438
- * @constructor
2439
- *
2440
- * @param {string} selector - Selector of html element. Container for widget
2441
- * @param {string} token - Pre authorized token
2442
- * @example
2443
- * var widget = new Canvas3ds('#widget', 'token');
2444
- *
2445
- *
2446
- */
2447
- declare class Canvas3ds {
2448
- protected link: Link;
2449
- protected configs: Configuration[];
2450
- protected publicKey: string;
2451
- protected token: {
2452
- content: string;
2453
- format: TOKEN_FORMAT;
2454
- charge_3ds_id: string;
2455
- };
2456
- protected standalone3dsService: Standalone3dsService;
2457
- protected container: Container;
2458
- protected iFrame: IFrame;
2459
- protected event: IFrameEvent;
2460
- protected eventEmitter: EventEmitter;
2461
- /** @constructs */ constructor(selector: string, token: string);
2462
- protected static extractToken(token: string): {
2463
- content: string;
2464
- format: TOKEN_FORMAT;
2465
- charge_3ds_id: string;
2466
- };
2467
- /**
2468
- * The final method to beginning, the load process of widget to html
2469
- *
2470
- */
2471
- load(): void;
2472
- /**
2473
- * Current method can change environment. By default environment = sandbox.
2474
- * Also we can change domain alias for this environment. By default domain_alias = paydock.com
2475
- *
2476
- * @example
2477
- * widget.setEnv('production');
2478
- * @param {string} env - sandbox, production
2479
- * @param {string} [alias] - Own domain alias
2480
- */
2481
- setEnv(env: string, alias?: string): void;
2482
- getEnv(): string;
2483
- on<E extends keyof Canvas3dsEventMap>(eventName: E, cb: (data: Canvas3dsEventMap[E]) => void): void;
2484
- on<E extends keyof Canvas3dsEventMap>(eventName: E): Promise<Canvas3dsEventMap[E]>;
2485
- on(eventName: string, cb: (data: IEventData$1) => void): void;
2486
- on(eventName: string): Promise<IEventData$1>;
2487
- /**
2488
- * Using this method you can hide widget after load
2489
- * @param {boolean} [saveSize=false] - using this param you can save iframe's size
2490
- */
2491
- hide(saveSize: boolean): void;
2492
- /**
2493
- * Using this method you can show widget after using hide method
2494
- *
2495
- */
2496
- show(): void;
2497
- /**
2498
- * Using this method you can reload widget
2499
- *
2500
- */
2501
- reload(): void;
2502
- }
2503
-
2504
- /**
2505
- * Canonical shared response shapes used by both Charge and Checkout internal APIs.
2506
- * Extracted here to remove the prior duplicated definitions in
2507
- * api-charge-internal.ts and api-checkout-internal.ts.
2508
- */
2509
- interface HandleResponseInterface {
2510
- status: string;
2511
- error: string;
2512
- result: {
2513
- reference: string;
2514
- reference_2: string;
2515
- identifier: string;
2516
- identifier_2: string;
2517
- identifier_3: string;
2518
- identifier_4: string;
2519
- identifier_5: string;
2520
- type: string;
2521
- status: string;
2522
- status_2: string;
2523
- status_code: string;
2524
- ref_token: string;
2525
- cancellation: string;
2526
- count: string;
2527
- version: string;
2528
- whitelist: {
2529
- status: string;
2530
- source: string;
2531
- };
2532
- result: string;
2533
- };
2534
- }
2535
- interface ProcessAuthenticationResponse {
2536
- status: string;
2537
- error?: string;
2538
- result?: {
2539
- challenge: string;
2540
- challenge_url: string;
2541
- decoupled_challenge: boolean;
2542
- frictionless: boolean;
2543
- identifier: string;
2544
- identifier_3: string;
2545
- identifier_4: string;
2546
- reference: string;
2547
- reference_2: string;
2548
- secondary_url: string;
2549
- skipped: boolean;
2550
- status: string;
2551
- type: string;
2552
- version: string;
2553
- description?: string;
2554
- };
2555
- }
2556
-
2557
- declare class ApiChargeInternal {
2558
- protected api: ApiInternal;
2559
- constructor(api: ApiInternal);
2560
- walletCapture(payload: WalletCaptureBody): Promise<WalletCaptureResponse>;
2561
- walletCallback(payload: WalletCallbackBody): Promise<WalletCallbackResponse>;
2562
- standalone3dsProcess(payload: Standalone3dsProcessBody): Promise<ProcessAuthenticationResponse>;
2563
- standalone3dsHandle(): Promise<HandleResponseInterface>;
2564
- }
2565
- interface WalletCaptureResponse {
2566
- id: string;
2567
- amount: number;
2568
- currency: string;
2569
- status: string;
2570
- }
2571
- interface WalletCaptureBody {
2572
- payment_method_id?: string;
2573
- customer?: {
2574
- payment_source?: {
2575
- type?: string;
2576
- card_name?: string;
2577
- card_scheme?: string;
2578
- card_number_last4?: string;
2579
- expire_month?: number;
2580
- expire_year?: number;
2581
- address_line1?: string;
2582
- address_line2?: string;
2583
- address_city?: string;
2584
- address_postcode?: string;
2585
- address_state?: string;
2586
- address_country?: string;
2587
- external_payer_id?: string;
2588
- ref_token?: string;
2589
- wallet_express?: boolean;
2590
- };
2591
- };
2592
- }
2593
- interface WalletCallbackBody {
2594
- request_type: string;
2595
- }
2596
- interface WalletCallbackResponse {
2597
- id: string;
2598
- status: string;
2599
- callback_method: string;
2600
- callback_rel: string;
2601
- callback_url: string;
2602
- }
2603
- interface Standalone3dsProcessBody {
2604
- charge_3ds_id: string;
2605
- }
2606
-
2607
- declare class ApiCheckoutInternal {
2608
- protected api: ApiInternal;
2609
- constructor(api: ApiInternal);
2610
- instructions(): Observable<object>;
2611
- private getInstructionLink;
2612
- callback(payload: Object): Promise<Object>;
2613
- status(id: string): Promise<Object>;
2423
+ declare class ApiCheckoutInternal {
2424
+ protected api: ApiInternal;
2425
+ constructor(api: ApiInternal);
2426
+ instructions(): Observable<object>;
2427
+ private getInstructionLink;
2428
+ callback(payload: Object): Promise<Object>;
2429
+ status(id: string): Promise<Object>;
2614
2430
  }
2615
2431
 
2616
2432
  declare class ApiGatewayInternal {
@@ -2885,11 +2701,488 @@ declare const CANVAS_3DS_EVENT: {
2885
2701
  readonly DECOUPLED: "chargeAuthDecoupled";
2886
2702
  /** Challenge required — issuer demands user interaction. Payload: `Canvas3dsAuthPayload`. */
2887
2703
  readonly CHALLENGE: "chargeAuthChallenge";
2704
+ /**
2705
+ * Two-step mode only: fingerprint done, SDK waiting for `Canvas3ds.authenticate()`. Emitted once, before any
2706
+ * outcome event (`INFO` may precede it); never for a one-step charge. Payload: `Canvas3dsReadyPayload`.
2707
+ */
2708
+ readonly READY: "chargeAuthReady";
2709
+ /**
2710
+ * The challenge iframe fired its FIRST `load` after `chargeAuthChallenge` (the ACS page has painted),
2711
+ * or the `CHALLENGE_LOADED_FALLBACK_MS` safety fallback elapsed without one. Emitted exactly once per
2712
+ * challenge; never emitted for a decoupled challenge (no challenge iframe). Payload: `Canvas3dsChallengeLoadedPayload`.
2713
+ */
2714
+ readonly CHALLENGE_LOADED: "chargeAuthChallengeLoaded";
2715
+ /**
2716
+ * The issuer delivered the final authentication result to the 3DS Server (the shopper finished the
2717
+ * challenge, or approved a decoupled authentication) and the SDK is now obtaining the outcome. Emitted at
2718
+ * most once per authentication, always before the terminal event. Detected through the `secondary_url`
2719
+ * result monitor (`source: 'poll'`) or, when the callback message arrives first, right before the outcome
2720
+ * it carries (`source: 'callback'`). Payload: `Canvas3dsChallengeCompletedPayload`.
2721
+ */
2722
+ readonly CHALLENGE_COMPLETED: "chargeAuthChallengeCompleted";
2888
2723
  /** Informational signal emitted by the GPayments flow. Internal — not part of the public typed surface. */
2889
2724
  readonly INFO: "chargeAuthInfo";
2890
2725
  /** Error during the flow (network, parsing, etc.). Payload: `Canvas3dsErrorPayload`. */
2891
2726
  readonly ERROR: "error";
2892
2727
  };
2728
+ declare class GPaymentsService {
2729
+ protected container: Container;
2730
+ protected api: ApiInternal;
2731
+ protected eventEmitter: EventEmitter;
2732
+ /** Origins allowed to deliver a processed outcome (`process_status`) via postMessage. */
2733
+ protected trustedOrigins: string[];
2734
+ protected browserAndChallengeContainer: Container;
2735
+ protected iFrameAuthorization: IFrame;
2736
+ protected monitoringContainer: Container;
2737
+ protected iFrameSecondaryUrl?: IFrame;
2738
+ protected iFrameEvent: IFrameEvent;
2739
+ protected resultRead: boolean;
2740
+ /** `chargeAuthChallengeLoaded` already emitted for the current challenge (by `load` or by the fallback). */
2741
+ protected challengeLoadedEmitted: boolean;
2742
+ /** `chargeAuthChallengeCompleted` already emitted for the current authentication (poll or callback). */
2743
+ protected challengeCompletedEmitted: boolean;
2744
+ /** Set once a terminal event was emitted: no lifecycle event may follow (reset when a new challenge starts). */
2745
+ protected challengeLifecycleClosed: boolean;
2746
+ protected challengeLoadedTimer: ReturnType<typeof setTimeout> | null;
2747
+ protected resultPollTimer: ReturnType<typeof setTimeout> | null;
2748
+ /** One-shot guard for the `chargeAuth` leg — the callback message may be delivered more than once. */
2749
+ protected authHandled: boolean;
2750
+ /** Two-step mode: `charge_3ds_id` of the deferred callback message; `null` until it arrives (always for one-step). */
2751
+ protected deferredCharge3dsId: string | null;
2752
+ /** `authenticate()` latch; consumed when the deferred message arrives, reset only after a `/process` transport failure. */
2753
+ protected authenticateRequested: boolean;
2754
+ /** One `/process` call per widget instance (a transport failure allows one more `authenticate()`). */
2755
+ protected authenticationStarted: boolean;
2756
+ /** The single `/process` retry after a transport failure has been granted; the next failure is final. */
2757
+ protected authenticationRetryUsed: boolean;
2758
+ constructor(container: Container, api: ApiInternal, eventEmitter: EventEmitter,
2759
+ /** Origins allowed to deliver a processed outcome (`process_status`) via postMessage. */
2760
+ trustedOrigins?: string[]);
2761
+ load({ initialization_url, secondary_url, charge_3ds_id }: ITokenStandalone3DS, title: string): void;
2762
+ private initializeIFrames;
2763
+ private hideIframes;
2764
+ private setupIFrameEvents;
2765
+ /**
2766
+ * Two-step mode: run the deferred authentication (`POST /standalone-3ds/process`). Never throws: runs now if
2767
+ * the deferred message already arrived, otherwise as soon as it does; a no-op on one-step charges, repeated
2768
+ * calls or after a terminal outcome. The outcome flows through the usual events.
2769
+ */
2770
+ authenticate(): void;
2771
+ /**
2772
+ * Calls `/process` once per instance (reachable from both the deferred message and `authenticate()`). The
2773
+ * response has the callback-outcome shape, so the challenge / decoupled / result legs are shared with
2774
+ * one-step. A rejection surfaces as `error`, with the same error object shape as the one-step callback
2775
+ * (`toOutcomeError`). An API answer (stale session, rejected authentication…) is terminal. The first transport
2776
+ * failure is not: the AReq may have run with its response lost, so the latches are reset and the merchant may
2777
+ * call `authenticate()` once more — `/process` is idempotent and replays the stored outcome. A failure of that
2778
+ * retry, of any kind, is final.
2779
+ */
2780
+ private performAuthentication;
2781
+ /**
2782
+ * A message carries a processed outcome only when it has `process_status` AND comes from a trusted
2783
+ * origin. Used by the result leg: an untrusted `process_status` is never acted upon — the SDK falls
2784
+ * back to `GET /handle` (still needed for decoupled challenges / polling). The authentication leg
2785
+ * ignores untrusted senders outright, before this check.
2786
+ */
2787
+ private hasChainedOutcome;
2788
+ private isTrustedOrigin;
2789
+ private removeIframes;
2790
+ private clearChallengeLoadedTimer;
2791
+ /**
2792
+ * Challenge iframe lifecycle (`chargeAuthChallengeLoaded`).
2793
+ *
2794
+ * The challenge iframe is cross-origin, but its `load` event still fires when the ACS page finishes loading:
2795
+ * the first one means the page painted (merchants can drop their loader). A fallback timer
2796
+ * (`armChallengeLoadedFallback`) guarantees `chargeAuthChallengeLoaded` within `CHALLENGE_LOADED_FALLBACK_MS`
2797
+ * even if no `load` ever fires; a late paint after that is simply ignored. Later `load`s are NOT a usable
2798
+ * signal for "the shopper submitted": the post-submit hops are HTTP redirects and self-submitting pages whose
2799
+ * loads abort, and the final callback page posts its message before its own `load` — so the post-submit
2800
+ * moment is `chargeAuthChallengeCompleted`, driven by the `secondary_url` result monitor instead.
2801
+ *
2802
+ * Nothing is emitted once the flow reached a terminal outcome (`finishChallengeLifecycle`), and a
2803
+ * decoupled challenge (no challenge iframe) never emits `chargeAuthChallengeLoaded`.
2804
+ *
2805
+ * Resets the per-challenge state and returns the `load` handler to attach to the challenge iframe.
2806
+ */
2807
+ private startChallengeLifecycle;
2808
+ /**
2809
+ * Arms the `chargeAuthChallengeLoaded` fallback — only when a challenge iframe actually exists (the
2810
+ * container may be gone, or `IFrame.load` may have no-op'd on an already-present iframe).
2811
+ */
2812
+ private armChallengeLoadedFallback;
2813
+ private emitChallengeLoaded;
2814
+ /**
2815
+ * `chargeAuthChallengeCompleted` — once per authentication, never after a terminal event. Idempotent so the
2816
+ * poll and the callback message can both call it: the first transport to notice the issuer's result wins.
2817
+ */
2818
+ private emitChallengeCompleted;
2819
+ /** Call before emitting any terminal event: no lifecycle event may follow it, and the result poll stops. */
2820
+ private finishChallengeLifecycle;
2821
+ private stopResultPolling;
2822
+ private parseResultData;
2823
+ private parseHandleResponse;
2824
+ private parseError;
2825
+ private processResult;
2826
+ /** Final (post-challenge) outcome delivered by the API through the callback message. */
2827
+ private handleResultOutcome;
2828
+ private externalAPI;
2829
+ /**
2830
+ * Polls the GPayments result monitor (`secondary_url`) until `AuthResultReady`. It is the primary source of
2831
+ * `chargeAuthChallengeCompleted` (the monitor flips as soon as the issuer's RReq reaches the 3DS Server) and
2832
+ * the fallback transport for the outcome itself (`GET /handle`) when the callback message never arrives —
2833
+ * the only transport for decoupled challenges. Stops once an outcome was obtained or the lifecycle closed.
2834
+ * Transport failures are retried on the same cadence; an unparsable body or an unknown event is fatal.
2835
+ */
2836
+ private doPolling;
2837
+ /**
2838
+ * Branches on the authentication outcome — delivered by the API through the callback message
2839
+ * (`process_status` → `status`) or, in two-step mode, returned by `/process` (same shape).
2840
+ */
2841
+ private handleAuthenticationOutcome;
2842
+ }
2843
+
2844
+ /**
2845
+ * Decoded payload of the Standalone 3DS charge token (the JWT body) the SDK
2846
+ * receives in `Canvas3ds`'s constructor when the token format is `standalone_3ds`.
2847
+ *
2848
+ * This shape is set by the Paydock backend when minting the token. Integrators
2849
+ * who decode the token themselves can use this interface to type the result.
2850
+ */
2851
+ interface ITokenStandalone3DS {
2852
+ /** Optional merchant-side correlation identifier carried through from the original charge request. */
2853
+ external_id?: string;
2854
+ /** URL of the first iframe the SDK loads to bootstrap the 3DS provider's authentication flow. */
2855
+ initialization_url: string;
2856
+ /**
2857
+ * @deprecated No longer read by the Standalone 3DS flow. The field is kept
2858
+ * on the interface for backwards compatibility with tokens minted by older
2859
+ * API versions; it will be removed in a future major release. Prefer
2860
+ * `initialization_url` + `secondary_url`.
2861
+ */
2862
+ authorization_url?: string;
2863
+ /** Optional URL of a secondary iframe used by some providers (e.g. GPayments) for monitoring/polling alongside the main flow. */
2864
+ secondary_url?: string;
2865
+ /** The Paydock 3DS charge identifier this token authorizes. Echoed back in every event payload emitted during the flow. */
2866
+ charge_3ds_id: string;
2867
+ /** Identifier of the 3DS gateway the SDK should delegate to. Currently only `'GPayments'` is handled; other values fall through. */
2868
+ service_type: string;
2869
+ }
2870
+ declare class Standalone3dsService {
2871
+ protected container: Container;
2872
+ protected eventEmitter: EventEmitter;
2873
+ protected env: string;
2874
+ protected alias: string;
2875
+ /** Provider flow created by `load()`; `undefined` before it. */
2876
+ protected gpaymentsService?: GPaymentsService;
2877
+ constructor(container: Container, eventEmitter: any);
2878
+ load(token: string, options: {
2879
+ title: string;
2880
+ }): void;
2881
+ /**
2882
+ * Two-step mode: forwards `Canvas3ds.authenticate()` to the provider flow. Calling it before `load()` is an
2883
+ * integration bug (nothing to authenticate yet): it emits `error` and is not remembered.
2884
+ */
2885
+ authenticate(token: string): void;
2886
+ /** `charge_3ds_id` from the standalone 3DS charge token, `undefined` when it cannot be decoded. */
2887
+ private static readCharge3dsId;
2888
+ /**
2889
+ * Origins allowed to deliver a processed 3DS outcome to the page via postMessage: the Paydock API
2890
+ * (inline callback page) and the Paydock widget (remote-app landing page), for the current env/alias.
2891
+ */
2892
+ protected getTrustedMessageOrigins(api: ApiBase): string[];
2893
+ setEnv(env: string, alias?: string): void;
2894
+ }
2895
+
2896
+ /**
2897
+ * Payload emitted by the Standalone 3DS flow for auth-related events
2898
+ * (chargeAuthSuccess, chargeAuthReject, chargeAuthChallenge, chargeAuthDecoupled).
2899
+ */
2900
+ interface Canvas3dsAuthPayload {
2901
+ /** The Paydock 3DS charge identifier (e.g. `'chrg_3ds_xxxxx'`) used to correlate the authentication with the underlying charge. */
2902
+ charge_3ds_id: string;
2903
+ /** Authentication outcome status reported by the 3DS provider (e.g. `'authenticated'`, `'rejected'`, `'pending'`). */
2904
+ status: string;
2905
+ /** Optional result details. Present when the 3DS provider returns additional context for the outcome. */
2906
+ result?: {
2907
+ /** Human-readable description of the outcome (e.g. `'frictionless'`). */
2908
+ description?: string;
2909
+ };
2910
+ }
2911
+ /** Payload of `chargeAuthReady` (two-step Standalone 3DS only): fingerprint done, SDK waiting for `Canvas3ds.authenticate()`. */
2912
+ interface Canvas3dsReadyPayload {
2913
+ /** Paydock 3DS charge id of the deferred authentication. */
2914
+ charge_3ds_id: string;
2915
+ }
2916
+ /**
2917
+ * Payload of `chargeAuthChallengeLoaded` (Standalone 3DS, challenge flow only).
2918
+ * Emitted exactly once per challenge, after `chargeAuthChallenge`.
2919
+ */
2920
+ interface Canvas3dsChallengeLoadedPayload {
2921
+ /** The Paydock 3DS charge identifier the challenge belongs to. */
2922
+ charge_3ds_id: string;
2923
+ /**
2924
+ * `'load'` — the challenge iframe fired its first `load`: the ACS page has painted.
2925
+ * `'timeout'` — no `load` arrived within the SDK's 2.5 s safety fallback; the event is emitted anyway so a
2926
+ * loader is never held forever (the page may still be loading and will paint on its own). Useful for
2927
+ * analytics (how often the fallback fires) — you do not need to handle the two differently.
2928
+ */
2929
+ reason: 'load' | 'timeout';
2930
+ }
2931
+ /**
2932
+ * Payload of `chargeAuthChallengeCompleted` (Standalone 3DS, challenge and decoupled flows).
2933
+ * Emitted at most once per authentication, after the shopper finished the challenge (or approved a decoupled
2934
+ * authentication) and always before the terminal event.
2935
+ */
2936
+ interface Canvas3dsChallengeCompletedPayload {
2937
+ /** The Paydock 3DS charge identifier the authentication belongs to. */
2938
+ charge_3ds_id: string;
2939
+ /**
2940
+ * How the SDK learned that the issuer delivered the result:
2941
+ * `'poll'` — the 3DS Server's result monitor reported it (the usual case: it flips as soon as the issuer's
2942
+ * result reaches the 3DS Server, before the challenge iframe has even left the bank's page);
2943
+ * `'callback'` — the callback message carrying the outcome arrived first (the terminal event follows
2944
+ * immediately). Informational only — handle both the same way.
2945
+ */
2946
+ source: 'poll' | 'callback';
2947
+ }
2948
+ /**
2949
+ * Payload emitted by the Standalone 3DS flow for error events.
2950
+ * `error` is intentionally `unknown` — upstream emitters do not guarantee a shape.
2951
+ */
2952
+ interface Canvas3dsErrorPayload {
2953
+ /** The Paydock 3DS charge identifier associated with the failed authentication attempt. */
2954
+ charge_3ds_id: string;
2955
+ /** The underlying error. Typed as `unknown` to force the consumer to narrow it before use. */
2956
+ error: unknown;
2957
+ }
2958
+ /**
2959
+ * Payload emitted by the iframe-based 3DS flow for auth-related events
2960
+ * (`chargeAuth`, `chargeAuthSuccess`, `chargeAuthReject`).
2961
+ *
2962
+ * Extends `IEventData` with optional 3DS-specific fields that the widget
2963
+ * merges into the message envelope for charge correlation.
2964
+ */
2965
+ interface Canvas3dsChargeAuthEventPayload extends IEventData$1 {
2966
+ /** The Paydock 3DS charge identifier. Present when the widget correlates the event with a charge. */
2967
+ charge_3ds_id?: string;
2968
+ /** Authentication outcome status reported by the widget (e.g. `'authenticated'`, `'server_error'`). */
2969
+ status?: string;
2970
+ /** Optional result details forwarded from the 3DS provider. */
2971
+ result?: {
2972
+ /** Human-readable description of the outcome (e.g. `'frictionless'`). */
2973
+ description?: string;
2974
+ };
2975
+ }
2976
+ /**
2977
+ * Payload emitted by the iframe-based 3DS flow for error events.
2978
+ * Extends `IEventData` with optional 3DS-specific fields for charge correlation.
2979
+ */
2980
+ interface Canvas3dsErrorEventPayload extends IEventData$1 {
2981
+ /** The Paydock 3DS charge identifier associated with the error. */
2982
+ charge_3ds_id?: string;
2983
+ }
2984
+ /**
2985
+ * Maps Canvas3ds event names to their callback data types.
2986
+ *
2987
+ * Events that can fire from both the iframe (html/url) and standalone flows
2988
+ * use a union to accommodate both shapes. Standalone-only and iframe-only events
2989
+ * use a single payload type.
2990
+ */
2991
+ interface Canvas3dsEventMap {
2992
+ /** Successful authentication. Standalone path emits `Canvas3dsAuthPayload`; iframe path emits `Canvas3dsChargeAuthEventPayload`. Narrow with `'event' in data` for iframe vs standalone. */
2993
+ chargeAuthSuccess: Canvas3dsAuthPayload | Canvas3dsChargeAuthEventPayload;
2994
+ /** Rejected authentication. Same dual-emit pattern as `chargeAuthSuccess`. */
2995
+ chargeAuthReject: Canvas3dsAuthPayload | Canvas3dsChargeAuthEventPayload;
2996
+ /** Authentication or processing error. Standalone path emits `Canvas3dsErrorPayload`; iframe path emits `Canvas3dsErrorEventPayload`. */
2997
+ error: Canvas3dsErrorPayload | Canvas3dsErrorEventPayload;
2998
+ /** Challenge required — issuer demands user interaction (OTP, biometric, etc.). Standalone-only. */
2999
+ chargeAuthChallenge: Canvas3dsAuthPayload;
3000
+ /**
3001
+ * Two-step mode only (`_3ds.authentication_flow: 'two_step'`): the background fingerprint is done and the SDK waits for
3002
+ * `Canvas3ds.authenticate()`. Standalone-only; fires once, after `load()` and before any outcome event
3003
+ * (`chargeAuthInfo` may precede it); never fires for a one-step charge, nor for inbuilt 3DS (`html` / `url`)
3004
+ * tokens (no event at all for those).
3005
+ *
3006
+ * Pattern: `load()` in a hidden container when the review page opens, `authenticate()` on Pay (a call before
3007
+ * `chargeAuthReady` is remembered; one before `load()` emits `error`), reveal the container only on `chargeAuthChallenge`, finish on the outcome events.
3008
+ */
3009
+ chargeAuthReady: Canvas3dsReadyPayload;
3010
+ /**
3011
+ * The challenge iframe has painted (first `load`), or the 2.5 s fallback elapsed — see `reason`. Standalone-only,
3012
+ * challenge flow only (never emitted for decoupled challenges). Fires once, after `chargeAuthChallenge`.
3013
+ *
3014
+ * Recommended loader pattern: show a loader before the charge POST, keep it through `chargeAuthChallenge`,
3015
+ * reveal the challenge on this event, cover it with "Completing verification" on `chargeAuthChallengeCompleted`,
3016
+ * and finish on `chargeAuthSuccess` / `chargeAuthReject` / `error`.
3017
+ */
3018
+ chargeAuthChallengeLoaded: Canvas3dsChallengeLoadedPayload;
3019
+ /**
3020
+ * The shopper finished the challenge (or approved a decoupled authentication): the issuer delivered the final
3021
+ * result to the 3DS Server and the SDK is obtaining the outcome. Cover the challenge iframe with your own
3022
+ * "Completing verification" state — whatever the bank or the 3DS Server render from here on is plumbing, not
3023
+ * UX. Standalone-only. Fires at most once per authentication, always before `chargeAuthSuccess` /
3024
+ * `chargeAuthReject` / `error`, and never after them. A wrong OTP or a further interactive step does NOT fire
3025
+ * it (no result has been delivered yet), so no grace timer or reveal fallback is needed on your side.
3026
+ */
3027
+ chargeAuthChallengeCompleted: Canvas3dsChallengeCompletedPayload;
3028
+ /** Decoupled authentication — issuer will authenticate out-of-band and notify later. Standalone-only. */
3029
+ chargeAuthDecoupled: Canvas3dsAuthPayload;
3030
+ /** Iframe-path authentication event. Extends `IEventData` with optional 3DS correlation fields (`charge_3ds_id`, `status`). */
3031
+ chargeAuth: Canvas3dsChargeAuthEventPayload;
3032
+ /** User cancelled the authentication flow before completion. Iframe-only. */
3033
+ chargeAuthCancelled: IEventData$1;
3034
+ /** Additional data collection step completed successfully. Iframe-only. */
3035
+ additionalDataCollectSuccess: IEventData$1;
3036
+ /** Additional data collection step was rejected. Iframe-only. */
3037
+ additionalDataCollectReject: IEventData$1;
3038
+ }
3039
+ /** Union of all known Canvas3ds event names. */
3040
+ type Canvas3dsEventName = keyof Canvas3dsEventMap;
3041
+ /**
3042
+ * Public, tree-shakeable alias for the internal `TOKEN_FORMAT` enum in canvas-3ds.ts.
3043
+ * Mirrors the string values of that enum without exposing the private enum itself.
3044
+ */
3045
+ declare const Canvas3dsTokenFormat: {
3046
+ /** Token whose `content` is a complete HTML page. The SDK renders it inside an iframe. */
3047
+ readonly HTML: "html";
3048
+ /** Token whose `content` is a URL. The SDK loads it inside an iframe. */
3049
+ readonly URL: "url";
3050
+ /** Token whose `content` describes a standalone 3DS service (e.g. GPayments). The SDK delegates to that service's flow. */
3051
+ readonly STANDALONE_3DS: "standalone_3ds";
3052
+ };
3053
+ type Canvas3dsTokenFormat = (typeof Canvas3dsTokenFormat)[keyof typeof Canvas3dsTokenFormat];
3054
+
3055
+ /**
3056
+ * List of available token's content formats
3057
+ * @enum TOKEN_FORMAT
3058
+ *
3059
+ * @type {object}
3060
+ * @param {string} HTML=html
3061
+ */
3062
+ declare enum TOKEN_FORMAT {
3063
+ HTML = "html",
3064
+ URL = "url",
3065
+ STANDALONE_3DS = "standalone_3ds"
3066
+ }
3067
+ /**
3068
+ * List of available event's name
3069
+ * @const EVENT
3070
+ *
3071
+ * @type {object}
3072
+ * @param {string} CHARGE_AUTH_SUCCESS=chargeAuthSuccess
3073
+ * @param {string} CHARGE_AUTH_REJECT=chargeAuthReject
3074
+ * @param {string} ADDITIONAL_DATA_SUCCESS=additionalDataCollectSuccess
3075
+ * @param {string} ADDITIONAL_DATA_REJECT=additionalDataCollectReject
3076
+ * @param {string} CHARGE_AUTH=chargeAuth
3077
+ */
3078
+ /**
3079
+ * List of available event's name for Standalone 3ds flow
3080
+ * @const STANDALONE_3DS_EVENT
3081
+ *
3082
+ * @type {object}
3083
+ * @param {string} AUTH_SUCCESS=chargeAuthSuccess
3084
+ * @param {string} AUTH_ERROR=chargeAuthReject
3085
+ * @param {string} DECOUPLED=chargeAuthDecoupled
3086
+ * @param {string} CHALLENGE=chargeAuthChallenge
3087
+ * @param {string} READY=chargeAuthReady - two-step mode only: fingerprint done, waiting for `authenticate()`
3088
+ * @param {string} CHALLENGE_LOADED=chargeAuthChallengeLoaded - challenge iframe painted (first `load`, or 2.5 s fallback); reveal your challenge UI here
3089
+ * @param {string} CHALLENGE_COMPLETED=chargeAuthChallengeCompleted - the shopper finished the challenge (issuer result delivered to the 3DS Server); cover the challenge iframe with your own loader until the terminal event
3090
+ * @param {string} INFO=chargeAuthInfo
3091
+ * @param {string} ERROR=error
3092
+ */
3093
+ /**
3094
+ * Class Canvas3ds include method for working on html
3095
+ * @constructor
3096
+ *
3097
+ * @param {string} selector - Selector of html element. Container for widget
3098
+ * @param {string} token - Pre authorized token
3099
+ * @example
3100
+ * var widget = new Canvas3ds('#widget', 'token');
3101
+ *
3102
+ *
3103
+ */
3104
+ declare class Canvas3ds {
3105
+ protected link: Link;
3106
+ protected configs: Configuration[];
3107
+ protected publicKey: string;
3108
+ protected token: {
3109
+ content: string;
3110
+ format: TOKEN_FORMAT;
3111
+ charge_3ds_id: string;
3112
+ };
3113
+ protected standalone3dsService: Standalone3dsService;
3114
+ protected container: Container;
3115
+ protected iFrame: IFrame;
3116
+ protected event: IFrameEvent;
3117
+ protected eventEmitter: EventEmitter;
3118
+ /** @constructs */ constructor(selector: string, token: string);
3119
+ protected static extractToken(token: string): {
3120
+ content: string;
3121
+ format: TOKEN_FORMAT;
3122
+ charge_3ds_id: string;
3123
+ };
3124
+ /**
3125
+ * The final method to beginning, the load process of widget to html
3126
+ *
3127
+ */
3128
+ load(): void;
3129
+ /**
3130
+ * Current method can change environment. By default environment = sandbox.
3131
+ * Also we can change domain alias for this environment. By default domain_alias = paydock.com
3132
+ *
3133
+ * @example
3134
+ * widget.setEnv('production');
3135
+ * @param {string} env - sandbox, production
3136
+ * @param {string} [alias] - Own domain alias
3137
+ */
3138
+ setEnv(env: string, alias?: string): void;
3139
+ getEnv(): string;
3140
+ on<E extends keyof Canvas3dsEventMap>(eventName: E, cb: (data: Canvas3dsEventMap[E]) => void): void;
3141
+ on<E extends keyof Canvas3dsEventMap>(eventName: E): Promise<Canvas3dsEventMap[E]>;
3142
+ on(eventName: string, cb: (data: IEventData$1) => void): void;
3143
+ on(eventName: string): Promise<IEventData$1>;
3144
+ /**
3145
+ * Two-step mode only (`_3ds.authentication_flow: 'two_step'`): runs the authentication the API deferred after the
3146
+ * fingerprint. Call it when the shopper confirms (e.g. presses "Pay"); the outcome arrives through the
3147
+ * usual events (`chargeAuthChallenge`, `chargeAuthSuccess`, `chargeAuthReject`, `error`).
3148
+ *
3149
+ * Never throws. After `chargeAuthReady` the authentication starts at once; before it, the call is
3150
+ * remembered and runs as soon as the fingerprint completes. One-step charges, repeated calls and calls after
3151
+ * a terminal outcome are no-ops. For inbuilt 3DS (`html` / `url`) tokens it is a silent no-op: no event is
3152
+ * emitted at all, so do not wait for `error` there. Calling it before `load()` is an integration error: it emits `error` and
3153
+ * is not remembered. If `/process` could not be reached (`error` with `error_code` `service_unreachable` /
3154
+ * `aborted`), `authenticate()` may be called once more; any other `error`, and any failure of that retry,
3155
+ * is final.
3156
+ * No client-side deadline: a stale 3DS Server session surfaces as `error` / `chargeAuthReject`.
3157
+ *
3158
+ * @example
3159
+ * const widget = new Canvas3ds('#widget', token); // charge created with _3ds.authentication_flow: 'two_step'
3160
+ * widget.on('chargeAuthReady', () => payButton.disabled = false);
3161
+ * widget.on('chargeAuthChallenge', () => showChallengeModal());
3162
+ * widget.on('chargeAuthSuccess', (data) => completePayment(data.charge_3ds_id));
3163
+ * widget.on('chargeAuthReject', () => showDeclined());
3164
+ * widget.on('error', () => showError());
3165
+ * widget.load(); // fingerprint runs while the shopper reviews the order
3166
+ *
3167
+ * payButton.addEventListener('click', () => widget.authenticate());
3168
+ */
3169
+ authenticate(): void;
3170
+ /**
3171
+ * Using this method you can hide widget after load
3172
+ * @param {boolean} [saveSize=false] - using this param you can save iframe's size
3173
+ */
3174
+ hide(saveSize: boolean): void;
3175
+ /**
3176
+ * Using this method you can show widget after using hide method
3177
+ *
3178
+ */
3179
+ show(): void;
3180
+ /**
3181
+ * Using this method you can reload widget
3182
+ *
3183
+ */
3184
+ reload(): void;
3185
+ }
2893
3186
 
2894
3187
  /**
2895
3188
  * Payload emitted by `Checkout.onPaymentSuccessful`.
@@ -7439,5 +7732,5 @@ declare global {
7439
7732
  }
7440
7733
  }
7441
7734
 
7442
- export { AfterpayCheckoutButton, AfterpayOnSiteMessaging, Api, ApplePayOpenWalletButton, ApplePayWalletButtonExpress, CANVAS_3DS_EVENT, CHECKOUT_BUTTON_EVENT, EVENT$2 as CHECKOUT_EVENT, Canvas3ds, Canvas3dsTokenFormat, Checkout, CheckoutActionCode, ClickToPay, Configuration, ContactShippingEditingMode, ELEMENT, ERROR_OPERATION, EVENT$3 as EVENT, Builder$1 as ExternalCheckoutBuilder, Checker as ExternalCheckoutChecker, FORM_FIELD, FRAUD_PREVENTION_EVENTS, FraudPreventionService, GooglePayOpenWalletButton, HtmlMultiWidget, HtmlPaymentSourceWidget, HtmlWidget, InstructionDebugger, MultiWidget, OpenWalletButtons, PAYMENT_EXPIRED, PAYMENT_FAILURE, PAYMENT_SUCCESSFUL, PAYMENT_TYPE, PURPOSE, PayPalDataCollector, PayPalSavePaymentSourceWidget, Builder as PaymentSourceBuilder, PaymentSourceWidget, PaypalCheckoutButton, PaypalWalletButtonExpress, STYLABLE_ELEMENT, STYLABLE_ELEMENT_STATE, STYLE, SUPPORTED_CARD_TYPES, TEXT, TOKEN_TYPE, TRIGGER, TYPE, VAULT_DISPLAY_STYLE, VaultDisplayWidget, EVENT as WALLET_BUTTONS_EXPRESS_EVENT, WALLET_TYPES, WalletButtons, ZipmoneyCheckoutButton };
7443
- export type { ApplePayAvailabilityOptions, ApplePayAvailabilityResult, ApplePayButtonStyle, ApplePayButtonType, ApplePayCapabilityToken, ApplePayCredentialStatus, ApplePayOpenWalletMeta, ApplePayWalletMeta, AppleShippingType, BaseWalletMeta, Billing, Canvas3dsAuthPayload, Canvas3dsChargeAuthEventPayload, Canvas3dsErrorEventPayload, Canvas3dsErrorPayload, Canvas3dsEventMap, Canvas3dsEventName, CheckoutIntentTokenPayload, CheckoutPaymentExpiredPayload, CheckoutPaymentFailurePayload, CheckoutPaymentSuccessPayload, CheckoutResponse, CreateOTTData, CreateOTTRequest, CreateOTTResponse, CreateSessionRequest, CreateSessionResponse, EventTypes, FraudPreventionEvent, FraudPreventionEventType, FraudPreventionProvider, GooglePayAvailabilityOptions, GooglePayAvailabilityResult, GooglePayCardConfig, GooglePayOpenWalletMeta, GooglePayOpenWalletMetaStyles, HandleResponseInterface, IApplePayShippingOption, ICheckout, IClickToPayMeta, IDetails, IElementStyleInput, IEventAfterLoadData, IEventCheckoutFinishData, IEventData$1 as IEventData, IEventError, IEventFinishData, IEventMetaData, IEventSizeData, IFormValidation, IOpenWalletProvider, IPayPalMeta, IStyles$1 as IStyles, ITexts, ITokenStandalone3DS, IWalletMeta, IWalletOnClickEvent, IWalletPaymentSuccessfulEvent, IWalletUnavailableEvent, IWalletUpdateData, IWalletUpdateEvent, OTTResponse, OnCancelEventData, OnClickEventData$1 as OnClickEventData, OnCreateOTTErrorEventData, OnCreateOTTErrorPayload, OnCreateOTTSuccessPayload, OnCreateOTTSuccessfulEventData, OnErrorEventData$1 as OnErrorEventData, OnErrorPayload, OnLoadedEventData, OnUnavailableDetails, OnUnavailableEventData$1 as OnUnavailableEventData, OnUnavailablePayload, OpenWalletAvailabilityOptions, OpenWalletAvailabilityResult, OpenWalletBaseEvent, OpenWalletDataEvent, OpenWalletEventType, OpenWalletMeta, PaypalWalletMeta, ProcessAuthenticationResponse, Shipping, VaultDisplayStyle, OnClickEventData as WalletExpressOnClickEventData, OnCloseEventData as WalletExpressOnCloseEventData, OnErrorEventData as WalletExpressOnErrorEventData, OnPaymentErrorEventData as WalletExpressOnPaymentErrorEventData, OnPaymentInReviewEventData as WalletExpressOnPaymentInReviewEventData, OnPaymentSuccessfulEventData as WalletExpressOnPaymentSuccessfulEventData, OnShippingAddressChangeEventData as WalletExpressOnShippingAddressChangeEventData, OnShippingAddressChangeEventResponse as WalletExpressOnShippingAddressChangeEventResponse, OnShippingOptionChangeEventData as WalletExpressOnShippingOptionChangeEventData, OnShippingOptionChangeEventResponse as WalletExpressOnShippingOptionChangeEventResponse, OnUnavailableEventData as WalletExpressOnUnavailableEventData, WalletType, WidgetEventMap, WidgetEventName };
7735
+ export { AfterpayCheckoutButton, AfterpayOnSiteMessaging, Api, ApplePayOpenWalletButton, ApplePayWalletButtonExpress, CANVAS_3DS_EVENT, CARD_SCHEME, CHECKOUT_BUTTON_EVENT, EVENT$2 as CHECKOUT_EVENT, Canvas3ds, Canvas3dsTokenFormat, Checkout, CheckoutActionCode, ClickToPay, Configuration, ContactShippingEditingMode, ELEMENT, ERROR_OPERATION, EVENT$3 as EVENT, Builder$1 as ExternalCheckoutBuilder, Checker as ExternalCheckoutChecker, FORM_FIELD, FRAUD_PREVENTION_EVENTS, FraudPreventionService, GooglePayOpenWalletButton, HtmlMultiWidget, HtmlPaymentSourceWidget, HtmlWidget, InstructionDebugger, MultiWidget, OpenWalletButtons, PAYMENT_EXPIRED, PAYMENT_FAILURE, PAYMENT_SUCCESSFUL, PAYMENT_TYPE, PURPOSE, PayPalDataCollector, PayPalSavePaymentSourceWidget, Builder as PaymentSourceBuilder, PaymentSourceWidget, PaypalCheckoutButton, PaypalWalletButtonExpress, STYLABLE_ELEMENT, STYLABLE_ELEMENT_STATE, STYLE, SUPPORTED_CARD_TYPES, TEXT, TOKEN_TYPE, TRIGGER, TYPE, VAULT_DISPLAY_STYLE, VaultDisplayWidget, EVENT as WALLET_BUTTONS_EXPRESS_EVENT, WALLET_TYPES, WalletButtons, ZipmoneyCheckoutButton };
7736
+ export type { ApplePayAvailabilityOptions, ApplePayAvailabilityResult, ApplePayButtonStyle, ApplePayButtonType, ApplePayCapabilityToken, ApplePayCredentialStatus, ApplePayOpenWalletMeta, ApplePayWalletMeta, AppleShippingType, BaseWalletMeta, Billing, Canvas3dsAuthPayload, Canvas3dsChallengeCompletedPayload, Canvas3dsChallengeLoadedPayload, Canvas3dsChargeAuthEventPayload, Canvas3dsErrorEventPayload, Canvas3dsErrorPayload, Canvas3dsEventMap, Canvas3dsEventName, Canvas3dsReadyPayload, CheckoutIntentTokenPayload, CheckoutPaymentExpiredPayload, CheckoutPaymentFailurePayload, CheckoutPaymentSuccessPayload, CheckoutResponse, CreateOTTData, CreateOTTRequest, CreateOTTResponse, CreateSessionRequest, CreateSessionResponse, EventTypes, FraudPreventionEvent, FraudPreventionEventType, FraudPreventionProvider, GooglePayAvailabilityOptions, GooglePayAvailabilityResult, GooglePayCardConfig, GooglePayOpenWalletMeta, GooglePayOpenWalletMetaStyles, HandleResponseInterface, IApplePayShippingOption, ICheckout, IClickToPayMeta, IDetails, IElementStyleInput, IEventAfterLoadData, IEventCheckoutFinishData, IEventData$1 as IEventData, IEventError, IEventFinishData, IEventMetaData, IEventSizeData, IFormValidation, IOpenWalletProvider, IPayPalMeta, IStyles$1 as IStyles, ITexts, ITokenStandalone3DS, IWalletMeta, IWalletOnClickEvent, IWalletPaymentSuccessfulEvent, IWalletUnavailableEvent, IWalletUpdateData, IWalletUpdateEvent, OTTResponse, OnCancelEventData, OnClickEventData$1 as OnClickEventData, OnCreateOTTErrorEventData, OnCreateOTTErrorPayload, OnCreateOTTSuccessPayload, OnCreateOTTSuccessfulEventData, OnErrorEventData$1 as OnErrorEventData, OnErrorPayload, OnLoadedEventData, OnUnavailableDetails, OnUnavailableEventData$1 as OnUnavailableEventData, OnUnavailablePayload, OpenWalletAvailabilityOptions, OpenWalletAvailabilityResult, OpenWalletBaseEvent, OpenWalletDataEvent, OpenWalletEventType, OpenWalletMeta, PaypalWalletMeta, ProcessAuthenticationResponse, Shipping, VaultDisplayStyle, OnClickEventData as WalletExpressOnClickEventData, OnCloseEventData as WalletExpressOnCloseEventData, OnErrorEventData as WalletExpressOnErrorEventData, OnPaymentErrorEventData as WalletExpressOnPaymentErrorEventData, OnPaymentInReviewEventData as WalletExpressOnPaymentInReviewEventData, OnPaymentSuccessfulEventData as WalletExpressOnPaymentSuccessfulEventData, OnShippingAddressChangeEventData as WalletExpressOnShippingAddressChangeEventData, OnShippingAddressChangeEventResponse as WalletExpressOnShippingAddressChangeEventResponse, OnShippingOptionChangeEventData as WalletExpressOnShippingOptionChangeEventData, OnShippingOptionChangeEventResponse as WalletExpressOnShippingOptionChangeEventResponse, OnUnavailableEventData as WalletExpressOnUnavailableEventData, WalletType, WidgetEventMap, WidgetEventName };