@syntrologie/runtime-sdk 2.5.1 → 2.6.0-canary.2
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 +1 -5
- package/dist/{chunk-SH5I7ZLB.js → chunk-FXRARX6K.js} +37 -39
- package/dist/chunk-FXRARX6K.js.map +7 -0
- 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 +21 -21
- package/dist/smart-canvas.esm.js.map +3 -3
- package/dist/smart-canvas.js +35 -40
- package/dist/smart-canvas.js.map +2 -2
- package/dist/smart-canvas.min.js +21 -21
- package/dist/smart-canvas.min.js.map +3 -3
- package/dist/version.d.ts +1 -1
- package/package.json +7 -7
- package/dist/chunk-SH5I7ZLB.js.map +0 -7
package/dist/bootstrap.d.ts
CHANGED
|
@@ -46,11 +46,7 @@ export interface SyntroInitOptions {
|
|
|
46
46
|
*/
|
|
47
47
|
fetcher?: CanvasConfigFetcher;
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
50
|
-
* When true, a SessionMetricTracker is created that tracks metrics during
|
|
51
|
-
* the user's session and updates GrowthBook attributes in real-time.
|
|
52
|
-
*
|
|
53
|
-
* @default false
|
|
49
|
+
* @deprecated Session metrics are always enabled. This flag has no effect.
|
|
54
50
|
*/
|
|
55
51
|
enableSessionMetrics?: boolean;
|
|
56
52
|
/**
|
|
@@ -3358,7 +3358,7 @@ function getAntiFlickerSnippet(config = {}) {
|
|
|
3358
3358
|
}
|
|
3359
3359
|
|
|
3360
3360
|
// src/version.ts
|
|
3361
|
-
var SDK_VERSION = "2.
|
|
3361
|
+
var SDK_VERSION = "2.6.0-canary.2";
|
|
3362
3362
|
|
|
3363
3363
|
// src/types.ts
|
|
3364
3364
|
var SDK_SCHEMA_VERSION = "2.0";
|
|
@@ -8578,7 +8578,7 @@ function matchPattern(pathname, pattern) {
|
|
|
8578
8578
|
return regex.test(normalizedPath);
|
|
8579
8579
|
}
|
|
8580
8580
|
var ContextManager = class {
|
|
8581
|
-
constructor(options
|
|
8581
|
+
constructor(options) {
|
|
8582
8582
|
__publicField(this, "context");
|
|
8583
8583
|
__publicField(this, "previousContext");
|
|
8584
8584
|
__publicField(this, "listeners", /* @__PURE__ */ new Set());
|
|
@@ -8671,30 +8671,8 @@ var ContextManager = class {
|
|
|
8671
8671
|
};
|
|
8672
8672
|
window.addEventListener("resize", handleResize);
|
|
8673
8673
|
this.cleanupFns.push(() => window.removeEventListener("resize", handleResize));
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
this.cleanupFns.push(unsub);
|
|
8677
|
-
} else {
|
|
8678
|
-
const handlePopState = () => {
|
|
8679
|
-
this.updatePage();
|
|
8680
|
-
};
|
|
8681
|
-
window.addEventListener("popstate", handlePopState);
|
|
8682
|
-
this.cleanupFns.push(() => window.removeEventListener("popstate", handlePopState));
|
|
8683
|
-
const originalPushState = history.pushState.bind(history);
|
|
8684
|
-
const originalReplaceState = history.replaceState.bind(history);
|
|
8685
|
-
history.pushState = (...args) => {
|
|
8686
|
-
originalPushState(...args);
|
|
8687
|
-
queueMicrotask(() => this.updatePage());
|
|
8688
|
-
};
|
|
8689
|
-
history.replaceState = (...args) => {
|
|
8690
|
-
originalReplaceState(...args);
|
|
8691
|
-
queueMicrotask(() => this.updatePage());
|
|
8692
|
-
};
|
|
8693
|
-
this.cleanupFns.push(() => {
|
|
8694
|
-
history.pushState = originalPushState;
|
|
8695
|
-
history.replaceState = originalReplaceState;
|
|
8696
|
-
});
|
|
8697
|
-
}
|
|
8674
|
+
const unsub = this.navigation.subscribe(() => this.updatePage());
|
|
8675
|
+
this.cleanupFns.push(unsub);
|
|
8698
8676
|
}
|
|
8699
8677
|
updateViewport() {
|
|
8700
8678
|
const newViewport = {
|
|
@@ -8750,7 +8728,7 @@ var ContextManager = class {
|
|
|
8750
8728
|
}
|
|
8751
8729
|
}
|
|
8752
8730
|
};
|
|
8753
|
-
function createContextManager(options
|
|
8731
|
+
function createContextManager(options) {
|
|
8754
8732
|
return new ContextManager(options);
|
|
8755
8733
|
}
|
|
8756
8734
|
|
|
@@ -8789,8 +8767,9 @@ function evaluateCondition(condition, evalContext) {
|
|
|
8789
8767
|
return events.hasRecentEvent(condition.eventName, withinMs);
|
|
8790
8768
|
}
|
|
8791
8769
|
case "state_equals": {
|
|
8792
|
-
if (!state) return false;
|
|
8793
|
-
|
|
8770
|
+
if (!(state == null ? void 0 : state.getValue)) return false;
|
|
8771
|
+
const actual = state.getValue(condition.key);
|
|
8772
|
+
return actual === condition.value;
|
|
8794
8773
|
}
|
|
8795
8774
|
case "viewport": {
|
|
8796
8775
|
const { width, height } = context.viewport;
|
|
@@ -8931,6 +8910,10 @@ function createEvaluationContext(context, options) {
|
|
|
8931
8910
|
getSessionMetric: (key) => {
|
|
8932
8911
|
var _a2;
|
|
8933
8912
|
return (_a2 = sessionMetrics == null ? void 0 : sessionMetrics.get(key)) != null ? _a2 : 0;
|
|
8913
|
+
},
|
|
8914
|
+
getValue: (key) => {
|
|
8915
|
+
var _a2;
|
|
8916
|
+
return (_a2 = state.session.get(key)) != null ? _a2 : state.user.get(key);
|
|
8934
8917
|
}
|
|
8935
8918
|
} : void 0,
|
|
8936
8919
|
events: events ? {
|
|
@@ -10507,6 +10490,22 @@ function createSmartCanvasRuntime(options = {}) {
|
|
|
10507
10490
|
accumulator
|
|
10508
10491
|
}
|
|
10509
10492
|
});
|
|
10493
|
+
let unsubPageViews;
|
|
10494
|
+
if (sessionMetrics) {
|
|
10495
|
+
sessionMetrics.increment("page_views");
|
|
10496
|
+
let lastCountedPath = typeof window !== "undefined" ? window.location.pathname : "/";
|
|
10497
|
+
unsubPageViews = navigation.subscribe((url, method) => {
|
|
10498
|
+
if (method === "replaceState") return;
|
|
10499
|
+
try {
|
|
10500
|
+
const newPath = new URL(url).pathname;
|
|
10501
|
+
if (newPath !== lastCountedPath) {
|
|
10502
|
+
lastCountedPath = newPath;
|
|
10503
|
+
sessionMetrics.increment("page_views");
|
|
10504
|
+
}
|
|
10505
|
+
} catch {
|
|
10506
|
+
}
|
|
10507
|
+
});
|
|
10508
|
+
}
|
|
10510
10509
|
const runtime3 = {
|
|
10511
10510
|
telemetry,
|
|
10512
10511
|
context,
|
|
@@ -10566,6 +10565,7 @@ function createSmartCanvasRuntime(options = {}) {
|
|
|
10566
10565
|
apps.unbind().catch((err) => {
|
|
10567
10566
|
console.error("[Runtime] Error unbinding apps registry:", err);
|
|
10568
10567
|
});
|
|
10568
|
+
unsubPageViews == null ? void 0 : unsubPageViews();
|
|
10569
10569
|
anchorResolverService.destroy();
|
|
10570
10570
|
accumulator.destroy();
|
|
10571
10571
|
navigation.destroy();
|
|
@@ -11048,15 +11048,13 @@ async function init(options) {
|
|
|
11048
11048
|
} : void 0
|
|
11049
11049
|
});
|
|
11050
11050
|
}
|
|
11051
|
-
|
|
11052
|
-
|
|
11053
|
-
|
|
11054
|
-
|
|
11055
|
-
|
|
11056
|
-
|
|
11057
|
-
|
|
11058
|
-
debug("Syntro Bootstrap", "SessionMetricTracker created");
|
|
11059
|
-
}
|
|
11051
|
+
sessionMetrics = createSessionMetricTracker({
|
|
11052
|
+
experiments,
|
|
11053
|
+
onMetricChange: (key, value) => {
|
|
11054
|
+
debug("Syntro Bootstrap", `Session metric changed: ${key} = ${value}`);
|
|
11055
|
+
}
|
|
11056
|
+
});
|
|
11057
|
+
debug("Syntro Bootstrap", "SessionMetricTracker created");
|
|
11060
11058
|
let runtimeMode = "production";
|
|
11061
11059
|
if (editorMode) runtimeMode = "editor";
|
|
11062
11060
|
else if (auditMode) runtimeMode = "audit";
|
|
@@ -11328,4 +11326,4 @@ export {
|
|
|
11328
11326
|
encodeToken,
|
|
11329
11327
|
Syntro
|
|
11330
11328
|
};
|
|
11331
|
-
//# sourceMappingURL=chunk-
|
|
11329
|
+
//# sourceMappingURL=chunk-FXRARX6K.js.map
|