@syntrologie/runtime-sdk 0.2.21 → 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 (311) hide show
  1. package/CAPABILITIES.md +721 -460
  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 +86 -56
  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 +32 -8
  87. package/dist/bootstrap.js +204 -85
  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 +3 -3
  105. package/dist/context/ContextManager.js +15 -15
  106. package/dist/context/ContextManager.js.map +1 -1
  107. package/dist/context/index.d.ts +4 -4
  108. package/dist/context/index.js +3 -3
  109. package/dist/context/schema.d.ts +17 -17
  110. package/dist/context/schema.js +1 -1
  111. package/dist/decisions/engine.d.ts +5 -5
  112. package/dist/decisions/engine.js +13 -13
  113. package/dist/decisions/index.d.ts +6 -6
  114. package/dist/decisions/index.js +5 -5
  115. package/dist/decisions/schema.d.ts +97 -97
  116. package/dist/decisions/schema.js +20 -20
  117. package/dist/decisions/strategies/rules.d.ts +1 -1
  118. package/dist/decisions/strategies/rules.js +24 -24
  119. package/dist/decisions/strategies/rules.js.map +1 -1
  120. package/dist/decisions/strategies/score.d.ts +1 -1
  121. package/dist/decisions/strategies/score.js +3 -3
  122. package/dist/decisions/types.d.ts +19 -19
  123. package/dist/earlyPatcher.d.ts +8 -20
  124. package/dist/earlyPatcher.js +13 -62
  125. package/dist/earlyPatcher.js.map +1 -1
  126. package/dist/editorLoader.d.ts +2 -0
  127. package/dist/editorLoader.js +104 -58
  128. package/dist/editorLoader.js.map +1 -1
  129. package/dist/events/EventBus.d.ts +3 -3
  130. package/dist/events/EventBus.js +5 -7
  131. package/dist/events/EventBus.js.map +1 -1
  132. package/dist/events/index.d.ts +6 -6
  133. package/dist/events/index.js +5 -5
  134. package/dist/events/normalizers/canvas.d.ts +2 -2
  135. package/dist/events/normalizers/canvas.js +3 -3
  136. package/dist/events/normalizers/canvas.js.map +1 -1
  137. package/dist/events/normalizers/posthog.d.ts +25 -1
  138. package/dist/events/normalizers/posthog.js +35 -27
  139. package/dist/events/normalizers/posthog.js.map +1 -1
  140. package/dist/events/schema.d.ts +13 -13
  141. package/dist/events/schema.js +2 -2
  142. package/dist/events/types.d.ts +7 -1
  143. package/dist/events/types.js +29 -21
  144. package/dist/events/types.js.map +1 -1
  145. package/dist/experiments/adapters/growthbook.d.ts +4 -4
  146. package/dist/experiments/adapters/growthbook.js +5 -5
  147. package/dist/experiments/adapters/growthbook.js.map +1 -1
  148. package/dist/experiments/index.d.ts +3 -3
  149. package/dist/experiments/index.js +1 -1
  150. package/dist/experiments/registry.d.ts +2 -2
  151. package/dist/experiments/registry.js +2 -2
  152. package/dist/experiments/types.d.ts +5 -1
  153. package/dist/fetchers/cdnFetcher.d.ts +1 -1
  154. package/dist/fetchers/cdnFetcher.js +4 -8
  155. package/dist/fetchers/cdnFetcher.js.map +1 -1
  156. package/dist/fetchers/experimentsFetcher.d.ts +2 -2
  157. package/dist/fetchers/experimentsFetcher.js +7 -7
  158. package/dist/fetchers/experimentsFetcher.js.map +1 -1
  159. package/dist/fetchers/index.d.ts +3 -3
  160. package/dist/fetchers/index.js +2 -2
  161. package/dist/fetchers/index.js.map +1 -1
  162. package/dist/fetchers/registry.d.ts +1 -1
  163. package/dist/fetchers/registry.js +4 -4
  164. package/dist/fetchers/types.d.ts +1 -1
  165. package/dist/hooks/useCanvasOverlays.d.ts +8 -5
  166. package/dist/hooks/useCanvasOverlays.js +66 -17
  167. package/dist/hooks/useCanvasOverlays.js.map +1 -1
  168. package/dist/hooks/useHostPatches.d.ts +2 -2
  169. package/dist/hooks/useHostPatches.js +8 -8
  170. package/dist/hooks/useHostPatches.js.map +1 -1
  171. package/dist/hooks/useShadowCanvasConfig.d.ts +5 -9
  172. package/dist/hooks/useShadowCanvasConfig.js +7 -5
  173. package/dist/hooks/useShadowCanvasConfig.js.map +1 -1
  174. package/dist/hostPatcher/core/patcher.d.ts +1 -1
  175. package/dist/hostPatcher/core/patcher.js +18 -9
  176. package/dist/hostPatcher/core/patcher.js.map +1 -1
  177. package/dist/hostPatcher/core/sanitizer.js +24 -3
  178. package/dist/hostPatcher/core/sanitizer.js.map +1 -1
  179. package/dist/hostPatcher/policy/defaultPolicy.js +15 -5
  180. package/dist/hostPatcher/policy/defaultPolicy.js.map +1 -1
  181. package/dist/hostPatcher/utils/anchors.js +4 -6
  182. package/dist/hostPatcher/utils/anchors.js.map +1 -1
  183. package/dist/index.d.ts +34 -27
  184. package/dist/index.js +36 -24
  185. package/dist/index.js.map +1 -1
  186. package/dist/logger.d.ts +29 -0
  187. package/dist/logger.js +81 -0
  188. package/dist/logger.js.map +1 -0
  189. package/dist/metrics/index.d.ts +1 -1
  190. package/dist/metrics/index.js +1 -1
  191. package/dist/metrics/sessionMetrics.d.ts +1 -1
  192. package/dist/metrics/sessionMetrics.js +6 -6
  193. package/dist/overlays/fetcher.d.ts +2 -2
  194. package/dist/overlays/fetcher.js +4 -4
  195. package/dist/overlays/recipeRegistry.js +2 -2
  196. package/dist/overlays/recipeRegistry.js.map +1 -1
  197. package/dist/overlays/runtime/anchor/resolve.js +1 -1
  198. package/dist/overlays/runtime/anchor/resolve.js.map +1 -1
  199. package/dist/overlays/runtime/index.d.ts +7 -7
  200. package/dist/overlays/runtime/index.js +7 -7
  201. package/dist/overlays/runtime/overlay/highlight.js +39 -39
  202. package/dist/overlays/runtime/overlay/highlight.js.map +1 -1
  203. package/dist/overlays/runtime/overlay/modal.js +5 -5
  204. package/dist/overlays/runtime/overlay/modal.js.map +1 -1
  205. package/dist/overlays/runtime/overlay/root.js +1 -1
  206. package/dist/overlays/runtime/overlay/runner.js +70 -23
  207. package/dist/overlays/runtime/overlay/runner.js.map +1 -1
  208. package/dist/overlays/runtime/overlay/tooltip.d.ts +1 -1
  209. package/dist/overlays/runtime/overlay/tooltip.js +10 -10
  210. package/dist/overlays/runtime/overlay/tooltip.js.map +1 -1
  211. package/dist/overlays/runtime/utils/dom.js +4 -1
  212. package/dist/overlays/runtime/utils/dom.js.map +1 -1
  213. package/dist/overlays/schema.d.ts +146 -146
  214. package/dist/overlays/schema.js +12 -8
  215. package/dist/overlays/schema.js.map +1 -1
  216. package/dist/react.d.ts +7 -7
  217. package/dist/react.js +4 -4
  218. package/dist/react.js.map +1 -1
  219. package/dist/render/RenderContext.d.ts +2 -2
  220. package/dist/render/RenderContext.js +5 -5
  221. package/dist/render/RenderContext.js.map +1 -1
  222. package/dist/render/index.d.ts +3 -3
  223. package/dist/render/index.js +1 -1
  224. package/dist/render/types.d.ts +4 -4
  225. package/dist/runtime.d.ts +32 -8
  226. package/dist/runtime.js +87 -13
  227. package/dist/runtime.js.map +1 -1
  228. package/dist/smart-canvas.esm.js +155 -78
  229. package/dist/smart-canvas.esm.js.map +4 -4
  230. package/dist/smart-canvas.js +38776 -33216
  231. package/dist/smart-canvas.js.map +4 -4
  232. package/dist/smart-canvas.min.js +156 -78
  233. package/dist/smart-canvas.min.js.map +4 -4
  234. package/dist/state/StateStore.d.ts +1 -1
  235. package/dist/state/StateStore.js +9 -9
  236. package/dist/state/StateStore.js.map +1 -1
  237. package/dist/state/helpers/cooldowns.d.ts +1 -1
  238. package/dist/state/helpers/cooldowns.js +1 -1
  239. package/dist/state/helpers/dismissals.d.ts +1 -1
  240. package/dist/state/helpers/dismissals.js +1 -1
  241. package/dist/state/helpers/frequency.d.ts +1 -1
  242. package/dist/state/helpers/frequency.js +1 -1
  243. package/dist/state/index.d.ts +4 -4
  244. package/dist/state/index.js +3 -3
  245. package/dist/state/schema.d.ts +1 -1
  246. package/dist/state/schema.js +1 -1
  247. package/dist/store/example.d.ts +1 -0
  248. package/dist/store/example.js +43 -0
  249. package/dist/store/example.js.map +1 -0
  250. package/dist/store/mini-effector.d.ts +46 -0
  251. package/dist/store/mini-effector.js +88 -0
  252. package/dist/store/mini-effector.js.map +1 -0
  253. package/dist/surfaces/Surfaces.d.ts +11 -0
  254. package/dist/surfaces/Surfaces.js +361 -0
  255. package/dist/surfaces/Surfaces.js.map +1 -0
  256. package/dist/surfaces/index.d.ts +9 -0
  257. package/dist/surfaces/index.js +12 -0
  258. package/dist/surfaces/index.js.map +1 -0
  259. package/dist/surfaces/positioning.d.ts +50 -0
  260. package/dist/surfaces/positioning.js +228 -0
  261. package/dist/surfaces/positioning.js.map +1 -0
  262. package/dist/surfaces/types.d.ts +167 -0
  263. package/dist/surfaces/types.js +23 -0
  264. package/dist/surfaces/types.js.map +1 -0
  265. package/dist/telemetry/adapters/noop.d.ts +12 -0
  266. package/dist/telemetry/adapters/noop.js +42 -0
  267. package/dist/telemetry/adapters/noop.js.map +1 -0
  268. package/dist/telemetry/adapters/posthog.d.ts +8 -2
  269. package/dist/telemetry/adapters/posthog.js +36 -14
  270. package/dist/telemetry/adapters/posthog.js.map +1 -1
  271. package/dist/telemetry/index.d.ts +4 -3
  272. package/dist/telemetry/index.js +3 -2
  273. package/dist/telemetry/index.js.map +1 -1
  274. package/dist/telemetry/registry.d.ts +2 -2
  275. package/dist/telemetry/registry.js +4 -2
  276. package/dist/telemetry/registry.js.map +1 -1
  277. package/dist/telemetry/types.d.ts +1 -1
  278. package/dist/theme/ThemeProvider.d.ts +2 -2
  279. package/dist/theme/ThemeProvider.js +21 -21
  280. package/dist/theme/ThemeProvider.js.map +1 -1
  281. package/dist/theme/defaultTheme.d.ts +2 -2
  282. package/dist/theme/defaultTheme.js +111 -111
  283. package/dist/theme/defaultTheme.js.map +1 -1
  284. package/dist/theme/extractHostTheme.d.ts +1 -1
  285. package/dist/theme/extractHostTheme.js +42 -44
  286. package/dist/theme/extractHostTheme.js.map +1 -1
  287. package/dist/theme/index.d.ts +5 -5
  288. package/dist/theme/index.js +3 -3
  289. package/dist/theme/index.js.map +1 -1
  290. package/dist/theme/types.d.ts +2 -2
  291. package/dist/token.d.ts +2 -0
  292. package/dist/token.js +3 -6
  293. package/dist/token.js.map +1 -1
  294. package/dist/types-only.d.ts +32 -0
  295. package/dist/types-only.js +11 -0
  296. package/dist/types-only.js.map +1 -0
  297. package/dist/types.d.ts +89 -56
  298. package/dist/types.js +15 -2
  299. package/dist/types.js.map +1 -1
  300. package/dist/version.d.ts +13 -0
  301. package/dist/version.js +14 -0
  302. package/dist/version.js.map +1 -0
  303. package/dist/widgets/WidgetRegistry.d.ts +139 -0
  304. package/dist/widgets/WidgetRegistry.js +182 -0
  305. package/dist/widgets/WidgetRegistry.js.map +1 -0
  306. package/dist/widgets/index.d.ts +7 -0
  307. package/dist/widgets/index.js +7 -0
  308. package/dist/widgets/index.js.map +1 -0
  309. package/package.json +26 -10
  310. package/schema/canvas-config.schema.json +488 -254
  311. package/schema/runtime-context.schema.json +1 -5
