@syntrologie/runtime-sdk 2.6.0-canary.2 → 2.6.0-canary.3

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.
@@ -19285,7 +19285,7 @@ var SyntrologieSDK = (() => {
19285
19285
  }
19286
19286
 
19287
19287
  // src/version.ts
19288
- var SDK_VERSION = "2.6.0-canary.2";
19288
+ var SDK_VERSION = "2.6.0-canary.3";
19289
19289
 
19290
19290
  // src/types.ts
19291
19291
  var SDK_SCHEMA_VERSION = "2.0";
@@ -39051,6 +39051,44 @@ ${cssRules}
39051
39051
  }
39052
39052
  return segmentFlags;
39053
39053
  }
39054
+ function collectBrowserMetadata() {
39055
+ if (typeof window === "undefined") return {};
39056
+ const attrs = {};
39057
+ try {
39058
+ const params = new URLSearchParams(window.location.search);
39059
+ for (const key of ["utm_source", "utm_medium", "utm_campaign", "utm_content", "utm_term"]) {
39060
+ const val = params.get(key);
39061
+ if (val) attrs[key] = val;
39062
+ }
39063
+ } catch {
39064
+ }
39065
+ try {
39066
+ if (navigator.language) attrs.browser_language = navigator.language;
39067
+ if (navigator.languages?.length) attrs.browser_languages = [...navigator.languages];
39068
+ } catch {
39069
+ }
39070
+ try {
39071
+ const w2 = window.innerWidth;
39072
+ attrs.device_type = w2 < 768 ? "mobile" : w2 < 1024 ? "tablet" : "desktop";
39073
+ } catch {
39074
+ }
39075
+ try {
39076
+ if (document.referrer) {
39077
+ attrs.referrer = document.referrer;
39078
+ try {
39079
+ attrs.referrer_hostname = new URL(document.referrer).hostname;
39080
+ } catch {
39081
+ }
39082
+ }
39083
+ } catch {
39084
+ }
39085
+ try {
39086
+ attrs.page_url = window.location.href;
39087
+ attrs.page_path = window.location.pathname;
39088
+ } catch {
39089
+ }
39090
+ return attrs;
39091
+ }
39054
39092
  async function init(options) {
39055
39093
  initLogger();
39056
39094
  debug("Syntro Bootstrap", "====== INIT ======");
@@ -39122,7 +39160,10 @@ ${cssRules}
39122
39160
  const telemetryHost = getEnvVar("NEXT_PUBLIC_SYNTRO_TELEMETRY_HOST") || getEnvVar("VITE_SYNTRO_TELEMETRY_HOST") || payload?.th;
39123
39161
  const editorUrl = getEnvVar("NEXT_PUBLIC_SYNTRO_EDITOR_URL") || getEnvVar("VITE_SYNTRO_EDITOR_URL") || options.canvas?.editorUrl;
39124
39162
  const cachedSegmentAttrs = loadCachedSegmentAttributes();
39125
- debug("Syntro Bootstrap", "Phase 1: Using cached segment attributes:", cachedSegmentAttrs);
39163
+ const browserMetadata = collectBrowserMetadata();
39164
+ const phaseOneAttrs = { ...browserMetadata, ...cachedSegmentAttrs };
39165
+ debug("Syntro Bootstrap", "Phase 1: Browser metadata:", browserMetadata);
39166
+ debug("Syntro Bootstrap", "Phase 1: Cached segment attributes:", cachedSegmentAttrs);
39126
39167
  let experiments;
39127
39168
  const events = createEventBus();
39128
39169
  console.log("[Syntro Bootstrap] EventBus created");
@@ -39136,7 +39177,7 @@ ${cssRules}
39136
39177
  cacheSegmentAttributes(segmentFlags);
39137
39178
  if (experiments) {
39138
39179
  const sessionAttrs = sessionMetrics?.getAll?.() ?? {};
39139
- const updatedAttrs = { ...sessionAttrs, ...segmentFlags };
39180
+ const updatedAttrs = { ...browserMetadata, ...sessionAttrs, ...segmentFlags };
39140
39181
  debug("Syntro Bootstrap", "Updating GrowthBook with attributes:", updatedAttrs);
39141
39182
  experiments.setAttributes?.(updatedAttrs);
39142
39183
  }
@@ -39163,8 +39204,8 @@ ${cssRules}
39163
39204
  clientKey: payload.e,
39164
39205
  apiHost: experimentHost,
39165
39206
  // undefined falls back to adapter default
39166
- // Phase 1: Use cached segment attributes for instant evaluation
39167
- attributes: cachedSegmentAttrs,
39207
+ // Phase 1: Use browser metadata + cached segment attributes for instant evaluation
39208
+ attributes: phaseOneAttrs,
39168
39209
  // Wire experiment tracking to telemetry provider
39169
39210
  onExperimentViewed: telemetry?.trackExperiment ? (key, variationId, variationName) => {
39170
39211
  telemetry.trackExperiment(key, variationId, variationName);
@@ -39344,7 +39385,7 @@ ${cssRules}
39344
39385
  }
39345
39386
 
39346
39387
  // src/index.ts
39347
- var RUNTIME_SDK_BUILD = true ? `${"2026-03-05T16:08:37.839Z"} (${"0c8e316295"})` : "dev";
39388
+ var RUNTIME_SDK_BUILD = true ? `${"2026-03-06T03:05:19.821Z"} (${"5cbe62a7e7"})` : "dev";
39348
39389
  if (typeof window !== "undefined") {
39349
39390
  console.log(`[Syntro Runtime] Build: ${RUNTIME_SDK_BUILD}`);
39350
39391
  const existing = window.SynOS;