@cookiemunch/sdk 0.8.0 → 0.9.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/CHANGELOG.md +5 -0
- package/dist/index.cjs +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +61 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ import type { ConformanceReport } from './executor-conformance.js';
|
|
|
20
20
|
* This package's version, sent in the default User-Agent. Cloudflare answers a request with
|
|
21
21
|
* no recognisable User-Agent with `403 error code: 1010`; a test pins this to package.json.
|
|
22
22
|
*/
|
|
23
|
-
export declare const SDK_VERSION = "0.
|
|
23
|
+
export declare const SDK_VERSION = "0.9.0";
|
|
24
24
|
export interface CookieMunchOptions {
|
|
25
25
|
apiKey: string;
|
|
26
26
|
/** "https://api.cookiemunch.net" — the /v1 prefix is appended automatically. */
|
|
@@ -358,11 +358,16 @@ export interface CookiePresetManifest {
|
|
|
358
358
|
code?: string;
|
|
359
359
|
message: string;
|
|
360
360
|
}>;
|
|
361
|
+
/**
|
|
362
|
+
* About the copy in effect: `entry_skipped` / `storage_entry_skipped` (one entry was unreadable and left out; the
|
|
363
|
+
* rest still applies, and a left-out storage entry gives `name`), or `short_notice`.
|
|
364
|
+
*/
|
|
361
365
|
warnings?: Array<{
|
|
362
366
|
rule?: number;
|
|
363
367
|
path?: string;
|
|
364
368
|
code?: string;
|
|
365
369
|
message: string;
|
|
370
|
+
name?: string;
|
|
366
371
|
}>;
|
|
367
372
|
}
|
|
368
373
|
/** PUT /v1/sites/:cbid/cookies/presets/custom — any vendor's embed manifest, by URL or as a body. */
|
|
@@ -766,6 +771,15 @@ export interface ButtonParityLint {
|
|
|
766
771
|
/** 100 minus 20 per warning and 5 per notice, floored at 0. */
|
|
767
772
|
score: number;
|
|
768
773
|
suggestedReject: SuggestedRejectStyle[];
|
|
774
|
+
/** Laws taking effect within 90 days where at least 1% of the site's recent decisions come from. Absent when none. */
|
|
775
|
+
regulatoryWarnings?: Array<{
|
|
776
|
+
code: 'law_upcoming';
|
|
777
|
+
law: string;
|
|
778
|
+
effective: string;
|
|
779
|
+
daysUntil: number;
|
|
780
|
+
trafficShare: number;
|
|
781
|
+
message: string;
|
|
782
|
+
}>;
|
|
769
783
|
}
|
|
770
784
|
/**
|
|
771
785
|
* Scrollbars on the surfaces Cookie Munch renders — the same shape on the banner theme (`theme.scrollbar`)
|
|
@@ -1851,6 +1865,44 @@ export interface RegulatoryFeedResult {
|
|
|
1851
1865
|
stale: boolean;
|
|
1852
1866
|
regulations: RegulationSummary[];
|
|
1853
1867
|
}
|
|
1868
|
+
/** A law taking effect soon where a site's visitors are. */
|
|
1869
|
+
export interface SiteUpcomingRegulation {
|
|
1870
|
+
id: string;
|
|
1871
|
+
name: string;
|
|
1872
|
+
jurisdiction: string;
|
|
1873
|
+
effective: string;
|
|
1874
|
+
/** Whole days from today; 0 = takes effect today. */
|
|
1875
|
+
daysUntil: number;
|
|
1876
|
+
/** Share (0–1) of the site's decisions in the window from where this law applies. */
|
|
1877
|
+
trafficShare: number;
|
|
1878
|
+
obligations: string[];
|
|
1879
|
+
/** For a US state law: what changes for the banner. */
|
|
1880
|
+
changes?: {
|
|
1881
|
+
universalOptOut: boolean;
|
|
1882
|
+
universalOptOutFrom?: string;
|
|
1883
|
+
sensitiveOptIn: boolean;
|
|
1884
|
+
minorOptInUnder: number;
|
|
1885
|
+
minorsAds: 'opt-in' | 'prohibited';
|
|
1886
|
+
};
|
|
1887
|
+
source: string;
|
|
1888
|
+
}
|
|
1889
|
+
/** `GET /v1/sites/{cbid}/regulatory/upcoming`. */
|
|
1890
|
+
export interface SiteUpcomingRegulations {
|
|
1891
|
+
reviewedAt: string;
|
|
1892
|
+
ageDays: number;
|
|
1893
|
+
reviewAfterDays: number;
|
|
1894
|
+
stale: boolean;
|
|
1895
|
+
days: number;
|
|
1896
|
+
minShare: number;
|
|
1897
|
+
/** The traffic window, epoch ms: the last 30 days. */
|
|
1898
|
+
window: {
|
|
1899
|
+
from: number;
|
|
1900
|
+
to: number;
|
|
1901
|
+
};
|
|
1902
|
+
/** Decisions recorded in the window. */
|
|
1903
|
+
decisions: number;
|
|
1904
|
+
upcoming: SiteUpcomingRegulation[];
|
|
1905
|
+
}
|
|
1854
1906
|
export interface AiInspectInput {
|
|
1855
1907
|
prompt: string;
|
|
1856
1908
|
purpose: string;
|
|
@@ -2999,6 +3051,14 @@ export interface CookieMunchClient {
|
|
|
2999
3051
|
feed(jurisdictions?: string[]): Promise<RegulatoryFeedResult>;
|
|
3000
3052
|
/** What takes effect within `days` (default 180), soonest first. */
|
|
3001
3053
|
upcoming(days?: number): Promise<RegulatoryFeedResult>;
|
|
3054
|
+
/**
|
|
3055
|
+
* `GET /v1/sites/{cbid}/regulatory/upcoming`: what takes effect within `days` (default 90)
|
|
3056
|
+
* where at least `minShare` (default 0.01) of this site's last 30 days of decisions came from.
|
|
3057
|
+
*/
|
|
3058
|
+
upcomingForSite(cbid: string, opts?: {
|
|
3059
|
+
days?: number;
|
|
3060
|
+
minShare?: number;
|
|
3061
|
+
}): Promise<SiteUpcomingRegulations>;
|
|
3002
3062
|
};
|
|
3003
3063
|
/** AI governance: policy, the inline gateway, inventory and lineage. */
|
|
3004
3064
|
ai: {
|
package/dist/index.js
CHANGED
|
@@ -257,7 +257,7 @@ async function exchangeOperatorToken(input) {
|
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
// src/index.ts
|
|
260
|
-
var SDK_VERSION = "0.
|
|
260
|
+
var SDK_VERSION = "0.9.0";
|
|
261
261
|
var CookieMunchApiError = class extends Error {
|
|
262
262
|
constructor(status, message, code, body) {
|
|
263
263
|
super(message);
|
|
@@ -569,7 +569,8 @@ function createCookieMunch(opts) {
|
|
|
569
569
|
},
|
|
570
570
|
regulatory: {
|
|
571
571
|
feed: (jurisdictions) => get(`/regulatory/feed${qs({ jurisdictions: jurisdictions?.join(",") })}`),
|
|
572
|
-
upcoming: (days) => get(`/regulatory/upcoming${qs({ days })}`)
|
|
572
|
+
upcoming: (days) => get(`/regulatory/upcoming${qs({ days })}`),
|
|
573
|
+
upcomingForSite: (cbid, opts2) => get(`/sites/${enc(cbid)}/regulatory/upcoming${qs({ days: opts2?.days, minShare: opts2?.minShare })}`)
|
|
573
574
|
},
|
|
574
575
|
ai: {
|
|
575
576
|
getPolicy: () => get("/ai/policy"),
|