@google-psat/report 0.11.0-1 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/dist/dashboard/components/siteMapReport/index.js +2 -2
  2. package/dist/dashboard/components/siteMapReport/layout.js +13 -3
  3. package/dist/dashboard/components/siteMapReport/sidebarData.js +18 -0
  4. package/dist/dashboard/components/utils/reportDownloader/generateSiteMapReportandDownload.js +3 -1
  5. package/dist-types/dashboard/components/siteMapReport/index.d.ts +3 -2
  6. package/dist-types/dashboard/components/siteMapReport/layout.d.ts +3 -2
  7. package/package.json +1 -1
  8. package/dist/dashboard/components/siteReport/tabs/technologies/index.js +0 -91
  9. package/dist/dashboard/components/utils/extractCookies.js +0 -36
  10. package/dist/dashboard/components/utils/extractReportData.js +0 -63
  11. package/dist/dashboard/components/utils/reshapeCookies.js +0 -102
  12. package/dist/dashboard/components/utils/tests/data.mock.js +0 -179
  13. package/dist/dashboard/components/utils/tests/extractCookies.js +0 -84
  14. package/dist/dashboard/components/utils/tests/extractReportData.js +0 -66
  15. package/dist/dashboard/components/utils/tests/reshapeCookies.js +0 -89
  16. package/dist-types/dashboard/components/siteReport/tabs/technologies/index.d.ts +0 -5
  17. package/dist-types/dashboard/components/utils/extractCookies.d.ts +0 -6
  18. package/dist-types/dashboard/components/utils/extractReportData.d.ts +0 -12
  19. package/dist-types/dashboard/components/utils/reshapeCookies.d.ts +0 -8
  20. package/dist-types/dashboard/components/utils/tests/data.mock.d.ts +0 -6
  21. package/dist-types/dashboard/components/utils/tests/extractCookies.d.ts +0 -1
  22. package/dist-types/dashboard/components/utils/tests/extractReportData.d.ts +0 -1
  23. package/dist-types/dashboard/components/utils/tests/reshapeCookies.d.ts +0 -1
@@ -24,8 +24,8 @@ import { SidebarProvider } from '@google-psat/design-system';
24
24
  */
25
25
  import sidebarData from './sidebarData';
26
26
  import Layout from './layout';
27
- const SiteMapReport = ({ landingPageCookies, completeJson, path, libraryMatches, }) => {
27
+ const SiteMapReport = ({ landingPageCookies, completeJson, path, libraryMatches, erroredOutUrls, }) => {
28
28
  const [data, setData] = useState(sidebarData);
29
- return (_jsx(SidebarProvider, { data: data, children: _jsx(Layout, { landingPageCookies: landingPageCookies, completeJson: completeJson, sidebarData: data, setSidebarData: setData, path: path, libraryMatches: libraryMatches }) }));
29
+ return (_jsx(SidebarProvider, { data: data, children: _jsx(Layout, { erroredOutUrls: erroredOutUrls, landingPageCookies: landingPageCookies, completeJson: completeJson, sidebarData: data, setSidebarData: setData, path: path, libraryMatches: libraryMatches }) }));
30
30
  };
31
31
  export default SiteMapReport;
@@ -26,12 +26,15 @@ import { useSidebar, Sidebar, SIDEBAR_ITEMS_KEYS, File, FileWhite, } from '@goog
26
26
  */
27
27
  import SiteMapCookiesWithIssues from './sitemapCookiesWithIssues';
28
28
  import CookiesTab from './cookies';
29
- const Layout = ({ landingPageCookies, completeJson, sidebarData, setSidebarData, path, libraryMatches, }) => {
29
+ import ErroredOutUrls from '../urlsWithIssues';
30
+ const Layout = ({ landingPageCookies, completeJson, sidebarData, setSidebarData, path, erroredOutUrls, libraryMatches, }) => {
30
31
  const [sites, setSites] = useState([]);
31
32
  useEffect(() => {
32
33
  const _sites = new Set();
33
- completeJson?.forEach(({ pageUrl }) => {
34
- _sites.add(pageUrl);
34
+ completeJson?.forEach(({ pageUrl, erroredOutUrls: _erroredOutURLs }) => {
35
+ if (!_erroredOutURLs?.some(({ url, errorName }) => url === pageUrl && errorName !== 'i')) {
36
+ _sites.add(pageUrl);
37
+ }
35
38
  });
36
39
  setSites(Array.from(_sites));
37
40
  }, [completeJson]);
@@ -113,9 +116,16 @@ const Layout = ({ landingPageCookies, completeJson, sidebarData, setSidebarData,
113
116
  path,
114
117
  },
115
118
  };
119
+ _data[SIDEBAR_ITEMS_KEYS.URL_WITH_ISSUES].panel = {
120
+ Element: ErroredOutUrls,
121
+ props: {
122
+ erroredOutUrls,
123
+ },
124
+ };
116
125
  return _data;
117
126
  });
118
127
  }, [
128
+ erroredOutUrls,
119
129
  clearQuery,
120
130
  completeJson,
121
131
  cookiesWithIssues,
@@ -42,5 +42,23 @@ const sidebarData = {
42
42
  },
43
43
  },
44
44
  },
45
+ [SIDEBAR_ITEMS_KEYS.URL_WITH_ISSUES]: {
46
+ title: 'URL Issues',
47
+ children: {},
48
+ icon: {
49
+ //@ts-ignore
50
+ Element: WarningBare,
51
+ props: {
52
+ className: 'fill-granite-gray',
53
+ },
54
+ },
55
+ selectedIcon: {
56
+ //@ts-ignore
57
+ Element: WarningBare,
58
+ props: {
59
+ className: 'fill-white',
60
+ },
61
+ },
62
+ },
45
63
  };
