@syntrologie/runtime-sdk 2.8.0-canary.23 → 2.8.0-canary.24
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/{chunk-M3BRHRCI.js → chunk-UJFBG2NR.js} +542 -22
- package/dist/chunk-UJFBG2NR.js.map +7 -0
- package/dist/index.js +4 -8
- package/dist/index.js.map +3 -3
- package/dist/react.js +1 -1
- package/dist/smart-canvas.esm.js +2 -2
- package/dist/smart-canvas.esm.js.map +1 -1
- package/dist/smart-canvas.js +2 -2
- package/dist/smart-canvas.js.map +1 -1
- package/dist/smart-canvas.min.js +2 -2
- package/dist/smart-canvas.min.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +3 -9
- package/scripts/validate-config.mjs +19 -0
- package/dist/chunk-M3BRHRCI.js.map +0 -7
|
@@ -3439,7 +3439,7 @@ function getAntiFlickerSnippet(config = {}) {
|
|
|
3439
3439
|
}
|
|
3440
3440
|
|
|
3441
3441
|
// src/version.ts
|
|
3442
|
-
var SDK_VERSION = "2.8.0-canary.
|
|
3442
|
+
var SDK_VERSION = "2.8.0-canary.24";
|
|
3443
3443
|
|
|
3444
3444
|
// src/types.ts
|
|
3445
3445
|
var SDK_SCHEMA_VERSION = "2.0";
|
|
@@ -3816,9 +3816,529 @@ function useShadowRoot() {
|
|
|
3816
3816
|
return ctx;
|
|
3817
3817
|
}
|
|
3818
3818
|
|
|
3819
|
-
//
|
|
3820
|
-
|
|
3819
|
+
// ../event-processor/dist/types.js
|
|
3820
|
+
var EVENT_SCHEMA_VERSION = "1.0.0";
|
|
3821
3821
|
var StandardEvents = {
|
|
3822
|
+
UI_CLICK: "ui.click",
|
|
3823
|
+
UI_SCROLL: "ui.scroll",
|
|
3824
|
+
UI_INPUT: "ui.input",
|
|
3825
|
+
UI_CHANGE: "ui.change",
|
|
3826
|
+
UI_SUBMIT: "ui.submit",
|
|
3827
|
+
NAV_PAGE_VIEW: "nav.page_view",
|
|
3828
|
+
NAV_PAGE_LEAVE: "nav.page_leave",
|
|
3829
|
+
UI_HESITATE: "ui.hesitate",
|
|
3830
|
+
UI_RAGE_CLICK: "ui.rage_click",
|
|
3831
|
+
UI_SCROLL_THRASH: "ui.scroll_thrash",
|
|
3832
|
+
UI_FOCUS_BOUNCE: "ui.focus_bounce",
|
|
3833
|
+
UI_IDLE: "ui.idle",
|
|
3834
|
+
UI_HOVER: "ui.hover"
|
|
3835
|
+
};
|
|
3836
|
+
var RRWebSource = {
|
|
3837
|
+
Mutation: 0,
|
|
3838
|
+
MouseMove: 1,
|
|
3839
|
+
MouseInteraction: 2,
|
|
3840
|
+
Scroll: 3,
|
|
3841
|
+
ViewportResize: 4,
|
|
3842
|
+
Input: 5,
|
|
3843
|
+
TouchMove: 6,
|
|
3844
|
+
MediaInteraction: 7,
|
|
3845
|
+
Drag: 12
|
|
3846
|
+
};
|
|
3847
|
+
var RRWebMouseInteraction = {
|
|
3848
|
+
MouseUp: 0,
|
|
3849
|
+
MouseDown: 1,
|
|
3850
|
+
Click: 2,
|
|
3851
|
+
ContextMenu: 3,
|
|
3852
|
+
DblClick: 4,
|
|
3853
|
+
Focus: 5,
|
|
3854
|
+
Blur: 6,
|
|
3855
|
+
TouchStart: 7,
|
|
3856
|
+
TouchEnd: 9
|
|
3857
|
+
};
|
|
3858
|
+
var DEFAULT_DETECTOR_CONFIG = {
|
|
3859
|
+
hesitationMs: 3e3,
|
|
3860
|
+
hesitationRadiusPx: 10,
|
|
3861
|
+
rageClickCount: 3,
|
|
3862
|
+
rageClickWindowMs: 1e3,
|
|
3863
|
+
rageClickRadiusPx: 30,
|
|
3864
|
+
scrollThrashReversals: 3,
|
|
3865
|
+
scrollThrashWindowMs: 2e3,
|
|
3866
|
+
focusBounceMaxInputs: 0,
|
|
3867
|
+
idleMs: 5e3,
|
|
3868
|
+
hoverSampleMs: 100
|
|
3869
|
+
};
|
|
3870
|
+
|
|
3871
|
+
// ../event-processor/dist/normalizers/posthog.js
|
|
3872
|
+
var POSTHOG_EVENT_MAP = {
|
|
3873
|
+
// NOTE: $autocapture is intentionally NOT in this map.
|
|
3874
|
+
// It's handled below in getEventName() with $event_type refinement
|
|
3875
|
+
// so that change/submit events aren't all mapped to ui.click.
|
|
3876
|
+
$click: StandardEvents.UI_CLICK,
|
|
3877
|
+
$scroll: StandardEvents.UI_SCROLL,
|
|
3878
|
+
$input: StandardEvents.UI_INPUT,
|
|
3879
|
+
$change: StandardEvents.UI_CHANGE,
|
|
3880
|
+
$submit: StandardEvents.UI_SUBMIT,
|
|
3881
|
+
// Navigation events
|
|
3882
|
+
$pageview: StandardEvents.NAV_PAGE_VIEW,
|
|
3883
|
+
$pageleave: StandardEvents.NAV_PAGE_LEAVE,
|
|
3884
|
+
// Session events
|
|
3885
|
+
$session_start: "session.start",
|
|
3886
|
+
// Identify events
|
|
3887
|
+
$identify: "user.identify"
|
|
3888
|
+
};
|
|
3889
|
+
function getEventName(phEvent) {
|
|
3890
|
+
var _a2, _b;
|
|
3891
|
+
const eventName = phEvent.event;
|
|
3892
|
+
if (typeof eventName !== "string") {
|
|
3893
|
+
return "posthog.unknown";
|
|
3894
|
+
}
|
|
3895
|
+
if (POSTHOG_EVENT_MAP[eventName]) {
|
|
3896
|
+
return POSTHOG_EVENT_MAP[eventName];
|
|
3897
|
+
}
|
|
3898
|
+
if (eventName === "$autocapture") {
|
|
3899
|
+
const tagName = (_a2 = phEvent.properties) == null ? void 0 : _a2.$tag_name;
|
|
3900
|
+
const eventType = (_b = phEvent.properties) == null ? void 0 : _b.$event_type;
|
|
3901
|
+
if (eventType === "submit")
|
|
3902
|
+
return StandardEvents.UI_SUBMIT;
|
|
3903
|
+
if (eventType === "change")
|
|
3904
|
+
return StandardEvents.UI_CHANGE;
|
|
3905
|
+
if (tagName === "input" || tagName === "textarea")
|
|
3906
|
+
return StandardEvents.UI_INPUT;
|
|
3907
|
+
return StandardEvents.UI_CLICK;
|
|
3908
|
+
}
|
|
3909
|
+
if (!eventName.startsWith("$")) {
|
|
3910
|
+
return `posthog.${eventName}`;
|
|
3911
|
+
}
|
|
3912
|
+
return eventName.replace("$", "posthog.");
|
|
3913
|
+
}
|
|
3914
|
+
var INTERACTIVE_TAGS = /* @__PURE__ */ new Set(["a", "button", "input", "select", "textarea"]);
|
|
3915
|
+
function resolveInteractiveTag(elements, directTag) {
|
|
3916
|
+
if (directTag && INTERACTIVE_TAGS.has(directTag))
|
|
3917
|
+
return directTag;
|
|
3918
|
+
if (!elements)
|
|
3919
|
+
return directTag;
|
|
3920
|
+
for (const el of elements) {
|
|
3921
|
+
const tag2 = el.tag_name;
|
|
3922
|
+
if (tag2 && INTERACTIVE_TAGS.has(tag2))
|
|
3923
|
+
return tag2;
|
|
3924
|
+
}
|
|
3925
|
+
return directTag;
|
|
3926
|
+
}
|
|
3927
|
+
function extractProps(phEvent) {
|
|
3928
|
+
var _a2, _b;
|
|
3929
|
+
const props = {};
|
|
3930
|
+
const phProps = phEvent.properties || {};
|
|
3931
|
+
const elements = phProps.$elements;
|
|
3932
|
+
const directTag = (_b = phProps.$tag_name) != null ? _b : (_a2 = elements == null ? void 0 : elements[0]) == null ? void 0 : _a2.tag_name;
|
|
3933
|
+
const isClickEvent = phEvent.event === "$autocapture" || phEvent.event === "$click";
|
|
3934
|
+
props.tagName = isClickEvent ? resolveInteractiveTag(elements, directTag) : directTag;
|
|
3935
|
+
if (phProps.$el_text)
|
|
3936
|
+
props.elementText = phProps.$el_text;
|
|
3937
|
+
if (elements)
|
|
3938
|
+
props.elements = elements;
|
|
3939
|
+
if (phProps.$current_url)
|
|
3940
|
+
props.url = phProps.$current_url;
|
|
3941
|
+
if (phProps.$pathname)
|
|
3942
|
+
props.pathname = phProps.$pathname;
|
|
3943
|
+
if (phProps.$host)
|
|
3944
|
+
props.host = phProps.$host;
|
|
3945
|
+
if (phProps.$viewport_width)
|
|
3946
|
+
props.viewportWidth = phProps.$viewport_width;
|
|
3947
|
+
if (phProps.$viewport_height)
|
|
3948
|
+
props.viewportHeight = phProps.$viewport_height;
|
|
3949
|
+
if (phProps.$session_id)
|
|
3950
|
+
props.sessionId = phProps.$session_id;
|
|
3951
|
+
if (phProps.$scroll_depth)
|
|
3952
|
+
props.scrollDepth = phProps.$scroll_depth;
|
|
3953
|
+
if (phProps.$scroll_percentage)
|
|
3954
|
+
props.scrollPercentage = phProps.$scroll_percentage;
|
|
3955
|
+
props.originalEvent = phEvent.event;
|
|
3956
|
+
return props;
|
|
3957
|
+
}
|
|
3958
|
+
function normalizePostHogEvent(phEvent) {
|
|
3959
|
+
let ts;
|
|
3960
|
+
if (typeof phEvent.timestamp === "number") {
|
|
3961
|
+
ts = phEvent.timestamp;
|
|
3962
|
+
} else if (typeof phEvent.timestamp === "string") {
|
|
3963
|
+
ts = new Date(phEvent.timestamp).getTime();
|
|
3964
|
+
} else {
|
|
3965
|
+
ts = Date.now();
|
|
3966
|
+
}
|
|
3967
|
+
return {
|
|
3968
|
+
ts,
|
|
3969
|
+
name: getEventName(phEvent),
|
|
3970
|
+
source: "posthog",
|
|
3971
|
+
props: extractProps(phEvent),
|
|
3972
|
+
schemaVersion: EVENT_SCHEMA_VERSION
|
|
3973
|
+
};
|
|
3974
|
+
}
|
|
3975
|
+
function shouldNormalizeEvent(phEvent) {
|
|
3976
|
+
const eventName = phEvent.event;
|
|
3977
|
+
if (typeof eventName !== "string")
|
|
3978
|
+
return false;
|
|
3979
|
+
const skipEvents = [
|
|
3980
|
+
"$feature_flag_called",
|
|
3981
|
+
"$feature_flags",
|
|
3982
|
+
"$groups",
|
|
3983
|
+
"$groupidentify",
|
|
3984
|
+
"$set",
|
|
3985
|
+
"$set_once",
|
|
3986
|
+
"$unset",
|
|
3987
|
+
"$create_alias",
|
|
3988
|
+
"$capture_metrics",
|
|
3989
|
+
"$performance_event",
|
|
3990
|
+
"$web_vitals",
|
|
3991
|
+
"$exception",
|
|
3992
|
+
"$dead_click",
|
|
3993
|
+
"$heatmap"
|
|
3994
|
+
];
|
|
3995
|
+
if (skipEvents.includes(eventName)) {
|
|
3996
|
+
return false;
|
|
3997
|
+
}
|
|
3998
|
+
return true;
|
|
3999
|
+
}
|
|
4000
|
+
function createPostHogNormalizer(publishFn) {
|
|
4001
|
+
return (eventName, properties) => {
|
|
4002
|
+
if (typeof eventName !== "string")
|
|
4003
|
+
return;
|
|
4004
|
+
const phEvent = {
|
|
4005
|
+
event: eventName,
|
|
4006
|
+
properties,
|
|
4007
|
+
timestamp: Date.now()
|
|
4008
|
+
};
|
|
4009
|
+
if (shouldNormalizeEvent(phEvent)) {
|
|
4010
|
+
const normalizedEvent = normalizePostHogEvent(phEvent);
|
|
4011
|
+
publishFn(normalizedEvent);
|
|
4012
|
+
}
|
|
4013
|
+
};
|
|
4014
|
+
}
|
|
4015
|
+
|
|
4016
|
+
// ../event-processor/dist/detectors/focus-bounce.js
|
|
4017
|
+
var FocusBounceDetector = class {
|
|
4018
|
+
constructor(config, emit) {
|
|
4019
|
+
this.config = config;
|
|
4020
|
+
this.emit = emit;
|
|
4021
|
+
this.focused = /* @__PURE__ */ new Map();
|
|
4022
|
+
}
|
|
4023
|
+
ingest(raw) {
|
|
4024
|
+
var _a2, _b;
|
|
4025
|
+
if (raw.type !== 3)
|
|
4026
|
+
return;
|
|
4027
|
+
const ts = raw.timestamp;
|
|
4028
|
+
if (raw.data.source === RRWebSource.MouseInteraction) {
|
|
4029
|
+
const id = (_a2 = raw.data.id) != null ? _a2 : 0;
|
|
4030
|
+
if (raw.data.type === RRWebMouseInteraction.Focus) {
|
|
4031
|
+
this.focused.set(id, { id, focusTs: ts, inputCount: 0 });
|
|
4032
|
+
} else if (raw.data.type === RRWebMouseInteraction.Blur) {
|
|
4033
|
+
const entry = this.focused.get(id);
|
|
4034
|
+
if (entry && entry.inputCount <= this.config.focusBounceMaxInputs) {
|
|
4035
|
+
this.emit({
|
|
4036
|
+
ts,
|
|
4037
|
+
name: StandardEvents.UI_FOCUS_BOUNCE,
|
|
4038
|
+
source: "rrweb",
|
|
4039
|
+
schemaVersion: EVENT_SCHEMA_VERSION,
|
|
4040
|
+
props: {
|
|
4041
|
+
elementId: id,
|
|
4042
|
+
duration_ms: ts - entry.focusTs
|
|
4043
|
+
}
|
|
4044
|
+
});
|
|
4045
|
+
}
|
|
4046
|
+
this.focused.delete(id);
|
|
4047
|
+
}
|
|
4048
|
+
} else if (raw.data.source === RRWebSource.Input) {
|
|
4049
|
+
const id = (_b = raw.data.id) != null ? _b : 0;
|
|
4050
|
+
const entry = this.focused.get(id);
|
|
4051
|
+
if (entry) {
|
|
4052
|
+
entry.inputCount++;
|
|
4053
|
+
}
|
|
4054
|
+
}
|
|
4055
|
+
}
|
|
4056
|
+
};
|
|
4057
|
+
|
|
4058
|
+
// ../event-processor/dist/detectors/hesitation.js
|
|
4059
|
+
var HesitationDetector = class {
|
|
4060
|
+
constructor(config, emit) {
|
|
4061
|
+
this.config = config;
|
|
4062
|
+
this.emit = emit;
|
|
4063
|
+
this.anchorX = 0;
|
|
4064
|
+
this.anchorY = 0;
|
|
4065
|
+
this.anchorTs = 0;
|
|
4066
|
+
this.emitted = false;
|
|
4067
|
+
this.hasPosition = false;
|
|
4068
|
+
}
|
|
4069
|
+
ingest(raw) {
|
|
4070
|
+
var _a2;
|
|
4071
|
+
if (raw.type !== 3 || raw.data.source !== RRWebSource.MouseMove)
|
|
4072
|
+
return;
|
|
4073
|
+
const positions = raw.data.positions;
|
|
4074
|
+
if (!positions || positions.length === 0)
|
|
4075
|
+
return;
|
|
4076
|
+
const last = positions[positions.length - 1];
|
|
4077
|
+
const ts = raw.timestamp + ((_a2 = last.timeOffset) != null ? _a2 : 0);
|
|
4078
|
+
if (!this.hasPosition) {
|
|
4079
|
+
this.anchorX = last.x;
|
|
4080
|
+
this.anchorY = last.y;
|
|
4081
|
+
this.anchorTs = ts;
|
|
4082
|
+
this.hasPosition = true;
|
|
4083
|
+
this.emitted = false;
|
|
4084
|
+
return;
|
|
4085
|
+
}
|
|
4086
|
+
const dx = last.x - this.anchorX;
|
|
4087
|
+
const dy = last.y - this.anchorY;
|
|
4088
|
+
const dist = Math.sqrt(dx * dx + dy * dy);
|
|
4089
|
+
if (dist > this.config.hesitationRadiusPx) {
|
|
4090
|
+
this.anchorX = last.x;
|
|
4091
|
+
this.anchorY = last.y;
|
|
4092
|
+
this.anchorTs = ts;
|
|
4093
|
+
this.emitted = false;
|
|
4094
|
+
}
|
|
4095
|
+
}
|
|
4096
|
+
tick(now) {
|
|
4097
|
+
if (!this.hasPosition || this.emitted)
|
|
4098
|
+
return;
|
|
4099
|
+
const elapsed = now - this.anchorTs;
|
|
4100
|
+
if (elapsed >= this.config.hesitationMs) {
|
|
4101
|
+
this.emit({
|
|
4102
|
+
ts: now,
|
|
4103
|
+
name: StandardEvents.UI_HESITATE,
|
|
4104
|
+
source: "rrweb",
|
|
4105
|
+
schemaVersion: EVENT_SCHEMA_VERSION,
|
|
4106
|
+
props: {
|
|
4107
|
+
x: this.anchorX,
|
|
4108
|
+
y: this.anchorY,
|
|
4109
|
+
duration_ms: elapsed
|
|
4110
|
+
}
|
|
4111
|
+
});
|
|
4112
|
+
this.emitted = true;
|
|
4113
|
+
}
|
|
4114
|
+
}
|
|
4115
|
+
};
|
|
4116
|
+
|
|
4117
|
+
// ../event-processor/dist/detectors/hover.js
|
|
4118
|
+
var HoverTracker = class {
|
|
4119
|
+
constructor(config, emit, elementResolver) {
|
|
4120
|
+
this.config = config;
|
|
4121
|
+
this.emit = emit;
|
|
4122
|
+
this.elementResolver = elementResolver;
|
|
4123
|
+
this.currentElement = null;
|
|
4124
|
+
this.hoverStartTs = null;
|
|
4125
|
+
this.lastX = 0;
|
|
4126
|
+
this.lastY = 0;
|
|
4127
|
+
this.lastSampleTs = -Infinity;
|
|
4128
|
+
}
|
|
4129
|
+
ingest(raw) {
|
|
4130
|
+
if (raw.type !== 3 || raw.data.source !== RRWebSource.MouseMove)
|
|
4131
|
+
return;
|
|
4132
|
+
const positions = raw.data.positions;
|
|
4133
|
+
if (!positions || positions.length === 0)
|
|
4134
|
+
return;
|
|
4135
|
+
const last = positions[positions.length - 1];
|
|
4136
|
+
this.lastX = last.x;
|
|
4137
|
+
this.lastY = last.y;
|
|
4138
|
+
}
|
|
4139
|
+
tick(now) {
|
|
4140
|
+
if (!this.elementResolver)
|
|
4141
|
+
return;
|
|
4142
|
+
if (now - this.lastSampleTs < this.config.hoverSampleMs)
|
|
4143
|
+
return;
|
|
4144
|
+
this.lastSampleTs = now;
|
|
4145
|
+
const newElement = this.elementResolver(this.lastX, this.lastY);
|
|
4146
|
+
const newKey = newElement ? elementKey(newElement) : null;
|
|
4147
|
+
const currentKey = this.currentElement ? elementKey(this.currentElement) : null;
|
|
4148
|
+
if (newKey !== currentKey) {
|
|
4149
|
+
if (this.currentElement && this.hoverStartTs !== null) {
|
|
4150
|
+
this.emit({
|
|
4151
|
+
ts: now,
|
|
4152
|
+
name: StandardEvents.UI_HOVER,
|
|
4153
|
+
source: "rrweb",
|
|
4154
|
+
schemaVersion: EVENT_SCHEMA_VERSION,
|
|
4155
|
+
props: {
|
|
4156
|
+
x: this.lastX,
|
|
4157
|
+
y: this.lastY,
|
|
4158
|
+
duration_ms: now - this.hoverStartTs,
|
|
4159
|
+
element: this.currentElement
|
|
4160
|
+
}
|
|
4161
|
+
});
|
|
4162
|
+
}
|
|
4163
|
+
this.currentElement = newElement;
|
|
4164
|
+
this.hoverStartTs = now;
|
|
4165
|
+
}
|
|
4166
|
+
}
|
|
4167
|
+
};
|
|
4168
|
+
function elementKey(el) {
|
|
4169
|
+
var _a2, _b, _c;
|
|
4170
|
+
return `${(_a2 = el.tag_name) != null ? _a2 : ""}|${(_b = el.attr__id) != null ? _b : ""}|${((_c = el.classes) != null ? _c : []).join(",")}`;
|
|
4171
|
+
}
|
|
4172
|
+
|
|
4173
|
+
// ../event-processor/dist/detectors/idle.js
|
|
4174
|
+
var IdleDetector = class {
|
|
4175
|
+
constructor(config, emit) {
|
|
4176
|
+
this.config = config;
|
|
4177
|
+
this.emit = emit;
|
|
4178
|
+
this.lastActivityTs = null;
|
|
4179
|
+
this.emitted = false;
|
|
4180
|
+
}
|
|
4181
|
+
ingest(raw) {
|
|
4182
|
+
if (raw.type !== 3)
|
|
4183
|
+
return;
|
|
4184
|
+
const src = raw.data.source;
|
|
4185
|
+
if (src === RRWebSource.MouseMove || src === RRWebSource.MouseInteraction || src === RRWebSource.Scroll) {
|
|
4186
|
+
this.lastActivityTs = raw.timestamp;
|
|
4187
|
+
this.emitted = false;
|
|
4188
|
+
}
|
|
4189
|
+
}
|
|
4190
|
+
tick(now) {
|
|
4191
|
+
if (this.lastActivityTs === null || this.emitted)
|
|
4192
|
+
return;
|
|
4193
|
+
if (now - this.lastActivityTs >= this.config.idleMs) {
|
|
4194
|
+
this.emit({
|
|
4195
|
+
ts: now,
|
|
4196
|
+
name: StandardEvents.UI_IDLE,
|
|
4197
|
+
source: "rrweb",
|
|
4198
|
+
schemaVersion: EVENT_SCHEMA_VERSION,
|
|
4199
|
+
props: {
|
|
4200
|
+
idle_ms: now - this.lastActivityTs
|
|
4201
|
+
}
|
|
4202
|
+
});
|
|
4203
|
+
this.emitted = true;
|
|
4204
|
+
}
|
|
4205
|
+
}
|
|
4206
|
+
};
|
|
4207
|
+
|
|
4208
|
+
// ../event-processor/dist/detectors/rage-click.js
|
|
4209
|
+
var RageClickDetector = class {
|
|
4210
|
+
constructor(config, emit) {
|
|
4211
|
+
this.config = config;
|
|
4212
|
+
this.emit = emit;
|
|
4213
|
+
this.clicks = [];
|
|
4214
|
+
}
|
|
4215
|
+
ingest(raw) {
|
|
4216
|
+
var _a2, _b;
|
|
4217
|
+
if (raw.type !== 3 || raw.data.source !== RRWebSource.MouseInteraction)
|
|
4218
|
+
return;
|
|
4219
|
+
if (raw.data.type !== RRWebMouseInteraction.Click)
|
|
4220
|
+
return;
|
|
4221
|
+
const x = (_a2 = raw.data.x) != null ? _a2 : 0;
|
|
4222
|
+
const y = (_b = raw.data.y) != null ? _b : 0;
|
|
4223
|
+
const ts = raw.timestamp;
|
|
4224
|
+
const cutoff = ts - this.config.rageClickWindowMs;
|
|
4225
|
+
this.clicks = this.clicks.filter((c) => c.ts >= cutoff);
|
|
4226
|
+
this.clicks.push({ ts, x, y });
|
|
4227
|
+
const nearby = this.clicks.filter((c) => {
|
|
4228
|
+
const dx = c.x - x;
|
|
4229
|
+
const dy = c.y - y;
|
|
4230
|
+
return Math.sqrt(dx * dx + dy * dy) <= this.config.rageClickRadiusPx;
|
|
4231
|
+
});
|
|
4232
|
+
if (nearby.length >= this.config.rageClickCount) {
|
|
4233
|
+
this.emit({
|
|
4234
|
+
ts,
|
|
4235
|
+
name: StandardEvents.UI_RAGE_CLICK,
|
|
4236
|
+
source: "rrweb",
|
|
4237
|
+
schemaVersion: EVENT_SCHEMA_VERSION,
|
|
4238
|
+
props: {
|
|
4239
|
+
x,
|
|
4240
|
+
y,
|
|
4241
|
+
clickCount: nearby.length,
|
|
4242
|
+
duration_ms: ts - nearby[0].ts
|
|
4243
|
+
}
|
|
4244
|
+
});
|
|
4245
|
+
this.clicks = [];
|
|
4246
|
+
}
|
|
4247
|
+
}
|
|
4248
|
+
};
|
|
4249
|
+
|
|
4250
|
+
// ../event-processor/dist/detectors/scroll-thrash.js
|
|
4251
|
+
var ScrollThrashDetector = class {
|
|
4252
|
+
constructor(config, emit) {
|
|
4253
|
+
this.config = config;
|
|
4254
|
+
this.emit = emit;
|
|
4255
|
+
this.lastY = null;
|
|
4256
|
+
this.lastDirection = null;
|
|
4257
|
+
this.reversals = [];
|
|
4258
|
+
}
|
|
4259
|
+
ingest(raw) {
|
|
4260
|
+
var _a2;
|
|
4261
|
+
if (raw.type !== 3 || raw.data.source !== RRWebSource.Scroll)
|
|
4262
|
+
return;
|
|
4263
|
+
const y = (_a2 = raw.data.y) != null ? _a2 : 0;
|
|
4264
|
+
const ts = raw.timestamp;
|
|
4265
|
+
if (this.lastY !== null) {
|
|
4266
|
+
const direction = y > this.lastY ? "down" : y < this.lastY ? "up" : this.lastDirection;
|
|
4267
|
+
if (direction && direction !== this.lastDirection) {
|
|
4268
|
+
const cutoff = ts - this.config.scrollThrashWindowMs;
|
|
4269
|
+
this.reversals = this.reversals.filter((t) => t > cutoff);
|
|
4270
|
+
this.reversals.push(ts);
|
|
4271
|
+
if (this.reversals.length >= this.config.scrollThrashReversals) {
|
|
4272
|
+
this.emit({
|
|
4273
|
+
ts,
|
|
4274
|
+
name: StandardEvents.UI_SCROLL_THRASH,
|
|
4275
|
+
source: "rrweb",
|
|
4276
|
+
schemaVersion: EVENT_SCHEMA_VERSION,
|
|
4277
|
+
props: {
|
|
4278
|
+
reversals: this.reversals.length,
|
|
4279
|
+
duration_ms: ts - this.reversals[0]
|
|
4280
|
+
}
|
|
4281
|
+
});
|
|
4282
|
+
this.reversals = [];
|
|
4283
|
+
}
|
|
4284
|
+
}
|
|
4285
|
+
this.lastDirection = direction;
|
|
4286
|
+
}
|
|
4287
|
+
this.lastY = y;
|
|
4288
|
+
}
|
|
4289
|
+
};
|
|
4290
|
+
|
|
4291
|
+
// ../event-processor/dist/processor.js
|
|
4292
|
+
function createEventProcessor(options) {
|
|
4293
|
+
const config = { ...DEFAULT_DETECTOR_CONFIG, ...options == null ? void 0 : options.config };
|
|
4294
|
+
const listeners = [];
|
|
4295
|
+
function emit(event) {
|
|
4296
|
+
for (const cb of listeners)
|
|
4297
|
+
cb(event);
|
|
4298
|
+
}
|
|
4299
|
+
const hesitation = new HesitationDetector(config, emit);
|
|
4300
|
+
const rageClick = new RageClickDetector(config, emit);
|
|
4301
|
+
const scrollThrash = new ScrollThrashDetector(config, emit);
|
|
4302
|
+
const focusBounce = new FocusBounceDetector(config, emit);
|
|
4303
|
+
const idle = new IdleDetector(config, emit);
|
|
4304
|
+
const hover = new HoverTracker(config, emit, options == null ? void 0 : options.elementResolver);
|
|
4305
|
+
const clickAttrBuffer = [];
|
|
4306
|
+
return {
|
|
4307
|
+
ingest(raw) {
|
|
4308
|
+
if (raw.kind === "posthog") {
|
|
4309
|
+
const { kind: _, ...phEvent } = raw;
|
|
4310
|
+
if (shouldNormalizeEvent(phEvent)) {
|
|
4311
|
+
emit(normalizePostHogEvent(phEvent));
|
|
4312
|
+
}
|
|
4313
|
+
} else if (raw.kind === "rrweb") {
|
|
4314
|
+
hesitation.ingest(raw);
|
|
4315
|
+
rageClick.ingest(raw);
|
|
4316
|
+
scrollThrash.ingest(raw);
|
|
4317
|
+
focusBounce.ingest(raw);
|
|
4318
|
+
idle.ingest(raw);
|
|
4319
|
+
hover.ingest(raw);
|
|
4320
|
+
}
|
|
4321
|
+
},
|
|
4322
|
+
onEvent(callback) {
|
|
4323
|
+
listeners.push(callback);
|
|
4324
|
+
},
|
|
4325
|
+
tick(timestamp) {
|
|
4326
|
+
hesitation.tick(timestamp);
|
|
4327
|
+
idle.tick(timestamp);
|
|
4328
|
+
hover.tick(timestamp);
|
|
4329
|
+
},
|
|
4330
|
+
enrichClickAttributes(timestamp, elements) {
|
|
4331
|
+
clickAttrBuffer.push({ ts: timestamp, elements });
|
|
4332
|
+
const cutoff = timestamp - 500;
|
|
4333
|
+
while (clickAttrBuffer.length > 0 && clickAttrBuffer[0].ts < cutoff) {
|
|
4334
|
+
clickAttrBuffer.shift();
|
|
4335
|
+
}
|
|
4336
|
+
}
|
|
4337
|
+
};
|
|
4338
|
+
}
|
|
4339
|
+
|
|
4340
|
+
// src/events/types.ts
|
|
4341
|
+
var StandardEvents2 = {
|
|
3822
4342
|
// UI events (from PostHog autocapture)
|
|
3823
4343
|
UI_CLICK: "ui.click",
|
|
3824
4344
|
UI_SCROLL: "ui.scroll",
|
|
@@ -3870,48 +4390,48 @@ function createCanvasEvent(name, props) {
|
|
|
3870
4390
|
};
|
|
3871
4391
|
}
|
|
3872
4392
|
function canvasOpened(surface) {
|
|
3873
|
-
return createCanvasEvent(
|
|
4393
|
+
return createCanvasEvent(StandardEvents2.CANVAS_OPENED, { surface });
|
|
3874
4394
|
}
|
|
3875
4395
|
function canvasClosed(surface) {
|
|
3876
|
-
return createCanvasEvent(
|
|
4396
|
+
return createCanvasEvent(StandardEvents2.CANVAS_CLOSED, { surface });
|
|
3877
4397
|
}
|
|
3878
4398
|
function tileViewed(tileId, surface) {
|
|
3879
|
-
return createCanvasEvent(
|
|
4399
|
+
return createCanvasEvent(StandardEvents2.TILE_VIEWED, { tileId, surface });
|
|
3880
4400
|
}
|
|
3881
4401
|
function tileExpanded(tileId, surface) {
|
|
3882
|
-
return createCanvasEvent(
|
|
4402
|
+
return createCanvasEvent(StandardEvents2.TILE_EXPANDED, { tileId, surface });
|
|
3883
4403
|
}
|
|
3884
4404
|
function tileCollapsed(tileId, surface) {
|
|
3885
|
-
return createCanvasEvent(
|
|
4405
|
+
return createCanvasEvent(StandardEvents2.TILE_COLLAPSED, { tileId, surface });
|
|
3886
4406
|
}
|
|
3887
4407
|
function tileAction(tileId, actionId, surface) {
|
|
3888
|
-
return createCanvasEvent(
|
|
4408
|
+
return createCanvasEvent(StandardEvents2.TILE_ACTION, {
|
|
3889
4409
|
tileId,
|
|
3890
4410
|
actionId,
|
|
3891
4411
|
surface
|
|
3892
4412
|
});
|
|
3893
4413
|
}
|
|
3894
4414
|
function overlayStarted(recipeId, recipeName) {
|
|
3895
|
-
return createCanvasEvent(
|
|
4415
|
+
return createCanvasEvent(StandardEvents2.OVERLAY_STARTED, {
|
|
3896
4416
|
recipeId,
|
|
3897
4417
|
recipeName
|
|
3898
4418
|
});
|
|
3899
4419
|
}
|
|
3900
4420
|
function overlayCompleted(recipeId, recipeName) {
|
|
3901
|
-
return createCanvasEvent(
|
|
4421
|
+
return createCanvasEvent(StandardEvents2.OVERLAY_COMPLETED, {
|
|
3902
4422
|
recipeId,
|
|
3903
4423
|
recipeName
|
|
3904
4424
|
});
|
|
3905
4425
|
}
|
|
3906
4426
|
function overlayDismissed(recipeId, recipeName, stepIndex) {
|
|
3907
|
-
return createCanvasEvent(
|
|
4427
|
+
return createCanvasEvent(StandardEvents2.OVERLAY_DISMISSED, {
|
|
3908
4428
|
recipeId,
|
|
3909
4429
|
recipeName,
|
|
3910
4430
|
stepIndex
|
|
3911
4431
|
});
|
|
3912
4432
|
}
|
|
3913
4433
|
function overlayStepViewed(recipeId, stepIndex, stepTitle) {
|
|
3914
|
-
return createCanvasEvent(
|
|
4434
|
+
return createCanvasEvent(StandardEvents2.OVERLAY_STEP_VIEWED, {
|
|
3915
4435
|
recipeId,
|
|
3916
4436
|
stepIndex,
|
|
3917
4437
|
stepTitle
|
|
@@ -4237,7 +4757,7 @@ function useNotifications(eventBus, tiles) {
|
|
|
4237
4757
|
const timerIds = useRef2(/* @__PURE__ */ new Map());
|
|
4238
4758
|
const publishDismissed = useCallback2(
|
|
4239
4759
|
(notif) => {
|
|
4240
|
-
eventBus == null ? void 0 : eventBus.publish(
|
|
4760
|
+
eventBus == null ? void 0 : eventBus.publish(StandardEvents2.NOTIFICATION_DISMISSED, {
|
|
4241
4761
|
notificationId: notif.id,
|
|
4242
4762
|
tileId: notif.tileId,
|
|
4243
4763
|
itemId: notif.itemId
|
|
@@ -4302,7 +4822,7 @@ function useNotifications(eventBus, tiles) {
|
|
|
4302
4822
|
}
|
|
4303
4823
|
return next;
|
|
4304
4824
|
});
|
|
4305
|
-
eventBus.publish(
|
|
4825
|
+
eventBus.publish(StandardEvents2.NOTIFICATION_SHOWN, {
|
|
4306
4826
|
notificationId: matched.id,
|
|
4307
4827
|
tileId: matched.tileId,
|
|
4308
4828
|
itemId: matched.itemId,
|
|
@@ -5136,7 +5656,7 @@ function ShadowCanvasOverlay({
|
|
|
5136
5656
|
const handleNotificationClick = useCallback4(
|
|
5137
5657
|
(notif) => {
|
|
5138
5658
|
if (runtime3) {
|
|
5139
|
-
runtime3.events.publish(
|
|
5659
|
+
runtime3.events.publish(StandardEvents2.NOTIFICATION_CLICKED, {
|
|
5140
5660
|
notificationId: notif.id,
|
|
5141
5661
|
tileId: notif.tileId,
|
|
5142
5662
|
itemId: notif.itemId
|
|
@@ -5146,7 +5666,7 @@ function ShadowCanvasOverlay({
|
|
|
5146
5666
|
onToggle();
|
|
5147
5667
|
}
|
|
5148
5668
|
if (runtime3 && notif.tileId) {
|
|
5149
|
-
runtime3.events.publish(
|
|
5669
|
+
runtime3.events.publish(StandardEvents2.NOTIFICATION_DEEP_LINK, {
|
|
5150
5670
|
tileId: notif.tileId,
|
|
5151
5671
|
itemId: notif.itemId
|
|
5152
5672
|
});
|
|
@@ -10654,9 +11174,6 @@ function encodeToken(payload) {
|
|
|
10654
11174
|
return TOKEN_PREFIX + base64;
|
|
10655
11175
|
}
|
|
10656
11176
|
|
|
10657
|
-
// src/bootstrap.ts
|
|
10658
|
-
import { createEventProcessor } from "@syntrologie/event-processor";
|
|
10659
|
-
|
|
10660
11177
|
// src/experiments/registry.ts
|
|
10661
11178
|
var adapters = {
|
|
10662
11179
|
growthbook: (config) => createGrowthBookClient({
|
|
@@ -11369,8 +11886,11 @@ export {
|
|
|
11369
11886
|
createSmartCanvasController,
|
|
11370
11887
|
ShadowRootProvider,
|
|
11371
11888
|
useShadowRoot,
|
|
11372
|
-
StandardEvents,
|
|
11373
11889
|
EVENT_SCHEMA_VERSION,
|
|
11890
|
+
normalizePostHogEvent,
|
|
11891
|
+
shouldNormalizeEvent,
|
|
11892
|
+
createPostHogNormalizer,
|
|
11893
|
+
StandardEvents2 as StandardEvents,
|
|
11374
11894
|
CanvasEvents,
|
|
11375
11895
|
NotificationToastStack,
|
|
11376
11896
|
MAX_VISIBLE_TOASTS,
|
|
@@ -11444,4 +11964,4 @@ export {
|
|
|
11444
11964
|
encodeToken,
|
|
11445
11965
|
Syntro
|
|
11446
11966
|
};
|
|
11447
|
-
//# sourceMappingURL=chunk-
|
|
11967
|
+
//# sourceMappingURL=chunk-UJFBG2NR.js.map
|