@invonetwork/web-sdk 2.1.1 → 2.2.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 CHANGED
@@ -4,6 +4,45 @@ All notable changes to `@invonetwork/web-sdk` are documented here. This project
4
4
  [Semantic Versioning](https://semver.org/). Releases are managed with
5
5
  [changesets](https://github.com/changesets/changesets).
6
6
 
7
+ ## [2.2.0] — 2026-07-07
8
+
9
+ **Backend reconciliation** — a full audit of the SDK against the live backend surfaced three
10
+ places the SDK didn't match reality. All changes are backward-compatible (relaxing required
11
+ inputs / adding surface); no working call breaks.
12
+
13
+ - **`mintPlayerToken` no longer requires `playerPhone`.** `/api/sdk/player-token` is a
14
+ session-token mint for an **existing** player (looked up by email) — not a registration call.
15
+ It reads only `player_email` and ignores `player_phone`. The 2.0.0 hard E.164 requirement was
16
+ a bug: it could **block a valid token mint for an existing email-only player**. `playerPhone`
17
+ is now optional and validated only if provided. Phone stays enforced where it matters — the
18
+ sender's phone on `initiateSend`/`initiateTransfer`, and at player creation.
19
+ - **Send by phone alone.** `receiverPlayerEmail` (send) and `targetPlayerEmail` (transfer) are
20
+ now **optional** — you can send to a recipient's phone; they supply their email at claim
21
+ (claim still requires it, since that's where the recipient establishes identity).
22
+ - **`getPlayerBalance` is by email only.** There is no by-`playerId` balance route on the
23
+ backend, so passing `playerId` threw a confusing 404. It now throws a clear `INVALID_INPUT`
24
+ pointing you to `InvoClient.getBalance()` (client-side) or `playerEmail` (server-side).
25
+ - **New `InvoError.isUserVerificationRequired`** for the `WEBAUTHN_UV_REQUIRED` (401) approve
26
+ failure — re-run the passkey ceremony requiring UV.
27
+ - Fixed `iterateItemPurchaseHistory` to read the backend's `total_count` pagination key (was
28
+ `total`; the loop already terminated via the short-page guard, so behavior is unchanged).
29
+
30
+ **Migration:** none required. If you were passing `playerPhone` to `mintPlayerToken` it still
31
+ works; you can now also omit it. Replace any `getPlayerBalance({ playerId })` with an email
32
+ lookup or `InvoClient.getBalance()`.
33
+
34
+ ## [2.1.2] — 2026-07-07
35
+
36
+ **Hosted-checkout reconciliation** (the create-session API contract is unchanged; the hosted
37
+ page was rebuilt). Additive + docs only.
38
+
39
+ - `createCheckout` now surfaces `expiresInSeconds` (the `checkout_url` token TTL, e.g. 900) as
40
+ a first-class field on `CreateCheckoutResult` — previously only on `.raw`.
41
+ - README: the `platform` rail is described as cards + Apple Pay / Google Pay / Link +
42
+ international billing (no app-store commission), and the checkout note now says reloading the
43
+ URL after a completed payment is idempotent (an already-complete success screen), not an
44
+ error. No API/signature changes.
45
+
7
46
  ## [2.1.1] — 2026-07-06
8
47
 
9
48
  **Security & correctness hardening** from a full audit + red-team of both SDKs. No API changes;
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  First-party TypeScript SDK for integrating **INVO** into partner **web** platforms (storefronts, web games, dashboards). It wraps INVO's web money flows behind a typed, versioned API — the web analog of the Unity/Unreal plugins.
4
4
 
5
- > **Status:** `v2.1.1` — stable, published on npm. The backend it wraps is **live** on sandbox + production. The API is covered by a [stability commitment](#stability): no breaking changes without a major bump. **Since 2.0.0 (breaking):** `mintPlayerToken` requires `playerPhone` (E.164) — see the [CHANGELOG](CHANGELOG.md) migration note. **2.1.0 adds** self-serve passkey recovery (`recoveryBegin`/`recoveryComplete`); **2.1.1** is a security/correctness hardening patch.
5
+ > **Status:** `v2.1.1` — stable, published on npm. The backend it wraps is **live** on sandbox + production. The API is covered by a [stability commitment](#stability): no breaking changes without a major bump. **Since 2.0.0 (breaking):** `mintPlayerToken` requires `playerPhone` (E.164) — see the [CHANGELOG](CHANGELOG.md) migration note. **2.1.0 adds** self-serve passkey recovery; **2.1.1** security hardening; **2.1.2** `expiresInSeconds` on `createCheckout`. **2.2.0** reconciles with the backend: `mintPlayerToken` no longer requires `playerPhone` (it's a session mint, not registration), send-by-phone-alone, and `getPlayerBalance` is email-only.
6
6
  > Canonical partner reference: **https://docs.invo.network/docs/currency-purchase** and **https://docs.invo.network/docs/game-developer-integration**.
7
7
 
8
8
  ## What it does
@@ -82,26 +82,30 @@ Build and test against the **dev console + sandbox** first, then switch to the *
82
82
 
83
83
  `InvoClient` needs a `token` and a `baseUrl` — which lets you adopt it **two ways**. Same SDK, same code in your components; only the config differs.
84
84
 
85
- ### Player registration (email + phone, required)
85
+ ### Player token (session mint for an existing player)
86
86
 
87
- `mintPlayerToken` is the player **registration** call, and it requires **both** `playerEmail` and `playerPhone`:
87
+ `mintPlayerToken` mints a short-lived, game-scoped **session token** for a player who
88
+ **already exists** on your game. It is *not* a registration call — the backend looks the
89
+ player up by `playerEmail` and returns a token for their existing identity (or `404` if no
90
+ such player exists). It only needs `playerEmail`:
88
91
 
89
92
  ```ts
90
93
  // your backend
91
- const { token } = await invo.mintPlayerToken({
92
- playerEmail: "player@example.com",
93
- playerPhone: "+15555550100", // REQUIRED — E.164: leading "+", country code, digits only
94
- });
94
+ const { token } = await invo.mintPlayerToken({ playerEmail: "player@example.com" });
95
95
  ```
96
96
 
97
- Why phone is not optional on the INVO network:
97
+ `playerPhone` is **optional** here (validated as E.164 only if you pass it, and ignored by this
98
+ endpoint) — an existing email-only player still mints a token.
98
99
 
99
- - **Identity is derived from email + phone together.** Registering email-only and adding the phone later **changes the identity and forces device re-enrollment** — collect the phone in your enrollment UI *before* the first mint.
100
- - **Incoming cross-game transfers are matched by phone.** An account without a phone can never see money sent to it.
101
- - **The account-linking consent SMS is triggered by phone.** Without one, the "add this email to your account?" flow can't run.
102
- - **Format is E.164** (`+15555550100`) — the SDK rejects anything else before it reaches the wire. Don't send national/local formats.
100
+ **Where phone actually matters.** A player's INVO identity encodes their phone, and cross-game
101
+ money routing keys off it — but that's enforced on the money calls, not the token mint:
103
102
 
104
- **Same person, new email, same phone is expected and supported.** When the phone already belongs to another INVO account, the mint throws an `InvoError` with `isPhoneShareApprovalRequired` (409) — this is **not a failure**: INVO sent the phone holder a consent SMS. Show the player a "pending approval" state, then re-issue the same mint once approved. Poll `phoneShareStatus({ phone, email })`, or use `phoneShareInitiate`/`phoneShareApprove` (the error's `phoneShareApprovalId` carries the id) for the in-app OTP fallback.
103
+ - **`initiateSend` / `initiateTransfer`** require the **sender's** phone (E.164), and take the
104
+ **recipient's** phone. You can send by the recipient's **phone alone** — they supply their
105
+ email when they claim.
106
+ - An account with no phone can't receive cross-game money and can't take part in the
107
+ account-linking consent SMS, so make sure players have a phone at **creation / enrollment**
108
+ (in your own player system), before they transact.
105
109
 
106
110
  ### Token bootstrap (both modes)
107
111
 
@@ -150,7 +154,7 @@ The WebAuthn ceremony still runs in the browser (it must — it's `navigator.cre
150
154
  INVO enables each flow for your tenant in the [console](#get-your-account--game-secret-invo-console). What you need to do:
151
155
 
152
156
  - **Store the game secret server-side** and expose a small endpoint that calls `mintPlayerToken` so the browser can fetch/refresh its token. Never ship the secret to the browser.
153
- - **Collect a phone number (E.164) in your enrollment flow** — `mintPlayerToken` requires it alongside the email (see [Player registration](#player-registration-email--phone-required)).
157
+ - **Make sure players have a phone (E.164) at creation/enrollment** — it's required on the money calls (`initiateSend`/`initiateTransfer`) and for cross-game receive, though not on the token mint itself (see [Player token](#player-token-session-mint-for-an-existing-player)).
154
158
  - **If you use browser-direct ([Mode A](#mode-a--browser-direct-default)):** ask INVO to **CORS-allow your web origin(s)** so the browser can call the API directly. (Not needed for [Mode B / proxy](#mode-b--behind-your-proxy-keep-the-token-server-side) — those requests are same-origin to your backend.)
155
159
  - **For passkeys (sends/transfers):** give INVO the **RP ID + web origin(s)** you'll serve from. Passkeys only validate on approved origins — if a call returns `WEBAUTHN_NOT_ENABLED_FOR_TENANT`, your origins aren't set up yet; contact INVO. (Until enrolled, the sender falls back to the SMS-PIN path automatically.)
156
160
  - **For currency purchase:** card checkout works out of the box; ask INVO to enable the `game`/`steam` rails if you need them.
@@ -200,7 +204,7 @@ Buy game currency with real money. Authenticated by the **payment rail**, not a
200
204
 
201
205
  ```ts
202
206
  // SERVER
203
- const { checkoutUrl, sessionId, expiresAt } = await server.createCheckout({
207
+ const { checkoutUrl, sessionId, expiresAt, expiresInSeconds } = await server.createCheckout({
204
208
  playerEmail: "p@example.com",
205
209
  usdAmount: "20.00", // USD, 0 < x ≤ 999.99
206
210
  rail: "platform", // optional: "platform" (default) | "game" | "steam"
@@ -208,7 +212,9 @@ const { checkoutUrl, sessionId, expiresAt } = await server.createCheckout({
208
212
  cancelUrl: "https://you/buy/cancel",
209
213
  metadata: { yourOrderId: "ord_42" }, // echoed on the purchase.completed webhook (all rails); order_id also reconciles
210
214
  });
211
- // → send the browser to checkoutUrl (single-use, ~15 min)
215
+ // → send the browser to checkoutUrl. Token TTL is expiresInSeconds (~900s / 15 min).
216
+ // Reloading the URL after a completed payment is idempotent — it shows an already-complete
217
+ // success screen (no error), so you don't have to guard against a refresh.
212
218
  ```
213
219
 
214
220
  Open `checkoutUrl` either way:
@@ -237,8 +243,8 @@ The hosted page handles card entry, saved cards, and 3-D Secure (with a top-leve
237
243
  ### Payment rails (neutral names)
238
244
 
239
245
  The `rail` selects the in-page experience — all branded INVO, no visible redirect:
240
- - `"platform"` (default) — card checkout.
241
- - `"game"` — regional / game-store methods.
246
+ - `"platform"` (default) — cards plus **Apple Pay / Google Pay / Link** (rendered automatically on supported devices) and international billing addresses. It's a web checkout, so there's no app-store commission.
247
+ - `"game"` — regional / game-store methods (may redirect to the regional hosted page).
242
248
  - `"steam"` — Steam titles hand off to the in-client Steam flow.
243
249
 
244
250
  Provider/processor names are an internal detail and never appear in the API.
@@ -299,14 +305,17 @@ const item = await server.purchaseItem({
299
305
 
300
306
  ## Player balance
301
307
 
302
- Read a player's currency balances (server-side, game-secret) by email or player id:
308
+ Read a player's currency balances (server-side, game-secret) **by email**:
303
309
 
304
310
  ```ts
305
311
  const { balances, summary } = await server.getPlayerBalance({ playerEmail: "p@example.com" });
306
312
  // balances: [{ currencyName, availableBalance, reservedBalance, totalBalance, currencySymbol, raw }]
307
- // or: server.getPlayerBalance({ playerId: 12345 })
308
313
  ```
309
314
 
315
+ Lookup is by email only — there is no by-`playerId` balance route (a `playerId` is a per-game
316
+ internal id). For a **client-side** read, use `InvoClient.getBalance()` (player-token; identity
317
+ comes from the token, no PII).
318
+
310
319
  ---
311
320
 
312
321
  ## Sends & transfers (move currency between players)
@@ -582,17 +591,17 @@ try {
582
591
 
583
592
  | Method | Returns |
584
593
  |---|---|
585
- | `mintPlayerToken({ playerEmail, playerPhone })` | `{ token, expiresAt, identityId }` — **both required**; `playerPhone` must be E.164 (see [Player registration](#player-registration-email--phone-required)) |
594
+ | `mintPlayerToken({ playerEmail, playerPhone? })` | `{ token, expiresAt, identityId }` — session mint for an **existing** player (404 if unknown); `playerPhone` optional/validated-if-present (see [Player token](#player-token-session-mint-for-an-existing-player)) |
586
595
  | `initiateSend(input)` | `{ transactionId, verificationMethod, guardianApproval?, raw }` |
587
596
  | `initiateTransfer(input)` | `{ transactionId, verificationMethod, guardianApproval?, raw }` |
588
- | `createCheckout(input)` | `{ sessionId, checkoutUrl, expiresAt, raw }` |
597
+ | `createCheckout(input)` | `{ sessionId, checkoutUrl, expiresAt, expiresInSeconds, raw }` |
589
598
  | `purchaseCurrency(input)` | `{ status, clientSecret?, paymentIntentId?, paymentUrl?, transactionId?, orderId?, newBalance?, raw }` |
590
599
  | `confirmPayment({ paymentIntentId, orderId? })` | `{ status, transactionId?, newBalance?, raw }` |
591
600
  | `getOrderDetails({ orderId? \| transactionId? })` | `{ order, financialSummary, statusTimeline, raw }` |
592
601
  | `purchaseItem(input)` | `{ status, transactionId, orderId, newBalance, previousBalance, currencyName, financialBreakdown?, raw }` |
593
602
  | `getItemPurchaseHistory({ playerEmail, limit?, offset? })` | `{ history, pagination, raw }` |
594
603
  | `getItemOrderDetails({ orderId? \| transactionId? \| clientRequestId? })` | `{ order, financialSummary, statusTimeline, raw }` |
595
- | `getPlayerBalance({ playerEmail? \| playerId? })` | `{ player, balances, summary, raw }` |
604
+ | `getPlayerBalance({ playerEmail })` | `{ player, balances, summary, raw }` — **by email only** (no by-id route; use `InvoClient.getBalance()` client-side) |
596
605
  | `getInboundPending({ playerEmail? \| playerPhone? })` | `{ inboundPending, raw }` — live unclaimed inbound sends/transfers |
597
606
  | `getLinkedIdentities({ playerEmail? \| playerPhone? })` | `{ walletUserId, primaryEmail, primaryPhone, isMinor, emails, notFound, raw }` — **server-only** (returns PII) |
598
607
  | `verifySmsTransfer(txnId, smsPin)` / `verifySmsSend(txnId, smsPin)` | `SmsVerifyResult` — complete the SMS-PIN path when `verificationMethod: "sms"` |
@@ -21,6 +21,14 @@ var InvoError = class _InvoError extends Error {
21
21
  get isEnrollmentAuthorizationRequired() {
22
22
  return this.code === "ENROLLMENT_REQUIRES_AUTHORIZATION";
23
23
  }
24
+ /**
25
+ * True if a passkey approve/confirm was rejected because the assertion lacked user
26
+ * verification (`WEBAUTHN_UV_REQUIRED`, 401). Re-run the ceremony requiring UV
27
+ * (biometric/PIN) — the backend treats a UV-satisfied assertion as the signed step-up.
28
+ */
29
+ get isUserVerificationRequired() {
30
+ return this.code === "WEBAUTHN_UV_REQUIRED";
31
+ }
24
32
  /**
25
33
  * True if enrolling is blocked because the identity already has an enrolled method
26
34
  * (anti-takeover gate, register/complete → 409). Two ways forward: `linkDevice` when
@@ -361,5 +369,5 @@ function toDestinationsResult(raw, direction) {
361
369
  }
362
370
 
363
371
  export { Http, InvoError, assertSecureBaseUrl, toDestinationsResult };
364
- //# sourceMappingURL=chunk-4GNJIQY2.js.map
365
- //# sourceMappingURL=chunk-4GNJIQY2.js.map
372
+ //# sourceMappingURL=chunk-DJADKVYI.js.map
373
+ //# sourceMappingURL=chunk-DJADKVYI.js.map
package/dist/index.cjs CHANGED
@@ -23,6 +23,14 @@ var InvoError = class _InvoError extends Error {
23
23
  get isEnrollmentAuthorizationRequired() {
24
24
  return this.code === "ENROLLMENT_REQUIRES_AUTHORIZATION";
25
25
  }
26
+ /**
27
+ * True if a passkey approve/confirm was rejected because the assertion lacked user
28
+ * verification (`WEBAUTHN_UV_REQUIRED`, 401). Re-run the ceremony requiring UV
29
+ * (biometric/PIN) — the backend treats a UV-satisfied assertion as the signed step-up.
30
+ */
31
+ get isUserVerificationRequired() {
32
+ return this.code === "WEBAUTHN_UV_REQUIRED";
33
+ }
26
34
  /**
27
35
  * True if enrolling is blocked because the identity already has an enrolled method
28
36
  * (anti-takeover gate, register/complete → 409). Two ways forward: `linkDevice` when
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as ClientConfig, a as CallOptions, A as ApproveResult, b as ConfirmReceiptResult, L as LinkDeviceResult, P as PendingCollectResult, D as DestinationsQuery, c as DestinationsResult, B as BalanceResult, E as EnrollmentBeginResult, d as EnrollmentVerifyResult, R as RecoveryBeginResult, e as RecoveryCompleteResult } from './types-DtihCpOj.cjs';
2
- export { f as BalanceRow, g as DestinationGame, I as InvoError, h as InvoErrorInfo, i as InvoHooks, j as InvoRequestInfo, k as InvoResponseInfo, l as PendingCollectItem, m as Rail, V as VerificationMethod } from './types-DtihCpOj.cjs';
1
+ import { C as ClientConfig, a as CallOptions, A as ApproveResult, b as ConfirmReceiptResult, L as LinkDeviceResult, P as PendingCollectResult, D as DestinationsQuery, c as DestinationsResult, B as BalanceResult, E as EnrollmentBeginResult, d as EnrollmentVerifyResult, R as RecoveryBeginResult, e as RecoveryCompleteResult } from './types-Byp0p1r5.cjs';
2
+ export { f as BalanceRow, g as DestinationGame, I as InvoError, h as InvoErrorInfo, i as InvoHooks, j as InvoRequestInfo, k as InvoResponseInfo, l as PendingCollectItem, m as Rail, V as VerificationMethod } from './types-Byp0p1r5.cjs';
3
3
 
4
4
  declare class InvoClient {
5
5
  private readonly http;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as ClientConfig, a as CallOptions, A as ApproveResult, b as ConfirmReceiptResult, L as LinkDeviceResult, P as PendingCollectResult, D as DestinationsQuery, c as DestinationsResult, B as BalanceResult, E as EnrollmentBeginResult, d as EnrollmentVerifyResult, R as RecoveryBeginResult, e as RecoveryCompleteResult } from './types-DtihCpOj.js';
2
- export { f as BalanceRow, g as DestinationGame, I as InvoError, h as InvoErrorInfo, i as InvoHooks, j as InvoRequestInfo, k as InvoResponseInfo, l as PendingCollectItem, m as Rail, V as VerificationMethod } from './types-DtihCpOj.js';
1
+ import { C as ClientConfig, a as CallOptions, A as ApproveResult, b as ConfirmReceiptResult, L as LinkDeviceResult, P as PendingCollectResult, D as DestinationsQuery, c as DestinationsResult, B as BalanceResult, E as EnrollmentBeginResult, d as EnrollmentVerifyResult, R as RecoveryBeginResult, e as RecoveryCompleteResult } from './types-Byp0p1r5.js';
2
+ export { f as BalanceRow, g as DestinationGame, I as InvoError, h as InvoErrorInfo, i as InvoHooks, j as InvoRequestInfo, k as InvoResponseInfo, l as PendingCollectItem, m as Rail, V as VerificationMethod } from './types-Byp0p1r5.js';
3
3
 
4
4
  declare class InvoClient {
5
5
  private readonly http;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { assertSecureBaseUrl, Http, toDestinationsResult, InvoError } from './chunk-4GNJIQY2.js';
2
- export { InvoError } from './chunk-4GNJIQY2.js';
1
+ import { assertSecureBaseUrl, Http, toDestinationsResult, InvoError } from './chunk-DJADKVYI.js';
2
+ export { InvoError } from './chunk-DJADKVYI.js';
3
3
 
4
4
  // src/shared/webauthn.ts
5
5
  function malformedOptions(field) {
package/dist/server.cjs CHANGED
@@ -25,6 +25,14 @@ var InvoError = class _InvoError extends Error {
25
25
  get isEnrollmentAuthorizationRequired() {
26
26
  return this.code === "ENROLLMENT_REQUIRES_AUTHORIZATION";
27
27
  }
28
+ /**
29
+ * True if a passkey approve/confirm was rejected because the assertion lacked user
30
+ * verification (`WEBAUTHN_UV_REQUIRED`, 401). Re-run the ceremony requiring UV
31
+ * (biometric/PIN) — the backend treats a UV-satisfied assertion as the signed step-up.
32
+ */
33
+ get isUserVerificationRequired() {
34
+ return this.code === "WEBAUTHN_UV_REQUIRED";
35
+ }
28
36
  /**
29
37
  * True if enrolling is blocked because the identity already has an enrolled method
30
38
  * (anti-takeover gate, register/complete → 409). Two ways forward: `linkDevice` when
@@ -528,7 +536,7 @@ async function hmacHexSubtle(secret, message) {
528
536
  }
529
537
 
530
538
  // src/server.ts
531
- var DEFAULT_UA = "invonetwork-web-sdk/2.1.1 (+https://invo.network)";
539
+ var DEFAULT_UA = "invonetwork-web-sdk/2.2.0 (+https://invo.network)";
532
540
  var MAX_USD_AMOUNT = 999.99;
533
541
  var MAX_ITEM_PRICE = 999999.99;
534
542
  function invalidInput(label, value, why) {
@@ -709,28 +717,29 @@ var InvoServer = class {
709
717
  /**
710
718
  * Mint a short-lived, game-scoped player token to hand to the browser InvoClient.
711
719
  *
712
- * This is the player REGISTRATION call: the network identity is derived from
713
- * `email + phone` TOGETHER, so both are required. Registering email-only and
714
- * attaching the phone later changes the identity and forces device re-enrollment —
715
- * collect the phone before the first mint. `playerPhone` must be E.164
716
- * (e.g. "+15555550100"); incoming cross-game transfers and the account-linking
717
- * consent SMS are both matched by phone, so an account without one can't receive
718
- * either.
720
+ * This is a SESSION-TOKEN mint for a player who ALREADY EXISTS on the game — not a
721
+ * registration call. The backend looks the player up by `playerEmail` and returns a
722
+ * token for their existing identity; if no such player exists it responds 404. The
723
+ * network identity (which encodes the player's phone) is established when the player
724
+ * is created and on the money-routing calls, so phone is NOT required or read here.
719
725
  *
720
- * If the phone already belongs to another INVO account (same person, new email),
721
- * this throws an InvoError with `isPhoneShareApprovalRequired` — NOT a failure:
722
- * the phone holder was sent a consent SMS. Surface "pending approval" to the user,
723
- * then re-issue the same call once approved (poll `phoneShareStatus`, or use
724
- * `phoneShareInitiate`/`phoneShareApprove` for the in-app OTP fallback).
726
+ * `playerPhone` is optional and only validated (E.164) if you pass it — the backend
727
+ * ignores it on this endpoint, so an existing email-only player can still mint a token.
728
+ * Phone is enforced where it actually matters: `initiateSend`/`initiateTransfer` (the
729
+ * sender's phone, and the recipient's when known) and at player creation.
725
730
  */
726
731
  async mintPlayerToken(input, opts) {
727
732
  if (typeof input.playerEmail !== "string" || !input.playerEmail.trim()) {
728
733
  throw invalidInput("playerEmail", input.playerEmail, "is required");
729
734
  }
730
- assertE164(input.playerPhone, "playerPhone");
735
+ const body = { player_email: input.playerEmail };
736
+ if (input.playerPhone !== void 0) {
737
+ assertE164(input.playerPhone, "playerPhone");
738
+ body["player_phone"] = input.playerPhone;
739
+ }
731
740
  const raw = await this.http.post(
732
741
  "/api/sdk/player-token",
733
- { player_email: input.playerEmail, player_phone: input.playerPhone },
742
+ body,
734
743
  this.auth,
735
744
  { idempotent: true, signal: opts?.signal }
736
745
  // safe to retry: re-mint just issues a fresh token
@@ -809,6 +818,7 @@ var InvoServer = class {
809
818
  sessionId: String(raw["session_id"] ?? ""),
810
819
  checkoutUrl: requireField(raw["checkout_url"], "checkout_url", raw),
811
820
  expiresAt: String(raw["expires_at"] ?? ""),
821
+ expiresInSeconds: Number(raw["expires_in_seconds"] ?? 0),
812
822
  raw
813
823
  };
814
824
  }
@@ -1035,20 +1045,32 @@ var InvoServer = class {
1035
1045
  for (const row of history) yield row;
1036
1046
  yielded += history.length;
1037
1047
  if (history.length < pageSize) return;
1038
- const total = Number(pagination?.["total"]);
1048
+ const p = pagination;
1049
+ const total = Number(p?.["total_count"] ?? p?.["total"]);
1039
1050
  if (Number.isFinite(total) && yielded >= total) return;
1040
1051
  }
1041
1052
  }
1042
- /** Read a player's currency balances, by email or playerId (game-secret). */
1053
+ /**
1054
+ * Read a player's currency balances by email (server-side, game-secret).
1055
+ *
1056
+ * NOTE: lookup is by EMAIL only. There is no by-id balance route on the backend
1057
+ * (`playerId` is a per-game internal id), so passing `playerId` throws — use the
1058
+ * browser `InvoClient.getBalance()` (token-authed, identity from the token) for a
1059
+ * client-side read, or `playerEmail` here server-side.
1060
+ */
1043
1061
  async getPlayerBalance(query, opts) {
1044
1062
  let path;
1045
- if (query.playerId != null && String(query.playerId).trim()) {
1046
- path = `/api/player-balances/player/${encodeURIComponent(String(query.playerId))}`;
1047
- } else if (typeof query.playerEmail === "string" && query.playerEmail.trim()) {
1063
+ if (typeof query.playerEmail === "string" && query.playerEmail.trim()) {
1048
1064
  path = `/api/player-balances/player/by-email/${encodeURIComponent(query.playerEmail)}`;
1065
+ } else if (query.playerId != null && String(query.playerId).trim()) {
1066
+ throw new InvoError({
1067
+ message: "getPlayerBalance is by playerEmail only \u2014 there is no by-id balance route. Use InvoClient.getBalance() client-side (player token), or pass playerEmail here.",
1068
+ code: "INVALID_INPUT",
1069
+ status: 0
1070
+ });
1049
1071
  } else {
1050
1072
  throw new InvoError({
1051
- message: "getPlayerBalance requires a playerEmail or playerId.",
1073
+ message: "getPlayerBalance requires a playerEmail.",
1052
1074
  code: "INVALID_INPUT",
1053
1075
  status: 0
1054
1076
  });
package/dist/server.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as InvoError, S as ServerConfig, a as CallOptions, n as PlayerToken, o as InitiateSendInput, p as InitiateResult, q as InitiateTransferInput, r as CreateCheckoutInput, s as CreateCheckoutResult, t as PurchaseInput, u as PurchaseResult, v as ConfirmPaymentResult, O as OrderDetailsResult, w as PurchaseItemInput, x as PurchaseItemResult, y as ItemHistoryQuery, z as ItemHistoryResult, F as ItemOrderQuery, G as PlayerBalanceQuery, H as PlayerBalanceResult, J as InboundPendingQuery, K as InboundPendingResult, M as LinkedIdentitiesQuery, N as LinkedIdentitiesResult, Q as SmsVerifyResult, T as ClaimTransferInput, U as ClaimResult, W as ClaimCurrencyInput, X as TransactionStatusResult, Y as GuardianApprovalStatusResult, Z as ServerDestinationsQuery, c as DestinationsResult, _ as PhoneShareContact, $ as PhoneShareInitiateResult, a0 as PhoneShareApproveInput, a1 as PhoneShareApproveResult, a2 as PhoneShareStatusResult } from './types-DtihCpOj.cjs';
2
- export { a3 as CurrencyBalance, g as DestinationGame, a4 as InboundPendingItem, h as InvoErrorInfo, i as InvoHooks, j as InvoRequestInfo, k as InvoResponseInfo, a5 as LinkedIdentityEmail, m as Rail, V as VerificationMethod } from './types-DtihCpOj.cjs';
1
+ import { I as InvoError, S as ServerConfig, a as CallOptions, n as PlayerToken, o as InitiateSendInput, p as InitiateResult, q as InitiateTransferInput, r as CreateCheckoutInput, s as CreateCheckoutResult, t as PurchaseInput, u as PurchaseResult, v as ConfirmPaymentResult, O as OrderDetailsResult, w as PurchaseItemInput, x as PurchaseItemResult, y as ItemHistoryQuery, z as ItemHistoryResult, F as ItemOrderQuery, G as PlayerBalanceQuery, H as PlayerBalanceResult, J as InboundPendingQuery, K as InboundPendingResult, M as LinkedIdentitiesQuery, N as LinkedIdentitiesResult, Q as SmsVerifyResult, T as ClaimTransferInput, U as ClaimResult, W as ClaimCurrencyInput, X as TransactionStatusResult, Y as GuardianApprovalStatusResult, Z as ServerDestinationsQuery, c as DestinationsResult, _ as PhoneShareContact, $ as PhoneShareInitiateResult, a0 as PhoneShareApproveInput, a1 as PhoneShareApproveResult, a2 as PhoneShareStatusResult } from './types-Byp0p1r5.cjs';
2
+ export { a3 as CurrencyBalance, g as DestinationGame, a4 as InboundPendingItem, h as InvoErrorInfo, i as InvoHooks, j as InvoRequestInfo, k as InvoResponseInfo, a5 as LinkedIdentityEmail, m as Rail, V as VerificationMethod } from './types-Byp0p1r5.cjs';
3
3
 
4
4
  interface VerifyWebhookOptions {
5
5
  /** Max age of the signed timestamp, in seconds. Default 300 (5 min). */
@@ -152,23 +152,20 @@ declare class InvoServer {
152
152
  /**
153
153
  * Mint a short-lived, game-scoped player token to hand to the browser InvoClient.
154
154
  *
155
- * This is the player REGISTRATION call: the network identity is derived from
156
- * `email + phone` TOGETHER, so both are required. Registering email-only and
157
- * attaching the phone later changes the identity and forces device re-enrollment —
158
- * collect the phone before the first mint. `playerPhone` must be E.164
159
- * (e.g. "+15555550100"); incoming cross-game transfers and the account-linking
160
- * consent SMS are both matched by phone, so an account without one can't receive
161
- * either.
155
+ * This is a SESSION-TOKEN mint for a player who ALREADY EXISTS on the game — not a
156
+ * registration call. The backend looks the player up by `playerEmail` and returns a
157
+ * token for their existing identity; if no such player exists it responds 404. The
158
+ * network identity (which encodes the player's phone) is established when the player
159
+ * is created and on the money-routing calls, so phone is NOT required or read here.
162
160
  *
163
- * If the phone already belongs to another INVO account (same person, new email),
164
- * this throws an InvoError with `isPhoneShareApprovalRequired` — NOT a failure:
165
- * the phone holder was sent a consent SMS. Surface "pending approval" to the user,
166
- * then re-issue the same call once approved (poll `phoneShareStatus`, or use
167
- * `phoneShareInitiate`/`phoneShareApprove` for the in-app OTP fallback).
161
+ * `playerPhone` is optional and only validated (E.164) if you pass it — the backend
162
+ * ignores it on this endpoint, so an existing email-only player can still mint a token.
163
+ * Phone is enforced where it actually matters: `initiateSend`/`initiateTransfer` (the
164
+ * sender's phone, and the recipient's when known) and at player creation.
168
165
  */
169
166
  mintPlayerToken(input: {
170
167
  playerEmail: string;
171
- playerPhone: string;
168
+ playerPhone?: string;
172
169
  }, opts?: CallOptions): Promise<PlayerToken>;
173
170
  /** Initiate a cross-game currency SEND. Inspect result.verificationMethod. */
174
171
  initiateSend(input: InitiateSendInput, opts?: CallOptions): Promise<InitiateResult>;
@@ -223,7 +220,14 @@ declare class InvoServer {
223
220
  playerEmail: string;
224
221
  pageSize?: number;
225
222
  }, opts?: CallOptions): AsyncGenerator<Record<string, unknown>, void, unknown>;
226
- /** Read a player's currency balances, by email or playerId (game-secret). */
223
+ /**
224
+ * Read a player's currency balances by email (server-side, game-secret).
225
+ *
226
+ * NOTE: lookup is by EMAIL only. There is no by-id balance route on the backend
227
+ * (`playerId` is a per-game internal id), so passing `playerId` throws — use the
228
+ * browser `InvoClient.getBalance()` (token-authed, identity from the token) for a
229
+ * client-side read, or `playerEmail` here server-side.
230
+ */
227
231
  getPlayerBalance(query: PlayerBalanceQuery, opts?: CallOptions): Promise<PlayerBalanceResult>;
228
232
  /**
229
233
  * List LIVE, unclaimed inbound sends/transfers addressed to a player at YOUR game —
package/dist/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as InvoError, S as ServerConfig, a as CallOptions, n as PlayerToken, o as InitiateSendInput, p as InitiateResult, q as InitiateTransferInput, r as CreateCheckoutInput, s as CreateCheckoutResult, t as PurchaseInput, u as PurchaseResult, v as ConfirmPaymentResult, O as OrderDetailsResult, w as PurchaseItemInput, x as PurchaseItemResult, y as ItemHistoryQuery, z as ItemHistoryResult, F as ItemOrderQuery, G as PlayerBalanceQuery, H as PlayerBalanceResult, J as InboundPendingQuery, K as InboundPendingResult, M as LinkedIdentitiesQuery, N as LinkedIdentitiesResult, Q as SmsVerifyResult, T as ClaimTransferInput, U as ClaimResult, W as ClaimCurrencyInput, X as TransactionStatusResult, Y as GuardianApprovalStatusResult, Z as ServerDestinationsQuery, c as DestinationsResult, _ as PhoneShareContact, $ as PhoneShareInitiateResult, a0 as PhoneShareApproveInput, a1 as PhoneShareApproveResult, a2 as PhoneShareStatusResult } from './types-DtihCpOj.js';
2
- export { a3 as CurrencyBalance, g as DestinationGame, a4 as InboundPendingItem, h as InvoErrorInfo, i as InvoHooks, j as InvoRequestInfo, k as InvoResponseInfo, a5 as LinkedIdentityEmail, m as Rail, V as VerificationMethod } from './types-DtihCpOj.js';
1
+ import { I as InvoError, S as ServerConfig, a as CallOptions, n as PlayerToken, o as InitiateSendInput, p as InitiateResult, q as InitiateTransferInput, r as CreateCheckoutInput, s as CreateCheckoutResult, t as PurchaseInput, u as PurchaseResult, v as ConfirmPaymentResult, O as OrderDetailsResult, w as PurchaseItemInput, x as PurchaseItemResult, y as ItemHistoryQuery, z as ItemHistoryResult, F as ItemOrderQuery, G as PlayerBalanceQuery, H as PlayerBalanceResult, J as InboundPendingQuery, K as InboundPendingResult, M as LinkedIdentitiesQuery, N as LinkedIdentitiesResult, Q as SmsVerifyResult, T as ClaimTransferInput, U as ClaimResult, W as ClaimCurrencyInput, X as TransactionStatusResult, Y as GuardianApprovalStatusResult, Z as ServerDestinationsQuery, c as DestinationsResult, _ as PhoneShareContact, $ as PhoneShareInitiateResult, a0 as PhoneShareApproveInput, a1 as PhoneShareApproveResult, a2 as PhoneShareStatusResult } from './types-Byp0p1r5.js';
2
+ export { a3 as CurrencyBalance, g as DestinationGame, a4 as InboundPendingItem, h as InvoErrorInfo, i as InvoHooks, j as InvoRequestInfo, k as InvoResponseInfo, a5 as LinkedIdentityEmail, m as Rail, V as VerificationMethod } from './types-Byp0p1r5.js';
3
3
 
4
4
  interface VerifyWebhookOptions {
5
5
  /** Max age of the signed timestamp, in seconds. Default 300 (5 min). */
@@ -152,23 +152,20 @@ declare class InvoServer {
152
152
  /**
153
153
  * Mint a short-lived, game-scoped player token to hand to the browser InvoClient.
154
154
  *
155
- * This is the player REGISTRATION call: the network identity is derived from
156
- * `email + phone` TOGETHER, so both are required. Registering email-only and
157
- * attaching the phone later changes the identity and forces device re-enrollment —
158
- * collect the phone before the first mint. `playerPhone` must be E.164
159
- * (e.g. "+15555550100"); incoming cross-game transfers and the account-linking
160
- * consent SMS are both matched by phone, so an account without one can't receive
161
- * either.
155
+ * This is a SESSION-TOKEN mint for a player who ALREADY EXISTS on the game — not a
156
+ * registration call. The backend looks the player up by `playerEmail` and returns a
157
+ * token for their existing identity; if no such player exists it responds 404. The
158
+ * network identity (which encodes the player's phone) is established when the player
159
+ * is created and on the money-routing calls, so phone is NOT required or read here.
162
160
  *
163
- * If the phone already belongs to another INVO account (same person, new email),
164
- * this throws an InvoError with `isPhoneShareApprovalRequired` — NOT a failure:
165
- * the phone holder was sent a consent SMS. Surface "pending approval" to the user,
166
- * then re-issue the same call once approved (poll `phoneShareStatus`, or use
167
- * `phoneShareInitiate`/`phoneShareApprove` for the in-app OTP fallback).
161
+ * `playerPhone` is optional and only validated (E.164) if you pass it — the backend
162
+ * ignores it on this endpoint, so an existing email-only player can still mint a token.
163
+ * Phone is enforced where it actually matters: `initiateSend`/`initiateTransfer` (the
164
+ * sender's phone, and the recipient's when known) and at player creation.
168
165
  */
169
166
  mintPlayerToken(input: {
170
167
  playerEmail: string;
171
- playerPhone: string;
168
+ playerPhone?: string;
172
169
  }, opts?: CallOptions): Promise<PlayerToken>;
173
170
  /** Initiate a cross-game currency SEND. Inspect result.verificationMethod. */
174
171
  initiateSend(input: InitiateSendInput, opts?: CallOptions): Promise<InitiateResult>;
@@ -223,7 +220,14 @@ declare class InvoServer {
223
220
  playerEmail: string;
224
221
  pageSize?: number;
225
222
  }, opts?: CallOptions): AsyncGenerator<Record<string, unknown>, void, unknown>;
226
- /** Read a player's currency balances, by email or playerId (game-secret). */
223
+ /**
224
+ * Read a player's currency balances by email (server-side, game-secret).
225
+ *
226
+ * NOTE: lookup is by EMAIL only. There is no by-id balance route on the backend
227
+ * (`playerId` is a per-game internal id), so passing `playerId` throws — use the
228
+ * browser `InvoClient.getBalance()` (token-authed, identity from the token) for a
229
+ * client-side read, or `playerEmail` here server-side.
230
+ */
227
231
  getPlayerBalance(query: PlayerBalanceQuery, opts?: CallOptions): Promise<PlayerBalanceResult>;
228
232
  /**
229
233
  * List LIVE, unclaimed inbound sends/transfers addressed to a player at YOUR game —
package/dist/server.js CHANGED
@@ -1,5 +1,5 @@
1
- import { InvoError, assertSecureBaseUrl, Http, toDestinationsResult } from './chunk-4GNJIQY2.js';
2
- export { InvoError } from './chunk-4GNJIQY2.js';
1
+ import { InvoError, assertSecureBaseUrl, Http, toDestinationsResult } from './chunk-DJADKVYI.js';
2
+ export { InvoError } from './chunk-DJADKVYI.js';
3
3
  import { createHmac, timingSafeEqual } from 'crypto';
4
4
 
5
5
  var DEFAULT_TOLERANCE_SEC = 300;
@@ -167,7 +167,7 @@ async function hmacHexSubtle(secret, message) {
167
167
  }
168
168
 
169
169
  // src/server.ts
170
- var DEFAULT_UA = "invonetwork-web-sdk/2.1.1 (+https://invo.network)";
170
+ var DEFAULT_UA = "invonetwork-web-sdk/2.2.0 (+https://invo.network)";
171
171
  var MAX_USD_AMOUNT = 999.99;
172
172
  var MAX_ITEM_PRICE = 999999.99;
173
173
  function invalidInput(label, value, why) {
@@ -348,28 +348,29 @@ var InvoServer = class {
348
348
  /**
349
349
  * Mint a short-lived, game-scoped player token to hand to the browser InvoClient.
350
350
  *
351
- * This is the player REGISTRATION call: the network identity is derived from
352
- * `email + phone` TOGETHER, so both are required. Registering email-only and
353
- * attaching the phone later changes the identity and forces device re-enrollment —
354
- * collect the phone before the first mint. `playerPhone` must be E.164
355
- * (e.g. "+15555550100"); incoming cross-game transfers and the account-linking
356
- * consent SMS are both matched by phone, so an account without one can't receive
357
- * either.
351
+ * This is a SESSION-TOKEN mint for a player who ALREADY EXISTS on the game — not a
352
+ * registration call. The backend looks the player up by `playerEmail` and returns a
353
+ * token for their existing identity; if no such player exists it responds 404. The
354
+ * network identity (which encodes the player's phone) is established when the player
355
+ * is created and on the money-routing calls, so phone is NOT required or read here.
358
356
  *
359
- * If the phone already belongs to another INVO account (same person, new email),
360
- * this throws an InvoError with `isPhoneShareApprovalRequired` — NOT a failure:
361
- * the phone holder was sent a consent SMS. Surface "pending approval" to the user,
362
- * then re-issue the same call once approved (poll `phoneShareStatus`, or use
363
- * `phoneShareInitiate`/`phoneShareApprove` for the in-app OTP fallback).
357
+ * `playerPhone` is optional and only validated (E.164) if you pass it — the backend
358
+ * ignores it on this endpoint, so an existing email-only player can still mint a token.
359
+ * Phone is enforced where it actually matters: `initiateSend`/`initiateTransfer` (the
360
+ * sender's phone, and the recipient's when known) and at player creation.
364
361
  */
365
362
  async mintPlayerToken(input, opts) {
366
363
  if (typeof input.playerEmail !== "string" || !input.playerEmail.trim()) {
367
364
  throw invalidInput("playerEmail", input.playerEmail, "is required");
368
365
  }
369
- assertE164(input.playerPhone, "playerPhone");
366
+ const body = { player_email: input.playerEmail };
367
+ if (input.playerPhone !== void 0) {
368
+ assertE164(input.playerPhone, "playerPhone");
369
+ body["player_phone"] = input.playerPhone;
370
+ }
370
371
  const raw = await this.http.post(
371
372
  "/api/sdk/player-token",
372
- { player_email: input.playerEmail, player_phone: input.playerPhone },
373
+ body,
373
374
  this.auth,
374
375
  { idempotent: true, signal: opts?.signal }
375
376
  // safe to retry: re-mint just issues a fresh token
@@ -448,6 +449,7 @@ var InvoServer = class {
448
449
  sessionId: String(raw["session_id"] ?? ""),
449
450
  checkoutUrl: requireField(raw["checkout_url"], "checkout_url", raw),
450
451
  expiresAt: String(raw["expires_at"] ?? ""),
452
+ expiresInSeconds: Number(raw["expires_in_seconds"] ?? 0),
451
453
  raw
452
454
  };
453
455
  }
@@ -674,20 +676,32 @@ var InvoServer = class {
674
676
  for (const row of history) yield row;
675
677
  yielded += history.length;
676
678
  if (history.length < pageSize) return;
677
- const total = Number(pagination?.["total"]);
679
+ const p = pagination;
680
+ const total = Number(p?.["total_count"] ?? p?.["total"]);
678
681
  if (Number.isFinite(total) && yielded >= total) return;
679
682
  }
680
683
  }
681
- /** Read a player's currency balances, by email or playerId (game-secret). */
684
+ /**
685
+ * Read a player's currency balances by email (server-side, game-secret).
686
+ *
687
+ * NOTE: lookup is by EMAIL only. There is no by-id balance route on the backend
688
+ * (`playerId` is a per-game internal id), so passing `playerId` throws — use the
689
+ * browser `InvoClient.getBalance()` (token-authed, identity from the token) for a
690
+ * client-side read, or `playerEmail` here server-side.
691
+ */
682
692
  async getPlayerBalance(query, opts) {
683
693
  let path;
684
- if (query.playerId != null && String(query.playerId).trim()) {
685
- path = `/api/player-balances/player/${encodeURIComponent(String(query.playerId))}`;
686
- } else if (typeof query.playerEmail === "string" && query.playerEmail.trim()) {
694
+ if (typeof query.playerEmail === "string" && query.playerEmail.trim()) {
687
695
  path = `/api/player-balances/player/by-email/${encodeURIComponent(query.playerEmail)}`;
696
+ } else if (query.playerId != null && String(query.playerId).trim()) {
697
+ throw new InvoError({
698
+ message: "getPlayerBalance is by playerEmail only \u2014 there is no by-id balance route. Use InvoClient.getBalance() client-side (player token), or pass playerEmail here.",
699
+ code: "INVALID_INPUT",
700
+ status: 0
701
+ });
688
702
  } else {
689
703
  throw new InvoError({
690
- message: "getPlayerBalance requires a playerEmail or playerId.",
704
+ message: "getPlayerBalance requires a playerEmail.",
691
705
  code: "INVALID_INPUT",
692
706
  status: 0
693
707
  });
@@ -28,6 +28,12 @@ declare class InvoError extends Error {
28
28
  get isTokenExpired(): boolean;
29
29
  /** True if `enrollPasskey()` needs the OTP-grant flow (`enrollmentBegin`/`enrollmentVerify`). */
30
30
  get isEnrollmentAuthorizationRequired(): boolean;
31
+ /**
32
+ * True if a passkey approve/confirm was rejected because the assertion lacked user
33
+ * verification (`WEBAUTHN_UV_REQUIRED`, 401). Re-run the ceremony requiring UV
34
+ * (biometric/PIN) — the backend treats a UV-satisfied assertion as the signed step-up.
35
+ */
36
+ get isUserVerificationRequired(): boolean;
31
37
  /**
32
38
  * True if enrolling is blocked because the identity already has an enrolled method
33
39
  * (anti-takeover gate, register/complete → 409). Two ways forward: `linkDevice` when
@@ -154,7 +160,8 @@ interface InitiateSendInput {
154
160
  senderPlayerName: string;
155
161
  senderPlayerEmail: string;
156
162
  senderPlayerPhone: string;
157
- receiverPlayerEmail: string;
163
+ /** Optional — you can send by the recipient's PHONE alone; they supply their email at claim. */
164
+ receiverPlayerEmail?: string;
158
165
  receiverPlayerPhone: string;
159
166
  receivingGameId: string | number;
160
167
  amount: string | number;
@@ -164,7 +171,8 @@ interface InitiateTransferInput {
164
171
  sourcePlayerName: string;
165
172
  sourcePlayerEmail: string;
166
173
  sourcePlayerPhone: string;
167
- targetPlayerEmail: string;
174
+ /** Optional — you can transfer by the recipient's PHONE alone; they supply their email at claim. */
175
+ targetPlayerEmail?: string;
168
176
  targetPlayerPhone: string;
169
177
  targetGameId: string | number;
170
178
  amount: string | number;
@@ -198,6 +206,8 @@ interface CreateCheckoutResult {
198
206
  /** Send the browser here; INVO's hosted page handles the processor + 3-D Secure. */
199
207
  checkoutUrl: string;
200
208
  expiresAt: string;
209
+ /** The `checkout_url` token TTL in seconds (e.g. 900 = 15 min). 0 if the backend omits it. */
210
+ expiresInSeconds: number;
201
211
  raw: Record<string, unknown>;
202
212
  }
203
213
  interface PurchaseInput {
@@ -28,6 +28,12 @@ declare class InvoError extends Error {
28
28
  get isTokenExpired(): boolean;
29
29
  /** True if `enrollPasskey()` needs the OTP-grant flow (`enrollmentBegin`/`enrollmentVerify`). */
30
30
  get isEnrollmentAuthorizationRequired(): boolean;
31
+ /**
32
+ * True if a passkey approve/confirm was rejected because the assertion lacked user
33
+ * verification (`WEBAUTHN_UV_REQUIRED`, 401). Re-run the ceremony requiring UV
34
+ * (biometric/PIN) — the backend treats a UV-satisfied assertion as the signed step-up.
35
+ */
36
+ get isUserVerificationRequired(): boolean;
31
37
  /**
32
38
  * True if enrolling is blocked because the identity already has an enrolled method
33
39
  * (anti-takeover gate, register/complete → 409). Two ways forward: `linkDevice` when
@@ -154,7 +160,8 @@ interface InitiateSendInput {
154
160
  senderPlayerName: string;
155
161
  senderPlayerEmail: string;
156
162
  senderPlayerPhone: string;
157
- receiverPlayerEmail: string;
163
+ /** Optional — you can send by the recipient's PHONE alone; they supply their email at claim. */
164
+ receiverPlayerEmail?: string;
158
165
  receiverPlayerPhone: string;
159
166
  receivingGameId: string | number;
160
167
  amount: string | number;
@@ -164,7 +171,8 @@ interface InitiateTransferInput {
164
171
  sourcePlayerName: string;
165
172
  sourcePlayerEmail: string;
166
173
  sourcePlayerPhone: string;
167
- targetPlayerEmail: string;
174
+ /** Optional — you can transfer by the recipient's PHONE alone; they supply their email at claim. */
175
+ targetPlayerEmail?: string;
168
176
  targetPlayerPhone: string;
169
177
  targetGameId: string | number;
170
178
  amount: string | number;
@@ -198,6 +206,8 @@ interface CreateCheckoutResult {
198
206
  /** Send the browser here; INVO's hosted page handles the processor + 3-D Secure. */
199
207
  checkoutUrl: string;
200
208
  expiresAt: string;
209
+ /** The `checkout_url` token TTL in seconds (e.g. 900 = 15 min). 0 if the backend omits it. */
210
+ expiresInSeconds: number;
201
211
  raw: Record<string, unknown>;
202
212
  }
203
213
  interface PurchaseInput {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@invonetwork/web-sdk",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "description": "INVO Web SDK — currency purchase + passkey (WebAuthn) verification for partner web platforms.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "private": false,