@syntrologie/runtime-sdk 0.2.20 → 1.0.0-canary.1

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 (332) hide show
  1. package/CAPABILITIES.md +756 -284
  2. package/README.md +310 -68
  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 +45 -49
  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/actions/ActionEngine.d.ts +11 -0
  15. package/dist/actions/ActionEngine.js +274 -0
  16. package/dist/actions/ActionEngine.js.map +1 -0
  17. package/dist/actions/executors/index.d.ts +117 -0
  18. package/dist/actions/executors/index.js +242 -0
  19. package/dist/actions/executors/index.js.map +1 -0
  20. package/dist/actions/executors/tour.d.ts +18 -0
  21. package/dist/actions/executors/tour.js +332 -0
  22. package/dist/actions/executors/tour.js.map +1 -0
  23. package/dist/actions/index.d.ts +10 -0
  24. package/dist/actions/index.js +12 -0
  25. package/dist/actions/index.js.map +1 -0
  26. package/dist/actions/types.d.ts +399 -0
  27. package/dist/actions/types.js +8 -0
  28. package/dist/actions/types.js.map +1 -0
  29. package/dist/actions/validation.d.ts +14 -0
  30. package/dist/actions/validation.js +602 -0
  31. package/dist/actions/validation.js.map +1 -0
  32. package/dist/antiFlicker.js +1 -1
  33. package/dist/api.d.ts +40 -26
  34. package/dist/api.js +90 -59
  35. package/dist/api.js.map +1 -1
  36. package/dist/apps/AppContext.d.ts +31 -0
  37. package/dist/apps/AppContext.js +93 -0
  38. package/dist/apps/AppContext.js.map +1 -0
  39. package/dist/apps/AppLoader.d.ts +84 -0
  40. package/dist/apps/AppLoader.js +256 -0
  41. package/dist/apps/AppLoader.js.map +1 -0
  42. package/dist/apps/AppRegistry.d.ts +102 -0
  43. package/dist/apps/AppRegistry.js +317 -0
  44. package/dist/apps/AppRegistry.js.map +1 -0
  45. package/dist/apps/adaptive-chatbot/index.js +7 -0
  46. package/dist/apps/adaptive-chatbot/index.js.map +7 -0
  47. package/dist/apps/examples/gamification-app.example.d.ts +305 -0
  48. package/dist/apps/examples/gamification-app.example.js +329 -0
  49. package/dist/apps/examples/gamification-app.example.js.map +1 -0
  50. package/dist/apps/faq/index.js +11 -0
  51. package/dist/apps/faq/index.js.map +7 -0
  52. package/dist/apps/gamification/index.js +2 -0
  53. package/dist/apps/gamification/index.js.map +7 -0
  54. package/dist/apps/index.d.ts +15 -0
  55. package/dist/apps/index.js +17 -0
  56. package/dist/apps/index.js.map +1 -0
  57. package/dist/apps/nav/index.js +11 -0
  58. package/dist/apps/nav/index.js.map +7 -0
  59. package/dist/apps/types.d.ts +231 -0
  60. package/dist/apps/types.js +8 -0
  61. package/dist/apps/types.js.map +1 -0
  62. package/dist/blocks/data/ComparisonBlock.d.ts +1 -1
  63. package/dist/blocks/data/ComparisonBlock.js +40 -40
  64. package/dist/blocks/data/ComparisonBlock.js.map +1 -1
  65. package/dist/blocks/data/StatsBlock.d.ts +1 -1
  66. package/dist/blocks/data/StatsBlock.js +41 -41
  67. package/dist/blocks/data/StatsBlock.js.map +1 -1
  68. package/dist/blocks/data/index.d.ts +2 -2
  69. package/dist/blocks/data/index.js +2 -2
  70. package/dist/blocks/index.d.ts +5 -5
  71. package/dist/blocks/index.js +29 -29
  72. package/dist/blocks/index.js.map +1 -1
  73. package/dist/blocks/interactive/ChecklistBlock.d.ts +1 -1
  74. package/dist/blocks/interactive/ChecklistBlock.js +60 -60
  75. package/dist/blocks/interactive/ChecklistBlock.js.map +1 -1
  76. package/dist/blocks/interactive/RatingBlock.d.ts +1 -1
  77. package/dist/blocks/interactive/RatingBlock.js +75 -65
  78. package/dist/blocks/interactive/RatingBlock.js.map +1 -1
  79. package/dist/blocks/interactive/index.d.ts +2 -2
  80. package/dist/blocks/interactive/index.js +2 -2
  81. package/dist/blocks/notification/NotificationBlock.d.ts +2 -2
  82. package/dist/blocks/notification/NotificationBlock.js +67 -63
  83. package/dist/blocks/notification/NotificationBlock.js.map +1 -1
  84. package/dist/blocks/notification/index.d.ts +1 -1
  85. package/dist/blocks/notification/index.js +1 -1
  86. package/dist/bootstrap.d.ts +47 -9
  87. package/dist/bootstrap.js +237 -69
  88. package/dist/bootstrap.js.map +1 -1
  89. package/dist/components/ShadowCanvasOverlay.d.ts +6 -6
  90. package/dist/components/ShadowCanvasOverlay.js +144 -107
  91. package/dist/components/ShadowCanvasOverlay.js.map +1 -1
  92. package/dist/components/TileCard.d.ts +5 -5
  93. package/dist/components/TileCard.js +204 -154
  94. package/dist/components/TileCard.js.map +1 -1
  95. package/dist/components/TileWheel.d.ts +3 -3
  96. package/dist/components/TileWheel.js +7 -7
  97. package/dist/components/TileWheel.js.map +1 -1
  98. package/dist/config-validator.d.ts +49 -0
  99. package/dist/config-validator.js +173 -0
  100. package/dist/config-validator.js.map +1 -0
  101. package/dist/configFetcher.d.ts +2 -2
  102. package/dist/configFetcher.js +20 -8
  103. package/dist/configFetcher.js.map +1 -1
  104. package/dist/context/ContextManager.d.ts +66 -0
  105. package/dist/context/ContextManager.js +268 -0
  106. package/dist/context/ContextManager.js.map +1 -0
  107. package/dist/context/index.d.ts +7 -0
  108. package/dist/context/index.js +7 -0
  109. package/dist/context/index.js.map +1 -0
  110. package/dist/context/schema.d.ts +360 -0
  111. package/dist/context/schema.js +50 -0
  112. package/dist/context/schema.js.map +1 -0
  113. package/dist/context/types.d.ts +101 -0
  114. package/dist/context/types.js +8 -0
  115. package/dist/context/types.js.map +1 -0
  116. package/dist/decisions/engine.d.ts +43 -0
  117. package/dist/decisions/engine.js +112 -0
  118. package/dist/decisions/engine.js.map +1 -0
  119. package/dist/decisions/index.d.ts +9 -0
  120. package/dist/decisions/index.js +10 -0
  121. package/dist/decisions/index.js.map +1 -0
  122. package/dist/decisions/schema.d.ts +2166 -0
  123. package/dist/decisions/schema.js +143 -0
  124. package/dist/decisions/schema.js.map +1 -0
  125. package/dist/decisions/strategies/rules.d.ts +24 -0
  126. package/dist/decisions/strategies/rules.js +152 -0
  127. package/dist/decisions/strategies/rules.js.map +1 -0
  128. package/dist/decisions/strategies/score.d.ts +10 -0
  129. package/dist/decisions/strategies/score.js +29 -0
  130. package/dist/decisions/strategies/score.js.map +1 -0
  131. package/dist/decisions/types.d.ts +242 -0
  132. package/dist/decisions/types.js +2 -0
  133. package/dist/decisions/types.js.map +1 -0
  134. package/dist/earlyPatcher.d.ts +8 -20
  135. package/dist/earlyPatcher.js +13 -62
  136. package/dist/earlyPatcher.js.map +1 -1
  137. package/dist/editorLoader.d.ts +12 -0
  138. package/dist/editorLoader.js +132 -48
  139. package/dist/editorLoader.js.map +1 -1
  140. package/dist/events/EventBus.d.ts +59 -0
  141. package/dist/events/EventBus.js +152 -0
  142. package/dist/events/EventBus.js.map +1 -0
  143. package/dist/events/index.d.ts +9 -0
  144. package/dist/events/index.js +10 -0
  145. package/dist/events/index.js.map +1 -0
  146. package/dist/events/normalizers/canvas.d.ts +67 -0
  147. package/dist/events/normalizers/canvas.js +116 -0
  148. package/dist/events/normalizers/canvas.js.map +1 -0
  149. package/dist/events/normalizers/posthog.d.ts +53 -0
  150. package/dist/events/normalizers/posthog.js +163 -0
  151. package/dist/events/normalizers/posthog.js.map +1 -0
  152. package/dist/events/schema.d.ts +70 -0
  153. package/dist/events/schema.js +30 -0
  154. package/dist/events/schema.js.map +1 -0
  155. package/dist/events/types.d.ts +79 -0
  156. package/dist/events/types.js +49 -0
  157. package/dist/events/types.js.map +1 -0
  158. package/dist/experiments/adapters/growthbook.d.ts +4 -4
  159. package/dist/experiments/adapters/growthbook.js +5 -5
  160. package/dist/experiments/adapters/growthbook.js.map +1 -1
  161. package/dist/experiments/index.d.ts +3 -3
  162. package/dist/experiments/index.js +1 -1
  163. package/dist/experiments/registry.d.ts +2 -2
  164. package/dist/experiments/registry.js +2 -2
  165. package/dist/experiments/types.d.ts +5 -1
  166. package/dist/fetchers/cdnFetcher.d.ts +1 -1
  167. package/dist/fetchers/cdnFetcher.js +4 -8
  168. package/dist/fetchers/cdnFetcher.js.map +1 -1
  169. package/dist/fetchers/experimentsFetcher.d.ts +2 -2
  170. package/dist/fetchers/experimentsFetcher.js +7 -7
  171. package/dist/fetchers/experimentsFetcher.js.map +1 -1
  172. package/dist/fetchers/index.d.ts +3 -3
  173. package/dist/fetchers/index.js +2 -2
  174. package/dist/fetchers/index.js.map +1 -1
  175. package/dist/fetchers/registry.d.ts +1 -1
  176. package/dist/fetchers/registry.js +4 -4
  177. package/dist/fetchers/types.d.ts +1 -1
  178. package/dist/hooks/useCanvasOverlays.d.ts +8 -5
  179. package/dist/hooks/useCanvasOverlays.js +66 -17
  180. package/dist/hooks/useCanvasOverlays.js.map +1 -1
  181. package/dist/hooks/useHostPatches.d.ts +2 -2
  182. package/dist/hooks/useHostPatches.js +8 -8
  183. package/dist/hooks/useHostPatches.js.map +1 -1
  184. package/dist/hooks/useShadowCanvasConfig.d.ts +9 -9
  185. package/dist/hooks/useShadowCanvasConfig.js +24 -8
  186. package/dist/hooks/useShadowCanvasConfig.js.map +1 -1
  187. package/dist/hostPatcher/core/patcher.d.ts +1 -1
  188. package/dist/hostPatcher/core/patcher.js +18 -9
  189. package/dist/hostPatcher/core/patcher.js.map +1 -1
  190. package/dist/hostPatcher/core/sanitizer.js +24 -3
  191. package/dist/hostPatcher/core/sanitizer.js.map +1 -1
  192. package/dist/hostPatcher/policy/defaultPolicy.js +15 -5
  193. package/dist/hostPatcher/policy/defaultPolicy.js.map +1 -1
  194. package/dist/hostPatcher/utils/anchors.js +4 -6
  195. package/dist/hostPatcher/utils/anchors.js.map +1 -1
  196. package/dist/index.d.ts +34 -21
  197. package/dist/index.js +46 -19
  198. package/dist/index.js.map +1 -1
  199. package/dist/logger.d.ts +29 -0
  200. package/dist/logger.js +81 -0
  201. package/dist/logger.js.map +1 -0
  202. package/dist/metrics/index.d.ts +1 -1
  203. package/dist/metrics/index.js +1 -1
  204. package/dist/metrics/sessionMetrics.d.ts +1 -1
  205. package/dist/metrics/sessionMetrics.js +6 -6
  206. package/dist/overlays/fetcher.d.ts +2 -2
  207. package/dist/overlays/fetcher.js +4 -4
  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 +70 -23
  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 +10 -10
  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 +98 -98
  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 +110 -0
  239. package/dist/runtime.js +206 -0
  240. package/dist/runtime.js.map +1 -0
  241. package/dist/smart-canvas.esm.js +155 -78
  242. package/dist/smart-canvas.esm.js.map +4 -4
  243. package/dist/smart-canvas.js +44390 -37343
  244. package/dist/smart-canvas.js.map +4 -4
  245. package/dist/smart-canvas.min.js +156 -78
  246. package/dist/smart-canvas.min.js.map +4 -4
  247. package/dist/state/StateStore.d.ts +41 -0
  248. package/dist/state/StateStore.js +170 -0
  249. package/dist/state/StateStore.js.map +1 -0
  250. package/dist/state/helpers/cooldowns.d.ts +7 -0
  251. package/dist/state/helpers/cooldowns.js +31 -0
  252. package/dist/state/helpers/cooldowns.js.map +1 -0
  253. package/dist/state/helpers/dismissals.d.ts +7 -0
  254. package/dist/state/helpers/dismissals.js +34 -0
  255. package/dist/state/helpers/dismissals.js.map +1 -0
  256. package/dist/state/helpers/frequency.d.ts +8 -0
  257. package/dist/state/helpers/frequency.js +43 -0
  258. package/dist/state/helpers/frequency.js.map +1 -0
  259. package/dist/state/index.d.ts +7 -0
  260. package/dist/state/index.js +7 -0
  261. package/dist/state/index.js.map +1 -0
  262. package/dist/state/schema.d.ts +49 -0
  263. package/dist/state/schema.js +25 -0
  264. package/dist/state/schema.js.map +1 -0
  265. package/dist/state/types.d.ts +137 -0
  266. package/dist/state/types.js +9 -0
  267. package/dist/state/types.js.map +1 -0
  268. package/dist/store/example.d.ts +1 -0
  269. package/dist/store/example.js +43 -0
  270. package/dist/store/example.js.map +1 -0
  271. package/dist/store/mini-effector.d.ts +46 -0
  272. package/dist/store/mini-effector.js +88 -0
  273. package/dist/store/mini-effector.js.map +1 -0
  274. package/dist/surfaces/Surfaces.d.ts +11 -0
  275. package/dist/surfaces/Surfaces.js +361 -0
  276. package/dist/surfaces/Surfaces.js.map +1 -0
  277. package/dist/surfaces/index.d.ts +9 -0
  278. package/dist/surfaces/index.js +12 -0
  279. package/dist/surfaces/index.js.map +1 -0
  280. package/dist/surfaces/positioning.d.ts +50 -0
  281. package/dist/surfaces/positioning.js +228 -0
  282. package/dist/surfaces/positioning.js.map +1 -0
  283. package/dist/surfaces/types.d.ts +167 -0
  284. package/dist/surfaces/types.js +23 -0
  285. package/dist/surfaces/types.js.map +1 -0
  286. package/dist/telemetry/adapters/noop.d.ts +12 -0
  287. package/dist/telemetry/adapters/noop.js +42 -0
  288. package/dist/telemetry/adapters/noop.js.map +1 -0
  289. package/dist/telemetry/adapters/posthog.d.ts +9 -3
  290. package/dist/telemetry/adapters/posthog.js +36 -14
  291. package/dist/telemetry/adapters/posthog.js.map +1 -1
  292. package/dist/telemetry/index.d.ts +4 -3
  293. package/dist/telemetry/index.js +3 -2
  294. package/dist/telemetry/index.js.map +1 -1
  295. package/dist/telemetry/registry.d.ts +2 -2
  296. package/dist/telemetry/registry.js +4 -2
  297. package/dist/telemetry/registry.js.map +1 -1
  298. package/dist/telemetry/types.d.ts +1 -1
  299. package/dist/theme/ThemeProvider.d.ts +2 -2
  300. package/dist/theme/ThemeProvider.js +21 -21
  301. package/dist/theme/ThemeProvider.js.map +1 -1
  302. package/dist/theme/defaultTheme.d.ts +2 -2
  303. package/dist/theme/defaultTheme.js +111 -111
  304. package/dist/theme/defaultTheme.js.map +1 -1
  305. package/dist/theme/extractHostTheme.d.ts +1 -1
  306. package/dist/theme/extractHostTheme.js +42 -44
  307. package/dist/theme/extractHostTheme.js.map +1 -1
  308. package/dist/theme/index.d.ts +5 -5
  309. package/dist/theme/index.js +3 -3
  310. package/dist/theme/index.js.map +1 -1
  311. package/dist/theme/types.d.ts +2 -2
  312. package/dist/token.d.ts +2 -0
  313. package/dist/token.js +3 -6
  314. package/dist/token.js.map +1 -1
  315. package/dist/types-only.d.ts +32 -0
  316. package/dist/types-only.js +11 -0
  317. package/dist/types-only.js.map +1 -0
  318. package/dist/types.d.ts +95 -54
  319. package/dist/types.js +15 -2
  320. package/dist/types.js.map +1 -1
  321. package/dist/version.d.ts +13 -0
  322. package/dist/version.js +14 -0
  323. package/dist/version.js.map +1 -0
  324. package/dist/widgets/WidgetRegistry.d.ts +139 -0
  325. package/dist/widgets/WidgetRegistry.js +182 -0
  326. package/dist/widgets/WidgetRegistry.js.map +1 -0
  327. package/dist/widgets/index.d.ts +7 -0
  328. package/dist/widgets/index.js +7 -0
  329. package/dist/widgets/index.js.map +1 -0
  330. package/package.json +27 -11
  331. package/schema/canvas-config.schema.json +666 -227
  332. package/schema/runtime-context.schema.json +127 -0
