@mindedsolutions/bug-reporter-sdk 0.3.3 → 0.3.5

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,5 +1,7 @@
1
+ import { type ViewStyle } from 'react-native';
1
2
  interface Props {
2
3
  onPress: () => void;
4
+ style?: ViewStyle;
3
5
  }
4
- export declare function FloatingButton({ onPress }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export declare function FloatingButton({ onPress, style }: Props): import("react/jsx-runtime").JSX.Element;
5
7
  export {};
@@ -3,14 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FloatingButton = FloatingButton;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_native_1 = require("react-native");
6
- function FloatingButton({ onPress }) {
7
- return ((0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { style: styles.button, onPress: onPress, activeOpacity: 0.8, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.icon, children: "\uD83D\uDC1B" }) }));
6
+ function FloatingButton({ onPress, style }) {
7
+ return ((0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { style: [styles.button, style], onPress: onPress, activeOpacity: 0.8, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.icon, children: "\uD83D\uDC1B" }) }));
8
8
  }
9
9
  const styles = react_native_1.StyleSheet.create({
10
10
  button: {
11
11
  position: 'absolute',
12
12
  bottom: 100,
13
13
  right: 20,
14
+ zIndex: 9999,
14
15
  width: 56,
15
16
  height: 56,
16
17
  borderRadius: 28,
@@ -25,7 +25,7 @@ function BugReporterProvider({ config, children }) {
25
25
  threshold: config.shakeThreshold,
26
26
  onShake: openModal,
27
27
  });
28
- return ((0, jsx_runtime_1.jsxs)(BugReporterContext_1.BugReporterContext.Provider, { value: { config, translations, isModalVisible, openModal, closeModal, isBoardVisible, openBoard, closeBoard, viewRef }, children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { ref: viewRef, collapsable: false, style: styles.container, children: children }), config.floatingButton !== false && (0, jsx_runtime_1.jsx)(FloatingButton_1.FloatingButton, { onPress: openModal }), (0, jsx_runtime_1.jsx)(ReportModal_1.ReportModal, {}), (0, jsx_runtime_1.jsx)(FeatureBoardModal_1.FeatureBoardModal, {})] }));
28
+ return ((0, jsx_runtime_1.jsxs)(BugReporterContext_1.BugReporterContext.Provider, { value: { config, translations, isModalVisible, openModal, closeModal, isBoardVisible, openBoard, closeBoard, viewRef }, children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { ref: viewRef, collapsable: false, style: styles.container, children: children }), config.floatingButton !== false && (0, jsx_runtime_1.jsx)(FloatingButton_1.FloatingButton, { onPress: openModal, style: config.floatingButtonStyle }), (0, jsx_runtime_1.jsx)(ReportModal_1.ReportModal, {}), (0, jsx_runtime_1.jsx)(FeatureBoardModal_1.FeatureBoardModal, {})] }));
29
29
  }
