@syntrologie/runtime-sdk 2.0.0 → 2.0.1-canary.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 (280) hide show
  1. package/CAPABILITIES.md +232 -138
  2. package/README.md +76 -57
  3. package/dist/RuntimeProvider.d.ts +6 -6
  4. package/dist/RuntimeProvider.js +2 -3
  5. package/dist/RuntimeProvider.js.map +1 -1
  6. package/dist/SmartCanvasApp.d.ts +8 -8
  7. package/dist/SmartCanvasApp.js +16 -18
  8. package/dist/SmartCanvasApp.js.map +1 -1
  9. package/dist/SmartCanvasElement.d.ts +5 -5
  10. package/dist/SmartCanvasElement.js +13 -13
  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 +1 -1
  15. package/dist/actions/ActionEngine.js +24 -24
  16. package/dist/actions/ActionEngine.js.map +1 -1
  17. package/dist/actions/executors/index.d.ts +6 -6
  18. package/dist/actions/executors/index.js +22 -22
  19. package/dist/actions/executors/index.js.map +1 -1
  20. package/dist/actions/executors/tour.d.ts +1 -1
  21. package/dist/actions/executors/tour.js +19 -19
  22. package/dist/actions/executors/tour.js.map +1 -1
  23. package/dist/actions/index.d.ts +5 -5
  24. package/dist/actions/index.js +3 -3
  25. package/dist/actions/index.js.map +1 -1
  26. package/dist/actions/types.d.ts +37 -37
  27. package/dist/actions/validation.d.ts +1 -1
  28. package/dist/actions/validation.js +195 -196
  29. package/dist/actions/validation.js.map +1 -1
  30. package/dist/antiFlicker.js +1 -1
  31. package/dist/api.d.ts +10 -10
  32. package/dist/api.js +11 -11
  33. package/dist/api.js.map +1 -1
  34. package/dist/apps/AppContext.d.ts +2 -2
  35. package/dist/apps/AppContext.js +1 -1
  36. package/dist/apps/AppContext.js.map +1 -1
  37. package/dist/apps/AppLoader.d.ts +2 -2
  38. package/dist/apps/AppLoader.js +24 -24
  39. package/dist/apps/AppLoader.js.map +1 -1
  40. package/dist/apps/AppRegistry.d.ts +2 -2
  41. package/dist/apps/AppRegistry.js +28 -28
  42. package/dist/apps/AppRegistry.js.map +1 -1
  43. package/dist/apps/adaptive-chatbot/index.js +7 -0
  44. package/dist/apps/adaptive-chatbot/index.js.map +7 -0
  45. package/dist/apps/examples/gamification-app.example.d.ts +3 -3
  46. package/dist/apps/examples/gamification-app.example.js +94 -94
  47. package/dist/apps/examples/gamification-app.example.js.map +1 -1
  48. package/dist/apps/faq/index.js.map +3 -3
  49. package/dist/apps/gamification/index.js.map +3 -3
  50. package/dist/apps/index.d.ts +10 -10
  51. package/dist/apps/index.js +6 -6
  52. package/dist/apps/nav/index.js.map +3 -3
  53. package/dist/apps/types.d.ts +10 -10
  54. package/dist/blocks/data/ComparisonBlock.d.ts +1 -1
  55. package/dist/blocks/data/ComparisonBlock.js +40 -40
  56. package/dist/blocks/data/ComparisonBlock.js.map +1 -1
  57. package/dist/blocks/data/StatsBlock.d.ts +1 -1
  58. package/dist/blocks/data/StatsBlock.js +41 -41
  59. package/dist/blocks/data/StatsBlock.js.map +1 -1
  60. package/dist/blocks/data/index.d.ts +2 -2
  61. package/dist/blocks/data/index.js +2 -2
  62. package/dist/blocks/index.d.ts +5 -5
  63. package/dist/blocks/index.js +29 -29
  64. package/dist/blocks/index.js.map +1 -1
  65. package/dist/blocks/interactive/ChecklistBlock.d.ts +1 -1
  66. package/dist/blocks/interactive/ChecklistBlock.js +60 -60
  67. package/dist/blocks/interactive/ChecklistBlock.js.map +1 -1
  68. package/dist/blocks/interactive/RatingBlock.d.ts +1 -1
  69. package/dist/blocks/interactive/RatingBlock.js +75 -65
  70. package/dist/blocks/interactive/RatingBlock.js.map +1 -1
  71. package/dist/blocks/interactive/index.d.ts +2 -2
  72. package/dist/blocks/interactive/index.js +2 -2
  73. package/dist/blocks/notification/NotificationBlock.d.ts +2 -2
  74. package/dist/blocks/notification/NotificationBlock.js +67 -63
  75. package/dist/blocks/notification/NotificationBlock.js.map +1 -1
  76. package/dist/blocks/notification/index.d.ts +1 -1
  77. package/dist/blocks/notification/index.js +1 -1
  78. package/dist/bootstrap.d.ts +10 -10
  79. package/dist/bootstrap.js +54 -40
  80. package/dist/bootstrap.js.map +1 -1
  81. package/dist/components/ShadowCanvasOverlay.d.ts +6 -6
  82. package/dist/components/ShadowCanvasOverlay.js +117 -107
  83. package/dist/components/ShadowCanvasOverlay.js.map +1 -1
  84. package/dist/components/TileCard.d.ts +5 -5
  85. package/dist/components/TileCard.js +174 -143
  86. package/dist/components/TileCard.js.map +1 -1
  87. package/dist/components/TileWheel.d.ts +3 -3
  88. package/dist/components/TileWheel.js +7 -7
  89. package/dist/components/TileWheel.js.map +1 -1
  90. package/dist/configFetcher.d.ts +2 -2
  91. package/dist/configFetcher.js +10 -7
  92. package/dist/configFetcher.js.map +1 -1
  93. package/dist/context/ContextManager.d.ts +3 -3
  94. package/dist/context/ContextManager.js +15 -15
  95. package/dist/context/ContextManager.js.map +1 -1
  96. package/dist/context/index.d.ts +4 -4
  97. package/dist/context/index.js +3 -3
  98. package/dist/context/schema.d.ts +1 -1
  99. package/dist/context/schema.js +1 -1
  100. package/dist/decisions/engine.d.ts +5 -5
  101. package/dist/decisions/engine.js +13 -13
  102. package/dist/decisions/index.d.ts +6 -6
  103. package/dist/decisions/index.js +5 -5
  104. package/dist/decisions/schema.d.ts +1 -1
  105. package/dist/decisions/schema.js +20 -20
  106. package/dist/decisions/strategies/rules.d.ts +1 -1
  107. package/dist/decisions/strategies/rules.js +24 -24
  108. package/dist/decisions/strategies/rules.js.map +1 -1
  109. package/dist/decisions/strategies/score.d.ts +1 -1
  110. package/dist/decisions/strategies/score.js +3 -3
  111. package/dist/decisions/types.d.ts +19 -19
  112. package/dist/editorLoader.js +20 -20
  113. package/dist/editorLoader.js.map +1 -1
  114. package/dist/events/EventBus.d.ts +3 -3
  115. package/dist/events/EventBus.js +5 -7
  116. package/dist/events/EventBus.js.map +1 -1
  117. package/dist/events/index.d.ts +6 -6
  118. package/dist/events/index.js +5 -5
  119. package/dist/events/normalizers/canvas.d.ts +2 -2
  120. package/dist/events/normalizers/canvas.js +3 -3
  121. package/dist/events/normalizers/canvas.js.map +1 -1
  122. package/dist/events/normalizers/posthog.d.ts +1 -1
  123. package/dist/events/normalizers/posthog.js +34 -27
  124. package/dist/events/normalizers/posthog.js.map +1 -1
  125. package/dist/events/schema.d.ts +1 -1
  126. package/dist/events/schema.js +2 -2
  127. package/dist/events/types.d.ts +1 -1
  128. package/dist/events/types.js +27 -27
  129. package/dist/experiments/adapters/growthbook.d.ts +4 -4
  130. package/dist/experiments/adapters/growthbook.js +5 -5
  131. package/dist/experiments/adapters/growthbook.js.map +1 -1
  132. package/dist/experiments/index.d.ts +3 -3
  133. package/dist/experiments/index.js +1 -1
  134. package/dist/experiments/registry.d.ts +2 -2
  135. package/dist/experiments/registry.js +2 -2
  136. package/dist/experiments/types.d.ts +5 -1
  137. package/dist/fetchers/cdnFetcher.d.ts +1 -1
  138. package/dist/fetchers/cdnFetcher.js +4 -8
  139. package/dist/fetchers/cdnFetcher.js.map +1 -1
  140. package/dist/fetchers/experimentsFetcher.d.ts +2 -2
  141. package/dist/fetchers/experimentsFetcher.js +7 -7
  142. package/dist/fetchers/experimentsFetcher.js.map +1 -1
  143. package/dist/fetchers/index.d.ts +3 -3
  144. package/dist/fetchers/index.js +2 -2
  145. package/dist/fetchers/index.js.map +1 -1
  146. package/dist/fetchers/registry.d.ts +1 -1
  147. package/dist/fetchers/registry.js +4 -4
  148. package/dist/fetchers/types.d.ts +1 -1
  149. package/dist/hooks/useCanvasOverlays.d.ts +5 -5
  150. package/dist/hooks/useCanvasOverlays.js +15 -13
  151. package/dist/hooks/useCanvasOverlays.js.map +1 -1
  152. package/dist/hooks/useHostPatches.d.ts +2 -2
  153. package/dist/hooks/useHostPatches.js +8 -8
  154. package/dist/hooks/useHostPatches.js.map +1 -1
  155. package/dist/hooks/useShadowCanvasConfig.d.ts +3 -3
  156. package/dist/hooks/useShadowCanvasConfig.js +5 -2
  157. package/dist/hooks/useShadowCanvasConfig.js.map +1 -1
  158. package/dist/hostPatcher/core/patcher.d.ts +1 -1
  159. package/dist/hostPatcher/core/patcher.js +18 -9
  160. package/dist/hostPatcher/core/patcher.js.map +1 -1
  161. package/dist/hostPatcher/core/sanitizer.js +24 -3
  162. package/dist/hostPatcher/core/sanitizer.js.map +1 -1
  163. package/dist/hostPatcher/policy/defaultPolicy.js +15 -5
  164. package/dist/hostPatcher/policy/defaultPolicy.js.map +1 -1
  165. package/dist/hostPatcher/utils/anchors.js +4 -6
  166. package/dist/hostPatcher/utils/anchors.js.map +1 -1
  167. package/dist/index.d.ts +32 -32
  168. package/dist/index.js +29 -29
  169. package/dist/index.js.map +1 -1
  170. package/dist/metrics/index.d.ts +1 -1
  171. package/dist/metrics/index.js +1 -1
  172. package/dist/metrics/sessionMetrics.d.ts +1 -1
  173. package/dist/metrics/sessionMetrics.js +6 -6
  174. package/dist/overlays/fetcher.d.ts +2 -2
  175. package/dist/overlays/fetcher.js +4 -4
  176. package/dist/overlays/recipeRegistry.js +2 -2
  177. package/dist/overlays/recipeRegistry.js.map +1 -1
  178. package/dist/overlays/runtime/anchor/resolve.js +1 -1
  179. package/dist/overlays/runtime/anchor/resolve.js.map +1 -1
  180. package/dist/overlays/runtime/index.d.ts +7 -7
  181. package/dist/overlays/runtime/index.js +7 -7
  182. package/dist/overlays/runtime/overlay/highlight.js +39 -39
  183. package/dist/overlays/runtime/overlay/highlight.js.map +1 -1
  184. package/dist/overlays/runtime/overlay/modal.js +5 -5
  185. package/dist/overlays/runtime/overlay/modal.js.map +1 -1
  186. package/dist/overlays/runtime/overlay/root.js +1 -1
  187. package/dist/overlays/runtime/overlay/runner.js +70 -23
  188. package/dist/overlays/runtime/overlay/runner.js.map +1 -1
  189. package/dist/overlays/runtime/overlay/tooltip.d.ts +1 -1
  190. package/dist/overlays/runtime/overlay/tooltip.js +10 -10
  191. package/dist/overlays/runtime/overlay/tooltip.js.map +1 -1
  192. package/dist/overlays/runtime/utils/dom.js +4 -1
  193. package/dist/overlays/runtime/utils/dom.js.map +1 -1
  194. package/dist/overlays/schema.js +12 -8
  195. package/dist/overlays/schema.js.map +1 -1
  196. package/dist/react.d.ts +7 -7
  197. package/dist/react.js +4 -4
  198. package/dist/react.js.map +1 -1
  199. package/dist/render/RenderContext.d.ts +2 -2
  200. package/dist/render/RenderContext.js +5 -5
  201. package/dist/render/RenderContext.js.map +1 -1
  202. package/dist/render/index.d.ts +3 -3
  203. package/dist/render/index.js +1 -1
  204. package/dist/render/types.d.ts +4 -4
  205. package/dist/runtime.d.ts +12 -12
  206. package/dist/runtime.js +20 -20
  207. package/dist/runtime.js.map +1 -1
  208. package/dist/smart-canvas.esm.js +16 -16
  209. package/dist/smart-canvas.esm.js.map +4 -4
  210. package/dist/smart-canvas.js +644 -491
  211. package/dist/smart-canvas.js.map +4 -4
  212. package/dist/smart-canvas.min.js +15 -15
  213. package/dist/smart-canvas.min.js.map +4 -4
  214. package/dist/state/StateStore.d.ts +1 -1
  215. package/dist/state/StateStore.js +9 -9
  216. package/dist/state/StateStore.js.map +1 -1
  217. package/dist/state/helpers/cooldowns.d.ts +1 -1
  218. package/dist/state/helpers/cooldowns.js +1 -1
  219. package/dist/state/helpers/dismissals.d.ts +1 -1
  220. package/dist/state/helpers/dismissals.js +1 -1
  221. package/dist/state/helpers/frequency.d.ts +1 -1
  222. package/dist/state/helpers/frequency.js +1 -1
  223. package/dist/state/index.d.ts +4 -4
  224. package/dist/state/index.js +3 -3
  225. package/dist/state/schema.d.ts +1 -1
  226. package/dist/state/schema.js +1 -1
  227. package/dist/store/example.js +13 -13
  228. package/dist/store/example.js.map +1 -1
  229. package/dist/store/mini-effector.js +6 -8
  230. package/dist/store/mini-effector.js.map +1 -1
  231. package/dist/surfaces/Surfaces.d.ts +1 -1
  232. package/dist/surfaces/Surfaces.js +25 -25
  233. package/dist/surfaces/Surfaces.js.map +1 -1
  234. package/dist/surfaces/index.d.ts +4 -4
  235. package/dist/surfaces/index.js +3 -3
  236. package/dist/surfaces/positioning.d.ts +2 -2
  237. package/dist/surfaces/positioning.js +74 -77
  238. package/dist/surfaces/positioning.js.map +1 -1
  239. package/dist/surfaces/types.d.ts +9 -9
  240. package/dist/surfaces/types.js +7 -7
  241. package/dist/surfaces/types.js.map +1 -1
  242. package/dist/telemetry/adapters/noop.d.ts +12 -0
  243. package/dist/telemetry/adapters/noop.js +42 -0
  244. package/dist/telemetry/adapters/noop.js.map +1 -0
  245. package/dist/telemetry/adapters/posthog.d.ts +2 -2
  246. package/dist/telemetry/adapters/posthog.js +29 -16
  247. package/dist/telemetry/adapters/posthog.js.map +1 -1
  248. package/dist/telemetry/index.d.ts +4 -3
  249. package/dist/telemetry/index.js +3 -2
  250. package/dist/telemetry/index.js.map +1 -1
  251. package/dist/telemetry/registry.d.ts +2 -2
  252. package/dist/telemetry/registry.js +4 -2
  253. package/dist/telemetry/registry.js.map +1 -1
  254. package/dist/telemetry/types.d.ts +1 -1
  255. package/dist/theme/ThemeProvider.d.ts +2 -2
  256. package/dist/theme/ThemeProvider.js +21 -21
  257. package/dist/theme/ThemeProvider.js.map +1 -1
  258. package/dist/theme/defaultTheme.d.ts +2 -2
  259. package/dist/theme/defaultTheme.js +111 -111
  260. package/dist/theme/defaultTheme.js.map +1 -1
  261. package/dist/theme/extractHostTheme.d.ts +1 -1
  262. package/dist/theme/extractHostTheme.js +42 -44
  263. package/dist/theme/extractHostTheme.js.map +1 -1
  264. package/dist/theme/index.d.ts +5 -5
  265. package/dist/theme/index.js +3 -3
  266. package/dist/theme/index.js.map +1 -1
  267. package/dist/theme/types.d.ts +2 -2
  268. package/dist/token.js +3 -6
  269. package/dist/token.js.map +1 -1
  270. package/dist/types-only.d.ts +1 -1
  271. package/dist/types.d.ts +43 -43
  272. package/dist/widgets/WidgetRegistry.d.ts +2 -2
  273. package/dist/widgets/WidgetRegistry.js +11 -11
  274. package/dist/widgets/WidgetRegistry.js.map +1 -1
  275. package/dist/widgets/index.d.ts +2 -2
  276. package/dist/widgets/index.js +1 -1
  277. package/dist/widgets/index.js.map +1 -1
  278. package/package.json +4 -2
  279. package/schema/canvas-config.schema.json +51 -7
  280. package/schema/runtime-context.schema.json +1 -5
