posthog-react-native 2.1.4 → 2.2.0-alpha1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -187,14 +187,61 @@ declare abstract class PostHogCore {
187
187
  shutdown(): void;
188
188
  }
189
189
 
190
+ declare type PostHogAutocaptureNavigationTrackerOptions = {
191
+ routeToName?: (name: string, params: any) => string;
192
+ routeToProperties?: (name: string, params: any) => string;
193
+ };
194
+ declare type PostHogAutocaptureOptions = {
195
+ captureTouches?: boolean;
196
+ customLabelProp?: string;
197
+ noCaptureProp?: string;
198
+ maxElementsCaptured?: number;
199
+ ignoreLabels?: string[];
200
+ propsToCapture?: string[];
201
+ captureScreens?: boolean;
202
+ navigation?: PostHogAutocaptureNavigationTrackerOptions;
203
+ captureLifecycleEvents?: boolean;
204
+ };
205
+ interface PostHogCustomAppProperties {
206
+ /** Build number like "1.2.2" or "122" */
207
+ $app_build?: string | null;
208
+ /** Name of the app as displayed below the icon like "PostHog" */
209
+ $app_name?: string | null;
210
+ /** Namespace of the app usually like "com.posthog.app" */
211
+ $app_namespace?: string | null;
212
+ /** Human friendly app version like what a user would see in the app store like "1.2.2" */
213
+ $app_version?: string | null;
214
+ /** Manufacturer like "Apple", "Samsung" or "Android" */
215
+ $device_manufacturer?: string | null;
216
+ /** Readable model name like "iPhone 12" */
217
+ $device_name?: string | null;
218
+ /** Operating system name like iOS or Android */
219
+ $os_name?: string | null;
220
+ /** Operating system version "14.0" */
221
+ $os_version?: string | null;
222
+ /** Locale (language) of the device like "en-US" */
223
+ $locale?: string | null;
224
+ /** Timezone of the device like "Europe/Berlin" */
225
+ $timezone?: string | null;
226
+ }
227
+ interface PostHogCustomAsyncStorage {
228
+ getItem: (key: string) => Promise<string | null>;
229
+ setItem: (key: string, value: string) => Promise<void>;
230
+ }
231
+
190
232
  declare type PostHogOptions = PosthogCoreOptions & {
191
233
  persistence?: 'memory' | 'file';
234
+ customAppProperties?: PostHogCustomAppProperties;
235
+ customAsyncStorage?: PostHogCustomAsyncStorage;
192
236
  };
