@bugfender/rn-bugfender 1.1.3 → 2.0.0-alpha.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.
Files changed (166) hide show
  1. package/README.md +110 -86
  2. package/RnBugfender.podspec +21 -0
  3. package/android/.gradle/7.1/dependencies-accessors/dependencies-accessors.lock +0 -0
  4. package/android/.gradle/{5.6.4 → 7.1/dependencies-accessors}/gc.properties +0 -0
  5. package/android/.gradle/7.1/executionHistory/executionHistory.bin +0 -0
  6. package/android/.gradle/7.1/executionHistory/executionHistory.lock +0 -0
  7. package/android/.gradle/{5.6.4 → 7.1}/fileChanges/last-build.bin +0 -0
  8. package/android/.gradle/7.1/fileHashes/fileHashes.bin +0 -0
  9. package/android/.gradle/7.1/fileHashes/fileHashes.lock +0 -0
  10. package/android/.gradle/7.1/gc.properties +0 -0
  11. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  12. package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
  13. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  14. package/android/.gradle/checksums/checksums.lock +0 -0
  15. package/android/.gradle/{5.6.4/fileHashes/fileHashes.bin → checksums/md5-checksums.bin} +0 -0
  16. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  17. package/android/.idea/compiler.xml +6 -0
  18. package/android/.idea/gradle.xml +1 -2
  19. package/android/.idea/jarRepositories.xml +40 -0
  20. package/android/.idea/misc.xml +4 -110
  21. package/android/.idea/runConfigurations.xml +1 -3
  22. package/android/.idea/uiDesigner.xml +124 -0
  23. package/android/build.gradle +47 -24
  24. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  25. package/android/gradle/wrapper/gradle-wrapper.properties +1 -2
  26. package/android/gradlew +34 -21
  27. package/android/gradlew.bat +24 -19
  28. package/android/src/main/AndroidManifest.xml +4 -3
  29. package/android/src/main/java/com/bugfender/react/{RNBugfenderModule.java → RnBugfenderModule.java} +88 -13
  30. package/android/src/main/java/com/bugfender/react/RnBugfenderPackage.java +28 -0
  31. package/ios/RnBugfender.h +5 -0
  32. package/ios/{RNBugfender.m → RnBugfender.m} +67 -8
  33. package/ios/{RNBugfender.xcodeproj → RnBugfender.xcodeproj}/project.pbxproj +42 -37
  34. package/ios/{RNBugfender.xcodeproj → RnBugfender.xcodeproj}/project.xcworkspace/contents.xcworkspacedata +0 -3
  35. package/ios/{RNBugfender.xcodeproj → RnBugfender.xcodeproj}/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
  36. package/ios/RnBugfender.xcodeproj/project.xcworkspace/xcuserdata/fj.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  37. package/ios/{RNBugfender.xcodeproj/xcuserdata/rubenvot.xcuserdatad → RnBugfender.xcodeproj/xcuserdata/fj.xcuserdatad}/xcschemes/xcschememanagement.plist +1 -6
  38. package/lib/commonjs/bugfender.js +338 -0
  39. package/lib/commonjs/bugfender.js.map +1 -0
  40. package/lib/commonjs/index.js +28 -0
  41. package/lib/commonjs/index.js.map +1 -0
  42. package/lib/commonjs/index.web.js +30 -0
  43. package/lib/commonjs/index.web.js.map +1 -0
  44. package/lib/commonjs/override-console-methods.js +91 -0
  45. package/lib/commonjs/override-console-methods.js.map +1 -0
  46. package/lib/commonjs/print-to-console.js +78 -0
  47. package/lib/commonjs/print-to-console.js.map +1 -0
  48. package/lib/commonjs/sdk-options.js +81 -0
  49. package/lib/commonjs/sdk-options.js.map +1 -0
  50. package/lib/commonjs/string-formatter.js +55 -0
  51. package/lib/commonjs/string-formatter.js.map +1 -0
  52. package/lib/commonjs/types/device.js +2 -0
  53. package/lib/commonjs/types/device.js.map +1 -0
  54. package/lib/commonjs/types/log.js +35 -0
  55. package/lib/commonjs/types/log.js.map +1 -0
  56. package/lib/commonjs/types/sdk-options.js +55 -0
  57. package/lib/commonjs/types/sdk-options.js.map +1 -0
  58. package/lib/commonjs/user-feedback.js +31 -0
  59. package/lib/commonjs/user-feedback.js.map +1 -0
  60. package/lib/module/bugfender.js +323 -0
  61. package/lib/module/bugfender.js.map +1 -0
  62. package/lib/module/index.js +6 -0
  63. package/lib/module/index.js.map +1 -0
  64. package/lib/module/index.web.js +5 -0
  65. package/lib/module/index.web.js.map +1 -0
  66. package/lib/module/override-console-methods.js +75 -0
  67. package/lib/module/override-console-methods.js.map +1 -0
  68. package/lib/module/print-to-console.js +67 -0
  69. package/lib/module/print-to-console.js.map +1 -0
  70. package/lib/module/sdk-options.js +72 -0
  71. package/lib/module/sdk-options.js.map +1 -0
  72. package/lib/module/string-formatter.js +45 -0
  73. package/lib/module/string-formatter.js.map +1 -0
  74. package/lib/module/types/device.js +2 -0
  75. package/lib/module/types/device.js.map +1 -0
  76. package/lib/module/types/log.js +24 -0
  77. package/lib/module/types/log.js.map +1 -0
  78. package/lib/module/types/sdk-options.js +46 -0
  79. package/lib/module/types/sdk-options.js.map +1 -0
  80. package/lib/module/user-feedback.js +22 -0
  81. package/lib/module/user-feedback.js.map +1 -0
  82. package/lib/typescript/bugfender.d.ts +163 -0
  83. package/lib/typescript/index.d.ts +5 -0
  84. package/lib/typescript/index.web.d.ts +4 -0
  85. package/lib/typescript/override-console-methods.d.ts +10 -0
  86. package/lib/typescript/print-to-console.d.ts +14 -0
  87. package/lib/typescript/sdk-options.d.ts +16 -0
  88. package/lib/typescript/string-formatter.d.ts +4 -0
  89. package/lib/typescript/types/device.d.ts +4 -0
  90. package/lib/typescript/types/log.d.ts +59 -0
  91. package/lib/typescript/types/sdk-options.d.ts +40 -0
  92. package/lib/typescript/user-feedback.d.ts +31 -0
  93. package/package.json +146 -12
  94. package/src/bugfender.ts +360 -0
  95. package/src/index.tsx +7 -0
  96. package/src/index.web.tsx +5 -0
  97. package/src/override-console-methods.ts +53 -0
  98. package/src/print-to-console.ts +67 -0
  99. package/src/sdk-options.ts +68 -0
  100. package/src/string-formatter.ts +44 -0
  101. package/src/types/device.ts +4 -0
  102. package/src/types/log.ts +75 -0
  103. package/src/types/sdk-options.ts +81 -0
  104. package/src/user-feedback.ts +33 -0
  105. package/.idea/codeStyles/Project.xml +0 -116
  106. package/.idea/modules.xml +0 -8
  107. package/.idea/rn-bugfender.iml +0 -9
  108. package/.idea/vcs.xml +0 -6
  109. package/RNBugfender.podspec +0 -26
  110. package/android/.gradle/5.6.4/fileHashes/fileHashes.lock +0 -0
  111. package/android/.idea/caches/build_file_checksums.ser +0 -0
  112. package/android/.idea/codeStyles/Project.xml +0 -116
  113. package/android/.idea/libraries/Gradle__com_android_support_appcompat_v7_23_0_1_aar.xml +0 -15
  114. package/android/.idea/libraries/Gradle__com_android_support_recyclerview_v7_23_0_1_aar.xml +0 -12
  115. package/android/.idea/libraries/Gradle__com_android_support_support_annotations_23_0_1_jar.xml +0 -11
  116. package/android/.idea/libraries/Gradle__com_android_support_support_v4_23_0_1_aar.xml +0 -16
  117. package/android/.idea/libraries/Gradle__com_bugfender_sdk_android_3_0_5_aar.xml +0 -12
  118. package/android/.idea/libraries/Gradle__com_facebook_fresco_drawee_0_8_1_aar.xml +0 -12
  119. package/android/.idea/libraries/Gradle__com_facebook_fresco_fbcore_0_8_1_aar.xml +0 -12
  120. package/android/.idea/libraries/Gradle__com_facebook_fresco_fresco_0_8_1_aar.xml +0 -12
  121. package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_0_8_1_aar.xml +0 -12
  122. package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_okhttp_0_8_1_aar.xml +0 -12
  123. package/android/.idea/libraries/Gradle__com_facebook_react_react_native_0_20_1_aar.xml +0 -16
  124. package/android/.idea/libraries/Gradle__com_facebook_stetho_stetho_1_2_0_jar.xml +0 -11
  125. package/android/.idea/libraries/Gradle__com_facebook_stetho_stetho_okhttp_1_2_0_jar.xml +0 -11
  126. package/android/.idea/libraries/Gradle__com_fasterxml_jackson_core_jackson_core_2_2_3_jar.xml +0 -11
  127. package/android/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_3_0_0_jar.xml +0 -11
  128. package/android/.idea/libraries/Gradle__com_nineoldandroids_library_2_4_0_jar.xml +0 -11
  129. package/android/.idea/libraries/Gradle__com_parse_bolts_bolts_android_1_1_4_jar.xml +0 -11
  130. package/android/.idea/libraries/Gradle__com_squareup_okhttp_okhttp_2_5_0_jar.xml +0 -11
  131. package/android/.idea/libraries/Gradle__com_squareup_okhttp_okhttp_ws_2_5_0_jar.xml +0 -11
  132. package/android/.idea/libraries/Gradle__com_squareup_okio_okio_1_6_0_jar.xml +0 -11
  133. package/android/.idea/libraries/Gradle__commons_cli_commons_cli_1_2_jar.xml +0 -13
  134. package/android/.idea/libraries/Gradle__org_webkit_android_jsc_r174650_aar.xml +0 -10
  135. package/android/.idea/modules.xml +0 -8
  136. package/android/android.iml +0 -116
  137. package/android/build/generated/source/buildConfig/debug/com/bugfender/react/BuildConfig.java +0 -13
  138. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +0 -11
  139. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output.json +0 -1
  140. package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +0 -1
  141. package/android/build/intermediates/compile_library_classes/debug/classes.jar +0 -0
  142. package/android/build/intermediates/compile_only_not_namespaced_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
  143. package/android/build/intermediates/incremental/debug-mergeJniLibs/merge-state +0 -0
  144. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +0 -2
  145. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +0 -2
  146. package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +0 -2
  147. package/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties +0 -1
  148. package/android/build/intermediates/incremental/packageDebugResources/merger.xml +0 -2
  149. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/bugfender/react/BuildConfig.class +0 -0
  150. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/bugfender/react/RNBugfenderModule.class +0 -0
  151. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/bugfender/react/RNBugfenderPackage.class +0 -0
  152. package/android/build/intermediates/library_java_res/debug/res.jar +0 -0
  153. package/android/build/intermediates/library_manifest/debug/AndroidManifest.xml +0 -11
  154. package/android/build/intermediates/merged_manifests/debug/output.json +0 -1
  155. package/android/build/intermediates/res/symbol-table-with-package/debug/package-aware-r.txt +0 -1309
  156. package/android/build/intermediates/runtime_library_classes/debug/classes.jar +0 -0
  157. package/android/build/intermediates/symbols/debug/R.txt +0 -1783
  158. package/android/build/intermediates/transforms/mergeJniLibs/debug/__content__.json +0 -1
  159. package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -37
  160. package/android/local.properties +0 -8
  161. package/android/src/main/java/com/bugfender/react/RNBugfenderPackage.java +0 -29
  162. package/bugfender.js +0 -188
  163. package/example/.babelrc +0 -3
  164. package/example/.watchmanconfig +0 -1
  165. package/example/App.js +0 -121
  166. package/ios/RNBugfender.h +0 -7
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SDKOptions = void 0;
7
+
8
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
+
10
+ class SDKOptions {
11
+ constructor() {
12
+ _defineProperty(this, "rules", {
13
+ appKey: ['required', 'string'],
14
+ apiURL: ['string', 'url'],
15
+ baseURL: ['string', 'url'],
16
+ overrideConsoleMethods: ['boolean'],
17
+ printToConsole: ['boolean'],
18
+ logBrowserEvents: ['boolean'],
19
+ logUIEvents: ['boolean'],
20
+ registerErrorHandler: ['boolean'],
21
+ version: ['string']
22
+ });
23
+ }
24
+
25
+ init(options) {
26
+ // Validate user provided options
27
+ this.validate(options); // Removing undefined attributes
28
+
29
+ options = { ...options
30
+ };
31
+ Object.entries(options).forEach(_ref => {
32
+ let [key, value] = _ref;
33
+
34
+ if (value === undefined) {
35
+ // @ts-ignore
36
+ delete options[key];
37
+ }
38
+ }); // Set default values if needed
39
+
40
+ return {
41
+ overrideConsoleMethods: true,
42
+ printToConsole: true,
43
+ logUIEvents: true,
44
+ registerErrorHandler: true,
45
+ enableLogcatLogging: false,
46
+ ...options
47
+ };
48
+ }
49
+
50
+ validate(options) {
51
+ const urlValidator = new RegExp(/^http(s)?:\/\//i);
52
+ Object.entries(this.rules).forEach(_ref2 => {
53
+ let [key, rules] = _ref2;
54
+ // @ts-ignore
55
+ const value = options[key];
56
+ rules.forEach(rule => {
57
+ if (rule === 'required') {
58
+ if (typeof value === 'undefined') {
59
+ throw new Error(`Bugfender requires '${key}' option to initialize.`);
60
+ }
61
+ } else if (rule === 'string') {
62
+ if (!['string', 'undefined'].includes(typeof value)) {
63
+ throw new Error(`'${key}' option must be a string.`);
64
+ }
65
+ } else if (rule === 'url') {
66
+ if (typeof value !== 'undefined' && !urlValidator.test(value)) {
67
+ throw new Error(`'${key}' option must be a valid URL.`);
68
+ }
69
+ } else if (rule === 'boolean') {
70
+ if (!['boolean', 'undefined'].includes(typeof value)) {
71
+ throw new Error(`'${key}' option must be a boolean.`);
72
+ }
73
+ }
74
+ });
75
+ });
76
+ }
77
+
78
+ }
79
+
80
+ exports.SDKOptions = SDKOptions;
81
+ //# sourceMappingURL=sdk-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["sdk-options.ts"],"names":["SDKOptions","appKey","apiURL","baseURL","overrideConsoleMethods","printToConsole","logBrowserEvents","logUIEvents","registerErrorHandler","version","init","options","validate","Object","entries","forEach","key","value","undefined","enableLogcatLogging","urlValidator","RegExp","rules","rule","Error","includes","test"],"mappings":";;;;;;;;;AAEO,MAAMA,UAAN,CAAiB;AAAA;AAAA,mCACJ;AAChBC,MAAAA,MAAM,EAAE,CAAC,UAAD,EAAa,QAAb,CADQ;AAEhBC,MAAAA,MAAM,EAAE,CAAC,QAAD,EAAW,KAAX,CAFQ;AAGhBC,MAAAA,OAAO,EAAE,CAAC,QAAD,EAAW,KAAX,CAHO;AAIhBC,MAAAA,sBAAsB,EAAE,CAAC,SAAD,CAJR;AAKhBC,MAAAA,cAAc,EAAE,CAAC,SAAD,CALA;AAMhBC,MAAAA,gBAAgB,EAAE,CAAC,SAAD,CANF;AAOhBC,MAAAA,WAAW,EAAE,CAAC,SAAD,CAPG;AAQhBC,MAAAA,oBAAoB,EAAE,CAAC,SAAD,CARN;AAShBC,MAAAA,OAAO,EAAE,CAAC,QAAD;AATO,KADI;AAAA;;AAafC,EAAAA,IAAI,CAACC,OAAD,EAAoC;AAC7C;AACA,SAAKC,QAAL,CAAcD,OAAd,EAF6C,CAI7C;;AACAA,IAAAA,OAAO,GAAG,EAAE,GAAGA;AAAL,KAAV;AACAE,IAAAA,MAAM,CAACC,OAAP,CAAeH,OAAf,EAAwBI,OAAxB,CAAgC,QAAkB;AAAA,UAAjB,CAACC,GAAD,EAAMC,KAAN,CAAiB;;AAChD,UAAIA,KAAK,KAAKC,SAAd,EAAyB;AACvB;AACA,eAAOP,OAAO,CAACK,GAAD,CAAd;AACD;AACF,KALD,EAN6C,CAa7C;;AACA,WAAO;AACLZ,MAAAA,sBAAsB,EAAE,IADnB;AAELC,MAAAA,cAAc,EAAE,IAFX;AAGLE,MAAAA,WAAW,EAAE,IAHR;AAILC,MAAAA,oBAAoB,EAAE,IAJjB;AAKLW,MAAAA,mBAAmB,EAAE,KALhB;AAML,SAAGR;AANE,KAAP;AAQD;;AAESC,EAAAA,QAAQ,CAACD,OAAD,EAA6B;AAC7C,UAAMS,YAAY,GAAG,IAAIC,MAAJ,CAAW,iBAAX,CAArB;AAEAR,IAAAA,MAAM,CAACC,OAAP,CAAe,KAAKQ,KAApB,EAA2BP,OAA3B,CAAmC,SAAkB;AAAA,UAAjB,CAACC,GAAD,EAAMM,KAAN,CAAiB;AACnD;AACA,YAAML,KAAK,GAAGN,OAAO,CAACK,GAAD,CAArB;AAEAM,MAAAA,KAAK,CAACP,OAAN,CAAcQ,IAAI,IAAI;AACpB,YAAIA,IAAI,KAAK,UAAb,EAAyB;AACvB,cAAI,OAAON,KAAP,KAAiB,WAArB,EAAkC;AAChC,kBAAM,IAAIO,KAAJ,CAAW,uBAAsBR,GAAI,yBAArC,CAAN;AACD;AACF,SAJD,MAIO,IAAIO,IAAI,KAAK,QAAb,EAAuB;AAC5B,cAAI,CAAC,CAAC,QAAD,EAAW,WAAX,EAAwBE,QAAxB,CAAiC,OAAOR,KAAxC,CAAL,EAAqD;AACnD,kBAAM,IAAIO,KAAJ,CAAW,IAAGR,GAAI,4BAAlB,CAAN;AACD;AACF,SAJM,MAIA,IAAIO,IAAI,KAAK,KAAb,EAAoB;AACzB,cAAI,OAAON,KAAP,KAAiB,WAAjB,IAAgC,CAACG,YAAY,CAACM,IAAb,CAAkBT,KAAlB,CAArC,EAA+D;AAC7D,kBAAM,IAAIO,KAAJ,CAAW,IAAGR,GAAI,+BAAlB,CAAN;AACD;AACF,SAJM,MAIA,IAAIO,IAAI,KAAK,SAAb,EAAwB;AAC7B,cAAI,CAAC,CAAC,SAAD,EAAY,WAAZ,EAAyBE,QAAzB,CAAkC,OAAOR,KAAzC,CAAL,EAAsD;AACpD,kBAAM,IAAIO,KAAJ,CAAW,IAAGR,GAAI,6BAAlB,CAAN;AACD;AACF;AACF,OAlBD;AAmBD,KAvBD;AAwBD;;AAhEqB","sourcesContent":["import type {ISDKOptions} from \"./types/sdk-options\";\n\nexport class SDKOptions {\n protected rules = {\n appKey: ['required', 'string'],\n apiURL: ['string', 'url'],\n baseURL: ['string', 'url'],\n overrideConsoleMethods: ['boolean'],\n printToConsole: ['boolean'],\n logBrowserEvents: ['boolean'],\n logUIEvents: ['boolean'],\n registerErrorHandler: ['boolean'],\n version: ['string'],\n };\n\n public init(options: ISDKOptions): ISDKOptions {\n // Validate user provided options\n this.validate(options);\n\n // Removing undefined attributes\n options = { ...options };\n Object.entries(options).forEach(([key, value]) => {\n if (value === undefined) {\n // @ts-ignore\n delete options[key];\n }\n });\n\n // Set default values if needed\n return {\n overrideConsoleMethods: true,\n printToConsole: true,\n logUIEvents: true,\n registerErrorHandler: true,\n enableLogcatLogging: false,\n ...options,\n };\n }\n\n protected validate(options: ISDKOptions): void {\n const urlValidator = new RegExp(/^http(s)?:\\/\\//i);\n\n Object.entries(this.rules).forEach(([key, rules]) => {\n // @ts-ignore\n const value = options[key];\n\n rules.forEach(rule => {\n if (rule === 'required') {\n if (typeof value === 'undefined') {\n throw new Error(`Bugfender requires '${key}' option to initialize.`)\n }\n } else if (rule === 'string') {\n if (!['string', 'undefined'].includes(typeof value)) {\n throw new Error(`'${key}' option must be a string.`);\n }\n } else if (rule === 'url') {\n if (typeof value !== 'undefined' && !urlValidator.test(value)) {\n throw new Error(`'${key}' option must be a valid URL.`);\n }\n } else if (rule === 'boolean') {\n if (!['boolean', 'undefined'].includes(typeof value)) {\n throw new Error(`'${key}' option must be a boolean.`);\n }\n }\n })\n });\n }\n}\n"]}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StringFormatter = void 0;
7
+
8
+ var _util = require("util");
9
+
10
+ class StringFormatter {
11
+ format(parameters) {
12
+ const [, ...textParams] = parameters;
13
+ let [textFormat] = parameters;
14
+ let text;
15
+
16
+ try {
17
+ // Our sanitizer gives better results, try with it first
18
+ textFormat = this.toString(textFormat);
19
+ } catch {
20
+ // Fallback to `format`
21
+ textFormat = (0, _util.format)(textFormat);
22
+ }
23
+
24
+ if (textParams.length > 0) {
25
+ text = (0, _util.format)(textFormat, ...textParams);
26
+ } else {
27
+ text = textFormat;
28
+ }
29
+
30
+ return text;
31
+ }
32
+
33
+ toString(value) {
34
+ // Depending on the type we prefer to do `String` or `stringify`
35
+ const isToString = ['string', 'symbol', 'bigint', 'function'].includes(typeof value) || value instanceof Error;
36
+
37
+ if (isToString) {
38
+ try {
39
+ return String(value);
40
+ } catch {
41
+ return JSON.stringify(value);
42
+ }
43
+ } else {
44
+ try {
45
+ return JSON.stringify(value);
46
+ } catch {
47
+ return String(value);
48
+ }
49
+ }
50
+ }
51
+
52
+ }
53
+
54
+ exports.StringFormatter = StringFormatter;
55
+ //# sourceMappingURL=string-formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["string-formatter.ts"],"names":["StringFormatter","format","parameters","textParams","textFormat","text","toString","length","value","isToString","includes","Error","String","JSON","stringify"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,eAAN,CAAsB;AACpBC,EAAAA,MAAM,CAACC,UAAD,EAAgC;AAC3C,UAAM,GAAG,GAAGC,UAAN,IAAoBD,UAA1B;AACA,QAAI,CAACE,UAAD,IAAeF,UAAnB;AACA,QAAIG,IAAJ;;AAEA,QAAI;AACF;AACAD,MAAAA,UAAU,GAAG,KAAKE,QAAL,CAAcF,UAAd,CAAb;AACD,KAHD,CAGE,MAAM;AACN;AACAA,MAAAA,UAAU,GAAG,kBAAOA,UAAP,CAAb;AACD;;AAED,QAAID,UAAU,CAACI,MAAX,GAAoB,CAAxB,EAA2B;AACzBF,MAAAA,IAAI,GAAG,kBAAOD,UAAP,EAAmB,GAAGD,UAAtB,CAAP;AACD,KAFD,MAEO;AACLE,MAAAA,IAAI,GAAGD,UAAP;AACD;;AAED,WAAOC,IAAP;AACD;;AAEOC,EAAAA,QAAQ,CAACE,KAAD,EAAyB;AACvC;AACA,UAAMC,UAAU,GAAG,CAAC,QAAD,EAAW,QAAX,EAAqB,QAArB,EAA+B,UAA/B,EAA2CC,QAA3C,CAAoD,OAAOF,KAA3D,KAAqEA,KAAK,YAAYG,KAAzG;;AAEA,QAAIF,UAAJ,EAAgB;AACd,UAAI;AACF,eAAOG,MAAM,CAACJ,KAAD,CAAb;AACD,OAFD,CAEE,MAAM;AACN,eAAOK,IAAI,CAACC,SAAL,CAAeN,KAAf,CAAP;AACD;AACF,KAND,MAMO;AACL,UAAI;AACF,eAAOK,IAAI,CAACC,SAAL,CAAeN,KAAf,CAAP;AACD,OAFD,CAEE,MAAM;AACN,eAAOI,MAAM,CAACJ,KAAD,CAAb;AACD;AACF;AACF;;AAxC0B","sourcesContent":["import {format} from \"util\";\n\nexport class StringFormatter {\n public format(parameters: unknown[]): string {\n const [, ...textParams] = parameters;\n let [textFormat] = parameters as string[];\n let text: string;\n\n try {\n // Our sanitizer gives better results, try with it first\n textFormat = this.toString(textFormat);\n } catch {\n // Fallback to `format`\n textFormat = format(textFormat);\n }\n\n if (textParams.length > 0) {\n text = format(textFormat, ...textParams);\n } else {\n text = textFormat;\n }\n\n return text;\n }\n\n private toString(value: unknown): string {\n // Depending on the type we prefer to do `String` or `stringify`\n const isToString = ['string', 'symbol', 'bigint', 'function'].includes(typeof value) || value instanceof Error;\n\n if (isToString) {\n try {\n return String(value);\n } catch {\n return JSON.stringify(value);\n }\n } else {\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n }\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=device.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.LogLevel = exports.LOG_LEVELS = void 0;
7
+
8
+ /**
9
+ * Log Levels
10
+ *
11
+ * Check the main README to see how to access the `LogLevel` enum.
12
+ */
13
+ let LogLevel;
14
+ /**
15
+ * @hidden
16
+ */
17
+
18
+ exports.LogLevel = LogLevel;
19
+
20
+ (function (LogLevel) {
21
+ LogLevel[LogLevel["Debug"] = 0] = "Debug";
22
+ LogLevel[LogLevel["Warning"] = 1] = "Warning";
23
+ LogLevel[LogLevel["Error"] = 2] = "Error";
24
+ LogLevel[LogLevel["Trace"] = 3] = "Trace";
25
+ LogLevel[LogLevel["Info"] = 4] = "Info";
26
+ LogLevel[LogLevel["Fatal"] = 5] = "Fatal";
27
+ })(LogLevel || (exports.LogLevel = LogLevel = {}));
28
+
29
+ const LOG_LEVELS = [LogLevel.Debug, LogLevel.Warning, LogLevel.Error, LogLevel.Trace, LogLevel.Info, LogLevel.Fatal];
30
+ /**
31
+ * @hidden
32
+ */
33
+
34
+ exports.LOG_LEVELS = LOG_LEVELS;
35
+ //# sourceMappingURL=log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["log.ts"],"names":["LogLevel","LOG_LEVELS","Debug","Warning","Error","Trace","Info","Fatal"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;IACYA,Q;AASZ;AACA;AACA;;;;WAXYA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;GAAAA,Q,wBAAAA,Q;;AAYL,MAAMC,UAAsB,GAAG,CACpCD,QAAQ,CAACE,KAD2B,EAEpCF,QAAQ,CAACG,OAF2B,EAGpCH,QAAQ,CAACI,KAH2B,EAIpCJ,QAAQ,CAACK,KAJ2B,EAKpCL,QAAQ,CAACM,IAL2B,EAMpCN,QAAQ,CAACO,KAN2B,CAA/B;AASP;AACA;AACA","sourcesContent":["/**\n * Log Levels\n *\n * Check the main README to see how to access the `LogLevel` enum.\n */\nexport enum LogLevel {\n Debug = 0,\n Warning = 1,\n Error = 2,\n Trace = 3,\n Info = 4,\n Fatal = 5,\n}\n\n/**\n * @hidden\n */\nexport const LOG_LEVELS: LogLevel[] = [\n LogLevel.Debug,\n LogLevel.Warning,\n LogLevel.Error,\n LogLevel.Trace,\n LogLevel.Info,\n LogLevel.Fatal,\n];\n\n/**\n * @hidden\n */\nexport interface ILogEntryShort {\n /** Date ISO */\n x: string;\n /** Text */\n t: string;\n /** Method */\n m: string;\n /** Absolute Time */\n at: number;\n /** Tag */\n tg: string;\n /** File */\n f: string;\n /** Line */\n l: number;\n /** Level */\n ll: number;\n /** URL */\n u: string;\n}\n\n/**\n * Log Entry object interface\n */\nexport interface ILogEntry {\n /** The line number where the log was triggered from */\n line?: number;\n\n /** The log's level based on LogLevel constant */\n level?: LogLevel;\n\n /** The log's tag */\n tag?: string;\n\n /** The method name where the log was triggered from */\n method?: string;\n\n /** The file name where the log was triggered from */\n file?: string;\n\n /** The log's text content */\n text?: string;\n\n /** The log's origin URL. This attribute is ignored on Android & iOS */\n url?: string;\n}\n"]}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SDKOptionsBuilder = void 0;
7
+
8
+ class SDKOptionsBuilder {
9
+ constructor(commonOptions) {
10
+ this.commonOptions = commonOptions;
11
+ }
12
+
13
+ native(nativeOptions) {
14
+ this.nativeOptions = nativeOptions;
15
+ return this;
16
+ }
17
+
18
+ web(webOptions) {
19
+ this.webOptions = webOptions;
20
+ return this;
21
+ }
22
+
23
+ build() {
24
+ var _this$webOptions, _this$webOptions2, _this$webOptions3, _this$nativeOptions;
25
+
26
+ const options = {
27
+ appKey: this.commonOptions.appKey,
28
+ apiURL: this.commonOptions.apiURL,
29
+ baseURL: this.commonOptions.baseURL,
30
+ overrideConsoleMethods: this.commonOptions.overrideConsoleMethods,
31
+ printToConsole: this.commonOptions.printToConsole,
32
+ logUIEvents: this.commonOptions.logUIEvents,
33
+ registerErrorHandler: this.commonOptions.registerErrorHandler,
34
+ deviceName: this.commonOptions.deviceName,
35
+ logBrowserEvents: (_this$webOptions = this.webOptions) === null || _this$webOptions === void 0 ? void 0 : _this$webOptions.logBrowserEvents,
36
+ build: (_this$webOptions2 = this.webOptions) === null || _this$webOptions2 === void 0 ? void 0 : _this$webOptions2.build,
37
+ version: (_this$webOptions3 = this.webOptions) === null || _this$webOptions3 === void 0 ? void 0 : _this$webOptions3.version,
38
+ enableLogcatLogging: (_this$nativeOptions = this.nativeOptions) === null || _this$nativeOptions === void 0 ? void 0 : _this$nativeOptions.enableLogcatLogging
39
+ }; // Removing undefined attributes
40
+
41
+ Object.entries(options).forEach(_ref => {
42
+ let [key, value] = _ref;
43
+
44
+ if (value === undefined) {
45
+ // @ts-ignore
46
+ delete options[key];
47
+ }
48
+ });
49
+ return options;
50
+ }
51
+
52
+ }
53
+
54
+ exports.SDKOptionsBuilder = SDKOptionsBuilder;
55
+ //# sourceMappingURL=sdk-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["sdk-options.ts"],"names":["SDKOptionsBuilder","constructor","commonOptions","native","nativeOptions","web","webOptions","build","options","appKey","apiURL","baseURL","overrideConsoleMethods","printToConsole","logUIEvents","registerErrorHandler","deviceName","logBrowserEvents","version","enableLogcatLogging","Object","entries","forEach","key","value","undefined"],"mappings":";;;;;;;AAmCO,MAAMA,iBAAN,CAAwB;AAK7BC,EAAAA,WAAW,CAACC,aAAD,EAAmC;AAC5C,SAAKA,aAAL,GAAqBA,aAArB;AACD;;AAEMC,EAAAA,MAAM,CAACC,aAAD,EAAsD;AACjE,SAAKA,aAAL,GAAqBA,aAArB;AACA,WAAO,IAAP;AACD;;AAEMC,EAAAA,GAAG,CAACC,UAAD,EAAgD;AACxD,SAAKA,UAAL,GAAkBA,UAAlB;AACA,WAAO,IAAP;AACD;;AAEMC,EAAAA,KAAK,GAAgB;AAAA;;AAC1B,UAAMC,OAAoB,GAAG;AAC3BC,MAAAA,MAAM,EAAE,KAAKP,aAAL,CAAmBO,MADA;AAE3BC,MAAAA,MAAM,EAAE,KAAKR,aAAL,CAAmBQ,MAFA;AAG3BC,MAAAA,OAAO,EAAE,KAAKT,aAAL,CAAmBS,OAHD;AAI3BC,MAAAA,sBAAsB,EAAE,KAAKV,aAAL,CAAmBU,sBAJhB;AAK3BC,MAAAA,cAAc,EAAE,KAAKX,aAAL,CAAmBW,cALR;AAM3BC,MAAAA,WAAW,EAAE,KAAKZ,aAAL,CAAmBY,WANL;AAO3BC,MAAAA,oBAAoB,EAAE,KAAKb,aAAL,CAAmBa,oBAPd;AAQ3BC,MAAAA,UAAU,EAAE,KAAKd,aAAL,CAAmBc,UARJ;AAS3BC,MAAAA,gBAAgB,sBAAE,KAAKX,UAAP,qDAAE,iBAAiBW,gBATR;AAU3BV,MAAAA,KAAK,uBAAE,KAAKD,UAAP,sDAAE,kBAAiBC,KAVG;AAW3BW,MAAAA,OAAO,uBAAE,KAAKZ,UAAP,sDAAE,kBAAiBY,OAXC;AAY3BC,MAAAA,mBAAmB,yBAAE,KAAKf,aAAP,wDAAE,oBAAoBe;AAZd,KAA7B,CAD0B,CAgB1B;;AACAC,IAAAA,MAAM,CAACC,OAAP,CAAeb,OAAf,EAAwBc,OAAxB,CAAgC,QAAkB;AAAA,UAAjB,CAACC,GAAD,EAAMC,KAAN,CAAiB;;AAChD,UAAIA,KAAK,KAAKC,SAAd,EAAyB;AACvB;AACA,eAAOjB,OAAO,CAACe,GAAD,CAAd;AACD;AACF,KALD;AAOA,WAAOf,OAAP;AACD;;AA5C4B","sourcesContent":["export interface ISDKCommonOptions {\n /** The app key to log into */\n appKey: string;\n /** Base URL to Bugfender API */\n apiURL?: string;\n /** Base URL to Bugfender web dashboard */\n baseURL?: string;\n /** Override default `window.console` so it also logs to Bugfender. Defaults to `true`. */\n overrideConsoleMethods?: boolean;\n /** Print also with `window.console` when Bugfender logging methods are called. Defaults to `true`. */\n printToConsole?: boolean;\n /** Register a handler for most common UI events to report them to Bugfender. Defaults to `true`. */\n logUIEvents?: boolean;\n /** Register error handler for uncaught errors that reports a crash to Bugfender. Defaults to `true`. */\n registerErrorHandler?: boolean;\n /** Sets the name for the device. If the Device Name is not set, then the platform standard device name will be automatically sent */\n deviceName?: string;\n}\n\nexport interface ISDKWebOptions {\n /** Register a handler for most common browser events to report them to Bugfender (Web specific). Defaults to `true`. */\n logBrowserEvents?: boolean;\n /** App build identifier (Web specific) */\n build?: string;\n /** App version identifier (Web specific) */\n version?: string;\n}\n\nexport interface ISDKNativeOptions {\n /** Logs all logs written via Logcat (Android specific). Defaults to `false`. */\n enableLogcatLogging?: boolean;\n}\n\nexport type ISDKOptions = ISDKCommonOptions & ISDKNativeOptions & ISDKWebOptions;\n\nexport class SDKOptionsBuilder {\n private commonOptions: ISDKCommonOptions;\n private nativeOptions?: ISDKNativeOptions;\n private webOptions?: ISDKWebOptions;\n\n constructor(commonOptions: ISDKCommonOptions) {\n this.commonOptions = commonOptions;\n }\n\n public native(nativeOptions: ISDKNativeOptions): SDKOptionsBuilder {\n this.nativeOptions = nativeOptions;\n return this;\n }\n\n public web(webOptions: ISDKWebOptions): SDKOptionsBuilder {\n this.webOptions = webOptions;\n return this;\n }\n\n public build(): ISDKOptions {\n const options: ISDKOptions = {\n appKey: this.commonOptions.appKey,\n apiURL: this.commonOptions.apiURL,\n baseURL: this.commonOptions.baseURL,\n overrideConsoleMethods: this.commonOptions.overrideConsoleMethods,\n printToConsole: this.commonOptions.printToConsole,\n logUIEvents: this.commonOptions.logUIEvents,\n registerErrorHandler: this.commonOptions.registerErrorHandler,\n deviceName: this.commonOptions.deviceName,\n logBrowserEvents: this.webOptions?.logBrowserEvents,\n build: this.webOptions?.build,\n version: this.webOptions?.version,\n enableLogcatLogging: this.nativeOptions?.enableLogcatLogging,\n };\n\n // Removing undefined attributes\n Object.entries(options).forEach(([key, value]) => {\n if (value === undefined) {\n // @ts-ignore\n delete options[key];\n }\n });\n\n return options;\n }\n}\n"]}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DefaultUserFeedbackOptions = void 0;
7
+
8
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
+
10
+ /**
11
+ * Options object for `Bugfender.getUserFeedback` with customised modal strings.
12
+ */
13
+ class DefaultUserFeedbackOptions {
14
+ constructor() {
15
+ _defineProperty(this, "title", 'Feedback');
16
+
17
+ _defineProperty(this, "hint", 'Please insert your feedback here and click send');
18
+
19
+ _defineProperty(this, "subjectPlaceholder", 'Subject…');
20
+
21
+ _defineProperty(this, "feedbackPlaceholder", 'Your feedback…');
22
+
23
+ _defineProperty(this, "submitLabel", 'Send');
24
+
25
+ _defineProperty(this, "closeLabel", 'Close');
26
+ }
27
+
28
+ }
29
+
30
+ exports.DefaultUserFeedbackOptions = DefaultUserFeedbackOptions;
31
+ //# sourceMappingURL=user-feedback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["user-feedback.ts"],"names":["DefaultUserFeedbackOptions"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AAgBO,MAAMA,0BAAN,CAA0E;AAAA;AAAA,mCAChE,UADgE;;AAAA,kCAEjE,iDAFiE;;AAAA,gDAGnD,UAHmD;;AAAA,iDAIlD,gBAJkD;;AAAA,yCAK1D,MAL0D;;AAAA,wCAM3D,OAN2D;AAAA;;AAAA","sourcesContent":["/**\n * Options object for `Bugfender.getUserFeedback` with customised modal strings.\n */\nexport interface UserFeedbackOptions {\n /** Default: `Feedback`. */\n title?: string;\n /** Default `Please insert your feedback here and click send`. */\n hint?: string;\n /** Default: `Subject…`. */\n subjectPlaceholder?: string;\n /** Default: `Your feedback…`. */\n feedbackPlaceholder?: string;\n /** Default: `Send`. */\n submitLabel?: string;\n /** Default: `Close`. This attribute is only used on iOS */\n closeLabel?: string;\n}\n\nexport class DefaultUserFeedbackOptions implements Required<UserFeedbackOptions> {\n public title = 'Feedback';\n public hint = 'Please insert your feedback here and click send';\n public subjectPlaceholder = 'Subject…';\n public feedbackPlaceholder = 'Your feedback…';\n public submitLabel = 'Send';\n public closeLabel = 'Close';\n}\n\nexport interface UserFeedbackResult {\n /** `true` if the user has sent the feedback. `false` if she has closed the modal without sending it. */\n isSent: boolean;\n /** If the feedback was sent this will contain the Bugfender URL for the feedback. */\n feedbackURL?: string;\n}\n"]}
@@ -0,0 +1,323 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ import { NativeModules, Platform } from 'react-native';
4
+ import { DefaultUserFeedbackOptions } from './user-feedback';
5
+ import { StringFormatter } from './string-formatter';
6
+ import { LogLevel } from "./types/log";
7
+ import { OverrideConsoleMethods } from "./override-console-methods";
8
+ import { PrintToConsole } from "./print-to-console";
9
+ import { SDKOptions } from "./sdk-options";
10
+ const LINKING_ERROR = `The package '@bugfender/rn-bugfender' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
11
+ ios: "- You have run 'pod install'\n",
12
+ default: ''
13
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
14
+ const RnBugfender = NativeModules.RnBugfender ? NativeModules.RnBugfender : new Proxy({}, {
15
+ get() {
16
+ throw new Error(LINKING_ERROR);
17
+ }
18
+
19
+ });
20
+
21
+ class BugfenderClass {
22
+ constructor() {
23
+ _defineProperty(this, "stringFormatter", new StringFormatter());
24
+
25
+ _defineProperty(this, "overrideConsoleMethods", new OverrideConsoleMethods(window));
26
+
27
+ _defineProperty(this, "printToConsole", new PrintToConsole(global.console));
28
+
29
+ _defineProperty(this, "sdkOptions", new SDKOptions());
30
+
31
+ _defineProperty(this, "initialized", false);
32
+ }
33
+
34
+ async init(options) {
35
+ if (!this.initialized) {
36
+ var _validatedOptions$pri;
37
+
38
+ const validatedOptions = this.sdkOptions.init(options); // Needs to be executed prior initialization
39
+
40
+ if (typeof options.deviceName !== 'undefined') {
41
+ RnBugfender.overrideDeviceName(options.deviceName);
42
+ } // Library initialization
43
+
44
+
45
+ Platform.OS === 'ios' ? RnBugfender.activateLogger(validatedOptions.appKey) : RnBugfender.init(validatedOptions.appKey, false);
46
+
47
+ if (typeof validatedOptions.apiURL !== 'undefined') {
48
+ RnBugfender.setApiUrl(validatedOptions.apiURL);
49
+ }
50
+
51
+ if (typeof validatedOptions.baseURL !== 'undefined') {
52
+ RnBugfender.setBaseUrl(validatedOptions.baseURL);
53
+ }
54
+
55
+ if (validatedOptions.enableLogcatLogging) {
56
+ RnBugfender.enableLogcatLogging();
57
+ }
58
+
59
+ if (validatedOptions.logUIEvents) {
60
+ RnBugfender.enableUIEventLogging();
61
+ }
62
+
63
+ if (validatedOptions.registerErrorHandler) {
64
+ RnBugfender.enableCrashReporting();
65
+ }
66
+
67
+ if (validatedOptions.overrideConsoleMethods) {
68
+ this.overrideConsoleMethods.init(this.stringFormatter);
69
+ }
70
+
71
+ this.printToConsole.init((_validatedOptions$pri = validatedOptions.printToConsole) !== null && _validatedOptions$pri !== void 0 ? _validatedOptions$pri : true);
72
+ this.initialized = true;
73
+ }
74
+ }
75
+ /**
76
+ * @returns Bugfender dashboard URL for the device
77
+ */
78
+
79
+
80
+ getDeviceURL() {
81
+ return RnBugfender.getDeviceUrl();
82
+ }
83
+ /**
84
+ * @returns Bugfender dashboard URL for the current session
85
+ */
86
+
87
+
88
+ getSessionURL() {
89
+ return RnBugfender.getSessionUrl();
90
+ }
91
+ /**
92
+ * Show a modal which asks for feedback. Once the user closes the modal or sends the feedback
93
+ * the returned promise resolves with the result.
94
+ *
95
+ * ```typescript
96
+ * Bugfender.getUserFeedback().then((result) => {
97
+ * if (result.isSent) {
98
+ * // User sent the feedback
99
+ * // `result.feedbackURL` contains the Bugfender feedback URL
100
+ * } else {
101
+ * // User closed the modal without sending the feedback
102
+ * }
103
+ * });
104
+ * ```
105
+ *
106
+ * @param options Options object to configure modal strings
107
+ * @returns Promise which resolves once the user closes the modal or sends the feedback
108
+ */
109
+
110
+
111
+ async getUserFeedback(options) {
112
+ return new Promise(resolve => {
113
+ var _options;
114
+
115
+ options = { ...new DefaultUserFeedbackOptions(),
116
+ ...((_options = options) !== null && _options !== void 0 ? _options : {})
117
+ };
118
+ return RnBugfender.showUserFeedback(options.title, options.hint, options.subjectPlaceholder, options.feedbackPlaceholder, options.submitLabel, options.closeLabel).then(value => {
119
+ resolve({
120
+ isSent: true,
121
+ feedbackURL: value
122
+ });
123
+ }, _ => {
124
+ resolve({
125
+ isSent: false
126
+ });
127
+ });
128
+ });
129
+ }
130
+ /**
131
+ * @param obj A JavaScript value to output
132
+ * @param objs List of optional JavaScript values to output
133
+ */
134
+
135
+
136
+ log() {
137
+ for (var _len = arguments.length, parameters = new Array(_len), _key = 0; _key < _len; _key++) {
138
+ parameters[_key] = arguments[_key];
139
+ }
140
+
141
+ this.printToConsole.log(...parameters);
142
+ let message = this.stringFormatter.format([...parameters]);
143
+ RnBugfender.debug('', message);
144
+ }
145
+ /**
146
+ * @param obj A JavaScript value to output
147
+ * @param objs List of optional JavaScript values to output
148
+ */
149
+
150
+
151
+ warn() {
152
+ for (var _len2 = arguments.length, parameters = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
153
+ parameters[_key2] = arguments[_key2];
154
+ }
155
+
156
+ this.printToConsole.warn(...parameters);
157
+ let message = this.stringFormatter.format([...parameters]);
158
+ RnBugfender.warning('', message);
159
+ }
160
+ /**
161
+ * @param obj A JavaScript value to output
162
+ * @param objs List of optional JavaScript values to output
163
+ */
164
+
165
+
166
+ error() {
167
+ for (var _len3 = arguments.length, parameters = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
168
+ parameters[_key3] = arguments[_key3];
169
+ }
170
+
171
+ this.printToConsole.error(...parameters);
172
+ let message = this.stringFormatter.format([...parameters]);
173
+ RnBugfender.error('', message);
174
+ }
175
+ /**
176
+ * @param obj A JavaScript value to output
177
+ * @param objs List of optional JavaScript values to output
178
+ */
179
+
180
+
181
+ trace() {
182
+ for (var _len4 = arguments.length, parameters = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
183
+ parameters[_key4] = arguments[_key4];
184
+ }
185
+
186
+ this.printToConsole.trace(...parameters);
187
+ let message = this.stringFormatter.format([...parameters]);
188
+ RnBugfender.trace('', message);
189
+ }
190
+ /**
191
+ * @param obj A JavaScript value to output
192
+ * @param objs List of optional JavaScript values to output
193
+ */
194
+
195
+
196
+ info() {
197
+ for (var _len5 = arguments.length, parameters = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
198
+ parameters[_key5] = arguments[_key5];
199
+ }
200
+
201
+ this.printToConsole.info(...parameters);
202
+ let message = this.stringFormatter.format([...parameters]);
203
+ RnBugfender.info('', message);
204
+ }
205
+ /**
206
+ * @param obj A JavaScript value to output
207
+ * @param objs List of optional JavaScript values to output
208
+ */
209
+
210
+
211
+ fatal() {
212
+ for (var _len6 = arguments.length, parameters = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
213
+ parameters[_key6] = arguments[_key6];
214
+ }
215
+
216
+ this.printToConsole.error(...parameters);
217
+ let message = this.stringFormatter.format([...parameters]);
218
+ RnBugfender.fatal('', message);
219
+ }
220
+ /**
221
+ * Remove a device associated key-value pair. [Learn more](https://bugfender.com/blog/associated-device-information/).
222
+ *
223
+ * @param key Key identifier
224
+ */
225
+
226
+
227
+ removeDeviceKey(key) {
228
+ RnBugfender.removeDeviceKey(key);
229
+ this.printToConsole.info(`Device key "${key}" removed`);
230
+ }
231
+ /**
232
+ * Use this method if you need more control over the data sent while logging. See `ILogEntry` interface reference to see all the accepted properties.
233
+ *
234
+ * @param log Log object that complies with `ILogEntry` interface.
235
+ */
236
+
237
+
238
+ sendLog(log) {
239
+ var _log$line, _log$method, _log$file, _log$level, _log$tag, _log$text;
240
+
241
+ this.printToConsole.printLog(log);
242
+ RnBugfender.log((_log$line = log.line) !== null && _log$line !== void 0 ? _log$line : 0, (_log$method = log.method) !== null && _log$method !== void 0 ? _log$method : '', (_log$file = log.file) !== null && _log$file !== void 0 ? _log$file : '', (_log$level = log.level) !== null && _log$level !== void 0 ? _log$level : LogLevel.Debug, (_log$tag = log.tag) !== null && _log$tag !== void 0 ? _log$tag : '', (_log$text = log.text) !== null && _log$text !== void 0 ? _log$text : '');
243
+ }
244
+ /**
245
+ * Send an issue.
246
+ *
247
+ * @param title - Title
248
+ * @param text - Text content
249
+ * @returns Bugfender dashboard URL for the issue.
250
+ */
251
+
252
+
253
+ sendIssue(title, text) {
254
+ this.printToConsole.warn(`Issue: ${title}.\n${text}`);
255
+ return RnBugfender.sendIssue(title, text);
256
+ }
257
+ /**
258
+ * Send a crash report.
259
+ *
260
+ * @param title - Title
261
+ * @param text - Text content
262
+ * @returns Bugfender dashboard URL for the crash.
263
+ */
264
+
265
+
266
+ sendCrash(title, text) {
267
+ this.printToConsole.error(`Crash: ${title}.\n${text}`);
268
+ return RnBugfender.sendCrash(title, text);
269
+ }
270
+ /**
271
+ * Send an user feedback.
272
+ *
273
+ * @param title - Title/Subject
274
+ * @param text - Feedback text
275
+ * @returns Bugfender dashboard URL for the feedback.
276
+ */
277
+
278
+
279
+ sendUserFeedback(title, text) {
280
+ this.printToConsole.info(`User Feedback: ${title}.\n${text}`);
281
+ return RnBugfender.sendUserFeedback(title, text);
282
+ }
283
+ /**
284
+ * Set a device associated key-value pair. [Learn more](https://bugfender.com/blog/associated-device-information/).
285
+ *
286
+ * @param key Key identifier.
287
+ * @param value Value.
288
+ */
289
+
290
+
291
+ setDeviceKey(key, value) {
292
+ this.printToConsole.info(`Device key "${key}" set to "${value}"`);
293
+
294
+ if (typeof value === 'boolean') {
295
+ RnBugfender.setDeviceBoolean(key, value);
296
+ } else if (typeof value === 'string') {
297
+ RnBugfender.setDeviceString(key, value);
298
+ } else {
299
+ // typeof value === 'number'
300
+ if (Number.isInteger(value)) {
301
+ RnBugfender.setDeviceInteger(key, value);
302
+ } else {
303
+ RnBugfender.setDeviceFloat(key, value);
304
+ }
305
+ }
306
+ }
307
+ /**
308
+ * Synchronizes all logs and issues with the server once, regardless if this device is enabled or not.
309
+ *
310
+ * Logs and issues are synchronized only once. After that, the logs are again sent according to the enabled flag
311
+ * in the Bugfender Console.
312
+ */
313
+
314
+
315
+ forceSendOnce() {
316
+ this.printToConsole.info(`Force send once`);
317
+ RnBugfender.forceSendOnce();
318
+ }
319
+
320
+ }
321
+
322
+ export { BugfenderClass, RnBugfender };
323
+ //# sourceMappingURL=bugfender.js.map