@preprio/toolkit 0.5.0-rc.4 → 0.5.1-dom.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.
Files changed (43) hide show
  1. package/README.md +67 -2
  2. package/dist/astro/index.cjs +1 -1
  3. package/dist/astro/index.js +1 -1
  4. package/dist/auto.cjs +4572 -0
  5. package/dist/auto.d.cts +42 -0
  6. package/dist/auto.d.ts +42 -0
  7. package/dist/auto.js +105 -0
  8. package/dist/browser/auto.js +117 -0
  9. package/dist/chunk-5I5TQ3NO.js +74 -0
  10. package/dist/chunk-AZC4BZJI.js +447 -0
  11. package/dist/{chunk-TG6N3C22.js → chunk-IKOOXTPM.js} +1 -1
  12. package/dist/{chunk-AHBN6FQP.js → chunk-IOSO232M.js} +4 -2
  13. package/dist/{chunk-PDNCNTDB.js → chunk-RRM5762S.js} +2 -71
  14. package/dist/chunk-SZTHSJUA.js +326 -0
  15. package/dist/{chunk-46ISDRHT.js → chunk-TEB7M7EM.js} +0 -4
  16. package/dist/chunk-UK664KSV.js +6 -0
  17. package/dist/{chunk-74KY5EAM.js → chunk-ZFGVP2GW.js} +28 -447
  18. package/dist/html-live-DzmEG9wU.d.cts +42 -0
  19. package/dist/html-live-DzmEG9wU.d.ts +42 -0
  20. package/dist/index.cjs +177 -2
  21. package/dist/index.d.cts +31 -28
  22. package/dist/index.d.ts +31 -28
  23. package/dist/index.js +21 -154
  24. package/dist/{live-preview-H4643QYF.js → live-preview-IYAS7PYV.js} +3 -2
  25. package/dist/nextjs/components.cjs +1 -1
  26. package/dist/nextjs/components.d.cts +2 -1
  27. package/dist/nextjs/components.d.ts +2 -1
  28. package/dist/nextjs/components.js +6 -3
  29. package/dist/nextjs/index.cjs +1 -1
  30. package/dist/nextjs/index.js +1 -1
  31. package/dist/nextjs/live-action.js +5 -3
  32. package/dist/nextjs/live.js +1 -1
  33. package/dist/nuxt/index.cjs +1 -1
  34. package/dist/nuxt/index.js +1 -1
  35. package/dist/pixel-DwW7cXJm.d.cts +49 -0
  36. package/dist/pixel-DwW7cXJm.d.ts +49 -0
  37. package/dist/react/components.cjs +1 -1
  38. package/dist/react/components.js +1 -1
  39. package/dist/sveltekit/index.cjs +1 -1
  40. package/dist/sveltekit/index.js +1 -1
  41. package/dist/{pixel-CX422dCO.d.cts → types-DtMa_-f2.d.cts} +1 -49
  42. package/dist/{pixel-CX422dCO.d.ts → types-DtMa_-f2.d.ts} +1 -49
  43. package/package.json +12 -2
