@bugfender/rn-bugfender 2.1.0 → 2.1.2

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 (114) hide show
  1. package/RnBugfender.podspec +17 -2
  2. package/android/.gradle/6.1.1/executionHistory/executionHistory.lock +0 -0
  3. package/android/.gradle/6.1.1/fileChanges/last-build.bin +0 -0
  4. package/android/.gradle/6.1.1/fileHashes/fileHashes.lock +0 -0
  5. package/android/.gradle/6.1.1/gc.properties +0 -0
  6. package/android/.gradle/7.4.2/checksums/checksums.lock +0 -0
  7. package/android/.gradle/7.4.2/dependencies-accessors/dependencies-accessors.lock +0 -0
  8. package/android/.gradle/7.4.2/dependencies-accessors/gc.properties +0 -0
  9. package/android/.gradle/7.4.2/executionHistory/executionHistory.lock +0 -0
  10. package/android/.gradle/7.4.2/fileChanges/last-build.bin +0 -0
  11. package/android/.gradle/7.4.2/fileHashes/fileHashes.lock +0 -0
  12. package/android/.gradle/7.4.2/gc.properties +0 -0
  13. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  14. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  15. package/android/.gradle/checksums/checksums.lock +0 -0
  16. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  17. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  18. package/android/.gradle/vcs-1/gc.properties +0 -0
  19. package/android/.idea/codeStyles/Project.xml +116 -0
  20. package/android/.idea/gradle.xml +19 -0
  21. package/android/.idea/misc.xml +9 -0
  22. package/android/.idea/modules/android.iml +18 -0
  23. package/android/.idea/modules.xml +8 -0
  24. package/android/.idea/vcs.xml +6 -0
  25. package/android/.idea/workspace.xml +47 -0
  26. package/android/build.gradle +117 -40
  27. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  28. package/android/gradle/wrapper/gradle-wrapper.properties +2 -1
  29. package/android/gradle.properties +5 -0
  30. package/android/gradlew +21 -34
  31. package/android/gradlew.bat +19 -24
  32. package/android/local.properties +8 -0
  33. package/android/src/main/java/com/{bugfender/react → bugfender.react}/RnBugfenderModule.java +0 -0
  34. package/android/src/main/java/com/{bugfender/react → bugfender.react}/RnBugfenderPackage.java +0 -0
  35. package/ios/{RnBugfender.m → RnBugfender.mm} +16 -4
  36. package/ios/RnBugfender.xcodeproj/project.pbxproj +4 -17
  37. package/lib/commonjs/bugfender.js +14 -26
  38. package/lib/commonjs/bugfender.js.map +1 -1
  39. package/lib/commonjs/index.js +2 -2
  40. package/lib/commonjs/index.js.map +1 -1
  41. package/lib/commonjs/index.web.js +2 -2
  42. package/lib/commonjs/index.web.js.map +1 -1
  43. package/lib/commonjs/override-console-methods.js +9 -9
  44. package/lib/commonjs/override-console-methods.js.map +1 -1
  45. package/lib/commonjs/sdk-options.js +5 -34
  46. package/lib/commonjs/sdk-options.js.map +1 -1
  47. package/lib/commonjs/types/sdk-options.js +2 -2
  48. package/lib/commonjs/types/sdk-options.js.map +1 -1
  49. package/lib/commonjs/user-feedback.js.map +1 -1
  50. package/lib/module/bugfender.js +12 -22
  51. package/lib/module/bugfender.js.map +1 -1
  52. package/lib/module/index.js +1 -1
  53. package/lib/module/index.js.map +1 -1
  54. package/lib/module/index.web.js +1 -1
  55. package/lib/module/index.web.js.map +1 -1
  56. package/lib/module/override-console-methods.js +9 -9
  57. package/lib/module/override-console-methods.js.map +1 -1
  58. package/lib/module/sdk-options.js +5 -34
  59. package/lib/module/sdk-options.js.map +1 -1
  60. package/lib/module/types/sdk-options.js +2 -2
  61. package/lib/module/types/sdk-options.js.map +1 -1
  62. package/lib/module/user-feedback.js.map +1 -1
  63. package/lib/typescript/bugfender.d.ts +5 -6
  64. package/lib/typescript/bugfender.d.ts.map +1 -0
  65. package/lib/typescript/index.d.ts +2 -1
  66. package/lib/typescript/index.d.ts.map +1 -0
  67. package/lib/typescript/index.web.d.ts +2 -1
  68. package/lib/typescript/index.web.d.ts.map +1 -0
  69. package/lib/typescript/override-console-methods.d.ts +2 -2
  70. package/lib/typescript/override-console-methods.d.ts.map +1 -0
  71. package/lib/typescript/sdk-options.d.ts +3 -12
  72. package/lib/typescript/sdk-options.d.ts.map +1 -0
  73. package/lib/typescript/types/sdk-options.d.ts +1 -0
  74. package/lib/typescript/types/sdk-options.d.ts.map +1 -0
  75. package/lib/typescript/user-feedback.d.ts +3 -15
  76. package/lib/typescript/user-feedback.d.ts.map +1 -0
  77. package/package.json +28 -24
  78. package/src/bugfender.ts +12 -17
  79. package/src/index.tsx +1 -1
  80. package/src/index.web.tsx +1 -1
  81. package/src/override-console-methods.ts +8 -9
  82. package/src/sdk-options.ts +6 -35
  83. package/src/types/sdk-options.ts +2 -2
  84. package/src/user-feedback.ts +3 -16
  85. package/lib/commonjs/print-to-console.js +0 -78
  86. package/lib/commonjs/print-to-console.js.map +0 -1
  87. package/lib/commonjs/string-formatter.js +0 -55
  88. package/lib/commonjs/string-formatter.js.map +0 -1
  89. package/lib/commonjs/types/device.js +0 -2
  90. package/lib/commonjs/types/device.js.map +0 -1
  91. package/lib/commonjs/types/log.js +0 -35
  92. package/lib/commonjs/types/log.js.map +0 -1
  93. package/lib/commonjs/utilities.js +0 -18
  94. package/lib/commonjs/utilities.js.map +0 -1
  95. package/lib/module/print-to-console.js +0 -67
  96. package/lib/module/print-to-console.js.map +0 -1
  97. package/lib/module/string-formatter.js +0 -45
  98. package/lib/module/string-formatter.js.map +0 -1
  99. package/lib/module/types/device.js +0 -2
  100. package/lib/module/types/device.js.map +0 -1
  101. package/lib/module/types/log.js +0 -24
  102. package/lib/module/types/log.js.map +0 -1
  103. package/lib/module/utilities.js +0 -11
  104. package/lib/module/utilities.js.map +0 -1
  105. package/lib/typescript/print-to-console.d.ts +0 -14
  106. package/lib/typescript/string-formatter.d.ts +0 -4
  107. package/lib/typescript/types/device.d.ts +0 -4
  108. package/lib/typescript/types/log.d.ts +0 -59
  109. package/lib/typescript/utilities.d.ts +0 -1
  110. package/src/print-to-console.ts +0 -67
  111. package/src/string-formatter.ts +0 -44
  112. package/src/types/device.ts +0 -4
  113. package/src/types/log.ts +0 -75
  114. package/src/utilities.ts +0 -8
