@uniformdev/next-app-router-client 20.50.1-alpha.2 → 20.50.1-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/index.d.mts +2 -16
- package/dist/index.d.ts +2 -16
- package/dist/index.esm.js +28 -62
- package/dist/index.js +55 -88
- package/dist/index.mjs +28 -62
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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 {
|
|
4
|
+
import { ComponentContext, ComponentParameter, PersonalizeProps } from '@uniformdev/next-app-router-shared';
|
|
5
5
|
import { VisibilityParameterValue } from '@uniformdev/canvas';
|
|
6
6
|
import * as _uniformdev_context__ from '@uniformdev/context/*';
|
|
7
7
|
|
|
@@ -36,20 +36,6 @@ declare const ClientContextTestTransfer: ({ event }: {
|
|
|
36
36
|
event: TestEvent;
|
|
37
37
|
}) => null;
|
|
38
38
|
|
|
39
|
-
type ClientTestProps = {
|
|
40
|
-
slots: Record<string, SlotDefinition>;
|
|
41
|
-
test: ExtractTestResult;
|
|
42
|
-
context: CompositionContext;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Client-side A/B test component used when the server skipped test evaluation
|
|
46
|
-
* (e.g. during prefetch). Evaluates the test on the client using the visitor's
|
|
47
|
-
* stored variant or rolling a new one, ensuring consistent assignment across pages.
|
|
48
|
-
*/
|
|
49
|
-
declare const ClientTest: ({ slots, test, context: compositionContext }: ClientTestProps) => React.FunctionComponentElement<{
|
|
50
|
-
children?: React.ReactNode | undefined;
|
|
51
|
-
}>;
|
|
52
|
-
|
|
53
39
|
type ClientUniformTextProps = {
|
|
54
40
|
/**
|
|
55
41
|
* The name of the HTML tag to render.
|
|
@@ -139,4 +125,4 @@ declare const useUniformContext: () => {
|
|
|
139
125
|
context: Context | undefined;
|
|
140
126
|
};
|
|
141
127
|
|
|
142
|
-
export { type ClientContextComponent, type ClientContextComponentProps, ClientContextTestTransfer,
|
|
128
|
+
export { type ClientContextComponent, type ClientContextComponentProps, ClientContextTestTransfer, ClientUniformText, type ClientUniformTextProps, ContextUpdateTransfer, DefaultUniformClientContext, Personalize, UniformScript, VisibilityRulesWrapperClient, createClientUniformContext, useInitUniformContext, useQuirks, useScores, useUniformContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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 {
|
|
4
|
+
import { ComponentContext, ComponentParameter, PersonalizeProps } from '@uniformdev/next-app-router-shared';
|
|
5
5
|
import { VisibilityParameterValue } from '@uniformdev/canvas';
|
|
6
6
|
import * as _uniformdev_context__ from '@uniformdev/context/*';
|
|
7
7
|
|
|
@@ -36,20 +36,6 @@ declare const ClientContextTestTransfer: ({ event }: {
|
|
|
36
36
|
event: TestEvent;
|
|
37
37
|
}) => null;
|
|
38
38
|
|
|
39
|
-
type ClientTestProps = {
|
|
40
|
-
slots: Record<string, SlotDefinition>;
|
|
41
|
-
test: ExtractTestResult;
|
|
42
|
-
context: CompositionContext;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Client-side A/B test component used when the server skipped test evaluation
|
|
46
|
-
* (e.g. during prefetch). Evaluates the test on the client using the visitor's
|
|
47
|
-
* stored variant or rolling a new one, ensuring consistent assignment across pages.
|
|
48
|
-
*/
|
|
49
|
-
declare const ClientTest: ({ slots, test, context: compositionContext }: ClientTestProps) => React.FunctionComponentElement<{
|
|
50
|
-
children?: React.ReactNode | undefined;
|
|
51
|
-
}>;
|
|
52
|
-
|
|
53
39
|
type ClientUniformTextProps = {
|
|
54
40
|
/**
|
|
55
41
|
* The name of the HTML tag to render.
|
|
@@ -139,4 +125,4 @@ declare const useUniformContext: () => {
|
|
|
139
125
|
context: Context | undefined;
|
|
140
126
|
};
|
|
141
127
|
|
|
142
|
-
export { type ClientContextComponent, type ClientContextComponentProps, ClientContextTestTransfer,
|
|
128
|
+
export { type ClientContextComponent, type ClientContextComponentProps, ClientContextTestTransfer, ClientUniformText, type ClientUniformTextProps, ContextUpdateTransfer, DefaultUniformClientContext, Personalize, UniformScript, VisibilityRulesWrapperClient, createClientUniformContext, useInitUniformContext, useQuirks, useScores, useUniformContext };
|
package/dist/index.esm.js
CHANGED
|
@@ -70,39 +70,6 @@ var ClientContextTestTransfer = ({ event }) => {
|
|
|
70
70
|
return null;
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
// src/components/ClientTest.tsx
|
|
74
|
-
import { CANVAS_TEST_SLOT } from "@uniformdev/canvas";
|
|
75
|
-
import {
|
|
76
|
-
evaluateTest
|
|
77
|
-
} from "@uniformdev/next-app-router-shared";
|
|
78
|
-
import { createElement, Fragment, useEffect as useEffect4, useMemo, useState as useState3 } from "react";
|
|
79
|
-
var ClientTest = ({ slots, test, context: compositionContext }) => {
|
|
80
|
-
const testSlot = slots[CANVAS_TEST_SLOT];
|
|
81
|
-
const { context } = useUniformContext();
|
|
82
|
-
const [indexToShow, setIndexToShow] = useState3(void 0);
|
|
83
|
-
useEffect4(() => {
|
|
84
|
-
if (!context || !testSlot) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
const { index } = evaluateTest({
|
|
88
|
-
context,
|
|
89
|
-
test,
|
|
90
|
-
compositionContext
|
|
91
|
-
});
|
|
92
|
-
if (index !== null) {
|
|
93
|
-
setIndexToShow(index);
|
|
94
|
-
}
|
|
95
|
-
}, [context, testSlot, test, compositionContext]);
|
|
96
|
-
const slotToShow = useMemo(() => {
|
|
97
|
-
var _a, _b;
|
|
98
|
-
if (typeof indexToShow !== "number" || !testSlot) {
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
return (_b = (_a = testSlot.items[indexToShow]) == null ? void 0 : _a.component) != null ? _b : null;
|
|
102
|
-
}, [indexToShow, testSlot]);
|
|
103
|
-
return createElement(Fragment, void 0, slotToShow);
|
|
104
|
-
};
|
|
105
|
-
|
|
106
73
|
// src/components/ClientUniformText.tsx
|
|
107
74
|
import {
|
|
108
75
|
ATTRIBUTE_COMPONENT_ID,
|
|
@@ -114,15 +81,15 @@ import {
|
|
|
114
81
|
createQuirksVisibilityRule,
|
|
115
82
|
evaluatePropertyCriteria
|
|
116
83
|
} from "@uniformdev/canvas";
|
|
117
|
-
import React, { useMemo
|
|
84
|
+
import React, { useMemo } from "react";
|
|
118
85
|
|
|
119
86
|
// src/hooks/useQuirks.ts
|
|
120
|
-
import { useEffect as
|
|
87
|
+
import { useEffect as useEffect4, useState as useState3 } from "react";
|
|
121
88
|
function useQuirks() {
|
|
122
89
|
var _a;
|
|
123
90
|
const { context } = useUniformContext();
|
|
124
|
-
const [quirks, setQuirks] =
|
|
125
|
-
|
|
91
|
+
const [quirks, setQuirks] = useState3((_a = context == null ? void 0 : context.quirks) != null ? _a : {});
|
|
92
|
+
useEffect4(() => {
|
|
126
93
|
if (!context) {
|
|
127
94
|
return;
|
|
128
95
|
}
|
|
@@ -150,12 +117,12 @@ var ClientUniformText = ({
|
|
|
150
117
|
}) => {
|
|
151
118
|
const parameter = providedParameter;
|
|
152
119
|
const quirks = useQuirks();
|
|
153
|
-
const rules =
|
|
120
|
+
const rules = useMemo(() => {
|
|
154
121
|
return {
|
|
155
122
|
...createQuirksVisibilityRule(quirks)
|
|
156
123
|
};
|
|
157
124
|
}, [quirks]);
|
|
158
|
-
const currentValue =
|
|
125
|
+
const currentValue = useMemo(() => {
|
|
159
126
|
var _a;
|
|
160
127
|
if (!parameter) {
|
|
161
128
|
return void 0;
|
|
@@ -223,12 +190,12 @@ var getParameterAttributes = ({
|
|
|
223
190
|
};
|
|
224
191
|
|
|
225
192
|
// src/components/ContextUpdateTransfer.tsx
|
|
226
|
-
import { useEffect as
|
|
193
|
+
import { useEffect as useEffect5 } from "react";
|
|
227
194
|
var hasKeys = (obj) => Object.keys(obj).length > 0;
|
|
228
195
|
var ContextUpdateTransfer = ({ update }) => {
|
|
229
196
|
const { context } = useUniformContext();
|
|
230
197
|
const stableUpdate = useStableValue(update, hasKeys);
|
|
231
|
-
|
|
198
|
+
useEffect5(() => {
|
|
232
199
|
if (context && stableUpdate) {
|
|
233
200
|
context.update(stableUpdate);
|
|
234
201
|
}
|
|
@@ -276,7 +243,7 @@ var createClientUniformContext = (options) => {
|
|
|
276
243
|
import { UNIFORM_MIDDLEWARE_QUIRK_COOKIE_NAME } from "@uniformdev/next-app-router-shared";
|
|
277
244
|
import Cookies from "js-cookie";
|
|
278
245
|
import { usePathname, useSearchParams } from "next/navigation";
|
|
279
|
-
import { useEffect as
|
|
246
|
+
import { useEffect as useEffect6, useRef as useRef3 } from "react";
|
|
280
247
|
var useInitUniformContext = (callback, compositionMetadata) => {
|
|
281
248
|
const path = usePathname();
|
|
282
249
|
const searchParams = useSearchParams();
|
|
@@ -284,7 +251,7 @@ var useInitUniformContext = (callback, compositionMetadata) => {
|
|
|
284
251
|
if (typeof window !== "undefined" && context.current === void 0) {
|
|
285
252
|
context.current = callback();
|
|
286
253
|
}
|
|
287
|
-
|
|
254
|
+
useEffect6(() => {
|
|
288
255
|
if (typeof window === "undefined" || typeof window.__UNIFORM_CONTEXT__ !== "undefined") {
|
|
289
256
|
return;
|
|
290
257
|
}
|
|
@@ -346,14 +313,14 @@ var DefaultUniformClientContext = ({
|
|
|
346
313
|
// src/components/Personalize.tsx
|
|
347
314
|
import { CANVAS_PERSONALIZE_SLOT } from "@uniformdev/canvas";
|
|
348
315
|
import { evaluatePersonalization } from "@uniformdev/next-app-router-shared";
|
|
349
|
-
import { createElement
|
|
316
|
+
import { createElement, Fragment, useEffect as useEffect8, useMemo as useMemo2, useState as useState5 } from "react";
|
|
350
317
|
|
|
351
318
|
// src/hooks/useScores.ts
|
|
352
|
-
import { useEffect as
|
|
319
|
+
import { useEffect as useEffect7, useState as useState4 } from "react";
|
|
353
320
|
function useScores() {
|
|
354
321
|
const { context } = useUniformContext();
|
|
355
|
-
const [scores, setScores] =
|
|
356
|
-
|
|
322
|
+
const [scores, setScores] = useState4(context == null ? void 0 : context.scores);
|
|
323
|
+
useEffect7(() => {
|
|
357
324
|
if (!context) {
|
|
358
325
|
return;
|
|
359
326
|
}
|
|
@@ -383,8 +350,8 @@ var Personalize = ({
|
|
|
383
350
|
const { context } = useUniformContext();
|
|
384
351
|
const scores = useScores();
|
|
385
352
|
const quirks = useQuirks();
|
|
386
|
-
const [indexesToShow, setIndexesToShow] =
|
|
387
|
-
|
|
353
|
+
const [indexesToShow, setIndexesToShow] = useState5(indexes);
|
|
354
|
+
useEffect8(() => {
|
|
388
355
|
if (typeof context === "undefined" || !personalizationSlot) {
|
|
389
356
|
return;
|
|
390
357
|
}
|
|
@@ -423,23 +390,23 @@ var Personalize = ({
|
|
|
423
390
|
quirks,
|
|
424
391
|
indexesToShow
|
|
425
392
|
]);
|
|
426
|
-
const slotsToShow =
|
|
393
|
+
const slotsToShow = useMemo2(() => {
|
|
427
394
|
return indexesToShow.map((key) => {
|
|
428
395
|
var _a2;
|
|
429
396
|
return (_a2 = personalizationSlot == null ? void 0 : personalizationSlot.items[key]) == null ? void 0 : _a2.component;
|
|
430
397
|
});
|
|
431
398
|
}, [indexesToShow, personalizationSlot]);
|
|
432
|
-
return
|
|
399
|
+
return createElement(Fragment, void 0, slotsToShow);
|
|
433
400
|
};
|
|
434
401
|
|
|
435
402
|
// src/components/UniformScript.tsx
|
|
436
403
|
import { createCanvasChannel, isAllowedReferrer } from "@uniformdev/canvas";
|
|
437
404
|
import { useRouter as useRouter2 } from "next/navigation";
|
|
438
|
-
import { useEffect as
|
|
405
|
+
import { useEffect as useEffect9, useMemo as useMemo3, useRef as useRef4 } from "react";
|
|
439
406
|
var UniformScript = () => {
|
|
440
407
|
const router = useRouter2();
|
|
441
408
|
const needsToRefreshRef = useRef4(false);
|
|
442
|
-
const channel =
|
|
409
|
+
const channel = useMemo3(() => {
|
|
443
410
|
var _a;
|
|
444
411
|
if (typeof window === "undefined") {
|
|
445
412
|
return;
|
|
@@ -450,7 +417,7 @@ var UniformScript = () => {
|
|
|
450
417
|
});
|
|
451
418
|
return instance;
|
|
452
419
|
}, []);
|
|
453
|
-
|
|
420
|
+
useEffect9(() => {
|
|
454
421
|
if (!channel) {
|
|
455
422
|
return;
|
|
456
423
|
}
|
|
@@ -467,7 +434,7 @@ var UniformScript = () => {
|
|
|
467
434
|
unsubscribeFromEditorUpdates();
|
|
468
435
|
};
|
|
469
436
|
}, [channel, router]);
|
|
470
|
-
|
|
437
|
+
useEffect9(() => {
|
|
471
438
|
if (typeof window === "undefined") {
|
|
472
439
|
return;
|
|
473
440
|
}
|
|
@@ -488,7 +455,7 @@ var UniformScript = () => {
|
|
|
488
455
|
document.head.appendChild(script);
|
|
489
456
|
}
|
|
490
457
|
}, []);
|
|
491
|
-
|
|
458
|
+
useEffect9(() => {
|
|
492
459
|
const handleBlurChange = () => {
|
|
493
460
|
if (needsToRefreshRef.current) {
|
|
494
461
|
router.refresh();
|
|
@@ -508,23 +475,23 @@ import {
|
|
|
508
475
|
createQuirksVisibilityRule as createQuirksVisibilityRule2,
|
|
509
476
|
evaluateNodeVisibilityParameter
|
|
510
477
|
} from "@uniformdev/canvas";
|
|
511
|
-
import React2, { useEffect as
|
|
478
|
+
import React2, { useEffect as useEffect10, useMemo as useMemo4, useState as useState6 } from "react";
|
|
512
479
|
var VisibilityRulesWrapperClient = ({
|
|
513
480
|
parameter,
|
|
514
481
|
initialIsVisible,
|
|
515
482
|
children
|
|
516
483
|
}) => {
|
|
517
|
-
const [isVisible, setIsVisible] =
|
|
518
|
-
const [visibleSource, setVisibleSource] =
|
|
484
|
+
const [isVisible, setIsVisible] = useState6(initialIsVisible);
|
|
485
|
+
const [visibleSource, setVisibleSource] = useState6(
|
|
519
486
|
initialIsVisible === null ? "unknown" : "server"
|
|
520
487
|
);
|
|
521
488
|
const quirks = useQuirks();
|
|
522
|
-
const rules =
|
|
489
|
+
const rules = useMemo4(() => {
|
|
523
490
|
return {
|
|
524
491
|
...createQuirksVisibilityRule2(quirks)
|
|
525
492
|
};
|
|
526
493
|
}, [quirks]);
|
|
527
|
-
|
|
494
|
+
useEffect10(() => {
|
|
528
495
|
const result = evaluateNodeVisibilityParameter({
|
|
529
496
|
rules,
|
|
530
497
|
parameter
|
|
@@ -539,7 +506,6 @@ var VisibilityRulesWrapperClient = ({
|
|
|
539
506
|
};
|
|
540
507
|
export {
|
|
541
508
|
ClientContextTestTransfer,
|
|
542
|
-
ClientTest,
|
|
543
509
|
ClientUniformText,
|
|
544
510
|
ContextUpdateTransfer,
|
|
545
511
|
DefaultUniformClientContext,
|
package/dist/index.js
CHANGED
|
@@ -32,7 +32,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
32
32
|
var src_exports = {};
|
|
33
33
|
__export(src_exports, {
|
|
34
34
|
ClientContextTestTransfer: () => ClientContextTestTransfer,
|
|
35
|
-
ClientTest: () => ClientTest,
|
|
36
35
|
ClientUniformText: () => ClientUniformText,
|
|
37
36
|
ContextUpdateTransfer: () => ContextUpdateTransfer,
|
|
38
37
|
DefaultUniformClientContext: () => DefaultUniformClientContext,
|
|
@@ -117,48 +116,17 @@ var ClientContextTestTransfer = ({ event }) => {
|
|
|
117
116
|
return null;
|
|
118
117
|
};
|
|
119
118
|
|
|
120
|
-
// src/components/ClientTest.tsx
|
|
121
|
-
var import_canvas = require("@uniformdev/canvas");
|
|
122
|
-
var import_next_app_router_shared = require("@uniformdev/next-app-router-shared");
|
|
123
|
-
var import_react4 = require("react");
|
|
124
|
-
var ClientTest = ({ slots, test, context: compositionContext }) => {
|
|
125
|
-
const testSlot = slots[import_canvas.CANVAS_TEST_SLOT];
|
|
126
|
-
const { context } = useUniformContext();
|
|
127
|
-
const [indexToShow, setIndexToShow] = (0, import_react4.useState)(void 0);
|
|
128
|
-
(0, import_react4.useEffect)(() => {
|
|
129
|
-
if (!context || !testSlot) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
const { index } = (0, import_next_app_router_shared.evaluateTest)({
|
|
133
|
-
context,
|
|
134
|
-
test,
|
|
135
|
-
compositionContext
|
|
136
|
-
});
|
|
137
|
-
if (index !== null) {
|
|
138
|
-
setIndexToShow(index);
|
|
139
|
-
}
|
|
140
|
-
}, [context, testSlot, test, compositionContext]);
|
|
141
|
-
const slotToShow = (0, import_react4.useMemo)(() => {
|
|
142
|
-
var _a, _b;
|
|
143
|
-
if (typeof indexToShow !== "number" || !testSlot) {
|
|
144
|
-
return null;
|
|
145
|
-
}
|
|
146
|
-
return (_b = (_a = testSlot.items[indexToShow]) == null ? void 0 : _a.component) != null ? _b : null;
|
|
147
|
-
}, [indexToShow, testSlot]);
|
|
148
|
-
return (0, import_react4.createElement)(import_react4.Fragment, void 0, slotToShow);
|
|
149
|
-
};
|
|
150
|
-
|
|
151
119
|
// src/components/ClientUniformText.tsx
|
|
152
|
-
var
|
|
153
|
-
var
|
|
120
|
+
var import_canvas = require("@uniformdev/canvas");
|
|
121
|
+
var import_react5 = __toESM(require("react"));
|
|
154
122
|
|
|
155
123
|
// src/hooks/useQuirks.ts
|
|
156
|
-
var
|
|
124
|
+
var import_react4 = require("react");
|
|
157
125
|
function useQuirks() {
|
|
158
126
|
var _a;
|
|
159
127
|
const { context } = useUniformContext();
|
|
160
|
-
const [quirks, setQuirks] = (0,
|
|
161
|
-
(0,
|
|
128
|
+
const [quirks, setQuirks] = (0, import_react4.useState)((_a = context == null ? void 0 : context.quirks) != null ? _a : {});
|
|
129
|
+
(0, import_react4.useEffect)(() => {
|
|
162
130
|
if (!context) {
|
|
163
131
|
return;
|
|
164
132
|
}
|
|
@@ -186,12 +154,12 @@ var ClientUniformText = ({
|
|
|
186
154
|
}) => {
|
|
187
155
|
const parameter = providedParameter;
|
|
188
156
|
const quirks = useQuirks();
|
|
189
|
-
const rules = (0,
|
|
157
|
+
const rules = (0, import_react5.useMemo)(() => {
|
|
190
158
|
return {
|
|
191
|
-
...(0,
|
|
159
|
+
...(0, import_canvas.createQuirksVisibilityRule)(quirks)
|
|
192
160
|
};
|
|
193
161
|
}, [quirks]);
|
|
194
|
-
const currentValue = (0,
|
|
162
|
+
const currentValue = (0, import_react5.useMemo)(() => {
|
|
195
163
|
var _a;
|
|
196
164
|
if (!parameter) {
|
|
197
165
|
return void 0;
|
|
@@ -199,7 +167,7 @@ var ClientUniformText = ({
|
|
|
199
167
|
if (!rules.length || !((_a = parameter.conditions) == null ? void 0 : _a.length)) {
|
|
200
168
|
return parameter.value;
|
|
201
169
|
}
|
|
202
|
-
const match = (0,
|
|
170
|
+
const match = (0, import_canvas.evaluatePropertyCriteria)({
|
|
203
171
|
baseValue: parameter.value,
|
|
204
172
|
conditionalValues: parameter.conditions,
|
|
205
173
|
rules
|
|
@@ -216,10 +184,10 @@ var ClientUniformText = ({
|
|
|
216
184
|
const parameterId = parameter.parameterId;
|
|
217
185
|
const isContextualEditing = Boolean(parameter._contextualEditing);
|
|
218
186
|
if (!isContextualEditing) {
|
|
219
|
-
return /* @__PURE__ */
|
|
187
|
+
return /* @__PURE__ */ import_react5.default.createElement(Tag, { style: isMultiline ? { whiteSpace: "pre-wrap" } : {}, ...props }, render(currentValue));
|
|
220
188
|
}
|
|
221
189
|
const computedPlaceholder = typeof placeholder === "function" ? placeholder({ id: parameterId }) : placeholder;
|
|
222
|
-
return /* @__PURE__ */
|
|
190
|
+
return /* @__PURE__ */ import_react5.default.createElement(
|
|
223
191
|
Tag,
|
|
224
192
|
{
|
|
225
193
|
...props,
|
|
@@ -247,24 +215,24 @@ var getParameterAttributes = ({
|
|
|
247
215
|
const type = parameter == null ? void 0 : parameter.type;
|
|
248
216
|
const isEditable = (_b = (_a = parameter == null ? void 0 : parameter._contextualEditing) == null ? void 0 : _a.isEditable) != null ? _b : false;
|
|
249
217
|
return {
|
|
250
|
-
[
|
|
251
|
-
[
|
|
252
|
-
[
|
|
253
|
-
[
|
|
254
|
-
[
|
|
255
|
-
[
|
|
218
|
+
[import_canvas.ATTRIBUTE_COMPONENT_ID]: component._id,
|
|
219
|
+
[import_canvas.ATTRIBUTE_PARAMETER_ID]: parameter.parameterId,
|
|
220
|
+
[import_canvas.ATTRIBUTE_PARAMETER_VALUE]: String(value != null ? value : ""),
|
|
221
|
+
[import_canvas.ATTRIBUTE_PARAMETER_TYPE]: type,
|
|
222
|
+
[import_canvas.ATTRIBUTE_PLACEHOLDER]: placeholder,
|
|
223
|
+
[import_canvas.ATTRIBUTE_MULTILINE]: isMultiline,
|
|
256
224
|
contentEditable: isEditable,
|
|
257
225
|
suppressContentEditableWarning: true
|
|
258
226
|
};
|
|
259
227
|
};
|
|
260
228
|
|
|
261
229
|
// src/components/ContextUpdateTransfer.tsx
|
|
262
|
-
var
|
|
230
|
+
var import_react6 = require("react");
|
|
263
231
|
var hasKeys = (obj) => Object.keys(obj).length > 0;
|
|
264
232
|
var ContextUpdateTransfer = ({ update }) => {
|
|
265
233
|
const { context } = useUniformContext();
|
|
266
234
|
const stableUpdate = useStableValue(update, hasKeys);
|
|
267
|
-
(0,
|
|
235
|
+
(0, import_react6.useEffect)(() => {
|
|
268
236
|
if (context && stableUpdate) {
|
|
269
237
|
context.update(stableUpdate);
|
|
270
238
|
}
|
|
@@ -306,18 +274,18 @@ var createClientUniformContext = (options) => {
|
|
|
306
274
|
};
|
|
307
275
|
|
|
308
276
|
// src/hooks/useInitUniformContext.ts
|
|
309
|
-
var
|
|
277
|
+
var import_next_app_router_shared = require("@uniformdev/next-app-router-shared");
|
|
310
278
|
var import_js_cookie = __toESM(require("js-cookie"));
|
|
311
279
|
var import_navigation = require("next/navigation");
|
|
312
|
-
var
|
|
280
|
+
var import_react7 = require("react");
|
|
313
281
|
var useInitUniformContext = (callback, compositionMetadata) => {
|
|
314
282
|
const path = (0, import_navigation.usePathname)();
|
|
315
283
|
const searchParams = (0, import_navigation.useSearchParams)();
|
|
316
|
-
const context = (0,
|
|
284
|
+
const context = (0, import_react7.useRef)(void 0);
|
|
317
285
|
if (typeof window !== "undefined" && context.current === void 0) {
|
|
318
286
|
context.current = callback();
|
|
319
287
|
}
|
|
320
|
-
(0,
|
|
288
|
+
(0, import_react7.useEffect)(() => {
|
|
321
289
|
if (typeof window === "undefined" || typeof window.__UNIFORM_CONTEXT__ !== "undefined") {
|
|
322
290
|
return;
|
|
323
291
|
}
|
|
@@ -325,7 +293,7 @@ var useInitUniformContext = (callback, compositionMetadata) => {
|
|
|
325
293
|
searchParams.forEach((value, key) => {
|
|
326
294
|
url.searchParams.set(key, value);
|
|
327
295
|
});
|
|
328
|
-
const quirkCookie = import_js_cookie.default.get(
|
|
296
|
+
const quirkCookie = import_js_cookie.default.get(import_next_app_router_shared.UNIFORM_MIDDLEWARE_QUIRK_COOKIE_NAME);
|
|
329
297
|
let quirks = void 0;
|
|
330
298
|
if (quirkCookie) {
|
|
331
299
|
try {
|
|
@@ -334,7 +302,7 @@ var useInitUniformContext = (callback, compositionMetadata) => {
|
|
|
334
302
|
console.error("Error parsing quirk cookie", error);
|
|
335
303
|
}
|
|
336
304
|
}
|
|
337
|
-
import_js_cookie.default.remove(
|
|
305
|
+
import_js_cookie.default.remove(import_next_app_router_shared.UNIFORM_MIDDLEWARE_QUIRK_COOKIE_NAME);
|
|
338
306
|
context.current.update({
|
|
339
307
|
url,
|
|
340
308
|
compositionMetadata,
|
|
@@ -377,16 +345,16 @@ var DefaultUniformClientContext = ({
|
|
|
377
345
|
};
|
|
378
346
|
|
|
379
347
|
// src/components/Personalize.tsx
|
|
380
|
-
var
|
|
381
|
-
var
|
|
382
|
-
var
|
|
348
|
+
var import_canvas2 = require("@uniformdev/canvas");
|
|
349
|
+
var import_next_app_router_shared2 = require("@uniformdev/next-app-router-shared");
|
|
350
|
+
var import_react9 = require("react");
|
|
383
351
|
|
|
384
352
|
// src/hooks/useScores.ts
|
|
385
|
-
var
|
|
353
|
+
var import_react8 = require("react");
|
|
386
354
|
function useScores() {
|
|
387
355
|
const { context } = useUniformContext();
|
|
388
|
-
const [scores, setScores] = (0,
|
|
389
|
-
(0,
|
|
356
|
+
const [scores, setScores] = (0, import_react8.useState)(context == null ? void 0 : context.scores);
|
|
357
|
+
(0, import_react8.useEffect)(() => {
|
|
390
358
|
if (!context) {
|
|
391
359
|
return;
|
|
392
360
|
}
|
|
@@ -412,16 +380,16 @@ var Personalize = ({
|
|
|
412
380
|
var _a, _b;
|
|
413
381
|
const trackingEventName = (_a = parameters.trackingEventName) == null ? void 0 : _a.value;
|
|
414
382
|
const algorithm = (_b = parameters.algorithm) == null ? void 0 : _b.value;
|
|
415
|
-
const personalizationSlot = slots[
|
|
383
|
+
const personalizationSlot = slots[import_canvas2.CANVAS_PERSONALIZE_SLOT];
|
|
416
384
|
const { context } = useUniformContext();
|
|
417
385
|
const scores = useScores();
|
|
418
386
|
const quirks = useQuirks();
|
|
419
|
-
const [indexesToShow, setIndexesToShow] = (0,
|
|
420
|
-
(0,
|
|
387
|
+
const [indexesToShow, setIndexesToShow] = (0, import_react9.useState)(indexes);
|
|
388
|
+
(0, import_react9.useEffect)(() => {
|
|
421
389
|
if (typeof context === "undefined" || !personalizationSlot) {
|
|
422
390
|
return;
|
|
423
391
|
}
|
|
424
|
-
const result = (0,
|
|
392
|
+
const result = (0, import_next_app_router_shared2.evaluatePersonalization)({
|
|
425
393
|
context,
|
|
426
394
|
compositionContext,
|
|
427
395
|
personalization: {
|
|
@@ -456,34 +424,34 @@ var Personalize = ({
|
|
|
456
424
|
quirks,
|
|
457
425
|
indexesToShow
|
|
458
426
|
]);
|
|
459
|
-
const slotsToShow = (0,
|
|
427
|
+
const slotsToShow = (0, import_react9.useMemo)(() => {
|
|
460
428
|
return indexesToShow.map((key) => {
|
|
461
429
|
var _a2;
|
|
462
430
|
return (_a2 = personalizationSlot == null ? void 0 : personalizationSlot.items[key]) == null ? void 0 : _a2.component;
|
|
463
431
|
});
|
|
464
432
|
}, [indexesToShow, personalizationSlot]);
|
|
465
|
-
return (0,
|
|
433
|
+
return (0, import_react9.createElement)(import_react9.Fragment, void 0, slotsToShow);
|
|
466
434
|
};
|
|
467
435
|
|
|
468
436
|
// src/components/UniformScript.tsx
|
|
469
|
-
var
|
|
437
|
+
var import_canvas3 = require("@uniformdev/canvas");
|
|
470
438
|
var import_navigation3 = require("next/navigation");
|
|
471
|
-
var
|
|
439
|
+
var import_react10 = require("react");
|
|
472
440
|
var UniformScript = () => {
|
|
473
441
|
const router = (0, import_navigation3.useRouter)();
|
|
474
|
-
const needsToRefreshRef = (0,
|
|
475
|
-
const channel = (0,
|
|
442
|
+
const needsToRefreshRef = (0, import_react10.useRef)(false);
|
|
443
|
+
const channel = (0, import_react10.useMemo)(() => {
|
|
476
444
|
var _a;
|
|
477
445
|
if (typeof window === "undefined") {
|
|
478
446
|
return;
|
|
479
447
|
}
|
|
480
|
-
const instance = (0,
|
|
448
|
+
const instance = (0, import_canvas3.createCanvasChannel)({
|
|
481
449
|
broadcastTo: [(_a = window.opener) != null ? _a : window.top],
|
|
482
450
|
listenTo: [window]
|
|
483
451
|
});
|
|
484
452
|
return instance;
|
|
485
453
|
}, []);
|
|
486
|
-
(0,
|
|
454
|
+
(0, import_react10.useEffect)(() => {
|
|
487
455
|
if (!channel) {
|
|
488
456
|
return;
|
|
489
457
|
}
|
|
@@ -500,13 +468,13 @@ var UniformScript = () => {
|
|
|
500
468
|
unsubscribeFromEditorUpdates();
|
|
501
469
|
};
|
|
502
470
|
}, [channel, router]);
|
|
503
|
-
(0,
|
|
471
|
+
(0, import_react10.useEffect)(() => {
|
|
504
472
|
if (typeof window === "undefined") {
|
|
505
473
|
return;
|
|
506
474
|
}
|
|
507
475
|
const existing = document.getElementById("uniform-script");
|
|
508
476
|
if (!existing) {
|
|
509
|
-
const textHost = (0,
|
|
477
|
+
const textHost = (0, import_canvas3.isAllowedReferrer)(window.document.referrer) ? window.document.referrer : "https://uniform.app/";
|
|
510
478
|
window.__UNIFORM_CONTEXTUAL_EDITING__ = {
|
|
511
479
|
framework: "React",
|
|
512
480
|
version: 2
|
|
@@ -521,7 +489,7 @@ var UniformScript = () => {
|
|
|
521
489
|
document.head.appendChild(script);
|
|
522
490
|
}
|
|
523
491
|
}, []);
|
|
524
|
-
(0,
|
|
492
|
+
(0, import_react10.useEffect)(() => {
|
|
525
493
|
const handleBlurChange = () => {
|
|
526
494
|
if (needsToRefreshRef.current) {
|
|
527
495
|
router.refresh();
|
|
@@ -537,25 +505,25 @@ var UniformScript = () => {
|
|
|
537
505
|
};
|
|
538
506
|
|
|
539
507
|
// src/components/VisibilityRulesWrapperClient.tsx
|
|
540
|
-
var
|
|
541
|
-
var
|
|
508
|
+
var import_canvas4 = require("@uniformdev/canvas");
|
|
509
|
+
var import_react11 = __toESM(require("react"));
|
|
542
510
|
var VisibilityRulesWrapperClient = ({
|
|
543
511
|
parameter,
|
|
544
512
|
initialIsVisible,
|
|
545
513
|
children
|
|
546
514
|
}) => {
|
|
547
|
-
const [isVisible, setIsVisible] = (0,
|
|
548
|
-
const [visibleSource, setVisibleSource] = (0,
|
|
515
|
+
const [isVisible, setIsVisible] = (0, import_react11.useState)(initialIsVisible);
|
|
516
|
+
const [visibleSource, setVisibleSource] = (0, import_react11.useState)(
|
|
549
517
|
initialIsVisible === null ? "unknown" : "server"
|
|
550
518
|
);
|
|
551
519
|
const quirks = useQuirks();
|
|
552
|
-
const rules = (0,
|
|
520
|
+
const rules = (0, import_react11.useMemo)(() => {
|
|
553
521
|
return {
|
|
554
|
-
...(0,
|
|
522
|
+
...(0, import_canvas4.createQuirksVisibilityRule)(quirks)
|
|
555
523
|
};
|
|
556
524
|
}, [quirks]);
|
|
557
|
-
(0,
|
|
558
|
-
const result = (0,
|
|
525
|
+
(0, import_react11.useEffect)(() => {
|
|
526
|
+
const result = (0, import_canvas4.evaluateNodeVisibilityParameter)({
|
|
559
527
|
rules,
|
|
560
528
|
parameter
|
|
561
529
|
});
|
|
@@ -565,12 +533,11 @@ var VisibilityRulesWrapperClient = ({
|
|
|
565
533
|
setIsVisible(result);
|
|
566
534
|
setVisibleSource("client");
|
|
567
535
|
}, [initialIsVisible, visibleSource, parameter, rules]);
|
|
568
|
-
return isVisible ? /* @__PURE__ */
|
|
536
|
+
return isVisible ? /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, children) : null;
|
|
569
537
|
};
|
|
570
538
|
// Annotate the CommonJS export names for ESM import in node:
|
|
571
539
|
0 && (module.exports = {
|
|
572
540
|
ClientContextTestTransfer,
|
|
573
|
-
ClientTest,
|
|
574
541
|
ClientUniformText,
|
|
575
542
|
ContextUpdateTransfer,
|
|
576
543
|
DefaultUniformClientContext,
|
package/dist/index.mjs
CHANGED
|
@@ -70,39 +70,6 @@ var ClientContextTestTransfer = ({ event }) => {
|
|
|
70
70
|
return null;
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
// src/components/ClientTest.tsx
|
|
74
|
-
import { CANVAS_TEST_SLOT } from "@uniformdev/canvas";
|
|
75
|
-
import {
|
|
76
|
-
evaluateTest
|
|
77
|
-
} from "@uniformdev/next-app-router-shared";
|
|
78
|
-
import { createElement, Fragment, useEffect as useEffect4, useMemo, useState as useState3 } from "react";
|
|
79
|
-
var ClientTest = ({ slots, test, context: compositionContext }) => {
|
|
80
|
-
const testSlot = slots[CANVAS_TEST_SLOT];
|
|
81
|
-
const { context } = useUniformContext();
|
|
82
|
-
const [indexToShow, setIndexToShow] = useState3(void 0);
|
|
83
|
-
useEffect4(() => {
|
|
84
|
-
if (!context || !testSlot) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
const { index } = evaluateTest({
|
|
88
|
-
context,
|
|
89
|
-
test,
|
|
90
|
-
compositionContext
|
|
91
|
-
});
|
|
92
|
-
if (index !== null) {
|
|
93
|
-
setIndexToShow(index);
|
|
94
|
-
}
|
|
95
|
-
}, [context, testSlot, test, compositionContext]);
|
|
96
|
-
const slotToShow = useMemo(() => {
|
|
97
|
-
var _a, _b;
|
|
98
|
-
if (typeof indexToShow !== "number" || !testSlot) {
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
return (_b = (_a = testSlot.items[indexToShow]) == null ? void 0 : _a.component) != null ? _b : null;
|
|
102
|
-
}, [indexToShow, testSlot]);
|
|
103
|
-
return createElement(Fragment, void 0, slotToShow);
|
|
104
|
-
};
|
|
105
|
-
|
|
106
73
|
// src/components/ClientUniformText.tsx
|
|
107
74
|
import {
|
|
108
75
|
ATTRIBUTE_COMPONENT_ID,
|
|
@@ -114,15 +81,15 @@ import {
|
|
|
114
81
|
createQuirksVisibilityRule,
|
|
115
82
|
evaluatePropertyCriteria
|
|
116
83
|
} from "@uniformdev/canvas";
|
|
117
|
-
import React, { useMemo
|
|
84
|
+
import React, { useMemo } from "react";
|
|
118
85
|
|
|
119
86
|
// src/hooks/useQuirks.ts
|
|
120
|
-
import { useEffect as
|
|
87
|
+
import { useEffect as useEffect4, useState as useState3 } from "react";
|
|
121
88
|
function useQuirks() {
|
|
122
89
|
var _a;
|
|
123
90
|
const { context } = useUniformContext();
|
|
124
|
-
const [quirks, setQuirks] =
|
|
125
|
-
|
|
91
|
+
const [quirks, setQuirks] = useState3((_a = context == null ? void 0 : context.quirks) != null ? _a : {});
|
|
92
|
+
useEffect4(() => {
|
|
126
93
|
if (!context) {
|
|
127
94
|
return;
|
|
128
95
|
}
|
|
@@ -150,12 +117,12 @@ var ClientUniformText = ({
|
|
|
150
117
|
}) => {
|
|
151
118
|
const parameter = providedParameter;
|
|
152
119
|
const quirks = useQuirks();
|
|
153
|
-
const rules =
|
|
120
|
+
const rules = useMemo(() => {
|
|
154
121
|
return {
|
|
155
122
|
...createQuirksVisibilityRule(quirks)
|
|
156
123
|
};
|
|
157
124
|
}, [quirks]);
|
|
158
|
-
const currentValue =
|
|
125
|
+
const currentValue = useMemo(() => {
|
|
159
126
|
var _a;
|
|
160
127
|
if (!parameter) {
|
|
161
128
|
return void 0;
|
|
@@ -223,12 +190,12 @@ var getParameterAttributes = ({
|
|
|
223
190
|
};
|
|
224
191
|
|
|
225
192
|
// src/components/ContextUpdateTransfer.tsx
|
|
226
|
-
import { useEffect as
|
|
193
|
+
import { useEffect as useEffect5 } from "react";
|
|
227
194
|
var hasKeys = (obj) => Object.keys(obj).length > 0;
|
|
228
195
|
var ContextUpdateTransfer = ({ update }) => {
|
|
229
196
|
const { context } = useUniformContext();
|
|
230
197
|
const stableUpdate = useStableValue(update, hasKeys);
|
|
231
|
-
|
|
198
|
+
useEffect5(() => {
|
|
232
199
|
if (context && stableUpdate) {
|
|
233
200
|
context.update(stableUpdate);
|
|
234
201
|
}
|
|
@@ -276,7 +243,7 @@ var createClientUniformContext = (options) => {
|
|
|
276
243
|
import { UNIFORM_MIDDLEWARE_QUIRK_COOKIE_NAME } from "@uniformdev/next-app-router-shared";
|
|
277
244
|
import Cookies from "js-cookie";
|
|
278
245
|
import { usePathname, useSearchParams } from "next/navigation";
|
|
279
|
-
import { useEffect as
|
|
246
|
+
import { useEffect as useEffect6, useRef as useRef3 } from "react";
|
|
280
247
|
var useInitUniformContext = (callback, compositionMetadata) => {
|
|
281
248
|
const path = usePathname();
|
|
282
249
|
const searchParams = useSearchParams();
|
|
@@ -284,7 +251,7 @@ var useInitUniformContext = (callback, compositionMetadata) => {
|
|
|
284
251
|
if (typeof window !== "undefined" && context.current === void 0) {
|
|
285
252
|
context.current = callback();
|
|
286
253
|
}
|
|
287
|
-
|
|
254
|
+
useEffect6(() => {
|
|
288
255
|
if (typeof window === "undefined" || typeof window.__UNIFORM_CONTEXT__ !== "undefined") {
|
|
289
256
|
return;
|
|
290
257
|
}
|
|
@@ -346,14 +313,14 @@ var DefaultUniformClientContext = ({
|
|
|
346
313
|
// src/components/Personalize.tsx
|
|
347
314
|
import { CANVAS_PERSONALIZE_SLOT } from "@uniformdev/canvas";
|
|
348
315
|
import { evaluatePersonalization } from "@uniformdev/next-app-router-shared";
|
|
349
|
-
import { createElement
|
|
316
|
+
import { createElement, Fragment, useEffect as useEffect8, useMemo as useMemo2, useState as useState5 } from "react";
|
|
350
317
|
|
|
351
318
|
// src/hooks/useScores.ts
|
|
352
|
-
import { useEffect as
|
|
319
|
+
import { useEffect as useEffect7, useState as useState4 } from "react";
|
|
353
320
|
function useScores() {
|
|
354
321
|
const { context } = useUniformContext();
|
|
355
|
-
const [scores, setScores] =
|
|
356
|
-
|
|
322
|
+
const [scores, setScores] = useState4(context == null ? void 0 : context.scores);
|
|
323
|
+
useEffect7(() => {
|
|
357
324
|
if (!context) {
|
|
358
325
|
return;
|
|
359
326
|
}
|
|
@@ -383,8 +350,8 @@ var Personalize = ({
|
|
|
383
350
|
const { context } = useUniformContext();
|
|
384
351
|
const scores = useScores();
|
|
385
352
|
const quirks = useQuirks();
|
|
386
|
-
const [indexesToShow, setIndexesToShow] =
|
|
387
|
-
|
|
353
|
+
const [indexesToShow, setIndexesToShow] = useState5(indexes);
|
|
354
|
+
useEffect8(() => {
|
|
388
355
|
if (typeof context === "undefined" || !personalizationSlot) {
|
|
389
356
|
return;
|
|
390
357
|
}
|
|
@@ -423,23 +390,23 @@ var Personalize = ({
|
|
|
423
390
|
quirks,
|
|
424
391
|
indexesToShow
|
|
425
392
|
]);
|
|
426
|
-
const slotsToShow =
|
|
393
|
+
const slotsToShow = useMemo2(() => {
|
|
427
394
|
return indexesToShow.map((key) => {
|
|
428
395
|
var _a2;
|
|
429
396
|
return (_a2 = personalizationSlot == null ? void 0 : personalizationSlot.items[key]) == null ? void 0 : _a2.component;
|
|
430
397
|
});
|
|
431
398
|
}, [indexesToShow, personalizationSlot]);
|
|
432
|
-
return
|
|
399
|
+
return createElement(Fragment, void 0, slotsToShow);
|
|
433
400
|
};
|
|
434
401
|
|
|
435
402
|
// src/components/UniformScript.tsx
|
|
436
403
|
import { createCanvasChannel, isAllowedReferrer } from "@uniformdev/canvas";
|
|
437
404
|
import { useRouter as useRouter2 } from "next/navigation";
|
|
438
|
-
import { useEffect as
|
|
405
|
+
import { useEffect as useEffect9, useMemo as useMemo3, useRef as useRef4 } from "react";
|
|
439
406
|
var UniformScript = () => {
|
|
440
407
|
const router = useRouter2();
|
|
441
408
|
const needsToRefreshRef = useRef4(false);
|
|
442
|
-
const channel =
|
|
409
|
+
const channel = useMemo3(() => {
|
|
443
410
|
var _a;
|
|
444
411
|
if (typeof window === "undefined") {
|
|
445
412
|
return;
|
|
@@ -450,7 +417,7 @@ var UniformScript = () => {
|
|
|
450
417
|
});
|
|
451
418
|
return instance;
|
|
452
419
|
}, []);
|
|
453
|
-
|
|
420
|
+
useEffect9(() => {
|
|
454
421
|
if (!channel) {
|
|
455
422
|
return;
|
|
456
423
|
}
|
|
@@ -467,7 +434,7 @@ var UniformScript = () => {
|
|
|
467
434
|
unsubscribeFromEditorUpdates();
|
|
468
435
|
};
|
|
469
436
|
}, [channel, router]);
|
|
470
|
-
|
|
437
|
+
useEffect9(() => {
|
|
471
438
|
if (typeof window === "undefined") {
|
|
472
439
|
return;
|
|
473
440
|
}
|
|
@@ -488,7 +455,7 @@ var UniformScript = () => {
|
|
|
488
455
|
document.head.appendChild(script);
|
|
489
456
|
}
|
|
490
457
|
}, []);
|
|
491
|
-
|
|
458
|
+
useEffect9(() => {
|
|
492
459
|
const handleBlurChange = () => {
|
|
493
460
|
if (needsToRefreshRef.current) {
|
|
494
461
|
router.refresh();
|
|
@@ -508,23 +475,23 @@ import {
|
|
|
508
475
|
createQuirksVisibilityRule as createQuirksVisibilityRule2,
|
|
509
476
|
evaluateNodeVisibilityParameter
|
|
510
477
|
} from "@uniformdev/canvas";
|
|
511
|
-
import React2, { useEffect as
|
|
478
|
+
import React2, { useEffect as useEffect10, useMemo as useMemo4, useState as useState6 } from "react";
|
|
512
479
|
var VisibilityRulesWrapperClient = ({
|
|
513
480
|
parameter,
|
|
514
481
|
initialIsVisible,
|
|
515
482
|
children
|
|
516
483
|
}) => {
|
|
517
|
-
const [isVisible, setIsVisible] =
|
|
518
|
-
const [visibleSource, setVisibleSource] =
|
|
484
|
+
const [isVisible, setIsVisible] = useState6(initialIsVisible);
|
|
485
|
+
const [visibleSource, setVisibleSource] = useState6(
|
|
519
486
|
initialIsVisible === null ? "unknown" : "server"
|
|
520
487
|
);
|
|
521
488
|
const quirks = useQuirks();
|
|
522
|
-
const rules =
|
|
489
|
+
const rules = useMemo4(() => {
|
|
523
490
|
return {
|
|
524
491
|
...createQuirksVisibilityRule2(quirks)
|
|
525
492
|
};
|
|
526
493
|
}, [quirks]);
|
|
527
|
-
|
|
494
|
+
useEffect10(() => {
|
|
528
495
|
const result = evaluateNodeVisibilityParameter({
|
|
529
496
|
rules,
|
|
530
497
|
parameter
|
|
@@ -539,7 +506,6 @@ var VisibilityRulesWrapperClient = ({
|
|
|
539
506
|
};
|
|
540
507
|
export {
|
|
541
508
|
ClientContextTestTransfer,
|
|
542
|
-
ClientTest,
|
|
543
509
|
ClientUniformText,
|
|
544
510
|
ContextUpdateTransfer,
|
|
545
511
|
DefaultUniformClientContext,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/next-app-router-client",
|
|
3
|
-
"version": "20.50.1-alpha.
|
|
3
|
+
"version": "20.50.1-alpha.4+47395e9a74",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"vitest": "3.2.4"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@uniformdev/canvas": "20.50.1-alpha.
|
|
40
|
-
"@uniformdev/canvas-react": "20.50.1-alpha.
|
|
41
|
-
"@uniformdev/context": "20.50.1-alpha.
|
|
42
|
-
"@uniformdev/next-app-router-shared": "20.50.1-alpha.
|
|
39
|
+
"@uniformdev/canvas": "20.50.1-alpha.4+47395e9a74",
|
|
40
|
+
"@uniformdev/canvas-react": "20.50.1-alpha.4+47395e9a74",
|
|
41
|
+
"@uniformdev/context": "20.50.1-alpha.4+47395e9a74",
|
|
42
|
+
"@uniformdev/next-app-router-shared": "20.50.1-alpha.4+47395e9a74",
|
|
43
43
|
"js-cookie": "3.0.5"
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "47395e9a74fd4e2a7a5b4cc6488c7326ad906bf9"
|
|
57
57
|
}
|