|
@@ -4,6 +4,8 @@ import type { Dispatch } from 'redux';
|
4
|
4
|
|
5
|
5
|
import { FEEDBACK_REQUEST_IN_PROGRESS } from '../../../modules/UI/UIErrors';
|
6
|
6
|
import { openDialog } from '../base/dialog';
|
|
7
|
+import { isVpaasMeeting } from '../billing-counter/functions';
|
|
8
|
+import { extractFqnFromPath } from '../dynamic-branding/functions';
|
7
|
9
|
|
8
|
10
|
import {
|
9
|
11
|
CANCEL_FEEDBACK,
|
|
@@ -11,9 +13,9 @@ import {
|
11
|
13
|
SUBMIT_FEEDBACK_SUCCESS
|
12
|
14
|
} from './actionTypes';
|
13
|
15
|
import { FeedbackDialog } from './components';
|
|
16
|
+import { sendFeedbackToJaaSRequest } from './functions';
|
14
|
17
|
|
15
|
18
|
declare var config: Object;
|
16
|
|
-declare var interfaceConfig: Object;
|
17
|
19
|
|
18
|
20
|
/**
|
19
|
21
|
* Caches the passed in feedback in the redux store.
|
|
@@ -110,6 +112,39 @@ export function openFeedbackDialog(conference: Object, onClose: ?Function) {
|
110
|
112
|
});
|
111
|
113
|
}
|
112
|
114
|
|
|
115
|
+/**
|
|
116
|
+ * Sends feedback metadata to JaaS endpoint.
|
|
117
|
+ *
|
|
118
|
+ * @param {JitsiConference} conference - The JitsiConference that is being rated.
|
|
119
|
+ * @param {Object} feedback - The feedback message and score.
|
|
120
|
+ *
|
|
121
|
+ * @returns {Promise}
|
|
122
|
+ */
|
|
123
|
+export function sendJaasFeedbackMetadata(conference: Object, feedback: Object) {
|
|
124
|
+ return (dispatch: Dispatch<any>, getState: Function): Promise<any> => {
|
|
125
|
+ const state = getState();
|
|
126
|
+ const { jaasFeedbackMetadataURL } = state['features/base/config'];
|
|
127
|
+
|
|
128
|
+ const { jwt, user, tenant } = state['features/base/jwt'];
|
|
129
|
+
|
|
130
|
+ if (!isVpaasMeeting(state) || !jaasFeedbackMetadataURL) {
|
|
131
|
+ return Promise.resolve();
|
|
132
|
+ }
|
|
133
|
+
|
|
134
|
+ const meetingFqn = extractFqnFromPath(state['features/base/connection'].locationURL.pathname);
|
|
135
|
+ const feedbackData = {
|
|
136
|
+ ...feedback,
|
|
137
|
+ sessionId: conference.getMeetingUniqueId(),
|
|
138
|
+ userId: user.id,
|
|
139
|
+ meetingFqn,
|
|
140
|
+ jwt,
|
|
141
|
+ tenant
|
|
142
|
+ };
|
|
143
|
+
|
|
144
|
+ return sendFeedbackToJaaSRequest(jaasFeedbackMetadataURL, feedbackData);
|
|
145
|
+ };
|
|
146
|
+}
|
|
147
|
+
|
113
|
148
|
/**
|
114
|
149
|
* Send the passed in feedback.
|
115
|
150
|
*
|
|
@@ -125,16 +160,17 @@ export function submitFeedback(
|
125
|
160
|
score: number,
|
126
|
161
|
message: string,
|
127
|
162
|
conference: Object) {
|
128
|
|
- return (dispatch: Dispatch<any>) => conference.sendFeedback(score, message)
|
129
|
|
- .then(
|
130
|
|
- () => dispatch({ type: SUBMIT_FEEDBACK_SUCCESS }),
|
131
|
|
- error => {
|
132
|
|
- dispatch({
|
133
|
|
- type: SUBMIT_FEEDBACK_ERROR,
|
134
|
|
- error
|
135
|
|
- });
|
136
|
|
-
|
137
|
|
- return Promise.reject(error);
|
138
|
|
- }
|
139
|
|
- );
|
|
163
|
+ return (dispatch: Dispatch<any>) =>
|
|
164
|
+ conference.sendFeedback(score, message)
|
|
165
|
+ .then(() => dispatch({ type: SUBMIT_FEEDBACK_SUCCESS }))
|
|
166
|
+ .then(() => dispatch(sendJaasFeedbackMetadata(conference, { score,
|
|
167
|
+ message }))
|
|
168
|
+ .catch(error => {
|
|
169
|
+ dispatch({
|
|
170
|
+ type: SUBMIT_FEEDBACK_ERROR,
|
|
171
|
+ error
|
|
172
|
+ });
|
|
173
|
+
|
|
174
|
+ return Promise.reject(error);
|
|
175
|
+ }));
|
140
|
176
|
}
|