@syntrologie/adapt-content 2.4.1 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/editor.d.ts.map +1 -1
  2. package/dist/editor.js +59 -3
  3. package/dist/runtime.d.ts.map +1 -1
  4. package/dist/runtime.js +67 -12
  5. package/dist/summarize.d.ts.map +1 -1
  6. package/dist/summarize.js +12 -1
  7. package/dist/types.d.ts +9 -42
  8. package/dist/types.d.ts.map +1 -1
  9. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/AnchorPicker.test.d.ts +2 -0
  10. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/AnchorPicker.test.d.ts.map +1 -0
  11. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/AnchorPicker.test.js +224 -0
  12. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/ConditionStatusLine.test.js +102 -0
  13. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/DetectionBadge.test.js +58 -6
  14. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/DismissedSection.test.js +18 -0
  15. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorCard.test.js +61 -2
  16. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorPanelShell.test.js +478 -7
  17. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/ElementHighlight.test.js +54 -0
  18. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/selectorGenerator.test.d.ts +2 -0
  19. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/selectorGenerator.test.d.ts.map +1 -0
  20. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/selectorGenerator.test.js +257 -0
  21. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/useTriggerWhenStatus.test.d.ts +2 -0
  22. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/useTriggerWhenStatus.test.d.ts.map +1 -0
  23. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/useTriggerWhenStatus.test.js +1015 -0
  24. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.js +1 -1
  25. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts +4 -4
  26. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts.map +1 -1
  27. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.js +2 -2
  28. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.d.ts +2 -1
  29. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.d.ts.map +1 -1
  30. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.js +20 -3
  31. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts +10 -8
  32. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts.map +1 -1
  33. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.js +350 -87
  34. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.js +1 -1
  35. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts +3 -3
  36. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts.map +1 -1
  37. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.js +1 -1
  38. package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts +1 -1
  39. package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts.map +1 -1
  40. package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.js +5 -2
  41. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.d.ts +24 -0
  42. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.d.ts.map +1 -0
  43. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/{useShowWhenStatus.js → useTriggerWhenStatus.js} +18 -15
  44. package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts +3 -3
  45. package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts.map +1 -1
  46. package/node_modules/@syntrologie/shared-editor-ui/dist/index.js +1 -1
  47. package/package.json +4 -5
  48. package/node_modules/@syntrologie/sdk-contracts/dist/index.d.ts +0 -26
  49. package/node_modules/@syntrologie/sdk-contracts/dist/index.js +0 -13
  50. package/node_modules/@syntrologie/sdk-contracts/dist/schemas.d.ts +0 -1428
  51. package/node_modules/@syntrologie/sdk-contracts/dist/schemas.js +0 -142
  52. package/node_modules/@syntrologie/sdk-contracts/package.json +0 -33
  53. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useShowWhenStatus.d.ts +0 -24
  54. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useShowWhenStatus.d.ts.map +0 -1
