@syntrologie/runtime-sdk 2.8.0-canary.32 → 2.8.0-canary.34

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.
@@ -35,6 +35,16 @@ export type { SyntroInitOptions, SyntroInitResult } from './bootstrap-types';
35
35
  * @returns The initialized SDK components
36
36
  */
37
37
  declare function init(options: import('./bootstrap-types').SyntroInitOptions): Promise<import('./bootstrap-types').SyntroInitResult | undefined>;
38
+ /**
39
+ * Emit a custom event through the SDK.
40
+ *
41
+ * Events flow through the EventBus (tile notification rule matching)
42
+ * and PostHog (analytics). Event names must use the `app:` prefix.
43
+ *
44
+ * @param eventName - Event name (e.g., 'app:setup:sdk_connected')
45
+ * @param props - Optional event properties
46
+ */
47
+ declare function emit(eventName: string, props?: Record<string, unknown>): void;
38
48
  /**
39
49
  * The Syntro namespace for single-token initialization.
40
50
  */
@@ -42,6 +52,9 @@ export declare const Syntro: {
42
52
  init: typeof init;
43
53
  encodeToken: typeof encodeToken;
44
54
  decodeToken: typeof decodeToken;
55
+ events: {
56
+ emit: typeof emit;
57
+ };
45
58
  };
