posthog-js 1.121.3 → 1.121.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"autocapture.js","sourceRoot":"","sources":["../../src/autocapture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAA;AACxH,OAAO,EACH,6BAA6B,EAC7B,aAAa,EACb,0BAA0B,EAC1B,sBAAsB,EACtB,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,KAAK,EACL,UAAU,EACV,YAAY,EACZ,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,GACnB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,SAAS,MAAM,wBAAwB,CAAA;AAG9C,OAAO,EAAE,gCAAgC,EAAE,MAAM,aAAa,CAAA;AAE9D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC9F,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAElD,IAAM,sBAAsB,GAAG,mBAAmB,CAAA;AAElD,SAAS,SAAS,CAAC,MAAc,EAAE,IAAY;IAC3C,IAAI,IAAI,CAAC,MAAM,GAAG,MAAM,EAAE;QACtB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,KAAK,CAAA;KACvC;IACD,OAAO,IAAI,CAAA;AACf,CAAC;AAED,IAAM,WAAW,GAAG;IAChB,kBAAkB,EAAE,EAAc;IAClC,qBAAqB,EAAE,IAAsB;IAC7C,qBAAqB,EAAE,KAAgB;IAEvC,wBAAwB,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,eAAe,CAAC,GAAG,KAAK,CAAA;SACpC;IACL,CAAC;IAED,qEAAqE;IACrE,qEAAqE;IACrE,yEAAyE;IACzE,0EAA0E;IAC1E,8BAA8B;IAC9B,iBAAiB,EAAE,UACf,KAAgC,EAChC,UAAkB,EAClB,iBAAyB;QAEzB,IAAI,CAAC,KAAK,EAAE;YACR,OAAO,IAAI,CAAA;SACd;QACD,UAAU,GAAG,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAA;QACxD,iBAAiB,GAAG,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAA;QAC7E,IAAI,WAAW,GAAG,CAAC,CAAA;QACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACnC,WAAW,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;SACrC;QACD,OAAO,WAAW,GAAG,UAAU,GAAG,iBAAiB,CAAA;IACvD,CAAC;IAED,kBAAkB,EAAE;QAChB,OAAO,WAAW,CAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,gBAAgB,CAAC,CAAA;IAClD,CAAC;CACJ,CAAA;AAED,sBAAsB,CAAC,WAAW,CAAC,CAAA;AACnC,0BAA0B,CAAC,WAAW,CAAC,CAAA;AAEvC,OAAO,EAAE,WAAW,EAAE,CAAA","sourcesContent":["import { _bind_instance_methods, _each, _extend, _includes, _register_event, _safewrap_instance_methods } from './utils'\nimport {\n autocaptureCompatibleElements,\n getClassNames,\n getDirectAndNestedSpanText,\n getElementsChainString,\n getSafeText,\n isAngularStyleAttr,\n isDocumentFragment,\n isElementNode,\n isSensitiveElement,\n isTag,\n isTextNode,\n makeSafeText,\n shouldCaptureDomEvent,\n shouldCaptureElement,\n shouldCaptureValue,\n splitClassString,\n} from './autocapture-utils'\nimport RageClick from './extensions/rageclick'\nimport { AutocaptureConfig, AutoCaptureCustomProperty, DecideResponse, Properties } from './types'\nimport { PostHog } from './posthog-core'\nimport { AUTOCAPTURE_DISABLED_SERVER_SIDE } from './constants'\n\nimport { _isBoolean, _isFunction, _isNull, _isObject, _isUndefined } from './utils/type-utils'\nimport { logger } from './utils/logger'\nimport { document, window } from './utils/globals'\n\nconst COPY_AUTOCAPTURE_EVENT = '$copy_autocapture'\n\nfunction limitText(length: number, text: string): string {\n if (text.length > length) {\n return text.slice(0, length) + '...'\n }\n return text\n}\n\nconst autocapture = {\n _initializedTokens: [] as string[],\n _isDisabledServerSide: null as boolean | null,\n _isAutocaptureEnabled: false as boolean,\n\n _setIsAutocaptureEnabled: function (instance: PostHog): void {\n const disabled_server_side = _isNull(this._isDisabledServerSide)\n ? !!instance.persistence?.props[AUTOCAPTURE_DISABLED_SERVER_SIDE]\n : this._isDisabledServerSide\n const enabled_client_side = !!instance.config.autocapture\n this._isAutocaptureEnabled = enabled_client_side && !disabled_server_side\n },\n\n _previousElementSibling: function (el: Element): Element | null {\n if (el.previousElementSibling) {\n return el.previousElementSibling\n } else {\n let _el: Element | null = el\n do {\n _el = _el.previousSibling as Element | null // resolves to ChildNode->Node, which is Element's parent class\n } while (_el && !isElementNode(_el))\n return _el\n }\n },\n\n _getAugmentPropertiesFromElement: function (elem: Element): Properties {\n const shouldCaptureEl = shouldCaptureElement(elem)\n if (!shouldCaptureEl) {\n return {}\n }\n\n const props: Properties = {}\n\n _each(elem.attributes, function (attr: Attr) {\n if (attr.name.indexOf('data-ph-capture-attribute') === 0) {\n const propertyKey = attr.name.replace('data-ph-capture-attribute-', '')\n const propertyValue = attr.value\n if (propertyKey && propertyValue && shouldCaptureValue(propertyValue)) {\n props[propertyKey] = propertyValue\n }\n }\n })\n return props\n },\n\n _getPropertiesFromElement: function (elem: Element, maskInputs: boolean, maskText: boolean): Properties {\n const tag_name = elem.tagName.toLowerCase()\n const props: Properties = {\n tag_name: tag_name,\n }\n if (autocaptureCompatibleElements.indexOf(tag_name) > -1 && !maskText) {\n if (tag_name.toLowerCase() === 'a' || tag_name.toLowerCase() === 'button') {\n props['$el_text'] = limitText(1024, getDirectAndNestedSpanText(elem))\n } else {\n props['$el_text'] = limitText(1024, getSafeText(elem))\n }\n }\n\n const classes = getClassNames(elem)\n if (classes.length > 0)\n props['classes'] = classes.filter(function (c) {\n return c !== ''\n })\n\n // capture the deny list here because this not-a-class class makes it tricky to use this.config in the function below\n const elementAttributeIgnorelist = this.config?.element_attribute_ignorelist\n _each(elem.attributes, function (attr: Attr) {\n // Only capture attributes we know are safe\n if (isSensitiveElement(elem) && ['name', 'id', 'class'].indexOf(attr.name) === -1) return\n\n if (elementAttributeIgnorelist?.includes(attr.name)) return\n\n if (!maskInputs && shouldCaptureValue(attr.value) && !isAngularStyleAttr(attr.name)) {\n let value = attr.value\n if (attr.name === 'class') {\n // html attributes can _technically_ contain linebreaks,\n // but we're very intolerant of them in the class string,\n // so we strip them.\n value = splitClassString(value).join(' ')\n }\n props['attr__' + attr.name] = limitText(1024, value)\n }\n })\n\n let nthChild = 1\n let nthOfType = 1\n let currentElem: Element | null = elem\n while ((currentElem = this._previousElementSibling(currentElem))) {\n // eslint-disable-line no-cond-assign\n nthChild++\n if (currentElem.tagName === elem.tagName) {\n nthOfType++\n }\n }\n props['nth_child'] = nthChild\n props['nth_of_type'] = nthOfType\n\n return props\n },\n\n _getDefaultProperties: function (eventType: string): Properties {\n return {\n $event_type: eventType,\n $ce_version: 1,\n }\n },\n\n _extractCustomPropertyValue: function (customProperty: AutoCaptureCustomProperty): string {\n const propValues: string[] = []\n _each(document?.querySelectorAll(customProperty['css_selector']), function (matchedElem) {\n let value\n\n if (['input', 'select'].indexOf(matchedElem.tagName.toLowerCase()) > -1) {\n value = matchedElem['value']\n } else if (matchedElem['textContent']) {\n value = matchedElem['textContent']\n }\n\n if (shouldCaptureValue(value)) {\n propValues.push(value)\n }\n })\n return propValues.join(', ')\n },\n\n // TODO: delete custom_properties after changeless typescript refactor\n _getCustomProperties: function (targetElementList: Element[]): Properties {\n const props: Properties = {} // will be deleted\n _each(this._customProperties, (customProperty) => {\n _each(customProperty['event_selectors'], (eventSelector) => {\n const eventElements = document?.querySelectorAll(eventSelector)\n _each(eventElements, (eventElement) => {\n if (_includes(targetElementList, eventElement) && shouldCaptureElement(eventElement)) {\n props[customProperty['name']] = this._extractCustomPropertyValue(customProperty)\n }\n })\n })\n })\n return props\n },\n\n _getEventTarget: function (e: Event): Element | null {\n // https://developer.mozilla.org/en-US/docs/Web/API/Event/target#Compatibility_notes\n if (_isUndefined(e.target)) {\n return (e.srcElement as Element) || null\n } else {\n if ((e.target as HTMLElement)?.shadowRoot) {\n return (e.composedPath()[0] as Element) || null\n }\n return (e.target as Element) || null\n }\n },\n\n _captureEvent: function (\n e: Event,\n instance: PostHog,\n eventName = '$autocapture',\n extraProps?: Properties\n ): boolean | void {\n /*** Don't mess with this code without running IE8 tests on it ***/\n let target = this._getEventTarget(e)\n if (isTextNode(target)) {\n // defeat Safari bug (see: http://www.quirksmode.org/js/events_properties.html)\n target = (target.parentNode || null) as Element | null\n }\n\n if (eventName === '$autocapture' && e.type === 'click' && e instanceof MouseEvent) {\n if (this.rageclicks?.isRageClick(e.clientX, e.clientY, new Date().getTime())) {\n this._captureEvent(e, instance, '$rageclick')\n }\n }\n\n const isCopyAutocapture = eventName === COPY_AUTOCAPTURE_EVENT\n if (\n target &&\n shouldCaptureDomEvent(\n target,\n e,\n this.config,\n // mostly this method cares about the target element, but in the case of copy events,\n // we want some of the work this check does without insisting on the target element's type\n isCopyAutocapture,\n // we also don't want to restrict copy checks to clicks,\n // so we pass that knowledge in here, rather than add the logic inside the check\n isCopyAutocapture ? ['copy', 'cut'] : undefined\n )\n ) {\n const targetElementList = [target]\n let curEl = target\n while (curEl.parentNode && !isTag(curEl, 'body')) {\n if (isDocumentFragment(curEl.parentNode)) {\n targetElementList.push((curEl.parentNode as any).host)\n curEl = (curEl.parentNode as any).host\n continue\n }\n targetElementList.push(curEl.parentNode as Element)\n curEl = curEl.parentNode as Element\n }\n\n const elementsJson: Properties[] = []\n const autocaptureAugmentProperties: Properties = {}\n let href,\n explicitNoCapture = false\n _each(targetElementList, (el) => {\n const shouldCaptureEl = shouldCaptureElement(el)\n\n // if the element or a parent element is an anchor tag\n // include the href as a property\n if (el.tagName.toLowerCase() === 'a') {\n href = el.getAttribute('href')\n href = shouldCaptureEl && shouldCaptureValue(href) && href\n }\n\n // allow users to programmatically prevent capturing of elements by adding class 'ph-no-capture'\n const classes = getClassNames(el)\n if (_includes(classes, 'ph-no-capture')) {\n explicitNoCapture = true\n }\n\n elementsJson.push(\n this._getPropertiesFromElement(\n el,\n instance.config.mask_all_element_attributes,\n instance.config.mask_all_text\n )\n )\n\n const augmentProperties = this._getAugmentPropertiesFromElement(el)\n _extend(autocaptureAugmentProperties, augmentProperties)\n })\n\n if (!instance.config.mask_all_text) {\n // if the element is a button or anchor tag get the span text from any\n // children and include it as/with the text property on the parent element\n if (target.tagName.toLowerCase() === 'a' || target.tagName.toLowerCase() === 'button') {\n elementsJson[0]['$el_text'] = getDirectAndNestedSpanText(target)\n } else {\n elementsJson[0]['$el_text'] = getSafeText(target)\n }\n }\n\n if (href) {\n elementsJson[0]['attr__href'] = href\n }\n\n if (explicitNoCapture) {\n return false\n }\n\n const props = _extend(\n this._getDefaultProperties(e.type),\n instance.elementsChainAsString\n ? {\n $elements_chain: getElementsChainString(elementsJson),\n }\n : {\n $elements: elementsJson,\n },\n elementsJson[0]?.['$el_text'] ? { $el_text: elementsJson[0]?.['$el_text'] } : {},\n this._getCustomProperties(targetElementList),\n autocaptureAugmentProperties,\n extraProps || {}\n )\n\n if (eventName === COPY_AUTOCAPTURE_EVENT) {\n // you can't read the data from the clipboard event,\n // but you can guess that you can read it from the window's current selection\n const selectedContent = makeSafeText(window?.getSelection()?.toString())\n const clipType = (e as ClipboardEvent).type || 'clipboard'\n if (!selectedContent) {\n return false\n }\n props['$selected_content'] = selectedContent\n props['$copy_type'] = clipType\n }\n\n instance.capture(eventName, props)\n return true\n }\n },\n\n // only reason is to stub for unit tests\n // since you can't override window.location props\n _navigate: function (href: string): void {\n if (!window) {\n return\n }\n window.location.href = href\n },\n\n _addDomEventHandlers: function (instance: PostHog): void {\n if (!window || !document) {\n return\n }\n const handler = (e: Event) => {\n e = e || window?.event\n this._captureEvent(e, instance)\n }\n\n const copiedTextHandler = (e: Event) => {\n e = e || window?.event\n this._captureEvent(e, instance, COPY_AUTOCAPTURE_EVENT)\n }\n\n _register_event(document, 'submit', handler, false, true)\n _register_event(document, 'change', handler, false, true)\n _register_event(document, 'click', handler, false, true)\n\n if (_isObject(instance.config.autocapture) && instance.config.autocapture.capture_copied_text) {\n _register_event(document, 'copy', copiedTextHandler, false, true)\n _register_event(document, 'cut', copiedTextHandler, false, true)\n }\n },\n\n _customProperties: [] as AutoCaptureCustomProperty[],\n rageclicks: null as RageClick | null,\n config: undefined as AutocaptureConfig | undefined,\n\n init: function (instance: PostHog): void {\n if (!_isBoolean(instance.__autocapture)) {\n this.config = instance.__autocapture\n }\n\n // precompile the regex\n if (this.config?.url_allowlist) {\n this.config.url_allowlist = this.config.url_allowlist.map((url) => new RegExp(url))\n }\n\n this.rageclicks = new RageClick(instance.config.rageclick)\n },\n\n afterDecideResponse: function (response: DecideResponse, instance: PostHog): void {\n const token = instance.config.token\n if (this._initializedTokens.indexOf(token) > -1) {\n logger.info('autocapture already initialized for token \"' + token + '\"')\n return\n }\n\n if (instance.persistence) {\n instance.persistence.register({\n [AUTOCAPTURE_DISABLED_SERVER_SIDE]: !!response['autocapture_opt_out'],\n })\n }\n // store this in-memory incase persistence is disabled\n this._isDisabledServerSide = !!response['autocapture_opt_out']\n\n this._setIsAutocaptureEnabled(instance)\n\n this._initializedTokens.push(token)\n\n if (\n response &&\n response['config'] &&\n response['config']['enable_collect_everything'] &&\n this._isAutocaptureEnabled\n ) {\n // TODO: delete custom_properties after changeless typescript refactor\n if (response['custom_properties']) {\n this._customProperties = response['custom_properties']\n }\n this._addDomEventHandlers(instance)\n } else {\n instance['__autocapture'] = false\n }\n },\n\n // this is a mechanism to ramp up CE with no server-side interaction.\n // when CE is active, every page load results in a decide request. we\n // need to gently ramp this up, so we don't overload decide. this decides\n // deterministically if CE is enabled for this project by modding the char\n // value of the project token.\n enabledForProject: function (\n token: string | null | undefined,\n numBuckets: number,\n numEnabledBuckets: number\n ): boolean {\n if (!token) {\n return true\n }\n numBuckets = !_isUndefined(numBuckets) ? numBuckets : 10\n numEnabledBuckets = !_isUndefined(numEnabledBuckets) ? numEnabledBuckets : 10\n let charCodeSum = 0\n for (let i = 0; i < token.length; i++) {\n charCodeSum += token.charCodeAt(i)\n }\n return charCodeSum % numBuckets < numEnabledBuckets\n },\n\n isBrowserSupported: function (): boolean {\n return _isFunction(document?.querySelectorAll)\n },\n}\n\n_bind_instance_methods(autocapture)\n_safewrap_instance_methods(autocapture)\n\nexport { autocapture }\n"]}
1
+ {"version":3,"file":"autocapture.js","sourceRoot":"","sources":["../../src/autocapture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACpE,OAAO,EACH,6BAA6B,EAC7B,aAAa,EACb,0BAA0B,EAC1B,sBAAsB,EACtB,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,KAAK,EACL,UAAU,EACV,YAAY,EACZ,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,GACnB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,SAAS,MAAM,wBAAwB,CAAA;AAG9C,OAAO,EAAE,gCAAgC,EAAE,MAAM,aAAa,CAAA;AAE9D,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAClF,OAAO,EAAE,MAAM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AC,CAAA;IAClD,CAAC;IACL,kBAAC;AAAD,CAAC,AA5TD,IA4TC","sourcesContent":["import { _each, _extend, _includes, _register_event } from './utils'\nimport {\n autocaptureCompatibleElements,\n getClassNames,\n getDirectAndNestedSpanText,\n getElementsChainString,\n getSafeText,\n isAngularStyleAttr,\n isDocumentFragment,\n isElementNode,\n isSensitiveElement,\n isTag,\n isTextNode,\n makeSafeText,\n shouldCaptureDomEvent,\n shouldCaptureElement,\n shouldCaptureValue,\n splitClassString,\n} from './autocapture-utils'\nimport RageClick from './extensions/rageclick'\nimport { AutocaptureConfig, DecideResponse, Properties } from './types'\nimport { PostHog } from './posthog-core'\nimport { AUTOCAPTURE_DISABLED_SERVER_SIDE } from './constants'\n\nimport { _isFunction, _isNull, _isObject, _isUndefined } from './utils/type-utils'\nimport { logger } from './utils/logger'\nimport { document, window } from './utils/globals'\n\nconst COPY_AUTOCAPTURE_EVENT = '$copy_autocapture'\n\nfunction limitText(length: number, text: string): string {\n if (text.length > length) {\n return text.slice(0, length) + '...'\n }\n return text\n}\n\nexport class Autocapture {\n instance: PostHog\n _initialized: boolean = false\n _isDisabledServerSide: boolean | null = null\n rageclicks = new RageClick()\n _elementsChainAsString = false\n\n constructor(instance: PostHog) {\n this.instance = instance\n }\n\n private get config(): AutocaptureConfig {\n const config = _isObject(this.instance.config.autocapture) ? this.instance.config.autocapture : {}\n // precompile the regex\n config.url_allowlist = config.url_allowlist?.map((url) => new RegExp(url))\n return config\n }\n\n private _addDomEventHandlers(): void {\n if (!this.isBrowserSupported()) {\n logger.info('Disabling Automatic Event Collection because this browser is not supported')\n return\n }\n\n if (!window || !document) {\n return\n }\n const handler = (e: Event) => {\n e = e || window?.event\n try {\n this._captureEvent(e)\n } catch (error) {\n logger.error('Failed to capture event', error)\n }\n }\n\n const copiedTextHandler = (e: Event) => {\n e = e || window?.event\n this._captureEvent(e, COPY_AUTOCAPTURE_EVENT)\n }\n\n _register_event(document, 'submit', handler, false, true)\n _register_event(document, 'change', handler, false, true)\n _register_event(document, 'click', handler, false, true)\n\n if (this.config.capture_copied_text) {\n _register_event(document, 'copy', copiedTextHandler, false, true)\n _register_event(document, 'cut', copiedTextHandler, false, true)\n }\n }\n\n public afterDecideResponse(response: DecideResponse) {\n if (this._initialized) {\n logger.info('autocapture already initialized')\n return\n }\n\n if (this.instance.persistence) {\n this.instance.persistence.register({\n [AUTOCAPTURE_DISABLED_SERVER_SIDE]: !!response['autocapture_opt_out'],\n })\n }\n // store this in-memory in case persistence is disabled\n this._isDisabledServerSide = !!response['autocapture_opt_out']\n\n if (response.elementsChainAsString) {\n this._elementsChainAsString = response.elementsChainAsString\n }\n\n if (this.isEnabled) {\n this._addDomEventHandlers()\n this._initialized = true\n }\n }\n\n public get isEnabled(): boolean {\n const disabledServer = _isNull(this._isDisabledServerSide)\n ? !!this.instance.persistence?.props[AUTOCAPTURE_DISABLED_SERVER_SIDE]\n : this._isDisabledServerSide\n const disabledClient = !this.instance.config.autocapture\n return !disabledClient && !disabledServer\n }\n\n private _previousElementSibling(el: Element): Element | null {\n if (el.previousElementSibling) {\n return el.previousElementSibling\n }\n let _el: Element | null = el\n do {\n _el = _el.previousSibling as Element | null // resolves to ChildNode->Node, which is Element's parent class\n } while (_el && !isElementNode(_el))\n return _el\n }\n\n private _getAugmentPropertiesFromElement(elem: Element): Properties {\n const shouldCaptureEl = shouldCaptureElement(elem)\n if (!shouldCaptureEl) {\n return {}\n }\n\n const props: Properties = {}\n\n _each(elem.attributes, function (attr: Attr) {\n if (attr.name && attr.name.indexOf('data-ph-capture-attribute') === 0) {\n const propertyKey = attr.name.replace('data-ph-capture-attribute-', '')\n const propertyValue = attr.value\n if (propertyKey && propertyValue && shouldCaptureValue(propertyValue)) {\n props[propertyKey] = propertyValue\n }\n }\n })\n return props\n }\n\n private _getPropertiesFromElement(elem: Element, maskInputs: boolean, maskText: boolean): Properties {\n const tag_name = elem.tagName.toLowerCase()\n const props: Properties = {\n tag_name: tag_name,\n }\n if (autocaptureCompatibleElements.indexOf(tag_name) > -1 && !maskText) {\n if (tag_name.toLowerCase() === 'a' || tag_name.toLowerCase() === 'button') {\n props['$el_text'] = limitText(1024, getDirectAndNestedSpanText(elem))\n } else {\n props['$el_text'] = limitText(1024, getSafeText(elem))\n }\n }\n\n const classes = getClassNames(elem)\n if (classes.length > 0)\n props['classes'] = classes.filter(function (c) {\n return c !== ''\n })\n\n // capture the deny list here because this not-a-class class makes it tricky to use this.config in the function below\n const elementAttributeIgnorelist = this.config?.element_attribute_ignorelist\n _each(elem.attributes, function (attr: Attr) {\n // Only capture attributes we know are safe\n if (isSensitiveElement(elem) && ['name', 'id', 'class'].indexOf(attr.name) === -1) return\n\n if (elementAttributeIgnorelist?.includes(attr.name)) return\n\n if (!maskInputs && shouldCaptureValue(attr.value) && !isAngularStyleAttr(attr.name)) {\n let value = attr.value\n if (attr.name === 'class') {\n // html attributes can _technically_ contain linebreaks,\n // but we're very intolerant of them in the class string,\n // so we strip them.\n value = splitClassString(value).join(' ')\n }\n props['attr__' + attr.name] = limitText(1024, value)\n }\n })\n\n let nthChild = 1\n let nthOfType = 1\n let currentElem: Element | null = elem\n while ((currentElem = this._previousElementSibling(currentElem))) {\n // eslint-disable-line no-cond-assign\n nthChild++\n if (currentElem.tagName === elem.tagName) {\n nthOfType++\n }\n }\n props['nth_child'] = nthChild\n props['nth_of_type'] = nthOfType\n\n return props\n }\n\n private _getDefaultProperties(eventType: string): Properties {\n return {\n $event_type: eventType,\n $ce_version: 1,\n }\n }\n\n private _getEventTarget(e: Event): Element | null {\n // https://developer.mozilla.org/en-US/docs/Web/API/Event/target#Compatibility_notes\n if (_isUndefined(e.target)) {\n return (e.srcElement as Element) || null\n } else {\n if ((e.target as HTMLElement)?.shadowRoot) {\n return (e.composedPath()[0] as Element) || null\n }\n return (e.target as Element) || null\n }\n }\n\n private _captureEvent(e: Event, eventName = '$autocapture'): boolean | void {\n /*** Don't mess with this code without running IE8 tests on it ***/\n let target = this._getEventTarget(e)\n if (isTextNode(target)) {\n // defeat Safari bug (see: http://www.quirksmode.org/js/events_properties.html)\n target = (target.parentNode || null) as Element | null\n }\n\n if (eventName === '$autocapture' && e.type === 'click' && e instanceof MouseEvent) {\n if (\n this.instance.config.rageclick &&\n this.rageclicks?.isRageClick(e.clientX, e.clientY, new Date().getTime())\n ) {\n this._captureEvent(e, '$rageclick')\n }\n }\n\n const isCopyAutocapture = eventName === COPY_AUTOCAPTURE_EVENT\n if (\n target &&\n shouldCaptureDomEvent(\n target,\n e,\n this.config,\n // mostly this method cares about the target element, but in the case of copy events,\n // we want some of the work this check does without insisting on the target element's type\n isCopyAutocapture,\n // we also don't want to restrict copy checks to clicks,\n // so we pass that knowledge in here, rather than add the logic inside the check\n isCopyAutocapture ? ['copy', 'cut'] : undefined\n )\n ) {\n const targetElementList = [target]\n let curEl = target\n while (curEl.parentNode && !isTag(curEl, 'body')) {\n if (isDocumentFragment(curEl.parentNode)) {\n targetElementList.push((curEl.parentNode as any).host)\n curEl = (curEl.parentNode as any).host\n continue\n }\n targetElementList.push(curEl.parentNode as Element)\n curEl = curEl.parentNode as Element\n }\n\n const elementsJson: Properties[] = []\n const autocaptureAugmentProperties: Properties = {}\n let href,\n explicitNoCapture = false\n\n _each(targetElementList, (el) => {\n const shouldCaptureEl = shouldCaptureElement(el)\n\n // if the element or a parent element is an anchor tag\n // include the href as a property\n if (el.tagName.toLowerCase() === 'a') {\n href = el.getAttribute('href')\n href = shouldCaptureEl && shouldCaptureValue(href) && href\n }\n\n // allow users to programmatically prevent capturing of elements by adding class 'ph-no-capture'\n const classes = getClassNames(el)\n if (_includes(classes, 'ph-no-capture')) {\n explicitNoCapture = true\n }\n\n elementsJson.push(\n this._getPropertiesFromElement(\n el,\n this.instance.config.mask_all_element_attributes,\n this.instance.config.mask_all_text\n )\n )\n\n const augmentProperties = this._getAugmentPropertiesFromElement(el)\n _extend(autocaptureAugmentProperties, augmentProperties)\n })\n\n if (!this.instance.config.mask_all_text) {\n // if the element is a button or anchor tag get the span text from any\n // children and include it as/with the text property on the parent element\n if (target.tagName.toLowerCase() === 'a' || target.tagName.toLowerCase() === 'button') {\n elementsJson[0]['$el_text'] = getDirectAndNestedSpanText(target)\n } else {\n elementsJson[0]['$el_text'] = getSafeText(target)\n }\n }\n\n if (href) {\n elementsJson[0]['attr__href'] = href\n }\n\n if (explicitNoCapture) {\n return false\n }\n\n const props = _extend(\n this._getDefaultProperties(e.type),\n this._elementsChainAsString\n ? {\n $elements_chain: getElementsChainString(elementsJson),\n }\n : {\n $elements: elementsJson,\n },\n elementsJson[0]?.['$el_text'] ? { $el_text: elementsJson[0]?.['$el_text'] } : {},\n autocaptureAugmentProperties\n )\n\n if (eventName === COPY_AUTOCAPTURE_EVENT) {\n // you can't read the data from the clipboard event,\n // but you can guess that you can read it from the window's current selection\n const selectedContent = makeSafeText(window?.getSelection()?.toString())\n const clipType = (e as ClipboardEvent).type || 'clipboard'\n if (!selectedContent) {\n return false\n }\n props['$selected_content'] = selectedContent\n props['$copy_type'] = clipType\n }\n\n this.instance.capture(eventName, props)\n return true\n }\n }\n\n isBrowserSupported(): boolean {\n return _isFunction(document?.querySelectorAll)\n }\n}\n"]}
package/lib/src/decide.js CHANGED
@@ -9,7 +9,6 @@ var __values = (this && this.__values) || function(o) {
9
9
  };
10
10
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
11
11
  };
