@syntrologie/runtime-sdk 2.8.0-canary.7 → 2.8.0-canary.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CAPABILITIES.md +299 -167
  2. package/README.md +2 -0
  3. package/dist/actions/schema.d.ts +783 -783
  4. package/dist/actions/schema.js +3 -3
  5. package/dist/actions/types.d.ts +1 -1
  6. package/dist/actions/validation-core.d.ts +24 -0
  7. package/dist/actions/validation-rules.d.ts +74 -0
  8. package/dist/actions/validation.d.ts +5 -11
  9. package/dist/bootstrap-init.d.ts +33 -0
  10. package/dist/bootstrap-runtime.d.ts +7 -0
  11. package/dist/bootstrap-types.d.ts +90 -0
  12. package/dist/bootstrap.d.ts +19 -83
  13. package/dist/{chunk-R5DNAIRI.js → chunk-77TNZ66J.js} +4 -4
  14. package/dist/{chunk-R5DNAIRI.js.map → chunk-77TNZ66J.js.map} +2 -2
  15. package/dist/{chunk-XDYJ64IN.js → chunk-IR6UOR63.js} +4 -4
  16. package/dist/chunk-IR6UOR63.js.map +7 -0
  17. package/dist/{chunk-GWF5BTST.js → chunk-WX32GVSP.js} +1855 -783
  18. package/dist/chunk-WX32GVSP.js.map +7 -0
  19. package/dist/chunk-YLLWLUQX.js +241 -0
  20. package/dist/chunk-YLLWLUQX.js.map +7 -0
  21. package/dist/components/ShadowCanvasOverlay.d.ts +1 -2
  22. package/dist/components/TileIcon.d.ts +2 -2
  23. package/dist/components/emojiToIcon.d.ts +24 -0
  24. package/dist/config/schema.d.ts +147 -136
  25. package/dist/config/schema.js +2 -2
  26. package/dist/decisions/schema.d.ts +47 -47
  27. package/dist/decisions/schema.js +1 -1
  28. package/dist/events/EventBus.d.ts +27 -1
  29. package/dist/events/history.d.ts +9 -0
  30. package/dist/events/index.d.ts +3 -0
  31. package/dist/events/normalizers/posthog.d.ts +4 -50
  32. package/dist/events/types.d.ts +30 -23
  33. package/dist/events/validation.d.ts +7 -0
  34. package/dist/fetchers/experimentsFetcher.d.ts +3 -3
  35. package/dist/index.d.ts +0 -2
  36. package/dist/index.js +1529 -212
  37. package/dist/index.js.map +4 -4
  38. package/dist/overlays/runtime/overlay/overlay-runner.d.ts +4 -0
  39. package/dist/overlays/runtime/overlay/overlay-state.d.ts +21 -0
  40. package/dist/overlays/types.d.ts +3 -1
  41. package/dist/react.js +6 -4
  42. package/dist/react.js.map +2 -2
  43. package/dist/smart-canvas.esm.js +115 -65
  44. package/dist/smart-canvas.esm.js.map +4 -4
  45. package/dist/smart-canvas.js +5901 -3064
  46. package/dist/smart-canvas.js.map +4 -4
  47. package/dist/smart-canvas.min.js +115 -65
  48. package/dist/smart-canvas.min.js.map +4 -4
  49. package/dist/telemetry/InterventionTracker.d.ts +23 -0
  50. package/dist/telemetry/adapters/posthog.d.ts +30 -4
  51. package/dist/telemetry/index.d.ts +1 -0
  52. package/dist/test/setup.d.ts +1 -0
  53. package/dist/token.d.ts +2 -0
  54. package/dist/version.d.ts +1 -1
  55. package/package.json +23 -28
  56. package/schema/canvas-config.schema.json +1974 -10925
  57. package/scripts/syntroReactPlugin.mjs +3 -0
  58. package/scripts/validate-config.mjs +42 -0
  59. package/dist/chunk-BU4Z6PD7.js +0 -218
  60. package/dist/chunk-BU4Z6PD7.js.map +0 -7
  61. package/dist/chunk-GWF5BTST.js.map +0 -7
  62. package/dist/chunk-XDYJ64IN.js.map +0 -7
