@uniformdev/canvas-next-rsc-client 20.6.5-alpha.1 → 20.7.1-alpha.106

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 CHANGED
@@ -1,2 +1,2 @@
1
- © 2024 Uniform Systems, Inc. All Rights Reserved.
1
+ © 2025 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,11 +1,10 @@
1
- import { ManifestV2, TestEvent, Quirks, ScoreVector } from '@uniformdev/context';
1
+ import { ManifestV2, PersonalizationEvent, TestEvent, CompositionMetadata, Quirks, ScoreVector } from '@uniformdev/context';
2
2
  import * as react from 'react';
3
- import { JSX, PropsWithChildren } from 'react';
4
- import { PersonalizationEvent } from '@uniformdev/context/*';
3
+ import { ReactNode, PropsWithChildren } from 'react';
5
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
5
  import { PureContextualEditingComponentWrapperProps } from '@uniformdev/canvas-react/core';
7
6
  import * as _uniformdev_canvas_next_rsc_shared from '@uniformdev/canvas-next-rsc-shared';
8
- import { AppDirectoryContextState, PersonalizeProps, ComponentProps, TestProps, CreateUniformContextOptions, AppDirectoryContext } from '@uniformdev/canvas-next-rsc-shared';
7
+ import { AppDirectoryContextState, ComponentProps, PersonalizeProps, TestProps, CreateUniformContextOptions, AppDirectoryContext } from '@uniformdev/canvas-next-rsc-shared';
9
8
  import { VisibilityParameterValue, ComponentInstance, UpdateContextualEditingStateInternalMessage } from '@uniformdev/canvas';
10
9
 
