@valbuild/next 0.73.2 → 0.75.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.
- package/dist/{ValApp-de156df4.cjs.dev.js → ValApp-54761eee.cjs.dev.js} +9 -7
- package/dist/{ValApp-50ec1e10.esm.js → ValApp-6cdadf96.esm.js} +9 -7
- package/dist/ValApp-9f1d8d49.cjs.js +7 -0
- package/dist/{ValApp-9eefeefd.cjs.prod.js → ValApp-9f1d8d49.cjs.prod.js} +9 -7
- package/dist/{ValNextProvider-01e318bd.esm.js → ValNextProvider-114b1205.esm.js} +12 -6
- package/dist/{ValNextProvider-951d0724.cjs.dev.js → ValNextProvider-3c3cdb83.cjs.dev.js} +10 -4
- package/dist/ValNextProvider-8b7cbdb7.cjs.js +7 -0
- package/dist/{ValNextProvider-8e3ff773.cjs.prod.js → ValNextProvider-8b7cbdb7.cjs.prod.js} +10 -4
- package/dist/declarations/src/ValApp.d.ts +1 -1
- package/dist/declarations/src/external_exempt_from_val_quickjs.d.ts +1 -1
- package/dist/useRemoteConfigSender-02451801.esm.js +70 -0
- package/dist/useRemoteConfigSender-3ea2fe91.cjs.prod.js +76 -0
- package/dist/useRemoteConfigSender-c78b81c5.cjs.dev.js +76 -0
- package/dist/valbuild-next.cjs.dev.js +2 -2
- package/dist/valbuild-next.cjs.prod.js +2 -2
- package/dist/valbuild-next.esm.js +2 -2
- package/package.json +6 -6
- package/rsc/dist/valbuild-next-rsc.cjs.dev.js +0 -1
- package/rsc/dist/valbuild-next-rsc.cjs.prod.js +0 -1
- package/rsc/dist/valbuild-next-rsc.esm.js +0 -1
- package/dist/ValApp-9eefeefd.cjs.js +0 -7
- package/dist/ValNextProvider-8e3ff773.cjs.js +0 -7
|
@@ -7,24 +7,25 @@ var slicedToArray = require('./slicedToArray-44036a76.cjs.dev.js');
|
|
|
7
7
|
var ui = require('@valbuild/ui');
|
|
8
8
|
var Script = require('next/script');
|
|
9
9
|
var React = require('react');
|
|
10
|
+
var useRemoteConfigSender = require('./useRemoteConfigSender-c78b81c5.cjs.dev.js');
|
|
10
11
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
12
|
require('./unsupportedIterableToArray-c8ab77c9.cjs.dev.js');
|
|
13
|
+
require('./objectSpread2-792eb2c2.cjs.dev.js');
|
|
14
|
+
require('@valbuild/core');
|
|
15
|
+
require('@valbuild/shared/internal');
|
|
12
16
|
|
|
13
17
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
14
18
|
|
|
15
19
|
var Script__default = /*#__PURE__*/_interopDefault(Script);
|
|
16
20
|
|
|
17
|
-
function _objectDestructuringEmpty(t) {
|
|
18
|
-
if (null == t) throw new TypeError("Cannot destructure " + t);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
21
|
var ValApp = function ValApp(_ref) {
|
|
22
|
-
|
|
23
|
-
var route = "/api/val";
|
|
22
|
+
var config = _ref.config;
|
|
23
|
+
var route = "/api/val"; // TODO: make configurable
|
|
24
24
|
var _useState = React.useState(),
|
|
25
25
|
_useState2 = slicedToArray._slicedToArray(_useState, 2),
|
|
26
26
|
inMessageMode = _useState2[0],
|
|
27
27
|
setInMessageMode = _useState2[1];
|
|
28
|
+
useRemoteConfigSender.useRemoteConfigSender(config);
|
|
28
29
|
React.useEffect(function () {
|
|
29
30
|
if (location.search === "?message_onready=true") {
|
|
30
31
|
setInMessageMode(true);
|
|
@@ -51,7 +52,8 @@ var ValApp = function ValApp(_ref) {
|
|
|
51
52
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
52
53
|
children: [/*#__PURE__*/jsxRuntime.jsx(Script__default["default"], {
|
|
53
54
|
type: "module",
|
|
54
|
-
src: "".concat(route, "/static").concat(ui.VAL_APP_PATH)
|
|
55
|
+
src: "".concat(route, "/static").concat(ui.VAL_APP_PATH),
|
|
56
|
+
crossOrigin: "anonymous"
|
|
55
57
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
56
58
|
id: ui.VAL_APP_ID
|
|
57
59
|
})]
|
|
@@ -3,20 +3,21 @@ import { _ as _slicedToArray } from './slicedToArray-aa291011.esm.js';
|
|
|
3
3
|
import { VAL_APP_PATH, VAL_APP_ID } from '@valbuild/ui';
|
|
4
4
|
import Script from 'next/script';
|
|
5
5
|
import { useState, useEffect } from 'react';
|
|
6
|
+
import { u as useRemoteConfigSender } from './useRemoteConfigSender-02451801.esm.js';
|
|
6
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
8
|
import './unsupportedIterableToArray-5baabfdc.esm.js';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
9
|
+
import './objectSpread2-c1340c1c.esm.js';
|
|
10
|
+
import '@valbuild/core';
|
|
11
|
+
import '@valbuild/shared/internal';
|
|
12
12
|
|
|
13
13
|
var ValApp = function ValApp(_ref) {
|
|
14
|
-
|
|
15
|
-
var route = "/api/val";
|
|
14
|
+
var config = _ref.config;
|
|
15
|
+
var route = "/api/val"; // TODO: make configurable
|
|
16
16
|
var _useState = useState(),
|
|
17
17
|
_useState2 = _slicedToArray(_useState, 2),
|
|
18
18
|
inMessageMode = _useState2[0],
|
|
19
19
|
setInMessageMode = _useState2[1];
|
|
20
|
+
useRemoteConfigSender(config);
|
|
20
21
|
useEffect(function () {
|
|
21
22
|
if (location.search === "?message_onready=true") {
|
|
22
23
|
setInMessageMode(true);
|
|
@@ -43,7 +44,8 @@ var ValApp = function ValApp(_ref) {
|
|
|
43
44
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
44
45
|
children: [/*#__PURE__*/jsx(Script, {
|
|
45
46
|
type: "module",
|
|
46
|
-
src: "".concat(route, "/static").concat(VAL_APP_PATH)
|
|
47
|
+
src: "".concat(route, "/static").concat(VAL_APP_PATH),
|
|
48
|
+
crossOrigin: "anonymous"
|
|
47
49
|
}), /*#__PURE__*/jsx("div", {
|
|
48
50
|
id: VAL_APP_ID
|
|
49
51
|
})]
|
|
@@ -7,24 +7,25 @@ var slicedToArray = require('./slicedToArray-ce613de6.cjs.prod.js');
|
|
|
7
7
|
var ui = require('@valbuild/ui');
|
|
8
8
|
var Script = require('next/script');
|
|
9
9
|
var React = require('react');
|
|
10
|
+
var useRemoteConfigSender = require('./useRemoteConfigSender-3ea2fe91.cjs.prod.js');
|
|
10
11
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
12
|
require('./unsupportedIterableToArray-0d2087a2.cjs.prod.js');
|
|
13
|
+
require('./objectSpread2-3c87fb4f.cjs.prod.js');
|
|
14
|
+
require('@valbuild/core');
|
|
15
|
+
require('@valbuild/shared/internal');
|
|
12
16
|
|
|
13
17
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
14
18
|
|
|
15
19
|
var Script__default = /*#__PURE__*/_interopDefault(Script);
|
|
16
20
|
|
|
17
|
-
function _objectDestructuringEmpty(t) {
|
|
18
|
-
if (null == t) throw new TypeError("Cannot destructure " + t);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
21
|
var ValApp = function ValApp(_ref) {
|
|
22
|
-
|
|
23
|
-
var route = "/api/val";
|
|
22
|
+
var config = _ref.config;
|
|
23
|
+
var route = "/api/val"; // TODO: make configurable
|
|
24
24
|
var _useState = React.useState(),
|
|
25
25
|
_useState2 = slicedToArray._slicedToArray(_useState, 2),
|
|
26
26
|
inMessageMode = _useState2[0],
|
|
27
27
|
setInMessageMode = _useState2[1];
|
|
28
|
+
useRemoteConfigSender.useRemoteConfigSender(config);
|
|
28
29
|
React.useEffect(function () {
|
|
29
30
|
if (location.search === "?message_onready=true") {
|
|
30
31
|
setInMessageMode(true);
|
|
@@ -51,7 +52,8 @@ var ValApp = function ValApp(_ref) {
|
|
|
51
52
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
52
53
|
children: [/*#__PURE__*/jsxRuntime.jsx(Script__default["default"], {
|
|
53
54
|
type: "module",
|
|
54
|
-
src: "".concat(route, "/static").concat(ui.VAL_APP_PATH)
|
|
55
|
+
src: "".concat(route, "/static").concat(ui.VAL_APP_PATH),
|
|
56
|
+
crossOrigin: "anonymous"
|
|
55
57
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
56
58
|
id: ui.VAL_APP_ID
|
|
57
59
|
})]
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { _ as _slicedToArray } from './slicedToArray-aa291011.esm.js';
|
|
3
|
-
import {
|
|
3
|
+
import { _ as _objectSpread2 } from './objectSpread2-c1340c1c.esm.js';
|
|
4
|
+
import { DEFAULT_CONTENT_HOST, Internal } from '@valbuild/core';
|
|
4
5
|
import { VAL_APP_PATH, VAL_OVERLAY_ID } from '@valbuild/ui';
|
|
5
6
|
import { useRouter } from 'next/navigation';
|
|
6
7
|
import Script from 'next/script';
|
|
7
|
-
import React
|
|
8
|
+
import React from 'react';
|
|
8
9
|
import { ValExternalStore, ValOverlayProvider } from './ValOverlayContext-a2fdbce0.esm.js';
|
|
9
10
|
import { SET_AUTO_TAG_JSX_ENABLED } from '@valbuild/react/stega';
|
|
10
11
|
import { createValClient } from '@valbuild/shared/internal';
|
|
12
|
+
import { u as useRemoteConfigSender } from './useRemoteConfigSender-02451801.esm.js';
|
|
11
13
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
12
14
|
import './unsupportedIterableToArray-5baabfdc.esm.js';
|
|
13
15
|
|
|
@@ -15,8 +17,10 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
15
17
|
// TODO: use config:
|
|
16
18
|
var route = "/api/val";
|
|
17
19
|
var client = React.useMemo(function () {
|
|
18
|
-
return createValClient(route)
|
|
19
|
-
|
|
20
|
+
return createValClient(route, _objectSpread2(_objectSpread2({}, props.config), {}, {
|
|
21
|
+
contentHostUrl: DEFAULT_CONTENT_HOST
|
|
22
|
+
}));
|
|
23
|
+
}, [route, props.config]);
|
|
20
24
|
|
|
21
25
|
// TODO: move below into react package
|
|
22
26
|
var valStore = React.useMemo(function () {
|
|
@@ -117,7 +121,7 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
117
121
|
};
|
|
118
122
|
}, [showOverlay, draftMode]);
|
|
119
123
|
var pollDraftStatIdRef = React.useRef(0);
|
|
120
|
-
useEffect(function () {
|
|
124
|
+
React.useEffect(function () {
|
|
121
125
|
// continous polling to check for updates:
|
|
122
126
|
|
|
123
127
|
var timeout;
|
|
@@ -242,6 +246,7 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
242
246
|
setDropZone("val-menu-right-center");
|
|
243
247
|
}
|
|
244
248
|
}, []);
|
|
249
|
+
useRemoteConfigSender(props.config);
|
|
245
250
|
return /*#__PURE__*/jsxs(ValOverlayProvider, {
|
|
246
251
|
draftMode: draftMode,
|
|
247
252
|
store: valStore,
|
|
@@ -261,7 +266,8 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
261
266
|
}), showOverlay && draftMode !== undefined && /*#__PURE__*/jsxs(React.Fragment, {
|
|
262
267
|
children: [/*#__PURE__*/jsx(Script, {
|
|
263
268
|
type: "module",
|
|
264
|
-
src: "".concat(route, "/static").concat(VAL_APP_PATH)
|
|
269
|
+
src: "".concat(route, "/static").concat(VAL_APP_PATH),
|
|
270
|
+
crossOrigin: "anonymous"
|
|
265
271
|
}), /*#__PURE__*/jsx("div", {
|
|
266
272
|
id: VAL_OVERLAY_ID
|
|
267
273
|
})]
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var slicedToArray = require('./slicedToArray-44036a76.cjs.dev.js');
|
|
7
|
+
var objectSpread2 = require('./objectSpread2-792eb2c2.cjs.dev.js');
|
|
7
8
|
var core = require('@valbuild/core');
|
|
8
9
|
var ui = require('@valbuild/ui');
|
|
9
10
|
var navigation = require('next/navigation');
|
|
@@ -12,6 +13,7 @@ var React = require('react');
|
|
|
12
13
|
var ValOverlayContext = require('./ValOverlayContext-55dae3ea.cjs.dev.js');
|
|
13
14
|
var stega = require('@valbuild/react/stega');
|
|
14
15
|
var internal = require('@valbuild/shared/internal');
|
|
16
|
+
var useRemoteConfigSender = require('./useRemoteConfigSender-c78b81c5.cjs.dev.js');
|
|
15
17
|
var jsxRuntime = require('react/jsx-runtime');
|
|
16
18
|
require('./unsupportedIterableToArray-c8ab77c9.cjs.dev.js');
|
|
17
19
|
|
|
@@ -24,8 +26,10 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
24
26
|
// TODO: use config:
|
|
25
27
|
var route = "/api/val";
|
|
26
28
|
var client = React__default["default"].useMemo(function () {
|
|
27
|
-
return internal.createValClient(route)
|
|
28
|
-
|
|
29
|
+
return internal.createValClient(route, objectSpread2._objectSpread2(objectSpread2._objectSpread2({}, props.config), {}, {
|
|
30
|
+
contentHostUrl: core.DEFAULT_CONTENT_HOST
|
|
31
|
+
}));
|
|
32
|
+
}, [route, props.config]);
|
|
29
33
|
|
|
30
34
|
// TODO: move below into react package
|
|
31
35
|
var valStore = React__default["default"].useMemo(function () {
|
|
@@ -126,7 +130,7 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
126
130
|
};
|
|
127
131
|
}, [showOverlay, draftMode]);
|
|
128
132
|
var pollDraftStatIdRef = React__default["default"].useRef(0);
|
|
129
|
-
|
|
133
|
+
React__default["default"].useEffect(function () {
|
|
130
134
|
// continous polling to check for updates:
|
|
131
135
|
|
|
132
136
|
var timeout;
|
|
@@ -251,6 +255,7 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
251
255
|
setDropZone("val-menu-right-center");
|
|
252
256
|
}
|
|
253
257
|
}, []);
|
|
258
|
+
useRemoteConfigSender.useRemoteConfigSender(props.config);
|
|
254
259
|
return /*#__PURE__*/jsxRuntime.jsxs(ValOverlayContext.ValOverlayProvider, {
|
|
255
260
|
draftMode: draftMode,
|
|
256
261
|
store: valStore,
|
|
@@ -270,7 +275,8 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
270
275
|
}), showOverlay && draftMode !== undefined && /*#__PURE__*/jsxRuntime.jsxs(React__default["default"].Fragment, {
|
|
271
276
|
children: [/*#__PURE__*/jsxRuntime.jsx(Script__default["default"], {
|
|
272
277
|
type: "module",
|
|
273
|
-
src: "".concat(route, "/static").concat(ui.VAL_APP_PATH)
|
|
278
|
+
src: "".concat(route, "/static").concat(ui.VAL_APP_PATH),
|
|
279
|
+
crossOrigin: "anonymous"
|
|
274
280
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
275
281
|
id: ui.VAL_OVERLAY_ID
|
|
276
282
|
})]
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var slicedToArray = require('./slicedToArray-ce613de6.cjs.prod.js');
|
|
7
|
+
var objectSpread2 = require('./objectSpread2-3c87fb4f.cjs.prod.js');
|
|
7
8
|
var core = require('@valbuild/core');
|
|
8
9
|
var ui = require('@valbuild/ui');
|
|
9
10
|
var navigation = require('next/navigation');
|
|
@@ -12,6 +13,7 @@ var React = require('react');
|
|
|
12
13
|
var ValOverlayContext = require('./ValOverlayContext-811e9be9.cjs.prod.js');
|
|
13
14
|
var stega = require('@valbuild/react/stega');
|
|
14
15
|
var internal = require('@valbuild/shared/internal');
|
|
16
|
+
var useRemoteConfigSender = require('./useRemoteConfigSender-3ea2fe91.cjs.prod.js');
|
|
15
17
|
var jsxRuntime = require('react/jsx-runtime');
|
|
16
18
|
require('./unsupportedIterableToArray-0d2087a2.cjs.prod.js');
|
|
17
19
|
|
|
@@ -24,8 +26,10 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
24
26
|
// TODO: use config:
|
|
25
27
|
var route = "/api/val";
|
|
26
28
|
var client = React__default["default"].useMemo(function () {
|
|
27
|
-
return internal.createValClient(route)
|
|
28
|
-
|
|
29
|
+
return internal.createValClient(route, objectSpread2._objectSpread2(objectSpread2._objectSpread2({}, props.config), {}, {
|
|
30
|
+
contentHostUrl: core.DEFAULT_CONTENT_HOST
|
|
31
|
+
}));
|
|
32
|
+
}, [route, props.config]);
|
|
29
33
|
|
|
30
34
|
// TODO: move below into react package
|
|
31
35
|
var valStore = React__default["default"].useMemo(function () {
|
|
@@ -126,7 +130,7 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
126
130
|
};
|
|
127
131
|
}, [showOverlay, draftMode]);
|
|
128
132
|
var pollDraftStatIdRef = React__default["default"].useRef(0);
|
|
129
|
-
|
|
133
|
+
React__default["default"].useEffect(function () {
|
|
130
134
|
// continous polling to check for updates:
|
|
131
135
|
|
|
132
136
|
var timeout;
|
|
@@ -251,6 +255,7 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
251
255
|
setDropZone("val-menu-right-center");
|
|
252
256
|
}
|
|
253
257
|
}, []);
|
|
258
|
+
useRemoteConfigSender.useRemoteConfigSender(props.config);
|
|
254
259
|
return /*#__PURE__*/jsxRuntime.jsxs(ValOverlayContext.ValOverlayProvider, {
|
|
255
260
|
draftMode: draftMode,
|
|
256
261
|
store: valStore,
|
|
@@ -270,7 +275,8 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
270
275
|
}), showOverlay && draftMode !== undefined && /*#__PURE__*/jsxRuntime.jsxs(React__default["default"].Fragment, {
|
|
271
276
|
children: [/*#__PURE__*/jsxRuntime.jsx(Script__default["default"], {
|
|
272
277
|
type: "module",
|
|
273
|
-
src: "".concat(route, "/static").concat(ui.VAL_APP_PATH)
|
|
278
|
+
src: "".concat(route, "/static").concat(ui.VAL_APP_PATH),
|
|
279
|
+
crossOrigin: "anonymous"
|
|
274
280
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
275
281
|
id: ui.VAL_OVERLAY_ID
|
|
276
282
|
})]
|
|
@@ -71,5 +71,5 @@ export declare const Internal: {
|
|
|
71
71
|
VAL_ENABLE_COOKIE_NAME: "val_enable";
|
|
72
72
|
VAL_STATE_COOKIE: "val_state";
|
|
73
73
|
VAL_SESSION_COOKIE: "val_session";
|
|
74
|
-
createFilename: (data: string | null, filename: string | null, metadata: import("@valbuild/core").
|
|
74
|
+
createFilename: (data: string | null, filename: string | null, metadata: import("@valbuild/core").FileMetadata | import("@valbuild/core").ImageMetadata | undefined, sha256: string) => string | null;
|
|
75
75
|
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { _ as _objectSpread2 } from './objectSpread2-c1340c1c.esm.js';
|
|
2
|
+
import { _ as _slicedToArray } from './slicedToArray-aa291011.esm.js';
|
|
3
|
+
import { DEFAULT_CONTENT_HOST, Internal } from '@valbuild/core';
|
|
4
|
+
import { VAL_CONFIG_RECEIVED_LISTENER, VAL_CONFIG_LISTENER } from '@valbuild/shared/internal';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
var textEncoder = new TextEncoder();
|
|
8
|
+
/*
|
|
9
|
+
* See the useRemoteConfigReceiver.tsx for the sender
|
|
10
|
+
*/
|
|
11
|
+
function useRemoteConfigSender(config) {
|
|
12
|
+
var _React$useState = React.useState(null),
|
|
13
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
14
|
+
sentRemoteConfigHash = _React$useState2[0],
|
|
15
|
+
setSentRemoteConfigHash = _React$useState2[1];
|
|
16
|
+
var _React$useState3 = React.useState(null),
|
|
17
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
18
|
+
receivedRemoteConfigHash = _React$useState4[0],
|
|
19
|
+
setReceivedRemoteConfigHash = _React$useState4[1];
|
|
20
|
+
React.useEffect(function () {
|
|
21
|
+
var sendConfig = function sendConfig() {
|
|
22
|
+
var sharedConfig = _objectSpread2(_objectSpread2({}, config), {}, {
|
|
23
|
+
// We're in NextJS now, so we can get process.env variables
|
|
24
|
+
contentHostUrl: process.env.VAL_CONTENT_URL || DEFAULT_CONTENT_HOST
|
|
25
|
+
});
|
|
26
|
+
var hash = Internal.getSHA256Hash(textEncoder.encode(JSON.stringify(sharedConfig)));
|
|
27
|
+
setSentRemoteConfigHash(hash);
|
|
28
|
+
window.dispatchEvent(new CustomEvent(VAL_CONFIG_LISTENER, {
|
|
29
|
+
detail: {
|
|
30
|
+
type: "val-config",
|
|
31
|
+
config: config,
|
|
32
|
+
hash: hash
|
|
33
|
+
}
|
|
34
|
+
}));
|
|
35
|
+
};
|
|
36
|
+
if (sentRemoteConfigHash === null || sentRemoteConfigHash !== receivedRemoteConfigHash) {
|
|
37
|
+
sendConfig();
|
|
38
|
+
var interval = setInterval(function () {
|
|
39
|
+
sendConfig();
|
|
40
|
+
}, 1000);
|
|
41
|
+
return function () {
|
|
42
|
+
clearInterval(interval);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}, [config, receivedRemoteConfigHash, sentRemoteConfigHash]);
|
|
46
|
+
React.useEffect(function () {
|
|
47
|
+
var configListener = function configListener(event) {
|
|
48
|
+
if (!(event instanceof CustomEvent)) {
|
|
49
|
+
console.warn("Received message of type val-config, but it was not a CustomEvent", event);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (event.detail.type !== "val-config-received") {
|
|
53
|
+
console.warn("Received message of type val-config, but it did not have the expected type", event.detail);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
var hash = event.detail.hash;
|
|
57
|
+
if (!hash) {
|
|
58
|
+
console.warn("Received message of type val-config, but it did not have a hash", event.detail);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
setReceivedRemoteConfigHash(hash);
|
|
62
|
+
};
|
|
63
|
+
window.addEventListener(VAL_CONFIG_RECEIVED_LISTENER, configListener);
|
|
64
|
+
return function () {
|
|
65
|
+
window.removeEventListener(VAL_CONFIG_RECEIVED_LISTENER, configListener);
|
|
66
|
+
};
|
|
67
|
+
}, [config]);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { useRemoteConfigSender as u };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var objectSpread2 = require('./objectSpread2-3c87fb4f.cjs.prod.js');
|
|
4
|
+
var slicedToArray = require('./slicedToArray-ce613de6.cjs.prod.js');
|
|
5
|
+
var core = require('@valbuild/core');
|
|
6
|
+
var internal = require('@valbuild/shared/internal');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
|
|
9
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
10
|
+
|
|
11
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
12
|
+
|
|
13
|
+
var textEncoder = new TextEncoder();
|
|
14
|
+
/*
|
|
15
|
+
* See the useRemoteConfigReceiver.tsx for the sender
|
|
16
|
+
*/
|
|
17
|
+
function useRemoteConfigSender(config) {
|
|
18
|
+
var _React$useState = React__default["default"].useState(null),
|
|
19
|
+
_React$useState2 = slicedToArray._slicedToArray(_React$useState, 2),
|
|
20
|
+
sentRemoteConfigHash = _React$useState2[0],
|
|
21
|
+
setSentRemoteConfigHash = _React$useState2[1];
|
|
22
|
+
var _React$useState3 = React__default["default"].useState(null),
|
|
23
|
+
_React$useState4 = slicedToArray._slicedToArray(_React$useState3, 2),
|
|
24
|
+
receivedRemoteConfigHash = _React$useState4[0],
|
|
25
|
+
setReceivedRemoteConfigHash = _React$useState4[1];
|
|
26
|
+
React__default["default"].useEffect(function () {
|
|
27
|
+
var sendConfig = function sendConfig() {
|
|
28
|
+
var sharedConfig = objectSpread2._objectSpread2(objectSpread2._objectSpread2({}, config), {}, {
|
|
29
|
+
// We're in NextJS now, so we can get process.env variables
|
|
30
|
+
contentHostUrl: process.env.VAL_CONTENT_URL || core.DEFAULT_CONTENT_HOST
|
|
31
|
+
});
|
|
32
|
+
var hash = core.Internal.getSHA256Hash(textEncoder.encode(JSON.stringify(sharedConfig)));
|
|
33
|
+
setSentRemoteConfigHash(hash);
|
|
34
|
+
window.dispatchEvent(new CustomEvent(internal.VAL_CONFIG_LISTENER, {
|
|
35
|
+
detail: {
|
|
36
|
+
type: "val-config",
|
|
37
|
+
config: config,
|
|
38
|
+
hash: hash
|
|
39
|
+
}
|
|
40
|
+
}));
|
|
41
|
+
};
|
|
42
|
+
if (sentRemoteConfigHash === null || sentRemoteConfigHash !== receivedRemoteConfigHash) {
|
|
43
|
+
sendConfig();
|
|
44
|
+
var interval = setInterval(function () {
|
|
45
|
+
sendConfig();
|
|
46
|
+
}, 1000);
|
|
47
|
+
return function () {
|
|
48
|
+
clearInterval(interval);
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}, [config, receivedRemoteConfigHash, sentRemoteConfigHash]);
|
|
52
|
+
React__default["default"].useEffect(function () {
|
|
53
|
+
var configListener = function configListener(event) {
|
|
54
|
+
if (!(event instanceof CustomEvent)) {
|
|
55
|
+
console.warn("Received message of type val-config, but it was not a CustomEvent", event);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (event.detail.type !== "val-config-received") {
|
|
59
|
+
console.warn("Received message of type val-config, but it did not have the expected type", event.detail);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
var hash = event.detail.hash;
|
|
63
|
+
if (!hash) {
|
|
64
|
+
console.warn("Received message of type val-config, but it did not have a hash", event.detail);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
setReceivedRemoteConfigHash(hash);
|
|
68
|
+
};
|
|
69
|
+
window.addEventListener(internal.VAL_CONFIG_RECEIVED_LISTENER, configListener);
|
|
70
|
+
return function () {
|
|
71
|
+
window.removeEventListener(internal.VAL_CONFIG_RECEIVED_LISTENER, configListener);
|
|
72
|
+
};
|
|
73
|
+
}, [config]);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
exports.useRemoteConfigSender = useRemoteConfigSender;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var objectSpread2 = require('./objectSpread2-792eb2c2.cjs.dev.js');
|
|
4
|
+
var slicedToArray = require('./slicedToArray-44036a76.cjs.dev.js');
|
|
5
|
+
var core = require('@valbuild/core');
|
|
6
|
+
var internal = require('@valbuild/shared/internal');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
|
|
9
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
10
|
+
|
|
11
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
12
|
+
|
|
13
|
+
var textEncoder = new TextEncoder();
|
|
14
|
+
/*
|
|
15
|
+
* See the useRemoteConfigReceiver.tsx for the sender
|
|
16
|
+
*/
|
|
17
|
+
function useRemoteConfigSender(config) {
|
|
18
|
+
var _React$useState = React__default["default"].useState(null),
|
|
19
|
+
_React$useState2 = slicedToArray._slicedToArray(_React$useState, 2),
|
|
20
|
+
sentRemoteConfigHash = _React$useState2[0],
|
|
21
|
+
setSentRemoteConfigHash = _React$useState2[1];
|
|
22
|
+
var _React$useState3 = React__default["default"].useState(null),
|
|
23
|
+
_React$useState4 = slicedToArray._slicedToArray(_React$useState3, 2),
|
|
24
|
+
receivedRemoteConfigHash = _React$useState4[0],
|
|
25
|
+
setReceivedRemoteConfigHash = _React$useState4[1];
|
|
26
|
+
React__default["default"].useEffect(function () {
|
|
27
|
+
var sendConfig = function sendConfig() {
|
|
28
|
+
var sharedConfig = objectSpread2._objectSpread2(objectSpread2._objectSpread2({}, config), {}, {
|
|
29
|
+
// We're in NextJS now, so we can get process.env variables
|
|
30
|
+
contentHostUrl: process.env.VAL_CONTENT_URL || core.DEFAULT_CONTENT_HOST
|
|
31
|
+
});
|
|
32
|
+
var hash = core.Internal.getSHA256Hash(textEncoder.encode(JSON.stringify(sharedConfig)));
|
|
33
|
+
setSentRemoteConfigHash(hash);
|
|
34
|
+
window.dispatchEvent(new CustomEvent(internal.VAL_CONFIG_LISTENER, {
|
|
35
|
+
detail: {
|
|
36
|
+
type: "val-config",
|
|
37
|
+
config: config,
|
|
38
|
+
hash: hash
|
|
39
|
+
}
|
|
40
|
+
}));
|
|
41
|
+
};
|
|
42
|
+
if (sentRemoteConfigHash === null || sentRemoteConfigHash !== receivedRemoteConfigHash) {
|
|
43
|
+
sendConfig();
|
|
44
|
+
var interval = setInterval(function () {
|
|
45
|
+
sendConfig();
|
|
46
|
+
}, 1000);
|
|
47
|
+
return function () {
|
|
48
|
+
clearInterval(interval);
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}, [config, receivedRemoteConfigHash, sentRemoteConfigHash]);
|
|
52
|
+
React__default["default"].useEffect(function () {
|
|
53
|
+
var configListener = function configListener(event) {
|
|
54
|
+
if (!(event instanceof CustomEvent)) {
|
|
55
|
+
console.warn("Received message of type val-config, but it was not a CustomEvent", event);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (event.detail.type !== "val-config-received") {
|
|
59
|
+
console.warn("Received message of type val-config, but it did not have the expected type", event.detail);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
var hash = event.detail.hash;
|
|
63
|
+
if (!hash) {
|
|
64
|
+
console.warn("Received message of type val-config, but it did not have a hash", event.detail);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
setReceivedRemoteConfigHash(hash);
|
|
68
|
+
};
|
|
69
|
+
window.addEventListener(internal.VAL_CONFIG_RECEIVED_LISTENER, configListener);
|
|
70
|
+
return function () {
|
|
71
|
+
window.removeEventListener(internal.VAL_CONFIG_RECEIVED_LISTENER, configListener);
|
|
72
|
+
};
|
|
73
|
+
}, [config]);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
exports.useRemoteConfigSender = useRemoteConfigSender;
|
|
@@ -6,10 +6,10 @@ 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-
|
|
9
|
+
var ValNextProvider = require('./ValNextProvider-3c3cdb83.cjs.dev.js');
|
|
10
10
|
var NextImage = require('next/image');
|
|
11
11
|
var jsxRuntime = require('react/jsx-runtime');
|
|
12
|
-
var ValApp = require('./ValApp-
|
|
12
|
+
var ValApp = require('./ValApp-54761eee.cjs.dev.js');
|
|
13
13
|
var version = require('./version-82faa1d0.cjs.dev.js');
|
|
14
14
|
|
|
15
15
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
@@ -6,10 +6,10 @@ 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-
|
|
9
|
+
var ValNextProvider = require('./ValNextProvider-8b7cbdb7.cjs.prod.js');
|
|
10
10
|
var NextImage = require('next/image');
|
|
11
11
|
var jsxRuntime = require('react/jsx-runtime');
|
|
12
|
-
var ValApp = require('./ValApp-
|
|
12
|
+
var ValApp = require('./ValApp-9f1d8d49.cjs.prod.js');
|
|
13
13
|
var version = require('./version-a9a6a619.cjs.prod.js');
|
|
14
14
|
|
|
15
15
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
@@ -5,10 +5,10 @@ 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-
|
|
8
|
+
import { ValNextProvider } from './ValNextProvider-114b1205.esm.js';
|
|
9
9
|
import NextImage from 'next/image';
|
|
10
10
|
import { jsx } from 'react/jsx-runtime';
|
|
11
|
-
export { ValApp } from './ValApp-
|
|
11
|
+
export { ValApp } from './ValApp-6cdadf96.esm.js';
|
|
12
12
|
import { V as VERSION } from './version-98ec5c7a.esm.js';
|
|
13
13
|
|
|
14
14
|
function _typeof(o) {
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"next",
|
|
9
9
|
"react"
|
|
10
10
|
],
|
|
11
|
-
"version": "0.
|
|
11
|
+
"version": "0.75.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.
|
|
49
|
-
"@valbuild/react": "~0.
|
|
50
|
-
"@valbuild/server": "~0.
|
|
51
|
-
"@valbuild/shared": "~0.
|
|
52
|
-
"@valbuild/ui": "~0.
|
|
48
|
+
"@valbuild/core": "~0.75.0",
|
|
49
|
+
"@valbuild/react": "~0.75.0",
|
|
50
|
+
"@valbuild/server": "~0.75.0",
|
|
51
|
+
"@valbuild/shared": "~0.75.0",
|
|
52
|
+
"@valbuild/ui": "~0.75.0",
|
|
53
53
|
"client-only": "^0.0.1",
|
|
54
54
|
"server-only": "^0.0.1"
|
|
55
55
|
},
|
|
@@ -84,7 +84,6 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
|
|
|
84
84
|
path: "/",
|
|
85
85
|
query: {
|
|
86
86
|
validate_sources: true,
|
|
87
|
-
validate_all: false,
|
|
88
87
|
validate_binary_files: false
|
|
89
88
|
},
|
|
90
89
|
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)
|
|
@@ -84,7 +84,6 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
|
|
|
84
84
|
path: "/",
|
|
85
85
|
query: {
|
|
86
86
|
validate_sources: true,
|
|
87
|
-
validate_all: false,
|
|
88
87
|
validate_binary_files: false
|
|
89
88
|
},
|
|
90
89
|
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)
|
|
@@ -80,7 +80,6 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
|
|
|
80
80
|
path: "/",
|
|
81
81
|
query: {
|
|
82
82
|
validate_sources: true,
|
|
83
|
-
validate_all: false,
|
|
84
83
|
validate_binary_files: false
|
|
85
84
|
},
|
|
86
85
|
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)
|