noibu-react-native 0.2.2 → 0.2.4

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 (100) hide show
  1. package/README.md +1 -1
  2. package/dist/api/clientConfig.js +225 -217
  3. package/dist/api/helpCode.js +61 -87
  4. package/dist/api/metroplexSocket.js +460 -463
  5. package/dist/api/storedPageVisit.js +150 -208
  6. package/dist/constants.js +10 -2
  7. package/dist/entry/init.js +65 -63
  8. package/dist/monitors/{appNavigationMonitor.js → AppNavigationMonitor.js} +12 -22
  9. package/dist/monitors/ClickMonitor.js +198 -0
  10. package/dist/monitors/ErrorMonitor.js +206 -0
  11. package/dist/monitors/KeyboardInputMonitor.js +60 -0
  12. package/dist/monitors/PageMonitor.js +98 -0
  13. package/dist/monitors/RequestMonitor.js +390 -0
  14. package/dist/monitors/http-tools/GqlErrorValidator.js +259 -0
  15. package/dist/monitors/http-tools/HTTPDataBundler.js +458 -0
  16. package/dist/monitors/integrations/react-native-navigation-integration.js +4 -2
  17. package/dist/pageVisit/EventDebouncer.js +99 -0
  18. package/dist/pageVisit/pageVisitEventError.js +2 -2
  19. package/dist/pageVisit/pageVisitEventHTTP.js +79 -93
  20. package/dist/react/ErrorBoundary.js +18 -15
  21. package/dist/sessionRecorder/nativeSessionRecorderSubscription.js +3 -2
  22. package/dist/sessionRecorder/sessionRecorder.js +152 -151
  23. package/dist/{api → src/api}/clientConfig.d.ts +2 -2
  24. package/dist/{api → src/api}/helpCode.d.ts +10 -16
  25. package/dist/{api → src/api}/metroplexSocket.d.ts +48 -67
  26. package/dist/{api → src/api}/storedPageVisit.d.ts +12 -21
  27. package/dist/{constants.d.ts → src/constants.d.ts} +45 -0
  28. package/dist/{entry → src/entry}/init.d.ts +1 -1
  29. package/dist/src/monitors/AppNavigationMonitor.d.ts +18 -0
  30. package/dist/src/monitors/ClickMonitor.d.ts +31 -0
  31. package/dist/src/monitors/ErrorMonitor.d.ts +63 -0
  32. package/dist/{monitors/keyboardInputMonitor.d.ts → src/monitors/KeyboardInputMonitor.d.ts} +7 -4
  33. package/dist/{monitors/pageMonitor.d.ts → src/monitors/PageMonitor.d.ts} +6 -8
  34. package/dist/src/monitors/RequestMonitor.d.ts +94 -0
  35. package/dist/src/monitors/http-tools/GqlErrorValidator.d.ts +59 -0
  36. package/dist/src/monitors/http-tools/HTTPDataBundler.d.ts +112 -0
  37. package/dist/{monitors → src/monitors}/integrations/react-native-navigation-integration.d.ts +3 -2
  38. package/dist/src/pageVisit/EventDebouncer.d.ts +24 -0
  39. package/dist/{pageVisit → src/pageVisit}/pageVisit.d.ts +1 -1
  40. package/dist/src/pageVisit/pageVisitEventHTTP.d.ts +25 -0
  41. package/dist/{sessionRecorder → src/sessionRecorder}/types.d.ts +1 -1
  42. package/dist/{storage → src/storage}/rnStorageProvider.d.ts +1 -1
  43. package/dist/{storage → src/storage}/storage.d.ts +2 -2
  44. package/dist/{storage → src/storage}/storageProvider.d.ts +3 -3
  45. package/dist/{utils → src/utils}/function.d.ts +27 -7
  46. package/dist/{utils → src/utils}/object.d.ts +11 -8
  47. package/dist/src/utils/piiRedactor.d.ts +11 -0
  48. package/dist/src/utils/polyfills.d.ts +4 -0
  49. package/dist/storage/rnStorageProvider.js +7 -4
  50. package/dist/storage/storage.js +43 -35
  51. package/dist/storage/storageProvider.js +23 -19
  52. package/dist/types/Config.d.ts +24 -20
  53. package/dist/types/Metroplex.types.d.ts +73 -0
  54. package/dist/types/Monitor.d.ts +11 -0
  55. package/dist/types/Monitor.js +19 -0
  56. package/dist/types/PageVisit.types.d.ts +8 -0
  57. package/dist/types/PageVisitErrors.types.d.ts +114 -0
  58. package/dist/types/PageVisitEvents.types.d.ts +91 -0
  59. package/dist/types/PageVisitMetrics.types.d.ts +27 -0
  60. package/dist/types/Storage.d.ts +1 -1
  61. package/dist/types/StoredPageVisit.types.d.ts +4 -47
  62. package/dist/types/WrappedObjects.d.ts +6 -0
  63. package/dist/utils/function.js +110 -77
  64. package/dist/utils/object.js +59 -6
  65. package/dist/utils/piiRedactor.js +98 -0
  66. package/dist/utils/polyfills.js +24 -0
  67. package/package.json +8 -8
  68. package/dist/monitors/appNavigationMonitor.d.ts +0 -22
  69. package/dist/monitors/clickMonitor.d.ts +0 -44
  70. package/dist/monitors/clickMonitor.js +0 -251
  71. package/dist/monitors/errorMonitor.d.ts +0 -28
  72. package/dist/monitors/errorMonitor.js +0 -180
  73. package/dist/monitors/gqlErrorValidator.d.ts +0 -82
  74. package/dist/monitors/gqlErrorValidator.js +0 -306
  75. package/dist/monitors/httpDataBundler.d.ts +0 -161
  76. package/dist/monitors/httpDataBundler.js +0 -725
  77. package/dist/monitors/inputMonitor.d.ts +0 -34
  78. package/dist/monitors/inputMonitor.js +0 -138
  79. package/dist/monitors/keyboardInputMonitor.js +0 -66
  80. package/dist/monitors/pageMonitor.js +0 -122
  81. package/dist/monitors/requestMonitor.d.ts +0 -10
  82. package/dist/monitors/requestMonitor.js +0 -401
  83. package/dist/pageVisit/pageVisitEventHTTP.d.ts +0 -18
  84. package/dist/types/PageVisit.d.ts +0 -22
  85. package/dist/types/ReactNative.d.ts +0 -4
  86. package/dist/types/globals.d.ts +0 -45
  87. /package/dist/{api → src/api}/inputManager.d.ts +0 -0
  88. /package/dist/{api → src/api}/storedMetrics.d.ts +0 -0
  89. /package/dist/{const_matchers.d.ts → src/const_matchers.d.ts} +0 -0
  90. /package/dist/{entry → src/entry}/index.d.ts +0 -0
  91. /package/dist/{pageVisit → src/pageVisit}/pageVisitEventError.d.ts +0 -0
  92. /package/dist/{pageVisit → src/pageVisit}/userStep.d.ts +0 -0
  93. /package/dist/{react → src/react}/ErrorBoundary.d.ts +0 -0
  94. /package/dist/{sessionRecorder → src/sessionRecorder}/nativeSessionRecorderSubscription.d.ts +0 -0
  95. /package/dist/{sessionRecorder → src/sessionRecorder}/sessionRecorder.d.ts +0 -0
  96. /package/dist/{utils → src/utils}/date.d.ts +0 -0
  97. /package/dist/{utils → src/utils}/eventlistener.d.ts +0 -0
  98. /package/dist/{utils → src/utils}/log.d.ts +0 -0
  99. /package/dist/{utils → src/utils}/performance.d.ts +0 -0
  100. /package/dist/{utils → src/utils}/stacktrace-parser.d.ts +0 -0
