@invonetwork/web-sdk 3.29.1 → 3.30.1

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +1442 -1397
  2. package/README.md +2954 -2923
  3. package/dist/chunk-3ECVREIM.js +6 -0
  4. package/dist/chunk-7O5JT3LK.js +1590 -0
  5. package/dist/{chunk-VP3OK4J4.js → chunk-TCT2QSVB.js} +515 -3
  6. package/dist/{chunk-YONO4JE5.js → chunk-V2RQYQQD.js} +44 -5
  7. package/dist/game-server.cjs +387 -42
  8. package/dist/game-server.d.cts +42 -6
  9. package/dist/game-server.d.ts +42 -6
  10. package/dist/game-server.js +286 -8
  11. package/dist/game.cjs +2677 -9
  12. package/dist/game.d.cts +78 -4
  13. package/dist/game.d.ts +78 -4
  14. package/dist/game.js +558 -3
  15. package/dist/hosted-approval-DcY4U2RN.d.cts +96 -0
  16. package/dist/hosted-approval-DiKmtjEh.d.ts +96 -0
  17. package/dist/index.d.cts +7 -96
  18. package/dist/index.d.ts +7 -96
  19. package/dist/index.js +2 -1635
  20. package/dist/loyalty-events-CmDw2ZoR.d.cts +40 -0
  21. package/dist/loyalty-events-CmDw2ZoR.d.ts +40 -0
  22. package/dist/{server-Bxo_wgHx.d.cts → server-BAOn3KH3.d.cts} +28 -2
  23. package/dist/{server-BYY6tM6X.d.ts → server-DHmQU1eN.d.ts} +28 -2
  24. package/dist/server.cjs +106 -40
  25. package/dist/server.d.cts +4 -3
  26. package/dist/server.d.ts +4 -3
  27. package/dist/server.js +3 -4
  28. package/dist/{types-_lIm74kd.d.cts → types-BTbZicgj.d.cts} +1 -40
  29. package/dist/{types-_lIm74kd.d.ts → types-BTbZicgj.d.ts} +1 -40
  30. package/dist/{types-CLyJDuXd.d.cts → types-jUxfYjiD.d.cts} +64 -1
  31. package/dist/{types-CLyJDuXd.d.ts → types-jUxfYjiD.d.ts} +64 -1
  32. package/dist/{version-DOaYbHu7.d.cts → version-CR7XECyP.d.cts} +1 -1
  33. package/dist/{version-DOaYbHu7.d.ts → version-CR7XECyP.d.ts} +1 -1
  34. package/package.json +91 -91
  35. package/dist/chunk-6CN236QH.js +0 -473
  36. package/dist/chunk-VOGZZ6QS.js +0 -6
package/dist/game.d.cts CHANGED
@@ -1,6 +1,8 @@
1
- import { i as GamePlayer, m as GameWallet, c as GameCatalog, k as GamePurchase, h as GameItemPurchase, d as GameCatalogItem, f as GameCurrencyBalance } from './types-CLyJDuXd.cjs';
2
- export { e as GameCheckout, G as GameCurrencyKind, b as GameEconomyConfig, g as GameErrorBody, j as GamePremiumPack, a as GamePurchaseStatus, l as GameSession } from './types-CLyJDuXd.cjs';
3
- export { S as SDK_VERSION } from './version-DOaYbHu7.cjs';
1
+ import { i as GamePlayer, q as GameWallet, c as GameCatalog, k as GamePurchase, h as GameItemPurchase, n as GameTransferKind, d as GameCatalogItem, f as GameCurrencyBalance, p as GameTransferStatus, m as GameTransferInput, o as GameTransferStart } from './types-jUxfYjiD.cjs';
2
+ export { e as GameCheckout, G as GameCurrencyKind, b as GameEconomyConfig, g as GameErrorBody, j as GamePremiumPack, a as GamePurchaseStatus, l as GameSession } from './types-jUxfYjiD.cjs';
3
+ import { A as ApproveHostedResult } from './hosted-approval-DcY4U2RN.cjs';
4
+ import { D as DestinationGame, P as PendingCollectItem } from './types-BTbZicgj.cjs';
5
+ export { S as SDK_VERSION } from './version-CR7XECyP.cjs';
4
6
 
