@luciq/react-native 18.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/CHANGELOG.md +5 -0
- package/FONTS_SETUP_GUIDE.md +521 -0
- package/Gemfile +1 -0
- package/Gemfile.lock +11 -0
- package/LICENSE +21 -0
- package/README.md +148 -0
- package/RNLuciq.podspec +21 -0
- package/android/build.gradle +88 -0
- package/android/gradle.properties +4 -0
- package/android/jacoco.gradle +52 -0
- package/android/native.gradle +7 -0
- package/android/proguard-rules.txt +1 -0
- package/android/sourcemaps.gradle +255 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/ai/luciq/reactlibrary/ArgsRegistry.java +278 -0
- package/android/src/main/java/ai/luciq/reactlibrary/Constants.java +20 -0
- package/android/src/main/java/ai/luciq/reactlibrary/RNLuciq.java +328 -0
- package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqAPMModule.java +392 -0
- package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqBugReportingModule.java +444 -0
- package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqCrashReportingModule.java +169 -0
- package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqFeatureRequestsModule.java +98 -0
- package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqNetworkLoggerModule.java +195 -0
- package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqReactnativeModule.java +1611 -0
- package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqReactnativePackage.java +41 -0
- package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqRepliesModule.java +298 -0
- package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqSessionReplayModule.java +213 -0
- package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqSurveysModule.java +237 -0
- package/android/src/main/java/ai/luciq/reactlibrary/utils/ArrayUtil.java +167 -0
- package/android/src/main/java/ai/luciq/reactlibrary/utils/EventEmitterModule.java +35 -0
- package/android/src/main/java/ai/luciq/reactlibrary/utils/LuciqUtil.java +58 -0
- package/android/src/main/java/ai/luciq/reactlibrary/utils/MainThreadHandler.java +13 -0
- package/android/src/main/java/ai/luciq/reactlibrary/utils/MapUtil.java +171 -0
- package/android/src/main/java/ai/luciq/reactlibrary/utils/RNTouchedViewExtractor.java +167 -0
- package/android/src/main/java/ai/luciq/reactlibrary/utils/ReportUtil.java +67 -0
- package/app.plugin.js +1 -0
- package/babel.config.js +3 -0
- package/bin/commands/MigrateCommand.d.ts +6 -0
- package/bin/commands/UploadEasUpdatesSourcemaps.d.ts +2 -0
- package/bin/commands/UploadSoFiles.d.ts +6 -0
- package/bin/commands/UploadSourcemaps.d.ts +2 -0
- package/bin/config/migration-config.json +125 -0
- package/bin/index.d.ts +2 -0
- package/bin/index.js +19179 -0
- package/bin/upload/index.d.ts +4 -0
- package/bin/upload/migrate.d.ts +14 -0
- package/bin/upload/uploadEasUpdatesSourcemaps.d.ts +21 -0
- package/bin/upload/uploadSoFiles.d.ts +21 -0
- package/bin/upload/uploadSourcemaps.d.ts +21 -0
- package/cli/commands/MigrateCommand.ts +32 -0
- package/cli/commands/UploadEasUpdatesSourcemaps.ts +34 -0
- package/cli/commands/UploadSoFiles.ts +38 -0
- package/cli/commands/UploadSourcemaps.ts +40 -0
- package/cli/config/migration-config.json +125 -0
- package/cli/index.ts +21 -0
- package/cli/upload/index.ts +4 -0
- package/cli/upload/migrate.ts +271 -0
- package/cli/upload/uploadEasUpdatesSourcemaps.ts +74 -0
- package/cli/upload/uploadSoFiles.ts +112 -0
- package/cli/upload/uploadSourcemaps.ts +73 -0
- package/dangerfile.ts +44 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +14 -0
- package/dist/models/FeatureFlag.d.ts +11 -0
- package/dist/models/FeatureFlag.js +1 -0
- package/dist/models/LuciqConfig.d.ts +42 -0
- package/dist/models/LuciqConfig.js +1 -0
- package/dist/models/NonFatalOptions.d.ts +15 -0
- package/dist/models/NonFatalOptions.js +1 -0
- package/dist/models/OverAirUpdate.d.ts +12 -0
- package/dist/models/OverAirUpdate.js +1 -0
- package/dist/models/Report.d.ts +70 -0
- package/dist/models/Report.js +109 -0
- package/dist/models/ReproConfig.d.ts +27 -0
- package/dist/models/ReproConfig.js +1 -0
- package/dist/models/SessionMetadata.d.ts +55 -0
- package/dist/models/SessionMetadata.js +1 -0
- package/dist/models/ThemeConfig.d.ts +27 -0
- package/dist/models/ThemeConfig.js +1 -0
- package/dist/models/W3cExternalTraceAttributes.d.ts +22 -0
- package/dist/models/W3cExternalTraceAttributes.js +1 -0
- package/dist/modules/APM.d.ts +77 -0
- package/dist/modules/APM.js +104 -0
- package/dist/modules/BugReporting.d.ts +138 -0
- package/dist/modules/BugReporting.js +202 -0
- package/dist/modules/CrashReporting.d.ts +19 -0
- package/dist/modules/CrashReporting.js +40 -0
- package/dist/modules/FeatureRequests.d.ts +20 -0
- package/dist/modules/FeatureRequests.js +28 -0
- package/dist/modules/Luciq.d.ts +362 -0
- package/dist/modules/Luciq.js +797 -0
- package/dist/modules/NetworkLogger.d.ts +52 -0
- package/dist/modules/NetworkLogger.js +208 -0
- package/dist/modules/Replies.d.ts +78 -0
- package/dist/modules/Replies.js +121 -0
- package/dist/modules/SessionReplay.d.ts +78 -0
- package/dist/modules/SessionReplay.js +98 -0
- package/dist/modules/Surveys.d.ts +75 -0
- package/dist/modules/Surveys.js +101 -0
- package/dist/native/NativeAPM.d.ts +18 -0
- package/dist/native/NativeAPM.js +4 -0
- package/dist/native/NativeBugReporting.d.ts +32 -0
- package/dist/native/NativeBugReporting.js +10 -0
- package/dist/native/NativeConstants.d.ts +182 -0
- package/dist/native/NativeConstants.js +1 -0
- package/dist/native/NativeCrashReporting.d.ts +18 -0
- package/dist/native/NativeCrashReporting.js +2 -0
- package/dist/native/NativeFeatureRequests.d.ts +8 -0
- package/dist/native/NativeFeatureRequests.js +2 -0
- package/dist/native/NativeLuciq.d.ts +86 -0
- package/dist/native/NativeLuciq.js +10 -0
- package/dist/native/NativeNetworkLogger.d.ts +21 -0
- package/dist/native/NativeNetworkLogger.js +14 -0
- package/dist/native/NativePackage.d.ts +21 -0
- package/dist/native/NativePackage.js +2 -0
- package/dist/native/NativeReplies.d.ts +21 -0
- package/dist/native/NativeReplies.js +8 -0
- package/dist/native/NativeSessionReplay.d.ts +16 -0
- package/dist/native/NativeSessionReplay.js +8 -0
- package/dist/native/NativeSurveys.d.ts +22 -0
- package/dist/native/NativeSurveys.js +9 -0
- package/dist/utils/AppStatesHandler.d.ts +3 -0
- package/dist/utils/AppStatesHandler.js +16 -0
- package/dist/utils/Enums.d.ts +244 -0
- package/dist/utils/Enums.js +266 -0
- package/dist/utils/FeatureFlags.d.ts +7 -0
- package/dist/utils/FeatureFlags.js +24 -0
- package/dist/utils/LuciqConstants.d.ts +14 -0
- package/dist/utils/LuciqConstants.js +15 -0
- package/dist/utils/LuciqUtils.d.ts +97 -0
- package/dist/utils/LuciqUtils.js +301 -0
- package/dist/utils/UnhandledRejectionTracking.d.ts +9 -0
- package/dist/utils/UnhandledRejectionTracking.js +99 -0
- package/dist/utils/XhrNetworkInterceptor.d.ts +39 -0
- package/dist/utils/XhrNetworkInterceptor.js +253 -0
- package/dist/utils/config.d.ts +5 -0
- package/dist/utils/config.js +6 -0
- package/dist/utils/logger.d.ts +10 -0
- package/dist/utils/logger.js +39 -0
- package/expo.d.ts +1 -0
- package/expo.js +1 -0
- package/ios/RNLuciq/ArgsRegistry.h +32 -0
- package/ios/RNLuciq/ArgsRegistry.m +276 -0
- package/ios/RNLuciq/LuciqAPMBridge.h +26 -0
- package/ios/RNLuciq/LuciqAPMBridge.m +99 -0
- package/ios/RNLuciq/LuciqBugReportingBridge.h +60 -0
- package/ios/RNLuciq/LuciqBugReportingBridge.m +241 -0
- package/ios/RNLuciq/LuciqCrashReportingBridge.h +18 -0
- package/ios/RNLuciq/LuciqCrashReportingBridge.m +68 -0
- package/ios/RNLuciq/LuciqFeatureRequestsBridge.h +30 -0
- package/ios/RNLuciq/LuciqFeatureRequestsBridge.m +61 -0
- package/ios/RNLuciq/LuciqNetworkLoggerBridge.h +44 -0
- package/ios/RNLuciq/LuciqNetworkLoggerBridge.m +206 -0
- package/ios/RNLuciq/LuciqReactBridge.h +151 -0
- package/ios/RNLuciq/LuciqReactBridge.m +548 -0
- package/ios/RNLuciq/LuciqRepliesBridge.h +40 -0
- package/ios/RNLuciq/LuciqRepliesBridge.m +80 -0
- package/ios/RNLuciq/LuciqSessionReplayBridge.h +32 -0
- package/ios/RNLuciq/LuciqSessionReplayBridge.m +107 -0
- package/ios/RNLuciq/LuciqSurveysBridge.h +46 -0
- package/ios/RNLuciq/LuciqSurveysBridge.m +107 -0
- package/ios/RNLuciq/RCTConvert+LuciqEnums.h +18 -0
- package/ios/RNLuciq/RCTConvert+LuciqEnums.m +127 -0
- package/ios/RNLuciq/RNLuciq.h +35 -0
- package/ios/RNLuciq/RNLuciq.m +107 -0
- package/ios/RNLuciq/Util/LCQAPM+PrivateAPIs.h +15 -0
- package/ios/RNLuciq/Util/LCQCrashReporting+CP.h +13 -0
- package/ios/RNLuciq/Util/LCQNetworkLogger+CP.h +68 -0
- package/ios/RNLuciq/Util/Luciq+CP.h +12 -0
- package/ios/RNLuciq.xcodeproj/project.pbxproj +352 -0
- package/ios/native.rb +12 -0
- package/ios/sourcemaps.sh +120 -0
- package/migrate.js +569 -0
- package/package.json +92 -0
- package/plugin/build/index.js +42078 -0
- package/plugin/src/index.ts +5 -0
- package/plugin/src/pluginProps.ts +6 -0
- package/plugin/src/withLuciq.ts +51 -0
- package/plugin/src/withLuciqAndroid.ts +99 -0
- package/plugin/src/withLuciqIOS.ts +109 -0
- package/plugin/tsconfig.json +7 -0
- package/react-native.config.js +16 -0
- package/scripts/customize-ios-endpoints.sh +28 -0
- package/scripts/dream-11-delete-unused-features.sh +62 -0
- package/scripts/find-token.js +58 -0
- package/scripts/find-token.sh +70 -0
- package/scripts/notify-github.sh +15 -0
- package/scripts/replace.js +58 -0
- package/scripts/snapshot-comment.md +15 -0
- package/scripts/snapshot-version.sh +11 -0
- package/src/index.ts +40 -0
- package/src/models/FeatureFlag.ts +12 -0
- package/src/models/LuciqConfig.ts +48 -0
- package/src/models/NonFatalOptions.ts +16 -0
- package/src/models/OverAirUpdate.ts +14 -0
- package/src/models/Report.ts +124 -0
- package/src/models/ReproConfig.ts +31 -0
- package/src/models/SessionMetadata.ts +57 -0
- package/src/models/ThemeConfig.ts +34 -0
- package/src/models/W3cExternalTraceAttributes.ts +22 -0
- package/src/modules/APM.ts +117 -0
- package/src/modules/BugReporting.ts +254 -0
- package/src/modules/CrashReporting.ts +54 -0
- package/src/modules/FeatureRequests.ts +32 -0
- package/src/modules/Luciq.ts +934 -0
- package/src/modules/NetworkLogger.ts +270 -0
- package/src/modules/Replies.ts +137 -0
- package/src/modules/SessionReplay.ts +111 -0
- package/src/modules/Surveys.ts +118 -0
- package/src/native/NativeAPM.ts +51 -0
- package/src/native/NativeBugReporting.ts +70 -0
- package/src/native/NativeConstants.ts +215 -0
- package/src/native/NativeCrashReporting.ts +29 -0
- package/src/native/NativeFeatureRequests.ts +12 -0
- package/src/native/NativeLuciq.ts +179 -0
- package/src/native/NativeNetworkLogger.ts +42 -0
- package/src/native/NativePackage.ts +25 -0
- package/src/native/NativeReplies.ts +34 -0
- package/src/native/NativeSessionReplay.ts +21 -0
- package/src/native/NativeSurveys.ts +34 -0
- package/src/promise.d.ts +11 -0
- package/src/utils/AppStatesHandler.ts +19 -0
- package/src/utils/Enums.ts +266 -0
- package/src/utils/FeatureFlags.ts +33 -0
- package/src/utils/LuciqConstants.ts +24 -0
- package/src/utils/LuciqUtils.ts +417 -0
- package/src/utils/UnhandledRejectionTracking.ts +118 -0
- package/src/utils/XhrNetworkInterceptor.ts +333 -0
- package/src/utils/config.ts +7 -0
- package/src/utils/logger.ts +54 -0
- package/tsconfig.json +32 -0
- package/tsconfig.test.json +4 -0
- package/tsconfig.upload.json +10 -0
- package/upload/index.d.ts +4 -0
- package/upload/index.js +17314 -0
- package/upload/migrate.d.ts +14 -0
- package/upload/package.json +5 -0
- package/upload/uploadEasUpdatesSourcemaps.d.ts +21 -0
- package/upload/uploadSoFiles.d.ts +21 -0
- package/upload/uploadSourcemaps.d.ts +21 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import { uploadSourcemaps } from './uploadSourcemaps';
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
|
|
5
|
+
export interface UploadEasUpdatesSourcemapsOptions {
|
|
6
|
+
file: string;
|
|
7
|
+
token: string;
|
|
8
|
+
name: string;
|
|
9
|
+
code: string;
|
|
10
|
+
androidUpdateId?: string;
|
|
11
|
+
iosUpdateId?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Disables logging to the console and prevents process exit on error.
|
|
14
|
+
*
|
|
15
|
+
* @default false
|
|
16
|
+
* */
|
|
17
|
+
silent?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function getMapFile(folderPath: string): string | null {
|
|
21
|
+
try {
|
|
22
|
+
if (fs.existsSync(folderPath)) {
|
|
23
|
+
const files = fs.readdirSync(folderPath);
|
|
24
|
+
const mapFile = files.find((file) => file.endsWith('.map'));
|
|
25
|
+
if (!mapFile) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return path.join(folderPath, mapFile);
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
} catch (err) {
|
|
32
|
+
console.error('Failed to read folder:', err);
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Uploads JavaScript sourcemaps to Luciq.
|
|
39
|
+
*
|
|
40
|
+
* @param opts Options for the sourcemaps upload process.
|
|
41
|
+
* @returns A promise that resolves to a boolean indicating whether the upload was successful.
|
|
42
|
+
*/
|
|
43
|
+
export const UploadEasUpdatesSourcemaps = async (
|
|
44
|
+
opts: UploadEasUpdatesSourcemapsOptions,
|
|
45
|
+
): Promise<boolean> => {
|
|
46
|
+
const jsFolderPath = path.join(opts.file, '_expo', 'static', 'js');
|
|
47
|
+
|
|
48
|
+
const androidFile = getMapFile(path.join(jsFolderPath, 'android'));
|
|
49
|
+
const iosFile = getMapFile(path.join(jsFolderPath, 'ios'));
|
|
50
|
+
if (androidFile && fs.existsSync(androidFile)) {
|
|
51
|
+
await uploadSourcemaps({
|
|
52
|
+
platform: 'android',
|
|
53
|
+
name: opts.name,
|
|
54
|
+
code: opts.code,
|
|
55
|
+
token: opts.token,
|
|
56
|
+
label: opts.androidUpdateId,
|
|
57
|
+
file: androidFile,
|
|
58
|
+
silent: opts.silent,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (iosFile && fs.existsSync(iosFile)) {
|
|
63
|
+
await uploadSourcemaps({
|
|
64
|
+
platform: 'ios',
|
|
65
|
+
name: opts.name,
|
|
66
|
+
code: opts.code,
|
|
67
|
+
token: opts.token,
|
|
68
|
+
label: opts.iosUpdateId,
|
|
69
|
+
file: iosFile,
|
|
70
|
+
silent: opts.silent,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return true;
|
|
74
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import FormData from 'form-data';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
|
|
5
|
+
export interface UploadSoFilesOptions {
|
|
6
|
+
arch: 'x86' | 'x86_64' | 'arm64-v8a' | 'armeabi-v7a';
|
|
7
|
+
file: string;
|
|
8
|
+
token: string;
|
|
9
|
+
name: string;
|
|
10
|
+
api_key: string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Disables logging to the console and prevents process exit on error.
|
|
14
|
+
*
|
|
15
|
+
* @default false
|
|
16
|
+
* */
|
|
17
|
+
silent?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Uploads NDK `.so` files to Luciq.
|
|
22
|
+
*
|
|
23
|
+
* @param opts Options for the `.so` files upload process.
|
|
24
|
+
* @returns A promise that resolves to a boolean indicating whether the upload was successful.
|
|
25
|
+
*/
|
|
26
|
+
export const uploadSoFiles = async (opts: UploadSoFilesOptions): Promise<boolean> => {
|
|
27
|
+
const fileName = opts.file;
|
|
28
|
+
|
|
29
|
+
const validFilePath = assert(
|
|
30
|
+
fileName != null,
|
|
31
|
+
'Failed to upload So Files: invalid file path',
|
|
32
|
+
opts.silent,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
if (!validFilePath) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const fileExists = assert(
|
|
40
|
+
fs.existsSync(fileName),
|
|
41
|
+
'Failed to upload So Files: File not found',
|
|
42
|
+
opts.silent,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
if (!fileExists) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const fileExt = fileName.split('.').pop();
|
|
50
|
+
|
|
51
|
+
const isZipFile = assert(
|
|
52
|
+
fileExt === 'zip',
|
|
53
|
+
'Failed to upload So Files: You can only upload ZIP files',
|
|
54
|
+
opts.silent,
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
if (!isZipFile) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const fileBlob = fs.readFileSync(opts.file);
|
|
62
|
+
|
|
63
|
+
const form = new FormData();
|
|
64
|
+
form.append('app_version', opts.name);
|
|
65
|
+
form.append('so_file', fileBlob, fileName);
|
|
66
|
+
form.append('application_token', opts.token);
|
|
67
|
+
form.append('api_key', opts.api_key);
|
|
68
|
+
form.append('arch', opts.arch);
|
|
69
|
+
|
|
70
|
+
if (!opts.silent) {
|
|
71
|
+
console.log('Uploading So files...');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const uploadEndpoint = 'https://api.instabug.com/api/web/public/so_files';
|
|
75
|
+
try {
|
|
76
|
+
await axios.post(uploadEndpoint, form, {
|
|
77
|
+
headers: form.getHeaders(),
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
if (!opts.silent) {
|
|
81
|
+
console.log(
|
|
82
|
+
`Successfully uploaded So Files for version: ${opts.name} with arch ${opts.arch}`,
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return true;
|
|
87
|
+
} catch (err) {
|
|
88
|
+
if (!opts.silent) {
|
|
89
|
+
console.error(
|
|
90
|
+
'Failed to upload So Files:',
|
|
91
|
+
axios.isAxiosError(err) ? err.response?.data : err,
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export const assert = (condition: unknown, message: string, silent?: boolean): boolean => {
|
|
102
|
+
if (silent) {
|
|
103
|
+
return Boolean(condition);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (!condition) {
|
|
107
|
+
console.error(message);
|
|
108
|
+
process.exit(1);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return true;
|
|
112
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import FormData from 'form-data';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
|
|
5
|
+
export interface UploadSourcemapsOptions {
|
|
6
|
+
platform: 'android' | 'ios';
|
|
7
|
+
file: string;
|
|
8
|
+
token: string;
|
|
9
|
+
name: string;
|
|
10
|
+
code: string;
|
|
11
|
+
label?: string;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Disables logging to the console and prevents process exit on error.
|
|
15
|
+
*
|
|
16
|
+
* @default false
|
|
17
|
+
* */
|
|
18
|
+
silent?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Uploads JavaScript sourcemaps to Luciq.
|
|
23
|
+
*
|
|
24
|
+
* @param opts Options for the sourcemaps upload process.
|
|
25
|
+
* @returns A promise that resolves to a boolean indicating whether the upload was successful.
|
|
26
|
+
*/
|
|
27
|
+
export const uploadSourcemaps = async (opts: UploadSourcemapsOptions): Promise<boolean> => {
|
|
28
|
+
const fileName = `${opts.platform}-sourcemap.json`;
|
|
29
|
+
const fileBlob = fs.readFileSync(opts.file);
|
|
30
|
+
|
|
31
|
+
const version = {
|
|
32
|
+
code: opts.code,
|
|
33
|
+
name: opts.name,
|
|
34
|
+
codepush: opts.label,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const form = new FormData();
|
|
38
|
+
form.append('app_version', JSON.stringify(version));
|
|
39
|
+
form.append('symbols_file', fileBlob, fileName);
|
|
40
|
+
form.append('application_token', opts.token);
|
|
41
|
+
form.append('platform', 'react_native');
|
|
42
|
+
form.append('os', opts.platform);
|
|
43
|
+
|
|
44
|
+
if (!opts.silent) {
|
|
45
|
+
console.log('Uploading Source map file...');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
const response = await axios.post('https://api.instabug.com/api/sdk/v3/symbols_files', form, {
|
|
50
|
+
headers: form.getHeaders(),
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const appVersion = version.codepush
|
|
54
|
+
? `${version.name} (${version.code})+codepush:${version.codepush}`
|
|
55
|
+
: `${version.name} (${version.code})`;
|
|
56
|
+
|
|
57
|
+
if (!opts.silent) {
|
|
58
|
+
console.log(`Successfully uploaded Source maps for version: ${appVersion}`);
|
|
59
|
+
console.log(response.data);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return true;
|
|
63
|
+
} catch (err) {
|
|
64
|
+
if (!opts.silent) {
|
|
65
|
+
console.error(
|
|
66
|
+
'Failed to upload source maps:',
|
|
67
|
+
axios.isAxiosError(err) ? err.response?.data : err,
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
};
|
package/dangerfile.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import collectCoverage, { ReportType } from '@luciq/danger-plugin-coverage';
|
|
2
|
+
import { danger, fail, schedule, warn } from 'danger';
|
|
3
|
+
|
|
4
|
+
const hasSourceChanges = danger.git.modified_files.some((file) => file.startsWith('src/'));
|
|
5
|
+
const declaredTrivial =
|
|
6
|
+
!hasSourceChanges || danger.github.issue.labels.some((label) => label.name === 'trivial');
|
|
7
|
+
|
|
8
|
+
// Make sure PR has a description.
|
|
9
|
+
async function hasDescription() {
|
|
10
|
+
const linesOfCode = (await danger.git.linesOfCode()) ?? 0;
|
|
11
|
+
const hasNoDiscription = danger.github.pr.body.includes('> Description goes here');
|
|
12
|
+
if (hasNoDiscription && linesOfCode > 10) {
|
|
13
|
+
fail('Please provide a summary of the changes in the pull request description.');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (!danger.git.modified_files.includes('CHANGELOG.md') && !declaredTrivial) {
|
|
17
|
+
warn(
|
|
18
|
+
'You have not included a CHANGELOG entry! \nYou can find it at [CHANGELOG.md](https://github.com/luciqai/luciq-reactnative-sdk/blob/master/CHANGELOG.md).',
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
schedule(hasDescription());
|
|
24
|
+
|
|
25
|
+
collectCoverage([
|
|
26
|
+
{
|
|
27
|
+
label: 'JavaScript',
|
|
28
|
+
type: ReportType.LCOV,
|
|
29
|
+
filePath: 'coverage/lcov.info',
|
|
30
|
+
threshold: 90,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
label: 'Android',
|
|
34
|
+
type: ReportType.JACOCO,
|
|
35
|
+
filePath: 'coverage/jacocoTestReport.xml',
|
|
36
|
+
threshold: 40,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: 'iOS',
|
|
40
|
+
type: ReportType.XCODE,
|
|
41
|
+
filePath: 'coverage/xcode.json',
|
|
42
|
+
threshold: 30,
|
|
43
|
+
},
|
|
44
|
+
]);
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { LuciqConfig } from './models/LuciqConfig';
|
|
2
|
+
import Report from './models/Report';
|
|
3
|
+
import type { ThemeConfig } from './models/ThemeConfig';
|
|
4
|
+
import * as APM from './modules/APM';
|
|
5
|
+
import * as BugReporting from './modules/BugReporting';
|
|
6
|
+
import * as CrashReporting from './modules/CrashReporting';
|
|
7
|
+
import * as FeatureRequests from './modules/FeatureRequests';
|
|
8
|
+
import * as Luciq from './modules/Luciq';
|
|
9
|
+
import * as NetworkLogger from './modules/NetworkLogger';
|
|
10
|
+
import type { NetworkData, NetworkDataObfuscationHandler } from './modules/NetworkLogger';
|
|
11
|
+
import * as Replies from './modules/Replies';
|
|
12
|
+
import type { Survey } from './modules/Surveys';
|
|
13
|
+
import * as Surveys from './modules/Surveys';
|
|
14
|
+
import * as SessionReplay from './modules/SessionReplay';
|
|
15
|
+
import type { SessionMetadata } from './models/SessionMetadata';
|
|
16
|
+
export * from './utils/Enums';
|
|
17
|
+
export { Report, APM, BugReporting, CrashReporting, FeatureRequests, NetworkLogger, SessionReplay, Replies, Surveys, };
|
|
18
|
+
export type { LuciqConfig, Survey, NetworkData, NetworkDataObfuscationHandler, SessionMetadata, ThemeConfig, };
|
|
19
|
+
export default Luciq;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Report from './models/Report';
|
|
2
|
+
// Modules
|
|
3
|
+
import * as APM from './modules/APM';
|
|
4
|
+
import * as BugReporting from './modules/BugReporting';
|
|
5
|
+
import * as CrashReporting from './modules/CrashReporting';
|
|
6
|
+
import * as FeatureRequests from './modules/FeatureRequests';
|
|
7
|
+
import * as Luciq from './modules/Luciq';
|
|
8
|
+
import * as NetworkLogger from './modules/NetworkLogger';
|
|
9
|
+
import * as Replies from './modules/Replies';
|
|
10
|
+
import * as Surveys from './modules/Surveys';
|
|
11
|
+
import * as SessionReplay from './modules/SessionReplay';
|
|
12
|
+
export * from './utils/Enums';
|
|
13
|
+
export { Report, APM, BugReporting, CrashReporting, FeatureRequests, NetworkLogger, SessionReplay, Replies, Surveys, };
|
|
14
|
+
export default Luciq;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { InvocationEvent, LogLevel, NetworkInterceptionMode } from '../utils/Enums';
|
|
2
|
+
import type { OverAirUpdate } from './OverAirUpdate';
|
|
3
|
+
export interface LuciqConfig {
|
|
4
|
+
/**
|
|
5
|
+
* The token that identifies the app. You can find it on your dashboard.
|
|
6
|
+
*/
|
|
7
|
+
token: string;
|
|
8
|
+
/**
|
|
9
|
+
* An array of events that invoke the SDK's UI.
|
|
10
|
+
*/
|
|
11
|
+
invocationEvents: InvocationEvent[];
|
|
12
|
+
/**
|
|
13
|
+
* An optional LogLevel to indicate the verbosity of SDK logs. Default is Error.
|
|
14
|
+
*/
|
|
15
|
+
debugLogsLevel?: LogLevel;
|
|
16
|
+
/**
|
|
17
|
+
* An optional code push version to be used for all reports.
|
|
18
|
+
*/
|
|
19
|
+
codePushVersion?: string;
|
|
20
|
+
/**
|
|
21
|
+
* An optional flag to override SDK screenshot security behavior.
|
|
22
|
+
*/
|
|
23
|
+
ignoreAndroidSecureFlag?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* An optional current App variant to be used for filtering data.
|
|
26
|
+
*/
|
|
27
|
+
appVariant?: string;
|
|
28
|
+
/**
|
|
29
|
+
* An optional network interception mode, this determines whether network interception
|
|
30
|
+
* is done in the JavaScript side or in the native Android and iOS SDK side.
|
|
31
|
+
*
|
|
32
|
+
* When set to `NetworkInterceptionMode.native`, configuring network logging
|
|
33
|
+
* should be done through native code not JavaScript (e.g. network request obfuscation).
|
|
34
|
+
*
|
|
35
|
+
* @default NetworkInterceptionMode.javascript
|
|
36
|
+
*/
|
|
37
|
+
networkInterceptionMode?: NetworkInterceptionMode;
|
|
38
|
+
/**
|
|
39
|
+
* An optional over air service update version to be used for all reports.
|
|
40
|
+
*/
|
|
41
|
+
overAirVersion?: OverAirUpdate;
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { NonFatalErrorLevel } from '../utils/Enums';
|
|
2
|
+
export interface NonFatalOptions {
|
|
3
|
+
/**
|
|
4
|
+
* An Optional extra user attributes attached to the crash
|
|
5
|
+
* */
|
|
6
|
+
userAttributes?: Record<string, string>;
|
|
7
|
+
/**
|
|
8
|
+
* An Optional key used to customize how crashes are grouped together
|
|
9
|
+
* */
|
|
10
|
+
fingerprint?: string;
|
|
11
|
+
/**
|
|
12
|
+
* An Optional different severity levels for errors
|
|
13
|
+
* */
|
|
14
|
+
level?: NonFatalErrorLevel;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OverAirUpdateServices } from '../utils/Enums';
|
|
2
|
+
export interface OverAirUpdate {
|
|
3
|
+
/**
|
|
4
|
+
* the name of OTA service
|
|
5
|
+
* e.g. `codePush` or `expo`
|
|
6
|
+
*/
|
|
7
|
+
service: OverAirUpdateServices;
|
|
8
|
+
/**
|
|
9
|
+
* The version or UUID of the OTA service
|
|
10
|
+
*/
|
|
11
|
+
version: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
interface LogInfo {
|
|
2
|
+
log: string;
|
|
3
|
+
type: 'verbose' | 'debug' | 'warn' | 'info' | 'error';
|
|
4
|
+
}
|
|
5
|
+
interface FileAttachmentInfo {
|
|
6
|
+
file: string;
|
|
7
|
+
type: 'url' | 'data';
|
|
8
|
+
}
|
|
9
|
+
export default class Report {
|
|
10
|
+
tags: string[];
|
|
11
|
+
consoleLogs: string[];
|
|
12
|
+
luciqLogs: LogInfo[];
|
|
13
|
+
userAttributes: Record<string, string>;
|
|
14
|
+
fileAttachments: FileAttachmentInfo[];
|
|
15
|
+
constructor(tags?: string[], consoleLogs?: string[], luciqLogs?: LogInfo[], userAttributes?: Record<string, string>, fileAttachments?: FileAttachmentInfo[]);
|
|
16
|
+
/**
|
|
17
|
+
* Append a tag to the report to be sent.
|
|
18
|
+
* @param tag
|
|
19
|
+
*/
|
|
20
|
+
appendTag(tag: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Append a console log to the report to be sent.
|
|
23
|
+
* @param consoleLog
|
|
24
|
+
*/
|
|
25
|
+
appendConsoleLog(consoleLog: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Add a user attribute with key and value to the report to be sent.
|
|
28
|
+
* @param key
|
|
29
|
+
* @param value
|
|
30
|
+
*/
|
|
31
|
+
setUserAttribute(key: string, value: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* Attach debug log to the report to be sent.
|
|
34
|
+
* @param log
|
|
35
|
+
*/
|
|
36
|
+
logDebug(log: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* Attach verbose log to the report to be sent.
|
|
39
|
+
* @param log
|
|
40
|
+
*/
|
|
41
|
+
logVerbose(log: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* Attach warn log to the report to be sent.
|
|
44
|
+
* @param log
|
|
45
|
+
*/
|
|
46
|
+
logWarn(log: string): void;
|
|
47
|
+
/**
|
|
48
|
+
* Attach error log to the report to be sent.
|
|
49
|
+
* @param log
|
|
50
|
+
*/
|
|
51
|
+
logError(log: string): void;
|
|
52
|
+
/**
|
|
53
|
+
* Attach info log to the report to be sent.
|
|
54
|
+
* @param log
|
|
55
|
+
*/
|
|
56
|
+
logInfo(log: string): void;
|
|
57
|
+
/**
|
|
58
|
+
* Attach a file to the report to be sent.
|
|
59
|
+
* @param url
|
|
60
|
+
* @param fileName
|
|
61
|
+
*/
|
|
62
|
+
addFileAttachmentWithUrl(url: string, fileName: string): void;
|
|
63
|
+
/**
|
|
64
|
+
* Attach a file to the report to be sent.
|
|
65
|
+
* @param data
|
|
66
|
+
* @param fileName
|
|
67
|
+
*/
|
|
68
|
+
addFileAttachmentWithData(data: string, fileName: string): void;
|
|
69
|
+
}
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
import { NativeLuciq } from '../native/NativeLuciq';
|
|
3
|
+
export default class Report {
|
|
4
|
+
tags;
|
|
5
|
+
consoleLogs;
|
|
6
|
+
luciqLogs;
|
|
7
|
+
userAttributes;
|
|
8
|
+
fileAttachments;
|
|
9
|
+
constructor(tags = [], consoleLogs = [], luciqLogs = [], userAttributes = {}, fileAttachments = []) {
|
|
10
|
+
this.tags = tags;
|
|
11
|
+
this.consoleLogs = consoleLogs;
|
|
12
|
+
this.luciqLogs = luciqLogs;
|
|
13
|
+
this.userAttributes = userAttributes;
|
|
14
|
+
this.fileAttachments = fileAttachments;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Append a tag to the report to be sent.
|
|
18
|
+
* @param tag
|
|
19
|
+
*/
|
|
20
|
+
appendTag(tag) {
|
|
21
|
+
NativeLuciq.appendTagToReport(tag);
|
|
22
|
+
this.tags = [...this.tags, tag];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Append a console log to the report to be sent.
|
|
26
|
+
* @param consoleLog
|
|
27
|
+
*/
|
|
28
|
+
appendConsoleLog(consoleLog) {
|
|
29
|
+
NativeLuciq.appendConsoleLogToReport(consoleLog);
|
|
30
|
+
this.consoleLogs = [...this.consoleLogs, consoleLog];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Add a user attribute with key and value to the report to be sent.
|
|
34
|
+
* @param key
|
|
35
|
+
* @param value
|
|
36
|
+
*/
|
|
37
|
+
setUserAttribute(key, value) {
|
|
38
|
+
NativeLuciq.setUserAttributeToReport(key, value);
|
|
39
|
+
this.userAttributes[key] = value;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Attach debug log to the report to be sent.
|
|
43
|
+
* @param log
|
|
44
|
+
*/
|
|
45
|
+
logDebug(log) {
|
|
46
|
+
NativeLuciq.logDebugToReport(log);
|
|
47
|
+
this.luciqLogs = [...this.luciqLogs, { log: log, type: 'debug' }];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Attach verbose log to the report to be sent.
|
|
51
|
+
* @param log
|
|
52
|
+
*/
|
|
53
|
+
logVerbose(log) {
|
|
54
|
+
NativeLuciq.logVerboseToReport(log);
|
|
55
|
+
this.luciqLogs = [...this.luciqLogs, { log: log, type: 'verbose' }];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Attach warn log to the report to be sent.
|
|
59
|
+
* @param log
|
|
60
|
+
*/
|
|
61
|
+
logWarn(log) {
|
|
62
|
+
NativeLuciq.logWarnToReport(log);
|
|
63
|
+
this.luciqLogs = [...this.luciqLogs, { log: log, type: 'warn' }];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Attach error log to the report to be sent.
|
|
67
|
+
* @param log
|
|
68
|
+
*/
|
|
69
|
+
logError(log) {
|
|
70
|
+
NativeLuciq.logErrorToReport(log);
|
|
71
|
+
this.luciqLogs = [...this.luciqLogs, { log: log, type: 'error' }];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Attach info log to the report to be sent.
|
|
75
|
+
* @param log
|
|
76
|
+
*/
|
|
77
|
+
logInfo(log) {
|
|
78
|
+
NativeLuciq.logInfoToReport(log);
|
|
79
|
+
this.luciqLogs = [...this.luciqLogs, { log: log, type: 'info' }];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Attach a file to the report to be sent.
|
|
83
|
+
* @param url
|
|
84
|
+
* @param fileName
|
|
85
|
+
*/
|
|
86
|
+
addFileAttachmentWithUrl(url, fileName) {
|
|
87
|
+
if (Platform.OS === 'ios') {
|
|
88
|
+
NativeLuciq.addFileAttachmentWithURLToReport(url);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
NativeLuciq.addFileAttachmentWithURLToReport(url, fileName);
|
|
92
|
+
}
|
|
93
|
+
this.fileAttachments = [...this.fileAttachments, { file: url, type: 'url' }];
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Attach a file to the report to be sent.
|
|
97
|
+
* @param data
|
|
98
|
+
* @param fileName
|
|
99
|
+
*/
|
|
100
|
+
addFileAttachmentWithData(data, fileName) {
|
|
101
|
+
if (Platform.OS === 'ios') {
|
|
102
|
+
NativeLuciq.addFileAttachmentWithDataToReport(data);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
NativeLuciq.addFileAttachmentWithDataToReport(data, fileName);
|
|
106
|
+
}
|
|
107
|
+
this.fileAttachments = [...this.fileAttachments, { file: data, type: 'data' }];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ReproStepsMode } from '../utils/Enums';
|
|
2
|
+
export interface ReproConfig {
|
|
3
|
+
/**
|
|
4
|
+
* Repro steps mode for Bug Reporting.
|
|
5
|
+
*
|
|
6
|
+
* @default ReproStepsMode.enabled
|
|
7
|
+
*/
|
|
8
|
+
bug?: ReproStepsMode;
|
|
9
|
+
/**
|
|
10
|
+
* Repro steps mode for Crash Reporting.
|
|
11
|
+
*
|
|
12
|
+
* @default ReproStepsMode.enabledWithNoScreenshots
|
|
13
|
+
*/
|
|
14
|
+
crash?: ReproStepsMode;
|
|
15
|
+
/**
|
|
16
|
+
* Repro steps mode for Session Replay.
|
|
17
|
+
*
|
|
18
|
+
* @default ReproStepsMode.enabled
|
|
19
|
+
*/
|
|
20
|
+
sessionReplay?: ReproStepsMode;
|
|
21
|
+
/**
|
|
22
|
+
* Repro steps mode for Bug Reporting, Crash Reporting, and Session Replay.
|
|
23
|
+
*
|
|
24
|
+
* When this is set, `bug`, `crash`, and `sessionReplay` will be ignored.
|
|
25
|
+
*/
|
|
26
|
+
all?: ReproStepsMode;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|