@cloudcare/rum-uniapp 2.0.2 → 2.1.2
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/cjs/boot/buildEnv.js +1 -1
- package/cjs/boot/rum.entry.js +14 -6
- package/cjs/boot/rum.js +4 -1
- package/cjs/helper/enums.js +2 -1
- package/cjs/rumEventsCollection/action/actionCollection.js +19 -1
- package/cjs/rumEventsCollection/assembly.js +2 -2
- package/esm/boot/buildEnv.js +1 -1
- package/esm/boot/rum.entry.js +14 -7
- package/esm/boot/rum.js +4 -1
- package/esm/helper/enums.js +2 -1
- package/esm/rumEventsCollection/action/actionCollection.js +20 -2
- package/esm/rumEventsCollection/assembly.js +2 -2
- package/package.json +1 -1
package/cjs/boot/buildEnv.js
CHANGED
package/cjs/boot/rum.entry.js
CHANGED
|
@@ -9,6 +9,8 @@ var _utils = require("../helper/utils");
|
|
|
9
9
|
|
|
10
10
|
var _rum = require("./rum");
|
|
11
11
|
|
|
12
|
+
var _enums = require("../helper/enums");
|
|
13
|
+
|
|
12
14
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
13
15
|
|
|
14
16
|
var makeRum = function makeRum(startRumImpl) {
|
|
@@ -18,12 +20,7 @@ var makeRum = function makeRum(startRumImpl) {
|
|
|
18
20
|
|
|
19
21
|
var _getInternalContext = function getInternalContext() {};
|
|
20
22
|
|
|
21
|
-
function
|
|
22
|
-
return (0, _utils.extend2Lev)({}, {
|
|
23
|
-
context: globalContextManager.get(),
|
|
24
|
-
user: user
|
|
25
|
-
});
|
|
26
|
-
}
|
|
23
|
+
var addActionStrategy = function addActionStrategy() {};
|
|
27
24
|
|
|
28
25
|
var rumGlobal = {
|
|
29
26
|
init: function init(Vue, userConfiguration) {
|
|
@@ -45,6 +42,7 @@ var makeRum = function makeRum(startRumImpl) {
|
|
|
45
42
|
});
|
|
46
43
|
|
|
47
44
|
_getInternalContext = _startRumImpl.getInternalContext;
|
|
45
|
+
addActionStrategy = _startRumImpl.addAction;
|
|
48
46
|
isAlreadyInitialized = true;
|
|
49
47
|
},
|
|
50
48
|
getInternalContext: function getInternalContext(startTime) {
|
|
@@ -54,6 +52,16 @@ var makeRum = function makeRum(startRumImpl) {
|
|
|
54
52
|
removeRumGlobalContext: globalContextManager.remove,
|
|
55
53
|
getRumGlobalContext: globalContextManager.get,
|
|
56
54
|
setRumGlobalContext: globalContextManager.set,
|
|
55
|
+
addAction: function addAction(name, context) {
|
|
56
|
+
if ((0, _utils.isObject)(context) && (0, _utils.isString)(name)) {
|
|
57
|
+
addActionStrategy({
|
|
58
|
+
name: name,
|
|
59
|
+
context: (0, _utils.extend2Lev)({}, context),
|
|
60
|
+
startClocks: (0, _utils.now)(),
|
|
61
|
+
type: _enums.ActionType.custom
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
},
|
|
57
65
|
setUser: function setUser(newUser) {
|
|
58
66
|
var sanitizedUser = sanitizeUser(newUser);
|
|
59
67
|
|
package/cjs/boot/rum.js
CHANGED
|
@@ -53,9 +53,12 @@ var startRum = function startRum(Vue, userConfiguration, getCommonContext) {
|
|
|
53
53
|
(0, _requestCollection.startRequestCollection)(lifeCycle, configuration);
|
|
54
54
|
(0, _performanceCollection.startPagePerformanceObservable)(lifeCycle, configuration);
|
|
55
55
|
(0, _setDataCollection.startSetDataColloction)(lifeCycle, Vue);
|
|
56
|
-
|
|
56
|
+
|
|
57
|
+
var _startActionCollection = (0, _actionCollection.startActionCollection)(lifeCycle, configuration, Vue);
|
|
58
|
+
|
|
57
59
|
var internalContext = (0, _internalContext.startInternalContext)(userConfiguration.applicationId, session, parentContexts);
|
|
58
60
|
return {
|
|
61
|
+
addAction: _startActionCollection.addAction,
|
|
59
62
|
getInternalContext: internalContext.get
|
|
60
63
|
};
|
|
61
64
|
};
|
package/cjs/helper/enums.js
CHANGED
|
@@ -21,10 +21,18 @@ function startActionCollection(lifeCycle, configuration, Vue) {
|
|
|
21
21
|
if (configuration.trackInteractions) {
|
|
22
22
|
(0, _trackActions.trackActions)(lifeCycle, Vue);
|
|
23
23
|
}
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
addAction: function addAction(action, savedCommonContext) {
|
|
27
|
+
lifeCycle.notify(_lifeCycle.LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, (0, _utils.extend2Lev)({
|
|
28
|
+
savedCommonContext: savedCommonContext
|
|
29
|
+
}, processAction(action)));
|
|
30
|
+
}
|
|
31
|
+
};
|
|
24
32
|
}
|
|
25
33
|
|
|
26
34
|
function processAction(action) {
|
|
27
|
-
var autoActionProperties = {
|
|
35
|
+
var autoActionProperties = isAutoAction(action) ? {
|
|
28
36
|
action: {
|
|
29
37
|
error: {
|
|
30
38
|
count: action.counts.errorCount
|
|
@@ -38,7 +46,12 @@ function processAction(action) {
|
|
|
38
46
|
count: action.counts.resourceCount
|
|
39
47
|
}
|
|
40
48
|
}
|
|
49
|
+
} : {
|
|
50
|
+
action: {
|
|
51
|
+
loadingTime: 0
|
|
52
|
+
}
|
|
41
53
|
};
|
|
54
|
+
var customerContext = !isAutoAction(action) ? action.context : undefined;
|
|
42
55
|
var actionEvent = (0, _utils.extend2Lev)({
|
|
43
56
|
action: {
|
|
44
57
|
target: {
|
|
@@ -50,7 +63,12 @@ function processAction(action) {
|
|
|
50
63
|
type: _enums.RumEventType.ACTION
|
|
51
64
|
}, autoActionProperties);
|
|
52
65
|
return {
|
|
66
|
+
customerContext: customerContext,
|
|
53
67
|
rawRumEvent: actionEvent,
|
|
54
68
|
startTime: action.startClocks
|
|
55
69
|
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function isAutoAction(action) {
|
|
73
|
+
return action.type !== _enums.ActionType.custom;
|
|
56
74
|
}
|
|
@@ -29,7 +29,7 @@ function startRumAssembly(applicationId, configuration, session, lifeCycle, pare
|
|
|
29
29
|
var startTime = data.startTime;
|
|
30
30
|
var rawRumEvent = data.rawRumEvent;
|
|
31
31
|
var viewContext = parentContexts.findView(startTime);
|
|
32
|
-
var savedCommonContext = data.
|
|
32
|
+
var savedCommonContext = data.savedCommonContext;
|
|
33
33
|
var customerContext = data.customerContext;
|
|
34
34
|
var deviceContext = {
|
|
35
35
|
device: _baseInfo["default"].deviceInfo
|
|
@@ -62,7 +62,7 @@ function startRumAssembly(applicationId, configuration, session, lifeCycle, pare
|
|
|
62
62
|
};
|
|
63
63
|
var rumEvent = (0, _utils.extend2Lev)(rumContext, deviceContext, viewContext, actionContext, rawRumEvent);
|
|
64
64
|
var serverRumEvent = (0, _utils.withSnakeCaseKeys)(rumEvent);
|
|
65
|
-
var context = (0, _utils.extend2Lev)(commonContext.context, customerContext);
|
|
65
|
+
var context = (0, _utils.extend2Lev)({}, commonContext.context, customerContext);
|
|
66
66
|
|
|
67
67
|
if (!(0, _utils.isEmptyObject)(context)) {
|
|
68
68
|
serverRumEvent.tags = context;
|
package/esm/boot/buildEnv.js
CHANGED
package/esm/boot/rum.entry.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { isPercentage, extend2Lev, createContextManager, defineGlobal, getGlobalObject } from '../helper/utils';
|
|
1
|
+
import { isPercentage, extend2Lev, now, createContextManager, defineGlobal, getGlobalObject, isString, isObject } from '../helper/utils';
|
|
2
2
|
import { startRum } from './rum';
|
|
3
|
+
import { ActionType } from '../helper/enums';
|
|
3
4
|
export var makeRum = function makeRum(startRumImpl) {
|
|
4
5
|
var isAlreadyInitialized = false;
|
|
5
6
|
var globalContextManager = createContextManager();
|
|
@@ -7,12 +8,7 @@ export var makeRum = function makeRum(startRumImpl) {
|
|
|
7
8
|
|
|
8
9
|
var _getInternalContext = function getInternalContext() {};
|
|
9
10
|
|
|
10
|
-
function
|
|
11
|
-
return extend2Lev({}, {
|
|
12
|
-
context: globalContextManager.get(),
|
|
13
|
-
user: user
|
|
14
|
-
});
|
|
15
|
-
}
|
|
11
|
+
var addActionStrategy = function addActionStrategy() {};
|
|
16
12
|
|
|
17
13
|
var rumGlobal = {
|
|
18
14
|
init: function init(Vue, userConfiguration) {
|
|
@@ -34,6 +30,7 @@ export var makeRum = function makeRum(startRumImpl) {
|
|
|
34
30
|
});
|
|
35
31
|
|
|
36
32
|
_getInternalContext = _startRumImpl.getInternalContext;
|
|
33
|
+
addActionStrategy = _startRumImpl.addAction;
|
|
37
34
|
isAlreadyInitialized = true;
|
|
38
35
|
},
|
|
39
36
|
getInternalContext: function getInternalContext(startTime) {
|
|
@@ -43,6 +40,16 @@ export var makeRum = function makeRum(startRumImpl) {
|
|
|
43
40
|
removeRumGlobalContext: globalContextManager.remove,
|
|
44
41
|
getRumGlobalContext: globalContextManager.get,
|
|
45
42
|
setRumGlobalContext: globalContextManager.set,
|
|
43
|
+
addAction: function addAction(name, context) {
|
|
44
|
+
if (isObject(context) && isString(name)) {
|
|
45
|
+
addActionStrategy({
|
|
46
|
+
name: name,
|
|
47
|
+
context: extend2Lev({}, context),
|
|
48
|
+
startClocks: now(),
|
|
49
|
+
type: ActionType.custom
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
},
|
|
46
53
|
setUser: function setUser(newUser) {
|
|
47
54
|
var sanitizedUser = sanitizeUser(newUser);
|
|
48
55
|
|
package/esm/boot/rum.js
CHANGED
|
@@ -29,9 +29,12 @@ export var startRum = function startRum(Vue, userConfiguration, getCommonContext
|
|
|
29
29
|
startRequestCollection(lifeCycle, configuration);
|
|
30
30
|
startPagePerformanceObservable(lifeCycle, configuration);
|
|
31
31
|
startSetDataColloction(lifeCycle, Vue);
|
|
32
|
-
|
|
32
|
+
|
|
33
|
+
var _startActionCollection = startActionCollection(lifeCycle, configuration, Vue);
|
|
34
|
+
|
|
33
35
|
var internalContext = startInternalContext(userConfiguration.applicationId, session, parentContexts);
|
|
34
36
|
return {
|
|
37
|
+
addAction: _startActionCollection.addAction,
|
|
35
38
|
getInternalContext: internalContext.get
|
|
36
39
|
};
|
|
37
40
|
};
|
package/esm/helper/enums.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { msToNs, extend2Lev } from '../../helper/utils';
|
|
2
2
|
import { LifeCycleEventType } from '../../core/lifeCycle';
|
|
3
|
-
import { RumEventType } from '../../helper/enums';
|
|
3
|
+
import { RumEventType, ActionType } from '../../helper/enums';
|
|
4
4
|
import { trackActions } from './trackActions';
|
|
5
5
|
export function startActionCollection(lifeCycle, configuration, Vue) {
|
|
6
6
|
lifeCycle.subscribe(LifeCycleEventType.AUTO_ACTION_COMPLETED, function (action) {
|
|
@@ -10,10 +10,18 @@ export function startActionCollection(lifeCycle, configuration, Vue) {
|
|
|
10
10
|
if (configuration.trackInteractions) {
|
|
11
11
|
trackActions(lifeCycle, Vue);
|
|
12
12
|
}
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
addAction: function addAction(action, savedCommonContext) {
|
|
16
|
+
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, extend2Lev({
|
|
17
|
+
savedCommonContext: savedCommonContext
|
|
18
|
+
}, processAction(action)));
|
|
19
|
+
}
|
|
20
|
+
};
|
|
13
21
|
}
|
|
14
22
|
|
|
15
23
|
function processAction(action) {
|
|
16
|
-
var autoActionProperties = {
|
|
24
|
+
var autoActionProperties = isAutoAction(action) ? {
|
|
17
25
|
action: {
|
|
18
26
|
error: {
|
|
19
27
|
count: action.counts.errorCount
|
|
@@ -27,7 +35,12 @@ function processAction(action) {
|
|
|
27
35
|
count: action.counts.resourceCount
|
|
28
36
|
}
|
|
29
37
|
}
|
|
38
|
+
} : {
|
|
39
|
+
action: {
|
|
40
|
+
loadingTime: 0
|
|
41
|
+
}
|
|
30
42
|
};
|
|
43
|
+
var customerContext = !isAutoAction(action) ? action.context : undefined;
|
|
31
44
|
var actionEvent = extend2Lev({
|
|
32
45
|
action: {
|
|
33
46
|
target: {
|
|
@@ -39,7 +52,12 @@ function processAction(action) {
|
|
|
39
52
|
type: RumEventType.ACTION
|
|
40
53
|
}, autoActionProperties);
|
|
41
54
|
return {
|
|
55
|
+
customerContext: customerContext,
|
|
42
56
|
rawRumEvent: actionEvent,
|
|
43
57
|
startTime: action.startClocks
|
|
44
58
|
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function isAutoAction(action) {
|
|
62
|
+
return action.type !== ActionType.custom;
|
|
45
63
|
}
|
|
@@ -14,7 +14,7 @@ export function startRumAssembly(applicationId, configuration, session, lifeCycl
|
|
|
14
14
|
var startTime = data.startTime;
|
|
15
15
|
var rawRumEvent = data.rawRumEvent;
|
|
16
16
|
var viewContext = parentContexts.findView(startTime);
|
|
17
|
-
var savedCommonContext = data.
|
|
17
|
+
var savedCommonContext = data.savedCommonContext;
|
|
18
18
|
var customerContext = data.customerContext;
|
|
19
19
|
var deviceContext = {
|
|
20
20
|
device: baseInfo.deviceInfo
|
|
@@ -47,7 +47,7 @@ export function startRumAssembly(applicationId, configuration, session, lifeCycl
|
|
|
47
47
|
};
|
|
48
48
|
var rumEvent = extend2Lev(rumContext, deviceContext, viewContext, actionContext, rawRumEvent);
|
|
49
49
|
var serverRumEvent = withSnakeCaseKeys(rumEvent);
|
|
50
|
-
var context = extend2Lev(commonContext.context, customerContext);
|
|
50
|
+
var context = extend2Lev({}, commonContext.context, customerContext);
|
|
51
51
|
|
|
52
52
|
if (!isEmptyObject(context)) {
|
|
53
53
|
serverRumEvent.tags = context;
|