@invonetwork/web-sdk 2.2.0 → 2.3.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 +18 -0
- package/README.md +7 -2
- package/dist/{chunk-DJADKVYI.js → chunk-SNFO5THM.js} +20 -8
- package/dist/index.cjs +30 -8
- package/dist/index.d.cts +14 -4
- package/dist/index.d.ts +14 -4
- package/dist/index.js +14 -4
- package/dist/server.cjs +19 -7
- package/dist/server.d.cts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +3 -3
- package/dist/{types-Byp0p1r5.d.cts → types-Cpo5Fvf9.d.cts} +15 -6
- package/dist/{types-Byp0p1r5.d.ts → types-Cpo5Fvf9.d.ts} +15 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,24 @@ 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.3.0] — 2026-07-07
|
|
8
|
+
|
|
9
|
+
**Claim-time phone-share approval.** The backend closed a security gap: claiming/collecting a
|
|
10
|
+
phone-routed transfer now authorizes the collecting identity against the receiver phone before
|
|
11
|
+
crediting. So `confirmReceiptSend`/`confirmReceiptTransfer` and `claimTransfer`/`claimCurrency`
|
|
12
|
+
can now return the phone-share `409 PHONE_SHARE_APPROVAL_REQUIRED` (previously only
|
|
13
|
+
registration/mint did). The existing `InvoError.isPhoneShareApprovalRequired` already classifies
|
|
14
|
+
it — no consumer code must change — but:
|
|
15
|
+
|
|
16
|
+
- New **`InvoError.phoneShareLast4`** surfaces the `phone_last4` from the 409 body for the UI
|
|
17
|
+
("we texted the phone ending 1234").
|
|
18
|
+
- `isPhoneShareApprovalRequired` docs + the `confirmReceipt*`/claim method docs + README now
|
|
19
|
+
spell out the claim-time path: it's **not a failure** — the funds are held and the phone owner
|
|
20
|
+
is texted; show `err.message` verbatim, then **retry the same call** once approved (it succeeds
|
|
21
|
+
idempotently); on denial/expiry the sender is refunded.
|
|
22
|
+
|
|
23
|
+
Additive, no breaking changes; affects all rails' claim paths (transfer, currency send, amazon).
|
|
24
|
+
|
|
7
25
|
## [2.2.0] — 2026-07-07
|
|
8
26
|
|
|
9
27
|
**Backend reconciliation** — a full audit of the SDK against the live backend surfaced three
|
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.
|
|
5
|
+
> **Status:** `v2.3.0` — 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. Recent highlights: **2.2.0** reconciled with the backend (`mintPlayerToken` is a session mint — `playerPhone` optional; send-by-phone-alone; email-only `getPlayerBalance`); **2.3.0** surfaces the claim-time phone-share `409` on `confirmReceipt*`/`claim*` (+ `err.phoneShareLast4`). Full history in the [CHANGELOG](CHANGELOG.md).
|
|
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
|
|
@@ -370,6 +370,10 @@ try {
|
|
|
370
370
|
} catch (e) {
|
|
371
371
|
if (e instanceof InvoError && e.isReceiverNotEnrolled) {
|
|
372
372
|
// recipient has no passkey here → show claim-code entry using approved.claimCode
|
|
373
|
+
} else if (e instanceof InvoError && e.isPhoneShareApprovalRequired) {
|
|
374
|
+
// receiver phone is contested → funds held, phone owner texted to approve.
|
|
375
|
+
showPending(e.message, e.phoneShareLast4); // show e.message verbatim; last4 names the phone
|
|
376
|
+
// …then RETRY the same confirmReceipt*/claim call once approved (succeeds idempotently).
|
|
373
377
|
} else throw e;
|
|
374
378
|
}
|
|
375
379
|
```
|
|
@@ -377,6 +381,7 @@ try {
|
|
|
377
381
|
- **`verificationMethod`** (from initiate): `"in_app"` → passkey approve; `"sms"` → un-enrolled, PIN sent; `undefined` + `guardianApproval` → minor/guardian (HTTP 202), do **not** show the PIN UI. On the guardian path the SDK reports `verificationMethod: undefined` (even though the raw 202 body also carries `"sms"`) so `guardianApproval` wins — but branch on it first to be safe.
|
|
378
382
|
- **Claim codes** are returned only by `approveTransfer`; they're the out-of-band fallback when the recipient isn't enrolled.
|
|
379
383
|
- **`err.isReceiverNotEnrolled`** on `confirmReceipt*` is the explicit signal to switch to claim-code entry.
|
|
384
|
+
- **`err.isPhoneShareApprovalRequired` on `confirmReceipt*` / `claimTransfer` / `claimCurrency`** (409): the receiver phone is contested, so INVO **holds the money** and texts the phone owner to approve. Not a failure — show `err.message` verbatim (`err.phoneShareLast4` names the phone), then **retry the same call** once approved (it succeeds idempotently); on denial/expiry the sender is refunded. Same handling as the initiate-time phone-share 409.
|
|
380
385
|
- Transfer self-claim may be disabled for your tenant; if it is, surface the claim-code path instead.
|
|
381
386
|
- **Holds:** an approve/claim can return an HTTP 202 hold instead of success — inspect `result.holdReason` (`"RISK_HOLD"`, `"GUARDIAN_APPROVAL_PENDING"`, and on confirm-receipt `"RECIPIENT_IDENTITY_PENDING"`); success has no `holdReason` (and `next: "pending_claim"`). Terminal guardian outcomes throw (`GUARDIAN_APPROVAL_REJECTED`/`_EXPIRED`).
|
|
382
387
|
|
|
@@ -567,7 +572,7 @@ Helpers:
|
|
|
567
572
|
| `.retryAfter` | seconds to back off on a 429 throttle |
|
|
568
573
|
| `.isEnrollmentAuthorizationRequired` | first-enrollment needs the OTP grant → `enrollmentBegin`/`enrollmentVerify` |
|
|
569
574
|
| `.isEnrollmentProofRequired` | another method exists → prove it via `linkDevice` |
|
|
570
|
-
| `.isPhoneShareApprovalRequired` |
|
|
575
|
+
| `.isPhoneShareApprovalRequired` | phone needs owner approval — at register/mint **or** at claim/`confirmReceipt*` (contested receiver phone) → show `.message` (+ `.phoneShareLast4`), retry the same call after approval |
|
|
571
576
|
| `.isPhoneShareAlreadyApproved` | phone-share was already approved (e.g. from a `/reject`) |
|
|
572
577
|
|
|
573
578
|
Client-side guards (bad amount, missing idempotency key, `rail:"steam"` on `purchaseCurrency`, item validation) throw `InvoError` with `.status === 0` **before** any network call. Notable backend codes: `SDK_TOKEN_EXPIRED`, `TENANT_NOT_MIGRATED`, `WEBAUTHN_NOT_ENABLED_FOR_TENANT`, `WEBAUTHN_UV_REQUIRED`, `ENROLLMENT_REQUIRES_PROOF`, `ENROLLMENT_CODE_INVALID`, `PASSKEY_RECOVERY_COOLDOWN` (403, `retryAfterAt`), `no_channel_on_file`, `rate_limited`, `WRONG_RAIL_ENDPOINT`, `flow_paused`.
|
|
@@ -70,12 +70,19 @@ var InvoError = class _InvoError extends Error {
|
|
|
70
70
|
return this.code === "INSUFFICIENT_BALANCE" || "required_amount" in b || /insufficient[_ ]balance/i.test(this.message);
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
|
-
* True if the call needs phone-share approval before it can complete (409)
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
73
|
+
* True if the call needs phone-share approval before it can complete (409) — the
|
|
74
|
+
* collecting/registering identity isn't yet authorized for the phone on file. Raised by:
|
|
75
|
+
* - registration/token-mint (phone already on another INVO account), and
|
|
76
|
+
* - **claim + confirm-receipt** (`claimTransfer`/`claimCurrency`,
|
|
77
|
+
* `confirmReceiptSend`/`confirmReceiptTransfer`) — the receiver phone is contested,
|
|
78
|
+
* so INVO holds the money and texts the phone owner to approve.
|
|
79
|
+
*
|
|
80
|
+
* NOT a failure. Show `err.message` verbatim (the backend supplies the user-facing text;
|
|
81
|
+
* `phoneShareLast4` tells the UI which phone), keep the funds pending, and **retry the same
|
|
82
|
+
* call** once the phone owner approves — an approved consent makes the retry succeed
|
|
83
|
+
* idempotently. On denial/expiry the backend refunds the sender. (`phoneShareApprovalId`
|
|
84
|
+
* carries the id when the 409 came from the OTP-handshake path;
|
|
85
|
+
* `phoneShareInitiate`/`phoneShareApprove`/`phoneShareStatus` drive that fallback.)
|
|
79
86
|
*/
|
|
80
87
|
get isPhoneShareApprovalRequired() {
|
|
81
88
|
return this.code === "PHONE_SHARE_APPROVAL_REQUIRED";
|
|
@@ -85,6 +92,11 @@ var InvoError = class _InvoError extends Error {
|
|
|
85
92
|
const v = this.bodyObject()["approval_id"];
|
|
86
93
|
return typeof v === "string" && v ? v : void 0;
|
|
87
94
|
}
|
|
95
|
+
/** Last 4 digits of the phone that must approve (`phone_last4`), for the UI message. */
|
|
96
|
+
get phoneShareLast4() {
|
|
97
|
+
const v = this.bodyObject()["phone_last4"];
|
|
98
|
+
return typeof v === "string" && v ? v : void 0;
|
|
99
|
+
}
|
|
88
100
|
/** True if the phone-share (phone, requesting_email) pair was already approved. */
|
|
89
101
|
get isPhoneShareAlreadyApproved() {
|
|
90
102
|
return this.code === "PHONE_SHARE_ALREADY_APPROVED";
|
|
@@ -369,5 +381,5 @@ function toDestinationsResult(raw, direction) {
|
|
|
369
381
|
}
|
|
370
382
|
|
|
371
383
|
export { Http, InvoError, assertSecureBaseUrl, toDestinationsResult };
|
|
372
|
-
//# sourceMappingURL=chunk-
|
|
373
|
-
//# sourceMappingURL=chunk-
|
|
384
|
+
//# sourceMappingURL=chunk-SNFO5THM.js.map
|
|
385
|
+
//# sourceMappingURL=chunk-SNFO5THM.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -72,12 +72,19 @@ var InvoError = class _InvoError extends Error {
|
|
|
72
72
|
return this.code === "INSUFFICIENT_BALANCE" || "required_amount" in b || /insufficient[_ ]balance/i.test(this.message);
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
|
-
* True if the call needs phone-share approval before it can complete (409)
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
75
|
+
* True if the call needs phone-share approval before it can complete (409) — the
|
|
76
|
+
* collecting/registering identity isn't yet authorized for the phone on file. Raised by:
|
|
77
|
+
* - registration/token-mint (phone already on another INVO account), and
|
|
78
|
+
* - **claim + confirm-receipt** (`claimTransfer`/`claimCurrency`,
|
|
79
|
+
* `confirmReceiptSend`/`confirmReceiptTransfer`) — the receiver phone is contested,
|
|
80
|
+
* so INVO holds the money and texts the phone owner to approve.
|
|
81
|
+
*
|
|
82
|
+
* NOT a failure. Show `err.message` verbatim (the backend supplies the user-facing text;
|
|
83
|
+
* `phoneShareLast4` tells the UI which phone), keep the funds pending, and **retry the same
|
|
84
|
+
* call** once the phone owner approves — an approved consent makes the retry succeed
|
|
85
|
+
* idempotently. On denial/expiry the backend refunds the sender. (`phoneShareApprovalId`
|
|
86
|
+
* carries the id when the 409 came from the OTP-handshake path;
|
|
87
|
+
* `phoneShareInitiate`/`phoneShareApprove`/`phoneShareStatus` drive that fallback.)
|
|
81
88
|
*/
|
|
82
89
|
get isPhoneShareApprovalRequired() {
|
|
83
90
|
return this.code === "PHONE_SHARE_APPROVAL_REQUIRED";
|
|
@@ -87,6 +94,11 @@ var InvoError = class _InvoError extends Error {
|
|
|
87
94
|
const v = this.bodyObject()["approval_id"];
|
|
88
95
|
return typeof v === "string" && v ? v : void 0;
|
|
89
96
|
}
|
|
97
|
+
/** Last 4 digits of the phone that must approve (`phone_last4`), for the UI message. */
|
|
98
|
+
get phoneShareLast4() {
|
|
99
|
+
const v = this.bodyObject()["phone_last4"];
|
|
100
|
+
return typeof v === "string" && v ? v : void 0;
|
|
101
|
+
}
|
|
90
102
|
/** True if the phone-share (phone, requesting_email) pair was already approved. */
|
|
91
103
|
get isPhoneShareAlreadyApproved() {
|
|
92
104
|
return this.code === "PHONE_SHARE_ALREADY_APPROVED";
|
|
@@ -547,11 +559,21 @@ var InvoClient = class {
|
|
|
547
559
|
async approveTransfer(transactionId, opts) {
|
|
548
560
|
return this.approve("transfers", transactionId, opts);
|
|
549
561
|
}
|
|
550
|
-
/**
|
|
562
|
+
/**
|
|
563
|
+
* Recipient self-claims a SEND with their passkey.
|
|
564
|
+
*
|
|
565
|
+
* May throw a 409 with `err.isPhoneShareApprovalRequired` when the receiver phone is
|
|
566
|
+
* contested (the collecting identity isn't yet authorized for it). NOT a failure — the
|
|
567
|
+
* money is held and the phone owner is texted to approve. Show `err.message`
|
|
568
|
+
* (`err.phoneShareLast4` names the phone), then **retry this same call** once approved
|
|
569
|
+
* (it then succeeds idempotently); on denial/expiry the backend refunds the sender.
|
|
570
|
+
*/
|
|
551
571
|
async confirmReceiptSend(transactionId, opts) {
|
|
552
572
|
return this.confirmReceipt("send", transactionId, opts);
|
|
553
573
|
}
|
|
554
|
-
/** Recipient self-claims a TRANSFER with their passkey.
|
|
574
|
+
/** Recipient self-claims a TRANSFER with their passkey. Can throw the same phone-share
|
|
575
|
+
* 409 as {@link confirmReceiptSend} (`err.isPhoneShareApprovalRequired`) — handle it the
|
|
576
|
+
* same way: show `err.message`, retry after the phone owner approves. */
|
|
555
577
|
async confirmReceiptTransfer(transactionId, opts) {
|
|
556
578
|
return this.confirmReceipt("transfers", transactionId, opts);
|
|
557
579
|
}
|
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-
|
|
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-
|
|
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-Cpo5Fvf9.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-Cpo5Fvf9.cjs';
|
|
3
3
|
|
|
4
4
|
declare class InvoClient {
|
|
5
5
|
private readonly http;
|
|
@@ -24,9 +24,19 @@ declare class InvoClient {
|
|
|
24
24
|
approveSend(transactionId: string, opts?: CallOptions): Promise<ApproveResult>;
|
|
25
25
|
/** Approve a TRANSFER with the player's passkey (returns the sender's claim code). */
|
|
26
26
|
approveTransfer(transactionId: string, opts?: CallOptions): Promise<ApproveResult>;
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Recipient self-claims a SEND with their passkey.
|
|
29
|
+
*
|
|
30
|
+
* May throw a 409 with `err.isPhoneShareApprovalRequired` when the receiver phone is
|
|
31
|
+
* contested (the collecting identity isn't yet authorized for it). NOT a failure — the
|
|
32
|
+
* money is held and the phone owner is texted to approve. Show `err.message`
|
|
33
|
+
* (`err.phoneShareLast4` names the phone), then **retry this same call** once approved
|
|
34
|
+
* (it then succeeds idempotently); on denial/expiry the backend refunds the sender.
|
|
35
|
+
*/
|
|
28
36
|
confirmReceiptSend(transactionId: string, opts?: CallOptions): Promise<ConfirmReceiptResult>;
|
|
29
|
-
/** Recipient self-claims a TRANSFER with their passkey.
|
|
37
|
+
/** Recipient self-claims a TRANSFER with their passkey. Can throw the same phone-share
|
|
38
|
+
* 409 as {@link confirmReceiptSend} (`err.isPhoneShareApprovalRequired`) — handle it the
|
|
39
|
+
* same way: show `err.message`, retry after the phone owner approves. */
|
|
30
40
|
confirmReceiptTransfer(transactionId: string, opts?: CallOptions): Promise<ConfirmReceiptResult>;
|
|
31
41
|
/**
|
|
32
42
|
* Interchangeable methods (§4.6): prove an *already-enrolled* method (e.g. the
|
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-
|
|
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-
|
|
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-Cpo5Fvf9.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-Cpo5Fvf9.js';
|
|
3
3
|
|
|
4
4
|
declare class InvoClient {
|
|
5
5
|
private readonly http;
|
|
@@ -24,9 +24,19 @@ declare class InvoClient {
|
|
|
24
24
|
approveSend(transactionId: string, opts?: CallOptions): Promise<ApproveResult>;
|
|
25
25
|
/** Approve a TRANSFER with the player's passkey (returns the sender's claim code). */
|
|
26
26
|
approveTransfer(transactionId: string, opts?: CallOptions): Promise<ApproveResult>;
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Recipient self-claims a SEND with their passkey.
|
|
29
|
+
*
|
|
30
|
+
* May throw a 409 with `err.isPhoneShareApprovalRequired` when the receiver phone is
|
|
31
|
+
* contested (the collecting identity isn't yet authorized for it). NOT a failure — the
|
|
32
|
+
* money is held and the phone owner is texted to approve. Show `err.message`
|
|
33
|
+
* (`err.phoneShareLast4` names the phone), then **retry this same call** once approved
|
|
34
|
+
* (it then succeeds idempotently); on denial/expiry the backend refunds the sender.
|
|
35
|
+
*/
|
|
28
36
|
confirmReceiptSend(transactionId: string, opts?: CallOptions): Promise<ConfirmReceiptResult>;
|
|
29
|
-
/** Recipient self-claims a TRANSFER with their passkey.
|
|
37
|
+
/** Recipient self-claims a TRANSFER with their passkey. Can throw the same phone-share
|
|
38
|
+
* 409 as {@link confirmReceiptSend} (`err.isPhoneShareApprovalRequired`) — handle it the
|
|
39
|
+
* same way: show `err.message`, retry after the phone owner approves. */
|
|
30
40
|
confirmReceiptTransfer(transactionId: string, opts?: CallOptions): Promise<ConfirmReceiptResult>;
|
|
31
41
|
/**
|
|
32
42
|
* Interchangeable methods (§4.6): prove an *already-enrolled* method (e.g. the
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { assertSecureBaseUrl, Http, toDestinationsResult, InvoError } from './chunk-
|
|
2
|
-
export { InvoError } from './chunk-
|
|
1
|
+
import { assertSecureBaseUrl, Http, toDestinationsResult, InvoError } from './chunk-SNFO5THM.js';
|
|
2
|
+
export { InvoError } from './chunk-SNFO5THM.js';
|
|
3
3
|
|
|
4
4
|
// src/shared/webauthn.ts
|
|
5
5
|
function malformedOptions(field) {
|
|
@@ -178,11 +178,21 @@ var InvoClient = class {
|
|
|
178
178
|
async approveTransfer(transactionId, opts) {
|
|
179
179
|
return this.approve("transfers", transactionId, opts);
|
|
180
180
|
}
|
|
181
|
-
/**
|
|
181
|
+
/**
|
|
182
|
+
* Recipient self-claims a SEND with their passkey.
|
|
183
|
+
*
|
|
184
|
+
* May throw a 409 with `err.isPhoneShareApprovalRequired` when the receiver phone is
|
|
185
|
+
* contested (the collecting identity isn't yet authorized for it). NOT a failure — the
|
|
186
|
+
* money is held and the phone owner is texted to approve. Show `err.message`
|
|
187
|
+
* (`err.phoneShareLast4` names the phone), then **retry this same call** once approved
|
|
188
|
+
* (it then succeeds idempotently); on denial/expiry the backend refunds the sender.
|
|
189
|
+
*/
|
|
182
190
|
async confirmReceiptSend(transactionId, opts) {
|
|
183
191
|
return this.confirmReceipt("send", transactionId, opts);
|
|
184
192
|
}
|
|
185
|
-
/** Recipient self-claims a TRANSFER with their passkey.
|
|
193
|
+
/** Recipient self-claims a TRANSFER with their passkey. Can throw the same phone-share
|
|
194
|
+
* 409 as {@link confirmReceiptSend} (`err.isPhoneShareApprovalRequired`) — handle it the
|
|
195
|
+
* same way: show `err.message`, retry after the phone owner approves. */
|
|
186
196
|
async confirmReceiptTransfer(transactionId, opts) {
|
|
187
197
|
return this.confirmReceipt("transfers", transactionId, opts);
|
|
188
198
|
}
|
package/dist/server.cjs
CHANGED
|
@@ -74,12 +74,19 @@ var InvoError = class _InvoError extends Error {
|
|
|
74
74
|
return this.code === "INSUFFICIENT_BALANCE" || "required_amount" in b || /insufficient[_ ]balance/i.test(this.message);
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
|
-
* True if the call needs phone-share approval before it can complete (409)
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
77
|
+
* True if the call needs phone-share approval before it can complete (409) — the
|
|
78
|
+
* collecting/registering identity isn't yet authorized for the phone on file. Raised by:
|
|
79
|
+
* - registration/token-mint (phone already on another INVO account), and
|
|
80
|
+
* - **claim + confirm-receipt** (`claimTransfer`/`claimCurrency`,
|
|
81
|
+
* `confirmReceiptSend`/`confirmReceiptTransfer`) — the receiver phone is contested,
|
|
82
|
+
* so INVO holds the money and texts the phone owner to approve.
|
|
83
|
+
*
|
|
84
|
+
* NOT a failure. Show `err.message` verbatim (the backend supplies the user-facing text;
|
|
85
|
+
* `phoneShareLast4` tells the UI which phone), keep the funds pending, and **retry the same
|
|
86
|
+
* call** once the phone owner approves — an approved consent makes the retry succeed
|
|
87
|
+
* idempotently. On denial/expiry the backend refunds the sender. (`phoneShareApprovalId`
|
|
88
|
+
* carries the id when the 409 came from the OTP-handshake path;
|
|
89
|
+
* `phoneShareInitiate`/`phoneShareApprove`/`phoneShareStatus` drive that fallback.)
|
|
83
90
|
*/
|
|
84
91
|
get isPhoneShareApprovalRequired() {
|
|
85
92
|
return this.code === "PHONE_SHARE_APPROVAL_REQUIRED";
|
|
@@ -89,6 +96,11 @@ var InvoError = class _InvoError extends Error {
|
|
|
89
96
|
const v = this.bodyObject()["approval_id"];
|
|
90
97
|
return typeof v === "string" && v ? v : void 0;
|
|
91
98
|
}
|
|
99
|
+
/** Last 4 digits of the phone that must approve (`phone_last4`), for the UI message. */
|
|
100
|
+
get phoneShareLast4() {
|
|
101
|
+
const v = this.bodyObject()["phone_last4"];
|
|
102
|
+
return typeof v === "string" && v ? v : void 0;
|
|
103
|
+
}
|
|
92
104
|
/** True if the phone-share (phone, requesting_email) pair was already approved. */
|
|
93
105
|
get isPhoneShareAlreadyApproved() {
|
|
94
106
|
return this.code === "PHONE_SHARE_ALREADY_APPROVED";
|
|
@@ -536,7 +548,7 @@ async function hmacHexSubtle(secret, message) {
|
|
|
536
548
|
}
|
|
537
549
|
|
|
538
550
|
// src/server.ts
|
|
539
|
-
var DEFAULT_UA = "invonetwork-web-sdk/2.
|
|
551
|
+
var DEFAULT_UA = "invonetwork-web-sdk/2.3.0 (+https://invo.network)";
|
|
540
552
|
var MAX_USD_AMOUNT = 999.99;
|
|
541
553
|
var MAX_ITEM_PRICE = 999999.99;
|
|
542
554
|
function invalidInput(label, value, why) {
|
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-
|
|
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-
|
|
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-Cpo5Fvf9.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-Cpo5Fvf9.cjs';
|
|
3
3
|
|
|
4
4
|
interface VerifyWebhookOptions {
|
|
5
5
|
/** Max age of the signed timestamp, in seconds. Default 300 (5 min). */
|
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-
|
|
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-
|
|
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-Cpo5Fvf9.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-Cpo5Fvf9.js';
|
|
3
3
|
|
|
4
4
|
interface VerifyWebhookOptions {
|
|
5
5
|
/** Max age of the signed timestamp, in seconds. Default 300 (5 min). */
|
package/dist/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InvoError, assertSecureBaseUrl, Http, toDestinationsResult } from './chunk-
|
|
2
|
-
export { InvoError } from './chunk-
|
|
1
|
+
import { InvoError, assertSecureBaseUrl, Http, toDestinationsResult } from './chunk-SNFO5THM.js';
|
|
2
|
+
export { InvoError } from './chunk-SNFO5THM.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.
|
|
170
|
+
var DEFAULT_UA = "invonetwork-web-sdk/2.3.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) {
|
|
@@ -62,16 +62,25 @@ declare class InvoError extends Error {
|
|
|
62
62
|
*/
|
|
63
63
|
get isInsufficientBalance(): boolean;
|
|
64
64
|
/**
|
|
65
|
-
* True if the call needs phone-share approval before it can complete (409)
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
65
|
+
* True if the call needs phone-share approval before it can complete (409) — the
|
|
66
|
+
* collecting/registering identity isn't yet authorized for the phone on file. Raised by:
|
|
67
|
+
* - registration/token-mint (phone already on another INVO account), and
|
|
68
|
+
* - **claim + confirm-receipt** (`claimTransfer`/`claimCurrency`,
|
|
69
|
+
* `confirmReceiptSend`/`confirmReceiptTransfer`) — the receiver phone is contested,
|
|
70
|
+
* so INVO holds the money and texts the phone owner to approve.
|
|
71
|
+
*
|
|
72
|
+
* NOT a failure. Show `err.message` verbatim (the backend supplies the user-facing text;
|
|
73
|
+
* `phoneShareLast4` tells the UI which phone), keep the funds pending, and **retry the same
|
|
74
|
+
* call** once the phone owner approves — an approved consent makes the retry succeed
|
|
75
|
+
* idempotently. On denial/expiry the backend refunds the sender. (`phoneShareApprovalId`
|
|
76
|
+
* carries the id when the 409 came from the OTP-handshake path;
|
|
77
|
+
* `phoneShareInitiate`/`phoneShareApprove`/`phoneShareStatus` drive that fallback.)
|
|
71
78
|
*/
|
|
72
79
|
get isPhoneShareApprovalRequired(): boolean;
|
|
73
80
|
/** The `approval_id` from a phone-share 409 body, for `phoneShareApprove`. */
|
|
74
81
|
get phoneShareApprovalId(): string | undefined;
|
|
82
|
+
/** Last 4 digits of the phone that must approve (`phone_last4`), for the UI message. */
|
|
83
|
+
get phoneShareLast4(): string | undefined;
|
|
75
84
|
/** True if the phone-share (phone, requesting_email) pair was already approved. */
|
|
76
85
|
get isPhoneShareAlreadyApproved(): boolean;
|
|
77
86
|
/** True if an idempotency-keyed request was a duplicate (item purchase → 409). */
|
|
@@ -62,16 +62,25 @@ declare class InvoError extends Error {
|
|
|
62
62
|
*/
|
|
63
63
|
get isInsufficientBalance(): boolean;
|
|
64
64
|
/**
|
|
65
|
-
* True if the call needs phone-share approval before it can complete (409)
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
65
|
+
* True if the call needs phone-share approval before it can complete (409) — the
|
|
66
|
+
* collecting/registering identity isn't yet authorized for the phone on file. Raised by:
|
|
67
|
+
* - registration/token-mint (phone already on another INVO account), and
|
|
68
|
+
* - **claim + confirm-receipt** (`claimTransfer`/`claimCurrency`,
|
|
69
|
+
* `confirmReceiptSend`/`confirmReceiptTransfer`) — the receiver phone is contested,
|
|
70
|
+
* so INVO holds the money and texts the phone owner to approve.
|
|
71
|
+
*
|
|
72
|
+
* NOT a failure. Show `err.message` verbatim (the backend supplies the user-facing text;
|
|
73
|
+
* `phoneShareLast4` tells the UI which phone), keep the funds pending, and **retry the same
|
|
74
|
+
* call** once the phone owner approves — an approved consent makes the retry succeed
|
|
75
|
+
* idempotently. On denial/expiry the backend refunds the sender. (`phoneShareApprovalId`
|
|
76
|
+
* carries the id when the 409 came from the OTP-handshake path;
|
|
77
|
+
* `phoneShareInitiate`/`phoneShareApprove`/`phoneShareStatus` drive that fallback.)
|
|
71
78
|
*/
|
|
72
79
|
get isPhoneShareApprovalRequired(): boolean;
|
|
73
80
|
/** The `approval_id` from a phone-share 409 body, for `phoneShareApprove`. */
|
|
74
81
|
get phoneShareApprovalId(): string | undefined;
|
|
82
|
+
/** Last 4 digits of the phone that must approve (`phone_last4`), for the UI message. */
|
|
83
|
+
get phoneShareLast4(): string | undefined;
|
|
75
84
|
/** True if the phone-share (phone, requesting_email) pair was already approved. */
|
|
76
85
|
get isPhoneShareAlreadyApproved(): boolean;
|
|
77
86
|
/** True if an idempotency-keyed request was a duplicate (item purchase → 409). */
|
package/package.json
CHANGED