46
64
  export default sidebarData;
@@ -18,7 +18,7 @@
18
18
  */
19
19
  import JSZip from 'jszip';
20
20
  import { saveAs } from 'file-saver';
21
- import { generateRootSummaryDataCSV, getCurrentDateAndTime, } from '@google-psat/common';
21
+ import { generateRootSummaryDataCSV, getCurrentDateAndTime, generateErrorLogFile, } from '@google-psat/common';
22
22
  import {} from '@google-psat/design-system';
23
23
  /**
24
24
  * Internal dependencies
@@ -40,6 +40,8 @@ const generateSiteMapReportandDownload = async (JSONReport, appliedFilters, path
40
40
  const rootSummaryData = generateRootSummaryDataCSV(JSONReport);
41
41
  zip.file('report.html', report);
42
42
  zip.file('report.csv', rootSummaryData);
43
+ const errorLogs = generateErrorLogFile(JSONReport);
44
+ zip.file('error_logs.txt', errorLogs);
43
45
  const content = await zip.generateAsync({ type: 'blob' });
44
46
  saveAs(content, `psat_cli_report_${getFolderName(path)}_${getCurrentDateAndTime('YYYY-MM-DD_HH-MM-SS')}.zip`);
45
47
  };
@@ -1,4 +1,4 @@
1
- import type { CookieFrameStorageType, CompleteJson, LibraryData } from '@google-psat/common';
1
+ import type { CookieFrameStorageType, CompleteJson, LibraryData, ErroredOutUrlsData } from '@google-psat/common';
2
2
  interface SiteMapReportProps {
3
3
  landingPageCookies: CookieFrameStorageType;
4
4
  completeJson: CompleteJson[] | null;
@@ -6,6 +6,7 @@ interface SiteMapReportProps {
6
6
  libraryMatches: {
7
7
  [url: string]: LibraryData;
8
8
  } | null;
9
+ erroredOutUrls: ErroredOutUrlsData[];
9
10
  }
10
- declare const SiteMapReport: ({ landingPageCookies, completeJson, path, libraryMatches, }: SiteMapReportProps) => import("react/jsx-runtime").JSX.Element;
11
+ declare const SiteMapReport: ({ landingPageCookies, completeJson, path, libraryMatches, erroredOutUrls, }: SiteMapReportProps) => import("react/jsx-runtime").JSX.Element;
11
12
  export default SiteMapReport;
@@ -2,7 +2,7 @@
2
2
  * External dependencies.
3
3
  */
