@riverbankcms/sdk 0.92.0 → 0.93.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,6 @@
1
1
  "use client";
2
- import { KeyboardCode, getBlockDefinition, CSS, useSdkConfig, unwrapResponse, parseSiteIconStyleGuideVersionId, parseBlockIconValue, listBlockDescriptors, useSensor, PointerSensor, useSensors, createEditorRemoveBlockCommand, unsafeAsEditorBlockId, DndContext, closestCenter, Button, Plus, useDroppable, useDraggable, useCombinedRefs, isKeyboardEvent, createCustomBlockRegistry, Card, cn, Collapsible, CollapsibleContent, listContentTypes, mergeBlockDescriptorsWithRegistry, createEditorReorderBlocksCommand, mutateBlockContent, deleteEntrySlotBlock, deleteBlock, useDndContext, useUniqueId, useIsomorphicLayoutEffect, EmptyState, Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, Search, getClientRect, resolveBlockTitle, CardHeader, GripVertical, ChevronRight, CardTitle, ArrowUp, ArrowDown, DropdownMenu, DropdownMenuTrigger, EllipsisVertical, DropdownMenuContent, DropdownMenuSeparator, DropdownMenuItem, Copy, Trash2, DialogFooter, DialogClose, CardContent, createEntrySlotBlock, createBlock, createEditorInsertBlockCommand, reorderEntrySlotBlocks, reorderBlocks, LoaderCircle, ChevronDown, getFeatureCardIconCompletion, toFeatureCardIconSuggestionInputs, getBlockIconSemanticFallbackId, suggestSemanticIconForFeatureCard, getGeneratedBlockIconStyleState, assertNever, createManifestFormAdapter, getModalConfig, createStoreBackend, validateBlockManifestIssues, isNonEmptyValue, Settings, ScrollableDialogContent, FormRenderer, Tabs, TabsList, TabsTrigger, TabsContent, RotateCcw, ImagePlus, Sparkles, Textarea, Callout, CalloutDescription, normalEditorCuratedPromotedFieldPaths, resolveVisiblePromotedFieldPathsForEditorBlock, CalloutTitle, unfinishedBlockCopy, recoveryConflictCopy, ManifestForm, unsafeAsEditorBlockValues, Box, mergeManifestWithSdkOptions, augmentManifestWithStyleGroups, suggestFeatureCardSemanticIcons, applyFeatureCardIconSuggestions, createFeatureCardIconKey, lucide_react_exports, isThemeV2NormalEditorRawStylePath, getFieldIntent, isHeaderField, isThemeV2NormalEditorRawStyleFieldName, BackgroundGradientField, BackgroundColorField, useField, FieldFrame, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, useMediaEditorOptional, useRichTextEditor, RichTextEditorSurface, ThemeScope, isObjectRecord, EMPTY_DOC, useAsyncPickerOptions, resolvePickerSelectionLabel, shouldShowPickerSearch, normalizePickerSearchThreshold, Combobox, Badge, useBlockContext, resolveMediaSlotContract, asRecord, parseAspectRatioValue, MediaEditor, PUBLIC_FILE_FIELD_KINDS, useBackendWatch, resolveIconPickerPreset, isIconPickerPreset, getIconPickerOptionsForPreset, isKnownIconName, getIconComponent, isOfferingsPreviewSourceKey, EyeOff, CommandMultiSelect, expectParsedBrandedId, parseSiteId, buildThemeRuntime, SdkConfigProvider, PaletteProvider, MediaEditorProvider, useEditorUiStoreInstance, useUISelector, getRichTextImagePositionFromTarget, insertOrReplaceRichTextImage, emitMediaCropDebug, Pencil, resolveVideoSelectionIntentForMediaField, resolveOfferingsPreviewGroupOrderEntries, normalizeOfferingsPreviewGroupOrder, inferLegacyOfferingsPreviewGroupOrder, siteOptionSources, evaluateVisibility, Root2, List, Trigger, Content, Input, Check, Label, isInternalResolvedLinkValue, resolveImageUrlWithContext, useMediaEditor, MediaPickerMini, MediaPickerDialog, toRoutableLinkPayload, classifyKnownMimeType, getDirectImageUrlForMediaAsset, isSvgMimeType } from './chunk-I6EOKV6B.mjs';
2
+ import { KeyboardCode, getBlockDefinition, CSS, useSdkConfig, parseSiteIconStyleGuideVersionId, parseBlockIconValue, listBlockDescriptors, useSensor, PointerSensor, useSensors, createEditorRemoveBlockCommand, unsafeAsEditorBlockId, DndContext, closestCenter, Button, Plus, useDroppable, useDraggable, useCombinedRefs, isKeyboardEvent, createCustomBlockRegistry, Card, cn, Collapsible, CollapsibleContent, listContentTypes, mergeBlockDescriptorsWithRegistry, createEditorReorderBlocksCommand, mutateBlockContent, deleteEntrySlotBlock, deleteBlock, useDndContext, useUniqueId, useIsomorphicLayoutEffect, EmptyState, Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, Search, getClientRect, resolveBlockTitle, CardHeader, GripVertical, ChevronRight, CardTitle, ArrowUp, ArrowDown, DropdownMenu, DropdownMenuTrigger, EllipsisVertical, DropdownMenuContent, DropdownMenuSeparator, DropdownMenuItem, Copy, Trash2, DialogFooter, DialogClose, CardContent, createEntrySlotBlock, createBlock, createEditorInsertBlockCommand, reorderEntrySlotBlocks, reorderBlocks, LoaderCircle, ChevronDown, getFeatureCardIconCompletion, toFeatureCardIconSuggestionInputs, getBlockIconSemanticFallbackId, suggestSemanticIconForFeatureCard, getGeneratedBlockIconStyleState, assertNever, createManifestFormAdapter, getModalConfig, createStoreBackend, validateBlockManifestIssues, isNonEmptyValue, Settings, ScrollableDialogContent, FormRenderer, Tabs, TabsList, TabsTrigger, TabsContent, RotateCcw, ImagePlus, Sparkles, Textarea, Callout, CalloutDescription, normalEditorCuratedPromotedFieldPaths, resolveVisiblePromotedFieldPathsForEditorBlock, CalloutTitle, unfinishedBlockCopy, recoveryConflictCopy, ManifestForm, unsafeAsEditorBlockValues, Box, mergeManifestWithSdkOptions, augmentManifestWithStyleGroups, suggestFeatureCardSemanticIcons, applyFeatureCardIconSuggestions, createFeatureCardIconKey, lucide_react_exports, isThemeV2NormalEditorRawStylePath, getFieldIntent, isHeaderField, isThemeV2NormalEditorRawStyleFieldName, BackgroundGradientField, BackgroundColorField, useField, FieldFrame, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, useMediaEditorOptional, useRichTextEditor, RichTextEditorSurface, ThemeScope, isObjectRecord, EMPTY_DOC, useAsyncPickerOptions, resolvePickerSelectionLabel, shouldShowPickerSearch, normalizePickerSearchThreshold, Combobox, Badge, useBlockContext, resolveMediaSlotContract, asRecord, parseAspectRatioValue, MediaEditor, PUBLIC_FILE_FIELD_KINDS, useBackendWatch, resolveIconPickerPreset, isIconPickerPreset, getIconPickerOptionsForPreset, isKnownIconName, getIconComponent, isOfferingsPreviewSourceKey, EyeOff, CommandMultiSelect, expectParsedBrandedId, parseSiteId, buildThemeRuntime, SdkConfigProvider, PaletteProvider, MediaEditorProvider, useEditorUiStoreInstance, useUISelector, getRichTextImagePositionFromTarget, insertOrReplaceRichTextImage, emitMediaCropDebug, Pencil, resolveVideoSelectionIntentForMediaField, resolveOfferingsPreviewGroupOrderEntries, normalizeOfferingsPreviewGroupOrder, inferLegacyOfferingsPreviewGroupOrder, siteOptionSources, evaluateVisibility, Root2, List, Trigger, Content, Input, Check, Label, isInternalResolvedLinkValue, resolveImageUrlWithContext, useMediaEditor, MediaPickerMini, MediaPickerDialog, toRoutableLinkPayload, classifyKnownMimeType, getDirectImageUrlForMediaAsset, isSvgMimeType } from './chunk-PCNCETBI.mjs';
3
+ import { unwrapResponse } from './chunk-NT76QGIJ.mjs';
3
4
  import React, { createContext, memo, useMemo, useState, useRef, useEffect, forwardRef, useCallback, useImperativeHandle, useContext, useSyncExternalStore, useLayoutEffect, Fragment as Fragment$1, useReducer } from 'react';
