@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.
@@ -31,8 +31,8 @@ import {
31
31
  WaitZ,
32
32
  WidgetConfigZ,
33
33
  coreActionStepSchemas
34
- } from "../chunk-FMLX4END.js";
35
- import "../chunk-44V2AOO4.js";
34
+ } from "../chunk-TVREQFRK.js";
35
+ import "../chunk-3EK46GSN.js";
36
36
  import "../chunk-LSU6P3XW.js";
37
37
  import "../chunk-5Z66FT5C.js";
38
38
  export {
@@ -8,9 +8,16 @@
8
8
  * via the __VITE_IMPORT_META_ENV__ define.
9
9
  */
10
10
  export declare function getEnvVar(name: string): string | undefined;
11
+ export declare function loadCached<T>(key: string, ttlMs?: number): T | null;
12
+ export declare function writeCached(key: string, data: unknown): void;
11
13
  /**
12
14
  * Load cached segment attributes from localStorage.
13
15
  * Returns cached values for instant Phase 1 evaluation.
16
+ *
17
+ * Data is stored in the generic { ts, data } envelope. Legacy entries written
18
+ * without the envelope (bare JSON objects) will fail to parse as an envelope
19
+ * and return null — `loadCachedSegmentAttributes` returns {} in that case.
20
+ * The next /decide call repopulates the cache in the new format automatically.
14
21
  */
15
22
  export declare function loadCachedSegmentAttributes(): Record<string, boolean>;
16
23
  /**
@@ -27,9 +34,14 @@ export declare function extractSegmentFlags(allFlags: Record<string, boolean | s
27
34
  * Only non-empty values are included.
28
35
  */
29
36
  export declare function collectBrowserMetadata(): Record<string, string | string[]>;
37
+ type InitialAttrs = Record<string, string>;
38
+ export declare function computeInitialAttrs(fresh: Record<string, string | string[]>, cached: InitialAttrs | null): InitialAttrs;
39
+ export declare function loadInitialAttrs(): InitialAttrs | null;
40
+ export declare function saveInitialAttrs(attrs: InitialAttrs): void;
30
41
  export declare const GEO_DEFAULT_HOST = "https://geo.syntrologie.com";
31
42
  /**
32
43
  * Fetch geo data from the Cloudflare Worker, with localStorage caching.
33
44
  * Returns cached data immediately on subsequent visits. Best-effort — never blocks init.
34
45
  */
35
46
  export declare function fetchGeo(geoHost: string): Promise<Record<string, string>>;
47
+ export {};
@@ -21,7 +21,7 @@ import type { AppLoader, AppLoadResult } from './apps/AppLoader';
21
21
  import type { SmartCanvasRuntime } from './runtime';
22
22
  import type { InterventionTracker } from './telemetry/InterventionTracker';
23
23
  import { decodeToken, encodeToken } from './token';
24
- export { collectBrowserMetadata, fetchGeo } from './bootstrap-init';
24
+ export { collectBrowserMetadata, computeInitialAttrs, fetchGeo, loadCached, writeCached, } from './bootstrap-init';
25
25
  export type { SyntroInitOptions, SyntroInitResult } from './bootstrap-types';
26
26
  /**
27
27
  * Initialize the Syntro SDK with a single token.
@@ -145,7 +145,9 @@ var CanvasConfigResponseZ = z.object({
145
145
  fetchedAt: z.string().datetime(),
146
146
  configVersion: z.string().optional(),
147
147
  canvasTitle: z.string().optional(),
148
- displayMode: z.enum(["standard", "focused", "inline"]).optional(),
148
+ displayMode: z.enum(["standard", "focused", "inline"]).describe(
149
+ "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."
150
+ ).optional(),
149
151
  tiles: z.array(TileZ),
150
152
  actions: z.array(z.any()),
151
153
  theme: CanvasThemeConfigZ.optional(),
@@ -185,4 +187,4 @@ export {
185
187
  CanvasConfigResponseZ,
186
188
  configSchemas
187
189
  };
188
- //# sourceMappingURL=chunk-44V2AOO4.js.map
190
+ //# sourceMappingURL=chunk-3EK46GSN.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/config/schema.ts"],
4
- "sourcesContent": ["/**\n * Zod schemas for canvas configuration types.\n *\n * Single source of truth for tile, theme, launcher, and top-level\n * CanvasConfigResponse shapes. These schemas are converted to JSON Schema\n * during build and merged into the unified canvas-config.schema.json.\n *\n * Design decisions:\n * - `.strict()` on top-level objects \u2192 `additionalProperties: false` in JSON Schema\n * - Element sub-schemas (canvas, tile, etc.) are NOT strict to allow future expansion\n */\n\nimport { z } from 'zod';\nimport { ActivationConfigZ, ConditionZ } from '../decisions/schema';\n\n// ============================================================================\n// Tile Notification Sub-Types\n// ============================================================================\n\nconst NotificationDeepLinkZ = z\n .object({\n tileId: z.string(),\n itemId: z.string().optional(),\n })\n .strict();\n\nconst TileNotificationRuleZ = z\n .object({\n on: z.string(),\n title: z.string(),\n body: z.string().optional(),\n icon: z.string().optional(),\n ttl: z.number().optional(),\n cooldown: z.number().optional(),\n deepLink: NotificationDeepLinkZ.optional(),\n })\n .strict();\n\n// ============================================================================\n// Tile\n// ============================================================================\n\nexport const TileZ = z\n .object({\n id: z.string(),\n title: z.string().optional(),\n subtitle: z.string().optional(),\n icon: z.string().optional(),\n priority: z.number().optional(),\n widget: z.string(),\n props: z.record(z.unknown()).optional(),\n activation: ActivationConfigZ.optional(),\n notifications: z.array(TileNotificationRuleZ).optional(),\n })\n .strict();\n\n// ============================================================================\n// Theme Config \u2014 Element Sub-Schemas\n// ============================================================================\n\nexport const CanvasElementConfigZ = z.object({\n position: z.enum(['left', 'right']).optional(),\n layout: z.enum(['overlay', 'push']).optional(),\n background: z.string().optional(),\n blur: z.string().optional(),\n border: z.string().optional(),\n width: z.string().optional(),\n /** Padding around tile content. Consumed by inline mode (drawer mode handles its own padding internally). */\n padding: z.string().optional(),\n transitionDuration: z.string().optional(),\n transitionEasing: z.string().optional(),\n transitionFade: z.string().optional(),\n backdrop: z.boolean().optional(),\n backdropColor: z.string().optional(),\n});\n\nexport const MobileThemeOverrideZ = z.object({\n canvas: CanvasElementConfigZ.optional(),\n});\n\nexport const LauncherElementConfigZ = z.object({\n background: z.string().optional(),\n backgroundHover: z.string().optional(),\n color: z.string().optional(),\n size: z.string().optional(),\n shadow: z.string().optional(),\n borderRadius: z.string().optional(),\n icon: z.string().optional(),\n});\n\nexport const TileElementConfigZ = z.object({\n background: z.string().optional(),\n backgroundHover: z.string().optional(),\n border: z.string().optional(),\n borderRadius: z.string().optional(),\n shadow: z.string().optional(),\n titleColor: z.string().optional(),\n textColor: z.string().optional(),\n iconBackground: z.string().optional(),\n iconShadow: z.string().optional(),\n headerPadding: z.string().optional(),\n bodyPadding: z.string().optional(),\n gap: z.string().optional(),\n});\n\nexport const OverlayElementConfigZ = z.object({\n background: z.string().optional(),\n textColor: z.string().optional(),\n titleColor: z.string().optional(),\n arrowColor: z.string().optional(),\n arrowSize: z.string().optional(),\n border: z.string().optional(),\n borderRadius: z.string().optional(),\n scrimOpacity: z.string().optional(),\n highlightRing: z.string().optional(),\n});\n\nexport const NotificationElementConfigZ = z.object({\n background: z.string().optional(),\n textColor: z.string().optional(),\n textSecondaryColor: z.string().optional(),\n border: z.string().optional(),\n borderRadius: z.string().optional(),\n successColor: z.string().optional(),\n warningColor: z.string().optional(),\n errorColor: z.string().optional(),\n iconBackground: z.string().optional(),\n progressGradient: z.string().optional(),\n});\n\nexport const ContentElementConfigZ = z.object({\n background: z.string().optional(),\n backgroundHover: z.string().optional(),\n border: z.string().optional(),\n borderRadius: z.string().optional(),\n textColor: z.string().optional(),\n textSecondaryColor: z.string().optional(),\n // Accordion layout\n itemDivider: z.string().optional(),\n itemGap: z.string().optional(),\n itemPadding: z.string().optional(),\n itemFontSize: z.string().optional(),\n // Expanded content\n bodyPadding: z.string().optional(),\n bodyFontSize: z.string().optional(),\n // Category headers\n categoryPadding: z.string().optional(),\n categoryGap: z.string().optional(),\n categoryFontSize: z.string().optional(),\n // Search\n searchBackground: z.string().optional(),\n searchColor: z.string().optional(),\n // Chevron\n chevronColor: z.string().optional(),\n});\n\n// ============================================================================\n// Theme Config \u2014 Top-Level\n// ============================================================================\n\nexport const CanvasThemeConfigZ = z\n .object({\n mode: z.enum(['dark', 'light']).optional(),\n fontFamily: z.string().optional(),\n colorPrimary: z.string().optional(),\n colorPrimaryHover: z.string().optional(),\n borderRadius: z.string().optional(),\n canvas: CanvasElementConfigZ.optional(),\n launcher: LauncherElementConfigZ.optional(),\n tile: TileElementConfigZ.optional(),\n overlay: OverlayElementConfigZ.optional(),\n notification: NotificationElementConfigZ.optional(),\n content: ContentElementConfigZ.optional(),\n mobile: MobileThemeOverrideZ.optional(),\n })\n .strict();\n\n// ============================================================================\n// Launcher Config\n// ============================================================================\n\nexport const LauncherConfigZ = z\n .object({\n enabled: z.boolean().optional(),\n label: z.string().optional(),\n position: z.string().optional(),\n animate: z.boolean().optional(),\n animationStyle: z.enum(['pulse', 'bounce', 'glow']).optional(),\n notificationCount: z.number().optional(),\n })\n .strict();\n\n// ============================================================================\n// Canvas Config Response (top-level)\n// ============================================================================\n\nexport const CanvasConfigResponseZ = z\n .object({\n schemaVersion: z.string().optional(),\n fetchedAt: z.string().datetime(),\n configVersion: z.string().optional(),\n canvasTitle: z.string().optional(),\n displayMode: z.enum(['standard', 'focused', 'inline']).optional(),\n tiles: z.array(TileZ),\n actions: z.array(z.any()),\n theme: CanvasThemeConfigZ.optional(),\n launcher: LauncherConfigZ.optional(),\n meta: z\n .object({\n verificationSteps: z\n .array(\n z.union([\n z.string(),\n z.object({\n text: z.string(),\n check: ConditionZ.optional(),\n }),\n ])\n )\n .optional(),\n })\n .passthrough()\n .optional(),\n })\n .strict();\n\n// ============================================================================\n// Export: Array for unified schema generation\n// ============================================================================\n\n/**\n * Config schemas for unified JSON Schema generation.\n * The generator imports this array and converts each to a JSON Schema $def.\n */\nexport const configSchemas = [\n { defName: 'tile', schema: TileZ },\n { defName: 'themeConfig', schema: CanvasThemeConfigZ },\n { defName: 'launcherConfig', schema: LauncherConfigZ },\n { defName: 'canvasConfigResponse', schema: CanvasConfigResponseZ },\n];\n\n// ============================================================================\n// Named Exports\n// ============================================================================\n\nexport { NotificationDeepLinkZ, TileNotificationRuleZ };\n"],
5
- "mappings": ";;;;;;AAYA,SAAS,SAAS;AAOlB,IAAM,wBAAwB,EAC3B,OAAO;AAAA,EACN,QAAQ,EAAE,OAAO;AAAA,EACjB,QAAQ,EAAE,OAAO,EAAE,SAAS;AAC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,MAAM,CAAC,EAAE,SAAS;AAAA,EAC7D,mBAAmB,EAAE,OAAO,EAAE,SAAS;AACzC,CAAC,EACA,OAAO;AAMH,IAAM,wBAAwB,EAClC,OAAO;AAAA,EACN,eAAe,EAAE,OAAO,EAAE,SAAS;AAAA,EACnC,WAAW,EAAE,OAAO,EAAE,SAAS;AAAA,EAC/B,eAAe,EAAE,OAAO,EAAE,SAAS;AAAA,EACnC,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,aAAa,EAAE,KAAK,CAAC,YAAY,WAAW,QAAQ,CAAC,EAAE,SAAS;AAAA,EAChE,OAAO,EAAE,MAAM,KAAK;AAAA,EACpB,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC;AAAA,EACxB,OAAO,mBAAmB,SAAS;AAAA,EACnC,UAAU,gBAAgB,SAAS;AAAA,EACnC,MAAM,EACH,OAAO;AAAA,IACN,mBAAmB,EAChB;AAAA,MACC,EAAE,MAAM;AAAA,QACN,EAAE,OAAO;AAAA,QACT,EAAE,OAAO;AAAA,UACP,MAAM,EAAE,OAAO;AAAA,UACf,OAAO,WAAW,SAAS;AAAA,QAC7B,CAAC;AAAA,MACH,CAAC;AAAA,IACH,EACC,SAAS;AAAA,EACd,CAAC,EACA,YAAY,EACZ,SAAS;AACd,CAAC,EACA,OAAO;AAUH,IAAM,gBAAgB;AAAA,EAC3B,EAAE,SAAS,QAAQ,QAAQ,MAAM;AAAA,EACjC,EAAE,SAAS,eAAe,QAAQ,mBAAmB;AAAA,EACrD,EAAE,SAAS,kBAAkB,QAAQ,gBAAgB;AAAA,EACrD,EAAE,SAAS,wBAAwB,QAAQ,sBAAsB;AACnE;",
4
+ "sourcesContent": ["/**\n * Zod schemas for canvas configuration types.\n *\n * Single source of truth for tile, theme, launcher, and top-level\n * CanvasConfigResponse shapes. These schemas are converted to JSON Schema\n * during build and merged into the unified canvas-config.schema.json.\n *\n * Design decisions:\n * - `.strict()` on top-level objects \u2192 `additionalProperties: false` in JSON Schema\n * - Element sub-schemas (canvas, tile, etc.) are NOT strict to allow future expansion\n */\n\nimport { z } from 'zod';\nimport { ActivationConfigZ, ConditionZ } from '../decisions/schema';\n\n// ============================================================================\n// Tile Notification Sub-Types\n// ============================================================================\n\nconst NotificationDeepLinkZ = z\n .object({\n tileId: z.string(),\n itemId: z.string().optional(),\n })\n .strict();\n\nconst TileNotificationRuleZ = z\n .object({\n on: z.string(),\n title: z.string(),\n body: z.string().optional(),\n icon: z.string().optional(),\n ttl: z.number().optional(),\n cooldown: z.number().optional(),\n deepLink: NotificationDeepLinkZ.optional(),\n })\n .strict();\n\n// ============================================================================\n// Tile\n// ============================================================================\n\nexport const TileZ = z\n .object({\n id: z.string(),\n title: z.string().optional(),\n subtitle: z.string().optional(),\n icon: z.string().optional(),\n priority: z.number().optional(),\n widget: z.string(),\n props: z.record(z.unknown()).optional(),\n activation: ActivationConfigZ.optional(),\n notifications: z.array(TileNotificationRuleZ).optional(),\n })\n .strict();\n\n// ============================================================================\n// Theme Config \u2014 Element Sub-Schemas\n// ============================================================================\n\nexport const CanvasElementConfigZ = z.object({\n position: z.enum(['left', 'right']).optional(),\n layout: z.enum(['overlay', 'push']).optional(),\n background: z.string().optional(),\n blur: z.string().optional(),\n border: z.string().optional(),\n width: z.string().optional(),\n /** Padding around tile content. Consumed by inline mode (drawer mode handles its own padding internally). */\n padding: z.string().optional(),\n transitionDuration: z.string().optional(),\n transitionEasing: z.string().optional(),\n transitionFade: z.string().optional(),\n backdrop: z.boolean().optional(),\n backdropColor: z.string().optional(),\n});\n\nexport const MobileThemeOverrideZ = z.object({\n canvas: CanvasElementConfigZ.optional(),\n});\n\nexport const LauncherElementConfigZ = z.object({\n background: z.string().optional(),\n backgroundHover: z.string().optional(),\n color: z.string().optional(),\n size: z.string().optional(),\n shadow: z.string().optional(),\n borderRadius: z.string().optional(),\n icon: z.string().optional(),\n});\n\nexport const TileElementConfigZ = z.object({\n background: z.string().optional(),\n backgroundHover: z.string().optional(),\n border: z.string().optional(),\n borderRadius: z.string().optional(),\n shadow: z.string().optional(),\n titleColor: z.string().optional(),\n textColor: z.string().optional(),\n iconBackground: z.string().optional(),\n iconShadow: z.string().optional(),\n headerPadding: z.string().optional(),\n bodyPadding: z.string().optional(),\n gap: z.string().optional(),\n});\n\nexport const OverlayElementConfigZ = z.object({\n background: z.string().optional(),\n textColor: z.string().optional(),\n titleColor: z.string().optional(),\n arrowColor: z.string().optional(),\n arrowSize: z.string().optional(),\n border: z.string().optional(),\n borderRadius: z.string().optional(),\n scrimOpacity: z.string().optional(),\n highlightRing: z.string().optional(),\n});\n\nexport const NotificationElementConfigZ = z.object({\n background: z.string().optional(),\n textColor: z.string().optional(),\n textSecondaryColor: z.string().optional(),\n border: z.string().optional(),\n borderRadius: z.string().optional(),\n successColor: z.string().optional(),\n warningColor: z.string().optional(),\n errorColor: z.string().optional(),\n iconBackground: z.string().optional(),\n progressGradient: z.string().optional(),\n});\n\nexport const ContentElementConfigZ = z.object({\n background: z.string().optional(),\n backgroundHover: z.string().optional(),\n border: z.string().optional(),\n borderRadius: z.string().optional(),\n textColor: z.string().optional(),\n textSecondaryColor: z.string().optional(),\n // Accordion layout\n itemDivider: z.string().optional(),\n itemGap: z.string().optional(),\n itemPadding: z.string().optional(),\n itemFontSize: z.string().optional(),\n // Expanded content\n bodyPadding: z.string().optional(),\n bodyFontSize: z.string().optional(),\n // Category headers\n categoryPadding: z.string().optional(),\n categoryGap: z.string().optional(),\n categoryFontSize: z.string().optional(),\n // Search\n searchBackground: z.string().optional(),\n searchColor: z.string().optional(),\n // Chevron\n chevronColor: z.string().optional(),\n});\n\n// ============================================================================\n// Theme Config \u2014 Top-Level\n// ============================================================================\n\nexport const CanvasThemeConfigZ = z\n .object({\n mode: z.enum(['dark', 'light']).optional(),\n fontFamily: z.string().optional(),\n colorPrimary: z.string().optional(),\n colorPrimaryHover: z.string().optional(),\n borderRadius: z.string().optional(),\n canvas: CanvasElementConfigZ.optional(),\n launcher: LauncherElementConfigZ.optional(),\n tile: TileElementConfigZ.optional(),\n overlay: OverlayElementConfigZ.optional(),\n notification: NotificationElementConfigZ.optional(),\n content: ContentElementConfigZ.optional(),\n mobile: MobileThemeOverrideZ.optional(),\n })\n .strict();\n\n// ============================================================================\n// Launcher Config\n// ============================================================================\n\nexport const LauncherConfigZ = z\n .object({\n enabled: z.boolean().optional(),\n label: z.string().optional(),\n position: z.string().optional(),\n animate: z.boolean().optional(),\n animationStyle: z.enum(['pulse', 'bounce', 'glow']).optional(),\n notificationCount: z.number().optional(),\n })\n .strict();\n\n// ============================================================================\n// Canvas Config Response (top-level)\n// ============================================================================\n\nexport const CanvasConfigResponseZ = z\n .object({\n schemaVersion: z.string().optional(),\n fetchedAt: z.string().datetime(),\n configVersion: z.string().optional(),\n canvasTitle: z.string().optional(),\n displayMode: z\n .enum(['standard', 'focused', 'inline'])\n .describe(\n '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.'\n )\n .optional(),\n tiles: z.array(TileZ),\n actions: z.array(z.any()),\n theme: CanvasThemeConfigZ.optional(),\n launcher: LauncherConfigZ.optional(),\n meta: z\n .object({\n verificationSteps: z\n .array(\n z.union([\n z.string(),\n z.object({\n text: z.string(),\n check: ConditionZ.optional(),\n }),\n ])\n )\n .optional(),\n })\n .passthrough()\n .optional(),\n })\n .strict();\n\n// ============================================================================\n// Export: Array for unified schema generation\n// ============================================================================\n\n/**\n * Config schemas for unified JSON Schema generation.\n * The generator imports this array and converts each to a JSON Schema $def.\n */\nexport const configSchemas = [\n { defName: 'tile', schema: TileZ },\n { defName: 'themeConfig', schema: CanvasThemeConfigZ },\n { defName: 'launcherConfig', schema: LauncherConfigZ },\n { defName: 'canvasConfigResponse', schema: CanvasConfigResponseZ },\n];\n\n// ============================================================================\n// Named Exports\n// ============================================================================\n\nexport { NotificationDeepLinkZ, TileNotificationRuleZ };\n"],
5
+ "mappings": ";;;;;;AAYA,SAAS,SA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ificationDeepLinkZ
3
- } from "./chunk-44V2AOO4.js";
3
+ } from "./chunk-3EK46GSN.js";
4
4
  import {
5
5
  AuthoringFieldsZ,
6
6
  TriggerWhenZ
@@ -272,4 +272,4 @@ export {
272
272
  TourZ,
273
273
  coreActionStepSchemas
274
274
  };
275
- //# sourceMappingURL=chunk-FMLX4END.js.map
275
+ //# sourceMappingURL=chunk-TVREQFRK.js.map
@@ -13,7 +13,7 @@ import {
13
13
  TileNotificationRuleZ,
14
14
  TileZ,
15
15
  configSchemas
16
- } from "../chunk-44V2AOO4.js";
16
+ } from "../chunk-3EK46GSN.js";
17
17
  import "../chunk-LSU6P3XW.js";
