@syntrologie/runtime-sdk 2.8.0-canary.63 → 2.8.0-canary.64

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.
@@ -20679,7 +20679,7 @@ Please report this to https://github.com/markedjs/marked.`, e2) {
20679
20679
  }
20680
20680
 
20681
20681
  // src/version.ts
20682
- var SDK_VERSION = "2.8.0-canary.63";
20682
+ var SDK_VERSION = "2.8.0-canary.64";
20683
20683
 
20684
20684
  // src/types.ts
20685
20685
  var SDK_SCHEMA_VERSION = "2.0";
@@ -38477,74 +38477,97 @@ ${cssRules}
38477
38477
  selector: external_exports.string(),
38478
38478
  route: external_exports.union([external_exports.string(), external_exports.array(external_exports.string())])
38479
38479
  }).strict();
38480
+ var COUNTABLE_EVENTS = [
38481
+ // User interactions (from PostHog autocapture normalization)
38482
+ "ui.click",
38483
+ "ui.scroll",
38484
+ "ui.input",
38485
+ "ui.change",
38486
+ "ui.submit",
38487
+ // Behavioral detectors (from event-processor)
38488
+ "ui.hover",
38489
+ "ui.idle",
38490
+ "ui.scroll_thrash",
38491
+ "ui.focus_bounce",
38492
+ // Navigation
38493
+ "nav.page_view",
38494
+ "nav.page_leave",
38495
+ // Derived behavioral signals
38496
+ "behavior.rage_click",
38497
+ "behavior.hesitation",
38498
+ "behavior.confusion"
38499
+ ];
38500
+ var CountableEventZ = external_exports.enum(COUNTABLE_EVENTS).describe("Event name to count. ui.* = user interactions and behavioral detectors, nav.* = page navigation, behavior.* = derived behavioral signals.");
38501
+ var SESSION_METRIC_KEYS = ["time_on_page", "page_views", "scroll_depth"];
38502
+ var SessionMetricKeyZ = external_exports.enum(SESSION_METRIC_KEYS).describe("Session metric key. time_on_page = seconds on current page, page_views = pages visited this session, scroll_depth = 0-100 percentage.");
38480
38503
  var PageUrlConditionZ = external_exports.object({
38481
38504
  type: external_exports.literal("page_url"),
38482
- url: external_exports.string()
38483
- });
38505
+ url: external_exports.string().describe('URL path to match (e.g. "/pricing", "/dashboard")')
38506
+ }).describe('Fires when the current page URL matches. Use for page-specific actions. Example: {"type": "page_url", "url": "/pricing"}');
38484
38507
  var RouteConditionZ = external_exports.object({
38485
38508
  type: external_exports.literal("route"),
38486
- routeId: external_exports.string()
38487
- });
38509
+ routeId: external_exports.string().describe("Named route ID from the route filter")
38510
+ }).describe("Fires when the current route matches a named route ID.");
38488
38511
  var AnchorVisibleConditionZ = external_exports.object({
38489
38512
  type: external_exports.literal("anchor_visible"),
38490
- anchorId: external_exports.string(),
38491
- state: external_exports.enum(["visible", "present", "absent"])
38492
- });
38513
+ anchorId: external_exports.string().describe("CSS selector of the anchor element"),
38514
+ state: external_exports.enum(["visible", "present", "absent"]).describe('"visible" = in viewport, "present" = in DOM, "absent" = not in DOM')
38515
+ }).describe(`Fires based on a DOM element's visibility state. Example: {"type": "anchor_visible", "anchorId": "#cta-button", "state": "visible"}`);
38493
38516
  var EventOccurredConditionZ = external_exports.object({
38494
38517
  type: external_exports.literal("event_occurred"),
38495
- eventName: external_exports.string(),
38496
- withinMs: external_exports.number().optional()
38497
- });
38518
+ eventName: external_exports.string().describe('Event name (e.g. "ui.click", "$pageview")'),
38519
+ withinMs: external_exports.number().optional().describe("Time window in ms. Omit = any time this session.")
38520
+ }).describe('Fires when a specific event has occurred during this session. Example: {"type": "event_occurred", "eventName": "ui.click", "withinMs": 5000}');
38498
38521
  var StateEqualsConditionZ = external_exports.object({
38499
38522
  type: external_exports.literal("state_equals"),
38500
- key: external_exports.string(),
38501
- value: external_exports.unknown()
38502
- });
38523
+ key: external_exports.string().describe("Key in the SDK persistent state store (localStorage). Only valid for keys the host app explicitly sets via syntro.state.set()."),
38524
+ value: external_exports.unknown().describe("Expected value to match against")
38525
+ }).describe("Checks the SDK persistent state store (localStorage). ONLY for host-app state set via syntro.state.set() \u2014 NOT for user attributes like region, device, or UTM params (those are handled by segment targeting). Do NOT use this for targeting. If you do not know the valid state keys, do not use this condition type.");
38503
38526
  var ViewportConditionZ = external_exports.object({
38504
38527
  type: external_exports.literal("viewport"),
38505
- minWidth: external_exports.number().optional(),
38506
- maxWidth: external_exports.number().optional(),
38507
- minHeight: external_exports.number().optional(),
38508
- maxHeight: external_exports.number().optional()
38509
- });
38528
+ minWidth: external_exports.number().optional().describe("Minimum viewport width in pixels"),
38529
+ maxWidth: external_exports.number().optional().describe("Maximum viewport width in pixels"),
38530
+ minHeight: external_exports.number().optional().describe("Minimum viewport height in pixels"),
38531
+ maxHeight: external_exports.number().optional().describe("Maximum viewport height in pixels")
38532
+ }).describe('Fires based on viewport (screen) size. Use for responsive behavior. Example: {"type": "viewport", "minWidth": 768} \u2014 fires on tablet and larger.');
38510
38533
  var SessionMetricConditionZ = external_exports.object({
38511
38534
  type: external_exports.literal("session_metric"),
38512
- key: external_exports.string(),
38535
+ key: SessionMetricKeyZ,
38513
38536
  operator: external_exports.enum(["gte", "lte", "eq", "gt", "lt"]),
38514
- threshold: external_exports.number()
38515
- });
38537
+ threshold: external_exports.number().describe("Numeric threshold to compare against")
38538
+ }).describe('Fires when a session metric crosses a threshold. Valid keys: "time_on_page" (seconds), "page_views" (count), "scroll_depth" (0-100). Example: {"type": "session_metric", "key": "time_on_page", "operator": "gte", "threshold": 30}');
38516
38539
  var DismissedConditionZ = external_exports.object({
38517
38540
  type: external_exports.literal("dismissed"),
38518
- key: external_exports.string(),
38519
- inverted: external_exports.boolean().optional()
38520
- });
38541
+ key: external_exports.string().describe("Dismissal key (usually a tile or action ID)"),
38542
+ inverted: external_exports.boolean().optional().describe("When true, fires if NOT dismissed (default behavior)")
38543
+ }).describe("Checks if an item has been dismissed by the user. Use with inverted: true to show only if not dismissed.");
38521
38544
  var CooldownActiveConditionZ = external_exports.object({
38522
38545
  type: external_exports.literal("cooldown_active"),
38523
- key: external_exports.string(),
38524
- inverted: external_exports.boolean().optional()
38525
- });
38546
+ key: external_exports.string().describe("Cooldown key"),
38547
+ inverted: external_exports.boolean().optional().describe("When true, fires if cooldown is NOT active")
38548
+ }).describe("Checks if a cooldown timer is currently active. Use to prevent showing the same intervention too frequently.");
38526
38549
  var FrequencyLimitConditionZ = external_exports.object({
38527
38550
  type: external_exports.literal("frequency_limit"),
38528
- key: external_exports.string(),
38529
- limit: external_exports.number(),
38530
- inverted: external_exports.boolean().optional()
38531
- });
38551
+ key: external_exports.string().describe("Frequency counter key"),
38552
+ limit: external_exports.number().describe("Maximum allowed count"),
38553
+ inverted: external_exports.boolean().optional().describe("When true, fires if limit NOT reached")
38554
+ }).describe("Checks if a frequency limit has been reached. Use to cap how many times an action fires per session.");
38532
38555
  var MatchOpZ = external_exports.object({
38533
38556
  equals: external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()]).optional(),