@@ -1,17 +1,10 @@
1
+ import type { UserFeedbackOptions as BaseUserFeebackOptions } from '@bugfender/common';
1
2
  /**
2
3
  * Options object for `Bugfender.getUserFeedback` with customised modal strings.
3
4
  */
4
- export interface UserFeedbackOptions {
5
- /** Default: `Feedback`. */
6
- title?: string;
5
+ export interface UserFeedbackOptions extends BaseUserFeebackOptions {
7
6
  /** Default `Please insert your feedback here and click send`. */
8
7
  hint?: string;
9
- /** Default: `Subject…`. */
10
- subjectPlaceholder?: string;
11
- /** Default: `Your feedback…`. */
12
- feedbackPlaceholder?: string;
13
- /** Default: `Send`. */
14
- submitLabel?: string;
15
8
  /** Default: `Close`. This attribute is only used on iOS */
16
9
  closeLabel?: string;
17
10
  }
@@ -23,9 +16,4 @@ export declare class DefaultUserFeedbackOptions implements Required<UserFeedback
23
16
  submitLabel: string;
24
17
  closeLabel: string;
25
18
  }
26
- export interface UserFeedbackResult {
27
- /** `true` if the user has sent the feedback. `false` if she has closed the modal without sending it. */
28
- isSent: boolean;
29
- /** If the feedback was sent this will contain the Bugfender URL for the feedback. */
30
- feedbackURL?: string;
31
- }
19
+ //# sourceMappingURL=user-feedback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-feedback.d.ts","sourceRoot":"","sources":["../../src/user-feedback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,IAAI,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEvF;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,sBAAsB;IACjE,iEAAiE;IACjE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,0BAA2B,YAAW,QAAQ,CAAC,mBAAmB,CAAC;IACvE,KAAK,SAAc;IACnB,IAAI,SAAqD;IACzD,kBAAkB,SAAc;IAChC,mBAAmB,SAAoB;IACvC,WAAW,SAAU;IACrB,UAAU,SAAW;CAC7B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bugfender/rn-bugfender",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "React Native bindings for Bugfender SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -29,8 +29,7 @@
29
29
  "prepare": "bob build",
