@lighthouse/common 6.1.0-canary.8 → 6.1.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.
- package/dist/helpers/get-audit-items-data/index.js +1 -1
- package/dist/pdf/audit/index.js +1 -1
- package/lib/helpers/fetch-image-for-web/index.js.map +1 -1
- package/lib/helpers/get-audit-items-data/index.js +1 -1
- package/lib/helpers/get-audit-items-data/index.js.map +1 -1
- package/lib/pdf/audit/index.js +1 -1
- package/lib/pdf/audit/index.js.map +1 -1
- package/package.json +1 -2
|
@@ -67,7 +67,7 @@ function getAuditItemsData(items, data) {
|
|
|
67
67
|
KeyPairId,
|
|
68
68
|
Signature
|
|
69
69
|
});
|
|
70
|
-
const link =
|
|
70
|
+
const link = `${awsS3BaseUrl}/${asset}`;
|
|
71
71
|
const thumbnailUrl = (0, _.buildFetchUrl)(asset, {
|
|
72
72
|
awsS3BaseUrl,
|
|
73
73
|
cloudfrontBaseUrl,
|
package/dist/pdf/audit/index.js
CHANGED
|
@@ -196,7 +196,7 @@ function generateContent(data) {
|
|
|
196
196
|
timezone
|
|
197
197
|
});
|
|
198
198
|
const promises = {
|
|
199
|
-
entry: (0, _helpers.buildAuditContent)(groupedData.items
|
|
199
|
+
entry: (0, _helpers.buildAuditContent)(groupedData.items),
|
|
200
200
|
footerTemplate: (0, _helpers.buildTemplateContent)(footerFields.formGroups, data),
|
|
201
201
|
headerTemplate: (0, _helpers.buildTemplateContent)(headerFields.formGroups, data)
|
|
202
202
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["imageNotFound","fetchLighthouseLogo","fetchImageForWeb","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","url","options","_options$isHeader","isHeader","Signature","Policy","KeyPairId","firstParamConnector","hasSignatureParams","constructedUrl","imageResponse","contentLengthHeader","_t","wrap","_context","prev","next","indexOf","includes","concat","console","debug","fetch","sent","headers","get","abrupt","Promise","reject","Error","encodedUrl","ok","arrayBuffer","error","stop","_x","_x2","apply","arguments"],"sources":["../../../src/helpers/fetch-image-for-web/index.js"],"sourcesContent":["import { imageNotFound } from '../../images'\nimport { fetchLighthouseLogo } from '../fetch-lighthouse-logo'\nexport const fetchImageForWeb = async function (url, options) {\n const { isHeader = false, Signature, Policy, KeyPairId } = options\n\n
|
|
1
|
+
{"version":3,"file":"index.js","names":["imageNotFound","fetchLighthouseLogo","fetchImageForWeb","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","url","options","_options$isHeader","isHeader","Signature","Policy","KeyPairId","firstParamConnector","hasSignatureParams","constructedUrl","imageResponse","contentLengthHeader","_t","wrap","_context","prev","next","indexOf","includes","concat","console","debug","fetch","sent","headers","get","abrupt","Promise","reject","Error","encodedUrl","ok","arrayBuffer","error","stop","_x","_x2","apply","arguments"],"sources":["../../../src/helpers/fetch-image-for-web/index.js"],"sourcesContent":["import { imageNotFound } from '../../images'\nimport { fetchLighthouseLogo } from '../fetch-lighthouse-logo'\nexport const fetchImageForWeb = async function (url, options) {\n const { isHeader = false, Signature, Policy, KeyPairId } = options\n\n try {\n const firstParamConnector = url.indexOf('?') > -1 ? '&' : '?'\n\n const hasSignatureParams =\n url.includes('Signature=') &&\n url.includes('Policy=') &&\n url.includes('Key-Pair-Id=')\n\n const constructedUrl = !hasSignatureParams\n ? `${url}${firstParamConnector}Signature=${Signature}&Policy=${Policy}&Key-Pair-Id=${KeyPairId}`\n : url\n\n console.debug('Fetching image via CloudFront For Web')\n\n const imageResponse = await fetch(constructedUrl)\n\n const contentLengthHeader = imageResponse.headers.get('content-length')\n\n if (contentLengthHeader === '0') {\n return Promise.reject(\n new Error(`Failed to fetch image as no content length: ${encodedUrl}`)\n )\n }\n\n if (!imageResponse.ok) {\n return Promise.reject(new Error(`Failed to fetch image: ${encodedUrl}`))\n }\n\n return await imageResponse.arrayBuffer()\n } catch (error) {\n if (isHeader) {\n // NOTE: Replace failed headers with LH logo\n console.error('FetchImageHeaderError', error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gBA,CAAAyC,EAAA,EAAAC,GAAA;IAAA,OAAAzC,IAAA,CAAA0C,KAAA,OAAAC,SAAA;EAAA;AAAA,GA0C5B","ignoreList":[]}
|
|
@@ -60,7 +60,7 @@ export function getAuditItemsData(items, data) {
|
|
|
60
60
|
KeyPairId: KeyPairId,
|
|
61
61
|
Signature: Signature
|
|
62
62
|
});
|
|
63
|
-
var link =
|
|
63
|
+
var link = "".concat(awsS3BaseUrl, "/").concat(asset);
|
|
64
64
|
var thumbnailUrl = buildFetchUrl(asset, _defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
65
65
|
awsS3BaseUrl: awsS3BaseUrl,
|
|
66
66
|
cloudfrontBaseUrl: cloudfrontBaseUrl,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["find","groupBy","map","get","round","buildFetchUrl","getAuditItemsData","items","data","_data$settings","settings","_data$settings2","awsS3BaseUrl","cloudinaryBaseUrl","cloudfrontBaseUrl","Policy","KeyPairId","Signature","shouldUseCloudfront","_data$entity","entity","_data$entity2","groupScores","groupedItems","auditData","overallActualScore","overallMaximumScore","groupIndex","key","skipped","group","title","label","groupData","groupMaximumScore","groupActualScore","groupResultScore","groupPercentageResultScore","currentGroupScores","max","actual","result","percentageResult","item","itemIndex","hasScore","score","rawAssets","assets","assetCount","length","asset","assetIndex","assetUrl","height","width","quality","fit","link","concat","
|
|
1
|
+
{"version":3,"file":"index.js","names":["find","groupBy","map","get","round","buildFetchUrl","getAuditItemsData","items","data","_data$settings","settings","_data$settings2","awsS3BaseUrl","cloudinaryBaseUrl","cloudfrontBaseUrl","Policy","KeyPairId","Signature","shouldUseCloudfront","_data$entity","entity","_data$entity2","groupScores","groupedItems","auditData","overallActualScore","overallMaximumScore","groupIndex","key","skipped","group","title","label","groupData","groupMaximumScore","groupActualScore","groupResultScore","groupPercentageResultScore","currentGroupScores","max","actual","result","percentageResult","item","itemIndex","hasScore","score","rawAssets","assets","assetCount","length","asset","assetIndex","assetUrl","height","width","quality","fit","link","concat","thumbnailUrl","_defineProperty","comments","matchingScore","scores","value","scoreLabel","scoreWeight","weight","questionId","_id"],"sources":["../../../src/helpers/get-audit-items-data/index.js"],"sourcesContent":["import { find, groupBy, map, get, round } from 'lodash'\n\nimport { buildFetchUrl } from '../'\n\nexport function getAuditItemsData(items, data) {\n const {\n settings: {\n awsS3BaseUrl,\n cloudinaryBaseUrl,\n cloudfrontBaseUrl,\n Policy,\n KeyPairId,\n Signature,\n shouldUseCloudfront,\n } = {},\n entity: { groupScores } = {},\n } = data\n\n const groupedItems = groupBy(items, 'group.id')\n\n const auditData = {\n overallActualScore: 0,\n overallMaximumScore: 0,\n }\n\n auditData.items = map(groupedItems, (items, groupIndex) => {\n const key = groupIndex\n const skipped = !!items[0].group.skipped\n const title = items[0].group.label\n\n const groupData = {\n key,\n groupMaximumScore: 0,\n groupActualScore: 0,\n groupResultScore: 0,\n groupPercentageResultScore: 0,\n skipped,\n title,\n }\n\n const currentGroupScores = get(groupScores, key)\n\n if (currentGroupScores) {\n groupData.groupMaximumScore = round(currentGroupScores.max, 2)\n groupData.groupActualScore = round(currentGroupScores.actual, 2)\n groupData.groupResultScore = currentGroupScores.result\n groupData.groupPercentageResultScore = currentGroupScores.percentageResult\n }\n\n groupData.items = items.map((item, itemIndex) => {\n // NOTE: we handle scores of -1, 0 and 1\n // -1 scores are skipped from group max and actual score\n // 0 and 1 must be included in the final scores\n const hasScore = item.score !== null && item.score !== -1\n const rawAssets = item.assets || []\n const assetCount = rawAssets.length\n\n const assets = rawAssets.map((asset, assetIndex) => {\n const assetUrl = buildFetchUrl(asset, {\n awsS3BaseUrl,\n cloudfrontBaseUrl,\n cloudinaryBaseUrl,\n height: 400,\n width: 600,\n quality: 50,\n fit: true,\n shouldUseCloudfront,\n Policy,\n KeyPairId,\n Signature,\n })\n\n const link = `${awsS3BaseUrl}/${asset}`\n\n const thumbnailUrl = buildFetchUrl(asset, {\n awsS3BaseUrl,\n cloudfrontBaseUrl,\n cloudinaryBaseUrl,\n shouldUseCloudfront,\n width: 100,\n quality: 50,\n fit: true,\n shouldUseCloudfront,\n Policy,\n KeyPairId,\n Signature,\n })\n\n const key = `${groupIndex}-item-asset-${assetIndex}`\n\n return {\n assetUrl,\n key,\n link,\n thumbnailUrl,\n }\n })\n\n const comments = item.comments\n const label = item.label\n const score = item.score\n const key = `${groupIndex}-item-${itemIndex}`\n const matchingScore = find(item.scores, { value: score })\n\n // NOTE: ensure we have a score otherwise fallback to - value\n const scoreLabel =\n hasScore && matchingScore && !skipped ? matchingScore.label : '-'\n const scoreWeight = hasScore && !skipped ? item.scoreWeight : '-'\n const weight = hasScore ? item.weight : '-'\n\n return {\n assetCount,\n assets,\n comments,\n key,\n label,\n questionId: item._id,\n score,\n scoreLabel,\n scoreWeight,\n weight,\n }\n })\n\n return groupData\n })\n\n return auditData\n}\n"],"mappings":";AAAA,SAASA,IAAI,EAAEC,OAAO,EAAEC,GAAG,EAAEC,GAAG,EAAEC,KAAK,QAAQ,QAAQ;AAEvD,SAASC,aAAa,QAAQ,KAAK;AAEnC,OAAO,SAASC,iBAAiBA,CAACC,KAAK,EAAEC,IAAI,EAAE;EAC7C,IAAAC,cAAA,GAWID,IAAI,CAVNE,QAAQ;IAAAC,eAAA,GAAAF,cAAA,cAQJ,CAAC,CAAC,GAAAA,cAAA;IAPJG,YAAY,GAAAD,eAAA,CAAZC,YAAY;IACZC,iBAAiB,GAAAF,eAAA,CAAjBE,iBAAiB;IACjBC,iBAAiB,GAAAH,eAAA,CAAjBG,iBAAiB;IACjBC,MAAM,GAAAJ,eAAA,CAANI,MAAM;IACNC,SAAS,GAAAL,eAAA,CAATK,SAAS;IACTC,SAAS,GAAAN,eAAA,CAATM,SAAS;IACTC,mBAAmB,GAAAP,eAAA,CAAnBO,mBAAmB;IAAAC,YAAA,GAGnBX,IAAI,CADNY,MAAM;IAAAC,aAAA,GAAAF,YAAA,cAAoB,CAAC,CAAC,GAAAA,YAAA;IAAlBG,WAAW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UACJE,YAAY,EAAZA;QACF,CAAC;MACH,CAAC,CAAC;MAEF,IAAME,QAAQ,GAAGnB,IAAI,CAACmB,QAAQ;MAC9B,IAAM9B,KAAK,GAAGW,IAAI,CAACX,KAAK;MACxB,IAAMc,KAAK,GAAGH,IAAI,CAACG,KAAK;MACxB,IAAMlB,GAAG,MAAA+B,MAAA,CAAMhC,UAAU,YAAAgC,MAAA,CAASf,SAAS,CAAE;MAC7C,IAAMmB,aAAa,GAAG/D,IAAI,CAAC2C,IAAI,CAACqB,MAAM,EAAE;QAAEC,KAAK,EAAEnB;MAAM,CAAC,CAAC;;MAEzD;MACA,IAAMoB,UAAU,GACdrB,QAAQ,IAAIkB,aAAa,IAAI,CAAClC,OAAO,GAAGkC,aAAa,CAAC/B,KAAK,GAAG,GAAG;MACnE,IAAMmC,WAAW,GAAGtB,QAAQ,IAAI,CAAChB,OAAO,GAAGc,IAAI,CAACwB,WAAW,GAAG,GAAG;MACjE,IAAMC,MAAM,GAAGvB,QAAQ,GAAGF,IAAI,CAACyB,MAAM,GAAG,GAAG;MAE3C,OAAO;QACLnB,UAAU,EAAVA,UAAU;QACVD,MAAM,EAANA,MAAM;QACNc,QAAQ,EAARA,QAAQ;QACRlC,GAAG,EAAHA,GAAG;QACHI,KAAK,EAALA,KAAK;QACLqC,UAAU,EAAE1B,IAAI,CAAC2B,GAAG;QACpBxB,KAAK,EAALA,KAAK;QACLoB,UAAU,EAAVA,UAAU;QACVC,WAAW,EAAXA,WAAW;QACXC,MAAM,EAANA;MACF,CAAC;IACH,CAAC,CAAC;IAEF,OAAOnC,SAAS;EAClB,CAAC,CAAC;EAEF,OAAOT,SAAS;AAClB","ignoreList":[]}
|
package/lib/pdf/audit/index.js
CHANGED
|
@@ -192,7 +192,7 @@ function generateContent(data) {
|
|
|
192
192
|
timezone: timezone
|
|
193
193
|
});
|
|
194
194
|
var promises = {
|
|
195
|
-
entry: buildAuditContent(groupedData.items
|
|
195
|
+
entry: buildAuditContent(groupedData.items),
|
|
196
196
|
footerTemplate: buildTemplateContent(footerFields.formGroups, data),
|
|
197
197
|
headerTemplate: buildTemplateContent(headerFields.formGroups, data)
|
|
198
198
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Promise","isEmpty","round","moment","buildAuditContent","buildAuditFollowUps","buildTemplateContent","generateDefinition","getFormattedAddress","horizontalLine","text","twoColumnTable","getAuditEntryDetails","buildAuditPdf","pdfOptions","data","entity","timezone","_pdfOptions$flags","flags","sequenceId","timestamp","createdAt","title","fileTitle","concat","generateContent","then","content","_objectSpread","type","catch","err","Error","message","_entity$followUps","followUps","_entity$footerFields","footerFields","_entity$gps","gps","_entity$headerFields","headerFields","_entity$score","score","_entity$title","entityDetails","gpsText","groupedData","locationText","referenceValue","timezoneHourTime","scoreText","target","targetServiceLevel","renderTargetFields","headerTitle","style","headerScore","alignment","firstRow","subTitle","headerSubTitle","colSpan","secondRow","reverseGeocoded","address","renderHeaderAddress","dummyColumn","headerAddress","renderThirdRow","thirdRow","serviceLevelBelow","serviceLevelText","scoreServiceLevelSubTitle","truncatedTargetPercent","scoreTargetText","scoreTargetSubTitle","scoreBreakdown","actual","max","scorePercentage","scoreTitle","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","widths","margin","totalScoreTable","hLineTop","hLineBottom","followUpItems","promises","entry","items","settings","footerTemplate","formGroups","headerTemplate","auditItemsTitle","font","lineHeight","props","_ref","_toConsumableArray"],"sources":["../../../src/pdf/audit/index.js"],"sourcesContent":["import Promise from 'bluebird'\nimport { isEmpty, round } from 'lodash'\nimport moment from 'moment-timezone'\n\nimport {\n buildAuditContent,\n buildAuditFollowUps,\n buildTemplateContent,\n generateDefinition,\n getFormattedAddress,\n horizontalLine,\n text,\n twoColumnTable,\n} from '../helpers'\nimport { getAuditEntryDetails } from '../../helpers'\n\n/**\n * buildAuditPdf\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} pdfOptions.flags - flags to conditionally render parts of the pdf\n * @param {object} data - pdf data\n * @param {object} data.entity - audit 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.cloudinaryBaseUrl - cloudinary base url\n * @param {string} data.timezone - timezone string\n * @param {object} data.users - application user documents\n * @returns {Promise} returns pdfmake definition object\n */\nexport function buildAuditPdf(pdfOptions, data) {\n const { entity, timezone } = data\n const { flags = {} } = pdfOptions\n\n const sequenceId = entity.sequenceId\n const timestamp = entity.createdAt\n const title = entity.title || 'Unknown'\n const fileTitle = `Audit Report - ${title}`\n\n return generateContent(data, flags)\n .then((content) =>\n generateDefinition({\n content,\n fileTitle,\n sequenceId,\n timestamp,\n timezone,\n type: 'Audit',\n ...pdfOptions,\n })\n )\n .catch((err) => {\n throw new Error(`BuildAuditPdfError: ${err.message}`)\n })\n}\n\nfunction generateContent(data) {\n const { entity } = data\n\n const {\n followUps = [],\n footerFields = {},\n gps = {},\n headerFields = {},\n score = {},\n title = 'Unknown',\n } = entity\n\n const timezone = entity?.timezone || data?.timezone || 'UTC'\n const entityDetails = getAuditEntryDetails(data)\n\n const {\n gpsText,\n groupedData,\n locationText,\n referenceValue,\n timezoneHourTime,\n scoreText,\n target,\n targetServiceLevel,\n } = entityDetails\n\n const renderTargetFields = !!targetServiceLevel\n const headerTitle = text(title, { style: 'title' })\n const headerScore = text(scoreText, { alignment: 'right', style: 'title' })\n const firstRow = [headerTitle, headerScore]\n const subTitle = `${\n locationText || gpsText\n } - ${timezoneHourTime} by ${referenceValue}`\n\n let headerSubTitle = text(subTitle, { colSpan: 2, style: 'subTitle' })\n let secondRow = [headerSubTitle]\n\n const reverseGeocoded = gps.reverseGeocoded\n const address = !isEmpty(reverseGeocoded)\n ? getFormattedAddress(reverseGeocoded)\n : ''\n const renderHeaderAddress = !isEmpty(reverseGeocoded)\n const dummyColumn = text(' ', { style: 'small' })\n\n let headerAddress = text(address, { colSpan: 2, style: 'small' })\n const renderThirdRow = renderHeaderAddress || renderTargetFields\n let thirdRow = renderHeaderAddress ? [headerAddress] : []\n\n if (renderTargetFields) {\n headerSubTitle = text(subTitle, { style: 'subTitle' })\n\n const serviceLevelBelow = targetServiceLevel === 'below'\n const serviceLevelText =\n targetServiceLevel === 'above'\n ? 'Above Target'\n : targetServiceLevel === 'on'\n ? 'On Target'\n : targetServiceLevel === 'below'\n ? 'Below Target'\n : ''\n\n const scoreServiceLevelSubTitle = text(serviceLevelText, {\n alignment: 'right',\n style: serviceLevelBelow ? 'serviceLevelBelow' : 'serviceLevelAboveOrOn',\n })\n\n secondRow = [headerSubTitle, scoreServiceLevelSubTitle]\n headerAddress = text(address, { style: 'small' })\n\n const truncatedTargetPercent = round(target, 2)\n const scoreTargetText = `(Target - ${truncatedTargetPercent}%)`\n const scoreTargetSubTitle = text(scoreTargetText, {\n alignment: 'right',\n style: 'subTitle',\n })\n\n thirdRow = renderHeaderAddress\n ? [headerAddress, scoreTargetSubTitle]\n : [dummyColumn, scoreTargetSubTitle]\n }\n\n const scoreBreakdown = text(\n `${round(score.actual, 2)} / ${round(score.max, 2)}`,\n {\n alignment: 'right',\n style: 'totalScore',\n }\n )\n const scorePercentage = text(scoreText, {\n alignment: 'right',\n colSpan: 2,\n style: 'totalAuditScore',\n })\n const scoreTitle = text('Total Score', { style: 'totalScore' })\n\n const body = renderThirdRow\n ? [firstRow, secondRow, thirdRow]\n : [firstRow, secondRow]\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 colSpan: 2,\n style: 'small',\n })\n\n if (entity.showSimplifiedDuration) {\n body.push([submittedAt, dummyColumn])\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 colSpan: 2,\n style: 'small',\n })\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 colSpan: 2,\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 colSpan: 2,\n style: 'small',\n }\n )\n\n body.push([startedAt, dummyColumn])\n body.push([submittedAt, dummyColumn])\n body.push([formDuration, dummyColumn])\n }\n\n const titleTable = twoColumnTable({\n body,\n layout: 'noBorders',\n style: 'titleTable',\n widths: ['*', 100],\n margin: [0, 0, 0, 30],\n })\n\n const totalScoreTable = twoColumnTable({\n body: [[scoreTitle, scoreBreakdown], [scorePercentage]],\n layout: 'noBorders',\n widths: ['*', 100],\n })\n\n const hLineTop = horizontalLine({ margin: [0, 10, 0, 0] })\n const hLineBottom = horizontalLine()\n\n const followUpItems = buildAuditFollowUps(followUps, { timezone })\n\n const promises = {\n entry: buildAuditContent(groupedData.items, data.settings),\n footerTemplate: buildTemplateContent(footerFields.formGroups, data),\n headerTemplate: buildTemplateContent(headerFields.formGroups, data),\n }\n\n const auditItemsTitle = [\n {\n text: 'Audit Items',\n style: {\n font: 'Gotham',\n lineHeight: 1.1,\n },\n },\n hLineTop,\n ]\n\n return Promise.props(promises)\n .then(({ entry, footerTemplate, headerTemplate }) => [\n titleTable,\n followUpItems,\n ...auditItemsTitle,\n ...headerTemplate,\n ...entry,\n hLineTop,\n totalScoreTable,\n hLineBottom,\n ...footerTemplate,\n ])\n .catch((err) => {\n throw new Error(`GenerateContentError: ${err.message}`)\n })\n}\n"],"mappings":";;;;AAAA,OAAOA,OAAO,MAAM,UAAU;AAC9B,SAASC,OAAO,EAAEC,KAAK,QAAQ,QAAQ;AACvC,OAAOC,MAAM,MAAM,iBAAiB;AAEpC,SACEC,iBAAiB,EACjBC,mBAAmB,EACnBC,oBAAoB,EACpBC,kBAAkB,EAClBC,mBAAmB,EACnBC,cAAc,EACdC,IAAI,EACJC,cAAc,QACT,YAAY;AACnB,SAASC,oBAAoB,QAAQ,eAAe;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAACC,UAAU,EAAEC,IAAI,EAAE;EAC9C,IAAQC,MAAM,GAAeD,IAAI,CAAzBC,MAAM;IAAEC,QAAQ,GAAKF,IAAI,CAAjBE,QAAQ;EACxB,IAAAC,iBAAA,GAAuBJ,UAAU,CAAzBK,KAAK;IAALA,KAAK,GAAAD,iBAAA,cAAG,CAAC,CAAC,GAAAA,iBAAA;EAElB,IAAME,UAAU,GAAGJ,MAAM,CAACI,UAAU;EACpC,IAAMC,SAAS,GAAGL,MAAM,CAACM,SAAS;EAClC,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round","moment","buildAuditContent","buildAuditFollowUps","buildTemplateContent","generateDefinition","getFormattedAddress","horizontalLine","text","twoColumnTable","getAuditEntryDetails","buildAuditPdf","pdfOptions","data","entity","timezone","_pdfOptions$flags","flags","sequenceId","timestamp","createdAt","title","fileTitle","concat","generateContent","then","content","_objectSpread","type","catch","err","Error","message","_entity$followUps","followUps","_entity$footerFields","footerFields","_entity$gps","gps","_entity$headerFields","headerFields","_entity$score","score","_entity$title","entityDetails","gpsText","groupedData","locationText","referenceValue","timezoneHourTime","scoreText","target","targetServiceLevel","renderTargetFields","headerTitle","style","headerScore","alignment","firstRow","subTitle","headerSubTitle","colSpan","secondRow","reverseGeocoded","address","renderHeaderAddress","dummyColumn","headerAddress","renderThirdRow","thirdRow","serviceLevelBelow","serviceLevelText","scoreServiceLevelSubTitle","truncatedTargetPercent","scoreTargetText","scoreTargetSubTitle","scoreBreakdown","actual","max","scorePercentage","scoreTitle","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","widths","margin","totalScoreTable","hLineTop","hLineBottom","followUpItems","promises","entry","items","footerTemplate","formGroups","headerTemplate","auditItemsTitle","font","lineHeight","props","_ref","_toConsumableArray"],"sources":["../../../src/pdf/audit/index.js"],"sourcesContent":["import Promise from 'bluebird'\nimport { isEmpty, round } from 'lodash'\nimport moment from 'moment-timezone'\n\nimport {\n buildAuditContent,\n buildAuditFollowUps,\n buildTemplateContent,\n generateDefinition,\n getFormattedAddress,\n horizontalLine,\n text,\n twoColumnTable,\n} from '../helpers'\nimport { getAuditEntryDetails } from '../../helpers'\n\n/**\n * buildAuditPdf\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} pdfOptions.flags - flags to conditionally render parts of the pdf\n * @param {object} data - pdf data\n * @param {object} data.entity - audit 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.cloudinaryBaseUrl - cloudinary base url\n * @param {string} data.timezone - timezone string\n * @param {object} data.users - application user documents\n * @returns {Promise} returns pdfmake definition object\n */\nexport function buildAuditPdf(pdfOptions, data) {\n const { entity, timezone } = data\n const { flags = {} } = pdfOptions\n\n const sequenceId = entity.sequenceId\n const timestamp = entity.createdAt\n const title = entity.title || 'Unknown'\n const fileTitle = `Audit Report - ${title}`\n\n return generateContent(data, flags)\n .then(content =>\n generateDefinition({\n content,\n fileTitle,\n sequenceId,\n timestamp,\n timezone,\n type: 'Audit',\n ...pdfOptions,\n })\n )\n .catch(err => {\n throw new Error(`BuildAuditPdfError: ${err.message}`)\n })\n}\n\nfunction generateContent(data) {\n const { entity } = data\n\n const {\n followUps = [],\n footerFields = {},\n gps = {},\n headerFields = {},\n score = {},\n title = 'Unknown',\n } = entity\n\n const timezone = entity?.timezone || data?.timezone || 'UTC'\n const entityDetails = getAuditEntryDetails(data)\n\n const {\n gpsText,\n groupedData,\n locationText,\n referenceValue,\n timezoneHourTime,\n scoreText,\n target,\n targetServiceLevel,\n } = entityDetails\n\n const renderTargetFields = !!targetServiceLevel\n const headerTitle = text(title, { style: 'title' })\n const headerScore = text(scoreText, { alignment: 'right', style: 'title' })\n const firstRow = [headerTitle, headerScore]\n const subTitle = `${locationText ||\n gpsText} - ${timezoneHourTime} by ${referenceValue}`\n\n let headerSubTitle = text(subTitle, { colSpan: 2, style: 'subTitle' })\n let secondRow = [headerSubTitle]\n\n const reverseGeocoded = gps.reverseGeocoded\n const address = !isEmpty(reverseGeocoded)\n ? getFormattedAddress(reverseGeocoded)\n : ''\n const renderHeaderAddress = !isEmpty(reverseGeocoded)\n const dummyColumn = text(' ', { style: 'small' })\n\n let headerAddress = text(address, { colSpan: 2, style: 'small' })\n const renderThirdRow = renderHeaderAddress || renderTargetFields\n let thirdRow = renderHeaderAddress ? [headerAddress] : []\n\n if (renderTargetFields) {\n headerSubTitle = text(subTitle, { style: 'subTitle' })\n\n const serviceLevelBelow = targetServiceLevel === 'below'\n const serviceLevelText =\n targetServiceLevel === 'above'\n ? 'Above Target'\n : targetServiceLevel === 'on'\n ? 'On Target'\n : targetServiceLevel === 'below'\n ? 'Below Target'\n : ''\n\n const scoreServiceLevelSubTitle = text(serviceLevelText, {\n alignment: 'right',\n style: serviceLevelBelow ? 'serviceLevelBelow' : 'serviceLevelAboveOrOn',\n })\n\n secondRow = [headerSubTitle, scoreServiceLevelSubTitle]\n headerAddress = text(address, { style: 'small' })\n\n const truncatedTargetPercent = round(target, 2)\n const scoreTargetText = `(Target - ${truncatedTargetPercent}%)`\n const scoreTargetSubTitle = text(scoreTargetText, {\n alignment: 'right',\n style: 'subTitle',\n })\n\n thirdRow = renderHeaderAddress\n ? [headerAddress, scoreTargetSubTitle]\n : [dummyColumn, scoreTargetSubTitle]\n }\n\n const scoreBreakdown = text(\n `${round(score.actual, 2)} / ${round(score.max, 2)}`,\n {\n alignment: 'right',\n style: 'totalScore',\n }\n )\n const scorePercentage = text(scoreText, {\n alignment: 'right',\n colSpan: 2,\n style: 'totalAuditScore',\n })\n const scoreTitle = text('Total Score', { style: 'totalScore' })\n\n const body = renderThirdRow\n ? [firstRow, secondRow, thirdRow]\n : [firstRow, secondRow]\n\n const submittedAtInTimezone = entity.submittedAt\n ? moment(entity.submittedAt)\n .tz(timezone)\n .format('YYYY-MM-DD HH:mm:ss z')\n : 'Not recorded'\n const submittedAt = text(`Submitted: ${submittedAtInTimezone}`, {\n colSpan: 2,\n style: 'small',\n })\n\n if (entity.showSimplifiedDuration) {\n body.push([submittedAt, dummyColumn])\n } else {\n const startedAtInTimezone = entity.startedAt\n ? moment(entity.startedAt)\n .tz(timezone)\n .format('YYYY-MM-DD HH:mm:ss z')\n : 'Not recorded'\n const startedAt = text(`Started: ${startedAtInTimezone}`, {\n colSpan: 2,\n style: 'small',\n })\n\n const submittedAtInTimezone = entity.submittedAt\n ? moment(entity.submittedAt)\n .tz(timezone)\n .format('YYYY-MM-DD HH:mm:ss z')\n : 'Not recorded'\n const submittedAt = text(`Submitted: ${submittedAtInTimezone}`, {\n colSpan: 2,\n style: 'small',\n })\n\n const momentDuration = moment.duration(Math.abs(entity.formDuration))\n const days = Math.floor(momentDuration.asDays())\n .toString()\n .padStart(2, '0')\n const hours = Math.floor(momentDuration.hours())\n .toString()\n .padStart(2, '0')\n const minutes = momentDuration\n .minutes()\n .toString()\n .padStart(2, '0')\n const seconds = momentDuration\n .seconds()\n .toString()\n .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 colSpan: 2,\n style: 'small',\n }\n )\n\n body.push([startedAt, dummyColumn])\n body.push([submittedAt, dummyColumn])\n body.push([formDuration, dummyColumn])\n }\n\n const titleTable = twoColumnTable({\n body,\n layout: 'noBorders',\n style: 'titleTable',\n widths: ['*', 100],\n margin: [0, 0, 0, 30],\n })\n\n const totalScoreTable = twoColumnTable({\n body: [[scoreTitle, scoreBreakdown], [scorePercentage]],\n layout: 'noBorders',\n widths: ['*', 100],\n })\n\n const hLineTop = horizontalLine({ margin: [0, 10, 0, 0] })\n const hLineBottom = horizontalLine()\n\n const followUpItems = buildAuditFollowUps(followUps, { timezone })\n\n const promises = {\n entry: buildAuditContent(groupedData.items),\n footerTemplate: buildTemplateContent(footerFields.formGroups, data),\n headerTemplate: buildTemplateContent(headerFields.formGroups, data),\n }\n\n const auditItemsTitle = [\n {\n text: 'Audit Items',\n style: {\n font: 'Gotham',\n lineHeight: 1.1,\n },\n },\n hLineTop,\n ]\n\n return Promise.props(promises)\n .then(({ entry, footerTemplate, headerTemplate }) => [\n titleTable,\n followUpItems,\n ...auditItemsTitle,\n ...headerTemplate,\n ...entry,\n hLineTop,\n totalScoreTable,\n hLineBottom,\n ...footerTemplate,\n ])\n .catch(err => {\n throw new Error(`GenerateContentError: ${err.message}`)\n })\n}\n"],"mappings":";;;;AAAA,OAAOA,OAAO,MAAM,UAAU;AAC9B,SAASC,OAAO,EAAEC,KAAK,QAAQ,QAAQ;AACvC,OAAOC,MAAM,MAAM,iBAAiB;AAEpC,SACEC,iBAAiB,EACjBC,mBAAmB,EACnBC,oBAAoB,EACpBC,kBAAkB,EAClBC,mBAAmB,EACnBC,cAAc,EACdC,IAAI,EACJC,cAAc,QACT,YAAY;AACnB,SAASC,oBAAoB,QAAQ,eAAe;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAACC,UAAU,EAAEC,IAAI,EAAE;EAC9C,IAAQC,MAAM,GAAeD,IAAI,CAAzBC,MAAM;IAAEC,QAAQ,GAAKF,IAAI,CAAjBE,QAAQ;EACxB,IAAAC,iBAAA,GAAuBJ,UAAU,CAAzBK,KAAK;IAALA,KAAK,GAAAD,iBAAA,cAAG,CAAC,CAAC,GAAAA,iBAAA;EAElB,IAAME,UAAU,GAAGJ,MAAM,CAACI,UAAU;EACpC,IAAMC,SAAS,GAAGL,MAAM,CAACM,SAAS;EAClC,IAAMC,KAAK,GAAGP,MAAM,CAACO,KAAK,IAAI,SAAS;EACvC,IAAMC,SAAS,qBAAAC,MAAA,CAAqBF,KAAK,CAAE;EAE3C,OAAOG,eAAe,CAACX,IAAI,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5G,mBAAmB,CAAC+B,SAAS,EAAE;IAAEnB,QAAQ,EAARA;EAAS,CAAC,CAAC;EAElE,IAAMiG,QAAQ,GAAG;IACfC,KAAK,EAAE/G,iBAAiB,CAAC4C,WAAW,CAACoE,KAAK,CAAC;IAC3CC,cAAc,EAAE/G,oBAAoB,CAACgC,YAAY,CAACgF,UAAU,EAAEvG,IAAI,CAAC;IACnEwG,cAAc,EAAEjH,oBAAoB,CAACoC,YAAY,CAAC4E,UAAU,EAAEvG,IAAI;EACpE,CAAC;EAED,IAAMyG,eAAe,GAAG,CACtB;IACE9G,IAAI,EAAE,aAAa;IACnB+C,KAAK,EAAE;MACLgE,IAAI,EAAE,QAAQ;MACdC,UAAU,EAAE;IACd;EACF,CAAC,EACDX,QAAQ,CACT;EAED,OAAO/G,OAAO,CAAC2H,KAAK,CAACT,QAAQ,CAAC,CAC3BvF,IAAI,CAAC,UAAAiG,IAAA;IAAA,IAAGT,KAAK,GAAAS,IAAA,CAALT,KAAK;MAAEE,cAAc,GAAAO,IAAA,CAAdP,cAAc;MAAEE,cAAc,GAAAK,IAAA,CAAdL,cAAc;IAAA,QAC5Cb,UAAU,EACVO,aAAa,EAAAxF,MAAA,CACV+F,eAAe,EAAAK,kBAAA,CACfN,cAAc,GAAAM,kBAAA,CACdV,KAAK,IACRJ,QAAQ,EACRD,eAAe,EACfE,WAAW,GAAAa,kBAAA,CACRR,cAAc;EAAA,CAClB,CAAC,CACDtF,KAAK,CAAC,UAAAC,GAAG,EAAI;IACZ,MAAM,IAAIC,KAAK,0BAAAR,MAAA,CAA0BO,GAAG,CAACE,OAAO,CAAE,CAAC;EACzD,CAAC,CAAC;AACN","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lighthouse/common",
|
|
3
|
-
"version": "6.1.0
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"watch": "yarn clear:es && babel src --out-dir lib --extensions '.js,.ts' --ignore 'src/**/fixtures.js,src/**/fixtures/*,src/**/*.story.js,src/**/*.story.ts,src/**/*.test.js,src/**/*.test.ts' --source-maps --watch",
|
|
9
8
|
"build": "yarn clear && yarn build:es && yarn build:node",
|
|
10
9
|
"build:es": "yarn clear:es && babel src --out-dir lib --extensions '.js,.ts' --ignore 'src/**/fixtures.js,src/**/fixtures/*,src/**/*.story.js,src/**/*.story.ts,src/**/*.test.js,src/**/*.test.ts' --source-maps",
|
|
11
10
|
"build:node": "yarn clear:node && BABEL_ENV=node babel src --out-dir dist --extensions '.js,.ts' --ignore 'src/**/fixtures.js,src/**/fixtures/*,src/**/*.story.js,src/**/*.story.ts,src/**/*.test.js,src/**/*.test.ts'",
|