@uniformdev/next-app-router-client 20.7.1-alpha.122 → 20.7.1-alpha.134
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/LICENSE.txt +1 -1
- package/dist/index.d.mts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.esm.js +22 -23
- package/dist/index.js +23 -21
- package/dist/index.mjs +22 -23
- package/package.json +10 -8
package/LICENSE.txt
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
©
|
|
1
|
+
© 2026 Uniform Systems, Inc. All Rights Reserved.
|
|
2
2
|
See details of Uniform Systems, Inc. Master Subscription Agreement here: https://uniform.dev/eula
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ManifestV2, CompositionMetadata, TestEvent, ContextState, ContextOptions, CookieTransitionDataStoreOptions, Context, Quirks, ScoreVector } from '@uniformdev/context';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { JSX, PropsWithChildren } from 'react';
|
|
4
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
4
|
import { ComponentContext, ComponentParameter, PersonalizeProps } from '@uniformdev/next-app-router-shared';
|
|
6
5
|
import { VisibilityParameterValue } from '@uniformdev/canvas';
|
|
7
6
|
import * as _uniformdev_context__ from '@uniformdev/context/*';
|
|
@@ -69,7 +68,7 @@ type ClientUniformTextProps = {
|
|
|
69
68
|
/**
|
|
70
69
|
* Renders text parameters. Offers inline editing capability out of the box.
|
|
71
70
|
*/
|
|
72
|
-
declare const ClientUniformText: ({ as, component, parameter: providedParameter, isMultiline, placeholder, render, ...props }: ClientUniformTextProps) =>
|
|
71
|
+
declare const ClientUniformText: ({ as, component, parameter: providedParameter, isMultiline, placeholder, render, ...props }: ClientUniformTextProps) => React__default.JSX.Element | null;
|
|
73
72
|
|
|
74
73
|
/**
|
|
75
74
|
* Transfers context state updates from RSC to the client-side context.
|
|
@@ -86,12 +85,12 @@ declare const Personalize: ({ parameters, indexes, slots, context: compositionCo
|
|
|
86
85
|
children?: React.ReactNode | undefined;
|
|
87
86
|
}>;
|
|
88
87
|
|
|
89
|
-
declare const UniformScript: () =>
|
|
88
|
+
declare const UniformScript: () => null;
|
|
90
89
|
|
|
91
90
|
declare const VisibilityRulesWrapperClient: ({ parameter, initialIsVisible, children, }: PropsWithChildren<{
|
|
92
91
|
parameter: VisibilityParameterValue;
|
|
93
92
|
initialIsVisible: boolean | null;
|
|
94
|
-
}>) =>
|
|
93
|
+
}>) => React__default.JSX.Element | null;
|
|
95
94
|
|
|
96
95
|
type CreateUniformContextOptions = Omit<ContextOptions, 'transitionStore'> & {
|
|
97
96
|
serverCookieValue: string | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ManifestV2, CompositionMetadata, TestEvent, ContextState, ContextOptions, CookieTransitionDataStoreOptions, Context, Quirks, ScoreVector } from '@uniformdev/context';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { JSX, PropsWithChildren } from 'react';
|
|
4
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
4
|
import { ComponentContext, ComponentParameter, PersonalizeProps } from '@uniformdev/next-app-router-shared';
|
|
6
5
|
import { VisibilityParameterValue } from '@uniformdev/canvas';
|
|
7
6
|
import * as _uniformdev_context__ from '@uniformdev/context/*';
|
|
@@ -69,7 +68,7 @@ type ClientUniformTextProps = {
|
|
|
69
68
|
/**
|
|
70
69
|
* Renders text parameters. Offers inline editing capability out of the box.
|
|
71
70
|
*/
|
|
72
|
-
declare const ClientUniformText: ({ as, component, parameter: providedParameter, isMultiline, placeholder, render, ...props }: ClientUniformTextProps) =>
|
|
71
|
+
declare const ClientUniformText: ({ as, component, parameter: providedParameter, isMultiline, placeholder, render, ...props }: ClientUniformTextProps) => React__default.JSX.Element | null;
|
|
73
72
|
|
|
74
73
|
/**
|
|
75
74
|
* Transfers context state updates from RSC to the client-side context.
|
|
@@ -86,12 +85,12 @@ declare const Personalize: ({ parameters, indexes, slots, context: compositionCo
|
|
|
86
85
|
children?: React.ReactNode | undefined;
|
|
87
86
|
}>;
|
|
88
87
|
|
|
89
|
-
declare const UniformScript: () =>
|
|
88
|
+
declare const UniformScript: () => null;
|
|
90
89
|
|
|
91
90
|
declare const VisibilityRulesWrapperClient: ({ parameter, initialIsVisible, children, }: PropsWithChildren<{
|
|
92
91
|
parameter: VisibilityParameterValue;
|
|
93
92
|
initialIsVisible: boolean | null;
|
|
94
|
-
}>) =>
|
|
93
|
+
}>) => React__default.JSX.Element | null;
|
|
95
94
|
|
|
96
95
|
type CreateUniformContextOptions = Omit<ContextOptions, 'transitionStore'> & {
|
|
97
96
|
serverCookieValue: string | undefined;
|
package/dist/index.esm.js
CHANGED
|
@@ -7,10 +7,12 @@ import { useEffect as useEffect3 } from "react";
|
|
|
7
7
|
import { useEffect, useRef, useState } from "react";
|
|
8
8
|
var useStableValue = (value, isValid) => {
|
|
9
9
|
const previousRef = useRef(null);
|
|
10
|
+
const isValidRef = useRef(isValid);
|
|
10
11
|
const [stableValue, setStableValue] = useState(void 0);
|
|
12
|
+
isValidRef.current = isValid;
|
|
11
13
|
useEffect(() => {
|
|
12
14
|
const serialized = JSON.stringify(value);
|
|
13
|
-
const valid =
|
|
15
|
+
const valid = isValidRef.current ? isValidRef.current(value) : true;
|
|
14
16
|
if (serialized !== previousRef.current && valid) {
|
|
15
17
|
previousRef.current = serialized;
|
|
16
18
|
setStableValue(value);
|
|
@@ -79,7 +81,7 @@ import {
|
|
|
79
81
|
createQuirksVisibilityRule,
|
|
80
82
|
evaluatePropertyCriteria
|
|
81
83
|
} from "@uniformdev/canvas";
|
|
82
|
-
import { useMemo } from "react";
|
|
84
|
+
import React, { useMemo } from "react";
|
|
83
85
|
|
|
84
86
|
// src/hooks/useQuirks.ts
|
|
85
87
|
import { useEffect as useEffect4, useState as useState3 } from "react";
|
|
@@ -104,7 +106,6 @@ function useQuirks() {
|
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
// src/components/ClientUniformText.tsx
|
|
107
|
-
import { jsx } from "react/jsx-runtime";
|
|
108
109
|
var ClientUniformText = ({
|
|
109
110
|
as,
|
|
110
111
|
component,
|
|
@@ -146,10 +147,10 @@ var ClientUniformText = ({
|
|
|
146
147
|
const parameterId = parameter.parameterId;
|
|
147
148
|
const isContextualEditing = Boolean(parameter._contextualEditing);
|
|
148
149
|
if (!isContextualEditing) {
|
|
149
|
-
return /* @__PURE__ */
|
|
150
|
+
return /* @__PURE__ */ React.createElement(Tag, { style: isMultiline ? { whiteSpace: "pre-wrap" } : {}, ...props }, render(currentValue));
|
|
150
151
|
}
|
|
151
152
|
const computedPlaceholder = typeof placeholder === "function" ? placeholder({ id: parameterId }) : placeholder;
|
|
152
|
-
return /* @__PURE__ */
|
|
153
|
+
return /* @__PURE__ */ React.createElement(
|
|
153
154
|
Tag,
|
|
154
155
|
{
|
|
155
156
|
...props,
|
|
@@ -161,9 +162,9 @@ var ClientUniformText = ({
|
|
|
161
162
|
}),
|
|
162
163
|
"data-uniform-parameter-type": "text",
|
|
163
164
|
"data-uniform-placeholder": computedPlaceholder,
|
|
164
|
-
style: isMultiline ? { whiteSpace: "pre-wrap" } : {}
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
style: isMultiline ? { whiteSpace: "pre-wrap" } : {}
|
|
166
|
+
},
|
|
167
|
+
isContextualEditing ? currentValue : render(currentValue)
|
|
167
168
|
);
|
|
168
169
|
};
|
|
169
170
|
var getParameterAttributes = ({
|
|
@@ -239,11 +240,7 @@ var createClientUniformContext = (options) => {
|
|
|
239
240
|
};
|
|
240
241
|
|
|
241
242
|
// src/hooks/useInitUniformContext.ts
|
|
242
|
-
import {
|
|
243
|
-
import {
|
|
244
|
-
UNIFORM_MIDDLEWARE_QUIRK_COOKIE_NAME,
|
|
245
|
-
UNIFORM_MIDDLEWARE_SCORE_COOKIE_NAME
|
|
246
|
-
} from "@uniformdev/next-app-router-shared";
|
|
243
|
+
import { UNIFORM_MIDDLEWARE_QUIRK_COOKIE_NAME } from "@uniformdev/next-app-router-shared";
|
|
247
244
|
import Cookies from "js-cookie";
|
|
248
245
|
import { usePathname, useSearchParams } from "next/navigation";
|
|
249
246
|
import { useEffect as useEffect6, useRef as useRef3 } from "react";
|
|
@@ -255,7 +252,6 @@ var useInitUniformContext = (callback, compositionMetadata) => {
|
|
|
255
252
|
context.current = callback();
|
|
256
253
|
}
|
|
257
254
|
useEffect6(() => {
|
|
258
|
-
var _a;
|
|
259
255
|
if (typeof window === "undefined" || typeof window.__UNIFORM_CONTEXT__ !== "undefined") {
|
|
260
256
|
return;
|
|
261
257
|
}
|
|
@@ -263,15 +259,20 @@ var useInitUniformContext = (callback, compositionMetadata) => {
|
|
|
263
259
|
searchParams.forEach((value, key) => {
|
|
264
260
|
url.searchParams.set(key, value);
|
|
265
261
|
});
|
|
266
|
-
const scoreCookie = Cookies.get(UNIFORM_MIDDLEWARE_SCORE_COOKIE_NAME);
|
|
267
262
|
const quirkCookie = Cookies.get(UNIFORM_MIDDLEWARE_QUIRK_COOKIE_NAME);
|
|
268
|
-
|
|
269
|
-
|
|
263
|
+
let quirks = void 0;
|
|
264
|
+
if (quirkCookie) {
|
|
265
|
+
try {
|
|
266
|
+
quirks = JSON.parse(quirkCookie);
|
|
267
|
+
} catch (error) {
|
|
268
|
+
console.error("Error parsing quirk cookie", error);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
270
271
|
Cookies.remove(UNIFORM_MIDDLEWARE_QUIRK_COOKIE_NAME);
|
|
271
272
|
context.current.update({
|
|
272
273
|
url,
|
|
273
274
|
compositionMetadata,
|
|
274
|
-
quirks:
|
|
275
|
+
quirks: quirks != null ? quirks : {}
|
|
275
276
|
});
|
|
276
277
|
if (!window.__UNIFORM_CONTEXT__) {
|
|
277
278
|
window.__UNIFORM_CONTEXT__ = context.current;
|
|
@@ -402,7 +403,6 @@ var Personalize = ({
|
|
|
402
403
|
import { createCanvasChannel, isAllowedReferrer } from "@uniformdev/canvas";
|
|
403
404
|
import { useRouter as useRouter2 } from "next/navigation";
|
|
404
405
|
import { useEffect as useEffect9, useMemo as useMemo3, useRef as useRef4 } from "react";
|
|
405
|
-
import { Fragment as Fragment2, jsx as jsx2 } from "react/jsx-runtime";
|
|
406
406
|
var UniformScript = () => {
|
|
407
407
|
const router = useRouter2();
|
|
408
408
|
const needsToRefreshRef = useRef4(false);
|
|
@@ -467,7 +467,7 @@ var UniformScript = () => {
|
|
|
467
467
|
document.removeEventListener("focus", handleBlurChange, true);
|
|
468
468
|
};
|
|
469
469
|
}, [router]);
|
|
470
|
-
return
|
|
470
|
+
return null;
|
|
471
471
|
};
|
|
472
472
|
|
|
473
473
|
// src/components/VisibilityRulesWrapperClient.tsx
|
|
@@ -475,8 +475,7 @@ import {
|
|
|
475
475
|
createQuirksVisibilityRule as createQuirksVisibilityRule2,
|
|
476
476
|
evaluateNodeVisibilityParameter
|
|
477
477
|
} from "@uniformdev/canvas";
|
|
478
|
-
import { useEffect as useEffect10, useMemo as useMemo4, useState as useState6 } from "react";
|
|
479
|
-
import { Fragment as Fragment3, jsx as jsx3 } from "react/jsx-runtime";
|
|
478
|
+
import React2, { useEffect as useEffect10, useMemo as useMemo4, useState as useState6 } from "react";
|
|
480
479
|
var VisibilityRulesWrapperClient = ({
|
|
481
480
|
parameter,
|
|
482
481
|
initialIsVisible,
|
|
@@ -503,7 +502,7 @@ var VisibilityRulesWrapperClient = ({
|
|
|
503
502
|
setIsVisible(result);
|
|
504
503
|
setVisibleSource("client");
|
|
505
504
|
}, [initialIsVisible, visibleSource, parameter, rules]);
|
|
506
|
-
return isVisible ? /* @__PURE__ */
|
|
505
|
+
return isVisible ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, children) : null;
|
|
507
506
|
};
|
|
508
507
|
export {
|
|
509
508
|
ClientContextTestTransfer,
|
package/dist/index.js
CHANGED
|
@@ -53,10 +53,12 @@ var import_react3 = require("react");
|
|
|
53
53
|
var import_react = require("react");
|
|
54
54
|
var useStableValue = (value, isValid) => {
|
|
55
55
|
const previousRef = (0, import_react.useRef)(null);
|
|
56
|
+
const isValidRef = (0, import_react.useRef)(isValid);
|
|
56
57
|
const [stableValue, setStableValue] = (0, import_react.useState)(void 0);
|
|
58
|
+
isValidRef.current = isValid;
|
|
57
59
|
(0, import_react.useEffect)(() => {
|
|
58
60
|
const serialized = JSON.stringify(value);
|
|
59
|
-
const valid =
|
|
61
|
+
const valid = isValidRef.current ? isValidRef.current(value) : true;
|
|
60
62
|
if (serialized !== previousRef.current && valid) {
|
|
61
63
|
previousRef.current = serialized;
|
|
62
64
|
setStableValue(value);
|
|
@@ -116,7 +118,7 @@ var ClientContextTestTransfer = ({ event }) => {
|
|
|
116
118
|
|
|
117
119
|
// src/components/ClientUniformText.tsx
|
|
118
120
|
var import_canvas = require("@uniformdev/canvas");
|
|
119
|
-
var import_react5 = require("react");
|
|
121
|
+
var import_react5 = __toESM(require("react"));
|
|
120
122
|
|
|
121
123
|
// src/hooks/useQuirks.ts
|
|
122
124
|
var import_react4 = require("react");
|
|
@@ -141,7 +143,6 @@ function useQuirks() {
|
|
|
141
143
|
}
|
|
142
144
|
|
|
143
145
|
// src/components/ClientUniformText.tsx
|
|
144
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
145
146
|
var ClientUniformText = ({
|
|
146
147
|
as,
|
|
147
148
|
component,
|
|
@@ -183,10 +184,10 @@ var ClientUniformText = ({
|
|
|
183
184
|
const parameterId = parameter.parameterId;
|
|
184
185
|
const isContextualEditing = Boolean(parameter._contextualEditing);
|
|
185
186
|
if (!isContextualEditing) {
|
|
186
|
-
return /* @__PURE__ */
|
|
187
|
+
return /* @__PURE__ */ import_react5.default.createElement(Tag, { style: isMultiline ? { whiteSpace: "pre-wrap" } : {}, ...props }, render(currentValue));
|
|
187
188
|
}
|
|
188
189
|
const computedPlaceholder = typeof placeholder === "function" ? placeholder({ id: parameterId }) : placeholder;
|
|
189
|
-
return /* @__PURE__ */
|
|
190
|
+
return /* @__PURE__ */ import_react5.default.createElement(
|
|
190
191
|
Tag,
|
|
191
192
|
{
|
|
192
193
|
...props,
|
|
@@ -198,9 +199,9 @@ var ClientUniformText = ({
|
|
|
198
199
|
}),
|
|
199
200
|
"data-uniform-parameter-type": "text",
|
|
200
201
|
"data-uniform-placeholder": computedPlaceholder,
|
|
201
|
-
style: isMultiline ? { whiteSpace: "pre-wrap" } : {}
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
style: isMultiline ? { whiteSpace: "pre-wrap" } : {}
|
|
203
|
+
},
|
|
204
|
+
isContextualEditing ? currentValue : render(currentValue)
|
|
204
205
|
);
|
|
205
206
|
};
|
|
206
207
|
var getParameterAttributes = ({
|
|
@@ -240,7 +241,7 @@ var ContextUpdateTransfer = ({ update }) => {
|
|
|
240
241
|
};
|
|
241
242
|
|
|
242
243
|
// src/components/DefaultUniformClientContext.tsx
|
|
243
|
-
var
|
|
244
|
+
var import_context2 = require("@uniformdev/context");
|
|
244
245
|
var import_navigation2 = require("next/navigation");
|
|
245
246
|
|
|
246
247
|
// src/context/createUniformContext.ts
|
|
@@ -273,7 +274,6 @@ var createClientUniformContext = (options) => {
|
|
|
273
274
|
};
|
|
274
275
|
|
|
275
276
|
// src/hooks/useInitUniformContext.ts
|
|
276
|
-
var import_context2 = require("@uniformdev/context");
|
|
277
277
|
var import_next_app_router_shared = require("@uniformdev/next-app-router-shared");
|
|
278
278
|
var import_js_cookie = __toESM(require("js-cookie"));
|
|
279
279
|
var import_navigation = require("next/navigation");
|
|
@@ -286,7 +286,6 @@ var useInitUniformContext = (callback, compositionMetadata) => {
|
|
|
286
286
|
context.current = callback();
|
|
287
287
|
}
|
|
288
288
|
(0, import_react7.useEffect)(() => {
|
|
289
|
-
var _a;
|
|
290
289
|
if (typeof window === "undefined" || typeof window.__UNIFORM_CONTEXT__ !== "undefined") {
|
|
291
290
|
return;
|
|
292
291
|
}
|
|
@@ -294,15 +293,20 @@ var useInitUniformContext = (callback, compositionMetadata) => {
|
|
|
294
293
|
searchParams.forEach((value, key) => {
|
|
295
294
|
url.searchParams.set(key, value);
|
|
296
295
|
});
|
|
297
|
-
const scoreCookie = import_js_cookie.default.get(import_next_app_router_shared.UNIFORM_MIDDLEWARE_SCORE_COOKIE_NAME);
|
|
298
296
|
const quirkCookie = import_js_cookie.default.get(import_next_app_router_shared.UNIFORM_MIDDLEWARE_QUIRK_COOKIE_NAME);
|
|
299
|
-
|
|
300
|
-
|
|
297
|
+
let quirks = void 0;
|
|
298
|
+
if (quirkCookie) {
|
|
299
|
+
try {
|
|
300
|
+
quirks = JSON.parse(quirkCookie);
|
|
301
|
+
} catch (error) {
|
|
302
|
+
console.error("Error parsing quirk cookie", error);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
301
305
|
import_js_cookie.default.remove(import_next_app_router_shared.UNIFORM_MIDDLEWARE_QUIRK_COOKIE_NAME);
|
|
302
306
|
context.current.update({
|
|
303
307
|
url,
|
|
304
308
|
compositionMetadata,
|
|
305
|
-
quirks:
|
|
309
|
+
quirks: quirks != null ? quirks : {}
|
|
306
310
|
});
|
|
307
311
|
if (!window.__UNIFORM_CONTEXT__) {
|
|
308
312
|
window.__UNIFORM_CONTEXT__ = context.current;
|
|
@@ -323,7 +327,7 @@ var DefaultUniformClientContext = ({
|
|
|
323
327
|
const plugins = [];
|
|
324
328
|
if (!disableDevTools) {
|
|
325
329
|
plugins.push(
|
|
326
|
-
(0,
|
|
330
|
+
(0, import_context2.enableContextDevTools)({
|
|
327
331
|
onAfterMessageReceived: () => {
|
|
328
332
|
router.refresh();
|
|
329
333
|
}
|
|
@@ -433,7 +437,6 @@ var Personalize = ({
|
|
|
433
437
|
var import_canvas3 = require("@uniformdev/canvas");
|
|
434
438
|
var import_navigation3 = require("next/navigation");
|
|
435
439
|
var import_react10 = require("react");
|
|
436
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
437
440
|
var UniformScript = () => {
|
|
438
441
|
const router = (0, import_navigation3.useRouter)();
|
|
439
442
|
const needsToRefreshRef = (0, import_react10.useRef)(false);
|
|
@@ -498,13 +501,12 @@ var UniformScript = () => {
|
|
|
498
501
|
document.removeEventListener("focus", handleBlurChange, true);
|
|
499
502
|
};
|
|
500
503
|
}, [router]);
|
|
501
|
-
return
|
|
504
|
+
return null;
|
|
502
505
|
};
|
|
503
506
|
|
|
504
507
|
// src/components/VisibilityRulesWrapperClient.tsx
|
|
505
508
|
var import_canvas4 = require("@uniformdev/canvas");
|
|
506
|
-
var import_react11 = require("react");
|
|
507
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
509
|
+
var import_react11 = __toESM(require("react"));
|
|
508
510
|
var VisibilityRulesWrapperClient = ({
|
|
509
511
|
parameter,
|
|
510
512
|
initialIsVisible,
|
|
@@ -531,7 +533,7 @@ var VisibilityRulesWrapperClient = ({
|
|
|
531
533
|
setIsVisible(result);
|
|
532
534
|
setVisibleSource("client");
|
|
533
535
|
}, [initialIsVisible, visibleSource, parameter, rules]);
|
|
534
|
-
return isVisible ? /* @__PURE__ */
|
|
536
|
+
return isVisible ? /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, children) : null;
|
|
535
537
|
};
|
|
536
538
|
// Annotate the CommonJS export names for ESM import in node:
|
|
537
539
|
0 && (module.exports = {
|
package/dist/index.mjs
CHANGED
|
@@ -7,10 +7,12 @@ import { useEffect as useEffect3 } from "react";
|
|
|
7
7
|
import { useEffect, useRef, useState } from "react";
|
|
8
8
|
var useStableValue = (value, isValid) => {
|
|
9
9
|
const previousRef = useRef(null);
|
|
10
|
+
const isValidRef = useRef(isValid);
|
|
10
11
|
const [stableValue, setStableValue] = useState(void 0);
|
|
12
|
+
isValidRef.current = isValid;
|
|
11
13
|
useEffect(() => {
|
|
12
14
|
const serialized = JSON.stringify(value);
|
|
13
|
-
const valid =
|
|
15
|
+
const valid = isValidRef.current ? isValidRef.current(value) : true;
|
|
14
16
|
if (serialized !== previousRef.current && valid) {
|
|
15
17
|
previousRef.current = serialized;
|
|
16
18
|
setStableValue(value);
|
|
@@ -79,7 +81,7 @@ import {
|
|
|
79
81
|
createQuirksVisibilityRule,
|
|
80
82
|
evaluatePropertyCriteria
|
|
81
83
|
} from "@uniformdev/canvas";
|
|
82
|
-
import { useMemo } from "react";
|
|
84
|
+
import React, { useMemo } from "react";
|
|
83
85
|
|
|
84
86
|
// src/hooks/useQuirks.ts
|
|
85
87
|
import { useEffect as useEffect4, useState as useState3 } from "react";
|
|
@@ -104,7 +106,6 @@ function useQuirks() {
|
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
// src/components/ClientUniformText.tsx
|
|
107
|
-
import { jsx } from "react/jsx-runtime";
|
|
108
109
|
var ClientUniformText = ({
|
|
109
110
|
as,
|
|
110
111
|
component,
|
|
@@ -146,10 +147,10 @@ var ClientUniformText = ({
|
|
|
146
147
|
const parameterId = parameter.parameterId;
|
|
147
148
|
const isContextualEditing = Boolean(parameter._contextualEditing);
|
|
148
149
|
if (!isContextualEditing) {
|
|
149
|
-
return /* @__PURE__ */
|
|
150
|
+
return /* @__PURE__ */ React.createElement(Tag, { style: isMultiline ? { whiteSpace: "pre-wrap" } : {}, ...props }, render(currentValue));
|
|
150
151
|
}
|
|
151
152
|
const computedPlaceholder = typeof placeholder === "function" ? placeholder({ id: parameterId }) : placeholder;
|
|
152
|
-
return /* @__PURE__ */
|
|
153
|
+
return /* @__PURE__ */ React.createElement(
|
|
153
154
|
Tag,
|
|
154
155
|
{
|
|
155
156
|
...props,
|
|
@@ -161,9 +162,9 @@ var ClientUniformText = ({
|
|
|
161
162
|
}),
|
|
162
163
|
"data-uniform-parameter-type": "text",
|
|
163
164
|
"data-uniform-placeholder": computedPlaceholder,
|
|
164
|
-
style: isMultiline ? { whiteSpace: "pre-wrap" } : {}
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
style: isMultiline ? { whiteSpace: "pre-wrap" } : {}
|
|
166
|
+
},
|
|
167
|
+
isContextualEditing ? currentValue : render(currentValue)
|
|
167
168
|
);
|
|
168
169
|
};
|
|
169
170
|
var getParameterAttributes = ({
|
|
@@ -239,11 +240,7 @@ var createClientUniformContext = (options) => {
|
|
|
239
240
|
};
|
|
240
241
|
|
|
241
242
|
// src/hooks/useInitUniformContext.ts
|
|
242
|
-
import {
|
|
243
|
-
import {
|
|
244
|
-
UNIFORM_MIDDLEWARE_QUIRK_COOKIE_NAME,
|
|
245
|
-
UNIFORM_MIDDLEWARE_SCORE_COOKIE_NAME
|
|
246
|
-
} from "@uniformdev/next-app-router-shared";
|
|
243
|
+
import { UNIFORM_MIDDLEWARE_QUIRK_COOKIE_NAME } from "@uniformdev/next-app-router-shared";
|
|
247
244
|
import Cookies from "js-cookie";
|
|
248
245
|
import { usePathname, useSearchParams } from "next/navigation";
|
|
249
246
|
import { useEffect as useEffect6, useRef as useRef3 } from "react";
|
|
@@ -255,7 +252,6 @@ var useInitUniformContext = (callback, compositionMetadata) => {
|
|
|
255
252
|
context.current = callback();
|
|
256
253
|
}
|
|
257
254
|
useEffect6(() => {
|
|
258
|
-
var _a;
|
|
259
255
|
if (typeof window === "undefined" || typeof window.__UNIFORM_CONTEXT__ !== "undefined") {
|
|
260
256
|
return;
|
|
261
257
|
}
|
|
@@ -263,15 +259,20 @@ var useInitUniformContext = (callback, compositionMetadata) => {
|
|
|
263
259
|
searchParams.forEach((value, key) => {
|
|
264
260
|
url.searchParams.set(key, value);
|
|
265
261
|
});
|
|
266
|
-
const scoreCookie = Cookies.get(UNIFORM_MIDDLEWARE_SCORE_COOKIE_NAME);
|
|
267
262
|
const quirkCookie = Cookies.get(UNIFORM_MIDDLEWARE_QUIRK_COOKIE_NAME);
|
|
268
|
-
|
|
269
|
-
|
|
263
|
+
let quirks = void 0;
|
|
264
|
+
if (quirkCookie) {
|
|
265
|
+
try {
|
|
266
|
+
quirks = JSON.parse(quirkCookie);
|
|
267
|
+
} catch (error) {
|
|
268
|
+
console.error("Error parsing quirk cookie", error);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
270
271
|
Cookies.remove(UNIFORM_MIDDLEWARE_QUIRK_COOKIE_NAME);
|
|
271
272
|
context.current.update({
|
|
272
273
|
url,
|
|
273
274
|
compositionMetadata,
|
|
274
|
-
quirks:
|
|
275
|
+
quirks: quirks != null ? quirks : {}
|
|
275
276
|
});
|
|
276
277
|
if (!window.__UNIFORM_CONTEXT__) {
|
|
277
278
|
window.__UNIFORM_CONTEXT__ = context.current;
|
|
@@ -402,7 +403,6 @@ var Personalize = ({
|
|
|
402
403
|
import { createCanvasChannel, isAllowedReferrer } from "@uniformdev/canvas";
|
|
403
404
|
import { useRouter as useRouter2 } from "next/navigation";
|
|
404
405
|
import { useEffect as useEffect9, useMemo as useMemo3, useRef as useRef4 } from "react";
|
|
405
|
-
import { Fragment as Fragment2, jsx as jsx2 } from "react/jsx-runtime";
|
|
406
406
|
var UniformScript = () => {
|
|
407
407
|
const router = useRouter2();
|
|
408
408
|
const needsToRefreshRef = useRef4(false);
|
|
@@ -467,7 +467,7 @@ var UniformScript = () => {
|
|
|
467
467
|
document.removeEventListener("focus", handleBlurChange, true);
|
|
468
468
|
};
|
|
469
469
|
}, [router]);
|
|
470
|
-
return
|
|
470
|
+
return null;
|
|
471
471
|
};
|
|
472
472
|
|
|
473
473
|
// src/components/VisibilityRulesWrapperClient.tsx
|
|
@@ -475,8 +475,7 @@ import {
|
|
|
475
475
|
createQuirksVisibilityRule as createQuirksVisibilityRule2,
|
|
476
476
|
evaluateNodeVisibilityParameter
|
|
477
477
|
} from "@uniformdev/canvas";
|
|
478
|
-
import { useEffect as useEffect10, useMemo as useMemo4, useState as useState6 } from "react";
|
|
479
|
-
import { Fragment as Fragment3, jsx as jsx3 } from "react/jsx-runtime";
|
|
478
|
+
import React2, { useEffect as useEffect10, useMemo as useMemo4, useState as useState6 } from "react";
|
|
480
479
|
var VisibilityRulesWrapperClient = ({
|
|
481
480
|
parameter,
|
|
482
481
|
initialIsVisible,
|
|
@@ -503,7 +502,7 @@ var VisibilityRulesWrapperClient = ({
|
|
|
503
502
|
setIsVisible(result);
|
|
504
503
|
setVisibleSource("client");
|
|
505
504
|
}, [initialIsVisible, visibleSource, parameter, rules]);
|
|
506
|
-
return isVisible ? /* @__PURE__ */
|
|
505
|
+
return isVisible ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, children) : null;
|
|
507
506
|
};
|
|
508
507
|
export {
|
|
509
508
|
ClientContextTestTransfer,
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/next-app-router-client",
|
|
3
|
-
"version": "20.7.1-alpha.
|
|
3
|
+
"version": "20.7.1-alpha.134+97fe4134d7",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
7
7
|
"dev": "tsup --watch",
|
|
8
8
|
"lint": "eslint \"src/**/*.{ts,tsx}\" --fix",
|
|
9
|
-
"test": "
|
|
9
|
+
"test": "vitest --passWithNoTests"
|
|
10
10
|
},
|
|
11
11
|
"sideEffects": false,
|
|
12
12
|
"main": "./dist/index.js",
|
|
@@ -31,13 +31,15 @@
|
|
|
31
31
|
"next": "16.0.7",
|
|
32
32
|
"react": "19.2.0",
|
|
33
33
|
"react-dom": "19.2.0",
|
|
34
|
-
"typescript": "5.9.2"
|
|
34
|
+
"typescript": "5.9.2",
|
|
35
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
36
|
+
"vitest": "3.2.4"
|
|
35
37
|
},
|
|
36
38
|
"dependencies": {
|
|
37
|
-
"@uniformdev/canvas": "20.7.1-alpha.
|
|
38
|
-
"@uniformdev/canvas-react": "20.7.1-alpha.
|
|
39
|
-
"@uniformdev/context": "20.7.1-alpha.
|
|
40
|
-
"@uniformdev/next-app-router-shared": "20.7.1-alpha.
|
|
39
|
+
"@uniformdev/canvas": "20.7.1-alpha.134+97fe4134d7",
|
|
40
|
+
"@uniformdev/canvas-react": "20.7.1-alpha.134+97fe4134d7",
|
|
41
|
+
"@uniformdev/context": "20.7.1-alpha.134+97fe4134d7",
|
|
42
|
+
"@uniformdev/next-app-router-shared": "20.7.1-alpha.134+97fe4134d7",
|
|
41
43
|
"js-cookie": "3.0.5"
|
|
42
44
|
},
|
|
43
45
|
"engines": {
|
|
@@ -51,5 +53,5 @@
|
|
|
51
53
|
"publishConfig": {
|
|
52
54
|
"access": "public"
|
|
53
55
|
},
|
|
54
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "97fe4134d72fb8c0b3a3432e1a6a410fdedeedb4"
|
|
55
57
|
}
|