@syntrologie/adapt-overlays 2.15.0 → 2.17.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 (226) hide show
  1. package/dist/chunk-VHAA22YE.js +14 -0
  2. package/dist/chunk-VHAA22YE.js.map +7 -0
  3. package/dist/runtime.d.ts +2 -1
  4. package/dist/runtime.d.ts.map +1 -1
  5. package/dist/runtime.js +2596 -354
  6. package/dist/runtime.js.map +7 -0
  7. package/dist/schema.d.ts +90 -21
  8. package/dist/schema.d.ts.map +1 -1
  9. package/dist/schema.js +440 -151
  10. package/dist/schema.js.map +7 -0
  11. package/dist/types.d.ts +1 -1
  12. package/dist/types.d.ts.map +1 -1
  13. package/package.json +5 -22
  14. package/dist/WorkflowTracker.d.ts +0 -10
  15. package/dist/WorkflowTracker.d.ts.map +0 -1
  16. package/dist/WorkflowTracker.js +0 -19
  17. package/dist/WorkflowWidget.d.ts +0 -70
  18. package/dist/WorkflowWidget.d.ts.map +0 -1
  19. package/dist/WorkflowWidget.js +0 -330
  20. package/dist/WorkflowWidgetLit.js +0 -617
  21. package/dist/cdn.d.ts +0 -35
  22. package/dist/cdn.d.ts.map +0 -1
  23. package/dist/cdn.js +0 -39
  24. package/dist/celebrations/__tests__/engine.test.js +0 -130
  25. package/dist/celebrations/__tests__/executor.test.js +0 -102
  26. package/dist/celebrations/__tests__/reduced-motion.test.js +0 -97
  27. package/dist/celebrations/effects/__tests__/confetti.test.js +0 -89
  28. package/dist/celebrations/effects/__tests__/emoji-rain.test.js +0 -88
  29. package/dist/celebrations/effects/__tests__/fireworks.test.js +0 -87
  30. package/dist/celebrations/effects/__tests__/sparkles.test.js +0 -79
  31. package/dist/celebrations/effects/confetti.js +0 -80
  32. package/dist/celebrations/effects/emoji-rain.js +0 -73
  33. package/dist/celebrations/effects/fireworks.js +0 -69
  34. package/dist/celebrations/effects/sparkles.js +0 -83
  35. package/dist/celebrations/engine.js +0 -93
  36. package/dist/celebrations/index.js +0 -73
  37. package/dist/celebrations/types.js +0 -1
  38. package/dist/editor.d.ts +0 -27
  39. package/dist/editor.d.ts.map +0 -1
  40. package/dist/editor.js +0 -22
  41. package/dist/executors/tour.js +0 -335
  42. package/dist/highlight.js +0 -180
  43. package/dist/modal.js +0 -218
  44. package/dist/overlay-editor-state.d.ts +0 -41
  45. package/dist/overlay-editor-state.d.ts.map +0 -1
  46. package/dist/overlay-editor-state.js +0 -131
  47. package/dist/overlay-editor-ui.d.ts +0 -9
  48. package/dist/overlay-editor-ui.d.ts.map +0 -1
  49. package/dist/overlay-editor-ui.js +0 -306
  50. package/dist/runtime-lit.d.ts +0 -94
  51. package/dist/runtime-lit.d.ts.map +0 -1
  52. package/dist/runtime-lit.js +0 -402
  53. package/dist/sanitizer.js +0 -84
  54. package/dist/summarize.js +0 -86
  55. package/dist/tooltip.js +0 -279
  56. package/dist/tour-types.js +0 -7
  57. package/dist/types.js +0 -7
  58. package/dist/workflow-types.js +0 -1
  59. package/node_modules/@syntro/design-system/README.md +0 -335
  60. package/node_modules/@syntro/design-system/dist/assets/syntrologie-logo.svg +0 -21
  61. package/node_modules/@syntro/design-system/dist/assets/syntrologie-logomark.svg +0 -10
  62. package/node_modules/@syntro/design-system/dist/index.d.ts +0 -8
  63. package/node_modules/@syntro/design-system/dist/index.d.ts.map +0 -1
  64. package/node_modules/@syntro/design-system/dist/index.js +0 -7
  65. package/node_modules/@syntro/design-system/dist/tailwind-preset.d.ts +0 -19
  66. package/node_modules/@syntro/design-system/dist/tailwind-preset.d.ts.map +0 -1
  67. package/node_modules/@syntro/design-system/dist/tailwind-preset.js +0 -455
  68. package/node_modules/@syntro/design-system/dist/tokens/colors.css +0 -464
  69. package/node_modules/@syntro/design-system/dist/tokens/colors.d.ts +0 -874
  70. package/node_modules/@syntro/design-system/dist/tokens/colors.d.ts.map +0 -1
  71. package/node_modules/@syntro/design-system/dist/tokens/colors.js +0 -564
  72. package/node_modules/@syntro/design-system/dist/tokens/effects.css +0 -43
  73. package/node_modules/@syntro/design-system/dist/tokens/effects.d.ts +0 -139
  74. package/node_modules/@syntro/design-system/dist/tokens/effects.d.ts.map +0 -1
  75. package/node_modules/@syntro/design-system/dist/tokens/effects.js +0 -121
  76. package/node_modules/@syntro/design-system/dist/tokens/index.d.ts +0 -12
  77. package/node_modules/@syntro/design-system/dist/tokens/index.d.ts.map +0 -1
  78. package/node_modules/@syntro/design-system/dist/tokens/index.js +0 -11
  79. package/node_modules/@syntro/design-system/dist/tokens/panel-shell.d.ts +0 -93
  80. package/node_modules/@syntro/design-system/dist/tokens/panel-shell.d.ts.map +0 -1
  81. package/node_modules/@syntro/design-system/dist/tokens/panel-shell.js +0 -72
  82. package/node_modules/@syntro/design-system/package.json +0 -55
  83. package/node_modules/@syntro/design-system/src/assets/syntrologie-logo.svg +0 -21
  84. package/node_modules/@syntro/design-system/src/assets/syntrologie-logomark.svg +0 -10
  85. package/node_modules/@syntrologie/shared-editor-ui/dist/cn.d.ts +0 -2
  86. package/node_modules/@syntrologie/shared-editor-ui/dist/cn.d.ts.map +0 -1
  87. package/node_modules/@syntrologie/shared-editor-ui/dist/cn.js +0 -3
  88. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.d.ts +0 -34
  89. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.d.ts.map +0 -1
  90. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.js +0 -161
  91. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPickerLit.d.ts +0 -84
  92. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPickerLit.d.ts.map +0 -1
  93. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPickerLit.js +0 -323
  94. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.d.ts +0 -7
  95. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.d.ts.map +0 -1
  96. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.js +0 -9
  97. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggleLit.d.ts +0 -25
  98. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggleLit.d.ts.map +0 -1
  99. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggleLit.js +0 -55
  100. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts +0 -23
  101. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts.map +0 -1
  102. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.js +0 -40
  103. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLineLit.d.ts +0 -33
  104. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLineLit.d.ts.map +0 -1
  105. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLineLit.js +0 -118
  106. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.d.ts +0 -7
  107. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.d.ts.map +0 -1
  108. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.js +0 -22
  109. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadgeLit.d.ts +0 -32
  110. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadgeLit.d.ts.map +0 -1
  111. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadgeLit.js +0 -68
  112. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.d.ts +0 -8
  113. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.d.ts.map +0 -1
  114. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.js +0 -9
  115. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSectionLit.d.ts +0 -34
  116. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSectionLit.d.ts.map +0 -1
  117. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSectionLit.js +0 -57
  118. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.d.ts +0 -7
  119. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.d.ts.map +0 -1
  120. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.js +0 -4
  121. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButtonLit.d.ts +0 -13
  122. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButtonLit.d.ts.map +0 -1
  123. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButtonLit.js +0 -31
  124. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.d.ts +0 -7
  125. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.d.ts.map +0 -1
  126. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.js +0 -4
  127. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBodyLit.d.ts +0 -7
  128. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBodyLit.d.ts.map +0 -1
  129. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBodyLit.js +0 -15
  130. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.d.ts +0 -13
  131. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.d.ts.map +0 -1
  132. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.js +0 -15
  133. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCardLit.d.ts +0 -36
  134. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCardLit.d.ts.map +0 -1
  135. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCardLit.js +0 -102
  136. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.d.ts +0 -7
  137. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.d.ts.map +0 -1
  138. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.js +0 -4
  139. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooterLit.d.ts +0 -20
  140. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooterLit.d.ts.map +0 -1
  141. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooterLit.js +0 -48
  142. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.d.ts +0 -9
  143. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.d.ts.map +0 -1
  144. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.js +0 -4
  145. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeaderLit.d.ts +0 -16
  146. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeaderLit.d.ts.map +0 -1
  147. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeaderLit.js +0 -25
  148. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.d.ts +0 -8
  149. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.d.ts.map +0 -1
  150. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.js +0 -8
  151. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInputLit.d.ts +0 -66
  152. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInputLit.d.ts.map +0 -1
  153. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInputLit.js +0 -87
  154. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.d.ts +0 -7
  155. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.d.ts.map +0 -1
  156. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.js +0 -4
  157. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayoutLit.d.ts +0 -7
  158. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayoutLit.d.ts.map +0 -1
  159. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayoutLit.js +0 -15
  160. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts +0 -25
  161. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts.map +0 -1
  162. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.js +0 -390
  163. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShellLit.d.ts +0 -66
  164. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShellLit.d.ts.map +0 -1
  165. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShellLit.js +0 -528
  166. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.d.ts +0 -8
  167. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.d.ts.map +0 -1
  168. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.js +0 -8
  169. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelectLit.d.ts +0 -41
  170. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelectLit.d.ts.map +0 -1
  171. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelectLit.js +0 -63
  172. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.d.ts +0 -8
  173. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.d.ts.map +0 -1
  174. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.js +0 -17
  175. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextareaLit.d.ts +0 -55
  176. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextareaLit.d.ts.map +0 -1
  177. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextareaLit.js +0 -92
  178. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.d.ts +0 -32
  179. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.d.ts.map +0 -1
  180. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.js +0 -85
  181. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlightLit.d.ts +0 -90
  182. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlightLit.d.ts.map +0 -1
  183. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlightLit.js +0 -242
  184. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.d.ts +0 -6
  185. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.d.ts.map +0 -1
  186. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.js +0 -4
  187. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyStateLit.d.ts +0 -12
  188. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyStateLit.d.ts.map +0 -1
  189. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyStateLit.js +0 -21
  190. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.d.ts +0 -8
  191. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.d.ts.map +0 -1
  192. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.js +0 -5
  193. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeaderLit.d.ts +0 -21
  194. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeaderLit.d.ts.map +0 -1
  195. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeaderLit.js +0 -33
  196. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts +0 -12
  197. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts.map +0 -1
  198. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.js +0 -40
  199. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourneyLit.d.ts +0 -28
  200. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourneyLit.d.ts.map +0 -1
  201. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourneyLit.js +0 -121
  202. package/node_modules/@syntrologie/shared-editor-ui/dist/controllers/PanelShellController.d.ts +0 -110
  203. package/node_modules/@syntrologie/shared-editor-ui/dist/controllers/PanelShellController.d.ts.map +0 -1
  204. package/node_modules/@syntrologie/shared-editor-ui/dist/controllers/PanelShellController.js +0 -476
  205. package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts +0 -26
  206. package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts.map +0 -1
  207. package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.js +0 -202
  208. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.d.ts +0 -8
  209. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.d.ts.map +0 -1
  210. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.js +0 -46
  211. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.d.ts +0 -24
  212. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.d.ts.map +0 -1
  213. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.js +0 -86
  214. package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts +0 -36
  215. package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts.map +0 -1
  216. package/node_modules/@syntrologie/shared-editor-ui/dist/index.js +0 -26
  217. package/node_modules/@syntrologie/shared-editor-ui/dist/lit-elements.d.ts +0 -15
  218. package/node_modules/@syntrologie/shared-editor-ui/dist/lit-elements.d.ts.map +0 -1
  219. package/node_modules/@syntrologie/shared-editor-ui/dist/lit-elements.js +0 -14
  220. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.d.ts +0 -33
  221. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.d.ts.map +0 -1
  222. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.js +0 -68
  223. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.d.ts +0 -22
  224. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.d.ts.map +0 -1
  225. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.js +0 -143
  226. package/node_modules/@syntrologie/shared-editor-ui/package.json +0 -55
