@preprio/toolkit 0.4.1 → 0.4.3
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/astro/index.cjs +3 -3
- package/dist/astro/index.d.cts +3 -0
- package/dist/astro/index.d.ts +3 -0
- package/dist/astro/index.js +3 -3
- package/dist/{chunk-FP5XYD6J.js → chunk-H7VA7NGY.js} +8 -4
- package/dist/index.cjs +10 -6
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/nextjs/components.cjs +8 -4
- package/dist/nextjs/components.d.cts +1 -1
- package/dist/nextjs/components.d.ts +1 -1
- package/dist/nextjs/components.js +1 -1
- package/dist/nextjs/index.cjs +3 -3
- package/dist/nextjs/index.d.cts +3 -0
- package/dist/nextjs/index.d.ts +3 -0
- package/dist/nextjs/index.js +3 -3
- package/dist/nuxt/index.cjs +3 -3
- package/dist/nuxt/index.d.cts +3 -0
- package/dist/nuxt/index.d.ts +3 -0
- package/dist/nuxt/index.js +3 -3
- package/dist/{pixel-Wsfvw9G2.d.cts → pixel-e1fUWl2Y.d.cts} +4 -1
- package/dist/{pixel-Wsfvw9G2.d.ts → pixel-e1fUWl2Y.d.ts} +4 -1
- package/dist/react/components.cjs +8 -4
- package/dist/react/components.js +8 -4
- package/dist/sveltekit/index.cjs +3 -3
- package/dist/sveltekit/index.d.cts +3 -0
- package/dist/sveltekit/index.d.ts +3 -0
- package/dist/sveltekit/index.js +3 -3
- package/package.json +1 -1
package/dist/astro/index.cjs
CHANGED
|
@@ -30,7 +30,7 @@ __export(astro_exports, {
|
|
|
30
30
|
module.exports = __toCommonJS(astro_exports);
|
|
31
31
|
|
|
32
32
|
// src/version.ts
|
|
33
|
-
var VERSION = "0.4.
|
|
33
|
+
var VERSION = "0.4.3";
|
|
34
34
|
|
|
35
35
|
// src/core/features.ts
|
|
36
36
|
function isEnabled(config) {
|
|
@@ -83,7 +83,7 @@ var PREPR_HEADER_KEYS = [
|
|
|
83
83
|
"Prepr-Visitor-IP",
|
|
84
84
|
"Prepr-Hubspot-Id",
|
|
85
85
|
"Prepr-Customer-Id-Created",
|
|
86
|
-
"
|
|
86
|
+
"User-Agent",
|
|
87
87
|
"Prepr-Package"
|
|
88
88
|
];
|
|
89
89
|
function getPreprHeadersFromHeaders(headers) {
|
|
@@ -272,7 +272,7 @@ function processFrameworkRequest(request, opts, framework) {
|
|
|
272
272
|
}
|
|
273
273
|
const userAgent = request.headers.get("user-agent");
|
|
274
274
|
if (userAgent) {
|
|
275
|
-
requestHeaders.set("
|
|
275
|
+
requestHeaders.set("User-Agent", sanitizeHeaderValue(userAgent));
|
|
276
276
|
}
|
|
277
277
|
const packageParts = [`@preprio/toolkit@${opts?.version ?? VERSION}`];
|
|
278
278
|
if (framework) packageParts.push(`framework=${framework}`);
|
package/dist/astro/index.d.cts
CHANGED
|
@@ -59,6 +59,9 @@ interface PreprHeaders {
|
|
|
59
59
|
readonly 'Prepr-Visitor-IP'?: string;
|
|
60
60
|
readonly 'Prepr-Hubspot-Id'?: string;
|
|
61
61
|
readonly 'Prepr-Customer-Id-Created'?: 'true';
|
|
62
|
+
/** The visitor's browser User-Agent, used by the API for device detection. */
|
|
63
|
+
readonly 'User-Agent'?: string;
|
|
64
|
+
/** @deprecated Never populated; the visitor's value is under `User-Agent`. */
|
|
62
65
|
readonly 'Prepr-User-Agent'?: string;
|
|
63
66
|
readonly 'Prepr-Package'?: string;
|
|
64
67
|
}
|
package/dist/astro/index.d.ts
CHANGED
|
@@ -59,6 +59,9 @@ interface PreprHeaders {
|
|
|
59
59
|
readonly 'Prepr-Visitor-IP'?: string;
|
|
60
60
|
readonly 'Prepr-Hubspot-Id'?: string;
|
|
61
61
|
readonly 'Prepr-Customer-Id-Created'?: 'true';
|
|
62
|
+
/** The visitor's browser User-Agent, used by the API for device detection. */
|
|
63
|
+
readonly 'User-Agent'?: string;
|
|
64
|
+
/** @deprecated Never populated; the visitor's value is under `User-Agent`. */
|
|
62
65
|
readonly 'Prepr-User-Agent'?: string;
|
|
63
66
|
readonly 'Prepr-Package'?: string;
|
|
64
67
|
}
|
package/dist/astro/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var VERSION = "0.4.
|
|
2
|
+
var VERSION = "0.4.3";
|
|
3
3
|
|
|
4
4
|
// src/core/features.ts
|
|
5
5
|
function isEnabled(config) {
|
|
@@ -52,7 +52,7 @@ var PREPR_HEADER_KEYS = [
|
|
|
52
52
|
"Prepr-Visitor-IP",
|
|
53
53
|
"Prepr-Hubspot-Id",
|
|
54
54
|
"Prepr-Customer-Id-Created",
|
|
55
|
-
"
|
|
55
|
+
"User-Agent",
|
|
56
56
|
"Prepr-Package"
|
|
57
57
|
];
|
|
58
58
|
function getPreprHeadersFromHeaders(headers) {
|
|
@@ -241,7 +241,7 @@ function processFrameworkRequest(request, opts, framework) {
|
|
|
241
241
|
}
|
|
242
242
|
const userAgent = request.headers.get("user-agent");
|
|
243
243
|
if (userAgent) {
|
|
244
|
-
requestHeaders.set("
|
|
244
|
+
requestHeaders.set("User-Agent", sanitizeHeaderValue(userAgent));
|
|
245
245
|
}
|
|
246
246
|
const packageParts = [`@preprio/toolkit@${opts?.version ?? VERSION}`];
|
|
247
247
|
if (framework) packageParts.push(`framework=${framework}`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var VERSION = "0.4.
|
|
2
|
+
var VERSION = "0.4.3";
|
|
3
3
|
|
|
4
4
|
// src/core/features.ts
|
|
5
5
|
function isEnabled(config) {
|
|
@@ -655,6 +655,7 @@ function createStegaAutoClean(options) {
|
|
|
655
655
|
const info = cleaned.get(textNode);
|
|
656
656
|
const settled = stripText ? info?.cleaned : info?.original;
|
|
657
657
|
if (info && textContent === settled) {
|
|
658
|
+
if (!info.decoded) return false;
|
|
658
659
|
const shown = resolveEditTarget(textNode);
|
|
659
660
|
if (!shown) return false;
|
|
660
661
|
pendingHidden.delete(textNode);
|
|
@@ -666,13 +667,14 @@ function createStegaAutoClean(options) {
|
|
|
666
667
|
const { cleaned: stripped, encoded } = vercelStegaSplit(textContent);
|
|
667
668
|
if (!encoded || stripped === textContent) return false;
|
|
668
669
|
const decoded = decodeStega(textContent);
|
|
669
|
-
if (!decoded?.href) return false;
|
|
670
|
+
if (!decoded?.href && !stripText) return false;
|
|
670
671
|
cleaned.set(textNode, {
|
|
671
672
|
original: textContent,
|
|
672
673
|
cleaned: stripped,
|
|
673
|
-
decoded
|
|
674
|
+
decoded: decoded?.href ? decoded : null
|
|
674
675
|
});
|
|
675
676
|
if (stripText) textNode.textContent = stripped;
|
|
677
|
+
if (!decoded?.href) return false;
|
|
676
678
|
const target = resolveEditTarget(textNode);
|
|
677
679
|
if (target) {
|
|
678
680
|
pendingHidden.delete(textNode);
|
|
@@ -709,7 +711,9 @@ function createStegaAutoClean(options) {
|
|
|
709
711
|
if (mutation.type === "characterData" && mutation.target.nodeType === Node.TEXT_NODE) {
|
|
710
712
|
const textNode = mutation.target;
|
|
711
713
|
const info = cleaned.get(textNode);
|
|
712
|
-
|
|
714
|
+
const text = textNode.textContent ?? "";
|
|
715
|
+
const settled = stripText ? info?.cleaned : info?.original;
|
|
716
|
+
if (text !== settled && vercelStegaSplit(text).encoded) {
|
|
713
717
|
affected.add(textNode);
|
|
714
718
|
}
|
|
715
719
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -44,7 +44,7 @@ __export(src_exports, {
|
|
|
44
44
|
module.exports = __toCommonJS(src_exports);
|
|
45
45
|
|
|
46
46
|
// src/version.ts
|
|
47
|
-
var VERSION = "0.4.
|
|
47
|
+
var VERSION = "0.4.3";
|
|
48
48
|
|
|
49
49
|
// src/core/features.ts
|
|
50
50
|
function isEnabled(config) {
|
|
@@ -456,6 +456,7 @@ function createStegaAutoClean(options) {
|
|
|
456
456
|
const info = cleaned.get(textNode);
|
|
457
457
|
const settled = stripText ? info?.cleaned : info?.original;
|
|
458
458
|
if (info && textContent === settled) {
|
|
459
|
+
if (!info.decoded) return false;
|
|
459
460
|
const shown = resolveEditTarget(textNode);
|
|
460
461
|
if (!shown) return false;
|
|
461
462
|
pendingHidden.delete(textNode);
|
|
@@ -467,13 +468,14 @@ function createStegaAutoClean(options) {
|
|
|
467
468
|
const { cleaned: stripped, encoded } = (0, import_stega2.vercelStegaSplit)(textContent);
|
|
468
469
|
if (!encoded || stripped === textContent) return false;
|
|
469
470
|
const decoded = decodeStega(textContent);
|
|
470
|
-
if (!decoded?.href) return false;
|
|
471
|
+
if (!decoded?.href && !stripText) return false;
|
|
471
472
|
cleaned.set(textNode, {
|
|
472
473
|
original: textContent,
|
|
473
474
|
cleaned: stripped,
|
|
474
|
-
decoded
|
|
475
|
+
decoded: decoded?.href ? decoded : null
|
|
475
476
|
});
|
|
476
477
|
if (stripText) textNode.textContent = stripped;
|
|
478
|
+
if (!decoded?.href) return false;
|
|
477
479
|
const target = resolveEditTarget(textNode);
|
|
478
480
|
if (target) {
|
|
479
481
|
pendingHidden.delete(textNode);
|
|
@@ -510,7 +512,9 @@ function createStegaAutoClean(options) {
|
|
|
510
512
|
if (mutation.type === "characterData" && mutation.target.nodeType === Node.TEXT_NODE) {
|
|
511
513
|
const textNode = mutation.target;
|
|
512
514
|
const info = cleaned.get(textNode);
|
|
513
|
-
|
|
515
|
+
const text = textNode.textContent ?? "";
|
|
516
|
+
const settled = stripText ? info?.cleaned : info?.original;
|
|
517
|
+
if (text !== settled && (0, import_stega2.vercelStegaSplit)(text).encoded) {
|
|
514
518
|
affected.add(textNode);
|
|
515
519
|
}
|
|
516
520
|
}
|
|
@@ -2319,7 +2323,7 @@ var PREPR_HEADER_KEYS = [
|
|
|
2319
2323
|
"Prepr-Visitor-IP",
|
|
2320
2324
|
"Prepr-Hubspot-Id",
|
|
2321
2325
|
"Prepr-Customer-Id-Created",
|
|
2322
|
-
"
|
|
2326
|
+
"User-Agent",
|
|
2323
2327
|
"Prepr-Package"
|
|
2324
2328
|
];
|
|
2325
2329
|
function getPreprHeadersFromHeaders(headers) {
|
|
@@ -2516,7 +2520,7 @@ function processFrameworkRequest(request, opts, framework) {
|
|
|
2516
2520
|
}
|
|
2517
2521
|
const userAgent = request.headers.get("user-agent");
|
|
2518
2522
|
if (userAgent) {
|
|
2519
|
-
requestHeaders.set("
|
|
2523
|
+
requestHeaders.set("User-Agent", sanitizeHeaderValue(userAgent));
|
|
2520
2524
|
}
|
|
2521
2525
|
const packageParts = [`@preprio/toolkit@${opts?.version ?? VERSION}`];
|
|
2522
2526
|
if (framework) packageParts.push(`framework=${framework}`);
|
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { P as PreprFeatures, R as ResolvedPreprFeatures, L as Locale, a as PreprSegment, b as PreprVariant, c as PreprToolbarProps, d as PreprPreviewOptions, e as PreprErrorCode, f as PreprHeaders } from './pixel-
|
|
2
|
-
export { g as PreprEnvironment, h as PreprEventType, i as PreprFeatureConfig, j as PreprHeaderName, k as PreprPixelConfig, l as PreprToolbarComponentProps, m as PreprToolbarOptions, n as loadTrackingPixel, s as setTrackingParam, t as trackEvent } from './pixel-
|
|
1
|
+
import { P as PreprFeatures, R as ResolvedPreprFeatures, L as Locale, a as PreprSegment, b as PreprVariant, c as PreprToolbarProps, d as PreprPreviewOptions, e as PreprErrorCode, f as PreprHeaders } from './pixel-e1fUWl2Y.cjs';
|
|
2
|
+
export { g as PreprEnvironment, h as PreprEventType, i as PreprFeatureConfig, j as PreprHeaderName, k as PreprPixelConfig, l as PreprToolbarComponentProps, m as PreprToolbarOptions, n as loadTrackingPixel, s as setTrackingParam, t as trackEvent } from './pixel-e1fUWl2Y.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Package version; must match package.json. Lives in its own leaf module so
|
|
6
6
|
* core can import it without cycling through the barrel.
|
|
7
7
|
*/
|
|
8
|
-
declare const VERSION = "0.4.
|
|
8
|
+
declare const VERSION = "0.4.3";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Resolve a `PreprFeatures` bag to plain booleans, defaulting every omitted key
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { P as PreprFeatures, R as ResolvedPreprFeatures, L as Locale, a as PreprSegment, b as PreprVariant, c as PreprToolbarProps, d as PreprPreviewOptions, e as PreprErrorCode, f as PreprHeaders } from './pixel-
|
|
2
|
-
export { g as PreprEnvironment, h as PreprEventType, i as PreprFeatureConfig, j as PreprHeaderName, k as PreprPixelConfig, l as PreprToolbarComponentProps, m as PreprToolbarOptions, n as loadTrackingPixel, s as setTrackingParam, t as trackEvent } from './pixel-
|
|
1
|
+
import { P as PreprFeatures, R as ResolvedPreprFeatures, L as Locale, a as PreprSegment, b as PreprVariant, c as PreprToolbarProps, d as PreprPreviewOptions, e as PreprErrorCode, f as PreprHeaders } from './pixel-e1fUWl2Y.js';
|
|
2
|
+
export { g as PreprEnvironment, h as PreprEventType, i as PreprFeatureConfig, j as PreprHeaderName, k as PreprPixelConfig, l as PreprToolbarComponentProps, m as PreprToolbarOptions, n as loadTrackingPixel, s as setTrackingParam, t as trackEvent } from './pixel-e1fUWl2Y.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Package version; must match package.json. Lives in its own leaf module so
|
|
6
6
|
* core can import it without cycling through the barrel.
|
|
7
7
|
*/
|
|
8
|
-
declare const VERSION = "0.4.
|
|
8
|
+
declare const VERSION = "0.4.3";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Resolve a `PreprFeatures` bag to plain booleans, defaulting every omitted key
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
setTrackingParam,
|
|
19
19
|
stegaClean,
|
|
20
20
|
trackEvent
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-H7VA7NGY.js";
|
|
22
22
|
|
|
23
23
|
// src/core/server.ts
|
|
24
24
|
var PreprError = class extends Error {
|
|
@@ -53,7 +53,7 @@ var PREPR_HEADER_KEYS = [
|
|
|
53
53
|
"Prepr-Visitor-IP",
|
|
54
54
|
"Prepr-Hubspot-Id",
|
|
55
55
|
"Prepr-Customer-Id-Created",
|
|
56
|
-
"
|
|
56
|
+
"User-Agent",
|
|
57
57
|
"Prepr-Package"
|
|
58
58
|
];
|
|
59
59
|
function getPreprHeadersFromHeaders(headers) {
|
|
@@ -250,7 +250,7 @@ function processFrameworkRequest(request, opts, framework) {
|
|
|
250
250
|
}
|
|
251
251
|
const userAgent = request.headers.get("user-agent");
|
|
252
252
|
if (userAgent) {
|
|
253
|
-
requestHeaders.set("
|
|
253
|
+
requestHeaders.set("User-Agent", sanitizeHeaderValue(userAgent));
|
|
254
254
|
}
|
|
255
255
|
const packageParts = [`@preprio/toolkit@${opts?.version ?? VERSION}`];
|
|
256
256
|
if (framework) packageParts.push(`framework=${framework}`);
|
|
@@ -432,6 +432,7 @@ function createStegaAutoClean(options) {
|
|
|
432
432
|
const info = cleaned.get(textNode);
|
|
433
433
|
const settled = stripText ? info?.cleaned : info?.original;
|
|
434
434
|
if (info && textContent === settled) {
|
|
435
|
+
if (!info.decoded) return false;
|
|
435
436
|
const shown = resolveEditTarget(textNode);
|
|
436
437
|
if (!shown) return false;
|
|
437
438
|
pendingHidden.delete(textNode);
|
|
@@ -443,13 +444,14 @@ function createStegaAutoClean(options) {
|
|
|
443
444
|
const { cleaned: stripped, encoded } = (0, import_stega2.vercelStegaSplit)(textContent);
|
|
444
445
|
if (!encoded || stripped === textContent) return false;
|
|
445
446
|
const decoded = decodeStega(textContent);
|
|
446
|
-
if (!decoded?.href) return false;
|
|
447
|
+
if (!decoded?.href && !stripText) return false;
|
|
447
448
|
cleaned.set(textNode, {
|
|
448
449
|
original: textContent,
|
|
449
450
|
cleaned: stripped,
|
|
450
|
-
decoded
|
|
451
|
+
decoded: decoded?.href ? decoded : null
|
|
451
452
|
});
|
|
452
453
|
if (stripText) textNode.textContent = stripped;
|
|
454
|
+
if (!decoded?.href) return false;
|
|
453
455
|
const target = resolveEditTarget(textNode);
|
|
454
456
|
if (target) {
|
|
455
457
|
pendingHidden.delete(textNode);
|
|
@@ -486,7 +488,9 @@ function createStegaAutoClean(options) {
|
|
|
486
488
|
if (mutation.type === "characterData" && mutation.target.nodeType === Node.TEXT_NODE) {
|
|
487
489
|
const textNode = mutation.target;
|
|
488
490
|
const info = cleaned.get(textNode);
|
|
489
|
-
|
|
491
|
+
const text = textNode.textContent ?? "";
|
|
492
|
+
const settled = stripText ? info?.cleaned : info?.original;
|
|
493
|
+
if (text !== settled && (0, import_stega2.vercelStegaSplit)(text).encoded) {
|
|
490
494
|
affected.add(textNode);
|
|
491
495
|
}
|
|
492
496
|
}
|
|
@@ -2266,7 +2270,7 @@ function createPreprPreview(opts = {}) {
|
|
|
2266
2270
|
var import_react = require("react");
|
|
2267
2271
|
|
|
2268
2272
|
// src/version.ts
|
|
2269
|
-
var VERSION = "0.4.
|
|
2273
|
+
var VERSION = "0.4.3";
|
|
2270
2274
|
|
|
2271
2275
|
// src/core/pixel.ts
|
|
2272
2276
|
var PIXEL_SCRIPT_URL = "https://cdn.tracking.prepr.io/js/prepr.min.js";
|
package/dist/nextjs/index.cjs
CHANGED
|
@@ -38,7 +38,7 @@ module.exports = __toCommonJS(nextjs_exports);
|
|
|
38
38
|
var import_server = require("next/server");
|
|
39
39
|
|
|
40
40
|
// src/version.ts
|
|
41
|
-
var VERSION = "0.4.
|
|
41
|
+
var VERSION = "0.4.3";
|
|
42
42
|
|
|
43
43
|
// src/core/constants.ts
|
|
44
44
|
var COOKIE_PREVIEW_MODE = "Prepr-Preview-Mode";
|
|
@@ -133,7 +133,7 @@ function processFrameworkRequest(request, opts, framework) {
|
|
|
133
133
|
}
|
|
134
134
|
const userAgent = request.headers.get("user-agent");
|
|
135
135
|
if (userAgent) {
|
|
136
|
-
requestHeaders.set("
|
|
136
|
+
requestHeaders.set("User-Agent", sanitizeHeaderValue(userAgent));
|
|
137
137
|
}
|
|
138
138
|
const packageParts = [`@preprio/toolkit@${opts?.version ?? VERSION}`];
|
|
139
139
|
if (framework) packageParts.push(`framework=${framework}`);
|
|
@@ -298,7 +298,7 @@ var PREPR_HEADER_KEYS = [
|
|
|
298
298
|
"Prepr-Visitor-IP",
|
|
299
299
|
"Prepr-Hubspot-Id",
|
|
300
300
|
"Prepr-Customer-Id-Created",
|
|
301
|
-
"
|
|
301
|
+
"User-Agent",
|
|
302
302
|
"Prepr-Package"
|
|
303
303
|
];
|
|
304
304
|
function getPreprHeadersFromHeaders(headers2) {
|
package/dist/nextjs/index.d.cts
CHANGED
|
@@ -119,6 +119,9 @@ interface PreprHeaders {
|
|
|
119
119
|
readonly 'Prepr-Visitor-IP'?: string;
|
|
120
120
|
readonly 'Prepr-Hubspot-Id'?: string;
|
|
121
121
|
readonly 'Prepr-Customer-Id-Created'?: 'true';
|
|
122
|
+
/** The visitor's browser User-Agent, used by the API for device detection. */
|
|
123
|
+
readonly 'User-Agent'?: string;
|
|
124
|
+
/** @deprecated Never populated; the visitor's value is under `User-Agent`. */
|
|
122
125
|
readonly 'Prepr-User-Agent'?: string;
|
|
123
126
|
readonly 'Prepr-Package'?: string;
|
|
124
127
|
}
|
package/dist/nextjs/index.d.ts
CHANGED
|
@@ -119,6 +119,9 @@ interface PreprHeaders {
|
|
|
119
119
|
readonly 'Prepr-Visitor-IP'?: string;
|
|
120
120
|
readonly 'Prepr-Hubspot-Id'?: string;
|
|
121
121
|
readonly 'Prepr-Customer-Id-Created'?: 'true';
|
|
122
|
+
/** The visitor's browser User-Agent, used by the API for device detection. */
|
|
123
|
+
readonly 'User-Agent'?: string;
|
|
124
|
+
/** @deprecated Never populated; the visitor's value is under `User-Agent`. */
|
|
122
125
|
readonly 'Prepr-User-Agent'?: string;
|
|
123
126
|
readonly 'Prepr-Package'?: string;
|
|
124
127
|
}
|
package/dist/nextjs/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { NextResponse } from "next/server";
|
|
3
3
|
|
|
4
4
|
// src/version.ts
|
|
5
|
-
var VERSION = "0.4.
|
|
5
|
+
var VERSION = "0.4.3";
|
|
6
6
|
|
|
7
7
|
// src/core/constants.ts
|
|
8
8
|
var COOKIE_PREVIEW_MODE = "Prepr-Preview-Mode";
|
|
@@ -97,7 +97,7 @@ function processFrameworkRequest(request, opts, framework) {
|
|
|
97
97
|
}
|
|
98
98
|
const userAgent = request.headers.get("user-agent");
|
|
99
99
|
if (userAgent) {
|
|
100
|
-
requestHeaders.set("
|
|
100
|
+
requestHeaders.set("User-Agent", sanitizeHeaderValue(userAgent));
|
|
101
101
|
}
|
|
102
102
|
const packageParts = [`@preprio/toolkit@${opts?.version ?? VERSION}`];
|
|
103
103
|
if (framework) packageParts.push(`framework=${framework}`);
|
|
@@ -262,7 +262,7 @@ var PREPR_HEADER_KEYS = [
|
|
|
262
262
|
"Prepr-Visitor-IP",
|
|
263
263
|
"Prepr-Hubspot-Id",
|
|
264
264
|
"Prepr-Customer-Id-Created",
|
|
265
|
-
"
|
|
265
|
+
"User-Agent",
|
|
266
266
|
"Prepr-Package"
|
|
267
267
|
];
|
|
268
268
|
function getPreprHeadersFromHeaders(headers2) {
|
package/dist/nuxt/index.cjs
CHANGED
|
@@ -35,7 +35,7 @@ __export(nuxt_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(nuxt_exports);
|
|
36
36
|
|
|
37
37
|
// src/version.ts
|
|
38
|
-
var VERSION = "0.4.
|
|
38
|
+
var VERSION = "0.4.3";
|
|
39
39
|
|
|
40
40
|
// src/core/constants.ts
|
|
41
41
|
var COOKIE_PREVIEW_MODE = "Prepr-Preview-Mode";
|
|
@@ -144,7 +144,7 @@ function processFrameworkRequest(request, opts, framework) {
|
|
|
144
144
|
}
|
|
145
145
|
const userAgent = request.headers.get("user-agent");
|
|
146
146
|
if (userAgent) {
|
|
147
|
-
requestHeaders.set("
|
|
147
|
+
requestHeaders.set("User-Agent", sanitizeHeaderValue(userAgent));
|
|
148
148
|
}
|
|
149
149
|
const packageParts = [`@preprio/toolkit@${opts?.version ?? VERSION}`];
|
|
150
150
|
if (framework) packageParts.push(`framework=${framework}`);
|
|
@@ -296,7 +296,7 @@ var PREPR_HEADER_KEYS = [
|
|
|
296
296
|
"Prepr-Visitor-IP",
|
|
297
297
|
"Prepr-Hubspot-Id",
|
|
298
298
|
"Prepr-Customer-Id-Created",
|
|
299
|
-
"
|
|
299
|
+
"User-Agent",
|
|
300
300
|
"Prepr-Package"
|
|
301
301
|
];
|
|
302
302
|
function getPreprHeadersFromHeaders(headers) {
|
package/dist/nuxt/index.d.cts
CHANGED
|
@@ -59,6 +59,9 @@ interface PreprHeaders {
|
|
|
59
59
|
readonly 'Prepr-Visitor-IP'?: string;
|
|
60
60
|
readonly 'Prepr-Hubspot-Id'?: string;
|
|
61
61
|
readonly 'Prepr-Customer-Id-Created'?: 'true';
|
|
62
|
+
/** The visitor's browser User-Agent, used by the API for device detection. */
|
|
63
|
+
readonly 'User-Agent'?: string;
|
|
64
|
+
/** @deprecated Never populated; the visitor's value is under `User-Agent`. */
|
|
62
65
|
readonly 'Prepr-User-Agent'?: string;
|
|
63
66
|
readonly 'Prepr-Package'?: string;
|
|
64
67
|
}
|
package/dist/nuxt/index.d.ts
CHANGED
|
@@ -59,6 +59,9 @@ interface PreprHeaders {
|
|
|
59
59
|
readonly 'Prepr-Visitor-IP'?: string;
|
|
60
60
|
readonly 'Prepr-Hubspot-Id'?: string;
|
|
61
61
|
readonly 'Prepr-Customer-Id-Created'?: 'true';
|
|
62
|
+
/** The visitor's browser User-Agent, used by the API for device detection. */
|
|
63
|
+
readonly 'User-Agent'?: string;
|
|
64
|
+
/** @deprecated Never populated; the visitor's value is under `User-Agent`. */
|
|
62
65
|
readonly 'Prepr-User-Agent'?: string;
|
|
63
66
|
readonly 'Prepr-Package'?: string;
|
|
64
67
|
}
|
package/dist/nuxt/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var VERSION = "0.4.
|
|
2
|
+
var VERSION = "0.4.3";
|
|
3
3
|
|
|
4
4
|
// src/core/constants.ts
|
|
5
5
|
var COOKIE_PREVIEW_MODE = "Prepr-Preview-Mode";
|
|
@@ -108,7 +108,7 @@ function processFrameworkRequest(request, opts, framework) {
|
|
|
108
108
|
}
|
|
109
109
|
const userAgent = request.headers.get("user-agent");
|
|
110
110
|
if (userAgent) {
|
|
111
|
-
requestHeaders.set("
|
|
111
|
+
requestHeaders.set("User-Agent", sanitizeHeaderValue(userAgent));
|
|
112
112
|
}
|
|
113
113
|
const packageParts = [`@preprio/toolkit@${opts?.version ?? VERSION}`];
|
|
114
114
|
if (framework) packageParts.push(`framework=${framework}`);
|
|
@@ -260,7 +260,7 @@ var PREPR_HEADER_KEYS = [
|
|
|
260
260
|
"Prepr-Visitor-IP",
|
|
261
261
|
"Prepr-Hubspot-Id",
|
|
262
262
|
"Prepr-Customer-Id-Created",
|
|
263
|
-
"
|
|
263
|
+
"User-Agent",
|
|
264
264
|
"Prepr-Package"
|
|
265
265
|
];
|
|
266
266
|
function getPreprHeadersFromHeaders(headers) {
|
|
@@ -108,7 +108,7 @@ interface PreprToolbarProps {
|
|
|
108
108
|
interface PreprToolbarComponentProps extends PreprToolbarProps {
|
|
109
109
|
options?: PreprPreviewOptions;
|
|
110
110
|
}
|
|
111
|
-
type PreprHeaderName = 'prepr-customer-id' | 'Prepr-Segments' | 'Prepr-ABtesting' | 'Prepr-User-Agent';
|
|
111
|
+
type PreprHeaderName = 'prepr-customer-id' | 'Prepr-Segments' | 'Prepr-ABtesting' | 'User-Agent' | 'Prepr-User-Agent';
|
|
112
112
|
type PreprVariant = 'A' | 'B';
|
|
113
113
|
type PreprEnvironment = 'preview' | 'production';
|
|
114
114
|
type PreprEventType = 'segment_changed' | 'variant_changed' | 'edit_mode_toggled' | 'preview_mode_toggled' | 'getScrollPosition' | 'loaded' | 'field_edit_requested';
|
|
@@ -126,6 +126,9 @@ interface PreprHeaders {
|
|
|
126
126
|
readonly 'Prepr-Visitor-IP'?: string;
|
|
127
127
|
readonly 'Prepr-Hubspot-Id'?: string;
|
|
128
128
|
readonly 'Prepr-Customer-Id-Created'?: 'true';
|
|
129
|
+
/** The visitor's browser User-Agent, used by the API for device detection. */
|
|
130
|
+
readonly 'User-Agent'?: string;
|
|
131
|
+
/** @deprecated Never populated; the visitor's value is under `User-Agent`. */
|
|
129
132
|
readonly 'Prepr-User-Agent'?: string;
|
|
130
133
|
readonly 'Prepr-Package'?: string;
|
|
131
134
|
}
|
|
@@ -108,7 +108,7 @@ interface PreprToolbarProps {
|
|
|
108
108
|
interface PreprToolbarComponentProps extends PreprToolbarProps {
|
|
109
109
|
options?: PreprPreviewOptions;
|
|
110
110
|
}
|
|
111
|
-
type PreprHeaderName = 'prepr-customer-id' | 'Prepr-Segments' | 'Prepr-ABtesting' | 'Prepr-User-Agent';
|
|
111
|
+
type PreprHeaderName = 'prepr-customer-id' | 'Prepr-Segments' | 'Prepr-ABtesting' | 'User-Agent' | 'Prepr-User-Agent';
|
|
112
112
|
type PreprVariant = 'A' | 'B';
|
|
113
113
|
type PreprEnvironment = 'preview' | 'production';
|
|
114
114
|
type PreprEventType = 'segment_changed' | 'variant_changed' | 'edit_mode_toggled' | 'preview_mode_toggled' | 'getScrollPosition' | 'loaded' | 'field_edit_requested';
|
|
@@ -126,6 +126,9 @@ interface PreprHeaders {
|
|
|
126
126
|
readonly 'Prepr-Visitor-IP'?: string;
|
|
127
127
|
readonly 'Prepr-Hubspot-Id'?: string;
|
|
128
128
|
readonly 'Prepr-Customer-Id-Created'?: 'true';
|
|
129
|
+
/** The visitor's browser User-Agent, used by the API for device detection. */
|
|
130
|
+
readonly 'User-Agent'?: string;
|
|
131
|
+
/** @deprecated Never populated; the visitor's value is under `User-Agent`. */
|
|
129
132
|
readonly 'Prepr-User-Agent'?: string;
|
|
130
133
|
readonly 'Prepr-Package'?: string;
|
|
131
134
|
}
|
|
@@ -431,6 +431,7 @@ function createStegaAutoClean(options) {
|
|
|
431
431
|
const info = cleaned.get(textNode);
|
|
432
432
|
const settled = stripText ? info?.cleaned : info?.original;
|
|
433
433
|
if (info && textContent === settled) {
|
|
434
|
+
if (!info.decoded) return false;
|
|
434
435
|
const shown = resolveEditTarget(textNode);
|
|
435
436
|
if (!shown) return false;
|
|
436
437
|
pendingHidden.delete(textNode);
|
|
@@ -442,13 +443,14 @@ function createStegaAutoClean(options) {
|
|
|
442
443
|
const { cleaned: stripped, encoded } = (0, import_stega2.vercelStegaSplit)(textContent);
|
|
443
444
|
if (!encoded || stripped === textContent) return false;
|
|
444
445
|
const decoded = decodeStega(textContent);
|
|
445
|
-
if (!decoded?.href) return false;
|
|
446
|
+
if (!decoded?.href && !stripText) return false;
|
|
446
447
|
cleaned.set(textNode, {
|
|
447
448
|
original: textContent,
|
|
448
449
|
cleaned: stripped,
|
|
449
|
-
decoded
|
|
450
|
+
decoded: decoded?.href ? decoded : null
|
|
450
451
|
});
|
|
451
452
|
if (stripText) textNode.textContent = stripped;
|
|
453
|
+
if (!decoded?.href) return false;
|
|
452
454
|
const target = resolveEditTarget(textNode);
|
|
453
455
|
if (target) {
|
|
454
456
|
pendingHidden.delete(textNode);
|
|
@@ -485,7 +487,9 @@ function createStegaAutoClean(options) {
|
|
|
485
487
|
if (mutation.type === "characterData" && mutation.target.nodeType === Node.TEXT_NODE) {
|
|
486
488
|
const textNode = mutation.target;
|
|
487
489
|
const info = cleaned.get(textNode);
|
|
488
|
-
|
|
490
|
+
const text = textNode.textContent ?? "";
|
|
491
|
+
const settled = stripText ? info?.cleaned : info?.original;
|
|
492
|
+
if (text !== settled && (0, import_stega2.vercelStegaSplit)(text).encoded) {
|
|
489
493
|
affected.add(textNode);
|
|
490
494
|
}
|
|
491
495
|
}
|
|
@@ -2262,7 +2266,7 @@ function createPreprPreview(opts = {}) {
|
|
|
2262
2266
|
}
|
|
2263
2267
|
|
|
2264
2268
|
// src/version.ts
|
|
2265
|
-
var VERSION = "0.4.
|
|
2269
|
+
var VERSION = "0.4.3";
|
|
2266
2270
|
|
|
2267
2271
|
// src/core/pixel.ts
|
|
2268
2272
|
var PIXEL_SCRIPT_URL = "https://cdn.tracking.prepr.io/js/prepr.min.js";
|
package/dist/react/components.js
CHANGED
|
@@ -407,6 +407,7 @@ function createStegaAutoClean(options) {
|
|
|
407
407
|
const info = cleaned.get(textNode);
|
|
408
408
|
const settled = stripText ? info?.cleaned : info?.original;
|
|
409
409
|
if (info && textContent === settled) {
|
|
410
|
+
if (!info.decoded) return false;
|
|
410
411
|
const shown = resolveEditTarget(textNode);
|
|
411
412
|
if (!shown) return false;
|
|
412
413
|
pendingHidden.delete(textNode);
|
|
@@ -418,13 +419,14 @@ function createStegaAutoClean(options) {
|
|
|
418
419
|
const { cleaned: stripped, encoded } = vercelStegaSplit(textContent);
|
|
419
420
|
if (!encoded || stripped === textContent) return false;
|
|
420
421
|
const decoded = decodeStega(textContent);
|
|
421
|
-
if (!decoded?.href) return false;
|
|
422
|
+
if (!decoded?.href && !stripText) return false;
|
|
422
423
|
cleaned.set(textNode, {
|
|
423
424
|
original: textContent,
|
|
424
425
|
cleaned: stripped,
|
|
425
|
-
decoded
|
|
426
|
+
decoded: decoded?.href ? decoded : null
|
|
426
427
|
});
|
|
427
428
|
if (stripText) textNode.textContent = stripped;
|
|
429
|
+
if (!decoded?.href) return false;
|
|
428
430
|
const target = resolveEditTarget(textNode);
|
|
429
431
|
if (target) {
|
|
430
432
|
pendingHidden.delete(textNode);
|
|
@@ -461,7 +463,9 @@ function createStegaAutoClean(options) {
|
|
|
461
463
|
if (mutation.type === "characterData" && mutation.target.nodeType === Node.TEXT_NODE) {
|
|
462
464
|
const textNode = mutation.target;
|
|
463
465
|
const info = cleaned.get(textNode);
|
|
464
|
-
|
|
466
|
+
const text = textNode.textContent ?? "";
|
|
467
|
+
const settled = stripText ? info?.cleaned : info?.original;
|
|
468
|
+
if (text !== settled && vercelStegaSplit(text).encoded) {
|
|
465
469
|
affected.add(textNode);
|
|
466
470
|
}
|
|
467
471
|
}
|
|
@@ -2238,7 +2242,7 @@ function createPreprPreview(opts = {}) {
|
|
|
2238
2242
|
}
|
|
2239
2243
|
|
|
2240
2244
|
// src/version.ts
|
|
2241
|
-
var VERSION = "0.4.
|
|
2245
|
+
var VERSION = "0.4.3";
|
|
2242
2246
|
|
|
2243
2247
|
// src/core/pixel.ts
|
|
2244
2248
|
var PIXEL_SCRIPT_URL = "https://cdn.tracking.prepr.io/js/prepr.min.js";
|
package/dist/sveltekit/index.cjs
CHANGED
|
@@ -35,7 +35,7 @@ __export(sveltekit_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(sveltekit_exports);
|
|
36
36
|
|
|
37
37
|
// src/version.ts
|
|
38
|
-
var VERSION = "0.4.
|
|
38
|
+
var VERSION = "0.4.3";
|
|
39
39
|
|
|
40
40
|
// src/core/constants.ts
|
|
41
41
|
var COOKIE_PREVIEW_MODE = "Prepr-Preview-Mode";
|
|
@@ -144,7 +144,7 @@ function processFrameworkRequest(request, opts, framework) {
|
|
|
144
144
|
}
|
|
145
145
|
const userAgent = request.headers.get("user-agent");
|
|
146
146
|
if (userAgent) {
|
|
147
|
-
requestHeaders.set("
|
|
147
|
+
requestHeaders.set("User-Agent", sanitizeHeaderValue(userAgent));
|
|
148
148
|
}
|
|
149
149
|
const packageParts = [`@preprio/toolkit@${opts?.version ?? VERSION}`];
|
|
150
150
|
if (framework) packageParts.push(`framework=${framework}`);
|
|
@@ -292,7 +292,7 @@ var PREPR_HEADER_KEYS = [
|
|
|
292
292
|
"Prepr-Visitor-IP",
|
|
293
293
|
"Prepr-Hubspot-Id",
|
|
294
294
|
"Prepr-Customer-Id-Created",
|
|
295
|
-
"
|
|
295
|
+
"User-Agent",
|
|
296
296
|
"Prepr-Package"
|
|
297
297
|
];
|
|
298
298
|
function getPreprHeadersFromHeaders(headers) {
|
|
@@ -59,6 +59,9 @@ interface PreprHeaders {
|
|
|
59
59
|
readonly 'Prepr-Visitor-IP'?: string;
|
|
60
60
|
readonly 'Prepr-Hubspot-Id'?: string;
|
|
61
61
|
readonly 'Prepr-Customer-Id-Created'?: 'true';
|
|
62
|
+
/** The visitor's browser User-Agent, used by the API for device detection. */
|
|
63
|
+
readonly 'User-Agent'?: string;
|
|
64
|
+
/** @deprecated Never populated; the visitor's value is under `User-Agent`. */
|
|
62
65
|
readonly 'Prepr-User-Agent'?: string;
|
|
63
66
|
readonly 'Prepr-Package'?: string;
|
|
64
67
|
}
|
|
@@ -59,6 +59,9 @@ interface PreprHeaders {
|
|
|
59
59
|
readonly 'Prepr-Visitor-IP'?: string;
|
|
60
60
|
readonly 'Prepr-Hubspot-Id'?: string;
|
|
61
61
|
readonly 'Prepr-Customer-Id-Created'?: 'true';
|
|
62
|
+
/** The visitor's browser User-Agent, used by the API for device detection. */
|
|
63
|
+
readonly 'User-Agent'?: string;
|
|
64
|
+
/** @deprecated Never populated; the visitor's value is under `User-Agent`. */
|
|
62
65
|
readonly 'Prepr-User-Agent'?: string;
|
|
63
66
|
readonly 'Prepr-Package'?: string;
|
|
64
67
|
}
|
package/dist/sveltekit/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var VERSION = "0.4.
|
|
2
|
+
var VERSION = "0.4.3";
|
|
3
3
|
|
|
4
4
|
// src/core/constants.ts
|
|
5
5
|
var COOKIE_PREVIEW_MODE = "Prepr-Preview-Mode";
|
|
@@ -108,7 +108,7 @@ function processFrameworkRequest(request, opts, framework) {
|
|
|
108
108
|
}
|
|
109
109
|
const userAgent = request.headers.get("user-agent");
|
|
110
110
|
if (userAgent) {
|
|
111
|
-
requestHeaders.set("
|
|
111
|
+
requestHeaders.set("User-Agent", sanitizeHeaderValue(userAgent));
|
|
112
112
|
}
|
|
113
113
|
const packageParts = [`@preprio/toolkit@${opts?.version ?? VERSION}`];
|
|
114
114
|
if (framework) packageParts.push(`framework=${framework}`);
|
|
@@ -256,7 +256,7 @@ var PREPR_HEADER_KEYS = [
|
|
|
256
256
|
"Prepr-Visitor-IP",
|
|
257
257
|
"Prepr-Hubspot-Id",
|
|
258
258
|
"Prepr-Customer-Id-Created",
|
|
259
|
-
"
|
|
259
|
+
"User-Agent",
|
|
260
260
|
"Prepr-Package"
|
|
261
261
|
];
|
|
262
262
|
function getPreprHeadersFromHeaders(headers) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@preprio/toolkit",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Prepr personalization, A/B testing and preview toolkit for React, Next.js, Nuxt, Astro, SvelteKit and Express",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Prepr B.V. (https://prepr.io)",
|