package/README.md CHANGED
@@ -2,19 +2,50 @@
2
2
 
3
3
  ## Smart Canvas SDK (React + Shadow DOM)
4
4
 
5
- The SDK now ships a framework-agnostic `<smart-canvas>` custom element with an **open shadow root**. We still render everything with React, but the canvas is encapsulated so host Tailwind configs, resets, or stacking contexts cant break the UI.
5
+ The SDK ships a framework-agnostic `<smart-canvas>` custom element with an **open shadow root**. We render everything with React, but the canvas is encapsulated so host Tailwind configs, resets, or stacking contexts can't break the UI.
6
6
 
7
- ### Whats Included
7
+ ### What's Included
8
8
 
9
9
  - `SmartCanvasElement` – the custom element that owns the shadow DOM, overlay root, and controller.
10
10
  - `SmartCanvasApp` – the React tree (overlay, rectangles, toggle) you portal into the shadow.
11
11
  - `SmartCanvasPortal` – helper for React hosts to portal their tree (and context) into the element mount.
12
12
  - `createSmartCanvas` – imperative API (`window.SmartCanvas.create`) for non-React hosts.
13
+ - **ActionEngine** – unified execution layer for interventions (highlight, tooltip, badge, DOM modifications)
14
+ - **Surfaces** – managed surface system for rendering UI into named slots
13
15
  - GrowthBook/PostHog wrappers, hooks, rectangle components, and wheel remain available.