38534
38557
  contains: external_exports.string().optional()
38535
- });
38558
+ }).describe("Match operator for counter filters. Exactly one of equals or contains must be specified.");
38536
38559
  var CounterDefZ = external_exports.object({
38537
- events: external_exports.array(external_exports.string()).min(1),
38538
- match: external_exports.record(external_exports.string(), MatchOpZ).optional()
38539
- });
38560
+ events: external_exports.array(CountableEventZ).min(1).describe("Event names to count. Use values from the countable events enum."),
38561
+ match: external_exports.record(external_exports.string(), MatchOpZ).optional().describe("Property filters. Keys are event prop names or element-chain fields (tag_name, $el_text, attr__*). All entries AND together.")
38562
+ }).describe("Defines what events to count. Registered as an accumulator predicate at config-load time.");
38540
38563
  var EventCountConditionZ = external_exports.object({
38541
38564
  type: external_exports.literal("event_count"),
38542
- key: external_exports.string(),
38565
+ key: external_exports.string().describe("Unique key for this counter (used for accumulator registration)"),
38543
38566
  operator: external_exports.enum(["gte", "lte", "eq", "gt", "lt"]),
38544
- count: external_exports.number().int().min(0),
38545
- withinMs: external_exports.number().positive().optional(),
38546
- counter: CounterDefZ.optional()
38547
- });
38567
+ count: external_exports.number().int().min(0).describe("Target count threshold"),
38568
+ withinMs: external_exports.number().positive().optional().describe("Time window in ms. Omit = count across entire session."),
38569
+ counter: CounterDefZ.optional().describe("Inline counter definition. Defines what events to count.")
38570
+ }).describe('Fires when accumulated event count crosses a threshold. Most powerful trigger type. Example: {"type": "event_count", "key": "pricing-clicks", "operator": "gte", "count": 3, "counter": {"events": ["ui.click"], "match": {"attr__data-cta": {"contains": "pricing"}}}}');
38548
38571
  var ConditionZ = external_exports.discriminatedUnion("type", [
38549
38572
  PageUrlConditionZ,
38550
38573
  RouteConditionZ,
@@ -38559,35 +38582,35 @@ ${cssRules}
38559
38582
  EventCountConditionZ
38560
38583
  ]);
