@uniformdev/canvas-next 19.0.0 → 19.1.1-alpha.1

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
@@ -12,6 +12,9 @@ var getQueryParam = (req, paramName) => {
12
12
  return Array.isArray(value) ? value[0] : value;
13
13
  };
14
14
  var createPreviewHandlerGet = ({ secret, resolveFullPath = resolveFullPathDefault } = {}) => async (req, res) => {
15
+ if (req.headers["sec-fetch-mode"] === "no-cors") {
16
+ return res.status(204).end();
17
+ }
15
18
  const queryParamsToPreserve = [IN_CONTEXT_EDITOR_QUERY_STRING_PARAM];
16
19
  const id = getQueryParam(req, "id");
17
20
  const slug = getQueryParam(req, "slug");
@@ -45,7 +48,8 @@ var createPreviewHandlerGet = ({ secret, resolveFullPath = resolveFullPathDefaul
45
48
  // By default the preview cookies stays as long as the tab is open. And in contextual editing mode, people tend to open Canvas editor (one tab) and another tab to see published changes.
46
49
  // This causes the second tab to still have the preview cookie, which causes unexpected behavior.
47
50
  // This is more obvious in contextual editing mode because we skip the composition fetching and the user sees a blank page where they expected the published composition.
48
- maxAge: isUniformContextualEditing ? 0 : void 0
51
+ // We set this value to `1` just to handle the case of middlewares and redirections, ideally `0` should do the trick.
52
+ maxAge: isUniformContextualEditing ? 1 : void 0
49
53
  }
50
54
  );
51
55
  const cookies = res.getHeader("Set-Cookie");
package/dist/index.js CHANGED
@@ -47,6 +47,9 @@ var getQueryParam = (req, paramName) => {
47
47
  return Array.isArray(value) ? value[0] : value;
48
48
  };
49
49
  var createPreviewHandlerGet = ({ secret, resolveFullPath = resolveFullPathDefault } = {}) => async (req, res) => {
50
+ if (req.headers["sec-fetch-mode"] === "no-cors") {
51
+ return res.status(204).end();
52
+ }
50
53
  const queryParamsToPreserve = [import_canvas.IN_CONTEXT_EDITOR_QUERY_STRING_PARAM];
51
54
  const id = getQueryParam(req, "id");
52
55
  const slug = getQueryParam(req, "slug");
@@ -80,7 +83,8 @@ var createPreviewHandlerGet = ({ secret, resolveFullPath = resolveFullPathDefaul
80
83
  // By default the preview cookies stays as long as the tab is open. And in contextual editing mode, people tend to open Canvas editor (one tab) and another tab to see published changes.
81
84
  // This causes the second tab to still have the preview cookie, which causes unexpected behavior.
82
85
  // This is more obvious in contextual editing mode because we skip the composition fetching and the user sees a blank page where they expected the published composition.
83
- maxAge: isUniformContextualEditing ? 0 : void 0
86
+ // We set this value to `1` just to handle the case of middlewares and redirections, ideally `0` should do the trick.
87
+ maxAge: isUniformContextualEditing ? 1 : void 0
84
88
  }
85
89
  );
86
90
  const cookies = res.getHeader("Set-Cookie");
package/dist/index.mjs CHANGED
@@ -12,6 +12,9 @@ var getQueryParam = (req, paramName) => {
12
12
  return Array.isArray(value) ? value[0] : value;
13
13
  };
14
14
  var createPreviewHandlerGet = ({ secret, resolveFullPath = resolveFullPathDefault } = {}) => async (req, res) => {
15
+ if (req.headers["sec-fetch-mode"] === "no-cors") {
16
+ return res.status(204).end();
17
+ }
15
18
  const queryParamsToPreserve = [IN_CONTEXT_EDITOR_QUERY_STRING_PARAM];
16
19
  const id = getQueryParam(req, "id");
17
20
  const slug = getQueryParam(req, "slug");
@@ -45,7 +48,8 @@ var createPreviewHandlerGet = ({ secret, resolveFullPath = resolveFullPathDefaul
45
48
  // By default the preview cookies stays as long as the tab is open. And in contextual editing mode, people tend to open Canvas editor (one tab) and another tab to see published changes.
46
49
  // This causes the second tab to still have the preview cookie, which causes unexpected behavior.
47
50
  // This is more obvious in contextual editing mode because we skip the composition fetching and the user sees a blank page where they expected the published composition.
48
- maxAge: isUniformContextualEditing ? 0 : void 0
51
+ // We set this value to `1` just to handle the case of middlewares and redirections, ideally `0` should do the trick.
52
+ maxAge: isUniformContextualEditing ? 1 : void 0
49
53
  }
50
54
  );
51
55
  const cookies = res.getHeader("Set-Cookie");
@@ -99,7 +99,7 @@ var withUniformGetStaticPaths = (options) => {
99
99
  });
100
100
  return {
101
101
  paths,
102
- fallback: false
102
+ fallback: true
103
103
  };
104
104
  };
105
105
  };
@@ -79,7 +79,7 @@ var withUniformGetStaticPaths = (options) => {
79
79
  });
80
80
  return {
81
81
  paths,
82
- fallback: false
82
+ fallback: true
83
83
  };
84
84
  };
85
85
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-next",
3
- "version": "19.0.0",
3
+ "version": "19.1.1-alpha.1+3ec68fe9d",
4
4
  "description": "Next.js SDK for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -53,9 +53,9 @@
53
53
  "document": "api-extractor run --local"
54
54
  },
55
55
  "dependencies": {
56
- "@uniformdev/canvas": "19.0.0",
57
- "@uniformdev/canvas-react": "19.0.0",
58
- "@uniformdev/project-map": "19.0.0"
56
+ "@uniformdev/canvas": "19.1.1-alpha.1+3ec68fe9d",
57
+ "@uniformdev/canvas-react": "19.1.1-alpha.1+3ec68fe9d",
58
+ "@uniformdev/project-map": "19.1.1-alpha.1+3ec68fe9d"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "next": ">= 12.0.0",
@@ -63,7 +63,7 @@
63
63
  "react-dom": ">=16"
64
64
  },
65
65
  "devDependencies": {
66
- "@types/react": "18.0.35",
66
+ "@types/react": "18.0.37",
67
67
  "next": "13.3.0",
68
68
  "react": "18.2.0",
69
69
  "react-dom": "18.2.0"
@@ -74,5 +74,5 @@
74
74
  "publishConfig": {
75
75
  "access": "public"
76
76
  },
77
- "gitHead": "e104985924b24a8de1d8dcfcca6c9167611adf85"
77
+ "gitHead": "3ec68fe9d54c7128e57cc8a5c8116fe968f65865"
78
78
  }