14
16
 
15
- ### Installation
17
+ ---
16
18
 
17
- #### NPM/Yarn
19
+ ## Quick Start
20
+
21
+ ```typescript
22
+ import { Syntro } from '@syntrologie/runtime-sdk';
23
+
24
+ const { runtime } = await Syntro.init({ token: 'syn_...' });
25
+
26
+ // Change a headline
27
+ const handle = await runtime.actions.apply({
28
+ kind: 'set_text',
29
+ anchorId: 'h1.hero-title',
30
+ text: 'Welcome to Our New Experience',
31
+ });
32
+
33
+ // Show a toast notification
34
+ const toast = runtime.surfaces.mount('toast_top', {
35
+ type: 'html',
36
+ content: '<div class="toast">Changes applied!</div>',
37
+ });
38
+
39
+ // Later: revert and cleanup
40
+ await handle.revert();
41
+ toast.unmount();
42
+ ```
43
+
44
+ ---
45
+
46
+ ## Installation
47
+
48
+ ### NPM/Yarn
18
49
 
19
50
  ```bash
20
51
  npm install @syntrologie/smart-canvas-sdk
@@ -22,7 +53,7 @@ npm install @syntrologie/smart-canvas-sdk
22
53
  yarn add @syntrologie/smart-canvas-sdk
23
54
  ```
24
55
 
25
- #### CDN
56
+ ### CDN
26
57
 
27
58
  For quick setup without a build process:
28
59
 
@@ -39,18 +70,113 @@ For quick setup without a build process:
39
70
  </script>
40
71
  ```
41
72
 
42
- #### Local Development
73
+ ### Local Development
43
74
 
44
75
  ```bash
45
- cd tech-core/sdks/shadow-canvas
76
+ cd tech-core/sdks/runtime-sdk
46
77
  npm run build
