noibu-react-native 0.2.6 → 0.2.8

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/README.md +15 -15
  2. package/android/build.gradle +1 -1
  3. package/dist/{src/api/clientConfig.d.ts → api/ClientConfig.d.ts} +19 -20
  4. package/dist/api/{clientConfig.js → ClientConfig.js} +82 -63
  5. package/dist/{src/api/helpCode.d.ts → api/HelpCode.d.ts} +3 -10
  6. package/dist/api/{helpCode.js → HelpCode.js} +8 -14
  7. package/dist/api/InputManager.d.ts +39 -0
  8. package/dist/api/InputManager.js +156 -0
  9. package/dist/{src/api/metroplexSocket.d.ts → api/MetroplexSocket.d.ts} +33 -38
  10. package/dist/api/{metroplexSocket.js → MetroplexSocket.js} +190 -178
  11. package/dist/{src/api/storedMetrics.d.ts → api/StoredMetrics.d.ts} +10 -20
  12. package/dist/api/StoredMetrics.js +158 -0
  13. package/dist/{src/api/storedPageVisit.d.ts → api/StoredPageVisit.d.ts} +11 -8
  14. package/dist/api/{storedPageVisit.js → StoredPageVisit.js} +62 -48
  15. package/dist/const_matchers.js +1 -5
  16. package/dist/constants.d.ts +48 -0
  17. package/dist/constants.js +15 -397
  18. package/dist/{src/entry → entry}/index.d.ts +5 -6
  19. package/dist/entry/index.js +3 -4
  20. package/dist/entry/init.d.ts +8 -0
  21. package/dist/entry/init.js +34 -19
  22. package/dist/monitors/AppNavigationMonitor.d.ts +10 -0
  23. package/dist/monitors/AppNavigationMonitor.js +19 -19
  24. package/dist/monitors/AppNavigationMonitor.test.d.ts +1 -0
  25. package/dist/{src/monitors → monitors}/BaseMonitor.d.ts +5 -5
  26. package/dist/monitors/BaseMonitor.js +9 -4
  27. package/dist/monitors/BaseMonitor.test.d.ts +1 -0
  28. package/dist/{src/monitors → monitors}/ClickMonitor.d.ts +10 -13
  29. package/dist/monitors/ClickMonitor.js +72 -76
  30. package/dist/monitors/ClickMonitor.test.d.ts +1 -0
  31. package/dist/{src/monitors → monitors}/ErrorMonitor.d.ts +4 -28
  32. package/dist/monitors/ErrorMonitor.js +45 -55
  33. package/dist/{src/monitors → monitors}/KeyboardInputMonitor.d.ts +1 -3
  34. package/dist/monitors/KeyboardInputMonitor.js +13 -11
  35. package/dist/{src/monitors → monitors}/PageMonitor.d.ts +1 -1
  36. package/dist/monitors/PageMonitor.js +25 -2
  37. package/dist/{src/monitors → monitors}/RequestMonitor.d.ts +9 -29
  38. package/dist/monitors/RequestMonitor.js +46 -57
  39. package/dist/monitors/http-tools/GqlErrorValidator.d.ts +35 -0
  40. package/dist/monitors/http-tools/GqlErrorValidator.js +42 -70
  41. package/dist/{src/monitors → monitors}/http-tools/HTTPDataBundler.d.ts +9 -15
  42. package/dist/monitors/http-tools/HTTPDataBundler.js +74 -67
  43. package/dist/monitors/integrations/ReactNativeNavigationIntegration.d.ts +17 -0
  44. package/dist/monitors/integrations/{react-native-navigation-integration.js → ReactNativeNavigationIntegration.js} +15 -12
  45. package/dist/{src/pageVisit → pageVisit}/EventDebouncer.d.ts +9 -10
  46. package/dist/pageVisit/EventDebouncer.js +43 -74
  47. package/dist/pageVisit/HttpEventManager.d.ts +14 -0
  48. package/dist/pageVisit/HttpEventManager.js +88 -0
  49. package/dist/pageVisit/PageVisitManager.d.ts +31 -0
  50. package/dist/pageVisit/PageVisitManager.js +99 -0
  51. package/dist/pageVisit/pageVisitEventError.d.ts +12 -0
  52. package/dist/pageVisit/pageVisitEventError.js +170 -280
  53. package/dist/{src/react → react}/ErrorBoundary.d.ts +4 -9
  54. package/dist/react/ErrorBoundary.js +3 -6
  55. package/dist/{src/sessionRecorder/sessionRecorder.d.ts → sessionRecorder/SessionRecorder.d.ts} +7 -17
  56. package/dist/sessionRecorder/{sessionRecorder.js → SessionRecorder.js} +60 -71
  57. package/dist/{src/sessionRecorder → sessionRecorder}/nativeSessionRecorderSubscription.d.ts +4 -6
  58. package/dist/sessionRecorder/nativeSessionRecorderSubscription.js +3 -5
  59. package/dist/{src/storage/rnStorageProvider.d.ts → storage/RNStorageProvider.d.ts} +4 -8
  60. package/dist/storage/{rnStorageProvider.js → RNStorageProvider.js} +3 -7
  61. package/dist/{src/storage/storage.d.ts → storage/Storage.d.ts} +8 -18
  62. package/dist/storage/{storage.js → Storage.js} +17 -30
  63. package/dist/{src/storage/storageProvider.d.ts → storage/StorageProvider.d.ts} +5 -8
  64. package/dist/storage/{storageProvider.js → StorageProvider.js} +7 -8
  65. package/dist/types/NavigationIntegration.d.ts +1 -1
  66. package/dist/utils/date.d.ts +7 -0
  67. package/dist/utils/date.js +41 -51
  68. package/dist/utils/eventlistener.js +6 -14
  69. package/dist/{src/utils → utils}/function.d.ts +13 -43
  70. package/dist/utils/function.js +42 -113
  71. package/dist/utils/log.d.ts +4 -0
  72. package/dist/utils/log.js +2 -4
  73. package/dist/{src/utils → utils}/object.d.ts +10 -8
  74. package/dist/utils/object.js +12 -12
  75. package/dist/{src/utils → utils}/performance.d.ts +1 -1
  76. package/dist/utils/piiRedactor.js +31 -3
  77. package/dist/utils/stacktrace-parser.d.ts +8 -0
  78. package/dist/utils/stacktrace-parser.js +29 -21
  79. package/dist/utils/stacktrace-parser.test.d.ts +1 -0
  80. package/package.json +14 -14
  81. package/dist/api/inputManager.js +0 -227
  82. package/dist/api/storedMetrics.js +0 -198
  83. package/dist/pageVisit/pageVisit.js +0 -181
  84. package/dist/pageVisit/pageVisitEventHTTP.js +0 -98
  85. package/dist/pageVisit/userStep.js +0 -20
  86. package/dist/src/api/inputManager.d.ts +0 -87
  87. package/dist/src/constants.d.ts +0 -290
  88. package/dist/src/entry/init.d.ts +0 -5
  89. package/dist/src/monitors/AppNavigationMonitor.d.ts +0 -18
  90. package/dist/src/monitors/http-tools/GqlErrorValidator.d.ts +0 -59
  91. package/dist/src/monitors/integrations/react-native-navigation-integration.d.ts +0 -20
  92. package/dist/src/pageVisit/pageVisit.d.ts +0 -52
  93. package/dist/src/pageVisit/pageVisitEventError.d.ts +0 -15
  94. package/dist/src/pageVisit/pageVisitEventHTTP.d.ts +0 -25
  95. package/dist/src/pageVisit/userStep.d.ts +0 -5
  96. package/dist/src/utils/date.d.ts +0 -6
  97. package/dist/src/utils/log.d.ts +0 -4
  98. package/dist/src/utils/stacktrace-parser.d.ts +0 -7
  99. package/dist/types/Config.d.ts +0 -31
  100. package/dist/types/Metroplex.types.d.ts +0 -73
  101. package/dist/types/PageVisit.types.d.ts +0 -8
  102. package/dist/types/PageVisitErrors.types.d.ts +0 -114
  103. package/dist/types/PageVisitEvents.types.d.ts +0 -91
  104. package/dist/types/PageVisitMetrics.types.d.ts +0 -27
  105. package/dist/types/Storage.d.ts +0 -14
  106. package/dist/types/StoredPageVisit.types.d.ts +0 -11
  107. package/dist/types/WrappedObjects.d.ts +0 -6
  108. /package/dist/{src/api/clientConfig.test.d.ts → api/ClientConfig.test.d.ts} +0 -0
  109. /package/dist/{src/monitors/BaseMonitor.test.d.ts → api/MetroplexSocket.test.d.ts} +0 -0
  110. /package/dist/{src/const_matchers.d.ts → const_matchers.d.ts} +0 -0
  111. /package/dist/{src/sessionRecorder → sessionRecorder}/types.d.ts +0 -0
  112. /package/dist/{src/utils → utils}/eventlistener.d.ts +0 -0
  113. /package/dist/{src/utils → utils}/piiRedactor.d.ts +0 -0
  114. /package/dist/{src/utils → utils}/polyfills.d.ts +0 -0
