@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
@@ -1,11 +1,13 @@
1
1
  "use server";
2
2
  import {
3
3
  isPreviewFromHeaders
4
- } from "../chunk-AHBN6FQP.js";
5
- import "../chunk-46ISDRHT.js";
4
+ } from "../chunk-IOSO232M.js";
5
+ import "../chunk-UK664KSV.js";
6
+ import "../chunk-TEB7M7EM.js";
6
7
  import {
7
8
  parsePatchLog
8
- } from "../chunk-74KY5EAM.js";
9
+ } from "../chunk-ZFGVP2GW.js";
10
+ import "../chunk-AZC4BZJI.js";
9
11
  import "../chunk-S3VT4UWM.js";
10
12
 
11
13
  // src/nextjs/live-action.ts
@@ -27,7 +27,7 @@ function isFramed() {
27
27
  return typeof window !== "undefined" && window.self !== window.top;
28
28
  }
29
29
  function startLive() {
30
- starting ?? (starting = import("../live-preview-H4643QYF.js").then(
30
+ starting ?? (starting = import("../live-preview-IYAS7PYV.js").then(
31
31
  ({ createLiveBridge, createLiveStore }) => {
32
32
  const skipped = new Set(quarantined());
33
33
  const started = createLiveStore({
@@ -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.5.0-rc.4";
38
+ var VERSION = "0.5.1-dom.0";
39
39
 
40
40
  // src/core/constants.ts
41
41
  var COOKIE_PREVIEW_MODE = "Prepr-Preview-Mode";
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "0.5.0-rc.4";
2
+ var VERSION = "0.5.1-dom.0";
3
3
 
4
4
  // src/core/constants.ts
5
5
  var COOKIE_PREVIEW_MODE = "Prepr-Preview-Mode";
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Loader + typed facade for Prepr's CDN tracking pixel, so consumers don't have
3
+ * to paste a `<script>` tag. The pixel itself lives on the CDN; this only sets
4
+ * up the handoff.
5
+ *
6
+ * The CDN script expects a queue stub to already exist when it loads, so the
7
+ * contract must be reproduced exactly:
8
+ * - `window.prepr` pushes `arguments` onto `.queue` until the real script
9
+ * lands and replaces `.process`.
10
+ * - `.t` must be a `Date.now()` timestamp.
11
+ * - The tag is inserted async, `src` cache-busted every 24h via
12
+ * `Math.ceil(Date.now() / cacheTime) * cacheTime`.
13
+ */
14
+ /** Config accepted by the CDN pixel. */
15
+ interface PreprPixelConfig {
16
+ destinations?: {
17
+ googleTagManager?: boolean;
18
+ };
19
+ variantImpressionThreshold?: number;
20
+ }
21
+ type PreprQueueArgs = unknown[];
22
+ interface PreprQueueFn {
23
+ (...args: PreprQueueArgs): void;
24
+ queue: PreprQueueArgs[];
25
+ t: number;
26
+ process?: (...args: PreprQueueArgs) => void;
27
+ }
28
+ declare global {
29
+ interface Window {
30
+ prepr?: PreprQueueFn;
31
+ }
32
+ }
33
+ /**
34
+ * Install the queue stub, inject the pixel script, then queue
35
+ * `('init', trackingId, config?)` and `('event', 'pageload')` in that order.
36
+ *
37
+ * Idempotent, and a no-op outside a browser.
38
+ */
39
+ declare function loadTrackingPixel(trackingId: string, config?: PreprPixelConfig): void;
40
+ /**
41
+ * Send a tracking event through `window.prepr`. Only depends on `window.prepr`
42
+ * existing, never on how it got installed. Warns once and returns quietly when
43
+ * no pixel is present.
44
+ */
45
+ declare function trackEvent(name: string, data?: string | Record<string, unknown>): void;
46
+ /** Loader-independent like `trackEvent`; warns once if no pixel is installed. */
47
+ declare function setTrackingParam(key: string, value: string): void;
48
+
49
+ export { type PreprPixelConfig as P, loadTrackingPixel as l, setTrackingParam as s, trackEvent as t };
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Loader + typed facade for Prepr's CDN tracking pixel, so consumers don't have
3
+ * to paste a `<script>` tag. The pixel itself lives on the CDN; this only sets
4
+ * up the handoff.
5
+ *
6
+ * The CDN script expects a queue stub to already exist when it loads, so the
7
+ * contract must be reproduced exactly:
8
+ * - `window.prepr` pushes `arguments` onto `.queue` until the real script
9
+ * lands and replaces `.process`.
10
+ * - `.t` must be a `Date.now()` timestamp.
11
+ * - The tag is inserted async, `src` cache-busted every 24h via
12
+ * `Math.ceil(Date.now() / cacheTime) * cacheTime`.
13
+ */
14
+ /** Config accepted by the CDN pixel. */
15
+ interface PreprPixelConfig {
16
+ destinations?: {
17
+ googleTagManager?: boolean;
18
+ };
19
+ variantImpressionThreshold?: number;
20
+ }
21
+ type PreprQueueArgs = unknown[];
22
+ interface PreprQueueFn {
23
+ (...args: PreprQueueArgs): void;
24
+ queue: PreprQueueArgs[];
25
+ t: number;
26
+ process?: (...args: PreprQueueArgs) => void;
27
+ }
28
+ declare global {
29
+ interface Window {
30
+ prepr?: PreprQueueFn;
31
+ }
32
+ }
33
+ /**
34
+ * Install the queue stub, inject the pixel script, then queue
35
+ * `('init', trackingId, config?)` and `('event', 'pageload')` in that order.
36
+ *
37
+ * Idempotent, and a no-op outside a browser.
38
+ */
39
+ declare function loadTrackingPixel(trackingId: string, config?: PreprPixelConfig): void;
40
+ /**
41
+ * Send a tracking event through `window.prepr`. Only depends on `window.prepr`
42
+ * existing, never on how it got installed. Warns once and returns quietly when
43
+ * no pixel is present.
44
+ */
45
+ declare function trackEvent(name: string, data?: string | Record<string, unknown>): void;
46
+ /** Loader-independent like `trackEvent`; warns once if no pixel is installed. */
47
+ declare function setTrackingParam(key: string, value: string): void;
48
+
49
+ export { type PreprPixelConfig as P, loadTrackingPixel as l, setTrackingParam as s, trackEvent as t };
@@ -3513,7 +3513,7 @@ function createPreprPreview(opts = {}) {
3513
3513
  }
3514
3514
 
3515
3515
  // src/version.ts
3516
- var VERSION = "0.5.0-rc.4";
3516
+ var VERSION = "0.5.1-dom.0";
3517
3517
 
3518
3518
  // src/core/pixel.ts
3519
3519
  var PIXEL_SCRIPT_URL = "https://cdn.tracking.prepr.io/js/prepr.min.js";
@@ -3489,7 +3489,7 @@ function createPreprPreview(opts = {}) {
3489
3489
  }
3490
3490
 
3491
3491
  // src/version.ts
3492
- var VERSION = "0.5.0-rc.4";
3492
+ var VERSION = "0.5.1-dom.0";
3493
3493
 
3494
3494
  // src/core/pixel.ts
3495
3495
  var PIXEL_SCRIPT_URL = "https://cdn.tracking.prepr.io/js/prepr.min.js";
@@ -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.5.0-rc.4";
38
+ var VERSION = "0.5.1-dom.0";
39
39
 
40
40
  // src/core/constants.ts
41
41
  var COOKIE_PREVIEW_MODE = "Prepr-Preview-Mode";
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "0.5.0-rc.4";
2
+ var VERSION = "0.5.1-dom.0";
3
3
 
4
4
  // src/core/constants.ts
5
5
  var COOKIE_PREVIEW_MODE = "Prepr-Preview-Mode";
@@ -149,52 +149,4 @@ interface PreprHeaders {
149
149
  }
150
150
  type PreprErrorCode = 'INVALID_TOKEN' | 'MISSING_TOKEN' | 'HTTP_ERROR' | 'FETCH_ERROR' | 'INVALID_RESPONSE' | 'CONTEXT_ERROR';
151
151
 
152
- /**
153
- * Loader + typed facade for Prepr's CDN tracking pixel, so consumers don't have
154
- * to paste a `<script>` tag. The pixel itself lives on the CDN; this only sets
155
- * up the handoff.
156
- *
157
- * The CDN script expects a queue stub to already exist when it loads, so the
158
- * contract must be reproduced exactly:
159
- * - `window.prepr` pushes `arguments` onto `.queue` until the real script
160
- * lands and replaces `.process`.
161
- * - `.t` must be a `Date.now()` timestamp.
162
- * - The tag is inserted async, `src` cache-busted every 24h via
163
- * `Math.ceil(Date.now() / cacheTime) * cacheTime`.
164
- */
165
- /** Config accepted by the CDN pixel. */
166
- interface PreprPixelConfig {
167
- destinations?: {
168
- googleTagManager?: boolean;
169
- };
170
- variantImpressionThreshold?: number;
171
- }
172
- type PreprQueueArgs = unknown[];
173
- interface PreprQueueFn {
174
- (...args: PreprQueueArgs): void;
175
- queue: PreprQueueArgs[];
176
- t: number;
177
- process?: (...args: PreprQueueArgs) => void;
178
- }
179
- declare global {
180
- interface Window {
181
- prepr?: PreprQueueFn;
182
- }
183
- }
184
- /**
185
- * Install the queue stub, inject the pixel script, then queue
186
- * `('init', trackingId, config?)` and `('event', 'pageload')` in that order.
187
- *
188
- * Idempotent, and a no-op outside a browser.
189
- */
190
- declare function loadTrackingPixel(trackingId: string, config?: PreprPixelConfig): void;
191
- /**
192
- * Send a tracking event through `window.prepr`. Only depends on `window.prepr`
193
- * existing, never on how it got installed. Warns once and returns quietly when
194
- * no pixel is present.
195
- */
196
- declare function trackEvent(name: string, data?: string | Record<string, unknown>): void;
197
- /** Loader-independent like `trackEvent`; warns once if no pixel is installed. */
198
- declare function setTrackingParam(key: string, value: string): void;
199
-
200
- export { type Locale as L, type PreprFeatures as P, type ResolvedPreprFeatures as R, type PreprSegment as a, type PreprVariant as b, type PreprToolbarProps as c, type PreprPreviewOptions as d, type PreprErrorCode as e, type PreprHeaders as f, type PreprEnvironment as g, type PreprEventType as h, type PreprFeatureConfig as i, type PreprHeaderName as j, type PreprPixelConfig as k, type PreprToolbarComponentProps as l, type PreprToolbarOptions as m, loadTrackingPixel as n, setTrackingParam as s, trackEvent as t };
152
+ export type { Locale as L, PreprToolbarProps as P, ResolvedPreprFeatures as R, PreprPreviewOptions as a, PreprFeatures as b, PreprSegment as c, PreprVariant as d, PreprErrorCode as e, PreprHeaders as f, PreprEnvironment as g, PreprEventType as h, PreprFeatureConfig as i, PreprHeaderName as j, PreprToolbarComponentProps as k, PreprToolbarOptions as l };
@@ -149,52 +149,4 @@ interface PreprHeaders {
149
149
  }
150
150
  type PreprErrorCode = 'INVALID_TOKEN' | 'MISSING_TOKEN' | 'HTTP_ERROR' | 'FETCH_ERROR' | 'INVALID_RESPONSE' | 'CONTEXT_ERROR';
151
151
 
152
- /**
153
- * Loader + typed facade for Prepr's CDN tracking pixel, so consumers don't have
154
- * to paste a `<script>` tag. The pixel itself lives on the CDN; this only sets
155
- * up the handoff.
156
- *
157
- * The CDN script expects a queue stub to already exist when it loads, so the
158
- * contract must be reproduced exactly:
159
- * - `window.prepr` pushes `arguments` onto `.queue` until the real script
160
- * lands and replaces `.process`.
161
- * - `.t` must be a `Date.now()` timestamp.
162
- * - The tag is inserted async, `src` cache-busted every 24h via
163
- * `Math.ceil(Date.now() / cacheTime) * cacheTime`.
164
- */
165
- /** Config accepted by the CDN pixel. */
166
- interface PreprPixelConfig {
167
- destinations?: {
168
- googleTagManager?: boolean;
169
- };
170
- variantImpressionThreshold?: number;
171
- }
172
- type PreprQueueArgs = unknown[];
173
- interface PreprQueueFn {
174
- (...args: PreprQueueArgs): void;
175
- queue: PreprQueueArgs[];
176
- t: number;
177
- process?: (...args: PreprQueueArgs) => void;
178
- }
179
- declare global {
180
- interface Window {
181
- prepr?: PreprQueueFn;
182
- }
183
- }
184
- /**
185
- * Install the queue stub, inject the pixel script, then queue
186
- * `('init', trackingId, config?)` and `('event', 'pageload')` in that order.
187
- *
188
- * Idempotent, and a no-op outside a browser.
189
- */
190
- declare function loadTrackingPixel(trackingId: string, config?: PreprPixelConfig): void;
191
- /**
192
- * Send a tracking event through `window.prepr`. Only depends on `window.prepr`
193
- * existing, never on how it got installed. Warns once and returns quietly when
194
- * no pixel is present.
195
- */
196
- declare function trackEvent(name: string, data?: string | Record<string, unknown>): void;
197
- /** Loader-independent like `trackEvent`; warns once if no pixel is installed. */
198
- declare function setTrackingParam(key: string, value: string): void;
199
-
200
- export { type Locale as L, type PreprFeatures as P, type ResolvedPreprFeatures as R, type PreprSegment as a, type PreprVariant as b, type PreprToolbarProps as c, type PreprPreviewOptions as d, type PreprErrorCode as e, type PreprHeaders as f, type PreprEnvironment as g, type PreprEventType as h, type PreprFeatureConfig as i, type PreprHeaderName as j, type PreprPixelConfig as k, type PreprToolbarComponentProps as l, type PreprToolbarOptions as m, loadTrackingPixel as n, setTrackingParam as s, trackEvent as t };
152
+ export type { Locale as L, PreprToolbarProps as P, ResolvedPreprFeatures as R, PreprPreviewOptions as a, PreprFeatures as b, PreprSegment as c, PreprVariant as d, PreprErrorCode as e, PreprHeaders as f, PreprEnvironment as g, PreprEventType as h, PreprFeatureConfig as i, PreprHeaderName as j, PreprToolbarComponentProps as k, PreprToolbarOptions as l };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@preprio/toolkit",
3
- "version": "0.5.0-rc.4",
3
+ "version": "0.5.1-dom.0",
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)",
@@ -32,13 +32,23 @@
32
32
  "homepage": "https://github.com/preprio/prepr-toolkit#readme",
33
33
  "bugs": "https://github.com/preprio/prepr-toolkit/issues",
34
34
  "type": "module",
35
- "sideEffects": false,
35
+ "sideEffects": [
36
+ "./dist/auto.js",
37
+ "./dist/auto.cjs",
38
+ "./dist/browser/auto.js"
39
+ ],
36
40
  "exports": {
37
41
  ".": {
38
42
  "types": "./dist/index.d.ts",
39
43
  "import": "./dist/index.js",
40
44
  "require": "./dist/index.cjs"
41
45
  },
46
+ "./auto": {
47
+ "types": "./dist/auto.d.ts",
48
+ "import": "./dist/auto.js",
49
+ "require": "./dist/auto.cjs"
50
+ },
51
+ "./browser/auto": "./dist/browser/auto.js",
42
52
  "./react": {
43
53
  "types": "./dist/react/index.d.ts",
44
54
  "import": "./dist/react/index.js",