@syntrologie/runtime-sdk 2.2.0-canary.9 → 2.2.0

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.
@@ -10,10 +10,12 @@ export interface CanvasFetcherOptions {
10
10
  manifestKey?: string;
11
11
  /** Prefix for variant flag discovery */
12
12
  variantFlagPrefix?: string;
13
+ /** SDK version for offline config caching. When set, enables localStorage caching. */
14
+ sdkVersion?: string;
13
15
  }
14
16
  export declare const resolveConfigUri: ({ configUri, experiments, featureKey, }: {
15
17
  configUri?: string;
16
18
  experiments?: ExperimentClient;
17
19
  featureKey?: string;
18
20
  }) => string | undefined;
19
- export declare const createCanvasConfigFetcher: ({ configUri, experiments, featureKey, credentials, configFeatureKey, manifestKey, variantFlagPrefix, }: CanvasFetcherOptions) => CanvasConfigFetcher;
21
+ export declare const createCanvasConfigFetcher: ({ configUri, experiments, featureKey, credentials, configFeatureKey, manifestKey, variantFlagPrefix, sdkVersion, }: CanvasFetcherOptions) => CanvasConfigFetcher;
@@ -6,6 +6,7 @@
6
6
  * - Notifying subscribers when context changes
7
7
  * - Providing the current context snapshot
8
8
  */
9
+ import type { NavigationMonitor } from '../navigation/NavigationMonitor';
9
10
  import type { TelemetryClient } from '../telemetry/types';
10
11
  import type { RoutesConfig } from '../types';
11
12
  import type { AnchorState, ContextChangeCallback, PageHistoryEntry, RuntimeContext, Unsubscribe } from './types';
@@ -16,6 +17,8 @@ export interface ContextManagerOptions {
16
17
  routes?: RoutesConfig;
17
18
  /** Initial page history (optional) */
18
19
  initialPageHistory?: PageHistoryEntry[];
20
+ /** Centralized navigation monitor (replaces direct History API patching) */
21
+ navigation?: NavigationMonitor;
19
22
  }
20
23
  /**
21
24
  * ContextManager class for managing runtime context.
@@ -26,6 +29,7 @@ export declare class ContextManager {
26
29
  private listeners;
27
30
  private telemetry?;
28
31
  private routes?;
32
+ private navigation?;
29
33
  private cleanupFns;
30
34
  constructor(options?: ContextManagerOptions);
31
35
  /**
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Service Worker Compatibility Diagnostic
3
+ *
4
+ * Detects active service workers that may interfere with SDK
5
+ * script loading or caching behavior on PWA sites.
6
+ */
7
+ export interface ServiceWorkerDiagnostics {
8
+ /** Whether the browser supports service workers */
9
+ supported: boolean;
10
+ /** Whether a service worker controller is active */
11
+ controllerActive: boolean;
12
+ /** Warning message if service worker detected */
13
+ warning?: string;
14
+ /** Registration scope if found */
15
+ scope?: string;
16
+ /** Error message if detection failed */
17
+ error?: string;
18
+ }
19
+ /**
20
+ * Check for active service workers and return diagnostics.
21
+ * This is async because getRegistration() returns a promise.
22
+ */
23
+ export declare function checkServiceWorker(): Promise<ServiceWorkerDiagnostics>;
@@ -9,9 +9,15 @@ export interface EditorConf {
9
9
  audit_session_id?: string;
10
10
  [key: string]: unknown;
11
11
  }
12
- /** Get decoded editor_source from URL or global (cached). */
12
+ /**
13
+ * Reset the editor params cache, forcing re-evaluation on next access.
14
+ * Called by the Chrome extension after restoring URL params via replaceState,
15
+ * or in tests to simulate fresh state without module reloading.
16
+ */
17
+ export declare function resetEditorParamsCache(): void;
18
+ /** Get decoded editor_source from URL or global (re-evaluates on null). */
13
19
  export declare function getEditorSource(): EditorSource | null;
14
- /** Get decoded editor_conf from URL or global (cached). */
20
+ /** Get decoded editor_conf from URL or global (re-evaluates on null). */
15
21
  export declare function getEditorConf(): EditorConf | null;
