@uniformdev/canvas-next-rsc-client 19.158.0 → 19.159.1-alpha.16
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 +12 -9
- package/dist/index.js +6 -3
- package/dist/index.mjs +12 -9
- package/package.json +5 -5
package/dist/index.esm.js
CHANGED
|
@@ -1009,18 +1009,17 @@ var PersonalizeClient = (props) => {
|
|
|
1009
1009
|
// src/components/TestClient.ts
|
|
1010
1010
|
import { CANVAS_TEST_SLOT } from "@uniformdev/canvas";
|
|
1011
1011
|
import { runTest } from "@uniformdev/canvas-next-rsc-shared";
|
|
1012
|
-
import { createElement as createElement2, Fragment as Fragment4,
|
|
1012
|
+
import { createElement as createElement2, Fragment as Fragment4, useMemo } from "react";
|
|
1013
1013
|
var TestClient = (props) => {
|
|
1014
1014
|
var _a;
|
|
1015
1015
|
const { slots } = props;
|
|
1016
1016
|
const { context } = useUniformContext();
|
|
1017
|
-
const
|
|
1018
|
-
useEffect8(() => {
|
|
1017
|
+
const index = useMemo(() => {
|
|
1019
1018
|
const result = runTest({
|
|
1020
1019
|
...props,
|
|
1021
1020
|
contextInstance: context
|
|
1022
1021
|
});
|
|
1023
|
-
|
|
1022
|
+
return result.index;
|
|
1024
1023
|
}, [props, context]);
|
|
1025
1024
|
if (typeof index !== "number") {
|
|
1026
1025
|
return null;
|
|
@@ -1035,14 +1034,14 @@ import {
|
|
|
1035
1034
|
isAllowedReferrer
|
|
1036
1035
|
} from "@uniformdev/canvas";
|
|
1037
1036
|
import { useRouter as useRouter2, useSearchParams as useSearchParams3 } from "next/navigation";
|
|
1038
|
-
import { useEffect as
|
|
1037
|
+
import { useEffect as useEffect8, useMemo as useMemo2, useRef } from "react";
|
|
1039
1038
|
import { Fragment as Fragment5, jsx as jsx3 } from "react/jsx-runtime";
|
|
1040
1039
|
var UniformScript = () => {
|
|
1041
1040
|
const router = useRouter2();
|
|
1042
1041
|
const params = useSearchParams3();
|
|
1043
1042
|
const needsToRefreshRef = useRef(false);
|
|
1044
1043
|
const enabled = params.get(IN_CONTEXT_EDITOR_QUERY_STRING_PARAM2) === "true";
|
|
1045
|
-
const channel =
|
|
1044
|
+
const channel = useMemo2(() => {
|
|
1046
1045
|
var _a;
|
|
1047
1046
|
if (typeof window === "undefined") {
|
|
1048
1047
|
return;
|
|
@@ -1053,7 +1052,7 @@ var UniformScript = () => {
|
|
|
1053
1052
|
});
|
|
1054
1053
|
return instance;
|
|
1055
1054
|
}, []);
|
|
1056
|
-
|
|
1055
|
+
useEffect8(() => {
|
|
1057
1056
|
if (!channel) {
|
|
1058
1057
|
return;
|
|
1059
1058
|
}
|
|
@@ -1070,7 +1069,7 @@ var UniformScript = () => {
|
|
|
1070
1069
|
unsubscribeFromEditorUpdates();
|
|
1071
1070
|
};
|
|
1072
1071
|
}, [channel, router]);
|
|
1073
|
-
|
|
1072
|
+
useEffect8(() => {
|
|
1074
1073
|
if (typeof window === "undefined") {
|
|
1075
1074
|
return;
|
|
1076
1075
|
}
|
|
@@ -1078,6 +1077,10 @@ var UniformScript = () => {
|
|
|
1078
1077
|
if (enabled) {
|
|
1079
1078
|
if (!existing) {
|
|
1080
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
|
+
};
|
|
1081
1084
|
const bundleHost = new URL(textHost);
|
|
1082
1085
|
bundleHost.pathname = "/files/canvas-in-context-embed/index.js";
|
|
1083
1086
|
const script = document.createElement("script");
|
|
@@ -1091,7 +1094,7 @@ var UniformScript = () => {
|
|
|
1091
1094
|
existing.remove();
|
|
1092
1095
|
}
|
|
1093
1096
|
}, [enabled]);
|
|
1094
|
-
|
|
1097
|
+
useEffect8(() => {
|
|
1095
1098
|
const handleBlurChange = () => {
|
|
1096
1099
|
if (needsToRefreshRef.current) {
|
|
1097
1100
|
router.refresh();
|
package/dist/index.js
CHANGED
|
@@ -1036,13 +1036,12 @@ var TestClient = (props) => {
|
|
|
1036
1036
|
var _a;
|
|
1037
1037
|
const { slots } = props;
|
|
1038
1038
|
const { context } = useUniformContext();
|
|
1039
|
-
const
|
|
1040
|
-
(0, import_react9.useEffect)(() => {
|
|
1039
|
+
const index = (0, import_react9.useMemo)(() => {
|
|
1041
1040
|
const result = (0, import_canvas_next_rsc_shared3.runTest)({
|
|
1042
1041
|
...props,
|
|
1043
1042
|
contextInstance: context
|
|
1044
1043
|
});
|
|
1045
|
-
|
|
1044
|
+
return result.index;
|
|
1046
1045
|
}, [props, context]);
|
|
1047
1046
|
if (typeof index !== "number") {
|
|
1048
1047
|
return null;
|
|
@@ -1096,6 +1095,10 @@ var UniformScript = () => {
|
|
|
1096
1095
|
if (enabled) {
|
|
1097
1096
|
if (!existing) {
|
|
1098
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
|
+
};
|
|
1099
1102
|
const bundleHost = new URL(textHost);
|
|
1100
1103
|
bundleHost.pathname = "/files/canvas-in-context-embed/index.js";
|
|
1101
1104
|
const script = document.createElement("script");
|
package/dist/index.mjs
CHANGED
|
@@ -1009,18 +1009,17 @@ var PersonalizeClient = (props) => {
|
|
|
1009
1009
|
// src/components/TestClient.ts
|
|
1010
1010
|
import { CANVAS_TEST_SLOT } from "@uniformdev/canvas";
|
|
1011
1011
|
import { runTest } from "@uniformdev/canvas-next-rsc-shared";
|
|
1012
|
-
import { createElement as createElement2, Fragment as Fragment4,
|
|
1012
|
+
import { createElement as createElement2, Fragment as Fragment4, useMemo } from "react";
|
|
1013
1013
|
var TestClient = (props) => {
|
|
1014
1014
|
var _a;
|
|
1015
1015
|
const { slots } = props;
|
|
1016
1016
|
const { context } = useUniformContext();
|
|
1017
|
-
const
|
|
1018
|
-
useEffect8(() => {
|
|
1017
|
+
const index = useMemo(() => {
|
|
1019
1018
|
const result = runTest({
|
|
1020
1019
|
...props,
|
|
1021
1020
|
contextInstance: context
|
|
1022
1021
|
});
|
|
1023
|
-
|
|
1022
|
+
return result.index;
|
|
1024
1023
|
}, [props, context]);
|
|
1025
1024
|
if (typeof index !== "number") {
|
|
1026
1025
|
return null;
|
|
@@ -1035,14 +1034,14 @@ import {
|
|
|
1035
1034
|
isAllowedReferrer
|
|
1036
1035
|
} from "@uniformdev/canvas";
|
|
1037
1036
|
import { useRouter as useRouter2, useSearchParams as useSearchParams3 } from "next/navigation";
|
|
1038
|
-
import { useEffect as
|
|
1037
|
+
import { useEffect as useEffect8, useMemo as useMemo2, useRef } from "react";
|
|
1039
1038
|
import { Fragment as Fragment5, jsx as jsx3 } from "react/jsx-runtime";
|
|
1040
1039
|
var UniformScript = () => {
|
|
1041
1040
|
const router = useRouter2();
|
|
1042
1041
|
const params = useSearchParams3();
|
|
1043
1042
|
const needsToRefreshRef = useRef(false);
|
|
1044
1043
|
const enabled = params.get(IN_CONTEXT_EDITOR_QUERY_STRING_PARAM2) === "true";
|
|
1045
|
-
const channel =
|
|
1044
|
+
const channel = useMemo2(() => {
|
|
1046
1045
|
var _a;
|
|
1047
1046
|
if (typeof window === "undefined") {
|
|
1048
1047
|
return;
|
|
@@ -1053,7 +1052,7 @@ var UniformScript = () => {
|
|
|
1053
1052
|
});
|
|
1054
1053
|
return instance;
|
|
1055
1054
|
}, []);
|
|
1056
|
-
|
|
1055
|
+
useEffect8(() => {
|
|
1057
1056
|
if (!channel) {
|
|
1058
1057
|
return;
|
|
1059
1058
|
}
|
|
@@ -1070,7 +1069,7 @@ var UniformScript = () => {
|
|
|
1070
1069
|
unsubscribeFromEditorUpdates();
|
|
1071
1070
|
};
|
|
1072
1071
|
}, [channel, router]);
|
|
1073
|
-
|
|
1072
|
+
useEffect8(() => {
|
|
1074
1073
|
if (typeof window === "undefined") {
|
|
1075
1074
|
return;
|
|
1076
1075
|
}
|
|
@@ -1078,6 +1077,10 @@ var UniformScript = () => {
|
|
|
1078
1077
|
if (enabled) {
|
|
1079
1078
|
if (!existing) {
|
|
1080
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
|
+
};
|
|
1081
1084
|
const bundleHost = new URL(textHost);
|
|
1082
1085
|
bundleHost.pathname = "/files/canvas-in-context-embed/index.js";
|
|
1083
1086
|
const script = document.createElement("script");
|
|
@@ -1091,7 +1094,7 @@ var UniformScript = () => {
|
|
|
1091
1094
|
existing.remove();
|
|
1092
1095
|
}
|
|
1093
1096
|
}, [enabled]);
|
|
1094
|
-
|
|
1097
|
+
useEffect8(() => {
|
|
1095
1098
|
const handleBlurChange = () => {
|
|
1096
1099
|
if (needsToRefreshRef.current) {
|
|
1097
1100
|
router.refresh();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next-rsc-client",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.159.1-alpha.16+112313047e",
|
|
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.
|
|
36
|
-
"@uniformdev/canvas-next-rsc-shared": "^19.
|
|
37
|
-
"@uniformdev/canvas-react": "^19.
|
|
35
|
+
"@uniformdev/canvas": "19.159.1-alpha.16+112313047e",
|
|
36
|
+
"@uniformdev/canvas-next-rsc-shared": "^19.159.1-alpha.16+112313047e",
|
|
37
|
+
"@uniformdev/canvas-react": "^19.159.1-alpha.16+112313047e"
|
|
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": "
|
|
50
|
+
"gitHead": "112313047e98c7a1c0045ea1c5d01a4c74b29871"
|
|
51
51
|
}
|