4
4
  import React from 'react';
5
- import { type CookieFrameStorageType, type CompleteJson, type LibraryData } from '@google-psat/common';
5
+ import { type CookieFrameStorageType, type CompleteJson, type LibraryData, type ErroredOutUrlsData } from '@google-psat/common';
6
6
  import { type SidebarItems } from '@google-psat/design-system';
7
7
  interface LayoutProps {
8
8
  landingPageCookies: CookieFrameStorageType;
@@ -13,6 +13,7 @@ interface LayoutProps {
13
13
  libraryMatches: {
14
14
  [url: string]: LibraryData;
15
15
  } | null;
16
+ erroredOutUrls: ErroredOutUrlsData[];
16
17
  }
17
- declare const Layout: ({ landingPageCookies, completeJson, sidebarData, setSidebarData, path, libraryMatches, }: LayoutProps) => import("react/jsx-runtime").JSX.Element;
18
+ declare const Layout: ({ landingPageCookies, completeJson, sidebarData, setSidebarData, path, erroredOutUrls, libraryMatches, }: LayoutProps) => import("react/jsx-runtime").JSX.Element;
18
19
  export default Layout;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google-psat/report",
3
- "version": "0.11.0-1",
3
+ "version": "0.12.0",
4
4
  "description": "Static HTML analysis report",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist-types/index.d.ts",
@@ -1,91 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- /*
3
- * Copyright 2023 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * https://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- /**
18
- * External dependencies
19
- */
20
- import { useMemo, useState } from 'react';
21
- import { Resizable } from 're-resizable';
22
- import { noop } from '@google-psat/common';
23
- import { I18n } from '@google-psat/i18n';
24
- import { Table, TableProvider, } from '@google-psat/design-system';
25
- /**
26
- * Internal dependencies
27
- */
28
- import { useContentStore } from '../../stateProviders/contentStore';
29
- const Technologies = ({ selectedSite }) => {
30
- const data = useContentStore(({ state }) => state.technologies || []);
31
- const [selectedRow, setSelectedRow] = useState();
32
- const tableColumns = useMemo(() => [
33
- {
34
- header: I18n.getMessage('name'),
35
- accessorKey: 'name',
36
- cell: (info) => info,
37
- enableHiding: false,
38
- },
39
- {
40
- header: I18n.getMessage('description'),
41
- accessorKey: 'description',
42
- cell: (info) => info,
43
- },
44
- {
45
- header: I18n.getMessage('confidence'),
46
- accessorKey: 'confidence',
47
- cell: (info) => (_jsx("span", { className: "w-full flex justify-center", children: info + '%' })),
48
- },
49
- {
50
- header: I18n.getMessage('website'),
51
- accessorKey: 'website',
52
- cell: (info) => info,
53
- },
54
- {
55
- header: I18n.getMessage('category'),
56
- accessorKey: 'categories',
57
- cell: (info) => info.map((i) => i.name).join(' | '),
58
- sortingComparator: (a, b) => {
59
- const aCategories = a
60
- ?.map((i) => i.name)
61
- .join(' | ') || '';
62
- const bCategories = b
63
- ?.map((i) => i.name)
64
- .join(' | ') || '';
65
- return aCategories.localeCompare(bCategories);
66
- },
67
- },
68
- ], []);
69
- const filters = useMemo(() => ({}), []);
70
- const searchKeys = useMemo(() => ['name', 'website'], []);
71
- const tablePersistentSettingsKey = useMemo(() => {
72
- if (selectedSite) {
73
- return `technologyListing#${selectedSite}`;
74
- }
75
- return 'technologyListing';
76
- }, [selectedSite]);
77
- 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: {
78
- width: '100%',
79
- height: '80%',
80
- }, minHeight: "6%", maxHeight: "95%", enable: {
81
- top: false,
82
- right: false,
83
- bottom: true,
84
- left: false,
85
- }, className: "h-full flex", children: _jsx(TableProvider, { data: data, tableColumns: tableColumns, tableFilterData: filters, tableSearchKeys: searchKeys, tablePersistentSettingsKey: tablePersistentSettingsKey, onRowClick: (row) => {
86
- setSelectedRow(row);
87
- }, onRowContextMenu: noop, getRowObjectKey: (row) => {
88
- return row.originalData.slug;
89
- }, children: _jsx(Table, { hideFiltering: true, selectedKey: selectedRow?.slug }) }) }), _jsx("div", { className: "flex-1 border border-gray-300 dark:border-quartz shadow h-full min-w-[10rem]", children: selectedRow ? (_jsxs("div", { className: "text-xs py-1 px-1.5", children: [selectedRow.name && (_jsxs(_Fragment, { children: [_jsx("p", { className: "font-bold text-granite-gray dark:text-manatee mb-1 text-semibold flex items-center", children: _jsx("span", { children: I18n.getMessage('technologyDetails') }) }), _jsx("p", { className: "mb-4 break-words text-outer-space-crayola dark:text-bright-gray", children: selectedRow.name })] })), _jsxs(_Fragment, { children: [_jsx("p", { className: "font-bold text-granite-gray dark:text-manatee mb-1", children: I18n.getMessage('description') }), _jsx("p", { className: "text-outer-space-crayola dark:text-bright-gray", children: selectedRow?.description || I18n.getMessage('noDescription') })] })] })) : (_jsx("div", { className: "h-full p-8 flex items-center", children: _jsx("p", { className: "text-lg w-full font-bold text-granite-gray dark:text-manatee text-center", children: I18n.getMessage('selectRowToPreview') }) })) })] }));
90
- };
91
- export default Technologies;
@@ -1,36 +0,0 @@
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 { calculateEffectiveExpiryDate, } from '@google-psat/common';
17
- /**
18
- * Internal dependencies
19
- */
20
- const extractCookies = (cookieData, pageUrl, shouldAddUrlToKey = false) => {
21
- return Object.entries(cookieData).reduce((acc, [frame, _data]) => {
22
- acc[frame] = Object.fromEntries(Object.entries(_data.frameCookies).map(([key, cookie]) => [
23
- key + (shouldAddUrlToKey ? '' : pageUrl),
24
- {
25
- ...cookie,
26
- pageUrl,
27
- parsedCookie: {
28
- ...cookie.parsedCookie,
29
- expires: calculateEffectiveExpiryDate(cookie.parsedCookie.expires),
30
- },
31
- },
32
- ]));
33
- return acc;
34
- }, {});
35
- };
36
- export default extractCookies;
@@ -1,63 +0,0 @@
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
- /**
17
- * Internal dependencies
18
- */
19
- import extractCookies from './extractCookies';
20
- const extractReportData = (data) => {
21
- const landingPageCookies = {};
22
- const erroredOutUrlsData = [];
23
- const technologies = [];
24
- const consolidatedLibraryMatches = {};
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
- }
31
- formatCookieData(extractCookies(cookieData, pageUrl, true), landingPageCookies);
32
- technologies.push(...technologyData.map((technology) => ({
33
- ...technology,
34
- pageUrl,
35
- })));
36
- consolidatedLibraryMatches[pageUrl] = libraryMatches;
37
- });
38
- return {
39
- landingPageCookies,
40
- consolidatedLibraryMatches,
41
- erroredOutUrlsData,
42
- };
43
- };
44
- const formatCookieData = (cookieData, store) => {
45
- Object.entries(cookieData).forEach(([frame, _cData]) => {
46
- if (!store[frame]) {
47
- store[frame] = {};
48
- }
49
- Object.entries(_cData).forEach(([key, cookie]) => {
50
- store[frame][key] = {
51
- ...cookie,
52
- isBlocked: store[frame][key]?.isBlocked || cookie.isBlocked,
53
- blockedReasons: [
54
- ...new Set([
55
- ...(store[frame][key]?.blockedReasons || []),
56
- ...(cookie.blockedReasons || []),
57
- ]),
58
- ],
59
- };
60
- });
61
- });
62
- };
63
- export default extractReportData;
@@ -1,102 +0,0 @@
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
- /**
17
- * External dependencies
18
- */
19
- import { deriveBlockingStatus, } from '@google-psat/common';
20
- import { I18n } from '@google-psat/i18n';
21
- const reshapeCookies = (cookies) => {
22
- return Object.entries(cookies)
23
- .filter(([frame]) => frame.includes('http'))
24
- .map(([frame, _cookies]) => createCookieObj(frame, _cookies))
25
- .reduce((acc, cookieObj) => {
26
- Object.keys(cookieObj).forEach((key) => {
27
- if (acc[key]) {
28
- const frameUrls = [
29
- ...(acc[key]?.frameUrls ?? []),
30
- ...(cookieObj[key]?.frameUrls ?? []),
31
- ];
32
- const blockedReasons = [
33
- ...new Set([
34
- ...(acc[key]?.blockedReasons ?? []),
35
- ...(cookieObj[key]?.blockedReasons ?? []),
36
- ]),
37
- ];
38
- const frameIdList = Array.from(new Set([
39
- ...(acc[key]?.frameIdList ?? []),
40
- ...(cookieObj[key]?.frameIdList ?? []),
41
- ]));
42
- const networkEvents = {
43
- requestEvents: [
44
- ...(cookieObj[key]?.networkEvents?.requestEvents || []),
45
- ...(acc[key].networkEvents?.requestEvents || []),
46
- ],
47
- responseEvents: [
48
- ...(cookieObj[key]?.networkEvents?.responseEvents || []),
49
- ...(acc[key].networkEvents?.responseEvents || []),
50
- ],
51
- };
52
- let blockingStatus = deriveBlockingStatus(networkEvents);
53
- //@ts-ignore -- Since this has to be run for data coming from extension only.
54
- if (globalThis?.PSAT_EXTENSION) {
55
- blockingStatus = cookieObj[key].blockingStatus;
56
- }
57
- acc[key] = {
58
- ...cookieObj[key],
59
- ...acc[key],
60
- blockedReasons,
61
- frameIdList,
62
- exemptionReason: acc[key]?.exemptionReason || cookieObj[key]?.exemptionReason,
63
- frameUrls,
64
- networkEvents,
65
- blockingStatus,
66
- };
67
- }
68
- else {
69
- acc[key] = cookieObj[key];
70
- }
71
- });
72
- return acc;
73
- }, {});
74
- };
75
- const createCookieObj = (frame, cookies) => Object.fromEntries(Object.values(cookies).map((cookie) => [
76
- cookie.parsedCookie.name +
77
- ':' +
78
- cookie.parsedCookie.domain +
79
- ':' +
80
- cookie.parsedCookie.path,
81
- {
82
- parsedCookie: cookie.parsedCookie,
83
- analytics: {
84
- ...cookie.analytics,
85
- category: cookie.analytics?.category === 'Unknown Category'
86
- ? I18n.getMessage('sdUncategorized')
87
- : cookie.analytics?.category,
88
- },
89
- url: cookie.url,
90
- headerType: 'response',
91
- blockedReasons: cookie.blockedReasons,
92
- isFirstParty: cookie.isFirstParty,
93
- frameIdList: [frame], // Hot fix: For Displaying cookies in CLI Dashboard.
94
- isBlocked: cookie.isBlocked,
95
- networkEvents: cookie.networkEvents,
96
- blockingStatus: cookie.blockingStatus,
97
- frameUrls: [frame],
98
- exemptionReason: cookie.exemptionReason,
99
- pageUrl: cookie.pageUrl,
100
- },
101
- ]));
102
- export default reshapeCookies;
@@ -1,179 +0,0 @@
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
- /**
17
- * External dependencies
18
- */
19
- import {} from '@google-psat/common';
20
- export const tempSinglePageData = {
21
- pageUrl: 'https://edition.cnn.com/sitemaps/sitemap-section.xml',
22
- libraryMatches: {},
23
- erroredOutUrls: [],
24
- cookieData: {
25
- 'https://edition.cnn.com': {
26
- frameCookies: {
27
- 'countryCode:.cnn.com:/': {
28
- parsedCookie: {
29
- name: 'countryCode',
30
- domain: '.cnn.com',
31
- path: '/',
32
- value: 'IN',
33
- samesite: 'None',
34
- expires: 'Session',
35
- httponly: false,
36
- secure: true,
37
- partitionKey: '',
38
- },
39
- analytics: {
40
- platform: 'Unknown',
41
- category: 'Uncategorized',
42
- GDPR: '',
43
- description: '',
44
- },
45
- url: '',
46
- isBlocked: false,
47
- isFirstParty: true,
48
- },
49
- },
50
- },
51
- },
52
- technologyData: [
53
- {
54
- slug: 'varnish',
55
- name: 'Varnish',
56
- description: 'Varnish is a reverse caching proxy.',
57
- confidence: 100,
58
- version: null,
59
- icon: 'Varnish.svg',
60
- website: 'https://www.varnish-cache.org',
61
- cpe: 'cpe:2.3:a:varnish-software:varnish_cache:*:*:*:*:*:*:*:*',
62
- categories: [
63
- {
64
- id: 23,
65
- slug: 'caching',
66
- name: 'Caching',
67
- },
68
- ],
69
- },
70
- ],
71
- };
72
- export const tempMultiPageData = [
73
- {
74
- libraryMatches: {},
75
- pageUrl: 'https://www.cnn.com/index.html',
76
- erroredOutUrls: [],
77
- technologyData: [
78
- {
79
- slug: 'varnish',
80
- name: 'Varnish',
81
- description: 'Varnish is a reverse caching proxy.',
82
- confidence: 100,
83
- version: null,
84
- icon: 'Varnish.svg',
85
- website: 'https://www.varnish-cache.org',
86
- cpe: 'cpe:2.3:a:varnish-software:varnish_cache:*:*:*:*:*:*:*:*',
87
- categories: [
88
- {
89
- id: 23,
90
- slug: 'caching',
91
- name: 'Caching',
92
- },
93
- ],
94
- },
95
- ],
96
- cookieData: {
97
- 'https://edition.cnn.com': {
98
- frameCookies: {
99
- 'countryCode:.cnn.com:/': {
100
- parsedCookie: {
101
- name: 'countryCode',
102
- domain: '.cnn.com',
103
- path: '/',
104
- value: 'IN',
105
- samesite: 'None',
106
- expires: 'Session',
107
- httponly: false,
108
- secure: true,
109
- partitionKey: '',
110
- },
111
- analytics: {
112
- platform: 'Unknown',
113
- category: 'Uncategorized',
114
- GDPR: '',
115
- description: '',
116
- },
117
- url: '',
118
- isBlocked: false,
119
- blockedReasons: ['ThirdPartyPhaseout'],
120
- isFirstParty: true,
121
- },
122
- },
123
- },
124
- },
125
- },
126
- {
127
- libraryMatches: {},
128
- pageUrl: 'https://edition.cnn.com/index.html',
129
- erroredOutUrls: [],
130
- technologyData: [
131
- {
132
- slug: 'varnish',
133
- name: 'Varnish',
134
- description: 'Varnish is a reverse caching proxy.',
135
- confidence: 100,
136
- version: null,
137
- icon: 'Varnish.svg',
138
- website: 'https://www.varnish-cache.org',
139
- cpe: 'cpe:2.3:a:varnish-software:varnish_cache:*:*:*:*:*:*:*:*',
140
- categories: [
141
- {
142
- id: 23,
143
- slug: 'caching',
144
- name: 'Caching',
145
- },
146
- ],
147
- },
148
- ],
149
- cookieData: {
150
- 'https://edition.cnn.com': {
151
- frameCookies: {
152
- 'countryCode:.cnn.com:/': {
153
- parsedCookie: {
154
- name: 'countryCode',
155
- domain: '.cnn.com',
156
- path: '/',
157
- value: 'IN',
158
- samesite: 'None',
159
- expires: 'Session',
160
- httponly: false,
161
- secure: true,
162
- partitionKey: '',
163
- },
164
- analytics: {
165
- platform: 'Unknown',
166
- category: 'Uncategorized',
167
- GDPR: '',
168
- description: '',
169
- },
170
- url: '',
171
- isBlocked: false,
172
- blockedReasons: ['ThirdPartyPhaseout'],
173
- isFirstParty: true,
174
- },
175
- },
176
- },
177
- },
178
- },
179
- ];
@@ -1,84 +0,0 @@
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
- /**
17
- * Internal dependencies
18
- */
19
- import extractCookies from '../extractCookies';
20
- import { tempSinglePageData } from './data.mock';
21
- describe('extractCookies', () => {
22
- it('should return an empty object if no cookies are present', () => {
23
- expect(extractCookies({}, '')).toEqual({});
24
- });
25
- it('should return an object with the cookies', () => {
26
- let isLandingPage = true;
27
- const pageUrl = 'https://edition.cnn.com';
28
- expect(extractCookies(tempSinglePageData.cookieData, pageUrl, isLandingPage)).toEqual({
29
- 'https://edition.cnn.com': {
30
- 'countryCode:.cnn.com:/': {
31
- parsedCookie: {
32
- name: 'countryCode',
33
- domain: '.cnn.com',
34
- path: '/',
35
- value: 'IN',
36
- samesite: 'None',
37
- expires: 'Session',
38
- httponly: false,
39
- secure: true,
40
- partitionKey: '',
41
- },
42
- analytics: {
43
- platform: 'Unknown',
44
- category: 'Uncategorized',
45
- GDPR: '',
46
- description: '',
47
- },
48
- url: '',
49
- pageUrl,
50
- isBlocked: false,
51
- isFirstParty: true,
52
- },
53
- },
54
- });
55
- isLandingPage = false;
56
- expect(extractCookies(tempSinglePageData.cookieData, pageUrl, isLandingPage)).toEqual({
57
- 'https://edition.cnn.com': {
58
- ['countryCode:.cnn.com:/' + pageUrl]: {
59
- parsedCookie: {
60
- name: 'countryCode',
61
- domain: '.cnn.com',
62
- path: '/',
63
- value: 'IN',
64
- samesite: 'None',
65
- expires: 'Session',
66
- httponly: false,
67
- secure: true,
68
- partitionKey: '',
69
- },
70
- analytics: {
71
- platform: 'Unknown',
72
- category: 'Uncategorized',
73
- GDPR: '',
74
- description: '',
75
- },
76
- url: '',
77
- pageUrl,
78
- isBlocked: false,
79
- isFirstParty: true,
80
- },
81
- },
82
- });
83
- });
84
- });
@@ -1,66 +0,0 @@
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
- /**
17
- * Internal dependencies
18
- */
19
- import extractReportData from '../extractReportData';
20
- import { tempMultiPageData } from './data.mock';
21
- describe('extractReportData', () => {
22
- it('should return an empty object if no cookies are present', () => {
23
- expect(extractReportData([])).toEqual({
24
- landingPageCookies: {},
25
- erroredOutUrlsData: [],
26
- consolidatedLibraryMatches: {},
27
- });
28
- });
29
- it('should return an object with the cookies', () => {
30
- expect(extractReportData(tempMultiPageData)).toEqual({
31
- landingPageCookies: {
32
- 'https://edition.cnn.com': {
33
- ['countryCode:.cnn.com:/']: {
34
- parsedCookie: {
35
- name: 'countryCode',
36
- domain: '.cnn.com',
37
- path: '/',
38
- value: 'IN',
39
- samesite: 'None',
40
- expires: 'Session',
41
- httponly: false,
42
- secure: true,
43
- partitionKey: '',
44
- },
45
- analytics: {
46
- platform: 'Unknown',
47
- category: 'Uncategorized',
48
- GDPR: '',
49
- description: '',
50
- },
51
- url: '',
52
- pageUrl: 'https://edition.cnn.com/index.html',
53
- isBlocked: false,
54
- blockedReasons: ['ThirdPartyPhaseout'],
55
- isFirstParty: true,
56
- },
57
- },
58
- },
59
- erroredOutUrlsData: [],
60
- consolidatedLibraryMatches: {
61
- 'https://edition.cnn.com/index.html': {},
62
- 'https://www.cnn.com/index.html': {},
63
- },
64
- });
65
- });
66
- });
@@ -1,89 +0,0 @@
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
- /**
17
- * Internal dependencies
18
- */
19
- import reshapeCookies from '../reshapeCookies';
20
- describe('reshapeCookies', () => {
21
- it('should return an empty object if no cookies are present', () => {
22
- expect(reshapeCookies({})).toEqual({});
23
- });
24
- it('should return an object with the cookies', () => {
25
- const cookies = {
26
- 'https://edition.cnn.com': {
27
- 'countryCode:.cnn.com:/': {
28
- parsedCookie: {
29
- name: 'countryCode',
30
- domain: '.cnn.com',
31
- path: '/',
32
- value: 'IN',
33
- samesite: 'None',
34
- expires: 'Session',
35
- httponly: false,
36
- secure: true,
37
- partitionKey: '',
38
- },
39
- analytics: {
40
- platform: 'Unknown',
41
- category: 'Uncategorized',
42
- GDPR: '',
43
- description: '',
44
- },
45
- url: 'https://www.cnn.com/index.html',
46
- isBlocked: false,
47
- blockedReasons: [],
48
- blockingStatus: undefined,
49
- networkEvents: undefined,
50
- isFirstParty: true,
51
- pageUrl: 'https://www.cnn.com/index.html',
52
- frameUrls: { sadf: 'https://edition.cnn.com' },
53
- },
54
- },
55
- };
56
- expect(reshapeCookies(cookies)).toEqual({
57
- 'countryCode:.cnn.com:/': {
58
- parsedCookie: {
59
- name: 'countryCode',
60
- value: 'IN',
61
- domain: '.cnn.com',
62
- path: '/',
63
- expires: 'Session',
64
- httponly: false,
65
- secure: true,
66
- samesite: 'None',
67
- partitionKey: '',
68
- },
69
- analytics: {
70
- platform: 'Unknown',
71
- category: 'Uncategorized',
72
- description: '',
73
- GDPR: '',
74
- },
75
- blockingStatus: undefined,
76
- networkEvents: undefined,
77
- isFirstParty: true,
78
- url: 'https://www.cnn.com/index.html',
79
- frameUrls: ['https://edition.cnn.com'],
80
- frameIdList: ['https://edition.cnn.com'],
81
- isBlocked: false,
82
- blockedReasons: [],
83
- headerType: 'response',
84
- exemptionReason: undefined,
85
- pageUrl: 'https://www.cnn.com/index.html',
86
- },
87
- });
88
- });
89
- });
@@ -1,5 +0,0 @@
1
- interface TechnologiesProps {
2
- selectedSite: string | null;
3
- }
4
- declare const Technologies: ({ selectedSite }: TechnologiesProps) => import("react/jsx-runtime").JSX.Element;
5
- export default Technologies;
@@ -1,6 +0,0 @@
1
- import { type CompleteJson, type CookieFrameStorageType } from '@google-psat/common';
2
- /**
3
- * Internal dependencies
4
- */
5
- declare const extractCookies: (cookieData: CompleteJson["cookieData"], pageUrl: string, shouldAddUrlToKey?: boolean) => CookieFrameStorageType;
6
- export default extractCookies;
@@ -1,12 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import type { CompleteJson, ErroredOutUrlsData, LibraryData } from '@google-psat/common';
5
- declare const extractReportData: (data: CompleteJson[]) => {
6
- landingPageCookies: {};
7
- consolidatedLibraryMatches: {
8
- [url: string]: LibraryData;
9
- };
10
- erroredOutUrlsData: ErroredOutUrlsData[];
11
- };
12
- export default extractReportData;
@@ -1,8 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { type CookieTableData, type CookieFrameStorageType } from '@google-psat/common';
5
- declare const reshapeCookies: (cookies: CookieFrameStorageType) => {
6
- [k: string]: CookieTableData;
7
- };
8
- export default reshapeCookies;
@@ -1,6 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { type CompleteJson } from '@google-psat/common';
5
- export declare const tempSinglePageData: CompleteJson;
6
- export declare const tempMultiPageData: CompleteJson[];