5
7
  /**
6
8
  * INVO game economy client (3.27.0), the browser half. It talks ONLY to your game server
@@ -23,6 +25,8 @@ interface InvoGameEconomyOptions {
23
25
  fetch?: typeof fetch;
24
26
  /** Earnings are batched into one request this often (ms). Default 750. */
25
27
  earnFlushMs?: number;
28
+ /** Override `fetch` for the transfer calls the browser makes to INVO itself (tests). */
29
+ invoFetch?: typeof fetch;
26
30
  /** How often to poll a checkout for its webhook credit (ms). Default 2000. */
27
31
  purchasePollMs?: number;
28
32
  /** Give up polling a checkout after this long (ms). Default 15 minutes. */
@@ -51,6 +55,29 @@ interface EconomyEvents {
51
55
  required: boolean;
52
56
  missing: string[];
53
57
  };
58
+ /** A transfer or send was approved, or one sent to this player was collected (3.30.0). */
59
+ transfer: TransferUpdate;
60
+ }
61
+ /** What happened on INVO's hosted approval page. */
62
+ interface TransferUpdate {
63
+ transactionId: string;
64
+ kind: GameTransferKind;
65
+ /** `out`: this player approved sending; `in`: this player collected one sent to them. */
66
+ direction: "out" | "in";
67
+ status: ApproveHostedResult["status"];
68
+ /** Present when the sender approved a transfer: the code a recipient can claim with. */
69
+ claimCode: string | null;
70
+ /** Set when INVO holds the money for review; it completes on its own. */
71
+ holdReason: string | null;
72
+ }
73
+ /**
74
+ * A place currency can go: another INVO game from INVO's destination list, or this game
75
+ * itself (`thisGame`), which only the send rail reaches (a transfer to your own game is refused).
76
+ */
77
+ interface GameTransferDestination extends DestinationGame {
78
+ thisGame: boolean;
79
+ /** The rails that reach it. */
80
+ kinds: GameTransferKind[];
54
81
  }
55
82
  type Listener<T> = (value: T) => void;
56
83
  /** The game's economy, in the browser. One per page. */
