@cloudcare/browser-rum 3.2.36 → 3.2.37

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,7 +17,8 @@ import {
17
17
  sanitize,
18
18
  createCustomerDataTrackerManager,
19
19
  CustomerDataCompressionStatus,
20
- displayAlreadyInitializedError
20
+ displayAlreadyInitializedError,
21
+ getType
21
22
  } from '@cloudcare/browser-core'
22
23
  import { buildCommonContext } from '../domain/contexts/commonContext'
23
24
  import { createPreStartStrategy } from './perStartRum'
@@ -184,9 +185,24 @@ export function makeRumPublicApi(startRumImpl, recorderApi, options) {
184
185
  addDebugSession: monitor(function (id) {}),
185
186
  clearDebugSession: monitor(function () {}),
186
187
  getDebugSession: monitor(function () {}),
187
- addAction: monitor(function (name, context) {
188
+ addTypeAction: monitor(function (name, type, context) {
188
189
  const handlingStack = createHandlingStack()
189
190
 
191
+ callMonitored(function () {
192
+ const sourceType = sanitize(type)
193
+ strategy.addAction({
194
+ name: sanitize(name),
195
+ context: sanitize(context),
196
+ startClocks: clocksNow(),
197
+ type:
198
+ getType(sourceType) === 'string' ? sourceType : ActionType.CUSTOM,
199
+ handlingStack: handlingStack
200
+ })
201
+ addTelemetryUsage({ feature: 'add-type-action' })
202
+ })
203
+ }),
204
+ addAction: monitor(function (name, context) {
205
+ const handlingStack = createHandlingStack()
190
206
  callMonitored(function () {
191
207
  strategy.addAction({
192
208
  name: sanitize(name),
@@ -435,7 +435,6 @@ function getAttributesForPrivacyLevel(element, nodePrivacyLevel, options) {
435
435
  return s.href === element.href
436
436
  })
437
437
  var cssText = getCssRulesString(stylesheet)
438
-
439
438
  if (cssText && stylesheet) {
440
439
  safeAttrs._cssText = cssText
441
440
  }
@@ -79,7 +79,7 @@ function processAction(action, pageStateHistory) {
79
79
  }
80
80
  : {
81
81
  action: {
82
- loadingTime: 0
82
+ loadingTime: action.context?.duration || 0
83
83
  }
84
84
  }
85
85
  var customerContext = !isAutoAction(action) ? action.context : undefined
@@ -115,5 +115,6 @@ function processAction(action, pageStateHistory) {
115
115
  }
116
116
 
117
117
  function isAutoAction(action) {
118
- return action.type !== ActionType.CUSTOM
118
+ return action.type === ActionType.CLICK
119
+ // return action.type !== ActionType.CUSTOM
119
120
  }
package/types/index.d.ts CHANGED
@@ -50,6 +50,11 @@ export declare const datafluxRum: {
50
50
  | RumSiteInitConfiguration
51
51
  | undefined
52
52
  addAction: (name: string, context?: object | undefined) => void
53
+ addTypeAction: (
54
+ name: string,
55
+ type?: string,
56
+ context?: object | undefined
57
+ ) => void
53
58
  addError: (error: unknown, context?: object | undefined) => void
54
59
  addTiming: (name: string, time?: number | undefined) => void
55
60
  setUser: (newUser: User) => void