@@ -1,330 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- /**
3
- * Workflow Widget - MountableWidget for the WorkflowTracker
4
- *
5
- * Bridges runtime.actions.getActive() (tour actions with workflow metadata),
6
- * runtime events (tour.started, tour.step_started, etc.), and the
7
- * WorkflowTracker presentational component.
8
- *
9
- * Responsibilities:
10
- * 1. Scan runtime.actions.getActive() for tours with `workflow` field
11
- * 2. Re-scan on tour.started events (tiles render before actions are applied)
12
- * 3. Load persisted state from runtime.state.user namespace
13
- * 4. Subscribe to tour.* events and update workflow entries
14
- * 5. Render WorkflowTracker with derived workflow entries
15
- * 6. Handle step clicks (publish workflow:jump_to_step)
16
- * 7. Handle dismiss (persist and re-render)
17
- */
18
- import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
19
- import { createRoot } from 'react-dom/client';
20
- import { WorkflowTracker } from './WorkflowTracker';
21
- // ============================================================================
22
- // Helpers
23
- // ============================================================================
24
- /**
25
- * Show a toast notification for a workflow tour.
26
- * Creates a DOM element, appends it to the container, and auto-removes after 4 seconds.
27
- */
28
- function showWorkflowToast(notification) {
29
- const toast = document.createElement('div');
30
- toast.setAttribute('data-testid', 'workflow-toast');
31
- toast.className = 'se-fixed se-bottom-4 se-right-4 se-z-50';
32
- Object.assign(toast.style, {
33
- position: 'fixed',
34
- bottom: '16px',
35
- right: '16px',
36
- zIndex: '2147483646',
37
- padding: '12px 16px',
38
- borderRadius: '8px',
39
- backgroundColor: 'var(--se-color-bg-surface, #fff)',
40
- color: 'var(--se-color-text-primary, #1a1a1a)',
41
- boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',
42
- maxWidth: '320px',
43
- fontFamily: 'var(--se-font-family, system-ui, sans-serif)',
44
- fontSize: '14px',
45
- lineHeight: '1.4',
46
- transition: 'opacity 0.3s ease',
47
- });
48
- const titleEl = document.createElement('div');
49
- titleEl.className = 'se-font-semibold';
50
- titleEl.style.fontWeight = '600';
51
- titleEl.textContent = notification.title;
52
- toast.appendChild(titleEl);
53
- if (notification.body) {
54
- const bodyEl = document.createElement('div');
55
- bodyEl.className = 'se-mt-1 se-text-sm';
56
- bodyEl.style.marginTop = '4px';
57
- bodyEl.style.fontSize = '13px';
58
- bodyEl.style.color = 'var(--se-color-text-secondary, #666)';
59
- bodyEl.textContent = notification.body;
60
- toast.appendChild(bodyEl);
61
- }
62
- // Append to document.body so the toast is visible at the viewport level
63
- // (the container is inside shadow DOM, where position:fixed is scoped)
64
- document.body.appendChild(toast);
65
- // Auto-remove after 4 seconds
66
- let removeTimer;
67
- const fadeTimer = setTimeout(() => {
68
- toast.style.opacity = '0';
69
- removeTimer = setTimeout(() => {
70
- toast.remove();
71
- }, 300);
72
- }, 4000);
73
- // Return cleanup function for unmount safety
74
- return () => {
75
- clearTimeout(fadeTimer);
76
- clearTimeout(removeTimer);
77
- toast.remove();
78
- };
79
- }
80
- /**
81
- * Extract workflow-enabled tours from active actions (runtime.actions.getActive()).
82
- * Only actions with kind 'overlays:tour', a tourId, and a workflow field are included.
83
- */
84
- function extractWorkflowsFromActive(activeActions) {
85
- const workflows = new Map();
86
- for (const entry of activeActions) {
87
- const action = entry.action;
88
- if (action.kind === 'overlays:tour' && action.workflow && action.tourId) {
89
- const meta = action.workflow;
90
- const rawSteps = action.steps || [];
91
- const steps = rawSteps.map((s) => ({
92
- id: s.id,
93
- title: meta.stepTitles?.[s.id] || s.id,
94
- }));
95
- workflows.set(action.tourId, { meta, steps });
96
- }
97
- }
98
- return workflows;
99
- }
100
- export function WorkflowWidgetInner({ runtime }) {
101
- // Scan active actions for workflow-enabled tours.
102
- // Re-scans when actionVersion bumps (triggered by tour.started events).
103
- const [actionVersion, setActionVersion] = useState(0);
104
- // biome-ignore lint/correctness/useExhaustiveDependencies: actionVersion is an intentional cache-buster that triggers re-scan when tour.started events fire
105
- const tourWorkflows = useMemo(() => {
106
- const active = runtime?.actions?.getActive?.() || [];
107
- return extractWorkflowsFromActive(active);
108
- }, [runtime, actionVersion]);
109
- // Keep a ref so event handlers always see the latest tourWorkflows
110
- const tourWorkflowsRef = useRef(tourWorkflows);
111
- tourWorkflowsRef.current = tourWorkflows;
112
- // Re-scan active actions when a tour starts (handles tile-renders-before-actions timing)
113
- useEffect(() => {
114
- if (!runtime?.events?.subscribe)
115
- return;
116
- return runtime.events.subscribe({ names: ['tour.started', 'tour.resumed'] }, () => setActionVersion((v) => v + 1));
117
- }, [runtime]);
118
- // Load persisted state
119
- const stateNs = useMemo(() => runtime?.state?.user?.ns?.('workflows'), [runtime]);
120
- // Ref to track which tours have had a toast notification
121
- const notifiedRef = useRef(new Set());
122
- // Ref to track toast cleanup functions for unmount safety
123
- const toastCleanupsRef = useRef([]);
124
- // Ref to track the container element for toast rendering
125
- const containerRef = useRef(null);
126
- // Ref to track completed tour timestamps
127
- const completedMapRef = useRef({});
128
- // Build workflow entries from discovered tours + persisted state
129
- const [workflowEntries, setWorkflowEntries] = useState([]);
130
- // Initialize persisted state refs once
131
- const persistInitialized = useRef(false);
132
- if (!persistInitialized.current && stateNs) {
133
- const notified = stateNs.get?.('notified') || [];
134
- for (const id of notified) {
135
- notifiedRef.current.add(id);
136
- }
137
- const completed = stateNs.get?.('completed') || {};
138
- completedMapRef.current = { ...completed };
139
- persistInitialized.current = true;
140
- }
141
- // Sync workflowEntries when tourWorkflows changes (new tours discovered via getActive)
142
- useEffect(() => {
143
- if (tourWorkflows.size === 0)
144
- return;
145
- const dismissed = stateNs?.get?.('dismissed') || [];
146
- const completed = stateNs?.get?.('completed') || {};
147
- setWorkflowEntries((prev) => {
148
- const existingIds = new Set(prev.map((e) => e.tourId));
149
- const newEntries = [];
150
- for (const [tourId, { meta, steps }] of tourWorkflows) {
151
- if (existingIds.has(tourId))
152
- continue; // Already tracked
153
- let status = 'active';
154
- if (dismissed.includes(tourId)) {
155
- status = 'dismissed';
156
- }
157
- else if (completed[tourId]) {
158
- status = 'completed';
159
- }
160
- newEntries.push({
161
- tourId,
162
- meta,
163
- steps,
164
- currentStepId: null,
165
- completedSteps: [],
166
- status,
167
- completedAt: completed[tourId] || undefined,
168
- });
169
- }
170
- return newEntries.length > 0 ? [...prev, ...newEntries] : prev;
171
- });
172
- // Fire toast for newly discovered active tours.
173
- // This handles the race condition where tour.started fires before the
174
- // widget discovers the tour via getActive() re-scan.
175
- for (const [tourId, { meta }] of tourWorkflows) {
176
- if (!notifiedRef.current.has(tourId) &&
177
- meta.notification &&
178
- !dismissed.includes(tourId) &&
179
- !completed[tourId]) {
180
- notifiedRef.current.add(tourId);
181
- stateNs?.set?.('notified', [...notifiedRef.current]);
182
- const cleanup = showWorkflowToast(meta.notification);
183
- toastCleanupsRef.current.push(cleanup);
184
- }
185
- }
186
- }, [tourWorkflows, stateNs]);
187
- // Subscribe to tour events
188
- useEffect(() => {
189
- if (!runtime?.events?.subscribe)
190
- return;
191
- const unsubscribe = runtime.events.subscribe({ patterns: ['^tour\\.'] }, (event) => {
192
- const tourId = event.props?.tourId;
193
- if (!tourId)
194
- return;
195
- // Re-scan active actions on tour.started (handles tile-renders-before-actions timing)
196
- const currentWorkflows = tourWorkflowsRef.current;
197
- if (!currentWorkflows.has(tourId) && event.name === 'tour.started') {
198
- // Tour just became active — re-scan will pick it up on next render
199
- setActionVersion((v) => v + 1);
200
- return;
201
- }
202
- // Only process events for tours that have workflow metadata
203
- if (!currentWorkflows.has(tourId))
204
- return;
205
- setWorkflowEntries((prev) => {
206
- const updated = prev.map((entry) => {
207
- if (entry.tourId !== tourId)
208
- return entry;
209
- switch (event.name) {
210
- case 'tour.started': {
211
- const startStepId = event.props?.startStepId || entry.steps[0]?.id || null;
212
- // Fire toast notification if not already notified
213
- if (!notifiedRef.current.has(tourId)) {
214
- notifiedRef.current.add(tourId);
215
- stateNs?.set?.('notified', [...notifiedRef.current]);
216
- const workflow = currentWorkflows.get(tourId);
217
- if (workflow?.meta.notification) {
218
- const cleanup = showWorkflowToast(workflow.meta.notification);
219
- toastCleanupsRef.current.push(cleanup);
220
- }
221
- }
222
- // Persist active state
223
- const activeIds = prev
224
- .filter((e) => e.status === 'active' || e.tourId === tourId)
225
- .map((e) => e.tourId);
226
- if (!activeIds.includes(tourId)) {
227
- activeIds.push(tourId);
228
- }
229
- stateNs?.set?.('active', [...new Set(activeIds)]);
230
- return {
231
- ...entry,
232
- status: 'active',
233
- currentStepId: startStepId,
234
- completedSteps: entry.status === 'active' ? entry.completedSteps : [],
235
- };
236
- }
237
- case 'tour.step_started': {
238
- const stepId = event.props?.stepId;
239
- return {
240
- ...entry,
241
- currentStepId: stepId || entry.currentStepId,
242
- };
243
- }
244
- case 'tour.step_changed': {
245
- const previousStepId = event.props?.previousStepId;
246
- const nextStepId = event.props?.nextStepId;
247
- const completedSteps = previousStepId && !entry.completedSteps.includes(previousStepId)
248
- ? [...entry.completedSteps, previousStepId]
249
- : entry.completedSteps;
250
- return {
251
- ...entry,
252
- currentStepId: nextStepId || entry.currentStepId,
253
- completedSteps,
254
- };
255
- }
256
- case 'tour.completed': {
257
- const completedAt = Date.now();
258
- // Persist completed state with timestamp
259
- completedMapRef.current[tourId] = completedAt;
260
- stateNs?.set?.('completed', { ...completedMapRef.current });
261
- return {
262
- ...entry,
263
- status: 'completed',
264
- currentStepId: null,
265
- completedSteps: entry.steps.map((s) => s.id),
266
- completedAt,
267
- };
268
- }
269
- case 'tour.paused': {
270
- // Keep current state, just note it was paused
271
- return entry;
272
- }
273
- default:
274
- return entry;
275
- }
276
- });
277
- return updated;
278
- });
279
- });
280
- return () => {
281
- unsubscribe();
282
- // Clean up any pending toast timers
283
- for (const cleanup of toastCleanupsRef.current) {
284
- cleanup();
285
- }
286
- toastCleanupsRef.current = [];
287
- };
288
- }, [runtime, stateNs]);
289
- // Handle step click — publish jump event
290
- const handleStepClick = useCallback((tourId, stepId) => {
291
- runtime?.events?.publish?.('workflow:jump_to_step', { tourId, stepId });
292
- }, [runtime]);
293
- // Handle dismiss
294
- const handleDismiss = useCallback((tourId) => {
295
- setWorkflowEntries((prev) => {
296
- const updated = prev.map((entry) => entry.tourId === tourId ? { ...entry, status: 'dismissed' } : entry);
297
- // Persist dismissed state
298
- const dismissedIds = updated.filter((e) => e.status === 'dismissed').map((e) => e.tourId);
299
- stateNs?.set?.('dismissed', dismissedIds);
300
- return updated;
301
- });
302
- }, [stateNs]);
303
- // Filter to active workflows only for rendering
304
- const activeWorkflows = useMemo(() => workflowEntries.filter((w) => w.status === 'active'), [workflowEntries]);
305
- return (_jsx("div", { ref: containerRef, children: _jsx(WorkflowTracker, { workflows: activeWorkflows, onStepClick: handleStepClick, onDismiss: handleDismiss }) }));
306
- }
307
- // ============================================================================
308
- // MountableWidget Interface
309
- // ============================================================================
310
- /**
311
- * Mountable widget interface for the runtime's WidgetRegistry.
312
- *
313
- * Follows the MountableWidget contract:
314
- * mount(container, config?) -> cleanup | void
315
- *
316
- * Config is enriched with `runtime` by WidgetRegistry.bindRuntime().
317
- */
318
- export const WorkflowMountableWidget = {
319
- mount(container, config) {
320
- const runtime = config?.runtime || null;
321
- const root = createRoot(container);
322
- root.render(React.createElement(WorkflowWidgetInner, {
323
- runtime,
324
- }));
325
- // Return cleanup function
326
- return () => {
327
- root.unmount();
328
- };
329
- },
330
- };