@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.
Files changed (91) hide show
  1. package/dist/helpers/build-fetch-url/index.js +2 -2
  2. package/dist/helpers/fetch-image/index.js +1 -1
  3. package/dist/helpers/fetch-image-for-pdf-generator-service/index.js +9 -9
  4. package/dist/helpers/fetch-image-for-web/index.js +3 -14
  5. package/dist/helpers/get-audit-entry-details/index.js +2 -0
  6. package/dist/helpers/get-issue-details/index.js +2 -0
  7. package/dist/helpers/get-task-entry-details/index.js +3 -1
  8. package/dist/pdf/helpers/fields/index.js +2 -2
  9. package/dist/scheduling/scheduling.types.js +9 -9
  10. package/dist/service-hours/schema.js +12 -12
  11. package/lib/errors/DomainError.js +7 -8
  12. package/lib/errors/DomainError.js.map +1 -1
  13. package/lib/errors/ValidationError.js +11 -9
  14. package/lib/errors/ValidationError.js.map +1 -1
  15. package/lib/helpers/build-fetch-url/index.js +2 -2
  16. package/lib/helpers/build-fetch-url/index.js.map +1 -1
  17. package/lib/helpers/fetch-image/index.js +1 -1
  18. package/lib/helpers/fetch-image/index.js.map +1 -1
  19. package/lib/helpers/fetch-image-for-pdf-generator-service/index.js +174 -180
  20. package/lib/helpers/fetch-image-for-pdf-generator-service/index.js.map +1 -1
  21. package/lib/helpers/fetch-image-for-web/index.js +60 -74
  22. package/lib/helpers/fetch-image-for-web/index.js.map +1 -1
  23. package/lib/helpers/fetch-lighthouse-logo/index.js +41 -43
  24. package/lib/helpers/fetch-lighthouse-logo/index.js.map +1 -1
  25. package/lib/helpers/get-audit-entry-details/index.js +2 -0
  26. package/lib/helpers/get-audit-entry-details/index.js.map +1 -1
  27. package/lib/helpers/get-audit-items-data/index.js +8 -8
  28. package/lib/helpers/get-audit-items-data/index.js.map +1 -1
  29. package/lib/helpers/get-issue-details/index.js +2 -0
  30. package/lib/helpers/get-issue-details/index.js.map +1 -1
  31. package/lib/helpers/get-job-details/index.js.map +1 -1
  32. package/lib/helpers/get-location-reference/index.js +6 -4
  33. package/lib/helpers/get-location-reference/index.js.map +1 -1
  34. package/lib/helpers/get-reference-details/index.js.map +1 -1
  35. package/lib/helpers/get-task-entry-details/index.js +3 -1
  36. package/lib/helpers/get-task-entry-details/index.js.map +1 -1
  37. package/lib/helpers/get-timezone-datetime/index.js.map +1 -1
  38. package/lib/pdf/activity-report/index.js +299 -311
  39. package/lib/pdf/activity-report/index.js.map +1 -1
  40. package/lib/pdf/audit/index.js.map +1 -1
  41. package/lib/pdf/helpers/build-audit-content/index.js.map +1 -1
  42. package/lib/pdf/helpers/build-audit-follow-ups/index.js.map +1 -1
  43. package/lib/pdf/helpers/build-location-scans-content/index.js.map +1 -1
  44. package/lib/pdf/helpers/build-template-content/index.js.map +1 -1
  45. package/lib/pdf/helpers/fields/index.js +14 -14
  46. package/lib/pdf/helpers/fields/index.js.map +1 -1
  47. package/lib/pdf/helpers/generate-definition/index.js.map +1 -1
  48. package/lib/pdf/helpers/horizontal-line/index.js.map +1 -1
  49. package/lib/pdf/helpers/html-transformer/index.js +1 -2
  50. package/lib/pdf/helpers/html-transformer/index.js.map +1 -1
  51. package/lib/pdf/helpers/table/index.js +63 -65
  52. package/lib/pdf/helpers/table/index.js.map +1 -1
  53. package/lib/pdf/issue/index.js.map +1 -1
  54. package/lib/pdf/job/index.js.map +1 -1
  55. package/lib/pdf/shift-report/index.js +275 -291
  56. package/lib/pdf/shift-report/index.js.map +1 -1
  57. package/lib/pdf/task/index.js.map +1 -1
  58. package/lib/scheduling/generators/occurrenceIntervalsGenerator.js +27 -30
  59. package/lib/scheduling/generators/occurrenceIntervalsGenerator.js.map +1 -1
  60. package/lib/scheduling/generators/scheduleIntervalsGenerator.js +19 -21
  61. package/lib/scheduling/generators/scheduleIntervalsGenerator.js.map +1 -1
  62. package/lib/scheduling/generators/serviceIntervalsGenerator.js +134 -136
  63. package/lib/scheduling/generators/serviceIntervalsGenerator.js.map +1 -1
  64. package/lib/scheduling/helpers/generateNonRepeatingSchedule.js +81 -83
  65. package/lib/scheduling/helpers/generateNonRepeatingSchedule.js.map +1 -1
  66. package/lib/scheduling/helpers/generateRepeatingSchedule.js +104 -106
  67. package/lib/scheduling/helpers/generateRepeatingSchedule.js.map +1 -1
  68. package/lib/scheduling/helpers/generateScheduleEnd.js.map +1 -1
  69. package/lib/scheduling/helpers/mergeIntervals.js.map +1 -1
  70. package/lib/scheduling/scheduling.types.js +9 -9
  71. package/lib/scheduling/scheduling.types.js.map +1 -1
  72. package/lib/scheduling/strategies/getNext.js +21 -17
  73. package/lib/scheduling/strategies/getNext.js.map +1 -1
  74. package/lib/scheduling/strategies/getNextExactDateOfMonth.js +21 -18
  75. package/lib/scheduling/strategies/getNextExactDateOfMonth.js.map +1 -1
  76. package/lib/scheduling/strategies/getNextLastDayOfMonth.js +20 -17
  77. package/lib/scheduling/strategies/getNextLastDayOfMonth.js.map +1 -1
  78. package/lib/scheduling/strategies/getNextLastWeekdayOfMonth.js +20 -17
  79. package/lib/scheduling/strategies/getNextLastWeekdayOfMonth.js.map +1 -1
  80. package/lib/scheduling/strategies/getNextNoRepeat.js +15 -14
  81. package/lib/scheduling/strategies/getNextNoRepeat.js.map +1 -1
  82. package/lib/scheduling/strategies/getNextWeekday.js +36 -33
  83. package/lib/scheduling/strategies/getNextWeekday.js.map +1 -1
  84. package/lib/scheduling/strategies/getNextXDayOfXWeekOfMonth.js +20 -17
  85. package/lib/scheduling/strategies/getNextXDayOfXWeekOfMonth.js.map +1 -1
  86. package/lib/schema/schema.js +21 -23
  87. package/lib/schema/schema.js.map +1 -1
  88. package/lib/service-hours/schema.js +15 -13
  89. package/lib/service-hours/schema.js.map +1 -1
  90. package/package.json +2 -2
  91. 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 _callee$(_context) {
57
- while (1) {
58
- switch (_context.prev = _context.next) {
59
- case 0:
60
- timestamp = data.timestamp, timezone = data.timezone;
61
- title = 'Daily Activity Report';
62
- _context.next = 4;
63
- return generateContent(data);
64
- case 4:
65
- content = _context.sent;
66
- return _context.abrupt("return", generateDefinition(_objectSpread({
67
- content: content,
68
- fileTitle: title,
69
- timestamp: timestamp,
70
- timezone: timezone,
71
- type: 'Activity Summary'
72
- }, pdfOptions)));
73
- case 6:
74
- case "end":
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 _callee2$(_context2) {
89
- while (1) {
90
- switch (_context2.prev = _context2.next) {
91
- case 0:
92
- _context2.next = 2;
93
- return buildActivitySection(data);
94
- case 2:
95
- activitySection = _context2.sent;
96
- summarySection = buildSummarySection(data);
97
- titleTable = buildTitleTable(data);
98
- return _context2.abrupt("return", [titleTable, summarySection, activitySection]);
99
- case 6:
100
- case "end":
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 _callee3$(_context3) {
115
- while (1) {
116
- switch (_context3.prev = _context3.next) {
117
- case 0:
118
- _data$showAlternate = data.showAlternate, showAlternate = _data$showAlternate === void 0 ? false : _data$showAlternate;
119
- if (!showAlternate) {
120
- _context3.next = 7;
121
- break;
122
- }
123
- locationScans = buildLocationScansSection(data);
124
- _context3.next = 5;
125
- return buildOtherActivitySection(data);
126
- case 5:
127
- otherActivity = _context3.sent;
128
- return _context3.abrupt("return", [locationScans, otherActivity]);
129
- case 7:
130
- _context3.next = 9;
131
- return buildActivitySummarySection(data);
132
- case 9:
133
- activitySummary = _context3.sent;
134
- return _context3.abrupt("return", [activitySummary]);
135
- case 11:
136
- case "end":
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 _callee4$(_context4) {
151
- while (1) {
152
- switch (_context4.prev = _context4.next) {
153
- case 0:
154
- 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;
155
- enterEvents = filter(events, function (event) {
156
- return event.type === 'enter';
157
- });
158
- exceedsMaxScans = size(enterEvents) > maxScans;
159
- scans = take(enterEvents, maxScans);
160
- auditRows = map(audits, getFormRowData('audits', data));
161
- issueRows = map(issues, getFormRowData('issues', data));
162
- scanRows = map(scans, getScanRowData(data));
163
- taskRows = map(tasks, getFormRowData('tasks', data));
164
- formCount = size([].concat(_toConsumableArray(auditRows), _toConsumableArray(issueRows), _toConsumableArray(taskRows)));
165
- exceedsMaxForms = formCount > MAX_ATTACHMENTS;
166
- rows = [].concat(_toConsumableArray(auditRows), _toConsumableArray(issueRows), _toConsumableArray(scanRows), _toConsumableArray(taskRows));
167
- sortedRows = sortBy(rows, ['timestamp'], ['asc']);
168
- title = text('Activity Summary', {
169
- style: 'summarySectionHeader'
170
- });
171
- header = table({
172
- body: [[title]],
173
- layout: 'noBorders',
174
- style: 'summaryHeaderTable'
175
- });
176
- hLine = horizontalLine();
177
- _context4.next = 17;
178
- return buildActivityTable({
179
- rows: sortedRows,
180
- settings: settings,
181
- timezone: timezone
182
- });
183
- case 17:
184
- activityTable = _context4.sent;
185
- activitySummarySection = [header, hLine, activityTable];
186
- if (exceedsMaxScans) {
187
- maxScansText = {
188
- 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', {
189
- link: "".concat(LIGHTHOUSE_BASE_URL, "/reports/events")
190
- }), text(' in the Lighthouse Management Console.')],
191
- style: 'small',
192
- margin: [0, 10, 0, 10]
193
- };
194
- activitySummarySection.push(maxScansText);
195
- }
196
- if (exceedsMaxForms) {
197
- maxFormsText = {
198
- 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.')],
199
- style: 'small',
200
- margin: [0, 10, 0, 10]
201
- };
202
- activitySummarySection.push(maxFormsText);
203
- }
204
- return _context4.abrupt("return", activitySummarySection);
205
- case 22:
206
- case "end":
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 _callee6$(_context6) {
221
- while (1) {
222
- switch (_context6.prev = _context6.next) {
223
- case 0:
224
- rows = _ref.rows, settings = _ref.settings, timezone = _ref.timezone;
225
- timezoneAbbr = getTimezoneAbbr(timezone);
226
- activityTableHeader = [text('Activity', {
227
- bold: true
228
- }), {
229
- text: ''
230
- },
231
- // icon column
232
- text('Location', {
233
- bold: true
234
- }), text('User', {
235
- bold: true
236
- }), text("Timestamp (".concat(timezoneAbbr, ")"), {
237
- alignment: 'right',
238
- bold: true
239
- })];
240
- _context6.next = 5;
241
- return Promise.map(rows, /*#__PURE__*/function () {
242
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data) {
243
- var link, location, icon, name, summaryFields, timestamp, title, timezoneHour, iconCell, rows, hasSummaryFields, fieldsTable, activityTableRow;
244
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
245
- while (1) {
246
- switch (_context5.prev = _context5.next) {
247
- case 0:
248
- link = data.link, location = data.location, icon = data.icon, name = data.name, summaryFields = data.summaryFields, timestamp = data.timestamp, title = data.title;
249
- timezoneHour = getTimezoneDatetime({
250
- format: 'ddd DD h:mm a',
251
- showTzAbbr: false,
252
- timestamp: timestamp,
253
- timezone: timezone
254
- });
255
- iconCell = icon ? {
256
- alignment: 'center',
257
- fit: [8, 8],
258
- image: icon,
259
- link: link
260
- } : {
261
- text: ''
262
- }; // NOTE: pass link to each column as
263
- // we can't wrap the entire table row
264
- rows = [[text(title, {
265
- link: link
266
- }), iconCell, text(location, {
267
- link: link
268
- }), text(name, {
269
- link: link
270
- }), text(timezoneHour, {
271
- alignment: 'right',
272
- link: link
273
- })]];
274
- hasSummaryFields = !isEmpty(summaryFields);
275
- if (!hasSummaryFields) {
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
- }, _callee5);
328
- }));
329
- return function (_x8) {
330
- return _ref4.apply(this, arguments);
331
- };
332
- }());
333
- case 5:
334
- activityTableRows = _context6.sent;
335
- activityTableBody = isEmpty(activityTableRows) ? [[text('No other activity', {
336
- colSpan: 5
337
- })]] : activityTableRows;
338
- activityTable = table({
339
- body: [activityTableHeader].concat(_toConsumableArray(activityTableBody)),
340
- dontBreakRows: true,
341
- layout: {
342
- hLineWidth: function hLineWidth() {
343
- return 0;
344
- },
345
- fillColor: zebraFillColor,
346
- paddingLeft: function paddingLeft() {
347
- return 5;
348
- },
349
- paddingRight: function paddingRight() {
350
- return 5;
351
- },
352
- paddingTop: function paddingTop() {
353
- return 5;
354
- },
355
- paddingBottom: function paddingBottom() {
356
- return 5;
357
- },
358
- vLineWidth: function vLineWidth() {
359
- return 0;
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
- widths: [120, 15, 100, 100, '*']
363
- });
364
- return _context6.abrupt("return", activityTable);
365
- case 9:
366
- case "end":
367
- return _context6.stop();
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; //const userEvents = groupBy(events, 'user')
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 _callee7$(_context7) {
525
- while (1) {
526
- switch (_context7.prev = _context7.next) {
527
- case 0:
528
- audits = data.audits, issues = data.issues, tasks = data.tasks, settings = data.settings, timezone = data.timezone;
529
- auditRows = map(audits, getFormRowData('audits', data));
530
- issueRows = map(issues, getFormRowData('issues', data));
531
- taskRows = map(tasks, getFormRowData('tasks', data));
532
- rows = [].concat(_toConsumableArray(auditRows), _toConsumableArray(issueRows), _toConsumableArray(taskRows));
533
- sortedRows = sortBy(rows, ['timestamp'], ['asc']);
534
- title = text('Other Activity', {
535
- style: 'summarySectionHeader'
536
- });
537
- header = table({
538
- body: [[title]],
539
- layout: 'noBorders',
540
- style: 'summaryHeaderTable'
541
- });
542
- hLine = horizontalLine();
543
- _context7.next = 11;
544
- return buildActivityTable({
545
- rows: sortedRows,
546
- settings: settings,
547
- timezone: timezone
548
- });
549
- case 11:
550
- activityTable = _context7.sent;
551
- otherActivitySummarySection = [header, hLine, activityTable];
552
- formCount = size(rows);
553
- exceedsMaxForms = formCount > MAX_ATTACHMENTS;
554
- if (exceedsMaxForms) {
555
- maxFormsText = {
556
- 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.')],
557
- style: 'small',
558
- margin: [0, 10, 0, 10]
559
- };
560
- otherActivitySummarySection.push(maxFormsText);
561
- }
562
- return _context7.abrupt("return", otherActivitySummarySection);
563
- case 17:
564
- case "end":
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
  }));