@@ -1,100 +1,74 @@
1
+ import { __awaiter } from 'tslib';
1
2
  import MetroplexSocket from './metroplexSocket.js';
2
3
  import { SEVERITY } from '../constants.js';
3
4
  import ClientConfig from './clientConfig.js';
5
+ import { Singleton } from '../types/Monitor.js';
4
6
 
5
7
  /**
6
8
  * HelpCode class is responsible for help code feature related functionality
7
9
  */
8
- class HelpCode {
9
- /**
10
- * Singleton instance
11
- * @returns {HelpCode}
12
- */
13
- static getInstance() {
14
- if (!this.instance) {
15
- this.instance = new HelpCode();
10
+ class HelpCode extends Singleton {
11
+ /**
12
+ * Constructs instance and sets up event listeners
13
+ */
14
+ constructor() {
15
+ super();
16
+ this.requestContext = null;
17
+ this.receiveHelpCode = this.receiveHelpCode.bind(this);
16
18
  }
17
-
18
- return this.instance;
19
- }
20
-
21
- /**
22
- * Constructs instance and sets up event listeners
23
- */
24
- constructor() {
25
- this.requestContext = null;
26
- this.receiveHelpCode = this.receiveHelpCode.bind(this);
27
- }
28
-
29
- /**
30
- * Requests a help code and returns a Promise that resolves when the help code is obtained
31
- * or rejects if the noibu connection is unavailable.
32
-
33
- * @returns {Promise<string>} Promise object representing the help code request.
34
- * @throws {string} Throws an error if the noibu connection is unavailable.
35
- */
36
- async requestHelpCode() {
37
- if (this.requestContext !== null) {
38
- return this.requestContext.promise;
39
- }
40
-
41
- const context = {
42
- resolve: null,
43
- reject: null,
44
- promise: null,
45
- };
46
-
47
- context.promise = new Promise((resolve, reject) => {
48
- context.resolve = resolve;
49
- context.reject = reject;
50
- });
51
-
52
- this.requestContext = context;
53
-
54
- const result = await MetroplexSocket.getInstance().requestHelpCode(
55
- this.receiveHelpCode,
56
- );
57
-
58
- if (result === false) {
59
- this.requestContext = null;
60
- return Promise.reject(new Error('noibu connection is unavailable'));
19
+ /**
20
+ * Requests a help code and returns a Promise that resolves when the help code is obtained
21
+ * or rejects if the noibu connection is unavailable.
22
+
23
+ * @returns {Promise<string>} Promise object representing the help code request.
24
+ * @throws {string} Throws an error if the noibu connection is unavailable.
25
+ */
26
+ requestHelpCode() {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ if (this.requestContext !== null) {
29
+ return this.requestContext.promise;
30
+ }
31
+ const context = {
32
+ resolve: null,
33
+ reject: null,
34
+ promise: null,
35
+ };
36
+ context.promise = new Promise((resolve, reject) => {
37
+ context.resolve = resolve;
38
+ context.reject = reject;
39
+ });
40
+ this.requestContext = context;
41
+ const result = yield MetroplexSocket.getInstance().requestHelpCode(this.receiveHelpCode);
42
+ if (!result) {
43
+ this.requestContext = null;
44
+ return Promise.reject(new Error('noibu connection is unavailable'));
45
+ }
46
+ return this.requestContext.promise;
47
+ });
61
48
  }
62
-
63
- return this.requestContext.promise;
64
- }
65
-
66
- /**
67
- * Handles the received help code event.
68
- * @param {CustomEvent<string>} event - The event object with string detail property.
69
- * @returns {void}
70
- */
71
- receiveHelpCode(event) {
72
- if (this.requestContext === null) {
73
- const { success, data } = event.detail;
74
-
75
- if (!success) {
76
- const message = `Noibu help code is not available due to ${data}`;
77
-
78
- ClientConfig.getInstance().postNoibuErrorAndOptionallyDisableClient(
79
- message,
80
- false,
81
- SEVERITY.error,
82
- );
83
- }
84
- return;
85
- }
86
-
87
- const context = this.requestContext;
88
- this.requestContext = null;
89
-
90
- const { success, data } = event.detail;
91
-
92
- if (success) {
93
- context.resolve(data);
94
- } else {
95
- context.reject(new Error(data));
49
+ /**
50
+ * Handles the received help code event.
51
+ */
52
+ receiveHelpCode(event) {
53
+ var _a, _b;
54
+ if (this.requestContext === null) {
55
+ const { success, data } = event.detail;
56
+ if (!success) {
57
+ const message = `Noibu help code is not available due to ${data}`;
58
+ ClientConfig.getInstance().postNoibuErrorAndOptionallyDisableClient(message, false, SEVERITY.error);
59
+ }
60
+ return;
61
+ }
62
+ const context = this.requestContext;
63
+ this.requestContext = null;
64
+ const { success, data } = event.detail;
65
+ if (success) {
66
+ (_a = context.resolve) === null || _a === void 0 ? void 0 : _a.call(context, data);
67
+ }
68
+ else {
69
+ (_b = context.reject) === null || _b === void 0 ? void 0 : _b.call(context, new Error(data));
70
+ }
96
71
  }
97
- }
98
72
  }
99
73
 
100
74
  export { HelpCode as default };