@preprio/toolkit 0.6.0-alpha.3 → 0.6.0-alpha.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.
- package/dist/astro/{chunk-CUDYSNJD.js → chunk-TLUVG5P7.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-VY5D3IED.js → chunk-EE3GXKCF.js} +1 -1
- package/dist/{chunk-FC53KN4H.js → chunk-MZW2RVGY.js} +1 -1
- package/dist/{chunk-UH2OK4XC.js → chunk-XQ4DDVSW.js} +1 -1
- package/dist/{chunk-3YZANSVY.js → chunk-YNZUYENT.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-5XGJJVGX.js → chunk-HP2SJJSL.js} +1 -1
- package/dist/nextjs/components.cjs +18 -7
- package/dist/nextjs/components.d.cts +2 -2
- package/dist/nextjs/components.d.ts +2 -2
- package/dist/nextjs/components.js +22 -9
- package/dist/nextjs/graphql.cjs +1 -1
- package/dist/nextjs/graphql.js +1 -1
- package/dist/nextjs/index.cjs +1 -1
- package/dist/nextjs/index.d.cts +2 -1
- package/dist/nextjs/index.d.ts +2 -1
- package/dist/nextjs/index.js +1 -1
- package/dist/nuxt/{chunk-KROR7RXW.js → chunk-QVY3D5B2.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-INDMNPEM.js → chunk-VSN5EX3U.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-MZW2RVGY.js";
|
|
6
|
+
import "../chunk-XQ4DDVSW.js";
|
|
7
|
+
import "../chunk-EE3GXKCF.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-MZW2RVGY.js";
|
|
25
25
|
import {
|
|
26
26
|
PreprError,
|
|
27
27
|
validatePreprToken
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import "./chunk-
|
|
28
|
+
} from "./chunk-XQ4DDVSW.js";
|
|
29
|
+
import "./chunk-EE3GXKCF.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.4";
|
|
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.4";
|
|
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-YNZUYENT.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-XQ4DDVSW.js";
|
|
36
36
|
import {
|
|
37
37
|
VERSION,
|
|
38
38
|
resolveFeatures
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-EE3GXKCF.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.4";
|
|
2517
2517
|
|
|
2518
2518
|
// src/core/pixel.ts
|
|
2519
2519
|
var PIXEL_SCRIPT_URL = "https://cdn.tracking.prepr.io/js/prepr.min.js";
|
|
@@ -2598,23 +2598,34 @@ function PreprPersonalizationSwitch({
|
|
|
2598
2598
|
refresh = true,
|
|
2599
2599
|
freshFor
|
|
2600
2600
|
}) {
|
|
2601
|
-
const
|
|
2602
|
-
|
|
2601
|
+
const [scheduler, setScheduler] = (0, import_react2.useState)(
|
|
2602
|
+
null
|
|
2603
|
+
);
|
|
2603
2604
|
(0, import_react2.useLayoutEffect)(() => {
|
|
2604
2605
|
applyPreprDecisions();
|
|
2605
2606
|
});
|
|
2606
2607
|
(0, import_react2.useEffect)(() => {
|
|
2607
2608
|
if (!refresh) return;
|
|
2608
2609
|
const started = createPreprRefreshScheduler({ freshFor });
|
|
2609
|
-
|
|
2610
|
+
setScheduler(started);
|
|
2610
2611
|
return () => {
|
|
2611
2612
|
started.stop();
|
|
2612
|
-
|
|
2613
|
+
setScheduler(null);
|
|
2613
2614
|
};
|
|
2614
2615
|
}, [refresh, freshFor]);
|
|
2616
|
+
return scheduler ? (0, import_react2.createElement)(
|
|
2617
|
+
import_react2.Suspense,
|
|
2618
|
+
{ fallback: null },
|
|
2619
|
+
(0, import_react2.createElement)(ViewCounter, { scheduler })
|
|
2620
|
+
) : null;
|
|
2621
|
+
}
|
|
2622
|
+
function ViewCounter({
|
|
2623
|
+
scheduler
|
|
2624
|
+
}) {
|
|
2625
|
+
const pathname = (0, import_navigation.usePathname)();
|
|
2615
2626
|
(0, import_react2.useEffect)(() => {
|
|
2616
|
-
scheduler.
|
|
2617
|
-
}, [pathname,
|
|
2627
|
+
scheduler.view();
|
|
2628
|
+
}, [pathname, scheduler]);
|
|
2618
2629
|
return null;
|
|
2619
2630
|
}
|
|
2620
2631
|
var VARIANT_KEY_ATTRIBUTE = "data-prepr-variant-key";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { k as PreprToolbarComponentProps } from '../types-BYH9XqmN.cjs';
|
|
3
3
|
import { P as PreprPixelConfig } from '../pixel-DwW7cXJm.cjs';
|
|
4
4
|
|
|
@@ -58,7 +58,7 @@ interface PreprPersonalizationSwitchProps {
|
|
|
58
58
|
* @example
|
|
59
59
|
* <PreprPersonalizationSwitch />
|
|
60
60
|
*/
|
|
61
|
-
declare function PreprPersonalizationSwitch({ refresh, freshFor, }: PreprPersonalizationSwitchProps): null;
|
|
61
|
+
declare function PreprPersonalizationSwitch({ refresh, freshFor, }: PreprPersonalizationSwitchProps): ReactElement | null;
|
|
62
62
|
/**
|
|
63
63
|
* Wraps one rendered variant and, once hydrated, puts the variant keys on the
|
|
64
64
|
* elements inside, where Prepr's tracking pixel counts impressions and the
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { k as PreprToolbarComponentProps } from '../types-BYH9XqmN.js';
|
|
3
3
|
import { P as PreprPixelConfig } from '../pixel-DwW7cXJm.js';
|
|
4
4
|
|
|
@@ -58,7 +58,7 @@ interface PreprPersonalizationSwitchProps {
|
|
|
58
58
|
* @example
|
|
59
59
|
* <PreprPersonalizationSwitch />
|
|
60
60
|
*/
|
|
61
|
-
declare function PreprPersonalizationSwitch({ refresh, freshFor, }: PreprPersonalizationSwitchProps): null;
|
|
61
|
+
declare function PreprPersonalizationSwitch({ refresh, freshFor, }: PreprPersonalizationSwitchProps): ReactElement | null;
|
|
62
62
|
/**
|
|
63
63
|
* Wraps one rendered variant and, once hydrated, puts the variant keys on the
|
|
64
64
|
* elements inside, where Prepr's tracking pixel counts impressions and the
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createPreprPreview,
|
|
4
4
|
loadTrackingPixel
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-YNZUYENT.js";
|
|
6
6
|
import "../chunk-S5RWVMDJ.js";
|
|
7
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-EE3GXKCF.js";
|
|
8
8
|
|
|
9
9
|
// src/nextjs/components.ts
|
|
10
10
|
import { usePathname, useRouter } from "next/navigation";
|
|
@@ -12,7 +12,9 @@ import {
|
|
|
12
12
|
createElement,
|
|
13
13
|
useEffect as useEffect2,
|
|
14
14
|
useLayoutEffect,
|
|
15
|
-
useRef
|
|
15
|
+
useRef,
|
|
16
|
+
useState,
|
|
17
|
+
Suspense
|
|
16
18
|
} from "react";
|
|
17
19
|
|
|
18
20
|
// src/react/hydration.ts
|
|
@@ -272,23 +274,34 @@ function PreprPersonalizationSwitch({
|
|
|
272
274
|
refresh = true,
|
|
273
275
|
freshFor
|
|
274
276
|
}) {
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
+
const [scheduler, setScheduler] = useState(
|
|
278
|
+
null
|
|
279
|
+
);
|
|
277
280
|
useLayoutEffect(() => {
|
|
278
281
|
applyPreprDecisions();
|
|
279
282
|
});
|
|
280
283
|
useEffect2(() => {
|
|
281
284
|
if (!refresh) return;
|
|
282
285
|
const started = createPreprRefreshScheduler({ freshFor });
|
|
283
|
-
|
|
286
|
+
setScheduler(started);
|
|
284
287
|
return () => {
|
|
285
288
|
started.stop();
|
|
286
|
-
|
|
289
|
+
setScheduler(null);
|
|
287
290
|
};
|
|
288
291
|
}, [refresh, freshFor]);
|
|
292
|
+
return scheduler ? createElement(
|
|
293
|
+
Suspense,
|
|
294
|
+
{ fallback: null },
|
|
295
|
+
createElement(ViewCounter, { scheduler })
|
|
296
|
+
) : null;
|
|
297
|
+
}
|
|
298
|
+
function ViewCounter({
|
|
299
|
+
scheduler
|
|
300
|
+
}) {
|
|
301
|
+
const pathname = usePathname();
|
|
289
302
|
useEffect2(() => {
|
|
290
|
-
scheduler.
|
|
291
|
-
}, [pathname,
|
|
303
|
+
scheduler.view();
|
|
304
|
+
}, [pathname, scheduler]);
|
|
292
305
|
return null;
|
|
293
306
|
}
|
|
294
307
|
var VARIANT_KEY_ATTRIBUTE = "data-prepr-variant-key";
|
package/dist/nextjs/graphql.cjs
CHANGED
package/dist/nextjs/graphql.js
CHANGED
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.4";
|
|
48
48
|
|
|
49
49
|
// src/core/constants.ts
|
|
50
50
|
var COOKIE_PREVIEW_MODE = "Prepr-Preview-Mode";
|
package/dist/nextjs/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NextRequest, NextResponse } from 'next/server';
|
|
2
2
|
import { a as PreprFeatures, P as PreprHeaders, c as PreprToolbarProps, d as PreprToolbarComponentProps } from './server-BL-sqZvu.cjs';
|
|
3
3
|
export { b as PreprError, e as extractAccessToken, i as isPersonalizedResponse, v as validatePreprToken } from './server-BL-sqZvu.cjs';
|
|
4
|
+
import { ReactElement } from 'react';
|
|
4
5
|
|
|
5
6
|
interface PreprMiddlewareOptions {
|
|
6
7
|
/** Enable preview-mode headers (segment/AB overrides, preview bar). */
|
|
@@ -181,6 +182,6 @@ interface PreprPersonalizationSwitchProps {
|
|
|
181
182
|
* @example
|
|
182
183
|
* <PreprPersonalizationSwitch />
|
|
183
184
|
*/
|
|
184
|
-
declare function PreprPersonalizationSwitch({ refresh, freshFor, }: PreprPersonalizationSwitchProps): null;
|
|
185
|
+
declare function PreprPersonalizationSwitch({ refresh, freshFor, }: PreprPersonalizationSwitchProps): ReactElement | null;
|
|
185
186
|
|
|
186
187
|
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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NextRequest, NextResponse } from 'next/server';
|
|
2
2
|
import { a as PreprFeatures, P as PreprHeaders, c as PreprToolbarProps, d as PreprToolbarComponentProps } from './server-BL-sqZvu.js';
|
|
3
3
|
export { b as PreprError, e as extractAccessToken, i as isPersonalizedResponse, v as validatePreprToken } from './server-BL-sqZvu.js';
|
|
4
|
+
import { ReactElement } from 'react';
|
|
4
5
|
|
|
5
6
|
interface PreprMiddlewareOptions {
|
|
6
7
|
/** Enable preview-mode headers (segment/AB overrides, preview bar). */
|
|
@@ -181,6 +182,6 @@ interface PreprPersonalizationSwitchProps {
|
|
|
181
182
|
* @example
|
|
182
183
|
* <PreprPersonalizationSwitch />
|
|
183
184
|
*/
|
|
184
|
-
declare function PreprPersonalizationSwitch({ refresh, freshFor, }: PreprPersonalizationSwitchProps): null;
|
|
185
|
+
declare function PreprPersonalizationSwitch({ refresh, freshFor, }: PreprPersonalizationSwitchProps): ReactElement | null;
|
|
185
186
|
|
|
186
187
|
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.4";
|
|
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.4";
|
|
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.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)",
|