@syntrologie/runtime-sdk 2.8.0-canary.89 → 2.8.0-canary.90

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.
@@ -20723,7 +20723,7 @@ Please report this to https://github.com/markedjs/marked.`, e2) {
20723
20723
  }
20724
20724
 
20725
20725
  // src/version.ts
20726
- var SDK_VERSION = "2.8.0-canary.89";
20726
+ var SDK_VERSION = "2.8.0-canary.90";
20727
20727
 
20728
20728
  // src/types.ts
20729
20729
  var SDK_SCHEMA_VERSION = "2.0";
@@ -41565,6 +41565,19 @@ ${cssRules}
41565
41565
  if (window.location.search) attrs.page_query = window.location.search;
41566
41566
  } catch {
41567
41567
  }
41568
+ try {
41569
+ const tg = window.Telegram?.WebApp;
41570
+ if (tg) {
41571
+ attrs.surface_type = "telegram";
41572
+ attrs.surface_host = tg.platform || "unknown";
41573
+ } else {
41574
+ attrs.surface_type = "web";
41575
+ attrs.surface_host = "web";
41576
+ }
41577
+ } catch {
41578
+ attrs.surface_type = "web";
41579
+ attrs.surface_host = "web";
41580
+ }
41568
41581
  return attrs;
41569
41582
  }
41570
41583
  var GEO_CACHE_KEY = "syntro_geo";
@@ -41917,10 +41930,45 @@ ${cssRules}
41917
41930
  const geoHost = payload?.g || getEnvVar("NEXT_PUBLIC_SYNTRO_GEO_HOST") || getEnvVar("VITE_SYNTRO_GEO_HOST") || GEO_DEFAULT_HOST;
41918
41931
  const cachedSegmentAttrs = loadCachedSegmentAttributes();
41919
41932
  const browserMetadata = collectBrowserMetadata();
41920
- const phaseOneAttrs = { ...browserMetadata, ...cachedSegmentAttrs };
41933
+ const appSignals = options.appSignals ?? {};
41934
+ const phaseOneAttrs = { ...browserMetadata, ...cachedSegmentAttrs, ...appSignals };
41921
41935
  debug("Syntro Bootstrap", "Phase 1: Browser metadata:", browserMetadata);
41922
41936
  debug("Syntro Bootstrap", "Phase 1: Cached segment attributes:", cachedSegmentAttrs);
41937
+ if (Object.keys(appSignals).length > 0) {
41938
+ debug("Syntro Bootstrap", "Phase 1: App signals:", appSignals);
41939
+ }
41923
41940
  const geoPromise = fetchGeo(geoHost);
41941
+ const mcpPromise = (() => {
41942
+ try {
41943
+ if (typeof window === "undefined" || window.self === window.top) return Promise.resolve(null);
41944
+ } catch {
41945
+ }
41946
+ return new Promise((resolve) => {
41947
+ const timer = setTimeout(() => {
41948
+ window.removeEventListener("message", handler);
41949
+ resolve(null);
41950
+ }, 500);
41951
+ function handler(event) {
41952
+ const data = event.data;
41953
+ if (data?.jsonrpc === "2.0" && data?.id === 1 && data?.result?.hostInfo) {
41954
+ clearTimeout(timer);
41955
+ window.removeEventListener("message", handler);
41956
+ resolve(data.result.hostInfo);
41957
+ }
41958
+ }
41959
+ window.addEventListener("message", handler);
41960
+ try {
41961
+ window.parent.postMessage(
41962
+ { jsonrpc: "2.0", id: 1, method: "ui/initialize", params: { capabilities: {} } },
41963
+ "*"
41964
+ );
41965
+ } catch {
41966
+ clearTimeout(timer);
41967
+ window.removeEventListener("message", handler);
41968
+ resolve(null);
41969
+ }
41970
+ });
41971
+ })();
41924
41972
  let experiments;
41925
41973
  const isDebugOrTest = options.debug || options.testMode;
41926
41974
  const events = createEventBus({
@@ -41974,7 +42022,7 @@ ${cssRules}
41974
42022
  cacheSegmentAttributes(segmentFlags);
41975
42023
  if (experiments) {
41976
42024
  const sessionAttrs = sessionMetrics?.getAll?.() ?? {};
41977
- const updatedAttrs = { ...browserMetadata, ...sessionAttrs, ...segmentFlags };
42025
+ const updatedAttrs = { ...browserMetadata, ...sessionAttrs, ...segmentFlags, ...appSignals };
41978
42026
  debug("Syntro Bootstrap", "Updating GrowthBook with attributes:", updatedAttrs);
41979
42027
  experiments.setAttributes?.(updatedAttrs);
41980
42028
  }
@@ -42001,6 +42049,10 @@ ${cssRules}
42001
42049
  }
42002
42050
  });
42003
42051
  console.log(`[Syntro Bootstrap] Telemetry client created (${provider}) with EventBus wiring`);
42052
+ if (Object.keys(appSignals).length > 0) {
42053
+ telemetry.register?.(appSignals);
42054
+ debug("Syntro Bootstrap", "Registered app signals as super properties:", appSignals);
42055
+ }
42004
42056
  const telemetryForCapture = telemetry;
42005
42057
  events.setPosthogCapture((name, props) => {
42006
42058
  telemetryForCapture.track?.(name, props);
@@ -42099,10 +42151,17 @@ ${cssRules}
42099
42151
  }
42100
42152
  const geoData = await geoPromise;
42101
42153
  if (experiments && Object.keys(geoData).length > 0) {
42102
- const mergedAttrs = { ...browserMetadata, ...geoData };
42154
+ const mergedAttrs = { ...browserMetadata, ...geoData, ...appSignals };
42103
42155
  debug("Syntro Bootstrap", "Merging geo data into GrowthBook attributes:", geoData);
42104
42156
  experiments.setAttributes?.(mergedAttrs);
42105
42157
  }
42158
+ const mcpHost = await mcpPromise;
42159
+ if (mcpHost && experiments) {
42160
+ browserMetadata.surface_type = "mcp-app";
42161
+ browserMetadata.surface_host = mcpHost.name;
42162
+ experiments.setAttributes?.({ ...browserMetadata, ...geoData });
42163
+ debug("Syntro Bootstrap", "MCP App detected:", mcpHost.name);
42164
+ }
42106
42165
  let baseFetcher;
42107
42166
  if (options.fetcher) {
42108
42167
  baseFetcher = options.fetcher;
@@ -42240,7 +42299,7 @@ ${cssRules}
42240
42299
  }
42241
42300
 
42242
42301
  // src/index.ts
42243
- var RUNTIME_SDK_BUILD = true ? `${"2026-04-17T16:20:07.924Z"} (${"a0bd7133641"})` : "dev";
42302
+ var RUNTIME_SDK_BUILD = true ? `${"2026-04-18T04:36:24.703Z"} (${"cb8871918e2"})` : "dev";
42244
42303
  if (typeof window !== "undefined") {
42245
42304
  console.log(`[Syntro Runtime] Build: ${RUNTIME_SDK_BUILD}`);
42246
42305
  const existing = window.SynOS;