@syntrologie/adapt-overlays 2.16.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 -481
  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,202 +0,0 @@
1
- /**
2
- * Format a triggerWhen condition into a human-readable label.
3
- * Pure function — no runtime dependency.
4
- */
5
- /**
6
- * Format match criteria as a parenthetical string.
7
- * { tagName: 'a' } → '(tagName: a)'
8
- */
9
- function _formatMatch(match) {
10
- if (!match || Object.keys(match).length === 0)
11
- return '';
12
- const parts = Object.entries(match).map(([k, v]) => `${k}: ${v}`);
13
- return ` (${parts.join(', ')})`;
14
- }
15
- /**
16
- * Format an operator for display.
17
- */
18
- function formatOperator(op) {
19
- switch (op) {
20
- case 'gte':
21
- return '\u2265'; // ≥
22
- case 'lte':
23
- return '\u2264'; // ≤
24
- case 'gt':
25
- return '>';
26
- case 'lt':
27
- return '<';
28
- case 'eq':
29
- return '=';
30
- default:
31
- return op;
32
- }
33
- }
34
- /**
35
- * Convert a hyphenated or underscored key into human-readable lowercase text.
36
- * e.g. "fine-arts-page-views" → "fine arts page views"
37
- */
38
- function humanizeKey(key) {
39
- return key.replace(/[-_]/g, ' ').toLowerCase();
40
- }
41
- /**
42
- * Strip trailing wildcard segments from a URL path.
43
- * e.g. "/fine-arts/**" → "/fine-arts/"
44
- */
45
- function cleanUrl(url) {
46
- return url.replace(/\/?\*+$/, '/').replace(/\/\/$/, '/');
47
- }
48
- // Pre-compiled regexes for event_count classification
49
- const PAGE_VIEW_RE = /page.?view/i;
50
- const CLICK_RE = /click/i;
51
- /**
52
- * Convert a Condition object into a human-readable label.
53
- * For event_count conditions, also returns progress data.
54
- */
55
- export function formatConditionLabel(condition, accumulatorCount) {
56
- switch (condition.type) {
57
- case 'event_count': {
58
- const key = condition.key;
59
- const op = condition.operator;
60
- const target = condition.count;
61
- const current = accumulatorCount ?? 0;
62
- const humanized = humanizeKey(key);
63
- let instruction;
64
- let shortLabel;
65
- if (PAGE_VIEW_RE.test(humanized)) {
66
- // Extract the topic by removing "page view(s)" from the humanized key
67
- const topic = humanized.replace(/\s*page\s*views?\s*/i, '').trim();
68
- instruction = topic
69
- ? `View ${topic} pages ${target}+ times`
70
- : `View pages ${target}+ times`;
71
- shortLabel = `View ${target}+ times`;
72
- }
73
- else if (CLICK_RE.test(humanized)) {
74
- const topic = humanized.replace(/\s*clicks?\s*/i, '').trim();
75
- instruction = topic ? `Click ${topic} ${target}+ times` : `Click ${target}+ times`;
76
- shortLabel = `${target}+ clicks`;
77
- }
78
- else {
79
- // Generic event
80
- const lastWord = humanized
81
- .trim()
82
- .split(' ')
83
- .filter((w) => w)
84
- .pop() || 'events';
85
- instruction = `Reach ${target}+ ${humanized} events`;
86
- shortLabel = `${target}+ ${lastWord}s`;
87
- }
88
- return {
89
- label: `${key} ${formatOperator(op)} ${target}`,
90
- instruction,
91
- shortLabel,
92
- progress: { current, target, operator: op },
93
- };
94
- }
95
- case 'page_url': {
96
- const url = condition.url;
97
- const cleaned = cleanUrl(url);
98
- const hasWildcard = url !== cleaned;
99
- const instruction = hasWildcard ? `Visit a ${cleaned} page` : `Visit ${cleaned}`;
100
- return {
101
- label: `${url}`,
102
- instruction,
103
- shortLabel: cleaned,
104
- };
105
- }
106
- case 'anchor_visible': {
107
- const rawAnchor = condition.anchorId;
108
- const anchorId = typeof rawAnchor === 'string'
109
- ? rawAnchor
110
- : (rawAnchor?.selector ?? '');
111
- const state = condition.state;
112
- return {
113
- label: `${anchorId} (${state})`,
114
- instruction: `Scroll until ${anchorId} is ${state}`,
115
- shortLabel: `${anchorId}`,
116
- };
117
- }
118
- case 'event_occurred': {
119
- const eventName = condition.eventName;
120
- return {
121
- label: `${eventName}`,
122
- instruction: `Trigger a ${eventName} event`,
123
- shortLabel: `${eventName}`,
124
- };
125
- }
126
- case 'state_equals': {
127
- const key = condition.key;
128
- const val = condition.value === undefined ? 'undefined' : JSON.stringify(condition.value);
129
- return {
130
- label: `${key} = ${val}`,
131
- instruction: `${key} equals ${val}`,
132
- shortLabel: `${key}`,
133
- };
134
- }
135
- case 'viewport': {
136
- const parts = [];
137
- if (condition.minWidth !== undefined)
138
- parts.push(`w ${formatOperator('gte')} ${condition.minWidth}px`);
139
- if (condition.maxWidth !== undefined)
140
- parts.push(`w ${formatOperator('lte')} ${condition.maxWidth}px`);
141
- if (condition.minHeight !== undefined)
142
- parts.push(`h ${formatOperator('gte')} ${condition.minHeight}px`);
143
- if (condition.maxHeight !== undefined)
144
- parts.push(`h ${formatOperator('lte')} ${condition.maxHeight}px`);
145
- const label = parts.join(', ') || 'any viewport';
146
- const instruction = parts.length > 0 ? `Use a viewport ${parts.join(' and ')}` : 'Use a viewport of any size';
147
- const shortLabel = parts.length > 0 ? parts[0] : 'Any size';
148
- return { label, instruction, shortLabel };
149
- }
150
- case 'session_metric': {
151
- const key = condition.key;
152
- const op = condition.operator;
153
- const threshold = condition.threshold;
154
- return {
155
- label: `${key} ${formatOperator(op)} ${threshold}`,
156
- instruction: `${key} reaches ${threshold}+`,
157
- shortLabel: `${key} ${threshold}+`,
158
- };
159
- }
160
- case 'dismissed': {
161
- const inverted = condition.inverted;
162
- const key = condition.key;
163
- const target = key || 'this';
164
- return {
165
- label: inverted ? 'not dismissed' : 'dismissed',
166
- instruction: inverted ? `Do not dismiss ${target}` : `Dismiss ${target}`,
167
- shortLabel: inverted ? 'Not dismissed' : 'Dismissed',
168
- };
169
- }
170
- case 'cooldown_active': {
171
- const inverted = condition.inverted;
172
- return {
173
- label: inverted ? 'cooldown inactive' : 'cooldown active',
174
- instruction: inverted ? 'Wait for cooldown to expire' : 'Cooldown is active',
175
- shortLabel: inverted ? 'Cooldown done' : 'Cooldown active',
176
- };
177
- }
178
- case 'frequency_limit': {
179
- const inverted = condition.inverted;
180
- const limit = condition.limit;
181
- return {
182
- label: `shown ${formatOperator(inverted ? 'lt' : 'gte')} ${limit} times`,
183
- instruction: inverted ? `Shown fewer than ${limit} times` : `Shown ${limit}+ times`,
184
- shortLabel: inverted ? `< ${limit} views` : `${limit}+ views`,
185
- };
186
- }
187
- case 'route': {
188
- const routeId = condition.routeId;
189
- return {
190
- label: `${routeId}`,
191
- instruction: `Navigate to ${routeId} route`,
192
- shortLabel: `${routeId}`,
193
- };
194
- }
195
- default:
196
- return {
197
- label: `${condition.type}`,
198
- instruction: `${condition.type}`,
199
- shortLabel: `${condition.type}`,
200
- };
201
- }
202
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * Returns a live DOMRect for an element, updating on scroll, resize,
3
- * and element size changes.
4
- *
5
- * Uses requestAnimationFrame to batch updates and avoid layout thrashing.
6
- */
7
- export declare function useElementRect(element: HTMLElement | null): DOMRect | null;
8
- //# sourceMappingURL=useElementRect.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useElementRect.d.ts","sourceRoot":"","sources":["../../src/hooks/useElementRect.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI,CA6C1E"}
@@ -1,46 +0,0 @@
1
- import { useCallback, useEffect, useState } from 'react';
2
- /**
3
- * Returns a live DOMRect for an element, updating on scroll, resize,
4
- * and element size changes.
5
- *
6
- * Uses requestAnimationFrame to batch updates and avoid layout thrashing.
7
- */
8
- export function useElementRect(element) {
9
- const [rect, setRect] = useState(null);
10
- const update = useCallback(() => {
11
- if (element) {
12
- setRect(element.getBoundingClientRect());
13
- }
14
- }, [element]);
15
- useEffect(() => {
16
- if (!element) {
17
- setRect(null);
18
- return;
19
- }
20
- // Initial measurement
21
- setRect(element.getBoundingClientRect());
22
- let rafId = null;
23
- const scheduleUpdate = () => {
24
- if (rafId != null)
25
- return;
26
- rafId = requestAnimationFrame(() => {
27
- rafId = null;
28
- update();
29
- });
30
- };
31
- // Scroll (capture phase catches nested scroll containers)
32
- window.addEventListener('scroll', scheduleUpdate, true);
33
- window.addEventListener('resize', scheduleUpdate);
34
- // Observe element size changes
35
- const ro = new ResizeObserver(scheduleUpdate);
36
- ro.observe(element);
37
- return () => {
38
- window.removeEventListener('scroll', scheduleUpdate, true);
39
- window.removeEventListener('resize', scheduleUpdate);
40
- ro.disconnect();
41
- if (rafId != null)
42
- cancelAnimationFrame(rafId);
43
- };
44
- }, [element, update]);
45
- return rect;
46
- }
@@ -1,24 +0,0 @@
1
- import type { TriggerWhenStatus } from '../components/ConditionStatusLine';
2
- /**
3
- * Minimal type for a triggerWhen action item.
4
- * Works with both FAQQuestionAction and NavTipAction.
5
- */
6
- export interface TriggerWhenItem {
7
- id: string;
8
- triggerWhen?: {
9
- type: string;
10
- rules?: Array<{
11
- conditions: Array<Record<string, unknown>>;
12
- value: unknown;
13
- }>;
14
- default?: unknown;
15
- } | null;
16
- }
17
- /**
18
- * Hook: live triggerWhen evaluation for a list of action items.
19
- *
20
- * @param items Array of items with id + optional triggerWhen
21
- * @returns Map from item id → TriggerWhenStatus (null for items without triggerWhen)
22
- */
23
- export declare function useTriggerWhenStatus(items: TriggerWhenItem[]): Map<string, TriggerWhenStatus | null>;
24
- //# sourceMappingURL=useTriggerWhenStatus.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useTriggerWhenStatus.d.ts","sourceRoot":"","sources":["../../src/hooks/useTriggerWhenStatus.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAmB,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAG5F;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,CAAC,EAAE;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,KAAK,CAAC;YACZ,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;YAC3C,KAAK,EAAE,OAAO,CAAC;SAChB,CAAC,CAAC;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,GAAG,IAAI,CAAC;CACV;AAqED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,eAAe,EAAE,GACvB,GAAG,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC,CA0CvC"}
@@ -1,86 +0,0 @@
1
- /**
2
- * useTriggerWhenStatus — live triggerWhen evaluation for editor diagnostics.
3
- *
4
- * Delegates condition evaluation to the runtime's evaluateSync() method,
5
- * eliminating duplicated logic. Subscribes to the EventAccumulator for
6
- * reactive updates.
7
- *
8
- * NOTE: This hook accesses `window.SynOS.handle.runtime` directly
9
- * because EditorPanelProps doesn't expose runtime. This is safe —
10
- * the editor only runs after runtime bootstrap.
11
- */
12
- import { useCallback, useEffect, useRef, useState } from 'react';
13
- import { formatConditionLabel } from '../formatConditionLabel';
14
- /**
15
- * Build a RuntimeLike from the real SynOS.handle.runtime.
16
- */
17
- function getRuntime() {
18
- const rt = window.SynOS?.handle?.runtime;
19
- if (!rt?.evaluateSync)
20
- return null;
21
- return {
22
- evaluateSync: rt.evaluateSync.bind(rt),
23
- accumulator: rt.accumulator,
24
- };
25
- }
26
- /**
27
- * Evaluate all conditions in a triggerWhen RuleStrategy via the runtime engine.
28
- */
29
- function evaluateTriggerWhen(triggerWhen, runtime) {
30
- if (triggerWhen.type !== 'rules' || !triggerWhen.rules?.length) {
31
- return { visible: !!triggerWhen.default, isFallback: true, conditions: [] };
32
- }
33
- const result = runtime.evaluateSync(triggerWhen);
34
- const conditions = (result.matchInfo?.evaluatedConditions ?? []).map(({ condition, result: passed }) => {
35
- // Get live accumulator count for event_count progress display
36
- const accCount = condition.type === 'event_count' && runtime.accumulator
37
- ? runtime.accumulator.getCount(condition.key, condition.withinMs)
38
- : undefined;
39
- const formatted = formatConditionLabel(condition, accCount);
40
- return { type: condition.type, passed, formatted };
41
- });
42
- return { visible: result.value, isFallback: result.isFallback, conditions };
43
- }
44
- /**
45
- * Hook: live triggerWhen evaluation for a list of action items.
46
- *
47
- * @param items Array of items with id + optional triggerWhen
48
- * @returns Map from item id → TriggerWhenStatus (null for items without triggerWhen)
49
- */
50
- export function useTriggerWhenStatus(items) {
51
- const [statuses, setStatuses] = useState(new Map());
52
- const itemsRef = useRef(items);
53
- itemsRef.current = items;
54
- const evaluate = useCallback(() => {
55
- const runtime = getRuntime();
56
- if (!runtime)
57
- return;
58
- const map = new Map();
59
- for (const item of itemsRef.current) {
60
- if (!item.triggerWhen) {
61
- map.set(item.id, null);
62
- }
63
- else {
64
- map.set(item.id, evaluateTriggerWhen(item.triggerWhen, runtime));
65
- }
66
- }
67
- setStatuses(map);
68
- }, []);
69
- useEffect(() => {
70
- // Initial evaluation
71
- evaluate();
72
- // Subscribe to accumulator changes for reactive event_count updates
73
- const runtime = getRuntime();
74
- const unsubs = [];
75
- if (runtime?.accumulator) {
76
- unsubs.push(runtime.accumulator.subscribe(evaluate));
77
- }
78
- // Poll every 2s for non-accumulator conditions (page_url, viewport, etc.)
79
- const interval = setInterval(evaluate, 2000);
80
- return () => {
81
- unsubs.forEach((u) => u());
82
- clearInterval(interval);
83
- };
84
- }, [evaluate]);
85
- return statuses;
86
- }
@@ -1,36 +0,0 @@
1
- export { cn } from './cn';
2
- export type { AnchorPickerProps, PickedElement } from './components/AnchorPicker';
3
- export { AnchorPicker } from './components/AnchorPicker';
4
- export { BeforeAfterToggle } from './components/BeforeAfterToggle';
5
- export type { ConditionStatus, TriggerWhenStatus } from './components/ConditionStatusLine';
6
- export { ConditionStatusLine } from './components/ConditionStatusLine';
7
- export { DetectionBadge } from './components/DetectionBadge';
8
- export { DismissedSection } from './components/DismissedSection';
9
- export { EditBackButton } from './components/EditBackButton';
10
- export { EditorBody } from './components/EditorBody';
11
- export { EditorCard } from './components/EditorCard';
12
- export { EditorFooter } from './components/EditorFooter';
13
- export { EditorHeader } from './components/EditorHeader';
14
- export { EditorInput } from './components/EditorInput';
15
- export { EditorLayout } from './components/EditorLayout';
16
- export type { EditorPanelShellProps } from './components/EditorPanelShell';
17
- export { EditorPanelShell } from './components/EditorPanelShell';
18
- export { EditorSelect } from './components/EditorSelect';
19
- export { EditorTextarea } from './components/EditorTextarea';
20
- export type { ElementHighlightProps } from './components/ElementHighlight';
21
- export { ElementHighlight } from './components/ElementHighlight';
22
- export { EmptyState } from './components/EmptyState';
23
- export { GroupHeader } from './components/GroupHeader';
24
- export type { TriggerJourneyProps } from './components/TriggerJourney';
25
- export { TriggerJourney } from './components/TriggerJourney';
26
- export type { PanelGeometry, PanelShellControllerOptions, ResizeDir, ResizeHandleDef, } from './controllers/PanelShellController';
27
- export { makeResizeHandles, PanelShellController } from './controllers/PanelShellController';
28
- export type { ConditionProgress, FormattedCondition } from './formatConditionLabel';
29
- export { formatConditionLabel } from './formatConditionLabel';
30
- export { useElementRect } from './hooks/useElementRect';
31
- export type { TriggerWhenItem } from './hooks/useTriggerWhenStatus';
32
- export { useTriggerWhenStatus } from './hooks/useTriggerWhenStatus';
33
- export { type ActionStep, buildActionStepFromElement, findRecommendedIndex, type PostHogElement, } from './utils/elementChainRecommender';
34
- export type { SelectorOptions } from './utils/selectorGenerator';
35
- export { generateSelector, getElementDescription, validateSelector, } from './utils/selectorGenerator';
36
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,YAAY,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,YAAY,EACV,aAAa,EACb,2BAA2B,EAC3B,SAAS,EACT,eAAe,GAChB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC7F,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,YAAY,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EACL,KAAK,UAAU,EACf,0BAA0B,EAC1B,oBAAoB,EACpB,KAAK,cAAc,GACpB,MAAM,iCAAiC,CAAC;AACzC,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC"}
@@ -1,26 +0,0 @@
1
- export { cn } from './cn';
2
- export { AnchorPicker } from './components/AnchorPicker';
3
- export { BeforeAfterToggle } from './components/BeforeAfterToggle';
4
- export { ConditionStatusLine } from './components/ConditionStatusLine';
5
- export { DetectionBadge } from './components/DetectionBadge';
6
- export { DismissedSection } from './components/DismissedSection';
7
- export { EditBackButton } from './components/EditBackButton';
8
- export { EditorBody } from './components/EditorBody';
9
- export { EditorCard } from './components/EditorCard';
10
- export { EditorFooter } from './components/EditorFooter';
11
- export { EditorHeader } from './components/EditorHeader';
12
- export { EditorInput } from './components/EditorInput';
13
- export { EditorLayout } from './components/EditorLayout';
14
- export { EditorPanelShell } from './components/EditorPanelShell';
15
- export { EditorSelect } from './components/EditorSelect';
16
- export { EditorTextarea } from './components/EditorTextarea';
17
- export { ElementHighlight } from './components/ElementHighlight';
18
- export { EmptyState } from './components/EmptyState';
19
- export { GroupHeader } from './components/GroupHeader';
20
- export { TriggerJourney } from './components/TriggerJourney';
21
- export { makeResizeHandles, PanelShellController } from './controllers/PanelShellController';
22
- export { formatConditionLabel } from './formatConditionLabel';
23
- export { useElementRect } from './hooks/useElementRect';
24
- export { useTriggerWhenStatus } from './hooks/useTriggerWhenStatus';
25
- export { buildActionStepFromElement, findRecommendedIndex, } from './utils/elementChainRecommender';
26
- export { generateSelector, getElementDescription, validateSelector, } from './utils/selectorGenerator';
@@ -1,15 +0,0 @@
1
- /**
2
- * Side-effect-only imports that register all Lit custom elements
3
- * from shared-editor-ui. Import this file to ensure se-editor-card,
4
- * se-group-header, etc. are available in the custom element registry.
5
- *
6
- * Does NOT pull in any React dependencies.
7
- */
8
- import './components/AnchorPickerLit';
9
- import './components/EditorCardLit';
10
- import './components/EditorPanelShellLit';
11
- import './components/EditorTextareaLit';
12
- import './components/ElementHighlightLit';
13
- import './components/EmptyStateLit';
14
- import './components/GroupHeaderLit';
15
- //# sourceMappingURL=lit-elements.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lit-elements.d.ts","sourceRoot":"","sources":["../src/lit-elements.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,8BAA8B,CAAC;AACtC,OAAO,4BAA4B,CAAC;AACpC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,gCAAgC,CAAC;AACxC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,6BAA6B,CAAC"}
@@ -1,14 +0,0 @@
1
- /**
2
- * Side-effect-only imports that register all Lit custom elements
3
- * from shared-editor-ui. Import this file to ensure se-editor-card,
4
- * se-group-header, etc. are available in the custom element registry.
5
- *
6
- * Does NOT pull in any React dependencies.
7
- */
8
- import './components/AnchorPickerLit';
9
- import './components/EditorCardLit';
10
- import './components/EditorPanelShellLit';
11
- import './components/EditorTextareaLit';
12
- import './components/ElementHighlightLit';
13
- import './components/EmptyStateLit';
14
- import './components/GroupHeaderLit';
@@ -1,33 +0,0 @@
1
- /**
2
- * Element Chain Recommender
3
- *
4
- * Given PostHog's $elements array, recommends which element the user
5
- * most likely intended to track for a KPI, and builds a PostHog action
6
- * step from that element.
7
- *
8
- * The interactive_tags and interactive_roles are loaded from the shared
9
- * field mapping fixture so the recommendation heuristic stays in sync
10
- * with the warehouse and runtime predicate matching.
11
- */
12
- export interface PostHogElement {
13
- tag_name: string;
14
- $el_text?: string;
15
- [key: string]: unknown;
16
- }
17
- export interface ActionStep {
18
- event: string;
19
- tag_name?: string;
20
- text?: string;
21
- url?: string;
22
- }
23
- /**
24
- * Find the index of the recommended element in the $elements chain.
25
- * Returns the first interactive element, or 0 if none found.
26
- */
27
- export declare function findRecommendedIndex(elements: PostHogElement[]): number;
28
- export interface BuildActionStepOptions {
29
- /** If true, infer $pageview for <a> elements with internal href */
30
- inferPageview?: boolean;
31
- }
32
- export declare function buildActionStepFromElement(element: PostHogElement, pageUrl: string, options?: BuildActionStepOptions): ActionStep;
33
- //# sourceMappingURL=elementChainRecommender.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"elementChainRecommender.d.ts","sourceRoot":"","sources":["../../src/utils/elementChainRecommender.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAKD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,MAAM,CAYvE;AAED,MAAM,WAAW,sBAAsB;IACrC,mEAAmE;IACnE,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAsBD,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,sBAA2B,GACnC,UAAU,CAmBZ"}
@@ -1,68 +0,0 @@
1
- /**
2
- * Element Chain Recommender
3
- *
4
- * Given PostHog's $elements array, recommends which element the user
5
- * most likely intended to track for a KPI, and builds a PostHog action
6
- * step from that element.
7
- *
8
- * The interactive_tags and interactive_roles are loaded from the shared
9
- * field mapping fixture so the recommendation heuristic stays in sync
10
- * with the warehouse and runtime predicate matching.
11
- */
12
- // Loaded from the shared fixture at build time.
13
- // The fixture is the single source of truth — do NOT hardcode these lists.
14
- import fieldMapping from '../../../../tests/fixtures/action-step-field-mapping.json';
15
- const INTERACTIVE_TAGS = new Set(fieldMapping.interactive_tags);
16
- const INTERACTIVE_ROLES = new Set(fieldMapping.interactive_roles);
17
- /**
18
- * Find the index of the recommended element in the $elements chain.
19
- * Returns the first interactive element, or 0 if none found.
20
- */
21
- export function findRecommendedIndex(elements) {
22
- if (elements.length === 0)
23
- return 0;
24
- for (let i = 0; i < elements.length; i++) {
25
- const el = elements[i];
26
- if (INTERACTIVE_TAGS.has(el.tag_name))
27
- return i;
28
- const role = (el.attr__role ?? el.role);
29
- if (role && INTERACTIVE_ROLES.has(role))
30
- return i;
31
- }
32
- return 0;
33
- }
34
- /**
35
- * Build a PostHog action step from a selected element in the chain.
36
- * Does NOT include `selector` — it's not supported in Athena.
37
- *
38
- * The `url` field stores the PATHNAME of the page where the user clicked,
39
- * not the full URL. This matches how the backend generates SQL:
40
- * step.url → `pathname LIKE '%<url>%'`
41
- * Storing the full URL (including the editor token / query string) makes
42
- * the stored KPI data ugly, leaks editor tokens into saved configs, and
43
- * forces the backend to re-parse on every query. Strip at the boundary.
44
- */
45
- function pageUrlToPathname(pageUrl) {
46
- try {
47
- const u = new URL(pageUrl);
48
- return u.pathname || pageUrl;
49
- }
50
- catch {
51
- return pageUrl;
52
- }
53
- }
54
- export function buildActionStepFromElement(element, pageUrl, options = {}) {
55
- const { inferPageview = false } = options;
56
- const href = element.attr__href;
57
- const isInternalLink = element.tag_name === 'a' && href && !href.startsWith('http') && !href.startsWith('//');
58
- const step = {
59
- event: inferPageview && isInternalLink ? '$pageview' : '$autocapture',
60
- tag_name: element.tag_name,
61
- url: pageUrlToPathname(pageUrl),
62
- };
63
- const text = (element.$el_text || '').trim();
64
- if (text) {
65
- step.text = text.slice(0, 100); // Truncate long text
66
- }
67
- return step;
68
- }
@@ -1,22 +0,0 @@
1
- export interface SelectorOptions {
2
- includeTag?: boolean;
3
- preferTestIds?: boolean;
4
- maxCombinations?: number;
5
- }
6
- /**
7
- * Generates a CSS selector for a given DOM element.
8
- * Uses css-selector-generator with settings optimized for:
9
- * - Stability (prefers IDs, data-testid, stable classes)
10
- * - Readability (includes tag names)
11
- * - Uniqueness (generates unique selectors)
12
- */
13
- export declare function generateSelector(element: Element, options?: SelectorOptions): string;
14
- /**
15
- * Validates that a selector correctly targets the expected element.
16
- */
17
- export declare function validateSelector(selector: string, expectedElement: Element): boolean;
18
- /**
19
- * Gets a human-readable description of an element for UI display.
20
- */
21
- export declare function getElementDescription(element: Element): string;
22
- //# sourceMappingURL=selectorGenerator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"selectorGenerator.d.ts","sourceRoot":"","sources":["../../src/utils/selectorGenerator.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAQD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,GAAE,eAAoB,GAAG,MAAM,CAiExF;AAmCD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,GAAG,OAAO,CAOpF;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAiB9D"}