posthog-react-native 3.2.0 → 3.2.1

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.
@@ -1,4 +1,4 @@
1
- import { PostHogCaptureOptions, PostHogCore, PostHogCoreOptions, PostHogFetchOptions, PostHogFetchResponse, PostHogPersistedProperty } from '../../posthog-core/src';
1
+ import { PostHogCaptureOptions, PostHogCore, PostHogCoreOptions, PostHogEventProperties, PostHogFetchOptions, PostHogFetchResponse, PostHogPersistedProperty } from '../../posthog-core/src';
2
2
  import { PostHogAutocaptureOptions, PostHogCustomAppProperties, PostHogCustomStorage, PostHogSessionReplayConfig } from './types';
3
3
  export type PostHogOptions = PostHogCoreOptions & {
4
4
  /** Allows you to provide the storage type. By default 'file'.
@@ -25,10 +25,8 @@ export type PostHogOptions = PostHogCoreOptions & {
25
25
  */
26
26
  enableSessionReplay?: boolean;
27
27
  /**
28
- * Enable Recording of Session Replays for Android and iOS
29
- * Requires Record user sessions to be enabled in the PostHog Project Settings
28
+ * Configuration for Session Replay
30
29
  * Experimental support
31
- * Defaults to false
32
30
  */
33
31
  sessionReplayConfig?: PostHogSessionReplayConfig;
34
32
  };
@@ -51,6 +49,8 @@ export declare class PostHog extends PostHogCore {
51
49
  [key: string]: any;
52
50
  }, options?: PostHogCaptureOptions): Promise<void>;
53
51
  getSessionId(): string;
52
+ resetSessionId(): void;
53
+ identify(distinctId?: string, properties?: PostHogEventProperties, options?: PostHogCaptureOptions): void;
54
54
  initReactNativeNavigation(options: PostHogAutocaptureOptions): boolean;
55
55
  private startSessionReplay;
56
56
  private captureNativeAppLifecycleEvents;
