@riverbankcms/sdk 0.92.0 → 0.94.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.
Files changed (74) hide show
  1. package/dist/{PreviewEditorSidebar-3CI5MKV3.mjs → PreviewEditorSidebar-D3PAF7NW.mjs} +3 -3
  2. package/dist/{PreviewEditorUI-DKEP636I.mjs → PreviewEditorUI-G5JVJEIJ.mjs} +3 -3
  3. package/dist/SdkPreviewModeRuntime-NHTLRNQD.mjs +8 -0
  4. package/dist/_dts/api/src/common/envelope.d.ts +10 -0
  5. package/dist/_dts/api/src/index.d.ts +2 -2
  6. package/dist/_dts/api/src/request.d.ts +1 -1
  7. package/dist/_dts/blocks/src/system/manifest/fieldValidation/index.d.ts +1 -0
  8. package/dist/_dts/content-editor/src/controller/EntryControllerProvider.d.ts +14 -14
  9. package/dist/_dts/content-editor/src/controller/useEntrySyncHelpers.d.ts +1 -1
  10. package/dist/_dts/content-editor/src/hooks/useEntryActions.d.ts +5 -15
  11. package/dist/_dts/content-editor/src/ui/editorSnapshot.d.ts +46 -0
  12. package/dist/_dts/content-editor/src/ui/editorUiStore.d.ts +43 -36
  13. package/dist/_dts/media-core/src/fileUploadFinalization.d.ts +29 -1
  14. package/dist/_dts/media-core/src/index.d.ts +1 -0
  15. package/dist/_dts/media-core/src/legacyMediaValue.d.ts +11 -0
  16. package/dist/_dts/media-react/src/hooks/useApiMediaUploader.d.ts +2 -1
  17. package/dist/_dts/sdk/src/version.d.ts +1 -1
  18. package/dist/{chunk-UOMTCHZD.mjs → chunk-A63UXN3P.mjs} +21 -19
  19. package/dist/{chunk-U5YM4AWE.mjs → chunk-AJZGT6YG.mjs} +1 -1
  20. package/dist/{chunk-6D7PLF4M.mjs → chunk-AQ6RT6LZ.mjs} +2 -2
  21. package/dist/{chunk-ZA2S7H34.mjs → chunk-NT76QGIJ.mjs} +98 -1
  22. package/dist/{chunk-I6EOKV6B.mjs → chunk-PCNCETBI.mjs} +676 -386
  23. package/dist/{chunk-LERKJM3E.mjs → chunk-XIK2HYI3.mjs} +7 -7
  24. package/dist/cli/index.mjs +198 -87
  25. package/dist/client/{accordion-BUDH2G3S.mjs → accordion-RNQIPG55.mjs} +2 -2
  26. package/dist/client/{bookingForm-NQMCELVB.mjs → bookingForm-HYEEVRLP.mjs} +5 -5
  27. package/dist/client/{carousel-ONCEW6IJ.mjs → carousel-W7DQ3YPU.mjs} +3 -3
  28. package/dist/client/{cart-V2TCK2GI.mjs → cart-PXJ3SXXO.mjs} +6 -6
  29. package/dist/client/{checkout-ZI7SWNCS.mjs → checkout-X3JYSOXI.mjs} +6 -6
  30. package/dist/client/{chunk-R3CZQLXF.mjs → chunk-6SYGVVWA.mjs} +1 -1
  31. package/dist/client/{chunk-N2WJPTF7.mjs → chunk-DUOHLWLF.mjs} +3 -3
  32. package/dist/client/{chunk-KXYEKEV6.mjs → chunk-IXDSXF2D.mjs} +7 -7
  33. package/dist/client/{chunk-ZJDBOLX7.mjs → chunk-J6TMMMXW.mjs} +2 -2
  34. package/dist/client/{chunk-B5UC2D6X.mjs → chunk-JNE6UI6U.mjs} +1 -1
  35. package/dist/client/{chunk-QQNVQ62W.mjs → chunk-OLAOAZEO.mjs} +1 -1
  36. package/dist/client/{chunk-AUMRQ242.mjs → chunk-PICR3NTQ.mjs} +2 -2
  37. package/dist/client/{chunk-ERQDHUS2.mjs → chunk-Q47XGAGS.mjs} +1 -1
  38. package/dist/client/{chunk-HQWIJLYN.mjs → chunk-WERRJXNJ.mjs} +1 -1
  39. package/dist/client/{chunk-JXY6NHG6.mjs → chunk-YYVGSYBO.mjs} +5 -5
  40. package/dist/client/client.mjs +127 -17
  41. package/dist/client/{courseRegistration-JPWAQ6KM.mjs → courseRegistration-QZ67PVHO.mjs} +5 -5
  42. package/dist/client/{eventCalendar-QDOCHBBV.mjs → eventCalendar-V3BDHQNT.mjs} +8 -8
  43. package/dist/client/{eventCombined-ZS2CXSIE.mjs → eventCombined-XYFRN2RG.mjs} +8 -8
  44. package/dist/client/{eventDetails-5LOBMPLN.mjs → eventDetails-TFE5TWKV.mjs} +8 -8
  45. package/dist/client/{eventListing-SBGY4I3L.mjs → eventListing-IQ6AGWZ6.mjs} +8 -8
  46. package/dist/client/{eventRegistration-XGPIU3Z2.mjs → eventRegistration-WGJVFKQJ.mjs} +8 -8
  47. package/dist/client/{form-R7D4LZWW.mjs → form-6UZY6RUA.mjs} +2 -2
  48. package/dist/client/{headerSection-RRLYUCGC.mjs → headerSection-RSFXY6V3.mjs} +3 -3
  49. package/dist/client/hooks.mjs +35 -3
  50. package/dist/client/{locationMap-35ZJMRBZ.mjs → locationMap-24FH67I4.mjs} +3 -3
  51. package/dist/client/{newsletterForm-MJ2VCFUT.mjs → newsletterForm-QVL3MLTN.mjs} +2 -2
  52. package/dist/client/{productDetail-2O7YQNBX.mjs → productDetail-ZDYN3G4T.mjs} +6 -6
  53. package/dist/client/{productList-FDP5BH7W.mjs → productList-4BMJLQHZ.mjs} +6 -6
  54. package/dist/client/rendering/client.mjs +8 -0
  55. package/dist/client/rendering/islands.mjs +19 -19
  56. package/dist/client/rendering.mjs +69 -2
  57. package/dist/client/{shop-BGYJ3LDT.mjs → shop-U5C634FF.mjs} +6 -6
  58. package/dist/preview-next/client/runtime.mjs +5 -5
  59. package/dist/{sdk-runtime-B3TFXRXZ.mjs → sdk-runtime-VGV46WVB.mjs} +6 -6
  60. package/dist/server/components.mjs +121 -61
  61. package/dist/server/config-validation.mjs +35 -3
  62. package/dist/server/config.mjs +35 -3
  63. package/dist/server/data.mjs +35 -3
  64. package/dist/server/index.mjs +104 -29
  65. package/dist/server/next.mjs +183 -80
  66. package/dist/server/page-converter.mjs +3 -3
  67. package/dist/server/prebuild.mjs +1 -1
  68. package/dist/server/rendering/server.mjs +121 -61
  69. package/dist/server/rendering.mjs +121 -61
  70. package/dist/server/routing.mjs +102 -62
  71. package/dist/server/server.mjs +167 -92
  72. package/package.json +1 -1
  73. package/dist/SdkPreviewModeRuntime-BRGRDQFH.mjs +0 -8
  74. /package/dist/client/{chunk-GH6IIOOE.mjs → chunk-PCHACQEB.mjs} +0 -0
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { ApiRequestError } from './chunk-ZA2S7H34.mjs';
2
+ import { unwrapResponse, ApiRequestError, ApiEnvelopeError, extractApiEnvelopeErrorDetails } from './chunk-NT76QGIJ.mjs';
3
3
  import { __commonJS, __export, __toESM } from './chunk-R7POPVJR.mjs';
4
4
  import * as React61 from 'react';
5
5
  import React61__default, { createContext, forwardRef, useContext, createElement, useRef, useMemo, useEffect, useState, useCallback, useImperativeHandle, useLayoutEffect, memo, createRef, Component as Component$1, useDebugValue, useId as useId$1, useSyncExternalStore, isValidElement, cloneElement, useReducer, startTransition } from 'react';
@@ -30342,62 +30342,6 @@ function resolveBlockTitle(manifest, blockContent, blockKind) {
30342
30342
  showSubtitle
30343
30343
  };
30344
30344
  }
30345
- var nullableString = z.union([z.string().min(1), z.null()]);
30346
- var resolvedInternalLinkKeys = ["entityId", "entityType", "href", "title", "typeLabel"];
30347
- var internalRouteOnlyLinkSchema = z.object({
30348
- kind: z.literal("internal"),
30349
- routeId: z.string().min(1)
30350
- }).passthrough().superRefine((value, ctx) => {
30351
- const hasResolvedMetadata = resolvedInternalLinkKeys.some((key) => value[key] != null);
30352
- if (!hasResolvedMetadata) return;
30353
- ctx.addIssue({
30354
- code: "custom",
30355
- message: "Internal links with resolved metadata must include entityId, entityType, href, title, and typeLabel"
30356
- });
30357
- });
30358
- var internalResolvedLinkSchema = z.object({
30359
- kind: z.literal("internal"),
30360
- routeId: z.string().min(1),
30361
- entityId: z.string().min(1),
30362
- entityType: z.enum(["page", "content"]),
30363
- href: z.string().min(1),
30364
- title: z.string().min(1),
30365
- typeLabel: z.string().min(1),
30366
- contentTypeKey: nullableString.optional(),
30367
- contentTypeName: nullableString.optional(),
30368
- updatedAt: nullableString.optional()
30369
- }).passthrough();
30370
- var internalLinkSchema = z.union([
30371
- internalResolvedLinkSchema,
30372
- internalRouteOnlyLinkSchema
30373
- ]);
30374
- var externalLinkSchema = z.object({
30375
- kind: z.literal("external"),
30376
- href: z.string().min(1)
30377
- }).passthrough();
30378
- var customLinkSchema = z.object({
30379
- kind: z.literal("url"),
30380
- href: z.string().min(1)
30381
- }).passthrough();
30382
- var pageLinkSchema = z.object({
30383
- kind: z.literal("page"),
30384
- identifier: z.string().min(1)
30385
- }).passthrough();
30386
- var entryLinkSchema = z.object({
30387
- kind: z.literal("entry"),
30388
- contentType: z.string().min(1),
30389
- identifier: z.string().min(1)
30390
- }).passthrough();
30391
- var linkSchema = z.union([
30392
- internalLinkSchema,
30393
- externalLinkSchema,
30394
- customLinkSchema,
30395
- pageLinkSchema,
30396
- entryLinkSchema
30397
- ]);
30398
- function isInternalResolvedLinkValue(value) {
30399
- return value?.kind === "internal" && "entityId" in value && "entityType" in value && "href" in value && "title" in value && "typeLabel" in value && typeof value.entityId === "string" && typeof value.entityType === "string" && typeof value.href === "string" && typeof value.title === "string" && typeof value.typeLabel === "string";
30400
- }
30401
30345
 
30402
30346
  // ../media-core/src/types.ts
30403
30347
  var SVG_MIME_TYPE = "image/svg+xml";
@@ -30953,6 +30897,79 @@ function mediaIdentifierOrFallback(current, fallback2) {
30953
30897
  if (typeof current === "string" && current.trim().length > 0) return current;
30954
30898
  return fallback2 ?? (typeof current === "string" ? current : void 0);
30955
30899
  }
