@lighthouse/common 5.0.0-canary-11 → 5.0.0-canary-13
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/helpers/build-fetch-url/index.js +2 -2
- package/dist/helpers/fetch-image/index.js +1 -1
- package/dist/helpers/fetch-image-for-pdf-generator-service/index.js +9 -9
- package/dist/helpers/fetch-image-for-web/index.js +3 -14
- package/dist/helpers/get-audit-entry-details/index.js +2 -0
- package/dist/helpers/get-issue-details/index.js +2 -0
- package/dist/helpers/get-task-entry-details/index.js +3 -1
- package/dist/pdf/helpers/fields/index.js +2 -2
- package/dist/scheduling/scheduling.types.js +9 -9
- package/dist/service-hours/schema.js +12 -12
- package/lib/errors/DomainError.js +7 -8
- package/lib/errors/DomainError.js.map +1 -1
- package/lib/errors/ValidationError.js +11 -9
- package/lib/errors/ValidationError.js.map +1 -1
- package/lib/helpers/build-fetch-url/index.js +2 -2
- package/lib/helpers/build-fetch-url/index.js.map +1 -1
- package/lib/helpers/fetch-image/index.js +1 -1
- package/lib/helpers/fetch-image/index.js.map +1 -1
- package/lib/helpers/fetch-image-for-pdf-generator-service/index.js +174 -180
- package/lib/helpers/fetch-image-for-pdf-generator-service/index.js.map +1 -1
- package/lib/helpers/fetch-image-for-web/index.js +60 -74
- package/lib/helpers/fetch-image-for-web/index.js.map +1 -1
- package/lib/helpers/fetch-lighthouse-logo/index.js +41 -43
- package/lib/helpers/fetch-lighthouse-logo/index.js.map +1 -1
- package/lib/helpers/get-audit-entry-details/index.js +2 -0
- package/lib/helpers/get-audit-entry-details/index.js.map +1 -1
- package/lib/helpers/get-audit-items-data/index.js +8 -8
- package/lib/helpers/get-audit-items-data/index.js.map +1 -1
- package/lib/helpers/get-issue-details/index.js +2 -0
- package/lib/helpers/get-issue-details/index.js.map +1 -1
- package/lib/helpers/get-job-details/index.js.map +1 -1
- package/lib/helpers/get-location-reference/index.js +6 -4
- package/lib/helpers/get-location-reference/index.js.map +1 -1
- package/lib/helpers/get-reference-details/index.js.map +1 -1
- package/lib/helpers/get-task-entry-details/index.js +3 -1
- package/lib/helpers/get-task-entry-details/index.js.map +1 -1
- package/lib/helpers/get-timezone-datetime/index.js.map +1 -1
- package/lib/pdf/activity-report/index.js +299 -311
- package/lib/pdf/activity-report/index.js.map +1 -1
- package/lib/pdf/audit/index.js.map +1 -1
- package/lib/pdf/helpers/build-audit-content/index.js.map +1 -1
- package/lib/pdf/helpers/build-audit-follow-ups/index.js.map +1 -1
- package/lib/pdf/helpers/build-location-scans-content/index.js.map +1 -1
- package/lib/pdf/helpers/build-template-content/index.js.map +1 -1
- package/lib/pdf/helpers/fields/index.js +14 -14
- package/lib/pdf/helpers/fields/index.js.map +1 -1
- package/lib/pdf/helpers/generate-definition/index.js.map +1 -1
- package/lib/pdf/helpers/horizontal-line/index.js.map +1 -1
- package/lib/pdf/helpers/html-transformer/index.js +1 -2
- package/lib/pdf/helpers/html-transformer/index.js.map +1 -1
- package/lib/pdf/helpers/table/index.js +63 -65
- package/lib/pdf/helpers/table/index.js.map +1 -1
- package/lib/pdf/issue/index.js.map +1 -1
- package/lib/pdf/job/index.js.map +1 -1
- package/lib/pdf/shift-report/index.js +275 -291
- package/lib/pdf/shift-report/index.js.map +1 -1
- package/lib/pdf/task/index.js.map +1 -1
- package/lib/scheduling/generators/occurrenceIntervalsGenerator.js +27 -30
- package/lib/scheduling/generators/occurrenceIntervalsGenerator.js.map +1 -1
- package/lib/scheduling/generators/scheduleIntervalsGenerator.js +19 -21
- package/lib/scheduling/generators/scheduleIntervalsGenerator.js.map +1 -1
- package/lib/scheduling/generators/serviceIntervalsGenerator.js +134 -136
- package/lib/scheduling/generators/serviceIntervalsGenerator.js.map +1 -1
- package/lib/scheduling/helpers/generateNonRepeatingSchedule.js +81 -83
- package/lib/scheduling/helpers/generateNonRepeatingSchedule.js.map +1 -1
- package/lib/scheduling/helpers/generateRepeatingSchedule.js +104 -106
- package/lib/scheduling/helpers/generateRepeatingSchedule.js.map +1 -1
- package/lib/scheduling/helpers/generateScheduleEnd.js.map +1 -1
- package/lib/scheduling/helpers/mergeIntervals.js.map +1 -1
- package/lib/scheduling/scheduling.types.js +9 -9
- package/lib/scheduling/scheduling.types.js.map +1 -1
- package/lib/scheduling/strategies/getNext.js +21 -17
- package/lib/scheduling/strategies/getNext.js.map +1 -1
- package/lib/scheduling/strategies/getNextExactDateOfMonth.js +21 -18
- package/lib/scheduling/strategies/getNextExactDateOfMonth.js.map +1 -1
- package/lib/scheduling/strategies/getNextLastDayOfMonth.js +20 -17
- package/lib/scheduling/strategies/getNextLastDayOfMonth.js.map +1 -1
- package/lib/scheduling/strategies/getNextLastWeekdayOfMonth.js +20 -17
- package/lib/scheduling/strategies/getNextLastWeekdayOfMonth.js.map +1 -1
- package/lib/scheduling/strategies/getNextNoRepeat.js +15 -14
- package/lib/scheduling/strategies/getNextNoRepeat.js.map +1 -1
- package/lib/scheduling/strategies/getNextWeekday.js +36 -33
- package/lib/scheduling/strategies/getNextWeekday.js.map +1 -1
- package/lib/scheduling/strategies/getNextXDayOfXWeekOfMonth.js +20 -17
- package/lib/scheduling/strategies/getNextXDayOfXWeekOfMonth.js.map +1 -1
- package/lib/schema/schema.js +21 -23
- package/lib/schema/schema.js.map +1 -1
- package/lib/service-hours/schema.js +15 -13
- package/lib/service-hours/schema.js.map +1 -1
- package/package.json +2 -2
- package/yarn-error.log +0 -13549
|
@@ -1,7 +1,7 @@
|
|
|
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";
|
|
4
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
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
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; }
|
|
7
7
|
import { filter, find, groupBy, isEmpty, map, size, sortBy, take, toString, reduce } from 'lodash';
|
|
@@ -53,27 +53,25 @@ export function buildActivityPdf(_x, _x2) {
|
|
|
53
53
|
function _buildActivityPdf() {
|
|
54
54
|
_buildActivityPdf = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(pdfOptions, data) {
|
|
55
55
|
var timestamp, timezone, title, content;
|
|
56
|
-
return _regeneratorRuntime.wrap(function
|
|
57
|
-
while (1) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return _context.stop();
|
|
76
|
-
}
|
|
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();
|
|
77
75
|
}
|
|
78
76
|
}, _callee);
|
|
79
77
|
}));
|
|
@@ -85,21 +83,19 @@ function generateContent(_x3) {
|
|
|
85
83
|
function _generateContent() {
|
|
86
84
|
_generateContent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(data) {
|
|
87
85
|
var activitySection, summarySection, titleTable;
|
|
88
|
-
return _regeneratorRuntime.wrap(function
|
|
89
|
-
while (1) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return _context2.stop();
|
|
102
|
-
}
|
|
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();
|
|
103
99
|
}
|
|
104
100
|
}, _callee2);
|
|
105
101
|
}));
|
|
@@ -111,31 +107,29 @@ function buildActivitySection(_x4) {
|
|
|
111
107
|
function _buildActivitySection() {
|
|
112
108
|
_buildActivitySection = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(data) {
|
|
113
109
|
var _data$showAlternate, showAlternate, locationScans, otherActivity, activitySummary;
|
|
114
|
-
return _regeneratorRuntime.wrap(function
|
|
115
|
-
while (1) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return _context3.stop();
|
|
138
|
-
}
|
|
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();
|
|
139
133
|
}
|
|
140
134
|
}, _callee3);
|
|
141
135
|
}));
|
|
@@ -147,65 +141,63 @@ function buildActivitySummarySection(_x5) {
|
|
|
147
141
|
function _buildActivitySummarySection() {
|
|
148
142
|
_buildActivitySummarySection = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data) {
|
|
149
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;
|
|
150
|
-
return _regeneratorRuntime.wrap(function
|
|
151
|
-
while (1) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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
|
-
return _context4.stop();
|
|
208
|
-
}
|
|
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();
|
|
209
201
|
}
|
|
210
202
|
}, _callee4);
|
|
211
203
|
}));
|
|
@@ -217,155 +209,151 @@ function buildActivityTable(_x6) {
|
|
|
217
209
|
function _buildActivityTable() {
|
|
218
210
|
_buildActivityTable = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref) {
|
|
219
211
|
var rows, settings, timezone, timezoneAbbr, activityTableHeader, activityTableRows, activityTableBody, activityTable;
|
|
220
|
-
return _regeneratorRuntime.wrap(function
|
|
221
|
-
while (1) {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
var
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
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
|
-
_context5.next = 10;
|
|
277
|
-
break;
|
|
278
|
-
}
|
|
279
|
-
_context5.next = 8;
|
|
280
|
-
return summaryFieldsTable({
|
|
281
|
-
fields: summaryFields,
|
|
282
|
-
settings: settings,
|
|
283
|
-
timezone: timezone
|
|
284
|
-
});
|
|
285
|
-
case 8:
|
|
286
|
-
fieldsTable = _context5.sent;
|
|
287
|
-
rows.push([fieldsTable]);
|
|
288
|
-
case 10:
|
|
289
|
-
// NOTE: we return a table per row which includes the entry details and the
|
|
290
|
-
// summary fields if relevant
|
|
291
|
-
activityTableRow = [table({
|
|
292
|
-
body: [].concat(rows),
|
|
293
|
-
colSpan: 5,
|
|
294
|
-
dontBreakRows: true,
|
|
295
|
-
headerRow: 0,
|
|
296
|
-
layout: {
|
|
297
|
-
hLineWidth: function hLineWidth() {
|
|
298
|
-
return 0;
|
|
299
|
-
},
|
|
300
|
-
paddingLeft: function paddingLeft() {
|
|
301
|
-
return 0;
|
|
302
|
-
},
|
|
303
|
-
paddingRight: function paddingRight() {
|
|
304
|
-
return 0;
|
|
305
|
-
},
|
|
306
|
-
paddingTop: function paddingTop() {
|
|
307
|
-
return 5;
|
|
308
|
-
},
|
|
309
|
-
paddingBottom: function paddingBottom() {
|
|
310
|
-
return 5;
|
|
311
|
-
},
|
|
312
|
-
vLineWidth: function vLineWidth() {
|
|
313
|
-
return 0;
|
|
314
|
-
}
|
|
315
|
-
},
|
|
316
|
-
// NOTE: the timestamp must fill up the rest of the table space as
|
|
317
|
-
// otherwise the padding would be off between this table and the parent
|
|
318
|
-
// table that wraps it
|
|
319
|
-
widths: [130, 25, 110, 110, '*']
|
|
320
|
-
})];
|
|
321
|
-
return _context5.abrupt("return", activityTableRow);
|
|
322
|
-
case 12:
|
|
323
|
-
case "end":
|
|
324
|
-
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;
|
|
325
268
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
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();
|
|
360
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;
|
|
333
|
+
},
|
|
334
|
+
fillColor: zebraFillColor,
|
|
335
|
+
paddingLeft: function paddingLeft() {
|
|
336
|
+
return 5;
|
|
361
337
|
},
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
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();
|
|
369
357
|
}
|
|
370
358
|
}, _callee6);
|
|
371
359
|
}));
|
|
@@ -455,7 +443,9 @@ function buildSummarySection(data) {
|
|
|
455
443
|
var audits = data.audits,
|
|
456
444
|
events = data.events,
|
|
457
445
|
issues = data.issues,
|
|
458
|
-
tasks = data.tasks;
|
|
446
|
+
tasks = data.tasks;
|
|
447
|
+
|
|
448
|
+
//const userEvents = groupBy(events, 'user')
|
|
459
449
|
var eventsByType = groupBy(events, 'type');
|
|
460
450
|
var enterEventsCount = size(eventsByType.enter);
|
|
461
451
|
//const geoEventsCount = size(eventsByType.geo)
|
|
@@ -521,49 +511,47 @@ function buildOtherActivitySection(_x7) {
|
|
|
521
511
|
function _buildOtherActivitySection() {
|
|
522
512
|
_buildOtherActivitySection = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(data) {
|
|
523
513
|
var audits, issues, tasks, settings, timezone, auditRows, issueRows, taskRows, rows, sortedRows, title, header, hLine, activityTable, otherActivitySummarySection, formCount, exceedsMaxForms, maxFormsText;
|
|
524
|
-
return _regeneratorRuntime.wrap(function
|
|
525
|
-
while (1) {
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
return _context7.stop();
|
|
566
|
-
}
|
|
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();
|
|
567
555
|
}
|
|
568
556
|
}, _callee7);
|
|
569
557
|
}));
|