@syntrologie/adapt-content 2.8.0-canary.31 → 2.8.0-canary.310
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.
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +431 -348
- package/dist/runtime.js.map +7 -0
- package/dist/schema.d.ts +56 -16
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +363 -62
- package/dist/schema.js.map +7 -0
- package/package.json +8 -26
- package/dist/cdn.d.ts +0 -35
- package/dist/cdn.d.ts.map +0 -1
- package/dist/cdn.js +0 -39
- package/dist/components/AnchorPicker.d.ts +0 -8
- package/dist/components/AnchorPicker.d.ts.map +0 -1
- package/dist/components/AnchorPicker.js +0 -6
- package/dist/content-editor-state.d.ts +0 -45
- package/dist/content-editor-state.d.ts.map +0 -1
- package/dist/content-editor-state.js +0 -123
- package/dist/content-editor-ui.d.ts +0 -26
- package/dist/content-editor-ui.d.ts.map +0 -1
- package/dist/content-editor-ui.js +0 -301
- package/dist/editor.d.ts +0 -9
- package/dist/editor.d.ts.map +0 -1
- package/dist/editor.js +0 -8
- package/dist/reconciliation-guard.js +0 -80
- package/dist/sanitizer.js +0 -95
- package/dist/summarize.js +0 -88
- package/dist/types.js +0 -7
- package/dist/utils/selectorGenerator.d.ts +0 -6
- package/dist/utils/selectorGenerator.d.ts.map +0 -1
- package/dist/utils/selectorGenerator.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/cn.d.ts +0 -2
- package/node_modules/@syntrologie/shared-editor-ui/dist/cn.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/cn.js +0 -3
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.d.ts +0 -34
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.js +0 -158
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.js +0 -9
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts +0 -23
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.js +0 -40
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.js +0 -22
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.js +0 -9
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.d.ts +0 -13
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.js +0 -15
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.d.ts +0 -9
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.js +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts +0 -25
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.js +0 -379
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.js +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.js +0 -17
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.d.ts +0 -32
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.js +0 -85
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.d.ts +0 -6
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.js +0 -5
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts +0 -12
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.js +0 -40
- package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts +0 -26
- package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.js +0 -202
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.js +0 -46
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.d.ts +0 -24
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.js +0 -86
- package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts +0 -34
- package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/index.js +0 -25
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.d.ts +0 -37
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.js +0 -52
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.d.ts +0 -22
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.js +0 -143
- package/node_modules/@syntrologie/shared-editor-ui/package.json +0 -45
|
@@ -1,34 +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 { ConditionProgress, FormattedCondition } from './formatConditionLabel';
|
|
27
|
-
export { formatConditionLabel } from './formatConditionLabel';
|
|
28
|
-
export { useElementRect } from './hooks/useElementRect';
|
|
29
|
-
export type { TriggerWhenItem } from './hooks/useTriggerWhenStatus';
|
|
30
|
-
export { useTriggerWhenStatus } from './hooks/useTriggerWhenStatus';
|
|
31
|
-
export { type ActionStep, buildActionStepFromElement, findRecommendedIndex, type PostHogElement, } from './utils/elementChainRecommender';
|
|
32
|
-
export type { SelectorOptions } from './utils/selectorGenerator';
|
|
33
|
-
export { generateSelector, getElementDescription, validateSelector, } from './utils/selectorGenerator';
|
|
34
|
-
//# 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,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,25 +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 { formatConditionLabel } from './formatConditionLabel';
|
|
22
|
-
export { useElementRect } from './hooks/useElementRect';
|
|
23
|
-
export { useTriggerWhenStatus } from './hooks/useTriggerWhenStatus';
|
|
24
|
-
export { buildActionStepFromElement, findRecommendedIndex, } from './utils/elementChainRecommender';
|
|
25
|
-
export { generateSelector, getElementDescription, validateSelector, } from './utils/selectorGenerator';
|
|
@@ -1,37 +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
|
-
/**
|
|
33
|
-
* Build a PostHog action step from a selected element in the chain.
|
|
34
|
-
* Does NOT include `selector` — it's not supported in Athena.
|
|
35
|
-
*/
|
|
36
|
-
export declare function buildActionStepFromElement(element: PostHogElement, pageUrl: string, options?: BuildActionStepOptions): ActionStep;
|
|
37
|
-
//# sourceMappingURL=elementChainRecommender.d.ts.map
|
package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.d.ts.map
DELETED
|
@@ -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;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,sBAA2B,GACnC,UAAU,CAmBZ"}
|
|
@@ -1,52 +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
|
-
export function buildActionStepFromElement(element, pageUrl, options = {}) {
|
|
39
|
-
const { inferPageview = false } = options;
|
|
40
|
-
const href = element.attr__href;
|
|
41
|
-
const isInternalLink = element.tag_name === 'a' && href && !href.startsWith('http') && !href.startsWith('//');
|
|
42
|
-
const step = {
|
|
43
|
-
event: inferPageview && isInternalLink ? '$pageview' : '$autocapture',
|
|
44
|
-
tag_name: element.tag_name,
|
|
45
|
-
url: pageUrl,
|
|
46
|
-
};
|
|
47
|
-
const text = (element.$el_text || '').trim();
|
|
48
|
-
if (text) {
|
|
49
|
-
step.text = text.slice(0, 100); // Truncate long text
|
|
50
|
-
}
|
|
51
|
-
return step;
|
|
52
|
-
}
|
|
@@ -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"}
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { getCssSelector } from 'css-selector-generator';
|
|
2
|
-
const DEFAULT_OPTIONS = {
|
|
3
|
-
includeTag: true,
|
|
4
|
-
preferTestIds: true,
|
|
5
|
-
maxCombinations: 100,
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Generates a CSS selector for a given DOM element.
|
|
9
|
-
* Uses css-selector-generator with settings optimized for:
|
|
10
|
-
* - Stability (prefers IDs, data-testid, stable classes)
|
|
11
|
-
* - Readability (includes tag names)
|
|
12
|
-
* - Uniqueness (generates unique selectors)
|
|
13
|
-
*/
|
|
14
|
-
export function generateSelector(element, options = {}) {
|
|
15
|
-
const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
16
|
-
// Build selector types in priority order
|
|
17
|
-
const selectors = [];
|
|
18
|
-
// Always prioritize ID if available
|
|
19
|
-
selectors.push('id');
|
|
20
|
-
// Include data-testid and other stable attributes
|
|
21
|
-
if (opts.preferTestIds) {
|
|
22
|
-
selectors.push('attribute');
|
|
23
|
-
}
|
|
24
|
-
// Then class names (filtered to exclude dynamic ones)
|
|
25
|
-
selectors.push('class');
|
|
26
|
-
// Tag names for context
|
|
27
|
-
selectors.push('tag');
|
|
28
|
-
// Fallbacks for uniqueness
|
|
29
|
-
selectors.push('nthchild');
|
|
30
|
-
selectors.push('nthoftype');
|
|
31
|
-
try {
|
|
32
|
-
const selector = getCssSelector(element, {
|
|
33
|
-
selectors,
|
|
34
|
-
includeTag: opts.includeTag,
|
|
35
|
-
maxCombinations: opts.maxCombinations,
|
|
36
|
-
// Blacklist common dynamic class patterns
|
|
37
|
-
blacklist: [
|
|
38
|
-
// Dynamic class patterns
|
|
39
|
-
/^[a-z]+-[a-f0-9]{5,}$/i, // hash-based classes like "css-1abc23"
|
|
40
|
-
/^_[a-zA-Z0-9]+$/, // CSS module classes like "_1abc23"
|
|
41
|
-
/^svelte-[a-z0-9]+$/i, // Svelte scoped classes
|
|
42
|
-
/^vue-[a-z0-9]+$/i, // Vue scoped classes
|
|
43
|
-
/^emotion-[0-9]+$/, // Emotion CSS-in-JS
|
|
44
|
-
/^sc-[a-zA-Z]+$/, // styled-components
|
|
45
|
-
// State classes that may change
|
|
46
|
-
/^(is-|has-|js-)/,
|
|
47
|
-
/^(active|selected|focused|disabled|hidden|visible)$/,
|
|
48
|
-
// Animation/transition classes
|
|
49
|
-
/^(fade|slide|animate)/,
|
|
50
|
-
/-(enter|leave|active)(-active|-done)?$/,
|
|
51
|
-
],
|
|
52
|
-
// Whitelist stable attribute selectors
|
|
53
|
-
whitelist: [
|
|
54
|
-
/^data-testid$/,
|
|
55
|
-
/^data-cy$/,
|
|
56
|
-
/^data-test$/,
|
|
57
|
-
/^data-qa$/,
|
|
58
|
-
/^aria-label$/,
|
|
59
|
-
/^role$/,
|
|
60
|
-
/^name$/,
|
|
61
|
-
/^type$/,
|
|
62
|
-
/^href$/,
|
|
63
|
-
],
|
|
64
|
-
});
|
|
65
|
-
return selector;
|
|
66
|
-
}
|
|
67
|
-
catch (error) {
|
|
68
|
-
console.warn('[SelectorGenerator] Failed to generate selector:', error);
|
|
69
|
-
// Fallback: try simpler approach
|
|
70
|
-
return generateFallbackSelector(element);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Fallback selector generation when the library fails.
|
|
75
|
-
* Creates a path-based selector from the element to the body.
|
|
76
|
-
*/
|
|
77
|
-
function generateFallbackSelector(element) {
|
|
78
|
-
const path = [];
|
|
79
|
-
let current = element;
|
|
80
|
-
while (current && current !== document.body && current !== document.documentElement) {
|
|
81
|
-
let selector = current.tagName.toLowerCase();
|
|
82
|
-
// Add ID if present
|
|
83
|
-
if (current.id) {
|
|
84
|
-
selector = `#${CSS.escape(current.id)}`;
|
|
85
|
-
path.unshift(selector);
|
|
86
|
-
break; // ID is unique enough
|
|
87
|
-
}
|
|
88
|
-
// Add nth-child for specificity
|
|
89
|
-
const parent = current.parentElement;
|
|
90
|
-
if (parent) {
|
|
91
|
-
const siblings = Array.from(parent.children);
|
|
92
|
-
const index = siblings.indexOf(current) + 1;
|
|
93
|
-
selector += `:nth-child(${index})`;
|
|
94
|
-
}
|
|
95
|
-
path.unshift(selector);
|
|
96
|
-
current = parent;
|
|
97
|
-
}
|
|
98
|
-
return path.join(' > ');
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Validates that a selector correctly targets the expected element.
|
|
102
|
-
*/
|
|
103
|
-
export function validateSelector(selector, expectedElement) {
|
|
104
|
-
try {
|
|
105
|
-
const matched = document.querySelector(selector);
|
|
106
|
-
return matched === expectedElement;
|
|
107
|
-
}
|
|
108
|
-
catch {
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Gets a human-readable description of an element for UI display.
|
|
114
|
-
*/
|
|
115
|
-
export function getElementDescription(element) {
|
|
116
|
-
const tag = element.tagName.toLowerCase();
|
|
117
|
-
const id = element.id ? `#${element.id}` : '';
|
|
118
|
-
const classes = element.className && typeof element.className === 'string'
|
|
119
|
-
? `.${element.className
|
|
120
|
-
.split(' ')
|
|
121
|
-
.filter((c) => c && !isDynamicClass(c))
|
|
122
|
-
.slice(0, 2)
|
|
123
|
-
.join('.')}`
|
|
124
|
-
: '';
|
|
125
|
-
// Get text content preview
|
|
126
|
-
const text = element.textContent?.trim().slice(0, 30) || '';
|
|
127
|
-
const textPreview = text ? ` "${text}${text.length >= 30 ? '...' : ''}"` : '';
|
|
128
|
-
return `${tag}${id}${classes}${textPreview}`.trim();
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Checks if a class name appears to be dynamically generated.
|
|
132
|
-
*/
|
|
133
|
-
function isDynamicClass(className) {
|
|
134
|
-
const dynamicPatterns = [
|
|
135
|
-
/^[a-z]+-[a-f0-9]{5,}$/i,
|
|
136
|
-
/^_[a-zA-Z0-9]+$/,
|
|
137
|
-
/^svelte-[a-z0-9]+$/i,
|
|
138
|
-
/^vue-[a-z0-9]+$/i,
|
|
139
|
-
/^emotion-[0-9]+$/,
|
|
140
|
-
/^sc-[a-zA-Z]+$/,
|
|
141
|
-
];
|
|
142
|
-
return dynamicPatterns.some((pattern) => pattern.test(className));
|
|
143
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@syntrologie/shared-editor-ui",
|
|
3
|
-
"version": "0.0.0-semantically-released",
|
|
4
|
-
"description": "Shared UI components for adaptive editor panels",
|
|
5
|
-
"license": "Proprietary",
|
|
6
|
-
"private": true,
|
|
7
|
-
"type": "module",
|
|
8
|
-
"main": "./src/index.ts",
|
|
9
|
-
"types": "./src/index.ts",
|
|
10
|
-
"exports": {
|
|
11
|
-
".": {
|
|
12
|
-
"types": "./src/index.ts",
|
|
13
|
-
"import": "./dist/index.js",
|
|
14
|
-
"default": "./dist/index.js"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"files": [
|
|
18
|
-
"dist"
|
|
19
|
-
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "tsc",
|
|
22
|
-
"typecheck": "tsc --noEmit",
|
|
23
|
-
"clean": "rm -rf dist",
|
|
24
|
-
"test": "vitest run",
|
|
25
|
-
"test:watch": "vitest"
|
|
26
|
-
},
|
|
27
|
-
"dependencies": {
|
|
28
|
-
"css-selector-generator": "^3.8.0"
|
|
29
|
-
},
|
|
30
|
-
"peerDependencies": {
|
|
31
|
-
"lucide-react": ">=0.400.0",
|
|
32
|
-
"react": ">=18.0.0",
|
|
33
|
-
"react-dom": ">=18.0.0"
|
|
34
|
-
},
|
|
35
|
-
"devDependencies": {
|
|
36
|
-
"@testing-library/dom": "^10.4.1",
|
|
37
|
-
"@testing-library/react": "^16.3.2",
|
|
38
|
-
"@types/react": "^19.2.0",
|
|
39
|
-
"jsdom": "^26.1.0",
|
|
40
|
-
"react": "^19.2.0",
|
|
41
|
-
"react-dom": "^19.2.0",
|
|
42
|
-
"typescript": "^5.9.3",
|
|
43
|
-
"vitest": "^4.0.18"
|
|
44
|
-
}
|
|
45
|
-
}
|