30
30
  const styles = react_native_1.StyleSheet.create({
31
31
  container: { flex: 1 },
@@ -40,19 +40,29 @@ const Application = __importStar(require("expo-application"));
40
40
  const Network = __importStar(require("expo-network"));
41
41
  function useDeviceInfo() {
42
42
  const getDeviceInfo = (0, react_1.useCallback)(() => {
43
- return {
44
- brand: Device.brand,
45
- model: Device.modelName,
46
- os: Device.osName,
47
- osVersion: Device.osVersion,
48
- };
43
+ try {
44
+ return {
45
+ brand: Device.brand,
46
+ model: Device.modelName,
47
+ os: Device.osName,
48
+ osVersion: Device.osVersion,
49
+ };
50
+ }
51
+ catch {
52
+ return { brand: null, model: null, os: null, osVersion: null };
53
+ }
49
54
  }, []);
50
55
  const getAppInfo = (0, react_1.useCallback)(() => {
51
- return {
52
- name: Application.applicationName,
53
- version: Application.nativeApplicationVersion,
54
- build: Application.nativeBuildVersion,
55
- };
56
+ try {
57
+ return {
58
+ name: Application.applicationName,
59
+ version: Application.nativeApplicationVersion,
60
+ build: Application.nativeBuildVersion,
61
+ };
62
+ }
63
+ catch {
64
+ return { name: null, version: null, build: null };
65
+ }
56
66
  }, []);
57
67
  const getNetworkInfo = (0, react_1.useCallback)(async () => {
58
68
  try {
@@ -13,24 +13,29 @@ function useShakeDetection({ enabled, threshold, onShake }) {
13
13
  (0, react_1.useEffect)(() => {
14
14
  if (!enabled)
15
15
  return;
16
- expo_sensors_1.Accelerometer.setUpdateInterval(100);
17
- const subscription = expo_sensors_1.Accelerometer.addListener(({ x, y, z }) => {
18
- const magnitude = Math.sqrt(x * x + y * y + z * z);
19
- if (magnitude < shakeThreshold)
20
- return;
21
- const now = Date.now();
22
- // Cooldown check
23
- if (now - lastShake.current < constants_1.SHAKE_COOLDOWN_MS)
24
- return;
25
- // Add timestamp and clean old ones
26
- timestamps.current.push(now);
27
- timestamps.current = timestamps.current.filter((t) => now - t < constants_1.SHAKE_WINDOW_MS);
28
- if (timestamps.current.length >= constants_1.SHAKE_COUNT) {
29
- lastShake.current = now;
30
- timestamps.current = [];
31
- onShakeRef.current();
32
- }
33
- });
34
- return () => subscription.remove();
16
+ try {
17
+ expo_sensors_1.Accelerometer.setUpdateInterval(100);
18
+ const subscription = expo_sensors_1.Accelerometer.addListener(({ x, y, z }) => {
19
+ const magnitude = Math.sqrt(x * x + y * y + z * z);
20
+ if (magnitude < shakeThreshold)
21
+ return;
22
+ const now = Date.now();
23
+ // Cooldown check
24
+ if (now - lastShake.current < constants_1.SHAKE_COOLDOWN_MS)
25
+ return;
26
+ // Add timestamp and clean old ones
27
+ timestamps.current.push(now);
28
+ timestamps.current = timestamps.current.filter((t) => now - t < constants_1.SHAKE_WINDOW_MS);
29
+ if (timestamps.current.length >= constants_1.SHAKE_COUNT) {
30
+ lastShake.current = now;
31
+ timestamps.current = [];
32
+ onShakeRef.current();
33
+ }
34
+ });
35
+ return () => subscription.remove();
36
+ }
37
+ catch {
38
+ // Native module not available (e.g. version mismatch)
39
+ }
35
40
  }, [enabled, shakeThreshold]);
36
41
  }
package/dist/types.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { ViewStyle } from 'react-native';
2
+ type ViewStyleProp = ViewStyle;
1
3
  export type BugCategory = 'Bug' | 'Crash' | 'UI' | 'Performance' | 'Feature Request' | 'Other';
2
4
  export type BugSeverity = 'low' | 'medium' | 'high' | 'critical';
3
5
  export type BugStatus = 'open' | 'in_progress' | 'resolved' | 'closed';
@@ -50,6 +52,7 @@ export interface BugReporterConfig {
50
52
  enableShake?: boolean;
51
53
  shakeThreshold?: number;
52
54
  floatingButton?: boolean;
55
+ floatingButtonStyle?: ViewStyleProp;
53
56
  categories?: BugCategory[];
54
57
  defaultCategory?: BugCategory;
55
58
  onReportSubmitted?: (report: BugReportPayload) => void;
@@ -79,3 +82,4 @@ export interface Translations {
79
82
  featureBoard: string;
80
83
  suggestFeature: string;
81
84
  }
85
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindedsolutions/bug-reporter-sdk",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "In-app bug reporting and feature request SDK for React Native/Expo with shake detection, screenshot capture, feature board, and Supabase integration",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,14 +21,14 @@
21
21
  "clean": "rm -rf dist"
22
22
  },
23
23
  "peerDependencies": {
24
- "expo-application": ">=5",
25
- "expo-device": ">=6",
26
- "expo-network": ">=6",
27
- "expo-sensors": ">=13",
24
+ "expo-application": ">=5 <8",
25
+ "expo-device": ">=6 <9",
26
+ "expo-network": ">=6 <8",
27
+ "expo-sensors": ">=13 <16",
28
28
  "react": ">=18",
29
29
  "react-native": ">=0.72",
30
- "react-native-view-shot": ">=3",
31
- "react-native-webview": ">=13"
30
+ "react-native-view-shot": ">=3 <5",
31
+ "react-native-webview": ">=13 <14"
32
32
  },
33
33
  "dependencies": {
34
34
  "@supabase/supabase-js": "^2.49.0"