txlemetry-react-native 4.55.1 → 5.0.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/LICENSE +353 -353
- package/dist/TxlemetryContext.d.ts +5 -0
- package/dist/TxlemetryContext.js +1 -0
- package/dist/TxlemetryErrorBoundary.d.ts +27 -0
- package/dist/TxlemetryErrorBoundary.js +1 -0
- package/dist/{PostHogMaskView.d.ts → TxlemetryMaskView.d.ts} +39 -39
- package/dist/TxlemetryMaskView.js +1 -0
- package/dist/TxlemetryProvider.d.ts +100 -0
- package/dist/TxlemetryProvider.js +1 -0
- package/dist/autocapture.d.ts +4 -4
- package/dist/autocapture.js +1 -1
- package/dist/error-tracking/index.d.ts +98 -98
- package/dist/error-tracking/index.js +1 -1
- package/dist/error-tracking/utils.d.ts +5 -5
- package/dist/frameworks/wix-navigation.d.ts +3 -3
- package/dist/frameworks/wix-navigation.js +1 -1
- package/dist/hooks/useFeatureFlag.d.ts +5 -5
- package/dist/hooks/useFeatureFlag.js +1 -1
- package/dist/hooks/useFeatureFlagResult.d.ts +3 -3
- package/dist/hooks/useFeatureFlagResult.js +1 -1
- package/dist/hooks/useFeatureFlags.d.ts +3 -3
- package/dist/hooks/useFeatureFlags.js +1 -1
- package/dist/hooks/useNavigationTracker.d.ts +6 -6
- package/dist/hooks/useNavigationTracker.js +1 -1
- package/dist/hooks/useTxlemetry.d.ts +2 -0
- package/dist/hooks/useTxlemetry.js +1 -0
- package/dist/hooks/utils.d.ts +14 -14
- package/dist/hooks/utils.js +1 -1
- package/dist/index.d.ts +14 -14
- package/dist/index.js +1 -1
- package/dist/index.txlemetry.d.ts +36 -36
- package/dist/index.txlemetry.js +21 -21
- package/dist/logs-defaults.d.ts +9 -9
- package/dist/native-deps.d.ts +4 -4
- package/dist/native-deps.js +1 -1
- package/dist/optional/OptionalAsyncStorage.d.ts +2 -2
- package/dist/optional/OptionalExpoApplication.d.ts +2 -2
- package/dist/optional/OptionalExpoDevice.d.ts +2 -2
- package/dist/optional/OptionalExpoFileSystem.d.ts +2 -2
- package/dist/optional/OptionalExpoFileSystemLegacy.d.ts +2 -2
- package/dist/optional/OptionalExpoLocalization.d.ts +2 -2
- package/dist/optional/OptionalPlugin.d.ts +20 -20
- package/dist/optional/OptionalReactNativeDeviceInfo.d.ts +2 -2
- package/dist/optional/OptionalReactNativeLocalize.d.ts +13 -13
- package/dist/optional/OptionalReactNativeNavigation.d.ts +2 -2
- package/dist/optional/OptionalReactNativeNavigationWix.d.ts +2 -2
- package/dist/optional/OptionalReactNativeSafeArea.d.ts +2 -2
- package/dist/optional/OptionalReactNativeSvg.d.ts +2 -2
- package/dist/storage.d.ts +41 -41
- package/dist/storage.js +1 -1
- package/dist/surveys/{PostHogSurveyProvider.d.ts → TxlemetrySurveyProvider.d.ts} +23 -23
- package/dist/surveys/TxlemetrySurveyProvider.js +1 -0
- package/dist/surveys/components/BottomSection.d.ts +9 -9
- package/dist/surveys/components/BottomSection.js +1 -1
- package/dist/surveys/components/Cancel.d.ts +5 -5
- package/dist/surveys/components/Cancel.js +1 -1
- package/dist/surveys/components/ConfirmationMessage.d.ts +12 -12
- package/dist/surveys/components/ConfirmationMessage.js +1 -1
- package/dist/surveys/components/QuestionHeader.d.ts +8 -8
- package/dist/surveys/components/QuestionHeader.js +1 -1
- package/dist/surveys/components/QuestionTypes.d.ts +26 -26
- package/dist/surveys/components/QuestionTypes.js +1 -1
- package/dist/surveys/components/SurveyModal.d.ts +11 -11
- package/dist/surveys/components/SurveyModal.js +1 -1
- package/dist/surveys/components/Surveys.d.ts +16 -16
- package/dist/surveys/components/Surveys.js +1 -1
- package/dist/surveys/getActiveMatchingSurveys.d.ts +2 -2
- package/dist/surveys/icons.d.ts +11 -11
- package/dist/surveys/icons.js +1 -1
- package/dist/surveys/index.d.ts +6 -6
- package/dist/surveys/index.js +1 -1
- package/dist/surveys/safeStyleSheet.d.ts +8 -8
- package/dist/surveys/survey-translations.d.ts +7 -7
- package/dist/surveys/survey-translations.js +1 -1
- package/dist/surveys/surveys-utils.d.ts +54 -54
- package/dist/surveys/surveys-utils.js +1 -1
- package/dist/surveys/useActivatedSurveys.d.ts +3 -3
- package/dist/surveys/useActivatedSurveys.js +1 -1
- package/dist/surveys/useSurveyStorage.d.ts +8 -8
- package/dist/surveys/useSurveyStorage.js +1 -1
- package/dist/tooling/expoconfig.d.ts +64 -64
- package/dist/tooling/expoconfig.js +1 -1
- package/dist/tooling/metroconfig.d.ts +21 -21
- package/dist/tooling/metroconfig.js +1 -1
- package/dist/tooling/{posthogMetroSerializer.d.ts → txlemetryMetroSerializer.d.ts} +17 -17
- package/dist/tooling/txlemetryMetroSerializer.js +1 -0
- package/dist/tooling/utils.d.ts +58 -58
- package/dist/tooling/vendor/expo/expoconfig.d.ts +23 -23
- package/dist/tooling/vendor/metro/countLines.d.ts +2 -2
- package/dist/tooling/vendor/metro/utils.d.ts +22 -22
- package/dist/{posthog-rn.d.ts → txlemetry-rn.d.ts} +1096 -1096
- package/dist/txlemetry-rn.js +1 -0
- package/dist/types.d.ts +205 -205
- package/dist/utils.d.ts +25 -25
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +149 -149
- package/tooling/txlemetry-xcode.sh +2 -2
- package/dist/PostHogContext.d.ts +0 -5
- package/dist/PostHogContext.js +0 -1
- package/dist/PostHogErrorBoundary.d.ts +0 -27
- package/dist/PostHogErrorBoundary.js +0 -1
- package/dist/PostHogMaskView.js +0 -1
- package/dist/PostHogProvider.d.ts +0 -100
- package/dist/PostHogProvider.js +0 -1
- package/dist/hooks/usePostHog.d.ts +0 -2
- package/dist/hooks/usePostHog.js +0 -1
- package/dist/posthog-rn.js +0 -1
- package/dist/surveys/PostHogSurveyProvider.js +0 -1
- package/dist/tooling/posthogMetroSerializer.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useFeatureFlags=useFeatureFlags;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var _utils=require("./utils");function useFeatureFlags(client){var
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useFeatureFlags=useFeatureFlags;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var _utils=require("./utils");function useFeatureFlags(client){var txlemetry=(0,_utils.useOverridableTxlemetry)(client,'useFeatureFlags');var _useState=(0,_react.useState)(txlemetry===null||txlemetry===void 0?void 0:txlemetry.getFeatureFlags()),_useState2=(0,_slicedToArray2["default"])(_useState,2),featureFlags=_useState2[0],setFeatureFlags=_useState2[1];(0,_react.useEffect)(function(){setFeatureFlags(txlemetry===null||txlemetry===void 0?void 0:txlemetry.getFeatureFlags());return txlemetry===null||txlemetry===void 0?void 0:txlemetry.onFeatureFlags(function(flags){setFeatureFlags(flags);});},[txlemetry]);return featureFlags;}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
declare function _useNavigationTracker(options?:
|
|
5
|
-
export declare const useNavigationTracker: typeof _useNavigationTracker;
|
|
6
|
-
export {};
|
|
1
|
+
import type { Txlemetry } from '../txlemetry-rn';
|
|
2
|
+
import { TxlemetryAutocaptureNavigationTrackerOptions } from '../types';
|
|
3
|
+
import { TxlemetryNavigationRef } from '../types';
|
|
4
|
+
declare function _useNavigationTracker(options?: TxlemetryAutocaptureNavigationTrackerOptions, navigationRef?: TxlemetryNavigationRef, client?: Txlemetry): void;
|
|
5
|
+
export declare const useNavigationTracker: typeof _useNavigationTracker;
|
|
6
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.useNavigationTracker=void 0;var _react=require("react");var _OptionalReactNativeNavigation=require("../optional/OptionalReactNativeNavigation");var _utils=require("./utils");function _useNavigationTrackerDisabled(){return;}function _useNavigationTracker(options,navigationRef,client){var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.useNavigationTracker=void 0;var _react=require("react");var _OptionalReactNativeNavigation=require("../optional/OptionalReactNativeNavigation");var _utils=require("./utils");function _useNavigationTrackerDisabled(){return;}function _useNavigationTracker(options,navigationRef,client){var txlemetry=(0,_utils.useOverridableTxlemetry)(client,'useNavigationTracker');if(!_OptionalReactNativeNavigation.OptionalReactNativeNavigation){throw new Error('No OptionalReactNativeNavigation');}var routes=undefined;var navigation=navigationRef;try{routes=_OptionalReactNativeNavigation.OptionalReactNativeNavigation.useNavigationState(function(state){return state===null||state===void 0?void 0:state.routes;});}catch(error){console.error('useNavigationState error',error);}try{if(!navigation){navigation=_OptionalReactNativeNavigation.OptionalReactNativeNavigation.useNavigation();}}catch(error){console.error('useNavigation error',error);return;}var trackRoute=(0,_react.useCallback)(function(){var _a,_b,_c;if(!navigation||!txlemetry){return;}var currentNavigation=navigation;if(navigation.current){currentNavigation=navigation.current;}var currentRoute=undefined;try{var isReady=false;try{isReady=currentNavigation.isReady();}catch(error){isReady=true;}if(!isReady){return;}currentRoute=currentNavigation.getCurrentRoute();}catch(error){return;}if(!currentRoute){return;}var _currentRoute=currentRoute,state=_currentRoute.state;var _currentRoute2=currentRoute,name=_currentRoute2.name,params=_currentRoute2.params;if((_a=state===null||state===void 0?void 0:state.routes)===null||_a===void 0?void 0:_a.length){var route=state.routes[state.routes.length-1];name=route.name;params=route.params;}var currentRouteName=((_b=options===null||options===void 0?void 0:options.routeToName)===null||_b===void 0?void 0:_b.call(options,name,params))||name||'Unknown';if(currentRouteName){var properties=(_c=options===null||options===void 0?void 0:options.routeToProperties)===null||_c===void 0?void 0:_c.call(options,currentRouteName,params);txlemetry.screen(currentRouteName,properties);}},[navigation,options,txlemetry]);(0,_react.useEffect)(function(){if(!routes){setTimeout(trackRoute,1);return;}trackRoute();},[routes,trackRoute]);}var useNavigationTracker=exports.useNavigationTracker=_OptionalReactNativeNavigation.OptionalReactNativeNavigation?_useNavigationTracker:_useNavigationTrackerDisabled;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useTxlemetry=void 0;var _react=_interopRequireDefault(require("react"));var _TxlemetryContext=require("../TxlemetryContext");var _utils=require("./utils");var useTxlemetry=exports.useTxlemetry=function useTxlemetry(){var _React$useContext=_react["default"].useContext(_TxlemetryContext.TxlemetryContext),client=_React$useContext.client;(0,_utils.warnIfNoClient)(client,'useTxlemetry');return client;};
|
package/dist/hooks/utils.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
/**
|
|
3
|
-
* Log an error if the
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export declare function warnIfNoClient(client:
|
|
7
|
-
/** @internal Exported for testing only. */
|
|
8
|
-
export declare function resetWarnedCallers(): void;
|
|
9
|
-
/**
|
|
10
|
-
* Returns the first available
|
|
11
|
-
* client is found. This is used internally by hooks that accept an optional client parameter.
|
|
12
|
-
* @internal
|
|
13
|
-
*/
|
|
14
|
-
export declare const
|
|
1
|
+
import type { Txlemetry } from '../txlemetry-rn';
|
|
2
|
+
/**
|
|
3
|
+
* Log an error if the Txlemetry client is not available. Warns once per unique caller to avoid console spam.
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare function warnIfNoClient(client: Txlemetry | undefined, caller: string): void;
|
|
7
|
+
/** @internal Exported for testing only. */
|
|
8
|
+
export declare function resetWarnedCallers(): void;
|
|
9
|
+
/**
|
|
10
|
+
* Returns the first available Txlemetry client from arguments or context, correctly typed. Logs an error if no
|
|
11
|
+
* client is found. This is used internally by hooks that accept an optional client parameter.
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare const useOverridableTxlemetry: (client: Txlemetry | undefined, caller: string) => Txlemetry | undefined;
|
package/dist/hooks/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.resetWarnedCallers=resetWarnedCallers;exports.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.resetWarnedCallers=resetWarnedCallers;exports.useOverridableTxlemetry=void 0;exports.warnIfNoClient=warnIfNoClient;var _react=require("react");var _TxlemetryContext=require("../TxlemetryContext");var warnedCallers=new Set();function warnIfNoClient(client,caller){if(!client&&!warnedCallers.has(caller)){warnedCallers.add(caller);console.error("".concat(caller," was called without a Txlemetry client. Wrap your app with <TxlemetryProvider> or pass a client directly. See https://txlemetry.com/docs/libraries/react-native?#with-the-txlemetryprovider"));}}function resetWarnedCallers(){warnedCallers.clear();}var useOverridableTxlemetry=exports.useOverridableTxlemetry=function useOverridableTxlemetry(client,caller){var _useContext=(0,_react.useContext)(_TxlemetryContext.TxlemetryContext),contextClient=_useContext.client;var txlemetry=client!==null&&client!==void 0?client:contextClient;warnIfNoClient(txlemetry,caller);return txlemetry;};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './hooks/useNavigationTracker';
|
|
5
|
-
export * from './hooks/useFeatureFlags';
|
|
6
|
-
export * from './hooks/useFeatureFlag';
|
|
7
|
-
export * from './hooks/useFeatureFlagResult';
|
|
8
|
-
export * from './hooks/
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
11
|
-
export * from './
|
|
12
|
-
export * from './types';
|
|
13
|
-
export * from './surveys';
|
|
14
|
-
export type { BeforeSendLogFn, CaptureLogOptions, CaptureLogger, LogAttributes, LogAttributeValue, LogSeverityLevel,
|
|
1
|
+
import { Txlemetry } from './txlemetry-rn';
|
|
2
|
+
export default Txlemetry;
|
|
3
|
+
export * from './txlemetry-rn';
|
|
4
|
+
export * from './hooks/useNavigationTracker';
|
|
5
|
+
export * from './hooks/useFeatureFlags';
|
|
6
|
+
export * from './hooks/useFeatureFlag';
|
|
7
|
+
export * from './hooks/useFeatureFlagResult';
|
|
8
|
+
export * from './hooks/useTxlemetry';
|
|
9
|
+
export * from './TxlemetryMaskView';
|
|
10
|
+
export * from './TxlemetryProvider';
|
|
11
|
+
export * from './TxlemetryErrorBoundary';
|
|
12
|
+
export * from './types';
|
|
13
|
+
export * from './surveys';
|
|
14
|
+
export type { BeforeSendLogFn, CaptureLogOptions, CaptureLogger, LogAttributes, LogAttributeValue, LogSeverityLevel, TxlemetryLogsConfig, } from '@txlemetry/core';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _exportNames={};exports["default"]=void 0;var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _exportNames={};exports["default"]=void 0;var _txlemetryRn=require("./txlemetry-rn");Object.keys(_txlemetryRn).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_txlemetryRn[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _txlemetryRn[key];}});});var _useNavigationTracker=require("./hooks/useNavigationTracker");Object.keys(_useNavigationTracker).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_useNavigationTracker[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _useNavigationTracker[key];}});});var _useFeatureFlags=require("./hooks/useFeatureFlags");Object.keys(_useFeatureFlags).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_useFeatureFlags[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _useFeatureFlags[key];}});});var _useFeatureFlag=require("./hooks/useFeatureFlag");Object.keys(_useFeatureFlag).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_useFeatureFlag[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _useFeatureFlag[key];}});});var _useFeatureFlagResult=require("./hooks/useFeatureFlagResult");Object.keys(_useFeatureFlagResult).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_useFeatureFlagResult[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _useFeatureFlagResult[key];}});});var _useTxlemetry=require("./hooks/useTxlemetry");Object.keys(_useTxlemetry).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_useTxlemetry[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _useTxlemetry[key];}});});var _TxlemetryMaskView=require("./TxlemetryMaskView");Object.keys(_TxlemetryMaskView).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_TxlemetryMaskView[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _TxlemetryMaskView[key];}});});var _TxlemetryProvider=require("./TxlemetryProvider");Object.keys(_TxlemetryProvider).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_TxlemetryProvider[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _TxlemetryProvider[key];}});});var _TxlemetryErrorBoundary=require("./TxlemetryErrorBoundary");Object.keys(_TxlemetryErrorBoundary).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_TxlemetryErrorBoundary[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _TxlemetryErrorBoundary[key];}});});var _types=require("./types");Object.keys(_types).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_types[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _types[key];}});});var _surveys=require("./surveys");Object.keys(_surveys).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_surveys[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _surveys[key];}});});var _default=exports["default"]=_txlemetryRn.Txlemetry;
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export default Txlemetry
|
|
4
|
-
export {
|
|
5
|
-
export { useNavigationTracker } from './hooks/useNavigationTracker'
|
|
6
|
-
export { useFeatureFlags } from './hooks/useFeatureFlags'
|
|
7
|
-
export { useFeatureFlag, useFeatureFlagWithPayload } from './hooks/useFeatureFlag'
|
|
8
|
-
export { useFeatureFlagResult } from './hooks/useFeatureFlagResult'
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export type { FeatureFlagWithPayload } from './hooks/useFeatureFlag'
|
|
15
|
-
export type {
|
|
16
|
-
export type {
|
|
17
|
-
export type {
|
|
18
|
-
export type {
|
|
19
|
-
export type {
|
|
20
|
-
export type {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} from './types'
|
|
28
|
-
export type {
|
|
29
|
-
BeforeSendLogFn,
|
|
30
|
-
CaptureLogOptions,
|
|
31
|
-
CaptureLogger,
|
|
32
|
-
LogAttributes,
|
|
33
|
-
LogAttributeValue,
|
|
34
|
-
LogSeverityLevel,
|
|
35
|
-
|
|
36
|
-
} from '@txlemetry/core'
|
|
1
|
+
import { Txlemetry } from './txlemetry-rn'
|
|
2
|
+
|
|
3
|
+
export default Txlemetry
|
|
4
|
+
export { Txlemetry, TxlemetryPersistedProperty } from './txlemetry-rn'
|
|
5
|
+
export { useNavigationTracker } from './hooks/useNavigationTracker'
|
|
6
|
+
export { useFeatureFlags } from './hooks/useFeatureFlags'
|
|
7
|
+
export { useFeatureFlag, useFeatureFlagWithPayload } from './hooks/useFeatureFlag'
|
|
8
|
+
export { useFeatureFlagResult } from './hooks/useFeatureFlagResult'
|
|
9
|
+
export { useTxlemetry } from './hooks/useTxlemetry'
|
|
10
|
+
export { TxlemetryMaskView } from './TxlemetryMaskView'
|
|
11
|
+
export { TxlemetryProvider } from './TxlemetryProvider'
|
|
12
|
+
export { TxlemetryErrorBoundary } from './TxlemetryErrorBoundary'
|
|
13
|
+
export { TxlemetrySurveyProvider, Questions, SurveyModal } from './surveys'
|
|
14
|
+
export type { FeatureFlagWithPayload } from './hooks/useFeatureFlag'
|
|
15
|
+
export type { TxlemetryOptions } from './txlemetry-rn'
|
|
16
|
+
export type { TxlemetryProviderProps } from './TxlemetryProvider'
|
|
17
|
+
export type { TxlemetryErrorBoundaryFallbackProps, TxlemetryErrorBoundaryProps } from './TxlemetryErrorBoundary'
|
|
18
|
+
export type { TxlemetryMaskViewProps } from './TxlemetryMaskView'
|
|
19
|
+
export type { TxlemetrySurveyProviderProps, SurveyModalProps } from './surveys'
|
|
20
|
+
export type {
|
|
21
|
+
TxlemetryAutocaptureNavigationTrackerOptions,
|
|
22
|
+
TxlemetryAutocaptureOptions,
|
|
23
|
+
TxlemetryCustomAppProperties,
|
|
24
|
+
TxlemetryCustomStorage,
|
|
25
|
+
TxlemetryNavigationRef,
|
|
26
|
+
TxlemetrySessionReplayConfig,
|
|
27
|
+
} from './types'
|
|
28
|
+
export type {
|
|
29
|
+
BeforeSendLogFn,
|
|
30
|
+
CaptureLogOptions,
|
|
31
|
+
CaptureLogger,
|
|
32
|
+
LogAttributes,
|
|
33
|
+
LogAttributeValue,
|
|
34
|
+
LogSeverityLevel,
|
|
35
|
+
TxlemetryLogsConfig,
|
|
36
|
+
} from '@txlemetry/core'
|
package/dist/index.txlemetry.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const sdk = require('./index')
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
default: sdk.
|
|
7
|
-
Txlemetry: sdk.
|
|
8
|
-
TxlemetryErrorBoundary: sdk.
|
|
9
|
-
TxlemetryMaskView: sdk.
|
|
10
|
-
TxlemetryPersistedProperty: sdk.
|
|
11
|
-
TxlemetryProvider: sdk.
|
|
12
|
-
TxlemetrySurveyProvider: sdk.
|
|
13
|
-
Questions: sdk.Questions,
|
|
14
|
-
SurveyModal: sdk.SurveyModal,
|
|
15
|
-
useFeatureFlag: sdk.useFeatureFlag,
|
|
16
|
-
useFeatureFlagResult: sdk.useFeatureFlagResult,
|
|
17
|
-
useFeatureFlagWithPayload: sdk.useFeatureFlagWithPayload,
|
|
18
|
-
useFeatureFlags: sdk.useFeatureFlags,
|
|
19
|
-
useNavigationTracker: sdk.useNavigationTracker,
|
|
20
|
-
useTxlemetry: sdk.
|
|
21
|
-
}
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const sdk = require('./index')
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
default: sdk.Txlemetry,
|
|
7
|
+
Txlemetry: sdk.Txlemetry,
|
|
8
|
+
TxlemetryErrorBoundary: sdk.TxlemetryErrorBoundary,
|
|
9
|
+
TxlemetryMaskView: sdk.TxlemetryMaskView,
|
|
10
|
+
TxlemetryPersistedProperty: sdk.TxlemetryPersistedProperty,
|
|
11
|
+
TxlemetryProvider: sdk.TxlemetryProvider,
|
|
12
|
+
TxlemetrySurveyProvider: sdk.TxlemetrySurveyProvider,
|
|
13
|
+
Questions: sdk.Questions,
|
|
14
|
+
SurveyModal: sdk.SurveyModal,
|
|
15
|
+
useFeatureFlag: sdk.useFeatureFlag,
|
|
16
|
+
useFeatureFlagResult: sdk.useFeatureFlagResult,
|
|
17
|
+
useFeatureFlagWithPayload: sdk.useFeatureFlagWithPayload,
|
|
18
|
+
useFeatureFlags: sdk.useFeatureFlags,
|
|
19
|
+
useNavigationTracker: sdk.useNavigationTracker,
|
|
20
|
+
useTxlemetry: sdk.useTxlemetry,
|
|
21
|
+
}
|
package/dist/logs-defaults.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const DEFAULT_FLUSH_INTERVAL_MS = 10000;
|
|
3
|
-
export declare const DEFAULT_RATE_CAP_WINDOW_MS = 10000;
|
|
4
|
-
export declare const DEFAULT_MAX_BUFFER_SIZE = 100;
|
|
5
|
-
export declare const DEFAULT_MAX_LOGS_PER_INTERVAL = 500;
|
|
6
|
-
export declare const DEFAULT_MAX_BATCH_RECORDS_PER_POST = 50;
|
|
7
|
-
export declare const DEFAULT_BACKGROUND_FLUSH_BUDGET_MS = 25000;
|
|
8
|
-
export declare const DEFAULT_TERMINATION_FLUSH_BUDGET_MS = 2000;
|
|
9
|
-
export declare function resolveLogsConfig(config:
|
|
1
|
+
import type { TxlemetryLogsConfig, ResolvedTxlemetryLogsConfig } from '@txlemetry/core';
|
|
2
|
+
export declare const DEFAULT_FLUSH_INTERVAL_MS = 10000;
|
|
3
|
+
export declare const DEFAULT_RATE_CAP_WINDOW_MS = 10000;
|
|
4
|
+
export declare const DEFAULT_MAX_BUFFER_SIZE = 100;
|
|
5
|
+
export declare const DEFAULT_MAX_LOGS_PER_INTERVAL = 500;
|
|
6
|
+
export declare const DEFAULT_MAX_BATCH_RECORDS_PER_POST = 50;
|
|
7
|
+
export declare const DEFAULT_BACKGROUND_FLUSH_BUDGET_MS = 25000;
|
|
8
|
+
export declare const DEFAULT_TERMINATION_FLUSH_BUDGET_MS = 2000;
|
|
9
|
+
export declare function resolveLogsConfig(config: TxlemetryLogsConfig | undefined): ResolvedTxlemetryLogsConfig;
|
package/dist/native-deps.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const currentDeviceType: string;
|
|
3
|
-
export declare const getAppProperties: () =>
|
|
4
|
-
export declare const buildOptimisticAsyncStorage: () =>
|
|
1
|
+
import { TxlemetryCustomAppProperties, TxlemetryCustomStorage } from './types';
|
|
2
|
+
export declare const currentDeviceType: string;
|
|
3
|
+
export declare const getAppProperties: () => TxlemetryCustomAppProperties;
|
|
4
|
+
export declare const buildOptimisticAsyncStorage: () => TxlemetryCustomStorage | undefined;
|
package/dist/native-deps.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.getAppProperties=exports.currentDeviceType=exports.buildOptimisticAsyncStorage=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _OptionalAsyncStorage=require("./optional/OptionalAsyncStorage");var _utils=require("./utils");var _OptionalExpoApplication=require("./optional/OptionalExpoApplication");var _OptionalExpoDevice=require("./optional/OptionalExpoDevice");var _OptionalExpoFileSystem=require("./optional/OptionalExpoFileSystem");var _OptionalExpoLocalization=require("./optional/OptionalExpoLocalization");var _OptionalReactNativeDeviceInfo=require("./optional/OptionalReactNativeDeviceInfo");var _OptionalReactNativeLocalize=require("./optional/OptionalReactNativeLocalize");var _OptionalExpoFileSystemLegacy=require("./optional/OptionalExpoFileSystemLegacy");var _core=require("@txlemetry/core");var getDeviceType=function getDeviceType(){var _a,_b,_c;var deviceType='Mobile';if((0,_utils.isMacOS)()||(0,_utils.isWindows)()){deviceType='Desktop';}else if((0,_utils.isWeb)()){var ua=typeof navigator!=='undefined'&&navigator.userAgent?navigator.userAgent:'';var nav=typeof navigator!=='undefined'?navigator:undefined;var win=typeof globalThis.window!=='undefined'?globalThis.window:undefined;deviceType=(0,_core.detectDeviceType)(ua,{userAgentDataPlatform:(_a=nav===null||nav===void 0?void 0:nav.userAgentData)===null||_a===void 0?void 0:_a.platform,maxTouchPoints:nav===null||nav===void 0?void 0:nav.maxTouchPoints,screenWidth:(_b=win===null||win===void 0?void 0:win.screen)===null||_b===void 0?void 0:_b.width,screenHeight:(_c=win===null||win===void 0?void 0:win.screen)===null||_c===void 0?void 0:_c.height,devicePixelRatio:win===null||win===void 0?void 0:win.devicePixelRatio});}return deviceType;};var currentDeviceType=exports.currentDeviceType=getDeviceType();var getAppProperties=exports.getAppProperties=function getAppProperties(){var _a,_b;var properties={$device_type:currentDeviceType};if(_OptionalExpoApplication.OptionalExpoApplication){properties.$app_build=_OptionalExpoApplication.OptionalExpoApplication.nativeBuildVersion;properties.$app_name=_OptionalExpoApplication.OptionalExpoApplication.applicationName;properties.$app_namespace=_OptionalExpoApplication.OptionalExpoApplication.applicationId;properties.$app_version=_OptionalExpoApplication.OptionalExpoApplication.nativeApplicationVersion;}else if(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo){properties.$app_build=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getBuildNumber());properties.$app_name=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getApplicationName());properties.$app_namespace=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getBundleId());properties.$app_version=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getVersion());}if(_OptionalExpoDevice.OptionalExpoDevice){properties.$device_manufacturer=_OptionalExpoDevice.OptionalExpoDevice.manufacturer;properties.$device_name=_OptionalExpoDevice.OptionalExpoDevice.modelName;if((0,_utils.getPlatformOS)()==='android'){properties.$os_name='Android';}else{properties.$os_name=_OptionalExpoDevice.OptionalExpoDevice.osName;}properties.$os_version=_OptionalExpoDevice.OptionalExpoDevice.osVersion;properties.$is_emulator=!_OptionalExpoDevice.OptionalExpoDevice.isDevice;}else if(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo){properties.$device_manufacturer=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getManufacturerSync());properties.$device_name=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getModel());properties.$os_name=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getSystemName());properties.$os_version=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getSystemVersion());properties.$is_emulator=_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.isEmulatorSync();}if(_OptionalExpoLocalization.OptionalExpoLocalization){var optionalExpoLocalization=_OptionalExpoLocalization.OptionalExpoLocalization;var locale=optionalExpoLocalization.locale;if(!locale&&optionalExpoLocalization.getLocales){locale=(_a=optionalExpoLocalization.getLocales()[0])===null||_a===void 0?void 0:_a.languageTag;}if(locale){properties.$locale=locale;}var timezone=optionalExpoLocalization.timezone;if(!timezone&&optionalExpoLocalization.getCalendars){timezone=(_b=optionalExpoLocalization.getCalendars()[0])===null||_b===void 0?void 0:_b.timeZone;}if(timezone){properties.$timezone=timezone;}}else if(_OptionalReactNativeLocalize.OptionalReactNativeLocalize){var localesFn=_OptionalReactNativeLocalize.OptionalReactNativeLocalize.getLocales;if(localesFn){var locales=localesFn();if(locales&&locales.length>0){var languageTag=locales[0].languageTag;if(languageTag){properties.$locale=languageTag;}}}var timezoneFn=_OptionalReactNativeLocalize.OptionalReactNativeLocalize.getTimeZone;if(timezoneFn){var _timezone=timezoneFn();if(_timezone){properties.$timezone=_timezone;}}}return properties;};var returnPropertyIfNotUnknown=function returnPropertyIfNotUnknown(value){if(value!=='unknown'){return value;}return null;};var buildLegacyStorage=function buildLegacyStorage(filesystem){return{getItem:function getItem(key){return(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(){var uri,stringContent,_t;return _regenerator["default"].wrap(function(_context){while(1)switch(_context.prev=_context.next){case 0:_context.prev=0;uri=(filesystem.documentDirectory||'')+key;_context.next=1;return filesystem.readAsStringAsync(uri);case 1:stringContent=_context.sent;return _context.abrupt("return",stringContent);case 2:_context.prev=2;_t=_context["catch"](0);return _context.abrupt("return",null);case 3:case"end":return _context.stop();}},_callee,null,[[0,2]]);}))();},setItem:function setItem(key,value){return(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(){var uri;return _regenerator["default"].wrap(function(_context2){while(1)switch(_context2.prev=_context2.next){case 0:uri=(filesystem.documentDirectory||'')+key;_context2.next=1;return filesystem.writeAsStringAsync(uri,value);case 1:case"end":return _context2.stop();}},_callee2);}))();}};};var buildOptimisticAsyncStorage=exports.buildOptimisticAsyncStorage=function buildOptimisticAsyncStorage(){if((0,_utils.isWeb)()&&typeof(_utils.GLOBAL_OBJ===null||_utils.GLOBAL_OBJ===void 0?void 0:_utils.GLOBAL_OBJ.window)==='undefined'){return undefined;}var supportedPlatform=!(0,_utils.isWeb)()&&!(0,_utils.isMacOS)();if(supportedPlatform){if(_OptionalExpoFileSystem.OptionalExpoFileSystem){var filesystem=_OptionalExpoFileSystem.OptionalExpoFileSystem;if(filesystem.Paths&&filesystem.File){return{getItem:function getItem(key){return(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee3(){var file,stringContent,_t2;return _regenerator["default"].wrap(function(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.prev=0;file=new filesystem.File(filesystem.Paths.document,key);_context3.next=1;return file.text();case 1:stringContent=_context3.sent;return _context3.abrupt("return",stringContent);case 2:_context3.prev=2;_t2=_context3["catch"](0);return _context3.abrupt("return",null);case 3:case"end":return _context3.stop();}},_callee3,null,[[0,2]]);}))();},setItem:function setItem(key,value){return(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee4(){var file;return _regenerator["default"].wrap(function(_context4){while(1)switch(_context4.prev=_context4.next){case 0:file=new filesystem.File(filesystem.Paths.document,key);_context4.next=1;return file.write(value);case 1:case"end":return _context4.stop();}},_callee4);}))();}};}}var legacyModule=_OptionalExpoFileSystemLegacy.OptionalExpoFileSystemLegacy||_OptionalExpoFileSystem.OptionalExpoFileSystem;try{if(legacyModule&&typeof legacyModule.readAsStringAsync==='function'){return buildLegacyStorage(legacyModule);}}catch(e){}}if(_OptionalAsyncStorage.OptionalAsyncStorage){return _OptionalAsyncStorage.OptionalAsyncStorage;}throw new Error('
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.getAppProperties=exports.currentDeviceType=exports.buildOptimisticAsyncStorage=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _OptionalAsyncStorage=require("./optional/OptionalAsyncStorage");var _utils=require("./utils");var _OptionalExpoApplication=require("./optional/OptionalExpoApplication");var _OptionalExpoDevice=require("./optional/OptionalExpoDevice");var _OptionalExpoFileSystem=require("./optional/OptionalExpoFileSystem");var _OptionalExpoLocalization=require("./optional/OptionalExpoLocalization");var _OptionalReactNativeDeviceInfo=require("./optional/OptionalReactNativeDeviceInfo");var _OptionalReactNativeLocalize=require("./optional/OptionalReactNativeLocalize");var _OptionalExpoFileSystemLegacy=require("./optional/OptionalExpoFileSystemLegacy");var _core=require("@txlemetry/core");var getDeviceType=function getDeviceType(){var _a,_b,_c;var deviceType='Mobile';if((0,_utils.isMacOS)()||(0,_utils.isWindows)()){deviceType='Desktop';}else if((0,_utils.isWeb)()){var ua=typeof navigator!=='undefined'&&navigator.userAgent?navigator.userAgent:'';var nav=typeof navigator!=='undefined'?navigator:undefined;var win=typeof globalThis.window!=='undefined'?globalThis.window:undefined;deviceType=(0,_core.detectDeviceType)(ua,{userAgentDataPlatform:(_a=nav===null||nav===void 0?void 0:nav.userAgentData)===null||_a===void 0?void 0:_a.platform,maxTouchPoints:nav===null||nav===void 0?void 0:nav.maxTouchPoints,screenWidth:(_b=win===null||win===void 0?void 0:win.screen)===null||_b===void 0?void 0:_b.width,screenHeight:(_c=win===null||win===void 0?void 0:win.screen)===null||_c===void 0?void 0:_c.height,devicePixelRatio:win===null||win===void 0?void 0:win.devicePixelRatio});}return deviceType;};var currentDeviceType=exports.currentDeviceType=getDeviceType();var getAppProperties=exports.getAppProperties=function getAppProperties(){var _a,_b;var properties={$device_type:currentDeviceType};if(_OptionalExpoApplication.OptionalExpoApplication){properties.$app_build=_OptionalExpoApplication.OptionalExpoApplication.nativeBuildVersion;properties.$app_name=_OptionalExpoApplication.OptionalExpoApplication.applicationName;properties.$app_namespace=_OptionalExpoApplication.OptionalExpoApplication.applicationId;properties.$app_version=_OptionalExpoApplication.OptionalExpoApplication.nativeApplicationVersion;}else if(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo){properties.$app_build=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getBuildNumber());properties.$app_name=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getApplicationName());properties.$app_namespace=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getBundleId());properties.$app_version=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getVersion());}if(_OptionalExpoDevice.OptionalExpoDevice){properties.$device_manufacturer=_OptionalExpoDevice.OptionalExpoDevice.manufacturer;properties.$device_name=_OptionalExpoDevice.OptionalExpoDevice.modelName;if((0,_utils.getPlatformOS)()==='android'){properties.$os_name='Android';}else{properties.$os_name=_OptionalExpoDevice.OptionalExpoDevice.osName;}properties.$os_version=_OptionalExpoDevice.OptionalExpoDevice.osVersion;properties.$is_emulator=!_OptionalExpoDevice.OptionalExpoDevice.isDevice;}else if(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo){properties.$device_manufacturer=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getManufacturerSync());properties.$device_name=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getModel());properties.$os_name=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getSystemName());properties.$os_version=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getSystemVersion());properties.$is_emulator=_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.isEmulatorSync();}if(_OptionalExpoLocalization.OptionalExpoLocalization){var optionalExpoLocalization=_OptionalExpoLocalization.OptionalExpoLocalization;var locale=optionalExpoLocalization.locale;if(!locale&&optionalExpoLocalization.getLocales){locale=(_a=optionalExpoLocalization.getLocales()[0])===null||_a===void 0?void 0:_a.languageTag;}if(locale){properties.$locale=locale;}var timezone=optionalExpoLocalization.timezone;if(!timezone&&optionalExpoLocalization.getCalendars){timezone=(_b=optionalExpoLocalization.getCalendars()[0])===null||_b===void 0?void 0:_b.timeZone;}if(timezone){properties.$timezone=timezone;}}else if(_OptionalReactNativeLocalize.OptionalReactNativeLocalize){var localesFn=_OptionalReactNativeLocalize.OptionalReactNativeLocalize.getLocales;if(localesFn){var locales=localesFn();if(locales&&locales.length>0){var languageTag=locales[0].languageTag;if(languageTag){properties.$locale=languageTag;}}}var timezoneFn=_OptionalReactNativeLocalize.OptionalReactNativeLocalize.getTimeZone;if(timezoneFn){var _timezone=timezoneFn();if(_timezone){properties.$timezone=_timezone;}}}return properties;};var returnPropertyIfNotUnknown=function returnPropertyIfNotUnknown(value){if(value!=='unknown'){return value;}return null;};var buildLegacyStorage=function buildLegacyStorage(filesystem){return{getItem:function getItem(key){return(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(){var uri,stringContent,_t;return _regenerator["default"].wrap(function(_context){while(1)switch(_context.prev=_context.next){case 0:_context.prev=0;uri=(filesystem.documentDirectory||'')+key;_context.next=1;return filesystem.readAsStringAsync(uri);case 1:stringContent=_context.sent;return _context.abrupt("return",stringContent);case 2:_context.prev=2;_t=_context["catch"](0);return _context.abrupt("return",null);case 3:case"end":return _context.stop();}},_callee,null,[[0,2]]);}))();},setItem:function setItem(key,value){return(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(){var uri;return _regenerator["default"].wrap(function(_context2){while(1)switch(_context2.prev=_context2.next){case 0:uri=(filesystem.documentDirectory||'')+key;_context2.next=1;return filesystem.writeAsStringAsync(uri,value);case 1:case"end":return _context2.stop();}},_callee2);}))();}};};var buildOptimisticAsyncStorage=exports.buildOptimisticAsyncStorage=function buildOptimisticAsyncStorage(){if((0,_utils.isWeb)()&&typeof(_utils.GLOBAL_OBJ===null||_utils.GLOBAL_OBJ===void 0?void 0:_utils.GLOBAL_OBJ.window)==='undefined'){return undefined;}var supportedPlatform=!(0,_utils.isWeb)()&&!(0,_utils.isMacOS)();if(supportedPlatform){if(_OptionalExpoFileSystem.OptionalExpoFileSystem){var filesystem=_OptionalExpoFileSystem.OptionalExpoFileSystem;if(filesystem.Paths&&filesystem.File){return{getItem:function getItem(key){return(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee3(){var file,stringContent,_t2;return _regenerator["default"].wrap(function(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.prev=0;file=new filesystem.File(filesystem.Paths.document,key);_context3.next=1;return file.text();case 1:stringContent=_context3.sent;return _context3.abrupt("return",stringContent);case 2:_context3.prev=2;_t2=_context3["catch"](0);return _context3.abrupt("return",null);case 3:case"end":return _context3.stop();}},_callee3,null,[[0,2]]);}))();},setItem:function setItem(key,value){return(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee4(){var file;return _regenerator["default"].wrap(function(_context4){while(1)switch(_context4.prev=_context4.next){case 0:file=new filesystem.File(filesystem.Paths.document,key);_context4.next=1;return file.write(value);case 1:case"end":return _context4.stop();}},_callee4);}))();}};}}var legacyModule=_OptionalExpoFileSystemLegacy.OptionalExpoFileSystemLegacy||_OptionalExpoFileSystem.OptionalExpoFileSystem;try{if(legacyModule&&typeof legacyModule.readAsStringAsync==='function'){return buildLegacyStorage(legacyModule);}}catch(e){}}if(_OptionalAsyncStorage.OptionalAsyncStorage){return _OptionalAsyncStorage.OptionalAsyncStorage;}throw new Error('Txlemetry: No storage available. Please install expo-file-system or react-native-async-storage OR implement a custom storage provider.');};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type AsyncStorage from '@react-native-async-storage/async-storage';
|
|
2
|
-
export declare let OptionalAsyncStorage: typeof AsyncStorage | undefined;
|
|
1
|
+
import type AsyncStorage from '@react-native-async-storage/async-storage';
|
|
2
|
+
export declare let OptionalAsyncStorage: typeof AsyncStorage | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type ExpoApplication from 'expo-application';
|
|
2
|
-
export declare let OptionalExpoApplication: typeof ExpoApplication | undefined;
|
|
1
|
+
import type ExpoApplication from 'expo-application';
|
|
2
|
+
export declare let OptionalExpoApplication: typeof ExpoApplication | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type ExpoDevice from 'expo-device';
|
|
2
|
-
export declare let OptionalExpoDevice: typeof ExpoDevice | undefined;
|
|
1
|
+
import type ExpoDevice from 'expo-device';
|
|
2
|
+
export declare let OptionalExpoDevice: typeof ExpoDevice | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type ExpoFileSystem from 'expo-file-system';
|
|
2
|
-
export declare let OptionalExpoFileSystem: typeof ExpoFileSystem | undefined;
|
|
1
|
+
import type ExpoFileSystem from 'expo-file-system';
|
|
2
|
+
export declare let OptionalExpoFileSystem: typeof ExpoFileSystem | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type FileSystem from 'expo-file-system/legacy';
|
|
2
|
-
export declare let OptionalExpoFileSystemLegacy: typeof FileSystem | undefined;
|
|
1
|
+
import type FileSystem from 'expo-file-system/legacy';
|
|
2
|
+
export declare let OptionalExpoFileSystemLegacy: typeof FileSystem | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type ExpoLocalization from 'expo-localization';
|
|
2
|
-
export declare let OptionalExpoLocalization: typeof ExpoLocalization | undefined;
|
|
1
|
+
import type ExpoLocalization from 'expo-localization';
|
|
2
|
+
export declare let OptionalExpoLocalization: typeof ExpoLocalization | undefined;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import type
|
|
2
|
-
/**
|
|
3
|
-
* `@txlemetry/react-native-plugin` is the primary native plugin; we fall back to
|
|
4
|
-
* `
|
|
5
|
-
* when only the legacy package is installed. Optional methods are absent on
|
|
6
|
-
* older plugins, so callers check availability at runtime.
|
|
7
|
-
*/
|
|
8
|
-
export type
|
|
9
|
-
setup?: (sessionId: string, sdkOptions: {
|
|
10
|
-
[key: string]: any;
|
|
11
|
-
}, pluginConfig: {
|
|
12
|
-
[key: string]: any;
|
|
13
|
-
}) => Promise<void>;
|
|
14
|
-
startRecording?: (resumeCurrent: boolean) => Promise<void>;
|
|
15
|
-
stopRecording?: () => Promise<void>;
|
|
16
|
-
addExceptionStep?: (message: string, properties?: {
|
|
17
|
-
[key: string]: any;
|
|
18
|
-
}) => Promise<void>;
|
|
19
|
-
};
|
|
20
|
-
export declare let OptionalReactNativePlugin:
|
|
1
|
+
import type TxlemetryReactNativePlugin from '@txlemetry/react-native-plugin';
|
|
2
|
+
/**
|
|
3
|
+
* `@txlemetry/react-native-plugin` is the primary native plugin; we fall back to
|
|
4
|
+
* `txlemetry-react-native-session-replay` (same surface minus the newer methods)
|
|
5
|
+
* when only the legacy package is installed. Optional methods are absent on
|
|
6
|
+
* older plugins, so callers check availability at runtime.
|
|
7
|
+
*/
|
|
8
|
+
export type TxlemetryReactNativePluginExtended = typeof TxlemetryReactNativePlugin & {
|
|
9
|
+
setup?: (sessionId: string, sdkOptions: {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}, pluginConfig: {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}) => Promise<void>;
|
|
14
|
+
startRecording?: (resumeCurrent: boolean) => Promise<void>;
|
|
15
|
+
stopRecording?: () => Promise<void>;
|
|
16
|
+
addExceptionStep?: (message: string, properties?: {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}) => Promise<void>;
|
|
19
|
+
};
|
|
20
|
+
export declare let OptionalReactNativePlugin: TxlemetryReactNativePluginExtended | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type ReactNativeDeviceInfo from 'react-native-device-info';
|
|
2
|
-
export declare let OptionalReactNativeDeviceInfo: typeof ReactNativeDeviceInfo | undefined;
|
|
1
|
+
import type ReactNativeDeviceInfo from 'react-native-device-info';
|
|
2
|
+
export declare let OptionalReactNativeDeviceInfo: typeof ReactNativeDeviceInfo | undefined;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
interface ReactNativeLocalize {
|
|
2
|
-
getLocales: () => {
|
|
3
|
-
languageCode: string;
|
|
4
|
-
scriptCode?: string;
|
|
5
|
-
countryCode: string;
|
|
6
|
-
languageTag: string;
|
|
7
|
-
isRTL: boolean;
|
|
8
|
-
}[];
|
|
9
|
-
getTimeZone(): string;
|
|
10
|
-
}
|
|
11
|
-
import type ReactNativeLocalize from 'react-native-localize';
|
|
12
|
-
export declare let OptionalReactNativeLocalize: typeof ReactNativeLocalize | undefined;
|
|
13
|
-
export {};
|
|
1
|
+
interface ReactNativeLocalize {
|
|
2
|
+
getLocales: () => {
|
|
3
|
+
languageCode: string;
|
|
4
|
+
scriptCode?: string;
|
|
5
|
+
countryCode: string;
|
|
6
|
+
languageTag: string;
|
|
7
|
+
isRTL: boolean;
|
|
8
|
+
}[];
|
|
9
|
+
getTimeZone(): string;
|
|
10
|
+
}
|
|
11
|
+
import type ReactNativeLocalize from 'react-native-localize';
|
|
12
|
+
export declare let OptionalReactNativeLocalize: typeof ReactNativeLocalize | undefined;
|
|
13
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type ReactNativeNavigation from '@react-navigation/native';
|
|
2
|
-
export declare let OptionalReactNativeNavigation: typeof ReactNativeNavigation | undefined;
|
|
1
|
+
import type ReactNativeNavigation from '@react-navigation/native';
|
|
2
|
+
export declare let OptionalReactNativeNavigation: typeof ReactNativeNavigation | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type ReactNativeNavigationWix from 'react-native-navigation';
|
|
2
|
-
export declare let OptionalReactNativeNavigationWix: typeof ReactNativeNavigationWix | undefined;
|
|
1
|
+
import type ReactNativeNavigationWix from 'react-native-navigation';
|
|
2
|
+
export declare let OptionalReactNativeNavigationWix: typeof ReactNativeNavigationWix | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type RNSafeAreaContext from 'react-native-safe-area-context';
|
|
2
|
-
export declare const useOptionalSafeAreaInsets: () => RNSafeAreaContext.EdgeInsets;
|
|
1
|
+
import type RNSafeAreaContext from 'react-native-safe-area-context';
|
|
2
|
+
export declare const useOptionalSafeAreaInsets: () => RNSafeAreaContext.EdgeInsets;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type * as ReactNativeSvg from 'react-native-svg';
|
|
2
|
-
export declare let OptionalReactNativeSvg: typeof ReactNativeSvg | undefined;
|
|
1
|
+
import type * as ReactNativeSvg from 'react-native-svg';
|
|
2
|
+
export declare let OptionalReactNativeSvg: typeof ReactNativeSvg | undefined;
|
package/dist/storage.d.ts
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type
|
|
3
|
-
[key: string]: any;
|
|
4
|
-
};
|
|
5
|
-
export declare class
|
|
6
|
-
memoryCache:
|
|
7
|
-
storage:
|
|
8
|
-
preloadPromise: Promise<void> | undefined;
|
|
9
|
-
private _storageKey;
|
|
10
|
-
private _pendingPromises;
|
|
11
|
-
private _persistTimer?;
|
|
12
|
-
constructor(storage:
|
|
13
|
-
/**
|
|
14
|
-
* Force any scheduled write to be initiated now and await in-flight async
|
|
15
|
-
* writes. Used by durability-sensitive paths (events flush, AppState
|
|
16
|
-
* background, shutdown, login/logout/opt-in/opt-out, fatal exceptions) so the
|
|
17
|
-
* latest state is on its way to the backend before they continue.
|
|
18
|
-
*
|
|
19
|
-
* Best-effort under crash: backend writes are async, so an immediate
|
|
20
|
-
* termination can interrupt them. Never throws — backend errors are logged
|
|
21
|
-
* inside persist() / _drainScheduledPersist().
|
|
22
|
-
*/
|
|
23
|
-
waitForPersist(): Promise<void>;
|
|
24
|
-
persist(): void;
|
|
25
|
-
private schedulePersist;
|
|
26
|
-
private _drainScheduledPersist;
|
|
27
|
-
getItem(key: string): any | null | undefined;
|
|
28
|
-
setItem(key: string, value: any): void;
|
|
29
|
-
removeItem(key: string): void;
|
|
30
|
-
clear(): void;
|
|
31
|
-
getAllKeys(): readonly string[];
|
|
32
|
-
populateMemoryCache(res: string | null): void;
|
|
33
|
-
}
|
|
34
|
-
export declare class
|
|
35
|
-
constructor(storageKey: string);
|
|
36
|
-
}
|
|
37
|
-
export declare function createEventsStorage(customStorage:
|
|
38
|
-
export declare function createLogsStorage(customStorage:
|
|
39
|
-
export declare function createEventsMemoryStorage():
|
|
40
|
-
export declare function createLogsMemoryStorage():
|
|
41
|
-
export {};
|
|
1
|
+
import { TxlemetryCustomStorage } from './types';
|
|
2
|
+
type TxlemetryStorageContents = {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
};
|
|
5
|
+
export declare class TxlemetryRNStorage {
|
|
6
|
+
memoryCache: TxlemetryStorageContents;
|
|
7
|
+
storage: TxlemetryCustomStorage;
|
|
8
|
+
preloadPromise: Promise<void> | undefined;
|
|
9
|
+
private _storageKey;
|
|
10
|
+
private _pendingPromises;
|
|
11
|
+
private _persistTimer?;
|
|
12
|
+
constructor(storage: TxlemetryCustomStorage, storageKey: string, legacyStorageKey?: string);
|
|
13
|
+
/**
|
|
14
|
+
* Force any scheduled write to be initiated now and await in-flight async
|
|
15
|
+
* writes. Used by durability-sensitive paths (events flush, AppState
|
|
16
|
+
* background, shutdown, login/logout/opt-in/opt-out, fatal exceptions) so the
|
|
17
|
+
* latest state is on its way to the backend before they continue.
|
|
18
|
+
*
|
|
19
|
+
* Best-effort under crash: backend writes are async, so an immediate
|
|
20
|
+
* termination can interrupt them. Never throws — backend errors are logged
|
|
21
|
+
* inside persist() / _drainScheduledPersist().
|
|
22
|
+
*/
|
|
23
|
+
waitForPersist(): Promise<void>;
|
|
24
|
+
persist(): void;
|
|
25
|
+
private schedulePersist;
|
|
26
|
+
private _drainScheduledPersist;
|
|
27
|
+
getItem(key: string): any | null | undefined;
|
|
28
|
+
setItem(key: string, value: any): void;
|
|
29
|
+
removeItem(key: string): void;
|
|
30
|
+
clear(): void;
|
|
31
|
+
getAllKeys(): readonly string[];
|
|
32
|
+
populateMemoryCache(res: string | null): void;
|
|
33
|
+
}
|
|
34
|
+
export declare class TxlemetryRNSyncMemoryStorage extends TxlemetryRNStorage {
|
|
35
|
+
constructor(storageKey: string);
|
|
36
|
+
}
|
|
37
|
+
export declare function createEventsStorage(customStorage: TxlemetryCustomStorage): TxlemetryRNStorage;
|
|
38
|
+
export declare function createLogsStorage(customStorage: TxlemetryCustomStorage): TxlemetryRNStorage;
|
|
39
|
+
export declare function createEventsMemoryStorage(): TxlemetryRNStorage;
|
|
40
|
+
export declare function createLogsMemoryStorage(): TxlemetryRNStorage;
|
|
41
|
+
export {};
|
package/dist/storage.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.TxlemetryRNSyncMemoryStorage=exports.TxlemetryRNStorage=void 0;exports.createEventsMemoryStorage=createEventsMemoryStorage;exports.createEventsStorage=createEventsStorage;exports.createLogsMemoryStorage=createLogsMemoryStorage;exports.createLogsStorage=createLogsStorage;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _core=require("@txlemetry/core");function _callSuper(t,o,e){return o=(0,_getPrototypeOf2["default"])(o),(0,_possibleConstructorReturn2["default"])(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],(0,_getPrototypeOf2["default"])(t).constructor):o.apply(t,e));}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}var EVENTS_STORAGE_FILE='.txlemetry-rn.json';var LOGS_STORAGE_FILE='.txlemetry-rn-logs.json';var LEGACY_EVENTS_STORAGE_FILE='.posthog-rn.json';var LEGACY_LOGS_STORAGE_FILE='.posthog-rn-logs.json';var TXLEMETRY_STORAGE_VERSION='v1';var PERSIST_DEBOUNCE_MS=100;var TxlemetryRNStorage=exports.TxlemetryRNStorage=function(){function TxlemetryRNStorage(storage,storageKey,legacyStorageKey){var _this=this;(0,_classCallCheck2["default"])(this,TxlemetryRNStorage);var _a;this.memoryCache={};this._pendingPromises=new Set();this.storage=storage;this._storageKey=storageKey;var preloadResult=readWithLegacyFallback(this.storage,this._storageKey,legacyStorageKey);if((0,_core.isPromise)(preloadResult)){this.preloadPromise=preloadResult.then(function(res){_this.populateMemoryCache(res);});(_a=this.preloadPromise)===null||_a===void 0?void 0:_a["finally"](function(){_this.preloadPromise=undefined;});}else{this.populateMemoryCache(preloadResult);}}return(0,_createClass2["default"])(TxlemetryRNStorage,[{key:"waitForPersist",value:(function(){var _waitForPersist=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(){return _regenerator["default"].wrap(function(_context){while(1)switch(_context.prev=_context.next){case 0:this._drainScheduledPersist();if(!(this._pendingPromises.size>0)){_context.next=1;break;}_context.next=1;return Promise.all(this._pendingPromises);case 1:case"end":return _context.stop();}},_callee,this);}));function waitForPersist(){return _waitForPersist.apply(this,arguments);}return waitForPersist;}())},{key:"persist",value:function persist(){var _this2=this;var payload={version:TXLEMETRY_STORAGE_VERSION,content:this.memoryCache};var result=this.storage.setItem(this._storageKey,JSON.stringify(payload));if((0,_core.isPromise)(result)){var promise=result["catch"](function(err){console.warn('Txlemetry storage persist failed:',err);})["finally"](function(){_this2._pendingPromises["delete"](promise);});this._pendingPromises.add(promise);}}},{key:"schedulePersist",value:function schedulePersist(){var _this3=this;if(this._persistTimer!==undefined){return;}this._persistTimer=(0,_core.safeSetTimeout)(function(){_this3._persistTimer=undefined;try{_this3.persist();}catch(err){console.warn('Txlemetry storage scheduled persist threw:',err);}},PERSIST_DEBOUNCE_MS);}},{key:"_drainScheduledPersist",value:function _drainScheduledPersist(){if(this._persistTimer===undefined){return;}clearTimeout(this._persistTimer);this._persistTimer=undefined;try{this.persist();}catch(err){console.warn('Txlemetry storage drain persist threw:',err);}}},{key:"getItem",value:function getItem(key){return this.memoryCache[key];}},{key:"setItem",value:function setItem(key,value){this.memoryCache[key]=value;this.schedulePersist();}},{key:"removeItem",value:function removeItem(key){delete this.memoryCache[key];this.schedulePersist();}},{key:"clear",value:function clear(){for(var key in this.memoryCache){delete this.memoryCache[key];}this.schedulePersist();}},{key:"getAllKeys",value:function getAllKeys(){return Object.keys(this.memoryCache);}},{key:"populateMemoryCache",value:function populateMemoryCache(res){try{var data=res?JSON.parse(res).content:{};for(var key in data){this.memoryCache[key]=data[key];}}catch(e){console.warn("Txlemetry failed to load persisted data from storage. This is likely because the storage format is. We'll reset the storage.",e);}}}]);}();function readWithLegacyFallback(storage,storageKey,legacyStorageKey){var result=storage.getItem(storageKey);if(!legacyStorageKey){return result;}var orLegacy=function orLegacy(res){return res===null||res===undefined?storage.getItem(legacyStorageKey):res;};return(0,_core.isPromise)(result)?result.then(orLegacy):orLegacy(result);}var TxlemetryRNSyncMemoryStorage=exports.TxlemetryRNSyncMemoryStorage=function(_TxlemetryRNStorage){function TxlemetryRNSyncMemoryStorage(storageKey){(0,_classCallCheck2["default"])(this,TxlemetryRNSyncMemoryStorage);var cache={};var storage={getItem:function getItem(key){return cache[key];},setItem:function setItem(key,value){cache[key]=value;}};return _callSuper(this,TxlemetryRNSyncMemoryStorage,[storage,storageKey]);}(0,_inherits2["default"])(TxlemetryRNSyncMemoryStorage,_TxlemetryRNStorage);return(0,_createClass2["default"])(TxlemetryRNSyncMemoryStorage);}(TxlemetryRNStorage);function createEventsStorage(customStorage){return new TxlemetryRNStorage(customStorage,EVENTS_STORAGE_FILE,LEGACY_EVENTS_STORAGE_FILE);}function createLogsStorage(customStorage){return new TxlemetryRNStorage(customStorage,LOGS_STORAGE_FILE,LEGACY_LOGS_STORAGE_FILE);}function createEventsMemoryStorage(){return new TxlemetryRNSyncMemoryStorage(EVENTS_STORAGE_FILE);}function createLogsMemoryStorage(){return new TxlemetryRNSyncMemoryStorage(LOGS_STORAGE_FILE);}
|