@openreplay/tracker 18.1.0-beta.0 → 18.1.1
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/cjs/entry.js +56 -3
- package/dist/cjs/entry.js.map +1 -1
- package/dist/cjs/index.js +56 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/main/app/guards.d.ts +1 -0
- package/dist/cjs/main/app/observer/top_observer.d.ts +4 -0
- package/dist/lib/entry.js +56 -3
- package/dist/lib/entry.js.map +1 -1
- package/dist/lib/index.js +56 -3
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/main/app/guards.d.ts +1 -0
- package/dist/lib/main/app/observer/top_observer.d.ts +4 -0
- package/dist/types/main/app/guards.d.ts +1 -0
- package/dist/types/main/app/observer/top_observer.d.ts +4 -0
- package/package.json +1 -1
|
@@ -19,6 +19,7 @@ type TagTypeMap = {
|
|
|
19
19
|
link: HTMLLinkElement;
|
|
20
20
|
canvas: HTMLCanvasElement;
|
|
21
21
|
slot: HTMLSlotElement;
|
|
22
|
+
dialog: HTMLDialogElement;
|
|
22
23
|
};
|
|
23
24
|
export declare function hasTag<T extends keyof TagTypeMap>(el: Node, tagName: T): el is TagTypeMap[typeof tagName];
|
|
24
25
|
export {};
|
|
@@ -46,6 +46,10 @@ export default class TopObserver extends Observer {
|
|
|
46
46
|
private shadowRootObservers;
|
|
47
47
|
private handleShadowRoot;
|
|
48
48
|
observe(): void;
|
|
49
|
+
private colorSchemeMQL;
|
|
50
|
+
private colorSchemeListener;
|
|
51
|
+
/** Send resolved used color-scheme ('dark'|'light'|'normal') for the player to force on replay. */
|
|
52
|
+
private sendColorScheme;
|
|
49
53
|
crossdomainObserve(rootNodeId: number, frameOder: number, frameLevel: number): void;
|
|
50
54
|
disconnect(): void;
|
|
51
55
|
}
|
package/dist/lib/entry.js
CHANGED
|
@@ -3308,6 +3308,25 @@ class Observer {
|
|
|
3308
3308
|
}
|
|
3309
3309
|
return;
|
|
3310
3310
|
}
|
|
3311
|
+
// `open` alone can't tell showModal() (modal/top-layer) from show()/`<dialog open>`
|
|
3312
|
+
// (non-modal); emit the mode alongside it so the player replays the right call (see DOMManager).
|
|
3313
|
+
if (name === 'open' && hasTag(node, 'dialog')) {
|
|
3314
|
+
let mode;
|
|
3315
|
+
if (value === null) {
|
|
3316
|
+
mode = 'closed';
|
|
3317
|
+
}
|
|
3318
|
+
else {
|
|
3319
|
+
let isModal = false;
|
|
3320
|
+
try {
|
|
3321
|
+
isModal = node.matches('dialog:modal');
|
|
3322
|
+
}
|
|
3323
|
+
catch (e) {
|
|
3324
|
+
/* :modal pseudo-class unsupported on this browser */
|
|
3325
|
+
}
|
|
3326
|
+
mode = isModal ? 'modal' : 'nonmodal';
|
|
3327
|
+
}
|
|
3328
|
+
this.app.send(SetNodeAttribute(id, '__openreplay_dialog', mode));
|
|
3329
|
+
}
|
|
3311
3330
|
if (name === 'src' ||
|
|
3312
3331
|
name === 'srcset' ||
|
|
3313
3332
|
name === 'integrity' ||
|
|
@@ -3916,6 +3935,8 @@ class TopObserver extends Observer {
|
|
|
3916
3935
|
this.iframeObservers = new WeakMap();
|
|
3917
3936
|
this.docObservers = new WeakMap();
|
|
3918
3937
|
this.shadowRootObservers = new WeakMap();
|
|
3938
|
+
this.colorSchemeMQL = null;
|
|
3939
|
+
this.colorSchemeListener = null;
|
|
3919
3940
|
this.app = params.app;
|
|
3920
3941
|
this.options = opts;
|
|
3921
3942
|
// IFrames
|
|
@@ -4010,9 +4031,36 @@ class TopObserver extends Observer {
|
|
|
4010
4031
|
// it has no node_id here
|
|
4011
4032
|
this.app.nodes.callNodeCallbacks(document, true);
|
|
4012
4033
|
}, window.document.documentElement);
|
|
4034
|
+
// Send before `orloaded` so it lands in the initial visual batch (see sendColorScheme).
|
|
4035
|
+
this.sendColorScheme();
|
|
4013
4036
|
// "DOM parsed" signal: observeRoot sent the full initial tree synchronously above.
|
|
4014
4037
|
// The worker keys on this attribute (BatchWriter) to finalize the visual batch.
|
|
4015
4038
|
this.app.send(SetNodeAttribute(0, 'orloaded', 'true'));
|
|
4039
|
+
if (IN_BROWSER && window.matchMedia) {
|
|
4040
|
+
this.colorSchemeMQL = window.matchMedia('(prefers-color-scheme: dark)');
|
|
4041
|
+
this.colorSchemeListener = this.app.safe(() => this.sendColorScheme());
|
|
4042
|
+
this.colorSchemeMQL.addEventListener?.('change', this.colorSchemeListener);
|
|
4043
|
+
}
|
|
4044
|
+
}
|
|
4045
|
+
/** Send resolved used color-scheme ('dark'|'light'|'normal') for the player to force on replay. */
|
|
4046
|
+
sendColorScheme() {
|
|
4047
|
+
if (!IN_BROWSER)
|
|
4048
|
+
return;
|
|
4049
|
+
const root = document.documentElement;
|
|
4050
|
+
let declared = getComputedStyle(root).colorScheme;
|
|
4051
|
+
if (!declared || declared === 'normal') {
|
|
4052
|
+
const meta = document.querySelector('meta[name="color-scheme" i]');
|
|
4053
|
+
const content = meta && meta.getAttribute('content');
|
|
4054
|
+
if (content)
|
|
4055
|
+
declared = content;
|
|
4056
|
+
}
|
|
4057
|
+
let used = 'normal';
|
|
4058
|
+
if (declared && declared !== 'normal') {
|
|
4059
|
+
const prefersDark = !!window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
4060
|
+
// resolve declared support against OS preference into the concrete used scheme
|
|
4061
|
+
used = declared.includes('dark') && (prefersDark || !declared.includes('light')) ? 'dark' : 'light';
|
|
4062
|
+
}
|
|
4063
|
+
this.app.send(SetNodeAttribute(0, '__openreplay_color_scheme', used));
|
|
4016
4064
|
}
|
|
4017
4065
|
crossdomainObserve(rootNodeId, frameOder, frameLevel) {
|
|
4018
4066
|
const observer = this;
|
|
@@ -4032,6 +4080,11 @@ class TopObserver extends Observer {
|
|
|
4032
4080
|
iframeObserver.syntheticObserve(rootNodeId, window.document);
|
|
4033
4081
|
}
|
|
4034
4082
|
disconnect() {
|
|
4083
|
+
if (this.colorSchemeMQL && this.colorSchemeListener) {
|
|
4084
|
+
this.colorSchemeMQL.removeEventListener?.('change', this.colorSchemeListener);
|
|
4085
|
+
}
|
|
4086
|
+
this.colorSchemeMQL = null;
|
|
4087
|
+
this.colorSchemeListener = null;
|
|
4035
4088
|
this.iframeOffsets.clear();
|
|
4036
4089
|
Element.prototype.attachShadow = attachShadowNativeFn;
|
|
4037
4090
|
this.iframeObserversArr.forEach((observer) => observer.disconnect());
|
|
@@ -4307,7 +4360,7 @@ class App {
|
|
|
4307
4360
|
this.stopCallbacks = [];
|
|
4308
4361
|
this.commitCallbacks = [];
|
|
4309
4362
|
this.activityState = ActivityState.NotActive;
|
|
4310
|
-
this.version = '18.1.
|
|
4363
|
+
this.version = '18.1.1'; // TODO: version compatability check inside each plugin.
|
|
4311
4364
|
this.socketMode = false;
|
|
4312
4365
|
this.compressionThreshold = 24 * 1000;
|
|
4313
4366
|
this.bc = null;
|
|
@@ -9720,7 +9773,7 @@ class ConstantProperties {
|
|
|
9720
9773
|
user_id: this.user_id,
|
|
9721
9774
|
distinct_id: this.deviceId,
|
|
9722
9775
|
sdk_edition: 'web',
|
|
9723
|
-
sdk_version: '18.1.
|
|
9776
|
+
sdk_version: '18.1.1',
|
|
9724
9777
|
timezone: getUTCOffsetString(),
|
|
9725
9778
|
search_engine: this.searchEngine,
|
|
9726
9779
|
};
|
|
@@ -10461,7 +10514,7 @@ class API {
|
|
|
10461
10514
|
this.signalStartIssue = (reason, missingApi) => {
|
|
10462
10515
|
const doNotTrack = this.checkDoNotTrack();
|
|
10463
10516
|
console.log("Tracker couldn't start due to:", JSON.stringify({
|
|
10464
|
-
trackerVersion: '18.1.
|
|
10517
|
+
trackerVersion: '18.1.1',
|
|
10465
10518
|
projectKey: this.options.projectKey,
|
|
10466
10519
|
doNotTrack,
|
|
10467
10520
|
reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,
|