@preprio/toolkit 0.2.0-beta.2 → 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.
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/react/index.ts
21
+ var react_exports = {};
22
+ __export(react_exports, {
23
+ PreprPreview: () => import_components.PreprPreview,
24
+ PreprTrackingPixel: () => import_components.PreprTrackingPixel
25
+ });
26
+ module.exports = __toCommonJS(react_exports);
27
+ var import_components = require("./components.js");
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ PreprPreview,
31
+ PreprTrackingPixel
32
+ });
@@ -0,0 +1 @@
1
+ export { PreprPreview, PreprPreviewProps, PreprTrackingPixel, PreprTrackingPixelProps } from './components.js';
@@ -0,0 +1 @@
1
+ export { PreprPreview, PreprPreviewProps, PreprTrackingPixel, PreprTrackingPixelProps } from './components.js';
@@ -0,0 +1,9 @@
1
+ // src/react/index.ts
2
+ import {
3
+ PreprPreview,
4
+ PreprTrackingPixel
5
+ } from "./components.js";
6
+ export {
7
+ PreprPreview,
8
+ PreprTrackingPixel
9
+ };
@@ -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.2";
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.2";
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,7 +1,7 @@
1
1
  {
2
2
  "name": "@preprio/toolkit",
3
- "version": "0.2.0-beta.2",
4
- "description": "Prepr personalization, A/B testing and preview toolkit for Next.js, Nuxt, Astro, SvelteKit and Express",
3
+ "version": "0.2.0-beta.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)",
7
7
  "keywords": [
@@ -12,6 +12,7 @@
12
12
  "ab-testing",
13
13
  "preview",
14
14
  "visual-editing",
15
+ "react",
15
16
  "nextjs",
16
17
  "nuxt",
17
18
  "astro",
@@ -38,6 +39,16 @@
38
39
  "import": "./dist/index.js",
39
40
  "require": "./dist/index.cjs"
40
41
  },
42
+ "./react": {
43
+ "types": "./dist/react/index.d.ts",
44
+ "import": "./dist/react/index.js",
45
+ "require": "./dist/react/index.cjs"
46
+ },
47
+ "./react/components": {
48
+ "types": "./dist/react/components.d.ts",
49
+ "import": "./dist/react/components.js",
50
+ "require": "./dist/react/components.cjs"
51
+ },
41
52
  "./nextjs": {
42
53
  "types": "./dist/nextjs/index.d.ts",
43
54
  "import": "./dist/nextjs/index.js",
@@ -83,16 +94,6 @@
83
94
  "src/sveltekit/*.svelte",
84
95
  "src/nuxt/*.vue"
85
96
  ],
86
- "scripts": {
87
- "gen:css": "node scripts/compile-css.mjs",
88
- "prebuild": "rm -rf dist && pnpm gen:css && node scripts/check-version.mjs",
89
- "pretest": "pnpm gen:css",
90
- "pretypecheck": "pnpm gen:css",
91
- "build": "tsup",
92
- "postbuild": "node scripts/check-exports.mjs",
93
- "test": "vitest run",
94
- "typecheck": "tsc --noEmit"
95
- },
96
97
  "dependencies": {
97
98
  "@vercel/stega": "^1.1.0",
98
99
  "preact": "^10.29.7"
@@ -134,5 +135,15 @@
134
135
  "tsup": "^8.5.1",
135
136
  "typescript": "^5.9.3",
136
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"
137
148
  }
138
- }
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'];