18
18
  import "../chunk-5Z66FT5C.js";
19
19
  export {
package/dist/index.js CHANGED
@@ -36,8 +36,8 @@ import {
36
36
  WaitZ,
37
37
  WidgetConfigZ,
38
38
  coreActionStepSchemas
39
- } from "./chunk-FMLX4END.js";
40
- import "./chunk-44V2AOO4.js";
39
+ } from "./chunk-TVREQFRK.js";
40
+ import "./chunk-3EK46GSN.js";
41
41
  import {
42
42
  ActivationConfigZ,
43
43
  AnchorVisibleConditionZ,
@@ -9935,7 +9935,7 @@ function bindWebVitals(reporter, options) {
9935
9935
  }
9936
9936
 
9937
9937
  // src/version.ts
9938
- var SDK_VERSION = "2.8.0-canary.206";
9938
+ var SDK_VERSION = "2.8.0-canary.208";
9939
9939
 
9940
9940
  // src/types.ts
9941
9941
  var SDK_SCHEMA_VERSION = "2.0";
@@ -10537,7 +10537,7 @@ var SmartCanvasElementLit = class extends LitElement9 {
10537
10537
  }
10538
10538
  // ---------- Render -------------------------------------------------------
10539
10539
  render() {
10540
- var _a3, _b, _c, _d, _e2, _f, _g;
10540
+ var _a3, _b, _c, _d, _e2, _f, _g, _h;
10541
10541
  const hasContent = this._tiles.length > 0 && !this._error;
10542
10542
  const showSurface = this._isLoading || hasContent;
10543
10543
  if (this._displayMode === "inline") {
@@ -10552,7 +10552,8 @@ var SmartCanvasElementLit = class extends LitElement9 {
10552
10552
  `;
10553
10553
  }
10554
10554
  const configHasTiles = ((_d = (_c = (_b = __privateGet(this, _rawConfig)) == null ? void 0 : _b.tiles) == null ? void 0 : _c.length) != null ? _d : 0) > 0;
10555
- if (!showSurface && !configHasTiles) return nothing8;
10555
+ const launcherEnabled = ((_e2 = this._launcher) == null ? void 0 : _e2.enabled) === true;
10556
+ if (!showSurface && !configHasTiles && !launcherEnabled) return nothing8;
10556
10557
  return html9`
10557
10558
  <syntro-canvas-overlay
10558
10559
  .isOpen=${this._isOpen}
@@ -10561,10 +10562,10 @@ var SmartCanvasElementLit = class extends LitElement9 {
10561
10562
  .error=${this._error}
10562
10563
  .canvasTitle=${this._canvasTitle}
10563
10564
  .displayMode=${this._displayMode}
10564
- .runtimeRef=${(_e2 = this.runtime) != null ? _e2 : null}
10565
- .telemetry=${(_f = this.telemetry) != null ? _f : null}
10565
+ .runtimeRef=${(_f = this.runtime) != null ? _f : null}
10566
+ .telemetry=${(_g = this.telemetry) != null ? _g : null}
10566
10567
  .themeConfig=${__privateGet(this, _themeCtrl).config}
10567
- ?launcherAnimate=${!!((_g = this._launcher) == null ? void 0 : _g.animate)}
10568
+ ?launcherAnimate=${!!((_h = this._launcher) == null ? void 0 : _h.animate)}
10568
10569
  @canvas-toggle=${__privateGet(this, _onCanvasToggle)}
10569
10570
  ></syntro-canvas-overlay>
10570
10571
  `;
@@ -14119,29 +14120,39 @@ function getEnvVar(name) {
14119
14120
  }
14120
14121
  return void 0;
14121
14122
  }
14122
- var SEGMENT_CACHE_KEY = "syntro_segment_attributes";
14123
- function loadCachedSegmentAttributes() {
14124
- if (typeof window === "undefined") return {};
14123
+ function loadCached(key, ttlMs) {
14124
+ if (typeof window === "undefined") return null;
14125
14125
  try {
14126
- const cached = localStorage.getItem(SEGMENT_CACHE_KEY);
14127
- if (cached) {
14128
- const attrs = JSON.parse(cached);
14129
- debug("Syntro Bootstrap", "Loaded cached segment attributes:", attrs);
14130
- return attrs;
14131
- }
14132
- } catch (err) {
14133
- warn("Syntro Bootstrap", "Failed to load cached segment attributes:", err);
14126
+ const raw = localStorage.getItem(key);
14127
+ if (!raw) return null;
14128
+ const envelope = JSON.parse(raw);
14129
+ if (!envelope || typeof envelope.ts !== "number" || !("data" in envelope)) return null;
14130
+ if (ttlMs != null && Date.now() - envelope.ts > ttlMs) return null;
14131
+ return envelope.data;
14132
+ } catch {
14133
+ return null;
14134
14134
  }
14135
- return {};
14136
14135
  }
14137
- function cacheSegmentAttributes(attrs) {
14136
+ function writeCached(key, data) {
14138
14137
  if (typeof window === "undefined") return;
14139
14138
  try {
14140
- localStorage.setItem(SEGMENT_CACHE_KEY, JSON.stringify(attrs));
14141
- debug("Syntro Bootstrap", "Cached segment attributes:", attrs);
14142
- } catch (err) {
14143
- warn("Syntro Bootstrap", "Failed to cache segment attributes:", err);
14139
+ const envelope = { ts: Date.now(), data };
14140
+ localStorage.setItem(key, JSON.stringify(envelope));
14141
+ } catch {
14142
+ }
14143
+ }
14144
+ var SEGMENT_CACHE_KEY = "syntro_segment_attributes";
14145
+ function loadCachedSegmentAttributes() {
14146
+ const cached = loadCached(SEGMENT_CACHE_KEY);
14147
+ if (cached) {
14148
+ debug("Syntro Bootstrap", "Loaded cached segment attributes:", cached);
14149
+ return cached;
14144
14150
  }
14151
+ return {};
14152
+ }
14153
+ function cacheSegmentAttributes(attrs) {
14154
+ writeCached(SEGMENT_CACHE_KEY, attrs);
14155
+ debug("Syntro Bootstrap", "Cached segment attributes:", attrs);
14145
14156
  }
14146
14157
  function extractSegmentFlags(allFlags) {
14147
14158
  if (!allFlags) return {};
@@ -14233,6 +14244,51 @@ function collectBrowserMetadata() {
14233
14244
  }
14234
14245
  return attrs;
14235
14246
  }
14247
+ var INITIAL_ATTRS_KEY = "syntro_initial_attrs";
14248
+ var INITIAL_ATTRS_TTL = 30 * 60 * 1e3;
14249
+ var UTM_KEYS = ["utm_source", "utm_medium", "utm_campaign", "utm_content", "utm_term"];
14250
+ function isInternalReferrer(referrerHostname) {
14251
+ if (typeof window === "undefined") return false;
14252
+ try {
14253
+ return referrerHostname === window.location.hostname;
14254
+ } catch {
14255
+ return false;
14256
+ }
14257
+ }
14258
+ function computeInitialAttrs(fresh, cached) {
14259
+ const result = {};
14260
+ const hasFreshUtms = UTM_KEYS.some((k2) => typeof fresh[k2] === "string");
14261
+ for (const key of UTM_KEYS) {
14262
+ const value = hasFreshUtms ? fresh[key] : cached == null ? void 0 : cached[key];
14263
+ if (value) result[key] = value;
14264
+ }
14265
+ const freshReferrerHostname = typeof fresh.referrer_hostname === "string" ? fresh.referrer_hostname : void 0;
14266
+ const isInternal = freshReferrerHostname ? isInternalReferrer(freshReferrerHostname) : true;
14267
+ if (!isInternal && typeof fresh.referrer === "string") {
14268
+ result.referrer = fresh.referrer;
14269
+ if (freshReferrerHostname) result.referrer_hostname = freshReferrerHostname;
14270
+ } else if (cached == null ? void 0 : cached.referrer) {
14271
+ result.referrer = cached.referrer;
14272
+ if (cached.referrer_hostname) result.referrer_hostname = cached.referrer_hostname;
14273
+ }
14274
+ if (cached == null ? void 0 : cached.initial_page_url) {
14275
+ result.initial_page_url = cached.initial_page_url;
14276
+ if (cached.initial_page_path) result.initial_page_path = cached.initial_page_path;
14277
+ if (cached.initial_page_query) result.initial_page_query = cached.initial_page_query;
14278
+ } else {
14279
+ if (typeof fresh.page_url === "string") result.initial_page_url = fresh.page_url;
14280
+ if (typeof fresh.page_path === "string") result.initial_page_path = fresh.page_path;
14281
+ if (typeof fresh.page_query === "string") result.initial_page_query = fresh.page_query;
14282
+ }
14283
+ return result;
14284
+ }
14285
+ function loadInitialAttrs() {
14286
+ return loadCached(INITIAL_ATTRS_KEY, INITIAL_ATTRS_TTL);
14287
+ }
14288
+ function saveInitialAttrs(attrs) {
14289
+ writeCached(INITIAL_ATTRS_KEY, attrs);
14290
+ debug("Syntro Bootstrap", "Cached initial attrs:", attrs);
14291
+ }
14236
14292
  var GEO_CACHE_KEY = "syntro_geo";
14237
14293
  var GEO_DEFAULT_HOST = "https://geo.syntrologie.com";
14238
14294
  async function fetchGeo(geoHost) {
@@ -14461,7 +14517,7 @@ function identifyFromUrlParam(telemetry, consentGate) {
14461
14517
  }
14462
14518
 
14463
14519
  // src/defaults/initialProperties.ts
14464
- var UTM_KEYS = ["utm_source", "utm_medium", "utm_campaign", "utm_content", "utm_term"];
14520
+ var UTM_KEYS2 = ["utm_source", "utm_medium", "utm_campaign", "utm_content", "utm_term"];
14465
14521
  function isStrictRegion(geo) {
14466
14522
  if (geo.is_eu === "true") return true;
14467
14523
  if (geo.country_code === "GB" || geo.country_code === "CH") return true;
@@ -14490,7 +14546,7 @@ function captureInitialProperties(telemetry, geoPromise) {
14490
14546
  $initial_referrer: referrer,
14491
14547
  $initial_referring_domain: safeReferringDomain(referrer)
14492
14548
  };
14493
- for (const key of UTM_KEYS) {
14549
+ for (const key of UTM_KEYS2) {
14494
14550
  const value = params.get(key);
14495
14551
  if (value) {
14496
14552
  props[`$initial_${key}`] = value;
@@ -18422,8 +18478,17 @@ async function _initCore(options) {
18422
18478
  const cachedSegmentAttrs = loadCachedSegmentAttributes();
18423
18479
  const browserMetadata = collectBrowserMetadata();
18424
18480
  const appSignalsInit = (_e2 = options.appSignalsInit) != null ? _e2 : {};
18425
- const phaseOneAttrs = { ...browserMetadata, ...cachedSegmentAttrs, ...appSignalsInit };
18481
+ const cachedInitialAttrs = loadInitialAttrs();
18482
+ const initialAttrs = computeInitialAttrs(browserMetadata, cachedInitialAttrs);
18483
+ saveInitialAttrs(initialAttrs);
18484
+ const phaseOneAttrs = {
18485
+ ...browserMetadata,
18486
+ ...initialAttrs,
18487
+ ...cachedSegmentAttrs,
18488
+ ...appSignalsInit
18489
+ };
18426
18490
  debug("Syntro Bootstrap", "Phase 1: Browser metadata:", browserMetadata);
18491
+ debug("Syntro Bootstrap", "Phase 1: Initial attrs:", initialAttrs);
18427
18492
  debug("Syntro Bootstrap", "Phase 1: Cached segment attributes:", cachedSegmentAttrs);
18428
18493
  if (Object.keys(appSignalsInit).length > 0) {
18429
18494
  debug("Syntro Bootstrap", "Phase 1: App signals:", appSignalsInit);
@@ -18519,6 +18584,7 @@ async function _initCore(options) {
18519
18584
  const sessionAttrs = (_b2 = (_a4 = sessionMetrics == null ? void 0 : sessionMetrics.getAll) == null ? void 0 : _a4.call(sessionMetrics)) != null ? _b2 : {};
18520
18585
  const updatedAttrs = {
18521
18586
  ...browserMetadata,
18587
+ ...initialAttrs,
18522
18588
  ...sessionAttrs,
18523
18589
  ...segmentFlags,
18524
18590
  ...appSignalsInit
@@ -18740,7 +18806,7 @@ async function _initCore(options) {
18740
18806
  }
18741
18807
  const geoData = await geoPromise;
18742
18808
  if (experiments && Object.keys(geoData).length > 0) {
18743
- const mergedAttrs = { ...browserMetadata, ...geoData, ...appSignalsInit };
18809
+ const mergedAttrs = { ...browserMetadata, ...initialAttrs, ...geoData, ...appSignalsInit };
18744
18810
  debug("Syntro Bootstrap", "Merging geo data into GrowthBook attributes:", geoData);
18745
18811
  (_l = experiments.setAttributes) == null ? void 0 : _l.call(experiments, mergedAttrs);
18746
18812
  }
@@ -18748,7 +18814,7 @@ async function _initCore(options) {
18748
18814
  if (mcpHost && experiments) {
18749
18815
  browserMetadata.surface_type = "mcp-app";
18750
18816
  browserMetadata.surface_host = mcpHost.name;
18751
- (_m = experiments.setAttributes) == null ? void 0 : _m.call(experiments, { ...browserMetadata, ...geoData });
18817
+ (_m = experiments.setAttributes) == null ? void 0 : _m.call(experiments, { ...browserMetadata, ...initialAttrs, ...geoData });
18752
18818
  runtime5.context.setSurfaceType("mcp-app");
18753
18819
  runtime5.context.setSurfaceHost(mcpHost.name);
18754
18820
  debug("Syntro Bootstrap", "MCP App detected:", mcpHost.name);