@opengeni/react 7.4.0 → 7.5.0-canary.36919050519001
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/README.md +124 -27
- package/dist/artifacts-document.js +3 -2
- package/dist/artifacts-presentation.js +3 -2
- package/dist/artifacts-spreadsheet.js +2 -2
- package/dist/artifacts.d.ts +1 -0
- package/dist/artifacts.js +516 -1413
- package/dist/artifacts.js.map +1 -1
- package/dist/{browser-viewer-2E6R2Y4W.js → browser-viewer-Z7S7QEJL.js} +6 -5
- package/dist/chat-interactive-block-UGBTNB3L.js +11 -0
- package/dist/{chunk-Y3QTZN2F.js → chunk-2VFNCX4E.js} +6 -6
- package/dist/{chunk-UDD6DLLT.js → chunk-3IJJEYW4.js} +15 -3
- package/dist/chunk-3IJJEYW4.js.map +1 -0
- package/dist/chunk-4RVYOY4O.js +379 -0
- package/dist/chunk-4RVYOY4O.js.map +1 -0
- package/dist/chunk-5CVXZA3Y.js +292 -0
- package/dist/chunk-5CVXZA3Y.js.map +1 -0
- package/dist/{chunk-5YK2ZDIG.js → chunk-5J4FOW6Q.js} +2 -10
- package/dist/chunk-5J4FOW6Q.js.map +1 -0
- package/dist/{chunk-KVERXCFY.js → chunk-5KYZIQFY.js} +40 -3
- package/dist/chunk-5KYZIQFY.js.map +1 -0
- package/dist/{chunk-KNDIXZN6.js → chunk-7UAMYXJY.js} +25 -18
- package/dist/{chunk-KNDIXZN6.js.map → chunk-7UAMYXJY.js.map} +1 -1
- package/dist/{chunk-SEEVCT36.js → chunk-A4UJB2MM.js} +2 -2
- package/dist/{chunk-X4HIN6TV.js → chunk-AFLPWUQ7.js} +71 -162
- package/dist/chunk-AFLPWUQ7.js.map +1 -0
- package/dist/chunk-B3V6TG77.js +41 -0
- package/dist/chunk-B3V6TG77.js.map +1 -0
- package/dist/{chunk-XEJEOAOV.js → chunk-B7WMS3CS.js} +51 -40
- package/dist/chunk-B7WMS3CS.js.map +1 -0
- package/dist/{chunk-S5JQ4R22.js → chunk-BDKR6BAR.js} +54 -24
- package/dist/chunk-BDKR6BAR.js.map +1 -0
- package/dist/{chunk-4MDLEHXL.js → chunk-DYWBUX5Q.js} +24 -12
- package/dist/chunk-DYWBUX5Q.js.map +1 -0
- package/dist/{chunk-YZ3YYMOM.js → chunk-E3G7SAYZ.js} +252 -624
- package/dist/chunk-E3G7SAYZ.js.map +1 -0
- package/dist/chunk-JT4JW7BC.js +54 -0
- package/dist/chunk-JT4JW7BC.js.map +1 -0
- package/dist/{chunk-5AZSK6MV.js → chunk-LWNLETQT.js} +5 -5
- package/dist/{chunk-USXVQACU.js → chunk-M7LBYP63.js} +5 -4
- package/dist/{chunk-USXVQACU.js.map → chunk-M7LBYP63.js.map} +1 -1
- package/dist/{chunk-L4OSXQ6H.js → chunk-NBOHNRLJ.js} +1289 -1060
- package/dist/chunk-NBOHNRLJ.js.map +1 -0
- package/dist/chunk-RHREZ7BO.js +11 -0
- package/dist/chunk-RHREZ7BO.js.map +1 -0
- package/dist/chunk-SCOTPE2I.js +589 -0
- package/dist/chunk-SCOTPE2I.js.map +1 -0
- package/dist/chunk-WEHMPOXK.js +39 -0
- package/dist/chunk-WEHMPOXK.js.map +1 -0
- package/dist/chunk-WRHIZYZF.js +988 -0
- package/dist/chunk-WRHIZYZF.js.map +1 -0
- package/dist/{chunk-3E2AITTZ.js → chunk-WUISZ3WU.js} +32 -28
- package/dist/{chunk-3E2AITTZ.js.map → chunk-WUISZ3WU.js.map} +1 -1
- package/dist/chunk-XCHWDJ22.js +107 -0
- package/dist/chunk-XCHWDJ22.js.map +1 -0
- package/dist/{chunk-DUEBTL3N.js → chunk-Y2PRMYLC.js} +4 -3
- package/dist/{chunk-DUEBTL3N.js.map → chunk-Y2PRMYLC.js.map} +1 -1
- package/dist/chunk-YBXQDQFX.js +1772 -0
- package/dist/chunk-YBXQDQFX.js.map +1 -0
- package/dist/chunk-YV4L3ILF.js +9 -0
- package/dist/chunk-YV4L3ILF.js.map +1 -0
- package/dist/{chunk-V2ABIVYJ.js → chunk-ZXSEDZP7.js} +70 -6
- package/dist/chunk-ZXSEDZP7.js.map +1 -0
- package/dist/components/artifacts/artifact-chrome.d.ts +120 -0
- package/dist/components/artifacts/artifact-sandbox.d.ts +27 -0
- package/dist/components/artifacts/chat-interactive-block.d.ts +29 -0
- package/dist/components/artifacts/deferred-chat-media.d.ts +15 -0
- package/dist/components/artifacts/editable-artifact-ui.d.ts +2 -1
- package/dist/components/artifacts/editable-artifact-view.d.ts +46 -0
- package/dist/components/artifacts/index.d.ts +7 -0
- package/dist/components/artifacts/latest-task-runner.d.ts +15 -0
- package/dist/components/artifacts/session-artifact-viewer.d.ts +39 -0
- package/dist/components/artifacts/site-view.d.ts +23 -0
- package/dist/components/browser-select-control.d.ts +3 -1
- package/dist/components/code-editor.d.ts +1 -4
- package/dist/components/desktop-viewer.d.ts +1 -1
- package/dist/components/message-timeline.d.ts +20 -3
- package/dist/components/open-geni-links.d.ts +16 -0
- package/dist/components/session-conversation.d.ts +20 -1
- package/dist/components/timeline-pill-geometry.d.ts +8 -0
- package/dist/components/timeline-pill-placement.d.ts +24 -0
- package/dist/components/usage-limit-notice.d.ts +49 -0
- package/dist/components/usage-member-list.d.ts +91 -0
- package/dist/components/usage-meter.d.ts +73 -0
- package/dist/composer.js +5 -5
- package/dist/{computer-viewer-WMJE6OA3.js → computer-viewer-KJWLH3GI.js} +7 -5
- package/dist/connect.js +7 -6
- package/dist/connect.js.map +1 -1
- package/dist/conversation-timeline.d.ts +1 -1
- package/dist/desktop.d.ts +7 -0
- package/dist/desktop.js +26 -0
- package/dist/desktop.js.map +1 -0
- package/dist/editor.d.ts +7 -0
- package/dist/editor.js +21 -0
- package/dist/editor.js.map +1 -0
- package/dist/hooks/latest-question.d.ts +1 -1
- package/dist/hooks/use-composer.d.ts +4 -0
- package/dist/hooks/use-desktop-stream.d.ts +1 -1
- package/dist/hooks/use-usage.d.ts +40 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.js +460 -1386
- package/dist/index.js.map +1 -1
- package/dist/interaction.js +8 -6
- package/dist/interaction.js.map +1 -1
- package/dist/{latest-question-QB4EUCW5.js → latest-question-IS445HOW.js} +3 -3
- package/dist/lib/format.d.ts +6 -1
- package/dist/lib/workbench-peers.d.ts +36 -0
- package/dist/machines.js +2 -2
- package/dist/{markdown-table-layout-PFUEZ2U4.js → markdown-table-layout-QXSLK4BY.js} +37 -5
- package/dist/markdown-table-layout-QXSLK4BY.js.map +1 -0
- package/dist/{queue-surface-implementation-IM2HD3SK.js → queue-surface-implementation-2CAQAIHM.js} +2 -2
- package/dist/realtime.js +3 -3
- package/dist/{sandbox-files-PXPIZAFG.js → sandbox-files-AEJTWGT4.js} +8 -5
- package/dist/sandbox-files-AEJTWGT4.js.map +1 -0
- package/dist/session-ui.d.ts +9 -2
- package/dist/session-ui.js +39 -20
- package/dist/session-ui.js.map +1 -1
- package/dist/session.js +4 -4
- package/dist/sites.js +4 -289
- package/dist/sites.js.map +1 -1
- package/dist/terminal.d.ts +8 -0
- package/dist/terminal.js +31 -0
- package/dist/terminal.js.map +1 -0
- package/dist/timeline/allowance-exhausted-row.d.ts +24 -0
- package/dist/timeline/genie-loading.d.ts +3 -1
- package/dist/timeline/types.d.ts +8 -1
- package/dist/{timeline-annotation-selection-ODLVF4OI.js → timeline-annotation-selection-DMLMM2TX.js} +6 -1
- package/dist/timeline-annotation-selection-DMLMM2TX.js.map +1 -0
- package/dist/timeline-pill-geometry-Z23V243M.js +110 -0
- package/dist/timeline-pill-geometry-Z23V243M.js.map +1 -0
- package/dist/usage/allowance-copy.d.ts +25 -0
- package/dist/usage/summary.d.ts +35 -0
- package/dist/usage.d.ts +13 -0
- package/dist/usage.js +1073 -0
- package/dist/usage.js.map +1 -0
- package/package.json +19 -3
- package/src/artifacts.ts +37 -0
- package/src/components/artifacts/artifact-chrome.tsx +413 -0
- package/src/components/artifacts/artifact-sandbox.tsx +185 -0
- package/src/components/artifacts/chat-interactive-block.tsx +260 -0
- package/src/components/artifacts/deferred-chat-media.tsx +67 -0
- package/src/components/artifacts/editable-artifact-ui.tsx +3 -1
- package/src/components/artifacts/editable-artifact-view.tsx +187 -0
- package/src/components/artifacts/editable-artifact-workbench.tsx +5 -2
- package/src/components/artifacts/editable-document.tsx +34 -36
- package/src/components/artifacts/editable-presentation.tsx +21 -16
- package/src/components/artifacts/index.ts +41 -0
- package/src/components/artifacts/latest-task-runner.ts +49 -0
- package/src/components/artifacts/session-artifact-viewer.tsx +376 -0
- package/src/components/artifacts/site-view.tsx +116 -0
- package/src/components/browser-select-control.tsx +4 -1
- package/src/components/browser-viewer.tsx +81 -22
- package/src/components/code-editor.tsx +13 -16
- package/src/components/computer-viewer.tsx +51 -23
- package/src/components/desktop-viewer.tsx +1 -1
- package/src/components/markdown-table-layout.ts +49 -5
- package/src/components/markdown.tsx +5 -2
- package/src/components/message-timeline.tsx +557 -516
- package/src/components/open-geni-links.tsx +24 -0
- package/src/components/sandbox-terminal.tsx +48 -11
- package/src/components/session-chrome.tsx +22 -3
- package/src/components/session-conversation.tsx +195 -102
- package/src/components/timeline-annotation-selection.tsx +7 -0
- package/src/components/timeline-pill-geometry.ts +169 -0
- package/src/components/timeline-pill-placement.ts +99 -0
- package/src/components/usage-limit-notice.tsx +179 -0
- package/src/components/usage-member-list.tsx +792 -0
- package/src/components/usage-meter.tsx +382 -0
- package/src/conversation-timeline.ts +10 -2
- package/src/desktop.ts +24 -0
- package/src/editor.ts +13 -0
- package/src/hooks/use-available-models.ts +1 -1
- package/src/hooks/use-composer.ts +57 -2
- package/src/hooks/use-desktop-stream.ts +19 -28
- package/src/hooks/use-usage.ts +100 -0
- package/src/index.ts +22 -0
- package/src/lib/format.ts +32 -6
- package/src/lib/workbench-peers.ts +62 -0
- package/src/session-ui.ts +22 -0
- package/src/terminal.ts +26 -0
- package/src/timeline/activity-rail.tsx +5 -3
- package/src/timeline/allowance-exhausted-row.tsx +86 -0
- package/src/timeline/genie-loading.tsx +16 -6
- package/src/timeline/projection.ts +78 -4
- package/src/timeline/types.ts +8 -0
- package/src/usage/allowance-copy.ts +64 -0
- package/src/usage/summary.ts +93 -0
- package/src/usage.ts +50 -0
- package/styles/compiled.css +325 -0
- package/dist/chunk-4MDLEHXL.js.map +0 -1
- package/dist/chunk-5YK2ZDIG.js.map +0 -1
- package/dist/chunk-KVERXCFY.js.map +0 -1
- package/dist/chunk-L4OSXQ6H.js.map +0 -1
- package/dist/chunk-S5JQ4R22.js.map +0 -1
- package/dist/chunk-UDD6DLLT.js.map +0 -1
- package/dist/chunk-UGMKPUEM.js +0 -299
- package/dist/chunk-UGMKPUEM.js.map +0 -1
- package/dist/chunk-V2ABIVYJ.js.map +0 -1
- package/dist/chunk-X4HIN6TV.js.map +0 -1
- package/dist/chunk-XEJEOAOV.js.map +0 -1
- package/dist/chunk-YZ3YYMOM.js.map +0 -1
- package/dist/markdown-table-layout-PFUEZ2U4.js.map +0 -1
- package/dist/timeline-annotation-selection-ODLVF4OI.js.map +0 -1
- /package/dist/{browser-viewer-2E6R2Y4W.js.map → browser-viewer-Z7S7QEJL.js.map} +0 -0
- /package/dist/{computer-viewer-WMJE6OA3.js.map → chat-interactive-block-UGBTNB3L.js.map} +0 -0
- /package/dist/{chunk-Y3QTZN2F.js.map → chunk-2VFNCX4E.js.map} +0 -0
- /package/dist/{chunk-SEEVCT36.js.map → chunk-A4UJB2MM.js.map} +0 -0
- /package/dist/{chunk-5AZSK6MV.js.map → chunk-LWNLETQT.js.map} +0 -0
- /package/dist/{sandbox-files-PXPIZAFG.js.map → computer-viewer-KJWLH3GI.js.map} +0 -0
- /package/dist/{latest-question-QB4EUCW5.js.map → latest-question-IS445HOW.js.map} +0 -0
- /package/dist/{queue-surface-implementation-IM2HD3SK.js.map → queue-surface-implementation-2CAQAIHM.js.map} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// src/lib/host-platform.ts
|
|
2
|
+
function interactionHostPlatform() {
|
|
3
|
+
if (typeof navigator === "undefined") return "other";
|
|
4
|
+
const platform = navigator.platform || navigator.userAgent;
|
|
5
|
+
return /Mac|iPhone|iPad|iPod/u.test(platform) ? "mac" : "other";
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
interactionHostPlatform
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=chunk-RHREZ7BO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/host-platform.ts"],"sourcesContent":["export type InteractionHostPlatform = \"mac\" | \"other\";\n\n/** Physical client platform. Remote input adapters use this only to identify\n * the user's primary shortcut modifier; the target platform is resolved\n * separately. */\nexport function interactionHostPlatform(): InteractionHostPlatform {\n if (typeof navigator === \"undefined\") return \"other\";\n const platform = navigator.platform || navigator.userAgent;\n return /Mac|iPhone|iPad|iPod/u.test(platform) ? \"mac\" : \"other\";\n}\n"],"mappings":";AAKO,SAAS,0BAAmD;AACjE,MAAI,OAAO,cAAc,YAAa,QAAO;AAC7C,QAAM,WAAW,UAAU,YAAY,UAAU;AACjD,SAAO,wBAAwB,KAAK,QAAQ,IAAI,QAAQ;AAC1D;","names":[]}
|
|
@@ -0,0 +1,589 @@
|
|
|
1
|
+
// src/components/artifacts/published-html-artifact-frame.tsx
|
|
2
|
+
import {
|
|
3
|
+
OPENGENI_SITE_BRIDGE_BOOTSTRAP_GLOBAL,
|
|
4
|
+
OPENGENI_SITE_BRIDGE_READY,
|
|
5
|
+
OPENGENI_SITE_BRIDGE_RESPONSE,
|
|
6
|
+
OPENGENI_SITE_BRIDGE_VERSION,
|
|
7
|
+
isOpenGeniSiteBridgeCancelMessage,
|
|
8
|
+
isOpenGeniSiteBridgeConnectMessage,
|
|
9
|
+
isOpenGeniSiteBridgeRequestMessage,
|
|
10
|
+
sanitizeOpenGeniSiteToolCallRequest,
|
|
11
|
+
isSiteHttpRequest,
|
|
12
|
+
serveSiteHttp
|
|
13
|
+
} from "@opengeni/sdk/site";
|
|
14
|
+
import { useEffect, useRef, useState } from "react";
|
|
15
|
+
import { resolveSiteClientScript } from "@opengeni/sdk/site-document";
|
|
16
|
+
import { jsx } from "react/jsx-runtime";
|
|
17
|
+
var PUBLISHED_HTML_ARTIFACT_IFRAME_SANDBOX = [
|
|
18
|
+
"allow-downloads",
|
|
19
|
+
"allow-forms",
|
|
20
|
+
"allow-modals",
|
|
21
|
+
"allow-orientation-lock",
|
|
22
|
+
"allow-pointer-lock",
|
|
23
|
+
"allow-popups",
|
|
24
|
+
"allow-popups-to-escape-sandbox",
|
|
25
|
+
"allow-presentation",
|
|
26
|
+
"allow-scripts"
|
|
27
|
+
].join(" ");
|
|
28
|
+
var SITE_BRIDGE_BOOTSTRAP_SCRIPT = `<script>(()=>{const key=${JSON.stringify(
|
|
29
|
+
OPENGENI_SITE_BRIDGE_BOOTSTRAP_GLOBAL
|
|
30
|
+
)};const parentWindow=window.parent;if(parentWindow===window)return;window.addEventListener("message",event=>{const data=event.data;if(event.source!==parentWindow||!data||data.type!==${JSON.stringify(
|
|
31
|
+
OPENGENI_SITE_BRIDGE_READY
|
|
32
|
+
)}||data.version!==${OPENGENI_SITE_BRIDGE_VERSION}||event.ports.length!==1)return;const port=event.ports[0];const previous=window[key]?.port;if(previous&&previous!==port)previous.close();Object.defineProperty(window,key,{configurable:true,value:{port}});port.start();});})();</script>`;
|
|
33
|
+
function publishedHtmlArtifactDocument(html, toolBridgeEnabled) {
|
|
34
|
+
if (!toolBridgeEnabled) return html;
|
|
35
|
+
html = resolveSiteClientScript(html);
|
|
36
|
+
const doctypeEnd = leadingDoctypeEnd(html);
|
|
37
|
+
if (doctypeEnd >= 0) {
|
|
38
|
+
return `${html.slice(0, doctypeEnd + 1)}${SITE_BRIDGE_BOOTSTRAP_SCRIPT}${html.slice(doctypeEnd + 1)}`;
|
|
39
|
+
}
|
|
40
|
+
return `${SITE_BRIDGE_BOOTSTRAP_SCRIPT}${html}`;
|
|
41
|
+
}
|
|
42
|
+
function leadingDoctypeEnd(html) {
|
|
43
|
+
const lower = html.toLowerCase();
|
|
44
|
+
let cursor = html.charCodeAt(0) === 65279 ? 1 : 0;
|
|
45
|
+
while (cursor < html.length) {
|
|
46
|
+
while (/\s/.test(html[cursor] ?? "")) cursor += 1;
|
|
47
|
+
if (!html.startsWith("<!--", cursor)) break;
|
|
48
|
+
const commentEnd = html.indexOf("-->", cursor + 4);
|
|
49
|
+
if (commentEnd < 0) return -1;
|
|
50
|
+
cursor = commentEnd + 3;
|
|
51
|
+
}
|
|
52
|
+
if (!lower.startsWith("<!doctype", cursor)) return -1;
|
|
53
|
+
return html.indexOf(">", cursor + 9);
|
|
54
|
+
}
|
|
55
|
+
function PublishedHtmlArtifactFrame(props) {
|
|
56
|
+
const frameRef = useRef(null);
|
|
57
|
+
const [height, setHeight] = useState();
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (!props.autoHeight) return;
|
|
60
|
+
const receive = (event) => {
|
|
61
|
+
if (event.source !== frameRef.current?.contentWindow || event.data?.type !== "opengeni.preview.height")
|
|
62
|
+
return;
|
|
63
|
+
const value = event.data.height;
|
|
64
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
65
|
+
setHeight(Math.min(1200, Math.max(80, value)));
|
|
66
|
+
};
|
|
67
|
+
window.addEventListener("message", receive);
|
|
68
|
+
return () => window.removeEventListener("message", receive);
|
|
69
|
+
}, [props.autoHeight]);
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
frameRef.current?.contentWindow?.postMessage(
|
|
72
|
+
{ type: "opengeni.preview.theme", theme: props.theme },
|
|
73
|
+
"*"
|
|
74
|
+
);
|
|
75
|
+
}, [props.theme]);
|
|
76
|
+
const bridgeRef = useRef(props.toolBridge);
|
|
77
|
+
const onFrameLoadRef = useRef(() => void 0);
|
|
78
|
+
const frameLoadPendingRef = useRef(false);
|
|
79
|
+
const toolBridgeEnabled = props.toolBridge !== void 0;
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
bridgeRef.current = props.toolBridge;
|
|
82
|
+
}, [props.toolBridge]);
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
if (!toolBridgeEnabled || typeof window === "undefined") return;
|
|
85
|
+
const requests = new SiteBridgeRequestRegistry();
|
|
86
|
+
const attachToolPort = (data, ports) => {
|
|
87
|
+
const port = openGeniSiteBridgePortFromBootstrap(data, ports);
|
|
88
|
+
if (!port) return;
|
|
89
|
+
requests.addPort(port);
|
|
90
|
+
port.addEventListener("message", (portEvent) => {
|
|
91
|
+
const message = portEvent.data;
|
|
92
|
+
if (isOpenGeniSiteBridgeCancelMessage(message)) {
|
|
93
|
+
requests.cancel(port, message.requestId);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (isSiteHttpRequest(message) && portEvent.ports.length === 1) {
|
|
97
|
+
const controller2 = requests.start(port, message.requestId);
|
|
98
|
+
if (!controller2) {
|
|
99
|
+
portEvent.ports[0].close();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
void serveSiteHttp(
|
|
103
|
+
message,
|
|
104
|
+
portEvent.ports[0],
|
|
105
|
+
async (request, signal) => {
|
|
106
|
+
const fetch = bridgeRef.current?.fetch;
|
|
107
|
+
if (!fetch) throw new Error("This Site host does not support the session SDK");
|
|
108
|
+
return fetch(request, signal);
|
|
109
|
+
},
|
|
110
|
+
controller2.signal
|
|
111
|
+
).finally(() => requests.complete(port, message.requestId, controller2));
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (!isOpenGeniSiteBridgeRequestMessage(message)) return;
|
|
115
|
+
const controller = requests.start(port, message.requestId);
|
|
116
|
+
if (!controller) {
|
|
117
|
+
port.postMessage({
|
|
118
|
+
type: OPENGENI_SITE_BRIDGE_RESPONSE,
|
|
119
|
+
version: OPENGENI_SITE_BRIDGE_VERSION,
|
|
120
|
+
requestId: message.requestId,
|
|
121
|
+
ok: false,
|
|
122
|
+
error: {
|
|
123
|
+
code: "duplicate_request_id",
|
|
124
|
+
message: "A Site tool request with this id is already running",
|
|
125
|
+
retryable: false
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
void handleSiteBridgeRequest(bridgeRef.current, message, controller.signal).then((value) => {
|
|
131
|
+
if (!controller.signal.aborted) {
|
|
132
|
+
port.postMessage({
|
|
133
|
+
type: OPENGENI_SITE_BRIDGE_RESPONSE,
|
|
134
|
+
version: OPENGENI_SITE_BRIDGE_VERSION,
|
|
135
|
+
requestId: message.requestId,
|
|
136
|
+
ok: true,
|
|
137
|
+
value
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}).catch((error) => {
|
|
141
|
+
if (!controller.signal.aborted) {
|
|
142
|
+
port.postMessage({
|
|
143
|
+
type: OPENGENI_SITE_BRIDGE_RESPONSE,
|
|
144
|
+
version: OPENGENI_SITE_BRIDGE_VERSION,
|
|
145
|
+
requestId: message.requestId,
|
|
146
|
+
ok: false,
|
|
147
|
+
error: siteBridgeError(error)
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}).finally(() => requests.complete(port, message.requestId, controller));
|
|
151
|
+
});
|
|
152
|
+
port.addEventListener("messageerror", () => requests.closePort(port));
|
|
153
|
+
port.start();
|
|
154
|
+
port.postMessage({
|
|
155
|
+
type: OPENGENI_SITE_BRIDGE_READY,
|
|
156
|
+
version: OPENGENI_SITE_BRIDGE_VERSION
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
const documentLease = new SiteBridgeDocumentLease(attachToolPort, () => requests.closeAll());
|
|
160
|
+
const onFrameLoad = () => {
|
|
161
|
+
frameLoadPendingRef.current = false;
|
|
162
|
+
const frameWindow = frameRef.current?.contentWindow ?? null;
|
|
163
|
+
if (!frameWindow) return;
|
|
164
|
+
documentLease.load(frameWindow);
|
|
165
|
+
};
|
|
166
|
+
onFrameLoadRef.current = onFrameLoad;
|
|
167
|
+
if (frameLoadPendingRef.current) {
|
|
168
|
+
frameLoadPendingRef.current = false;
|
|
169
|
+
onFrameLoad();
|
|
170
|
+
}
|
|
171
|
+
return () => {
|
|
172
|
+
onFrameLoadRef.current = () => void 0;
|
|
173
|
+
documentLease.close();
|
|
174
|
+
};
|
|
175
|
+
}, [props.html, toolBridgeEnabled]);
|
|
176
|
+
return /* @__PURE__ */ jsx(
|
|
177
|
+
"iframe",
|
|
178
|
+
{
|
|
179
|
+
ref: frameRef,
|
|
180
|
+
title: props.title,
|
|
181
|
+
sandbox: PUBLISHED_HTML_ARTIFACT_IFRAME_SANDBOX,
|
|
182
|
+
referrerPolicy: "no-referrer",
|
|
183
|
+
srcDoc: publishedHtmlArtifactDocument(props.html, toolBridgeEnabled),
|
|
184
|
+
onLoad: () => {
|
|
185
|
+
frameRef.current?.contentWindow?.postMessage(
|
|
186
|
+
{ type: "opengeni.preview.theme", theme: props.theme },
|
|
187
|
+
"*"
|
|
188
|
+
);
|
|
189
|
+
frameLoadPendingRef.current = true;
|
|
190
|
+
onFrameLoadRef.current();
|
|
191
|
+
},
|
|
192
|
+
className: props.className,
|
|
193
|
+
style: { ...props.style, ...props.autoHeight && height ? { height } : {} }
|
|
194
|
+
}
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
var SiteBridgeRequestRegistry = class {
|
|
198
|
+
controllersByPort = /* @__PURE__ */ new Map();
|
|
199
|
+
addPort(port) {
|
|
200
|
+
if (!this.controllersByPort.has(port)) this.controllersByPort.set(port, /* @__PURE__ */ new Map());
|
|
201
|
+
}
|
|
202
|
+
start(port, requestId) {
|
|
203
|
+
const controllers = this.controllersByPort.get(port);
|
|
204
|
+
if (!controllers || controllers.has(requestId)) return null;
|
|
205
|
+
const controller = new AbortController();
|
|
206
|
+
controllers.set(requestId, controller);
|
|
207
|
+
return controller;
|
|
208
|
+
}
|
|
209
|
+
cancel(port, requestId) {
|
|
210
|
+
const controllers = this.controllersByPort.get(port);
|
|
211
|
+
const controller = controllers?.get(requestId);
|
|
212
|
+
if (!controller) return;
|
|
213
|
+
controller.abort(new Error("Site tool request cancelled"));
|
|
214
|
+
controllers.delete(requestId);
|
|
215
|
+
}
|
|
216
|
+
complete(port, requestId, controller) {
|
|
217
|
+
const controllers = this.controllersByPort.get(port);
|
|
218
|
+
if (controllers?.get(requestId) === controller) controllers.delete(requestId);
|
|
219
|
+
}
|
|
220
|
+
closePort(port) {
|
|
221
|
+
const controllers = this.controllersByPort.get(port);
|
|
222
|
+
if (!controllers) return;
|
|
223
|
+
for (const controller of controllers.values()) {
|
|
224
|
+
controller.abort(new Error("Site tool bridge port closed"));
|
|
225
|
+
}
|
|
226
|
+
controllers.clear();
|
|
227
|
+
this.controllersByPort.delete(port);
|
|
228
|
+
port.close();
|
|
229
|
+
}
|
|
230
|
+
closeAll() {
|
|
231
|
+
for (const port of [...this.controllersByPort.keys()]) this.closePort(port);
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
var SiteBridgeDocumentLease = class {
|
|
235
|
+
constructor(attachToolPort, closeActivePorts, createMessageChannel = () => new MessageChannel()) {
|
|
236
|
+
this.attachToolPort = attachToolPort;
|
|
237
|
+
this.closeActivePorts = closeActivePorts;
|
|
238
|
+
this.createMessageChannel = createMessageChannel;
|
|
239
|
+
}
|
|
240
|
+
loaded = false;
|
|
241
|
+
bootstrapPort = null;
|
|
242
|
+
load(frameWindow) {
|
|
243
|
+
if (this.loaded) {
|
|
244
|
+
this.close();
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
this.loaded = true;
|
|
248
|
+
const channel = this.createMessageChannel();
|
|
249
|
+
this.bootstrapPort = channel.port1;
|
|
250
|
+
channel.port1.addEventListener("message", (event) => {
|
|
251
|
+
this.attachToolPort(event.data, event.ports);
|
|
252
|
+
});
|
|
253
|
+
channel.port1.start();
|
|
254
|
+
frameWindow.postMessage(
|
|
255
|
+
{
|
|
256
|
+
type: OPENGENI_SITE_BRIDGE_READY,
|
|
257
|
+
version: OPENGENI_SITE_BRIDGE_VERSION
|
|
258
|
+
},
|
|
259
|
+
"*",
|
|
260
|
+
[channel.port2]
|
|
261
|
+
);
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
264
|
+
close() {
|
|
265
|
+
this.bootstrapPort?.close();
|
|
266
|
+
this.bootstrapPort = null;
|
|
267
|
+
this.closeActivePorts();
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
function openGeniSiteBridgePortFromBootstrap(data, ports) {
|
|
271
|
+
if (!isOpenGeniSiteBridgeConnectMessage(data)) return null;
|
|
272
|
+
return ports.length === 1 ? ports[0] : null;
|
|
273
|
+
}
|
|
274
|
+
async function handleSiteBridgeRequest(bridge, message, signal) {
|
|
275
|
+
if (!bridge) throw new Error("Site tool bridge is unavailable");
|
|
276
|
+
if (message.method === "catalog") return await bridge.catalog({ signal });
|
|
277
|
+
if (message.method === "declarations") {
|
|
278
|
+
if (!bridge.declarations) throw new Error("Site tool declarations are unavailable");
|
|
279
|
+
return await bridge.declarations({ signal });
|
|
280
|
+
}
|
|
281
|
+
return await bridge.call(sanitizeOpenGeniSiteToolCallRequest(message.payload), { signal });
|
|
282
|
+
}
|
|
283
|
+
function siteBridgeError(error) {
|
|
284
|
+
const candidate = error;
|
|
285
|
+
return {
|
|
286
|
+
code: typeof candidate?.code === "string" ? candidate.code : "site_tool_call_failed",
|
|
287
|
+
message: typeof candidate?.message === "string" ? candidate.message : "Site tool request failed",
|
|
288
|
+
retryable: candidate?.retryable === true,
|
|
289
|
+
outcomeUnknown: candidate?.outcomeUnknown === true
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// src/sites-ui.tsx
|
|
294
|
+
import { useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
295
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
296
|
+
async function loadSiteSnapshot(client, workspaceId, siteId, options = {}) {
|
|
297
|
+
const requestOptions = options.signal ? { signal: options.signal } : {};
|
|
298
|
+
const detail = await client.getWorkspaceArtifact(workspaceId, siteId, requestOptions);
|
|
299
|
+
options.signal?.throwIfAborted();
|
|
300
|
+
if (detail.artifact.id !== siteId || detail.artifact.workspaceId !== workspaceId)
|
|
301
|
+
throw new Error("Site scope mismatch");
|
|
302
|
+
const selectedVersion = options.versionId ? detail.versions.find((version) => version.id === options.versionId) : detail.artifact.currentVersion;
|
|
303
|
+
const versionId = options.versionId ?? selectedVersion?.id;
|
|
304
|
+
let content = selectedVersion && versionId && (detail.artifact.status === "active" || options.includeArchivedContent) ? {
|
|
305
|
+
artifactId: siteId,
|
|
306
|
+
versionId,
|
|
307
|
+
requestedTools: selectedVersion.requestedTools,
|
|
308
|
+
html: await client.getWorkspaceArtifactHtml(workspaceId, siteId, {
|
|
309
|
+
...requestOptions,
|
|
310
|
+
versionId
|
|
311
|
+
})
|
|
312
|
+
} : null;
|
|
313
|
+
if (versionId && !selectedVersion && (detail.artifact.status === "active" || options.includeArchivedContent)) {
|
|
314
|
+
if (!client.getWorkspaceArtifactContent) throw new Error("Site version unavailable");
|
|
315
|
+
content = await client.getWorkspaceArtifactContent(workspaceId, siteId, {
|
|
316
|
+
...requestOptions,
|
|
317
|
+
versionId
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
options.signal?.throwIfAborted();
|
|
321
|
+
if (content && (content.artifactId !== siteId || content.versionId !== versionId))
|
|
322
|
+
throw new Error("Site content mismatch");
|
|
323
|
+
return { detail: structuredClone(detail), content: content ? structuredClone(content) : null };
|
|
324
|
+
}
|
|
325
|
+
function useScopeKey(values) {
|
|
326
|
+
const [scope, setScope] = useState2(values);
|
|
327
|
+
const [generation, setGeneration] = useState2(0);
|
|
328
|
+
if (values.some((value, index) => value !== scope[index])) {
|
|
329
|
+
setScope(values);
|
|
330
|
+
setGeneration(generation + 1);
|
|
331
|
+
}
|
|
332
|
+
return generation;
|
|
333
|
+
}
|
|
334
|
+
function SiteList(props) {
|
|
335
|
+
const key = useScopeKey([props.client, props.workspaceId, props.status]);
|
|
336
|
+
return /* @__PURE__ */ jsx2(ScopedSiteList, { ...props }, key);
|
|
337
|
+
}
|
|
338
|
+
function ScopedSiteList({
|
|
339
|
+
client,
|
|
340
|
+
workspaceId,
|
|
341
|
+
status = "active",
|
|
342
|
+
onOpen,
|
|
343
|
+
className
|
|
344
|
+
}) {
|
|
345
|
+
const [page, setPage] = useState2(null);
|
|
346
|
+
const [cursor, setCursor] = useState2();
|
|
347
|
+
const [error, setError] = useState2(false);
|
|
348
|
+
const [reload, setReload] = useState2(0);
|
|
349
|
+
useEffect2(() => {
|
|
350
|
+
const abort = new AbortController();
|
|
351
|
+
setPage(null);
|
|
352
|
+
setError(false);
|
|
353
|
+
void Promise.resolve().then(
|
|
354
|
+
() => client.listWorkspaceArtifacts(workspaceId, {
|
|
355
|
+
status,
|
|
356
|
+
...cursor ? { cursor } : {},
|
|
357
|
+
limit: 50,
|
|
358
|
+
signal: abort.signal
|
|
359
|
+
})
|
|
360
|
+
).then((result) => {
|
|
361
|
+
if (!abort.signal.aborted) setPage(structuredClone(result));
|
|
362
|
+
}).catch(() => {
|
|
363
|
+
if (!abort.signal.aborted) setError(true);
|
|
364
|
+
});
|
|
365
|
+
return () => abort.abort();
|
|
366
|
+
}, [client, workspaceId, status, cursor, reload]);
|
|
367
|
+
return /* @__PURE__ */ jsxs("section", { className, "aria-label": "Sites", "aria-busy": !page && !error, children: [
|
|
368
|
+
error ? /* @__PURE__ */ jsx2("p", { role: "alert", children: "Sites are unavailable or access has changed. Refresh to check access." }) : !page ? /* @__PURE__ */ jsx2("p", { role: "status", children: "Loading Sites\u2026" }) : page.artifacts.length === 0 ? /* @__PURE__ */ jsxs("p", { role: "status", children: [
|
|
369
|
+
"No ",
|
|
370
|
+
status,
|
|
371
|
+
" Sites."
|
|
372
|
+
] }) : /* @__PURE__ */ jsx2("ul", { children: page.artifacts.map((site) => /* @__PURE__ */ jsxs("li", { children: [
|
|
373
|
+
/* @__PURE__ */ jsx2("button", { type: "button", onClick: () => onOpen(structuredClone(site)), children: site.title }),
|
|
374
|
+
/* @__PURE__ */ jsx2("p", { children: site.description }),
|
|
375
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
376
|
+
site.status,
|
|
377
|
+
" \xB7 revision ",
|
|
378
|
+
site.currentVersion?.revision ?? "unpublished"
|
|
379
|
+
] })
|
|
380
|
+
] }, site.id)) }),
|
|
381
|
+
page?.nextCursor && /* @__PURE__ */ jsx2("button", { type: "button", onClick: () => setCursor(page.nextCursor), children: "Next page" }),
|
|
382
|
+
cursor && /* @__PURE__ */ jsx2("button", { type: "button", onClick: () => setCursor(void 0), children: "First page" }),
|
|
383
|
+
/* @__PURE__ */ jsx2("button", { type: "button", onClick: () => setReload((value) => value + 1), children: "Refresh Sites" })
|
|
384
|
+
] });
|
|
385
|
+
}
|
|
386
|
+
function SiteDetail(props) {
|
|
387
|
+
const key = useScopeKey([props.client, props.workspaceId, props.siteId]);
|
|
388
|
+
return /* @__PURE__ */ jsx2(ScopedSiteDetail, { ...props }, key);
|
|
389
|
+
}
|
|
390
|
+
function ScopedSiteDetail({
|
|
391
|
+
client,
|
|
392
|
+
workspaceId,
|
|
393
|
+
siteId,
|
|
394
|
+
canPublish = false,
|
|
395
|
+
toolBridge,
|
|
396
|
+
className
|
|
397
|
+
}) {
|
|
398
|
+
const [loaded, setLoaded] = useState2(null);
|
|
399
|
+
const [error, setError] = useState2(false);
|
|
400
|
+
const [reload, setReload] = useState2(0);
|
|
401
|
+
const [busy, setBusy] = useState2(false);
|
|
402
|
+
const [rollbackId, setRollbackId] = useState2("");
|
|
403
|
+
const [confirmation, setConfirmation] = useState2(null);
|
|
404
|
+
const mutation = useRef2(null);
|
|
405
|
+
useEffect2(() => () => mutation.current?.abort(), []);
|
|
406
|
+
useEffect2(() => {
|
|
407
|
+
const abort = new AbortController();
|
|
408
|
+
setLoaded(null);
|
|
409
|
+
setError(false);
|
|
410
|
+
setConfirmation(null);
|
|
411
|
+
setRollbackId("");
|
|
412
|
+
void Promise.resolve().then(async () => {
|
|
413
|
+
const snapshot = await loadSiteSnapshot(client, workspaceId, siteId, {
|
|
414
|
+
signal: abort.signal
|
|
415
|
+
});
|
|
416
|
+
if (!abort.signal.aborted) setLoaded(snapshot);
|
|
417
|
+
}).catch(() => {
|
|
418
|
+
if (!abort.signal.aborted) {
|
|
419
|
+
setLoaded(null);
|
|
420
|
+
setError(true);
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
return () => abort.abort();
|
|
424
|
+
}, [client, workspaceId, siteId, reload]);
|
|
425
|
+
useEffect2(() => {
|
|
426
|
+
if (!loaded || busy) return;
|
|
427
|
+
const abort = new AbortController();
|
|
428
|
+
let checking = false;
|
|
429
|
+
const timer = setInterval(() => {
|
|
430
|
+
if (checking) return;
|
|
431
|
+
checking = true;
|
|
432
|
+
void Promise.resolve().then(() => client.getWorkspaceArtifact(workspaceId, siteId, { signal: abort.signal })).then((detail) => {
|
|
433
|
+
if (abort.signal.aborted) return;
|
|
434
|
+
if (detail.artifact.id !== siteId || detail.artifact.workspaceId !== workspaceId)
|
|
435
|
+
throw new Error("Site scope mismatch");
|
|
436
|
+
if (detail.artifact.currentVersion?.id !== loaded.detail.artifact.currentVersion?.id || detail.artifact.status !== loaded.detail.artifact.status) {
|
|
437
|
+
setLoaded(null);
|
|
438
|
+
setReload((value) => value + 1);
|
|
439
|
+
}
|
|
440
|
+
}).catch(() => {
|
|
441
|
+
if (!abort.signal.aborted) {
|
|
442
|
+
setLoaded(null);
|
|
443
|
+
setError(true);
|
|
444
|
+
}
|
|
445
|
+
}).finally(() => {
|
|
446
|
+
checking = false;
|
|
447
|
+
});
|
|
448
|
+
}, 15e3);
|
|
449
|
+
return () => {
|
|
450
|
+
abort.abort();
|
|
451
|
+
clearInterval(timer);
|
|
452
|
+
};
|
|
453
|
+
}, [client, workspaceId, siteId, loaded, busy]);
|
|
454
|
+
const commit = async () => {
|
|
455
|
+
const current = loaded?.detail.artifact.currentVersion;
|
|
456
|
+
if (!canPublish || !loaded || !current || !confirmation || mutation.current) return;
|
|
457
|
+
const abort = new AbortController();
|
|
458
|
+
mutation.current = abort;
|
|
459
|
+
setBusy(true);
|
|
460
|
+
try {
|
|
461
|
+
const common = { expectedCurrentVersionId: current.id, idempotencyKey: crypto.randomUUID() };
|
|
462
|
+
if (confirmation === "rollback") {
|
|
463
|
+
if (!loaded.detail.versions.some((version) => version.id === rollbackId))
|
|
464
|
+
throw new Error("Unknown version");
|
|
465
|
+
await client.rollbackWorkspaceArtifact(
|
|
466
|
+
workspaceId,
|
|
467
|
+
siteId,
|
|
468
|
+
{ ...common, versionId: rollbackId, reason: "Restore explicitly selected Site version" },
|
|
469
|
+
{ signal: abort.signal }
|
|
470
|
+
);
|
|
471
|
+
} else {
|
|
472
|
+
await client.setWorkspaceArtifactStatus(
|
|
473
|
+
workspaceId,
|
|
474
|
+
siteId,
|
|
475
|
+
{
|
|
476
|
+
...common,
|
|
477
|
+
status: loaded.detail.artifact.status === "active" ? "archived" : "active",
|
|
478
|
+
reason: "Explicit Site status change"
|
|
479
|
+
},
|
|
480
|
+
{ signal: abort.signal }
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
if (!abort.signal.aborted) {
|
|
484
|
+
setLoaded(null);
|
|
485
|
+
setReload((value) => value + 1);
|
|
486
|
+
}
|
|
487
|
+
} catch {
|
|
488
|
+
if (!abort.signal.aborted) {
|
|
489
|
+
setLoaded(null);
|
|
490
|
+
setError(true);
|
|
491
|
+
}
|
|
492
|
+
} finally {
|
|
493
|
+
if (!abort.signal.aborted) {
|
|
494
|
+
mutation.current = null;
|
|
495
|
+
setBusy(false);
|
|
496
|
+
setConfirmation(null);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
const site = loaded?.detail.artifact;
|
|
501
|
+
return /* @__PURE__ */ jsxs(
|
|
502
|
+
"section",
|
|
503
|
+
{
|
|
504
|
+
className,
|
|
505
|
+
"aria-label": "Site details",
|
|
506
|
+
"aria-busy": busy || !loaded && !error,
|
|
507
|
+
children: [
|
|
508
|
+
error && /* @__PURE__ */ jsx2("p", { role: "alert", children: "Site state could not be confirmed or access has changed. Refresh before continuing." }),
|
|
509
|
+
!loaded && !error && /* @__PURE__ */ jsx2("p", { role: "status", children: "Loading Site\u2026" }),
|
|
510
|
+
site && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
511
|
+
/* @__PURE__ */ jsx2("h2", { children: site.title }),
|
|
512
|
+
/* @__PURE__ */ jsx2("p", { children: site.description }),
|
|
513
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
514
|
+
site.status,
|
|
515
|
+
" \xB7 revision ",
|
|
516
|
+
site.currentVersion?.revision ?? "unpublished"
|
|
517
|
+
] }),
|
|
518
|
+
loaded.content && /* @__PURE__ */ jsx2(
|
|
519
|
+
PublishedHtmlArtifactFrame,
|
|
520
|
+
{
|
|
521
|
+
html: loaded.content.html,
|
|
522
|
+
title: site.title,
|
|
523
|
+
...toolBridge ? { toolBridge } : {}
|
|
524
|
+
}
|
|
525
|
+
),
|
|
526
|
+
/* @__PURE__ */ jsx2("h3", { children: "Versions" }),
|
|
527
|
+
/* @__PURE__ */ jsx2("ul", { children: loaded.detail.versions.map((version) => /* @__PURE__ */ jsxs("li", { children: [
|
|
528
|
+
"Revision ",
|
|
529
|
+
version.revision,
|
|
530
|
+
" \xB7 ",
|
|
531
|
+
version.createdAt,
|
|
532
|
+
version.id === site.currentVersion?.id ? " \xB7 current" : ""
|
|
533
|
+
] }, version.id)) }),
|
|
534
|
+
loaded.detail.versionsTruncated && /* @__PURE__ */ jsx2("p", { children: "Older versions are not included in this response." }),
|
|
535
|
+
canPublish && site.currentVersion && /* @__PURE__ */ jsxs("fieldset", { disabled: busy, children: [
|
|
536
|
+
/* @__PURE__ */ jsx2("legend", { children: "Manage Site" }),
|
|
537
|
+
/* @__PURE__ */ jsx2("button", { type: "button", onClick: () => setConfirmation("status"), children: site.status === "active" ? "Archive Site" : "Restore Site" }),
|
|
538
|
+
/* @__PURE__ */ jsxs("label", { children: [
|
|
539
|
+
"Version to restore",
|
|
540
|
+
/* @__PURE__ */ jsxs(
|
|
541
|
+
"select",
|
|
542
|
+
{
|
|
543
|
+
value: rollbackId,
|
|
544
|
+
onChange: (event) => {
|
|
545
|
+
setRollbackId(event.target.value);
|
|
546
|
+
setConfirmation(null);
|
|
547
|
+
},
|
|
548
|
+
children: [
|
|
549
|
+
/* @__PURE__ */ jsx2("option", { value: "", children: "Choose a version" }),
|
|
550
|
+
loaded.detail.versions.filter((version) => version.id !== site.currentVersion?.id).map((version) => /* @__PURE__ */ jsxs("option", { value: version.id, children: [
|
|
551
|
+
"Revision ",
|
|
552
|
+
version.revision
|
|
553
|
+
] }, version.id))
|
|
554
|
+
]
|
|
555
|
+
}
|
|
556
|
+
)
|
|
557
|
+
] }),
|
|
558
|
+
/* @__PURE__ */ jsx2(
|
|
559
|
+
"button",
|
|
560
|
+
{
|
|
561
|
+
type: "button",
|
|
562
|
+
disabled: !rollbackId,
|
|
563
|
+
onClick: () => setConfirmation("rollback"),
|
|
564
|
+
children: "Review rollback"
|
|
565
|
+
}
|
|
566
|
+
),
|
|
567
|
+
confirmation && /* @__PURE__ */ jsxs("div", { role: "group", "aria-label": "Confirm Site change", children: [
|
|
568
|
+
/* @__PURE__ */ jsx2("p", { children: confirmation === "rollback" ? "Make the selected version current?" : site.status === "active" ? "Archive this Site for workspace users?" : "Restore this Site for workspace users?" }),
|
|
569
|
+
/* @__PURE__ */ jsx2("button", { type: "button", onClick: () => void commit(), children: "Confirm change" }),
|
|
570
|
+
/* @__PURE__ */ jsx2("button", { type: "button", onClick: () => setConfirmation(null), children: "Keep current state" })
|
|
571
|
+
] })
|
|
572
|
+
] })
|
|
573
|
+
] }),
|
|
574
|
+
/* @__PURE__ */ jsx2("button", { type: "button", disabled: busy, onClick: () => setReload((value) => value + 1), children: "Refresh Site" })
|
|
575
|
+
]
|
|
576
|
+
}
|
|
577
|
+
);
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
export {
|
|
581
|
+
PUBLISHED_HTML_ARTIFACT_IFRAME_SANDBOX,
|
|
582
|
+
publishedHtmlArtifactDocument,
|
|
583
|
+
PublishedHtmlArtifactFrame,
|
|
584
|
+
openGeniSiteBridgePortFromBootstrap,
|
|
585
|
+
loadSiteSnapshot,
|
|
586
|
+
SiteList,
|
|
587
|
+
SiteDetail
|
|
588
|
+
};
|
|
589
|
+
//# sourceMappingURL=chunk-SCOTPE2I.js.map
|