@@ -1,181 +0,0 @@
1
- import uuid from 'react-native-uuid';
2
- import { TYPE_ATT_NAME, OCCURRED_AT_ATT_NAME, MAX_PAGEVISIT_EVENTS, MAX_PAGEVISIT_PARTS, PV_METROPLEX_TYPE, PV_EVENTS_ATT_NAME, PV_PART_COUNTER_ATT_NAME, PAGE_VISIT_PART_ATT_NAME } from '../constants.js';
3
- import ClientConfig from '../api/clientConfig.js';
4
- import MetroplexSocket from '../api/metroplexSocket.js';
5
- import StoredMetrics from '../api/storedMetrics.js';
6
- import { noibuLog } from '../utils/log.js';
7
-
8
- /** @module Pagevisit */
9
-
10
- /**
11
- * Singleton class to hold all the information
12
- * about the gathered errors throught the session
13
- */
14
- class PageVisit {
15
- /**
16
- * Creates an instance of a PageVisit
17
- */
18
- constructor() {
19
- this.partCounter = 0;
20
- // TODO: Remove pvMap and related variables since we only send a single event at a time
21
- this.pvMap = {};
22
- this.partCounter = 0;
23
- this.pvEventLength = 0;
24
- // variables used for monitoring our posting frequency
25
- this.visibilityChangedCounter = 0;
26
- this.totalPvEventLength = 0;
27
- this.inDebounceHandle = 0;
28
- this.isInAcceleratedPvPostMode = false;
29
- }
30
-
31
- /**
32
- * creates a PV object
33
- */
34
- static configureInstance() {
35
- if (!this.instance) {
36
- this.instance = new PageVisit();
37
- }
38
- }
39
-
40
- /** gets the singleton instance
41
- * @returns {PageVisit}
42
- */
43
- static getInstance() {
44
- if (!this.instance) {
45
- throw new Error('Pagevisit was never configured');
46
- }
47
- return this.instance;
48
- }
49
-
50
- /** adds page visit events into the current page visit map and then sends a page visit message
51
- * @param {} eventObjects
52
- * @param {} type
53
- */
54
- addPageVisitEvents(eventObjects, type) {
55
- eventObjects.forEach(eventObj => {
56
- this._addPageVisitEvent(eventObj, type);
57
- });
58
- this._sendPageVisitMessage();
59
- }
60
-
61
- /**
62
- * adds the page visit event into the current page visit map and then sends a page visit message
63
- * returns the the key to access this event in the map
64
- * @param {} eventObj
65
- * @param {} type
66
- */
67
- addPageVisitEvent(eventObj, type) {
68
- noibuLog('addPageVisitEvent', {
69
- eventObj,
70
- type,
71
- });
72
- const id = this._addPageVisitEvent(eventObj, type);
73
- this._sendPageVisitMessage();
74
- return id;
75
- }
76
-
77
- /**
78
- * adds a new page visit event into the current page visit map and returns the
79
- * the key to access this event in the map
80
- * @param {} eventObj
81
- * @param {} type
82
- */
83
- _addPageVisitEvent(eventObj, type) {
84
- if (!('occurredAt' in eventObj && 'event' in eventObj)) {
85
- throw new Error('missing attributes in the eventObj');
86
- }
87
-
88
- // creating the pvEvent from the passed pv
89
- const pvEvent = {
90
- [TYPE_ATT_NAME]: type,
91
- [OCCURRED_AT_ATT_NAME]: eventObj.occurredAt,
92
- [type]: eventObj.event,
93
- };
94
-
95
- // if we are over the limit set by the Beacon API limit, we need to
96
- // send what we currently have in the buffer to metroplex
97
- if (this.pvEventLength >= MAX_PAGEVISIT_EVENTS) {
98
- this._sendPageVisitMessage();
99
- }
100
-
101
- const pvEventId = uuid.v4();
102
- // updating sizes
103
- this.pvMap[pvEventId] = pvEvent;
104
- this.pvEventLength += 1;
105
- this.totalPvEventLength += 1;
106
-
107
- return pvEventId;
108
- }
109
-
110
- /**
111
- * Creates a page visit frag from an events array and part counter. Appends
112
- * the end time field and returns the frag
113
- * @param {} pvEvents
114
- * @param {} partCounter
115
- */
116
- static makePageVisitFrag(pvEvents, partCounter) {
117
- const pagevistFrag = {};
118
- pagevistFrag[PV_EVENTS_ATT_NAME] = pvEvents;
119
- pagevistFrag[PV_PART_COUNTER_ATT_NAME] = partCounter;
120
- return MetroplexSocket.getInstance().addEndTimeToPayload(
121
- pagevistFrag,
122
- true,
123
- );
124
- }
125
-
126
- /**
127
- * _sendPageVisitMessage will reset the buffer and post the current
128
- * content to metroplex
129
- */
130
- _sendPageVisitMessage() {
131
- // not using Object.values since we want to support as many browsers
132
- // as possible
133
- const pvEvents = Object.keys(this.pvMap).map(id => this.pvMap[id]);
134
-
135
- if (pvEvents.length === 0) {
136
- // don't send to metroplex if the event buffer is empty.
137
- // A previous call to this function from visibilityChange
138
- // would have sent it as a final post. Another reason it would be empty is
139
- // if the user has not done anything on the page and switched tabs,
140
- // or closed the browser etc
141
- return;
142
- }
143
-
144
- if (this.partCounter >= MAX_PAGEVISIT_PARTS) {
145
- // if we are attempting to send over the MAX_PAGEVISIT_PARTS
146
- // number of parts then we block any subsequent part post to not
147
- // inondate our back end. We lock the client for 10 minute, something
148
- // must be going bad.
149
- ClientConfig.getInstance().lockClientUntilNextPage(
150
- `NoibuJS will stop processing parts because we ` +
151
- `reached max parts: ${MAX_PAGEVISIT_PARTS}. Variables: ` +
152
- `
153
- total Pv Event Length: ${this.totalPvEventLength}
154
- visibility Changed Counter: ${this.visibilityChangedCounter}
155
- `,
156
- );
157
- return;
158
- }
159
-
160
- const pagevistFrag = PageVisit.makePageVisitFrag(
161
- pvEvents,
162
- this.partCounter,
163
- );
164
-
165
- StoredMetrics.getInstance().setPvPart(this.partCounter);
166
-
167
- const metroplexMsg = {
168
- [PAGE_VISIT_PART_ATT_NAME]: pagevistFrag,
169
- };
170
-
171
- MetroplexSocket.getInstance().sendMessage(PV_METROPLEX_TYPE, metroplexMsg);
172
-
173
- // since we sent the content of the buffer to metroplex, we reset
174
- // all variables that contained information about the past buffer.
175
- this.pvMap = {};
176
- this.pvEventLength = 0;
177
- this.partCounter += 1;
178
- }
179
- }
180
-
181
- export { PageVisit };
@@ -1,98 +0,0 @@
1
- import { timestampWrapper } from '../utils/date.js';
2
- import { HTTP_RESP_CODE_ATT_NAME, HTTP_RESP_TIME_ATT_NAME, HTTP_METHOD_ATT_NAME, URL_ATT_NAME, PV_SEQ_ATT_NAME, PAGE_VISIT_HTTP_DATA_ATT_NAME, HTTP_DATA_METROPLEX_TYPE, HTTP_EVENT_TYPE, MAX_HTTP_DATA_EVENT_COUNT, MAX_HTTP_DATA_IF_ERROR_EVENT_COUNT } from '../constants.js';
3
- import { PageVisit } from './pageVisit.js';
4
- import StoredMetrics from '../api/storedMetrics.js';
5
- import MetroplexSocket from '../api/metroplexSocket.js';
6
- import { getMaxSubstringAllowed, asString, safeTrim } from '../utils/function.js';
7
- import { EventDebouncer } from './EventDebouncer.js';
8
-
9
- /** @module PageVisitEventHTTP */
10
- /**
11
- * Determines if a response is a failure
12
- */
13
- function isHttpCodeFailure(code) {
14
- if (typeof code !== 'number') {
15
- return true;
16
- }
17
- return code >= 400 || code <= 0;
18
- }
19
- /** Class representing a PageVisitEventHTTP */
20
- class PageVisitEventHTTP {
21
- /**
22
- * Creates an instance of the http event for the pv
23
- */
24
- constructor(httpEvent, httpData, isGqlError = false) {
25
- /** if no value or it's less than 0, fallback to 0 */
26
- const validate = (value) => (!value || value < 0 ? 0 : value);
27
- this.httpEvent = {
28
- [HTTP_RESP_CODE_ATT_NAME]: validate(httpEvent[HTTP_RESP_CODE_ATT_NAME]),
29
- [HTTP_RESP_TIME_ATT_NAME]: validate(httpEvent[HTTP_RESP_TIME_ATT_NAME]),
30
- [HTTP_METHOD_ATT_NAME]: (httpEvent[HTTP_METHOD_ATT_NAME] || 'get').toUpperCase(),
31
- [URL_ATT_NAME]: getMaxSubstringAllowed(asString(httpEvent[URL_ATT_NAME])),
32
- };
33
- this.httpData = httpData;
34
- this.isGqlError = isGqlError;
35
- }
36
- /** Saves the HTTP event to the pageVisit Queue */
37
- saveHTTPEvent() {
38
- // we do not store http events that have empty urls
39
- if (!this.httpEvent || !safeTrim(this.httpEvent[URL_ATT_NAME])) {
40
- return;
41
- }
42
- // we register an http event
43
- StoredMetrics.getInstance().addHttpEvent();
44
- const status = this.httpEvent[HTTP_RESP_CODE_ATT_NAME];
45
- // send http data down to metroplex
46
- if (this.httpData) {
47
- // add the sequence number to both events
48
- const sequenceNumber = StoredMetrics.getInstance().httpSequenceNumber;
49
- const isSendAllowed = PageVisitEventHTTP.isSendAllowed(status, sequenceNumber, this.isGqlError);
50
- // restrict total number of events collected per page visit to ensure we don't
51
- // blow up memory and storage usage
52
- if (isSendAllowed) {
53
- this.httpData[PV_SEQ_ATT_NAME] = sequenceNumber;
54
- this.httpEvent[PV_SEQ_ATT_NAME] = sequenceNumber;
55
- // increment the count
56
- StoredMetrics.getInstance().addHttpData();
57
- const metroplexMsg = {
58
- [PAGE_VISIT_HTTP_DATA_ATT_NAME]: this.httpData,
59
- };
60
- MetroplexSocket.getInstance().sendMessage(HTTP_DATA_METROPLEX_TYPE, metroplexMsg);
61
- }
62
- else {
63
- // have collected more than the max number of http requests for this
64
- // page visit, so increment the over request limit count
65
- StoredMetrics.getInstance().addHttpDataOverLimit();
66
- }
67
- }
68
- // if this was an error, send immediately so we don't lose it
69
- if (isHttpCodeFailure(status)) {
70
- PageVisit.getInstance().addPageVisitEvent({
71
- event: this.httpEvent,
72
- occurredAt: new Date(timestampWrapper(Date.now())).toISOString(),
73
- }, HTTP_EVENT_TYPE);
74
- return;
75
- }
76
- // debounce event
77
- EventDebouncer.getInstance().addEvent(this.httpEvent, HTTP_EVENT_TYPE);
78
- }
79
- /**
80
- * Checks if sending data is allowed based on the HTTP status code and count.
81
- * status - The HTTP status code to evaluate.
82
- * count - The count of events to consider.
83
- * isGqlError - Whether the context is considered as a GQL error.
84
- * Returns `true` if sending data is allowed, `false` otherwise.
85
- */
86
- static isSendAllowed(status, count, isGqlError = false) {
87
- const isFailure = isHttpCodeFailure(status) || isGqlError;
88
- const isSuccess = !isFailure;
89
- if (isSuccess) {
90
- if (count < MAX_HTTP_DATA_EVENT_COUNT) {
91
- return true;
92
- }
93
- }
94
- return isFailure && count < MAX_HTTP_DATA_IF_ERROR_EVENT_COUNT;
95
- }
96
- }
97
-
98
- export { PageVisitEventHTTP, isHttpCodeFailure };
@@ -1,20 +0,0 @@
1
- import { asString } from '../utils/function.js';
2
- import { CSS_CLASS_ATT_NAME } from '../constants.js';
3
-
4
- /** @module UserStep */
5
- /**
6
- * updates the payload of a user step in order to stringify the css class
7
- * @param {} payload
8
- */
9
- function updatePayload(payload) {
10
- // In certain cases the class returned by the attribute will be an
11
- // object. This will break the metroplex validation and thus needs to be
12
- // stringified
13
- const updatedPayload = payload;
14
- updatedPayload[CSS_CLASS_ATT_NAME] = asString(
15
- updatedPayload[CSS_CLASS_ATT_NAME],
16
- );
17
- return updatedPayload;
18
- }
19
-
20
- export { updatePayload };
@@ -1,87 +0,0 @@
1
- /** this class controls the input that customers can inject into
2
- * our script via the NoibuJS SDK
3
- */
4
- export default class InputManager {
5
- /** gets the singleton instance */
6
- static getInstance(): InputManager;
7
- customIDs: {};
8
- customErrorsCount: number;
9
- TOO_MANY_IDS_ADDED_MSG: string;
10
- ID_NAME_ALREADY_ADDED_MSG: string;
11
- NAME_TOO_LONG_MSG: string;
12
- VALUE_TOO_LONG_MSG: string;
13
- INVALID_NAME_TYPE_MSG: string;
14
- INVALID_VALUE_TYPE_MSG: string;
15
- NAME_HAS_NO_LENGTH_MSG: string;
16
- VALUE_HAS_NO_LENGTH_MSG: string;
17
- SUCCESS_MSG: string;
18
- ERROR_HAS_NO_MSG_MSG: string;
19
- ERROR_HAS_NO_STACK_MSG: string;
20
- NULL_CUSTOM_ERR_MSG: string;
21
- ERROR_ALREADY_RECEIVED_MSG: string;
22
- INVALID_ERROR_SOURCE_MSG: string;
23
- TOO_MANY_ERRORS_RECEIVED_PER_PAGEVISIT_MSG: string;
24
- /** exposes functions to the window of the browser for the clients
25
- * to interact with on their end
26
- */
27
- exposeFunctions(): {
28
- requestHelpCode: (alert?: boolean) => Promise<string>;
29
- addCustomAttribute: (name: string, value: string) => Promise<string>;
30
- addError: (customError: Error) => string;
31
- addJsSdkError: (customError: string, errorSource: string) => string;
32
- };
33
- /**
34
- * gets the sdk object that will be assigned to a window variable
35
- * @returns {{
36
- * requestHelpCode: (alert?: boolean) => Promise<string>,
37
- * addCustomAttribute: (name: string, value: string) => Promise<string>,
38
- * addError: (customError: Error) => string,
39
- * addJsSdkError: (customError: string, errorSource: string) => string
40
- * }}
41
- */
42
- _getSDKWindowObject(): {
43
- requestHelpCode: (alert?: boolean) => Promise<string>;
44
- addCustomAttribute: (name: string, value: string) => Promise<string>;
45
- addError: (customError: Error) => string;
46
- addJsSdkError: (customError: string, errorSource: string) => string;
47
- };
48
- /**
49
- * validates the custom error that was passed
50
- * @param {} customError
51
- */
52
- _validateCustomError(customError: any): string;
53
- /**
54
- * Validates and sets the custom error to our internal trackers
55
- * @param {} customError
56
- */
57
- _validateAndSetCustomError(customError: any): string;
58
- /**
59
- * adds an error from a JS Sdk to the session
60
- * @param {} customError
61
- * @param {string} errorSource
62
- */
63
- _addErrorFromJSSdk(customError: any, errorSource: string): string;
64
- /**
65
- * adds a custom Error to the session
66
- * @param {} customError
67
- */
68
- _addCustomError(customError: any): string;
69
- /**
70
- * adds a custom id to the session
71
- * @param {} name
72
- * @param {} value
73
- */
74
- _addCustomAttribute(name: any, value: any): Promise<string>;
75
- /**
76
- * validation function for customer input
77
- * @param {} name
78
- * @param {} value
79
- */
80
- _validateCustomIDInput(name: any, value: any): string;
81
- /**
82
- * Requests a help code from the HelpCode instance.
83
- * @param {boolean} [alertUser=true] - Whether to alert the user about the help code request.
84
- * @returns {Promise<string>} A promise that resolves with the requested help code.
85
- */
86
- _requestHelpCode(): Promise<string>;
87
- }
@@ -1,290 +0,0 @@
1
- /** @module Constants */
2
- export declare const CURRENT_NOIBUJS_VERSION: 2;
3
- export declare const MAX_FRAMES_IN_ARRAY: 50;
4
- export declare const MAX_STRING_LENGTH: 1024;
5
- export declare const MAX_STRING_LENGTH_2048: 2048;
6
- export declare const MAX_HTTP_DATA_PAYLOAD_LENGTH: 50000;
7
- export declare const MAX_COLLECT_ERROR_LOG: 50;
8
- export declare const MAX_PAGEVISIT_PARTS: 10000;
9
- export declare const MAX_HTTP_DATA_EVENT_COUNT: 100;
10
- export declare const MAX_TIME_FOR_UNSENT_DATA_MILLIS: 500;
11
- export declare const NOIBU_BROWSER_ID_KYWRD: "n_browser_data";
12
- export declare const NOIBU_STORED_PAGE_VISIT: "n_stored_page_visit";
13
- export declare const NOIBU_LOCAL_STORAGE_TEST_KEY: "n_key";
14
- export declare const LOCAL_STORAGE_WRITE_TIMEOUT_MILLIS: 2500;
15
- export declare const CLIENT_LOCK_TIME_MINUTES: 45;
16
- export declare const PV_SEQ_NUM_RESET_TIME_MINUTES: 45;
17
- export declare const REQUIRED_DATA_PROCESSING_URLS: readonly ["metroplexSocketBase", "metroplexHTTPBase", "domain"];
18
- export declare const HTTP_BODY_DROPPED_TYPE_MSG: "Dropped due to unsupported type.";
19
- export declare const HTTP_BODY_DROPPED_LENGTH_MSG: "Dropped due to length.";
20
- export declare const HTTP_BODY_NULL_STRING: "null";
21
- export declare const BLOCKED_HTTP_HEADER_KEYS: string[];
22
- export declare const PII_DIGIT_PATTERN: RegExp;
23
- export declare const PII_EMAIL_PATTERN: RegExp;
24
- export declare const HTTP_PII_BLOCKING_PATTERNS: RegExp[];
25
- export declare const DEFAULT_WEBSITE_SUBDOMAIN_PATTERN: RegExp;
26
- export declare const PII_REDACTION_REPLACEMENT_STRING: "******";
27
- export declare const DEFAULT_STACK_FRAME_FIELD_VALUE: "_";
28
- export declare const CURRENT_PV_VERSION: 5;
29
- export declare const CURRENT_METRICS_VERSION: 1;
30
- export declare const SEVERITY: {
31
- readonly error: "error";
32
- readonly warn: "warn";
33
- readonly info: "info";
34
- readonly debug: "debug";
35
- };
36
- export declare const MAX_METROPLEX_SOCKET_INNACTIVE_TIME: number;
37
- export declare const MAX_PAGEVISIT_VISITED: 300;
38
- export declare const IMG_EXTENSIONS: readonly ["jpg", "jpeg", "bmp", "gif", "png"];
39
- export declare const MAX_PAGEVISIT_EVENTS: 200;
40
- export declare const POSSIBLE_HTML_ATTRIBUTES_FOR_TEXT_VALUES: string[];
41
- export declare const MAX_CUSTOM_IDS_PER_PAGEVISIT: 10;
42
- export declare const MAX_CUSTOM_ERRORS_PER_PAGEVISIT: 500;
43
- export declare const NOIBUJS_SDK_REQUEST_HELP_CODE: "requestHelpCode";
44
- export declare const NOIBUJS_SDK_ADD_ID_FUNCTION: "addCustomAttribute";
45
- export declare const NOIBUJS_SDK_ADD_ERROR_FUNCTION: "addError";
46
- export declare const NOIBUJS_SDK_ADD_ERROR_FROM_JS_FMW_FUNCTION: "addJsSdkError";
47
- export declare const ERROR_PROPS: readonly ["url", "type", "str", "http_code", "js_err"];
48
- export declare const EVENT_TARGETS: string[];
49
- export declare const WHITELIST_HTML_ID_TEXT_REGEX = "method|finance|sagepay|cart|bag|coupon|affirm|karna|sezzle|button";
50
- export declare const HUMAN_READABLE_CONTENT_TYPE_REGEX = "text|json|xml|html|graphql|x-www-form-urlencoded|form-data";
51
- export declare const PV_METROPLEX_TYPE: "p";
52
- export declare const VIDEO_METROPLEX_TYPE: "v";
53
- export declare const META_DATA_METROPLEX_TYPE: "m";
54
- export declare const HTTP_DATA_METROPLEX_TYPE: "h";
55
- export declare const CUSTOM_ID_NAME_TYPE: "id_name";
56
- export declare const CUSTOM_ID_VALUE_TYPE: "id_val";
57
- export declare const BROWSER_ID_ATT_NAME: "br_id";
58
- export declare const PV_ID_ATT_NAME: "pv_id";
59
- export declare const VER_ATT_NAME: "v";
60
- export declare const PV_SEQ_ATT_NAME: "seq";
61
- export declare const VIDEO_RECORDER_ATT_NAME: "video_recorder";
62
- export declare const ON_URL_ATT_NAME: "on_url";
63
- export declare const PAGE_GROUPS_ATT_NAME = "page_groups";
64
- export declare const PAGE_TITLE_ATT_NAME = "page_title";
65
- export declare const URL_ATT_NAME: "url";
66
- export declare const REF_URL_ATT_NAME: "ref_url";
67
- export declare const STARTED_AT_ATT_NAME: "start_at";
68
- export declare const PV_EVENTS_ATT_NAME: "events";
69
- export declare const PV_PART_COUNTER_ATT_NAME: "pc";
70
- export declare const CONN_COUNT_ATT_NAME: "conc";
71
- export declare const COLLECT_VER_ATT_NAME: "cv";
72
- export declare const VIDEO_FRAG_ATT_NAME: "vid";
73
- export declare const CSS_URLS_ATT_NAME: "css_urls";
74
- export declare const END_AT_ATT_NAME: "end_at";
75
- export declare const LENGTH_ATT_NAME: "len";
76
- export declare const IS_LAST_ATT_NAME: "last";
77
- export declare const TYPE_ATT_NAME: "type";
78
- export declare const OCCURRED_AT_ATT_NAME: "occ_at";
79
- export declare const HTTP_CODE_ATT_NAME: "h_code";
80
- export declare const JS_ERROR_ATT_NAME: "j_err";
81
- export declare const GQL_ERROR_ATT_NAME: "gql_err";
82
- export declare const EVENT_EVENT_TYPE: "events";
83
- export declare const TAGNAME_ATT_NAME: "tag";
84
- export declare const SOURCE_ATT_NAME: "src";
85
- export declare const TEXT_ATT_NAME: "txt";
86
- export declare const HTMLID_ATT_NAME: "hid";
87
- export declare const HTTP_METHOD_ATT_NAME: "mtd";
88
- export declare const HTTP_RESP_CODE_ATT_NAME: "code";
89
- export declare const HTTP_RESP_TIME_ATT_NAME: "r_time";
90
- export declare const HTTP_RESP_LENGTH_ATT_NAME: "resp_len";
91
- export declare const HTTP_DATA_PAYLOAD_ATT_NAME: "rqp";
92
- export declare const HTTP_DATA_RESP_PAYLOAD_ATT_NAME: "rsp";
93
- export declare const HTTP_DATA_REQ_HEADERS_ATT_NAME: "rqh";
94
- export declare const HTTP_DATA_RESP_HEADERS_ATT_NAME: "rsh";
95
- export declare const JS_STACK_LINE_ATT_NAME: "line";
96
- export declare const JS_STACK_COL_ATT_NAME: "column";
97
- export declare const JS_STACK_METHOD_ATT_NAME: "mname";
98
- export declare const JS_STACK_FILE_ATT_NAME: "file";
99
- export declare const JS_STACK_FRAMES_ATT_NAME: "frames";
100
- export declare const JS_STACK_MESSAGE_ATT_NAME: "msg";
101
- export declare const ERROR_SOURCE_ATT_NAME: "err_src";
102
- export declare const CSS_CLASS_ATT_NAME: "class";
103
- export declare const SEQ_NUM_ATT_NAME: "seq_num";
104
- export declare const HELP_CODE_ATT_NAME: "hc";
105
- export declare const WORK_REQUEST_ATT_NAME: "wr";
106
- export declare const LANG_ATT_NAME: "lang";
107
- export declare const SCRIPT_ID_ATT_NAME: "script_id";
108
- export declare const SCRIPT_INSTANCE_ID_ATT_NAME: "script_inst_id";
109
- export declare const METROPLEX_SOCKET_INSTANCE_ID_ATT_NAME: "mp_sock_inst_id";
110
- export declare const SOCKET_INSTANCE_ID_ATT_NAME: "sock_inst_id";
111
- export declare const EXP_VIDEO_LENGTH_ATT_NAME: "exp_vid_len";
112
- export declare const PV_EXP_VF_SEQ_ATT_NAME: "exp_vf_seq";
113
- export declare const PV_EXP_PART_COUNTER_ATT_NAME: "exp_pc_seq";
114
- export declare const VIDEO_CLICKS_ATT_NAME: "vid_clicks";
115
- export declare const PV_CLICKS_ATT_NAME: "pv_clicks";
116
- export declare const DID_CUT_PV_ATT_NAME: "did_cut_pv";
117
- export declare const DID_CUT_VID_ATT_NAME: "did_cut_vid";
118
- export declare const DID_START_VID_ATT_NAME: "did_start_vid";
119
- export declare const HTTP_COUNT_EXPECTED_ATT_NAME: "exp_http";
120
- export declare const ERR_COUNT_EXPECTED_ATT_NAME: "exp_err";
121
- export declare const PV_EXP_HTTP_DATA_SEQ_ATT_NAME: "exp_http_seq";
122
- export declare const PV_HTTP_PAYLOADS_COLLECTED_ATT_NAME: "http_payloads";
123
- export declare const PV_HTTP_PAYLOADS_DROPPED_OVERSIZE_ATT_NAME: "http_drop_oversize";
124
- export declare const PV_HTTP_PAYLOADS_DROPPED_TYPE_ATT_NAME: "http_drop_type";
125
- export declare const PV_HTTP_REQUESTS_DROPPED_OVER_LIMIT: "http_over_limit";
126
- export declare const HTTP_EVENT_TYPE: "http";
127
- export declare const JS_EVENT_TYPE: "js";
128
- export declare const GQL_EVENT_TYPE: "gql";
129
- export declare const USERSTEP_EVENT_TYPE: "userstep";
130
- export declare const CLICK_EVENT_TYPE: "click";
131
- export declare const KEYBOARD_EVENT_TYPE: "kbd";
132
- export declare const ERROR_EVENT_TYPE: "err";
133
- export declare const PAGE_EVENT_TYPE: "page";
134
- export declare const APP_NAVIGATION_EVENT_TYPE = "app_nav";
135
- export declare const PAGE_VISIT_INFORMATION_ATT_NAME: "pvi";
136
- export declare const PAGE_VISIT_PART_ATT_NAME: "pvp";
137
- export declare const PAGE_VISIT_VID_FRAG_ATT_NAME: "pvvf";
138
- export declare const PAGE_VISIT_META_DATA_ATT_NAME: "pvm";
139
- export declare const PAGE_VISIT_HTTP_DATA_ATT_NAME: "pvh";
140
- export declare const VIDEO_PART_COUNT_ATT_NAME: "vpnum";
141
- export declare const CSS_SEQ_SENT: "seq_sent";
142
- export declare const CSS_RECEIVED: "received";
143
- export declare const MAX_BEACON_PAYLOAD_SIZE: 59000;
144
- export declare const MAX_RETRY_MSG_Q_SIZE = 500;
145
- export declare const MAX_METROPLEX_CONNECTION_COUNT: 100;
146
- export declare const NOIBU_INPUT_URLS: string[];
147
- export declare const METROPLEX_FRAG_ROUTE: "pv_part";
148
- export declare const METROPLEX_ERROR_ROUTE: "collect_error";
149
- export declare const METROPLEX_METRICS_ROUTE: "metrics";
150
- export declare const METROPLEX_FULL_PV_ROUTE: "pv";
151
- export declare const STOP_STORING_VID_SOCKET_MESSAGE: "vid_block";
152
- export declare const STOP_STORING_PV_SOCKET_MESSAGE: "pv_block";
153
- export declare const BLOCK_SOCKET_MESSAGE: "full_block";
154
- export declare const CLOSE_CONNECTION_FORCEFULLY: "close_conn";
155
- export declare const OK_SOCKET_MESSAGE: "ok";
156
- export declare const XML_HTTP_REQUEST_ERROR_TYPE: "XMLHttpRequest";
157
- export declare const ERROR_EVENT_ERROR_TYPE: "ErrorEvent";
158
- export declare const ERROR_EVENT_UNHANDLED_REJECTION_TYPE: "UnhandledRejectionError";
159
- export declare const EVENT_ERROR_TYPE: "Event";
160
- export declare const RESPONSE_ERROR_TYPE: "Response";
161
- export declare const GQL_ERROR_TYPE: "GQLError";
162
- export declare const WRAPPED_EXCEPTION_ERROR_TYPE: "WrappedException";
163
- export declare const FETCH_EXCEPTION_ERROR_TYPE: "FetchException";
164
- export declare const ERROR_LOG_EVENT_ERROR_TYPE: "ErrorLogEvent";
165
- export declare const CUSTOM_ERROR_EVENT_TYPE: "CustomError";
166
- export declare const CONSOLE_FUNCTION_OVERRIDES: readonly ["error", "warn", "log"];
167
- export declare const PAGE_EVENTS_WINDOW: string[];
168
- export declare const PAGE_EVENTS_DOCUMENT: string[];
169
- export declare const CONTENT_TYPE: "content-type";
170
- export declare const CONTENT_LENGTH: "content-length";
171
- /**
172
- *
173
- * frequency of video posts to metroplex
174
- */
175
- export declare function VIDEO_POST_FREQUENCY(): string | 10000;
176
- /**
177
- *
178
- * frequency of pv posts to metroplex
179
- */
180
- export declare function PV_POST_FREQUENCY(): string | 10000;
181
- /**
182
- *
183
- * Gets the script id from the cookie object, returns default if cannot be found
184
- */
185
- export declare function GET_SCRIPT_ID(): string;
186
- /**
187
- *
188
- * Checks if the script version is beta
189
- */
190
- export declare function IS_NJS_VERSION_BETA(): boolean;
191
- /**
192
- *
193
- * Gets the max metro recon number
194
- */
195
- export declare function GET_MAX_METROPLEX_RECONNECTION_NUMBER(): number;
196
- /**
197
- *
198
- * Returns the amount of time in milliseconds to delay a new connection by
199
- * if we have exceeded the max consecutive connection count
200
- */
201
- export declare function GET_METROPLEX_CONSECUTIVE_CONNECTION_DELAY(): number;
202
- /**
203
- *
204
- * gets the max page visit size buffer
205
- */
206
- export declare function GET_MAX_PAGEVISIT_SIZE(): string | 20000;
207
- /**
208
- *
209
- * gets the base url for metroplex's websocket connection
210
- */
211
- export declare function GET_METROPLEX_BASE_SOCKET_URL(): string;
212
- /**
213
- * gets the base url for metroplex's HTTP requests
214
- */
215
- export declare function GET_METROPLEX_BASE_HTTP_URL(): string;
216
- /**
217
- *
218
- * Returns the URL that accepts http post requests
219
- */
220
- export declare function GET_METROPLEX_POST_URL(): string;
221
- /**
222
- *
223
- * Returns the URL for posting metrics data to Metroplex
224
- */
225
- export declare function GET_METROPLEX_METRICS_URL(): string;
226
- /**
227
- *
228
- * gets the current env
229
- */
230
- export declare function JS_ENV(): string;
231
- /**
232
- * gets the current env
233
- */
234
- export declare function GET_DEVICE_ENV(): string;
235
- export declare const METROPLEX_RETRY_FREQUENCY: 30000;
236
- export declare const STACK_TRACE_SANITIZE_REGEXP: RegExp;
237
- export declare const BLOCKLISTED_DOMAINS: {
238
- 'input.noibu.com': boolean;
239
- 'input.staging.noibu.com': boolean;
240
- 'vf.noibu.com': boolean;
241
- 'vf.staging.noibu.com': boolean;
242
- 'cdn.noibu.com': boolean;
243
- };
244
- export declare const MAX_RECORDER_EVENT_BUFFER = 10;
245
- export declare const MAX_TIME_FOR_RECORDER_USER_EVENTS = 2000;
246
- export declare const POST_METRICS_EVENT_NAME = "noibuPostMetrics";
247
- export declare const PAGE_CHECK_ERROR_ATT_NAME = "pagecheck_err";
248
- export declare const RESOURCE_ERROR_ATT_NAME = "res_err";
249
- export declare const GQL_EXTENSIONS_ATT_NAME = "extensions";
250
- export declare const GQL_LOCATIONS_ATT_NAME = "locations";
251
- export declare const GQL_SRC_ATT_NAME = "src";
252
- export declare const GQL_PATH_ATT_NAME = "path";
253
- export declare const GQL_LINE_ATT_NAME = "line";
254
- export declare const GQL_COLUMN_ATT_NAME = "column";
255
- export declare const GQL_MESSAGE_ATT_NAME = "message";
256
- export declare const GLOBAL_REASSIGN_ERROR_TYPE = "GlobalReassignError";
257
- export declare const PAGE_CHECK_ERROR_TYPE = "PageCheckError";
258
- export declare const IMAGE_ERROR_TYPE = "ImageError";
259
- export declare const JS_STACK_CAUSE_ATT_NAME = "cause";
260
- export declare const CUSTOM_ATTRIBUTE_TOTAL_COUNT_ATT_NAME = "cust_attr_total";
261
- export declare const CUSTOM_ATTRIBUTE_FAIL_COUNT_ATT_NAME = "cust_attr_fail";
262
- export declare const CUSTOM_ATTRIBUTE_KEY_COUNT_ATT_NAME = "cust_attr_key";
263
- export declare const OTHER_METRICS_ATT_NAME = "omm";
264
- export declare const OTHER_METRICS_KEYS: {
265
- readonly STORAGE_FULL: "sf";
266
- readonly STORAGE_UNAVAILABLE: "su";
267
- readonly STORAGE_UNAVAILABLE_SECURITY_ERROR: "suse";
268
- };
269
- export declare const BODY_USED_ERROR = "Response data unavailable due to an improperly wrapped fetch call";
270
- export declare const MAX_HTTP_DATA_IF_ERROR_EVENT_COUNT = 120;
271
- export declare const MAX_SUCCESS_HTTP_DATA_PAYLOAD_LENGTH = 65536;
272
- export declare const LOCATION_EVENT_TYPE = "loc";
273
- export declare const ECOMMERCE_EVENT_TYPE = "ecommerce";
274
- export declare const NETWORK_STATS_EVENT_TYPE = "network";
275
- export declare const TITLE_EVENT_TYPE = "title";
276
- export declare const PAGE_TYPE_EVENT_TYPE = "page_type";
277
- export declare const HTTP_DATA_COLLECTION_FLAG_NAME = "http_data_collection";
278
- export declare const HTTP_DATA_PAYLOAD_URL_REGEXES_FLAG_NAME = "http_re";
279
- export declare const HELP_CODE_EVENT_NAME = "noibuHelpCode";
280
- export declare const ATTRIBUTE_SELECTORS_ATT_NAME = "att_sel";
281
- export declare const WIN_NJS_VERSION_ATT_NAME = "njs_version";
282
- export declare const WIN_SCRIPT_ID_ATT_NAME = "scriptID";
283
- export declare const WIN_BLOCKED_SELECTOR_ATT_NAME = "sel";
284
- export declare const DISABLED_STATUS_KEY = "DisabledStatus";
285
- export declare const CLIENT_UNLOCK_TIME_KEY = "ClientUnlockTime";
286
- export declare const BROWSER_ID_KEY = "BrowserId";
287
- export declare const CURRENT_PAGE_VISIT_COUNT_KEY = "CurrentPageVisitCount";
288
- export declare const PAGE_VISIT_ID_KEY = "pvId";
289
- export declare const LAST_ACTIVE_TIME_KEY = "LastActive";
290
- export declare const HELP_CODE_HASH_PARAM_NAME = "#helpcode";
@@ -1,5 +0,0 @@
1
- import { CustomerConfig } from '../../types/Config';
2
- /**
3
- * initilializes the script to start executing all of NJS features
4
- */
5
- export default function globalInit(customerConfig: CustomerConfig): Promise<void>;