38561
38584
  var RuleZ = external_exports.object({
38562
- conditions: external_exports.array(ConditionZ),
38563
- value: external_exports.unknown()
38564
- });
38585
+ conditions: external_exports.array(ConditionZ).describe("Array of conditions \u2014 ALL must match (AND logic) for this rule to fire."),
38586
+ value: external_exports.unknown().describe("Value returned when all conditions match. For triggerWhen: true = fire the action.")
38587
+ }).describe("A single rule. ALL conditions must match (AND logic). Rules in a strategy are evaluated top-to-bottom \u2014 first rule where all conditions match wins and returns its value.");
38565
38588
  var RuleStrategyZ = external_exports.object({
38566
38589
  type: external_exports.literal("rules"),
38567
- rules: external_exports.array(RuleZ),
38568
- default: external_exports.unknown()
38569
- });
38590
+ rules: external_exports.array(RuleZ).describe("Ordered list of rules. Evaluated top-to-bottom \u2014 first match wins."),
38591
+ default: external_exports.unknown().describe("Fallback value when no rule matches. For triggerWhen: false = do not fire by default.")
38592
+ }).describe("Rule-based strategy. Evaluates rules top-to-bottom. First rule where ALL conditions match returns its value. If no rule matches, returns default. For triggerWhen: set value=true on matching rules, default=false.");
38570
38593
  var ScoreStrategyZ = external_exports.object({
38571
38594
  type: external_exports.literal("score"),
38572
38595
  field: external_exports.string(),
38573
38596
  threshold: external_exports.number(),
38574
38597
  above: external_exports.unknown(),
38575
38598
  below: external_exports.unknown()
38576
- });
38599
+ }).describe("Score-based strategy. Compares a field value against a threshold.");
38577
38600
  var ModelStrategyZ = external_exports.object({
38578
38601
  type: external_exports.literal("model"),
38579
38602
  modelId: external_exports.string(),
38580
38603
  inputs: external_exports.array(external_exports.string()),
38581
38604
  outputMapping: external_exports.record(external_exports.string(), external_exports.unknown()),
38582
38605
  default: external_exports.unknown()
38583
- });
38606
+ }).describe("ML model strategy. Sends inputs to a model and maps outputs.");
38584
38607
  var ExternalStrategyZ = external_exports.object({
38585
38608
  type: external_exports.literal("external"),
38586
38609
  endpoint: external_exports.string(),
38587
38610
  method: external_exports.enum(["GET", "POST"]).optional(),
38588
38611
  default: external_exports.unknown(),
38589
38612
  timeoutMs: external_exports.number().optional()
38590
- });
38613
+ }).describe("External API strategy. Calls an endpoint to determine the value.");
38591
38614
  var DecisionStrategyZ = external_exports.discriminatedUnion("type", [
38592
38615
  RuleStrategyZ,
38593
38616
  ScoreStrategyZ,
@@ -42120,7 +42143,7 @@ ${cssRules}
42120
42143
  }
42121
42144
 
42122
42145
  // src/index.ts
42123
- var RUNTIME_SDK_BUILD = true ? `${"2026-04-13T03:02:09.724Z"} (${"709fe972866"})` : "dev";
42146
+ var RUNTIME_SDK_BUILD = true ? `${"2026-04-13T06:17:12.836Z"} (${"04de87d27a6"})` : "dev";
42124
42147
  if (typeof window !== "undefined") {
42125
42148
  console.log(`[Syntro Runtime] Build: ${RUNTIME_SDK_BUILD}`);
42126
42149
  const existing = window.SynOS;