@syntrologie/runtime-sdk 0.2.21 → 1.0.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.
Files changed (324) hide show
  1. package/CAPABILITIES.md +944 -440
  2. package/README.md +395 -66
  3. package/dist/RuntimeProvider.d.ts +51 -0
  4. package/dist/RuntimeProvider.js +113 -0
  5. package/dist/RuntimeProvider.js.map +1 -0
  6. package/dist/SmartCanvasApp.d.ts +16 -10
  7. package/dist/SmartCanvasApp.js +47 -51
  8. package/dist/SmartCanvasApp.js.map +1 -1
  9. package/dist/SmartCanvasElement.d.ts +5 -5
  10. package/dist/SmartCanvasElement.js +24 -14
  11. package/dist/SmartCanvasElement.js.map +1 -1
  12. package/dist/SmartCanvasPortal.d.ts +2 -2
  13. package/dist/SmartCanvasPortal.js +2 -2
  14. package/dist/SmartCanvasPortal.js.map +1 -1
  15. package/dist/actions/ActionEngine.d.ts +11 -0
  16. package/dist/actions/ActionEngine.js +272 -0
  17. package/dist/actions/ActionEngine.js.map +1 -0
  18. package/dist/actions/executors/index.d.ts +116 -0
  19. package/dist/actions/executors/index.js +240 -0
  20. package/dist/actions/executors/index.js.map +1 -0
  21. package/dist/actions/executors/tour.d.ts +18 -0
  22. package/dist/actions/executors/tour.js +332 -0
  23. package/dist/actions/executors/tour.js.map +1 -0
  24. package/dist/actions/index.d.ts +10 -0
  25. package/dist/actions/index.js +12 -0
  26. package/dist/actions/index.js.map +1 -0
  27. package/dist/actions/types.d.ts +399 -0
  28. package/dist/actions/types.js +8 -0
  29. package/dist/actions/types.js.map +1 -0
  30. package/dist/actions/validation.d.ts +14 -0
  31. package/dist/actions/validation.js +577 -0
  32. package/dist/actions/validation.js.map +1 -0
  33. package/dist/adaptives/adaptive-chatbot/index.js +9 -0
  34. package/dist/adaptives/adaptive-chatbot/index.js.map +7 -0
  35. package/dist/adaptives/adaptive-content/index.js +2 -0
  36. package/dist/adaptives/adaptive-content/index.js.map +7 -0
  37. package/dist/adaptives/adaptive-faq/index.js +11 -0
  38. package/dist/adaptives/adaptive-faq/index.js.map +7 -0
  39. package/dist/adaptives/adaptive-gamification/index.js +2 -0
  40. package/dist/adaptives/adaptive-gamification/index.js.map +7 -0
  41. package/dist/adaptives/adaptive-nav/index.js +11 -0
  42. package/dist/adaptives/adaptive-nav/index.js.map +7 -0
  43. package/dist/adaptives/adaptive-overlays/index.js +91 -0
  44. package/dist/adaptives/adaptive-overlays/index.js.map +7 -0
  45. package/dist/antiFlicker.js +1 -1
  46. package/dist/api.d.ts +40 -26
  47. package/dist/api.js +87 -60
  48. package/dist/api.js.map +1 -1
  49. package/dist/apps/AppContext.d.ts +31 -0
  50. package/dist/apps/AppContext.js +91 -0
  51. package/dist/apps/AppContext.js.map +1 -0
  52. package/dist/apps/AppLoader.d.ts +85 -0
  53. package/dist/apps/AppLoader.js +282 -0
  54. package/dist/apps/AppLoader.js.map +1 -0
  55. package/dist/apps/AppRegistry.d.ts +102 -0
  56. package/dist/apps/AppRegistry.js +317 -0
  57. package/dist/apps/AppRegistry.js.map +1 -0
  58. package/dist/apps/examples/gamification-app.example.d.ts +305 -0
  59. package/dist/apps/examples/gamification-app.example.js +329 -0
  60. package/dist/apps/examples/gamification-app.example.js.map +1 -0
  61. package/dist/apps/index.d.ts +14 -0
  62. package/dist/apps/index.js +16 -0
  63. package/dist/apps/index.js.map +1 -0
  64. package/dist/apps/types.d.ts +231 -0
  65. package/dist/apps/types.js +8 -0
  66. package/dist/apps/types.js.map +1 -0
  67. package/dist/blocks/data/ComparisonBlock.d.ts +1 -1
  68. package/dist/blocks/data/ComparisonBlock.js +40 -40
  69. package/dist/blocks/data/ComparisonBlock.js.map +1 -1
  70. package/dist/blocks/data/StatsBlock.d.ts +1 -1
  71. package/dist/blocks/data/StatsBlock.js +42 -44
  72. package/dist/blocks/data/StatsBlock.js.map +1 -1
  73. package/dist/blocks/data/index.d.ts +2 -2
  74. package/dist/blocks/data/index.js +2 -2
  75. package/dist/blocks/index.d.ts +5 -5
  76. package/dist/blocks/index.js +29 -30
  77. package/dist/blocks/index.js.map +1 -1
  78. package/dist/blocks/interactive/ChecklistBlock.d.ts +1 -1
  79. package/dist/blocks/interactive/ChecklistBlock.js +60 -60
  80. package/dist/blocks/interactive/ChecklistBlock.js.map +1 -1
  81. package/dist/blocks/interactive/RatingBlock.d.ts +1 -1
  82. package/dist/blocks/interactive/RatingBlock.js +73 -65
  83. package/dist/blocks/interactive/RatingBlock.js.map +1 -1
  84. package/dist/blocks/interactive/index.d.ts +2 -2
  85. package/dist/blocks/interactive/index.js +2 -2
  86. package/dist/blocks/notification/NotificationBlock.d.ts +2 -2
  87. package/dist/blocks/notification/NotificationBlock.js +68 -64
  88. package/dist/blocks/notification/NotificationBlock.js.map +1 -1
  89. package/dist/blocks/notification/index.d.ts +1 -1
  90. package/dist/blocks/notification/index.js +1 -1
  91. package/dist/bootstrap.d.ts +32 -8
  92. package/dist/bootstrap.js +218 -102
  93. package/dist/bootstrap.js.map +1 -1
  94. package/dist/components/ShadowCanvasOverlay.d.ts +6 -6
  95. package/dist/components/ShadowCanvasOverlay.js +156 -118
  96. package/dist/components/ShadowCanvasOverlay.js.map +1 -1
  97. package/dist/components/TileCard.d.ts +5 -5
  98. package/dist/components/TileCard.js +205 -154
  99. package/dist/components/TileCard.js.map +1 -1
  100. package/dist/components/TileWheel.d.ts +3 -3
  101. package/dist/components/TileWheel.js +29 -7
  102. package/dist/components/TileWheel.js.map +1 -1
  103. package/dist/config-validator.d.ts +49 -0
  104. package/dist/config-validator.js +173 -0
  105. package/dist/config-validator.js.map +1 -0
  106. package/dist/configFetcher.d.ts +7 -3
  107. package/dist/configFetcher.js +70 -29
  108. package/dist/configFetcher.js.map +1 -1
  109. package/dist/context/ContextManager.d.ts +3 -3
  110. package/dist/context/ContextManager.js +19 -18
  111. package/dist/context/ContextManager.js.map +1 -1
  112. package/dist/context/index.d.ts +4 -4
  113. package/dist/context/index.js +3 -3
  114. package/dist/context/schema.d.ts +9 -9
  115. package/dist/context/schema.js +2 -2
  116. package/dist/context/schema.js.map +1 -1
  117. package/dist/decisions/engine.d.ts +5 -5
  118. package/dist/decisions/engine.js +13 -13
  119. package/dist/decisions/engine.js.map +1 -1
  120. package/dist/decisions/index.d.ts +6 -6
  121. package/dist/decisions/index.js +5 -5
  122. package/dist/decisions/schema.d.ts +131 -131
  123. package/dist/decisions/schema.js +21 -21
  124. package/dist/decisions/schema.js.map +1 -1
  125. package/dist/decisions/strategies/rules.d.ts +1 -1
  126. package/dist/decisions/strategies/rules.js +24 -24
  127. package/dist/decisions/strategies/rules.js.map +1 -1
  128. package/dist/decisions/strategies/score.d.ts +1 -1
  129. package/dist/decisions/strategies/score.js +3 -3
  130. package/dist/decisions/types.d.ts +19 -19
  131. package/dist/earlyPatcher.d.ts +8 -20
  132. package/dist/earlyPatcher.js +13 -62
  133. package/dist/earlyPatcher.js.map +1 -1
  134. package/dist/editorLoader.d.ts +19 -7
  135. package/dist/editorLoader.js +154 -97
  136. package/dist/editorLoader.js.map +1 -1
  137. package/dist/events/EventBus.d.ts +3 -3
  138. package/dist/events/EventBus.js +5 -7
  139. package/dist/events/EventBus.js.map +1 -1
  140. package/dist/events/index.d.ts +6 -6
  141. package/dist/events/index.js +5 -5
  142. package/dist/events/normalizers/canvas.d.ts +2 -2
  143. package/dist/events/normalizers/canvas.js +3 -3
  144. package/dist/events/normalizers/canvas.js.map +1 -1
  145. package/dist/events/normalizers/posthog.d.ts +25 -1
  146. package/dist/events/normalizers/posthog.js +35 -27
  147. package/dist/events/normalizers/posthog.js.map +1 -1
  148. package/dist/events/schema.d.ts +13 -13
  149. package/dist/events/schema.js +3 -3
  150. package/dist/events/schema.js.map +1 -1
  151. package/dist/events/types.d.ts +7 -1
  152. package/dist/events/types.js +29 -21
  153. package/dist/events/types.js.map +1 -1
  154. package/dist/experiments/adapters/growthbook.d.ts +5 -4
  155. package/dist/experiments/adapters/growthbook.js +14 -6
  156. package/dist/experiments/adapters/growthbook.js.map +1 -1
  157. package/dist/experiments/index.d.ts +3 -3
  158. package/dist/experiments/index.js +1 -1
  159. package/dist/experiments/registry.d.ts +2 -2
  160. package/dist/experiments/registry.js +2 -2
  161. package/dist/experiments/types.d.ts +10 -1
  162. package/dist/fetchers/cdnFetcher.d.ts +1 -1
  163. package/dist/fetchers/cdnFetcher.js +4 -8
  164. package/dist/fetchers/cdnFetcher.js.map +1 -1
  165. package/dist/fetchers/experimentsFetcher.d.ts +25 -3
  166. package/dist/fetchers/experimentsFetcher.js +55 -8
  167. package/dist/fetchers/experimentsFetcher.js.map +1 -1
  168. package/dist/fetchers/index.d.ts +3 -3
  169. package/dist/fetchers/index.js +2 -2
  170. package/dist/fetchers/index.js.map +1 -1
  171. package/dist/fetchers/mergeConfigs.d.ts +29 -0
  172. package/dist/fetchers/mergeConfigs.js +38 -0
  173. package/dist/fetchers/mergeConfigs.js.map +1 -0
  174. package/dist/fetchers/registry.d.ts +1 -1
  175. package/dist/fetchers/registry.js +4 -4
  176. package/dist/fetchers/types.d.ts +1 -1
  177. package/dist/hooks/useCanvasOverlays.d.ts +8 -5
  178. package/dist/hooks/useCanvasOverlays.js +66 -17
  179. package/dist/hooks/useCanvasOverlays.js.map +1 -1
  180. package/dist/hooks/useHostPatches.d.ts +2 -2
  181. package/dist/hooks/useHostPatches.js +8 -8
  182. package/dist/hooks/useHostPatches.js.map +1 -1
  183. package/dist/hooks/useShadowCanvasConfig.d.ts +5 -9
  184. package/dist/hooks/useShadowCanvasConfig.js +7 -5
  185. package/dist/hooks/useShadowCanvasConfig.js.map +1 -1
  186. package/dist/hostPatcher/core/patcher.d.ts +1 -1
  187. package/dist/hostPatcher/core/patcher.js +18 -9
  188. package/dist/hostPatcher/core/patcher.js.map +1 -1
  189. package/dist/hostPatcher/core/sanitizer.js +24 -3
  190. package/dist/hostPatcher/core/sanitizer.js.map +1 -1
  191. package/dist/hostPatcher/policy/defaultPolicy.js +15 -5
  192. package/dist/hostPatcher/policy/defaultPolicy.js.map +1 -1
  193. package/dist/hostPatcher/utils/anchors.js +4 -6
  194. package/dist/hostPatcher/utils/anchors.js.map +1 -1
  195. package/dist/index.d.ts +34 -27
  196. package/dist/index.js +51 -24
  197. package/dist/index.js.map +1 -1
  198. package/dist/logger.d.ts +29 -0
  199. package/dist/logger.js +81 -0
  200. package/dist/logger.js.map +1 -0
  201. package/dist/metrics/index.d.ts +1 -1
  202. package/dist/metrics/index.js +1 -1
  203. package/dist/metrics/sessionMetrics.d.ts +1 -1
  204. package/dist/metrics/sessionMetrics.js +6 -6
  205. package/dist/overlays/fetcher.d.ts +2 -2
  206. package/dist/overlays/fetcher.js +13 -15
  207. package/dist/overlays/fetcher.js.map +1 -1
  208. package/dist/overlays/recipeRegistry.js +2 -2
  209. package/dist/overlays/recipeRegistry.js.map +1 -1
  210. package/dist/overlays/runtime/anchor/resolve.js +1 -1
  211. package/dist/overlays/runtime/anchor/resolve.js.map +1 -1
  212. package/dist/overlays/runtime/index.d.ts +7 -7
  213. package/dist/overlays/runtime/index.js +7 -7
  214. package/dist/overlays/runtime/overlay/highlight.js +39 -39
  215. package/dist/overlays/runtime/overlay/highlight.js.map +1 -1
  216. package/dist/overlays/runtime/overlay/modal.js +5 -5
  217. package/dist/overlays/runtime/overlay/modal.js.map +1 -1
  218. package/dist/overlays/runtime/overlay/root.js +1 -1
  219. package/dist/overlays/runtime/overlay/runner.js +88 -28
  220. package/dist/overlays/runtime/overlay/runner.js.map +1 -1
  221. package/dist/overlays/runtime/overlay/tooltip.d.ts +1 -1
  222. package/dist/overlays/runtime/overlay/tooltip.js +13 -15
  223. package/dist/overlays/runtime/overlay/tooltip.js.map +1 -1
  224. package/dist/overlays/runtime/utils/dom.js +4 -1
  225. package/dist/overlays/runtime/utils/dom.js.map +1 -1
  226. package/dist/overlays/schema.d.ts +146 -146
  227. package/dist/overlays/schema.js +12 -8
  228. package/dist/overlays/schema.js.map +1 -1
  229. package/dist/react.d.ts +7 -7
  230. package/dist/react.js +4 -4
  231. package/dist/react.js.map +1 -1
  232. package/dist/render/RenderContext.d.ts +2 -2
  233. package/dist/render/RenderContext.js +5 -5
  234. package/dist/render/RenderContext.js.map +1 -1
  235. package/dist/render/index.d.ts +3 -3
  236. package/dist/render/index.js +1 -1
  237. package/dist/render/types.d.ts +4 -4
  238. package/dist/runtime.d.ts +32 -8
  239. package/dist/runtime.js +109 -13
  240. package/dist/runtime.js.map +1 -1
  241. package/dist/smart-canvas.esm.js +144 -55
  242. package/dist/smart-canvas.esm.js.map +4 -4
  243. package/dist/smart-canvas.js +14688 -11455
  244. package/dist/smart-canvas.js.map +4 -4
  245. package/dist/smart-canvas.min.js +145 -55
  246. package/dist/smart-canvas.min.js.map +4 -4
  247. package/dist/state/StateStore.d.ts +1 -7
  248. package/dist/state/StateStore.js +15 -9
  249. package/dist/state/StateStore.js.map +1 -1
  250. package/dist/state/helpers/cooldowns.d.ts +1 -1
  251. package/dist/state/helpers/cooldowns.js +1 -1
  252. package/dist/state/helpers/dismissals.d.ts +1 -1
  253. package/dist/state/helpers/dismissals.js +1 -1
  254. package/dist/state/helpers/frequency.d.ts +1 -1
  255. package/dist/state/helpers/frequency.js +1 -1
  256. package/dist/state/index.d.ts +4 -4
  257. package/dist/state/index.js +3 -3
  258. package/dist/state/schema.d.ts +1 -1
  259. package/dist/state/schema.js +1 -1
  260. package/dist/store/example.d.ts +1 -0
  261. package/dist/store/example.js +43 -0
  262. package/dist/store/example.js.map +1 -0
  263. package/dist/store/mini-effector.d.ts +46 -0
  264. package/dist/store/mini-effector.js +88 -0
  265. package/dist/store/mini-effector.js.map +1 -0
  266. package/dist/surfaces/Surfaces.d.ts +11 -0
  267. package/dist/surfaces/Surfaces.js +361 -0
  268. package/dist/surfaces/Surfaces.js.map +1 -0
  269. package/dist/surfaces/index.d.ts +9 -0
  270. package/dist/surfaces/index.js +12 -0
  271. package/dist/surfaces/index.js.map +1 -0
  272. package/dist/surfaces/positioning.d.ts +50 -0
  273. package/dist/surfaces/positioning.js +228 -0
  274. package/dist/surfaces/positioning.js.map +1 -0
  275. package/dist/surfaces/types.d.ts +167 -0
  276. package/dist/surfaces/types.js +23 -0
  277. package/dist/surfaces/types.js.map +1 -0
  278. package/dist/telemetry/adapters/noop.d.ts +12 -0
  279. package/dist/telemetry/adapters/noop.js +42 -0
  280. package/dist/telemetry/adapters/noop.js.map +1 -0
  281. package/dist/telemetry/adapters/posthog.d.ts +8 -2
  282. package/dist/telemetry/adapters/posthog.js +36 -14
  283. package/dist/telemetry/adapters/posthog.js.map +1 -1
  284. package/dist/telemetry/index.d.ts +4 -3
  285. package/dist/telemetry/index.js +3 -2
  286. package/dist/telemetry/index.js.map +1 -1
  287. package/dist/telemetry/registry.d.ts +2 -9
  288. package/dist/telemetry/registry.js +4 -2
  289. package/dist/telemetry/registry.js.map +1 -1
  290. package/dist/telemetry/types.d.ts +1 -1
  291. package/dist/theme/ThemeProvider.d.ts +2 -2
  292. package/dist/theme/ThemeProvider.js +21 -21
  293. package/dist/theme/ThemeProvider.js.map +1 -1
  294. package/dist/theme/defaultTheme.d.ts +4 -5
  295. package/dist/theme/defaultTheme.js +127 -118
  296. package/dist/theme/defaultTheme.js.map +1 -1
  297. package/dist/theme/extractHostTheme.d.ts +1 -1
  298. package/dist/theme/extractHostTheme.js +43 -45
  299. package/dist/theme/extractHostTheme.js.map +1 -1
  300. package/dist/theme/index.d.ts +5 -5
  301. package/dist/theme/index.js +3 -3
  302. package/dist/theme/index.js.map +1 -1
  303. package/dist/theme/types.d.ts +2 -2
  304. package/dist/token.d.ts +2 -0
  305. package/dist/token.js +3 -6
  306. package/dist/token.js.map +1 -1
  307. package/dist/types-only.d.ts +32 -0
  308. package/dist/types-only.js +11 -0
  309. package/dist/types-only.js.map +1 -0
  310. package/dist/types.d.ts +89 -56
  311. package/dist/types.js +14 -2
  312. package/dist/types.js.map +1 -1
  313. package/dist/version.d.ts +13 -0
  314. package/dist/version.js +14 -0
  315. package/dist/version.js.map +1 -0
  316. package/dist/widgets/WidgetRegistry.d.ts +145 -0
  317. package/dist/widgets/WidgetRegistry.js +191 -0
  318. package/dist/widgets/WidgetRegistry.js.map +1 -0
  319. package/dist/widgets/index.d.ts +7 -0
  320. package/dist/widgets/index.js +7 -0
  321. package/dist/widgets/index.js.map +1 -0
  322. package/package.json +35 -15
  323. package/schema/canvas-config.schema.json +488 -254
  324. package/schema/runtime-context.schema.json +1 -5
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAQA,iBAAiB;AACjB,OAAO,EACL,SAAS,EACT,UAAU,EACV,eAAe,EACf,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAExB,mBAAmB;AACnB,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAE5B,2BAA2B;AAC3B,OAAO,EACL,aAAa,EACb,QAAQ,EACR,aAAa,EACb,WAAW,GACZ,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAGA,iBAAiB;AACjB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE7F,mBAAmB;AACnB,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEhG,2BAA2B;AAC3B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
@@ -80,12 +80,12 @@ export interface ExtractedTheme {
80
80
  /**
81
81
  * Theme mode
82
82
  */
83
- export type ThemeMode = "light" | "dark" | "auto";
83
+ export type ThemeMode = 'light' | 'dark' | 'auto';
84
84
  /**
85
85
  * User-provided theme overrides via appearance config
86
86
  */
87
87
  export interface ThemeAppearance {
88
88
  mode?: ThemeMode;
89
89
  variables?: Partial<Record<`--sc-${string}`, string>>;
90
- baseTheme?: "system" | "light" | "dark";
90
+ baseTheme?: 'system' | 'light' | 'dark';
91
91
  }
package/dist/token.d.ts CHANGED
@@ -20,6 +20,8 @@ export interface SyntroTokenPayload {
20
20
  f?: string;
21
21
  /** Fetcher-specific options (e.g., configId for cdn fetcher) */
22
22
  o?: Record<string, string>;
23
+ /** Debug mode - enables console logging (default: false) */
24
+ d?: boolean;
23
25
  }
24
26
  /**
25
27
  * Decode a Syntro token into its payload.
package/dist/token.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * It bundles all necessary credentials (experiments, telemetry, config) into
6
6
  * a single string that clients can use to initialize the SDK.
7
7
  */
8
- const TOKEN_PREFIX = "syn_";
8
+ const TOKEN_PREFIX = 'syn_';
9
9
  /**
10
10
  * Decode a Syntro token into its payload.
11
11
  *
@@ -19,7 +19,7 @@ export function decodeToken(token) {
19
19
  }
20
20
  const base64 = token.slice(TOKEN_PREFIX.length);
21
21
  // Convert base64url to standard base64
22
- const standardBase64 = base64.replace(/-/g, "+").replace(/_/g, "/");
22
+ const standardBase64 = base64.replace(/-/g, '+').replace(/_/g, '/');
23
23
  const json = atob(standardBase64);
24
24
  const payload = JSON.parse(json);
25
25
  if (payload.v !== 1) {
@@ -38,10 +38,7 @@ export function decodeToken(token) {
38
38
  export function encodeToken(payload) {
39
39
  const json = JSON.stringify(payload);
40
40
  // Convert to base64url (URL-safe, no padding)
41
- const base64 = btoa(json)
42
- .replace(/\+/g, "-")
43
- .replace(/\//g, "_")
44
- .replace(/=+$/, "");
41
+ const base64 = btoa(json).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
45
42
  return TOKEN_PREFIX + base64;
46
43
  }
47
44
  //# sourceMappingURL=token.js.map
package/dist/token.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"token.js","sourceRoot":"","sources":["../src/token.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,YAAY,GAAG,MAAM,CAAC;AAyB5B;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAChD,uCAAuC;IACvC,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACpE,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC;IAClC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAuB,CAAC;IAEvD,IAAI,OAAO,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,8BAA8B,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,OAA2B;IACrD,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,8CAA8C;IAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC;SACtB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACtB,OAAO,YAAY,GAAG,MAAM,CAAC;AAC/B,CAAC"}
1
+ {"version":3,"file":"token.js","sourceRoot":"","sources":["../src/token.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,YAAY,GAAG,MAAM,CAAC;AA4B5B;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAChD,uCAAuC;IACvC,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACpE,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC;IAClC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAuB,CAAC;IAEvD,IAAI,OAAO,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,8BAA8B,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,OAA2B;IACrD,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,8CAA8C;IAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACrF,OAAO,YAAY,GAAG,MAAM,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Types-only export for app packages.
3
+ *
4
+ * This file re-exports action types without importing any runtime code,
5
+ * allowing app packages to import types without circular dependency issues.
6
+ *
7
+ * Apps should import from "@syntrologie/runtime-sdk/types" instead of
8
+ * the main entry point when they only need type definitions.
9
+ */
10
+ /**
11
+ * Props passed to editor panel components.
12
+ */
13
+ export interface EditorPanelProps {
14
+ /** The current config for this app's portion */
15
+ config: Record<string, unknown>;
16
+ /** Callback when config changes */
17
+ onChange: (config: Record<string, unknown>) => void;
18
+ /** Editor utilities */
19
+ editor: {
20
+ /** Mark the editor as dirty (has unsaved changes) */
21
+ setDirty: (dirty: boolean) => void;
22
+ /** Navigate back to home */
23
+ navigateHome: () => Promise<boolean>;
24
+ /** Save the current config */
25
+ save: () => Promise<void>;
26
+ /** Publish the current config */
27
+ publish: (captureScreenshot?: boolean) => Promise<void>;
28
+ };
29
+ /** Platform client for API calls (optional) */
30
+ platformClient?: unknown;
31
+ }
32
+ export type { StaticSurfaceSlot, InlineSurfaceSlot, AdjacentSurfaceSlot, SurfaceSlot, HighlightStyle, BadgePosition, TooltipContent, TooltipTrigger, InsertPosition, WidgetConfig, HighlightAction, PulseAction, BadgeAction, TooltipAction, InsertHtmlAction, SetTextAction, SetAttrAction, AddClassAction, RemoveClassAction, SetStyleAction, MountWidgetAction, ScrollToAction, NavigateAction, ActionStep, ActionKind, ActionState, ActionHandle, BatchActionHandle, ActiveAction, ValidationError, ValidationWarning, ValidationResult, ExecutorCleanup, ExecutorUpdate, ExecutorResult, ActionExecutor, ExecutorContext, } from './actions/types';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Types-only export for app packages.
3
+ *
4
+ * This file re-exports action types without importing any runtime code,
5
+ * allowing app packages to import types without circular dependency issues.
6
+ *
7
+ * Apps should import from "@syntrologie/runtime-sdk/types" instead of
8
+ * the main entry point when they only need type definitions.
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=types-only.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-only.js","sourceRoot":"","sources":["../src/types-only.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
package/dist/types.d.ts CHANGED
@@ -1,11 +1,26 @@
1
+ import type { ActionStep } from './actions/types';
2
+ export { SDK_VERSION } from './version';
3
+ /**
4
+ * SDK schema version in Major.Minor format (e.g., "2.0", "2.1").
5
+ * Used for compatibility checking between SDK and backend configs.
6
+ * Sent in X-SDK-Schema-Version header.
7
+ *
8
+ * Bump rules:
9
+ * - Major: Breaking changes (field removal, type changes)
10
+ * - Minor: Backwards-compatible additions (new optional fields)
11
+ *
12
+ * @since 2.0.0
13
+ */
14
+ export declare const SDK_SCHEMA_VERSION = "2.0";
15
+ export type { ActionStep } from './actions/types';
1
16
  /**
2
17
  * Props passed to every tile component when mounted
3
18
  */
4
19
  export interface TileComponentProps {
5
20
  config: TileConfig;
6
21
  isExpanded: boolean;
7
- surface: "overlay" | "wheel";
8
- telemetry?: import("./telemetry/types").TelemetryClient;
22
+ surface: 'overlay' | 'wheel';
23
+ telemetry?: import('./telemetry/types').TelemetryClient;
9
24
  }
10
25
  /**
11
26
  * Interface for registering custom tile components
@@ -16,15 +31,15 @@ export interface TileComponent {
16
31
  /**
17
32
  * All available block types organized by category
18
33
  */
19
- export type NotificationBlockType = "alert" | "success" | "warning" | "info" | "error";
20
- export type MediaBlockType = "video" | "gallery" | "code";
21
- export type InteractiveBlockType = "form" | "rating" | "progress" | "survey" | "checklist";
22
- export type DataBlockType = "stats" | "comparison" | "chart" | "table";
23
- export type LegacyBlockType = "text" | "metric" | "chatbot" | "embed";
34
+ export type NotificationBlockType = 'alert' | 'success' | 'warning' | 'info' | 'error';
35
+ export type MediaBlockType = 'video' | 'gallery' | 'code';
36
+ export type InteractiveBlockType = 'form' | 'rating' | 'progress' | 'survey' | 'checklist';
37
+ export type DataBlockType = 'stats' | 'comparison' | 'chart' | 'table';
38
+ export type LegacyBlockType = 'text' | 'metric' | 'chatbot' | 'embed';
24
39
  /**
25
40
  * Union of all block types
26
41
  */
27
- export type BlockType = NotificationBlockType | MediaBlockType | InteractiveBlockType | DataBlockType | LegacyBlockType | "custom";
42
+ export type BlockType = NotificationBlockType | MediaBlockType | InteractiveBlockType | DataBlockType | LegacyBlockType | 'custom';
28
43
  export interface NotificationContentBase {
29
44
  title: string;
30
45
  body?: string;
@@ -33,49 +48,49 @@ export interface NotificationContentBase {
33
48
  timestamp?: string;
34
49
  }
35
50
  export interface AlertContent extends NotificationContentBase {
36
- type: "alert";
37
- severity?: "low" | "medium" | "high" | "critical";
51
+ type: 'alert';
52
+ severity?: 'low' | 'medium' | 'high' | 'critical';
38
53
  }
39
54
  export interface SuccessContent extends NotificationContentBase {
40
- type: "success";
55
+ type: 'success';
41
56
  confetti?: boolean;
42
57
  }
43
58
  export interface WarningContent extends NotificationContentBase {
44
- type: "warning";
59
+ type: 'warning';
45
60
  countdown?: number;
46
61
  }
47
62
  export interface InfoContent extends NotificationContentBase {
48
- type: "info";
63
+ type: 'info';
49
64
  learnMoreUrl?: string;
50
65
  }
51
66
  export interface ErrorContent extends NotificationContentBase {
52
- type: "error";
67
+ type: 'error';
53
68
  errorCode?: string;
54
69
  retryable?: boolean;
55
70
  }
56
71
  export type NotificationContent = AlertContent | SuccessContent | WarningContent | InfoContent | ErrorContent;
57
72
  export interface VideoContent {
58
- type: "video";
73
+ type: 'video';
59
74
  src: string;
60
- provider?: "youtube" | "vimeo" | "custom";
75
+ provider?: 'youtube' | 'vimeo' | 'custom';
61
76
  poster?: string;
62
77
  autoplay?: boolean;
63
78
  muted?: boolean;
64
79
  loop?: boolean;
65
- aspectRatio?: "16:9" | "4:3" | "1:1" | "9:16";
80
+ aspectRatio?: '16:9' | '4:3' | '1:1' | '9:16';
66
81
  }
67
82
  export interface GalleryContent {
68
- type: "gallery";
83
+ type: 'gallery';
69
84
  images: Array<{
70
85
  src: string;
71
86
  alt?: string;
72
87
  caption?: string;
73
88
  }>;
74
- layout?: "carousel" | "grid" | "masonry";
89
+ layout?: 'carousel' | 'grid' | 'masonry';
75
90
  columns?: 2 | 3 | 4;
76
91
  }
77
92
  export interface CodeContent {
78
- type: "code";
93
+ type: 'code';
79
94
  code: string;
80
95
  language?: string;
81
96
  lineNumbers?: boolean;
@@ -86,7 +101,7 @@ export interface CodeContent {
86
101
  export type MediaContent = VideoContent | GalleryContent | CodeContent;
87
102
  export interface FormField {
88
103
  id: string;
89
- type: "text" | "email" | "select" | "checkbox" | "radio" | "textarea";
104
+ type: 'text' | 'email' | 'select' | 'checkbox' | 'radio' | 'textarea';
90
105
  label: string;
91
106
  placeholder?: string;
92
107
  required?: boolean;
@@ -97,21 +112,21 @@ export interface FormField {
97
112
  defaultValue?: string | boolean;
98
113
  }
99
114
  export interface FormContent {
100
- type: "form";
115
+ type: 'form';
101
116
  fields: FormField[];
102
117
  submitLabel?: string;
103
118
  submitActionId?: string;
104
119
  }
105
120
  export interface RatingContent {
106
- type: "rating";
107
- variant: "stars" | "thumbs" | "nps" | "emoji";
121
+ type: 'rating';
122
+ variant: 'stars' | 'thumbs' | 'nps' | 'emoji';
108
123
  question?: string;
109
124
  maxValue?: number;
110
125
  submitActionId?: string;
111
126
  }
112
127
  export interface ProgressContent {
113
- type: "progress";
114
- variant: "bar" | "steps" | "circular";
128
+ type: 'progress';
129
+ variant: 'bar' | 'steps' | 'circular';
115
130
  value: number;
116
131
  max?: number;
117
132
  steps?: Array<{
@@ -126,7 +141,7 @@ export interface SurveyChoice {
126
141
  icon?: string;
127
142
  }
128
143
  export interface SurveyContent {
129
- type: "survey";
144
+ type: 'survey';
130
145
  question: string;
131
146
  choices: SurveyChoice[];
132
147
  multiSelect?: boolean;
@@ -143,19 +158,19 @@ export interface ChecklistItem {
143
158
  completed?: boolean;
144
159
  }
145
160
  export interface ChecklistContent {
146
- type: "checklist";
161
+ type: 'checklist';
147
162
  items: ChecklistItem[];
148
163
  title?: string;
149
164
  showProgress?: boolean;
150
165
  }
151
166
  export type InteractiveContent = FormContent | RatingContent | ProgressContent | SurveyContent | ChecklistContent;
152
167
  export interface TrendIndicator {
153
- direction: "up" | "down" | "neutral";
168
+ direction: 'up' | 'down' | 'neutral';
154
169
  value: string;
155
170
  timeframe?: string;
156
171
  }
157
172
  export interface StatsContent {
158
- type: "stats";
173
+ type: 'stats';
159
174
  value: string;
160
175
  label: string;
161
176
  trend?: TrendIndicator;
@@ -170,15 +185,15 @@ export interface ComparisonItem {
170
185
  icon?: string;
171
186
  }
172
187
  export interface ComparisonContent {
173
- type: "comparison";
188
+ type: 'comparison';
174
189
  items: ComparisonItem[];
175
- layout?: "grid" | "list" | "table";
190
+ layout?: 'grid' | 'list' | 'table';
176
191
  columns?: 2 | 3 | 4;
177
192
  highlightBest?: boolean;
178
193
  }
179
194
  export interface ChartContent {
180
- type: "chart";
181
- chartType: "bar" | "line" | "pie" | "donut";
195
+ type: 'chart';
196
+ chartType: 'bar' | 'line' | 'pie' | 'donut';
182
197
  data: Array<{
183
198
  label: string;
184
199
  value: number;
@@ -195,7 +210,7 @@ export interface TableColumn {
195
210
  width?: string;
196
211
  }
197
212
  export interface TableContent {
198
- type: "table";
213
+ type: 'table';
199
214
  columns: TableColumn[];
200
215
  rows: Array<Record<string, string | number>>;
201
216
  sortable?: boolean;
@@ -206,12 +221,12 @@ export type DataContent = StatsContent | ComparisonContent | ChartContent | Tabl
206
221
  /**
207
222
  * Grid width: "full" = spans both columns, "half" = one column
208
223
  */
209
- export type TileSize = "full" | "half";
224
+ export type TileSize = 'full' | 'half';
210
225
  /**
211
226
  * Built-in tile types (convenience components we ship)
212
227
  * @deprecated Use BlockType instead
213
228
  */
214
- export type BuiltInTileType = "text" | "metric" | "chatbot" | "embed";
229
+ export type BuiltInTileType = 'text' | 'metric' | 'chatbot' | 'embed';
215
230
  /**
216
231
  * Content configuration for built-in tile types
217
232
  * @deprecated Use specific content types (NotificationContent, MediaContent, etc.)
@@ -229,7 +244,7 @@ export interface BuiltInTileContent {
229
244
  * Content configuration for custom tile components
230
245
  */
231
246
  export interface CustomTileContent {
232
- type: "custom";
247
+ type: 'custom';
233
248
  component: string;
234
249
  props?: Record<string, unknown>;
235
250
  actions?: TileAction[];
@@ -249,7 +264,7 @@ export interface TileAction {
249
264
  label: string;
250
265
  href?: string;
251
266
  onClickId?: string;
252
- style?: "primary" | "secondary";
267
+ style?: 'primary' | 'secondary';
253
268
  }
254
269
  /**
255
270
  * Visual styling for tile chrome
@@ -269,7 +284,7 @@ export interface TileExperiment {
269
284
  variationValue?: string | number | boolean;
270
285
  predicate?: (value: unknown) => boolean;
271
286
  }
272
- export type { ActivationConfig, RouteFilter, DecisionStrategy } from "./decisions/types";
287
+ export type { ActivationConfig, RouteFilter, DecisionStrategy } from './decisions/types';
273
288
  /**
274
289
  * Full tile configuration
275
290
  */
@@ -292,12 +307,10 @@ export interface TileConfig {
292
307
  * Activation configuration for conditional rendering.
293
308
  * Replaces the experiment field with more flexible context-aware decisions.
294
309
  */
295
- activation?: import("./decisions/types").ActivationConfig;
310
+ activation?: import('./decisions/types').ActivationConfig;
296
311
  }
297
- import type { Patch } from "./hostPatcher/core/types";
298
312
  /**
299
313
  * Theme configuration for the SmartCanvas overlay.
300
- * These values are typically set from workspace settings after style selection.
301
314
  */
302
315
  export interface CanvasThemeConfig {
303
316
  name?: string;
@@ -310,35 +323,55 @@ export interface CanvasThemeConfig {
310
323
  borderRadius?: string;
311
324
  position?: 'left' | 'right';
312
325
  }
326
+ /**
327
+ * Launcher button configuration.
328
+ */
313
329
  export interface LauncherConfig {
314
- /** Label shown on the launcher button (default: "Adaptives") */
315
330
  label?: string;
316
- /** Whether to animate the launcher to draw attention */
317
331
  animate?: boolean;
318
- /** Animation style: "pulse" (default), "bounce", "glow" */
319
- animationStyle?: "pulse" | "bounce" | "glow";
332
+ animationStyle?: 'pulse' | 'bounce' | 'glow';
320
333
  }
334
+ /**
335
+ * Route filtering - control where canvas appears.
336
+ */
321
337
  export interface RoutesConfig {
322
- /** Routes where the canvas should NOT appear (e.g., ["/login", "/signup"]) */
323
338
  exclude?: string[];
324
- /** If specified, canvas ONLY appears on these routes */
325
339
  include?: string[];
326
340
  }
341
+ /**
342
+ * Canvas configuration response.
343
+ *
344
+ * This is the complete config format. Actions are the single mechanism
345
+ * for all interventions: DOM modifications, tooltips, highlights, modals.
346
+ */
327
347
  export interface CanvasConfigResponse {
348
+ /**
349
+ * Schema version this config conforms to (e.g., "2.0", "2.1").
350
+ * Used for compatibility checking and automatic migration between versions.
351
+ * If omitted, defaults to "1.0" for backwards compatibility.
352
+ *
353
+ * @since 2.0.0
354
+ */
355
+ schemaVersion?: string;
356
+ /** Tiles to display in the canvas drawer */
328
357
  tiles: TileConfig[];
358
+ /**
359
+ * Actions to execute.
360
+ * This is the unified intervention format. Every DOM change, tooltip,
361
+ * highlight, or modal is an ActionStep.
362
+ */
363
+ actions: ActionStep[];
364
+ /** When the config was fetched */
329
365
  fetchedAt: string;
366
+ /** Optional version string for cache invalidation */
330
367
  configVersion?: string;
368
+ /** Display title for the canvas */
331
369
  canvasTitle?: string;
332
- patches?: Patch[];
333
- /** @deprecated Use overlayRecipes instead */
334
- overlayRecipe?: import('./overlays/types').CanvasRecipe;
335
- /** Multiple overlay recipes (tours) */
336
- overlayRecipes?: import('./overlays/types').CanvasRecipe[];
337
- /** SmartCanvas theme configuration from workspace settings */
370
+ /** Theme configuration */
338
371
  theme?: CanvasThemeConfig;
339
372
  /** Launcher button configuration */
340
373
  launcher?: LauncherConfig;
341
- /** Route filtering - control where canvas appears */
374
+ /** Route filtering */
342
375
  routes?: RoutesConfig;
343
376
  }
344
377
  export type CanvasConfigFetcher = () => Promise<CanvasConfigResponse>;
package/dist/types.js CHANGED
@@ -1,5 +1,17 @@
1
1
  // =============================================================================
2
- // TILE COMPONENT API
2
+ // SDK VERSION CONSTANTS
3
3
  // =============================================================================
4
- export {};
4
+ export { SDK_VERSION } from './version';
5
+ /**
6
+ * SDK schema version in Major.Minor format (e.g., "2.0", "2.1").
7
+ * Used for compatibility checking between SDK and backend configs.
8
+ * Sent in X-SDK-Schema-Version header.
9
+ *
10
+ * Bump rules:
11
+ * - Major: Breaking changes (field removal, type changes)
12
+ * - Minor: Backwards-compatible additions (new optional fields)
13
+ *
14
+ * @since 2.0.0
15
+ */
16
+ export const SDK_SCHEMA_VERSION = '2.0';
5
17
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,qBAAqB;AACrB,gFAAgF"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,wBAAwB;AACxB,gFAAgF;AAShF,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * SDK package version.
3
+ *
4
+ * This file is auto-generated at release time by `scripts/prepare-release.mjs`.
5
+ * The sentinel value below is overwritten with the real semver version
6
+ * during the semantic-release prepare phase.
7
+ *
8
+ * DO NOT import version from package.json — this constant is the single
9
+ * source of truth for the runtime bundle.
10
+ *
11
+ * @since 2.0.0
12
+ */
13
+ export declare const SDK_VERSION = "1.0.0";
@@ -0,0 +1,14 @@
1
+ /**
2
+ * SDK package version.
3
+ *
4
+ * This file is auto-generated at release time by `scripts/prepare-release.mjs`.
5
+ * The sentinel value below is overwritten with the real semver version
6
+ * during the semantic-release prepare phase.
7
+ *
8
+ * DO NOT import version from package.json — this constant is the single
9
+ * source of truth for the runtime bundle.
10
+ *
11
+ * @since 2.0.0
12
+ */
13
+ export const SDK_VERSION = '1.0.0';
14
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC"}
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Widget Registry
3
+ *
4
+ * Extensible registry for mountable widget components.
5
+ * Apps can register custom widgets that can be rendered via mountWidget actions.
6
+ */
7
+ /**
8
+ * Cleanup function returned when unmounting a widget.
9
+ */
10
+ export type WidgetCleanup = () => void;
11
+ /**
12
+ * Mountable widget component interface.
13
+ *
14
+ * Widgets must implement this interface to be registered and mounted
15
+ * via the Surfaces system or mountWidget actions.
16
+ */
17
+ export interface MountableWidget {
18
+ /**
19
+ * Mount the widget into a container element.
20
+ *
21
+ * @param container - The DOM element to mount into
22
+ * @param config - Configuration/props for the widget
23
+ * @returns A cleanup function to unmount the widget, or void
24
+ */
25
+ mount(container: HTMLElement, config?: Record<string, unknown>): WidgetCleanup | void;
26
+ /**
27
+ * Optional: Update the widget with new config.
28
+ * If not provided, the widget will be unmounted and remounted on updates.
29
+ *
30
+ * @param container - The DOM element containing the widget
31
+ * @param config - New configuration/props
32
+ */
33
+ update?(container: HTMLElement, config?: Record<string, unknown>): void;
34
+ }
35
+ /**
36
+ * Widget registration entry.
37
+ */
38
+ export interface WidgetRegistration {
39
+ /** Widget ID (e.g., "gamification:leaderboard") */
40
+ id: string;
41
+ /** The widget component */
42
+ widget: MountableWidget;
43
+ /** Source app ID or "built-in" */
44
+ source: 'built-in' | string;
45
+ /** Optional metadata */
46
+ metadata?: {
47
+ name?: string;
48
+ description?: string;
49
+ icon?: string;
50
+ };
51
+ }
52
+ /**
53
+ * Mounted widget handle.
54
+ */
55
+ export interface MountedWidgetHandle {
56
+ /** The widget ID */
57
+ widgetId: string;
58
+ /** The container element */
59
+ container: HTMLElement;
60
+ /** Unmount the widget */
61
+ unmount: () => void;
62
+ /** Update the widget config */
63
+ update: (config?: Record<string, unknown>) => void;
64
+ }
65
+ /**
66
+ * Extensible registry for widget components.
67
+ *
68
+ * Allows apps to register custom widgets that can be rendered via
69
+ * mountWidget actions or directly through the Surfaces system.
70
+ */
71
+ export declare class WidgetRegistry {
72
+ private widgets;
73
+ private mountedWidgets;
74
+ private mountIdCounter;
75
+ private runtimeRef?;
76
+ constructor();
77
+ /**
78
+ * Bind a runtime reference so it can be injected into widget mount() calls.
79
+ * Uses `unknown` to avoid circular imports (WidgetRegistry ← runtime.ts).
80
+ */
81
+ bindRuntime(runtime: unknown): void;
82
+ /**
83
+ * Register a widget.
84
+ *
85
+ * @param id - The widget ID (e.g., "gamification:leaderboard")
86
+ * @param widget - The widget component
87
+ * @param source - The source app ID (for tracking)
88
+ * @param metadata - Optional metadata about the widget
89
+ */
90
+ register(id: string, widget: MountableWidget, source?: string, metadata?: WidgetRegistration['metadata']): void;
91
+ /**
92
+ * Unregister a widget.
93
+ *
94
+ * @param id - The widget ID to unregister
95
+ * @returns true if the widget was unregistered, false if not found or built-in
96
+ */
97
+ unregister(id: string): boolean;
98
+ /**
99
+ * Unregister all widgets from a specific source.
100
+ *
101
+ * @param source - The source app ID
102
+ */
103
+ unregisterBySource(source: string): void;
104
+ /**
105
+ * Get a widget by ID.
106
+ */
107
+ get(id: string): MountableWidget | undefined;
108
+ /**
109
+ * Get the full registration for a widget.
110
+ */
111
+ getRegistration(id: string): WidgetRegistration | undefined;
112
+ /**
113
+ * Check if a widget exists.
114
+ */
115
+ has(id: string): boolean;
116
+ /**
117
+ * Mount a widget into a container.
118
+ *
119
+ * @param id - The widget ID
120
+ * @param container - The DOM element to mount into
121
+ * @param config - Configuration/props for the widget
122
+ * @returns A handle for managing the mounted widget
123
+ */
124
+ mount(id: string, container: HTMLElement, config?: Record<string, unknown>): MountedWidgetHandle;
125
+ /**
126
+ * List all registered widget IDs.
127
+ */
128
+ list(): string[];
129
+ /**
130
+ * List all registrations.
131
+ */
132
+ listRegistrations(): WidgetRegistration[];
133
+ /**
134
+ * Get all widgets from a specific source.
135
+ */
136
+ getBySource(source: string): WidgetRegistration[];
137
+ /**
138
+ * Clean up all mounted widgets.
139
+ */
140
+ destroy(): void;
141
+ }
142
+ /**
143
+ * Default singleton instance of WidgetRegistry.
144
+ */
145
+ export declare const widgetRegistry: WidgetRegistry;