@@ -0,0 +1,23 @@
1
+ import type { TelemetryClient } from './types';
2
+ /**
3
+ * Tracks 4 intervention metrics via PostHog:
4
+ * - served: config delivered to browser
5
+ * - seen: intervention visible in viewport
6
+ * - triggered: activation conditions met
7
+ * - interacted: user clicked/engaged
8
+ *
9
+ * Deduplication: "seen" and "triggered" fire once per intervention per page.
10
+ * "served" fires once per fetch. "interacted" fires every time.
11
+ */
12
+ export declare class InterventionTracker {
13
+ private telemetry;
14
+ private variantId;
15
+ private seenSet;
16
+ private triggeredSet;
17
+ constructor(telemetry: TelemetryClient, variantId: string);
18
+ trackServed(tiles: number, actions: number): void;
19
+ trackSeen(interventionId: string, interventionKind: string): void;
20
+ trackTriggered(interventionId: string, interventionKind: string): void;
21
+ trackInteracted(interventionId: string, interventionKind: string, interactionType: string): void;
22
+ resetPage(): void;
23
+ }
@@ -32,10 +32,12 @@ export interface PostHogAdapterOptions {
32
32
  */
33
33
  sessionRecording?: boolean;
34
34
  /**
35
- * Enable pageview capture.
36
- * @default true
35
+ * Pageview capture mode.
36
+ * - true: capture only on initial page load
37
+ * - 'history_change': auto-capture on SPA navigation (pushState/replaceState)
38
+ * @default "history_change"
37
39
  */
38
- capturePageview?: boolean;
40
+ capturePageview?: boolean | 'history_change';
39
41
  /**
40
42
  * Enable page leave capture.
41
43
  * @default true
@@ -71,6 +73,18 @@ export interface PostHogAdapterOptions {
71
73
  * @default false
72
74
  */
73
75
  requireExplicitConsent?: boolean;
76
+ /**
77
+ * Enable behavioral signal detection (hesitation, rage click, etc.)
78
+ * Pass `true` for defaults, or a partial DetectorConfig to customize thresholds.
79
+ * @default false
80
+ */
81
+ behavioralSignals?: boolean | Record<string, number>;
82
+ /**
83
+ * Callback for raw rrweb events from session recording.
84
+ * Called with each rrweb eventWithTime before PostHog processes it.
85
+ * Used by the event processor for behavioral signal detection.
86
+ */
87
+ onRRWebEvent?: (event: Record<string, unknown>) => void;
74
88
  }
75
89
  interface CanvasAnalyticsPayload extends Properties {
76
90
  rectangleId?: string;
@@ -84,13 +98,25 @@ export declare class PostHogAdapter implements TelemetryClient {
84
98
  private client?;
85
99
  private featureFlagsCallback?;
86
100
  private captureCallback?;
87
- private consentUnsub?;
101
+ private rrwebCallback?;
88
102
  constructor(options?: PostHogAdapterOptions);
89
103
  /**
90
104
  * Initialize the PostHog client. Called immediately (no consent gate)
91
105
  * or deferred (when consent gate grants).
92
106
  */
93
107
  private initPostHog;
108
+ /**
109
+ * Set up rrweb event interception on PostHog's session recording.
110
+ *
111
+ * PostHog lazy-loads the rrweb recorder. The SessionRecording wrapper has
112
+ * an `onRRwebEmit` method, but rrweb delivers events directly to the
113
+ * lazy-loaded recorder instance's `onRRwebEmit`, bypassing the wrapper.
114
+ * We must find and patch the recorder instance, not the wrapper.
115
+ *
116
+ * The recorder instance is stored on a minified property of SessionRecording.
117
+ * We detect it by looking for an object with both `onRRwebEmit` and `start` methods.
118
+ */
119
+ private setupRRWebIntercept;
94
120
  /**
95
121
  * Get all feature flags from PostHog.
96
122
  * Used to extract segment membership flags (in_segment_*).
@@ -1,4 +1,5 @@
1
1
  export { createNoopClient } from './adapters/noop';
2
2
  export type { PostHogAdapterOptions } from './adapters/posthog';
3
3
  export { createPostHogClient } from './adapters/posthog';
4
+ export { InterventionTracker } from './InterventionTracker';
4
5
  export type { CanvasSurface, TelemetryClient } from './types';
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/vitest';
package/dist/token.d.ts CHANGED
@@ -20,6 +20,8 @@ export interface SyntroTokenPayload {
20
20
  f?: string;
21
21
  /** Fetcher-specific options (e.g., configId for cdn fetcher) */
22
22
  o?: Record<string, string>;
23
+ /** Geo worker URL (e.g., "https://dev-geo.syntrologie.com" for dev) */
24
+ g?: string;
23
25
  /** Debug mode - enables console logging (default: false) */
24
26
  d?: boolean;
25
27
  }
package/dist/version.d.ts CHANGED
@@ -10,4 +10,4 @@
10
10
  *
11
11
  * @since 2.0.0
12
12
  */
13
- export declare const SDK_VERSION = "2.8.0-canary.7";
13
+ export declare const SDK_VERSION = "2.8.0-canary.71";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syntrologie/runtime-sdk",
3
- "version": "2.8.0-canary.7",
3
+ "version": "2.8.0-canary.71",
4
4
  "description": "Syntrologie Runtime SDK for web experimentation and analytics",
5
5
  "license": "Proprietary",
6
6
  "private": false,
@@ -61,21 +61,16 @@
61
61
  "validate-config": "node ./scripts/validate-config.mjs",
62
62
  "typecheck": "tsc --noEmit -p tsconfig.build.json",
63
63
  "test": "vitest run",
64
- "prepublishOnly": "npm run clean && npm run build"
64
+ "strip-internal-deps": "node ./scripts/strip-internal-deps.mjs",
65
+ "prepublishOnly": "npm run clean && npm run build && npm run strip-internal-deps"
65
66
  },
