@lighthouse/common 4.31.1-canary.3 → 4.31.1-canary.4

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.
@@ -81,8 +81,7 @@ function buildAuditFollowUps(rawFollowUpIssues = [], options = {}) {
81
81
  link
82
82
  } : {
83
83
  text: ''
84
- }; // TODO Should we use the same icon for an external link as we do for a jump link?
85
-
84
+ };
86
85
  const linkToDestination = item.questionId;
87
86
  const iconJumpCell = _images.launchIcon ? {
88
87
  alignment: 'center',
@@ -113,7 +112,21 @@ function buildAuditFollowUps(rawFollowUpIssues = [], options = {}) {
113
112
  alignment: 'right'
114
113
  }]);
115
114
  });
116
- const headerText = ['', 'Issue Title', 'Status', 'Assignees', 'Audit Question', '', 'Last Updated'];
115
+ const headerLinkIconCell = _images.launchIcon ? {
116
+ alignment: 'center',
117
+ fit: [8, 8],
118
+ image: _images.launchIcon
119
+ } : {
120
+ text: ''
121
+ };
122
+ const headerJumpIconCell = _images.launchIcon ? {
123
+ alignment: 'center',
124
+ fit: [8, 8],
125
+ image: _images.internalLinkIcon
126
+ } : {
127
+ text: ''
128
+ };
129
+ const headerText = [headerLinkIconCell, 'Issue Title', 'Status', 'Assignees', headerJumpIconCell, 'Audit Question', 'Last Updated'];
117
130
  const headerRow = headerText.map(text => ({
118
131
  text,
119
132
  style: {
@@ -128,7 +141,7 @@ function buildAuditFollowUps(rawFollowUpIssues = [], options = {}) {
128
141
  const followUpsTable = (0, _.sixColumnTable)({
129
142
  body: [headerRow, ...tableBody],
130
143
  style: 'titleTable',
131
- widths: [6, '*', 55, 55, '*', 6, '18%'],
144
+ widths: [6, '*', 55, 55, 6, '*', '16%'],
132
145
  margin: [0, 0, 0, 30]
133
146
  });
134
147
  console.log('buildAuditFollowUps', {
@@ -76,8 +76,7 @@ export function buildAuditFollowUps() {
76
76
  link: link
77
77
  } : {
78
78
  text: ''
79
- }; // TODO Should we use the same icon for an external link as we do for a jump link?
80
-
79
+ };
81
80
  var linkToDestination = item.questionId;
82
81
  var iconJumpCell = launchIcon ? {
83
82
  alignment: 'center',
@@ -108,7 +107,21 @@ export function buildAuditFollowUps() {
108
107
  alignment: 'right'
109
108
  }]);
110
109
  });
111
- var headerText = ['', 'Issue Title', 'Status', 'Assignees', 'Audit Question', '', 'Last Updated'];
110
+ var headerLinkIconCell = launchIcon ? {
111
+ alignment: 'center',
112
+ fit: [8, 8],
113
+ image: launchIcon
114
+ } : {
115
+ text: ''
116
+ };
117
+ var headerJumpIconCell = launchIcon ? {
118
+ alignment: 'center',
119
+ fit: [8, 8],
120
+ image: internalLinkIcon
121
+ } : {
122
+ text: ''
123
+ };
124
+ var headerText = [headerLinkIconCell, 'Issue Title', 'Status', 'Assignees', headerJumpIconCell, 'Audit Question', 'Last Updated'];
112
125
  var headerRow = headerText.map(function (text) {
113
126
  return {
114
127
  text: text,
@@ -125,7 +138,7 @@ export function buildAuditFollowUps() {
125
138
  var followUpsTable = sixColumnTable({
126
139
  body: [headerRow].concat(tableBody),
127
140
  style: 'titleTable',
128
- widths: [6, '*', 55, 55, '*', 6, '18%'],
141
+ widths: [6, '*', 55, 55, 6, '*', '16%'],
129
142
  margin: [0, 0, 0, 30]
130
143
  });
131
144
  console.log('buildAuditFollowUps', {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/pdf/helpers/build-audit-follow-ups/index.js"],"names":["moment","getStatusDetails","getUserFullName","defaultStyles","horizontalLine","sixColumnTable","launchIcon","internalLinkIcon","LIGHTHOUSE_BASE_URL","buildAuditFollowUps","rawFollowUpIssues","options","console","log","sectionTitle","text","style","font","lineHeight","margin","sectionDivider","followUpIssues","filter","item","errorMessage","length","subTitle","timezone","tableBody","forEach","mappedStatus","status","toUpperCase","small","color","alignment","updatedAt","format","tz","link","issueId","iconLinkCell","fit","image","linkToDestination","questionId","iconJumpCell","assignees","assigneeUsername","push","issueTitle","questionLabel","headerText","headerRow","map","bold","fontSize","followUpsTable","body","widths"],"mappings":";;;;;;A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jB,gBALiB,EAMjB,EANiB,EAOjB,cAPiB,CAAnB;AASA,MAAMC,SAAS,GAAGD,UAAU,CAACE,GAAX,CAAe,UAAAvC,IAAI;AAAA,WAAK;AACxCA,MAAAA,IAAI,EAAJA,IADwC;AAExCC,MAAAA,KAAK,EAAE;AACLuC,QAAAA,IAAI,EAAE,IADD;AAELtC,QAAAA,IAAI,EAAE,QAFD;AAGLuC,QAAAA,QAAQ,EAAE,CAHL;AAILrB,QAAAA,SAAS,EAAE;AAJN;AAFiC,KAAL;AAAA,GAAnB,CAAlB;AASAkB,EAAAA,SAAS,CAAC,CAAD,CAAT,CAAalB,SAAb,GAAyB,QAAzB;AACAkB,EAAAA,SAAS,CAAC,CAAD,CAAT,CAAalB,SAAb,GAAyB,OAAzB;AAEA,MAAMsB,cAAc,GAAGpD,cAAc,CAAC;AACpCqD,IAAAA,IAAI,GAAGL,SAAH,SAAiBzB,SAAjB,CADgC;AAEpCZ,IAAAA,KAAK,EAAE,YAF6B;AAGpC2C,IAAAA,MAAM,EAAE,CAAC,CAAD,EAAI,GAAJ,EAAS,EAAT,EAAa,EAAb,EAAiB,GAAjB,EAAsB,CAAtB,EAAyB,KAAzB,CAH4B;AAIpCxC,IAAAA,MAAM,EAAE,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,EAAV;AAJ4B,GAAD,CAArC;AAOAP,EAAAA,OAAO,CAACC,GAAR,CAAY,qBAAZ,EAAmC;AACjC4C,IAAAA,cAAc,EAAdA;AADiC,GAAnC;AAIA,SAAO,CAAC3C,YAAD,EAAeM,cAAf,EAA+BqC,cAA/B,CAAP;AACD","sourcesContent":["import moment from 'moment-timezone'\nimport { getStatusDetails, getUserFullName } from '../../../helpers'\nimport { defaultStyles, horizontalLine, sixColumnTable } from '../'\nimport { launchIcon, internalLinkIcon } from '../../../images'\n// Still to do:\n// *. Setup the page breaks, either on the last item here or the first in the next section\n// - I want to do this in a way that avoids orphans, or at least only add a page break if the result looks balanced\n// - If we can work out the page position of the last follow up item then we can determine whether to use a page break or not\n// *. If you're not using the flag then you should make sure that all of the variables necessary have been passed in\n// - If the required data isn't present then you should probably just not process follow up issues for the document\n// - If you establish this at the start you can build it into the `hasFollowUps` flag\n// *. Is there some way that you can setup an override for the pdfmake version used by storybook?\n\nconst LIGHTHOUSE_BASE_URL = 'https://app.lighthouse.io'\n\nexport function buildAuditFollowUps(rawFollowUpIssues = [], options = {}) {\n console.log('buildAuditFollowUps', {\n rawFollowUpIssues,\n options,\n })\n\n const sectionTitle = [\n {\n text: 'Follow-up Issues',\n style: {\n font: 'Gotham',\n lineHeight: 1.1,\n margin: [0, 0, 0, 50],\n },\n },\n ]\n const sectionDivider = horizontalLine({ margin: [0, 0, 0, 0] })\n\n const followUpIssues = rawFollowUpIssues.filter(item => !item.errorMessage)\n if (!followUpIssues.length) {\n // Show a `no follow up issues` message if there are no follow up issues\n return [\n sectionTitle,\n sectionDivider,\n {\n text: 'No follow up issues exist for this Audit',\n style: defaultStyles.subTitle,\n margin: [0, 5, 0, 50],\n },\n ]\n }\n\n const { timezone = 'America/New_York' } = options\n const tableBody = []\n followUpIssues.forEach(item => {\n const mappedStatus = getStatusDetails(item.status)\n const status = {\n text: mappedStatus.text.toUpperCase(),\n style: {\n ...defaultStyles.small,\n color: mappedStatus.style.color,\n alignment: 'center',\n },\n }\n\n let updatedAt = ''\n if (item.updatedAt) {\n const format = 'MMM D h:mma' // e.g. Jan 21 12:59am in the Audit timezone\n updatedAt = moment.tz(item.updatedAt, timezone).format(format)\n }\n\n const link = `${LIGHTHOUSE_BASE_URL}/reports/issues/${item.issueId}`\n const iconLinkCell = launchIcon\n ? { alignment: 'center', fit: [8, 8], image: launchIcon, link }\n : { text: '' }\n\n // TODO Should we use the same icon for an external link as we do for a jump link?\n const linkToDestination = item.questionId\n const iconJumpCell = launchIcon\n ? {\n alignment: 'center',\n fit: [8, 8],\n image: internalLinkIcon,\n linkToDestination,\n }\n : { text: '' }\n\n const assignees = item.assignees || []\n const assigneeUsername = assignees.length === 0\n ? 'Unassigned'\n : assignees.length === 1\n // TODO Currently this gives `first last`, I don't think it can fall back to 'Unknown User' here\n ? getUserFullName(assignees, 0)\n : `${assignees.length} users`\n \n tableBody.push([\n iconLinkCell,\n { text: item.issueTitle || '', link, style: 'small', image: launchIcon },\n status,\n { text: assigneeUsername, style: 'small' },\n { text: item.questionLabel || '', style: 'small', linkToDestination },\n iconJumpCell,\n { text: updatedAt || '', style: 'small', alignment: 'right' },\n ])\n })\n\n const headerText = [\n '',\n 'Issue Title',\n 'Status',\n 'Assignees',\n 'Audit Question',\n '',\n 'Last Updated',\n ]\n const headerRow = headerText.map(text => ({\n text,\n style: {\n bold: true,\n font: 'Gotham',\n fontSize: 8,\n alignment: 'left',\n },\n }))\n headerRow[2].alignment = 'center'\n headerRow[6].alignment = 'right'\n\n const followUpsTable = sixColumnTable({\n body: [headerRow, ...tableBody],\n style: 'titleTable',\n widths: [6, '*', 55, 55, '*', 6, '18%'],\n margin: [0, 0, 0, 30],\n })\n\n console.log('buildAuditFollowUps', {\n followUpsTable,\n })\n\n return [sectionTitle, sectionDivider, followUpsTable]\n}\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../src/pdf/helpers/build-audit-follow-ups/index.js"],"names":["moment","getStatusDetails","getUserFullName","defaultStyles","horizontalLine","sixColumnTable","launchIcon","internalLinkIcon","LIGHTHOUSE_BASE_URL","buildAuditFollowUps","rawFollowUpIssues","options","console","log","sectionTitle","text","style","font","lineHeight","margin","sectionDivider","followUpIssues","filter","item","errorMessage","length","subTitle","timezone","tableBody","forEach","mappedStatus","status","toUpperCase","small","color","alignment","updatedAt","format","tz","link","issueId","iconLinkCell","fit","image","linkToDestination","questionId","iconJumpCell","assignees","assigneeUsername","push","issueTitle","questionLabel","headerLinkIconCell","headerJumpIconCell","headerText","headerRow","map","bold","fontSize","followUpsTable","body","widths"],"mappings":";;;;;;AAAA,OAAOA,MAAP,MAAmB,iBAAnB;AACA,SAASC,gBAAT,EA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AAAA,OAAO,CAACC,GAAR,CAAY,qBAAZ,EAAmC;AACjC8C,IAAAA,cAAc,EAAdA;AADiC,GAAnC;AAIA,SAAO,CAAC7C,YAAD,EAAeM,cAAf,EAA+BuC,cAA/B,CAAP;AACD","sourcesContent":["import moment from 'moment-timezone'\nimport { getStatusDetails, getUserFullName } from '../../../helpers'\nimport { defaultStyles, horizontalLine, sixColumnTable } from '../'\nimport { launchIcon, internalLinkIcon } from '../../../images'\n// Still to do:\n// *. Setup the page breaks, either on the last item here or the first in the next section\n// - I want to do this in a way that avoids orphans, or at least only add a page break if the result looks balanced\n// - If we can work out the page position of the last follow up item then we can determine whether to use a page break or not\n// *. If you're not using the flag then you should make sure that all of the variables necessary have been passed in\n// - If the required data isn't present then you should probably just not process follow up issues for the document\n// - If you establish this at the start you can build it into the `hasFollowUps` flag\n// *. Is there some way that you can setup an override for the pdfmake version used by storybook?\n\nconst LIGHTHOUSE_BASE_URL = 'https://app.lighthouse.io'\n\nexport function buildAuditFollowUps(rawFollowUpIssues = [], options = {}) {\n console.log('buildAuditFollowUps', {\n rawFollowUpIssues,\n options,\n })\n\n const sectionTitle = [\n {\n text: 'Follow-up Issues',\n style: {\n font: 'Gotham',\n lineHeight: 1.1,\n margin: [0, 0, 0, 50],\n },\n },\n ]\n const sectionDivider = horizontalLine({ margin: [0, 0, 0, 0] })\n\n const followUpIssues = rawFollowUpIssues.filter(item => !item.errorMessage)\n if (!followUpIssues.length) {\n // Show a `no follow up issues` message if there are no follow up issues\n return [\n sectionTitle,\n sectionDivider,\n {\n text: 'No follow up issues exist for this Audit',\n style: defaultStyles.subTitle,\n margin: [0, 5, 0, 50],\n },\n ]\n }\n\n const { timezone = 'America/New_York' } = options\n const tableBody = []\n followUpIssues.forEach(item => {\n const mappedStatus = getStatusDetails(item.status)\n const status = {\n text: mappedStatus.text.toUpperCase(),\n style: {\n ...defaultStyles.small,\n color: mappedStatus.style.color,\n alignment: 'center',\n },\n }\n\n let updatedAt = ''\n if (item.updatedAt) {\n const format = 'MMM D h:mma' // e.g. Jan 21 12:59am in the Audit timezone\n updatedAt = moment.tz(item.updatedAt, timezone).format(format)\n }\n\n const link = `${LIGHTHOUSE_BASE_URL}/reports/issues/${item.issueId}`\n const iconLinkCell = launchIcon\n ? { alignment: 'center', fit: [8, 8], image: launchIcon, link }\n : { text: '' }\n\n const linkToDestination = item.questionId\n const iconJumpCell = launchIcon\n ? {\n alignment: 'center',\n fit: [8, 8],\n image: internalLinkIcon,\n linkToDestination,\n }\n : { text: '' }\n\n const assignees = item.assignees || []\n const assigneeUsername = assignees.length === 0\n ? 'Unassigned'\n : assignees.length === 1\n // TODO Currently this gives `first last`, I don't think it can fall back to 'Unknown User' here\n ? getUserFullName(assignees, 0)\n : `${assignees.length} users`\n \n tableBody.push([\n iconLinkCell,\n { text: item.issueTitle || '', link, style: 'small', image: launchIcon },\n status,\n { text: assigneeUsername, style: 'small' },\n { text: item.questionLabel || '', style: 'small', linkToDestination },\n iconJumpCell,\n { text: updatedAt || '', style: 'small', alignment: 'right' },\n ])\n })\n\n const headerLinkIconCell = launchIcon\n ? { alignment: 'center', fit: [8, 8], image: launchIcon }\n : { text: '' }\n \n const headerJumpIconCell = launchIcon\n ? { alignment: 'center', fit: [8, 8], image: internalLinkIcon }\n : { text: '' }\n \n const headerText = [\n headerLinkIconCell,\n 'Issue Title',\n 'Status',\n 'Assignees',\n headerJumpIconCell,\n 'Audit Question',\n 'Last Updated',\n ]\n const headerRow = headerText.map(text => ({\n text,\n style: {\n bold: true,\n font: 'Gotham',\n fontSize: 8,\n alignment: 'left',\n },\n }))\n headerRow[2].alignment = 'center'\n headerRow[6].alignment = 'right'\n\n const followUpsTable = sixColumnTable({\n body: [headerRow, ...tableBody],\n style: 'titleTable',\n widths: [6, '*', 55, 55, 6, '*', '16%'],\n margin: [0, 0, 0, 30],\n })\n\n console.log('buildAuditFollowUps', {\n followUpsTable,\n })\n\n return [sectionTitle, sectionDivider, followUpsTable]\n}\n"],"file":"index.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lighthouse/common",
3
- "version": "4.31.1-canary.3",
3
+ "version": "4.31.1-canary.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "lib/index.js",