package/dist/types.d.ts CHANGED
@@ -1,11 +1,25 @@
1
+ export { SDK_VERSION } from './version';
2
+ /**
3
+ * SDK schema version in Major.Minor format (e.g., "2.0", "2.1").
4
+ * Used for compatibility checking between SDK and backend configs.
5
+ * Sent in X-SDK-Schema-Version header.
6
+ *
7
+ * Bump rules:
8
+ * - Major: Breaking changes (field removal, type changes)
9
+ * - Minor: Backwards-compatible additions (new optional fields)
10
+ *
11
+ * @since 2.0.0
12
+ */
13
+ export declare const SDK_SCHEMA_VERSION = "2.0";
14
+ export type { ActionStep } from './actions/types';
1
15
  /**
2
16
  * Props passed to every tile component when mounted
3
17
  */
4
18
  export interface TileComponentProps {
5
19
  config: TileConfig;
6
20
  isExpanded: boolean;
7
- surface: "overlay" | "wheel";
8
- telemetry?: import("./telemetry/types").TelemetryClient;
21
+ surface: 'overlay' | 'wheel';
22
+ telemetry?: import('./telemetry/types').TelemetryClient;
9
23
  }
10
24
  /**
11
25
  * Interface for registering custom tile components
@@ -16,15 +30,15 @@ export interface TileComponent {
16
30
  /**
17
31
  * All available block types organized by category
18
32
  */
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";
33
+ export type NotificationBlockType = 'alert' | 'success' | 'warning' | 'info' | 'error';
34
+ export type MediaBlockType = 'video' | 'gallery' | 'code';
35
+ export type InteractiveBlockType = 'form' | 'rating' | 'progress' | 'survey' | 'checklist';
36
+ export type DataBlockType = 'stats' | 'comparison' | 'chart' | 'table';
37
+ export type LegacyBlockType = 'text' | 'metric' | 'chatbot' | 'embed';
24
38
  /**
25
39
  * Union of all block types
26
40
  */
