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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.Txlemetry=void 0;Object.defineProperty(exports,"TxlemetryPersistedProperty",{enumerable:true,get:function get(){return _core.TxlemetryPersistedProperty;}});var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _get2=_interopRequireDefault(require("@babel/runtime/helpers/get"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _reactNative=require("react-native");var _core=require("@txlemetry/core");var _storage=require("./storage");var _logsDefaults=require("./logs-defaults");var _version=require("./version");var _nativeDeps=require("./native-deps");var _utils=require("./utils");var _wixNavigation=require("./frameworks/wix-navigation");var _OptionalPlugin=require("./optional/OptionalPlugin");var _errorTracking=require("./error-tracking");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 _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;})();}function _superPropGet(t,o,e,r){var p=(0,_get2["default"])((0,_getPrototypeOf2["default"])(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function mapAppStateForLogs(state){if(state==='background'){return'background';}if(!state||state==='unknown'){return undefined;}return'foreground';}var Txlemetry=exports.Txlemetry=function(_TxlemetryCore){function Txlemetry(apiKey,options){var _this;(0,_classCallCheck2["default"])(this,Txlemetry);var _a,_b,_c,_d,_e,_f;var normalizedApiKey=typeof apiKey==='string'?apiKey.trim():'';if(!normalizedApiKey){console.error("You must pass your Txlemetry project's api key. The client will be disabled.");}_this=_callSuper(this,Txlemetry,[normalizedApiKey,options]);_this._appProperties={};_this._sessionReplayNativeInitialized=false;_this._nativeErrorTrackingInitialized=false;_this._sessionReplayEvalChain=Promise.resolve();_this._sessionReplayEventTriggers=[];_this._surveysReadyPromise=null;_this._surveysReady=false;_this._requestHeaders={};_this._surveysReadyResolve=null;_this._isInitialized=false;_this._persistence=(_a=options===null||options===void 0?void 0:options.persistence)!==null&&_a!==void 0?_a:'file';_this._disableSurveys=(_b=options===null||options===void 0?void 0:options.disableSurveys)!==null&&_b!==void 0?_b:false;_this._errorTracking=new _errorTracking.ErrorTracking(_this,options===null||options===void 0?void 0:options.errorTracking,_this._logger);_this._setDefaultPersonProperties=(_c=options===null||options===void 0?void 0:options.setDefaultPersonProperties)!==null&&_c!==void 0?_c:true;_this._overrideDisplayLanguage=((_d=options===null||options===void 0?void 0:options.overrideDisplayLanguage)===null||_d===void 0?void 0:_d.trim())||null;_this._requestHeaders=(_e=options===null||options===void 0?void 0:options.requestHeaders)!==null&&_e!==void 0?_e:{};_this._appProperties=typeof(options===null||options===void 0?void 0:options.customAppProperties)==='function'?options.customAppProperties((0,_nativeDeps.getAppProperties)()):(options===null||options===void 0?void 0:options.customAppProperties)||(0,_nativeDeps.getAppProperties)();var storagePromise;var theStorage;if(_this._persistence==='file'){theStorage=(_f=options===null||options===void 0?void 0:options.customStorage)!==null&&_f!==void 0?_f:(0,_nativeDeps.buildOptimisticAsyncStorage)();}if(theStorage){_this._eventsStorage=(0,_storage.createEventsStorage)(theStorage);_this._logsStorage=(0,_storage.createLogsStorage)(theStorage);var preloads=[];if(_this._eventsStorage.preloadPromise){preloads.push(['events',_this._eventsStorage.preloadPromise]);}if(_this._logsStorage.preloadPromise){preloads.push(['logs',_this._logsStorage.preloadPromise]);}if(preloads.length>0){storagePromise=(0,_core.allSettled)(preloads.map(function(_ref){var _ref2=(0,_slicedToArray2["default"])(_ref,2),p=_ref2[1];return p;})).then(function(results){results.forEach(function(r,i){if(r.status==='rejected'){_this._logger.error("Txlemetry ".concat(preloads[i][0]," storage preload failed:"),r.reason);}});});}}else{_this._eventsStorage=(0,_storage.createEventsMemoryStorage)();_this._logsStorage=(0,_storage.createLogsMemoryStorage)();}_this._currentAppState=mapAppStateForLogs(_reactNative.AppState.currentState);_this._resolvedLogsConfig=(0,_logsDefaults.resolveLogsConfig)(options===null||options===void 0?void 0:options.logs);_this._logs=new _core.TxlemetryLogs(_this,_this._resolvedLogsConfig,_this._logger,function(){var _a;var flags=_this.getFeatureFlags();var flagKeys=flags?Object.keys(flags):undefined;return{distinctId:_this.getDistinctId()||undefined,sessionId:_this.getSessionId()||undefined,screenName:((_a=_this.sessionProps)===null||_a===void 0?void 0:_a.$screen_name)||undefined,appState:_this._currentAppState,activeFeatureFlags:flagKeys&&flagKeys.length>0?flagKeys:undefined};},function(fn){return _this.wrap(fn);},function(){return _this._logsStorage.waitForPersist();});_reactNative.AppState.addEventListener('change',function(state){if(state==='unknown'){return;}var mapped=mapAppStateForLogs(state);if(mapped){_this._currentAppState=mapped;}void _this.flush()["catch"](function(){var _ref3=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(err){return _regenerator["default"].wrap(function(_context){while(1)switch(_context.prev=_context.next){case 0:_context.next=1;return(0,_core.logFlushError)(err);case 1:case"end":return _context.stop();}},_callee);}));return function(_x3){return _ref3.apply(this,arguments);};}());var isBackgrounding=mapped==='background';var logsFlushPromise=isBackgrounding?_this._logs.flushWithTimeout(_this._resolvedLogsConfig.backgroundFlushBudgetMs):_this._logs.flush();void logsFlushPromise["catch"](function(){var _ref4=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(err){return _regenerator["default"].wrap(function(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=1;return(0,_core.logFlushError)(err);case 1:case"end":return _context2.stop();}},_callee2);}));return function(_x4){return _ref4.apply(this,arguments);};}());void _this._eventsStorage.waitForPersist();void _this._logsStorage.waitForPersist();if(state==='active'){_this.getSessionId();}});var initAfterStorage=function initAfterStorage(){var enablePersistSessionIdAcrossRestart=options===null||options===void 0?void 0:options.enablePersistSessionIdAcrossRestart;if(!enablePersistSessionIdAcrossRestart){_this.setPersistedProperty(_core.TxlemetryPersistedProperty.SessionId,null);_this.setPersistedProperty(_core.TxlemetryPersistedProperty.SessionLastTimestamp,null);_this.setPersistedProperty(_core.TxlemetryPersistedProperty.SessionStartTimestamp,null);}_this.setupBootstrap(options);if(!_this.getPersistedProperty(_core.TxlemetryPersistedProperty.DeviceId)){var anonId=_this.getAnonymousId();if(anonId){_this.setPersistedProperty(_core.TxlemetryPersistedProperty.DeviceId,anonId);}}if(_this._setDefaultPersonProperties){_this._setDefaultPersonPropertiesForFlags(false);}_this._isInitialized=true;if(_this.isDisabled){return;}var cachedRemoteConfig=_this.getPersistedProperty(_core.TxlemetryPersistedProperty.RemoteConfig);if(cachedRemoteConfig){_this._errorTracking.onRemoteConfig(cachedRemoteConfig.errorTracking);}_this.reloadRemoteConfigAsync().then(function(response){if(response){_this._handleSurveysFromRemoteConfig(response);}})["catch"](function(error){_this._logger.error('Error loading remote config:',error);})["finally"](function(){_this._notifySurveysReady();});if((options===null||options===void 0?void 0:options.captureAppLifecycleEvents)!==false){void _this.captureAppLifecycleEvents();}void _this.persistAppVersion();void _this.startSessionReplay(options,cachedRemoteConfig!==null&&cachedRemoteConfig!==void 0?cachedRemoteConfig:undefined);if(options===null||options===void 0?void 0:options.enableSessionReplay){_this.onFeatureFlags(function(){void _this._evaluateAndStartSessionReplay();});}if((options===null||options===void 0?void 0:options.addTracingHeaders)&&options.addTracingHeaders.length>0){(0,_core.patchFetchForTracingHeaders)(_this,options.addTracingHeaders);}};if(storagePromise){_this._initPromise=storagePromise.then(initAfterStorage);}else{_this._initPromise=Promise.resolve();initAfterStorage();}return _this;}(0,_inherits2["default"])(Txlemetry,_TxlemetryCore);return(0,_createClass2["default"])(Txlemetry,[{key:"ready",value:(function(){var _ready=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee3(){return _regenerator["default"].wrap(function(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.next=1;return this._initPromise;case 1:case"end":return _context3.stop();}},_callee3,this);}));function ready(){return _ready.apply(this,arguments);}return ready;}())},{key:"onRemoteConfig",value:function onRemoteConfig(response){this._errorTracking.onRemoteConfig(response.errorTracking);}},{key:"_storageForKey",value:function _storageForKey(key){return key===_core.TxlemetryPersistedProperty.LogsQueue?this._logsStorage:this._eventsStorage;}},{key:"getPersistedProperty",value:function getPersistedProperty(key){return this._storageForKey(key).getItem(key);}},{key:"setPersistedProperty",value:function setPersistedProperty(key,value){var storage=this._storageForKey(key);return value!==null?storage.setItem(key,value):storage.removeItem(key);}},{key:"flushStorage",value:(function(){var _flushStorage=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee4(){return _regenerator["default"].wrap(function(_context4){while(1)switch(_context4.prev=_context4.next){case 0:_context4.next=1;return this._eventsStorage.waitForPersist();case 1:case"end":return _context4.stop();}},_callee4,this);}));function flushStorage(){return _flushStorage.apply(this,arguments);}return flushStorage;}())},{key:"_shutdown",value:(function(){var _shutdown2=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee5(){var shutdownTimeoutMs,start,logsBudgetMs,remainingMs,drain,_args5=arguments;return _regenerator["default"].wrap(function(_context5){while(1)switch(_context5.prev=_context5.next){case 0:shutdownTimeoutMs=_args5.length>0&&_args5[0]!==undefined?_args5[0]:30000;this._errorTracking.clearExceptionSteps();start=Date.now();logsBudgetMs=Math.min(shutdownTimeoutMs,this._resolvedLogsConfig.terminationFlushBudgetMs);_context5.prev=1;_context5.next=2;return Promise.all([this._logs.shutdown(logsBudgetMs),_superPropGet(Txlemetry,"_shutdown",this,3)([shutdownTimeoutMs])]);case 2:_context5.prev=2;remainingMs=Math.max(0,shutdownTimeoutMs-(Date.now()-start));drain=Promise.all([this._eventsStorage.waitForPersist(),this._logsStorage.waitForPersist()]);_context5.next=3;return Promise.race([drain,new Promise(function(resolve){return(0,_core.safeSetTimeout)(resolve,remainingMs);})]);case 3:return _context5.finish(2);case 4:case"end":return _context5.stop();}},_callee5,this,[[1,,2,4]]);}));function _shutdown(){return _shutdown2.apply(this,arguments);}return _shutdown;}())},{key:"fetch",value:function(_fetch){function fetch(_x,_x2){return _fetch.apply(this,arguments);}fetch.toString=function(){return _fetch.toString();};return fetch;}(function(url,options){return fetch(url,options);})},{key:"getLibraryId",value:function getLibraryId(){return'posthog-react-native';}},{key:"getLibraryVersion",value:function getLibraryVersion(){return _version.version;}},{key:"getCustomUserAgent",value:function getCustomUserAgent(){if(_reactNative.Platform.OS==='web'){return'';}return"".concat(this.getLibraryId(),"/").concat(this.getLibraryVersion());}},{key:"getCustomHeaders",value:function getCustomHeaders(){return _objectSpread(_objectSpread({},_superPropGet(Txlemetry,"getCustomHeaders",this,3)([])),this._requestHeaders);}},{key:"getCommonEventProperties",value:function getCommonEventProperties(){return _objectSpread(_objectSpread(_objectSpread({},_superPropGet(Txlemetry,"getCommonEventProperties",this,3)([])),this._appProperties),{},{$screen_height:_reactNative.Dimensions.get('screen').height,$screen_width:_reactNative.Dimensions.get('screen').width});}},{key:"getSurveyDisplayLanguageOverride",value:function getSurveyDisplayLanguageOverride(){return this._overrideDisplayLanguage;}},{key:"register",value:function register(properties){return _superPropGet(Txlemetry,"register",this,3)([properties]);}},{key:"unregister",value:function unregister(property){return _superPropGet(Txlemetry,"unregister",this,3)([property]);}},{key:"reset",value:function reset(propertiesToKeep){var effectivePropertiesToKeep=propertiesToKeep!==null&&propertiesToKeep!==void 0?propertiesToKeep:[_core.TxlemetryPersistedProperty.InstalledAppBuild,_core.TxlemetryPersistedProperty.InstalledAppVersion,_core.TxlemetryPersistedProperty.DeviceId];_superPropGet(Txlemetry,"reset",this,3)([[_core.TxlemetryPersistedProperty.RemoteConfig,_core.TxlemetryPersistedProperty.SessionReplay,_core.TxlemetryPersistedProperty.Surveys].concat((0,_toConsumableArray2["default"])(effectivePropertiesToKeep))]);if(this._setDefaultPersonProperties){this._setDefaultPersonPropertiesForFlags(false);}void this._eventsStorage.waitForPersist();}},{key:"_setDefaultPersonPropertiesForFlags",value:function _setDefaultPersonPropertiesForFlags(){var _this2=this;var reloadFeatureFlags=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;var defaultProps={};var relevantKeys=['$app_version','$app_build','$app_namespace','$os_name','$os_version','$device_type'];relevantKeys.forEach(function(key){var value=_this2._appProperties[key];if(value!==null&&value!==undefined){defaultProps[key]=value;}});var commonProps=this.getCommonEventProperties();if(commonProps.$lib){defaultProps.$lib=commonProps.$lib;}if(commonProps.$lib_version){defaultProps.$lib_version=commonProps.$lib_version;}if(Object.keys(defaultProps).length>0){this.setPersonPropertiesForFlags(defaultProps,reloadFeatureFlags);}}},{key:"flush",value:function flush(){return _superPropGet(Txlemetry,"flush",this,3)([]);}},{key:"captureLog",value:function captureLog(options){this._logs.captureLog(options);}},{key:"flushLogs",value:function flushLogs(){return this._logs.flush();}},{key:"logger",get:function get(){var _this3=this;if(!this._captureLogger){this._captureLogger={trace:function trace(body,attributes){return _this3.captureLog({body:body,level:'trace',attributes:attributes});},debug:function debug(body,attributes){return _this3.captureLog({body:body,level:'debug',attributes:attributes});},info:function info(body,attributes){return _this3.captureLog({body:body,level:'info',attributes:attributes});},warn:function warn(body,attributes){return _this3.captureLog({body:body,level:'warn',attributes:attributes});},error:function error(body,attributes){return _this3.captureLog({body:body,level:'error',attributes:attributes});},fatal:function fatal(body,attributes){return _this3.captureLog({body:body,level:'fatal',attributes:attributes});}};}return this._captureLogger;}},{key:"optIn",value:function optIn(){var result=_superPropGet(Txlemetry,"optIn",this,3)([]);void this._eventsStorage.waitForPersist();return result;}},{key:"optOut",value:function optOut(){var result=_superPropGet(Txlemetry,"optOut",this,3)([]);void this._eventsStorage.waitForPersist();return result;}},{key:"isFeatureEnabled",value:function isFeatureEnabled(key,options){return _superPropGet(Txlemetry,"isFeatureEnabled",this,3)([key,options]);}},{key:"getFeatureFlag",value:function getFeatureFlag(key,options){return _superPropGet(Txlemetry,"getFeatureFlag",this,3)([key,options]);}},{key:"getFeatureFlagPayload",value:function getFeatureFlagPayload(key){return _superPropGet(Txlemetry,"getFeatureFlagPayload",this,3)([key]);}},{key:"reloadFeatureFlags",value:function reloadFeatureFlags(){_superPropGet(Txlemetry,"reloadFeatureFlags",this,3)([]);}},{key:"reloadFeatureFlagsAsync",value:function reloadFeatureFlagsAsync(){return _superPropGet(Txlemetry,"reloadFeatureFlagsAsync",this,3)([]);}},{key:"updateFlags",value:function updateFlags(flags,payloads,options){_superPropGet(Txlemetry,"updateFlags",this,3)([flags,payloads,options]);}},{key:"group",value:function group(groupType,groupKey,properties){_superPropGet(Txlemetry,"group",this,3)([groupType,groupKey,properties]);if(properties&&Object.keys(properties).length>0){var propsToCache={};Object.keys(properties).forEach(function(key){var value=properties[key];if(value!==null&&value!==undefined){propsToCache[key]=value;}});if(Object.keys(propsToCache).length>0){this.setGroupPropertiesForFlags((0,_defineProperty2["default"])({},groupType,propsToCache));}}}},{key:"alias",value:function alias(_alias){_superPropGet(Txlemetry,"alias",this,3)([_alias]);}},{key:"getDistinctId",value:function getDistinctId(){return _superPropGet(Txlemetry,"getDistinctId",this,3)([]);}},{key:"getDeviceId",value:function getDeviceId(){var deviceId=this.getPersistedProperty(_core.TxlemetryPersistedProperty.DeviceId);if(!deviceId){var anonId=this.getAnonymousId();if(anonId){this.setPersistedProperty(_core.TxlemetryPersistedProperty.DeviceId,anonId);return anonId;}return'';}return deviceId;}},{key:"setPersonPropertiesForFlags",value:function setPersonPropertiesForFlags(properties){var reloadFeatureFlags=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;_superPropGet(Txlemetry,"setPersonPropertiesForFlags",this,3)([properties,reloadFeatureFlags]);}},{key:"resetPersonPropertiesForFlags",value:function resetPersonPropertiesForFlags(){var reloadFeatureFlags=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;_superPropGet(Txlemetry,"resetPersonPropertiesForFlags",this,3)([]);if(reloadFeatureFlags){this.reloadFeatureFlags();}}},{key:"setGroupPropertiesForFlags",value:function setGroupPropertiesForFlags(properties){var reloadFeatureFlags=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;_superPropGet(Txlemetry,"setGroupPropertiesForFlags",this,3)([properties]);if(reloadFeatureFlags){this.reloadFeatureFlags();}}},{key:"resetGroupPropertiesForFlags",value:function resetGroupPropertiesForFlags(){var reloadFeatureFlags=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;_superPropGet(Txlemetry,"resetGroupPropertiesForFlags",this,3)([]);if(reloadFeatureFlags){this.reloadFeatureFlags();}}},{key:"screen",value:(function(){var _screen=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee6(name,properties,options){return _regenerator["default"].wrap(function(_context6){while(1)switch(_context6.prev=_context6.next){case 0:_context6.next=1;return this._initPromise;case 1:this.registerForSession({$screen_name:name});return _context6.abrupt("return",this.capture('$screen',_objectSpread(_objectSpread({},properties),{},{$screen_name:name}),options));case 2:case"end":return _context6.stop();}},_callee6,this);}));function screen(_x5,_x6,_x7){return _screen.apply(this,arguments);}return screen;}())},{key:"_isEnableSessionReplay",value:function _isEnableSessionReplay(){var _a;return!this.isDisabled&&((_a=this._enableSessionReplay)!==null&&_a!==void 0?_a:false);}},{key:"_resetSessionId",value:function _resetSessionId(reactNativeSessionReplay,sessionId){if(reactNativeSessionReplay){reactNativeSessionReplay.endSession();reactNativeSessionReplay.startSession(sessionId);}}},{key:"getSessionId",value:function getSessionId(){var sessionId=_superPropGet(Txlemetry,"getSessionId",this,3)([]);if(!this._isEnableSessionReplay()&&!this._isNativePluginInitialized()){return sessionId;}if(sessionId.length>0&&this._currentSessionId&&sessionId!==this._currentSessionId){if(_OptionalPlugin.OptionalReactNativePlugin){try{this._resetSessionId(_OptionalPlugin.OptionalReactNativePlugin,String(sessionId));this._logger.info("sessionId rotated from ".concat(this._currentSessionId," to ").concat(sessionId,"."));}catch(e){this._logger.error("Failed to rotate sessionId: ".concat(e,"."));}}this._currentSessionId=sessionId;if(this._sessionReplayEventTriggers.length>0){void this._evaluateAndStartSessionReplay();}}else{this._logger.info("sessionId not rotated, sessionId ".concat(sessionId," and currentSessionId ").concat(this._currentSessionId,"."));}return sessionId;}},{key:"resetSessionId",value:function resetSessionId(){_superPropGet(Txlemetry,"resetSessionId",this,3)([]);if((this._isEnableSessionReplay()||this._isNativePluginInitialized())&&_OptionalPlugin.OptionalReactNativePlugin){try{_OptionalPlugin.OptionalReactNativePlugin.endSession();this._logger.info("Native Txlemetry session ended.");}catch(e){this._logger.error("Native Txlemetry session failed to end: ".concat(e,"."));}}}},{key:"startSessionRecording",value:(function(){var _startSessionRecording2=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee7(){var resumeCurrent,_args7=arguments;return _regenerator["default"].wrap(function(_context7){while(1)switch(_context7.prev=_context7.next){case 0:resumeCurrent=_args7.length>0&&_args7[0]!==undefined?_args7[0]:true;_context7.next=1;return this._startSessionRecording(resumeCurrent);case 1:case"end":return _context7.stop();}},_callee7,this);}));function startSessionRecording(){return _startSessionRecording2.apply(this,arguments);}return startSessionRecording;}())},{key:"_startSessionRecording",value:function(){var _startSessionRecording3=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee8(resumeCurrent){var initialized,newSessionId,_t;return _regenerator["default"].wrap(function(_context8){while(1)switch(_context8.prev=_context8.next){case 0:_context8.next=1;return this._initPromise;case 1:if(!this.isDisabled){_context8.next=2;break;}return _context8.abrupt("return",false);case 2:if(_OptionalPlugin.OptionalReactNativePlugin){_context8.next=3;break;}return _context8.abrupt("return",false);case 3:_context8.prev=3;if(_OptionalPlugin.OptionalReactNativePlugin.startRecording){_context8.next=4;break;}this._logger.warn('startRecording is not available. Please update @txlemetry/react-native-plugin or txlemetry-react-native-session-replay.');return _context8.abrupt("return",false);case 4:if(this._sessionReplayNativeInitialized){_context8.next=6;break;}this._logger.info('Native session replay SDK not initialized, initializing now...');_context8.next=5;return this.initializeNativePlugin(this._sessionReplayOptions,undefined,true);case 5:initialized=_context8.sent;if(initialized){_context8.next=6;break;}this._logger.error('Failed to initialize native session replay SDK.');return _context8.abrupt("return",false);case 6:if(!resumeCurrent){_superPropGet(Txlemetry,"resetSessionId",this,3)([]);newSessionId=_superPropGet(Txlemetry,"getSessionId",this,3)([]);this._resetSessionId(_OptionalPlugin.OptionalReactNativePlugin,String(newSessionId));this._currentSessionId=newSessionId;}_context8.next=7;return _OptionalPlugin.OptionalReactNativePlugin.startRecording(resumeCurrent);case 7:this._logger.info("Session recording ".concat(resumeCurrent?'resumed':'started',"."));return _context8.abrupt("return",true);case 8:_context8.prev=8;_t=_context8["catch"](3);this._logger.error("Failed to start session recording: ".concat(_t));return _context8.abrupt("return",false);case 9:case"end":return _context8.stop();}},_callee8,this,[[3,8]]);}));function _startSessionRecording(_x8){return _startSessionRecording3.apply(this,arguments);}return _startSessionRecording;}()},{key:"stopSessionRecording",value:(function(){var _stopSessionRecording2=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee9(){return _regenerator["default"].wrap(function(_context9){while(1)switch(_context9.prev=_context9.next){case 0:_context9.next=1;return this._stopSessionRecording();case 1:case"end":return _context9.stop();}},_callee9,this);}));function stopSessionRecording(){return _stopSessionRecording2.apply(this,arguments);}return stopSessionRecording;}())},{key:"_stopSessionRecording",value:function(){var _stopSessionRecording3=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee0(){var _t2;return _regenerator["default"].wrap(function(_context0){while(1)switch(_context0.prev=_context0.next){case 0:_context0.next=1;return this._initPromise;case 1:if(!this.isDisabled){_context0.next=2;break;}return _context0.abrupt("return",false);case 2:if(_OptionalPlugin.OptionalReactNativePlugin){_context0.next=3;break;}return _context0.abrupt("return",false);case 3:_context0.prev=3;if(_OptionalPlugin.OptionalReactNativePlugin.stopRecording){_context0.next=4;break;}this._logger.warn('stopRecording is not available. Please update @txlemetry/react-native-plugin or txlemetry-react-native-session-replay.');return _context0.abrupt("return",false);case 4:_context0.next=5;return _OptionalPlugin.OptionalReactNativePlugin.stopRecording();case 5:this._logger.info('Session recording stopped.');return _context0.abrupt("return",true);case 6:_context0.prev=6;_t2=_context0["catch"](3);this._logger.error("Failed to stop session recording: ".concat(_t2));return _context0.abrupt("return",false);case 7:case"end":return _context0.stop();}},_callee0,this,[[3,6]]);}));function _stopSessionRecording(){return _stopSessionRecording3.apply(this,arguments);}return _stopSessionRecording;}()},{key:"isSessionReplayActive",value:(function(){var _isSessionReplayActive=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee1(){var _t3;return _regenerator["default"].wrap(function(_context1){while(1)switch(_context1.prev=_context1.next){case 0:_context1.next=1;return this._initPromise;case 1:if(!this.isDisabled){_context1.next=2;break;}return _context1.abrupt("return",false);case 2:if(_OptionalPlugin.OptionalReactNativePlugin){_context1.next=3;break;}return _context1.abrupt("return",false);case 3:_context1.prev=3;_context1.next=4;return _OptionalPlugin.OptionalReactNativePlugin.isEnabled();case 4:return _context1.abrupt("return",_context1.sent);case 5:_context1.prev=5;_t3=_context1["catch"](3);this._logger.error("Failed to check session replay status: ".concat(_t3));return _context1.abrupt("return",false);case 6:case"end":return _context1.stop();}},_callee1,this,[[3,5]]);}));function isSessionReplayActive(){return _isSessionReplayActive.apply(this,arguments);}return isSessionReplayActive;}())},{key:"identify",value:function identify(distinctId,properties,options){var previousDistinctId=this.getDistinctId();var userProps=(properties===null||properties===void 0?void 0:properties.$set)||properties;var userPropsOnce=properties===null||properties===void 0?void 0:properties.$set_once;_superPropGet(Txlemetry,"identify",this,3)([distinctId,properties,options]);var propsToCache={};if(userProps&&(0,_typeof2["default"])(userProps)==='object'&&!Array.isArray(userProps)){Object.entries(userProps).forEach(function(_ref5){var _ref6=(0,_slicedToArray2["default"])(_ref5,2),key=_ref6[0],value=_ref6[1];if(value!==null&&value!==undefined){propsToCache[key]=value;}});}var propsOnceToCache={};if(userPropsOnce&&(0,_typeof2["default"])(userPropsOnce)==='object'&&!Array.isArray(userPropsOnce)){Object.entries(userPropsOnce).forEach(function(_ref7){var _ref8=(0,_slicedToArray2["default"])(_ref7,2),key=_ref8[0],value=_ref8[1];if(value!==null&&value!==undefined){propsOnceToCache[key]=value;}});}if(Object.keys(propsToCache).length>0||Object.keys(propsOnceToCache).length>0){this.setPersonPropertiesForFlags(_objectSpread({$set:propsToCache},Object.keys(propsOnceToCache).length>0?{$set_once:propsOnceToCache}:{}),false);}if((this._isEnableSessionReplay()||this._isNativePluginInitialized())&&_OptionalPlugin.OptionalReactNativePlugin){try{distinctId=distinctId||previousDistinctId;var anonymousId=this.getAnonymousId();_OptionalPlugin.OptionalReactNativePlugin.identify(String(distinctId),String(anonymousId));this._logger.info("Native Txlemetry identified with distinctId ".concat(distinctId," and anonymousId ").concat(anonymousId,"."));}catch(e){this._logger.error("Native Txlemetry failed to identify: ".concat(e,"."));}}void this._eventsStorage.waitForPersist();}},{key:"captureException",value:function captureException(error){var additionalProperties=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var hint=arguments.length>2?arguments[2]:undefined;var resolvedHint=hint!==null&&hint!==void 0?hint:{mechanism:{handled:true,type:'generic'},syntheticException:new Error('Synthetic Error')};additionalProperties=this._errorTracking.attachExceptionSteps(additionalProperties);_superPropGet(Txlemetry,"captureException",this,3)([error,additionalProperties,resolvedHint]);if((additionalProperties===null||additionalProperties===void 0?void 0:additionalProperties.$exception_level)==='fatal'){void this._eventsStorage.waitForPersist();void this._logsStorage.waitForPersist();}}},{key:"addExceptionStep",value:function addExceptionStep(message,properties){this._errorTracking.addExceptionStep(message,properties);}},{key:"createErrorPropertiesBuilder",value:function createErrorPropertiesBuilder(){return new _core.ErrorTracking.ErrorPropertiesBuilder([new _core.ErrorTracking.PromiseRejectionEventCoercer(),new _core.ErrorTracking.ErrorCoercer(),new _core.ErrorTracking.ErrorEventCoercer(),new _core.ErrorTracking.ObjectCoercer(),new _core.ErrorTracking.StringCoercer(),new _core.ErrorTracking.PrimitiveCoercer()],_core.ErrorTracking.createStackParser((0,_utils.isHermes)()?'hermes':'web:javascript',_core.ErrorTracking.chromeStackLineParser,_core.ErrorTracking.geckoStackLineParser));}},{key:"initReactNativeNavigation",value:function initReactNativeNavigation(options){return(0,_wixNavigation.withReactNativeNavigation)(this,options);}},{key:"createPersonProfile",value:function createPersonProfile(){_superPropGet(Txlemetry,"createPersonProfile",this,3)([]);}},{key:"setPersonProperties",value:function setPersonProperties(userPropertiesToSet,userPropertiesToSetOnce){var reloadFeatureFlags=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;_superPropGet(Txlemetry,"setPersonProperties",this,3)([userPropertiesToSet,userPropertiesToSetOnce,reloadFeatureFlags]);}},{key:"unsetPersonProperties",value:function unsetPersonProperties(propertyNames){var reloadFeatureFlags=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;_superPropGet(Txlemetry,"unsetPersonProperties",this,3)([propertyNames,reloadFeatureFlags]);}},{key:"getSurveys",value:function(){var _getSurveys=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee10(){var surveys;return _regenerator["default"].wrap(function(_context10){while(1)switch(_context10.prev=_context10.next){case 0:if(!(this._disableSurveys===true)){_context10.next=1;break;}this._logger.info('Loading surveys is disabled.');this._cacheSurveys(null,'disabled in config');return _context10.abrupt("return",[]);case 1:surveys=this.getPersistedProperty(_core.TxlemetryPersistedProperty.Surveys);if(!(surveys&&surveys.length>0)){_context10.next=2;break;}this._logger.info('Surveys fetched from storage: ',JSON.stringify(surveys));return _context10.abrupt("return",surveys);case 2:this._logger.info('No surveys found in storage');return _context10.abrupt("return",[]);case 3:case"end":return _context10.stop();}},_callee10,this);}));function getSurveys(){return _getSurveys.apply(this,arguments);}return getSurveys;}()},{key:"_onSurveysReady",value:function _onSurveysReady(){var _this4=this;if(this._surveysReady){return Promise.resolve();}if(!this._surveysReadyPromise){this._surveysReadyPromise=new Promise(function(resolve){_this4._surveysReadyResolve=resolve;});}return this._surveysReadyPromise;}},{key:"_cacheSurveys",value:function _cacheSurveys(surveys,source){this.setPersistedProperty(_core.TxlemetryPersistedProperty.Surveys,surveys);if(surveys&&surveys.length>0){this._logger.info("Surveys cached from ".concat(source,":"),JSON.stringify(surveys));}else if(surveys===null){this._logger.info("Surveys cleared (".concat(source,")"));}else{this._logger.info("No surveys to cache from ".concat(source,")"));}}},{key:"_notifySurveysReady",value:function _notifySurveysReady(){this._surveysReady=true;if(this._surveysReadyResolve){this._surveysReadyResolve();this._surveysReadyResolve=null;this._surveysReadyPromise=null;}}},{key:"_handleSurveysFromRemoteConfig",value:function _handleSurveysFromRemoteConfig(response){if(this._disableSurveys===true){this._logger.info('Loading surveys skipped, disabled.');this._cacheSurveys(null,'remote config (disabled)');return;}var surveys=response.surveys;if(Array.isArray(surveys)&&surveys.length>0){this._cacheSurveys(surveys,'remote config');}else{this._cacheSurveys(null,'remote config');}}},{key:"_isAutocaptureNativeErrors",value:function _isAutocaptureNativeErrors(options){var _a;var autocapture=(_a=options===null||options===void 0?void 0:options.errorTracking)===null||_a===void 0?void 0:_a.autocapture;var nativeCrashes=(0,_typeof2["default"])(autocapture)==='object'&&autocapture.nativeCrashes===true;return!this.isDisabled&&nativeCrashes;}},{key:"_isNativePluginInitialized",value:function _isNativePluginInitialized(){return this._sessionReplayNativeInitialized||this._nativeErrorTrackingInitialized;}},{key:"initializeSessionReplayNative",value:(function(){var _initializeSessionReplayNative=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee11(options,cachedRemoteConfig){return _regenerator["default"].wrap(function(_context11){while(1)switch(_context11.prev=_context11.next){case 0:return _context11.abrupt("return",this.initializeNativePlugin(options,cachedRemoteConfig,true));case 1:case"end":return _context11.stop();}},_callee11,this);}));function initializeSessionReplayNative(_x9,_x0){return _initializeSessionReplayNative.apply(this,arguments);}return initializeSessionReplayNative;}())},{key:"initializeNativePlugin",value:function(){var _initializeNativePlugin=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee12(options,cachedRemoteConfig){var enableSessionReplay,_a,_b,_c,_d,_e,_f,enableNativeErrorTracking,sessionId,defaultThrottleDelayMs,_ref9,_ref9$maskAllTextInpu,maskAllTextInputs,_ref9$maskAllImages,maskAllImages,_ref9$maskAllSandboxe,maskAllSandboxedViews,_ref9$captureLog,localCaptureLog,_ref9$captureNetworkT,localCaptureNetworkTelemetry,_ref9$screenshotModeB,screenshotModeBackgroundCapture,localSampleRate,_ref9$iOSdebouncerDel,iOSdebouncerDelayMs,_ref9$androidDebounce,androidDebouncerDelayMs,throttleDelayMs,remoteConsoleLogEnabled,remoteNetworkTimingEnabled,remoteSampleRateRaw,captureLog,captureNetworkTelemetry,localSampleRateValid,remoteSampleRateValid,sampleRate,source,sdkReplayConfig,sessionReplay,cachedSessionReplayConfig,sdkOptions,loggableSdkOptions,wasSessionReplayEnabled,pluginConfig,_args12=arguments,_t4,_t5;return _regenerator["default"].wrap(function(_context12){while(1)switch(_context12.prev=_context12.next){case 0:enableSessionReplay=_args12.length>2&&_args12[2]!==undefined?_args12[2]:this._isEnableSessionReplay();enableNativeErrorTracking=this._isAutocaptureNativeErrors(options);if(!(!enableSessionReplay&&!enableNativeErrorTracking)){_context12.next=1;break;}return _context12.abrupt("return",true);case 1:if(_OptionalPlugin.OptionalReactNativePlugin){_context12.next=2;break;}this._logger.warn(enableSessionReplay?'Session replay enabled but not installed.':'Native error tracking enabled but not installed.');return _context12.abrupt("return",false);case 2:if(!((!enableSessionReplay||this._sessionReplayNativeInitialized)&&(!enableNativeErrorTracking||this._nativeErrorTrackingInitialized))){_context12.next=3;break;}return _context12.abrupt("return",true);case 3:if(!(this._isNativePluginInitialized()&&enableSessionReplay&&!this._sessionReplayNativeInitialized)){_context12.next=5;break;}this._sessionReplayNativeInitialized=true;_context12.next=4;return(_a=_OptionalPlugin.OptionalReactNativePlugin.startRecording)===null||_a===void 0?void 0:_a.call(_OptionalPlugin.OptionalReactNativePlugin,true);case 4:return _context12.abrupt("return",true);case 5:sessionId=this.getSessionId();if(!(sessionId.length===0)){_context12.next=6;break;}this._logger.warn("Native Txlemetry plugin enabled but no sessionId found.");return _context12.abrupt("return",false);case 6:defaultThrottleDelayMs=1000;_ref9=(_b=options===null||options===void 0?void 0:options.sessionReplayConfig)!==null&&_b!==void 0?_b:{},_ref9$maskAllTextInpu=_ref9.maskAllTextInputs,maskAllTextInputs=_ref9$maskAllTextInpu===void 0?true:_ref9$maskAllTextInpu,_ref9$maskAllImages=_ref9.maskAllImages,maskAllImages=_ref9$maskAllImages===void 0?true:_ref9$maskAllImages,_ref9$maskAllSandboxe=_ref9.maskAllSandboxedViews,maskAllSandboxedViews=_ref9$maskAllSandboxe===void 0?true:_ref9$maskAllSandboxe,_ref9$captureLog=_ref9.captureLog,localCaptureLog=_ref9$captureLog===void 0?true:_ref9$captureLog,_ref9$captureNetworkT=_ref9.captureNetworkTelemetry,localCaptureNetworkTelemetry=_ref9$captureNetworkT===void 0?true:_ref9$captureNetworkT,_ref9$screenshotModeB=_ref9.screenshotModeBackgroundCapture,screenshotModeBackgroundCapture=_ref9$screenshotModeB===void 0?false:_ref9$screenshotModeB,localSampleRate=_ref9.sampleRate,_ref9$iOSdebouncerDel=_ref9.iOSdebouncerDelayMs,iOSdebouncerDelayMs=_ref9$iOSdebouncerDel===void 0?defaultThrottleDelayMs:_ref9$iOSdebouncerDel,_ref9$androidDebounce=_ref9.androidDebouncerDelayMs,androidDebouncerDelayMs=_ref9$androidDebounce===void 0?defaultThrottleDelayMs:_ref9$androidDebounce;throttleDelayMs=(_d=(_c=options===null||options===void 0?void 0:options.sessionReplayConfig)===null||_c===void 0?void 0:_c.throttleDelayMs)!==null&&_d!==void 0?_d:defaultThrottleDelayMs;if(throttleDelayMs===defaultThrottleDelayMs&&(iOSdebouncerDelayMs!==defaultThrottleDelayMs||androidDebouncerDelayMs!==defaultThrottleDelayMs)){throttleDelayMs=Math.max(iOSdebouncerDelayMs,androidDebouncerDelayMs);}remoteConsoleLogEnabled=(0,_utils.getRemoteConfigBool)(cachedRemoteConfig===null||cachedRemoteConfig===void 0?void 0:cachedRemoteConfig.sessionRecording,'consoleLogRecordingEnabled',true);remoteNetworkTimingEnabled=(0,_utils.getRemoteConfigBool)(cachedRemoteConfig===null||cachedRemoteConfig===void 0?void 0:cachedRemoteConfig.capturePerformance,'network_timing',true);remoteSampleRateRaw=(0,_utils.getRemoteConfigNumber)(cachedRemoteConfig===null||cachedRemoteConfig===void 0?void 0:cachedRemoteConfig.sessionRecording,'sampleRate');captureLog=localCaptureLog&&remoteConsoleLogEnabled;captureNetworkTelemetry=localCaptureNetworkTelemetry&&remoteNetworkTimingEnabled;localSampleRateValid=localSampleRate===undefined?undefined:(0,_utils.isValidSampleRate)(localSampleRate)?localSampleRate:undefined;remoteSampleRateValid=remoteSampleRateRaw===undefined?undefined:(0,_utils.isValidSampleRate)(remoteSampleRateRaw)?remoteSampleRateRaw:undefined;sampleRate=localSampleRateValid!==null&&localSampleRateValid!==void 0?localSampleRateValid:remoteSampleRateValid;if(localCaptureLog&&!remoteConsoleLogEnabled){this._logger.info('captureLog disabled by remote config (consoleLogRecordingEnabled=false).');}if(localCaptureNetworkTelemetry&&!remoteNetworkTimingEnabled){this._logger.info('captureNetworkTelemetry disabled by remote config (capturePerformance.network_timing=false).');}if(localSampleRate!==undefined&&localSampleRateValid===undefined){this._logger.warn("Ignoring invalid sessionReplayConfig.sampleRate '".concat(localSampleRate,"'. Expected a number between 0 and 1."));}if(remoteSampleRateRaw!==undefined&&remoteSampleRateValid===undefined){this._logger.warn("Ignoring invalid remote config sessionRecording.sampleRate '".concat(remoteSampleRateRaw,"'. Expected a number between 0 and 1."));}if(typeof sampleRate==='number'){source=localSampleRateValid!==undefined?'local config':'remote config';this._logger.info("sampleRate set from ".concat(source," (").concat(sampleRate,")."));}sdkReplayConfig={maskAllTextInputs:maskAllTextInputs,maskAllImages:maskAllImages,maskAllSandboxedViews:maskAllSandboxedViews,captureLog:captureLog,captureNetworkTelemetry:captureNetworkTelemetry,screenshotModeBackgroundCapture:screenshotModeBackgroundCapture,sampleRate:sampleRate,iOSdebouncerDelayMs:iOSdebouncerDelayMs,androidDebouncerDelayMs:androidDebouncerDelayMs,throttleDelayMs:throttleDelayMs};this._logger.info("Native Txlemetry plugin replay config: ".concat(JSON.stringify(sdkReplayConfig)));sessionReplay=(_e=this.getPersistedProperty(_core.TxlemetryPersistedProperty.SessionReplay))!==null&&_e!==void 0?_e:{};cachedSessionReplayConfig=(_f=sessionReplay)!==null&&_f!==void 0?_f:{};this._logger.info("Session replay session recording from flags cached config: ".concat(JSON.stringify(cachedSessionReplayConfig)));sdkOptions={apiKey:this.apiKey,host:this.host,debug:this.isDebug,distinctId:this.getDistinctId(),anonymousId:this.getAnonymousId(),sdkVersion:this.getLibraryVersion(),flushAt:this.flushAt,requestHeaders:this._requestHeaders};loggableSdkOptions=_objectSpread(_objectSpread({},sdkOptions),{},{requestHeaders:Object.keys(this._requestHeaders)});this._logger.info("Native Txlemetry plugin sdk options: ".concat(JSON.stringify(loggableSdkOptions)));_context12.prev=7;if(!enableSessionReplay){_context12.next=9;break;}_context12.next=8;return _OptionalPlugin.OptionalReactNativePlugin.isEnabled()["catch"](function(){return false;});case 8:_t4=_context12.sent;_context12.next=10;break;case 9:_t4=false;case 10:wasSessionReplayEnabled=_t4;if(!_OptionalPlugin.OptionalReactNativePlugin.setup){_context12.next=12;break;}pluginConfig={sessionReplay:{enabled:enableSessionReplay,sdkReplayConfig:sdkReplayConfig,decideReplayConfig:cachedSessionReplayConfig},errorTracking:{nativeAutocapture:enableNativeErrorTracking,exceptionSteps:this._errorTracking.getNativePluginExceptionStepsConfig()}};_context12.next=11;return _OptionalPlugin.OptionalReactNativePlugin.setup(String(sessionId),sdkOptions,pluginConfig);case 11:if(wasSessionReplayEnabled){this._resetSessionId(_OptionalPlugin.OptionalReactNativePlugin,String(sessionId));}_context12.next=17;break;case 12:if(enableNativeErrorTracking){this._logger.warn('Native error tracking is not available. Please update @txlemetry/react-native-plugin or txlemetry-react-native-session-replay.');enableNativeErrorTracking=false;}if(enableSessionReplay){_context12.next=13;break;}return _context12.abrupt("return",false);case 13:_context12.next=14;return _OptionalPlugin.OptionalReactNativePlugin.isEnabled();case 14:if(_context12.sent){_context12.next=16;break;}_context12.next=15;return _OptionalPlugin.OptionalReactNativePlugin.start(String(sessionId),sdkOptions,sdkReplayConfig,cachedSessionReplayConfig);case 15:_context12.next=17;break;case 16:this._resetSessionId(_OptionalPlugin.OptionalReactNativePlugin,String(sessionId));case 17:this._currentSessionId=sessionId;if(enableSessionReplay){this._sessionReplayNativeInitialized=true;this._logger.info("Session replay started with sessionId ".concat(sessionId,"."));}if(enableNativeErrorTracking){this._nativeErrorTrackingInitialized=true;this._errorTracking.onNativeErrorTrackingReady();this._logger.info('Native error tracking started.');}return _context12.abrupt("return",true);case 18:_context12.prev=18;_t5=_context12["catch"](7);this._logger.error("Native Txlemetry plugin failed to start: ".concat(_t5,"."));return _context12.abrupt("return",false);case 19:case"end":return _context12.stop();}},_callee12,this,[[7,18]]);}));function initializeNativePlugin(_x1,_x10){return _initializeNativePlugin.apply(this,arguments);}return initializeNativePlugin;}()},{key:"startSessionReplay",value:function(){var _startSessionReplay=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee13(options,cachedRemoteConfig){return _regenerator["default"].wrap(function(_context13){while(1)switch(_context13.prev=_context13.next){case 0:this._enableSessionReplay=options===null||options===void 0?void 0:options.enableSessionReplay;this._sessionReplayOptions=options;_context13.next=1;return this._evaluateAndStartSessionReplay(cachedRemoteConfig);case 1:case"end":return _context13.stop();}},_callee13,this);}));function startSessionReplay(_x11,_x12){return _startSessionReplay.apply(this,arguments);}return startSessionReplay;}()},{key:"_evaluateAndStartSessionReplay",value:function _evaluateAndStartSessionReplay(cachedRemoteConfig){var _this5=this;this._sessionReplayEvalChain=this._sessionReplayEvalChain["catch"](function(){}).then(function(){return _this5._evaluateAndStartSessionReplayInternal(cachedRemoteConfig);});return this._sessionReplayEvalChain;}},{key:"_evaluateAndStartSessionReplayInternal",value:function(){var _evaluateAndStartSessionReplayInternal2=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee14(cachedRemoteConfig){var _a,_b,_c,_d,options,enableNativeErrorTracking,remoteConfig,sessionReplay,featureFlags,cachedFeatureFlags,cachedSessionReplayConfig,recordingActive,linkedFlag,value,flag,variant,_value,eventTriggers,activated,_t6;return _regenerator["default"].wrap(function(_context14){while(1)switch(_context14.prev=_context14.next){case 0:options=this._sessionReplayOptions;enableNativeErrorTracking=this._isAutocaptureNativeErrors(options);remoteConfig=cachedRemoteConfig!==null&&cachedRemoteConfig!==void 0?cachedRemoteConfig:this.getPersistedProperty(_core.TxlemetryPersistedProperty.RemoteConfig);if(this._isEnableSessionReplay()){_context14.next=2;break;}this._logger.info('Session replay is not enabled.');this._sessionReplayEventTriggers=[];if(!enableNativeErrorTracking){_context14.next=1;break;}_context14.next=1;return this.initializeNativePlugin(options,remoteConfig,false);case 1:return _context14.abrupt("return");case 2:sessionReplay=(_a=this.getPersistedProperty(_core.TxlemetryPersistedProperty.SessionReplay))!==null&&_a!==void 0?_a:{};featureFlags=(_b=this.getKnownFeatureFlags())!==null&&_b!==void 0?_b:{};cachedFeatureFlags=(_c=featureFlags)!==null&&_c!==void 0?_c:{};cachedSessionReplayConfig=(_d=sessionReplay)!==null&&_d!==void 0?_d:{};this._logger.info('Session replay feature flags from flags cached config:',JSON.stringify(cachedFeatureFlags));recordingActive=true;linkedFlag=cachedSessionReplayConfig['linkedFlag'];if(typeof linkedFlag==='string'){value=cachedFeatureFlags[linkedFlag];if(typeof value==='boolean'){recordingActive=value;}else if(typeof value==='string'){recordingActive=true;}else{recordingActive=false;}this._logger.info("Session replay '".concat(linkedFlag,"' linked flag value: '").concat(value,"'"));}else if(linkedFlag&&(0,_typeof2["default"])(linkedFlag)==='object'){flag=linkedFlag['flag'];variant=linkedFlag['variant'];if(flag&&variant){_value=cachedFeatureFlags[flag];recordingActive=_value===variant;this._logger.info("Session replay '".concat(flag,"' linked flag variant '").concat(variant,"' and value '").concat(_value,"'"));}else{this._logger.info("Session replay '".concat(flag,"' linked flag variant: '").concat(variant,"' does not exist/quota limited."));recordingActive=false;}}else{this._logger.info("Session replay has no cached linkedFlag.");}eventTriggers=this._parseEventTriggers(cachedSessionReplayConfig['eventTriggers']);this._sessionReplayEventTriggers=eventTriggers;if(eventTriggers.length>0){activated=this._isEventTriggerActivatedForSession(_superPropGet(Txlemetry,"getSessionId",this,3)([]));if(!activated){recordingActive=false;}this._logger.info("Session replay event triggers configured (".concat(eventTriggers.length,"); activated: ").concat(activated,"."));}if(!recordingActive){_context14.next=8;break;}if(!(this._sessionReplayRecordingActive===true)){_context14.next=3;break;}return _context14.abrupt("return");case 3:if(!this._sessionReplayNativeInitialized){_context14.next=5;break;}_context14.next=4;return this._startSessionRecording(true);case 4:_t6=_context14.sent;_context14.next=7;break;case 5:_context14.next=6;return this.initializeNativePlugin(options,remoteConfig,true);case 6:_t6=_context14.sent;case 7:this._sessionReplayRecordingActive=_t6;_context14.next=12;break;case 8:this._logger.info('Session replay disabled.');if(!(this._sessionReplayRecordingActive===true)){_context14.next=10;break;}_context14.next=9;return this._stopSessionRecording();case 9:this._sessionReplayRecordingActive=!_context14.sent;_context14.next=11;break;case 10:this._sessionReplayRecordingActive=false;case 11:if(!enableNativeErrorTracking){_context14.next=12;break;}_context14.next=12;return this.initializeNativePlugin(options,remoteConfig,false);case 12:case"end":return _context14.stop();}},_callee14,this);}));function _evaluateAndStartSessionReplayInternal(_x13){return _evaluateAndStartSessionReplayInternal2.apply(this,arguments);}return _evaluateAndStartSessionReplayInternal;}()},{key:"processBeforeEnqueue",value:function processBeforeEnqueue(message){var processed=_superPropGet(Txlemetry,"processBeforeEnqueue",this,3)([message]);try{this._maybeActivateEventTrigger(processed===null||processed===void 0?void 0:processed['event']);}catch(e){this._logger.error("Session replay event trigger check failed: ".concat(e,"."));}return processed;}},{key:"_maybeActivateEventTrigger",value:function _maybeActivateEventTrigger(eventName){if(this._sessionReplayEventTriggers.length===0||typeof eventName!=='string'){return;}if(!this._sessionReplayEventTriggers.includes(eventName)){return;}var sessionId=_superPropGet(Txlemetry,"getSessionId",this,3)([]);if(!sessionId){return;}if(this._isEventTriggerActivatedForSession(sessionId)&&this._sessionReplayRecordingActive===true){return;}if(!this._isEventTriggerActivatedForSession(sessionId)){this.setPersistedProperty(_core.TxlemetryPersistedProperty.SessionReplayEventTriggerActivatedSession,sessionId);this._logger.info("Session replay event trigger '".concat(eventName,"' activated for session ").concat(sessionId,"."));}void this._evaluateAndStartSessionReplay();}},{key:"_parseEventTriggers",value:function _parseEventTriggers(value){if(!Array.isArray(value)){return[];}return value.filter(function(entry){return typeof entry==='string';});}},{key:"_isEventTriggerActivatedForSession",value:function _isEventTriggerActivatedForSession(sessionId){return this.getPersistedProperty(_core.TxlemetryPersistedProperty.SessionReplayEventTriggerActivatedSession)===sessionId;}},{key:"captureAppLifecycleEvents",value:function(){var _captureAppLifecycleEvents=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee15(){var _this6=this;var _a,appBuild,appVersion,isMemoryPersistence,properties,prevAppBuild,prevAppVersion,initialUrl,_t7,_t8,_t9;return _regenerator["default"].wrap(function(_context15){while(1)switch(_context15.prev=_context15.next){case 0:appBuild=this._appProperties.$app_build;appVersion=this._appProperties.$app_version;isMemoryPersistence=this._persistence==='memory';properties={};if(!isMemoryPersistence){prevAppBuild=this.getPersistedProperty(_core.TxlemetryPersistedProperty.InstalledAppBuild);prevAppVersion=this.getPersistedProperty(_core.TxlemetryPersistedProperty.InstalledAppVersion);if(!appBuild||!appVersion){this._logger.warn('Txlemetry could not track installation/update/open, as the build and version were not set. '+'This can happen if some dependencies are not installed correctly, or if you have provided'+'customAppProperties but not included $app_build or $app_version.');}if(appBuild){if(!prevAppBuild){this.capture('Application Installed',properties);}else if(prevAppBuild!==appBuild){this.capture('Application Updated',_objectSpread(_objectSpread(_objectSpread({},(0,_core.maybeAdd)('previous_version',prevAppVersion)),(0,_core.maybeAdd)('previous_build',prevAppBuild)),properties));}}}else{this._logger.warn('Txlemetry was initialised with persistence set to "memory", capturing native app events (Application Installed and Application Updated) is not supported.');}_context15.next=1;return _reactNative.Linking.getInitialURL();case 1:_t8=_a=_context15.sent;_t7=_t8!==null;if(!_t7){_context15.next=2;break;}_t7=_a!==void 0;case 2:if(!_t7){_context15.next=3;break;}_t9=_a;_context15.next=4;break;case 3:_t9=undefined;case 4:initialUrl=_t9;this.capture('Application Opened',_objectSpread(_objectSpread({},properties),(0,_core.maybeAdd)('url',initialUrl)));_reactNative.AppState.addEventListener('change',function(state){if(state==='active'){_this6.capture('Application Became Active');}else if(state==='background'){_this6.capture('Application Backgrounded');}});case 5:case"end":return _context15.stop();}},_callee15,this);}));function captureAppLifecycleEvents(){return _captureAppLifecycleEvents.apply(this,arguments);}return captureAppLifecycleEvents;}()},{key:"persistAppVersion",value:function(){var _persistAppVersion=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee16(){var appBuild,appVersion;return _regenerator["default"].wrap(function(_context16){while(1)switch(_context16.prev=_context16.next){case 0:appBuild=this._appProperties.$app_build;appVersion=this._appProperties.$app_version;this.setPersistedProperty(_core.TxlemetryPersistedProperty.InstalledAppBuild,appBuild);this.setPersistedProperty(_core.TxlemetryPersistedProperty.InstalledAppVersion,appVersion);case 1:case"end":return _context16.stop();}},_callee16,this);}));function persistAppVersion(){return _persistAppVersion.apply(this,arguments);}return persistAppVersion;}()}]);}(_core.TxlemetryCore);
|
package/dist/types.d.ts
CHANGED
|
@@ -1,205 +1,205 @@
|
|
|
1
|
-
export type
|
|
2
|
-
routeToName?: (name: string, params: any) => string;
|
|
3
|
-
routeToProperties?: (name: string, params: any) => Record<string, any>;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated
|
|
7
|
-
*/
|
|
8
|
-
export type
|
|
9
|
-
getCurrentRoute(): any | undefined;
|
|
10
|
-
isReady: () => boolean;
|
|
11
|
-
current?:
|
|
12
|
-
};
|
|
13
|
-
export type
|
|
14
|
-
/**
|
|
15
|
-
* Enable autocapture of touch events
|
|
16
|
-
*
|
|
17
|
-
* @default false
|
|
18
|
-
*/
|
|
19
|
-
captureTouches?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Custom prop name used to label elements for autocapture
|
|
22
|
-
*
|
|
23
|
-
* @default 'ph-label'
|
|
24
|
-
*/
|
|
25
|
-
customLabelProp?: string;
|
|
26
|
-
/**
|
|
27
|
-
* Prop name used to prevent autocapture on an element and its children
|
|
28
|
-
*
|
|
29
|
-
* @default 'ph-no-capture'
|
|
30
|
-
*/
|
|
31
|
-
noCaptureProp?: string;
|
|
32
|
-
/**
|
|
33
|
-
* Maximum number of elements to capture in the component tree hierarchy
|
|
34
|
-
*
|
|
35
|
-
* @default 20
|
|
36
|
-
*/
|
|
37
|
-
maxElementsCaptured?: number;
|
|
38
|
-
/**
|
|
39
|
-
* List of element labels to ignore during autocapture
|
|
40
|
-
*
|
|
41
|
-
* @default []
|
|
42
|
-
*/
|
|
43
|
-
ignoreLabels?: string[];
|
|
44
|
-
/**
|
|
45
|
-
* List of prop names to capture from elements
|
|
46
|
-
*
|
|
47
|
-
* @default ['style', 'testID', 'accessibilityLabel', 'ph-label', 'children']
|
|
48
|
-
*/
|
|
49
|
-
propsToCapture?: string[];
|
|
50
|
-
/**
|
|
51
|
-
* Capture the screen name (or route name) and properties
|
|
52
|
-
*
|
|
53
|
-
* Only used for expo-router, @react-navigation/native and react-native-navigation
|
|
54
|
-
*
|
|
55
|
-
* For react-native-navigation, you need to call initReactNativeNavigation before using this option
|
|
56
|
-
* See example: https://
|
|
57
|
-
*
|
|
58
|
-
* For @react-navigation/native v6 and below, you need to wrap the
|
|
59
|
-
* See example: https://
|
|
60
|
-
*
|
|
61
|
-
* For @react-navigation/native v7 and above, because of a library change, you'll need to capture the screens manually and disable this option
|
|
62
|
-
* You can use the onStateChange callback from the NavigationContainer to capture the screens automatically using the screen capture method
|
|
63
|
-
* You can use the '
|
|
64
|
-
* Since captureScreens is disabled, you don't need to pass the navigationRef, the navigation mutation object is also ignored
|
|
65
|
-
* See example: https://reactnavigation.org/docs/screen-tracking/ and https://
|
|
66
|
-
*
|
|
67
|
-
* For expo-router, expo-router uses @react-navigation/native, but does not expose the NavigationContainer, you'll need to capture the screens manually and disable this option
|
|
68
|
-
* expo-router always has access to a URL, you can use the URL to capture the screens automatically using the screen capture method
|
|
69
|
-
* You can use the '
|
|
70
|
-
* Since captureScreens is disabled, you don't need to pass the navigationRef, the navigation mutation object is also ignored
|
|
71
|
-
* See example: https://docs.expo.dev/router/reference/screen-tracking/ and https://
|
|
72
|
-
*
|
|
73
|
-
* @default true
|
|
74
|
-
*/
|
|
75
|
-
captureScreens?: boolean;
|
|
76
|
-
/**
|
|
77
|
-
* Used for mutating the screen name and properties
|
|
78
|
-
* Only used if captureScreens is true
|
|
79
|
-
*
|
|
80
|
-
* @default Default to the route name and params
|
|
81
|
-
*/
|
|
82
|
-
navigation?:
|
|
83
|
-
/**
|
|
84
|
-
* If you create a navigation ref with createNavigationContainerRef, you need to pass the navigation ref
|
|
85
|
-
* Only used for expo-router and @react-navigation/native if captureScreens is true
|
|
86
|
-
*
|
|
87
|
-
* @deprecated this is deprecated since it didn't work as expected, check out the `captureScreens` comments for capturing screen views semi-automatically
|
|
88
|
-
*/
|
|
89
|
-
navigationRef?:
|
|
90
|
-
};
|
|
91
|
-
export interface
|
|
92
|
-
/** Build number like "1.2.2" or "122" */
|
|
93
|
-
$app_build?: string | null;
|
|
94
|
-
/** Name of the app as displayed below the icon like "
|
|
95
|
-
$app_name?: string | null;
|
|
96
|
-
/** Namespace of the app usually like "com.
|
|
97
|
-
$app_namespace?: string | null;
|
|
98
|
-
/** Human friendly app version like what a user would see in the app store like "1.2.2" */
|
|
99
|
-
$app_version?: string | null;
|
|
100
|
-
/** Manufacturer like "Apple", "Samsung" or "Android" */
|
|
101
|
-
$device_manufacturer?: string | null;
|
|
102
|
-
/** Readable model name like "iPhone 12" or "Samsung Galaxy S24" */
|
|
103
|
-
$device_name?: string | null;
|
|
104
|
-
/** Model identifier like "iPhone13,2" or "SM-S921B" */
|
|
105
|
-
$device_model?: string | null;
|
|
106
|
-
/** Device type ("Mobile" | "Desktop") */
|
|
107
|
-
$device_type?: string | null;
|
|
108
|
-
/** Operating system name like iOS or Android */
|
|
109
|
-
$os_name?: string | null;
|
|
110
|
-
/** Operating system version "14.0" */
|
|
111
|
-
$os_version?: string | null;
|
|
112
|
-
/** Locale (language) of the device like "en-US" */
|
|
113
|
-
$locale?: string | null;
|
|
114
|
-
/** Timezone of the device like "Europe/Berlin" */
|
|
115
|
-
$timezone?: string | null;
|
|
116
|
-
/** Whether the app is running on an emulator/simulator */
|
|
117
|
-
$is_emulator?: boolean | null;
|
|
118
|
-
}
|
|
119
|
-
export type
|
|
120
|
-
/**
|
|
121
|
-
* Enable masking of all text and text input fields
|
|
122
|
-
*
|
|
123
|
-
* @default true
|
|
124
|
-
*/
|
|
125
|
-
maskAllTextInputs?: boolean;
|
|
126
|
-
/**
|
|
127
|
-
* Enable masking of all images to a placeholder
|
|
128
|
-
*
|
|
129
|
-
* @default true
|
|
130
|
-
*/
|
|
131
|
-
maskAllImages?: boolean;
|
|
132
|
-
/**
|
|
133
|
-
* Enable masking of all sandboxed system views
|
|
134
|
-
* These may include UIImagePickerController, PHPickerViewController and CNContactPickerViewController
|
|
135
|
-
* iOS only
|
|
136
|
-
*
|
|
137
|
-
* @default true
|
|
138
|
-
*/
|
|
139
|
-
maskAllSandboxedViews?: boolean;
|
|
140
|
-
/**
|
|
141
|
-
* Enable capturing of logs as console events
|
|
142
|
-
*
|
|
143
|
-
* @default true
|
|
144
|
-
*/
|
|
145
|
-
captureLog?: boolean;
|
|
146
|
-
/**
|
|
147
|
-
* Deboucer delay used to reduce the number of snapshots captured and reduce performance impact
|
|
148
|
-
* This is used for capturing the view as a screenshot
|
|
149
|
-
* The lower the number more snapshots will be captured but higher the performance impact
|
|
150
|
-
*
|
|
151
|
-
* @default 1000
|
|
152
|
-
* @deprecated please use throttleDelayMs instead
|
|
153
|
-
*/
|
|
154
|
-
iOSdebouncerDelayMs?: number;
|
|
155
|
-
/**
|
|
156
|
-
* Deboucer delay used to reduce the number of snapshots captured and reduce performance impact
|
|
157
|
-
* This is used for capturing the view as a screenshot
|
|
158
|
-
* The lower the number more snapshots will be captured but higher the performance impact
|
|
159
|
-
* Ps: it was 500ms (0.5s) by default until version 3.3.7
|
|
160
|
-
*
|
|
161
|
-
* @default 1000
|
|
162
|
-
* @deprecated please use throttleDelayMs instead
|
|
163
|
-
*/
|
|
164
|
-
androidDebouncerDelayMs?: number;
|
|
165
|
-
/**
|
|
166
|
-
* Throttling delay used to reduce the number of snapshots captured and reduce performance impact
|
|
167
|
-
* This is used for capturing the view as a wireframe or screenshot
|
|
168
|
-
* The lower the number more snapshots will be captured but higher the performance impact
|
|
169
|
-
*
|
|
170
|
-
* This value has precedence over iOSdebouncerDelayMs and androidDebouncerDelayMs
|
|
171
|
-
* If this is not set, we will take the max number between iOSdebouncerDelayMs and androidDebouncerDelayMs for back compatibility
|
|
172
|
-
*
|
|
173
|
-
* @default 1000
|
|
174
|
-
*/
|
|
175
|
-
throttleDelayMs?: number;
|
|
176
|
-
/**
|
|
177
|
-
* Enable capturing network telemetry
|
|
178
|
-
* iOS only
|
|
179
|
-
*
|
|
180
|
-
* @default true
|
|
181
|
-
*/
|
|
182
|
-
captureNetworkTelemetry?: boolean;
|
|
183
|
-
/**
|
|
184
|
-
* Schedule screenshot image capture on a background queue.
|
|
185
|
-
* iOS only
|
|
186
|
-
* Experimental support
|
|
187
|
-
*
|
|
188
|
-
* Warning: Enabling this option will trigger Main Thread Checker warnings and may
|
|
189
|
-
* briefly freeze the app the first time a screenshot is captured. Consider disabling
|
|
190
|
-
* Main Thread Checker in your scheme's run diagnostics when enabling this.
|
|
191
|
-
*
|
|
192
|
-
* @default false
|
|
193
|
-
*/
|
|
194
|
-
screenshotModeBackgroundCapture?: boolean;
|
|
195
|
-
/**
|
|
196
|
-
* Session replay sample rate between 0 and 1
|
|
197
|
-
* Local config has precedence over remote config when both are set.
|
|
198
|
-
* If undefined, sampling is controlled by remote config (when available).
|
|
199
|
-
*/
|
|
200
|
-
sampleRate?: number;
|
|
201
|
-
};
|
|
202
|
-
export interface
|
|
203
|
-
getItem: (key: string) => string | null | Promise<string | null>;
|
|
204
|
-
setItem: (key: string, value: string) => void | Promise<void>;
|
|
205
|
-
}
|
|
1
|
+
export type TxlemetryAutocaptureNavigationTrackerOptions = {
|
|
2
|
+
routeToName?: (name: string, params: any) => string;
|
|
3
|
+
routeToProperties?: (name: string, params: any) => Record<string, any>;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated
|
|
7
|
+
*/
|
|
8
|
+
export type TxlemetryNavigationRef = {
|
|
9
|
+
getCurrentRoute(): any | undefined;
|
|
10
|
+
isReady: () => boolean;
|
|
11
|
+
current?: TxlemetryNavigationRef | any | undefined;
|
|
12
|
+
};
|
|
13
|
+
export type TxlemetryAutocaptureOptions = {
|
|
14
|
+
/**
|
|
15
|
+
* Enable autocapture of touch events
|
|
16
|
+
*
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
captureTouches?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Custom prop name used to label elements for autocapture
|
|
22
|
+
*
|
|
23
|
+
* @default 'ph-label'
|
|
24
|
+
*/
|
|
25
|
+
customLabelProp?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Prop name used to prevent autocapture on an element and its children
|
|
28
|
+
*
|
|
29
|
+
* @default 'ph-no-capture'
|
|
30
|
+
*/
|
|
31
|
+
noCaptureProp?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Maximum number of elements to capture in the component tree hierarchy
|
|
34
|
+
*
|
|
35
|
+
* @default 20
|
|
36
|
+
*/
|
|
37
|
+
maxElementsCaptured?: number;
|
|
38
|
+
/**
|
|
39
|
+
* List of element labels to ignore during autocapture
|
|
40
|
+
*
|
|
41
|
+
* @default []
|
|
42
|
+
*/
|
|
43
|
+
ignoreLabels?: string[];
|
|
44
|
+
/**
|
|
45
|
+
* List of prop names to capture from elements
|
|
46
|
+
*
|
|
47
|
+
* @default ['style', 'testID', 'accessibilityLabel', 'ph-label', 'children']
|
|
48
|
+
*/
|
|
49
|
+
propsToCapture?: string[];
|
|
50
|
+
/**
|
|
51
|
+
* Capture the screen name (or route name) and properties
|
|
52
|
+
*
|
|
53
|
+
* Only used for expo-router, @react-navigation/native and react-native-navigation
|
|
54
|
+
*
|
|
55
|
+
* For react-native-navigation, you need to call initReactNativeNavigation before using this option
|
|
56
|
+
* See example: https://txlemetry.com/docs/libraries/react-native#with-react-native-navigation-and-autocapture
|
|
57
|
+
*
|
|
58
|
+
* For @react-navigation/native v6 and below, you need to wrap the TxlemetryProvider within the NavigationContainer
|
|
59
|
+
* See example: https://txlemetry.com/docs/libraries/react-native#with-react-navigationnative-and-autocapture
|
|
60
|
+
*
|
|
61
|
+
* For @react-navigation/native v7 and above, because of a library change, you'll need to capture the screens manually and disable this option
|
|
62
|
+
* You can use the onStateChange callback from the NavigationContainer to capture the screens automatically using the screen capture method
|
|
63
|
+
* You can use the 'useTxlemetry()' hook or your own txlemetry instance to capture the screens
|
|
64
|
+
* Since captureScreens is disabled, you don't need to pass the navigationRef, the navigation mutation object is also ignored
|
|
65
|
+
* See example: https://reactnavigation.org/docs/screen-tracking/ and https://txlemetry.com/docs/libraries/react-native#manually-capturing-screen-capture-events
|
|
66
|
+
*
|
|
67
|
+
* For expo-router, expo-router uses @react-navigation/native, but does not expose the NavigationContainer, you'll need to capture the screens manually and disable this option
|
|
68
|
+
* expo-router always has access to a URL, you can use the URL to capture the screens automatically using the screen capture method
|
|
69
|
+
* You can use the 'useTxlemetry()' hook or your own txlemetry instance to capture the screens
|
|
70
|
+
* Since captureScreens is disabled, you don't need to pass the navigationRef, the navigation mutation object is also ignored
|
|
71
|
+
* See example: https://docs.expo.dev/router/reference/screen-tracking/ and https://txlemetry.com/docs/libraries/react-native#manually-capturing-screen-capture-events
|
|
72
|
+
*
|
|
73
|
+
* @default true
|
|
74
|
+
*/
|
|
75
|
+
captureScreens?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Used for mutating the screen name and properties
|
|
78
|
+
* Only used if captureScreens is true
|
|
79
|
+
*
|
|
80
|
+
* @default Default to the route name and params
|
|
81
|
+
*/
|
|
82
|
+
navigation?: TxlemetryAutocaptureNavigationTrackerOptions;
|
|
83
|
+
/**
|
|
84
|
+
* If you create a navigation ref with createNavigationContainerRef, you need to pass the navigation ref
|
|
85
|
+
* Only used for expo-router and @react-navigation/native if captureScreens is true
|
|
86
|
+
*
|
|
87
|
+
* @deprecated this is deprecated since it didn't work as expected, check out the `captureScreens` comments for capturing screen views semi-automatically
|
|
88
|
+
*/
|
|
89
|
+
navigationRef?: TxlemetryNavigationRef;
|
|
90
|
+
};
|
|
91
|
+
export interface TxlemetryCustomAppProperties {
|
|
92
|
+
/** Build number like "1.2.2" or "122" */
|
|
93
|
+
$app_build?: string | null;
|
|
94
|
+
/** Name of the app as displayed below the icon like "Txlemetry" */
|
|
95
|
+
$app_name?: string | null;
|
|
96
|
+
/** Namespace of the app usually like "com.txlemetry.app" */
|
|
97
|
+
$app_namespace?: string | null;
|
|
98
|
+
/** Human friendly app version like what a user would see in the app store like "1.2.2" */
|
|
99
|
+
$app_version?: string | null;
|
|
100
|
+
/** Manufacturer like "Apple", "Samsung" or "Android" */
|
|
101
|
+
$device_manufacturer?: string | null;
|
|
102
|
+
/** Readable model name like "iPhone 12" or "Samsung Galaxy S24" */
|
|
103
|
+
$device_name?: string | null;
|
|
104
|
+
/** Model identifier like "iPhone13,2" or "SM-S921B" */
|
|
105
|
+
$device_model?: string | null;
|
|
106
|
+
/** Device type ("Mobile" | "Desktop") */
|
|
107
|
+
$device_type?: string | null;
|
|
108
|
+
/** Operating system name like iOS or Android */
|
|
109
|
+
$os_name?: string | null;
|
|
110
|
+
/** Operating system version "14.0" */
|
|
111
|
+
$os_version?: string | null;
|
|
112
|
+
/** Locale (language) of the device like "en-US" */
|
|
113
|
+
$locale?: string | null;
|
|
114
|
+
/** Timezone of the device like "Europe/Berlin" */
|
|
115
|
+
$timezone?: string | null;
|
|
116
|
+
/** Whether the app is running on an emulator/simulator */
|
|
117
|
+
$is_emulator?: boolean | null;
|
|
118
|
+
}
|
|
119
|
+
export type TxlemetrySessionReplayConfig = {
|
|
120
|
+
/**
|
|
121
|
+
* Enable masking of all text and text input fields
|
|
122
|
+
*
|
|
123
|
+
* @default true
|
|
124
|
+
*/
|
|
125
|
+
maskAllTextInputs?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Enable masking of all images to a placeholder
|
|
128
|
+
*
|
|
129
|
+
* @default true
|
|
130
|
+
*/
|
|
131
|
+
maskAllImages?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Enable masking of all sandboxed system views
|
|
134
|
+
* These may include UIImagePickerController, PHPickerViewController and CNContactPickerViewController
|
|
135
|
+
* iOS only
|
|
136
|
+
*
|
|
137
|
+
* @default true
|
|
138
|
+
*/
|
|
139
|
+
maskAllSandboxedViews?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Enable capturing of logs as console events
|
|
142
|
+
*
|
|
143
|
+
* @default true
|
|
144
|
+
*/
|
|
145
|
+
captureLog?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Deboucer delay used to reduce the number of snapshots captured and reduce performance impact
|
|
148
|
+
* This is used for capturing the view as a screenshot
|
|
149
|
+
* The lower the number more snapshots will be captured but higher the performance impact
|
|
150
|
+
*
|
|
151
|
+
* @default 1000
|
|
152
|
+
* @deprecated please use throttleDelayMs instead
|
|
153
|
+
*/
|
|
154
|
+
iOSdebouncerDelayMs?: number;
|
|
155
|
+
/**
|
|
156
|
+
* Deboucer delay used to reduce the number of snapshots captured and reduce performance impact
|
|
157
|
+
* This is used for capturing the view as a screenshot
|
|
158
|
+
* The lower the number more snapshots will be captured but higher the performance impact
|
|
159
|
+
* Ps: it was 500ms (0.5s) by default until version 3.3.7
|
|
160
|
+
*
|
|
161
|
+
* @default 1000
|
|
162
|
+
* @deprecated please use throttleDelayMs instead
|
|
163
|
+
*/
|
|
164
|
+
androidDebouncerDelayMs?: number;
|
|
165
|
+
/**
|
|
166
|
+
* Throttling delay used to reduce the number of snapshots captured and reduce performance impact
|
|
167
|
+
* This is used for capturing the view as a wireframe or screenshot
|
|
168
|
+
* The lower the number more snapshots will be captured but higher the performance impact
|
|
169
|
+
*
|
|
170
|
+
* This value has precedence over iOSdebouncerDelayMs and androidDebouncerDelayMs
|
|
171
|
+
* If this is not set, we will take the max number between iOSdebouncerDelayMs and androidDebouncerDelayMs for back compatibility
|
|
172
|
+
*
|
|
173
|
+
* @default 1000
|
|
174
|
+
*/
|
|
175
|
+
throttleDelayMs?: number;
|
|
176
|
+
/**
|
|
177
|
+
* Enable capturing network telemetry
|
|
178
|
+
* iOS only
|
|
179
|
+
*
|
|
180
|
+
* @default true
|
|
181
|
+
*/
|
|
182
|
+
captureNetworkTelemetry?: boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Schedule screenshot image capture on a background queue.
|
|
185
|
+
* iOS only
|
|
186
|
+
* Experimental support
|
|
187
|
+
*
|
|
188
|
+
* Warning: Enabling this option will trigger Main Thread Checker warnings and may
|
|
189
|
+
* briefly freeze the app the first time a screenshot is captured. Consider disabling
|
|
190
|
+
* Main Thread Checker in your scheme's run diagnostics when enabling this.
|
|
191
|
+
*
|
|
192
|
+
* @default false
|
|
193
|
+
*/
|
|
194
|
+
screenshotModeBackgroundCapture?: boolean;
|
|
195
|
+
/**
|
|
196
|
+
* Session replay sample rate between 0 and 1
|
|
197
|
+
* Local config has precedence over remote config when both are set.
|
|
198
|
+
* If undefined, sampling is controlled by remote config (when available).
|
|
199
|
+
*/
|
|
200
|
+
sampleRate?: number;
|
|
201
|
+
};
|
|
202
|
+
export interface TxlemetryCustomStorage {
|
|
203
|
+
getItem: (key: string) => string | null | Promise<string | null>;
|
|
204
|
+
setItem: (key: string, value: string) => void | Promise<void>;
|
|
205
|
+
}
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
export { getRemoteConfigBool, getRemoteConfigNumber, isValidSampleRate } from '@txlemetry/core';
|
|
2
|
-
type ReactNativeGlobal = {
|
|
3
|
-
HermesInternal?: {
|
|
4
|
-
enablePromiseRejectionTracker?: (args: {
|
|
5
|
-
allRejections: boolean;
|
|
6
|
-
onUnhandled?: (id: string, error: any) => void;
|
|
7
|
-
onHandled?: (id: string, error: any) => void;
|
|
8
|
-
}) => void;
|
|
9
|
-
hasPromise?: () => boolean;
|
|
10
|
-
};
|
|
11
|
-
ErrorUtils?: {
|
|
12
|
-
getGlobalHandler?: () => (error: Error, isFatal: boolean) => void;
|
|
13
|
-
setGlobalHandler?: (handler: (error: Error, isFatal: boolean) => void) => void;
|
|
14
|
-
};
|
|
15
|
-
onunhandledrejection?: (event: unknown) => void;
|
|
16
|
-
};
|
|
17
|
-
export declare const GLOBAL_OBJ: ReactNativeGlobal;
|
|
18
|
-
export declare function getPlatformOS(): string | undefined;
|
|
19
|
-
/** Checks if the current platform is web */
|
|
20
|
-
export declare function isWeb(): boolean;
|
|
21
|
-
/** Checks if the current platform is macOS */
|
|
22
|
-
export declare function isMacOS(): boolean;
|
|
23
|
-
/** Checks if the current platform is Windows */
|
|
24
|
-
export declare function isWindows(): boolean;
|
|
25
|
-
export declare const isHermes: () => boolean;
|
|
1
|
+
export { getRemoteConfigBool, getRemoteConfigNumber, isValidSampleRate } from '@txlemetry/core';
|
|
2
|
+
type ReactNativeGlobal = {
|
|
3
|
+
HermesInternal?: {
|
|
4
|
+
enablePromiseRejectionTracker?: (args: {
|
|
5
|
+
allRejections: boolean;
|
|
6
|
+
onUnhandled?: (id: string, error: any) => void;
|
|
7
|
+
onHandled?: (id: string, error: any) => void;
|
|
8
|
+
}) => void;
|
|
9
|
+
hasPromise?: () => boolean;
|
|
10
|
+
};
|
|
11
|
+
ErrorUtils?: {
|
|
12
|
+
getGlobalHandler?: () => (error: Error, isFatal: boolean) => void;
|
|
13
|
+
setGlobalHandler?: (handler: (error: Error, isFatal: boolean) => void) => void;
|
|
14
|
+
};
|
|
15
|
+
onunhandledrejection?: (event: unknown) => void;
|
|
16
|
+
};
|
|
17
|
+
export declare const GLOBAL_OBJ: ReactNativeGlobal;
|
|
18
|
+
export declare function getPlatformOS(): string | undefined;
|
|
19
|
+
/** Checks if the current platform is web */
|
|
20
|
+
export declare function isWeb(): boolean;
|
|
21
|
+
/** Checks if the current platform is macOS */
|
|
22
|
+
export declare function isMacOS(): boolean;
|
|
23
|
+
/** Checks if the current platform is Windows */
|
|
24
|
+
export declare function isWindows(): boolean;
|
|
25
|
+
export declare const isHermes: () => boolean;
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "
|
|
1
|
+
export declare const version = "5.0.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version=void 0;var version=exports.version="
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version=void 0;var version=exports.version="5.0.0";
|