@preprio/toolkit 0.2.0-beta.3 → 0.2.0-beta.4

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.
@@ -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.2.0-beta.3";
33
+ var VERSION = "0.2.0-beta.4";
34
34
 
35
35
  // src/core/features.ts
36
36
  function isEnabled(config) {
@@ -27,8 +27,18 @@ interface PreprFeatures {
27
27
  editMode?: PreprFeatureConfig;
28
28
  }
29
29
  interface PreprToolbarProps {
30
- readonly activeSegment: string | null;
31
- readonly activeVariant: string | null;
30
+ /**
31
+ * Server-resolved active segment. Optional: omit it with `segments`
32
+ * disabled, where there is nothing to resolve. When enabled and omitted,
33
+ * the persisted cookie is used.
34
+ */
35
+ readonly activeSegment?: string | null;
36
+ /**
37
+ * Server-resolved active A/B variant. Optional: omit it with `abTesting`
38
+ * disabled, where there is nothing to resolve. When enabled and omitted,
39
+ * the persisted cookie is used.
40
+ */
41
+ readonly activeVariant?: string | null;
32
42
  /** Available segments to personalize on. */
33
43
  readonly segments?: readonly PreprSegment[];
34
44
  /** @deprecated Alias for `segments`. */
@@ -27,8 +27,18 @@ interface PreprFeatures {
27
27
  editMode?: PreprFeatureConfig;
28
28
  }
29
29
  interface PreprToolbarProps {
30
- readonly activeSegment: string | null;
31
- readonly activeVariant: string | null;
30
+ /**
31
+ * Server-resolved active segment. Optional: omit it with `segments`
32
+ * disabled, where there is nothing to resolve. When enabled and omitted,
33
+ * the persisted cookie is used.
34
+ */
35
+ readonly activeSegment?: string | null;
36
+ /**
37
+ * Server-resolved active A/B variant. Optional: omit it with `abTesting`
38
+ * disabled, where there is nothing to resolve. When enabled and omitted,
39
+ * the persisted cookie is used.
40
+ */
41
+ readonly activeVariant?: string | null;
32
42
  /** Available segments to personalize on. */
33
43
  readonly segments?: readonly PreprSegment[];
34
44
  /** @deprecated Alias for `segments`. */
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "0.2.0-beta.3";
2
+ var VERSION = "0.2.0-beta.4";
3
3
 
4
4
  // src/core/features.ts
5
5
  function isEnabled(config) {
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.2.0-beta.3";
47
+ var VERSION = "0.2.0-beta.4";
48
48
 
49
49
  // src/core/features.ts
50
50
  function isEnabled(config) {
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-763p7m6A.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-763p7m6A.cjs';
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-Dd72wuJp.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-Dd72wuJp.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.2.0-beta.3";
8
+ declare const VERSION = "0.2.0-beta.4";
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-763p7m6A.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-763p7m6A.js';
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-Dd72wuJp.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-Dd72wuJp.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.2.0-beta.3";
8
+ declare const VERSION = "0.2.0-beta.4";
9
9
 
10
10
  /**
11
11
  * Resolve a `PreprFeatures` bag to plain booleans, defaulting every omitted key
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  } from "./chunk-6OOGNVJ4.js";
21
21
 
22
22
  // src/version.ts
23
- var VERSION = "0.2.0-beta.3";
23
+ var VERSION = "0.2.0-beta.4";
24
24
 
25
25
  // src/core/server.ts
26
26
  var PreprError = class extends Error {
@@ -1,4 +1,4 @@
1
- import { k as PreprPixelConfig, l as PreprToolbarComponentProps } from '../pixel-763p7m6A.cjs';
1
+ import { k as PreprPixelConfig, l as PreprToolbarComponentProps } from '../pixel-Dd72wuJp.cjs';
2
2
 
3
3
  interface PreprTrackingPixelProps {
4
4
  /** Prepr tracking/access token. */
@@ -1,4 +1,4 @@
1
- import { k as PreprPixelConfig, l as PreprToolbarComponentProps } from '../pixel-763p7m6A.js';
1
+ import { k as PreprPixelConfig, l as PreprToolbarComponentProps } from '../pixel-Dd72wuJp.js';
2
2
 
3
3
  interface PreprTrackingPixelProps {
4
4
  /** Prepr tracking/access token. */
@@ -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.2.0-beta.3";
41
+ var VERSION = "0.2.0-beta.4";
42
42
 
43
43
  // src/core/constants.ts
44
44
  var COOKIE_PREVIEW_MODE = "Prepr-Preview-Mode";
@@ -30,8 +30,18 @@ interface PreprFeatures {
30
30
  editMode?: PreprFeatureConfig;
31
31
  }
32
32
  interface PreprToolbarProps {
33
- readonly activeSegment: string | null;
34
- readonly activeVariant: string | null;
33
+ /**
34
+ * Server-resolved active segment. Optional: omit it with `segments`
35
+ * disabled, where there is nothing to resolve. When enabled and omitted,
36
+ * the persisted cookie is used.
37
+ */
38
+ readonly activeSegment?: string | null;
39
+ /**
40
+ * Server-resolved active A/B variant. Optional: omit it with `abTesting`
41
+ * disabled, where there is nothing to resolve. When enabled and omitted,
42
+ * the persisted cookie is used.
43
+ */
44
+ readonly activeVariant?: string | null;
35
45
  /** Available segments to personalize on. */
36
46
  readonly segments?: readonly PreprSegment[];
37
47
  /** @deprecated Alias for `segments`. */
@@ -30,8 +30,18 @@ interface PreprFeatures {
30
30
  editMode?: PreprFeatureConfig;
31
31
  }
32
32
  interface PreprToolbarProps {
33
- readonly activeSegment: string | null;
34
- readonly activeVariant: string | null;
33
+ /**
34
+ * Server-resolved active segment. Optional: omit it with `segments`
35
+ * disabled, where there is nothing to resolve. When enabled and omitted,
36
+ * the persisted cookie is used.
37
+ */
38
+ readonly activeSegment?: string | null;
39
+ /**
40
+ * Server-resolved active A/B variant. Optional: omit it with `abTesting`
41
+ * disabled, where there is nothing to resolve. When enabled and omitted,
42
+ * the persisted cookie is used.
43
+ */
44
+ readonly activeVariant?: string | null;
35
45
  /** Available segments to personalize on. */
36
46
  readonly segments?: readonly PreprSegment[];
37
47
  /** @deprecated Alias for `segments`. */
@@ -2,7 +2,7 @@
2
2
  import { NextResponse } from "next/server";
3
3
 
4
4
  // src/version.ts
5
- var VERSION = "0.2.0-beta.3";
5
+ var VERSION = "0.2.0-beta.4";
6
6
 
7
7
  // src/core/constants.ts
8
8
  var COOKIE_PREVIEW_MODE = "Prepr-Preview-Mode";
@@ -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.2.0-beta.3";
38
+ var VERSION = "0.2.0-beta.4";
39
39
 
40
40
  // src/core/constants.ts
41
41
  var COOKIE_PREVIEW_MODE = "Prepr-Preview-Mode";
@@ -27,8 +27,18 @@ interface PreprFeatures {
27
27
  editMode?: PreprFeatureConfig;
28
28
  }
29
29
  interface PreprToolbarProps {
30
- readonly activeSegment: string | null;
31
- readonly activeVariant: string | null;
30
+ /**
31
+ * Server-resolved active segment. Optional: omit it with `segments`
32
+ * disabled, where there is nothing to resolve. When enabled and omitted,
33
+ * the persisted cookie is used.
34
+ */
35
+ readonly activeSegment?: string | null;
36
+ /**
37
+ * Server-resolved active A/B variant. Optional: omit it with `abTesting`
38
+ * disabled, where there is nothing to resolve. When enabled and omitted,
39
+ * the persisted cookie is used.
40
+ */
41
+ readonly activeVariant?: string | null;
32
42
  /** Available segments to personalize on. */
33
43
  readonly segments?: readonly PreprSegment[];
34
44
  /** @deprecated Alias for `segments`. */
@@ -27,8 +27,18 @@ interface PreprFeatures {
27
27
  editMode?: PreprFeatureConfig;
28
28
  }
29
29
  interface PreprToolbarProps {
30
- readonly activeSegment: string | null;
31
- readonly activeVariant: string | null;
30
+ /**
31
+ * Server-resolved active segment. Optional: omit it with `segments`
32
+ * disabled, where there is nothing to resolve. When enabled and omitted,
33
+ * the persisted cookie is used.
34
+ */
35
+ readonly activeSegment?: string | null;
36
+ /**
37
+ * Server-resolved active A/B variant. Optional: omit it with `abTesting`
38
+ * disabled, where there is nothing to resolve. When enabled and omitted,
39
+ * the persisted cookie is used.
40
+ */
41
+ readonly activeVariant?: string | null;
32
42
  /** Available segments to personalize on. */
33
43
  readonly segments?: readonly PreprSegment[];
34
44
  /** @deprecated Alias for `segments`. */
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "0.2.0-beta.3";
2
+ var VERSION = "0.2.0-beta.4";
3
3
 
4
4
  // src/core/constants.ts
5
5
  var COOKIE_PREVIEW_MODE = "Prepr-Preview-Mode";
@@ -70,8 +70,18 @@ interface PreprPreviewOptions extends PreprToolbarOptions {
70
70
  allowedEditorOrigins?: string[];
71
71
  }
72
72
  interface PreprToolbarProps {
73
- readonly activeSegment: string | null;
74
- readonly activeVariant: string | null;
73
+ /**
74
+ * Server-resolved active segment. Optional: omit it with `segments`
75
+ * disabled, where there is nothing to resolve. When enabled and omitted,
76
+ * the persisted cookie is used.
77
+ */
78
+ readonly activeSegment?: string | null;
79
+ /**
80
+ * Server-resolved active A/B variant. Optional: omit it with `abTesting`
81
+ * disabled, where there is nothing to resolve. When enabled and omitted,
82
+ * the persisted cookie is used.
83
+ */
84
+ readonly activeVariant?: string | null;
75
85
  /** Available segments to personalize on. */
76
86
  readonly segments?: readonly PreprSegment[];
77
87
  /** @deprecated Alias for `segments`. */
@@ -70,8 +70,18 @@ interface PreprPreviewOptions extends PreprToolbarOptions {
70
70
  allowedEditorOrigins?: string[];
71
71
  }
72
72
  interface PreprToolbarProps {
73
- readonly activeSegment: string | null;
74
- readonly activeVariant: string | null;
73
+ /**
74
+ * Server-resolved active segment. Optional: omit it with `segments`
75
+ * disabled, where there is nothing to resolve. When enabled and omitted,
76
+ * the persisted cookie is used.
77
+ */
78
+ readonly activeSegment?: string | null;
79
+ /**
80
+ * Server-resolved active A/B variant. Optional: omit it with `abTesting`
81
+ * disabled, where there is nothing to resolve. When enabled and omitted,
82
+ * the persisted cookie is used.
83
+ */
84
+ readonly activeVariant?: string | null;
75
85
  /** Available segments to personalize on. */
76
86
  readonly segments?: readonly PreprSegment[];
77
87
  /** @deprecated Alias for `segments`. */
@@ -64,8 +64,18 @@ interface PreprPreviewOptions extends PreprToolbarOptions {
64
64
  allowedEditorOrigins?: string[];
65
65
  }
66
66
  interface PreprToolbarProps {
67
- readonly activeSegment: string | null;
68
- readonly activeVariant: string | null;
67
+ /**
68
+ * Server-resolved active segment. Optional: omit it with `segments`
69
+ * disabled, where there is nothing to resolve. When enabled and omitted,
70
+ * the persisted cookie is used.
71
+ */
72
+ readonly activeSegment?: string | null;
73
+ /**
74
+ * Server-resolved active A/B variant. Optional: omit it with `abTesting`
75
+ * disabled, where there is nothing to resolve. When enabled and omitted,
76
+ * the persisted cookie is used.
77
+ */
78
+ readonly activeVariant?: string | null;
69
79
  /** Available segments to personalize on. */
70
80
  readonly segments?: readonly PreprSegment[];
71
81
  /** @deprecated Alias for `segments`. */
@@ -64,8 +64,18 @@ interface PreprPreviewOptions extends PreprToolbarOptions {
64
64
  allowedEditorOrigins?: string[];
65
65
  }
66
66
  interface PreprToolbarProps {
67
- readonly activeSegment: string | null;
68
- readonly activeVariant: string | null;
67
+ /**
68
+ * Server-resolved active segment. Optional: omit it with `segments`
69
+ * disabled, where there is nothing to resolve. When enabled and omitted,
70
+ * the persisted cookie is used.
71
+ */
72
+ readonly activeSegment?: string | null;
73
+ /**
74
+ * Server-resolved active A/B variant. Optional: omit it with `abTesting`
75
+ * disabled, where there is nothing to resolve. When enabled and omitted,
76
+ * the persisted cookie is used.
77
+ */
78
+ readonly activeVariant?: string | null;
69
79
  /** Available segments to personalize on. */
70
80
  readonly segments?: readonly PreprSegment[];
71
81
  /** @deprecated Alias for `segments`. */
@@ -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.2.0-beta.3";
38
+ var VERSION = "0.2.0-beta.4";
39
39
 
40
40
  // src/core/constants.ts
41
41
  var COOKIE_PREVIEW_MODE = "Prepr-Preview-Mode";
@@ -27,8 +27,18 @@ interface PreprFeatures {
27
27
  editMode?: PreprFeatureConfig;
28
28
  }
29
29
  interface PreprToolbarProps {
30
- readonly activeSegment: string | null;
31
- readonly activeVariant: string | null;
30
+ /**
31
+ * Server-resolved active segment. Optional: omit it with `segments`
32
+ * disabled, where there is nothing to resolve. When enabled and omitted,
33
+ * the persisted cookie is used.
34
+ */
35
+ readonly activeSegment?: string | null;
36
+ /**
37
+ * Server-resolved active A/B variant. Optional: omit it with `abTesting`
38
+ * disabled, where there is nothing to resolve. When enabled and omitted,
39
+ * the persisted cookie is used.
40
+ */
41
+ readonly activeVariant?: string | null;
32
42
  /** Available segments to personalize on. */
33
43
  readonly segments?: readonly PreprSegment[];
34
44
  /** @deprecated Alias for `segments`. */
@@ -27,8 +27,18 @@ interface PreprFeatures {
27
27
  editMode?: PreprFeatureConfig;
28
28
  }
29
29
  interface PreprToolbarProps {
30
- readonly activeSegment: string | null;
31
- readonly activeVariant: string | null;
30
+ /**
31
+ * Server-resolved active segment. Optional: omit it with `segments`
32
+ * disabled, where there is nothing to resolve. When enabled and omitted,
33
+ * the persisted cookie is used.
34
+ */
35
+ readonly activeSegment?: string | null;
36
+ /**
37
+ * Server-resolved active A/B variant. Optional: omit it with `abTesting`
38
+ * disabled, where there is nothing to resolve. When enabled and omitted,
39
+ * the persisted cookie is used.
40
+ */
41
+ readonly activeVariant?: string | null;
32
42
  /** Available segments to personalize on. */
33
43
  readonly segments?: readonly PreprSegment[];
34
44
  /** @deprecated Alias for `segments`. */
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "0.2.0-beta.3";
2
+ var VERSION = "0.2.0-beta.4";
3
3
 
4
4
  // src/core/constants.ts
5
5
  var COOKIE_PREVIEW_MODE = "Prepr-Preview-Mode";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@preprio/toolkit",
3
- "version": "0.2.0-beta.3",
3
+ "version": "0.2.0-beta.4",
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)",
@@ -94,16 +94,6 @@
94
94
  "src/sveltekit/*.svelte",
95
95
  "src/nuxt/*.vue"
96
96
  ],
97
- "scripts": {
98
- "gen:css": "node scripts/compile-css.mjs",
99
- "prebuild": "rm -rf dist && pnpm gen:css && node scripts/check-version.mjs",
100
- "pretest": "pnpm gen:css",
101
- "pretypecheck": "pnpm gen:css",
102
- "build": "tsup",
103
- "postbuild": "node scripts/check-exports.mjs",
104
- "test": "vitest run",
105
- "typecheck": "tsc --noEmit"
106
- },
107
97
  "dependencies": {
108
98
  "@vercel/stega": "^1.1.0",
109
99
  "preact": "^10.29.7"
@@ -145,5 +135,15 @@
145
135
  "tsup": "^8.5.1",
146
136
  "typescript": "^5.9.3",
147
137
  "vitest": "^4.1.10"
138
+ },
139
+ "scripts": {
140
+ "gen:css": "node scripts/compile-css.mjs",
141
+ "prebuild": "rm -rf dist && pnpm gen:css && node scripts/check-version.mjs",
142
+ "pretest": "pnpm gen:css",
143
+ "pretypecheck": "pnpm gen:css",
144
+ "build": "tsup",
145
+ "postbuild": "node scripts/check-exports.mjs",
146
+ "test": "vitest run",
147
+ "typecheck": "tsc --noEmit"
148
148
  }
149
- }
149
+ }
@@ -11,8 +11,8 @@ import { createPreprPreview } from '@preprio/toolkit';
11
11
  import type { PreprToolbarComponentProps } from '@preprio/toolkit';
12
12
 
13
13
  const props = defineProps<{
14
- activeSegment: PreprToolbarComponentProps['activeSegment'];
15
- activeVariant: PreprToolbarComponentProps['activeVariant'];
14
+ activeSegment?: PreprToolbarComponentProps['activeSegment'];
15
+ activeVariant?: PreprToolbarComponentProps['activeVariant'];
16
16
  segments?: PreprToolbarComponentProps['segments'];
17
17
  data?: PreprToolbarComponentProps['data'];
18
18
  options?: PreprToolbarComponentProps['options'];