46
59
  declare global {
47
60
  interface Window {
@@ -3456,7 +3456,7 @@ function getAntiFlickerSnippet(config = {}) {
3456
3456
  }
3457
3457
 
3458
3458
  // src/version.ts
3459
- var SDK_VERSION = "2.8.0-canary.32";
3459
+ var SDK_VERSION = "2.8.0-canary.34";
3460
3460
 
3461
3461
  // src/types.ts
3462
3462
  var SDK_SCHEMA_VERSION = "2.0";
@@ -4032,9 +4032,9 @@ function createPostHogNormalizer(publishFn) {
4032
4032
 
4033
4033
  // ../event-processor/dist/detectors/focus-bounce.js
4034
4034
  var FocusBounceDetector = class {
4035
- constructor(config, emit) {
4035
+ constructor(config, emit2) {
4036
4036
  this.config = config;
4037
- this.emit = emit;
4037
+ this.emit = emit2;
4038
4038
  this.focused = /* @__PURE__ */ new Map();
4039
4039
  }
4040
4040
  ingest(raw) {
@@ -4074,9 +4074,9 @@ var FocusBounceDetector = class {
4074
4074
 
4075
4075
  // ../event-processor/dist/detectors/hesitation.js
4076
4076
  var HesitationDetector = class {
4077
- constructor(config, emit) {
4077
+ constructor(config, emit2) {
4078
4078
  this.config = config;
4079
- this.emit = emit;
4079
+ this.emit = emit2;
4080
4080
  this.anchorX = 0;
4081
4081
  this.anchorY = 0;
4082
4082
  this.anchorTs = 0;
@@ -4133,9 +4133,9 @@ var HesitationDetector = class {
4133
4133
 
4134
4134
  // ../event-processor/dist/detectors/hover.js
4135
4135
  var HoverTracker = class {
4136
- constructor(config, emit, elementResolver) {
4136
+ constructor(config, emit2, elementResolver) {
4137
4137
  this.config = config;
4138
- this.emit = emit;
4138
+ this.emit = emit2;
4139
4139
  this.elementResolver = elementResolver;
4140
4140
  this.currentElement = null;
4141
4141
  this.hoverStartTs = null;
@@ -4189,9 +4189,9 @@ function elementKey(el) {
4189
4189
 
4190
4190
  // ../event-processor/dist/detectors/idle.js
4191
4191
  var IdleDetector = class {
4192
- constructor(config, emit) {
4192
+ constructor(config, emit2) {
4193
4193
  this.config = config;
4194
- this.emit = emit;
4194
+ this.emit = emit2;
4195
4195
  this.lastActivityTs = null;
4196
4196
  this.emitted = false;
4197
4197
  }
@@ -4224,9 +4224,9 @@ var IdleDetector = class {
4224
4224
 
4225
4225
  // ../event-processor/dist/detectors/rage-click.js
4226
4226
  var RageClickDetector = class {
4227
- constructor(config, emit) {
4227
+ constructor(config, emit2) {
4228
4228
  this.config = config;
4229
- this.emit = emit;
4229
+ this.emit = emit2;
4230
4230
  this.clicks = [];
4231
4231
  }
4232
4232
  ingest(raw) {
@@ -4266,9 +4266,9 @@ var RageClickDetector = class {
4266
4266
 
4267
4267
  // ../event-processor/dist/detectors/scroll-thrash.js
4268
4268
  var ScrollThrashDetector = class {
4269
- constructor(config, emit) {
4269
+ constructor(config, emit2) {
4270
4270
  this.config = config;
4271
- this.emit = emit;
4271
+ this.emit = emit2;
4272
4272
  this.lastY = null;
4273
4273
  this.lastDirection = null;
4274
4274
  this.reversals = [];
@@ -4309,23 +4309,23 @@ var ScrollThrashDetector = class {
4309
4309
  function createEventProcessor(options) {
4310
4310
  const config = { ...DEFAULT_DETECTOR_CONFIG, ...options == null ? void 0 : options.config };
4311
4311
  const listeners = [];
4312
- function emit(event) {
4312
+ function emit2(event) {
4313
4313
  for (const cb of listeners)
4314
4314
  cb(event);
4315
4315
  }
4316
- const hesitation = new HesitationDetector(config, emit);
4317
- const rageClick = new RageClickDetector(config, emit);
4318
- const scrollThrash = new ScrollThrashDetector(config, emit);
4319
- const focusBounce = new FocusBounceDetector(config, emit);
4320
- const idle = new IdleDetector(config, emit);
4321
- const hover = new HoverTracker(config, emit, options == null ? void 0 : options.elementResolver);
4316
+ const hesitation = new HesitationDetector(config, emit2);
4317
+ const rageClick = new RageClickDetector(config, emit2);
4318
+ const scrollThrash = new ScrollThrashDetector(config, emit2);
4319
+ const focusBounce = new FocusBounceDetector(config, emit2);
4320
+ const idle = new IdleDetector(config, emit2);
4321
+ const hover = new HoverTracker(config, emit2, options == null ? void 0 : options.elementResolver);
4322
4322
  const clickAttrBuffer = [];
4323
4323
  return {
4324
4324
  ingest(raw) {
4325
4325
  if (raw.kind === "posthog") {
4326
4326
  const { kind: _, ...phEvent } = raw;
4327
4327
  if (shouldNormalizeEvent(phEvent)) {
4328
- emit(normalizePostHogEvent(phEvent));
4328
+ emit2(normalizePostHogEvent(phEvent));
4329
4329
  }
4330
4330
  } else if (raw.kind === "rrweb") {
4331
4331
  hesitation.ingest(raw);
@@ -5756,6 +5756,17 @@ function ShadowCanvasOverlay({
5756
5756
  }
5757
5757
  onToggle();
5758
5758
  }, [isOpen, telemetry, runtime3, onToggle]);
5759
+ useEffect7(() => {
5760
+ if (!isOpen) return;
5761
+ const handleOutsideClick = (e) => {
5762
+ const path = e.composedPath();
5763
+ if (containerRef.current && !path.includes(containerRef.current)) {
5764
+ toggle2();
5765
+ }
5766
+ };
5767
+ document.addEventListener("mousedown", handleOutsideClick);
5768
+ return () => document.removeEventListener("mousedown", handleOutsideClick);
5769
+ }, [isOpen, toggle2]);
5759
5770
  const onLauncherPointerDown = useCallback4((e) => {
5760
5771
  const rect = e.currentTarget.getBoundingClientRect();
5761
5772
  dragRef.current = {
@@ -5881,7 +5892,7 @@ function ShadowCanvasOverlay({
5881
5892
  style: {
5882
5893
  position: "fixed",
5883
5894
  inset: 0,
5884
- pointerEvents: isOpen ? "auto" : "none",
5895
+ pointerEvents: "none",
5885
5896
  zIndex
5886
5897
  },
5887
5898
  children: /* @__PURE__ */ jsxs3("div", { style: wrapperStyle, children: [
@@ -5954,17 +5965,7 @@ function ShadowCanvasOverlay({
5954
5965
  ) }),
5955
5966
  footerSlot
5956
5967
  ] }),
5957
- /* @__PURE__ */ jsx8(
5958
- "div",
5959
- {
5960
- onClick: toggle2,
5961
- style: {
5962
- flex: "1 1 auto",
5963
- pointerEvents: isOpen ? "auto" : "none",
5964
- cursor: "default"
5965
- }
5966
- }
5967
- )
5968
+ /* @__PURE__ */ jsx8("div", { style: { flex: "1 1 auto" } })
5968
5969
  ] })
5969
5970
  }
5970
5971
  );
@@ -12111,10 +12112,18 @@ async function init(options) {
12111
12112
  return void 0;
12112
12113
  }
12113
12114
  }
12115
+ function emit(eventName, props = {}) {
12116
+ var _a2, _b;
12117
+ if (typeof window === "undefined") return;
12118
+ const runtime3 = (_a2 = window.SynOS) == null ? void 0 : _a2.runtime;
12119
+ if (!((_b = runtime3 == null ? void 0 : runtime3.events) == null ? void 0 : _b.publish)) return;
12120
+ runtime3.events.publish({ name: eventName, source: "custom", props });
12121
+ }
12114
12122
  var Syntro = {
12115
12123
  init,
12116
12124
  encodeToken,
12117
- decodeToken
12125
+ decodeToken,
12126
+ events: { emit }
12118
12127
  };
12119
12128
  if (typeof window !== "undefined") {
12120
12129
  window.Syntro = Syntro;
@@ -12226,4 +12235,4 @@ export {
12226
12235
  encodeToken,
12227
12236
  Syntro
12228
12237
  };
12229
- //# sourceMappingURL=chunk-IDMFX5NB.js.map
12238
+ //# sourceMappingURL=chunk-VOIWA5BM.js.map