@nagoorkani/session-capture-expo 0.1.2 → 0.1.4
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/README.md +19 -0
- package/dist/device.d.ts +53 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +103 -3
- package/dist/index.mjs +104 -4
- package/dist/store-expo.d.ts +5 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -41,6 +41,25 @@ foreground/background transitions are tracked, and errors — including unhandle
|
|
|
41
41
|
rejections — are captured without further wiring. Uncaught errors still reach
|
|
42
42
|
your own handlers: the SDK chains rather than replaces them.
|
|
43
43
|
|
|
44
|
+
### More device detail (optional)
|
|
45
|
+
|
|
46
|
+
Brand, model, screen, locale, timezone, OS and React Native version, and disk
|
|
47
|
+
space are sent with every session at no cost. Battery, memory, CPU
|
|
48
|
+
architectures, OS build, simulator flag, iOS model names and connection type
|
|
49
|
+
need Expo modules. Install whichever you want and pass them in:
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import * as Device from 'expo-device'
|
|
53
|
+
import * as Battery from 'expo-battery'
|
|
54
|
+
import * as Network from 'expo-network'
|
|
55
|
+
|
|
56
|
+
init({ /* ... */, modules: { device: Device, battery: Battery, network: Network } })
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
They are passed rather than detected, so the SDK depends on none of them.
|
|
60
|
+
Battery and connection are read after the session opens, and arrive as a
|
|
61
|
+
`device_context` event a moment later.
|
|
62
|
+
|
|
44
63
|
## Capturing
|
|
45
64
|
|
|
46
65
|
```ts
|
package/dist/device.d.ts
CHANGED
|
@@ -15,9 +15,61 @@
|
|
|
15
15
|
* This module is therefore device-only. Nothing importable by tests may import
|
|
16
16
|
* it: `core.ts` receives the context through a provider instead.
|
|
17
17
|
*/
|
|
18
|
+
type Fields = Record<string, string | number | boolean>;
|
|
18
19
|
export interface DeviceContext {
|
|
19
20
|
platform?: 'ios' | 'android';
|
|
20
21
|
osVersion?: string;
|
|
21
22
|
appVersion?: string;
|
|
23
|
+
deviceModel?: string;
|
|
24
|
+
/** Grouped detail the dashboard's Info tab renders as one card each. */
|
|
25
|
+
device?: Fields;
|
|
26
|
+
os?: Fields;
|
|
27
|
+
app?: Fields;
|
|
22
28
|
}
|
|
23
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Expo modules the host app passes in, if it has them installed:
|
|
31
|
+
*
|
|
32
|
+
* import * as Device from 'expo-device'
|
|
33
|
+
* import * as Battery from 'expo-battery'
|
|
34
|
+
* import * as Network from 'expo-network'
|
|
35
|
+
* init({ ..., modules: { device: Device, battery: Battery, network: Network } })
|
|
36
|
+
*
|
|
37
|
+
* Passed in rather than required by name. The SDK ships prebuilt, and an
|
|
38
|
+
* optional `require` of an uninstalled module is a bundler-dependent guess —
|
|
39
|
+
* the same class of silent-on-device failure `device.ts` already hit once.
|
|
40
|
+
* Typed structurally so none of the three is a dependency of the SDK.
|
|
41
|
+
*/
|
|
42
|
+
export interface DeviceModules {
|
|
43
|
+
device?: {
|
|
44
|
+
modelName?: string | null;
|
|
45
|
+
totalMemory?: number | null;
|
|
46
|
+
osBuildId?: string | null;
|
|
47
|
+
isDevice?: boolean;
|
|
48
|
+
supportedCpuArchitectures?: string[] | null;
|
|
49
|
+
deviceYearClass?: number | null;
|
|
50
|
+
};
|
|
51
|
+
battery?: {
|
|
52
|
+
getBatteryLevelAsync(): Promise<number>;
|
|
53
|
+
getBatteryStateAsync(): Promise<number>;
|
|
54
|
+
isLowPowerModeEnabledAsync?(): Promise<boolean>;
|
|
55
|
+
};
|
|
56
|
+
network?: {
|
|
57
|
+
getNetworkStateAsync(): Promise<{
|
|
58
|
+
type?: string;
|
|
59
|
+
isConnected?: boolean;
|
|
60
|
+
isInternetReachable?: boolean | null;
|
|
61
|
+
}>;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Battery and connection, which only have async APIs — so they cannot ride on
|
|
66
|
+
* `session_start`, which is captured synchronously the moment a session opens.
|
|
67
|
+
* They go out as a `device_context` event a moment later, and the dashboard
|
|
68
|
+
* merges it into the same cards.
|
|
69
|
+
*/
|
|
70
|
+
export declare function readDeviceState(modules: DeviceModules): Promise<DeviceContext | null>;
|
|
71
|
+
export declare function readDeviceContext(appVersion?: string, modules?: DeviceModules, storage?: {
|
|
72
|
+
freeBytes?: number;
|
|
73
|
+
totalBytes?: number;
|
|
74
|
+
}): DeviceContext;
|
|
75
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* installed here and unwound by `shutdown()`.
|
|
7
7
|
*/
|
|
8
8
|
import { type InitOptions, type RemoteConfig } from '@nagoorkani/session-capture-core';
|
|
9
|
+
import { type DeviceModules } from './device.ts';
|
|
9
10
|
export type { CaptureEvent, EventBatch, EventType, InitOptions, RemoteConfig, } from '@nagoorkani/session-capture-core';
|
|
10
11
|
export { SCHEMA_VERSION, DEFAULT_CONFIG } from '@nagoorkani/session-capture-core';
|
|
11
12
|
export { isSelfDisabled, safe, safeAsync } from '@nagoorkani/session-capture-core';
|
|
@@ -30,6 +31,11 @@ export { MemoryStore, type FileStore } from '@nagoorkani/session-capture-core';
|
|
|
30
31
|
export { isSampled } from '@nagoorkani/session-capture-core';
|
|
31
32
|
export { createPersistentStore } from './store-expo.ts';
|
|
32
33
|
export { SDK_VERSION } from '@nagoorkani/session-capture-core';
|
|
34
|
+
export type { DeviceModules } from './device.ts';
|
|
35
|
+
export interface ExpoInitOptions extends InitOptions {
|
|
36
|
+
/** Optional Expo modules for battery, memory, connection and more in the Info tab. */
|
|
37
|
+
modules?: DeviceModules;
|
|
38
|
+
}
|
|
33
39
|
export type { Breadcrumb } from '@nagoorkani/session-capture-core';
|
|
34
40
|
export type { CapturedError } from '@nagoorkani/session-capture-core';
|
|
35
41
|
export type { NetworkEvent } from '@nagoorkani/session-capture-core';
|
|
@@ -39,7 +45,7 @@ export type { NetworkEvent } from '@nagoorkani/session-capture-core';
|
|
|
39
45
|
* Pass `enabled: false` to initialize without capturing, then `setEnabled(true)`
|
|
40
46
|
* once the user consents. Nothing is captured *or* buffered while disabled.
|
|
41
47
|
*/
|
|
42
|
-
export declare const init: (options:
|
|
48
|
+
export declare const init: (options: ExpoInitOptions) => void | undefined;
|
|
43
49
|
/** Enable or disable capture at runtime. The consent gate. */
|
|
44
50
|
export declare const setEnabled: (enabled: boolean) => void | undefined;
|
|
45
51
|
/** Whether the SDK is currently capturing. */
|
package/dist/index.js
CHANGED
|
@@ -574,7 +574,7 @@ var SessionManager = class {
|
|
|
574
574
|
};
|
|
575
575
|
|
|
576
576
|
// ../core/src/core.ts
|
|
577
|
-
var SDK_VERSION = "0.1.
|
|
577
|
+
var SDK_VERSION = "0.1.3";
|
|
578
578
|
var SESSION_TIMEOUT_MS = 30 * 60 * 1e3;
|
|
579
579
|
var ALWAYS_CAPTURED = /* @__PURE__ */ new Set([
|
|
580
580
|
"error"
|
|
@@ -1553,7 +1553,71 @@ var MemoryStore = class {
|
|
|
1553
1553
|
|
|
1554
1554
|
// src/device.ts
|
|
1555
1555
|
var import_react_native = require("react-native");
|
|
1556
|
-
function
|
|
1556
|
+
function compact(fields) {
|
|
1557
|
+
const out = {};
|
|
1558
|
+
for (const [name, value] of Object.entries(fields)) {
|
|
1559
|
+
if (typeof value === "string" ? value : typeof value === "number" || typeof value === "boolean") {
|
|
1560
|
+
out[name] = value;
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
return out;
|
|
1564
|
+
}
|
|
1565
|
+
function readDetail(context) {
|
|
1566
|
+
const constants = import_react_native.Platform.constants ?? {};
|
|
1567
|
+
const screen2 = import_react_native.Dimensions.get("screen");
|
|
1568
|
+
const rn = constants.reactNativeVersion;
|
|
1569
|
+
const intl = Intl.DateTimeFormat().resolvedOptions();
|
|
1570
|
+
if (typeof constants.Model === "string") context.deviceModel = constants.Model.slice(0, 64);
|
|
1571
|
+
context.device = compact({
|
|
1572
|
+
brand: constants.Brand,
|
|
1573
|
+
manufacturer: constants.Manufacturer,
|
|
1574
|
+
model: constants.Model,
|
|
1575
|
+
family: constants.interfaceIdiom,
|
|
1576
|
+
screenWidthPixels: Math.round(screen2.width * screen2.scale),
|
|
1577
|
+
screenHeightPixels: Math.round(screen2.height * screen2.scale),
|
|
1578
|
+
screenDensity: screen2.scale,
|
|
1579
|
+
fontScale: screen2.fontScale,
|
|
1580
|
+
orientation: screen2.width > screen2.height ? "landscape" : "portrait",
|
|
1581
|
+
colorScheme: import_react_native.Appearance.getColorScheme() ?? void 0,
|
|
1582
|
+
locale: intl.locale,
|
|
1583
|
+
timezone: intl.timeZone
|
|
1584
|
+
});
|
|
1585
|
+
context.os = compact({
|
|
1586
|
+
name: constants.systemName ?? (import_react_native.Platform.OS === "android" ? "Android" : void 0),
|
|
1587
|
+
version: constants.Release ?? constants.osVersion,
|
|
1588
|
+
apiLevel: import_react_native.Platform.OS === "android" ? import_react_native.Platform.Version : void 0
|
|
1589
|
+
});
|
|
1590
|
+
context.app = compact({
|
|
1591
|
+
version: context.appVersion,
|
|
1592
|
+
reactNative: rn ? `${rn.major}.${rn.minor}.${rn.patch}` : void 0,
|
|
1593
|
+
jsEngine: "HermesInternal" in globalThis ? "hermes" : "jsc"
|
|
1594
|
+
});
|
|
1595
|
+
}
|
|
1596
|
+
var PLUGGED_IN = [2, 3];
|
|
1597
|
+
async function readDeviceState(modules) {
|
|
1598
|
+
const device = {};
|
|
1599
|
+
const { battery, network } = modules;
|
|
1600
|
+
if (battery) {
|
|
1601
|
+
const [level, state, lowPower] = await Promise.all([
|
|
1602
|
+
battery.getBatteryLevelAsync().catch(() => -1),
|
|
1603
|
+
battery.getBatteryStateAsync().catch(() => 0),
|
|
1604
|
+
battery.isLowPowerModeEnabledAsync?.().catch(() => void 0)
|
|
1605
|
+
]);
|
|
1606
|
+
if (level >= 0) device.batteryPercent = Math.round(level * 100);
|
|
1607
|
+
if (state) device.charging = PLUGGED_IN.includes(state);
|
|
1608
|
+
device.lowPowerMode = lowPower;
|
|
1609
|
+
}
|
|
1610
|
+
if (network) {
|
|
1611
|
+
const net = await network.getNetworkStateAsync().catch(() => null);
|
|
1612
|
+
if (net) {
|
|
1613
|
+
device.connectionType = net.type?.toLowerCase();
|
|
1614
|
+
device.online = net.isInternetReachable ?? net.isConnected;
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
const fields = compact(device);
|
|
1618
|
+
return Object.keys(fields).length ? { device: fields } : null;
|
|
1619
|
+
}
|
|
1620
|
+
function readDeviceContext(appVersion, modules = {}, storage) {
|
|
1557
1621
|
const context = {};
|
|
1558
1622
|
if (appVersion) {
|
|
1559
1623
|
context.appVersion = appVersion;
|
|
@@ -1564,6 +1628,28 @@ function readDeviceContext(appVersion) {
|
|
|
1564
1628
|
if (import_react_native.Platform.Version !== void 0 && import_react_native.Platform.Version !== null) {
|
|
1565
1629
|
context.osVersion = String(import_react_native.Platform.Version);
|
|
1566
1630
|
}
|
|
1631
|
+
try {
|
|
1632
|
+
readDetail(context);
|
|
1633
|
+
const d = modules.device;
|
|
1634
|
+
if (d) {
|
|
1635
|
+
Object.assign(context.device, compact({
|
|
1636
|
+
// iOS has no model name in React Native; expo-device maps it ("iPhone 15").
|
|
1637
|
+
model: d.modelName ?? context.device.model,
|
|
1638
|
+
simulator: d.isDevice === void 0 ? void 0 : !d.isDevice,
|
|
1639
|
+
memorySizeBytes: d.totalMemory,
|
|
1640
|
+
architectures: d.supportedCpuArchitectures?.join(", "),
|
|
1641
|
+
yearClass: d.deviceYearClass
|
|
1642
|
+
}));
|
|
1643
|
+
Object.assign(context.os, compact({ build: d.osBuildId }));
|
|
1644
|
+
}
|
|
1645
|
+
if (storage) {
|
|
1646
|
+
Object.assign(context.device, compact({
|
|
1647
|
+
storageSizeBytes: storage.totalBytes,
|
|
1648
|
+
freeStorageBytes: storage.freeBytes
|
|
1649
|
+
}));
|
|
1650
|
+
}
|
|
1651
|
+
} catch {
|
|
1652
|
+
}
|
|
1567
1653
|
return context;
|
|
1568
1654
|
}
|
|
1569
1655
|
|
|
@@ -1610,6 +1696,13 @@ function createPersistentStore(directory = QUEUE_DIR) {
|
|
|
1610
1696
|
return null;
|
|
1611
1697
|
}
|
|
1612
1698
|
}
|
|
1699
|
+
function readStorage() {
|
|
1700
|
+
try {
|
|
1701
|
+
return { freeBytes: import_expo_file_system.Paths.availableDiskSpace, totalBytes: import_expo_file_system.Paths.totalDiskSpace };
|
|
1702
|
+
} catch {
|
|
1703
|
+
return void 0;
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1613
1706
|
|
|
1614
1707
|
// src/lifecycle.ts
|
|
1615
1708
|
var import_react_native2 = require("react-native");
|
|
@@ -1707,8 +1800,15 @@ var init = safe((options) => {
|
|
|
1707
1800
|
await queue?.enqueue(batch);
|
|
1708
1801
|
void dispatcher?.drain();
|
|
1709
1802
|
},
|
|
1710
|
-
deviceContext: () => ({ ...readDeviceContext(options.appVersion) })
|
|
1803
|
+
deviceContext: () => ({ ...readDeviceContext(options.appVersion, options.modules, readStorage()) })
|
|
1711
1804
|
});
|
|
1805
|
+
const modules = options.modules;
|
|
1806
|
+
if (modules?.battery || modules?.network) {
|
|
1807
|
+
core.onSession(() => {
|
|
1808
|
+
void readDeviceState(modules).then((state) => state && core?.capture("device_context", { ...state })).catch(() => {
|
|
1809
|
+
});
|
|
1810
|
+
});
|
|
1811
|
+
}
|
|
1712
1812
|
core.init(options);
|
|
1713
1813
|
void bootstrapConfig(options).catch(() => {
|
|
1714
1814
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -522,7 +522,7 @@ var SessionManager = class {
|
|
|
522
522
|
};
|
|
523
523
|
|
|
524
524
|
// ../core/src/core.ts
|
|
525
|
-
var SDK_VERSION = "0.1.
|
|
525
|
+
var SDK_VERSION = "0.1.3";
|
|
526
526
|
var SESSION_TIMEOUT_MS = 30 * 60 * 1e3;
|
|
527
527
|
var ALWAYS_CAPTURED = /* @__PURE__ */ new Set([
|
|
528
528
|
"error"
|
|
@@ -1500,8 +1500,72 @@ var MemoryStore = class {
|
|
|
1500
1500
|
};
|
|
1501
1501
|
|
|
1502
1502
|
// src/device.ts
|
|
1503
|
-
import { Platform } from "react-native";
|
|
1504
|
-
function
|
|
1503
|
+
import { Appearance, Dimensions, Platform } from "react-native";
|
|
1504
|
+
function compact(fields) {
|
|
1505
|
+
const out = {};
|
|
1506
|
+
for (const [name, value] of Object.entries(fields)) {
|
|
1507
|
+
if (typeof value === "string" ? value : typeof value === "number" || typeof value === "boolean") {
|
|
1508
|
+
out[name] = value;
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
return out;
|
|
1512
|
+
}
|
|
1513
|
+
function readDetail(context) {
|
|
1514
|
+
const constants = Platform.constants ?? {};
|
|
1515
|
+
const screen2 = Dimensions.get("screen");
|
|
1516
|
+
const rn = constants.reactNativeVersion;
|
|
1517
|
+
const intl = Intl.DateTimeFormat().resolvedOptions();
|
|
1518
|
+
if (typeof constants.Model === "string") context.deviceModel = constants.Model.slice(0, 64);
|
|
1519
|
+
context.device = compact({
|
|
1520
|
+
brand: constants.Brand,
|
|
1521
|
+
manufacturer: constants.Manufacturer,
|
|
1522
|
+
model: constants.Model,
|
|
1523
|
+
family: constants.interfaceIdiom,
|
|
1524
|
+
screenWidthPixels: Math.round(screen2.width * screen2.scale),
|
|
1525
|
+
screenHeightPixels: Math.round(screen2.height * screen2.scale),
|
|
1526
|
+
screenDensity: screen2.scale,
|
|
1527
|
+
fontScale: screen2.fontScale,
|
|
1528
|
+
orientation: screen2.width > screen2.height ? "landscape" : "portrait",
|
|
1529
|
+
colorScheme: Appearance.getColorScheme() ?? void 0,
|
|
1530
|
+
locale: intl.locale,
|
|
1531
|
+
timezone: intl.timeZone
|
|
1532
|
+
});
|
|
1533
|
+
context.os = compact({
|
|
1534
|
+
name: constants.systemName ?? (Platform.OS === "android" ? "Android" : void 0),
|
|
1535
|
+
version: constants.Release ?? constants.osVersion,
|
|
1536
|
+
apiLevel: Platform.OS === "android" ? Platform.Version : void 0
|
|
1537
|
+
});
|
|
1538
|
+
context.app = compact({
|
|
1539
|
+
version: context.appVersion,
|
|
1540
|
+
reactNative: rn ? `${rn.major}.${rn.minor}.${rn.patch}` : void 0,
|
|
1541
|
+
jsEngine: "HermesInternal" in globalThis ? "hermes" : "jsc"
|
|
1542
|
+
});
|
|
1543
|
+
}
|
|
1544
|
+
var PLUGGED_IN = [2, 3];
|
|
1545
|
+
async function readDeviceState(modules) {
|
|
1546
|
+
const device = {};
|
|
1547
|
+
const { battery, network } = modules;
|
|
1548
|
+
if (battery) {
|
|
1549
|
+
const [level, state, lowPower] = await Promise.all([
|
|
1550
|
+
battery.getBatteryLevelAsync().catch(() => -1),
|
|
1551
|
+
battery.getBatteryStateAsync().catch(() => 0),
|
|
1552
|
+
battery.isLowPowerModeEnabledAsync?.().catch(() => void 0)
|
|
1553
|
+
]);
|
|
1554
|
+
if (level >= 0) device.batteryPercent = Math.round(level * 100);
|
|
1555
|
+
if (state) device.charging = PLUGGED_IN.includes(state);
|
|
1556
|
+
device.lowPowerMode = lowPower;
|
|
1557
|
+
}
|
|
1558
|
+
if (network) {
|
|
1559
|
+
const net = await network.getNetworkStateAsync().catch(() => null);
|
|
1560
|
+
if (net) {
|
|
1561
|
+
device.connectionType = net.type?.toLowerCase();
|
|
1562
|
+
device.online = net.isInternetReachable ?? net.isConnected;
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
const fields = compact(device);
|
|
1566
|
+
return Object.keys(fields).length ? { device: fields } : null;
|
|
1567
|
+
}
|
|
1568
|
+
function readDeviceContext(appVersion, modules = {}, storage) {
|
|
1505
1569
|
const context = {};
|
|
1506
1570
|
if (appVersion) {
|
|
1507
1571
|
context.appVersion = appVersion;
|
|
@@ -1512,6 +1576,28 @@ function readDeviceContext(appVersion) {
|
|
|
1512
1576
|
if (Platform.Version !== void 0 && Platform.Version !== null) {
|
|
1513
1577
|
context.osVersion = String(Platform.Version);
|
|
1514
1578
|
}
|
|
1579
|
+
try {
|
|
1580
|
+
readDetail(context);
|
|
1581
|
+
const d = modules.device;
|
|
1582
|
+
if (d) {
|
|
1583
|
+
Object.assign(context.device, compact({
|
|
1584
|
+
// iOS has no model name in React Native; expo-device maps it ("iPhone 15").
|
|
1585
|
+
model: d.modelName ?? context.device.model,
|
|
1586
|
+
simulator: d.isDevice === void 0 ? void 0 : !d.isDevice,
|
|
1587
|
+
memorySizeBytes: d.totalMemory,
|
|
1588
|
+
architectures: d.supportedCpuArchitectures?.join(", "),
|
|
1589
|
+
yearClass: d.deviceYearClass
|
|
1590
|
+
}));
|
|
1591
|
+
Object.assign(context.os, compact({ build: d.osBuildId }));
|
|
1592
|
+
}
|
|
1593
|
+
if (storage) {
|
|
1594
|
+
Object.assign(context.device, compact({
|
|
1595
|
+
storageSizeBytes: storage.totalBytes,
|
|
1596
|
+
freeStorageBytes: storage.freeBytes
|
|
1597
|
+
}));
|
|
1598
|
+
}
|
|
1599
|
+
} catch {
|
|
1600
|
+
}
|
|
1515
1601
|
return context;
|
|
1516
1602
|
}
|
|
1517
1603
|
|
|
@@ -1558,6 +1644,13 @@ function createPersistentStore(directory = QUEUE_DIR) {
|
|
|
1558
1644
|
return null;
|
|
1559
1645
|
}
|
|
1560
1646
|
}
|
|
1647
|
+
function readStorage() {
|
|
1648
|
+
try {
|
|
1649
|
+
return { freeBytes: Paths.availableDiskSpace, totalBytes: Paths.totalDiskSpace };
|
|
1650
|
+
} catch {
|
|
1651
|
+
return void 0;
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1561
1654
|
|
|
1562
1655
|
// src/lifecycle.ts
|
|
1563
1656
|
import { AppState } from "react-native";
|
|
@@ -1655,8 +1748,15 @@ var init = safe((options) => {
|
|
|
1655
1748
|
await queue?.enqueue(batch);
|
|
1656
1749
|
void dispatcher?.drain();
|
|
1657
1750
|
},
|
|
1658
|
-
deviceContext: () => ({ ...readDeviceContext(options.appVersion) })
|
|
1751
|
+
deviceContext: () => ({ ...readDeviceContext(options.appVersion, options.modules, readStorage()) })
|
|
1659
1752
|
});
|
|
1753
|
+
const modules = options.modules;
|
|
1754
|
+
if (modules?.battery || modules?.network) {
|
|
1755
|
+
core.onSession(() => {
|
|
1756
|
+
void readDeviceState(modules).then((state) => state && core?.capture("device_context", { ...state })).catch(() => {
|
|
1757
|
+
});
|
|
1758
|
+
});
|
|
1759
|
+
}
|
|
1660
1760
|
core.init(options);
|
|
1661
1761
|
void bootstrapConfig(options).catch(() => {
|
|
1662
1762
|
});
|
package/dist/store-expo.d.ts
CHANGED
|
@@ -33,3 +33,8 @@ export declare class ExpoFileStore implements FileStore {
|
|
|
33
33
|
* bad as refusing to run inside someone else's application.
|
|
34
34
|
*/
|
|
35
35
|
export declare function createPersistentStore(directory?: string): FileStore | null;
|
|
36
|
+
/** Disk capacity for the Info tab. Sync in the current file-system API. */
|
|
37
|
+
export declare function readStorage(): {
|
|
38
|
+
freeBytes?: number;
|
|
39
|
+
totalBytes?: number;
|
|
40
|
+
} | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nagoorkani/session-capture-expo",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Lightweight session capture and observability for Expo / React Native",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"analytics"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@nagoorkani/session-capture-core": "^0.1.
|
|
23
|
+
"@nagoorkani/session-capture-core": "^0.1.3"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"expo": ">=50",
|