@cloudcare/browser-rum 3.3.4 → 3.3.6
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/bundle/dataflux-rum.js +1 -1
- package/cjs/boot/buildEnv.js +1 -1
- package/cjs/boot/perStartRum.js +42 -6
- package/cjs/boot/perStartRum.js.map +1 -1
- package/cjs/boot/recorderApi.js +35 -10
- package/cjs/boot/recorderApi.js.map +1 -1
- package/cjs/boot/rum.js +8 -0
- package/cjs/boot/rum.js.map +1 -1
- package/cjs/boot/rumPublicApi.js +36 -3
- package/cjs/boot/rumPublicApi.js.map +1 -1
- package/cjs/domain/configuration.js +7 -0
- package/cjs/domain/configuration.js.map +1 -1
- package/cjs/domain/contexts/urlContexts.js +11 -2
- package/cjs/domain/contexts/urlContexts.js.map +1 -1
- package/cjs/domain/contexts/viewContexts.js +2 -2
- package/cjs/domain/contexts/viewContexts.js.map +1 -1
- package/cjs/domain/deflate/deflateWorker.js +1 -1
- package/cjs/domain/plugins.js +67 -0
- package/cjs/domain/plugins.js.map +1 -0
- package/cjs/domain/replay/record/canvasEncodeWorker.js +1 -1
- package/cjs/domain/rumEventsCollection/error/errorCollection.js +17 -5
- package/cjs/domain/rumEventsCollection/error/errorCollection.js.map +1 -1
- package/cjs/domain/rumEventsCollection/resource/resourceCollection.js +56 -0
- package/cjs/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -1
- package/cjs/domain/rumEventsCollection/resource/webSocketCollection.js +196 -0
- package/cjs/domain/rumEventsCollection/resource/webSocketCollection.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackLoadingTime.js +8 -3
- package/cjs/domain/rumEventsCollection/view/trackLoadingTime.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackViews.js +2 -1
- package/cjs/domain/rumEventsCollection/view/trackViews.js.map +1 -1
- package/cjs/domain/rumSessionManager.js +23 -3
- package/cjs/domain/rumSessionManager.js.map +1 -1
- package/esm/boot/buildEnv.js +1 -1
- package/esm/boot/perStartRum.js +42 -6
- package/esm/boot/perStartRum.js.map +1 -1
- package/esm/boot/recorderApi.js +35 -10
- package/esm/boot/recorderApi.js.map +1 -1
- package/esm/boot/rum.js +8 -0
- package/esm/boot/rum.js.map +1 -1
- package/esm/boot/rumPublicApi.js +36 -3
- package/esm/boot/rumPublicApi.js.map +1 -1
- package/esm/domain/configuration.js +8 -1
- package/esm/domain/configuration.js.map +1 -1
- package/esm/domain/contexts/urlContexts.js +12 -3
- package/esm/domain/contexts/urlContexts.js.map +1 -1
- package/esm/domain/contexts/viewContexts.js +2 -2
- package/esm/domain/contexts/viewContexts.js.map +1 -1
- package/esm/domain/deflate/deflateWorker.js +1 -1
- package/esm/domain/plugins.js +59 -0
- package/esm/domain/plugins.js.map +1 -0
- package/esm/domain/replay/record/canvasEncodeWorker.js +1 -1
- package/esm/domain/rumEventsCollection/error/errorCollection.js +17 -5
- package/esm/domain/rumEventsCollection/error/errorCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/resourceCollection.js +55 -0
- package/esm/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/webSocketCollection.js +189 -0
- package/esm/domain/rumEventsCollection/resource/webSocketCollection.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackLoadingTime.js +8 -3
- package/esm/domain/rumEventsCollection/view/trackLoadingTime.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackViews.js +2 -1
- package/esm/domain/rumEventsCollection/view/trackViews.js.map +1 -1
- package/esm/domain/rumSessionManager.js +24 -4
- package/esm/domain/rumSessionManager.js.map +1 -1
- package/package.json +4 -4
- package/src/boot/perStartRum.js +47 -7
- package/src/boot/recorderApi.js +36 -12
- package/src/boot/rum.js +11 -0
- package/src/boot/rumPublicApi.js +38 -3
- package/src/domain/configuration.js +13 -1
- package/src/domain/contexts/urlContexts.js +17 -3
- package/src/domain/contexts/viewContexts.js +2 -2
- package/src/domain/plugins.js +94 -0
- package/src/domain/rumEventsCollection/error/errorCollection.js +22 -6
- package/src/domain/rumEventsCollection/resource/resourceCollection.js +70 -0
- package/src/domain/rumEventsCollection/resource/webSocketCollection.js +271 -0
- package/src/domain/rumEventsCollection/view/trackLoadingTime.js +12 -3
- package/src/domain/rumEventsCollection/view/trackViews.js +2 -1
- package/src/domain/rumSessionManager.js +33 -2
- package/types/index.d.ts +85 -6
package/esm/boot/perStartRum.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createBoundedBuffer, display, canUseEventBridge, displayAlreadyInitializedError, willSyntheticsInjectRum, noop, timeStampNow, clocksNow, assign, addTelemetryConfiguration, initFetchObservable, deepClone, fetchAndApplyRemoteConfiguration, getEventBridge, getType } from '@cloudcare/browser-core';
|
|
2
2
|
import { validateAndBuildRumConfiguration } from '../domain/configuration';
|
|
3
|
+
import { getPluginsTelemetry, validatePlugins } from '../domain/plugins';
|
|
3
4
|
export function createPreStartStrategy(rumPublicApiOptions, getCommonContext, doStartRum) {
|
|
4
5
|
var ignoreInitIfSyntheticsWillInjectRum = rumPublicApiOptions.ignoreInitIfSyntheticsWillInjectRum;
|
|
5
6
|
var startCompressionWorker = rumPublicApiOptions.startCompressionWorker;
|
|
@@ -11,9 +12,12 @@ export function createPreStartStrategy(rumPublicApiOptions, getCommonContext, do
|
|
|
11
12
|
var cachedInitConfiguration;
|
|
12
13
|
var cachedConfiguration;
|
|
13
14
|
var cachedRemoteConfiguration;
|
|
15
|
+
var hasStarted;
|
|
16
|
+
var initializationPending;
|
|
17
|
+
var pluginsRequireManualViewTracking;
|
|
14
18
|
var resourceTrackerManager = rumPublicApiOptions.resourceTrackerManager;
|
|
15
19
|
function tryStartRum() {
|
|
16
|
-
if (!cachedInitConfiguration || !cachedConfiguration) {
|
|
20
|
+
if (hasStarted || !cachedInitConfiguration || !cachedConfiguration) {
|
|
17
21
|
return;
|
|
18
22
|
}
|
|
19
23
|
var initialViewOptions;
|
|
@@ -31,6 +35,7 @@ export function createPreStartStrategy(rumPublicApiOptions, getCommonContext, do
|
|
|
31
35
|
initialViewOptions = firstStartViewCall.options;
|
|
32
36
|
}
|
|
33
37
|
var startRumResult = doStartRum(cachedConfiguration, compressionWorker, initialViewOptions);
|
|
38
|
+
hasStarted = true;
|
|
34
39
|
bufferApiCalls.drain(startRumResult);
|
|
35
40
|
}
|
|
36
41
|
function doInit(initConfiguration, remoteConfiguration) {
|
|
@@ -46,17 +51,23 @@ export function createPreStartStrategy(rumPublicApiOptions, getCommonContext, do
|
|
|
46
51
|
cachedInitConfiguration = initConfiguration;
|
|
47
52
|
cachedRemoteConfiguration = remoteConfiguration;
|
|
48
53
|
remoteConfigrationCallbacks.drain(cachedRemoteConfiguration);
|
|
49
|
-
addTelemetryConfiguration(deepClone(initConfiguration));
|
|
50
54
|
if (cachedConfiguration) {
|
|
51
55
|
displayAlreadyInitializedError('DATAFLUX_RUM', initConfiguration);
|
|
52
56
|
return;
|
|
53
57
|
}
|
|
58
|
+
var telemetryConfiguration = deepClone(initConfiguration);
|
|
59
|
+
if (initConfiguration.plugins) {
|
|
60
|
+
telemetryConfiguration.plugins = getPluginsTelemetry(initConfiguration.plugins);
|
|
61
|
+
}
|
|
62
|
+
addTelemetryConfiguration(telemetryConfiguration);
|
|
54
63
|
var configuration = validateAndBuildRumConfiguration(initConfiguration);
|
|
55
64
|
if (!configuration) {
|
|
65
|
+
initializationPending = false;
|
|
56
66
|
return;
|
|
57
67
|
}
|
|
58
68
|
if (!eventBridgeAvailable && !configuration.sessionStoreStrategyType) {
|
|
59
69
|
display.warn('No storage available for session. We will not send any data.');
|
|
70
|
+
initializationPending = false;
|
|
60
71
|
return;
|
|
61
72
|
}
|
|
62
73
|
if (configuration.compressIntakeRequests && !configuration.sendContentTypeByJson && !eventBridgeAvailable && startCompressionWorker) {
|
|
@@ -67,10 +78,12 @@ export function createPreStartStrategy(rumPublicApiOptions, getCommonContext, do
|
|
|
67
78
|
noop);
|
|
68
79
|
if (!compressionWorker) {
|
|
69
80
|
// The compression worker starter should have logged an error message explaining the issue
|
|
81
|
+
initializationPending = false;
|
|
70
82
|
return;
|
|
71
83
|
}
|
|
72
84
|
}
|
|
73
85
|
cachedConfiguration = configuration;
|
|
86
|
+
initializationPending = false;
|
|
74
87
|
// Instrumuent fetch to track network requests
|
|
75
88
|
// This is needed in case the consent is not granted and some cutsomer
|
|
76
89
|
// library (Apollo Client) is storing uninstrumented fetch to be used later
|
|
@@ -79,24 +92,42 @@ export function createPreStartStrategy(rumPublicApiOptions, getCommonContext, do
|
|
|
79
92
|
tryStartRum();
|
|
80
93
|
}
|
|
81
94
|
return {
|
|
82
|
-
init: function init(initConfiguration) {
|
|
95
|
+
init: function init(initConfiguration, publicApi) {
|
|
83
96
|
if (!initConfiguration) {
|
|
84
97
|
display.error('Missing configuration');
|
|
85
98
|
return;
|
|
86
99
|
}
|
|
87
100
|
// Set the experimental feature flags as early as possible, so we can use them in most places
|
|
88
101
|
|
|
89
|
-
// Expose the initial configuration regardless of initialization success.
|
|
90
|
-
cachedInitConfiguration = initConfiguration;
|
|
91
102
|
// If we are in a Synthetics test configured to automatically inject a RUM instance, we want
|
|
92
103
|
// to completely discard the customer application RUM instance by ignoring their init() call.
|
|
93
104
|
// But, we should not ignore the init() call from the Synthetics-injected RUM instance, so the
|
|
94
105
|
// internal `ignoreInitIfSyntheticsWillInjectRum` option is here to bypass this condition.
|
|
95
106
|
if (ignoreInitIfSyntheticsWillInjectRum && willSyntheticsInjectRum()) {
|
|
107
|
+
cachedInitConfiguration = initConfiguration;
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (initializationPending || cachedConfiguration) {
|
|
111
|
+
displayAlreadyInitializedError('DATAFLUX_RUM', initConfiguration);
|
|
96
112
|
return;
|
|
97
113
|
}
|
|
114
|
+
// Expose the accepted configuration regardless of initialization success.
|
|
115
|
+
cachedInitConfiguration = initConfiguration;
|
|
116
|
+
if (!validatePlugins(initConfiguration.plugins)) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
initializationPending = true;
|
|
120
|
+
if (rumPublicApiOptions.onInit) {
|
|
121
|
+
rumPublicApiOptions.onInit(initConfiguration, publicApi);
|
|
122
|
+
}
|
|
123
|
+
pluginsRequireManualViewTracking = !!initConfiguration.plugins && initConfiguration.trackViewsManually === true;
|
|
98
124
|
if (initConfiguration.remoteConfiguration) {
|
|
99
|
-
fetchAndApplyRemoteConfiguration(initConfiguration,
|
|
125
|
+
fetchAndApplyRemoteConfiguration(initConfiguration, function (remoteInitConfiguration, remoteConfiguration) {
|
|
126
|
+
if (pluginsRequireManualViewTracking) {
|
|
127
|
+
remoteInitConfiguration.trackViewsManually = true;
|
|
128
|
+
}
|
|
129
|
+
doInit(remoteInitConfiguration, remoteConfiguration);
|
|
130
|
+
});
|
|
100
131
|
} else {
|
|
101
132
|
doInit(initConfiguration);
|
|
102
133
|
}
|
|
@@ -115,6 +146,11 @@ export function createPreStartStrategy(rumPublicApiOptions, getCommonContext, do
|
|
|
115
146
|
},
|
|
116
147
|
getInternalContext: noop,
|
|
117
148
|
stopSession: noop,
|
|
149
|
+
startSession: function startSession(options) {
|
|
150
|
+
bufferApiCalls.add(function (startRumResult) {
|
|
151
|
+
return startRumResult.startSession(options);
|
|
152
|
+
});
|
|
153
|
+
},
|
|
118
154
|
setForcedSession: function setForcedSession() {
|
|
119
155
|
bufferApiCalls.add(function (startRumResult) {
|
|
120
156
|
return startRumResult.setForcedSession();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"perStartRum.js","names":["createBoundedBuffer","display","canUseEventBridge","displayAlreadyInitializedError","willSyntheticsInjectRum","noop","timeStampNow","clocksNow","assign","addTelemetryConfiguration","initFetchObservable","deepClone","fetchAndApplyRemoteConfiguration","getEventBridge","getType","validateAndBuildRumConfiguration","createPreStartStrategy","rumPublicApiOptions","getCommonContext","doStartRum","ignoreInitIfSyntheticsWillInjectRum","startCompressionWorker","overrideInitConfiguration","bufferApiCalls","remoteConfigrationCallbacks","firstStartViewCall","compressionWorker","cachedInitConfiguration","cachedConfiguration","cachedRemoteConfiguration","resourceTrackerManager","tryStartRum","initialViewOptions","trackViewsManually","remove","callback","options","startRumResult","drain","doInit","initConfiguration","remoteConfiguration","eventBridgeAvailable","overrideInitConfigurationForBridge","configuration","sessionStoreStrategyType","warn","compressIntakeRequests","sendContentTypeByJson","subscribe","init","error","getInitConfiguration","getRemoteConfiguration","add","getInternalContext","stopSession","setForcedSession","addTiming","name","time","undefined","startView","startClocks","setViewName","setViewContext","context","setViewContextProperty","key","value","getViewContext","addTypeAction","action","type","commonContext","addAction","addResource","resource","addError","providedError","createResourceTrackerId","createTrackerId","setResourceContext","trackerId","appendResourceContext","finishResource","getResource","_initConfiguration$de","_getEventBridge","applicationId","clientToken","sessionSampleRate","defaultPrivacyLevel","getPrivacyLevel"],"sources":["../../src/boot/perStartRum.js"],"sourcesContent":["import {\n createBoundedBuffer,\n display,\n canUseEventBridge,\n displayAlreadyInitializedError,\n willSyntheticsInjectRum,\n noop,\n timeStampNow,\n clocksNow,\n assign,\n addTelemetryConfiguration,\n initFetchObservable,\n deepClone,\n fetchAndApplyRemoteConfiguration,\n getEventBridge,\n getType\n} from '@cloudcare/browser-core'\nimport { validateAndBuildRumConfiguration } from '../domain/configuration'\n\nexport function createPreStartStrategy(\n rumPublicApiOptions,\n getCommonContext,\n doStartRum\n) {\n var ignoreInitIfSyntheticsWillInjectRum =\n rumPublicApiOptions.ignoreInitIfSyntheticsWillInjectRum\n var startCompressionWorker = rumPublicApiOptions.startCompressionWorker\n var overrideInitConfiguration = rumPublicApiOptions.overrideInitConfiguration\n var bufferApiCalls = createBoundedBuffer()\n var remoteConfigrationCallbacks = createBoundedBuffer()\n var firstStartViewCall\n\n var compressionWorker\n\n var cachedInitConfiguration\n var cachedConfiguration\n var cachedRemoteConfiguration\n var resourceTrackerManager = rumPublicApiOptions.resourceTrackerManager\n function tryStartRum() {\n if (!cachedInitConfiguration || !cachedConfiguration) {\n return\n }\n\n var initialViewOptions\n\n if (cachedConfiguration.trackViewsManually) {\n if (!firstStartViewCall) {\n return\n }\n // An initial view is always created when starting RUM.\n // When tracking views automatically, any startView call before RUM start creates an extra\n // view.\n // When tracking views manually, we use the ViewOptions from the first startView call as the\n // initial view options, and we remove the actual startView call so we don't create an extra\n // view.\n bufferApiCalls.remove(firstStartViewCall.callback)\n initialViewOptions = firstStartViewCall.options\n }\n\n var startRumResult = doStartRum(\n cachedConfiguration,\n compressionWorker,\n initialViewOptions\n )\n\n bufferApiCalls.drain(startRumResult)\n }\n\n function doInit(initConfiguration, remoteConfiguration) {\n var eventBridgeAvailable = canUseEventBridge()\n if (eventBridgeAvailable) {\n initConfiguration = overrideInitConfigurationForBridge(initConfiguration)\n }\n if (overrideInitConfiguration) {\n initConfiguration = overrideInitConfiguration(initConfiguration)\n }\n\n // Update the exposed initConfiguration to reflect the bridge and remote configuration overrides\n cachedInitConfiguration = initConfiguration\n cachedRemoteConfiguration = remoteConfiguration\n remoteConfigrationCallbacks.drain(cachedRemoteConfiguration)\n addTelemetryConfiguration(deepClone(initConfiguration))\n if (cachedConfiguration) {\n displayAlreadyInitializedError('DATAFLUX_RUM', initConfiguration)\n return\n }\n var configuration = validateAndBuildRumConfiguration(initConfiguration)\n if (!configuration) {\n return\n }\n\n if (!eventBridgeAvailable && !configuration.sessionStoreStrategyType) {\n display.warn(\n 'No storage available for session. We will not send any data.'\n )\n return\n }\n\n if (\n configuration.compressIntakeRequests &&\n !configuration.sendContentTypeByJson &&\n !eventBridgeAvailable &&\n startCompressionWorker\n ) {\n compressionWorker = startCompressionWorker(\n configuration,\n 'RUM',\n // Worker initialization can fail asynchronously, especially in Firefox where even CSP\n // issues are reported asynchronously. For now, the SDK will continue its execution even if\n // data won't be sent to Datadog. We could improve this behavior in the future.\n noop\n )\n if (!compressionWorker) {\n // The compression worker starter should have logged an error message explaining the issue\n return\n }\n }\n\n cachedConfiguration = configuration\n // Instrumuent fetch to track network requests\n // This is needed in case the consent is not granted and some cutsomer\n // library (Apollo Client) is storing uninstrumented fetch to be used later\n // The subscrption is needed so that the instrumentation process is completed\n initFetchObservable().subscribe(noop)\n\n tryStartRum()\n }\n\n return {\n init: function (initConfiguration) {\n if (!initConfiguration) {\n display.error('Missing configuration')\n return\n }\n // Set the experimental feature flags as early as possible, so we can use them in most places\n\n // Expose the initial configuration regardless of initialization success.\n cachedInitConfiguration = initConfiguration\n // If we are in a Synthetics test configured to automatically inject a RUM instance, we want\n // to completely discard the customer application RUM instance by ignoring their init() call.\n // But, we should not ignore the init() call from the Synthetics-injected RUM instance, so the\n // internal `ignoreInitIfSyntheticsWillInjectRum` option is here to bypass this condition.\n if (ignoreInitIfSyntheticsWillInjectRum && willSyntheticsInjectRum()) {\n return\n }\n if (initConfiguration.remoteConfiguration) {\n fetchAndApplyRemoteConfiguration(initConfiguration, doInit)\n } else {\n doInit(initConfiguration)\n }\n },\n\n getInitConfiguration: function () {\n return cachedInitConfiguration\n },\n getRemoteConfiguration: function (callback) {\n if (getType(callback) === 'function') {\n if (cachedRemoteConfiguration) {\n callback(cachedRemoteConfiguration)\n } else {\n remoteConfigrationCallbacks.add(callback)\n }\n }\n },\n getInternalContext: noop,\n\n stopSession: noop,\n setForcedSession: function () {\n bufferApiCalls.add((startRumResult) => startRumResult.setForcedSession())\n },\n addTiming: function (name, time) {\n if (time === undefined) {\n time = timeStampNow()\n }\n bufferApiCalls.add(function (startRumResult) {\n startRumResult.addTiming(name, time)\n })\n },\n\n startView: function (options, startClocks) {\n if (startClocks === undefined) {\n startClocks = clocksNow()\n }\n const callback = function (startRumResult) {\n startRumResult.startView(options, startClocks)\n }\n bufferApiCalls.add(callback)\n\n if (!firstStartViewCall) {\n firstStartViewCall = { options: options, callback: callback }\n tryStartRum()\n }\n },\n setViewName(name) {\n bufferApiCalls.add((startRumResult) => startRumResult.setViewName(name))\n },\n\n setViewContext(context) {\n bufferApiCalls.add((startRumResult) =>\n startRumResult.setViewContext(context)\n )\n },\n\n setViewContextProperty(key, value) {\n bufferApiCalls.add((startRumResult) =>\n startRumResult.setViewContextProperty(key, value)\n )\n },\n\n getViewContext: () => {},\n\n addTypeAction: function (action, type, commonContext) {\n if (commonContext === undefined) {\n commonContext = getCommonContext()\n }\n bufferApiCalls.add(function (startRumResult) {\n startRumResult.addTypeAction(action, type, commonContext)\n })\n },\n addAction: function (action, commonContext) {\n if (commonContext === undefined) {\n commonContext = getCommonContext()\n }\n bufferApiCalls.add(function (startRumResult) {\n startRumResult.addAction(action, commonContext)\n })\n },\n addResource: function (resource, commonContext) {\n if (commonContext === undefined) {\n commonContext = getCommonContext()\n }\n bufferApiCalls.add(function (startRumResult) {\n startRumResult.addResource(resource, commonContext)\n })\n },\n addError: function (providedError, commonContext) {\n if (commonContext === undefined) {\n commonContext = getCommonContext()\n }\n bufferApiCalls.add(function (startRumResult) {\n startRumResult.addError(providedError, commonContext)\n })\n },\n createResourceTrackerId: function () {\n return resourceTrackerManager.createTrackerId()\n },\n setResourceContext: function (trackerId, context) {\n resourceTrackerManager.setResourceContext(trackerId, context)\n },\n appendResourceContext: function (trackerId, context) {\n resourceTrackerManager.appendResourceContext(trackerId, context)\n },\n finishResource: function (trackerId) {\n resourceTrackerManager.finishResource(trackerId)\n },\n getResource: function (trackerId) {\n return resourceTrackerManager.getResource(trackerId)\n }\n }\n}\n\nfunction overrideInitConfigurationForBridge(initConfiguration) {\n return assign({}, initConfiguration, {\n applicationId: '00000000-aaaa-0000-aaaa-000000000000',\n clientToken: 'empty',\n sessionSampleRate: 100,\n defaultPrivacyLevel:\n initConfiguration.defaultPrivacyLevel ??\n getEventBridge()?.getPrivacyLevel()\n })\n}\n"],"mappings":"AAAA,SACEA,mBAAmB,EACnBC,OAAO,EACPC,iBAAiB,EACjBC,8BAA8B,EAC9BC,uBAAuB,EACvBC,IAAI,EACJC,YAAY,EACZC,SAAS,EACTC,MAAM,EACNC,yBAAyB,EACzBC,mBAAmB,EACnBC,SAAS,EACTC,gCAAgC,EAChC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SAAvBA,qBAAqBA,CAAYD,SAAS,EAAEjB,OAAO,EAAE;MACnDpC,sBAAsB,CAACsD,qBAAqB,CAACD,SAAS,EAAEjB,OAAO,CAAC;IAClE,CAAC;IACDmB,cAAc,EAAE,SAAhBA,cAAcA,CAAYF,SAAS,EAAE;MACnCrD,sBAAsB,CAACuD,cAAc,CAACF,SAAS,CAAC;IAClD,CAAC;IACDG,WAAW,EAAE,SAAbA,WAAWA,CAAYH,SAAS,EAAE;MAChC,OAAOrD,sBAAsB,CAACwD,WAAW,CAACH,SAAS,CAAC;IACtD;EACF,CAAC;AACH;AAEA,SAASxC,kCAAkCA,CAACH,iBAAiB,EAAE;EAAA,IAAA+C,qBAAA,EAAAC,eAAA;EAC7D,OAAOhF,MAAM,CAAC,CAAC,CAAC,EAAEgC,iBAAiB,EAAE;IACnCiD,aAAa,EAAE,sCAAsC;IACrDC,WAAW,EAAE,OAAO;IACpBC,iBAAiB,EAAE,GAAG;IACtBC,mBAAmB,GAAAL,qBAAA,GACjB/C,iBAAiB,CAACoD,mBAAmB,cAAAL,qBAAA,cAAAA,qBAAA,IAAAC,eAAA,GACrC3E,cAAc,CAAC,CAAC,cAAA2E,eAAA,uBAAhBA,eAAA,CAAkBK,eAAe,CAAC;EACtC,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"perStartRum.js","names":["createBoundedBuffer","display","canUseEventBridge","displayAlreadyInitializedError","willSyntheticsInjectRum","noop","timeStampNow","clocksNow","assign","addTelemetryConfiguration","initFetchObservable","deepClone","fetchAndApplyRemoteConfiguration","getEventBridge","getType","validateAndBuildRumConfiguration","getPluginsTelemetry","validatePlugins","createPreStartStrategy","rumPublicApiOptions","getCommonContext","doStartRum","ignoreInitIfSyntheticsWillInjectRum","startCompressionWorker","overrideInitConfiguration","bufferApiCalls","remoteConfigrationCallbacks","firstStartViewCall","compressionWorker","cachedInitConfiguration","cachedConfiguration","cachedRemoteConfiguration","hasStarted","initializationPending","pluginsRequireManualViewTracking","resourceTrackerManager","tryStartRum","initialViewOptions","trackViewsManually","remove","callback","options","startRumResult","drain","doInit","initConfiguration","remoteConfiguration","eventBridgeAvailable","overrideInitConfigurationForBridge","telemetryConfiguration","plugins","configuration","sessionStoreStrategyType","warn","compressIntakeRequests","sendContentTypeByJson","subscribe","init","publicApi","error","onInit","remoteInitConfiguration","getInitConfiguration","getRemoteConfiguration","add","getInternalContext","stopSession","startSession","setForcedSession","addTiming","name","time","undefined","startView","startClocks","setViewName","setViewContext","context","setViewContextProperty","key","value","getViewContext","addTypeAction","action","type","commonContext","addAction","addResource","resource","addError","providedError","createResourceTrackerId","createTrackerId","setResourceContext","trackerId","appendResourceContext","finishResource","getResource","_initConfiguration$de","_getEventBridge","applicationId","clientToken","sessionSampleRate","defaultPrivacyLevel","getPrivacyLevel"],"sources":["../../src/boot/perStartRum.js"],"sourcesContent":["import {\n createBoundedBuffer,\n display,\n canUseEventBridge,\n displayAlreadyInitializedError,\n willSyntheticsInjectRum,\n noop,\n timeStampNow,\n clocksNow,\n assign,\n addTelemetryConfiguration,\n initFetchObservable,\n deepClone,\n fetchAndApplyRemoteConfiguration,\n getEventBridge,\n getType\n} from '@cloudcare/browser-core'\nimport { validateAndBuildRumConfiguration } from '../domain/configuration'\nimport { getPluginsTelemetry, validatePlugins } from '../domain/plugins'\n\nexport function createPreStartStrategy(\n rumPublicApiOptions,\n getCommonContext,\n doStartRum\n) {\n var ignoreInitIfSyntheticsWillInjectRum =\n rumPublicApiOptions.ignoreInitIfSyntheticsWillInjectRum\n var startCompressionWorker = rumPublicApiOptions.startCompressionWorker\n var overrideInitConfiguration = rumPublicApiOptions.overrideInitConfiguration\n var bufferApiCalls = createBoundedBuffer()\n var remoteConfigrationCallbacks = createBoundedBuffer()\n var firstStartViewCall\n\n var compressionWorker\n\n var cachedInitConfiguration\n var cachedConfiguration\n var cachedRemoteConfiguration\n var hasStarted\n var initializationPending\n var pluginsRequireManualViewTracking\n var resourceTrackerManager = rumPublicApiOptions.resourceTrackerManager\n function tryStartRum() {\n if (hasStarted || !cachedInitConfiguration || !cachedConfiguration) {\n return\n }\n\n var initialViewOptions\n\n if (cachedConfiguration.trackViewsManually) {\n if (!firstStartViewCall) {\n return\n }\n // An initial view is always created when starting RUM.\n // When tracking views automatically, any startView call before RUM start creates an extra\n // view.\n // When tracking views manually, we use the ViewOptions from the first startView call as the\n // initial view options, and we remove the actual startView call so we don't create an extra\n // view.\n bufferApiCalls.remove(firstStartViewCall.callback)\n initialViewOptions = firstStartViewCall.options\n }\n\n var startRumResult = doStartRum(\n cachedConfiguration,\n compressionWorker,\n initialViewOptions\n )\n hasStarted = true\n\n bufferApiCalls.drain(startRumResult)\n }\n\n function doInit(initConfiguration, remoteConfiguration) {\n var eventBridgeAvailable = canUseEventBridge()\n if (eventBridgeAvailable) {\n initConfiguration = overrideInitConfigurationForBridge(initConfiguration)\n }\n if (overrideInitConfiguration) {\n initConfiguration = overrideInitConfiguration(initConfiguration)\n }\n\n // Update the exposed initConfiguration to reflect the bridge and remote configuration overrides\n cachedInitConfiguration = initConfiguration\n cachedRemoteConfiguration = remoteConfiguration\n remoteConfigrationCallbacks.drain(cachedRemoteConfiguration)\n if (cachedConfiguration) {\n displayAlreadyInitializedError('DATAFLUX_RUM', initConfiguration)\n return\n }\n var telemetryConfiguration = deepClone(initConfiguration)\n if (initConfiguration.plugins) {\n telemetryConfiguration.plugins = getPluginsTelemetry(\n initConfiguration.plugins\n )\n }\n addTelemetryConfiguration(telemetryConfiguration)\n var configuration = validateAndBuildRumConfiguration(initConfiguration)\n if (!configuration) {\n initializationPending = false\n return\n }\n\n if (!eventBridgeAvailable && !configuration.sessionStoreStrategyType) {\n display.warn(\n 'No storage available for session. We will not send any data.'\n )\n initializationPending = false\n return\n }\n\n if (\n configuration.compressIntakeRequests &&\n !configuration.sendContentTypeByJson &&\n !eventBridgeAvailable &&\n startCompressionWorker\n ) {\n compressionWorker = startCompressionWorker(\n configuration,\n 'RUM',\n // Worker initialization can fail asynchronously, especially in Firefox where even CSP\n // issues are reported asynchronously. For now, the SDK will continue its execution even if\n // data won't be sent to Datadog. We could improve this behavior in the future.\n noop\n )\n if (!compressionWorker) {\n // The compression worker starter should have logged an error message explaining the issue\n initializationPending = false\n return\n }\n }\n\n cachedConfiguration = configuration\n initializationPending = false\n // Instrumuent fetch to track network requests\n // This is needed in case the consent is not granted and some cutsomer\n // library (Apollo Client) is storing uninstrumented fetch to be used later\n // The subscrption is needed so that the instrumentation process is completed\n initFetchObservable().subscribe(noop)\n tryStartRum()\n }\n\n return {\n init: function (initConfiguration, publicApi) {\n if (!initConfiguration) {\n display.error('Missing configuration')\n return\n }\n // Set the experimental feature flags as early as possible, so we can use them in most places\n\n // If we are in a Synthetics test configured to automatically inject a RUM instance, we want\n // to completely discard the customer application RUM instance by ignoring their init() call.\n // But, we should not ignore the init() call from the Synthetics-injected RUM instance, so the\n // internal `ignoreInitIfSyntheticsWillInjectRum` option is here to bypass this condition.\n if (ignoreInitIfSyntheticsWillInjectRum && willSyntheticsInjectRum()) {\n cachedInitConfiguration = initConfiguration\n return\n }\n if (initializationPending || cachedConfiguration) {\n displayAlreadyInitializedError('DATAFLUX_RUM', initConfiguration)\n return\n }\n // Expose the accepted configuration regardless of initialization success.\n cachedInitConfiguration = initConfiguration\n if (!validatePlugins(initConfiguration.plugins)) {\n return\n }\n initializationPending = true\n if (rumPublicApiOptions.onInit) {\n rumPublicApiOptions.onInit(initConfiguration, publicApi)\n }\n pluginsRequireManualViewTracking =\n !!initConfiguration.plugins &&\n initConfiguration.trackViewsManually === true\n if (initConfiguration.remoteConfiguration) {\n fetchAndApplyRemoteConfiguration(\n initConfiguration,\n function (remoteInitConfiguration, remoteConfiguration) {\n if (pluginsRequireManualViewTracking) {\n remoteInitConfiguration.trackViewsManually = true\n }\n doInit(remoteInitConfiguration, remoteConfiguration)\n }\n )\n } else {\n doInit(initConfiguration)\n }\n },\n\n getInitConfiguration: function () {\n return cachedInitConfiguration\n },\n getRemoteConfiguration: function (callback) {\n if (getType(callback) === 'function') {\n if (cachedRemoteConfiguration) {\n callback(cachedRemoteConfiguration)\n } else {\n remoteConfigrationCallbacks.add(callback)\n }\n }\n },\n getInternalContext: noop,\n\n stopSession: noop,\n startSession: function (options) {\n bufferApiCalls.add((startRumResult) => startRumResult.startSession(options))\n },\n setForcedSession: function () {\n bufferApiCalls.add((startRumResult) => startRumResult.setForcedSession())\n },\n addTiming: function (name, time) {\n if (time === undefined) {\n time = timeStampNow()\n }\n bufferApiCalls.add(function (startRumResult) {\n startRumResult.addTiming(name, time)\n })\n },\n\n startView: function (options, startClocks) {\n if (startClocks === undefined) {\n startClocks = clocksNow()\n }\n const callback = function (startRumResult) {\n startRumResult.startView(options, startClocks)\n }\n bufferApiCalls.add(callback)\n\n if (!firstStartViewCall) {\n firstStartViewCall = { options: options, callback: callback }\n tryStartRum()\n }\n },\n setViewName(name) {\n bufferApiCalls.add((startRumResult) => startRumResult.setViewName(name))\n },\n\n setViewContext(context) {\n bufferApiCalls.add((startRumResult) =>\n startRumResult.setViewContext(context)\n )\n },\n\n setViewContextProperty(key, value) {\n bufferApiCalls.add((startRumResult) =>\n startRumResult.setViewContextProperty(key, value)\n )\n },\n\n getViewContext: () => {},\n\n addTypeAction: function (action, type, commonContext) {\n if (commonContext === undefined) {\n commonContext = getCommonContext()\n }\n bufferApiCalls.add(function (startRumResult) {\n startRumResult.addTypeAction(action, type, commonContext)\n })\n },\n addAction: function (action, commonContext) {\n if (commonContext === undefined) {\n commonContext = getCommonContext()\n }\n bufferApiCalls.add(function (startRumResult) {\n startRumResult.addAction(action, commonContext)\n })\n },\n addResource: function (resource, commonContext) {\n if (commonContext === undefined) {\n commonContext = getCommonContext()\n }\n bufferApiCalls.add(function (startRumResult) {\n startRumResult.addResource(resource, commonContext)\n })\n },\n addError: function (providedError, commonContext) {\n if (commonContext === undefined) {\n commonContext = getCommonContext()\n }\n bufferApiCalls.add(function (startRumResult) {\n startRumResult.addError(providedError, commonContext)\n })\n },\n createResourceTrackerId: function () {\n return resourceTrackerManager.createTrackerId()\n },\n setResourceContext: function (trackerId, context) {\n resourceTrackerManager.setResourceContext(trackerId, context)\n },\n appendResourceContext: function (trackerId, context) {\n resourceTrackerManager.appendResourceContext(trackerId, context)\n },\n finishResource: function (trackerId) {\n resourceTrackerManager.finishResource(trackerId)\n },\n getResource: function (trackerId) {\n return resourceTrackerManager.getResource(trackerId)\n }\n }\n}\n\nfunction overrideInitConfigurationForBridge(initConfiguration) {\n return assign({}, initConfiguration, {\n applicationId: '00000000-aaaa-0000-aaaa-000000000000',\n clientToken: 'empty',\n sessionSampleRate: 100,\n defaultPrivacyLevel:\n initConfiguration.defaultPrivacyLevel ??\n getEventBridge()?.getPrivacyLevel()\n })\n}\n"],"mappings":"AAAA,SACEA,mBAAmB,EACnBC,OAAO,EACPC,iBAAiB,EACjBC,8BAA8B,EAC9BC,uBAAuB,EACvBC,IAAI,EACJC,YAAY,EACZC,SAAS,EACTC,MAAM,EACNC,yBAAyB,EACzBC,mBAAmB,EACnBC,SAAS,EACTC,gCAAgC,EAChCC,cAAc,EACdC,OAAO,QACF,yBAAyB;AAChC,SAASC,gCAAgC,QAAQ,yBAAyB;AAC1E,SAASC,mBAAmB,EAAEC,eAAe,QAAQ,mBAAmB;AAExE,OAAO,SAASC,sBAAsBA,CACpCC,mBAAmB,EACnBC,gBAAgB,EAChBC,UAAU,EACV;EACA,IAAIC,mCAAmC,GACrCH,mBAAmB,CAACG,mCAAmC;EACzD,IAAIC,sBAAsB,GAAGJ,mBAAmB,CAACI,sBAAsB;EACvE,IAAIC,yBAAyB,GAAGL,mBAAmB,CAACK,yBAAyB;EAC7E,IAAIC,cAAc,GAAGzB,mBAAmB,CAAC,CAAC;EAC1C,IAAI0B,2BAA2B,GAAG1B,mBAAmB,CAAC,CAAC;EACvD,IAAI2B,kBAAkB;EAEtB,IAAIC,iBAAiB;EAErB,IAAIC,uBAAuB;EAC3B,IAAIC,mBAAmB;EACvB,IAAIC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Aa,EAAE,sCAAsC;IACrDC,WAAW,EAAE,OAAO;IACpBC,iBAAiB,EAAE,GAAG;IACtBC,mBAAmB,GAAAL,qBAAA,GACjBrD,iBAAiB,CAAC0D,mBAAmB,cAAAL,qBAAA,cAAAA,qBAAA,IAAAC,eAAA,GACrCtF,cAAc,CAAC,CAAC,cAAAsF,eAAA,uBAAhBA,eAAA,CAAkBK,eAAe,CAAC;EACtC,CAAC,CAAC;AACJ","ignoreList":[]}
|
package/esm/boot/recorderApi.js
CHANGED
|
@@ -20,9 +20,10 @@ export function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {
|
|
|
20
20
|
var state = {
|
|
21
21
|
status: RecorderStatus.Stopped
|
|
22
22
|
};
|
|
23
|
-
var startStrategy = function startStrategy() {
|
|
23
|
+
var startStrategy = function startStrategy(options) {
|
|
24
24
|
state = {
|
|
25
|
-
status: RecorderStatus.IntentToStart
|
|
25
|
+
status: RecorderStatus.IntentToStart,
|
|
26
|
+
options: options
|
|
26
27
|
};
|
|
27
28
|
};
|
|
28
29
|
var stopStrategy = function stopStrategy() {
|
|
@@ -78,9 +79,11 @@ export function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {
|
|
|
78
79
|
onRumStart: function onRumStart(lifeCycle, configuration, sessionManager, viewContexts, worker) {
|
|
79
80
|
lifeCycle.subscribe(LifeCycleEventType.SESSION_EXPIRED, function () {
|
|
80
81
|
if (state.status === RecorderStatus.Starting || state.status === RecorderStatus.Started) {
|
|
82
|
+
var options = state.options;
|
|
81
83
|
stopStrategy();
|
|
82
84
|
state = {
|
|
83
|
-
status: RecorderStatus.IntentToStart
|
|
85
|
+
status: RecorderStatus.IntentToStart,
|
|
86
|
+
options: options
|
|
84
87
|
};
|
|
85
88
|
}
|
|
86
89
|
});
|
|
@@ -91,9 +94,18 @@ export function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {
|
|
|
91
94
|
});
|
|
92
95
|
lifeCycle.subscribe(LifeCycleEventType.SESSION_RENEWED, function () {
|
|
93
96
|
if (state.status === RecorderStatus.IntentToStart) {
|
|
94
|
-
startStrategy();
|
|
97
|
+
startStrategy(state.options);
|
|
95
98
|
}
|
|
96
99
|
});
|
|
100
|
+
if (sessionManager.sessionStateUpdateObservable) {
|
|
101
|
+
sessionManager.sessionStateUpdateObservable.subscribe(function (_ref) {
|
|
102
|
+
var previousState = _ref.previousState,
|
|
103
|
+
newState = _ref.newState;
|
|
104
|
+
if (state.status === RecorderStatus.IntentToStart && !previousState.forcedSession && newState.forcedSession) {
|
|
105
|
+
startStrategy(state.options);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
97
109
|
var cachedDeflateEncoder;
|
|
98
110
|
function getOrCreateDeflateEncoder() {
|
|
99
111
|
if (!cachedDeflateEncoder) {
|
|
@@ -109,18 +121,31 @@ export function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {
|
|
|
109
121
|
return cachedDeflateEncoder;
|
|
110
122
|
}
|
|
111
123
|
startStrategy = function startStrategy(options) {
|
|
124
|
+
if (state.status === RecorderStatus.Starting || state.status === RecorderStatus.Started) {
|
|
125
|
+
if (options && options.force) {
|
|
126
|
+
sessionManager.setForcedSession();
|
|
127
|
+
}
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (options && options.force) {
|
|
131
|
+
// A forced session renewal emits SESSION_RENEWED synchronously. Leave
|
|
132
|
+
// the intent state temporarily to avoid starting the recorder twice.
|
|
133
|
+
state = {
|
|
134
|
+
status: RecorderStatus.Stopped
|
|
135
|
+
};
|
|
136
|
+
sessionManager.setForcedSession();
|
|
137
|
+
}
|
|
112
138
|
var session = sessionManager.findTrackedSession();
|
|
113
139
|
if (!session || !session.sessionReplayAllowed) {
|
|
114
140
|
state = {
|
|
115
|
-
status: RecorderStatus.IntentToStart
|
|
141
|
+
status: RecorderStatus.IntentToStart,
|
|
142
|
+
options: options
|
|
116
143
|
};
|
|
117
144
|
return;
|
|
118
145
|
}
|
|
119
|
-
if (state.status === RecorderStatus.Starting || state.status === RecorderStatus.Started) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
146
|
state = {
|
|
123
|
-
status: RecorderStatus.Starting
|
|
147
|
+
status: RecorderStatus.Starting,
|
|
148
|
+
options: options
|
|
124
149
|
};
|
|
125
150
|
runOnReadyState('interactive', function () {
|
|
126
151
|
if (state.status !== RecorderStatus.Starting) {
|
|
@@ -242,7 +267,7 @@ export function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {
|
|
|
242
267
|
}
|
|
243
268
|
};
|
|
244
269
|
if (state.status === RecorderStatus.IntentToStart) {
|
|
245
|
-
startStrategy();
|
|
270
|
+
startStrategy(state.options);
|
|
246
271
|
}
|
|
247
272
|
},
|
|
248
273
|
takeSubsequentFullSnapshot: function takeSubsequentFullSnapshot() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recorderApi.js","names":["noop","runOnReadyState","LifeCycleEventType","canUseEventBridge","bridgeSupports","BridgeCapability","PageExitReason","makeRecorderApiStub","getReplayStats","getReplayStatsImpl","createDeflateEncoder","startDeflateWorker","DeflateWorkerStatus","getDeflateWorkerStatus","DeflateEncoderStreamId","RecorderStatus","Stopped","IntentToStart","Starting","Started","makeRecorderApi","startRecordingImpl","createDeflateWorkerImpl","RECORDS","isBrowserSupported","state","status","startStrategy","stopStrategy","takeSubsequentFullSnapshot","snapshotCanvas","ok","reason","getSerializedNodeIdForDebug","undefined","getLastAutoCanvasSnapshotResultForDebug","getAutoCanvasSnapshotDebugHistoryForDebug","getLastCanvasMutationForDebug","getCanvasMutationHistoryForDebug","getLastDomMutationForDebug","getDomMutationHistoryForDebug","getLastReplaySegmentFlushForDebug","getReplaySegmentFlushHistoryForDebug","getReplayPerformanceForDebug","flushReplayMutationsForDebug","start","options","stop","onRumStart","lifeCycle","configuration","sessionManager","viewContexts","worker","subscribe","SESSION_EXPIRED","PAGE_EXITED","pageExitEvent","UNLOADING","SESSION_RENEWED","cachedDeflateEncoder","getOrCreateDeflateEncoder","REPLAY","session","findTrackedSession","sessionReplayAllowed","deflateEncoder","recordingImpl","stopRecording","canvas","node","isRecording","Initialized","viewId","Array","from","CSSSupportsRule","URL","createObjectURL","NodeList","prototype"],"sources":["../../src/boot/recorderApi.js"],"sourcesContent":["import {\n noop,\n runOnReadyState,\n LifeCycleEventType,\n canUseEventBridge,\n bridgeSupports,\n BridgeCapability,\n PageExitReason\n} from '@cloudcare/browser-core'\n\nimport { makeRecorderApiStub } from './recorderApiStub'\nimport { getReplayStats as getReplayStatsImpl } from '../domain/replay/replayStats'\nimport {\n createDeflateEncoder,\n startDeflateWorker,\n DeflateWorkerStatus,\n getDeflateWorkerStatus,\n DeflateEncoderStreamId\n} from '../domain/deflate'\nvar RecorderStatus = {\n // The recorder is stopped.\n Stopped: 0,\n // The user started the recording while it wasn't possible yet. The recorder should start as soon\n // as possible.\n IntentToStart: 1,\n // The recorder is starting. It does not record anything yet.\n Starting: 2,\n // The recorder is started, it records the session.\n Started: 3\n}\n\nexport function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {\n if (\n (canUseEventBridge() && !bridgeSupports(BridgeCapability.RECORDS)) ||\n !isBrowserSupported()\n ) {\n return makeRecorderApiStub()\n }\n\n var state = {\n status: RecorderStatus.Stopped\n }\n\n var startStrategy = function () {\n state = { status: RecorderStatus.IntentToStart }\n }\n var stopStrategy = function () {\n state = { status: RecorderStatus.Stopped }\n }\n var takeSubsequentFullSnapshot = function () {}\n var snapshotCanvas = function () {\n return {\n ok: false,\n reason: 'not_recording'\n }\n }\n var getSerializedNodeIdForDebug = function () {\n return undefined\n }\n var getLastAutoCanvasSnapshotResultForDebug = function () {\n return undefined\n }\n var getAutoCanvasSnapshotDebugHistoryForDebug = function () {\n return undefined\n }\n var getLastCanvasMutationForDebug = function () {\n return undefined\n }\n var getCanvasMutationHistoryForDebug = function () {\n return undefined\n }\n var getLastDomMutationForDebug = function () {\n return undefined\n }\n var getDomMutationHistoryForDebug = function () {\n return undefined\n }\n var getLastReplaySegmentFlushForDebug = function () {\n return undefined\n }\n var getReplaySegmentFlushHistoryForDebug = function () {\n return undefined\n }\n var getReplayPerformanceForDebug = function () {\n return undefined\n }\n var flushReplayMutationsForDebug = noop\n return {\n start: function (options) {\n startStrategy(options)\n },\n stop: function () {\n stopStrategy()\n },\n\n onRumStart: function (\n lifeCycle,\n configuration,\n sessionManager,\n viewContexts,\n worker\n ) {\n lifeCycle.subscribe(LifeCycleEventType.SESSION_EXPIRED, function () {\n if (\n state.status === RecorderStatus.Starting ||\n state.status === RecorderStatus.Started\n ) {\n stopStrategy()\n state = { status: RecorderStatus.IntentToStart }\n }\n })\n lifeCycle.subscribe(\n LifeCycleEventType.PAGE_EXITED,\n function (pageExitEvent) {\n if (pageExitEvent.reason === PageExitReason.UNLOADING) {\n stopStrategy()\n }\n }\n )\n lifeCycle.subscribe(LifeCycleEventType.SESSION_RENEWED, function () {\n if (state.status === RecorderStatus.IntentToStart) {\n startStrategy()\n }\n })\n var cachedDeflateEncoder\n function getOrCreateDeflateEncoder() {\n if (!cachedDeflateEncoder) {\n if (!worker) {\n worker = startDeflateWorker(\n configuration,\n 'Session Replay',\n function () {\n stopStrategy()\n },\n createDeflateWorkerImpl\n )\n }\n if (worker) {\n cachedDeflateEncoder = createDeflateEncoder(\n worker,\n DeflateEncoderStreamId.REPLAY\n )\n }\n }\n return cachedDeflateEncoder\n }\n startStrategy = function (options) {\n var session = sessionManager.findTrackedSession()\n if (!session || !session.sessionReplayAllowed) {\n state = { status: RecorderStatus.IntentToStart }\n return\n }\n\n if (\n state.status === RecorderStatus.Starting ||\n state.status === RecorderStatus.Started\n ) {\n return\n }\n\n state = { status: RecorderStatus.Starting }\n\n runOnReadyState('interactive', function () {\n if (state.status !== RecorderStatus.Starting) {\n return\n }\n var deflateEncoder = getOrCreateDeflateEncoder()\n if (!deflateEncoder) {\n state = {\n status: RecorderStatus.Stopped\n }\n return\n }\n var recordingImpl = startRecordingImpl(\n lifeCycle,\n configuration,\n sessionManager,\n viewContexts,\n deflateEncoder\n )\n state = {\n status: RecorderStatus.Started,\n stopRecording: recordingImpl.stop,\n takeSubsequentFullSnapshot: recordingImpl.takeSubsequentFullSnapshot,\n snapshotCanvas: recordingImpl.snapshotCanvas || noop,\n getSerializedNodeIdForDebug:\n recordingImpl.getSerializedNodeIdForDebug || noop,\n getLastAutoCanvasSnapshotResultForDebug:\n recordingImpl.getLastAutoCanvasSnapshotResultForDebug || noop,\n getAutoCanvasSnapshotDebugHistoryForDebug:\n recordingImpl.getAutoCanvasSnapshotDebugHistoryForDebug || noop,\n getLastCanvasMutationForDebug:\n recordingImpl.getLastCanvasMutationForDebug || noop,\n getCanvasMutationHistoryForDebug:\n recordingImpl.getCanvasMutationHistoryForDebug || noop,\n getLastDomMutationForDebug:\n recordingImpl.getLastDomMutationForDebug || noop,\n getDomMutationHistoryForDebug:\n recordingImpl.getDomMutationHistoryForDebug || noop,\n getLastReplaySegmentFlushForDebug:\n recordingImpl.getLastReplaySegmentFlushForDebug || noop,\n getReplaySegmentFlushHistoryForDebug:\n recordingImpl.getReplaySegmentFlushHistoryForDebug || noop,\n getReplayPerformanceForDebug:\n recordingImpl.getReplayPerformanceForDebug || noop,\n flushReplayMutationsForDebug:\n recordingImpl.flushReplayMutationsForDebug || noop\n }\n })\n }\n\n stopStrategy = function () {\n if (state.status === RecorderStatus.Stopped) {\n return\n }\n\n if (state.status === RecorderStatus.Started) {\n state.stopRecording()\n }\n\n state = {\n status: RecorderStatus.Stopped\n }\n }\n takeSubsequentFullSnapshot = function () {\n state.takeSubsequentFullSnapshot()\n }\n snapshotCanvas = function (canvas, options) {\n if (state.status === RecorderStatus.Started) {\n return state.snapshotCanvas(canvas, options)\n }\n return {\n ok: false,\n reason: 'not_recording'\n }\n }\n getSerializedNodeIdForDebug = function (node) {\n if (state.status === RecorderStatus.Started) {\n return state.getSerializedNodeIdForDebug(node)\n }\n return undefined\n }\n getLastAutoCanvasSnapshotResultForDebug = function () {\n if (state.status === RecorderStatus.Started) {\n return state.getLastAutoCanvasSnapshotResultForDebug()\n }\n return undefined\n }\n getAutoCanvasSnapshotDebugHistoryForDebug = function () {\n if (state.status === RecorderStatus.Started) {\n return state.getAutoCanvasSnapshotDebugHistoryForDebug()\n }\n return undefined\n }\n getLastCanvasMutationForDebug = function () {\n if (state.status === RecorderStatus.Started) {\n return state.getLastCanvasMutationForDebug()\n }\n return undefined\n }\n getCanvasMutationHistoryForDebug = function () {\n if (state.status === RecorderStatus.Started) {\n return state.getCanvasMutationHistoryForDebug()\n }\n return undefined\n }\n getLastDomMutationForDebug = function () {\n if (state.status === RecorderStatus.Started) {\n return state.getLastDomMutationForDebug()\n }\n return undefined\n }\n getDomMutationHistoryForDebug = function () {\n if (state.status === RecorderStatus.Started) {\n return state.getDomMutationHistoryForDebug()\n }\n return undefined\n }\n getLastReplaySegmentFlushForDebug = function () {\n if (state.status === RecorderStatus.Started) {\n return state.getLastReplaySegmentFlushForDebug()\n }\n return undefined\n }\n getReplaySegmentFlushHistoryForDebug = function () {\n if (state.status === RecorderStatus.Started) {\n return state.getReplaySegmentFlushHistoryForDebug()\n }\n return undefined\n }\n getReplayPerformanceForDebug = function () {\n if (state.status === RecorderStatus.Started) {\n return state.getReplayPerformanceForDebug()\n }\n return undefined\n }\n flushReplayMutationsForDebug = function () {\n if (state.status === RecorderStatus.Started) {\n state.flushReplayMutationsForDebug()\n }\n }\n if (state.status === RecorderStatus.IntentToStart) {\n startStrategy()\n }\n },\n takeSubsequentFullSnapshot() {\n takeSubsequentFullSnapshot()\n },\n snapshotCanvas: function (canvas, options) {\n return snapshotCanvas(canvas, options)\n },\n getSerializedNodeIdForDebug: function (node) {\n return getSerializedNodeIdForDebug(node)\n },\n getLastReplaySegmentFlushForDebug: function () {\n return getLastReplaySegmentFlushForDebug()\n },\n getLastAutoCanvasSnapshotResultForDebug: function () {\n return getLastAutoCanvasSnapshotResultForDebug()\n },\n getAutoCanvasSnapshotDebugHistoryForDebug: function () {\n return getAutoCanvasSnapshotDebugHistoryForDebug()\n },\n getLastCanvasMutationForDebug: function () {\n return getLastCanvasMutationForDebug()\n },\n getCanvasMutationHistoryForDebug: function () {\n return getCanvasMutationHistoryForDebug()\n },\n getLastDomMutationForDebug: function () {\n return getLastDomMutationForDebug()\n },\n getDomMutationHistoryForDebug: function () {\n return getDomMutationHistoryForDebug()\n },\n getReplaySegmentFlushHistoryForDebug: function () {\n return getReplaySegmentFlushHistoryForDebug()\n },\n getReplayPerformanceForDebug: function () {\n return getReplayPerformanceForDebug()\n },\n flushReplayMutationsForDebug: function () {\n flushReplayMutationsForDebug()\n },\n isRecording: function () {\n return (\n getDeflateWorkerStatus() === DeflateWorkerStatus.Initialized &&\n state.status === RecorderStatus.Started\n )\n },\n getReplayStats: function (viewId) {\n return getDeflateWorkerStatus() === DeflateWorkerStatus.Initialized\n ? getReplayStatsImpl(viewId)\n : undefined\n }\n }\n}\n\n/**\n * Test for Browser features used while recording\n */\nfunction isBrowserSupported() {\n return (\n // Array.from is a bit less supported by browsers than CSSSupportsRule, but has higher chances\n // to be polyfilled. Test for both to be more confident. We could add more things if we find out\n // this test is not sufficient.\n typeof Array.from === 'function' &&\n typeof CSSSupportsRule === 'function' &&\n typeof URL.createObjectURL === 'function' &&\n 'forEach' in NodeList.prototype\n )\n}\n"],"mappings":"AAAA,SACEA,IAAI,EACJC,eAAe,EACfC,kBAAkB,EAClBC,iBAAiB,EACjBC,cAAc,EACdC,gBAAgB,EAChBC,cAAc,QACT,yBAAyB;AAEhC,SAASC,mBAAmB,QAAQ,mBAAmB;AACvD,SAASC,cAAc,IAAIC,kBAAkB,QAAQ,8BAA8B;AACnF,SACEC,oBAAoB,EACpBC,kBAAkB,EAClBC,mBAAmB,EACnBC,sBAAsB,EACtBC,sBAAsB,QACjB,mBAAmB;AAC1B,IAAIC,cAAc,GAAG;EACnB;EACAC,OAAO,EAAE,CAAC;EACV;EACA;EACAC,aAAa,EAAE,CAAC;EAChB;EACA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A,0BAA0BA,CAAA,EAAc;MACtC,OAAOA,2BAA0B,CAAC,CAAC;IACrC,CAAC;IACDC,6BAA6B,EAAE,SAA/BA,6BAA6BA,CAAA,EAAc;MACzC,OAAOA,8BAA6B,CAAC,CAAC;IACxC,CAAC;IACDE,oCAAoC,EAAE,SAAtCA,oCAAoCA,CAAA,EAAc;MAChD,OAAOA,qCAAoC,CAAC,CAAC;IAC/C,CAAC;IACDC,4BAA4B,EAAE,SAA9BA,4BAA4BA,CAAA,EAAc;MACxC,OAAOA,6BAA4B,CAAC,CAAC;IACvC,CAAC;IACDC,4BAA4B,EAAE,SAA9BA,4BAA4BA,CAAA,EAAc;MACxCA,6BAA4B,CAAC,CAAC;IAChC,CAAC;IACD2B,WAAW,EAAE,SAAbA,WAAWA,CAAA,EAAc;MACvB,OACE1D,sBAAsB,CAAC,CAAC,KAAKD,mBAAmB,CAAC4D,WAAW,IAC5D/C,KAAK,CAACC,MAAM,KAAKX,cAAc,CAACI,OAAO;IAE3C,CAAC;IACDX,cAAc,EAAE,SAAhBA,cAAcA,CAAYiE,MAAM,EAAE;MAChC,OAAO5D,sBAAsB,CAAC,CAAC,KAAKD,mBAAmB,CAAC4D,WAAW,GAC/D/D,kBAAkB,CAACgE,MAAM,CAAC,GAC1BvC,SAAS;IACf;EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA,SAASV,kBAAkBA,CAAA,EAAG;EAC5B;IACE;IACA;IACA;IACA,OAAOkD,KAAK,CAACC,IAAI,KAAK,UAAU,IAChC,OAAOC,eAAe,KAAK,UAAU,IACrC,OAAOC,GAAG,CAACC,eAAe,KAAK,UAAU,IACzC,SAAS,IAAIC,QAAQ,CAACC;EAAS;AAEnC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"recorderApi.js","names":["noop","runOnReadyState","LifeCycleEventType","canUseEventBridge","bridgeSupports","BridgeCapability","PageExitReason","makeRecorderApiStub","getReplayStats","getReplayStatsImpl","createDeflateEncoder","startDeflateWorker","DeflateWorkerStatus","getDeflateWorkerStatus","DeflateEncoderStreamId","RecorderStatus","Stopped","IntentToStart","Starting","Started","makeRecorderApi","startRecordingImpl","createDeflateWorkerImpl","RECORDS","isBrowserSupported","state","status","startStrategy","options","stopStrategy","takeSubsequentFullSnapshot","snapshotCanvas","ok","reason","getSerializedNodeIdForDebug","undefined","getLastAutoCanvasSnapshotResultForDebug","getAutoCanvasSnapshotDebugHistoryForDebug","getLastCanvasMutationForDebug","getCanvasMutationHistoryForDebug","getLastDomMutationForDebug","getDomMutationHistoryForDebug","getLastReplaySegmentFlushForDebug","getReplaySegmentFlushHistoryForDebug","getReplayPerformanceForDebug","flushReplayMutationsForDebug","start","stop","onRumStart","lifeCycle","configuration","sessionManager","viewContexts","worker","subscribe","SESSION_EXPIRED","PAGE_EXITED","pageExitEvent","UNLOADING","SESSION_RENEWED","sessionStateUpdateObservable","_ref","previousState","newState","forcedSession","cachedDeflateEncoder","getOrCreateDeflateEncoder","REPLAY","force","setForcedSession","session","findTrackedSession","sessionReplayAllowed","deflateEncoder","recordingImpl","stopRecording","canvas","node","isRecording","Initialized","viewId","Array","from","CSSSupportsRule","URL","createObjectURL","NodeList","prototype"],"sources":["../../src/boot/recorderApi.js"],"sourcesContent":["import {\n noop,\n runOnReadyState,\n LifeCycleEventType,\n canUseEventBridge,\n bridgeSupports,\n BridgeCapability,\n PageExitReason\n} from '@cloudcare/browser-core'\n\nimport { makeRecorderApiStub } from './recorderApiStub'\nimport { getReplayStats as getReplayStatsImpl } from '../domain/replay/replayStats'\nimport {\n createDeflateEncoder,\n startDeflateWorker,\n DeflateWorkerStatus,\n getDeflateWorkerStatus,\n DeflateEncoderStreamId\n} from '../domain/deflate'\nvar RecorderStatus = {\n // The recorder is stopped.\n Stopped: 0,\n // The user started the recording while it wasn't possible yet. The recorder should start as soon\n // as possible.\n IntentToStart: 1,\n // The recorder is starting. It does not record anything yet.\n Starting: 2,\n // The recorder is started, it records the session.\n Started: 3\n}\n\nexport function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {\n if (\n (canUseEventBridge() && !bridgeSupports(BridgeCapability.RECORDS)) ||\n !isBrowserSupported()\n ) {\n return makeRecorderApiStub()\n }\n\n var state = {\n status: RecorderStatus.Stopped\n }\n\n var startStrategy = function (options) {\n state = { status: RecorderStatus.IntentToStart, options: options }\n }\n var stopStrategy = function () {\n state = { status: RecorderStatus.Stopped }\n }\n var takeSubsequentFullSnapshot = function () {}\n var snapshotCanvas = function () {\n return {\n ok: false,\n reason: 'not_recording'\n }\n }\n var getSerializedNodeIdForDebug = function () {\n return undefined\n }\n var getLastAutoCanvasSnapshotResultForDebug = function () {\n return undefined\n }\n var getAutoCanvasSnapshotDebugHistoryForDebug = function () {\n return undefined\n }\n var getLastCanvasMutationForDebug = function () {\n return undefined\n }\n var getCanvasMutationHistoryForDebug = function () {\n return undefined\n }\n var getLastDomMutationForDebug = function () {\n return undefined\n }\n var getDomMutationHistoryForDebug = function () {\n return undefined\n }\n var getLastReplaySegmentFlushForDebug = function () {\n return undefined\n }\n var getReplaySegmentFlushHistoryForDebug = function () {\n return undefined\n }\n var getReplayPerformanceForDebug = function () {\n return undefined\n }\n var flushReplayMutationsForDebug = noop\n return {\n start: function (options) {\n startStrategy(options)\n },\n stop: function () {\n stopStrategy()\n },\n\n onRumStart: function (\n lifeCycle,\n configuration,\n sessionManager,\n viewContexts,\n worker\n ) {\n lifeCycle.subscribe(LifeCycleEventType.SESSION_EXPIRED, function () {\n if (\n state.status === RecorderStatus.Starting ||\n state.status === RecorderStatus.Started\n ) {\n var options = state.options\n stopStrategy()\n state = { status: RecorderStatus.IntentToStart, options: options }\n }\n })\n lifeCycle.subscribe(\n LifeCycleEventType.PAGE_EXITED,\n function (pageExitEvent) {\n if (pageExitEvent.reason === PageExitReason.UNLOADING) {\n stopStrategy()\n }\n }\n )\n lifeCycle.subscribe(LifeCycleEventType.SESSION_RENEWED, function () {\n if (state.status === RecorderStatus.IntentToStart) {\n startStrategy(state.options)\n }\n })\n if (sessionManager.sessionStateUpdateObservable) {\n sessionManager.sessionStateUpdateObservable.subscribe(function ({\n previousState,\n newState\n }) {\n if (\n state.status === RecorderStatus.IntentToStart &&\n !previousState.forcedSession &&\n newState.forcedSession\n ) {\n startStrategy(state.options)\n }\n })\n }\n var cachedDeflateEncoder\n function getOrCreateDeflateEncoder() {\n if (!cachedDeflateEncoder) {\n if (!worker) {\n worker = startDeflateWorker(\n configuration,\n 'Session Replay',\n function () {\n stopStrategy()\n },\n createDeflateWorkerImpl\n )\n }\n if (worker) {\n cachedDeflateEncoder = createDeflateEncoder(\n worker,\n DeflateEncoderStreamId.REPLAY\n )\n }\n }\n return cachedDeflateEncoder\n }\n startStrategy = function (options) {\n if (\n state.status === RecorderStatus.Starting ||\n state.status === RecorderStatus.Started\n ) {\n if (options && options.force) {\n sessionManager.setForcedSession()\n }\n return\n }\n\n if (options && options.force) {\n // A forced session renewal emits SESSION_RENEWED synchronously. Leave\n // the intent state temporarily to avoid starting the recorder twice.\n state = { status: RecorderStatus.Stopped }\n sessionManager.setForcedSession()\n }\n var session = sessionManager.findTrackedSession()\n if (!session || !session.sessionReplayAllowed) {\n state = { status: RecorderStatus.IntentToStart, options: options }\n return\n }\n\n state = { status: RecorderStatus.Starting, options: options }\n\n runOnReadyState('interactive', function () {\n if (state.status !== RecorderStatus.Starting) {\n return\n }\n var deflateEncoder = getOrCreateDeflateEncoder()\n if (!deflateEncoder) {\n state = {\n status: RecorderStatus.Stopped\n }\n return\n }\n var recordingImpl = startRecordingImpl(\n lifeCycle,\n configuration,\n sessionManager,\n viewContexts,\n deflateEncoder\n )\n state = {\n status: RecorderStatus.Started,\n stopRecording: recordingImpl.stop,\n takeSubsequentFullSnapshot: recordingImpl.takeSubsequentFullSnapshot,\n snapshotCanvas: recordingImpl.snapshotCanvas || noop,\n getSerializedNodeIdForDebug:\n recordingImpl.getSerializedNodeIdForDebug || noop,\n getLastAutoCanvasSnapshotResultForDebug:\n recordingImpl.getLastAutoCanvasSnapshotResultForDebug || noop,\n getAutoCanvasSnapshotDebugHistoryForDebug:\n recordingImpl.getAutoCanvasSnapshotDebugHistoryForDebug || noop,\n getLastCanvasMutationForDebug:\n recordingImpl.getLastCanvasMutationForDebug || noop,\n getCanvasMutationHistoryForDebug:\n recordingImpl.getCanvasMutationHistoryForDebug || noop,\n getLastDomMutationForDebug:\n recordingImpl.getLastDomMutationForDebug || noop,\n getDomMutationHistoryForDebug:\n recordingImpl.getDomMutationHistoryForDebug || noop,\n getLastReplaySegmentFlushForDebug:\n recordingImpl.getLastReplaySegmentFlushForDebug || noop,\n getReplaySegmentFlushHistoryForDebug:\n recordingImpl.getReplaySegmentFlushHistoryForDebug || noop,\n getReplayPerformanceForDebug:\n recordingImpl.getReplayPerformanceForDebug || noop,\n flushReplayMutationsForDebug:\n recordingImpl.flushReplayMutationsForDebug || noop\n }\n })\n }\n\n stopStrategy = function () {\n if (state.status === RecorderStatus.Stopped) {\n return\n }\n\n if (state.status === RecorderStatus.Started) {\n state.stopRecording()\n }\n\n state = {\n status: RecorderStatus.Stopped\n }\n }\n takeSubsequentFullSnapshot = function () {\n state.takeSubsequentFullSnapshot()\n }\n snapshotCanvas = function (canvas, options) {\n if (state.status === RecorderStatus.Started) {\n return state.snapshotCanvas(canvas, options)\n }\n return {\n ok: false,\n reason: 'not_recording'\n }\n }\n getSerializedNodeIdForDebug = function (node) {\n if (state.status === RecorderStatus.Started) {\n return state.getSerializedNodeIdForDebug(node)\n }\n return undefined\n }\n getLastAutoCanvasSnapshotResultForDebug = function () {\n if (state.status === RecorderStatus.Started) {\n return state.getLastAutoCanvasSnapshotResultForDebug()\n }\n return undefined\n }\n getAutoCanvasSnapshotDebugHistoryForDebug = function () {\n if (state.status === RecorderStatus.Started) {\n return state.getAutoCanvasSnapshotDebugHistoryForDebug()\n }\n return undefined\n }\n getLastCanvasMutationForDebug = function () {\n if (state.status === RecorderStatus.Started) {\n return state.getLastCanvasMutationForDebug()\n }\n return undefined\n }\n getCanvasMutationHistoryForDebug = function () {\n if (state.status === RecorderStatus.Started) {\n return state.getCanvasMutationHistoryForDebug()\n }\n return undefined\n }\n getLastDomMutationForDebug = function () {\n if (state.status === RecorderStatus.Started) {\n return state.getLastDomMutationForDebug()\n }\n return undefined\n }\n getDomMutationHistoryForDebug = function () {\n if (state.status === RecorderStatus.Started) {\n return state.getDomMutationHistoryForDebug()\n }\n return undefined\n }\n getLastReplaySegmentFlushForDebug = function () {\n if (state.status === RecorderStatus.Started) {\n return state.getLastReplaySegmentFlushForDebug()\n }\n return undefined\n }\n getReplaySegmentFlushHistoryForDebug = function () {\n if (state.status === RecorderStatus.Started) {\n return state.getReplaySegmentFlushHistoryForDebug()\n }\n return undefined\n }\n getReplayPerformanceForDebug = function () {\n if (state.status === RecorderStatus.Started) {\n return state.getReplayPerformanceForDebug()\n }\n return undefined\n }\n flushReplayMutationsForDebug = function () {\n if (state.status === RecorderStatus.Started) {\n state.flushReplayMutationsForDebug()\n }\n }\n if (state.status === RecorderStatus.IntentToStart) {\n startStrategy(state.options)\n }\n },\n takeSubsequentFullSnapshot() {\n takeSubsequentFullSnapshot()\n },\n snapshotCanvas: function (canvas, options) {\n return snapshotCanvas(canvas, options)\n },\n getSerializedNodeIdForDebug: function (node) {\n return getSerializedNodeIdForDebug(node)\n },\n getLastReplaySegmentFlushForDebug: function () {\n return getLastReplaySegmentFlushForDebug()\n },\n getLastAutoCanvasSnapshotResultForDebug: function () {\n return getLastAutoCanvasSnapshotResultForDebug()\n },\n getAutoCanvasSnapshotDebugHistoryForDebug: function () {\n return getAutoCanvasSnapshotDebugHistoryForDebug()\n },\n getLastCanvasMutationForDebug: function () {\n return getLastCanvasMutationForDebug()\n },\n getCanvasMutationHistoryForDebug: function () {\n return getCanvasMutationHistoryForDebug()\n },\n getLastDomMutationForDebug: function () {\n return getLastDomMutationForDebug()\n },\n getDomMutationHistoryForDebug: function () {\n return getDomMutationHistoryForDebug()\n },\n getReplaySegmentFlushHistoryForDebug: function () {\n return getReplaySegmentFlushHistoryForDebug()\n },\n getReplayPerformanceForDebug: function () {\n return getReplayPerformanceForDebug()\n },\n flushReplayMutationsForDebug: function () {\n flushReplayMutationsForDebug()\n },\n isRecording: function () {\n return (\n getDeflateWorkerStatus() === DeflateWorkerStatus.Initialized &&\n state.status === RecorderStatus.Started\n )\n },\n getReplayStats: function (viewId) {\n return getDeflateWorkerStatus() === DeflateWorkerStatus.Initialized\n ? getReplayStatsImpl(viewId)\n : undefined\n }\n }\n}\n\n/**\n * Test for Browser features used while recording\n */\nfunction isBrowserSupported() {\n return (\n // Array.from is a bit less supported by browsers than CSSSupportsRule, but has higher chances\n // to be polyfilled. Test for both to be more confident. We could add more things if we find out\n // this test is not sufficient.\n typeof Array.from === 'function' &&\n typeof CSSSupportsRule === 'function' &&\n typeof URL.createObjectURL === 'function' &&\n 'forEach' in NodeList.prototype\n )\n}\n"],"mappings":"AAAA,SACEA,IAAI,EACJC,eAAe,EACfC,kBAAkB,EAClBC,iBAAiB,EACjBC,cAAc,EACdC,gBAAgB,EAChBC,cAAc,QACT,yBAAyB;AAEhC,SAASC,mBAAmB,QAAQ,mBAAmB;AACvD,SAASC,cAAc,IAAIC,kBAAkB,QAAQ,8BAA8B;AACnF,SACEC,oBAAoB,EACpBC,kBAAkB,EAClBC,mBAAmB,EACnBC,sBAAsB,EACtBC,sBAAsB,QACjB,mBAAmB;AAC1B,IAAIC,cAAc,GAAG;EACnB;EACAC,OAAO,EAAE,CAAC;EACV;EACA;EACAC,aAAa,EAAE,CAAC;EAChB;EACAC,QAAQ,EAAE,CAAC;EACX;EACAC,OAAO,EAAE;AACX,CAAC;AAED,OAAO,SAASC,eAAeA,CAACC,kBAAkB,EAAEC,uBAAuB,EAAE;EAC3E,IACGnB,iBAAiB,CAAC,CAAC,IAAI,CAACC,cAAc,CAACC,gBAAgB,CAACkB,OAAO,CAAC,IACjE,CAACC,kBAAkB,CAAC,CAAC,EACrB;IACA,OAAOjB,mBAAmB,CAAC,CAAC;EAC9B;EA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EAAE,SAAhBA,cAAcA,CAAYwE,MAAM,EAAE;MAChC,OAAOnE,sBAAsB,CAAC,CAAC,KAAKD,mBAAmB,CAACmE,WAAW,GAC/DtE,kBAAkB,CAACuE,MAAM,CAAC,GAC1B7C,SAAS;IACf;EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA,SAASX,kBAAkBA,CAAA,EAAG;EAC5B;IACE;IACA;IACA;IACA,OAAOyD,KAAK,CAACC,IAAI,KAAK,UAAU,IAChC,OAAOC,eAAe,KAAK,UAAU,IACrC,OAAOC,GAAG,CAACC,eAAe,KAAK,UAAU,IACzC,SAAS,IAAIC,QAAQ,CAACC;EAAS;AAEnC","ignoreList":[]}
|
package/esm/boot/rum.js
CHANGED
|
@@ -19,6 +19,7 @@ import { startErrorCollection } from '../domain/rumEventsCollection/error/errorC
|
|
|
19
19
|
import { startViewCollection } from '../domain/rumEventsCollection/view/viewCollection';
|
|
20
20
|
import { startRequestCollection } from '../domain/requestCollection';
|
|
21
21
|
import { startResourceCollection } from '../domain/rumEventsCollection/resource/resourceCollection';
|
|
22
|
+
import { startWebSocketCollection } from '../domain/rumEventsCollection/resource/webSocketCollection';
|
|
22
23
|
export function startRum(configuration, recorderApi, customerDataTrackerManager, getCommonContext, initialViewOptions, createEncoder, resourceTrackerManager) {
|
|
23
24
|
var cleanupTasks = [];
|
|
24
25
|
var lifeCycle = new LifeCycle();
|
|
@@ -85,6 +86,10 @@ export function startRum(configuration, recorderApi, customerDataTrackerManager,
|
|
|
85
86
|
var _startResourceCollection = startResourceCollection(lifeCycle, configuration, pageStateHistory, undefined, undefined, resourceTrackerManager);
|
|
86
87
|
var addResource = _startResourceCollection.addResource;
|
|
87
88
|
cleanupTasks.push(_startResourceCollection.stop);
|
|
89
|
+
if (configuration.trackWebSockets) {
|
|
90
|
+
var webSocketCollection = startWebSocketCollection(lifeCycle, viewContexts);
|
|
91
|
+
cleanupTasks.unshift(webSocketCollection.stop);
|
|
92
|
+
}
|
|
88
93
|
if (PerformanceObserver.supportedEntryTypes && PerformanceObserver.supportedEntryTypes.includes(RumPerformanceEntryType.LONG_ANIMATION_FRAME)) {
|
|
89
94
|
var longAnimationFrameCollection = startLongAnimationFrameCollection(lifeCycle, configuration);
|
|
90
95
|
cleanupTasks.push(longAnimationFrameCollection.stop);
|
|
@@ -115,6 +120,9 @@ export function startRum(configuration, recorderApi, customerDataTrackerManager,
|
|
|
115
120
|
stopSession: function stopSession() {
|
|
116
121
|
session.expire();
|
|
117
122
|
},
|
|
123
|
+
startSession: function startSession(options) {
|
|
124
|
+
session.startSession(options);
|
|
125
|
+
},
|
|
118
126
|
getInternalContext: internalContext.get,
|
|
119
127
|
stop: function stop() {
|
|
120
128
|
cleanupTasks.forEach(function (task) {
|
package/esm/boot/rum.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rum.js","names":["startRumSessionManager","startRumSessionManagerStub","startCacheUsrCache","LifeCycle","LifeCycleEventType","createPageExitObservable","canUseEventBridge","startTelemetry","TelemetryService","drainPreStartTelemetry","createDOMMutationObservable","createLocationChangeObservable","startLongTaskCollection","startLongAnimationFrameCollection","RumPerformanceEntryType","startActionCollection","startRumBatch","startRumEventBridge","startRumAssembly","startDisplayContext","startInternalContext","startUrlContexts","startViewContexts","startPageStateHistory","startErrorCollection","startViewCollection","startRequestCollection","startResourceCollection","startRum","configuration","recorderApi","customerDataTrackerManager","getCommonContext","initialViewOptions","createEncoder","resourceTrackerManager","cleanupTasks","lifeCycle","telemetry","startRumTelemetry","reportError","error","notify","RAW_ERROR_COLLECTED","pageExitObservable","pageExitSubscription","subscribe","event","PAGE_EXITED","push","unsubscribe","session","batch","observable","expireObservable","stop","userSession","domMutationObservable","locationChangeObservable","location","pageStateHistory","_startRumEventCollection","startRumEventCollection","viewContexts","urlContexts","actionContexts","stopRumEventCollection","addAction","setContextProvider","application","id","applicationId","findTrackedSession","view","findView","action","findActionId","ids","findAllActionId","_startViewCollection","addTiming","startView","setViewName","setViewContext","setViewContextProperty","getViewContext","stopViewCollection","_startResourceCollection","undefined","addResource","PerformanceObserver","supportedEntryTypes","includes","LONG_ANIMATION_FRAME","longAnimationFrameCollection","_startErrorCollection","addError","internalContext","setForcedSession","stopSession","expire","getInternalContext","get","forEach","task","createResourceTrackerId","createTrackerId","setResourceContext","trackerId","context","appendResourceContext","finishResource","getResource","RUM","sessionManager","userSessionManager","_startActionCollection","displayContext"],"sources":["../../src/boot/rum.js"],"sourcesContent":["import {\n startRumSessionManager,\n startRumSessionManagerStub\n} from '../domain/rumSessionManager'\nimport { startCacheUsrCache } from '../domain/usr'\nimport {\n LifeCycle,\n LifeCycleEventType,\n createPageExitObservable,\n canUseEventBridge,\n startTelemetry,\n TelemetryService,\n drainPreStartTelemetry\n} from '@cloudcare/browser-core'\nimport { createDOMMutationObservable } from '../domain/domMutationObservable.js'\nimport { createLocationChangeObservable } from '../domain/locationChangeObservable'\nimport { startLongTaskCollection } from '../domain/rumEventsCollection/longTask/longTaskCollection'\nimport { startLongAnimationFrameCollection } from '../domain/rumEventsCollection/longTask/longAnimationFrameCollection'\nimport { RumPerformanceEntryType } from '../domain/performanceObservable'\nimport { startActionCollection } from '../domain/rumEventsCollection/actions/actionCollection'\nimport { startRumBatch } from '../transport/startRumBatch'\nimport { startRumEventBridge } from '../transport/startRumEventBridge'\nimport { startRumAssembly } from '../domain/assembly'\nimport { startDisplayContext } from '../domain/contexts/displayContext.js'\nimport { startInternalContext } from '../domain/contexts/internalContext'\nimport { startUrlContexts } from '../domain/contexts/urlContexts'\nimport { startViewContexts } from '../domain/contexts/viewContexts'\nimport { startPageStateHistory } from '../domain/contexts/pageStateHistory'\nimport { startErrorCollection } from '../domain/rumEventsCollection/error/errorCollection'\nimport { startViewCollection } from '../domain/rumEventsCollection/view/viewCollection'\nimport { startRequestCollection } from '../domain/requestCollection'\nimport { startResourceCollection } from '../domain/rumEventsCollection/resource/resourceCollection'\n\nexport function startRum(\n configuration,\n recorderApi,\n customerDataTrackerManager,\n getCommonContext,\n initialViewOptions,\n createEncoder,\n resourceTrackerManager\n) {\n var cleanupTasks = []\n var lifeCycle = new LifeCycle()\n var telemetry = startRumTelemetry(configuration)\n\n var reportError = function (error) {\n lifeCycle.notify(LifeCycleEventType.RAW_ERROR_COLLECTED, { error: error })\n }\n var pageExitObservable = createPageExitObservable()\n var pageExitSubscription = pageExitObservable.subscribe(function (event) {\n lifeCycle.notify(LifeCycleEventType.PAGE_EXITED, event)\n })\n cleanupTasks.push(function () {\n pageExitSubscription.unsubscribe()\n })\n var session = !canUseEventBridge()\n ? startRumSessionManager(configuration, lifeCycle)\n : startRumSessionManagerStub()\n if (!canUseEventBridge()) {\n var batch = startRumBatch(\n configuration,\n lifeCycle,\n telemetry.observable,\n reportError,\n pageExitObservable,\n session.expireObservable,\n createEncoder\n )\n cleanupTasks.push(function () {\n batch.stop()\n })\n } else {\n startRumEventBridge(lifeCycle)\n }\n\n var userSession = startCacheUsrCache(configuration)\n var domMutationObservable = createDOMMutationObservable()\n var locationChangeObservable = createLocationChangeObservable(location)\n var pageStateHistory = startPageStateHistory()\n var _startRumEventCollection = startRumEventCollection(\n lifeCycle,\n configuration,\n location,\n session,\n userSession,\n pageStateHistory,\n locationChangeObservable,\n domMutationObservable,\n getCommonContext,\n reportError\n )\n var viewContexts = _startRumEventCollection.viewContexts\n var urlContexts = _startRumEventCollection.urlContexts\n var actionContexts = _startRumEventCollection.actionContexts\n var stopRumEventCollection = _startRumEventCollection.stop\n var addAction = _startRumEventCollection.addAction\n cleanupTasks.push(stopRumEventCollection)\n drainPreStartTelemetry()\n\n telemetry.setContextProvider(function () {\n return {\n application: {\n id: configuration.applicationId\n },\n session: {\n id: session.findTrackedSession() && session.findTrackedSession().id\n },\n view: {\n id: viewContexts.findView() && viewContexts.findView().id\n },\n action: {\n id: actionContexts.findActionId(),\n ids: actionContexts.findAllActionId()\n }\n }\n })\n const {\n addTiming,\n startView,\n setViewName,\n setViewContext,\n setViewContextProperty,\n getViewContext,\n stop: stopViewCollection\n } = startViewCollection(\n lifeCycle,\n configuration,\n location,\n domMutationObservable,\n locationChangeObservable,\n pageStateHistory,\n recorderApi,\n initialViewOptions\n )\n cleanupTasks.push(stopViewCollection)\n\n const _startResourceCollection = startResourceCollection(\n lifeCycle,\n configuration,\n pageStateHistory,\n undefined,\n undefined,\n resourceTrackerManager\n )\n var addResource = _startResourceCollection.addResource\n cleanupTasks.push(_startResourceCollection.stop)\n if (\n PerformanceObserver.supportedEntryTypes &&\n PerformanceObserver.supportedEntryTypes.includes(\n RumPerformanceEntryType.LONG_ANIMATION_FRAME\n )\n ) {\n var longAnimationFrameCollection = startLongAnimationFrameCollection(\n lifeCycle,\n configuration\n )\n cleanupTasks.push(longAnimationFrameCollection.stop)\n } else {\n startLongTaskCollection(lifeCycle, configuration)\n }\n\n var _startErrorCollection = startErrorCollection(\n lifeCycle,\n configuration,\n session,\n pageStateHistory\n )\n var addError = _startErrorCollection.addError\n startRequestCollection(lifeCycle, configuration, session)\n\n var internalContext = startInternalContext(\n configuration.applicationId,\n session,\n viewContexts,\n actionContexts,\n urlContexts\n )\n return {\n addResource: addResource,\n addAction: addAction,\n addError: addError,\n addTiming: addTiming,\n configuration: configuration,\n startView,\n setViewContext,\n setViewContextProperty,\n getViewContext,\n setViewName,\n lifeCycle: lifeCycle,\n viewContexts: viewContexts,\n session: session,\n setForcedSession: function () {\n session.setForcedSession()\n },\n stopSession: function () {\n session.expire()\n },\n getInternalContext: internalContext.get,\n stop: function () {\n cleanupTasks.forEach(function (task) {\n task()\n })\n },\n createResourceTrackerId: function () {\n return resourceTrackerManager.createTrackerId()\n },\n setResourceContext: function (trackerId, context) {\n resourceTrackerManager.setResourceContext(trackerId, context)\n },\n appendResourceContext: function (trackerId, context) {\n resourceTrackerManager.appendResourceContext(trackerId, context)\n },\n finishResource: function (trackerId) {\n resourceTrackerManager.finishResource(trackerId)\n },\n getResource: function (trackerId) {\n return resourceTrackerManager.getResource(trackerId)\n }\n }\n}\nfunction startRumTelemetry(configuration) {\n const telemetry = startTelemetry(TelemetryService.RUM, configuration)\n // if (canUseEventBridge()) {\n // const bridge = getEventBridge()\n // telemetry.observable.subscribe((event) =>\n // bridge.send('internal_telemetry', event)\n // )\n // }\n return telemetry\n}\n\nexport function startRumEventCollection(\n lifeCycle,\n configuration,\n location,\n sessionManager,\n userSessionManager,\n pageStateHistory,\n locationChangeObservable,\n domMutationObservable,\n getCommonContext,\n reportError\n) {\n var viewContexts = startViewContexts(lifeCycle)\n var urlContexts = startUrlContexts(\n lifeCycle,\n locationChangeObservable,\n location\n )\n\n var _startActionCollection = startActionCollection(\n lifeCycle,\n domMutationObservable,\n configuration,\n pageStateHistory\n )\n var actionContexts = _startActionCollection.actionContexts\n var addAction = _startActionCollection.addAction\n\n var displayContext = startDisplayContext()\n startRumAssembly(\n configuration,\n lifeCycle,\n sessionManager,\n userSessionManager,\n viewContexts,\n urlContexts,\n actionContexts,\n displayContext,\n getCommonContext,\n reportError\n )\n return {\n viewContexts: viewContexts,\n urlContexts: urlContexts,\n pageStateHistory: pageStateHistory,\n addAction: addAction,\n actionContexts: actionContexts,\n stop: function () {\n displayContext.stop()\n pageStateHistory.stop()\n urlContexts.stop()\n viewContexts.stop()\n }\n }\n}\n"],"mappings":"AAAA,SACEA,sBAAsB,EACtBC,0BAA0B,QACrB,6BAA6B;AACpC,SAASC,kBAAkB,QAAQ,eAAe;AAClD,SACEC,SAAS,EACTC,kBAAkB,EAClBC,wBAAwB,EACxBC,iBAAiB,EACjBC,cAAc,EACdC,gBAAgB,EAChBC,sBAAsB,QACjB,yBAAyB;AAChC,SAASC,2BAA2B,QAAQ,oCAAoC;AAChF,SAASC,8BAA8B,QAAQ,oCAAoC;AACnF,SAASC,uBAAuB,QAAQ,2DAA2D;AACnG,SAASC,iCAAiC,QAAQ,qEAAqE;AACvH,SAASC,uBAAuB,QAAQ,iCAAiC;AACzE,SAASC,qBAAqB,QAAQ,wDAAwD;AAC9F,SAASC,aAAa,QAAQ,4BAA4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CgB,SAAS,EACTqB,wBAAwB,EACxBC,QACF,CAAC;EAED,IAAIyD,sBAAsB,GAAGrG,qBAAqB,CAChDsB,SAAS,EACToB,qBAAqB,EACrB5B,aAAa,EACb+B,gBACF,CAAC;EACD,IAAIK,cAAc,GAAGmD,sBAAsB,CAACnD,cAAc;EAC1D,IAAIE,SAAS,GAAGiD,sBAAsB,CAACjD,SAAS;EAEhD,IAAIkD,cAAc,GAAGlG,mBAAmB,CAAC,CAAC;EAC1CD,gBAAgB,CACdW,aAAa,EACbQ,SAAS,EACT6E,cAAc,EACdC,kBAAkB,EAClBpD,YAAY,EACZC,WAAW,EACXC,cAAc,EACdoD,cAAc,EACdrF,gBAAgB,EAChBQ,WACF,CAAC;EACD,OAAO;IACLuB,YAAY,EAAEA,YAAY;IAC1BC,WAAW,EAAEA,WAAW;IACxBJ,gBAAgB,EAAEA,gBAAgB;IAClCO,SAAS,EAAEA,SAAS;IACpBF,cAAc,EAAEA,cAAc;IAC9BV,IAAI,EAAE,SAANA,IAAIA,CAAA,EAAc;MAChB8D,cAAc,CAAC9D,IAAI,CAAC,CAAC;MACrBK,gBAAgB,CAACL,IAAI,CAAC,CAAC;MACvBS,WAAW,CAACT,IAAI,CAAC,CAAC;MAClBQ,YAAY,CAACR,IAAI,CAAC,CAAC;IACrB;EACF,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"rum.js","names":["startRumSessionManager","startRumSessionManagerStub","startCacheUsrCache","LifeCycle","LifeCycleEventType","createPageExitObservable","canUseEventBridge","startTelemetry","TelemetryService","drainPreStartTelemetry","createDOMMutationObservable","createLocationChangeObservable","startLongTaskCollection","startLongAnimationFrameCollection","RumPerformanceEntryType","startActionCollection","startRumBatch","startRumEventBridge","startRumAssembly","startDisplayContext","startInternalContext","startUrlContexts","startViewContexts","startPageStateHistory","startErrorCollection","startViewCollection","startRequestCollection","startResourceCollection","startWebSocketCollection","startRum","configuration","recorderApi","customerDataTrackerManager","getCommonContext","initialViewOptions","createEncoder","resourceTrackerManager","cleanupTasks","lifeCycle","telemetry","startRumTelemetry","reportError","error","notify","RAW_ERROR_COLLECTED","pageExitObservable","pageExitSubscription","subscribe","event","PAGE_EXITED","push","unsubscribe","session","batch","observable","expireObservable","stop","userSession","domMutationObservable","locationChangeObservable","location","pageStateHistory","_startRumEventCollection","startRumEventCollection","viewContexts","urlContexts","actionContexts","stopRumEventCollection","addAction","setContextProvider","application","id","applicationId","findTrackedSession","view","findView","action","findActionId","ids","findAllActionId","_startViewCollection","addTiming","startView","setViewName","setViewContext","setViewContextProperty","getViewContext","stopViewCollection","_startResourceCollection","undefined","addResource","trackWebSockets","webSocketCollection","unshift","PerformanceObserver","supportedEntryTypes","includes","LONG_ANIMATION_FRAME","longAnimationFrameCollection","_startErrorCollection","addError","internalContext","setForcedSession","stopSession","expire","startSession","options","getInternalContext","get","forEach","task","createResourceTrackerId","createTrackerId","setResourceContext","trackerId","context","appendResourceContext","finishResource","getResource","RUM","sessionManager","userSessionManager","_startActionCollection","displayContext"],"sources":["../../src/boot/rum.js"],"sourcesContent":["import {\n startRumSessionManager,\n startRumSessionManagerStub\n} from '../domain/rumSessionManager'\nimport { startCacheUsrCache } from '../domain/usr'\nimport {\n LifeCycle,\n LifeCycleEventType,\n createPageExitObservable,\n canUseEventBridge,\n startTelemetry,\n TelemetryService,\n drainPreStartTelemetry\n} from '@cloudcare/browser-core'\nimport { createDOMMutationObservable } from '../domain/domMutationObservable.js'\nimport { createLocationChangeObservable } from '../domain/locationChangeObservable'\nimport { startLongTaskCollection } from '../domain/rumEventsCollection/longTask/longTaskCollection'\nimport { startLongAnimationFrameCollection } from '../domain/rumEventsCollection/longTask/longAnimationFrameCollection'\nimport { RumPerformanceEntryType } from '../domain/performanceObservable'\nimport { startActionCollection } from '../domain/rumEventsCollection/actions/actionCollection'\nimport { startRumBatch } from '../transport/startRumBatch'\nimport { startRumEventBridge } from '../transport/startRumEventBridge'\nimport { startRumAssembly } from '../domain/assembly'\nimport { startDisplayContext } from '../domain/contexts/displayContext.js'\nimport { startInternalContext } from '../domain/contexts/internalContext'\nimport { startUrlContexts } from '../domain/contexts/urlContexts'\nimport { startViewContexts } from '../domain/contexts/viewContexts'\nimport { startPageStateHistory } from '../domain/contexts/pageStateHistory'\nimport { startErrorCollection } from '../domain/rumEventsCollection/error/errorCollection'\nimport { startViewCollection } from '../domain/rumEventsCollection/view/viewCollection'\nimport { startRequestCollection } from '../domain/requestCollection'\nimport { startResourceCollection } from '../domain/rumEventsCollection/resource/resourceCollection'\nimport { startWebSocketCollection } from '../domain/rumEventsCollection/resource/webSocketCollection'\n\nexport function startRum(\n configuration,\n recorderApi,\n customerDataTrackerManager,\n getCommonContext,\n initialViewOptions,\n createEncoder,\n resourceTrackerManager\n) {\n var cleanupTasks = []\n var lifeCycle = new LifeCycle()\n var telemetry = startRumTelemetry(configuration)\n\n var reportError = function (error) {\n lifeCycle.notify(LifeCycleEventType.RAW_ERROR_COLLECTED, { error: error })\n }\n var pageExitObservable = createPageExitObservable()\n var pageExitSubscription = pageExitObservable.subscribe(function (event) {\n lifeCycle.notify(LifeCycleEventType.PAGE_EXITED, event)\n })\n cleanupTasks.push(function () {\n pageExitSubscription.unsubscribe()\n })\n var session = !canUseEventBridge()\n ? startRumSessionManager(configuration, lifeCycle)\n : startRumSessionManagerStub()\n if (!canUseEventBridge()) {\n var batch = startRumBatch(\n configuration,\n lifeCycle,\n telemetry.observable,\n reportError,\n pageExitObservable,\n session.expireObservable,\n createEncoder\n )\n cleanupTasks.push(function () {\n batch.stop()\n })\n } else {\n startRumEventBridge(lifeCycle)\n }\n\n var userSession = startCacheUsrCache(configuration)\n var domMutationObservable = createDOMMutationObservable()\n var locationChangeObservable = createLocationChangeObservable(location)\n var pageStateHistory = startPageStateHistory()\n var _startRumEventCollection = startRumEventCollection(\n lifeCycle,\n configuration,\n location,\n session,\n userSession,\n pageStateHistory,\n locationChangeObservable,\n domMutationObservable,\n getCommonContext,\n reportError\n )\n var viewContexts = _startRumEventCollection.viewContexts\n var urlContexts = _startRumEventCollection.urlContexts\n var actionContexts = _startRumEventCollection.actionContexts\n var stopRumEventCollection = _startRumEventCollection.stop\n var addAction = _startRumEventCollection.addAction\n cleanupTasks.push(stopRumEventCollection)\n drainPreStartTelemetry()\n\n telemetry.setContextProvider(function () {\n return {\n application: {\n id: configuration.applicationId\n },\n session: {\n id: session.findTrackedSession() && session.findTrackedSession().id\n },\n view: {\n id: viewContexts.findView() && viewContexts.findView().id\n },\n action: {\n id: actionContexts.findActionId(),\n ids: actionContexts.findAllActionId()\n }\n }\n })\n const {\n addTiming,\n startView,\n setViewName,\n setViewContext,\n setViewContextProperty,\n getViewContext,\n stop: stopViewCollection\n } = startViewCollection(\n lifeCycle,\n configuration,\n location,\n domMutationObservable,\n locationChangeObservable,\n pageStateHistory,\n recorderApi,\n initialViewOptions\n )\n cleanupTasks.push(stopViewCollection)\n\n const _startResourceCollection = startResourceCollection(\n lifeCycle,\n configuration,\n pageStateHistory,\n undefined,\n undefined,\n resourceTrackerManager\n )\n var addResource = _startResourceCollection.addResource\n cleanupTasks.push(_startResourceCollection.stop)\n if (configuration.trackWebSockets) {\n var webSocketCollection = startWebSocketCollection(\n lifeCycle,\n viewContexts\n )\n cleanupTasks.unshift(webSocketCollection.stop)\n }\n if (\n PerformanceObserver.supportedEntryTypes &&\n PerformanceObserver.supportedEntryTypes.includes(\n RumPerformanceEntryType.LONG_ANIMATION_FRAME\n )\n ) {\n var longAnimationFrameCollection = startLongAnimationFrameCollection(\n lifeCycle,\n configuration\n )\n cleanupTasks.push(longAnimationFrameCollection.stop)\n } else {\n startLongTaskCollection(lifeCycle, configuration)\n }\n\n var _startErrorCollection = startErrorCollection(\n lifeCycle,\n configuration,\n session,\n pageStateHistory\n )\n var addError = _startErrorCollection.addError\n startRequestCollection(lifeCycle, configuration, session)\n\n var internalContext = startInternalContext(\n configuration.applicationId,\n session,\n viewContexts,\n actionContexts,\n urlContexts\n )\n return {\n addResource: addResource,\n addAction: addAction,\n addError: addError,\n addTiming: addTiming,\n configuration: configuration,\n startView,\n setViewContext,\n setViewContextProperty,\n getViewContext,\n setViewName,\n lifeCycle: lifeCycle,\n viewContexts: viewContexts,\n session: session,\n setForcedSession: function () {\n session.setForcedSession()\n },\n stopSession: function () {\n session.expire()\n },\n startSession: function (options) {\n session.startSession(options)\n },\n getInternalContext: internalContext.get,\n stop: function () {\n cleanupTasks.forEach(function (task) {\n task()\n })\n },\n createResourceTrackerId: function () {\n return resourceTrackerManager.createTrackerId()\n },\n setResourceContext: function (trackerId, context) {\n resourceTrackerManager.setResourceContext(trackerId, context)\n },\n appendResourceContext: function (trackerId, context) {\n resourceTrackerManager.appendResourceContext(trackerId, context)\n },\n finishResource: function (trackerId) {\n resourceTrackerManager.finishResource(trackerId)\n },\n getResource: function (trackerId) {\n return resourceTrackerManager.getResource(trackerId)\n }\n }\n}\nfunction startRumTelemetry(configuration) {\n const telemetry = startTelemetry(TelemetryService.RUM, configuration)\n // if (canUseEventBridge()) {\n // const bridge = getEventBridge()\n // telemetry.observable.subscribe((event) =>\n // bridge.send('internal_telemetry', event)\n // )\n // }\n return telemetry\n}\n\nexport function startRumEventCollection(\n lifeCycle,\n configuration,\n location,\n sessionManager,\n userSessionManager,\n pageStateHistory,\n locationChangeObservable,\n domMutationObservable,\n getCommonContext,\n reportError\n) {\n var viewContexts = startViewContexts(lifeCycle)\n var urlContexts = startUrlContexts(\n lifeCycle,\n locationChangeObservable,\n location\n )\n\n var _startActionCollection = startActionCollection(\n lifeCycle,\n domMutationObservable,\n configuration,\n pageStateHistory\n )\n var actionContexts = _startActionCollection.actionContexts\n var addAction = _startActionCollection.addAction\n\n var displayContext = startDisplayContext()\n startRumAssembly(\n configuration,\n lifeCycle,\n sessionManager,\n userSessionManager,\n viewContexts,\n urlContexts,\n actionContexts,\n displayContext,\n getCommonContext,\n reportError\n )\n return {\n viewContexts: viewContexts,\n urlContexts: urlContexts,\n pageStateHistory: pageStateHistory,\n addAction: addAction,\n actionContexts: actionContexts,\n stop: function () {\n displayContext.stop()\n pageStateHistory.stop()\n urlContexts.stop()\n viewContexts.stop()\n }\n }\n}\n"],"mappings":"AAAA,SACEA,sBAAsB,EACtBC,0BAA0B,QACrB,6BAA6B;AACpC,SAASC,kBAAkB,QAAQ,eAAe;AAClD,SACEC,SAAS,EACTC,kBAAkB,EAClBC,wBAAwB,EACxBC,iBAAiB,EACjBC,cAAc,EACdC,gBAAgB,EAChBC,sBAAsB,QACjB,yBAAyB;AAChC,SAASC,2BAA2B,QAAQ,oCAAoC;AAChF,SAASC,8BAA8B,QAAQ,oCAAoC;AACnF,SAASC,uBAAuB,QAAQ,2DAA2D;AACnG,SAASC,iCAAiC,QAAQ,qEAAqE;AACvH,SAASC,uBAAuB,QAAQ,iCAAiC;AACzE,SAASC,qBAAqB,QAAQ,wDAAwD;AAC9F,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,mBAAmB,QAAQ,kCAAkC;AACtE,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,mBAAmB,QAAQ,sCAAsC;AAC1E,SAASC,oBAAoB,QAAQ,oCAAoC;AACzE,SAASC,gBAAgB,QAAQ,gCAAgC;AACjE,SAASC,iBAAiB,QAAQ,iCAAiC;AACnE,SAASC,qBAAqB,QAAQ,qCAAqC;AAC3E,SAASC,oBAAoB,QAAQ,qDAAqD;AAC1F,SAASC,mBAAmB,QAAQ,mDAAmD;AACvF,SAASC,sBAAsB,QAAQ,6BAA6B;AACpE,SAASC,uBAAuB,QAAQ,2DAA2D;AACnG,SAASC,wBAAwB,QAAQ,4DAA4D;AAErG,OAAO,SAASC,QAAQA,CACtBC,aAAa,EACbC,WAAW,EACXC,0BAA0B,EAC1BC,gBAAgB,EAChBC,kBAAkB,EAClBC,aAAa,EACbC,sBAAsB,EACtB;EACA,IAAIC,YAAY,GAAG,EAAE;EACrB,IAAIC,SAAS,GAAG,IAAInC,SAAS,CAAC,CAAC;EAC/B,IAAIoC,SAAS,GA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dC,kBAAkB,EAClBzD,YAAY,EACZC,WAAW,EACXC,cAAc,EACdyD,cAAc,EACd1F,gBAAgB,EAChBQ,WACF,CAAC;EACD,OAAO;IACLuB,YAAY,EAAEA,YAAY;IAC1BC,WAAW,EAAEA,WAAW;IACxBJ,gBAAgB,EAAEA,gBAAgB;IAClCO,SAAS,EAAEA,SAAS;IACpBF,cAAc,EAAEA,cAAc;IAC9BV,IAAI,EAAE,SAANA,IAAIA,CAAA,EAAc;MAChBmE,cAAc,CAACnE,IAAI,CAAC,CAAC;MACrBK,gBAAgB,CAACL,IAAI,CAAC,CAAC;MACvBS,WAAW,CAACT,IAAI,CAAC,CAAC;MAClBQ,YAAY,CAACR,IAAI,CAAC,CAAC;IACrB;EACF,CAAC;AACH","ignoreList":[]}
|
package/esm/boot/rumPublicApi.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
import { makePublicApi, createContextManager, CustomerDataType, clocksNow, ActionType, ResourceType, deepClone, createHandlingStack, sanitizeUser, checkUser, callMonitored, assign, monitor, storeContextManager, createIdentityEncoder, addTelemetryUsage, sanitize, createCustomerDataTrackerManager, CustomerDataCompressionStatus, displayAlreadyInitializedError, getType } from '@cloudcare/browser-core';
|
|
3
3
|
import { buildCommonContext } from '../domain/contexts/commonContext';
|
|
4
|
+
import { callPluginsMethod } from '../domain/plugins';
|
|
4
5
|
import { createPreStartStrategy } from './perStartRum';
|
|
5
6
|
import { createResourceTrackerManager } from '../domain/rumEventsCollection/resource/resourceTrackerManager';
|
|
6
7
|
var RUM_STORAGE_KEY = 'rum';
|
|
@@ -30,8 +31,28 @@ export function makeRumPublicApi(startRumImpl, recorderApi, options) {
|
|
|
30
31
|
function getCommonContext() {
|
|
31
32
|
return buildCommonContext(globalContextManager, userContextManager, recorderApi);
|
|
32
33
|
}
|
|
33
|
-
var strategy
|
|
34
|
-
|
|
34
|
+
var strategy;
|
|
35
|
+
function addPluginError(providedError) {
|
|
36
|
+
callMonitored(function () {
|
|
37
|
+
providedError = providedError || {};
|
|
38
|
+
strategy.addError(assign({}, providedError, {
|
|
39
|
+
context: sanitize(providedError.context)
|
|
40
|
+
}), getCommonContext());
|
|
41
|
+
addTelemetryUsage({
|
|
42
|
+
feature: 'add-error'
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
strategy = createPreStartStrategy(assign({}, options, {
|
|
47
|
+
resourceTrackerManager: resourceTrackerManager,
|
|
48
|
+
onInit: function onInit(initConfiguration, publicApi) {
|
|
49
|
+
callPluginsMethod(initConfiguration.plugins, 'onInit', {
|
|
50
|
+
addError: addPluginError,
|
|
51
|
+
publicApi: publicApi,
|
|
52
|
+
rum: publicApi,
|
|
53
|
+
initConfiguration: initConfiguration
|
|
54
|
+
});
|
|
55
|
+
}
|
|
35
56
|
}), getCommonContext, function (configuration, compressionWorker, initialViewOptions) {
|
|
36
57
|
if (configuration.storeContextsToLocal) {
|
|
37
58
|
storeContextManager(configuration, globalContextManager, RUM_STORAGE_KEY, CustomerDataType.GlobalContext);
|
|
@@ -43,6 +64,11 @@ export function makeRumPublicApi(startRumImpl, recorderApi, options) {
|
|
|
43
64
|
} : createIdentityEncoder, resourceTrackerManager);
|
|
44
65
|
recorderApi.onRumStart(startRumResult.lifeCycle, configuration, startRumResult.session, startRumResult.viewContexts, compressionWorker);
|
|
45
66
|
strategy = createPostStartStrategy(strategy, startRumResult);
|
|
67
|
+
callPluginsMethod(configuration.plugins, 'onRumStart', {
|
|
68
|
+
addError: addPluginError,
|
|
69
|
+
publicApi: rumPublicApi,
|
|
70
|
+
rum: rumPublicApi
|
|
71
|
+
});
|
|
46
72
|
return startRumResult;
|
|
47
73
|
});
|
|
48
74
|
var startView = monitor(function (options) {
|
|
@@ -60,7 +86,7 @@ export function makeRumPublicApi(startRumImpl, recorderApi, options) {
|
|
|
60
86
|
var recorderPublicApi = options.makeRecorderPublicApi ? options.makeRecorderPublicApi(recorderApi) : {};
|
|
61
87
|
var rumPublicApi = makePublicApi(assign({
|
|
62
88
|
init: monitor(function (initConfiguration) {
|
|
63
|
-
strategy.init(initConfiguration);
|
|
89
|
+
strategy.init(initConfiguration, rumPublicApi);
|
|
64
90
|
}),
|
|
65
91
|
setViewName: monitor(function (name) {
|
|
66
92
|
strategy.setViewName(name);
|
|
@@ -241,6 +267,13 @@ export function makeRumPublicApi(startRumImpl, recorderApi, options) {
|
|
|
241
267
|
feature: 'stop-session'
|
|
242
268
|
});
|
|
243
269
|
}),
|
|
270
|
+
startSession: monitor(function (options) {
|
|
271
|
+
strategy.startSession(options);
|
|
272
|
+
addTelemetryUsage({
|
|
273
|
+
feature: 'start-session',
|
|
274
|
+
sessionSampleRate: options && options.sessionSampleRate
|
|
275
|
+
});
|
|
276
|
+
}),
|
|
244
277
|
setForcedSession: monitor(function () {
|
|
245
278
|
strategy.setForcedSession();
|
|
246
279
|
addTelemetryUsage({
|