@backmatter/studio 0.0.3 → 0.0.5
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/chunks/EmbedPublishPage-hx1xoAhI.js +149 -0
- package/dist/chunks/{UiKitPage-CTZtLwJ0.js → UiKitPage-BOunq6mr.js} +12 -11
- package/dist/chunks/WorkspaceRoutes-CTFTWu3L.js +57731 -0
- package/dist/chunks/{dashboard-nvFBzpZv.js → dashboard-upmiawx5.js} +216 -215
- package/dist/chunks/{index-Cr-IOgdC.js → index-CBvevwfT.js} +9 -8
- package/dist/chunks/status-bar-action-DiXhfcj3.js +30254 -0
- package/dist/dashboard.js +2 -2
- package/dist/index.js +139 -228
- package/dist/site-widget.js +294 -0
- package/dist/studio.css +46 -6
- package/package.json +6 -1
- package/src/chat/ChangeCard.tsx +11 -6
- package/src/chat/ChatMessage.tsx +27 -2
- package/src/chat/ChatPanel.tsx +13 -3
- package/src/chat/ChatProvider.tsx +6 -2
- package/src/chat/Composer.tsx +33 -24
- package/src/chat/DocLink.tsx +31 -0
- package/src/chat/DocListCard.tsx +3 -3
- package/src/chat/PointerChip.tsx +139 -0
- package/src/chat/chat-context.ts +14 -0
- package/src/chat/icons.tsx +10 -0
- package/src/chat/session-expiry.ts +8 -5
- package/src/chrome/OpenSiteButton.tsx +33 -25
- package/src/pages/EmbedPublishPage.tsx +279 -84
- package/src/pages/SettingsGeneralPage.tsx +2 -0
- package/src/pages/host-env.ts +6 -1
- package/src/site-pointer.ts +271 -0
- package/src/site-widget.tsx +395 -0
- package/dist/chunks/WorkspaceRoutes-DyRVES9t.js +0 -87308
package/dist/dashboard.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as a, i as s } from "./chunks/dashboard-
|
|
2
|
-
import {
|
|
1
|
+
import { A as a, i as s } from "./chunks/dashboard-upmiawx5.js";
|
|
2
|
+
import { c as t, I as f } from "./chunks/status-bar-action-DiXhfcj3.js";
|
|
3
3
|
export {
|
|
4
4
|
a as DashboardApp,
|
|
5
5
|
t as configureStudio,
|
package/dist/index.js
CHANGED
|
@@ -1,39 +1,42 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useLayoutEffect as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { jsx as r, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { useLayoutEffect as I, useEffect as u, useRef as C, useState as S } from "react";
|
|
3
|
+
import { k as L, T, E as N, C as M, b as D, d as z, u as O, D as g, f as x, i as b, j as _, F as A, G as B, H as F, c as P, I as w, J as j, K as G, n as q, R as H, L as m, N as v } from "./chunks/status-bar-action-DiXhfcj3.js";
|
|
4
|
+
import { M as Se } from "./chunks/status-bar-action-DiXhfcj3.js";
|
|
5
|
+
import { f as V, s as K, g as $, R as W, h as J, i as X, L as Y, w as Q, T as E, r as Z } from "./chunks/WorkspaceRoutes-CTFTWu3L.js";
|
|
6
|
+
import { u as ee, S as te } from "./chunks/define-studio-BYtYDGLX.js";
|
|
7
|
+
import { d as Pe } from "./chunks/define-studio-BYtYDGLX.js";
|
|
8
|
+
import { E as ne } from "./chunks/EmbedPublishPage-hx1xoAhI.js";
|
|
9
|
+
const p = {
|
|
8
10
|
accent: "var(--x11n7hvk)",
|
|
9
11
|
accentHover: "var(--x1vnpaut)",
|
|
10
12
|
focus: "var(--x1nzi8h4)"
|
|
11
13
|
};
|
|
12
|
-
function
|
|
14
|
+
function re(e) {
|
|
13
15
|
const t = /^var\((--[^,)]+)/.exec(e);
|
|
14
16
|
return (t == null ? void 0 : t[1]) ?? null;
|
|
15
17
|
}
|
|
16
|
-
const
|
|
17
|
-
function
|
|
18
|
-
var t,
|
|
19
|
-
const e = (
|
|
20
|
-
return
|
|
18
|
+
const oe = [p.accent, p.accentHover, p.focus];
|
|
19
|
+
function ie() {
|
|
20
|
+
var t, i;
|
|
21
|
+
const e = (i = (t = ee().theme) == null ? void 0 : t.accent) == null ? void 0 : i.trim();
|
|
22
|
+
return I(() => {
|
|
21
23
|
if (!e) return;
|
|
22
|
-
const a = document.documentElement,
|
|
23
|
-
for (const o of
|
|
24
|
+
const a = document.documentElement, n = oe.map(re).filter((o) => !!o);
|
|
25
|
+
for (const o of n) a.style.setProperty(o, e);
|
|
24
26
|
return () => {
|
|
25
|
-
for (const o of
|
|
27
|
+
for (const o of n) a.style.removeProperty(o);
|
|
26
28
|
};
|
|
27
29
|
}, [e]), null;
|
|
28
30
|
}
|
|
29
|
-
function
|
|
30
|
-
return
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
31
|
+
function ae({ workspaceId: e }) {
|
|
32
|
+
return u(() => L(), []), /* @__PURE__ */ r(T, { children: /* @__PURE__ */ r(N, { children: /* @__PURE__ */ r(M, { workspaceId: e, startOpen: !0, pointer: !0, children: /* @__PURE__ */ l(D, { children: [
|
|
33
|
+
/* @__PURE__ */ r(se, {}),
|
|
34
|
+
/* @__PURE__ */ r(ce, {}),
|
|
35
|
+
/* @__PURE__ */ r(de, {}),
|
|
36
|
+
/* @__PURE__ */ r(z, { fill: !0 })
|
|
34
37
|
] }) }) }) });
|
|
35
38
|
}
|
|
36
|
-
function
|
|
39
|
+
function f() {
|
|
37
40
|
if (!document.referrer) return "";
|
|
38
41
|
try {
|
|
39
42
|
return new URL(document.referrer).origin;
|
|
@@ -41,15 +44,15 @@ function k() {
|
|
|
41
44
|
return "";
|
|
42
45
|
}
|
|
43
46
|
}
|
|
44
|
-
function
|
|
45
|
-
const { setFocus: e } =
|
|
46
|
-
return
|
|
47
|
-
const t =
|
|
48
|
-
function
|
|
47
|
+
function se() {
|
|
48
|
+
const { setFocus: e } = O();
|
|
49
|
+
return u(() => {
|
|
50
|
+
const t = f();
|
|
51
|
+
function i(a) {
|
|
49
52
|
if (!t || a.origin !== t) return;
|
|
50
|
-
const
|
|
51
|
-
if ((
|
|
52
|
-
const o =
|
|
53
|
+
const n = a.data;
|
|
54
|
+
if ((n == null ? void 0 : n.type) !== "backmatter:focus") return;
|
|
55
|
+
const o = n.doc;
|
|
53
56
|
!(o != null && o.locale) || !o.type || !o.slug || e({
|
|
54
57
|
docRef: { locale: o.locale, type: o.type, slug: o.slug },
|
|
55
58
|
frontmatter: {},
|
|
@@ -57,160 +60,68 @@ function Te() {
|
|
|
57
60
|
selection: null
|
|
58
61
|
});
|
|
59
62
|
}
|
|
60
|
-
return window.addEventListener("message",
|
|
61
|
-
}, [e]),
|
|
62
|
-
const t =
|
|
63
|
-
function
|
|
64
|
-
const
|
|
65
|
-
!t || !(
|
|
63
|
+
return window.addEventListener("message", i), t && window.parent.postMessage({ type: "backmatter:chat-ready" }, t), () => window.removeEventListener("message", i);
|
|
64
|
+
}, [e]), u(() => {
|
|
65
|
+
const t = f();
|
|
66
|
+
function i(a) {
|
|
67
|
+
const n = a.detail;
|
|
68
|
+
!t || !(n != null && n.docRef) || window.parent.postMessage({ type: "backmatter:doc-changed", doc: n.docRef }, t);
|
|
66
69
|
}
|
|
67
|
-
return window.addEventListener(
|
|
70
|
+
return window.addEventListener(g, i), () => window.removeEventListener(g, i);
|
|
68
71
|
}, []), null;
|
|
69
72
|
}
|
|
70
|
-
function
|
|
71
|
-
const {
|
|
72
|
-
return
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
function ce() {
|
|
74
|
+
const { addPointer: e } = x();
|
|
75
|
+
return u(() => {
|
|
76
|
+
const t = f();
|
|
77
|
+
function i(a) {
|
|
78
|
+
if (!t || a.origin !== t || a.source !== window.parent) return;
|
|
79
|
+
const n = a.data;
|
|
80
|
+
if ((n == null ? void 0 : n.type) !== "backmatter:pointer-grab") return;
|
|
81
|
+
const o = _(
|
|
82
|
+
n.doc ?? {},
|
|
83
|
+
n.grab
|
|
84
|
+
);
|
|
85
|
+
o && e(o);
|
|
86
|
+
}
|
|
87
|
+
return window.addEventListener("message", i), () => window.removeEventListener("message", i);
|
|
88
|
+
}, [e]), null;
|
|
89
|
+
}
|
|
90
|
+
function de() {
|
|
91
|
+
const { panel: e, dispatch: t } = x(), i = e.mode, a = C(i);
|
|
92
|
+
return u(() => {
|
|
93
|
+
const n = f();
|
|
94
|
+
if (!n || window.parent === window) return;
|
|
95
|
+
const o = b(a.current);
|
|
96
|
+
a.current = i, o && !b(i) && window.parent.postMessage({ type: "backmatter:chat-closed" }, n);
|
|
97
|
+
}, [i]), u(() => {
|
|
98
|
+
const n = f();
|
|
99
|
+
function o(c) {
|
|
100
|
+
var d;
|
|
101
|
+
!n || c.origin !== n || ((d = c.data) == null ? void 0 : d.type) === "backmatter:chat-open" && (t({ type: "open" }), requestAnimationFrame(() => {
|
|
82
102
|
window.dispatchEvent(new Event("backmatter:chat-focus"));
|
|
83
103
|
}));
|
|
84
104
|
}
|
|
85
105
|
return window.addEventListener("message", o), () => window.removeEventListener("message", o);
|
|
86
106
|
}, [t]), null;
|
|
87
107
|
}
|
|
88
|
-
const
|
|
89
|
-
function
|
|
90
|
-
if (!document.referrer) return "";
|
|
91
|
-
try {
|
|
92
|
-
return new URL(document.referrer).origin;
|
|
93
|
-
} catch {
|
|
94
|
-
return "";
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
function $e(e) {
|
|
98
|
-
if (!(e instanceof Error)) return "Commit failed";
|
|
99
|
-
const t = e;
|
|
100
|
-
return t.code === "conflict" ? "Resolve conflicts before committing" : t.code === "nothing_to_commit" ? "Nothing to commit" : t.code === "validation" ? e.message.replace(/^validation:\s*/, "Validation failed: ") : t.code === "github_not_bound" ? "Connect GitHub first" : e.message;
|
|
101
|
-
}
|
|
102
|
-
function q(e) {
|
|
103
|
-
return `${e.locale}/${e.type}/${e.slug}`;
|
|
104
|
-
}
|
|
105
|
-
function De({
|
|
106
|
-
workspaceId: e
|
|
107
|
-
}) {
|
|
108
|
-
g(() => B(), []);
|
|
109
|
-
const [t, r] = w(null), [a, s] = w("viewer"), [o, d] = w(""), [f, m] = w(null), [c, y] = w(!1), [U, N] = w(null);
|
|
110
|
-
g(() => {
|
|
111
|
-
let i = !1;
|
|
112
|
-
return G(e).then((l) => {
|
|
113
|
-
i || s(l.workspace.role);
|
|
114
|
-
}).catch(() => {
|
|
115
|
-
i || m("Could not load this workspace");
|
|
116
|
-
}), () => {
|
|
117
|
-
i = !0;
|
|
118
|
-
};
|
|
119
|
-
}, [e]), g(() => {
|
|
120
|
-
let i = !1;
|
|
121
|
-
const l = () => {
|
|
122
|
-
S(e).then((u) => {
|
|
123
|
-
if (i) return;
|
|
124
|
-
r(u);
|
|
125
|
-
const T = O();
|
|
126
|
-
T && window.parent.postMessage({
|
|
127
|
-
type: "backmatter:git",
|
|
128
|
-
changeCount: u.changes.length,
|
|
129
|
-
conflictCount: $(u)
|
|
130
|
-
}, T);
|
|
131
|
-
}).catch((u) => {
|
|
132
|
-
i || m(u instanceof Error ? u.message : "Git status failed");
|
|
133
|
-
});
|
|
134
|
-
};
|
|
135
|
-
l();
|
|
136
|
-
const v = window.setInterval(l, _e);
|
|
137
|
-
return () => {
|
|
138
|
-
i = !0, window.clearInterval(v);
|
|
139
|
-
};
|
|
140
|
-
}, [e]);
|
|
141
|
-
const h = (t == null ? void 0 : t.changes) ?? [], x = $(t), E = ae(x, fe(a)), V = Q(() => h.filter((i) => i.status === "conflict"), [h]), F = re(h);
|
|
142
|
-
async function L(i, l) {
|
|
143
|
-
const v = `${q(i)}:${l}`;
|
|
144
|
-
N(v), m(null);
|
|
145
|
-
try {
|
|
146
|
-
await ce(e, i.locale, i.type, i.slug, l), le({
|
|
147
|
-
workspaceId: e,
|
|
148
|
-
locale: i.locale,
|
|
149
|
-
type: i.type,
|
|
150
|
-
slug: i.slug,
|
|
151
|
-
status: l === "theirs" ? "clean" : "modified"
|
|
152
|
-
});
|
|
153
|
-
const u = await S(e);
|
|
154
|
-
r(u);
|
|
155
|
-
} catch (u) {
|
|
156
|
-
m(u instanceof Error ? u.message : "Resolve failed");
|
|
157
|
-
} finally {
|
|
158
|
-
N(null);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
async function H(i) {
|
|
162
|
-
if (i.preventDefault(), !(c || E !== "commit" || h.length === 0)) {
|
|
163
|
-
y(!0), m(null);
|
|
164
|
-
try {
|
|
165
|
-
const l = await ue(e, o);
|
|
166
|
-
d(""), de(e, l.files);
|
|
167
|
-
const v = O();
|
|
168
|
-
v && window.parent.postMessage({
|
|
169
|
-
type: "backmatter:published"
|
|
170
|
-
}, v), r(await S(e));
|
|
171
|
-
} catch (l) {
|
|
172
|
-
m($e(l));
|
|
173
|
-
} finally {
|
|
174
|
-
y(!1);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
const W = c ? "Committing…" : x > 0 ? `Resolve ${x} ${x === 1 ? "conflict" : "conflicts"}` : E === "blocked" ? "Writers cannot publish" : h.length === 0 ? "Nothing to publish" : `Deploy ${h.length} ${h.length === 1 ? "change" : "changes"}`;
|
|
179
|
-
return /* @__PURE__ */ p("form", { className: "x78zum5 xdt5ytf x11cgr9k x1us19tq x9f619 x1t7e3gq x1hb2obb xqjzbou x1vrk1b5", onSubmit: (i) => void H(i), children: [
|
|
180
|
-
/* @__PURE__ */ n(b, { as: "p", size: "sm", weight: "medium", tone: "muted", children: (t == null ? void 0 : t.currentBranch) ?? "Publish" }),
|
|
181
|
-
h.length === 0 ? /* @__PURE__ */ n(b, { as: "p", size: "sm", tone: "muted", children: "Nothing to publish" }) : /* @__PURE__ */ n("ul", { className: "x1ghz6dp x1717udv xe8uvvx x78zum5 xdt5ytf x1ndbd79", children: h.map((i) => /* @__PURE__ */ p("li", { className: "x78zum5 xdt5ytf x3smv4v", children: [
|
|
182
|
-
/* @__PURE__ */ p("span", { children: [
|
|
183
|
-
i.status,
|
|
184
|
-
" ",
|
|
185
|
-
i.type,
|
|
186
|
-
"/",
|
|
187
|
-
i.slug
|
|
188
|
-
] }),
|
|
189
|
-
i.status === "conflict" ? /* @__PURE__ */ p("span", { className: "x78zum5 x3smv4v", children: [
|
|
190
|
-
/* @__PURE__ */ n(C, { size: "sm", variant: "secondary", disabled: U !== null, onClick: () => void L(i, "mine"), children: "Keep mine" }),
|
|
191
|
-
/* @__PURE__ */ n(C, { size: "sm", variant: "secondary", disabled: U !== null, onClick: () => void L(i, "theirs"), children: "Take theirs" })
|
|
192
|
-
] }) : null
|
|
193
|
-
] }, q(i))) }),
|
|
194
|
-
V.length > 0 ? null : /* @__PURE__ */ n(se, { value: o, placeholder: F, "aria-label": "Commit message", onChange: (i) => d(i.target.value) }),
|
|
195
|
-
f ? /* @__PURE__ */ n(b, { as: "p", size: "sm", tone: "danger", children: f }) : null,
|
|
196
|
-
/* @__PURE__ */ n(C, { type: "submit", size: "sm", disabled: c || E !== "commit" || h.length === 0, children: W })
|
|
197
|
-
] });
|
|
198
|
-
}
|
|
199
|
-
const I = "backmatter:enter-at", Oe = 1e4;
|
|
200
|
-
function K(e, t) {
|
|
108
|
+
const k = "backmatter:enter-at", ue = 1e4;
|
|
109
|
+
function R(e, t) {
|
|
201
110
|
if (typeof window > "u") return !1;
|
|
202
|
-
const
|
|
203
|
-
if (
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
111
|
+
const i = !!(window.top && window.top !== window);
|
|
112
|
+
if (B(i) === "parent")
|
|
113
|
+
return window.parent.postMessage({
|
|
114
|
+
type: F
|
|
115
|
+
}, window.location.origin), !0;
|
|
116
|
+
const a = Number(window.sessionStorage.getItem(k) ?? 0);
|
|
117
|
+
return Date.now() - a < ue ? !1 : (window.sessionStorage.setItem(k, String(Date.now())), window.location.assign(K(t, {
|
|
207
118
|
workspaceId: e,
|
|
208
|
-
returnUrl:
|
|
209
|
-
})), !0;
|
|
119
|
+
returnUrl: window.location.href
|
|
120
|
+
})), !0);
|
|
210
121
|
}
|
|
211
|
-
function
|
|
122
|
+
function le(e) {
|
|
212
123
|
const t = e.dashboardUrl ?? "https://dash.backmatter.app";
|
|
213
|
-
return
|
|
124
|
+
return P({
|
|
214
125
|
baseUrl: e.proxyPath ?? "/api/backmatter/cms",
|
|
215
126
|
publicApiUrl: e.apiUrl,
|
|
216
127
|
credentials: "same-origin",
|
|
@@ -218,79 +129,79 @@ function qe(e) {
|
|
|
218
129
|
version: e.version,
|
|
219
130
|
dashboardUrl: t,
|
|
220
131
|
onUnauthorized: ({
|
|
221
|
-
status:
|
|
132
|
+
status: i
|
|
222
133
|
}) => {
|
|
223
|
-
|
|
134
|
+
i === 401 && R(e.workspaceId, t);
|
|
224
135
|
}
|
|
225
|
-
}),
|
|
136
|
+
}), w();
|
|
226
137
|
}
|
|
227
|
-
function
|
|
228
|
-
const t = e.basePath ?? "/backmatter", [
|
|
229
|
-
return /* @__PURE__ */
|
|
230
|
-
/* @__PURE__ */
|
|
231
|
-
/* @__PURE__ */
|
|
138
|
+
function Ee(e) {
|
|
139
|
+
const t = e.basePath ?? "/backmatter", [i] = S(() => le(e));
|
|
140
|
+
return /* @__PURE__ */ r(te, { definition: e.studio, children: /* @__PURE__ */ l(V, { children: [
|
|
141
|
+
/* @__PURE__ */ r(ie, {}),
|
|
142
|
+
/* @__PURE__ */ r(A, { basename: t, children: /* @__PURE__ */ r(fe, { ...e }) })
|
|
232
143
|
] }) });
|
|
233
144
|
}
|
|
234
|
-
function
|
|
235
|
-
const t =
|
|
236
|
-
if (
|
|
237
|
-
let
|
|
238
|
-
const
|
|
239
|
-
return
|
|
240
|
-
...
|
|
241
|
-
onUnauthorized: (
|
|
242
|
-
|
|
145
|
+
function fe(e) {
|
|
146
|
+
const t = j(), i = e.dashboardUrl ?? "https://dash.backmatter.app", [a, n] = S("loading");
|
|
147
|
+
if (u(() => {
|
|
148
|
+
let d = !1;
|
|
149
|
+
const h = w().onUnauthorized;
|
|
150
|
+
return P({
|
|
151
|
+
...w(),
|
|
152
|
+
onUnauthorized: (s) => {
|
|
153
|
+
s.status === 426 ? n("outdated") : h == null || h(s);
|
|
243
154
|
}
|
|
244
|
-
}),
|
|
245
|
-
if (
|
|
246
|
-
if (!(
|
|
247
|
-
|
|
155
|
+
}), G().then(async (s) => {
|
|
156
|
+
if (d) return;
|
|
157
|
+
if (!(s != null && s.user)) {
|
|
158
|
+
R(e.workspaceId, i) || n("unauthorized");
|
|
248
159
|
return;
|
|
249
160
|
}
|
|
250
161
|
const {
|
|
251
|
-
workspace:
|
|
252
|
-
} = await
|
|
253
|
-
|
|
162
|
+
workspace: U
|
|
163
|
+
} = await q(e.workspaceId);
|
|
164
|
+
d || n({
|
|
254
165
|
user: {
|
|
255
|
-
id:
|
|
256
|
-
email:
|
|
166
|
+
id: s.user.id,
|
|
167
|
+
email: s.user.email
|
|
257
168
|
},
|
|
258
|
-
slug:
|
|
169
|
+
slug: U.slug
|
|
259
170
|
});
|
|
260
171
|
}).catch(() => {
|
|
261
|
-
|
|
172
|
+
d || n((s) => s === "outdated" ? s : "unauthorized");
|
|
262
173
|
}), () => {
|
|
263
|
-
|
|
174
|
+
d = !0;
|
|
264
175
|
};
|
|
265
|
-
}, [e.workspaceId,
|
|
176
|
+
}, [e.workspaceId, i]), a === "loading") return /* @__PURE__ */ r($, {});
|
|
266
177
|
if (a === "outdated")
|
|
267
|
-
return /* @__PURE__ */
|
|
178
|
+
return /* @__PURE__ */ l(y, { title: "This site's editor is out of date", children: [
|
|
268
179
|
"Update ",
|
|
269
|
-
/* @__PURE__ */
|
|
180
|
+
/* @__PURE__ */ r("code", { children: "@backmatter/studio" }),
|
|
270
181
|
" and ",
|
|
271
|
-
/* @__PURE__ */
|
|
182
|
+
/* @__PURE__ */ r("code", { children: "@backmatter/next" }),
|
|
272
183
|
" on the site, then reload."
|
|
273
184
|
] });
|
|
274
185
|
if (a === "unauthorized")
|
|
275
|
-
return /* @__PURE__ */
|
|
186
|
+
return /* @__PURE__ */ l(y, { title: "Could not start editing", children: [
|
|
276
187
|
"The site did not receive a session from the dashboard. Check that this site's origin is listed in the workspace settings and that ",
|
|
277
|
-
/* @__PURE__ */
|
|
188
|
+
/* @__PURE__ */ r("code", { children: "/api/backmatter" }),
|
|
278
189
|
" routes are deployed."
|
|
279
190
|
] });
|
|
280
191
|
const o = t.pathname.match(/^\/embed\/chat\/([^/]+)\/?$/);
|
|
281
192
|
if (o != null && o[1])
|
|
282
|
-
return /* @__PURE__ */
|
|
283
|
-
const
|
|
284
|
-
return
|
|
285
|
-
|
|
286
|
-
}, children: /* @__PURE__ */
|
|
287
|
-
/* @__PURE__ */
|
|
288
|
-
/* @__PURE__ */
|
|
289
|
-
|
|
290
|
-
/* @__PURE__ */
|
|
193
|
+
return /* @__PURE__ */ r(ae, { workspaceId: decodeURIComponent(o[1]) });
|
|
194
|
+
const c = t.pathname.match(/^\/embed\/publish\/([^/]+)\/?$/);
|
|
195
|
+
return c != null && c[1] ? /* @__PURE__ */ r(ne, { workspaceId: decodeURIComponent(c[1]) }) : /* @__PURE__ */ r(W, { user: a.user, children: /* @__PURE__ */ r(J, { children: /* @__PURE__ */ r(X, { userId: a.user.id, email: a.user.email, onLogout: () => {
|
|
196
|
+
he(e.previewEntryPath ?? "/api/backmatter/preview", i);
|
|
197
|
+
}, children: /* @__PURE__ */ l(H, { children: [
|
|
198
|
+
/* @__PURE__ */ r(m, { path: "/", element: /* @__PURE__ */ r(v, { to: `/${a.slug}`, replace: !0 }) }),
|
|
199
|
+
/* @__PURE__ */ r(m, { path: "/workspaces/:workspaceId/*", element: /* @__PURE__ */ r(Y, {}) }),
|
|
200
|
+
Q(),
|
|
201
|
+
/* @__PURE__ */ r(m, { path: "*", element: /* @__PURE__ */ r(v, { to: "/", replace: !0 }) })
|
|
291
202
|
] }) }) }) });
|
|
292
203
|
}
|
|
293
|
-
async function
|
|
204
|
+
async function he(e, t) {
|
|
294
205
|
try {
|
|
295
206
|
await fetch(e, {
|
|
296
207
|
method: "POST",
|
|
@@ -298,23 +209,23 @@ async function Ae(e, t) {
|
|
|
298
209
|
});
|
|
299
210
|
} catch {
|
|
300
211
|
}
|
|
301
|
-
|
|
212
|
+
Z.wipe(), window.location.assign(t);
|
|
302
213
|
}
|
|
303
|
-
function
|
|
214
|
+
function y({
|
|
304
215
|
title: e,
|
|
305
216
|
children: t
|
|
306
217
|
}) {
|
|
307
|
-
return /* @__PURE__ */
|
|
308
|
-
/* @__PURE__ */
|
|
309
|
-
/* @__PURE__ */
|
|
218
|
+
return /* @__PURE__ */ r("div", { className: "x1ov3xa9 xrvj5dj x1ku5rj1 x1t7e3gq", children: /* @__PURE__ */ l("div", { className: "x78zum5 xdt5ytf x1ndbd79 xq2pcee x1t7e3gq x4pepcl x1d0qn7y", children: [
|
|
219
|
+
/* @__PURE__ */ r(E, { size: "lg", weight: "medium", children: e }),
|
|
220
|
+
/* @__PURE__ */ r(E, { tone: "muted", children: t })
|
|
310
221
|
] }) });
|
|
311
222
|
}
|
|
312
223
|
export {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
224
|
+
Ee as SiteStudio,
|
|
225
|
+
Se as apiUrl,
|
|
226
|
+
R as bounceToEnter,
|
|
227
|
+
le as configureSiteStudio,
|
|
228
|
+
P as configureStudio,
|
|
229
|
+
Pe as defineStudio,
|
|
230
|
+
w as studioConfig
|
|
320
231
|
};
|