package/CAPABILITIES.md CHANGED
@@ -67,6 +67,7 @@ Change a page header when the element is visible:
67
67
 
68
68
  The SDK includes the following adaptive packages, each providing specific capabilities:
69
69
 
70
+ - [@syntrologie/app-chatbot](#syntrologieapp-chatbot)
70
71
  - [@syntrologie/app-content](#syntrologieapp-content)
71
72
  - [@syntrologie/app-faq](#syntrologieapp-faq)
72
73
  - [@syntrologie/app-gamification](#syntrologieapp-gamification)
@@ -74,6 +75,85 @@ The SDK includes the following adaptive packages, each providing specific capabi
74
75
  - [@syntrologie/app-navigation](#syntrologieapp-navigation)
75
76
  - [@syntrologie/app-overlays](#syntrologieapp-overlays)
76
77
 
78
+ ---
79
+
80
+ # @syntrologie/app-chatbot
81
+
82
+ AI chat assistant widget with action execution capabilities.
83
+
84
+ ## Widgets
85
+
86
+ ### adaptive-chatbot:assistant
87
+
88
+ Mounts an AI-powered chat assistant that connects to a backend LLM endpoint. The assistant can parse action instructions from the LLM response and execute them on the page via the runtime's ActionEngine.
89
+
90
+ **Tile config example:**
91
+
92
+ ```json
93
+ {
94
+ "id": "chatbot-assistant",
95
+ "title": "Ask Assistant",
96
+ "content": {
97
+ "type": "custom",
98
+ "component": "adaptive-chatbot:assistant",
99
+ "props": {
100
+ "backendUrl": "/api/chat/message",
101
+ "mlflowRunId": "abc123",
102
+ "greeting": "Hi! How can I help?"
103
+ }
104
+ },
105
+ "size": "full",
106
+ "defaultExpanded": true
107
+ }
108
+ ```
109
+
110
+ ### Config Props
111
+
112
+ | Property | Type | Required | Default | Description |
113
+ | ------------- | ------ | -------- | --------------------- | --------------------------------------- |
114
+ | `backendUrl` | string | Yes | — | URL for the chat API endpoint |
115
+ | `mlflowRunId` | string | No | — | MLflow run ID for experiment tracking |
116
+ | `greeting` | string | No | "Hi! How can I help?" | Initial greeting message |
117
+ | `maxHistory` | number | No | 20 | Max messages sent as history to backend |
118
+
119
+ ## Action Execution
120
+
121
+ The chatbot does **not** define its own action kinds. Instead, it parses JSON action blocks from the LLM response and executes them via `runtime.actions.applyBatch()`. This means the chatbot can trigger any action kind registered in the runtime (highlights, tooltips, text changes, navigation, tours, etc.).
122
+
123
+ ### LLM Response Format
124
+
125
+ The backend returns a text reply that may contain embedded JSON action blocks in fenced code blocks:
126
+
127
+ ```
128
+ Here's what I found. Let me highlight the pricing section for you.
129
+
130
+ \`\`\`json
131
+ {"kind": "overlays:highlight", "anchorId": "pricing-section"}
132
+ \`\`\`
133
+
134
+ Is there anything else you'd like to know?
135
+ ```
136
+
137
+ - JSON blocks with a `kind` field are extracted as actions and removed from display text
138
+ - JSON blocks without `kind` are left in the display text as-is
139
+ - Multiple action blocks can appear in a single response
140
+ - Actions with unknown kinds are silently ignored by the ActionEngine
141
+
142
+ ## Authentication
143
+
144
+ The widget reads auth credentials from the browser:
145
+
146
+ - **JWT**: `stytch_session_jwt` cookie
147
+ - **Workspace ID**: `syntrologie_workspace_id` from localStorage
148
+ - Headers: `Authorization: Bearer <jwt>` + `X-Workspace-Id: <id>`
149
+
150
+ ## Events
151
+
152
+ | Event | Props | Description |
153
+ | ------------------------- | ---------------------------- | --------------------------------- |
154
+ | `chatbot.actions_applied` | `count`, `kinds[]`, `tileId` | Emitted when actions are executed |
155
+
156
+
77
157
  ---
78
158
 
79
159
  # @syntrologie/app-content
@@ -83,13 +163,14 @@ DOM content modification capabilities for text, attributes, styles, HTML, and cl
83
163
  ## Actions
84
164
 
85
165
  ### set_text
166
+
86
167
  Replaces the text content of an element.
87
168
 
88
- | Property | Type | Required | Description |
89
- |----------|------|----------|-------------|
90
- | `kind` | `"set_text"` | Yes | Action type |
91
- | `anchorId` | string | Yes | Element selector |
92
- | `text` | string | Yes | New text content |
169
+ | Property | Type | Required | Description |
170
+ | ---------- | ------------ | -------- | ---------------- |
171
+ | `kind` | `"set_text"` | Yes | Action type |
172
+ | `anchorId` | string | Yes | Element selector |
173
+ | `text` | string | Yes | New text content |
93
174
 
94
175
  ```json
95
176
  {
@@ -100,14 +181,15 @@ Replaces the text content of an element.
100
181
  ```
101
182
 
102
183
  ### set_attr
184
+
103
185
  Sets an HTML attribute on an element.
104
186
 
105
- | Property | Type | Required | Description |
106
- |----------|------|----------|-------------|
107
- | `kind` | `"set_attr"` | Yes | Action type |
108
- | `anchorId` | string | Yes | Element selector |
109
- | `attr` | string | Yes | Attribute name |
110
- | `value` | string | Yes | Attribute value |
187
+ | Property | Type | Required | Description |
188
+ | ---------- | ------------ | -------- | ---------------- |
189
+ | `kind` | `"set_attr"` | Yes | Action type |
190
+ | `anchorId` | string | Yes | Element selector |
191
+ | `attr` | string | Yes | Attribute name |
192
+ | `value` | string | Yes | Attribute value |
111
193
 
112
194
  **Blocked attributes:** Event handlers (`onclick`, `onerror`, etc.) are not allowed.
113
195
 
@@ -121,13 +203,14 @@ Sets an HTML attribute on an element.
121
203
  ```
122
204
 
123
205
  ### set_style
206
+
124
207
  Sets inline CSS styles on an element.
125
208
 
126
- | Property | Type | Required | Description |
127
- |----------|------|----------|-------------|
128
- | `kind` | `"set_style"` | Yes | Action type |
129
- | `anchorId` | string | Yes | Element selector |
130
- | `styles` | object | Yes | CSS property/value pairs |
209
+ | Property | Type | Required | Description |
210
+ | ---------- | ------------- | -------- | ------------------------ |
211
+ | `kind` | `"set_style"` | Yes | Action type |
212
+ | `anchorId` | string | Yes | Element selector |
213
+ | `styles` | object | Yes | CSS property/value pairs |
131
214
 
132
215
  ```json
133
216
  {
@@ -141,16 +224,18 @@ Sets inline CSS styles on an element.
141
224
  ```
142
225
 
143
226
  ### insert_html
227
+
144
228
  Inserts HTML content relative to an element.
145
229
 
146
- | Property | Type | Required | Description |
147
- |----------|------|----------|-------------|
148
- | `kind` | `"insert_html"` | Yes | Action type |
149
- | `anchorId` | string | Yes | Element selector |
150
- | `html` | string | Yes | HTML content (sanitized) |
151
- | `position` | string | Yes | `"before"`, `"after"`, `"prepend"`, `"append"`, `"replace"` |
230
+ | Property | Type | Required | Description |
231
+ | ---------- | --------------- | -------- | ----------------------------------------------------------- |
232
+ | `kind` | `"insert_html"` | Yes | Action type |
233
+ | `anchorId` | string | Yes | Element selector |
234
+ | `html` | string | Yes | HTML content (sanitized) |
235
+ | `position` | string | Yes | `"before"`, `"after"`, `"prepend"`, `"append"`, `"replace"` |
152
236
 
153
237
  **Positions:**
238
+
154
239
  - `before` - Insert before the element
155
240
  - `after` - Insert after the element
156
241
  - `prepend` - Insert inside, before first child
@@ -167,13 +252,14 @@ Inserts HTML content relative to an element.
167
252
  ```
168
253
 
169
254
  ### add_class
255
+
170
256
  Adds a CSS class to an element.
171
257
 
172
- | Property | Type | Required | Description |
173
- |----------|------|----------|-------------|
174
- | `kind` | `"add_class"` | Yes | Action type |
175
- | `anchorId` | string | Yes | Element selector |
176
- | `className` | string | Yes | Class name to add |
258
+ | Property | Type | Required | Description |
259
+ | ----------- | ------------- | -------- | ----------------- |
260
+ | `kind` | `"add_class"` | Yes | Action type |
261
+ | `anchorId` | string | Yes | Element selector |
262
+ | `className` | string | Yes | Class name to add |
177
263
 
178
264
  ```json
179
265
  {
@@ -184,13 +270,14 @@ Adds a CSS class to an element.
184
270
  ```
185
271
 
186
272
  ### remove_class
273
+
187
274
  Removes a CSS class from an element.
188
275
 
189
- | Property | Type | Required | Description |
190
- |----------|------|----------|-------------|
191
- | `kind` | `"remove_class"` | Yes | Action type |
192
- | `anchorId` | string | Yes | Element selector |
193
- | `className` | string | Yes | Class name to remove |
276
+ | Property | Type | Required | Description |
277
+ | ----------- | ---------------- | -------- | -------------------- |
278
+ | `kind` | `"remove_class"` | Yes | Action type |
279
+ | `anchorId` | string | Yes | Element selector |
280
+ | `className` | string | Yes | Class name to remove |
194
281
 
195
282
  ```json
196
283
  {
@@ -210,24 +297,25 @@ FAQ accordion widget with conditional item visibility.
210
297
  ## Actions
211
298
 
212
299
  ### mount_faq
300
+
213
301
  Mounts an FAQ accordion widget to a surface slot.
214
302
 
215
- | Property | Type | Required | Description |
216
- |----------|------|----------|-------------|
217
- | `kind` | `"mount_faq"` | Yes | Action type |
218
- | `slot` | string | Yes | Target slot (e.g., `"drawer_right"`, `"overlay_center"`) |
219
- | `config.title` | string | No | Widget title |
220
- | `config.items` | array | Yes | FAQ items (see below) |
303
+ | Property | Type | Required | Description |
304
+ | -------------- | ------------- | -------- | -------------------------------------------------------- |
305
+ | `kind` | `"mount_faq"` | Yes | Action type |
306
+ | `slot` | string | Yes | Target slot (e.g., `"drawer_right"`, `"overlay_center"`) |
307
+ | `config.title` | string | No | Widget title |
308
+ | `config.items` | array | Yes | FAQ items (see below) |
221
309
 
222
310
  ### FAQ Item Schema
223
311
 
224
312
  Each item in the `items` array:
225
313
 
226
- | Property | Type | Required | Description |
227
- |----------|------|----------|-------------|
228
- | `question` | string | Yes | The question text |
229
- | `answer` | string | Yes | The answer text (supports markdown) |
230
- | `showWhen` | DecisionStrategy | No | Conditional visibility strategy |
314
+ | Property | Type | Required | Description |
315
+ | ---------- | ---------------- | -------- | ----------------------------------- |
316
+ | `question` | string | Yes | The question text |
317
+ | `answer` | string | Yes | The answer text (supports markdown) |
318
+ | `showWhen` | DecisionStrategy | No | Conditional visibility strategy |
231
319
 
232
320
  ```json
233
321
  {
@@ -247,9 +335,7 @@ Each item in the `items` array:
247
335
  "type": "rules",
248
336
  "rules": [
249
337
  {
250
- "conditions": [
251
- { "type": "page_url", "pattern": "/pricing*" }
252
- ],
338
+ "conditions": [{ "type": "page_url", "pattern": "/pricing*" }],
253
339
  "value": true
254
340
  }
255
341
  ],
@@ -264,6 +350,7 @@ Each item in the `items` array:
264
350
  ## Compositional Pattern
265
351
 
266
352
  The FAQ widget supports **per-item conditional visibility** using `showWhen` strategies. This allows different FAQ items to appear based on:
353
+
267
354
  - Current page/route
268
355
  - User segment or state
269
356
  - Viewport conditions
@@ -281,34 +368,35 @@ Gamification capabilities including badges, points, and leaderboards.
281
368
  ## Actions
282
369
 
283
370
  ### mount_gamification
371
+
284
372
  Mounts gamification UI elements.
285
373
 
286
- | Property | Type | Required | Description |
287
- |----------|------|----------|-------------|
288
- | `kind` | `"mount_gamification"` | Yes | Action type |
289
- | `slot` | string | Yes | Target slot |
290
- | `config` | object | Yes | Gamification configuration |
374
+ | Property | Type | Required | Description |
375
+ | -------- | ---------------------- | -------- | -------------------------- |
376
+ | `kind` | `"mount_gamification"` | Yes | Action type |
377
+ | `slot` | string | Yes | Target slot |
378
+ | `config` | object | Yes | Gamification configuration |
291
379
 
292
380
  ### Configuration Schema
293
381
 
294
- | Property | Type | Required | Default | Description |
295
- |----------|------|----------|---------|-------------|
296
- | `badges` | array | No | `[]` | Badge definitions |
297
- | `points.enabled` | boolean | No | `false` | Enable points system |
298
- | `points.multiplier` | number | No | `1` | Points multiplier |
299
- | `leaderboard.enabled` | boolean | No | `false` | Show leaderboard |
300
- | `leaderboard.refreshInterval` | number | No | `60000` | Refresh interval in ms |
382
+ | Property | Type | Required | Default | Description |
383
+ | ----------------------------- | ------- | -------- | ------- | ---------------------- |
384
+ | `badges` | array | No | `[]` | Badge definitions |
385
+ | `points.enabled` | boolean | No | `false` | Enable points system |
386
+ | `points.multiplier` | number | No | `1` | Points multiplier |
387
+ | `leaderboard.enabled` | boolean | No | `false` | Show leaderboard |
388
+ | `leaderboard.refreshInterval` | number | No | `60000` | Refresh interval in ms |
301
389
 
302
390
  ### Badge Schema
303
391
 
304
- | Property | Type | Required | Description |
305
- |----------|------|----------|-------------|
306
- | `id` | string | Yes | Unique badge identifier |
307
- | `name` | string | Yes | Display name |
308
- | `icon` | string | Yes | Icon identifier |
309
- | `description` | string | No | Badge description |
310
- | `trigger.event` | string | Yes | Event that triggers the badge |
311
- | `trigger.conditions` | array | No | Additional conditions |
392
+ | Property | Type | Required | Description |
393
+ | -------------------- | ------ | -------- | ----------------------------- |
394
+ | `id` | string | Yes | Unique badge identifier |
395
+ | `name` | string | Yes | Display name |
396
+ | `icon` | string | Yes | Icon identifier |
397
+ | `description` | string | No | Badge description |
398
+ | `trigger.event` | string | Yes | Event that triggers the badge |
399
+ | `trigger.conditions` | array | No | Additional conditions |
312
400
 
313
401
  ```json
314
402
  {
@@ -367,25 +455,26 @@ Navigation link list widget with conditional item visibility.
367
455
  ## Actions
368
456
 
369
457
  ### mount_nav
458
+
370
459
  Mounts a navigation link list widget to a surface slot.
371
460
 
372
- | Property | Type | Required | Description |
373
- |----------|------|----------|-------------|
374
- | `kind` | `"mount_nav"` | Yes | Action type |
375
- | `slot` | string | Yes | Target slot (e.g., `"drawer_left"`, `"inline:{anchorId}"`) |
376
- | `config.title` | string | No | Widget title |
377
- | `config.items` | array | Yes | Navigation items (see below) |
461
+ | Property | Type | Required | Description |
462
+ | -------------- | ------------- | -------- | ---------------------------------------------------------- |
463
+ | `kind` | `"mount_nav"` | Yes | Action type |
464
+ | `slot` | string | Yes | Target slot (e.g., `"drawer_left"`, `"inline:{anchorId}"`) |
465
+ | `config.title` | string | No | Widget title |
466
+ | `config.items` | array | Yes | Navigation items (see below) |
378
467
 
379
468
  ### Nav Item Schema
380
469
 
381
470
  Each item in the `items` array:
382
471
 
383
- | Property | Type | Required | Description |
384
- |----------|------|----------|-------------|
385
- | `label` | string | Yes | Link text |
386
- | `href` | string | Yes | Link destination |
387
- | `icon` | string | No | Icon identifier |
388
- | `showWhen` | DecisionStrategy | No | Conditional visibility strategy |
472
+ | Property | Type | Required | Description |
473
+ | ---------- | ---------------- | -------- | ------------------------------- |
474
+ | `label` | string | Yes | Link text |
475
+ | `href` | string | Yes | Link destination |
476
+ | `icon` | string | No | Icon identifier |
477
+ | `showWhen` | DecisionStrategy | No | Conditional visibility strategy |
389
478
 
390
479
  ```json
391
480
  {
@@ -407,9 +496,7 @@ Each item in the `items` array:
407
496
  "type": "rules",
408
497
  "rules": [
409
498
  {
410
- "conditions": [
411
- { "type": "state_equals", "key": "user.role", "value": "admin" }
412
- ],
499
+ "conditions": [{ "type": "state_equals", "key": "user.role", "value": "admin" }],
413
500
  "value": true
414
501
  }
415
502
  ],
@@ -424,9 +511,7 @@ Each item in the `items` array:
424
511
  "type": "rules",
425
512
  "rules": [
426
513
  {
427
- "conditions": [
428
- { "type": "state_equals", "key": "user.plan", "value": "free" }
429
- ],
514
+ "conditions": [{ "type": "state_equals", "key": "user.plan", "value": "free" }],
430
515
  "value": true
431
516
  }
432
517
  ],
@@ -441,6 +526,7 @@ Each item in the `items` array:
441
526
  ## Compositional Pattern
442
527
 
443
528
  The nav widget supports **per-item conditional visibility** using `showWhen` strategies. This allows different navigation items to appear based on:
529
+
444
530
  - User role or permissions
445
531
  - Subscription tier
446
532
  - Feature flags
@@ -458,15 +544,16 @@ Navigation capabilities for scrolling and URL navigation.
458
544
  ## Actions
459
545
 
460
546
  ### scroll_to
547
+
461
548
  Scrolls the viewport to bring an element into view.
462
549
 
463
- | Property | Type | Required | Default | Description |
464
- |----------|------|----------|---------|-------------|
465
- | `kind` | `"scroll_to"` | Yes | | Action type |
466
- | `anchorId` | string | Yes | | Element selector |
467
- | `behavior` | string | No | `"smooth"` | `"smooth"`, `"instant"`, `"auto"` |
468
- | `block` | string | No | `"center"` | `"start"`, `"center"`, `"end"`, `"nearest"` |
469
- | `inline` | string | No | `"nearest"` | `"start"`, `"center"`, `"end"`, `"nearest"` |
550
+ | Property | Type | Required | Default | Description |
551
+ | ---------- | ------------- | -------- | ----------- | ------------------------------------------- |
552
+ | `kind` | `"scroll_to"` | Yes | | Action type |
553
+ | `anchorId` | string | Yes | | Element selector |
554
+ | `behavior` | string | No | `"smooth"` | `"smooth"`, `"instant"`, `"auto"` |
555
+ | `block` | string | No | `"center"` | `"start"`, `"center"`, `"end"`, `"nearest"` |
556
+ | `inline` | string | No | `"nearest"` | `"start"`, `"center"`, `"end"`, `"nearest"` |
470
557
 
471
558
  ```json
472
559
  {
@@ -478,13 +565,14 @@ Scrolls the viewport to bring an element into view.
478
565
  ```
479
566
 
480
567
  ### navigate
568
+
481
569
  Navigates to a URL.
482
570
 
483
- | Property | Type | Required | Default | Description |
484
- |----------|------|----------|---------|-------------|
485
- | `kind` | `"navigate"` | Yes | | Action type |
486
- | `url` | string | Yes | | Destination URL |
487
- | `target` | string | No | `"_self"` | `"_self"` or `"_blank"` |
571
+ | Property | Type | Required | Default | Description |
572
+ | -------- | ------------ | -------- | --------- | ----------------------- |
573
+ | `kind` | `"navigate"` | Yes | | Action type |
574
+ | `url` | string | Yes | | Destination URL |
575
+ | `target` | string | No | `"_self"` | `"_self"` or `"_blank"` |
488
576
 
489
577
  ```json
490
578
  {
@@ -506,16 +594,17 @@ Visual overlay capabilities including highlights, tooltips, badges, and pulse an
506
594
  ## Actions
507
595
 
508
596
  ### highlight
597
+
509
598
  Creates a spotlight effect around an element with a scrim overlay.
510
599
 
511
- | Property | Type | Required | Default | Description |
512
- |----------|------|----------|---------|-------------|
513
- | `kind` | `"highlight"` | Yes | | Action type |
514
- | `anchorId` | string | Yes | | Element selector |
515
- | `style.color` | string | No | `"#5b8cff"` | Ring color |
516
- | `style.scrimOpacity` | number | No | `0.55` | Backdrop opacity 0-1 (set to 0 to hide) |
517
- | `style.paddingPx` | number | No | `12` | Space around element |
518
- | `style.radiusPx` | number | No | `12` | Ring corner radius |
600
+ | Property | Type | Required | Default | Description |
601
+ | -------------------- | ------------- | -------- | ----------- | --------------------------------------- |
602
+ | `kind` | `"highlight"` | Yes | | Action type |
603
+ | `anchorId` | string | Yes | | Element selector |
604
+ | `style.color` | string | No | `"#5b8cff"` | Ring color |
605
+ | `style.scrimOpacity` | number | No | `0.55` | Backdrop opacity 0-1 (set to 0 to hide) |
606
+ | `style.paddingPx` | number | No | `12` | Space around element |
607
+ | `style.radiusPx` | number | No | `12` | Ring corner radius |
519
608
 
520
609
  ```json
521
610
  {
@@ -529,18 +618,19 @@ Creates a spotlight effect around an element with a scrim overlay.
529
618
  ```
530
619
 
531
620
  ### tooltip
621
+
532
622
  Shows a tooltip near an element with optional title, body, and CTA.
533
623
 
534
- | Property | Type | Required | Default | Description |
535
- |----------|------|----------|---------|-------------|
536
- | `kind` | `"tooltip"` | Yes | | Action type |
537
- | `anchorId` | string | Yes | | Element selector |
538
- | `content.title` | string | No | | Tooltip heading |
539
- | `content.body` | string | Yes | | Tooltip text |
540
- | `content.cta.label` | string | No | | CTA button text |
541
- | `content.cta.action` | Action | No | | Action to execute on CTA click |
542
- | `trigger` | string | No | `"immediate"` | `"immediate"`, `"hover"`, `"click"` |
543
- | `placement` | string | No | `"top"` | See placement options below |
624
+ | Property | Type | Required | Default | Description |
625
+ | -------------------- | ----------- | -------- | ------------- | ----------------------------------- |
626
+ | `kind` | `"tooltip"` | Yes | | Action type |
627
+ | `anchorId` | string | Yes | | Element selector |
628
+ | `content.title` | string | No | | Tooltip heading |
629
+ | `content.body` | string | Yes | | Tooltip text |
630
+ | `content.cta.label` | string | No | | CTA button text |
631
+ | `content.cta.action` | Action | No | | Action to execute on CTA click |
632
+ | `trigger` | string | No | `"immediate"` | `"immediate"`, `"hover"`, `"click"` |
633
+ | `placement` | string | No | `"top"` | See placement options below |
544
634
 
545
635
  **Placement options:** `top`, `top-start`, `top-end`, `bottom`, `bottom-start`, `bottom-end`, `left`, `left-start`, `left-end`, `right`, `right-start`, `right-end`
546
636
 
@@ -562,14 +652,15 @@ Shows a tooltip near an element with optional title, body, and CTA.
562
652
  ```
563
653
 
564
654
  ### badge
655
+
565
656
  Adds a small badge indicator near an element.
566
657
 
567
- | Property | Type | Required | Default | Description |
568
- |----------|------|----------|---------|-------------|
569
- | `kind` | `"badge"` | Yes | | Action type |
570
- | `anchorId` | string | Yes | | Element selector |
571
- | `text` | string | Yes | | Badge text (e.g., "NEW", "3") |
572
- | `position` | string | No | `"top-right"` | `"top-left"`, `"top-right"`, `"bottom-left"`, `"bottom-right"` |
658
+ | Property | Type | Required | Default | Description |
659
+ | ---------- | --------- | -------- | ------------- | -------------------------------------------------------------- |
660
+ | `kind` | `"badge"` | Yes | | Action type |
661
+ | `anchorId` | string | Yes | | Element selector |
662
+ | `text` | string | Yes | | Badge text (e.g., "NEW", "3") |
663
+ | `position` | string | No | `"top-right"` | `"top-left"`, `"top-right"`, `"bottom-left"`, `"bottom-right"` |
573
664
 
574
665
  ```json
575
666
  {
@@ -581,13 +672,14 @@ Adds a small badge indicator near an element.
581
672
  ```
582
673
 
583
674
  ### pulse
675
+
584
676
  Adds a pulsing animation to draw attention.
585
677
 
586
- | Property | Type | Required | Default | Description |
587
- |----------|------|----------|---------|-------------|
588
- | `kind` | `"pulse"` | Yes | | Action type |
589
- | `anchorId` | string | Yes | | Element selector |
590
- | `duration` | number | No | `2000` | Animation duration in ms |
678
+ | Property | Type | Required | Default | Description |
679
+ | ---------- | --------- | -------- | ------- | ------------------------ |
680
+ | `kind` | `"pulse"` | Yes | | Action type |
681
+ | `anchorId` | string | Yes | | Element selector |
682
+ | `duration` | number | No | `2000` | Animation duration in ms |
591
683
 
592
684
  ```json
593
685
  {
@@ -598,23 +690,25 @@ Adds a pulsing animation to draw attention.
598
690
  ```
599
691
 
600
692
  ### modal
693
+
601
694
  Shows a centered modal dialog with optional CTA buttons.
602
695
 
603
- | Property | Type | Required | Default | Description |
604
- |----------|------|----------|---------|-------------|
605
- | `kind` | `"overlays:modal"` | Yes | | Action type |
606
- | `content.title` | string | No | | Modal heading |
607
- | `content.body` | string | Yes | | Modal text |
608
- | `size` | string | No | `"md"` | `"sm"`, `"md"`, `"lg"` |
609
- | `blocking` | boolean | No | `false` | Block page interaction |
610
- | `scrim.opacity` | number | No | `0.6` | Backdrop opacity 0-1 |
611
- | `dismiss.onEsc` | boolean | No | `true` | Close on Escape key |
612
- | `dismiss.closeButton` | boolean | No | `true` | Show close button |
613
- | `dismiss.timeoutMs` | number | No | | Auto-close after timeout |
614
- | `ctaButtons` | array | No | | Array of CTA buttons |
615
- | `waitFor` | string | No | | When to complete: `"dismissed"`, `"cta-click"`, `"timeout:N"` |
696
+ | Property | Type | Required | Default | Description |
697
+ | --------------------- | ------------------ | -------- | ------- | ------------------------------------------------------------- |
698
+ | `kind` | `"overlays:modal"` | Yes | | Action type |
699
+ | `content.title` | string | No | | Modal heading |
700
+ | `content.body` | string | Yes | | Modal text |
701
+ | `size` | string | No | `"md"` | `"sm"`, `"md"`, `"lg"` |
702
+ | `blocking` | boolean | No | `false` | Block page interaction |
703
+ | `scrim.opacity` | number | No | `0.6` | Backdrop opacity 0-1 |
704
+ | `dismiss.onEsc` | boolean | No | `true` | Close on Escape key |
705
+ | `dismiss.closeButton` | boolean | No | `true` | Show close button |
706
+ | `dismiss.timeoutMs` | number | No | | Auto-close after timeout |
707
+ | `ctaButtons` | array | No | | Array of CTA buttons |
708
+ | `waitFor` | string | No | | When to complete: `"dismissed"`, `"cta-click"`, `"timeout:N"` |
616
709
 
617
710
  **CTA Button properties:**
711
+
618
712
  - `label`: Button text
619
713
  - `actionId`: Identifier for the action
620
714
  - `primary`: Whether this is a primary button (default: false)