30
30
  "release": "release-it",
31
31
  "example": "yarn --cwd example",
32
- "pods": "cd example && pod-install --quiet",
33
- "bootstrap": "yarn example && yarn && yarn pods"
32
+ "bootstrap": "yarn example && yarn && yarn example pods"
34
33
  },
35
34
  "keywords": [
36
35
  "bugfender",
@@ -55,25 +54,29 @@
55
54
  "registry": "https://registry.npmjs.org/"
56
55
  },
57
56
  "devDependencies": {
58
- "@commitlint/config-conventional": "^11.0.0",
59
- "@react-native-community/eslint-config": "^2.0.0",
60
- "@release-it/conventional-changelog": "^2.0.0",
61
- "@types/jest": "^26.0.0",
62
- "@types/react": "^16.9.19",
63
- "@types/react-native": "0.62.13",
64
- "commitlint": "^11.0.0",
65
- "eslint": "^7.2.0",
66
- "eslint-config-prettier": "^7.0.0",
67
- "eslint-plugin-prettier": "^3.1.3",
68
- "husky": "^6.0.0",
69
- "jest": "^26.0.1",
70
- "pod-install": "^0.1.0",
71
- "prettier": "^2.0.5",
72
- "react": "16.13.1",
73
- "react-native": "0.64.1",
74
- "react-native-builder-bob": "^0.18.0",
75
- "release-it": "^14.2.2",
76
- "typescript": "^4.1.3"
57
+ "@arkweid/lefthook": "^0.7.7",
58
+ "@babel/eslint-parser": "^7.19.1",
59
+ "@commitlint/config-conventional": "^17.2.0",
60
+ "@react-native-community/eslint-config": "^3.2.0",
61
+ "@release-it/conventional-changelog": "^5.1.1",
62
+ "@types/jest": "^29.2.2",
63
+ "@types/react": "~18.0.25",
64
+ "@types/react-native": "0.70.6",
65
+ "commitlint": "^17.2.0",
66
+ "eslint": "^8.27.0",
67
+ "eslint-config-prettier": "^8.5.0",
68
+ "eslint-plugin-prettier": "^4.2.1",
69
+ "jest": "^29.3.1",
70
+ "pod-install": "^0.1.38",
71
+ "prettier": "^2.7.1",
72
+ "react": "18.1.0",
73
+ "react-native": "0.70.6",
74
+ "react-native-builder-bob": "^0.20.1",
75
+ "release-it": "^15.5.0",
76
+ "typescript": "^4.8.4"
77
+ },
78
+ "resolutions": {
79
+ "@types/react": "17.0.21"
77
80
  },
78
81
  "peerDependencies": {
79
82
  "react": "*",
@@ -110,6 +113,7 @@
110
113
  },
111
114
  "eslintConfig": {
112
115
  "root": true,
116
+ "parser": "@babel/eslint-parser",
113
117
  "extends": [
114
118
  "@react-native-community",
115
119
  "prettier"
@@ -153,7 +157,7 @@
153
157
  ]
154
158
  },
