@funnelfox/billing 0.12.0 → 0.13.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/dist/chunk-index.cjs.js +679 -8
- package/dist/chunk-index.es.js +679 -8
- package/dist/funnelfox-billing.js +679 -8
- package/dist/funnelfox-billing.min.js +1 -1
- package/package.json +2 -2
- package/src/types.d.ts +82 -2
package/src/types.d.ts
CHANGED
|
@@ -456,13 +456,90 @@ export declare function initMethod(
|
|
|
456
456
|
options: InitMethodOptions
|
|
457
457
|
): Promise<PaymentMethodInterface>;
|
|
458
458
|
|
|
459
|
-
export
|
|
459
|
+
export interface SilentPurchaseOptions {
|
|
460
460
|
priceId: string;
|
|
461
461
|
externalId: string;
|
|
462
462
|
clientMetadata: Record<string, string | number | boolean>;
|
|
463
463
|
orgId: string;
|
|
464
464
|
baseUrl: string;
|
|
465
|
-
|
|
465
|
+
/** CIT pass-through (sent only when set). Omitted = funnel/org setting. */
|
|
466
|
+
initiationType?: 'cit' | 'mit';
|
|
467
|
+
/** CIT card networks (sent only when set). `[]` = all networks. */
|
|
468
|
+
citCardNetworks?: string[];
|
|
469
|
+
/** Allow CIT for PAN_ONLY Google Pay (sent only when set). */
|
|
470
|
+
citGooglePayPanOnly?: boolean;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/** Result of the 3DS step of a one-click purchase, passed to `onThreeDSEnd`. */
|
|
474
|
+
export type ThreeDSResult = 'passed' | 'failed' | 'abandoned' | 'error';
|
|
475
|
+
|
|
476
|
+
export interface SilentPurchaseDetailedOptions extends SilentPurchaseOptions {
|
|
477
|
+
/** Opt-in: run 3DS when the bank asks for it and resolve with a detailed result. */
|
|
478
|
+
handle3DS: true;
|
|
479
|
+
/**
|
|
480
|
+
* Fired once when the one-click response carries a non-empty `action_required_token`,
|
|
481
|
+
* before the challenge (keep the upsell button disabled until the promise resolves).
|
|
482
|
+
*/
|
|
483
|
+
onThreeDSStart?: (info: { orderId: string }) => void;
|
|
484
|
+
/** Fired exactly once per `onThreeDSStart`, after the 3DS step and before the promise resolves. */
|
|
485
|
+
onThreeDSEnd?: (info: { result: ThreeDSResult }) => void;
|
|
486
|
+
/**
|
|
487
|
+
* Give up on the 3DS step after this many ms. Default 600000. Resolves `3ds_abandoned` if the
|
|
488
|
+
* challenge was shown; `error` if it ran out before the challenge was shown (with
|
|
489
|
+
* `failedRequest: 'create_client_session'` while that request was pending). Never aborts a
|
|
490
|
+
* request that is already sent.
|
|
491
|
+
*/
|
|
492
|
+
threeDSTimeoutMs?: number;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
export type OneClickOutcome =
|
|
496
|
+
| 'succeeded'
|
|
497
|
+
| 'declined'
|
|
498
|
+
| '3ds_failed'
|
|
499
|
+
| '3ds_abandoned'
|
|
500
|
+
| 'error'
|
|
501
|
+
| 'processing'
|
|
502
|
+
| 'already_purchased';
|
|
503
|
+
|
|
504
|
+
/** The request that failed, set only on request failures. */
|
|
505
|
+
export type OneClickFailedRequest =
|
|
506
|
+
| 'one_click'
|
|
507
|
+
| 'create_client_session'
|
|
508
|
+
| 'resume_payment';
|
|
509
|
+
|
|
510
|
+
export interface OneClickResult {
|
|
511
|
+
outcome: OneClickOutcome;
|
|
512
|
+
/** `null` only when no order was created (error before/at one_click). */
|
|
513
|
+
orderId: string | null;
|
|
514
|
+
/** The backend returned a non-empty `action_required_token`. */
|
|
515
|
+
threeDSChallenged: boolean;
|
|
516
|
+
failedMessageForUser?: string | null;
|
|
517
|
+
declineCode?: string | null;
|
|
518
|
+
declineCodeSource?: DeclineCodeSource | null;
|
|
519
|
+
/**
|
|
520
|
+
* Request failures: the original `APIError` (`statusCode`, `errorCode`, `response`) or
|
|
521
|
+
* `NetworkError` instance, unwrapped. `PrimerError` for Primer-side failures;
|
|
522
|
+
* `FunnefoxSDKError` for the in-flight guard and unsupported responses.
|
|
523
|
+
*/
|
|
524
|
+
error?: Error;
|
|
525
|
+
failedRequest?: OneClickFailedRequest;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* One-click purchase with the customer's saved payment method.
|
|
530
|
+
* Legacy mode (no `handle3DS`): resolves `true` for any 2xx `status: 'success'` response
|
|
531
|
+
* (including declines), `false` otherwise; rejects on HTTP errors. Does not run 3DS.
|
|
532
|
+
*/
|
|
533
|
+
export declare function silentPurchase(
|
|
534
|
+
options: SilentPurchaseOptions & { handle3DS?: false }
|
|
535
|
+
): Promise<boolean>;
|
|
536
|
+
/**
|
|
537
|
+
* Detailed mode (`handle3DS: true`): runs the Primer 3DS challenge when the bank asks for it
|
|
538
|
+
* and resolves with a `OneClickResult`. Rejects only with `ValidationError` on invalid options.
|
|
539
|
+
*/
|
|
540
|
+
export declare function silentPurchase(
|
|
541
|
+
options: SilentPurchaseDetailedOptions
|
|
542
|
+
): Promise<OneClickResult>;
|
|
466
543
|
|
|
467
544
|
export declare function getAvailablePaymentMethods(params: {
|
|
468
545
|
countryCode?: string;
|
|
@@ -732,4 +809,7 @@ export interface OneClickRequest {
|
|
|
732
809
|
pp_ident: string;
|
|
733
810
|
external_id: string;
|
|
734
811
|
client_metadata: Record<string, string | number | boolean>;
|
|
812
|
+
initiation_type?: 'cit' | 'mit';
|
|
813
|
+
cit_card_networks?: string[];
|
|
814
|
+
cit_google_pay_pan_only?: boolean;
|
|
735
815
|
}
|