Move detectors into detectors/ folder
Reorganize detector files into src/detectors/ following the same pattern as src/integrations/. Rename detector-interface.ts to detector.ts (the interface), and detector.ts to cookie-detector.ts. Barrel export from detectors/index.ts provides Detector interface and all three detector classes. Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -17,11 +17,9 @@ import {
|
||||
observeAndActivate,
|
||||
} from "./activation";
|
||||
import { COOKIE_NAME, getConsentCookie, setConsentCookie } from "./cookie";
|
||||
import { CookieDetector } from "./detector";
|
||||
import type { Detector } from "./detector-interface";
|
||||
import type { Detector } from "./detectors";
|
||||
import { CookieDetector, StorageDetector, ThirdPartyDetector } from "./detectors";
|
||||
import { NotFoundError } from "./errors";
|
||||
import { StorageDetector } from "./storage-detector";
|
||||
import { ThirdPartyDetector } from "./third-party-detector";
|
||||
import { fetchJSON } from "./http";
|
||||
import { detectLanguage } from "./i18n";
|
||||
import type { ConsentIntegration } from "./integrations";
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
import { isDeletion, parseCookieName, parseMaxAgeSeconds } from "./cookie-utils";
|
||||
import type { Detector } from "./detector-interface";
|
||||
import { NotFoundError } from "./errors";
|
||||
import { fetchJSON } from "./http";
|
||||
import { isDeletion, parseCookieName, parseMaxAgeSeconds } from "../cookie-utils";
|
||||
import type { Detector } from "./detector";
|
||||
import { NotFoundError } from "../errors";
|
||||
import { fetchJSON } from "../http";
|
||||
|
||||
interface DetectedCookieEntry {
|
||||
name: string;
|
||||
18
packages/cookie-banner/src/detectors/index.ts
Normal file
18
packages/cookie-banner/src/detectors/index.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
// Copyright (c) 2026 Probo Inc <hello@getprobo.com>.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
export type { Detector } from "./detector";
|
||||
export { CookieDetector } from "./cookie-detector";
|
||||
export { StorageDetector } from "./storage-detector";
|
||||
export { ThirdPartyDetector } from "./third-party-detector";
|
||||
@@ -12,9 +12,9 @@
|
||||
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
import type { Detector } from "./detector-interface";
|
||||
import { NotFoundError } from "./errors";
|
||||
import { fetchJSON } from "./http";
|
||||
import type { Detector } from "./detector";
|
||||
import { NotFoundError } from "../errors";
|
||||
import { fetchJSON } from "../http";
|
||||
|
||||
interface DetectedStorageEntry {
|
||||
key: string;
|
||||
@@ -12,9 +12,9 @@
|
||||
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
import type { Detector } from "./detector-interface";
|
||||
import { NotFoundError } from "./errors";
|
||||
import { fetchJSON } from "./http";
|
||||
import type { Detector } from "./detector";
|
||||
import { NotFoundError } from "../errors";
|
||||
import { fetchJSON } from "../http";
|
||||
|
||||
interface DetectedResourceEntry {
|
||||
origin: string;
|
||||
Reference in New Issue
Block a user