@@ -0,0 +1,447 @@
1
+ import {
2
+ createScopedLogger
3
+ } from "./chunk-S3VT4UWM.js";
4
+
5
+ // src/core/live-preview/field-name.ts
6
+ var UPPERCASE_BOUNDARY = /(.)(?=[A-Z])/g;
7
+ function graphqlFieldName(apiId) {
8
+ return apiId.replace(UPPERCASE_BOUNDARY, "$1_").toLowerCase();
9
+ }
10
+ function fieldKeyIn(record, apiId) {
11
+ if (Object.prototype.hasOwnProperty.call(record, apiId)) return apiId;
12
+ const name = graphqlFieldName(apiId);
13
+ return Object.prototype.hasOwnProperty.call(record, name) ? name : void 0;
14
+ }
15
+ var TEXT_BODY_FIELDS = [
16
+ { name: "body", plain: false },
17
+ { name: "html", plain: false },
18
+ { name: "text", plain: true }
19
+ ];
20
+ var TAG_PATTERN = /<[^>]+>/g;
21
+ function plainTextFromHtml(html) {
22
+ return html.replace(TAG_PATTERN, "");
23
+ }
24
+ function isTextEntry(record) {
25
+ const typename = record.__typename;
26
+ if (typeof typename === "string") return typename === "Text";
27
+ return "html" in record || "text" in record && "format" in record;
28
+ }
29
+
30
+ // src/core/live-preview/index-snapshot.ts
31
+ var debug = createScopedLogger("live-preview");
32
+ function indexSnapshot(data) {
33
+ const index = /* @__PURE__ */ new Map();
34
+ const visited = /* @__PURE__ */ new WeakSet();
35
+ const path = [];
36
+ function walk(node) {
37
+ if (node === null || typeof node !== "object") return;
38
+ if (visited.has(node)) return;
39
+ visited.add(node);
40
+ if (Array.isArray(node)) {
41
+ for (let i = 0; i < node.length; i++) {
42
+ path.push(i);
43
+ walk(node[i]);
44
+ path.pop();
45
+ }
46
+ return;
47
+ }
48
+ const record = node;
49
+ if (typeof record._id === "string") {
50
+ const paths = index.get(record._id);
51
+ if (paths) paths.push([...path]);
52
+ else index.set(record._id, [[...path]]);
53
+ } else if (typeof record.__typename === "string") {
54
+ debug.log("item without _id will not live-update", {
55
+ __typename: record.__typename
56
+ });
57
+ }
58
+ for (const key in record) {
59
+ if (!Object.prototype.hasOwnProperty.call(record, key)) continue;
60
+ path.push(key);
61
+ walk(record[key]);
62
+ path.pop();
63
+ }
64
+ }
65
+ walk(data);
66
+ return index;
67
+ }
68
+
69
+ // src/core/live-preview/patch.ts
70
+ import { vercelStegaSplit } from "@vercel/stega";
71
+ var INDEX_SEGMENT = /^\d+$/;
72
+ var FORBIDDEN_SEGMENTS = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
73
+ function isPlainObject(value) {
74
+ return value !== null && typeof value === "object" && !Array.isArray(value);
75
+ }
76
+ function mergeObject(current, incoming) {
77
+ let changed = false;
78
+ const next = { ...current };
79
+ for (const key of Object.keys(current)) {
80
+ if (!(key in incoming) || incoming[key] === void 0) continue;
81
+ const value = isPlainObject(current[key]) && isPlainObject(incoming[key]) ? mergeObject(current[key], incoming[key]) : incoming[key];
82
+ if (value !== current[key]) {
83
+ next[key] = value;
84
+ changed = true;
85
+ }
86
+ }
87
+ return changed ? next : current;
88
+ }
89
+ function shapeLike(template, incoming) {
90
+ const out = {};
91
+ for (const key of Object.keys(template)) {
92
+ const value = incoming[key];
93
+ out[key] = value === void 0 ? null : isPlainObject(template[key]) && isPlainObject(value) ? shapeLike(template[key], value) : value;
94
+ }
95
+ return out;
96
+ }
97
+ function mergeStructured(current, incoming) {
98
+ if (incoming === null || Array.isArray(incoming) && !incoming.length) {
99
+ if (Array.isArray(current)) return current.length ? [] : current;
100
+ return null;
101
+ }
102
+ const list = Array.isArray(incoming) ? incoming : [incoming];
103
+ if (current === null || current === void 0) return incoming;
104
+ if (Array.isArray(current)) {
105
+ const template = current.find(isPlainObject);
106
+ return list.map((entry) => {
107
+ const match = current.find(
108
+ (c) => isPlainObject(c) && c._id !== void 0 && c._id === entry._id
109
+ );
110
+ if (isPlainObject(match)) return mergeObject(match, entry);
111
+ return isPlainObject(template) ? shapeLike(template, entry) : entry;
112
+ });
113
+ }
114
+ if (isPlainObject(current)) return mergeObject(current, list[0]);
115
+ return current;
116
+ }
117
+ function isPatchable(current) {
118
+ return current === null || typeof current === "string" || typeof current === "number" || typeof current === "boolean";
119
+ }
120
+ function cloneNode(node) {
121
+ return Array.isArray(node) ? [...node] : { ...node };
122
+ }
123
+ function patchSnapshot(snapshot, index, itemId, field, value) {
124
+ const paths = index.get(itemId);
125
+ if (!paths?.length) return snapshot;
126
+ let root = snapshot;
127
+ let changed = false;
128
+ const markChanged = () => {
129
+ changed = true;
130
+ };
131
+ for (const path of paths) {
132
+ for (const [target, targetValue] of expandTextBody(
133
+ root,
134
+ path,
135
+ field,
136
+ value
137
+ )) {
138
+ root = patchAtPath(root, path, target, targetValue, markChanged);
139
+ }
140
+ }
141
+ return changed ? root : snapshot;
142
+ }
143
+ function expandTextBody(root, path, field, value) {
144
+ const segments = field.split(".");
145
+ if (segments[segments.length - 1] !== "body" || typeof value !== "string") {
146
+ return [[field, value]];
147
+ }
148
+ let node = root;
149
+ for (const step of path) {
150
+ node = node[step];
151
+ }
152
+ for (const segment of segments.slice(0, -1)) {
153
+ if (node === null || typeof node !== "object") return [[field, value]];
154
+ const record2 = node;
155
+ node = INDEX_SEGMENT.test(segment) ? record2[Number(segment)] : record2[fieldKeyIn(record2, segment) ?? segment];
156
+ }
157
+ if (node === null || typeof node !== "object" || Array.isArray(node)) {
158
+ return [[field, value]];
159
+ }
160
+ const record = node;
161
+ if (!isTextEntry(record)) return [[field, value]];
162
+ const prefix = segments.slice(0, -1);
163
+ const writes = [];
164
+ for (const { name, plain } of TEXT_BODY_FIELDS) {
165
+ if (!(name in record)) continue;
166
+ writes.push([
167
+ [...prefix, name].join("."),
168
+ plain ? plainTextFromHtml(value) : value
169
+ ]);
170
+ }
171
+ return writes.length ? writes : [[field, value]];
172
+ }
173
+ function patchAtPath(root, path, field, value, markChanged) {
174
+ const segments = field.split(".");
175
+ if (segments.some((s) => FORBIDDEN_SEGMENTS.has(s))) return root;
176
+ let node = root;
177
+ for (const step of path) {
178
+ node = node[step];
179
+ }
180
+ const fullPath = [...path];
181
+ for (const segment of segments) {
182
+ let step = segment;
183
+ if (INDEX_SEGMENT.test(segment)) {
184
+ step = Number(segment);
185
+ } else if (node !== null && typeof node === "object") {
186
+ step = fieldKeyIn(node, segment) ?? segment;
187
+ }
188
+ fullPath.push(step);
189
+ node = node !== null && typeof node === "object" ? node[step] : void 0;
190
+ }
191
+ return writeAtPath(root, fullPath, value, markChanged);
192
+ }
193
+ function writeAtPath(root, fullPath, value, markChanged = () => {
194
+ }) {
195
+ if (!fullPath.length) return root;
196
+ if (fullPath.some((s) => FORBIDDEN_SEGMENTS.has(String(s)))) return root;
197
+ const last = fullPath.length - 1;
198
+ let node = root;
199
+ for (let i = 0; i < last; i++) {
200
+ if (node === null || typeof node !== "object") return root;
201
+ node = node[fullPath[i]];
202
+ }
203
+ if (node === null || typeof node !== "object") return root;
204
+ const container = node;
205
+ const key = fullPath[last];
206
+ if (!(key in container)) return root;
207
+ let next;
208
+ if (value === null || typeof value === "object") {
209
+ next = mergeStructured(container[key], value);
210
+ } else if (!isPatchable(container[key])) {
211
+ return root;
212
+ } else {
213
+ next = keepEditLink(container[key], value);
214
+ }
215
+ if (container[key] === next) return root;
216
+ const newRoot = cloneNode(root);
217
+ let cursor = newRoot;
218
+ for (let i = 0; i < last; i++) {
219
+ const child = cloneNode(cursor[fullPath[i]]);
220
+ cursor[fullPath[i]] = child;
221
+ cursor = child;
222
+ }
223
+ cursor[key] = next;
224
+ markChanged();
225
+ return newRoot;
226
+ }
227
+ function listKeysOf(entry) {
228
+ if (!isPlainObject(entry)) return [];
229
+ const keys = [];
230
+ if (typeof entry._id === "string") keys.push(entry._id);
231
+ const first = Array.isArray(entry.items) ? entry.items[0] : null;
232
+ if (isPlainObject(first) && typeof first._id === "string") {
233
+ keys.push(first._id);
234
+ }
235
+ return keys;
236
+ }
237
+ function buildText(entry, template) {
238
+ const body = typeof entry.body === "string" ? entry.body : "";
239
+ const full = {
240
+ __typename: "Text",
241
+ _id: entry._id,
242
+ body,
243
+ html: body,
244
+ text: plainTextFromHtml(body),
245
+ format: entry.format ?? null
246
+ };
247
+ if (!template) return full;
248
+ const out = {};
249
+ for (const key of Object.keys(template)) {
250
+ out[key] = key in full ? full[key] : null;
251
+ }
252
+ return out;
253
+ }
254
+ function syncList(current, entries, build) {
255
+ if (current === null || current === void 0) {
256
+ const built = syncList([], entries, build);
257
+ return built.length ? built : current;
258
+ }
259
+ if (!Array.isArray(current)) return current;
260
+ const byKey = /* @__PURE__ */ new Map();
261
+ const templates = /* @__PURE__ */ new Map();
262
+ for (const c of current) {
263
+ for (const key of listKeysOf(c)) byKey.set(key, c);
264
+ if (isPlainObject(c) && typeof c.__typename === "string") {
265
+ if (!templates.has(c.__typename)) templates.set(c.__typename, c);
266
+ }
267
+ }
268
+ if (!entries.length) return current.length ? [] : current;
269
+ if (current.length && !byKey.size) return current;
270
+ if (current.length && !entries.some((e) => byKey.has(e._id))) return current;
271
+ const next = [];
272
+ for (const entry of entries) {
273
+ const existing = byKey.get(entry._id);
274
+ const built = existing === void 0 && entry.fields ? build?.(entry) : void 0;
275
+ if (existing !== void 0) {
276
+ next.push(existing);
277
+ } else if (built) {
278
+ next.push(built);
279
+ } else if (entry.__typename === "Text") {
280
+ next.push(buildText(entry, templates.get("Text")));
281
+ }
282
+ }
283
+ const same = next.length === current.length && next.every((n, i) => n === current[i]);
284
+ return same ? current : next;
285
+ }
286
+ function syncListSnapshot(snapshot, index, itemId, field, entries) {
287
+ const paths = index.get(itemId);
288
+ if (!paths?.length) return snapshot;
289
+ const fieldPath = field.split(".");
290
+ if (fieldPath.some((s) => FORBIDDEN_SEGMENTS.has(s))) return snapshot;
291
+ let root = snapshot;
292
+ for (const path of paths) {
293
+ root = syncListAtPath(root, [...path, ...fieldPath], entries);
294
+ }
295
+ return root;
296
+ }
297
+ function syncListAtPath(root, fullPath, entries, build) {
298
+ if (!fullPath.length) return root;
299
+ if (fullPath.some((s) => FORBIDDEN_SEGMENTS.has(String(s)))) return root;
300
+ let node = root;
301
+ for (const key of fullPath) {
302
+ node = node !== null && typeof node === "object" ? node[key] : void 0;
303
+ }
304
+ const next = syncList(node, entries, build);
305
+ if (next === node) return root;
306
+ const newRoot = cloneNode(root);
307
+ let cursor = newRoot;
308
+ for (let i = 0; i < fullPath.length - 1; i++) {
309
+ const child = cloneNode(cursor[fullPath[i]]);
310
+ cursor[fullPath[i]] = child;
311
+ cursor = child;
312
+ }
313
+ cursor[fullPath[fullPath.length - 1]] = next;
314
+ return newRoot;
315
+ }
316
+ function keepEditLink(current, value) {
317
+ if (typeof current !== "string" || typeof value !== "string") return value;
318
+ const { encoded } = vercelStegaSplit(current);
319
+ if (!encoded || vercelStegaSplit(value).encoded) return value;
320
+ return value + encoded;
321
+ }
322
+
323
+ // src/core/live-preview/validate.ts
324
+ function isScalar(v) {
325
+ return typeof v === "string" || typeof v === "number" || typeof v === "boolean";
326
+ }
327
+ var MAX_DEPTH = 3;
328
+ var MAX_ENTRIES = 50;
329
+ var FORBIDDEN_KEYS = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
330
+ var SAFE_URL = /^https?:\/\//i;
331
+ var URL_KEY = /^(?:url|href|src|link)$|(?:_url|Url)$/;
332
+ var URL_IGNORED_ANYWHERE = /[\t\n\r]/g;
333
+ var SCRIPT_SCHEME = /^(?:javascript|vbscript|data):/i;
334
+ function isSafeLinkValue(value) {
335
+ const stripped = value.replace(URL_IGNORED_ANYWHERE, "");
336
+ let start = 0;
337
+ while (start < stripped.length && stripped.charCodeAt(start) <= 32) start++;
338
+ return !SCRIPT_SCHEME.test(stripped.slice(start));
339
+ }
340
+ function isUrlKey(key) {
341
+ return URL_KEY.test(key);
342
+ }
343
+ function isSafeKeyValue(key, value) {
344
+ if (typeof value !== "string") return true;
345
+ if (key === "url") return SAFE_URL.test(value);
346
+ return !isUrlKey(key) || isSafeLinkValue(value);
347
+ }
348
+ function isLiveValue(v, depth = 0) {
349
+ if (v === null || isScalar(v)) return true;
350
+ if (depth >= MAX_DEPTH) return false;
351
+ if (Array.isArray(v)) {
352
+ return depth === 0 && v.length <= MAX_ENTRIES && v.every((entry) => isPlainRecord(entry) && isLiveValue(entry, depth + 1));
353
+ }
354
+ if (!isPlainRecord(v)) return false;
355
+ const keys = Object.keys(v);
356
+ if (keys.length > MAX_ENTRIES) return false;
357
+ return keys.every((key) => {
358
+ if (FORBIDDEN_KEYS.has(key)) return false;
359
+ const value = v[key];
360
+ if (!isSafeKeyValue(key, value)) return false;
361
+ return !Array.isArray(value) && isLiveValue(value, depth + 1);
362
+ });
363
+ }
364
+ function isLiveFieldChange(field, value) {
365
+ if (!isLiveValue(value)) return false;
366
+ const name = field.slice(field.lastIndexOf(".") + 1);
367
+ return typeof value !== "string" || !isUrlKey(name) || isSafeLinkValue(value);
368
+ }
369
+ var MAX_LIST_ENTRIES = 200;
370
+ function parseListEntries(value) {
371
+ if (!Array.isArray(value) || value.length > MAX_LIST_ENTRIES) return null;
372
+ const list = [];
373
+ for (const raw of value) {
374
+ if (!isPlainRecord(raw) || typeof raw._id !== "string" || !raw._id) {
375
+ return null;
376
+ }
377
+ const entry = { _id: raw._id };
378
+ if (typeof raw.__typename === "string") entry.__typename = raw.__typename;
379
+ if (typeof raw.body === "string") entry.body = raw.body;
380
+ if (typeof raw.format === "string" || raw.format === null) {
381
+ entry.format = raw.format;
382
+ }
383
+ if (typeof raw.typeName === "string" && raw.typeName.length <= 200) {
384
+ entry.typeName = raw.typeName;
385
+ }
386
+ if (raw.fields !== void 0) {
387
+ if (!isPlainRecord(raw.fields) || !isFieldValue(raw.fields, 0)) {
388
+ return null;
389
+ }
390
+ entry.fields = raw.fields;
391
+ }
392
+ list.push(entry);
393
+ }
394
+ return list;
395
+ }
396
+ function isPlainRecord(v) {
397
+ return v !== null && typeof v === "object" && Object.getPrototypeOf(v) === Object.prototype;
398
+ }
399
+ var MAX_FIELD_DEPTH = 6;
400
+ var MAX_FIELD_KEYS = 100;
401
+ function isFieldValue(v, depth) {
402
+ if (v === null || isScalar(v)) return true;
403
+ if (depth >= MAX_FIELD_DEPTH) return false;
404
+ if (Array.isArray(v)) {
405
+ return v.length <= MAX_ENTRIES && v.every(
406
+ (entry) => isScalar(entry) || isPlainRecord(entry) && isFieldValue(entry, depth + 1)
407
+ );
408
+ }
409
+ if (!isPlainRecord(v)) return false;
410
+ const keys = Object.keys(v);
411
+ if (keys.length > MAX_FIELD_KEYS) return false;
412
+ return keys.every((key) => {
413
+ if (FORBIDDEN_KEYS.has(key)) return false;
414
+ const value = v[key];
415
+ if (!isSafeKeyValue(key, value)) return false;
416
+ return isFieldValue(value, depth + 1);
417
+ });
418
+ }
419
+ var MAX_EDIT_LENGTH = 1e3;
420
+ function parseEditTarget(raw) {
421
+ if (!isPlainRecord(raw)) return void 0;
422
+ const { item, field } = raw;
423
+ if (typeof item !== "string" || !item || item.length > MAX_EDIT_LENGTH) {
424
+ return void 0;
425
+ }
426
+ if (typeof field !== "string" || !field || field.length > MAX_EDIT_LENGTH) {
427
+ return void 0;
428
+ }
429
+ return { item, field };
430
+ }
431
+
432
+ export {
433
+ graphqlFieldName,
434
+ TEXT_BODY_FIELDS,
435
+ plainTextFromHtml,
436
+ isTextEntry,
437
+ indexSnapshot,
438
+ patchSnapshot,
439
+ writeAtPath,
440
+ syncListSnapshot,
441
+ syncListAtPath,
442
+ keepEditLink,
443
+ isLiveFieldChange,
444
+ parseListEntries,
445
+ isPlainRecord,
446
+ parseEditTarget
447
+ };
@@ -8,7 +8,7 @@ import {
8
8
  parseListEntries,
9
9
  patchSnapshot,
10
10
  syncListSnapshot
11
- } from "./chunk-74KY5EAM.js";
11
+ } from "./chunk-AZC4BZJI.js";
12
12
  import {
13
13
  createScopedLogger,
14
14
  getTrustedParentOrigin,
@@ -1,7 +1,9 @@
1
1
  import {
2
- VERSION,
2
+ VERSION
3
+ } from "./chunk-UK664KSV.js";
4
+ import {
3
5
  resolveFeatures
4
- } from "./chunk-46ISDRHT.js";
6
+ } from "./chunk-TEB7M7EM.js";
5
7
 
