posthog-react-native 2.1.0 → 2.1.2
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/lib/index.cjs.js +7 -15
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +0 -2
- package/lib/index.esm.js +7 -15
- package/lib/index.esm.js.map +1 -1
- package/lib/posthog-react-native/src/posthog.d.ts +14 -0
- package/lib/posthog-react-native/src/types.d.ts +0 -2
- package/package.json +5 -4
- package/CHANGELOG.md +0 -5
- package/lib/node_modules/tslib/tslib.es6.d.ts +0 -35
package/lib/index.cjs.js
CHANGED
|
@@ -1438,7 +1438,7 @@ var preloadSemiAsyncStorage = function () {
|
|
|
1438
1438
|
return _preloadSemiAsyncStoragePromise;
|
|
1439
1439
|
};
|
|
1440
1440
|
|
|
1441
|
-
var version = "2.
|
|
1441
|
+
var version = "2.0.0";
|
|
1442
1442
|
|
|
1443
1443
|
var PostHog =
|
|
1444
1444
|
/** @class */
|
|
@@ -1806,20 +1806,14 @@ var autocaptureFromTouchEvent = function (e, posthog, options) {
|
|
|
1806
1806
|
}
|
|
1807
1807
|
};
|
|
1808
1808
|
|
|
1809
|
-
function
|
|
1809
|
+
function PostHogHooks(_a) {
|
|
1810
1810
|
var options = _a.options;
|
|
1811
1811
|
useNavigationTracker(options === null || options === void 0 ? void 0 : options.navigation);
|
|
1812
|
-
return null;
|
|
1813
|
-
}
|
|
1814
|
-
|
|
1815
|
-
function PostHogLifecycleHook() {
|
|
1816
1812
|
useLifecycleTracker();
|
|
1817
1813
|
return null;
|
|
1818
1814
|
}
|
|
1819
1815
|
|
|
1820
1816
|
var PostHogProvider = function (_a) {
|
|
1821
|
-
var _b, _c;
|
|
1822
|
-
|
|
1823
1817
|
var children = _a.children,
|
|
1824
1818
|
client = _a.client,
|
|
1825
1819
|
options = _a.options,
|
|
@@ -1832,13 +1826,10 @@ var PostHogProvider = function (_a) {
|
|
|
1832
1826
|
posthogRef.current = client ? client : apiKey ? new PostHog(apiKey, options) : undefined;
|
|
1833
1827
|
}
|
|
1834
1828
|
|
|
1829
|
+
var autocaptureEnabled = !!autocapture;
|
|
1835
1830
|
var autocaptureOptions = autocapture && typeof autocapture !== 'boolean' ? autocapture : {};
|
|
1836
1831
|
var posthog = posthogRef.current;
|
|
1837
1832
|
var captureTouches = posthog && (autocapture === true || (autocaptureOptions === null || autocaptureOptions === void 0 ? void 0 : autocaptureOptions.captureTouches));
|
|
1838
|
-
var captureScreens = posthog && (autocapture === true || ((_b = autocaptureOptions === null || autocaptureOptions === void 0 ? void 0 : autocaptureOptions.captureScreens) !== null && _b !== void 0 ? _b : true)); // Default to true if not set
|
|
1839
|
-
|
|
1840
|
-
var captureLifecycle = posthog && (autocapture === true || ((_c = autocaptureOptions === null || autocaptureOptions === void 0 ? void 0 : autocaptureOptions.captureLifecycleEvents) !== null && _c !== void 0 ? _c : true)); // Default to true if not set
|
|
1841
|
-
|
|
1842
1833
|
var onTouch = React.useCallback(function (type, e) {
|
|
1843
1834
|
// TODO: Improve this to ensure we only capture presses and not just ends of a drag for example
|
|
1844
1835
|
if (!captureTouches) {
|
|
@@ -1848,7 +1839,8 @@ var PostHogProvider = function (_a) {
|
|
|
1848
1839
|
if (type === 'end') {
|
|
1849
1840
|
autocaptureFromTouchEvent(e, posthog, autocaptureOptions);
|
|
1850
1841
|
}
|
|
1851
|
-
}, [posthog, autocapture]);
|
|
1842
|
+
}, [posthog, autocapture]); // TODO: Improve this to ensure we only capture presses and not just ends of a drag for example
|
|
1843
|
+
|
|
1852
1844
|
return /*#__PURE__*/React__default["default"].createElement(reactNative.View, {
|
|
1853
1845
|
"ph-label": "PostHogProvider",
|
|
1854
1846
|
style: style || {
|
|
@@ -1861,9 +1853,9 @@ var PostHogProvider = function (_a) {
|
|
|
1861
1853
|
value: {
|
|
1862
1854
|
client: posthogRef.current
|
|
1863
1855
|
}
|
|
1864
|
-
},
|
|
1856
|
+
}, autocaptureEnabled ? /*#__PURE__*/React__default["default"].createElement(PostHogHooks, {
|
|
1865
1857
|
options: autocaptureOptions
|
|
1866
|
-
}) : null,
|
|
1858
|
+
}) : null, children));
|
|
1867
1859
|
};
|
|
1868
1860
|
|
|
1869
1861
|
exports.PostHog = PostHog;
|