@@ -1,142 +0,0 @@
1
- /**
2
- * Shared Zod schemas for decision strategies, conditions, and event scoping.
3
- *
4
- * These are the canonical definitions — runtime-sdk and all adaptive packages
5
- * should import from here instead of duplicating.
6
- */
7
- import { z } from 'zod';
8
- // =============================================================================
9
- // CONDITION SCHEMAS
10
- // =============================================================================
11
- export const PageUrlConditionZ = z.object({
12
- type: z.literal('page_url'),
13
- url: z.string(),
14
- });
15
- export const RouteConditionZ = z.object({
16
- type: z.literal('route'),
17
- routeId: z.string(),
18
- });
19
- export const AnchorVisibleConditionZ = z.object({
20
- type: z.literal('anchor_visible'),
21
- anchorId: z.string(),
22
- state: z.enum(['visible', 'present', 'absent']),
23
- });
24
- export const EventOccurredConditionZ = z.object({
25
- type: z.literal('event_occurred'),
26
- eventName: z.string(),
27
- withinMs: z.number().optional(),
28
- });
29
- export const StateEqualsConditionZ = z.object({
30
- type: z.literal('state_equals'),
31
- key: z.string(),
32
- value: z.unknown(),
33
- });
34
- export const ViewportConditionZ = z.object({
35
- type: z.literal('viewport'),
36
- minWidth: z.number().optional(),
37
- maxWidth: z.number().optional(),
38
- minHeight: z.number().optional(),
39
- maxHeight: z.number().optional(),
40
- });
41
- export const SessionMetricConditionZ = z.object({
42
- type: z.literal('session_metric'),
43
- key: z.string(),
44
- operator: z.enum(['gte', 'lte', 'eq', 'gt', 'lt']),
45
- threshold: z.number(),
46
- });
47
- export const DismissedConditionZ = z.object({
48
- type: z.literal('dismissed'),
49
- key: z.string(),
50
- inverted: z.boolean().optional(),
51
- });
52
- export const CooldownActiveConditionZ = z.object({
53
- type: z.literal('cooldown_active'),
54
- key: z.string(),
55
- inverted: z.boolean().optional(),
56
- });
57
- export const FrequencyLimitConditionZ = z.object({
58
- type: z.literal('frequency_limit'),
59
- key: z.string(),
60
- limit: z.number(),
61
- inverted: z.boolean().optional(),
62
- });
63
- export const EventCountConditionZ = z.object({
64
- type: z.literal('event_count'),
65
- key: z.string(),
66
- operator: z.enum(['gte', 'lte', 'eq', 'gt', 'lt']),
67
- count: z.number().int().min(0),
68
- withinMs: z.number().positive().optional(),
69
- });
70
- export const ConditionZ = z.discriminatedUnion('type', [
71
- PageUrlConditionZ,
72
- RouteConditionZ,
73
- AnchorVisibleConditionZ,
74
- EventOccurredConditionZ,
75
- StateEqualsConditionZ,
76
- ViewportConditionZ,
77
- SessionMetricConditionZ,
78
- DismissedConditionZ,
79
- CooldownActiveConditionZ,
80
- FrequencyLimitConditionZ,
81
- EventCountConditionZ,
82
- ]);
83
- // =============================================================================
84
- // STRATEGY SCHEMAS
85
- // =============================================================================
86
- export const RuleZ = z.object({
87
- conditions: z.array(ConditionZ),
88
- value: z.unknown(),
89
- });
90
- export const RuleStrategyZ = z.object({
91
- type: z.literal('rules'),
92
- rules: z.array(RuleZ),
93
- default: z.unknown(),
94
- });
95
- export const ScoreStrategyZ = z.object({
96
- type: z.literal('score'),
97
- field: z.string(),
98
- threshold: z.number(),
99
- above: z.unknown(),
100
- below: z.unknown(),
101
- });
102
- export const ModelStrategyZ = z.object({
103
- type: z.literal('model'),
104
- modelId: z.string(),
105
- inputs: z.array(z.string()),
106
- outputMapping: z.record(z.string(), z.unknown()),
107
- default: z.unknown(),
108
- });
109
- export const ExternalStrategyZ = z.object({
110
- type: z.literal('external'),
111
- endpoint: z.string(),
112
- method: z.enum(['GET', 'POST']).optional(),
113
- default: z.unknown(),
114
- timeoutMs: z.number().optional(),
115
- });
116
- export const DecisionStrategyZ = z.discriminatedUnion('type', [
117
- RuleStrategyZ,
118
- ScoreStrategyZ,
119
- ModelStrategyZ,
120
- ExternalStrategyZ,
121
- ]);
122
- // =============================================================================
123
- // EVENT SCOPE SCHEMA
124
- // =============================================================================
125
- /** Scopes a widget to specific events/URLs. */
126
- export const EventScopeZ = z.object({
127
- events: z.array(z.string()),
128
- urlContains: z.string().optional(),
129
- props: z.record(z.union([z.string(), z.number(), z.boolean()])).optional(),
130
- });
131
- // =============================================================================
132
- // NOTIFY SCHEMA
133
- // =============================================================================
134
- /** Toast notification config for showWhen transitions. */
135
- export const NotifyZ = z
136
- .object({
137
- title: z.string().optional(),
138
- body: z.string().optional(),
139
- icon: z.string().optional(),
140
- })
141
- .nullable()
142
- .optional();
@@ -1,33 +0,0 @@
1
- {
2
- "name": "@syntrologie/sdk-contracts",
3
- "version": "0.0.0-semantically-released",
4
- "description": "Shared TypeScript contracts between runtime-sdk and adaptive packages",
5
- "license": "Proprietary",
6
- "private": true,
7
- "type": "module",
8
- "main": "dist/index.js",
9
- "types": "dist/index.d.ts",
10
- "exports": {
11
- ".": {
12
- "types": "./dist/index.d.ts",
13
- "import": "./dist/index.js"
14
- },
15
- "./schemas": {
16
- "types": "./dist/schemas.d.ts",
17
- "import": "./dist/schemas.js"
18
- }
19
- },
20
- "files": [
21
- "dist"
22
- ],
23
- "scripts": {
24
- "build": "tsc",
25
- "typecheck": "tsc --noEmit"
26
- },
27
- "dependencies": {
28
- "zod": "^3.25.76"
29
- },
30
- "devDependencies": {
31
- "typescript": "^5.9.3"
32
- }
33
- }
@@ -1,24 +0,0 @@
1
- import type { ShowWhenStatus } from '../components/ConditionStatusLine';
2
- /**
3
- * Minimal type for a showWhen action item.
4
- * Works with both FAQQuestionAction and NavTipAction.
5
- */
6
- export interface ShowWhenItem {
7
- id: string;
8
- showWhen?: {
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 showWhen evaluation for a list of action items.
19
- *
20
- * @param items Array of items with id + optional showWhen
21
- * @returns Map from item id → ShowWhenStatus (null for items without showWhen)
22
- */
23
- export declare function useShowWhenStatus(items: ShowWhenItem[]): Map<string, ShowWhenStatus | null>;
24
- //# sourceMappingURL=useShowWhenStatus.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useShowWhenStatus.d.ts","sourceRoot":"","sources":["../../src/hooks/useShowWhenStatus.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAGzF;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE;QACT,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;AAuND;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC,CA0C3F"}