@syntrologie/runtime-sdk 2.8.0-canary.206 → 2.8.0-canary.208
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/actions/schema.js +2 -2
- package/dist/bootstrap-init.d.ts +12 -0
- package/dist/bootstrap.d.ts +1 -1
- package/dist/{chunk-44V2AOO4.js → chunk-3EK46GSN.js} +4 -2
- package/dist/{chunk-44V2AOO4.js.map → chunk-3EK46GSN.js.map} +2 -2
- package/dist/{chunk-FMLX4END.js → chunk-TVREQFRK.js} +2 -2
- package/dist/config/schema.js +1 -1
- package/dist/index.js +96 -30
- package/dist/index.js.map +3 -3
- package/dist/smart-canvas.esm.js +198 -198
- package/dist/smart-canvas.esm.js.map +3 -3
- package/dist/smart-canvas.js +94 -26
- package/dist/smart-canvas.js.map +3 -3
- package/dist/smart-canvas.min.js +198 -198
- package/dist/smart-canvas.min.js.map +3 -3
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/schema/canvas-config.schema.json +2 -1
- /package/dist/{chunk-FMLX4END.js.map → chunk-TVREQFRK.js.map} +0 -0
package/dist/smart-canvas.js
CHANGED
|
@@ -16728,7 +16728,7 @@ Please report this to https://github.com/markedjs/marked.`, e10) {
|
|
|
16728
16728
|
}
|
|
16729
16729
|
|
|
16730
16730
|
// src/version.ts
|
|
16731
|
-
var SDK_VERSION = "2.8.0-canary.
|
|
16731
|
+
var SDK_VERSION = "2.8.0-canary.208";
|
|
16732
16732
|
|
|
16733
16733
|
// src/types.ts
|
|
16734
16734
|
var SDK_SCHEMA_VERSION = "2.0";
|
|
@@ -18154,7 +18154,8 @@ ${cssRules}
|
|
|
18154
18154
|
`;
|
|
18155
18155
|
}
|
|
18156
18156
|
const configHasTiles = (__privateGet(this, _rawConfig)?.tiles?.length ?? 0) > 0;
|
|
18157
|
-
|
|
18157
|
+
const launcherEnabled = this._launcher?.enabled === true;
|
|
18158
|
+
if (!showSurface && !configHasTiles && !launcherEnabled) return A;
|
|
18158
18159
|
return b2`
|
|
18159
18160
|
<syntro-canvas-overlay
|
|
18160
18161
|
.isOpen=${this._isOpen}
|
|
@@ -20894,7 +20895,9 @@ ${cssRules}
|
|
|
20894
20895
|
fetchedAt: external_exports.string().datetime(),
|
|
20895
20896
|
configVersion: external_exports.string().optional(),
|
|
20896
20897
|
canvasTitle: external_exports.string().optional(),
|
|
20897
|
-
displayMode: external_exports.enum(["standard", "focused", "inline"]).
|
|
20898
|
+
displayMode: external_exports.enum(["standard", "focused", "inline"]).describe(
|
|
20899
|
+
"DO NOT SET \u2014 determined automatically by the runtime based on the surface type (web \u2192 standard, agent/MCP \u2192 inline). Setting this field will be stripped by the config fixer."
|
|
20900
|
+
).optional(),
|
|
20898
20901
|
tiles: external_exports.array(TileZ),
|
|
20899
20902
|
actions: external_exports.array(external_exports.any()),
|
|
20900
20903
|
theme: CanvasThemeConfigZ.optional(),
|
|
@@ -22092,30 +22095,40 @@ ${cssRules}
|
|
|
22092
22095
|
}
|
|
22093
22096
|
return void 0;
|
|
22094
22097
|
}
|
|
22095
|
-
|
|
22096
|
-
|
|
22097
|
-
if (typeof window === "undefined") return {};
|
|
22098
|
+
function loadCached(key, ttlMs) {
|
|
22099
|
+
if (typeof window === "undefined") return null;
|
|
22098
22100
|
try {
|
|
22099
|
-
const
|
|
22100
|
-
if (
|
|
22101
|
-
|
|
22102
|
-
|
|
22103
|
-
|
|
22104
|
-
|
|
22105
|
-
} catch
|
|
22106
|
-
|
|
22101
|
+
const raw = localStorage.getItem(key);
|
|
22102
|
+
if (!raw) return null;
|
|
22103
|
+
const envelope = JSON.parse(raw);
|
|
22104
|
+
if (!envelope || typeof envelope.ts !== "number" || !("data" in envelope)) return null;
|
|
22105
|
+
if (ttlMs != null && Date.now() - envelope.ts > ttlMs) return null;
|
|
22106
|
+
return envelope.data;
|
|
22107
|
+
} catch {
|
|
22108
|
+
return null;
|
|
22107
22109
|
}
|
|
22108
|
-
return {};
|
|
22109
22110
|
}
|
|
22110
|
-
function
|
|
22111
|
+
function writeCached(key, data) {
|
|
22111
22112
|
if (typeof window === "undefined") return;
|
|
22112
22113
|
try {
|
|
22113
|
-
|
|
22114
|
-
|
|
22115
|
-
} catch
|
|
22116
|
-
warn("Syntro Bootstrap", "Failed to cache segment attributes:", err);
|
|
22114
|
+
const envelope = { ts: Date.now(), data };
|
|
22115
|
+
localStorage.setItem(key, JSON.stringify(envelope));
|
|
22116
|
+
} catch {
|
|
22117
22117
|
}
|
|
22118
22118
|
}
|
|
22119
|
+
var SEGMENT_CACHE_KEY = "syntro_segment_attributes";
|
|
22120
|
+
function loadCachedSegmentAttributes() {
|
|
22121
|
+
const cached = loadCached(SEGMENT_CACHE_KEY);
|
|
22122
|
+
if (cached) {
|
|
22123
|
+
debug("Syntro Bootstrap", "Loaded cached segment attributes:", cached);
|
|
22124
|
+
return cached;
|
|
22125
|
+
}
|
|
22126
|
+
return {};
|
|
22127
|
+
}
|
|
22128
|
+
function cacheSegmentAttributes(attrs) {
|
|
22129
|
+
writeCached(SEGMENT_CACHE_KEY, attrs);
|
|
22130
|
+
debug("Syntro Bootstrap", "Cached segment attributes:", attrs);
|
|
22131
|
+
}
|
|
22119
22132
|
function extractSegmentFlags(allFlags) {
|
|
22120
22133
|
if (!allFlags) return {};
|
|
22121
22134
|
const segmentFlags = {};
|
|
@@ -22205,6 +22218,51 @@ ${cssRules}
|
|
|
22205
22218
|
}
|
|
22206
22219
|
return attrs;
|
|
22207
22220
|
}
|
|
22221
|
+
var INITIAL_ATTRS_KEY = "syntro_initial_attrs";
|
|
22222
|
+
var INITIAL_ATTRS_TTL = 30 * 60 * 1e3;
|
|
22223
|
+
var UTM_KEYS = ["utm_source", "utm_medium", "utm_campaign", "utm_content", "utm_term"];
|
|
22224
|
+
function isInternalReferrer(referrerHostname) {
|
|
22225
|
+
if (typeof window === "undefined") return false;
|
|
22226
|
+
try {
|
|
22227
|
+
return referrerHostname === window.location.hostname;
|
|
22228
|
+
} catch {
|
|
22229
|
+
return false;
|
|
22230
|
+
}
|
|
22231
|
+
}
|
|
22232
|
+
function computeInitialAttrs(fresh, cached) {
|
|
22233
|
+
const result = {};
|
|
22234
|
+
const hasFreshUtms = UTM_KEYS.some((k5) => typeof fresh[k5] === "string");
|
|
22235
|
+
for (const key of UTM_KEYS) {
|
|
22236
|
+
const value = hasFreshUtms ? fresh[key] : cached?.[key];
|
|
22237
|
+
if (value) result[key] = value;
|
|
22238
|
+
}
|
|
22239
|
+
const freshReferrerHostname = typeof fresh.referrer_hostname === "string" ? fresh.referrer_hostname : void 0;
|
|
22240
|
+
const isInternal = freshReferrerHostname ? isInternalReferrer(freshReferrerHostname) : true;
|
|
22241
|
+
if (!isInternal && typeof fresh.referrer === "string") {
|
|
22242
|
+
result.referrer = fresh.referrer;
|
|
22243
|
+
if (freshReferrerHostname) result.referrer_hostname = freshReferrerHostname;
|
|
22244
|
+
} else if (cached?.referrer) {
|
|
22245
|
+
result.referrer = cached.referrer;
|
|
22246
|
+
if (cached.referrer_hostname) result.referrer_hostname = cached.referrer_hostname;
|
|
22247
|
+
}
|
|
22248
|
+
if (cached?.initial_page_url) {
|
|
22249
|
+
result.initial_page_url = cached.initial_page_url;
|
|
22250
|
+
if (cached.initial_page_path) result.initial_page_path = cached.initial_page_path;
|
|
22251
|
+
if (cached.initial_page_query) result.initial_page_query = cached.initial_page_query;
|
|
22252
|
+
} else {
|
|
22253
|
+
if (typeof fresh.page_url === "string") result.initial_page_url = fresh.page_url;
|
|
22254
|
+
if (typeof fresh.page_path === "string") result.initial_page_path = fresh.page_path;
|
|
22255
|
+
if (typeof fresh.page_query === "string") result.initial_page_query = fresh.page_query;
|
|
22256
|
+
}
|
|
22257
|
+
return result;
|
|
22258
|
+
}
|
|
22259
|
+
function loadInitialAttrs() {
|
|
22260
|
+
return loadCached(INITIAL_ATTRS_KEY, INITIAL_ATTRS_TTL);
|
|
22261
|
+
}
|
|
22262
|
+
function saveInitialAttrs(attrs) {
|
|
22263
|
+
writeCached(INITIAL_ATTRS_KEY, attrs);
|
|
22264
|
+
debug("Syntro Bootstrap", "Cached initial attrs:", attrs);
|
|
22265
|
+
}
|
|
22208
22266
|
var GEO_CACHE_KEY = "syntro_geo";
|
|
22209
22267
|
var GEO_DEFAULT_HOST = "https://geo.syntrologie.com";
|
|
22210
22268
|
async function fetchGeo(geoHost) {
|
|
@@ -22430,7 +22488,7 @@ ${cssRules}
|
|
|
22430
22488
|
}
|
|
22431
22489
|
|
|
22432
22490
|
// src/defaults/initialProperties.ts
|
|
22433
|
-
var
|
|
22491
|
+
var UTM_KEYS2 = ["utm_source", "utm_medium", "utm_campaign", "utm_content", "utm_term"];
|
|
22434
22492
|
function isStrictRegion(geo) {
|
|
22435
22493
|
if (geo.is_eu === "true") return true;
|
|
22436
22494
|
if (geo.country_code === "GB" || geo.country_code === "CH") return true;
|
|
@@ -22459,7 +22517,7 @@ ${cssRules}
|
|
|
22459
22517
|
$initial_referrer: referrer,
|
|
22460
22518
|
$initial_referring_domain: safeReferringDomain(referrer)
|
|
22461
22519
|
};
|
|
22462
|
-
for (const key of
|
|
22520
|
+
for (const key of UTM_KEYS2) {
|
|
22463
22521
|
const value = params.get(key);
|
|
22464
22522
|
if (value) {
|
|
22465
22523
|
props[`$initial_${key}`] = value;
|
|
@@ -33867,8 +33925,17 @@ ${cssRules}
|
|
|
33867
33925
|
const cachedSegmentAttrs = loadCachedSegmentAttributes();
|
|
33868
33926
|
const browserMetadata = collectBrowserMetadata();
|
|
33869
33927
|
const appSignalsInit = options.appSignalsInit ?? {};
|
|
33870
|
-
const
|
|
33928
|
+
const cachedInitialAttrs = loadInitialAttrs();
|
|
33929
|
+
const initialAttrs = computeInitialAttrs(browserMetadata, cachedInitialAttrs);
|
|
33930
|
+
saveInitialAttrs(initialAttrs);
|
|
33931
|
+
const phaseOneAttrs = {
|
|
33932
|
+
...browserMetadata,
|
|
33933
|
+
...initialAttrs,
|
|
33934
|
+
...cachedSegmentAttrs,
|
|
33935
|
+
...appSignalsInit
|
|
33936
|
+
};
|
|
33871
33937
|
debug("Syntro Bootstrap", "Phase 1: Browser metadata:", browserMetadata);
|
|
33938
|
+
debug("Syntro Bootstrap", "Phase 1: Initial attrs:", initialAttrs);
|
|
33872
33939
|
debug("Syntro Bootstrap", "Phase 1: Cached segment attributes:", cachedSegmentAttrs);
|
|
33873
33940
|
if (Object.keys(appSignalsInit).length > 0) {
|
|
33874
33941
|
debug("Syntro Bootstrap", "Phase 1: App signals:", appSignalsInit);
|
|
@@ -33962,6 +34029,7 @@ ${cssRules}
|
|
|
33962
34029
|
const sessionAttrs = sessionMetrics?.getAll?.() ?? {};
|
|
33963
34030
|
const updatedAttrs = {
|
|
33964
34031
|
...browserMetadata,
|
|
34032
|
+
...initialAttrs,
|
|
33965
34033
|
...sessionAttrs,
|
|
33966
34034
|
...segmentFlags,
|
|
33967
34035
|
...appSignalsInit
|
|
@@ -34180,7 +34248,7 @@ ${cssRules}
|
|
|
34180
34248
|
}
|
|
34181
34249
|
const geoData = await geoPromise;
|
|
34182
34250
|
if (experiments && Object.keys(geoData).length > 0) {
|
|
34183
|
-
const mergedAttrs = { ...browserMetadata, ...geoData, ...appSignalsInit };
|
|
34251
|
+
const mergedAttrs = { ...browserMetadata, ...initialAttrs, ...geoData, ...appSignalsInit };
|
|
34184
34252
|
debug("Syntro Bootstrap", "Merging geo data into GrowthBook attributes:", geoData);
|
|
34185
34253
|
experiments.setAttributes?.(mergedAttrs);
|
|
34186
34254
|
}
|
|
@@ -34188,7 +34256,7 @@ ${cssRules}
|
|
|
34188
34256
|
if (mcpHost && experiments) {
|
|
34189
34257
|
browserMetadata.surface_type = "mcp-app";
|
|
34190
34258
|
browserMetadata.surface_host = mcpHost.name;
|
|
34191
|
-
experiments.setAttributes?.({ ...browserMetadata, ...geoData });
|
|
34259
|
+
experiments.setAttributes?.({ ...browserMetadata, ...initialAttrs, ...geoData });
|
|
34192
34260
|
runtime5.context.setSurfaceType("mcp-app");
|
|
34193
34261
|
runtime5.context.setSurfaceHost(mcpHost.name);
|
|
34194
34262
|
debug("Syntro Bootstrap", "MCP App detected:", mcpHost.name);
|
|
@@ -34800,7 +34868,7 @@ ${cssRules}
|
|
|
34800
34868
|
}
|
|
34801
34869
|
|
|
34802
34870
|
// src/index.ts
|
|
34803
|
-
var RUNTIME_SDK_BUILD = true ? `${"2026-05-
|
|
34871
|
+
var RUNTIME_SDK_BUILD = true ? `${"2026-05-08T08:50:55.542Z"} (${"909c7d481cf"})` : "dev";
|
|
34804
34872
|
if (typeof window !== "undefined") {
|
|
34805
34873
|
console.log(`[Syntro Runtime] Build: ${RUNTIME_SDK_BUILD} (Lit)`);
|
|
34806
34874
|
const existing = window.SynOS;
|