6
8
  // src/core/server.ts
7
9
  var PreprError = class extends Error {
@@ -1,8 +1,7 @@
1
1
  import {
2
2
  ALL_FEATURES_ENABLED,
3
- VERSION,
4
3
  resolveFeatures
5
- } from "./chunk-46ISDRHT.js";
4
+ } from "./chunk-TEB7M7EM.js";
6
5
  import {
7
6
  createIframeBridge,
8
7
  isLocale,
@@ -3077,71 +3076,6 @@ function createPreprPreview(opts = {}) {
3077
3076
  return controller;
3078
3077
  }
3079
3078
 
3080
- // src/core/pixel.ts
3081
- var PIXEL_SCRIPT_URL = "https://cdn.tracking.prepr.io/js/prepr.min.js";
3082
- var CACHE_BUST_INTERVAL_MS = 24 * 60 * 60 * 1e3;
3083
- var warnedNoPixel = false;
3084
- function warnNoPixelOnce() {
3085
- if (warnedNoPixel) return;
3086
- warnedNoPixel = true;
3087
- console.warn(
3088
- "[Prepr] Tracking pixel is not installed. Call loadTrackingPixel() first, or ensure the legacy Prepr snippet is present on the page."
3089
- );
3090
- }
3091
- function loadTrackingPixel(trackingId, config) {
3092
- if (typeof window === "undefined" || typeof document === "undefined") {
3093
- return;
3094
- }
3095
- if (window.prepr) {
3096
- return;
3097
- }
3098
- const queueFn = ((...args) => {
3099
- if (queueFn.process) {
3100
- queueFn.process(...args);
3101
- } else {
3102
- queueFn.queue.push(args);
3103
- }
3104
- });
3105
- queueFn.queue = [];
3106
- queueFn.t = Date.now();
3107
- window.prepr = queueFn;
3108
- const script = document.createElement("script");
3109
- script.async = true;
3110
- const cacheBuster = Math.ceil(Date.now() / CACHE_BUST_INTERVAL_MS) * CACHE_BUST_INTERVAL_MS;
3111
- script.src = `${PIXEL_SCRIPT_URL}?t=${cacheBuster}`;
3112
- const firstScript = document.getElementsByTagName("script")[0];
3113
- if (firstScript?.parentNode) {
3114
- firstScript.parentNode.insertBefore(script, firstScript);
3115
- } else {
3116
- document.head.appendChild(script);
3117
- }
3118
- if (config !== void 0) {
3119
- queueFn("init", trackingId, config);
3120
- } else {
3121
- queueFn("init", trackingId);
3122
- }
3123
- queueFn("param", "pp", VERSION);
3124
- queueFn("event", "pageload");
3125
- }
3126
- function trackEvent(name, data) {
3127
- if (typeof window === "undefined" || !window.prepr) {
3128
- warnNoPixelOnce();
3129
- return;
3130
- }
3131
- if (data !== void 0) {
3132
- window.prepr("event", name, data);
3133
- } else {
3134
- window.prepr("event", name);
3135
- }
3136
- }
3137
- function setTrackingParam(key, value) {
3138
- if (typeof window === "undefined" || !window.prepr) {
3139
- warnNoPixelOnce();
3140
- return;
3141
- }
3142
- window.prepr("param", key, value);
3143
- }
3144
-
3145
3079
  export {
3146
3080
  COOKIE_PREVIEW_MODE,
3147
3081
  COOKIE_SEGMENT,
@@ -3157,8 +3091,5 @@ export {
3157
3091
  createToolbarStore,
3158
3092
  PreprToolbarElement,
3159
3093
  definePreprToolbar,
3160
- createPreprPreview,
3161
- loadTrackingPixel,
3162
- trackEvent,
3163
- setTrackingParam
3094
+ createPreprPreview
3164
3095
  };