@plusscommunities/pluss-maintenance-web-forms 1.1.36 → 1.1.37-beta.1
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/dist/index.cjs.js +217 -106
- package/dist/index.esm.js +217 -106
- package/dist/index.umd.js +217 -106
- package/package.json +1 -1
- package/src/components/AnalyticsHub.js +331 -154
- package/src/feature.config.js +0 -1
- package/src/values.config.a.js +0 -6
- package/src/values.config.default.js +0 -6
- package/src/values.config.forms.js +0 -6
- package/src/values.config.js +0 -6
package/dist/index.esm.js
CHANGED
|
@@ -81,13 +81,7 @@ const values = {
|
|
|
81
81
|
hasHelpButton: true,
|
|
82
82
|
helpGuideURL: 'https://www.plusscommunities.com/forms-feature',
|
|
83
83
|
stringConfigJobStatus: 'maintenanceJobStatusForms',
|
|
84
|
-
stringConfigHideSeen: 'maintenanceDisableSeenForms'
|
|
85
|
-
// Comment subscription notification preference
|
|
86
|
-
notificationPreference: {
|
|
87
|
-
key: 'maintenancerequestFormsComments',
|
|
88
|
-
label: 'Forms comments',
|
|
89
|
-
permission: 'maintenanceTrackingForms'
|
|
90
|
-
}
|
|
84
|
+
stringConfigHideSeen: 'maintenanceDisableSeenForms'
|
|
91
85
|
};
|
|
92
86
|
|
|
93
87
|
// import * as PlussCore from '../../pluss-core/src';
|
|
@@ -210,8 +204,7 @@ const FeatureConfig = {
|
|
|
210
204
|
init: environment => {
|
|
211
205
|
FeatureConfig.env = environment;
|
|
212
206
|
PlussCore.Config.init(environment);
|
|
213
|
-
}
|
|
214
|
-
notificationPreference: values.notificationPreference
|
|
207
|
+
}
|
|
215
208
|
};
|
|
216
209
|
|
|
217
210
|
const JOBS_LOADED = values.actionJobsLoaded;
|
|
@@ -224,12 +217,12 @@ const JOBS_HIDE_SEEN = values.actionJobsHideSeen;
|
|
|
224
217
|
function ownKeys$7(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
225
218
|
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
226
219
|
const {
|
|
227
|
-
Helper: Helper$
|
|
220
|
+
Helper: Helper$6,
|
|
228
221
|
Session: Session$9
|
|
229
222
|
} = PlussCore;
|
|
230
223
|
const maintenanceActions = {
|
|
231
224
|
getJobType: (site, typeId) => {
|
|
232
|
-
let url = Helper$
|
|
225
|
+
let url = Helper$6.getUrl(values.serviceKey, 'getjobtype');
|
|
233
226
|
return Session$9.authedFunction({
|
|
234
227
|
method: 'POST',
|
|
235
228
|
url,
|
|
@@ -240,7 +233,7 @@ const maintenanceActions = {
|
|
|
240
233
|
});
|
|
241
234
|
},
|
|
242
235
|
getJobTypes: (site, id) => {
|
|
243
|
-
let url = Helper$
|
|
236
|
+
let url = Helper$6.getUrl(values.serviceKey, 'getjobtypes');
|
|
244
237
|
return Session$9.authedFunction({
|
|
245
238
|
method: 'POST',
|
|
246
239
|
url,
|
|
@@ -250,7 +243,7 @@ const maintenanceActions = {
|
|
|
250
243
|
});
|
|
251
244
|
},
|
|
252
245
|
getJob: (site, id) => {
|
|
253
|
-
let url = Helper$
|
|
246
|
+
let url = Helper$6.getUrl(values.serviceKey, 'getJob');
|
|
254
247
|
return Session$9.authedFunction({
|
|
255
248
|
method: 'POST',
|
|
256
249
|
url,
|
|
@@ -261,7 +254,7 @@ const maintenanceActions = {
|
|
|
261
254
|
});
|
|
262
255
|
},
|
|
263
256
|
getJobByJobId: (site, jobId) => {
|
|
264
|
-
let url = Helper$
|
|
257
|
+
let url = Helper$6.getUrl(values.serviceKey, 'getJob');
|
|
265
258
|
return Session$9.authedFunction({
|
|
266
259
|
method: 'POST',
|
|
267
260
|
url,
|
|
@@ -276,7 +269,7 @@ const maintenanceActions = {
|
|
|
276
269
|
let type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
277
270
|
return Session$9.authedFunction({
|
|
278
271
|
method: 'POST',
|
|
279
|
-
url: Helper$
|
|
272
|
+
url: Helper$6.getUrl(values.serviceKey, 'getJobs'),
|
|
280
273
|
data: {
|
|
281
274
|
site,
|
|
282
275
|
status,
|
|
@@ -299,7 +292,7 @@ const maintenanceActions = {
|
|
|
299
292
|
}
|
|
300
293
|
return Session$9.authedFunction({
|
|
301
294
|
method: 'GET',
|
|
302
|
-
url: Helper$
|
|
295
|
+
url: Helper$6.getUrl(values.serviceKey, 'get/requests', query)
|
|
303
296
|
});
|
|
304
297
|
},
|
|
305
298
|
getJobsRecursive: function (site, status, type, lastKey) {
|
|
@@ -317,14 +310,14 @@ const maintenanceActions = {
|
|
|
317
310
|
createJob: job => {
|
|
318
311
|
return Session$9.authedFunction({
|
|
319
312
|
method: 'POST',
|
|
320
|
-
url: Helper$
|
|
313
|
+
url: Helper$6.getUrl(values.serviceKey, 'sendMaintenance'),
|
|
321
314
|
data: _objectSpread$7({}, job)
|
|
322
315
|
});
|
|
323
316
|
},
|
|
324
317
|
editJob: (job, site) => {
|
|
325
318
|
return Session$9.authedFunction({
|
|
326
319
|
method: 'POST',
|
|
327
|
-
url: Helper$
|
|
320
|
+
url: Helper$6.getUrl(values.serviceKey, 'editJob'),
|
|
328
321
|
data: {
|
|
329
322
|
job,
|
|
330
323
|
site
|
|
@@ -334,7 +327,7 @@ const maintenanceActions = {
|
|
|
334
327
|
deleteJob: (site, id) => {
|
|
335
328
|
return Session$9.authedFunction({
|
|
336
329
|
method: 'POST',
|
|
337
|
-
url: Helper$
|
|
330
|
+
url: Helper$6.getUrl(values.serviceKey, 'requests/remove'),
|
|
338
331
|
data: {
|
|
339
332
|
site,
|
|
340
333
|
id
|
|
@@ -344,7 +337,7 @@ const maintenanceActions = {
|
|
|
344
337
|
editJobStatus: (id, status) => {
|
|
345
338
|
return Session$9.authedFunction({
|
|
346
339
|
method: 'POST',
|
|
347
|
-
url: Helper$
|
|
340
|
+
url: Helper$6.getUrl(values.serviceKey, 'editJobStatus'),
|
|
348
341
|
data: {
|
|
349
342
|
id,
|
|
350
343
|
status
|
|
@@ -354,7 +347,7 @@ const maintenanceActions = {
|
|
|
354
347
|
editJobPriority: (id, priority) => {
|
|
355
348
|
return Session$9.authedFunction({
|
|
356
349
|
method: 'POST',
|
|
357
|
-
url: Helper$
|
|
350
|
+
url: Helper$6.getUrl(values.serviceKey, 'update/priority'),
|
|
358
351
|
data: {
|
|
359
352
|
id,
|
|
360
353
|
priority
|
|
@@ -364,7 +357,7 @@ const maintenanceActions = {
|
|
|
364
357
|
assignJob: (jobId, userId) => {
|
|
365
358
|
return Session$9.authedFunction({
|
|
366
359
|
method: 'POST',
|
|
367
|
-
url: Helper$
|
|
360
|
+
url: Helper$6.getUrl(values.serviceKey, 'update/assign'),
|
|
368
361
|
data: {
|
|
369
362
|
id: jobId,
|
|
370
363
|
userId
|
|
@@ -374,7 +367,7 @@ const maintenanceActions = {
|
|
|
374
367
|
getAssignees: site => {
|
|
375
368
|
return Session$9.authedFunction({
|
|
376
369
|
method: 'GET',
|
|
377
|
-
url: Helper$
|
|
370
|
+
url: Helper$6.getUrl(values.serviceKey, 'get/assignees', {
|
|
378
371
|
site
|
|
379
372
|
})
|
|
380
373
|
});
|
|
@@ -382,7 +375,7 @@ const maintenanceActions = {
|
|
|
382
375
|
addNote: (jobId, note, attachments, images) => {
|
|
383
376
|
return Session$9.authedFunction({
|
|
384
377
|
method: 'POST',
|
|
385
|
-
url: Helper$
|
|
378
|
+
url: Helper$6.getUrl(values.serviceKey, 'requests/note'),
|
|
386
379
|
data: {
|
|
387
380
|
id: jobId,
|
|
388
381
|
note,
|
|
@@ -395,7 +388,7 @@ const maintenanceActions = {
|
|
|
395
388
|
editNote: (jobId, noteId, note, attachments, images) => {
|
|
396
389
|
return Session$9.authedFunction({
|
|
397
390
|
method: 'POST',
|
|
398
|
-
url: Helper$
|
|
391
|
+
url: Helper$6.getUrl(values.serviceKey, 'requests/note'),
|
|
399
392
|
data: {
|
|
400
393
|
id: jobId,
|
|
401
394
|
note,
|
|
@@ -409,7 +402,7 @@ const maintenanceActions = {
|
|
|
409
402
|
deleteNote: (jobId, noteId) => {
|
|
410
403
|
return Session$9.authedFunction({
|
|
411
404
|
method: 'POST',
|
|
412
|
-
url: Helper$
|
|
405
|
+
url: Helper$6.getUrl(values.serviceKey, 'requests/note'),
|
|
413
406
|
data: {
|
|
414
407
|
id: jobId,
|
|
415
408
|
noteId,
|
|
@@ -429,7 +422,7 @@ const maintenanceActions = {
|
|
|
429
422
|
};
|
|
430
423
|
return Session$9.authedFunction({
|
|
431
424
|
method: 'POST',
|
|
432
|
-
url: Helper$
|
|
425
|
+
url: Helper$6.getUrl(values.serviceKey, 'createJobType'),
|
|
433
426
|
data
|
|
434
427
|
});
|
|
435
428
|
},
|
|
@@ -447,14 +440,14 @@ const maintenanceActions = {
|
|
|
447
440
|
if (hasCustomFields && customFields) data.customFields = customFields;
|
|
448
441
|
return Session$9.authedFunction({
|
|
449
442
|
method: 'POST',
|
|
450
|
-
url: Helper$
|
|
443
|
+
url: Helper$6.getUrl(values.serviceKey, 'editJobType'),
|
|
451
444
|
data
|
|
452
445
|
});
|
|
453
446
|
},
|
|
454
447
|
deleteJobType: (site, id) => {
|
|
455
448
|
return Session$9.authedFunction({
|
|
456
449
|
method: 'POST',
|
|
457
|
-
url: Helper$
|
|
450
|
+
url: Helper$6.getUrl(values.serviceKey, 'deleteJobType'),
|
|
458
451
|
data: {
|
|
459
452
|
site,
|
|
460
453
|
id
|
|
@@ -464,7 +457,7 @@ const maintenanceActions = {
|
|
|
464
457
|
getExternalSync: jobId => {
|
|
465
458
|
return Session$9.authedFunction({
|
|
466
459
|
method: 'GET',
|
|
467
|
-
url: Helper$
|
|
460
|
+
url: Helper$6.getUrl(values.serviceKey, 'get/externalsync', {
|
|
468
461
|
id: jobId
|
|
469
462
|
})
|
|
470
463
|
});
|
|
@@ -472,7 +465,7 @@ const maintenanceActions = {
|
|
|
472
465
|
retrySync: jobId => {
|
|
473
466
|
return Session$9.authedFunction({
|
|
474
467
|
method: 'POST',
|
|
475
|
-
url: Helper$
|
|
468
|
+
url: Helper$6.getUrl(values.serviceKey, 'update/retrysync'),
|
|
476
469
|
data: {
|
|
477
470
|
id: jobId
|
|
478
471
|
}
|
|
@@ -481,7 +474,7 @@ const maintenanceActions = {
|
|
|
481
474
|
};
|
|
482
475
|
|
|
483
476
|
const {
|
|
484
|
-
Helper: Helper$
|
|
477
|
+
Helper: Helper$5,
|
|
485
478
|
Session: Session$8
|
|
486
479
|
} = PlussCore;
|
|
487
480
|
const reactionActions = {
|
|
@@ -499,7 +492,7 @@ const reactionActions = {
|
|
|
499
492
|
}
|
|
500
493
|
return Session$8.authedFunction({
|
|
501
494
|
method: 'POST',
|
|
502
|
-
url: Helper$
|
|
495
|
+
url: Helper$5.getUrl('reactions', 'comments/add'),
|
|
503
496
|
data
|
|
504
497
|
});
|
|
505
498
|
},
|
|
@@ -522,7 +515,7 @@ const reactionActions = {
|
|
|
522
515
|
}
|
|
523
516
|
return Session$8.authedFunction({
|
|
524
517
|
method: 'GET',
|
|
525
|
-
url: Helper$
|
|
518
|
+
url: Helper$5.getUrl('reactions', 'comments/get', query)
|
|
526
519
|
});
|
|
527
520
|
}
|
|
528
521
|
};
|
|
@@ -556,7 +549,7 @@ var jobStatusOptions = [
|
|
|
556
549
|
];
|
|
557
550
|
|
|
558
551
|
const {
|
|
559
|
-
Helper: Helper$
|
|
552
|
+
Helper: Helper$4
|
|
560
553
|
} = PlussCore;
|
|
561
554
|
const jobsUpdate = (site, isdashboard) => {
|
|
562
555
|
return dispatch => {
|
|
@@ -564,7 +557,7 @@ const jobsUpdate = (site, isdashboard) => {
|
|
|
564
557
|
type: JOBS_LOADING
|
|
565
558
|
});
|
|
566
559
|
maintenanceActions.getJobsRecursive(site).then(res => {
|
|
567
|
-
const currentSite = Helper$
|
|
560
|
+
const currentSite = Helper$4.readStorageWithCookie('site');
|
|
568
561
|
if (!_.isEmpty(res) && res[0].site === currentSite) {
|
|
569
562
|
dispatch({
|
|
570
563
|
type: JOBS_LOADED,
|
|
@@ -2701,7 +2694,7 @@ function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
|
|
|
2701
2694
|
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2702
2695
|
const {
|
|
2703
2696
|
Apis: Apis$1,
|
|
2704
|
-
Helper: Helper$
|
|
2697
|
+
Helper: Helper$3,
|
|
2705
2698
|
Session: Session$3,
|
|
2706
2699
|
Colours: Colours$1,
|
|
2707
2700
|
Components: Components$3
|
|
@@ -3103,7 +3096,7 @@ class Job extends Component {
|
|
|
3103
3096
|
}
|
|
3104
3097
|
});
|
|
3105
3098
|
this.state = {
|
|
3106
|
-
jobId: Helper$
|
|
3099
|
+
jobId: Helper$3.safeReadParams(props, "jobId") ? props.match.params.jobId : null,
|
|
3107
3100
|
job: null,
|
|
3108
3101
|
showingSelector: false,
|
|
3109
3102
|
updating: false,
|
|
@@ -3306,7 +3299,7 @@ class Job extends Component {
|
|
|
3306
3299
|
}, /*#__PURE__*/React.createElement("div", {
|
|
3307
3300
|
className: "imageGrid_image",
|
|
3308
3301
|
style: {
|
|
3309
|
-
backgroundImage: "url('".concat(Helper$
|
|
3302
|
+
backgroundImage: "url('".concat(Helper$3.get1400(image), "')"),
|
|
3310
3303
|
width: size,
|
|
3311
3304
|
height: size
|
|
3312
3305
|
}
|
|
@@ -3521,7 +3514,7 @@ class Job extends Component {
|
|
|
3521
3514
|
}]
|
|
3522
3515
|
})), /*#__PURE__*/React.createElement("p", {
|
|
3523
3516
|
className: "maintenanceNote_text"
|
|
3524
|
-
}, Helper$
|
|
3517
|
+
}, Helper$3.toParagraphed(note.Note)), note.Attachments.map((a, i) => this.renderAttachment(a, i)), note.Images && note.Images.length > 0 ? this.renderImageGrid(note.Images, IMAGE_SIZE_NOTE) : null));
|
|
3525
3518
|
}
|
|
3526
3519
|
renderAssignment() {
|
|
3527
3520
|
const {
|
|
@@ -3955,7 +3948,7 @@ function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t
|
|
|
3955
3948
|
const {
|
|
3956
3949
|
Actions,
|
|
3957
3950
|
Components: Components$2,
|
|
3958
|
-
Helper: Helper$
|
|
3951
|
+
Helper: Helper$2,
|
|
3959
3952
|
Session: Session$2,
|
|
3960
3953
|
Colours,
|
|
3961
3954
|
Apis
|
|
@@ -4313,7 +4306,7 @@ class AddJob extends Component {
|
|
|
4313
4306
|
if (_.isNil(answer) || _.isEmpty(answer)) return true;
|
|
4314
4307
|
switch (type) {
|
|
4315
4308
|
case "email":
|
|
4316
|
-
return Helper$
|
|
4309
|
+
return Helper$2.isEmail(answer);
|
|
4317
4310
|
case "date":
|
|
4318
4311
|
return moment(answer, "YYYY-MM-DD", true).isValid();
|
|
4319
4312
|
case "time":
|
|
@@ -4334,7 +4327,7 @@ class AddJob extends Component {
|
|
|
4334
4327
|
this.customImageInputs = {};
|
|
4335
4328
|
this.customDocumentInputs = {};
|
|
4336
4329
|
this.state = {
|
|
4337
|
-
jobId: Helper$
|
|
4330
|
+
jobId: Helper$2.safeReadParams(this.props, "jobId") ? this.props.match.params.jobId : null,
|
|
4338
4331
|
job: null,
|
|
4339
4332
|
showingSelector: false,
|
|
4340
4333
|
updating: false,
|
|
@@ -4686,7 +4679,7 @@ class AddJob extends Component {
|
|
|
4686
4679
|
return /*#__PURE__*/React.createElement("p", {
|
|
4687
4680
|
className: "visitorSignIn_text-staticText",
|
|
4688
4681
|
key: fieldId
|
|
4689
|
-
}, Helper$
|
|
4682
|
+
}, Helper$2.toParagraphed(field.label, {
|
|
4690
4683
|
marginTop: 10
|
|
4691
4684
|
}));
|
|
4692
4685
|
case "date":
|
|
@@ -4941,7 +4934,7 @@ const mapStateToProps$2 = state => {
|
|
|
4941
4934
|
return {
|
|
4942
4935
|
auth,
|
|
4943
4936
|
strings: state.strings && state.strings.config || {},
|
|
4944
|
-
optionOnlyForResidents: Helper$
|
|
4937
|
+
optionOnlyForResidents: Helper$2.getSiteSettingFromState(state, values.optionOnlyForResidents)
|
|
4945
4938
|
};
|
|
4946
4939
|
};
|
|
4947
4940
|
var AddJob$1 = connect(mapStateToProps$2, {
|
|
@@ -4953,7 +4946,7 @@ var AddJob$1 = connect(mapStateToProps$2, {
|
|
|
4953
4946
|
const {
|
|
4954
4947
|
Components: Components$1,
|
|
4955
4948
|
Session: Session$1,
|
|
4956
|
-
Helper
|
|
4949
|
+
Helper: Helper$1
|
|
4957
4950
|
} = PlussCore;
|
|
4958
4951
|
const DEFAULT_FIELD = {
|
|
4959
4952
|
type: 'text',
|
|
@@ -4996,7 +4989,7 @@ class AddJobType extends Component {
|
|
|
4996
4989
|
const {
|
|
4997
4990
|
jobTypeEmail
|
|
4998
4991
|
} = this.state;
|
|
4999
|
-
return !_.isEmpty(jobTypeEmail) && Helper.isEmail(jobTypeEmail);
|
|
4992
|
+
return !_.isEmpty(jobTypeEmail) && Helper$1.isEmail(jobTypeEmail);
|
|
5000
4993
|
});
|
|
5001
4994
|
_defineProperty(this, "isJobTypeValid", () => {
|
|
5002
4995
|
const {
|
|
@@ -5198,7 +5191,7 @@ class AddJobType extends Component {
|
|
|
5198
5191
|
}];
|
|
5199
5192
|
this.state = {
|
|
5200
5193
|
loading: false,
|
|
5201
|
-
jobTypeId: Helper.safeReadParams(this.props, 'jobTypeId') ? this.props.match.params.jobTypeId : null,
|
|
5194
|
+
jobTypeId: Helper$1.safeReadParams(this.props, 'jobTypeId') ? this.props.match.params.jobTypeId : null,
|
|
5202
5195
|
jobTypeName: '',
|
|
5203
5196
|
jobTypeEmail: '',
|
|
5204
5197
|
jobTypeDescription: '',
|
|
@@ -5750,7 +5743,8 @@ var AddJobType$1 = connect(mapStateToProps$1, {
|
|
|
5750
5743
|
const {
|
|
5751
5744
|
Analytics: Analytics$1,
|
|
5752
5745
|
Session,
|
|
5753
|
-
Components
|
|
5746
|
+
Components,
|
|
5747
|
+
Helper
|
|
5754
5748
|
} = PlussCore;
|
|
5755
5749
|
const getInitialState = () => ({
|
|
5756
5750
|
requests: 0,
|
|
@@ -5770,10 +5764,21 @@ const AnalyticsHub = _ref => {
|
|
|
5770
5764
|
auth,
|
|
5771
5765
|
prevText,
|
|
5772
5766
|
dayCount,
|
|
5773
|
-
strings
|
|
5767
|
+
strings,
|
|
5768
|
+
userType,
|
|
5769
|
+
userCategory,
|
|
5770
|
+
selectedSites
|
|
5774
5771
|
} = _ref;
|
|
5775
5772
|
const [analyticsData, setAnalyticsData] = useState(getInitialState());
|
|
5776
5773
|
const [isExportOpen, setIsExportOpen] = useState(false);
|
|
5774
|
+
const [failedSites, setFailedSites] = useState([]);
|
|
5775
|
+
const [comparisonData, setComparisonData] = useState({
|
|
5776
|
+
requests: [],
|
|
5777
|
+
completedRequests: [],
|
|
5778
|
+
comments: [],
|
|
5779
|
+
isLoading: true
|
|
5780
|
+
});
|
|
5781
|
+
const comparisonMode = selectedSites && selectedSites.length > 1;
|
|
5777
5782
|
const hasAccess = Session.validateAccess(auth.site, values.permissionMaintenanceTracking, auth);
|
|
5778
5783
|
if (!hasAccess) {
|
|
5779
5784
|
return null;
|
|
@@ -5785,50 +5790,120 @@ const AnalyticsHub = _ref => {
|
|
|
5785
5790
|
return strings.sideNav[key];
|
|
5786
5791
|
})();
|
|
5787
5792
|
const exportColumns = [{
|
|
5788
|
-
label:
|
|
5789
|
-
key:
|
|
5790
|
-
}, {
|
|
5791
|
-
label:
|
|
5792
|
-
key:
|
|
5793
|
+
label: "Select All",
|
|
5794
|
+
key: ""
|
|
5795
|
+
}, ...(comparisonMode ? [{
|
|
5796
|
+
label: "Site",
|
|
5797
|
+
key: "site"
|
|
5798
|
+
}] : []), {
|
|
5799
|
+
label: "Start Date",
|
|
5800
|
+
key: "startDate"
|
|
5793
5801
|
}, {
|
|
5794
|
-
label:
|
|
5795
|
-
key:
|
|
5802
|
+
label: "End Date",
|
|
5803
|
+
key: "endDate"
|
|
5796
5804
|
}, {
|
|
5797
5805
|
label: "".concat(values.textSingularName, "s"),
|
|
5798
|
-
key:
|
|
5806
|
+
key: "requests"
|
|
5799
5807
|
}, {
|
|
5800
5808
|
label: "Completed ".concat(values.textSingularName, "s"),
|
|
5801
|
-
key:
|
|
5809
|
+
key: "completedRequests"
|
|
5802
5810
|
}, {
|
|
5803
|
-
label:
|
|
5804
|
-
key:
|
|
5811
|
+
label: "Comments",
|
|
5812
|
+
key: "comments"
|
|
5805
5813
|
}];
|
|
5806
5814
|
useEffect(() => {
|
|
5807
5815
|
getData();
|
|
5808
|
-
}, [startTime, endTime]);
|
|
5816
|
+
}, [startTime, endTime, userType, userCategory, selectedSites]);
|
|
5809
5817
|
const getData = async () => {
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5818
|
+
if (comparisonMode) {
|
|
5819
|
+
setComparisonData({
|
|
5820
|
+
requests: [],
|
|
5821
|
+
completedRequests: [],
|
|
5822
|
+
comments: [],
|
|
5823
|
+
isLoading: true
|
|
5824
|
+
});
|
|
5825
|
+
const multiSiteResultsObj = await Analytics$1.fetchMultiSiteData(selectedSites, async site => {
|
|
5826
|
+
const {
|
|
5827
|
+
data
|
|
5828
|
+
} = await analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime, endTime, true, {
|
|
5829
|
+
userType,
|
|
5830
|
+
userCategory
|
|
5831
|
+
});
|
|
5832
|
+
return data;
|
|
5833
|
+
});
|
|
5834
|
+
const roles = auth.user.Roles;
|
|
5835
|
+
const failed = Object.entries(multiSiteResultsObj).filter(_ref2 => {
|
|
5836
|
+
let [, data] = _ref2;
|
|
5837
|
+
return data === null;
|
|
5838
|
+
}).map(_ref3 => {
|
|
5839
|
+
let [site] = _ref3;
|
|
5840
|
+
return Helper.getSiteNameFromRoles(site, roles);
|
|
5841
|
+
});
|
|
5842
|
+
setFailedSites(failed);
|
|
5843
|
+
const multiSiteResults = Object.entries(multiSiteResultsObj).filter(_ref4 => {
|
|
5844
|
+
let [, data] = _ref4;
|
|
5845
|
+
return data !== null;
|
|
5846
|
+
}).map(_ref5 => {
|
|
5847
|
+
let [site, data] = _ref5;
|
|
5848
|
+
return {
|
|
5849
|
+
site,
|
|
5850
|
+
data
|
|
5851
|
+
};
|
|
5852
|
+
});
|
|
5853
|
+
const buildComparison = (activityKey, countType) => multiSiteResults.map(result => ({
|
|
5854
|
+
name: Helper.getSiteNameFromRoles(result.site, roles),
|
|
5855
|
+
value: Analytics$1.countActivities(result.data, activityKey, countType)
|
|
5856
|
+
}));
|
|
5857
|
+
setComparisonData({
|
|
5858
|
+
requests: buildComparison("Request", "total"),
|
|
5859
|
+
completedRequests: buildComparison("RequestCompleted", "unique"),
|
|
5860
|
+
comments: buildComparison("Comment", "total"),
|
|
5861
|
+
isLoading: false
|
|
5862
|
+
});
|
|
5863
|
+
} else {
|
|
5864
|
+
setAnalyticsData(getInitialState());
|
|
5865
|
+
const site = selectedSites && selectedSites.length === 1 ? selectedSites[0] : auth.site;
|
|
5866
|
+
const timeDifference = endTime - startTime;
|
|
5867
|
+
const [currentStatsResponse, prevStatsResponse] = await Promise.all([analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime, endTime, true, {
|
|
5868
|
+
userType,
|
|
5869
|
+
userCategory
|
|
5870
|
+
}), analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime - timeDifference, startTime, true, {
|
|
5871
|
+
userType,
|
|
5872
|
+
userCategory
|
|
5873
|
+
})]);
|
|
5874
|
+
const data = {
|
|
5875
|
+
requests: Analytics$1.countActivities(currentStatsResponse.data, "Request", "total"),
|
|
5876
|
+
prevRequests: Analytics$1.countActivities(prevStatsResponse.data, "Request", "total"),
|
|
5877
|
+
completedRequests: Analytics$1.countActivities(currentStatsResponse.data, "RequestCompleted", "unique"),
|
|
5878
|
+
prevCompletedRequests: Analytics$1.countActivities(prevStatsResponse.data, "RequestCompleted", "unique"),
|
|
5879
|
+
comments: Analytics$1.countActivities(currentStatsResponse.data, "Comment", "total"),
|
|
5880
|
+
prevComments: Analytics$1.countActivities(prevStatsResponse.data, "Comment", "total"),
|
|
5881
|
+
isLoading: false
|
|
5882
|
+
};
|
|
5883
|
+
setAnalyticsData(data);
|
|
5884
|
+
}
|
|
5824
5885
|
};
|
|
5825
5886
|
const isReadyToOpenCSV = () => {
|
|
5826
|
-
return !analyticsData.isLoading;
|
|
5887
|
+
return comparisonMode ? !comparisonData.isLoading : !analyticsData.isLoading;
|
|
5827
5888
|
};
|
|
5828
5889
|
const getExportSource = () => {
|
|
5890
|
+
if (comparisonMode) {
|
|
5891
|
+
const sites = comparisonData.requests || [];
|
|
5892
|
+
return sites.map((site, i) => {
|
|
5893
|
+
var _comparisonData$compl, _comparisonData$comme;
|
|
5894
|
+
return {
|
|
5895
|
+
site: site.name,
|
|
5896
|
+
startDate: moment(startTime + 1).format("D-MM-YYYY"),
|
|
5897
|
+
endDate: moment(endTime).format("D-MM-YYYY"),
|
|
5898
|
+
requests: site.value,
|
|
5899
|
+
completedRequests: ((_comparisonData$compl = comparisonData.completedRequests[i]) === null || _comparisonData$compl === void 0 ? void 0 : _comparisonData$compl.value) || 0,
|
|
5900
|
+
comments: ((_comparisonData$comme = comparisonData.comments[i]) === null || _comparisonData$comme === void 0 ? void 0 : _comparisonData$comme.value) || 0
|
|
5901
|
+
};
|
|
5902
|
+
});
|
|
5903
|
+
}
|
|
5829
5904
|
return [{
|
|
5830
|
-
startDate: moment(startTime + 1).format(
|
|
5831
|
-
endDate: moment(endTime).format(
|
|
5905
|
+
startDate: moment(startTime + 1).format("D-MM-YYYY"),
|
|
5906
|
+
endDate: moment(endTime).format("D-MM-YYYY"),
|
|
5832
5907
|
requests: analyticsData.requests,
|
|
5833
5908
|
completedRequests: analyticsData.completedRequests,
|
|
5834
5909
|
comments: analyticsData.comments
|
|
@@ -5839,13 +5914,14 @@ const AnalyticsHub = _ref => {
|
|
|
5839
5914
|
return null;
|
|
5840
5915
|
}
|
|
5841
5916
|
const source = getExportSource();
|
|
5917
|
+
const filterSuffix = [userType, userCategory].filter(Boolean).map(f => f.toLowerCase().replace(/\s+/g, '-')).join('_');
|
|
5842
5918
|
return /*#__PURE__*/React.createElement(Components.ExportCsvPopup, {
|
|
5843
5919
|
onClose: () => {
|
|
5844
5920
|
setIsExportOpen(false);
|
|
5845
5921
|
},
|
|
5846
5922
|
columns: exportColumns,
|
|
5847
5923
|
source: source,
|
|
5848
|
-
filename: "".concat(values.analyticsKey, "
|
|
5924
|
+
filename: "".concat(values.analyticsKey, "analytics").concat(comparisonMode ? '_comparison' : '').concat(filterSuffix ? "_".concat(filterSuffix) : '', "_").concat(source[0].startDate, "_").concat(source[0].endDate, ".csv")
|
|
5849
5925
|
});
|
|
5850
5926
|
};
|
|
5851
5927
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -5862,33 +5938,68 @@ const AnalyticsHub = _ref => {
|
|
|
5862
5938
|
},
|
|
5863
5939
|
isActive: isReadyToOpenCSV(),
|
|
5864
5940
|
leftIcon: "file-code-o"
|
|
5865
|
-
}, "Export CSV")), /*#__PURE__*/React.createElement(
|
|
5941
|
+
}, "Export CSV")), failedSites.length > 0 && /*#__PURE__*/React.createElement(Components.Text, {
|
|
5942
|
+
type: "help",
|
|
5943
|
+
style: {
|
|
5944
|
+
color: '#c02743'
|
|
5945
|
+
}
|
|
5946
|
+
}, "Data unavailable for: ", failedSites.join(', ')), /*#__PURE__*/React.createElement("div", {
|
|
5866
5947
|
className: "analyticsSection dashboardSection_content"
|
|
5867
|
-
},
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
5891
|
-
|
|
5948
|
+
}, (() => {
|
|
5949
|
+
const chartSuffix = [selectedSites && selectedSites.length > 0 ? "&sites=".concat(selectedSites.join(",")) : "", userType ? "&userType=".concat(encodeURIComponent(userType)) : "", userCategory ? "&userCategory=".concat(encodeURIComponent(userCategory)) : ""].join("");
|
|
5950
|
+
if (comparisonMode) {
|
|
5951
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
5952
|
+
style: {
|
|
5953
|
+
display: "flex",
|
|
5954
|
+
flexDirection: "column",
|
|
5955
|
+
gap: 16
|
|
5956
|
+
}
|
|
5957
|
+
}, /*#__PURE__*/React.createElement(Components.ComparisonStatBox, {
|
|
5958
|
+
title: "".concat(featureTitle, " Requests"),
|
|
5959
|
+
data: comparisonData.requests,
|
|
5960
|
+
prevText: prevText,
|
|
5961
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Request&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
5962
|
+
isLoading: comparisonData.isLoading
|
|
5963
|
+
}), /*#__PURE__*/React.createElement(Components.ComparisonStatBox, {
|
|
5964
|
+
title: "Completed ".concat(featureTitle, " Requests"),
|
|
5965
|
+
data: comparisonData.completedRequests,
|
|
5966
|
+
prevText: prevText,
|
|
5967
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=RequestCompleted&countType=unique&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
5968
|
+
isLoading: comparisonData.isLoading
|
|
5969
|
+
}), /*#__PURE__*/React.createElement(Components.ComparisonStatBox, {
|
|
5970
|
+
title: "".concat(featureTitle, " Comments"),
|
|
5971
|
+
data: comparisonData.comments,
|
|
5972
|
+
prevText: prevText,
|
|
5973
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Comment&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
5974
|
+
isLoading: comparisonData.isLoading
|
|
5975
|
+
}));
|
|
5976
|
+
}
|
|
5977
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Components.StatBox, {
|
|
5978
|
+
title: "".concat(featureTitle, " Requests"),
|
|
5979
|
+
icon: faWrench,
|
|
5980
|
+
value: analyticsData.requests,
|
|
5981
|
+
previousValue: analyticsData.prevRequests,
|
|
5982
|
+
prevText: prevText,
|
|
5983
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Request&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
5984
|
+
isLoading: analyticsData.isLoading
|
|
5985
|
+
}), /*#__PURE__*/React.createElement(Components.StatBox, {
|
|
5986
|
+
title: "Completed ".concat(featureTitle, " Requests"),
|
|
5987
|
+
icon: faCircleCheck,
|
|
5988
|
+
value: analyticsData.completedRequests,
|
|
5989
|
+
previousValue: analyticsData.prevCompletedRequests,
|
|
5990
|
+
prevText: prevText,
|
|
5991
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=RequestCompleted&countType=unique&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
5992
|
+
isLoading: analyticsData.isLoading
|
|
5993
|
+
}), /*#__PURE__*/React.createElement(Components.StatBox, {
|
|
5994
|
+
title: "".concat(featureTitle, " Comments"),
|
|
5995
|
+
icon: faComment,
|
|
5996
|
+
value: analyticsData.comments,
|
|
5997
|
+
previousValue: analyticsData.prevComments,
|
|
5998
|
+
prevText: prevText,
|
|
5999
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Comment&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
6000
|
+
isLoading: analyticsData.isLoading
|
|
6001
|
+
}));
|
|
6002
|
+
})()));
|
|
5892
6003
|
};
|
|
5893
6004
|
const mapStateToProps = state => {
|
|
5894
6005
|
const {
|