@google-psat/report 0.10.0 → 0.10.1

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.
@@ -21,6 +21,6 @@ import { PrivacySandboxColoredIcon } from '@google-psat/design-system';
21
21
  const Header = ({ url, dateTime }) => {
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", 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 text-cente", children: isExtension ? 'PSAT Extension Analysis' : 'PSAT CLI Analysis' })] }));
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 text-cente", children: isExtension ? 'PSAT Extension Analysis' : 'PSAT CLI Analysis' })] }));
25
25
  };
26
26
  export default Header;
@@ -133,7 +133,7 @@ const Layout = ({ landingPageCookies, completeJson, sidebarData, setSidebarData,
133
133
  updateSelectedItemKey(SIDEBAR_ITEMS_KEYS.COOKIES);
134
134
  }
135
135
  }, [isKeySelected, selectedItemKey, sidebarData, updateSelectedItemKey]);
136
- return (_jsxs("div", { className: "w-full h-screen flex", children: [_jsx(Resizable, { defaultSize: { width: '200px', height: '100%' }, minWidth: '150px', maxWidth: '50%', enable: {
136
+ return (_jsxs("div", { className: "w-full h-screen flex dark:bg-raisin-black text-raisin-black dark:text-bright-gray", children: [_jsx(Resizable, { defaultSize: { width: '200px', height: '100%' }, minWidth: '150px', maxWidth: '50%', enable: {
137
137
  right: true,
138
138
  }, children: _jsx(Sidebar, {}) }), _jsx("div", { className: "flex-1 max-h-screen overflow-auto", children: PanelElement && _jsx(PanelElement, { ...props }) })] }));
139
139
  };
@@ -138,7 +138,7 @@ const Layout = ({ selectedSite, setSidebarData, query = '', clearQuery = noop, }
138
138
  lastSelectedSite.current = selectedSite;
139
139
  }
140
140
  }, [selectedSite, updateSelectedItemKey]);
141
- return (_jsxs("div", { className: "w-full h-full flex", children: [_jsx(Resizable, { defaultSize: { width: '200px', height: '100%' }, minWidth: '150px', maxWidth: '60%', enable: {
141
+ return (_jsxs("div", { className: "w-full h-full flex dark:bg-raisin-black text-raisin-black dark:text-bright-gray", children: [_jsx(Resizable, { defaultSize: { width: '200px', height: '100%' }, minWidth: '150px', maxWidth: '60%', enable: {
142
142
  right: true,
143
143
  }, children: _jsx(Sidebar, {}) }), _jsx("div", { className: "flex-1 max-h-screen overflow-auto", children: PanelElement && _jsx(PanelElement, { ...props }) })] }));
144
144
  };
@@ -72,7 +72,10 @@ const BlockedCookiesSection = ({ tabCookies, cookiesWithIssues, tabFrames, }) =>
72
72
  },
73
73
  };
74
74
  });
75
- return (_jsx(CookiesLandingWrapper, { dataMapping: blockedCookieDataMapping, testId: "blocked-cookies-insights", children: dataComponents.length > 0 && (_jsxs(_Fragment, { children: [_jsx(MatrixContainer, { title: I18n.getMessage('blockedCookies'), matrixData: dataComponents, infoIconTitle: I18n.getMessage('blockedReasonsNote') }),
75
+ const description = blockedCookiesStats.blockedCookies.total === 0
76
+ ? 'No cookies were blocked by the browser.'
77
+ : '';
78
+ return (_jsx(CookiesLandingWrapper, { description: description, dataMapping: blockedCookieDataMapping, testId: "blocked-cookies-insights", children: dataComponents.length > 0 && (_jsxs(_Fragment, { children: [_jsx(MatrixContainer, { title: I18n.getMessage('blockedCookies'), matrixData: dataComponents, infoIconTitle: I18n.getMessage('blockedReasonsNote') }),
76
79
  //@ts-ignore -- PSAT_EXTENSTION is added only when the report is downloaded from the extension. Since optional chaining is done it will return false if it doesnt exist.
77
80
  !globalThis?.PSAT_EXTENSION && (_jsx("div", { className: "flex flex-col mt-8", children: _jsx("div", { className: "pt-4", children: _jsx(MatrixContainer, { matrixData: blockedDataComponents, allowExpand: false }) }) }))] })) }));
78
81
  };
@@ -20,10 +20,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
20
20
  import { getLegendDescription } from '@google-psat/common';
21
21
  import { I18n } from '@google-psat/i18n';
22
22
  import { CookiesLandingWrapper, MatrixContainer, LEGEND_DESCRIPTION, prepareFrameStatsComponentForExtensionDashboard, } from '@google-psat/design-system';
23
- const FramesSection = () => {
23
+ const FramesSection = ({ tabCookies }) => {
24
24
  const framesStats = prepareFrameStatsComponentForExtensionDashboard(
25
25
  //@ts-ignore
26
- globalThis?.PSAT_DATA.json[0] || {});
26
+ globalThis?.PSAT_DATA.json[0] || {}, tabCookies);
27
27
  const dataComponents = framesStats.legend.map((component) => {
28
28
  const legendDescription = LEGEND_DESCRIPTION[component.descriptionKey] || '';
29
29
  return {
@@ -87,6 +87,10 @@ const Landing = ({ tabFrames, tabCookies, cookiesWithIssues, downloadReport, lib
87
87
  link: 'frames',
88
88
  panel: {
89
89
  Element: FramesSection,
90
+ props: {
91
+ tabCookies,
92
+ tabFrames,
93
+ },
90
94
  },
91
95
  });
92
96
  }
@@ -49,6 +49,11 @@ const reshapeCookies = (cookies) => {
49
49
  ...(acc[key].networkEvents?.responseEvents || []),
50
50
  ],
51
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
+ }
52
57
  acc[key] = {
53
58
  ...cookieObj[key],
54
59
  ...acc[key],
@@ -57,7 +62,7 @@ const reshapeCookies = (cookies) => {
57
62
  exemptionReason: acc[key]?.exemptionReason || cookieObj[key]?.exemptionReason,
58
63
  frameUrls,
59
64
  networkEvents,
60
- blockingStatus: deriveBlockingStatus(networkEvents),
65
+ blockingStatus,
61
66
  };
62
67
  }
63
68
  else {
@@ -29,9 +29,9 @@ export const tempSinglePageData = {
29
29
  domain: '.cnn.com',
30
30
  path: '/',
31
31
  value: 'IN',
32
- sameSite: 'None',
32
+ samesite: 'None',
33
33
  expires: 'Session',
34
- httpOnly: false,
34
+ httponly: false,
35
35
  secure: true,
36
36
  partitionKey: '',
37
37
  },
@@ -100,9 +100,9 @@ export const tempMultiPageData = [
100
100
  domain: '.cnn.com',
101
101
  path: '/',
102
102
  value: 'IN',
103
- sameSite: 'None',
103
+ samesite: 'None',
104
104
  expires: 'Session',
105
- httpOnly: false,
105
+ httponly: false,
106
106
  secure: true,
107
107
  partitionKey: '',
108
108
  },
@@ -152,9 +152,9 @@ export const tempMultiPageData = [
152
152
  domain: '.cnn.com',
153
153
  path: '/',
154
154
  value: 'IN',
155
- sameSite: 'None',
155
+ samesite: 'None',
156
156
  expires: 'Session',
157
- httpOnly: false,
157
+ httponly: false,
158
158
  secure: true,
159
159
  partitionKey: '',
160
160
  },
@@ -33,9 +33,9 @@ describe('extractCookies', () => {
33
33
  domain: '.cnn.com',
34
34
  path: '/',
35
35
  value: 'IN',
36
- sameSite: 'None',
36
+ samesite: 'None',
37
37
  expires: 'Session',
38
- httpOnly: false,
38
+ httponly: false,
39
39
  secure: true,
40
40
  partitionKey: '',
41
41
  },
@@ -61,9 +61,9 @@ describe('extractCookies', () => {
61
61
  domain: '.cnn.com',
62
62
  path: '/',
63
63
  value: 'IN',
64
- sameSite: 'None',
64
+ samesite: 'None',
65
65
  expires: 'Session',
66
- httpOnly: false,
66
+ httponly: false,
67
67
  secure: true,
68
68
  partitionKey: '',
69
69
  },
@@ -35,9 +35,9 @@ describe('extractReportData', () => {
35
35
  domain: '.cnn.com',
36
36
  path: '/',
37
37
  value: 'IN',
38
- sameSite: 'None',
38
+ samesite: 'None',
39
39
  expires: 'Session',
40
- httpOnly: false,
40
+ httponly: false,
41
41
  secure: true,
42
42
  partitionKey: '',
43
43
  },
@@ -30,9 +30,9 @@ describe('reshapeCookies', () => {
30
30
  domain: '.cnn.com',
31
31
  path: '/',
32
32
  value: 'IN',
33
- sameSite: 'None',
33
+ samesite: 'None',
34
34
  expires: 'Session',
35
- httpOnly: false,
35
+ httponly: false,
36
36
  secure: true,
37
37
  partitionKey: '',
38
38
  },
@@ -61,9 +61,9 @@ describe('reshapeCookies', () => {
61
61
  domain: '.cnn.com',
62
62
  path: '/',
63
63
  expires: 'Session',
64
- httpOnly: false,
64
+ httponly: false,
65
65
  secure: true,
66
- sameSite: 'None',
66
+ samesite: 'None',
67
67
  partitionKey: '',
68
68
  },
69
69
  analytics: {
@@ -80,7 +80,7 @@ const useCookieListing = (tabCookies, selectedFrameUrl, persistenceKey = 'cookie
80
80
  },
81
81
  {
82
82
  header: I18n.getMessage('sameSite'),
83
- accessorKey: 'parsedCookie.sameSite',
83
+ accessorKey: 'parsedCookie.samesite',
84
84
  cell: (info) => I18n.getMessage((info?.toString() || '').toLowerCase()),
85
85
  widthWeightagePercentage: 8,
86
86
  },
@@ -210,7 +210,7 @@ const useCookieListing = (tabCookies, selectedFrameUrl, persistenceKey = 'cookie
210
210
  return val === (filterValue === I18n.getMessage('true'));
211
211
  },
212
212
  },
213
- 'parsedCookie.sameSite': {
213
+ 'parsedCookie.samesite': {
214
214
  title: I18n.getMessage('sameSite'),
215
215
  hasStaticFilterValues: true,
216
216
  filterValues: {
@@ -227,7 +227,7 @@ const useCookieListing = (tabCookies, selectedFrameUrl, persistenceKey = 'cookie
227
227
  useGenericPersistenceKey: true,
228
228
  comparator: (value, filterValue) => {
229
229
  const val = value;
230
- return val?.toLowerCase() === filterValue.toLowerCase();
230
+ return I18n.getMessage(val?.toLowerCase()) === filterValue;
231
231
  },
232
232
  },
233
233
  'parsedCookie.secure': {
@@ -1,2 +1,9 @@
1
- declare const FramesSection: () => import("react/jsx-runtime").JSX.Element;
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { type TabCookies } from '@google-psat/common';
5
+ interface FramesSectionProps {
6
+ tabCookies: TabCookies | null;
7
+ }
8
+ declare const FramesSection: ({ tabCookies }: FramesSectionProps) => import("react/jsx-runtime").JSX.Element;
2
9
  export default FramesSection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google-psat/report",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Static HTML analysis report",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist-types/index.d.ts",