30900
+
30901
+ // ../media-core/src/legacyMediaValue.ts
30902
+ function legacyStringMediaTypeForField(field) {
30903
+ if (field.type === "file") {
30904
+ return field.fileKinds?.[0] ?? "document";
30905
+ }
30906
+ return field.mediaKinds?.[0] ?? "image";
30907
+ }
30908
+ function normalizeLegacyStringMediaValueForField(value, field) {
30909
+ if (typeof value !== "string") return value;
30910
+ const src = value.trim();
30911
+ if (!src) return value;
30912
+ return {
30913
+ type: legacyStringMediaTypeForField(field),
30914
+ src
30915
+ };
30916
+ }
30917
+ var nullableString = z.union([z.string().min(1), z.null()]);
30918
+ var resolvedInternalLinkKeys = ["entityId", "entityType", "href", "title", "typeLabel"];
30919
+ var internalRouteOnlyLinkSchema = z.object({
30920
+ kind: z.literal("internal"),
30921
+ routeId: z.string().min(1)
30922
+ }).passthrough().superRefine((value, ctx) => {
30923
+ const hasResolvedMetadata = resolvedInternalLinkKeys.some((key) => value[key] != null);
30924
+ if (!hasResolvedMetadata) return;
30925
+ ctx.addIssue({
30926
+ code: "custom",
30927
+ message: "Internal links with resolved metadata must include entityId, entityType, href, title, and typeLabel"
30928
+ });
30929
+ });
30930
+ var internalResolvedLinkSchema = z.object({
30931
+ kind: z.literal("internal"),
30932
+ routeId: z.string().min(1),
30933
+ entityId: z.string().min(1),
30934
+ entityType: z.enum(["page", "content"]),
30935
+ href: z.string().min(1),
30936
+ title: z.string().min(1),
30937
+ typeLabel: z.string().min(1),
30938
+ contentTypeKey: nullableString.optional(),
30939
+ contentTypeName: nullableString.optional(),
30940
+ updatedAt: nullableString.optional()
30941
+ }).passthrough();
30942
+ var internalLinkSchema = z.union([
30943
+ internalResolvedLinkSchema,
30944
+ internalRouteOnlyLinkSchema
30945
+ ]);
30946
+ var externalLinkSchema = z.object({
30947
+ kind: z.literal("external"),
30948
+ href: z.string().min(1)
30949
+ }).passthrough();
30950
+ var customLinkSchema = z.object({
30951
+ kind: z.literal("url"),
30952
+ href: z.string().min(1)
30953
+ }).passthrough();
30954
+ var pageLinkSchema = z.object({
30955
+ kind: z.literal("page"),
30956
+ identifier: z.string().min(1)
30957
+ }).passthrough();
30958
+ var entryLinkSchema = z.object({
30959
+ kind: z.literal("entry"),
30960
+ contentType: z.string().min(1),
30961
+ identifier: z.string().min(1)
30962
+ }).passthrough();
30963
+ var linkSchema = z.union([
30964
+ internalLinkSchema,
30965
+ externalLinkSchema,
30966
+ customLinkSchema,
30967
+ pageLinkSchema,
30968
+ entryLinkSchema
30969
+ ]);
30970
+ function isInternalResolvedLinkValue(value) {
30971
+ return value?.kind === "internal" && "entityId" in value && "entityType" in value && "href" in value && "title" in value && "typeLabel" in value && typeof value.entityId === "string" && typeof value.entityType === "string" && typeof value.href === "string" && typeof value.title === "string" && typeof value.typeLabel === "string";
30972
+ }
30956
30973
  var transformStepSchema = z.object({
30957
30974
  id: z.string().min(1, "Transform requires an identifier"),
30958
30975
  options: z.record(z.string(), z.unknown()).optional()
@@ -32986,7 +33003,10 @@ function deriveFieldValidationPlan(field, path = [field.id]) {
32986
33003
  return makePlan("richText", "object", field, path, required, commonConstraints(required, { kind: "richTextDoc" }));
32987
33004
  case "media":
32988
33005
  case "file":
32989
- return makePlan("media", "object", field, path, required, commonConstraints(required, { kind: "mediaObject" }));
33006
+ return {
33007
+ ...makePlan("media", "object", field, path, required, commonConstraints(required, { kind: "mediaObject" })),
33008
+ legacyStringType: legacyStringMediaTypeForField(field)
33009
+ };
32990
33010
  case "link":
32991
33011
  return makePlan("link", "object", field, path, required, commonConstraints(required, { kind: "linkObject" }));
32992
33012
  case "boolean":
@@ -33171,15 +33191,23 @@ function normalizeFieldValue(plan, value, ctx) {
33171
33191
  return normalizeRepeaterItems(plan, value, ctx);
33172
33192
  case "boolean":
33173
33193
  case "richText":
33174
- case "media":
33175
33194
  case "link":
33176
33195
  case "select":
33177
33196
  case "passthrough":
33178
33197
  return value;
33198
+ case "media":
33199
+ return normalizeMediaInput(plan, value);
33179
33200
  default:
33180
33201
  return assertNever4(plan);
33181
33202
  }
33182
33203
  }
33204
+ function normalizeMediaInput(plan, value) {
33205
+ return normalizeLegacyStringMediaValueForField(value, {
33206
+ type: plan.fieldType,
33207
+ mediaKinds: plan.fieldType === "media" ? [plan.legacyStringType] : void 0,
33208
+ fileKinds: plan.fieldType === "file" ? [plan.legacyStringType] : void 0
33209
+ });
33210
+ }
33183
33211
  function normalizeObjectChildren(children, value, ctx) {
33184
33212
  if (!value || typeof value !== "object" || Array.isArray(value)) return value;
33185
33213
  const normalized = {
@@ -95923,6 +95951,40 @@ function isUnknownArray3(value) {
95923
95951
  }
95924
95952
 
95925
95953
  // ../content-editor/src/ui/editorSnapshot.ts
95954
+ function deriveEditorValuePublicationState(snapshot) {
95955
+ const current = snapshot.current ?? snapshot.baseline;
95956
+ const published = snapshot.publishedBaseline;
95957
+ if (!current && !published) {
95958
+ return { kind: "empty", hasUnpublishedChanges: false };
95959
+ }
95960
+ if (current && !published) {
95961
+ return {
95962
+ kind: "unpublished-draft",
95963
+ current,
95964
+ hasUnpublishedChanges: true
95965
+ };
95966
+ }
95967
+ if (!current && published) {
95968
+ return {
95969
+ kind: "published-missing-current",
95970
+ published,
95971
+ hasUnpublishedChanges: true
95972
+ };
95973
+ }
95974
+ if (!recordsEqual(current, published)) {
95975
+ return {
95976
+ kind: "published-with-unpublished-changes",
95977
+ current,
95978
+ published,
95979
+ hasUnpublishedChanges: true
95980
+ };
95981
+ }
95982
+ return {
95983
+ kind: "published-clean",
95984
+ published,
95985
+ hasUnpublishedChanges: false
95986
+ };
95987
+ }
95926
95988
  var BASELINE_SYNC_STATE = { kind: "baseline" };
95927
95989
  var PENDING_SYNC_STATE = { kind: "pending" };
95928
95990
  var blockDefaultsByKind = /* @__PURE__ */ new Map();
@@ -95963,7 +96025,9 @@ function linkedEntryMetaEqual(left, right) {
95963
96025
  }
95964
96026
  function editorValueRecordArraysEqual(left, right) {
95965
96027
  if (left.length !== right.length) return false;
95966
- return left.every((leftValue, index2) => recordsEqual(leftValue, right[index2] ?? null));
96028
+ return left.every(
96029
+ (leftValue, index2) => recordsEqual(leftValue, right[index2] ?? null)
96030
+ );
95967
96031
  }
95968
96032
  function linkedEntrySnapshotValuesEqual(left, right) {
95969
96033
  return snapshotValuesEqual(left, right) && linkedEntryMetaEqual(left.meta, right.meta);
@@ -96163,8 +96227,10 @@ function normalizedBlocksEqual(left, right) {
96163
96227
  if (leftBlock.orderIndex !== rightBlock.orderIndex) return false;
96164
96228
  if (leftBlock.purpose !== rightBlock.purpose) return false;
96165
96229
  if (!recordsEqual(leftBlock.content, rightBlock.content)) return false;
96166
- if (!recordsEqual(leftBlock.draftContent, rightBlock.draftContent)) return false;
96167
- if (!recordsEqual(leftBlock.publishedContent, rightBlock.publishedContent)) return false;
96230
+ if (!recordsEqual(leftBlock.draftContent, rightBlock.draftContent))
96231
+ return false;
96232
+ if (!recordsEqual(leftBlock.publishedContent, rightBlock.publishedContent))
96233
+ return false;
96168
96234
  if (!recordsEqual(leftBlock.bindings, rightBlock.bindings)) return false;
96169
96235
  }
96170
96236
  return true;
@@ -96237,14 +96303,16 @@ function draftsRecordEqualIgnoringOrder(left, right) {
96237
96303
  const leftDraft = left[draftId];
96238
96304
  const rightDraft = right[draftId];
96239
96305
  if (!leftDraft || !rightDraft) return false;
96240
- if (!draftSnapshotContentEqualIgnoringOrder(leftDraft, rightDraft)) return false;
96306
+ if (!draftSnapshotContentEqualIgnoringOrder(leftDraft, rightDraft))
96307
+ return false;
96241
96308
  }
96242
96309
  return true;
96243
96310
  }
96244
96311
  function diffToReorderOnly(previous, next) {
96245
96312
  if (!snapshotValuesEqual(previous.metadata, next.metadata)) return null;
96246
96313
  if (!snapshotValuesEqual(previous.content, next.content)) return null;
96247
- if (!linkedEntriesRecordEqual(previous.linkedEntries, next.linkedEntries)) return null;
96314
+ if (!linkedEntriesRecordEqual(previous.linkedEntries, next.linkedEntries))
96315
+ return null;
96248
96316
  if (previous.blockList.length !== next.blockList.length) return null;
96249
96317
  const previousIds = previous.blockList.map((block) => block.id);
96250
96318
  const nextIds = next.blockList.map((block) => block.id);
@@ -96261,8 +96329,12 @@ function structuralContextMatches(previous, next) {
96261
96329
  return snapshotValueContentEqual(previous.metadata, next.metadata) && snapshotValueContentEqual(previous.content, next.content) && linkedEntriesRecordEqual(previous.linkedEntries, next.linkedEntries);
96262
96330
  }
96263
96331
  function commonDraftsEqualIgnoringOrderAndVersion(previous, next, excludedDraftId) {
96264
- const previousDrafts = { ...previous.drafts };
96265
- const nextDrafts = { ...next.drafts };
96332
+ const previousDrafts = {
96333
+ ...previous.drafts
96334
+ };
96335
+ const nextDrafts = {
96336
+ ...next.drafts
96337
+ };
96266
96338
  delete previousDrafts[excludedDraftId];
96267
96339
  delete nextDrafts[excludedDraftId];
96268
96340
  return draftsRecordEqualIgnoringOrder(previousDrafts, nextDrafts);
@@ -96297,7 +96369,8 @@ function findInsertedBlock(previous, next) {
96297
96369
  const previousAfter = previous.slice(insertionIndex);
96298
96370
  const nextAfter = next.slice(insertionIndex + 1);
96299
96371
  if (!normalizedBlocksEqual(nextBefore, previousBefore)) return null;
96300
- if (!normalizedBlocksEqual(reindexNormalizedBlocks(nextAfter), previousAfter)) return null;
96372
+ if (!normalizedBlocksEqual(reindexNormalizedBlocks(nextAfter), previousAfter))
96373
+ return null;
96301
96374
  return { block: candidate, index: insertionIndex };
96302
96375
  }
96303
96376
  function findRemovedBlock(previous, next) {
@@ -96313,7 +96386,8 @@ function findRemovedBlock(previous, next) {
96313
96386
  const previousAfter = previous.slice(removalIndex + 1);
96314
96387
  const nextAfter = next.slice(removalIndex);
96315
96388
  if (!normalizedBlocksEqual(previousBefore, nextBefore)) return null;
96316
- if (!normalizedBlocksEqual(reindexNormalizedBlocks(previousAfter), nextAfter)) return null;
96389
+ if (!normalizedBlocksEqual(reindexNormalizedBlocks(previousAfter), nextAfter))
96390
+ return null;
96317
96391
  return candidate;
96318
96392
  }
96319
96393
  function deriveInsertEffect(previous, next) {
@@ -96361,12 +96435,10 @@ function reorderNormalizedBlocks(blocks, blockIds) {
96361
96435
  if (reordered.some((block) => block === null)) {
96362
96436
  return blocks;
96363
96437
  }
96364
- return reordered.map(
96365
- (block, index2) => ({
96366
- ...block,
96367
- orderIndex: index2
96368
- })
96369
- );
96438
+ return reordered.map((block, index2) => ({
96439
+ ...block,
96440
+ orderIndex: index2
96441
+ }));
96370
96442
  }
96371
96443
  function reindexNormalizedBlocks(blocks) {
96372
96444
  return blocks.map(
@@ -96394,7 +96466,9 @@ function insertNormalizedBlock(blockList, block, index2) {
96394
96466
  return reindexNormalizedBlocks(next);
96395
96467
  }
96396
96468
  function removeNormalizedBlock(blockList, blockId) {
96397
- return reindexNormalizedBlocks(blockList.filter((block) => block.id !== blockId));
96469
+ return reindexNormalizedBlocks(
96470
+ blockList.filter((block) => block.id !== blockId)
96471
+ );
96398
96472
  }
96399
96473
  function getPersistedBlockList(blocks) {
96400
96474
  return blocks.every(isPersistedBlock) ? blocks : null;
@@ -96473,10 +96547,14 @@ function applyEditorCommand(snapshot, command2) {
96473
96547
  const next = cloneRecord(source) ?? {};
96474
96548
  setAtPath(next, command2.path, command2.value);
96475
96549
  const nextCurrent = unsafeAsEditorMetadataValues(next);
96476
- const nextMetadata = updateValueSnapshot(snapshot.metadata, cloneMetadataValues, {
96477
- current: nextCurrent,
96478
- syncState: createSyncState(snapshot.metadata.baseline, nextCurrent)
96479
- });
96550
+ const nextMetadata = updateValueSnapshot(
96551
+ snapshot.metadata,
96552
+ cloneMetadataValues,
96553
+ {
96554
+ current: nextCurrent,
96555
+ syncState: createSyncState(snapshot.metadata.baseline, nextCurrent)
96556
+ }
96557
+ );
96480
96558
  if (nextMetadata === snapshot.metadata) return snapshot;
96481
96559
  return {
96482
96560
  ...snapshot,
@@ -96485,10 +96563,14 @@ function applyEditorCommand(snapshot, command2) {
96485
96563
  }
96486
96564
  case "replace-metadata": {
96487
96565
  const nextCurrent = cloneMetadataValues(command2.value);
96488
- const nextMetadata = updateValueSnapshot(snapshot.metadata, cloneMetadataValues, {
96489
- current: nextCurrent,
96490
- syncState: createSyncState(snapshot.metadata.baseline, nextCurrent)
96491
- });
96566
+ const nextMetadata = updateValueSnapshot(
96567
+ snapshot.metadata,
96568
+ cloneMetadataValues,
96569
+ {
96570
+ current: nextCurrent,
96571
+ syncState: createSyncState(snapshot.metadata.baseline, nextCurrent)
96572
+ }
96573
+ );
96492
96574
  if (nextMetadata === snapshot.metadata) return snapshot;
96493
96575
  return {
96494
96576
  ...snapshot,
@@ -96500,10 +96582,14 @@ function applyEditorCommand(snapshot, command2) {
96500
96582
  const next = cloneRecord(source) ?? {};
96501
96583
  setAtPath(next, command2.path, command2.value);
96502
96584
  const nextCurrent = unsafeAsEditorContentValues(next);
96503
- const nextContent = updateValueSnapshot(snapshot.content, cloneContentValues, {
96504
- current: nextCurrent,
96505
- syncState: createSyncState(snapshot.content.baseline, nextCurrent)
96506
- });
96585
+ const nextContent = updateValueSnapshot(
96586
+ snapshot.content,
96587
+ cloneContentValues,
96588
+ {
96589
+ current: nextCurrent,
96590
+ syncState: createSyncState(snapshot.content.baseline, nextCurrent)
96591
+ }
96592
+ );
96507
96593
  if (nextContent === snapshot.content) return snapshot;
96508
96594
  return {
96509
96595
  ...snapshot,
@@ -96512,10 +96598,14 @@ function applyEditorCommand(snapshot, command2) {
96512
96598
  }
96513
96599
  case "replace-content": {
96514
96600
  const nextCurrent = cloneContentValues(command2.value);
96515
- const nextContent = updateValueSnapshot(snapshot.content, cloneContentValues, {
96516
- current: nextCurrent,
96517
- syncState: createSyncState(snapshot.content.baseline, nextCurrent)
96518
- });
96601
+ const nextContent = updateValueSnapshot(
96602
+ snapshot.content,
96603
+ cloneContentValues,
96604
+ {
96605
+ current: nextCurrent,
96606
+ syncState: createSyncState(snapshot.content.baseline, nextCurrent)
96607
+ }
96608
+ );
96519
96609
  if (nextContent === snapshot.content) return snapshot;
96520
96610
  return {
96521
96611
  ...snapshot,
@@ -96539,7 +96629,10 @@ function applyEditorCommand(snapshot, command2) {
96539
96629
  command2.blockId,
96540
96630
  (draft) => updateDraftSnapshot(draft, {
96541
96631
  current: cloneBlockValues(command2.value),
96542
- syncState: createSyncState(draft.baseline, cloneBlockValues(command2.value))
96632
+ syncState: createSyncState(
96633
+ draft.baseline,
96634
+ cloneBlockValues(command2.value)
96635
+ )
96543
96636
  })
96544
96637
  );
96545
96638
  case "set-linked-entry-value":
@@ -96559,11 +96652,18 @@ function applyEditorCommand(snapshot, command2) {
96559
96652
  command2.entryId,
96560
96653
  (entry) => updateLinkedEntrySnapshot(entry, {
96561
96654
  current: cloneContentValues(command2.value),
96562
- syncState: createSyncState(entry.baseline, cloneContentValues(command2.value))
96655
+ syncState: createSyncState(
96656
+ entry.baseline,
96657
+ cloneContentValues(command2.value)
96658
+ )
96563
96659
  })
96564
96660
  );
96565
96661
  case "insert-block": {
96566
- const nextBlockList = insertNormalizedBlock(snapshot.blockList, command2.block, command2.index);
96662
+ const nextBlockList = insertNormalizedBlock(
96663
+ snapshot.blockList,
96664
+ command2.block,
96665
+ command2.index
96666
+ );
96567
96667
  const insertedDraft = updateDraftSnapshot(command2.draft, {
96568
96668
  meta: { orderIndex: command2.index }
96569
96669
  });
@@ -96571,7 +96671,10 @@ function applyEditorCommand(snapshot, command2) {
96571
96671
  ...snapshot.drafts,
96572
96672
  [command2.block.id]: insertedDraft
96573
96673
  };
96574
- const nextDrafts = syncDraftOrderWithBlocks(nextDraftsWithInsert, nextBlockList);
96674
+ const nextDrafts = syncDraftOrderWithBlocks(
96675
+ nextDraftsWithInsert,
96676
+ nextBlockList
96677
+ );
96575
96678
  if (normalizedBlocksEqual(nextBlockList, snapshot.blockList) && draftsRecordEqual(nextDrafts, snapshot.drafts)) {
96576
96679
  return snapshot;
96577
96680
  }
@@ -96582,11 +96685,19 @@ function applyEditorCommand(snapshot, command2) {
96582
96685
  };
96583
96686
  }
96584
96687
  case "remove-block": {
96585
- const currentBlock = snapshot.blockList.find((block) => block.id === command2.blockId);
96688
+ const currentBlock = snapshot.blockList.find(
96689
+ (block) => block.id === command2.blockId
96690
+ );
96586
96691
  if (!currentBlock) return snapshot;
96587
- const nextBlockList = removeNormalizedBlock(snapshot.blockList, command2.blockId);
96692
+ const nextBlockList = removeNormalizedBlock(
96693
+ snapshot.blockList,
96694
+ command2.blockId
96695
+ );
96588
96696
  const { [command2.blockId]: _removedDraft, ...remainingDrafts } = snapshot.drafts;
96589
- const nextDrafts = syncDraftOrderWithBlocks(remainingDrafts, nextBlockList);
96697
+ const nextDrafts = syncDraftOrderWithBlocks(
96698
+ remainingDrafts,
96699
+ nextBlockList
96700
+ );
96590
96701
  if (normalizedBlocksEqual(nextBlockList, snapshot.blockList) && draftsRecordEqual(nextDrafts, snapshot.drafts)) {
96591
96702
  return snapshot;
96592
96703
  }
@@ -96599,9 +96710,14 @@ function applyEditorCommand(snapshot, command2) {
96599
96710
  case "reorder-blocks": {
96600
96711
  const persistedBlocks = getPersistedBlockList(snapshot.blockList);
96601
96712
  if (!persistedBlocks) {
96602
- throw new Error("reorder-blocks requires every block in the structure list to be persisted");
96713
+ throw new Error(
96714
+ "reorder-blocks requires every block in the structure list to be persisted"
96715
+ );
96603
96716
  }
96604
- const nextBlocks = reorderNormalizedBlocks(persistedBlocks, command2.blockIds);
96717
+ const nextBlocks = reorderNormalizedBlocks(
96718
+ persistedBlocks,
96719
+ command2.blockIds
96720
+ );
96605
96721
  const nextDrafts = syncDraftOrderWithBlocks(snapshot.drafts, nextBlocks);
96606
96722
  if (normalizedBlocksEqual(nextBlocks, snapshot.blockList) && draftsRecordEqual(nextDrafts, snapshot.drafts)) {
96607
96723
  return snapshot;
@@ -96646,6 +96762,8 @@ function applySystemOperation(snapshot, operation) {
96646
96762
  return setMetadataPublishedBaseline(snapshot, operation.published);
96647
96763
  case "set-content-published-baseline":
96648
96764
  return setContentPublishedBaseline(snapshot, operation.published);
96765
+ case "apply-publish-success":
96766
+ return applyPublishSuccessTransition(snapshot, operation.transition);
96649
96767
  case "autosave-metadata-succeeded":
96650
96768
  return autosaveMetadataSucceeded(
96651
96769
  snapshot,
@@ -96667,9 +96785,19 @@ function applySystemOperation(snapshot, operation) {
96667
96785
  case "clear-content-error":
96668
96786
  return clearContentError(snapshot);
96669
96787
  case "init-new-draft-block":
96670
- return initNewDraftBlock(snapshot, operation.blockId, operation.baseline, operation.meta);
96788
+ return initNewDraftBlock(
96789
+ snapshot,
96790
+ operation.blockId,
96791
+ operation.baseline,
96792
+ operation.meta
96793
+ );
96671
96794
  case "update-draft-block-baseline":
96672
- return updateDraftBlockBaseline(snapshot, operation.blockId, operation.baseline, operation.meta);
96795
+ return updateDraftBlockBaseline(
96796
+ snapshot,
96797
+ operation.blockId,
96798
+ operation.baseline,
96799
+ operation.meta
96800
+ );
96673
96801
  case "remove-draft-block":
96674
96802
  return removeDraftBlock(snapshot, operation.blockId);
96675
96803
  case "set-draft-published-baselines":
@@ -96702,7 +96830,11 @@ function applySystemOperation(snapshot, operation) {
96702
96830
  operation.optimisticHash
96703
96831
  );
96704
96832
  case "save-linked-entry-failed":
96705
- return saveLinkedEntryFailed(snapshot, operation.entryId, operation.message);
96833
+ return saveLinkedEntryFailed(
96834
+ snapshot,
96835
+ operation.entryId,
96836
+ operation.message
96837
+ );
96706
96838
  case "clear-linked-entry-error":
96707
96839
  return clearLinkedEntryError(snapshot, operation.entryId);
96708
96840
  case "replace-block-list":
@@ -96715,12 +96847,16 @@ function hydrateMetadataSnapshot(snapshot, baseline, current, published) {
96715
96847
  const nextBaseline = cloneMetadataValues(baseline);
96716
96848
  const nextCurrent = cloneMetadataValues(current ?? baseline ?? null);
96717
96849
  const nextPublished = published !== void 0 ? cloneMetadataValues(published) : snapshot.metadata.publishedBaseline;
96718
- const nextMetadata = updateValueSnapshot(snapshot.metadata, cloneMetadataValues, {
96719
- baseline: nextBaseline,
96720
- current: nextCurrent,
96721
- publishedBaseline: nextPublished,
96722
- syncState: createSyncState(nextBaseline, nextCurrent)
96723
- });
96850
+ const nextMetadata = updateValueSnapshot(
96851
+ snapshot.metadata,
96852
+ cloneMetadataValues,
96853
+ {
96854
+ baseline: nextBaseline,
96855
+ current: nextCurrent,
96856
+ publishedBaseline: nextPublished,
96857
+ syncState: createSyncState(nextBaseline, nextCurrent)
96858
+ }
96859
+ );
96724
96860
  if (nextMetadata === snapshot.metadata) return snapshot;
96725
96861
  return {
96726
96862
  ...snapshot,
@@ -96731,12 +96867,16 @@ function hydrateContentSnapshot(snapshot, baseline, current, published) {
96731
96867
  const nextBaseline = cloneContentValues(baseline);
96732
96868
  const nextCurrent = cloneContentValues(current ?? baseline ?? null);
96733
96869
  const nextPublished = published !== void 0 ? cloneContentValues(published) : snapshot.content.publishedBaseline;
96734
- const nextContent = updateValueSnapshot(snapshot.content, cloneContentValues, {
96735
- baseline: nextBaseline,
96736
- current: nextCurrent,
96737
- publishedBaseline: nextPublished,
96738
- syncState: createSyncState(nextBaseline, nextCurrent)
96739
- });
96870
+ const nextContent = updateValueSnapshot(
96871
+ snapshot.content,
96872
+ cloneContentValues,
96873
+ {
96874
+ baseline: nextBaseline,
96875
+ current: nextCurrent,
96876
+ publishedBaseline: nextPublished,
96877
+ syncState: createSyncState(nextBaseline, nextCurrent)
96878
+ }
96879
+ );
96740
96880
  if (nextContent === snapshot.content) return snapshot;
96741
96881
  return {
96742
96882
  ...snapshot,
@@ -96744,9 +96884,13 @@ function hydrateContentSnapshot(snapshot, baseline, current, published) {
96744
96884
  };
96745
96885
  }
96746
96886
  function setMetadataPublishedBaseline(snapshot, published) {
96747
- const nextMetadata = updateValueSnapshot(snapshot.metadata, cloneMetadataValues, {
96748
- publishedBaseline: cloneMetadataValues(published)
96749
- });
96887
+ const nextMetadata = updateValueSnapshot(
96888
+ snapshot.metadata,
96889
+ cloneMetadataValues,
96890
+ {
96891
+ publishedBaseline: cloneMetadataValues(published)
96892
+ }
96893
+ );
96750
96894
  if (nextMetadata === snapshot.metadata) return snapshot;
96751
96895
  return {
96752
96896
  ...snapshot,
@@ -96754,24 +96898,53 @@ function setMetadataPublishedBaseline(snapshot, published) {
96754
96898
  };
96755
96899
  }
96756
96900
  function setContentPublishedBaseline(snapshot, published) {
96757
- const nextContent = updateValueSnapshot(snapshot.content, cloneContentValues, {
96758
- publishedBaseline: cloneContentValues(published)
96759
- });
96901
+ const nextContent = updateValueSnapshot(
96902
+ snapshot.content,
96903
+ cloneContentValues,
96904
+ {
96905
+ publishedBaseline: cloneContentValues(published)
96906
+ }
96907
+ );
96760
96908
  if (nextContent === snapshot.content) return snapshot;
96761
96909
  return {
96762
96910
  ...snapshot,
96763
96911
  content: nextContent
96764
96912
  };
96765
96913
  }
96914
+ function applyPublishSuccessTransition(snapshot, transition) {
96915
+ const nextMetadataSnapshot = hydrateMetadataSnapshot(
96916
+ snapshot,
96917
+ transition.metadata.baseline,
96918
+ transition.metadata.current,
96919
+ transition.metadata.published
96920
+ );
96921
+ const nextContentSnapshot = nextMetadataSnapshot.content.version === transition.content.versionAtPublishStart && transition.content.published !== null ? hydrateContentSnapshot(
96922
+ nextMetadataSnapshot,
96923
+ transition.content.published,
96924
+ transition.content.published,
96925
+ transition.content.published
96926
+ ) : setContentPublishedBaseline(
96927
+ nextMetadataSnapshot,
96928
+ transition.content.published
96929
+ );
96930
+ return transition.blockPublishedBaselines ? setDraftPublishedBaselines(
96931
+ nextContentSnapshot,
96932
+ transition.blockPublishedBaselines
96933
+ ) : nextContentSnapshot;
96934
+ }
96766
96935
  function autosaveMetadataSucceeded(snapshot, savedValues, acknowledgedVersion) {
96767
96936
  const currentMetadata = snapshot.metadata;
96768
96937
  const savedBaseline = cloneMetadataValues(savedValues);
96769
96938
  const hasNewerEdits = currentMetadata.version > acknowledgedVersion;
96770
- const nextMetadata = updateValueSnapshot(currentMetadata, cloneMetadataValues, {
96771
- baseline: savedBaseline,
96772
- current: hasNewerEdits ? currentMetadata.current : savedBaseline,
96773
- syncState: hasNewerEdits ? createSyncState(savedBaseline, currentMetadata.current) : BASELINE_SYNC_STATE
96774
- });
96939
+ const nextMetadata = updateValueSnapshot(
96940
+ currentMetadata,
96941
+ cloneMetadataValues,
96942
+ {
96943
+ baseline: savedBaseline,
96944
+ current: hasNewerEdits ? currentMetadata.current : savedBaseline,
96945
+ syncState: hasNewerEdits ? createSyncState(savedBaseline, currentMetadata.current) : BASELINE_SYNC_STATE
96946
+ }
96947
+ );
96775
96948
  if (nextMetadata === currentMetadata) return snapshot;
96776
96949
  return {
96777
96950
  ...snapshot,
@@ -96794,9 +96967,13 @@ function autosaveContentSucceeded(snapshot, savedValues, acknowledgedVersion) {
96794
96967
  };
96795
96968
  }
96796
96969
  function autosaveMetadataFailed(snapshot, message2) {
96797
- const nextMetadata = updateValueSnapshot(snapshot.metadata, cloneMetadataValues, {
96798
- syncState: { kind: "failed", error: message2 ?? "Save failed" }
96799
- });
96970
+ const nextMetadata = updateValueSnapshot(
96971
+ snapshot.metadata,
96972
+ cloneMetadataValues,
96973
+ {
96974
+ syncState: { kind: "failed", error: message2 ?? "Save failed" }
96975
+ }
96976
+ );
96800
96977
  if (nextMetadata === snapshot.metadata) return snapshot;
96801
96978
  return {
96802
96979
  ...snapshot,
@@ -96804,9 +96981,13 @@ function autosaveMetadataFailed(snapshot, message2) {
96804
96981
  };
96805
96982
  }
96806
96983
  function autosaveContentFailed(snapshot, message2) {
96807
- const nextContent = updateValueSnapshot(snapshot.content, cloneContentValues, {
96808
- syncState: { kind: "failed", error: message2 ?? "Save failed" }
96809
- });
96984
+ const nextContent = updateValueSnapshot(
96985
+ snapshot.content,
96986
+ cloneContentValues,
96987
+ {
96988
+ syncState: { kind: "failed", error: message2 ?? "Save failed" }
96989
+ }
96990
+ );
96810
96991
  if (nextContent === snapshot.content) return snapshot;
96811
96992
  return {
96812
96993
  ...snapshot,
@@ -96814,9 +96995,16 @@ function autosaveContentFailed(snapshot, message2) {
96814
96995
  };
96815
96996
  }
96816
96997
  function clearMetadataError(snapshot) {
96817
- const nextMetadata = updateValueSnapshot(snapshot.metadata, cloneMetadataValues, {
96818
- syncState: createSyncState(snapshot.metadata.baseline, snapshot.metadata.current)
96819
- });
96998
+ const nextMetadata = updateValueSnapshot(
96999
+ snapshot.metadata,
97000
+ cloneMetadataValues,
97001
+ {
97002
+ syncState: createSyncState(
97003
+ snapshot.metadata.baseline,
97004
+ snapshot.metadata.current
97005
+ )
97006
+ }
97007
+ );
96820
97008
  if (nextMetadata === snapshot.metadata) return snapshot;
96821
97009
  return {
96822
97010
  ...snapshot,
@@ -96824,9 +97012,16 @@ function clearMetadataError(snapshot) {
96824
97012
  };
96825
97013
  }
96826
97014
  function clearContentError(snapshot) {
96827
- const nextContent = updateValueSnapshot(snapshot.content, cloneContentValues, {
96828
- syncState: createSyncState(snapshot.content.baseline, snapshot.content.current)
96829
- });
97015
+ const nextContent = updateValueSnapshot(
97016
+ snapshot.content,
97017
+ cloneContentValues,
97018
+ {
97019
+ syncState: createSyncState(
97020
+ snapshot.content.baseline,
97021
+ snapshot.content.current
97022
+ )
97023
+ }
97024
+ );
96830
97025
  if (nextContent === snapshot.content) return snapshot;
96831
97026
  return {
96832
97027
  ...snapshot,
@@ -96840,8 +97035,14 @@ function getSnapshotStatus(syncState) {
96840
97035
  return syncState.kind;
96841
97036
  }
96842
97037
  function buildDraftSnapshotFromBaseline(blockId, baseline, meta, existing) {
96843
- const normalizedBaseline = applyBlockDefaults(extractBlockData(baseline), meta.kind);
96844
- const normalizedPublished = applyBlockDefaults(extractBlockData(meta.publishedContent), meta.kind);
97038
+ const normalizedBaseline = applyBlockDefaults(
97039
+ extractBlockData(baseline),
97040
+ meta.kind
97041
+ );
97042
+ const normalizedPublished = applyBlockDefaults(
97043
+ extractBlockData(meta.publishedContent),
97044
+ meta.kind
97045
+ );
96845
97046
  const nextBaseline = cloneBlockValues(normalizedBaseline);
96846
97047
  const existingSyncState = existing?.syncState.kind;
96847
97048
  const shouldPreserveCurrent = existingSyncState === "pending" || existingSyncState === "failed";
@@ -96863,7 +97064,12 @@ function buildDraftSnapshotFromBaseline(blockId, baseline, meta, existing) {
96863
97064
  }
96864
97065
  function initNewDraftBlock(snapshot, blockId, baseline, meta) {
96865
97066
  const existing = snapshot.drafts[blockId];
96866
- const nextDraft = buildDraftSnapshotFromBaseline(blockId, baseline, meta, existing);
97067
+ const nextDraft = buildDraftSnapshotFromBaseline(
97068
+ blockId,
97069
+ baseline,
97070
+ meta,
97071
+ existing
97072
+ );
96867
97073
  if (existing && draftValuesEqual(existing, nextDraft)) {
96868
97074
  return snapshot;
96869
97075
  }
@@ -96878,26 +97084,37 @@ function initNewDraftBlock(snapshot, blockId, baseline, meta) {
96878
97084
  function updateDraftBlockBaseline(snapshot, blockId, baseline, meta) {
96879
97085
  const existing = snapshot.drafts[blockId];
96880
97086
  if (!existing) {
96881
- throw new Error(`update-draft-block-baseline requires an existing draft for ${blockId}`);
96882
- }
96883
- const nextDraft = buildDraftSnapshotFromBaseline(blockId, baseline, {
96884
- kind: meta?.kind ?? existing.meta.kind,
96885
- purpose: meta?.purpose !== void 0 ? meta.purpose : existing.meta.purpose,
96886
- orderIndex: meta?.orderIndex !== void 0 ? meta.orderIndex : existing.meta.orderIndex,
96887
- publishedContent: meta?.publishedContent !== void 0 ? meta.publishedContent : existing.meta.publishedContent
96888
- }, existing);
97087
+ throw new Error(
97088
+ `update-draft-block-baseline requires an existing draft for ${blockId}`
97089
+ );
97090
+ }
97091
+ const nextDraft = buildDraftSnapshotFromBaseline(
97092
+ blockId,
97093
+ baseline,
97094
+ {
97095
+ kind: meta?.kind ?? existing.meta.kind,
97096
+ purpose: meta?.purpose !== void 0 ? meta.purpose : existing.meta.purpose,
97097
+ orderIndex: meta?.orderIndex !== void 0 ? meta.orderIndex : existing.meta.orderIndex,
97098
+ publishedContent: meta?.publishedContent !== void 0 ? meta.publishedContent : existing.meta.publishedContent
97099
+ },
97100
+ existing
97101
+ );
96889
97102
  if (draftValuesEqual(existing, nextDraft)) {
96890
97103
  return snapshot;
96891
97104
  }
96892
- const nextBlockList = updatePersistedBlockInList(snapshot.blockList, blockId, (block) => ({
96893
- ...block,
96894
- kind: nextDraft.meta.kind,
96895
- orderIndex: nextDraft.meta.orderIndex,
96896
- purpose: nextDraft.meta.purpose,
96897
- content: nextDraft.baseline,
96898
- draftContent: nextDraft.current ?? nextDraft.baseline,
96899
- publishedContent: nextDraft.meta.publishedContent
96900
- }));
97105
+ const nextBlockList = updatePersistedBlockInList(
97106
+ snapshot.blockList,
97107
+ blockId,
97108
+ (block) => ({
97109
+ ...block,
97110
+ kind: nextDraft.meta.kind,
97111
+ orderIndex: nextDraft.meta.orderIndex,
97112
+ purpose: nextDraft.meta.purpose,
97113
+ content: nextDraft.baseline,
97114
+ draftContent: nextDraft.current ?? nextDraft.baseline,
97115
+ publishedContent: nextDraft.meta.publishedContent
97116
+ })
97117
+ );
96901
97118
  return {
96902
97119
  ...snapshot,
96903
97120
  blockList: nextBlockList,
@@ -96917,14 +97134,19 @@ function removeDraftBlock(snapshot, blockId) {
96917
97134
  };
96918
97135
  }
96919
97136
  function setDraftPublishedBaselines(snapshot, blocks) {
96920
- let nextDrafts = { ...snapshot.drafts };
97137
+ let nextDrafts = {
97138
+ ...snapshot.drafts
97139
+ };
96921
97140
  let nextBlockList = snapshot.blockList;
96922
97141
  let changed = false;
96923
97142
  for (const block of blocks) {
96924
97143
  const draft = nextDrafts[block.id];
96925
97144
  if (!draft) continue;
96926
97145
  const kindForDefaults = block.kind ?? draft.meta.kind;
96927
- const normalizedPublished = applyBlockDefaults(extractBlockData(block.publishedContent), kindForDefaults);
97146
+ const normalizedPublished = applyBlockDefaults(
97147
+ extractBlockData(block.publishedContent),
97148
+ kindForDefaults
97149
+ );
96928
97150
  const nextDraft = updateDraftSnapshot(draft, {
96929
97151
  meta: {
96930
97152
  publishedContent: cloneBlockValues(normalizedPublished ?? null)
@@ -96932,11 +97154,15 @@ function setDraftPublishedBaselines(snapshot, blocks) {
96932
97154
  });
96933
97155
  if (nextDraft === draft) continue;
96934
97156
  nextDrafts[block.id] = nextDraft;
96935
- nextBlockList = updatePersistedBlockInList(nextBlockList, block.id, (currentBlock) => ({
96936
- ...currentBlock,
96937
- kind: kindForDefaults,
96938
- publishedContent: nextDraft.meta.publishedContent
96939
- }));
97157
+ nextBlockList = updatePersistedBlockInList(
97158
+ nextBlockList,
97159
+ block.id,
97160
+ (currentBlock) => ({
97161
+ ...currentBlock,
97162
+ kind: kindForDefaults,
97163
+ publishedContent: nextDraft.meta.publishedContent
97164
+ })
97165
+ );
96940
97166
  changed = true;
96941
97167
  }
96942
97168
  if (!changed) return snapshot;
@@ -96961,11 +97187,15 @@ function autosaveDraftSucceeded(snapshot, blockId, savedValues, acknowledgedVers
96961
97187
  if (nextDraft === draft) {
96962
97188
  return snapshot;
96963
97189
  }
96964
- const nextBlockList = updatePersistedBlockInList(snapshot.blockList, blockId, (block) => ({
96965
- ...block,
96966
- content: nextDraft.baseline,
96967
- draftContent: nextDraft.current ?? nextDraft.baseline
96968
- }));
97190
+ const nextBlockList = updatePersistedBlockInList(
97191
+ snapshot.blockList,
97192
+ blockId,
97193
+ (block) => ({
97194
+ ...block,
97195
+ content: nextDraft.baseline,
97196
+ draftContent: nextDraft.current ?? nextDraft.baseline
97197
+ })
97198
+ );
96969
97199
  return {
96970
97200
  ...snapshot,
96971
97201
  blockList: nextBlockList,
@@ -97120,15 +97350,54 @@ function inspectDrafts(snapshot) {
97120
97350
  function getLinkedEntrySnapshot(snapshot, entryId) {
97121
97351
  return snapshot.linkedEntries[entryId] ?? null;
97122
97352
  }
97353
+ function deriveDraftValuePublicationState(draft) {
97354
+ return deriveEditorValuePublicationState({
97355
+ version: draft.version,
97356
+ baseline: draft.baseline,
97357
+ current: draft.current,
97358
+ publishedBaseline: draft.meta.publishedContent,
97359
+ syncState: draft.syncState
97360
+ });
97361
+ }
97362
+ function getFirstUnpublishedDraftChange(snapshot) {
97363
+ for (const draft of inspectDrafts(snapshot)) {
97364
+ const publicationState = deriveDraftValuePublicationState(draft);
97365
+ switch (publicationState.kind) {
97366
+ case "empty":
97367
+ case "published-clean":
97368
+ continue;
97369
+ case "unpublished-draft":
97370
+ return {
97371
+ blockId: draft.id,
97372
+ kind: draft.meta.kind,
97373
+ reason: "missing_published",
97374
+ currentContent: publicationState.current,
97375
+ publishedContent: null
97376
+ };
97377
+ case "published-missing-current":
97378
+ return {
97379
+ blockId: draft.id,
97380
+ kind: draft.meta.kind,
97381
+ reason: "missing_current",
97382
+ currentContent: null,
97383
+ publishedContent: publicationState.published
97384
+ };
97385
+ case "published-with-unpublished-changes":
97386
+ return {
97387
+ blockId: draft.id,
97388
+ kind: draft.meta.kind,
97389
+ reason: "different",
97390
+ currentContent: publicationState.current,
97391
+ publishedContent: publicationState.published
97392
+ };
97393
+ default:
97394
+ return assertNever9(publicationState);
97395
+ }
97396
+ }
97397
+ return null;
97398
+ }
97123
97399
  function hasUnpublishedDraftChanges(snapshot) {
97124
- return inspectDrafts(snapshot).some((draft) => {
97125
- const currentContent = draft.current ?? draft.baseline;
97126
- const published = draft.meta.publishedContent;
97127
- if (!currentContent && !published) return false;
97128
- if (currentContent && !published) return true;
97129
- if (!currentContent && published) return true;
97130
- return !recordsEqual(currentContent, published);
97131
- });
97400
+ return getFirstUnpublishedDraftChange(snapshot) !== null;
97132
97401
  }
97133
97402
 
97134
97403
  // ../content-editor/src/ui/editorHistory.ts
@@ -97381,11 +97650,21 @@ function deriveBlockValidationSummary({
97381
97650
  // ../content-editor/src/ui/editorUiStore.ts
97382
97651
  var TEXT_COALESCE_IDLE_MS = 500;
97383
97652
  function hasUnpublishedChanges(snapshot) {
97384
- const currentContent = snapshot.current ?? snapshot.baseline;
97385
- const published = snapshot.publishedBaseline;
97386
- if (!currentContent && !published) return false;
97387
- if (currentContent && !published) return true;
97388
- return !recordsEqual(currentContent, published);
97653
+ return deriveEditorValuePublicationState(snapshot).hasUnpublishedChanges;
97654
+ }
97655
+ function toEditorPublishSuccessTransition(transition) {
97656
+ return {
97657
+ metadata: {
97658
+ baseline: transition.metadata.baseline ? unsafeAsEditorMetadataValues(transition.metadata.baseline) : null,
97659
+ current: transition.metadata.current ? unsafeAsEditorMetadataValues(transition.metadata.current) : null,
97660
+ published: transition.metadata.published ? unsafeAsEditorMetadataValues(transition.metadata.published) : null
97661
+ },
97662
+ content: {
97663
+ published: transition.content.published ? unsafeAsEditorContentValues(transition.content.published) : null,
97664
+ versionAtPublishStart: transition.content.versionAtPublishStart
97665
+ },
97666
+ blockPublishedBaselines: transition.blockPublishedBaselines
97667
+ };
97389
97668
  }
97390
97669
  function normalizeDraftBlockBaselineInput(value) {
97391
97670
  const extracted = extractBlockData(value);
@@ -97530,7 +97809,10 @@ function createEditorUiStore(options = {}) {
97530
97809
  triggerUpdate();
97531
97810
  return true;
97532
97811
  };
97533
- const applyUserEditorOperation = (operation) => commitUserSnapshot(operation.command, applyUserOperation(editorSnapshot, operation));
97812
+ const applyUserEditorOperation = (operation) => commitUserSnapshot(
97813
+ operation.command,
97814
+ applyUserOperation(editorSnapshot, operation)
97815
+ );
97534
97816
  const applySystemEditorOperation = (operation) => replacePresentSnapshot(applySystemOperation(editorSnapshot, operation));
97535
97817
  const replacePresentSnapshot = (nextSnapshot) => {
97536
97818
  if (editorHistorySnapshotsEqual(editorSnapshot, nextSnapshot)) {
@@ -97556,10 +97838,14 @@ function createEditorUiStore(options = {}) {
97556
97838
  }
97557
97839
  };
97558
97840
  const computeDraftSyncState = () => {
97559
- const metadataStatus = getSnapshotStatus(editorSnapshot.metadata.syncState);
97841
+ const metadataStatus = getSnapshotStatus(
97842
+ editorSnapshot.metadata.syncState
97843
+ );
97560
97844
  const contentStatus = getSnapshotStatus(editorSnapshot.content.syncState);
97561
- if (metadataStatus === "failed" || contentStatus === "failed") return "failed";
97562
- if (metadataStatus === "pending" || contentStatus === "pending") return "pending";
97845
+ if (metadataStatus === "failed" || contentStatus === "failed")
97846
+ return "failed";
97847
+ if (metadataStatus === "pending" || contentStatus === "pending")
97848
+ return "pending";
97563
97849
  for (const draft of inspectDrafts(editorSnapshot)) {
97564
97850
  const status = getSnapshotStatus(draft.syncState);
97565
97851
  if (status === "failed") return "failed";
@@ -97628,7 +97914,10 @@ function createEditorUiStore(options = {}) {
97628
97914
  });
97629
97915
  },
97630
97916
  autosaveFailed: (message2) => {
97631
- applySystemEditorOperation({ type: "autosave-metadata-failed", message: message2 });
97917
+ applySystemEditorOperation({
97918
+ type: "autosave-metadata-failed",
97919
+ message: message2
97920
+ });
97632
97921
  },
97633
97922
  clearError: () => {
97634
97923
  applySystemEditorOperation({ type: "clear-metadata-error" });
@@ -97832,7 +98121,9 @@ function createEditorUiStore(options = {}) {
97832
98121
  initNewBlock: (blockId, baseline, meta) => {
97833
98122
  const normalizedBaseline = normalizeDraftBlockBaselineInput(baseline);
97834
98123
  if (getDraftSnapshot(editorSnapshot, blockId)) {
97835
- throw new Error(`drafts.initNewBlock expected a missing draft (${blockId})`);
98124
+ throw new Error(
98125
+ `drafts.initNewBlock expected a missing draft (${blockId})`
98126
+ );
97836
98127
  }
97837
98128
  const changed = applySystemEditorOperation({
97838
98129
  type: "init-new-draft-block",
@@ -97852,7 +98143,9 @@ function createEditorUiStore(options = {}) {
97852
98143
  updateBlockBaseline: (blockId, baseline, meta) => {
97853
98144
  const normalizedBaseline = normalizeDraftBlockBaselineInput(baseline);
97854
98145
  if (!getDraftSnapshot(editorSnapshot, blockId)) {
97855
- throw new Error(`drafts.updateBlockBaseline expected an existing draft (${blockId})`);
98146
+ throw new Error(
98147
+ `drafts.updateBlockBaseline expected an existing draft (${blockId})`
98148
+ );
97856
98149
  }
97857
98150
  const changed = applySystemEditorOperation({
97858
98151
  type: "update-draft-block-baseline",
@@ -97868,7 +98161,10 @@ function createEditorUiStore(options = {}) {
97868
98161
  }
97869
98162
  },
97870
98163
  setBlockPublishedBaselinesFromBlocks: (blocks) => {
97871
- const changed = applySystemEditorOperation({ type: "set-draft-published-baselines", blocks });
98164
+ const changed = applySystemEditorOperation({
98165
+ type: "set-draft-published-baselines",
98166
+ blocks
98167
+ });
97872
98168
  if (changed) {
97873
98169
  notifyDraftChanges(blocks.map((block) => block.id));
97874
98170
  }
@@ -97989,44 +98285,7 @@ function createEditorUiStore(options = {}) {
97989
98285
  }
97990
98286
  },
97991
98287
  hasUnpublishedBlockChanges: () => hasUnpublishedDraftChanges(editorSnapshot),
97992
- getFirstUnpublishedBlockChange: () => {
97993
- for (const draft of inspectDrafts(editorSnapshot)) {
97994
- const currentContent = draft.current ?? draft.baseline;
97995
- const published = draft.meta.publishedContent;
97996
- if (!currentContent && !published) continue;
97997
- if (currentContent && !published) {
97998
- return {
97999
- blockId: draft.id,
98000
- kind: draft.meta.kind,
98001
- reason: "missing_published",
98002
- currentContent,
98003
- publishedContent: null
98004
- };
98005
- }
98006
- if (!currentContent && published) {
98007
- return {
98008
- blockId: draft.id,
98009
- kind: draft.meta.kind,
98010
- reason: "missing_current",
98011
- currentContent: null,
98012
- publishedContent: published
98013
- };
98014
- }
98015
- if (!recordsEqual(
98016
- currentContent,
98017
- published
98018
- )) {
98019
- return {
98020
- blockId: draft.id,
98021
- kind: draft.meta.kind,
98022
- reason: "different",
98023
- currentContent,
98024
- publishedContent: published
98025
- };
98026
- }
98027
- }
98028
- return null;
98029
- },
98288
+ getFirstUnpublishedBlockChange: () => getFirstUnpublishedDraftChange(editorSnapshot),
98030
98289
  markAllBlocksAsPublished: () => {
98031
98290
  const blocks = inspectDrafts(editorSnapshot).map((draft) => ({
98032
98291
  id: draft.id,
@@ -98112,7 +98371,10 @@ function createEditorUiStore(options = {}) {
98112
98371
  const clearHistory = () => {
98113
98372
  clearCoalescingSession();
98114
98373
  const nextHistoryState = createHistoryState(editorSnapshot);
98115
- if (historyState.past.length === 0 && historyState.future.length === 0 && editorHistorySnapshotsEqual(historyState.present, nextHistoryState.present)) {
98374
+ if (historyState.past.length === 0 && historyState.future.length === 0 && editorHistorySnapshotsEqual(
98375
+ historyState.present,
98376
+ nextHistoryState.present
98377
+ )) {
98116
98378
  return;
98117
98379
  }
98118
98380
  historyState = nextHistoryState;
@@ -98153,7 +98415,9 @@ function createEditorUiStore(options = {}) {
98153
98415
  activePreviewField: null,
98154
98416
  focusRequest: null,
98155
98417
  activeBlockId: null,
98156
- setDrawerOpen: (open) => set3((state) => state.drawerOpen === open ? state : { drawerOpen: open }),
98418
+ setDrawerOpen: (open) => set3(
98419
+ (state) => state.drawerOpen === open ? state : { drawerOpen: open }
98420
+ ),
98157
98421
  setPreviewSidebarTab: (tab) => set3(
98158
98422
  (state) => state.previewSidebarTab === tab ? state : { previewSidebarTab: tab }
98159
98423
  ),
@@ -98186,8 +98450,12 @@ function createEditorUiStore(options = {}) {
98186
98450
  itemIndex: typeof payload.itemIndex === "number" ? payload.itemIndex : null
98187
98451
  }
98188
98452
  }),
98189
- clearFocus: () => set3((state) => state.focusRequest === null ? state : { focusRequest: null }),
98190
- setActiveBlockId: (id) => set3((state) => state.activeBlockId === id ? state : { activeBlockId: id }),
98453
+ clearFocus: () => set3(
98454
+ (state) => state.focusRequest === null ? state : { focusRequest: null }
98455
+ ),
98456
+ setActiveBlockId: (id) => set3(
98457
+ (state) => state.activeBlockId === id ? state : { activeBlockId: id }
98458
+ ),
98191
98459
  getDraftSyncState: () => computeDraftSyncState(),
98192
98460
  getUnpublishedState: () => deriveEditorUnpublishedState({
98193
98461
  metadataHasUnpublishedChanges: metadataSlice.hasUnpublishedChanges(),
@@ -98197,6 +98465,12 @@ function createEditorUiStore(options = {}) {
98197
98465
  hasBeenPublishedBefore: editorSnapshot.metadata.publishedBaseline !== null
98198
98466
  }),
98199
98467
  hasAnyUnpublishedChanges: () => get3().getUnpublishedState().hasUnpublishedChanges,
98468
+ applyPublishSuccessTransition: (transition) => {
98469
+ applySystemEditorOperation({
98470
+ type: "apply-publish-success",
98471
+ transition: toEditorPublishSuccessTransition(transition)
98472
+ });
98473
+ },
98200
98474
  history: {
98201
98475
  getState: () => historyState,
98202
98476
  canUndo: () => canUndoHistory(historyState),
@@ -98770,28 +99044,6 @@ function cloneFieldCollection(collection) {
98770
99044
  return JSON.parse(JSON.stringify(collection));
98771
99045
  }
98772
99046
 
98773
- // ../api/src/common/envelope.ts
98774
- function isApiSuccess(result) {
98775
- return result.success === true;
98776
- }
98777
- var ApiEnvelopeError = class extends Error {
98778
- constructor(error) {
98779
- super(error.message);
98780
- this.name = "ApiEnvelopeError";
98781
- this.code = error.code;
98782
- this.requestId = error.requestId;
98783
- this.timestamp = error.timestamp;
98784
- this.status = error.status;
98785
- this.fieldErrors = error.fieldErrors;
98786
- }
98787
- };
98788
- function unwrapResponse(result) {
98789
- if (isApiSuccess(result)) {
98790
- return result.data;
98791
- }
98792
- throw new ApiEnvelopeError(result.error);
98793
- }
98794
-
98795
99047
  // ../api/src/utils/isRecord.ts
98796
99048
  function isRecord16(value) {
98797
99049
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -99451,8 +99703,14 @@ async function waitForAutosavesComplete(uiStore, timeoutMs = 6e4) {
99451
99703
  function getDirtyAutosaveTypes(uiStore, hasRoute) {
99452
99704
  const state = uiStore.getState();
99453
99705
  const snapshots = [
99454
- { scope: { kind: "metadata" }, syncState: state.metadata.getSnapshot().syncState },
99455
- { scope: { kind: "content" }, syncState: state.content.getSnapshot().syncState }
99706
+ {
99707
+ scope: { kind: "metadata" },
99708
+ syncState: state.metadata.getSnapshot().syncState
99709
+ },
99710
+ {
99711
+ scope: { kind: "content" },
99712
+ syncState: state.content.getSnapshot().syncState
99713
+ }
99456
99714
  ];
99457
99715
  if (hasRoute) {
99458
99716
  for (const draft of state.drafts.inspect()) {
@@ -99471,9 +99729,7 @@ function getDirtyAutosaveTypes(uiStore, hasRoute) {
99471
99729
  return uniqueAutosaveSchedulerKeys(deriveDirtyAutosaveScopes(snapshots));
99472
99730
  }
99473
99731
  function hasAutosaveErrors(uiStore) {
99474
- return hasAutosaveStatusFailure(
99475
- getAutosaveStatusesByScheduler(uiStore)
99476
- );
99732
+ return hasAutosaveStatusFailure(getAutosaveStatusesByScheduler(uiStore));
99477
99733
  }
99478
99734
  function autosaveStatusesByScheduler(autosave) {
99479
99735
  return {
@@ -99528,99 +99784,110 @@ function useEntryActions({
99528
99784
  throw new Error(message2);
99529
99785
  }
99530
99786
  }, [uiStore, hasRoute, setErrorMessage]);
99531
- const performPublish = useCallback(async (options) => {
99532
- setErrorMessage(null);
99533
- const validationErrors = validateAllBlocks(uiStore);
99534
- const publishability = derivePublishability({
99535
- unpublishedState: uiStore.getState().getUnpublishedState(),
99536
- validationErrors,
99537
- drawerOpen: uiStore.getState().drawerOpen,
99538
- includeAutosaveFailures: true,
99539
- autosave: getAutosaveStatusesByScheduler(uiStore)
99540
- });
99541
- if (publishability.kind === "blocked") {
99542
- switch (publishability.reason) {
99543
- case "invalidBlocks":
99544
- applyBlockedPublishPlan(
99545
- uiStore,
99546
- publishability.blockedPublishPlan,
99547
- setErrorMessage
99548
- );
99549
- return;
99550
- case "noUnpublishedChanges":
99551
- return;
99552
- case "invalidBlockSummary":
99553
- return;
99554
- case "autosaveFailed":
99555
- setErrorMessage("Cannot publish: failed to save draft changes.");
99556
- throw new Error("Cannot publish: failed to save draft changes.");
99557
- }
99558
- }
99559
- const dirtyTypes = getDirtyAutosaveTypes(uiStore, hasRoute);
99560
- uiStore.getState().autosave.saveNow(dirtyTypes);
99561
- uiStore.getState().autosave.flushAllPending();
99562
- await waitForAutosavesComplete(uiStore);
99563
- const autosavePublishability = derivePublishability({
99564
- unpublishedState: uiStore.getState().getUnpublishedState(),
99565
- validationErrors: [],
99566
- drawerOpen: uiStore.getState().drawerOpen,
99567
- includeAutosaveFailures: true,
99568
- autosave: getAutosaveStatusesByScheduler(uiStore)
99569
- });
99570
- if (autosavePublishability.kind === "blocked" && autosavePublishability.reason === "autosaveFailed") {
99571
- const message2 = "Cannot publish: failed to save draft changes.";
99572
- setErrorMessage(message2);
99573
- throw new Error(message2);
99574
- }
99575
- uiStore.getState().autosave.setMetadataStatus({ status: "saving" });
99576
- try {
99577
- const values = uiStore.getState().metadata.getCurrentValues() || {};
99578
- const publishConfig = latestRef.current.definition.publish;
99579
- const fallbackPayload = options?.mode !== "now" && hasRoute && values.draftStatus === "scheduled" && values.scheduledPublishAt ? { publishAt: values.scheduledPublishAt } : void 0;
99580
- const payload = publishConfig?.buildPayload?.(values, latestRef.current.entry) ?? fallbackPayload;
99581
- const publishResult = await latestRef.current.publishMutation.mutateAsync(payload);
99582
- const nextEntry = publishResult.snapshot;
99583
- const timestamp = (/* @__PURE__ */ new Date()).toISOString();
99584
- const snapshot = latestRef.current.syncEntry(nextEntry, {
99585
- clearError: true
99787
+ const performPublish = useCallback(
99788
+ async (options) => {
99789
+ setErrorMessage(null);
99790
+ const validationErrors = validateAllBlocks(uiStore);
99791
+ const publishability = derivePublishability({
99792
+ unpublishedState: uiStore.getState().getUnpublishedState(),
99793
+ validationErrors,
99794
+ drawerOpen: uiStore.getState().drawerOpen,
99795
+ includeAutosaveFailures: true,
99796
+ autosave: getAutosaveStatusesByScheduler(uiStore)
99586
99797
  });
99587
- uiStore.getState().autosave.setMetadataStatus({
99588
- status: "success",
99589
- lastSavedAt: timestamp
99590
- });
99591
- latestRef.current.resetFromSnapshot(snapshot, { keepValues: true });
99592
- uiStore.getState().history.clear();
99593
- uiStore.getState().blockValidation.clearAll();
99594
- const transition = buildPublishSuccessTransition({
99595
- nextEntry,
99596
- routing: latestRef.current.routing,
99597
- publishedContent: publishResult.publishedContent ?? null,
99598
- publishedBlocks: publishResult.publishedBlocks
99798
+ if (publishability.kind === "blocked") {
99799
+ switch (publishability.reason) {
99800
+ case "invalidBlocks":
99801
+ applyBlockedPublishPlan(
99802
+ uiStore,
99803
+ publishability.blockedPublishPlan,
99804
+ setErrorMessage
99805
+ );
99806
+ return;
99807
+ case "noUnpublishedChanges":
99808
+ return;
99809
+ case "invalidBlockSummary":
99810
+ return;
99811
+ case "autosaveFailed":
99812
+ setErrorMessage("Cannot publish: failed to save draft changes.");
99813
+ throw new Error("Cannot publish: failed to save draft changes.");
99814
+ }
99815
+ }
99816
+ const dirtyTypes = getDirtyAutosaveTypes(uiStore, hasRoute);
99817
+ uiStore.getState().autosave.saveNow(dirtyTypes);
99818
+ uiStore.getState().autosave.flushAllPending();
99819
+ await waitForAutosavesComplete(uiStore);
99820
+ const autosavePublishability = derivePublishability({
99821
+ unpublishedState: uiStore.getState().getUnpublishedState(),
99822
+ validationErrors: [],
99823
+ drawerOpen: uiStore.getState().drawerOpen,
99824
+ includeAutosaveFailures: true,
99825
+ autosave: getAutosaveStatusesByScheduler(uiStore)
99599
99826
  });
99600
- uiStore.getState().metadata.setPublishedBaseline(transition.metadataPublishedBaseline);
99601
- uiStore.getState().content.setPublishedBaseline(transition.contentPublishedBaseline);
99602
- if (transition.blockPublishedBaselines) {
99603
- uiStore.getState().drafts.setBlockPublishedBaselinesFromBlocks(
99604
- transition.blockPublishedBaselines
99605
- );
99827
+ if (autosavePublishability.kind === "blocked" && autosavePublishability.reason === "autosaveFailed") {
99828
+ const message2 = "Cannot publish: failed to save draft changes.";
99829
+ setErrorMessage(message2);
99830
+ throw new Error(message2);
99606
99831
  }
99607
- if (isUnpublishedChangesDebugEnabled()) {
99608
- const state = uiStore.getState();
99609
- console.log("[content-editor:useEntryActions.publish] after publish", {
99610
- unpublishedState: state.getUnpublishedState(),
99611
- draftSyncState: state.getDraftSyncState(),
99612
- metadataHasUnpublishedChanges: state.metadata.hasUnpublishedChanges(),
99613
- contentHasUnpublishedChanges: state.content.hasUnpublishedChanges(),
99614
- blocksHaveUnpublishedChanges: state.drafts.hasUnpublishedBlockChanges()
99832
+ uiStore.getState().autosave.setMetadataStatus({ status: "saving" });
99833
+ const contentVersionAtPublishStart = uiStore.getState().content.getSnapshot().version;
99834
+ try {
99835
+ const values = uiStore.getState().metadata.getCurrentValues() || {};
99836
+ const publishConfig = latestRef.current.definition.publish;
99837
+ const fallbackPayload = options?.mode !== "now" && hasRoute && values.draftStatus === "scheduled" && values.scheduledPublishAt ? { publishAt: values.scheduledPublishAt } : void 0;
99838
+ const payload = publishConfig?.buildPayload?.(values, latestRef.current.entry) ?? fallbackPayload;
99839
+ const publishResult = await latestRef.current.publishMutation.mutateAsync(payload);
99840
+ const nextEntry = publishResult.snapshot;
99841
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString();
99842
+ const snapshot = latestRef.current.syncEntry(nextEntry, {
99843
+ clearError: true
99615
99844
  });
99845
+ uiStore.getState().autosave.setMetadataStatus({
99846
+ status: "success",
99847
+ lastSavedAt: timestamp
99848
+ });
99849
+ const transition = buildPublishSuccessTransition({
99850
+ nextEntry,
99851
+ routing: latestRef.current.routing,
99852
+ publishedContent: publishResult.publishedContent ?? null,
99853
+ publishedBlocks: publishResult.publishedBlocks
99854
+ });
99855
+ uiStore.getState().applyPublishSuccessTransition({
99856
+ metadata: {
99857
+ baseline: snapshot.baseline,
99858
+ current: snapshot.values,
99859
+ published: transition.metadataPublishedBaseline
99860
+ },
99861
+ content: {
99862
+ published: transition.contentPublishedBaseline,
99863
+ versionAtPublishStart: contentVersionAtPublishStart
99864
+ },
99865
+ blockPublishedBaselines: transition.blockPublishedBaselines
99866
+ });
99867
+ uiStore.getState().history.clear();
99868
+ uiStore.getState().blockValidation.clearAll();
99869
+ if (isUnpublishedChangesDebugEnabled()) {
99870
+ const state = uiStore.getState();
99871
+ console.log(
99872
+ "[content-editor:useEntryActions.publish] after publish",
99873
+ {
99874
+ unpublishedState: state.getUnpublishedState(),
99875
+ draftSyncState: state.getDraftSyncState(),
99876
+ metadataHasUnpublishedChanges: state.metadata.hasUnpublishedChanges(),
99877
+ contentHasUnpublishedChanges: state.content.hasUnpublishedChanges(),
99878
+ blocksHaveUnpublishedChanges: state.drafts.hasUnpublishedBlockChanges()
99879
+ }
99880
+ );
99881
+ }
99882
+ } catch (error) {
99883
+ const message2 = error instanceof Error ? error.message : "Failed to publish entry";
99884
+ uiStore.getState().autosave.setMetadataStatus({ status: "error" });
99885
+ setErrorMessage(message2);
99886
+ throw error;
99616
99887
  }
99617
- } catch (error) {
99618
- const message2 = error instanceof Error ? error.message : "Failed to publish entry";
99619
- uiStore.getState().autosave.setMetadataStatus({ status: "error" });
99620
- setErrorMessage(message2);
99621
- throw error;
99622
- }
99623
- }, [hasRoute, uiStore, setErrorMessage]);
99888
+ },
99889
+ [hasRoute, uiStore, setErrorMessage]
99890
+ );
99624
99891
  const performDiscard = useCallback(async () => {
99625
99892
  uiStore.getState().autosave.setMetadataStatus({ status: "saving" });
99626
99893
  setErrorMessage(null);
@@ -100655,7 +100922,7 @@ function useEntrySyncHelpers({
100655
100922
  [createSnapshot, setErrorMessage]
100656
100923
  );
100657
100924
  const resetFromSnapshot = useCallback(
100658
- (snapshot, _resetOptions) => {
100925
+ (snapshot) => {
100659
100926
  uiStore.getState().metadata.hydrate(snapshot.baseline, snapshot.values);
100660
100927
  },
100661
100928
  [uiStore]
@@ -101185,9 +101452,9 @@ function useInternalValue(props2) {
101185
101452
  setErrorMessage
101186
101453
  });
101187
101454
  const resetFromSnapshotWithSkipFlag = useCallback(
101188
- (snapshot, resetOptions) => {
101455
+ (snapshot) => {
101189
101456
  skipAutoSaveRef.current = true;
101190
- resetFromSnapshot(snapshot, resetOptions);
101457
+ resetFromSnapshot(snapshot);
101191
101458
  },
101192
101459
  [resetFromSnapshot]
101193
101460
  );
@@ -150638,6 +150905,14 @@ var MediaUploaderError = class extends Error {
150638
150905
  this.cause = options.cause;
150639
150906
  }
150640
150907
  };
150908
+ var SignedUrlUploadError = class extends Error {
150909
+ constructor(status) {
150910
+ super("Signed URL upload failed");
150911
+ this.name = "SignedUrlUploadError";
150912
+ this.status = status;
150913
+ }
150914
+ };
150915
+ var DEFAULT_UPLOAD_ERROR_MESSAGE = "Upload failed. Please try again.";
150641
150916
  var useApiMediaUploader = ({
150642
150917
  siteId,
150643
150918
  apiClient,
@@ -150646,6 +150921,7 @@ var useApiMediaUploader = ({
150646
150921
  videoPrepIntent,
150647
150922
  loadVideoPrep,
150648
150923
  onClassification,
150924
+ onUploadError,
150649
150925
  logger: providedLogger
150650
150926
  }) => {
150651
150927
  const loggerRef = useRef(providedLogger ?? createConsoleLogger());
@@ -150719,7 +150995,8 @@ var useApiMediaUploader = ({
150719
150995
  });
150720
150996
  }
150721
150997
  } catch (error) {
150722
- const message2 = extractUploadError(error);
150998
+ const uploaderError = mediaUploaderErrorFromCaught(error);
150999
+ const { message: message2 } = uploaderError;
150723
151000
  if (error instanceof ApiRequestError) {
150724
151001
  uploadLogger.error("media upload failed", { status: error.status, message: message2 });
150725
151002
  } else {
@@ -150728,7 +151005,8 @@ var useApiMediaUploader = ({
150728
151005
  error: error instanceof Error ? error.message : String(error)
150729
151006
  });
150730
151007
  }
150731
- throw mediaUploaderErrorFromCaught(error, message2);
151008
+ onUploadError?.(uploaderError, file);
151009
+ throw uploaderError;
150732
151010
  }
150733
151011
  onProgress?.(file.size, file.size, "uploading");
150734
151012
  if (autoClassify) {
@@ -150742,7 +151020,7 @@ var useApiMediaUploader = ({
150742
151020
  }
150743
151021
  return asset;
150744
151022
  },
150745
- [siteId, autoClassify, onClassification, uploadIntent, videoPrepIntent, loadVideoPrep]
151023
+ [siteId, autoClassify, onClassification, uploadIntent, videoPrepIntent, loadVideoPrep, onUploadError]
150746
151024
  );
150747
151025
  };
150748
151026
  async function maybePrepareVideoFile(input) {
@@ -150900,7 +151178,7 @@ var putBlobToSignedUrl = ({
150900
151178
  headers: { "Content-Type": contentType },
150901
151179
  body: blob
150902
151180
  }).then((response) => {
150903
- if (!response.ok) throw new Error(`Upload failed with status ${response.status}`);
151181
+ if (!response.ok) throw new SignedUrlUploadError(response.status);
150904
151182
  });
150905
151183
  }
150906
151184
  return new Promise((resolve, reject) => {
@@ -150914,7 +151192,7 @@ var putBlobToSignedUrl = ({
150914
151192
  if (xhr.status >= 200 && xhr.status < 300) {
150915
151193
  resolve();
150916
151194
  } else {
150917
- reject(new Error(`Upload failed with status ${xhr.status}`));
151195
+ reject(new SignedUrlUploadError(xhr.status));
150918
151196
  }
150919
151197
  });
150920
151198
  xhr.addEventListener("error", () => reject(new Error("Upload failed")));
@@ -150924,27 +151202,28 @@ var putBlobToSignedUrl = ({
150924
151202
  xhr.send(blob);
150925
151203
  });
150926
151204
  };
150927
- var extractUploadError = (error) => {
151205
+ var uploadMessageFromUnknownError = (error) => {
150928
151206
  if (error instanceof ApiEnvelopeError) {
150929
- return error.message.trim() ? error.message : "Upload failed";
151207
+ return error.message.trim() ? error.message : DEFAULT_UPLOAD_ERROR_MESSAGE;
150930
151208
  }
150931
151209
  if (error instanceof ApiRequestError) {
150932
- const payload = error.body;
150933
- for (const value of [payload?.error, payload?.message]) {
150934
- if (typeof value === "string" && value.trim()) {
150935
- return value;
150936
- }
151210
+ const envelope = extractApiEnvelopeErrorDetails(error.body);
151211
+ if (envelope.message) {
151212
+ return envelope.message;
150937
151213
  }
150938
- return `Upload failed with status ${error.status}`;
151214
+ return DEFAULT_UPLOAD_ERROR_MESSAGE;
151215
+ }
151216
+ if (error instanceof SignedUrlUploadError) {
151217
+ return DEFAULT_UPLOAD_ERROR_MESSAGE;
150939
151218
  }
150940
151219
  if (error instanceof Error && error.message.trim()) {
150941
151220
  return error.message;
150942
151221
  }
150943
- return "Upload failed";
151222
+ return DEFAULT_UPLOAD_ERROR_MESSAGE;
150944
151223
  };
150945
- function mediaUploaderErrorFromCaught(error, message2) {
151224
+ function mediaUploaderErrorFromCaught(error) {
150946
151225
  if (error instanceof ApiEnvelopeError) {
150947
- return new MediaUploaderError(message2, {
151226
+ return new MediaUploaderError(uploadMessageFromUnknownError(error), {
150948
151227
  code: error.code,
150949
151228
  status: error.status,
150950
151229
  fieldErrors: error.fieldErrors,
@@ -150952,12 +151231,21 @@ function mediaUploaderErrorFromCaught(error, message2) {
150952
151231
  });
150953
151232
  }
150954
151233
  if (error instanceof ApiRequestError) {
150955
- return new MediaUploaderError(message2, {
151234
+ const envelope = extractApiEnvelopeErrorDetails(error.body);
151235
+ return new MediaUploaderError(envelope.message ?? DEFAULT_UPLOAD_ERROR_MESSAGE, {
151236
+ code: envelope.code ?? error.errorCode,
151237
+ status: envelope.status ?? error.status,
151238
+ fieldErrors: envelope.fieldErrors ?? void 0,
151239
+ cause: error
151240
+ });
151241
+ }
151242
+ if (error instanceof SignedUrlUploadError) {
151243
+ return new MediaUploaderError(DEFAULT_UPLOAD_ERROR_MESSAGE, {
150956
151244
  status: error.status,
150957
151245
  cause: error
150958
151246
  });
150959
151247
  }
150960
- return new MediaUploaderError(message2, { cause: error });
151248
+ return new MediaUploaderError(uploadMessageFromUnknownError(error), { cause: error });
150961
151249
  }
150962
151250
  var findIndex2 = (arr, id) => arr.findIndex((asset) => asset.id === id);
150963
151251
  var MediaLibrary = ({
@@ -157415,7 +157703,8 @@ var MediaPickerDialog = ({
157415
157703
  className: isError ? "h-full bg-destructive" : isSuccess ? "h-full bg-green-500" : "h-full bg-primary",
157416
157704
  style: { width: `${progress}%` }
157417
157705
  }
157418
- ) })
157706
+ ) }),
157707
+ isError && item.error?.message ? /* @__PURE__ */ jsx("p", { className: "mt-2 text-sm text-destructive", children: item.error.message }) : null
157419
157708
  ] }, item.id);
157420
157709
  }) }) : null
157421
157710
  ] })
@@ -182318,7 +182607,7 @@ function TabButton({ active, label, onClick }) {
182318
182607
  {
182319
182608
  type: "button",
182320
182609
  className: cn(
182321
- "flex-1 rounded-sm px-3 py-2 text-sm font-medium transition",
182610
+ "min-w-0 flex-1 truncate rounded-sm px-3 py-2 text-sm font-medium transition",
182322
182611
  active ? "bg-background shadow" : "hover:bg-background/50",
182323
182612
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
182324
182613
  ),
@@ -182338,18 +182627,19 @@ function InternalTabPanel(props2) {
182338
182627
  onSearchChange,
182339
182628
  onSelectRouteId
182340
182629
  } = props2;
182341
- return /* @__PURE__ */ jsxs("div", { className: "space-y-3 pt-1", children: [
182630
+ return /* @__PURE__ */ jsxs("div", { className: "min-w-0 space-y-3 pt-1", children: [
182342
182631
  /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Select any published or draft page, post, or routed entry for this site." }),
182343
182632
  /* @__PURE__ */ jsx(
182344
182633
  Input,
182345
182634
  {
182635
+ className: "min-w-0",
182346
182636
  placeholder: loadingItems ? "Loading\u2026" : "Search content...",
182347
182637
  value: searchQuery,
182348
182638
  onChange: (event) => onSearchChange(event.target.value),
182349
182639
  disabled: loadingItems
182350
182640
  }
182351
182641
  ),
182352
- /* @__PURE__ */ jsx("div", { className: "max-h-64 overflow-y-auto rounded-md border border-input", children: filteredItems.length > 0 ? filteredItems.map((item) => {
182642
+ /* @__PURE__ */ jsx("div", { className: "min-w-0 max-w-full overflow-hidden rounded-md border border-input", children: /* @__PURE__ */ jsx("div", { className: "max-h-64 overflow-y-auto", children: filteredItems.length > 0 ? filteredItems.map((item) => {
182353
182643
  const isSelected = selectedRouteId === item.routeId;
182354
182644
  const title = getDisplayTitle(item);
182355
182645
  return /* @__PURE__ */ jsxs(
@@ -182357,12 +182647,12 @@ function InternalTabPanel(props2) {
182357
182647
  {
182358
182648
  type: "button",
182359
182649
  className: cn(
182360
- "flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors hover:bg-muted",
182650
+ "flex min-w-0 w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors hover:bg-muted",
182361
182651
  isSelected && "bg-muted"
182362
182652
  ),
182363
182653
  onClick: () => onSelectRouteId(item.routeId),
182364
182654
  children: [
182365
- /* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
182655
+ /* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1 overflow-hidden", children: [
182366
182656
  /* @__PURE__ */ jsx("span", { className: "block truncate font-medium", children: title }),
182367
182657
  /* @__PURE__ */ jsx(
182368
182658
  "span",
@@ -182381,12 +182671,12 @@ function InternalTabPanel(props2) {
182381
182671
  },
182382
182672
  item.routeId
182383
182673
  );
182384
- }) : /* @__PURE__ */ jsx("p", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: loadingItems ? "Loading\u2026" : errorMessage ?? "No routable content yet" }) }),
182385
- selectedItem ? /* @__PURE__ */ jsxs("div", { className: "rounded-md border border-border bg-muted/30 px-3 py-2 text-sm", children: [
182386
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
182387
- /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
182388
- /* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: getDisplayTitle(selectedItem) }),
182389
- /* @__PURE__ */ jsx(Badge2, { variant: "secondary", className: "ml-2 shrink-0", children: selectedItem.typeLabel })
182674
+ }) : /* @__PURE__ */ jsx("p", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: loadingItems ? "Loading\u2026" : errorMessage ?? "No routable content yet" }) }) }),
182675
+ selectedItem ? /* @__PURE__ */ jsxs("div", { className: "min-w-0 overflow-hidden rounded-md border border-border bg-muted/30 px-3 py-2 text-sm", children: [
182676
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center justify-between gap-2", children: [
182677
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
182678
+ /* @__PURE__ */ jsx("span", { className: "block min-w-0 truncate font-medium", children: getDisplayTitle(selectedItem) }),
182679
+ /* @__PURE__ */ jsx(Badge2, { variant: "secondary", className: "shrink-0", children: selectedItem.typeLabel })
182390
182680
  ] }),
182391
182681
  /* @__PURE__ */ jsx(
182392
182682
  Button,
@@ -182394,7 +182684,7 @@ function InternalTabPanel(props2) {
182394
182684
  type: "button",
182395
182685
  variant: "ghost",
182396
182686
  size: "sm",
182397
- className: "h-7 px-2 text-xs",
182687
+ className: "h-7 shrink-0 px-2 text-xs",
182398
182688
  onClick: () => onSelectRouteId(null),
182399
182689
  children: "Clear"
182400
182690
  }
@@ -182529,13 +182819,13 @@ function LinkPopover({ editor, tone = "dark", initialItems, loadItems }) {
182529
182819
  children: /* @__PURE__ */ jsx(Link, { className: "size-4", "aria-hidden": "true" })
182530
182820
  }
182531
182821
  ),
182532
- /* @__PURE__ */ jsx(Dialog2, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs(DialogContent2, { className: "max-h-[85vh] max-w-2xl overflow-y-auto", children: [
182822
+ /* @__PURE__ */ jsx(Dialog2, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs(DialogContent2, { className: "max-h-[85vh] w-[calc(100vw-2rem)] max-w-2xl overflow-hidden overflow-y-auto", children: [
182533
182823
  /* @__PURE__ */ jsxs(DialogHeader, { children: [
182534
182824
  /* @__PURE__ */ jsx(DialogTitle2, { children: "Choose link" }),
182535
182825
  /* @__PURE__ */ jsx(DialogDescription2, { children: "Select an internal page, an external URL, or a custom path." })
182536
182826
  ] }),
182537
- /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
182538
- /* @__PURE__ */ jsxs("div", { className: "flex gap-2 rounded-md bg-muted/40 p-1", children: [
182827
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 space-y-3", children: [
182828
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 gap-2 rounded-md bg-muted/40 p-1", children: [
182539
182829
  /* @__PURE__ */ jsx(TabButton, { active: tab === "internal", label: "Internal", onClick: () => setTab("internal") }),
182540
182830
  /* @__PURE__ */ jsx(TabButton, { active: tab === "external", label: "External URL", onClick: () => setTab("external") }),
182541
182831
  /* @__PURE__ */ jsx(TabButton, { active: tab === "custom", label: "Custom Path", onClick: () => setTab("custom") })
@@ -189013,4 +189303,4 @@ lucide-react/dist/esm/lucide-react.mjs:
189013
189303
  *)
189014
189304
  */
189015
189305
 
189016
- export { AMBIENT_BACKGROUND_ROLES2 as AMBIENT_BACKGROUND_ROLES, ArrowDown, ArrowUp, BackgroundColorField, BackgroundGradientField, Badge2 as Badge, BlockApiProvider, Box, Button, CSS2 as CSS, Callout, CalloutDescription, CalloutTitle, Card, CardContent, CardHeader, CardTitle, Check, ChevronDown, ChevronLeft, ChevronRight, Collapsible2 as Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, ColorPicker, Combobox, CommandMultiSelect, Content, ContentFieldsForm, ContentSpinner, Copy, DEFAULT_LAUNCH_READINESS_INPUT, Dialog2 as Dialog, DialogClose2 as DialogClose, DialogContent2 as DialogContent, DialogDescription2 as DialogDescription, DialogFooter, DialogHeader, DialogTitle2 as DialogTitle, DndContext, DropdownMenu2 as DropdownMenu, DropdownMenuContent2 as DropdownMenuContent, DropdownMenuItem2 as DropdownMenuItem, DropdownMenuLabel2 as DropdownMenuLabel, DropdownMenuSeparator2 as DropdownMenuSeparator, DropdownMenuTrigger2 as DropdownMenuTrigger, EDITABLE_SURFACE_FORWARDING_PROP, EMPTY_DOC, EditableBlockProvider, EditorChrome, EditorProvider, EllipsisVertical, EmptyState2 as EmptyState, EntryControllerProvider, EyeOff, FieldFrame, FixedBottomSurface, FormRenderer, GRADIENT_PRESETS, GripVertical, Image, ImagePlus, Input, KeyboardCode, LINKED_CONTENT_ENTRY_META_KEY, Label4 as Label, List2 as List, LoaderCircle, ManifestForm, Maximize2, MediaEditor, MediaEditorProvider, MediaPickerDialog, MediaPickerMini, Monitor, PAGE_DESIGN_EDITOR_STATE_FETCH_ERROR_MESSAGE, PUBLIC_FILE_FIELD_KINDS, PageRenderer, Palette, PaletteProvider, Pencil, Plus, PointerSensor, PreviewDesignCoordinatorProvider, PreviewDesignHistoryOrderProvider, PreviewRichTextEditor, PreviewTextEditor, PreviewThemeOverlayProvider, ResizableSplitPane, ResponsiveScope, RichText2 as RichText, RichTextEditorSurface, Root2, RotateCcw, SECTION_BACKGROUND_MIN_SOURCE_HEIGHT, SECTION_BACKGROUND_MIN_SOURCE_WIDTH, SITE_CHROME_CLASS_NAMES, SITE_CHROME_VISIBLE_HEADER_SELECTOR, SUBROUTE_KINDS, ScrollableDialogContent, SdkConfigProvider, Search, Select2 as Select, SelectContent2 as SelectContent, SelectItem2 as SelectItem, SelectTrigger2 as SelectTrigger, SelectValue2 as SelectValue, Separator2 as Separator, Settings, SiteChromeCustomizeProvider, SiteDocumentLayout, Smartphone, Sparkles, Surface, Tablet, Tabs2 as Tabs, TabsContent2 as TabsContent, TabsList2 as TabsList, TabsTrigger2 as TabsTrigger, Text2 as Text, Textarea, ThemeScope, Trash2, TriangleAlert, Trigger, Upload, X, applyBackgroundOverrideContentPatch, applyCompiledRuntimeFieldsToContent, applyFeatureCardIconSuggestions, applyPageDesignEditorAction, applyResolvedSelections, asDesignBlockId, asRecord, assertNever, assertNever5 as assertNever2, attachRenderableMediaAssetFields, augmentManifestWithStyleGroups, backgroundColorTokens, backgroundOverrideEquals, beginAutosaveBatch, buildApplySiteStyleSelectionBody, buildEditorModelRuntimeFieldsByBlockId, buildSiteChromeLookModels, buildThemeRuntime, buttonPersonalities, canCycleBackgroundOverrideValue, canRedoHistory, canUndoHistory, cancelPreview, classifyHistoryShortcut, classifyKnownMimeType, clearTypographyFontOverrides, clientComponentRegistry, closestCenter, cn, confirmAutosaveBatch, createBlock, createCustomBlockRegistry, createEditorInsertBlockCommand, createEditorRemoveBlockCommand, createEditorReorderBlocksCommand, createEntrySlotBlock, createFeatureCardIconKey, createHistoryState, createManifestFormAdapter, createManifestValidation, createMicrobatcher, createOptimisticActionRunner, createRoutingHelpers, createSnapshotFromPageRecord, createStoreBackend, createStyleConfiguratorState, curatedSiteStyles, cycleSiteChromeLookId, cycleableSiteChromeOptions, decodePublicProductCategorySelectorQuery, defaultBackgroundOverrideForMode, defaultSectionTransitionVariantForFamily, deleteBlock, deleteEntrySlotBlock, deriveLaunchReadiness, deriveRouteMetadataPresentation, deriveStyleConfiguratorCapabilities, deriveTransactionCapabilities, designRuntimeRulesForTheme, dismissNotices, dismissWarnings, emitMediaCropDebug, enabledBackgroundModes, enqueueTransaction, evaluateTypographyFontSlot, evaluateVisibility, expectParsedBrandedId, findButtonPersonality, findFooterLook, findPaletteVariant, findTypographyPreset, foldSubroute, formatSiteChromeBackgroundTokenLabel, getBlockDefinition, getBlockIconSemanticFallbackId, getClientRect, getCuratedSiteStyle, getDirectImageUrlForMediaAsset, getFeatureCardIconCompletion, getFieldIntent, getFooterLayout, getGeneratedBlockIconStyleState, getHeaderLayout, getHeaderStyle, getIconComponent, getIconPickerOptionsForPreset, getLinkedContentEntryMeta, getModalConfig, getPageDesignEditorState, getRichTextImagePositionFromTarget, gradientToCss, idleEditorTransactionQueueState, imagePoolForOverride, inferLegacyOfferingsPreviewGroupOrder, insertOrReplaceRichTextImage, isHeaderField, isIconPickerPreset, isInternalResolvedLinkValue, isKeyboardEvent, isKnownIconName, isNonEmptyValue, isObjectRecord2 as isObjectRecord, isOfferingsPreviewSourceKey, isPreviewingChange, isSupportedLoaderEndpoint, isSvgMimeType, isThemeV2NormalEditorRawStyleFieldName, isThemeV2NormalEditorRawStylePath, listBlockDescriptors, listContentTypes, listEntryPageContentSlots, lucide_react_exports, markApplyFailed, markApplySaved, markApplySaving, mergeBlockDescriptorsWithRegistry, mergeManifestWithSdkOptions, mutateBlockContent, normalEditorCuratedPromotedFieldPaths, normalizeOfferingsPreviewGroupOrder, normalizePickerSearchThreshold, normalizePublicApiLoaderParams, openRow, paletteOverridesSchema, paletteVariants, parseAspectRatioValue, parseBackgroundOverrideFromContent, parseBlockIconValue, parseMediaAssetId, parseSiteIconStyleGuideVersionId, parseSiteId, planBackgroundOverride, planBackgroundTransition, planPageDesignLayoutLookCompatibility, planSiteChromeFooterLayoutSelection, planSiteChromeLookSelection, planSiteDocument, planSiteStylePreviewChange, prefetchBlockData, previewAssistantEnabled, previewButtonPersonality, previewDesignHistoryDomainForCommand, previewFooterLook, previewHeaderLayout, previewHeaderStyle, previewPaletteVariant, previewSiteStyle, previewTypographyPreset, pushHistoryEntry, rankBackgroundImagePoolItems, recoveryConflictCopy, redoHistory, rejectAutosaveBatch, renderBlock, reorderBlocks, reorderEntrySlotBlocks, requireEntriesForCuratedChoices, resolveBackgroundCapability, resolveBlockTitle, resolveContentTitle, resolveIconPickerPreset, resolveImageUrlWithContext, resolveMediaSlotContract, resolveOfferingsPreviewGroupOrderEntries, resolvePageRouteSlug, resolvePickerSelectionLabel, resolvePreviewSidebarTab, resolveStyleConfiguratorInitialSnapshot, resolveVideoSelectionIntentForMediaField, resolveVisiblePromotedFieldPathsForEditorBlock, sectionTransitionFamilies, sectionTransitionFamilyForBoundaryOptionId, sectionTransitionVariantForBoundaryOptionId, selectPreviewDesignHistoryDomain, selectionSnapshotFromApplySiteStyleSelectionResponse, setPaletteOverrides, setTypographyBodyFontOverride, setTypographyHeadingFontOverride, shouldShowPickerSearch, siteFooterManifest, siteHeaderManifest, siteOptionSources, stableSerialize, styleConfiguratorHistoryEntryForPersistedSelection, suggestFeatureCardSemanticIcons, suggestSemanticIconForFeatureCard, surfaceResolutionContextFromTheme, syncStyleConfiguratorState, systemCustomizeFacetAppliesToLayoutVariant, systemCustomizeFacetApplyContentPatch, systemCustomizeFacetCurrentValue, systemCustomizeFacetDefinitionForBlock, systemCustomizeFacetDefinitionsForBlock, systemCustomizeFacetLabelForValue, systemCustomizeFacetNextValue, systemCustomizeFacetRollbackContentPatch, toFeatureCardIconSuggestionInputs, toRoutableLinkPayload, toggleRow, typographyPresets, undoHistory, unfinishedBlockCopy, unsafeAsEditorBlockId, unsafeAsEditorBlockValues, unsafeAsLinkedContentEntryId, unwrapResponse, useAsyncPickerOptions, useBackendWatch, useBlockContext, useCombinedRefs, useDebouncedLatestSave, useDndContext, useDraggable, useDroppable, useEditor, useEditorUiStore, useEditorUiStoreInstance, useEntryController, useEntryEditorController, useField, useIsomorphicLayoutEffect3 as useIsomorphicLayoutEffect, useMediaEditor, useMediaEditorOptional, useMultiAutosave, useOptionalEditorUiStoreInstance, usePreviewDesignCoordinator, usePreviewDesignHistoryOrder, usePreviewThemeOverlay, useRichTextEditor, useSdkConfig, useSensor, useSensors, useSiteChromeCustomizeOptional, useUISelector, useUniqueId, validateBlockManifestIssues, visibleHeaderClearancePx };
189306
+ export { AMBIENT_BACKGROUND_ROLES2 as AMBIENT_BACKGROUND_ROLES, ArrowDown, ArrowUp, BackgroundColorField, BackgroundGradientField, Badge2 as Badge, BlockApiProvider, Box, Button, CSS2 as CSS, Callout, CalloutDescription, CalloutTitle, Card, CardContent, CardHeader, CardTitle, Check, ChevronDown, ChevronLeft, ChevronRight, Collapsible2 as Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, ColorPicker, Combobox, CommandMultiSelect, Content, ContentFieldsForm, ContentSpinner, Copy, DEFAULT_LAUNCH_READINESS_INPUT, Dialog2 as Dialog, DialogClose2 as DialogClose, DialogContent2 as DialogContent, DialogDescription2 as DialogDescription, DialogFooter, DialogHeader, DialogTitle2 as DialogTitle, DndContext, DropdownMenu2 as DropdownMenu, DropdownMenuContent2 as DropdownMenuContent, DropdownMenuItem2 as DropdownMenuItem, DropdownMenuLabel2 as DropdownMenuLabel, DropdownMenuSeparator2 as DropdownMenuSeparator, DropdownMenuTrigger2 as DropdownMenuTrigger, EDITABLE_SURFACE_FORWARDING_PROP, EMPTY_DOC, EditableBlockProvider, EditorChrome, EditorProvider, EllipsisVertical, EmptyState2 as EmptyState, EntryControllerProvider, EyeOff, FieldFrame, FixedBottomSurface, FormRenderer, GRADIENT_PRESETS, GripVertical, Image, ImagePlus, Input, KeyboardCode, LINKED_CONTENT_ENTRY_META_KEY, Label4 as Label, List2 as List, LoaderCircle, ManifestForm, Maximize2, MediaEditor, MediaEditorProvider, MediaPickerDialog, MediaPickerMini, Monitor, PAGE_DESIGN_EDITOR_STATE_FETCH_ERROR_MESSAGE, PUBLIC_FILE_FIELD_KINDS, PageRenderer, Palette, PaletteProvider, Pencil, Plus, PointerSensor, PreviewDesignCoordinatorProvider, PreviewDesignHistoryOrderProvider, PreviewRichTextEditor, PreviewTextEditor, PreviewThemeOverlayProvider, ResizableSplitPane, ResponsiveScope, RichText2 as RichText, RichTextEditorSurface, Root2, RotateCcw, SECTION_BACKGROUND_MIN_SOURCE_HEIGHT, SECTION_BACKGROUND_MIN_SOURCE_WIDTH, SITE_CHROME_CLASS_NAMES, SITE_CHROME_VISIBLE_HEADER_SELECTOR, SUBROUTE_KINDS, ScrollableDialogContent, SdkConfigProvider, Search, Select2 as Select, SelectContent2 as SelectContent, SelectItem2 as SelectItem, SelectTrigger2 as SelectTrigger, SelectValue2 as SelectValue, Separator2 as Separator, Settings, SiteChromeCustomizeProvider, SiteDocumentLayout, Smartphone, Sparkles, Surface, Tablet, Tabs2 as Tabs, TabsContent2 as TabsContent, TabsList2 as TabsList, TabsTrigger2 as TabsTrigger, Text2 as Text, Textarea, ThemeScope, Trash2, TriangleAlert, Trigger, Upload, X, applyBackgroundOverrideContentPatch, applyCompiledRuntimeFieldsToContent, applyFeatureCardIconSuggestions, applyPageDesignEditorAction, applyResolvedSelections, asDesignBlockId, asRecord, assertNever, assertNever5 as assertNever2, attachRenderableMediaAssetFields, augmentManifestWithStyleGroups, backgroundColorTokens, backgroundOverrideEquals, beginAutosaveBatch, buildApplySiteStyleSelectionBody, buildEditorModelRuntimeFieldsByBlockId, buildSiteChromeLookModels, buildThemeRuntime, buttonPersonalities, canCycleBackgroundOverrideValue, canRedoHistory, canUndoHistory, cancelPreview, classifyHistoryShortcut, classifyKnownMimeType, clearTypographyFontOverrides, clientComponentRegistry, closestCenter, cn, confirmAutosaveBatch, createBlock, createCustomBlockRegistry, createEditorInsertBlockCommand, createEditorRemoveBlockCommand, createEditorReorderBlocksCommand, createEntrySlotBlock, createFeatureCardIconKey, createHistoryState, createManifestFormAdapter, createManifestValidation, createMicrobatcher, createOptimisticActionRunner, createRoutingHelpers, createSnapshotFromPageRecord, createStoreBackend, createStyleConfiguratorState, curatedSiteStyles, cycleSiteChromeLookId, cycleableSiteChromeOptions, decodePublicProductCategorySelectorQuery, defaultBackgroundOverrideForMode, defaultSectionTransitionVariantForFamily, deleteBlock, deleteEntrySlotBlock, deriveLaunchReadiness, deriveRouteMetadataPresentation, deriveStyleConfiguratorCapabilities, deriveTransactionCapabilities, designRuntimeRulesForTheme, dismissNotices, dismissWarnings, emitMediaCropDebug, enabledBackgroundModes, enqueueTransaction, evaluateTypographyFontSlot, evaluateVisibility, expectParsedBrandedId, findButtonPersonality, findFooterLook, findPaletteVariant, findTypographyPreset, foldSubroute, formatSiteChromeBackgroundTokenLabel, getBlockDefinition, getBlockIconSemanticFallbackId, getClientRect, getCuratedSiteStyle, getDirectImageUrlForMediaAsset, getFeatureCardIconCompletion, getFieldIntent, getFooterLayout, getGeneratedBlockIconStyleState, getHeaderLayout, getHeaderStyle, getIconComponent, getIconPickerOptionsForPreset, getLinkedContentEntryMeta, getModalConfig, getPageDesignEditorState, getRichTextImagePositionFromTarget, gradientToCss, idleEditorTransactionQueueState, imagePoolForOverride, inferLegacyOfferingsPreviewGroupOrder, insertOrReplaceRichTextImage, isHeaderField, isIconPickerPreset, isInternalResolvedLinkValue, isKeyboardEvent, isKnownIconName, isNonEmptyValue, isObjectRecord2 as isObjectRecord, isOfferingsPreviewSourceKey, isPreviewingChange, isSupportedLoaderEndpoint, isSvgMimeType, isThemeV2NormalEditorRawStyleFieldName, isThemeV2NormalEditorRawStylePath, listBlockDescriptors, listContentTypes, listEntryPageContentSlots, lucide_react_exports, markApplyFailed, markApplySaved, markApplySaving, mergeBlockDescriptorsWithRegistry, mergeManifestWithSdkOptions, mutateBlockContent, normalEditorCuratedPromotedFieldPaths, normalizeOfferingsPreviewGroupOrder, normalizePickerSearchThreshold, normalizePublicApiLoaderParams, openRow, paletteOverridesSchema, paletteVariants, parseAspectRatioValue, parseBackgroundOverrideFromContent, parseBlockIconValue, parseMediaAssetId, parseSiteIconStyleGuideVersionId, parseSiteId, planBackgroundOverride, planBackgroundTransition, planPageDesignLayoutLookCompatibility, planSiteChromeFooterLayoutSelection, planSiteChromeLookSelection, planSiteDocument, planSiteStylePreviewChange, prefetchBlockData, previewAssistantEnabled, previewButtonPersonality, previewDesignHistoryDomainForCommand, previewFooterLook, previewHeaderLayout, previewHeaderStyle, previewPaletteVariant, previewSiteStyle, previewTypographyPreset, pushHistoryEntry, rankBackgroundImagePoolItems, recoveryConflictCopy, redoHistory, rejectAutosaveBatch, renderBlock, reorderBlocks, reorderEntrySlotBlocks, requireEntriesForCuratedChoices, resolveBackgroundCapability, resolveBlockTitle, resolveContentTitle, resolveIconPickerPreset, resolveImageUrlWithContext, resolveMediaSlotContract, resolveOfferingsPreviewGroupOrderEntries, resolvePageRouteSlug, resolvePickerSelectionLabel, resolvePreviewSidebarTab, resolveStyleConfiguratorInitialSnapshot, resolveVideoSelectionIntentForMediaField, resolveVisiblePromotedFieldPathsForEditorBlock, sectionTransitionFamilies, sectionTransitionFamilyForBoundaryOptionId, sectionTransitionVariantForBoundaryOptionId, selectPreviewDesignHistoryDomain, selectionSnapshotFromApplySiteStyleSelectionResponse, setPaletteOverrides, setTypographyBodyFontOverride, setTypographyHeadingFontOverride, shouldShowPickerSearch, siteFooterManifest, siteHeaderManifest, siteOptionSources, stableSerialize, styleConfiguratorHistoryEntryForPersistedSelection, suggestFeatureCardSemanticIcons, suggestSemanticIconForFeatureCard, surfaceResolutionContextFromTheme, syncStyleConfiguratorState, systemCustomizeFacetAppliesToLayoutVariant, systemCustomizeFacetApplyContentPatch, systemCustomizeFacetCurrentValue, systemCustomizeFacetDefinitionForBlock, systemCustomizeFacetDefinitionsForBlock, systemCustomizeFacetLabelForValue, systemCustomizeFacetNextValue, systemCustomizeFacetRollbackContentPatch, toFeatureCardIconSuggestionInputs, toRoutableLinkPayload, toggleRow, typographyPresets, undoHistory, unfinishedBlockCopy, unsafeAsEditorBlockId, unsafeAsEditorBlockValues, unsafeAsLinkedContentEntryId, useAsyncPickerOptions, useBackendWatch, useBlockContext, useCombinedRefs, useDebouncedLatestSave, useDndContext, useDraggable, useDroppable, useEditor, useEditorUiStore, useEditorUiStoreInstance, useEntryController, useEntryEditorController, useField, useIsomorphicLayoutEffect3 as useIsomorphicLayoutEffect, useMediaEditor, useMediaEditorOptional, useMultiAutosave, useOptionalEditorUiStoreInstance, usePreviewDesignCoordinator, usePreviewDesignHistoryOrder, usePreviewThemeOverlay, useRichTextEditor, useSdkConfig, useSensor, useSensors, useSiteChromeCustomizeOptional, useUISelector, useUniqueId, validateBlockManifestIssues, visibleHeaderClearancePx };