@mindedsolutions/bug-reporter-sdk 0.3.1 → 0.3.3
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/dist/components/FeatureBoardModal.d.ts +1 -0
- package/dist/components/FeatureBoardModal.js +57 -0
- package/dist/context/BugReporterContext.d.ts +3 -0
- package/dist/context/BugReporterProvider.js +5 -1
- package/dist/hooks/useFeatureBoard.d.ts +2 -0
- package/dist/hooks/useFeatureBoard.js +2 -8
- package/package.json +6 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function FeatureBoardModal(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FeatureBoardModal = FeatureBoardModal;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const react_native_webview_1 = require("react-native-webview");
|
|
7
|
+
const useBugReporter_1 = require("../hooks/useBugReporter");
|
|
8
|
+
const useFeatureBoard_1 = require("../hooks/useFeatureBoard");
|
|
9
|
+
// Cast to work around React 18/19 JSX type incompatibility
|
|
10
|
+
const WebView = react_native_webview_1.WebView;
|
|
11
|
+
function FeatureBoardModal() {
|
|
12
|
+
const { translations, isBoardVisible, closeBoard } = (0, useBugReporter_1.useBugReporter)();
|
|
13
|
+
const { boardUrl } = (0, useFeatureBoard_1.useFeatureBoard)();
|
|
14
|
+
if (!boardUrl)
|
|
15
|
+
return null;
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Modal, { visible: isBoardVisible, animationType: "slide", presentationStyle: "fullScreen", onRequestClose: closeBoard, children: (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.container, children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.safeTop }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.header, children: [(0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { onPress: closeBoard, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.closeText, children: translations.cancel }) }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.title, children: translations.featureBoard }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.placeholder })] }), (0, jsx_runtime_1.jsx)(WebView, { source: { uri: boardUrl }, style: styles.webview, startInLoadingState: true, renderLoading: () => ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.loading, children: (0, jsx_runtime_1.jsx)(react_native_1.ActivityIndicator, { size: "large", color: "#6366f1" }) })) })] }) }));
|
|
17
|
+
}
|
|
18
|
+
const styles = react_native_1.StyleSheet.create({
|
|
19
|
+
container: {
|
|
20
|
+
flex: 1,
|
|
21
|
+
backgroundColor: '#fff',
|
|
22
|
+
},
|
|
23
|
+
safeTop: {
|
|
24
|
+
paddingTop: react_native_1.Platform.OS === 'android' ? react_native_1.StatusBar.currentHeight ?? 44 : 54,
|
|
25
|
+
backgroundColor: '#fff',
|
|
26
|
+
},
|
|
27
|
+
header: {
|
|
28
|
+
flexDirection: 'row',
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
justifyContent: 'space-between',
|
|
31
|
+
paddingHorizontal: 16,
|
|
32
|
+
paddingVertical: 14,
|
|
33
|
+
borderBottomWidth: 1,
|
|
34
|
+
borderBottomColor: '#e5e7eb',
|
|
35
|
+
},
|
|
36
|
+
title: {
|
|
37
|
+
fontSize: 17,
|
|
38
|
+
fontWeight: '600',
|
|
39
|
+
color: '#111827',
|
|
40
|
+
},
|
|
41
|
+
closeText: {
|
|
42
|
+
fontSize: 16,
|
|
43
|
+
color: '#6b7280',
|
|
44
|
+
},
|
|
45
|
+
placeholder: {
|
|
46
|
+
width: 50,
|
|
47
|
+
},
|
|
48
|
+
webview: {
|
|
49
|
+
flex: 1,
|
|
50
|
+
},
|
|
51
|
+
loading: {
|
|
52
|
+
...react_native_1.StyleSheet.absoluteFillObject,
|
|
53
|
+
justifyContent: 'center',
|
|
54
|
+
alignItems: 'center',
|
|
55
|
+
backgroundColor: '#fff',
|
|
56
|
+
},
|
|
57
|
+
});
|
|
@@ -7,6 +7,9 @@ export interface BugReporterContextValue {
|
|
|
7
7
|
isModalVisible: boolean;
|
|
8
8
|
openModal: () => void;
|
|
9
9
|
closeModal: () => void;
|
|
10
|
+
isBoardVisible: boolean;
|
|
11
|
+
openBoard: () => void;
|
|
12
|
+
closeBoard: () => void;
|
|
10
13
|
viewRef: RefObject<View>;
|
|
11
14
|
}
|
|
12
15
|
export declare const BugReporterContext: import("react").Context<BugReporterContextValue | null>;
|
|
@@ -6,22 +6,26 @@ const react_1 = require("react");
|
|
|
6
6
|
const react_native_1 = require("react-native");
|
|
7
7
|
const BugReporterContext_1 = require("./BugReporterContext");
|
|
8
8
|
const ReportModal_1 = require("../components/ReportModal");
|
|
9
|
+
const FeatureBoardModal_1 = require("../components/FeatureBoardModal");
|
|
9
10
|
const FloatingButton_1 = require("../components/FloatingButton");
|
|
10
11
|
const useShakeDetection_1 = require("../hooks/useShakeDetection");
|
|
11
12
|
const i18n_1 = require("../i18n");
|
|
12
13
|
function BugReporterProvider({ config, children }) {
|
|
13
14
|
const [isModalVisible, setIsModalVisible] = (0, react_1.useState)(false);
|
|
15
|
+
const [isBoardVisible, setIsBoardVisible] = (0, react_1.useState)(false);
|
|
14
16
|
const viewRef = (0, react_1.useRef)(null);
|
|
15
17
|
const translations = (0, i18n_1.getTranslations)(config.locale);
|
|
16
18
|
const openModal = (0, react_1.useCallback)(() => setIsModalVisible(true), []);
|
|
17
19
|
const closeModal = (0, react_1.useCallback)(() => setIsModalVisible(false), []);
|
|
20
|
+
const openBoard = (0, react_1.useCallback)(() => setIsBoardVisible(true), []);
|
|
21
|
+
const closeBoard = (0, react_1.useCallback)(() => setIsBoardVisible(false), []);
|
|
18
22
|
const shakeEnabled = config.enableShake ?? !__DEV__;
|
|
19
23
|
(0, useShakeDetection_1.useShakeDetection)({
|
|
20
24
|
enabled: shakeEnabled,
|
|
21
25
|
threshold: config.shakeThreshold,
|
|
22
26
|
onShake: openModal,
|
|
23
27
|
});
|
|
24
|
-
return ((0, jsx_runtime_1.jsxs)(BugReporterContext_1.BugReporterContext.Provider, { value: { config, translations, isModalVisible, openModal, closeModal, 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, {})] }));
|
|
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, {})] }));
|
|
25
29
|
}
|
|
26
30
|
const styles = react_native_1.StyleSheet.create({
|
|
27
31
|
container: { flex: 1 },
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useFeatureBoard = useFeatureBoard;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const react_native_1 = require("react-native");
|
|
6
5
|
const useBugReporter_1 = require("./useBugReporter");
|
|
7
6
|
function useFeatureBoard() {
|
|
8
|
-
const { config } = (0, useBugReporter_1.useBugReporter)();
|
|
7
|
+
const { config, openBoard, closeBoard, isBoardVisible } = (0, useBugReporter_1.useBugReporter)();
|
|
9
8
|
const boardUrl = (0, react_1.useMemo)(() => {
|
|
10
9
|
if (!config.featureBoard)
|
|
11
10
|
return null;
|
|
@@ -13,10 +12,5 @@ function useFeatureBoard() {
|
|
|
13
12
|
const url = `${base}/${config.projectId}`;
|
|
14
13
|
return config.userId ? `${url}?voter_id=${encodeURIComponent(config.userId)}` : url;
|
|
15
14
|
}, [config.featureBoard, config.projectId, config.userId]);
|
|
16
|
-
|
|
17
|
-
if (boardUrl) {
|
|
18
|
-
react_native_1.Linking.openURL(boardUrl);
|
|
19
|
-
}
|
|
20
|
-
}, [boardUrl]);
|
|
21
|
-
return { boardUrl, openFeatureBoard };
|
|
15
|
+
return { boardUrl, openFeatureBoard: openBoard, closeFeatureBoard: closeBoard, isBoardVisible };
|
|
22
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindedsolutions/bug-reporter-sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
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,13 +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
28
|
"react": ">=18",
|
|
25
29
|
"react-native": ">=0.72",
|
|
26
|
-
"expo-sensors": ">=13",
|
|
27
30
|
"react-native-view-shot": ">=3",
|
|
28
|
-
"
|
|
29
|
-
"expo-application": ">=5",
|
|
30
|
-
"expo-network": ">=6"
|
|
31
|
+
"react-native-webview": ">=13"
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
33
34
|
"@supabase/supabase-js": "^2.49.0"
|