posthog-react-native 4.84.2 → 4.84.3
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/autocapture.js +1 -1
- package/dist/autocapture.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +4 -4
package/dist/autocapture.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.maxAncestorsTraversed=exports.findOwningNode=exports.defaultPostHogLabelProp=exports.autocaptureFromTouchEvent=void 0;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){(0,_defineProperty2["default"])(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var _n=0,F=function F(){};return{s:F,n:function n(){return _n>=r.length?{done:!0}:{done:!1,value:r[_n++]};},e:function e(r){throw r;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var o,a=!0,u=!1;return{s:function s(){t=t.call(r);},n:function n(){var r=t.next();return a=r.done,r;},e:function e(r){u=!0,o=r;},f:function f(){try{a||null==t["return"]||t["return"]();}finally{if(u)throw o;}}};}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}var isAnimatedValue=function isAnimatedValue(value){return(value===null||value===void 0?void 0:value._isReanimatedSharedValue)===true||(0,_typeof2["default"])(value)==='object'&&value!==null&&'_value'in value;};var _flattenStyles=function flattenStyles(styles){var flattened={};if(isAnimatedValue(styles)){return{};}if(Array.isArray(styles)){var _iterator=_createForOfIteratorHelper(styles),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var style=_step.value;(0,_extends2["default"])(flattened,_flattenStyles(style));}}catch(err){_iterator.e(err);}finally{_iterator.f();}}else if(styles&&(0,_typeof2["default"])(styles)==='object'){for(var key in styles){if(!isAnimatedValue(styles[key])){flattened[key]=styles[key];}}}return flattened;};var stringifyStyle=function stringifyStyle(styles){var flattened=_flattenStyles(styles);var str=Object.keys(flattened).map(function(x){return"".concat(x,":").concat(flattened[x]);}).join(';');return str;};var sanitiseLabel=function sanitiseLabel(label){return label.replace(/[^a-z0-9]+/gi,'-');};var defaultPostHogLabelProp=exports.defaultPostHogLabelProp='ph-label';var captureAttributePrefix='data-ph-capture-attribute-';var frameworkInternalLabels=['LocaleProvider'];var reactFiberKeyPattern=/^__react(Fiber|InternalInstance)\$/;var maxFallbackAncestors=100;var maxOwnerAncestors=100;var warnedCaptureFailure=false;var getFallbackTargetInstance=function getFallbackTargetInstance(e){var node=e.target;for(var depth=0;node&&(0,_typeof2["default"])(node)==='object'&&depth<maxFallbackAncestors;depth++){var key=Object.getOwnPropertyNames(node).find(function(name){return reactFiberKeyPattern.test(name);});if(key){return node[key];}node=node.parentNode;}return undefined;};var findOwningNode=exports.findOwningNode=function findOwningNode(e,owners){var current=e._targetInst||getFallbackTargetInstance(e);for(var depth=0;current&&depth<maxOwnerAncestors;depth++){if(current.stateNode&&owners.has(current.stateNode)){return current.stateNode;}current=current["return"];}return undefined;};var maxAncestorsTraversed=exports.maxAncestorsTraversed=1000;var defaultMaxElementsCaptured=20;var autocaptureFromTouchEvent=exports.autocaptureFromTouchEvent=function autocaptureFromTouchEvent(e,posthog){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var eventType=arguments.length>3&&arguments[3]!==undefined?arguments[3]:'touch';try{captureFromEvent(e,posthog,options,eventType);}catch(error){if(!warnedCaptureFailure){warnedCaptureFailure=true;console.warn('PostHog autocapture: capturing the interaction threw:',error);}}};var captureFromEvent=function captureFromEvent(e,posthog,options,eventType){var _a,_b,_c,_d;var _options$noCapturePro=options.noCaptureProp,noCaptureProp=_options$noCapturePro===void 0?'ph-no-capture':_options$noCapturePro,_options$customLabelP=options.customLabelProp,customLabelProp=_options$customLabelP===void 0?defaultPostHogLabelProp:_options$customLabelP,_options$maxElementsC=options.maxElementsCaptured,maxElementsCapturedOption=_options$maxElementsC===void 0?defaultMaxElementsCaptured:_options$maxElementsC,_options$ignoreLabels=options.ignoreLabels,ignoreLabels=_options$ignoreLabels===void 0?[]:_options$ignoreLabels,_options$propsToCaptu=options.propsToCapture,propsToCapture=_options$propsToCaptu===void 0?['style','testID','accessibilityLabel',customLabelProp,'children']:_options$propsToCaptu;var maxElementsCaptured=Number.isFinite(maxElementsCapturedOption)?maxElementsCapturedOption:defaultMaxElementsCaptured;var nativeInst=e._targetInst;var targetInst=nativeInst||getFallbackTargetInstance(e);if(!targetInst){return;}var elements=[];var autocaptureProperties={};var currentInst=targetInst;var ancestorsTraversed=0;var _loop=function _loop(){var props=currentInst.memoizedProps;if(ancestorsTraversed++>=maxAncestorsTraversed){return{v:void 0};}if(props===null||props===void 0?void 0:props[noCaptureProp]){return{v:void 0};}if(elements.length>=maxElementsCaptured){currentInst=currentInst["return"];return 0;}var el={tag_name:''};var elAutocaptureProperties={};if(props){Object.keys(props).forEach(function(key){var value=props[key];if(key.indexOf(captureAttributePrefix)===0){var propertyKey=key.slice(captureAttributePrefix.length);if(propertyKey&&['string','number','boolean'].includes((0,_typeof2["default"])(value))&&value!==''){elAutocaptureProperties[propertyKey]=value;}}if(!propsToCapture.includes(key)){return;}if(key==='style'){try{el.attr__style=stringifyStyle(value);}catch(error){}}else if(['string','number','boolean'].includes((0,_typeof2["default"])(value))){if(key==='children'){el.$el_text=typeof value==='string'?value:JSON.stringify(value);}else{el["attr__".concat(key)]=value;}}});}var hasCustomLabel=typeof(props===null||props===void 0?void 0:props[customLabelProp])!=='undefined';var label=hasCustomLabel?"".concat(props===null||props===void 0?void 0:props[customLabelProp]):((_a=currentInst.elementType)===null||_a===void 0?void 0:_a.displayName)||((_b=currentInst.elementType)===null||_b===void 0?void 0:_b.name);(0,_extends2["default"])(autocaptureProperties,elAutocaptureProperties);var isFrameworkWrapper=!nativeInst&&!hasCustomLabel&&elements.length===0&&frameworkInternalLabels.includes(label);if(label&&!isFrameworkWrapper&&!ignoreLabels.includes(label)){el.tag_name=sanitiseLabel(label);elements.push(el);}currentInst=currentInst["return"];},_ret;while(currentInst){_ret=_loop();if(_ret===0)continue;if(_ret)return _ret.v;}if(elements.length){var elAttrLabelKey="attr__".concat(customLabelProp);var lastLabel=undefined;for(var i=elements.length-1;i>=0;i--){var element=elements[i];if(element[elAttrLabelKey]){lastLabel=element[elAttrLabelKey];}if(lastLabel){element['tag_name']=lastLabel;}}posthog.autocapture(eventType,elements,_objectSpread(_objectSpread({},autocaptureProperties),{},{$touch_x:(_c=e.nativeEvent)===null||_c===void 0?void 0:_c.pageX,$touch_y:(_d=e.nativeEvent)===null||_d===void 0?void 0:_d.pageY}));}};
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.maxAncestorsTraversed=exports.findOwningNode=exports.defaultPostHogLabelProp=exports.autocaptureFromTouchEvent=void 0;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){(0,_defineProperty2["default"])(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var _n=0,F=function F(){};return{s:F,n:function n(){return _n>=r.length?{done:!0}:{done:!1,value:r[_n++]};},e:function e(r){throw r;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var o,a=!0,u=!1;return{s:function s(){t=t.call(r);},n:function n(){var r=t.next();return a=r.done,r;},e:function e(r){u=!0,o=r;},f:function f(){try{a||null==t["return"]||t["return"]();}finally{if(u)throw o;}}};}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}var isAnimatedValue=function isAnimatedValue(value){return(value===null||value===void 0?void 0:value._isReanimatedSharedValue)===true||(0,_typeof2["default"])(value)==='object'&&value!==null&&'_value'in value;};var _flattenStyles=function flattenStyles(styles){var flattened={};if(isAnimatedValue(styles)){return{};}if(Array.isArray(styles)){var _iterator=_createForOfIteratorHelper(styles),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var style=_step.value;(0,_extends2["default"])(flattened,_flattenStyles(style));}}catch(err){_iterator.e(err);}finally{_iterator.f();}}else if(styles&&(0,_typeof2["default"])(styles)==='object'){for(var key in styles){if(!isAnimatedValue(styles[key])){flattened[key]=styles[key];}}}return flattened;};var stringifyStyle=function stringifyStyle(styles){var flattened=_flattenStyles(styles);var str=Object.keys(flattened).map(function(x){return"".concat(x,":").concat(flattened[x]);}).join(';');return str;};var sanitiseLabel=function sanitiseLabel(label){return label.replace(/[^a-z0-9]+/gi,'-');};var defaultPostHogLabelProp=exports.defaultPostHogLabelProp='ph-label';var captureAttributePrefix='data-ph-capture-attribute-';var frameworkInternalLabels=['LocaleProvider'];var reactFiberKeyPattern=/^__react(Fiber|InternalInstance)\$/;var maxFallbackAncestors=100;var maxOwnerAncestors=100;var warnedCaptureFailure=false;var getFallbackTargetInstance=function getFallbackTargetInstance(e){var node=e.target;for(var depth=0;node&&(0,_typeof2["default"])(node)==='object'&&depth<maxFallbackAncestors;depth++){if(node.__internalInstanceHandle){return node.__internalInstanceHandle;}var key=Object.getOwnPropertyNames(node).find(function(name){return reactFiberKeyPattern.test(name);});if(key){return node[key];}node=node.parentNode;}return undefined;};var findOwningNode=exports.findOwningNode=function findOwningNode(e,owners){var current=e._targetInst||getFallbackTargetInstance(e);for(var depth=0;current&&depth<maxOwnerAncestors;depth++){if(current.stateNode&&owners.has(current.stateNode)){return current.stateNode;}current=current["return"];}return undefined;};var maxAncestorsTraversed=exports.maxAncestorsTraversed=1000;var defaultMaxElementsCaptured=20;var autocaptureFromTouchEvent=exports.autocaptureFromTouchEvent=function autocaptureFromTouchEvent(e,posthog){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var eventType=arguments.length>3&&arguments[3]!==undefined?arguments[3]:'touch';try{captureFromEvent(e,posthog,options,eventType);}catch(error){if(!warnedCaptureFailure){warnedCaptureFailure=true;console.warn('PostHog autocapture: capturing the interaction threw:',error);}}};var captureFromEvent=function captureFromEvent(e,posthog,options,eventType){var _a,_b,_c,_d;var _options$noCapturePro=options.noCaptureProp,noCaptureProp=_options$noCapturePro===void 0?'ph-no-capture':_options$noCapturePro,_options$customLabelP=options.customLabelProp,customLabelProp=_options$customLabelP===void 0?defaultPostHogLabelProp:_options$customLabelP,_options$maxElementsC=options.maxElementsCaptured,maxElementsCapturedOption=_options$maxElementsC===void 0?defaultMaxElementsCaptured:_options$maxElementsC,_options$ignoreLabels=options.ignoreLabels,ignoreLabels=_options$ignoreLabels===void 0?[]:_options$ignoreLabels,_options$propsToCaptu=options.propsToCapture,propsToCapture=_options$propsToCaptu===void 0?['style','testID','accessibilityLabel',customLabelProp,'children']:_options$propsToCaptu;var maxElementsCaptured=Number.isFinite(maxElementsCapturedOption)?maxElementsCapturedOption:defaultMaxElementsCaptured;var nativeInst=e._targetInst;var targetInst=nativeInst||getFallbackTargetInstance(e);if(!targetInst){return;}var elements=[];var autocaptureProperties={};var currentInst=targetInst;var ancestorsTraversed=0;var _loop=function _loop(){var props=currentInst.memoizedProps;if(ancestorsTraversed++>=maxAncestorsTraversed){return{v:void 0};}if(props===null||props===void 0?void 0:props[noCaptureProp]){return{v:void 0};}if(elements.length>=maxElementsCaptured){currentInst=currentInst["return"];return 0;}var el={tag_name:''};var elAutocaptureProperties={};if(props){Object.keys(props).forEach(function(key){var value=props[key];if(key.indexOf(captureAttributePrefix)===0){var propertyKey=key.slice(captureAttributePrefix.length);if(propertyKey&&['string','number','boolean'].includes((0,_typeof2["default"])(value))&&value!==''){elAutocaptureProperties[propertyKey]=value;}}if(!propsToCapture.includes(key)){return;}if(key==='style'){try{el.attr__style=stringifyStyle(value);}catch(error){}}else if(['string','number','boolean'].includes((0,_typeof2["default"])(value))){if(key==='children'){el.$el_text=typeof value==='string'?value:JSON.stringify(value);}else{el["attr__".concat(key)]=value;}}});}var hasCustomLabel=typeof(props===null||props===void 0?void 0:props[customLabelProp])!=='undefined';var label=hasCustomLabel?"".concat(props===null||props===void 0?void 0:props[customLabelProp]):((_a=currentInst.elementType)===null||_a===void 0?void 0:_a.displayName)||((_b=currentInst.elementType)===null||_b===void 0?void 0:_b.name);(0,_extends2["default"])(autocaptureProperties,elAutocaptureProperties);var isFrameworkWrapper=!nativeInst&&!hasCustomLabel&&elements.length===0&&frameworkInternalLabels.includes(label);if(label&&!isFrameworkWrapper&&!ignoreLabels.includes(label)){el.tag_name=sanitiseLabel(label);elements.push(el);}currentInst=currentInst["return"];},_ret;while(currentInst){_ret=_loop();if(_ret===0)continue;if(_ret)return _ret.v;}if(elements.length){var elAttrLabelKey="attr__".concat(customLabelProp);var lastLabel=undefined;for(var i=elements.length-1;i>=0;i--){var element=elements[i];if(element[elAttrLabelKey]){lastLabel=element[elAttrLabelKey];}if(lastLabel){element['tag_name']=lastLabel;}}posthog.autocapture(eventType,elements,_objectSpread(_objectSpread({},autocaptureProperties),{},{$touch_x:(_c=e.nativeEvent)===null||_c===void 0?void 0:_c.pageX,$touch_y:(_d=e.nativeEvent)===null||_d===void 0?void 0:_d.pageY}));}};
|
|
2
2
|
//# sourceMappingURL=autocapture.js.map
|
package/dist/autocapture.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocapture.js","names":["isAnimatedValue","value","_isReanimatedSharedValue","_typeof2","flattenStyles","styles","flattened","Array","isArray","_iterator","_createForOfIteratorHelper","_step","s","n","done","style","_extends2","err","e","f","key","stringifyStyle","str","Object","keys","map","x","concat","join","sanitiseLabel","label","replace","defaultPostHogLabelProp","exports","captureAttributePrefix","frameworkInternalLabels","reactFiberKeyPattern","maxFallbackAncestors","maxOwnerAncestors","warnedCaptureFailure","getFallbackTargetInstance","node","target","depth","getOwnPropertyNames","find","name","test","parentNode","undefined","findOwningNode","owners","current","_targetInst","stateNode","has","maxAncestorsTraversed","defaultMaxElementsCaptured","autocaptureFromTouchEvent","posthog","options","arguments","length","eventType","captureFromEvent","error","console","warn","_options$noCapturePro","noCaptureProp","_options$customLabelP","customLabelProp","_options$maxElementsC","maxElementsCaptured","maxElementsCapturedOption","_options$ignoreLabels","ignoreLabels","_options$propsToCaptu","propsToCapture","Number","isFinite","nativeInst","targetInst","elements","autocaptureProperties","currentInst","ancestorsTraversed","_loop","props","memoizedProps","v","el","tag_name","elAutocaptureProperties","forEach","indexOf","propertyKey","slice","includes","attr__style","$el_text","JSON","stringify","hasCustomLabel","_a","elementType","displayName","_b","isFrameworkWrapper","push","_ret","elAttrLabelKey","lastLabel","i","element","autocapture","_objectSpread","$touch_x","_c","nativeEvent","pageX","$touch_y","_d","pageY"],"sources":["../src/autocapture.tsx"],"sourcesContent":["import { PostHog } from './posthog-rn'\nimport { PostHogAutocaptureElement, JsonType } from '@posthog/core'\nimport { PostHogAutocaptureOptions } from './types'\n\ninterface Element {\n elementType?: {\n displayName?: string\n name?: string\n }\n memoizedProps?: Record<string, unknown>\n return?: Element\n // Host fibers carry their DOM node here; used to scope web capture to a provider's subtree.\n stateNode?: unknown\n}\n\nconst isAnimatedValue = (value: any): boolean => {\n // Check if it's a Reanimated shared value or animated style\n // _isReanimatedSharedValue is the official internal marker for SharedValues\n // Also check for _value property which is present in SharedValues\n return value?._isReanimatedSharedValue === true || (typeof value === 'object' && value !== null && '_value' in value)\n}\n\nconst flattenStyles = (styles: any): any => {\n const flattened: any = {}\n\n // Skip if the entire style object is an animated value\n if (isAnimatedValue(styles)) {\n return {}\n }\n\n if (Array.isArray(styles)) {\n for (const style of styles) {\n Object.assign(flattened, flattenStyles(style))\n }\n } else if (styles && typeof styles === 'object') {\n // Filter out individual animated properties within a regular style object\n // This handles cases like { opacity: animatedValue, backgroundColor: 'red' }\n for (const key in styles) {\n if (!isAnimatedValue(styles[key])) {\n flattened[key] = styles[key]\n }\n }\n }\n\n return flattened\n}\n\nconst stringifyStyle = (styles: any): string => {\n const flattened = flattenStyles(styles)\n\n const str = Object.keys(flattened)\n .map((x) => `${x}:${flattened[x]}`)\n .join(';')\n\n return str\n}\n\nconst sanitiseLabel = (label: string): string => {\n return label.replace(/[^a-z0-9]+/gi, '-')\n}\n\nexport const defaultPostHogLabelProp = 'ph-label'\n\nconst captureAttributePrefix = 'data-ph-capture-attribute-'\n\n// react-native-web internals; skipped only where RNW puts them, so a same-named app component is kept.\n// Verified against RNW 0.20.0 and 0.21.2: createElement wraps in LocaleProvider only when\n// `domProps.dir` is set, so a nested element inside a text ancestor never gets one. Recheck on bump.\nconst frameworkInternalLabels = ['LocaleProvider']\n\nconst reactFiberKeyPattern = /^__react(Fiber|InternalInstance)\\$/\n\n// Cycle guard, not a depth policy: real DOM chains null-terminate, a malformed parentNode may not.\nconst maxFallbackAncestors = 100\n\n// Separate bound for the fiber walk: unrelated to the DOM guard above, so tuning one never\n// silently retunes the other.\nconst maxOwnerAncestors = 100\n\n// Fires per interaction, so warn once: a persistent failure here silently disables autocapture.\nlet warnedCaptureFailure = false\n\n// react-dom (RN Web) events have no _targetInst; the fiber sits on e.target under a randomised\n// __reactFiber$ key. The clicked node may be a non-React node inside a React subtree, so walk up.\nconst getFallbackTargetInstance = (e: any): Element | undefined => {\n let node = e.target\n\n for (let depth = 0; node && typeof node === 'object' && depth < maxFallbackAncestors; depth++) {\n const key = Object.getOwnPropertyNames(node).find((name) => reactFiberKeyPattern.test(name))\n if (key) {\n return node[key]\n }\n node = node.parentNode\n }\n\n return undefined\n}\n\n// Returns the owner node this event happened under, or undefined if none owns it. Walks the fiber\n// tree, not the DOM: RNW's Modal portals to document.body, so the DOM parent chain leaves the\n// subtree but fiber `.return` does not. Kept separate from the element walk in captureFromEvent,\n// which stops at maxElementsCaptured and would falsely reject a deep target.\nexport const findOwningNode = (e: any, owners: { has(node: unknown): boolean }): unknown => {\n let current: Element | undefined = e._targetInst || getFallbackTargetInstance(e)\n for (let depth = 0; current && depth < maxOwnerAncestors; depth++) {\n if (current.stateNode && owners.has(current.stateNode)) {\n return current.stateNode\n }\n current = current.return\n }\n\n return undefined\n}\n\n// Fail-closed bound on the walk; unrelated to maxElementsCaptured, which caps the emitted payload.\nexport const maxAncestorsTraversed = 1000\n\nconst defaultMaxElementsCaptured = 20\n\n// Autocapture must never break the host app: a throw would escape into RN's touch dispatch on\n// native, or the DOM click handler on web. Matches the browser SDK, which guards its equivalent\n// document-level handler (packages/browser/src/autocapture.ts).\nexport const autocaptureFromTouchEvent = (\n e: any,\n posthog: PostHog,\n options: PostHogAutocaptureOptions = {},\n eventType: 'touch' | 'click' = 'touch'\n): void => {\n try {\n captureFromEvent(e, posthog, options, eventType)\n } catch (error) {\n if (!warnedCaptureFailure) {\n warnedCaptureFailure = true\n console.warn('PostHog autocapture: capturing the interaction threw:', error)\n }\n }\n}\n\nconst captureFromEvent = (\n e: any,\n posthog: PostHog,\n options: PostHogAutocaptureOptions,\n eventType: 'touch' | 'click'\n): void => {\n const {\n noCaptureProp = 'ph-no-capture',\n customLabelProp = defaultPostHogLabelProp,\n maxElementsCaptured: maxElementsCapturedOption = defaultMaxElementsCaptured,\n ignoreLabels = [],\n propsToCapture = ['style', 'testID', 'accessibilityLabel', customLabelProp, 'children'],\n } = options\n\n // The destructure default only covers `undefined`; a NaN would make every comparison against it\n // false, silently uncapping the payload instead of capping it.\n const maxElementsCaptured = Number.isFinite(maxElementsCapturedOption)\n ? maxElementsCapturedOption\n : defaultMaxElementsCaptured\n\n const nativeInst = e._targetInst\n const targetInst: Element | undefined = nativeInst || getFallbackTargetInstance(e)\n if (!targetInst) {\n return\n }\n const elements: PostHogAutocaptureElement[] = []\n const autocaptureProperties: Record<string, JsonType> = {}\n\n let currentInst: Element | undefined = targetInst\n let ancestorsTraversed = 0\n\n while (currentInst) {\n const props = currentInst.memoizedProps\n\n if (ancestorsTraversed++ >= maxAncestorsTraversed) {\n return\n }\n\n if (props?.[noCaptureProp]) {\n // Immediately ignore events if a no capture is in the chain\n return\n }\n\n if (elements.length >= maxElementsCaptured) {\n // keep walking so a no capture ancestor above the cap is still seen\n currentInst = currentInst.return\n continue\n }\n\n const el: PostHogAutocaptureElement = {\n tag_name: '',\n }\n const elAutocaptureProperties: Record<string, JsonType> = {}\n\n if (props) {\n // Capture data-ph-capture-attribute props as event properties.\n // Element props are only captured from propsToCapture.\n Object.keys(props).forEach((key) => {\n const value = props[key]\n\n if (key.indexOf(captureAttributePrefix) === 0) {\n const propertyKey = key.slice(captureAttributePrefix.length)\n if (propertyKey && ['string', 'number', 'boolean'].includes(typeof value) && value !== '') {\n elAutocaptureProperties[propertyKey] = value as JsonType\n }\n }\n\n if (!propsToCapture.includes(key)) {\n return\n }\n\n if (key === 'style') {\n // Safely handle style prop, especially for animated styles\n try {\n el.attr__style = stringifyStyle(value)\n } catch (error) {\n // Skip style capturing if it fails (e.g., animated styles)\n }\n } else if (['string', 'number', 'boolean'].includes(typeof value)) {\n if (key === 'children') {\n el.$el_text = typeof value === 'string' ? value : JSON.stringify(value)\n } else {\n el[`attr__${key}`] = value as JsonType\n }\n }\n })\n }\n\n // Try and find a sensible label\n const hasCustomLabel = typeof props?.[customLabelProp] !== 'undefined'\n const label = hasCustomLabel\n ? `${props?.[customLabelProp]}`\n : currentInst.elementType?.displayName || currentInst.elementType?.name\n\n Object.assign(autocaptureProperties, elAutocaptureProperties)\n\n // RNW wraps the touched host node directly, so its internals only ever head the chain; a match\n // further up is the app's own component. A user-set label is never a framework internal.\n const isFrameworkWrapper =\n !nativeInst && !hasCustomLabel && elements.length === 0 && frameworkInternalLabels.includes(label as string)\n\n if (label && !isFrameworkWrapper && !ignoreLabels.includes(label)) {\n el.tag_name = sanitiseLabel(label)\n elements.push(el)\n }\n\n currentInst = currentInst.return\n }\n\n if (elements.length) {\n // The element that was tapped, may be a child (or grandchild of an element with a customLabelProp (default: ph-label))\n // In this case, the current labels applied obscure the customLabelProp (default: ph-label)\n // To correct this, loop over the elements in reverse, and promote the customLabelProp (default: ph-label)\n const elAttrLabelKey = `attr__${customLabelProp}`\n let lastLabel: string | undefined = undefined\n\n for (let i = elements.length - 1; i >= 0; i--) {\n const element = elements[i]\n if (element[elAttrLabelKey]) {\n // this element had a customLabelProp (default: ph-label) set, promote it to the lastLabel\n lastLabel = element[elAttrLabelKey] as string\n }\n\n // if lastLabel is set, update this elements tag_name\n if (lastLabel) {\n element['tag_name'] = lastLabel\n }\n }\n posthog.autocapture(eventType, elements, {\n ...autocaptureProperties,\n $touch_x: e.nativeEvent?.pageX,\n $touch_y: e.nativeEvent?.pageY,\n })\n }\n}\n"],"mappings":"uyEAeA,GAAM,CAAAA,eAAe,CAAG,QAAlB,CAAAA,eAAeA,CAAIC,KAAU,CAAa,CAI9C,MAAO,CAAAA,KAAK,SAALA,KAAK,iBAALA,KAAK,CAAEC,wBAAwB,IAAK,IAAI,EAAK,GAAAC,QAAA,aAAOF,KAAK,IAAK,QAAQ,EAAIA,KAAK,GAAK,IAAI,EAAI,QAAQ,EAAI,CAAAA,KAAM,CACvH,CAAC,CAED,GAAM,CAAAG,cAAa,CAAG,QAAhB,CAAAA,aAAaA,CAAIC,MAAW,CAAS,CACzC,GAAM,CAAAC,SAAS,CAAQ,EAAE,CAGzB,GAAIN,eAAe,CAACK,MAAM,CAAC,CAAE,CAC3B,MAAO,EAAE,CACX,CAEA,GAAIE,KAAK,CAACC,OAAO,CAAC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,CAAG,CAAC,CAAEmD,CAAC,EAAI,CAAC,CAAEA,CAAC,EAAE,CAAE,CAC7C,GAAM,CAAAC,OAAO,CAAG/B,QAAQ,CAAC8B,CAAC,CAAC,CAC3B,GAAIC,OAAO,CAACH,cAAc,CAAC,CAAE,CAE3BC,SAAS,CAAGE,OAAO,CAACH,cAAc,CAAW,CAC/C,CAGA,GAAIC,SAAS,CAAE,CACbE,OAAO,CAAC,UAAU,CAAC,CAAGF,SAAS,CACjC,CACF,CACArD,OAAO,CAACwD,WAAW,CAACpD,SAAS,CAAEoB,QAAQ,CAAAiC,aAAA,CAAAA,aAAA,IAClChC,qBAAqB,MACxBiC,QAAQ,CAAE,CAAAC,EAAA,CAAApG,CAAC,CAACqG,WAAW,UAAAD,EAAA,iBAAAA,EAAA,CAAEE,KAAK,CAC9BC,QAAQ,CAAE,CAAAC,EAAA,CAAAxG,CAAC,CAACqG,WAAW,UAAAG,EAAA,iBAAAA,EAAA,CAAEC,KAAK,EAC/B,CAAC,CACJ,CACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"autocapture.js","names":["isAnimatedValue","value","_isReanimatedSharedValue","_typeof2","flattenStyles","styles","flattened","Array","isArray","_iterator","_createForOfIteratorHelper","_step","s","n","done","style","_extends2","err","e","f","key","stringifyStyle","str","Object","keys","map","x","concat","join","sanitiseLabel","label","replace","defaultPostHogLabelProp","exports","captureAttributePrefix","frameworkInternalLabels","reactFiberKeyPattern","maxFallbackAncestors","maxOwnerAncestors","warnedCaptureFailure","getFallbackTargetInstance","node","target","depth","__internalInstanceHandle","getOwnPropertyNames","find","name","test","parentNode","undefined","findOwningNode","owners","current","_targetInst","stateNode","has","maxAncestorsTraversed","defaultMaxElementsCaptured","autocaptureFromTouchEvent","posthog","options","arguments","length","eventType","captureFromEvent","error","console","warn","_options$noCapturePro","noCaptureProp","_options$customLabelP","customLabelProp","_options$maxElementsC","maxElementsCaptured","maxElementsCapturedOption","_options$ignoreLabels","ignoreLabels","_options$propsToCaptu","propsToCapture","Number","isFinite","nativeInst","targetInst","elements","autocaptureProperties","currentInst","ancestorsTraversed","_loop","props","memoizedProps","v","el","tag_name","elAutocaptureProperties","forEach","indexOf","propertyKey","slice","includes","attr__style","$el_text","JSON","stringify","hasCustomLabel","_a","elementType","displayName","_b","isFrameworkWrapper","push","_ret","elAttrLabelKey","lastLabel","i","element","autocapture","_objectSpread","$touch_x","_c","nativeEvent","pageX","$touch_y","_d","pageY"],"sources":["../src/autocapture.tsx"],"sourcesContent":["import { PostHog } from './posthog-rn'\nimport { PostHogAutocaptureElement, JsonType } from '@posthog/core'\nimport { PostHogAutocaptureOptions } from './types'\n\ninterface Element {\n elementType?: {\n displayName?: string\n name?: string\n }\n memoizedProps?: Record<string, unknown>\n return?: Element\n // Host fibers carry their DOM node here; used to scope web capture to a provider's subtree.\n stateNode?: unknown\n}\n\nconst isAnimatedValue = (value: any): boolean => {\n // Check if it's a Reanimated shared value or animated style\n // _isReanimatedSharedValue is the official internal marker for SharedValues\n // Also check for _value property which is present in SharedValues\n return value?._isReanimatedSharedValue === true || (typeof value === 'object' && value !== null && '_value' in value)\n}\n\nconst flattenStyles = (styles: any): any => {\n const flattened: any = {}\n\n // Skip if the entire style object is an animated value\n if (isAnimatedValue(styles)) {\n return {}\n }\n\n if (Array.isArray(styles)) {\n for (const style of styles) {\n Object.assign(flattened, flattenStyles(style))\n }\n } else if (styles && typeof styles === 'object') {\n // Filter out individual animated properties within a regular style object\n // This handles cases like { opacity: animatedValue, backgroundColor: 'red' }\n for (const key in styles) {\n if (!isAnimatedValue(styles[key])) {\n flattened[key] = styles[key]\n }\n }\n }\n\n return flattened\n}\n\nconst stringifyStyle = (styles: any): string => {\n const flattened = flattenStyles(styles)\n\n const str = Object.keys(flattened)\n .map((x) => `${x}:${flattened[x]}`)\n .join(';')\n\n return str\n}\n\nconst sanitiseLabel = (label: string): string => {\n return label.replace(/[^a-z0-9]+/gi, '-')\n}\n\nexport const defaultPostHogLabelProp = 'ph-label'\n\nconst captureAttributePrefix = 'data-ph-capture-attribute-'\n\n// react-native-web internals; skipped only where RNW puts them, so a same-named app component is kept.\n// Verified against RNW 0.20.0 and 0.21.2: createElement wraps in LocaleProvider only when\n// `domProps.dir` is set, so a nested element inside a text ancestor never gets one. Recheck on bump.\nconst frameworkInternalLabels = ['LocaleProvider']\n\nconst reactFiberKeyPattern = /^__react(Fiber|InternalInstance)\\$/\n\n// Cycle guard, not a depth policy: real DOM chains null-terminate, a malformed parentNode may not.\nconst maxFallbackAncestors = 100\n\n// Separate bound for the fiber walk: unrelated to the DOM guard above, so tuning one never\n// silently retunes the other.\nconst maxOwnerAncestors = 100\n\n// Fires per interaction, so warn once: a persistent failure here silently disables autocapture.\nlet warnedCaptureFailure = false\n\n// react-dom (RN Web) events have no _targetInst; the fiber sits on e.target under a randomised\n// __reactFiber$ key. Fabric host instances (RN new architecture) have no such key either, but expose\n// the fiber as __internalInstanceHandle. The clicked node may be a non-React node inside a React\n// subtree, so walk up.\nconst getFallbackTargetInstance = (e: any): Element | undefined => {\n let node = e.target\n\n for (let depth = 0; node && typeof node === 'object' && depth < maxFallbackAncestors; depth++) {\n if (node.__internalInstanceHandle) {\n return node.__internalInstanceHandle\n }\n const key = Object.getOwnPropertyNames(node).find((name) => reactFiberKeyPattern.test(name))\n if (key) {\n return node[key]\n }\n node = node.parentNode\n }\n\n return undefined\n}\n\n// Returns the owner node this event happened under, or undefined if none owns it. Walks the fiber\n// tree, not the DOM: RNW's Modal portals to document.body, so the DOM parent chain leaves the\n// subtree but fiber `.return` does not. Kept separate from the element walk in captureFromEvent,\n// which stops at maxElementsCaptured and would falsely reject a deep target.\nexport const findOwningNode = (e: any, owners: { has(node: unknown): boolean }): unknown => {\n let current: Element | undefined = e._targetInst || getFallbackTargetInstance(e)\n for (let depth = 0; current && depth < maxOwnerAncestors; depth++) {\n if (current.stateNode && owners.has(current.stateNode)) {\n return current.stateNode\n }\n current = current.return\n }\n\n return undefined\n}\n\n// Fail-closed bound on the walk; unrelated to maxElementsCaptured, which caps the emitted payload.\nexport const maxAncestorsTraversed = 1000\n\nconst defaultMaxElementsCaptured = 20\n\n// Autocapture must never break the host app: a throw would escape into RN's touch dispatch on\n// native, or the DOM click handler on web. Matches the browser SDK, which guards its equivalent\n// document-level handler (packages/browser/src/autocapture.ts).\nexport const autocaptureFromTouchEvent = (\n e: any,\n posthog: PostHog,\n options: PostHogAutocaptureOptions = {},\n eventType: 'touch' | 'click' = 'touch'\n): void => {\n try {\n captureFromEvent(e, posthog, options, eventType)\n } catch (error) {\n if (!warnedCaptureFailure) {\n warnedCaptureFailure = true\n console.warn('PostHog autocapture: capturing the interaction threw:', error)\n }\n }\n}\n\nconst captureFromEvent = (\n e: any,\n posthog: PostHog,\n options: PostHogAutocaptureOptions,\n eventType: 'touch' | 'click'\n): void => {\n const {\n noCaptureProp = 'ph-no-capture',\n customLabelProp = defaultPostHogLabelProp,\n maxElementsCaptured: maxElementsCapturedOption = defaultMaxElementsCaptured,\n ignoreLabels = [],\n propsToCapture = ['style', 'testID', 'accessibilityLabel', customLabelProp, 'children'],\n } = options\n\n // The destructure default only covers `undefined`; a NaN would make every comparison against it\n // false, silently uncapping the payload instead of capping it.\n const maxElementsCaptured = Number.isFinite(maxElementsCapturedOption)\n ? maxElementsCapturedOption\n : defaultMaxElementsCaptured\n\n const nativeInst = e._targetInst\n const targetInst: Element | undefined = nativeInst || getFallbackTargetInstance(e)\n if (!targetInst) {\n return\n }\n const elements: PostHogAutocaptureElement[] = []\n const autocaptureProperties: Record<string, JsonType> = {}\n\n let currentInst: Element | undefined = targetInst\n let ancestorsTraversed = 0\n\n while (currentInst) {\n const props = currentInst.memoizedProps\n\n if (ancestorsTraversed++ >= maxAncestorsTraversed) {\n return\n }\n\n if (props?.[noCaptureProp]) {\n // Immediately ignore events if a no capture is in the chain\n return\n }\n\n if (elements.length >= maxElementsCaptured) {\n // keep walking so a no capture ancestor above the cap is still seen\n currentInst = currentInst.return\n continue\n }\n\n const el: PostHogAutocaptureElement = {\n tag_name: '',\n }\n const elAutocaptureProperties: Record<string, JsonType> = {}\n\n if (props) {\n // Capture data-ph-capture-attribute props as event properties.\n // Element props are only captured from propsToCapture.\n Object.keys(props).forEach((key) => {\n const value = props[key]\n\n if (key.indexOf(captureAttributePrefix) === 0) {\n const propertyKey = key.slice(captureAttributePrefix.length)\n if (propertyKey && ['string', 'number', 'boolean'].includes(typeof value) && value !== '') {\n elAutocaptureProperties[propertyKey] = value as JsonType\n }\n }\n\n if (!propsToCapture.includes(key)) {\n return\n }\n\n if (key === 'style') {\n // Safely handle style prop, especially for animated styles\n try {\n el.attr__style = stringifyStyle(value)\n } catch (error) {\n // Skip style capturing if it fails (e.g., animated styles)\n }\n } else if (['string', 'number', 'boolean'].includes(typeof value)) {\n if (key === 'children') {\n el.$el_text = typeof value === 'string' ? value : JSON.stringify(value)\n } else {\n el[`attr__${key}`] = value as JsonType\n }\n }\n })\n }\n\n // Try and find a sensible label\n const hasCustomLabel = typeof props?.[customLabelProp] !== 'undefined'\n const label = hasCustomLabel\n ? `${props?.[customLabelProp]}`\n : currentInst.elementType?.displayName || currentInst.elementType?.name\n\n Object.assign(autocaptureProperties, elAutocaptureProperties)\n\n // RNW wraps the touched host node directly, so its internals only ever head the chain; a match\n // further up is the app's own component. A user-set label is never a framework internal.\n const isFrameworkWrapper =\n !nativeInst && !hasCustomLabel && elements.length === 0 && frameworkInternalLabels.includes(label as string)\n\n if (label && !isFrameworkWrapper && !ignoreLabels.includes(label)) {\n el.tag_name = sanitiseLabel(label)\n elements.push(el)\n }\n\n currentInst = currentInst.return\n }\n\n if (elements.length) {\n // The element that was tapped, may be a child (or grandchild of an element with a customLabelProp (default: ph-label))\n // In this case, the current labels applied obscure the customLabelProp (default: ph-label)\n // To correct this, loop over the elements in reverse, and promote the customLabelProp (default: ph-label)\n const elAttrLabelKey = `attr__${customLabelProp}`\n let lastLabel: string | undefined = undefined\n\n for (let i = elements.length - 1; i >= 0; i--) {\n const element = elements[i]\n if (element[elAttrLabelKey]) {\n // this element had a customLabelProp (default: ph-label) set, promote it to the lastLabel\n lastLabel = element[elAttrLabelKey] as string\n }\n\n // if lastLabel is set, update this elements tag_name\n if (lastLabel) {\n element['tag_name'] = lastLabel\n }\n }\n posthog.autocapture(eventType, elements, {\n ...autocaptureProperties,\n $touch_x: e.nativeEvent?.pageX,\n $touch_y: e.nativeEvent?.pageY,\n })\n }\n}\n"],"mappings":"uyEAeA,GAAM,CAAAA,eAAe,CAAG,QAAlB,CAAAA,eAAeA,CAAIC,KAAU,CAAa,CAI9C,MAAO,CAAAA,KAAK,SAALA,KAAK,iBAALA,KAAK,CAAEC,wBAAwB,IAAK,IAAI,EAAK,GAAAC,QAAA,aAAOF,KAAK,IAAK,QAAQ,EAAIA,KAAK,GAAK,IAAI,EAAI,QAAQ,EAAI,CAAAA,KAAM,CACvH,CAAC,CAED,GAAM,CAAAG,cAAa,CAAG,QAAhB,CAAAA,aAAaA,CAAIC,MAAW,CAAS,CACzC,GAAM,CAAAC,SAAS,CAAQ,EAAE,CAGzB,GAAIN,eAAe,CAACK,MAAM,CAAC,CAAE,CAC3B,MAAO,EAAE,CACX,CAEA,GAAIE,KAAK,CAACC,OAAO,CAACH,MAAM,CAAC,CAAE,KAAAI,SAAA,CAAAC,0BAAA,CACLL,MAAM,EAAAM,KAAA,KAA1B,IAAAF,SAAA,CAAAG,CAAA,KAAAD,KAAA,CAAAF,SAAA,CAAAI,CAAA,IAAAC,IAAA,EAA4B,IAAjB,CAAAC,KAAK,CAAAJ,KAAA,CAAAV,KAAA,CACd,GAAAe,SAAA,aAAcV,SAAS,CAAEF,cAAa,CAACW,KAAK,CAAC,CAAC,CAChD,CAAC,OAAAE,GAAA,EAAAR,SAAA,CAAAS,CAAA,CAAAD,GAAA,WAAAR,SAAA,CAAAU,CAAA,IACH,CAAC,IAAM,IAAId,MAAM,EAAI,GAAAF,QAAA,aAAOE,MAAM,IAAK,QAAQ,CAAE,CAG/C,IAAK,GAAM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C,qBAAqB,MACxBiC,QAAQ,CAAE,CAAAC,EAAA,CAAArG,CAAC,CAACsG,WAAW,UAAAD,EAAA,iBAAAA,EAAA,CAAEE,KAAK,CAC9BC,QAAQ,CAAE,CAAAC,EAAA,CAAAzG,CAAC,CAACsG,WAAW,UAAAG,EAAA,iBAAAA,EAAA,CAAEC,KAAK,EAC/B,CAAC,CACJ,CACF,CAAC","ignoreList":[]}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "4.84.
|
|
1
|
+
export declare const version = "4.84.3";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version=void 0;var version=exports.version="4.84.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version=void 0;var version=exports.version="4.84.3";
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","names":["version","exports"],"sources":["../src/version.ts"],"sourcesContent":["export const version = \"4.84.
|
|
1
|
+
{"version":3,"file":"version.js","names":["version","exports"],"sources":["../src/version.ts"],"sourcesContent":["export const version = \"4.84.3\"\n"],"mappings":"6FAAO,GAAM,CAAAA,OAAO,CAAAC,OAAA,CAAAD,OAAA,CAAG,QAAQ","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "posthog-react-native",
|
|
3
|
-
"version": "4.84.
|
|
3
|
+
"version": "4.84.3",
|
|
4
4
|
"bugs": {
|
|
5
5
|
"url": "https://github.com/PostHog/posthog-js/issues"
|
|
6
6
|
},
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@posthog/core": "^1.61.1",
|
|
38
|
-
"@posthog/types": "^1.
|
|
38
|
+
"@posthog/types": "^1.418.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@babel/cli": "^7.19.3",
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
"typescript": "7.0.2",
|
|
74
74
|
"@vitest/coverage-v8": "^1.6.1",
|
|
75
75
|
"vitest": "^1.6.1",
|
|
76
|
-
"@posthog
|
|
76
|
+
"@posthog/react-native-plugin": "2.12.7",
|
|
77
77
|
"@posthog-tooling/tsconfig-base": "1.1.1",
|
|
78
|
-
"@posthog/
|
|
78
|
+
"@posthog-tooling/rollup-utils": "1.1.1"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
81
|
"@react-native-async-storage/async-storage": ">=1.0.0",
|