openreplay/tracker/tracker-assist/src/utils.ts
Andrey Babushkin 3fcccb51e8
Patch assist (#3296)
* add global method support

* fix errors

* remove wrong updates

* remove wrong updates

* add onDrag as option

* fix wrong updates
2025-04-14 11:33:06 +02:00

33 lines
No EOL
978 B
TypeScript

export const DOCS_HOST = 'https://docs.openreplay.com'
const warnedFeatures: { [key: string]: boolean } = {}
export function deprecationWarn(nameOfFeature: string, useInstead: string, docsPath = '/'): void {
if (warnedFeatures[nameOfFeature]) {
return
}
console.warn(
`OpenReplay: ${nameOfFeature} is deprecated. ${
useInstead ? `Please, use ${useInstead} instead.` : ''
} Visit ${DOCS_HOST}${docsPath} for more information.`,
)
warnedFeatures[nameOfFeature] = true
}
export function hasOpenreplayAttribute(e: Element, attr: string): boolean {
const newName = `data-openreplay-${attr}`
if (e.hasAttribute(newName)) {
// @ts-ignore
if (DEPRECATED_ATTRS[attr]) {
deprecationWarn(
`"${newName}" attribute`,
// @ts-ignore
`"${DEPRECATED_ATTRS[attr] as string}" attribute`,
'/en/sdk/sanitize-data',
)
}
return true
}
return false
}