@syntrologie/runtime-sdk 2.8.0-canary.7 → 2.8.0-canary.71
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/CAPABILITIES.md +299 -167
- package/README.md +2 -0
- package/dist/actions/schema.d.ts +783 -783
- package/dist/actions/schema.js +3 -3
- package/dist/actions/types.d.ts +1 -1
- package/dist/actions/validation-core.d.ts +24 -0
- package/dist/actions/validation-rules.d.ts +74 -0
- package/dist/actions/validation.d.ts +5 -11
- package/dist/bootstrap-init.d.ts +33 -0
- package/dist/bootstrap-runtime.d.ts +7 -0
- package/dist/bootstrap-types.d.ts +90 -0
- package/dist/bootstrap.d.ts +19 -83
- package/dist/{chunk-R5DNAIRI.js → chunk-77TNZ66J.js} +4 -4
- package/dist/{chunk-R5DNAIRI.js.map → chunk-77TNZ66J.js.map} +2 -2
- package/dist/{chunk-XDYJ64IN.js → chunk-IR6UOR63.js} +4 -4
- package/dist/chunk-IR6UOR63.js.map +7 -0
- package/dist/{chunk-GWF5BTST.js → chunk-WX32GVSP.js} +1855 -783
- package/dist/chunk-WX32GVSP.js.map +7 -0
- package/dist/chunk-YLLWLUQX.js +241 -0
- package/dist/chunk-YLLWLUQX.js.map +7 -0
- package/dist/components/ShadowCanvasOverlay.d.ts +1 -2
- package/dist/components/TileIcon.d.ts +2 -2
- package/dist/components/emojiToIcon.d.ts +24 -0
- package/dist/config/schema.d.ts +147 -136
- package/dist/config/schema.js +2 -2
- package/dist/decisions/schema.d.ts +47 -47
- package/dist/decisions/schema.js +1 -1
- package/dist/events/EventBus.d.ts +27 -1
- package/dist/events/history.d.ts +9 -0
- package/dist/events/index.d.ts +3 -0
- package/dist/events/normalizers/posthog.d.ts +4 -50
- package/dist/events/types.d.ts +30 -23
- package/dist/events/validation.d.ts +7 -0
- package/dist/fetchers/experimentsFetcher.d.ts +3 -3
- package/dist/index.d.ts +0 -2
- package/dist/index.js +1529 -212
- package/dist/index.js.map +4 -4
- package/dist/overlays/runtime/overlay/overlay-runner.d.ts +4 -0
- package/dist/overlays/runtime/overlay/overlay-state.d.ts +21 -0
- package/dist/overlays/types.d.ts +3 -1
- package/dist/react.js +6 -4
- package/dist/react.js.map +2 -2
- package/dist/smart-canvas.esm.js +115 -65
- package/dist/smart-canvas.esm.js.map +4 -4
- package/dist/smart-canvas.js +5901 -3064
- package/dist/smart-canvas.js.map +4 -4
- package/dist/smart-canvas.min.js +115 -65
- package/dist/smart-canvas.min.js.map +4 -4
- package/dist/telemetry/InterventionTracker.d.ts +23 -0
- package/dist/telemetry/adapters/posthog.d.ts +30 -4
- package/dist/telemetry/index.d.ts +1 -0
- package/dist/test/setup.d.ts +1 -0
- package/dist/token.d.ts +2 -0
- package/dist/version.d.ts +1 -1
- package/package.json +23 -28
- package/schema/canvas-config.schema.json +1974 -10925
- package/scripts/syntroReactPlugin.mjs +3 -0
- package/scripts/validate-config.mjs +42 -0
- package/dist/chunk-BU4Z6PD7.js +0 -218
- package/dist/chunk-BU4Z6PD7.js.map +0 -7
- package/dist/chunk-GWF5BTST.js.map +0 -7
- package/dist/chunk-XDYJ64IN.js.map +0 -7
package/dist/config/schema.js
CHANGED
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
TileNotificationRuleZ,
|
|
13
13
|
TileZ,
|
|
14
14
|
configSchemas
|
|
15
|
-
} from "../chunk-
|
|
16
|
-
import "../chunk-
|
|
15
|
+
} from "../chunk-IR6UOR63.js";
|
|
16
|
+
import "../chunk-YLLWLUQX.js";
|
|
17
17
|
export {
|
|
18
18
|
CanvasConfigResponseZ,
|
|
19
19
|
CanvasElementConfigZ,
|
|
@@ -72,7 +72,7 @@ export declare function validateCondition(data: unknown): z.SafeParseReturnType<
|
|
|
72
72
|
maxHeight?: number | undefined;
|
|
73
73
|
} | {
|
|
74
74
|
type: "session_metric";
|
|
75
|
-
key:
|
|
75
|
+
key: "time_on_page" | "page_views" | "scroll_depth";
|
|
76
76
|
operator: "gte" | "lte" | "eq" | "gt" | "lt";
|
|
77
77
|
threshold: number;
|
|
78
78
|
} | {
|
|
@@ -95,7 +95,7 @@ export declare function validateCondition(data: unknown): z.SafeParseReturnType<
|
|
|
95
95
|
count: number;
|
|
96
96
|
withinMs?: number | undefined;
|
|
97
97
|
counter?: {
|
|
98
|
-
events:
|
|
98
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
99
99
|
match?: Record<string, {
|
|
100
100
|
equals?: string | number | boolean | undefined;
|
|
101
101
|
contains?: string | undefined;
|
|
@@ -127,7 +127,7 @@ export declare function validateCondition(data: unknown): z.SafeParseReturnType<
|
|
|
127
127
|
maxHeight?: number | undefined;
|
|
128
128
|
} | {
|
|
129
129
|
type: "session_metric";
|
|
130
|
-
key:
|
|
130
|
+
key: "time_on_page" | "page_views" | "scroll_depth";
|
|
131
131
|
operator: "gte" | "lte" | "eq" | "gt" | "lt";
|
|
132
132
|
threshold: number;
|
|
133
133
|
} | {
|
|
@@ -150,7 +150,7 @@ export declare function validateCondition(data: unknown): z.SafeParseReturnType<
|
|
|
150
150
|
count: number;
|
|
151
151
|
withinMs?: number | undefined;
|
|
152
152
|
counter?: {
|
|
153
|
-
events:
|
|
153
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
154
154
|
match?: Record<string, {
|
|
155
155
|
equals?: string | number | boolean | undefined;
|
|
156
156
|
contains?: string | undefined;
|
|
@@ -189,7 +189,7 @@ export declare function validateStrategy(data: unknown): z.SafeParseReturnType<{
|
|
|
189
189
|
maxHeight?: number | undefined;
|
|
190
190
|
} | {
|
|
191
191
|
type: "session_metric";
|
|
192
|
-
key:
|
|
192
|
+
key: "time_on_page" | "page_views" | "scroll_depth";
|
|
193
193
|
operator: "gte" | "lte" | "eq" | "gt" | "lt";
|
|
194
194
|
threshold: number;
|
|
195
195
|
} | {
|
|
@@ -212,7 +212,7 @@ export declare function validateStrategy(data: unknown): z.SafeParseReturnType<{
|
|
|
212
212
|
count: number;
|
|
213
213
|
withinMs?: number | undefined;
|
|
214
214
|
counter?: {
|
|
215
|
-
events:
|
|
215
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
216
216
|
match?: Record<string, {
|
|
217
217
|
equals?: string | number | boolean | undefined;
|
|
218
218
|
contains?: string | undefined;
|
|
@@ -269,7 +269,7 @@ export declare function validateStrategy(data: unknown): z.SafeParseReturnType<{
|
|
|
269
269
|
maxHeight?: number | undefined;
|
|
270
270
|
} | {
|
|
271
271
|
type: "session_metric";
|
|
272
|
-
key:
|
|
272
|
+
key: "time_on_page" | "page_views" | "scroll_depth";
|
|
273
273
|
operator: "gte" | "lte" | "eq" | "gt" | "lt";
|
|
274
274
|
threshold: number;
|
|
275
275
|
} | {
|
|
@@ -292,7 +292,7 @@ export declare function validateStrategy(data: unknown): z.SafeParseReturnType<{
|
|
|
292
292
|
count: number;
|
|
293
293
|
withinMs?: number | undefined;
|
|
294
294
|
counter?: {
|
|
295
|
-
events:
|
|
295
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
296
296
|
match?: Record<string, {
|
|
297
297
|
equals?: string | number | boolean | undefined;
|
|
298
298
|
contains?: string | undefined;
|
|
@@ -359,7 +359,7 @@ export declare const decisionSchemas: ({
|
|
|
359
359
|
} | {
|
|
360
360
|
defName: string;
|
|
361
361
|
schema: z.ZodObject<{
|
|
362
|
-
events: z.ZodArray<z.
|
|
362
|
+
events: z.ZodArray<z.ZodEnum<["ui.click", "ui.scroll", "ui.input", "ui.change", "ui.submit", "ui.hover", "ui.idle", "ui.scroll_thrash", "ui.focus_bounce", "nav.page_view", "nav.page_leave", "behavior.rage_click", "behavior.hesitation", "behavior.confusion"]>, "many">;
|
|
363
363
|
match: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
364
364
|
equals: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
365
365
|
contains: z.ZodOptional<z.ZodString>;
|
|
@@ -371,13 +371,13 @@ export declare const decisionSchemas: ({
|
|
|
371
371
|
contains?: string | undefined;
|
|
372
372
|
}>>>;
|
|
373
373
|
}, "strip", z.ZodTypeAny, {
|
|
374
|
-
events:
|
|
374
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
375
375
|
match?: Record<string, {
|
|
376
376
|
equals?: string | number | boolean | undefined;
|
|
377
377
|
contains?: string | undefined;
|
|
378
378
|
}> | undefined;
|
|
379
379
|
}, {
|
|
380
|
-
events:
|
|
380
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
381
381
|
match?: Record<string, {
|
|
382
382
|
equals?: string | number | boolean | undefined;
|
|
383
383
|
contains?: string | undefined;
|
|
@@ -501,17 +501,17 @@ export declare const decisionSchemas: ({
|
|
|
501
501
|
maxHeight?: number | undefined;
|
|
502
502
|
}>, z.ZodObject<{
|
|
503
503
|
type: z.ZodLiteral<"session_metric">;
|
|
504
|
-
key: z.
|
|
504
|
+
key: z.ZodEnum<["time_on_page", "page_views", "scroll_depth"]>;
|
|
505
505
|
operator: z.ZodEnum<["gte", "lte", "eq", "gt", "lt"]>;
|
|
506
506
|
threshold: z.ZodNumber;
|
|
507
507
|
}, "strip", z.ZodTypeAny, {
|
|
508
508
|
type: "session_metric";
|
|
509
|
-
key:
|
|
509
|
+
key: "time_on_page" | "page_views" | "scroll_depth";
|
|
510
510
|
operator: "gte" | "lte" | "eq" | "gt" | "lt";
|
|
511
511
|
threshold: number;
|
|
512
512
|
}, {
|
|
513
513
|
type: "session_metric";
|
|
514
|
-
key:
|
|
514
|
+
key: "time_on_page" | "page_views" | "scroll_depth";
|
|
515
515
|
operator: "gte" | "lte" | "eq" | "gt" | "lt";
|
|
516
516
|
threshold: number;
|
|
517
517
|
}>, z.ZodObject<{
|
|
@@ -560,7 +560,7 @@ export declare const decisionSchemas: ({
|
|
|
560
560
|
count: z.ZodNumber;
|
|
561
561
|
withinMs: z.ZodOptional<z.ZodNumber>;
|
|
562
562
|
counter: z.ZodOptional<z.ZodObject<{
|
|
563
|
-
events: z.ZodArray<z.
|
|
563
|
+
events: z.ZodArray<z.ZodEnum<["ui.click", "ui.scroll", "ui.input", "ui.change", "ui.submit", "ui.hover", "ui.idle", "ui.scroll_thrash", "ui.focus_bounce", "nav.page_view", "nav.page_leave", "behavior.rage_click", "behavior.hesitation", "behavior.confusion"]>, "many">;
|
|
564
564
|
match: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
565
565
|
equals: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
566
566
|
contains: z.ZodOptional<z.ZodString>;
|
|
@@ -572,13 +572,13 @@ export declare const decisionSchemas: ({
|
|
|
572
572
|
contains?: string | undefined;
|
|
573
573
|
}>>>;
|
|
574
574
|
}, "strip", z.ZodTypeAny, {
|
|
575
|
-
events:
|
|
575
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
576
576
|
match?: Record<string, {
|
|
577
577
|
equals?: string | number | boolean | undefined;
|
|
578
578
|
contains?: string | undefined;
|
|
579
579
|
}> | undefined;
|
|
580
580
|
}, {
|
|
581
|
-
events:
|
|
581
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
582
582
|
match?: Record<string, {
|
|
583
583
|
equals?: string | number | boolean | undefined;
|
|
584
584
|
contains?: string | undefined;
|
|
@@ -591,7 +591,7 @@ export declare const decisionSchemas: ({
|
|
|
591
591
|
count: number;
|
|
592
592
|
withinMs?: number | undefined;
|
|
593
593
|
counter?: {
|
|
594
|
-
events:
|
|
594
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
595
595
|
match?: Record<string, {
|
|
596
596
|
equals?: string | number | boolean | undefined;
|
|
597
597
|
contains?: string | undefined;
|
|
@@ -604,7 +604,7 @@ export declare const decisionSchemas: ({
|
|
|
604
604
|
count: number;
|
|
605
605
|
withinMs?: number | undefined;
|
|
606
606
|
counter?: {
|
|
607
|
-
events:
|
|
607
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
608
608
|
match?: Record<string, {
|
|
609
609
|
equals?: string | number | boolean | undefined;
|
|
610
610
|
contains?: string | undefined;
|
|
@@ -639,7 +639,7 @@ export declare const decisionSchemas: ({
|
|
|
639
639
|
maxHeight?: number | undefined;
|
|
640
640
|
} | {
|
|
641
641
|
type: "session_metric";
|
|
642
|
-
key:
|
|
642
|
+
key: "time_on_page" | "page_views" | "scroll_depth";
|
|
643
643
|
operator: "gte" | "lte" | "eq" | "gt" | "lt";
|
|
644
644
|
threshold: number;
|
|
645
645
|
} | {
|
|
@@ -662,7 +662,7 @@ export declare const decisionSchemas: ({
|
|
|
662
662
|
count: number;
|
|
663
663
|
withinMs?: number | undefined;
|
|
664
664
|
counter?: {
|
|
665
|
-
events:
|
|
665
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
666
666
|
match?: Record<string, {
|
|
667
667
|
equals?: string | number | boolean | undefined;
|
|
668
668
|
contains?: string | undefined;
|
|
@@ -697,7 +697,7 @@ export declare const decisionSchemas: ({
|
|
|
697
697
|
maxHeight?: number | undefined;
|
|
698
698
|
} | {
|
|
699
699
|
type: "session_metric";
|
|
700
|
-
key:
|
|
700
|
+
key: "time_on_page" | "page_views" | "scroll_depth";
|
|
701
701
|
operator: "gte" | "lte" | "eq" | "gt" | "lt";
|
|
702
702
|
threshold: number;
|
|
703
703
|
} | {
|
|
@@ -720,7 +720,7 @@ export declare const decisionSchemas: ({
|
|
|
720
720
|
count: number;
|
|
721
721
|
withinMs?: number | undefined;
|
|
722
722
|
counter?: {
|
|
723
|
-
events:
|
|
723
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
724
724
|
match?: Record<string, {
|
|
725
725
|
equals?: string | number | boolean | undefined;
|
|
726
726
|
contains?: string | undefined;
|
|
@@ -759,7 +759,7 @@ export declare const decisionSchemas: ({
|
|
|
759
759
|
maxHeight?: number | undefined;
|
|
760
760
|
} | {
|
|
761
761
|
type: "session_metric";
|
|
762
|
-
key:
|
|
762
|
+
key: "time_on_page" | "page_views" | "scroll_depth";
|
|
763
763
|
operator: "gte" | "lte" | "eq" | "gt" | "lt";
|
|
764
764
|
threshold: number;
|
|
765
765
|
} | {
|
|
@@ -782,7 +782,7 @@ export declare const decisionSchemas: ({
|
|
|
782
782
|
count: number;
|
|
783
783
|
withinMs?: number | undefined;
|
|
784
784
|
counter?: {
|
|
785
|
-
events:
|
|
785
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
786
786
|
match?: Record<string, {
|
|
787
787
|
equals?: string | number | boolean | undefined;
|
|
788
788
|
contains?: string | undefined;
|
|
@@ -821,7 +821,7 @@ export declare const decisionSchemas: ({
|
|
|
821
821
|
maxHeight?: number | undefined;
|
|
822
822
|
} | {
|
|
823
823
|
type: "session_metric";
|
|
824
|
-
key:
|
|
824
|
+
key: "time_on_page" | "page_views" | "scroll_depth";
|
|
825
825
|
operator: "gte" | "lte" | "eq" | "gt" | "lt";
|
|
826
826
|
threshold: number;
|
|
827
827
|
} | {
|
|
@@ -844,7 +844,7 @@ export declare const decisionSchemas: ({
|
|
|
844
844
|
count: number;
|
|
845
845
|
withinMs?: number | undefined;
|
|
846
846
|
counter?: {
|
|
847
|
-
events:
|
|
847
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
848
848
|
match?: Record<string, {
|
|
849
849
|
equals?: string | number | boolean | undefined;
|
|
850
850
|
contains?: string | undefined;
|
|
@@ -995,17 +995,17 @@ export declare const decisionSchemas: ({
|
|
|
995
995
|
maxHeight?: number | undefined;
|
|
996
996
|
}>, z.ZodObject<{
|
|
997
997
|
type: z.ZodLiteral<"session_metric">;
|
|
998
|
-
key: z.
|
|
998
|
+
key: z.ZodEnum<["time_on_page", "page_views", "scroll_depth"]>;
|
|
999
999
|
operator: z.ZodEnum<["gte", "lte", "eq", "gt", "lt"]>;
|
|
1000
1000
|
threshold: z.ZodNumber;
|
|
1001
1001
|
}, "strip", z.ZodTypeAny, {
|
|
1002
1002
|
type: "session_metric";
|
|
1003
|
-
key:
|
|
1003
|
+
key: "time_on_page" | "page_views" | "scroll_depth";
|
|
1004
1004
|
operator: "gte" | "lte" | "eq" | "gt" | "lt";
|
|
1005
1005
|
threshold: number;
|
|
1006
1006
|
}, {
|
|
1007
1007
|
type: "session_metric";
|
|
1008
|
-
key:
|
|
1008
|
+
key: "time_on_page" | "page_views" | "scroll_depth";
|
|
1009
1009
|
operator: "gte" | "lte" | "eq" | "gt" | "lt";
|
|
1010
1010
|
threshold: number;
|
|
1011
1011
|
}>, z.ZodObject<{
|
|
@@ -1054,7 +1054,7 @@ export declare const decisionSchemas: ({
|
|
|
1054
1054
|
count: z.ZodNumber;
|
|
1055
1055
|
withinMs: z.ZodOptional<z.ZodNumber>;
|
|
1056
1056
|
counter: z.ZodOptional<z.ZodObject<{
|
|
1057
|
-
events: z.ZodArray<z.
|
|
1057
|
+
events: z.ZodArray<z.ZodEnum<["ui.click", "ui.scroll", "ui.input", "ui.change", "ui.submit", "ui.hover", "ui.idle", "ui.scroll_thrash", "ui.focus_bounce", "nav.page_view", "nav.page_leave", "behavior.rage_click", "behavior.hesitation", "behavior.confusion"]>, "many">;
|
|
1058
1058
|
match: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1059
1059
|
equals: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
1060
1060
|
contains: z.ZodOptional<z.ZodString>;
|
|
@@ -1066,13 +1066,13 @@ export declare const decisionSchemas: ({
|
|
|
1066
1066
|
contains?: string | undefined;
|
|
1067
1067
|
}>>>;
|
|
1068
1068
|
}, "strip", z.ZodTypeAny, {
|
|
1069
|
-
events:
|
|
1069
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
1070
1070
|
match?: Record<string, {
|
|
1071
1071
|
equals?: string | number | boolean | undefined;
|
|
1072
1072
|
contains?: string | undefined;
|
|
1073
1073
|
}> | undefined;
|
|
1074
1074
|
}, {
|
|
1075
|
-
events:
|
|
1075
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
1076
1076
|
match?: Record<string, {
|
|
1077
1077
|
equals?: string | number | boolean | undefined;
|
|
1078
1078
|
contains?: string | undefined;
|
|
@@ -1085,7 +1085,7 @@ export declare const decisionSchemas: ({
|
|
|
1085
1085
|
count: number;
|
|
1086
1086
|
withinMs?: number | undefined;
|
|
1087
1087
|
counter?: {
|
|
1088
|
-
events:
|
|
1088
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
1089
1089
|
match?: Record<string, {
|
|
1090
1090
|
equals?: string | number | boolean | undefined;
|
|
1091
1091
|
contains?: string | undefined;
|
|
@@ -1098,7 +1098,7 @@ export declare const decisionSchemas: ({
|
|
|
1098
1098
|
count: number;
|
|
1099
1099
|
withinMs?: number | undefined;
|
|
1100
1100
|
counter?: {
|
|
1101
|
-
events:
|
|
1101
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
1102
1102
|
match?: Record<string, {
|
|
1103
1103
|
equals?: string | number | boolean | undefined;
|
|
1104
1104
|
contains?: string | undefined;
|
|
@@ -1133,7 +1133,7 @@ export declare const decisionSchemas: ({
|
|
|
1133
1133
|
maxHeight?: number | undefined;
|
|
1134
1134
|
} | {
|
|
1135
1135
|
type: "session_metric";
|
|
1136
|
-
key:
|
|
1136
|
+
key: "time_on_page" | "page_views" | "scroll_depth";
|
|
1137
1137
|
operator: "gte" | "lte" | "eq" | "gt" | "lt";
|
|
1138
1138
|
threshold: number;
|
|
1139
1139
|
} | {
|
|
@@ -1156,7 +1156,7 @@ export declare const decisionSchemas: ({
|
|
|
1156
1156
|
count: number;
|
|
1157
1157
|
withinMs?: number | undefined;
|
|
1158
1158
|
counter?: {
|
|
1159
|
-
events:
|
|
1159
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
1160
1160
|
match?: Record<string, {
|
|
1161
1161
|
equals?: string | number | boolean | undefined;
|
|
1162
1162
|
contains?: string | undefined;
|
|
@@ -1191,7 +1191,7 @@ export declare const decisionSchemas: ({
|
|
|
1191
1191
|
maxHeight?: number | undefined;
|
|
1192
1192
|
} | {
|
|
1193
1193
|
type: "session_metric";
|
|
1194
|
-
key:
|
|
1194
|
+
key: "time_on_page" | "page_views" | "scroll_depth";
|
|
1195
1195
|
operator: "gte" | "lte" | "eq" | "gt" | "lt";
|
|
1196
1196
|
threshold: number;
|
|
1197
1197
|
} | {
|
|
@@ -1214,7 +1214,7 @@ export declare const decisionSchemas: ({
|
|
|
1214
1214
|
count: number;
|
|
1215
1215
|
withinMs?: number | undefined;
|
|
1216
1216
|
counter?: {
|
|
1217
|
-
events:
|
|
1217
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
1218
1218
|
match?: Record<string, {
|
|
1219
1219
|
equals?: string | number | boolean | undefined;
|
|
1220
1220
|
contains?: string | undefined;
|
|
@@ -1299,17 +1299,17 @@ export declare const decisionSchemas: ({
|
|
|
1299
1299
|
maxHeight?: number | undefined;
|
|
1300
1300
|
}>, z.ZodObject<{
|
|
1301
1301
|
type: z.ZodLiteral<"session_metric">;
|
|
1302
|
-
key: z.
|
|
1302
|
+
key: z.ZodEnum<["time_on_page", "page_views", "scroll_depth"]>;
|
|
1303
1303
|
operator: z.ZodEnum<["gte", "lte", "eq", "gt", "lt"]>;
|
|
1304
1304
|
threshold: z.ZodNumber;
|
|
1305
1305
|
}, "strip", z.ZodTypeAny, {
|
|
1306
1306
|
type: "session_metric";
|
|
1307
|
-
key:
|
|
1307
|
+
key: "time_on_page" | "page_views" | "scroll_depth";
|
|
1308
1308
|
operator: "gte" | "lte" | "eq" | "gt" | "lt";
|
|
1309
1309
|
threshold: number;
|
|
1310
1310
|
}, {
|
|
1311
1311
|
type: "session_metric";
|
|
1312
|
-
key:
|
|
1312
|
+
key: "time_on_page" | "page_views" | "scroll_depth";
|
|
1313
1313
|
operator: "gte" | "lte" | "eq" | "gt" | "lt";
|
|
1314
1314
|
threshold: number;
|
|
1315
1315
|
}>, z.ZodObject<{
|
|
@@ -1358,7 +1358,7 @@ export declare const decisionSchemas: ({
|
|
|
1358
1358
|
count: z.ZodNumber;
|
|
1359
1359
|
withinMs: z.ZodOptional<z.ZodNumber>;
|
|
1360
1360
|
counter: z.ZodOptional<z.ZodObject<{
|
|
1361
|
-
events: z.ZodArray<z.
|
|
1361
|
+
events: z.ZodArray<z.ZodEnum<["ui.click", "ui.scroll", "ui.input", "ui.change", "ui.submit", "ui.hover", "ui.idle", "ui.scroll_thrash", "ui.focus_bounce", "nav.page_view", "nav.page_leave", "behavior.rage_click", "behavior.hesitation", "behavior.confusion"]>, "many">;
|
|
1362
1362
|
match: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1363
1363
|
equals: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
1364
1364
|
contains: z.ZodOptional<z.ZodString>;
|
|
@@ -1370,13 +1370,13 @@ export declare const decisionSchemas: ({
|
|
|
1370
1370
|
contains?: string | undefined;
|
|
1371
1371
|
}>>>;
|
|
1372
1372
|
}, "strip", z.ZodTypeAny, {
|
|
1373
|
-
events:
|
|
1373
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
1374
1374
|
match?: Record<string, {
|
|
1375
1375
|
equals?: string | number | boolean | undefined;
|
|
1376
1376
|
contains?: string | undefined;
|
|
1377
1377
|
}> | undefined;
|
|
1378
1378
|
}, {
|
|
1379
|
-
events:
|
|
1379
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
1380
1380
|
match?: Record<string, {
|
|
1381
1381
|
equals?: string | number | boolean | undefined;
|
|
1382
1382
|
contains?: string | undefined;
|
|
@@ -1389,7 +1389,7 @@ export declare const decisionSchemas: ({
|
|
|
1389
1389
|
count: number;
|
|
1390
1390
|
withinMs?: number | undefined;
|
|
1391
1391
|
counter?: {
|
|
1392
|
-
events:
|
|
1392
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
1393
1393
|
match?: Record<string, {
|
|
1394
1394
|
equals?: string | number | boolean | undefined;
|
|
1395
1395
|
contains?: string | undefined;
|
|
@@ -1402,7 +1402,7 @@ export declare const decisionSchemas: ({
|
|
|
1402
1402
|
count: number;
|
|
1403
1403
|
withinMs?: number | undefined;
|
|
1404
1404
|
counter?: {
|
|
1405
|
-
events:
|
|
1405
|
+
events: ("ui.click" | "ui.scroll" | "ui.input" | "ui.change" | "ui.submit" | "ui.hover" | "ui.idle" | "ui.scroll_thrash" | "ui.focus_bounce" | "nav.page_view" | "nav.page_leave" | "behavior.rage_click" | "behavior.hesitation" | "behavior.confusion")[];
|
|
1406
1406
|
match?: Record<string, {
|
|
1407
1407
|
equals?: string | number | boolean | undefined;
|
|
1408
1408
|
contains?: string | undefined;
|
package/dist/decisions/schema.js
CHANGED
|
@@ -6,10 +6,19 @@
|
|
|
6
6
|
* - Event history for recent event lookups
|
|
7
7
|
* - Filtering by name, pattern, or source
|
|
8
8
|
*/
|
|
9
|
-
import type {
|
|
9
|
+
import type { EventHistory } from './history';
|
|
10
|
+
import type { EmitResult, EventCallback, EventFilter, EventUnsubscribe, NormalizedEvent } from './types';
|
|
10
11
|
export interface EventBusOptions {
|
|
11
12
|
/** Maximum number of events to keep in history */
|
|
12
13
|
maxHistorySize?: number;
|
|
14
|
+
/** Enable debug mode — emit() returns EmitResult and logs to console */
|
|
15
|
+
debug?: boolean;
|
|
16
|
+
/** EventHistory instance for recording emitted events (debug/test) */
|
|
17
|
+
history?: EventHistory;
|
|
18
|
+
/** PostHog capture function for forwarding custom events */
|
|
19
|
+
posthogCapture?: (name: string, props?: Record<string, unknown>) => void;
|
|
20
|
+
/** When true, skip PostHog forwarding (for tests) */
|
|
21
|
+
testMode?: boolean;
|
|
13
22
|
}
|
|
14
23
|
/**
|
|
15
24
|
* EventBus class for managing normalized events.
|
|
@@ -18,6 +27,10 @@ export declare class EventBus {
|
|
|
18
27
|
private subscriptions;
|
|
19
28
|
private history;
|
|
20
29
|
private maxHistorySize;
|
|
30
|
+
private debug;
|
|
31
|
+
private emitHistory;
|
|
32
|
+
private posthogCapture;
|
|
33
|
+
private testMode;
|
|
21
34
|
constructor(options?: EventBusOptions);
|
|
22
35
|
/**
|
|
23
36
|
* Subscribe to events matching an optional filter.
|
|
@@ -32,6 +45,19 @@ export declare class EventBus {
|
|
|
32
45
|
* Publish a pre-constructed NormalizedEvent.
|
|
33
46
|
*/
|
|
34
47
|
publishEvent(event: NormalizedEvent): void;
|
|
48
|
+
/**
|
|
49
|
+
* Emit a validated custom event from the host application.
|
|
50
|
+
*
|
|
51
|
+
* Custom events must use the `app:` prefix (e.g. `app:cart:abandoned`).
|
|
52
|
+
* In debug mode, returns an EmitResult with delivery details.
|
|
53
|
+
* In production mode, returns undefined.
|
|
54
|
+
*/
|
|
55
|
+
emit(name: string, props?: Record<string, unknown>): EmitResult | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Set the PostHog capture function after construction.
|
|
58
|
+
* Used by bootstrap to wire PostHog after the EventBus is created.
|
|
59
|
+
*/
|
|
60
|
+
setPosthogCapture(fn: (name: string, props?: Record<string, unknown>) => void): void;
|
|
35
61
|
/**
|
|
36
62
|
* Get recent events matching an optional filter.
|
|
37
63
|
*/
|
package/dist/events/index.d.ts
CHANGED
|
@@ -5,8 +5,11 @@ export type { EventAccumulator, EventAccumulatorOptions } from './EventAccumulat
|
|
|
5
5
|
export { createEventAccumulator } from './EventAccumulator';
|
|
6
6
|
export type { EventBusOptions } from './EventBus';
|
|
7
7
|
export { createEventBus, EventBus } from './EventBus';
|
|
8
|
+
export { EventHistory } from './history';
|
|
8
9
|
export { CanvasEvents } from './normalizers/canvas';
|
|
9
10
|
export { createPostHogNormalizer, normalizePostHogEvent, shouldNormalizeEvent, } from './normalizers/posthog';
|
|
10
11
|
export { registerConfigPredicates } from './registerConfigPredicates';
|
|
11
12
|
export * from './schema';
|
|
12
13
|
export * from './types';
|
|
14
|
+
export type { ValidationResult as EventValidationResult } from './validation';
|
|
15
|
+
export { validateEventName, validateProps } from './validation';
|
|
@@ -1,53 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* PostHog Event Normalizer
|
|
2
|
+
* PostHog Event Normalizer — re-exported from @syntrologie/event-processor.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* This module is automatically wired up during `Syntro.init()` when PostHog
|
|
7
|
-
* credentials are provided in the token. The flow is:
|
|
8
|
-
*
|
|
9
|
-
* 1. PostHog captures user interactions (clicks, scrolls, navigation, etc.)
|
|
10
|
-
* 2. PostHog's `eventCaptured` callback fires
|
|
11
|
-
* 3. `createPostHogNormalizer()` transforms the event to a NormalizedEvent
|
|
12
|
-
* 4. The normalized event is published to the EventBus
|
|
13
|
-
*
|
|
14
|
-
* This allows canvas components and decision strategies to react to user
|
|
15
|
-
* interactions with the main webapp, not just canvas-specific events.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```typescript
|
|
19
|
-
* // In bootstrap.ts (already wired up automatically)
|
|
20
|
-
* const normalizer = createPostHogNormalizer((event) => {
|
|
21
|
-
* eventBus.publishEvent(event);
|
|
22
|
-
* });
|
|
23
|
-
*
|
|
24
|
-
* // PostHog adapter calls normalizer on each capture
|
|
25
|
-
* posthog.on('eventCaptured', normalizer);
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* @see RUNTIME_V2_REFERENCE.md for the full event mapping table
|
|
29
|
-
*/
|
|
30
|
-
import type { NormalizedEvent } from '../types';
|
|
31
|
-
/**
|
|
32
|
-
* PostHog event structure (simplified).
|
|
33
|
-
*/
|
|
34
|
-
interface PostHogEvent {
|
|
35
|
-
event: string;
|
|
36
|
-
properties?: Record<string, unknown>;
|
|
37
|
-
timestamp?: string | number;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Normalize a PostHog event into a NormalizedEvent.
|
|
41
|
-
*/
|
|
42
|
-
export declare function normalizePostHogEvent(phEvent: PostHogEvent): NormalizedEvent;
|
|
43
|
-
/**
|
|
44
|
-
* Check if a PostHog event should be normalized.
|
|
45
|
-
* Filters out internal/system events that aren't useful for adaptives.
|
|
46
|
-
*/
|
|
47
|
-
export declare function shouldNormalizeEvent(phEvent: PostHogEvent): boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Create a function that hooks into PostHog's onCapture callback
|
|
50
|
-
* and normalizes events into the EventBus.
|
|
4
|
+
* The canonical implementation now lives in the event-processor package
|
|
5
|
+
* so it can be shared between runtime-sdk (browser) and the data pipeline.
|
|
51
6
|
*/
|
|
52
|
-
export
|
|
53
|
-
export {};
|
|
7
|
+
export { createPostHogNormalizer, normalizePostHogEvent, shouldNormalizeEvent, } from '@syntrologie/event-processor/normalizers/posthog';
|
package/dist/events/types.d.ts
CHANGED
|
@@ -4,25 +4,8 @@
|
|
|
4
4
|
* The EventBus provides a normalized event stream that unifies events from
|
|
5
5
|
* PostHog autocapture, Canvas events, and derived behavioral signals.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*/
|
|
10
|
-
export type EventSource = 'posthog' | 'canvas' | 'derived';
|
|
11
|
-
/**
|
|
12
|
-
* Normalized event structure for the event bus.
|
|
13
|
-
*/
|
|
14
|
-
export interface NormalizedEvent {
|
|
15
|
-
/** Event timestamp (milliseconds since epoch) */
|
|
16
|
-
ts: number;
|
|
17
|
-
/** Normalized event name (e.g., "ui.click", "canvas.opened") */
|
|
18
|
-
name: string;
|
|
19
|
-
/** Event source */
|
|
20
|
-
source: EventSource;
|
|
21
|
-
/** Event properties/payload */
|
|
22
|
-
props?: Record<string, unknown>;
|
|
23
|
-
/** Schema version for forward compatibility */
|
|
24
|
-
schemaVersion: string;
|
|
25
|
-
}
|
|
7
|
+
export type { EventSource, NormalizedEvent } from '@syntrologie/event-processor';
|
|
8
|
+
export { EVENT_SCHEMA_VERSION } from '@syntrologie/event-processor';
|
|
26
9
|
/**
|
|
27
10
|
* Event filter for subscriptions.
|
|
28
11
|
*/
|
|
@@ -32,18 +15,22 @@ export interface EventFilter {
|
|
|
32
15
|
/** Filter by event name patterns (regex) */
|
|
33
16
|
patterns?: string[];
|
|
34
17
|
/** Filter by sources */
|
|
35
|
-
sources?: EventSource[];
|
|
18
|
+
sources?: import('@syntrologie/event-processor').EventSource[];
|
|
36
19
|
}
|
|
37
20
|
/**
|
|
38
21
|
* Callback for event subscriptions.
|
|
39
22
|
*/
|
|
40
|
-
export type EventCallback = (event: NormalizedEvent) => void;
|
|
23
|
+
export type EventCallback = (event: import('@syntrologie/event-processor').NormalizedEvent) => void;
|
|
41
24
|
/**
|
|
42
25
|
* Unsubscribe function returned by subscribe().
|
|
43
26
|
*/
|
|
44
27
|
export type EventUnsubscribe = () => void;
|
|
45
28
|
/**
|
|
46
29
|
* Standard event names used by the runtime.
|
|
30
|
+
*
|
|
31
|
+
* This is a superset of event-processor's StandardEvents, adding
|
|
32
|
+
* canvas, overlay, action, notification, and surface events that
|
|
33
|
+
* are specific to the runtime SDK.
|
|
47
34
|
*/
|
|
48
35
|
export declare const StandardEvents: {
|
|
49
36
|
readonly UI_CLICK: "ui.click";
|
|
@@ -78,6 +65,26 @@ export declare const StandardEvents: {
|
|
|
78
65
|
readonly SURFACE_UNMOUNTED: "surface.unmounted";
|
|
79
66
|
};
|
|
80
67
|
/**
|
|
81
|
-
*
|
|
68
|
+
* Result returned from emit() in debug mode.
|
|
69
|
+
* In production mode, emit() returns undefined.
|
|
70
|
+
*/
|
|
71
|
+
export interface EmitResult {
|
|
72
|
+
delivered: boolean;
|
|
73
|
+
matchedRules: Array<{
|
|
74
|
+
tileId: string;
|
|
75
|
+
ruleIndex: number;
|
|
76
|
+
title: string;
|
|
77
|
+
}>;
|
|
78
|
+
posthogCaptured: boolean;
|
|
79
|
+
listenersNotified: number;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Entry in the debug/test event history.
|
|
82
83
|
*/
|
|
83
|
-
export
|
|
84
|
+
export interface EmitHistoryEntry {
|
|
85
|
+
name: string;
|
|
86
|
+
props?: Record<string, unknown>;
|
|
87
|
+
source: 'custom';
|
|
88
|
+
timestamp: number;
|
|
89
|
+
matchedRules: EmitResult['matchedRules'];
|
|
90
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface ValidationResult {
|
|
2
|
+
valid: boolean;
|
|
3
|
+
reason?: string;
|
|
4
|
+
stripped?: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare function validateEventName(name: string): ValidationResult;
|
|
7
|
+
export declare function validateProps(props: Record<string, unknown> | undefined): ValidationResult;
|