@newrelic/browser-agent 1.302.0-rc.11 → 1.302.0-rc.12
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/runtime.js +9 -0
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/harvest/harvester.js +1 -1
- package/dist/cjs/features/utils/agent-session.js +0 -8
- package/dist/cjs/loaders/api/consent.js +16 -3
- package/dist/esm/common/config/runtime.js +9 -0
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/common/harvest/harvester.js +1 -1
- package/dist/esm/features/utils/agent-session.js +0 -8
- package/dist/esm/loaders/api/consent.js +16 -3
- package/dist/types/common/config/runtime.d.ts.map +1 -1
- package/dist/types/features/utils/agent-session.d.ts.map +1 -1
- package/dist/types/loaders/api/consent.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/config/runtime.js +10 -0
- package/src/common/harvest/harvester.js +1 -1
- package/src/features/utils/agent-session.js +0 -8
- package/src/loaders/api/consent.js +16 -3
|
@@ -23,9 +23,18 @@ const ReadOnly = {
|
|
|
23
23
|
version: _env.VERSION,
|
|
24
24
|
originTime: _runtime.originTime
|
|
25
25
|
};
|
|
26
|
+
const hiddenState = {
|
|
27
|
+
consented: false
|
|
28
|
+
};
|
|
26
29
|
const RuntimeModel = {
|
|
27
30
|
/** Agent-specific metadata found in the RUM call response. ex. entityGuid */
|
|
28
31
|
appMetadata: {},
|
|
32
|
+
get consented() {
|
|
33
|
+
return this.session?.state?.consent || hiddenState.consented;
|
|
34
|
+
},
|
|
35
|
+
set consented(value) {
|
|
36
|
+
hiddenState.consented = value;
|
|
37
|
+
},
|
|
29
38
|
customTransaction: undefined,
|
|
30
39
|
denyList: undefined,
|
|
31
40
|
disabled: false,
|
|
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.RRWEB_PACKAGE_NAME = exports.D
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the version of the agent
|
|
19
19
|
*/
|
|
20
|
-
const VERSION = exports.VERSION = "1.302.0-rc.
|
|
20
|
+
const VERSION = exports.VERSION = "1.302.0-rc.12";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Exposes the build type of the agent
|
|
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.RRWEB_PACKAGE_NAME = exports.D
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the version of the agent
|
|
19
19
|
*/
|
|
20
|
-
const VERSION = exports.VERSION = "1.302.0-rc.
|
|
20
|
+
const VERSION = exports.VERSION = "1.302.0-rc.12";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Exposes the build type of the agent
|
|
@@ -69,7 +69,7 @@ class Harvester {
|
|
|
69
69
|
endpointVersion: aggregateInst.harvestEndpointVersion || 1
|
|
70
70
|
};
|
|
71
71
|
if (aggregateInst.blocked) return output;
|
|
72
|
-
if (this.agentRef.init?.browser_consent_mode?.enabled && !this.agentRef.runtime
|
|
72
|
+
if (this.agentRef.init?.browser_consent_mode?.enabled && !this.agentRef.runtime.consented) return output;
|
|
73
73
|
const submitMethod = (0, _submitData.getSubmitMethod)(localOpts);
|
|
74
74
|
if (!submitMethod) return output;
|
|
75
75
|
const shouldRetryOnFail = !localOpts.isFinalHarvest && submitMethod === _submitData.xhr; // always retry all features harvests except for final
|
|
@@ -63,14 +63,6 @@ function setupAgentSession(agentRef) {
|
|
|
63
63
|
agentRef.runtime.session.write({
|
|
64
64
|
consent: accept === undefined ? true : accept
|
|
65
65
|
});
|
|
66
|
-
|
|
67
|
-
// call sendRum if it wasn't called yet
|
|
68
|
-
agentRef.features.page_view_event.onAggregateImported.then(loaded => {
|
|
69
|
-
const pveAgg = agentRef.features.page_view_event.featAggregate;
|
|
70
|
-
if (loaded && !pveAgg.sentRum) {
|
|
71
|
-
pveAgg.sendRum();
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
66
|
}, 'session', sharedEE);
|
|
75
67
|
(0, _drain.drain)(agentRef.agentIdentifier, 'session');
|
|
76
68
|
return agentRef.runtime.session;
|
|
@@ -14,11 +14,24 @@ var _console = require("../../common/util/console");
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
function setupConsentAPI(agent) {
|
|
17
|
-
(0, _sharedHandlers.setupAPI)(_constants.CONSENT, function (accept) {
|
|
18
|
-
if (
|
|
17
|
+
(0, _sharedHandlers.setupAPI)(_constants.CONSENT, function (accept = true) {
|
|
18
|
+
if (typeof accept !== 'boolean') {
|
|
19
19
|
(0, _console.warn)(65, typeof accept);
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
/** harvester, by way of "consented" getter, checks session state first, and falls back on runtime state if not available. Set both here */
|
|
23
|
+
(0, _handle.handle)(_constants.prefix + _constants.CONSENT, [accept], undefined, 'session', agent.ee); // sets session state (if available)
|
|
24
|
+
agent.runtime.consented = accept; // sets runtime state
|
|
25
|
+
|
|
26
|
+
/** if consent is granted, attempt to make a PageView event harvest if one has not already been made */
|
|
27
|
+
if (accept) {
|
|
28
|
+
const pveInst = agent.features.page_view_event;
|
|
29
|
+
pveInst.onAggregateImported.then(loaded => {
|
|
30
|
+
const pveAgg = pveInst.featAggregate;
|
|
31
|
+
if (loaded && !pveAgg.sentRum) {
|
|
32
|
+
pveAgg.sendRum();
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
23
36
|
}, agent);
|
|
24
37
|
}
|
|
@@ -17,9 +17,18 @@ const ReadOnly = {
|
|
|
17
17
|
version: VERSION,
|
|
18
18
|
originTime
|
|
19
19
|
};
|
|
20
|
+
const hiddenState = {
|
|
21
|
+
consented: false
|
|
22
|
+
};
|
|
20
23
|
const RuntimeModel = {
|
|
21
24
|
/** Agent-specific metadata found in the RUM call response. ex. entityGuid */
|
|
22
25
|
appMetadata: {},
|
|
26
|
+
get consented() {
|
|
27
|
+
return this.session?.state?.consent || hiddenState.consented;
|
|
28
|
+
},
|
|
29
|
+
set consented(value) {
|
|
30
|
+
hiddenState.consented = value;
|
|
31
|
+
},
|
|
23
32
|
customTransaction: undefined,
|
|
24
33
|
denyList: undefined,
|
|
25
34
|
disabled: false,
|
|
@@ -61,7 +61,7 @@ export class Harvester {
|
|
|
61
61
|
endpointVersion: aggregateInst.harvestEndpointVersion || 1
|
|
62
62
|
};
|
|
63
63
|
if (aggregateInst.blocked) return output;
|
|
64
|
-
if (this.agentRef.init?.browser_consent_mode?.enabled && !this.agentRef.runtime
|
|
64
|
+
if (this.agentRef.init?.browser_consent_mode?.enabled && !this.agentRef.runtime.consented) return output;
|
|
65
65
|
const submitMethod = getSubmitMethod(localOpts);
|
|
66
66
|
if (!submitMethod) return output;
|
|
67
67
|
const shouldRetryOnFail = !localOpts.isFinalHarvest && submitMethod === xhrMethod; // always retry all features harvests except for final
|
|
@@ -56,14 +56,6 @@ export function setupAgentSession(agentRef) {
|
|
|
56
56
|
agentRef.runtime.session.write({
|
|
57
57
|
consent: accept === undefined ? true : accept
|
|
58
58
|
});
|
|
59
|
-
|
|
60
|
-
// call sendRum if it wasn't called yet
|
|
61
|
-
agentRef.features.page_view_event.onAggregateImported.then(loaded => {
|
|
62
|
-
const pveAgg = agentRef.features.page_view_event.featAggregate;
|
|
63
|
-
if (loaded && !pveAgg.sentRum) {
|
|
64
|
-
pveAgg.sendRum();
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
59
|
}, 'session', sharedEE);
|
|
68
60
|
drain(agentRef.agentIdentifier, 'session');
|
|
69
61
|
return agentRef.runtime.session;
|
|
@@ -7,11 +7,24 @@ import { setupAPI } from './sharedHandlers';
|
|
|
7
7
|
import { handle } from '../../common/event-emitter/handle';
|
|
8
8
|
import { warn } from '../../common/util/console';
|
|
9
9
|
export function setupConsentAPI(agent) {
|
|
10
|
-
setupAPI(CONSENT, function (accept) {
|
|
11
|
-
if (
|
|
10
|
+
setupAPI(CONSENT, function (accept = true) {
|
|
11
|
+
if (typeof accept !== 'boolean') {
|
|
12
12
|
warn(65, typeof accept);
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
/** harvester, by way of "consented" getter, checks session state first, and falls back on runtime state if not available. Set both here */
|
|
16
|
+
handle(prefix + CONSENT, [accept], undefined, 'session', agent.ee); // sets session state (if available)
|
|
17
|
+
agent.runtime.consented = accept; // sets runtime state
|
|
18
|
+
|
|
19
|
+
/** if consent is granted, attempt to make a PageView event harvest if one has not already been made */
|
|
20
|
+
if (accept) {
|
|
21
|
+
const pveInst = agent.features.page_view_event;
|
|
22
|
+
pveInst.onAggregateImported.then(loaded => {
|
|
23
|
+
const pveAgg = pveInst.featAggregate;
|
|
24
|
+
if (loaded && !pveAgg.sentRum) {
|
|
25
|
+
pveAgg.sendRum();
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
16
29
|
}, agent);
|
|
17
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/common/config/runtime.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/common/config/runtime.js"],"names":[],"mappings":"AAsDO,gDAON"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-session.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/agent-session.js"],"names":[],"mappings":"AAaA,
|
|
1
|
+
{"version":3,"file":"agent-session.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/agent-session.js"],"names":[],"mappings":"AAaA,sDAoDC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consent.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/consent.js"],"names":[],"mappings":"AASA,
|
|
1
|
+
{"version":3,"file":"consent.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/consent.js"],"names":[],"mappings":"AASA,kDAqBC"}
|
package/package.json
CHANGED
|
@@ -19,9 +19,19 @@ const ReadOnly = {
|
|
|
19
19
|
originTime
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
const hiddenState = {
|
|
23
|
+
consented: false
|
|
24
|
+
}
|
|
25
|
+
|
|
22
26
|
const RuntimeModel = {
|
|
23
27
|
/** Agent-specific metadata found in the RUM call response. ex. entityGuid */
|
|
24
28
|
appMetadata: {},
|
|
29
|
+
get consented () {
|
|
30
|
+
return this.session?.state?.consent || hiddenState.consented
|
|
31
|
+
},
|
|
32
|
+
set consented (value) {
|
|
33
|
+
hiddenState.consented = value
|
|
34
|
+
},
|
|
25
35
|
customTransaction: undefined,
|
|
26
36
|
denyList: undefined,
|
|
27
37
|
disabled: false,
|
|
@@ -59,7 +59,7 @@ export class Harvester {
|
|
|
59
59
|
triggerHarvestFor (aggregateInst, localOpts = {}) {
|
|
60
60
|
const output = { ranSend: false, payload: undefined, endpointVersion: aggregateInst.harvestEndpointVersion || 1 }
|
|
61
61
|
if (aggregateInst.blocked) return output
|
|
62
|
-
if (this.agentRef.init?.browser_consent_mode?.enabled && !this.agentRef.runtime
|
|
62
|
+
if (this.agentRef.init?.browser_consent_mode?.enabled && !this.agentRef.runtime.consented) return output
|
|
63
63
|
|
|
64
64
|
const submitMethod = getSubmitMethod(localOpts)
|
|
65
65
|
if (!submitMethod) return output
|
|
@@ -58,14 +58,6 @@ export function setupAgentSession (agentRef) {
|
|
|
58
58
|
|
|
59
59
|
registerHandler('api-consent', (accept) => {
|
|
60
60
|
agentRef.runtime.session.write({ consent: accept === undefined ? true : accept })
|
|
61
|
-
|
|
62
|
-
// call sendRum if it wasn't called yet
|
|
63
|
-
agentRef.features.page_view_event.onAggregateImported.then((loaded) => {
|
|
64
|
-
const pveAgg = agentRef.features.page_view_event.featAggregate
|
|
65
|
-
if (loaded && !pveAgg.sentRum) {
|
|
66
|
-
pveAgg.sendRum()
|
|
67
|
-
}
|
|
68
|
-
})
|
|
69
61
|
}, 'session', sharedEE)
|
|
70
62
|
|
|
71
63
|
drain(agentRef.agentIdentifier, 'session')
|
|
@@ -8,11 +8,24 @@ import { handle } from '../../common/event-emitter/handle'
|
|
|
8
8
|
import { warn } from '../../common/util/console'
|
|
9
9
|
|
|
10
10
|
export function setupConsentAPI (agent) {
|
|
11
|
-
setupAPI(CONSENT, function (accept) {
|
|
12
|
-
if (
|
|
11
|
+
setupAPI(CONSENT, function (accept = true) {
|
|
12
|
+
if (typeof accept !== 'boolean') {
|
|
13
13
|
warn(65, typeof accept)
|
|
14
14
|
return
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
/** harvester, by way of "consented" getter, checks session state first, and falls back on runtime state if not available. Set both here */
|
|
17
|
+
handle(prefix + CONSENT, [accept], undefined, 'session', agent.ee) // sets session state (if available)
|
|
18
|
+
agent.runtime.consented = accept // sets runtime state
|
|
19
|
+
|
|
20
|
+
/** if consent is granted, attempt to make a PageView event harvest if one has not already been made */
|
|
21
|
+
if (accept) {
|
|
22
|
+
const pveInst = agent.features.page_view_event
|
|
23
|
+
pveInst.onAggregateImported.then((loaded) => {
|
|
24
|
+
const pveAgg = pveInst.featAggregate
|
|
25
|
+
if (loaded && !pveAgg.sentRum) {
|
|
26
|
+
pveAgg.sendRum()
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
}
|
|
17
30
|
}, agent)
|
|
18
31
|
}
|