@syntrologie/runtime-sdk 2.4.0-canary.2 → 2.4.0-canary.21
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 +116 -1
- package/dist/SmartCanvasApp.d.ts +5 -3
- package/dist/actions/executors/index.d.ts +1 -2
- package/dist/actions/index.d.ts +2 -2
- package/dist/actions/schema.d.ts +58243 -201
- package/dist/actions/schema.js +5 -2
- package/dist/actions/types.d.ts +45 -48
- package/dist/anchor/AnchorResolver.d.ts +18 -0
- package/dist/anchor/index.d.ts +2 -0
- package/dist/api.d.ts +3 -8
- package/dist/apps/examples/gamification-app.example.d.ts +8 -8
- package/dist/chunk-2UYZ5DWI.js +126 -0
- package/dist/chunk-2UYZ5DWI.js.map +7 -0
- package/dist/{chunk-DOJR7R46.js → chunk-HF3D7YFQ.js} +49 -31
- package/dist/chunk-HF3D7YFQ.js.map +7 -0
- package/dist/{chunk-ZDZ3IYFN.js → chunk-IPU3WVPY.js} +3449 -2110
- package/dist/chunk-IPU3WVPY.js.map +7 -0
- package/dist/{chunk-BIYMC56J.js → chunk-P5G4KT2U.js} +54 -6
- package/dist/chunk-P5G4KT2U.js.map +7 -0
- package/dist/components/ShadowCanvasOverlay.d.ts +1 -20
- package/dist/config/schema.d.ts +1797 -267
- package/dist/config/schema.js +19 -62
- package/dist/config/schema.js.map +3 -3
- package/dist/context/schema.d.ts +8 -8
- package/dist/decisions/schema.d.ts +506 -1490
- package/dist/decisions/schema.js +5 -2
- package/dist/decisions/types.d.ts +22 -0
- package/dist/events/registerConfigPredicates.d.ts +7 -10
- package/dist/events/schema.d.ts +12 -12
- package/dist/experiments/adapters/growthbook.d.ts +2 -0
- package/dist/experiments/types.d.ts +7 -0
- package/dist/hooks/useShadowCanvasConfig.d.ts +4 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +72 -98
- package/dist/index.js.map +3 -3
- package/dist/overlays/schema.d.ts +48 -48
- package/dist/react.js +4 -3
- package/dist/react.js.map +1 -1
- package/dist/runtime.d.ts +3 -0
- package/dist/smart-canvas.esm.js +62 -66
- package/dist/smart-canvas.esm.js.map +4 -4
- package/dist/smart-canvas.js +2591 -1167
- package/dist/smart-canvas.js.map +4 -4
- package/dist/smart-canvas.min.js +62 -66
- package/dist/smart-canvas.min.js.map +4 -4
- package/dist/surfaces/types.d.ts +2 -1
- package/dist/theme/ThemeProvider.d.ts +11 -16
- package/dist/theme/defaultTheme.d.ts +6 -1
- package/dist/theme/index.d.ts +3 -4
- package/dist/theme/types.d.ts +10 -0
- package/dist/version.d.ts +1 -1
- package/package.json +7 -7
- package/schema/canvas-config.schema.json +9418 -790
- package/scripts/validate-config.mjs +78 -0
- package/dist/actions/executors/tour.d.ts +0 -18
- package/dist/chunk-BIYMC56J.js.map +0 -7
- package/dist/chunk-DOJR7R46.js.map +0 -7
- package/dist/chunk-JMHRHAEL.js +0 -18
- package/dist/chunk-JMHRHAEL.js.map +0 -7
- package/dist/chunk-ZDZ3IYFN.js.map +0 -7
- package/dist/hooks/useHostPatches.d.ts +0 -9
- package/dist/theme/extractHostTheme.d.ts +0 -14
|
@@ -15,11 +15,11 @@ export declare const SelectorZ: z.ZodUnion<[z.ZodObject<{
|
|
|
15
15
|
type: z.ZodLiteral<"css">;
|
|
16
16
|
value: z.ZodString;
|
|
17
17
|
}, "strip", z.ZodTypeAny, {
|
|
18
|
-
value: string;
|
|
19
18
|
type: "css";
|
|
20
|
-
}, {
|
|
21
19
|
value: string;
|
|
20
|
+
}, {
|
|
22
21
|
type: "css";
|
|
22
|
+
value: string;
|
|
23
23
|
}>, z.ZodObject<{
|
|
24
24
|
type: z.ZodLiteral<"aria">;
|
|
25
25
|
role: z.ZodOptional<z.ZodString>;
|
|
@@ -36,11 +36,11 @@ export declare const SelectorZ: z.ZodUnion<[z.ZodObject<{
|
|
|
36
36
|
type: z.ZodLiteral<"shadow-css">;
|
|
37
37
|
value: z.ZodString;
|
|
38
38
|
}, "strip", z.ZodTypeAny, {
|
|
39
|
-
value: string;
|
|
40
39
|
type: "shadow-css";
|
|
41
|
-
}, {
|
|
42
40
|
value: string;
|
|
41
|
+
}, {
|
|
43
42
|
type: "shadow-css";
|
|
43
|
+
value: string;
|
|
44
44
|
}>, z.ZodObject<{
|
|
45
45
|
type: z.ZodLiteral<"ref">;
|
|
46
46
|
el: z.ZodAny;
|
|
@@ -70,11 +70,11 @@ export declare const TooltipStepZ: z.ZodObject<{
|
|
|
70
70
|
type: z.ZodLiteral<"css">;
|
|
71
71
|
value: z.ZodString;
|
|
72
72
|
}, "strip", z.ZodTypeAny, {
|
|
73
|
-
value: string;
|
|
74
73
|
type: "css";
|
|
75
|
-
}, {
|
|
76
74
|
value: string;
|
|
75
|
+
}, {
|
|
77
76
|
type: "css";
|
|
77
|
+
value: string;
|
|
78
78
|
}>, z.ZodObject<{
|
|
79
79
|
type: z.ZodLiteral<"aria">;
|
|
80
80
|
role: z.ZodOptional<z.ZodString>;
|
|
@@ -91,11 +91,11 @@ export declare const TooltipStepZ: z.ZodObject<{
|
|
|
91
91
|
type: z.ZodLiteral<"shadow-css">;
|
|
92
92
|
value: z.ZodString;
|
|
93
93
|
}, "strip", z.ZodTypeAny, {
|
|
94
|
-
value: string;
|
|
95
94
|
type: "shadow-css";
|
|
96
|
-
}, {
|
|
97
95
|
value: string;
|
|
96
|
+
}, {
|
|
98
97
|
type: "shadow-css";
|
|
98
|
+
value: string;
|
|
99
99
|
}>, z.ZodObject<{
|
|
100
100
|
type: z.ZodLiteral<"ref">;
|
|
101
101
|
el: z.ZodAny;
|
|
@@ -145,15 +145,15 @@ export declare const TooltipStepZ: z.ZodObject<{
|
|
|
145
145
|
key: string;
|
|
146
146
|
value?: string | undefined;
|
|
147
147
|
} | {
|
|
148
|
-
value: string;
|
|
149
148
|
type: "css";
|
|
149
|
+
value: string;
|
|
150
150
|
} | {
|
|
151
151
|
type: "aria";
|
|
152
152
|
label?: string | undefined;
|
|
153
153
|
role?: string | undefined;
|
|
154
154
|
} | {
|
|
155
|
-
value: string;
|
|
156
155
|
type: "shadow-css";
|
|
156
|
+
value: string;
|
|
157
157
|
} | {
|
|
158
158
|
type: "ref";
|
|
159
159
|
el?: any;
|
|
@@ -179,15 +179,15 @@ export declare const TooltipStepZ: z.ZodObject<{
|
|
|
179
179
|
key: string;
|
|
180
180
|
value?: string | undefined;
|
|
181
181
|
} | {
|
|
182
|
-
value: string;
|
|
183
182
|
type: "css";
|
|
183
|
+
value: string;
|
|
184
184
|
} | {
|
|
185
185
|
type: "aria";
|
|
186
186
|
label?: string | undefined;
|
|
187
187
|
role?: string | undefined;
|
|
188
188
|
} | {
|
|
189
|
-
value: string;
|
|
190
189
|
type: "shadow-css";
|
|
190
|
+
value: string;
|
|
191
191
|
} | {
|
|
192
192
|
type: "ref";
|
|
193
193
|
el?: any;
|
|
@@ -221,11 +221,11 @@ export declare const HighlightStepZ: z.ZodObject<{
|
|
|
221
221
|
type: z.ZodLiteral<"css">;
|
|
222
222
|
value: z.ZodString;
|
|
223
223
|
}, "strip", z.ZodTypeAny, {
|
|
224
|
-
value: string;
|
|
225
224
|
type: "css";
|
|
226
|
-
}, {
|
|
227
225
|
value: string;
|
|
226
|
+
}, {
|
|
228
227
|
type: "css";
|
|
228
|
+
value: string;
|
|
229
229
|
}>, z.ZodObject<{
|
|
230
230
|
type: z.ZodLiteral<"aria">;
|
|
231
231
|
role: z.ZodOptional<z.ZodString>;
|
|
@@ -242,11 +242,11 @@ export declare const HighlightStepZ: z.ZodObject<{
|
|
|
242
242
|
type: z.ZodLiteral<"shadow-css">;
|
|
243
243
|
value: z.ZodString;
|
|
244
244
|
}, "strip", z.ZodTypeAny, {
|
|
245
|
-
value: string;
|
|
246
245
|
type: "shadow-css";
|
|
247
|
-
}, {
|
|
248
246
|
value: string;
|
|
247
|
+
}, {
|
|
249
248
|
type: "shadow-css";
|
|
249
|
+
value: string;
|
|
250
250
|
}>, z.ZodObject<{
|
|
251
251
|
type: z.ZodLiteral<"ref">;
|
|
252
252
|
el: z.ZodAny;
|
|
@@ -298,15 +298,15 @@ export declare const HighlightStepZ: z.ZodObject<{
|
|
|
298
298
|
key: string;
|
|
299
299
|
value?: string | undefined;
|
|
300
300
|
} | {
|
|
301
|
-
value: string;
|
|
302
301
|
type: "css";
|
|
302
|
+
value: string;
|
|
303
303
|
} | {
|
|
304
304
|
type: "aria";
|
|
305
305
|
label?: string | undefined;
|
|
306
306
|
role?: string | undefined;
|
|
307
307
|
} | {
|
|
308
|
-
value: string;
|
|
309
308
|
type: "shadow-css";
|
|
309
|
+
value: string;
|
|
310
310
|
} | {
|
|
311
311
|
type: "ref";
|
|
312
312
|
el?: any;
|
|
@@ -334,15 +334,15 @@ export declare const HighlightStepZ: z.ZodObject<{
|
|
|
334
334
|
key: string;
|
|
335
335
|
value?: string | undefined;
|
|
336
336
|
} | {
|
|
337
|
-
value: string;
|
|
338
337
|
type: "css";
|
|
338
|
+
value: string;
|
|
339
339
|
} | {
|
|
340
340
|
type: "aria";
|
|
341
341
|
label?: string | undefined;
|
|
342
342
|
role?: string | undefined;
|
|
343
343
|
} | {
|
|
344
|
-
value: string;
|
|
345
344
|
type: "shadow-css";
|
|
345
|
+
value: string;
|
|
346
346
|
} | {
|
|
347
347
|
type: "ref";
|
|
348
348
|
el?: any;
|
|
@@ -386,11 +386,11 @@ export declare const CanvasRecipeZ: z.ZodObject<{
|
|
|
386
386
|
type: z.ZodLiteral<"css">;
|
|
387
387
|
value: z.ZodString;
|
|
388
388
|
}, "strip", z.ZodTypeAny, {
|
|
389
|
-
value: string;
|
|
390
389
|
type: "css";
|
|
391
|
-
}, {
|
|
392
390
|
value: string;
|
|
391
|
+
}, {
|
|
393
392
|
type: "css";
|
|
393
|
+
value: string;
|
|
394
394
|
}>, z.ZodObject<{
|
|
395
395
|
type: z.ZodLiteral<"aria">;
|
|
396
396
|
role: z.ZodOptional<z.ZodString>;
|
|
@@ -407,11 +407,11 @@ export declare const CanvasRecipeZ: z.ZodObject<{
|
|
|
407
407
|
type: z.ZodLiteral<"shadow-css">;
|
|
408
408
|
value: z.ZodString;
|
|
409
409
|
}, "strip", z.ZodTypeAny, {
|
|
410
|
-
value: string;
|
|
411
410
|
type: "shadow-css";
|
|
412
|
-
}, {
|
|
413
411
|
value: string;
|
|
412
|
+
}, {
|
|
414
413
|
type: "shadow-css";
|
|
414
|
+
value: string;
|
|
415
415
|
}>, z.ZodObject<{
|
|
416
416
|
type: z.ZodLiteral<"ref">;
|
|
417
417
|
el: z.ZodAny;
|
|
@@ -461,15 +461,15 @@ export declare const CanvasRecipeZ: z.ZodObject<{
|
|
|
461
461
|
key: string;
|
|
462
462
|
value?: string | undefined;
|
|
463
463
|
} | {
|
|
464
|
-
value: string;
|
|
465
464
|
type: "css";
|
|
465
|
+
value: string;
|
|
466
466
|
} | {
|
|
467
467
|
type: "aria";
|
|
468
468
|
label?: string | undefined;
|
|
469
469
|
role?: string | undefined;
|
|
470
470
|
} | {
|
|
471
|
-
value: string;
|
|
472
471
|
type: "shadow-css";
|
|
472
|
+
value: string;
|
|
473
473
|
} | {
|
|
474
474
|
type: "ref";
|
|
475
475
|
el?: any;
|
|
@@ -495,15 +495,15 @@ export declare const CanvasRecipeZ: z.ZodObject<{
|
|
|
495
495
|
key: string;
|
|
496
496
|
value?: string | undefined;
|
|
497
497
|
} | {
|
|
498
|
-
value: string;
|
|
499
498
|
type: "css";
|
|
499
|
+
value: string;
|
|
500
500
|
} | {
|
|
501
501
|
type: "aria";
|
|
502
502
|
label?: string | undefined;
|
|
503
503
|
role?: string | undefined;
|
|
504
504
|
} | {
|
|
505
|
-
value: string;
|
|
506
505
|
type: "shadow-css";
|
|
506
|
+
value: string;
|
|
507
507
|
} | {
|
|
508
508
|
type: "ref";
|
|
509
509
|
el?: any;
|
|
@@ -536,11 +536,11 @@ export declare const CanvasRecipeZ: z.ZodObject<{
|
|
|
536
536
|
type: z.ZodLiteral<"css">;
|
|
537
537
|
value: z.ZodString;
|
|
538
538
|
}, "strip", z.ZodTypeAny, {
|
|
539
|
-
value: string;
|
|
540
539
|
type: "css";
|
|
541
|
-
}, {
|
|
542
540
|
value: string;
|
|
541
|
+
}, {
|
|
543
542
|
type: "css";
|
|
543
|
+
value: string;
|
|
544
544
|
}>, z.ZodObject<{
|
|
545
545
|
type: z.ZodLiteral<"aria">;
|
|
546
546
|
role: z.ZodOptional<z.ZodString>;
|
|
@@ -557,11 +557,11 @@ export declare const CanvasRecipeZ: z.ZodObject<{
|
|
|
557
557
|
type: z.ZodLiteral<"shadow-css">;
|
|
558
558
|
value: z.ZodString;
|
|
559
559
|
}, "strip", z.ZodTypeAny, {
|
|
560
|
-
value: string;
|
|
561
560
|
type: "shadow-css";
|
|
562
|
-
}, {
|
|
563
561
|
value: string;
|
|
562
|
+
}, {
|
|
564
563
|
type: "shadow-css";
|
|
564
|
+
value: string;
|
|
565
565
|
}>, z.ZodObject<{
|
|
566
566
|
type: z.ZodLiteral<"ref">;
|
|
567
567
|
el: z.ZodAny;
|
|
@@ -613,15 +613,15 @@ export declare const CanvasRecipeZ: z.ZodObject<{
|
|
|
613
613
|
key: string;
|
|
614
614
|
value?: string | undefined;
|
|
615
615
|
} | {
|
|
616
|
-
value: string;
|
|
617
616
|
type: "css";
|
|
617
|
+
value: string;
|
|
618
618
|
} | {
|
|
619
619
|
type: "aria";
|
|
620
620
|
label?: string | undefined;
|
|
621
621
|
role?: string | undefined;
|
|
622
622
|
} | {
|
|
623
|
-
value: string;
|
|
624
623
|
type: "shadow-css";
|
|
624
|
+
value: string;
|
|
625
625
|
} | {
|
|
626
626
|
type: "ref";
|
|
627
627
|
el?: any;
|
|
@@ -649,15 +649,15 @@ export declare const CanvasRecipeZ: z.ZodObject<{
|
|
|
649
649
|
key: string;
|
|
650
650
|
value?: string | undefined;
|
|
651
651
|
} | {
|
|
652
|
-
value: string;
|
|
653
652
|
type: "css";
|
|
653
|
+
value: string;
|
|
654
654
|
} | {
|
|
655
655
|
type: "aria";
|
|
656
656
|
label?: string | undefined;
|
|
657
657
|
role?: string | undefined;
|
|
658
658
|
} | {
|
|
659
|
-
value: string;
|
|
660
659
|
type: "shadow-css";
|
|
660
|
+
value: string;
|
|
661
661
|
} | {
|
|
662
662
|
type: "ref";
|
|
663
663
|
el?: any;
|
|
@@ -691,15 +691,15 @@ export declare const CanvasRecipeZ: z.ZodObject<{
|
|
|
691
691
|
key: string;
|
|
692
692
|
value?: string | undefined;
|
|
693
693
|
} | {
|
|
694
|
-
value: string;
|
|
695
694
|
type: "css";
|
|
695
|
+
value: string;
|
|
696
696
|
} | {
|
|
697
697
|
type: "aria";
|
|
698
698
|
label?: string | undefined;
|
|
699
699
|
role?: string | undefined;
|
|
700
700
|
} | {
|
|
701
|
-
value: string;
|
|
702
701
|
type: "shadow-css";
|
|
702
|
+
value: string;
|
|
703
703
|
} | {
|
|
704
704
|
type: "ref";
|
|
705
705
|
el?: any;
|
|
@@ -721,15 +721,15 @@ export declare const CanvasRecipeZ: z.ZodObject<{
|
|
|
721
721
|
key: string;
|
|
722
722
|
value?: string | undefined;
|
|
723
723
|
} | {
|
|
724
|
-
value: string;
|
|
725
724
|
type: "css";
|
|
725
|
+
value: string;
|
|
726
726
|
} | {
|
|
727
727
|
type: "aria";
|
|
728
728
|
label?: string | undefined;
|
|
729
729
|
role?: string | undefined;
|
|
730
730
|
} | {
|
|
731
|
-
value: string;
|
|
732
731
|
type: "shadow-css";
|
|
732
|
+
value: string;
|
|
733
733
|
} | {
|
|
734
734
|
type: "ref";
|
|
735
735
|
el?: any;
|
|
@@ -766,15 +766,15 @@ export declare const CanvasRecipeZ: z.ZodObject<{
|
|
|
766
766
|
key: string;
|
|
767
767
|
value?: string | undefined;
|
|
768
768
|
} | {
|
|
769
|
-
value: string;
|
|
770
769
|
type: "css";
|
|
770
|
+
value: string;
|
|
771
771
|
} | {
|
|
772
772
|
type: "aria";
|
|
773
773
|
label?: string | undefined;
|
|
774
774
|
role?: string | undefined;
|
|
775
775
|
} | {
|
|
776
|
-
value: string;
|
|
777
776
|
type: "shadow-css";
|
|
777
|
+
value: string;
|
|
778
778
|
} | {
|
|
779
779
|
type: "ref";
|
|
780
780
|
el?: any;
|
|
@@ -796,15 +796,15 @@ export declare const CanvasRecipeZ: z.ZodObject<{
|
|
|
796
796
|
key: string;
|
|
797
797
|
value?: string | undefined;
|
|
798
798
|
} | {
|
|
799
|
-
value: string;
|
|
800
799
|
type: "css";
|
|
800
|
+
value: string;
|
|
801
801
|
} | {
|
|
802
802
|
type: "aria";
|
|
803
803
|
label?: string | undefined;
|
|
804
804
|
role?: string | undefined;
|
|
805
805
|
} | {
|
|
806
|
-
value: string;
|
|
807
806
|
type: "shadow-css";
|
|
807
|
+
value: string;
|
|
808
808
|
} | {
|
|
809
809
|
type: "ref";
|
|
810
810
|
el?: any;
|
|
@@ -842,15 +842,15 @@ export declare function validateRecipe(json: unknown): {
|
|
|
842
842
|
key: string;
|
|
843
843
|
value?: string | undefined;
|
|
844
844
|
} | {
|
|
845
|
-
value: string;
|
|
846
845
|
type: "css";
|
|
846
|
+
value: string;
|
|
847
847
|
} | {
|
|
848
848
|
type: "aria";
|
|
849
849
|
label?: string | undefined;
|
|
850
850
|
role?: string | undefined;
|
|
851
851
|
} | {
|
|
852
|
-
value: string;
|
|
853
852
|
type: "shadow-css";
|
|
853
|
+
value: string;
|
|
854
854
|
} | {
|
|
855
855
|
type: "ref";
|
|
856
856
|
el?: any;
|
|
@@ -872,15 +872,15 @@ export declare function validateRecipe(json: unknown): {
|
|
|
872
872
|
key: string;
|
|
873
873
|
value?: string | undefined;
|
|
874
874
|
} | {
|
|
875
|
-
value: string;
|
|
876
875
|
type: "css";
|
|
876
|
+
value: string;
|
|
877
877
|
} | {
|
|
878
878
|
type: "aria";
|
|
879
879
|
label?: string | undefined;
|
|
880
880
|
role?: string | undefined;
|
|
881
881
|
} | {
|
|
882
|
-
value: string;
|
|
883
882
|
type: "shadow-css";
|
|
883
|
+
value: string;
|
|
884
884
|
} | {
|
|
885
885
|
type: "ref";
|
|
886
886
|
el?: any;
|
package/dist/react.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Syntro
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-IPU3WVPY.js";
|
|
4
|
+
import "./chunk-HF3D7YFQ.js";
|
|
5
|
+
import "./chunk-2UYZ5DWI.js";
|
|
6
|
+
import "./chunk-P5G4KT2U.js";
|
|
6
7
|
|
|
7
8
|
// src/react.tsx
|
|
8
9
|
import { createContext, useContext, useEffect, useRef, useState } from "react";
|
package/dist/react.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/react.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * React bindings for the Syntro SDK.\n *\n * Usage:\n * ```tsx\n * import { SyntroProvider, useSyntro } from '@syntrologie/runtime-sdk/react';\n *\n * function App() {\n * return (\n * <SyntroProvider token=\"syn_xxx\">\n * <MyApp />\n * </SyntroProvider>\n * );\n * }\n *\n * function MyComponent() {\n * const { canvas, experiments, telemetry, isReady } = useSyntro();\n * // ...\n * }\n * ```\n */\nimport { createContext, type ReactNode, useContext, useEffect, useRef, useState } from 'react';\n\nimport type { SmartCanvasHandle } from './api';\nimport { Syntro, type SyntroInitOptions, type SyntroInitResult } from './bootstrap';\nimport type { ExperimentClient } from './experiments/types';\nimport type { TelemetryClient } from './telemetry/types';\n\nexport interface SyntroContextValue {\n /** The SmartCanvas handle */\n canvas: SmartCanvasHandle | null;\n /** The experiment client */\n experiments: ExperimentClient | null;\n /** The telemetry client */\n telemetry: TelemetryClient | null;\n /** Whether the SDK has finished initializing */\n isReady: boolean;\n /** Any error that occurred during initialization */\n error: Error | null;\n}\n\nconst SyntroContext = createContext<SyntroContextValue | null>(null);\n\n// Global tracking to handle React Strict Mode double-mounting\nlet globalInitPromise: Promise<SyntroInitResult> | null = null;\nlet globalInitToken: string | null = null;\n\nexport interface SyntroProviderProps {\n /**\n * The Syntro token containing all credentials.\n */\n token: string;\n\n /**\n * Optional canvas configuration overrides.\n */\n canvasOptions?: SyntroInitOptions['canvas'];\n\n /**\n * Custom config fetcher to override the default experiment-based fetcher.\n * Use this for local development or when bypassing the experiment server.\n */\n fetcher?: SyntroInitOptions['fetcher'];\n\n /**\n * Children to render.\n */\n children: ReactNode;\n\n /**\n * Called when initialization completes.\n */\n onReady?: (result: SyntroInitResult) => void;\n\n /**\n * Called when initialization fails.\n */\n onError?: (error: Error) => void;\n}\n\n/**\n * Provider component that initializes the Syntro SDK.\n *\n * Place this at the root of your app or at the top of any subtree\n * that needs access to the SDK.\n */\nexport function SyntroProvider({\n token,\n canvasOptions,\n fetcher,\n children,\n onReady,\n onError,\n}: SyntroProviderProps) {\n const [state, setState] = useState<SyntroContextValue>({\n canvas: null,\n experiments: null,\n telemetry: null,\n isReady: false,\n error: null,\n });\n\n const initRef = useRef(false);\n const handleRef = useRef<SmartCanvasHandle | null>(null);\n\n useEffect(() => {\n if (!token) return;\n\n // Reuse existing init if same token (handles React Strict Mode remounts)\n if (globalInitPromise && globalInitToken === token) {\n globalInitPromise.then((result) => {\n handleRef.current = result.canvas;\n setState({\n canvas: result.canvas,\n experiments: result.experiments ?? null,\n telemetry: result.telemetry ?? null,\n isReady: true,\n error: null,\n });\n });\n return;\n }\n\n // Prevent double init\n if (initRef.current) return;\n initRef.current = true;\n\n globalInitToken = token;\n globalInitPromise = Syntro.init({ token, canvas: canvasOptions, fetcher });\n\n globalInitPromise\n .then((result) => {\n handleRef.current = result.canvas;\n setState({\n canvas: result.canvas,\n experiments: result.experiments ?? null,\n telemetry: result.telemetry ?? null,\n isReady: true,\n error: null,\n });\n onReady?.(result);\n })\n .catch((err) => {\n const error = err instanceof Error ? err : new Error(String(err));\n setState((prev) => ({ ...prev, error, isReady: true }));\n onError?.(error);\n // Clear global state on error so retry is possible\n globalInitPromise = null;\n globalInitToken = null;\n });\n\n // Don't destroy on unmount in dev mode - React Strict Mode will remount\n // The canvas persists and will be reused on remount\n }, [token, canvasOptions, fetcher, onError, onReady]);\n\n return <SyntroContext.Provider value={state}>{children}</SyntroContext.Provider>;\n}\n\n/**\n * Hook to access the Syntro SDK.\n *\n * Must be used within a SyntroProvider.\n *\n * @returns The SDK context containing canvas, experiments, telemetry, and status\n */\nexport function useSyntro(): SyntroContextValue {\n const context = useContext(SyntroContext);\n if (!context) {\n throw new Error('useSyntro must be used within a SyntroProvider');\n }\n return context;\n}\n\n/**\n * Hook to check if the SDK is ready.\n *\n * Shorthand for `useSyntro().isReady`.\n */\nexport function useSyntroReady(): boolean {\n return useSyntro().isReady;\n}\n\n/**\n * Hook to access the experiment client.\n *\n * @returns The experiment client, or null if not configured\n */\nexport function useSyntroExperiments(): ExperimentClient | null {\n return useSyntro().experiments;\n}\n\n/**\n * Hook to access the telemetry client.\n *\n * @returns The telemetry client, or null if not configured\n */\nexport function useSyntroTelemetry(): TelemetryClient | null {\n return useSyntro().telemetry;\n}\n\n/**\n * Hook to access the canvas handle.\n *\n * @returns The canvas handle, or null if not ready\n */\nexport function useSyntroCanvas(): SmartCanvasHandle | null {\n return useSyntro().canvas;\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;AAqBA,SAAS,eAA+B,YAAY,WAAW,QAAQ,gBAAgB;AAsI9E;AAlHT,IAAM,gBAAgB,cAAyC,IAAI;AAGnE,IAAI,oBAAsD;AAC1D,IAAI,kBAAiC;AAyC9B,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAwB;AACtB,QAAM,CAAC,OAAO,QAAQ,IAAI,SAA6B;AAAA,IACrD,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,WAAW;AAAA,IACX,SAAS;AAAA,IACT,OAAO;AAAA,EACT,CAAC;AAED,QAAM,UAAU,OAAO,KAAK;AAC5B,QAAM,YAAY,OAAiC,IAAI;AAEvD,YAAU,MAAM;AACd,QAAI,CAAC,MAAO;AAGZ,QAAI,qBAAqB,oBAAoB,OAAO;AAClD,wBAAkB,KAAK,CAAC,WAAW;AA9GzC;AA+GQ,kBAAU,UAAU,OAAO;AAC3B,iBAAS;AAAA,UACP,QAAQ,OAAO;AAAA,UACf,cAAa,YAAO,gBAAP,YAAsB;AAAA,UACnC,YAAW,YAAO,cAAP,YAAoB;AAAA,UAC/B,SAAS;AAAA,UACT,OAAO;AAAA,QACT,CAAC;AAAA,MACH,CAAC;AACD;AAAA,IACF;AAGA,QAAI,QAAQ,QAAS;AACrB,YAAQ,UAAU;AAElB,sBAAkB;AAClB,wBAAoB,OAAO,KAAK,EAAE,OAAO,QAAQ,eAAe,QAAQ,CAAC;AAEzE,sBACG,KAAK,CAAC,WAAW;AAnIxB;AAoIQ,gBAAU,UAAU,OAAO;AAC3B,eAAS;AAAA,QACP,QAAQ,OAAO;AAAA,QACf,cAAa,YAAO,gBAAP,YAAsB;AAAA,QACnC,YAAW,YAAO,cAAP,YAAoB;AAAA,QAC/B,SAAS;AAAA,QACT,OAAO;AAAA,MACT,CAAC;AACD,yCAAU;AAAA,IACZ,CAAC,EACA,MAAM,CAAC,QAAQ;AACd,YAAM,QAAQ,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,GAAG,CAAC;AAChE,eAAS,CAAC,UAAU,EAAE,GAAG,MAAM,OAAO,SAAS,KAAK,EAAE;AACtD,yCAAU;AAEV,0BAAoB;AACpB,wBAAkB;AAAA,IACpB,CAAC;AAAA,EAIL,GAAG,CAAC,OAAO,eAAe,SAAS,SAAS,OAAO,CAAC;AAEpD,SAAO,oBAAC,cAAc,UAAd,EAAuB,OAAO,OAAQ,UAAS;AACzD;AASO,SAAS,YAAgC;AAC9C,QAAM,UAAU,WAAW,aAAa;AACxC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,gDAAgD;AAAA,EAClE;AACA,SAAO;AACT;AAOO,SAAS,iBAA0B;AACxC,SAAO,UAAU,EAAE;AACrB;AAOO,SAAS,uBAAgD;AAC9D,SAAO,UAAU,EAAE;AACrB;AAOO,SAAS,qBAA6C;AAC3D,SAAO,UAAU,EAAE;AACrB;AAOO,SAAS,kBAA4C;AAC1D,SAAO,UAAU,EAAE;AACrB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/runtime.d.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* The runtime receives the config and makes decisions using DecisionStrategy.
|
|
15
15
|
*/
|
|
16
16
|
import { type ActionEngine, type ExecutorRegistry } from './actions';
|
|
17
|
+
import { type AnchorResolver } from './anchor';
|
|
17
18
|
import { type AppRegistry } from './apps';
|
|
18
19
|
import { type ContextManager } from './context/ContextManager';
|
|
19
20
|
import type { DecisionResult, DecisionStrategy, RouteFilter } from './decisions/types';
|
|
@@ -60,6 +61,8 @@ export interface SmartCanvasRuntime {
|
|
|
60
61
|
apps: AppRegistry;
|
|
61
62
|
/** Event accumulator for event_count conditions */
|
|
62
63
|
accumulator: EventAccumulator;
|
|
64
|
+
/** Centralized anchor resolver for DOM observation */
|
|
65
|
+
anchorResolver: AnchorResolver;
|
|
63
66
|
/** Centralized navigation monitor for History API interception */
|
|
64
67
|
navigation: NavigationMonitor;
|
|
65
68
|
/** Runtime version */
|