@valbuild/next 0.68.2 → 0.69.0

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.
@@ -46,7 +46,7 @@ var ValNextProvider = function ValNextProvider(props) {
46
46
  useConsoleLogEnableVal(showOverlay);
47
47
  React.useEffect(function () {
48
48
  if (location.search === "?message_onready=true") {
49
- console.warn("In message mode");
49
+ console.warn("Val is verifying draft mode...");
50
50
  return;
51
51
  }
52
52
  if (isValStudioPath(location.pathname)) {
@@ -162,7 +162,7 @@ var ValNextProvider = function ValNextProvider(props) {
162
162
  return;
163
163
  }
164
164
  pollDraftStatIdRef.current--;
165
- timeout = setTimeout(pollCurrentDraftMode, iframeSrc === null ? 1000 : 100);
165
+ timeout = setTimeout(pollCurrentDraftMode, iframeSrc === null ? 20000 : 100);
166
166
  });
167
167
  }
168
168
  pollCurrentDraftMode();
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./ValNextProvider-8e3ff773.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./ValNextProvider-8e3ff773.cjs.dev.js");
7
+ }
@@ -55,7 +55,7 @@ var ValNextProvider = function ValNextProvider(props) {
55
55
  useConsoleLogEnableVal(showOverlay);
56
56
  React__default["default"].useEffect(function () {
57
57
  if (location.search === "?message_onready=true") {
58
- console.warn("In message mode");
58
+ console.warn("Val is verifying draft mode...");
59
59
  return;
60
60
  }
61
61
  if (isValStudioPath(location.pathname)) {
@@ -171,7 +171,7 @@ var ValNextProvider = function ValNextProvider(props) {
171
171
  return;
172
172
  }
173
173
  pollDraftStatIdRef.current--;
174
- timeout = setTimeout(pollCurrentDraftMode, iframeSrc === null ? 1000 : 100);
174
+ timeout = setTimeout(pollCurrentDraftMode, iframeSrc === null ? 20000 : 100);
175
175
  });
176
176
  }
177
177
  pollCurrentDraftMode();
@@ -55,7 +55,7 @@ var ValNextProvider = function ValNextProvider(props) {
55
55
  useConsoleLogEnableVal(showOverlay);
56
56
  React__default["default"].useEffect(function () {
57
57
  if (location.search === "?message_onready=true") {
58
- console.warn("In message mode");
58
+ console.warn("Val is verifying draft mode...");
59
59
  return;
60
60
  }
61
61
  if (isValStudioPath(location.pathname)) {
@@ -171,7 +171,7 @@ var ValNextProvider = function ValNextProvider(props) {
171
171
  return;
172
172
  }
173
173
  pollDraftStatIdRef.current--;
174
- timeout = setTimeout(pollCurrentDraftMode, iframeSrc === null ? 1000 : 100);
174
+ timeout = setTimeout(pollCurrentDraftMode, iframeSrc === null ? 20000 : 100);
175
175
  });
176
176
  }
177
177
  pollCurrentDraftMode();
@@ -6,7 +6,7 @@ var objectSpread2 = require('./objectSpread2-792eb2c2.cjs.dev.js');
6
6
  var core = require('@valbuild/core');
7
7
  var stega = require('@valbuild/react/stega');
8
8
  var internal = require('@valbuild/react/internal');
9
- var ValNextProvider = require('./ValNextProvider-ae04e6ef.cjs.dev.js');
9
+ var ValNextProvider = require('./ValNextProvider-951d0724.cjs.dev.js');
10
10
  var NextImage = require('next/image');
11
11
  var jsxRuntime = require('react/jsx-runtime');
12
12
  var ValApp = require('./ValApp-de156df4.cjs.dev.js');
@@ -6,7 +6,7 @@ var objectSpread2 = require('./objectSpread2-3c87fb4f.cjs.prod.js');
6
6
  var core = require('@valbuild/core');
7
7
  var stega = require('@valbuild/react/stega');
8
8
  var internal = require('@valbuild/react/internal');
9
- var ValNextProvider = require('./ValNextProvider-9527119b.cjs.prod.js');
9
+ var ValNextProvider = require('./ValNextProvider-8e3ff773.cjs.prod.js');
10
10
  var NextImage = require('next/image');
11
11
  var jsxRuntime = require('react/jsx-runtime');
12
12
  var ValApp = require('./ValApp-9eefeefd.cjs.prod.js');
@@ -5,7 +5,7 @@ export { core as expr };
5
5
  export { FILE_REF_PROP, GenericSelector, Schema, VAL_EXTENSION, derefPatch, modules } from '@valbuild/core';
6
6
  import { stegaClean, stegaDecodeString, autoTagJSX } from '@valbuild/react/stega';
7
7
  export { ValRichText } from '@valbuild/react/internal';
8
- import { ValNextProvider } from './ValNextProvider-196cd569.esm.js';
8
+ import { ValNextProvider } from './ValNextProvider-01e318bd.esm.js';
9
9
  import NextImage from 'next/image';
10
10
  import { jsx } from 'react/jsx-runtime';
11
11
  export { ValApp } from './ValApp-50ec1e10.esm.js';
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "next",
9
9
  "react"
10
10
  ],
11
- "version": "0.68.2",
11
+ "version": "0.69.0",
12
12
  "scripts": {
13
13
  "typecheck": "tsc --noEmit",
14
14
  "test": "jest"
@@ -45,11 +45,11 @@
45
45
  "exports": true
46
46
  },
47
47
  "dependencies": {
48
- "@valbuild/core": "~0.68.0",
49
- "@valbuild/react": "~0.68.0",
50
- "@valbuild/server": "~0.68.2",
51
- "@valbuild/shared": "~0.68.1",
52
- "@valbuild/ui": "~0.68.2",
48
+ "@valbuild/core": "~0.69.0",
49
+ "@valbuild/react": "~0.69.0",
50
+ "@valbuild/server": "~0.69.0",
51
+ "@valbuild/shared": "~0.69.0",
52
+ "@valbuild/ui": "~0.69.0",
53
53
  "client-only": "^0.0.1",
54
54
  "server-only": "^0.0.1"
55
55
  },
@@ -16,7 +16,7 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
16
16
  return function (selector) {
17
17
  var exec = /*#__PURE__*/function () {
18
18
  var _ref = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee() {
19
- var enabled, headers, cookies, host, _cookies, _cookies3, valServer, patchesRes, allPatches, treeRes, modules;
19
+ var enabled, headers, cookies, host, _cookies, valServer, treeRes, modules;
20
20
  return asyncToGenerator._regeneratorRuntime().wrap(function _callee$(_context) {
21
21
  while (1) switch (_context.prev = _context.next) {
22
22
  case 0:
@@ -34,7 +34,7 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
34
34
  console.error("Val: could not check if Val is enabled! This might be due to an error to check draftMode. fetchVal can only be used server-side. Use useVal on clients.", _context.t0);
35
35
  case 10:
36
36
  if (!enabled) {
37
- _context.next = 58;
37
+ _context.next = 52;
38
38
  break;
39
39
  }
40
40
  stega.SET_AUTO_TAG_JSX_ENABLED(true);
@@ -72,7 +72,7 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
72
72
  case 34:
73
73
  host = headers && getHost(headers);
74
74
  if (!(host && cookies)) {
75
- _context.next = 58;
75
+ _context.next = 52;
76
76
  break;
77
77
  }
78
78
  _context.next = 38;
@@ -80,25 +80,6 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
80
80
  case 38:
81
81
  valServer = _context.sent;
82
82
  _context.next = 41;
83
- return valServer["/patches"]["GET"]({
84
- query: {
85
- omit_patch: true,
86
- author: undefined,
87
- patch_id: undefined,
88
- module_file_path: undefined
89
- },
90
- cookies: objectSpread2._defineProperty({}, internal.VAL_SESSION_COOKIE, (_cookies = cookies) === null || _cookies === void 0 || (_cookies = _cookies.get(internal.VAL_SESSION_COOKIE)) === null || _cookies === void 0 ? void 0 : _cookies.value)
91
- });
92
- case 41:
93
- patchesRes = _context.sent;
94
- if (!(patchesRes.status !== 200)) {
95
- _context.next = 44;
96
- break;
97
- }
98
- throw Error(JSON.stringify(patchesRes.json, null, 2));
99
- case 44:
100
- allPatches = Object.keys(patchesRes.json.patches);
101
- _context.next = 47;
102
83
  return valServer["/sources/~"]["PUT"]({
103
84
  path: "/",
104
85
  query: {
@@ -106,15 +87,12 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
106
87
  validate_all: false,
107
88
  validate_binary_files: false
108
89
  },
109
- body: {
110
- patchIds: allPatches
111
- },
112
- cookies: objectSpread2._defineProperty({}, internal.VAL_SESSION_COOKIE, (_cookies3 = cookies) === null || _cookies3 === void 0 || (_cookies3 = _cookies3.get(internal.VAL_SESSION_COOKIE)) === null || _cookies3 === void 0 ? void 0 : _cookies3.value)
90
+ cookies: objectSpread2._defineProperty({}, internal.VAL_SESSION_COOKIE, (_cookies = cookies) === null || _cookies === void 0 || (_cookies = _cookies.get(internal.VAL_SESSION_COOKIE)) === null || _cookies === void 0 ? void 0 : _cookies.value)
113
91
  });
114
- case 47:
92
+ case 41:
115
93
  treeRes = _context.sent;
116
94
  if (!(treeRes.status === 200)) {
117
- _context.next = 53;
95
+ _context.next = 47;
118
96
  break;
119
97
  }
120
98
  modules = treeRes.json.modules;
@@ -127,21 +105,21 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
127
105
  }
128
106
  }
129
107
  }));
130
- case 53:
108
+ case 47:
131
109
  if (!(treeRes.status === 401)) {
132
- _context.next = 57;
110
+ _context.next = 51;
133
111
  break;
134
112
  }
135
113
  console.warn("Val: authentication error: ", treeRes.json.message);
136
- _context.next = 58;
114
+ _context.next = 52;
137
115
  break;
138
- case 57:
116
+ case 51:
139
117
  throw Error(JSON.stringify(treeRes.json, null, 2));
140
- case 58:
118
+ case 52:
141
119
  return _context.abrupt("return", stega.stegaEncode(selector, {
142
120
  disabled: !enabled
143
121
  }));
144
- case 59:
122
+ case 53:
145
123
  case "end":
146
124
  return _context.stop();
147
125
  }
@@ -16,7 +16,7 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
16
16
  return function (selector) {
17
17
  var exec = /*#__PURE__*/function () {
18
18
  var _ref = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee() {
19
- var enabled, headers, cookies, host, _cookies, _cookies3, valServer, patchesRes, allPatches, treeRes, modules;
19
+ var enabled, headers, cookies, host, _cookies, valServer, treeRes, modules;
20
20
  return asyncToGenerator._regeneratorRuntime().wrap(function _callee$(_context) {
21
21
  while (1) switch (_context.prev = _context.next) {
22
22
  case 0:
@@ -34,7 +34,7 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
34
34
  console.error("Val: could not check if Val is enabled! This might be due to an error to check draftMode. fetchVal can only be used server-side. Use useVal on clients.", _context.t0);
35
35
  case 10:
36
36
  if (!enabled) {
37
- _context.next = 58;
37
+ _context.next = 52;
38
38
  break;
39
39
  }
40
40
  stega.SET_AUTO_TAG_JSX_ENABLED(true);
@@ -72,7 +72,7 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
72
72
  case 34:
73
73
  host = headers && getHost(headers);
74
74
  if (!(host && cookies)) {
75
- _context.next = 58;
75
+ _context.next = 52;
76
76
  break;
77
77
  }
78
78
  _context.next = 38;
@@ -80,25 +80,6 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
80
80
  case 38:
81
81
  valServer = _context.sent;
82
82
  _context.next = 41;
83
- return valServer["/patches"]["GET"]({
84
- query: {
85
- omit_patch: true,
86
- author: undefined,
87
- patch_id: undefined,
88
- module_file_path: undefined
89
- },
90
- cookies: objectSpread2._defineProperty({}, internal.VAL_SESSION_COOKIE, (_cookies = cookies) === null || _cookies === void 0 || (_cookies = _cookies.get(internal.VAL_SESSION_COOKIE)) === null || _cookies === void 0 ? void 0 : _cookies.value)
91
- });
92
- case 41:
93
- patchesRes = _context.sent;
94
- if (!(patchesRes.status !== 200)) {
95
- _context.next = 44;
96
- break;
97
- }
98
- throw Error(JSON.stringify(patchesRes.json, null, 2));
99
- case 44:
100
- allPatches = Object.keys(patchesRes.json.patches);
101
- _context.next = 47;
102
83
  return valServer["/sources/~"]["PUT"]({
103
84
  path: "/",
104
85
  query: {
@@ -106,15 +87,12 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
106
87
  validate_all: false,
107
88
  validate_binary_files: false
108
89
  },
109
- body: {
110
- patchIds: allPatches
111
- },
112
- cookies: objectSpread2._defineProperty({}, internal.VAL_SESSION_COOKIE, (_cookies3 = cookies) === null || _cookies3 === void 0 || (_cookies3 = _cookies3.get(internal.VAL_SESSION_COOKIE)) === null || _cookies3 === void 0 ? void 0 : _cookies3.value)
90
+ cookies: objectSpread2._defineProperty({}, internal.VAL_SESSION_COOKIE, (_cookies = cookies) === null || _cookies === void 0 || (_cookies = _cookies.get(internal.VAL_SESSION_COOKIE)) === null || _cookies === void 0 ? void 0 : _cookies.value)
113
91
  });
114
- case 47:
92
+ case 41:
115
93
  treeRes = _context.sent;
116
94
  if (!(treeRes.status === 200)) {
117
- _context.next = 53;
95
+ _context.next = 47;
118
96
  break;
119
97
  }
120
98
  modules = treeRes.json.modules;
@@ -127,21 +105,21 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
127
105
  }
128
106
  }
129
107
  }));
130
- case 53:
108
+ case 47:
131
109
  if (!(treeRes.status === 401)) {
132
- _context.next = 57;
110
+ _context.next = 51;
133
111
  break;
134
112
  }
135
113
  console.warn("Val: authentication error: ", treeRes.json.message);
136
- _context.next = 58;
114
+ _context.next = 52;
137
115
  break;
138
- case 57:
116
+ case 51:
139
117
  throw Error(JSON.stringify(treeRes.json, null, 2));
140
- case 58:
118
+ case 52:
141
119
  return _context.abrupt("return", stega.stegaEncode(selector, {
142
120
  disabled: !enabled
143
121
  }));
144
- case 59:
122
+ case 53:
145
123
  case "end":
146
124
  return _context.stop();
147
125
  }
@@ -12,7 +12,7 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
12
12
  return function (selector) {
13
13
  var exec = /*#__PURE__*/function () {
14
14
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
15
- var enabled, headers, cookies, host, _cookies, _cookies3, valServer, patchesRes, allPatches, treeRes, modules;
15
+ var enabled, headers, cookies, host, _cookies, valServer, treeRes, modules;
16
16
  return _regeneratorRuntime().wrap(function _callee$(_context) {
17
17
  while (1) switch (_context.prev = _context.next) {
18
18
  case 0:
@@ -30,7 +30,7 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
30
30
  console.error("Val: could not check if Val is enabled! This might be due to an error to check draftMode. fetchVal can only be used server-side. Use useVal on clients.", _context.t0);
31
31
  case 10:
32
32
  if (!enabled) {
33
- _context.next = 58;
33
+ _context.next = 52;
34
34
  break;
35
35
  }
36
36
  SET_AUTO_TAG_JSX_ENABLED(true);
@@ -68,7 +68,7 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
68
68
  case 34:
69
69
  host = headers && getHost(headers);
70
70
  if (!(host && cookies)) {
71
- _context.next = 58;
71
+ _context.next = 52;
72
72
  break;
73
73
  }
74
74
  _context.next = 38;
@@ -76,25 +76,6 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
76
76
  case 38:
77
77
  valServer = _context.sent;
78
78
  _context.next = 41;
79
- return valServer["/patches"]["GET"]({
80
- query: {
81
- omit_patch: true,
82
- author: undefined,
83
- patch_id: undefined,
84
- module_file_path: undefined
85
- },
86
- cookies: _defineProperty({}, VAL_SESSION_COOKIE, (_cookies = cookies) === null || _cookies === void 0 || (_cookies = _cookies.get(VAL_SESSION_COOKIE)) === null || _cookies === void 0 ? void 0 : _cookies.value)
87
- });
88
- case 41:
89
- patchesRes = _context.sent;
90
- if (!(patchesRes.status !== 200)) {
91
- _context.next = 44;
92
- break;
93
- }
94
- throw Error(JSON.stringify(patchesRes.json, null, 2));
95
- case 44:
96
- allPatches = Object.keys(patchesRes.json.patches);
97
- _context.next = 47;
98
79
  return valServer["/sources/~"]["PUT"]({
99
80
  path: "/",
100
81
  query: {
@@ -102,15 +83,12 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
102
83
  validate_all: false,
103
84
  validate_binary_files: false
104
85
  },
105
- body: {
106
- patchIds: allPatches
107
- },
108
- cookies: _defineProperty({}, VAL_SESSION_COOKIE, (_cookies3 = cookies) === null || _cookies3 === void 0 || (_cookies3 = _cookies3.get(VAL_SESSION_COOKIE)) === null || _cookies3 === void 0 ? void 0 : _cookies3.value)
86
+ cookies: _defineProperty({}, VAL_SESSION_COOKIE, (_cookies = cookies) === null || _cookies === void 0 || (_cookies = _cookies.get(VAL_SESSION_COOKIE)) === null || _cookies === void 0 ? void 0 : _cookies.value)
109
87
  });
110
- case 47:
88
+ case 41:
111
89
  treeRes = _context.sent;
112
90
  if (!(treeRes.status === 200)) {
113
- _context.next = 53;
91
+ _context.next = 47;
114
92
  break;
115
93
  }
116
94
  modules = treeRes.json.modules;
@@ -123,21 +101,21 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
123
101
  }
124
102
  }
125
103
  }));
126
- case 53:
104
+ case 47:
127
105
  if (!(treeRes.status === 401)) {
128
- _context.next = 57;
106
+ _context.next = 51;
129
107
  break;
130
108
  }
131
109
  console.warn("Val: authentication error: ", treeRes.json.message);
132
- _context.next = 58;
110
+ _context.next = 52;
133
111
  break;
134
- case 57:
112
+ case 51:
135
113
  throw Error(JSON.stringify(treeRes.json, null, 2));
136
- case 58:
114
+ case 52:
137
115
  return _context.abrupt("return", stegaEncode(selector, {
138
116
  disabled: !enabled
139
117
  }));
140
- case 59:
118
+ case 53:
141
119
  case "end":
142
120
  return _context.stop();
143
121
  }
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- if (process.env.NODE_ENV === "production") {
4
- module.exports = require("./ValNextProvider-9527119b.cjs.prod.js");
5
- } else {
6
- module.exports = require("./ValNextProvider-9527119b.cjs.dev.js");
7
- }