@lighthouse/common 6.10.0 → 6.10.1-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 (229) hide show
  1. package/.mise.toml +6 -6
  2. package/CHANGELOG.md +758 -758
  3. package/README.md +1 -1
  4. package/dist/errors/FetchImageError.js +3 -3
  5. package/dist/helpers/fetch-image-for-pdf-generator-service/index.js +7 -7
  6. package/dist/helpers/floatify/index.js +6 -6
  7. package/dist/helpers/get-audit-items-data/index.js +47 -36
  8. package/dist/helpers/validate-url/index.js +4 -4
  9. package/dist/pdf/activity-report/index.js +32 -32
  10. package/dist/pdf/audit/index.js +23 -23
  11. package/dist/pdf/helpers/fields/index.js +47 -27
  12. package/dist/pdf/issue/index.js +23 -23
  13. package/dist/pdf/job/index.js +22 -22
  14. package/dist/pdf/shift-report/index.js +28 -28
  15. package/dist/pdf/task/index.js +23 -23
  16. package/dist/scheduling/generators/occurrenceIntervalsGenerator.js +2 -2
  17. package/dist/scheduling/generators/scheduleIntervalsGenerator.js +2 -2
  18. package/dist/scheduling/generators/serviceIntervalsGenerator.js +2 -2
  19. package/dist/scheduling/helpers/convertToTimezone.js +6 -6
  20. package/dist/scheduling/helpers/generateNonRepeatingSchedule.js +2 -2
  21. package/dist/scheduling/helpers/generateRepeatingSchedule.js +2 -2
  22. package/dist/scheduling/helpers/generateScheduleEnd.js +2 -2
  23. package/dist/scheduling/helpers/hasValidStartAndEnd.js +5 -5
  24. package/dist/scheduling/helpers/intervalCovers.js +6 -6
  25. package/dist/scheduling/helpers/intervalIntersectsEnd.js +6 -6
  26. package/dist/scheduling/helpers/intervalIntersectsStart.js +6 -6
  27. package/dist/scheduling/helpers/intervalOnlyIntersectsEnd.js +6 -6
  28. package/dist/scheduling/helpers/intervalOnlyIntersectsStart.js +6 -6
  29. package/dist/scheduling/helpers/intervalOutside.js +6 -6
  30. package/dist/scheduling/helpers/intervalWithin.js +6 -6
  31. package/dist/scheduling/helpers/mergeIntervals.js +6 -6
  32. package/dist/scheduling/helpers/splitIntervals.js +6 -6
  33. package/dist/scheduling/strategies/getNext.js +2 -2
  34. package/dist/scheduling/strategies/getNextExactDateOfMonth.js +2 -2
  35. package/dist/scheduling/strategies/getNextLastDayOfMonth.js +2 -2
  36. package/dist/scheduling/strategies/getNextLastWeekdayOfMonth.js +2 -2
  37. package/dist/scheduling/strategies/getNextNoRepeat.js +2 -2
  38. package/dist/scheduling/strategies/getNextWeekday.js +2 -2
  39. package/dist/scheduling/strategies/getNextXDayOfXWeekOfMonth.js +2 -2
  40. package/dist/service-hours/__helpers__/calculate-hours.js +4 -4
  41. package/dist/service-hours/__helpers__/isOpen.js +2 -2
  42. package/dist/service-hours/schema.js +4 -4
  43. package/lib/constants.js +12 -6
  44. package/lib/constants.js.map +1 -1
  45. package/lib/errors/DomainError.js +14 -21
  46. package/lib/errors/DomainError.js.map +1 -1
  47. package/lib/errors/FetchImageError.js +17 -24
  48. package/lib/errors/FetchImageError.js.map +1 -1
  49. package/lib/errors/ValidationError.js +30 -36
  50. package/lib/errors/ValidationError.js.map +1 -1
  51. package/lib/errors/index.js +23 -5
  52. package/lib/errors/index.js.map +1 -1
  53. package/lib/helpers/build-fetch-url/index.js +43 -47
  54. package/lib/helpers/build-fetch-url/index.js.map +1 -1
  55. package/lib/helpers/fetch-image/index.js +83 -82
  56. package/lib/helpers/fetch-image/index.js.map +1 -1
  57. package/lib/helpers/fetch-image-for-pdf-generator-service/index.js +168 -243
  58. package/lib/helpers/fetch-image-for-pdf-generator-service/index.js.map +1 -1
  59. package/lib/helpers/fetch-image-for-web/index.js +71 -94
  60. package/lib/helpers/fetch-image-for-web/index.js.map +1 -1
  61. package/lib/helpers/fetch-lighthouse-logo/index.js +36 -61
  62. package/lib/helpers/fetch-lighthouse-logo/index.js.map +1 -1
  63. package/lib/helpers/floatify/index.js +13 -7
  64. package/lib/helpers/floatify/index.js.map +1 -1
  65. package/lib/helpers/get-assignees-full-names/index.js +11 -7
  66. package/lib/helpers/get-assignees-full-names/index.js.map +1 -1
  67. package/lib/helpers/get-audit-entry-details/index.js +42 -32
  68. package/lib/helpers/get-audit-entry-details/index.js.map +1 -1
  69. package/lib/helpers/get-audit-items-data/index.js +104 -83
  70. package/lib/helpers/get-audit-items-data/index.js.map +1 -1
  71. package/lib/helpers/get-geometry-geocoded-string/index.js +10 -5
  72. package/lib/helpers/get-geometry-geocoded-string/index.js.map +1 -1
  73. package/lib/helpers/get-issue-details/index.js +53 -43
  74. package/lib/helpers/get-issue-details/index.js.map +1 -1
  75. package/lib/helpers/get-job-details/index.js +49 -41
  76. package/lib/helpers/get-job-details/index.js.map +1 -1
  77. package/lib/helpers/get-location-reference/index.js +32 -34
  78. package/lib/helpers/get-location-reference/index.js.map +1 -1
  79. package/lib/helpers/get-pretty-duration/index.js +16 -10
  80. package/lib/helpers/get-pretty-duration/index.js.map +1 -1
  81. package/lib/helpers/get-reference-details/index.js +20 -10
  82. package/lib/helpers/get-reference-details/index.js.map +1 -1
  83. package/lib/helpers/get-status-details/index.js +8 -2
  84. package/lib/helpers/get-status-details/index.js.map +1 -1
  85. package/lib/helpers/get-task-entry-details/index.js +32 -23
  86. package/lib/helpers/get-task-entry-details/index.js.map +1 -1
  87. package/lib/helpers/get-timezone-abbr/index.js +11 -4
  88. package/lib/helpers/get-timezone-abbr/index.js.map +1 -1
  89. package/lib/helpers/get-timezone-datetime/index.js +20 -13
  90. package/lib/helpers/get-timezone-datetime/index.js.map +1 -1
  91. package/lib/helpers/get-user-full-name/index.js +9 -3
  92. package/lib/helpers/get-user-full-name/index.js.map +1 -1
  93. package/lib/helpers/get-value-as-percentage/index.js +9 -4
  94. package/lib/helpers/get-value-as-percentage/index.js.map +1 -1
  95. package/lib/helpers/image-validators/index.js +18 -12
  96. package/lib/helpers/image-validators/index.js.map +1 -1
  97. package/lib/helpers/index.js +130 -18
  98. package/lib/helpers/index.js.map +1 -1
  99. package/lib/helpers/validate-url/index.js +11 -5
  100. package/lib/helpers/validate-url/index.js.map +1 -1
  101. package/lib/images/index.js +10 -4
  102. package/lib/images/index.js.map +1 -1
  103. package/lib/index.js +66 -10
  104. package/lib/index.js.map +1 -1
  105. package/lib/pdf/activity-report/index.js +407 -537
  106. package/lib/pdf/activity-report/index.js.map +1 -1
  107. package/lib/pdf/audit/index.js +137 -134
  108. package/lib/pdf/audit/index.js.map +1 -1
  109. package/lib/pdf/fonts/index.js +4 -2
  110. package/lib/pdf/fonts/index.js.map +1 -1
  111. package/lib/pdf/helpers/build-audit-content/index.js +57 -51
  112. package/lib/pdf/helpers/build-audit-content/index.js.map +1 -1
  113. package/lib/pdf/helpers/build-audit-follow-ups/index.js +52 -50
  114. package/lib/pdf/helpers/build-audit-follow-ups/index.js.map +1 -1
  115. package/lib/pdf/helpers/build-location-scans-content/index.js +22 -16
  116. package/lib/pdf/helpers/build-location-scans-content/index.js.map +1 -1
  117. package/lib/pdf/helpers/build-template-content/index.js +52 -51
  118. package/lib/pdf/helpers/build-template-content/index.js.map +1 -1
  119. package/lib/pdf/helpers/default-footer/index.js +38 -35
  120. package/lib/pdf/helpers/default-footer/index.js.map +1 -1
  121. package/lib/pdf/helpers/default-header/index.js +40 -35
  122. package/lib/pdf/helpers/default-header/index.js.map +1 -1
  123. package/lib/pdf/helpers/default-styles/index.js +7 -1
  124. package/lib/pdf/helpers/default-styles/index.js.map +1 -1
  125. package/lib/pdf/helpers/fields/index.js +225 -214
  126. package/lib/pdf/helpers/fields/index.js.map +1 -1
  127. package/lib/pdf/helpers/format-location-address/index.js +14 -8
  128. package/lib/pdf/helpers/format-location-address/index.js.map +1 -1
  129. package/lib/pdf/helpers/generate-definition/index.js +60 -65
  130. package/lib/pdf/helpers/generate-definition/index.js.map +1 -1
  131. package/lib/pdf/helpers/horizontal-line/index.js +14 -14
  132. package/lib/pdf/helpers/horizontal-line/index.js.map +1 -1
  133. package/lib/pdf/helpers/html-transformer/index.js +45 -35
  134. package/lib/pdf/helpers/html-transformer/index.js.map +1 -1
  135. package/lib/pdf/helpers/index.js +194 -15
  136. package/lib/pdf/helpers/index.js.map +1 -1
  137. package/lib/pdf/helpers/parse-value/index.js +10 -4
  138. package/lib/pdf/helpers/parse-value/index.js.map +1 -1
  139. package/lib/pdf/helpers/table/index.js +136 -205
  140. package/lib/pdf/helpers/table/index.js.map +1 -1
  141. package/lib/pdf/helpers/text/index.js +11 -8
  142. package/lib/pdf/helpers/text/index.js.map +1 -1
  143. package/lib/pdf/icons/index.js +8 -2
  144. package/lib/pdf/icons/index.js.map +1 -1
  145. package/lib/pdf/index.js +47 -6
  146. package/lib/pdf/index.js.map +1 -1
  147. package/lib/pdf/issue/index.js +141 -135
  148. package/lib/pdf/issue/index.js.map +1 -1
  149. package/lib/pdf/job/index.js +95 -81
  150. package/lib/pdf/job/index.js.map +1 -1
  151. package/lib/pdf/shift-report/emptyFixtures.js +8 -2
  152. package/lib/pdf/shift-report/emptyFixtures.js.map +1 -1
  153. package/lib/pdf/shift-report/index.js +399 -521
  154. package/lib/pdf/shift-report/index.js.map +1 -1
  155. package/lib/pdf/task/index.js +89 -83
  156. package/lib/pdf/task/index.js.map +1 -1
  157. package/lib/scheduling/generators/index.js +38 -3
  158. package/lib/scheduling/generators/index.js.map +1 -1
  159. package/lib/scheduling/generators/occurrenceIntervalsGenerator.js +44 -37
  160. package/lib/scheduling/generators/occurrenceIntervalsGenerator.js.map +1 -1
  161. package/lib/scheduling/generators/scheduleIntervalsGenerator.js +20 -28
  162. package/lib/scheduling/generators/scheduleIntervalsGenerator.js.map +1 -1
  163. package/lib/scheduling/generators/serviceIntervalsGenerator.js +120 -150
  164. package/lib/scheduling/generators/serviceIntervalsGenerator.js.map +1 -1
  165. package/lib/scheduling/helpers/convertToTimezone.js +18 -11
  166. package/lib/scheduling/helpers/convertToTimezone.js.map +1 -1
  167. package/lib/scheduling/helpers/generateNonRepeatingSchedule.js +57 -95
  168. package/lib/scheduling/helpers/generateNonRepeatingSchedule.js.map +1 -1
  169. package/lib/scheduling/helpers/generateRepeatingSchedule.js +80 -119
  170. package/lib/scheduling/helpers/generateRepeatingSchedule.js.map +1 -1
  171. package/lib/scheduling/helpers/generateScheduleEnd.js +24 -14
  172. package/lib/scheduling/helpers/generateScheduleEnd.js.map +1 -1
  173. package/lib/scheduling/helpers/hasValidStartAndEnd.js +19 -11
  174. package/lib/scheduling/helpers/hasValidStartAndEnd.js.map +1 -1
  175. package/lib/scheduling/helpers/index.js +159 -14
  176. package/lib/scheduling/helpers/index.js.map +1 -1
  177. package/lib/scheduling/helpers/intervalCovers.js +13 -7
  178. package/lib/scheduling/helpers/intervalCovers.js.map +1 -1
  179. package/lib/scheduling/helpers/intervalIntersectsEnd.js +13 -7
  180. package/lib/scheduling/helpers/intervalIntersectsEnd.js.map +1 -1
  181. package/lib/scheduling/helpers/intervalIntersectsStart.js +13 -7
  182. package/lib/scheduling/helpers/intervalIntersectsStart.js.map +1 -1
  183. package/lib/scheduling/helpers/intervalOnlyIntersectsEnd.js +15 -10
  184. package/lib/scheduling/helpers/intervalOnlyIntersectsEnd.js.map +1 -1
  185. package/lib/scheduling/helpers/intervalOnlyIntersectsStart.js +15 -10
  186. package/lib/scheduling/helpers/intervalOnlyIntersectsStart.js.map +1 -1
  187. package/lib/scheduling/helpers/intervalOutside.js +15 -9
  188. package/lib/scheduling/helpers/intervalOutside.js.map +1 -1
  189. package/lib/scheduling/helpers/intervalWithin.js +13 -7
  190. package/lib/scheduling/helpers/intervalWithin.js.map +1 -1
  191. package/lib/scheduling/helpers/mergeIntervals.js +21 -17
  192. package/lib/scheduling/helpers/mergeIntervals.js.map +1 -1
  193. package/lib/scheduling/helpers/splitIntervals.js +24 -23
  194. package/lib/scheduling/helpers/splitIntervals.js.map +1 -1
  195. package/lib/scheduling/index.js +38 -3
  196. package/lib/scheduling/index.js.map +1 -1
  197. package/lib/scheduling/scheduling.types.js +9 -3
  198. package/lib/scheduling/scheduling.types.js.map +1 -1
  199. package/lib/scheduling/strategies/getNext.js +57 -63
  200. package/lib/scheduling/strategies/getNext.js.map +1 -1
  201. package/lib/scheduling/strategies/getNextExactDateOfMonth.js +47 -56
  202. package/lib/scheduling/strategies/getNextExactDateOfMonth.js.map +1 -1
  203. package/lib/scheduling/strategies/getNextLastDayOfMonth.js +43 -51
  204. package/lib/scheduling/strategies/getNextLastDayOfMonth.js.map +1 -1
  205. package/lib/scheduling/strategies/getNextLastWeekdayOfMonth.js +49 -56
  206. package/lib/scheduling/strategies/getNextLastWeekdayOfMonth.js.map +1 -1
  207. package/lib/scheduling/strategies/getNextNoRepeat.js +25 -36
  208. package/lib/scheduling/strategies/getNextNoRepeat.js.map +1 -1
  209. package/lib/scheduling/strategies/getNextWeekday.js +47 -79
  210. package/lib/scheduling/strategies/getNextWeekday.js.map +1 -1
  211. package/lib/scheduling/strategies/getNextXDayOfXWeekOfMonth.js +52 -58
  212. package/lib/scheduling/strategies/getNextXDayOfXWeekOfMonth.js.map +1 -1
  213. package/lib/scheduling/strategies/index.js +82 -7
  214. package/lib/scheduling/strategies/index.js.map +1 -1
  215. package/lib/schema/index.js +16 -1
  216. package/lib/schema/index.js.map +1 -1
  217. package/lib/schema/schema.js +28 -34
  218. package/lib/schema/schema.js.map +1 -1
  219. package/lib/service-hours/__helpers__/calculate-hours.js +24 -22
  220. package/lib/service-hours/__helpers__/calculate-hours.js.map +1 -1
  221. package/lib/service-hours/__helpers__/isOpen.js +25 -24
  222. package/lib/service-hours/__helpers__/isOpen.js.map +1 -1
  223. package/lib/service-hours/index.js +27 -2
  224. package/lib/service-hours/index.js.map +1 -1
  225. package/lib/service-hours/schema.js +68 -55
  226. package/lib/service-hours/schema.js.map +1 -1
  227. package/package.json +86 -86
  228. package/vitest.config.ts +23 -23
  229. package/vitest.setup.js +7 -7
