@lighthouse/common 6.5.0 → 6.6.0-canary.0
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/constants.js +7 -13
- package/dist/errors/DomainError.js +2 -4
- package/dist/errors/ValidationError.js +0 -8
- package/dist/errors/index.js +1 -5
- package/dist/helpers/build-fetch-url/index.js +0 -5
- package/dist/helpers/fetch-image/index.js +16 -32
- package/dist/helpers/fetch-image-for-pdf-generator-service/index.js +7 -40
- package/dist/helpers/fetch-image-for-web/index.js +0 -9
- package/dist/helpers/fetch-lighthouse-logo/index.js +2 -13
- package/dist/helpers/floatify/index.js +0 -1
- package/dist/helpers/get-assignees-full-names/index.js +0 -4
- package/dist/helpers/get-audit-entry-details/index.js +0 -3
- package/dist/helpers/get-audit-items-data/index.js +2 -6
- package/dist/helpers/get-geometry-geocoded-string/index.js +0 -3
- package/dist/helpers/get-issue-details/index.js +0 -7
- package/dist/helpers/get-job-details/index.js +0 -7
- package/dist/helpers/get-location-reference/index.js +18 -21
- package/dist/helpers/get-pretty-duration/index.js +0 -5
- package/dist/helpers/get-reference-details/index.js +0 -4
- package/dist/helpers/get-status-details/index.js +2 -9
- package/dist/helpers/get-task-entry-details/index.js +0 -3
- package/dist/helpers/get-timezone-abbr/index.js +0 -4
- package/dist/helpers/get-timezone-datetime/index.js +0 -5
- package/dist/helpers/get-user-full-name/index.js +0 -1
- package/dist/helpers/get-value-as-percentage/index.js +0 -1
- package/dist/helpers/image-validators/index.js +8 -9
- package/dist/helpers/index.js +16 -33
- package/dist/images/index.js +5 -9
- package/dist/index.js +4 -20
- package/dist/pdf/activity-report/index.js +41 -62
- package/dist/pdf/audit/index.js +0 -14
- package/dist/pdf/helpers/build-audit-content/index.js +4 -15
- package/dist/pdf/helpers/build-audit-follow-ups/index.js +4 -14
- package/dist/pdf/helpers/build-location-scans-content/index.js +4 -17
- package/dist/pdf/helpers/build-template-content/index.js +5 -14
- package/dist/pdf/helpers/default-footer/index.js +2 -3
- package/dist/pdf/helpers/default-header/index.js +0 -2
- package/dist/pdf/helpers/default-styles/index.js +2 -3
- package/dist/pdf/helpers/fields/index.js +21 -51
- package/dist/pdf/helpers/format-location-address/index.js +0 -3
- package/dist/pdf/helpers/generate-definition/index.js +0 -12
- package/dist/pdf/helpers/horizontal-line/index.js +0 -1
- package/dist/pdf/helpers/html-transformer/index.js +11 -23
- package/dist/pdf/helpers/index.js +40 -55
- package/dist/pdf/helpers/parse-value/index.js +2 -6
- package/dist/pdf/helpers/table/index.js +13 -31
- package/dist/pdf/helpers/text/index.js +0 -1
- package/dist/pdf/icons/index.js +3 -5
- package/dist/pdf/index.js +4 -10
- package/dist/pdf/issue/index.js +17 -16
- package/dist/pdf/job/index.js +1 -13
- package/dist/pdf/shift-report/emptyFixtures.js +4 -6
- package/dist/pdf/shift-report/index.js +2 -25
- package/dist/pdf/task/index.js +0 -13
- package/dist/scheduling/generators/index.js +0 -6
- package/dist/scheduling/generators/occurrenceIntervalsGenerator.js +1 -6
- package/dist/scheduling/generators/scheduleIntervalsGenerator.js +0 -5
- package/dist/scheduling/generators/serviceIntervalsGenerator.js +13 -27
- package/dist/scheduling/helpers/convertToTimezone.js +1 -6
- package/dist/scheduling/helpers/generateNonRepeatingSchedule.js +3 -9
- package/dist/scheduling/helpers/generateRepeatingSchedule.js +11 -18
- package/dist/scheduling/helpers/generateScheduleEnd.js +2 -8
- package/dist/scheduling/helpers/hasValidStartAndEnd.js +0 -6
- package/dist/scheduling/helpers/index.js +0 -28
- package/dist/scheduling/helpers/intervalCovers.js +0 -1
- package/dist/scheduling/helpers/intervalIntersectsEnd.js +0 -1
- package/dist/scheduling/helpers/intervalIntersectsStart.js +0 -1
- package/dist/scheduling/helpers/intervalOnlyIntersectsEnd.js +1 -3
- package/dist/scheduling/helpers/intervalOnlyIntersectsStart.js +0 -3
- package/dist/scheduling/helpers/intervalOutside.js +0 -1
- package/dist/scheduling/helpers/intervalWithin.js +0 -1
- package/dist/scheduling/helpers/mergeIntervals.js +0 -4
- package/dist/scheduling/helpers/splitIntervals.js +0 -3
- package/dist/scheduling/index.js +0 -6
- package/dist/scheduling/scheduling.types.js +10 -18
- package/dist/scheduling/strategies/getNext.js +2 -13
- package/dist/scheduling/strategies/getNextExactDateOfMonth.js +0 -12
- package/dist/scheduling/strategies/getNextLastDayOfMonth.js +0 -10
- package/dist/scheduling/strategies/getNextLastWeekdayOfMonth.js +0 -11
- package/dist/scheduling/strategies/getNextNoRepeat.js +0 -7
- package/dist/scheduling/strategies/getNextWeekday.js +0 -10
- package/dist/scheduling/strategies/getNextXDayOfXWeekOfMonth.js +0 -12
- package/dist/scheduling/strategies/index.js +0 -14
- package/dist/schema/index.js +0 -2
- package/dist/schema/schema.js +2 -7
- package/dist/service-hours/__helpers__/calculate-hours.js +4 -13
- package/dist/service-hours/__helpers__/isOpen.js +0 -9
- package/dist/service-hours/index.js +0 -4
- package/dist/service-hours/schema.js +20 -43
- package/lib/constants.js.map +1 -1
- package/lib/errors/DomainError.js +11 -47
- package/lib/errors/DomainError.js.map +1 -1
- package/lib/errors/ValidationError.js +15 -52
- package/lib/errors/ValidationError.js.map +1 -1
- package/lib/errors/index.js.map +1 -1
- package/lib/helpers/build-fetch-url/index.js +14 -20
- package/lib/helpers/build-fetch-url/index.js.map +1 -1
- package/lib/helpers/fetch-image/index.js +20 -27
- package/lib/helpers/fetch-image/index.js.map +1 -1
- package/lib/helpers/fetch-image-for-pdf-generator-service/index.js +187 -239
- package/lib/helpers/fetch-image-for-pdf-generator-service/index.js.map +1 -1
- package/lib/helpers/fetch-image-for-web/index.js +50 -66
- package/lib/helpers/fetch-image-for-web/index.js.map +1 -1
- package/lib/helpers/fetch-lighthouse-logo/index.js +47 -59
- package/lib/helpers/fetch-lighthouse-logo/index.js.map +1 -1
- package/lib/helpers/floatify/index.js.map +1 -1
- package/lib/helpers/get-assignees-full-names/index.js +0 -1
- package/lib/helpers/get-assignees-full-names/index.js.map +1 -1
- package/lib/helpers/get-audit-entry-details/index.js +8 -8
- package/lib/helpers/get-audit-entry-details/index.js.map +1 -1
- package/lib/helpers/get-audit-items-data/index.js +16 -19
- package/lib/helpers/get-audit-items-data/index.js.map +1 -1
- package/lib/helpers/get-geometry-geocoded-string/index.js.map +1 -1
- package/lib/helpers/get-issue-details/index.js +11 -11
- package/lib/helpers/get-issue-details/index.js.map +1 -1
- package/lib/helpers/get-job-details/index.js +12 -12
- package/lib/helpers/get-job-details/index.js.map +1 -1
- package/lib/helpers/get-location-reference/index.js +32 -36
- package/lib/helpers/get-location-reference/index.js.map +1 -1
- package/lib/helpers/get-pretty-duration/index.js +0 -4
- package/lib/helpers/get-pretty-duration/index.js.map +1 -1
- package/lib/helpers/get-reference-details/index.js +1 -3
- package/lib/helpers/get-reference-details/index.js.map +1 -1
- package/lib/helpers/get-status-details/index.js +0 -4
- package/lib/helpers/get-status-details/index.js.map +1 -1
- package/lib/helpers/get-task-entry-details/index.js +5 -5
- package/lib/helpers/get-task-entry-details/index.js.map +1 -1
- package/lib/helpers/get-timezone-abbr/index.js.map +1 -1
- package/lib/helpers/get-timezone-datetime/index.js +6 -6
- package/lib/helpers/get-timezone-datetime/index.js.map +1 -1
- package/lib/helpers/get-user-full-name/index.js.map +1 -1
- package/lib/helpers/get-value-as-percentage/index.js.map +1 -1
- package/lib/helpers/image-validators/index.js +8 -7
- package/lib/helpers/image-validators/index.js.map +1 -1
- package/lib/helpers/index.js.map +1 -1
- package/lib/images/index.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/pdf/activity-report/index.js +360 -416
- package/lib/pdf/activity-report/index.js.map +1 -1
- package/lib/pdf/audit/index.js +25 -36
- package/lib/pdf/audit/index.js.map +1 -1
- package/lib/pdf/fonts/index.js.map +1 -1
- package/lib/pdf/helpers/build-audit-content/index.js +3 -5
- package/lib/pdf/helpers/build-audit-content/index.js.map +1 -1
- package/lib/pdf/helpers/build-audit-follow-ups/index.js +5 -12
- package/lib/pdf/helpers/build-audit-follow-ups/index.js.map +1 -1
- package/lib/pdf/helpers/build-location-scans-content/index.js +4 -9
- package/lib/pdf/helpers/build-location-scans-content/index.js.map +1 -1
- package/lib/pdf/helpers/build-template-content/index.js +7 -9
- package/lib/pdf/helpers/build-template-content/index.js.map +1 -1
- package/lib/pdf/helpers/default-footer/index.js +9 -8
- package/lib/pdf/helpers/default-footer/index.js.map +1 -1
- package/lib/pdf/helpers/default-header/index.js +5 -5
- package/lib/pdf/helpers/default-header/index.js.map +1 -1
- package/lib/pdf/helpers/default-styles/index.js.map +1 -1
- package/lib/pdf/helpers/fields/index.js +48 -81
- package/lib/pdf/helpers/fields/index.js.map +1 -1
- package/lib/pdf/helpers/format-location-address/index.js.map +1 -1
- package/lib/pdf/helpers/generate-definition/index.js +22 -29
- package/lib/pdf/helpers/generate-definition/index.js.map +1 -1
- package/lib/pdf/helpers/horizontal-line/index.js +1 -1
- package/lib/pdf/helpers/horizontal-line/index.js.map +1 -1
- package/lib/pdf/helpers/html-transformer/index.js +19 -30
- package/lib/pdf/helpers/html-transformer/index.js.map +1 -1
- package/lib/pdf/helpers/index.js.map +1 -1
- package/lib/pdf/helpers/parse-value/index.js +2 -4
- package/lib/pdf/helpers/parse-value/index.js.map +1 -1
- package/lib/pdf/helpers/table/index.js +78 -84
- package/lib/pdf/helpers/table/index.js.map +1 -1
- package/lib/pdf/helpers/text/index.js +2 -5
- package/lib/pdf/helpers/text/index.js.map +1 -1
- package/lib/pdf/icons/index.js.map +1 -1
- package/lib/pdf/index.js.map +1 -1
- package/lib/pdf/issue/index.js +36 -30
- package/lib/pdf/issue/index.js.map +1 -1
- package/lib/pdf/job/index.js +12 -19
- package/lib/pdf/job/index.js.map +1 -1
- package/lib/pdf/shift-report/emptyFixtures.js.map +1 -1
- package/lib/pdf/shift-report/index.js +308 -374
- package/lib/pdf/shift-report/index.js.map +1 -1
- package/lib/pdf/task/index.js +11 -19
- package/lib/pdf/task/index.js.map +1 -1
- package/lib/scheduling/generators/index.js.map +1 -1
- package/lib/scheduling/generators/occurrenceIntervalsGenerator.js +27 -38
- package/lib/scheduling/generators/occurrenceIntervalsGenerator.js.map +1 -1
- package/lib/scheduling/generators/scheduleIntervalsGenerator.js +19 -30
- package/lib/scheduling/generators/scheduleIntervalsGenerator.js.map +1 -1
- package/lib/scheduling/generators/serviceIntervalsGenerator.js +139 -181
- package/lib/scheduling/generators/serviceIntervalsGenerator.js.map +1 -1
- package/lib/scheduling/helpers/convertToTimezone.js +1 -1
- package/lib/scheduling/helpers/convertToTimezone.js.map +1 -1
- package/lib/scheduling/helpers/generateNonRepeatingSchedule.js +84 -124
- package/lib/scheduling/helpers/generateNonRepeatingSchedule.js.map +1 -1
- package/lib/scheduling/helpers/generateRepeatingSchedule.js +107 -175
- package/lib/scheduling/helpers/generateRepeatingSchedule.js.map +1 -1
- package/lib/scheduling/helpers/generateScheduleEnd.js +6 -6
- package/lib/scheduling/helpers/generateScheduleEnd.js.map +1 -1
- package/lib/scheduling/helpers/hasValidStartAndEnd.js +1 -2
- package/lib/scheduling/helpers/hasValidStartAndEnd.js.map +1 -1
- package/lib/scheduling/helpers/index.js.map +1 -1
- package/lib/scheduling/helpers/intervalCovers.js.map +1 -1
- package/lib/scheduling/helpers/intervalIntersectsEnd.js.map +1 -1
- package/lib/scheduling/helpers/intervalIntersectsStart.js.map +1 -1
- package/lib/scheduling/helpers/intervalOnlyIntersectsEnd.js +1 -0
- package/lib/scheduling/helpers/intervalOnlyIntersectsEnd.js.map +1 -1
- package/lib/scheduling/helpers/intervalOnlyIntersectsStart.js +1 -1
- package/lib/scheduling/helpers/intervalOnlyIntersectsStart.js.map +1 -1
- package/lib/scheduling/helpers/intervalOutside.js.map +1 -1
- package/lib/scheduling/helpers/intervalWithin.js.map +1 -1
- package/lib/scheduling/helpers/mergeIntervals.js +0 -3
- package/lib/scheduling/helpers/mergeIntervals.js.map +1 -1
- package/lib/scheduling/helpers/splitIntervals.js +1 -1
- package/lib/scheduling/helpers/splitIntervals.js.map +1 -1
- package/lib/scheduling/index.js.map +1 -1
- package/lib/scheduling/scheduling.types.js +9 -14
- package/lib/scheduling/scheduling.types.js.map +1 -1
- package/lib/scheduling/strategies/getNext.js +22 -30
- package/lib/scheduling/strategies/getNext.js.map +1 -1
- package/lib/scheduling/strategies/getNextExactDateOfMonth.js +22 -31
- package/lib/scheduling/strategies/getNextExactDateOfMonth.js.map +1 -1
- package/lib/scheduling/strategies/getNextLastDayOfMonth.js +21 -28
- package/lib/scheduling/strategies/getNextLastDayOfMonth.js.map +1 -1
- package/lib/scheduling/strategies/getNextLastWeekdayOfMonth.js +21 -28
- package/lib/scheduling/strategies/getNextLastWeekdayOfMonth.js.map +1 -1
- package/lib/scheduling/strategies/getNextNoRepeat.js +15 -23
- package/lib/scheduling/strategies/getNextNoRepeat.js.map +1 -1
- package/lib/scheduling/strategies/getNextWeekday.js +43 -78
- package/lib/scheduling/strategies/getNextWeekday.js.map +1 -1
- package/lib/scheduling/strategies/getNextXDayOfXWeekOfMonth.js +21 -28
- package/lib/scheduling/strategies/getNextXDayOfXWeekOfMonth.js.map +1 -1
- package/lib/scheduling/strategies/index.js.map +1 -1
- package/lib/schema/index.js.map +1 -1
- package/lib/schema/schema.js +22 -30
- package/lib/schema/schema.js.map +1 -1
- package/lib/service-hours/__helpers__/calculate-hours.js +4 -13
- package/lib/service-hours/__helpers__/calculate-hours.js.map +1 -1
- package/lib/service-hours/__helpers__/isOpen.js +3 -7
- package/lib/service-hours/__helpers__/isOpen.js.map +1 -1
- package/lib/service-hours/index.js.map +1 -1
- package/lib/service-hours/schema.js +21 -36
- package/lib/service-hours/schema.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
4
3
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
5
|
-
|
|
6
|
-
function ownKeys(
|
|
7
|
-
|
|
8
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9
|
-
|
|
4
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
|
+
function ownKeys(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; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
7
|
import { filter, find, groupBy, isEmpty, map, size, sortBy, take, toString, reduce } from 'lodash';
|
|
11
8
|
import moment from 'moment-timezone';
|
|
12
9
|
import Promise from 'bluebird';
|
|
@@ -16,6 +13,7 @@ import { launchIcon } from '../../images';
|
|
|
16
13
|
var DEFAULT_MAX_SCANS = 200;
|
|
17
14
|
var MAX_ATTACHMENTS = 100;
|
|
18
15
|
var LIGHTHOUSE_BASE_URL = 'https://app.lighthouse.io';
|
|
16
|
+
|
|
19
17
|
/**
|
|
20
18
|
* buildActivityPdf
|
|
21
19
|
*
|
|
@@ -49,371 +47,323 @@ var LIGHTHOUSE_BASE_URL = 'https://app.lighthouse.io';
|
|
|
49
47
|
* @param {array} data.users - user documents
|
|
50
48
|
* @returns {Promise} returns pdfmake definition object
|
|
51
49
|
*/
|
|
52
|
-
|
|
53
50
|
export function buildActivityPdf(_x, _x2) {
|
|
54
51
|
return _buildActivityPdf.apply(this, arguments);
|
|
55
52
|
}
|
|
56
|
-
|
|
57
53
|
function _buildActivityPdf() {
|
|
58
|
-
_buildActivityPdf = _asyncToGenerator(
|
|
54
|
+
_buildActivityPdf = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(pdfOptions, data) {
|
|
59
55
|
var timestamp, timezone, title, content;
|
|
60
|
-
return _regeneratorRuntime.wrap(function
|
|
61
|
-
while (1) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
content
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
case 6:
|
|
80
|
-
case "end":
|
|
81
|
-
return _context.stop();
|
|
82
|
-
}
|
|
56
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
57
|
+
while (1) switch (_context.prev = _context.next) {
|
|
58
|
+
case 0:
|
|
59
|
+
timestamp = data.timestamp, timezone = data.timezone;
|
|
60
|
+
title = 'Daily Activity Report';
|
|
61
|
+
_context.next = 1;
|
|
62
|
+
return generateContent(data);
|
|
63
|
+
case 1:
|
|
64
|
+
content = _context.sent;
|
|
65
|
+
return _context.abrupt("return", generateDefinition(_objectSpread({
|
|
66
|
+
content: content,
|
|
67
|
+
fileTitle: title,
|
|
68
|
+
timestamp: timestamp,
|
|
69
|
+
timezone: timezone,
|
|
70
|
+
type: 'Activity Summary'
|
|
71
|
+
}, pdfOptions)));
|
|
72
|
+
case 2:
|
|
73
|
+
case "end":
|
|
74
|
+
return _context.stop();
|
|
83
75
|
}
|
|
84
76
|
}, _callee);
|
|
85
77
|
}));
|
|
86
78
|
return _buildActivityPdf.apply(this, arguments);
|
|
87
79
|
}
|
|
88
|
-
|
|
89
80
|
function generateContent(_x3) {
|
|
90
81
|
return _generateContent.apply(this, arguments);
|
|
91
82
|
}
|
|
92
|
-
|
|
93
83
|
function _generateContent() {
|
|
94
|
-
_generateContent = _asyncToGenerator(
|
|
84
|
+
_generateContent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(data) {
|
|
95
85
|
var activitySection, summarySection, titleTable;
|
|
96
|
-
return _regeneratorRuntime.wrap(function
|
|
97
|
-
while (1) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
case 6:
|
|
110
|
-
case "end":
|
|
111
|
-
return _context2.stop();
|
|
112
|
-
}
|
|
86
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
87
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
88
|
+
case 0:
|
|
89
|
+
_context2.next = 1;
|
|
90
|
+
return buildActivitySection(data);
|
|
91
|
+
case 1:
|
|
92
|
+
activitySection = _context2.sent;
|
|
93
|
+
summarySection = buildSummarySection(data);
|
|
94
|
+
titleTable = buildTitleTable(data);
|
|
95
|
+
return _context2.abrupt("return", [titleTable, summarySection, activitySection]);
|
|
96
|
+
case 2:
|
|
97
|
+
case "end":
|
|
98
|
+
return _context2.stop();
|
|
113
99
|
}
|
|
114
100
|
}, _callee2);
|
|
115
101
|
}));
|
|
116
102
|
return _generateContent.apply(this, arguments);
|
|
117
103
|
}
|
|
118
|
-
|
|
119
104
|
function buildActivitySection(_x4) {
|
|
120
105
|
return _buildActivitySection.apply(this, arguments);
|
|
121
106
|
}
|
|
122
|
-
|
|
123
107
|
function _buildActivitySection() {
|
|
124
|
-
_buildActivitySection = _asyncToGenerator(
|
|
108
|
+
_buildActivitySection = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(data) {
|
|
125
109
|
var _data$showAlternate, showAlternate, locationScans, otherActivity, activitySummary;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
case 9:
|
|
151
|
-
activitySummary = _context3.sent;
|
|
152
|
-
return _context3.abrupt("return", [activitySummary]);
|
|
153
|
-
|
|
154
|
-
case 11:
|
|
155
|
-
case "end":
|
|
156
|
-
return _context3.stop();
|
|
157
|
-
}
|
|
110
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
111
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
112
|
+
case 0:
|
|
113
|
+
_data$showAlternate = data.showAlternate, showAlternate = _data$showAlternate === void 0 ? false : _data$showAlternate;
|
|
114
|
+
if (!showAlternate) {
|
|
115
|
+
_context3.next = 2;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
locationScans = buildLocationScansSection(data);
|
|
119
|
+
_context3.next = 1;
|
|
120
|
+
return buildOtherActivitySection(data);
|
|
121
|
+
case 1:
|
|
122
|
+
otherActivity = _context3.sent;
|
|
123
|
+
return _context3.abrupt("return", [locationScans, otherActivity]);
|
|
124
|
+
case 2:
|
|
125
|
+
_context3.next = 3;
|
|
126
|
+
return buildActivitySummarySection(data);
|
|
127
|
+
case 3:
|
|
128
|
+
activitySummary = _context3.sent;
|
|
129
|
+
return _context3.abrupt("return", [activitySummary]);
|
|
130
|
+
case 4:
|
|
131
|
+
case "end":
|
|
132
|
+
return _context3.stop();
|
|
158
133
|
}
|
|
159
134
|
}, _callee3);
|
|
160
135
|
}));
|
|
161
136
|
return _buildActivitySection.apply(this, arguments);
|
|
162
137
|
}
|
|
163
|
-
|
|
164
138
|
function buildActivitySummarySection(_x5) {
|
|
165
139
|
return _buildActivitySummarySection.apply(this, arguments);
|
|
166
140
|
}
|
|
167
|
-
|
|
168
141
|
function _buildActivitySummarySection() {
|
|
169
|
-
_buildActivitySummarySection = _asyncToGenerator(
|
|
142
|
+
_buildActivitySummarySection = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data) {
|
|
170
143
|
var audits, events, issues, _data$maxScans, maxScans, settings, tasks, timezone, enterEvents, exceedsMaxScans, scans, auditRows, issueRows, scanRows, taskRows, formCount, exceedsMaxForms, rows, sortedRows, title, header, hLine, activityTable, activitySummarySection, maxScansText, maxFormsText;
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
return _context4.abrupt("return", activitySummarySection);
|
|
231
|
-
|
|
232
|
-
case 22:
|
|
233
|
-
case "end":
|
|
234
|
-
return _context4.stop();
|
|
235
|
-
}
|
|
144
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
145
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
146
|
+
case 0:
|
|
147
|
+
audits = data.audits, events = data.events, issues = data.issues, _data$maxScans = data.maxScans, maxScans = _data$maxScans === void 0 ? DEFAULT_MAX_SCANS : _data$maxScans, settings = data.settings, tasks = data.tasks, timezone = data.timezone;
|
|
148
|
+
enterEvents = filter(events, function (event) {
|
|
149
|
+
return event.type === 'enter';
|
|
150
|
+
});
|
|
151
|
+
exceedsMaxScans = size(enterEvents) > maxScans;
|
|
152
|
+
scans = take(enterEvents, maxScans);
|
|
153
|
+
auditRows = map(audits, getFormRowData('audits', data));
|
|
154
|
+
issueRows = map(issues, getFormRowData('issues', data));
|
|
155
|
+
scanRows = map(scans, getScanRowData(data));
|
|
156
|
+
taskRows = map(tasks, getFormRowData('tasks', data));
|
|
157
|
+
formCount = size([].concat(_toConsumableArray(auditRows), _toConsumableArray(issueRows), _toConsumableArray(taskRows)));
|
|
158
|
+
exceedsMaxForms = formCount > MAX_ATTACHMENTS;
|
|
159
|
+
rows = [].concat(_toConsumableArray(auditRows), _toConsumableArray(issueRows), _toConsumableArray(scanRows), _toConsumableArray(taskRows));
|
|
160
|
+
sortedRows = sortBy(rows, ['timestamp'], ['asc']);
|
|
161
|
+
title = text('Activity Summary', {
|
|
162
|
+
style: 'summarySectionHeader'
|
|
163
|
+
});
|
|
164
|
+
header = table({
|
|
165
|
+
body: [[title]],
|
|
166
|
+
layout: 'noBorders',
|
|
167
|
+
style: 'summaryHeaderTable'
|
|
168
|
+
});
|
|
169
|
+
hLine = horizontalLine();
|
|
170
|
+
_context4.next = 1;
|
|
171
|
+
return buildActivityTable({
|
|
172
|
+
rows: sortedRows,
|
|
173
|
+
settings: settings,
|
|
174
|
+
timezone: timezone
|
|
175
|
+
});
|
|
176
|
+
case 1:
|
|
177
|
+
activityTable = _context4.sent;
|
|
178
|
+
activitySummarySection = [header, hLine, activityTable];
|
|
179
|
+
if (exceedsMaxScans) {
|
|
180
|
+
maxScansText = {
|
|
181
|
+
text: [text("Location Scans in the Daily Activity Report are limited to a total of ".concat(maxScans, ".")), text(' To view all Location Scans visit '), text('the Events Report', {
|
|
182
|
+
link: "".concat(LIGHTHOUSE_BASE_URL, "/reports/events")
|
|
183
|
+
}), text(' in the Lighthouse Management Console.')],
|
|
184
|
+
style: 'small',
|
|
185
|
+
margin: [0, 10, 0, 10]
|
|
186
|
+
};
|
|
187
|
+
activitySummarySection.push(maxScansText);
|
|
188
|
+
}
|
|
189
|
+
if (exceedsMaxForms) {
|
|
190
|
+
maxFormsText = {
|
|
191
|
+
text: [text("Detailed Form Submissions in the Daily Activity Report are limited to a total of ".concat(MAX_ATTACHMENTS, ". ")), text('To access individual Form Submissions, open the hyperlink next to the respective submission within the Activity Summary table. Alternatively, they may be accessed in the Lighthouse Management Console.')],
|
|
192
|
+
style: 'small',
|
|
193
|
+
margin: [0, 10, 0, 10]
|
|
194
|
+
};
|
|
195
|
+
activitySummarySection.push(maxFormsText);
|
|
196
|
+
}
|
|
197
|
+
return _context4.abrupt("return", activitySummarySection);
|
|
198
|
+
case 2:
|
|
199
|
+
case "end":
|
|
200
|
+
return _context4.stop();
|
|
236
201
|
}
|
|
237
202
|
}, _callee4);
|
|
238
203
|
}));
|
|
239
204
|
return _buildActivitySummarySection.apply(this, arguments);
|
|
240
205
|
}
|
|
241
|
-
|
|
242
206
|
function buildActivityTable(_x6) {
|
|
243
207
|
return _buildActivityTable.apply(this, arguments);
|
|
244
208
|
}
|
|
245
|
-
|
|
246
209
|
function _buildActivityTable() {
|
|
247
|
-
_buildActivityTable = _asyncToGenerator(
|
|
210
|
+
_buildActivityTable = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref) {
|
|
248
211
|
var rows, settings, timezone, timezoneAbbr, activityTableHeader, activityTableRows, activityTableBody, activityTable;
|
|
249
|
-
return _regeneratorRuntime.wrap(function
|
|
250
|
-
while (1) {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
if (!hasSummaryFields) {
|
|
306
|
-
_context5.next = 10;
|
|
307
|
-
break;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
_context5.next = 8;
|
|
311
|
-
return summaryFieldsTable({
|
|
312
|
-
fields: summaryFields,
|
|
313
|
-
settings: settings,
|
|
314
|
-
timezone: timezone
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
case 8:
|
|
318
|
-
fieldsTable = _context5.sent;
|
|
319
|
-
rows.push([fieldsTable]);
|
|
320
|
-
|
|
321
|
-
case 10:
|
|
322
|
-
// NOTE: we return a table per row which includes the entry details and the
|
|
323
|
-
// summary fields if relevant
|
|
324
|
-
activityTableRow = [table({
|
|
325
|
-
body: [].concat(rows),
|
|
326
|
-
colSpan: 5,
|
|
327
|
-
dontBreakRows: true,
|
|
328
|
-
headerRow: 0,
|
|
329
|
-
layout: {
|
|
330
|
-
hLineWidth: function hLineWidth() {
|
|
331
|
-
return 0;
|
|
332
|
-
},
|
|
333
|
-
paddingLeft: function paddingLeft() {
|
|
334
|
-
return 0;
|
|
335
|
-
},
|
|
336
|
-
paddingRight: function paddingRight() {
|
|
337
|
-
return 0;
|
|
338
|
-
},
|
|
339
|
-
paddingTop: function paddingTop() {
|
|
340
|
-
return 5;
|
|
341
|
-
},
|
|
342
|
-
paddingBottom: function paddingBottom() {
|
|
343
|
-
return 5;
|
|
344
|
-
},
|
|
345
|
-
vLineWidth: function vLineWidth() {
|
|
346
|
-
return 0;
|
|
347
|
-
}
|
|
348
|
-
},
|
|
349
|
-
// NOTE: the timestamp must fill up the rest of the table space as
|
|
350
|
-
// otherwise the padding would be off between this table and the parent
|
|
351
|
-
// table that wraps it
|
|
352
|
-
widths: [130, 25, 110, 110, '*']
|
|
353
|
-
})];
|
|
354
|
-
return _context5.abrupt("return", activityTableRow);
|
|
355
|
-
|
|
356
|
-
case 12:
|
|
357
|
-
case "end":
|
|
358
|
-
return _context5.stop();
|
|
212
|
+
return _regeneratorRuntime.wrap(function (_context6) {
|
|
213
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
214
|
+
case 0:
|
|
215
|
+
rows = _ref.rows, settings = _ref.settings, timezone = _ref.timezone;
|
|
216
|
+
timezoneAbbr = getTimezoneAbbr(timezone);
|
|
217
|
+
activityTableHeader = [text('Activity', {
|
|
218
|
+
bold: true
|
|
219
|
+
}), {
|
|
220
|
+
text: ''
|
|
221
|
+
},
|
|
222
|
+
// icon column
|
|
223
|
+
text('Location', {
|
|
224
|
+
bold: true
|
|
225
|
+
}), text('User', {
|
|
226
|
+
bold: true
|
|
227
|
+
}), text("Timestamp (".concat(timezoneAbbr, ")"), {
|
|
228
|
+
alignment: 'right',
|
|
229
|
+
bold: true
|
|
230
|
+
})];
|
|
231
|
+
_context6.next = 1;
|
|
232
|
+
return Promise.map(rows, /*#__PURE__*/function () {
|
|
233
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data) {
|
|
234
|
+
var link, location, icon, name, summaryFields, timestamp, title, timezoneHour, iconCell, rows, hasSummaryFields, fieldsTable, activityTableRow;
|
|
235
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
236
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
237
|
+
case 0:
|
|
238
|
+
link = data.link, location = data.location, icon = data.icon, name = data.name, summaryFields = data.summaryFields, timestamp = data.timestamp, title = data.title;
|
|
239
|
+
timezoneHour = getTimezoneDatetime({
|
|
240
|
+
format: 'ddd DD h:mm a',
|
|
241
|
+
showTzAbbr: false,
|
|
242
|
+
timestamp: timestamp,
|
|
243
|
+
timezone: timezone
|
|
244
|
+
});
|
|
245
|
+
iconCell = icon ? {
|
|
246
|
+
alignment: 'center',
|
|
247
|
+
fit: [8, 8],
|
|
248
|
+
image: icon,
|
|
249
|
+
link: link
|
|
250
|
+
} : {
|
|
251
|
+
text: ''
|
|
252
|
+
}; // NOTE: pass link to each column as
|
|
253
|
+
// we can't wrap the entire table row
|
|
254
|
+
rows = [[text(title, {
|
|
255
|
+
link: link
|
|
256
|
+
}), iconCell, text(location, {
|
|
257
|
+
link: link
|
|
258
|
+
}), text(name, {
|
|
259
|
+
link: link
|
|
260
|
+
}), text(timezoneHour, {
|
|
261
|
+
alignment: 'right',
|
|
262
|
+
link: link
|
|
263
|
+
})]];
|
|
264
|
+
hasSummaryFields = !isEmpty(summaryFields);
|
|
265
|
+
if (!hasSummaryFields) {
|
|
266
|
+
_context5.next = 2;
|
|
267
|
+
break;
|
|
359
268
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
269
|
+
_context5.next = 1;
|
|
270
|
+
return summaryFieldsTable({
|
|
271
|
+
fields: summaryFields,
|
|
272
|
+
settings: settings,
|
|
273
|
+
timezone: timezone
|
|
274
|
+
});
|
|
275
|
+
case 1:
|
|
276
|
+
fieldsTable = _context5.sent;
|
|
277
|
+
rows.push([fieldsTable]);
|
|
278
|
+
case 2:
|
|
279
|
+
// NOTE: we return a table per row which includes the entry details and the
|
|
280
|
+
// summary fields if relevant
|
|
281
|
+
activityTableRow = [table({
|
|
282
|
+
body: [].concat(rows),
|
|
283
|
+
colSpan: 5,
|
|
284
|
+
dontBreakRows: true,
|
|
285
|
+
headerRow: 0,
|
|
286
|
+
layout: {
|
|
287
|
+
hLineWidth: function hLineWidth() {
|
|
288
|
+
return 0;
|
|
289
|
+
},
|
|
290
|
+
paddingLeft: function paddingLeft() {
|
|
291
|
+
return 0;
|
|
292
|
+
},
|
|
293
|
+
paddingRight: function paddingRight() {
|
|
294
|
+
return 0;
|
|
295
|
+
},
|
|
296
|
+
paddingTop: function paddingTop() {
|
|
297
|
+
return 5;
|
|
298
|
+
},
|
|
299
|
+
paddingBottom: function paddingBottom() {
|
|
300
|
+
return 5;
|
|
301
|
+
},
|
|
302
|
+
vLineWidth: function vLineWidth() {
|
|
303
|
+
return 0;
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
// NOTE: the timestamp must fill up the rest of the table space as
|
|
307
|
+
// otherwise the padding would be off between this table and the parent
|
|
308
|
+
// table that wraps it
|
|
309
|
+
widths: [130, 25, 110, 110, '*']
|
|
310
|
+
})];
|
|
311
|
+
return _context5.abrupt("return", activityTableRow);
|
|
312
|
+
case 3:
|
|
313
|
+
case "end":
|
|
314
|
+
return _context5.stop();
|
|
396
315
|
}
|
|
316
|
+
}, _callee5);
|
|
317
|
+
}));
|
|
318
|
+
return function (_x8) {
|
|
319
|
+
return _ref4.apply(this, arguments);
|
|
320
|
+
};
|
|
321
|
+
}());
|
|
322
|
+
case 1:
|
|
323
|
+
activityTableRows = _context6.sent;
|
|
324
|
+
activityTableBody = isEmpty(activityTableRows) ? [[text('No other activity', {
|
|
325
|
+
colSpan: 5
|
|
326
|
+
})]] : activityTableRows;
|
|
327
|
+
activityTable = table({
|
|
328
|
+
body: [activityTableHeader].concat(_toConsumableArray(activityTableBody)),
|
|
329
|
+
dontBreakRows: true,
|
|
330
|
+
layout: {
|
|
331
|
+
hLineWidth: function hLineWidth() {
|
|
332
|
+
return 0;
|
|
397
333
|
},
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
334
|
+
fillColor: zebraFillColor,
|
|
335
|
+
paddingLeft: function paddingLeft() {
|
|
336
|
+
return 5;
|
|
337
|
+
},
|
|
338
|
+
paddingRight: function paddingRight() {
|
|
339
|
+
return 5;
|
|
340
|
+
},
|
|
341
|
+
paddingTop: function paddingTop() {
|
|
342
|
+
return 5;
|
|
343
|
+
},
|
|
344
|
+
paddingBottom: function paddingBottom() {
|
|
345
|
+
return 5;
|
|
346
|
+
},
|
|
347
|
+
vLineWidth: function vLineWidth() {
|
|
348
|
+
return 0;
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
widths: [120, 15, 100, 100, '*']
|
|
352
|
+
});
|
|
353
|
+
return _context6.abrupt("return", activityTable);
|
|
354
|
+
case 2:
|
|
355
|
+
case "end":
|
|
356
|
+
return _context6.stop();
|
|
406
357
|
}
|
|
407
358
|
}, _callee6);
|
|
408
359
|
}));
|
|
409
360
|
return _buildActivityTable.apply(this, arguments);
|
|
410
361
|
}
|
|
411
|
-
|
|
412
362
|
function buildLocationScansSection(data) {
|
|
413
363
|
var events = data.events,
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
364
|
+
start = data.start,
|
|
365
|
+
timezone = data.timezone,
|
|
366
|
+
zones = data.zones;
|
|
417
367
|
var title = text('Location Scans', {
|
|
418
368
|
style: 'summarySectionHeader'
|
|
419
369
|
});
|
|
@@ -421,12 +371,15 @@ function buildLocationScansSection(data) {
|
|
|
421
371
|
body: [[title]],
|
|
422
372
|
layout: 'noBorders',
|
|
423
373
|
style: 'summaryHeaderTable'
|
|
424
|
-
});
|
|
374
|
+
});
|
|
425
375
|
|
|
426
|
-
|
|
376
|
+
// use start time and timezone to figure out the interval boundaries
|
|
377
|
+
var hourIntervalBoundaries = buildLocationScansBoundaries(start, timezone);
|
|
427
378
|
|
|
379
|
+
// pair interval boundaries into column headers for the table
|
|
428
380
|
var hourIntervalColumnHeaders = hourIntervalBoundaries.reduce(function (columns, interval, index, intervals) {
|
|
429
|
-
if (index < size(intervals) - 1)
|
|
381
|
+
if (index < size(intervals) - 1)
|
|
382
|
+
// skip the final iteration as it's just the end of the last interval
|
|
430
383
|
columns.push(text("".concat(interval.format('h'), "-").concat(intervals[index + 1].format('hA')), {
|
|
431
384
|
alignment: 'center',
|
|
432
385
|
bold: true
|
|
@@ -439,8 +392,9 @@ function buildLocationScansSection(data) {
|
|
|
439
392
|
alignment: 'right',
|
|
440
393
|
bold: true
|
|
441
394
|
})]);
|
|
442
|
-
var hLine = horizontalLine();
|
|
395
|
+
var hLine = horizontalLine();
|
|
443
396
|
|
|
397
|
+
// NOTE: only show the enter events within the summary table
|
|
444
398
|
var enterEvents = filter(events, function (event) {
|
|
445
399
|
return event.type === 'enter';
|
|
446
400
|
});
|
|
@@ -454,10 +408,11 @@ function buildLocationScansSection(data) {
|
|
|
454
408
|
}, {});
|
|
455
409
|
var scansTableRows = map(groupedEventsByZone, function (events) {
|
|
456
410
|
var zone = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
457
|
-
var sortedGroup = sortBy(events, ['timestamp'], ['asc']);
|
|
458
|
-
|
|
459
|
-
var locationScansByInterval = buildLocationScansContent(hourIntervalBoundaries, events); // map the interval buckets to a format fit for the table
|
|
411
|
+
var sortedGroup = sortBy(events, ['timestamp'], ['asc']);
|
|
460
412
|
|
|
413
|
+
// put events into interval buckets
|
|
414
|
+
var locationScansByInterval = buildLocationScansContent(hourIntervalBoundaries, events);
|
|
415
|
+
// map the interval buckets to a format fit for the table
|
|
461
416
|
var locationScansByIntervalContent = locationScansByInterval.map(function (interval) {
|
|
462
417
|
return {
|
|
463
418
|
alignment: 'center',
|
|
@@ -484,28 +439,29 @@ function buildLocationScansSection(data) {
|
|
|
484
439
|
});
|
|
485
440
|
return [header, hLine, scansTable];
|
|
486
441
|
}
|
|
487
|
-
|
|
488
442
|
function buildSummarySection(data) {
|
|
489
443
|
var audits = data.audits,
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
444
|
+
events = data.events,
|
|
445
|
+
issues = data.issues,
|
|
446
|
+
tasks = data.tasks;
|
|
493
447
|
|
|
448
|
+
//const userEvents = groupBy(events, 'user')
|
|
494
449
|
var eventsByType = groupBy(events, 'type');
|
|
495
|
-
var enterEventsCount = size(eventsByType.enter);
|
|
496
|
-
|
|
450
|
+
var enterEventsCount = size(eventsByType.enter);
|
|
451
|
+
//const geoEventsCount = size(eventsByType.geo)
|
|
497
452
|
var issuesCount = size(issues);
|
|
498
453
|
var tasksCount = size(tasks);
|
|
499
|
-
var auditsCount = size(audits);
|
|
454
|
+
var auditsCount = size(audits);
|
|
455
|
+
//const uniqueUsers = size(userEvents)
|
|
500
456
|
|
|
501
457
|
var auditsText = text('AUDITS', {
|
|
502
458
|
style: 'summaryText'
|
|
503
|
-
});
|
|
504
|
-
|
|
459
|
+
});
|
|
460
|
+
//const geoText = text('GPS', { style: 'summaryText' })
|
|
505
461
|
var issuesText = text('ISSUES', {
|
|
506
462
|
style: 'summaryText'
|
|
507
|
-
});
|
|
508
|
-
|
|
463
|
+
});
|
|
464
|
+
//const peopleText = text('PEOPLE', { style: 'summaryText' })
|
|
509
465
|
var scansText = text('SCANS', {
|
|
510
466
|
style: 'summaryText'
|
|
511
467
|
});
|
|
@@ -514,12 +470,12 @@ function buildSummarySection(data) {
|
|
|
514
470
|
});
|
|
515
471
|
var auditsCountText = text(toString(auditsCount), {
|
|
516
472
|
style: 'summaryCount'
|
|
517
|
-
});
|
|
518
|
-
|
|
473
|
+
});
|
|
474
|
+
//const peopleCountText = text(toString(uniqueUsers), { style: 'summaryCount' })
|
|
519
475
|
var scansCountText = text(toString(enterEventsCount), {
|
|
520
476
|
style: 'summaryCount'
|
|
521
|
-
});
|
|
522
|
-
|
|
477
|
+
});
|
|
478
|
+
//const geoCountText = text(toString(geoEventsCount), { style: 'summaryCount' })
|
|
523
479
|
var issuesCountText = text(toString(issuesCount), {
|
|
524
480
|
style: 'summaryCount'
|
|
525
481
|
});
|
|
@@ -528,11 +484,11 @@ function buildSummarySection(data) {
|
|
|
528
484
|
});
|
|
529
485
|
var auditTable = summaryStatTable({
|
|
530
486
|
body: [[auditsText], [auditsCountText]]
|
|
531
|
-
});
|
|
487
|
+
});
|
|
488
|
+
//const peopleTable = summaryStatTable({
|
|
532
489
|
// body: [[peopleText], [peopleCountText]],
|
|
533
490
|
//})
|
|
534
491
|
//const gpsTable = summaryStatTable({ body: [[geoText], [geoCountText]] })
|
|
535
|
-
|
|
536
492
|
var scanTable = summaryStatTable({
|
|
537
493
|
body: [[scansText], [scansCountText]]
|
|
538
494
|
});
|
|
@@ -543,82 +499,71 @@ function buildSummarySection(data) {
|
|
|
543
499
|
body: [[tasksText], [tasksCountText]]
|
|
544
500
|
});
|
|
545
501
|
var wrapperTable = summaryWrapperTable({
|
|
546
|
-
body: [[
|
|
547
|
-
/*peopleTable,*/
|
|
548
|
-
|
|
502
|
+
body: [[/*peopleTable,*/
|
|
549
503
|
/*gpsTable,*/
|
|
550
504
|
scanTable, issueTable, taskTables, auditTable]]
|
|
551
505
|
});
|
|
552
506
|
return wrapperTable;
|
|
553
507
|
}
|
|
554
|
-
|
|
555
508
|
function buildOtherActivitySection(_x7) {
|
|
556
509
|
return _buildOtherActivitySection.apply(this, arguments);
|
|
557
510
|
}
|
|
558
|
-
|
|
559
511
|
function _buildOtherActivitySection() {
|
|
560
|
-
_buildOtherActivitySection = _asyncToGenerator(
|
|
512
|
+
_buildOtherActivitySection = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(data) {
|
|
561
513
|
var audits, issues, tasks, settings, timezone, auditRows, issueRows, taskRows, rows, sortedRows, title, header, hLine, activityTable, otherActivitySummarySection, formCount, exceedsMaxForms, maxFormsText;
|
|
562
|
-
return _regeneratorRuntime.wrap(function
|
|
563
|
-
while (1) {
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
return _context7.abrupt("return", otherActivitySummarySection);
|
|
604
|
-
|
|
605
|
-
case 17:
|
|
606
|
-
case "end":
|
|
607
|
-
return _context7.stop();
|
|
608
|
-
}
|
|
514
|
+
return _regeneratorRuntime.wrap(function (_context7) {
|
|
515
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
516
|
+
case 0:
|
|
517
|
+
audits = data.audits, issues = data.issues, tasks = data.tasks, settings = data.settings, timezone = data.timezone;
|
|
518
|
+
auditRows = map(audits, getFormRowData('audits', data));
|
|
519
|
+
issueRows = map(issues, getFormRowData('issues', data));
|
|
520
|
+
taskRows = map(tasks, getFormRowData('tasks', data));
|
|
521
|
+
rows = [].concat(_toConsumableArray(auditRows), _toConsumableArray(issueRows), _toConsumableArray(taskRows));
|
|
522
|
+
sortedRows = sortBy(rows, ['timestamp'], ['asc']);
|
|
523
|
+
title = text('Other Activity', {
|
|
524
|
+
style: 'summarySectionHeader'
|
|
525
|
+
});
|
|
526
|
+
header = table({
|
|
527
|
+
body: [[title]],
|
|
528
|
+
layout: 'noBorders',
|
|
529
|
+
style: 'summaryHeaderTable'
|
|
530
|
+
});
|
|
531
|
+
hLine = horizontalLine();
|
|
532
|
+
_context7.next = 1;
|
|
533
|
+
return buildActivityTable({
|
|
534
|
+
rows: sortedRows,
|
|
535
|
+
settings: settings,
|
|
536
|
+
timezone: timezone
|
|
537
|
+
});
|
|
538
|
+
case 1:
|
|
539
|
+
activityTable = _context7.sent;
|
|
540
|
+
otherActivitySummarySection = [header, hLine, activityTable];
|
|
541
|
+
formCount = size(rows);
|
|
542
|
+
exceedsMaxForms = formCount > MAX_ATTACHMENTS;
|
|
543
|
+
if (exceedsMaxForms) {
|
|
544
|
+
maxFormsText = {
|
|
545
|
+
text: [text("Detailed Form Submissions in the Daily Activity Report are limited to a total of ".concat(MAX_ATTACHMENTS, ". ")), text('To access individual Form Submissions, open the hyperlink next to the respective submission within the Other Activity table. Alternatively, they may be accessed in the Lighthouse Management Console.')],
|
|
546
|
+
style: 'small',
|
|
547
|
+
margin: [0, 10, 0, 10]
|
|
548
|
+
};
|
|
549
|
+
otherActivitySummarySection.push(maxFormsText);
|
|
550
|
+
}
|
|
551
|
+
return _context7.abrupt("return", otherActivitySummarySection);
|
|
552
|
+
case 2:
|
|
553
|
+
case "end":
|
|
554
|
+
return _context7.stop();
|
|
609
555
|
}
|
|
610
556
|
}, _callee7);
|
|
611
557
|
}));
|
|
612
558
|
return _buildOtherActivitySection.apply(this, arguments);
|
|
613
559
|
}
|
|
614
|
-
|
|
615
560
|
function buildTitleTable(data) {
|
|
616
561
|
var location = data.location,
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
562
|
+
start = data.start,
|
|
563
|
+
end = data.end,
|
|
564
|
+
timezone = data.timezone;
|
|
620
565
|
var _location$address = location.address,
|
|
621
|
-
|
|
566
|
+
address = _location$address === void 0 ? {} : _location$address;
|
|
622
567
|
var headerTitle = text('Daily Activity Report', {
|
|
623
568
|
style: 'title'
|
|
624
569
|
});
|
|
@@ -644,20 +589,19 @@ function buildTitleTable(data) {
|
|
|
644
589
|
style: 'titleTable'
|
|
645
590
|
});
|
|
646
591
|
}
|
|
647
|
-
|
|
648
592
|
function getFormRowData(collection, _ref2) {
|
|
649
593
|
var locations = _ref2.locations,
|
|
650
|
-
|
|
651
|
-
|
|
594
|
+
users = _ref2.users,
|
|
595
|
+
zones = _ref2.zones;
|
|
652
596
|
return function (document) {
|
|
653
597
|
var _id = document._id,
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
598
|
+
createdAt = document.createdAt,
|
|
599
|
+
_document$entry = document.entry,
|
|
600
|
+
entry = _document$entry === void 0 ? {} : _document$entry,
|
|
601
|
+
_document$title = document.title,
|
|
602
|
+
title = _document$title === void 0 ? 'Unknown' : _document$title,
|
|
603
|
+
_document$user = document.user,
|
|
604
|
+
user = _document$user === void 0 ? '' : _document$user;
|
|
661
605
|
var location = getLocationReference({
|
|
662
606
|
entity: document,
|
|
663
607
|
locations: locations,
|
|
@@ -668,9 +612,10 @@ function getFormRowData(collection, _ref2) {
|
|
|
668
612
|
var userDoc = find(users, function (doc) {
|
|
669
613
|
return doc._id.toString() === user.toString();
|
|
670
614
|
});
|
|
671
|
-
var name = userDoc && "".concat(userDoc.firstName, " ").concat(userDoc.lastName) || 'Unknown User';
|
|
672
|
-
// aren't supported and will return an empty array here
|
|
615
|
+
var name = userDoc && "".concat(userDoc.firstName, " ").concat(userDoc.lastName) || 'Unknown User';
|
|
673
616
|
|
|
617
|
+
// NOTE: currently only issues and tasks will return summary fields, audits
|
|
618
|
+
// aren't supported and will return an empty array here
|
|
674
619
|
var summaryFields = entry.summaryFields || [];
|
|
675
620
|
return {
|
|
676
621
|
icon: launchIcon,
|
|
@@ -683,16 +628,15 @@ function getFormRowData(collection, _ref2) {
|
|
|
683
628
|
};
|
|
684
629
|
};
|
|
685
630
|
}
|
|
686
|
-
|
|
687
631
|
function getScanRowData(_ref3) {
|
|
688
632
|
var users = _ref3.users,
|
|
689
|
-
|
|
633
|
+
zones = _ref3.zones;
|
|
690
634
|
return function (document) {
|
|
691
635
|
var timestamp = document.timestamp,
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
636
|
+
_document$user2 = document.user,
|
|
637
|
+
user = _document$user2 === void 0 ? '' : _document$user2,
|
|
638
|
+
_document$zone = document.zone,
|
|
639
|
+
zone = _document$zone === void 0 ? '' : _document$zone;
|
|
696
640
|
var userDoc = user && find(users, function (doc) {
|
|
697
641
|
return doc._id.toString() === user.toString();
|
|
698
642
|
});
|