@newrelic/browser-agent 1.238.0 → 1.239.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/common/config/state/init.js +21 -13
- package/dist/cjs/common/config/state/runtime.js +0 -4
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/constants/runtime.js +3 -3
- package/dist/cjs/common/constants/shared-channel.js +3 -1
- package/dist/cjs/common/deny-list/deny-list.js +2 -8
- package/dist/cjs/common/drain/drain.js +1 -1
- package/dist/cjs/common/event-emitter/contextual-ee.js +6 -6
- package/dist/cjs/common/harvest/harvest-scheduler.js +2 -4
- package/dist/cjs/common/harvest/harvest.js +2 -6
- package/dist/cjs/common/serialize/bel-serializer.js +1 -1
- package/dist/cjs/common/session/session-entity.js +16 -12
- package/dist/cjs/common/storage/first-party-cookies.js +5 -4
- package/dist/cjs/common/storage/local-storage.js +3 -2
- package/dist/cjs/common/timer/interaction-timer.js +14 -6
- package/dist/cjs/common/timing/nav-timing.js +1 -1
- package/dist/cjs/common/unload/eol.js +4 -30
- package/dist/cjs/common/util/feature-flags.js +14 -15
- package/dist/cjs/common/util/invoke.js +3 -1
- package/dist/cjs/common/util/obfuscate.js +3 -5
- package/dist/cjs/common/util/traverse.js +1 -0
- package/dist/cjs/common/window/page-visibility.js +1 -2
- package/dist/cjs/common/wrap/wrap-jsonp.js +1 -1
- package/dist/cjs/features/ajax/aggregate/index.js +5 -7
- package/dist/cjs/features/ajax/instrument/distributed-tracing.js +8 -8
- package/dist/cjs/features/ajax/instrument/index.js +47 -15
- package/dist/cjs/features/jserrors/aggregate/canonical-function-name.js +0 -1
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.js +4 -4
- package/dist/cjs/features/jserrors/aggregate/index.js +4 -5
- package/dist/cjs/features/metrics/aggregate/framework-detection.js +103 -7
- package/dist/cjs/features/metrics/aggregate/index.js +20 -37
- package/dist/cjs/features/metrics/instrument/index.js +0 -2
- package/dist/cjs/features/page_action/aggregate/index.js +17 -19
- package/dist/cjs/features/page_view_event/aggregate/index.js +1 -2
- package/dist/cjs/features/page_view_event/instrument/index.js +4 -2
- package/dist/cjs/features/page_view_timing/aggregate/index.js +6 -7
- package/dist/cjs/features/session_replay/aggregate/index.js +3 -3
- package/dist/cjs/features/session_trace/aggregate/index.js +8 -8
- package/dist/cjs/features/spa/aggregate/index.js +14 -20
- package/dist/cjs/features/spa/aggregate/interaction.js +0 -2
- package/dist/cjs/features/spa/aggregate/serializer.js +1 -1
- package/dist/cjs/features/utils/aggregate-base.js +4 -0
- package/dist/cjs/features/utils/handler-cache.js +3 -1
- package/dist/cjs/features/utils/instrument-base.js +24 -6
- package/dist/cjs/loaders/agent-base.js +11 -0
- package/dist/cjs/loaders/agent.js +7 -7
- package/dist/cjs/loaders/api/api.js +21 -4
- package/dist/cjs/loaders/api/apiAsync.js +19 -20
- package/dist/cjs/loaders/configure/configure.js +3 -0
- package/dist/cjs/loaders/micro-agent.js +20 -3
- package/dist/esm/common/config/state/init.js +21 -13
- package/dist/esm/common/config/state/runtime.js +0 -4
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/common/constants/runtime.js +1 -1
- package/dist/esm/common/constants/shared-channel.js +3 -1
- package/dist/esm/common/deny-list/deny-list.js +2 -8
- package/dist/esm/common/drain/drain.js +1 -1
- package/dist/esm/common/event-emitter/contextual-ee.js +6 -6
- package/dist/esm/common/harvest/harvest-scheduler.js +2 -4
- package/dist/esm/common/harvest/harvest.js +2 -6
- package/dist/esm/common/serialize/bel-serializer.js +1 -1
- package/dist/esm/common/session/session-entity.js +16 -12
- package/dist/esm/common/storage/first-party-cookies.js +5 -4
- package/dist/esm/common/storage/local-storage.js +3 -2
- package/dist/esm/common/timer/interaction-timer.js +14 -6
- package/dist/esm/common/timing/nav-timing.js +1 -1
- package/dist/esm/common/unload/eol.js +5 -31
- package/dist/esm/common/util/feature-flags.js +14 -15
- package/dist/esm/common/util/invoke.js +3 -1
- package/dist/esm/common/util/obfuscate.js +3 -5
- package/dist/esm/common/util/traverse.js +1 -0
- package/dist/esm/common/window/page-visibility.js +1 -2
- package/dist/esm/common/wrap/wrap-jsonp.js +1 -1
- package/dist/esm/features/ajax/aggregate/index.js +5 -7
- package/dist/esm/features/ajax/instrument/distributed-tracing.js +8 -8
- package/dist/esm/features/ajax/instrument/index.js +47 -15
- package/dist/esm/features/jserrors/aggregate/canonical-function-name.js +0 -1
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.js +4 -4
- package/dist/esm/features/jserrors/aggregate/index.js +4 -5
- package/dist/esm/features/metrics/aggregate/framework-detection.js +103 -7
- package/dist/esm/features/metrics/aggregate/index.js +22 -39
- package/dist/esm/features/metrics/instrument/index.js +1 -3
- package/dist/esm/features/page_action/aggregate/index.js +17 -19
- package/dist/esm/features/page_view_event/aggregate/index.js +1 -2
- package/dist/esm/features/page_view_event/instrument/index.js +4 -2
- package/dist/esm/features/page_view_timing/aggregate/index.js +7 -8
- package/dist/esm/features/session_replay/aggregate/index.js +2 -2
- package/dist/esm/features/session_trace/aggregate/index.js +8 -8
- package/dist/esm/features/spa/aggregate/index.js +14 -20
- package/dist/esm/features/spa/aggregate/interaction.js +0 -2
- package/dist/esm/features/spa/aggregate/serializer.js +1 -1
- package/dist/esm/features/utils/aggregate-base.js +4 -0
- package/dist/esm/features/utils/handler-cache.js +3 -1
- package/dist/esm/features/utils/instrument-base.js +24 -6
- package/dist/esm/loaders/agent-base.js +11 -0
- package/dist/esm/loaders/agent.js +7 -7
- package/dist/esm/loaders/api/api.js +21 -4
- package/dist/esm/loaders/api/apiAsync.js +19 -20
- package/dist/esm/loaders/configure/configure.js +3 -0
- package/dist/esm/loaders/features/enabled-features.js +1 -1
- package/dist/esm/loaders/micro-agent.js +21 -4
- package/dist/types/common/config/state/init.d.ts.map +1 -1
- package/dist/types/common/config/state/runtime.d.ts.map +1 -1
- package/dist/types/common/constants/runtime.d.ts +1 -1
- package/dist/types/common/constants/runtime.d.ts.map +1 -1
- package/dist/types/common/harvest/harvest-scheduler.d.ts.map +1 -1
- package/dist/types/common/harvest/harvest.d.ts.map +1 -1
- package/dist/types/common/session/session-entity.d.ts +6 -9
- package/dist/types/common/session/session-entity.d.ts.map +1 -1
- package/dist/types/common/storage/first-party-cookies.d.ts +1 -1
- package/dist/types/common/storage/first-party-cookies.d.ts.map +1 -1
- package/dist/types/common/storage/local-storage.d.ts.map +1 -1
- package/dist/types/common/timer/interaction-timer.d.ts +3 -0
- package/dist/types/common/timer/interaction-timer.d.ts.map +1 -1
- package/dist/types/common/unload/eol.d.ts +1 -2
- package/dist/types/common/unload/eol.d.ts.map +1 -1
- package/dist/types/common/util/feature-flags.d.ts.map +1 -1
- package/dist/types/common/util/obfuscate.d.ts.map +1 -1
- package/dist/types/common/util/traverse.d.ts.map +1 -1
- package/dist/types/common/window/page-visibility.d.ts.map +1 -1
- package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/ajax/instrument/index.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/canonical-function-name.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts +1 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/framework-detection.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/metrics/instrument/index.d.ts.map +1 -1
- package/dist/types/features/page_action/aggregate/index.d.ts +2 -2
- package/dist/types/features/page_action/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/spa/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/spa/aggregate/interaction.d.ts.map +1 -1
- package/dist/types/features/utils/aggregate-base.d.ts +1 -0
- package/dist/types/features/utils/aggregate-base.d.ts.map +1 -1
- package/dist/types/features/utils/handler-cache.d.ts.map +1 -1
- package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
- package/dist/types/loaders/agent-base.d.ts +6 -0
- package/dist/types/loaders/agent-base.d.ts.map +1 -1
- package/dist/types/loaders/agent.d.ts +1 -1
- package/dist/types/loaders/agent.d.ts.map +1 -1
- package/dist/types/loaders/api/api.d.ts +1 -0
- package/dist/types/loaders/api/api.d.ts.map +1 -1
- package/dist/types/loaders/api/apiAsync.d.ts.map +1 -1
- package/dist/types/loaders/configure/configure.d.ts +1 -0
- package/dist/types/loaders/configure/configure.d.ts.map +1 -1
- package/dist/types/loaders/micro-agent.d.ts +7 -1
- package/dist/types/loaders/micro-agent.d.ts.map +1 -1
- package/package.json +41 -12
- package/src/common/aggregate/aggregator.test.js +107 -0
- package/src/common/config/state/configurable.test.js +73 -0
- package/src/common/config/state/info.test.js +31 -0
- package/src/common/config/state/init.js +13 -12
- package/src/common/config/state/init.test.js +28 -0
- package/src/common/config/state/loader-config.test.js +21 -0
- package/src/common/config/state/runtime.js +0 -2
- package/src/common/config/state/runtime.test.js +21 -0
- package/src/common/constants/__mocks__/runtime.js +1 -1
- package/src/common/constants/runtime.js +1 -1
- package/src/common/constants/runtime.test.js +2 -2
- package/src/common/constants/shared-channel.js +1 -1
- package/src/common/deny-list/deny-list.js +2 -10
- package/src/common/drain/drain.js +1 -1
- package/src/common/drain/drain.test.js +74 -0
- package/src/common/event-emitter/contextual-ee.js +6 -6
- package/src/common/harvest/harvest-scheduler.js +2 -5
- package/src/common/harvest/harvest-scheduler.test.js +2 -6
- package/src/common/harvest/harvest.js +2 -6
- package/src/common/harvest/harvest.test.js +0 -2
- package/src/common/ids/id.test.js +6 -6
- package/src/common/serialize/bel-serializer.js +1 -1
- package/src/common/session/session-entity.component-test.js +3 -2
- package/src/common/session/session-entity.js +11 -9
- package/src/common/storage/first-party-cookies.js +5 -4
- package/src/common/storage/local-storage.js +3 -2
- package/src/common/timer/interaction-timer.component-test.js +52 -7
- package/src/common/timer/interaction-timer.js +15 -6
- package/src/common/timer/timer.test.js +0 -1
- package/src/common/timing/nav-timing.js +1 -1
- package/src/common/unload/eol.js +5 -31
- package/src/common/url/encode.test.js +1 -0
- package/src/common/util/__mocks__/invoke.js +1 -0
- package/src/common/util/data-size.test.js +0 -1
- package/src/common/util/feature-flags.js +15 -17
- package/src/common/util/feature-flags.test.js +4 -8
- package/src/common/util/invoke.js +1 -1
- package/src/common/util/obfuscate.js +3 -5
- package/src/common/util/submit-data.test.js +1 -1
- package/src/common/util/traverse.js +1 -0
- package/src/common/window/__mocks__/nreum.js +3 -1
- package/src/common/window/page-visibility.js +1 -2
- package/src/common/wrap/wrap-jsonp.js +1 -1
- package/src/features/ajax/aggregate/index.js +5 -7
- package/src/features/ajax/instrument/distributed-tracing.js +8 -8
- package/src/features/ajax/instrument/index.js +40 -17
- package/src/features/jserrors/aggregate/canonical-function-name.js +0 -2
- package/src/features/jserrors/aggregate/compute-stack-trace.js +4 -4
- package/src/features/jserrors/aggregate/compute-stack-trace.test.js +1 -1
- package/src/features/jserrors/aggregate/index.js +4 -5
- package/src/features/metrics/aggregate/framework-detection.js +129 -8
- package/src/features/metrics/aggregate/framework-detection.test.js +213 -82
- package/src/features/metrics/aggregate/index.js +22 -45
- package/src/features/metrics/instrument/index.js +1 -3
- package/src/features/page_action/aggregate/index.js +12 -13
- package/src/features/page_view_event/aggregate/index.js +1 -2
- package/src/features/page_view_event/instrument/index.js +2 -2
- package/src/features/page_view_timing/aggregate/index.js +7 -8
- package/src/features/session_replay/aggregate/index.component-test.js +3 -15
- package/src/features/session_replay/aggregate/index.js +2 -2
- package/src/features/session_trace/aggregate/index.js +6 -9
- package/src/features/spa/aggregate/index.js +14 -20
- package/src/features/spa/aggregate/interaction.js +0 -2
- package/src/features/spa/aggregate/serializer.js +1 -1
- package/src/features/utils/aggregate-base.js +5 -0
- package/src/features/utils/aggregate-base.test.js +2 -1
- package/src/features/utils/handler-cache.js +3 -2
- package/src/features/utils/instrument-base.js +25 -6
- package/src/features/utils/instrument-base.test.js +2 -2
- package/src/loaders/agent-base.js +11 -0
- package/src/loaders/agent.js +7 -7
- package/src/loaders/api/api.js +21 -4
- package/src/loaders/api/api.test.js +85 -0
- package/src/loaders/api/apiAsync.js +19 -20
- package/src/loaders/api/apiAsync.test.js +17 -0
- package/src/loaders/configure/configure.js +3 -0
- package/src/loaders/features/enabled-features.js +1 -1
- package/src/loaders/micro-agent.js +22 -4
- package/dist/cjs/features/metrics/aggregate/endpoint-map.js +0 -14
- package/dist/cjs/features/metrics/aggregate/polyfill-detection.es5.js +0 -14
- package/dist/cjs/features/metrics/aggregate/polyfill-detection.js +0 -53
- package/dist/esm/features/metrics/aggregate/endpoint-map.js +0 -7
- package/dist/esm/features/metrics/aggregate/polyfill-detection.es5.js +0 -8
- package/dist/esm/features/metrics/aggregate/polyfill-detection.js +0 -47
- package/dist/types/features/metrics/aggregate/endpoint-map.d.ts +0 -8
- package/dist/types/features/metrics/aggregate/endpoint-map.d.ts.map +0 -1
- package/dist/types/features/metrics/aggregate/polyfill-detection.d.ts +0 -6
- package/dist/types/features/metrics/aggregate/polyfill-detection.d.ts.map +0 -1
- package/dist/types/features/metrics/aggregate/polyfill-detection.es5.d.ts +0 -7
- package/dist/types/features/metrics/aggregate/polyfill-detection.es5.d.ts.map +0 -1
- package/src/features/metrics/aggregate/endpoint-map.js +0 -7
- package/src/features/metrics/aggregate/polyfill-detection.es5.js +0 -8
- package/src/features/metrics/aggregate/polyfill-detection.es5.test.js +0 -16
- package/src/features/metrics/aggregate/polyfill-detection.js +0 -48
- package/src/features/metrics/aggregate/polyfill-detection.test.js +0 -163
|
@@ -17,8 +17,6 @@ const model = () => {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
return {
|
|
20
|
-
allow_bfcache: true,
|
|
21
|
-
// *cli - temporary feature flag for BFCache work
|
|
22
20
|
privacy: {
|
|
23
21
|
cookies_enabled: true
|
|
24
22
|
},
|
|
@@ -27,7 +25,8 @@ const model = () => {
|
|
|
27
25
|
deny_list: undefined,
|
|
28
26
|
block_internal: true,
|
|
29
27
|
enabled: true,
|
|
30
|
-
harvestTimeSeconds: 10
|
|
28
|
+
harvestTimeSeconds: 10,
|
|
29
|
+
autoStart: true
|
|
31
30
|
},
|
|
32
31
|
distributed_tracing: {
|
|
33
32
|
enabled: undefined,
|
|
@@ -46,32 +45,39 @@ const model = () => {
|
|
|
46
45
|
obfuscate: undefined,
|
|
47
46
|
jserrors: {
|
|
48
47
|
enabled: true,
|
|
49
|
-
harvestTimeSeconds: 10
|
|
48
|
+
harvestTimeSeconds: 10,
|
|
49
|
+
autoStart: true
|
|
50
50
|
},
|
|
51
51
|
metrics: {
|
|
52
|
-
enabled: true
|
|
52
|
+
enabled: true,
|
|
53
|
+
autoStart: true
|
|
53
54
|
},
|
|
54
55
|
page_action: {
|
|
55
56
|
enabled: true,
|
|
56
|
-
harvestTimeSeconds: 30
|
|
57
|
+
harvestTimeSeconds: 30,
|
|
58
|
+
autoStart: true
|
|
57
59
|
},
|
|
58
60
|
page_view_event: {
|
|
59
|
-
enabled: true
|
|
61
|
+
enabled: true,
|
|
62
|
+
autoStart: true
|
|
60
63
|
},
|
|
61
64
|
page_view_timing: {
|
|
62
65
|
enabled: true,
|
|
63
66
|
harvestTimeSeconds: 30,
|
|
64
|
-
long_task: false
|
|
67
|
+
long_task: false,
|
|
68
|
+
autoStart: true
|
|
65
69
|
},
|
|
66
70
|
session_trace: {
|
|
67
71
|
enabled: true,
|
|
68
|
-
harvestTimeSeconds: 10
|
|
72
|
+
harvestTimeSeconds: 10,
|
|
73
|
+
autoStart: true
|
|
69
74
|
},
|
|
70
75
|
harvest: {
|
|
71
76
|
tooManyRequestsDelay: 60
|
|
72
77
|
},
|
|
73
78
|
session_replay: {
|
|
74
79
|
// feature settings
|
|
80
|
+
autoStart: true,
|
|
75
81
|
enabled: false,
|
|
76
82
|
harvestTimeSeconds: 60,
|
|
77
83
|
sampleRate: 0.1,
|
|
@@ -110,23 +116,25 @@ const model = () => {
|
|
|
110
116
|
},
|
|
111
117
|
spa: {
|
|
112
118
|
enabled: true,
|
|
113
|
-
harvestTimeSeconds: 10
|
|
119
|
+
harvestTimeSeconds: 10,
|
|
120
|
+
autoStart: true
|
|
114
121
|
}
|
|
115
122
|
};
|
|
116
123
|
};
|
|
117
124
|
const _cache = {};
|
|
125
|
+
const missingAgentIdError = 'All configuration objects require an agent identifier!';
|
|
118
126
|
function getConfiguration(id) {
|
|
119
|
-
if (!id) throw new Error(
|
|
127
|
+
if (!id) throw new Error(missingAgentIdError);
|
|
120
128
|
if (!_cache[id]) throw new Error("Configuration for ".concat(id, " was never set"));
|
|
121
129
|
return _cache[id];
|
|
122
130
|
}
|
|
123
131
|
function setConfiguration(id, obj) {
|
|
124
|
-
if (!id) throw new Error(
|
|
132
|
+
if (!id) throw new Error(missingAgentIdError);
|
|
125
133
|
_cache[id] = (0, _configurable.getModeledObject)(obj, model());
|
|
126
134
|
(0, _nreum.gosNREUMInitializedAgents)(id, _cache[id], 'config');
|
|
127
135
|
}
|
|
128
136
|
function getConfigurationValue(id, path) {
|
|
129
|
-
if (!id) throw new Error(
|
|
137
|
+
if (!id) throw new Error(missingAgentIdError);
|
|
130
138
|
var val = getConfiguration(id);
|
|
131
139
|
if (val) {
|
|
132
140
|
var parts = path.split('.');
|
|
@@ -11,10 +11,6 @@ var _runtime = require("../../constants/runtime");
|
|
|
11
11
|
var _env = require("../../constants/env.npm");
|
|
12
12
|
const model = {
|
|
13
13
|
buildEnv: _env.BUILD_ENV,
|
|
14
|
-
bytesSent: {},
|
|
15
|
-
// Used for SM to capture body bytes sent per endpoint
|
|
16
|
-
queryBytesSent: {},
|
|
17
|
-
// Used for SM to capture query parameter bytes sent per endpoint
|
|
18
14
|
customTransaction: undefined,
|
|
19
15
|
disabled: false,
|
|
20
16
|
distMethod: _env.DIST_METHOD,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.supportsSendBeacon = exports.isiOS = exports.isWorkerScope = exports.isIE = exports.isBrowserScope = exports.initialLocation = exports.
|
|
6
|
+
exports.supportsSendBeacon = exports.isiOS = exports.isWorkerScope = exports.isIE = exports.isBrowserScope = exports.initialLocation = exports.iOSBelow16 = exports.globalScope = exports.ffVersion = void 0;
|
|
7
7
|
/**
|
|
8
8
|
* @file Contains constants about the environment the agent is running
|
|
9
9
|
* within. These values are derived at the time the agent is first loaded.
|
|
@@ -36,8 +36,8 @@ const isiOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
|
|
|
36
36
|
* This was fixed in v16+.
|
|
37
37
|
*/
|
|
38
38
|
exports.isiOS = isiOS;
|
|
39
|
-
const
|
|
40
|
-
exports.
|
|
39
|
+
const iOSBelow16 = isiOS && typeof SharedWorker === 'undefined';
|
|
40
|
+
exports.iOSBelow16 = iOSBelow16;
|
|
41
41
|
const ffVersion = (() => {
|
|
42
42
|
const match = navigator.userAgent.match(/Firefox[/\s](\d+\.\d+)/);
|
|
43
43
|
if (Array.isArray(match) && match.length >= 2) {
|
|
@@ -11,7 +11,9 @@ exports.sharedChannel = void 0;
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
let onReplayReady;
|
|
14
|
-
const sessionReplayInitialized = new Promise(resolve =>
|
|
14
|
+
const sessionReplayInitialized = new Promise(resolve => {
|
|
15
|
+
onReplayReady = resolve;
|
|
16
|
+
});
|
|
15
17
|
const sharedChannel = Object.freeze({
|
|
16
18
|
onReplayReady,
|
|
17
19
|
sessionReplayInitialized
|
|
@@ -81,10 +81,7 @@ function domainMatchesPattern(pattern, domain) {
|
|
|
81
81
|
if (pattern.length > domain.length) {
|
|
82
82
|
return false;
|
|
83
83
|
}
|
|
84
|
-
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
return false;
|
|
84
|
+
return domain.indexOf(pattern) === domain.length - pattern.length;
|
|
88
85
|
}
|
|
89
86
|
|
|
90
87
|
/**
|
|
@@ -105,8 +102,5 @@ function comparePath(pattern, path) {
|
|
|
105
102
|
if (pattern === '') {
|
|
106
103
|
return true;
|
|
107
104
|
}
|
|
108
|
-
|
|
109
|
-
return true;
|
|
110
|
-
}
|
|
111
|
-
return false;
|
|
105
|
+
return pattern === path;
|
|
112
106
|
}
|
|
@@ -55,7 +55,6 @@ function drain() {
|
|
|
55
55
|
let agentIdentifier = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
56
56
|
let featureName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'feature';
|
|
57
57
|
curateRegistry(agentIdentifier);
|
|
58
|
-
|
|
59
58
|
// If the feature for the specified agent is not in the registry, that means the instrument file was bypassed.
|
|
60
59
|
// This could happen in tests, or loaders that directly import the aggregator. In these cases it is safe to
|
|
61
60
|
// drain the feature group immediately rather than waiting to drain all at once.
|
|
@@ -74,6 +73,7 @@ function drain() {
|
|
|
74
73
|
items.sort((a, b) => a[1].priority - b[1].priority);
|
|
75
74
|
items.forEach(_ref2 => {
|
|
76
75
|
let [group] = _ref2;
|
|
76
|
+
registry[agentIdentifier].delete(group);
|
|
77
77
|
drainGroup(group);
|
|
78
78
|
});
|
|
79
79
|
}
|
|
@@ -44,16 +44,16 @@ function ee(old, debugId) {
|
|
|
44
44
|
}
|
|
45
45
|
var emitter = {
|
|
46
46
|
on: addEventListener,
|
|
47
|
-
addEventListener
|
|
48
|
-
removeEventListener
|
|
49
|
-
emit
|
|
47
|
+
addEventListener,
|
|
48
|
+
removeEventListener,
|
|
49
|
+
emit,
|
|
50
50
|
get: getOrCreate,
|
|
51
|
-
listeners
|
|
52
|
-
context
|
|
51
|
+
listeners,
|
|
52
|
+
context,
|
|
53
53
|
buffer: bufferEventsByGroup,
|
|
54
54
|
abort,
|
|
55
55
|
aborted: false,
|
|
56
|
-
isBuffering
|
|
56
|
+
isBuffering,
|
|
57
57
|
debugId,
|
|
58
58
|
backlog: isolatedBacklog ? {} : old && typeof old.backlog === 'object' ? old.backlog : {}
|
|
59
59
|
};
|
|
@@ -8,7 +8,6 @@ var submitData = _interopRequireWildcard(require("../util/submit-data"));
|
|
|
8
8
|
var _sharedContext = require("../context/shared-context");
|
|
9
9
|
var _harvest = require("./harvest");
|
|
10
10
|
var _eol = require("../unload/eol");
|
|
11
|
-
var _config = require("../config/config");
|
|
12
11
|
var _sessionEntity = require("../session/session-entity");
|
|
13
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -43,7 +42,7 @@ class HarvestScheduler extends _sharedContext.SharedContext {
|
|
|
43
42
|
this.harvest = new _harvest.Harvest(this.sharedContext);
|
|
44
43
|
|
|
45
44
|
// unload if EOL mechanism fires
|
|
46
|
-
(0, _eol.subscribeToEOL)(this.unload.bind(this)
|
|
45
|
+
(0, _eol.subscribeToEOL)(this.unload.bind(this));
|
|
47
46
|
|
|
48
47
|
/* Flush all buffered data if session resets and give up retries. This should be synchronous to ensure that the correct `session` value is sent.
|
|
49
48
|
Since session-reset generates a new session ID and the ID is grabbed at send-time, any delays or retries would cause the payload to be sent under
|
|
@@ -110,7 +109,7 @@ class HarvestScheduler extends _sharedContext.SharedContext {
|
|
|
110
109
|
if (!submitMethod) return false;
|
|
111
110
|
const retry = !opts?.unload && submitMethod === submitData.xhr;
|
|
112
111
|
payload = this.opts.getPayload({
|
|
113
|
-
retry
|
|
112
|
+
retry
|
|
114
113
|
});
|
|
115
114
|
if (!payload) {
|
|
116
115
|
if (this.started) {
|
|
@@ -146,7 +145,6 @@ class HarvestScheduler extends _sharedContext.SharedContext {
|
|
|
146
145
|
if (this.started) {
|
|
147
146
|
this.scheduleHarvest();
|
|
148
147
|
}
|
|
149
|
-
return;
|
|
150
148
|
}
|
|
151
149
|
onHarvestFinished(opts, result) {
|
|
152
150
|
if (this.opts.onFinished) {
|
|
@@ -131,7 +131,8 @@ class Harvest extends _sharedContext.SharedContext {
|
|
|
131
131
|
}
|
|
132
132
|
return false;
|
|
133
133
|
}
|
|
134
|
-
|
|
134
|
+
const endpointURLPart = endpoint !== 'rum' ? "/".concat(endpoint) : '';
|
|
135
|
+
let url = "".concat(this.getScheme(), "://").concat(info.errorBeacon).concat(endpointURLPart, "/1/").concat(info.licenseKey);
|
|
135
136
|
if (customUrl) url = customUrl;
|
|
136
137
|
if (raw) url = "".concat(this.getScheme(), "://").concat(info.errorBeacon, "/").concat(endpoint);
|
|
137
138
|
const baseParams = !raw && includeBaseParams ? this.baseQueryString() : '';
|
|
@@ -159,11 +160,6 @@ class Harvest extends _sharedContext.SharedContext {
|
|
|
159
160
|
// If body is null, undefined, or an empty object or array, send an empty string instead
|
|
160
161
|
body = '';
|
|
161
162
|
}
|
|
162
|
-
|
|
163
|
-
// Get bytes harvested per endpoint as a supportability metric. See metrics aggregator (on unload).
|
|
164
|
-
agentRuntime.bytesSent[endpoint] = (agentRuntime.bytesSent[endpoint] || 0) + body?.length || 0;
|
|
165
|
-
// Get query bytes harvested per endpoint as a supportability metric. See metrics aggregator (on unload).
|
|
166
|
-
agentRuntime.queryBytesSent[endpoint] = (agentRuntime.queryBytesSent[endpoint] || 0) + fullUrl.split('?').slice(-1)[0]?.length || 0;
|
|
167
163
|
const headers = [];
|
|
168
164
|
headers.push({
|
|
169
165
|
key: 'content-type',
|
|
@@ -34,7 +34,7 @@ function getAddStringContext(agentIdentifier) {
|
|
|
34
34
|
function addString(str) {
|
|
35
35
|
if (typeof str === 'undefined' || str === '') return '';
|
|
36
36
|
var obfuscator = new _obfuscate.Obfuscator({
|
|
37
|
-
agentIdentifier
|
|
37
|
+
agentIdentifier
|
|
38
38
|
});
|
|
39
39
|
str = String(str);
|
|
40
40
|
if (obfuscator.shouldObfuscate()) str = obfuscator.obfuscateString(str);
|
|
@@ -48,33 +48,37 @@ class SessionEntity {
|
|
|
48
48
|
* expiresMs and inactiveMs are used to "expire" the session, but can be overridden in the constructor. Pass 0 to disable expiration timers.
|
|
49
49
|
*/
|
|
50
50
|
constructor(opts) {
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
setup(_ref) {
|
|
54
|
-
let {
|
|
51
|
+
const {
|
|
55
52
|
agentIdentifier,
|
|
56
53
|
key,
|
|
57
|
-
storage
|
|
58
|
-
|
|
59
|
-
expiresMs = _constants.DEFAULT_EXPIRES_MS,
|
|
60
|
-
inactiveMs = _constants.DEFAULT_INACTIVE_MS
|
|
61
|
-
} = _ref;
|
|
54
|
+
storage
|
|
55
|
+
} = opts;
|
|
62
56
|
if (!agentIdentifier || !key || !storage) {
|
|
63
57
|
throw new Error("Missing required field(s):".concat(!agentIdentifier ? ' agentID' : '').concat(!key ? ' key' : '').concat(!storage ? ' storage' : ''));
|
|
64
58
|
}
|
|
65
59
|
this.agentIdentifier = agentIdentifier;
|
|
66
60
|
this.storage = storage;
|
|
67
61
|
this.state = {};
|
|
68
|
-
this.sync(model);
|
|
69
62
|
|
|
70
63
|
// key is intended to act as the k=v pair
|
|
71
64
|
this.key = key;
|
|
65
|
+
this.ee = _contextualEe.ee.get(agentIdentifier);
|
|
66
|
+
(0, _wrap.wrapEvents)(this.ee);
|
|
67
|
+
this.setup(opts);
|
|
68
|
+
}
|
|
69
|
+
setup(_ref) {
|
|
70
|
+
let {
|
|
71
|
+
value = (0, _uniqueId.generateRandomHexString)(16),
|
|
72
|
+
expiresMs = _constants.DEFAULT_EXPIRES_MS,
|
|
73
|
+
inactiveMs = _constants.DEFAULT_INACTIVE_MS
|
|
74
|
+
} = _ref;
|
|
75
|
+
this.state = {};
|
|
76
|
+
this.sync(model);
|
|
77
|
+
|
|
72
78
|
// value is intended to act as the primary value of the k=v pair
|
|
73
79
|
this.state.value = value;
|
|
74
80
|
this.expiresMs = expiresMs;
|
|
75
81
|
this.inactiveMs = inactiveMs;
|
|
76
|
-
this.ee = _contextualEe.ee.get(agentIdentifier);
|
|
77
|
-
(0, _wrap.wrapEvents)(this.ee);
|
|
78
82
|
|
|
79
83
|
// the first time the session entity class is instantiated, we check the storage API for an existing
|
|
80
84
|
// object. If it exists, the values inside the object are used to inform the timers that run locally.
|
|
@@ -13,22 +13,23 @@ class FirstPartyCookies {
|
|
|
13
13
|
var match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)'));
|
|
14
14
|
if (match) return match[2];
|
|
15
15
|
} catch (err) {
|
|
16
|
+
// Error is ignored
|
|
16
17
|
return '';
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
set(key, value) {
|
|
20
21
|
try {
|
|
21
|
-
const cookie = "".concat(key, "=").concat(value, "; Domain=").concat(domain, "; Path=/");
|
|
22
|
+
const cookie = "".concat(key, "=").concat(value, "; Domain=").concat(this.domain, "; Path=/");
|
|
22
23
|
document.cookie = cookie;
|
|
23
24
|
} catch (err) {
|
|
24
|
-
|
|
25
|
+
// Error is ignored
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
remove(key) {
|
|
28
29
|
try {
|
|
29
|
-
|
|
30
|
+
document.cookie = "".concat(key, "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; Domain=").concat(this.domain, "; Path=/");
|
|
30
31
|
} catch (err) {
|
|
31
|
-
|
|
32
|
+
// Error is ignored
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
}
|
|
@@ -11,6 +11,7 @@ class LocalStorage {
|
|
|
11
11
|
// Cast it back to undefined if it doesnt exist
|
|
12
12
|
return localStorage.getItem(key) || undefined;
|
|
13
13
|
} catch (err) {
|
|
14
|
+
// Error is ignored
|
|
14
15
|
return '';
|
|
15
16
|
}
|
|
16
17
|
}
|
|
@@ -19,14 +20,14 @@ class LocalStorage {
|
|
|
19
20
|
if (value === undefined || value === null) return this.remove(key);
|
|
20
21
|
return localStorage.setItem(key, value);
|
|
21
22
|
} catch (err) {
|
|
22
|
-
|
|
23
|
+
// Error is ignored
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
remove(key) {
|
|
26
27
|
try {
|
|
27
28
|
localStorage.removeItem(key);
|
|
28
29
|
} catch (err) {
|
|
29
|
-
|
|
30
|
+
// Error is ignored
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
}
|
|
@@ -27,14 +27,16 @@ class InteractionTimer extends _timer.Timer {
|
|
|
27
27
|
}
|
|
28
28
|
if (_runtime.isBrowserScope && opts.ee) {
|
|
29
29
|
if (opts.ee) {
|
|
30
|
+
this.ee = opts.ee;
|
|
30
31
|
const debouncedRefresh = (0, _invoke.debounce)(this.refresh.bind(this), 500, {
|
|
31
32
|
leading: true
|
|
32
33
|
});
|
|
33
|
-
|
|
34
|
+
this.refreshHandler = evts => {
|
|
34
35
|
if (opts.refreshEvents.includes(evts?.[0]?.type)) {
|
|
35
36
|
debouncedRefresh();
|
|
36
37
|
}
|
|
37
|
-
}
|
|
38
|
+
};
|
|
39
|
+
opts.ee.on('fn-end', this.refreshHandler);
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
// watch for the vis state changing. If the page is hidden, the local inactivity timer should be paused
|
|
@@ -48,22 +50,28 @@ class InteractionTimer extends _timer.Timer {
|
|
|
48
50
|
(0, _pageVisibility.subscribeToVisibilityChange)(state => {
|
|
49
51
|
if (state === 'hidden') this.pause();
|
|
50
52
|
// vis change --> visible is treated like a new interaction with the page
|
|
51
|
-
else
|
|
52
|
-
this.refresh();
|
|
53
|
-
this.onResume(); // emit resume event after state updated
|
|
54
|
-
}
|
|
53
|
+
else this.resume();
|
|
55
54
|
}, false, false, this.abortController?.signal);
|
|
56
55
|
}
|
|
57
56
|
}
|
|
58
57
|
abort() {
|
|
59
58
|
this.clear();
|
|
60
59
|
this.abortController?.abort();
|
|
60
|
+
if (this.refreshHandler) {
|
|
61
|
+
this.ee.removeEventListener('fn-end', this.refreshHandler);
|
|
62
|
+
this.refreshHandler = this.ee = null;
|
|
63
|
+
}
|
|
61
64
|
}
|
|
62
65
|
pause() {
|
|
63
66
|
this.onPause();
|
|
64
67
|
clearTimeout(this.timer);
|
|
65
68
|
this.remainingMs = this.initialMs - (Date.now() - this.startTimestamp);
|
|
66
69
|
}
|
|
70
|
+
resume() {
|
|
71
|
+
this.refresh();
|
|
72
|
+
this.onResume(); // emit resume event after state updated
|
|
73
|
+
}
|
|
74
|
+
|
|
67
75
|
refresh(cb, ms) {
|
|
68
76
|
this.clear();
|
|
69
77
|
this.timer = this.create(cb, ms);
|
|
@@ -35,7 +35,7 @@ var DOM_CONTENT_LOAD_EVENT = 'domContentLoadedEvent';
|
|
|
35
35
|
var navTimingValues = [];
|
|
36
36
|
exports.navTimingValues = navTimingValues;
|
|
37
37
|
function getPntType(type) {
|
|
38
|
-
if (typeof type
|
|
38
|
+
if (typeof type === 'number') return type;
|
|
39
39
|
const types = {
|
|
40
40
|
navigate: undefined,
|
|
41
41
|
reload: 1,
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.subscribeToEOL = subscribeToEOL;
|
|
7
7
|
var _eventListenerOpts = require("../event-listener/event-listener-opts");
|
|
8
|
-
var _invoke = require("../util/invoke");
|
|
9
8
|
var _runtime = require("../constants/runtime");
|
|
10
9
|
var _pageVisibility = require("../window/page-visibility");
|
|
11
10
|
/*
|
|
@@ -30,37 +29,12 @@ if (_runtime.isWorkerScope) {
|
|
|
30
29
|
* Subscribes a provided callback to the time/event when the agent should treat it as end-of-life.
|
|
31
30
|
* This is used, for example, to submit a final harvest and send all remaining data on best-effort.
|
|
32
31
|
* @param {function} cb - func to run before or during the last reliable event or time of an env's life span
|
|
33
|
-
* @param {boolean} allowBFCache - (temp) feature flag to gate new v1222 BFC support
|
|
34
32
|
*/
|
|
35
|
-
function subscribeToEOL(cb
|
|
33
|
+
function subscribeToEOL(cb) {
|
|
36
34
|
if (_runtime.isBrowserScope) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
// --this ought to be removed once support for version below 14.5 phases out
|
|
41
|
-
} else {
|
|
42
|
-
var oneCall = (0, _invoke.single)(cb);
|
|
43
|
-
|
|
44
|
-
// Firefox has a bug wherein a slow-loading resource loaded from the 'pagehide'
|
|
45
|
-
// or 'unload' event will delay the 'load' event firing on the next page load.
|
|
46
|
-
// In Firefox versions that support sendBeacon, this doesn't matter, because
|
|
47
|
-
// we'll use it instead of an image load for our final harvest.
|
|
48
|
-
//
|
|
49
|
-
// Some Safari versions never fire the 'unload' event for pages that are being
|
|
50
|
-
// put into the WebKit page cache, so we *need* to use the pagehide event for
|
|
51
|
-
// the final submission from Safari.
|
|
52
|
-
//
|
|
53
|
-
// Generally speaking, we will try to submit our final harvest from either
|
|
54
|
-
// pagehide or unload, whichever comes first, but in Firefox, we need to avoid
|
|
55
|
-
// attempting to submit from pagehide to ensure that we don't slow down loading
|
|
56
|
-
// of the next page.
|
|
57
|
-
if (!_runtime.ffVersion || navigator.sendBeacon) {
|
|
58
|
-
(0, _eventListenerOpts.windowAddEventListener)('pagehide', oneCall);
|
|
59
|
-
} else {
|
|
60
|
-
(0, _eventListenerOpts.windowAddEventListener)('beforeunload', oneCall);
|
|
61
|
-
}
|
|
62
|
-
(0, _eventListenerOpts.windowAddEventListener)('unload', oneCall);
|
|
63
|
-
}
|
|
35
|
+
(0, _pageVisibility.subscribeToVisibilityChange)(cb, true); // when user switches tab or hides window, esp. mobile scenario
|
|
36
|
+
(0, _eventListenerOpts.windowAddEventListener)('pagehide', cb); // when user navigates away, and because safari iOS v14.4- doesn't fully support vis change
|
|
37
|
+
// --this ought to be removed once support for version below 14.5 phases out
|
|
64
38
|
} else if (_runtime.isWorkerScope) {
|
|
65
39
|
_runtime.globalScope.cleanupTasks.push(cb); // close() should run these tasks before quitting thread
|
|
66
40
|
}
|
|
@@ -7,7 +7,6 @@ exports.activateFeatures = activateFeatures;
|
|
|
7
7
|
exports.activatedFeatures = void 0;
|
|
8
8
|
var _contextualEe = require("../event-emitter/contextual-ee");
|
|
9
9
|
var _handle = require("../event-emitter/handle");
|
|
10
|
-
var _drain = require("../drain/drain");
|
|
11
10
|
var _features = require("../../loaders/features/features");
|
|
12
11
|
/*
|
|
13
12
|
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
@@ -21,24 +20,24 @@ const bucketMap = {
|
|
|
21
20
|
spa: [_features.FEATURE_NAMES.spa],
|
|
22
21
|
sr: [_features.FEATURE_NAMES.sessionReplay, _features.FEATURE_NAMES.sessionTrace]
|
|
23
22
|
};
|
|
23
|
+
const sentIds = new Set();
|
|
24
24
|
|
|
25
25
|
/** Note that this function only processes each unique flag ONCE, with the first occurrence of each flag and numeric value determining its switch on/off setting. */
|
|
26
26
|
function activateFeatures(flags, agentIdentifier) {
|
|
27
27
|
const sharedEE = _contextualEe.ee.get(agentIdentifier);
|
|
28
28
|
if (!(flags && typeof flags === 'object')) return;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
});
|
|
29
|
+
if (!sentIds.has(agentIdentifier)) {
|
|
30
|
+
Object.entries(flags).forEach(_ref => {
|
|
31
|
+
let [flag, num] = _ref;
|
|
32
|
+
if (bucketMap[flag]) {
|
|
33
|
+
bucketMap[flag].forEach(feat => {
|
|
34
|
+
if (!num) (0, _handle.handle)('block-' + flag, [], undefined, feat, sharedEE);else (0, _handle.handle)('feat-' + flag, [], undefined, feat, sharedEE);
|
|
35
|
+
(0, _handle.handle)('rumresp-' + flag, [Boolean(num)], undefined, feat, sharedEE); // this is a duplicate of feat-/block- but makes awaiting for 1 event easier than 2
|
|
36
|
+
});
|
|
37
|
+
} else if (num) (0, _handle.handle)('feat-' + flag, [], undefined, undefined, sharedEE); // not sure what other flags are overlooked, but there's a test for ones not in the map --
|
|
38
|
+
activatedFeatures[flag] = Boolean(num);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
42
41
|
|
|
43
42
|
// Let the features waiting on their respective flags know that RUM response was received and that any missing flags are interpreted as bad entitlement / "off".
|
|
44
43
|
// Hence, those features will not be hanging forever if their flags aren't included in the response.
|
|
@@ -48,7 +47,7 @@ function activateFeatures(flags, agentIdentifier) {
|
|
|
48
47
|
activatedFeatures[flag] = false;
|
|
49
48
|
}
|
|
50
49
|
});
|
|
51
|
-
|
|
50
|
+
sentIds.add(agentIdentifier);
|
|
52
51
|
}
|
|
53
52
|
const activatedFeatures = {};
|
|
54
53
|
exports.activatedFeatures = activatedFeatures;
|
|
@@ -39,7 +39,9 @@ function debounce(func) {
|
|
|
39
39
|
}
|
|
40
40
|
if (leading && timer === undefined) {
|
|
41
41
|
func.apply(_this, args);
|
|
42
|
-
timer = setTimeout(() =>
|
|
42
|
+
timer = setTimeout(() => {
|
|
43
|
+
timer = clearTimeout(timer);
|
|
44
|
+
}, timeout);
|
|
43
45
|
}
|
|
44
46
|
if (!leading) {
|
|
45
47
|
clearTimeout(timer);
|
|
@@ -61,11 +61,9 @@ function validateRules(rules) {
|
|
|
61
61
|
invalidRegexDetected = true;
|
|
62
62
|
}
|
|
63
63
|
var replacement = rules[i].replacement;
|
|
64
|
-
if (replacement) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
invalidReplacementDetected = true;
|
|
68
|
-
}
|
|
64
|
+
if (replacement && typeof replacement !== 'string') {
|
|
65
|
+
(0, _console.warn)('An obfuscation replacement rule contains a "replacement" value with an invalid type (must be a string)');
|
|
66
|
+
invalidReplacementDetected = true;
|
|
69
67
|
}
|
|
70
68
|
}
|
|
71
69
|
return !invalidReplacementDetected && !invalidRegexDetected;
|
|
@@ -26,6 +26,7 @@ function applyFnToProps(obj, fn) {
|
|
|
26
26
|
if (typeof obj[property] === 'object') {
|
|
27
27
|
applyFnToProps(obj[property], fn, type, ignoreKeys);
|
|
28
28
|
} else {
|
|
29
|
+
// eslint-disable-next-line valid-typeof
|
|
29
30
|
if (typeof obj[property] === type && !ignoreKeys.includes(property)) obj[property] = fn(obj[property]);
|
|
30
31
|
}
|
|
31
32
|
});
|
|
@@ -20,11 +20,10 @@ function subscribeToVisibilityChange(cb) {
|
|
|
20
20
|
let capture = arguments.length > 2 ? arguments[2] : undefined;
|
|
21
21
|
let abortSignal = arguments.length > 3 ? arguments[3] : undefined;
|
|
22
22
|
(0, _eventListenerOpts.documentAddEventListener)('visibilitychange', handleVisibilityChange, capture, abortSignal);
|
|
23
|
-
return;
|
|
24
23
|
function handleVisibilityChange() {
|
|
25
24
|
if (toHiddenOnly) {
|
|
26
25
|
// trigger cb on change to hidden state only
|
|
27
|
-
if (document.visibilityState
|
|
26
|
+
if (document.visibilityState === 'hidden') cb();
|
|
28
27
|
return;
|
|
29
28
|
}
|
|
30
29
|
cb(document.visibilityState);
|