posthog-js 1.78.6 → 1.79.0
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/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/es.js +1 -1
- package/dist/es.js.map +1 -1
- package/dist/module.d.ts +5 -0
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/src/autocapture.js +5 -0
- package/lib/src/autocapture.js.map +1 -1
- package/lib/src/types.d.ts +5 -0
- package/lib/src/types.js.map +1 -1
- package/package.json +1 -1
package/lib/package.json
CHANGED
package/lib/src/autocapture.js
CHANGED
|
@@ -50,6 +50,7 @@ var autocapture = {
|
|
|
50
50
|
return props;
|
|
51
51
|
},
|
|
52
52
|
_getPropertiesFromElement: function (elem, maskInputs, maskText) {
|
|
53
|
+
var _a;
|
|
53
54
|
var tag_name = elem.tagName.toLowerCase();
|
|
54
55
|
var props = {
|
|
55
56
|
tag_name: tag_name,
|
|
@@ -67,10 +68,14 @@ var autocapture = {
|
|
|
67
68
|
props['classes'] = classes.split(' ').filter(function (c) {
|
|
68
69
|
return c !== '';
|
|
69
70
|
});
|
|
71
|
+
// capture the deny list here because this not-a-class class makes it tricky to use this.config in the function below
|
|
72
|
+
var elementAttributeIgnorelist = (_a = this.config) === null || _a === void 0 ? void 0 : _a.element_attribute_ignorelist;
|
|
70
73
|
_each(elem.attributes, function (attr) {
|
|
71
74
|
// Only capture attributes we know are safe
|
|
72
75
|
if (isSensitiveElement(elem) && ['name', 'id', 'class'].indexOf(attr.name) === -1)
|
|
73
76
|
return;
|
|
77
|
+
if (elementAttributeIgnorelist === null || elementAttributeIgnorelist === void 0 ? void 0 : elementAttributeIgnorelist.includes(attr.name))
|
|
78
|
+
return;
|
|
74
79
|
if (!maskInputs && shouldCaptureValue(attr.value) && !isAngularStyleAttr(attr.name)) {
|
|
75
80
|
props['attr__' + attr.name] = limitText(1024, attr.value);
|
|
76
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocapture.js","sourceRoot":"","sources":["../../src/autocapture.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,sBAAsB,EACtB,KAAK,EACL,OAAO,EACP,SAAS,EACT,WAAW,EACX,YAAY,EACZ,eAAe,EACf,0BAA0B,EAC1B,MAAM,GACT,MAAM,SAAS,CAAA;AAChB,OAAO,EACH,YAAY,EACZ,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,KAAK,EACL,UAAU,EACV,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,6BAA6B,EAC7B,kBAAkB,EAClB,kBAAkB,EAClB,0BAA0B,GAC7B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,SAAS,MAAM,wBAAwB,CAAA;AAG9C,OAAO,EAAE,gCAAgC,EAAE,MAAM,aAAa,CAAA;AAE9D,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,EAAE,UAAU,QAAiB;;QACjD,IAAM,oBAAoB,GACtB,IAAI,CAAC,qBAAqB,KAAK,IAAI;YAC/B,CAAC,CAAC,CAAC,CAAC,CAAA,MAAA,QAAQ,CAAC,WAAW,0CAAE,KAAK,CAAC,gCAAgC,CAAC,CAAA;YACjE,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAA;QACpC,IAAM,mBAAmB,GAAG,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAA;QA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AC,iBAAiB,GAAG,QAAQ,CAAC,mBAAmB,CAAC,CAAA;aACzD;YACD,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAA;SACtC;aAAM;YACH,QAAQ,CAAC,eAAe,CAAC,GAAG,KAAK,CAAA;SACpC;IACL,CAAC;IAED,qEAAqE;IACrE,qEAAqE;IACrE,wEAAwE;IACxE,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,CAAC,gBAAgB,CAAC,CAAA;IACjD,CAAC;CACJ,CAAA;AAED,sBAAsB,CAAC,WAAW,CAAC,CAAA;AACnC,0BAA0B,CAAC,WAAW,CAAC,CAAA;AAEvC,OAAO,EAAE,WAAW,EAAE,CAAA","sourcesContent":["import {\n _bind_instance_methods,\n _each,\n _extend,\n _includes,\n _isFunction,\n _isUndefined,\n _register_event,\n _safewrap_instance_methods,\n logger,\n} from './utils'\nimport {\n getClassName,\n getSafeText,\n isElementNode,\n isSensitiveElement,\n isTag,\n isTextNode,\n shouldCaptureDomEvent,\n shouldCaptureElement,\n shouldCaptureValue,\n autocaptureCompatibleElements,\n isAngularStyleAttr,\n isDocumentFragment,\n getDirectAndNestedSpanText,\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\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 =\n this._isDisabledServerSide === null\n ? !!instance.persistence?.props[AUTOCAPTURE_DISABLED_SERVER_SIDE]\n : this._isDisabledServerSide\n const enabled_client_side = !!instance.get_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 = getClassName(elem)\n if (classes.length > 0)\n props['classes'] = classes.split(' ').filter(function (c) {\n return c !== ''\n })\n\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 (!maskInputs && shouldCaptureValue(attr.value) && !isAngularStyleAttr(attr.name)) {\n props['attr__' + attr.name] = limitText(1024, attr.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 (typeof e.target === 'undefined') {\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 (e: Event, instance: PostHog, 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 (this.rageclicks?.isRageClick(e.clientX, e.clientY, new Date().getTime())) {\n this._captureEvent(e, instance, '$rageclick')\n }\n }\n\n if (target && shouldCaptureDomEvent(target, e, this.config)) {\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 = getClassName(el).split(' ')\n if (_includes(classes, 'ph-no-capture')) {\n explicitNoCapture = true\n }\n\n elementsJson.push(\n this._getPropertiesFromElement(\n el,\n instance.get_config('mask_all_element_attributes'),\n instance.get_config('mask_all_text')\n )\n )\n\n const augmentProperties = this._getAugmentPropertiesFromElement(el)\n _extend(autocaptureAugmentProperties, augmentProperties)\n })\n\n if (!instance.get_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 {\n $elements: elementsJson,\n },\n this._getCustomProperties(targetElementList),\n autocaptureAugmentProperties\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 window.location.href = href\n },\n\n _addDomEventHandlers: function (instance: PostHog): void {\n const handler = (e: Event) => {\n e = e || window.event\n this._captureEvent(e, instance)\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\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 (typeof instance.__autocapture !== 'boolean') {\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.get_config('rageclick'))\n },\n\n afterDecideResponse: function (response: DecideResponse, instance: PostHog): void {\n const token = instance.get_config('token')\n if (this._initializedTokens.indexOf(token) > -1) {\n logger.log('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,EACH,sBAAsB,EACtB,KAAK,EACL,OAAO,EACP,SAAS,EACT,WAAW,EACX,YAAY,EACZ,eAAe,EACf,0BAA0B,EAC1B,MAAM,GACT,MAAM,SAAS,CAAA;AAChB,OAAO,EACH,YAAY,EACZ,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,KAAK,EACL,UAAU,EACV,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,6BAA6B,EAC7B,kBAAkB,EAClB,kBAAkB,EAClB,0BAA0B,GAC7B,MAAM,qB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AgC,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,CAAC,gBAAgB,CAAC,CAAA;IACjD,CAAC;CACJ,CAAA;AAED,sBAAsB,CAAC,WAAW,CAAC,CAAA;AACnC,0BAA0B,CAAC,WAAW,CAAC,CAAA;AAEvC,OAAO,EAAE,WAAW,EAAE,CAAA","sourcesContent":["import {\n _bind_instance_methods,\n _each,\n _extend,\n _includes,\n _isFunction,\n _isUndefined,\n _register_event,\n _safewrap_instance_methods,\n logger,\n} from './utils'\nimport {\n getClassName,\n getSafeText,\n isElementNode,\n isSensitiveElement,\n isTag,\n isTextNode,\n shouldCaptureDomEvent,\n shouldCaptureElement,\n shouldCaptureValue,\n autocaptureCompatibleElements,\n isAngularStyleAttr,\n isDocumentFragment,\n getDirectAndNestedSpanText,\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\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 =\n this._isDisabledServerSide === null\n ? !!instance.persistence?.props[AUTOCAPTURE_DISABLED_SERVER_SIDE]\n : this._isDisabledServerSide\n const enabled_client_side = !!instance.get_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 = getClassName(elem)\n if (classes.length > 0)\n props['classes'] = classes.split(' ').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 props['attr__' + attr.name] = limitText(1024, attr.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 (typeof e.target === 'undefined') {\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 (e: Event, instance: PostHog, 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 (this.rageclicks?.isRageClick(e.clientX, e.clientY, new Date().getTime())) {\n this._captureEvent(e, instance, '$rageclick')\n }\n }\n\n if (target && shouldCaptureDomEvent(target, e, this.config)) {\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 = getClassName(el).split(' ')\n if (_includes(classes, 'ph-no-capture')) {\n explicitNoCapture = true\n }\n\n elementsJson.push(\n this._getPropertiesFromElement(\n el,\n instance.get_config('mask_all_element_attributes'),\n instance.get_config('mask_all_text')\n )\n )\n\n const augmentProperties = this._getAugmentPropertiesFromElement(el)\n _extend(autocaptureAugmentProperties, augmentProperties)\n })\n\n if (!instance.get_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 {\n $elements: elementsJson,\n },\n this._getCustomProperties(targetElementList),\n autocaptureAugmentProperties\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 window.location.href = href\n },\n\n _addDomEventHandlers: function (instance: PostHog): void {\n const handler = (e: Event) => {\n e = e || window.event\n this._captureEvent(e, instance)\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\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 (typeof instance.__autocapture !== 'boolean') {\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.get_config('rageclick'))\n },\n\n afterDecideResponse: function (response: DecideResponse, instance: PostHog): void {\n const token = instance.get_config('token')\n if (this._initializedTokens.indexOf(token) > -1) {\n logger.log('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"]}
|
package/lib/src/types.d.ts
CHANGED
|
@@ -38,6 +38,11 @@ export interface AutocaptureConfig {
|
|
|
38
38
|
* e.g. ['[ph-capture]']
|
|
39
39
|
*/
|
|
40
40
|
css_selector_allowlist?: string[];
|
|
41
|
+
/**
|
|
42
|
+
* Exclude certain element attributes from autocapture
|
|
43
|
+
* E.g. ['aria-label'] or [data-attr-pii]
|
|
44
|
+
*/
|
|
45
|
+
element_attribute_ignorelist?: string[];
|
|
41
46
|
}
|
|
42
47
|
export declare type UUIDVersion = 'og' | 'v7';
|
|
43
48
|
export interface PostHogConfig {
|
package/lib/src/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAgKA,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACnB,iCAAkB,CAAA;IAClB,gCAAiB,CAAA;AACrB,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB","sourcesContent":["import type { MaskInputOptions, SlimDOMOptions } from 'rrweb-snapshot'\nimport { PostHog } from './posthog-core'\nimport { RetryQueue } from './retry-queue'\n\nexport type Property = any\nexport type Properties = Record<string, Property>\nexport interface CaptureResult {\n uuid: string\n event: string\n properties: Properties\n $set?: Properties\n $set_once?: Properties\n timestamp?: Date\n}\nexport type CaptureCallback = (response: any, data: any) => void\n\nexport type AutocaptureCompatibleElement = 'a' | 'button' | 'form' | 'input' | 'select' | 'textarea' | 'label'\nexport type DomAutocaptureEvents = 'click' | 'change' | 'submit'\n\n/**\n * If an array is passed for an allowlist, autocapture events will only be sent for elements matching\n * at least one of the elements in the array. Multiple allowlists can be used\n */\nexport interface AutocaptureConfig {\n /**\n * List of URLs to allow autocapture on, can be strings to match\n * or regexes e.g. ['https://example.com', 'test.com/.*']\n */\n url_allowlist?: (string | RegExp)[]\n\n /**\n * List of DOM events to allow autocapture on e.g. ['click', 'change', 'submit']\n */\n dom_event_allowlist?: DomAutocaptureEvents[]\n\n /**\n * List of DOM elements to allow autocapture on\n * e.g. ['a', 'button', 'form', 'input', 'select', 'textarea', 'label']\n */\n element_allowlist?: AutocaptureCompatibleElement[]\n\n /**\n * List of CSS selectors to allow autocapture on\n * e.g. ['[ph-capture]']\n */\n css_selector_allowlist?: string[]\n}\n\nexport type UUIDVersion = 'og' | 'v7'\n\nexport interface PostHogConfig {\n api_host: string\n api_method: string\n api_transport: string\n ui_host: string | null\n token: string\n autocapture: boolean | AutocaptureConfig\n rageclick: boolean\n cross_subdomain_cookie: boolean\n persistence: 'localStorage' | 'cookie' | 'memory' | 'localStorage+cookie' | 'sessionStorage'\n persistence_name: string\n cookie_name: string\n loaded: (posthog_instance: PostHog) => void\n store_google: boolean\n custom_campaign_params: string[]\n // a list of strings to be tested against navigator.userAgent to determine if the source is a bot\n // this is **added to** the default list of bots that we check\n // defaults to the empty array\n custom_blocked_useragents: string[]\n save_referrer: boolean\n test: boolean\n verbose: boolean\n capture_pageview: boolean\n capture_pageleave: boolean\n debug: boolean\n cookie_expiration: number\n upgrade: boolean\n disable_session_recording: boolean\n disable_persistence: boolean\n disable_cookie: boolean\n enable_recording_console_log?: boolean\n secure_cookie: boolean\n ip: boolean\n opt_out_capturing_by_default: boolean\n opt_out_persistence_by_default: boolean\n opt_out_capturing_persistence_type: 'localStorage' | 'cookie'\n opt_out_capturing_cookie_prefix: string | null\n opt_in_site_apps: boolean\n respect_dnt: boolean\n property_blacklist: string[]\n xhr_headers: { [header_name: string]: string }\n on_xhr_error: (failedRequest: XMLHttpRequest) => void\n inapp_protocol: string\n inapp_link_new_window: boolean\n request_batching: boolean\n sanitize_properties: ((properties: Properties, event_name: string) => Properties) | null\n properties_string_max_length: number\n session_recording: SessionRecordingOptions\n session_idle_timeout_seconds: number\n mask_all_element_attributes: boolean\n mask_all_text: boolean\n advanced_disable_decide: boolean\n advanced_disable_feature_flags: boolean\n advanced_disable_feature_flags_on_first_load: boolean\n advanced_disable_toolbar_metrics: boolean\n get_device_id: (uuid: string) => string\n name: string\n callback_fn: string\n _onCapture: (eventName: string, eventData: CaptureResult) => void\n capture_performance?: boolean\n // Should only be used for testing. Could negatively impact performance.\n disable_compression: boolean\n bootstrap: {\n distinctID?: string\n isIdentifiedID?: boolean\n featureFlags?: Record<string, boolean | string>\n featureFlagPayloads?: Record<string, JsonType>\n }\n segment?: any\n __preview_measure_pageview_stats?: boolean\n}\n\nexport interface OptInOutCapturingOptions {\n capture: (event: string, properties: Properties, options: CaptureOptions) => void\n capture_event_name: string\n capture_properties: Properties\n enable_persistence: boolean\n clear_persistence: boolean\n persistence_type: 'cookie' | 'localStorage' | 'localStorage+cookie'\n cookie_prefix: string\n cookie_expiration: number\n cross_subdomain_cookie: boolean\n secure_cookie: boolean\n}\n\nexport interface isFeatureEnabledOptions {\n send_event: boolean\n}\n\nexport interface SessionRecordingOptions {\n blockClass?: string | RegExp\n blockSelector?: string | null\n ignoreClass?: string\n maskTextClass?: string | RegExp\n maskTextSelector?: string | null\n maskTextFn?: ((text: string) => string) | null\n maskAllInputs?: boolean\n maskInputOptions?: MaskInputOptions\n maskInputFn?: ((text: string, element?: HTMLElement) => string) | null\n /** Modify the network request before it is captured. Returning null stops it being captured */\n maskNetworkRequestFn?: ((url: NetworkRequest) => NetworkRequest | null | undefined) | null\n slimDOMOptions?: SlimDOMOptions | 'all' | true\n collectFonts?: boolean\n inlineStylesheet?: boolean\n recorderVersion?: 'v1' | 'v2'\n recordCrossOriginIframes?: boolean\n}\n\nexport type SessionIdChangedCallback = (sessionId: string, windowId: string | null | undefined) => void\n\nexport enum Compression {\n GZipJS = 'gzip-js',\n Base64 = 'base64',\n}\n\nexport interface XHROptions {\n transport?: 'XHR' | 'sendBeacon'\n method?: 'POST' | 'GET'\n urlQueryArgs?: { compression: Compression }\n verbose?: boolean\n blob?: boolean\n sendBeacon?: boolean\n}\n\nexport interface CaptureOptions extends XHROptions {\n $set?: Properties /** used with $identify */\n $set_once?: Properties /** used with $identify */\n _batchKey?: string /** key of queue, e.g. 'sessionRecording' vs 'event' */\n _metrics?: Properties\n _noTruncate?: boolean /** if set, overrides and disables config.properties_string_max_length */\n endpoint?: string /** defaults to '/e/' */\n send_instantly?: boolean /** if set skips the batched queue */\n timestamp?: Date\n}\n\nexport interface RetryQueueElement {\n retryAt: Date\n requestData: QueuedRequestData\n}\nexport interface QueuedRequestData {\n url: string\n data: Properties\n options: CaptureOptions\n headers?: Properties\n callback?: RequestCallback\n retriesPerformedSoFar?: number\n}\n\nexport interface XHRParams extends QueuedRequestData {\n retryQueue: RetryQueue\n onXHRError: (req: XMLHttpRequest) => void\n timeout?: number\n onResponse?: (req: XMLHttpRequest) => void\n}\n\nexport interface DecideResponse {\n status: number\n supportedCompression: Compression[]\n config: {\n enable_collect_everything: boolean\n }\n custom_properties: AutoCaptureCustomProperty[] // TODO: delete, not sent\n featureFlags: Record<string, string | boolean>\n featureFlagPayloads: Record<string, JsonType>\n errorsWhileComputingFlags: boolean\n autocapture_opt_out?: boolean\n capturePerformance?: boolean\n // this is currently in development and may have breaking changes without a major version bump\n autocaptureExceptions?:\n | boolean\n | {\n endpoint?: string\n errors_to_ignore: string[]\n }\n sessionRecording?: {\n endpoint?: string\n consoleLogRecordingEnabled?: boolean\n recorderVersion?: 'v1' | 'v2'\n }\n toolbarParams: ToolbarParams\n editorParams?: ToolbarParams /** @deprecated, renamed to toolbarParams, still present on older API responses */\n toolbarVersion: 'toolbar' /** @deprecated, moved to toolbarParams */\n isAuthenticated: boolean\n siteApps: { id: number; url: string }[]\n}\n\nexport type FeatureFlagsCallback = (flags: string[], variants: Record<string, string | boolean>) => void\n\n// TODO: delete custom_properties after changeless typescript refactor\nexport interface AutoCaptureCustomProperty {\n name: string\n css_selector: string\n event_selectors: string[]\n}\n\nexport interface CompressionData {\n data: string\n compression?: Compression\n}\n\nexport interface GDPROptions {\n capture?: (\n event: string,\n properties: Properties,\n options: CaptureOptions\n ) => void /** function used for capturing a PostHog event to record the opt-in action */\n captureEventName?: string /** event name to be used for capturing the opt-in action */\n captureProperties?: Properties /** set of properties to be captured along with the opt-in action */\n /** persistence mechanism used */\n persistenceType?: 'cookie' | 'localStorage' | 'localStorage+cookie'\n persistencePrefix?: string /** [__ph_opt_in_out] - custom prefix to be used in the cookie/localstorage name */\n cookieExpiration?: number /** number of days until the opt-in cookie expires */\n crossSubdomainCookie?: boolean /** whether the opt-in cookie is set as cross-subdomain or not */\n secureCookie?: boolean /** whether the opt-in cookie is set as secure or not */\n respectDnt?: boolean\n window?: Window\n}\n\nexport type RequestCallback = (response: Record<string, any>, data?: Properties) => void\n\nexport interface PersistentStore {\n is_supported: () => boolean\n error: (error: any) => void\n parse: (name: string) => any\n get: (name: string) => any\n set: (name: string, value: any, expire_days?: number | null, cross_subdomain?: boolean, secure?: boolean) => void\n remove: (name: string, cross_subdomain?: boolean) => void\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type Breaker = {}\nexport type EventHandler = (event: Event) => boolean | void\n\nexport type ToolbarUserIntent = 'add-action' | 'edit-action'\nexport type ToolbarSource = 'url' | 'localstorage'\nexport type ToolbarVersion = 'toolbar'\n\n/* sync with posthog */\nexport interface ToolbarParams {\n token?: string /** public posthog-js token */\n temporaryToken?: string /** private temporary user token */\n actionId?: number\n userIntent?: ToolbarUserIntent\n source?: ToolbarSource\n toolbarVersion?: ToolbarVersion\n instrument?: boolean\n distinctId?: string\n userEmail?: string\n dataAttributes?: string[]\n featureFlags?: Record<string, string | boolean>\n}\n\nexport interface PostData {\n buffer?: BlobPart\n compression?: Compression\n data?: string\n}\n\nexport interface JSC {\n (): void\n [key: string]: (response: any) => void\n}\n\nexport type SnippetArrayItem = [method: string, ...args: any[]]\n\nexport type JsonType = string | number | boolean | null | { [key: string]: JsonType } | Array<JsonType>\n\n/** A feature that isn't publicly available yet.*/\nexport interface EarlyAccessFeature {\n // Sync this with the backend's EarlyAccessFeatureSerializer!\n name: string\n description: string\n stage: 'concept' | 'alpha' | 'beta'\n documentationUrl: string | null\n flagKey: string | null\n}\n\nexport type EarlyAccessFeatureCallback = (earlyAccessFeatures: EarlyAccessFeature[]) => void\n\nexport interface EarlyAccessFeatureResponse {\n earlyAccessFeatures: EarlyAccessFeature[]\n}\n\nexport type NetworkRequest = {\n url: string\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAsKA,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACnB,iCAAkB,CAAA;IAClB,gCAAiB,CAAA;AACrB,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB","sourcesContent":["import type { MaskInputOptions, SlimDOMOptions } from 'rrweb-snapshot'\nimport { PostHog } from './posthog-core'\nimport { RetryQueue } from './retry-queue'\n\nexport type Property = any\nexport type Properties = Record<string, Property>\nexport interface CaptureResult {\n uuid: string\n event: string\n properties: Properties\n $set?: Properties\n $set_once?: Properties\n timestamp?: Date\n}\nexport type CaptureCallback = (response: any, data: any) => void\n\nexport type AutocaptureCompatibleElement = 'a' | 'button' | 'form' | 'input' | 'select' | 'textarea' | 'label'\nexport type DomAutocaptureEvents = 'click' | 'change' | 'submit'\n\n/**\n * If an array is passed for an allowlist, autocapture events will only be sent for elements matching\n * at least one of the elements in the array. Multiple allowlists can be used\n */\nexport interface AutocaptureConfig {\n /**\n * List of URLs to allow autocapture on, can be strings to match\n * or regexes e.g. ['https://example.com', 'test.com/.*']\n */\n url_allowlist?: (string | RegExp)[]\n\n /**\n * List of DOM events to allow autocapture on e.g. ['click', 'change', 'submit']\n */\n dom_event_allowlist?: DomAutocaptureEvents[]\n\n /**\n * List of DOM elements to allow autocapture on\n * e.g. ['a', 'button', 'form', 'input', 'select', 'textarea', 'label']\n */\n element_allowlist?: AutocaptureCompatibleElement[]\n\n /**\n * List of CSS selectors to allow autocapture on\n * e.g. ['[ph-capture]']\n */\n css_selector_allowlist?: string[]\n\n /**\n * Exclude certain element attributes from autocapture\n * E.g. ['aria-label'] or [data-attr-pii]\n */\n element_attribute_ignorelist?: string[]\n}\n\nexport type UUIDVersion = 'og' | 'v7'\n\nexport interface PostHogConfig {\n api_host: string\n api_method: string\n api_transport: string\n ui_host: string | null\n token: string\n autocapture: boolean | AutocaptureConfig\n rageclick: boolean\n cross_subdomain_cookie: boolean\n persistence: 'localStorage' | 'cookie' | 'memory' | 'localStorage+cookie' | 'sessionStorage'\n persistence_name: string\n cookie_name: string\n loaded: (posthog_instance: PostHog) => void\n store_google: boolean\n custom_campaign_params: string[]\n // a list of strings to be tested against navigator.userAgent to determine if the source is a bot\n // this is **added to** the default list of bots that we check\n // defaults to the empty array\n custom_blocked_useragents: string[]\n save_referrer: boolean\n test: boolean\n verbose: boolean\n capture_pageview: boolean\n capture_pageleave: boolean\n debug: boolean\n cookie_expiration: number\n upgrade: boolean\n disable_session_recording: boolean\n disable_persistence: boolean\n disable_cookie: boolean\n enable_recording_console_log?: boolean\n secure_cookie: boolean\n ip: boolean\n opt_out_capturing_by_default: boolean\n opt_out_persistence_by_default: boolean\n opt_out_capturing_persistence_type: 'localStorage' | 'cookie'\n opt_out_capturing_cookie_prefix: string | null\n opt_in_site_apps: boolean\n respect_dnt: boolean\n property_blacklist: string[]\n xhr_headers: { [header_name: string]: string }\n on_xhr_error: (failedRequest: XMLHttpRequest) => void\n inapp_protocol: string\n inapp_link_new_window: boolean\n request_batching: boolean\n sanitize_properties: ((properties: Properties, event_name: string) => Properties) | null\n properties_string_max_length: number\n session_recording: SessionRecordingOptions\n session_idle_timeout_seconds: number\n mask_all_element_attributes: boolean\n mask_all_text: boolean\n advanced_disable_decide: boolean\n advanced_disable_feature_flags: boolean\n advanced_disable_feature_flags_on_first_load: boolean\n advanced_disable_toolbar_metrics: boolean\n get_device_id: (uuid: string) => string\n name: string\n callback_fn: string\n _onCapture: (eventName: string, eventData: CaptureResult) => void\n capture_performance?: boolean\n // Should only be used for testing. Could negatively impact performance.\n disable_compression: boolean\n bootstrap: {\n distinctID?: string\n isIdentifiedID?: boolean\n featureFlags?: Record<string, boolean | string>\n featureFlagPayloads?: Record<string, JsonType>\n }\n segment?: any\n __preview_measure_pageview_stats?: boolean\n}\n\nexport interface OptInOutCapturingOptions {\n capture: (event: string, properties: Properties, options: CaptureOptions) => void\n capture_event_name: string\n capture_properties: Properties\n enable_persistence: boolean\n clear_persistence: boolean\n persistence_type: 'cookie' | 'localStorage' | 'localStorage+cookie'\n cookie_prefix: string\n cookie_expiration: number\n cross_subdomain_cookie: boolean\n secure_cookie: boolean\n}\n\nexport interface isFeatureEnabledOptions {\n send_event: boolean\n}\n\nexport interface SessionRecordingOptions {\n blockClass?: string | RegExp\n blockSelector?: string | null\n ignoreClass?: string\n maskTextClass?: string | RegExp\n maskTextSelector?: string | null\n maskTextFn?: ((text: string) => string) | null\n maskAllInputs?: boolean\n maskInputOptions?: MaskInputOptions\n maskInputFn?: ((text: string, element?: HTMLElement) => string) | null\n /** Modify the network request before it is captured. Returning null stops it being captured */\n maskNetworkRequestFn?: ((url: NetworkRequest) => NetworkRequest | null | undefined) | null\n slimDOMOptions?: SlimDOMOptions | 'all' | true\n collectFonts?: boolean\n inlineStylesheet?: boolean\n recorderVersion?: 'v1' | 'v2'\n recordCrossOriginIframes?: boolean\n}\n\nexport type SessionIdChangedCallback = (sessionId: string, windowId: string | null | undefined) => void\n\nexport enum Compression {\n GZipJS = 'gzip-js',\n Base64 = 'base64',\n}\n\nexport interface XHROptions {\n transport?: 'XHR' | 'sendBeacon'\n method?: 'POST' | 'GET'\n urlQueryArgs?: { compression: Compression }\n verbose?: boolean\n blob?: boolean\n sendBeacon?: boolean\n}\n\nexport interface CaptureOptions extends XHROptions {\n $set?: Properties /** used with $identify */\n $set_once?: Properties /** used with $identify */\n _batchKey?: string /** key of queue, e.g. 'sessionRecording' vs 'event' */\n _metrics?: Properties\n _noTruncate?: boolean /** if set, overrides and disables config.properties_string_max_length */\n endpoint?: string /** defaults to '/e/' */\n send_instantly?: boolean /** if set skips the batched queue */\n timestamp?: Date\n}\n\nexport interface RetryQueueElement {\n retryAt: Date\n requestData: QueuedRequestData\n}\nexport interface QueuedRequestData {\n url: string\n data: Properties\n options: CaptureOptions\n headers?: Properties\n callback?: RequestCallback\n retriesPerformedSoFar?: number\n}\n\nexport interface XHRParams extends QueuedRequestData {\n retryQueue: RetryQueue\n onXHRError: (req: XMLHttpRequest) => void\n timeout?: number\n onResponse?: (req: XMLHttpRequest) => void\n}\n\nexport interface DecideResponse {\n status: number\n supportedCompression: Compression[]\n config: {\n enable_collect_everything: boolean\n }\n custom_properties: AutoCaptureCustomProperty[] // TODO: delete, not sent\n featureFlags: Record<string, string | boolean>\n featureFlagPayloads: Record<string, JsonType>\n errorsWhileComputingFlags: boolean\n autocapture_opt_out?: boolean\n capturePerformance?: boolean\n // this is currently in development and may have breaking changes without a major version bump\n autocaptureExceptions?:\n | boolean\n | {\n endpoint?: string\n errors_to_ignore: string[]\n }\n sessionRecording?: {\n endpoint?: string\n consoleLogRecordingEnabled?: boolean\n recorderVersion?: 'v1' | 'v2'\n }\n toolbarParams: ToolbarParams\n editorParams?: ToolbarParams /** @deprecated, renamed to toolbarParams, still present on older API responses */\n toolbarVersion: 'toolbar' /** @deprecated, moved to toolbarParams */\n isAuthenticated: boolean\n siteApps: { id: number; url: string }[]\n}\n\nexport type FeatureFlagsCallback = (flags: string[], variants: Record<string, string | boolean>) => void\n\n// TODO: delete custom_properties after changeless typescript refactor\nexport interface AutoCaptureCustomProperty {\n name: string\n css_selector: string\n event_selectors: string[]\n}\n\nexport interface CompressionData {\n data: string\n compression?: Compression\n}\n\nexport interface GDPROptions {\n capture?: (\n event: string,\n properties: Properties,\n options: CaptureOptions\n ) => void /** function used for capturing a PostHog event to record the opt-in action */\n captureEventName?: string /** event name to be used for capturing the opt-in action */\n captureProperties?: Properties /** set of properties to be captured along with the opt-in action */\n /** persistence mechanism used */\n persistenceType?: 'cookie' | 'localStorage' | 'localStorage+cookie'\n persistencePrefix?: string /** [__ph_opt_in_out] - custom prefix to be used in the cookie/localstorage name */\n cookieExpiration?: number /** number of days until the opt-in cookie expires */\n crossSubdomainCookie?: boolean /** whether the opt-in cookie is set as cross-subdomain or not */\n secureCookie?: boolean /** whether the opt-in cookie is set as secure or not */\n respectDnt?: boolean\n window?: Window\n}\n\nexport type RequestCallback = (response: Record<string, any>, data?: Properties) => void\n\nexport interface PersistentStore {\n is_supported: () => boolean\n error: (error: any) => void\n parse: (name: string) => any\n get: (name: string) => any\n set: (name: string, value: any, expire_days?: number | null, cross_subdomain?: boolean, secure?: boolean) => void\n remove: (name: string, cross_subdomain?: boolean) => void\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type Breaker = {}\nexport type EventHandler = (event: Event) => boolean | void\n\nexport type ToolbarUserIntent = 'add-action' | 'edit-action'\nexport type ToolbarSource = 'url' | 'localstorage'\nexport type ToolbarVersion = 'toolbar'\n\n/* sync with posthog */\nexport interface ToolbarParams {\n token?: string /** public posthog-js token */\n temporaryToken?: string /** private temporary user token */\n actionId?: number\n userIntent?: ToolbarUserIntent\n source?: ToolbarSource\n toolbarVersion?: ToolbarVersion\n instrument?: boolean\n distinctId?: string\n userEmail?: string\n dataAttributes?: string[]\n featureFlags?: Record<string, string | boolean>\n}\n\nexport interface PostData {\n buffer?: BlobPart\n compression?: Compression\n data?: string\n}\n\nexport interface JSC {\n (): void\n [key: string]: (response: any) => void\n}\n\nexport type SnippetArrayItem = [method: string, ...args: any[]]\n\nexport type JsonType = string | number | boolean | null | { [key: string]: JsonType } | Array<JsonType>\n\n/** A feature that isn't publicly available yet.*/\nexport interface EarlyAccessFeature {\n // Sync this with the backend's EarlyAccessFeatureSerializer!\n name: string\n description: string\n stage: 'concept' | 'alpha' | 'beta'\n documentationUrl: string | null\n flagKey: string | null\n}\n\nexport type EarlyAccessFeatureCallback = (earlyAccessFeatures: EarlyAccessFeature[]) => void\n\nexport interface EarlyAccessFeatureResponse {\n earlyAccessFeatures: EarlyAccessFeature[]\n}\n\nexport type NetworkRequest = {\n url: string\n}\n"]}
|
package/package.json
CHANGED