@newrelic/browser-agent 1.232.1 → 1.233.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/cdn/experimental.js +27 -0
- package/dist/cjs/cdn/polyfills.js +5 -2
- package/dist/cjs/common/config/state/configurable.js +15 -26
- package/dist/cjs/common/config/state/info.js +1 -1
- package/dist/cjs/common/config/state/init.js +101 -56
- package/dist/cjs/common/config/state/loader-config.js +1 -1
- package/dist/cjs/common/config/state/runtime.js +1 -5
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/drain/drain.js +1 -1
- package/dist/cjs/common/harvest/harvest-scheduler.js +43 -8
- package/dist/cjs/common/harvest/harvest-scheduler.test.js +39 -0
- package/dist/cjs/common/harvest/harvest.js +106 -55
- package/dist/cjs/common/session/session-entity.js +35 -22
- package/dist/cjs/common/session/session-entity.test.js +73 -49
- package/dist/cjs/common/timer/interaction-timer.js +9 -12
- package/dist/cjs/common/url/protocol.test.js +0 -1
- package/dist/cjs/common/util/feature-flags.js +2 -1
- package/dist/cjs/common/util/submit-data.js +57 -18
- package/dist/cjs/common/wrap/wrap-fetch.js +1 -1
- package/dist/cjs/common/wrap/wrap-function.js +1 -1
- package/dist/cjs/common/wrap/wrap-promise.js +1 -1
- package/dist/cjs/features/ajax/aggregate/index.js +2 -2
- package/dist/cjs/features/jserrors/aggregate/index.js +7 -5
- package/dist/cjs/features/metrics/aggregate/framework-detection.js +67 -0
- package/dist/cjs/features/metrics/aggregate/framework-detection.test.js +137 -0
- package/dist/cjs/features/metrics/aggregate/index.js +7 -3
- package/dist/cjs/features/metrics/aggregate/polyfill-detection.es5.js +14 -0
- package/dist/cjs/features/metrics/aggregate/polyfill-detection.es5.test.js +17 -0
- package/dist/cjs/features/metrics/aggregate/polyfill-detection.js +53 -0
- package/dist/cjs/features/metrics/aggregate/polyfill-detection.test.js +165 -0
- package/dist/cjs/features/page_action/aggregate/index.js +2 -2
- package/dist/cjs/features/page_view_event/aggregate/index.js +6 -3
- package/dist/cjs/features/page_view_timing/aggregate/index.js +2 -2
- package/dist/cjs/features/session_replay/aggregate/index.js +336 -0
- package/dist/cjs/features/session_replay/constants.js +9 -0
- package/dist/cjs/features/session_replay/index.js +12 -0
- package/dist/cjs/features/session_replay/instrument/index.js +29 -0
- package/dist/cjs/features/session_trace/aggregate/index.js +163 -162
- package/dist/cjs/features/session_trace/constants.js +2 -9
- package/dist/cjs/features/session_trace/instrument/index.js +24 -66
- package/dist/cjs/features/spa/aggregate/index.js +2 -2
- package/dist/cjs/features/utils/agent-session.js +1 -2
- package/dist/cjs/features/utils/aggregate-base.js +64 -0
- package/dist/cjs/features/utils/feature-base.js +0 -31
- package/dist/cjs/features/utils/handler-cache.js +3 -4
- package/dist/cjs/features/utils/instrument-base.js +42 -10
- package/dist/cjs/features/utils/{lazy-loader.js → lazy-feature-loader.js} +4 -2
- package/dist/cjs/loaders/agent.js +1 -1
- package/dist/cjs/loaders/api/apiAsync.js +3 -1
- package/dist/cjs/loaders/configure/configure.js +3 -3
- package/dist/cjs/loaders/features/featureDependencies.js +0 -12
- package/dist/cjs/loaders/features/features.js +3 -1
- package/dist/cjs/loaders/micro-agent.js +6 -6
- package/dist/esm/cdn/experimental.js +24 -0
- package/dist/esm/cdn/polyfills.js +5 -2
- package/dist/esm/common/config/state/configurable.js +14 -24
- package/dist/esm/common/config/state/info.js +2 -2
- package/dist/esm/common/config/state/init.js +102 -57
- package/dist/esm/common/config/state/loader-config.js +2 -2
- package/dist/esm/common/config/state/runtime.js +2 -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/drain/drain.js +1 -1
- package/dist/esm/common/harvest/harvest-scheduler.js +43 -8
- package/dist/esm/common/harvest/harvest-scheduler.test.js +37 -0
- package/dist/esm/common/harvest/harvest.js +108 -56
- package/dist/esm/common/session/session-entity.js +35 -22
- package/dist/esm/common/session/session-entity.test.js +73 -49
- package/dist/esm/common/timer/interaction-timer.js +9 -12
- package/dist/esm/common/url/protocol.test.js +0 -1
- package/dist/esm/common/util/feature-flags.js +2 -1
- package/dist/esm/common/util/submit-data.js +57 -18
- package/dist/esm/common/wrap/wrap-fetch.js +1 -1
- package/dist/esm/common/wrap/wrap-function.js +1 -1
- package/dist/esm/common/wrap/wrap-promise.js +1 -1
- package/dist/esm/features/ajax/aggregate/index.js +2 -2
- package/dist/esm/features/jserrors/aggregate/index.js +7 -5
- package/dist/esm/features/metrics/aggregate/framework-detection.js +61 -0
- package/dist/esm/features/metrics/aggregate/framework-detection.test.js +133 -0
- package/dist/esm/features/metrics/aggregate/index.js +7 -3
- package/dist/esm/features/metrics/aggregate/polyfill-detection.es5.js +8 -0
- package/dist/esm/features/metrics/aggregate/polyfill-detection.es5.test.js +15 -0
- package/dist/esm/features/metrics/aggregate/polyfill-detection.js +47 -0
- package/dist/esm/features/metrics/aggregate/polyfill-detection.test.js +163 -0
- package/dist/esm/features/page_action/aggregate/index.js +2 -2
- package/dist/esm/features/page_view_event/aggregate/index.js +6 -3
- package/dist/esm/features/page_view_timing/aggregate/index.js +2 -2
- package/dist/esm/features/session_replay/aggregate/index.js +330 -0
- package/dist/esm/features/session_replay/constants.js +2 -0
- package/dist/esm/features/session_replay/index.js +12 -0
- package/dist/esm/features/session_replay/instrument/index.js +21 -0
- package/dist/esm/features/session_trace/aggregate/index.js +163 -162
- package/dist/esm/features/session_trace/constants.js +1 -5
- package/dist/esm/features/session_trace/instrument/index.js +24 -66
- package/dist/esm/features/spa/aggregate/index.js +2 -2
- package/dist/esm/features/utils/agent-session.js +1 -2
- package/dist/esm/features/utils/aggregate-base.js +57 -0
- package/dist/esm/features/utils/feature-base.js +1 -32
- package/dist/esm/features/utils/handler-cache.js +3 -4
- package/dist/esm/features/utils/instrument-base.js +42 -10
- package/dist/esm/features/utils/{lazy-loader.js → lazy-feature-loader.js} +3 -1
- package/dist/esm/loaders/agent.js +1 -1
- package/dist/esm/loaders/api/apiAsync.js +3 -1
- package/dist/esm/loaders/configure/configure.js +3 -3
- package/dist/esm/loaders/features/featureDependencies.js +0 -11
- package/dist/esm/loaders/features/features.js +3 -1
- package/dist/esm/loaders/micro-agent.js +6 -6
- package/dist/types/cdn/experimental.d.ts +2 -0
- package/dist/types/cdn/experimental.d.ts.map +1 -0
- package/dist/types/common/config/state/configurable.d.ts +1 -3
- package/dist/types/common/config/state/configurable.d.ts.map +1 -1
- 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/harvest/harvest-scheduler.d.ts +26 -3
- package/dist/types/common/harvest/harvest-scheduler.d.ts.map +1 -1
- package/dist/types/common/harvest/harvest.d.ts +37 -34
- package/dist/types/common/harvest/harvest.d.ts.map +1 -1
- package/dist/types/common/session/session-entity.d.ts +6 -3
- package/dist/types/common/session/session-entity.d.ts.map +1 -1
- package/dist/types/common/timer/interaction-timer.d.ts +2 -1
- package/dist/types/common/timer/interaction-timer.d.ts.map +1 -1
- package/dist/types/common/util/feature-flags.d.ts.map +1 -1
- package/dist/types/common/util/submit-data.d.ts +40 -14
- package/dist/types/common/util/submit-data.d.ts.map +1 -1
- package/dist/types/features/ajax/aggregate/index.d.ts +2 -2
- package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts +2 -2
- package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/framework-detection.d.ts.map +1 -0
- package/dist/types/features/metrics/aggregate/index.d.ts +2 -2
- package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/polyfill-detection.d.ts +6 -0
- package/dist/types/features/metrics/aggregate/polyfill-detection.d.ts.map +1 -0
- package/dist/types/features/metrics/aggregate/polyfill-detection.es5.d.ts +7 -0
- package/dist/types/features/metrics/aggregate/polyfill-detection.es5.d.ts.map +1 -0
- 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 +2 -2
- 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 +2 -2
- package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/aggregate/index.d.ts +100 -0
- package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/session_replay/constants.d.ts +2 -0
- package/dist/types/features/session_replay/constants.d.ts.map +1 -0
- package/dist/types/features/session_replay/index.d.ts +2 -0
- package/dist/types/features/session_replay/index.d.ts.map +1 -0
- package/dist/types/features/session_replay/instrument/index.d.ts +6 -0
- package/dist/types/features/session_replay/instrument/index.d.ts.map +1 -0
- package/dist/types/features/session_trace/aggregate/index.d.ts +8 -57
- package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_trace/constants.d.ts +0 -3
- package/dist/types/features/session_trace/constants.d.ts.map +1 -1
- package/dist/types/features/session_trace/instrument/index.d.ts +1 -3
- package/dist/types/features/session_trace/instrument/index.d.ts.map +1 -1
- package/dist/types/features/spa/aggregate/index.d.ts +2 -2
- package/dist/types/features/spa/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/utils/agent-session.d.ts.map +1 -1
- package/dist/types/features/utils/aggregate-base.d.ts +11 -0
- package/dist/types/features/utils/aggregate-base.d.ts.map +1 -0
- package/dist/types/features/utils/feature-base.d.ts +0 -5
- package/dist/types/features/utils/feature-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 +3 -1
- package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
- package/dist/types/features/utils/{lazy-loader.d.ts → lazy-feature-loader.d.ts} +2 -2
- package/dist/types/features/utils/lazy-feature-loader.d.ts.map +1 -0
- package/dist/types/loaders/configure/configure.d.ts.map +1 -1
- package/dist/types/loaders/features/featureDependencies.d.ts +0 -1
- package/dist/types/loaders/features/featureDependencies.d.ts.map +1 -1
- package/dist/types/loaders/features/features.d.ts +1 -0
- package/dist/types/loaders/features/features.d.ts.map +1 -1
- package/package.json +30 -20
- package/src/cdn/experimental.js +36 -0
- package/src/cdn/polyfills.js +4 -1
- package/src/common/config/state/configurable.js +18 -24
- package/src/common/config/state/info.js +2 -2
- package/src/common/config/state/init.js +62 -28
- package/src/common/config/state/loader-config.js +2 -2
- package/src/common/config/state/runtime.js +2 -4
- package/src/common/drain/drain.js +1 -1
- package/src/common/harvest/harvest-scheduler.js +48 -8
- package/src/common/harvest/harvest-scheduler.test.js +25 -0
- package/src/common/harvest/harvest.js +72 -50
- package/src/common/session/session-entity.js +34 -23
- package/src/common/session/session-entity.test.js +57 -51
- package/src/common/timer/interaction-timer.js +9 -12
- package/src/common/url/protocol.test.js +0 -1
- package/src/common/util/feature-flags.js +2 -2
- package/src/common/util/submit-data.js +28 -17
- package/src/common/wrap/wrap-fetch.js +1 -1
- package/src/common/wrap/wrap-function.js +1 -1
- package/src/common/wrap/wrap-promise.js +1 -1
- package/src/features/ajax/aggregate/index.js +2 -2
- package/src/features/jserrors/aggregate/index.js +7 -5
- package/src/features/metrics/aggregate/framework-detection.js +73 -0
- package/src/features/metrics/aggregate/framework-detection.test.js +201 -0
- package/src/features/metrics/aggregate/index.js +8 -3
- package/src/features/metrics/aggregate/polyfill-detection.es5.js +9 -0
- package/src/features/metrics/aggregate/polyfill-detection.es5.test.js +16 -0
- package/src/features/metrics/aggregate/polyfill-detection.js +48 -0
- package/src/features/metrics/aggregate/polyfill-detection.test.js +163 -0
- package/src/features/page_action/aggregate/index.js +2 -2
- package/src/features/page_view_event/aggregate/index.js +5 -5
- package/src/features/page_view_timing/aggregate/index.js +2 -2
- package/src/features/session_replay/aggregate/index.js +319 -0
- package/src/features/session_replay/constants.js +3 -0
- package/src/features/session_replay/index.js +12 -0
- package/src/features/session_replay/instrument/index.js +22 -0
- package/src/features/session_trace/aggregate/index.js +148 -187
- package/src/features/session_trace/constants.js +0 -4
- package/src/features/session_trace/instrument/index.js +17 -69
- package/src/features/spa/aggregate/index.js +2 -2
- package/src/features/utils/agent-session.js +1 -2
- package/src/features/utils/aggregate-base.js +51 -0
- package/src/features/utils/feature-base.js +1 -31
- package/src/features/utils/handler-cache.js +3 -4
- package/src/features/utils/instrument-base.js +40 -8
- package/src/features/utils/{lazy-loader.js → lazy-feature-loader.js} +3 -1
- package/src/loaders/agent.js +1 -1
- package/src/loaders/api/apiAsync.js +1 -1
- package/src/loaders/configure/configure.js +4 -3
- package/src/loaders/features/featureDependencies.js +0 -12
- package/src/loaders/features/features.js +3 -1
- package/src/loaders/micro-agent.js +4 -4
- package/dist/cjs/common/metrics/framework-detection.js +0 -72
- package/dist/cjs/common/util/user-agent.js +0 -57
- package/dist/cjs/common/window/supports-performance-observer.js +0 -15
- package/dist/esm/common/metrics/framework-detection.js +0 -66
- package/dist/esm/common/util/user-agent.js +0 -48
- package/dist/esm/common/window/supports-performance-observer.js +0 -9
- package/dist/types/common/metrics/framework-detection.d.ts.map +0 -1
- package/dist/types/common/util/user-agent.d.ts +0 -5
- package/dist/types/common/util/user-agent.d.ts.map +0 -1
- package/dist/types/common/window/supports-performance-observer.d.ts +0 -2
- package/dist/types/common/window/supports-performance-observer.d.ts.map +0 -1
- package/dist/types/features/utils/lazy-loader.d.ts.map +0 -1
- package/src/common/metrics/framework-detection.js +0 -71
- package/src/common/util/user-agent.js +0 -56
- package/src/common/window/supports-performance-observer.js +0 -10
- /package/dist/types/{common/metrics → features/metrics/aggregate}/framework-detection.d.ts +0 -0
|
@@ -38,17 +38,19 @@ describe('constructor', () => {
|
|
|
38
38
|
expect(session).toMatchObject({
|
|
39
39
|
agentIdentifier: expect.any(String),
|
|
40
40
|
key: expect.any(String),
|
|
41
|
-
value: expect.any(String),
|
|
42
41
|
expiresMs: expect.any(Number),
|
|
43
|
-
expiresAt: expect.any(Number),
|
|
44
42
|
expiresTimer: expect.any(Object),
|
|
45
43
|
inactiveMs: expect.any(Number),
|
|
46
|
-
inactiveAt: expect.any(Number),
|
|
47
44
|
inactiveTimer: expect.any(Object),
|
|
48
45
|
isNew: expect.any(Boolean),
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
storage: expect.any(Object),
|
|
47
|
+
state: expect.objectContaining({
|
|
48
|
+
value: expect.any(String),
|
|
49
|
+
expiresAt: expect.any(Number),
|
|
50
|
+
inactiveAt: expect.any(Number),
|
|
51
|
+
sessionReplay: expect.any(Number),
|
|
52
|
+
sessionTraceActive: expect.any(Boolean)
|
|
53
|
+
})
|
|
52
54
|
});
|
|
53
55
|
});
|
|
54
56
|
test('can use sane defaults', () => {
|
|
@@ -56,11 +58,12 @@ describe('constructor', () => {
|
|
|
56
58
|
agentIdentifier,
|
|
57
59
|
key
|
|
58
60
|
});
|
|
59
|
-
expect(session).toEqual(expect.objectContaining({
|
|
61
|
+
expect(session.state).toEqual(expect.objectContaining({
|
|
60
62
|
value: expect.any(String),
|
|
61
63
|
expiresAt: expect.any(Number),
|
|
62
64
|
inactiveAt: expect.any(Number),
|
|
63
|
-
|
|
65
|
+
updatedAt: expect.any(Number),
|
|
66
|
+
sessionReplay: expect.any(Number),
|
|
64
67
|
sessionTraceActive: expect.any(Boolean)
|
|
65
68
|
}));
|
|
66
69
|
});
|
|
@@ -81,7 +84,7 @@ describe('constructor', () => {
|
|
|
81
84
|
key,
|
|
82
85
|
expiresMs: 100
|
|
83
86
|
});
|
|
84
|
-
expect(session.expiresAt).toEqual(now + 100);
|
|
87
|
+
expect(session.state.expiresAt).toEqual(now + 100);
|
|
85
88
|
});
|
|
86
89
|
test('expiresAt is the correct future timestamp - existing session', () => {
|
|
87
90
|
const now = Date.now();
|
|
@@ -90,7 +93,11 @@ describe('constructor', () => {
|
|
|
90
93
|
["".concat(_constants.PREFIX, "_").concat(key)]: {
|
|
91
94
|
value,
|
|
92
95
|
expiresAt: now + 5000,
|
|
93
|
-
inactiveAt: Infinity
|
|
96
|
+
inactiveAt: Infinity,
|
|
97
|
+
updatedAt: now,
|
|
98
|
+
sessionReplay: 0,
|
|
99
|
+
sessionTraceActive: false,
|
|
100
|
+
custom: {}
|
|
94
101
|
}
|
|
95
102
|
});
|
|
96
103
|
const session = new _sessionEntity.SessionEntity({
|
|
@@ -99,7 +106,7 @@ describe('constructor', () => {
|
|
|
99
106
|
expiresMs: 100,
|
|
100
107
|
storageAPI: existingData
|
|
101
108
|
});
|
|
102
|
-
expect(session.expiresAt).toEqual(now + 5000);
|
|
109
|
+
expect(session.state.expiresAt).toEqual(now + 5000);
|
|
103
110
|
});
|
|
104
111
|
test('expiresAt never expires if 0', () => {
|
|
105
112
|
const session = new _sessionEntity.SessionEntity({
|
|
@@ -107,7 +114,7 @@ describe('constructor', () => {
|
|
|
107
114
|
key,
|
|
108
115
|
expiresMs: 0
|
|
109
116
|
});
|
|
110
|
-
expect(session.expiresAt).toEqual(Infinity);
|
|
117
|
+
expect(session.state.expiresAt).toEqual(Infinity);
|
|
111
118
|
});
|
|
112
119
|
test('inactiveAt is the correct future timestamp - new session', () => {
|
|
113
120
|
const now = Date.now();
|
|
@@ -117,7 +124,7 @@ describe('constructor', () => {
|
|
|
117
124
|
key,
|
|
118
125
|
inactiveMs: 100
|
|
119
126
|
});
|
|
120
|
-
expect(session.inactiveAt).toEqual(now + 100);
|
|
127
|
+
expect(session.state.inactiveAt).toEqual(now + 100);
|
|
121
128
|
});
|
|
122
129
|
test('inactiveAt is the correct future timestamp - existing session', () => {
|
|
123
130
|
const now = Date.now();
|
|
@@ -126,7 +133,11 @@ describe('constructor', () => {
|
|
|
126
133
|
["".concat(_constants.PREFIX, "_").concat(key)]: {
|
|
127
134
|
value,
|
|
128
135
|
inactiveAt: now + 5000,
|
|
129
|
-
expiresAt: Infinity
|
|
136
|
+
expiresAt: Infinity,
|
|
137
|
+
updatedAt: now,
|
|
138
|
+
sessionReplay: 0,
|
|
139
|
+
sessionTraceActive: false,
|
|
140
|
+
custom: {}
|
|
130
141
|
}
|
|
131
142
|
});
|
|
132
143
|
const session = new _sessionEntity.SessionEntity({
|
|
@@ -135,7 +146,7 @@ describe('constructor', () => {
|
|
|
135
146
|
inactiveMs: 100,
|
|
136
147
|
storageAPI: existingData
|
|
137
148
|
});
|
|
138
|
-
expect(session.inactiveAt).toEqual(now + 5000);
|
|
149
|
+
expect(session.state.inactiveAt).toEqual(now + 5000);
|
|
139
150
|
});
|
|
140
151
|
test('inactiveAt never expires if 0', () => {
|
|
141
152
|
const session = new _sessionEntity.SessionEntity({
|
|
@@ -143,7 +154,7 @@ describe('constructor', () => {
|
|
|
143
154
|
key,
|
|
144
155
|
inactiveMs: 0
|
|
145
156
|
});
|
|
146
|
-
expect(session.inactiveAt).toEqual(Infinity);
|
|
157
|
+
expect(session.state.inactiveAt).toEqual(Infinity);
|
|
147
158
|
});
|
|
148
159
|
test('should handle isNew', () => {
|
|
149
160
|
const newSession = new _sessionEntity.SessionEntity({
|
|
@@ -156,7 +167,11 @@ describe('constructor', () => {
|
|
|
156
167
|
["".concat(_constants.PREFIX, "_").concat(key)]: {
|
|
157
168
|
value,
|
|
158
169
|
expiresAt: Infinity,
|
|
159
|
-
inactiveAt: Infinity
|
|
170
|
+
inactiveAt: Infinity,
|
|
171
|
+
updatedAt: Date.now(),
|
|
172
|
+
sessionReplay: 0,
|
|
173
|
+
sessionTraceActive: false,
|
|
174
|
+
custom: {}
|
|
160
175
|
}
|
|
161
176
|
});
|
|
162
177
|
const existingSession = new _sessionEntity.SessionEntity({
|
|
@@ -179,11 +194,12 @@ describe('constructor', () => {
|
|
|
179
194
|
key,
|
|
180
195
|
storageAPI
|
|
181
196
|
});
|
|
182
|
-
expect(session).toEqual(expect.objectContaining({
|
|
197
|
+
expect(session.state).toEqual(expect.objectContaining({
|
|
183
198
|
value: expect.any(String),
|
|
184
199
|
expiresAt: expect.any(Number),
|
|
185
200
|
inactiveAt: expect.any(Number),
|
|
186
|
-
|
|
201
|
+
updatedAt: expect.any(Number),
|
|
202
|
+
sessionReplay: expect.any(Number),
|
|
187
203
|
sessionTraceActive: expect.any(Boolean)
|
|
188
204
|
}));
|
|
189
205
|
});
|
|
@@ -202,11 +218,12 @@ describe('constructor', () => {
|
|
|
202
218
|
key,
|
|
203
219
|
storageAPI
|
|
204
220
|
});
|
|
205
|
-
expect(session).toEqual(expect.objectContaining({
|
|
221
|
+
expect(session.state).toEqual(expect.objectContaining({
|
|
206
222
|
value: expect.any(String),
|
|
207
223
|
expiresAt: expect.any(Number),
|
|
208
224
|
inactiveAt: expect.any(Number),
|
|
209
|
-
|
|
225
|
+
updatedAt: expect.any(Number),
|
|
226
|
+
sessionReplay: expect.any(Number),
|
|
210
227
|
sessionTraceActive: expect.any(Boolean)
|
|
211
228
|
}));
|
|
212
229
|
});
|
|
@@ -225,11 +242,12 @@ describe('constructor', () => {
|
|
|
225
242
|
key,
|
|
226
243
|
storageAPI
|
|
227
244
|
});
|
|
228
|
-
expect(session).toEqual(expect.objectContaining({
|
|
245
|
+
expect(session.state).toEqual(expect.objectContaining({
|
|
229
246
|
value: expect.any(String),
|
|
230
247
|
expiresAt: expect.any(Number),
|
|
231
248
|
inactiveAt: expect.any(Number),
|
|
232
|
-
|
|
249
|
+
updatedAt: expect.any(Number),
|
|
250
|
+
sessionReplay: expect.any(Number),
|
|
233
251
|
sessionTraceActive: expect.any(Boolean)
|
|
234
252
|
}));
|
|
235
253
|
});
|
|
@@ -244,10 +262,10 @@ describe('reset()', () => {
|
|
|
244
262
|
expiresMs: 10
|
|
245
263
|
});
|
|
246
264
|
const sessionVal = session.value;
|
|
247
|
-
expect(session.value).toBeTruthy();
|
|
265
|
+
expect(session.state.value).toBeTruthy();
|
|
248
266
|
session.reset();
|
|
249
|
-
expect(session.value).toBeTruthy();
|
|
250
|
-
expect(session.value).not.toEqual(sessionVal);
|
|
267
|
+
expect(session.state.value).toBeTruthy();
|
|
268
|
+
expect(session.state.value).not.toEqual(sessionVal);
|
|
251
269
|
});
|
|
252
270
|
test('custom data should be wiped on reset', () => {
|
|
253
271
|
const now = Date.now();
|
|
@@ -258,12 +276,12 @@ describe('reset()', () => {
|
|
|
258
276
|
expiresMs: 10
|
|
259
277
|
});
|
|
260
278
|
session.syncCustomAttribute('test', 123);
|
|
261
|
-
expect(session.custom.test).toEqual(123);
|
|
279
|
+
expect(session.state.custom.test).toEqual(123);
|
|
262
280
|
expect(session.read().custom.test).toEqual(123);
|
|
263
281
|
|
|
264
282
|
// simulate a timer expiring
|
|
265
283
|
session.reset();
|
|
266
|
-
expect(session.custom?.test).toEqual(undefined);
|
|
284
|
+
expect(session.state.custom?.test).toEqual(undefined);
|
|
267
285
|
expect(session.read()?.custom?.test).toEqual(undefined);
|
|
268
286
|
});
|
|
269
287
|
});
|
|
@@ -279,7 +297,7 @@ describe('read()', () => {
|
|
|
279
297
|
value: expect.any(String),
|
|
280
298
|
expiresAt: expect.any(Number),
|
|
281
299
|
inactiveAt: expect.any(Number),
|
|
282
|
-
|
|
300
|
+
sessionReplay: expect.any(Number),
|
|
283
301
|
sessionTraceActive: expect.any(Boolean)
|
|
284
302
|
}));
|
|
285
303
|
});
|
|
@@ -288,7 +306,11 @@ describe('read()', () => {
|
|
|
288
306
|
["".concat(_constants.PREFIX, "_").concat(key)]: {
|
|
289
307
|
value,
|
|
290
308
|
expiresAt: Infinity,
|
|
291
|
-
inactiveAt: Infinity
|
|
309
|
+
inactiveAt: Infinity,
|
|
310
|
+
updatedAt: Date.now(),
|
|
311
|
+
sessionReplay: 0,
|
|
312
|
+
sessionTraceActive: false,
|
|
313
|
+
custom: {}
|
|
292
314
|
}
|
|
293
315
|
});
|
|
294
316
|
const session = new _sessionEntity.SessionEntity({
|
|
@@ -310,17 +332,18 @@ describe('write()', () => {
|
|
|
310
332
|
agentIdentifier,
|
|
311
333
|
key
|
|
312
334
|
});
|
|
313
|
-
expect(session.value).not.toEqual(value);
|
|
314
|
-
expect(session.expiresAt).not.toEqual(Infinity);
|
|
315
|
-
expect(session.inactiveAt).not.toEqual(Infinity);
|
|
335
|
+
expect(session.state.value).not.toEqual(value);
|
|
336
|
+
expect(session.state.expiresAt).not.toEqual(Infinity);
|
|
337
|
+
expect(session.state.inactiveAt).not.toEqual(Infinity);
|
|
316
338
|
session.write({
|
|
339
|
+
...session.state,
|
|
317
340
|
value,
|
|
318
341
|
expiresAt: Infinity,
|
|
319
342
|
inactiveAt: Infinity
|
|
320
343
|
});
|
|
321
|
-
expect(session.value).toEqual(value);
|
|
322
|
-
expect(session.expiresAt).toEqual(Infinity);
|
|
323
|
-
expect(session.inactiveAt).toEqual(Infinity);
|
|
344
|
+
expect(session.state.value).toEqual(value);
|
|
345
|
+
expect(session.state.expiresAt).toEqual(Infinity);
|
|
346
|
+
expect(session.state.inactiveAt).toEqual(Infinity);
|
|
324
347
|
});
|
|
325
348
|
test('write() sets data that read() can access', () => {
|
|
326
349
|
const now = Date.now();
|
|
@@ -330,6 +353,7 @@ describe('write()', () => {
|
|
|
330
353
|
key
|
|
331
354
|
});
|
|
332
355
|
session.write({
|
|
356
|
+
...session.state,
|
|
333
357
|
value,
|
|
334
358
|
expiresAt: now + 100,
|
|
335
359
|
inactiveAt: now + 100
|
|
@@ -365,10 +389,10 @@ describe('refresh()', () => {
|
|
|
365
389
|
key,
|
|
366
390
|
inactiveMs: 100
|
|
367
391
|
});
|
|
368
|
-
expect(session.inactiveAt).toEqual(now + 100);
|
|
392
|
+
expect(session.state.inactiveAt).toEqual(now + 100);
|
|
369
393
|
jest.setSystemTime(now + 1000);
|
|
370
394
|
session.refresh();
|
|
371
|
-
expect(session.inactiveAt).toEqual(now + 100 + 1000);
|
|
395
|
+
expect(session.state.inactiveAt).toEqual(now + 100 + 1000);
|
|
372
396
|
});
|
|
373
397
|
test('refresh resets the entity if expiresTimer is invalid', () => {
|
|
374
398
|
const now = Date.now();
|
|
@@ -378,13 +402,13 @@ describe('refresh()', () => {
|
|
|
378
402
|
key,
|
|
379
403
|
value
|
|
380
404
|
});
|
|
381
|
-
expect(session.value).toEqual(value);
|
|
405
|
+
expect(session.state.value).toEqual(value);
|
|
382
406
|
session.write({
|
|
383
|
-
...session.
|
|
407
|
+
...session.state,
|
|
384
408
|
expiresAt: now - 1
|
|
385
409
|
});
|
|
386
410
|
session.refresh();
|
|
387
|
-
expect(session.value).not.toEqual(value);
|
|
411
|
+
expect(session.state.value).not.toEqual(value);
|
|
388
412
|
});
|
|
389
413
|
test('refresh resets the entity if inactiveTimer is invalid', () => {
|
|
390
414
|
const now = Date.now();
|
|
@@ -394,13 +418,13 @@ describe('refresh()', () => {
|
|
|
394
418
|
key,
|
|
395
419
|
value
|
|
396
420
|
});
|
|
397
|
-
expect(session.value).toEqual(value);
|
|
421
|
+
expect(session.state.value).toEqual(value);
|
|
398
422
|
session.write({
|
|
399
|
-
...session.
|
|
423
|
+
...session.state,
|
|
400
424
|
inactiveAt: now - 1
|
|
401
425
|
});
|
|
402
426
|
session.refresh();
|
|
403
|
-
expect(session.value).not.toEqual(value);
|
|
427
|
+
expect(session.state.value).not.toEqual(value);
|
|
404
428
|
});
|
|
405
429
|
});
|
|
406
430
|
describe('syncCustomAttribute()', () => {
|
|
@@ -412,17 +436,17 @@ describe('syncCustomAttribute()', () => {
|
|
|
412
436
|
|
|
413
437
|
// if custom has never been set, and a "delete" action is triggered, do nothing
|
|
414
438
|
session.syncCustomAttribute('test', null);
|
|
415
|
-
expect(session?.custom?.test).toEqual(undefined);
|
|
439
|
+
expect(session?.state?.custom?.test).toEqual(undefined);
|
|
416
440
|
session.syncCustomAttribute('test', 1);
|
|
417
|
-
expect(session?.custom?.test).toEqual(1);
|
|
441
|
+
expect(session?.state?.custom?.test).toEqual(1);
|
|
418
442
|
session.syncCustomAttribute('test', 'string');
|
|
419
|
-
expect(session?.custom?.test).toEqual('string');
|
|
443
|
+
expect(session?.state?.custom?.test).toEqual('string');
|
|
420
444
|
session.syncCustomAttribute('test', false);
|
|
421
|
-
expect(session?.custom?.test).toEqual(false);
|
|
445
|
+
expect(session?.state?.custom?.test).toEqual(false);
|
|
422
446
|
|
|
423
447
|
// null specifically deletes the object completely
|
|
424
448
|
session.syncCustomAttribute('test', null);
|
|
425
|
-
expect(session?.custom?.test).toEqual(undefined);
|
|
449
|
+
expect(session?.state?.custom?.test).toEqual(undefined);
|
|
426
450
|
});
|
|
427
451
|
test('Only runs in browser scope', () => {
|
|
428
452
|
mockBrowserScope.mockReturnValue(false);
|
|
@@ -11,8 +11,9 @@ var _globalScope = require("../util/global-scope");
|
|
|
11
11
|
class InteractionTimer extends _timer.Timer {
|
|
12
12
|
constructor(opts, ms) {
|
|
13
13
|
super(opts, ms);
|
|
14
|
-
this.
|
|
15
|
-
this.
|
|
14
|
+
this.onPause = typeof opts.onPause === 'function' ? opts.onPause : () => {/* noop */};
|
|
15
|
+
this.onRefresh = typeof opts.onRefresh === 'function' ? opts.onRefresh : () => {/* noop */};
|
|
16
|
+
this.onResume = typeof opts.onResume === 'function' ? opts.onResume : () => {/* noop */};
|
|
16
17
|
|
|
17
18
|
// used by pause/resume
|
|
18
19
|
this.remainingMs = undefined;
|
|
@@ -47,7 +48,10 @@ class InteractionTimer extends _timer.Timer {
|
|
|
47
48
|
(0, _pageVisibility.subscribeToVisibilityChange)(state => {
|
|
48
49
|
if (state === 'hidden') this.pause();
|
|
49
50
|
// vis change --> visible is treated like a new interaction with the page
|
|
50
|
-
else
|
|
51
|
+
else {
|
|
52
|
+
this.onResume();
|
|
53
|
+
this.refresh();
|
|
54
|
+
}
|
|
51
55
|
}, false, false, this.abortController?.signal);
|
|
52
56
|
}
|
|
53
57
|
}
|
|
@@ -56,7 +60,7 @@ class InteractionTimer extends _timer.Timer {
|
|
|
56
60
|
this.abortController?.abort();
|
|
57
61
|
}
|
|
58
62
|
pause() {
|
|
59
|
-
this.onPause
|
|
63
|
+
this.onPause();
|
|
60
64
|
clearTimeout(this.timer);
|
|
61
65
|
this.remainingMs = this.initialMs - (Date.now() - this.startTimestamp);
|
|
62
66
|
}
|
|
@@ -65,14 +69,7 @@ class InteractionTimer extends _timer.Timer {
|
|
|
65
69
|
this.timer = this.create(cb, ms);
|
|
66
70
|
this.startTimestamp = Date.now();
|
|
67
71
|
this.remainingMs = undefined;
|
|
68
|
-
this.onRefresh
|
|
72
|
+
this.onRefresh();
|
|
69
73
|
}
|
|
70
|
-
|
|
71
|
-
// NOT CURRENTLY UTILIZED BY ANYTHING
|
|
72
|
-
// resume () {
|
|
73
|
-
// if (!this.remainingMs || !this.isValid()) return
|
|
74
|
-
// this.timer = this.create(this.cb, this.remainingMs)
|
|
75
|
-
// this.remainingMs = undefined
|
|
76
|
-
// }
|
|
77
74
|
}
|
|
78
75
|
exports.InteractionTimer = InteractionTimer;
|
|
@@ -19,7 +19,8 @@ const bucketMap = {
|
|
|
19
19
|
stn: [_features.FEATURE_NAMES.sessionTrace],
|
|
20
20
|
err: [_features.FEATURE_NAMES.jserrors, _features.FEATURE_NAMES.metrics],
|
|
21
21
|
ins: [_features.FEATURE_NAMES.pageAction],
|
|
22
|
-
spa: [_features.FEATURE_NAMES.spa]
|
|
22
|
+
spa: [_features.FEATURE_NAMES.spa],
|
|
23
|
+
sr: [_features.FEATURE_NAMES.sessionReplay]
|
|
23
24
|
};
|
|
24
25
|
function activateFeatures(flags, agentIdentifier) {
|
|
25
26
|
var sharedEE = _contextualEe.ee.get(agentIdentifier);
|
|
@@ -14,12 +14,18 @@ const submitData = {};
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Send via JSONP. Do NOT call this function outside of a guaranteed web window environment.
|
|
17
|
-
* @param {
|
|
18
|
-
* @param {string}
|
|
17
|
+
* @param {Object} args - The args
|
|
18
|
+
* @param {string} args.url - The URL to send to
|
|
19
|
+
* @param {string} args.jsonp - The string name of the jsonp cb method
|
|
20
|
+
* @returns {XMLHttpRequest}
|
|
19
21
|
* @returns {Element}
|
|
20
22
|
*/
|
|
21
23
|
exports.submitData = submitData;
|
|
22
|
-
submitData.jsonp = function jsonp(
|
|
24
|
+
submitData.jsonp = function jsonp(_ref) {
|
|
25
|
+
let {
|
|
26
|
+
url,
|
|
27
|
+
jsonp
|
|
28
|
+
} = _ref;
|
|
23
29
|
try {
|
|
24
30
|
if (_globalScope.isWorkerScope) {
|
|
25
31
|
try {
|
|
@@ -27,7 +33,9 @@ submitData.jsonp = function jsonp(url, jsonp) {
|
|
|
27
33
|
} catch (e) {
|
|
28
34
|
// for now theres no other way to execute the callback from ingest without jsonp, or unsafe eval / new Function calls
|
|
29
35
|
// future work needs to be conducted to allow ingest to return a more traditional JSON API-like experience for the entitlement flags
|
|
30
|
-
submitData.xhrGet(
|
|
36
|
+
submitData.xhrGet({
|
|
37
|
+
url: url + '&jsonp=' + jsonp
|
|
38
|
+
});
|
|
31
39
|
return false;
|
|
32
40
|
}
|
|
33
41
|
} else {
|
|
@@ -42,19 +50,38 @@ submitData.jsonp = function jsonp(url, jsonp) {
|
|
|
42
50
|
// do nothing
|
|
43
51
|
}
|
|
44
52
|
};
|
|
45
|
-
submitData.xhrGet = function xhrGet(
|
|
46
|
-
|
|
53
|
+
submitData.xhrGet = function xhrGet(_ref2) {
|
|
54
|
+
let {
|
|
55
|
+
url
|
|
56
|
+
} = _ref2;
|
|
57
|
+
return submitData.xhr({
|
|
58
|
+
url,
|
|
59
|
+
sync: false,
|
|
60
|
+
method: 'GET'
|
|
61
|
+
});
|
|
47
62
|
};
|
|
48
63
|
|
|
49
64
|
/**
|
|
50
65
|
* Send via XHR
|
|
51
|
-
* @param {
|
|
52
|
-
* @param {string}
|
|
53
|
-
* @param {
|
|
66
|
+
* @param {Object} args - The args
|
|
67
|
+
* @param {string} args.url - The URL to send to
|
|
68
|
+
* @param {string=} args.body - The Stringified body
|
|
69
|
+
* @param {boolean=} args.sync - Run XHR as Synchronous
|
|
70
|
+
* @param {string=} [args.method=POST] - The XHR method to use
|
|
71
|
+
* @param {{key: string, value: string}[]} [args.headers] - The headers to attach
|
|
54
72
|
* @returns {XMLHttpRequest}
|
|
55
73
|
*/
|
|
56
|
-
submitData.xhr = function xhr(
|
|
57
|
-
let
|
|
74
|
+
submitData.xhr = function xhr(_ref3) {
|
|
75
|
+
let {
|
|
76
|
+
url,
|
|
77
|
+
body,
|
|
78
|
+
sync,
|
|
79
|
+
method = 'POST',
|
|
80
|
+
headers = [{
|
|
81
|
+
key: 'content-type',
|
|
82
|
+
value: 'text/plain'
|
|
83
|
+
}]
|
|
84
|
+
} = _ref3;
|
|
58
85
|
var request = new XMLHttpRequest();
|
|
59
86
|
request.open(method, url, !sync);
|
|
60
87
|
try {
|
|
@@ -63,7 +90,9 @@ submitData.xhr = function xhr(url, body, sync) {
|
|
|
63
90
|
} catch (e) {
|
|
64
91
|
// do nothing
|
|
65
92
|
}
|
|
66
|
-
|
|
93
|
+
headers.forEach(header => {
|
|
94
|
+
request.setRequestHeader(header.key, header.value);
|
|
95
|
+
});
|
|
67
96
|
request.send(body);
|
|
68
97
|
return request;
|
|
69
98
|
};
|
|
@@ -77,10 +106,15 @@ submitData.xhr = function xhr(url, body, sync) {
|
|
|
77
106
|
|
|
78
107
|
/**
|
|
79
108
|
* Send by appending an <img> element to the page. Do NOT call this function outside of a guaranteed web window environment.
|
|
80
|
-
* @param {
|
|
81
|
-
* @
|
|
109
|
+
* @param {Object} args - The args
|
|
110
|
+
* @param {string} args.url - The URL to send to
|
|
111
|
+
* @returns {HTMLImageElement}
|
|
82
112
|
*/
|
|
83
|
-
submitData.img = function img(
|
|
113
|
+
submitData.img = function img(_ref4) {
|
|
114
|
+
let {
|
|
115
|
+
url
|
|
116
|
+
} = _ref4;
|
|
117
|
+
console.log('img url', url);
|
|
84
118
|
var element = new Image();
|
|
85
119
|
element.src = url;
|
|
86
120
|
return element;
|
|
@@ -88,11 +122,16 @@ submitData.img = function img(url) {
|
|
|
88
122
|
|
|
89
123
|
/**
|
|
90
124
|
* Send via sendBeacon. Do NOT call this function outside of a guaranteed web window environment.
|
|
91
|
-
* @param {
|
|
92
|
-
* @param {string}
|
|
125
|
+
* @param {Object} args - The args
|
|
126
|
+
* @param {string} args.url - The URL to send to
|
|
127
|
+
* @param {string=} args.body - The Stringified body
|
|
93
128
|
* @returns {boolean}
|
|
94
129
|
*/
|
|
95
|
-
submitData.beacon = function (
|
|
130
|
+
submitData.beacon = function (_ref5) {
|
|
131
|
+
let {
|
|
132
|
+
url,
|
|
133
|
+
body
|
|
134
|
+
} = _ref5;
|
|
96
135
|
// Navigator has to be bound to ensure it does not error in some browsers
|
|
97
136
|
// https://xgwang.me/posts/you-may-not-know-beacon/#it-may-throw-error%2C-be-sure-to-catch
|
|
98
137
|
const send = window.navigator.sendBeacon.bind(window.navigator);
|
|
@@ -75,7 +75,7 @@ function wrapFetch(sharedEE) {
|
|
|
75
75
|
var fn = target[name];
|
|
76
76
|
if (typeof fn === 'function') {
|
|
77
77
|
target[name] = function () {
|
|
78
|
-
var args =
|
|
78
|
+
var args = [...arguments];
|
|
79
79
|
var ctx = {};
|
|
80
80
|
// we are wrapping args in an array so we can preserve the reference
|
|
81
81
|
ee.emit(prefix + 'before-start', [args], ctx);
|
|
@@ -76,7 +76,7 @@ function wrapPromise(sharedEE) {
|
|
|
76
76
|
WrappedPromise[method] = function (subPromises) {
|
|
77
77
|
// use our own wrapped version of "Promise.all" and ".race" static fns
|
|
78
78
|
let finalized = false;
|
|
79
|
-
|
|
79
|
+
[...(subPromises || [])].forEach(sub => {
|
|
80
80
|
this.resolve(sub).then(setNrId(method === 'all'), setNrId(false));
|
|
81
81
|
});
|
|
82
82
|
const origFnCallWithThis = prevStaticFn.apply(this, arguments);
|
|
@@ -15,13 +15,13 @@ var _constants = require("../constants");
|
|
|
15
15
|
var _drain = require("../../../common/drain/drain");
|
|
16
16
|
var _features = require("../../../loaders/features/features");
|
|
17
17
|
var _constants2 = require("../../metrics/constants");
|
|
18
|
-
var
|
|
18
|
+
var _aggregateBase = require("../../utils/aggregate-base");
|
|
19
19
|
/*
|
|
20
20
|
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
21
21
|
* SPDX-License-Identifier: Apache-2.0
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
class Aggregate extends
|
|
24
|
+
class Aggregate extends _aggregateBase.AggregateBase {
|
|
25
25
|
static featureName = _constants.FEATURE_NAME;
|
|
26
26
|
constructor(agentIdentifier, aggregator) {
|
|
27
27
|
super(agentIdentifier, aggregator, _constants.FEATURE_NAME);
|
|
@@ -19,7 +19,7 @@ var _globalScope = require("../../../common/util/global-scope");
|
|
|
19
19
|
var _constants = require("../constants");
|
|
20
20
|
var _drain = require("../../../common/drain/drain");
|
|
21
21
|
var _features = require("../../../loaders/features/features");
|
|
22
|
-
var
|
|
22
|
+
var _aggregateBase = require("../../utils/aggregate-base");
|
|
23
23
|
/*
|
|
24
24
|
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
25
25
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -29,7 +29,7 @@ var _featureBase = require("../../utils/feature-base");
|
|
|
29
29
|
* @typedef {import('./compute-stack-trace.js').StackInfo} StackInfo
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
|
-
class Aggregate extends
|
|
32
|
+
class Aggregate extends _aggregateBase.AggregateBase {
|
|
33
33
|
static featureName = _constants.FEATURE_NAME;
|
|
34
34
|
constructor(agentIdentifier, aggregator) {
|
|
35
35
|
var _this;
|
|
@@ -188,10 +188,12 @@ class Aggregate extends _featureBase.FeatureBase {
|
|
|
188
188
|
time: time
|
|
189
189
|
};
|
|
190
190
|
|
|
191
|
-
// stn and spa aggregators listen to this event - stn sends the error in its payload,
|
|
191
|
+
// sr, stn and spa aggregators listen to this event - stn sends the error in its payload,
|
|
192
192
|
// and spa annotates the error with interaction info
|
|
193
|
-
|
|
194
|
-
(0, _handle.handle)('errorAgg',
|
|
193
|
+
const msg = [type, bucketHash, params, newMetrics];
|
|
194
|
+
(0, _handle.handle)('errorAgg', msg, undefined, _features.FEATURE_NAMES.sessionTrace, this.ee);
|
|
195
|
+
(0, _handle.handle)('errorAgg', msg, undefined, _features.FEATURE_NAMES.spa, this.ee);
|
|
196
|
+
(0, _handle.handle)('errorAgg', msg, undefined, _features.FEATURE_NAMES.sessionReplay, this.ee);
|
|
195
197
|
|
|
196
198
|
// still send EE events for other features such as above, but stop this one from aggregating internal data
|
|
197
199
|
if (this.blocked) return;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getFrameworks = getFrameworks;
|
|
7
|
+
var _globalScope = require("../../../common/util/global-scope");
|
|
8
|
+
const FRAMEWORKS = {
|
|
9
|
+
REACT: 'React',
|
|
10
|
+
ANGULAR: 'Angular',
|
|
11
|
+
ANGULARJS: 'AngularJS',
|
|
12
|
+
BACKBONE: 'Backbone',
|
|
13
|
+
EMBER: 'Ember',
|
|
14
|
+
VUE: 'Vue',
|
|
15
|
+
METEOR: 'Meteor',
|
|
16
|
+
ZEPTO: 'Zepto',
|
|
17
|
+
JQUERY: 'Jquery',
|
|
18
|
+
MOOTOOLS: 'MooTools'
|
|
19
|
+
};
|
|
20
|
+
function getFrameworks() {
|
|
21
|
+
if (!_globalScope.isBrowserScope) return []; // don't bother detecting frameworks if not in the main window context
|
|
22
|
+
|
|
23
|
+
const frameworks = [];
|
|
24
|
+
try {
|
|
25
|
+
if (detectReact()) frameworks.push(FRAMEWORKS.REACT);
|
|
26
|
+
if (detectAngularJs()) frameworks.push(FRAMEWORKS.ANGULARJS);
|
|
27
|
+
if (detectAngular()) frameworks.push(FRAMEWORKS.ANGULAR);
|
|
28
|
+
if (Object.prototype.hasOwnProperty.call(window, 'Backbone')) frameworks.push(FRAMEWORKS.BACKBONE);
|
|
29
|
+
if (Object.prototype.hasOwnProperty.call(window, 'Ember')) frameworks.push(FRAMEWORKS.EMBER);
|
|
30
|
+
if (Object.prototype.hasOwnProperty.call(window, 'Vue')) frameworks.push(FRAMEWORKS.VUE);
|
|
31
|
+
if (Object.prototype.hasOwnProperty.call(window, 'Meteor')) frameworks.push(FRAMEWORKS.METEOR);
|
|
32
|
+
if (Object.prototype.hasOwnProperty.call(window, 'Zepto')) frameworks.push(FRAMEWORKS.ZEPTO);
|
|
33
|
+
if (Object.prototype.hasOwnProperty.call(window, 'jQuery')) frameworks.push(FRAMEWORKS.JQUERY);
|
|
34
|
+
if (Object.prototype.hasOwnProperty.call(window, 'MooTools')) frameworks.push(FRAMEWORKS.MOOTOOLS);
|
|
35
|
+
} catch (err) {
|
|
36
|
+
// Possibly not supported
|
|
37
|
+
}
|
|
38
|
+
return frameworks;
|
|
39
|
+
}
|
|
40
|
+
function detectReact() {
|
|
41
|
+
try {
|
|
42
|
+
return Object.prototype.hasOwnProperty.call(window, 'React') || Object.prototype.hasOwnProperty.call(window, 'ReactDOM') || Object.prototype.hasOwnProperty.call(window, 'ReactRedux') || document.querySelector('[data-reactroot], [data-reactid]') || (() => {
|
|
43
|
+
const divs = document.querySelectorAll('body > div');
|
|
44
|
+
for (let i = 0; i < divs.length; i++) {
|
|
45
|
+
if (Object.prototype.hasOwnProperty.call(divs[i], '_reactRootContainer')) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
})();
|
|
50
|
+
} catch (err) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function detectAngularJs() {
|
|
55
|
+
try {
|
|
56
|
+
return Object.prototype.hasOwnProperty.call(window, 'angular') || document.querySelector('.ng-binding, [ng-app], [data-ng-app], [ng-controller], [data-ng-controller], [ng-repeat], [data-ng-repeat]') || document.querySelector('script[src*="angular.js"], script[src*="angular.min.js"]');
|
|
57
|
+
} catch (err) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function detectAngular() {
|
|
62
|
+
try {
|
|
63
|
+
return Object.prototype.hasOwnProperty.call(window, 'ng') || document.querySelector('[ng-version]');
|
|
64
|
+
} catch (err) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
}
|