@genex-ai/embed-sdk 0.8.0 → 0.9.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/dist/sentry.js +26 -4
- package/package.json +2 -2
package/dist/sentry.js
CHANGED
|
@@ -16,18 +16,39 @@ function scrubTokens(s) {
|
|
|
16
16
|
// src/sentry.ts
|
|
17
17
|
var DEFAULT_GAMES_DSN = "https://d1414cfcdc09bf1c1d124e86f8087251@o4511115493900288.ingest.us.sentry.io/4511662569160704";
|
|
18
18
|
var initialized = false;
|
|
19
|
+
function isTouchDevice() {
|
|
20
|
+
try {
|
|
21
|
+
const coarse = matchMedia("(pointer: coarse)").matches;
|
|
22
|
+
const touch = navigator.maxTouchPoints > 1;
|
|
23
|
+
const nav = navigator;
|
|
24
|
+
const mobileUA = nav.userAgentData ? !!nav.userAgentData.mobile : /Mobi|Android/i.test(navigator.userAgent);
|
|
25
|
+
return touch && coarse || mobileUA;
|
|
26
|
+
} catch {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
var touchSession = false;
|
|
19
31
|
function initGameSentry(opts) {
|
|
20
32
|
if (typeof window === "undefined") return;
|
|
21
33
|
if (initialized) return;
|
|
22
34
|
initialized = true;
|
|
35
|
+
touchSession = isTouchDevice();
|
|
36
|
+
try {
|
|
37
|
+
window.__GENEX_SDK_SENTRY__ = "touch-aware";
|
|
38
|
+
} catch {
|
|
39
|
+
}
|
|
23
40
|
_stashTicketFromUrl();
|
|
24
41
|
Sentry.init({
|
|
25
42
|
dsn: opts.dsn ?? DEFAULT_GAMES_DSN,
|
|
26
43
|
environment: opts.environment ?? "production",
|
|
27
|
-
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
//
|
|
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,
|
|
31
52
|
replaysOnErrorSampleRate: 1,
|
|
32
53
|
dataCollection: { userInfo: true },
|
|
33
54
|
initialScope: { tags: { game_slug: opts.slug } },
|
|
@@ -105,6 +126,7 @@ function initGameSentry(opts) {
|
|
|
105
126
|
}
|
|
106
127
|
var lastSnapshot = 0;
|
|
107
128
|
function sentryCanvasSnapshot(canvas, opts) {
|
|
129
|
+
if (touchSession) return;
|
|
108
130
|
const now = Date.now();
|
|
109
131
|
if (now - lastSnapshot < (opts?.intervalMs ?? 500)) return;
|
|
110
132
|
lastSnapshot = now;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genex-ai/embed-sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Player identity + durable game state for genex games
|
|
3
|
+
"version": "0.9.0",
|
|
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",
|
|
7
7
|
"types": "./dist/index.d.ts",
|