@genex-ai/embed-sdk 0.10.0 → 0.12.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.
@@ -25,6 +25,7 @@ var authWaiters = [];
25
25
  var playerWaiters = [];
26
26
  var overlayEl = null;
27
27
  var popoverEl = null;
28
+ var popoverMinimizeTimer;
28
29
  var pendingPlayerSave;
29
30
  var hasPendingPlayerSave = false;
30
31
  var pendingScores = /* @__PURE__ */ new Map();
@@ -832,6 +833,10 @@ function showGuestPopover() {
832
833
  }
833
834
  }
834
835
  function removeGuestPopover() {
836
+ if (popoverMinimizeTimer !== void 0) {
837
+ clearTimeout(popoverMinimizeTimer);
838
+ popoverMinimizeTimer = void 0;
839
+ }
835
840
  try {
836
841
  const root = popoverEl?.root;
837
842
  root?.remove?.();
@@ -841,15 +846,31 @@ function removeGuestPopover() {
841
846
  }
842
847
  function buildGuestPopover(d) {
843
848
  ensureOverlayFont(d);
849
+ let mobile = false;
850
+ try {
851
+ const w = win();
852
+ const nav = w?.navigator;
853
+ if (w && nav) {
854
+ const coarse = w.matchMedia?.("(pointer: coarse)").matches ?? false;
855
+ const touch = (nav.maxTouchPoints ?? 0) > 1;
856
+ const mobileUA = nav.userAgentData ? nav.userAgentData.mobile : /Mobi|Android/i.test(nav.userAgent ?? "");
857
+ mobile = touch && coarse || mobileUA;
858
+ }
859
+ } catch {
860
+ }
844
861
  const root = d.createElement("div");
845
862
  root.setAttribute("data-genex-guest-popover", "");
846
- root.style.cssText = `position:fixed;top:12px;right:12px;z-index:2147483646;display:flex;align-items:center;gap:12px;padding:10px 12px 10px 16px;border-radius:12px;background:rgba(0,0,0,0.85);color:#fff;font-family:${OVERLAY_FONT_STACK};font-size:13px;box-shadow:0 4px 24px rgba(0,0,0,0.4);pointer-events:auto;user-select:none`;
863
+ root.style.cssText = "position:fixed;top:calc(12px + env(safe-area-inset-top));right:calc(12px + env(safe-area-inset-right));z-index:2147483646;display:flex;justify-content:flex-end;pointer-events:none";
864
+ const card = d.createElement("div");
865
+ card.style.cssText = `display:flex;align-items:center;border-radius:12px;background:rgba(0,0,0,0.85);color:#fff;font-family:${OVERLAY_FONT_STACK};box-shadow:0 4px 24px rgba(0,0,0,0.4);pointer-events:auto;user-select:none;` + (mobile ? "gap:8px;padding:8px 8px 8px 12px;font-size:12px;max-width:calc(100vw - 88px)" : "gap:12px;padding:10px 12px 10px 16px;font-size:13px");
866
+ root.appendChild(card);
847
867
  const text = d.createElement("span");
848
- text.textContent = user?.name ? `Playing as ${user.name} \u2014 sign in to save progress` : "Sign in to save progress";
849
- root.appendChild(text);
868
+ text.textContent = !mobile && user?.name ? `Playing as ${user.name} \u2014 sign in to save progress` : "Sign in to save progress";
869
+ if (mobile) text.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap";
870
+ card.appendChild(text);
850
871
  const signIn = d.createElement("button");
851
872
  signIn.textContent = "Sign in";
852
- signIn.style.cssText = "font-family:inherit;font-size:13px;font-weight:500;padding:6px 16px;border-radius:9px;border:none;cursor:pointer;background:#4b60bf;color:#fff";
873
+ signIn.style.cssText = "font-family:inherit;font-weight:500;border-radius:9px;border:none;cursor:pointer;background:#4b60bf;color:#fff;" + (mobile ? "font-size:12px;padding:5px 12px" : "font-size:13px;padding:6px 16px");
853
874
  signIn.addEventListener("mouseenter", () => {
854
875
  signIn.style.background = "#3f51a8";
855
876
  });
@@ -863,7 +884,7 @@ function buildGuestPopover(d) {
863
884
  clearRetryFlag();
864
885
  void redirectToAuthorize(w);
865
886
  });
866
- root.appendChild(signIn);
887
+ card.appendChild(signIn);
867
888
  const dismiss = d.createElement("button");
868
889
  dismiss.textContent = "\xD7";
869
890
  dismiss.setAttribute("aria-label", "Dismiss");
@@ -872,7 +893,24 @@ function buildGuestPopover(d) {
872
893
  writePopoverDismissed();
873
894
  removeGuestPopover();
874
895
  });
875
- root.appendChild(dismiss);
896
+ card.appendChild(dismiss);
897
+ if (mobile) {
898
+ const chip = d.createElement("button");
899
+ chip.setAttribute("aria-label", "Sign in to save progress");
900
+ chip.style.cssText = "display:none;width:44px;height:44px;border-radius:50%;border:none;cursor:pointer;background:rgba(0,0,0,0.55);color:#fff;align-items:center;justify-content:center;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);pointer-events:auto";
901
+ chip.innerHTML = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"/><polyline points="10 17 15 12 10 7"/><line x1="15" y1="12" x2="3" y2="12"/></svg>';
902
+ root.appendChild(chip);
903
+ const setMinimized = (v) => {
904
+ card.style.display = v ? "none" : "flex";
905
+ chip.style.display = v ? "flex" : "none";
906
+ };
907
+ popoverMinimizeTimer = setTimeout(() => setMinimized(true), 5e3);
908
+ card.addEventListener("pointerdown", () => {
909
+ if (popoverMinimizeTimer !== void 0) clearTimeout(popoverMinimizeTimer);
910
+ popoverMinimizeTimer = void 0;
911
+ });
912
+ chip.addEventListener("click", () => setMinimized(false));
913
+ }
876
914
  const mount = () => {
877
915
  if (d.body && !root.isConnected) d.body.appendChild(root);
878
916
  };
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  submitScore,
18
18
  waitForAuth,
19
19
  waitForPlayer
20
- } from "./chunk-Z7VGKJYX.js";
20
+ } from "./chunk-EEOKYBXG.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-Z7VGKJYX.js";
5
+ } from "./chunk-EEOKYBXG.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.10.0",
3
+ "version": "0.12.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",