@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.
- package/dist/bootstrap-types.d.ts +11 -0
- package/dist/{chunk-K56N5LRE.js → chunk-TOBT6CVT.js} +73 -13
- package/dist/{chunk-K56N5LRE.js.map → chunk-TOBT6CVT.js.map} +3 -3
- package/dist/index.js +1 -1
- package/dist/react.js +1 -1
- package/dist/smart-canvas.esm.js +41 -41
- package/dist/smart-canvas.esm.js.map +3 -3
- package/dist/smart-canvas.js +64 -5
- package/dist/smart-canvas.js.map +2 -2
- package/dist/smart-canvas.min.js +41 -41
- package/dist/smart-canvas.min.js.map +3 -3
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -56,6 +56,17 @@ export interface SyntroInitOptions {
|
|
|
56
56
|
* @default false
|
|
57
57
|
*/
|
|
58
58
|
testMode?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* App-provided signal values. These are merged into SDK attributes
|
|
61
|
+
* alongside auto-collected browser/geo signals for local flag evaluation.
|
|
62
|
+
*
|
|
63
|
+
* Use this when the host environment (MCP server, agent, etc.) provides
|
|
64
|
+
* signal values that the SDK can't auto-collect from the browser.
|
|
65
|
+
*
|
|
66
|
+
* Values are also registered as PostHog super properties so every
|
|
67
|
+
* event includes them.
|
|
68
|
+
*/
|
|
69
|
+
appSignals?: Record<string, string>;
|
|
59
70
|
}
|
|
60
71
|
export interface SyntroInitResult {
|
|
61
72
|
/**
|
|
@@ -3456,7 +3456,7 @@ function getAntiFlickerSnippet(config = {}) {
|
|
|
3456
3456
|
}
|
|
3457
3457
|
|
|
3458
3458
|
// src/version.ts
|
|
3459
|
-
var SDK_VERSION = "2.8.0-canary.
|
|
3459
|
+
var SDK_VERSION = "2.8.0-canary.90";
|
|
3460
3460
|
|
|
3461
3461
|
// src/types.ts
|
|
3462
3462
|
var SDK_SCHEMA_VERSION = "2.0";
|
|
@@ -11625,7 +11625,7 @@ function extractSegmentFlags(allFlags) {
|
|
|
11625
11625
|
return segmentFlags;
|
|
11626
11626
|
}
|
|
11627
11627
|
function collectBrowserMetadata() {
|
|
11628
|
-
var _a2;
|
|
11628
|
+
var _a2, _b;
|
|
11629
11629
|
if (typeof window === "undefined") return {};
|
|
11630
11630
|
const attrs = {};
|
|
11631
11631
|
try {
|
|
@@ -11677,6 +11677,19 @@ function collectBrowserMetadata() {
|
|
|
11677
11677
|
if (window.location.search) attrs.page_query = window.location.search;
|
|
11678
11678
|
} catch {
|
|
11679
11679
|
}
|
|
11680
|
+
try {
|
|
11681
|
+
const tg = (_b = window.Telegram) == null ? void 0 : _b.WebApp;
|
|
11682
|
+
if (tg) {
|
|
11683
|
+
attrs.surface_type = "telegram";
|
|
11684
|
+
attrs.surface_host = tg.platform || "unknown";
|
|
11685
|
+
} else {
|
|
11686
|
+
attrs.surface_type = "web";
|
|
11687
|
+
attrs.surface_host = "web";
|
|
11688
|
+
}
|
|
11689
|
+
} catch {
|
|
11690
|
+
attrs.surface_type = "web";
|
|
11691
|
+
attrs.surface_host = "web";
|
|
11692
|
+
}
|
|
11680
11693
|
return attrs;
|
|
11681
11694
|
}
|
|
11682
11695
|
var GEO_CACHE_KEY = "syntro_geo";
|
|
@@ -11966,7 +11979,7 @@ function createTelemetryClient(provider, config) {
|
|
|
11966
11979
|
|
|
11967
11980
|
// src/bootstrap-runtime.ts
|
|
11968
11981
|
async function _initCore(options) {
|
|
11969
|
-
var _a2, _b, _c, _d, _e, _f, _g;
|
|
11982
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11970
11983
|
initLogger();
|
|
11971
11984
|
debug("Syntro Bootstrap", "====== INIT ======");
|
|
11972
11985
|
debug("Syntro Bootstrap", "Options:", {
|
|
@@ -12034,10 +12047,46 @@ async function _initCore(options) {
|
|
|
12034
12047
|
const geoHost = (payload == null ? void 0 : payload.g) || getEnvVar("NEXT_PUBLIC_SYNTRO_GEO_HOST") || getEnvVar("VITE_SYNTRO_GEO_HOST") || GEO_DEFAULT_HOST;
|
|
12035
12048
|
const cachedSegmentAttrs = loadCachedSegmentAttributes();
|
|
12036
12049
|
const browserMetadata = collectBrowserMetadata();
|
|
12037
|
-
const
|
|
12050
|
+
const appSignals = (_c = options.appSignals) != null ? _c : {};
|
|
12051
|
+
const phaseOneAttrs = { ...browserMetadata, ...cachedSegmentAttrs, ...appSignals };
|
|
12038
12052
|
debug("Syntro Bootstrap", "Phase 1: Browser metadata:", browserMetadata);
|
|
12039
12053
|
debug("Syntro Bootstrap", "Phase 1: Cached segment attributes:", cachedSegmentAttrs);
|
|
12054
|
+
if (Object.keys(appSignals).length > 0) {
|
|
12055
|
+
debug("Syntro Bootstrap", "Phase 1: App signals:", appSignals);
|
|
12056
|
+
}
|
|
12040
12057
|
const geoPromise = fetchGeo(geoHost);
|
|
12058
|
+
const mcpPromise = (() => {
|
|
12059
|
+
try {
|
|
12060
|
+
if (typeof window === "undefined" || window.self === window.top) return Promise.resolve(null);
|
|
12061
|
+
} catch {
|
|
12062
|
+
}
|
|
12063
|
+
return new Promise((resolve) => {
|
|
12064
|
+
const timer = setTimeout(() => {
|
|
12065
|
+
window.removeEventListener("message", handler);
|
|
12066
|
+
resolve(null);
|
|
12067
|
+
}, 500);
|
|
12068
|
+
function handler(event) {
|
|
12069
|
+
var _a3;
|
|
12070
|
+
const data = event.data;
|
|
12071
|
+
if ((data == null ? void 0 : data.jsonrpc) === "2.0" && (data == null ? void 0 : data.id) === 1 && ((_a3 = data == null ? void 0 : data.result) == null ? void 0 : _a3.hostInfo)) {
|
|
12072
|
+
clearTimeout(timer);
|
|
12073
|
+
window.removeEventListener("message", handler);
|
|
12074
|
+
resolve(data.result.hostInfo);
|
|
12075
|
+
}
|
|
12076
|
+
}
|
|
12077
|
+
window.addEventListener("message", handler);
|
|
12078
|
+
try {
|
|
12079
|
+
window.parent.postMessage(
|
|
12080
|
+
{ jsonrpc: "2.0", id: 1, method: "ui/initialize", params: { capabilities: {} } },
|
|
12081
|
+
"*"
|
|
12082
|
+
);
|
|
12083
|
+
} catch {
|
|
12084
|
+
clearTimeout(timer);
|
|
12085
|
+
window.removeEventListener("message", handler);
|
|
12086
|
+
resolve(null);
|
|
12087
|
+
}
|
|
12088
|
+
});
|
|
12089
|
+
})();
|
|
12041
12090
|
let experiments;
|
|
12042
12091
|
const isDebugOrTest = options.debug || options.testMode;
|
|
12043
12092
|
const events = createEventBus({
|
|
@@ -12092,7 +12141,7 @@ async function _initCore(options) {
|
|
|
12092
12141
|
cacheSegmentAttributes(segmentFlags);
|
|
12093
12142
|
if (experiments) {
|
|
12094
12143
|
const sessionAttrs = (_b2 = (_a3 = sessionMetrics == null ? void 0 : sessionMetrics.getAll) == null ? void 0 : _a3.call(sessionMetrics)) != null ? _b2 : {};
|
|
12095
|
-
const updatedAttrs = { ...browserMetadata, ...sessionAttrs, ...segmentFlags };
|
|
12144
|
+
const updatedAttrs = { ...browserMetadata, ...sessionAttrs, ...segmentFlags, ...appSignals };
|
|
12096
12145
|
debug("Syntro Bootstrap", "Updating GrowthBook with attributes:", updatedAttrs);
|
|
12097
12146
|
(_c2 = experiments.setAttributes) == null ? void 0 : _c2.call(experiments, updatedAttrs);
|
|
12098
12147
|
}
|
|
@@ -12119,6 +12168,10 @@ async function _initCore(options) {
|
|
|
12119
12168
|
}
|
|
12120
12169
|
});
|
|
12121
12170
|
console.log(`[Syntro Bootstrap] Telemetry client created (${provider}) with EventBus wiring`);
|
|
12171
|
+
if (Object.keys(appSignals).length > 0) {
|
|
12172
|
+
(_d = telemetry.register) == null ? void 0 : _d.call(telemetry, appSignals);
|
|
12173
|
+
debug("Syntro Bootstrap", "Registered app signals as super properties:", appSignals);
|
|
12174
|
+
}
|
|
12122
12175
|
const telemetryForCapture = telemetry;
|
|
12123
12176
|
events.setPosthogCapture((name, props) => {
|
|
12124
12177
|
var _a3;
|
|
@@ -12189,7 +12242,7 @@ async function _initCore(options) {
|
|
|
12189
12242
|
};
|
|
12190
12243
|
debug("Syntro Bootstrap", "Global SynOS object exposed");
|
|
12191
12244
|
}
|
|
12192
|
-
const registeredApps = (
|
|
12245
|
+
const registeredApps = (_g = (_f = (_e = runtime3.apps).list) == null ? void 0 : _f.call(_e)) != null ? _g : [];
|
|
12193
12246
|
console.log(
|
|
12194
12247
|
`[DIAG] Activation loop: ${registeredApps.length} apps in registry:`,
|
|
12195
12248
|
registeredApps.map((a) => `${a.manifest.id}(${a.state})`).join(", ")
|
|
@@ -12218,15 +12271,22 @@ async function _initCore(options) {
|
|
|
12218
12271
|
}
|
|
12219
12272
|
const geoData = await geoPromise;
|
|
12220
12273
|
if (experiments && Object.keys(geoData).length > 0) {
|
|
12221
|
-
const mergedAttrs = { ...browserMetadata, ...geoData };
|
|
12274
|
+
const mergedAttrs = { ...browserMetadata, ...geoData, ...appSignals };
|
|
12222
12275
|
debug("Syntro Bootstrap", "Merging geo data into GrowthBook attributes:", geoData);
|
|
12223
|
-
(
|
|
12276
|
+
(_h = experiments.setAttributes) == null ? void 0 : _h.call(experiments, mergedAttrs);
|
|
12277
|
+
}
|
|
12278
|
+
const mcpHost = await mcpPromise;
|
|
12279
|
+
if (mcpHost && experiments) {
|
|
12280
|
+
browserMetadata.surface_type = "mcp-app";
|
|
12281
|
+
browserMetadata.surface_host = mcpHost.name;
|
|
12282
|
+
(_i = experiments.setAttributes) == null ? void 0 : _i.call(experiments, { ...browserMetadata, ...geoData });
|
|
12283
|
+
debug("Syntro Bootstrap", "MCP App detected:", mcpHost.name);
|
|
12224
12284
|
}
|
|
12225
12285
|
let baseFetcher;
|
|
12226
12286
|
if (options.fetcher) {
|
|
12227
12287
|
baseFetcher = options.fetcher;
|
|
12228
12288
|
} else if (payload == null ? void 0 : payload.f) {
|
|
12229
|
-
const configFetcher = createConfigFetcher(payload.f, (
|
|
12289
|
+
const configFetcher = createConfigFetcher(payload.f, (_j = payload.o) != null ? _j : {});
|
|
12230
12290
|
baseFetcher = async () => {
|
|
12231
12291
|
var _a3;
|
|
12232
12292
|
const result = await configFetcher.fetch();
|
|
@@ -12240,7 +12300,7 @@ async function _initCore(options) {
|
|
|
12240
12300
|
}
|
|
12241
12301
|
const warnedAppFailures = /* @__PURE__ */ new Set();
|
|
12242
12302
|
const appLoadingFetcher = baseFetcher ? async () => {
|
|
12243
|
-
var _a3, _b2, _c2, _d2, _e2, _f2, _g2,
|
|
12303
|
+
var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k, _l;
|
|
12244
12304
|
const config = await baseFetcher();
|
|
12245
12305
|
const tileCount = (_b2 = (_a3 = config.tiles) == null ? void 0 : _a3.length) != null ? _b2 : 0;
|
|
12246
12306
|
const actionCount = (_d2 = (_c2 = config.actions) == null ? void 0 : _c2.length) != null ? _d2 : 0;
|
|
@@ -12265,8 +12325,8 @@ async function _initCore(options) {
|
|
|
12265
12325
|
console.log(
|
|
12266
12326
|
"[Syntro Bootstrap] Config fetched:",
|
|
12267
12327
|
`tiles=${(_g2 = (_f2 = config.tiles) == null ? void 0 : _f2.length) != null ? _g2 : 0},`,
|
|
12268
|
-
`actions=${(
|
|
12269
|
-
`theme=${(_k = (
|
|
12328
|
+
`actions=${(_i2 = (_h2 = config.actions) == null ? void 0 : _h2.length) != null ? _i2 : 0},`,
|
|
12329
|
+
`theme=${(_k = (_j2 = config.theme) == null ? void 0 : _j2.name) != null ? _k : "none"}`
|
|
12270
12330
|
);
|
|
12271
12331
|
if (((_l = config.actions) == null ? void 0 : _l.length) > 0) {
|
|
12272
12332
|
console.log(
|
|
@@ -12470,4 +12530,4 @@ export {
|
|
|
12470
12530
|
encodeToken,
|
|
12471
12531
|
Syntro
|
|
12472
12532
|
};
|
|
12473
|
-
//# sourceMappingURL=chunk-
|
|
12533
|
+
//# sourceMappingURL=chunk-TOBT6CVT.js.map
|