@syntrologie/runtime-sdk 2.6.0-canary.1 → 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.
- package/dist/bootstrap.d.ts +7 -5
- package/dist/{chunk-Q4WGXNKC.js → chunk-AUDHAZ3R.js} +83 -43
- package/dist/{chunk-Q4WGXNKC.js.map → chunk-AUDHAZ3R.js.map} +2 -2
- package/dist/context/ContextManager.d.ts +5 -5
- package/dist/decisions/types.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/overlays/runtime/overlay/tooltip.d.ts +10 -0
- package/dist/react.js +1 -1
- package/dist/smart-canvas.esm.js +30 -30
- package/dist/smart-canvas.esm.js.map +3 -3
- package/dist/smart-canvas.js +80 -44
- package/dist/smart-canvas.js.map +3 -3
- package/dist/smart-canvas.min.js +30 -30
- package/dist/smart-canvas.min.js.map +3 -3
- package/dist/version.d.ts +1 -1
- package/package.json +7 -7
package/dist/smart-canvas.js
CHANGED
|
@@ -19285,7 +19285,7 @@ var SyntrologieSDK = (() => {
|
|
|
19285
19285
|
}
|
|
19286
19286
|
|
|
19287
19287
|
// src/version.ts
|
|
19288
|
-
var SDK_VERSION = "2.6.0-canary.
|
|
19288
|
+
var SDK_VERSION = "2.6.0-canary.3";
|
|
19289
19289
|
|
|
19290
19290
|
// src/types.ts
|
|
19291
19291
|
var SDK_SCHEMA_VERSION = "2.0";
|
|
@@ -36651,7 +36651,7 @@ ${cssRules}
|
|
|
36651
36651
|
return regex.test(normalizedPath);
|
|
36652
36652
|
}
|
|
36653
36653
|
var ContextManager = class {
|
|
36654
|
-
constructor(options
|
|
36654
|
+
constructor(options) {
|
|
36655
36655
|
__publicField(this, "context");
|
|
36656
36656
|
__publicField(this, "previousContext");
|
|
36657
36657
|
__publicField(this, "listeners", /* @__PURE__ */ new Set());
|
|
@@ -36743,30 +36743,8 @@ ${cssRules}
|
|
|
36743
36743
|
};
|
|
36744
36744
|
window.addEventListener("resize", handleResize);
|
|
36745
36745
|
this.cleanupFns.push(() => window.removeEventListener("resize", handleResize));
|
|
36746
|
-
|
|
36747
|
-
|
|
36748
|
-
this.cleanupFns.push(unsub);
|
|
36749
|
-
} else {
|
|
36750
|
-
const handlePopState = () => {
|
|
36751
|
-
this.updatePage();
|
|
36752
|
-
};
|
|
36753
|
-
window.addEventListener("popstate", handlePopState);
|
|
36754
|
-
this.cleanupFns.push(() => window.removeEventListener("popstate", handlePopState));
|
|
36755
|
-
const originalPushState = history.pushState.bind(history);
|
|
36756
|
-
const originalReplaceState = history.replaceState.bind(history);
|
|
36757
|
-
history.pushState = (...args) => {
|
|
36758
|
-
originalPushState(...args);
|
|
36759
|
-
queueMicrotask(() => this.updatePage());
|
|
36760
|
-
};
|
|
36761
|
-
history.replaceState = (...args) => {
|
|
36762
|
-
originalReplaceState(...args);
|
|
36763
|
-
queueMicrotask(() => this.updatePage());
|
|
36764
|
-
};
|
|
36765
|
-
this.cleanupFns.push(() => {
|
|
36766
|
-
history.pushState = originalPushState;
|
|
36767
|
-
history.replaceState = originalReplaceState;
|
|
36768
|
-
});
|
|
36769
|
-
}
|
|
36746
|
+
const unsub = this.navigation.subscribe(() => this.updatePage());
|
|
36747
|
+
this.cleanupFns.push(unsub);
|
|
36770
36748
|
}
|
|
36771
36749
|
updateViewport() {
|
|
36772
36750
|
const newViewport = {
|
|
@@ -36822,7 +36800,7 @@ ${cssRules}
|
|
|
36822
36800
|
}
|
|
36823
36801
|
}
|
|
36824
36802
|
};
|
|
36825
|
-
function createContextManager(options
|
|
36803
|
+
function createContextManager(options) {
|
|
36826
36804
|
return new ContextManager(options);
|
|
36827
36805
|
}
|
|
36828
36806
|
|
|
@@ -36907,8 +36885,9 @@ ${cssRules}
|
|
|
36907
36885
|
return events.hasRecentEvent(condition.eventName, withinMs);
|
|
36908
36886
|
}
|
|
36909
36887
|
case "state_equals": {
|
|
36910
|
-
if (!state) return false;
|
|
36911
|
-
|
|
36888
|
+
if (!state?.getValue) return false;
|
|
36889
|
+
const actual = state.getValue(condition.key);
|
|
36890
|
+
return actual === condition.value;
|
|
36912
36891
|
}
|
|
36913
36892
|
case "viewport": {
|
|
36914
36893
|
const { width, height } = context.viewport;
|
|
@@ -37045,7 +37024,8 @@ ${cssRules}
|
|
|
37045
37024
|
isDismissed: (key) => state.dismissals.isDismissed(key),
|
|
37046
37025
|
isCooldownActive: (key) => state.cooldowns.isActive(key),
|
|
37047
37026
|
getFrequencyCount: (key) => state.frequency.count(key),
|
|
37048
|
-
getSessionMetric: (key) => sessionMetrics?.get(key) ?? 0
|
|
37027
|
+
getSessionMetric: (key) => sessionMetrics?.get(key) ?? 0,
|
|
37028
|
+
getValue: (key) => state.session.get(key) ?? state.user.get(key)
|
|
37049
37029
|
} : void 0,
|
|
37050
37030
|
events: events ? {
|
|
37051
37031
|
hasRecentEvent: (eventName, withinMs) => events.hasRecentEvent(eventName, withinMs)
|
|
@@ -38625,6 +38605,22 @@ ${cssRules}
|
|
|
38625
38605
|
accumulator
|
|
38626
38606
|
}
|
|
38627
38607
|
});
|
|
38608
|
+
let unsubPageViews;
|
|
38609
|
+
if (sessionMetrics) {
|
|
38610
|
+
sessionMetrics.increment("page_views");
|
|
38611
|
+
let lastCountedPath = typeof window !== "undefined" ? window.location.pathname : "/";
|
|
38612
|
+
unsubPageViews = navigation2.subscribe((url, method) => {
|
|
38613
|
+
if (method === "replaceState") return;
|
|
38614
|
+
try {
|
|
38615
|
+
const newPath = new URL(url).pathname;
|
|
38616
|
+
if (newPath !== lastCountedPath) {
|
|
38617
|
+
lastCountedPath = newPath;
|
|
38618
|
+
sessionMetrics.increment("page_views");
|
|
38619
|
+
}
|
|
38620
|
+
} catch {
|
|
38621
|
+
}
|
|
38622
|
+
});
|
|
38623
|
+
}
|
|
38628
38624
|
const runtime7 = {
|
|
38629
38625
|
telemetry,
|
|
38630
38626
|
context,
|
|
@@ -38683,6 +38679,7 @@ ${cssRules}
|
|
|
38683
38679
|
apps.unbind().catch((err) => {
|
|
38684
38680
|
console.error("[Runtime] Error unbinding apps registry:", err);
|
|
38685
38681
|
});
|
|
38682
|
+
unsubPageViews?.();
|
|
38686
38683
|
anchorResolverService.destroy();
|
|
38687
38684
|
accumulator.destroy();
|
|
38688
38685
|
navigation2.destroy();
|
|
@@ -39054,6 +39051,44 @@ ${cssRules}
|
|
|
39054
39051
|
}
|
|
39055
39052
|
return segmentFlags;
|
|
39056
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
|
+
}
|
|
39057
39092
|
async function init(options) {
|
|
39058
39093
|
initLogger();
|
|
39059
39094
|
debug("Syntro Bootstrap", "====== INIT ======");
|
|
@@ -39125,7 +39160,10 @@ ${cssRules}
|
|
|
39125
39160
|
const telemetryHost = getEnvVar("NEXT_PUBLIC_SYNTRO_TELEMETRY_HOST") || getEnvVar("VITE_SYNTRO_TELEMETRY_HOST") || payload?.th;
|
|
39126
39161
|
const editorUrl = getEnvVar("NEXT_PUBLIC_SYNTRO_EDITOR_URL") || getEnvVar("VITE_SYNTRO_EDITOR_URL") || options.canvas?.editorUrl;
|
|
39127
39162
|
const cachedSegmentAttrs = loadCachedSegmentAttributes();
|
|
39128
|
-
|
|
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);
|
|
39129
39167
|
let experiments;
|
|
39130
39168
|
const events = createEventBus();
|
|
39131
39169
|
console.log("[Syntro Bootstrap] EventBus created");
|
|
@@ -39139,7 +39177,7 @@ ${cssRules}
|
|
|
39139
39177
|
cacheSegmentAttributes(segmentFlags);
|
|
39140
39178
|
if (experiments) {
|
|
39141
39179
|
const sessionAttrs = sessionMetrics?.getAll?.() ?? {};
|
|
39142
|
-
const updatedAttrs = { ...sessionAttrs, ...segmentFlags };
|
|
39180
|
+
const updatedAttrs = { ...browserMetadata, ...sessionAttrs, ...segmentFlags };
|
|
39143
39181
|
debug("Syntro Bootstrap", "Updating GrowthBook with attributes:", updatedAttrs);
|
|
39144
39182
|
experiments.setAttributes?.(updatedAttrs);
|
|
39145
39183
|
}
|
|
@@ -39166,23 +39204,21 @@ ${cssRules}
|
|
|
39166
39204
|
clientKey: payload.e,
|
|
39167
39205
|
apiHost: experimentHost,
|
|
39168
39206
|
// undefined falls back to adapter default
|
|
39169
|
-
// Phase 1: Use cached segment attributes for instant evaluation
|
|
39170
|
-
attributes:
|
|
39207
|
+
// Phase 1: Use browser metadata + cached segment attributes for instant evaluation
|
|
39208
|
+
attributes: phaseOneAttrs,
|
|
39171
39209
|
// Wire experiment tracking to telemetry provider
|
|
39172
39210
|
onExperimentViewed: telemetry?.trackExperiment ? (key, variationId, variationName) => {
|
|
39173
39211
|
telemetry.trackExperiment(key, variationId, variationName);
|
|
39174
39212
|
} : void 0
|
|
39175
39213
|
});
|
|
39176
39214
|
}
|
|
39177
|
-
|
|
39178
|
-
|
|
39179
|
-
|
|
39180
|
-
|
|
39181
|
-
|
|
39182
|
-
|
|
39183
|
-
|
|
39184
|
-
debug("Syntro Bootstrap", "SessionMetricTracker created");
|
|
39185
|
-
}
|
|
39215
|
+
sessionMetrics = createSessionMetricTracker({
|
|
39216
|
+
experiments,
|
|
39217
|
+
onMetricChange: (key, value) => {
|
|
39218
|
+
debug("Syntro Bootstrap", `Session metric changed: ${key} = ${value}`);
|
|
39219
|
+
}
|
|
39220
|
+
});
|
|
39221
|
+
debug("Syntro Bootstrap", "SessionMetricTracker created");
|
|
39186
39222
|
let runtimeMode = "production";
|
|
39187
39223
|
if (editorMode) runtimeMode = "editor";
|
|
39188
39224
|
else if (auditMode) runtimeMode = "audit";
|
|
@@ -39349,7 +39385,7 @@ ${cssRules}
|
|
|
39349
39385
|
}
|
|
39350
39386
|
|
|
39351
39387
|
// src/index.ts
|
|
39352
|
-
var RUNTIME_SDK_BUILD = true ? `${"2026-03-
|
|
39388
|
+
var RUNTIME_SDK_BUILD = true ? `${"2026-03-06T03:05:19.821Z"} (${"5cbe62a7e7"})` : "dev";
|
|
39353
39389
|
if (typeof window !== "undefined") {
|
|
39354
39390
|
console.log(`[Syntro Runtime] Build: ${RUNTIME_SDK_BUILD}`);
|
|
39355
39391
|
const existing = window.SynOS;
|