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