66
67
  "dependencies": {
67
- "@floating-ui/dom": "^1.7.5",
68
+ "@floating-ui/dom": "1.7.5",
68
69
  "@growthbook/growthbook": "~1.6.2",
69
- "@growthbook/growthbook-react": "^1.6.4",
70
- "@syntrologie/adapt-chatbot": "2.8.0-canary.7",
71
- "@syntrologie/adapt-content": "2.8.0-canary.7",
72
- "@syntrologie/adapt-faq": "2.8.0-canary.7",
73
- "@syntrologie/adapt-gamification": "2.8.0-canary.7",
74
- "@syntrologie/adapt-nav": "2.8.0-canary.7",
75
- "@syntrologie/adapt-overlays": "2.8.0-canary.7",
76
- "lucide-react": "^0.576.0",
77
- "posthog-js": "~1.302.2",
78
- "zod": "^3.25.76"
70
+ "@growthbook/growthbook-react": "1.6.4",
71
+ "lucide-react": "0.576.0",
72
+ "posthog-js": "1.341.0",
73
+ "zod": "3.25.76"
79
74
  },
80
75
  "peerDependencies": {
81
76
  "react": ">=18.0.0",
@@ -86,21 +81,21 @@
86
81
  "@semantic-release/github": "~12.0.3",
87
82
  "@semantic-release/npm": "~13.1.3",
88
83
  "@syntro/design-system": "*",
89
- "@testing-library/dom": "^10.4.1",
90
- "@testing-library/jest-dom": "^6.9.1",
91
- "@testing-library/react": "^16.3.2",
92
- "@types/node": "^22.19.7",
93
- "@types/react": "^19.2.0",
94
- "@types/react-dom": "^19.2.0",
95
- "ajv": "^8.18.0",
96
- "ajv-formats": "^3.0.1",
97
- "esbuild": "^0.27.2",
98
- "jsdom": "^26.1.0",
99
- "react": "^19.2.0",
100
- "react-dom": "^19.2.0",
84
+ "@testing-library/dom": "10.4.1",
85
+ "@testing-library/jest-dom": "6.9.1",
86
+ "@testing-library/react": "16.3.2",
87
+ "@types/node": "22.19.7",
88
+ "@types/react": "19.2.14",
89
+ "@types/react-dom": "19.2.3",
90
+ "ajv": "8.18.0",
91
+ "ajv-formats": "3.0.1",
92
+ "esbuild": "0.27.2",
93
+ "jsdom": "26.1.0",
94
+ "react": "19.2.1",
95
+ "react-dom": "19.2.1",
101
96
  "semantic-release": "~25.0.3",
102
- "typescript": "^5.9.3",
103
- "vitest": "^4.0.18",
104
- "zod-to-json-schema": "^3.25.1"
97
+ "typescript": "5.9.3",
98
+ "vitest": "4.0.18",
99
+ "zod-to-json-schema": "3.25.1"
105
100
  }
106
101
  }