@cookiemunch/sdk 0.13.2 → 0.14.1
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 +9 -0
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +33 -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.1";
|
|
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,10 @@ 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[];
|
|
497
|
+
/** referalli: the token in your aff.js tag; without cookieDays/programHandle the lifetime is the window that script is served with. */
|
|
498
|
+
orgToken?: string;
|
|
495
499
|
/** impact: your program id; declares IR_<campaignId> too. */
|
|
496
500
|
campaignId?: string;
|
|
497
501
|
}
|
|
@@ -616,6 +620,28 @@ export interface DeclarationDiff {
|
|
|
616
620
|
after: DeclaredCookie;
|
|
617
621
|
}>;
|
|
618
622
|
}
|
|
623
|
+
/** POST /v1/sites/:cbid/cookies/plan — the declarations PUT, then each preset in key order. */
|
|
624
|
+
export interface CookiePlanInput {
|
|
625
|
+
cookies?: Array<DeclaredCookieInput & {
|
|
626
|
+
name: string;
|
|
627
|
+
}>;
|
|
628
|
+
replace?: boolean;
|
|
629
|
+
/** Vendor → its params, applied in key order, each seeing the steps before it. */
|
|
630
|
+
presets?: Partial<Record<CookiePresetVendor, CookiePresetParams>>;
|
|
631
|
+
}
|
|
632
|
+
/** What the steps, in order, would produce. Nothing was stored. */
|
|
633
|
+
export interface CookiePlanResult {
|
|
634
|
+
dryRun: true;
|
|
635
|
+
/** Each step's own dry-run answer, plus `step` (`cookies` or `presets.<vendor>`) and its diff against the step before. */
|
|
636
|
+
steps: Array<{
|
|
637
|
+
step: string;
|
|
638
|
+
diff: DeclarationDiff;
|
|
639
|
+
[k: string]: unknown;
|
|
640
|
+
}>;
|
|
641
|
+
declared: DeclaredCookie[];
|
|
642
|
+
count: number;
|
|
643
|
+
diff: DeclarationDiff;
|
|
644
|
+
}
|
|
619
645
|
/** The answer to a `dryRun` declaration write: nothing was stored. */
|
|
620
646
|
export interface DeclarationDryRun {
|
|
621
647
|
dryRun: true;
|
|
@@ -2939,6 +2965,11 @@ export interface CookieMunchClient {
|
|
|
2939
2965
|
dryRun?: true;
|
|
2940
2966
|
diff?: DeclarationDiff;
|
|
2941
2967
|
}>;
|
|
2968
|
+
/**
|
|
2969
|
+
* Plan a provisioning run, storing nothing: the declarations PUT (`cookies`, `replace`), then each
|
|
2970
|
+
* preset in `presets` in key order, against one scratch copy — exactly what the real calls in that order produce.
|
|
2971
|
+
*/
|
|
2972
|
+
planCookies(cbid: string, input: CookiePlanInput): Promise<CookiePlanResult>;
|
|
2942
2973
|
snippet(cbid: string, opts?: SnippetOptions): Promise<InstallSnippet>;
|
|
2943
2974
|
/**
|
|
2944
2975
|
* 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.1";
|
|
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 }),
|