@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,42 +1,42 @@
1
- import { compact, get, isArray, isPlainObject, reduce } from 'lodash';
2
- export function getLocationReference() {
3
- var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4
- var _data$areaLabelPath = data.areaLabelPath,
5
- areaLabelPath = _data$areaLabelPath === void 0 ? 'area.label' : _data$areaLabelPath,
6
- _data$areaLocations = data.areaLocations,
7
- areaLocations = _data$areaLocations === void 0 ? {} : _data$areaLocations,
8
- _data$geocodedLabelPa = data.geocodedLabelPath,
9
- geocodedLabelPath = _data$geocodedLabelPa === void 0 ? 'gps.reverseGeocoded.label' : _data$geocodedLabelPa,
10
- _data$entity = data.entity,
11
- entity = _data$entity === void 0 ? {} : _data$entity,
12
- _data$locations = data.locations,
13
- locations = _data$locations === void 0 ? {} : _data$locations,
14
- _data$zones = data.zones,
15
- zones = _data$zones === void 0 ? {} : _data$zones;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getLocationReference = getLocationReference;
7
+ var _lodash = require("lodash");
8
+ function getLocationReference(data = {}) {
9
+ const {
10
+ areaLabelPath = 'area.label',
11
+ areaLocations = {},
12
+ geocodedLabelPath = 'gps.reverseGeocoded.label',
13
+ entity = {},
14
+ locations = {},
15
+ zones = {}
16
+ } = data;
16
17
 
17
18
  // 1. If we can construct `{point}, {location}` use that
18
- var areaPoint = get(entity, 'area.point.name');
19
- var areaLocation = get(entity, 'area.location.name');
19
+ const areaPoint = (0, _lodash.get)(entity, 'area.point.name');
20
+ const areaLocation = (0, _lodash.get)(entity, 'area.location.name');
20
21
  if (areaLocation && areaPoint) {
21
- return "".concat(areaPoint, " - ").concat(areaLocation);
22
+ return `${areaPoint} - ${areaLocation}`;
22
23
  }
23
24
 
24
25
  // 2. Else, try and use area label
25
- var areaLabel = get(entity, areaLabelPath);
26
+ const areaLabel = (0, _lodash.get)(entity, areaLabelPath);
26
27
  if (areaLabel) {
27
28
  return areaLabel;
28
29
  }
29
30
 
30
31
  // 3. Else, try and use zone, location
31
- var location = entity.location;
32
- var zone = entity.zone;
32
+ const location = entity.location;
33
+ const zone = entity.zone;
33
34
 
34
35
  // TODO This can be deprecated once we have removed visits as a feature. It's to account for
35
36
  // legacy location ids being referenced. This temporary workaround allows us to use the area
36
37
  // locations legacyId reference as a key which will match a legacy location id on the entity
37
- var areaLocationMap = reduce(areaLocations, function (memo, location) {
38
- var _location$legacyId;
39
- var legacyId = location === null || location === void 0 || (_location$legacyId = location.legacyId) === null || _location$legacyId === void 0 ? void 0 : _location$legacyId.toString();
38
+ const areaLocationMap = (0, _lodash.reduce)(areaLocations, (memo, location) => {
39
+ const legacyId = location?.legacyId?.toString();
40
40
  if (!legacyId) return memo;
41
41
  memo[legacyId] = location;
42
42
  return memo;
@@ -44,26 +44,24 @@ export function getLocationReference() {
44
44
 
45
45
  // NOTE we expect locations/zones in object map format so convert array to
46
46
  // format before running through
47
- var locationMap = isArray(locations) ? reduce(locations, function (memo, location) {
48
- var _location$_id;
49
- var locationId = location === null || location === void 0 || (_location$_id = location._id) === null || _location$_id === void 0 ? void 0 : _location$_id.toString();
47
+ const locationMap = (0, _lodash.isArray)(locations) ? (0, _lodash.reduce)(locations, (memo, location) => {
48
+ const locationId = location?._id?.toString();
50
49
  if (!locationId) return memo;
51
50
  memo[locationId] = location;
52
51
  return memo;
53
52
  }, {}) : locations;
54
- var zoneMap = isArray(zones) ? reduce(zones, function (memo, zone) {
55
- var _zone$_id;
56
- var zoneId = zone === null || zone === void 0 || (_zone$_id = zone._id) === null || _zone$_id === void 0 ? void 0 : _zone$_id.toString();
53
+ const zoneMap = (0, _lodash.isArray)(zones) ? (0, _lodash.reduce)(zones, (memo, zone) => {
54
+ const zoneId = zone?._id?.toString();
57
55
  if (!zoneId) return memo;
58
56
  memo[zoneId] = zone;
59
57
  return memo;
60
58
  }, {}) : zones;
61
59
 
62
60
  // NOTE location/zone can be passed as an object, object id or plain string
63
- var locationName = isPlainObject(location) ? location.name : location ? get(areaLocationMap, "".concat(location.toString(), ".name")) || get(locationMap, "".concat(location.toString(), ".name")) : undefined;
64
- var zoneName = isPlainObject(zone) ? zone.name : zone ? get(zoneMap, "".concat(zone.toString(), ".name")) : undefined;
61
+ const locationName = (0, _lodash.isPlainObject)(location) ? location.name : location ? (0, _lodash.get)(areaLocationMap, `${location.toString()}.name`) || (0, _lodash.get)(locationMap, `${location.toString()}.name`) : undefined;
62
+ const zoneName = (0, _lodash.isPlainObject)(zone) ? zone.name : zone ? (0, _lodash.get)(zoneMap, `${zone.toString()}.name`) : undefined;
65
63
  if (zoneName) {
66
- var parts = compact([zoneName, locationName]);
64
+ const parts = (0, _lodash.compact)([zoneName, locationName]);
67
65
  return parts.join(', ');
68
66
  }
69
67
 
@@ -73,7 +71,7 @@ export function getLocationReference() {
73
71
  }
74
72
 
75
73
  // 5. Else, try geocoded location
76
- var geocodedLabel = get(entity, geocodedLabelPath);
74
+ const geocodedLabel = (0, _lodash.get)(entity, geocodedLabelPath);
77
75
  if (geocodedLabel) {
78
76
  return geocodedLabel;
79
77
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["compact","get","isArray","isPlainObject","reduce","getLocationReference","data","arguments","length","undefined","_data$areaLabelPath","areaLabelPath","_data$areaLocations","areaLocations","_data$geocodedLabelPa","geocodedLabelPath","_data$entity","entity","_data$locations","locations","_data$zones","zones","areaPoint","areaLocation","concat","areaLabel","location","zone","areaLocationMap","memo","_location$legacyId","legacyId","toString","locationMap","_location$_id","locationId","_id","zoneMap","_zone$_id","zoneId","locationName","name","zoneName","parts","join","geocodedLabel"],"sources":["../../../src/helpers/get-location-reference/index.js"],"sourcesContent":["import { compact, get, isArray, isPlainObject, reduce } from 'lodash'\n\nexport function getLocationReference(data = {}) {\n const {\n areaLabelPath = 'area.label',\n areaLocations = {},\n geocodedLabelPath = 'gps.reverseGeocoded.label',\n entity = {},\n locations = {},\n zones = {},\n } = data\n\n // 1. If we can construct `{point}, {location}` use that\n const areaPoint = get(entity, 'area.point.name')\n const areaLocation = get(entity, 'area.location.name')\n\n if (areaLocation && areaPoint) {\n return `${areaPoint} - ${areaLocation}`\n }\n\n // 2. Else, try and use area label\n const areaLabel = get(entity, areaLabelPath)\n\n if (areaLabel) {\n return areaLabel\n }\n\n // 3. Else, try and use zone, location\n const location = entity.location\n const zone = entity.zone\n\n // TODO This can be deprecated once we have removed visits as a feature. It's to account for\n // legacy location ids being referenced. This temporary workaround allows us to use the area\n // locations legacyId reference as a key which will match a legacy location id on the entity\n const areaLocationMap = reduce(\n areaLocations,\n (memo, location) => {\n const legacyId = location?.legacyId?.toString()\n if (!legacyId) return memo\n\n memo[legacyId] = location\n return memo\n },\n {}\n )\n\n // NOTE we expect locations/zones in object map format so convert array to\n // format before running through\n const locationMap = isArray(locations)\n ? reduce(\n locations,\n (memo, location) => {\n const locationId = location?._id?.toString()\n if (!locationId) return memo\n\n memo[locationId] = location\n return memo\n },\n {}\n )\n : locations\n\n const zoneMap = isArray(zones)\n ? reduce(\n zones,\n (memo, zone) => {\n const zoneId = zone?._id?.toString()\n if (!zoneId) return memo\n\n memo[zoneId] = zone\n return memo\n },\n {}\n )\n : zones\n\n // NOTE location/zone can be passed as an object, object id or plain string\n const locationName = isPlainObject(location)\n ? location.name\n : location\n ? get(areaLocationMap, `${location.toString()}.name`) ||\n get(locationMap, `${location.toString()}.name`)\n : undefined\n\n const zoneName = isPlainObject(zone)\n ? zone.name\n : zone\n ? get(zoneMap, `${zone.toString()}.name`)\n : undefined\n\n if (zoneName) {\n const parts = compact([zoneName, locationName])\n return parts.join(', ')\n }\n\n // 4. Else, try and use location only\n if (locationName) {\n return locationName\n }\n\n // 5. Else, try geocoded location\n const geocodedLabel = get(entity, geocodedLabelPath)\n\n if (geocodedLabel) {\n return geocodedLabel\n }\n\n return 'Unknown Location'\n}\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_lodash","require","getLocationReference","data","areaLabelPath","areaLocations","geocodedLabelPath","entity","locations","zones","areaPoint","get","areaLocation","areaLabel","location","zone","areaLocationMap","reduce","memo","legacyId","toString","locationMap","isArray","locationId","_id","zoneMap","zoneId","locationName","isPlainObject","name","undefined","zoneName","parts","compact","join","geocodedLabel"],"sources":["../../../src/helpers/get-location-reference/index.js"],"sourcesContent":["import { compact, get, isArray, isPlainObject, reduce } from 'lodash'\r\n\r\nexport function getLocationReference(data = {}) {\r\n const {\r\n areaLabelPath = 'area.label',\r\n areaLocations = {},\r\n geocodedLabelPath = 'gps.reverseGeocoded.label',\r\n entity = {},\r\n locations = {},\r\n zones = {},\r\n } = data\r\n\r\n // 1. If we can construct `{point}, {location}` use that\r\n const areaPoint = get(entity, 'area.point.name')\r\n const areaLocation = get(entity, 'area.location.name')\r\n\r\n if (areaLocation && areaPoint) {\r\n return `${areaPoint} - ${areaLocation}`\r\n }\r\n\r\n // 2. Else, try and use area label\r\n const areaLabel = get(entity, areaLabelPath)\r\n\r\n if (areaLabel) {\r\n return areaLabel\r\n }\r\n\r\n // 3. Else, try and use zone, location\r\n const location = entity.location\r\n const zone = entity.zone\r\n\r\n // TODO This can be deprecated once we have removed visits as a feature. It's to account for\r\n // legacy location ids being referenced. This temporary workaround allows us to use the area\r\n // locations legacyId reference as a key which will match a legacy location id on the entity\r\n const areaLocationMap = reduce(\r\n areaLocations,\r\n (memo, location) => {\r\n const legacyId = location?.legacyId?.toString()\r\n if (!legacyId) return memo\r\n\r\n memo[legacyId] = location\r\n return memo\r\n },\r\n {}\r\n )\r\n\r\n // NOTE we expect locations/zones in object map format so convert array to\r\n // format before running through\r\n const locationMap = isArray(locations)\r\n ? reduce(\r\n locations,\r\n (memo, location) => {\r\n const locationId = location?._id?.toString()\r\n if (!locationId) return memo\r\n\r\n memo[locationId] = location\r\n return memo\r\n },\r\n {}\r\n )\r\n : locations\r\n\r\n const zoneMap = isArray(zones)\r\n ? reduce(\r\n zones,\r\n (memo, zone) => {\r\n const zoneId = zone?._id?.toString()\r\n if (!zoneId) return memo\r\n\r\n memo[zoneId] = zone\r\n return memo\r\n },\r\n {}\r\n )\r\n : zones\r\n\r\n // NOTE location/zone can be passed as an object, object id or plain string\r\n const locationName = isPlainObject(location)\r\n ? location.name\r\n : location\r\n ? get(areaLocationMap, `${location.toString()}.name`) ||\r\n get(locationMap, `${location.toString()}.name`)\r\n : undefined\r\n\r\n const zoneName = isPlainObject(zone)\r\n ? zone.name\r\n : zone\r\n ? get(zoneMap, `${zone.toString()}.name`)\r\n : undefined\r\n\r\n if (zoneName) {\r\n const parts = compact([zoneName, locationName])\r\n return parts.join(', ')\r\n }\r\n\r\n // 4. Else, try and use location only\r\n if (locationName) {\r\n return locationName\r\n }\r\n\r\n // 5. Else, try geocoded location\r\n const geocodedLabel = get(entity, geocodedLabelPath)\r\n\r\n if (geocodedLabel) {\r\n return geocodedLabel\r\n }\r\n\r\n return 'Unknown Location'\r\n}\r\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEO,SAASC,oBAAoBA,CAACC,IAAI,GAAG,CAAC,CAAC,EAAE;EAC9C,MAAM;IACJC,aAAa,GAAG,YAAY;IAC5BC,aAAa,GAAG,CAAC,CAAC;IAClBC,iBAAiB,GAAG,2BAA2B;IAC/CC,MAAM,GAAG,CAAC,CAAC;IACXC,SAAS,GAAG,CAAC,CAAC;IACdC,KAAK,GAAG,CAAC;EACX,CAAC,GAAGN,IAAI;;EAER;EACA,MAAMO,SAAS,GAAG,IAAAC,WAAG,EAACJ,MAAM,EAAE,iBAAiB,CAAC;EAChD,MAAMK,YAAY,GAAG,IAAAD,WAAG,EAACJ,MAAM,EAAE,oBAAoB,CAAC;EAEtD,IAAIK,YAAY,IAAIF,SAAS,EAAE;IAC7B,OAAO,GAAGA,SAAS,MAAME,YAAY,EAAE;EACzC;;EAEA;EACA,MAAMC,SAAS,GAAG,IAAAF,WAAG,EAACJ,MAAM,EAAEH,aAAa,CAAC;EAE5C,IAAIS,SAAS,EAAE;IACb,OAAOA,SAAS;EAClB;;EAEA;EACA,MAAMC,QAAQ,GAAGP,MAAM,CAACO,QAAQ;EAChC,MAAMC,IAAI,GAAGR,MAAM,CAACQ,IAAI;;EAExB;EACA;EACA;EACA,MAAMC,eAAe,GAAG,IAAAC,cAAM,EAC5BZ,aAAa,EACb,CAACa,IAAI,EAAEJ,QAAQ,KAAK;IAClB,MAAMK,QAAQ,GAAGL,QAAQ,EAAEK,QAAQ,EAAEC,QAAQ,CAAC,CAAC;IAC/C,IAAI,CAACD,QAAQ,EAAE,OAAOD,IAAI;IAE1BA,IAAI,CAACC,QAAQ,CAAC,GAAGL,QAAQ;IACzB,OAAOI,IAAI;EACb,CAAC,EACD,CAAC,CACH,CAAC;;EAED;EACA;EACA,MAAMG,WAAW,GAAG,IAAAC,eAAO,EAACd,SAAS,CAAC,GAClC,IAAAS,cAAM,EACJT,SAAS,EACT,CAACU,IAAI,EAAEJ,QAAQ,KAAK;IAClB,MAAMS,UAAU,GAAGT,QAAQ,EAAEU,GAAG,EAAEJ,QAAQ,CAAC,CAAC;IAC5C,IAAI,CAACG,UAAU,EAAE,OAAOL,IAAI;IAE5BA,IAAI,CAACK,UAAU,CAAC,GAAGT,QAAQ;IAC3B,OAAOI,IAAI;EACb,CAAC,EACD,CAAC,CACH,CAAC,GACDV,SAAS;EAEb,MAAMiB,OAAO,GAAG,IAAAH,eAAO,EAACb,KAAK,CAAC,GAC1B,IAAAQ,cAAM,EACJR,KAAK,EACL,CAACS,IAAI,EAAEH,IAAI,KAAK;IACd,MAAMW,MAAM,GAAGX,IAAI,EAAES,GAAG,EAAEJ,QAAQ,CAAC,CAAC;IACpC,IAAI,CAACM,MAAM,EAAE,OAAOR,IAAI;IAExBA,IAAI,CAACQ,MAAM,CAAC,GAAGX,IAAI;IACnB,OAAOG,IAAI;EACb,CAAC,EACD,CAAC,CACH,CAAC,GACDT,KAAK;;EAET;EACA,MAAMkB,YAAY,GAAG,IAAAC,qBAAa,EAACd,QAAQ,CAAC,GACxCA,QAAQ,CAACe,IAAI,GACbf,QAAQ,GACR,IAAAH,WAAG,EAACK,eAAe,EAAE,GAAGF,QAAQ,CAACM,QAAQ,CAAC,CAAC,OAAO,CAAC,IACnD,IAAAT,WAAG,EAACU,WAAW,EAAE,GAAGP,QAAQ,CAACM,QAAQ,CAAC,CAAC,OAAO,CAAC,GAC/CU,SAAS;EAEb,MAAMC,QAAQ,GAAG,IAAAH,qBAAa,EAACb,IAAI,CAAC,GAChCA,IAAI,CAACc,IAAI,GACTd,IAAI,GACJ,IAAAJ,WAAG,EAACc,OAAO,EAAE,GAAGV,IAAI,CAACK,QAAQ,CAAC,CAAC,OAAO,CAAC,GACvCU,SAAS;EAEb,IAAIC,QAAQ,EAAE;IACZ,MAAMC,KAAK,GAAG,IAAAC,eAAO,EAAC,CAACF,QAAQ,EAAEJ,YAAY,CAAC,CAAC;IAC/C,OAAOK,KAAK,CAACE,IAAI,CAAC,IAAI,CAAC;EACzB;;EAEA;EACA,IAAIP,YAAY,EAAE;IAChB,OAAOA,YAAY;EACrB;;EAEA;EACA,MAAMQ,aAAa,GAAG,IAAAxB,WAAG,EAACJ,MAAM,EAAED,iBAAiB,CAAC;EAEpD,IAAI6B,aAAa,EAAE;IACjB,OAAOA,aAAa;EACtB;EAEA,OAAO,kBAAkB;AAC3B","ignoreList":[]}
@@ -1,18 +1,24 @@
1
- export function getPrettyDuration(duration) {
2
- var days = Math.floor(duration.asDays());
3
- var hours = Math.floor(duration.asHours());
4
- var hoursInDay = duration.hours();
5
- var minutes = duration.minutes();
6
- var seconds = duration.seconds();
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getPrettyDuration = getPrettyDuration;
7
+ function getPrettyDuration(duration) {
8
+ const days = Math.floor(duration.asDays());
9
+ const hours = Math.floor(duration.asHours());
10
+ const hoursInDay = duration.hours();
11
+ const minutes = duration.minutes();
12
+ const seconds = duration.seconds();
7
13
  if (days > 0) {
8
- return "".concat(days, "d ").concat(hoursInDay, "h");
14
+ return `${days}d ${hoursInDay}h`;
9
15
  }
10
16
  if (hours > 0) {
11
- return "".concat(hours, "h ").concat(minutes, "m");
17
+ return `${hours}h ${minutes}m`;
12
18
  }
13
19
  if (minutes > 0) {
14
- return "".concat(minutes, "m");
20
+ return `${minutes}m`;
15
21
  }
16
- return "".concat(seconds, "s");
22
+ return `${seconds}s`;
17
23
  }
18
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["getPrettyDuration","duration","days","Math","floor","asDays","hours","asHours","hoursInDay","minutes","seconds","concat"],"sources":["../../../src/helpers/get-pretty-duration/index.js"],"sourcesContent":["export function getPrettyDuration(duration) {\n const days = Math.floor(duration.asDays())\n const hours = Math.floor(duration.asHours())\n\n const hoursInDay = duration.hours()\n const minutes = duration.minutes()\n const seconds = duration.seconds()\n\n if (days > 0) {\n return `${days}d ${hoursInDay}h`\n }\n if (hours > 0) {\n return `${hours}h ${minutes}m`\n }\n if (minutes > 0) {\n return `${minutes}m`\n }\n\n return `${seconds}s`\n}\n"],"mappings":"AAAA,OAAO,SAASA,iBAAiBA,CAACC,QAAQ,EAAE;EAC1C,IAAMC,IAAI,GAAGC,IAAI,CAACC,KAAK,CAACH,QAAQ,CAACI,MAAM,CAAC,CAAC,CAAC;EAC1C,IAAMC,KAAK,GAAGH,IAAI,CAACC,KAAK,CAACH,QAAQ,CAACM,OAAO,CAAC,CAAC,CAAC;EAE5C,IAAMC,UAAU,GAAGP,QAAQ,CAACK,KAAK,CAAC,CAAC;EACnC,IAAMG,OAAO,GAAGR,QAAQ,CAACQ,OAAO,CAAC,CAAC;EAClC,IAAMC,OAAO,GAAGT,QAAQ,CAACS,OAAO,CAAC,CAAC;EAElC,IAAIR,IAAI,GAAG,CAAC,EAAE;IACZ,UAAAS,MAAA,CAAUT,IAAI,QAAAS,MAAA,CAAKH,UAAU;EAC/B;EACA,IAAIF,KAAK,GAAG,CAAC,EAAE;IACb,UAAAK,MAAA,CAAUL,KAAK,QAAAK,MAAA,CAAKF,OAAO;EAC7B;EACA,IAAIA,OAAO,GAAG,CAAC,EAAE;IACf,UAAAE,MAAA,CAAUF,OAAO;EACnB;EAEA,UAAAE,MAAA,CAAUD,OAAO;AACnB","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["getPrettyDuration","duration","days","Math","floor","asDays","hours","asHours","hoursInDay","minutes","seconds"],"sources":["../../../src/helpers/get-pretty-duration/index.js"],"sourcesContent":["export function getPrettyDuration(duration) {\r\n const days = Math.floor(duration.asDays())\r\n const hours = Math.floor(duration.asHours())\r\n\r\n const hoursInDay = duration.hours()\r\n const minutes = duration.minutes()\r\n const seconds = duration.seconds()\r\n\r\n if (days > 0) {\r\n return `${days}d ${hoursInDay}h`\r\n }\r\n if (hours > 0) {\r\n return `${hours}h ${minutes}m`\r\n }\r\n if (minutes > 0) {\r\n return `${minutes}m`\r\n }\r\n\r\n return `${seconds}s`\r\n}\r\n"],"mappings":";;;;;;AAAO,SAASA,iBAAiBA,CAACC,QAAQ,EAAE;EAC1C,MAAMC,IAAI,GAAGC,IAAI,CAACC,KAAK,CAACH,QAAQ,CAACI,MAAM,CAAC,CAAC,CAAC;EAC1C,MAAMC,KAAK,GAAGH,IAAI,CAACC,KAAK,CAACH,QAAQ,CAACM,OAAO,CAAC,CAAC,CAAC;EAE5C,MAAMC,UAAU,GAAGP,QAAQ,CAACK,KAAK,CAAC,CAAC;EACnC,MAAMG,OAAO,GAAGR,QAAQ,CAACQ,OAAO,CAAC,CAAC;EAClC,MAAMC,OAAO,GAAGT,QAAQ,CAACS,OAAO,CAAC,CAAC;EAElC,IAAIR,IAAI,GAAG,CAAC,EAAE;IACZ,OAAO,GAAGA,IAAI,KAAKM,UAAU,GAAG;EAClC;EACA,IAAIF,KAAK,GAAG,CAAC,EAAE;IACb,OAAO,GAAGA,KAAK,KAAKG,OAAO,GAAG;EAChC;EACA,IAAIA,OAAO,GAAG,CAAC,EAAE;IACf,OAAO,GAAGA,OAAO,GAAG;EACtB;EAEA,OAAO,GAAGC,OAAO,GAAG;AACtB","ignoreList":[]}
@@ -1,18 +1,28 @@
1
- import { getUserFullName } from '../';
2
- export function getReferenceDetails(data) {
3
- var entity = data.entity,
4
- users = data.users;
5
- var user = entity.user;
6
- var label = 'Reference';
7
- var value = 'Unknown Reference';
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getReferenceDetails = getReferenceDetails;
7
+ var _ = require("../");
8
+ function getReferenceDetails(data) {
9
+ const {
10
+ entity,
11
+ users
12
+ } = data;
13
+ const {
14
+ user
15
+ } = entity;
16
+ let label = 'Reference';
17
+ let value = 'Unknown Reference';
8
18
  if (user) {
9
- var userFullName = getUserFullName(users, user);
19
+ const userFullName = (0, _.getUserFullName)(users, user);
10
20
  label = 'User';
11
21
  value = userFullName;
12
22
  }
13
23
  return {
14
- label: label,
15
- value: value
24
+ label,
25
+ value
16
26
  };
17
27
  }
18
28
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["getUserFullName","getReferenceDetails","data","entity","users","user","label","value","userFullName"],"sources":["../../../src/helpers/get-reference-details/index.js"],"sourcesContent":["import { getUserFullName } from '../'\n\nexport function getReferenceDetails(data) {\n const { entity, users } = data\n const { user } = entity\n\n let label = 'Reference'\n let value = 'Unknown Reference'\n\n if (user) {\n const userFullName = getUserFullName(users, user)\n label = 'User'\n value = userFullName\n }\n\n return {\n label,\n value,\n }\n}\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,KAAK;AAErC,OAAO,SAASC,mBAAmBA,CAACC,IAAI,EAAE;EACxC,IAAQC,MAAM,GAAYD,IAAI,CAAtBC,MAAM;IAAEC,KAAK,GAAKF,IAAI,CAAdE,KAAK;EACrB,IAAQC,IAAI,GAAKF,MAAM,CAAfE,IAAI;EAEZ,IAAIC,KAAK,GAAG,WAAW;EACvB,IAAIC,KAAK,GAAG,mBAAmB;EAE/B,IAAIF,IAAI,EAAE;IACR,IAAMG,YAAY,GAAGR,eAAe,CAACI,KAAK,EAAEC,IAAI,CAAC;IACjDC,KAAK,GAAG,MAAM;IACdC,KAAK,GAAGC,YAAY;EACtB;EAEA,OAAO;IACLF,KAAK,EAALA,KAAK;IACLC,KAAK,EAALA;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_","require","getReferenceDetails","data","entity","users","user","label","value","userFullName","getUserFullName"],"sources":["../../../src/helpers/get-reference-details/index.js"],"sourcesContent":["import { getUserFullName } from '../'\r\n\r\nexport function getReferenceDetails(data) {\r\n const { entity, users } = data\r\n const { user } = entity\r\n\r\n let label = 'Reference'\r\n let value = 'Unknown Reference'\r\n\r\n if (user) {\r\n const userFullName = getUserFullName(users, user)\r\n label = 'User'\r\n value = userFullName\r\n }\r\n\r\n return {\r\n label,\r\n value,\r\n }\r\n}\r\n"],"mappings":";;;;;;AAAA,IAAAA,CAAA,GAAAC,OAAA;AAEO,SAASC,mBAAmBA,CAACC,IAAI,EAAE;EACxC,MAAM;IAAEC,MAAM;IAAEC;EAAM,CAAC,GAAGF,IAAI;EAC9B,MAAM;IAAEG;EAAK,CAAC,GAAGF,MAAM;EAEvB,IAAIG,KAAK,GAAG,WAAW;EACvB,IAAIC,KAAK,GAAG,mBAAmB;EAE/B,IAAIF,IAAI,EAAE;IACR,MAAMG,YAAY,GAAG,IAAAC,iBAAe,EAACL,KAAK,EAAEC,IAAI,CAAC;IACjDC,KAAK,GAAG,MAAM;IACdC,KAAK,GAAGC,YAAY;EACtB;EAEA,OAAO;IACLF,KAAK;IACLC;EACF,CAAC;AACH","ignoreList":[]}
@@ -1,5 +1,11 @@
1
- import { memoize } from 'lodash';
2
- export var getStatusDetails = memoize(function (status) {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getStatusDetails = void 0;
7
+ var _lodash = require("lodash");
8
+ const getStatusDetails = exports.getStatusDetails = (0, _lodash.memoize)(status => {
3
9
  switch (status) {
4
10
  case 'cancelled':
5
11
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["memoize","getStatusDetails","status","style","color","text"],"sources":["../../../src/helpers/get-status-details/index.js"],"sourcesContent":["import { memoize } from 'lodash'\n\nexport const getStatusDetails = memoize(status => {\n switch (status) {\n case 'cancelled':\n return {\n style: {\n color: '#AAA',\n },\n text: 'Cancelled',\n }\n case 'closed':\n return {\n style: {\n color: '#D0021B',\n },\n text: 'Closed',\n }\n case 'in-progress':\n return {\n style: {\n color: '#00AAE4',\n },\n text: 'In Progress',\n }\n case 'open':\n return {\n style: {\n color: '#FF8C2F',\n },\n text: 'Open',\n }\n default:\n return {\n style: {\n color: '#666666',\n },\n text: 'Unknown',\n }\n }\n})\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,QAAQ;AAEhC,OAAO,IAAMC,gBAAgB,GAAGD,OAAO,CAAC,UAAAE,MAAM,EAAI;EAChD,QAAQA,MAAM;IACZ,KAAK,WAAW;MACd,OAAO;QACLC,KAAK,EAAE;UACLC,KAAK,EAAE;QACT,CAAC;QACDC,IAAI,EAAE;MACR,CAAC;IACH,KAAK,QAAQ;MACX,OAAO;QACLF,KAAK,EAAE;UACLC,KAAK,EAAE;QACT,CAAC;QACDC,IAAI,EAAE;MACR,CAAC;IACH,KAAK,aAAa;MAChB,OAAO;QACLF,KAAK,EAAE;UACLC,KAAK,EAAE;QACT,CAAC;QACDC,IAAI,EAAE;MACR,CAAC;IACH,KAAK,MAAM;MACT,OAAO;QACLF,KAAK,EAAE;UACLC,KAAK,EAAE;QACT,CAAC;QACDC,IAAI,EAAE;MACR,CAAC;IACH;MACE,OAAO;QACLF,KAAK,EAAE;UACLC,KAAK,EAAE;QACT,CAAC;QACDC,IAAI,EAAE;MACR,CAAC;EACL;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_lodash","require","getStatusDetails","exports","memoize","status","style","color","text"],"sources":["../../../src/helpers/get-status-details/index.js"],"sourcesContent":["import { memoize } from 'lodash'\r\n\r\nexport const getStatusDetails = memoize(status => {\r\n switch (status) {\r\n case 'cancelled':\r\n return {\r\n style: {\r\n color: '#AAA',\r\n },\r\n text: 'Cancelled',\r\n }\r\n case 'closed':\r\n return {\r\n style: {\r\n color: '#D0021B',\r\n },\r\n text: 'Closed',\r\n }\r\n case 'in-progress':\r\n return {\r\n style: {\r\n color: '#00AAE4',\r\n },\r\n text: 'In Progress',\r\n }\r\n case 'open':\r\n return {\r\n style: {\r\n color: '#FF8C2F',\r\n },\r\n text: 'Open',\r\n }\r\n default:\r\n return {\r\n style: {\r\n color: '#666666',\r\n },\r\n text: 'Unknown',\r\n }\r\n }\r\n})\r\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEO,MAAMC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,IAAAE,eAAO,EAACC,MAAM,IAAI;EAChD,QAAQA,MAAM;IACZ,KAAK,WAAW;MACd,OAAO;QACLC,KAAK,EAAE;UACLC,KAAK,EAAE;QACT,CAAC;QACDC,IAAI,EAAE;MACR,CAAC;IACH,KAAK,QAAQ;MACX,OAAO;QACLF,KAAK,EAAE;UACLC,KAAK,EAAE;QACT,CAAC;QACDC,IAAI,EAAE;MACR,CAAC;IACH,KAAK,aAAa;MAChB,OAAO;QACLF,KAAK,EAAE;UACLC,KAAK,EAAE;QACT,CAAC;QACDC,IAAI,EAAE;MACR,CAAC;IACH,KAAK,MAAM;MACT,OAAO;QACLF,KAAK,EAAE;UACLC,KAAK,EAAE;QACT,CAAC;QACDC,IAAI,EAAE;MACR,CAAC;IACH;MACE,OAAO;QACLF,KAAK,EAAE;UACLC,KAAK,EAAE;QACT,CAAC;QACDC,IAAI,EAAE;MACR,CAAC;EACL;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,34 +1,43 @@
1
- import { get } from 'lodash';
2
- import { getLocationReference, getReferenceDetails, getTimezoneDatetime } from '../';
3
- export function getTaskEntryDetails(data) {
4
- var _data$entity = data.entity,
5
- entity = _data$entity === void 0 ? {} : _data$entity,
6
- timezone = data.timezone;
7
- var createdAt = entity.createdAt,
8
- gps = entity.gps,
9
- sequenceId = entity.sequenceId,
10
- templateRevision = entity.templateRevision;
11
- var gpsText = get(gps, 'reverseGeocoded.label', 'Unknown Location');
12
- var locationText = getLocationReference(data);
13
- var referenceDetails = getReferenceDetails(data);
14
- var timezoneHourTime = getTimezoneDatetime({
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getTaskEntryDetails = getTaskEntryDetails;
7
+ var _lodash = require("lodash");
8
+ var _ = require("../");
9
+ function getTaskEntryDetails(data) {
10
+ const {
11
+ entity = {},
12
+ timezone
13
+ } = data;
14
+ const {
15
+ createdAt,
16
+ gps,
17
+ sequenceId,
18
+ templateRevision
19
+ } = entity;
20
+ const gpsText = (0, _lodash.get)(gps, 'reverseGeocoded.label', 'Unknown Location');
21
+ const locationText = (0, _.getLocationReference)(data);
22
+ const referenceDetails = (0, _.getReferenceDetails)(data);
23
+ const timezoneHourTime = (0, _.getTimezoneDatetime)({
15
24
  format: 'h:mm a',
16
25
  timestamp: createdAt,
17
- timezone: timezone
26
+ timezone
18
27
  });
19
- var timezoneDatetime = getTimezoneDatetime({
28
+ const timezoneDatetime = (0, _.getTimezoneDatetime)({
20
29
  timestamp: createdAt,
21
- timezone: timezone
30
+ timezone
22
31
  });
23
32
  return {
24
- locationText: locationText,
25
- gpsText: gpsText,
33
+ locationText,
34
+ gpsText,
26
35
  referenceLabel: referenceDetails.label,
27
36
  referenceValue: referenceDetails.value,
28
- sequenceId: sequenceId,
29
- templateRevision: templateRevision,
30
- timezoneHourTime: timezoneHourTime,
31
- timezoneDatetime: timezoneDatetime
37
+ sequenceId,
38
+ templateRevision,
39
+ timezoneHourTime,
40
+ timezoneDatetime
32
41
  };
33
42
  }
34
43
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["get","getLocationReference","getReferenceDetails","getTimezoneDatetime","getTaskEntryDetails","data","_data$entity","entity","timezone","createdAt","gps","sequenceId","templateRevision","gpsText","locationText","referenceDetails","timezoneHourTime","format","timestamp","timezoneDatetime","referenceLabel","label","referenceValue","value"],"sources":["../../../src/helpers/get-task-entry-details/index.js"],"sourcesContent":["import { get } from 'lodash'\n\nimport {\n getLocationReference,\n getReferenceDetails,\n getTimezoneDatetime,\n} from '../'\n\nexport function getTaskEntryDetails(data) {\n const { entity = {}, timezone } = data\n\n const { createdAt, gps, sequenceId, templateRevision } = entity\n\n const gpsText = get(gps, 'reverseGeocoded.label', 'Unknown Location')\n const locationText = getLocationReference(data)\n const referenceDetails = getReferenceDetails(data)\n const timezoneHourTime = getTimezoneDatetime({\n format: 'h:mm a',\n timestamp: createdAt,\n timezone,\n })\n const timezoneDatetime = getTimezoneDatetime({\n timestamp: createdAt,\n timezone,\n })\n\n return {\n locationText,\n gpsText,\n referenceLabel: referenceDetails.label,\n referenceValue: referenceDetails.value,\n sequenceId,\n templateRevision,\n timezoneHourTime,\n timezoneDatetime,\n }\n}\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,QAAQ;AAE5B,SACEC,oBAAoB,EACpBC,mBAAmB,EACnBC,mBAAmB,QACd,KAAK;AAEZ,OAAO,SAASC,mBAAmBA,CAACC,IAAI,EAAE;EACxC,IAAAC,YAAA,GAAkCD,IAAI,CAA9BE,MAAM;IAANA,MAAM,GAAAD,YAAA,cAAG,CAAC,CAAC,GAAAA,YAAA;IAAEE,QAAQ,GAAKH,IAAI,CAAjBG,QAAQ;EAE7B,IAAQC,SAAS,GAAwCF,MAAM,CAAvDE,SAAS;IAAEC,GAAG,GAAmCH,MAAM,CAA5CG,GAAG;IAAEC,UAAU,GAAuBJ,MAAM,CAAvCI,UAAU;IAAEC,gBAAgB,GAAKL,MAAM,CAA3BK,gBAAgB;EAEpD,IAAMC,OAAO,GAAGb,GAAG,CAACU,GAAG,EAAE,uBAAuB,EAAE,kBAAkB,CAAC;EACrE,IAAMI,YAAY,GAAGb,oBAAoB,CAACI,IAAI,CAAC;EAC/C,IAAMU,gBAAgB,GAAGb,mBAAmB,CAACG,IAAI,CAAC;EAClD,IAAMW,gBAAgB,GAAGb,mBAAmB,CAAC;IAC3Cc,MAAM,EAAE,QAAQ;IAChBC,SAAS,EAAET,SAAS;IACpBD,QAAQ,EAARA;EACF,CAAC,CAAC;EACF,IAAMW,gBAAgB,GAAGhB,mBAAmB,CAAC;IAC3Ce,SAAS,EAAET,SAAS;IACpBD,QAAQ,EAARA;EACF,CAAC,CAAC;EAEF,OAAO;IACLM,YAAY,EAAZA,YAAY;IACZD,OAAO,EAAPA,OAAO;IACPO,cAAc,EAAEL,gBAAgB,CAACM,KAAK;IACtCC,cAAc,EAAEP,gBAAgB,CAACQ,KAAK;IACtCZ,UAAU,EAAVA,UAAU;IACVC,gBAAgB,EAAhBA,gBAAgB;IAChBI,gBAAgB,EAAhBA,gBAAgB;IAChBG,gBAAgB,EAAhBA;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_lodash","require","_","getTaskEntryDetails","data","entity","timezone","createdAt","gps","sequenceId","templateRevision","gpsText","get","locationText","getLocationReference","referenceDetails","getReferenceDetails","timezoneHourTime","getTimezoneDatetime","format","timestamp","timezoneDatetime","referenceLabel","label","referenceValue","value"],"sources":["../../../src/helpers/get-task-entry-details/index.js"],"sourcesContent":["import { get } from 'lodash'\r\n\r\nimport {\r\n getLocationReference,\r\n getReferenceDetails,\r\n getTimezoneDatetime,\r\n} from '../'\r\n\r\nexport function getTaskEntryDetails(data) {\r\n const { entity = {}, timezone } = data\r\n\r\n const { createdAt, gps, sequenceId, templateRevision } = entity\r\n\r\n const gpsText = get(gps, 'reverseGeocoded.label', 'Unknown Location')\r\n const locationText = getLocationReference(data)\r\n const referenceDetails = getReferenceDetails(data)\r\n const timezoneHourTime = getTimezoneDatetime({\r\n format: 'h:mm a',\r\n timestamp: createdAt,\r\n timezone,\r\n })\r\n const timezoneDatetime = getTimezoneDatetime({\r\n timestamp: createdAt,\r\n timezone,\r\n })\r\n\r\n return {\r\n locationText,\r\n gpsText,\r\n referenceLabel: referenceDetails.label,\r\n referenceValue: referenceDetails.value,\r\n sequenceId,\r\n templateRevision,\r\n timezoneHourTime,\r\n timezoneDatetime,\r\n }\r\n}\r\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,CAAA,GAAAD,OAAA;AAMO,SAASE,mBAAmBA,CAACC,IAAI,EAAE;EACxC,MAAM;IAAEC,MAAM,GAAG,CAAC,CAAC;IAAEC;EAAS,CAAC,GAAGF,IAAI;EAEtC,MAAM;IAAEG,SAAS;IAAEC,GAAG;IAAEC,UAAU;IAAEC;EAAiB,CAAC,GAAGL,MAAM;EAE/D,MAAMM,OAAO,GAAG,IAAAC,WAAG,EAACJ,GAAG,EAAE,uBAAuB,EAAE,kBAAkB,CAAC;EACrE,MAAMK,YAAY,GAAG,IAAAC,sBAAoB,EAACV,IAAI,CAAC;EAC/C,MAAMW,gBAAgB,GAAG,IAAAC,qBAAmB,EAACZ,IAAI,CAAC;EAClD,MAAMa,gBAAgB,GAAG,IAAAC,qBAAmB,EAAC;IAC3CC,MAAM,EAAE,QAAQ;IAChBC,SAAS,EAAEb,SAAS;IACpBD;EACF,CAAC,CAAC;EACF,MAAMe,gBAAgB,GAAG,IAAAH,qBAAmB,EAAC;IAC3CE,SAAS,EAAEb,SAAS;IACpBD;EACF,CAAC,CAAC;EAEF,OAAO;IACLO,YAAY;IACZF,OAAO;IACPW,cAAc,EAAEP,gBAAgB,CAACQ,KAAK;IACtCC,cAAc,EAAET,gBAAgB,CAACU,KAAK;IACtChB,UAAU;IACVC,gBAAgB;IAChBO,gBAAgB;IAChBI;EACF,CAAC;AACH","ignoreList":[]}
@@ -1,7 +1,14 @@
1
- import moment from 'moment-timezone';
2
- export function getTimezoneAbbr(timezone) {
3
- var mTimezoneTime = moment.tz(timezone);
4
- var timezoneText = mTimezoneTime.format('z');
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.getTimezoneAbbr = getTimezoneAbbr;
8
+ var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
9
+ function getTimezoneAbbr(timezone) {
10
+ const mTimezoneTime = _momentTimezone.default.tz(timezone);
11
+ const timezoneText = mTimezoneTime.format('z');
5
12
  return timezoneText;
6
13
  }
7
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["moment","getTimezoneAbbr","timezone","mTimezoneTime","tz","timezoneText","format"],"sources":["../../../src/helpers/get-timezone-abbr/index.js"],"sourcesContent":["import moment from 'moment-timezone'\n\nexport function getTimezoneAbbr(timezone) {\n const mTimezoneTime = moment.tz(timezone)\n const timezoneText = mTimezoneTime.format('z')\n\n return timezoneText\n}\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,iBAAiB;AAEpC,OAAO,SAASC,eAAeA,CAACC,QAAQ,EAAE;EACxC,IAAMC,aAAa,GAAGH,MAAM,CAACI,EAAE,CAACF,QAAQ,CAAC;EACzC,IAAMG,YAAY,GAAGF,aAAa,CAACG,MAAM,CAAC,GAAG,CAAC;EAE9C,OAAOD,YAAY;AACrB","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_momentTimezone","_interopRequireDefault","require","getTimezoneAbbr","timezone","mTimezoneTime","moment","tz","timezoneText","format"],"sources":["../../../src/helpers/get-timezone-abbr/index.js"],"sourcesContent":["import moment from 'moment-timezone'\r\n\r\nexport function getTimezoneAbbr(timezone) {\r\n const mTimezoneTime = moment.tz(timezone)\r\n const timezoneText = mTimezoneTime.format('z')\r\n\r\n return timezoneText\r\n}\r\n"],"mappings":";;;;;;;AAAA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEO,SAASC,eAAeA,CAACC,QAAQ,EAAE;EACxC,MAAMC,aAAa,GAAGC,uBAAM,CAACC,EAAE,CAACH,QAAQ,CAAC;EACzC,MAAMI,YAAY,GAAGH,aAAa,CAACI,MAAM,CAAC,GAAG,CAAC;EAE9C,OAAOD,YAAY;AACrB","ignoreList":[]}
@@ -1,15 +1,22 @@
1
- import moment from 'moment-timezone';
2
- export function getTimezoneDatetime(options) {
3
- var _options$format = options.format,
4
- format = _options$format === void 0 ? 'ddd, MMM D h:mm:ssa' : _options$format,
5
- _options$showTzAbbr = options.showTzAbbr,
6
- showTzAbbr = _options$showTzAbbr === void 0 ? true : _options$showTzAbbr,
7
- _options$timestamp = options.timestamp,
8
- timestamp = _options$timestamp === void 0 ? moment() : _options$timestamp,
9
- timezone = options.timezone;
10
- var mTimezoneTime = moment.tz(timestamp, timezone);
11
- var datetimeText = mTimezoneTime.format(format);
12
- var timezoneText = mTimezoneTime.format('z');
13
- return showTzAbbr ? "".concat(datetimeText, " ").concat(timezoneText) : datetimeText;
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.getTimezoneDatetime = getTimezoneDatetime;
8
+ var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
9
+ function getTimezoneDatetime(options) {
10
+ const {
11
+ format = 'ddd, MMM D h:mm:ssa',
12
+ // Mon, Jan 21 12:59am
13
+ showTzAbbr = true,
14
+ timestamp = (0, _momentTimezone.default)(),
15
+ timezone
16
+ } = options;
17
+ const mTimezoneTime = _momentTimezone.default.tz(timestamp, timezone);
18
+ const datetimeText = mTimezoneTime.format(format);
19
+ const timezoneText = mTimezoneTime.format('z');
20
+ return showTzAbbr ? `${datetimeText} ${timezoneText}` : datetimeText;
14
21
  }
15
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["moment","getTimezoneDatetime","options","_options$format","format","_options$showTzAbbr","showTzAbbr","_options$timestamp","timestamp","timezone","mTimezoneTime","tz","datetimeText","timezoneText","concat"],"sources":["../../../src/helpers/get-timezone-datetime/index.js"],"sourcesContent":["import moment from 'moment-timezone'\n\nexport function getTimezoneDatetime(options) {\n const {\n format = 'ddd, MMM D h:mm:ssa', // Mon, Jan 21 12:59am\n showTzAbbr = true,\n timestamp = moment(),\n timezone,\n } = options\n\n const mTimezoneTime = moment.tz(timestamp, timezone)\n const datetimeText = mTimezoneTime.format(format)\n const timezoneText = mTimezoneTime.format('z')\n\n return showTzAbbr ? `${datetimeText} ${timezoneText}` : datetimeText\n}\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,iBAAiB;AAEpC,OAAO,SAASC,mBAAmBA,CAACC,OAAO,EAAE;EAC3C,IAAAC,eAAA,GAKID,OAAO,CAJTE,MAAM;IAANA,MAAM,GAAAD,eAAA,cAAG,qBAAqB,GAAAA,eAAA;IAAAE,mBAAA,GAI5BH,OAAO,CAHTI,UAAU;IAAVA,UAAU,GAAAD,mBAAA,cAAG,IAAI,GAAAA,mBAAA;IAAAE,kBAAA,GAGfL,OAAO,CAFTM,SAAS;IAATA,SAAS,GAAAD,kBAAA,cAAGP,MAAM,CAAC,CAAC,GAAAO,kBAAA;IACpBE,QAAQ,GACNP,OAAO,CADTO,QAAQ;EAGV,IAAMC,aAAa,GAAGV,MAAM,CAACW,EAAE,CAACH,SAAS,EAAEC,QAAQ,CAAC;EACpD,IAAMG,YAAY,GAAGF,aAAa,CAACN,MAAM,CAACA,MAAM,CAAC;EACjD,IAAMS,YAAY,GAAGH,aAAa,CAACN,MAAM,CAAC,GAAG,CAAC;EAE9C,OAAOE,UAAU,MAAAQ,MAAA,CAAMF,YAAY,OAAAE,MAAA,CAAID,YAAY,IAAKD,YAAY;AACtE","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_momentTimezone","_interopRequireDefault","require","getTimezoneDatetime","options","format","showTzAbbr","timestamp","moment","timezone","mTimezoneTime","tz","datetimeText","timezoneText"],"sources":["../../../src/helpers/get-timezone-datetime/index.js"],"sourcesContent":["import moment from 'moment-timezone'\r\n\r\nexport function getTimezoneDatetime(options) {\r\n const {\r\n format = 'ddd, MMM D h:mm:ssa', // Mon, Jan 21 12:59am\r\n showTzAbbr = true,\r\n timestamp = moment(),\r\n timezone,\r\n } = options\r\n\r\n const mTimezoneTime = moment.tz(timestamp, timezone)\r\n const datetimeText = mTimezoneTime.format(format)\r\n const timezoneText = mTimezoneTime.format('z')\r\n\r\n return showTzAbbr ? `${datetimeText} ${timezoneText}` : datetimeText\r\n}\r\n"],"mappings":";;;;;;;AAAA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEO,SAASC,mBAAmBA,CAACC,OAAO,EAAE;EAC3C,MAAM;IACJC,MAAM,GAAG,qBAAqB;IAAE;IAChCC,UAAU,GAAG,IAAI;IACjBC,SAAS,GAAG,IAAAC,uBAAM,EAAC,CAAC;IACpBC;EACF,CAAC,GAAGL,OAAO;EAEX,MAAMM,aAAa,GAAGF,uBAAM,CAACG,EAAE,CAACJ,SAAS,EAAEE,QAAQ,CAAC;EACpD,MAAMG,YAAY,GAAGF,aAAa,CAACL,MAAM,CAACA,MAAM,CAAC;EACjD,MAAMQ,YAAY,GAAGH,aAAa,CAACL,MAAM,CAAC,GAAG,CAAC;EAE9C,OAAOC,UAAU,GAAG,GAAGM,YAAY,IAAIC,YAAY,EAAE,GAAGD,YAAY;AACtE","ignoreList":[]}
@@ -1,6 +1,12 @@
1
- export function getUserFullName(users, userId) {
2
- var user = users[userId];
3
- if (user) return "".concat(user.firstName, " ").concat(user.lastName);
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getUserFullName = getUserFullName;
7
+ function getUserFullName(users, userId) {
8
+ const user = users[userId];
9
+ if (user) return `${user.firstName} ${user.lastName}`;
4
10
  return 'Unknown User';
5
11
  }
6
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["getUserFullName","users","userId","user","concat","firstName","lastName"],"sources":["../../../src/helpers/get-user-full-name/index.js"],"sourcesContent":["export function getUserFullName(users, userId) {\n const user = users[userId]\n\n if (user) return `${user.firstName} ${user.lastName}`\n\n return 'Unknown User'\n}\n"],"mappings":"AAAA,OAAO,SAASA,eAAeA,CAACC,KAAK,EAAEC,MAAM,EAAE;EAC7C,IAAMC,IAAI,GAAGF,KAAK,CAACC,MAAM,CAAC;EAE1B,IAAIC,IAAI,EAAE,UAAAC,MAAA,CAAUD,IAAI,CAACE,SAAS,OAAAD,MAAA,CAAID,IAAI,CAACG,QAAQ;EAEnD,OAAO,cAAc;AACvB","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["getUserFullName","users","userId","user","firstName","lastName"],"sources":["../../../src/helpers/get-user-full-name/index.js"],"sourcesContent":["export function getUserFullName(users, userId) {\r\n const user = users[userId]\r\n\r\n if (user) return `${user.firstName} ${user.lastName}`\r\n\r\n return 'Unknown User'\r\n}\r\n"],"mappings":";;;;;;AAAO,SAASA,eAAeA,CAACC,KAAK,EAAEC,MAAM,EAAE;EAC7C,MAAMC,IAAI,GAAGF,KAAK,CAACC,MAAM,CAAC;EAE1B,IAAIC,IAAI,EAAE,OAAO,GAAGA,IAAI,CAACC,SAAS,IAAID,IAAI,CAACE,QAAQ,EAAE;EAErD,OAAO,cAAc;AACvB","ignoreList":[]}
@@ -1,6 +1,11 @@
1
- export function getValueAsPercentage() {
2
- var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
3
- var percentage = Math.floor(value * 100);
4
- return "".concat(percentage, "%");
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getValueAsPercentage = getValueAsPercentage;
7
+ function getValueAsPercentage(value = 0) {
8
+ const percentage = Math.floor(value * 100);
9
+ return `${percentage}%`;
5
10
  }
6
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["getValueAsPercentage","value","arguments","length","undefined","percentage","Math","floor","concat"],"sources":["../../../src/helpers/get-value-as-percentage/index.js"],"sourcesContent":["export function getValueAsPercentage(value = 0) {\n const percentage = Math.floor(value * 100)\n return `${percentage}%`\n}\n"],"mappings":"AAAA,OAAO,SAASA,oBAAoBA,CAAA,EAAY;EAAA,IAAXC,KAAK,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAC5C,IAAMG,UAAU,GAAGC,IAAI,CAACC,KAAK,CAACN,KAAK,GAAG,GAAG,CAAC;EAC1C,UAAAO,MAAA,CAAUH,UAAU;AACtB","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["getValueAsPercentage","value","percentage","Math","floor"],"sources":["../../../src/helpers/get-value-as-percentage/index.js"],"sourcesContent":["export function getValueAsPercentage(value = 0) {\r\n const percentage = Math.floor(value * 100)\r\n return `${percentage}%`\r\n}\r\n"],"mappings":";;;;;;AAAO,SAASA,oBAAoBA,CAACC,KAAK,GAAG,CAAC,EAAE;EAC9C,MAAMC,UAAU,GAAGC,IAAI,CAACC,KAAK,CAACH,KAAK,GAAG,GAAG,CAAC;EAC1C,OAAO,GAAGC,UAAU,GAAG;AACzB","ignoreList":[]}
@@ -1,7 +1,13 @@
1
- export function validateBase64Image(base64String) {
2
- var isJpeg = base64String.startsWith('data:image/jpeg;base64,');
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.validateBase64Image = validateBase64Image;
7
+ function validateBase64Image(base64String) {
8
+ const isJpeg = base64String.startsWith('data:image/jpeg;base64,');
3
9
  if (isJpeg) return validateJpegImage(base64String);
4
- var isPng = base64String.startsWith('data:image/png;base64,');
10
+ const isPng = base64String.startsWith('data:image/png;base64,');
5
11
  if (isPng) return validatePngImage(base64String);
6
12
  return false;
7
13
  }
@@ -9,23 +15,23 @@ export function validateBase64Image(base64String) {
9
15
  // See SO for more info: https://stackoverflow.com/a/41635312
10
16
  // Fiddle: https://jsfiddle.net/Lnyxuchw/
11
17
  function validateJpegImage(base64string) {
12
- var src = base64string;
13
- var base64Data = src.replace('data:image/jpeg;base64,', '');
14
- var imageData = new Uint8Array(Buffer.from(base64Data, 'base64'));
15
- var imageCorrupted = imageData[imageData.length - 1] === 217 && imageData[imageData.length - 2] === 255;
18
+ const src = base64string;
19
+ const base64Data = src.replace('data:image/jpeg;base64,', '');
20
+ const imageData = new Uint8Array(Buffer.from(base64Data, 'base64'));
21
+ const imageCorrupted = imageData[imageData.length - 1] === 217 && imageData[imageData.length - 2] === 255;
16
22
  return imageCorrupted;
17
23
  }
18
24
 
19
25
  // See SO for more info: https://stackoverflow.com/a/41635312
20
26
  // Fiddle: https://jsfiddle.net/Lnyxuchw/
21
27
  function validatePngImage(base64string) {
22
- var src = base64string;
23
- var base64Data = src.replace('data:image/png;base64,', '');
24
- var imageData = new Uint8Array(Buffer.from(base64Data, 'base64'));
25
- var sequence = [0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130];
28
+ const src = base64string;
29
+ const base64Data = src.replace('data:image/png;base64,', '');
30
+ const imageData = new Uint8Array(Buffer.from(base64Data, 'base64'));
31
+ const sequence = [0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130];
26
32
 
27
33
  //check last 12 elements of array so they contains needed values
28
- for (var i = 12; i > 0; i--) {
34
+ for (let i = 12; i > 0; i--) {
29
35
  if (imageData[imageData.length - i] !== sequence[12 - i]) {
30
36
  return false;
31
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["validateBase64Image","base64String","isJpeg","startsWith","validateJpegImage","isPng","validatePngImage","base64string","src","base64Data","replace","imageData","Uint8Array","Buffer","from","imageCorrupted","length","sequence","i"],"sources":["../../../src/helpers/image-validators/index.js"],"sourcesContent":["export function validateBase64Image(base64String) {\n const isJpeg = base64String.startsWith('data:image/jpeg;base64,')\n\n if (isJpeg) return validateJpegImage(base64String)\n\n const isPng = base64String.startsWith('data:image/png;base64,')\n\n if (isPng) return validatePngImage(base64String)\n\n return false\n}\n\n// See SO for more info: https://stackoverflow.com/a/41635312\n// Fiddle: https://jsfiddle.net/Lnyxuchw/\nfunction validateJpegImage(base64string) {\n const src = base64string\n const base64Data = src.replace('data:image/jpeg;base64,', '')\n const imageData = new Uint8Array(Buffer.from(base64Data, 'base64'))\n const imageCorrupted =\n imageData[imageData.length - 1] === 217 &&\n imageData[imageData.length - 2] === 255\n\n return imageCorrupted\n}\n\n// See SO for more info: https://stackoverflow.com/a/41635312\n// Fiddle: https://jsfiddle.net/Lnyxuchw/\nfunction validatePngImage(base64string) {\n const src = base64string\n const base64Data = src.replace('data:image/png;base64,', '')\n const imageData = new Uint8Array(Buffer.from(base64Data, 'base64'))\n const sequence = [0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130]\n\n //check last 12 elements of array so they contains needed values\n for (let i = 12; i > 0; i--) {\n if (imageData[imageData.length - i] !== sequence[12 - i]) {\n return false\n }\n }\n\n return true\n}\n"],"mappings":"AAAA,OAAO,SAASA,mBAAmBA,CAACC,YAAY,EAAE;EAChD,IAAMC,MAAM,GAAGD,YAAY,CAACE,UAAU,CAAC,yBAAyB,CAAC;EAEjE,IAAID,MAAM,EAAE,OAAOE,iBAAiB,CAACH,YAAY,CAAC;EAElD,IAAMI,KAAK,GAAGJ,YAAY,CAACE,UAAU,CAAC,wBAAwB,CAAC;EAE/D,IAAIE,KAAK,EAAE,OAAOC,gBAAgB,CAACL,YAAY,CAAC;EAEhD,OAAO,KAAK;AACd;;AAEA;AACA;AACA,SAASG,iBAAiBA,CAACG,YAAY,EAAE;EACvC,IAAMC,GAAG,GAAGD,YAAY;EACxB,IAAME,UAAU,GAAGD,GAAG,CAACE,OAAO,CAAC,yBAAyB,EAAE,EAAE,CAAC;EAC7D,IAAMC,SAAS,GAAG,IAAIC,UAAU,CAACC,MAAM,CAACC,IAAI,CAACL,UAAU,EAAE,QAAQ,CAAC,CAAC;EACnE,IAAMM,cAAc,GAClBJ,SAAS,CAACA,SAAS,CAACK,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,IACvCL,SAAS,CAACA,SAAS,CAACK,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG;EAEzC,OAAOD,cAAc;AACvB;;AAEA;AACA;AACA,SAAST,gBAAgBA,CAACC,YAAY,EAAE;EACtC,IAAMC,GAAG,GAAGD,YAAY;EACxB,IAAME,UAAU,GAAGD,GAAG,CAACE,OAAO,CAAC,wBAAwB,EAAE,EAAE,CAAC;EAC5D,IAAMC,SAAS,GAAG,IAAIC,UAAU,CAACC,MAAM,CAACC,IAAI,CAACL,UAAU,EAAE,QAAQ,CAAC,CAAC;EACnE,IAAMQ,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC;;EAE/D;EACA,KAAK,IAAIC,CAAC,GAAG,EAAE,EAAEA,CAAC,GAAG,CAAC,EAAEA,CAAC,EAAE,EAAE;IAC3B,IAAIP,SAAS,CAACA,SAAS,CAACK,MAAM,GAAGE,CAAC,CAAC,KAAKD,QAAQ,CAAC,EAAE,GAAGC,CAAC,CAAC,EAAE;MACxD,OAAO,KAAK;IACd;EACF;EAEA,OAAO,IAAI;AACb","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["validateBase64Image","base64String","isJpeg","startsWith","validateJpegImage","isPng","validatePngImage","base64string","src","base64Data","replace","imageData","Uint8Array","Buffer","from","imageCorrupted","length","sequence","i"],"sources":["../../../src/helpers/image-validators/index.js"],"sourcesContent":["export function validateBase64Image(base64String) {\r\n const isJpeg = base64String.startsWith('data:image/jpeg;base64,')\r\n\r\n if (isJpeg) return validateJpegImage(base64String)\r\n\r\n const isPng = base64String.startsWith('data:image/png;base64,')\r\n\r\n if (isPng) return validatePngImage(base64String)\r\n\r\n return false\r\n}\r\n\r\n// See SO for more info: https://stackoverflow.com/a/41635312\r\n// Fiddle: https://jsfiddle.net/Lnyxuchw/\r\nfunction validateJpegImage(base64string) {\r\n const src = base64string\r\n const base64Data = src.replace('data:image/jpeg;base64,', '')\r\n const imageData = new Uint8Array(Buffer.from(base64Data, 'base64'))\r\n const imageCorrupted =\r\n imageData[imageData.length - 1] === 217 &&\r\n imageData[imageData.length - 2] === 255\r\n\r\n return imageCorrupted\r\n}\r\n\r\n// See SO for more info: https://stackoverflow.com/a/41635312\r\n// Fiddle: https://jsfiddle.net/Lnyxuchw/\r\nfunction validatePngImage(base64string) {\r\n const src = base64string\r\n const base64Data = src.replace('data:image/png;base64,', '')\r\n const imageData = new Uint8Array(Buffer.from(base64Data, 'base64'))\r\n const sequence = [0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130]\r\n\r\n //check last 12 elements of array so they contains needed values\r\n for (let i = 12; i > 0; i--) {\r\n if (imageData[imageData.length - i] !== sequence[12 - i]) {\r\n return false\r\n }\r\n }\r\n\r\n return true\r\n}\r\n"],"mappings":";;;;;;AAAO,SAASA,mBAAmBA,CAACC,YAAY,EAAE;EAChD,MAAMC,MAAM,GAAGD,YAAY,CAACE,UAAU,CAAC,yBAAyB,CAAC;EAEjE,IAAID,MAAM,EAAE,OAAOE,iBAAiB,CAACH,YAAY,CAAC;EAElD,MAAMI,KAAK,GAAGJ,YAAY,CAACE,UAAU,CAAC,wBAAwB,CAAC;EAE/D,IAAIE,KAAK,EAAE,OAAOC,gBAAgB,CAACL,YAAY,CAAC;EAEhD,OAAO,KAAK;AACd;;AAEA;AACA;AACA,SAASG,iBAAiBA,CAACG,YAAY,EAAE;EACvC,MAAMC,GAAG,GAAGD,YAAY;EACxB,MAAME,UAAU,GAAGD,GAAG,CAACE,OAAO,CAAC,yBAAyB,EAAE,EAAE,CAAC;EAC7D,MAAMC,SAAS,GAAG,IAAIC,UAAU,CAACC,MAAM,CAACC,IAAI,CAACL,UAAU,EAAE,QAAQ,CAAC,CAAC;EACnE,MAAMM,cAAc,GAClBJ,SAAS,CAACA,SAAS,CAACK,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,IACvCL,SAAS,CAACA,SAAS,CAACK,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG;EAEzC,OAAOD,cAAc;AACvB;;AAEA;AACA;AACA,SAAST,gBAAgBA,CAACC,YAAY,EAAE;EACtC,MAAMC,GAAG,GAAGD,YAAY;EACxB,MAAME,UAAU,GAAGD,GAAG,CAACE,OAAO,CAAC,wBAAwB,EAAE,EAAE,CAAC;EAC5D,MAAMC,SAAS,GAAG,IAAIC,UAAU,CAACC,MAAM,CAACC,IAAI,CAACL,UAAU,EAAE,QAAQ,CAAC,CAAC;EACnE,MAAMQ,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC;;EAE/D;EACA,KAAK,IAAIC,CAAC,GAAG,EAAE,EAAEA,CAAC,GAAG,CAAC,EAAEA,CAAC,EAAE,EAAE;IAC3B,IAAIP,SAAS,CAACA,SAAS,CAACK,MAAM,GAAGE,CAAC,CAAC,KAAKD,QAAQ,CAAC,EAAE,GAAGC,CAAC,CAAC,EAAE;MACxD,OAAO,KAAK;IACd;EACF;EAEA,OAAO,IAAI;AACb","ignoreList":[]}