@@ -1 +1 @@
1
- "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.PostHog=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));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 _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 _src=require("../../posthog-core/src");var _legacy=require("./legacy");var _storage=require("./storage");var _version=require("./version");var _nativeDeps=require("./native-deps");var _wixNavigation=require("./frameworks/wix-navigation");var _OptionalSessionReplay=require("./optional/OptionalSessionReplay");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,e,o,r){var p=(0,_get2["default"])((0,_getPrototypeOf2["default"])(1&r?t.prototype:t),e,o);return 2&r&&"function"==typeof p?function(t){return p.apply(o,t);}:p;}var PostHog=exports.PostHog=function(_PostHogCore){function PostHog(apiKey,options){var _this;(0,_classCallCheck2["default"])(this,PostHog);var _a,_b;_this=_callSuper(this,PostHog,[apiKey,options]);_this._appProperties={};_this._isInitialized=false;_this._persistence=(_a=options===null||options===void 0?void 0:options.persistence)!==null&&_a!==void 0?_a:'file';_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)();_reactNative.AppState.addEventListener('change',function(){void _this.flush();});var storagePromise;if(_this._persistence==='file'){_this._storage=new _storage.PostHogRNStorage((_b=options===null||options===void 0?void 0:options.customStorage)!==null&&_b!==void 0?_b:(0,_nativeDeps.buildOptimisiticAsyncStorage)());storagePromise=_this._storage.preloadPromise;}else{_this._storage=new _storage.PostHogRNSyncMemoryStorage();}if(storagePromise){storagePromise.then(function(){if(!_this._storage.getItem(_src.PostHogPersistedProperty.AnonymousId)){void(0,_legacy.getLegacyValues)().then(function(legacyValues){var _a,_b;if(legacyValues===null||legacyValues===void 0?void 0:legacyValues.distinctId){(_a=_this._storage)===null||_a===void 0?void 0:_a.setItem(_src.PostHogPersistedProperty.DistinctId,legacyValues.distinctId);(_b=_this._storage)===null||_b===void 0?void 0:_b.setItem(_src.PostHogPersistedProperty.AnonymousId,legacyValues.anonymousId);}});}});}var initAfterStorage=function initAfterStorage(){_this.setupBootstrap(options);_this._isInitialized=true;if((options===null||options===void 0?void 0:options.preloadFeatureFlags)!==false){_this.reloadFeatureFlags();}if(options===null||options===void 0?void 0:options.captureNativeAppLifecycleEvents){if(_this._persistence==='memory'){console.warn('PostHog was initialised with persistence set to "memory", capturing native app events is not supported.');}else{void _this.captureNativeAppLifecycleEvents();}}void _this.persistAppVersion();void _this.startSessionReplay(options);};if(storagePromise){_this._initPromise=storagePromise.then(initAfterStorage);}else{_this._initPromise=Promise.resolve();initAfterStorage();}return _this;}(0,_inherits2["default"])(PostHog,_PostHogCore);return(0,_createClass2["default"])(PostHog,[{key:"ready",value:function(){var _ready=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(){return _regenerator["default"].wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.next=2;return this._initPromise;case 2:case"end":return _context.stop();}},_callee,this);}));function ready(){return _ready.apply(this,arguments);}return ready;}()},{key:"getPersistedProperty",value:function getPersistedProperty(key){return this._storage.getItem(key);}},{key:"setPersistedProperty",value:function setPersistedProperty(key,value){return value!==null?this._storage.setItem(key,value):this._storage.removeItem(key);}},{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:"getCommonEventProperties",value:function getCommonEventProperties(){return _objectSpread(_objectSpread(_objectSpread({},_superPropGet(PostHog,"getCommonEventProperties",this,3)([])),this._appProperties),{},{$screen_height:_reactNative.Dimensions.get('screen').height,$screen_width:_reactNative.Dimensions.get('screen').width});}},{key:"screen",value:function(){var _screen=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(name,properties,options){return _regenerator["default"].wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return this._initPromise;case 2:this.registerForSession({$screen_name:name});return _context2.abrupt("return",this.capture('$screen',_objectSpread(_objectSpread({},properties),{},{$screen_name:name}),options));case 4:case"end":return _context2.stop();}},_callee2,this);}));function screen(_x3,_x4,_x5){return _screen.apply(this,arguments);}return screen;}()},{key:"getSessionId",value:function getSessionId(){var sessionId=_superPropGet(PostHog,"getSessionId",this,3)([]);if(!this._enableSessionReplay){return sessionId;}if(sessionId.length>0&&this._currentSessionId&&sessionId!==this._currentSessionId){if(_OptionalSessionReplay.OptionalReactNativeSessionReplay){try{_OptionalSessionReplay.OptionalReactNativeSessionReplay.endSession();_OptionalSessionReplay.OptionalReactNativeSessionReplay.startSession(sessionId);console.info('PostHog Debug',"Session replay started with sessionId ".concat(sessionId,"."));}catch(e){console.error('PostHog Debug',"Session replay failed to start with sessionId: ".concat(e,"."));}}this._currentSessionId=sessionId;}return sessionId;}},{key:"initReactNativeNavigation",value:function initReactNativeNavigation(options){return(0,_wixNavigation.withReactNativeNavigation)(this,options);}},{key:"startSessionReplay",value:function(){var _startSessionReplay=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee3(options){var _a,_b,_c,sdkReplayConfig,sessionReplay,decideReplayConfig,sessionId,sdkOptions;return _regenerator["default"].wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:this._enableSessionReplay=options===null||options===void 0?void 0:options.enableSessionReplay;if(this._enableSessionReplay){_context3.next=4;break;}console.info('PostHog Debug','Session replay is not enabled.');return _context3.abrupt("return");case 4:sdkReplayConfig=(_a=options===null||options===void 0?void 0:options.sessionReplayConfig)!==null&&_a!==void 0?_a:{maskAllTextInputs:true,maskAllImages:true,captureLog:true,captureNetworkTelemetry:true,iOSdebouncerDelayMs:1000,androidDebouncerDelayMs:500};console.log('PostHog Debug',"Session replay sdk config: ".concat(JSON.stringify(sdkReplayConfig)));sessionReplay=(_b=this.getPersistedProperty(_src.PostHogPersistedProperty.SessionReplay))!==null&&_b!==void 0?_b:{};if(!sessionReplay){_context3.next=37;break;}decideReplayConfig=(_c=sessionReplay)!==null&&_c!==void 0?_c:{};console.log('PostHog Debug',"Session replay decide cached config: ".concat(JSON.stringify(decideReplayConfig)));if(!_OptionalSessionReplay.OptionalReactNativeSessionReplay){_context3.next=34;break;}sessionId=this.getSessionId();if(!(sessionId.length===0)){_context3.next=15;break;}console.warn('PostHog Debug','Session replay enabled but no sessionId found.');return _context3.abrupt("return");case 15:sdkOptions={apiKey:this.apiKey,host:this.host,debug:this.isDebug};console.log('PostHog Debug',"Session replay sdk options: ".concat(JSON.stringify(sdkOptions)));_context3.prev=17;_context3.next=20;return _OptionalSessionReplay.OptionalReactNativeSessionReplay.isEnabled();case 20:if(_context3.sent){_context3.next=26;break;}_context3.next=23;return _OptionalSessionReplay.OptionalReactNativeSessionReplay.start(sessionId,sdkOptions,sdkReplayConfig,decideReplayConfig);case 23:console.info('PostHog Debug',"Session replay started with sessionId ".concat(sessionId,"."));_context3.next=27;break;case 26:console.log('PostHog Debug',"Session replay already started.");case 27:_context3.next=32;break;case 29:_context3.prev=29;_context3.t0=_context3["catch"](17);console.error('PostHog Debug',"Session replay failed to start: ".concat(_context3.t0,"."));case 32:_context3.next=35;break;case 34:console.warn('PostHog Debug','Session replay enabled but not installed.');case 35:_context3.next=38;break;case 37:console.info('PostHog Debug','Session replay disabled.');case 38:case"end":return _context3.stop();}},_callee3,this,[[17,29]]);}));function startSessionReplay(_x6){return _startSessionReplay.apply(this,arguments);}return startSessionReplay;}()},{key:"captureNativeAppLifecycleEvents",value:function(){var _captureNativeAppLifecycleEvents=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee4(){var _this2=this;var _a,prevAppBuild,prevAppVersion,appBuild,appVersion,initialUrl;return _regenerator["default"].wrap(function _callee4$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:prevAppBuild=this.getPersistedProperty(_src.PostHogPersistedProperty.InstalledAppBuild);prevAppVersion=this.getPersistedProperty(_src.PostHogPersistedProperty.InstalledAppVersion);appBuild=this._appProperties.$app_build;appVersion=this._appProperties.$app_version;if(!appBuild||!appVersion){console.warn('PostHog 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',{version:appVersion,build:appBuild});}else if(prevAppBuild!==appBuild){this.capture('Application Updated',{previous_version:prevAppVersion,previous_build:prevAppBuild,version:appVersion,build:appBuild});}}_context4.next=8;return _reactNative.Linking.getInitialURL();case 8:_context4.t1=_a=_context4.sent;_context4.t0=_context4.t1!==null;if(!_context4.t0){_context4.next=12;break;}_context4.t0=_a!==void 0;case 12:if(!_context4.t0){_context4.next=16;break;}_context4.t2=_a;_context4.next=17;break;case 16:_context4.t2=undefined;case 17:initialUrl=_context4.t2;this.capture('Application Opened',{version:appVersion,build:appBuild,url:initialUrl});_reactNative.AppState.addEventListener('change',function(state){if(state==='active'){_this2.capture('Application Became Active',{version:appVersion,build:appBuild});}else if(state==='background'){_this2.capture('Application Backgrounded');}});case 20:case"end":return _context4.stop();}},_callee4,this);}));function captureNativeAppLifecycleEvents(){return _captureNativeAppLifecycleEvents.apply(this,arguments);}return captureNativeAppLifecycleEvents;}()},{key:"persistAppVersion",value:function(){var _persistAppVersion=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee5(){var appBuild,appVersion;return _regenerator["default"].wrap(function _callee5$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:appBuild=this._appProperties.$app_build;appVersion=this._appProperties.$app_version;this.setPersistedProperty(_src.PostHogPersistedProperty.InstalledAppBuild,appBuild);this.setPersistedProperty(_src.PostHogPersistedProperty.InstalledAppVersion,appVersion);case 4:case"end":return _context5.stop();}},_callee5,this);}));function persistAppVersion(){return _persistAppVersion.apply(this,arguments);}return persistAppVersion;}()}]);}(_src.PostHogCore);
1
+ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.PostHog=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));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 _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 _src=require("../../posthog-core/src");var _legacy=require("./legacy");var _storage=require("./storage");var _version=require("./version");var _nativeDeps=require("./native-deps");var _wixNavigation=require("./frameworks/wix-navigation");var _OptionalSessionReplay=require("./optional/OptionalSessionReplay");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,e,o,r){var p=(0,_get2["default"])((0,_getPrototypeOf2["default"])(1&r?t.prototype:t),e,o);return 2&r&&"function"==typeof p?function(t){return p.apply(o,t);}:p;}var PostHog=exports.PostHog=function(_PostHogCore){function PostHog(apiKey,options){var _this;(0,_classCallCheck2["default"])(this,PostHog);var _a,_b;_this=_callSuper(this,PostHog,[apiKey,options]);_this._appProperties={};_this._isInitialized=false;_this._persistence=(_a=options===null||options===void 0?void 0:options.persistence)!==null&&_a!==void 0?_a:'file';_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)();_reactNative.AppState.addEventListener('change',function(){void _this.flush();});var storagePromise;if(_this._persistence==='file'){_this._storage=new _storage.PostHogRNStorage((_b=options===null||options===void 0?void 0:options.customStorage)!==null&&_b!==void 0?_b:(0,_nativeDeps.buildOptimisiticAsyncStorage)());storagePromise=_this._storage.preloadPromise;}else{_this._storage=new _storage.PostHogRNSyncMemoryStorage();}if(storagePromise){storagePromise.then(function(){if(!_this._storage.getItem(_src.PostHogPersistedProperty.AnonymousId)){void(0,_legacy.getLegacyValues)().then(function(legacyValues){var _a,_b;if(legacyValues===null||legacyValues===void 0?void 0:legacyValues.distinctId){(_a=_this._storage)===null||_a===void 0?void 0:_a.setItem(_src.PostHogPersistedProperty.DistinctId,legacyValues.distinctId);(_b=_this._storage)===null||_b===void 0?void 0:_b.setItem(_src.PostHogPersistedProperty.AnonymousId,legacyValues.anonymousId);}});}});}var initAfterStorage=function initAfterStorage(){_this.setupBootstrap(options);_this._isInitialized=true;if((options===null||options===void 0?void 0:options.preloadFeatureFlags)!==false){_this.reloadFeatureFlags();}if(options===null||options===void 0?void 0:options.captureNativeAppLifecycleEvents){if(_this._persistence==='memory'){console.warn('PostHog was initialised with persistence set to "memory", capturing native app events is not supported.');}else{void _this.captureNativeAppLifecycleEvents();}}void _this.persistAppVersion();void _this.startSessionReplay(options);};if(storagePromise){_this._initPromise=storagePromise.then(initAfterStorage);}else{_this._initPromise=Promise.resolve();initAfterStorage();}return _this;}(0,_inherits2["default"])(PostHog,_PostHogCore);return(0,_createClass2["default"])(PostHog,[{key:"ready",value:function(){var _ready=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(){return _regenerator["default"].wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.next=2;return this._initPromise;case 2:case"end":return _context.stop();}},_callee,this);}));function ready(){return _ready.apply(this,arguments);}return ready;}()},{key:"getPersistedProperty",value:function getPersistedProperty(key){return this._storage.getItem(key);}},{key:"setPersistedProperty",value:function setPersistedProperty(key,value){return value!==null?this._storage.setItem(key,value):this._storage.removeItem(key);}},{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:"getCommonEventProperties",value:function getCommonEventProperties(){return _objectSpread(_objectSpread(_objectSpread({},_superPropGet(PostHog,"getCommonEventProperties",this,3)([])),this._appProperties),{},{$screen_height:_reactNative.Dimensions.get('screen').height,$screen_width:_reactNative.Dimensions.get('screen').width});}},{key:"screen",value:function(){var _screen=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(name,properties,options){return _regenerator["default"].wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return this._initPromise;case 2:this.registerForSession({$screen_name:name});return _context2.abrupt("return",this.capture('$screen',_objectSpread(_objectSpread({},properties),{},{$screen_name:name}),options));case 4:case"end":return _context2.stop();}},_callee2,this);}));function screen(_x3,_x4,_x5){return _screen.apply(this,arguments);}return screen;}()},{key:"getSessionId",value:function getSessionId(){var sessionId=_superPropGet(PostHog,"getSessionId",this,3)([]);if(!this._enableSessionReplay){return sessionId;}if(sessionId.length>0&&this._currentSessionId&&sessionId!==this._currentSessionId){if(_OptionalSessionReplay.OptionalReactNativeSessionReplay){try{_OptionalSessionReplay.OptionalReactNativeSessionReplay.endSession();_OptionalSessionReplay.OptionalReactNativeSessionReplay.startSession(sessionId);console.info('PostHog Debug',"Session replay started with sessionId ".concat(sessionId,"."));}catch(e){console.error('PostHog Debug',"Session replay failed to start with sessionId: ".concat(e,"."));}}this._currentSessionId=sessionId;}return sessionId;}},{key:"resetSessionId",value:function resetSessionId(){_superPropGet(PostHog,"resetSessionId",this,3)([]);if(this._enableSessionReplay&&_OptionalSessionReplay.OptionalReactNativeSessionReplay){try{_OptionalSessionReplay.OptionalReactNativeSessionReplay.endSession();console.info('PostHog Debug',"Session replay ended.");}catch(e){console.error('PostHog Debug',"Session replay failed to end: ".concat(e,"."));}}}},{key:"identify",value:function identify(distinctId,properties,options){var previousDistinctId=this.getDistinctId();_superPropGet(PostHog,"identify",this,3)([distinctId,properties,options]);if(this._enableSessionReplay&&_OptionalSessionReplay.OptionalReactNativeSessionReplay){try{distinctId=distinctId||previousDistinctId;_OptionalSessionReplay.OptionalReactNativeSessionReplay.identify(distinctId,this.getAnonymousId());console.info('PostHog Debug',"Session replay identified with distinctId ".concat(distinctId,"."));}catch(e){console.error('PostHog Debug',"Session replay failed to identify: ".concat(e,"."));}}}},{key:"initReactNativeNavigation",value:function initReactNativeNavigation(options){return(0,_wixNavigation.withReactNativeNavigation)(this,options);}},{key:"startSessionReplay",value:function(){var _startSessionReplay=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee3(options){var _a,_b,_c,sdkReplayConfig,sessionReplay,decideReplayConfig,sessionId,sdkOptions;return _regenerator["default"].wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:this._enableSessionReplay=options===null||options===void 0?void 0:options.enableSessionReplay;if(this._enableSessionReplay){_context3.next=4;break;}console.info('PostHog Debug','Session replay is not enabled.');return _context3.abrupt("return");case 4:sdkReplayConfig=(_a=options===null||options===void 0?void 0:options.sessionReplayConfig)!==null&&_a!==void 0?_a:{maskAllTextInputs:true,maskAllImages:true,captureLog:true,captureNetworkTelemetry:true,iOSdebouncerDelayMs:1000,androidDebouncerDelayMs:500};console.log('PostHog Debug',"Session replay sdk config: ".concat(JSON.stringify(sdkReplayConfig)));sessionReplay=(_b=this.getPersistedProperty(_src.PostHogPersistedProperty.SessionReplay))!==null&&_b!==void 0?_b:{};if(!sessionReplay){_context3.next=37;break;}decideReplayConfig=(_c=sessionReplay)!==null&&_c!==void 0?_c:{};console.log('PostHog Debug',"Session replay decide cached config: ".concat(JSON.stringify(decideReplayConfig)));if(!_OptionalSessionReplay.OptionalReactNativeSessionReplay){_context3.next=34;break;}sessionId=this.getSessionId();if(!(sessionId.length===0)){_context3.next=15;break;}console.warn('PostHog Debug','Session replay enabled but no sessionId found.');return _context3.abrupt("return");case 15:sdkOptions={apiKey:this.apiKey,host:this.host,debug:this.isDebug,distinctId:this.getDistinctId(),anonymousId:this.getAnonymousId()};console.log('PostHog Debug',"Session replay sdk options: ".concat(JSON.stringify(sdkOptions)));_context3.prev=17;_context3.next=20;return _OptionalSessionReplay.OptionalReactNativeSessionReplay.isEnabled();case 20:if(_context3.sent){_context3.next=26;break;}_context3.next=23;return _OptionalSessionReplay.OptionalReactNativeSessionReplay.start(sessionId,sdkOptions,sdkReplayConfig,decideReplayConfig);case 23:console.info('PostHog Debug',"Session replay started with sessionId ".concat(sessionId,"."));_context3.next=27;break;case 26:console.log('PostHog Debug',"Session replay already started.");case 27:_context3.next=32;break;case 29:_context3.prev=29;_context3.t0=_context3["catch"](17);console.error('PostHog Debug',"Session replay failed to start: ".concat(_context3.t0,"."));case 32:_context3.next=35;break;case 34:console.warn('PostHog Debug','Session replay enabled but not installed.');case 35:_context3.next=38;break;case 37:console.info('PostHog Debug','Session replay disabled.');case 38:case"end":return _context3.stop();}},_callee3,this,[[17,29]]);}));function startSessionReplay(_x6){return _startSessionReplay.apply(this,arguments);}return startSessionReplay;}()},{key:"captureNativeAppLifecycleEvents",value:function(){var _captureNativeAppLifecycleEvents=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee4(){var _this2=this;var _a,prevAppBuild,prevAppVersion,appBuild,appVersion,initialUrl;return _regenerator["default"].wrap(function _callee4$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:prevAppBuild=this.getPersistedProperty(_src.PostHogPersistedProperty.InstalledAppBuild);prevAppVersion=this.getPersistedProperty(_src.PostHogPersistedProperty.InstalledAppVersion);appBuild=this._appProperties.$app_build;appVersion=this._appProperties.$app_version;if(!appBuild||!appVersion){console.warn('PostHog 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',{version:appVersion,build:appBuild});}else if(prevAppBuild!==appBuild){this.capture('Application Updated',{previous_version:prevAppVersion,previous_build:prevAppBuild,version:appVersion,build:appBuild});}}_context4.next=8;return _reactNative.Linking.getInitialURL();case 8:_context4.t1=_a=_context4.sent;_context4.t0=_context4.t1!==null;if(!_context4.t0){_context4.next=12;break;}_context4.t0=_a!==void 0;case 12:if(!_context4.t0){_context4.next=16;break;}_context4.t2=_a;_context4.next=17;break;case 16:_context4.t2=undefined;case 17:initialUrl=_context4.t2;this.capture('Application Opened',{version:appVersion,build:appBuild,url:initialUrl});_reactNative.AppState.addEventListener('change',function(state){if(state==='active'){_this2.capture('Application Became Active',{version:appVersion,build:appBuild});}else if(state==='background'){_this2.capture('Application Backgrounded');}});case 20:case"end":return _context4.stop();}},_callee4,this);}));function captureNativeAppLifecycleEvents(){return _captureNativeAppLifecycleEvents.apply(this,arguments);}return captureNativeAppLifecycleEvents;}()},{key:"persistAppVersion",value:function(){var _persistAppVersion=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee5(){var appBuild,appVersion;return _regenerator["default"].wrap(function _callee5$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:appBuild=this._appProperties.$app_build;appVersion=this._appProperties.$app_version;this.setPersistedProperty(_src.PostHogPersistedProperty.InstalledAppBuild,appBuild);this.setPersistedProperty(_src.PostHogPersistedProperty.InstalledAppVersion,appVersion);case 4:case"end":return _context5.stop();}},_callee5,this);}));function persistAppVersion(){return _persistAppVersion.apply(this,arguments);}return persistAppVersion;}()}]);}(_src.PostHogCore);
@@ -1 +1 @@
1
- {"version":3,"file":"posthog-rn.js","sourceRoot":"","sources":["../../../src/posthog-rn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEtE,OAAO,EAGL,WAAW,EAIX,wBAAwB,GACzB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAA;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,4BAA4B,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAO9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,EAAE,gCAAgC,EAAE,MAAM,kCAAkC,CAAA;AAwCnF,MAAM,OAAO,OAAQ,SAAQ,WAAW;IAOtC,YAAY,MAAc,EAAE,OAAwB;;QAClD,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QALhB,mBAAc,GAA+B,EAAE,CAAA;QAMrD,IAAI,CAAC,cAAc,GAAG,KAAK,CAAA;QAC3B,IAAI,CAAC,YAAY,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,mCAAI,MAAM,CAAA;QAElD,yDAAyD;QACzD,IAAI,CAAC,cAAc;YACjB,OAAO,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,mBAAmB,CAAA,KAAK,UAAU;gBAChD,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,g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UAAU,CAAC,CAAA;IACrF,CAAC;CACF"}
@@ -1 +1 @@
1
- export declare const version = "3.2.0";
1
+ export declare const version = "3.2.1";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version=void 0;var version=exports.version="3.2.0";
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version=void 0;var version=exports.version="3.2.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "posthog-react-native",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "main": "lib/posthog-react-native/index.js",
5
5
  "files": [
6
6
  "lib/"
@@ -33,7 +33,7 @@
33
33
  "react-native": "^0.69.1",
34
34
  "react-native-device-info": "^10.3.0",
35
35
  "react-native-navigation": "^6.0.0",
36
- "posthog-react-native-session-replay": ">=0.1.0"
36
+ "posthog-react-native-session-replay": ">=0.1.1"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@react-native-async-storage/async-storage": ">=1.0.0",
@@ -44,7 +44,7 @@
44
44
  "expo-localization": ">= 11.0.0",
45
45
  "react-native-device-info": ">= 10.0.0",
46
46
  "react-native-navigation": ">=6.0.0",
47
- "posthog-react-native-session-replay": ">=0.1.0"
47
+ "posthog-react-native-session-replay": ">=0.1.1"
48
48
  },
49
49
  "peerDependenciesMeta": {
50
50
  "@react-native-async-storage/async-storage": {