|
@@ -1,9 +1,11 @@
|
|
1
|
+import { sendAnalytics, createVpaasConferenceJoinedEvent } from '../analytics';
|
|
2
|
+import { CONFERENCE_JOINED } from '../base/conference/actionTypes';
|
1
|
3
|
import { PARTICIPANT_JOINED } from '../base/participants/actionTypes';
|
2
|
4
|
import { MiddlewareRegistry } from '../base/redux';
|
3
|
5
|
|
4
|
6
|
import { SET_BILLING_ID } from './actionTypes';
|
5
|
7
|
import { countEndpoint } from './actions';
|
6
|
|
-import { setBillingId } from './functions';
|
|
8
|
+import { isVpaasMeeting, extractVpaasTenantFromPath, setBillingId } from './functions';
|
7
|
9
|
|
8
|
10
|
/**
|
9
|
11
|
* The redux middleware for billing counter.
|
|
@@ -14,6 +16,11 @@ import { setBillingId } from './functions';
|
14
|
16
|
|
15
|
17
|
MiddlewareRegistry.register(store => next => async action => {
|
16
|
18
|
switch (action.type) {
|
|
19
|
+ case CONFERENCE_JOINED: {
|
|
20
|
+ _maybeTrackVpaasConferenceJoin(store.getState());
|
|
21
|
+
|
|
22
|
+ break;
|
|
23
|
+ }
|
17
|
24
|
case SET_BILLING_ID: {
|
18
|
25
|
setBillingId(action.value);
|
19
|
26
|
|
|
@@ -34,3 +41,17 @@ MiddlewareRegistry.register(store => next => async action => {
|
34
|
41
|
|
35
|
42
|
return next(action);
|
36
|
43
|
});
|
|
44
|
+
|
|
45
|
+/**
|
|
46
|
+ * Tracks the conference join event if the meeting is a vpaas one.
|
|
47
|
+ *
|
|
48
|
+ * @param {Store} state - The app state.
|
|
49
|
+ * @returns {Function}
|
|
50
|
+ */
|
|
51
|
+function _maybeTrackVpaasConferenceJoin(state) {
|
|
52
|
+ if (isVpaasMeeting(state)) {
|
|
53
|
+ sendAnalytics(createVpaasConferenceJoinedEvent(
|
|
54
|
+ extractVpaasTenantFromPath(
|
|
55
|
+ state['features/base/connection'].locationURL.pathname)));
|
|
56
|
+ }
|
|
57
|
+}
|