- analytics-js wraps posthog-js 1.435.1 and posthog-react-native 4.78.2: reads NEXT_PUBLIC_/EXPO_PUBLIC_/VITE_ANALYTICS_SITE and _HOST, waits for consent (no client, no storage, no request before it), masks all inputs, [data-private]/.ph-mask text, blocks [data-block], no canvas, headers or bodies; Expo entry keeps the queue on the device and sends $screen per route change (screenTracker). - analytics-node wraps posthog-node 5.54.1. - test/a1: posthog-node (gzip), posthog-js under jsdom, one Chromium run (cached 1243, full build in new headless mode), React Native offline for 10 minutes plus a restart and a lost response: every event stored once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
1.6 KiB
JavaScript
36 lines
1.6 KiB
JavaScript
// A minimal stand-in for the `react-native` module so the unmodified React
|
|
// Native SDK runs under Node in tests: an iOS device that is in the
|
|
// foreground. Only what the SDK touches at runtime is real; UI components
|
|
// are names (nothing renders in these tests).
|
|
const listeners = new Set();
|
|
const component = (name) => name;
|
|
module.exports = {
|
|
Platform: { OS: "ios", Version: "17.4", isPad: false, isTV: false, constants: {}, select: (o) => o.ios ?? o.default },
|
|
AppState: {
|
|
currentState: "active",
|
|
addEventListener: (_type, fn) => {
|
|
listeners.add(fn);
|
|
return { remove: () => listeners.delete(fn) };
|
|
},
|
|
_emit: (state) => {
|
|
module.exports.AppState.currentState = state;
|
|
for (const fn of listeners) fn(state);
|
|
},
|
|
},
|
|
Dimensions: { get: () => ({ width: 390, height: 844, scale: 3, fontScale: 1 }), addEventListener: () => ({ remove() {} }) },
|
|
Keyboard: { addListener: () => ({ remove() {} }), dismiss() {} },
|
|
Linking: { getInitialURL: async () => null, addEventListener: () => ({ remove() {} }) },
|
|
UIManager: { getViewManagerConfig: () => null, hasViewManagerConfig: () => false },
|
|
NativeModules: {},
|
|
StyleSheet: { create: (s) => s, flatten: (s) => s, hairlineWidth: 1, absoluteFill: {} },
|
|
useWindowDimensions: () => ({ width: 390, height: 844, scale: 3, fontScale: 1 }),
|
|
View: component("View"),
|
|
Text: component("Text"),
|
|
TextInput: component("TextInput"),
|
|
TouchableOpacity: component("TouchableOpacity"),
|
|
Pressable: component("Pressable"),
|
|
ScrollView: component("ScrollView"),
|
|
Modal: component("Modal"),
|
|
KeyboardAvoidingView: component("KeyboardAvoidingView"),
|
|
};
|