@invonetwork/web-sdk 2.5.0 → 3.0.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 +71 -0
- package/README.md +28 -31
- package/dist/{chunk-ZKYUSYK5.js → chunk-SPTYWJDN.js} +12 -4
- package/dist/index.cjs +77 -159
- package/dist/index.d.cts +19 -31
- package/dist/index.d.ts +19 -31
- package/dist/index.js +69 -159
- package/dist/server.cjs +57 -47
- package/dist/server.d.cts +18 -9
- package/dist/server.d.ts +18 -9
- package/dist/server.js +49 -47
- package/dist/{types-g1xz5GDk.d.cts → types-DMNXAGiw.d.cts} +49 -113
- package/dist/{types-g1xz5GDk.d.ts → types-DMNXAGiw.d.ts} +49 -113
- package/package.json +1 -1
|
@@ -117,6 +117,9 @@ declare class InvoError extends Error {
|
|
|
117
117
|
/** True if a Platform Commerce CARD purchase was below the processor's floor of $0.50
|
|
118
118
|
* (backend code `BELOW_STRIPE_MINIMUM`, 400). Neutral name; matches the wire code. */
|
|
119
119
|
get isBelowCardMinimum(): boolean;
|
|
120
|
+
/** True if a Platform Commerce CARD purchase exceeded the hosted checkout's single-charge
|
|
121
|
+
* cap of $999.99 (`ABOVE_CARD_MAXIMUM`, 400) — split the sale or lower the amount. */
|
|
122
|
+
get isAboveCardMaximum(): boolean;
|
|
120
123
|
/**
|
|
121
124
|
* True if a Platform Commerce refund targeted an order that was already refunded
|
|
122
125
|
* (409). Idempotent outcome — the original refund did happen, so treat this as
|
|
@@ -254,13 +257,6 @@ interface ClientConfig extends InvoConfig {
|
|
|
254
257
|
* is retried once with the new token, and the client keeps using it thereafter.
|
|
255
258
|
*/
|
|
256
259
|
refreshToken?: () => Promise<string> | string;
|
|
257
|
-
/**
|
|
258
|
-
* Optional. The card processor's PUBLISHABLE key (public — safe in the browser),
|
|
259
|
-
* used as the default for `platformCommerce.confirmCardPayment` /
|
|
260
|
-
* `mountCardPayment` when a per-call `publishableKey` isn't given. This is the
|
|
261
|
-
* Platform Commerce CARD leg only; the passkey/token flows never use it.
|
|
262
|
-
*/
|
|
263
|
-
commercePublishableKey?: string;
|
|
264
260
|
}
|
|
265
261
|
interface PlayerToken {
|
|
266
262
|
token: string;
|
|
@@ -411,19 +407,9 @@ interface ItemOrderQuery {
|
|
|
411
407
|
/** How a Platform Commerce purchase is funded. Server-resolved under lock — the client
|
|
412
408
|
* can request it, but the backend verifies the actual balance before value moves. */
|
|
413
409
|
type FundingSource = "balance" | "card";
|
|
414
|
-
/** Billing address — REQUIRED on the card leg (AVS / fraud / merchant-of-record records). */
|
|
415
|
-
interface BillingAddress {
|
|
416
|
-
line1: string;
|
|
417
|
-
city: string;
|
|
418
|
-
postalCode: string;
|
|
419
|
-
/** 2-letter ISO country code, e.g. "US". */
|
|
420
|
-
country: string;
|
|
421
|
-
name?: string;
|
|
422
|
-
line2?: string;
|
|
423
|
-
state?: string;
|
|
424
|
-
}
|
|
425
410
|
interface PlatformPurchaseInput {
|
|
426
|
-
/** Idempotency key, unique per tenant. Required.
|
|
411
|
+
/** Idempotency key, unique per tenant. Required. Balance leg: a duplicate returns 409.
|
|
412
|
+
* Card leg: a duplicate REPLAYS the same checkout session (`idempotentReplay: true`). */
|
|
427
413
|
clientRequestId: string;
|
|
428
414
|
/** "balance" (spend held INVO currency) or "card" (pay by card — new money). Required;
|
|
429
415
|
* server-validated. */
|
|
@@ -437,23 +423,29 @@ interface PlatformPurchaseInput {
|
|
|
437
423
|
/** Price PER UNIT. > 0. On the CARD leg this is USD; on the BALANCE leg it is the
|
|
438
424
|
* tenant's network-currency amount. */
|
|
439
425
|
unitPrice: string | number;
|
|
440
|
-
/** Must equal unitPrice × itemQuantity (±0.01). USD on the card leg
|
|
441
|
-
* on the balance leg. */
|
|
426
|
+
/** Must equal unitPrice × itemQuantity (±0.01). USD on the card leg (min $0.50,
|
|
427
|
+
* max $999.99); network currency on the balance leg. */
|
|
442
428
|
totalPrice: string | number;
|
|
443
429
|
playerPhone?: string;
|
|
444
430
|
itemDescription?: string;
|
|
445
431
|
itemCategory?: string;
|
|
446
|
-
/**
|
|
447
|
-
|
|
432
|
+
/** Card leg only: where INVO's hosted checkout sends the buyer after payment. */
|
|
433
|
+
successUrl?: string;
|
|
434
|
+
/** Card leg only: where the hosted checkout sends the buyer on cancel. */
|
|
435
|
+
cancelUrl?: string;
|
|
436
|
+
/** Card leg only: your correlation object, echoed back on the webhook. */
|
|
437
|
+
metadata?: Record<string, unknown>;
|
|
448
438
|
}
|
|
449
|
-
/** "success" → BALANCE leg settled synchronously. "requires_payment" → CARD leg:
|
|
450
|
-
* `
|
|
439
|
+
/** "success" → BALANCE leg settled synchronously. "requires_payment" → CARD leg: send
|
|
440
|
+
* the buyer to `checkoutUrl` (INVO's hosted checkout page). */
|
|
451
441
|
type PlatformPurchaseStatus = "success" | "requires_payment";
|
|
452
442
|
interface PlatformPurchaseResult {
|
|
453
|
-
/** "success" (balance settled) | "requires_payment" (card —
|
|
443
|
+
/** "success" (balance settled) | "requires_payment" (card — send the buyer to `checkoutUrl`). */
|
|
454
444
|
status: string;
|
|
455
445
|
fundingSource: string;
|
|
456
|
-
|
|
446
|
+
/** Balance leg only — the card leg creates the order lazily on the verified payment,
|
|
447
|
+
* so `requires_payment` responses carry a `sessionId` instead. */
|
|
448
|
+
orderId?: string | number;
|
|
457
449
|
transactionId?: string;
|
|
458
450
|
/** Canonical balance AFTER the debit (balance leg). */
|
|
459
451
|
newBalance?: string | number | null;
|
|
@@ -461,9 +453,17 @@ interface PlatformPurchaseResult {
|
|
|
461
453
|
currencyName?: string;
|
|
462
454
|
/** { total_paid, developer_revenue, platform_fee } when present. */
|
|
463
455
|
financialBreakdown?: Record<string, unknown>;
|
|
464
|
-
/**
|
|
465
|
-
|
|
456
|
+
/** The hosted-checkout session id. Present on the card leg. */
|
|
457
|
+
sessionId?: string;
|
|
458
|
+
/** Send the buyer here (redirect, or `InvoClient.platformCommerce.mountCheckout`).
|
|
459
|
+
* INVO's hosted page owns the card form, wallets, billing address, and 3-D Secure. */
|
|
460
|
+
checkoutUrl?: string;
|
|
461
|
+
/** Unix seconds when the checkout session expires. Present on the card leg. */
|
|
462
|
+
expiresAt?: number;
|
|
466
463
|
amountUsd?: string | number | null;
|
|
464
|
+
/** True when this response REPLAYED an existing session for the same
|
|
465
|
+
* `clientRequestId` (safe retry — same URL, never a second charge). */
|
|
466
|
+
idempotentReplay?: boolean;
|
|
467
467
|
raw: Record<string, unknown>;
|
|
468
468
|
}
|
|
469
469
|
interface PlatformOrderStatusResult {
|
|
@@ -497,93 +497,29 @@ interface PlatformRefundResult {
|
|
|
497
497
|
* currency; the refund response carries no unit, so this is `undefined` there
|
|
498
498
|
* (the `platform_commerce.refunded` webhook is authoritative for the unit). */
|
|
499
499
|
amountUnit?: string;
|
|
500
|
+
/** Balance leg only: the canonical balance AFTER the re-credit. */
|
|
501
|
+
newBalance?: string | number | null;
|
|
502
|
+
/** Card leg only: the card processor's refund id (for support/reconciliation). */
|
|
503
|
+
processorRefundId?: string;
|
|
500
504
|
/** Always true — INVO retains its fee; the customer is made whole minus that fee. */
|
|
501
505
|
feeRetained?: boolean;
|
|
502
506
|
raw: Record<string, unknown>;
|
|
503
507
|
}
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
};
|
|
520
|
-
/** "if_required" keeps the flow in-page unless the bank forces a redirect. */
|
|
521
|
-
redirect?: "if_required" | "always";
|
|
522
|
-
}): Promise<InvoCardConfirmResponse>;
|
|
523
|
-
}
|
|
524
|
-
interface InvoCardElements {
|
|
525
|
-
create(type: string, opts?: Record<string, unknown>): InvoCardElement;
|
|
526
|
-
}
|
|
527
|
-
interface InvoCardElement {
|
|
528
|
-
mount(target: string | HTMLElement): void;
|
|
529
|
-
unmount?(): void;
|
|
530
|
-
}
|
|
531
|
-
interface InvoCardConfirmResponse {
|
|
532
|
-
error?: {
|
|
533
|
-
message?: string;
|
|
534
|
-
code?: string;
|
|
535
|
-
[k: string]: unknown;
|
|
536
|
-
};
|
|
537
|
-
paymentIntent?: {
|
|
538
|
-
id?: string;
|
|
539
|
-
status?: string;
|
|
540
|
-
[k: string]: unknown;
|
|
541
|
-
};
|
|
542
|
-
[k: string]: unknown;
|
|
543
|
-
}
|
|
544
|
-
interface MountCardPaymentOptions {
|
|
545
|
-
/** Where the Payment Element renders: a CSS selector or an HTMLElement. */
|
|
546
|
-
mount: string | HTMLElement;
|
|
547
|
-
/** The card processor PUBLISHABLE key (public). Falls back to
|
|
548
|
-
* `ClientConfig.commercePublishableKey`. */
|
|
549
|
-
publishableKey?: string;
|
|
550
|
-
/** URL the processor returns to after any off-site step (e.g. 3-D Secure). */
|
|
551
|
-
returnUrl?: string;
|
|
552
|
-
/** Payment Element appearance/config, passed straight to the processor. */
|
|
553
|
-
appearance?: Record<string, unknown>;
|
|
554
|
-
/** Advanced/testing: inject the processor instead of loading it from the CDN. */
|
|
555
|
-
loadProcessor?: (publishableKey: string) => Promise<InvoCardProcessor>;
|
|
556
|
-
}
|
|
557
|
-
interface ConfirmCardPaymentOptions extends MountCardPaymentOptions {
|
|
558
|
-
/** Your existing "Pay" button (selector or element). If omitted, the SDK renders a
|
|
559
|
-
* minimal button inside `mount` (requires a DOM `document`). */
|
|
560
|
-
submit?: string | HTMLElement;
|
|
561
|
-
/** Label for the auto-rendered button when `submit` is omitted. Default "Pay". */
|
|
562
|
-
submitLabel?: string;
|
|
563
|
-
}
|
|
564
|
-
type CardPaymentStatus = "succeeded" | "requires_action" | "processing" | "failed";
|
|
565
|
-
interface CardPaymentResult {
|
|
566
|
-
/**
|
|
567
|
-
* "succeeded" — the processor captured/authorized (still fulfill on the
|
|
568
|
-
* `platform_commerce.purchased` webhook, never on this alone). "requires_action" — the
|
|
569
|
-
* bank needs a step (e.g. redirect). "processing" — async settlement in flight.
|
|
570
|
-
* "failed" — declined/errored (`error` carries the message).
|
|
571
|
-
*/
|
|
572
|
-
status: CardPaymentStatus;
|
|
573
|
-
paymentIntentId?: string;
|
|
574
|
-
/** Present on "failed": the processor's error message. */
|
|
575
|
-
error?: string;
|
|
576
|
-
raw: Record<string, unknown>;
|
|
577
|
-
}
|
|
578
|
-
/** Handle returned by `mountCardPayment`: confirm on your own button, then tear down. */
|
|
579
|
-
interface CardPaymentSession {
|
|
580
|
-
/** The mounted Payment Element (processor-native object). */
|
|
581
|
-
element: InvoCardElement;
|
|
582
|
-
/** Confirm the payment (call from your Pay button's click handler). */
|
|
583
|
-
confirm(opts?: {
|
|
584
|
-
returnUrl?: string;
|
|
585
|
-
}): Promise<CardPaymentResult>;
|
|
586
|
-
/** Unmount the Payment Element. */
|
|
508
|
+
interface MountCheckoutOptions {
|
|
509
|
+
/** Called when INVO's page posts `INVO_CHECKOUT_COMPLETE` (payment finished in-frame).
|
|
510
|
+
* Show "processing" and reconcile server-side — the sale is REAL only on the
|
|
511
|
+
* `platform_commerce.purchased` webhook, never on this client signal. */
|
|
512
|
+
onComplete?: (data: Record<string, unknown>) => void;
|
|
513
|
+
/** Extra CSS class for the iframe. The SDK sets width:100%/border:0 by default. */
|
|
514
|
+
className?: string;
|
|
515
|
+
/** iframe `title` for accessibility. Default "INVO checkout". */
|
|
516
|
+
title?: string;
|
|
517
|
+
}
|
|
518
|
+
/** Handle returned by `mountCheckout`. */
|
|
519
|
+
interface CheckoutMountHandle {
|
|
520
|
+
/** The mounted iframe element. */
|
|
521
|
+
iframe: HTMLIFrameElement;
|
|
522
|
+
/** Remove the iframe and stop listening for checkout messages. */
|
|
587
523
|
destroy(): void;
|
|
588
524
|
}
|
|
589
525
|
interface PlayerBalanceQuery {
|
|
@@ -939,4 +875,4 @@ interface PhoneShareStatusResult {
|
|
|
939
875
|
raw: Record<string, unknown>;
|
|
940
876
|
}
|
|
941
877
|
|
|
942
|
-
export { type
|
|
878
|
+
export { type LinkedIdentitiesResult as $, type ApproveResult as A, type BalanceResult as B, type CheckoutMountHandle as C, type DestinationsQuery as D, type EnrollmentBeginResult as E, type PurchaseInput as F, type PurchaseResult as G, Http as H, InvoError as I, type ConfirmPaymentResult as J, type PurchaseItemInput as K, type LinkDeviceResult as L, type MountCheckoutOptions as M, type PurchaseItemResult as N, type OrderDetailsResult as O, type PendingCollectResult as P, type ItemHistoryQuery as Q, type RecoveryBeginResult as R, type ServerConfig as S, type ItemHistoryResult as T, type ItemOrderQuery as U, type VerificationMethod as V, type PlayerBalanceQuery as W, type PlayerBalanceResult as X, type InboundPendingQuery as Y, type InboundPendingResult as Z, type LinkedIdentitiesQuery as _, type ClientConfig as a, type SmsVerifyResult as a0, type ClaimTransferInput as a1, type ClaimResult as a2, type ClaimCurrencyInput as a3, type TransactionStatusResult as a4, type GuardianApprovalStatusResult as a5, type ServerDestinationsQuery as a6, type PhoneShareContact as a7, type PhoneShareInitiateResult as a8, type PhoneShareApproveInput as a9, type PhoneShareApproveResult as aa, type PhoneShareStatusResult as ab, type CurrencyBalance as ac, type FundingSource as ad, type InboundPendingItem as ae, type LinkedIdentityEmail as af, type PlatformPurchaseStatus as ag, type CallOptions as b, type ConfirmReceiptResult as c, type DestinationsResult as d, type EnrollmentVerifyResult as e, type RecoveryCompleteResult as f, type BalanceRow as g, type DestinationGame as h, type InvoErrorInfo as i, type InvoHooks as j, type InvoRequestInfo as k, type InvoResponseInfo as l, type PendingCollectItem as m, type Rail as n, type AuthHeader as o, type PlatformPurchaseInput as p, type PlatformPurchaseResult as q, type PlatformOrderStatusResult as r, type PlatformRefundInput as s, type PlatformRefundResult as t, type PlayerToken as u, type InitiateSendInput as v, type InitiateResult as w, type InitiateTransferInput as x, type CreateCheckoutInput as y, type CreateCheckoutResult as z };
|
package/package.json
CHANGED