@cloudcare/browser-rum 3.1.16 → 3.1.18

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.
@@ -17,8 +17,7 @@ import {
17
17
  assign,
18
18
  canUseEventBridge,
19
19
  monitor,
20
- extend2Lev,
21
- createStoredContextManager
20
+ storeContextManager
22
21
  } from '@cloudcare/browser-core'
23
22
  import { validateAndBuildRumConfiguration } from '../domain/configuration'
24
23
  import { buildCommonContext } from '../domain/contexts/commonContext'
@@ -122,24 +121,36 @@ export function makeRumPublicApi(startRumImpl, recorderApi) {
122
121
  }
123
122
  function doStartRum(configuration, initialViewOptions) {
124
123
  if (configuration.storeContextsToLocal) {
125
- // localstorage
126
- var beforeInitGlobalContext = globalContextManager.getContext()
127
- globalContextManager = createStoredContextManager(
124
+ storeContextManager(
125
+ configuration,
126
+ globalContextManager,
128
127
  RUM_STORAGE_KEY,
129
128
  CustomerDataType.GlobalContext
130
129
  )
131
- globalContextManager.setContext(
132
- extend2Lev(globalContextManager.getContext(), beforeInitGlobalContext)
133
- )
134
-
135
- var beforeInitUserContext = userContextManager.getContext()
136
- userContextManager = createStoredContextManager(
130
+ storeContextManager(
131
+ configuration,
132
+ userContextManager,
137
133
  RUM_STORAGE_KEY,
138
134
  CustomerDataType.User
139
135
  )
140
- userContextManager.setContext(
141
- extend2Lev(userContextManager.getContext(), beforeInitUserContext)
142
- )
136
+ // // localstorage
137
+ // var beforeInitGlobalContext = globalContextManager.getContext()
138
+ // globalContextManager = createStoredContextManager(
139
+ // RUM_STORAGE_KEY,
140
+ // CustomerDataType.GlobalContext
141
+ // )
142
+ // globalContextManager.setContext(
143
+ // extend2Lev(globalContextManager.getContext(), beforeInitGlobalContext)
144
+ // )
145
+
146
+ // var beforeInitUserContext = userContextManager.getContext()
147
+ // userContextManager = createStoredContextManager(
148
+ // RUM_STORAGE_KEY,
149
+ // CustomerDataType.User
150
+ // )
151
+ // userContextManager.setContext(
152
+ // extend2Lev(userContextManager.getContext(), beforeInitUserContext)
153
+ // )
143
154
  }
144
155
  var startRumResults = startRumImpl(
145
156
  configuration,
@@ -104,14 +104,14 @@ function processRequest(
104
104
  startClocks,
105
105
  request.duration
106
106
  )
107
- var pageStateInfo = computePageStateInfo(
108
- pageStateHistory,
109
- startClocks,
110
- isNullUndefinedDefaultValue(
111
- matchingTiming && matchingTiming.duration,
112
- request.duration
113
- )
114
- )
107
+ // var pageStateInfo = computePageStateInfo(
108
+ // pageStateHistory,
109
+ // startClocks,
110
+ // isNullUndefinedDefaultValue(
111
+ // matchingTiming && matchingTiming.duration,
112
+ // request.duration
113
+ // )
114
+ // )
115
115
  var urlObj = urlParse(request.url).getParse()
116
116
  var resourceEvent = extend2Lev(
117
117
  {
@@ -134,8 +134,7 @@ function processRequest(
134
134
  type: RumEventType.RESOURCE
135
135
  },
136
136
  tracingInfo,
137
- correspondingTimingOverrides,
138
- pageStateInfo
137
+ correspondingTimingOverrides
139
138
  )
140
139
  return {
141
140
  startTime: startClocks.relative,
@@ -178,11 +177,11 @@ function processResourceEntry(
178
177
  } else if (isCacheHit(entry)) {
179
178
  statusCode = 200
180
179
  }
181
- var pageStateInfo = computePageStateInfo(
182
- pageStateHistory,
183
- startClocks,
184
- entry.duration
185
- )
180
+ // var pageStateInfo = computePageStateInfo(
181
+ // pageStateHistory,
182
+ // startClocks,
183
+ // entry.duration
184
+ // )
186
185
 
187
186
  var resourceEvent = extend2Lev(
188
187
  {
@@ -202,8 +201,7 @@ function processResourceEntry(
202
201
  type: RumEventType.RESOURCE
203
202
  },
204
203
  tracingInfo,
205
- entryMetrics,
206
- pageStateInfo
204
+ entryMetrics
207
205
  )
208
206
  return {
209
207
  startTime: startClocks.relative,
@@ -243,26 +241,22 @@ function computeRequestTracingInfo(request) {
243
241
  resource: { id: UUID() }
244
242
  }
245
243
  }
246
- function computePageStateInfo(pageStateHistory, startClocks, duration) {
247
- return {
248
- _gc: {
249
- page_states: pageStateHistory.findAll(startClocks.relative, duration),
250
- page_was_discarded: String(document.wasDiscarded)
251
- }
252
- }
253
- }
244
+ // function computePageStateInfo(pageStateHistory, startClocks, duration) {
245
+ // return {
246
+ // _gc: {
247
+ // page_states: pageStateHistory.findAll(startClocks.relative, duration),
248
+ // page_was_discarded: String(document.wasDiscarded)
249
+ // }
250
+ // }
251
+ // }
254
252
  function computeRequestDuration(pageStateHistory, startClocks, duration) {
255
- const requestCrosseds = pageStateHistory.findAll(
253
+ return !pageStateHistory.wasInPageStateDuringPeriod(
254
+ PageState.FROZEN,
256
255
  startClocks.relative,
257
256
  duration
258
257
  )
259
- var requestCrossedFrozenState
260
- if (requestCrosseds) {
261
- requestCrossedFrozenState = some(requestCrosseds, function (pageState) {
262
- return pageState.state === PageState.FROZEN
263
- })
264
- }
265
- return !requestCrossedFrozenState ? toServerDuration(duration) : undefined
258
+ ? toServerDuration(duration)
259
+ : undefined
266
260
  }
267
261
  function computeEntryTracingInfo(entry) {
268
262
  return entry.traceId ? { _gc: { traceId: entry.traceId } } : undefined
@@ -81,10 +81,7 @@ export function trackViews(
81
81
  lifeCycle.subscribe(
82
82
  LifeCycleEventType.PAGE_EXITED,
83
83
  function (pageExitEvent) {
84
- if (
85
- pageExitEvent.reason === PageExitReason.UNLOADING ||
86
- pageExitEvent.reason === PageExitReason.PAGEHIDE
87
- ) {
84
+ if (pageExitEvent.reason === PageExitReason.UNLOADING) {
88
85
  currentView.end()
89
86
  }
90
87
  }