Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Add provider to allowed list #551

Merged
merged 2 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
ref: use allowed list context provider instead of hook and update paths
  • Loading branch information
mayan-000 committed Mar 12, 2024
commit 748234bd17fc8db04aba74b2856bd37dc2d1527a
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import { CookieDetails, CookieTable } from '@ps-analysis-tool/design-system';
import { useCookieStore } from '../../../stateProviders/syncCookieStore';
import useCookieListing from './useCookieListing';
import RowContextMenu from './rowContextMenu';
import useAllowedList from './useAllowedList';
import { useSettingsStore } from '../../../stateProviders/syncSettingsStore';
import { useAllowedList } from '../../../stateProviders/useAllowedList';

interface CookiesListingProps {
setFilteredCookies: React.Dispatch<CookieTableData[]>;
Expand All @@ -47,7 +47,11 @@ const CookiesListing = ({ setFilteredCookies }: CookiesListingProps) => {
const isUsingCDP = useSettingsStore(({ state }) => state.isUsingCDP);

const { domainsInAllowList, setDomainsInAllowListCallback, isIncognito } =
useAllowedList();
useAllowedList(({ state, actions }) => ({
domainsInAllowList: state.domainsInAllowList,
setDomainsInAllowListCallback: actions.setDomainsInAllowListCallback,
isIncognito: state.isIncognito,
}));

const {
tableData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ import type { TableRow } from '@ps-analysis-tool/design-system';
/**
* Internal dependencies
*/
import setParentDomain from './useAllowedList/setParentDomain';
import onAllowListClick from './useAllowedList/onAllowListClick';
import reloadCurrentTab from '../../../../../utils/reloadCurrentTab';
import getDotPrefixedDomain from './useAllowedList/getDotPrefixedDomain';
import isCookieDomainInAllowList from './useAllowedList/isCookieDomainInAllowList';
import {
setParentDomain,
onAllowListClick,
getDotPrefixedDomain,
isCookieDomainInAllowList,
} from '../../../stateProviders/useAllowedList/utils';

interface RowContextMenuProps {
domainsInAllowList: Set<string>;
isIncognito: boolean;
setDomainsInAllowListCallback: React.Dispatch<
React.SetStateAction<Set<string>>
>;
setDomainsInAllowListCallback: (list: Set<string>) => void;
tabUrl: string;
removeSelectedRow?: () => void;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { getCookieKey, type TabCookies } from '@ps-analysis-tool/common';
/**
* Internal dependencies.
*/
import isCookieDomainInAllowList from '../useAllowedList/isCookieDomainInAllowList';
import { isCookieDomainInAllowList } from '../../../../stateProviders/useAllowedList/utils';

const useHighlighting = (
cookies: TabCookies,
Expand Down
5 changes: 4 additions & 1 deletion packages/extension/src/view/devtools/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { LibraryDetectionProvider } from '@ps-analysis-tool/library-detection';
import App from './app';
import { Provider as ExternalStoreProvider } from './stateProviders/syncCookieStore';
import { Provider as SettingsStoreProvider } from './stateProviders/syncSettingsStore';
import { Provider as AllowedListProvider } from './stateProviders/useAllowedList';

const isDarkMode = chrome.devtools.panels.themeName === 'dark';
document.body.classList.add(isDarkMode ? 'dark' : 'light');
Expand All @@ -44,7 +45,9 @@ if (root) {
<ExternalStoreProvider>
<TablePersistentSettingsProvider>
<LibraryDetectionProvider>
<App />
<AllowedListProvider>
<App />
</AllowedListProvider>
</LibraryDetectionProvider>
</TablePersistentSettingsProvider>
</ExternalStoreProvider>
Expand Down
Loading