@uniformdev/canvas-next-rsc-client 19.154.1-alpha.21 → 19.154.1-alpha.24

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.esm.js CHANGED
@@ -767,6 +767,7 @@ var _scores;
767
767
  var _state;
768
768
  var _pzCache;
769
769
  var _plugins;
770
+ var _commands;
770
771
  var _mitt3;
771
772
  var _emitTest;
772
773
  var emitTest_fn;
@@ -781,6 +782,7 @@ _scores = /* @__PURE__ */ new WeakMap();
781
782
  _state = /* @__PURE__ */ new WeakMap();
782
783
  _pzCache = /* @__PURE__ */ new WeakMap();
783
784
  _plugins = /* @__PURE__ */ new WeakMap();
785
+ _commands = /* @__PURE__ */ new WeakMap();
784
786
  _mitt3 = /* @__PURE__ */ new WeakMap();
785
787
  _emitTest = /* @__PURE__ */ new WeakSet();
786
788
  emitTest_fn = function(event) {
@@ -1007,18 +1009,17 @@ var PersonalizeClient = (props) => {
1007
1009
  // src/components/TestClient.ts
1008
1010
  import { CANVAS_TEST_SLOT } from "@uniformdev/canvas";
1009
1011
  import { runTest } from "@uniformdev/canvas-next-rsc-shared";
1010
- import { createElement as createElement2, Fragment as Fragment4, useEffect as useEffect8, useState as useState7 } from "react";
1012
+ import { createElement as createElement2, Fragment as Fragment4, useMemo } from "react";
1011
1013
  var TestClient = (props) => {
1012
1014
  var _a;
1013
1015
  const { slots } = props;
1014
1016
  const { context } = useUniformContext();
1015
- const [index, setIndex] = useState7(0);
1016
- useEffect8(() => {
1017
+ const index = useMemo(() => {
1017
1018
  const result = runTest({
1018
1019
  ...props,
1019
1020
  contextInstance: context
1020
1021
  });
1021
- setIndex(result.index);
1022
+ return result.index;
1022
1023
  }, [props, context]);
1023
1024
  if (typeof index !== "number") {
1024
1025
  return null;
@@ -1033,14 +1034,14 @@ import {
1033
1034
  isAllowedReferrer
1034
1035
  } from "@uniformdev/canvas";
1035
1036
  import { useRouter as useRouter2, useSearchParams as useSearchParams3 } from "next/navigation";
1036
- import { useEffect as useEffect9, useMemo, useRef } from "react";
1037
+ import { useEffect as useEffect8, useMemo as useMemo2, useRef } from "react";
1037
1038
  import { Fragment as Fragment5, jsx as jsx3 } from "react/jsx-runtime";
1038
1039
  var UniformScript = () => {
1039
1040
  const router = useRouter2();
1040
1041
  const params = useSearchParams3();
1041
1042
  const needsToRefreshRef = useRef(false);
1042
1043
  const enabled = params.get(IN_CONTEXT_EDITOR_QUERY_STRING_PARAM2) === "true";
1043
- const channel = useMemo(() => {
1044
+ const channel = useMemo2(() => {
1044
1045
  var _a;
1045
1046
  if (typeof window === "undefined") {
1046
1047
  return;
@@ -1051,7 +1052,7 @@ var UniformScript = () => {
1051
1052
  });
1052
1053
  return instance;
1053
1054
  }, []);
1054
- useEffect9(() => {
1055
+ useEffect8(() => {
1055
1056
  if (!channel) {
1056
1057
  return;
1057
1058
  }
@@ -1068,7 +1069,7 @@ var UniformScript = () => {
1068
1069
  unsubscribeFromEditorUpdates();
1069
1070
  };
1070
1071
  }, [channel, router]);
1071
- useEffect9(() => {
1072
+ useEffect8(() => {
1072
1073
  if (typeof window === "undefined") {
1073
1074
  return;
1074
1075
  }
@@ -1076,6 +1077,10 @@ var UniformScript = () => {
1076
1077
  if (enabled) {
1077
1078
  if (!existing) {
1078
1079
  const textHost = isAllowedReferrer(window.document.referrer) ? window.document.referrer : "https://uniform.app/";
1080
+ window.__UNIFORM_CONTEXTUAL_EDITING__ = {
1081
+ framework: "React",
1082
+ version: 2
1083
+ };
1079
1084
  const bundleHost = new URL(textHost);
1080
1085
  bundleHost.pathname = "/files/canvas-in-context-embed/index.js";
1081
1086
  const script = document.createElement("script");
@@ -1089,7 +1094,7 @@ var UniformScript = () => {
1089
1094
  existing.remove();
1090
1095
  }
1091
1096
  }, [enabled]);
1092
- useEffect9(() => {
1097
+ useEffect8(() => {
1093
1098
  const handleBlurChange = () => {
1094
1099
  if (needsToRefreshRef.current) {
1095
1100
  router.refresh();
package/dist/index.js CHANGED
@@ -789,6 +789,7 @@ var _scores;
789
789
  var _state;
790
790
  var _pzCache;
791
791
  var _plugins;
792
+ var _commands;
792
793
  var _mitt3;
793
794
  var _emitTest;
794
795
  var emitTest_fn;
@@ -803,6 +804,7 @@ _scores = /* @__PURE__ */ new WeakMap();
803
804
  _state = /* @__PURE__ */ new WeakMap();
804
805
  _pzCache = /* @__PURE__ */ new WeakMap();
805
806
  _plugins = /* @__PURE__ */ new WeakMap();
807
+ _commands = /* @__PURE__ */ new WeakMap();
806
808
  _mitt3 = /* @__PURE__ */ new WeakMap();
807
809
  _emitTest = /* @__PURE__ */ new WeakSet();
808
810
  emitTest_fn = function(event) {
@@ -1034,13 +1036,12 @@ var TestClient = (props) => {
1034
1036
  var _a;
1035
1037
  const { slots } = props;
1036
1038
  const { context } = useUniformContext();
1037
- const [index, setIndex] = (0, import_react9.useState)(0);
1038
- (0, import_react9.useEffect)(() => {
1039
+ const index = (0, import_react9.useMemo)(() => {
1039
1040
  const result = (0, import_canvas_next_rsc_shared3.runTest)({
1040
1041
  ...props,
1041
1042
  contextInstance: context
1042
1043
  });
1043
- setIndex(result.index);
1044
+ return result.index;
1044
1045
  }, [props, context]);
1045
1046
  if (typeof index !== "number") {
1046
1047
  return null;
@@ -1094,6 +1095,10 @@ var UniformScript = () => {
1094
1095
  if (enabled) {
1095
1096
  if (!existing) {
1096
1097
  const textHost = (0, import_canvas4.isAllowedReferrer)(window.document.referrer) ? window.document.referrer : "https://uniform.app/";
1098
+ window.__UNIFORM_CONTEXTUAL_EDITING__ = {
1099
+ framework: "React",
1100
+ version: 2
1101
+ };
1097
1102
  const bundleHost = new URL(textHost);
1098
1103
  bundleHost.pathname = "/files/canvas-in-context-embed/index.js";
1099
1104
  const script = document.createElement("script");
package/dist/index.mjs CHANGED
@@ -767,6 +767,7 @@ var _scores;
767
767
  var _state;
768
768
  var _pzCache;
769
769
  var _plugins;
770
+ var _commands;
770
771
  var _mitt3;
771
772
  var _emitTest;
772
773
  var emitTest_fn;
@@ -781,6 +782,7 @@ _scores = /* @__PURE__ */ new WeakMap();
781
782
  _state = /* @__PURE__ */ new WeakMap();
782
783
  _pzCache = /* @__PURE__ */ new WeakMap();
783
784
  _plugins = /* @__PURE__ */ new WeakMap();
785
+ _commands = /* @__PURE__ */ new WeakMap();
784
786
  _mitt3 = /* @__PURE__ */ new WeakMap();
785
787
  _emitTest = /* @__PURE__ */ new WeakSet();
786
788
  emitTest_fn = function(event) {
@@ -1007,18 +1009,17 @@ var PersonalizeClient = (props) => {
1007
1009
  // src/components/TestClient.ts
1008
1010
  import { CANVAS_TEST_SLOT } from "@uniformdev/canvas";
1009
1011
  import { runTest } from "@uniformdev/canvas-next-rsc-shared";
1010
- import { createElement as createElement2, Fragment as Fragment4, useEffect as useEffect8, useState as useState7 } from "react";
1012
+ import { createElement as createElement2, Fragment as Fragment4, useMemo } from "react";
1011
1013
  var TestClient = (props) => {
1012
1014
  var _a;
1013
1015
  const { slots } = props;
1014
1016
  const { context } = useUniformContext();
1015
- const [index, setIndex] = useState7(0);
1016
- useEffect8(() => {
1017
+ const index = useMemo(() => {
1017
1018
  const result = runTest({
1018
1019
  ...props,
1019
1020
  contextInstance: context
1020
1021
  });
1021
- setIndex(result.index);
1022
+ return result.index;
1022
1023
  }, [props, context]);
1023
1024
  if (typeof index !== "number") {
1024
1025
  return null;
@@ -1033,14 +1034,14 @@ import {
1033
1034
  isAllowedReferrer
1034
1035
  } from "@uniformdev/canvas";
1035
1036
  import { useRouter as useRouter2, useSearchParams as useSearchParams3 } from "next/navigation";
1036
- import { useEffect as useEffect9, useMemo, useRef } from "react";
1037
+ import { useEffect as useEffect8, useMemo as useMemo2, useRef } from "react";
1037
1038
  import { Fragment as Fragment5, jsx as jsx3 } from "react/jsx-runtime";
1038
1039
  var UniformScript = () => {
1039
1040
  const router = useRouter2();
1040
1041
  const params = useSearchParams3();
1041
1042
  const needsToRefreshRef = useRef(false);
1042
1043
  const enabled = params.get(IN_CONTEXT_EDITOR_QUERY_STRING_PARAM2) === "true";
1043
- const channel = useMemo(() => {
1044
+ const channel = useMemo2(() => {
1044
1045
  var _a;
1045
1046
  if (typeof window === "undefined") {
1046
1047
  return;
@@ -1051,7 +1052,7 @@ var UniformScript = () => {
1051
1052
  });
1052
1053
  return instance;
1053
1054
  }, []);
1054
- useEffect9(() => {
1055
+ useEffect8(() => {
1055
1056
  if (!channel) {
1056
1057
  return;
1057
1058
  }
@@ -1068,7 +1069,7 @@ var UniformScript = () => {
1068
1069
  unsubscribeFromEditorUpdates();
1069
1070
  };
1070
1071
  }, [channel, router]);
1071
- useEffect9(() => {
1072
+ useEffect8(() => {
1072
1073
  if (typeof window === "undefined") {
1073
1074
  return;
1074
1075
  }
@@ -1076,6 +1077,10 @@ var UniformScript = () => {
1076
1077
  if (enabled) {
1077
1078
  if (!existing) {
1078
1079
  const textHost = isAllowedReferrer(window.document.referrer) ? window.document.referrer : "https://uniform.app/";
1080
+ window.__UNIFORM_CONTEXTUAL_EDITING__ = {
1081
+ framework: "React",
1082
+ version: 2
1083
+ };
1079
1084
  const bundleHost = new URL(textHost);
1080
1085
  bundleHost.pathname = "/files/canvas-in-context-embed/index.js";
1081
1086
  const script = document.createElement("script");
@@ -1089,7 +1094,7 @@ var UniformScript = () => {
1089
1094
  existing.remove();
1090
1095
  }
1091
1096
  }, [enabled]);
1092
- useEffect9(() => {
1097
+ useEffect8(() => {
1093
1098
  const handleBlurChange = () => {
1094
1099
  if (needsToRefreshRef.current) {
1095
1100
  router.refresh();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-next-rsc-client",
3
- "version": "19.154.1-alpha.21+51a6cdaf4f",
3
+ "version": "19.154.1-alpha.24+6b5f73fb09",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "scripts": {
6
6
  "build": "tsup",
@@ -32,9 +32,9 @@
32
32
  "react-dom": "18.2.0"
33
33
  },
34
34
  "dependencies": {
35
- "@uniformdev/canvas": "19.154.1-alpha.21+51a6cdaf4f",
36
- "@uniformdev/canvas-next-rsc-shared": "^19.154.1-alpha.21+51a6cdaf4f",
37
- "@uniformdev/canvas-react": "^19.154.1-alpha.21+51a6cdaf4f"
35
+ "@uniformdev/canvas": "19.154.1-alpha.24+6b5f73fb09",
36
+ "@uniformdev/canvas-next-rsc-shared": "^19.154.1-alpha.24+6b5f73fb09",
37
+ "@uniformdev/canvas-react": "^19.154.1-alpha.24+6b5f73fb09"
38
38
  },
39
39
  "engines": {
40
40
  "node": ">=16.14.0"
@@ -47,5 +47,5 @@
47
47
  "publishConfig": {
48
48
  "access": "public"
49
49
  },
50
- "gitHead": "51a6cdaf4f8fca15be62c0ea9e83cfe0b084cca1"
50
+ "gitHead": "6b5f73fb09a0f75fb549cdc6ed754da016b7b345"
51
51
  }