camox 0.51.0 → 0.52.2
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/core/createApp.d.ts +1 -0
- package/dist/core/createApp.js +1 -0
- package/dist/core/editing/contentEdits.js +78 -0
- package/dist/core/editing/createEditableBlock.js +277 -311
- package/dist/core/lib/contentType.js +2 -2
- package/dist/core/recordItem.js +3 -3
- package/dist/features/canvas/CamoxCanvas.js +15 -15
- package/dist/features/canvas/CanvasLoadingScreen.js +15 -11
- package/dist/features/canvas/CanvasPageFrame.js +81 -87
- package/dist/features/canvas/CanvasPreviewPageSlot.js +1 -1
- package/dist/features/canvas/DerivedPagePathInput.js +12 -12
- package/dist/features/canvas/canvasOverlayGeometry.js +1 -1
- package/dist/features/canvas/canvasStore.js +2 -2
- package/dist/features/canvas/sidebar/CuratedPageInspector.js +1 -1
- package/dist/features/canvas/sidebar/LayoutPageBlocks.js +23 -31
- package/dist/features/canvas/useCanvasCamera.js +1 -1
- package/dist/features/canvas/useDiscoveredPreviewPaths.js +16 -9
- package/dist/features/page/CuratedPageContent.js +1 -1
- package/dist/features/preview/CamoxPreview.d.ts +8 -4
- package/dist/features/preview/CamoxPreview.js +257 -442
- package/dist/features/preview/EditablePageContent.js +244 -2
- package/dist/features/preview/EditablePageExperience.js +2 -4
- package/dist/features/preview/components/AddBlockSheet.js +55 -15
- package/dist/features/preview/components/BlockActionsPopover.js +12 -16
- package/dist/features/preview/components/BlockPeek.js +66 -0
- package/dist/features/preview/components/BlockThumbnail.js +134 -119
- package/dist/features/preview/components/CanvasPreview.js +1 -1
- package/dist/features/preview/components/CreatePageModal.js +150 -156
- package/dist/features/preview/components/Frame.js +27 -4
- package/dist/features/preview/components/MobilePreviewDrawer.js +1 -1
- package/dist/features/preview/components/PageInfo.js +161 -126
- package/dist/features/preview/components/PagePicker.js +2 -2
- package/dist/features/preview/components/PageTree.js +174 -190
- package/dist/features/preview/components/PreviewPanel.js +3 -3
- package/dist/features/preview/components/ReferenceFieldEditor.js +4 -4
- package/dist/features/preview/components/ReferenceListFieldEditor.js +4 -4
- package/dist/features/preview/components/RemovedBlockPlaceholder.js +37 -70
- package/dist/features/preview/components/RepeatableItemsList.js +1 -1
- package/dist/features/preview/components/SelectionEditor.js +248 -256
- package/dist/features/preview/components/StudioEditingFallback.js +22 -26
- package/dist/features/preview/components/useFieldWriter.js +19 -19
- package/dist/features/preview/components/useRecordView.js +105 -147
- package/dist/features/preview/components/useRepeatableItemActions.js +0 -2
- package/dist/features/preview/pageRecord.js +30 -24
- package/dist/features/preview/previewStore.js +2 -0
- package/dist/features/preview/studioNotice.js +20 -0
- package/dist/features/provider/AuthenticatedCamoxProvider.js +46 -30
- package/dist/features/renderer/RendererApp.js +542 -0
- package/dist/features/renderer/RendererFrames.js +450 -0
- package/dist/features/renderer/definitionAnswers.js +26 -0
- package/dist/features/renderer/protocol.js +35 -0
- package/dist/features/renderer/rendererHost.js +249 -0
- package/dist/features/renderer/studioConnection.js +186 -0
- package/dist/features/routes/pageRuntime.js +7 -2
- package/dist/features/runtime/RuntimeChrome.js +2 -5
- package/dist/features/runtime/assetPrefix.js +14 -0
- package/dist/features/runtime/breadcrumbs.js +1 -1
- package/dist/features/runtime/editingFallback.js +4 -8
- package/dist/features/runtime/livePages.js +1 -1
- package/dist/features/runtime/pageApp.js +57 -83
- package/dist/features/runtime/pageClient.js +1 -1
- package/dist/features/runtime/pageNavigation.js +3 -2
- package/dist/features/runtime/publicCache.js +15 -3
- package/dist/features/runtime/publishingDraft.js +23 -0
- package/dist/features/runtime/rendererClient.d.ts +8 -0
- package/dist/features/runtime/rendererClient.js +77 -0
- package/dist/features/runtime/runtime.d.ts +9 -0
- package/dist/features/runtime/runtime.js +36 -17
- package/dist/features/runtime/runtimeRoutes.d.ts +2 -0
- package/dist/features/runtime/runtimeRoutes.js +2 -0
- package/dist/features/runtime/worker.d.ts +10 -1
- package/dist/features/runtime/worker.js +20 -7
- package/dist/features/studio/FollowAgentProvider.js +10 -10
- package/dist/features/studio/components/ProjectMenu.js +1 -1
- package/dist/features/studio/components/ReviewDraftSheet.js +242 -138
- package/dist/features/studio/components/ThreadMessages.js +100 -65
- package/dist/features/studio/components/UserButton.js +1 -1
- package/dist/features/vite/definitionsSync.js +1 -1
- package/dist/features/vite/hostedChecks.js +127 -0
- package/dist/features/vite/runtimeDev.js +26 -0
- package/dist/features/vite/vite.js +33 -5
- package/dist/hooks/use-page-destinations.js +10 -10
- package/dist/lib/revisions.js +20 -0
- package/dist/lib/studio-definitions.js +160 -0
- package/dist/lib/studio-reads.js +65 -21
- package/dist/lib/use-project-room.js +16 -10
- package/dist/package.js +1 -1
- package/dist/studio.css +1 -1
- package/package.json +8 -4
- package/skills/camox/SKILL.md +4 -0
- package/skills/camox/references/artifacts.md +1 -1
|
@@ -2,8 +2,8 @@ import { useProjectUuid } from "../../lib/auth.js";
|
|
|
2
2
|
import { parseLocalePath } from "../../lib/locale-path.js";
|
|
3
3
|
import { useViewLocale } from "../../lib/view-locale-context.js";
|
|
4
4
|
import { useLocation, useNavigate } from "../navigation/navigation.js";
|
|
5
|
-
import { useCamoxApp } from "../provider/components/CamoxAppContext.js";
|
|
6
5
|
import { reads, useReadQueries, useReadQuery } from "../../lib/studio-reads.js";
|
|
6
|
+
import { useRoutableLayouts } from "../../lib/studio-definitions.js";
|
|
7
7
|
import { FollowAgentContext } from "./followAgentContext.js";
|
|
8
8
|
import { canvasPageId, getCanvasPages } from "../canvas/canvasPages.js";
|
|
9
9
|
import { selectedCanvasPage } from "../canvas/canvasSelection.js";
|
|
@@ -102,7 +102,7 @@ function _temp(id) {
|
|
|
102
102
|
/** Where the editor is, and the Studio content following locates the agent's touches with. */
|
|
103
103
|
function useFollowWhere(runtimeBasePath) {
|
|
104
104
|
const $ = c(35);
|
|
105
|
-
const
|
|
105
|
+
const layouts = useRoutableLayouts();
|
|
106
106
|
const projectUuid = useProjectUuid();
|
|
107
107
|
const location = useLocation();
|
|
108
108
|
const { locale, locales } = useViewLocale();
|
|
@@ -129,20 +129,20 @@ function useFollowWhere(runtimeBasePath) {
|
|
|
129
129
|
const { data: pageList } = useReadQuery(t1, t3);
|
|
130
130
|
const discoveredPaths = useDiscoveredPreviewPaths(runtimeBasePath);
|
|
131
131
|
let t4;
|
|
132
|
-
if ($[6] !==
|
|
133
|
-
t4 = pageList ? getCanvasPages(pageList,
|
|
134
|
-
$[6] =
|
|
135
|
-
$[7] =
|
|
132
|
+
if ($[6] !== discoveredPaths || $[7] !== layouts || $[8] !== locale || $[9] !== pageList) {
|
|
133
|
+
t4 = pageList ? getCanvasPages(pageList, layouts, discoveredPaths, locale) : [];
|
|
134
|
+
$[6] = discoveredPaths;
|
|
135
|
+
$[7] = layouts;
|
|
136
136
|
$[8] = locale;
|
|
137
137
|
$[9] = pageList;
|
|
138
138
|
$[10] = t4;
|
|
139
139
|
} else t4 = $[10];
|
|
140
140
|
const canvasPages = t4;
|
|
141
141
|
let t5;
|
|
142
|
-
if ($[11] !==
|
|
143
|
-
t5 = selectedCanvasPage(canvasPages,
|
|
144
|
-
$[11] =
|
|
145
|
-
$[12] =
|
|
142
|
+
if ($[11] !== canvasPages || $[12] !== layouts || $[13] !== locales || $[14] !== location.pathname) {
|
|
143
|
+
t5 = selectedCanvasPage(canvasPages, layouts, location.pathname, locales);
|
|
144
|
+
$[11] = canvasPages;
|
|
145
|
+
$[12] = layouts;
|
|
146
146
|
$[13] = locales;
|
|
147
147
|
$[14] = location.pathname;
|
|
148
148
|
$[15] = t5;
|
|
@@ -3,9 +3,9 @@ import { getApiUrl } from "../../../lib/api-client.js";
|
|
|
3
3
|
import { Link as Link$1 } from "../../navigation/navigation.js";
|
|
4
4
|
import { reads, useReadQuery } from "../../../lib/studio-reads.js";
|
|
5
5
|
import { useLocalizedPath } from "../../../lib/view-locale.js";
|
|
6
|
+
import { version } from "../../../package.js";
|
|
6
7
|
import { STUDIO_SETTINGS_PATH } from "../routes.js";
|
|
7
8
|
import { buildFaviconUrl } from "../../routes/pageRuntime.js";
|
|
8
|
-
import { version } from "../../../package.js";
|
|
9
9
|
import { c } from "react/compiler-runtime";
|
|
10
10
|
import * as React from "react";
|
|
11
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -2,18 +2,19 @@ import { useDraftScope } from "../../../lib/draft-scope.js";
|
|
|
2
2
|
import { reads, useReadQuery } from "../../../lib/studio-reads.js";
|
|
3
3
|
import { cn } from "../../../lib/utils.js";
|
|
4
4
|
import { draftMutations } from "../../../lib/queries.js";
|
|
5
|
+
import { previewStore } from "../../preview/previewStore.js";
|
|
5
6
|
import { localeLabel } from "../localeOptions.js";
|
|
6
7
|
import { draftLabel, plural, timeAgo } from "../draftLabel.js";
|
|
7
8
|
import { useRenameDraft } from "./RenameDraftDialog.js";
|
|
8
9
|
import { useShowInCanvas } from "../showInCanvas.js";
|
|
9
10
|
import { c } from "react/compiler-runtime";
|
|
10
11
|
import * as React from "react";
|
|
11
|
-
import { CONFLICTS_CHANGED_ERROR, TRANSLATIONS_PENDING_ERROR } from "@camox/api-contract/drafts";
|
|
12
|
+
import { CONFLICTS_CHANGED_ERROR, REVISION_CHANGED_ERROR, TRANSLATIONS_PENDING_ERROR } from "@camox/api-contract/drafts";
|
|
12
13
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
14
|
import { useMutation } from "@tanstack/react-query";
|
|
14
15
|
import { Button } from "@camox/ui/button";
|
|
15
16
|
import { Sheet, SheetContent, SheetDescription, SheetTitle } from "@camox/ui/sheet";
|
|
16
|
-
import { CircleCheck, OctagonX, Replace, Trash2, Unlink } from "lucide-react";
|
|
17
|
+
import { CircleCheck, OctagonX, Replace, Trash2, TriangleAlert, Unlink } from "lucide-react";
|
|
17
18
|
import { toast } from "@camox/ui/toaster";
|
|
18
19
|
import { Skeleton } from "@camox/ui/skeleton";
|
|
19
20
|
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
|
|
@@ -104,8 +105,8 @@ const LOST_REASONS = {
|
|
|
104
105
|
writtenAfterDeletion: "This draft deletes what it was added to, so publishing deletes it too."
|
|
105
106
|
};
|
|
106
107
|
/**
|
|
107
|
-
* A card for something to know before publishing: blockers in red, conflicts and lost
|
|
108
|
-
* amber.
|
|
108
|
+
* A card for something to know before publishing: blockers in red; removals, conflicts and lost
|
|
109
|
+
* changes in amber.
|
|
109
110
|
*/
|
|
110
111
|
function Card(t0) {
|
|
111
112
|
const $ = c(22);
|
|
@@ -189,25 +190,37 @@ function Card(t0) {
|
|
|
189
190
|
} else t10 = $[21];
|
|
190
191
|
return t10;
|
|
191
192
|
}
|
|
192
|
-
/** From how many
|
|
193
|
+
/** From how many problems sharing a message they fold into one card, naming each subject. */
|
|
193
194
|
const SHARED_MESSAGE_MIN = 3;
|
|
194
195
|
/**
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
* message is the same for each. A blocker on a page has an action that shows it in the Canvas.
|
|
196
|
+
* Warnings the review shows: what the draft's code removes while Live content uses it, which is
|
|
197
|
+
* about the draft. Other warnings are about problems already on Live, and stay out (ADR 0009).
|
|
198
198
|
*/
|
|
199
|
-
|
|
199
|
+
const isShownWarning = (problem) => problem.code === "removedInUse";
|
|
200
|
+
/**
|
|
201
|
+
* One card per problem, saying what's wrong and where. Problems sharing a message fold into one
|
|
202
|
+
* card naming each: a development draft can hold dozens of definitions to release, and a removed
|
|
203
|
+
* block can sit on dozens of pages, with the same message for each. A problem on a page has an
|
|
204
|
+
* action that shows it in the Canvas; a blocker in the draft's code, which only the agent fixes,
|
|
205
|
+
* one that opens the draft's thread.
|
|
206
|
+
*/
|
|
207
|
+
function ProblemCards({ problems, tone, icon, onShow, onOpenThread }) {
|
|
200
208
|
const byMessage = /* @__PURE__ */ new Map();
|
|
201
|
-
for (const problem of
|
|
209
|
+
for (const problem of problems) byMessage.set(problem.message, [...byMessage.get(problem.message) ?? [], problem]);
|
|
202
210
|
return [...byMessage].flatMap(([message, shared]) => {
|
|
203
211
|
if (shared.length < SHARED_MESSAGE_MIN) return shared.map((problem) => {
|
|
204
212
|
const place = problemPlace(problem);
|
|
205
213
|
const target = blockerTarget(problem);
|
|
206
214
|
return /* @__PURE__ */ jsx(Card, {
|
|
207
|
-
tone
|
|
208
|
-
icon
|
|
215
|
+
tone,
|
|
216
|
+
icon,
|
|
209
217
|
title: problem.message,
|
|
210
|
-
action:
|
|
218
|
+
action: problem.entity === "code" ? /* @__PURE__ */ jsx(Button, {
|
|
219
|
+
variant: "outline",
|
|
220
|
+
size: "sm",
|
|
221
|
+
onClick: onOpenThread,
|
|
222
|
+
children: "Open the thread"
|
|
223
|
+
}) : target && /* @__PURE__ */ jsx(Button, {
|
|
211
224
|
variant: "outline",
|
|
212
225
|
size: "sm",
|
|
213
226
|
onClick: () => onShow(target),
|
|
@@ -217,8 +230,8 @@ function BlockerCards({ blockers, onShow }) {
|
|
|
217
230
|
}, `${problem.code}:${problem.id}:${problem.locale}:${problem.field}`);
|
|
218
231
|
});
|
|
219
232
|
return [/* @__PURE__ */ jsx(Card, {
|
|
220
|
-
tone
|
|
221
|
-
icon
|
|
233
|
+
tone,
|
|
234
|
+
icon,
|
|
222
235
|
title: message,
|
|
223
236
|
children: /* @__PURE__ */ jsx("ul", {
|
|
224
237
|
className: "flex flex-wrap gap-1 pt-0.5",
|
|
@@ -433,34 +446,62 @@ function UseLiveVersionButton(t0) {
|
|
|
433
446
|
} else t8 = $[19];
|
|
434
447
|
return t8;
|
|
435
448
|
}
|
|
436
|
-
/**
|
|
449
|
+
/**
|
|
450
|
+
* Blockers first, then what the draft's code removes while Live content uses it, then conflicts,
|
|
451
|
+
* then lost changes: one card each, with no section heading.
|
|
452
|
+
*/
|
|
437
453
|
function Cards(t0) {
|
|
438
|
-
const $ = c(
|
|
439
|
-
const { projectId, preview, onChanged, onShow } = t0;
|
|
454
|
+
const $ = c(33);
|
|
455
|
+
const { projectId, preview, onChanged, onShow, onOpenThread } = t0;
|
|
440
456
|
const { blockers, conflicts, lost, changes, defaultLocale } = preview;
|
|
441
|
-
if (blockers.length + conflicts.length + lost.length === 0) return null;
|
|
442
457
|
let t1;
|
|
443
|
-
if ($[0] !==
|
|
444
|
-
t1 =
|
|
445
|
-
$[0] =
|
|
458
|
+
if ($[0] !== preview.warnings) {
|
|
459
|
+
t1 = preview.warnings.filter(isShownWarning);
|
|
460
|
+
$[0] = preview.warnings;
|
|
446
461
|
$[1] = t1;
|
|
447
462
|
} else t1 = $[1];
|
|
448
|
-
const
|
|
463
|
+
const warnings = t1;
|
|
464
|
+
if (blockers.length + warnings.length + conflicts.length + lost.length === 0) return null;
|
|
449
465
|
let t2;
|
|
450
|
-
if ($[2] !==
|
|
451
|
-
t2 =
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
$[3] = onShow;
|
|
457
|
-
$[4] = t2;
|
|
458
|
-
} else t2 = $[4];
|
|
466
|
+
if ($[2] !== changes) {
|
|
467
|
+
t2 = new Set(changes.filter(_temp).map(_temp2));
|
|
468
|
+
$[2] = changes;
|
|
469
|
+
$[3] = t2;
|
|
470
|
+
} else t2 = $[3];
|
|
471
|
+
const deleted = t2;
|
|
459
472
|
let t3;
|
|
460
|
-
if ($[
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
473
|
+
if ($[4] !== blockers || $[5] !== onOpenThread || $[6] !== onShow) {
|
|
474
|
+
t3 = /* @__PURE__ */ jsx(ProblemCards, {
|
|
475
|
+
problems: blockers,
|
|
476
|
+
tone: "danger",
|
|
477
|
+
icon: OctagonX,
|
|
478
|
+
onShow,
|
|
479
|
+
onOpenThread
|
|
480
|
+
});
|
|
481
|
+
$[4] = blockers;
|
|
482
|
+
$[5] = onOpenThread;
|
|
483
|
+
$[6] = onShow;
|
|
484
|
+
$[7] = t3;
|
|
485
|
+
} else t3 = $[7];
|
|
486
|
+
let t4;
|
|
487
|
+
if ($[8] !== onOpenThread || $[9] !== onShow || $[10] !== warnings) {
|
|
488
|
+
t4 = /* @__PURE__ */ jsx(ProblemCards, {
|
|
489
|
+
problems: warnings,
|
|
490
|
+
tone: "warning",
|
|
491
|
+
icon: TriangleAlert,
|
|
492
|
+
onShow,
|
|
493
|
+
onOpenThread
|
|
494
|
+
});
|
|
495
|
+
$[8] = onOpenThread;
|
|
496
|
+
$[9] = onShow;
|
|
497
|
+
$[10] = warnings;
|
|
498
|
+
$[11] = t4;
|
|
499
|
+
} else t4 = $[11];
|
|
500
|
+
let t5;
|
|
501
|
+
if ($[12] !== conflicts || $[13] !== defaultLocale || $[14] !== deleted || $[15] !== onChanged || $[16] !== projectId) {
|
|
502
|
+
let t6;
|
|
503
|
+
if ($[18] !== defaultLocale || $[19] !== deleted || $[20] !== onChanged || $[21] !== projectId) {
|
|
504
|
+
t6 = (conflict) => /* @__PURE__ */ jsxs(Card, {
|
|
464
505
|
tone: "warning",
|
|
465
506
|
icon: Replace,
|
|
466
507
|
title: conflictTitle(conflict),
|
|
@@ -479,25 +520,25 @@ function Cards(t0) {
|
|
|
479
520
|
})
|
|
480
521
|
]
|
|
481
522
|
}, conflictKey(conflict));
|
|
482
|
-
$[
|
|
483
|
-
$[
|
|
484
|
-
$[
|
|
485
|
-
$[
|
|
486
|
-
$[
|
|
487
|
-
} else
|
|
488
|
-
|
|
489
|
-
$[
|
|
490
|
-
$[
|
|
491
|
-
$[
|
|
492
|
-
$[
|
|
493
|
-
$[
|
|
494
|
-
$[
|
|
495
|
-
} else
|
|
496
|
-
let
|
|
497
|
-
if ($[
|
|
498
|
-
let
|
|
499
|
-
if ($[
|
|
500
|
-
|
|
523
|
+
$[18] = defaultLocale;
|
|
524
|
+
$[19] = deleted;
|
|
525
|
+
$[20] = onChanged;
|
|
526
|
+
$[21] = projectId;
|
|
527
|
+
$[22] = t6;
|
|
528
|
+
} else t6 = $[22];
|
|
529
|
+
t5 = conflicts.map(t6);
|
|
530
|
+
$[12] = conflicts;
|
|
531
|
+
$[13] = defaultLocale;
|
|
532
|
+
$[14] = deleted;
|
|
533
|
+
$[15] = onChanged;
|
|
534
|
+
$[16] = projectId;
|
|
535
|
+
$[17] = t5;
|
|
536
|
+
} else t5 = $[17];
|
|
537
|
+
let t6;
|
|
538
|
+
if ($[23] !== defaultLocale || $[24] !== lost) {
|
|
539
|
+
let t7;
|
|
540
|
+
if ($[26] !== defaultLocale) {
|
|
541
|
+
t7 = (change_1) => /* @__PURE__ */ jsxs(Card, {
|
|
501
542
|
tone: "warning",
|
|
502
543
|
icon: Unlink,
|
|
503
544
|
title: change_1.reason === "writtenAfterDeletion" ? change_1.label : `Loses the change to the ${change_1.label}`,
|
|
@@ -507,30 +548,32 @@ function Cards(t0) {
|
|
|
507
548
|
change_1.id,
|
|
508
549
|
change_1.locale
|
|
509
550
|
]));
|
|
510
|
-
$[
|
|
511
|
-
$[
|
|
512
|
-
} else
|
|
513
|
-
|
|
514
|
-
$[
|
|
515
|
-
$[
|
|
516
|
-
$[
|
|
517
|
-
} else
|
|
518
|
-
let
|
|
519
|
-
if ($[
|
|
520
|
-
|
|
551
|
+
$[26] = defaultLocale;
|
|
552
|
+
$[27] = t7;
|
|
553
|
+
} else t7 = $[27];
|
|
554
|
+
t6 = lost.map(t7);
|
|
555
|
+
$[23] = defaultLocale;
|
|
556
|
+
$[24] = lost;
|
|
557
|
+
$[25] = t6;
|
|
558
|
+
} else t6 = $[25];
|
|
559
|
+
let t7;
|
|
560
|
+
if ($[28] !== t3 || $[29] !== t4 || $[30] !== t5 || $[31] !== t6) {
|
|
561
|
+
t7 = /* @__PURE__ */ jsxs("ul", {
|
|
521
562
|
className: "flex flex-col gap-2",
|
|
522
563
|
children: [
|
|
523
|
-
t2,
|
|
524
564
|
t3,
|
|
525
|
-
t4
|
|
565
|
+
t4,
|
|
566
|
+
t5,
|
|
567
|
+
t6
|
|
526
568
|
]
|
|
527
569
|
});
|
|
528
|
-
$[
|
|
529
|
-
$[
|
|
530
|
-
$[
|
|
531
|
-
$[
|
|
532
|
-
|
|
533
|
-
|
|
570
|
+
$[28] = t3;
|
|
571
|
+
$[29] = t4;
|
|
572
|
+
$[30] = t5;
|
|
573
|
+
$[31] = t6;
|
|
574
|
+
$[32] = t7;
|
|
575
|
+
} else t7 = $[32];
|
|
576
|
+
return t7;
|
|
534
577
|
}
|
|
535
578
|
function _temp2(change_0) {
|
|
536
579
|
return JSON.stringify([
|
|
@@ -574,37 +617,82 @@ function StatusLine(t0) {
|
|
|
574
617
|
} else t3 = $[6];
|
|
575
618
|
return t3;
|
|
576
619
|
}
|
|
620
|
+
/** What Publish sends: the review's token, and the revision a draft with code shows. */
|
|
621
|
+
const publishInput = (projectId, shown, publishAnyway) => ({
|
|
622
|
+
projectId,
|
|
623
|
+
token: shown.token,
|
|
624
|
+
...shown.code?.revision && { revision: shown.code.revision },
|
|
625
|
+
...publishAnyway && { publishAnyway }
|
|
626
|
+
});
|
|
627
|
+
/** Why a publish with code went back to the review, as the review says it. */
|
|
628
|
+
const PUBLISH_ABORTED = {
|
|
629
|
+
revisionChanged: "The agent changed the code since this review opened, so the publish stopped. Check the preview, then publish again.",
|
|
630
|
+
conflictsChanged: "Live changed while publishing, so the publish stopped and Live is as it was. Check the new list.",
|
|
631
|
+
blocked: "Something now needs fixing before publishing, so the publish stopped.",
|
|
632
|
+
codeDoesNotMerge: "Live's code changed while publishing, and it doesn't merge with this draft's yet, so the publish stopped. Camox's agent is fixing it in the draft's thread: publish again once it's done.",
|
|
633
|
+
liveCodeMoved: "Live's code changed while publishing, and the draft took too long to take it in, so the publish stopped. Try again.",
|
|
634
|
+
failed: "The publish couldn't finish on Camox's side, and Live is as it was. Try again."
|
|
635
|
+
};
|
|
577
636
|
/**
|
|
578
|
-
* What's fine or still running: the draft is up to date with Live, its
|
|
579
|
-
* page SEO being written.
|
|
637
|
+
* What's fine or still running: the draft is up to date with Live, its latest code changes
|
|
638
|
+
* building, its translations, and the page SEO being written.
|
|
580
639
|
*/
|
|
581
640
|
function StatusLines(t0) {
|
|
582
|
-
const $ = c(
|
|
641
|
+
const $ = c(34);
|
|
583
642
|
const { preview, locales, waiting } = t0;
|
|
584
|
-
const { conflicts, translating, warnings } = preview;
|
|
643
|
+
const { conflicts, translating, warnings, code } = preview;
|
|
585
644
|
let seoPages;
|
|
586
645
|
let t1;
|
|
587
646
|
let t2;
|
|
588
647
|
let t3;
|
|
589
|
-
|
|
648
|
+
let t4;
|
|
649
|
+
let t5;
|
|
650
|
+
let t6;
|
|
651
|
+
if ($[0] !== code || $[1] !== conflicts.length || $[2] !== locales || $[3] !== translating || $[4] !== waiting || $[5] !== warnings) {
|
|
590
652
|
const translations = locales.filter(_temp3).map(_temp4);
|
|
591
|
-
let
|
|
592
|
-
if ($[
|
|
593
|
-
|
|
594
|
-
$[
|
|
595
|
-
$[
|
|
596
|
-
} else
|
|
597
|
-
seoPages =
|
|
653
|
+
let t7;
|
|
654
|
+
if ($[13] !== warnings) {
|
|
655
|
+
t7 = new Set(warnings.filter(_temp5).map(_temp6));
|
|
656
|
+
$[13] = warnings;
|
|
657
|
+
$[14] = t7;
|
|
658
|
+
} else t7 = $[14];
|
|
659
|
+
seoPages = t7.size;
|
|
660
|
+
const aborted = code?.publishAborted && !code.publishing ? code.publishAborted : null;
|
|
598
661
|
t1 = "flex flex-col gap-1.5";
|
|
599
|
-
if ($[
|
|
600
|
-
t2 =
|
|
662
|
+
if ($[15] !== aborted) {
|
|
663
|
+
t2 = aborted && /* @__PURE__ */ jsx("li", {
|
|
664
|
+
className: "text-sm text-amber-700 dark:text-amber-400",
|
|
665
|
+
children: PUBLISH_ABORTED[aborted] ?? PUBLISH_ABORTED.failed
|
|
666
|
+
});
|
|
667
|
+
$[15] = aborted;
|
|
668
|
+
$[16] = t2;
|
|
669
|
+
} else t2 = $[16];
|
|
670
|
+
if ($[17] !== code?.includesLive || $[18] !== conflicts.length) {
|
|
671
|
+
t3 = conflicts.length === 0 && (code?.includesLive ?? true) && /* @__PURE__ */ jsx(StatusLine, {
|
|
601
672
|
done: true,
|
|
602
673
|
children: "Includes everything published to Live since this draft started"
|
|
603
674
|
});
|
|
604
|
-
$[
|
|
605
|
-
$[
|
|
606
|
-
|
|
607
|
-
t3 =
|
|
675
|
+
$[17] = code?.includesLive;
|
|
676
|
+
$[18] = conflicts.length;
|
|
677
|
+
$[19] = t3;
|
|
678
|
+
} else t3 = $[19];
|
|
679
|
+
if ($[20] !== code?.building) {
|
|
680
|
+
t4 = code?.building && /* @__PURE__ */ jsx(StatusLine, {
|
|
681
|
+
done: false,
|
|
682
|
+
children: "Building the latest changes…"
|
|
683
|
+
});
|
|
684
|
+
$[20] = code?.building;
|
|
685
|
+
$[21] = t4;
|
|
686
|
+
} else t4 = $[21];
|
|
687
|
+
if ($[22] !== code?.publishing) {
|
|
688
|
+
t5 = code?.publishing && /* @__PURE__ */ jsx(StatusLine, {
|
|
689
|
+
done: false,
|
|
690
|
+
children: "Publishing the new code and content…"
|
|
691
|
+
});
|
|
692
|
+
$[22] = code?.publishing;
|
|
693
|
+
$[23] = t5;
|
|
694
|
+
} else t5 = $[23];
|
|
695
|
+
t6 = translating.length > 0 ? /* @__PURE__ */ jsxs(StatusLine, {
|
|
608
696
|
done: false,
|
|
609
697
|
children: [
|
|
610
698
|
"Translating into ",
|
|
@@ -617,24 +705,31 @@ function StatusLines(t0) {
|
|
|
617
705
|
done: true,
|
|
618
706
|
children: ["Translated into ", listFormat.format(translations.map(localeLabel))]
|
|
619
707
|
});
|
|
620
|
-
$[0] =
|
|
621
|
-
$[1] =
|
|
622
|
-
$[2] =
|
|
623
|
-
$[3] =
|
|
624
|
-
$[4] =
|
|
625
|
-
$[5] =
|
|
626
|
-
$[6] =
|
|
627
|
-
$[7] =
|
|
628
|
-
$[8] =
|
|
708
|
+
$[0] = code;
|
|
709
|
+
$[1] = conflicts.length;
|
|
710
|
+
$[2] = locales;
|
|
711
|
+
$[3] = translating;
|
|
712
|
+
$[4] = waiting;
|
|
713
|
+
$[5] = warnings;
|
|
714
|
+
$[6] = seoPages;
|
|
715
|
+
$[7] = t1;
|
|
716
|
+
$[8] = t2;
|
|
717
|
+
$[9] = t3;
|
|
718
|
+
$[10] = t4;
|
|
719
|
+
$[11] = t5;
|
|
720
|
+
$[12] = t6;
|
|
629
721
|
} else {
|
|
630
|
-
seoPages = $[
|
|
631
|
-
t1 = $[
|
|
632
|
-
t2 = $[
|
|
633
|
-
t3 = $[
|
|
722
|
+
seoPages = $[6];
|
|
723
|
+
t1 = $[7];
|
|
724
|
+
t2 = $[8];
|
|
725
|
+
t3 = $[9];
|
|
726
|
+
t4 = $[10];
|
|
727
|
+
t5 = $[11];
|
|
728
|
+
t6 = $[12];
|
|
634
729
|
}
|
|
635
|
-
let
|
|
636
|
-
if ($[
|
|
637
|
-
|
|
730
|
+
let t7;
|
|
731
|
+
if ($[24] !== seoPages) {
|
|
732
|
+
t7 = seoPages > 0 && /* @__PURE__ */ jsxs(StatusLine, {
|
|
638
733
|
done: false,
|
|
639
734
|
children: [
|
|
640
735
|
"Writing SEO for ",
|
|
@@ -642,26 +737,32 @@ function StatusLines(t0) {
|
|
|
642
737
|
"…"
|
|
643
738
|
]
|
|
644
739
|
});
|
|
645
|
-
$[
|
|
646
|
-
$[
|
|
647
|
-
} else
|
|
648
|
-
let
|
|
649
|
-
if ($[
|
|
650
|
-
|
|
740
|
+
$[24] = seoPages;
|
|
741
|
+
$[25] = t7;
|
|
742
|
+
} else t7 = $[25];
|
|
743
|
+
let t8;
|
|
744
|
+
if ($[26] !== t1 || $[27] !== t2 || $[28] !== t3 || $[29] !== t4 || $[30] !== t5 || $[31] !== t6 || $[32] !== t7) {
|
|
745
|
+
t8 = /* @__PURE__ */ jsxs("ul", {
|
|
651
746
|
className: t1,
|
|
652
747
|
children: [
|
|
653
748
|
t2,
|
|
654
749
|
t3,
|
|
655
|
-
t4
|
|
750
|
+
t4,
|
|
751
|
+
t5,
|
|
752
|
+
t6,
|
|
753
|
+
t7
|
|
656
754
|
]
|
|
657
755
|
});
|
|
658
|
-
$[
|
|
659
|
-
$[
|
|
660
|
-
$[
|
|
661
|
-
$[
|
|
662
|
-
$[
|
|
663
|
-
|
|
664
|
-
|
|
756
|
+
$[26] = t1;
|
|
757
|
+
$[27] = t2;
|
|
758
|
+
$[28] = t3;
|
|
759
|
+
$[29] = t4;
|
|
760
|
+
$[30] = t5;
|
|
761
|
+
$[31] = t6;
|
|
762
|
+
$[32] = t7;
|
|
763
|
+
$[33] = t8;
|
|
764
|
+
} else t8 = $[33];
|
|
765
|
+
return t8;
|
|
665
766
|
}
|
|
666
767
|
function _temp6(warning_0) {
|
|
667
768
|
return warning_0.id;
|
|
@@ -1093,8 +1194,12 @@ function ReviewDraftSheet(t0) {
|
|
|
1093
1194
|
} else t13 = $[25];
|
|
1094
1195
|
let t14;
|
|
1095
1196
|
if ($[26] !== leave || $[27] !== preview) {
|
|
1096
|
-
t14 = (
|
|
1097
|
-
|
|
1197
|
+
t14 = (result) => {
|
|
1198
|
+
if ("publishing" in result && result.publishing) {
|
|
1199
|
+
preview.refetch();
|
|
1200
|
+
return;
|
|
1201
|
+
}
|
|
1202
|
+
const { empty, ended: ended_0 } = result;
|
|
1098
1203
|
if (!empty) return leave(ended_0);
|
|
1099
1204
|
toast.info("This draft has no changes, so there is nothing to publish.");
|
|
1100
1205
|
preview.refetch();
|
|
@@ -1111,6 +1216,11 @@ function ReviewDraftSheet(t0) {
|
|
|
1111
1216
|
preview.refetch();
|
|
1112
1217
|
return;
|
|
1113
1218
|
}
|
|
1219
|
+
if (error.code === REVISION_CHANGED_ERROR) {
|
|
1220
|
+
toast.error(error.message || "The draft changed since you opened this review.");
|
|
1221
|
+
preview.refetch();
|
|
1222
|
+
return;
|
|
1223
|
+
}
|
|
1114
1224
|
if (error.code === TRANSLATIONS_PENDING_ERROR) {
|
|
1115
1225
|
toast.info("Translations are still running. Wait for them, or publish anyway.");
|
|
1116
1226
|
preview.refetch();
|
|
@@ -1137,7 +1247,7 @@ function ReviewDraftSheet(t0) {
|
|
|
1137
1247
|
const data = preview.data;
|
|
1138
1248
|
const headline = data?.overview.status === "ready" ? data.overview.headline : null;
|
|
1139
1249
|
const busy = publish.isPending;
|
|
1140
|
-
const ready = !!data && data.blockers.length === 0 && !busy && !preview.isFetching;
|
|
1250
|
+
const ready = !!data && data.blockers.length === 0 && !data.code?.building && !data.code?.publishing && !busy && !preview.isFetching;
|
|
1141
1251
|
let t17;
|
|
1142
1252
|
if ($[34] !== data?.translating) {
|
|
1143
1253
|
t17 = data?.translating ?? [];
|
|
@@ -1157,10 +1267,7 @@ function ReviewDraftSheet(t0) {
|
|
|
1157
1267
|
if ($[36] !== busy || $[37] !== data || $[38] !== mutate || $[39] !== projectId || $[40] !== translated || $[41] !== waiting) {
|
|
1158
1268
|
t18 = () => {
|
|
1159
1269
|
if (!waiting || !translated || !data || busy) return;
|
|
1160
|
-
mutate({
|
|
1161
|
-
projectId,
|
|
1162
|
-
token: data.token
|
|
1163
|
-
}, { onSettled: () => setWaiting(null) });
|
|
1270
|
+
mutate(publishInput(projectId, data), { onSettled: () => setWaiting(null) });
|
|
1164
1271
|
};
|
|
1165
1272
|
t19 = [
|
|
1166
1273
|
waiting,
|
|
@@ -1187,10 +1294,7 @@ function ReviewDraftSheet(t0) {
|
|
|
1187
1294
|
if ($[44] !== data || $[45] !== projectId || $[46] !== publish || $[47] !== translating.length) {
|
|
1188
1295
|
t20 = () => {
|
|
1189
1296
|
if (!data) return;
|
|
1190
|
-
if (translating.length === 0) return publish.mutate(
|
|
1191
|
-
projectId,
|
|
1192
|
-
token: data.token
|
|
1193
|
-
});
|
|
1297
|
+
if (translating.length === 0) return publish.mutate(publishInput(projectId, data));
|
|
1194
1298
|
setWaiting({ conflicts: new Set(data.conflicts.map(conflictKey)) });
|
|
1195
1299
|
};
|
|
1196
1300
|
$[44] = data;
|
|
@@ -1259,6 +1363,10 @@ function ReviewDraftSheet(t0) {
|
|
|
1259
1363
|
onShow: (target) => {
|
|
1260
1364
|
onOpenChange(false);
|
|
1261
1365
|
showInCanvas(target);
|
|
1366
|
+
},
|
|
1367
|
+
onOpenThread: () => {
|
|
1368
|
+
onOpenChange(false);
|
|
1369
|
+
previewStore.send({ type: "showCanvas" });
|
|
1262
1370
|
}
|
|
1263
1371
|
}),
|
|
1264
1372
|
/* @__PURE__ */ jsx(StatusLines, {
|
|
@@ -1309,11 +1417,7 @@ function ReviewDraftSheet(t0) {
|
|
|
1309
1417
|
variant: "outline",
|
|
1310
1418
|
className: "ml-auto",
|
|
1311
1419
|
disabled: !ready,
|
|
1312
|
-
onClick: () => data && publish.mutate(
|
|
1313
|
-
projectId,
|
|
1314
|
-
token: data.token,
|
|
1315
|
-
publishAnyway: true
|
|
1316
|
-
}),
|
|
1420
|
+
onClick: () => data && publish.mutate(publishInput(projectId, data, true)),
|
|
1317
1421
|
children: "Publish anyway"
|
|
1318
1422
|
});
|
|
1319
1423
|
$[65] = data;
|