47
- cd ../../tax_landing_page
48
- npm install @syntrologie/smart-canvas-sdk@file:../tech-core/sdks/shadow-canvas
49
78
  ```
50
79
 
51
- Rebuild and reinstall whenever the SDK changes.
80
+ ---
81
+
82
+ ## Core Modules
83
+
84
+ ### ActionEngine
85
+
86
+ The ActionEngine provides a unified API for applying reversible interventions:
87
+
88
+ ```typescript
89
+ // Visual actions
90
+ await runtime.actions.apply({ kind: 'highlight', anchorId: '#cta', style: { color: '#4f46e5' } });
91
+ await runtime.actions.apply({
92
+ kind: 'tooltip',
93
+ anchorId: '#help',
94
+ content: { body: 'Click for help' },
95
+ });
96
+ await runtime.actions.apply({ kind: 'badge', anchorId: '#inbox', content: '3' });
97
+ await runtime.actions.apply({ kind: 'pulse', anchorId: '#notification' });
98
+
99
+ // DOM actions
100
+ await runtime.actions.apply({ kind: 'set_text', anchorId: 'h1', text: 'New headline' });
101
+ await runtime.actions.apply({
102
+ kind: 'insert_html',
103
+ anchorId: '.cta',
104
+ html: '<span>NEW</span>',
105
+ position: 'append',
106
+ });
107
+ await runtime.actions.apply({ kind: 'add_class', anchorId: '.card', className: 'highlighted' });
108
+ await runtime.actions.apply({
109
+ kind: 'set_style',
110
+ anchorId: '.hero',
111
+ styles: { background: '#1e40af' },
112
+ });
113
+
114
+ // Navigation actions
115
+ await runtime.actions.apply({ kind: 'scroll_to', anchorId: '#pricing' });
116
+ await runtime.actions.apply({ kind: 'navigate', url: '/signup' });
117
+
118
+ // Batch with atomic rollback
119
+ const batch = await runtime.actions.applyBatch([
120
+ { kind: 'set_text', anchorId: 'h1', text: 'New' },
121
+ { kind: 'highlight', anchorId: 'h1' },
122
+ ]);
123
+ await batch.revertAll();
124
+ ```
125
+
126
+ ### Surfaces
52
127
 
53
- ### Using the Custom Element (React Host)
128
+ The Surfaces system manages UI rendering into named slots:
129
+
130
+ ```typescript
131
+ // Static slots
132
+ runtime.surfaces.mount('toast_top', { type: 'html', content: '<div>Saved!</div>' });
133
+ runtime.surfaces.mount('drawer_right', { type: 'html', content: '<div>Settings</div>' });
134
+ runtime.surfaces.mount('overlay_center', { type: 'html', content: '<div>Modal</div>' });
135
+
136
+ // Dynamic slots (positioned relative to anchors)
137
+ runtime.surfaces.mount('inline:product-card', { type: 'html', content: '<span>SALE</span>' });
138
+ runtime.surfaces.mount(
139
+ 'adjacent:help-icon',
140
+ { type: 'html', content: '<div>Help text</div>' },
141
+ {
142
+ position: { placement: 'bottom' },
143
+ }
144
+ );
145
+
146
+ // Priority-based arbitration
147
+ runtime.surfaces.mount('toast_top', content, { priority: 10 }); // Higher priority wins
148
+ ```
149
+
150
+ **Available Static Slots:**
151
+ | Slot | Position |
152
+ |------|----------|
153
+ | `drawer_right` | Right edge, full height |
154
+ | `drawer_left` | Left edge, full height |
155
+ | `drawer_bottom` | Bottom edge, full width |
156
+ | `overlay_center` | Centered modal |
157
+ | `overlay_corner_br` | Bottom-right corner |
158
+ | `overlay_corner_bl` | Bottom-left corner |
159
+ | `toast_top` | Top center |
160
+ | `toast_bottom` | Bottom center |
161
+
162
+ ### Runtime
163
+
164
+ The runtime provides access to all core providers:
165
+
166
+ ```typescript
167
+ const { runtime } = await Syntro.init({ token: 'syn_...' });
168
+
169
+ runtime.telemetry; // Event tracking (PostHog)
170
+ runtime.context; // Page/session/viewport state
171
+ runtime.events; // Normalized event stream
172
+ runtime.state; // Persistent storage
173
+ runtime.actions; // ActionEngine
174
+ runtime.surfaces; // Surfaces
175
+ ```
176
+
177
+ ---
178
+
179
+ ## Using the Custom Element (React Host)
54
180
 
55
181
  ```tsx
56
182
  import {
@@ -60,9 +186,11 @@ import {
60
186
  SmartCanvasPortal,
61
187
  registerSmartCanvasElement,
62
188
  type SmartCanvasElement,
63
- } from "@syntrologie/smart-canvas-sdk";
189
+ } from '@syntrologie/smart-canvas-sdk';
64
190
 
65
- const canvasFetcher = async () => {/* return ShadowCanvasConfigResponse */};
191
+ const canvasFetcher = async () => {
192
+ /* return ShadowCanvasConfigResponse */
193
+ };
66
194
 
