react-native-bug-reporter 1.0.0
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/LICENSE +21 -0
- package/README.md +217 -0
- package/android/build.gradle +49 -0
- package/android/src/main/AndroidManifest.xml +11 -0
- package/android/src/main/java/com/bugreporter/ScreenshotDetectorModule.kt +227 -0
- package/android/src/main/java/com/bugreporter/ScreenshotDetectorPackage.kt +20 -0
- package/ios/RNBugReporterScreenshot.m +11 -0
- package/ios/RNBugReporterScreenshot.swift +113 -0
- package/lib/commonjs/BugReporterProvider.js +139 -0
- package/lib/commonjs/BugReporterProvider.js.map +1 -0
- package/lib/commonjs/collectors/appInfo.js +21 -0
- package/lib/commonjs/collectors/appInfo.js.map +1 -0
- package/lib/commonjs/collectors/collectContext.js +45 -0
- package/lib/commonjs/collectors/collectContext.js.map +1 -0
- package/lib/commonjs/collectors/deviceInfo.js +41 -0
- package/lib/commonjs/collectors/deviceInfo.js.map +1 -0
- package/lib/commonjs/collectors/networkInfo.js +33 -0
- package/lib/commonjs/collectors/networkInfo.js.map +1 -0
- package/lib/commonjs/components/BugReportAdminScreen.js +225 -0
- package/lib/commonjs/components/BugReportAdminScreen.js.map +1 -0
- package/lib/commonjs/components/BugReportModal.js +341 -0
- package/lib/commonjs/components/BugReportModal.js.map +1 -0
- package/lib/commonjs/components/ScreenshotEditor.js +466 -0
- package/lib/commonjs/components/ScreenshotEditor.js.map +1 -0
- package/lib/commonjs/components/ScreenshotPreview.js +134 -0
- package/lib/commonjs/components/ScreenshotPreview.js.map +1 -0
- package/lib/commonjs/components/SeveritySelector.js +65 -0
- package/lib/commonjs/components/SeveritySelector.js.map +1 -0
- package/lib/commonjs/context/BugReporterContext.js +24 -0
- package/lib/commonjs/context/BugReporterContext.js.map +1 -0
- package/lib/commonjs/hooks/useScreenshotDetector.js +22 -0
- package/lib/commonjs/hooks/useScreenshotDetector.js.map +1 -0
- package/lib/commonjs/index.js +87 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/native/ScreenshotDetector.js +72 -0
- package/lib/commonjs/native/ScreenshotDetector.js.map +1 -0
- package/lib/commonjs/navigation/screenTracker.js +47 -0
- package/lib/commonjs/navigation/screenTracker.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/services/bugReportService.js +61 -0
- package/lib/commonjs/services/bugReportService.js.map +1 -0
- package/lib/commonjs/services/supabaseService.js +166 -0
- package/lib/commonjs/services/supabaseService.js.map +1 -0
- package/lib/commonjs/theme.js +28 -0
- package/lib/commonjs/theme.js.map +1 -0
- package/lib/commonjs/types.js +35 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/utils/logger.js +29 -0
- package/lib/commonjs/utils/logger.js.map +1 -0
- package/lib/module/BugReporterProvider.js +134 -0
- package/lib/module/BugReporterProvider.js.map +1 -0
- package/lib/module/collectors/appInfo.js +16 -0
- package/lib/module/collectors/appInfo.js.map +1 -0
- package/lib/module/collectors/collectContext.js +41 -0
- package/lib/module/collectors/collectContext.js.map +1 -0
- package/lib/module/collectors/deviceInfo.js +37 -0
- package/lib/module/collectors/deviceInfo.js.map +1 -0
- package/lib/module/collectors/networkInfo.js +29 -0
- package/lib/module/collectors/networkInfo.js.map +1 -0
- package/lib/module/components/BugReportAdminScreen.js +221 -0
- package/lib/module/components/BugReportAdminScreen.js.map +1 -0
- package/lib/module/components/BugReportModal.js +337 -0
- package/lib/module/components/BugReportModal.js.map +1 -0
- package/lib/module/components/ScreenshotEditor.js +461 -0
- package/lib/module/components/ScreenshotEditor.js.map +1 -0
- package/lib/module/components/ScreenshotPreview.js +130 -0
- package/lib/module/components/ScreenshotPreview.js.map +1 -0
- package/lib/module/components/SeveritySelector.js +61 -0
- package/lib/module/components/SeveritySelector.js.map +1 -0
- package/lib/module/context/BugReporterContext.js +19 -0
- package/lib/module/context/BugReporterContext.js.map +1 -0
- package/lib/module/hooks/useScreenshotDetector.js +18 -0
- package/lib/module/hooks/useScreenshotDetector.js.map +1 -0
- package/lib/module/index.js +32 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/native/ScreenshotDetector.js +68 -0
- package/lib/module/native/ScreenshotDetector.js.map +1 -0
- package/lib/module/navigation/screenTracker.js +41 -0
- package/lib/module/navigation/screenTracker.js.map +1 -0
- package/lib/module/services/bugReportService.js +57 -0
- package/lib/module/services/bugReportService.js.map +1 -0
- package/lib/module/services/supabaseService.js +159 -0
- package/lib/module/services/supabaseService.js.map +1 -0
- package/lib/module/theme.js +23 -0
- package/lib/module/theme.js.map +1 -0
- package/lib/module/types.js +31 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils/logger.js +25 -0
- package/lib/module/utils/logger.js.map +1 -0
- package/lib/typescript/src/BugReporterProvider.d.ts +18 -0
- package/lib/typescript/src/BugReporterProvider.d.ts.map +1 -0
- package/lib/typescript/src/collectors/appInfo.d.ts +6 -0
- package/lib/typescript/src/collectors/appInfo.d.ts.map +1 -0
- package/lib/typescript/src/collectors/collectContext.d.ts +7 -0
- package/lib/typescript/src/collectors/collectContext.d.ts.map +1 -0
- package/lib/typescript/src/collectors/deviceInfo.d.ts +7 -0
- package/lib/typescript/src/collectors/deviceInfo.d.ts.map +1 -0
- package/lib/typescript/src/collectors/networkInfo.d.ts +6 -0
- package/lib/typescript/src/collectors/networkInfo.d.ts.map +1 -0
- package/lib/typescript/src/components/BugReportAdminScreen.d.ts +11 -0
- package/lib/typescript/src/components/BugReportAdminScreen.d.ts.map +1 -0
- package/lib/typescript/src/components/BugReportModal.d.ts +20 -0
- package/lib/typescript/src/components/BugReportModal.d.ts.map +1 -0
- package/lib/typescript/src/components/ScreenshotEditor.d.ts +16 -0
- package/lib/typescript/src/components/ScreenshotEditor.d.ts.map +1 -0
- package/lib/typescript/src/components/ScreenshotPreview.d.ts +11 -0
- package/lib/typescript/src/components/ScreenshotPreview.d.ts.map +1 -0
- package/lib/typescript/src/components/SeveritySelector.d.ts +10 -0
- package/lib/typescript/src/components/SeveritySelector.d.ts.map +1 -0
- package/lib/typescript/src/context/BugReporterContext.d.ts +20 -0
- package/lib/typescript/src/context/BugReporterContext.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useScreenshotDetector.d.ts +7 -0
- package/lib/typescript/src/hooks/useScreenshotDetector.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +26 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/native/ScreenshotDetector.d.ts +15 -0
- package/lib/typescript/src/native/ScreenshotDetector.d.ts.map +1 -0
- package/lib/typescript/src/navigation/screenTracker.d.ts +7 -0
- package/lib/typescript/src/navigation/screenTracker.d.ts.map +1 -0
- package/lib/typescript/src/services/bugReportService.d.ts +17 -0
- package/lib/typescript/src/services/bugReportService.d.ts.map +1 -0
- package/lib/typescript/src/services/supabaseService.d.ts +38 -0
- package/lib/typescript/src/services/supabaseService.d.ts.map +1 -0
- package/lib/typescript/src/theme.d.ts +7 -0
- package/lib/typescript/src/theme.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +144 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/utils/logger.d.ts +7 -0
- package/lib/typescript/src/utils/logger.d.ts.map +1 -0
- package/package.json +100 -0
- package/react-native-bug-reporter.podspec +22 -0
- package/react-native.config.js +18 -0
- package/src/BugReporterProvider.tsx +178 -0
- package/src/collectors/appInfo.ts +15 -0
- package/src/collectors/collectContext.ts +47 -0
- package/src/collectors/deviceInfo.ts +51 -0
- package/src/collectors/networkInfo.ts +31 -0
- package/src/components/BugReportAdminScreen.tsx +160 -0
- package/src/components/BugReportModal.tsx +315 -0
- package/src/components/ScreenshotEditor.tsx +410 -0
- package/src/components/ScreenshotPreview.tsx +98 -0
- package/src/components/SeveritySelector.tsx +59 -0
- package/src/context/BugReporterContext.ts +29 -0
- package/src/hooks/useScreenshotDetector.ts +20 -0
- package/src/index.ts +51 -0
- package/src/native/ScreenshotDetector.ts +87 -0
- package/src/navigation/screenTracker.ts +40 -0
- package/src/services/bugReportService.ts +81 -0
- package/src/services/supabaseService.ts +195 -0
- package/src/theme.ts +23 -0
- package/src/types.ts +156 -0
- package/src/utils/logger.ts +24 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["StyleSheet","Text","TouchableOpacity","View","SEVERITIES","SEVERITY_COLORS","jsx","_jsx","LABELS","low","medium","high","critical","SeveritySelector","value","onChange","theme","style","styles","row","children","map","sev","selected","color","accessibilityRole","accessibilityState","onPress","chip","borderColor","backgroundColor","label","mutedColor","create","flexDirection","gap","flex","paddingVertical","borderRadius","borderWidth","alignItems","fontSize","fontWeight"],"sourceRoot":"../../../src","sources":["components/SeveritySelector.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,IAAI,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AACvE,SAASC,UAAU,QAA0B,UAAU;AACvD,SAASC,eAAe,QAA4B,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAQ/D,MAAMC,MAAmC,GAAG;EAC1CC,GAAG,EAAE,KAAK;EACVC,MAAM,EAAE,QAAQ;EAChBC,IAAI,EAAE,MAAM;EACZC,QAAQ,EAAE;AACZ,CAAC;AAED,OAAO,SAASC,gBAAgBA,CAAC;EAAEC,KAAK;EAAEC,QAAQ;EAAEC;AAAa,CAAC,EAAE;EAClE,oBACET,IAAA,CAACJ,IAAI;IAACc,KAAK,EAAEC,MAAM,CAACC,GAAI;IAAAC,QAAA,EACrBhB,UAAU,CAACiB,GAAG,CAACC,GAAG,IAAI;MACrB,MAAMC,QAAQ,GAAGD,GAAG,KAAKR,KAAK;MAC9B,MAAMU,KAAK,GAAGnB,eAAe,CAACiB,GAAG,CAAC;MAClC,oBACEf,IAAA,CAACL,gBAAgB;QAEfuB,iBAAiB,EAAC,QAAQ;QAC1BC,kBAAkB,EAAE;UAAEH;QAAS,CAAE;QACjCI,OAAO,EAAEA,CAAA,KAAMZ,QAAQ,CAACO,GAAG,CAAE;QAC7BL,KAAK,EAAE,CACLC,MAAM,CAACU,IAAI,EACX;UAAEC,WAAW,EAAEN,QAAQ,GAAGC,KAAK,GAAGR,KAAK,CAACa;QAAY,CAAC,EACrDN,QAAQ,IAAI;UAAEO,eAAe,EAAEN;QAAM,CAAC,CACtC;QAAAJ,QAAA,eACFb,IAAA,CAACN,IAAI;UACHgB,KAAK,EAAE,CACLC,MAAM,CAACa,KAAK,EACZ;YAAEP,KAAK,EAAED,QAAQ,GAAG,MAAM,GAAGP,KAAK,CAACgB;UAAW,CAAC,CAC/C;UAAAZ,QAAA,EACDZ,MAAM,CAACc,GAAG;QAAC,CACR;MAAC,GAfFA,GAgBW,CAAC;IAEvB,CAAC;EAAC,CACE,CAAC;AAEX;AAEA,MAAMJ,MAAM,GAAGlB,UAAU,CAACiC,MAAM,CAAC;EAC/Bd,GAAG,EAAE;IAAEe,aAAa,EAAE,KAAK;IAAEC,GAAG,EAAE;EAAE,CAAC;EACrCP,IAAI,EAAE;IACJQ,IAAI,EAAE,CAAC;IACPC,eAAe,EAAE,EAAE;IACnBC,YAAY,EAAE,EAAE;IAChBC,WAAW,EAAE,GAAG;IAChBC,UAAU,EAAE;EACd,CAAC;EACDT,KAAK,EAAE;IAAEU,QAAQ,EAAE,EAAE;IAAEC,UAAU,EAAE;EAAM;AAC3C,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
4
|
+
export const BugReporterContext = /*#__PURE__*/createContext(null);
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Access the bug reporter imperatively, e.g. to wire a "Report a bug" button:
|
|
8
|
+
*
|
|
9
|
+
* const { openReporter } = useBugReporter();
|
|
10
|
+
* <Button title="Report a bug" onPress={() => openReporter()} />
|
|
11
|
+
*/
|
|
12
|
+
export function useBugReporter() {
|
|
13
|
+
const ctx = useContext(BugReporterContext);
|
|
14
|
+
if (!ctx) {
|
|
15
|
+
throw new Error('useBugReporter must be used within a <BugReporterProvider>');
|
|
16
|
+
}
|
|
17
|
+
return ctx;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=BugReporterContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","useContext","BugReporterContext","useBugReporter","ctx","Error"],"sourceRoot":"../../../src","sources":["context/BugReporterContext.ts"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AAcjD,OAAO,MAAMC,kBAAkB,gBAAGF,aAAa,CAAiC,IAAI,CAAC;;AAErF;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,cAAcA,CAAA,EAA4B;EACxD,MAAMC,GAAG,GAAGH,UAAU,CAACC,kBAAkB,CAAC;EAC1C,IAAI,CAACE,GAAG,EAAE;IACR,MAAM,IAAIC,KAAK,CAAC,4DAA4D,CAAC;EAC/E;EACA,OAAOD,GAAG;AACZ","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { screenshotDetector } from '../native/ScreenshotDetector';
|
|
5
|
+
/**
|
|
6
|
+
* Subscribes to native screenshot detection while `enabled` is true.
|
|
7
|
+
* Calls `onScreenshot` with the captured image whenever the user takes one.
|
|
8
|
+
*/
|
|
9
|
+
export function useScreenshotDetector(enabled, onScreenshot) {
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (!enabled) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const unsubscribe = screenshotDetector.subscribe(onScreenshot);
|
|
15
|
+
return unsubscribe;
|
|
16
|
+
}, [enabled, onScreenshot]);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=useScreenshotDetector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","screenshotDetector","useScreenshotDetector","enabled","onScreenshot","unsubscribe","subscribe"],"sourceRoot":"../../../src","sources":["hooks/useScreenshotDetector.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,kBAAkB,QAAQ,8BAA8B;AAGjE;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CACnCC,OAAgB,EAChBC,YAAkD,EAClD;EACAJ,SAAS,CAAC,MAAM;IACd,IAAI,CAACG,OAAO,EAAE;MACZ;IACF;IACA,MAAME,WAAW,GAAGJ,kBAAkB,CAACK,SAAS,CAACF,YAAY,CAAC;IAC9D,OAAOC,WAAW;EACpB,CAAC,EAAE,CAACF,OAAO,EAAEC,YAAY,CAAC,CAAC;AAC7B","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* React Native Universal Bug Reporter SDK
|
|
5
|
+
* ---------------------------------------
|
|
6
|
+
* Drop-in bug reporting: detect screenshots, collect device/app/user context,
|
|
7
|
+
* and ship everything to Supabase (Postgres + Storage). A Database Webhook →
|
|
8
|
+
* Edge Function sends the notification email.
|
|
9
|
+
*
|
|
10
|
+
* Quick start:
|
|
11
|
+
*
|
|
12
|
+
* import { BugReporterProvider } from 'react-native-bug-reporter';
|
|
13
|
+
*
|
|
14
|
+
* <BugReporterProvider config={{ supabaseUrl: '...', supabaseAnonKey: '...' }}>
|
|
15
|
+
* <App />
|
|
16
|
+
* </BugReporterProvider>
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export { BugReporterProvider } from './BugReporterProvider';
|
|
20
|
+
export { useBugReporter } from './context/BugReporterContext';
|
|
21
|
+
export { BugReportAdminScreen } from './components/BugReportAdminScreen';
|
|
22
|
+
|
|
23
|
+
// Navigation tracking helpers
|
|
24
|
+
export { setCurrentScreen, getCurrentScreen, getActiveRouteName } from './navigation/screenTracker';
|
|
25
|
+
|
|
26
|
+
// Lower-level pieces, exported for advanced/custom integrations.
|
|
27
|
+
export { collectContext } from './collectors/collectContext';
|
|
28
|
+
export { submitBugReport } from './services/bugReportService';
|
|
29
|
+
export { subscribeToReports, updateReportStatus } from './services/supabaseService';
|
|
30
|
+
export { screenshotDetector } from './native/ScreenshotDetector';
|
|
31
|
+
export { SEVERITIES } from './types';
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["BugReporterProvider","useBugReporter","BugReportAdminScreen","setCurrentScreen","getCurrentScreen","getActiveRouteName","collectContext","submitBugReport","subscribeToReports","updateReportStatus","screenshotDetector","SEVERITIES"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,cAAc,QAAQ,8BAA8B;AAC7D,SAASC,oBAAoB,QAAQ,mCAAmC;;AAExE;AACA,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,kBAAkB,QACb,4BAA4B;;AAEnC;AACA,SAASC,cAAc,QAAQ,6BAA6B;AAC5D,SAASC,eAAe,QAAQ,6BAA6B;AAC7D,SACEC,kBAAkB,EAClBC,kBAAkB,QACb,4BAA4B;AACnC,SAASC,kBAAkB,QAAQ,6BAA6B;AAgBhE,SAASC,UAAU,QAAQ,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
|
4
|
+
import { logger } from '../utils/logger';
|
|
5
|
+
const LINKING_ERROR = `The native module 'RNBugReporterScreenshot' from 'react-native-bug-reporter' is not linked.\n` + Platform.select({
|
|
6
|
+
ios: '- Run `cd ios && pod install`, then rebuild the app.\n',
|
|
7
|
+
android: '- Rebuild the Android app (autolinking registers the module automatically).\n',
|
|
8
|
+
default: ''
|
|
9
|
+
}) + '- A native rebuild is required after install — Fast Refresh is not enough.\n';
|
|
10
|
+
const NativeScreenshot = NativeModules.RNBugReporterScreenshot;
|
|
11
|
+
/**
|
|
12
|
+
* Thin wrapper around the native screenshot detector. Exposes a single
|
|
13
|
+
* `subscribe` method that starts detection and returns an unsubscribe fn.
|
|
14
|
+
*/
|
|
15
|
+
class ScreenshotDetector {
|
|
16
|
+
emitter = null;
|
|
17
|
+
listenerCount = 0;
|
|
18
|
+
isAvailable() {
|
|
19
|
+
return !!NativeScreenshot;
|
|
20
|
+
}
|
|
21
|
+
subscribe(listener) {
|
|
22
|
+
if (!NativeScreenshot) {
|
|
23
|
+
logger.warn(LINKING_ERROR);
|
|
24
|
+
return () => {};
|
|
25
|
+
}
|
|
26
|
+
if (!this.emitter) {
|
|
27
|
+
this.emitter = new NativeEventEmitter(NativeScreenshot);
|
|
28
|
+
}
|
|
29
|
+
const subscription = this.emitter.addListener('BugReporterScreenshotTaken', payload => {
|
|
30
|
+
if (!payload || !payload.uri) {
|
|
31
|
+
// Detection fired but capture failed — still notify with no image so
|
|
32
|
+
// the user can file a report manually.
|
|
33
|
+
listener({
|
|
34
|
+
uri: '',
|
|
35
|
+
width: 0,
|
|
36
|
+
height: 0
|
|
37
|
+
});
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
listener({
|
|
41
|
+
uri: payload.uri,
|
|
42
|
+
width: payload.width,
|
|
43
|
+
height: payload.height
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
if (this.listenerCount === 0) {
|
|
47
|
+
try {
|
|
48
|
+
NativeScreenshot.start();
|
|
49
|
+
} catch (e) {
|
|
50
|
+
logger.warn('failed to start native detector', e);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
this.listenerCount += 1;
|
|
54
|
+
return () => {
|
|
55
|
+
subscription.remove();
|
|
56
|
+
this.listenerCount = Math.max(0, this.listenerCount - 1);
|
|
57
|
+
if (this.listenerCount === 0) {
|
|
58
|
+
try {
|
|
59
|
+
NativeScreenshot.stop();
|
|
60
|
+
} catch (e) {
|
|
61
|
+
logger.warn('failed to stop native detector', e);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export const screenshotDetector = new ScreenshotDetector();
|
|
68
|
+
//# sourceMappingURL=ScreenshotDetector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeEventEmitter","NativeModules","Platform","logger","LINKING_ERROR","select","ios","android","default","NativeScreenshot","RNBugReporterScreenshot","ScreenshotDetector","emitter","listenerCount","isAvailable","subscribe","listener","warn","subscription","addListener","payload","uri","width","height","start","e","remove","Math","max","stop","screenshotDetector"],"sourceRoot":"../../../src","sources":["native/ScreenshotDetector.ts"],"mappings":";;AAAA,SAASA,kBAAkB,EAAEC,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAE1E,SAASC,MAAM,QAAQ,iBAAiB;AAExC,MAAMC,aAAa,GACjB,+FAA+F,GAC/FF,QAAQ,CAACG,MAAM,CAAC;EACdC,GAAG,EAAE,wDAAwD;EAC7DC,OAAO,EAAE,+EAA+E;EACxFC,OAAO,EAAE;AACX,CAAC,CAAC,GACF,8EAA8E;AAEhF,MAAMC,gBAAgB,GAAGR,aAAa,CAACS,uBAO1B;AAIb;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,CAAC;EACfC,OAAO,GAA8B,IAAI;EACzCC,aAAa,GAAG,CAAC;EAEzBC,WAAWA,CAAA,EAAY;IACrB,OAAO,CAAC,CAACL,gBAAgB;EAC3B;EAEAM,SAASA,CAACC,QAA4B,EAAc;IAClD,IAAI,CAACP,gBAAgB,EAAE;MACrBN,MAAM,CAACc,IAAI,CAACb,aAAa,CAAC;MAC1B,OAAO,MAAM,CAAC,CAAC;IACjB;IAEA,IAAI,CAAC,IAAI,CAACQ,OAAO,EAAE;MACjB,IAAI,CAACA,OAAO,GAAG,IAAIZ,kBAAkB,CAACS,gBAAuB,CAA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+
/**
|
|
4
|
+
* Lightweight current-screen tracker.
|
|
5
|
+
*
|
|
6
|
+
* The SDK is navigation-library agnostic. The host app reports its active
|
|
7
|
+
* route name here, and the SDK reads it when collecting context.
|
|
8
|
+
*
|
|
9
|
+
* Usage with React Navigation:
|
|
10
|
+
*
|
|
11
|
+
* <NavigationContainer
|
|
12
|
+
* onStateChange={(state) => {
|
|
13
|
+
* const route = getActiveRouteName(state);
|
|
14
|
+
* if (route) setCurrentScreen(route);
|
|
15
|
+
* }}
|
|
16
|
+
* />
|
|
17
|
+
*
|
|
18
|
+
* Or call `setCurrentScreen('Home')` manually from any screen's effect.
|
|
19
|
+
*/
|
|
20
|
+
let currentScreen = null;
|
|
21
|
+
export function setCurrentScreen(name) {
|
|
22
|
+
currentScreen = name;
|
|
23
|
+
}
|
|
24
|
+
export function getCurrentScreen() {
|
|
25
|
+
return currentScreen;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Walks a React Navigation state object to find the deepest active route name.
|
|
30
|
+
*/
|
|
31
|
+
export function getActiveRouteName(state) {
|
|
32
|
+
if (!state || typeof state.index !== 'number' || !Array.isArray(state.routes)) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const route = state.routes[state.index];
|
|
36
|
+
if (route?.state) {
|
|
37
|
+
return getActiveRouteName(route.state);
|
|
38
|
+
}
|
|
39
|
+
return route?.name ?? null;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=screenTracker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["currentScreen","setCurrentScreen","name","getCurrentScreen","getActiveRouteName","state","index","Array","isArray","routes","route"],"sourceRoot":"../../../src","sources":["navigation/screenTracker.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIA,aAA4B,GAAG,IAAI;AAEvC,OAAO,SAASC,gBAAgBA,CAACC,IAAmB,EAAQ;EAC1DF,aAAa,GAAGE,IAAI;AACtB;AAEA,OAAO,SAASC,gBAAgBA,CAAA,EAAkB;EAChD,OAAOH,aAAa;AACtB;;AAEA;AACA;AACA;AACA,OAAO,SAASI,kBAAkBA,CAACC,KAAU,EAAiB;EAC5D,IAAI,CAACA,KAAK,IAAI,OAAOA,KAAK,CAACC,KAAK,KAAK,QAAQ,IAAI,CAACC,KAAK,CAACC,OAAO,CAACH,KAAK,CAACI,MAAM,CAAC,EAAE;IAC7E,OAAO,IAAI;EACb;EACA,MAAMC,KAAK,GAAGL,KAAK,CAACI,MAAM,CAACJ,KAAK,CAACC,KAAK,CAAC;EACvC,IAAII,KAAK,EAAEL,KAAK,EAAE;IAChB,OAAOD,kBAAkB,CAACM,KAAK,CAACL,KAAK,CAAC;EACxC;EACA,OAAOK,KAAK,EAAER,IAAI,IAAI,IAAI;AAC5B","ignoreList":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { insertReport, targetFromConfig, uploadScreenshot } from './supabaseService';
|
|
4
|
+
import { logger } from '../utils/logger';
|
|
5
|
+
/**
|
|
6
|
+
* End-to-end submission pipeline (Supabase):
|
|
7
|
+
* 1. upload the screenshot to Supabase Storage (if present)
|
|
8
|
+
* 2. insert the report row into Postgres
|
|
9
|
+
*
|
|
10
|
+
* A Database Webhook → Edge Function then sends the notification email.
|
|
11
|
+
*/
|
|
12
|
+
export async function submitBugReport({
|
|
13
|
+
input,
|
|
14
|
+
context,
|
|
15
|
+
screenshot,
|
|
16
|
+
config,
|
|
17
|
+
onState
|
|
18
|
+
}) {
|
|
19
|
+
const target = targetFromConfig(config);
|
|
20
|
+
|
|
21
|
+
// Normalize configured recipient(s).
|
|
22
|
+
const notifyEmails = (Array.isArray(config.notifyEmails) ? config.notifyEmails : config.notifyEmails ? [config.notifyEmails] : []).map(e => e.trim()).filter(Boolean);
|
|
23
|
+
let screenshotUrl = null;
|
|
24
|
+
let screenshotPath = null;
|
|
25
|
+
try {
|
|
26
|
+
if (screenshot?.uri) {
|
|
27
|
+
onState?.('uploading');
|
|
28
|
+
const result = await uploadScreenshot(target, screenshot.uri);
|
|
29
|
+
screenshotUrl = result.publicUrl;
|
|
30
|
+
screenshotPath = result.storagePath;
|
|
31
|
+
}
|
|
32
|
+
onState?.('saving');
|
|
33
|
+
const report = {
|
|
34
|
+
title: input.title.trim(),
|
|
35
|
+
description: input.description.trim(),
|
|
36
|
+
severity: input.severity,
|
|
37
|
+
screenshotUrl,
|
|
38
|
+
screenshotPath,
|
|
39
|
+
context,
|
|
40
|
+
status: 'open',
|
|
41
|
+
createdAt: context.timestamp,
|
|
42
|
+
...(notifyEmails.length ? {
|
|
43
|
+
notifyEmails
|
|
44
|
+
} : {})
|
|
45
|
+
};
|
|
46
|
+
const saved = await insertReport(target, report);
|
|
47
|
+
onState?.('done');
|
|
48
|
+
config.onSubmitted?.(saved);
|
|
49
|
+
return saved;
|
|
50
|
+
} catch (error) {
|
|
51
|
+
logger.error('submit failed', error);
|
|
52
|
+
onState?.('error');
|
|
53
|
+
config.onError?.(error);
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=bugReportService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["insertReport","targetFromConfig","uploadScreenshot","logger","submitBugReport","input","context","screenshot","config","onState","target","notifyEmails","Array","isArray","map","e","trim","filter","Boolean","screenshotUrl","screenshotPath","uri","result","publicUrl","storagePath","report","title","description","severity","status","createdAt","timestamp","length","saved","onSubmitted","error","onError"],"sourceRoot":"../../../src","sources":["services/bugReportService.ts"],"mappings":";;AAQA,SAASA,YAAY,EAAEC,gBAAgB,EAAEC,gBAAgB,QAAQ,mBAAmB;AACpF,SAASC,MAAM,QAAQ,iBAAiB;AAUxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,eAAeA,CAAC;EAC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OAAO,GAAG,MAAM,CAAC;IACjBD,MAAM,CAAC0B,WAAW,GAAGD,KAAK,CAAC;IAC3B,OAAOA,KAAK;EACd,CAAC,CAAC,OAAOE,KAAK,EAAE;IACdhC,MAAM,CAACgC,KAAK,CAAC,eAAe,EAAEA,KAAK,CAAC;IACpC1B,OAAO,GAAG,OAAO,CAAC;IAClBD,MAAM,CAAC4B,OAAO,GAAGD,KAAK,CAAC;IACvB,MAAMA,KAAK;EACb;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import 'react-native-url-polyfill/auto';
|
|
4
|
+
import { createClient } from '@supabase/supabase-js';
|
|
5
|
+
import { logger } from '../utils/logger';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Supabase backend for the SDK.
|
|
9
|
+
*
|
|
10
|
+
* - Screenshots upload to a Supabase Storage bucket.
|
|
11
|
+
* - Reports are inserted into a Postgres table.
|
|
12
|
+
* - A Database Webhook → Edge Function (see supabase/) emails each new report.
|
|
13
|
+
*
|
|
14
|
+
* The client is pure JS — no native config files. You only need the project URL
|
|
15
|
+
* and anon key (passed via BugReporterConfig).
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
let client = null;
|
|
19
|
+
let clientKey = '';
|
|
20
|
+
function getClient(url, anonKey) {
|
|
21
|
+
const key = `${url}::${anonKey}`;
|
|
22
|
+
if (!client || clientKey !== key) {
|
|
23
|
+
client = createClient(url, anonKey, {
|
|
24
|
+
auth: {
|
|
25
|
+
persistSession: false,
|
|
26
|
+
autoRefreshToken: false
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
clientKey = key;
|
|
30
|
+
}
|
|
31
|
+
return client;
|
|
32
|
+
}
|
|
33
|
+
/** DB row (snake_case) → SDK BugReport (camelCase). */
|
|
34
|
+
function mapRow(row) {
|
|
35
|
+
return {
|
|
36
|
+
id: row.id,
|
|
37
|
+
title: row.title ?? '',
|
|
38
|
+
description: row.description ?? '',
|
|
39
|
+
severity: row.severity ?? 'medium',
|
|
40
|
+
screenshotUrl: row.screenshot_url ?? null,
|
|
41
|
+
screenshotPath: row.screenshot_path ?? null,
|
|
42
|
+
context: row.context ?? {},
|
|
43
|
+
status: row.status ?? 'open',
|
|
44
|
+
createdAt: row.created_at ?? '',
|
|
45
|
+
notifyEmails: row.notify_emails ?? undefined
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Uploads a local screenshot file to Supabase Storage; returns its public URL.
|
|
50
|
+
*
|
|
51
|
+
* Uses a multipart FormData POST to the Storage REST endpoint. React Native's
|
|
52
|
+
* networking streams `file://` / `content://` uris natively this way, which is
|
|
53
|
+
* reliable on real devices — unlike `fetch(fileUri).arrayBuffer()`, which throws
|
|
54
|
+
* "Network request failed" on Android.
|
|
55
|
+
*/
|
|
56
|
+
export async function uploadScreenshot(target, localUri) {
|
|
57
|
+
const storagePath = `${Date.now()}_${Math.floor(Math.random() * 1e6)}.png`;
|
|
58
|
+
const endpoint = `${target.supabaseUrl.replace(/\/+$/, '')}/storage/v1/object/${target.storageBucket}/${storagePath}`;
|
|
59
|
+
const form = new FormData();
|
|
60
|
+
form.append('file', {
|
|
61
|
+
uri: localUri,
|
|
62
|
+
name: storagePath,
|
|
63
|
+
type: 'image/png'
|
|
64
|
+
});
|
|
65
|
+
const res = await fetch(endpoint, {
|
|
66
|
+
method: 'POST',
|
|
67
|
+
headers: {
|
|
68
|
+
apikey: target.supabaseAnonKey,
|
|
69
|
+
Authorization: `Bearer ${target.supabaseAnonKey}`,
|
|
70
|
+
'x-upsert': 'true'
|
|
71
|
+
},
|
|
72
|
+
body: form
|
|
73
|
+
});
|
|
74
|
+
if (!res.ok) {
|
|
75
|
+
const text = await res.text().catch(() => '');
|
|
76
|
+
throw new Error(`Storage upload failed (${res.status}): ${text}`);
|
|
77
|
+
}
|
|
78
|
+
const publicUrl = `${target.supabaseUrl.replace(/\/+$/, '')}/storage/v1/object/public/${target.storageBucket}/${storagePath}`;
|
|
79
|
+
logger.log('screenshot uploaded', storagePath);
|
|
80
|
+
return {
|
|
81
|
+
publicUrl,
|
|
82
|
+
storagePath
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Inserts a bug report row and returns the saved report. */
|
|
87
|
+
export async function insertReport(target, report) {
|
|
88
|
+
const supabase = getClient(target.supabaseUrl, target.supabaseAnonKey);
|
|
89
|
+
const {
|
|
90
|
+
data,
|
|
91
|
+
error
|
|
92
|
+
} = await supabase.from(target.tableName).insert({
|
|
93
|
+
title: report.title,
|
|
94
|
+
description: report.description,
|
|
95
|
+
severity: report.severity,
|
|
96
|
+
screenshot_url: report.screenshotUrl,
|
|
97
|
+
screenshot_path: report.screenshotPath,
|
|
98
|
+
context: report.context,
|
|
99
|
+
status: report.status,
|
|
100
|
+
created_at: report.createdAt,
|
|
101
|
+
notify_emails: report.notifyEmails ?? null
|
|
102
|
+
}).select().single();
|
|
103
|
+
if (error) throw error;
|
|
104
|
+
logger.log('report inserted', data.id);
|
|
105
|
+
return mapRow(data);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Subscribes to the reports table (newest first). Does an initial fetch, then
|
|
110
|
+
* refetches on any realtime change. Returns an unsubscribe function.
|
|
111
|
+
*/
|
|
112
|
+
export function subscribeToReports(target, onData, onError) {
|
|
113
|
+
const supabase = getClient(target.supabaseUrl, target.supabaseAnonKey);
|
|
114
|
+
const fetchAll = async () => {
|
|
115
|
+
const {
|
|
116
|
+
data,
|
|
117
|
+
error
|
|
118
|
+
} = await supabase.from(target.tableName).select('*').order('created_at', {
|
|
119
|
+
ascending: false
|
|
120
|
+
}).limit(200);
|
|
121
|
+
if (error) {
|
|
122
|
+
logger.error('reports fetch error', error);
|
|
123
|
+
onError?.(error);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
onData((data ?? []).map(mapRow));
|
|
127
|
+
};
|
|
128
|
+
fetchAll();
|
|
129
|
+
const channel = supabase.channel(`bugreporter:${target.tableName}`).on('postgres_changes', {
|
|
130
|
+
event: '*',
|
|
131
|
+
schema: 'public',
|
|
132
|
+
table: target.tableName
|
|
133
|
+
}, () => fetchAll()).subscribe();
|
|
134
|
+
return () => {
|
|
135
|
+
supabase.removeChannel(channel);
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** Updates a report's status (admin). */
|
|
140
|
+
export async function updateReportStatus(target, reportId, status) {
|
|
141
|
+
const supabase = getClient(target.supabaseUrl, target.supabaseAnonKey);
|
|
142
|
+
const {
|
|
143
|
+
error
|
|
144
|
+
} = await supabase.from(target.tableName).update({
|
|
145
|
+
status
|
|
146
|
+
}).eq('id', reportId);
|
|
147
|
+
if (error) throw error;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** Builds a SupabaseTarget from the SDK config (with defaults). */
|
|
151
|
+
export function targetFromConfig(config) {
|
|
152
|
+
return {
|
|
153
|
+
supabaseUrl: config.supabaseUrl,
|
|
154
|
+
supabaseAnonKey: config.supabaseAnonKey,
|
|
155
|
+
tableName: config.tableName ?? 'bug_reports',
|
|
156
|
+
storageBucket: config.storageBucket ?? 'bug-reports'
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=supabaseService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createClient","logger","client","clientKey","getClient","url","anonKey","key","auth","persistSession","autoRefreshToken","mapRow","row","id","title","description","severity","screenshotUrl","screenshot_url","screenshotPath","screenshot_path","context","status","createdAt","created_at","notifyEmails","notify_emails","undefined","uploadScreenshot","target","localUri","storagePath","Date","now","Math","floor","random","endpoint","supabaseUrl","replace","storageBucket","form","FormData","append","uri","name","type","res","fetch","method","headers","apikey","supabaseAnonKey","Authorization","body","ok","text","catch","Error","publicUrl","log","insertReport","report","supabase","data","error","from","tableName","insert","select","single","subscribeToReports","onData","onError","fetchAll","order","ascending","limit","map","channel","on","event","schema","table","subscribe","removeChannel","updateReportStatus","reportId","update","eq","targetFromConfig","config"],"sourceRoot":"../../../src","sources":["services/supabaseService.ts"],"mappings":";;AAAA,OAAO,gCAAgC;AACvC,SAASA,YAAY,QAA6B,uBAAuB;AAEzE,SAASC,MAAM,QAAQ,iBAAiB;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAIC,MAA6B,GAAG,IAAI;AACxC,IAAIC,SAAS,GAAG,EAAE;AAElB,SAASC,SAASA,CAACC,GAAW,EAAEC,OAAe,EAAkB;EAC/D,MAAMC,GAAG,GAAG,GAAGF,GAAG,KAAKC,OAAO,EAAE;EAChC,IAAI,CAACJ,MAAM,IAAIC,SAAS,KAAKI,GAAG,EAAE;IAChCL,MAAM,GAAGF,YAAY,CAACK,GAAG,EAAEC,OAAO,EAAE;MAClCE,IAAI,EAAE;QAAEC,cAAc,EAAE,KAAK;QAAEC,gBAAgB,EAAE;MAAM;IACzD,CAAC,CAAC;IACFP,SAAS,GAAGI,GAAG;EACjB;EACA,OAAOL,MAAM;AACf;AASA;AACA,SAASS,MAAMA,CAACC,GAA4B,EAAa;EACvD,OAAO;IACLC,EAAE,EAAED,GAAG,CAACC,EAAY;IACpBC,KAAK,EAAGF,GAAG,CAACE,KAAK,IAAe,EAAE;IAClCC,WAAW,EAAGH,GAAG,CAACG,WAAW,IAAe,EAAE;IAC9CC,QAAQ,EAAGJ,GAAG,CAACI,QAAQ,IAA8B,QAAQ;IAC7DC,aAAa,EAAGL,GAAG,CAACM,cAAc,IAAe,IAAI;IACrDC,cAAc,EAAGP,GAAG,CAACQ,eAAe,IAAe,IAAI;IACvDC,OAAO,EAAGT,GAAG,CAACS,OAAO,IAA8B,CAAC,CAA0B;IAC9EC,MAAM,EAAGV,GAAG,CAACU,MAAM,IAA4B,MAAM;IACrDC,SAAS,EAAGX,GAAG,CAACY,UAAU,IAAe,EAAE;IAC3CC,YAAY,EAAGb,GAA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CAClBmE,EAAE,CAAC,IAAI,EAAEF,QAAQ,CAAC;EACrB,IAAItB,KAAK,EAAE,MAAMA,KAAK;AACxB;;AAEA;AACA,OAAO,SAASyB,gBAAgBA,CAACC,MAKhC,EAAkB;EACjB,OAAO;IACLrD,WAAW,EAAEqD,MAAM,CAACrD,WAAW;IAC/Bc,eAAe,EAAEuC,MAAM,CAACvC,eAAe;IACvCe,SAAS,EAAEwB,MAAM,CAACxB,SAAS,IAAI,aAAa;IAC5C3B,aAAa,EAAEmD,MAAM,CAACnD,aAAa,IAAI;EACzC,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export const defaultTheme = {
|
|
4
|
+
primaryColor: '#2563eb',
|
|
5
|
+
backgroundColor: '#ffffff',
|
|
6
|
+
textColor: '#111827',
|
|
7
|
+
mutedColor: '#6b7280',
|
|
8
|
+
borderColor: '#e5e7eb',
|
|
9
|
+
errorColor: '#ef4444'
|
|
10
|
+
};
|
|
11
|
+
export function resolveTheme(theme) {
|
|
12
|
+
return {
|
|
13
|
+
...defaultTheme,
|
|
14
|
+
...(theme || {})
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export const SEVERITY_COLORS = {
|
|
18
|
+
low: '#3b82f6',
|
|
19
|
+
medium: '#f59e0b',
|
|
20
|
+
high: '#ef4444',
|
|
21
|
+
critical: '#991b1b'
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["defaultTheme","primaryColor","backgroundColor","textColor","mutedColor","borderColor","errorColor","resolveTheme","theme","SEVERITY_COLORS","low","medium","high","critical"],"sourceRoot":"../../src","sources":["theme.ts"],"mappings":";;AAIA,OAAO,MAAMA,YAA2B,GAAG;EACzCC,YAAY,EAAE,SAAS;EACvBC,eAAe,EAAE,SAAS;EAC1BC,SAAS,EAAE,SAAS;EACpBC,UAAU,EAAE,SAAS;EACrBC,WAAW,EAAE,SAAS;EACtBC,UAAU,EAAE;AACd,CAAC;AAED,OAAO,SAASC,YAAYA,CAACC,KAAwB,EAAiB;EACpE,OAAO;IAAE,GAAGR,YAAY;IAAE,IAAIQ,KAAK,IAAI,CAAC,CAAC;EAAE,CAAC;AAC9C;AAEA,OAAO,MAAMC,eAAuC,GAAG;EACrDC,GAAG,EAAE,SAAS;EACdC,MAAM,EAAE,SAAS;EACjBC,IAAI,EAAE,SAAS;EACfC,QAAQ,EAAE;AACZ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Core type definitions for the Universal Bug Reporter SDK.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const SEVERITIES = ['low', 'medium', 'high', 'critical'];
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Information about the signed-in user, supplied by the host app.
|
|
11
|
+
* Everything is optional so the SDK works in apps without auth.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** Device metadata collected automatically at report time. */
|
|
15
|
+
|
|
16
|
+
/** Host application metadata collected automatically. */
|
|
17
|
+
|
|
18
|
+
/** Network connectivity snapshot. */
|
|
19
|
+
|
|
20
|
+
/** Everything the SDK auto-collects when a report is opened. */
|
|
21
|
+
|
|
22
|
+
/** User-entered fields from the report modal. */
|
|
23
|
+
|
|
24
|
+
/** The full bug report persisted on the backend. */
|
|
25
|
+
|
|
26
|
+
/** A screenshot captured / detected on device. */
|
|
27
|
+
|
|
28
|
+
/** Theme overrides for the modal UI. */
|
|
29
|
+
|
|
30
|
+
/** Configuration passed to BugReporterProvider. */
|
|
31
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SEVERITIES"],"sourceRoot":"../../src","sources":["types.ts"],"mappings":";;AAAA;AACA;AACA;;AAIA,OAAO,MAAMA,UAAyB,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC;;AAE9E;AACA;AACA;AACA;;AASA;;AAmBA;;AAUA;;AAUA;;AAWA;;AAOA;;AAYA;;AAYA;;AAUA","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Tiny namespaced logger that can be toggled via config.debug.
|
|
5
|
+
*/
|
|
6
|
+
let enabled = false;
|
|
7
|
+
const PREFIX = '[BugReporter]';
|
|
8
|
+
export const logger = {
|
|
9
|
+
setEnabled(value) {
|
|
10
|
+
enabled = value;
|
|
11
|
+
},
|
|
12
|
+
log(...args) {
|
|
13
|
+
if (enabled) {
|
|
14
|
+
console.log(PREFIX, ...args);
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
warn(...args) {
|
|
18
|
+
// Warnings always surface — they usually indicate a setup problem.
|
|
19
|
+
console.warn(PREFIX, ...args);
|
|
20
|
+
},
|
|
21
|
+
error(...args) {
|
|
22
|
+
console.error(PREFIX, ...args);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["enabled","PREFIX","logger","setEnabled","value","log","args","console","warn","error"],"sourceRoot":"../../../src","sources":["utils/logger.ts"],"mappings":";;AAAA;AACA;AACA;AACA,IAAIA,OAAO,GAAG,KAAK;AAEnB,MAAMC,MAAM,GAAG,eAAe;AAE9B,OAAO,MAAMC,MAAM,GAAG;EACpBC,UAAUA,CAACC,KAAc,EAAE;IACzBJ,OAAO,GAAGI,KAAK;EACjB,CAAC;EACDC,GAAGA,CAAC,GAAGC,IAAe,EAAE;IACtB,IAAIN,OAAO,EAAE;MACXO,OAAO,CAACF,GAAG,CAACJ,MAAM,EAAE,GAAGK,IAAI,CAAC;IAC9B;EACF,CAAC;EACDE,IAAIA,CAAC,GAAGF,IAAe,EAAE;IACvB;IACAC,OAAO,CAACC,IAAI,CAACP,MAAM,EAAE,GAAGK,IAAI,CAAC;EAC/B,CAAC;EACDG,KAAKA,CAAC,GAAGH,IAAe,EAAE;IACxBC,OAAO,CAACE,KAAK,CAACR,MAAM,EAAE,GAAGK,IAAI,CAAC;EAChC;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BugReporterConfig } from './types';
|
|
3
|
+
interface Props {
|
|
4
|
+
config: BugReporterConfig;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Top-level SDK provider. Wrap your app in it once:
|
|
9
|
+
*
|
|
10
|
+
* <BugReporterProvider config={{ apiBaseUrl: '...' }}>
|
|
11
|
+
* <App />
|
|
12
|
+
* </BugReporterProvider>
|
|
13
|
+
*
|
|
14
|
+
* It listens for screenshots, collects context, and hosts the report modal.
|
|
15
|
+
*/
|
|
16
|
+
export declare function BugReporterProvider({ config, children }: Props): React.JSX.Element;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=BugReporterProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BugReporterProvider.d.ts","sourceRoot":"","sources":["../../../src/BugReporterProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAEV,iBAAiB,EAIlB,MAAM,SAAS,CAAC;AAUjB,UAAU,KAAK;IACb,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,KAAK,qBA4I9D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appInfo.d.ts","sourceRoot":"","sources":["../../../../src/collectors/appInfo.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC;;GAEG;AACH,wBAAgB,cAAc,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAQ5D"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BugReporterConfig, CollectedContext } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Gathers every piece of automatic context for a bug report in parallel:
|
|
4
|
+
* user, device, app, network, current screen, and timestamp.
|
|
5
|
+
*/
|
|
6
|
+
export declare function collectContext(config: BugReporterConfig): Promise<CollectedContext>;
|
|
7
|
+
//# sourceMappingURL=collectContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collectContext.d.ts","sourceRoot":"","sources":["../../../../src/collectors/collectContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAY,MAAM,UAAU,CAAC;AAoB9E;;;GAGG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAsBzF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DeviceInfo } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Collects device metadata. Every field is wrapped defensively because the
|
|
4
|
+
* various getters can reject on some devices/emulators.
|
|
5
|
+
*/
|
|
6
|
+
export declare function collectDeviceInfo(): Promise<DeviceInfo>;
|
|
7
|
+
//# sourceMappingURL=deviceInfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deviceInfo.d.ts","sourceRoot":"","sources":["../../../../src/collectors/deviceInfo.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG3C;;;GAGG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,UAAU,CAAC,CAyC7D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networkInfo.d.ts","sourceRoot":"","sources":["../../../../src/collectors/networkInfo.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C;;GAEG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,WAAW,CAAC,CAuB/D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BugReporterConfig } from '../types';
|
|
2
|
+
interface Props {
|
|
3
|
+
config: Pick<BugReporterConfig, 'supabaseUrl' | 'supabaseAnonKey' | 'tableName' | 'storageBucket' | 'theme'>;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* In-app admin viewer. Live-subscribes to the Supabase reports table with
|
|
7
|
+
* screenshot thumbnails and a tap-to-cycle status control.
|
|
8
|
+
*/
|
|
9
|
+
export declare function BugReportAdminScreen({ config }: Props): import("react").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=BugReportAdminScreen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BugReportAdminScreen.d.ts","sourceRoot":"","sources":["../../../../src/components/BugReportAdminScreen.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAa,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAG7D,UAAU,KAAK;IACb,MAAM,EAAE,IAAI,CACV,iBAAiB,EACjB,aAAa,GAAG,iBAAiB,GAAG,WAAW,GAAG,eAAe,GAAG,OAAO,CAC5E,CAAC;CACH;AAID;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,MAAM,EAAE,EAAE,KAAK,+BAsGrD"}
|