@cookiemunch/sdk 0.15.1 → 0.17.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/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.15.1";
23
+ export declare const SDK_VERSION = "0.16.0";
24
24
  export interface CookieMunchOptions {
25
25
  apiKey: string;
26
26
  /** "https://api.cookiemunch.net" — the /v1 prefix is appended automatically. */
@@ -283,7 +283,8 @@ export interface CategorizedCookie {
283
283
  vendor?: string;
284
284
  }
285
285
  /** What a declaration row describes. */
286
- export type StorageType = 'cookie' | 'localStorage' | 'sessionStorage' | 'indexedDB';
286
+ /** `none`: a cookieless processor (an analytics beacon) declared so the policy names it; nothing is stored. */
287
+ export type StorageType = 'cookie' | 'localStorage' | 'sessionStorage' | 'indexedDB' | 'none';
287
288
  /** A cookie the site owner retired: the site renamed or stopped setting it. */
288
289
  export interface RetiredCookie {
289
290
  /** Exact name, or a `prefix*` wildcard. */
@@ -324,7 +325,7 @@ export interface DeclaredCookieInput {
324
325
  domain?: string;
325
326
  /** Treat the name as a prefix wildcard (a trailing `*` does the same). */
326
327
  pattern?: boolean;
327
- /** A cookie (default) or a key in localStorage, sessionStorage or IndexedDB. */
328
+ /** A cookie (default), a key in localStorage, sessionStorage or IndexedDB, or `none` (stores nothing: a cookieless processor). */
328
329
  type?: StorageType;
329
330
  }
330
331
  /** A stored declaration. */
@@ -381,8 +382,36 @@ export interface CookieTranslateResult {
381
382
  reason: string;
382
383
  }>;
383
384
  }
385
+ /** POST /v1/sites/:cbid/config/translate */
386
+ export interface ConfigTranslateResult {
387
+ dryRun: boolean;
388
+ provider: 'deepl' | 'google' | null;
389
+ languages: string[];
390
+ unsupported: Array<{
391
+ language: string;
392
+ reason: string;
393
+ }>;
394
+ failed: Array<{
395
+ language: string;
396
+ error: string;
397
+ }>;
398
+ characters: number;
399
+ translated: number;
400
+ /** Per copy path (`banner.title`, `categories.chat.label`) and language; `text` is absent on a dry run. */
401
+ changes: Array<{
402
+ path: string;
403
+ language: string;
404
+ source: string;
405
+ text?: string;
406
+ }>;
407
+ skipped: Array<{
408
+ path: string;
409
+ language: string;
410
+ reason: string;
411
+ }>;
412
+ }
384
413
  /** A platform whose cookies and storage a preset declares. */
385
- export type CookiePresetVendor = 'atlas' | 'forumulate' | 'chatly' | 'cookiemunch' | 'referalli' | 'firstpromoter' | 'partnerstack' | 'tapfiliate' | 'impact'
414
+ export type CookiePresetVendor = 'atlas' | 'forumulate' | 'chatly' | 'cookiemunch' | 'referalli' | 'firstpromoter' | 'partnerstack' | 'tapfiliate' | 'impact' | 'seolyticize'
386
415
  /** @deprecated the old name of `referalli`, accepted until 2027-10-23. */
387
416
  | 'referally';
388
417
  /** Where a vendor's live manifest will come from, and whether it exists yet. */
@@ -2426,6 +2455,8 @@ export interface ExecutorPresetStep {
2426
2455
  /** The presets, which are usable now, and this org's canary address. */
2427
2456
  export interface ExecutorPresets {
2428
2457
  canaryEmail: string;
2458
+ /** The same list as `presets`, under the name every list answer uses. */
2459
+ data?: ExecutorPresets['presets'];
2429
2460
  presets: Array<{
2430
2461
  name: ExecutorPresetName;
2431
2462
  title: string;
@@ -2901,7 +2932,7 @@ export interface CookieMunchClient {
2901
2932
  dryRun: true;
2902
2933
  retired: RetiredCookie[];
2903
2934
  }>;
2904
- /** Every declaration preset (atlas, forumulate, chatly, cookiemunch, referalli, firstpromoter, partnerstack, tapfiliate, impact): params, what it declared here, manifest status. */
2935
+ /** Every declaration preset (atlas, forumulate, chatly, cookiemunch, referalli, firstpromoter, partnerstack, tapfiliate, impact, seolyticize): params, what it declared here, manifest status. */
2905
2936
  cookiePresets(cbid: string): Promise<{
2906
2937
  presets: CookiePreset[];
2907
2938
  aliases?: Record<string, string>;
@@ -2954,6 +2985,15 @@ export interface CookieMunchClient {
2954
2985
  }, opts?: {
2955
2986
  dryRun?: boolean;
2956
2987
  }): Promise<CookieTranslateResult>;
2988
+ /**
2989
+ * The same for the site's own banner and category copy: fills the `i18n.overrides` languages
2990
+ * it lacks on the connected account. Never overwrites a person's text. `dryRun` calls no provider.
2991
+ */
2992
+ translateConfig(cbid: string, input?: {
2993
+ languages?: string[];
2994
+ }, opts?: {
2995
+ dryRun?: boolean;
2996
+ }): Promise<ConfigTranslateResult>;
2957
2997
  /** Remove every declaration a vendor preset made. */
2958
2998
  removeCookiePreset(cbid: string, vendor: CookiePresetVendor | (string & {}), opts?: {
2959
2999
  dryRun?: boolean;
package/dist/index.js CHANGED
@@ -88,7 +88,7 @@ async function exchangeOperatorToken(input) {
88
88
  }
89
89
 
90
90
  // src/index.ts
91
- var SDK_VERSION = "0.15.1";
91
+ var SDK_VERSION = "0.16.0";
92
92
  var CookieMunchApiError = class extends Error {
93
93
  constructor(status, message, code, body) {
94
94
  super(message);
@@ -253,6 +253,7 @@ function createCookieMunch(opts) {
253
253
  connectTranslation: (cbid, input, o) => request("PUT", `/sites/${enc(cbid)}/translation${qs({ verify: o?.verify ? "1" : void 0 })}`, input),
254
254
  disconnectTranslation: (cbid) => request("DELETE", `/sites/${enc(cbid)}/translation`),
255
255
  translateCookies: (cbid, input, o) => request("POST", `/sites/${enc(cbid)}/cookies/translate${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, input ?? {}),
256
+ translateConfig: (cbid, input, o) => request("POST", `/sites/${enc(cbid)}/config/translate${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, input ?? {}),
256
257
  removeCookiePreset: (cbid, vendor, o) => request("DELETE", `/sites/${enc(cbid)}/cookies/presets/${enc(vendor)}${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`),
257
258
  deleteObservedCookie: (async (cbid, name, o) => {
258
259
  const out = await request("DELETE", `/sites/${enc(cbid)}/observed-cookies/${enc(name)}${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`);