27
- export type BlockType = NotificationBlockType | MediaBlockType | InteractiveBlockType | DataBlockType | LegacyBlockType | "custom";
41
+ export type BlockType = NotificationBlockType | MediaBlockType | InteractiveBlockType | DataBlockType | LegacyBlockType | 'custom';
28
42
  export interface NotificationContentBase {
29
43
  title: string;
30
44
  body?: string;
@@ -33,49 +47,49 @@ export interface NotificationContentBase {
33
47
  timestamp?: string;
34
48
  }
35
49
  export interface AlertContent extends NotificationContentBase {
36
- type: "alert";
37
- severity?: "low" | "medium" | "high" | "critical";
50
+ type: 'alert';
51
+ severity?: 'low' | 'medium' | 'high' | 'critical';
38
52
  }
39
53
  export interface SuccessContent extends NotificationContentBase {
40
- type: "success";
54
+ type: 'success';
41
55
  confetti?: boolean;
42
56
  }
43
57
  export interface WarningContent extends NotificationContentBase {
44
- type: "warning";
58
+ type: 'warning';
45
59
  countdown?: number;
46
60
  }
47
61
  export interface InfoContent extends NotificationContentBase {
48
- type: "info";
62
+ type: 'info';
49
63
  learnMoreUrl?: string;
50
64
  }
51
65
  export interface ErrorContent extends NotificationContentBase {
52
- type: "error";
66
+ type: 'error';
53
67
  errorCode?: string;
54
68
  retryable?: boolean;
55
69
  }
56
70
  export type NotificationContent = AlertContent | SuccessContent | WarningContent | InfoContent | ErrorContent;
57
71
  export interface VideoContent {
58
- type: "video";
72
+ type: 'video';
59
73
  src: string;
60
- provider?: "youtube" | "vimeo" | "custom";
74
+ provider?: 'youtube' | 'vimeo' | 'custom';
61
75
  poster?: string;
62
76
  autoplay?: boolean;
63
77
  muted?: boolean;
64
78
  loop?: boolean;
65
- aspectRatio?: "16:9" | "4:3" | "1:1" | "9:16";
79
+ aspectRatio?: '16:9' | '4:3' | '1:1' | '9:16';
66
80
  }
67
81
  export interface GalleryContent {
68
- type: "gallery";
82
+ type: 'gallery';
69
83
  images: Array<{
70
84
  src: string;
71
85
  alt?: string;
72
86
  caption?: string;
73
87
  }>;
74
- layout?: "carousel" | "grid" | "masonry";
88
+ layout?: 'carousel' | 'grid' | 'masonry';
75
89
  columns?: 2 | 3 | 4;
76
90
  }
77
91
  export interface CodeContent {
78
- type: "code";
92
+ type: 'code';
79
93
  code: string;
80
94
  language?: string;
81
95
  lineNumbers?: boolean;
@@ -86,7 +100,7 @@ export interface CodeContent {
86
100
  export type MediaContent = VideoContent | GalleryContent | CodeContent;
87
101
  export interface FormField {
88
102
  id: string;
89
- type: "text" | "email" | "select" | "checkbox" | "radio" | "textarea";
103
+ type: 'text' | 'email' | 'select' | 'checkbox' | 'radio' | 'textarea';
90
104
  label: string;
91
105
  placeholder?: string;
92
106
  required?: boolean;
@@ -97,21 +111,21 @@ export interface FormField {
97
111
  defaultValue?: string | boolean;
98
112
  }
99
113
  export interface FormContent {
100
- type: "form";
114
+ type: 'form';
101
115
  fields: FormField[];
102
116
  submitLabel?: string;
103
117
  submitActionId?: string;
104
118
  }
105
119
  export interface RatingContent {
106
- type: "rating";
107
- variant: "stars" | "thumbs" | "nps" | "emoji";
120
+ type: 'rating';
121
+ variant: 'stars' | 'thumbs' | 'nps' | 'emoji';
108
122
  question?: string;
109
123
  maxValue?: number;
110
124
  submitActionId?: string;
111
125
  }
112
126
  export interface ProgressContent {
113
- type: "progress";
114
- variant: "bar" | "steps" | "circular";
127
+ type: 'progress';
128
+ variant: 'bar' | 'steps' | 'circular';
115
129
  value: number;
116
130
  max?: number;
117
131
  steps?: Array<{
@@ -126,7 +140,7 @@ export interface SurveyChoice {
126
140
  icon?: string;
127
141
  }
128
142
  export interface SurveyContent {
129
- type: "survey";
143
+ type: 'survey';
130
144
  question: string;
131
145
  choices: SurveyChoice[];
132
146
  multiSelect?: boolean;
@@ -143,19 +157,19 @@ export interface ChecklistItem {
143
157
  completed?: boolean;
144
158
  }
145
159
  export interface ChecklistContent {
146
- type: "checklist";
160
+ type: 'checklist';
147
161
  items: ChecklistItem[];
148
162
  title?: string;
149
163
  showProgress?: boolean;
150
164
  }
151
165
  export type InteractiveContent = FormContent | RatingContent | ProgressContent | SurveyContent | ChecklistContent;
152
166
  export interface TrendIndicator {
153
- direction: "up" | "down" | "neutral";
167
+ direction: 'up' | 'down' | 'neutral';
154
168
  value: string;
155
169
  timeframe?: string;
156
170
  }
157
171
  export interface StatsContent {
158
- type: "stats";
172
+ type: 'stats';
159
173
  value: string;
160
174
  label: string;
161
175
  trend?: TrendIndicator;
@@ -170,15 +184,15 @@ export interface ComparisonItem {
170
184
  icon?: string;
171
185
  }
172
186
  export interface ComparisonContent {
173
- type: "comparison";
187
+ type: 'comparison';
174
188
  items: ComparisonItem[];
175
- layout?: "grid" | "list" | "table";
189
+ layout?: 'grid' | 'list' | 'table';
176
190
  columns?: 2 | 3 | 4;
177
191
  highlightBest?: boolean;
178
192
  }
179
193
  export interface ChartContent {
180
- type: "chart";
181
- chartType: "bar" | "line" | "pie" | "donut";
194
+ type: 'chart';
195
+ chartType: 'bar' | 'line' | 'pie' | 'donut';
182
196
  data: Array<{
183
197
  label: string;
184
198
  value: number;
@@ -195,7 +209,7 @@ export interface TableColumn {
195
209
  width?: string;
196
210
  }
197
211
  export interface TableContent {
198
- type: "table";
212
+ type: 'table';
199
213
  columns: TableColumn[];
200
214
  rows: Array<Record<string, string | number>>;
201
215
  sortable?: boolean;
@@ -206,12 +220,12 @@ export type DataContent = StatsContent | ComparisonContent | ChartContent | Tabl
206
220
  /**
207
221
  * Grid width: "full" = spans both columns, "half" = one column
208
222
  */
209
- export type TileSize = "full" | "half";
223
+ export type TileSize = 'full' | 'half';
210
224
  /**
211
225
  * Built-in tile types (convenience components we ship)
212
226
  * @deprecated Use BlockType instead
213
227
  */
214
- export type BuiltInTileType = "text" | "metric" | "chatbot" | "embed";
228
+ export type BuiltInTileType = 'text' | 'metric' | 'chatbot' | 'embed';
215
229
  /**
216
230
  * Content configuration for built-in tile types
217
231
  * @deprecated Use specific content types (NotificationContent, MediaContent, etc.)
@@ -229,7 +243,7 @@ export interface BuiltInTileContent {
229
243
  * Content configuration for custom tile components
230
244
  */
231
245
  export interface CustomTileContent {
232
- type: "custom";
246
+ type: 'custom';
233
247
  component: string;
234
248
  props?: Record<string, unknown>;
235
249
  actions?: TileAction[];
@@ -249,7 +263,7 @@ export interface TileAction {
249
263
  label: string;
250
264
  href?: string;
251
265
  onClickId?: string;
252
- style?: "primary" | "secondary";
266
+ style?: 'primary' | 'secondary';
253
267
  }
254
268
  /**
255
269
  * Visual styling for tile chrome
@@ -261,6 +275,7 @@ export interface TileStyle {
261
275
  }
262
276
  /**
263
277
  * Experiment targeting for A/B tests
278
+ * @deprecated Use ActivationConfig with DecisionStrategy instead
264
279
  */
265
280
  export interface TileExperiment {
266
281
  featureKey?: string;
@@ -268,6 +283,7 @@ export interface TileExperiment {
268
283
  variationValue?: string | number | boolean;
269
284
  predicate?: (value: unknown) => boolean;
270
285
  }
286
+ export type { ActivationConfig, RouteFilter, DecisionStrategy } from './decisions/types';
271
287
  /**
272
288
  * Full tile configuration
273
289
  */
@@ -283,13 +299,18 @@ export interface TileConfig {
283
299
  defaultExpanded?: boolean;
284
300
  content: TileContent;
285
301
  style?: TileStyle;
302
+ /** @deprecated Use activation.strategy instead */
286
303
  experiment?: TileExperiment;
287
304
  analyticsKey?: string;
305
+ /**
306
+ * Activation configuration for conditional rendering.
307
+ * Replaces the experiment field with more flexible context-aware decisions.
308
+ */
309
+ activation?: import('./decisions/types').ActivationConfig;
288
310
  }
289
- import type { Patch } from "./hostPatcher/core/types";
311
+ import type { ActionStep } from './actions/types';
290
312
  /**
291
313
  * Theme configuration for the SmartCanvas overlay.
292
- * These values are typically set from workspace settings after style selection.
293
314
  */
294
315
  export interface CanvasThemeConfig {
295
316
  name?: string;
@@ -302,35 +323,55 @@ export interface CanvasThemeConfig {
302
323
  borderRadius?: string;
303
324
  position?: 'left' | 'right';
304
325
  }
326
+ /**
327
+ * Launcher button configuration.
328
+ */
305
329
  export interface LauncherConfig {
306
- /** Label shown on the launcher button (default: "Adaptives") */
307
330
  label?: string;
308
- /** Whether to animate the launcher to draw attention */
309
331
  animate?: boolean;
310
- /** Animation style: "pulse" (default), "bounce", "glow" */
311
- animationStyle?: "pulse" | "bounce" | "glow";
332
+ animationStyle?: 'pulse' | 'bounce' | 'glow';
312
333
  }
334
+ /**
335
+ * Route filtering - control where canvas appears.
336
+ */
313
337
  export interface RoutesConfig {
314
- /** Routes where the canvas should NOT appear (e.g., ["/login", "/signup"]) */
315
338
  exclude?: string[];
316
- /** If specified, canvas ONLY appears on these routes */
317
339
  include?: string[];
318
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
+ */
319
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 */
320
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 */
321
365
  fetchedAt: string;
366
+ /** Optional version string for cache invalidation */
322
367
  configVersion?: string;
368
+ /** Display title for the canvas */
323
369
  canvasTitle?: string;
324
- patches?: Patch[];
325
- /** @deprecated Use overlayRecipes instead */
326
- overlayRecipe?: import('./overlays/types').CanvasRecipe;
327
- /** Multiple overlay recipes (tours) */
328
- overlayRecipes?: import('./overlays/types').CanvasRecipe[];
329
- /** SmartCanvas theme configuration from workspace settings */
370
+ /** Theme configuration */
330
371
  theme?: CanvasThemeConfig;
331
372
  /** Launcher button configuration */
332
373
  launcher?: LauncherConfig;
333
- /** Route filtering - control where canvas appears */
374
+ /** Route filtering */
334
375
  routes?: RoutesConfig;
335
376
  }
336
377
  export type CanvasConfigFetcher = () => Promise<CanvasConfigResponse>;
package/dist/types.js CHANGED
@@ -1,5 +1,18 @@
1
1
  // =============================================================================
2
- // TILE COMPONENT API
2
+ // SDK VERSION CONSTANTS
3
3
  // =============================================================================
4
- export {};
4
+ // Re-export SDK_VERSION from the auto-generated version file
5
+ export { SDK_VERSION } from './version';
6
+ /**
7
+ * SDK schema version in Major.Minor format (e.g., "2.0", "2.1").
8
+ * Used for compatibility checking between SDK and backend configs.
9
+ * Sent in X-SDK-Schema-Version header.
10
+ *
11
+ * Bump rules:
12
+ * - Major: Breaking changes (field removal, type changes)
13
+ * - Minor: Backwards-compatible additions (new optional fields)
14
+ *
15
+ * @since 2.0.0
16
+ */
17
+ export const SDK_SCHEMA_VERSION = '2.0';
5
18
  //# 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;AAEhF,6DAA6D;AAC7D,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-canary.1";
@@ -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-canary.1';
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,gBAAgB,CAAC"}
@@ -0,0 +1,139 @@
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
+ constructor();
76
+ /**
77
+ * Register a widget.
78
+ *
79
+ * @param id - The widget ID (e.g., "gamification:leaderboard")
80
+ * @param widget - The widget component
81
+ * @param source - The source app ID (for tracking)
82
+ * @param metadata - Optional metadata about the widget
83
+ */
84
+ register(id: string, widget: MountableWidget, source?: string, metadata?: WidgetRegistration['metadata']): void;
85
+ /**
86
+ * Unregister a widget.
87
+ *
88
+ * @param id - The widget ID to unregister
89
+ * @returns true if the widget was unregistered, false if not found or built-in
90
+ */
91
+ unregister(id: string): boolean;
92
+ /**
93
+ * Unregister all widgets from a specific source.
94
+ *
95
+ * @param source - The source app ID
96
+ */
97
+ unregisterBySource(source: string): void;
98
+ /**
99
+ * Get a widget by ID.
100
+ */
101
+ get(id: string): MountableWidget | undefined;
102
+ /**
103
+ * Get the full registration for a widget.
104
+ */
105
+ getRegistration(id: string): WidgetRegistration | undefined;
106
+ /**
107
+ * Check if a widget exists.
108
+ */
109
+ has(id: string): boolean;
110
+ /**
111
+ * Mount a widget into a container.
112
+ *
113
+ * @param id - The widget ID
114
+ * @param container - The DOM element to mount into
115
+ * @param config - Configuration/props for the widget
116
+ * @returns A handle for managing the mounted widget
117
+ */
118
+ mount(id: string, container: HTMLElement, config?: Record<string, unknown>): MountedWidgetHandle;
119
+ /**
120
+ * List all registered widget IDs.
121
+ */
122
+ list(): string[];
123
+ /**
124
+ * List all registrations.
125
+ */
126
+ listRegistrations(): WidgetRegistration[];
127
+ /**
128
+ * Get all widgets from a specific source.
129
+ */
130
+ getBySource(source: string): WidgetRegistration[];
131
+ /**
132
+ * Clean up all mounted widgets.
133
+ */
134
+ destroy(): void;
135
+ }
136
+ /**
137
+ * Default singleton instance of WidgetRegistry.
138
+ */
139
+ export declare const widgetRegistry: WidgetRegistry;