@sentry/replay 7.55.0 → 7.55.2
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/cjs/index.js +51 -51
- package/cjs/index.js.map +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/package.json +5 -5
- package/types/index.d.ts +1 -5
- package/types/index.d.ts.map +1 -1
- package/types/types/replayFrame.d.ts +1 -1
- package/types/types/replayFrame.d.ts.map +1 -1
- package/types/types/rrweb.d.ts +10 -1
- package/types/types/rrweb.d.ts.map +1 -1
package/cjs/index.js
CHANGED
|
@@ -45,7 +45,7 @@ const SLOW_CLICK_THRESHOLD = 3000;
|
|
|
45
45
|
/* For scroll actions after a click, we only look for a very short time period to detect programmatic scrolling. */
|
|
46
46
|
const SLOW_CLICK_SCROLL_TIMEOUT = 300;
|
|
47
47
|
|
|
48
|
-
var NodeType;
|
|
48
|
+
var NodeType$1;
|
|
49
49
|
(function (NodeType) {
|
|
50
50
|
NodeType[NodeType["Document"] = 0] = "Document";
|
|
51
51
|
NodeType[NodeType["DocumentType"] = 1] = "DocumentType";
|
|
@@ -53,7 +53,7 @@ var NodeType;
|
|
|
53
53
|
NodeType[NodeType["Text"] = 3] = "Text";
|
|
54
54
|
NodeType[NodeType["CDATA"] = 4] = "CDATA";
|
|
55
55
|
NodeType[NodeType["Comment"] = 5] = "Comment";
|
|
56
|
-
})(NodeType || (NodeType = {}));
|
|
56
|
+
})(NodeType$1 || (NodeType$1 = {}));
|
|
57
57
|
|
|
58
58
|
function isElement(n) {
|
|
59
59
|
return n.nodeType === n.ELEMENT_NODE;
|
|
@@ -457,7 +457,7 @@ function serializeNode(n, options) {
|
|
|
457
457
|
case n.DOCUMENT_NODE:
|
|
458
458
|
if (n.compatMode !== 'CSS1Compat') {
|
|
459
459
|
return {
|
|
460
|
-
type: NodeType.Document,
|
|
460
|
+
type: NodeType$1.Document,
|
|
461
461
|
childNodes: [],
|
|
462
462
|
compatMode: n.compatMode,
|
|
463
463
|
rootId,
|
|
@@ -465,14 +465,14 @@ function serializeNode(n, options) {
|
|
|
465
465
|
}
|
|
466
466
|
else {
|
|
467
467
|
return {
|
|
468
|
-
type: NodeType.Document,
|
|
468
|
+
type: NodeType$1.Document,
|
|
469
469
|
childNodes: [],
|
|
470
470
|
rootId,
|
|
471
471
|
};
|
|
472
472
|
}
|
|
473
473
|
case n.DOCUMENT_TYPE_NODE:
|
|
474
474
|
return {
|
|
475
|
-
type: NodeType.DocumentType,
|
|
475
|
+
type: NodeType$1.DocumentType,
|
|
476
476
|
name: n.name,
|
|
477
477
|
publicId: n.publicId,
|
|
478
478
|
systemId: n.systemId,
|
|
@@ -616,7 +616,7 @@ function serializeNode(n, options) {
|
|
|
616
616
|
delete attributes.src;
|
|
617
617
|
}
|
|
618
618
|
return {
|
|
619
|
-
type: NodeType.Element,
|
|
619
|
+
type: NodeType$1.Element,
|
|
620
620
|
tagName,
|
|
621
621
|
attributes,
|
|
622
622
|
childNodes: [],
|
|
@@ -670,20 +670,20 @@ function serializeNode(n, options) {
|
|
|
670
670
|
: defaultMaskFn(textContent);
|
|
671
671
|
}
|
|
672
672
|
return {
|
|
673
|
-
type: NodeType.Text,
|
|
673
|
+
type: NodeType$1.Text,
|
|
674
674
|
textContent: textContent || '',
|
|
675
675
|
isStyle,
|
|
676
676
|
rootId,
|
|
677
677
|
};
|
|
678
678
|
case n.CDATA_SECTION_NODE:
|
|
679
679
|
return {
|
|
680
|
-
type: NodeType.CDATA,
|
|
680
|
+
type: NodeType$1.CDATA,
|
|
681
681
|
textContent: '',
|
|
682
682
|
rootId,
|
|
683
683
|
};
|
|
684
684
|
case n.COMMENT_NODE:
|
|
685
685
|
return {
|
|
686
|
-
type: NodeType.Comment,
|
|
686
|
+
type: NodeType$1.Comment,
|
|
687
687
|
textContent: n.textContent || '',
|
|
688
688
|
rootId,
|
|
689
689
|
};
|
|
@@ -700,10 +700,10 @@ function lowerIfExists(maybeAttr) {
|
|
|
700
700
|
}
|
|
701
701
|
}
|
|
702
702
|
function slimDOMExcluded(sn, slimDOMOptions) {
|
|
703
|
-
if (slimDOMOptions.comment && sn.type === NodeType.Comment) {
|
|
703
|
+
if (slimDOMOptions.comment && sn.type === NodeType$1.Comment) {
|
|
704
704
|
return true;
|
|
705
705
|
}
|
|
706
|
-
else if (sn.type === NodeType.Element) {
|
|
706
|
+
else if (sn.type === NodeType$1.Element) {
|
|
707
707
|
if (slimDOMOptions.script &&
|
|
708
708
|
(sn.tagName === 'script' ||
|
|
709
709
|
(sn.tagName === 'link' &&
|
|
@@ -804,7 +804,7 @@ function serializeNodeWithId(n, options) {
|
|
|
804
804
|
}
|
|
805
805
|
else if (slimDOMExcluded(_serializedNode, slimDOMOptions) ||
|
|
806
806
|
(!preserveWhiteSpace &&
|
|
807
|
-
_serializedNode.type === NodeType.Text &&
|
|
807
|
+
_serializedNode.type === NodeType$1.Text &&
|
|
808
808
|
!_serializedNode.isStyle &&
|
|
809
809
|
!_serializedNode.textContent.replace(/^\s+|\s+$/gm, '').length)) {
|
|
810
810
|
id = IGNORED_NODE;
|
|
@@ -822,17 +822,17 @@ function serializeNodeWithId(n, options) {
|
|
|
822
822
|
onSerialize(n);
|
|
823
823
|
}
|
|
824
824
|
let recordChild = !skipChild;
|
|
825
|
-
if (serializedNode.type === NodeType.Element) {
|
|
825
|
+
if (serializedNode.type === NodeType$1.Element) {
|
|
826
826
|
recordChild = recordChild && !serializedNode.needBlock;
|
|
827
827
|
delete serializedNode.needBlock;
|
|
828
828
|
if (n.shadowRoot)
|
|
829
829
|
serializedNode.isShadowHost = true;
|
|
830
830
|
}
|
|
831
|
-
if ((serializedNode.type === NodeType.Document ||
|
|
832
|
-
serializedNode.type === NodeType.Element) &&
|
|
831
|
+
if ((serializedNode.type === NodeType$1.Document ||
|
|
832
|
+
serializedNode.type === NodeType$1.Element) &&
|
|
833
833
|
recordChild) {
|
|
834
834
|
if (slimDOMOptions.headWhitespace &&
|
|
835
|
-
_serializedNode.type === NodeType.Element &&
|
|
835
|
+
_serializedNode.type === NodeType$1.Element &&
|
|
836
836
|
_serializedNode.tagName === 'head') {
|
|
837
837
|
preserveWhiteSpace = false;
|
|
838
838
|
}
|
|
@@ -882,7 +882,7 @@ function serializeNodeWithId(n, options) {
|
|
|
882
882
|
if (n.parentNode && isShadowRoot(n.parentNode)) {
|
|
883
883
|
serializedNode.isShadow = true;
|
|
884
884
|
}
|
|
885
|
-
if (serializedNode.type === NodeType.Element &&
|
|
885
|
+
if (serializedNode.type === NodeType$1.Element &&
|
|
886
886
|
serializedNode.tagName === 'iframe') {
|
|
887
887
|
onceIframeLoaded(n, () => {
|
|
888
888
|
const iframeDoc = n.contentDocument;
|
|
@@ -998,7 +998,7 @@ function skipAttribute(tagName, attributeName, value) {
|
|
|
998
998
|
return ((tagName === 'video' || tagName === 'audio') && attributeName === 'autoplay');
|
|
999
999
|
}
|
|
1000
1000
|
|
|
1001
|
-
|
|
1001
|
+
var EventType;
|
|
1002
1002
|
(function (EventType) {
|
|
1003
1003
|
EventType[EventType["DomContentLoaded"] = 0] = "DomContentLoaded";
|
|
1004
1004
|
EventType[EventType["Load"] = 1] = "Load";
|
|
@@ -1007,7 +1007,7 @@ exports.EventType = void 0;
|
|
|
1007
1007
|
EventType[EventType["Meta"] = 4] = "Meta";
|
|
1008
1008
|
EventType[EventType["Custom"] = 5] = "Custom";
|
|
1009
1009
|
EventType[EventType["Plugin"] = 6] = "Plugin";
|
|
1010
|
-
})(
|
|
1010
|
+
})(EventType || (EventType = {}));
|
|
1011
1011
|
var IncrementalSource;
|
|
1012
1012
|
(function (IncrementalSource) {
|
|
1013
1013
|
IncrementalSource[IncrementalSource["Mutation"] = 0] = "Mutation";
|
|
@@ -1307,7 +1307,7 @@ function polyfill(win = window) {
|
|
|
1307
1307
|
}
|
|
1308
1308
|
function isIframeINode(node) {
|
|
1309
1309
|
if ('__sn' in node) {
|
|
1310
|
-
return (node.__sn.type === NodeType.Element && node.__sn.tagName === 'iframe');
|
|
1310
|
+
return (node.__sn.type === NodeType$1.Element && node.__sn.tagName === 'iframe');
|
|
1311
1311
|
}
|
|
1312
1312
|
return false;
|
|
1313
1313
|
}
|
|
@@ -2980,17 +2980,17 @@ function record(options = {}) {
|
|
|
2980
2980
|
wrappedEmit = (e, isCheckout) => {
|
|
2981
2981
|
var _a;
|
|
2982
2982
|
if (((_a = mutationBuffers[0]) === null || _a === void 0 ? void 0 : _a.isFrozen()) &&
|
|
2983
|
-
e.type !==
|
|
2984
|
-
!(e.type ===
|
|
2983
|
+
e.type !== EventType.FullSnapshot &&
|
|
2984
|
+
!(e.type === EventType.IncrementalSnapshot &&
|
|
2985
2985
|
e.data.source === IncrementalSource.Mutation)) {
|
|
2986
2986
|
mutationBuffers.forEach((buf) => buf.unfreeze());
|
|
2987
2987
|
}
|
|
2988
2988
|
emit(eventProcessor(e), isCheckout);
|
|
2989
|
-
if (e.type ===
|
|
2989
|
+
if (e.type === EventType.FullSnapshot) {
|
|
2990
2990
|
lastFullSnapshotEvent = e;
|
|
2991
2991
|
incrementalSnapshotCount = 0;
|
|
2992
2992
|
}
|
|
2993
|
-
else if (e.type ===
|
|
2993
|
+
else if (e.type === EventType.IncrementalSnapshot) {
|
|
2994
2994
|
if (e.data.source === IncrementalSource.Mutation &&
|
|
2995
2995
|
e.data.isAttachIframe) {
|
|
2996
2996
|
return;
|
|
@@ -3006,16 +3006,16 @@ function record(options = {}) {
|
|
|
3006
3006
|
};
|
|
3007
3007
|
const wrappedMutationEmit = (m) => {
|
|
3008
3008
|
wrappedEmit(wrapEvent({
|
|
3009
|
-
type:
|
|
3009
|
+
type: EventType.IncrementalSnapshot,
|
|
3010
3010
|
data: Object.assign({ source: IncrementalSource.Mutation }, m),
|
|
3011
3011
|
}));
|
|
3012
3012
|
};
|
|
3013
3013
|
const wrappedScrollEmit = (p) => wrappedEmit(wrapEvent({
|
|
3014
|
-
type:
|
|
3014
|
+
type: EventType.IncrementalSnapshot,
|
|
3015
3015
|
data: Object.assign({ source: IncrementalSource.Scroll }, p),
|
|
3016
3016
|
}));
|
|
3017
3017
|
const wrappedCanvasMutationEmit = (p) => wrappedEmit(wrapEvent({
|
|
3018
|
-
type:
|
|
3018
|
+
type: EventType.IncrementalSnapshot,
|
|
3019
3019
|
data: Object.assign({ source: IncrementalSource.CanvasMutation }, p),
|
|
3020
3020
|
}));
|
|
3021
3021
|
const iframeManager = new IframeManager({
|
|
@@ -3060,7 +3060,7 @@ function record(options = {}) {
|
|
|
3060
3060
|
takeFullSnapshot = (isCheckout = false) => {
|
|
3061
3061
|
var _a, _b, _c, _d;
|
|
3062
3062
|
wrappedEmit(wrapEvent({
|
|
3063
|
-
type:
|
|
3063
|
+
type: EventType.Meta,
|
|
3064
3064
|
data: {
|
|
3065
3065
|
href: window.location.href,
|
|
3066
3066
|
width: getWindowWidth(),
|
|
@@ -3103,7 +3103,7 @@ function record(options = {}) {
|
|
|
3103
3103
|
}
|
|
3104
3104
|
mirror.map = idNodeMap;
|
|
3105
3105
|
wrappedEmit(wrapEvent({
|
|
3106
|
-
type:
|
|
3106
|
+
type: EventType.FullSnapshot,
|
|
3107
3107
|
data: {
|
|
3108
3108
|
node,
|
|
3109
3109
|
initialOffset: {
|
|
@@ -3128,7 +3128,7 @@ function record(options = {}) {
|
|
|
3128
3128
|
const handlers = [];
|
|
3129
3129
|
handlers.push(on('DOMContentLoaded', () => {
|
|
3130
3130
|
wrappedEmit(wrapEvent({
|
|
3131
|
-
type:
|
|
3131
|
+
type: EventType.DomContentLoaded,
|
|
3132
3132
|
data: {},
|
|
3133
3133
|
}));
|
|
3134
3134
|
}));
|
|
@@ -3138,40 +3138,40 @@ function record(options = {}) {
|
|
|
3138
3138
|
onMutation,
|
|
3139
3139
|
mutationCb: wrappedMutationEmit,
|
|
3140
3140
|
mousemoveCb: (positions, source) => wrappedEmit(wrapEvent({
|
|
3141
|
-
type:
|
|
3141
|
+
type: EventType.IncrementalSnapshot,
|
|
3142
3142
|
data: {
|
|
3143
3143
|
source,
|
|
3144
3144
|
positions,
|
|
3145
3145
|
},
|
|
3146
3146
|
})),
|
|
3147
3147
|
mouseInteractionCb: (d) => wrappedEmit(wrapEvent({
|
|
3148
|
-
type:
|
|
3148
|
+
type: EventType.IncrementalSnapshot,
|
|
3149
3149
|
data: Object.assign({ source: IncrementalSource.MouseInteraction }, d),
|
|
3150
3150
|
})),
|
|
3151
3151
|
scrollCb: wrappedScrollEmit,
|
|
3152
3152
|
viewportResizeCb: (d) => wrappedEmit(wrapEvent({
|
|
3153
|
-
type:
|
|
3153
|
+
type: EventType.IncrementalSnapshot,
|
|
3154
3154
|
data: Object.assign({ source: IncrementalSource.ViewportResize }, d),
|
|
3155
3155
|
})),
|
|
3156
3156
|
inputCb: (v) => wrappedEmit(wrapEvent({
|
|
3157
|
-
type:
|
|
3157
|
+
type: EventType.IncrementalSnapshot,
|
|
3158
3158
|
data: Object.assign({ source: IncrementalSource.Input }, v),
|
|
3159
3159
|
})),
|
|
3160
3160
|
mediaInteractionCb: (p) => wrappedEmit(wrapEvent({
|
|
3161
|
-
type:
|
|
3161
|
+
type: EventType.IncrementalSnapshot,
|
|
3162
3162
|
data: Object.assign({ source: IncrementalSource.MediaInteraction }, p),
|
|
3163
3163
|
})),
|
|
3164
3164
|
styleSheetRuleCb: (r) => wrappedEmit(wrapEvent({
|
|
3165
|
-
type:
|
|
3165
|
+
type: EventType.IncrementalSnapshot,
|
|
3166
3166
|
data: Object.assign({ source: IncrementalSource.StyleSheetRule }, r),
|
|
3167
3167
|
})),
|
|
3168
3168
|
styleDeclarationCb: (r) => wrappedEmit(wrapEvent({
|
|
3169
|
-
type:
|
|
3169
|
+
type: EventType.IncrementalSnapshot,
|
|
3170
3170
|
data: Object.assign({ source: IncrementalSource.StyleDeclaration }, r),
|
|
3171
3171
|
})),
|
|
3172
3172
|
canvasMutationCb: wrappedCanvasMutationEmit,
|
|
3173
3173
|
fontCb: (p) => wrappedEmit(wrapEvent({
|
|
3174
|
-
type:
|
|
3174
|
+
type: EventType.IncrementalSnapshot,
|
|
3175
3175
|
data: Object.assign({ source: IncrementalSource.Font }, p),
|
|
3176
3176
|
})),
|
|
3177
3177
|
blockClass,
|
|
@@ -3204,7 +3204,7 @@ function record(options = {}) {
|
|
|
3204
3204
|
observer: p.observer,
|
|
3205
3205
|
options: p.options,
|
|
3206
3206
|
callback: (payload) => wrappedEmit(wrapEvent({
|
|
3207
|
-
type:
|
|
3207
|
+
type: EventType.Plugin,
|
|
3208
3208
|
data: {
|
|
3209
3209
|
plugin: p.name,
|
|
3210
3210
|
payload,
|
|
@@ -3232,7 +3232,7 @@ function record(options = {}) {
|
|
|
3232
3232
|
else {
|
|
3233
3233
|
handlers.push(on('load', () => {
|
|
3234
3234
|
wrappedEmit(wrapEvent({
|
|
3235
|
-
type:
|
|
3235
|
+
type: EventType.Load,
|
|
3236
3236
|
data: {},
|
|
3237
3237
|
}));
|
|
3238
3238
|
init();
|
|
@@ -3251,7 +3251,7 @@ record.addCustomEvent = (tag, payload) => {
|
|
|
3251
3251
|
throw new Error('please add custom event after start recording');
|
|
3252
3252
|
}
|
|
3253
3253
|
wrappedEmit(wrapEvent({
|
|
3254
|
-
type:
|
|
3254
|
+
type: EventType.Custom,
|
|
3255
3255
|
data: {
|
|
3256
3256
|
tag,
|
|
3257
3257
|
payload,
|
|
@@ -3282,7 +3282,7 @@ function createBreadcrumb(
|
|
|
3282
3282
|
};
|
|
3283
3283
|
}
|
|
3284
3284
|
|
|
3285
|
-
|
|
3285
|
+
var NodeType;
|
|
3286
3286
|
(function (NodeType) {
|
|
3287
3287
|
NodeType[NodeType["Document"] = 0] = "Document";
|
|
3288
3288
|
NodeType[NodeType["DocumentType"] = 1] = "DocumentType";
|
|
@@ -3290,7 +3290,7 @@ exports.NodeType = void 0;
|
|
|
3290
3290
|
NodeType[NodeType["Text"] = 3] = "Text";
|
|
3291
3291
|
NodeType[NodeType["CDATA"] = 4] = "CDATA";
|
|
3292
3292
|
NodeType[NodeType["Comment"] = 5] = "Comment";
|
|
3293
|
-
})(
|
|
3293
|
+
})(NodeType || (NodeType = {}));
|
|
3294
3294
|
|
|
3295
3295
|
/**
|
|
3296
3296
|
* Add a breadcrumb event to replay.
|
|
@@ -3308,7 +3308,7 @@ function addBreadcrumbEvent(replay, breadcrumb) {
|
|
|
3308
3308
|
|
|
3309
3309
|
replay.addUpdate(() => {
|
|
3310
3310
|
void replay.throttledAddEvent({
|
|
3311
|
-
type:
|
|
3311
|
+
type: EventType.Custom,
|
|
3312
3312
|
// TODO: We were converting from ms to seconds for breadcrumbs, spans,
|
|
3313
3313
|
// but maybe we should just keep them as milliseconds
|
|
3314
3314
|
timestamp: (breadcrumb.timestamp || 0) * 1000,
|
|
@@ -3540,7 +3540,7 @@ const handleDomListener = (
|
|
|
3540
3540
|
/** Get the base DOM breadcrumb. */
|
|
3541
3541
|
function getBaseDomBreadcrumb(target, message) {
|
|
3542
3542
|
// `__sn` property is the serialized node created by rrweb
|
|
3543
|
-
const serializedNode = target && isRrwebNode(target) && target.__sn.type ===
|
|
3543
|
+
const serializedNode = target && isRrwebNode(target) && target.__sn.type === NodeType.Element ? target.__sn : null;
|
|
3544
3544
|
|
|
3545
3545
|
return {
|
|
3546
3546
|
message,
|
|
@@ -3553,7 +3553,7 @@ function getBaseDomBreadcrumb(target, message) {
|
|
|
3553
3553
|
textContent: target
|
|
3554
3554
|
? Array.from(target.childNodes)
|
|
3555
3555
|
.map(
|
|
3556
|
-
(node) => '__sn' in node && node.__sn.type ===
|
|
3556
|
+
(node) => '__sn' in node && node.__sn.type === NodeType.Text && node.__sn.textContent,
|
|
3557
3557
|
)
|
|
3558
3558
|
.filter(Boolean) // filter out empty values
|
|
3559
3559
|
.map(text => (text ).trim())
|
|
@@ -4414,7 +4414,7 @@ function getSession({
|
|
|
4414
4414
|
}
|
|
4415
4415
|
|
|
4416
4416
|
function isCustomEvent(event) {
|
|
4417
|
-
return event.type ===
|
|
4417
|
+
return event.type === EventType.Custom;
|
|
4418
4418
|
}
|
|
4419
4419
|
|
|
4420
4420
|
/**
|
|
@@ -4669,7 +4669,7 @@ function createPerformanceSpans(
|
|
|
4669
4669
|
) {
|
|
4670
4670
|
return entries.map(({ type, start, end, name, data }) => {
|
|
4671
4671
|
const response = replay.throttledAddEvent({
|
|
4672
|
-
type:
|
|
4672
|
+
type: EventType.Custom,
|
|
4673
4673
|
timestamp: start,
|
|
4674
4674
|
data: {
|
|
4675
4675
|
tag: 'performanceSpan',
|
|
@@ -6447,7 +6447,7 @@ function getHandleRecordingEmit(replay) {
|
|
|
6447
6447
|
function createOptionsEvent(replay) {
|
|
6448
6448
|
const options = replay.getOptions();
|
|
6449
6449
|
return {
|
|
6450
|
-
type:
|
|
6450
|
+
type: EventType.Custom,
|
|
6451
6451
|
timestamp: Date.now(),
|
|
6452
6452
|
data: {
|
|
6453
6453
|
tag: 'options',
|
|
@@ -7408,7 +7408,7 @@ class ReplayContainer {
|
|
|
7408
7408
|
|
|
7409
7409
|
this.addUpdate(() => {
|
|
7410
7410
|
void addEvent(this, {
|
|
7411
|
-
type:
|
|
7411
|
+
type: EventType.Custom,
|
|
7412
7412
|
timestamp: breadcrumb.timestamp || 0,
|
|
7413
7413
|
data: {
|
|
7414
7414
|
tag: 'breadcrumb',
|
|
@@ -7674,7 +7674,7 @@ class ReplayContainer {
|
|
|
7674
7674
|
_createCustomBreadcrumb(breadcrumb) {
|
|
7675
7675
|
this.addUpdate(() => {
|
|
7676
7676
|
void this.throttledAddEvent({
|
|
7677
|
-
type:
|
|
7677
|
+
type: EventType.Custom,
|
|
7678
7678
|
timestamp: breadcrumb.timestamp || 0,
|
|
7679
7679
|
data: {
|
|
7680
7680
|
tag: 'breadcrumb',
|