67
195
  function SmartCanvasBridge() {
68
196
  const [element, setElement] = useState<SmartCanvasElement | null>(null);
@@ -90,7 +218,9 @@ function SmartCanvasBridge() {
90
218
  }
91
219
  ```
92
220
 
93
- ### Using the Imperative API (Plain JS Host)
221
+ ---
222
+
223
+ ## Using the Imperative API (Plain JS Host)
94
224
 
95
225
  When using via CDN, the SDK is available as `window.SyntrologieSDK`:
96
226
 
@@ -99,87 +229,199 @@ When using via CDN, the SDK is available as `window.SyntrologieSDK`:
99
229
  await window.SmartCanvas?.create({
100
230
  defaultOpen: true,
101
231
  tokens: {
102
- "--sc-surface": "#050814",
103
- "--sc-fg": "#f8fafc",
232
+ '--sc-surface': '#050814',
233
+ '--sc-fg': '#f8fafc',
104
234
  },
105
235
  integrations: {
106
- posthog, // existing PostHog client
107
- growthbook, // existing GrowthBook client
236
+ posthog, // existing PostHog client
237
+ growthbook, // existing GrowthBook client
108
238
  },
109
239
  });
110
240
  ```
111
241
 
112
- ### Styling & Overlays
242
+ ---
113
243
 
114
- - Fonts, colors, and CSS variables (`--sc-surface`, `--sc-fg`, etc.) are inherited from the host. Tokens can be overridden via `setTokens` or standard CSS:
115
- - `--syntro-tooltip-bg`, `--syntro-tooltip-fg`, `--syntro-tooltip-radius`, `--syntro-tooltip-shadow`
116
- - `--syntro-ring`, `--syntro-spotlight-backdrop` for highlights
117
- - A scoped reset is injected via `adoptedStyleSheets` (fallbacks to `<style>`).
118
- - Tooltips/popovers should use the Popover API or Floating UI with the exposed overlay root (`element.getOverlayRoot()`).
244
+ ## Event System
245
+
246
+ The EventBus provides a unified stream of normalized events:
247
+
248
+ ```typescript
249
+ // Subscribe to events
250
+ runtime.events.subscribe({ names: ['ui.click', 'action.applied'] }, (event) => {
251
+ console.log(event.name, event.props);
252
+ });
119
253
 
120
- ### Analytics Events
254
+ // Standard events
255
+ // UI: ui.click, ui.scroll, ui.input, ui.submit
256
+ // Navigation: nav.page_view, nav.page_leave
257
+ // Canvas: canvas.opened, canvas.closed, tile.viewed, tile.action
258
+ // Actions: action.applied, action.reverted, action.failed
259
+ // Surfaces: surface.mounted, surface.unmounted
260
+ ```
121
261
 
122
- The `createSyntroTelemetry` client emits:
262
+ ---
123
263
 
124
- | Event | Description |
125
- | --- | --- |
126
- | `shadow_canvas_opened` / `shadow_canvas_closed` | Toggle button interactions. |
127
- | `shadow_canvas_rectangle_viewed` | A rectangle becomes visible (overlay grid & wheel). |
128
- | `shadow_canvas_action` | CTA click, chatbot send, overlay events (tooltips, dismiss, anchor missing). |
264
+ ## State Management
129
265
 
130
- ### Rectangle Config (unchanged)
266
+ ```typescript
267
+ // Dismissals
268
+ runtime.state.dismissals.mark("promo-banner");
269
+ if (runtime.state.dismissals.isDismissed("promo-banner")) { ... }
131
270
 
132
- The experimentation service still returns the same payload (`rectangles`, `style`, `content`, optional `experiment` metadata). Top-level fields now include optional `canvasTitle` so host teams can rename the overlay without code changes. See `src/types.ts` for the exact contract.
271
+ // Cooldowns
272
+ runtime.state.cooldowns.set("upsell", 86400000); // 24h
273
+ if (runtime.state.cooldowns.isActive("upsell")) { ... }
133
274
 
134
- ### Schema & Validation Tool
275
+ // Frequency caps
276
+ runtime.state.frequency.increment("tooltip-shown");
277
+ if (runtime.state.frequency.count("tooltip-shown") >= 3) { ... }
278
+ ```
135
279
 
136
- - JSON schema lives at `schema/canvas-config.schema.json` (published with the package).
137
- - Validate a config file locally:
280
+ ---
281
+
282
+ ## Decision Strategies
283
+
284
+ Control when adaptives activate:
285
+
286
+ ```typescript
287
+ const result = runtime.evaluateSync({
288
+ type: 'rules',
289
+ rules: [
290
+ {
291
+ conditions: [
292
+ { type: 'page_url', pattern: '/pricing*' },
293
+ { type: 'viewport', minWidth: 768 },
294
+ { type: 'dismissed', key: 'promo', inverted: true },
295
+ ],
296
+ value: true,
297
+ },
298
+ ],
299
+ default: false,
300
+ });
138
301
 
139
- ```bash
140
- cd tech-core/sdks/shadow-canvas
141
- npm run validate-config -- ../../tax_landing_page/public/smart-canvas-demo.json
302
+ if (result.value) {
303
+ // Apply adaptive
304
+ }
142
305
  ```
143
306
 
144
- The script evaluates structure/required fields without third-party dependencies so CI and content authors can catch issues early.
307
+ ---
145
308
 
146
- ### Overlays (Tooltips & Highlights)
309
+ ## Styling & Overlays
147
310
 
148
- - Recipes use the schema in `src/overlays/schema.ts` (roughly `{ id, version, steps[] }`).
149
- - Provide a recipe URI via `overlayConfigUri` or let GrowthBook supply `smart-canvas-overlay-uri`.
150
- - Overlays render in `#syntro-overlays` (fixed, pointer-events: none) and use Floating UI for tethering.
151
- - The Canvas runtime dynamically imports the overlay chunk only when a recipe resolves.
152
- - Exposed helpers:
153
- - `createOverlayRecipeFetcher`, `resolveConfigUri`
154
- - `runOverlays`, `showTooltip`, `showHighlight`
155
- - `createAnchorResolver` (works for main DOM + shadow DOM)
311
+ - Fonts, colors, and CSS variables are inherited from the host
312
+ - Tokens can be overridden via `setTokens` or standard CSS:
313
+ - `--syntro-tooltip-bg`, `--syntro-tooltip-fg`, `--syntro-tooltip-radius`
314
+ - `--syntro-ring`, `--syntro-spotlight-backdrop` for highlights
315
+ - A scoped reset is injected via `adoptedStyleSheets`
156
316
 
157
- Telemetry for overlays uses `telemetry.trackAction("syntro_overlay_*", stepId, "overlay")`.
317
+ ---
158
318
 
159
- ### Testing
319
+ ## Schema & Validation
160
320
 
161
- - Shadow root is **open**, so Playwright/Cypress can traverse via `.shadow()`.
162
- - Data hooks: `[data-shadow-canvas-id="overlay-launcher"]`, `[data-shadow-canvas-id="rectangle-${id}"]`, etc.
163
- - `SmartCanvasController` exposes `open/close` for deterministic tests.
321
+ - JSON schema lives at `schema/canvas-config.schema.json`
322
+ - Validate a config file locally:
164
323
 
165
- ### Directory Overview
324
+ ```bash
325
+ cd tech-core/sdks/runtime-sdk
326
+ npm run validate-config -- path/to/config.json
327
+ ```
328
+
329
+ ---
330
+
331
+ ## Documentation
332
+
333
+ - **[APPS.md](./APPS.md)** - App architecture: how to build runtime extensions with actions, schemas, and editor modules
334
+ - **[CAPABILITIES.md](./CAPABILITIES.md)** - Complete reference for all actions, surfaces, and config options
335
+ - **[RUNTIME_V2_REFERENCE.md](./RUNTIME_V2_REFERENCE.md)** - Context, Events, State, Decisions modules
336
+
337
+ ---
338
+
339
+ ## Directory Overview
166
340
 
167
341
  ```
168
- tech-core/sdks/shadow-canvas
342
+ tech-core/sdks/runtime-sdk
169
343
  ├─ src
170
- │ ├─ SmartCanvasElement.tsx // custom element + controller glue
171
- │ ├─ SmartCanvasApp.tsx // React UI
172
- │ ├─ SmartCanvasPortal.tsx // portal helper
173
- │ ├─ api.tsx // window.SmartCanvas + imperative API
174
- ├─ analytics/, experiments/, hooks/, components/
175
- └─ controller.ts
344
+ │ ├─ actions/ # ActionEngine (interventions)
345
+ ├─ types.ts
346
+ ├─ ActionEngine.ts
347
+ ├─ validation.ts
348
+ │ └─ executors/ # visual, dom, navigation executors
349
+ ├─ apps/ # App system (see APPS.md)
350
+ │ │ ├─ AppRegistry.ts # App registration and lifecycle
351
+ │ │ ├─ AppLoader.ts # Dynamic app loading
352
+ │ │ ├─ types.ts # AppManifest, AppContext types
353
+ │ │ └─ built-in/ # Core apps (bundled with runtime)
354
+ │ ├─ surfaces/ # Surfaces (UI rendering)
355
+ │ │ ├─ types.ts
356
+ │ │ ├─ Surfaces.ts
357
+ │ │ └─ positioning.ts
358
+ │ ├─ context/ # Page/session/viewport state
359
+ │ ├─ events/ # EventBus
360
+ │ ├─ state/ # StateStore
361
+ │ ├─ decisions/ # DecisionStrategy evaluation
362
+ │ ├─ runtime.ts # SmartCanvasRuntime factory
363
+ │ ├─ bootstrap.ts # Syntro.init()
364
+ │ ├─ SmartCanvasElement.tsx
365
+ │ ├─ SmartCanvasApp.tsx
366
+ │ └─ SmartCanvasPortal.tsx
367
+ ├─ schema/
368
+ │ └─ canvas-config.schema.json
369
+ ├─ APPS.md
370
+ ├─ CAPABILITIES.md
371
+ ├─ RUNTIME_V2_REFERENCE.md
176
372
  └─ README.md
177
373
  ```
178
374
 
179
- ### Quick Checklist
375
+ ---
376
+
377
+ ## Development Commands
378
+
379
+ ```bash
380
+ # Build TypeScript library
381
+ npm run build:lib
382
+
383
+ # Build CDN bundle
384
+ npm run build:cdn
385
+
386
+ # Full build
387
+ npm run build
388
+
389
+ # Validate a config file
390
+ npm run validate-config -- path/to/config.json
391
+
392
+ # Type check
393
+ npx tsc --noEmit
394
+ ```
395
+
396
+ ---
397
+
398
+ ## Testing
399
+
400
+ - Shadow root is **open**, so Playwright/Cypress can traverse via `.shadow()`
401
+ - Data hooks: `[data-shadow-canvas-id="overlay-launcher"]`, `[data-shadow-canvas-id="rectangle-${id}"]`
402
+ - `SmartCanvasController` exposes `open/close` for deterministic tests
403
+
404
+ ---
405
+
406
+ ## Analytics Events
407
+
408
+ The telemetry client emits:
409
+
410
+ | Event | Description |
411
+ | ----------------------------------------------- | --------------------------------------- |
412
+ | `shadow_canvas_opened` / `shadow_canvas_closed` | Toggle button interactions |
413
+ | `shadow_canvas_rectangle_viewed` | A rectangle becomes visible |
414
+ | `shadow_canvas_action` | CTA click, chatbot send, overlay events |
415
+ | `action.applied` / `action.reverted` | ActionEngine events |
416
+ | `surface.mounted` / `surface.unmounted` | Surfaces events |
417
+
418
+ ---
419
+
420
+ ## Quick Checklist
180
421
 
181
- 1. Call `registerSmartCanvasElement()` once per app.
182
- 2. Render `<smart-canvas>` (custom element).
183
- 3. Portal your React tree into the elements shadow via `SmartCanvasPortal`.
184
- 4. Configure the SDK with your API credentials.
185
- 5. For non-React pages, call `window.SmartCanvas.create()` with configuration.
422
+ 1. Call `registerSmartCanvasElement()` once per app
423
+ 2. Render `<smart-canvas>` (custom element)
424
+ 3. Portal your React tree into the element's shadow via `SmartCanvasPortal`
425
+ 4. Configure the SDK with your API credentials
426
+ 5. Use `runtime.actions` for interventions, `runtime.surfaces` for UI
427
+ 6. For non-React pages, call `window.SmartCanvas.create()` with configuration
@@ -0,0 +1,51 @@
1
+ /**
2
+ * RuntimeProvider - React context for accessing the v2 Runtime.
3
+ *
4
+ * Provides access to the SmartCanvasRuntime from any component in the tree.
5
+ */
6
+ import { ReactNode } from 'react';
7
+ import type { SmartCanvasRuntime } from './runtime';
8
+ import type { RuntimeContext } from './context/types';
9
+ export interface RuntimeProviderProps {
10
+ /** The SmartCanvasRuntime instance */
11
+ runtime: SmartCanvasRuntime | null;
12
+ children: ReactNode;
13
+ }
14
+ /**
15
+ * Provider component for the SmartCanvasRuntime.
16
+ */
17
+ export declare function RuntimeProvider({ runtime, children }: RuntimeProviderProps): import("react/jsx-runtime").JSX.Element;
18
+ /**
19
+ * Hook to access the SmartCanvasRuntime.
20
+ */
21
+ export declare function useRuntime(): SmartCanvasRuntime | null;
22
+ /**
23
+ * Hook to access the current runtime context (reactive).
24
+ */
25
+ export declare function useRuntimeContext(): RuntimeContext | null;
26
+ /**
27
+ * Hook to access a specific part of the runtime context.
28
+ */
29
+ export declare function usePageContext(): import("./context").PageContext | null;
30
+ export declare function useSessionContext(): import("./context").SessionContext | null;
31
+ export declare function useViewportContext(): import("./context").ViewportContext | null;
32
+ /**
33
+ * Hook to subscribe to runtime events.
34
+ */
35
+ export declare function useRuntimeEvents(filter: {
36
+ names?: string[];
37
+ patterns?: string[];
38
+ sources?: Array<'posthog' | 'canvas' | 'derived'>;
39
+ } | undefined, callback: (event: import('./events/types').NormalizedEvent) => void, deps?: React.DependencyList): void;
40
+ /**
41
+ * Hook to access state helpers.
42
+ */
43
+ export declare function useRuntimeState(): import("./state").StateStore | null;
44
+ /**
45
+ * Hook to evaluate a decision strategy.
46
+ */
47
+ export declare function useDecision<T>(strategy: import('./decisions/types').DecisionStrategy<T> | undefined | null, defaultValue: T): {
48
+ value: T;
49
+ isFallback: boolean;
50
+ isLoading: boolean;
51
+ };
@@ -0,0 +1,113 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * RuntimeProvider - React context for accessing the v2 Runtime.
4
+ *
5
+ * Provides access to the SmartCanvasRuntime from any component in the tree.
6
+ */
7
+ import { createContext, useContext, useMemo, useEffect, useState } from 'react';
8
+ const RuntimeReactContext = createContext({
9
+ runtime: null,
10
+ context: null,
11
+ });
12
+ /**
13
+ * Provider component for the SmartCanvasRuntime.
14
+ */
15
+ export function RuntimeProvider({ runtime, children }) {
16
+ // Subscribe to context changes and re-render when they occur
17
+ const [context, setContext] = useState(runtime ? runtime.context.get() : null);
18
+ useEffect(() => {
19
+ if (!runtime)
20
+ return;
21
+ // Set initial context
22
+ setContext(runtime.context.get());
23
+ // Subscribe to changes
24
+ const unsubscribe = runtime.context.subscribe((ctx) => {
25
+ setContext(ctx);
26
+ });
27
+ return unsubscribe;
28
+ }, [runtime]);
29
+ const value = useMemo(() => ({ runtime, context }), [runtime, context]);
30
+ return _jsx(RuntimeReactContext.Provider, { value: value, children: children });
31
+ }
32
+ /**
33
+ * Hook to access the SmartCanvasRuntime.
34
+ */
35
+ export function useRuntime() {
36
+ const { runtime } = useContext(RuntimeReactContext);
37
+ return runtime;
38
+ }
39
+ /**
40
+ * Hook to access the current runtime context (reactive).
41
+ */
42
+ export function useRuntimeContext() {
43
+ const { context } = useContext(RuntimeReactContext);
44
+ return context;
45
+ }
46
+ /**
47
+ * Hook to access a specific part of the runtime context.
48
+ */
49
+ export function usePageContext() {
50
+ var _a;
51
+ const context = useRuntimeContext();
52
+ return (_a = context === null || context === void 0 ? void 0 : context.page) !== null && _a !== void 0 ? _a : null;
53
+ }
54
+ export function useSessionContext() {
55
+ var _a;
56
+ const context = useRuntimeContext();
57
+ return (_a = context === null || context === void 0 ? void 0 : context.session) !== null && _a !== void 0 ? _a : null;
58
+ }
59
+ export function useViewportContext() {
60
+ var _a;
61
+ const context = useRuntimeContext();
62
+ return (_a = context === null || context === void 0 ? void 0 : context.viewport) !== null && _a !== void 0 ? _a : null;
63
+ }
64
+ /**
65
+ * Hook to subscribe to runtime events.
66
+ */
67
+ export function useRuntimeEvents(filter, callback, deps = []) {
68
+ const runtime = useRuntime();
69
+ useEffect(() => {
70
+ if (!runtime)
71
+ return;
72
+ const unsubscribe = filter
73
+ ? runtime.events.subscribe(filter, callback)
74
+ : runtime.events.subscribe(callback);
75
+ return unsubscribe;
76
+ }, [runtime, ...deps]);
77
+ }
78
+ /**
79
+ * Hook to access state helpers.
80
+ */
81
+ export function useRuntimeState() {
82
+ var _a;
83
+ const runtime = useRuntime();
84
+ return (_a = runtime === null || runtime === void 0 ? void 0 : runtime.state) !== null && _a !== void 0 ? _a : null;
85
+ }
86
+ /**
87
+ * Hook to evaluate a decision strategy.
88
+ */
89
+ export function useDecision(strategy, defaultValue) {
90
+ const runtime = useRuntime();
91
+ const [result, setResult] = useState({
92
+ value: defaultValue,
93
+ isFallback: true,
94
+ isLoading: true,
95
+ });
96
+ useEffect(() => {
97
+ if (!runtime || !strategy) {
98
+ setResult({ value: defaultValue, isFallback: true, isLoading: false });
99
+ return;
100
+ }
101
+ let cancelled = false;
102
+ runtime.evaluate(strategy).then((res) => {
103
+ if (!cancelled) {
104
+ setResult({ value: res.value, isFallback: res.isFallback, isLoading: false });
105
+ }
106
+ });
107
+ return () => {
108
+ cancelled = true;
109
+ };
110
+ }, [runtime, strategy, defaultValue]);
111
+ return result;
112
+ }
113
+ //# sourceMappingURL=RuntimeProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RuntimeProvider.js","sourceRoot":"","sources":["../src/RuntimeProvider.tsx"],"names":[],"mappings":"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"}
@@ -1,11 +1,11 @@
1
- import { ReactNode } from "react";
2
- import { SmartCanvasController } from "./controller";
3
- import type { CanvasConfigFetcher } from "./types";
4
- import type { ExperimentClient } from "./experiments/types";
5
- import type { TelemetryClient } from "./telemetry/types";
6
- import type { OverlayRecipeFetcher } from "./overlays/fetcher";
7
- import { MountableComponent } from "./api";
8
- import { CanvasTheme } from "./components/ShadowCanvasOverlay";
1
+ import { ReactNode } from 'react';
2
+ import { SmartCanvasController } from './controller';
3
+ import type { CanvasConfigFetcher } from './types';
4
+ import type { ExperimentClient } from './experiments/types';
5
+ import type { TelemetryClient } from './telemetry/types';
6
+ import { MountableComponent } from './api';
7
+ import { CanvasTheme } from './components/ShadowCanvasOverlay';
8
+ import type { SmartCanvasRuntime } from './runtime';
9
9
  export interface SmartCanvasAppProps {
10
10
  controller: SmartCanvasController;
11
11
  fetcher?: CanvasConfigFetcher;
@@ -16,9 +16,15 @@ export interface SmartCanvasAppProps {
16
16
  pollIntervalMs?: number;
17
17
  experiments?: ExperimentClient;
18
18
  telemetry?: TelemetryClient;
19
- overlayFetcher?: OverlayRecipeFetcher;
19
+ /** v2 Runtime instance for context, events, state, and decisions */
20
+ runtime?: SmartCanvasRuntime;
21
+ /** @deprecated Actions replace overlay recipes. Use config.actions instead. */
22
+ overlayFetcher?: () => Promise<unknown>;
23
+ /** @deprecated Actions replace overlay recipes. Use config.actions instead. */
20
24
  overlayConfigUri?: string;
25
+ /** @deprecated Actions replace overlay recipes. Use config.actions instead. */
21
26
  overlayConfigFeatureKey?: string;
27
+ /** @deprecated Actions replace overlay recipes. Use config.actions instead. */
22
28
  overlayFetchCredentials?: RequestCredentials;
23
29
  footerSlot?: ReactNode;
24
30
  launcherLabel?: string;
@@ -26,4 +32,4 @@ export interface SmartCanvasAppProps {
26
32
  customRenderers?: Record<string, MountableComponent>;
27
33
  theme?: Partial<CanvasTheme>;
28
34
  }
29
- export declare function SmartCanvasApp({ controller, fetcher, configUri, configUriFeatureKey, configFeatureKey, fetchCredentials, pollIntervalMs, experiments, telemetry, overlayFetcher, overlayConfigUri, overlayConfigFeatureKey, overlayFetchCredentials, footerSlot, launcherLabel, canvasHost, customRenderers, theme, }: SmartCanvasAppProps): import("react/jsx-runtime").JSX.Element | null;
35
+ export declare function SmartCanvasApp({ controller, fetcher, configUri, configUriFeatureKey, configFeatureKey, fetchCredentials, pollIntervalMs, experiments, telemetry, runtime, overlayFetcher, overlayConfigUri, overlayConfigFeatureKey, overlayFetchCredentials, footerSlot, launcherLabel, canvasHost, customRenderers, theme, }: SmartCanvasAppProps): import("react/jsx-runtime").JSX.Element;