155
159
  "dependencies": {
156
- "@bugfender/sdk": "^2.1.0",
157
- "util": "^0.12.4"
160
+ "@bugfender/common": "^1.0.0",
161
+ "@bugfender/sdk": "^2.1.0"
158
162
  }
159
163
  }
package/src/bugfender.ts CHANGED
@@ -1,12 +1,8 @@
1
1
  import { NativeModules, Platform } from 'react-native';
2
+ import { BugfenderFacade, DeviceKeyValue, LogEntry, LogLevel, PrintToConsole, UserFeedbackResult, format, formatLogEntryText } from '@bugfender/common';
2
3
  import type { ISDKOptions } from './types/sdk-options';
3
- import type { UserFeedbackOptions, UserFeedbackResult } from './user-feedback';
4
+ import type { UserFeedbackOptions } from './user-feedback';
4
5
  import { DefaultUserFeedbackOptions } from './user-feedback';
5
- import type { DeviceKeyValue } from './types/device';
6
- import type { ILogEntry } from './types/log';
7
- import { StringFormatter } from './string-formatter';
8
- import { LogLevel } from './types/log';
9
- import { PrintToConsole } from './print-to-console';
10
6
  import { SDKOptions } from './sdk-options';
11
7
 
12
8
  const LINKING_ERROR =
@@ -26,8 +22,7 @@ const RnBugfender = NativeModules.RnBugfender
26
22
  }
27
23
  );
28
24
 
