@preprio/toolkit 0.6.0-alpha.4 → 0.6.0-alpha.6
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/{chunk-TLUVG5P7.js → chunk-MWRA3732.js} +1 -1
- package/dist/astro/graphql.js +1 -1
- package/dist/astro/index.cjs +1 -1
- package/dist/astro/index.js +1 -1
- package/dist/{chunk-EE3GXKCF.js → chunk-NSQOGI5K.js} +1 -1
- package/dist/{chunk-XQ4DDVSW.js → chunk-OQGEL4TV.js} +1 -1
- package/dist/{chunk-MZW2RVGY.js → chunk-W6AVX6FI.js} +1 -1
- package/dist/{chunk-YNZUYENT.js → chunk-Y7DWVOOY.js} +1 -1
- package/dist/graphql/codegen.js +3 -3
- package/dist/graphql.js +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/nextjs/{chunk-HP2SJJSL.js → chunk-PIQF5ZI5.js} +1 -1
- package/dist/nextjs/components.cjs +7 -2
- package/dist/nextjs/components.d.cts +0 -18
- package/dist/nextjs/components.d.ts +0 -18
- package/dist/nextjs/components.js +8 -3
- package/dist/nextjs/graphql.cjs +3 -2
- package/dist/nextjs/graphql.js +3 -2
- package/dist/nextjs/index.cjs +1 -1
- package/dist/nextjs/index.d.cts +0 -18
- package/dist/nextjs/index.d.ts +0 -18
- package/dist/nextjs/index.js +1 -1
- package/dist/nuxt/{chunk-QVY3D5B2.js → chunk-PF6GVWHV.js} +1 -1
- package/dist/nuxt/graphql.js +1 -1
- package/dist/nuxt/index.cjs +1 -1
- package/dist/nuxt/index.js +1 -1
- package/dist/react/components.cjs +1 -1
- package/dist/react/components.js +1 -1
- package/dist/sveltekit/{chunk-VSN5EX3U.js → chunk-5K7HWMIF.js} +1 -1
- package/dist/sveltekit/graphql.js +1 -1
- package/dist/sveltekit/index.cjs +1 -1
- package/dist/sveltekit/index.js +1 -1
- package/package.json +1 -1
package/dist/astro/graphql.js
CHANGED
package/dist/astro/index.cjs
CHANGED
package/dist/astro/index.js
CHANGED
package/dist/graphql/codegen.js
CHANGED
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
toDecisionQuery,
|
|
3
3
|
toSchemaInfo,
|
|
4
4
|
toVariantsQuery
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-W6AVX6FI.js";
|
|
6
|
+
import "../chunk-OQGEL4TV.js";
|
|
7
|
+
import "../chunk-NSQOGI5K.js";
|
|
8
8
|
|
|
9
9
|
// src/codegen/index.ts
|
|
10
10
|
function typeRef(type) {
|
package/dist/graphql.js
CHANGED
|
@@ -21,12 +21,12 @@ import {
|
|
|
21
21
|
toSchemaInfo,
|
|
22
22
|
toVariantsDocument,
|
|
23
23
|
toVariantsQuery
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-W6AVX6FI.js";
|
|
25
25
|
import {
|
|
26
26
|
PreprError,
|
|
27
27
|
validatePreprToken
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import "./chunk-
|
|
28
|
+
} from "./chunk-OQGEL4TV.js";
|
|
29
|
+
import "./chunk-NSQOGI5K.js";
|
|
30
30
|
|
|
31
31
|
// src/core/variants/probe-document.ts
|
|
32
32
|
function probeSelectionSet(set, fragments) {
|
package/dist/index.cjs
CHANGED
package/dist/index.d.cts
CHANGED
|
@@ -7,7 +7,7 @@ export { P as PreprPixelConfig, l as loadTrackingPixel, s as setTrackingParam, t
|
|
|
7
7
|
* Package version; must match package.json. Lives in its own leaf module so
|
|
8
8
|
* core can import it without cycling through the barrel.
|
|
9
9
|
*/
|
|
10
|
-
declare const VERSION = "0.6.0-alpha.
|
|
10
|
+
declare const VERSION = "0.6.0-alpha.6";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Resolve a `PreprFeatures` bag to plain booleans, defaulting every omitted key
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export { P as PreprPixelConfig, l as loadTrackingPixel, s as setTrackingParam, t
|
|
|
7
7
|
* Package version; must match package.json. Lives in its own leaf module so
|
|
8
8
|
* core can import it without cycling through the barrel.
|
|
9
9
|
*/
|
|
10
|
-
declare const VERSION = "0.6.0-alpha.
|
|
10
|
+
declare const VERSION = "0.6.0-alpha.6";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Resolve a `PreprFeatures` bag to plain booleans, defaulting every omitted key
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
loadTrackingPixel,
|
|
16
16
|
setTrackingParam,
|
|
17
17
|
trackEvent
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-Y7DWVOOY.js";
|
|
19
19
|
import {
|
|
20
20
|
isPersonalizedResponse
|
|
21
21
|
} from "./chunk-3NCEVJJ3.js";
|
|
@@ -32,11 +32,11 @@ import {
|
|
|
32
32
|
getPreprUUIDFromHeaders,
|
|
33
33
|
getToolbarPropsFromHeaders,
|
|
34
34
|
validatePreprToken
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-OQGEL4TV.js";
|
|
36
36
|
import {
|
|
37
37
|
VERSION,
|
|
38
38
|
resolveFeatures
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-NSQOGI5K.js";
|
|
40
40
|
|
|
41
41
|
// src/core/middleware.ts
|
|
42
42
|
var UTM_PARAMS = [
|
|
@@ -2513,7 +2513,7 @@ function applyPreprDecisions(view) {
|
|
|
2513
2513
|
var import_react = require("react");
|
|
2514
2514
|
|
|
2515
2515
|
// src/version.ts
|
|
2516
|
-
var VERSION = "0.6.0-alpha.
|
|
2516
|
+
var VERSION = "0.6.0-alpha.6";
|
|
2517
2517
|
|
|
2518
2518
|
// src/core/pixel.ts
|
|
2519
2519
|
var PIXEL_SCRIPT_URL = "https://cdn.tracking.prepr.io/js/prepr.min.js";
|
|
@@ -2594,6 +2594,7 @@ function PreprAbSwitch() {
|
|
|
2594
2594
|
});
|
|
2595
2595
|
return null;
|
|
2596
2596
|
}
|
|
2597
|
+
var viewCount = 0;
|
|
2597
2598
|
function PreprPersonalizationSwitch({
|
|
2598
2599
|
refresh = true,
|
|
2599
2600
|
freshFor
|
|
@@ -2601,8 +2602,12 @@ function PreprPersonalizationSwitch({
|
|
|
2601
2602
|
const [scheduler, setScheduler] = (0, import_react2.useState)(
|
|
2602
2603
|
null
|
|
2603
2604
|
);
|
|
2605
|
+
const viewUrl = (0, import_react2.useRef)(null);
|
|
2604
2606
|
(0, import_react2.useLayoutEffect)(() => {
|
|
2605
|
-
|
|
2607
|
+
const url = location.pathname + location.search;
|
|
2608
|
+
if (viewUrl.current === url) return;
|
|
2609
|
+
viewUrl.current = url;
|
|
2610
|
+
applyPreprDecisions(`${url}#${++viewCount}`);
|
|
2606
2611
|
});
|
|
2607
2612
|
(0, import_react2.useEffect)(() => {
|
|
2608
2613
|
if (!refresh) return;
|
|
@@ -40,24 +40,6 @@ interface PreprPersonalizationSwitchProps {
|
|
|
40
40
|
/** Same as `createPreprProxy`'s `freshFor`. Default 10 000 ms. */
|
|
41
41
|
freshFor?: number;
|
|
42
42
|
}
|
|
43
|
-
/**
|
|
44
|
-
* Shows the segment variants decided in the proxy for the groups above the
|
|
45
|
-
* fold, before the page paints, and keeps those decisions fresh while the
|
|
46
|
-
* visitor browses: a short while after each page view, when the visitor
|
|
47
|
-
* points at a link to a personalized page, and when the tab comes back.
|
|
48
|
-
* Because the next page's decision is already in place when it opens, a
|
|
49
|
-
* visitor who joins a segment mid-visit sees it on their next page view,
|
|
50
|
-
* without anything on screen changing.
|
|
51
|
-
*
|
|
52
|
-
* Mount it once in the root layout. The background refreshes are answered by
|
|
53
|
-
* `createPreprProxy`; with a proxy that calls `resolveDecisions` itself, the
|
|
54
|
-
* first refresh gets a page back and refreshing stops for the browser
|
|
55
|
-
* session. The decisions themselves come from `createPreprProxy` or
|
|
56
|
-
* `resolveDecisions` in `proxy.ts`.
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* <PreprPersonalizationSwitch />
|
|
60
|
-
*/
|
|
61
43
|
declare function PreprPersonalizationSwitch({ refresh, freshFor, }: PreprPersonalizationSwitchProps): ReactElement | null;
|
|
62
44
|
/**
|
|
63
45
|
* Wraps one rendered variant and, once hydrated, puts the variant keys on the
|
|
@@ -40,24 +40,6 @@ interface PreprPersonalizationSwitchProps {
|
|
|
40
40
|
/** Same as `createPreprProxy`'s `freshFor`. Default 10 000 ms. */
|
|
41
41
|
freshFor?: number;
|
|
42
42
|
}
|
|
43
|
-
/**
|
|
44
|
-
* Shows the segment variants decided in the proxy for the groups above the
|
|
45
|
-
* fold, before the page paints, and keeps those decisions fresh while the
|
|
46
|
-
* visitor browses: a short while after each page view, when the visitor
|
|
47
|
-
* points at a link to a personalized page, and when the tab comes back.
|
|
48
|
-
* Because the next page's decision is already in place when it opens, a
|
|
49
|
-
* visitor who joins a segment mid-visit sees it on their next page view,
|
|
50
|
-
* without anything on screen changing.
|
|
51
|
-
*
|
|
52
|
-
* Mount it once in the root layout. The background refreshes are answered by
|
|
53
|
-
* `createPreprProxy`; with a proxy that calls `resolveDecisions` itself, the
|
|
54
|
-
* first refresh gets a page back and refreshing stops for the browser
|
|
55
|
-
* session. The decisions themselves come from `createPreprProxy` or
|
|
56
|
-
* `resolveDecisions` in `proxy.ts`.
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* <PreprPersonalizationSwitch />
|
|
60
|
-
*/
|
|
61
43
|
declare function PreprPersonalizationSwitch({ refresh, freshFor, }: PreprPersonalizationSwitchProps): ReactElement | null;
|
|
62
44
|
/**
|
|
63
45
|
* Wraps one rendered variant and, once hydrated, puts the variant keys on the
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createPreprPreview,
|
|
4
4
|
loadTrackingPixel
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-Y7DWVOOY.js";
|
|
6
6
|
import "../chunk-S5RWVMDJ.js";
|
|
7
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-NSQOGI5K.js";
|
|
8
8
|
|
|
9
9
|
// src/nextjs/components.ts
|
|
10
10
|
import { usePathname, useRouter } from "next/navigation";
|
|
@@ -270,6 +270,7 @@ function PreprAbSwitch() {
|
|
|
270
270
|
});
|
|
271
271
|
return null;
|
|
272
272
|
}
|
|
273
|
+
var viewCount = 0;
|
|
273
274
|
function PreprPersonalizationSwitch({
|
|
274
275
|
refresh = true,
|
|
275
276
|
freshFor
|
|
@@ -277,8 +278,12 @@ function PreprPersonalizationSwitch({
|
|
|
277
278
|
const [scheduler, setScheduler] = useState(
|
|
278
279
|
null
|
|
279
280
|
);
|
|
281
|
+
const viewUrl = useRef(null);
|
|
280
282
|
useLayoutEffect(() => {
|
|
281
|
-
|
|
283
|
+
const url = location.pathname + location.search;
|
|
284
|
+
if (viewUrl.current === url) return;
|
|
285
|
+
viewUrl.current = url;
|
|
286
|
+
applyPreprDecisions(`${url}#${++viewCount}`);
|
|
282
287
|
});
|
|
283
288
|
useEffect2(() => {
|
|
284
289
|
if (!refresh) return;
|
package/dist/nextjs/graphql.cjs
CHANGED
|
@@ -38,7 +38,7 @@ __export(graphql_exports, {
|
|
|
38
38
|
module.exports = __toCommonJS(graphql_exports);
|
|
39
39
|
|
|
40
40
|
// src/version.ts
|
|
41
|
-
var VERSION = "0.6.0-alpha.
|
|
41
|
+
var VERSION = "0.6.0-alpha.6";
|
|
42
42
|
|
|
43
43
|
// src/core/features.ts
|
|
44
44
|
function isEnabled(config) {
|
|
@@ -1552,7 +1552,8 @@ function createPreprProxy(options) {
|
|
|
1552
1552
|
parseRefreshPaths(request.headers.get(PREPR_REFRESH_HEADER))
|
|
1553
1553
|
);
|
|
1554
1554
|
}
|
|
1555
|
-
const
|
|
1555
|
+
const rendersPage = (request.method === "GET" || request.method === "HEAD") && isPagePath(request.nextUrl.pathname);
|
|
1556
|
+
const target = rendersPage ? lookup(request.nextUrl) : null;
|
|
1556
1557
|
if (target && preview) {
|
|
1557
1558
|
const draft = preprDraftRedirect(request, { preview });
|
|
1558
1559
|
if (draft) return draft;
|
package/dist/nextjs/graphql.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
preprDraftRedirect,
|
|
8
8
|
resolvePreprBucket,
|
|
9
9
|
validatePreprToken
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-PIQF5ZI5.js";
|
|
11
11
|
|
|
12
12
|
// src/core/variants/constants.ts
|
|
13
13
|
var PREPR_CONTEXT_ALIAS = "_preprContext";
|
|
@@ -1143,7 +1143,8 @@ function createPreprProxy(options) {
|
|
|
1143
1143
|
parseRefreshPaths(request.headers.get(PREPR_REFRESH_HEADER))
|
|
1144
1144
|
);
|
|
1145
1145
|
}
|
|
1146
|
-
const
|
|
1146
|
+
const rendersPage = (request.method === "GET" || request.method === "HEAD") && isPagePath(request.nextUrl.pathname);
|
|
1147
|
+
const target = rendersPage ? lookup(request.nextUrl) : null;
|
|
1147
1148
|
if (target && preview) {
|
|
1148
1149
|
const draft = preprDraftRedirect(request, { preview });
|
|
1149
1150
|
if (draft) return draft;
|
package/dist/nextjs/index.cjs
CHANGED
|
@@ -44,7 +44,7 @@ module.exports = __toCommonJS(nextjs_exports);
|
|
|
44
44
|
var import_server = require("next/server");
|
|
45
45
|
|
|
46
46
|
// src/version.ts
|
|
47
|
-
var VERSION = "0.6.0-alpha.
|
|
47
|
+
var VERSION = "0.6.0-alpha.6";
|
|
48
48
|
|
|
49
49
|
// src/core/constants.ts
|
|
50
50
|
var COOKIE_PREVIEW_MODE = "Prepr-Preview-Mode";
|
package/dist/nextjs/index.d.cts
CHANGED
|
@@ -164,24 +164,6 @@ interface PreprPersonalizationSwitchProps {
|
|
|
164
164
|
/** Same as `createPreprProxy`'s `freshFor`. Default 10 000 ms. */
|
|
165
165
|
freshFor?: number;
|
|
166
166
|
}
|
|
167
|
-
/**
|
|
168
|
-
* Shows the segment variants decided in the proxy for the groups above the
|
|
169
|
-
* fold, before the page paints, and keeps those decisions fresh while the
|
|
170
|
-
* visitor browses: a short while after each page view, when the visitor
|
|
171
|
-
* points at a link to a personalized page, and when the tab comes back.
|
|
172
|
-
* Because the next page's decision is already in place when it opens, a
|
|
173
|
-
* visitor who joins a segment mid-visit sees it on their next page view,
|
|
174
|
-
* without anything on screen changing.
|
|
175
|
-
*
|
|
176
|
-
* Mount it once in the root layout. The background refreshes are answered by
|
|
177
|
-
* `createPreprProxy`; with a proxy that calls `resolveDecisions` itself, the
|
|
178
|
-
* first refresh gets a page back and refreshing stops for the browser
|
|
179
|
-
* session. The decisions themselves come from `createPreprProxy` or
|
|
180
|
-
* `resolveDecisions` in `proxy.ts`.
|
|
181
|
-
*
|
|
182
|
-
* @example
|
|
183
|
-
* <PreprPersonalizationSwitch />
|
|
184
|
-
*/
|
|
185
167
|
declare function PreprPersonalizationSwitch({ refresh, freshFor, }: PreprPersonalizationSwitchProps): ReactElement | null;
|
|
186
168
|
|
|
187
169
|
export { PREPR_BUCKET_COOKIE, type PreprBucket, type PreprDraftOptions, type PreprMiddlewareOptions, PreprPersonalizationSwitch, type PreprPersonalizationSwitchProps, PreprToolbar, PreprTrackingPixel, type PreprTrackingPixelProps, type ResolvePreprBucketOptions, createPreprDraftRoute, createPreprMiddleware, getActiveSegment, getActiveVariant, getPreprHeaders, getPreprUUID, getToolbarProps, preprDraftRedirect, resolvePreprBucket };
|
package/dist/nextjs/index.d.ts
CHANGED
|
@@ -164,24 +164,6 @@ interface PreprPersonalizationSwitchProps {
|
|
|
164
164
|
/** Same as `createPreprProxy`'s `freshFor`. Default 10 000 ms. */
|
|
165
165
|
freshFor?: number;
|
|
166
166
|
}
|
|
167
|
-
/**
|
|
168
|
-
* Shows the segment variants decided in the proxy for the groups above the
|
|
169
|
-
* fold, before the page paints, and keeps those decisions fresh while the
|
|
170
|
-
* visitor browses: a short while after each page view, when the visitor
|
|
171
|
-
* points at a link to a personalized page, and when the tab comes back.
|
|
172
|
-
* Because the next page's decision is already in place when it opens, a
|
|
173
|
-
* visitor who joins a segment mid-visit sees it on their next page view,
|
|
174
|
-
* without anything on screen changing.
|
|
175
|
-
*
|
|
176
|
-
* Mount it once in the root layout. The background refreshes are answered by
|
|
177
|
-
* `createPreprProxy`; with a proxy that calls `resolveDecisions` itself, the
|
|
178
|
-
* first refresh gets a page back and refreshing stops for the browser
|
|
179
|
-
* session. The decisions themselves come from `createPreprProxy` or
|
|
180
|
-
* `resolveDecisions` in `proxy.ts`.
|
|
181
|
-
*
|
|
182
|
-
* @example
|
|
183
|
-
* <PreprPersonalizationSwitch />
|
|
184
|
-
*/
|
|
185
167
|
declare function PreprPersonalizationSwitch({ refresh, freshFor, }: PreprPersonalizationSwitchProps): ReactElement | null;
|
|
186
168
|
|
|
187
169
|
export { PREPR_BUCKET_COOKIE, type PreprBucket, type PreprDraftOptions, type PreprMiddlewareOptions, PreprPersonalizationSwitch, type PreprPersonalizationSwitchProps, PreprToolbar, PreprTrackingPixel, type PreprTrackingPixelProps, type ResolvePreprBucketOptions, createPreprDraftRoute, createPreprMiddleware, getActiveSegment, getActiveVariant, getPreprHeaders, getPreprUUID, getToolbarProps, preprDraftRedirect, resolvePreprBucket };
|
package/dist/nextjs/index.js
CHANGED
package/dist/nuxt/graphql.js
CHANGED
package/dist/nuxt/index.cjs
CHANGED
package/dist/nuxt/index.js
CHANGED
|
@@ -2313,7 +2313,7 @@ function isReactHydrated(text) {
|
|
|
2313
2313
|
}
|
|
2314
2314
|
|
|
2315
2315
|
// src/version.ts
|
|
2316
|
-
var VERSION = "0.6.0-alpha.
|
|
2316
|
+
var VERSION = "0.6.0-alpha.6";
|
|
2317
2317
|
|
|
2318
2318
|
// src/core/pixel.ts
|
|
2319
2319
|
var PIXEL_SCRIPT_URL = "https://cdn.tracking.prepr.io/js/prepr.min.js";
|
package/dist/react/components.js
CHANGED
|
@@ -2289,7 +2289,7 @@ function isReactHydrated(text) {
|
|
|
2289
2289
|
}
|
|
2290
2290
|
|
|
2291
2291
|
// src/version.ts
|
|
2292
|
-
var VERSION = "0.6.0-alpha.
|
|
2292
|
+
var VERSION = "0.6.0-alpha.6";
|
|
2293
2293
|
|
|
2294
2294
|
// src/core/pixel.ts
|
|
2295
2295
|
var PIXEL_SCRIPT_URL = "https://cdn.tracking.prepr.io/js/prepr.min.js";
|
package/dist/sveltekit/index.cjs
CHANGED
package/dist/sveltekit/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@preprio/toolkit",
|
|
3
|
-
"version": "0.6.0-alpha.
|
|
3
|
+
"version": "0.6.0-alpha.6",
|
|
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)",
|