@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.
Files changed (242) hide show
  1. package/dist/constants.js +7 -13
  2. package/dist/errors/DomainError.js +2 -4
  3. package/dist/errors/ValidationError.js +0 -8
  4. package/dist/errors/index.js +1 -5
  5. package/dist/helpers/build-fetch-url/index.js +0 -5
  6. package/dist/helpers/fetch-image/index.js +16 -32
  7. package/dist/helpers/fetch-image-for-pdf-generator-service/index.js +7 -40
  8. package/dist/helpers/fetch-image-for-web/index.js +0 -9
  9. package/dist/helpers/fetch-lighthouse-logo/index.js +2 -13
  10. package/dist/helpers/floatify/index.js +0 -1
  11. package/dist/helpers/get-assignees-full-names/index.js +0 -4
  12. package/dist/helpers/get-audit-entry-details/index.js +0 -3
  13. package/dist/helpers/get-audit-items-data/index.js +2 -6
  14. package/dist/helpers/get-geometry-geocoded-string/index.js +0 -3
  15. package/dist/helpers/get-issue-details/index.js +0 -7
  16. package/dist/helpers/get-job-details/index.js +0 -7
  17. package/dist/helpers/get-location-reference/index.js +18 -21
  18. package/dist/helpers/get-pretty-duration/index.js +0 -5
  19. package/dist/helpers/get-reference-details/index.js +0 -4
  20. package/dist/helpers/get-status-details/index.js +2 -9
  21. package/dist/helpers/get-task-entry-details/index.js +0 -3
  22. package/dist/helpers/get-timezone-abbr/index.js +0 -4
  23. package/dist/helpers/get-timezone-datetime/index.js +0 -5
  24. package/dist/helpers/get-user-full-name/index.js +0 -1
  25. package/dist/helpers/get-value-as-percentage/index.js +0 -1
  26. package/dist/helpers/image-validators/index.js +8 -9
  27. package/dist/helpers/index.js +16 -33
  28. package/dist/images/index.js +5 -9
  29. package/dist/index.js +4 -20
  30. package/dist/pdf/activity-report/index.js +41 -62
  31. package/dist/pdf/audit/index.js +0 -14
  32. package/dist/pdf/helpers/build-audit-content/index.js +4 -15
  33. package/dist/pdf/helpers/build-audit-follow-ups/index.js +4 -14
  34. package/dist/pdf/helpers/build-location-scans-content/index.js +4 -17
  35. package/dist/pdf/helpers/build-template-content/index.js +5 -14
  36. package/dist/pdf/helpers/default-footer/index.js +2 -3
  37. package/dist/pdf/helpers/default-header/index.js +0 -2
  38. package/dist/pdf/helpers/default-styles/index.js +2 -3
  39. package/dist/pdf/helpers/fields/index.js +21 -51
  40. package/dist/pdf/helpers/format-location-address/index.js +0 -3
  41. package/dist/pdf/helpers/generate-definition/index.js +0 -12
  42. package/dist/pdf/helpers/horizontal-line/index.js +0 -1
  43. package/dist/pdf/helpers/html-transformer/index.js +11 -23
  44. package/dist/pdf/helpers/index.js +40 -55
  45. package/dist/pdf/helpers/parse-value/index.js +2 -6
  46. package/dist/pdf/helpers/table/index.js +13 -31
  47. package/dist/pdf/helpers/text/index.js +0 -1
  48. package/dist/pdf/icons/index.js +3 -5
  49. package/dist/pdf/index.js +4 -10
  50. package/dist/pdf/issue/index.js +17 -16
  51. package/dist/pdf/job/index.js +1 -13
  52. package/dist/pdf/shift-report/emptyFixtures.js +4 -6
  53. package/dist/pdf/shift-report/index.js +2 -25
  54. package/dist/pdf/task/index.js +0 -13
  55. package/dist/scheduling/generators/index.js +0 -6
  56. package/dist/scheduling/generators/occurrenceIntervalsGenerator.js +1 -6
  57. package/dist/scheduling/generators/scheduleIntervalsGenerator.js +0 -5
  58. package/dist/scheduling/generators/serviceIntervalsGenerator.js +13 -27
  59. package/dist/scheduling/helpers/convertToTimezone.js +1 -6
  60. package/dist/scheduling/helpers/generateNonRepeatingSchedule.js +3 -9
  61. package/dist/scheduling/helpers/generateRepeatingSchedule.js +11 -18
  62. package/dist/scheduling/helpers/generateScheduleEnd.js +2 -8
  63. package/dist/scheduling/helpers/hasValidStartAndEnd.js +0 -6
  64. package/dist/scheduling/helpers/index.js +0 -28
  65. package/dist/scheduling/helpers/intervalCovers.js +0 -1
  66. package/dist/scheduling/helpers/intervalIntersectsEnd.js +0 -1
  67. package/dist/scheduling/helpers/intervalIntersectsStart.js +0 -1
  68. package/dist/scheduling/helpers/intervalOnlyIntersectsEnd.js +1 -3
  69. package/dist/scheduling/helpers/intervalOnlyIntersectsStart.js +0 -3
  70. package/dist/scheduling/helpers/intervalOutside.js +0 -1
  71. package/dist/scheduling/helpers/intervalWithin.js +0 -1
  72. package/dist/scheduling/helpers/mergeIntervals.js +0 -4
  73. package/dist/scheduling/helpers/splitIntervals.js +0 -3
  74. package/dist/scheduling/index.js +0 -6
  75. package/dist/scheduling/scheduling.types.js +10 -18
  76. package/dist/scheduling/strategies/getNext.js +2 -13
  77. package/dist/scheduling/strategies/getNextExactDateOfMonth.js +0 -12
  78. package/dist/scheduling/strategies/getNextLastDayOfMonth.js +0 -10
  79. package/dist/scheduling/strategies/getNextLastWeekdayOfMonth.js +0 -11
  80. package/dist/scheduling/strategies/getNextNoRepeat.js +0 -7
  81. package/dist/scheduling/strategies/getNextWeekday.js +0 -10
  82. package/dist/scheduling/strategies/getNextXDayOfXWeekOfMonth.js +0 -12
  83. package/dist/scheduling/strategies/index.js +0 -14
  84. package/dist/schema/index.js +0 -2
  85. package/dist/schema/schema.js +2 -7
  86. package/dist/service-hours/__helpers__/calculate-hours.js +4 -13
  87. package/dist/service-hours/__helpers__/isOpen.js +0 -9
  88. package/dist/service-hours/index.js +0 -4
  89. package/dist/service-hours/schema.js +20 -43
  90. package/lib/constants.js.map +1 -1
  91. package/lib/errors/DomainError.js +11 -47
  92. package/lib/errors/DomainError.js.map +1 -1
  93. package/lib/errors/ValidationError.js +15 -52
  94. package/lib/errors/ValidationError.js.map +1 -1
  95. package/lib/errors/index.js.map +1 -1
  96. package/lib/helpers/build-fetch-url/index.js +14 -20
  97. package/lib/helpers/build-fetch-url/index.js.map +1 -1
  98. package/lib/helpers/fetch-image/index.js +20 -27
  99. package/lib/helpers/fetch-image/index.js.map +1 -1
  100. package/lib/helpers/fetch-image-for-pdf-generator-service/index.js +187 -239
  101. package/lib/helpers/fetch-image-for-pdf-generator-service/index.js.map +1 -1
  102. package/lib/helpers/fetch-image-for-web/index.js +50 -66
  103. package/lib/helpers/fetch-image-for-web/index.js.map +1 -1
  104. package/lib/helpers/fetch-lighthouse-logo/index.js +47 -59
  105. package/lib/helpers/fetch-lighthouse-logo/index.js.map +1 -1
  106. package/lib/helpers/floatify/index.js.map +1 -1
  107. package/lib/helpers/get-assignees-full-names/index.js +0 -1
  108. package/lib/helpers/get-assignees-full-names/index.js.map +1 -1
  109. package/lib/helpers/get-audit-entry-details/index.js +8 -8
  110. package/lib/helpers/get-audit-entry-details/index.js.map +1 -1
  111. package/lib/helpers/get-audit-items-data/index.js +16 -19
  112. package/lib/helpers/get-audit-items-data/index.js.map +1 -1
  113. package/lib/helpers/get-geometry-geocoded-string/index.js.map +1 -1
  114. package/lib/helpers/get-issue-details/index.js +11 -11
  115. package/lib/helpers/get-issue-details/index.js.map +1 -1
  116. package/lib/helpers/get-job-details/index.js +12 -12
  117. package/lib/helpers/get-job-details/index.js.map +1 -1
  118. package/lib/helpers/get-location-reference/index.js +32 -36
  119. package/lib/helpers/get-location-reference/index.js.map +1 -1
  120. package/lib/helpers/get-pretty-duration/index.js +0 -4
  121. package/lib/helpers/get-pretty-duration/index.js.map +1 -1
  122. package/lib/helpers/get-reference-details/index.js +1 -3
  123. package/lib/helpers/get-reference-details/index.js.map +1 -1
  124. package/lib/helpers/get-status-details/index.js +0 -4
  125. package/lib/helpers/get-status-details/index.js.map +1 -1
  126. package/lib/helpers/get-task-entry-details/index.js +5 -5
  127. package/lib/helpers/get-task-entry-details/index.js.map +1 -1
  128. package/lib/helpers/get-timezone-abbr/index.js.map +1 -1
  129. package/lib/helpers/get-timezone-datetime/index.js +6 -6
  130. package/lib/helpers/get-timezone-datetime/index.js.map +1 -1
  131. package/lib/helpers/get-user-full-name/index.js.map +1 -1
  132. package/lib/helpers/get-value-as-percentage/index.js.map +1 -1
  133. package/lib/helpers/image-validators/index.js +8 -7
  134. package/lib/helpers/image-validators/index.js.map +1 -1
  135. package/lib/helpers/index.js.map +1 -1
  136. package/lib/images/index.js.map +1 -1
  137. package/lib/index.js.map +1 -1
  138. package/lib/pdf/activity-report/index.js +360 -416
  139. package/lib/pdf/activity-report/index.js.map +1 -1
  140. package/lib/pdf/audit/index.js +25 -36
  141. package/lib/pdf/audit/index.js.map +1 -1
  142. package/lib/pdf/fonts/index.js.map +1 -1
  143. package/lib/pdf/helpers/build-audit-content/index.js +3 -5
  144. package/lib/pdf/helpers/build-audit-content/index.js.map +1 -1
  145. package/lib/pdf/helpers/build-audit-follow-ups/index.js +5 -12
  146. package/lib/pdf/helpers/build-audit-follow-ups/index.js.map +1 -1
  147. package/lib/pdf/helpers/build-location-scans-content/index.js +4 -9
  148. package/lib/pdf/helpers/build-location-scans-content/index.js.map +1 -1
  149. package/lib/pdf/helpers/build-template-content/index.js +7 -9
  150. package/lib/pdf/helpers/build-template-content/index.js.map +1 -1
  151. package/lib/pdf/helpers/default-footer/index.js +9 -8
  152. package/lib/pdf/helpers/default-footer/index.js.map +1 -1
  153. package/lib/pdf/helpers/default-header/index.js +5 -5
  154. package/lib/pdf/helpers/default-header/index.js.map +1 -1
  155. package/lib/pdf/helpers/default-styles/index.js.map +1 -1
  156. package/lib/pdf/helpers/fields/index.js +48 -81
  157. package/lib/pdf/helpers/fields/index.js.map +1 -1
  158. package/lib/pdf/helpers/format-location-address/index.js.map +1 -1
  159. package/lib/pdf/helpers/generate-definition/index.js +22 -29
  160. package/lib/pdf/helpers/generate-definition/index.js.map +1 -1
  161. package/lib/pdf/helpers/horizontal-line/index.js +1 -1
  162. package/lib/pdf/helpers/horizontal-line/index.js.map +1 -1
  163. package/lib/pdf/helpers/html-transformer/index.js +19 -30
  164. package/lib/pdf/helpers/html-transformer/index.js.map +1 -1
  165. package/lib/pdf/helpers/index.js.map +1 -1
  166. package/lib/pdf/helpers/parse-value/index.js +2 -4
  167. package/lib/pdf/helpers/parse-value/index.js.map +1 -1
  168. package/lib/pdf/helpers/table/index.js +78 -84
  169. package/lib/pdf/helpers/table/index.js.map +1 -1
  170. package/lib/pdf/helpers/text/index.js +2 -5
  171. package/lib/pdf/helpers/text/index.js.map +1 -1
  172. package/lib/pdf/icons/index.js.map +1 -1
  173. package/lib/pdf/index.js.map +1 -1
  174. package/lib/pdf/issue/index.js +36 -30
  175. package/lib/pdf/issue/index.js.map +1 -1
  176. package/lib/pdf/job/index.js +12 -19
  177. package/lib/pdf/job/index.js.map +1 -1
  178. package/lib/pdf/shift-report/emptyFixtures.js.map +1 -1
  179. package/lib/pdf/shift-report/index.js +308 -374
  180. package/lib/pdf/shift-report/index.js.map +1 -1
  181. package/lib/pdf/task/index.js +11 -19
  182. package/lib/pdf/task/index.js.map +1 -1
  183. package/lib/scheduling/generators/index.js.map +1 -1
  184. package/lib/scheduling/generators/occurrenceIntervalsGenerator.js +27 -38
  185. package/lib/scheduling/generators/occurrenceIntervalsGenerator.js.map +1 -1
  186. package/lib/scheduling/generators/scheduleIntervalsGenerator.js +19 -30
  187. package/lib/scheduling/generators/scheduleIntervalsGenerator.js.map +1 -1
  188. package/lib/scheduling/generators/serviceIntervalsGenerator.js +139 -181
  189. package/lib/scheduling/generators/serviceIntervalsGenerator.js.map +1 -1
  190. package/lib/scheduling/helpers/convertToTimezone.js +1 -1
  191. package/lib/scheduling/helpers/convertToTimezone.js.map +1 -1
  192. package/lib/scheduling/helpers/generateNonRepeatingSchedule.js +84 -124
  193. package/lib/scheduling/helpers/generateNonRepeatingSchedule.js.map +1 -1
  194. package/lib/scheduling/helpers/generateRepeatingSchedule.js +107 -175
  195. package/lib/scheduling/helpers/generateRepeatingSchedule.js.map +1 -1
  196. package/lib/scheduling/helpers/generateScheduleEnd.js +6 -6
  197. package/lib/scheduling/helpers/generateScheduleEnd.js.map +1 -1
  198. package/lib/scheduling/helpers/hasValidStartAndEnd.js +1 -2
  199. package/lib/scheduling/helpers/hasValidStartAndEnd.js.map +1 -1
  200. package/lib/scheduling/helpers/index.js.map +1 -1
  201. package/lib/scheduling/helpers/intervalCovers.js.map +1 -1
  202. package/lib/scheduling/helpers/intervalIntersectsEnd.js.map +1 -1
  203. package/lib/scheduling/helpers/intervalIntersectsStart.js.map +1 -1
  204. package/lib/scheduling/helpers/intervalOnlyIntersectsEnd.js +1 -0
  205. package/lib/scheduling/helpers/intervalOnlyIntersectsEnd.js.map +1 -1
  206. package/lib/scheduling/helpers/intervalOnlyIntersectsStart.js +1 -1
  207. package/lib/scheduling/helpers/intervalOnlyIntersectsStart.js.map +1 -1
  208. package/lib/scheduling/helpers/intervalOutside.js.map +1 -1
  209. package/lib/scheduling/helpers/intervalWithin.js.map +1 -1
  210. package/lib/scheduling/helpers/mergeIntervals.js +0 -3
  211. package/lib/scheduling/helpers/mergeIntervals.js.map +1 -1
  212. package/lib/scheduling/helpers/splitIntervals.js +1 -1
  213. package/lib/scheduling/helpers/splitIntervals.js.map +1 -1
  214. package/lib/scheduling/index.js.map +1 -1
  215. package/lib/scheduling/scheduling.types.js +9 -14
  216. package/lib/scheduling/scheduling.types.js.map +1 -1
  217. package/lib/scheduling/strategies/getNext.js +22 -30
  218. package/lib/scheduling/strategies/getNext.js.map +1 -1
  219. package/lib/scheduling/strategies/getNextExactDateOfMonth.js +22 -31
  220. package/lib/scheduling/strategies/getNextExactDateOfMonth.js.map +1 -1
  221. package/lib/scheduling/strategies/getNextLastDayOfMonth.js +21 -28
  222. package/lib/scheduling/strategies/getNextLastDayOfMonth.js.map +1 -1
  223. package/lib/scheduling/strategies/getNextLastWeekdayOfMonth.js +21 -28
  224. package/lib/scheduling/strategies/getNextLastWeekdayOfMonth.js.map +1 -1
  225. package/lib/scheduling/strategies/getNextNoRepeat.js +15 -23
  226. package/lib/scheduling/strategies/getNextNoRepeat.js.map +1 -1
  227. package/lib/scheduling/strategies/getNextWeekday.js +43 -78
  228. package/lib/scheduling/strategies/getNextWeekday.js.map +1 -1
  229. package/lib/scheduling/strategies/getNextXDayOfXWeekOfMonth.js +21 -28
  230. package/lib/scheduling/strategies/getNextXDayOfXWeekOfMonth.js.map +1 -1
  231. package/lib/scheduling/strategies/index.js.map +1 -1
  232. package/lib/schema/index.js.map +1 -1
  233. package/lib/schema/schema.js +22 -30
  234. package/lib/schema/schema.js.map +1 -1
  235. package/lib/service-hours/__helpers__/calculate-hours.js +4 -13
  236. package/lib/service-hours/__helpers__/calculate-hours.js.map +1 -1
  237. package/lib/service-hours/__helpers__/isOpen.js +3 -7
  238. package/lib/service-hours/__helpers__/isOpen.js.map +1 -1
  239. package/lib/service-hours/index.js.map +1 -1
  240. package/lib/service-hours/schema.js +21 -36
  241. package/lib/service-hours/schema.js.map +1 -1
  242. 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(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
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( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(pdfOptions, data) {
54
+ _buildActivityPdf = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(pdfOptions, data) {
59
55
  var timestamp, timezone, title, content;
60
- return _regeneratorRuntime.wrap(function _callee$(_context) {
61
- while (1) {
62
- switch (_context.prev = _context.next) {
63
- case 0:
64
- timestamp = data.timestamp, timezone = data.timezone;
65
- title = 'Daily Activity Report';
66
- _context.next = 4;
67
- return generateContent(data);
68
-
69
- case 4:
70
- content = _context.sent;
71
- return _context.abrupt("return", generateDefinition(_objectSpread({
72
- content: content,
73
- fileTitle: title,
74
- timestamp: timestamp,
75
- timezone: timezone,
76
- type: 'Activity Summary'
77
- }, pdfOptions)));
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( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(data) {
84
+ _generateContent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(data) {
95
85
  var activitySection, summarySection, titleTable;
96
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
97
- while (1) {
98
- switch (_context2.prev = _context2.next) {
99
- case 0:
100
- _context2.next = 2;
101
- return buildActivitySection(data);
102
-
103
- case 2:
104
- activitySection = _context2.sent;
105
- summarySection = buildSummarySection(data);
106
- titleTable = buildTitleTable(data);
107
- return _context2.abrupt("return", [titleTable, summarySection, activitySection]);
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( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(data) {
108
+ _buildActivitySection = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(data) {
125
109
  var _data$showAlternate, showAlternate, locationScans, otherActivity, activitySummary;
126
-
127
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
128
- while (1) {
129
- switch (_context3.prev = _context3.next) {
130
- case 0:
131
- _data$showAlternate = data.showAlternate, showAlternate = _data$showAlternate === void 0 ? false : _data$showAlternate;
132
-
133
- if (!showAlternate) {
134
- _context3.next = 7;
135
- break;
136
- }
137
-
138
- locationScans = buildLocationScansSection(data);
139
- _context3.next = 5;
140
- return buildOtherActivitySection(data);
141
-
142
- case 5:
143
- otherActivity = _context3.sent;
144
- return _context3.abrupt("return", [locationScans, otherActivity]);
145
-
146
- case 7:
147
- _context3.next = 9;
148
- return buildActivitySummarySection(data);
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( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data) {
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
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
173
- while (1) {
174
- switch (_context4.prev = _context4.next) {
175
- case 0:
176
- 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;
177
- enterEvents = filter(events, function (event) {
178
- return event.type === 'enter';
179
- });
180
- exceedsMaxScans = size(enterEvents) > maxScans;
181
- scans = take(enterEvents, maxScans);
182
- auditRows = map(audits, getFormRowData('audits', data));
183
- issueRows = map(issues, getFormRowData('issues', data));
184
- scanRows = map(scans, getScanRowData(data));
185
- taskRows = map(tasks, getFormRowData('tasks', data));
186
- formCount = size([].concat(_toConsumableArray(auditRows), _toConsumableArray(issueRows), _toConsumableArray(taskRows)));
187
- exceedsMaxForms = formCount > MAX_ATTACHMENTS;
188
- rows = [].concat(_toConsumableArray(auditRows), _toConsumableArray(issueRows), _toConsumableArray(scanRows), _toConsumableArray(taskRows));
189
- sortedRows = sortBy(rows, ['timestamp'], ['asc']);
190
- title = text('Activity Summary', {
191
- style: 'summarySectionHeader'
192
- });
193
- header = table({
194
- body: [[title]],
195
- layout: 'noBorders',
196
- style: 'summaryHeaderTable'
197
- });
198
- hLine = horizontalLine();
199
- _context4.next = 17;
200
- return buildActivityTable({
201
- rows: sortedRows,
202
- settings: settings,
203
- timezone: timezone
204
- });
205
-
206
- case 17:
207
- activityTable = _context4.sent;
208
- activitySummarySection = [header, hLine, activityTable];
209
-
210
- if (exceedsMaxScans) {
211
- maxScansText = {
212
- 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', {
213
- link: "".concat(LIGHTHOUSE_BASE_URL, "/reports/events")
214
- }), text(' in the Lighthouse Management Console.')],
215
- style: 'small',
216
- margin: [0, 10, 0, 10]
217
- };
218
- activitySummarySection.push(maxScansText);
219
- }
220
-
221
- if (exceedsMaxForms) {
222
- maxFormsText = {
223
- 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.')],
224
- style: 'small',
225
- margin: [0, 10, 0, 10]
226
- };
227
- activitySummarySection.push(maxFormsText);
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( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref) {
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 _callee6$(_context6) {
250
- while (1) {
251
- switch (_context6.prev = _context6.next) {
252
- case 0:
253
- rows = _ref.rows, settings = _ref.settings, timezone = _ref.timezone;
254
- timezoneAbbr = getTimezoneAbbr(timezone);
255
- activityTableHeader = [text('Activity', {
256
- bold: true
257
- }), {
258
- text: ''
259
- }, // icon column
260
- text('Location', {
261
- bold: true
262
- }), text('User', {
263
- bold: true
264
- }), text("Timestamp (".concat(timezoneAbbr, ")"), {
265
- alignment: 'right',
266
- bold: true
267
- })];
268
- _context6.next = 5;
269
- return Promise.map(rows, /*#__PURE__*/function () {
270
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data) {
271
- var link, location, icon, name, summaryFields, timestamp, title, timezoneHour, iconCell, rows, hasSummaryFields, fieldsTable, activityTableRow;
272
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
273
- while (1) {
274
- switch (_context5.prev = _context5.next) {
275
- case 0:
276
- link = data.link, location = data.location, icon = data.icon, name = data.name, summaryFields = data.summaryFields, timestamp = data.timestamp, title = data.title;
277
- timezoneHour = getTimezoneDatetime({
278
- format: 'ddd DD h:mm a',
279
- showTzAbbr: false,
280
- timestamp: timestamp,
281
- timezone: timezone
282
- });
283
- iconCell = icon ? {
284
- alignment: 'center',
285
- fit: [8, 8],
286
- image: icon,
287
- link: link
288
- } : {
289
- text: ''
290
- }; // NOTE: pass link to each column as
291
- // we can't wrap the entire table row
292
-
293
- rows = [[text(title, {
294
- link: link
295
- }), iconCell, text(location, {
296
- link: link
297
- }), text(name, {
298
- link: link
299
- }), text(timezoneHour, {
300
- alignment: 'right',
301
- link: link
302
- })]];
303
- hasSummaryFields = !isEmpty(summaryFields);
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
- }, _callee5);
362
- }));
363
-
364
- return function (_x8) {
365
- return _ref4.apply(this, arguments);
366
- };
367
- }());
368
-
369
- case 5:
370
- activityTableRows = _context6.sent;
371
- activityTableBody = isEmpty(activityTableRows) ? [[text('No other activity', {
372
- colSpan: 5
373
- })]] : activityTableRows;
374
- activityTable = table({
375
- body: [activityTableHeader].concat(_toConsumableArray(activityTableBody)),
376
- dontBreakRows: true,
377
- layout: {
378
- hLineWidth: function hLineWidth() {
379
- return 0;
380
- },
381
- fillColor: zebraFillColor,
382
- paddingLeft: function paddingLeft() {
383
- return 5;
384
- },
385
- paddingRight: function paddingRight() {
386
- return 5;
387
- },
388
- paddingTop: function paddingTop() {
389
- return 5;
390
- },
391
- paddingBottom: function paddingBottom() {
392
- return 5;
393
- },
394
- vLineWidth: function vLineWidth() {
395
- 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();
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
- widths: [120, 15, 100, 100, '*']
399
- });
400
- return _context6.abrupt("return", activityTable);
401
-
402
- case 9:
403
- case "end":
404
- return _context6.stop();
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
- start = data.start,
415
- timezone = data.timezone,
416
- zones = data.zones;
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
- }); // use start time and timezone to figure out the interval boundaries
374
+ });
425
375
 
426
- var hourIntervalBoundaries = buildLocationScansBoundaries(start, timezone); // pair interval boundaries into column headers for the table
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) // skip the final iteration as it's just the end of the last interval
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(); // NOTE: only show the enter events within the summary table
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']); // put events into interval buckets
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
- events = data.events,
491
- issues = data.issues,
492
- tasks = data.tasks; //const userEvents = groupBy(events, 'user')
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); //const geoEventsCount = size(eventsByType.geo)
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); //const uniqueUsers = size(userEvents)
454
+ var auditsCount = size(audits);
455
+ //const uniqueUsers = size(userEvents)
500
456
 
501
457
  var auditsText = text('AUDITS', {
502
458
  style: 'summaryText'
503
- }); //const geoText = text('GPS', { style: 'summaryText' })
504
-
459
+ });
460
+ //const geoText = text('GPS', { style: 'summaryText' })
505
461
  var issuesText = text('ISSUES', {
506
462
  style: 'summaryText'
507
- }); //const peopleText = text('PEOPLE', { style: 'summaryText' })
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
- }); //const peopleCountText = text(toString(uniqueUsers), { style: 'summaryCount' })
518
-
473
+ });
474
+ //const peopleCountText = text(toString(uniqueUsers), { style: 'summaryCount' })
519
475
  var scansCountText = text(toString(enterEventsCount), {
520
476
  style: 'summaryCount'
521
- }); //const geoCountText = text(toString(geoEventsCount), { style: 'summaryCount' })
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
- }); //const peopleTable = summaryStatTable({
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( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(data) {
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 _callee7$(_context7) {
563
- while (1) {
564
- switch (_context7.prev = _context7.next) {
565
- case 0:
566
- audits = data.audits, issues = data.issues, tasks = data.tasks, settings = data.settings, timezone = data.timezone;
567
- auditRows = map(audits, getFormRowData('audits', data));
568
- issueRows = map(issues, getFormRowData('issues', data));
569
- taskRows = map(tasks, getFormRowData('tasks', data));
570
- rows = [].concat(_toConsumableArray(auditRows), _toConsumableArray(issueRows), _toConsumableArray(taskRows));
571
- sortedRows = sortBy(rows, ['timestamp'], ['asc']);
572
- title = text('Other Activity', {
573
- style: 'summarySectionHeader'
574
- });
575
- header = table({
576
- body: [[title]],
577
- layout: 'noBorders',
578
- style: 'summaryHeaderTable'
579
- });
580
- hLine = horizontalLine();
581
- _context7.next = 11;
582
- return buildActivityTable({
583
- rows: sortedRows,
584
- settings: settings,
585
- timezone: timezone
586
- });
587
-
588
- case 11:
589
- activityTable = _context7.sent;
590
- otherActivitySummarySection = [header, hLine, activityTable];
591
- formCount = size(rows);
592
- exceedsMaxForms = formCount > MAX_ATTACHMENTS;
593
-
594
- if (exceedsMaxForms) {
595
- maxFormsText = {
596
- 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.')],
597
- style: 'small',
598
- margin: [0, 10, 0, 10]
599
- };
600
- otherActivitySummarySection.push(maxFormsText);
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
- start = data.start,
618
- end = data.end,
619
- timezone = data.timezone;
562
+ start = data.start,
563
+ end = data.end,
564
+ timezone = data.timezone;
620
565
  var _location$address = location.address,
621
- address = _location$address === void 0 ? {} : _location$address;
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
- users = _ref2.users,
651
- zones = _ref2.zones;
594
+ users = _ref2.users,
595
+ zones = _ref2.zones;
652
596
  return function (document) {
653
597
  var _id = document._id,
654
- createdAt = document.createdAt,
655
- _document$entry = document.entry,
656
- entry = _document$entry === void 0 ? {} : _document$entry,
657
- _document$title = document.title,
658
- title = _document$title === void 0 ? 'Unknown' : _document$title,
659
- _document$user = document.user,
660
- user = _document$user === void 0 ? '' : _document$user;
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'; // NOTE: currently only issues and tasks will return summary fields, audits
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
- zones = _ref3.zones;
633
+ zones = _ref3.zones;
690
634
  return function (document) {
691
635
  var timestamp = document.timestamp,
692
- _document$user2 = document.user,
693
- user = _document$user2 === void 0 ? '' : _document$user2,
694
- _document$zone = document.zone,
695
- zone = _document$zone === void 0 ? '' : _document$zone;
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
  });