@google-psat/report 0.10.2 → 0.11.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/dashboard/components/header/index.js +2 -2
- package/dist/dashboard/components/siteMapReport/cookies.js +4 -6
- package/dist/dashboard/components/siteMapReport/layout.js +3 -3
- package/dist/dashboard/components/siteReport/components/layout.js +4 -31
- package/dist/dashboard/components/siteReport/index.js +2 -2
- package/dist/dashboard/components/siteReport/stateProviders/contentStore/index.js +2 -8
- package/dist/dashboard/components/siteReport/tabs/cookies/cookiesLandingContainer/cookieLanding/knownBreakages.js +1 -1
- package/dist/dashboard/components/siteReport/tabs/cookies/cookiesLandingContainer/cookieLanding/landing.js +4 -1
- package/dist/dashboard/components/siteReport/tabs/cookies/cookiesLandingContainer/index.js +4 -3
- package/dist/dashboard/components/siteReport/tabs/cookies/index.js +1 -1
- package/dist/dashboard/components/urlsWithIssues/index.js +1 -5
- package/dist/dashboard/components/utils/extractReportData.js +8 -1
- package/dist/dashboard/components/utils/reportDownloader/generateSiteMapReportandDownload.js +3 -1
- package/dist/dashboard/components/utils/reportDownloader/utils.js +10 -25
- package/dist/dashboard/components/utils/tests/data.mock.js +3 -0
- package/dist/dashboard/components/utils/tests/extractReportData.js +2 -0
- package/dist/dashboard/index.js +0 -2
- package/dist-types/dashboard/components/header/index.d.ts +2 -1
- package/dist-types/dashboard/components/siteReport/index.d.ts +2 -3
- package/dist-types/dashboard/components/siteReport/stateProviders/contentStore/index.d.ts +2 -4
- package/dist-types/dashboard/components/utils/extractReportData.d.ts +2 -1
- package/dist-types/dashboard/index.d.ts +0 -2
- package/package.json +1 -1
|
@@ -18,9 +18,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
18
18
|
* External dependencies.
|
|
19
19
|
*/
|
|
20
20
|
import { PrivacySandboxColoredIcon } from '@google-psat/design-system';
|
|
21
|
-
const Header = ({ url, dateTime }) => {
|
|
21
|
+
const Header = ({ url, dateTime, version }) => {
|
|
22
22
|
// @ts-ignore - Global object.
|
|
23
23
|
const isExtension = globalThis?.PSAT_EXTENSION;
|
|
24
|
-
return (_jsxs("div", { className: "flex justify-between gap-3 px-4 py-2 bg-white dark:bg-charleston-green border-b border-hex-gray dark:border-quartz", children: [_jsxs("div", { className: "flex gap-2 items-center", children: [_jsx(PrivacySandboxColoredIcon, { className: "w-[40px] h-[40px]" }), _jsxs("div", { children: [url && _jsx("p", { className: "text-xs mb-[1px]", children: url }), _jsx("p", { className: "text-xs mb-[1px]", children: dateTime })] })] }), _jsx("div", { className: "flex items-center
|
|
24
|
+
return (_jsxs("div", { className: "flex justify-between gap-3 px-4 py-2 bg-white dark:bg-charleston-green border-b border-hex-gray dark:border-quartz", children: [_jsxs("div", { className: "flex gap-2 items-center", children: [_jsx(PrivacySandboxColoredIcon, { className: "w-[40px] h-[40px]" }), _jsxs("div", { children: [url && _jsx("p", { className: "text-xs mb-[1px]", children: url }), _jsx("p", { className: "text-xs mb-[1px]", children: dateTime })] })] }), _jsx("div", { className: "flex items-center", children: _jsxs("div", { children: [_jsx("span", { className: "block", children: isExtension ? 'PSAT Extension Analysis' : 'PSAT CLI Analysis' }), _jsx("span", { className: "block text-right text-darkest-gray dark:text-white text-[11px]", children: version ? 'v' + version : '' })] }) })] }));
|
|
25
25
|
};
|
|
26
26
|
export default Header;
|
|
@@ -18,7 +18,7 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
18
18
|
* External dependencies.
|
|
19
19
|
*/
|
|
20
20
|
import { useCallback, useMemo, useState } from 'react';
|
|
21
|
-
import { noop, } from '@google-psat/common';
|
|
21
|
+
import { noop, extractCookies, } from '@google-psat/common';
|
|
22
22
|
import { useSidebar } from '@google-psat/design-system';
|
|
23
23
|
/**
|
|
24
24
|
* Internal dependencies.
|
|
@@ -26,7 +26,6 @@ import { useSidebar } from '@google-psat/design-system';
|
|
|
26
26
|
import AssembledCookiesLanding from '../siteReport/tabs/cookies/cookiesLandingContainer';
|
|
27
27
|
import SiteReport from '../siteReport';
|
|
28
28
|
import { generateSiteMapReportandDownload } from '../utils/reportDownloader';
|
|
29
|
-
import extractCookies from '../utils/extractCookies';
|
|
30
29
|
const CookiesTab = ({ selectedSite, tabCookies, tabFrames, completeJson, path, libraryMatches, query = '', clearQuery = noop, }) => {
|
|
31
30
|
const isKeySelected = useSidebar(({ actions }) => actions.isKeySelected);
|
|
32
31
|
const [appliedFilters, setAppliedFilters] = useState({});
|
|
@@ -56,18 +55,17 @@ const CookiesTab = ({ selectedSite, tabCookies, tabFrames, completeJson, path, l
|
|
|
56
55
|
}
|
|
57
56
|
await generateSiteMapReportandDownload(completeJson, appliedFilters, path);
|
|
58
57
|
}, [appliedFilters, completeJson, path]);
|
|
59
|
-
const [siteFilteredCookies,
|
|
58
|
+
const [siteFilteredCookies, siteFilteredCompleteJson] = useMemo(() => {
|
|
60
59
|
const reportData = completeJson?.find((data) => isKeySelected(data.pageUrl));
|
|
61
60
|
if (!reportData) {
|
|
62
61
|
return [{}, [], null];
|
|
63
62
|
}
|
|
64
63
|
const _cookies = extractCookies(reportData.cookieData, '', true);
|
|
65
|
-
|
|
66
|
-
return [_cookies, _technologies, [reportData]];
|
|
64
|
+
return [_cookies, [reportData]];
|
|
67
65
|
}, [completeJson, isKeySelected]);
|
|
68
66
|
const sitemapPath =
|
|
69
67
|
// @ts-ignore - Global object
|
|
70
68
|
globalThis?.PSAT_DATA?.siteMapUrl || globalThis?.PSAT_DATA?.selectedSite;
|
|
71
|
-
return (_jsx(_Fragment, { children: !selectedSite ? (_jsx(AssembledCookiesLanding, { tabCookies: tabCookies, tabFrames: tabFrames, libraryMatches: siteMapLibraryMatches, libraryMatchesUrlCount: libraryMatchesUrlCount, downloadReport: downloadReport, menuBarScrollContainerId: "dashboard-sitemap-layout-container", setAppliedFilters: setAppliedFilters, query: query, clearQuery: clearQuery, url: sitemapPath })) : (_jsx(SiteReport, { cookies: siteFilteredCookies,
|
|
69
|
+
return (_jsx(_Fragment, { children: !selectedSite ? (_jsx(AssembledCookiesLanding, { tabCookies: tabCookies, tabFrames: tabFrames, libraryMatches: siteMapLibraryMatches, libraryMatchesUrlCount: libraryMatchesUrlCount, downloadReport: downloadReport, menuBarScrollContainerId: "dashboard-sitemap-layout-container", setAppliedFilters: setAppliedFilters, query: query, clearQuery: clearQuery, url: sitemapPath })) : (_jsx(SiteReport, { cookies: siteFilteredCookies, completeJson: siteFilteredCompleteJson, selectedSite: selectedSite || '', path: path, libraryMatches: libraryMatches && selectedSite ? libraryMatches[selectedSite] : {}, query: query, clearQuery: clearQuery })) }));
|
|
72
70
|
};
|
|
73
71
|
export default CookiesTab;
|
|
@@ -19,13 +19,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
19
19
|
*/
|
|
20
20
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
21
21
|
import { Resizable } from 're-resizable';
|
|
22
|
-
import { noop, } from '@google-psat/common';
|
|
22
|
+
import { noop, reshapeCookies, } from '@google-psat/common';
|
|
23
23
|
import { useSidebar, Sidebar, SIDEBAR_ITEMS_KEYS, File, FileWhite, } from '@google-psat/design-system';
|
|
24
24
|
/**
|
|
25
25
|
* Internal dependencies.
|
|
26
26
|
*/
|
|
27
27
|
import SiteMapCookiesWithIssues from './sitemapCookiesWithIssues';
|
|
28
|
-
import reshapeCookies from '../utils/reshapeCookies';
|
|
29
28
|
import CookiesTab from './cookies';
|
|
30
29
|
const Layout = ({ landingPageCookies, completeJson, sidebarData, setSidebarData, path, libraryMatches, }) => {
|
|
31
30
|
const [sites, setSites] = useState([]);
|
|
@@ -37,7 +36,8 @@ const Layout = ({ landingPageCookies, completeJson, sidebarData, setSidebarData,
|
|
|
37
36
|
setSites(Array.from(_sites));
|
|
38
37
|
}, [completeJson]);
|
|
39
38
|
const reshapedCookies = useMemo(() => reshapeCookies(landingPageCookies), [landingPageCookies]);
|
|
40
|
-
const cookiesWithIssues = useMemo(() => Object.fromEntries(Object.entries(reshapedCookies).filter(([, cookie]) => cookie.isBlocked ||
|
|
39
|
+
const cookiesWithIssues = useMemo(() => Object.fromEntries(Object.entries(reshapedCookies).filter(([, cookie]) => cookie.isBlocked ||
|
|
40
|
+
(cookie.blockedReasons && cookie.blockedReasons?.length > 0))), [reshapedCookies]);
|
|
41
41
|
const { activePanel, selectedItemKey, updateSelectedItemKey, isKeySelected } = useSidebar(({ state, actions }) => ({
|
|
42
42
|
activePanel: state.activePanel,
|
|
43
43
|
selectedItemKey: state.selectedItemKey,
|
|
@@ -19,23 +19,20 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
19
19
|
*/
|
|
20
20
|
import React, { useEffect, useMemo, useRef } from 'react';
|
|
21
21
|
import { Resizable } from 're-resizable';
|
|
22
|
-
import { I18n } from '@google-psat/i18n';
|
|
23
22
|
import { noop } from '@google-psat/common';
|
|
24
|
-
import { Sidebar, useSidebar, SIDEBAR_ITEMS_KEYS, CookieIcon, CookieIconWhite,
|
|
23
|
+
import { Sidebar, useSidebar, SIDEBAR_ITEMS_KEYS, CookieIcon, CookieIconWhite, } from '@google-psat/design-system';
|
|
25
24
|
/**
|
|
26
25
|
* Internal dependencies.
|
|
27
26
|
*/
|
|
28
27
|
import { useContentStore } from '../stateProviders/contentStore';
|
|
29
28
|
import CookiesTab from '../tabs/cookies';
|
|
30
29
|
import SiteCookiesWithIssues from '../tabs/siteCookiesWithIssues';
|
|
31
|
-
import Technologies from '../tabs/technologies';
|
|
32
30
|
const Layout = ({ selectedSite, setSidebarData, query = '', clearQuery = noop, }) => {
|
|
33
|
-
const {
|
|
34
|
-
technologies: state.technologies,
|
|
31
|
+
const { completeJson } = useContentStore(({ state }) => ({
|
|
35
32
|
completeJson: state.completeJson,
|
|
36
33
|
}));
|
|
37
34
|
const frameUrls = useMemo(() => {
|
|
38
|
-
const frames = Object.keys(completeJson?.[0]
|
|
35
|
+
const frames = Object.keys(completeJson?.[0]?.cookieData ?? {});
|
|
39
36
|
return frames.filter((url) => url?.includes('http'));
|
|
40
37
|
}, [completeJson]);
|
|
41
38
|
const { activePanel, selectedItemKey, updateSelectedItemKey } = useSidebar(({ state, actions }) => ({
|
|
@@ -81,7 +78,7 @@ const Layout = ({ selectedSite, setSidebarData, query = '', clearQuery = noop, }
|
|
|
81
78
|
//@ts-ignore
|
|
82
79
|
Element: CookieIconWhite,
|
|
83
80
|
},
|
|
84
|
-
isBlurred: Object.keys(completeJson?.[0]
|
|
81
|
+
isBlurred: Object.keys(completeJson?.[0]?.cookieData?.[url]?.frameCookies || {}).length === 0,
|
|
85
82
|
};
|
|
86
83
|
return acc;
|
|
87
84
|
}, {});
|
|
@@ -91,29 +88,6 @@ const Layout = ({ selectedSite, setSidebarData, query = '', clearQuery = noop, }
|
|
|
91
88
|
selectedSite,
|
|
92
89
|
},
|
|
93
90
|
};
|
|
94
|
-
if (technologies && technologies.length > 0) {
|
|
95
|
-
_data[SIDEBAR_ITEMS_KEYS.TECHNOLOGIES] = {
|
|
96
|
-
title: I18n.getMessage('technologies'),
|
|
97
|
-
children: {},
|
|
98
|
-
icon: {
|
|
99
|
-
//@ts-ignore
|
|
100
|
-
Element: SiteBoundariesIcon,
|
|
101
|
-
},
|
|
102
|
-
selectedIcon: {
|
|
103
|
-
//@ts-ignore
|
|
104
|
-
Element: SiteBoundariesIconWhite,
|
|
105
|
-
},
|
|
106
|
-
panel: {
|
|
107
|
-
Element: Technologies,
|
|
108
|
-
props: {
|
|
109
|
-
selectedSite,
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
delete _data[SIDEBAR_ITEMS_KEYS.TECHNOLOGIES];
|
|
116
|
-
}
|
|
117
91
|
return _data;
|
|
118
92
|
});
|
|
119
93
|
}, [
|
|
@@ -124,7 +98,6 @@ const Layout = ({ selectedSite, setSidebarData, query = '', clearQuery = noop, }
|
|
|
124
98
|
selectedItemKey,
|
|
125
99
|
selectedSite,
|
|
126
100
|
setSidebarData,
|
|
127
|
-
technologies,
|
|
128
101
|
]);
|
|
129
102
|
useEffect(() => {
|
|
130
103
|
if (selectedItemKey === null) {
|
|
@@ -26,8 +26,8 @@ import { SidebarProvider } from '@google-psat/design-system';
|
|
|
26
26
|
import { Provider as ContentStoreProvider } from './stateProviders/contentStore';
|
|
27
27
|
import Layout from './components/layout';
|
|
28
28
|
import Tabs from './tabs';
|
|
29
|
-
const SiteReport = ({ cookies,
|
|
29
|
+
const SiteReport = ({ cookies, completeJson, selectedSite, path, libraryMatches, query = '', clearQuery = noop, }) => {
|
|
30
30
|
const [data, setData] = useState(Tabs);
|
|
31
|
-
return (_jsx(ContentStoreProvider, { cookies: cookies,
|
|
31
|
+
return (_jsx(ContentStoreProvider, { cookies: cookies, completeJson: completeJson, libraryMatches: libraryMatches, path: path, children: _jsx(SidebarProvider, { data: data, children: _jsx(Layout, { selectedSite: selectedSite, setSidebarData: setData, query: query, clearQuery: clearQuery }) }) }));
|
|
32
32
|
};
|
|
33
33
|
export default SiteReport;
|
|
@@ -18,27 +18,21 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
18
18
|
* External dependencies.
|
|
19
19
|
*/
|
|
20
20
|
import { useMemo } from 'react';
|
|
21
|
-
import { useContextSelector, createContext, } from '@google-psat/common';
|
|
22
|
-
/**
|
|
23
|
-
* Internal dependencies.
|
|
24
|
-
*/
|
|
25
|
-
import reshapeCookies from '../../../utils/reshapeCookies';
|
|
21
|
+
import { useContextSelector, createContext, reshapeCookies, } from '@google-psat/common';
|
|
26
22
|
const initialState = {
|
|
27
23
|
state: {
|
|
28
24
|
tabCookies: {},
|
|
29
|
-
technologies: [],
|
|
30
25
|
completeJson: null,
|
|
31
26
|
path: '',
|
|
32
27
|
libraryMatches: null,
|
|
33
28
|
},
|
|
34
29
|
};
|
|
35
30
|
export const Context = createContext(initialState);
|
|
36
|
-
export const Provider = ({ cookies,
|
|
31
|
+
export const Provider = ({ cookies, completeJson, children, path, libraryMatches, }) => {
|
|
37
32
|
const tabCookies = useMemo(() => reshapeCookies(cookies), [cookies]);
|
|
38
33
|
return (_jsx(Context.Provider, { value: {
|
|
39
34
|
state: {
|
|
40
35
|
tabCookies,
|
|
41
|
-
technologies,
|
|
42
36
|
completeJson,
|
|
43
37
|
path,
|
|
44
38
|
libraryMatches,
|
|
@@ -47,7 +47,7 @@ const KnownBreakages = ({ libraryMatches, libraryMatchesUrlCount, }) => {
|
|
|
47
47
|
?.domQuerymatches
|
|
48
48
|
: null;
|
|
49
49
|
return (_jsx(Component, { matches: matches, domQueryMatches: domQueryMatches, urlCount: libraryMatchesUrlCount?.[library.name] }, library.name));
|
|
50
|
-
}) })) : (_jsx("p", { className: "text-center dark:text-bright-gray", children: I18n.getMessage('noLibraries') }));
|
|
50
|
+
}) })) : (_jsx("p", { className: "text-center text-gray dark:text-bright-gray", children: I18n.getMessage('noLibraries') }));
|
|
51
51
|
return (_jsx(CookiesLandingWrapper, { dataMapping: dataMapping, testId: "library-detection", description: "", children: _jsx("div", { className: "divide-y divide-hex-gray", children: result }) }));
|
|
52
52
|
};
|
|
53
53
|
export default KnownBreakages;
|
|
@@ -105,6 +105,9 @@ const Landing = ({ tabFrames, tabCookies, cookiesWithIssues, downloadReport, lib
|
|
|
105
105
|
const menuData = useMemo(() => sections.map(({ name, link }) => ({ name, link })), [sections]);
|
|
106
106
|
return (_jsxs(_Fragment, { children: [_jsx(MenuBar, { disableReportDownload: false, downloadReport:
|
|
107
107
|
// @ts-ignore -- PSAT_DATA is not present in globalThis type.
|
|
108
|
-
globalThis?.PSAT_DATA?.hideDownloadButton
|
|
108
|
+
globalThis?.PSAT_DATA?.hideDownloadButton ||
|
|
109
|
+
Object.keys(tabCookies ?? {}).length === 0
|
|
110
|
+
? undefined
|
|
111
|
+
: downloadReport, menuData: menuData, scrollContainerId: menuBarScrollContainerId, extraClasses: "top-[85px]" }), sections.map(({ link, panel: { Element, props } }) => (_jsx("div", { id: link, className: "cookie-landing-section", children: Element && _jsx(Element, { ...(props || {}) }) }, link)))] }));
|
|
109
112
|
};
|
|
110
113
|
export default Landing;
|
|
@@ -31,7 +31,7 @@ const AssembledCookiesLanding = ({ tabCookies, tabFrames, setAppliedFilters, dow
|
|
|
31
31
|
const cookies = useMemo(() => Object.values(tabCookies || {}), [tabCookies]);
|
|
32
32
|
const filterOutput = useGlobalFiltering(cookies, query, clearQuery);
|
|
33
33
|
// @ts-ignore Using global variable.
|
|
34
|
-
const { dateTime } = globalThis?.PSAT_DATA || {};
|
|
34
|
+
const { dateTime, psatVersion } = globalThis?.PSAT_DATA || {};
|
|
35
35
|
const cookiesByKey = useMemo(() => {
|
|
36
36
|
return (filterOutput.filteredData.reduce((acc, cookie) => {
|
|
37
37
|
const cookieKey = getCookieKey(cookie.parsedCookie);
|
|
@@ -42,12 +42,13 @@ const AssembledCookiesLanding = ({ tabCookies, tabFrames, setAppliedFilters, dow
|
|
|
42
42
|
return acc;
|
|
43
43
|
}, {}) || {});
|
|
44
44
|
}, [filterOutput.filteredData]);
|
|
45
|
-
const cookiesWithIssues = useMemo(() => Object.fromEntries(Object.entries(cookiesByKey).filter(([, cookie]) => cookie.isBlocked
|
|
45
|
+
const cookiesWithIssues = useMemo(() => Object.fromEntries(Object.entries(cookiesByKey).filter(([, cookie]) => cookie.isBlocked ||
|
|
46
|
+
(cookie.blockedReasons && cookie.blockedReasons?.length > 0))), [cookiesByKey]);
|
|
46
47
|
useEffect(() => {
|
|
47
48
|
setAppliedFilters(filterOutput.selectedFilters);
|
|
48
49
|
}, [filterOutput.selectedFilters, setAppliedFilters]);
|
|
49
50
|
const [showFilterSidebar, setShowFilterSidebar] = useState(false);
|
|
50
|
-
return (_jsxs("div", { className: "h-full flex flex-col", children: [_jsx(Header, { url: url, dateTime: dateTime }), _jsxs("div", { className: "flex justify-center items-center flex-1 border-b border-gray-300 dark:border-quartz bg-anti-flash-white dark:bg-raisin-black", children: [_jsx("button", { className: "w-3 h-3 m-1 pl-1", onClick: () => setShowFilterSidebar(!showFilterSidebar), title: I18n.getMessage('openFilterOptions'), children: _jsx(FilterIcon, { className: showFilterSidebar
|
|
51
|
+
return (_jsxs("div", { className: "h-full flex flex-col", children: [_jsx(Header, { url: url, dateTime: dateTime, version: psatVersion }), _jsxs("div", { className: "flex justify-center items-center flex-1 border-b border-gray-300 dark:border-quartz bg-anti-flash-white dark:bg-raisin-black", children: [_jsx("button", { className: "w-3 h-3 m-1 pl-1", onClick: () => setShowFilterSidebar(!showFilterSidebar), title: I18n.getMessage('openFilterOptions'), children: _jsx(FilterIcon, { className: showFilterSidebar
|
|
51
52
|
? 'text-royal-blue dark:text-medium-persian-blue'
|
|
52
53
|
: 'text-mischka' }) }), _jsx(ChipsBar, { selectedFilters: filterOutput.selectedFilters, resetFilters: filterOutput.resetFilters, toggleFilterSelection: filterOutput.toggleFilterSelection })] }), _jsxs("div", { className: "flex grow-0", style: {
|
|
53
54
|
height: 'calc(100% - 82px)',
|
|
@@ -32,7 +32,7 @@ const CookiesTab = ({ selectedFrameUrl, selectedSite, query = '', clearQuery = n
|
|
|
32
32
|
}));
|
|
33
33
|
const [appliedFilters, setAppliedFilters] = useState({});
|
|
34
34
|
const tabFrames = useMemo(() => {
|
|
35
|
-
const frames = Object.keys(completeJson?.[0]
|
|
35
|
+
const frames = Object.keys(completeJson?.[0]?.cookieData ?? {}).reduce((acc, _url) => {
|
|
36
36
|
if (_url?.includes('http')) {
|
|
37
37
|
acc[_url] = {};
|
|
38
38
|
}
|
|
@@ -43,10 +43,6 @@ const ErroredOutUrls = ({ erroredOutUrls }) => {
|
|
|
43
43
|
},
|
|
44
44
|
], []);
|
|
45
45
|
const filters = useMemo(() => ({}), []);
|
|
46
|
-
const searchKeys = useMemo(() => ['url'], []);
|
|
47
|
-
const tablePersistentSettingsKey = useMemo(() => {
|
|
48
|
-
return 'urlsWithIssues';
|
|
49
|
-
}, []);
|
|
50
46
|
return (_jsxs("div", { className: "w-full h-full text-outer-space-crayola border-x border-american-silver dark:border-quartz flex flex-col", children: [_jsx(Resizable, { defaultSize: {
|
|
51
47
|
width: '100%',
|
|
52
48
|
height: '80%',
|
|
@@ -55,7 +51,7 @@ const ErroredOutUrls = ({ erroredOutUrls }) => {
|
|
|
55
51
|
right: false,
|
|
56
52
|
bottom: true,
|
|
57
53
|
left: false,
|
|
58
|
-
}, className: "h-full flex", children: _jsx(TableProvider, { data: erroredOutUrls, tableColumns: tableColumns, tableFilterData: filters, tableSearchKeys:
|
|
54
|
+
}, className: "h-full flex", children: _jsx(TableProvider, { data: erroredOutUrls, tableColumns: tableColumns, tableFilterData: filters, tableSearchKeys: ['url'], tablePersistentSettingsKey: "urlsWithIssues", onRowClick: (row) => {
|
|
59
55
|
setSelectedRow(row);
|
|
60
56
|
}, onRowContextMenu: noop, getRowObjectKey: (row) => {
|
|
61
57
|
return row.originalData.url;
|
|
@@ -19,9 +19,15 @@
|
|
|
19
19
|
import extractCookies from './extractCookies';
|
|
20
20
|
const extractReportData = (data) => {
|
|
21
21
|
const landingPageCookies = {};
|
|
22
|
+
const erroredOutUrlsData = [];
|
|
22
23
|
const technologies = [];
|
|
23
24
|
const consolidatedLibraryMatches = {};
|
|
24
|
-
data.forEach(({ cookieData, pageUrl, libraryMatches, technologyData }) => {
|
|
25
|
+
data.forEach(({ cookieData, pageUrl, libraryMatches, technologyData, erroredOutUrls, }) => {
|
|
26
|
+
erroredOutUrlsData.push(...(erroredOutUrls ?? []));
|
|
27
|
+
if (erroredOutUrls &&
|
|
28
|
+
erroredOutUrls.filter(({ url }) => url === pageUrl).length > 0) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
25
31
|
formatCookieData(extractCookies(cookieData, pageUrl, true), landingPageCookies);
|
|
26
32
|
technologies.push(...technologyData.map((technology) => ({
|
|
27
33
|
...technology,
|
|
@@ -32,6 +38,7 @@ const extractReportData = (data) => {
|
|
|
32
38
|
return {
|
|
33
39
|
landingPageCookies,
|
|
34
40
|
consolidatedLibraryMatches,
|
|
41
|
+
erroredOutUrlsData,
|
|
35
42
|
};
|
|
36
43
|
};
|
|
37
44
|
const formatCookieData = (cookieData, store) => {
|
package/dist/dashboard/components/utils/reportDownloader/generateSiteMapReportandDownload.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import JSZip from 'jszip';
|
|
20
20
|
import { saveAs } from 'file-saver';
|
|
21
|
-
import { getCurrentDateAndTime } from '@google-psat/common';
|
|
21
|
+
import { generateRootSummaryDataCSV, getCurrentDateAndTime, } from '@google-psat/common';
|
|
22
22
|
import {} from '@google-psat/design-system';
|
|
23
23
|
/**
|
|
24
24
|
* Internal dependencies
|
|
@@ -37,7 +37,9 @@ const generateSiteMapReportandDownload = async (JSONReport, appliedFilters, path
|
|
|
37
37
|
createZip(data, appliedFilters, zipFolder);
|
|
38
38
|
});
|
|
39
39
|
const report = generateSitemapHTMLFile(JSONReport, appliedFilters);
|
|
40
|
+
const rootSummaryData = generateRootSummaryDataCSV(JSONReport);
|
|
40
41
|
zip.file('report.html', report);
|
|
42
|
+
zip.file('report.csv', rootSummaryData);
|
|
41
43
|
const content = await zip.generateAsync({ type: 'blob' });
|
|
42
44
|
saveAs(content, `psat_cli_report_${getFolderName(path)}_${getCurrentDateAndTime('YYYY-MM-DD_HH-MM-SS')}.zip`);
|
|
43
45
|
};
|
|
@@ -1,31 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
* Copyright 2023 Google LLC
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { generateCookiesWithIssuesCSV, generateAllCookiesCSV, generateSummaryDataCSV, generateTechnologyCSV, } from '@google-psat/common';
|
|
1
|
+
import { generateCookiesWithIssuesCSV, generateAllCookiesCSV, generateSummaryDataCSV, } from '@google-psat/common';
|
|
17
2
|
import {} from '@google-psat/design-system';
|
|
3
|
+
/**
|
|
4
|
+
* Internal dependencies.
|
|
5
|
+
*/
|
|
6
|
+
import packageJson from '../../../../../package.json';
|
|
18
7
|
const generateCSVFiles = (data) => {
|
|
19
8
|
const allCookiesCSV = generateAllCookiesCSV(data);
|
|
20
|
-
let technologyDataCSV = null;
|
|
21
|
-
if (data.technologyData.length > 0) {
|
|
22
|
-
technologyDataCSV = generateTechnologyCSV(data);
|
|
23
|
-
}
|
|
24
9
|
const cookiesWithIssuesDataCSV = generateCookiesWithIssuesCSV(data);
|
|
25
10
|
const summaryDataCSV = generateSummaryDataCSV(data);
|
|
26
11
|
return {
|
|
27
12
|
allCookiesCSV,
|
|
28
|
-
technologyDataCSV,
|
|
29
13
|
cookiesWithIssuesDataCSV,
|
|
30
14
|
summaryDataCSV,
|
|
31
15
|
};
|
|
@@ -64,6 +48,8 @@ const generateHTMLFile = (analysisData, appliedFilters) => {
|
|
|
64
48
|
// @ts-ignore -- because this data will already be injected from cli or the extension.
|
|
65
49
|
dateTime: globalThis?.PSAT_DATA.dateTime,
|
|
66
50
|
hideDownloadButton: true,
|
|
51
|
+
// @ts-ignore -- because this data will already be injected from cli or the extension.
|
|
52
|
+
psatVersion: globalThis?.PSAT_DATA.psatVersion ?? packageJson.version,
|
|
67
53
|
};
|
|
68
54
|
let code = `window.PSAT_DATA = ${JSON.stringify(reportData)};`;
|
|
69
55
|
// @ts-ignore -- because this data will already be injected from cli or the extension.
|
|
@@ -113,6 +99,8 @@ export const generateSitemapHTMLFile = (analysisData, appliedFilters) => {
|
|
|
113
99
|
dateTime: globalThis?.PSAT_DATA.dateTime,
|
|
114
100
|
appliedFilters,
|
|
115
101
|
hideDownloadButton: true,
|
|
102
|
+
// @ts-ignore -- because this data will already be injected from cli or the extension.
|
|
103
|
+
psatVersion: globalThis?.PSAT_DATA.psatVersion ?? packageJson.version,
|
|
116
104
|
};
|
|
117
105
|
const code = `window.PSAT_DATA = ${JSON.stringify(reportData)}`;
|
|
118
106
|
script.text = code;
|
|
@@ -123,12 +111,9 @@ export const generateSitemapHTMLFile = (analysisData, appliedFilters) => {
|
|
|
123
111
|
return html;
|
|
124
112
|
};
|
|
125
113
|
export const createZip = (analysisData, appliedFilters, zipObject) => {
|
|
126
|
-
const { allCookiesCSV,
|
|
114
|
+
const { allCookiesCSV, cookiesWithIssuesDataCSV, summaryDataCSV } = generateCSVFiles(analysisData);
|
|
127
115
|
const file = generateHTMLFile(analysisData, appliedFilters);
|
|
128
116
|
zipObject.file('cookies.csv', allCookiesCSV);
|
|
129
|
-
if (technologyDataCSV) {
|
|
130
|
-
zipObject.file('technologies.csv', technologyDataCSV);
|
|
131
|
-
}
|
|
132
117
|
zipObject.file('cookie-issues.csv', cookiesWithIssuesDataCSV);
|
|
133
118
|
zipObject.file('report.csv', summaryDataCSV);
|
|
134
119
|
zipObject.file('report.json', JSON.stringify(analysisData, null, 4));
|
|
@@ -20,6 +20,7 @@ import {} from '@google-psat/common';
|
|
|
20
20
|
export const tempSinglePageData = {
|
|
21
21
|
pageUrl: 'https://edition.cnn.com/sitemaps/sitemap-section.xml',
|
|
22
22
|
libraryMatches: {},
|
|
23
|
+
erroredOutUrls: [],
|
|
23
24
|
cookieData: {
|
|
24
25
|
'https://edition.cnn.com': {
|
|
25
26
|
frameCookies: {
|
|
@@ -72,6 +73,7 @@ export const tempMultiPageData = [
|
|
|
72
73
|
{
|
|
73
74
|
libraryMatches: {},
|
|
74
75
|
pageUrl: 'https://www.cnn.com/index.html',
|
|
76
|
+
erroredOutUrls: [],
|
|
75
77
|
technologyData: [
|
|
76
78
|
{
|
|
77
79
|
slug: 'varnish',
|
|
@@ -124,6 +126,7 @@ export const tempMultiPageData = [
|
|
|
124
126
|
{
|
|
125
127
|
libraryMatches: {},
|
|
126
128
|
pageUrl: 'https://edition.cnn.com/index.html',
|
|
129
|
+
erroredOutUrls: [],
|
|
127
130
|
technologyData: [
|
|
128
131
|
{
|
|
129
132
|
slug: 'varnish',
|
|
@@ -22,6 +22,7 @@ describe('extractReportData', () => {
|
|
|
22
22
|
it('should return an empty object if no cookies are present', () => {
|
|
23
23
|
expect(extractReportData([])).toEqual({
|
|
24
24
|
landingPageCookies: {},
|
|
25
|
+
erroredOutUrlsData: [],
|
|
25
26
|
consolidatedLibraryMatches: {},
|
|
26
27
|
});
|
|
27
28
|
});
|
|
@@ -55,6 +56,7 @@ describe('extractReportData', () => {
|
|
|
55
56
|
},
|
|
56
57
|
},
|
|
57
58
|
},
|
|
59
|
+
erroredOutUrlsData: [],
|
|
58
60
|
consolidatedLibraryMatches: {
|
|
59
61
|
'https://edition.cnn.com/index.html': {},
|
|
60
62
|
'https://www.cnn.com/index.html': {},
|
package/dist/dashboard/index.js
CHANGED
|
@@ -15,5 +15,3 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export { default as SiteReport } from './components/siteReport';
|
|
17
17
|
export { default as SiteMapReport } from './components/siteMapReport';
|
|
18
|
-
export { default as extractReportData } from './components/utils/extractReportData';
|
|
19
|
-
export { default as extractCookies } from './components/utils/extractCookies';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
interface HeaderProps {
|
|
2
2
|
url: string | undefined | null;
|
|
3
3
|
dateTime: string;
|
|
4
|
+
version: string;
|
|
4
5
|
}
|
|
5
|
-
declare const Header: ({ url, dateTime }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare const Header: ({ url, dateTime, version }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export default Header;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { type CompleteJson, type CookieJsonDataType, type LibraryData
|
|
1
|
+
import { type CompleteJson, type CookieJsonDataType, type LibraryData } from '@google-psat/common';
|
|
2
2
|
interface SiteReportProps {
|
|
3
3
|
cookies: {
|
|
4
4
|
[frame: string]: {
|
|
5
5
|
[key: string]: CookieJsonDataType;
|
|
6
6
|
};
|
|
7
7
|
};
|
|
8
|
-
technologies: TechnologyData[];
|
|
9
8
|
completeJson: CompleteJson[] | null;
|
|
10
9
|
selectedSite: string | null;
|
|
11
10
|
path: string;
|
|
@@ -13,5 +12,5 @@ interface SiteReportProps {
|
|
|
13
12
|
query?: string;
|
|
14
13
|
clearQuery?: () => void;
|
|
15
14
|
}
|
|
16
|
-
declare const SiteReport: ({ cookies,
|
|
15
|
+
declare const SiteReport: ({ cookies, completeJson, selectedSite, path, libraryMatches, query, clearQuery, }: SiteReportProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
16
|
export default SiteReport;
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
* External dependencies.
|
|
3
3
|
*/
|
|
4
4
|
import { type PropsWithChildren } from 'react';
|
|
5
|
-
import { type CompleteJson, type CookieJsonDataType, type CookieTableData, type
|
|
5
|
+
import { type CompleteJson, type CookieJsonDataType, type CookieTableData, type LibraryData } from '@google-psat/common';
|
|
6
6
|
export interface ContentStore {
|
|
7
7
|
state: {
|
|
8
8
|
tabCookies: {
|
|
9
9
|
[key: string]: CookieTableData;
|
|
10
10
|
};
|
|
11
|
-
technologies: TechnologyData[] | undefined;
|
|
12
11
|
completeJson: CompleteJson[] | null;
|
|
13
12
|
path: string;
|
|
14
13
|
libraryMatches: LibraryData | null;
|
|
@@ -21,12 +20,11 @@ interface ContentStoreProviderProps {
|
|
|
21
20
|
[key: string]: CookieJsonDataType;
|
|
22
21
|
};
|
|
23
22
|
};
|
|
24
|
-
technologies?: TechnologyData[];
|
|
25
23
|
completeJson: CompleteJson[] | null;
|
|
26
24
|
path: string;
|
|
27
25
|
libraryMatches: LibraryData | null;
|
|
28
26
|
}
|
|
29
|
-
export declare const Provider: ({ cookies,
|
|
27
|
+
export declare const Provider: ({ cookies, completeJson, children, path, libraryMatches, }: PropsWithChildren<ContentStoreProviderProps>) => import("react/jsx-runtime").JSX.Element;
|
|
30
28
|
export declare function useContentStore(): ContentStore;
|
|
31
29
|
export declare function useContentStore<T>(selector: (state: ContentStore) => T): T;
|
|
32
30
|
export {};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type { CompleteJson, LibraryData } from '@google-psat/common';
|
|
4
|
+
import type { CompleteJson, ErroredOutUrlsData, LibraryData } from '@google-psat/common';
|
|
5
5
|
declare const extractReportData: (data: CompleteJson[]) => {
|
|
6
6
|
landingPageCookies: {};
|
|
7
7
|
consolidatedLibraryMatches: {
|
|
8
8
|
[url: string]: LibraryData;
|
|
9
9
|
};
|
|
10
|
+
erroredOutUrlsData: ErroredOutUrlsData[];
|
|
10
11
|
};
|
|
11
12
|
export default extractReportData;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
export { default as SiteReport } from './components/siteReport';
|
|
2
2
|
export { default as SiteMapReport } from './components/siteMapReport';
|
|
3
|
-
export { default as extractReportData } from './components/utils/extractReportData';
|
|
4
|
-
export { default as extractCookies } from './components/utils/extractCookies';
|