@cookiemunch/sdk 0.13.2 → 0.14.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 +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +31 -2
- package/dist/index.js +2 -1
- 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.14.0";
|
|
24
24
|
export interface CookieMunchOptions {
|
|
25
25
|
apiKey: string;
|
|
26
26
|
/** "https://api.cookiemunch.net" — the /v1 prefix is appended automatically. */
|
|
@@ -467,7 +467,7 @@ export interface CookieSuggestionsDeclared {
|
|
|
467
467
|
declared?: DeclaredCookie[];
|
|
468
468
|
diff?: DeclarationDiff;
|
|
469
469
|
}
|
|
470
|
-
/** Preset parameters: Atlas `frontendApiHost`/`crossSubdomainCookies`/`publishableKey`; Chatly `publicId`/`dragging`/`storage`/`tracking`/`category`; referral and affiliate presets (referalli, firstpromoter, partnerstack, tapfiliate, impact) `cookieDomain`/`cookieDays`/`category`, referalli `legacyName`, impact `campaignId`. */
|
|
470
|
+
/** Preset parameters: Atlas `frontendApiHost`/`crossSubdomainCookies`/`publishableKey`; Chatly `publicId`/`dragging`/`storage`/`tracking`/`category`; referral and affiliate presets (referalli, firstpromoter, partnerstack, tapfiliate, impact) `cookieDomain`/`cookieDays`/`category`, referalli `legacyName`/`programHandle`, impact `campaignId`. */
|
|
471
471
|
export interface CookiePresetParams {
|
|
472
472
|
frontendApiHost?: string;
|
|
473
473
|
crossSubdomainCookies?: boolean;
|
|
@@ -492,6 +492,8 @@ export interface CookiePresetParams {
|
|
|
492
492
|
cookieDays?: number;
|
|
493
493
|
/** referalli: default true, also declare referally_ctx (the pre-rename copy aff.js still writes). */
|
|
494
494
|
legacyName?: boolean;
|
|
495
|
+
/** referalli: your program handle(s), up to 10; without cookieDays the lifetime is the programs' public cookieWindowDays. */
|
|
496
|
+
programHandle?: string | string[];
|
|
495
497
|
/** impact: your program id; declares IR_<campaignId> too. */
|
|
496
498
|
campaignId?: string;
|
|
497
499
|
}
|
|
@@ -616,6 +618,28 @@ export interface DeclarationDiff {
|
|
|
616
618
|
after: DeclaredCookie;
|
|
617
619
|
}>;
|
|
618
620
|
}
|
|
621
|
+
/** POST /v1/sites/:cbid/cookies/plan — the declarations PUT, then each preset in key order. */
|
|
622
|
+
export interface CookiePlanInput {
|
|
623
|
+
cookies?: Array<DeclaredCookieInput & {
|
|
624
|
+
name: string;
|
|
625
|
+
}>;
|
|
626
|
+
replace?: boolean;
|
|
627
|
+
/** Vendor → its params, applied in key order, each seeing the steps before it. */
|
|
628
|
+
presets?: Partial<Record<CookiePresetVendor, CookiePresetParams>>;
|
|
629
|
+
}
|
|
630
|
+
/** What the steps, in order, would produce. Nothing was stored. */
|
|
631
|
+
export interface CookiePlanResult {
|
|
632
|
+
dryRun: true;
|
|
633
|
+
/** Each step's own dry-run answer, plus `step` (`cookies` or `presets.<vendor>`) and its diff against the step before. */
|
|
634
|
+
steps: Array<{
|
|
635
|
+
step: string;
|
|
636
|
+
diff: DeclarationDiff;
|
|
637
|
+
[k: string]: unknown;
|
|
638
|
+
}>;
|
|
639
|
+
declared: DeclaredCookie[];
|
|
640
|
+
count: number;
|
|
641
|
+
diff: DeclarationDiff;
|
|
642
|
+
}
|
|
619
643
|
/** The answer to a `dryRun` declaration write: nothing was stored. */
|
|
620
644
|
export interface DeclarationDryRun {
|
|
621
645
|
dryRun: true;
|
|
@@ -2939,6 +2963,11 @@ export interface CookieMunchClient {
|
|
|
2939
2963
|
dryRun?: true;
|
|
2940
2964
|
diff?: DeclarationDiff;
|
|
2941
2965
|
}>;
|
|
2966
|
+
/**
|
|
2967
|
+
* Plan a provisioning run, storing nothing: the declarations PUT (`cookies`, `replace`), then each
|
|
2968
|
+
* preset in `presets` in key order, against one scratch copy — exactly what the real calls in that order produce.
|
|
2969
|
+
*/
|
|
2970
|
+
planCookies(cbid: string, input: CookiePlanInput): Promise<CookiePlanResult>;
|
|
2942
2971
|
snippet(cbid: string, opts?: SnippetOptions): Promise<InstallSnippet>;
|
|
2943
2972
|
/**
|
|
2944
2973
|
* Mint a short-lived signed token to see the banner as a visitor in a given region and
|
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.
|
|
91
|
+
var SDK_VERSION = "0.14.0";
|
|
92
92
|
var CookieMunchApiError = class extends Error {
|
|
93
93
|
constructor(status, message, code, body) {
|
|
94
94
|
super(message);
|
|
@@ -258,6 +258,7 @@ function createCookieMunch(opts) {
|
|
|
258
258
|
return o?.dryRun ? out : void 0;
|
|
259
259
|
}),
|
|
260
260
|
declareCookies: (cbid, cookies, o) => request("PUT", `/sites/${enc(cbid)}/cookies${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, { cookies, ...o?.replace ? { replace: true } : {} }),
|
|
261
|
+
planCookies: (cbid, input) => request("POST", `/sites/${enc(cbid)}/cookies/plan`, input),
|
|
261
262
|
snippet: (cbid, opts2) => get(`/sites/${enc(cbid)}/snippet${qs({ blockingmode: opts2?.blockingMode, culture: opts2?.culture })}`),
|
|
262
263
|
previewToken: (cbid, o) => request("POST", `/sites/${enc(cbid)}/preview-token`, o ?? {}),
|
|
263
264
|
verify: (cbid, method) => request("POST", `/sites/${enc(cbid)}/verify`, { method }),
|