@@ -72,6 +99,9 @@ declare class InvoGameEconomy {
72
99
  private pendingEarn;
73
100
  private pendingEarnReason;
74
101
  private earnTimer;
102
+ private readonly invoFetch;
103
+ private transferStatusCache;
104
+ private transferClient;
75
105
  constructor(options?: InvoGameEconomyOptions);
76
106
  /** Subscribe; returns the unsubscribe function. */
77
107
  on<K extends keyof EconomyEvents>(type: K, listener: Listener<EconomyEvents[K]>): () => void;
@@ -142,6 +172,46 @@ declare class InvoGameEconomy {
142
172
  }>;
143
173
  private setWallet;
144
174
  private readStoredPlayer;
175
+ /**
176
+ * Whether players can move currency to other players here, who can receive, and which
177
+ * recipient details to ask for. Cached; pass `true` to ask the server again.
178
+ */
179
+ transferStatus(refresh?: boolean): Promise<GameTransferStatus>;
180
+ /**
181
+ * Get ready to transfer: fetches the short-lived INVO player token the approval and collect
182
+ * calls use. {@link transferDestinations} and {@link pendingTransfers} call it for you; the
183
+ * approve and collect calls need it done BEFORE the click, so the INVO window can open.
184
+ */
185
+ prepareTransfers(): Promise<void>;
186
+ private useTransferToken;
187
+ /**
188
+ * Where this player can send: this game first (send rail only), then every INVO game the
189
+ * destination list offers, each with its currency and per-transfer limits.
190
+ */
191
+ transferDestinations(): Promise<GameTransferDestination[]>;
192
+ /**
193
+ * Start a transfer or send on the server. Nothing moves yet: call {@link approveTransfer}
194
+ * from the player's next click to open INVO's passkey page.
195
+ */
196
+ startTransfer(input: GameTransferInput): Promise<GameTransferStart>;
197
+ /**
198
+ * The sender approves. With a real key this opens INVO's hosted passkey page, so CALL IT
199
+ * DIRECTLY FROM A CLICK (the browser only allows the window from a user gesture). On the
200
+ * public demo key (`approval: "sandbox"`) the game server approves it in INVO's demo sandbox.
201
+ */
202
+ approveTransfer(start: Pick<GameTransferStart, "transactionId" | "kind"> & {
203
+ approval?: "passkey" | "sandbox";
204
+ }): Promise<ApproveHostedResult>;
205
+ /** Transfers and sends waiting for this player: ones sent to them, and ones they still need to approve. */
206
+ pendingTransfers(): Promise<PendingCollectItem[]>;
207
+ /**
208
+ * Settle a pending item on INVO's hosted page: collect one sent to this player, or approve
209
+ * one they started. CALL THIS DIRECTLY FROM A CLICK.
210
+ */
211
+ collectTransfer(item: PendingCollectItem, approval?: "passkey" | "sandbox"): Promise<ApproveHostedResult>;
212
+ /** A demo-sandbox step done by the game server, reported like the hosted page's result. */
213
+ private sandboxStep;
214
+ private hosted;
145
215
  private clearSession;
146
216
  private resumeReturningCheckout;
147
217
  private request;
@@ -179,6 +249,8 @@ interface InvoUIOptions {
179
249
  onModalChange?: (open: boolean) => void;
180
250
  /** Hide the HUD's shop button (open the shop from your own UI instead). */
181
251
  hideShopButton?: boolean;
252
+ /** Hide the HUD's transfer button (open transfers from your own UI instead). */
253
+ hideTransferButton?: boolean;
182
254
  /** Item categories to show as shop tabs, in order. Default: every category in the catalog. */
183
255
  categories?: string[];
184
256
  }
@@ -186,6 +258,8 @@ interface InvoUIHandle {
186
258
  openShop(category?: string): void;
187
259
  openBuyCurrency(): void;
188
260
  openSignIn(): void;
261
+ /** Send currency to another player, or collect what was sent to this one (3.30.0). */
262
+ openTransfers(tab?: "send" | "collect"): void;
189
263
  close(): void;
190
264
  toast(message: string, tone?: "info" | "success" | "error"): void;
191
265
  destroy(): void;
@@ -194,4 +268,4 @@ interface InvoUIHandle {
194
268
  /** Mount the UI kit inside `container` (usually the element that holds the game canvas). */
195
269
  declare function mountInvoUI(container: HTMLElement, economy: InvoGameEconomy, options?: InvoUIOptions): InvoUIHandle;
196
270
 
197
- export { type EconomyEvents, GameCatalog, GameCatalogItem, GameCurrencyBalance, GameItemPurchase, GamePlayer, GamePurchase, GameWallet, InvoGameEconomy, type InvoGameEconomyOptions, InvoGameError, type InvoUIHandle, type InvoUIOptions, type InvoUITheme, type PurchaseUpdate, mountInvoUI };
271
+ export { ApproveHostedResult, DestinationGame, type EconomyEvents, GameCatalog, GameCatalogItem, GameCurrencyBalance, GameItemPurchase, GamePlayer, GamePurchase, type GameTransferDestination, GameTransferInput, GameTransferKind, GameTransferStart, GameTransferStatus, GameWallet, InvoGameEconomy, type InvoGameEconomyOptions, InvoGameError, type InvoUIHandle, type InvoUIOptions, type InvoUITheme, PendingCollectItem, type PurchaseUpdate, type TransferUpdate, mountInvoUI };
package/dist/game.d.ts CHANGED
@@ -1,6 +1,8 @@
1
- import { i as GamePlayer, m as GameWallet, c as GameCatalog, k as GamePurchase, h as GameItemPurchase, d as GameCatalogItem, f as GameCurrencyBalance } from './types-CLyJDuXd.js';
2
- export { e as GameCheckout, G as GameCurrencyKind, b as GameEconomyConfig, g as GameErrorBody, j as GamePremiumPack, a as GamePurchaseStatus, l as GameSession } from './types-CLyJDuXd.js';
3
- export { S as SDK_VERSION } from './version-DOaYbHu7.js';
1
+ import { i as GamePlayer, q as GameWallet, c as GameCatalog, k as GamePurchase, h as GameItemPurchase, n as GameTransferKind, d as GameCatalogItem, f as GameCurrencyBalance, p as GameTransferStatus, m as GameTransferInput, o as GameTransferStart } from './types-jUxfYjiD.js';
2
+ export { e as GameCheckout, G as GameCurrencyKind, b as GameEconomyConfig, g as GameErrorBody, j as GamePremiumPack, a as GamePurchaseStatus, l as GameSession } from './types-jUxfYjiD.js';
3
+ import { A as ApproveHostedResult } from './hosted-approval-DiKmtjEh.js';
4
+ import { D as DestinationGame, P as PendingCollectItem } from './types-BTbZicgj.js';
5
+ export { S as SDK_VERSION } from './version-CR7XECyP.js';
4
6
 
5
7
  /**
6
8
  * INVO game economy client (3.27.0), the browser half. It talks ONLY to your game server
@@ -23,6 +25,8 @@ interface InvoGameEconomyOptions {
23
25
  fetch?: typeof fetch;
24
26
  /** Earnings are batched into one request this often (ms). Default 750. */
25
27
  earnFlushMs?: number;
28
+ /** Override `fetch` for the transfer calls the browser makes to INVO itself (tests). */
29
+ invoFetch?: typeof fetch;
26
30
  /** How often to poll a checkout for its webhook credit (ms). Default 2000. */
27
31
  purchasePollMs?: number;
28
32
  /** Give up polling a checkout after this long (ms). Default 15 minutes. */
@@ -51,6 +55,29 @@ interface EconomyEvents {
51
55
  required: boolean;
52
56
  missing: string[];
53
57
  };
58
+ /** A transfer or send was approved, or one sent to this player was collected (3.30.0). */
59
+ transfer: TransferUpdate;
60
+ }
61
+ /** What happened on INVO's hosted approval page. */
62
+ interface TransferUpdate {
63
+ transactionId: string;
64
+ kind: GameTransferKind;
65
+ /** `out`: this player approved sending; `in`: this player collected one sent to them. */
66
+ direction: "out" | "in";
67
+ status: ApproveHostedResult["status"];
68
+ /** Present when the sender approved a transfer: the code a recipient can claim with. */
69
+ claimCode: string | null;
70
+ /** Set when INVO holds the money for review; it completes on its own. */
71
+ holdReason: string | null;
72
+ }
73
+ /**
74
+ * A place currency can go: another INVO game from INVO's destination list, or this game
75
+ * itself (`thisGame`), which only the send rail reaches (a transfer to your own game is refused).
76
+ */
77
+ interface GameTransferDestination extends DestinationGame {
78
+ thisGame: boolean;
79
+ /** The rails that reach it. */
80
+ kinds: GameTransferKind[];
54
81
  }
55
82
  type Listener<T> = (value: T) => void;
56
83
  /** The game's economy, in the browser. One per page. */
@@ -72,6 +99,9 @@ declare class InvoGameEconomy {
72
99
  private pendingEarn;
73
100
  private pendingEarnReason;
74
101
  private earnTimer;
102
+ private readonly invoFetch;
103
+ private transferStatusCache;
104
+ private transferClient;
75
105
  constructor(options?: InvoGameEconomyOptions);
76
106
  /** Subscribe; returns the unsubscribe function. */
77
107
  on<K extends keyof EconomyEvents>(type: K, listener: Listener<EconomyEvents[K]>): () => void;
@@ -142,6 +172,46 @@ declare class InvoGameEconomy {
142
172
  }>;
143
173
  private setWallet;
144
174
  private readStoredPlayer;
175
+ /**
176
+ * Whether players can move currency to other players here, who can receive, and which
177
+ * recipient details to ask for. Cached; pass `true` to ask the server again.
178
+ */
179
+ transferStatus(refresh?: boolean): Promise<GameTransferStatus>;
180
+ /**
181
+ * Get ready to transfer: fetches the short-lived INVO player token the approval and collect
182
+ * calls use. {@link transferDestinations} and {@link pendingTransfers} call it for you; the
183
+ * approve and collect calls need it done BEFORE the click, so the INVO window can open.
184
+ */
185
+ prepareTransfers(): Promise<void>;
186
+ private useTransferToken;
187
+ /**
188
+ * Where this player can send: this game first (send rail only), then every INVO game the
189
+ * destination list offers, each with its currency and per-transfer limits.
190
+ */
191
+ transferDestinations(): Promise<GameTransferDestination[]>;
192
+ /**
193
+ * Start a transfer or send on the server. Nothing moves yet: call {@link approveTransfer}
194
+ * from the player's next click to open INVO's passkey page.
195
+ */
196
+ startTransfer(input: GameTransferInput): Promise<GameTransferStart>;
197
+ /**
198
+ * The sender approves. With a real key this opens INVO's hosted passkey page, so CALL IT
199
+ * DIRECTLY FROM A CLICK (the browser only allows the window from a user gesture). On the
200
+ * public demo key (`approval: "sandbox"`) the game server approves it in INVO's demo sandbox.
201
+ */
202
+ approveTransfer(start: Pick<GameTransferStart, "transactionId" | "kind"> & {
203
+ approval?: "passkey" | "sandbox";
204
+ }): Promise<ApproveHostedResult>;
205
+ /** Transfers and sends waiting for this player: ones sent to them, and ones they still need to approve. */
206
+ pendingTransfers(): Promise<PendingCollectItem[]>;
207
+ /**
208
+ * Settle a pending item on INVO's hosted page: collect one sent to this player, or approve
209
+ * one they started. CALL THIS DIRECTLY FROM A CLICK.
210
+ */
211
+ collectTransfer(item: PendingCollectItem, approval?: "passkey" | "sandbox"): Promise<ApproveHostedResult>;
212
+ /** A demo-sandbox step done by the game server, reported like the hosted page's result. */
213
+ private sandboxStep;
214
+ private hosted;
145
215
  private clearSession;
146
216
  private resumeReturningCheckout;
147
217
  private request;
@@ -179,6 +249,8 @@ interface InvoUIOptions {
179
249
  onModalChange?: (open: boolean) => void;
180
250
  /** Hide the HUD's shop button (open the shop from your own UI instead). */
181
251
  hideShopButton?: boolean;
252
+ /** Hide the HUD's transfer button (open transfers from your own UI instead). */
253
+ hideTransferButton?: boolean;
182
254
  /** Item categories to show as shop tabs, in order. Default: every category in the catalog. */
183
255
  categories?: string[];
184
256
  }
@@ -186,6 +258,8 @@ interface InvoUIHandle {
186
258
  openShop(category?: string): void;
187
259
  openBuyCurrency(): void;
188
260
  openSignIn(): void;
261
+ /** Send currency to another player, or collect what was sent to this one (3.30.0). */
262
+ openTransfers(tab?: "send" | "collect"): void;
189
263
  close(): void;
190
264
  toast(message: string, tone?: "info" | "success" | "error"): void;
191
265
  destroy(): void;
@@ -194,4 +268,4 @@ interface InvoUIHandle {
194
268
  /** Mount the UI kit inside `container` (usually the element that holds the game canvas). */
195
269
  declare function mountInvoUI(container: HTMLElement, economy: InvoGameEconomy, options?: InvoUIOptions): InvoUIHandle;
196
270
 
197
- export { type EconomyEvents, GameCatalog, GameCatalogItem, GameCurrencyBalance, GameItemPurchase, GamePlayer, GamePurchase, GameWallet, InvoGameEconomy, type InvoGameEconomyOptions, InvoGameError, type InvoUIHandle, type InvoUIOptions, type InvoUITheme, type PurchaseUpdate, mountInvoUI };
271
+ export { ApproveHostedResult, DestinationGame, type EconomyEvents, GameCatalog, GameCatalogItem, GameCurrencyBalance, GameItemPurchase, GamePlayer, GamePurchase, type GameTransferDestination, GameTransferInput, GameTransferKind, GameTransferStart, GameTransferStatus, GameWallet, InvoGameEconomy, type InvoGameEconomyOptions, InvoGameError, type InvoUIHandle, type InvoUIOptions, type InvoUITheme, PendingCollectItem, type PurchaseUpdate, type TransferUpdate, mountInvoUI };