@invonetwork/web-sdk 3.0.0 → 3.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 +610 -495
- package/README.md +98 -9
- package/dist/{chunk-SPTYWJDN.js → chunk-ZLPMCR5Q.js} +104 -6
- package/dist/index.cjs +102 -4
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/server.cjs +131 -11
- package/dist/server.d.cts +54 -8
- package/dist/server.d.ts +54 -8
- package/dist/server.js +31 -9
- package/dist/{types-DMNXAGiw.d.cts → types-DzmukUr9.d.cts} +117 -3
- package/dist/{types-DMNXAGiw.d.ts → types-DzmukUr9.d.ts} +117 -3
- package/package.json +76 -76
|
@@ -7,8 +7,25 @@
|
|
|
7
7
|
* `code` when present, else fall back to `message`. See the handoff doc §8.
|
|
8
8
|
*/
|
|
9
9
|
declare class InvoError extends Error {
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Stable machine code, provider-neutral.
|
|
12
|
+
*
|
|
13
|
+
* When the backend stamps a neutral alias (`error_code_public`) — which it
|
|
14
|
+
* does for every code carrying a payment processor's name — this is that
|
|
15
|
+
* alias. Otherwise it is the wire code unchanged. Branch on this: it is the
|
|
16
|
+
* value INVO's public documentation prints, and it will not change under you
|
|
17
|
+
* if a processor does.
|
|
18
|
+
*/
|
|
11
19
|
readonly code: string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* The literal machine code on the wire, before any neutral aliasing.
|
|
22
|
+
*
|
|
23
|
+
* Equal to {@link code} for the overwhelming majority of errors. It differs
|
|
24
|
+
* only where the raw code names a processor. Provided so an integration that
|
|
25
|
+
* was already matching a raw value keeps a way to do so — but prefer
|
|
26
|
+
* {@link code} or the typed predicates below.
|
|
27
|
+
*/
|
|
28
|
+
readonly rawCode: string | undefined;
|
|
12
29
|
/** HTTP status. */
|
|
13
30
|
readonly status: number;
|
|
14
31
|
/** Raw parsed body, for debugging / fields not surfaced here. */
|
|
@@ -18,6 +35,7 @@ declare class InvoError extends Error {
|
|
|
18
35
|
constructor(args: {
|
|
19
36
|
message: string;
|
|
20
37
|
code?: string;
|
|
38
|
+
rawCode?: string;
|
|
21
39
|
status: number;
|
|
22
40
|
body?: unknown;
|
|
23
41
|
requestId?: string;
|
|
@@ -100,6 +118,58 @@ declare class InvoError extends Error {
|
|
|
100
118
|
* pick a non-Steam destination (surfaced via `DestinationGame.acceptsSteamOriginValue`).
|
|
101
119
|
*/
|
|
102
120
|
get isNonSteamValueIntoSteamBlocked(): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* True if the initiate was refused because **the caller's OWN game is in testing**
|
|
123
|
+
* (`SOURCE_GAME_NOT_LIVE`, 403). Reaches this SDK via `initiateSend` / `initiateTransfer`;
|
|
124
|
+
* the backend uses the same code on its Amazon rewards-send path too (not wrapped here),
|
|
125
|
+
* so one branch keeps working if that flow is ever added.
|
|
126
|
+
*
|
|
127
|
+
* **The caller can self-serve this**: switch the game to Live in the developer console
|
|
128
|
+
* (Game Settings → Status). Show `err.message` — it names the game and the exact control.
|
|
129
|
+
* `err.gameStatus` carries the current state if you want to render it.
|
|
130
|
+
*
|
|
131
|
+
* Deliberately distinct from {@link isTargetGameNotLive} — do NOT collapse the two into
|
|
132
|
+
* one "not live" case. The remediation differs: this one the developer can fix, the
|
|
133
|
+
* other one they cannot.
|
|
134
|
+
*/
|
|
135
|
+
get isSourceGameNotLive(): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* True if the initiate was refused because **the DESTINATION game is in testing**
|
|
138
|
+
* (`TARGET_GAME_NOT_LIVE`, 403). Reaches this SDK via `initiateSend` / `initiateTransfer`;
|
|
139
|
+
* same backend vocabulary on the Amazon rewards-send path (not wrapped here).
|
|
140
|
+
*
|
|
141
|
+
* **The caller usually CANNOT fix this** — the destination is another developer's game
|
|
142
|
+
* and only its owner can switch it to Live. Don't offer a "go fix it" action; show
|
|
143
|
+
* `err.message` and, ideally, steer the player to a different destination
|
|
144
|
+
* (`getDestinations`). `err.gameStatus` carries the current state.
|
|
145
|
+
*
|
|
146
|
+
* Deliberately distinct from {@link isSourceGameNotLive} — see the note there.
|
|
147
|
+
*/
|
|
148
|
+
get isTargetGameNotLive(): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* The game's current status from a `*_GAME_NOT_LIVE` refusal (`game_status`, e.g.
|
|
151
|
+
* `"testing"`) — for rendering the actual state. Present on both the source and target
|
|
152
|
+
* refusals.
|
|
153
|
+
*/
|
|
154
|
+
get gameStatus(): string | undefined;
|
|
155
|
+
/**
|
|
156
|
+
* True if the tenant has **no verified WebAuthn RP ID**, so passkey endpoints are dark
|
|
157
|
+
* (`WEBAUTHN_NOT_ENABLED_FOR_TENANT`, 403).
|
|
158
|
+
*
|
|
159
|
+
* **This is a configuration state, not a failure.** Passkey step-up is per-tenant and
|
|
160
|
+
* stays dark until the developer verifies a domain in the console. Treat it as
|
|
161
|
+
* "this tenant hasn't enabled passkeys yet" and fall back to the SMS/in-app path rather
|
|
162
|
+
* than surfacing an error to the player — the ceremony was never available to fail.
|
|
163
|
+
*
|
|
164
|
+
* This is currently the COMMON case, not an edge case: as of 2026-08-05 only 4 of 23
|
|
165
|
+
* sandbox tenants and **0 of 3 production tenants** have a verified RP ID. Every
|
|
166
|
+
* integration needs this branch until domain verification is widespread.
|
|
167
|
+
*
|
|
168
|
+
* The fix (for the developer's own tenant) is to verify a domain — see the passkey
|
|
169
|
+
* prerequisites in the README. Note this refusal carries the code on `code`, not
|
|
170
|
+
* `error_code`; the SDK reads both, so `err.code` is populated either way.
|
|
171
|
+
*/
|
|
172
|
+
get isWebauthnNotEnabledForTenant(): boolean;
|
|
103
173
|
/** True if the phone-share (phone, requesting_email) pair was already approved. */
|
|
104
174
|
get isPhoneShareAlreadyApproved(): boolean;
|
|
105
175
|
/** True if an idempotency-keyed request was a duplicate (item / platform purchase → 409). */
|
|
@@ -114,6 +184,34 @@ declare class InvoError extends Error {
|
|
|
114
184
|
/** True if a Platform Commerce purchase was too small for the fee to round above zero
|
|
115
185
|
* (`AMOUNT_BELOW_MINIMUM`, 400) — raise the amount. */
|
|
116
186
|
get isAmountBelowMinimum(): boolean;
|
|
187
|
+
/**
|
|
188
|
+
* True if the `rail` you sent disagrees with the storefront key you
|
|
189
|
+
* authenticated with (`RAIL_CHANNEL_MISMATCH`, 400).
|
|
190
|
+
*
|
|
191
|
+
* A storefront key already determines the rail, so the fix is to stop sending
|
|
192
|
+
* `rail` — not to send a different one. The error body carries `channel` and
|
|
193
|
+
* `rail` so you can see which storefront the key belongs to.
|
|
194
|
+
*
|
|
195
|
+
* INVO refuses rather than silently overriding, because silently overriding
|
|
196
|
+
* would bill a player through a route you did not ask for.
|
|
197
|
+
*/
|
|
198
|
+
get isRailChannelMismatch(): boolean;
|
|
199
|
+
/**
|
|
200
|
+
* True if a Steam purchase was attempted for a title INVO has not registered
|
|
201
|
+
* as distributed on Steam (`STEAM_RAIL_NOT_ENTITLED`, 403).
|
|
202
|
+
*
|
|
203
|
+
* Holding a `steam` storefront key does not by itself register the title —
|
|
204
|
+
* only INVO can do that. This is not retryable; contact INVO.
|
|
205
|
+
*/
|
|
206
|
+
get isSteamRailNotEntitled(): boolean;
|
|
207
|
+
/**
|
|
208
|
+
* True if a title distributed on Steam tried to sell currency on a non-Steam
|
|
209
|
+
* rail (`STEAM_PURCHASE_LAYER_REQUIRED`, 409).
|
|
210
|
+
*
|
|
211
|
+
* Currency for a Steam title must be bought through Steam. Use the dedicated
|
|
212
|
+
* Steam purchase flow. Not retryable on the same rail.
|
|
213
|
+
*/
|
|
214
|
+
get isSteamPurchaseLayerRequired(): boolean;
|
|
117
215
|
/** True if a Platform Commerce CARD purchase was below the processor's floor of $0.50
|
|
118
216
|
* (backend code `BELOW_STRIPE_MINIMUM`, 400). Neutral name; matches the wire code. */
|
|
119
217
|
get isBelowCardMinimum(): boolean;
|
|
@@ -223,7 +321,14 @@ interface CallOptions {
|
|
|
223
321
|
/** Public, neutral payment-rail names. Provider/processor names are an internal
|
|
224
322
|
* backend routing detail and are deliberately NOT exposed here. */
|
|
225
323
|
type Rail = "platform" | "game" | "steam";
|
|
226
|
-
/**
|
|
324
|
+
/**
|
|
325
|
+
* Verification method returned by initiate-send / initiate-transfer.
|
|
326
|
+
*
|
|
327
|
+
* These are NOT two equivalent options. `"in_app"` is the passkey (WebAuthn) approve —
|
|
328
|
+
* the gold standard and the path to build for. `"sms"` means the sender has **no passkey
|
|
329
|
+
* enrolled** and the backend fell back to a PIN; treat it as a prompt to enroll, not as a
|
|
330
|
+
* destination. The SMS-PIN path is being phased out.
|
|
331
|
+
*/
|
|
227
332
|
type VerificationMethod = "in_app" | "sms";
|
|
228
333
|
interface InvoConfig {
|
|
229
334
|
/** API base URL. Prod: "https://invo.network". Sandbox: "https://sandbox.invo.network/sandbox". */
|
|
@@ -288,7 +393,11 @@ interface InitiateTransferInput {
|
|
|
288
393
|
interface InitiateResult {
|
|
289
394
|
transactionId: string;
|
|
290
395
|
/**
|
|
291
|
-
* "in_app" → proceed to the
|
|
396
|
+
* `"in_app"` → the sender has a passkey; proceed to the approve flow (the recommended
|
|
397
|
+
* and only non-deprecated path). `"sms"` → the sender has **no passkey**, so a PIN was
|
|
398
|
+
* sent as a last-resort fallback — the best response is to offer `enrollPasskey()` and
|
|
399
|
+
* then `approveSend`/`approveTransfer`, falling back to the PIN pad only if they can't
|
|
400
|
+
* or won't enroll. The SMS-PIN completion is being phased out.
|
|
292
401
|
* `undefined` when the backend returned the minor/guardian path (HTTP 202) and
|
|
293
402
|
* no verification method applies yet — check `guardianApproval` and do NOT route
|
|
294
403
|
* the user into the SMS-PIN UI in that case (§4.3 / §8).
|
|
@@ -752,6 +861,11 @@ interface LinkDeviceResult {
|
|
|
752
861
|
status: string;
|
|
753
862
|
raw: Record<string, unknown>;
|
|
754
863
|
}
|
|
864
|
+
/**
|
|
865
|
+
* Result of `verifySmsTransfer` / `verifySmsSend` — the last-resort path for senders with
|
|
866
|
+
* no passkey. The SMS-PIN completion is being phased out; passkey approve
|
|
867
|
+
* (`InvoClient.approveSend` / `approveTransfer`) is the gold standard.
|
|
868
|
+
*/
|
|
755
869
|
interface SmsVerifyResult {
|
|
756
870
|
/** "success" on a completed verification. */
|
|
757
871
|
status: string;
|
package/package.json
CHANGED
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@invonetwork/web-sdk",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"description": "INVO Web SDK — currency purchase + passkey (WebAuthn) verification for partner web platforms.",
|
|
5
|
-
"license": "SEE LICENSE IN LICENSE",
|
|
6
|
-
"private": false,
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/Invo-Technologies/invo-web-sdk.git"
|
|
10
|
-
},
|
|
11
|
-
"homepage": "https://docs.invo.network",
|
|
12
|
-
"bugs": {
|
|
13
|
-
"url": "https://github.com/Invo-Technologies/invo-web-sdk/issues"
|
|
14
|
-
},
|
|
15
|
-
"type": "module",
|
|
16
|
-
"engines": {
|
|
17
|
-
"node": ">=18"
|
|
18
|
-
},
|
|
19
|
-
"sideEffects": false,
|
|
20
|
-
"files": [
|
|
21
|
-
"dist",
|
|
22
|
-
"!dist/**/*.map",
|
|
23
|
-
"README.md",
|
|
24
|
-
"LICENSE",
|
|
25
|
-
"CHANGELOG.md"
|
|
26
|
-
],
|
|
27
|
-
"exports": {
|
|
28
|
-
".": {
|
|
29
|
-
"types": "./dist/index.d.ts",
|
|
30
|
-
"import": "./dist/index.js",
|
|
31
|
-
"require": "./dist/index.cjs"
|
|
32
|
-
},
|
|
33
|
-
"./server": {
|
|
34
|
-
"types": "./dist/server.d.ts",
|
|
35
|
-
"import": "./dist/server.js",
|
|
36
|
-
"require": "./dist/server.cjs"
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
"main": "./dist/index.cjs",
|
|
40
|
-
"module": "./dist/index.js",
|
|
41
|
-
"types": "./dist/index.d.ts",
|
|
42
|
-
"scripts": {
|
|
43
|
-
"build": "tsup",
|
|
44
|
-
"dev": "tsup --watch",
|
|
45
|
-
"typecheck": "tsc --noEmit",
|
|
46
|
-
"lint": "eslint .",
|
|
47
|
-
"test": "vitest run",
|
|
48
|
-
"test:watch": "vitest",
|
|
49
|
-
"clean": "rimraf dist",
|
|
50
|
-
"changeset": "changeset",
|
|
51
|
-
"version-packages": "changeset version",
|
|
52
|
-
"release": "npm run build && changeset publish",
|
|
53
|
-
"prepublishOnly": "npm run clean && npm run build"
|
|
54
|
-
},
|
|
55
|
-
"keywords": [
|
|
56
|
-
"invo",
|
|
57
|
-
"webauthn",
|
|
58
|
-
"passkey",
|
|
59
|
-
"payments",
|
|
60
|
-
"game-currency",
|
|
61
|
-
"sdk"
|
|
62
|
-
],
|
|
63
|
-
"publishConfig": {
|
|
64
|
-
"access": "public"
|
|
65
|
-
},
|
|
66
|
-
"devDependencies": {
|
|
67
|
-
"@changesets/cli": "^2.31.0",
|
|
68
|
-
"@eslint/js": "^10.0.1",
|
|
69
|
-
"eslint": "^10.6.0",
|
|
70
|
-
"rimraf": "^5.0.5",
|
|
71
|
-
"tsup": "^8.0.1",
|
|
72
|
-
"typescript": "^5.4.5",
|
|
73
|
-
"typescript-eslint": "^8.62.1",
|
|
74
|
-
"vitest": "^1.5.0"
|
|
75
|
-
}
|
|
76
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@invonetwork/web-sdk",
|
|
3
|
+
"version": "3.2.0",
|
|
4
|
+
"description": "INVO Web SDK — currency purchase + passkey (WebAuthn) verification for partner web platforms.",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
6
|
+
"private": false,
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/Invo-Technologies/invo-web-sdk.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://docs.invo.network",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/Invo-Technologies/invo-web-sdk/issues"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=18"
|
|
18
|
+
},
|
|
19
|
+
"sideEffects": false,
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"!dist/**/*.map",
|
|
23
|
+
"README.md",
|
|
24
|
+
"LICENSE",
|
|
25
|
+
"CHANGELOG.md"
|
|
26
|
+
],
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"import": "./dist/index.js",
|
|
31
|
+
"require": "./dist/index.cjs"
|
|
32
|
+
},
|
|
33
|
+
"./server": {
|
|
34
|
+
"types": "./dist/server.d.ts",
|
|
35
|
+
"import": "./dist/server.js",
|
|
36
|
+
"require": "./dist/server.cjs"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"main": "./dist/index.cjs",
|
|
40
|
+
"module": "./dist/index.js",
|
|
41
|
+
"types": "./dist/index.d.ts",
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsup",
|
|
44
|
+
"dev": "tsup --watch",
|
|
45
|
+
"typecheck": "tsc --noEmit",
|
|
46
|
+
"lint": "eslint .",
|
|
47
|
+
"test": "vitest run",
|
|
48
|
+
"test:watch": "vitest",
|
|
49
|
+
"clean": "rimraf dist",
|
|
50
|
+
"changeset": "changeset",
|
|
51
|
+
"version-packages": "changeset version",
|
|
52
|
+
"release": "npm run build && changeset publish",
|
|
53
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
54
|
+
},
|
|
55
|
+
"keywords": [
|
|
56
|
+
"invo",
|
|
57
|
+
"webauthn",
|
|
58
|
+
"passkey",
|
|
59
|
+
"payments",
|
|
60
|
+
"game-currency",
|
|
61
|
+
"sdk"
|
|
62
|
+
],
|
|
63
|
+
"publishConfig": {
|
|
64
|
+
"access": "public"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@changesets/cli": "^2.31.0",
|
|
68
|
+
"@eslint/js": "^10.0.1",
|
|
69
|
+
"eslint": "^10.6.0",
|
|
70
|
+
"rimraf": "^5.0.5",
|
|
71
|
+
"tsup": "^8.0.1",
|
|
72
|
+
"typescript": "^5.4.5",
|
|
73
|
+
"typescript-eslint": "^8.62.1",
|
|
74
|
+
"vitest": "^1.5.0"
|
|
75
|
+
}
|
|
76
|
+
}
|