@amplitude/session-replay-browser 1.52.0-codexsemantic-review-integration.0 → 1.52.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/lib/cjs/config/joined-config.d.ts +1 -0
- package/lib/cjs/config/joined-config.d.ts.map +1 -1
- package/lib/cjs/config/joined-config.js +10 -1
- package/lib/cjs/config/joined-config.js.map +1 -1
- package/lib/cjs/config/local-config.d.ts +3 -3
- package/lib/cjs/config/local-config.d.ts.map +1 -1
- package/lib/cjs/config/local-config.js +5 -3
- package/lib/cjs/config/local-config.js.map +1 -1
- package/lib/cjs/config/types.d.ts +17 -9
- package/lib/cjs/config/types.d.ts.map +1 -1
- package/lib/cjs/config/types.js.map +1 -1
- package/lib/cjs/helpers.d.ts.map +1 -1
- package/lib/cjs/helpers.js +7 -4
- package/lib/cjs/helpers.js.map +1 -1
- package/lib/cjs/hooks/click.d.ts +2 -8
- package/lib/cjs/hooks/click.d.ts.map +1 -1
- package/lib/cjs/hooks/click.js +3 -42
- package/lib/cjs/hooks/click.js.map +1 -1
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/plugins/url-tracking-plugin.d.ts +0 -3
- package/lib/cjs/plugins/url-tracking-plugin.d.ts.map +1 -1
- package/lib/cjs/plugins/url-tracking-plugin.js +9 -16
- package/lib/cjs/plugins/url-tracking-plugin.js.map +1 -1
- package/lib/cjs/semantic-identity.d.ts +1 -1
- package/lib/cjs/semantic-identity.d.ts.map +1 -1
- package/lib/cjs/semantic-identity.js +4 -3
- package/lib/cjs/semantic-identity.js.map +1 -1
- package/lib/cjs/semantic-types.d.ts +45 -0
- package/lib/cjs/semantic-types.d.ts.map +1 -0
- package/lib/cjs/semantic-types.js +3 -0
- package/lib/cjs/semantic-types.js.map +1 -0
- package/lib/cjs/semantic.d.ts +9 -12
- package/lib/cjs/semantic.d.ts.map +1 -1
- package/lib/cjs/semantic.js +17 -90
- package/lib/cjs/semantic.js.map +1 -1
- package/lib/cjs/session-replay.d.ts +39 -2
- package/lib/cjs/session-replay.d.ts.map +1 -1
- package/lib/cjs/session-replay.js +267 -132
- package/lib/cjs/session-replay.js.map +1 -1
- package/lib/cjs/utils/rrweb.d.ts +0 -3
- package/lib/cjs/utils/rrweb.d.ts.map +1 -1
- package/lib/cjs/utils/rrweb.js.map +1 -1
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.d.ts.map +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/cjs/version.js.map +1 -1
- package/lib/cjs/window-focus.d.ts +40 -0
- package/lib/cjs/window-focus.d.ts.map +1 -0
- package/lib/cjs/window-focus.js +182 -0
- package/lib/cjs/window-focus.js.map +1 -0
- package/lib/esm/config/joined-config.d.ts +1 -0
- package/lib/esm/config/joined-config.d.ts.map +1 -1
- package/lib/esm/config/joined-config.js +10 -1
- package/lib/esm/config/joined-config.js.map +1 -1
- package/lib/esm/config/local-config.d.ts +3 -3
- package/lib/esm/config/local-config.d.ts.map +1 -1
- package/lib/esm/config/local-config.js +5 -3
- package/lib/esm/config/local-config.js.map +1 -1
- package/lib/esm/config/types.d.ts +17 -9
- package/lib/esm/config/types.d.ts.map +1 -1
- package/lib/esm/config/types.js.map +1 -1
- package/lib/esm/helpers.d.ts.map +1 -1
- package/lib/esm/helpers.js +8 -5
- package/lib/esm/helpers.js.map +1 -1
- package/lib/esm/hooks/click.d.ts +2 -8
- package/lib/esm/hooks/click.d.ts.map +1 -1
- package/lib/esm/hooks/click.js +3 -42
- package/lib/esm/hooks/click.js.map +1 -1
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/plugins/url-tracking-plugin.d.ts +0 -3
- package/lib/esm/plugins/url-tracking-plugin.d.ts.map +1 -1
- package/lib/esm/plugins/url-tracking-plugin.js +9 -16
- package/lib/esm/plugins/url-tracking-plugin.js.map +1 -1
- package/lib/esm/semantic-identity.d.ts +1 -1
- package/lib/esm/semantic-identity.d.ts.map +1 -1
- package/lib/esm/semantic-identity.js +4 -3
- package/lib/esm/semantic-identity.js.map +1 -1
- package/lib/esm/semantic-types.d.ts +45 -0
- package/lib/esm/semantic-types.d.ts.map +1 -0
- package/lib/esm/semantic-types.js +2 -0
- package/lib/esm/semantic-types.js.map +1 -0
- package/lib/esm/semantic.d.ts +9 -12
- package/lib/esm/semantic.d.ts.map +1 -1
- package/lib/esm/semantic.js +17 -90
- package/lib/esm/semantic.js.map +1 -1
- package/lib/esm/session-replay.d.ts +39 -2
- package/lib/esm/session-replay.d.ts.map +1 -1
- package/lib/esm/session-replay.js +267 -132
- package/lib/esm/session-replay.js.map +1 -1
- package/lib/esm/utils/rrweb.d.ts +0 -3
- package/lib/esm/utils/rrweb.d.ts.map +1 -1
- package/lib/esm/utils/rrweb.js.map +1 -1
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.d.ts.map +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/esm/version.js.map +1 -1
- package/lib/esm/window-focus.d.ts +40 -0
- package/lib/esm/window-focus.d.ts.map +1 -0
- package/lib/esm/window-focus.js +179 -0
- package/lib/esm/window-focus.js.map +1 -0
- package/lib/scripts/index-min.js +1 -1
- package/lib/scripts/index-min.js.gz +0 -0
- package/lib/scripts/index-min.js.map +1 -1
- package/lib/scripts/session-replay-browser-min.js +1 -1
- package/lib/scripts/session-replay-browser-min.js.gz +0 -0
- package/lib/scripts/session-replay-browser-min.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WindowFocusTracker = void 0;
|
|
4
|
+
var analytics_core_1 = require("@amplitude/analytics-core");
|
|
5
|
+
/**
|
|
6
|
+
* Decides when focus arrived from outside this window.
|
|
7
|
+
*
|
|
8
|
+
* A blur whose next frame lands on an iframe stayed in this page. Anything else
|
|
9
|
+
* left the window. The parent is already blurred once an iframe is focused, so
|
|
10
|
+
* that iframe's window is watched too: moving into a nested frame is not a
|
|
11
|
+
* leave, and moving from the frame to another visible window is.
|
|
12
|
+
*/
|
|
13
|
+
var WindowFocusTracker = /** @class */ (function () {
|
|
14
|
+
function WindowFocusTracker() {
|
|
15
|
+
this.focusLeftWindow = false;
|
|
16
|
+
}
|
|
17
|
+
/** Call from the window `blur` listener. `activeElement` is not updated yet. */
|
|
18
|
+
WindowFocusTracker.prototype.noteBlur = function () {
|
|
19
|
+
var _this = this;
|
|
20
|
+
this.focusLeftWindow = false;
|
|
21
|
+
this.cancelFocusDestinationCheck();
|
|
22
|
+
var scope = (0, analytics_core_1.getGlobalScope)();
|
|
23
|
+
this.scheduleFocusInspect(scope, function () {
|
|
24
|
+
var _a;
|
|
25
|
+
var active = (_a = scope === null || scope === void 0 ? void 0 : scope.document) === null || _a === void 0 ? void 0 : _a.activeElement;
|
|
26
|
+
if ((active === null || active === void 0 ? void 0 : active.tagName) === 'IFRAME') {
|
|
27
|
+
_this.watchFocusedFrame(active);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
_this.releaseFocusedFrame();
|
|
31
|
+
_this.focusLeftWindow = true;
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
/** The document hid. Drop the iframe watcher; visibility owns the checkout. */
|
|
35
|
+
WindowFocusTracker.prototype.onDocumentHidden = function () {
|
|
36
|
+
this.releaseFocusedFrame();
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* The document was shown. Drop the external-focus flag so the focus event
|
|
40
|
+
* that follows a tab return does not take a second checkout.
|
|
41
|
+
*/
|
|
42
|
+
WindowFocusTracker.prototype.onDocumentVisible = function () {
|
|
43
|
+
this.focusLeftWindow = false;
|
|
44
|
+
this.cancelFocusDestinationCheck();
|
|
45
|
+
this.releaseFocusedFrame();
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Call from the window `focus` listener. True when focus arrived from outside
|
|
49
|
+
* this window while the document stayed visible.
|
|
50
|
+
*/
|
|
51
|
+
WindowFocusTracker.prototype.consumeArrivedFromOutside = function () {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
var arrivedFromOutside = this.focusLeftWindow && ((_b = (_a = (0, analytics_core_1.getGlobalScope)()) === null || _a === void 0 ? void 0 : _a.document) === null || _b === void 0 ? void 0 : _b.visibilityState) === 'visible';
|
|
54
|
+
this.focusLeftWindow = false;
|
|
55
|
+
this.releaseFocusedFrame();
|
|
56
|
+
return arrivedFromOutside;
|
|
57
|
+
};
|
|
58
|
+
WindowFocusTracker.prototype.stop = function () {
|
|
59
|
+
this.focusLeftWindow = false;
|
|
60
|
+
this.cancelFocusDestinationCheck();
|
|
61
|
+
this.releaseFocusedFrame();
|
|
62
|
+
};
|
|
63
|
+
WindowFocusTracker.prototype.noteFrameBlur = function () {
|
|
64
|
+
var _this = this;
|
|
65
|
+
this.cancelFocusDestinationCheck();
|
|
66
|
+
var scope = (0, analytics_core_1.getGlobalScope)();
|
|
67
|
+
this.scheduleFocusInspect(scope, function () {
|
|
68
|
+
var _a;
|
|
69
|
+
var active = (_a = scope === null || scope === void 0 ? void 0 : scope.document) === null || _a === void 0 ? void 0 : _a.activeElement;
|
|
70
|
+
var parentDocument = scope === null || scope === void 0 ? void 0 : scope.document;
|
|
71
|
+
var parentHasFocus = typeof (parentDocument === null || parentDocument === void 0 ? void 0 : parentDocument.hasFocus) === 'function' && parentDocument.hasFocus();
|
|
72
|
+
if (parentHasFocus || (active === null || active === void 0 ? void 0 : active.tagName) !== 'IFRAME') {
|
|
73
|
+
_this.releaseFocusedFrame();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
var holder = _this.focusHolder(active);
|
|
77
|
+
if (holder) {
|
|
78
|
+
_this.watchFocusedFrame(holder);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
_this.focusLeftWindow = true;
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* The iframe that still holds focus, walking into nested frames. Undefined means
|
|
86
|
+
* the frame's document is visible and neither it nor a child frame is focused.
|
|
87
|
+
*/
|
|
88
|
+
WindowFocusTracker.prototype.focusHolder = function (frame, seen) {
|
|
89
|
+
if (seen === null || seen === void 0 ? void 0 : seen.has(frame)) {
|
|
90
|
+
return frame;
|
|
91
|
+
}
|
|
92
|
+
var visited = seen !== null && seen !== void 0 ? seen : new Set();
|
|
93
|
+
visited.add(frame);
|
|
94
|
+
var doc;
|
|
95
|
+
try {
|
|
96
|
+
doc = frame.contentDocument;
|
|
97
|
+
}
|
|
98
|
+
catch (_a) {
|
|
99
|
+
// A cross-origin frame is still part of this page.
|
|
100
|
+
return frame;
|
|
101
|
+
}
|
|
102
|
+
if (doc == null) {
|
|
103
|
+
return frame;
|
|
104
|
+
}
|
|
105
|
+
if (typeof doc.hasFocus === 'function' && doc.hasFocus()) {
|
|
106
|
+
return frame;
|
|
107
|
+
}
|
|
108
|
+
var inner = doc.activeElement;
|
|
109
|
+
if ((inner === null || inner === void 0 ? void 0 : inner.tagName) === 'IFRAME') {
|
|
110
|
+
return this.focusHolder(inner, visited);
|
|
111
|
+
}
|
|
112
|
+
return undefined;
|
|
113
|
+
};
|
|
114
|
+
WindowFocusTracker.prototype.watchFocusedFrame = function (frame) {
|
|
115
|
+
var _this = this;
|
|
116
|
+
this.releaseFocusedFrame();
|
|
117
|
+
var child;
|
|
118
|
+
var onBlur = function () {
|
|
119
|
+
_this.noteFrameBlur();
|
|
120
|
+
};
|
|
121
|
+
try {
|
|
122
|
+
child = frame.contentWindow;
|
|
123
|
+
// Reading `addEventListener` on a cross-origin Window throws a SecurityError.
|
|
124
|
+
if (child == null || typeof child.addEventListener !== 'function') {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
child.addEventListener('blur', onBlur);
|
|
128
|
+
}
|
|
129
|
+
catch (_a) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
this.focusedFrameWindow = child;
|
|
133
|
+
this.focusedFrameBlur = onBlur;
|
|
134
|
+
};
|
|
135
|
+
WindowFocusTracker.prototype.releaseFocusedFrame = function () {
|
|
136
|
+
var child = this.focusedFrameWindow;
|
|
137
|
+
var onBlur = this.focusedFrameBlur;
|
|
138
|
+
this.focusedFrameWindow = undefined;
|
|
139
|
+
this.focusedFrameBlur = undefined;
|
|
140
|
+
if (child === undefined) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
try {
|
|
144
|
+
child.removeEventListener('blur', onBlur);
|
|
145
|
+
}
|
|
146
|
+
catch (_a) {
|
|
147
|
+
// The frame can reject listener removal once it is cross-origin.
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
WindowFocusTracker.prototype.scheduleFocusInspect = function (scope, inspect) {
|
|
151
|
+
var _this = this;
|
|
152
|
+
var run = function () {
|
|
153
|
+
_this.focusDestinationFrame = undefined;
|
|
154
|
+
try {
|
|
155
|
+
inspect();
|
|
156
|
+
}
|
|
157
|
+
catch (_a) {
|
|
158
|
+
// This runs from a rAF callback, so a throw would surface as an uncaught
|
|
159
|
+
// error on the host page. Focus tracking is best effort: stop watching.
|
|
160
|
+
_this.releaseFocusedFrame();
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
if (typeof (scope === null || scope === void 0 ? void 0 : scope.requestAnimationFrame) === 'function') {
|
|
164
|
+
this.focusDestinationFrame = scope.requestAnimationFrame(run);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
run();
|
|
168
|
+
};
|
|
169
|
+
WindowFocusTracker.prototype.cancelFocusDestinationCheck = function () {
|
|
170
|
+
if (this.focusDestinationFrame === undefined) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
var scope = (0, analytics_core_1.getGlobalScope)();
|
|
174
|
+
if (typeof (scope === null || scope === void 0 ? void 0 : scope.cancelAnimationFrame) === 'function') {
|
|
175
|
+
scope.cancelAnimationFrame(this.focusDestinationFrame);
|
|
176
|
+
}
|
|
177
|
+
this.focusDestinationFrame = undefined;
|
|
178
|
+
};
|
|
179
|
+
return WindowFocusTracker;
|
|
180
|
+
}());
|
|
181
|
+
exports.WindowFocusTracker = WindowFocusTracker;
|
|
182
|
+
//# sourceMappingURL=window-focus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"window-focus.js","sourceRoot":"","sources":["../../src/window-focus.ts"],"names":[],"mappings":";;;AAAA,4DAA2D;AAE3D;;;;;;;GAOG;AACH;IAAA;QACU,oBAAe,GAAG,KAAK,CAAC;IAsKlC,CAAC;IAjKC,gFAAgF;IAChF,qCAAQ,GAAR;QAAA,iBAaC;QAZC,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAC7B,IAAI,CAAC,2BAA2B,EAAE,CAAC;QACnC,IAAM,KAAK,GAAG,IAAA,+BAAc,GAAE,CAAC;QAC/B,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE;;YAC/B,IAAM,MAAM,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,0CAAE,aAAa,CAAC;YAC9C,IAAI,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,MAAK,QAAQ,EAAE;gBAChC,KAAI,CAAC,iBAAiB,CAAC,MAA2B,CAAC,CAAC;gBACpD,OAAO;aACR;YACD,KAAI,CAAC,mBAAmB,EAAE,CAAC;YAC3B,KAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC9B,CAAC,CAAC,CAAC;IACL,CAAC;IAED,+EAA+E;IAC/E,6CAAgB,GAAhB;QACE,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACH,8CAAiB,GAAjB;QACE,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAC7B,IAAI,CAAC,2BAA2B,EAAE,CAAC;QACnC,IAAI,CAAC,mBAAmB,EAAE,CAAC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;YAC5C,OAAO;SACR;QACD,IAAM,KAAK,GAAG,IAAA,+BAAc,GAAE,CAAC;QAC/B,IAAI,OAAO,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,oBAAoB,CAAA,KAAK,UAAU,EAAE;YACrD,KAAK,CAAC,oBAAoB,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;SACxD;QACD,IAAI,CAAC,qBAAqB,GAAG,SAAS,CAAC;IACzC,CAAC;IACH,yBAAC;AAAD,CAAC,AAvKD,IAuKC;AAvKY,gDAAkB","sourcesContent":["import { getGlobalScope } from '@amplitude/analytics-core';\n\n/**\n * Decides when focus arrived from outside this window.\n *\n * A blur whose next frame lands on an iframe stayed in this page. Anything else\n * left the window. The parent is already blurred once an iframe is focused, so\n * that iframe's window is watched too: moving into a nested frame is not a\n * leave, and moving from the frame to another visible window is.\n */\nexport class WindowFocusTracker {\n private focusLeftWindow = false;\n private focusDestinationFrame: number | undefined;\n private focusedFrameWindow: Window | undefined;\n private focusedFrameBlur: (() => void) | undefined;\n\n /** Call from the window `blur` listener. `activeElement` is not updated yet. */\n noteBlur(): void {\n this.focusLeftWindow = false;\n this.cancelFocusDestinationCheck();\n const scope = getGlobalScope();\n this.scheduleFocusInspect(scope, () => {\n const active = scope?.document?.activeElement;\n if (active?.tagName === 'IFRAME') {\n this.watchFocusedFrame(active as HTMLIFrameElement);\n return;\n }\n this.releaseFocusedFrame();\n this.focusLeftWindow = true;\n });\n }\n\n /** The document hid. Drop the iframe watcher; visibility owns the checkout. */\n onDocumentHidden(): void {\n this.releaseFocusedFrame();\n }\n\n /**\n * The document was shown. Drop the external-focus flag so the focus event\n * that follows a tab return does not take a second checkout.\n */\n onDocumentVisible(): void {\n this.focusLeftWindow = false;\n this.cancelFocusDestinationCheck();\n this.releaseFocusedFrame();\n }\n\n /**\n * Call from the window `focus` listener. True when focus arrived from outside\n * this window while the document stayed visible.\n */\n consumeArrivedFromOutside(): boolean {\n const arrivedFromOutside = this.focusLeftWindow && getGlobalScope()?.document?.visibilityState === 'visible';\n this.focusLeftWindow = false;\n this.releaseFocusedFrame();\n return arrivedFromOutside;\n }\n\n stop(): void {\n this.focusLeftWindow = false;\n this.cancelFocusDestinationCheck();\n this.releaseFocusedFrame();\n }\n\n private noteFrameBlur() {\n this.cancelFocusDestinationCheck();\n const scope = getGlobalScope();\n this.scheduleFocusInspect(scope, () => {\n const active = scope?.document?.activeElement;\n const parentDocument = scope?.document;\n const parentHasFocus = typeof parentDocument?.hasFocus === 'function' && parentDocument.hasFocus();\n if (parentHasFocus || active?.tagName !== 'IFRAME') {\n this.releaseFocusedFrame();\n return;\n }\n const holder = this.focusHolder(active as HTMLIFrameElement);\n if (holder) {\n this.watchFocusedFrame(holder);\n return;\n }\n this.focusLeftWindow = true;\n });\n }\n\n /**\n * The iframe that still holds focus, walking into nested frames. Undefined means\n * the frame's document is visible and neither it nor a child frame is focused.\n */\n private focusHolder(frame: HTMLIFrameElement, seen?: Set<HTMLIFrameElement>): HTMLIFrameElement | undefined {\n if (seen?.has(frame)) {\n return frame;\n }\n const visited = seen ?? new Set<HTMLIFrameElement>();\n visited.add(frame);\n let doc: Document | null | undefined;\n try {\n doc = frame.contentDocument;\n } catch {\n // A cross-origin frame is still part of this page.\n return frame;\n }\n if (doc == null) {\n return frame;\n }\n if (typeof doc.hasFocus === 'function' && doc.hasFocus()) {\n return frame;\n }\n const inner = doc.activeElement;\n if (inner?.tagName === 'IFRAME') {\n return this.focusHolder(inner as HTMLIFrameElement, visited);\n }\n return undefined;\n }\n\n private watchFocusedFrame(frame: HTMLIFrameElement) {\n this.releaseFocusedFrame();\n let child: Window | null | undefined;\n const onBlur = () => {\n this.noteFrameBlur();\n };\n try {\n child = frame.contentWindow;\n // Reading `addEventListener` on a cross-origin Window throws a SecurityError.\n if (child == null || typeof child.addEventListener !== 'function') {\n return;\n }\n child.addEventListener('blur', onBlur);\n } catch {\n return;\n }\n this.focusedFrameWindow = child;\n this.focusedFrameBlur = onBlur;\n }\n\n private releaseFocusedFrame() {\n const child = this.focusedFrameWindow;\n const onBlur = this.focusedFrameBlur;\n this.focusedFrameWindow = undefined;\n this.focusedFrameBlur = undefined;\n if (child === undefined) {\n return;\n }\n try {\n child.removeEventListener('blur', onBlur as () => void);\n } catch {\n // The frame can reject listener removal once it is cross-origin.\n }\n }\n\n private scheduleFocusInspect(scope: ReturnType<typeof getGlobalScope>, inspect: () => void) {\n const run = () => {\n this.focusDestinationFrame = undefined;\n try {\n inspect();\n } catch {\n // This runs from a rAF callback, so a throw would surface as an uncaught\n // error on the host page. Focus tracking is best effort: stop watching.\n this.releaseFocusedFrame();\n }\n };\n if (typeof scope?.requestAnimationFrame === 'function') {\n this.focusDestinationFrame = scope.requestAnimationFrame(run);\n return;\n }\n run();\n }\n\n private cancelFocusDestinationCheck() {\n if (this.focusDestinationFrame === undefined) {\n return;\n }\n const scope = getGlobalScope();\n if (typeof scope?.cancelAnimationFrame === 'function') {\n scope.cancelAnimationFrame(this.focusDestinationFrame);\n }\n this.focusDestinationFrame = undefined;\n }\n}\n"]}
|
|
@@ -7,6 +7,7 @@ export declare class SessionReplayJoinedConfigGenerator {
|
|
|
7
7
|
private readonly remoteConfigClient;
|
|
8
8
|
constructor(remoteConfigClient: IRemoteConfigClient, localConfig: ISessionReplayLocalConfig);
|
|
9
9
|
generateJoinedConfig(): Promise<SessionReplayConfigs>;
|
|
10
|
+
private sanitizeSemanticSampleRate;
|
|
10
11
|
/**
|
|
11
12
|
* Defensive bounds for the remote-supplied min_session_duration_ms. A misconfigured
|
|
12
13
|
* value (e.g. 30_000_000) would silently suppress every replay until the config is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"joined-config.d.ts","sourceRoot":"","sources":["../../../src/config/joined-config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAA4C,MAAM,2BAA2B,CAAC;AAEnH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EACL,wBAAwB,IAAI,yBAAyB,EACrD,aAAa,EACb,oBAAoB,EAGrB,MAAM,SAAS,CAAC;AAajB,eAAO,MAAM,uCAAuC,kBAAmB,aAAa,kBAAkB,OAAO,kBAW5G,CAAC;AACF,qBAAa,kCAAkC;IAC7C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA4B;IACxD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAsB;gBAE7C,kBAAkB,EAAE,mBAAmB,EAAE,WAAW,EAAE,yBAAyB;IAKrF,oBAAoB,IAAI,OAAO,CAAC,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"joined-config.d.ts","sourceRoot":"","sources":["../../../src/config/joined-config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAA4C,MAAM,2BAA2B,CAAC;AAEnH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EACL,wBAAwB,IAAI,yBAAyB,EACrD,aAAa,EACb,oBAAoB,EAGrB,MAAM,SAAS,CAAC;AAajB,eAAO,MAAM,uCAAuC,kBAAmB,aAAa,kBAAkB,OAAO,kBAW5G,CAAC;AACF,qBAAa,kCAAkC;IAC7C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA4B;IACxD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAsB;gBAE7C,kBAAkB,EAAE,mBAAmB,EAAE,WAAW,EAAE,yBAAyB;IAKrF,oBAAoB,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAgN3D,OAAO,CAAC,0BAA0B;IASlC;;;;;;OAMG;IACH,OAAO,CAAC,4BAA4B;CAmBrC;AAED;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAElD,eAAO,MAAM,wCAAwC,WAAkB,MAAM,WAAW,oBAAoB,gDAc3G,CAAC"}
|
|
@@ -114,7 +114,9 @@ var SessionReplayJoinedConfigGenerator = /** @class */ (function () {
|
|
|
114
114
|
}
|
|
115
115
|
samplingConfig = sessionReplayRemoteConfig.sr_sampling_config, remotePrivacyConfig = sessionReplayRemoteConfig.sr_privacy_config, targetingConfig = sessionReplayRemoteConfig.sr_targeting_config, semanticConfig = sessionReplayRemoteConfig.sr_semantic_config;
|
|
116
116
|
if (semanticConfig) {
|
|
117
|
-
config.semanticCapture = __assign(__assign(__assign({ enabled: false }, config.semanticCapture), semanticConfig
|
|
117
|
+
config.semanticCapture = __assign(__assign(__assign(__assign({ enabled: false }, config.semanticCapture), (semanticConfig.enabled !== undefined ? { enabled: semanticConfig.enabled } : {})), (semanticConfig.sampleRate !== undefined
|
|
118
|
+
? { sampleRate: this.sanitizeSemanticSampleRate(semanticConfig.sampleRate) }
|
|
119
|
+
: {})), { families: __assign(__assign({}, (_a = config.semanticCapture) === null || _a === void 0 ? void 0 : _a.families), semanticConfig.families) });
|
|
118
120
|
}
|
|
119
121
|
if (samplingConfig && Object.keys(samplingConfig).length > 0) {
|
|
120
122
|
if (Object.prototype.hasOwnProperty.call(samplingConfig, 'capture_enabled')) {
|
|
@@ -245,6 +247,13 @@ var SessionReplayJoinedConfigGenerator = /** @class */ (function () {
|
|
|
245
247
|
});
|
|
246
248
|
});
|
|
247
249
|
};
|
|
250
|
+
SessionReplayJoinedConfigGenerator.prototype.sanitizeSemanticSampleRate = function (raw) {
|
|
251
|
+
if (typeof raw === 'number' && Number.isFinite(raw) && raw >= 0 && raw <= 1)
|
|
252
|
+
return raw;
|
|
253
|
+
// A malformed remote sampling control must not increase semantic collection.
|
|
254
|
+
this.localConfig.loggerProvider.warn("Invalid semantic sampleRate remote value (".concat(String(raw), "); disabling capture."));
|
|
255
|
+
return 0;
|
|
256
|
+
};
|
|
248
257
|
/**
|
|
249
258
|
* Defensive bounds for the remote-supplied min_session_duration_ms. A misconfigured
|
|
250
259
|
* value (e.g. 30_000_000) would silently suppress every replay until the config is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"joined-config.js","sourceR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G,CAAC,EAAE;YACpD,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,IAAI,CAClC,2EAAoE,MAAM,CAAC,GAAG,CAAC,iBAAc,CAC9F,CAAC;YACF,OAAO,SAAS,CAAC;SAClB;QACD,IAAI,GAAG,GAAG,CAAC,EAAE;YACX,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,IAAI,CAAC,4DAAqD,GAAG,iBAAc,CAAC,CAAC;YAC7G,OAAO,SAAS,CAAC;SAClB;QACD,IAAI,GAAG,GAAG,2BAA2B,EAAE;YACrC,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,IAAI,CAClC,+CAAwC,GAAG,sBAAY,2BAA2B,0BAAuB,CAC1G,CAAC;YACF,OAAO,2BAA2B,CAAC;SACpC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACH,yCAAC;AAAD,CAAC,AA/OD,IA+OC;;AAED;;;;;GAKG;AACH,MAAM,CAAC,IAAM,2BAA2B,GAAG,KAAM,CAAC;AAElD,MAAM,CAAC,IAAM,wCAAwC,GAAG,UAAO,MAAc,EAAE,OAA6B;;;QACpG,WAAW,GAAG,IAAI,wBAAwB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAE5D,kBAAkB,GAAG,IAAI,kBAAkB,CAC/C,MAAM,EACN,WAAW,CAAC,cAAc,EAC1B,WAAW,CAAC,UAAU,EACtB,OAAO,CAAC,eAAe;QACvB,0FAA0F;QAC1F,wFAAwF;QACxF,OAAO,CAAC,iBAAiB,CAC1B,CAAC;QAEF,sBAAO,IAAI,kCAAkC,CAAC,kBAAkB,EAAE,WAAW,CAAC,EAAC;;KAChF,CAAC","sourcesContent":["import { validatePrivacySelectors } from '@amplitude/session-replay-dom-privacy';\nimport { ILogger, IRemoteConfigClient, RemoteConfigClient, RemoteConfig, Source } from '@amplitude/analytics-core';\nimport { getDebugConfig } from '../helpers';\nimport { SessionReplayOptions } from '../typings/session-replay';\nimport { SessionReplayLocalConfig } from './local-config';\nimport {\n SessionReplayLocalConfig as ISessionReplayLocalConfig,\n PrivacyConfig,\n SessionReplayConfigs,\n SessionReplayJoinedConfig,\n SessionReplayRemoteConfig,\n} from './types';\n\n// Budget for waiting on the remote config response before falling back to the local cache.\n// The inner fetch in analytics-core uses a 1000ms per-attempt AbortController timeout with\n// up to 3 retries — but this outer timeout is the only thing the SR plugin waits on, so\n// only the first attempt can possibly complete in time (attempt 2 starts at ~1000-1333ms\n// after backoff jitter and runs to ~2000-2333ms, well past any reasonable outer budget).\n// 1500ms is set above the 1000ms inner abort to avoid a tie with the inner cutoff and\n// give the first attempt's resolution path room to finish; everything else falls through\n// to the cache fallback. See SR-4234: prefer remote over a stale cache that would\n// otherwise win the synchronous race in 'all' mode.\nconst REMOTE_CONFIG_TIMEOUT_MS = 1500;\n\nexport const removeInvalidSelectorsFromPrivacyConfig = (privacyConfig: PrivacyConfig, loggerProvider: ILogger) => {\n const fragment = document.createDocumentFragment();\n return validatePrivacySelectors(\n privacyConfig,\n (selector) => {\n fragment.querySelector(selector);\n },\n (selector) => {\n loggerProvider.warn(`[session-replay-browser] omitting selector \"${selector}\" because it is invalid`);\n },\n );\n};\nexport class SessionReplayJoinedConfigGenerator {\n private readonly localConfig: ISessionReplayLocalConfig;\n private readonly remoteConfigClient: IRemoteConfigClient;\n\n constructor(remoteConfigClient: IRemoteConfigClient, localConfig: ISessionReplayLocalConfig) {\n this.localConfig = localConfig;\n this.remoteConfigClient = remoteConfigClient;\n }\n\n async generateJoinedConfig(): Promise<SessionReplayConfigs> {\n const config: SessionReplayJoinedConfig = { ...this.localConfig };\n // Special case here as optOut is implemented via getter/setter\n config.optOut = this.localConfig.optOut;\n // We always want captureEnabled to be true, unless there's an override\n // in the remote config.\n config.captureEnabled = true;\n let sessionReplayRemoteConfig: SessionReplayRemoteConfig | undefined;\n\n try {\n // Subscribe with a timeout so the SDK prefers the remote response and only falls back\n // to cache after the budget elapses. 'all' mode would race a synchronous cache read\n // against the network and resolve on whichever fires first — cache always wins, so a\n // stale cache silently overrides the live config (SR-4234).\n await new Promise<void>((resolve, reject) => {\n this.remoteConfigClient.subscribe(\n 'configs.sessionReplay',\n { timeout: REMOTE_CONFIG_TIMEOUT_MS },\n (remoteConfig: RemoteConfig | null, source: Source) => {\n this.localConfig.loggerProvider.debug(\n `Session Replay remote configuration received from ${source}:`,\n JSON.stringify(remoteConfig, null, 2),\n );\n\n if (!remoteConfig) {\n reject(new Error('No remote config received'));\n return;\n }\n\n // remoteConfig is already filtered to 'configs.sessionReplay' namespace\n const namespaceConfig = remoteConfig as SessionReplayRemoteConfig;\n const samplingConfig = namespaceConfig.sr_sampling_config;\n const privacyConfig = namespaceConfig.sr_privacy_config;\n const targetingConfig = namespaceConfig.sr_targeting_config;\n const semanticConfig = namespaceConfig.sr_semantic_config;\n\n const ugcFilterRules = config.interactionConfig?.ugcFilterRules;\n // This is intentionally forced to only be set through the remote config.\n config.interactionConfig = namespaceConfig.sr_interaction_config;\n if (config.interactionConfig && ugcFilterRules) {\n config.interactionConfig.ugcFilterRules = ugcFilterRules;\n }\n\n // This is intentionally forced to only be set through the remote config.\n config.loggingConfig = namespaceConfig.sr_logging_config;\n\n if (samplingConfig || privacyConfig || targetingConfig || semanticConfig) {\n sessionReplayRemoteConfig = {};\n if (semanticConfig) {\n sessionReplayRemoteConfig.sr_semantic_config = semanticConfig;\n }\n if (samplingConfig) {\n sessionReplayRemoteConfig.sr_sampling_config = samplingConfig;\n }\n if (privacyConfig) {\n sessionReplayRemoteConfig.sr_privacy_config = privacyConfig;\n }\n if (targetingConfig) {\n sessionReplayRemoteConfig.sr_targeting_config = targetingConfig;\n }\n }\n\n resolve();\n },\n );\n });\n } catch (error) {\n this.localConfig.loggerProvider.error('Failed to generate joined config: ', error);\n config.captureEnabled = false;\n return {\n localConfig: this.localConfig,\n joinedConfig: config,\n remoteConfig: undefined,\n };\n }\n\n if (!sessionReplayRemoteConfig) {\n return {\n localConfig: this.localConfig,\n joinedConfig: config,\n remoteConfig: sessionReplayRemoteConfig,\n };\n }\n\n const {\n sr_sampling_config: samplingConfig,\n sr_privacy_config: remotePrivacyConfig,\n sr_targeting_config: targetingConfig,\n sr_semantic_config: semanticConfig,\n } = sessionReplayRemoteConfig;\n if (semanticConfig) {\n config.semanticCapture = {\n enabled: false,\n ...config.semanticCapture,\n ...semanticConfig,\n families: { ...config.semanticCapture?.families, ...semanticConfig.families },\n };\n }\n if (samplingConfig && Object.keys(samplingConfig).length > 0) {\n if (Object.prototype.hasOwnProperty.call(samplingConfig, 'capture_enabled')) {\n config.captureEnabled = samplingConfig.capture_enabled;\n } else {\n config.captureEnabled = false;\n }\n\n if (Object.prototype.hasOwnProperty.call(samplingConfig, 'sample_rate')) {\n config.sampleRate = samplingConfig.sample_rate;\n }\n\n if (Object.prototype.hasOwnProperty.call(samplingConfig, 'min_session_duration_ms')) {\n config.minSessionDurationMs = this.sanitizeMinSessionDurationMs(samplingConfig.min_session_duration_ms);\n }\n } else {\n // If config API response was valid (ie 200), but no config returned, assume that\n // customer has not yet set up config, and use sample rate from SDK options,\n // allowing for immediate replay capture\n config.captureEnabled = true;\n this.localConfig.loggerProvider.debug(\n 'Remote config successfully fetched, but no values set for project, Session Replay capture enabled.',\n );\n }\n\n // Remote config join acts somewhat like a left join between the remote and the local\n // config. That is, remote config has precedence over local values as with sampling.\n // However, non conflicting values will be added to the lists.\n // Here's an example to illustrate:\n //\n // Remote config: {'.selector1': 'MASK', '.selector2': 'UNMASK'}\n // Local config: {'.selector1': 'UNMASK', '.selector3': 'MASK'}\n //\n // Resolved config: {'.selector1': 'MASK', '.selector2': 'UNMASK', '.selector3': 'MASK'}\n // config.privacyConfig = {\n // ...(config.privacyConfig ?? {}),\n // ...remotePrivacyConfig,\n // };\n\n if (remotePrivacyConfig) {\n const localPrivacyConfig: PrivacyConfig = config.privacyConfig ?? {};\n\n const joinedPrivacyConfig: Required<PrivacyConfig> & { blockSelector: string[] } = {\n defaultMaskLevel: remotePrivacyConfig.defaultMaskLevel ?? localPrivacyConfig.defaultMaskLevel ?? 'medium',\n blockSelector: [],\n maskSelector: [],\n unmaskSelector: [],\n maskAttributes: [\n ...new Set([...(localPrivacyConfig.maskAttributes ?? []), ...(remotePrivacyConfig.maskAttributes ?? [])]),\n ],\n urlMaskLevels: [...(remotePrivacyConfig.urlMaskLevels ?? []), ...(localPrivacyConfig.urlMaskLevels ?? [])],\n };\n\n const privacyConfigSelectorMap = (privacyConfig: PrivacyConfig): Record<string, 'mask' | 'unmask' | 'block'> => {\n const selectorMap: Record<string, 'mask' | 'unmask' | 'block'> = {};\n if (typeof privacyConfig.blockSelector === 'string') {\n privacyConfig.blockSelector = [privacyConfig.blockSelector];\n }\n\n for (const selector of privacyConfig.blockSelector ?? []) {\n selectorMap[selector] = 'block';\n }\n for (const selector of privacyConfig.maskSelector ?? []) {\n selectorMap[selector] = 'mask';\n }\n for (const selector of privacyConfig.unmaskSelector ?? []) {\n selectorMap[selector] = 'unmask';\n }\n return selectorMap;\n };\n\n const selectorMap: Record<string, 'mask' | 'unmask' | 'block'> = {\n ...privacyConfigSelectorMap(localPrivacyConfig),\n ...privacyConfigSelectorMap(remotePrivacyConfig),\n };\n\n for (const [selector, selectorType] of Object.entries(selectorMap)) {\n if (selectorType === 'mask') {\n joinedPrivacyConfig.maskSelector.push(selector);\n } else if (selectorType === 'block') {\n joinedPrivacyConfig.blockSelector.push(selector);\n } else if (selectorType === 'unmask') {\n joinedPrivacyConfig.unmaskSelector.push(selector);\n }\n }\n\n config.privacyConfig = removeInvalidSelectorsFromPrivacyConfig(\n joinedPrivacyConfig,\n this.localConfig.loggerProvider,\n );\n }\n\n if (targetingConfig && Object.keys(targetingConfig).length > 0) {\n config.targetingConfig = targetingConfig;\n }\n\n this.localConfig.loggerProvider.debug(\n JSON.stringify({ name: 'session replay joined config', config: getDebugConfig(config) }, null, 2),\n );\n\n return {\n localConfig: this.localConfig,\n joinedConfig: config,\n remoteConfig: sessionReplayRemoteConfig,\n };\n }\n\n /**\n * Defensive bounds for the remote-supplied min_session_duration_ms. A misconfigured\n * value (e.g. 30_000_000) would silently suppress every replay until the config is\n * pushed again, so we clamp to a sane ceiling and warn on out-of-range inputs.\n * Returns undefined for clearly invalid values so the gate falls back to disabled\n * rather than carrying a NaN through downstream comparisons.\n */\n private sanitizeMinSessionDurationMs(raw: unknown): number | undefined {\n if (typeof raw !== 'number' || !Number.isFinite(raw)) {\n this.localConfig.loggerProvider.warn(\n `min_session_duration_ms remote value is not a finite number (got ${String(raw)}); ignoring.`,\n );\n return undefined;\n }\n if (raw < 0) {\n this.localConfig.loggerProvider.warn(`min_session_duration_ms remote value is negative (${raw}); ignoring.`);\n return undefined;\n }\n if (raw > MAX_MIN_SESSION_DURATION_MS) {\n this.localConfig.loggerProvider.warn(\n `min_session_duration_ms remote value ${raw} exceeds ${MAX_MIN_SESSION_DURATION_MS}ms ceiling; clamping.`,\n );\n return MAX_MIN_SESSION_DURATION_MS;\n }\n return raw;\n }\n}\n\n/**\n * Upper bound for the remote-configured replay min duration. 60 seconds is well above\n * any reasonable bounce threshold; values higher than this are almost certainly typos\n * (e.g. seconds confused for milliseconds, or an extra zero) and would otherwise\n * suppress every replay until the config is corrected.\n */\nexport const MAX_MIN_SESSION_DURATION_MS = 60_000;\n\nexport const createSessionReplayJoinedConfigGenerator = async (apiKey: string, options: SessionReplayOptions) => {\n const localConfig = new SessionReplayLocalConfig(apiKey, options);\n\n const remoteConfigClient = new RemoteConfigClient(\n apiKey,\n localConfig.loggerProvider,\n localConfig.serverZone,\n options.configServerUrl,\n // Custom transport for the config GET. SR's FetchConfigRequest is structurally compatible\n // with RemoteConfigFetchRequest, so the customer's handleFetchConfig drops straight in.\n options.handleFetchConfig,\n );\n\n return new SessionReplayJoinedConfigGenerator(remoteConfigClient, localConfig);\n};\n"]}
|
|
1
|
+
{"version":3,"file":"joined-config.js","sourceRoot":"","sources":["../../../src/config/joined-config.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC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,WAAW,GAAG,IAAI,wBAAwB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAE5D,kBAAkB,GAAG,IAAI,kBAAkB,CAC/C,MAAM,EACN,WAAW,CAAC,cAAc,EAC1B,WAAW,CAAC,UAAU,EACtB,OAAO,CAAC,eAAe;QACvB,0FAA0F;QAC1F,wFAAwF;QACxF,OAAO,CAAC,iBAAiB,CAC1B,CAAC;QAEF,sBAAO,IAAI,kCAAkC,CAAC,kBAAkB,EAAE,WAAW,CAAC,EAAC;;KAChF,CAAC","sourcesContent":["import { validatePrivacySelectors } from '@amplitude/session-replay-dom-privacy';\nimport { ILogger, IRemoteConfigClient, RemoteConfigClient, RemoteConfig, Source } from '@amplitude/analytics-core';\nimport { getDebugConfig } from '../helpers';\nimport { SessionReplayOptions } from '../typings/session-replay';\nimport { SessionReplayLocalConfig } from './local-config';\nimport {\n SessionReplayLocalConfig as ISessionReplayLocalConfig,\n PrivacyConfig,\n SessionReplayConfigs,\n SessionReplayJoinedConfig,\n SessionReplayRemoteConfig,\n} from './types';\n\n// Budget for waiting on the remote config response before falling back to the local cache.\n// The inner fetch in analytics-core uses a 1000ms per-attempt AbortController timeout with\n// up to 3 retries — but this outer timeout is the only thing the SR plugin waits on, so\n// only the first attempt can possibly complete in time (attempt 2 starts at ~1000-1333ms\n// after backoff jitter and runs to ~2000-2333ms, well past any reasonable outer budget).\n// 1500ms is set above the 1000ms inner abort to avoid a tie with the inner cutoff and\n// give the first attempt's resolution path room to finish; everything else falls through\n// to the cache fallback. See SR-4234: prefer remote over a stale cache that would\n// otherwise win the synchronous race in 'all' mode.\nconst REMOTE_CONFIG_TIMEOUT_MS = 1500;\n\nexport const removeInvalidSelectorsFromPrivacyConfig = (privacyConfig: PrivacyConfig, loggerProvider: ILogger) => {\n const fragment = document.createDocumentFragment();\n return validatePrivacySelectors(\n privacyConfig,\n (selector) => {\n fragment.querySelector(selector);\n },\n (selector) => {\n loggerProvider.warn(`[session-replay-browser] omitting selector \"${selector}\" because it is invalid`);\n },\n );\n};\nexport class SessionReplayJoinedConfigGenerator {\n private readonly localConfig: ISessionReplayLocalConfig;\n private readonly remoteConfigClient: IRemoteConfigClient;\n\n constructor(remoteConfigClient: IRemoteConfigClient, localConfig: ISessionReplayLocalConfig) {\n this.localConfig = localConfig;\n this.remoteConfigClient = remoteConfigClient;\n }\n\n async generateJoinedConfig(): Promise<SessionReplayConfigs> {\n const config: SessionReplayJoinedConfig = { ...this.localConfig };\n // Special case here as optOut is implemented via getter/setter\n config.optOut = this.localConfig.optOut;\n // We always want captureEnabled to be true, unless there's an override\n // in the remote config.\n config.captureEnabled = true;\n let sessionReplayRemoteConfig: SessionReplayRemoteConfig | undefined;\n\n try {\n // Subscribe with a timeout so the SDK prefers the remote response and only falls back\n // to cache after the budget elapses. 'all' mode would race a synchronous cache read\n // against the network and resolve on whichever fires first — cache always wins, so a\n // stale cache silently overrides the live config (SR-4234).\n await new Promise<void>((resolve, reject) => {\n this.remoteConfigClient.subscribe(\n 'configs.sessionReplay',\n { timeout: REMOTE_CONFIG_TIMEOUT_MS },\n (remoteConfig: RemoteConfig | null, source: Source) => {\n this.localConfig.loggerProvider.debug(\n `Session Replay remote configuration received from ${source}:`,\n JSON.stringify(remoteConfig, null, 2),\n );\n\n if (!remoteConfig) {\n reject(new Error('No remote config received'));\n return;\n }\n\n // remoteConfig is already filtered to 'configs.sessionReplay' namespace\n const namespaceConfig = remoteConfig as SessionReplayRemoteConfig;\n const samplingConfig = namespaceConfig.sr_sampling_config;\n const privacyConfig = namespaceConfig.sr_privacy_config;\n const targetingConfig = namespaceConfig.sr_targeting_config;\n const semanticConfig = namespaceConfig.sr_semantic_config;\n\n const ugcFilterRules = config.interactionConfig?.ugcFilterRules;\n // This is intentionally forced to only be set through the remote config.\n config.interactionConfig = namespaceConfig.sr_interaction_config;\n if (config.interactionConfig && ugcFilterRules) {\n config.interactionConfig.ugcFilterRules = ugcFilterRules;\n }\n\n // This is intentionally forced to only be set through the remote config.\n config.loggingConfig = namespaceConfig.sr_logging_config;\n\n if (samplingConfig || privacyConfig || targetingConfig || semanticConfig) {\n sessionReplayRemoteConfig = {};\n if (semanticConfig) {\n sessionReplayRemoteConfig.sr_semantic_config = semanticConfig;\n }\n if (samplingConfig) {\n sessionReplayRemoteConfig.sr_sampling_config = samplingConfig;\n }\n if (privacyConfig) {\n sessionReplayRemoteConfig.sr_privacy_config = privacyConfig;\n }\n if (targetingConfig) {\n sessionReplayRemoteConfig.sr_targeting_config = targetingConfig;\n }\n }\n\n resolve();\n },\n );\n });\n } catch (error) {\n this.localConfig.loggerProvider.error('Failed to generate joined config: ', error);\n config.captureEnabled = false;\n return {\n localConfig: this.localConfig,\n joinedConfig: config,\n remoteConfig: undefined,\n };\n }\n\n if (!sessionReplayRemoteConfig) {\n return {\n localConfig: this.localConfig,\n joinedConfig: config,\n remoteConfig: sessionReplayRemoteConfig,\n };\n }\n\n const {\n sr_sampling_config: samplingConfig,\n sr_privacy_config: remotePrivacyConfig,\n sr_targeting_config: targetingConfig,\n sr_semantic_config: semanticConfig,\n } = sessionReplayRemoteConfig;\n if (semanticConfig) {\n config.semanticCapture = {\n enabled: false,\n ...config.semanticCapture,\n // Only serializable controls may come from remote config. Preserve the local createCapture callback.\n ...(semanticConfig.enabled !== undefined ? { enabled: semanticConfig.enabled } : {}),\n ...(semanticConfig.sampleRate !== undefined\n ? { sampleRate: this.sanitizeSemanticSampleRate(semanticConfig.sampleRate) }\n : {}),\n families: { ...config.semanticCapture?.families, ...semanticConfig.families },\n };\n }\n if (samplingConfig && Object.keys(samplingConfig).length > 0) {\n if (Object.prototype.hasOwnProperty.call(samplingConfig, 'capture_enabled')) {\n config.captureEnabled = samplingConfig.capture_enabled;\n } else {\n config.captureEnabled = false;\n }\n\n if (Object.prototype.hasOwnProperty.call(samplingConfig, 'sample_rate')) {\n config.sampleRate = samplingConfig.sample_rate;\n }\n\n if (Object.prototype.hasOwnProperty.call(samplingConfig, 'min_session_duration_ms')) {\n config.minSessionDurationMs = this.sanitizeMinSessionDurationMs(samplingConfig.min_session_duration_ms);\n }\n } else {\n // If config API response was valid (ie 200), but no config returned, assume that\n // customer has not yet set up config, and use sample rate from SDK options,\n // allowing for immediate replay capture\n config.captureEnabled = true;\n this.localConfig.loggerProvider.debug(\n 'Remote config successfully fetched, but no values set for project, Session Replay capture enabled.',\n );\n }\n\n // Remote config join acts somewhat like a left join between the remote and the local\n // config. That is, remote config has precedence over local values as with sampling.\n // However, non conflicting values will be added to the lists.\n // Here's an example to illustrate:\n //\n // Remote config: {'.selector1': 'MASK', '.selector2': 'UNMASK'}\n // Local config: {'.selector1': 'UNMASK', '.selector3': 'MASK'}\n //\n // Resolved config: {'.selector1': 'MASK', '.selector2': 'UNMASK', '.selector3': 'MASK'}\n // config.privacyConfig = {\n // ...(config.privacyConfig ?? {}),\n // ...remotePrivacyConfig,\n // };\n\n if (remotePrivacyConfig) {\n const localPrivacyConfig: PrivacyConfig = config.privacyConfig ?? {};\n\n const joinedPrivacyConfig: Required<PrivacyConfig> & { blockSelector: string[] } = {\n defaultMaskLevel: remotePrivacyConfig.defaultMaskLevel ?? localPrivacyConfig.defaultMaskLevel ?? 'medium',\n blockSelector: [],\n maskSelector: [],\n unmaskSelector: [],\n maskAttributes: [\n ...new Set([...(localPrivacyConfig.maskAttributes ?? []), ...(remotePrivacyConfig.maskAttributes ?? [])]),\n ],\n urlMaskLevels: [...(remotePrivacyConfig.urlMaskLevels ?? []), ...(localPrivacyConfig.urlMaskLevels ?? [])],\n };\n\n const privacyConfigSelectorMap = (privacyConfig: PrivacyConfig): Record<string, 'mask' | 'unmask' | 'block'> => {\n const selectorMap: Record<string, 'mask' | 'unmask' | 'block'> = {};\n if (typeof privacyConfig.blockSelector === 'string') {\n privacyConfig.blockSelector = [privacyConfig.blockSelector];\n }\n\n for (const selector of privacyConfig.blockSelector ?? []) {\n selectorMap[selector] = 'block';\n }\n for (const selector of privacyConfig.maskSelector ?? []) {\n selectorMap[selector] = 'mask';\n }\n for (const selector of privacyConfig.unmaskSelector ?? []) {\n selectorMap[selector] = 'unmask';\n }\n return selectorMap;\n };\n\n const selectorMap: Record<string, 'mask' | 'unmask' | 'block'> = {\n ...privacyConfigSelectorMap(localPrivacyConfig),\n ...privacyConfigSelectorMap(remotePrivacyConfig),\n };\n\n for (const [selector, selectorType] of Object.entries(selectorMap)) {\n if (selectorType === 'mask') {\n joinedPrivacyConfig.maskSelector.push(selector);\n } else if (selectorType === 'block') {\n joinedPrivacyConfig.blockSelector.push(selector);\n } else if (selectorType === 'unmask') {\n joinedPrivacyConfig.unmaskSelector.push(selector);\n }\n }\n\n config.privacyConfig = removeInvalidSelectorsFromPrivacyConfig(\n joinedPrivacyConfig,\n this.localConfig.loggerProvider,\n );\n }\n\n if (targetingConfig && Object.keys(targetingConfig).length > 0) {\n config.targetingConfig = targetingConfig;\n }\n\n this.localConfig.loggerProvider.debug(\n JSON.stringify({ name: 'session replay joined config', config: getDebugConfig(config) }, null, 2),\n );\n\n return {\n localConfig: this.localConfig,\n joinedConfig: config,\n remoteConfig: sessionReplayRemoteConfig,\n };\n }\n\n private sanitizeSemanticSampleRate(raw: unknown): number {\n if (typeof raw === 'number' && Number.isFinite(raw) && raw >= 0 && raw <= 1) return raw;\n // A malformed remote sampling control must not increase semantic collection.\n this.localConfig.loggerProvider.warn(\n `Invalid semantic sampleRate remote value (${String(raw)}); disabling capture.`,\n );\n return 0;\n }\n\n /**\n * Defensive bounds for the remote-supplied min_session_duration_ms. A misconfigured\n * value (e.g. 30_000_000) would silently suppress every replay until the config is\n * pushed again, so we clamp to a sane ceiling and warn on out-of-range inputs.\n * Returns undefined for clearly invalid values so the gate falls back to disabled\n * rather than carrying a NaN through downstream comparisons.\n */\n private sanitizeMinSessionDurationMs(raw: unknown): number | undefined {\n if (typeof raw !== 'number' || !Number.isFinite(raw)) {\n this.localConfig.loggerProvider.warn(\n `min_session_duration_ms remote value is not a finite number (got ${String(raw)}); ignoring.`,\n );\n return undefined;\n }\n if (raw < 0) {\n this.localConfig.loggerProvider.warn(`min_session_duration_ms remote value is negative (${raw}); ignoring.`);\n return undefined;\n }\n if (raw > MAX_MIN_SESSION_DURATION_MS) {\n this.localConfig.loggerProvider.warn(\n `min_session_duration_ms remote value ${raw} exceeds ${MAX_MIN_SESSION_DURATION_MS}ms ceiling; clamping.`,\n );\n return MAX_MIN_SESSION_DURATION_MS;\n }\n return raw;\n }\n}\n\n/**\n * Upper bound for the remote-configured replay min duration. 60 seconds is well above\n * any reasonable bounce threshold; values higher than this are almost certainly typos\n * (e.g. seconds confused for milliseconds, or an extra zero) and would otherwise\n * suppress every replay until the config is corrected.\n */\nexport const MAX_MIN_SESSION_DURATION_MS = 60_000;\n\nexport const createSessionReplayJoinedConfigGenerator = async (apiKey: string, options: SessionReplayOptions) => {\n const localConfig = new SessionReplayLocalConfig(apiKey, options);\n\n const remoteConfigClient = new RemoteConfigClient(\n apiKey,\n localConfig.loggerProvider,\n localConfig.serverZone,\n options.configServerUrl,\n // Custom transport for the config GET. SR's FetchConfigRequest is structurally compatible\n // with RemoteConfigFetchRequest, so the customer's handleFetchConfig drops straight in.\n options.handleFetchConfig,\n );\n\n return new SessionReplayJoinedConfigGenerator(remoteConfigClient, localConfig);\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SemanticAnalyticsContext, SemanticCaptureOptions } from '../semantic-types';
|
|
2
2
|
import { Config, Logger, FetchTransport, LogLevel } from '@amplitude/analytics-core';
|
|
3
3
|
import { SessionReplayOptions, StoreType } from '../typings/session-replay';
|
|
4
4
|
import { SessionReplayLocalConfig as ISessionReplayLocalConfig, CrossOriginIframesConfig, FlushIntervalConfig, InteractionConfig, PrivacyConfig, SessionReplayPerformanceConfig, SessionReplayVersion, SessionReplaySendEventsHandler, SessionReplayFetchConfigHandler } from './types';
|
|
@@ -12,8 +12,8 @@ export declare class SessionReplayLocalConfig extends Config implements ISession
|
|
|
12
12
|
apiKey: string;
|
|
13
13
|
sampleRate: number;
|
|
14
14
|
privacyConfig?: PrivacyConfig;
|
|
15
|
-
semanticCapture?:
|
|
16
|
-
semanticAnalyticsContext?:
|
|
15
|
+
semanticCapture?: SemanticCaptureOptions;
|
|
16
|
+
semanticAnalyticsContext?: SemanticAnalyticsContext;
|
|
17
17
|
interactionConfig?: InteractionConfig;
|
|
18
18
|
debugMode?: boolean;
|
|
19
19
|
configServerUrl?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-config.d.ts","sourceRoot":"","sources":["../../../src/config/local-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"local-config.d.ts","sourceRoot":"","sources":["../../../src/config/local-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAE,MAAM,EAAW,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAY9F,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EACL,wBAAwB,IAAI,yBAAyB,EACrD,wBAAwB,EACxB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,8BAA8B,EAC9B,oBAAoB,EACpB,8BAA8B,EAC9B,+BAA+B,EAChC,MAAM,SAAS,CAAC;AAIjB,eAAO,MAAM,gBAAgB;;;;;CAK3B,CAAC;AAEH,qBAAa,wBAAyB,SAAQ,MAAO,YAAW,yBAAyB;IACvF,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,eAAe,CAAC,EAAE,sBAAsB,CAAC;IACzC,wBAAwB,CAAC,EAAE,wBAAwB,CAAC;IACpD,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,SAAS,EAAE,SAAS,CAAC;IACrB,iBAAiB,CAAC,EAAE,8BAA8B,CAAC;IACnD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qCAAqC,CAAC,EAAE,OAAO,CAAC;IAChD,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,kBAAkB,CAAC,EAAE,wBAAwB,CAAC;IAC9C,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,gBAAgB,CAAC,EAAE,8BAA8B,CAAC;IAClD,iBAAiB,CAAC,EAAE,+BAA+B,CAAC;gBAExC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB;CAwG1D"}
|
|
@@ -42,9 +42,11 @@ var SessionReplayLocalConfig = /** @class */ (function (_super) {
|
|
|
42
42
|
if (options.eagerFullSnapshotSend !== undefined) {
|
|
43
43
|
_this.eagerFullSnapshotSend = options.eagerFullSnapshotSend;
|
|
44
44
|
}
|
|
45
|
-
// Defaults to false
|
|
46
|
-
// snapshot is off unless the consumer explicitly opts in.
|
|
47
|
-
//
|
|
45
|
+
// Defaults to false: the on-focus full
|
|
46
|
+
// snapshot is off unless the consumer explicitly opts in. A focus that arrives from
|
|
47
|
+
// another visible window still takes one checkout, including a return from a window
|
|
48
|
+
// switch that started while an iframe in this page was focused. Same-page iframe
|
|
49
|
+
// focus does not.
|
|
48
50
|
_this.captureFullSnapshotOnFocus = (_f = options.captureFullSnapshotOnFocus) !== null && _f !== void 0 ? _f : false;
|
|
49
51
|
if (options.maxPersistedEventsSizeBytes !== undefined) {
|
|
50
52
|
_this.maxPersistedEventsSizeBytes = sanitizeByteSize(options.maxPersistedEventsSizeBytes, MIN_EVENT_BYTE_SIZE, MAX_PERSISTED_EVENTS_SIZE_CEILING, 'maxPersistedEventsSizeBytes', _this.loggerProvider);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-config.js","sourceRoot":"","sources":["../../../src/config/local-config.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAW,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC9F,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,EAC7B,0BAA0B,EAC1B,mBAAmB,EACnB,mBAAmB,EACnB,mCAAmC,EACnC,YAAY,EACZ,YAAY,EACZ,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAatB,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,CAAC,IAAM,gBAAgB,GAAG,cAAM,OAAA,CAAC;IACrC,eAAe,EAAE,CAAC;IAClB,QAAQ,EAAE,QAAQ,CAAC,IAAI;IACvB,cAAc,EAAE,IAAI,MAAM,EAAE;IAC5B,iBAAiB,EAAE,IAAI,cAAc,EAAE;CACxC,CAAC,EALoC,CAKpC,CAAC;AAEH;IAA8C,4CAAM;IAiClD,kCAAY,MAAc,EAAE,OAA6B;QAAzD,iBAqGC;;QApGC,IAAM,aAAa,GAAG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,GAAG,YAAY,CAAC;aACxC;iBAAM,IAAI,SAAS,CAAC,aAAa,KAAK,SAAS,EAAE;gBAChD,cAAc,CAAC,IAAI,CACjB,6CAAsC,YAAY,mDAAyC,YAAY,kCAA+B,CACvI,CAAC;gBACF,SAAS,CAAC,aAAa,GAAG,YAAY,CAAC;aACxC;iBAAM;gBACL,cAAc,CAAC,IAAI,CACjB,6CAAsC,SAAS,CAAC,aAAa,2CAAiC,SAAS,CAAC,aAAa,iCAA8B,CACpJ,CAAC;gBACF,SAAS,CAAC,aAAa,GAAG,SAAS,CAAC,aAAa,CAAC;aACnD;SACF;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import type { AnalyticsContext, SemanticCaptureConfig } from '@amplitude/amp-semantic';\nimport { Config, ILogger, Logger, FetchTransport, LogLevel } from '@amplitude/analytics-core';\nimport {\n DEFAULT_FLUSH_MAX_INTERVAL_MS,\n DEFAULT_FLUSH_MIN_INTERVAL_MS,\n DEFAULT_PERFORMANCE_CONFIG,\n DEFAULT_SAMPLE_RATE,\n DEFAULT_SERVER_ZONE,\n DEFAULT_URL_CHANGE_POLLING_INTERVAL,\n MAX_INTERVAL,\n MIN_INTERVAL,\n UNMASK_TEXT_CLASS,\n} from '../constants';\nimport { SessionReplayOptions, StoreType } from '../typings/session-replay';\nimport {\n SessionReplayLocalConfig as ISessionReplayLocalConfig,\n CrossOriginIframesConfig,\n FlushIntervalConfig,\n InteractionConfig,\n PrivacyConfig,\n SessionReplayPerformanceConfig,\n SessionReplayVersion,\n SessionReplaySendEventsHandler,\n SessionReplayFetchConfigHandler,\n} from './types';\nimport { SafeLoggerProvider } from '../logger';\nimport { validateUGCFilterRules } from '../helpers';\n\nexport const getDefaultConfig = () => ({\n flushMaxRetries: 2,\n logLevel: LogLevel.Warn,\n loggerProvider: new Logger(),\n transportProvider: new FetchTransport(),\n});\n\nexport class SessionReplayLocalConfig extends Config implements ISessionReplayLocalConfig {\n apiKey: string;\n sampleRate: number;\n privacyConfig?: PrivacyConfig;\n semanticCapture?: SemanticCaptureConfig;\n semanticAnalyticsContext?: AnalyticsContext;\n interactionConfig?: InteractionConfig;\n debugMode?: boolean;\n configServerUrl?: string;\n trackServerUrl?: string;\n shouldInlineStylesheet?: boolean;\n inlineImages?: boolean;\n version?: SessionReplayVersion;\n storeType: StoreType;\n performanceConfig?: SessionReplayPerformanceConfig;\n useWebWorker?: boolean;\n enableTransportCompression?: boolean;\n sendTimeoutMs?: number;\n applyBackgroundColorToBlockedElements?: boolean;\n enableUrlChangePolling?: boolean;\n urlChangePollingInterval?: number;\n captureDocumentTitle?: boolean;\n captureAdoptedStyleSheets?: boolean;\n crossOriginIframes?: CrossOriginIframesConfig;\n fullSnapshotIntervalMs?: number;\n flushIntervalConfig?: FlushIntervalConfig;\n eagerFullSnapshotSend?: boolean;\n captureFullSnapshotOnFocus?: boolean;\n maxPersistedEventsSizeBytes?: number;\n maxSingleEventSizeBytes?: number;\n handleSendEvents?: SessionReplaySendEventsHandler;\n handleFetchConfig?: SessionReplayFetchConfigHandler;\n\n constructor(apiKey: string, options: SessionReplayOptions) {\n const defaultConfig = getDefaultConfig();\n super({\n transportProvider: defaultConfig.transportProvider,\n loggerProvider: new SafeLoggerProvider(options.loggerProvider || defaultConfig.loggerProvider),\n ...options,\n apiKey,\n });\n this.flushMaxRetries =\n options.flushMaxRetries !== undefined && options.flushMaxRetries <= defaultConfig.flushMaxRetries\n ? options.flushMaxRetries\n : defaultConfig.flushMaxRetries;\n\n this.apiKey = apiKey;\n this.sampleRate = options.sampleRate || DEFAULT_SAMPLE_RATE;\n this.semanticCapture = options.semanticCapture;\n this.semanticAnalyticsContext = options.semanticAnalyticsContext;\n this.serverZone = options.serverZone || DEFAULT_SERVER_ZONE;\n this.configServerUrl = options.configServerUrl;\n this.trackServerUrl = options.trackServerUrl;\n this.shouldInlineStylesheet = options.shouldInlineStylesheet;\n this.inlineImages = options.inlineImages;\n this.version = options.version;\n this.performanceConfig = options.performanceConfig || DEFAULT_PERFORMANCE_CONFIG;\n this.storeType = options.storeType ?? 'memory';\n this.applyBackgroundColorToBlockedElements = options.applyBackgroundColorToBlockedElements ?? false;\n this.enableUrlChangePolling = options.enableUrlChangePolling ?? false;\n this.urlChangePollingInterval = options.urlChangePollingInterval ?? DEFAULT_URL_CHANGE_POLLING_INTERVAL;\n this.captureDocumentTitle = options.captureDocumentTitle ?? false;\n if (options.fullSnapshotIntervalMs !== undefined) {\n this.fullSnapshotIntervalMs = options.fullSnapshotIntervalMs;\n }\n if (options.eagerFullSnapshotSend !== undefined) {\n this.eagerFullSnapshotSend = options.eagerFullSnapshotSend;\n }\n // Defaults to false per the validated amp-on-amp perf config (SR-4646): the on-focus full\n // snapshot is off unless the consumer explicitly opts in. focusListener honors this by\n // skipping the snapshot whenever the value is not true.\n this.captureFullSnapshotOnFocus = options.captureFullSnapshotOnFocus ?? false;\n if (options.maxPersistedEventsSizeBytes !== undefined) {\n this.maxPersistedEventsSizeBytes = sanitizeByteSize(\n options.maxPersistedEventsSizeBytes,\n MIN_EVENT_BYTE_SIZE,\n MAX_PERSISTED_EVENTS_SIZE_CEILING,\n 'maxPersistedEventsSizeBytes',\n this.loggerProvider,\n );\n }\n if (options.maxSingleEventSizeBytes !== undefined) {\n this.maxSingleEventSizeBytes = sanitizeByteSize(\n options.maxSingleEventSizeBytes,\n MIN_EVENT_BYTE_SIZE,\n MAX_SINGLE_EVENT_SIZE_CEILING,\n 'maxSingleEventSizeBytes',\n this.loggerProvider,\n );\n }\n\n // Auto-include .amp-unmask as a default unmaskSelector entry so it works\n // symmetrically with amp-mask/amp-block without requiring explicit config (SR-2945).\n this.privacyConfig = {\n ...(options.privacyConfig ?? {}),\n unmaskSelector: Array.from(new Set([`.${UNMASK_TEXT_CLASS}`, ...(options.privacyConfig?.unmaskSelector ?? [])])),\n };\n if (options.interactionConfig) {\n this.interactionConfig = options.interactionConfig;\n\n // validate ugcFilterRules, throw error if invalid - throw error at the beginning of the config\n if (this.interactionConfig.ugcFilterRules) {\n validateUGCFilterRules(this.interactionConfig.ugcFilterRules);\n }\n }\n if (options.debugMode) {\n this.debugMode = options.debugMode;\n }\n // Support both new useWebWorker and legacy experimental.useWebWorker for backwards\n // compatibility. Defaults to true per the validated amp-on-amp perf config (SR-4646):\n // compression runs off the main thread unless the consumer explicitly sets either flag\n // to false. The top-level option wins over the legacy experimental one when both are set.\n const legacyOptions = options as { experimental?: { useWebWorker?: boolean } };\n this.useWebWorker = options.useWebWorker ?? legacyOptions.experimental?.useWebWorker ?? true;\n this.enableTransportCompression = options.enableTransportCompression ?? true;\n // Pass through undefined so the track destination applies its SEND_TIMEOUT_MS default;\n // an explicit 0 is preserved (disables the timeout).\n this.sendTimeoutMs = options.sendTimeoutMs;\n this.captureAdoptedStyleSheets = options.captureAdoptedStyleSheets ?? true;\n if (options.crossOriginIframes) {\n this.crossOriginIframes = options.crossOriginIframes;\n }\n if (options.flushIntervalConfig) {\n this.flushIntervalConfig = sanitizeFlushIntervalConfig(options.flushIntervalConfig, this.loggerProvider);\n } else {\n // Default to the validated amp-on-amp perf config (SR-4646). The values are known-valid\n // (min <= max, both above the floor), so no sanitization is required.\n this.flushIntervalConfig = {\n minIntervalMs: DEFAULT_FLUSH_MIN_INTERVAL_MS,\n maxIntervalMs: DEFAULT_FLUSH_MAX_INTERVAL_MS,\n };\n }\n this.handleSendEvents = options.handleSendEvents;\n this.handleFetchConfig = options.handleFetchConfig;\n }\n}\n\n// 100ms floor avoids degenerate configs (0/negative) that would split on every event.\n// Customers wanting fewer requests should be raising the value, not lowering it; the floor\n// is just a defensive guard against typos and unsigned-int rollovers.\nconst MIN_FLUSH_INTERVAL_FLOOR_MS = 100;\n\n// Shared 1 KB floor for the byte-size overrides — small enough to exercise splitting/drops\n// while debugging, large enough to avoid a 0/negative config that splits on every event.\nconst MIN_EVENT_BYTE_SIZE = 1_000;\n// Batch cap ceiling: stay under the SR ingest service's 10 MB decompressed split threshold\n// (above which the server splits the batch itself) with headroom for the request wrapper.\nconst MAX_PERSISTED_EVENTS_SIZE_CEILING = 8_000_000;\n// Single-event ceiling: the server rejects a single event above ~10 MB, so never allow an\n// override to exceed that.\nconst MAX_SINGLE_EVENT_SIZE_CEILING = 10_000_000;\n\n// Defensive bounds for the byte-size overrides. Non-finite inputs are ignored (fall back to\n// the SDK default); out-of-range values are clamped and logged so a typo can't silently\n// disable splitting or push past the server's limits.\nfunction sanitizeByteSize(\n raw: number,\n min: number,\n max: number,\n name: string,\n loggerProvider: ILogger,\n): number | undefined {\n if (!Number.isFinite(raw)) {\n loggerProvider.warn(`${name} value is not a finite number (got ${String(raw)}); ignoring.`);\n return undefined;\n }\n if (raw < min) {\n loggerProvider.warn(`${name} ${raw} is below floor ${min}; clamping.`);\n return min;\n }\n if (raw > max) {\n loggerProvider.warn(`${name} ${raw} exceeds ceiling ${max}; clamping.`);\n return max;\n }\n return raw;\n}\n\nfunction sanitizeFlushIntervalConfig(raw: FlushIntervalConfig, loggerProvider: ILogger): FlushIntervalConfig {\n const sanitized: FlushIntervalConfig = {};\n if (raw.minIntervalMs !== undefined) {\n if (!Number.isFinite(raw.minIntervalMs) || raw.minIntervalMs < MIN_FLUSH_INTERVAL_FLOOR_MS) {\n loggerProvider.warn(\n `flushIntervalConfig.minIntervalMs ${raw.minIntervalMs} is below floor ${MIN_FLUSH_INTERVAL_FLOOR_MS}ms; clamping.`,\n );\n sanitized.minIntervalMs = MIN_FLUSH_INTERVAL_FLOOR_MS;\n } else {\n sanitized.minIntervalMs = raw.minIntervalMs;\n }\n }\n if (raw.maxIntervalMs !== undefined) {\n // Unlike min, `Infinity` is a meaningful value here: it means \"no upper bound on interval\n // growth\" (Math.min(Infinity, x) === x in BaseEventsStore.shouldSplitEventsList). Reject\n // only NaN and sub-floor values; pass Infinity through.\n if (Number.isNaN(raw.maxIntervalMs) || raw.maxIntervalMs < MIN_FLUSH_INTERVAL_FLOOR_MS) {\n loggerProvider.warn(\n `flushIntervalConfig.maxIntervalMs ${raw.maxIntervalMs} is below floor ${MIN_FLUSH_INTERVAL_FLOOR_MS}ms; clamping.`,\n );\n sanitized.maxIntervalMs = MIN_FLUSH_INTERVAL_FLOOR_MS;\n } else {\n sanitized.maxIntervalMs = raw.maxIntervalMs;\n }\n }\n // Cross-validate against the SDK's effective defaults so that a partial config (only one of\n // {minIntervalMs, maxIntervalMs}) doesn't get silently clamped by the unspecified default.\n // Concrete failure mode without this: customer sets only `minIntervalMs: 30_000`, the store's\n // `maxInterval` falls back to `MAX_INTERVAL = 10_000`, and `shouldSplitEventsList` then\n // caps the effective interval at 10s — silently negating the customer's tune-up.\n // The user-supplied value always wins; we fill in the other side to match.\n if (sanitized.minIntervalMs !== undefined || sanitized.maxIntervalMs !== undefined) {\n const effectiveMin = sanitized.minIntervalMs ?? MIN_INTERVAL;\n const effectiveMax = sanitized.maxIntervalMs ?? MAX_INTERVAL;\n if (effectiveMax < effectiveMin) {\n if (sanitized.maxIntervalMs === undefined) {\n loggerProvider.warn(\n `flushIntervalConfig.minIntervalMs (${effectiveMin}) exceeds the default maxIntervalMs (${MAX_INTERVAL}); raising max to match min.`,\n );\n sanitized.maxIntervalMs = effectiveMin;\n } else if (sanitized.minIntervalMs === undefined) {\n loggerProvider.warn(\n `flushIntervalConfig.maxIntervalMs (${effectiveMax}) is below the default minIntervalMs (${MIN_INTERVAL}); lowering min to match max.`,\n );\n sanitized.minIntervalMs = effectiveMax;\n } else {\n loggerProvider.warn(\n `flushIntervalConfig.maxIntervalMs (${sanitized.maxIntervalMs}) is less than minIntervalMs (${sanitized.minIntervalMs}); raising max to match min.`,\n );\n sanitized.maxIntervalMs = sanitized.minIntervalMs;\n }\n }\n }\n return sanitized;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"local-config.js","sourceRoot":"","sources":["../../../src/config/local-config.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAW,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC9F,OAAO,EAC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Aa,GAAG,2BAA2B,CAAC;SACvD;aAAM;YACL,SAAS,CAAC,aAAa,GAAG,GAAG,CAAC,aAAa,CAAC;SAC7C;KACF;IACD,4FAA4F;IAC5F,2FAA2F;IAC3F,8FAA8F;IAC9F,wFAAwF;IACxF,iFAAiF;IACjF,2EAA2E;IAC3E,IAAI,SAAS,CAAC,aAAa,KAAK,SAAS,IAAI,SAAS,CAAC,aAAa,KAAK,SAAS,EAAE;QAClF,IAAM,YAAY,GAAG,MAAA,SAAS,CAAC,aAAa,mCAAI,YAAY,CAAC;QAC7D,IAAM,YAAY,GAAG,MAAA,SAAS,CAAC,aAAa,mCAAI,YAAY,CAAC;QAC7D,IAAI,YAAY,GAAG,YAAY,EAAE;YAC/B,IAAI,SAAS,CAAC,aAAa,KAAK,SAAS,EAAE;gBACzC,cAAc,CAAC,IAAI,CACjB,6CAAsC,YAAY,kDAAwC,YAAY,iCAA8B,CACrI,CAAC;gBACF,SAAS,CAAC,aAAa,GAAG,YAAY,CAAC;aACxC;iBAAM,IAAI,SAAS,CAAC,aAAa,KAAK,SAAS,EAAE;gBAChD,cAAc,CAAC,IAAI,CACjB,6CAAsC,YAAY,mDAAyC,YAAY,kCAA+B,CACvI,CAAC;gBACF,SAAS,CAAC,aAAa,GAAG,YAAY,CAAC;aACxC;iBAAM;gBACL,cAAc,CAAC,IAAI,CACjB,6CAAsC,SAAS,CAAC,aAAa,2CAAiC,SAAS,CAAC,aAAa,iCAA8B,CACpJ,CAAC;gBACF,SAAS,CAAC,aAAa,GAAG,SAAS,CAAC,aAAa,CAAC;aACnD;SACF;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import type { SemanticAnalyticsContext, SemanticCaptureOptions } from '../semantic-types';\nimport { Config, ILogger, Logger, FetchTransport, LogLevel } from '@amplitude/analytics-core';\nimport {\n DEFAULT_FLUSH_MAX_INTERVAL_MS,\n DEFAULT_FLUSH_MIN_INTERVAL_MS,\n DEFAULT_PERFORMANCE_CONFIG,\n DEFAULT_SAMPLE_RATE,\n DEFAULT_SERVER_ZONE,\n DEFAULT_URL_CHANGE_POLLING_INTERVAL,\n MAX_INTERVAL,\n MIN_INTERVAL,\n UNMASK_TEXT_CLASS,\n} from '../constants';\nimport { SessionReplayOptions, StoreType } from '../typings/session-replay';\nimport {\n SessionReplayLocalConfig as ISessionReplayLocalConfig,\n CrossOriginIframesConfig,\n FlushIntervalConfig,\n InteractionConfig,\n PrivacyConfig,\n SessionReplayPerformanceConfig,\n SessionReplayVersion,\n SessionReplaySendEventsHandler,\n SessionReplayFetchConfigHandler,\n} from './types';\nimport { SafeLoggerProvider } from '../logger';\nimport { validateUGCFilterRules } from '../helpers';\n\nexport const getDefaultConfig = () => ({\n flushMaxRetries: 2,\n logLevel: LogLevel.Warn,\n loggerProvider: new Logger(),\n transportProvider: new FetchTransport(),\n});\n\nexport class SessionReplayLocalConfig extends Config implements ISessionReplayLocalConfig {\n apiKey: string;\n sampleRate: number;\n privacyConfig?: PrivacyConfig;\n semanticCapture?: SemanticCaptureOptions;\n semanticAnalyticsContext?: SemanticAnalyticsContext;\n interactionConfig?: InteractionConfig;\n debugMode?: boolean;\n configServerUrl?: string;\n trackServerUrl?: string;\n shouldInlineStylesheet?: boolean;\n inlineImages?: boolean;\n version?: SessionReplayVersion;\n storeType: StoreType;\n performanceConfig?: SessionReplayPerformanceConfig;\n useWebWorker?: boolean;\n enableTransportCompression?: boolean;\n sendTimeoutMs?: number;\n applyBackgroundColorToBlockedElements?: boolean;\n enableUrlChangePolling?: boolean;\n urlChangePollingInterval?: number;\n captureDocumentTitle?: boolean;\n captureAdoptedStyleSheets?: boolean;\n crossOriginIframes?: CrossOriginIframesConfig;\n fullSnapshotIntervalMs?: number;\n flushIntervalConfig?: FlushIntervalConfig;\n eagerFullSnapshotSend?: boolean;\n captureFullSnapshotOnFocus?: boolean;\n maxPersistedEventsSizeBytes?: number;\n maxSingleEventSizeBytes?: number;\n handleSendEvents?: SessionReplaySendEventsHandler;\n handleFetchConfig?: SessionReplayFetchConfigHandler;\n\n constructor(apiKey: string, options: SessionReplayOptions) {\n const defaultConfig = getDefaultConfig();\n super({\n transportProvider: defaultConfig.transportProvider,\n loggerProvider: new SafeLoggerProvider(options.loggerProvider || defaultConfig.loggerProvider),\n ...options,\n apiKey,\n });\n this.flushMaxRetries =\n options.flushMaxRetries !== undefined && options.flushMaxRetries <= defaultConfig.flushMaxRetries\n ? options.flushMaxRetries\n : defaultConfig.flushMaxRetries;\n\n this.apiKey = apiKey;\n this.sampleRate = options.sampleRate || DEFAULT_SAMPLE_RATE;\n this.semanticCapture = options.semanticCapture;\n this.semanticAnalyticsContext = options.semanticAnalyticsContext;\n this.serverZone = options.serverZone || DEFAULT_SERVER_ZONE;\n this.configServerUrl = options.configServerUrl;\n this.trackServerUrl = options.trackServerUrl;\n this.shouldInlineStylesheet = options.shouldInlineStylesheet;\n this.inlineImages = options.inlineImages;\n this.version = options.version;\n this.performanceConfig = options.performanceConfig || DEFAULT_PERFORMANCE_CONFIG;\n this.storeType = options.storeType ?? 'memory';\n this.applyBackgroundColorToBlockedElements = options.applyBackgroundColorToBlockedElements ?? false;\n this.enableUrlChangePolling = options.enableUrlChangePolling ?? false;\n this.urlChangePollingInterval = options.urlChangePollingInterval ?? DEFAULT_URL_CHANGE_POLLING_INTERVAL;\n this.captureDocumentTitle = options.captureDocumentTitle ?? false;\n if (options.fullSnapshotIntervalMs !== undefined) {\n this.fullSnapshotIntervalMs = options.fullSnapshotIntervalMs;\n }\n if (options.eagerFullSnapshotSend !== undefined) {\n this.eagerFullSnapshotSend = options.eagerFullSnapshotSend;\n }\n // Defaults to false: the on-focus full\n // snapshot is off unless the consumer explicitly opts in. A focus that arrives from\n // another visible window still takes one checkout, including a return from a window\n // switch that started while an iframe in this page was focused. Same-page iframe\n // focus does not.\n this.captureFullSnapshotOnFocus = options.captureFullSnapshotOnFocus ?? false;\n if (options.maxPersistedEventsSizeBytes !== undefined) {\n this.maxPersistedEventsSizeBytes = sanitizeByteSize(\n options.maxPersistedEventsSizeBytes,\n MIN_EVENT_BYTE_SIZE,\n MAX_PERSISTED_EVENTS_SIZE_CEILING,\n 'maxPersistedEventsSizeBytes',\n this.loggerProvider,\n );\n }\n if (options.maxSingleEventSizeBytes !== undefined) {\n this.maxSingleEventSizeBytes = sanitizeByteSize(\n options.maxSingleEventSizeBytes,\n MIN_EVENT_BYTE_SIZE,\n MAX_SINGLE_EVENT_SIZE_CEILING,\n 'maxSingleEventSizeBytes',\n this.loggerProvider,\n );\n }\n\n // Auto-include .amp-unmask as a default unmaskSelector entry so it works\n // symmetrically with amp-mask/amp-block without requiring explicit config (SR-2945).\n this.privacyConfig = {\n ...(options.privacyConfig ?? {}),\n unmaskSelector: Array.from(new Set([`.${UNMASK_TEXT_CLASS}`, ...(options.privacyConfig?.unmaskSelector ?? [])])),\n };\n if (options.interactionConfig) {\n this.interactionConfig = options.interactionConfig;\n\n // validate ugcFilterRules, throw error if invalid - throw error at the beginning of the config\n if (this.interactionConfig.ugcFilterRules) {\n validateUGCFilterRules(this.interactionConfig.ugcFilterRules);\n }\n }\n if (options.debugMode) {\n this.debugMode = options.debugMode;\n }\n // Support both new useWebWorker and legacy experimental.useWebWorker for backwards\n // compatibility. Defaults to true per the validated amp-on-amp perf config (SR-4646):\n // compression runs off the main thread unless the consumer explicitly sets either flag\n // to false. The top-level option wins over the legacy experimental one when both are set.\n const legacyOptions = options as { experimental?: { useWebWorker?: boolean } };\n this.useWebWorker = options.useWebWorker ?? legacyOptions.experimental?.useWebWorker ?? true;\n this.enableTransportCompression = options.enableTransportCompression ?? true;\n // Pass through undefined so the track destination applies its SEND_TIMEOUT_MS default;\n // an explicit 0 is preserved (disables the timeout).\n this.sendTimeoutMs = options.sendTimeoutMs;\n this.captureAdoptedStyleSheets = options.captureAdoptedStyleSheets ?? true;\n if (options.crossOriginIframes) {\n this.crossOriginIframes = options.crossOriginIframes;\n }\n if (options.flushIntervalConfig) {\n this.flushIntervalConfig = sanitizeFlushIntervalConfig(options.flushIntervalConfig, this.loggerProvider);\n } else {\n // Default to the validated amp-on-amp perf config (SR-4646). The values are known-valid\n // (min <= max, both above the floor), so no sanitization is required.\n this.flushIntervalConfig = {\n minIntervalMs: DEFAULT_FLUSH_MIN_INTERVAL_MS,\n maxIntervalMs: DEFAULT_FLUSH_MAX_INTERVAL_MS,\n };\n }\n this.handleSendEvents = options.handleSendEvents;\n this.handleFetchConfig = options.handleFetchConfig;\n }\n}\n\n// 100ms floor avoids degenerate configs (0/negative) that would split on every event.\n// Customers wanting fewer requests should be raising the value, not lowering it; the floor\n// is just a defensive guard against typos and unsigned-int rollovers.\nconst MIN_FLUSH_INTERVAL_FLOOR_MS = 100;\n\n// Shared 1 KB floor for the byte-size overrides — small enough to exercise splitting/drops\n// while debugging, large enough to avoid a 0/negative config that splits on every event.\nconst MIN_EVENT_BYTE_SIZE = 1_000;\n// Batch cap ceiling: stay under the SR ingest service's 10 MB decompressed split threshold\n// (above which the server splits the batch itself) with headroom for the request wrapper.\nconst MAX_PERSISTED_EVENTS_SIZE_CEILING = 8_000_000;\n// Single-event ceiling: the server rejects a single event above ~10 MB, so never allow an\n// override to exceed that.\nconst MAX_SINGLE_EVENT_SIZE_CEILING = 10_000_000;\n\n// Defensive bounds for the byte-size overrides. Non-finite inputs are ignored (fall back to\n// the SDK default); out-of-range values are clamped and logged so a typo can't silently\n// disable splitting or push past the server's limits.\nfunction sanitizeByteSize(\n raw: number,\n min: number,\n max: number,\n name: string,\n loggerProvider: ILogger,\n): number | undefined {\n if (!Number.isFinite(raw)) {\n loggerProvider.warn(`${name} value is not a finite number (got ${String(raw)}); ignoring.`);\n return undefined;\n }\n if (raw < min) {\n loggerProvider.warn(`${name} ${raw} is below floor ${min}; clamping.`);\n return min;\n }\n if (raw > max) {\n loggerProvider.warn(`${name} ${raw} exceeds ceiling ${max}; clamping.`);\n return max;\n }\n return raw;\n}\n\nfunction sanitizeFlushIntervalConfig(raw: FlushIntervalConfig, loggerProvider: ILogger): FlushIntervalConfig {\n const sanitized: FlushIntervalConfig = {};\n if (raw.minIntervalMs !== undefined) {\n if (!Number.isFinite(raw.minIntervalMs) || raw.minIntervalMs < MIN_FLUSH_INTERVAL_FLOOR_MS) {\n loggerProvider.warn(\n `flushIntervalConfig.minIntervalMs ${raw.minIntervalMs} is below floor ${MIN_FLUSH_INTERVAL_FLOOR_MS}ms; clamping.`,\n );\n sanitized.minIntervalMs = MIN_FLUSH_INTERVAL_FLOOR_MS;\n } else {\n sanitized.minIntervalMs = raw.minIntervalMs;\n }\n }\n if (raw.maxIntervalMs !== undefined) {\n // Unlike min, `Infinity` is a meaningful value here: it means \"no upper bound on interval\n // growth\" (Math.min(Infinity, x) === x in BaseEventsStore.shouldSplitEventsList). Reject\n // only NaN and sub-floor values; pass Infinity through.\n if (Number.isNaN(raw.maxIntervalMs) || raw.maxIntervalMs < MIN_FLUSH_INTERVAL_FLOOR_MS) {\n loggerProvider.warn(\n `flushIntervalConfig.maxIntervalMs ${raw.maxIntervalMs} is below floor ${MIN_FLUSH_INTERVAL_FLOOR_MS}ms; clamping.`,\n );\n sanitized.maxIntervalMs = MIN_FLUSH_INTERVAL_FLOOR_MS;\n } else {\n sanitized.maxIntervalMs = raw.maxIntervalMs;\n }\n }\n // Cross-validate against the SDK's effective defaults so that a partial config (only one of\n // {minIntervalMs, maxIntervalMs}) doesn't get silently clamped by the unspecified default.\n // Concrete failure mode without this: customer sets only `minIntervalMs: 30_000`, the store's\n // `maxInterval` falls back to `MAX_INTERVAL = 10_000`, and `shouldSplitEventsList` then\n // caps the effective interval at 10s — silently negating the customer's tune-up.\n // The user-supplied value always wins; we fill in the other side to match.\n if (sanitized.minIntervalMs !== undefined || sanitized.maxIntervalMs !== undefined) {\n const effectiveMin = sanitized.minIntervalMs ?? MIN_INTERVAL;\n const effectiveMax = sanitized.maxIntervalMs ?? MAX_INTERVAL;\n if (effectiveMax < effectiveMin) {\n if (sanitized.maxIntervalMs === undefined) {\n loggerProvider.warn(\n `flushIntervalConfig.minIntervalMs (${effectiveMin}) exceeds the default maxIntervalMs (${MAX_INTERVAL}); raising max to match min.`,\n );\n sanitized.maxIntervalMs = effectiveMin;\n } else if (sanitized.minIntervalMs === undefined) {\n loggerProvider.warn(\n `flushIntervalConfig.maxIntervalMs (${effectiveMax}) is below the default minIntervalMs (${MIN_INTERVAL}); lowering min to match max.`,\n );\n sanitized.minIntervalMs = effectiveMax;\n } else {\n loggerProvider.warn(\n `flushIntervalConfig.maxIntervalMs (${sanitized.maxIntervalMs}) is less than minIntervalMs (${sanitized.minIntervalMs}); raising max to match min.`,\n );\n sanitized.maxIntervalMs = sanitized.minIntervalMs;\n }\n }\n }\n return sanitized;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SemanticAnalyticsContext, SemanticCaptureConfig, SemanticCaptureOptions } from '../semantic-types';
|
|
2
2
|
import type { PrivacyConfig } from '@amplitude/session-replay-dom-privacy';
|
|
3
3
|
export type { PrivacyConfig, MaskLevel } from '@amplitude/session-replay-dom-privacy';
|
|
4
4
|
import { IConfig, LogLevel, ILogger } from '@amplitude/analytics-core';
|
|
@@ -165,9 +165,9 @@ export interface SessionReplayLocalConfig extends IConfig {
|
|
|
165
165
|
sampleRate: number;
|
|
166
166
|
privacyConfig?: PrivacyConfig;
|
|
167
167
|
/** Optional semantic events in the replay stream. Disabled by default. */
|
|
168
|
-
semanticCapture?:
|
|
168
|
+
semanticCapture?: SemanticCaptureOptions;
|
|
169
169
|
/** @internal Supplied by the analytics plugin host. */
|
|
170
|
-
semanticAnalyticsContext?:
|
|
170
|
+
semanticAnalyticsContext?: SemanticAnalyticsContext;
|
|
171
171
|
/**
|
|
172
172
|
* Adds additional debug event property to help debug instrumentation issues
|
|
173
173
|
* (such as mismatching apps). Only recommended for debugging initial setup,
|
|
@@ -338,18 +338,26 @@ export interface SessionReplayLocalConfig extends IConfig {
|
|
|
338
338
|
eagerFullSnapshotSend?: boolean;
|
|
339
339
|
/**
|
|
340
340
|
* When true, the window `focus` listener forces a fresh rrweb full snapshot
|
|
341
|
-
* (`takeFullSnapshot`) every time the page regains focus
|
|
342
|
-
* changes that happened while the tab was backgrounded. When false (default), the on-focus
|
|
341
|
+
* (`takeFullSnapshot`) every time the page regains focus. When false (default), the on-focus
|
|
343
342
|
* full snapshot is skipped entirely (recording simply continues from the existing stream).
|
|
344
343
|
*
|
|
345
344
|
* On pages with heavy focus churn (e.g. embedded iframes, inline editors that repeatedly
|
|
346
345
|
* steal and return focus) this fires constantly, and when combined with
|
|
347
346
|
* `eagerFullSnapshotSend` each focus produces an immediate network send — the primary
|
|
348
|
-
* driver of focus-driven request storms.
|
|
349
|
-
* therefore the send) at the cost of slightly staler post-focus frames.
|
|
347
|
+
* driver of focus-driven request storms.
|
|
350
348
|
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
349
|
+
* Switching browser tabs does not depend on this flag. Hiding the document flushes
|
|
350
|
+
* mutations still waiting on the idle queue, and showing it takes one checkout snapshot
|
|
351
|
+
* so playback is not left on an older snapshot from this tab or from another tab that
|
|
352
|
+
* shares the session. `visibilitychange` fires once per tab switch, so that path stays
|
|
353
|
+
* on when focus snapshots are off.
|
|
354
|
+
*
|
|
355
|
+
* Two windows that both stay visible never hide, so focus arriving from outside this
|
|
356
|
+
* window still takes one checkout. Focus that only moved into an iframe in this page
|
|
357
|
+
* does not. Leaving that iframe for another window does not blur the parent again;
|
|
358
|
+
* the return still takes one checkout.
|
|
359
|
+
*
|
|
360
|
+
* @defaultValue false. Was `true` before the on-focus snapshot default changed.
|
|
353
361
|
*/
|
|
354
362
|
captureFullSnapshotOnFocus?: boolean;
|
|
355
363
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/config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