@@ -1,203 +1,209 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- 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; }
4
- 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; }
5
- import { get, filter, isEmpty, map } from 'lodash';
6
- import moment from 'moment-timezone';
7
- import { buildTemplateContent, generateDefinition, getFormattedAddress, horizontalLine, table, text, threeColumnTable } from '../helpers';
8
- import { getIssueDetails, getStatusDetails, getTimezoneAbbr, getTimezoneDatetime } from '../../helpers';
1
+ "use strict";
9
2
 
10
- /**
11
- * buildIssuePdf
12
- *
13
- * @param {object} pdfOptions - the pdf options
14
- * @param {string} pdfOptions.fileTitle - pdf file title
15
- * @param {function} pdfOptions.footer - function executed to generate footer
16
- * @param {function} pdfOptions.header - function executed to generate header
17
- * @param {string} pdfOptions.logoUrl - pdf logo url
18
- * @param {array} pdfOptions.pageMargins - pdf page margins
19
- * @param {string} pdfOptions.pageOrientation - pdf page orientation
20
- * @param {string} pdfOptions.pageSize - pdf page size
21
- * @param {object} pdfOptions.styles - pdf styles
22
- * @param {object} pdfOptions.title - pdf title
23
- * @param {object} data - pdf data
24
- * @param {object} data.entity - issue document
25
- * @param {object} data.locations - locations documents
26
- * @param {object} data.settings - settings properties
27
- * @param {string} data.settings.awsS3BaseUrl - aws S3 base url
28
- * @param {string} data.settings.cloudfrontBaseUrl - cloudfront base url
29
- * @param {string} data.timezone - timezone string
30
- * @param {object} data.users - application user documents
31
- * @param {object} data.zones - zone documents
32
- * @returns {Promise} returns pdfmake definition object
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.buildIssuePdf = buildIssuePdf;
8
+ var _lodash = require("lodash");
9
+ var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
10
+ var _helpers = require("../helpers");
11
+ var _helpers2 = require("../../helpers");
12
+ /**
13
+ * buildIssuePdf
14
+ *
15
+ * @param {object} pdfOptions - the pdf options
16
+ * @param {string} pdfOptions.fileTitle - pdf file title
17
+ * @param {function} pdfOptions.footer - function executed to generate footer
18
+ * @param {function} pdfOptions.header - function executed to generate header
19
+ * @param {string} pdfOptions.logoUrl - pdf logo url
20
+ * @param {array} pdfOptions.pageMargins - pdf page margins
21
+ * @param {string} pdfOptions.pageOrientation - pdf page orientation
22
+ * @param {string} pdfOptions.pageSize - pdf page size
23
+ * @param {object} pdfOptions.styles - pdf styles
24
+ * @param {object} pdfOptions.title - pdf title
25
+ * @param {object} data - pdf data
26
+ * @param {object} data.entity - issue document
27
+ * @param {object} data.locations - locations documents
28
+ * @param {object} data.settings - settings properties
29
+ * @param {string} data.settings.awsS3BaseUrl - aws S3 base url
30
+ * @param {string} data.settings.cloudinaryBaseUrl - cloudinary base url
31
+ * @param {string} data.timezone - timezone string
32
+ * @param {object} data.users - application user documents
33
+ * @param {object} data.zones - zone documents
34
+ * @returns {Promise} returns pdfmake definition object
33
35
  */