193
237
  declare class PostHog extends PostHogCore {
194
238
  private _persistence;
195
239
  private _memoryStorage;
196
- static initAsync(): Promise<void>;
240
+ private _semiAsyncStorage;
241
+ private _appProperties;
197
242
  constructor(apiKey: string, options?: PostHogOptions);
243
+ /** Await this method to ensure that all state has been loaded from the async provider */
244
+ initAsync(): Promise<void>;
198
245
  getPersistedProperty<T>(key: PostHogPersistedProperty): T | undefined;
199
246
  setPersistedProperty<T>(key: PostHogPersistedProperty, value: T | null): void;
200
247
  fetch(url: string, options: PostHogFetchOptions): Promise<PostHogFetchResponse>;
@@ -207,22 +254,6 @@ declare class PostHog extends PostHogCore {
207
254
 
208
255
  declare function useLifecycleTracker(client?: PostHog): void;
209
256
 
210
- declare type PostHogAutocaptureNavigationTrackerOptions = {
211
- routeToName?: (name: string, params: any) => string;
212
- routeToProperties?: (name: string, params: any) => string;
213
- };
214
- declare type PostHogAutocaptureOptions = {
215
- captureTouches?: boolean;
216
- customLabelProp?: string;
217
- noCaptureProp?: string;
218
- maxElementsCaptured?: number;
219
- ignoreLabels?: string[];
220
- propsToCapture?: string[];
221
- captureScreens?: boolean;
222
- navigation?: PostHogAutocaptureNavigationTrackerOptions;
223
- captureLifecycleEvents?: boolean;
224
- };
225
-
226
257
  declare function _useNavigationTracker(options?: PostHogAutocaptureNavigationTrackerOptions, client?: PostHog): void;
227
258
  declare const useNavigationTracker: typeof _useNavigationTracker;
228
259
 
@@ -242,4 +273,4 @@ interface PostHogProviderProps {
242
273
  }
243
274
  declare const PostHogProvider: ({ children, client, options, apiKey, autocapture, style, }: PostHogProviderProps) => JSX.Element;
244
275
 
245
- export { PostHog, PostHogAutocaptureNavigationTrackerOptions, PostHogAutocaptureOptions, PostHogOptions, PostHogProvider, PostHogProviderProps, PostHog as default, useFeatureFlag, useFeatureFlags, useLifecycleTracker, useNavigationTracker, usePostHog };
276
+ export { PostHog, PostHogAutocaptureNavigationTrackerOptions, PostHogAutocaptureOptions, PostHogCustomAppProperties, PostHogCustomAsyncStorage, PostHogOptions, PostHogProvider, PostHogProviderProps, PostHog as default, useFeatureFlag, useFeatureFlags, useLifecycleTracker, useNavigationTracker, usePostHog };
package/lib/index.esm.js CHANGED
@@ -1,8 +1,4 @@
1
1
  import { Platform, Dimensions, AppState, View } from 'react-native';
2
- import * as ExpoApplication from 'expo-application';
3
- import * as ExpoDevice from 'expo-device';
4
- import * as ExpoLocalization from 'expo-localization';
5
- import * as FileSystem from 'expo-file-system';
6
2
  import React, { useRef, useEffect, useState, useCallback } from 'react';
7
3
 
8
4
  /******************************************************************************
@@ -1247,6 +1243,22 @@ var PostHogMemoryStorage = /** @class */ (function () {
1247
1243
  return PostHogMemoryStorage;
1248
1244
  }());
1249
1245
 
1246
+ var _OptionalExpoApplication = undefined;
1247
+
1248
+ try {
1249
+ _OptionalExpoApplication = require('expo-application');
1250
+ } catch (e) {}
1251
+
1252
+ var OptionalExpoApplication = _OptionalExpoApplication;
1253
+
1254
+ var _OptionalExpoFileSystem = undefined;
1255
+
1256
+ try {
1257
+ _OptionalExpoFileSystem = require('expo-file-system');
1258
+ } catch (e) {}
1259
+
1260
+ var OptionalExpoFileSystem = _OptionalExpoFileSystem;
1261
+
1250
1262
  var getLegacyValues = function () {
1251
1263
  return __awaiter(void 0, void 0, void 0, function () {
1252
1264
  var posthogFileDirectory, posthogDistinctIdFile, posthogAnonymousIdFile, res, _a, _b, _c, _d, _e, _f;
@@ -1254,10 +1266,18 @@ var getLegacyValues = function () {
1254
1266
  return __generator(this, function (_g) {
1255
1267
  switch (_g.label) {
1256
1268
  case 0:
1269
+ // NOTE: The old react-native lib stored data in files on the filesystem.
1270
+ // This function takes care of pulling the legacy IDs to ensure we are using them if already present
1271
+ if (!OptionalExpoFileSystem || !OptionalExpoApplication) {
1272
+ return [2
1273
+ /*return*/
1274
+ ];
1275
+ }
1276
+
1257
1277
  if (!(Platform.OS === 'ios')) return [3
1258
1278
  /*break*/
1259
1279
  , 8];
1260
- posthogFileDirectory = "".concat(FileSystem.documentDirectory, "../Library/Application%20Support/").concat(ExpoApplication.applicationId, "/");
1280
+ posthogFileDirectory = "".concat(OptionalExpoFileSystem.documentDirectory, "../Library/Application%20Support/").concat(OptionalExpoApplication.applicationId, "/");
1261
1281
  posthogDistinctIdFile = posthogFileDirectory + 'posthog.distinctId';
1262
1282
  posthogAnonymousIdFile = posthogFileDirectory + 'posthog.anonymousId';
1263
1283
  res = {
@@ -1273,7 +1293,7 @@ var getLegacyValues = function () {
1273
1293
  _c = (_b = JSON).parse;
1274
1294
  return [4
1275
1295
  /*yield*/
1276
- , FileSystem.readAsStringAsync(posthogDistinctIdFile)];
1296
+ , OptionalExpoFileSystem.readAsStringAsync(posthogDistinctIdFile)];
1277
1297
 
1278
1298
  case 2:
1279
1299
  _a.distinctId = _c.apply(_b, [_g.sent()])['posthog.distinctId'];
@@ -1294,7 +1314,7 @@ var getLegacyValues = function () {
1294
1314
  _f = (_e = JSON).parse;
1295
1315
  return [4
1296
1316
  /*yield*/
1297
- , FileSystem.readAsStringAsync(posthogAnonymousIdFile)];
1317
+ , OptionalExpoFileSystem.readAsStringAsync(posthogAnonymousIdFile)];
1298
1318
 
1299
1319
  case 5:
1300
1320
  _d.anonymousId = _f.apply(_e, [_g.sent()])['posthog.anonymousId'];
@@ -1323,115 +1343,222 @@ var getLegacyValues = function () {
1323
1343
  };
1324
1344
 
1325
1345
  var POSTHOG_STORAGE_KEY = '.posthog-rn.json';
1326
- var POSTHOG_STORAGE_VERSION = 'v1';
1346
+ var POSTHOG_STORAGE_VERSION = 'v1'; // NOTE: The core prefers a synchronous storage so we mimic this by pre-loading all keys
1327
1347
 
1328
- var loadStorageAsync = function () {
1329
- return __awaiter(void 0, void 0, void 0, function () {
1330
- var uri, stringContent;
1331
- return __generator(this, function (_a) {
1332
- switch (_a.label) {
1333
- case 0:
1334
- uri = (FileSystem.documentDirectory || '') + POSTHOG_STORAGE_KEY;
1335
- _a.label = 1;
1336
-
1337
- case 1:
1338
- _a.trys.push([1, 3,, 4]);
1348
+ var SemiAsyncStorage =
1349
+ /** @class */
1350
+ function () {
1351
+ function SemiAsyncStorage(asyncStorage) {
1352
+ this._memoryCache = {};
1353
+ this._asyncStorage = asyncStorage;
1354
+ }
1339
1355
 
1340
- return [4
1341
- /*yield*/
1342
- , FileSystem.readAsStringAsync(uri)];
1356
+ SemiAsyncStorage.prototype.preloadAsync = function () {
1357
+ var _this = this;
1343
1358
 
1344
- case 2:
1345
- stringContent = _a.sent();
1346
- return [2
1347
- /*return*/
1348
- , JSON.parse(stringContent).content];
1359
+ if (this._preloadSemiAsyncStoragePromise) {
1360
+ return this._preloadSemiAsyncStoragePromise;
1361
+ }
1349
1362
 
1350
- case 3:
1351
- _a.sent();
1352
- return [2
1353
- /*return*/
1354
- , {}];
1363
+ this._preloadSemiAsyncStoragePromise = this._asyncStorage.getItem(POSTHOG_STORAGE_KEY).then(function (res) {
1364
+ try {
1365
+ var data = res ? JSON.parse(res).content : {};
1355
1366
 
1356
- case 4:
1357
- return [2
1358
- /*return*/
1359
- ];
1367
+ for (var key in data) {
1368
+ _this._memoryCache[key] = _this._memoryCache[key] === undefined ? data[key] : _this._memoryCache[key];
1369
+ }
1370
+ } catch (e) {
1371
+ console.warn("PostHog failed to load persisted data from storage. This is likely because the storage format is. We'll reset the storage.", e);
1360
1372
  }
1361
1373
  });
1362
- });
1363
- };
1374
+ return this._preloadSemiAsyncStoragePromise;
1375
+ };
1364
1376
 
1365
- var persistStorageAsync = function (content) {
1366
- return __awaiter(void 0, void 0, void 0, function () {
1367
- var uri, data;
1368
- return __generator(this, function (_a) {
1369
- switch (_a.label) {
1370
- case 0:
1371
- uri = (FileSystem.documentDirectory || '') + POSTHOG_STORAGE_KEY;
1372
- data = {
1373
- version: POSTHOG_STORAGE_VERSION,
1374
- content: content
1375
- };
1376
- return [4
1377
- /*yield*/
1378
- , FileSystem.writeAsStringAsync(uri, JSON.stringify(data)).catch(function (e) {
1379
- console.error('PostHog failed to persist data to storage', e);
1380
- })];
1377
+ SemiAsyncStorage.prototype.persist = function () {
1378
+ var payload = {
1379
+ version: POSTHOG_STORAGE_VERSION,
1380
+ content: this._memoryCache
1381
+ };
1382
+ void this._asyncStorage.setItem(POSTHOG_STORAGE_KEY, JSON.stringify(payload));
1383
+ };
1381
1384
 
1382
- case 1:
1383
- _a.sent();
1385
+ SemiAsyncStorage.prototype.getItem = function (key) {
1386
+ return this._memoryCache[key];
1387
+ };
1384
1388
 
1385
- return [2
1386
- /*return*/
1387
- ];
1388
- }
1389
- });
1390
- });
1391
- }; // NOTE: The core prefers a synchronous storage so we mimic this by pre-loading all keys
1392
-
1393
-
1394
- var _memoryCache = {};
1395
- var SemiAsyncStorage = {
1396
- getItem: function (key) {
1397
- return _memoryCache[key];
1398
- },
1399
- setItem: function (key, value) {
1400
- _memoryCache[key] = value;
1401
- void persistStorageAsync(_memoryCache);
1402
- },
1403
- removeItem: function (key) {
1404
- delete _memoryCache[key];
1405
- void persistStorageAsync(_memoryCache);
1406
- },
1407
- clear: function () {
1408
- for (var key in _memoryCache) {
1409
- delete _memoryCache[key];
1389
+ SemiAsyncStorage.prototype.setItem = function (key, value) {
1390
+ this._memoryCache[key] = value;
1391
+ this.persist();
1392
+ };
1393
+
1394
+ SemiAsyncStorage.prototype.removeItem = function (key) {
1395
+ delete this._memoryCache[key];
1396
+ this.persist();
1397
+ };
1398
+
1399
+ SemiAsyncStorage.prototype.clear = function () {
1400
+ for (var key in this._memoryCache) {
1401
+ delete this._memoryCache[key];
1410
1402
  }
1411
1403
 
1412
- void persistStorageAsync(_memoryCache);
1413
- },
1414
- getAllKeys: function () {
1415
- return Object.keys(_memoryCache);
1416
- }
1404
+ this.persist();
1405
+ };
1406
+
1407
+ SemiAsyncStorage.prototype.getAllKeys = function () {
1408
+ return Object.keys(this._memoryCache);
1409
+ };
1410
+
1411
+ return SemiAsyncStorage;
1412
+ }();
1413
+
1414
+ var version = "2.2.0-alpha1";
1415
+
1416
+ var warn = function (name) {
1417
+ console.warn("PostHog: Missing ".concat(name, " optional dependency. Some functions may not work as expected..."));
1417
1418
  };
1418
1419
 
1419
- var _preloadSemiAsyncStoragePromise;
1420
+ var _OptionalAsyncStorage = undefined;
1421
+
1422
+ try {
1423
+ _OptionalAsyncStorage = require('@react-native-async-storage/async-storage').default;
1424
+ } catch (e) {
1425
+ warn('@react-native-async-storage/async-storage');
1426
+ }
1427
+
1428
+ var OptionalAsyncStorage = _OptionalAsyncStorage;
1429
+
1430
+ var _OptionalExpoDevice = undefined;
1431
+
1432
+ try {
1433
+ _OptionalExpoDevice = require('expo-device');
1434
+ } catch (e) {}
1420
1435
 
1421
- var preloadSemiAsyncStorage = function () {
1422
- if (_preloadSemiAsyncStoragePromise) {
1423
- return _preloadSemiAsyncStoragePromise;
1436
+ var OptionalExpoDevice = _OptionalExpoDevice;
1437
+
1438
+ var _OptionalExpoLocalization = undefined;
1439
+
1440
+ try {
1441
+ _OptionalExpoLocalization = require('expo-localization');
1442
+ } catch (e) {}
1443
+
1444
+ var OptionalExpoLocalization = _OptionalExpoLocalization;
1445
+
1446
+ var _OptionalReactNativeDeviceInfo = undefined;
1447
+
1448
+ try {
1449
+ _OptionalReactNativeDeviceInfo = require('react-native-device-info');
1450
+ } catch (e) {
1451
+ warn('react-native-device-info');
1452
+ }
1453
+
1454
+ var OptionalReactNativeDeviceInfo = _OptionalReactNativeDeviceInfo;
1455
+
1456
+ var getAppProperties = function () {
1457
+ var properties = {};
1458
+
1459
+ if (OptionalExpoApplication) {
1460
+ properties.$app_build = OptionalExpoApplication.nativeBuildVersion;
1461
+ properties.$app_name = OptionalExpoApplication.applicationName;
1462
+ properties.$app_namespace = OptionalExpoApplication.applicationId;
1463
+ properties.$app_version = OptionalExpoApplication.nativeApplicationVersion;
1424
1464
  }
1425
1465
 
1426
- _preloadSemiAsyncStoragePromise = loadStorageAsync().then(function (res) {
1427
- for (var key in res) {
1428
- _memoryCache[key] = _memoryCache[key] === undefined ? res[key] : _memoryCache[key];
1429
- }
1430
- });
1431
- return _preloadSemiAsyncStoragePromise;
1466
+ if (OptionalExpoDevice) {
1467
+ properties.$device_manufacturer = OptionalExpoDevice.manufacturer;
1468
+ properties.$device_name = OptionalExpoDevice.modelName;
1469
+ properties.$os_name = OptionalExpoDevice.osName;
1470
+ properties.$os_version = OptionalExpoDevice.osVersion;
1471
+ }
1472
+
1473
+ if (OptionalExpoLocalization) {
1474
+ properties.$locale = OptionalExpoLocalization.locale;
1475
+ properties.$timezone = OptionalExpoLocalization.timezone;
1476
+ }
1477
+
1478
+ if (OptionalReactNativeDeviceInfo) {
1479
+ properties.$app_build = OptionalReactNativeDeviceInfo.getBuildIdSync();
1480
+ properties.$app_name = OptionalReactNativeDeviceInfo.getApplicationName();
1481
+ properties.$app_namespace = OptionalReactNativeDeviceInfo.getBundleId();
1482
+ properties.$app_version = OptionalReactNativeDeviceInfo.getVersion();
1483
+ properties.$device_manufacturer = OptionalReactNativeDeviceInfo.getManufacturerSync();
1484
+ properties.$device_name = OptionalReactNativeDeviceInfo.getDeviceNameSync();
1485
+ properties.$os_name = OptionalReactNativeDeviceInfo.getSystemName();
1486
+ properties.$os_version = OptionalReactNativeDeviceInfo.getSystemVersion();
1487
+ }
1488
+
1489
+ return properties;
1432
1490
  };
1491
+ var buildOptimisiticAsyncStorage = function () {
1492
+ if (OptionalExpoFileSystem) {
1493
+ var filesystem_1 = OptionalExpoFileSystem;
1494
+ return {
1495
+ getItem: function (key) {
1496
+ return __awaiter(this, void 0, void 0, function () {
1497
+ var uri, stringContent;
1498
+ return __generator(this, function (_a) {
1499
+ switch (_a.label) {
1500
+ case 0:
1501
+ uri = (filesystem_1.documentDirectory || '') + key;
1502
+ _a.label = 1;
1503
+
1504
+ case 1:
1505
+ _a.trys.push([1, 3,, 4]);
1506
+
1507
+ return [4
1508
+ /*yield*/
1509
+ , filesystem_1.readAsStringAsync(uri)];
1510
+
1511
+ case 2:
1512
+ stringContent = _a.sent();
1513
+ return [2
1514
+ /*return*/
1515
+ , stringContent];
1516
+
1517
+ case 3:
1518
+ _a.sent();
1519
+ return [2
1520
+ /*return*/
1521
+ , null];
1522
+
1523
+ case 4:
1524
+ return [2
1525
+ /*return*/
1526
+ ];
1527
+ }
1528
+ });
1529
+ });
1530
+ },
1531
+ setItem: function (key, value) {
1532
+ return __awaiter(this, void 0, void 0, function () {
1533
+ var uri;
1534
+ return __generator(this, function (_a) {
1535
+ switch (_a.label) {
1536
+ case 0:
1537
+ uri = (filesystem_1.documentDirectory || '') + key;
1538
+ return [4
1539
+ /*yield*/
1540
+ , filesystem_1.writeAsStringAsync(uri, value)];
1541
+
1542
+ case 1:
1543
+ _a.sent();
1544
+
1545
+ return [2
1546
+ /*return*/
1547
+ ];
1548
+ }
1549
+ });
1550
+ });
1551
+ }
1552
+ };
1553
+ }
1433
1554
 
1434
- var version = "2.1.4";
1555
+ if (OptionalAsyncStorage) {
1556
+ return OptionalAsyncStorage;
1557
+ }
1558
+
1559
+ console.log(OptionalAsyncStorage);
1560
+ throw new Error('PostHog: No storage available. Please install expo-filesystem or react-native-async-storage OR implement a custom storage provider.');
1561
+ };
1435
1562
 
1436
1563
  var PostHog =
1437
1564
  /** @class */
@@ -1442,29 +1569,51 @@ function (_super) {
1442
1569
  var _this = _super.call(this, apiKey, options) || this;
1443
1570
 
1444
1571
  _this._memoryStorage = new PostHogMemoryStorage();
1572
+ _this._appProperties = {};
1445
1573
  _this._persistence = options === null || options === void 0 ? void 0 : options.persistence;
1574
+ _this._appProperties = (options === null || options === void 0 ? void 0 : options.customAppProperties) || getAppProperties();
1575
+ _this._semiAsyncStorage = new SemiAsyncStorage((options === null || options === void 0 ? void 0 : options.customAsyncStorage) || buildOptimisiticAsyncStorage());
1446
1576
  AppState.addEventListener('change', function () {
1447
1577
  _this.flush();
1448
1578
  }); // Ensure the async storage has been preloaded (this call is cached)
1449
1579
  // It is possible that the old library was used so we try to get the legacy distinctID
1450
1580
 
1451
- void preloadSemiAsyncStorage().then(function () {
1581
+ void _this._semiAsyncStorage.preloadAsync().then(function () {
1452
1582
  _this.setupBootstrap(options);
1453
1583
 
1454
- if (!SemiAsyncStorage.getItem(PostHogPersistedProperty.AnonymousId)) {
1584
+ if (!_this._semiAsyncStorage.getItem(PostHogPersistedProperty.AnonymousId)) {
1455
1585
  getLegacyValues().then(function (legacyValues) {
1456
1586
  if (legacyValues === null || legacyValues === void 0 ? void 0 : legacyValues.distinctId) {
1457
- SemiAsyncStorage.setItem(PostHogPersistedProperty.DistinctId, legacyValues.distinctId);
1458
- SemiAsyncStorage.setItem(PostHogPersistedProperty.AnonymousId, legacyValues.anonymousId);
1587
+ _this._semiAsyncStorage.setItem(PostHogPersistedProperty.DistinctId, legacyValues.distinctId);
1588
+
1589
+ _this._semiAsyncStorage.setItem(PostHogPersistedProperty.AnonymousId, legacyValues.anonymousId);
1459
1590
  }
1460
1591
  });
1461
1592
  }
1462
1593
  });
1463
1594
  return _this;
1464
1595
  }
1596
+ /** Await this method to ensure that all state has been loaded from the async provider */
1597
+
1598
+
1599
+ PostHog.prototype.initAsync = function () {
1600
+ return __awaiter(this, void 0, void 0, function () {
1601
+ return __generator(this, function (_a) {
1602
+ switch (_a.label) {
1603
+ case 0:
1604
+ return [4
1605
+ /*yield*/
1606
+ , this._semiAsyncStorage];
1465
1607
 
1466
- PostHog.initAsync = function () {
1467
- return preloadSemiAsyncStorage();
1608
+ case 1:
1609
+ _a.sent();
1610
+
1611
+ return [2
1612
+ /*return*/
1613
+ ];
1614
+ }
1615
+ });
1616
+ });
1468
1617
  };
1469
1618
 
1470
1619
  PostHog.prototype.getPersistedProperty = function (key) {
@@ -1472,7 +1621,7 @@ function (_super) {
1472
1621
  return this._memoryStorage.getProperty(key);
1473
1622
  }
1474
1623
 
1475
- return SemiAsyncStorage.getItem(key) || undefined;
1624
+ return this._semiAsyncStorage.getItem(key) || undefined;
1476
1625
  };
1477
1626
 
1478
1627
  PostHog.prototype.setPersistedProperty = function (key, value) {
@@ -1480,7 +1629,7 @@ function (_super) {
1480
1629
  return this._memoryStorage.setProperty(key, value);
1481
1630
  }
1482
1631
 
1483
- return value !== null ? SemiAsyncStorage.setItem(key, value) : SemiAsyncStorage.removeItem(key);
1632
+ return value !== null ? this._semiAsyncStorage.setItem(key, value) : this._semiAsyncStorage.removeItem(key);
1484
1633
  };
1485
1634
 
1486
1635
  PostHog.prototype.fetch = function (url, options) {
@@ -1500,20 +1649,10 @@ function (_super) {
1500
1649
  };
1501
1650
 
1502
1651
  PostHog.prototype.getCommonEventProperties = function () {
1503
- return __assign(__assign({}, _super.prototype.getCommonEventProperties.call(this)), {
1504
- $app_build: '1',
1505
- $app_name: ExpoApplication.applicationName,
1506
- $app_namespace: ExpoApplication.applicationId,
1507
- $app_version: ExpoApplication.nativeApplicationVersion,
1508
- $device_manufacturer: ExpoDevice.manufacturer,
1509
- $device_name: ExpoDevice.modelName,
1652
+ return __assign(__assign(__assign({}, _super.prototype.getCommonEventProperties.call(this)), this._appProperties), {
1510
1653
  $device_type: Platform.OS,
1511
- $locale: ExpoLocalization.locale,
1512
- $os_name: ExpoDevice.osName,
1513
- $os_version: ExpoDevice.osVersion,
1514
1654
  $screen_height: Dimensions.get('screen').height,
1515
- $screen_width: Dimensions.get('screen').width,
1516
- $timezone: ExpoLocalization.timezone
1655
+ $screen_width: Dimensions.get('screen').width
1517
1656
  });
1518
1657
  }; // Custom methods
1519
1658
 
@@ -1526,9 +1665,6 @@ function (_super) {
1526
1665
 
1527
1666
  return PostHog;
1528
1667
  }(PostHogCore);
1529
- // is used
1530
-
1531
- void PostHog.initAsync();
1532
1668
 
1533
1669
  var PostHogContext = /*#__PURE__*/React.createContext({
1534
1670
  client: undefined
@@ -1573,10 +1709,6 @@ function useLifecycleTracker(client) {
1573
1709
 
1574
1710
  var _OptionalReactNativeNavigation = undefined;
1575
1711
 
1576
- var warn = function (name) {
1577
- console.warn("PostHog: Missing ".concat(name, " optional dependency. Some functions may not work as expected..."));
1578
- };
1579
-
1580
1712
  try {
1581
1713
  _OptionalReactNativeNavigation = require('@react-navigation/native');
1582
1714
  } catch (e) {