16
22
  /**
17
23
  * Checks if the editor should be loaded.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export declare const RUNTIME_SDK_BUILD: string;
1
2
  export * from './api';
2
3
  export * from './components/ShadowCanvasOverlay';
3
4
  export * from './components/TileCard';
@@ -24,6 +25,8 @@ export * from './context';
24
25
  export * from './decisions';
25
26
  export * from './events';
26
27
  export * from './events';
28
+ export type { NavigationDiagnostics, NavigationListener } from './navigation/NavigationMonitor';
29
+ export { NavigationMonitor } from './navigation/NavigationMonitor';
27
30
  export * from './notifications';
28
31
  export { RuntimeProvider, useDecision, usePageContext, useRuntime, useRuntimeContext, useRuntimeEvents, useRuntimeState, useSessionContext, useViewportContext, } from './RuntimeProvider';
29
32
  export type { RuntimeMode, SmartCanvasRuntime, SmartCanvasRuntimeOptions } from './runtime';
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  EventBus,
10
10
  ExecutorRegistry,
11
11
  MAX_VISIBLE_TOASTS,
12
+ NavigationMonitor,
12
13
  NotificationToastStack,
13
14
  RUNTIME_VERSION,
14
15
  RuntimeProvider,
@@ -100,7 +101,7 @@ import {
100
101
  validateAction,
101
102
  validateActions,
102
103
  widgetRegistry
103
- } from "./chunk-UEAP7WOK.js";
104
+ } from "./chunk-V4MDQX67.js";
104
105
  import {
105
106
  AddClassZ,
106
107
  BadgePositionZ,
@@ -321,7 +322,8 @@ var styles = {
321
322
  flexDirection: "column",
322
323
  height: "100%",
323
324
  fontFamily: "system-ui, -apple-system, sans-serif",
324
- fontSize: "14px"
325
+ fontSize: "14px",
326
+ touchAction: "none"
325
327
  },
326
328
  messageList: {
327
329
  flex: 1,
@@ -980,7 +982,7 @@ function FAQWidget({ config, runtime: runtime7, instanceId }) {
980
982
  const hasCategories = useMemo(() => filteredQuestions.some((q) => q.config.category), [filteredQuestions]);
981
983
  const resolvedTheme = useMemo(() => {
982
984
  var _a;
983
- if (config.theme !== "auto")
985
+ if (config.theme && config.theme !== "auto")
984
986
  return config.theme;
985
987
  if (typeof window !== "undefined") {
986
988
  return ((_a = window.matchMedia) == null ? void 0 : _a.call(window, "(prefers-color-scheme: dark)").matches) ? "dark" : "light";
@@ -1435,7 +1437,7 @@ function NavWidget({ config, runtime: runtime7, instanceId }) {
1435
1437
  const hasCategories = useMemo2(() => visibleTips.some((t) => t.config.category), [visibleTips]);
1436
1438
  const resolvedTheme = useMemo2(() => {
1437
1439
  var _a;
1438
- if (config.theme !== "auto")
1440
+ if (config.theme && config.theme !== "auto")
1439
1441
  return config.theme;
1440
1442
  if (typeof window !== "undefined") {
1441
1443
  return ((_a = window.matchMedia) == null ? void 0 : _a.call(window, "(prefers-color-scheme: dark)").matches) ? "dark" : "light";
@@ -1569,6 +1571,14 @@ var executeScrollTo = async (action, context) => {
1569
1571
  }
1570
1572
  };
1571
1573
  };
1574
+ function isSameOrigin(url) {
1575
+ try {
1576
+ const parsed = new URL(url, window.location.origin);
1577
+ return parsed.origin === window.location.origin;
1578
+ } catch {
1579
+ return false;
1580
+ }
1581
+ }
1572
1582
  var executeNavigate = async (action, context) => {
1573
1583
  var _a;
1574
1584
  const url = action.url.trim();
@@ -1584,6 +1594,9 @@ var executeNavigate = async (action, context) => {
1584
1594
  });
1585
1595
  if (target === "_blank") {
1586
1596
  window.open(url, "_blank", "noopener,noreferrer");
1597
+ } else if (!action.forceFullNavigation && isSameOrigin(url)) {
1598
+ window.history.pushState(null, "", url);
1599
+ window.dispatchEvent(new PopStateEvent("popstate"));
1587
1600
  } else {
1588
1601
  window.location.href = url;
1589
1602
  }
@@ -2157,12 +2170,15 @@ function validateFrequencyEntry(data) {
2157
2170
  }
2158
2171
 
2159
2172
  // src/index.ts
2173
+ var RUNTIME_SDK_BUILD = typeof __BUILD_TIMESTAMP__ !== "undefined" ? `${__BUILD_TIMESTAMP__} (${__BUILD_GIT_HASH__})` : "dev";
2160
2174
  if (typeof window !== "undefined") {
2175
+ console.log(`[Syntro Runtime] Build: ${RUNTIME_SDK_BUILD}`);
2161
2176
  const existing = window.SynOS;
2162
2177
  const registry = (existing == null ? void 0 : existing.appRegistry) || appRegistry;
2163
2178
  window.SynOS = {
2164
2179
  ...existing,
2165
2180
  appRegistry: registry,
2181
+ _runtimeBuild: RUNTIME_SDK_BUILD,
2166
2182
  React: React4,
2167
2183
  ReactDOM: { ...ReactDOMClient, createPortal: createPortal2, flushSync }
2168
2184
  };
@@ -2210,6 +2226,7 @@ export {
2210
2226
  ModelStrategyZ,
2211
2227
  MountWidgetZ,
2212
2228
  NavigateZ,
2229
+ NavigationMonitor,
2213
2230
  NormalizedEventZ,
2214
2231
  NotificationToastStack,
2215
2232
  PageContextZ,
@@ -2218,6 +2235,7 @@ export {
2218
2235
  ParallelZ,
2219
2236
  PlacementZ,
2220
2237
  PulseZ,
2238
+ RUNTIME_SDK_BUILD,
2221
2239
  RUNTIME_VERSION,
2222
2240
  RemoveClassZ,
2223
2241
  RouteConditionZ,