Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lighthouse/common

Package Overview
Dependencies
Maintainers
6
Versions
461
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lighthouse/common - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

2

dist/lighthouse-common.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("lodash"),require("moment"),require("bluebird"),require("moment-timezone"),require("fetch-ponyfill")):"function"==typeof define&&define.amd?define(["lodash","moment","bluebird","moment-timezone","fetch-ponyfill"],t):"object"==typeof exports?exports["lighthouse-common"]=t(require("lodash"),require("moment"),require("bluebird"),require("moment-timezone"),require("fetch-ponyfill")):e["lighthouse-common"]=t(e._,e.moment,e.bluebird,e["moment-timezone"],e["fetch-ponyfill"])}(window,function(e,t,n,r,o){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=41)}([function(t,n){t.exports=e},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(39);Object.defineProperty(t,"buildAuditContent",{enumerable:!0,get:function(){return r.buildAuditContent}});var o=n(38);Object.defineProperty(t,"buildFetchUrl",{enumerable:!0,get:function(){return o.buildFetchUrl}});var i=n(37);Object.defineProperty(t,"buildTemplateContent",{enumerable:!0,get:function(){return i.buildTemplateContent}});var u=n(36);Object.defineProperty(t,"defaultFooter",{enumerable:!0,get:function(){return u.defaultFooter}});var a=n(35);Object.defineProperty(t,"defaultHeader",{enumerable:!0,get:function(){return a.defaultHeader}});var l=n(34);Object.defineProperty(t,"defaultStyles",{enumerable:!0,get:function(){return l.defaultStyles}});var s=n(33);Object.defineProperty(t,"fetchImage",{enumerable:!0,get:function(){return s.fetchImage}});var c=n(31);Object.defineProperty(t,"generateDefinition",{enumerable:!0,get:function(){return c.generateDefinition}});var f=n(30);Object.defineProperty(t,"getAssigneesFullNames",{enumerable:!0,get:function(){return f.getAssigneesFullNames}});var d=n(29);Object.defineProperty(t,"getAuditEntryDetails",{enumerable:!0,get:function(){return d.getAuditEntryDetails}});var m=n(28);Object.defineProperty(t,"getAuditItemsData",{enumerable:!0,get:function(){return m.getAuditItemsData}});var b=n(27);Object.defineProperty(t,"getEntityProperty",{enumerable:!0,get:function(){return b.getEntityProperty}});var g=n(26);Object.defineProperty(t,"getGeometryGeocodedString",{enumerable:!0,get:function(){return g.getGeometryGeocodedString}});var p=n(25);Object.defineProperty(t,"getIssueDetails",{enumerable:!0,get:function(){return p.getIssueDetails}});var y=n(24);Object.defineProperty(t,"getJobDetails",{enumerable:!0,get:function(){return y.getJobDetails}});var h=n(23);Object.defineProperty(t,"getLocationText",{enumerable:!0,get:function(){return h.getLocationText}});var v=n(22);Object.defineProperty(t,"getPrettyDuration",{enumerable:!0,get:function(){return v.getPrettyDuration}});var _=n(21);Object.defineProperty(t,"getReferenceDetails",{enumerable:!0,get:function(){return _.getReferenceDetails}});var T=n(20);Object.defineProperty(t,"getStatusDetails",{enumerable:!0,get:function(){return T.getStatusDetails}});var x=n(19);Object.defineProperty(t,"getTaskEntryDetails",{enumerable:!0,get:function(){return x.getTaskEntryDetails}});var O=n(18);Object.defineProperty(t,"getTimezoneDatetime",{enumerable:!0,get:function(){return O.getTimezoneDatetime}});var P=n(17);Object.defineProperty(t,"getUserFullName",{enumerable:!0,get:function(){return P.getUserFullName}});var j=n(16);Object.defineProperty(t,"getValueAsPercentage",{enumerable:!0,get:function(){return j.getValueAsPercentage}});var D=n(15);Object.defineProperty(t,"horizontalLine",{enumerable:!0,get:function(){return D.horizontalLine}});var A=n(14);Object.defineProperty(t,"imagesTable",{enumerable:!0,get:function(){return A.imagesTable}});var L=n(13);Object.defineProperty(t,"parseValue",{enumerable:!0,get:function(){return L.parseValue}});var S=n(12);Object.defineProperty(t,"table",{enumerable:!0,get:function(){return S.table}}),Object.defineProperty(t,"twoColumnTable",{enumerable:!0,get:function(){return S.twoColumnTable}}),Object.defineProperty(t,"fourColumnTable",{enumerable:!0,get:function(){return S.fourColumnTable}});var E=n(11);Object.defineProperty(t,"text",{enumerable:!0,get:function(){return E.text}})},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});t.ENVIRONMENT=e.env.ENVIRONMENT||"development",t.AWS_S3_BASE_URL=e.env.AWS_S3_BASE_URL||"https://uploads-test-lighthouse-io.s3.amazonaws.com",t.CLOUDINARY_BASE_URL=e.env.CLOUDINARY_BASE_URL||"https://res.cloudinary.com/lighthouseio/image/fetch",t.DEFAULT_IMAGE_ROW_LENGTH=3,t.DEFAULT_PAGE_MARGINS=[60,110,60,80],t.DEFAULT_PAGE_ORIENTATION="portrait",t.DEFAULT_PAGE_SIZE="A4",t.DEFAULT_TITLE="Lighthouse.io",t.LIGHTHOUSE_LOGO_URL="https://s3.amazonaws.com/assets-lighthouse-io/img/logo-medium.png"}).call(this,n(40))},function(e,t){e.exports=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.buildTaskPdf=function(e,t){const n=`Task Report - ${(0,o.get)(t,"entity.title","Unknown")}`;return function(e){const{entity:t}=e,{entry:n,title:r}=t,o=(0,i.getTaskEntryDetails)(e),u=[[{text:"Title",bold:!0},r],[{text:"Location",bold:!0},o.locationText],[{text:"GPS Location",bold:!0},o.gpsText],[{text:o.referenceLabel,bold:!0},o.referenceValue],[{text:"Created",bold:!0},o.timezoneDatetime]],a=(0,i.text)("Task Report",{style:"h1"}),l=(0,i.twoColumnTable)({body:u});return(0,i.buildTemplateContent)(n.formGroups).then(({details:e=[],photos:t=[]})=>[a,l,...e,...t])}(t).then(t=>(0,i.generateDefinition)(r({content:t,fileTitle:n},e)))};var o=n(0),i=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.buildJobPdf=function(e,t){const n=`Job Report - ${(0,o.get)(t,"entity.title","Unknown")}`,l=function(e){const{entity:t}=e,{title:n}=t,r=(0,u.getJobDetails)(e),l=[[{text:"Location",bold:!0},r.locationText],[{text:"Author",bold:!0},r.authorFullName],[{text:"Reference",bold:!0},r.reference],[{text:"Description",bold:!0},r.description],[{text:"Due Date",bold:!0},r.dueDateTimezoneDateTime],[{text:"Assignees",bold:!0},r.assigneeNames],[{text:"Status",bold:!0},{text:r.statusText,color:r.statusColor}],[{text:"Created",bold:!0},r.createdTimezoneDateTime],[{text:"Timezone",bold:!0},r.timezoneAbbrText]],s=(0,u.text)(`Job Report: ${n}`,{style:"h1"}),c=(0,u.twoColumnTable)({body:l}),f=(0,u.text)("Job Activities",{style:"h2"}),d=function(e){const{jobActivities:t,timezone:n,users:r}=e;if((0,o.isEmpty)(t))return{body:[["No Job Activities Data"]],widths:"*"};const l=(0,o.map)(t,e=>{const{entity:t}=e,{type:a,duration:l,user:s,start:c={},end:f={}}=t,d=(0,u.getUserFullName)(r,s),m=i.default.duration(l,"minutes"),b=l?(0,u.getPrettyDuration)(m):"-",g=c.time,p=(0,o.get)(c,"geometryReverseGeocoded.label","-"),y=f.time,h=(0,o.get)(f,"geometryReverseGeocoded.label","-"),v=g?(0,u.getTimezoneDatetime)(g,n,!1):"-",_=y?(0,u.getTimezoneDatetime)(y,n,!1):"-";return[a,d,v,p,_,h,b]});return{body:[a,...l],widths:[70,80,60,"*",60,"*",50]}}(e),m=(0,u.table)(d);return[s,c,f,(0,u.horizontalLine)(),m,(0,u.horizontalLine)()]}(t);return(0,u.generateDefinition)(r({content:l,fileTitle:n,pageOrientation:"landscape"},e))};var o=n(0),i=function(e){return e&&e.__esModule?e:{default:e}}(n(2)),u=n(1);const a=[{text:"Type",bold:!0},{text:"User",bold:!0},{text:"Start Time",bold:!0},{text:"Start Location",bold:!0},{text:"End Time",bold:!0},{text:"End Location",bold:!0},{text:"Duration",bold:!0}]},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.buildIssuePdf=function(e,t){const n=`Issue Report - ${(0,o.get)(t,"entity.title","Unknown")}`;return function(e){const{entity:t,timezone:n}=e,{entry:r,title:a,timeline:l=[]}=t,s=(0,i.getIssueDetails)(e),c=(0,o.map)(l,u),f=[[{text:"Title",bold:!0},a],[{text:"Status",bold:!0},{text:s.statusText,color:s.statusColor}],[{text:"Assignees",bold:!0},s.assigneeNames],[{text:"Location",bold:!0},s.locationText],[{text:"GPS Location",bold:!0},s.gpsText],[{text:"Raised by",bold:!0},s.fullName],[{text:"Created",bold:!0},s.timezoneDatetime]];s.isClosedStatus&&f.push([{text:"Duration",bold:!0},s.durationText]);const d=(0,o.isEmpty)(c)?[["No Timeline data"]]:(0,o.map)(c,function(e){return t=>{const{text:n,timestamp:r}=t,o=(0,i.getTimezoneDatetime)(r,e);return[{text:o,bold:!0},n]}}(n)),m=(0,i.text)("Issue Report",{style:"h1"}),b=(0,i.twoColumnTable)({body:f}),g=(0,i.text)("Timeline",{style:"h2"}),p=(0,i.horizontalLine)(),y=(0,i.twoColumnTable)({body:d});return(0,i.buildTemplateContent)(r.formGroups).then(({details:e=[],photos:t=[]})=>[m,b,g,p,y,...e,...t])}(t).then(t=>(0,i.generateDefinition)(r({content:t,fileTitle:n},e)))};var o=n(0),i=n(1);function u(e){const{_id:t,meta:n={},timestamp:r}=e,{field:u}=n;let a;return{_id:t,text:a="status"===u?function(e){const{meta:t,source:n,type:r}=e,u=(0,o.get)(t,"next"),a=(0,o.get)(n,"meta.firstName"),l=(0,o.get)(n,"meta.lastName"),s=a&&l?`${a} ${l}`:"Unknown User",c="issue-new"===r,f="issue-update"===r,d="open"===u,m=(0,i.getStatusDetails)(u).text;return c&&d?`Issue opened by ${s}`:c&&!d?`Issue opened with status ${m} by ${s}`:f?`Issue updated to ${m} by ${s}`:"Unknown status timeline change"}(e):null,timestamp:r}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.buildAuditPdf=function(e,t){const n=`Audit Report - ${(0,o.get)(t,"entity.title","Unknown")}`;return function(e){const{entity:t}=e,{footerFields:n={},headerFields:r={},title:a="Unknown"}=t,l=(0,u.getAuditEntryDetails)(e),s=[[{text:"Title",bold:!0},a],[{text:"Location",bold:!0},l.locationText],[{text:"GPS Location",bold:!0},l.gpsText],[{text:l.referenceLabel,bold:!0},l.referenceValue],[{text:"Created",bold:!0},l.timezoneDatetime],[{text:"Score",bold:!0},l.scoreText]],c=[[{text:"Total Score",bold:!0},`${l.groupedData.overallActualScore} / ${l.groupedData.overallMaximumScore}`]],f=(0,u.text)("Audit Report",{style:"h2"}),d=(0,u.twoColumnTable)({body:s}),m=(0,u.text)("Details",{style:"h2"}),b=(0,u.twoColumnTable)({body:c,style:{fontSize:12},margin:[0,20,0,10]}),g={entry:(0,u.buildAuditContent)(l.groupedData.items),footer:(0,u.buildTemplateContent)(n.formGroups),header:(0,u.buildTemplateContent)(r.formGroups)};return i.default.props(g).then(({entry:e,footer:t,header:n})=>{const{details:r=[],photos:i=[]}=e,{details:u=[],photos:a=[]}=t,{details:l=[],photos:s=[]}=n;return[f,d,m,...(0,o.reject)(l,["text","Details"]),...r,b,...(0,o.reject)(u,["text","Details"]),...s,...i,...a]})}(t).then(t=>(0,u.generateDefinition)(r({content:t,fileTitle:n},e)))};var o=n(0),i=function(e){return e&&e.__esModule?e:{default:e}}(n(3)),u=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9);Object.defineProperty(t,"buildAuditPdf",{enumerable:!0,get:function(){return r.buildAuditPdf}});var o=n(8);Object.defineProperty(t,"buildIssuePdf",{enumerable:!0,get:function(){return o.buildIssuePdf}});var i=n(7);Object.defineProperty(t,"buildJobPdf",{enumerable:!0,get:function(){return i.buildJobPdf}});var u=n(6);Object.defineProperty(t,"buildTaskPdf",{enumerable:!0,get:function(){return u.buildTaskPdf}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.text=function(e,t={}){return r({text:e=e||"Unknown"},t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.table=i,t.twoColumnTable=function(e){return i((0,r.defaults)({},e,{widths:[130,"*"]}))},t.fourColumnTable=function(e){return i((0,r.defaults)({},e,{widths:[130,"*","*","*"]}))};var r=n(0),o=n(1);function i(e){const{body:t,layout:n="noBorders",margin:i=[0,10,0,20],widths:u}=e;let{style:a="table"}=e;return(0,r.isObject)(a)&&(a=(0,r.defaults)({},a,o.defaultStyles.table)),{layout:n,margin:i,style:a,table:{body:t,widths:u,headerRows:1}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseValue=function(e){if((0,r.isBoolean)(e))return e?"Yes":"No";if((0,r.isObjectLike)(e)&&(0,r.isEmpty)(e))return" - ";return e||" - "};var r=n(0)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.imagesTable=function(e){const t=(0,r.chunk)(e,o.DEFAULT_IMAGE_ROW_LENGTH);return(0,r.map)(t,e=>{const t=(0,r.fill)(Array(o.DEFAULT_IMAGE_ROW_LENGTH),{text:""}),n=(0,r.concat)(e,(0,r.slice)(t,e.length));return{table:{body:[[...n]],widths:[160,160,160]},layout:"noBorders",margin:[0,5,0,5]}})};var r=n(0),o=n(4)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.horizontalLine=function(){return{style:"horizontalLine",table:{widths:["*"],body:[[" "],[" "]]},layout:{hLineWidth:(e,t)=>0===e||e===t.table.body.length?0:.5,vLineWidth:()=>0,hLineColor:()=>"#ddd"}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getValueAsPercentage=function(e=0){return`${Math.floor(100*e)}%`}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getUserFullName=function(e,t){const n=(0,r.find)(e,["entity.user._id",t]),o=(0,r.get)(n,"entity.user");return o?`${o.firstName} ${o.lastName}`:"Unknown User"};var r=n(0)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getTimezoneDatetime=function(e,t,n=!0){const o=(0,r.default)(e).tz(t),i=o.format("MMM D h:mma"),u=o.format("z");return n?`${i} (${u})`:`${i}`},n(5);var r=function(e){return e&&e.__esModule?e:{default:e}}(n(2))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getTaskEntryDetails=function(e){const{entity:t={},timezone:n}=e,{createdAt:i,gps:u}=t,a=(0,r.get)(u,"reverseGeocoded.label","Unknown Location"),l=(0,o.getLocationText)(e),s=(0,o.getReferenceDetails)(e),c=(0,o.getTimezoneDatetime)(i,n);return{locationText:l,gpsText:a,referenceLabel:s.label,referenceValue:s.value,timezoneDatetime:c}};var r=n(0),o=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getStatusDetails=void 0;var r=n(0);t.getStatusDetails=(0,r.memoize)(e=>{switch(e){case"closed":return{style:{color:"#D0021B"},text:"Closed"};case"in-progress":return{style:{color:"#00AAE4"},text:"In Progress"};case"open":return{style:{color:"#FF8C2F"},text:"Open"};default:return{style:{color:"#666666"},text:"Unknown"}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getReferenceDetails=function(e){const{entity:t,users:n}=e,{user:o}=t;let i="Reference",u="Unknown Reference";if(o){const e=(0,r.getUserFullName)(n,o);i="User",u=e}return{label:i,value:u}};var r=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getPrettyDuration=function(e){const t=Math.floor(e.asDays()),n=Math.floor(e.asHours()),r=e.hours(),o=e.minutes(),i=e.seconds();if(t>0)return`${t}d ${r}h`;if(n>0)return`${n}h ${o}m`;if(o>0)return`${o}m`;return`${i}s`}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getLocationText=function(e){const{entity:t,locations:n=[],zones:i=[]}=e,{area:u,location:a,zone:l}=t;let s,c;const f=(0,r.get)(u,"label");a&&(s=(0,r.isString)(a)?(0,o.getEntityProperty)(n,a,"name"):a.name);l&&(c=(0,r.isString)(l)?(0,o.getEntityProperty)(i,l,"name"):l.name);if(s||c){const e=(0,r.compact)([s,c]);return e.join(", ")}if(f)return f;return"Unknown Location"};var r=n(0),o=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getJobDetails=function(e){const{entity:t={},timezone:n,users:u}=e,{assignees:a,author:l,createdAt:s,description:c="-",due:f,geometryReverseGeocoded:d,reference:m="-",status:b}=t,g=(0,i.getAssigneesFullNames)(u,a),p=(0,i.getUserFullName)(u,l),y=(0,i.getGeometryGeocodedString)(d),h=(0,i.getStatusDetails)(b),v=h.style,_=v.color,T=(0,r.upperCase)(h.text),x=(0,i.getTimezoneDatetime)(s,n),O=(0,i.getTimezoneDatetime)(f,n),P=(0,o.default)().tz(n).format("z");return{assigneeNames:g,authorFullName:p,createdTimezoneDateTime:x,description:c,dueDateTimezoneDateTime:O,locationText:y,statusStyle:v,statusColor:_,statusText:T,reference:m,timezoneAbbrText:P}},n(5);var r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(2)),i=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getIssueDetails=function(e){const{entity:t,timezone:n,users:u}=e,{assignees:a,createdAt:l,duration:s,gps:c,status:f,user:d}=t,m=(0,i.getAssigneesFullNames)(u,a),b=o.default.duration(s,"minutes"),g=(0,i.getPrettyDuration)(b),p=(0,i.getUserFullName)(u,d),y=(0,r.get)(c,"reverseGeocoded.label","Unknown Location"),h="closed"===f,v=(0,i.getLocationText)(e),_=(0,i.getStatusDetails)(f),T=_.style,x=T.color,O=(0,r.upperCase)(_.text),P=(0,i.getTimezoneDatetime)(l,n);return{assigneeNames:m,durationText:g,gpsText:y,fullName:p,isClosedStatus:h,locationText:v,statusStyle:T,statusColor:x,statusText:O,timezoneDatetime:P}};var r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(2)),i=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getGeometryGeocodedString=function(e,t=o){return e?(0,r.chain)(e).pick(t).values().compact().join(", ").value():"Unknown Location"};var r=n(0);const o=["label","postalcode"]},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getEntityProperty=function(e,t,n){return((0,r.find)(e,["entity._id",t])||{})[n]};var r=n(0)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getAuditItemsData=function(e){const t=(0,r.groupBy)(e,"group.id"),n={overallActualScore:0,overallMaximumScore:0};return n.items=(0,r.map)(t,(e,t)=>{const i={key:t,groupMaximumScore:0,groupActualScore:0,title:e[0].group.label};return i.items=e.map((e,u)=>{const{assets:a,comments:l,label:s,score:c,scores:f,scoreWeight:d,weight:m}=e,b=(0,r.maxBy)(f,"value").value*m,g=(0,r.find)(f,{value:c});return i.groupMaximumScore+=b,i.groupActualScore+=d,n.overallMaximumScore+=b,n.overallActualScore+=d,{assetCount:a.length,assets:a.map((e,n)=>({assetUrl:(0,o.fetchUrl)(e,{width:800}),key:`${t}-item-asset-${n}`,thumbnailUrl:(0,o.fetchUrl)(e,{width:100})})),comments:l,key:`${t}-item-${u}`,label:s,scoreLabel:g?g.label:"Unknown Score"}}),i}),n};var r=n(0),o=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getAuditEntryDetails=function(e){const{entity:t,timezone:n}=e,{createdAt:i,gps:u,items:a,score:l}=t,s=(0,o.getLocationText)(e),c=(0,r.get)(u,"reverseGeocoded.label","Unknown Location"),f=(0,o.getAuditItemsData)(a),d=(0,o.getReferenceDetails)(e),m=(0,o.getValueAsPercentage)(l.result),b=(0,o.getTimezoneDatetime)(i,n);return{gpsText:c,groupedData:f,locationText:s,referenceLabel:d.label,referenceValue:d.value,scoreText:m,timezoneDatetime:b}};var r=n(0),o=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getAssigneesFullNames=function(e,t){return(0,r.chain)(t).map(t=>(0,o.getUserFullName)(e,t)).compact().join(", ").value()||"No users assigned"};var r=n(0),o=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateDefinition=function(e){const{content:t,fileTitle:n,footer:a=u.defaultFooter,header:l=u.defaultHeader,logoUrl:s=i.LIGHTHOUSE_LOGO_URL,pageMargins:c=i.DEFAULT_PAGE_MARGINS,pageOrientation:f=i.DEFAULT_PAGE_ORIENTATION,pageSize:d=i.DEFAULT_PAGE_SIZE,styles:m={},title:b=i.DEFAULT_TITLE}=e,g=(0,r.defaults)({},m,u.defaultStyles),p={title:n},y=function(e){if((0,r.isFunction)(e))return o.default.resolve(e());return o.default.resolve(e)}(l(s)),h=function(e){if((0,r.isFunction)(e))return o.default.resolve(e());return o.default.resolve(e)}(t),v=function(e){if((0,r.isFunction)(e))return o.default.resolve(e());return o.default.resolve(e)}(a(i.LIGHTHOUSE_LOGO_URL,b)),_=[y,h,v];return o.default.all(_).then(([e,t,n])=>({header:e,content:t,footer:n,info:p,pageMargins:c,pageOrientation:f,pageSize:d,styles:g}))};var r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(3)),i=n(4),u=n(1)},function(e,t){e.exports=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fetchImage=function(e){return u(e).then(t=>t.ok?t.blob():o.default.reject(new Error(`Failed to fetch image: ${e}`))).then(e=>new o.default((t,n)=>{const r=new FileReader;r.onloadend=(()=>t(r.result)),r.onerror=n,r.readAsDataURL(e)}))};var r=i(n(32)),o=i(n(3));function i(e){return e&&e.__esModule?e:{default:e}}const{fetch:u}=(0,r.default)({Promise:o.default})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.defaultStyles={h1:{fontSize:16,margin:[0,20,0,20],color:"#222"},h2:{fontSize:14,margin:[0,10,0,10],color:"#22"},h3:{fontSize:12,margin:[0,10,0,0],color:"#444"},horizontalLine:{margin:[0,0,0,0],fontSize:1},small:{fontSize:8,bold:!1,color:"#666"},table:{fontSize:8,lineHeight:1.1,color:"#444"}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultHeader=function(e){return(0,r.fetchImage)(e).then(e=>({fit:[130,50],image:e,margin:[60,60,60,0]}))};var r=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultFooter=function(e,t){const n=(0,r.default)().format("D/M/YY");return(0,o.fetchImage)(e).then(e=>r=>({columns:[{fit:[80,30],image:e,margin:[60,20,0,0]},{alignment:"right",text:`${t} | ${n} | Page ${r}`,style:"small",margin:[0,25,60,0]}]}))};var r=function(e){return e&&e.__esModule?e:{default:e}}(n(2)),o=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.buildTemplateContent=function(e){const t=[],n=[];(0,r.reduce)(e,(e,t)=>{const n=(0,i.text)(t.label,{style:"h3"}),o=(0,i.horizontalLine)(),u=(0,r.chain)(t.fieldGroups).map(t=>{const n=(0,r.filter)(t.fields,e=>"list"===e.fieldtype&&"media"===e.options.type&&e.value.length>0);(0,r.each)(n,t=>{(0,r.each)(t.value,t=>{const n=(0,i.fetchUrl)(t,{width:800});e.images.push(n)})});const o=(0,r.filter)(t.fields,e=>"list"!==e.fieldtype);if((0,r.isEmpty)(o))return[];const u=(0,r.map)(o,e=>{const{label:t,value:n}=e,o=(0,i.parseValue)(n),u=(0,r.isArray)(o)?(0,r.join)(o,", "):function(e){return(0,r.startsWith)(e,"data:image/png;")}(o)?{alignment:"left",image:o,width:140}:o;return[t,u]}),a=(0,i.twoColumnTable)({body:u});return[a]}).flattenDeep().compact().value();if(!(0,r.isEmpty)(u))return e.details.push([n,o,...u]),e},{details:t,images:n});const u=(0,r.map)(n,e=>(0,i.fetchImage)(e));return o.default.all(u).then(e=>{if((0,r.isEmpty)(t)||t.unshift((0,i.text)("Details",{style:"h2"})),(0,r.isEmpty)(e))return{details:t};const o=(0,i.text)("Photos",{pageBreak:"before",style:"h2"}),u=(0,i.horizontalLine)(),a=(0,r.map)(e,(e,t)=>{const r=n[t];return{alignment:"center",fit:[150,150],image:e,link:r}}),l=(0,i.imagesTable)(a),s=[o,u,...l];return{details:t,photos:s}})};var r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(3)),i=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.buildFetchUrl=function(e,{width:t,height:n}){const o=[];let i="";t&&o.push(`w_${t.toString()}`);n&&o.push(`h_${n.toString()}`);o.length>0&&(i=`${o.join(",")}/`);return`${r.CLOUDINARY_BASE_URL}/${i}${r.AWS_S3_BASE_URL}/${e}`};var r=n(4)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.buildAuditContent=function(e){const t=[],n=[];return(0,r.reduce)(e,(e,t)=>{const{groupActualScore:n,groupMaximumScore:u,items:a,title:l}=t,s=[[{text:"Group Score",bold:!0},`${n}/${u}`]],c=(0,i.text)(l,{style:"h3"}),f=(0,i.horizontalLine)(),d=(0,i.twoColumnTable)({body:s,margin:[0,0,0,0]}),m=[[{text:"Question",bold:!0},{text:"Score",bold:!0},{text:"Attachments",bold:!0},{text:"Comments",bold:!0}]];(0,r.each)(a,t=>{const{assetCount:n,assets:u,comments:a="",label:s="",scoreLabel:c=""}=t;if(m.push([s,c,n,a]),(0,r.isEmpty)(u))return;const f=(0,r.map)(u,e=>(0,i.fetchImage)(e.assetUrl)),d=o.default.all(f).then(e=>{const t=(0,i.text)(l,{style:"h3"}),n=(0,i.horizontalLine)(),o=(0,r.map)(e,(e,t)=>{const n=u[t];return{alignment:"center",fit:[150,150],image:e,link:n&&n.assetUrl}});return[t,...(0,i.imagesTable)(o),n]});e.imageContentPromises.push(d)});const b=(0,i.fourColumnTable)({body:m,margin:[0,0,0,0],widths:[130,"*","*","*"]});return e.details.push([c,f,b,f,d,f]),e},{details:t,imageContentPromises:n}),o.default.all(n).then(e=>{if((0,r.isEmpty)(e))return{details:t};const n=[(0,i.text)("Photos",{pageBreak:"before",style:"h2"}),(0,i.horizontalLine)(),...e];return{details:t,photos:n}})};var r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(3)),i=n(1)},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(e){r=u}}();var l,s=[],c=!1,f=-1;function d(){c&&l&&(c=!1,l.length?s=l.concat(s):f=-1,s.length&&m())}function m(){if(!c){var e=a(d);c=!0;for(var t=s.length;t;){for(l=s,s=[];++f<t;)l&&l[f].run();f=-1,t=s.length}l=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function b(e,t){this.fun=e,this.array=t}function g(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];s.push(new b(e,t)),1!==s.length||c||a(m)},b.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=g,o.addListener=g,o.once=g,o.off=g,o.removeListener=g,o.removeAllListeners=g,o.emit=g,o.prependListener=g,o.prependOnceListener=g,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4);Object.keys(r).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}})});var o=n(1);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var i=n(10);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})})}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("lodash"),require("moment"),require("bluebird"),require("moment-timezone"),require("fetch-ponyfill")):"function"==typeof define&&define.amd?define(["lodash","moment","bluebird","moment-timezone","fetch-ponyfill"],t):"object"==typeof exports?exports["lighthouse-common"]=t(require("lodash"),require("moment"),require("bluebird"),require("moment-timezone"),require("fetch-ponyfill")):e["lighthouse-common"]=t(e._,e.moment,e.bluebird,e["moment-timezone"],e["fetch-ponyfill"])}(window,function(e,t,n,r,o){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=41)}([function(t,n){t.exports=e},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(39);Object.defineProperty(t,"buildAuditContent",{enumerable:!0,get:function(){return r.buildAuditContent}});var o=n(38);Object.defineProperty(t,"buildFetchUrl",{enumerable:!0,get:function(){return o.buildFetchUrl}});var i=n(37);Object.defineProperty(t,"buildTemplateContent",{enumerable:!0,get:function(){return i.buildTemplateContent}});var u=n(36);Object.defineProperty(t,"defaultFooter",{enumerable:!0,get:function(){return u.defaultFooter}});var a=n(35);Object.defineProperty(t,"defaultHeader",{enumerable:!0,get:function(){return a.defaultHeader}});var l=n(34);Object.defineProperty(t,"defaultStyles",{enumerable:!0,get:function(){return l.defaultStyles}});var s=n(33);Object.defineProperty(t,"fetchImage",{enumerable:!0,get:function(){return s.fetchImage}});var c=n(31);Object.defineProperty(t,"generateDefinition",{enumerable:!0,get:function(){return c.generateDefinition}});var f=n(30);Object.defineProperty(t,"getAssigneesFullNames",{enumerable:!0,get:function(){return f.getAssigneesFullNames}});var d=n(29);Object.defineProperty(t,"getAuditEntryDetails",{enumerable:!0,get:function(){return d.getAuditEntryDetails}});var m=n(28);Object.defineProperty(t,"getAuditItemsData",{enumerable:!0,get:function(){return m.getAuditItemsData}});var b=n(27);Object.defineProperty(t,"getEntityProperty",{enumerable:!0,get:function(){return b.getEntityProperty}});var g=n(26);Object.defineProperty(t,"getGeometryGeocodedString",{enumerable:!0,get:function(){return g.getGeometryGeocodedString}});var p=n(25);Object.defineProperty(t,"getIssueDetails",{enumerable:!0,get:function(){return p.getIssueDetails}});var y=n(24);Object.defineProperty(t,"getJobDetails",{enumerable:!0,get:function(){return y.getJobDetails}});var h=n(23);Object.defineProperty(t,"getLocationText",{enumerable:!0,get:function(){return h.getLocationText}});var v=n(22);Object.defineProperty(t,"getPrettyDuration",{enumerable:!0,get:function(){return v.getPrettyDuration}});var _=n(21);Object.defineProperty(t,"getReferenceDetails",{enumerable:!0,get:function(){return _.getReferenceDetails}});var T=n(20);Object.defineProperty(t,"getStatusDetails",{enumerable:!0,get:function(){return T.getStatusDetails}});var x=n(19);Object.defineProperty(t,"getTaskEntryDetails",{enumerable:!0,get:function(){return x.getTaskEntryDetails}});var O=n(18);Object.defineProperty(t,"getTimezoneDatetime",{enumerable:!0,get:function(){return O.getTimezoneDatetime}});var P=n(17);Object.defineProperty(t,"getUserFullName",{enumerable:!0,get:function(){return P.getUserFullName}});var j=n(16);Object.defineProperty(t,"getValueAsPercentage",{enumerable:!0,get:function(){return j.getValueAsPercentage}});var D=n(15);Object.defineProperty(t,"horizontalLine",{enumerable:!0,get:function(){return D.horizontalLine}});var A=n(14);Object.defineProperty(t,"imagesTable",{enumerable:!0,get:function(){return A.imagesTable}});var L=n(13);Object.defineProperty(t,"parseValue",{enumerable:!0,get:function(){return L.parseValue}});var S=n(12);Object.defineProperty(t,"table",{enumerable:!0,get:function(){return S.table}}),Object.defineProperty(t,"twoColumnTable",{enumerable:!0,get:function(){return S.twoColumnTable}}),Object.defineProperty(t,"fourColumnTable",{enumerable:!0,get:function(){return S.fourColumnTable}});var E=n(11);Object.defineProperty(t,"text",{enumerable:!0,get:function(){return E.text}})},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});t.ENVIRONMENT=e.env.ENVIRONMENT||"development",t.AWS_S3_BASE_URL=e.env.AWS_S3_BASE_URL||"https://uploads-test-lighthouse-io.s3.amazonaws.com",t.CLOUDINARY_BASE_URL=e.env.CLOUDINARY_BASE_URL||"https://res.cloudinary.com/lighthouseio/image/fetch",t.DEFAULT_IMAGE_ROW_LENGTH=3,t.DEFAULT_PAGE_MARGINS=[60,110,60,80],t.DEFAULT_PAGE_ORIENTATION="portrait",t.DEFAULT_PAGE_SIZE="A4",t.DEFAULT_TITLE="Lighthouse.io",t.LIGHTHOUSE_LOGO_URL="https://s3.amazonaws.com/assets-lighthouse-io/img/logo-medium.png"}).call(this,n(40))},function(e,t){e.exports=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.buildTaskPdf=function(e,t){const n=`Task Report - ${(0,o.get)(t,"entity.title","Unknown")}`;return function(e){const{entity:t}=e,{entry:n,title:r}=t,o=(0,i.getTaskEntryDetails)(e),u=[[{text:"Title",bold:!0},r],[{text:"Location",bold:!0},o.locationText],[{text:"GPS Location",bold:!0},o.gpsText],[{text:o.referenceLabel,bold:!0},o.referenceValue],[{text:"Created",bold:!0},o.timezoneDatetime]],a=(0,i.text)("Task Report",{style:"h1"}),l=(0,i.twoColumnTable)({body:u});return(0,i.buildTemplateContent)(n.formGroups).then(({details:e=[],photos:t=[]})=>[a,l,...e,...t])}(t).then(t=>(0,i.generateDefinition)(r({content:t,fileTitle:n},e)))};var o=n(0),i=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.buildJobPdf=function(e,t){const n=`Job Report - ${(0,o.get)(t,"entity.title","Unknown")}`,l=function(e){const{entity:t}=e,{title:n}=t,r=(0,u.getJobDetails)(e),l=[[{text:"Location",bold:!0},r.locationText],[{text:"Author",bold:!0},r.authorFullName],[{text:"Reference",bold:!0},r.reference],[{text:"Description",bold:!0},r.description],[{text:"Due Date",bold:!0},r.dueDateTimezoneDateTime],[{text:"Assignees",bold:!0},r.assigneeNames],[{text:"Status",bold:!0},{text:r.statusText,color:r.statusColor}],[{text:"Created",bold:!0},r.createdTimezoneDateTime],[{text:"Timezone",bold:!0},r.timezoneAbbrText]],s=(0,u.text)(`Job Report: ${n}`,{style:"h1"}),c=(0,u.twoColumnTable)({body:l}),f=(0,u.text)("Job Activities",{style:"h2"}),d=function(e){const{jobActivities:t,timezone:n,users:r}=e;if((0,o.isEmpty)(t))return{body:[["No Job Activities Data"]],widths:"*"};const l=(0,o.map)(t,e=>{const{entity:t}=e,{type:a,duration:l,user:s,start:c={},end:f={}}=t,d=(0,u.getUserFullName)(r,s),m=i.default.duration(l,"minutes"),b=l?(0,u.getPrettyDuration)(m):"-",g=c.time,p=(0,o.get)(c,"geometryReverseGeocoded.label","-"),y=f.time,h=(0,o.get)(f,"geometryReverseGeocoded.label","-"),v=g?(0,u.getTimezoneDatetime)(g,n,!1):"-",_=y?(0,u.getTimezoneDatetime)(y,n,!1):"-";return[a,d,v,p,_,h,b]});return{body:[a,...l],widths:[70,80,60,"*",60,"*",50]}}(e),m=(0,u.table)(d);return[s,c,f,(0,u.horizontalLine)(),m,(0,u.horizontalLine)()]}(t);return(0,u.generateDefinition)(r({content:l,fileTitle:n,pageOrientation:"landscape"},e))};var o=n(0),i=function(e){return e&&e.__esModule?e:{default:e}}(n(2)),u=n(1);const a=[{text:"Type",bold:!0},{text:"User",bold:!0},{text:"Start Time",bold:!0},{text:"Start Location",bold:!0},{text:"End Time",bold:!0},{text:"End Location",bold:!0},{text:"Duration",bold:!0}]},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.buildIssuePdf=function(e,t){const n=`Issue Report - ${(0,o.get)(t,"entity.title","Unknown")}`;return function(e){const{entity:t,timezone:n}=e,{entry:r,title:a,timeline:l=[]}=t,s=(0,i.getIssueDetails)(e),c=(0,o.map)(l,u),f=[[{text:"Title",bold:!0},a],[{text:"Status",bold:!0},{text:s.statusText,color:s.statusColor}],[{text:"Assignees",bold:!0},s.assigneeNames],[{text:"Location",bold:!0},s.locationText],[{text:"GPS Location",bold:!0},s.gpsText],[{text:"Raised by",bold:!0},s.fullName],[{text:"Created",bold:!0},s.timezoneDatetime]];s.isClosedStatus&&f.push([{text:"Duration",bold:!0},s.durationText]);const d=(0,o.isEmpty)(c)?[["No Timeline data"]]:(0,o.map)(c,function(e){return t=>{const{text:n,timestamp:r}=t,o=(0,i.getTimezoneDatetime)(r,e);return[{text:o,bold:!0},n]}}(n)),m=(0,i.text)("Issue Report",{style:"h1"}),b=(0,i.twoColumnTable)({body:f}),g=(0,i.text)("Timeline",{style:"h2"}),p=(0,i.horizontalLine)(),y=(0,i.twoColumnTable)({body:d});return(0,i.buildTemplateContent)(r.formGroups).then(({details:e=[],photos:t=[]})=>[m,b,g,p,y,...e,...t])}(t).then(t=>(0,i.generateDefinition)(r({content:t,fileTitle:n},e)))};var o=n(0),i=n(1);function u(e){const{_id:t,meta:n={},timestamp:r}=e,{field:u}=n;let a;return{_id:t,text:a="status"===u?function(e){const{meta:t,source:n,type:r}=e,u=(0,o.get)(t,"next"),a=(0,o.get)(n,"meta.firstName"),l=(0,o.get)(n,"meta.lastName"),s=a&&l?`${a} ${l}`:"Unknown User",c="issue-new"===r,f="issue-update"===r,d="open"===u,m=(0,i.getStatusDetails)(u).text;return c&&d?`Issue opened by ${s}`:c&&!d?`Issue opened with status ${m} by ${s}`:f?`Issue updated to ${m} by ${s}`:"Unknown status timeline change"}(e):null,timestamp:r}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.buildAuditPdf=function(e,t){const n=`Audit Report - ${(0,o.get)(t,"entity.title","Unknown")}`;return function(e){const{entity:t}=e,{footerFields:n={},headerFields:r={},title:a="Unknown"}=t,l=(0,u.getAuditEntryDetails)(e),s=[[{text:"Title",bold:!0},a],[{text:"Location",bold:!0},l.locationText],[{text:"GPS Location",bold:!0},l.gpsText],[{text:l.referenceLabel,bold:!0},l.referenceValue],[{text:"Created",bold:!0},l.timezoneDatetime],[{text:"Score",bold:!0},l.scoreText]],c=[[{text:"Total Score",bold:!0},`${l.groupedData.overallActualScore} / ${l.groupedData.overallMaximumScore}`]],f=(0,u.text)("Audit Report",{style:"h2"}),d=(0,u.twoColumnTable)({body:s}),m=(0,u.text)("Details",{style:"h2"}),b=(0,u.twoColumnTable)({body:c,style:{fontSize:12},margin:[0,20,0,10]}),g={entry:(0,u.buildAuditContent)(l.groupedData.items),footer:(0,u.buildTemplateContent)(n.formGroups),header:(0,u.buildTemplateContent)(r.formGroups)};return i.default.props(g).then(({entry:e,footer:t,header:n})=>{const{details:r=[],photos:i=[]}=e,{details:u=[],photos:a=[]}=t,{details:l=[],photos:s=[]}=n;return[f,d,m,...(0,o.reject)(l,["text","Details"]),...r,b,...(0,o.reject)(u,["text","Details"]),...s,...i,...a]})}(t).then(t=>(0,u.generateDefinition)(r({content:t,fileTitle:n},e)))};var o=n(0),i=function(e){return e&&e.__esModule?e:{default:e}}(n(3)),u=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9);Object.defineProperty(t,"buildAuditPdf",{enumerable:!0,get:function(){return r.buildAuditPdf}});var o=n(8);Object.defineProperty(t,"buildIssuePdf",{enumerable:!0,get:function(){return o.buildIssuePdf}});var i=n(7);Object.defineProperty(t,"buildJobPdf",{enumerable:!0,get:function(){return i.buildJobPdf}});var u=n(6);Object.defineProperty(t,"buildTaskPdf",{enumerable:!0,get:function(){return u.buildTaskPdf}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.text=function(e,t={}){return r({text:e=e||"Unknown"},t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.table=i,t.twoColumnTable=function(e){return i((0,r.defaults)({},e,{widths:[130,"*"]}))},t.fourColumnTable=function(e){return i((0,r.defaults)({},e,{widths:[130,"*","*","*"]}))};var r=n(0),o=n(1);function i(e){const{body:t,layout:n="noBorders",margin:i=[0,10,0,20],widths:u}=e;let{style:a="table"}=e;return(0,r.isObject)(a)&&(a=(0,r.defaults)({},a,o.defaultStyles.table)),{layout:n,margin:i,style:a,table:{body:t,widths:u,headerRows:1}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseValue=function(e){if((0,r.isBoolean)(e))return e?"Yes":"No";if((0,r.isObjectLike)(e)&&(0,r.isEmpty)(e))return" - ";return e||" - "};var r=n(0)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.imagesTable=function(e){const t=(0,r.chunk)(e,o.DEFAULT_IMAGE_ROW_LENGTH);return(0,r.map)(t,e=>{const t=(0,r.fill)(Array(o.DEFAULT_IMAGE_ROW_LENGTH),{text:""}),n=(0,r.concat)(e,(0,r.slice)(t,e.length));return{table:{body:[[...n]],widths:[160,160,160]},layout:"noBorders",margin:[0,5,0,5]}})};var r=n(0),o=n(4)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.horizontalLine=function(){return{style:"horizontalLine",table:{widths:["*"],body:[[" "],[" "]]},layout:{hLineWidth:(e,t)=>0===e||e===t.table.body.length?0:.5,vLineWidth:()=>0,hLineColor:()=>"#ddd"}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getValueAsPercentage=function(e=0){return`${Math.floor(100*e)}%`}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getUserFullName=function(e,t){const n=(0,r.find)(e,["entity.user._id",t]),o=(0,r.get)(n,"entity.user");return o?`${o.firstName} ${o.lastName}`:"Unknown User"};var r=n(0)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getTimezoneDatetime=function(e,t,n=!0){const o=(0,r.default)(e).tz(t),i=o.format("MMM D h:mma"),u=o.format("z");return n?`${i} (${u})`:`${i}`},n(5);var r=function(e){return e&&e.__esModule?e:{default:e}}(n(2))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getTaskEntryDetails=function(e){const{entity:t={},timezone:n}=e,{createdAt:i,gps:u}=t,a=(0,r.get)(u,"reverseGeocoded.label","Unknown Location"),l=(0,o.getLocationText)(e),s=(0,o.getReferenceDetails)(e),c=(0,o.getTimezoneDatetime)(i,n);return{locationText:l,gpsText:a,referenceLabel:s.label,referenceValue:s.value,timezoneDatetime:c}};var r=n(0),o=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getStatusDetails=void 0;var r=n(0);t.getStatusDetails=(0,r.memoize)(e=>{switch(e){case"closed":return{style:{color:"#D0021B"},text:"Closed"};case"in-progress":return{style:{color:"#00AAE4"},text:"In Progress"};case"open":return{style:{color:"#FF8C2F"},text:"Open"};default:return{style:{color:"#666666"},text:"Unknown"}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getReferenceDetails=function(e){const{entity:t,users:n}=e,{user:o}=t;let i="Reference",u="Unknown Reference";if(o){const e=(0,r.getUserFullName)(n,o);i="User",u=e}return{label:i,value:u}};var r=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getPrettyDuration=function(e){const t=Math.floor(e.asDays()),n=Math.floor(e.asHours()),r=e.hours(),o=e.minutes(),i=e.seconds();if(t>0)return`${t}d ${r}h`;if(n>0)return`${n}h ${o}m`;if(o>0)return`${o}m`;return`${i}s`}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getLocationText=function(e){const{entity:t,locations:n=[],zones:i=[]}=e,{area:u,location:a,zone:l}=t;let s,c;const f=(0,r.get)(u,"label");a&&(s=(0,r.isString)(a)?(0,o.getEntityProperty)(n,a,"name"):a.name);l&&(c=(0,r.isString)(l)?(0,o.getEntityProperty)(i,l,"name"):l.name);if(s||c){const e=(0,r.compact)([s,c]);return e.join(", ")}if(f)return f;return"Unknown Location"};var r=n(0),o=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getJobDetails=function(e){const{entity:t={},timezone:n,users:u}=e,{assignees:a,author:l,createdAt:s,description:c="-",due:f,geometryReverseGeocoded:d,reference:m="-",status:b}=t,g=(0,i.getAssigneesFullNames)(u,a),p=(0,i.getUserFullName)(u,l),y=(0,i.getGeometryGeocodedString)(d),h=(0,i.getStatusDetails)(b),v=h.style,_=v.color,T=(0,r.upperCase)(h.text),x=(0,i.getTimezoneDatetime)(s,n),O=(0,i.getTimezoneDatetime)(f,n),P=(0,o.default)().tz(n).format("z");return{assigneeNames:g,authorFullName:p,createdTimezoneDateTime:x,description:c,dueDateTimezoneDateTime:O,locationText:y,statusStyle:v,statusColor:_,statusText:T,reference:m,timezoneAbbrText:P}},n(5);var r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(2)),i=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getIssueDetails=function(e){const{entity:t,timezone:n,users:u}=e,{assignees:a,createdAt:l,duration:s,gps:c,status:f,user:d}=t,m=(0,i.getAssigneesFullNames)(u,a),b=o.default.duration(s,"minutes"),g=(0,i.getPrettyDuration)(b),p=(0,i.getUserFullName)(u,d),y=(0,r.get)(c,"reverseGeocoded.label","Unknown Location"),h="closed"===f,v=(0,i.getLocationText)(e),_=(0,i.getStatusDetails)(f),T=_.style,x=T.color,O=(0,r.upperCase)(_.text),P=(0,i.getTimezoneDatetime)(l,n);return{assigneeNames:m,durationText:g,gpsText:y,fullName:p,isClosedStatus:h,locationText:v,statusStyle:T,statusColor:x,statusText:O,timezoneDatetime:P}};var r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(2)),i=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getGeometryGeocodedString=function(e,t=o){return e?(0,r.chain)(e).pick(t).values().compact().join(", ").value():"Unknown Location"};var r=n(0);const o=["label","postalcode"]},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getEntityProperty=function(e,t,n){return((0,r.find)(e,["entity._id",t])||{})[n]};var r=n(0)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getAuditItemsData=function(e){const t=(0,r.groupBy)(e,"group.id"),n={overallActualScore:0,overallMaximumScore:0};return n.items=(0,r.map)(t,(e,t)=>{const i={key:t,groupMaximumScore:0,groupActualScore:0,title:e[0].group.label};return i.items=e.map((e,u)=>{const{assets:a,comments:l,label:s,score:c,scores:f,scoreWeight:d,weight:m}=e,b=(0,r.maxBy)(f,"value").value*m,g=(0,r.find)(f,{value:c});return i.groupMaximumScore+=b,i.groupActualScore+=d,n.overallMaximumScore+=b,n.overallActualScore+=d,{assetCount:a.length,assets:a.map((e,n)=>({assetUrl:(0,o.buildFetchUrl)(e,{width:800}),key:`${t}-item-asset-${n}`,thumbnailUrl:(0,o.buildFetchUrl)(e,{width:100})})),comments:l,key:`${t}-item-${u}`,label:s,scoreLabel:g?g.label:"Unknown Score"}}),i}),n};var r=n(0),o=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getAuditEntryDetails=function(e){const{entity:t,timezone:n}=e,{createdAt:i,gps:u,items:a,score:l}=t,s=(0,o.getLocationText)(e),c=(0,r.get)(u,"reverseGeocoded.label","Unknown Location"),f=(0,o.getAuditItemsData)(a),d=(0,o.getReferenceDetails)(e),m=(0,o.getValueAsPercentage)(l.result),b=(0,o.getTimezoneDatetime)(i,n);return{gpsText:c,groupedData:f,locationText:s,referenceLabel:d.label,referenceValue:d.value,scoreText:m,timezoneDatetime:b}};var r=n(0),o=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getAssigneesFullNames=function(e,t){return(0,r.chain)(t).map(t=>(0,o.getUserFullName)(e,t)).compact().join(", ").value()||"No users assigned"};var r=n(0),o=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateDefinition=function(e){const{content:t,fileTitle:n,footer:a=u.defaultFooter,header:l=u.defaultHeader,logoUrl:s=i.LIGHTHOUSE_LOGO_URL,pageMargins:c=i.DEFAULT_PAGE_MARGINS,pageOrientation:f=i.DEFAULT_PAGE_ORIENTATION,pageSize:d=i.DEFAULT_PAGE_SIZE,styles:m={},title:b=i.DEFAULT_TITLE}=e,g=(0,r.defaults)({},m,u.defaultStyles),p={title:n},y=function(e){if((0,r.isFunction)(e))return o.default.resolve(e());return o.default.resolve(e)}(l(s)),h=function(e){if((0,r.isFunction)(e))return o.default.resolve(e());return o.default.resolve(e)}(t),v=function(e){if((0,r.isFunction)(e))return o.default.resolve(e());return o.default.resolve(e)}(a(i.LIGHTHOUSE_LOGO_URL,b)),_=[y,h,v];return o.default.all(_).then(([e,t,n])=>({header:e,content:t,footer:n,info:p,pageMargins:c,pageOrientation:f,pageSize:d,styles:g}))};var r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(3)),i=n(4),u=n(1)},function(e,t){e.exports=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fetchImage=function(e){return u(e).then(t=>t.ok?t.blob():o.default.reject(new Error(`Failed to fetch image: ${e}`))).then(e=>new o.default((t,n)=>{const r=new FileReader;r.onloadend=(()=>t(r.result)),r.onerror=n,r.readAsDataURL(e)}))};var r=i(n(32)),o=i(n(3));function i(e){return e&&e.__esModule?e:{default:e}}const{fetch:u}=(0,r.default)({Promise:o.default})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.defaultStyles={h1:{fontSize:16,margin:[0,20,0,20],color:"#222"},h2:{fontSize:14,margin:[0,10,0,10],color:"#22"},h3:{fontSize:12,margin:[0,10,0,0],color:"#444"},horizontalLine:{margin:[0,0,0,0],fontSize:1},small:{fontSize:8,bold:!1,color:"#666"},table:{fontSize:8,lineHeight:1.1,color:"#444"}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultHeader=function(e){return(0,r.fetchImage)(e).then(e=>({fit:[130,50],image:e,margin:[60,60,60,0]}))};var r=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultFooter=function(e,t){const n=(0,r.default)().format("D/M/YY");return(0,o.fetchImage)(e).then(e=>r=>({columns:[{fit:[80,30],image:e,margin:[60,20,0,0]},{alignment:"right",text:`${t} | ${n} | Page ${r}`,style:"small",margin:[0,25,60,0]}]}))};var r=function(e){return e&&e.__esModule?e:{default:e}}(n(2)),o=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.buildTemplateContent=function(e){const t=[],n=[];(0,r.reduce)(e,(e,t)=>{const n=(0,i.text)(t.label,{style:"h3"}),o=(0,i.horizontalLine)(),u=(0,r.chain)(t.fieldGroups).map(t=>{const n=(0,r.filter)(t.fields,e=>"list"===e.fieldtype&&"media"===e.options.type&&e.value.length>0);(0,r.each)(n,t=>{(0,r.each)(t.value,t=>{const n=(0,i.buildFetchUrl)(t,{width:800});e.images.push(n)})});const o=(0,r.filter)(t.fields,e=>"list"!==e.fieldtype);if((0,r.isEmpty)(o))return[];const u=(0,r.map)(o,e=>{const{label:t,value:n}=e,o=(0,i.parseValue)(n),u=(0,r.isArray)(o)?(0,r.join)(o,", "):function(e){return(0,r.startsWith)(e,"data:image/png;")}(o)?{alignment:"left",image:o,width:140}:o;return[t,u]}),a=(0,i.twoColumnTable)({body:u});return[a]}).flattenDeep().compact().value();if(!(0,r.isEmpty)(u))return e.details.push([n,o,...u]),e},{details:t,images:n});const u=(0,r.map)(n,e=>(0,i.buildFetchUrl)(e));return o.default.all(u).then(e=>{if((0,r.isEmpty)(t)||t.unshift((0,i.text)("Details",{style:"h2"})),(0,r.isEmpty)(e))return{details:t};const o=(0,i.text)("Photos",{pageBreak:"before",style:"h2"}),u=(0,i.horizontalLine)(),a=(0,r.map)(e,(e,t)=>{const r=n[t];return{alignment:"center",fit:[150,150],image:e,link:r}}),l=(0,i.imagesTable)(a),s=[o,u,...l];return{details:t,photos:s}})};var r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(3)),i=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.buildFetchUrl=function(e,{width:t,height:n}){const o=[];let i="";t&&o.push(`w_${t.toString()}`);n&&o.push(`h_${n.toString()}`);o.length>0&&(i=`${o.join(",")}/`);return`${r.CLOUDINARY_BASE_URL}/${i}${r.AWS_S3_BASE_URL}/${e}`};var r=n(4)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.buildAuditContent=function(e){const t=[],n=[];return(0,r.reduce)(e,(e,t)=>{const{groupActualScore:n,groupMaximumScore:u,items:a,title:l}=t,s=[[{text:"Group Score",bold:!0},`${n}/${u}`]],c=(0,i.text)(l,{style:"h3"}),f=(0,i.horizontalLine)(),d=(0,i.twoColumnTable)({body:s,margin:[0,0,0,0]}),m=[[{text:"Question",bold:!0},{text:"Score",bold:!0},{text:"Attachments",bold:!0},{text:"Comments",bold:!0}]];(0,r.each)(a,t=>{const{assetCount:n,assets:u,comments:a="",label:s="",scoreLabel:c=""}=t;if(m.push([s,c,n,a]),(0,r.isEmpty)(u))return;const f=(0,r.map)(u,e=>(0,i.fetchImage)(e.assetUrl)),d=o.default.all(f).then(e=>{const t=(0,i.text)(l,{style:"h3"}),n=(0,i.horizontalLine)(),o=(0,r.map)(e,(e,t)=>{const n=u[t];return{alignment:"center",fit:[150,150],image:e,link:n&&n.assetUrl}});return[t,...(0,i.imagesTable)(o),n]});e.imageContentPromises.push(d)});const b=(0,i.fourColumnTable)({body:m,margin:[0,0,0,0],widths:[130,"*","*","*"]});return e.details.push([c,f,b,f,d,f]),e},{details:t,imageContentPromises:n}),o.default.all(n).then(e=>{if((0,r.isEmpty)(e))return{details:t};const n=[(0,i.text)("Photos",{pageBreak:"before",style:"h2"}),(0,i.horizontalLine)(),...e];return{details:t,photos:n}})};var r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(3)),i=n(1)},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(e){r=u}}();var l,s=[],c=!1,f=-1;function d(){c&&l&&(c=!1,l.length?s=l.concat(s):f=-1,s.length&&m())}function m(){if(!c){var e=a(d);c=!0;for(var t=s.length;t;){for(l=s,s=[];++f<t;)l&&l[f].run();f=-1,t=s.length}l=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function b(e,t){this.fun=e,this.array=t}function g(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];s.push(new b(e,t)),1!==s.length||c||a(m)},b.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=g,o.addListener=g,o.once=g,o.off=g,o.removeListener=g,o.removeAllListeners=g,o.emit=g,o.prependListener=g,o.prependOnceListener=g,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4);Object.keys(r).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}})});var o=n(1);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var i=n(10);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})})}])});
{
"name": "@lighthouse/common",
"version": "0.1.2",
"version": "0.1.3",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/lighthouse-common.js",

@@ -12,6 +12,8 @@ import {

} from 'lodash'
import Promise from 'bluebird'
import {
fetchImage,
fetchUrl,
buildFetchUrl,
horizontalLine,

@@ -46,3 +48,3 @@ imagesTable,

each(field.value, filename => {
const url = fetchUrl(filename, {
const url = buildFetchUrl(filename, {
width: 800,

@@ -97,3 +99,3 @@ })

const imagePromises = map(images, url => fetchImage(url))
const imagePromises = map(images, url => buildFetchUrl(url))

@@ -100,0 +102,0 @@ return Promise.all(imagePromises).then(base64Images => {

import { find, groupBy, map, maxBy } from 'lodash'
import { fetchUrl } from './'
import { buildFetchUrl } from './'

@@ -49,5 +49,5 @@ export function getAuditItemsData(items) {

const assets = itemAssets.map((asset, assetIndex) => {
const assetUrl = fetchUrl(asset, { width: 800 })
const assetUrl = buildFetchUrl(asset, { width: 800 })
const key = `${groupIndex}-item-asset-${assetIndex}`
const thumbnailUrl = fetchUrl(asset, { width: 100 })
const thumbnailUrl = buildFetchUrl(asset, { width: 100 })

@@ -54,0 +54,0 @@ return {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc