change(tracker): code rev

This commit is contained in:
sylenien 2022-09-13 09:30:03 +02:00 committed by Delirium
parent c5548cf060
commit 9156ffdf54
3 changed files with 12 additions and 11 deletions

View file

@ -1,7 +1,7 @@
{
"name": "@openreplay/tracker",
"description": "The OpenReplay tracker main package",
"version": "4.0.2",
"version": "4.0.1",
"keywords": [
"logging",
"replay"

View file

@ -47,11 +47,11 @@ export default class Sanitizer {
if (this.options.domSanitizer !== undefined && isElementNode(node)) {
const sanitizeLevel = this.options.domSanitizer(node)
if (sanitizeLevel > 0) {
const maskedSet =
sanitizeLevel === SanitizeLevel.Hidden ? this.hiddenContainers : this.obscured
maskedSet.add(id)
if (sanitizeLevel === SanitizeLevel.Obscured) {
this.obscured.add(id)
}
if (sanitizeLevel === SanitizeLevel.Hidden) {
this.hiddenContainers.add(id)
}
}
}

View file

@ -1,3 +1,5 @@
const DEPRECATED_ATTRS = { htmlmasked: 'hidden-html', masked: 'obscured' }
export const IN_BROWSER = !(typeof window === 'undefined')
const navigationStart: number | false =
@ -51,16 +53,15 @@ export function getLabelAttribute(e: Element): string | null {
return value
}
export function hasOpenreplayAttribute(e: Element, name: string): boolean {
const deprecatedNames = { htmlmasked: 'hidden-html', masked: 'obscured' }
const newName = `data-openreplay-${name}`
export function hasOpenreplayAttribute(e: Element, attr: string): boolean {
const newName = `data-openreplay-${attr}`
if (e.hasAttribute(newName)) {
// @ts-ignore
if (deprecatedNames[name]) {
if (DEPRECATED_ATTRS[attr]) {
deprecationWarn(
`"${newName}" attribute`,
// @ts-ignore
`"${deprecatedNames[name] as string}" attribute`,
`"${DEPRECATED_ATTRS[attr] as string}" attribute`,
'/installation/sanitize-data',
)
}