@syntrologie/runtime-sdk 2.10.0 → 2.11.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.js +4 -3
- package/dist/{chunk-XDYJ64IN.js → chunk-37TTQRH5.js} +2 -2
- package/dist/{chunk-OIDBMIRB.js → chunk-H3FAYTUV.js} +110 -138
- package/dist/chunk-H3FAYTUV.js.map +7 -0
- package/dist/chunk-JMHRHAEL.js +18 -0
- package/dist/chunk-JMHRHAEL.js.map +7 -0
- package/dist/{chunk-R5DNAIRI.js → chunk-NBFQGKSV.js} +3 -3
- package/dist/{chunk-BU4Z6PD7.js → chunk-Q77NT67W.js} +1 -16
- package/dist/{chunk-BU4Z6PD7.js.map → chunk-Q77NT67W.js.map} +1 -1
- package/dist/config/schema.js +3 -2
- package/dist/decisions/schema.js +2 -1
- package/dist/events/normalizers/posthog.d.ts +4 -50
- package/dist/events/types.d.ts +8 -25
- package/dist/index.js +14 -8
- package/dist/index.js.map +3 -3
- package/dist/react.js +5 -4
- package/dist/react.js.map +1 -1
- package/dist/replayMirror-QZ3GQ527.js +32 -0
- package/dist/replayMirror-QZ3GQ527.js.map +7 -0
- package/dist/smart-canvas.esm.js +51 -51
- package/dist/smart-canvas.esm.js.map +4 -4
- package/dist/smart-canvas.js +669 -148
- package/dist/smart-canvas.js.map +4 -4
- package/dist/smart-canvas.min.js +51 -51
- package/dist/smart-canvas.min.js.map +4 -4
- package/dist/telemetry/adapters/posthog.d.ts +31 -0
- package/dist/telemetry/replayMirror.d.ts +7 -0
- package/dist/version.d.ts +1 -1
- package/package.json +8 -7
- package/dist/chunk-OIDBMIRB.js.map +0 -7
- /package/dist/{chunk-XDYJ64IN.js.map → chunk-37TTQRH5.js.map} +0 -0
- /package/dist/{chunk-R5DNAIRI.js.map → chunk-NBFQGKSV.js.map} +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __typeError = (msg) => {
|
|
3
|
+
throw TypeError(msg);
|
|
4
|
+
};
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
8
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
9
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
__publicField,
|
|
14
|
+
__privateGet,
|
|
15
|
+
__privateAdd,
|
|
16
|
+
__privateSet
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=chunk-JMHRHAEL.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NotificationDeepLinkZ
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-37TTQRH5.js";
|
|
4
4
|
import {
|
|
5
5
|
TriggerWhenZ
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-Q77NT67W.js";
|
|
7
7
|
|
|
8
8
|
// src/actions/schema.ts
|
|
9
9
|
import { z } from "zod";
|
|
@@ -249,4 +249,4 @@ export {
|
|
|
249
249
|
TourZ,
|
|
250
250
|
coreActionStepSchemas
|
|
251
251
|
};
|
|
252
|
-
//# sourceMappingURL=chunk-
|
|
252
|
+
//# sourceMappingURL=chunk-NBFQGKSV.js.map
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __typeError = (msg) => {
|
|
3
|
-
throw TypeError(msg);
|
|
4
|
-
};
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
8
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
9
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
|
-
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
|
-
|
|
12
1
|
// src/decisions/schema.ts
|
|
13
2
|
import { z as z2 } from "zod";
|
|
14
3
|
|
|
@@ -183,10 +172,6 @@ var decisionSchemas = [
|
|
|
183
172
|
];
|
|
184
173
|
|
|
185
174
|
export {
|
|
186
|
-
__publicField,
|
|
187
|
-
__privateGet,
|
|
188
|
-
__privateAdd,
|
|
189
|
-
__privateSet,
|
|
190
175
|
PageUrlConditionZ,
|
|
191
176
|
RouteConditionZ,
|
|
192
177
|
AnchorVisibleConditionZ,
|
|
@@ -215,4 +200,4 @@ export {
|
|
|
215
200
|
validateActivationConfig,
|
|
216
201
|
decisionSchemas
|
|
217
202
|
};
|
|
218
|
-
//# sourceMappingURL=chunk-
|
|
203
|
+
//# sourceMappingURL=chunk-Q77NT67W.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/decisions/schema.ts", "../../sdk-contracts/dist/schemas.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * Zod schemas for decision strategy validation.\n *\n * Condition and strategy schemas are canonical in @syntrologie/sdk-contracts.\n * This module re-exports them and adds runtime-specific schemas\n * (ActivationConfig, RouteFilter) plus the decisionSchemas array for\n * unified JSON Schema generation.\n */\nimport { z } from 'zod';\n\n// Re-export all condition + strategy schemas from the single source of truth\nexport {\n AnchorVisibleConditionZ,\n type ConditionSchema,\n ConditionZ,\n CooldownActiveConditionZ,\n CounterDefZ,\n type DecisionStrategySchema,\n DecisionStrategyZ,\n DismissedConditionZ,\n EventCountConditionZ,\n EventOccurredConditionZ,\n ExternalStrategyZ,\n FrequencyLimitConditionZ,\n MatchOpZ,\n ModelStrategyZ,\n PageUrlConditionZ,\n RouteConditionZ,\n type RuleSchema,\n RuleStrategyZ,\n RuleZ,\n ScoreStrategyZ,\n SessionMetricConditionZ,\n StateEqualsConditionZ,\n TriggerWhenZ,\n ViewportConditionZ,\n} from '@syntrologie/sdk-contracts';\n\nimport {\n ConditionZ,\n CounterDefZ,\n DecisionStrategyZ,\n ExternalStrategyZ,\n MatchOpZ,\n ModelStrategyZ,\n RuleStrategyZ,\n RuleZ,\n ScoreStrategyZ,\n} from '@syntrologie/sdk-contracts';\n\n// =============================================================================\n// ACTIVATION CONFIG SCHEMA (runtime-specific)\n// =============================================================================\n\nexport const RouteFilterZ = z.object({\n include: z\n .array(z.string())\n .optional()\n .describe(\n 'URL patterns where this tile appears. Supports *, **, :param wildcards. ' +\n 'Use sparingly \u2014 mostly to isolate to specific webapp functionality. ' +\n 'Omit to appear on all routes.'\n ),\n exclude: z\n .array(z.string())\n .optional()\n .describe('URL patterns where this tile should NOT appear. Evaluated before include.'),\n});\n\nexport const ActivationConfigZ = z.object({\n routes: RouteFilterZ,\n onlyIfPopulated: z\n .boolean()\n .optional()\n .describe(\n 'When true, tile is hidden if none of its props.actions[] have an active triggerWhen. ' +\n 'Useful for tiles with all-deferred FAQ questions or nav tips. Default: false.'\n ),\n});\n\n// =============================================================================\n// VALIDATION FUNCTIONS\n// =============================================================================\n\n/**\n * Validate a Condition object.\n */\nexport function validateCondition(data: unknown) {\n return ConditionZ.safeParse(data);\n}\n\n/**\n * Validate a DecisionStrategy object.\n */\nexport function validateStrategy(data: unknown) {\n return DecisionStrategyZ.safeParse(data);\n}\n\n/**\n * Validate an ActivationConfig object.\n */\nexport function validateActivationConfig(data: unknown) {\n return ActivationConfigZ.safeParse(data);\n}\n\n// =============================================================================\n// Export: Array for unified schema generation\n// =============================================================================\n\n/**\n * Decision schemas for unified JSON Schema generation.\n * The generator imports this array and converts each to a JSON Schema $def.\n *\n * Note: `decisionStrategy` is NOT included here \u2014 it's a oneOf wrapper that\n * the generator builds from $refs to the four strategy defs.\n */\nexport const decisionSchemas = [\n { defName: 'matchOp', schema: MatchOpZ },\n { defName: 'counterDef', schema: CounterDefZ },\n { defName: 'activationConfig', schema: ActivationConfigZ },\n { defName: 'routeFilter', schema: RouteFilterZ },\n { defName: 'ruleStrategy', schema: RuleStrategyZ },\n { defName: 'scoreStrategy', schema: ScoreStrategyZ },\n { defName: 'modelStrategy', schema: ModelStrategyZ },\n { defName: 'externalStrategy', schema: ExternalStrategyZ },\n { defName: 'rule', schema: RuleZ },\n { defName: 'condition', schema: ConditionZ },\n];\n\n// =============================================================================\n// TYPE INFERENCE\n// =============================================================================\n\nexport type ActivationConfigSchema = z.infer<typeof ActivationConfigZ>;\n", "/**\n * Shared Zod schemas for decision strategies, conditions, and event scoping.\n *\n * These are the canonical definitions \u2014 runtime-sdk and all adaptive packages\n * should import from here instead of duplicating.\n */\nimport { z } from 'zod';\n// =============================================================================\n// ANCHOR ID SCHEMA\n// =============================================================================\nexport const AnchorIdZ = z\n .object({\n selector: z.string(),\n route: z.union([z.string(), z.array(z.string())]),\n})\n .strict();\n// =============================================================================\n// CONDITION SCHEMAS\n// =============================================================================\nexport const PageUrlConditionZ = z.object({\n type: z.literal('page_url'),\n url: z.string(),\n});\nexport const RouteConditionZ = z.object({\n type: z.literal('route'),\n routeId: z.string(),\n});\nexport const AnchorVisibleConditionZ = z.object({\n type: z.literal('anchor_visible'),\n anchorId: z.string(),\n state: z.enum(['visible', 'present', 'absent']),\n});\nexport const EventOccurredConditionZ = z.object({\n type: z.literal('event_occurred'),\n eventName: z.string(),\n withinMs: z.number().optional(),\n});\nexport const StateEqualsConditionZ = z.object({\n type: z.literal('state_equals'),\n key: z.string(),\n value: z.unknown(),\n});\nexport const ViewportConditionZ = z.object({\n type: z.literal('viewport'),\n minWidth: z.number().optional(),\n maxWidth: z.number().optional(),\n minHeight: z.number().optional(),\n maxHeight: z.number().optional(),\n});\nexport const SessionMetricConditionZ = z.object({\n type: z.literal('session_metric'),\n key: z.string(),\n operator: z.enum(['gte', 'lte', 'eq', 'gt', 'lt']),\n threshold: z.number(),\n});\nexport const DismissedConditionZ = z.object({\n type: z.literal('dismissed'),\n key: z.string(),\n inverted: z.boolean().optional(),\n});\nexport const CooldownActiveConditionZ = z.object({\n type: z.literal('cooldown_active'),\n key: z.string(),\n inverted: z.boolean().optional(),\n});\nexport const FrequencyLimitConditionZ = z.object({\n type: z.literal('frequency_limit'),\n key: z.string(),\n limit: z.number(),\n inverted: z.boolean().optional(),\n});\nexport const MatchOpZ = z.object({\n equals: z.union([z.string(), z.number(), z.boolean()]).optional(),\n contains: z.string().optional(),\n});\nexport const CounterDefZ = z.object({\n events: z.array(z.string()).min(1),\n match: z.record(z.string(), MatchOpZ).optional(),\n});\nexport const EventCountConditionZ = z.object({\n type: z.literal('event_count'),\n key: z.string(),\n operator: z.enum(['gte', 'lte', 'eq', 'gt', 'lt']),\n count: z.number().int().min(0),\n withinMs: z.number().positive().optional(),\n counter: CounterDefZ.optional(),\n});\nexport const ConditionZ = z.discriminatedUnion('type', [\n PageUrlConditionZ,\n RouteConditionZ,\n AnchorVisibleConditionZ,\n EventOccurredConditionZ,\n StateEqualsConditionZ,\n ViewportConditionZ,\n SessionMetricConditionZ,\n DismissedConditionZ,\n CooldownActiveConditionZ,\n FrequencyLimitConditionZ,\n EventCountConditionZ,\n]);\n// =============================================================================\n// STRATEGY SCHEMAS\n// =============================================================================\nexport const RuleZ = z.object({\n conditions: z.array(ConditionZ),\n value: z.unknown(),\n});\nexport const RuleStrategyZ = z.object({\n type: z.literal('rules'),\n rules: z.array(RuleZ),\n default: z.unknown(),\n});\nexport const ScoreStrategyZ = z.object({\n type: z.literal('score'),\n field: z.string(),\n threshold: z.number(),\n above: z.unknown(),\n below: z.unknown(),\n});\nexport const ModelStrategyZ = z.object({\n type: z.literal('model'),\n modelId: z.string(),\n inputs: z.array(z.string()),\n outputMapping: z.record(z.string(), z.unknown()),\n default: z.unknown(),\n});\nexport const ExternalStrategyZ = z.object({\n type: z.literal('external'),\n endpoint: z.string(),\n method: z.enum(['GET', 'POST']).optional(),\n default: z.unknown(),\n timeoutMs: z.number().optional(),\n});\nexport const DecisionStrategyZ = z.discriminatedUnion('type', [\n RuleStrategyZ,\n ScoreStrategyZ,\n ModelStrategyZ,\n ExternalStrategyZ,\n]);\n/** Canonical Zod schema for the optional triggerWhen field on actions and adaptive items. */\nexport const TriggerWhenZ = DecisionStrategyZ.nullable().optional();\n// =============================================================================\n// EVENT SCOPE SCHEMA\n// =============================================================================\n/** Scopes a widget to specific events/URLs. */\nexport const EventScopeZ = z.object({\n events: z.array(z.string()),\n urlContains: z.string().optional(),\n props: z.record(z.union([z.string(), z.number(), z.boolean()])).optional(),\n});\n// =============================================================================\n// NOTIFY SCHEMA\n// =============================================================================\n/** Toast notification config for triggerWhen transitions. */\nexport const NotifyZ = z\n .object({\n title: z.string().optional(),\n body: z.string().optional(),\n icon: z.string().optional(),\n})\n .nullable()\n .optional();\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAQA,SAAS,KAAAA,UAAS;;;ACFlB,SAAS,SAAS;AAIX,IAAM,YAAY,EACpB,OAAO;AAAA,EACR,UAAU,EAAE,OAAO;AAAA,EACnB,OAAO,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AACpD,CA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D,EAAE,SAAS,iBAAiB,QAAQ,eAAe;AAAA,EACnD,EAAE,SAAS,iBAAiB,QAAQ,eAAe;AAAA,EACnD,EAAE,SAAS,oBAAoB,QAAQ,kBAAkB;AAAA,EACzD,EAAE,SAAS,QAAQ,QAAQ,MAAM;AAAA,EACjC,EAAE,SAAS,aAAa,QAAQ,WAAW;AAC7C;",
|
|
6
6
|
"names": ["z", "z"]
|
|
7
7
|
}
|
package/dist/config/schema.js
CHANGED
|
@@ -12,8 +12,9 @@ import {
|
|
|
12
12
|
TileNotificationRuleZ,
|
|
13
13
|
TileZ,
|
|
14
14
|
configSchemas
|
|
15
|
-
} from "../chunk-
|
|
16
|
-
import "../chunk-
|
|
15
|
+
} from "../chunk-37TTQRH5.js";
|
|
16
|
+
import "../chunk-Q77NT67W.js";
|
|
17
|
+
import "../chunk-JMHRHAEL.js";
|
|
17
18
|
export {
|
|
18
19
|
CanvasConfigResponseZ,
|
|
19
20
|
CanvasElementConfigZ,
|
package/dist/decisions/schema.js
CHANGED
|
@@ -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";
|
|
@@ -77,7 +64,3 @@ export declare const StandardEvents: {
|
|
|
77
64
|
readonly SURFACE_MOUNTED: "surface.mounted";
|
|
78
65
|
readonly SURFACE_UNMOUNTED: "surface.unmounted";
|
|
79
66
|
};
|
|
80
|
-
/**
|
|
81
|
-
* Current schema version for normalized events.
|
|
82
|
-
*/
|
|
83
|
-
export declare const EVENT_SCHEMA_VERSION = "1.0.0";
|
package/dist/index.js
CHANGED
|
@@ -43,7 +43,6 @@ import {
|
|
|
43
43
|
createGrowthBookClient,
|
|
44
44
|
createNoopClient,
|
|
45
45
|
createPostHogClient,
|
|
46
|
-
createPostHogNormalizer,
|
|
47
46
|
createSessionMetricTracker,
|
|
48
47
|
createSmartCanvas,
|
|
49
48
|
createSmartCanvasController,
|
|
@@ -71,7 +70,6 @@ import {
|
|
|
71
70
|
interpolateTemplate,
|
|
72
71
|
isCoreActionKind,
|
|
73
72
|
matchEvent,
|
|
74
|
-
normalizePostHogEvent,
|
|
75
73
|
playEnterAnimation,
|
|
76
74
|
playExitAnimation,
|
|
77
75
|
purple,
|
|
@@ -83,7 +81,6 @@ import {
|
|
|
83
81
|
runtime2,
|
|
84
82
|
setupAdjacentPositioning,
|
|
85
83
|
setupInlinePositioning,
|
|
86
|
-
shouldNormalizeEvent,
|
|
87
84
|
slateGrey,
|
|
88
85
|
useDecision,
|
|
89
86
|
useNotifications,
|
|
@@ -100,7 +97,7 @@ import {
|
|
|
100
97
|
validateAction,
|
|
101
98
|
validateActions,
|
|
102
99
|
widgetRegistry
|
|
103
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-H3FAYTUV.js";
|
|
104
101
|
import {
|
|
105
102
|
AddClassZ,
|
|
106
103
|
AnchorIdZ,
|
|
@@ -134,8 +131,8 @@ import {
|
|
|
134
131
|
WaitZ,
|
|
135
132
|
WidgetConfigZ,
|
|
136
133
|
coreActionStepSchemas
|
|
137
|
-
} from "./chunk-
|
|
138
|
-
import "./chunk-
|
|
134
|
+
} from "./chunk-NBFQGKSV.js";
|
|
135
|
+
import "./chunk-37TTQRH5.js";
|
|
139
136
|
import {
|
|
140
137
|
ActivationConfigZ,
|
|
141
138
|
AnchorVisibleConditionZ,
|
|
@@ -160,12 +157,14 @@ import {
|
|
|
160
157
|
StateEqualsConditionZ,
|
|
161
158
|
TriggerWhenZ,
|
|
162
159
|
ViewportConditionZ,
|
|
163
|
-
__publicField,
|
|
164
160
|
decisionSchemas,
|
|
165
161
|
validateActivationConfig,
|
|
166
162
|
validateCondition,
|
|
167
163
|
validateStrategy
|
|
168
|
-
} from "./chunk-
|
|
164
|
+
} from "./chunk-Q77NT67W.js";
|
|
165
|
+
import {
|
|
166
|
+
__publicField
|
|
167
|
+
} from "./chunk-JMHRHAEL.js";
|
|
169
168
|
|
|
170
169
|
// src/index.ts
|
|
171
170
|
import React4 from "react";
|
|
@@ -4207,6 +4206,13 @@ function validateRuntimeContext(data) {
|
|
|
4207
4206
|
return RuntimeContextZ.safeParse(data);
|
|
4208
4207
|
}
|
|
4209
4208
|
|
|
4209
|
+
// src/events/normalizers/posthog.ts
|
|
4210
|
+
import {
|
|
4211
|
+
createPostHogNormalizer,
|
|
4212
|
+
normalizePostHogEvent,
|
|
4213
|
+
shouldNormalizeEvent
|
|
4214
|
+
} from "@syntrologie/event-processor/normalizers/posthog";
|
|
4215
|
+
|
|
4210
4216
|
// src/events/schema.ts
|
|
4211
4217
|
import { z as z3 } from "zod";
|
|
4212
4218
|
var EventSourceZ = z3.enum(["posthog", "canvas", "derived"]);
|