12
- import { autocapture } from './autocapture';
13
12
  import { loadScript } from './utils';
14
13
  import { Compression } from './types';
15
14
  import { STORED_GROUP_PROPERTIES_KEY, STORED_PERSON_PROPERTIES_KEY } from './constants';
@@ -49,7 +48,7 @@ var Decide = /** @class */ (function () {
49
48
  Decide.prototype.parseDecideResponse = function (response) {
50
49
  var e_1, _a;
51
50
  var _this = this;
52
- var _b;
51
+ var _b, _c;
53
52
  this.instance.featureFlags.setReloadingPaused(false);
54
53
  // :TRICKY: Reload - start another request if queued!
55
54
  this.instance.featureFlags._startReloadTimer();
@@ -71,7 +70,7 @@ var Decide = /** @class */ (function () {
71
70
  }
72
71
  this.instance.toolbar.afterDecideResponse(response);
73
72
  (_b = this.instance.sessionRecording) === null || _b === void 0 ? void 0 : _b.afterDecideResponse(response);
74
- autocapture.afterDecideResponse(response, this.instance);
73
+ (_c = this.instance.autocapture) === null || _c === void 0 ? void 0 : _c.afterDecideResponse(response);
75
74
  this.instance._afterDecideResponse(response);
76
75
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
77
76
  // @ts-ignore
@@ -114,15 +113,15 @@ var Decide = /** @class */ (function () {
114
113
  };
115
114
  var this_1 = this;
116
115
  try {
117
- for (var _c = __values(response['siteApps']), _d = _c.next(); !_d.done; _d = _c.next()) {
118
- var _e = _d.value, id = _e.id, url = _e.url;
116
+ for (var _d = __values(response['siteApps']), _e = _d.next(); !_e.done; _e = _d.next()) {
117
+ var _f = _e.value, id = _f.id, url = _f.url;
119
118
  _loop_1(id, url);
120
119
  }
121
120
  }
122
121
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
123
122
  finally {
124
123
  try {
125
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
124
+ if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
126
125
  }
127
126
  finally { if (e_1) throw e_1.error; }
128
127
  }
@@ -1 +1 @@
1
- {"version":3,"file":"decide.js","sourceRoot":"","sources":["../../src/decide.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,EAAE,WAAW,EAAkB,MAAM,SAAS,CAAA;AACrD,OAAO,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAEvF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAA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,CAAC,aAAa,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;oBAErE,gBAAgB,CAAC,0BAAmB,EAAE,CAAE,CAAC,GAAG,OAAK,QAAQ,CAAA;oBAEzD,UAAU,CAAC,SAAS,EAAE,UAAC,GAAG;wBACtB,IAAI,GAAG,EAAE;4BACL,MAAM,CAAC,KAAK,CAAC,8DAAuD,EAAE,CAAE,EAAE,GAAG,CAAC,CAAA;yBACjF;oBACL,CAAC,CAAC,CAAA;;;;oBATN,KAA0B,IAAA,KAAA,SAAA,QAAQ,CAAC,UAAU,CAAC,CAAA,gBAAA;wBAAnC,IAAA,aAAW,EAAT,EAAE,QAAA,EAAE,GAAG,SAAA;gCAAP,EAAE,EAAE,GAAG;qBAUnB;;;;;;;;;aACJ;iBAAM,IAAI,QAAQ,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;gBACxC,MAAM,CAAC,KAAK,CAAC,kFAAkF,CAAC,CAAA;aACnG;SACJ;IACL,CAAC;IACL,aAAC;AAAD,CAAC,AAvHD,IAuHC","sourcesContent":["import { autocapture } from './autocapture'\nimport { loadScript } from './utils'\nimport { PostHog } from './posthog-core'\nimport { Compression, DecideResponse } from './types'\nimport { STORED_GROUP_PROPERTIES_KEY, STORED_PERSON_PROPERTIES_KEY } from './constants'\n\nimport { _isUndefined } from './utils/type-utils'\nimport { logger } from './utils/logger'\nimport { window, document, assignableWindow } from './utils/globals'\n\nexport class Decide {\n instance: PostHog\n\n constructor(instance: PostHog) {\n this.instance = instance\n // don't need to wait for `decide` to return if flags were provided on initialisation\n this.instance.decideEndpointWasHit = this.instance._hasBootstrappedFeatureFlags()\n }\n\n call(): void {\n /*\n Calls /decide endpoint to fetch options for autocapture, session recording, feature flags & compression.\n */\n const data = {\n token: this.instance.config.token,\n distinct_id: this.instance.get_distinct_id(),\n groups: this.instance.getGroups(),\n person_properties: this.instance.get_property(STORED_PERSON_PROPERTIES_KEY),\n group_properties: this.instance.get_property(STORED_GROUP_PROPERTIES_KEY),\n disable_flags:\n this.instance.config.advanced_disable_feature_flags ||\n this.instance.config.advanced_disable_feature_flags_on_first_load ||\n undefined,\n }\n\n this.instance._send_request({\n method: 'POST',\n url: this.instance.requestRouter.endpointFor('api', '/decide/?v=3'),\n data,\n compression: this.instance.config.disable_compression ? undefined : Compression.Base64,\n timeout: this.instance.config.feature_flag_request_timeout_ms,\n callback: (response) => this.parseDecideResponse(response.json as DecideResponse | undefined),\n })\n }\n\n parseDecideResponse(response?: DecideResponse): void {\n this.instance.featureFlags.setReloadingPaused(false)\n // :TRICKY: Reload - start another request if queued!\n this.instance.featureFlags._startReloadTimer()\n\n const errorsLoading = !response\n\n if (\n !this.instance.config.advanced_disable_feature_flags_on_first_load &&\n !this.instance.config.advanced_disable_feature_flags\n ) {\n this.instance.featureFlags.receivedFeatureFlags(response ?? {}, errorsLoading)\n }\n\n if (errorsLoading) {\n logger.error('Failed to fetch feature flags from PostHog.')\n return\n }\n if (!(document && document.body)) {\n logger.info('document not ready yet, trying again in 500 milliseconds...')\n setTimeout(() => {\n this.parseDecideResponse(response)\n }, 500)\n return\n }\n\n this.instance.toolbar.afterDecideResponse(response)\n this.instance.sessionRecording?.afterDecideResponse(response)\n autocapture.afterDecideResponse(response, this.instance)\n this.instance._afterDecideResponse(response)\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const surveysGenerator = window?.extendPostHogWithSurveys\n\n if (!this.instance.config.disable_surveys && response['surveys'] && !surveysGenerator) {\n loadScript(this.instance.requestRouter.endpointFor('assets', '/static/surveys.js'), (err) => {\n if (err) {\n return logger.error(`Could not load surveys script`, err)\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n window.extendPostHogWithSurveys(this.instance)\n })\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const exceptionAutoCaptureAddedToWindow = window?.extendPostHogWithExceptionAutoCapture\n if (\n response['autocaptureExceptions'] &&\n !!response['autocaptureExceptions'] &&\n _isUndefined(exceptionAutoCaptureAddedToWindow)\n ) {\n loadScript(this.instance.requestRouter.endpointFor('assets', '/static/exception-autocapture.js'), (err) => {\n if (err) {\n return logger.error(`Could not load exception autocapture script`, err)\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n window.extendPostHogWithExceptionAutocapture(this.instance, response)\n })\n }\n\n if (response['siteApps']) {\n if (this.instance.config.opt_in_site_apps) {\n for (const { id, url } of response['siteApps']) {\n const scriptUrl = this.instance.requestRouter.endpointFor('api', url)\n\n assignableWindow[`__$$ph_site_app_${id}`] = this.instance\n\n loadScript(scriptUrl, (err) => {\n if (err) {\n logger.error(`Error while initializing PostHog app with config id ${id}`, err)\n }\n })\n }\n } else if (response['siteApps'].length > 0) {\n logger.error('PostHog site apps are disabled. Enable the \"opt_in_site_apps\" config to proceed.')\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"decide.js","sourceRoot":"","sources":["../../src/decide.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,EAAE,WAAW,EAAkB,MAAM,SAAS,CAAA;AACrD,OAAO,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAEvF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAEpE;IAGI,gBAAY,QAAiB;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,qFAAqF;QACrF,IAAI,CAAC,QAAQ,CAAC,oBAAoB,GAAG,IAAI,CAAC,QAAQ,CAAC,4BAA4B,EAAE,CAAA;IACrF,CAAC;IAED,qBAAI,GAAJ;QAAA,iBAwBC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AC,8DAAuD,EAAE,CAAE,EAAE,GAAG,CAAC,CAAA;yBACjF;oBACL,CAAC,CAAC,CAAA;;;;oBATN,KAA0B,IAAA,KAAA,SAAA,QAAQ,CAAC,UAAU,CAAC,CAAA,gBAAA;wBAAnC,IAAA,aAAW,EAAT,EAAE,QAAA,EAAE,GAAG,SAAA;gCAAP,EAAE,EAAE,GAAG;qBAUnB;;;;;;;;;aACJ;iBAAM,IAAI,QAAQ,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;gBACxC,MAAM,CAAC,KAAK,CAAC,kFAAkF,CAAC,CAAA;aACnG;SACJ;IACL,CAAC;IACL,aAAC;AAAD,CAAC,AAvHD,IAuHC","sourcesContent":["import { loadScript } from './utils'\nimport { PostHog } from './posthog-core'\nimport { Compression, DecideResponse } from './types'\nimport { STORED_GROUP_PROPERTIES_KEY, STORED_PERSON_PROPERTIES_KEY } from './constants'\n\nimport { _isUndefined } from './utils/type-utils'\nimport { logger } from './utils/logger'\nimport { window, document, assignableWindow } from './utils/globals'\n\nexport class Decide {\n instance: PostHog\n\n constructor(instance: PostHog) {\n this.instance = instance\n // don't need to wait for `decide` to return if flags were provided on initialisation\n this.instance.decideEndpointWasHit = this.instance._hasBootstrappedFeatureFlags()\n }\n\n call(): void {\n /*\n Calls /decide endpoint to fetch options for autocapture, session recording, feature flags & compression.\n */\n const data = {\n token: this.instance.config.token,\n distinct_id: this.instance.get_distinct_id(),\n groups: this.instance.getGroups(),\n person_properties: this.instance.get_property(STORED_PERSON_PROPERTIES_KEY),\n group_properties: this.instance.get_property(STORED_GROUP_PROPERTIES_KEY),\n disable_flags:\n this.instance.config.advanced_disable_feature_flags ||\n this.instance.config.advanced_disable_feature_flags_on_first_load ||\n undefined,\n }\n\n this.instance._send_request({\n method: 'POST',\n url: this.instance.requestRouter.endpointFor('api', '/decide/?v=3'),\n data,\n compression: this.instance.config.disable_compression ? undefined : Compression.Base64,\n timeout: this.instance.config.feature_flag_request_timeout_ms,\n callback: (response) => this.parseDecideResponse(response.json as DecideResponse | undefined),\n })\n }\n\n parseDecideResponse(response?: DecideResponse): void {\n this.instance.featureFlags.setReloadingPaused(false)\n // :TRICKY: Reload - start another request if queued!\n this.instance.featureFlags._startReloadTimer()\n\n const errorsLoading = !response\n\n if (\n !this.instance.config.advanced_disable_feature_flags_on_first_load &&\n !this.instance.config.advanced_disable_feature_flags\n ) {\n this.instance.featureFlags.receivedFeatureFlags(response ?? {}, errorsLoading)\n }\n\n if (errorsLoading) {\n logger.error('Failed to fetch feature flags from PostHog.')\n return\n }\n if (!(document && document.body)) {\n logger.info('document not ready yet, trying again in 500 milliseconds...')\n setTimeout(() => {\n this.parseDecideResponse(response)\n }, 500)\n return\n }\n\n this.instance.toolbar.afterDecideResponse(response)\n this.instance.sessionRecording?.afterDecideResponse(response)\n this.instance.autocapture?.afterDecideResponse(response)\n this.instance._afterDecideResponse(response)\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const surveysGenerator = window?.extendPostHogWithSurveys\n\n if (!this.instance.config.disable_surveys && response['surveys'] && !surveysGenerator) {\n loadScript(this.instance.requestRouter.endpointFor('assets', '/static/surveys.js'), (err) => {\n if (err) {\n return logger.error(`Could not load surveys script`, err)\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n window.extendPostHogWithSurveys(this.instance)\n })\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const exceptionAutoCaptureAddedToWindow = window?.extendPostHogWithExceptionAutoCapture\n if (\n response['autocaptureExceptions'] &&\n !!response['autocaptureExceptions'] &&\n _isUndefined(exceptionAutoCaptureAddedToWindow)\n ) {\n loadScript(this.instance.requestRouter.endpointFor('assets', '/static/exception-autocapture.js'), (err) => {\n if (err) {\n return logger.error(`Could not load exception autocapture script`, err)\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n window.extendPostHogWithExceptionAutocapture(this.instance, response)\n })\n }\n\n if (response['siteApps']) {\n if (this.instance.config.opt_in_site_apps) {\n for (const { id, url } of response['siteApps']) {\n const scriptUrl = this.instance.requestRouter.endpointFor('api', url)\n\n assignableWindow[`__$$ph_site_app_${id}`] = this.instance\n\n loadScript(scriptUrl, (err) => {\n if (err) {\n logger.error(`Error while initializing PostHog app with config id ${id}`, err)\n }\n })\n }\n } else if (response['siteApps'].length > 0) {\n logger.error('PostHog site apps are disabled. Enable the \"opt_in_site_apps\" config to proceed.')\n }\n }\n }\n}\n"]}
@@ -4,7 +4,6 @@ export default class RageClick {
4
4
  y: number;
5
5
  timestamp: number;
6
6
  }[];
7
- enabled: boolean;
8
- constructor(enabled: boolean);
7
+ constructor();
9
8
  isRageClick(x: number, y: number, timestamp: number): boolean;
10
9
  }
@@ -5,14 +5,10 @@ var RAGE_CLICK_THRESHOLD_PX = 30;
5
5
  var RAGE_CLICK_TIMEOUT_MS = 1000;
6
6
  var RAGE_CLICK_CLICK_COUNT = 3;
7
7
  var RageClick = /** @class */ (function () {
8
- function RageClick(enabled) {
8
+ function RageClick() {
9
9
  this.clicks = [];
10
- this.enabled = enabled;
11
10
  }
12
11
  RageClick.prototype.isRageClick = function (x, y, timestamp) {
13
- if (!this.enabled) {
14
- return false;
15
- }
16
12
  var lastClick = this.clicks[this.clicks.length - 1];
17
13
  if (lastClick &&
18
14
  Math.abs(x - lastClick.x) + Math.abs(y - lastClick.y) < RAGE_CLICK_THRESHOLD_PX &&
@@ -1 +1 @@
1
- {"version":3,"file":"rageclick.js","sourceRoot":"","sources":["../../../src/extensions/rageclick.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,yFAAyF;AACzF,0BAA0B;AAE1B,IAAM,uBAAuB,GAAG,EAAE,CAAA;AAClC,IAAM,qBAAqB,GAAG,IAAI,CAAA;AAClC,IAAM,sBAAsB,GAAG,CAAC,CAAA;AAEhC;IAII,mBAAY,OAAgB;QACxB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAA;QAChB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IAC1B,CAAC;IAED,+BAAW,GAAX,UAAY,CAAS,EAAE,CAAS,EAAE,SAAiB;QAC/C,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACf,OAAO,KAAK,CAAA;SACf;QAED,IAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;QACrD,IACI,SAAS;YACT,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,uBAAuB;YAC/E,SAAS,GAAG,SAAS,CAAC,SAAS,GAAG,qBAAqB,EACzD;YACE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,GAAA,EAAE,CAAC,GAAA,EAAE,SAAS,WAAA,EAAE,CAAC,CAAA;YAErC,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,sBAAsB,EAAE;gBAC/C,OAAO,IAAI,CAAA;aACd;SACJ;aAAM;YACH,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAA,EAAE,CAAC,GAAA,EAAE,SAAS,WAAA,EAAE,CAAC,CAAA;SACtC;QAED,OAAO,KAAK,CAAA;IAChB,CAAC;IACL,gBAAC;AAAD,CAAC,AA/BD,IA+BC","sourcesContent":["// Naive rage click implementation: If mouse has not moved than RAGE_CLICK_THRESHOLD_PX\n// over RAGE_CLICK_CLICK_COUNT clicks with max RAGE_CLICK_TIMEOUT_MS between clicks, it's\n// counted as a rage click\n\nconst RAGE_CLICK_THRESHOLD_PX = 30\nconst RAGE_CLICK_TIMEOUT_MS = 1000\nconst RAGE_CLICK_CLICK_COUNT = 3\n\nexport default class RageClick {\n clicks: { x: number; y: number; timestamp: number }[]\n enabled: boolean\n\n constructor(enabled: boolean) {\n this.clicks = []\n this.enabled = enabled\n }\n\n isRageClick(x: number, y: number, timestamp: number): boolean {\n if (!this.enabled) {\n return false\n }\n\n const lastClick = this.clicks[this.clicks.length - 1]\n if (\n lastClick &&\n Math.abs(x - lastClick.x) + Math.abs(y - lastClick.y) < RAGE_CLICK_THRESHOLD_PX &&\n timestamp - lastClick.timestamp < RAGE_CLICK_TIMEOUT_MS\n ) {\n this.clicks.push({ x, y, timestamp })\n\n if (this.clicks.length === RAGE_CLICK_CLICK_COUNT) {\n return true\n }\n } else {\n this.clicks = [{ x, y, timestamp }]\n }\n\n return false\n }\n}\n"]}
1
+ {"version":3,"file":"rageclick.js","sourceRoot":"","sources":["../../../src/extensions/rageclick.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,yFAAyF;AACzF,0BAA0B;AAE1B,IAAM,uBAAuB,GAAG,EAAE,CAAA;AAClC,IAAM,qBAAqB,GAAG,IAAI,CAAA;AAClC,IAAM,sBAAsB,GAAG,CAAC,CAAA;AAEhC;IAGI;QACI,IAAI,CAAC,MAAM,GAAG,EAAE,CAAA;IACpB,CAAC;IAED,+BAAW,GAAX,UAAY,CAAS,EAAE,CAAS,EAAE,SAAiB;QAC/C,IAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;QACrD,IACI,SAAS;YACT,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,uBAAuB;YAC/E,SAAS,GAAG,SAAS,CAAC,SAAS,GAAG,qBAAqB,EACzD;YACE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,GAAA,EAAE,CAAC,GAAA,EAAE,SAAS,WAAA,EAAE,CAAC,CAAA;YAErC,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,sBAAsB,EAAE;gBAC/C,OAAO,IAAI,CAAA;aACd;SACJ;aAAM;YACH,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAA,EAAE,CAAC,GAAA,EAAE,SAAS,WAAA,EAAE,CAAC,CAAA;SACtC;QAED,OAAO,KAAK,CAAA;IAChB,CAAC;IACL,gBAAC;AAAD,CAAC,AAzBD,IAyBC","sourcesContent":["// Naive rage click implementation: If mouse has not moved than RAGE_CLICK_THRESHOLD_PX\n// over RAGE_CLICK_CLICK_COUNT clicks with max RAGE_CLICK_TIMEOUT_MS between clicks, it's\n// counted as a rage click\n\nconst RAGE_CLICK_THRESHOLD_PX = 30\nconst RAGE_CLICK_TIMEOUT_MS = 1000\nconst RAGE_CLICK_CLICK_COUNT = 3\n\nexport default class RageClick {\n clicks: { x: number; y: number; timestamp: number }[]\n\n constructor() {\n this.clicks = []\n }\n\n isRageClick(x: number, y: number, timestamp: number): boolean {\n const lastClick = this.clicks[this.clicks.length - 1]\n if (\n lastClick &&\n Math.abs(x - lastClick.x) + Math.abs(y - lastClick.y) < RAGE_CLICK_THRESHOLD_PX &&\n timestamp - lastClick.timestamp < RAGE_CLICK_TIMEOUT_MS\n ) {\n this.clicks.push({ x, y, timestamp })\n\n if (this.clicks.length === RAGE_CLICK_CLICK_COUNT) {\n return true\n }\n } else {\n this.clicks = [{ x, y, timestamp }]\n }\n\n return false\n }\n}\n"]}
@@ -6,13 +6,14 @@ import { RequestQueue } from './request-queue';
6
6
  import { RetryQueue } from './retry-queue';
7
7
  import { SessionIdManager } from './sessionid';
8
8
  import { RequestRouter } from './utils/request-router';
9
- import { AutocaptureConfig, CaptureOptions, CaptureResult, Compression, DecideResponse, EarlyAccessFeatureCallback, GDPROptions, IsFeatureEnabledOptions, JsonType, OptInOutCapturingOptions, PostHogConfig, Properties, Property, QueuedRequestOptions, RequestCallback, SessionIdChangedCallback, SnippetArrayItem, ToolbarParams } from './types';
9
+ import { CaptureOptions, CaptureResult, Compression, DecideResponse, EarlyAccessFeatureCallback, GDPROptions, IsFeatureEnabledOptions, JsonType, OptInOutCapturingOptions, PostHogConfig, Properties, Property, QueuedRequestOptions, RequestCallback, SessionIdChangedCallback, SnippetArrayItem, ToolbarParams } from './types';
10
10
  import { SentryIntegration } from './extensions/sentry-integration';
11
11
  import { PageViewManager } from './page-view';
12
12
  import { PostHogSurveys } from './posthog-surveys';
13
13
  import { RateLimiter } from './rate-limiter';
14
14
  import { SurveyCallback } from './posthog-surveys-types';
15
15
  import { SessionPropsManager } from './session-props';
16
+ import { Autocapture } from './autocapture';
16
17
  type OnlyValidKeys<T, Shape> = T extends Shape ? (Exclude<keyof T, keyof Shape> extends never ? T : never) : never;
17
18
  export declare const defaultConfig: () => PostHogConfig;
18
19
  declare class DeprecatedWebPerformanceObserver {
@@ -37,6 +38,7 @@ export declare class PostHog {
37
38
  sessionManager?: SessionIdManager;
38
39
  sessionPropsManager?: SessionPropsManager;
39
40
  requestRouter: RequestRouter;
41
+ autocapture?: Autocapture;
40
42
  _requestQueue?: RequestQueue;
41
43
  _retryQueue?: RetryQueue;
42
44
  sessionRecording?: SessionRecording;
@@ -45,10 +47,8 @@ export declare class PostHog {
45
47
  compression?: Compression;
46
48
  __captureHooks: ((eventName: string) => void)[];
47
49
  __request_queue: QueuedRequestOptions[];
48
- __autocapture: boolean | AutocaptureConfig | undefined;
49
50
  decideEndpointWasHit: boolean;
50
51
  analyticsDefaultEndpoint: string;
51
- elementsChainAsString: boolean;
52
52
  SentryIntegration: typeof SentryIntegration;
53
53
  segmentIntegration: () => any;
54
54
  /** DEPRECATED: We keep this to support existing usage but now one should just call .setPersonProperties */
@@ -37,7 +37,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
37
37
  import Config from './config';
38
38
  import { _copyAndTruncateStrings, _each, _eachArray, _extend, _includes, _register_event, _safewrap_class, isCrossDomainCookie, isDistinctIdStringLike, } from './utils';
39
39
  import { assignableWindow, document, location, userAgent, window } from './utils/globals';
40
- import { autocapture } from './autocapture';
41
40
  import { PostHogFeatureFlags } from './posthog-featureflags';
42
41
  import { PostHogPersistence } from './posthog-persistence';
43
42
  import { ALIAS_ID_KEY, ENABLE_PERSON_PROCESSING, FLAG_CALL_REPORTED, PEOPLE_DISTINCT_ID_KEY, SESSION_RECORDING_IS_SAMPLED, } from './constants';
@@ -63,6 +62,7 @@ import { logger } from './utils/logger';
63
62
  import { SessionPropsManager } from './session-props';
64
63
  import { _isBlockedUA } from './utils/blocked-uas';
65
64
  import { extendURLParams, request, SUPPORTS_REQUEST } from './request';
65
+ import { Autocapture } from './autocapture';
66
66
  var instances = {};
67
67
  // some globals for comparisons
68
68
  var __NOOP = function () { };
@@ -178,9 +178,7 @@ var PostHog = /** @class */ (function () {
178
178
  this.__captureHooks = [];
179
179
  this.__request_queue = [];
180
180
  this.__loaded = false;
181
- this.__autocapture = undefined;
182
181
  this.analyticsDefaultEndpoint = '/e/';
183
- this.elementsChainAsString = false;
184
182
  this.featureFlags = new PostHogFeatureFlags(this);
185
183
  this.toolbar = new Toolbar(this);
186
184
  this.pageViewManager = new PageViewManager(this);
@@ -284,24 +282,7 @@ var PostHog = /** @class */ (function () {
284
282
  if (!this.config.disable_scroll_properties) {
285
283
  this.pageViewManager.startMeasuringScrollPosition();
286
284
  }
287
- this.__autocapture = this.config.autocapture;
288
- autocapture._setIsAutocaptureEnabled(this);
289
- if (autocapture._isAutocaptureEnabled) {
290
- this.__autocapture = this.config.autocapture;
291
- var num_buckets = 100;
292
- var num_enabled_buckets = 100;
293
- if (!autocapture.enabledForProject(this.config.token, num_buckets, num_enabled_buckets)) {
294
- this.__autocapture = false;
295
- logger.info('Not in active bucket: disabling Automatic Event Collection.');
296
- }
297
- else if (!autocapture.isBrowserSupported()) {
298
- this.__autocapture = false;
299
- logger.info('Disabling Automatic Event Collection because this browser is not supported');
300
- }
301
- else {
302
- autocapture.init(this);
303
- }
304
- }
285
+ this.autocapture = new Autocapture(this);
305
286
  // if any instance on the page has debug = true, we set the
306
287
  // global debug to be true
307
288
  Config.DEBUG = Config.DEBUG || this.config.debug;
@@ -387,9 +368,6 @@ var PostHog = /** @class */ (function () {
387
368
  if ((_a = response.analytics) === null || _a === void 0 ? void 0 : _a.endpoint) {
388
369
  this.analyticsDefaultEndpoint = response.analytics.endpoint;
389
370
  }
390
- if (response.elementsChainAsString) {
391
- this.elementsChainAsString = response.elementsChainAsString;
392
- }
393
371
  };
394
372
  PostHog.prototype._loaded = function () {
395
373
  var _this = this;