@syntrologie/runtime-sdk 2.18.0 → 2.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/schema.d.ts +64 -0
- package/dist/actions/schema.js +1 -1
- package/dist/{chunk-R7R2ZKZU.js → chunk-FMLX4END.js} +26 -4
- package/dist/chunk-FMLX4END.js.map +7 -0
- package/dist/index.js +150 -14
- package/dist/index.js.map +4 -4
- package/dist/observability/healthReporter.d.ts +11 -0
- package/dist/observability/index.d.ts +2 -0
- package/dist/observability/sdkScriptUrl.d.ts +16 -0
- package/dist/observability/types.d.ts +17 -2
- package/dist/observability/webVitalsAdapter.d.ts +22 -0
- package/dist/smart-canvas.esm.js +182 -182
- package/dist/smart-canvas.esm.js.map +4 -4
- package/dist/smart-canvas.js +5230 -4839
- package/dist/smart-canvas.js.map +4 -4
- package/dist/smart-canvas.min.js +182 -182
- package/dist/smart-canvas.min.js.map +4 -4
- package/dist/version.d.ts +1 -1
- package/package.json +2 -1
- package/schema/canvas-config.schema.json +69 -31
- package/dist/chunk-R7R2ZKZU.js.map +0 -7
package/dist/actions/schema.d.ts
CHANGED
|
@@ -53,14 +53,20 @@ declare const CtaButtonZ: z.ZodObject<{
|
|
|
53
53
|
label: z.ZodString;
|
|
54
54
|
actionId: z.ZodString;
|
|
55
55
|
primary: z.ZodOptional<z.ZodBoolean>;
|
|
56
|
+
href: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
57
|
+
target: z.ZodOptional<z.ZodEnum<["_self", "_blank"]>>;
|
|
56
58
|
}, "strict", z.ZodTypeAny, {
|
|
57
59
|
label: string;
|
|
58
60
|
actionId: string;
|
|
61
|
+
target?: "_self" | "_blank" | undefined;
|
|
59
62
|
primary?: boolean | undefined;
|
|
63
|
+
href?: string | undefined;
|
|
60
64
|
}, {
|
|
61
65
|
label: string;
|
|
62
66
|
actionId: string;
|
|
67
|
+
target?: "_self" | "_blank" | undefined;
|
|
63
68
|
primary?: boolean | undefined;
|
|
69
|
+
href?: string | undefined;
|
|
64
70
|
}>;
|
|
65
71
|
/**
|
|
66
72
|
* Tooltip content (schema-safe version).
|
|
@@ -73,21 +79,29 @@ declare const TooltipContentZ: z.ZodObject<{
|
|
|
73
79
|
label: z.ZodString;
|
|
74
80
|
actionId: z.ZodString;
|
|
75
81
|
primary: z.ZodOptional<z.ZodBoolean>;
|
|
82
|
+
href: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
83
|
+
target: z.ZodOptional<z.ZodEnum<["_self", "_blank"]>>;
|
|
76
84
|
}, "strict", z.ZodTypeAny, {
|
|
77
85
|
label: string;
|
|
78
86
|
actionId: string;
|
|
87
|
+
target?: "_self" | "_blank" | undefined;
|
|
79
88
|
primary?: boolean | undefined;
|
|
89
|
+
href?: string | undefined;
|
|
80
90
|
}, {
|
|
81
91
|
label: string;
|
|
82
92
|
actionId: string;
|
|
93
|
+
target?: "_self" | "_blank" | undefined;
|
|
83
94
|
primary?: boolean | undefined;
|
|
95
|
+
href?: string | undefined;
|
|
84
96
|
}>, "many">>;
|
|
85
97
|
}, "strict", z.ZodTypeAny, {
|
|
86
98
|
body: string;
|
|
87
99
|
ctaButtons?: {
|
|
88
100
|
label: string;
|
|
89
101
|
actionId: string;
|
|
102
|
+
target?: "_self" | "_blank" | undefined;
|
|
90
103
|
primary?: boolean | undefined;
|
|
104
|
+
href?: string | undefined;
|
|
91
105
|
}[] | undefined;
|
|
92
106
|
title?: string | undefined;
|
|
93
107
|
}, {
|
|
@@ -95,7 +109,9 @@ declare const TooltipContentZ: z.ZodObject<{
|
|
|
95
109
|
ctaButtons?: {
|
|
96
110
|
label: string;
|
|
97
111
|
actionId: string;
|
|
112
|
+
target?: "_self" | "_blank" | undefined;
|
|
98
113
|
primary?: boolean | undefined;
|
|
114
|
+
href?: string | undefined;
|
|
99
115
|
}[] | undefined;
|
|
100
116
|
title?: string | undefined;
|
|
101
117
|
}>;
|
|
@@ -6425,21 +6441,29 @@ declare const TooltipZ: z.ZodObject<{
|
|
|
6425
6441
|
label: z.ZodString;
|
|
6426
6442
|
actionId: z.ZodString;
|
|
6427
6443
|
primary: z.ZodOptional<z.ZodBoolean>;
|
|
6444
|
+
href: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
6445
|
+
target: z.ZodOptional<z.ZodEnum<["_self", "_blank"]>>;
|
|
6428
6446
|
}, "strict", z.ZodTypeAny, {
|
|
6429
6447
|
label: string;
|
|
6430
6448
|
actionId: string;
|
|
6449
|
+
target?: "_self" | "_blank" | undefined;
|
|
6431
6450
|
primary?: boolean | undefined;
|
|
6451
|
+
href?: string | undefined;
|
|
6432
6452
|
}, {
|
|
6433
6453
|
label: string;
|
|
6434
6454
|
actionId: string;
|
|
6455
|
+
target?: "_self" | "_blank" | undefined;
|
|
6435
6456
|
primary?: boolean | undefined;
|
|
6457
|
+
href?: string | undefined;
|
|
6436
6458
|
}>, "many">>;
|
|
6437
6459
|
}, "strict", z.ZodTypeAny, {
|
|
6438
6460
|
body: string;
|
|
6439
6461
|
ctaButtons?: {
|
|
6440
6462
|
label: string;
|
|
6441
6463
|
actionId: string;
|
|
6464
|
+
target?: "_self" | "_blank" | undefined;
|
|
6442
6465
|
primary?: boolean | undefined;
|
|
6466
|
+
href?: string | undefined;
|
|
6443
6467
|
}[] | undefined;
|
|
6444
6468
|
title?: string | undefined;
|
|
6445
6469
|
}, {
|
|
@@ -6447,7 +6471,9 @@ declare const TooltipZ: z.ZodObject<{
|
|
|
6447
6471
|
ctaButtons?: {
|
|
6448
6472
|
label: string;
|
|
6449
6473
|
actionId: string;
|
|
6474
|
+
target?: "_self" | "_blank" | undefined;
|
|
6450
6475
|
primary?: boolean | undefined;
|
|
6476
|
+
href?: string | undefined;
|
|
6451
6477
|
}[] | undefined;
|
|
6452
6478
|
title?: string | undefined;
|
|
6453
6479
|
}>;
|
|
@@ -6956,7 +6982,9 @@ declare const TooltipZ: z.ZodObject<{
|
|
|
6956
6982
|
ctaButtons?: {
|
|
6957
6983
|
label: string;
|
|
6958
6984
|
actionId: string;
|
|
6985
|
+
target?: "_self" | "_blank" | undefined;
|
|
6959
6986
|
primary?: boolean | undefined;
|
|
6987
|
+
href?: string | undefined;
|
|
6960
6988
|
}[] | undefined;
|
|
6961
6989
|
title?: string | undefined;
|
|
6962
6990
|
};
|
|
@@ -7059,7 +7087,9 @@ declare const TooltipZ: z.ZodObject<{
|
|
|
7059
7087
|
ctaButtons?: {
|
|
7060
7088
|
label: string;
|
|
7061
7089
|
actionId: string;
|
|
7090
|
+
target?: "_self" | "_blank" | undefined;
|
|
7062
7091
|
primary?: boolean | undefined;
|
|
7092
|
+
href?: string | undefined;
|
|
7063
7093
|
}[] | undefined;
|
|
7064
7094
|
title?: string | undefined;
|
|
7065
7095
|
};
|
|
@@ -7190,14 +7220,20 @@ declare const ModalZ: z.ZodObject<{
|
|
|
7190
7220
|
label: z.ZodString;
|
|
7191
7221
|
actionId: z.ZodString;
|
|
7192
7222
|
primary: z.ZodOptional<z.ZodBoolean>;
|
|
7223
|
+
href: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
7224
|
+
target: z.ZodOptional<z.ZodEnum<["_self", "_blank"]>>;
|
|
7193
7225
|
}, "strict", z.ZodTypeAny, {
|
|
7194
7226
|
label: string;
|
|
7195
7227
|
actionId: string;
|
|
7228
|
+
target?: "_self" | "_blank" | undefined;
|
|
7196
7229
|
primary?: boolean | undefined;
|
|
7230
|
+
href?: string | undefined;
|
|
7197
7231
|
}, {
|
|
7198
7232
|
label: string;
|
|
7199
7233
|
actionId: string;
|
|
7234
|
+
target?: "_self" | "_blank" | undefined;
|
|
7200
7235
|
primary?: boolean | undefined;
|
|
7236
|
+
href?: string | undefined;
|
|
7201
7237
|
}>, "many">>;
|
|
7202
7238
|
waitFor: z.ZodOptional<z.ZodString>;
|
|
7203
7239
|
label: z.ZodOptional<z.ZodString>;
|
|
@@ -7711,7 +7747,9 @@ declare const ModalZ: z.ZodObject<{
|
|
|
7711
7747
|
ctaButtons?: {
|
|
7712
7748
|
label: string;
|
|
7713
7749
|
actionId: string;
|
|
7750
|
+
target?: "_self" | "_blank" | undefined;
|
|
7714
7751
|
primary?: boolean | undefined;
|
|
7752
|
+
href?: string | undefined;
|
|
7715
7753
|
}[] | undefined;
|
|
7716
7754
|
label?: string | undefined;
|
|
7717
7755
|
triggerWhen?: {
|
|
@@ -7818,7 +7856,9 @@ declare const ModalZ: z.ZodObject<{
|
|
|
7818
7856
|
ctaButtons?: {
|
|
7819
7857
|
label: string;
|
|
7820
7858
|
actionId: string;
|
|
7859
|
+
target?: "_self" | "_blank" | undefined;
|
|
7821
7860
|
primary?: boolean | undefined;
|
|
7861
|
+
href?: string | undefined;
|
|
7822
7862
|
}[] | undefined;
|
|
7823
7863
|
label?: string | undefined;
|
|
7824
7864
|
triggerWhen?: {
|
|
@@ -19839,21 +19879,29 @@ export declare const coreActionStepSchemas: ({
|
|
|
19839
19879
|
label: z.ZodString;
|
|
19840
19880
|
actionId: z.ZodString;
|
|
19841
19881
|
primary: z.ZodOptional<z.ZodBoolean>;
|
|
19882
|
+
href: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
19883
|
+
target: z.ZodOptional<z.ZodEnum<["_self", "_blank"]>>;
|
|
19842
19884
|
}, "strict", z.ZodTypeAny, {
|
|
19843
19885
|
label: string;
|
|
19844
19886
|
actionId: string;
|
|
19887
|
+
target?: "_self" | "_blank" | undefined;
|
|
19845
19888
|
primary?: boolean | undefined;
|
|
19889
|
+
href?: string | undefined;
|
|
19846
19890
|
}, {
|
|
19847
19891
|
label: string;
|
|
19848
19892
|
actionId: string;
|
|
19893
|
+
target?: "_self" | "_blank" | undefined;
|
|
19849
19894
|
primary?: boolean | undefined;
|
|
19895
|
+
href?: string | undefined;
|
|
19850
19896
|
}>, "many">>;
|
|
19851
19897
|
}, "strict", z.ZodTypeAny, {
|
|
19852
19898
|
body: string;
|
|
19853
19899
|
ctaButtons?: {
|
|
19854
19900
|
label: string;
|
|
19855
19901
|
actionId: string;
|
|
19902
|
+
target?: "_self" | "_blank" | undefined;
|
|
19856
19903
|
primary?: boolean | undefined;
|
|
19904
|
+
href?: string | undefined;
|
|
19857
19905
|
}[] | undefined;
|
|
19858
19906
|
title?: string | undefined;
|
|
19859
19907
|
}, {
|
|
@@ -19861,7 +19909,9 @@ export declare const coreActionStepSchemas: ({
|
|
|
19861
19909
|
ctaButtons?: {
|
|
19862
19910
|
label: string;
|
|
19863
19911
|
actionId: string;
|
|
19912
|
+
target?: "_self" | "_blank" | undefined;
|
|
19864
19913
|
primary?: boolean | undefined;
|
|
19914
|
+
href?: string | undefined;
|
|
19865
19915
|
}[] | undefined;
|
|
19866
19916
|
title?: string | undefined;
|
|
19867
19917
|
}>;
|
|
@@ -20370,7 +20420,9 @@ export declare const coreActionStepSchemas: ({
|
|
|
20370
20420
|
ctaButtons?: {
|
|
20371
20421
|
label: string;
|
|
20372
20422
|
actionId: string;
|
|
20423
|
+
target?: "_self" | "_blank" | undefined;
|
|
20373
20424
|
primary?: boolean | undefined;
|
|
20425
|
+
href?: string | undefined;
|
|
20374
20426
|
}[] | undefined;
|
|
20375
20427
|
title?: string | undefined;
|
|
20376
20428
|
};
|
|
@@ -20473,7 +20525,9 @@ export declare const coreActionStepSchemas: ({
|
|
|
20473
20525
|
ctaButtons?: {
|
|
20474
20526
|
label: string;
|
|
20475
20527
|
actionId: string;
|
|
20528
|
+
target?: "_self" | "_blank" | undefined;
|
|
20476
20529
|
primary?: boolean | undefined;
|
|
20530
|
+
href?: string | undefined;
|
|
20477
20531
|
}[] | undefined;
|
|
20478
20532
|
title?: string | undefined;
|
|
20479
20533
|
};
|
|
@@ -20606,14 +20660,20 @@ export declare const coreActionStepSchemas: ({
|
|
|
20606
20660
|
label: z.ZodString;
|
|
20607
20661
|
actionId: z.ZodString;
|
|
20608
20662
|
primary: z.ZodOptional<z.ZodBoolean>;
|
|
20663
|
+
href: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
20664
|
+
target: z.ZodOptional<z.ZodEnum<["_self", "_blank"]>>;
|
|
20609
20665
|
}, "strict", z.ZodTypeAny, {
|
|
20610
20666
|
label: string;
|
|
20611
20667
|
actionId: string;
|
|
20668
|
+
target?: "_self" | "_blank" | undefined;
|
|
20612
20669
|
primary?: boolean | undefined;
|
|
20670
|
+
href?: string | undefined;
|
|
20613
20671
|
}, {
|
|
20614
20672
|
label: string;
|
|
20615
20673
|
actionId: string;
|
|
20674
|
+
target?: "_self" | "_blank" | undefined;
|
|
20616
20675
|
primary?: boolean | undefined;
|
|
20676
|
+
href?: string | undefined;
|
|
20617
20677
|
}>, "many">>;
|
|
20618
20678
|
waitFor: z.ZodOptional<z.ZodString>;
|
|
20619
20679
|
label: z.ZodOptional<z.ZodString>;
|
|
@@ -21127,7 +21187,9 @@ export declare const coreActionStepSchemas: ({
|
|
|
21127
21187
|
ctaButtons?: {
|
|
21128
21188
|
label: string;
|
|
21129
21189
|
actionId: string;
|
|
21190
|
+
target?: "_self" | "_blank" | undefined;
|
|
21130
21191
|
primary?: boolean | undefined;
|
|
21192
|
+
href?: string | undefined;
|
|
21131
21193
|
}[] | undefined;
|
|
21132
21194
|
label?: string | undefined;
|
|
21133
21195
|
triggerWhen?: {
|
|
@@ -21234,7 +21296,9 @@ export declare const coreActionStepSchemas: ({
|
|
|
21234
21296
|
ctaButtons?: {
|
|
21235
21297
|
label: string;
|
|
21236
21298
|
actionId: string;
|
|
21299
|
+
target?: "_self" | "_blank" | undefined;
|
|
21237
21300
|
primary?: boolean | undefined;
|
|
21301
|
+
href?: string | undefined;
|
|
21238
21302
|
}[] | undefined;
|
|
21239
21303
|
label?: string | undefined;
|
|
21240
21304
|
triggerWhen?: {
|
package/dist/actions/schema.js
CHANGED
|
@@ -36,10 +36,32 @@ var PlacementZ = z.enum([
|
|
|
36
36
|
"right-start",
|
|
37
37
|
"right-end"
|
|
38
38
|
]);
|
|
39
|
+
var SAFE_HREF_PATTERN = /^(?:[/.#?]|[hH][tT][tT][pP][sS]?:\/\/|[mM][aA][iI][lL][tT][oO]:|[tT][eE][lL]:)/;
|
|
40
|
+
var HrefZ = z.string().min(1).regex(SAFE_HREF_PATTERN, {
|
|
41
|
+
message: "href must start with /, ./, ../, #, ?, http(s)://, mailto:, or tel: \u2014 javascript:, data:, and vbscript: are not allowed"
|
|
42
|
+
}).refine(
|
|
43
|
+
(s) => {
|
|
44
|
+
try {
|
|
45
|
+
const parsed = new URL(s, "https://syntro.local/");
|
|
46
|
+
return ["http:", "https:", "mailto:", "tel:"].includes(parsed.protocol);
|
|
47
|
+
} catch {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
{ message: "href resolves to an unsupported protocol" }
|
|
52
|
+
);
|
|
39
53
|
var CtaButtonZ = z.object({
|
|
40
|
-
label: z.string(),
|
|
41
|
-
actionId: z.string()
|
|
42
|
-
|
|
54
|
+
label: z.string().describe("Visible button label."),
|
|
55
|
+
actionId: z.string().describe(
|
|
56
|
+
'Identifier emitted on action.modal_cta_clicked / action.tooltip_cta_clicked. Use "dismiss" to close the overlay without publishing an event or navigating, even if href is set.'
|
|
57
|
+
),
|
|
58
|
+
primary: z.boolean().optional().describe("When true, renders as the primary (filled) button. Defaults to false."),
|
|
59
|
+
href: HrefZ.optional().describe(
|
|
60
|
+
'URL to navigate to when the button is clicked. Use this to drive users to a destination (product page, signup, etc.) \u2014 set href on a non-dismiss button rather than relying on actionId conventions or content:setAttr tricks. Accepts relative paths ("/product/x"), fragments ("#section"), query strings, and absolute http(s) URLs. javascript:/data:/vbscript: are rejected.'
|
|
61
|
+
),
|
|
62
|
+
target: z.enum(["_self", "_blank"]).optional().describe(
|
|
63
|
+
'Navigation target. "_self" (default) replaces the current tab; "_blank" opens a new tab with noopener,noreferrer.'
|
|
64
|
+
)
|
|
43
65
|
}).strict();
|
|
44
66
|
var TooltipContentZ = z.object({
|
|
45
67
|
title: z.string().optional(),
|
|
@@ -250,4 +272,4 @@ export {
|
|
|
250
272
|
TourZ,
|
|
251
273
|
coreActionStepSchemas
|
|
252
274
|
};
|
|
253
|
-
//# sourceMappingURL=chunk-
|
|
275
|
+
//# sourceMappingURL=chunk-FMLX4END.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/actions/schema.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Core Action Zod Schemas\n *\n * Single source of truth for the shape of all 18 core action types.\n * These schemas are converted to JSON Schema during build and merged\n * into the unified canvas-config.schema.json.\n *\n * Design decisions:\n * - `.strict()` on most objects \u2192 `additionalProperties: false` in JSON Schema\n * - Tour/TourStep use `.passthrough()` to allow adaptive-specific extensions (e.g. `workflow`)\n * - Matches `types.ts` exactly (fixes all drift from the old manual JSON defs)\n * - Recursive ActionStep references use `z.any()` as placeholder; the generator\n * replaces `{}` with `{ \"$ref\": \"#/$defs/actionStep\" }` post-conversion\n */\n\nimport { AuthoringFieldsZ } from '@syntrologie/sdk-contracts';\nimport { z } from 'zod';\nimport { NotificationDeepLinkZ } from '../config/schema';\nimport { TriggerWhenZ } from '../decisions/schema';\n\n// ============================================================================\n// Shared Sub-Types\n// ============================================================================\n\n/**\n * Conditional execution for actions.\n *\n * Actions use `triggerWhen` (DecisionStrategy) exclusively.\n * NOTE: `activation` (with routes/strategy) is for TILES only \u2014 it is evaluated\n * by `runtime.filterTiles()` in useShadowCanvasConfig but is NEVER checked by\n * ActionEngine. Do not add `activation` here; use `triggerWhen` with a\n * `page_url` condition instead.\n */\nconst ActionTriggerZ = {\n triggerWhen: TriggerWhenZ,\n};\n\n/** Route-scoped anchor identifier */\nconst AnchorIdZ = z\n .object({\n selector: z.string(),\n route: z.union([z.string(), z.array(z.string())]),\n })\n .strict();\n\n/** Highlight style configuration */\nconst HighlightStyleZ = z\n .object({\n color: z.string().optional(),\n scrimOpacity: z.number().min(0).max(1).optional(),\n paddingPx: z.number().optional(),\n radiusPx: z.number().optional(),\n })\n .strict();\n\n/** Badge position relative to anchor */\nconst BadgePositionZ = z.enum(['top-left', 'top-right', 'bottom-left', 'bottom-right']);\n\n/**\n * Floating-ui Placement \u2014 all 12 values.\n * Matches `@floating-ui/dom` `Placement` type.\n */\nconst PlacementZ = z.enum([\n 'top',\n 'top-start',\n 'top-end',\n 'bottom',\n 'bottom-start',\n 'bottom-end',\n 'left',\n 'left-start',\n 'left-end',\n 'right',\n 'right-start',\n 'right-end',\n]);\n\n/**\n * Validates a CTA button href. Allows relative paths (\"/x\", \"./x\", \"../x\"),\n * fragments (\"#x\"), query strings (\"?x\"), absolute http(s) URLs, and\n * mailto:/tel: links. Rejects everything else \u2014 including javascript:, data:,\n * vbscript:, and bypass attempts that embed control characters in the scheme\n * (e.g. \"java\\\\tscript:alert(1)\" \u2014 browsers strip the tab before resolving).\n *\n * Two layers of validation:\n *\n * 1. `.regex()` \u2014 a positive-allowlist pattern. This serializes to JSON\n * Schema's `pattern` keyword and is enforced at the server-side jsonschema\n * validation layer (where the Zod `.refine()` doesn't reach). Uses\n * character classes for case-insensitivity since JSON Schema regex is\n * ECMA 262 without inline flags.\n *\n * 2. `.refine()` \u2014 runs the input through `new URL()` to canonicalize the\n * scheme using the same algorithm browsers use, then checks the resolved\n * protocol against an allowlist. Catches anything the regex misses.\n */\nconst SAFE_HREF_PATTERN =\n /^(?:[/.#?]|[hH][tT][tT][pP][sS]?:\\/\\/|[mM][aA][iI][lL][tT][oO]:|[tT][eE][lL]:)/;\n\nconst HrefZ = z\n .string()\n .min(1)\n .regex(SAFE_HREF_PATTERN, {\n message:\n 'href must start with /, ./, ../, #, ?, http(s)://, mailto:, or tel: \u2014 javascript:, data:, and vbscript: are not allowed',\n })\n .refine(\n (s) => {\n try {\n const parsed = new URL(s, 'https://syntro.local/');\n return ['http:', 'https:', 'mailto:', 'tel:'].includes(parsed.protocol);\n } catch {\n return false;\n }\n },\n { message: 'href resolves to an unsupported protocol' }\n );\n\n/** CTA button configuration for tooltips/modals */\nconst CtaButtonZ = z\n .object({\n label: z.string().describe('Visible button label.'),\n actionId: z\n .string()\n .describe(\n 'Identifier emitted on action.modal_cta_clicked / action.tooltip_cta_clicked. Use \"dismiss\" to close the overlay without publishing an event or navigating, even if href is set.'\n ),\n primary: z\n .boolean()\n .optional()\n .describe('When true, renders as the primary (filled) button. Defaults to false.'),\n href: HrefZ.optional().describe(\n 'URL to navigate to when the button is clicked. Use this to drive users to a destination (product page, signup, etc.) \u2014 set href on a non-dismiss button rather than relying on actionId conventions or content:setAttr tricks. Accepts relative paths (\"/product/x\"), fragments (\"#section\"), query strings, and absolute http(s) URLs. javascript:/data:/vbscript: are rejected.'\n ),\n target: z\n .enum(['_self', '_blank'])\n .optional()\n .describe(\n 'Navigation target. \"_self\" (default) replaces the current tab; \"_blank\" opens a new tab with noopener,noreferrer.'\n ),\n })\n .strict();\n\n/**\n * Tooltip content (schema-safe version).\n * Omits `cta` (legacy field with recursive ActionStep; never in JSON schema).\n */\nconst TooltipContentZ = z\n .object({\n title: z.string().optional(),\n body: z.string(),\n ctaButtons: z.array(CtaButtonZ).optional(),\n })\n .strict();\n\n/** Modal content configuration */\nconst ModalContentZ = z\n .object({\n title: z.string().optional(),\n body: z.string(),\n })\n .strict();\n\n/** Position where HTML/content should be inserted */\nconst InsertPositionZ = z.enum(['before', 'after', 'prepend', 'append', 'replace']);\n\n/** Tooltip trigger mode */\nconst TooltipTriggerZ = z.enum(['immediate', 'hover', 'click']);\n\n/** Widget configuration for surface mounting */\nconst WidgetConfigZ = z\n .object({\n widgetId: z.string(),\n props: z.record(z.unknown()).optional(),\n priority: z.number().optional(),\n })\n .strict();\n\n/**\n * Tour step (schema-safe version).\n * Uses `z.any()` for the `action` field \u2014 the generator replaces it with a $ref.\n */\nconst TourStepForSchemaZ = z\n .object({\n id: z.string(),\n action: z.any(),\n route: z.string().optional(),\n onAction: z.record(z.string()).optional(),\n })\n .passthrough();\n\n// ============================================================================\n// ScrollBehavior / ScrollLogicalPosition (DOM built-in types as Zod enums)\n// ============================================================================\n\nconst ScrollBehaviorZ = z.enum(['auto', 'smooth', 'instant']);\nconst ScrollLogicalPositionZ = z.enum(['start', 'center', 'end', 'nearest']);\n\n// ============================================================================\n// Core Action Schemas (18 total)\n// ============================================================================\n\n// --- Content Actions ---\n\nconst SetTextZ = z\n .object({\n kind: z.literal('content:setText'),\n anchorId: AnchorIdZ,\n text: z.string(),\n label: z.string().optional(),\n })\n .extend(ActionTriggerZ)\n .extend(AuthoringFieldsZ)\n .strict();\n\nconst SetAttrZ = z\n .object({\n kind: z.literal('content:setAttr'),\n anchorId: AnchorIdZ,\n attr: z.string(),\n value: z.string(),\n label: z.string().optional(),\n })\n .extend(ActionTriggerZ)\n .extend(AuthoringFieldsZ)\n .strict();\n\nconst AddClassZ = z\n .object({\n kind: z.literal('content:addClass'),\n anchorId: AnchorIdZ,\n className: z.string(),\n label: z.string().optional(),\n })\n .extend(ActionTriggerZ)\n .extend(AuthoringFieldsZ)\n .strict();\n\nconst RemoveClassZ = z\n .object({\n kind: z.literal('content:removeClass'),\n anchorId: AnchorIdZ,\n className: z.string(),\n label: z.string().optional(),\n })\n .extend(ActionTriggerZ)\n .extend(AuthoringFieldsZ)\n .strict();\n\nconst SetStyleZ = z\n .object({\n kind: z.literal('content:setStyle'),\n anchorId: AnchorIdZ,\n styles: z.record(z.string()),\n label: z.string().optional(),\n })\n .extend(ActionTriggerZ)\n .extend(AuthoringFieldsZ)\n .strict();\n\nconst InsertHtmlZ = z\n .object({\n kind: z.literal('content:insertHtml'),\n anchorId: AnchorIdZ,\n html: z.string(),\n position: InsertPositionZ,\n deepLink: NotificationDeepLinkZ.optional(),\n label: z.string().optional(),\n })\n .extend(ActionTriggerZ)\n .extend(AuthoringFieldsZ)\n .strict();\n\n// --- Overlay Actions ---\n\nconst HighlightZ = z\n .object({\n kind: z.literal('overlays:highlight'),\n anchorId: AnchorIdZ,\n style: HighlightStyleZ.optional(),\n duration: z.number().optional(),\n label: z.string().optional(),\n })\n .extend(ActionTriggerZ)\n .extend(AuthoringFieldsZ)\n .strict();\n\nconst PulseZ = z\n .object({\n kind: z.literal('overlays:pulse'),\n anchorId: AnchorIdZ,\n duration: z.number().optional(),\n label: z.string().optional(),\n })\n .extend(ActionTriggerZ)\n .extend(AuthoringFieldsZ)\n .strict();\n\nconst BadgeZ = z\n .object({\n kind: z.literal('overlays:badge'),\n anchorId: AnchorIdZ,\n content: z.string(),\n position: BadgePositionZ.optional(),\n label: z.string().optional(),\n })\n .extend(ActionTriggerZ)\n .extend(AuthoringFieldsZ)\n .strict();\n\nconst TooltipZ = z\n .object({\n kind: z.literal('overlays:tooltip'),\n anchorId: AnchorIdZ,\n content: TooltipContentZ,\n trigger: TooltipTriggerZ.optional(),\n placement: PlacementZ.optional(),\n waitFor: z.string().optional(),\n label: z.string().optional(),\n })\n .extend(ActionTriggerZ)\n .extend(AuthoringFieldsZ)\n .strict();\n\nconst ModalZ = z\n .object({\n kind: z.literal('overlays:modal'),\n content: ModalContentZ,\n size: z.enum(['sm', 'md', 'lg']).optional(),\n blocking: z.boolean().optional(),\n scrim: z\n .object({\n opacity: z.number().min(0).max(1).optional(),\n })\n .strict()\n .optional(),\n dismiss: z\n .object({\n onEsc: z.boolean().optional(),\n closeButton: z.boolean().optional(),\n timeoutMs: z.number().min(0).optional(),\n })\n .strict()\n .optional(),\n ctaButtons: z.array(CtaButtonZ).optional(),\n waitFor: z.string().optional(),\n label: z.string().optional(),\n })\n .extend(ActionTriggerZ)\n .extend(AuthoringFieldsZ)\n .strict();\n\n// --- Navigation Actions ---\n\nconst ScrollToZ = z\n .object({\n kind: z.literal('navigation:scrollTo'),\n anchorId: AnchorIdZ,\n behavior: ScrollBehaviorZ.optional(),\n block: ScrollLogicalPositionZ.optional(),\n inline: ScrollLogicalPositionZ.optional(),\n label: z.string().optional(),\n })\n .extend(ActionTriggerZ)\n .extend(AuthoringFieldsZ)\n .strict();\n\nconst NavigateZ = z\n .object({\n kind: z.literal('navigation:navigate'),\n url: z.string(),\n target: z.enum(['_self', '_blank']).optional(),\n label: z.string().optional(),\n })\n .extend(ActionTriggerZ)\n .extend(AuthoringFieldsZ)\n .strict();\n\n// --- Core Primitives ---\n\nconst MountWidgetZ = z\n .object({\n kind: z.literal('core:mountWidget'),\n slot: z.string(),\n widget: WidgetConfigZ,\n label: z.string().optional(),\n })\n .extend(ActionTriggerZ)\n .extend(AuthoringFieldsZ)\n .strict();\n\nconst WaitZ = z\n .object({\n kind: z.literal('core:wait'),\n durationMs: z.number().min(0).optional(),\n event: z.string().optional(),\n label: z.string().optional(),\n })\n .extend(ActionTriggerZ)\n .extend(AuthoringFieldsZ)\n .strict();\n\n/**\n * Sequence \u2014 executes actions serially.\n * `actions` uses `z.any()` as placeholder for recursive ActionStep refs.\n */\nconst SequenceZ = z\n .object({\n kind: z.literal('core:sequence'),\n actions: z.array(z.any()),\n label: z.string().optional(),\n })\n .extend(ActionTriggerZ)\n .extend(AuthoringFieldsZ)\n .strict();\n\n/**\n * Parallel \u2014 executes actions concurrently.\n * `actions` uses `z.any()` as placeholder for recursive ActionStep refs.\n */\nconst ParallelZ = z\n .object({\n kind: z.literal('core:parallel'),\n actions: z.array(z.any()),\n waitFor: z.enum(['all', 'any']).optional(),\n label: z.string().optional(),\n })\n .extend(ActionTriggerZ)\n .extend(AuthoringFieldsZ)\n .strict();\n\n/**\n * Tour \u2014 orchestrate sequential steps with cross-page state.\n * `steps` contains TourStepForSchemaZ which uses z.any() for step.action.\n */\nconst TourZ = z\n .object({\n kind: z.literal('overlays:tour'),\n tourId: z.string(),\n steps: z.array(TourStepForSchemaZ).min(1),\n startStep: z.string().optional(),\n autoStart: z.boolean().optional(),\n label: z.string().optional(),\n })\n .extend(ActionTriggerZ)\n .extend(AuthoringFieldsZ)\n .passthrough();\n\n// ============================================================================\n// Export: Array for unified schema generation\n// ============================================================================\n\n/**\n * All 18 core action step schemas for unified JSON Schema generation.\n * The generator imports this array and converts each to JSON Schema,\n * then merges them into `$defs` and `actionStep.oneOf`.\n *\n * `defName` values match the existing `$defs` keys for backward compat.\n */\nexport const coreActionStepSchemas = [\n { defName: 'setText', schema: SetTextZ },\n { defName: 'setAttr', schema: SetAttrZ },\n { defName: 'addClass', schema: AddClassZ },\n { defName: 'removeClass', schema: RemoveClassZ },\n { defName: 'setStyle', schema: SetStyleZ },\n { defName: 'insertHtml', schema: InsertHtmlZ },\n { defName: 'highlight', schema: HighlightZ },\n { defName: 'pulse', schema: PulseZ },\n { defName: 'badge', schema: BadgeZ },\n { defName: 'tooltip', schema: TooltipZ },\n { defName: 'modal', schema: ModalZ },\n { defName: 'scrollTo', schema: ScrollToZ },\n { defName: 'navigate', schema: NavigateZ },\n { defName: 'mountWidget', schema: MountWidgetZ },\n { defName: 'wait', schema: WaitZ },\n { defName: 'sequence', schema: SequenceZ },\n { defName: 'parallel', schema: ParallelZ },\n { defName: 'tour', schema: TourZ },\n];\n\n// ============================================================================\n// Named Exports (for unit tests and direct usage)\n// ============================================================================\n\nexport {\n AddClassZ,\n // Sub-types\n AnchorIdZ,\n BadgePositionZ,\n BadgeZ,\n CtaButtonZ,\n HighlightStyleZ,\n HighlightZ,\n InsertHtmlZ,\n InsertPositionZ,\n ModalContentZ,\n ModalZ,\n MountWidgetZ,\n NavigateZ,\n ParallelZ,\n PlacementZ,\n PulseZ,\n RemoveClassZ,\n ScrollBehaviorZ,\n ScrollLogicalPositionZ,\n ScrollToZ,\n SequenceZ,\n SetAttrZ,\n SetStyleZ,\n // Actions\n SetTextZ,\n TooltipContentZ,\n TooltipTriggerZ,\n TooltipZ,\n TourStepForSchemaZ,\n TourZ,\n WaitZ,\n WidgetConfigZ,\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAgBA,SAAS,SAAS;AAiBlB,IAAM,iBAAiB;AAAA,EACrB,aAAa;AACf;AAGA,IAAM,YAAY,EACf,OAAO;AAAA,EACN,UAAU,EAAE,OAAO;AAAA,EACnB,OAAO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AC7B,CAAC,EACA,OAAO,cAAc,EACrB,OAAO,gBAAgB,EACvB,YAAY;AAaR,IAAM,wBAAwB;AAAA,EACnC,EAAE,SAAS,WAAW,QAAQ,SAAS;AAAA,EACvC,EAAE,SAAS,WAAW,QAAQ,SAAS;AAAA,EACvC,EAAE,SAAS,YAAY,QAAQ,UAAU;AAAA,EACzC,EAAE,SAAS,eAAe,QAAQ,aAAa;AAAA,EAC/C,EAAE,SAAS,YAAY,QAAQ,UAAU;AAAA,EACzC,EAAE,SAAS,cAAc,QAAQ,YAAY;AAAA,EAC7C,EAAE,SAAS,aAAa,QAAQ,WAAW;AAAA,EAC3C,EAAE,SAAS,SAAS,QAAQ,OAAO;AAAA,EACnC,EAAE,SAAS,SAAS,QAAQ,OAAO;AAAA,EACnC,EAAE,SAAS,WAAW,QAAQ,SAAS;AAAA,EACvC,EAAE,SAAS,SAAS,QAAQ,OAAO;AAAA,EACnC,EAAE,SAAS,YAAY,QAAQ,UAAU;AAAA,EACzC,EAAE,SAAS,YAAY,QAAQ,UAAU;AAAA,EACzC,EAAE,SAAS,eAAe,QAAQ,aAAa;AAAA,EAC/C,EAAE,SAAS,QAAQ,QAAQ,MAAM;AAAA,EACjC,EAAE,SAAS,YAAY,QAAQ,UAAU;AAAA,EACzC,EAAE,SAAS,YAAY,QAAQ,UAAU;AAAA,EACzC,EAAE,SAAS,QAAQ,QAAQ,MAAM;AACnC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
WaitZ,
|
|
37
37
|
WidgetConfigZ,
|
|
38
38
|
coreActionStepSchemas
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-FMLX4END.js";
|
|
40
40
|
import "./chunk-44V2AOO4.js";
|
|
41
41
|
import {
|
|
42
42
|
ActivationConfigZ,
|
|
@@ -967,6 +967,28 @@ var executeCelebrate = async (action, context) => {
|
|
|
967
967
|
}
|
|
968
968
|
};
|
|
969
969
|
};
|
|
970
|
+
var ALLOWED_PROTOCOLS = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "tel:"]);
|
|
971
|
+
function isSafeNavigationHref(href) {
|
|
972
|
+
if (typeof href !== "string" || href.trim().length === 0) return false;
|
|
973
|
+
let parsed;
|
|
974
|
+
try {
|
|
975
|
+
parsed = new URL(href, "https://syntro.local/");
|
|
976
|
+
} catch {
|
|
977
|
+
return false;
|
|
978
|
+
}
|
|
979
|
+
return ALLOWED_PROTOCOLS.has(parsed.protocol);
|
|
980
|
+
}
|
|
981
|
+
function navigateForCta(input) {
|
|
982
|
+
if (input.actionId === "dismiss") return false;
|
|
983
|
+
if (!input.href || !isSafeNavigationHref(input.href)) return false;
|
|
984
|
+
const href = input.href;
|
|
985
|
+
if (input.target === "_blank") {
|
|
986
|
+
window.open(href, "_blank", "noopener,noreferrer");
|
|
987
|
+
} else {
|
|
988
|
+
window.location.assign(href);
|
|
989
|
+
}
|
|
990
|
+
return true;
|
|
991
|
+
}
|
|
970
992
|
var ACTIVE_TOUR_KEY = "syntro_active_tour";
|
|
971
993
|
var activeTours = /* @__PURE__ */ new Map();
|
|
972
994
|
function getTourState(tourId) {
|
|
@@ -1942,10 +1964,16 @@ var executeModal = async (action, context) => {
|
|
|
1942
1964
|
const actionId = btn.getAttribute("data-syntro-action");
|
|
1943
1965
|
if (actionId) {
|
|
1944
1966
|
actionClicked = actionId;
|
|
1967
|
+
const matchingBtn = ctaButtons == null ? void 0 : ctaButtons.find((b2) => b2.actionId === actionId);
|
|
1968
|
+
const href = matchingBtn == null ? void 0 : matchingBtn.href;
|
|
1945
1969
|
context.publishEvent("action.modal_cta_clicked", {
|
|
1946
|
-
actionId
|
|
1970
|
+
actionId,
|
|
1971
|
+
...href ? { href } : {}
|
|
1947
1972
|
});
|
|
1948
1973
|
handle.destroy();
|
|
1974
|
+
if (matchingBtn) {
|
|
1975
|
+
navigateForCta(matchingBtn);
|
|
1976
|
+
}
|
|
1949
1977
|
}
|
|
1950
1978
|
};
|
|
1951
1979
|
actionBtns.forEach((btn) => btn.addEventListener("click", actionHandler));
|
|
@@ -3110,8 +3138,12 @@ var executeTooltip = async (action, context) => {
|
|
|
3110
3138
|
context.publishEvent("action.tooltip_cta_clicked", {
|
|
3111
3139
|
anchorId: action.anchorId,
|
|
3112
3140
|
actionId,
|
|
3113
|
-
label: clickedBtn.label
|
|
3141
|
+
label: clickedBtn.label,
|
|
3142
|
+
...clickedBtn.href ? { href: clickedBtn.href } : {}
|
|
3114
3143
|
});
|
|
3144
|
+
handle.destroy();
|
|
3145
|
+
navigateForCta(clickedBtn);
|
|
3146
|
+
return;
|
|
3115
3147
|
}
|
|
3116
3148
|
}
|
|
3117
3149
|
handle.destroy();
|
|
@@ -9590,6 +9622,10 @@ var HealthReporter = class {
|
|
|
9590
9622
|
__publicField(this, "timer", null);
|
|
9591
9623
|
__publicField(this, "pagehideHandler", null);
|
|
9592
9624
|
__publicField(this, "runtime", null);
|
|
9625
|
+
/** Cleanup function for adapters that registered side effects (e.g. the
|
|
9626
|
+
* web-vitals long-task observer). Called from `stop()` so SPA re-init
|
|
9627
|
+
* via `initHealthReporter` doesn't accumulate observers. */
|
|
9628
|
+
__publicField(this, "adapterCleanup", null);
|
|
9593
9629
|
var _a3;
|
|
9594
9630
|
this.resource = config.resource;
|
|
9595
9631
|
this.flushIntervalMs = (_a3 = config.flushIntervalMs) != null ? _a3 : 6e4;
|
|
@@ -9602,6 +9638,15 @@ var HealthReporter = class {
|
|
|
9602
9638
|
bindRuntime(binding) {
|
|
9603
9639
|
this.runtime = binding;
|
|
9604
9640
|
}
|
|
9641
|
+
/**
|
|
9642
|
+
* Register a cleanup function to run on `stop()`. Used by adapters
|
|
9643
|
+
* (e.g. webVitalsAdapter) that need to release per-bind resources
|
|
9644
|
+
* like PerformanceObservers. Replaces any prior cleanup — only one
|
|
9645
|
+
* adapter cleanup is tracked.
|
|
9646
|
+
*/
|
|
9647
|
+
attachAdapterCleanup(cleanup) {
|
|
9648
|
+
this.adapterCleanup = cleanup;
|
|
9649
|
+
}
|
|
9605
9650
|
increment(signal, by = 1) {
|
|
9606
9651
|
var _a3;
|
|
9607
9652
|
this.counters.set(signal, ((_a3 = this.counters.get(signal)) != null ? _a3 : 0) + by);
|
|
@@ -9697,6 +9742,13 @@ var HealthReporter = class {
|
|
|
9697
9742
|
window.removeEventListener("pagehide", this.pagehideHandler);
|
|
9698
9743
|
this.pagehideHandler = null;
|
|
9699
9744
|
}
|
|
9745
|
+
if (this.adapterCleanup !== null) {
|
|
9746
|
+
try {
|
|
9747
|
+
this.adapterCleanup();
|
|
9748
|
+
} catch {
|
|
9749
|
+
}
|
|
9750
|
+
this.adapterCleanup = null;
|
|
9751
|
+
}
|
|
9700
9752
|
}
|
|
9701
9753
|
};
|
|
9702
9754
|
function percentile(sortedAsc, q2) {
|
|
@@ -9801,8 +9853,89 @@ function createOtlpEmitter(cfg) {
|
|
|
9801
9853
|
};
|
|
9802
9854
|
}
|
|
9803
9855
|
|
|
9856
|
+
// src/observability/sdkScriptUrl.ts
|
|
9857
|
+
function detect() {
|
|
9858
|
+
var _a3;
|
|
9859
|
+
if (typeof document === "undefined") return void 0;
|
|
9860
|
+
const cs = document.currentScript;
|
|
9861
|
+
if (cs && cs.src) return cs.src;
|
|
9862
|
+
try {
|
|
9863
|
+
const scripts = Array.from(document.scripts);
|
|
9864
|
+
for (let i = scripts.length - 1; i >= 0; i -= 1) {
|
|
9865
|
+
const src = (_a3 = scripts[i]) == null ? void 0 : _a3.src;
|
|
9866
|
+
if (typeof src === "string" && (src.includes("runtime-sdk") || src.includes("smart-canvas"))) {
|
|
9867
|
+
return src;
|
|
9868
|
+
}
|
|
9869
|
+
}
|
|
9870
|
+
} catch {
|
|
9871
|
+
}
|
|
9872
|
+
return void 0;
|
|
9873
|
+
}
|
|
9874
|
+
var SDK_SCRIPT_URL = detect();
|
|
9875
|
+
function getSdkScriptUrlPrefix() {
|
|
9876
|
+
if (!SDK_SCRIPT_URL) return void 0;
|
|
9877
|
+
const lastSlash = SDK_SCRIPT_URL.lastIndexOf("/");
|
|
9878
|
+
if (lastSlash === -1) return void 0;
|
|
9879
|
+
return SDK_SCRIPT_URL.substring(0, lastSlash + 1);
|
|
9880
|
+
}
|
|
9881
|
+
|
|
9882
|
+
// src/observability/webVitalsAdapter.ts
|
|
9883
|
+
import { onCLS, onFCP, onINP, onLCP, onTTFB } from "web-vitals";
|
|
9884
|
+
var VITALS_BOUND_FLAG = "__syntro_vitals_bound";
|
|
9885
|
+
var VITALS_CURRENT_REPORTER = "__syntro_vitals_current_reporter";
|
|
9886
|
+
function bindWebVitals(reporter, options) {
|
|
9887
|
+
if (typeof window === "undefined") return () => {
|
|
9888
|
+
};
|
|
9889
|
+
const w2 = window;
|
|
9890
|
+
w2[VITALS_CURRENT_REPORTER] = reporter;
|
|
9891
|
+
let longTaskObserver = null;
|
|
9892
|
+
const prefix = options == null ? void 0 : options.attributedScriptUrlPrefix;
|
|
9893
|
+
if (prefix && "PerformanceObserver" in window) {
|
|
9894
|
+
try {
|
|
9895
|
+
longTaskObserver = new PerformanceObserver((list) => {
|
|
9896
|
+
const current = w2[VITALS_CURRENT_REPORTER];
|
|
9897
|
+
if (!current) return;
|
|
9898
|
+
for (const entry of list.getEntries()) {
|
|
9899
|
+
const attribution = entry.attribution;
|
|
9900
|
+
if (!attribution) continue;
|
|
9901
|
+
const matched = attribution.some((a) => {
|
|
9902
|
+
var _a3, _b;
|
|
9903
|
+
const src = (_b = (_a3 = a.containerSrc) != null ? _a3 : a.name) != null ? _b : "";
|
|
9904
|
+
return src.startsWith(prefix);
|
|
9905
|
+
});
|
|
9906
|
+
if (matched) {
|
|
9907
|
+
current.increment("longtasks_self_count");
|
|
9908
|
+
current.increment("longtasks_self_blocking_ms", Math.round(entry.duration));
|
|
9909
|
+
}
|
|
9910
|
+
}
|
|
9911
|
+
});
|
|
9912
|
+
longTaskObserver.observe({ type: "longtask", buffered: true });
|
|
9913
|
+
} catch {
|
|
9914
|
+
longTaskObserver = null;
|
|
9915
|
+
}
|
|
9916
|
+
}
|
|
9917
|
+
if (!w2[VITALS_BOUND_FLAG]) {
|
|
9918
|
+
w2[VITALS_BOUND_FLAG] = true;
|
|
9919
|
+
const recordMs = (signal) => (metric) => {
|
|
9920
|
+
const current = w2[VITALS_CURRENT_REPORTER];
|
|
9921
|
+
current == null ? void 0 : current.recordHistogram(signal, metric.value);
|
|
9922
|
+
};
|
|
9923
|
+
onLCP(recordMs("lcp_ms"));
|
|
9924
|
+
onINP(recordMs("inp_ms"));
|
|
9925
|
+
onFCP(recordMs("fcp_ms"));
|
|
9926
|
+
onTTFB(recordMs("ttfb_ms"));
|
|
9927
|
+
onCLS((metric) => {
|
|
9928
|
+
const current = w2[VITALS_CURRENT_REPORTER];
|
|
9929
|
+
current == null ? void 0 : current.recordHistogram("cls_score", metric.value);
|
|
9930
|
+
});
|
|
9931
|
+
}
|
|
9932
|
+
return () => {
|
|
9933
|
+
longTaskObserver == null ? void 0 : longTaskObserver.disconnect();
|
|
9934
|
+
};
|
|
9935
|
+
}
|
|
9936
|
+
|
|
9804
9937
|
// src/version.ts
|
|
9805
|
-
var SDK_VERSION = "2.
|
|
9938
|
+
var SDK_VERSION = "2.20.0";
|
|
9806
9939
|
|
|
9807
9940
|
// src/types.ts
|
|
9808
9941
|
var SDK_SCHEMA_VERSION = "2.0";
|
|
@@ -18200,7 +18333,7 @@ function createTelemetryClient(provider, config) {
|
|
|
18200
18333
|
|
|
18201
18334
|
// src/bootstrap-runtime.ts
|
|
18202
18335
|
async function _initCore(options) {
|
|
18203
|
-
var _a3, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
18336
|
+
var _a3, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
18204
18337
|
initLogger();
|
|
18205
18338
|
debug("Syntro Bootstrap", "====== INIT ======");
|
|
18206
18339
|
debug("Syntro Bootstrap", "Options:", {
|
|
@@ -18267,7 +18400,7 @@ async function _initCore(options) {
|
|
|
18267
18400
|
if (payload != null && payload.obd !== true && telemetryHost) {
|
|
18268
18401
|
try {
|
|
18269
18402
|
const otlpEndpoint = `${telemetryHost.replace(/\/$/, "")}/sdk-otel/v1/logs`;
|
|
18270
|
-
initHealthReporter({
|
|
18403
|
+
const reporter = initHealthReporter({
|
|
18271
18404
|
resource: {
|
|
18272
18405
|
serviceName: "syntro-runtime-sdk",
|
|
18273
18406
|
serviceVersion: SDK_VERSION,
|
|
@@ -18278,14 +18411,17 @@ async function _initCore(options) {
|
|
|
18278
18411
|
},
|
|
18279
18412
|
emit: createOtlpEmitter({ endpoint: otlpEndpoint })
|
|
18280
18413
|
});
|
|
18414
|
+
const attributedScriptUrlPrefix = (_c = getSdkScriptUrlPrefix()) != null ? _c : "https://cdn.syntrologie.com/runtime-sdk/";
|
|
18415
|
+
const cleanup = bindWebVitals(reporter, { attributedScriptUrlPrefix });
|
|
18416
|
+
reporter.attachAdapterCleanup(cleanup);
|
|
18281
18417
|
} catch {
|
|
18282
18418
|
}
|
|
18283
18419
|
}
|
|
18284
|
-
const editorUrl = getEnvVar("NEXT_PUBLIC_SYNTRO_EDITOR_URL") || getEnvVar("VITE_SYNTRO_EDITOR_URL") || ((
|
|
18420
|
+
const editorUrl = getEnvVar("NEXT_PUBLIC_SYNTRO_EDITOR_URL") || getEnvVar("VITE_SYNTRO_EDITOR_URL") || ((_d = options.canvas) == null ? void 0 : _d.editorUrl);
|
|
18285
18421
|
const geoHost = (payload == null ? void 0 : payload.g) || getEnvVar("NEXT_PUBLIC_SYNTRO_GEO_HOST") || getEnvVar("VITE_SYNTRO_GEO_HOST") || GEO_DEFAULT_HOST;
|
|
18286
18422
|
const cachedSegmentAttrs = loadCachedSegmentAttributes();
|
|
18287
18423
|
const browserMetadata = collectBrowserMetadata();
|
|
18288
|
-
const appSignalsInit = (
|
|
18424
|
+
const appSignalsInit = (_e2 = options.appSignalsInit) != null ? _e2 : {};
|
|
18289
18425
|
const phaseOneAttrs = { ...browserMetadata, ...cachedSegmentAttrs, ...appSignalsInit };
|
|
18290
18426
|
debug("Syntro Bootstrap", "Phase 1: Browser metadata:", browserMetadata);
|
|
18291
18427
|
debug("Syntro Bootstrap", "Phase 1: Cached segment attributes:", cachedSegmentAttrs);
|
|
@@ -18429,7 +18565,7 @@ async function _initCore(options) {
|
|
|
18429
18565
|
});
|
|
18430
18566
|
console.log(`[Syntro Bootstrap] Telemetry client created (${provider}) with EventBus wiring`);
|
|
18431
18567
|
if (Object.keys(appSignalsInit).length > 0) {
|
|
18432
|
-
(
|
|
18568
|
+
(_f = telemetry.track) == null ? void 0 : _f.call(telemetry, "app_signals_init", appSignalsInit);
|
|
18433
18569
|
debug("Syntro Bootstrap", "Tracked app signals event:", appSignalsInit);
|
|
18434
18570
|
}
|
|
18435
18571
|
const telemetryForCapture = telemetry;
|
|
@@ -18487,7 +18623,7 @@ async function _initCore(options) {
|
|
|
18487
18623
|
if ((platformAdapter == null ? void 0 : platformAdapter.name) === "shopify" && telemetryHost) {
|
|
18488
18624
|
try {
|
|
18489
18625
|
shopifyPixelBridge = new ShopifyPixelBridge({
|
|
18490
|
-
distinctId: (
|
|
18626
|
+
distinctId: (_h = (_g = telemetry.getDistinctId) == null ? void 0 : _g.call(telemetry)) != null ? _h : "",
|
|
18491
18627
|
telemetryHost,
|
|
18492
18628
|
telemetryKey: payload.t
|
|
18493
18629
|
});
|
|
@@ -18575,7 +18711,7 @@ async function _initCore(options) {
|
|
|
18575
18711
|
debug("Syntro Bootstrap", "auto-load of adaptive-mcp failed (non-fatal):", err);
|
|
18576
18712
|
});
|
|
18577
18713
|
}
|
|
18578
|
-
const registeredApps = (
|
|
18714
|
+
const registeredApps = (_k = (_j = (_i = runtime5.apps).list) == null ? void 0 : _j.call(_i)) != null ? _k : [];
|
|
18579
18715
|
console.log(
|
|
18580
18716
|
`[DIAG] Activation loop: ${registeredApps.length} apps in registry:`,
|
|
18581
18717
|
registeredApps.map((a) => `${a.manifest.id}(${a.state})`).join(", ")
|
|
@@ -18606,13 +18742,13 @@ async function _initCore(options) {
|
|
|
18606
18742
|
if (experiments && Object.keys(geoData).length > 0) {
|
|
18607
18743
|
const mergedAttrs = { ...browserMetadata, ...geoData, ...appSignalsInit };
|
|
18608
18744
|
debug("Syntro Bootstrap", "Merging geo data into GrowthBook attributes:", geoData);
|
|
18609
|
-
(
|
|
18745
|
+
(_l = experiments.setAttributes) == null ? void 0 : _l.call(experiments, mergedAttrs);
|
|
18610
18746
|
}
|
|
18611
18747
|
const mcpHost = await mcpPromise;
|
|
18612
18748
|
if (mcpHost && experiments) {
|
|
18613
18749
|
browserMetadata.surface_type = "mcp-app";
|
|
18614
18750
|
browserMetadata.surface_host = mcpHost.name;
|
|
18615
|
-
(
|
|
18751
|
+
(_m = experiments.setAttributes) == null ? void 0 : _m.call(experiments, { ...browserMetadata, ...geoData });
|
|
18616
18752
|
runtime5.context.setSurfaceType("mcp-app");
|
|
18617
18753
|
runtime5.context.setSurfaceHost(mcpHost.name);
|
|
18618
18754
|
debug("Syntro Bootstrap", "MCP App detected:", mcpHost.name);
|
|
@@ -18621,7 +18757,7 @@ async function _initCore(options) {
|
|
|
18621
18757
|
if (options.fetcher) {
|
|
18622
18758
|
baseFetcher = options.fetcher;
|
|
18623
18759
|
} else if (payload == null ? void 0 : payload.f) {
|
|
18624
|
-
const configFetcher = createConfigFetcher(payload.f, (
|
|
18760
|
+
const configFetcher = createConfigFetcher(payload.f, (_n = payload.o) != null ? _n : {});
|
|
18625
18761
|
baseFetcher = async () => {
|
|
18626
18762
|
var _a4;
|
|
18627
18763
|
const result = await configFetcher.fetch();
|