@uniformdev/canvas-next-rsc-client 20.74.6-alpha.3 → 20.74.7-alpha.12

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
@@ -942,12 +942,15 @@ var UniformScript = () => {
942
942
  if (typeof window === "undefined") {
943
943
  return;
944
944
  }
945
+ if (!enabled || !isAllowedReferrer(window.document.referrer)) {
946
+ return;
947
+ }
945
948
  const instance = createCanvasChannel({
946
949
  broadcastTo: [(_a = window.opener) != null ? _a : window.top],
947
950
  listenTo: [window]
948
951
  });
949
952
  return instance;
950
- }, []);
953
+ }, [enabled]);
951
954
  useEffect8(() => {
952
955
  if (!channel) {
953
956
  return;
@@ -1093,6 +1096,8 @@ function useScores() {
1093
1096
  // src/hooks/useUniformContextualEditingState.ts
1094
1097
  import {
1095
1098
  createCanvasChannel as createCanvasChannel2,
1099
+ IN_CONTEXT_EDITOR_QUERY_STRING_PARAM as IN_CONTEXT_EDITOR_QUERY_STRING_PARAM3,
1100
+ isAllowedReferrer as isAllowedReferrer2,
1096
1101
  isUpdateContextualEditingStateInternalMessage
1097
1102
  } from "@uniformdev/canvas";
1098
1103
  import { useEffect as useEffect12, useMemo as useMemo4, useState as useState10 } from "react";
@@ -1101,6 +1106,13 @@ var useUniformContextualEditingState = ({
1101
1106
  } = {}) => {
1102
1107
  const [selectedComponentReference, setSelectedComponentReference] = useState10();
1103
1108
  const channel = useMemo4(() => {
1109
+ if (typeof window === "undefined") {
1110
+ return;
1111
+ }
1112
+ const enabled = new URLSearchParams(window.location.search).get(IN_CONTEXT_EDITOR_QUERY_STRING_PARAM3) === "true";
1113
+ if (!enabled || !isAllowedReferrer2(window.document.referrer)) {
1114
+ return;
1115
+ }
1104
1116
  const channel2 = createCanvasChannel2({
1105
1117
  broadcastTo: [window],
1106
1118
  listenTo: [window]
package/dist/index.js CHANGED
@@ -963,12 +963,15 @@ var UniformScript = () => {
963
963
  if (typeof window === "undefined") {
964
964
  return;
965
965
  }
966
+ if (!enabled || !(0, import_canvas4.isAllowedReferrer)(window.document.referrer)) {
967
+ return;
968
+ }
966
969
  const instance = (0, import_canvas4.createCanvasChannel)({
967
970
  broadcastTo: [(_a = window.opener) != null ? _a : window.top],
968
971
  listenTo: [window]
969
972
  });
970
973
  return instance;
971
- }, []);
974
+ }, [enabled]);
972
975
  (0, import_react10.useEffect)(() => {
973
976
  if (!channel) {
974
977
  return;
@@ -1116,6 +1119,13 @@ var useUniformContextualEditingState = ({
1116
1119
  } = {}) => {
1117
1120
  const [selectedComponentReference, setSelectedComponentReference] = (0, import_react14.useState)();
1118
1121
  const channel = (0, import_react14.useMemo)(() => {
1122
+ if (typeof window === "undefined") {
1123
+ return;
1124
+ }
1125
+ const enabled = new URLSearchParams(window.location.search).get(import_canvas6.IN_CONTEXT_EDITOR_QUERY_STRING_PARAM) === "true";
1126
+ if (!enabled || !(0, import_canvas6.isAllowedReferrer)(window.document.referrer)) {
1127
+ return;
1128
+ }
1119
1129
  const channel2 = (0, import_canvas6.createCanvasChannel)({
1120
1130
  broadcastTo: [window],
1121
1131
  listenTo: [window]
package/dist/index.mjs CHANGED
@@ -942,12 +942,15 @@ var UniformScript = () => {
942
942
  if (typeof window === "undefined") {
943
943
  return;
944
944
  }
945
+ if (!enabled || !isAllowedReferrer(window.document.referrer)) {
946
+ return;
947
+ }
945
948
  const instance = createCanvasChannel({
946
949
  broadcastTo: [(_a = window.opener) != null ? _a : window.top],
947
950
  listenTo: [window]
948
951
  });
949
952
  return instance;
950
- }, []);
953
+ }, [enabled]);
951
954
  useEffect8(() => {
952
955
  if (!channel) {
953
956
  return;
@@ -1093,6 +1096,8 @@ function useScores() {
1093
1096
  // src/hooks/useUniformContextualEditingState.ts
1094
1097
  import {
1095
1098
  createCanvasChannel as createCanvasChannel2,
1099
+ IN_CONTEXT_EDITOR_QUERY_STRING_PARAM as IN_CONTEXT_EDITOR_QUERY_STRING_PARAM3,
1100
+ isAllowedReferrer as isAllowedReferrer2,
1096
1101
  isUpdateContextualEditingStateInternalMessage
1097
1102
  } from "@uniformdev/canvas";
1098
1103
  import { useEffect as useEffect12, useMemo as useMemo4, useState as useState10 } from "react";
@@ -1101,6 +1106,13 @@ var useUniformContextualEditingState = ({
1101
1106
  } = {}) => {
1102
1107
  const [selectedComponentReference, setSelectedComponentReference] = useState10();
1103
1108
  const channel = useMemo4(() => {
1109
+ if (typeof window === "undefined") {
1110
+ return;
1111
+ }
1112
+ const enabled = new URLSearchParams(window.location.search).get(IN_CONTEXT_EDITOR_QUERY_STRING_PARAM3) === "true";
1113
+ if (!enabled || !isAllowedReferrer2(window.document.referrer)) {
1114
+ return;
1115
+ }
1104
1116
  const channel2 = createCanvasChannel2({
1105
1117
  broadcastTo: [window],
1106
1118
  listenTo: [window]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-next-rsc-client",
3
- "version": "20.74.6-alpha.3+ac26410bba",
3
+ "version": "20.74.7-alpha.12+f93a44837e",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "scripts": {
6
6
  "build": "tsup",
@@ -34,9 +34,9 @@
34
34
  "typescript": "6.0.3"
35
35
  },
36
36
  "dependencies": {
37
- "@uniformdev/canvas": "20.74.6-alpha.3+ac26410bba",
38
- "@uniformdev/canvas-next-rsc-shared": "20.74.6-alpha.3+ac26410bba",
39
- "@uniformdev/canvas-react": "20.74.6-alpha.3+ac26410bba",
37
+ "@uniformdev/canvas": "20.74.7-alpha.12+f93a44837e",
38
+ "@uniformdev/canvas-next-rsc-shared": "20.74.7-alpha.12+f93a44837e",
39
+ "@uniformdev/canvas-react": "20.74.7-alpha.12+f93a44837e",
40
40
  "js-cookie": "3.0.8"
41
41
  },
42
42
  "engines": {
@@ -50,5 +50,5 @@
50
50
  "publishConfig": {
51
51
  "access": "public"
52
52
  },
53
- "gitHead": "ac26410bba86c828620eb1876847bbaffd639036"
53
+ "gitHead": "f93a44837e168f8ece4f56657a29a6f72467c1cb"
54
54
  }