@invonetwork/web-sdk 3.26.0 → 3.27.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 +1369 -1350
- package/README.md +119 -1
- package/dist/chunk-2DYTV74W.js +3681 -0
- package/dist/chunk-3YDO7GSH.js +6 -0
- package/dist/chunk-6CN236QH.js +473 -0
- package/dist/{chunk-7BYAUHTA.js → chunk-VP3OK4J4.js} +56 -459
- package/dist/game-server.cjs +5933 -0
- package/dist/game-server.d.cts +185 -0
- package/dist/game-server.d.ts +185 -0
- package/dist/game-server.js +716 -0
- package/dist/game.cjs +2172 -0
- package/dist/game.d.cts +197 -0
- package/dist/game.d.ts +197 -0
- package/dist/game.js +1034 -0
- package/dist/index.cjs +87 -0
- package/dist/index.d.cts +19 -3
- package/dist/index.d.ts +19 -3
- package/dist/index.js +26 -2
- package/dist/server.cjs +98 -1
- package/dist/server.d.cts +28 -10
- package/dist/server.d.ts +28 -10
- package/dist/server.js +4 -3649
- package/dist/types-CoW9LopI.d.cts +143 -0
- package/dist/types-CoW9LopI.d.ts +143 -0
- package/dist/{types-Cjd4SAR8.d.cts → types-_lIm74kd.d.cts} +40 -1
- package/dist/{types-Cjd4SAR8.d.ts → types-_lIm74kd.d.ts} +40 -1
- package/dist/version-BXFwI0-s.d.cts +8 -0
- package/dist/version-BXFwI0-s.d.ts +8 -0
- package/package.json +91 -77
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* INVO game economy layer (3.27.0) — types shared by `@invonetwork/web-sdk/game` (browser)
|
|
3
|
+
* and `@invonetwork/web-sdk/game-server` (Node). Types only: nothing here runs, so the
|
|
4
|
+
* browser bundle never pulls in server code.
|
|
5
|
+
*
|
|
6
|
+
* The model, in one paragraph: a game has two currencies. PREMIUM currency is the game's
|
|
7
|
+
* INVO currency — bought with real money through INVO's hosted checkout, held and debited
|
|
8
|
+
* by INVO (INVO is its ledger). SOFT currency is earned by playing and is held by your game
|
|
9
|
+
* server's own ledger. Items in the shop are priced in one or the other. The browser never
|
|
10
|
+
* decides a balance: it asks your game server, which asks INVO.
|
|
11
|
+
*/
|
|
12
|
+
/** Which currency an item is priced in. */
|
|
13
|
+
type GameCurrencyKind = "premium" | "soft";
|
|
14
|
+
/** One item in the shop. Prices are whole units of the currency. */
|
|
15
|
+
interface GameCatalogItem {
|
|
16
|
+
/** Stable id, sent to INVO as `item_id` for premium items. Letters, digits, `-`, `_`, `.`. */
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
/** Free-form grouping, e.g. `"cosmetic"` or `"upgrade"`. Sent to INVO as `item_category`. */
|
|
21
|
+
category: string;
|
|
22
|
+
currency: GameCurrencyKind;
|
|
23
|
+
/** Price in whole units of `currency`, 1..999999. */
|
|
24
|
+
price: number;
|
|
25
|
+
/**
|
|
26
|
+
* How many a player may own. `1` for a cosmetic (a second purchase is refused with
|
|
27
|
+
* `ALREADY_OWNED`), higher for stackable upgrades. Default 1.
|
|
28
|
+
*/
|
|
29
|
+
maxOwned?: number;
|
|
30
|
+
/** Optional display colour (CSS) for the shop tile. */
|
|
31
|
+
color?: string;
|
|
32
|
+
/** Optional icon glyph or short label for the shop tile. */
|
|
33
|
+
icon?: string;
|
|
34
|
+
}
|
|
35
|
+
/** A premium-currency pack sold for real money through INVO's hosted checkout. */
|
|
36
|
+
interface GamePremiumPack {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
/** List price in USD, as INVO expects it: a decimal string such as `"4.99"`. */
|
|
40
|
+
usdAmount: string;
|
|
41
|
+
/** How many premium units the pack is advertised as (display only; INVO credits the real amount). */
|
|
42
|
+
amount?: number;
|
|
43
|
+
/** Optional badge, e.g. `"Best value"`. */
|
|
44
|
+
badge?: string;
|
|
45
|
+
}
|
|
46
|
+
/** Your game's economy: the shop, the packs and the soft-currency rules. */
|
|
47
|
+
interface GameEconomyConfig {
|
|
48
|
+
premium: {
|
|
49
|
+
/** Display name of the premium currency, e.g. `"Gems"`. Should match the INVO console. */
|
|
50
|
+
name: string;
|
|
51
|
+
packs: GamePremiumPack[];
|
|
52
|
+
};
|
|
53
|
+
soft: {
|
|
54
|
+
/** Display name of the soft currency, e.g. `"Coins"`. */
|
|
55
|
+
name: string;
|
|
56
|
+
/** Granted once when a player first joins. Default 0. */
|
|
57
|
+
startingBalance?: number;
|
|
58
|
+
/** Largest single `earn` call the server accepts. Default 1000. */
|
|
59
|
+
maxEarnPerRequest?: number;
|
|
60
|
+
/** Most soft currency one player may earn in any rolling minute. Default 10000. */
|
|
61
|
+
maxEarnPerMinute?: number;
|
|
62
|
+
};
|
|
63
|
+
items: GameCatalogItem[];
|
|
64
|
+
}
|
|
65
|
+
/** A balance as the game shows it. `null` when INVO could not be reached this time. */
|
|
66
|
+
interface GameCurrencyBalance {
|
|
67
|
+
kind: GameCurrencyKind;
|
|
68
|
+
name: string;
|
|
69
|
+
balance: number | null;
|
|
70
|
+
}
|
|
71
|
+
interface GameWallet {
|
|
72
|
+
premium: GameCurrencyBalance;
|
|
73
|
+
soft: GameCurrencyBalance;
|
|
74
|
+
/** Item id → quantity owned. */
|
|
75
|
+
inventory: Record<string, number>;
|
|
76
|
+
/** ISO time the server read this wallet. */
|
|
77
|
+
asOf: string;
|
|
78
|
+
}
|
|
79
|
+
interface GamePlayer {
|
|
80
|
+
id: string;
|
|
81
|
+
email: string;
|
|
82
|
+
name: string;
|
|
83
|
+
/** Masked, e.g. `•••0111`. The full number never leaves the server after sign-in. */
|
|
84
|
+
phoneMasked: string | null;
|
|
85
|
+
}
|
|
86
|
+
/** `POST /session` answer. */
|
|
87
|
+
interface GameSession {
|
|
88
|
+
sessionToken: string;
|
|
89
|
+
expiresAt: string;
|
|
90
|
+
player: GamePlayer;
|
|
91
|
+
wallet: GameWallet;
|
|
92
|
+
}
|
|
93
|
+
/** `GET /catalog` answer. */
|
|
94
|
+
interface GameCatalog {
|
|
95
|
+
premium: {
|
|
96
|
+
name: string;
|
|
97
|
+
packs: GamePremiumPack[];
|
|
98
|
+
};
|
|
99
|
+
soft: {
|
|
100
|
+
name: string;
|
|
101
|
+
};
|
|
102
|
+
items: GameCatalogItem[];
|
|
103
|
+
/** True when the server talks to INVO's sandbox (no real money moves). */
|
|
104
|
+
sandbox: boolean;
|
|
105
|
+
}
|
|
106
|
+
/** Status of a premium-currency purchase, as the game server knows it. */
|
|
107
|
+
type GamePurchaseStatus = "pending" | "credited" | "failed" | "refunded";
|
|
108
|
+
interface GamePurchase {
|
|
109
|
+
purchaseRef: string;
|
|
110
|
+
packId: string;
|
|
111
|
+
status: GamePurchaseStatus;
|
|
112
|
+
/** Premium units INVO credited (from the signed `purchase.completed` webhook). */
|
|
113
|
+
credited: number | null;
|
|
114
|
+
createdAt: string;
|
|
115
|
+
updatedAt: string;
|
|
116
|
+
}
|
|
117
|
+
/** `POST /checkout` answer: open `checkoutUrl`, then poll `GET /purchases/{purchaseRef}`. */
|
|
118
|
+
interface GameCheckout {
|
|
119
|
+
purchaseRef: string;
|
|
120
|
+
checkoutUrl: string;
|
|
121
|
+
expiresAt: string;
|
|
122
|
+
}
|
|
123
|
+
/** `POST /items/{id}/buy` answer. */
|
|
124
|
+
interface GameItemPurchase {
|
|
125
|
+
itemId: string;
|
|
126
|
+
quantity: number;
|
|
127
|
+
currency: GameCurrencyKind;
|
|
128
|
+
/** INVO's transaction id for premium items; the ledger entry id for soft items. */
|
|
129
|
+
transactionId: string;
|
|
130
|
+
/** True when this answer replays an earlier request with the same `clientRequestId`. */
|
|
131
|
+
replayed: boolean;
|
|
132
|
+
wallet: GameWallet;
|
|
133
|
+
}
|
|
134
|
+
/** Error body every game-server route answers with on failure. */
|
|
135
|
+
interface GameErrorBody {
|
|
136
|
+
error: {
|
|
137
|
+
code: string;
|
|
138
|
+
message: string;
|
|
139
|
+
requestId?: string;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export type { GameCurrencyKind as G, GamePurchaseStatus as a, GameEconomyConfig as b, GameCatalog as c, GameCatalogItem as d, GameCheckout as e, GameCurrencyBalance as f, GameErrorBody as g, GameItemPurchase as h, GamePlayer as i, GamePremiumPack as j, GamePurchase as k, GameSession as l, GameWallet as m };
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* INVO game economy layer (3.27.0) — types shared by `@invonetwork/web-sdk/game` (browser)
|
|
3
|
+
* and `@invonetwork/web-sdk/game-server` (Node). Types only: nothing here runs, so the
|
|
4
|
+
* browser bundle never pulls in server code.
|
|
5
|
+
*
|
|
6
|
+
* The model, in one paragraph: a game has two currencies. PREMIUM currency is the game's
|
|
7
|
+
* INVO currency — bought with real money through INVO's hosted checkout, held and debited
|
|
8
|
+
* by INVO (INVO is its ledger). SOFT currency is earned by playing and is held by your game
|
|
9
|
+
* server's own ledger. Items in the shop are priced in one or the other. The browser never
|
|
10
|
+
* decides a balance: it asks your game server, which asks INVO.
|
|
11
|
+
*/
|
|
12
|
+
/** Which currency an item is priced in. */
|
|
13
|
+
type GameCurrencyKind = "premium" | "soft";
|
|
14
|
+
/** One item in the shop. Prices are whole units of the currency. */
|
|
15
|
+
interface GameCatalogItem {
|
|
16
|
+
/** Stable id, sent to INVO as `item_id` for premium items. Letters, digits, `-`, `_`, `.`. */
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
/** Free-form grouping, e.g. `"cosmetic"` or `"upgrade"`. Sent to INVO as `item_category`. */
|
|
21
|
+
category: string;
|
|
22
|
+
currency: GameCurrencyKind;
|
|
23
|
+
/** Price in whole units of `currency`, 1..999999. */
|
|
24
|
+
price: number;
|
|
25
|
+
/**
|
|
26
|
+
* How many a player may own. `1` for a cosmetic (a second purchase is refused with
|
|
27
|
+
* `ALREADY_OWNED`), higher for stackable upgrades. Default 1.
|
|
28
|
+
*/
|
|
29
|
+
maxOwned?: number;
|
|
30
|
+
/** Optional display colour (CSS) for the shop tile. */
|
|
31
|
+
color?: string;
|
|
32
|
+
/** Optional icon glyph or short label for the shop tile. */
|
|
33
|
+
icon?: string;
|
|
34
|
+
}
|
|
35
|
+
/** A premium-currency pack sold for real money through INVO's hosted checkout. */
|
|
36
|
+
interface GamePremiumPack {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
/** List price in USD, as INVO expects it: a decimal string such as `"4.99"`. */
|
|
40
|
+
usdAmount: string;
|
|
41
|
+
/** How many premium units the pack is advertised as (display only; INVO credits the real amount). */
|
|
42
|
+
amount?: number;
|
|
43
|
+
/** Optional badge, e.g. `"Best value"`. */
|
|
44
|
+
badge?: string;
|
|
45
|
+
}
|
|
46
|
+
/** Your game's economy: the shop, the packs and the soft-currency rules. */
|
|
47
|
+
interface GameEconomyConfig {
|
|
48
|
+
premium: {
|
|
49
|
+
/** Display name of the premium currency, e.g. `"Gems"`. Should match the INVO console. */
|
|
50
|
+
name: string;
|
|
51
|
+
packs: GamePremiumPack[];
|
|
52
|
+
};
|
|
53
|
+
soft: {
|
|
54
|
+
/** Display name of the soft currency, e.g. `"Coins"`. */
|
|
55
|
+
name: string;
|
|
56
|
+
/** Granted once when a player first joins. Default 0. */
|
|
57
|
+
startingBalance?: number;
|
|
58
|
+
/** Largest single `earn` call the server accepts. Default 1000. */
|
|
59
|
+
maxEarnPerRequest?: number;
|
|
60
|
+
/** Most soft currency one player may earn in any rolling minute. Default 10000. */
|
|
61
|
+
maxEarnPerMinute?: number;
|
|
62
|
+
};
|
|
63
|
+
items: GameCatalogItem[];
|
|
64
|
+
}
|
|
65
|
+
/** A balance as the game shows it. `null` when INVO could not be reached this time. */
|
|
66
|
+
interface GameCurrencyBalance {
|
|
67
|
+
kind: GameCurrencyKind;
|
|
68
|
+
name: string;
|
|
69
|
+
balance: number | null;
|
|
70
|
+
}
|
|
71
|
+
interface GameWallet {
|
|
72
|
+
premium: GameCurrencyBalance;
|
|
73
|
+
soft: GameCurrencyBalance;
|
|
74
|
+
/** Item id → quantity owned. */
|
|
75
|
+
inventory: Record<string, number>;
|
|
76
|
+
/** ISO time the server read this wallet. */
|
|
77
|
+
asOf: string;
|
|
78
|
+
}
|
|
79
|
+
interface GamePlayer {
|
|
80
|
+
id: string;
|
|
81
|
+
email: string;
|
|
82
|
+
name: string;
|
|
83
|
+
/** Masked, e.g. `•••0111`. The full number never leaves the server after sign-in. */
|
|
84
|
+
phoneMasked: string | null;
|
|
85
|
+
}
|
|
86
|
+
/** `POST /session` answer. */
|
|
87
|
+
interface GameSession {
|
|
88
|
+
sessionToken: string;
|
|
89
|
+
expiresAt: string;
|
|
90
|
+
player: GamePlayer;
|
|
91
|
+
wallet: GameWallet;
|
|
92
|
+
}
|
|
93
|
+
/** `GET /catalog` answer. */
|
|
94
|
+
interface GameCatalog {
|
|
95
|
+
premium: {
|
|
96
|
+
name: string;
|
|
97
|
+
packs: GamePremiumPack[];
|
|
98
|
+
};
|
|
99
|
+
soft: {
|
|
100
|
+
name: string;
|
|
101
|
+
};
|
|
102
|
+
items: GameCatalogItem[];
|
|
103
|
+
/** True when the server talks to INVO's sandbox (no real money moves). */
|
|
104
|
+
sandbox: boolean;
|
|
105
|
+
}
|
|
106
|
+
/** Status of a premium-currency purchase, as the game server knows it. */
|
|
107
|
+
type GamePurchaseStatus = "pending" | "credited" | "failed" | "refunded";
|
|
108
|
+
interface GamePurchase {
|
|
109
|
+
purchaseRef: string;
|
|
110
|
+
packId: string;
|
|
111
|
+
status: GamePurchaseStatus;
|
|
112
|
+
/** Premium units INVO credited (from the signed `purchase.completed` webhook). */
|
|
113
|
+
credited: number | null;
|
|
114
|
+
createdAt: string;
|
|
115
|
+
updatedAt: string;
|
|
116
|
+
}
|
|
117
|
+
/** `POST /checkout` answer: open `checkoutUrl`, then poll `GET /purchases/{purchaseRef}`. */
|
|
118
|
+
interface GameCheckout {
|
|
119
|
+
purchaseRef: string;
|
|
120
|
+
checkoutUrl: string;
|
|
121
|
+
expiresAt: string;
|
|
122
|
+
}
|
|
123
|
+
/** `POST /items/{id}/buy` answer. */
|
|
124
|
+
interface GameItemPurchase {
|
|
125
|
+
itemId: string;
|
|
126
|
+
quantity: number;
|
|
127
|
+
currency: GameCurrencyKind;
|
|
128
|
+
/** INVO's transaction id for premium items; the ledger entry id for soft items. */
|
|
129
|
+
transactionId: string;
|
|
130
|
+
/** True when this answer replays an earlier request with the same `clientRequestId`. */
|
|
131
|
+
replayed: boolean;
|
|
132
|
+
wallet: GameWallet;
|
|
133
|
+
}
|
|
134
|
+
/** Error body every game-server route answers with on failure. */
|
|
135
|
+
interface GameErrorBody {
|
|
136
|
+
error: {
|
|
137
|
+
code: string;
|
|
138
|
+
message: string;
|
|
139
|
+
requestId?: string;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export type { GameCurrencyKind as G, GamePurchaseStatus as a, GameEconomyConfig as b, GameCatalog as c, GameCatalogItem as d, GameCheckout as e, GameCurrencyBalance as f, GameErrorBody as g, GameItemPurchase as h, GamePlayer as i, GamePremiumPack as j, GamePurchase as k, GameSession as l, GameWallet as m };
|
|
@@ -913,6 +913,45 @@ declare class Http {
|
|
|
913
913
|
private backoff;
|
|
914
914
|
}
|
|
915
915
|
|
|
916
|
+
/**
|
|
917
|
+
* Gameplay event types your game reports to INVO's loyalty engine (3.27.0). Currency steps
|
|
918
|
+
* (purchases, transfers, sends, item spending, subscriptions) are seen by INVO directly and
|
|
919
|
+
* are never reported; reporting one is refused with `RESERVED_EVENT_TYPE`.
|
|
920
|
+
*
|
|
921
|
+
* - `game.session.started` / `game.session.heartbeat`: payload `{ session_ref }`
|
|
922
|
+
* - `game.session.ended`: payload `{ session_ref, duration_seconds }`
|
|
923
|
+
* - `game.milestone.reached`: payload `{ milestone_key, value?, session_ref? }` (e.g. `level_10`)
|
|
924
|
+
* - `game.custom.recorded`: payload `{ event_name, value? }`; the name must be registered in
|
|
925
|
+
* the console first, else `422 validation_failed`
|
|
926
|
+
*/
|
|
927
|
+
type GameEventType = "game.session.started" | "game.session.heartbeat" | "game.session.ended" | "game.milestone.reached" | "game.custom.recorded" | (string & {});
|
|
928
|
+
/** One gameplay event, reported by the player's browser (`InvoClient.reportGameEvent`). */
|
|
929
|
+
interface ReportGameEventInput {
|
|
930
|
+
/** A `game.*` type; see {@link GameEventType}. */
|
|
931
|
+
eventType: GameEventType;
|
|
932
|
+
/**
|
|
933
|
+
* Idempotency key (a UUID). Resend the SAME id when you retry, so INVO counts the event
|
|
934
|
+
* once. The SDK generates one when you leave it out, and returns it.
|
|
935
|
+
*/
|
|
936
|
+
eventId?: string;
|
|
937
|
+
/** When it happened: ISO 8601 with a timezone, or a Date. Defaults to INVO's receive time. */
|
|
938
|
+
occurredAt?: string | Date;
|
|
939
|
+
/** The event's fields (see {@link GameEventType}). */
|
|
940
|
+
payload?: Record<string, unknown>;
|
|
941
|
+
}
|
|
942
|
+
/** One gameplay event reported by your SERVER (`InvoServer.reportGameEvent`), trusted for rewards. */
|
|
943
|
+
interface ReportServerGameEventInput extends ReportGameEventInput {
|
|
944
|
+
/** The player in your game, by email. */
|
|
945
|
+
playerEmail: string;
|
|
946
|
+
}
|
|
947
|
+
interface ReportGameEventResult {
|
|
948
|
+
/** True when INVO recorded the event (202). */
|
|
949
|
+
accepted: boolean;
|
|
950
|
+
/** The event id INVO received: yours, or the one the SDK generated. Reuse it on a retry. */
|
|
951
|
+
eventId: string;
|
|
952
|
+
raw: Record<string, unknown>;
|
|
953
|
+
}
|
|
954
|
+
|
|
916
955
|
/** Per-call options (e.g. cancellation). Accepted as an optional last arg on SDK methods. */
|
|
917
956
|
interface CallOptions {
|
|
918
957
|
/** Cancel this call. Aborting throws an InvoError (code "ABORTED"); aborted calls are never retried. */
|
|
@@ -3701,4 +3740,4 @@ interface RewardsPageLink {
|
|
|
3701
3740
|
raw: Record<string, unknown>;
|
|
3702
3741
|
}
|
|
3703
3742
|
|
|
3704
|
-
export { type
|
|
3743
|
+
export { type PurchaseRefusalReason as $, type ApproveResult as A, type BalanceResult as B, type ConfirmReceiptResult as C, type DestinationsQuery as D, type EnrollmentBeginResult as E, type InvoErrorInfo as F, type GameEventType as G, Http as H, InvoError as I, type InvoHooks as J, type InvoRequestInfo as K, type LinkDeviceResult as L, type MountCheckoutOptions as M, type InvoResponseInfo as N, type LoyaltyCard as O, type PurchaseStatusResult as P, type LoyaltyCardReward as Q, type RedeemRewardResult as R, type LoyaltyCardStep as S, type LoyaltyRewardState as T, type LoyaltyStepProgress as U, type LoyaltyStepState as V, type WaitForPurchaseInput as W, type LoyaltyVaultEntry as X, type PendingCollectItem as Y, type PhoneChangeApproval as Z, type PhoneChangeDeviceSignal as _, type PurchaseCredited as a, type SteamFinalizeResult as a$, type Rail as a0, type VerificationMethod as a1, type AuthHeader as a2, type PlatformPurchaseInput as a3, type PlatformPurchaseResult as a4, type PlatformOrderStatusResult as a5, type PlatformPurchaseHistoryQuery as a6, type PlatformPurchaseHistoryResult as a7, type PlatformRefundInput as a8, type PlatformRefundResult as a9, type SandboxForceAuthChallengeOptions as aA, type ServerConfig as aB, type MintPlayerTokenInput as aC, type PlayerToken as aD, type RegisterPlayerInput as aE, type RegisterPlayerResult as aF, type UpdatePlayerPhoneInput as aG, type UpdatePlayerPhoneResult as aH, type RequestPhoneChangeInput as aI, type RequestPhoneChangeResult as aJ, type PhoneChangeRequest as aK, type InitiateSendInput as aL, type InitiateResult as aM, type InitiateTransferInput as aN, type CreateCheckoutInput as aO, type CreateCheckoutResult as aP, type PurchaseInput as aQ, type PurchaseResult as aR, type CurrencyPurchaseQuoteInput as aS, type CurrencyPurchaseQuote as aT, type ConfirmPaymentResult as aU, type OrderDetailsResult as aV, type SteamPacksQuery as aW, type SteamPacksResult as aX, type SteamInitPurchaseInput as aY, type SteamInitPurchaseResult as aZ, type SteamFinalizeInput as a_, type CreateSubscriptionInput as aa, type SubscriptionResult as ab, type GetSubscriptionOptions as ac, type GetSubscriptionResult as ad, type ListSubscriptionsOptions as ae, type SubscriptionListResult as af, type CancelSubscriptionOptions as ag, type CancelResult as ah, type ChangeAmountResult as ai, type SetPaymentMethodInput as aj, type SetPaymentMethodResult as ak, type RefundSubscriptionInput as al, type RefundResult as am, type SteamSubscriptionInitInput as an, type SteamInitResult as ao, type SteamFinalizeSubscriptionResult as ap, type CardSetupSessionInput as aq, type CardSetupSessionResult as ar, type CardSetupInput as as, type CardSetupResult as at, type CardSetupConfirmInput as au, type CardSetupConfirmResult as av, type PlayerCardsResult as aw, type SandboxClockResult as ax, type SandboxFailureOutcome as ay, type SandboxForceFailureOptions as az, type PurchaseExpired as b, type RefundRevenueShareAttribution as b$, type PurchaseItemInput as b0, type PurchaseItemResult as b1, type ItemHistoryQuery as b2, type ItemHistoryResult as b3, type ItemOrderQuery as b4, type PlayerActivityQuery as b5, type PlayerActivityResult as b6, type PlayerActivityEntry as b7, type PlayerBalanceQuery as b8, type PlayerBalanceResult as b9, type CompleteDeviceApprovalResult as bA, type CardSetupStatus as bB, type CheckoutWarning as bC, type CurrencyBalance as bD, type CurrencyPurchaseQuoteBreakdown as bE, type DeviceApprovalChannel as bF, type DeviceApprovalEnrollment as bG, type DeviceApprovalFlow as bH, type DeviceApprovalPollStatus as bI, type DeviceEnrollmentDecision as bJ, type DeviceEnrollmentRespond as bK, type ExpiryReason as bL, type FeeTakenFrom as bM, type FirstCharge as bN, type FirstChargeStatus as bO, type FundingSource as bP, type InboundPendingItem as bQ, type LinkedIdentityEmail as bR, type MinPurchaseWarning as bS, type PhoneChangeConfirmation as bT, type PhoneChangeRequestStatus as bU, type PlatformPurchaseStatus as bV, type PlayerActivityType as bW, type RefundInitiation as bX, type RefundPendingApproval as bY, type RefundProcessingFeeBasis as bZ, type RefundReceipt as b_, type ReportServerGameEventInput as ba, type InboundPendingQuery as bb, type InboundPendingResult as bc, type LinkedIdentitiesQuery as bd, type LinkedIdentitiesResult as be, type SmsVerifyResult as bf, type ClaimTransferInput as bg, type ClaimResult as bh, type ClaimCurrencyInput as bi, type TransactionStatusResult as bj, type GuardianApprovalStatusResult as bk, type ServerDestinationsQuery as bl, type PhoneShareContact as bm, type PhoneShareInitiateResult as bn, type PhoneShareApproveInput as bo, type PhoneShareApproveResult as bp, type PhoneShareStatusResult as bq, type BeginDeviceApprovalInput as br, type DeviceApprovalGrant as bs, type PollDeviceApprovalInput as bt, type DeviceApprovalPollResult as bu, type ConfirmDeviceEnrollmentInput as bv, type ConfirmDeviceEnrollmentResult as bw, type ApproveWithDeviceCodeInput as bx, type DeviceApprovalSettleResult as by, type CompleteDeviceApprovalInput as bz, type PurchaseRefunded as c, type RefundWarning as c0, type SandboxClockState as c1, type SavedCard as c2, type SteamPack as c3, type SteamUserSession as c4, type Subscription as c5, type SubscriptionBaseInput as c6, type SubscriptionConsent as c7, type SubscriptionConsentInput as c8, type SubscriptionFundingRail as c9, type SubscriptionInterval as ca, type SubscriptionRevenueShare as cb, type SubscriptionRevenueShareInput as cc, type SubscriptionStatus as cd, type UnacknowledgedPurchaseOutcome as ce, isRefundPendingApproval as cf, type PurchaseRefused as d, type CheckoutClientConfig as e, type PurchaseStatusInput as f, type CallOptions as g, type CheckoutMountHandle as h, type ClientConfig as i, type PhoneChangeApprovalsResult as j, type ApprovePhoneChangeInput as k, type ApprovePhoneChangeResult as l, type PendingCollectResult as m, type DestinationsResult as n, type LoyaltyCardsResult as o, type LoyaltyVaultResult as p, type RewardsPageLink as q, type ReportGameEventInput as r, type ReportGameEventResult as s, type EnrollmentVerifyResult as t, type RecoveryBeginResult as u, type RecoveryCompleteResult as v, type BalanceRow as w, type CheckoutPurchaseStatus as x, type ClaimDelivery as y, type DestinationGame as z };
|
|
@@ -913,6 +913,45 @@ declare class Http {
|
|
|
913
913
|
private backoff;
|
|
914
914
|
}
|
|
915
915
|
|
|
916
|
+
/**
|
|
917
|
+
* Gameplay event types your game reports to INVO's loyalty engine (3.27.0). Currency steps
|
|
918
|
+
* (purchases, transfers, sends, item spending, subscriptions) are seen by INVO directly and
|
|
919
|
+
* are never reported; reporting one is refused with `RESERVED_EVENT_TYPE`.
|
|
920
|
+
*
|
|
921
|
+
* - `game.session.started` / `game.session.heartbeat`: payload `{ session_ref }`
|
|
922
|
+
* - `game.session.ended`: payload `{ session_ref, duration_seconds }`
|
|
923
|
+
* - `game.milestone.reached`: payload `{ milestone_key, value?, session_ref? }` (e.g. `level_10`)
|
|
924
|
+
* - `game.custom.recorded`: payload `{ event_name, value? }`; the name must be registered in
|
|
925
|
+
* the console first, else `422 validation_failed`
|
|
926
|
+
*/
|
|
927
|
+
type GameEventType = "game.session.started" | "game.session.heartbeat" | "game.session.ended" | "game.milestone.reached" | "game.custom.recorded" | (string & {});
|
|
928
|
+
/** One gameplay event, reported by the player's browser (`InvoClient.reportGameEvent`). */
|
|
929
|
+
interface ReportGameEventInput {
|
|
930
|
+
/** A `game.*` type; see {@link GameEventType}. */
|
|
931
|
+
eventType: GameEventType;
|
|
932
|
+
/**
|
|
933
|
+
* Idempotency key (a UUID). Resend the SAME id when you retry, so INVO counts the event
|
|
934
|
+
* once. The SDK generates one when you leave it out, and returns it.
|
|
935
|
+
*/
|
|
936
|
+
eventId?: string;
|
|
937
|
+
/** When it happened: ISO 8601 with a timezone, or a Date. Defaults to INVO's receive time. */
|
|
938
|
+
occurredAt?: string | Date;
|
|
939
|
+
/** The event's fields (see {@link GameEventType}). */
|
|
940
|
+
payload?: Record<string, unknown>;
|
|
941
|
+
}
|
|
942
|
+
/** One gameplay event reported by your SERVER (`InvoServer.reportGameEvent`), trusted for rewards. */
|
|
943
|
+
interface ReportServerGameEventInput extends ReportGameEventInput {
|
|
944
|
+
/** The player in your game, by email. */
|
|
945
|
+
playerEmail: string;
|
|
946
|
+
}
|
|
947
|
+
interface ReportGameEventResult {
|
|
948
|
+
/** True when INVO recorded the event (202). */
|
|
949
|
+
accepted: boolean;
|
|
950
|
+
/** The event id INVO received: yours, or the one the SDK generated. Reuse it on a retry. */
|
|
951
|
+
eventId: string;
|
|
952
|
+
raw: Record<string, unknown>;
|
|
953
|
+
}
|
|
954
|
+
|
|
916
955
|
/** Per-call options (e.g. cancellation). Accepted as an optional last arg on SDK methods. */
|
|
917
956
|
interface CallOptions {
|
|
918
957
|
/** Cancel this call. Aborting throws an InvoError (code "ABORTED"); aborted calls are never retried. */
|
|
@@ -3701,4 +3740,4 @@ interface RewardsPageLink {
|
|
|
3701
3740
|
raw: Record<string, unknown>;
|
|
3702
3741
|
}
|
|
3703
3742
|
|
|
3704
|
-
export { type
|
|
3743
|
+
export { type PurchaseRefusalReason as $, type ApproveResult as A, type BalanceResult as B, type ConfirmReceiptResult as C, type DestinationsQuery as D, type EnrollmentBeginResult as E, type InvoErrorInfo as F, type GameEventType as G, Http as H, InvoError as I, type InvoHooks as J, type InvoRequestInfo as K, type LinkDeviceResult as L, type MountCheckoutOptions as M, type InvoResponseInfo as N, type LoyaltyCard as O, type PurchaseStatusResult as P, type LoyaltyCardReward as Q, type RedeemRewardResult as R, type LoyaltyCardStep as S, type LoyaltyRewardState as T, type LoyaltyStepProgress as U, type LoyaltyStepState as V, type WaitForPurchaseInput as W, type LoyaltyVaultEntry as X, type PendingCollectItem as Y, type PhoneChangeApproval as Z, type PhoneChangeDeviceSignal as _, type PurchaseCredited as a, type SteamFinalizeResult as a$, type Rail as a0, type VerificationMethod as a1, type AuthHeader as a2, type PlatformPurchaseInput as a3, type PlatformPurchaseResult as a4, type PlatformOrderStatusResult as a5, type PlatformPurchaseHistoryQuery as a6, type PlatformPurchaseHistoryResult as a7, type PlatformRefundInput as a8, type PlatformRefundResult as a9, type SandboxForceAuthChallengeOptions as aA, type ServerConfig as aB, type MintPlayerTokenInput as aC, type PlayerToken as aD, type RegisterPlayerInput as aE, type RegisterPlayerResult as aF, type UpdatePlayerPhoneInput as aG, type UpdatePlayerPhoneResult as aH, type RequestPhoneChangeInput as aI, type RequestPhoneChangeResult as aJ, type PhoneChangeRequest as aK, type InitiateSendInput as aL, type InitiateResult as aM, type InitiateTransferInput as aN, type CreateCheckoutInput as aO, type CreateCheckoutResult as aP, type PurchaseInput as aQ, type PurchaseResult as aR, type CurrencyPurchaseQuoteInput as aS, type CurrencyPurchaseQuote as aT, type ConfirmPaymentResult as aU, type OrderDetailsResult as aV, type SteamPacksQuery as aW, type SteamPacksResult as aX, type SteamInitPurchaseInput as aY, type SteamInitPurchaseResult as aZ, type SteamFinalizeInput as a_, type CreateSubscriptionInput as aa, type SubscriptionResult as ab, type GetSubscriptionOptions as ac, type GetSubscriptionResult as ad, type ListSubscriptionsOptions as ae, type SubscriptionListResult as af, type CancelSubscriptionOptions as ag, type CancelResult as ah, type ChangeAmountResult as ai, type SetPaymentMethodInput as aj, type SetPaymentMethodResult as ak, type RefundSubscriptionInput as al, type RefundResult as am, type SteamSubscriptionInitInput as an, type SteamInitResult as ao, type SteamFinalizeSubscriptionResult as ap, type CardSetupSessionInput as aq, type CardSetupSessionResult as ar, type CardSetupInput as as, type CardSetupResult as at, type CardSetupConfirmInput as au, type CardSetupConfirmResult as av, type PlayerCardsResult as aw, type SandboxClockResult as ax, type SandboxFailureOutcome as ay, type SandboxForceFailureOptions as az, type PurchaseExpired as b, type RefundRevenueShareAttribution as b$, type PurchaseItemInput as b0, type PurchaseItemResult as b1, type ItemHistoryQuery as b2, type ItemHistoryResult as b3, type ItemOrderQuery as b4, type PlayerActivityQuery as b5, type PlayerActivityResult as b6, type PlayerActivityEntry as b7, type PlayerBalanceQuery as b8, type PlayerBalanceResult as b9, type CompleteDeviceApprovalResult as bA, type CardSetupStatus as bB, type CheckoutWarning as bC, type CurrencyBalance as bD, type CurrencyPurchaseQuoteBreakdown as bE, type DeviceApprovalChannel as bF, type DeviceApprovalEnrollment as bG, type DeviceApprovalFlow as bH, type DeviceApprovalPollStatus as bI, type DeviceEnrollmentDecision as bJ, type DeviceEnrollmentRespond as bK, type ExpiryReason as bL, type FeeTakenFrom as bM, type FirstCharge as bN, type FirstChargeStatus as bO, type FundingSource as bP, type InboundPendingItem as bQ, type LinkedIdentityEmail as bR, type MinPurchaseWarning as bS, type PhoneChangeConfirmation as bT, type PhoneChangeRequestStatus as bU, type PlatformPurchaseStatus as bV, type PlayerActivityType as bW, type RefundInitiation as bX, type RefundPendingApproval as bY, type RefundProcessingFeeBasis as bZ, type RefundReceipt as b_, type ReportServerGameEventInput as ba, type InboundPendingQuery as bb, type InboundPendingResult as bc, type LinkedIdentitiesQuery as bd, type LinkedIdentitiesResult as be, type SmsVerifyResult as bf, type ClaimTransferInput as bg, type ClaimResult as bh, type ClaimCurrencyInput as bi, type TransactionStatusResult as bj, type GuardianApprovalStatusResult as bk, type ServerDestinationsQuery as bl, type PhoneShareContact as bm, type PhoneShareInitiateResult as bn, type PhoneShareApproveInput as bo, type PhoneShareApproveResult as bp, type PhoneShareStatusResult as bq, type BeginDeviceApprovalInput as br, type DeviceApprovalGrant as bs, type PollDeviceApprovalInput as bt, type DeviceApprovalPollResult as bu, type ConfirmDeviceEnrollmentInput as bv, type ConfirmDeviceEnrollmentResult as bw, type ApproveWithDeviceCodeInput as bx, type DeviceApprovalSettleResult as by, type CompleteDeviceApprovalInput as bz, type PurchaseRefunded as c, type RefundWarning as c0, type SandboxClockState as c1, type SavedCard as c2, type SteamPack as c3, type SteamUserSession as c4, type Subscription as c5, type SubscriptionBaseInput as c6, type SubscriptionConsent as c7, type SubscriptionConsentInput as c8, type SubscriptionFundingRail as c9, type SubscriptionInterval as ca, type SubscriptionRevenueShare as cb, type SubscriptionRevenueShareInput as cc, type SubscriptionStatus as cd, type UnacknowledgedPurchaseOutcome as ce, isRefundPendingApproval as cf, type PurchaseRefused as d, type CheckoutClientConfig as e, type PurchaseStatusInput as f, type CallOptions as g, type CheckoutMountHandle as h, type ClientConfig as i, type PhoneChangeApprovalsResult as j, type ApprovePhoneChangeInput as k, type ApprovePhoneChangeResult as l, type PendingCollectResult as m, type DestinationsResult as n, type LoyaltyCardsResult as o, type LoyaltyVaultResult as p, type RewardsPageLink as q, type ReportGameEventInput as r, type ReportGameEventResult as s, type EnrollmentVerifyResult as t, type RecoveryBeginResult as u, type RecoveryCompleteResult as v, type BalanceRow as w, type CheckoutPurchaseStatus as x, type ClaimDelivery as y, type DestinationGame as z };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The package version, as sent in the server User-Agent. A test pins this to
|
|
3
|
+
* `package.json` so it cannot drift silently (it did: the UA read 3.0.0 through 3.7.0).
|
|
4
|
+
* Bump it with the changeset flow.
|
|
5
|
+
*/
|
|
6
|
+
declare const SDK_VERSION = "3.27.0";
|
|
7
|
+
|
|
8
|
+
export { SDK_VERSION as S };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The package version, as sent in the server User-Agent. A test pins this to
|
|
3
|
+
* `package.json` so it cannot drift silently (it did: the UA read 3.0.0 through 3.7.0).
|
|
4
|
+
* Bump it with the changeset flow.
|
|
5
|
+
*/
|
|
6
|
+
declare const SDK_VERSION = "3.27.0";
|
|
7
|
+
|
|
8
|
+
export { SDK_VERSION as S };
|
package/package.json
CHANGED
|
@@ -1,77 +1,91 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@invonetwork/web-sdk",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"description": "INVO Web SDK — currency purchase
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@invonetwork/web-sdk",
|
|
3
|
+
"version": "3.27.0",
|
|
4
|
+
"description": "INVO Web SDK — currency purchase, passkey (WebAuthn) verification, loyalty, and a drop-in game economy layer (wallet, shop, hosted checkout) for partner web platforms and browser games.",
|
|
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
|
+
"./game": {
|
|
39
|
+
"types": "./dist/game.d.ts",
|
|
40
|
+
"import": "./dist/game.js",
|
|
41
|
+
"require": "./dist/game.cjs"
|
|
42
|
+
},
|
|
43
|
+
"./game-server": {
|
|
44
|
+
"types": "./dist/game-server.d.ts",
|
|
45
|
+
"import": "./dist/game-server.js",
|
|
46
|
+
"require": "./dist/game-server.cjs"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"main": "./dist/index.cjs",
|
|
50
|
+
"module": "./dist/index.js",
|
|
51
|
+
"types": "./dist/index.d.ts",
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "tsup",
|
|
54
|
+
"dev": "tsup --watch",
|
|
55
|
+
"typecheck": "tsc --noEmit",
|
|
56
|
+
"lint": "eslint .",
|
|
57
|
+
"test": "vitest run",
|
|
58
|
+
"test:watch": "vitest",
|
|
59
|
+
"clean": "rimraf dist",
|
|
60
|
+
"changeset": "changeset",
|
|
61
|
+
"version-packages": "changeset version",
|
|
62
|
+
"release": "npm run build && changeset publish",
|
|
63
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
64
|
+
},
|
|
65
|
+
"keywords": [
|
|
66
|
+
"invo",
|
|
67
|
+
"webauthn",
|
|
68
|
+
"passkey",
|
|
69
|
+
"payments",
|
|
70
|
+
"game-currency",
|
|
71
|
+
"sdk",
|
|
72
|
+
"game",
|
|
73
|
+
"game-economy",
|
|
74
|
+
"browser-game",
|
|
75
|
+
"loyalty"
|
|
76
|
+
],
|
|
77
|
+
"publishConfig": {
|
|
78
|
+
"access": "public"
|
|
79
|
+
},
|
|
80
|
+
"devDependencies": {
|
|
81
|
+
"@changesets/cli": "^2.31.0",
|
|
82
|
+
"@eslint/js": "^10.0.1",
|
|
83
|
+
"eslint": "^10.6.0",
|
|
84
|
+
"happy-dom": "^15.11.7",
|
|
85
|
+
"rimraf": "^5.0.5",
|
|
86
|
+
"tsup": "^8.0.1",
|
|
87
|
+
"typescript": "^5.4.5",
|
|
88
|
+
"typescript-eslint": "^8.62.1",
|
|
89
|
+
"vitest": "^1.5.0"
|
|
90
|
+
}
|
|
91
|
+
}
|