29
- class BugfenderClass {
30
- private stringFormatter = new StringFormatter();
25
+ class BugfenderClass implements BugfenderFacade {
31
26
  private overrideConsoleMethods =
32
27
  new (require('./override-console-methods').OverrideConsoleMethods)(window);
33
28
  private printToConsole = new PrintToConsole(global.console);
@@ -56,7 +51,7 @@ class BugfenderClass {
56
51
  : RnBugfender.init(validatedOptions.appKey, validatedOptions.printToConsole ?? false);
57
52
 
58
53
  if (validatedOptions.overrideConsoleMethods) {
59
- this.overrideConsoleMethods.init(this.stringFormatter);
54
+ this.overrideConsoleMethods.init();
60
55
  }
61
56
 
62
57
  this.printToConsole.init(validatedOptions.printToConsole ?? true);
@@ -160,7 +155,7 @@ class BugfenderClass {
160
155
  public log(...parameters: unknown[]): void {
161
156
  this.printToConsole.log(...parameters);
162
157
 
163
- let message = this.stringFormatter.format([...parameters]);
158
+ let message = format([...parameters]);
164
159
  RnBugfender.debug('', message);
165
160
  }
166
161
 
@@ -179,7 +174,7 @@ class BugfenderClass {
179
174
  public warn(...parameters: unknown[]): void {
180
175
  this.printToConsole.warn(...parameters);
181
176
 
182
- let message = this.stringFormatter.format([...parameters]);
177
+ let message = format([...parameters]);
183
178
  RnBugfender.warning('', message);
184
179
  }
185
180
 
@@ -198,7 +193,7 @@ class BugfenderClass {
198
193
  public error(...parameters: unknown[]): void {
199
194
  this.printToConsole.error(...parameters);
200
195
 
201
- let message = this.stringFormatter.format([...parameters]);
196
+ let message = format([...parameters]);
202
197
  RnBugfender.error('', message);
203
198
  }
204
199
 
@@ -217,7 +212,7 @@ class BugfenderClass {
217
212
  public trace(...parameters: unknown[]): void {
218
213
  this.printToConsole.trace(...parameters);
219
214
 
220
- let message = this.stringFormatter.format([...parameters]);
215
+ let message = format([...parameters]);
221
216
  RnBugfender.trace('', message);
222
217
  }
223
218
 
@@ -236,7 +231,7 @@ class BugfenderClass {
236
231
  public info(...parameters: unknown[]): void {
237
232
  this.printToConsole.info(...parameters);
238
233
 
239
- let message = this.stringFormatter.format([...parameters]);
234
+ let message = format([...parameters]);
240
235
  RnBugfender.info('', message);
241
236
  }
242
237
 
@@ -255,7 +250,7 @@ class BugfenderClass {
255
250
  public fatal(...parameters: unknown[]): void {
256
251
  this.printToConsole.error(...parameters);
257
252
 
258
- let message = this.stringFormatter.format([...parameters]);
253
+ let message = format([...parameters]);
259
254
  RnBugfender.fatal('', message);
260
255
  }
261
256
 
@@ -274,7 +269,7 @@ class BugfenderClass {
274
269
  *
275
270
  * @param log Log object that complies with `ILogEntry` interface.
276
271
  */
277
- public sendLog(log: ILogEntry): void {
272
+ public sendLog(log: LogEntry): void {
278
273
  this.printToConsole.printLog(log);
279
274
 
280
275
  RnBugfender.log(
@@ -283,7 +278,7 @@ class BugfenderClass {
283
278
  log.file ?? '',
284
279
  log.level ?? LogLevel.Debug,
285
280
  log.tag ?? '',
286
- log.text ?? ''
281
+ formatLogEntryText(log.text ?? '')
287
282
  );
288
283
  }
289
284
 
package/src/index.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { LogLevel } from './types/log';
1
+ import { LogLevel } from '@bugfender/common';
2
2
  import { SDKOptionsBuilder } from './types/sdk-options';
3
3
  import { BugfenderClass } from './bugfender';
4
4
 
package/src/index.web.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { LogLevel } from './types/log';
1
+ import { LogLevel } from '@bugfender/common';
2
2
  import { SDKOptionsBuilder } from './types/sdk-options';
3
3
  import { Bugfender } from '@bugfender/sdk';
4
4
 
@@ -1,6 +1,5 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
1
+ import {format} from '@bugfender/common';
2
2
  import {RnBugfender} from "./bugfender";
3
- import type {StringFormatter} from "./string-formatter";
4
3
 
5
4
  /**
6
5
  * Overrides the `window.console` methods in order to execute the Bugfender equivalent logging
@@ -12,39 +11,39 @@ export class OverrideConsoleMethods {
12
11
  ) {
13
12
  }
14
13
 
15
- public init(stringFormatter: StringFormatter): void {
14
+ public init(): void {
16
15
 
17
16
  (this.window as any).console = function (console: Console) {
18
17
  return {
19
18
  ...console,
20
19
  log: function (...parameters: unknown[]) {
21
20
  console.log(...parameters);
22
- let message = stringFormatter.format([...parameters]);
21
+ let message = format([...parameters]);
23
22
  RnBugfender.debug('', message);
24
23
  },
25
24
  debug: function (...parameters: unknown[]) {
26
25
  console.debug(...parameters);
27
- let message = stringFormatter.format([...parameters]);
26
+ let message = format([...parameters]);
28
27
  RnBugfender.debug('', message);
29
28
  },
30
29
  trace: function (...parameters: unknown[]) {
31
30
  console.trace(...parameters);
32
- let message = stringFormatter.format([...parameters]);
31
+ let message = format([...parameters]);
33
32
  RnBugfender.trace('', message);
34
33
  },
35
34
  info: function (...parameters: unknown[]) {
36
35
  console.info(...parameters);
37
- let message = stringFormatter.format([...parameters]);
36
+ let message = format([...parameters]);
38
37
  RnBugfender.info('', message);
39
38
  },
40
39
  warn: function (...parameters: unknown[]) {
41
40
  console.warn(...parameters);
42
- let message = stringFormatter.format([...parameters]);
41
+ let message = format([...parameters]);
43
42
  RnBugfender.warning('', message);
44
43
  },
45
44
  error: function (...parameters: unknown[]) {
46
45
  console.error(...parameters);
47
- let message = stringFormatter.format([...parameters]);
46
+ let message = format([...parameters]);
48
47
  RnBugfender.error('', message);
49
48
  },
50
49
  };
@@ -1,8 +1,8 @@
1
1
  import type {ISDKOptions} from "./types/sdk-options";
2
- import {removeUndefinedAttributes} from "./utilities";
2
+ import {prepareOptions, validate, ValidationRules} from "@bugfender/common";
3
3
 
4
4
  export class SDKOptions {
5
- protected rules = {
5
+ protected rules: ValidationRules = {
6
6
  appKey: ['required', 'string'],
7
7
  apiURL: ['string', 'url'],
8
8
  baseURL: ['string', 'url'],
@@ -15,11 +15,11 @@ export class SDKOptions {
15
15
  };
16
16
 
17
17
  public init(options: ISDKOptions): ISDKOptions {
18
- // Validate user provided options
19
- this.validate(options);
18
+ // Prepare options
19
+ options = prepareOptions(options);
20
20
 
21
- options = { ...options };
22
- removeUndefinedAttributes(options);
21
+ // Validate user provided options
22
+ validate(options, this.rules);
23
23
 
24
24
  // Set default values if needed
25
25
  return {
@@ -32,33 +32,4 @@ export class SDKOptions {
32
32
  ...options,
33
33
  };
34
34
  }
35
-
36
- protected validate(options: ISDKOptions): void {
37
- const urlValidator = new RegExp(/^http(s)?:\/\//i);
38
-
39
- Object.entries(this.rules).forEach(([key, rules]) => {
40
- // @ts-ignore
41
- const value = options[key];
42
-
43
- rules.forEach(rule => {
44
- if (rule === 'required') {
45
- if (typeof value === 'undefined') {
46
- throw new Error(`Bugfender requires '${key}' option to initialize.`)
47
- }
48
- } else if (rule === 'string') {
49
- if (!['string', 'undefined'].includes(typeof value)) {
50
- throw new Error(`'${key}' option must be a string.`);
51
- }
52
- } else if (rule === 'url') {
53
- if (typeof value !== 'undefined' && !urlValidator.test(value)) {
54
- throw new Error(`'${key}' option must be a valid URL.`);
55
- }
56
- } else if (rule === 'boolean') {
57
- if (!['boolean', 'undefined'].includes(typeof value)) {
58
- throw new Error(`'${key}' option must be a boolean.`);
59
- }
60
- }
61
- })
62
- });
63
- }
64
35
  }
@@ -1,4 +1,4 @@
1
- import {removeUndefinedAttributes} from "../utilities";
1
+ import {removeUndefinedProperties} from '@bugfender/common';
2
2
 
3
3
  export interface ISDKCommonOptions {
4
4
  /** The app key to log into */
@@ -73,7 +73,7 @@ export class SDKOptionsBuilder {
73
73
  maximumLocalStorageSize: this.nativeOptions?.maximumLocalStorageSize,
74
74
  };
75
75
 
76
- removeUndefinedAttributes(options);
76
+ removeUndefinedProperties(options);
77
77
 
78
78
  return options;
79
79
  }
@@ -1,17 +1,11 @@
1
+ import type { UserFeedbackOptions as BaseUserFeebackOptions } from '@bugfender/common';
2
+
1
3
  /**
2
4
  * Options object for `Bugfender.getUserFeedback` with customised modal strings.
3
5
  */
4
- export interface UserFeedbackOptions {
5
- /** Default: `Feedback`. */
6
- title?: string;
6
+ export interface UserFeedbackOptions extends BaseUserFeebackOptions {
7
7
  /** Default `Please insert your feedback here and click send`. */
8
8
  hint?: string;
9
- /** Default: `Subject…`. */
10
- subjectPlaceholder?: string;
11
- /** Default: `Your feedback…`. */
12
- feedbackPlaceholder?: string;
13
- /** Default: `Send`. */
14
- submitLabel?: string;
15
9
  /** Default: `Close`. This attribute is only used on iOS */
16
10
  closeLabel?: string;
17
11
  }
@@ -24,10 +18,3 @@ export class DefaultUserFeedbackOptions implements Required<UserFeedbackOptions>
24
18
  public submitLabel = 'Send';
25
19
  public closeLabel = 'Close';
26
20
  }
27
-
28
- export interface UserFeedbackResult {
29
- /** `true` if the user has sent the feedback. `false` if she has closed the modal without sending it. */
30
- isSent: boolean;
31
- /** If the feedback was sent this will contain the Bugfender URL for the feedback. */
32
- feedbackURL?: string;
33
- }
@@ -1,78 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.PrintToConsole = void 0;
7
-
8
- var _util = require("util");
9
-
10
- var _log = require("./types/log");
11
-
12
- 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; }
13
-
14
- class PrintToConsole {
15
- constructor(console) {
16
- this.console = console;
17
-
18
- _defineProperty(this, "printToConsole", false);
19
- }
20
-
21
- init(printToConsole) {
22
- this.printToConsole = printToConsole;
23
- }
24
-
25
- error() {
26
- if (this.printToConsole) {
27
- this.console.error(...arguments);
28
- }
29
- }
30
-
31
- info() {
32
- if (this.printToConsole) {
33
- this.console.info(...arguments);
34
- }
35
- }
36
-
37
- log() {
38
- if (this.printToConsole) {
39
- this.console.log(...arguments);
40
- }
41
- }
42
-
43
- debug() {
44
- if (this.printToConsole) {
45
- this.console.debug(...arguments);
46
- }
47
- }
48
-
49
- trace() {
50
- if (this.printToConsole) {
51
- this.console.trace(...arguments);
52
- }
53
- }
54
-
55
- warn() {
56
- if (this.printToConsole) {
57
- this.console.warn(...arguments);
58
- }
59
- }
60
-
61
- printLog(log) {
62
- if (this.printToConsole) {
63
- // Log to browser console
64
- // debug, warning, error, trace, info, fatal
65
- const levelToMethod = ['log', 'warn', 'error', 'trace', 'info', 'error'];
66
- const method = levelToMethod[log.level || _log.LogLevel.Debug];
67
- const tag = log.tag ? `[${log.tag}] ` : '';
68
- const location = [log.file || '', log.method || '', log.line || ''].filter(p => p !== '').join(':');
69
- const message = `${tag}${(0, _util.format)(log.text)} ${location}`; // @ts-ignore
70
-
71
- this.console[method](message);
72
- }
73
- }
74
-
75
- }
76
-
77
- exports.PrintToConsole = PrintToConsole;
78
- //# sourceMappingURL=print-to-console.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["print-to-console.ts"],"names":["PrintToConsole","constructor","console","init","printToConsole","error","info","log","debug","trace","warn","printLog","levelToMethod","method","level","LogLevel","Debug","tag","location","file","line","filter","p","join","message","text"],"mappings":";;;;;;;AAAA;;AAEA;;;;AAEO,MAAMA,cAAN,CAAqB;AAG1BC,EAAAA,WAAW,CACUC,OADV,EAET;AAAA,SADmBA,OACnB,GADmBA,OACnB;;AAAA,4CAJkC,KAIlC;AACD;;AAEMC,EAAAA,IAAI,CAACC,cAAD,EAAgC;AACzC,SAAKA,cAAL,GAAsBA,cAAtB;AACD;;AAEMC,EAAAA,KAAK,GAAiC;AAC3C,QAAI,KAAKD,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaG,KAAb,CAAmB,YAAnB;AACD;AACF;;AAEMC,EAAAA,IAAI,GAAiC;AAC1C,QAAI,KAAKF,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaI,IAAb,CAAkB,YAAlB;AACD;AACF;;AAEMC,EAAAA,GAAG,GAAiC;AACzC,QAAI,KAAKH,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaK,GAAb,CAAiB,YAAjB;AACD;AACF;;AAEMC,EAAAA,KAAK,GAAiC;AAC3C,QAAI,KAAKJ,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaM,KAAb,CAAmB,YAAnB;AACD;AACF;;AAEMC,EAAAA,KAAK,GAAiC;AAC3C,QAAI,KAAKL,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaO,KAAb,CAAmB,YAAnB;AACD;AACF;;AAEMC,EAAAA,IAAI,GAAiC;AAC1C,QAAI,KAAKN,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaQ,IAAb,CAAkB,YAAlB;AACD;AACF;;AAEMC,EAAAA,QAAQ,CAACJ,GAAD,EAAuB;AACpC,QAAI,KAAKH,cAAT,EAAyB;AACvB;AACA;AACA,YAAMQ,aAAa,GAAG,CAAC,KAAD,EAAQ,MAAR,EAAgB,OAAhB,EAAyB,OAAzB,EAAkC,MAAlC,EAA0C,OAA1C,CAAtB;AACA,YAAMC,MAAM,GAAGD,aAAa,CAACL,GAAG,CAACO,KAAJ,IAAaC,cAASC,KAAvB,CAA5B;AACA,YAAMC,GAAG,GAAGV,GAAG,CAACU,GAAJ,GAAW,IAAGV,GAAG,CAACU,GAAI,IAAtB,GAA4B,EAAxC;AACA,YAAMC,QAAQ,GAAG,CAACX,GAAG,CAACY,IAAJ,IAAY,EAAb,EAAiBZ,GAAG,CAACM,MAAJ,IAAc,EAA/B,EAAmCN,GAAG,CAACa,IAAJ,IAAY,EAA/C,EAAmDC,MAAnD,CAA0DC,CAAC,IAAIA,CAAC,KAAK,EAArE,EAAyEC,IAAzE,CAA8E,GAA9E,CAAjB;AACA,YAAMC,OAAO,GAAI,GAAEP,GAAI,GAAE,kBAAOV,GAAG,CAACkB,IAAX,CAAiB,IAAGP,QAAS,EAAtD,CAPuB,CASvB;;AACA,WAAKhB,OAAL,CAAaW,MAAb,EAAqBW,OAArB;AACD;AACF;;AA7DyB","sourcesContent":["import {format} from 'util';\nimport type {ILogEntry} from \"./types/log\";\nimport {LogLevel} from \"./types/log\";\n\nexport class PrintToConsole {\n protected printToConsole: boolean = false;\n\n constructor(\n protected readonly console: Console,\n ) {\n }\n\n public init(printToConsole: boolean): void {\n this.printToConsole = printToConsole;\n }\n\n public error(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.error(...parameters);\n }\n }\n\n public info(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.info(...parameters);\n }\n }\n\n public log(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.log(...parameters);\n }\n }\n\n public debug(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.debug(...parameters);\n }\n }\n\n public trace(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.trace(...parameters);\n }\n }\n\n public warn(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.warn(...parameters);\n }\n }\n\n public printLog(log: ILogEntry): void {\n if (this.printToConsole) {\n // Log to browser console\n // debug, warning, error, trace, info, fatal\n const levelToMethod = ['log', 'warn', 'error', 'trace', 'info', 'error'];\n const method = levelToMethod[log.level || LogLevel.Debug];\n const tag = log.tag ? `[${log.tag}] ` : '';\n const location = [log.file || '', log.method || '', log.line || ''].filter(p => p !== '').join(':');\n const message = `${tag}${format(log.text)} ${location}`;\n\n // @ts-ignore\n this.console[method](message);\n }\n }\n}\n"]}
@@ -1,55 +0,0 @@
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
@@ -1 +0,0 @@
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"]}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=device.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -1,35 +0,0 @@
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
@@ -1 +0,0 @@
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"]}
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.removeUndefinedAttributes = removeUndefinedAttributes;
7
-
8
- function removeUndefinedAttributes(object) {
9
- Object.entries(object).forEach(_ref => {
10
- let [key, value] = _ref;
11
-
12
- if (value === undefined) {
13
- // @ts-ignore
14
- delete object[key];
15
- }
16
- });
17
- }
18
- //# sourceMappingURL=utilities.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["utilities.ts"],"names":["removeUndefinedAttributes","object","Object","entries","forEach","key","value","undefined"],"mappings":";;;;;;;AAAO,SAASA,yBAAT,CAAmCC,MAAnC,EAAgD;AACrDC,EAAAA,MAAM,CAACC,OAAP,CAAeF,MAAf,EAAuBG,OAAvB,CAA+B,QAAkB;AAAA,QAAjB,CAACC,GAAD,EAAMC,KAAN,CAAiB;;AAC/C,QAAIA,KAAK,KAAKC,SAAd,EAAyB;AACvB;AACA,aAAON,MAAM,CAACI,GAAD,CAAb;AACD;AACF,GALD;AAMD","sourcesContent":["export function removeUndefinedAttributes(object: any) {\n Object.entries(object).forEach(([key, value]) => {\n if (value === undefined) {\n // @ts-ignore\n delete object[key];\n }\n });\n}\n"]}