@replohq/sandbox-runtime 1.2.0 → 1.3.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/NavigationReceiver.d.ts +1 -0
- package/NavigationReceiver.js +25 -0
- package/NavigationReceiver.js.map +7 -0
- package/_vendor/schemas/selectModeIframeRpc.d.ts +6 -0
- package/_vendor/schemas/selectModeIframeRpc.mjs +5 -0
- package/buildMetadata.js +3 -3
- package/package.json +4 -4
- package/sandbox-runtime.js +2 -0
- package/sandbox-runtime.js.map +2 -2
- package/select-mode/iframeRpcChannel.d.ts +4 -1
- package/select-mode/iframeRpcChannel.js +8 -0
- package/select-mode/iframeRpcChannel.js.map +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function NavigationReceiver(): null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useMemo } from "react";
|
|
3
|
+
import { useRouter } from "next/navigation";
|
|
4
|
+
import { useIframeRpcChannel } from "./_vendor/replo-utils/react/use-iframe-rpc-channel.mjs";
|
|
5
|
+
import {
|
|
6
|
+
getSelectModeIframeRpcChannel,
|
|
7
|
+
setNavigateToRouteHandler
|
|
8
|
+
} from "./select-mode/iframeRpcChannel";
|
|
9
|
+
function NavigationReceiver() {
|
|
10
|
+
const router = useRouter();
|
|
11
|
+
useIframeRpcChannel(useMemo(() => getSelectModeIframeRpcChannel(), []));
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
setNavigateToRouteHandler(({ pathname }) => {
|
|
14
|
+
router.push(pathname);
|
|
15
|
+
});
|
|
16
|
+
return () => {
|
|
17
|
+
setNavigateToRouteHandler(null);
|
|
18
|
+
};
|
|
19
|
+
}, [router]);
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
NavigationReceiver
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=NavigationReceiver.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../NavigationReceiver.tsx"],
|
|
4
|
+
"sourcesContent": ["\"use client\";\n\nimport { useEffect, useMemo } from \"react\";\n\nimport { useRouter } from \"next/navigation\";\n\nimport { useIframeRpcChannel } from \"replo-utils/react/use-iframe-rpc-channel\";\n\nimport {\n getSelectModeIframeRpcChannel,\n setNavigateToRouteHandler,\n} from \"./select-mode/iframeRpcChannel\";\n\n// Hands the editor's `navigateToRoute` commands to the app router; `LinkInterceptor` reports the resulting navigation up.\nexport function NavigationReceiver() {\n const router = useRouter();\n useIframeRpcChannel(useMemo(() => getSelectModeIframeRpcChannel(), []));\n\n // eslint-disable-next-line replo/no-use-effect -- RPC handler registration tied to the router's lifetime.\n useEffect(() => {\n setNavigateToRouteHandler(({ pathname }) => {\n router.push(pathname);\n });\n return () => {\n setNavigateToRouteHandler(null);\n };\n }, [router]);\n\n return null;\n}\n"],
|
|
5
|
+
"mappings": ";AAEA,SAAS,WAAW,eAAe;AAEnC,SAAS,iBAAiB;AAE1B,SAAS,2BAA2B;AAEpC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAGA,SAAS,qBAAqB;AACnC,QAAM,SAAS,UAAU;AACzB,sBAAoB,QAAQ,MAAM,8BAA8B,GAAG,CAAC,CAAC,CAAC;AAGtE,YAAU,MAAM;AACd,8BAA0B,CAAC,EAAE,SAAS,MAAM;AAC1C,aAAO,KAAK,QAAQ;AAAA,IACtB,CAAC;AACD,WAAO,MAAM;AACX,gCAA0B,IAAI;AAAA,IAChC;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAEX,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -131,6 +131,12 @@ export declare const websiteBuilderToCanopyMethodConfig: {
|
|
|
131
131
|
}, z.core.$strip>;
|
|
132
132
|
timeoutMs: number;
|
|
133
133
|
};
|
|
134
|
+
navigateToRoute: {
|
|
135
|
+
inputSchema: z.ZodObject<{
|
|
136
|
+
pathname: z.ZodString;
|
|
137
|
+
}, z.core.$strip>;
|
|
138
|
+
outputSchema: z.ZodVoid;
|
|
139
|
+
};
|
|
134
140
|
setDisplayMode: {
|
|
135
141
|
inputSchema: z.ZodObject<{
|
|
136
142
|
displayMode: z.ZodEnum<{
|
|
@@ -18,6 +18,11 @@ var websiteBuilderToCanopyMethodConfig = {
|
|
|
18
18
|
outputSchema: selectedElementSchema,
|
|
19
19
|
timeoutMs: 1500
|
|
20
20
|
},
|
|
21
|
+
// Client-side transition command; fire-and-forget because success is observed as the `replo:navigated` echo.
|
|
22
|
+
navigateToRoute: {
|
|
23
|
+
inputSchema: z.object({ pathname: z.string() }),
|
|
24
|
+
outputSchema: z.void()
|
|
25
|
+
},
|
|
21
26
|
setDisplayMode: {
|
|
22
27
|
inputSchema: z.object({ displayMode: displayModeSchema }),
|
|
23
28
|
outputSchema: z.void()
|
package/buildMetadata.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const BUILD_METADATA = {
|
|
2
2
|
"packageName": "@replohq/sandbox-runtime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"branch": "HEAD",
|
|
5
|
-
"commit": "
|
|
6
|
-
"builtAt": "2026-08-
|
|
5
|
+
"commit": "544d5eef4f0142da5e8569baa4832a525d11fc06",
|
|
6
|
+
"builtAt": "2026-08-26T18:10:31.971Z"
|
|
7
7
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@replohq/sandbox-runtime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"reploBuild": {
|
|
5
5
|
"packageName": "@replohq/sandbox-runtime",
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.3.0",
|
|
7
7
|
"branch": "HEAD",
|
|
8
|
-
"commit": "
|
|
9
|
-
"builtAt": "2026-08-
|
|
8
|
+
"commit": "544d5eef4f0142da5e8569baa4832a525d11fc06",
|
|
9
|
+
"builtAt": "2026-08-26T18:10:31.971Z"
|
|
10
10
|
},
|
|
11
11
|
"description": "Replo sandbox runtime — editor integration for agent-built Next.js sites.",
|
|
12
12
|
"license": "SEE LICENSE IN LICENSE",
|
package/sandbox-runtime.js
CHANGED
|
@@ -5,6 +5,7 @@ import { ClientErrorBoundary } from "./ClientErrorBoundary";
|
|
|
5
5
|
import { DesignLibraryPreview } from "./design-library-preview/DesignLibraryPreview";
|
|
6
6
|
import { DocumentReadyBeacon } from "./DocumentReadyBeacon";
|
|
7
7
|
import LinkInterceptor from "./LinkInterceptor";
|
|
8
|
+
import { NavigationReceiver } from "./NavigationReceiver";
|
|
8
9
|
import { NextErrorReporter } from "./NextErrorReporter";
|
|
9
10
|
import PostHogRelay from "./posthog-relay";
|
|
10
11
|
import { EditorSelection } from "./select-mode/EditorSelection";
|
|
@@ -15,6 +16,7 @@ function SandboxRuntime({ children }) {
|
|
|
15
16
|
/* @__PURE__ */ jsx(NextErrorReporter, {}),
|
|
16
17
|
/* @__PURE__ */ jsxs(ClientErrorBoundary, { children: [
|
|
17
18
|
/* @__PURE__ */ jsx(LinkInterceptor, {}),
|
|
19
|
+
/* @__PURE__ */ jsx(NavigationReceiver, {}),
|
|
18
20
|
/* @__PURE__ */ jsx(PostHogRelay, {}),
|
|
19
21
|
/* @__PURE__ */ jsx(EditorSelection, {}),
|
|
20
22
|
/* @__PURE__ */ jsx(AnnotationLayerMount, {}),
|
package/sandbox-runtime.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../sandbox-runtime.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\";\n\nimport { AnnotationLayerMount } from \"./annotations/AnnotationLayerMount\";\nimport { ClientErrorBoundary } from \"./ClientErrorBoundary\";\nimport { DesignLibraryPreview } from \"./design-library-preview/DesignLibraryPreview\";\nimport { DocumentReadyBeacon } from \"./DocumentReadyBeacon\";\nimport LinkInterceptor from \"./LinkInterceptor\";\nimport { NextErrorReporter } from \"./NextErrorReporter\";\nimport PostHogRelay from \"./posthog-relay\";\nimport { EditorSelection } from \"./select-mode/EditorSelection\";\n\nexport function SandboxRuntime({ children }: React.PropsWithChildren) {\n // The editor only embeds dev servers (`next dev`), so editor-integration components render there only \u2014 production builds ship none of them and behave like plain Next apps.\n const isDevServer = process.env.NODE_ENV === \"development\";\n\n return isDevServer ? (\n <>\n <DocumentReadyBeacon />\n {/* NOTE (Max, 2026-06-08): Outside ClientErrorBoundary on purpose \u2014 when\n the boundary catches a runtime error it swaps its children for a\n neutral cover, which would unmount the reporter and freeze it in the\n error state. It must stay mounted to observe Next's overlay across\n error <-> recover. */}\n <NextErrorReporter />\n <ClientErrorBoundary>\n <LinkInterceptor />\n <PostHogRelay />\n <EditorSelection />\n <AnnotationLayerMount />\n <DesignLibraryPreview />\n {children}\n </ClientErrorBoundary>\n </>\n ) : (\n children\n );\n}\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["\"use client\";\n\nimport { AnnotationLayerMount } from \"./annotations/AnnotationLayerMount\";\nimport { ClientErrorBoundary } from \"./ClientErrorBoundary\";\nimport { DesignLibraryPreview } from \"./design-library-preview/DesignLibraryPreview\";\nimport { DocumentReadyBeacon } from \"./DocumentReadyBeacon\";\nimport LinkInterceptor from \"./LinkInterceptor\";\nimport { NavigationReceiver } from \"./NavigationReceiver\";\nimport { NextErrorReporter } from \"./NextErrorReporter\";\nimport PostHogRelay from \"./posthog-relay\";\nimport { EditorSelection } from \"./select-mode/EditorSelection\";\n\nexport function SandboxRuntime({ children }: React.PropsWithChildren) {\n // The editor only embeds dev servers (`next dev`), so editor-integration components render there only \u2014 production builds ship none of them and behave like plain Next apps.\n const isDevServer = process.env.NODE_ENV === \"development\";\n\n return isDevServer ? (\n <>\n <DocumentReadyBeacon />\n {/* NOTE (Max, 2026-06-08): Outside ClientErrorBoundary on purpose \u2014 when\n the boundary catches a runtime error it swaps its children for a\n neutral cover, which would unmount the reporter and freeze it in the\n error state. It must stay mounted to observe Next's overlay across\n error <-> recover. */}\n <NextErrorReporter />\n <ClientErrorBoundary>\n <LinkInterceptor />\n <NavigationReceiver />\n <PostHogRelay />\n <EditorSelection />\n <AnnotationLayerMount />\n <DesignLibraryPreview />\n {children}\n </ClientErrorBoundary>\n </>\n ) : (\n children\n );\n}\n"],
|
|
5
|
+
"mappings": ";AAiBI,mBACE,KAOA,YARF;AAfJ,SAAS,4BAA4B;AACrC,SAAS,2BAA2B;AACpC,SAAS,4BAA4B;AACrC,SAAS,2BAA2B;AACpC,OAAO,qBAAqB;AAC5B,SAAS,0BAA0B;AACnC,SAAS,yBAAyB;AAClC,OAAO,kBAAkB;AACzB,SAAS,uBAAuB;AAEzB,SAAS,eAAe,EAAE,SAAS,GAA4B;AAEpE,QAAM,cAAc,QAAQ,IAAI,aAAa;AAE7C,SAAO,cACL,iCACE;AAAA,wBAAC,uBAAoB;AAAA,IAMrB,oBAAC,qBAAkB;AAAA,IACnB,qBAAC,uBACC;AAAA,0BAAC,mBAAgB;AAAA,MACjB,oBAAC,sBAAmB;AAAA,MACpB,oBAAC,gBAAa;AAAA,MACd,oBAAC,mBAAgB;AAAA,MACjB,oBAAC,wBAAqB;AAAA,MACtB,oBAAC,wBAAqB;AAAA,MACrB;AAAA,OACH;AAAA,KACF,IAEA;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,7 +2,10 @@ import type { SelectedElement } from "../_vendor/schemas/generated/selectMode";
|
|
|
2
2
|
import type { IframeRpcChannelInputHandlers, IframeRpcChannelRemote } from "../_vendor/schemas/iframeRpcChannel";
|
|
3
3
|
import { canopyToWebsiteBuilderMethodConfig, websiteBuilderToCanopyMethodConfig } from "../_vendor/schemas/selectModeIframeRpc";
|
|
4
4
|
export type WebsiteBuilderRpcRemote = IframeRpcChannelRemote<typeof canopyToWebsiteBuilderMethodConfig>;
|
|
5
|
-
type SelectModeParentMessagingHandlers = Omit<IframeRpcChannelInputHandlers<typeof websiteBuilderToCanopyMethodConfig>, "symbolicateSelectedElement">;
|
|
5
|
+
type SelectModeParentMessagingHandlers = Omit<IframeRpcChannelInputHandlers<typeof websiteBuilderToCanopyMethodConfig>, "symbolicateSelectedElement" | "navigateToRoute">;
|
|
6
|
+
export declare function setNavigateToRouteHandler(handler: ((input: {
|
|
7
|
+
pathname: string;
|
|
8
|
+
}) => void) | null): void;
|
|
6
9
|
export declare function getSelectModeIframeRpcChannel(): import("../_vendor/schemas/iframeRpcChannel").IframeRpcChannel<{
|
|
7
10
|
requestInlineTextEdit: {
|
|
8
11
|
inputSchema: import("zod").ZodObject<{
|
|
@@ -10,6 +10,10 @@ import {
|
|
|
10
10
|
} from "../_vendor/schemas/selectModeIframeRpc.mjs";
|
|
11
11
|
import { symbolicateSelectedElement } from "./symbolicate";
|
|
12
12
|
let messagingHandlers = null;
|
|
13
|
+
let navigateToRouteHandler = null;
|
|
14
|
+
function setNavigateToRouteHandler(handler) {
|
|
15
|
+
navigateToRouteHandler = handler;
|
|
16
|
+
}
|
|
13
17
|
function createSelectModeIframeRpcChannel() {
|
|
14
18
|
return createIframeRpcChannel({
|
|
15
19
|
subscriberWindow: window,
|
|
@@ -50,6 +54,9 @@ function createSelectModeIframeRpcChannel() {
|
|
|
50
54
|
},
|
|
51
55
|
symbolicateSelectedElement: (element) => {
|
|
52
56
|
return symbolicateSelectedElement(element);
|
|
57
|
+
},
|
|
58
|
+
navigateToRoute: (input) => {
|
|
59
|
+
navigateToRouteHandler?.(input);
|
|
53
60
|
}
|
|
54
61
|
}
|
|
55
62
|
});
|
|
@@ -87,6 +94,7 @@ export {
|
|
|
87
94
|
getSelectModeIframeRpcChannel,
|
|
88
95
|
getWebsiteBuilderRpc,
|
|
89
96
|
requestInlineTextEdit,
|
|
97
|
+
setNavigateToRouteHandler,
|
|
90
98
|
setSelectModeParentHandlers
|
|
91
99
|
};
|
|
92
100
|
//# sourceMappingURL=iframeRpcChannel.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../select-mode/iframeRpcChannel.ts"],
|
|
4
|
-
"sourcesContent": ["import type { SelectedElement } from \"schemas/generated/selectMode\";\nimport type {\n IframeRpcChannelInputHandlers,\n IframeRpcChannelRemote,\n} from \"schemas/iframeRpcChannel\";\n\nimport {\n createIframeRpcChannel,\n createIframeRpcRemote,\n} from \"schemas/iframeRpcChannel\";\nimport {\n canopyToWebsiteBuilderMethodConfig,\n SELECT_MODE_IFRAME_RPC_CHANNEL_ID,\n SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION,\n websiteBuilderToCanopyMethodConfig,\n} from \"schemas/selectModeIframeRpc\";\n\nimport { symbolicateSelectedElement } from \"./symbolicate\";\n\nexport type WebsiteBuilderRpcRemote = IframeRpcChannelRemote<\n typeof canopyToWebsiteBuilderMethodConfig\n>;\n\ntype SelectModeParentMessagingHandlers = Omit<\n IframeRpcChannelInputHandlers<typeof websiteBuilderToCanopyMethodConfig>,\n \"symbolicateSelectedElement\"\n>;\n\n// Module-level handler pointers; `useParentMessaging` sets these on mount\n// and nulls them on unmount. Inbound void methods are dropped until then.\n// `symbolicateSelectedElement` is wired permanently on the channel.\nlet messagingHandlers: SelectModeParentMessagingHandlers | null = null;\n\nfunction createSelectModeIframeRpcChannel() {\n return createIframeRpcChannel({\n subscriberWindow: window,\n channelIdentifier: SELECT_MODE_IFRAME_RPC_CHANNEL_ID,\n version: SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION,\n getTargetWindow: () => (window.parent === window ? null : window.parent),\n targetOrigin: \"*\",\n isExpectedMessage: (event) => event.source === window.parent,\n outgoingMethods: canopyToWebsiteBuilderMethodConfig,\n incomingMethods: websiteBuilderToCanopyMethodConfig,\n handlers: {\n setDisplayMode: (input) => {\n messagingHandlers?.setDisplayMode(input);\n },\n setSelectionType: (input) => {\n messagingHandlers?.setSelectionType(input);\n },\n applyOptimisticUpdate: (input) => {\n messagingHandlers?.applyOptimisticUpdate(input);\n },\n markCommitted: (input) => {\n messagingHandlers?.markCommitted(input);\n },\n resolveSessionOverrides: (input) => {\n messagingHandlers?.resolveSessionOverrides(input);\n },\n revertOverride: (input) => {\n messagingHandlers?.revertOverride(input);\n },\n enterEditMode: (input) => {\n messagingHandlers?.enterEditMode(input);\n },\n exitEditMode: (input) => {\n messagingHandlers?.exitEditMode(input);\n },\n formatCommand: (input) => {\n messagingHandlers?.formatCommand(input);\n },\n symbolicateSelectedElement: (element) => {\n return symbolicateSelectedElement(element);\n },\n },\n });\n}\n\nlet channel: ReturnType<typeof createSelectModeIframeRpcChannel> | null = null;\nlet websiteBuilderRpc: WebsiteBuilderRpcRemote | null = null;\n\nexport function getSelectModeIframeRpcChannel() {\n if (typeof window === \"undefined\") {\n return null;\n }\n channel ??= createSelectModeIframeRpcChannel();\n return channel;\n}\n\nexport function setSelectModeParentHandlers(\n nextHandlers: SelectModeParentMessagingHandlers | null,\n) {\n messagingHandlers = nextHandlers;\n}\n\nexport function getWebsiteBuilderRpc(): WebsiteBuilderRpcRemote | null {\n const currentChannel = getSelectModeIframeRpcChannel();\n if (!currentChannel) {\n return null;\n }\n websiteBuilderRpc ??= createIframeRpcRemote(currentChannel);\n return websiteBuilderRpc;\n}\n\nexport function requestInlineTextEdit(input: {\n editId: string;\n element: SelectedElement;\n}) {\n const remote = getWebsiteBuilderRpc();\n if (!remote) {\n return Promise.reject(\n new Error(\"Website Builder iframe RPC is unavailable\"),\n );\n }\n return remote.requestInlineTextEdit(input);\n}\n"],
|
|
5
|
-
"mappings": "AAMA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,kCAAkC;AAc3C,IAAI,oBAA8D;
|
|
4
|
+
"sourcesContent": ["import type { SelectedElement } from \"schemas/generated/selectMode\";\nimport type {\n IframeRpcChannelInputHandlers,\n IframeRpcChannelRemote,\n} from \"schemas/iframeRpcChannel\";\n\nimport {\n createIframeRpcChannel,\n createIframeRpcRemote,\n} from \"schemas/iframeRpcChannel\";\nimport {\n canopyToWebsiteBuilderMethodConfig,\n SELECT_MODE_IFRAME_RPC_CHANNEL_ID,\n SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION,\n websiteBuilderToCanopyMethodConfig,\n} from \"schemas/selectModeIframeRpc\";\n\nimport { symbolicateSelectedElement } from \"./symbolicate\";\n\nexport type WebsiteBuilderRpcRemote = IframeRpcChannelRemote<\n typeof canopyToWebsiteBuilderMethodConfig\n>;\n\ntype SelectModeParentMessagingHandlers = Omit<\n IframeRpcChannelInputHandlers<typeof websiteBuilderToCanopyMethodConfig>,\n \"symbolicateSelectedElement\" | \"navigateToRoute\"\n>;\n\n// Module-level handler pointers; `useParentMessaging` sets these on mount\n// and nulls them on unmount. Inbound void methods are dropped until then.\n// `symbolicateSelectedElement` is wired permanently on the channel.\nlet messagingHandlers: SelectModeParentMessagingHandlers | null = null;\n\n// Set by `NavigationReceiver` while a router is mounted; unhandled commands are dropped.\nlet navigateToRouteHandler: ((input: { pathname: string }) => void) | null =\n null;\n\nexport function setNavigateToRouteHandler(\n handler: ((input: { pathname: string }) => void) | null,\n) {\n navigateToRouteHandler = handler;\n}\n\nfunction createSelectModeIframeRpcChannel() {\n return createIframeRpcChannel({\n subscriberWindow: window,\n channelIdentifier: SELECT_MODE_IFRAME_RPC_CHANNEL_ID,\n version: SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION,\n getTargetWindow: () => (window.parent === window ? null : window.parent),\n targetOrigin: \"*\",\n isExpectedMessage: (event) => event.source === window.parent,\n outgoingMethods: canopyToWebsiteBuilderMethodConfig,\n incomingMethods: websiteBuilderToCanopyMethodConfig,\n handlers: {\n setDisplayMode: (input) => {\n messagingHandlers?.setDisplayMode(input);\n },\n setSelectionType: (input) => {\n messagingHandlers?.setSelectionType(input);\n },\n applyOptimisticUpdate: (input) => {\n messagingHandlers?.applyOptimisticUpdate(input);\n },\n markCommitted: (input) => {\n messagingHandlers?.markCommitted(input);\n },\n resolveSessionOverrides: (input) => {\n messagingHandlers?.resolveSessionOverrides(input);\n },\n revertOverride: (input) => {\n messagingHandlers?.revertOverride(input);\n },\n enterEditMode: (input) => {\n messagingHandlers?.enterEditMode(input);\n },\n exitEditMode: (input) => {\n messagingHandlers?.exitEditMode(input);\n },\n formatCommand: (input) => {\n messagingHandlers?.formatCommand(input);\n },\n symbolicateSelectedElement: (element) => {\n return symbolicateSelectedElement(element);\n },\n navigateToRoute: (input) => {\n navigateToRouteHandler?.(input);\n },\n },\n });\n}\n\nlet channel: ReturnType<typeof createSelectModeIframeRpcChannel> | null = null;\nlet websiteBuilderRpc: WebsiteBuilderRpcRemote | null = null;\n\nexport function getSelectModeIframeRpcChannel() {\n if (typeof window === \"undefined\") {\n return null;\n }\n channel ??= createSelectModeIframeRpcChannel();\n return channel;\n}\n\nexport function setSelectModeParentHandlers(\n nextHandlers: SelectModeParentMessagingHandlers | null,\n) {\n messagingHandlers = nextHandlers;\n}\n\nexport function getWebsiteBuilderRpc(): WebsiteBuilderRpcRemote | null {\n const currentChannel = getSelectModeIframeRpcChannel();\n if (!currentChannel) {\n return null;\n }\n websiteBuilderRpc ??= createIframeRpcRemote(currentChannel);\n return websiteBuilderRpc;\n}\n\nexport function requestInlineTextEdit(input: {\n editId: string;\n element: SelectedElement;\n}) {\n const remote = getWebsiteBuilderRpc();\n if (!remote) {\n return Promise.reject(\n new Error(\"Website Builder iframe RPC is unavailable\"),\n );\n }\n return remote.requestInlineTextEdit(input);\n}\n"],
|
|
5
|
+
"mappings": "AAMA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,kCAAkC;AAc3C,IAAI,oBAA8D;AAGlE,IAAI,yBACF;AAEK,SAAS,0BACd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