@invonetwork/web-sdk 3.29.1 → 3.30.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +1432 -1397
  2. package/README.md +2954 -2923
  3. package/dist/{chunk-YONO4JE5.js → chunk-664RAO2T.js} +25 -5
  4. package/dist/chunk-BIK6UXY7.js +6 -0
  5. package/dist/chunk-QDHOPJFL.js +1634 -0
  6. package/dist/{chunk-VP3OK4J4.js → chunk-TSTP2CWA.js} +471 -3
  7. package/dist/game-server.cjs +269 -2
  8. package/dist/game-server.d.cts +40 -6
  9. package/dist/game-server.d.ts +40 -6
  10. package/dist/game-server.js +252 -7
  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-BYY6tM6X.d.ts → server-B0mvlGFY.d.ts} +17 -2
  23. package/dist/{server-Bxo_wgHx.d.cts → server-DEh9wjF2.d.cts} +17 -2
  24. package/dist/server.cjs +22 -1
  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-DfVkILOj.d.cts} +1 -1
  33. package/dist/{version-DOaYbHu7.d.ts → version-DfVkILOj.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
@@ -1685,7 +1685,7 @@ function toPhoneChangeRequest(raw) {
1685
1685
  }
1686
1686
 
1687
1687
  // src/version.ts
1688
- var SDK_VERSION = "3.29.1";
1688
+ var SDK_VERSION = "3.30.0";
1689
1689
 
1690
1690
  // src/payouts.ts
1691
1691
  var AMOUNT = /^\d+(\.\d{1,2})?$/;
@@ -3753,6 +3753,27 @@ var SandboxSubscriptionsServer = class {
3753
3753
  var SandboxServer = class {
3754
3754
  constructor(http, auth, clockKey) {
3755
3755
  this.subscriptions = new SandboxSubscriptionsServer(http, auth, clockKey);
3756
+ this.http = http;
3757
+ this.auth = auth;
3758
+ }
3759
+ /**
3760
+ * Public demo key only (3.30.0): approve a send or transfer the demo player started, without
3761
+ * a passkey. INVO's demo sandbox answers with the claim code, which the recipient's game
3762
+ * server then uses with `claimCurrency` (a send) or `claimTransfer` (a transfer). Refused on
3763
+ * every other key and in production.
3764
+ */
3765
+ async approveDemoMove(transactionId, kind, opts) {
3766
+ if (typeof transactionId !== "string" || !transactionId.trim()) {
3767
+ throw invalidInput2("transactionId", transactionId, "is required");
3768
+ }
3769
+ const path2 = `/test-auth/${kind === "send" ? "sends" : "transfers"}/${encodeURIComponent(transactionId)}/approve`;
3770
+ const raw = await this.http.post(path2, {}, this.auth, { signal: opts?.signal });
3771
+ return {
3772
+ status: String(raw["status"] ?? ""),
3773
+ claimCode: typeof raw["claim_code"] === "string" ? raw["claim_code"] : null,
3774
+ claimCodeExpiresAt: typeof raw["claim_code_expires_at"] === "string" ? raw["claim_code_expires_at"] : null,
3775
+ raw
3776
+ };
3756
3777
  }
3757
3778
  };
3758
3779
  var InvoServer = class {
@@ -5424,6 +5445,19 @@ var GameServerError = class extends Error {
5424
5445
  this.requestId = requestId;
5425
5446
  }
5426
5447
  };
5448
+ function moveDetails(raw) {
5449
+ const d = (raw?.["send_details"] ?? raw?.["transfer_details"] ?? {}) || {};
5450
+ const pick = (...keys) => {
5451
+ for (const k of keys) if (d[k] !== void 0 && d[k] !== null && d[k] !== "") return String(d[k]);
5452
+ return null;
5453
+ };
5454
+ const toId = pick("receiving_game_id", "target_game_id");
5455
+ const fromId = pick("sending_game_id", "source_game_id");
5456
+ const toName = pick("receiving_game", "target_game", "target_game_name");
5457
+ const fromName = pick("sending_game", "source_game", "source_game_name");
5458
+ const sameGame = fromId !== null && toId !== null ? fromId === toId : toName !== null && toName === fromName;
5459
+ return { sameGame, destinationName: toName, currencyName: pick("currency", "currency_name") ?? (typeof raw?.["currency_name"] === "string" ? raw["currency_name"] : null) };
5460
+ }
5427
5461
  function validateEconomy(economy) {
5428
5462
  const problems = [];
5429
5463
  if (!economy?.premium?.name) problems.push("premium.name is required");
@@ -5529,6 +5563,7 @@ function createInvoGameServer(options) {
5529
5563
  maxPerMinute: economy.soft.maxEarnPerMinute ?? 1e4
5530
5564
  };
5531
5565
  const iso = () => now().toISOString();
5566
+ const environmentNow = options.environment ?? (() => options.sandbox ? "sandbox" : "production");
5532
5567
  function toPlayer(p) {
5533
5568
  return { id: p.id, email: p.email, name: p.name, phoneMasked: maskPhone(p.phone) };
5534
5569
  }
@@ -5916,6 +5951,223 @@ function createInvoGameServer(options) {
5916
5951
  throw err;
5917
5952
  }
5918
5953
  }
5954
+ function transferStatus() {
5955
+ const demo = !!options.demoProjectId;
5956
+ const environment = environmentNow();
5957
+ const setting = options.transfers ?? "auto";
5958
+ let reason = null;
5959
+ if (setting === false) reason = "off";
5960
+ else if (setting === "auto" && !demo) {
5961
+ if (environment === "resolving") reason = "checking";
5962
+ else if (environment === "sandbox") reason = "sandbox";
5963
+ }
5964
+ return {
5965
+ enabled: reason === null,
5966
+ reason,
5967
+ demo,
5968
+ scope: demo ? "project" : "network",
5969
+ recipientFields: demo ? { email: "required", phone: "hidden" } : { email: "optional", phone: "required" },
5970
+ apiBaseUrl: reason === null ? options.playerApiBaseUrl?.() ?? null : null,
5971
+ approval: demo ? "sandbox" : "passkey"
5972
+ };
5973
+ }
5974
+ function requireTransfers() {
5975
+ const status = transferStatus();
5976
+ if (!status.enabled) {
5977
+ throw new GameServerError(
5978
+ 403,
5979
+ "TRANSFERS_DISABLED",
5980
+ status.reason === "sandbox" ? "Transfers are off on this sandbox key. Set INVO_TRANSFERS=on to try them, or use your production key." : status.reason === "checking" ? "Checking this game's INVO key. Try again in a moment." : "Transfers are switched off for this game."
5981
+ );
5982
+ }
5983
+ return status;
5984
+ }
5985
+ async function transferToken(request) {
5986
+ const status = requireTransfers();
5987
+ const { player } = await sessionPlayer(request);
5988
+ try {
5989
+ const minted = await invo.mintPlayerToken({ playerEmail: player.email });
5990
+ return json(200, { token: minted.token, expiresAt: minted.expiresAt, apiBaseUrl: status.apiBaseUrl }, { "cache-control": "no-store" });
5991
+ } catch (err) {
5992
+ if (err instanceof InvoError) throw fromInvoError(err);
5993
+ throw err;
5994
+ }
5995
+ }
5996
+ async function startTransfer(request) {
5997
+ requireTransfers();
5998
+ const { player } = await sessionPlayer(request);
5999
+ const body = await readJson(request);
6000
+ const kind = body["kind"] === "send" ? "send" : "transfer";
6001
+ const amount = String(body["amount"] ?? "").trim();
6002
+ if (!/^\d{1,9}(\.\d{1,2})?$/.test(amount) || Number(amount) <= 0) {
6003
+ throw new GameServerError(400, "INVALID_AMOUNT", "Enter an amount greater than zero.");
6004
+ }
6005
+ const targetGameId = body["targetGameId"];
6006
+ if ((typeof targetGameId !== "string" || !targetGameId.trim()) && typeof targetGameId !== "number") {
6007
+ throw new GameServerError(400, "INVALID_GAME", "Pick a game to send to.");
6008
+ }
6009
+ const requestId = typeof body["clientRequestId"] === "string" ? body["clientRequestId"] : "";
6010
+ if (requestId && !REQUEST_ID.test(requestId)) {
6011
+ throw new GameServerError(400, "INVALID_REQUEST_ID", "clientRequestId must be 8 to 64 letters, digits, - or _.");
6012
+ }
6013
+ const clientRequestId = requestId || crypto.randomBytes(16).toString("hex");
6014
+ const typedEmail = typeof body["recipientEmail"] === "string" ? body["recipientEmail"].trim().toLowerCase() : "";
6015
+ if (typedEmail && !EMAIL.test(typedEmail)) throw new GameServerError(400, "INVALID_EMAIL", "Check the recipient's email address.");
6016
+ let senderPhone;
6017
+ let recipientEmail;
6018
+ let recipientPhone;
6019
+ const demoPid = options.demoProjectId;
6020
+ if (demoPid) {
6021
+ if (!typedEmail) {
6022
+ throw new GameServerError(400, "RECIPIENT_EMAIL_REQUIRED", "Enter your friend's email: the one they sign in to this game with.");
6023
+ }
6024
+ recipientEmail = toDemoEmail(typedEmail, demoPid);
6025
+ if (recipientEmail === player.email) throw new GameServerError(400, "RECIPIENT_IS_SENDER", "Pick someone other than yourself.");
6026
+ recipientPhone = demoPhoneFor(recipientEmail);
6027
+ senderPhone = demoPhoneFor(player.email);
6028
+ } else {
6029
+ recipientPhone = typeof body["recipientPhone"] === "string" ? body["recipientPhone"].replace(/[\s()-]/g, "") : "";
6030
+ if (!E1642.test(recipientPhone)) {
6031
+ throw new GameServerError(400, "INVALID_PHONE", "Enter the recipient's phone in international format, e.g. +15555550111.");
6032
+ }
6033
+ recipientEmail = typedEmail || void 0;
6034
+ const typedSender = typeof body["senderPhone"] === "string" ? body["senderPhone"].replace(/[\s()-]/g, "") : "";
6035
+ senderPhone = typedSender || player.phone || "";
6036
+ if (!E1642.test(senderPhone)) throw new GameServerError(400, "SENDER_PHONE_REQUIRED", "Add the phone number on your INVO account to send.");
6037
+ }
6038
+ try {
6039
+ const started = kind === "send" ? await invo.initiateSend({
6040
+ clientRequestId,
6041
+ senderPlayerName: player.name,
6042
+ senderPlayerEmail: player.email,
6043
+ senderPlayerPhone: senderPhone,
6044
+ receiverPlayerPhone: recipientPhone,
6045
+ ...recipientEmail ? { receiverPlayerEmail: recipientEmail } : {},
6046
+ receivingGameId: targetGameId,
6047
+ amount
6048
+ }) : await invo.initiateTransfer({
6049
+ clientRequestId,
6050
+ sourcePlayerName: player.name,
6051
+ sourcePlayerEmail: player.email,
6052
+ sourcePlayerPhone: senderPhone,
6053
+ targetPlayerPhone: recipientPhone,
6054
+ ...recipientEmail ? { targetPlayerEmail: recipientEmail } : {},
6055
+ targetGameId,
6056
+ amount
6057
+ });
6058
+ log("info", "transfer started", { kind, playerId: player.id, transactionId: started.transactionId });
6059
+ if (demoPid && recipientEmail) {
6060
+ const details = moveDetails(started.raw);
6061
+ const move = {
6062
+ transactionId: started.transactionId,
6063
+ kind,
6064
+ fromPlayerId: player.id,
6065
+ fromName: player.name,
6066
+ toEmail: recipientEmail,
6067
+ amount,
6068
+ currencyName: details.currencyName ?? economy.premium.name,
6069
+ sameGame: details.sameGame,
6070
+ destinationName: details.destinationName ?? "",
6071
+ status: "started",
6072
+ claimCode: null,
6073
+ claimCodeExpiresAt: null,
6074
+ createdAt: iso()
6075
+ };
6076
+ await store.transact((s) => void ((s.demoMoves ?? (s.demoMoves = {}))[move.transactionId] = move));
6077
+ }
6078
+ const answer = {
6079
+ transactionId: started.transactionId,
6080
+ kind,
6081
+ guardianPending: Boolean(started.guardianApproval),
6082
+ playerToken: started.playerToken ?? null,
6083
+ approval: demoPid ? "sandbox" : "passkey"
6084
+ };
6085
+ return json(200, answer, { "cache-control": "no-store" });
6086
+ } catch (err) {
6087
+ if (err instanceof InvoError) throw fromInvoError(err);
6088
+ throw err;
6089
+ }
6090
+ }
6091
+ function requireDemo() {
6092
+ requireTransfers();
6093
+ if (!options.demoProjectId) {
6094
+ throw new GameServerError(409, "PASSKEY_REQUIRED", "Approve and collect on INVO's page with your passkey.");
6095
+ }
6096
+ return options.demoProjectId;
6097
+ }
6098
+ async function approveMove(request, id) {
6099
+ requireDemo();
6100
+ const { player } = await sessionPlayer(request);
6101
+ const move = await store.read((s) => s.demoMoves?.[id] ?? null);
6102
+ if (!move || move.fromPlayerId !== player.id) throw new GameServerError(404, "TRANSFER_NOT_FOUND", "That transfer isn't yours to approve.");
6103
+ if (move.status !== "started") return json(200, { status: "approved", claimCode: move.claimCode, replayed: true });
6104
+ try {
6105
+ const approved = await invo.sandbox.approveDemoMove(id, move.kind);
6106
+ await store.transact((s) => {
6107
+ const m = s.demoMoves?.[id];
6108
+ if (m && m.status === "started") {
6109
+ m.status = "approved";
6110
+ m.claimCode = approved.claimCode;
6111
+ m.claimCodeExpiresAt = approved.claimCodeExpiresAt;
6112
+ }
6113
+ });
6114
+ log("info", "demo transfer approved", { kind: move.kind, playerId: player.id, transactionId: id });
6115
+ return json(200, { status: "approved", claimCode: approved.claimCode, replayed: false });
6116
+ } catch (err) {
6117
+ if (err instanceof InvoError) throw fromInvoError(err);
6118
+ throw err;
6119
+ }
6120
+ }
6121
+ async function pendingMoves(request) {
6122
+ requireDemo();
6123
+ const { player } = await sessionPlayer(request);
6124
+ const nowMs = now().getTime();
6125
+ const moves = await store.read((s) => Object.values(s.demoMoves ?? {}));
6126
+ const pending = moves.filter(
6127
+ (m) => m.toEmail === player.email && m.status === "approved" && m.sameGame && (!m.claimCodeExpiresAt || Date.parse(m.claimCodeExpiresAt) > nowMs) || m.fromPlayerId === player.id && m.status === "started"
6128
+ ).sort((a, b) => b.createdAt.localeCompare(a.createdAt)).map((m) => {
6129
+ const incoming = m.toEmail === player.email;
6130
+ return {
6131
+ transferId: m.transactionId,
6132
+ kind: incoming ? "receiving_confirm" : "identity_gate",
6133
+ flow: m.kind,
6134
+ amount: m.amount,
6135
+ currency: m.currencyName,
6136
+ counterpartyGame: incoming ? `${m.fromName}, in this game` : m.destinationName || "another game",
6137
+ expiresAt: m.claimCodeExpiresAt,
6138
+ stepUpRequired: false,
6139
+ held: false,
6140
+ holdReason: null,
6141
+ raw: {}
6142
+ };
6143
+ });
6144
+ return json(200, { pending }, { "cache-control": "no-store" });
6145
+ }
6146
+ async function collectMove(request, id) {
6147
+ requireDemo();
6148
+ const { player } = await sessionPlayer(request);
6149
+ const move = await store.read((s) => s.demoMoves?.[id] ?? null);
6150
+ if (!move || move.toEmail !== player.email) throw new GameServerError(404, "TRANSFER_NOT_FOUND", "There's nothing to collect with that id.");
6151
+ if (move.status === "collected") return json(200, { status: "collected", replayed: true, wallet: await readWallet(player) });
6152
+ if (move.status !== "approved" || !move.claimCode) throw new GameServerError(409, "NOT_APPROVED_YET", "The sender hasn't approved this one yet.");
6153
+ if (!move.sameGame) throw new GameServerError(409, "OTHER_GAME", `This one is waiting in ${move.destinationName || "another game"}; collect it there.`);
6154
+ try {
6155
+ if (move.kind === "send") {
6156
+ await invo.claimCurrency({ claimCode: move.claimCode, receiverPlayerName: player.name, receiverPlayerEmail: player.email, receiverPlayerPhone: demoPhoneFor(player.email) });
6157
+ } else {
6158
+ throw new GameServerError(409, "OTHER_GAME", "Collect this transfer in the game it was sent to.");
6159
+ }
6160
+ } catch (err) {
6161
+ if (err instanceof InvoError) throw fromInvoError(err);
6162
+ throw err;
6163
+ }
6164
+ await store.transact((s) => {
6165
+ const m = s.demoMoves?.[id];
6166
+ if (m) m.status = "collected";
6167
+ });
6168
+ log("info", "demo transfer collected", { kind: move.kind, playerId: player.id, transactionId: id });
6169
+ return json(200, { status: "collected", replayed: false, wallet: await readWallet(player) });
6170
+ }
5919
6171
  async function route(request, sub, method) {
5920
6172
  if (method === "GET" && sub === "/health") return json(200, { ok: true, setupRequired: false, sandbox: options.sandbox, demo: !!options.demoProjectId });
5921
6173
  if (method === "GET" && sub === "/catalog") return catalog();
@@ -5933,6 +6185,15 @@ function createInvoGameServer(options) {
5933
6185
  if (method === "POST" && sub === "/earn") return earn(request);
5934
6186
  if (method === "POST" && sub === "/events") return events(request);
5935
6187
  if (method === "GET" && sub === "/rewards") return rewards(request);
6188
+ if (method === "GET" && sub === "/transfers/status") return json(200, transferStatus());
6189
+ if (method === "POST" && sub === "/transfers/token") return transferToken(request);
6190
+ if (method === "POST" && sub === "/transfers") return startTransfer(request);
6191
+ if (method === "GET" && sub === "/transfers/pending") return pendingMoves(request);
6192
+ const move = /^\/transfers\/([^/]+)\/(approve|collect)$/.exec(sub);
6193
+ if (method === "POST" && move) {
6194
+ const id = decodeURIComponent(move[1]);
6195
+ return move[2] === "approve" ? approveMove(request, id) : collectMove(request, id);
6196
+ }
5936
6197
  return json(404, { error: { code: "NOT_FOUND", message: "No such route." } });
5937
6198
  }
5938
6199
  return {
@@ -6003,7 +6264,13 @@ function invoGameServerFromEnv(options) {
6003
6264
  },
6004
6265
  basePath: options.basePath,
6005
6266
  publicUrl: env["PUBLIC_URL"] || void 0,
6006
- log: options.log
6267
+ log: options.log,
6268
+ transfers: (() => {
6269
+ const t = env["INVO_TRANSFERS"]?.trim().toLowerCase();
6270
+ return t === "on" ? true : t === "off" ? false : "auto";
6271
+ })(),
6272
+ environment: envNow,
6273
+ playerApiBaseUrl: () => explicitBase || (state.environment === "production" ? PRODUCTION_BASE_URL : state.environment === "sandbox" ? SANDBOX_BASE_URL : null)
6007
6274
  };
6008
6275
  const server = createInvoGameServer(serverOptions);
6009
6276
  return { server, missing, sandbox: sandboxNow(), environment: envNow(), demo };
@@ -1,9 +1,10 @@
1
- import { I as InvoServer, a as InvoEnvironment } from './server-Bxo_wgHx.cjs';
2
- export { D as DEMO_KEY_PREFIX, E as EnvironmentUnknownError, P as PRODUCTION_BASE_URL, S as SANDBOX_BASE_URL, b as baseUrlForKey, i as isDemoKey, r as resolveEnvironment, v as verifyInvoSignature } from './server-Bxo_wgHx.cjs';
3
- import { G as GameCurrencyKind, a as GamePurchaseStatus, b as GameEconomyConfig } from './types-CLyJDuXd.cjs';
4
- export { c as GameCatalog, d as GameCatalogItem, e as GameCheckout, f as GameCurrencyBalance, g as GameErrorBody, h as GameItemPurchase, i as GamePlayer, j as GamePremiumPack, k as GamePurchase, l as GameSession, m as GameWallet } from './types-CLyJDuXd.cjs';
5
- export { I as InvoError } from './types-_lIm74kd.cjs';
6
- export { S as SDK_VERSION } from './version-DOaYbHu7.cjs';
1
+ import { I as InvoServer, a as InvoEnvironment } from './server-DEh9wjF2.cjs';
2
+ export { D as DEMO_KEY_PREFIX, E as EnvironmentUnknownError, P as PRODUCTION_BASE_URL, S as SANDBOX_BASE_URL, b as baseUrlForKey, i as isDemoKey, r as resolveEnvironment, v as verifyInvoSignature } from './server-DEh9wjF2.cjs';
3
+ import { G as GameCurrencyKind, a as GamePurchaseStatus, b as GameEconomyConfig } from './types-jUxfYjiD.cjs';
4
+ export { c as GameCatalog, d as GameCatalogItem, e as GameCheckout, f as GameCurrencyBalance, g as GameErrorBody, h as GameItemPurchase, i as GamePlayer, j as GamePremiumPack, k as GamePurchase, l as GameSession, m as GameTransferInput, n as GameTransferKind, o as GameTransferStart, p as GameTransferStatus, q as GameWallet } from './types-jUxfYjiD.cjs';
5
+ export { I as InvoError } from './types-BTbZicgj.cjs';
6
+ export { S as SDK_VERSION } from './version-DfVkILOj.cjs';
7
+ import './loyalty-events-CmDw2ZoR.cjs';
7
8
 
8
9
  interface StoredPlayer {
9
10
  id: string;
@@ -62,6 +63,29 @@ interface GameStoreState {
62
63
  inventory: Record<string, Record<string, number>>;
63
64
  /** Webhook idempotency key → time processed. */
64
65
  webhooks: Record<string, string>;
66
+ /**
67
+ * Public demo key only (3.30.0): sends and transfers between players of this project, by
68
+ * INVO transaction id. The server approves them in INVO's demo sandbox and keeps the claim
69
+ * code so the recipient can collect. Absent in stores written before 3.30.0.
70
+ */
71
+ demoMoves?: Record<string, StoredDemoMove>;
72
+ }
73
+ interface StoredDemoMove {
74
+ transactionId: string;
75
+ kind: "send" | "transfer";
76
+ fromPlayerId: string;
77
+ fromName: string;
78
+ /** The recipient's demo email (already mapped with `toDemoEmail`). */
79
+ toEmail: string;
80
+ amount: string;
81
+ currencyName: string;
82
+ /** True when it lands in this game, so a player of this game can collect it. */
83
+ sameGame: boolean;
84
+ destinationName: string;
85
+ status: "started" | "approved" | "collected";
86
+ claimCode: string | null;
87
+ claimCodeExpiresAt: string | null;
88
+ createdAt: string;
65
89
  }
66
90
  interface GameStore {
67
91
  /** Read a consistent snapshot. Do not mutate it. */
@@ -115,6 +139,16 @@ interface InvoGameServerOptions {
115
139
  * address or number ever reaches INVO. {@link invoGameServerFromEnv} sets it for you.
116
140
  */
117
141
  demoProjectId?: string;
142
+ /**
143
+ * Player-to-player transfers and sends (3.30.0). `"auto"` (the default) turns them on for
144
+ * the public demo key and in production, and off on other sandbox keys; `true` or `false`
145
+ * forces it. {@link invoGameServerFromEnv} reads `INVO_TRANSFERS` (`on`, `off`, `auto`).
146
+ */
147
+ transfers?: boolean | "auto";
148
+ /** Where the key's environment stands, for `transfers: "auto"`. Default: from `sandbox`. */
149
+ environment?: () => InvoEnvironment | "resolving";
150
+ /** INVO's API base for the browser's player-token calls, or null while unknown. */
151
+ playerApiBaseUrl?: () => string | null;
118
152
  }
119
153
  interface InvoGameServer {
120
154
  readonly basePath: string;
@@ -1,9 +1,10 @@
1
- import { I as InvoServer, a as InvoEnvironment } from './server-BYY6tM6X.js';
2
- export { D as DEMO_KEY_PREFIX, E as EnvironmentUnknownError, P as PRODUCTION_BASE_URL, S as SANDBOX_BASE_URL, b as baseUrlForKey, i as isDemoKey, r as resolveEnvironment, v as verifyInvoSignature } from './server-BYY6tM6X.js';
3
- import { G as GameCurrencyKind, a as GamePurchaseStatus, b as GameEconomyConfig } from './types-CLyJDuXd.js';
4
- export { c as GameCatalog, d as GameCatalogItem, e as GameCheckout, f as GameCurrencyBalance, g as GameErrorBody, h as GameItemPurchase, i as GamePlayer, j as GamePremiumPack, k as GamePurchase, l as GameSession, m as GameWallet } from './types-CLyJDuXd.js';
5
- export { I as InvoError } from './types-_lIm74kd.js';
6
- export { S as SDK_VERSION } from './version-DOaYbHu7.js';
1
+ import { I as InvoServer, a as InvoEnvironment } from './server-B0mvlGFY.js';
2
+ export { D as DEMO_KEY_PREFIX, E as EnvironmentUnknownError, P as PRODUCTION_BASE_URL, S as SANDBOX_BASE_URL, b as baseUrlForKey, i as isDemoKey, r as resolveEnvironment, v as verifyInvoSignature } from './server-B0mvlGFY.js';
3
+ import { G as GameCurrencyKind, a as GamePurchaseStatus, b as GameEconomyConfig } from './types-jUxfYjiD.js';
4
+ export { c as GameCatalog, d as GameCatalogItem, e as GameCheckout, f as GameCurrencyBalance, g as GameErrorBody, h as GameItemPurchase, i as GamePlayer, j as GamePremiumPack, k as GamePurchase, l as GameSession, m as GameTransferInput, n as GameTransferKind, o as GameTransferStart, p as GameTransferStatus, q as GameWallet } from './types-jUxfYjiD.js';
5
+ export { I as InvoError } from './types-BTbZicgj.js';
6
+ export { S as SDK_VERSION } from './version-DfVkILOj.js';
7
+ import './loyalty-events-CmDw2ZoR.js';
7
8
 
8
9
  interface StoredPlayer {
9
10
  id: string;
@@ -62,6 +63,29 @@ interface GameStoreState {
62
63
  inventory: Record<string, Record<string, number>>;
63
64
  /** Webhook idempotency key → time processed. */
64
65
  webhooks: Record<string, string>;
66
+ /**
67
+ * Public demo key only (3.30.0): sends and transfers between players of this project, by
68
+ * INVO transaction id. The server approves them in INVO's demo sandbox and keeps the claim
69
+ * code so the recipient can collect. Absent in stores written before 3.30.0.
70
+ */
71
+ demoMoves?: Record<string, StoredDemoMove>;
72
+ }
73
+ interface StoredDemoMove {
74
+ transactionId: string;
75
+ kind: "send" | "transfer";
76
+ fromPlayerId: string;
77
+ fromName: string;
78
+ /** The recipient's demo email (already mapped with `toDemoEmail`). */
79
+ toEmail: string;
80
+ amount: string;
81
+ currencyName: string;
82
+ /** True when it lands in this game, so a player of this game can collect it. */
83
+ sameGame: boolean;
84
+ destinationName: string;
85
+ status: "started" | "approved" | "collected";
86
+ claimCode: string | null;
87
+ claimCodeExpiresAt: string | null;
88
+ createdAt: string;
65
89
  }
66
90
  interface GameStore {
67
91
  /** Read a consistent snapshot. Do not mutate it. */
@@ -115,6 +139,16 @@ interface InvoGameServerOptions {
115
139
  * address or number ever reaches INVO. {@link invoGameServerFromEnv} sets it for you.
116
140
  */
117
141
  demoProjectId?: string;
142
+ /**
143
+ * Player-to-player transfers and sends (3.30.0). `"auto"` (the default) turns them on for
144
+ * the public demo key and in production, and off on other sandbox keys; `true` or `false`
145
+ * forces it. {@link invoGameServerFromEnv} reads `INVO_TRANSFERS` (`on`, `off`, `auto`).
146
+ */
147
+ transfers?: boolean | "auto";
148
+ /** Where the key's environment stands, for `transfers: "auto"`. Default: from `sandbox`. */
149
+ environment?: () => InvoEnvironment | "resolving";
150
+ /** INVO's API base for the browser's player-token calls, or null while unknown. */
151
+ playerApiBaseUrl?: () => string | null;
118
152
  }
119
153
  interface InvoGameServer {
120
154
  readonly basePath: string;