@genex-ai/embed-sdk 0.11.0 → 0.13.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.
@@ -2,6 +2,7 @@
2
2
  var PROTOCOL_VERSION = 1;
3
3
  var RETRY_FLAG = "genex:embed:retry";
4
4
  var POPOVER_DISMISSED_FLAG = "genex:guest:popover-dismissed";
5
+ var PLAYER_ID_KEY = "genex:player";
5
6
  var config = null;
6
7
  var state = "pending";
7
8
  var user = null;
@@ -70,6 +71,20 @@ function writePopoverDismissed() {
70
71
  } catch {
71
72
  }
72
73
  }
74
+ function playerId() {
75
+ try {
76
+ const store = win()?.localStorage;
77
+ if (!store) return "no-storage";
78
+ let id = store.getItem(PLAYER_ID_KEY);
79
+ if (!id) {
80
+ id = typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
81
+ store.setItem(PLAYER_ID_KEY, id);
82
+ }
83
+ return id;
84
+ } catch {
85
+ return "no-storage";
86
+ }
87
+ }
73
88
  function initEmbed(cfg) {
74
89
  const w = win();
75
90
  if (!w) return;
@@ -471,7 +486,10 @@ async function requestGuestSession() {
471
486
  const res = await doFetch(`${config.apiUrl}/api/embed/guest-session`, {
472
487
  method: "POST",
473
488
  headers: { "Content-Type": "application/json" },
474
- body: JSON.stringify({ slug: config.slug })
489
+ // playerId is analytics-only: the SERVER still mints the session's own
490
+ // guest id and the token is unchanged — this just lets the play event
491
+ // key on something that survives the tab.
492
+ body: JSON.stringify({ slug: config.slug, playerId: playerId() })
475
493
  });
476
494
  if (epoch !== identityEpoch) return;
477
495
  if (!res.ok) {
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  submitScore,
18
18
  waitForAuth,
19
19
  waitForPlayer
20
- } from "./chunk-EEOKYBXG.js";
20
+ } from "./chunk-XGTGIWVQ.js";
21
21
  export {
22
22
  __resetForTests,
23
23
  _stashTicketFromUrl,
package/dist/sentry.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  _stashTicketFromUrl,
3
3
  getUser,
4
4
  on
5
- } from "./chunk-EEOKYBXG.js";
5
+ } from "./chunk-XGTGIWVQ.js";
6
6
 
7
7
  // src/sentry.ts
8
8
  import * as Sentry from "@sentry/browser";
@@ -41,15 +41,15 @@ function initGameSentry(opts) {
41
41
  Sentry.init({
42
42
  dsn: opts.dsn ?? DEFAULT_GAMES_DSN,
43
43
  environment: opts.environment ?? "production",
44
- // Mobile-readiness program (2026-07-21): touch devices get throttled
45
- // telemetry this REVERSES the 2026-07-02 record-every-session decision
46
- // for the touch device class only, because 100% replay + canvas readback
47
- // burns memory/GPU on the phones the crash program is trying to save.
48
- // Desktop keeps full rates; on-error replays stay 100% everywhere, so the
49
- // crash-debugging case keeps its data.
50
- tracesSampleRate: touchSession ? 0.2 : 1,
51
- replaysSessionSampleRate: touchSession ? 0.1 : 1,
52
- replaysOnErrorSampleRate: 1,
44
+ // Rates are sized to the org quota, which every project shares: 5M spans and
45
+ // 50 replays per month. The previous desktop 1.0/1.0 exhausted both in July
46
+ // 2026, after which Sentry drops everything. Touch stays lower than desktop
47
+ // for the 2026-07-21 mobile-readiness reason (replay + canvas readback burns
48
+ // phone memory), and session replay is off outright 50/month only stretches
49
+ // to errored sessions.
50
+ tracesSampleRate: touchSession ? 0.05 : 0.1,
51
+ replaysSessionSampleRate: 0,
52
+ replaysOnErrorSampleRate: 0.01,
53
53
  dataCollection: { userInfo: true },
54
54
  initialScope: { tags: { game_slug: opts.slug } },
55
55
  integrations: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genex-ai/embed-sdk",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "description": "Player identity + durable game state for genex games \u2014 signed-in or guest play, per-player save slots, shared world state, and soft-trust leaderboards.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",