@goliapkg/sentori-react-native 0.7.2 → 0.7.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/android/src/main/java/com/sentori/SentoriModule.kt +10 -0
- package/android/src/main/java/com/sentori/SentoriScreenshotCapture.kt +60 -2
- package/ios/SentoriModule.swift +10 -0
- package/ios/SentoriScreenshotCapture.swift +76 -2
- package/lib/capture.d.ts.map +1 -1
- package/lib/capture.js +23 -1
- package/lib/capture.js.map +1 -1
- package/lib/handlers/screenshot.d.ts +3 -2
- package/lib/handlers/screenshot.d.ts.map +1 -1
- package/lib/handlers/screenshot.js +47 -94
- package/lib/handlers/screenshot.js.map +1 -1
- package/lib/index.d.ts +4 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -5
- package/lib/index.js.map +1 -1
- package/lib/init.d.ts +8 -4
- package/lib/init.d.ts.map +1 -1
- package/lib/init.js +5 -0
- package/lib/init.js.map +1 -1
- package/lib/mask.d.ts +11 -47
- package/lib/mask.d.ts.map +1 -1
- package/lib/mask.js +27 -116
- package/lib/mask.js.map +1 -1
- package/lib/native.d.ts +15 -0
- package/lib/native.d.ts.map +1 -1
- package/lib/native.js +22 -0
- package/lib/native.js.map +1 -1
- package/lib/navigation.d.ts.map +1 -1
- package/lib/navigation.js +33 -9
- package/lib/navigation.js.map +1 -1
- package/lib/netinfo.d.ts +14 -0
- package/lib/netinfo.d.ts.map +1 -0
- package/lib/netinfo.js +70 -0
- package/lib/netinfo.js.map +1 -0
- package/package.json +7 -8
- package/src/__tests__/screenshot.test.ts +6 -8
- package/src/capture.ts +26 -1
- package/src/handlers/screenshot.ts +46 -117
- package/src/index.ts +4 -5
- package/src/init.ts +13 -4
- package/src/mask.ts +41 -0
- package/src/native.ts +35 -0
- package/src/navigation.ts +37 -9
- package/src/netinfo.ts +81 -0
- package/src/mask.tsx +0 -150
package/lib/init.js
CHANGED
|
@@ -4,6 +4,7 @@ import { installLifecycleHandler } from './handlers/lifecycle';
|
|
|
4
4
|
import { installPromiseHandler } from './handlers/promise';
|
|
5
5
|
import { installNetworkHandler } from './handlers/network';
|
|
6
6
|
import { drainNativePending, setNativeConfig } from './native';
|
|
7
|
+
import { startNetworkTypeWatch } from './netinfo';
|
|
7
8
|
import { startSession } from './session-tracker';
|
|
8
9
|
import { drainOfflineQueue, enqueue, startTransport, uploadAttachment, } from './transport';
|
|
9
10
|
const DEFAULT_INGEST_URL = 'https://ingest.sentori.golia.jp';
|
|
@@ -35,6 +36,10 @@ export const init = (options) => {
|
|
|
35
36
|
environment: env,
|
|
36
37
|
});
|
|
37
38
|
startTransport();
|
|
39
|
+
// v0.8.0-c — start watching network class. No-op if NetInfo isn't
|
|
40
|
+
// installed; events just won't carry `device.networkType` in that
|
|
41
|
+
// case.
|
|
42
|
+
startNetworkTypeWatch();
|
|
38
43
|
const capture = options.capture ?? {};
|
|
39
44
|
if (capture.globalErrors !== false)
|
|
40
45
|
installGlobalHandler();
|
package/lib/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EACL,iBAAiB,EACjB,OAAO,EACP,cAAc,EACd,gBAAgB,GACjB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":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gBACF,8DAA8D;gBAC9D,2DAA2D;gBAC3D,0DAA0D;gBAC1D,6DAA6D;gBAC7D,2DAA2D;gBAC3D,IAAI,KAAK,CAAC,mBAAmB,IAAI,KAAK,CAAC,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACtE,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,EAAE,CAAC;wBAC1C,MAAM,IAAI,GAAG,MAAM,gBAAgB,CACjC,KAAK,CAAC,EAAE,EACR,CAAC,CAAC,IAAI,EACN,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,EAC5C,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CACrB,CAAC;wBACF,IAAI,IAAI,EAAE,CAAC;4BACT,IAAI,CAAC,KAAK,CAAC,WAAW;gCAAE,KAAK,CAAC,WAAW,GAAG,EAAE,CAAC;4BAC/C,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;wBAC/B,CAAC;oBACH,CAAC;oBACD,OAAO,KAAK,CAAC,mBAAmB,CAAC;gBACnC,CAAC;gBACD,OAAO,CAAC,KAAK,CAAC,CAAC;YACjB,CAAC;YAAC,MAAM,CAAC;gBACP,iBAAiB;YACnB,CAAC;QACH,CAAC;IACH,CAAC,CAAC;SACD,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACnB,iBAAiB,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AACtC,CAAC,CAAC"}
|
package/lib/mask.d.ts
CHANGED
|
@@ -1,52 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
import { type ViewProps } from 'react-native';
|
|
3
|
-
/** What we drive in the capture window: any handle with
|
|
4
|
-
* `setNativeProps({ opacity })`. RN's View instance satisfies this. */
|
|
5
|
-
type Maskable = {
|
|
6
|
-
setNativeProps?: (props: {
|
|
7
|
-
style?: {
|
|
8
|
-
opacity?: number;
|
|
9
|
-
};
|
|
10
|
-
}) => void;
|
|
11
|
-
};
|
|
1
|
+
type MaskQuery = () => string[];
|
|
12
2
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
|
|
16
|
-
export declare function setMaskedNode(node: null | Maskable | unknown): void;
|
|
17
|
-
export declare function unsetMaskedNode(node: null | Maskable | unknown): void;
|
|
18
|
-
/** Returns the current set of registered masked nodes + nativeIDs.
|
|
19
|
-
* Read by the native screenshotter layer (iOS / Android sub-E / F). */
|
|
20
|
-
export declare function getMaskedRegions(): {
|
|
21
|
-
nativeIds: Set<string>;
|
|
22
|
-
overlays: Set<Maskable>;
|
|
23
|
-
refs: Set<Maskable>;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Phase 48 sub-B — engage masking right before screenshot capture.
|
|
27
|
-
* Returns a function the caller must invoke once capture is done so
|
|
28
|
-
* the user never sees the black overlays.
|
|
29
|
-
*
|
|
30
|
-
* Two paths:
|
|
31
|
-
* - Overlays from `<MaskRegion>`: flip opacity 0 → 1 (cover children).
|
|
32
|
-
* - Imperative refs from `setMaskedNode`: flip opacity 1 → 0 on the
|
|
33
|
-
* view itself (whole subtree disappears for one frame).
|
|
3
|
+
* Register a callback the SDK calls right before each screenshot
|
|
4
|
+
* capture. Return the native-IDs (the `nativeID` prop on the RN
|
|
5
|
+
* `<View>`) that should be blacked-out in the captured image.
|
|
34
6
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*/
|
|
38
|
-
export declare function engageMasks(): () => void;
|
|
39
|
-
/**
|
|
40
|
-
* Declarative redaction. `<MaskRegion>{children}</MaskRegion>` keeps
|
|
41
|
-
* the children visible in normal flight; under capture the overlay's
|
|
42
|
-
* opacity is flipped to 1 and the children are hidden behind a black
|
|
43
|
-
* square in the rendered screenshot.
|
|
7
|
+
* Idempotent: a second call replaces the first. Pass `null` (or
|
|
8
|
+
* call `clearMaskQuery`) to detach.
|
|
44
9
|
*/
|
|
45
|
-
export declare function
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
export declare function __resetMaskedRegionsForTests(): void;
|
|
10
|
+
export declare function registerMaskQuery(query: MaskQuery): void;
|
|
11
|
+
/** Unregister. Mostly for tests / teardown. */
|
|
12
|
+
export declare function clearMaskQuery(): void;
|
|
13
|
+
/** Internal — read by `handlers/screenshot.ts` at capture time. */
|
|
14
|
+
export declare function getRegisteredMaskQuery(): MaskQuery | null;
|
|
51
15
|
export {};
|
|
52
16
|
//# sourceMappingURL=mask.d.ts.map
|
package/lib/mask.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mask.d.ts","sourceRoot":"","sources":["../src/mask.
|
|
1
|
+
{"version":3,"file":"mask.d.ts","sourceRoot":"","sources":["../src/mask.ts"],"names":[],"mappings":"AAgBA,KAAK,SAAS,GAAG,MAAM,MAAM,EAAE,CAAC;AAIhC;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAExD;AAED,+CAA+C;AAC/C,wBAAgB,cAAc,IAAI,IAAI,CAErC;AAED,mEAAmE;AACnE,wBAAgB,sBAAsB,IAAI,SAAS,GAAG,IAAI,CAEzD"}
|
package/lib/mask.js
CHANGED
|
@@ -1,125 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
// Phase 42 sub-D.09/10 + Phase 48 sub-B — mark UI regions as "do not
|
|
3
|
-
// screenshot" AND actually redact them at capture time.
|
|
1
|
+
// v0.7.3 — mask discovery via consumer-supplied query callback.
|
|
4
2
|
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// user never sees the overlay. The overlay uses `pointerEvents="none"`
|
|
11
|
-
// so it never intercepts touches.
|
|
3
|
+
// The SDK does not own a registry of masked regions. The host app
|
|
4
|
+
// keeps its own (e.g. a `Set<string>` updated as `<Maskable>`
|
|
5
|
+
// components mount/unmount) and hands the SDK a thunk that returns
|
|
6
|
+
// the current list of native-IDs to redact. The SDK calls the thunk
|
|
7
|
+
// once per screenshot capture — cheap, called rarely, only on error.
|
|
12
8
|
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const _maskedRefs = new Set();
|
|
22
|
-
const _maskedOverlays = new Set();
|
|
23
|
-
const _maskedNativeIds = new Set();
|
|
9
|
+
// Why this shape: a logging SDK should never live on the render
|
|
10
|
+
// path. Earlier iterations exported `<MaskRegion>` (React component)
|
|
11
|
+
// and `setMaskedNode` (imperative ref helper), which forced every
|
|
12
|
+
// PII-bearing UI file to import from the SDK and put SDK bugs in
|
|
13
|
+
// the user's render tree. This module is JS-only — no React, no JSX,
|
|
14
|
+
// no native module touch — so swapping or removing the SDK doesn't
|
|
15
|
+
// affect rendering.
|
|
16
|
+
let _query = null;
|
|
24
17
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
|
|
28
|
-
export function setMaskedNode(node) {
|
|
29
|
-
if (!node || typeof node.setNativeProps !== 'function')
|
|
30
|
-
return;
|
|
31
|
-
_maskedRefs.add(node);
|
|
32
|
-
}
|
|
33
|
-
export function unsetMaskedNode(node) {
|
|
34
|
-
if (!node)
|
|
35
|
-
return;
|
|
36
|
-
_maskedRefs.delete(node);
|
|
37
|
-
}
|
|
38
|
-
/** Returns the current set of registered masked nodes + nativeIDs.
|
|
39
|
-
* Read by the native screenshotter layer (iOS / Android sub-E / F). */
|
|
40
|
-
export function getMaskedRegions() {
|
|
41
|
-
return { nativeIds: _maskedNativeIds, overlays: _maskedOverlays, refs: _maskedRefs };
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Phase 48 sub-B — engage masking right before screenshot capture.
|
|
45
|
-
* Returns a function the caller must invoke once capture is done so
|
|
46
|
-
* the user never sees the black overlays.
|
|
47
|
-
*
|
|
48
|
-
* Two paths:
|
|
49
|
-
* - Overlays from `<MaskRegion>`: flip opacity 0 → 1 (cover children).
|
|
50
|
-
* - Imperative refs from `setMaskedNode`: flip opacity 1 → 0 on the
|
|
51
|
-
* view itself (whole subtree disappears for one frame).
|
|
18
|
+
* Register a callback the SDK calls right before each screenshot
|
|
19
|
+
* capture. Return the native-IDs (the `nativeID` prop on the RN
|
|
20
|
+
* `<View>`) that should be blacked-out in the captured image.
|
|
52
21
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
22
|
+
* Idempotent: a second call replaces the first. Pass `null` (or
|
|
23
|
+
* call `clearMaskQuery`) to detach.
|
|
55
24
|
*/
|
|
56
|
-
export function
|
|
57
|
-
|
|
58
|
-
for (const o of _maskedOverlays) {
|
|
59
|
-
try {
|
|
60
|
-
o.setNativeProps?.({ style: { opacity: 1 } });
|
|
61
|
-
overlaysEngaged.push(o);
|
|
62
|
-
}
|
|
63
|
-
catch {
|
|
64
|
-
// skip
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
const refsEngaged = [];
|
|
68
|
-
for (const r of _maskedRefs) {
|
|
69
|
-
try {
|
|
70
|
-
r.setNativeProps?.({ style: { opacity: 0 } });
|
|
71
|
-
refsEngaged.push(r);
|
|
72
|
-
}
|
|
73
|
-
catch {
|
|
74
|
-
// skip
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return () => {
|
|
78
|
-
for (const o of overlaysEngaged) {
|
|
79
|
-
try {
|
|
80
|
-
o.setNativeProps?.({ style: { opacity: 0 } });
|
|
81
|
-
}
|
|
82
|
-
catch {
|
|
83
|
-
// skip
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
for (const r of refsEngaged) {
|
|
87
|
-
try {
|
|
88
|
-
r.setNativeProps?.({ style: { opacity: 1 } });
|
|
89
|
-
}
|
|
90
|
-
catch {
|
|
91
|
-
// skip
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
};
|
|
25
|
+
export function registerMaskQuery(query) {
|
|
26
|
+
_query = query;
|
|
95
27
|
}
|
|
96
|
-
/**
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
* opacity is flipped to 1 and the children are hidden behind a black
|
|
100
|
-
* square in the rendered screenshot.
|
|
101
|
-
*/
|
|
102
|
-
export function MaskRegion({ children, nativeID, ...rest }) {
|
|
103
|
-
const idRef = useRef(nativeID ?? `sentori-mask-${Math.random().toString(36).slice(2, 10)}`);
|
|
104
|
-
const overlayRef = useRef(null);
|
|
105
|
-
useEffect(() => {
|
|
106
|
-
const id = idRef.current;
|
|
107
|
-
_maskedNativeIds.add(id);
|
|
108
|
-
const overlay = overlayRef.current;
|
|
109
|
-
if (overlay)
|
|
110
|
-
_maskedOverlays.add(overlay);
|
|
111
|
-
return () => {
|
|
112
|
-
_maskedNativeIds.delete(id);
|
|
113
|
-
if (overlay)
|
|
114
|
-
_maskedOverlays.delete(overlay);
|
|
115
|
-
};
|
|
116
|
-
}, []);
|
|
117
|
-
return (_jsxs(View, { collapsable: false, nativeID: idRef.current, ...rest, children: [children, _jsx(View, { pointerEvents: "none", ref: overlayRef, style: [StyleSheet.absoluteFill, { backgroundColor: '#000', opacity: 0 }] })] }));
|
|
28
|
+
/** Unregister. Mostly for tests / teardown. */
|
|
29
|
+
export function clearMaskQuery() {
|
|
30
|
+
_query = null;
|
|
118
31
|
}
|
|
119
|
-
/**
|
|
120
|
-
export function
|
|
121
|
-
|
|
122
|
-
_maskedOverlays.clear();
|
|
123
|
-
_maskedNativeIds.clear();
|
|
32
|
+
/** Internal — read by `handlers/screenshot.ts` at capture time. */
|
|
33
|
+
export function getRegisteredMaskQuery() {
|
|
34
|
+
return _query;
|
|
124
35
|
}
|
|
125
36
|
//# sourceMappingURL=mask.js.map
|
package/lib/mask.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mask.js","sourceRoot":"","sources":["../src/mask.
|
|
1
|
+
{"version":3,"file":"mask.js","sourceRoot":"","sources":["../src/mask.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,EAAE;AACF,kEAAkE;AAClE,8DAA8D;AAC9D,mEAAmE;AACnE,oEAAoE;AACpE,qEAAqE;AACrE,EAAE;AACF,gEAAgE;AAChE,qEAAqE;AACrE,kEAAkE;AAClE,iEAAiE;AACjE,qEAAqE;AACrE,mEAAmE;AACnE,oBAAoB;AAIpB,IAAI,MAAM,GAAqB,IAAI,CAAC;AAEpC;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAgB;IAChD,MAAM,GAAG,KAAK,CAAC;AACjB,CAAC;AAED,+CAA+C;AAC/C,MAAM,UAAU,cAAc;IAC5B,MAAM,GAAG,IAAI,CAAC;AAChB,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,sBAAsB;IACpC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/lib/native.d.ts
CHANGED
|
@@ -37,4 +37,19 @@ export declare function startAnrWatchdog(options?: {
|
|
|
37
37
|
timeoutMs?: number;
|
|
38
38
|
}): void;
|
|
39
39
|
export declare function stopAnrWatchdog(): void;
|
|
40
|
+
/**
|
|
41
|
+
* v0.7.3 — drives the native screenshot path. JS side passes the
|
|
42
|
+
* current list of mask `nativeID`s (read from the consumer's
|
|
43
|
+
* registered mask query); native renders + redacts.
|
|
44
|
+
*
|
|
45
|
+
* Returns `null` on every failure mode: no native module bound
|
|
46
|
+
* (jest, bun test, web), method missing (older native build still
|
|
47
|
+
* deployed), capture failed (no key window, timed out, etc.).
|
|
48
|
+
* Callers must treat `null` as "no screenshot this round" — the
|
|
49
|
+
* error event still ships, just without a thumbnail.
|
|
50
|
+
*/
|
|
51
|
+
export declare function captureNativeScreenshotWithMask(maskedIds: string[]): Promise<null | {
|
|
52
|
+
base64: string;
|
|
53
|
+
mediaType: string;
|
|
54
|
+
}>;
|
|
40
55
|
//# sourceMappingURL=native.d.ts.map
|
package/lib/native.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAsDH,wBAAgB,eAAe,CAAC,MAAM,EAAE;IACtC,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd,GAAG,IAAI,CAMP;AAED,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAQ5D;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAMzC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE;IACzC,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,GAAG,IAAI,CAMP;AAED,wBAAgB,eAAe,IAAI,IAAI,CAMtC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,+BAA+B,CACnD,SAAS,EAAE,MAAM,EAAE,GAClB,OAAO,CAAC,IAAI,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAQvD"}
|
package/lib/native.js
CHANGED
|
@@ -80,4 +80,26 @@ export function stopAnrWatchdog() {
|
|
|
80
80
|
// ignore
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* v0.7.3 — drives the native screenshot path. JS side passes the
|
|
85
|
+
* current list of mask `nativeID`s (read from the consumer's
|
|
86
|
+
* registered mask query); native renders + redacts.
|
|
87
|
+
*
|
|
88
|
+
* Returns `null` on every failure mode: no native module bound
|
|
89
|
+
* (jest, bun test, web), method missing (older native build still
|
|
90
|
+
* deployed), capture failed (no key window, timed out, etc.).
|
|
91
|
+
* Callers must treat `null` as "no screenshot this round" — the
|
|
92
|
+
* error event still ships, just without a thumbnail.
|
|
93
|
+
*/
|
|
94
|
+
export async function captureNativeScreenshotWithMask(maskedIds) {
|
|
95
|
+
const n = native();
|
|
96
|
+
if (!n?.captureScreenshotWithMask)
|
|
97
|
+
return null;
|
|
98
|
+
try {
|
|
99
|
+
return await n.captureScreenshotWithMask(maskedIds);
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
83
105
|
//# sourceMappingURL=native.js.map
|
package/lib/native.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.js","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"native.js","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAuCH,IAAI,OAA+C,CAAA;AAEnD,SAAS,MAAM;IACb,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,OAAO,CAAA;IACzC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,OAAO,CAAC,mBAAmB,CAEvC,CAAA;QACD,OAAO,GAAG,IAAI,CAAC,mBAAmB,CAAsB,SAAS,CAAC,CAAA;IACpE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,IAAI,CAAA;IAChB,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,MAI/B;IACC,IAAI,CAAC;QACH,MAAM,EAAE,EAAE,SAAS,CAAC,MAAM,CAAC,CAAA;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,sBAAsB;IACxB,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB;IACtC,MAAM,CAAC,GAAG,MAAM,EAAE,CAAA;IAClB,IAAI,CAAC,CAAC;QAAE,OAAO,EAAE,CAAA;IACjB,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,CAAC,YAAY,EAAE,CAAA;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAA;IACX,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB;IAChC,IAAI,CAAC;QACH,MAAM,EAAE,EAAE,sBAAsB,EAAE,EAAE,CAAA;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,sCAAsC;IACxC,CAAC;AACH,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAIhC;IACC,IAAI,CAAC;QACH,MAAM,EAAE,EAAE,gBAAgB,EAAE,CAAC,OAAO,CAAC,CAAA;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,gCAAgC;IAClC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,IAAI,CAAC;QACH,MAAM,EAAE,EAAE,eAAe,EAAE,EAAE,CAAA;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,SAAS;IACX,CAAC;AACH,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACnD,SAAmB;IAEnB,MAAM,CAAC,GAAG,MAAM,EAAE,CAAA;IAClB,IAAI,CAAC,CAAC,EAAE,yBAAyB;QAAE,OAAO,IAAI,CAAA;IAC9C,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,CAAC,yBAAyB,CAAC,SAAS,CAAC,CAAA;IACrD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC"}
|
package/lib/navigation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../src/navigation.ts"],"names":[],"mappings":"AA4BA;;kDAEkD;AAClD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;IAClE,eAAe,EAAE,MAAM;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CACrD,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,iBAAiB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../src/navigation.ts"],"names":[],"mappings":"AA4BA;;kDAEkD;AAClD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;IAClE,eAAe,EAAE,MAAM;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CACrD,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,iBAAiB,GAAG,IAAI,CAiFzE"}
|
package/lib/navigation.js
CHANGED
|
@@ -42,6 +42,9 @@ import { captureStep } from './trail';
|
|
|
42
42
|
export function useTraceNavigation(navigationRef) {
|
|
43
43
|
// Latest route name we've observed.
|
|
44
44
|
const lastRouteRef = useRef(null);
|
|
45
|
+
// Wall-clock ms when the last screen was entered. Drives dwell time
|
|
46
|
+
// attached to the leaving span + the next captureStep breadcrumb.
|
|
47
|
+
const lastRouteEnteredAtRef = useRef(null);
|
|
45
48
|
// Span for the screen the user is currently on. Finished when the
|
|
46
49
|
// next screen is entered (or on unmount).
|
|
47
50
|
const openSpanRef = useRef(null);
|
|
@@ -53,7 +56,7 @@ export function useTraceNavigation(navigationRef) {
|
|
|
53
56
|
// Each screen gets its own trace root — detach from whatever the
|
|
54
57
|
// previous screen's span was (we keep it active, so without
|
|
55
58
|
// `parent: null` the new one would nest under it).
|
|
56
|
-
const openScreenSpan = (from, to) => {
|
|
59
|
+
const openScreenSpan = (from, to, prevDwellMs) => {
|
|
57
60
|
const span = startSpan('react.navigation', {
|
|
58
61
|
name: from ? `${from} → ${to}` : to,
|
|
59
62
|
parent: null,
|
|
@@ -62,19 +65,39 @@ export function useTraceNavigation(navigationRef) {
|
|
|
62
65
|
openSpanRef.current = span;
|
|
63
66
|
setActiveSpan(span);
|
|
64
67
|
lastRouteRef.current = to;
|
|
65
|
-
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
+
lastRouteEnteredAtRef.current = Date.now();
|
|
69
|
+
// v0.8.0-b — dwell on the previous screen surfaces in the
|
|
70
|
+
// session trail. The leaving span's `durationMs` already
|
|
71
|
+
// carries the same number, but the trail is the most-glanced
|
|
72
|
+
// surface so we duplicate it as breadcrumb data. No bytes wasted:
|
|
73
|
+
// a breadcrumb without sessionTrail enabled is a no-op.
|
|
68
74
|
captureStep(`screen:${to}`, {
|
|
69
|
-
breadcrumb: {
|
|
75
|
+
breadcrumb: {
|
|
76
|
+
data: prevDwellMs !== null ? { dwellMsPrev: prevDwellMs } : undefined,
|
|
77
|
+
message: from ? `${from} → ${to}` : to,
|
|
78
|
+
type: 'navigation',
|
|
79
|
+
},
|
|
70
80
|
});
|
|
71
81
|
};
|
|
82
|
+
const finishOpenSpanWithDwell = () => {
|
|
83
|
+
const span = openSpanRef.current;
|
|
84
|
+
const enteredAt = lastRouteEnteredAtRef.current;
|
|
85
|
+
if (!span)
|
|
86
|
+
return null;
|
|
87
|
+
const dwellMs = enteredAt !== null ? Math.max(0, Date.now() - enteredAt) : null;
|
|
88
|
+
span.finish({
|
|
89
|
+
status: 'ok',
|
|
90
|
+
// Tag values are strings on the wire — cast at finish-time.
|
|
91
|
+
tags: dwellMs !== null ? { 'nav.dwell_ms': String(dwellMs) } : undefined,
|
|
92
|
+
});
|
|
93
|
+
return dwellMs;
|
|
94
|
+
};
|
|
72
95
|
// Open a span for the initial screen so its requests are grouped
|
|
73
96
|
// too (auth / config / first data load are usually the busiest
|
|
74
97
|
// screen of a session).
|
|
75
98
|
const initial = navigationRef.getCurrentRoute()?.name ?? null;
|
|
76
99
|
if (initial !== null)
|
|
77
|
-
openScreenSpan(null, initial);
|
|
100
|
+
openScreenSpan(null, initial, null);
|
|
78
101
|
else
|
|
79
102
|
lastRouteRef.current = null;
|
|
80
103
|
const unsubscribe = navigationRef.addListener('state', () => {
|
|
@@ -82,13 +105,14 @@ export function useTraceNavigation(navigationRef) {
|
|
|
82
105
|
const prev = lastRouteRef.current;
|
|
83
106
|
if (next === null || next === prev)
|
|
84
107
|
return;
|
|
85
|
-
|
|
86
|
-
openScreenSpan(prev, next);
|
|
108
|
+
const dwellMs = finishOpenSpanWithDwell();
|
|
109
|
+
openScreenSpan(prev, next, dwellMs);
|
|
87
110
|
});
|
|
88
111
|
return () => {
|
|
89
112
|
unsubscribe();
|
|
90
|
-
|
|
113
|
+
finishOpenSpanWithDwell();
|
|
91
114
|
openSpanRef.current = null;
|
|
115
|
+
lastRouteEnteredAtRef.current = null;
|
|
92
116
|
setActiveSpan(null);
|
|
93
117
|
};
|
|
94
118
|
}, [navigationRef]);
|
package/lib/navigation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../src/navigation.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,oEAAoE;AACpE,0DAA0D;AAC1D,qEAAqE;AACrE,iEAAiE;AACjE,EAAE;AACF,yDAAyD;AACzD,8DAA8D;AAC9D,mEAAmE;AACnE,4CAA4C;AAC5C,EAAE;AACF,oEAAoE;AACpE,gEAAgE;AAChE,mEAAmE;AACnE,kEAAkE;AAClE,EAAE;AACF,kEAAkE;AAClE,qEAAqE;AACrE,sEAAsE;AACtE,gEAAgE;AAChE,6CAA6C;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,SAAS,EAA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uB,EAAE,CAAC;YAC1C,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,WAAW,EAAE,CAAC;YACd,uBAAuB,EAAE,CAAC;YAC1B,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC;YAC3B,qBAAqB,CAAC,OAAO,GAAG,IAAI,CAAC;YACrC,aAAa,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;AACtB,CAAC"}
|
package/lib/netinfo.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Device } from '@goliapkg/sentori-core';
|
|
2
|
+
type NetworkType = Device['networkType'];
|
|
3
|
+
/**
|
|
4
|
+
* Idempotent — subscribe to NetInfo state changes and cache the
|
|
5
|
+
* latest network class. Called once from `init()`. Pure no-op if
|
|
6
|
+
* the peer isn't installed or we're not in an RN runtime.
|
|
7
|
+
*/
|
|
8
|
+
export declare function startNetworkTypeWatch(): void;
|
|
9
|
+
/** Synchronous read at capture time. */
|
|
10
|
+
export declare function getCachedNetworkType(): NetworkType;
|
|
11
|
+
/** Test-only. */
|
|
12
|
+
export declare function __resetNetworkTypeForTests(): void;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=netinfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"netinfo.d.ts","sourceRoot":"","sources":["../src/netinfo.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD,KAAK,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;AA8BzC;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAc5C;AAED,wCAAwC;AACxC,wBAAgB,oBAAoB,IAAI,WAAW,CAElD;AAED,iBAAiB;AACjB,wBAAgB,0BAA0B,IAAI,IAAI,CAKjD"}
|
package/lib/netinfo.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// v0.8.0-c — cached read of the current network class.
|
|
2
|
+
//
|
|
3
|
+
// `@react-native-community/netinfo` is an OPTIONAL peer dep. If the
|
|
4
|
+
// host app has it installed (most production RN apps do — it's a
|
|
5
|
+
// standard library), we subscribe at SDK init time and cache the
|
|
6
|
+
// latest network state. `collectDevice()` reads the cache
|
|
7
|
+
// synchronously at capture time. If the peer isn't installed, the
|
|
8
|
+
// cache stays `undefined` and `device.networkType` is omitted —
|
|
9
|
+
// no warning, no crash.
|
|
10
|
+
//
|
|
11
|
+
// We collapse NetInfo's enum into the smaller set the protocol
|
|
12
|
+
// allows (see `Device.networkType` in `sdk/core/src/types.ts`):
|
|
13
|
+
// `wifi`, `2g/3g/4g/slow-2g`, `offline`, `unknown`. 5G collapses
|
|
14
|
+
// into `4g` because the schema doesn't have a 5g slot yet; the
|
|
15
|
+
// information loss is acceptable for an analytics dimension.
|
|
16
|
+
let _cached;
|
|
17
|
+
let _started = false;
|
|
18
|
+
let _unsubscribe = null;
|
|
19
|
+
function mapState(state) {
|
|
20
|
+
if (state.isConnected === false)
|
|
21
|
+
return 'offline';
|
|
22
|
+
if (state.type === 'wifi' || state.type === 'ethernet')
|
|
23
|
+
return 'wifi';
|
|
24
|
+
if (state.type === 'cellular') {
|
|
25
|
+
const gen = state.details?.cellularGeneration;
|
|
26
|
+
if (gen === '2g' || gen === '3g' || gen === '4g')
|
|
27
|
+
return gen;
|
|
28
|
+
if (gen === '5g')
|
|
29
|
+
return '4g';
|
|
30
|
+
return 'unknown';
|
|
31
|
+
}
|
|
32
|
+
if (state.type === 'none' || state.type === 'unknown')
|
|
33
|
+
return 'unknown';
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Idempotent — subscribe to NetInfo state changes and cache the
|
|
38
|
+
* latest network class. Called once from `init()`. Pure no-op if
|
|
39
|
+
* the peer isn't installed or we're not in an RN runtime.
|
|
40
|
+
*/
|
|
41
|
+
export function startNetworkTypeWatch() {
|
|
42
|
+
if (_started)
|
|
43
|
+
return;
|
|
44
|
+
_started = true;
|
|
45
|
+
try {
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
47
|
+
const mod = require('@react-native-community/netinfo');
|
|
48
|
+
const add = mod.addEventListener ?? mod.default?.addEventListener;
|
|
49
|
+
if (typeof add !== 'function')
|
|
50
|
+
return;
|
|
51
|
+
_unsubscribe = add((state) => {
|
|
52
|
+
_cached = mapState(state);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
// not installed — leave cache undefined
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/** Synchronous read at capture time. */
|
|
60
|
+
export function getCachedNetworkType() {
|
|
61
|
+
return _cached;
|
|
62
|
+
}
|
|
63
|
+
/** Test-only. */
|
|
64
|
+
export function __resetNetworkTypeForTests() {
|
|
65
|
+
_unsubscribe?.();
|
|
66
|
+
_unsubscribe = null;
|
|
67
|
+
_started = false;
|
|
68
|
+
_cached = undefined;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=netinfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"netinfo.js","sourceRoot":"","sources":["../src/netinfo.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,EAAE;AACF,oEAAoE;AACpE,iEAAiE;AACjE,iEAAiE;AACjE,0DAA0D;AAC1D,kEAAkE;AAClE,gEAAgE;AAChE,wBAAwB;AACxB,EAAE;AACF,+DAA+D;AAC/D,gEAAgE;AAChE,iEAAiE;AACjE,+DAA+D;AAC/D,6DAA6D;AAiB7D,IAAI,OAAoB,CAAC;AACzB,IAAI,QAAQ,GAAG,KAAK,CAAC;AACrB,IAAI,YAAY,GAAwB,IAAI,CAAC;AAE7C,SAAS,QAAQ,CAAC,KAAmB;IACnC,IAAI,KAAK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U,0BAA0B;IACxC,YAAY,EAAE,EAAE,CAAC;IACjB,YAAY,GAAG,IAAI,CAAC;IACpB,QAAQ,GAAG,KAAK,CAAC;IACjB,OAAO,GAAG,SAAS,CAAC;AACtB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goliapkg/sentori-react-native",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"description": "Sentori SDK for React Native \u2014 JS-layer error capture, native crash handlers (iOS / Android), batched transport, fetch + react-navigation tracing.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://sentori.golia.jp",
|
|
@@ -41,24 +41,23 @@
|
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"expo-modules-core": ">=2.0",
|
|
43
43
|
"react": ">=18",
|
|
44
|
-
"react-native": ">=0.74"
|
|
45
|
-
"react-native-view-shot": ">=3.8"
|
|
44
|
+
"react-native": ">=0.74"
|
|
46
45
|
},
|
|
47
46
|
"peerDependenciesMeta": {
|
|
48
47
|
"@react-native-async-storage/async-storage": {
|
|
49
48
|
"optional": true
|
|
50
49
|
},
|
|
51
|
-
"
|
|
50
|
+
"@react-native-community/netinfo": {
|
|
52
51
|
"optional": true
|
|
53
52
|
},
|
|
54
|
-
"
|
|
53
|
+
"expo-modules-core": {
|
|
55
54
|
"optional": true
|
|
56
55
|
}
|
|
57
56
|
},
|
|
58
57
|
"optionalDependencies": {
|
|
59
58
|
"@react-native-async-storage/async-storage": ">=1.23",
|
|
60
|
-
"
|
|
61
|
-
"
|
|
59
|
+
"@react-native-community/netinfo": ">=11.0",
|
|
60
|
+
"expo-modules-core": ">=2.0"
|
|
62
61
|
},
|
|
63
62
|
"devDependencies": {
|
|
64
63
|
"@types/bun": "latest",
|
|
@@ -69,6 +68,6 @@
|
|
|
69
68
|
"access": "public"
|
|
70
69
|
},
|
|
71
70
|
"dependencies": {
|
|
72
|
-
"@goliapkg/sentori-core": "0.7.
|
|
71
|
+
"@goliapkg/sentori-core": "0.7.1"
|
|
73
72
|
}
|
|
74
73
|
}
|
|
@@ -3,15 +3,13 @@ import { afterEach, beforeEach, describe, expect, mock, test } from 'bun:test';
|
|
|
3
3
|
import { setConfig, __resetForTests as resetConfig } from '../config';
|
|
4
4
|
import { uploadAttachment } from '../transport';
|
|
5
5
|
|
|
6
|
-
//
|
|
6
|
+
// Unit coverage for the upload pipeline.
|
|
7
7
|
//
|
|
8
|
-
// `captureScreenshot()` itself goes through
|
|
9
|
-
// +
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
// runtime concern asserted via manual smoke + the iOS / Android
|
|
14
|
-
// XCTest / instrumentation tests in sub-E / sub-F.
|
|
8
|
+
// `captureScreenshot()` itself goes through the native module
|
|
9
|
+
// (v0.7.3+) which doesn't exist in the bun:test runtime, so we
|
|
10
|
+
// test it indirectly: `uploadAttachment` is the non-RN-API surface
|
|
11
|
+
// and that's what we hit hardest. The native render + mask redaction
|
|
12
|
+
// is exercised by the iOS XCTest / Android instrumentation tests.
|
|
15
13
|
|
|
16
14
|
const origFetch = globalThis.fetch;
|
|
17
15
|
afterEach(() => {
|