4
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
6
 
@@ -4184,14 +4185,14 @@ function LinkPicker(props) {
4184
4185
  }
4185
4186
  onChange({ kind: "url", href: trimmed.startsWith("/") ? trimmed : `/${trimmed}` });
4186
4187
  };
4187
- return /* @__PURE__ */ jsx("div", { className: cn("space-y-3", className), children: /* @__PURE__ */ jsxs(Root2, { value: activeTab, onValueChange: (next) => setActiveTab(next), children: [
4188
- /* @__PURE__ */ jsxs(List, { className: "flex gap-2 rounded-md bg-muted/40 p-1", children: [
4188
+ return /* @__PURE__ */ jsx("div", { className: cn("min-w-0 space-y-3", className), children: /* @__PURE__ */ jsxs(Root2, { value: activeTab, onValueChange: (next) => setActiveTab(next), children: [
4189
+ /* @__PURE__ */ jsxs(List, { className: "flex min-w-0 gap-2 rounded-md bg-muted/40 p-1", children: [
4189
4190
  /* @__PURE__ */ jsx(
4190
4191
  Trigger,
4191
4192
  {
4192
4193
  value: "internal",
4193
4194
  className: cn(
4194
- "flex-1 rounded-sm px-3 py-2 text-sm font-medium transition data-[state=active]:bg-background data-[state=active]:shadow",
4195
+ "min-w-0 flex-1 truncate rounded-sm px-3 py-2 text-sm font-medium transition data-[state=active]:bg-background data-[state=active]:shadow",
4195
4196
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
4196
4197
  ),
4197
4198
  children: "Internal"
@@ -4202,7 +4203,7 @@ function LinkPicker(props) {
4202
4203
  {
4203
4204
  value: "external",
4204
4205
  className: cn(
4205
- "flex-1 rounded-sm px-3 py-2 text-sm font-medium transition data-[state=active]:bg-background data-[state=active]:shadow",
4206
+ "min-w-0 flex-1 truncate rounded-sm px-3 py-2 text-sm font-medium transition data-[state=active]:bg-background data-[state=active]:shadow",
4206
4207
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
4207
4208
  ),
4208
4209
  children: "External URL"
@@ -4213,25 +4214,26 @@ function LinkPicker(props) {
4213
4214
  {
4214
4215
  value: "custom",
4215
4216
  className: cn(
4216
- "flex-1 rounded-sm px-3 py-2 text-sm font-medium transition data-[state=active]:bg-background data-[state=active]:shadow",
4217
+ "min-w-0 flex-1 truncate rounded-sm px-3 py-2 text-sm font-medium transition data-[state=active]:bg-background data-[state=active]:shadow",
4217
4218
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
4218
4219
  ),
4219
4220
  children: "Custom Path"
4220
4221
  }
4221
4222
  )
4222
4223
  ] }),
4223
- /* @__PURE__ */ jsx(Content, { value: "internal", className: "focus-visible:outline-none", children: /* @__PURE__ */ jsxs("div", { className: "space-y-3 pt-3", children: [
4224
+ /* @__PURE__ */ jsx(Content, { value: "internal", className: "focus-visible:outline-none", children: /* @__PURE__ */ jsxs("div", { className: "min-w-0 space-y-3 pt-3", children: [
4224
4225
  /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Select any published or draft page, post, or routed entry for this site." }),
4225
4226
  /* @__PURE__ */ jsx(
4226
4227
  Input,
4227
4228
  {
4229
+ className: "min-w-0",
4228
4230
  placeholder: loading ? "Loading\u2026" : "Search content...",
4229
4231
  value: searchQuery,
4230
4232
  onChange: (e) => setSearchQuery(e.target.value),
4231
4233
  disabled: disabled || loading
4232
4234
  }
4233
4235
  ),
4234
- /* @__PURE__ */ jsx("div", { className: "max-h-64 overflow-y-auto rounded-md border border-input", children: filteredItems.length > 0 ? filteredItems.map((item) => {
4236
+ /* @__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) => {
4235
4237
  const isSelected = internalSelectedId === item.routeId;
4236
4238
  const title = getDisplayTitle(item);
4237
4239
  return /* @__PURE__ */ jsxs(
@@ -4239,13 +4241,13 @@ function LinkPicker(props) {
4239
4241
  {
4240
4242
  type: "button",
4241
4243
  className: cn(
4242
- "flex w-full items-center gap-2 px-3 py-2 text-sm text-left transition-colors hover:bg-muted",
4244
+ "flex min-w-0 w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors hover:bg-muted",
4243
4245
  isSelected && "bg-muted"
4244
4246
  ),
4245
4247
  onClick: () => handleInternalSelect(item),
4246
4248
  disabled,
4247
4249
  children: [
4248
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
4250
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 overflow-hidden", children: [
4249
4251
  /* @__PURE__ */ jsx("span", { className: "block truncate font-medium", children: title }),
4250
4252
  /* @__PURE__ */ jsx(
4251
4253
  "span",
@@ -4264,12 +4266,12 @@ function LinkPicker(props) {
4264
4266
  },
4265
4267
  item.routeId
4266
4268
  );
4267
- }) : /* @__PURE__ */ jsx("p", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: loading ? "Loading\u2026" : errorMessage ?? "No routable content yet" }) }),
4268
- internalSelectedItem ? /* @__PURE__ */ jsxs("div", { className: "rounded-md border border-border bg-muted/30 px-3 py-2 text-sm", children: [
4269
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
4270
- /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
4271
- /* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: getDisplayTitle(internalSelectedItem) }),
4272
- /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "ml-2 shrink-0", children: internalSelectedItem.typeLabel })
4269
+ }) : /* @__PURE__ */ jsx("p", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: loading ? "Loading\u2026" : errorMessage ?? "No routable content yet" }) }) }),
4270
+ internalSelectedItem ? /* @__PURE__ */ jsxs("div", { className: "min-w-0 overflow-hidden rounded-md border border-border bg-muted/30 px-3 py-2 text-sm", children: [
4271
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center justify-between gap-2", children: [
4272
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
4273
+ /* @__PURE__ */ jsx("span", { className: "block min-w-0 truncate font-medium", children: getDisplayTitle(internalSelectedItem) }),
4274
+ /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "shrink-0", children: internalSelectedItem.typeLabel })
4273
4275
  ] }),
4274
4276
  /* @__PURE__ */ jsx(
4275
4277
  Button,
@@ -4277,7 +4279,7 @@ function LinkPicker(props) {
4277
4279
  type: "button",
4278
4280
  variant: "ghost",
4279
4281
  size: "sm",
4280
- className: "h-7 px-2 text-xs",
4282
+ className: "h-7 shrink-0 px-2 text-xs",
4281
4283
  onClick: () => onChange(null),
4282
4284
  disabled,
4283
4285
  children: "Clear"
@@ -4339,12 +4341,12 @@ function LinkPickerDialog({
4339
4341
  useEffect(() => {
4340
4342
  if (open) setDraft(value);
4341
4343
  }, [open, value]);
4342
- return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-w-2xl", children: [
4344
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "w-[calc(100vw-2rem)] max-w-2xl overflow-hidden", children: [
4343
4345
  /* @__PURE__ */ jsxs(DialogHeader, { children: [
4344
4346
  /* @__PURE__ */ jsx(DialogTitle, { children: "Choose link" }),
4345
4347
  /* @__PURE__ */ jsx(DialogDescription, { children: "Select an internal page, an external URL, or a custom path." })
4346
4348
  ] }),
4347
- /* @__PURE__ */ jsx("div", { className: "py-2", children: /* @__PURE__ */ jsx(
4349
+ /* @__PURE__ */ jsx("div", { className: "min-w-0 py-2", children: /* @__PURE__ */ jsx(
4348
4350
  LinkPicker,
4349
4351
  {
4350
4352
  siteId,
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { ApiRequestError, markPreviewAuthExpired } from './chunk-ZA2S7H34.mjs';
2
+ import { ApiRequestError, markPreviewAuthExpired } from './chunk-NT76QGIJ.mjs';
3
3
  import { createContext, useContext, useRef } from 'react';
4
4
  import { jsx } from 'react/jsx-runtime';
5
5
  import { QueryClient, MutationCache, QueryCache, QueryClientProvider } from '@tanstack/react-query';
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { assertNever2, usePreviewDesignHistoryOrder, useOptionalEditorUiStoreInstance, getPageDesignEditorState, PAGE_DESIGN_EDITOR_STATE_FETCH_ERROR_MESSAGE, unwrapResponse, useDebouncedLatestSave, AMBIENT_BACKGROUND_ROLES, applyPageDesignEditorAction, resolvePreviewSidebarTab, confirmAutosaveBatch, beginAutosaveBatch, enqueueTransaction, applyBackgroundOverrideContentPatch, systemCustomizeFacetDefinitionForBlock, systemCustomizeFacetRollbackContentPatch, systemCustomizeFacetApplyContentPatch, unsafeAsEditorBlockId, createHistoryState, rejectAutosaveBatch, redoHistory, undoHistory, pushHistoryEntry, idleEditorTransactionQueueState, canRedoHistory, deriveTransactionCapabilities, canUndoHistory, backgroundOverrideEquals, attachRenderableMediaAssetFields, planPageDesignLayoutLookCompatibility, unsafeAsEditorBlockValues } from './chunk-I6EOKV6B.mjs';
3
- import { ApiRequestError, resolveSurfaceDocumentAttributes, SURFACE_DOCUMENT_DATA_ATTRIBUTE, SURFACE_IDS } from './chunk-ZA2S7H34.mjs';
2
+ import { assertNever2, usePreviewDesignHistoryOrder, useOptionalEditorUiStoreInstance, getPageDesignEditorState, PAGE_DESIGN_EDITOR_STATE_FETCH_ERROR_MESSAGE, useDebouncedLatestSave, AMBIENT_BACKGROUND_ROLES, applyPageDesignEditorAction, resolvePreviewSidebarTab, confirmAutosaveBatch, beginAutosaveBatch, enqueueTransaction, applyBackgroundOverrideContentPatch, systemCustomizeFacetDefinitionForBlock, systemCustomizeFacetRollbackContentPatch, systemCustomizeFacetApplyContentPatch, unsafeAsEditorBlockId, createHistoryState, rejectAutosaveBatch, redoHistory, undoHistory, pushHistoryEntry, idleEditorTransactionQueueState, canRedoHistory, deriveTransactionCapabilities, canUndoHistory, backgroundOverrideEquals, attachRenderableMediaAssetFields, planPageDesignLayoutLookCompatibility, unsafeAsEditorBlockValues } from './chunk-PCNCETBI.mjs';
3
+ import { ApiRequestError, unwrapResponse, resolveSurfaceDocumentAttributes, SURFACE_DOCUMENT_DATA_ATTRIBUTE, SURFACE_IDS } from './chunk-NT76QGIJ.mjs';
4
4
  import { createContext, useState, useRef, useEffect, useMemo, useLayoutEffect, useContext } from 'react';
5
5
  import { jsx } from 'react/jsx-runtime';
6
6
 
@@ -278,6 +278,101 @@ function resolveApiBaseUrl() {
278
278
  return getCmsApiUrl();
279
279
  }
280
280
 
281
+ // ../api/src/common/envelope.ts
282
+ var API_ERROR_CODES = [
283
+ "auth:unauthenticated",
284
+ "auth:token_expired",
285
+ "auth:token_invalid",
286
+ "auth:forbidden",
287
+ "auth:mfa_required",
288
+ "auth:sudo_required",
289
+ "auth:insufficient_permissions",
290
+ "auth:impersonation_restricted",
291
+ "validation:invalid_input",
292
+ "validation:missing_field",
293
+ "validation:invalid_format",
294
+ "validation:payload_too_large",
295
+ "resource:not_found",
296
+ "resource:already_exists",
297
+ "resource:conflict",
298
+ "resource:gone",
299
+ "rate_limit:exceeded",
300
+ "billing:payment_required",
301
+ "billing:plan_limit_exceeded",
302
+ "billing:pass_redemption_failed",
303
+ "server:internal_error",
304
+ "server:unavailable",
305
+ "external:service_error",
306
+ "external:registrar_orphaned_contact_profile",
307
+ "network:connection_error",
308
+ "network:timeout",
309
+ "network:dns_error"
310
+ ];
311
+ var API_ERROR_CODE_SET = new Set(API_ERROR_CODES);
312
+ function isApiErrorCode(value) {
313
+ return typeof value === "string" && API_ERROR_CODE_SET.has(value);
314
+ }
315
+ function isApiSuccess(result) {
316
+ return result.success === true;
317
+ }
318
+ function isRecord(value) {
319
+ return typeof value === "object" && value !== null && !Array.isArray(value);
320
+ }
321
+ function isFieldError(value) {
322
+ return isRecord(value) && typeof value.field === "string" && typeof value.code === "string" && typeof value.message === "string";
323
+ }
324
+ function fieldErrorsFromUnknown(value) {
325
+ if (!Array.isArray(value)) return null;
326
+ return value.every(isFieldError) ? value : null;
327
+ }
328
+ function extractEnvelopeErrorObject(body) {
329
+ if (!isRecord(body)) return null;
330
+ const error = body.error;
331
+ if (!isRecord(error)) return null;
332
+ if ("success" in body && body.success !== false) {
333
+ return null;
334
+ }
335
+ return error;
336
+ }
337
+ function extractApiEnvelopeErrorDetails(body) {
338
+ const error = extractEnvelopeErrorObject(body);
339
+ if (!error) {
340
+ return {
341
+ rawCode: null,
342
+ code: null,
343
+ message: null,
344
+ status: null,
345
+ fieldErrors: null
346
+ };
347
+ }
348
+ const rawCode = typeof error.code === "string" ? error.code : null;
349
+ const message = typeof error.message === "string" && error.message.trim().length > 0 ? error.message : null;
350
+ return {
351
+ rawCode,
352
+ code: isApiErrorCode(rawCode) ? rawCode : null,
353
+ message,
354
+ status: typeof error.status === "number" && Number.isFinite(error.status) ? error.status : null,
355
+ fieldErrors: fieldErrorsFromUnknown(error.fieldErrors)
356
+ };
357
+ }
358
+ var ApiEnvelopeError = class extends Error {
359
+ constructor(error) {
360
+ super(error.message);
361
+ this.name = "ApiEnvelopeError";
362
+ this.code = error.code;
363
+ this.requestId = error.requestId;
364
+ this.timestamp = error.timestamp;
365
+ this.status = error.status;
366
+ this.fieldErrors = error.fieldErrors;
367
+ }
368
+ };
369
+ function unwrapResponse(result) {
370
+ if (isApiSuccess(result)) {
371
+ return result.data;
372
+ }
373
+ throw new ApiEnvelopeError(result.error);
374
+ }
375
+
281
376
  // ../api/src/apiEndpointTypes.ts
282
377
  function blockedDemoMutationPolicy(classification, publicMessage) {
283
378
  if (publicMessage.trim() === "") {
@@ -7085,6 +7180,7 @@ function createParsedClient(rawClient) {
7085
7180
  const auth = config.auth ?? "user";
7086
7181
  if (!response.ok) {
7087
7182
  const body = await parseErrorBody(response);
7183
+ const envelopeError = extractApiEnvelopeErrorDetails(body);
7088
7184
  const requestId = response.headers.get("x-request-id") ?? void 0;
7089
7185
  const retryAfterMs = parseRetryAfterHeader(response.headers.get("retry-after"));
7090
7186
  throw new ApiRequestError(
@@ -7096,6 +7192,7 @@ function createParsedClient(rawClient) {
7096
7192
  auth,
7097
7193
  requestId,
7098
7194
  body,
7195
+ errorCode: envelopeError.code ?? void 0,
7099
7196
  retryAfterMs
7100
7197
  }
7101
7198
  );
@@ -7113,4 +7210,4 @@ function createBearerAPIClient(token, baseUrl) {
7113
7210
  return createCMSClient(authHeaders, baseUrl);
7114
7211
  }
7115
7212
 
7116
- export { API_ENDPOINTS, ApiRequestError, DEFAULT_SURFACE_ID, SURFACE_DOCUMENT_DATA_ATTRIBUTE, SURFACE_IDS, createBearerAPIClient, getDashboardUrl, initPreviewAuth, isPreviewRuntimeSessionEditable, markPreviewAuthExpired, resolveSurfaceDocumentAttributes, usePreviewAuth, usePreviewAuthFetch, usePreviewToken };
7213
+ export { API_ENDPOINTS, ApiEnvelopeError, ApiRequestError, DEFAULT_SURFACE_ID, SURFACE_DOCUMENT_DATA_ATTRIBUTE, SURFACE_IDS, createBearerAPIClient, extractApiEnvelopeErrorDetails, getDashboardUrl, initPreviewAuth, isPreviewRuntimeSessionEditable, markPreviewAuthExpired, resolveSurfaceDocumentAttributes, unwrapResponse, usePreviewAuth, usePreviewAuthFetch, usePreviewToken };