34
36
 
35
- var publicSubmissionTextColor = '#FF8C2F';
36
- var internalSubmissionTextColor = '#00AAE4';
37
- export function buildIssuePdf(pdfOptions, data) {
38
- var entity = data.entity,
39
- timezone = data.timezone;
40
- var sequenceId = entity.sequenceId;
41
- var timestamp = entity.createdAt;
42
- var title = entity.title || 'Unknown';
43
- var fileTitle = "Issue Report - ".concat(title);
44
- return generateContent(data, pdfOptions).then(function (content) {
45
- return generateDefinition(_objectSpread({
46
- content: content,
47
- fileTitle: fileTitle,
48
- sequenceId: sequenceId,
49
- timestamp: timestamp,
50
- timezone: timezone,
51
- type: 'Issue'
52
- }, pdfOptions));
53
- });
37
+ const publicSubmissionTextColor = '#FF8C2F';
38
+ const internalSubmissionTextColor = '#00AAE4';
39
+ function buildIssuePdf(pdfOptions, data) {
40
+ const {
41
+ entity,
42
+ timezone
43
+ } = data;
44
+ const sequenceId = entity.sequenceId;
45
+ const timestamp = entity.createdAt;
46
+ const title = entity.title || 'Unknown';
47
+ const fileTitle = `Issue Report - ${title}`;
48
+ return generateContent(data, pdfOptions).then(content => (0, _helpers.generateDefinition)({
49
+ content,
50
+ fileTitle,
51
+ sequenceId,
52
+ timestamp,
53
+ timezone,
54
+ type: 'Issue',
55
+ ...pdfOptions
56
+ }));
54
57
  }
55
58
  function generateContent(data, pdfOptions) {
56
- var _plugins$publicForms;
57
- var entity = data.entity,
58
- timezone = data.timezone;
59
- var entry = entity.entry,
60
- _entity$gps = entity.gps,
61
- gps = _entity$gps === void 0 ? {} : _entity$gps,
62
- _entity$timeline = entity.timeline,
63
- timeline = _entity$timeline === void 0 ? [] : _entity$timeline,
64
- title = entity.title;
65
- var _pdfOptions$plugins = pdfOptions.plugins,
66
- plugins = _pdfOptions$plugins === void 0 ? {} : _pdfOptions$plugins;
67
- var entityDetails = getIssueDetails(data);
68
- var assigneeNames = entityDetails.assigneeNames,
69
- durationText = entityDetails.durationText,
70
- gpsText = entityDetails.gpsText,
71
- isPublicSubmission = entityDetails.isPublicSubmission,
72
- locationText = entityDetails.locationText,
73
- statusColor = entityDetails.statusColor,
74
- statusText = entityDetails.statusText;
75
- var reverseGeocoded = gps.reverseGeocoded;
76
- var subTitle = "".concat(locationText || gpsText);
77
- var headerTitle = text(title, {
59
+ const {
60
+ entity,
61
+ timezone
62
+ } = data;
63
+ const {
64
+ entry,
65
+ gps = {},
66
+ timeline = [],
67
+ title
68
+ } = entity;
69
+ const {
70
+ plugins = {}
71
+ } = pdfOptions;
72
+ const entityDetails = (0, _helpers2.getIssueDetails)(data);
73
+ const {
74
+ assigneeNames,
75
+ durationText,
76
+ gpsText,
77
+ isPublicSubmission,
78
+ locationText,
79
+ statusColor,
80
+ statusText
81
+ } = entityDetails;
82
+ const reverseGeocoded = gps.reverseGeocoded;
83
+ const subTitle = `${locationText || gpsText}`;
84
+ const headerTitle = (0, _helpers.text)(title, {
78
85
  style: 'title'
79
86
  });
80
- var headerSubTitle = text(subTitle, {
87
+ const headerSubTitle = (0, _helpers.text)(subTitle, {
81
88
  style: 'subTitle'
82
89
  });
83
- var address = !isEmpty(reverseGeocoded) ? getFormattedAddress(reverseGeocoded) : '';
84
- var headerAddress = text(address, {
90
+ const address = !(0, _lodash.isEmpty)(reverseGeocoded) ? (0, _helpers.getFormattedAddress)(reverseGeocoded) : '';
91
+ const headerAddress = (0, _helpers.text)(address, {
85
92
  style: 'small'
86
93
  });
87
- var body = !isEmpty(reverseGeocoded) ? [[headerTitle], [headerSubTitle], [headerAddress]] : [[headerTitle], [headerSubTitle]];
88
- var submittedAtInTimezone = entity.submittedAt ? moment(entity.submittedAt).tz(timezone).format('YYYY-MM-DD HH:mm:ss z') : 'Not recorded';
89
- var submittedAt = text("Submitted: ".concat(submittedAtInTimezone), {
94
+ const body = !(0, _lodash.isEmpty)(reverseGeocoded) ? [[headerTitle], [headerSubTitle], [headerAddress]] : [[headerTitle], [headerSubTitle]];
95
+ const submittedAtInTimezone = entity.submittedAt ? (0, _momentTimezone.default)(entity.submittedAt).tz(timezone).format('YYYY-MM-DD HH:mm:ss z') : 'Not recorded';
96
+ const submittedAt = (0, _helpers.text)(`Submitted: ${submittedAtInTimezone}`, {
90
97
  style: 'small'
91
98
  });
92
99
  if (entity.showSimplifiedDuration) {
93
100
  body.push([submittedAt]);
94
101
  } else {
95
- var startedAtInTimezone = entity.startedAt ? moment(entity.startedAt).tz(timezone).format('YYYY-MM-DD HH:mm:ss z') : 'Not recorded';
96
- var startedAt = text("Started: ".concat(startedAtInTimezone), {
102
+ const startedAtInTimezone = entity.startedAt ? (0, _momentTimezone.default)(entity.startedAt).tz(timezone).format('YYYY-MM-DD HH:mm:ss z') : 'Not recorded';
103
+ const startedAt = (0, _helpers.text)(`Started: ${startedAtInTimezone}`, {
97
104
  style: 'small'
98
105
  });
99
- var momentDuration = moment.duration(Math.abs(entity.formDuration));
100
- var days = Math.floor(momentDuration.asDays()).toString().padStart(2, '0');
101
- var hours = Math.floor(momentDuration.hours()).toString().padStart(2, '0');
102
- var minutes = momentDuration.minutes().toString().padStart(2, '0');
103
- var seconds = momentDuration.seconds().toString().padStart(2, '0');
104
- var formattedFormDuration = entity.formDuration ? "".concat(entity.formDuration < 0 ? '-' : '').concat(days, ":").concat(hours, ":").concat(minutes, ":").concat(seconds) : 'Not recorded';
105
- var formDuration = text("Form Duration (DD:HH:MM:SS): ".concat(formattedFormDuration), {
106
+ const momentDuration = _momentTimezone.default.duration(Math.abs(entity.formDuration));
107
+ const days = Math.floor(momentDuration.asDays()).toString().padStart(2, '0');
108
+ const hours = Math.floor(momentDuration.hours()).toString().padStart(2, '0');
109
+ const minutes = momentDuration.minutes().toString().padStart(2, '0');
110
+ const seconds = momentDuration.seconds().toString().padStart(2, '0');
111
+ const formattedFormDuration = entity.formDuration ? `${entity.formDuration < 0 ? '-' : ''}${days}:${hours}:${minutes}:${seconds}` : 'Not recorded';
112
+ const formDuration = (0, _helpers.text)(`Form Duration (DD:HH:MM:SS): ${formattedFormDuration}`, {
106
113
  style: 'small'
107
114
  });
108
115
  body.push([startedAt]);
109
116
  body.push([submittedAt]);
110
117
  body.push([formDuration]);
111
118
  }
112
- var titleTable = table({
113
- body: body,
119
+ const titleTable = (0, _helpers.table)({
120
+ body,
114
121
  layout: 'noBorders',
115
122
  style: 'titleTable'
116
123
  });
117
- var statusLabelText = text('Status', {
124
+ const statusLabelText = (0, _helpers.text)('Status', {
118
125
  bold: true
119
126
  });
120
- var statusValueText = text(statusText, {
127
+ const statusValueText = (0, _helpers.text)(statusText, {
121
128
  color: statusColor
122
129
  });
123
- var metaTable = table({
130
+ const metaTable = (0, _helpers.table)({
124
131
  body: [[statusLabelText, statusValueText]],
125
132
  layout: 'noBorders',
126
133
  style: 'metaTable'
127
134
  });
128
135
  if (statusText === 'CLOSED') {
129
- var durationLabelText = text('Duration', {
136
+ const durationLabelText = (0, _helpers.text)('Duration', {
130
137
  bold: true
131
138
  });
132
- var durationValueText = text(durationText);
139
+ const durationValueText = (0, _helpers.text)(durationText);
133
140
  metaTable.table.body.push([durationLabelText, durationValueText]);
134
141
  }
135
- var assigneeLabelText = text('Assignees', {
142
+ const assigneeLabelText = (0, _helpers.text)('Assignees', {
136
143
  bold: true
137
144
  });
138
- var assigneeValueText = text(assigneeNames);
145
+ const assigneeValueText = (0, _helpers.text)(assigneeNames);
139
146
  metaTable.table.body.push([assigneeLabelText, assigneeValueText]);
140
- if ((_plugins$publicForms = plugins.publicForms) !== null && _plugins$publicForms !== void 0 && _plugins$publicForms.enabled) {
141
- var sourceText = isPublicSubmission ? 'PUBLIC SUBMISSION' : 'INTERNAL SUBMISSION';
142
- var sourceColor = isPublicSubmission ? publicSubmissionTextColor : internalSubmissionTextColor;
143
- var sourceLabelText = text('Source', {
147
+ if (plugins.publicForms?.enabled) {
148
+ const sourceText = isPublicSubmission ? 'PUBLIC SUBMISSION' : 'INTERNAL SUBMISSION';
149
+ const sourceColor = isPublicSubmission ? publicSubmissionTextColor : internalSubmissionTextColor;
150
+ const sourceLabelText = (0, _helpers.text)('Source', {
144
151
  bold: true
145
152
  });
146
- var sourceValueText = text(sourceText, {
153
+ const sourceValueText = (0, _helpers.text)(sourceText, {
147
154
  color: sourceColor
148
155
  });
149
156
  metaTable.table.body.push([sourceLabelText, sourceValueText]);
150
157
  }
151
- var timelineTitle = text('Timeline', {
158
+ const timelineTitle = (0, _helpers.text)('Timeline', {
152
159
  style: 'timelineTitle'
153
160
  });
154
- var timelineHorizontalLine = horizontalLine();
155
- var timelineTable = createTimelineTable(timeline, timezone);
156
- return buildTemplateContent(entry.formGroups, data).then(function (entry) {
157
- return [titleTable, metaTable, timelineTitle, timelineHorizontalLine, timelineTable].concat(_toConsumableArray(entry));
158
- });
161
+ const timelineHorizontalLine = (0, _helpers.horizontalLine)();
162
+ const timelineTable = createTimelineTable(timeline, timezone);
163
+ return (0, _helpers.buildTemplateContent)(entry.formGroups, data).then(entry => [titleTable, metaTable, timelineTitle, timelineHorizontalLine, timelineTable, ...entry]);
159
164
  }
160
165
  function createTimelineTable(timeline, timezone) {
161
- var timezoneAbbr = getTimezoneAbbr(timezone);
162
- var timelineHeaderRow = [text('Activity', {
166
+ const timezoneAbbr = (0, _helpers2.getTimezoneAbbr)(timezone);
167
+ const timelineHeaderRow = [(0, _helpers.text)('Activity', {
163
168
  bold: true
164
- }), text('User', {
169
+ }), (0, _helpers.text)('User', {
165
170
  bold: true
166
- }), text("Date & Timestamp (".concat(timezoneAbbr, ")"), {
171
+ }), (0, _helpers.text)(`Date & Timestamp (${timezoneAbbr})`, {
167
172
  alignment: 'right',
168
173
  bold: true
169
174
  })];
170
- var statusUpdates = filter(timeline, ['meta.field', 'status']);
171
- var timelineBodyRows = isEmpty(statusUpdates) ? [text('No Timeline activity', {
175
+ const statusUpdates = (0, _lodash.filter)(timeline, ['meta.field', 'status']);
176
+ const timelineBodyRows = (0, _lodash.isEmpty)(statusUpdates) ? [(0, _helpers.text)('No Timeline activity', {
172
177
  colSpan: 3
173
- })] : map(statusUpdates, function (item) {
174
- var _item$meta = item.meta,
175
- meta = _item$meta === void 0 ? {} : _item$meta,
176
- source = item.source,
177
- timestamp = item.timestamp,
178
- type = item.type;
179
- var next = get(meta, 'next');
180
- var firstName = get(source, 'meta.firstName');
181
- var lastName = get(source, 'meta.lastName');
182
- var fullName = firstName && lastName ? "".concat(firstName, " ").concat(lastName) : 'Unknown User';
183
- var isNew = type === 'issue-new';
184
- var isUpdate = type === 'issue-update';
185
- var isOpen = next === 'open';
186
- var statusDetails = getStatusDetails(next);
187
- var nextStatusText = statusDetails.text;
188
- var activity = isNew && isOpen ? 'Issue opened' : isNew && !isOpen ? "Issue opened with status ".concat(nextStatusText) : isUpdate ? "Issue updated to ".concat(nextStatusText) : 'Unknown status timeline change';
189
- var datetime = getTimezoneDatetime({
178
+ })] : (0, _lodash.map)(statusUpdates, item => {
179
+ const {
180
+ meta = {},
181
+ source,
182
+ timestamp,
183
+ type
184
+ } = item;
185
+ const next = (0, _lodash.get)(meta, 'next');
186
+ const firstName = (0, _lodash.get)(source, 'meta.firstName');
187
+ const lastName = (0, _lodash.get)(source, 'meta.lastName');
188
+ const fullName = firstName && lastName ? `${firstName} ${lastName}` : 'Unknown User';
189
+ const isNew = type === 'issue-new';
190
+ const isUpdate = type === 'issue-update';
191
+ const isOpen = next === 'open';
192
+ const statusDetails = (0, _helpers2.getStatusDetails)(next);
193
+ const nextStatusText = statusDetails.text;
194
+ const activity = isNew && isOpen ? 'Issue opened' : isNew && !isOpen ? `Issue opened with status ${nextStatusText}` : isUpdate ? `Issue updated to ${nextStatusText}` : 'Unknown status timeline change';
195
+ const datetime = (0, _helpers2.getTimezoneDatetime)({
190
196
  format: 'ddd, MMM D h:mm:ssa z',
191
197
  showTzAbbr: false,
192
- timestamp: timestamp,
193
- timezone: timezone
198
+ timestamp,
199
+ timezone
194
200
  });
195
- return [text(activity), text(fullName), text(datetime, {
201
+ return [(0, _helpers.text)(activity), (0, _helpers.text)(fullName), (0, _helpers.text)(datetime, {
196
202
  alignment: 'right'
197
203
  })];
198
204
  });
199
- var timelineTable = threeColumnTable({
200
- body: [timelineHeaderRow].concat(_toConsumableArray(timelineBodyRows))
205
+ const timelineTable = (0, _helpers.threeColumnTable)({
206
+ body: [timelineHeaderRow, ...timelineBodyRows]
201
207
  });
202
208
  return timelineTable;
203
209
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["get","filter","isEmpty","map","moment","buildTemplateContent","generateDefinition","getFormattedAddress","horizontalLine","table","text","threeColumnTable","getIssueDetails","getStatusDetails","getTimezoneAbbr","getTimezoneDatetime","publicSubmissionTextColor","internalSubmissionTextColor","buildIssuePdf","pdfOptions","data","entity","timezone","sequenceId","timestamp","createdAt","title","fileTitle","concat","generateContent","then","content","_objectSpread","type","_plugins$publicForms","entry","_entity$gps","gps","_entity$timeline","timeline","_pdfOptions$plugins","plugins","entityDetails","assigneeNames","durationText","gpsText","isPublicSubmission","locationText","statusColor","statusText","reverseGeocoded","subTitle","headerTitle","style","headerSubTitle","address","headerAddress","body","submittedAtInTimezone","submittedAt","tz","format","showSimplifiedDuration","push","startedAtInTimezone","startedAt","momentDuration","duration","Math","abs","formDuration","days","floor","asDays","toString","padStart","hours","minutes","seconds","formattedFormDuration","titleTable","layout","statusLabelText","bold","statusValueText","color","metaTable","durationLabelText","durationValueText","assigneeLabelText","assigneeValueText","publicForms","enabled","sourceText","sourceColor","sourceLabelText","sourceValueText","timelineTitle","timelineHorizontalLine","timelineTable","createTimelineTable","formGroups","_toConsumableArray","timezoneAbbr","timelineHeaderRow","alignment","statusUpdates","timelineBodyRows","colSpan","item","_item$meta","meta","source","next","firstName","lastName","fullName","isNew","isUpdate","isOpen","statusDetails","nextStatusText","activity","datetime","showTzAbbr"],"sources":["../../../src/pdf/issue/index.js"],"sourcesContent":["import { get, filter, isEmpty, map } from 'lodash'\nimport moment from 'moment-timezone'\n\nimport {\n buildTemplateContent,\n generateDefinition,\n getFormattedAddress,\n horizontalLine,\n table,\n text,\n threeColumnTable,\n} from '../helpers'\n\nimport {\n getIssueDetails,\n getStatusDetails,\n getTimezoneAbbr,\n getTimezoneDatetime,\n} from '../../helpers'\n\n/**\n * buildIssuePdf\n *\n * @param {object} pdfOptions - the pdf options\n * @param {string} pdfOptions.fileTitle - pdf file title\n * @param {function} pdfOptions.footer - function executed to generate footer\n * @param {function} pdfOptions.header - function executed to generate header\n * @param {string} pdfOptions.logoUrl - pdf logo url\n * @param {array} pdfOptions.pageMargins - pdf page margins\n * @param {string} pdfOptions.pageOrientation - pdf page orientation\n * @param {string} pdfOptions.pageSize - pdf page size\n * @param {object} pdfOptions.styles - pdf styles\n * @param {object} pdfOptions.title - pdf title\n * @param {object} data - pdf data\n * @param {object} data.entity - issue document\n * @param {object} data.locations - locations documents\n * @param {object} data.settings - settings properties\n * @param {string} data.settings.awsS3BaseUrl - aws S3 base url\n * @param {string} data.settings.cloudfrontBaseUrl - cloudfront base url\n * @param {string} data.timezone - timezone string\n * @param {object} data.users - application user documents\n * @param {object} data.zones - zone documents\n * @returns {Promise} returns pdfmake definition object\n */\n\nconst publicSubmissionTextColor = '#FF8C2F'\nconst internalSubmissionTextColor = '#00AAE4'\n\nexport function buildIssuePdf(pdfOptions, data) {\n const { entity, timezone } = data\n\n const sequenceId = entity.sequenceId\n const timestamp = entity.createdAt\n const title = entity.title || 'Unknown'\n\n const fileTitle = `Issue Report - ${title}`\n\n return generateContent(data, pdfOptions).then((content) =>\n generateDefinition({\n content,\n fileTitle,\n sequenceId,\n timestamp,\n timezone,\n type: 'Issue',\n ...pdfOptions,\n })\n )\n}\n\nfunction generateContent(data, pdfOptions) {\n const { entity, timezone } = data\n const { entry, gps = {}, timeline = [], title } = entity\n const { plugins = {} } = pdfOptions\n\n const entityDetails = getIssueDetails(data)\n\n const {\n assigneeNames,\n durationText,\n gpsText,\n isPublicSubmission,\n locationText,\n statusColor,\n statusText,\n } = entityDetails\n\n const reverseGeocoded = gps.reverseGeocoded\n\n const subTitle = `${locationText || gpsText}`\n const headerTitle = text(title, { style: 'title' })\n const headerSubTitle = text(subTitle, { style: 'subTitle' })\n const address = !isEmpty(reverseGeocoded)\n ? getFormattedAddress(reverseGeocoded)\n : ''\n const headerAddress = text(address, { style: 'small' })\n\n const body = !isEmpty(reverseGeocoded)\n ? [[headerTitle], [headerSubTitle], [headerAddress]]\n : [[headerTitle], [headerSubTitle]]\n\n const submittedAtInTimezone = entity.submittedAt\n ? moment(entity.submittedAt).tz(timezone).format('YYYY-MM-DD HH:mm:ss z')\n : 'Not recorded'\n const submittedAt = text(`Submitted: ${submittedAtInTimezone}`, {\n style: 'small',\n })\n\n if (entity.showSimplifiedDuration) {\n body.push([submittedAt])\n } else {\n const startedAtInTimezone = entity.startedAt\n ? moment(entity.startedAt).tz(timezone).format('YYYY-MM-DD HH:mm:ss z')\n : 'Not recorded'\n const startedAt = text(`Started: ${startedAtInTimezone}`, {\n style: 'small',\n })\n\n const momentDuration = moment.duration(Math.abs(entity.formDuration))\n const days = Math.floor(momentDuration.asDays()).toString().padStart(2, '0')\n const hours = Math.floor(momentDuration.hours()).toString().padStart(2, '0')\n const minutes = momentDuration.minutes().toString().padStart(2, '0')\n const seconds = momentDuration.seconds().toString().padStart(2, '0')\n const formattedFormDuration = entity.formDuration\n ? `${\n entity.formDuration < 0 ? '-' : ''\n }${days}:${hours}:${minutes}:${seconds}`\n : 'Not recorded'\n const formDuration = text(\n `Form Duration (DD:HH:MM:SS): ${formattedFormDuration}`,\n {\n style: 'small',\n }\n )\n\n body.push([startedAt])\n body.push([submittedAt])\n body.push([formDuration])\n }\n\n const titleTable = table({\n body,\n layout: 'noBorders',\n style: 'titleTable',\n })\n\n const statusLabelText = text('Status', { bold: true })\n const statusValueText = text(statusText, { color: statusColor })\n\n const metaTable = table({\n body: [[statusLabelText, statusValueText]],\n layout: 'noBorders',\n style: 'metaTable',\n })\n\n if (statusText === 'CLOSED') {\n const durationLabelText = text('Duration', { bold: true })\n const durationValueText = text(durationText)\n metaTable.table.body.push([durationLabelText, durationValueText])\n }\n\n const assigneeLabelText = text('Assignees', { bold: true })\n const assigneeValueText = text(assigneeNames)\n metaTable.table.body.push([assigneeLabelText, assigneeValueText])\n\n if (plugins.publicForms?.enabled) {\n const sourceText = isPublicSubmission\n ? 'PUBLIC SUBMISSION'\n : 'INTERNAL SUBMISSION'\n\n const sourceColor = isPublicSubmission\n ? publicSubmissionTextColor\n : internalSubmissionTextColor\n const sourceLabelText = text('Source', { bold: true })\n const sourceValueText = text(sourceText, { color: sourceColor })\n metaTable.table.body.push([sourceLabelText, sourceValueText])\n }\n\n const timelineTitle = text('Timeline', { style: 'timelineTitle' })\n const timelineHorizontalLine = horizontalLine()\n const timelineTable = createTimelineTable(timeline, timezone)\n\n return buildTemplateContent(entry.formGroups, data).then((entry) => [\n titleTable,\n metaTable,\n timelineTitle,\n timelineHorizontalLine,\n timelineTable,\n ...entry,\n ])\n}\n\nfunction createTimelineTable(timeline, timezone) {\n const timezoneAbbr = getTimezoneAbbr(timezone)\n\n const timelineHeaderRow = [\n text('Activity', { bold: true }),\n text('User', { bold: true }),\n text(`Date & Timestamp (${timezoneAbbr})`, {\n alignment: 'right',\n bold: true,\n }),\n ]\n\n const statusUpdates = filter(timeline, ['meta.field', 'status'])\n\n const timelineBodyRows = isEmpty(statusUpdates)\n ? [text('No Timeline activity', { colSpan: 3 })]\n : map(statusUpdates, (item) => {\n const { meta = {}, source, timestamp, type } = item\n\n const next = get(meta, 'next')\n const firstName = get(source, 'meta.firstName')\n const lastName = get(source, 'meta.lastName')\n\n const fullName =\n firstName && lastName ? `${firstName} ${lastName}` : 'Unknown User'\n\n const isNew = type === 'issue-new'\n const isUpdate = type === 'issue-update'\n const isOpen = next === 'open'\n\n const statusDetails = getStatusDetails(next)\n const nextStatusText = statusDetails.text\n\n const activity =\n isNew && isOpen\n ? 'Issue opened'\n : isNew && !isOpen\n ? `Issue opened with status ${nextStatusText}`\n : isUpdate\n ? `Issue updated to ${nextStatusText}`\n : 'Unknown status timeline change'\n\n const datetime = getTimezoneDatetime({\n format: 'ddd, MMM D h:mm:ssa z',\n showTzAbbr: false,\n timestamp,\n timezone,\n })\n\n return [\n text(activity),\n text(fullName),\n text(datetime, { alignment: 'right' }),\n ]\n })\n\n const timelineTable = threeColumnTable({\n body: [timelineHeaderRow, ...timelineBodyRows],\n })\n\n return timelineTable\n}\n"],"mappings":";;;;AAAA,SAASA,GAAG,EAAEC,MAAM,EAAEC,OAAO,EAAEC,GAAG,QAAQ,QAAQ;AAClD,OAAOC,MAAM,MAAM,iBAAiB;AAEpC,SACEC,oBAAoB,EACpBC,kBAAkB,EAClBC,mBAAmB,EACnBC,cAAc,EACdC,KAAK,EACLC,IAAI,EACJC,gBAAgB,Q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,aAAa;AACtB","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_lodash","require","_momentTimezone","_interopRequireDefault","_helpers","_helpers2","publicSubmissionTextColor","internalSubmissionTextColor","buildIssuePdf","pdfOptions","data","entity","timezone","sequenceId","timestamp","createdAt","title","fileTitle","generateContent","then","content","generateDefinition","type","entry","gps","timeline","plugins","entityDetails","getIssueDetails","assigneeNames","durationText","gpsText","isPublicSubmission","locationText","statusColor","statusText","reverseGeocoded","subTitle","headerTitle","text","style","headerSubTitle","address","isEmpty","getFormattedAddress","headerAddress","body","submittedAtInTimezone","submittedAt","moment","tz","format","showSimplifiedDuration","push","startedAtInTimezone","startedAt","momentDuration","duration","Math","abs","formDuration","days","floor","asDays","toString","padStart","hours","minutes","seconds","formattedFormDuration","titleTable","table","layout","statusLabelText","bold","statusValueText","color","metaTable","durationLabelText","durationValueText","assigneeLabelText","assigneeValueText","publicForms","enabled","sourceText","sourceColor","sourceLabelText","sourceValueText","timelineTitle","timelineHorizontalLine","horizontalLine","timelineTable","createTimelineTable","buildTemplateContent","formGroups","timezoneAbbr","getTimezoneAbbr","timelineHeaderRow","alignment","statusUpdates","filter","timelineBodyRows","colSpan","map","item","meta","source","next","get","firstName","lastName","fullName","isNew","isUpdate","isOpen","statusDetails","getStatusDetails","nextStatusText","activity","datetime","getTimezoneDatetime","showTzAbbr","threeColumnTable"],"sources":["../../../src/pdf/issue/index.js"],"sourcesContent":["import { get, filter, isEmpty, map } from 'lodash'\r\nimport moment from 'moment-timezone'\r\n\r\nimport {\r\n buildTemplateContent,\r\n generateDefinition,\r\n getFormattedAddress,\r\n horizontalLine,\r\n table,\r\n text,\r\n threeColumnTable,\r\n} from '../helpers'\r\n\r\nimport {\r\n getIssueDetails,\r\n getStatusDetails,\r\n getTimezoneAbbr,\r\n getTimezoneDatetime,\r\n} from '../../helpers'\r\n\r\n/**\r\n * buildIssuePdf\r\n *\r\n * @param {object} pdfOptions - the pdf options\r\n * @param {string} pdfOptions.fileTitle - pdf file title\r\n * @param {function} pdfOptions.footer - function executed to generate footer\r\n * @param {function} pdfOptions.header - function executed to generate header\r\n * @param {string} pdfOptions.logoUrl - pdf logo url\r\n * @param {array} pdfOptions.pageMargins - pdf page margins\r\n * @param {string} pdfOptions.pageOrientation - pdf page orientation\r\n * @param {string} pdfOptions.pageSize - pdf page size\r\n * @param {object} pdfOptions.styles - pdf styles\r\n * @param {object} pdfOptions.title - pdf title\r\n * @param {object} data - pdf data\r\n * @param {object} data.entity - issue document\r\n * @param {object} data.locations - locations documents\r\n * @param {object} data.settings - settings properties\r\n * @param {string} data.settings.awsS3BaseUrl - aws S3 base url\r\n * @param {string} data.settings.cloudinaryBaseUrl - cloudinary base url\r\n * @param {string} data.timezone - timezone string\r\n * @param {object} data.users - application user documents\r\n * @param {object} data.zones - zone documents\r\n * @returns {Promise} returns pdfmake definition object\r\n */\r\n\r\nconst publicSubmissionTextColor = '#FF8C2F'\r\nconst internalSubmissionTextColor = '#00AAE4'\r\n\r\nexport function buildIssuePdf(pdfOptions, data) {\r\n const { entity, timezone } = data\r\n\r\n const sequenceId = entity.sequenceId\r\n const timestamp = entity.createdAt\r\n const title = entity.title || 'Unknown'\r\n\r\n const fileTitle = `Issue Report - ${title}`\r\n\r\n return generateContent(data, pdfOptions).then((content) =>\r\n generateDefinition({\r\n content,\r\n fileTitle,\r\n sequenceId,\r\n timestamp,\r\n timezone,\r\n type: 'Issue',\r\n ...pdfOptions,\r\n })\r\n )\r\n}\r\n\r\nfunction generateContent(data, pdfOptions) {\r\n const { entity, timezone } = data\r\n const { entry, gps = {}, timeline = [], title } = entity\r\n const { plugins = {} } = pdfOptions\r\n\r\n const entityDetails = getIssueDetails(data)\r\n\r\n const {\r\n assigneeNames,\r\n durationText,\r\n gpsText,\r\n isPublicSubmission,\r\n locationText,\r\n statusColor,\r\n statusText,\r\n } = entityDetails\r\n\r\n const reverseGeocoded = gps.reverseGeocoded\r\n\r\n const subTitle = `${locationText || gpsText}`\r\n const headerTitle = text(title, { style: 'title' })\r\n const headerSubTitle = text(subTitle, { style: 'subTitle' })\r\n const address = !isEmpty(reverseGeocoded)\r\n ? getFormattedAddress(reverseGeocoded)\r\n : ''\r\n const headerAddress = text(address, { style: 'small' })\r\n\r\n const body = !isEmpty(reverseGeocoded)\r\n ? [[headerTitle], [headerSubTitle], [headerAddress]]\r\n : [[headerTitle], [headerSubTitle]]\r\n\r\n const submittedAtInTimezone = entity.submittedAt\r\n ? moment(entity.submittedAt).tz(timezone).format('YYYY-MM-DD HH:mm:ss z')\r\n : 'Not recorded'\r\n const submittedAt = text(`Submitted: ${submittedAtInTimezone}`, {\r\n style: 'small',\r\n })\r\n\r\n if (entity.showSimplifiedDuration) {\r\n body.push([submittedAt])\r\n } else {\r\n const startedAtInTimezone = entity.startedAt\r\n ? moment(entity.startedAt).tz(timezone).format('YYYY-MM-DD HH:mm:ss z')\r\n : 'Not recorded'\r\n const startedAt = text(`Started: ${startedAtInTimezone}`, {\r\n style: 'small',\r\n })\r\n\r\n const momentDuration = moment.duration(Math.abs(entity.formDuration))\r\n const days = Math.floor(momentDuration.asDays()).toString().padStart(2, '0')\r\n const hours = Math.floor(momentDuration.hours()).toString().padStart(2, '0')\r\n const minutes = momentDuration.minutes().toString().padStart(2, '0')\r\n const seconds = momentDuration.seconds().toString().padStart(2, '0')\r\n const formattedFormDuration = entity.formDuration\r\n ? `${\r\n entity.formDuration < 0 ? '-' : ''\r\n }${days}:${hours}:${minutes}:${seconds}`\r\n : 'Not recorded'\r\n const formDuration = text(\r\n `Form Duration (DD:HH:MM:SS): ${formattedFormDuration}`,\r\n {\r\n style: 'small',\r\n }\r\n )\r\n\r\n body.push([startedAt])\r\n body.push([submittedAt])\r\n body.push([formDuration])\r\n }\r\n\r\n const titleTable = table({\r\n body,\r\n layout: 'noBorders',\r\n style: 'titleTable',\r\n })\r\n\r\n const statusLabelText = text('Status', { bold: true })\r\n const statusValueText = text(statusText, { color: statusColor })\r\n\r\n const metaTable = table({\r\n body: [[statusLabelText, statusValueText]],\r\n layout: 'noBorders',\r\n style: 'metaTable',\r\n })\r\n\r\n if (statusText === 'CLOSED') {\r\n const durationLabelText = text('Duration', { bold: true })\r\n const durationValueText = text(durationText)\r\n metaTable.table.body.push([durationLabelText, durationValueText])\r\n }\r\n\r\n const assigneeLabelText = text('Assignees', { bold: true })\r\n const assigneeValueText = text(assigneeNames)\r\n metaTable.table.body.push([assigneeLabelText, assigneeValueText])\r\n\r\n if (plugins.publicForms?.enabled) {\r\n const sourceText = isPublicSubmission\r\n ? 'PUBLIC SUBMISSION'\r\n : 'INTERNAL SUBMISSION'\r\n\r\n const sourceColor = isPublicSubmission\r\n ? publicSubmissionTextColor\r\n : internalSubmissionTextColor\r\n const sourceLabelText = text('Source', { bold: true })\r\n const sourceValueText = text(sourceText, { color: sourceColor })\r\n metaTable.table.body.push([sourceLabelText, sourceValueText])\r\n }\r\n\r\n const timelineTitle = text('Timeline', { style: 'timelineTitle' })\r\n const timelineHorizontalLine = horizontalLine()\r\n const timelineTable = createTimelineTable(timeline, timezone)\r\n\r\n return buildTemplateContent(entry.formGroups, data).then((entry) => [\r\n titleTable,\r\n metaTable,\r\n timelineTitle,\r\n timelineHorizontalLine,\r\n timelineTable,\r\n ...entry,\r\n ])\r\n}\r\n\r\nfunction createTimelineTable(timeline, timezone) {\r\n const timezoneAbbr = getTimezoneAbbr(timezone)\r\n\r\n const timelineHeaderRow = [\r\n text('Activity', { bold: true }),\r\n text('User', { bold: true }),\r\n text(`Date & Timestamp (${timezoneAbbr})`, {\r\n alignment: 'right',\r\n bold: true,\r\n }),\r\n ]\r\n\r\n const statusUpdates = filter(timeline, ['meta.field', 'status'])\r\n\r\n const timelineBodyRows = isEmpty(statusUpdates)\r\n ? [text('No Timeline activity', { colSpan: 3 })]\r\n : map(statusUpdates, (item) => {\r\n const { meta = {}, source, timestamp, type } = item\r\n\r\n const next = get(meta, 'next')\r\n const firstName = get(source, 'meta.firstName')\r\n const lastName = get(source, 'meta.lastName')\r\n\r\n const fullName =\r\n firstName && lastName ? `${firstName} ${lastName}` : 'Unknown User'\r\n\r\n const isNew = type === 'issue-new'\r\n const isUpdate = type === 'issue-update'\r\n const isOpen = next === 'open'\r\n\r\n const statusDetails = getStatusDetails(next)\r\n const nextStatusText = statusDetails.text\r\n\r\n const activity =\r\n isNew && isOpen\r\n ? 'Issue opened'\r\n : isNew && !isOpen\r\n ? `Issue opened with status ${nextStatusText}`\r\n : isUpdate\r\n ? `Issue updated to ${nextStatusText}`\r\n : 'Unknown status timeline change'\r\n\r\n const datetime = getTimezoneDatetime({\r\n format: 'ddd, MMM D h:mm:ssa z',\r\n showTzAbbr: false,\r\n timestamp,\r\n timezone,\r\n })\r\n\r\n return [\r\n text(activity),\r\n text(fullName),\r\n text(datetime, { alignment: 'right' }),\r\n ]\r\n })\r\n\r\n const timelineTable = threeColumnTable({\r\n body: [timelineHeaderRow, ...timelineBodyRows],\r\n })\r\n\r\n return timelineTable\r\n}\r\n"],"mappings":";;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAH,OAAA;AAUA,IAAAI,SAAA,GAAAJ,OAAA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMK,yBAAyB,GAAG,SAAS;AAC3C,MAAMC,2BAA2B,GAAG,SAAS;AAEtC,SAASC,aAAaA,CAACC,UAAU,EAAEC,IAAI,EAAE;EAC9C,MAAM;IAAEC,MAAM;IAAEC;EAAS,CAAC,GAAGF,IAAI;EAEjC,MAAMG,UAAU,GAAGF,MAAM,CAACE,UAAU;EACpC,MAAMC,SAAS,GAAGH,MAAM,CAACI,SAAS;EAClC,MAAMC,KAAK,GAAGL,MAAM,CAACK,KAAK,IAAI,SAAS;EAEvC,MAAMC,SAAS,GAAG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