@cookiemunch/sdk 0.16.0 → 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
@@ -382,6 +382,34 @@ export interface CookieTranslateResult {
382
382
  reason: string;
383
383
  }>;
384
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
+ }
385
413
  /** A platform whose cookies and storage a preset declares. */
386
414
  export type CookiePresetVendor = 'atlas' | 'forumulate' | 'chatly' | 'cookiemunch' | 'referalli' | 'firstpromoter' | 'partnerstack' | 'tapfiliate' | 'impact' | 'seolyticize'
387
415
  /** @deprecated the old name of `referalli`, accepted until 2027-10-23. */
@@ -2957,6 +2985,15 @@ export interface CookieMunchClient {
2957
2985
  }, opts?: {
2958
2986
  dryRun?: boolean;
2959
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>;
2960
2997
  /** Remove every declaration a vendor preset made. */
2961
2998
  removeCookiePreset(cbid: string, vendor: CookiePresetVendor | (string & {}), opts?: {
2962
2999
  dryRun?: boolean;
package/dist/index.js CHANGED
@@ -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 })}`);