11
10
  type ClientContextComponentProps = {
@@ -27,7 +26,7 @@ type ClientContextComponentProps = {
27
26
  */
28
27
  experimentalQuirkSerialization: boolean;
29
28
  };
30
- type ClientContextComponent = (props: ClientContextComponentProps) => JSX.Element | null;
29
+ type ClientContextComponent = (props: ClientContextComponentProps) => ReactNode;
31
30
 
32
31
  declare const ClientContextPersonalizationTransfer: ({ event, ts, }: {
33
32
  event: PersonalizationEvent;
@@ -41,8 +40,9 @@ declare const ClientContextTestTransfer: ({ event, ts }: {
41
40
 
42
41
  declare const ClientContextualEditingComponentWrapper: (props: PropsWithChildren<PureContextualEditingComponentWrapperProps>) => react_jsx_runtime.JSX.Element;
43
42
 
44
- declare const ClientContextUpdate: ({ path }: {
43
+ declare const ClientContextUpdate: ({ path, compositionMetadata, }: {
45
44
  path: string;
45
+ compositionMetadata: CompositionMetadata;
46
46
  }) => react_jsx_runtime.JSX.Element;
47
47
 
48
48
  declare const ContextUpdateTransferClient: ({ update, ts, }: {
@@ -52,11 +52,9 @@ declare const ContextUpdateTransferClient: ({ update, ts, }: {
52
52
 
53
53
  declare const DefaultUniformClientContext: ClientContextComponent;
54
54
 
55
- type PersonalizeClientProps = PersonalizeProps & {
55
+ interface PersonalizeClientProps extends ComponentProps<PersonalizeProps> {
56
56
  indexes: number[];
57
- slots: ComponentProps['slots'];
58
- component: ComponentProps['component'];
59
- };
57
+ }
60
58
  declare const PersonalizeClient: (props: PersonalizeClientProps) => react.FunctionComponentElement<{
61
59
  children?: react.ReactNode | undefined;
62
60
  }>;
package/dist/index.d.ts CHANGED
@@ -1,11 +1,10 @@
1
- import { ManifestV2, TestEvent, Quirks, ScoreVector } from '@uniformdev/context';
1
+ import { ManifestV2, PersonalizationEvent, TestEvent, CompositionMetadata, Quirks, ScoreVector } from '@uniformdev/context';
2
2
  import * as react from 'react';
3
- import { JSX, PropsWithChildren } from 'react';
4
- import { PersonalizationEvent } from '@uniformdev/context/*';
3
+ import { ReactNode, PropsWithChildren } from 'react';
5
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
5
  import { PureContextualEditingComponentWrapperProps } from '@uniformdev/canvas-react/core';
7
6
  import * as _uniformdev_canvas_next_rsc_shared from '@uniformdev/canvas-next-rsc-shared';
8
- import { AppDirectoryContextState, PersonalizeProps, ComponentProps, TestProps, CreateUniformContextOptions, AppDirectoryContext } from '@uniformdev/canvas-next-rsc-shared';
7
+ import { AppDirectoryContextState, ComponentProps, PersonalizeProps, TestProps, CreateUniformContextOptions, AppDirectoryContext } from '@uniformdev/canvas-next-rsc-shared';
9
8
  import { VisibilityParameterValue, ComponentInstance, UpdateContextualEditingStateInternalMessage } from '@uniformdev/canvas';
10
9
 
11
10
  type ClientContextComponentProps = {
@@ -27,7 +26,7 @@ type ClientContextComponentProps = {
27
26
  */
28
27
  experimentalQuirkSerialization: boolean;
29
28
  };
30
- type ClientContextComponent = (props: ClientContextComponentProps) => JSX.Element | null;
29
+ type ClientContextComponent = (props: ClientContextComponentProps) => ReactNode;
31
30
 
32
31
  declare const ClientContextPersonalizationTransfer: ({ event, ts, }: {
33
32
  event: PersonalizationEvent;
@@ -41,8 +40,9 @@ declare const ClientContextTestTransfer: ({ event, ts }: {
41
40
 
42
41
  declare const ClientContextualEditingComponentWrapper: (props: PropsWithChildren<PureContextualEditingComponentWrapperProps>) => react_jsx_runtime.JSX.Element;
43
42
 
44
- declare const ClientContextUpdate: ({ path }: {
43
+ declare const ClientContextUpdate: ({ path, compositionMetadata, }: {
45
44
  path: string;
45
+ compositionMetadata: CompositionMetadata;
46
46
  }) => react_jsx_runtime.JSX.Element;
47
47
 
48
48
  declare const ContextUpdateTransferClient: ({ update, ts, }: {
@@ -52,11 +52,9 @@ declare const ContextUpdateTransferClient: ({ update, ts, }: {
52
52
 
53
53
  declare const DefaultUniformClientContext: ClientContextComponent;
54
54
 
55
- type PersonalizeClientProps = PersonalizeProps & {
55
+ interface PersonalizeClientProps extends ComponentProps<PersonalizeProps> {
56
56
  indexes: number[];
57
- slots: ComponentProps['slots'];
58
- component: ComponentProps['component'];
59
- };
57
+ }
60
58
  declare const PersonalizeClient: (props: PersonalizeClientProps) => react.FunctionComponentElement<{
61
59
  children?: react.ReactNode | undefined;
62
60
  }>;
package/dist/index.esm.js CHANGED
@@ -295,16 +295,24 @@ var ClientContextualEditingComponentWrapperInner = ({
295
295
  };
296
296
 
297
297
  // src/components/ClientContextUpdate.tsx
298
+ import Cookies from "js-cookie";
298
299
  import { useSearchParams as useSearchParams2 } from "next/navigation";
299
300
  import { Suspense as Suspense2, useEffect as useEffect4 } from "react";
300
301
  import { Fragment as Fragment2, jsx as jsx2 } from "react/jsx-runtime";
301
- var ClientContextUpdate = ({ path }) => {
302
- return /* @__PURE__ */ jsx2(Suspense2, { children: /* @__PURE__ */ jsx2(ClientContextUpdateInner, { path }) });
302
+ var ClientContextUpdate = ({
303
+ path,
304
+ compositionMetadata
305
+ }) => {
306
+ return /* @__PURE__ */ jsx2(Suspense2, { children: /* @__PURE__ */ jsx2(ClientContextUpdateInner, { path, compositionMetadata }) });
303
307
  };
304
- var ClientContextUpdateInner = ({ path }) => {
308
+ var ClientContextUpdateInner = ({
309
+ path,
310
+ compositionMetadata
311
+ }) => {
305
312
  const searchParams = useSearchParams2();
306
313
  const { context } = useUniformContext();
307
314
  useEffect4(() => {
315
+ var _a;
308
316
  if (!context || typeof window === "undefined") {
309
317
  return;
310
318
  }
@@ -313,9 +321,11 @@ var ClientContextUpdateInner = ({ path }) => {
313
321
  params: {
314
322
  path: path.split("/").filter(Boolean)
315
323
  },
316
- searchParams: convertedSearchParams
324
+ cookies: (_a = Cookies.get()) != null ? _a : {},
325
+ searchParams: convertedSearchParams,
326
+ compositionMetadata
317
327
  });
318
- }, [path, searchParams, context]);
328
+ }, [path, searchParams, context, compositionMetadata]);
319
329
  return /* @__PURE__ */ jsx2(Fragment2, {});
320
330
  };
321
331
 
@@ -364,105 +374,8 @@ function dequal(foo, bar) {
364
374
  return foo !== foo && bar !== bar;
365
375
  }
366
376
 
367
- // ../../node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.mjs
368
- function assign(target) {
369
- for (var i = 1; i < arguments.length; i++) {
370
- var source = arguments[i];
371
- for (var key in source) {
372
- target[key] = source[key];
373
- }
374
- }
375
- return target;
376
- }
377
- var defaultConverter = {
378
- read: function(value) {
379
- if (value[0] === '"') {
380
- value = value.slice(1, -1);
381
- }
382
- return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
383
- },
384
- write: function(value) {
385
- return encodeURIComponent(value).replace(
386
- /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
387
- decodeURIComponent
388
- );
389
- }
390
- };
391
- function init(converter, defaultAttributes) {
392
- function set(name, value, attributes) {
393
- if (typeof document === "undefined") {
394
- return;
395
- }
396
- attributes = assign({}, defaultAttributes, attributes);
397
- if (typeof attributes.expires === "number") {
398
- attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
399
- }
400
- if (attributes.expires) {
401
- attributes.expires = attributes.expires.toUTCString();
402
- }
403
- name = encodeURIComponent(name).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
404
- var stringifiedAttributes = "";
405
- for (var attributeName in attributes) {
406
- if (!attributes[attributeName]) {
407
- continue;
408
- }
409
- stringifiedAttributes += "; " + attributeName;
410
- if (attributes[attributeName] === true) {
411
- continue;
412
- }
413
- stringifiedAttributes += "=" + attributes[attributeName].split(";")[0];
414
- }
415
- return document.cookie = name + "=" + converter.write(value, name) + stringifiedAttributes;
416
- }
417
- function get(name) {
418
- if (typeof document === "undefined" || arguments.length && !name) {
419
- return;
420
- }
421
- var cookies = document.cookie ? document.cookie.split("; ") : [];
422
- var jar = {};
423
- for (var i = 0; i < cookies.length; i++) {
424
- var parts = cookies[i].split("=");
425
- var value = parts.slice(1).join("=");
426
- try {
427
- var found = decodeURIComponent(parts[0]);
428
- jar[found] = converter.read(value, found);
429
- if (name === found) {
430
- break;
431
- }
432
- } catch (e) {
433
- }
434
- }
435
- return name ? jar[name] : jar;
436
- }
437
- return Object.create(
438
- {
439
- set,
440
- get,
441
- remove: function(name, attributes) {
442
- set(
443
- name,
444
- "",
445
- assign({}, attributes, {
446
- expires: -1
447
- })
448
- );
449
- },
450
- withAttributes: function(attributes) {
451
- return init(this.converter, assign({}, this.attributes, attributes));
452
- },
453
- withConverter: function(converter2) {
454
- return init(assign({}, this.converter, converter2), this.attributes);
455
- }
456
- },
457
- {
458
- attributes: { value: Object.freeze(defaultAttributes) },
459
- converter: { value: Object.freeze(converter) }
460
- }
461
- );
462
- }
463
- var api = init(defaultConverter, { path: "/" });
464
-
465
377
  // ../context/dist/index.mjs
378
+ import Cookies2 from "js-cookie";
466
379
  var import_rfdc = __toESM(require_rfdc(), 1);
467
380
  var import_rfdc2 = __toESM(require_rfdc(), 1);
468
381
  var import_rfdc3 = __toESM(require_rfdc(), 1);
@@ -720,6 +633,7 @@ defaultData_fn = function() {
720
633
  controlGroup: (_c = (_b = __privateGet(this, _options).manifest) == null ? void 0 : _b.rollForControlGroup()) != null ? _c : false
721
634
  };
722
635
  };
636
+ var _personalizationSelectionAlgorithms;
723
637
  var _serverTransitionState;
724
638
  var _scores;
725
639
  var _state;
@@ -733,6 +647,7 @@ var emitTest_fn;
733
647
  var updateGoals_fn;
734
648
  var updateComputedScores_fn;
735
649
  var calculateScores_fn;
650
+ _personalizationSelectionAlgorithms = /* @__PURE__ */ new WeakMap();
736
651
  _serverTransitionState = /* @__PURE__ */ new WeakMap();
737
652
  _scores = /* @__PURE__ */ new WeakMap();
738
653
  _state = /* @__PURE__ */ new WeakMap();
@@ -943,7 +858,6 @@ import { CANVAS_PERSONALIZE_SLOT } from "@uniformdev/canvas";
943
858
  import { runPersonalization } from "@uniformdev/canvas-next-rsc-shared";
944
859
  import { createElement, Fragment as Fragment3, useEffect as useEffect7, useState as useState6 } from "react";
945
860
  var PersonalizeClient = (props) => {
946
- const { slots } = props;
947
861
  const { context } = useUniformContext();
948
862
  const [indexesToShow, setIndexesToShow] = useState6(props.indexes);
949
863
  useEffect7(() => {
@@ -958,14 +872,16 @@ var PersonalizeClient = (props) => {
958
872
  setIndexesToShow(result.indexes);
959
873
  };
960
874
  context.events.on("scoresUpdated", handleRunPersonalization);
875
+ context.events.on("quirksUpdated", handleRunPersonalization);
961
876
  handleRunPersonalization();
962
877
  return () => {
963
878
  context.events.off("scoresUpdated", handleRunPersonalization);
879
+ context.events.off("quirksUpdated", handleRunPersonalization);
964
880
  };
965
881
  }, [props, context]);
966
882
  const slotsToShow = indexesToShow.map((key) => {
967
883
  var _a;
968
- return (_a = slots[CANVAS_PERSONALIZE_SLOT]) == null ? void 0 : _a.items[key];
884
+ return (_a = props.slots[CANVAS_PERSONALIZE_SLOT]) == null ? void 0 : _a.items[key];
969
885
  });
970
886
  return createElement(Fragment3, void 0, slotsToShow);
971
887
  };
@@ -995,7 +911,8 @@ var TestClient = (props) => {
995
911
  import {
996
912
  createCanvasChannel,
997
913
  IN_CONTEXT_EDITOR_QUERY_STRING_PARAM as IN_CONTEXT_EDITOR_QUERY_STRING_PARAM2,
998
- isAllowedReferrer
914
+ isAllowedReferrer,
915
+ version
999
916
  } from "@uniformdev/canvas";
1000
917
  import { useRouter as useRouter2, useSearchParams as useSearchParams3 } from "next/navigation";
1001
918
  import { useEffect as useEffect8, useMemo as useMemo2, useRef } from "react";
@@ -1029,6 +946,9 @@ var UniformScript = () => {
1029
946
  needsToRefreshRef.current = true;
1030
947
  }
1031
948
  });
949
+ channel.ready({
950
+ rsc: true
951
+ });
1032
952
  return () => {
1033
953
  unsubscribeFromEditorUpdates();
1034
954
  };
@@ -1043,7 +963,8 @@ var UniformScript = () => {
1043
963
  const textHost = isAllowedReferrer(window.document.referrer) ? window.document.referrer : "https://uniform.app/";
1044
964
  window.__UNIFORM_CONTEXTUAL_EDITING__ = {
1045
965
  framework: "React",
1046
- version: 2
966
+ version: 2,
967
+ canvasPackageVersion: version
1047
968
  };
1048
969
  const bundleHost = new URL(textHost);
1049
970
  bundleHost.pathname = "/files/canvas-in-context-embed/index.js";
@@ -1212,8 +1133,3 @@ export {
1212
1133
  useUniformContext,
1213
1134
  useUniformContextualEditingState
1214
1135
  };
1215
- /*! Bundled license information:
1216
-
1217
- js-cookie/dist/js.cookie.mjs:
1218
- (*! js-cookie v3.0.5 | MIT *)
1219
- */
package/dist/index.js CHANGED
@@ -321,16 +321,24 @@ var ClientContextualEditingComponentWrapperInner = ({
321
321
  };
322
322
 
323
323
  // src/components/ClientContextUpdate.tsx
324
+ var import_js_cookie = __toESM(require("js-cookie"));
324
325
  var import_navigation2 = require("next/navigation");
325
326
  var import_react5 = require("react");
326
327
  var import_jsx_runtime2 = require("react/jsx-runtime");
327
- var ClientContextUpdate = ({ path }) => {
328
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react5.Suspense, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ClientContextUpdateInner, { path }) });
328
+ var ClientContextUpdate = ({
329
+ path,
330
+ compositionMetadata
331
+ }) => {
332
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react5.Suspense, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ClientContextUpdateInner, { path, compositionMetadata }) });
329
333
  };
330
- var ClientContextUpdateInner = ({ path }) => {
334
+ var ClientContextUpdateInner = ({
335
+ path,
336
+ compositionMetadata
337
+ }) => {
331
338
  const searchParams = (0, import_navigation2.useSearchParams)();
332
339
  const { context } = useUniformContext();
333
340
  (0, import_react5.useEffect)(() => {
341
+ var _a;
334
342
  if (!context || typeof window === "undefined") {
335
343
  return;
336
344
  }
@@ -339,9 +347,11 @@ var ClientContextUpdateInner = ({ path }) => {
339
347
  params: {
340
348
  path: path.split("/").filter(Boolean)
341
349
  },
342
- searchParams: convertedSearchParams
350
+ cookies: (_a = import_js_cookie.default.get()) != null ? _a : {},
351
+ searchParams: convertedSearchParams,
352
+ compositionMetadata
343
353
  });
344
- }, [path, searchParams, context]);
354
+ }, [path, searchParams, context, compositionMetadata]);
345
355
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, {});
346
356
  };
347
357
 
@@ -390,105 +400,8 @@ function dequal(foo, bar) {
390
400
  return foo !== foo && bar !== bar;
391
401
  }
392
402
 
393
- // ../../node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.mjs
394
- function assign(target) {
395
- for (var i = 1; i < arguments.length; i++) {
396
- var source = arguments[i];
397
- for (var key in source) {
398
- target[key] = source[key];
399
- }
400
- }
401
- return target;
402
- }
403
- var defaultConverter = {
404
- read: function(value) {
405
- if (value[0] === '"') {
406
- value = value.slice(1, -1);
407
- }
408
- return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
409
- },
410
- write: function(value) {
411
- return encodeURIComponent(value).replace(
412
- /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
413
- decodeURIComponent
414
- );
415
- }
416
- };
417
- function init(converter, defaultAttributes) {
418
- function set(name, value, attributes) {
419
- if (typeof document === "undefined") {
420
- return;
421
- }
422
- attributes = assign({}, defaultAttributes, attributes);
423
- if (typeof attributes.expires === "number") {
424
- attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
425
- }
426
- if (attributes.expires) {
427
- attributes.expires = attributes.expires.toUTCString();
428
- }
429
- name = encodeURIComponent(name).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
430
- var stringifiedAttributes = "";
431
- for (var attributeName in attributes) {
432
- if (!attributes[attributeName]) {
433
- continue;
434
- }
435
- stringifiedAttributes += "; " + attributeName;
436
- if (attributes[attributeName] === true) {
437
- continue;
438
- }
439
- stringifiedAttributes += "=" + attributes[attributeName].split(";")[0];
440
- }
441
- return document.cookie = name + "=" + converter.write(value, name) + stringifiedAttributes;
442
- }
443
- function get(name) {
444
- if (typeof document === "undefined" || arguments.length && !name) {
445
- return;
446
- }
447
- var cookies = document.cookie ? document.cookie.split("; ") : [];
448
- var jar = {};
449
- for (var i = 0; i < cookies.length; i++) {
450
- var parts = cookies[i].split("=");
451
- var value = parts.slice(1).join("=");
452
- try {
453
- var found = decodeURIComponent(parts[0]);
454
- jar[found] = converter.read(value, found);
455
- if (name === found) {
456
- break;
457
- }
458
- } catch (e) {
459
- }
460
- }
461
- return name ? jar[name] : jar;
462
- }
463
- return Object.create(
464
- {
465
- set,
466
- get,
467
- remove: function(name, attributes) {
468
- set(
469
- name,
470
- "",
471
- assign({}, attributes, {
472
- expires: -1
473
- })
474
- );
475
- },
476
- withAttributes: function(attributes) {
477
- return init(this.converter, assign({}, this.attributes, attributes));
478
- },
479
- withConverter: function(converter2) {
480
- return init(assign({}, this.converter, converter2), this.attributes);
481
- }
482
- },
483
- {
484
- attributes: { value: Object.freeze(defaultAttributes) },
485
- converter: { value: Object.freeze(converter) }
486
- }
487
- );
488
- }
489
- var api = init(defaultConverter, { path: "/" });
490
-
491
403
  // ../context/dist/index.mjs
404
+ var import_js_cookie2 = __toESM(require("js-cookie"), 1);
492
405
  var import_rfdc = __toESM(require_rfdc(), 1);
493
406
  var import_rfdc2 = __toESM(require_rfdc(), 1);
494
407
  var import_rfdc3 = __toESM(require_rfdc(), 1);
@@ -746,6 +659,7 @@ defaultData_fn = function() {
746
659
  controlGroup: (_c = (_b = __privateGet(this, _options).manifest) == null ? void 0 : _b.rollForControlGroup()) != null ? _c : false
747
660
  };
748
661
  };
662
+ var _personalizationSelectionAlgorithms;
749
663
  var _serverTransitionState;
750
664
  var _scores;
751
665
  var _state;
@@ -759,6 +673,7 @@ var emitTest_fn;
759
673
  var updateGoals_fn;
760
674
  var updateComputedScores_fn;
761
675
  var calculateScores_fn;
676
+ _personalizationSelectionAlgorithms = /* @__PURE__ */ new WeakMap();
762
677
  _serverTransitionState = /* @__PURE__ */ new WeakMap();
763
678
  _scores = /* @__PURE__ */ new WeakMap();
764
679
  _state = /* @__PURE__ */ new WeakMap();
@@ -969,7 +884,6 @@ var import_canvas2 = require("@uniformdev/canvas");
969
884
  var import_canvas_next_rsc_shared2 = require("@uniformdev/canvas-next-rsc-shared");
970
885
  var import_react8 = require("react");
971
886
  var PersonalizeClient = (props) => {
972
- const { slots } = props;
973
887
  const { context } = useUniformContext();
974
888
  const [indexesToShow, setIndexesToShow] = (0, import_react8.useState)(props.indexes);
975
889
  (0, import_react8.useEffect)(() => {
@@ -984,14 +898,16 @@ var PersonalizeClient = (props) => {
984
898
  setIndexesToShow(result.indexes);
985
899
  };
986
900
  context.events.on("scoresUpdated", handleRunPersonalization);
901
+ context.events.on("quirksUpdated", handleRunPersonalization);
987
902
  handleRunPersonalization();
988
903
  return () => {
989
904
  context.events.off("scoresUpdated", handleRunPersonalization);
905
+ context.events.off("quirksUpdated", handleRunPersonalization);
990
906
  };
991
907
  }, [props, context]);
992
908
  const slotsToShow = indexesToShow.map((key) => {
993
909
  var _a;
994
- return (_a = slots[import_canvas2.CANVAS_PERSONALIZE_SLOT]) == null ? void 0 : _a.items[key];
910
+ return (_a = props.slots[import_canvas2.CANVAS_PERSONALIZE_SLOT]) == null ? void 0 : _a.items[key];
995
911
  });
996
912
  return (0, import_react8.createElement)(import_react8.Fragment, void 0, slotsToShow);
997
913
  };
@@ -1051,6 +967,9 @@ var UniformScript = () => {
1051
967
  needsToRefreshRef.current = true;
1052
968
  }
1053
969
  });
970
+ channel.ready({
971
+ rsc: true
972
+ });
1054
973
  return () => {
1055
974
  unsubscribeFromEditorUpdates();
1056
975
  };
@@ -1065,7 +984,8 @@ var UniformScript = () => {
1065
984
  const textHost = (0, import_canvas4.isAllowedReferrer)(window.document.referrer) ? window.document.referrer : "https://uniform.app/";
1066
985
  window.__UNIFORM_CONTEXTUAL_EDITING__ = {
1067
986
  framework: "React",
1068
- version: 2
987
+ version: 2,
988
+ canvasPackageVersion: import_canvas4.version
1069
989
  };
1070
990
  const bundleHost = new URL(textHost);
1071
991
  bundleHost.pathname = "/files/canvas-in-context-embed/index.js";
@@ -1229,8 +1149,3 @@ var useUniformContextualEditingState = ({
1229
1149
  useUniformContext,
1230
1150
  useUniformContextualEditingState
1231
1151
  });
1232
- /*! Bundled license information:
1233
-
1234
- js-cookie/dist/js.cookie.mjs:
1235
- (*! js-cookie v3.0.5 | MIT *)
1236
- */
package/dist/index.mjs CHANGED
@@ -295,16 +295,24 @@ var ClientContextualEditingComponentWrapperInner = ({
295
295
  };
296
296
 
297
297
  // src/components/ClientContextUpdate.tsx
298
+ import Cookies from "js-cookie";
298
299
  import { useSearchParams as useSearchParams2 } from "next/navigation";
299
300
  import { Suspense as Suspense2, useEffect as useEffect4 } from "react";
300
301
  import { Fragment as Fragment2, jsx as jsx2 } from "react/jsx-runtime";
301
- var ClientContextUpdate = ({ path }) => {
302
- return /* @__PURE__ */ jsx2(Suspense2, { children: /* @__PURE__ */ jsx2(ClientContextUpdateInner, { path }) });
302
+ var ClientContextUpdate = ({
303
+ path,
304
+ compositionMetadata
305
+ }) => {
306
+ return /* @__PURE__ */ jsx2(Suspense2, { children: /* @__PURE__ */ jsx2(ClientContextUpdateInner, { path, compositionMetadata }) });
303
307
  };
304
- var ClientContextUpdateInner = ({ path }) => {
308
+ var ClientContextUpdateInner = ({
309
+ path,
310
+ compositionMetadata
311
+ }) => {
305
312
  const searchParams = useSearchParams2();
306
313
  const { context } = useUniformContext();
307
314
  useEffect4(() => {
315
+ var _a;
308
316
  if (!context || typeof window === "undefined") {
309
317
  return;
310
318
  }
@@ -313,9 +321,11 @@ var ClientContextUpdateInner = ({ path }) => {
313
321
  params: {
314
322
  path: path.split("/").filter(Boolean)
315
323
  },
316
- searchParams: convertedSearchParams
324
+ cookies: (_a = Cookies.get()) != null ? _a : {},
325
+ searchParams: convertedSearchParams,
326
+ compositionMetadata
317
327
  });
318
- }, [path, searchParams, context]);
328
+ }, [path, searchParams, context, compositionMetadata]);
319
329
  return /* @__PURE__ */ jsx2(Fragment2, {});
320
330
  };
321
331
 
@@ -364,105 +374,8 @@ function dequal(foo, bar) {
364
374
  return foo !== foo && bar !== bar;
365
375
  }
366
376
 
367
- // ../../node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.mjs
368
- function assign(target) {
369
- for (var i = 1; i < arguments.length; i++) {
370
- var source = arguments[i];
371
- for (var key in source) {
372
- target[key] = source[key];
373
- }
374
- }
375
- return target;
376
- }
377
- var defaultConverter = {
378
- read: function(value) {
379
- if (value[0] === '"') {
380
- value = value.slice(1, -1);
381
- }
382
- return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
383
- },
384
- write: function(value) {
385
- return encodeURIComponent(value).replace(
386
- /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
387
- decodeURIComponent
388
- );
389
- }
390
- };
391
- function init(converter, defaultAttributes) {
392
- function set(name, value, attributes) {
393
- if (typeof document === "undefined") {
394
- return;
395
- }
396
- attributes = assign({}, defaultAttributes, attributes);
397
- if (typeof attributes.expires === "number") {
398
- attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
399
- }
400
- if (attributes.expires) {
401
- attributes.expires = attributes.expires.toUTCString();
402
- }
403
- name = encodeURIComponent(name).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
404
- var stringifiedAttributes = "";
405
- for (var attributeName in attributes) {
406
- if (!attributes[attributeName]) {
407
- continue;
408
- }
409
- stringifiedAttributes += "; " + attributeName;
410
- if (attributes[attributeName] === true) {
411
- continue;
412
- }
413
- stringifiedAttributes += "=" + attributes[attributeName].split(";")[0];
414
- }
415
- return document.cookie = name + "=" + converter.write(value, name) + stringifiedAttributes;
416
- }
417
- function get(name) {
418
- if (typeof document === "undefined" || arguments.length && !name) {
419
- return;
420
- }
421
- var cookies = document.cookie ? document.cookie.split("; ") : [];
422
- var jar = {};
423
- for (var i = 0; i < cookies.length; i++) {
424
- var parts = cookies[i].split("=");
425
- var value = parts.slice(1).join("=");
426
- try {
427
- var found = decodeURIComponent(parts[0]);
428
- jar[found] = converter.read(value, found);
429
- if (name === found) {
430
- break;
431
- }
432
- } catch (e) {
433
- }
434
- }
435
- return name ? jar[name] : jar;
436
- }
437
- return Object.create(
438
- {
439
- set,
440
- get,
441
- remove: function(name, attributes) {
442
- set(
443
- name,
444
- "",
445
- assign({}, attributes, {
446
- expires: -1
447
- })
448
- );
449
- },
450
- withAttributes: function(attributes) {
451
- return init(this.converter, assign({}, this.attributes, attributes));
452
- },
453
- withConverter: function(converter2) {
454
- return init(assign({}, this.converter, converter2), this.attributes);
455
- }
456
- },
457
- {
458
- attributes: { value: Object.freeze(defaultAttributes) },
459
- converter: { value: Object.freeze(converter) }
460
- }
461
- );
462
- }
463
- var api = init(defaultConverter, { path: "/" });
464
-
465
377
  // ../context/dist/index.mjs
378
+ import Cookies2 from "js-cookie";
466
379
  var import_rfdc = __toESM(require_rfdc(), 1);
467
380
  var import_rfdc2 = __toESM(require_rfdc(), 1);
468
381
  var import_rfdc3 = __toESM(require_rfdc(), 1);
@@ -720,6 +633,7 @@ defaultData_fn = function() {
720
633
  controlGroup: (_c = (_b = __privateGet(this, _options).manifest) == null ? void 0 : _b.rollForControlGroup()) != null ? _c : false
721
634
  };
722
635
  };
636
+ var _personalizationSelectionAlgorithms;
723
637
  var _serverTransitionState;
724
638
  var _scores;
725
639
  var _state;
@@ -733,6 +647,7 @@ var emitTest_fn;
733
647
  var updateGoals_fn;
734
648
  var updateComputedScores_fn;
735
649
  var calculateScores_fn;
650
+ _personalizationSelectionAlgorithms = /* @__PURE__ */ new WeakMap();
736
651
  _serverTransitionState = /* @__PURE__ */ new WeakMap();
737
652
  _scores = /* @__PURE__ */ new WeakMap();
738
653
  _state = /* @__PURE__ */ new WeakMap();
@@ -943,7 +858,6 @@ import { CANVAS_PERSONALIZE_SLOT } from "@uniformdev/canvas";
943
858
  import { runPersonalization } from "@uniformdev/canvas-next-rsc-shared";
944
859
  import { createElement, Fragment as Fragment3, useEffect as useEffect7, useState as useState6 } from "react";
945
860
  var PersonalizeClient = (props) => {
946
- const { slots } = props;
947
861
  const { context } = useUniformContext();
948
862
  const [indexesToShow, setIndexesToShow] = useState6(props.indexes);
949
863
  useEffect7(() => {
@@ -958,14 +872,16 @@ var PersonalizeClient = (props) => {
958
872
  setIndexesToShow(result.indexes);
959
873
  };
960
874
  context.events.on("scoresUpdated", handleRunPersonalization);
875
+ context.events.on("quirksUpdated", handleRunPersonalization);
961
876
  handleRunPersonalization();
962
877
  return () => {
963
878
  context.events.off("scoresUpdated", handleRunPersonalization);
879
+ context.events.off("quirksUpdated", handleRunPersonalization);
964
880
  };
965
881
  }, [props, context]);
966
882
  const slotsToShow = indexesToShow.map((key) => {
967
883
  var _a;
968
- return (_a = slots[CANVAS_PERSONALIZE_SLOT]) == null ? void 0 : _a.items[key];
884
+ return (_a = props.slots[CANVAS_PERSONALIZE_SLOT]) == null ? void 0 : _a.items[key];
969
885
  });
970
886
  return createElement(Fragment3, void 0, slotsToShow);
971
887
  };
@@ -995,7 +911,8 @@ var TestClient = (props) => {
995
911
  import {
996
912
  createCanvasChannel,
997
913
  IN_CONTEXT_EDITOR_QUERY_STRING_PARAM as IN_CONTEXT_EDITOR_QUERY_STRING_PARAM2,
998
- isAllowedReferrer
914
+ isAllowedReferrer,
915
+ version
999
916
  } from "@uniformdev/canvas";
1000
917
  import { useRouter as useRouter2, useSearchParams as useSearchParams3 } from "next/navigation";
1001
918
  import { useEffect as useEffect8, useMemo as useMemo2, useRef } from "react";
@@ -1029,6 +946,9 @@ var UniformScript = () => {
1029
946
  needsToRefreshRef.current = true;
1030
947
  }
1031
948
  });
949
+ channel.ready({
950
+ rsc: true
951
+ });
1032
952
  return () => {
1033
953
  unsubscribeFromEditorUpdates();
1034
954
  };
@@ -1043,7 +963,8 @@ var UniformScript = () => {
1043
963
  const textHost = isAllowedReferrer(window.document.referrer) ? window.document.referrer : "https://uniform.app/";
1044
964
  window.__UNIFORM_CONTEXTUAL_EDITING__ = {
1045
965
  framework: "React",
1046
- version: 2
966
+ version: 2,
967
+ canvasPackageVersion: version
1047
968
  };
1048
969
  const bundleHost = new URL(textHost);
1049
970
  bundleHost.pathname = "/files/canvas-in-context-embed/index.js";
@@ -1212,8 +1133,3 @@ export {
1212
1133
  useUniformContext,
1213
1134
  useUniformContextualEditingState
1214
1135
  };
1215
- /*! Bundled license information:
1216
-
1217
- js-cookie/dist/js.cookie.mjs:
1218
- (*! js-cookie v3.0.5 | MIT *)
1219
- */
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-next-rsc-client",
3
- "version": "20.6.5-alpha.1+1b1a069415",
3
+ "version": "20.7.1-alpha.106+1c23ae89f7",
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": "jest --maxWorkers=1 --passWithNoTests"
9
+ "document": "api-extractor run --local"
10
10
  },
11
11
  "sideEffects": false,
12
12
  "main": "./dist/index.js",
@@ -24,29 +24,30 @@
24
24
  "/dist"
25
25
  ],
26
26
  "devDependencies": {
27
- "@types/node": "22.7.8",
28
- "@types/react": "18.3.11",
29
- "eslint": "9.9.0",
30
- "next": "15.1.0",
27
+ "@types/js-cookie": "3.0.6",
28
+ "@types/node": "24.3.1",
29
+ "@types/react": "18.3.24",
30
+ "next": "15.2.5",
31
31
  "react": "18.3.1",
32
32
  "react-dom": "18.3.1",
33
- "typescript": "5.7.2"
33
+ "typescript": "5.9.2"
34
34
  },
35
35
  "dependencies": {
36
- "@uniformdev/canvas": "20.6.5-alpha.1+1b1a069415",
37
- "@uniformdev/canvas-next-rsc-shared": "^20.6.5-alpha.1+1b1a069415",
38
- "@uniformdev/canvas-react": "^20.6.5-alpha.1+1b1a069415"
36
+ "@uniformdev/canvas": "20.7.1-alpha.106+1c23ae89f7",
37
+ "@uniformdev/canvas-next-rsc-shared": "20.7.1-alpha.106+1c23ae89f7",
38
+ "@uniformdev/canvas-react": "20.7.1-alpha.106+1c23ae89f7",
39
+ "js-cookie": "3.0.5"
39
40
  },
40
41
  "engines": {
41
42
  "node": "^18.18.0 || ^19.8.0 || >= 20.0.0"
42
43
  },
43
44
  "peerDependencies": {
44
- "next": ">=15.1.0",
45
+ "next": ">=15.2.3",
45
46
  "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0",
46
47
  "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0"
47
48
  },
48
49
  "publishConfig": {
49
50
  "access": "public"
50
51
  },
51
- "gitHead": "1b1a06941575fefd19f3ab5621a0c403aa2cf7d5"
52
+ "gitHead": "1c23ae89f73bdb01775340b0f5a1c97fc54d8d63"
52
53
  }