@tightknitai/block-kitchen 0.9.10 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { c as BlockKitchenProps, Z as SupportedBlock, k as ChannelOption, V as SendAsUserStatus, X as SendPayload, W as SendExtrasContext, a5 as Template, Q as PreviewSurface, R as PreviewTheme } from './palette-Duj901T6.cjs';
4
- export { A as AlertBlock, a as AlertLevel, B as BlockKitchenBaseProps, b as BlockKitchenComposeOnlyProps, d as BlockKitchenSendProps, e as BrandPreset, f as BrandTheme, g as BrandTokens, h as BuilderBlock, C as CardBlock, i as CarouselBlock, j as CartesianChart, l as Chart, m as ChartAxisConfig, n as ChartDataPoint, o as ChartSeries, p as ChartType, q as ContainerBlock, r as ContainerChildBlock, s as ContextActionsBlock, t as ContextActionsElement, u as CustomEmoji, D as DataVisualizationBlock, E as EditableVia, v as EditingConfig, F as FeedbackButtonSubobject, w as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, x as IconButtonIcon, y as InputBlock, L as LoadMessageInput, z as LoadResult, M as MarkdownBlock, P as PaletteSection, G as PaletteVariant, J as PieChart, K as PieChartSegment, N as PlanBlock, O as PreviewHooks, S as PrimaryActionConfig, T as PrimaryActionContext, U as RecentMessage, Y as SendResult, _ as SupportedBlockType, $ as SupportedHeaderBlock, a0 as TableBlock, a1 as TableCell, a2 as TableColumnSetting, a3 as TaskCardBlock, a4 as TaskCardStatus, a6 as UpdatePayload, a7 as UpdateResult, a8 as UrlSourceElement, a9 as ValidationSummary, aa as VideoBlock, ac as defaultPalette, ad as extraAlertVariant, ae as legacyInputVariants } from './palette-Duj901T6.cjs';
3
+ import { c as BlockKitchenProps, _ as SupportedBlock, k as ChannelOption, W as SendAsUserStatus, Y as SendPayload, X as SendExtrasContext, a6 as Template, R as PreviewSurface, S as PreviewTheme } from './palette-C8sPJuXx.cjs';
4
+ export { A as AlertBlock, a as AlertLevel, B as BlockKitchenBaseProps, b as BlockKitchenComposeOnlyProps, d as BlockKitchenSendProps, e as BrandPreset, f as BrandTheme, g as BrandTokens, h as BuilderBlock, C as CardBlock, i as CarouselBlock, j as CartesianChart, l as Chart, m as ChartAxisConfig, n as ChartDataPoint, o as ChartSeries, p as ChartType, q as ContainerBlock, r as ContainerChildBlock, s as ContextActionsBlock, t as ContextActionsElement, u as CustomEmoji, D as DataVisualizationBlock, E as EditableVia, F as FeedbackButtonSubobject, v as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, w as IconButtonIcon, x as InputBlock, L as LoadMessageInput, y as LoadResult, z as LoadedMessage, G as LoadingConfig, M as MarkdownBlock, P as PaletteSection, J as PaletteVariant, K as PieChart, N as PieChartSegment, O as PlanBlock, Q as PreviewHooks, T as PrimaryActionConfig, U as PrimaryActionContext, V as RecentMessage, Z as SendResult, $ as SupportedBlockType, a0 as SupportedHeaderBlock, a1 as TableBlock, a2 as TableCell, a3 as TableColumnSetting, a4 as TaskCardBlock, a5 as TaskCardStatus, a7 as UpdatePayload, a8 as UpdateResult, a9 as UrlSourceElement, aa as ValidationSummary, ab as VideoBlock, ad as defaultPalette, ae as extraAlertVariant, af as legacyInputVariants } from './palette-C8sPJuXx.cjs';
5
5
  export { decodeBlocksFromString, encodeBlocksToString, toSlackBlocks } from './helpers.cjs';
6
6
  import 'slack-web-api-client';
7
7
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { c as BlockKitchenProps, Z as SupportedBlock, k as ChannelOption, V as SendAsUserStatus, X as SendPayload, W as SendExtrasContext, a5 as Template, Q as PreviewSurface, R as PreviewTheme } from './palette-Duj901T6.js';
4
- export { A as AlertBlock, a as AlertLevel, B as BlockKitchenBaseProps, b as BlockKitchenComposeOnlyProps, d as BlockKitchenSendProps, e as BrandPreset, f as BrandTheme, g as BrandTokens, h as BuilderBlock, C as CardBlock, i as CarouselBlock, j as CartesianChart, l as Chart, m as ChartAxisConfig, n as ChartDataPoint, o as ChartSeries, p as ChartType, q as ContainerBlock, r as ContainerChildBlock, s as ContextActionsBlock, t as ContextActionsElement, u as CustomEmoji, D as DataVisualizationBlock, E as EditableVia, v as EditingConfig, F as FeedbackButtonSubobject, w as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, x as IconButtonIcon, y as InputBlock, L as LoadMessageInput, z as LoadResult, M as MarkdownBlock, P as PaletteSection, G as PaletteVariant, J as PieChart, K as PieChartSegment, N as PlanBlock, O as PreviewHooks, S as PrimaryActionConfig, T as PrimaryActionContext, U as RecentMessage, Y as SendResult, _ as SupportedBlockType, $ as SupportedHeaderBlock, a0 as TableBlock, a1 as TableCell, a2 as TableColumnSetting, a3 as TaskCardBlock, a4 as TaskCardStatus, a6 as UpdatePayload, a7 as UpdateResult, a8 as UrlSourceElement, a9 as ValidationSummary, aa as VideoBlock, ac as defaultPalette, ad as extraAlertVariant, ae as legacyInputVariants } from './palette-Duj901T6.js';
3
+ import { c as BlockKitchenProps, _ as SupportedBlock, k as ChannelOption, W as SendAsUserStatus, Y as SendPayload, X as SendExtrasContext, a6 as Template, R as PreviewSurface, S as PreviewTheme } from './palette-C8sPJuXx.js';
4
+ export { A as AlertBlock, a as AlertLevel, B as BlockKitchenBaseProps, b as BlockKitchenComposeOnlyProps, d as BlockKitchenSendProps, e as BrandPreset, f as BrandTheme, g as BrandTokens, h as BuilderBlock, C as CardBlock, i as CarouselBlock, j as CartesianChart, l as Chart, m as ChartAxisConfig, n as ChartDataPoint, o as ChartSeries, p as ChartType, q as ContainerBlock, r as ContainerChildBlock, s as ContextActionsBlock, t as ContextActionsElement, u as CustomEmoji, D as DataVisualizationBlock, E as EditableVia, F as FeedbackButtonSubobject, v as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, w as IconButtonIcon, x as InputBlock, L as LoadMessageInput, y as LoadResult, z as LoadedMessage, G as LoadingConfig, M as MarkdownBlock, P as PaletteSection, J as PaletteVariant, K as PieChart, N as PieChartSegment, O as PlanBlock, Q as PreviewHooks, T as PrimaryActionConfig, U as PrimaryActionContext, V as RecentMessage, Z as SendResult, $ as SupportedBlockType, a0 as SupportedHeaderBlock, a1 as TableBlock, a2 as TableCell, a3 as TableColumnSetting, a4 as TaskCardBlock, a5 as TaskCardStatus, a7 as UpdatePayload, a8 as UpdateResult, a9 as UrlSourceElement, aa as ValidationSummary, ab as VideoBlock, ad as defaultPalette, ae as extraAlertVariant, af as legacyInputVariants } from './palette-C8sPJuXx.js';
5
5
  export { decodeBlocksFromString, encodeBlocksToString, toSlackBlocks } from './helpers.js';
6
6
  import 'slack-web-api-client';
7
7
 
package/dist/index.js CHANGED
@@ -2226,6 +2226,29 @@ function useBlockKitchenState({
2226
2226
  replaceAll
2227
2227
  };
2228
2228
  }
2229
+ function useDevWarning(condition, message) {
2230
+ const warnedRef = useRef(false);
2231
+ useEffect(() => {
2232
+ if (condition && !warnedRef.current) {
2233
+ warnedRef.current = true;
2234
+ console.warn(message);
2235
+ }
2236
+ }, [condition, message]);
2237
+ }
2238
+ function useNotifyOnChange(value, toKey, callback) {
2239
+ const lastNotifiedRef = useRef(null);
2240
+ useEffect(() => {
2241
+ if (!callback) {
2242
+ return;
2243
+ }
2244
+ const key = toKey(value);
2245
+ if (lastNotifiedRef.current === key) {
2246
+ return;
2247
+ }
2248
+ lastNotifiedRef.current = key;
2249
+ callback(value);
2250
+ }, [value, toKey, callback]);
2251
+ }
2229
2252
 
2230
2253
  // src/lib/brand-theme.ts
2231
2254
  var TOKEN_TO_CSS_VAR = {
@@ -3023,7 +3046,7 @@ function LoadMessageDialog({
3023
3046
  loadRecentMessagesRef.current = loadRecentMessages;
3024
3047
  loadChannelsRef.current = loadChannels;
3025
3048
  });
3026
- const hasRecent = !!loadRecentMessages;
3049
+ const hasRecent = !!loadRecentMessages && !!loadChannels;
3027
3050
  useEffect(() => {
3028
3051
  if (!open) {
3029
3052
  return;
@@ -3034,7 +3057,10 @@ function LoadMessageDialog({
3034
3057
  setRecent(null);
3035
3058
  setRecentError(null);
3036
3059
  setSelectedRecent(null);
3037
- if (!loadRecentMessagesRef.current) {
3060
+ }, [open]);
3061
+ useEffect(() => {
3062
+ const load = loadChannelsRef.current;
3063
+ if (!open || !hasRecent || !load) {
3038
3064
  setChannels([]);
3039
3065
  setChannelsError(null);
3040
3066
  return;
@@ -3042,7 +3068,7 @@ function LoadMessageDialog({
3042
3068
  setChannels(null);
3043
3069
  setChannelsError(null);
3044
3070
  let cancelled = false;
3045
- loadChannelsRef.current().then((list) => {
3071
+ load().then((list) => {
3046
3072
  if (!cancelled) {
3047
3073
  setChannels(list);
3048
3074
  }
@@ -3054,7 +3080,7 @@ function LoadMessageDialog({
3054
3080
  return () => {
3055
3081
  cancelled = true;
3056
3082
  };
3057
- }, [open]);
3083
+ }, [open, hasRecent]);
3058
3084
  useEffect(() => {
3059
3085
  if (!open || !loadRecentMessagesRef.current || !channelId) {
3060
3086
  return;
@@ -9414,7 +9440,8 @@ function Toolbar2({
9414
9440
  showSend = true,
9415
9441
  primaryAction,
9416
9442
  sendButtonLabel = "Review & send",
9417
- editingEnabled = false,
9443
+ loadEnabled = false,
9444
+ updateEnabled = false,
9418
9445
  editBadge,
9419
9446
  onOpenLoad,
9420
9447
  onOpenUpdate,
@@ -9434,7 +9461,7 @@ function Toolbar2({
9434
9461
  return /* @__PURE__ */ jsxs(Fragment, { children: [
9435
9462
  /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-x-2 gap-y-1 border-b bg-background px-2 py-1.5 sm:px-3 sm:py-2", children: [
9436
9463
  /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-1 sm:gap-2", children: [
9437
- editingEnabled ? /* @__PURE__ */ jsxs(Button, { type: "button", size: "sm", onClick: onOpenLoad, "aria-label": loadButtonLabel, children: [
9464
+ loadEnabled ? /* @__PURE__ */ jsxs(Button, { type: "button", size: "sm", onClick: onOpenLoad, "aria-label": loadButtonLabel, children: [
9438
9465
  /* @__PURE__ */ jsx(MailSearch, { className: "h-3.5 w-3.5" }),
9439
9466
  /* @__PURE__ */ jsx("span", { className: "hidden md:inline", children: loadButtonLabel })
9440
9467
  ] }) : null,
@@ -9564,9 +9591,12 @@ function Toolbar2({
9564
9591
  children: /* @__PURE__ */ jsx("span", { children: primaryAction.label })
9565
9592
  }
9566
9593
  )
9567
- ) : null : editBadge ? (
9568
- // A message is loaded: split button. Main action updates it in
9569
- // place; the menu also offers posting the blocks as a new message.
9594
+ ) : null : editBadge && updateEnabled ? (
9595
+ // A message is loaded and update-in-place is wired: split button.
9596
+ // Main action updates it in place; the menu also offers posting
9597
+ // the blocks as a new message. Without `updateEnabled` (loading
9598
+ // configured but no `editing.onUpdate`), the plain send button
9599
+ // below stays — the loaded message can only be posted as new.
9570
9600
  /* @__PURE__ */ jsxs("div", { className: "flex items-stretch", children: [
9571
9601
  /* @__PURE__ */ jsxs(
9572
9602
  Button,
@@ -9639,7 +9669,7 @@ function Toolbar2({
9639
9669
  ] })
9640
9670
  ] })
9641
9671
  ] }),
9642
- editingEnabled && editBadge ? /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 border-b bg-muted px-2 py-2 text-foreground sm:px-3", children: [
9672
+ loadEnabled && editBadge ? /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 border-b bg-muted px-2 py-2 text-foreground sm:px-3", children: [
9643
9673
  /* @__PURE__ */ jsx(Pencil, { className: "h-4 w-4 shrink-0 text-primary" }),
9644
9674
  /* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1 text-sm", children: [
9645
9675
  "References an existing message in ",
@@ -9802,6 +9832,19 @@ function UpdateDialog({
9802
9832
  ] })
9803
9833
  ] }) });
9804
9834
  }
9835
+ function toLoadedMessage({
9836
+ ok: _ok,
9837
+ blocks: _blocks,
9838
+ ...loadedMessage
9839
+ }) {
9840
+ return loadedMessage;
9841
+ }
9842
+ function loadedMessageKey(message) {
9843
+ return message ? JSON.stringify(message) : null;
9844
+ }
9845
+ function validationSummaryKey(summary) {
9846
+ return JSON.stringify([summary.valid, summary.errorCount, ...summary.errors]);
9847
+ }
9805
9848
  function BlockKitchen(props) {
9806
9849
  const {
9807
9850
  workspaceName,
@@ -9814,7 +9857,8 @@ function BlockKitchen(props) {
9814
9857
  loadSendAsUserStatus,
9815
9858
  onSend,
9816
9859
  renderSendExtras,
9817
- editing,
9860
+ loading,
9861
+ onUpdate: onUpdateProp,
9818
9862
  primaryAction,
9819
9863
  loadButtonLabel,
9820
9864
  updateButtonLabel,
@@ -9858,36 +9902,39 @@ function BlockKitchen(props) {
9858
9902
  const variantById = useMemo(() => buildVariantById(paletteSections), [paletteSections]);
9859
9903
  const allowedSurfaces = allowedSurfacesProp && allowedSurfacesProp.length > 0 ? allowedSurfacesProp : ["message"];
9860
9904
  const sendEnabled = Boolean(loadChannels && loadSendAsUserStatus && onSend);
9861
- const editingConfig = sendEnabled ? editing : void 0;
9862
- const seededBlocks = editingConfig?.initialTarget?.blocks ?? initialBlocks;
9863
- useEffect(() => {
9864
- if (editingConfig?.initialTarget && initialBlocks) {
9865
- console.warn(
9866
- "[BlockKitchen] Both `initialBlocks` and `editing.initialTarget` were provided; using the target\u2019s blocks and ignoring `initialBlocks`."
9867
- );
9868
- }
9869
- const sendPropsProvided = [loadChannels, loadSendAsUserStatus, onSend].filter(Boolean).length;
9870
- if (sendPropsProvided > 0 && sendPropsProvided < 3) {
9871
- console.warn(
9872
- "[BlockKitchen] Partial send wiring: `loadChannels`, `loadSendAsUserStatus`, and `onSend` are all-or-nothing. The send button is hidden until all three are provided."
9873
- );
9874
- }
9875
- if (editing && !sendEnabled) {
9876
- console.warn(
9877
- "[BlockKitchen] `editing` requires the send integration (`loadChannels`, `loadSendAsUserStatus`, `onSend`); ignoring `editing`."
9878
- );
9879
- }
9880
- if (renderSendExtras && !sendEnabled) {
9881
- console.warn(
9882
- "[BlockKitchen] `renderSendExtras` extends the built-in send dialog, which requires the send integration (`loadChannels`, `loadSendAsUserStatus`, `onSend`); ignoring `renderSendExtras`."
9883
- );
9884
- }
9885
- if (primaryAction && sendEnabled) {
9886
- console.warn(
9887
- "[BlockKitchen] `primaryAction` is only available in compose-only mode \u2014 with the send integration wired, the built-in Send/Update flow owns the toolbar\u2019s primary action; ignoring `primaryAction`."
9888
- );
9889
- }
9890
- }, []);
9905
+ const loadEnabled = Boolean(loading);
9906
+ const recentChannelSource = loading?.loadChannels ?? (sendEnabled ? loadChannels : void 0);
9907
+ const onUpdate = sendEnabled ? onUpdateProp : void 0;
9908
+ const seededBlocks = loading?.initialTarget?.blocks ?? initialBlocks;
9909
+ const sendPropsProvided = [loadChannels, loadSendAsUserStatus, onSend].filter(Boolean).length;
9910
+ useDevWarning(
9911
+ Boolean(loading?.initialTarget && initialBlocks),
9912
+ "[BlockKitchen] Both `initialBlocks` and an `initialTarget` were provided; using the target\u2019s blocks and ignoring `initialBlocks`."
9913
+ );
9914
+ useDevWarning(
9915
+ sendPropsProvided > 0 && sendPropsProvided < 3,
9916
+ "[BlockKitchen] Partial send wiring: `loadChannels`, `loadSendAsUserStatus`, and `onSend` are all-or-nothing. The send button is hidden until all three are provided."
9917
+ );
9918
+ useDevWarning(
9919
+ Boolean(onUpdateProp && !sendEnabled),
9920
+ "[BlockKitchen] `onUpdate` requires the send integration (`loadChannels`, `loadSendAsUserStatus`, `onSend`); ignoring `onUpdate`. To load an existing message without the send integration, use the `loading` prop instead."
9921
+ );
9922
+ useDevWarning(
9923
+ Boolean(sendEnabled && onUpdateProp && !loading),
9924
+ "[BlockKitchen] `onUpdate` needs a loaded message, but no load source is configured \u2014 provide the `loading` prop. The update flow is unreachable."
9925
+ );
9926
+ useDevWarning(
9927
+ Boolean(loading?.loadRecentMessages && !recentChannelSource),
9928
+ "[BlockKitchen] `loading.loadRecentMessages` needs a channel list to scope its lookup \u2014 provide `loading.loadChannels` (compose-only mode has no send integration to reuse). Hiding the recent-messages picker."
9929
+ );
9930
+ useDevWarning(
9931
+ Boolean(renderSendExtras && !sendEnabled),
9932
+ "[BlockKitchen] `renderSendExtras` extends the built-in send dialog, which requires the send integration (`loadChannels`, `loadSendAsUserStatus`, `onSend`); ignoring `renderSendExtras`."
9933
+ );
9934
+ useDevWarning(
9935
+ Boolean(primaryAction && sendEnabled),
9936
+ "[BlockKitchen] `primaryAction` is only available in compose-only mode \u2014 with the send integration wired, the built-in Send/Update flow owns the toolbar\u2019s primary action; ignoring `primaryAction`."
9937
+ );
9891
9938
  const { blocks, addBlock, addChild, updateBlock, removeBlock, duplicateBlock, reorderBlock, moveBlock, replaceAll } = useBlockKitchenState({ initialBlocks: seededBlocks, onChange });
9892
9939
  const childParentById = useMemo(() => {
9893
9940
  const map = /* @__PURE__ */ new Map();
@@ -9904,8 +9951,11 @@ function BlockKitchen(props) {
9904
9951
  const [sendOpen, setSendOpen] = useState(false);
9905
9952
  const [updateOpen, setUpdateOpen] = useState(false);
9906
9953
  const [loadOpen, setLoadOpen] = useState(false);
9907
- const [editTarget, setEditTarget] = useState(() => editingConfig?.initialTarget ?? null);
9908
- const activeEditTarget = editingConfig ? editTarget : null;
9954
+ const [editTarget, setEditTarget] = useState(
9955
+ () => loading?.initialTarget ? toLoadedMessage(loading.initialTarget) : null
9956
+ );
9957
+ const activeEditTarget = loadEnabled ? editTarget : null;
9958
+ useNotifyOnChange(activeEditTarget, loadedMessageKey, loading?.onLoadedMessageChange);
9909
9959
  const [issuesOpen, setIssuesOpen] = useState(false);
9910
9960
  const [paletteOpen, setPaletteOpen] = useState(false);
9911
9961
  const [openBlockId, setOpenBlockId] = useState(null);
@@ -9927,18 +9977,7 @@ function BlockKitchen(props) {
9927
9977
  () => ({ valid: validation.valid, errorCount: validation.total, errors: validation.errors }),
9928
9978
  [validation]
9929
9979
  );
9930
- const lastNotifiedValidationRef = useRef(null);
9931
- useEffect(() => {
9932
- if (!onValidationChange) {
9933
- return;
9934
- }
9935
- const key = JSON.stringify([validationSummary.valid, validationSummary.errorCount, ...validationSummary.errors]);
9936
- if (lastNotifiedValidationRef.current === key) {
9937
- return;
9938
- }
9939
- lastNotifiedValidationRef.current = key;
9940
- onValidationChange(validationSummary);
9941
- }, [validationSummary, onValidationChange]);
9980
+ useNotifyOnChange(validationSummary, validationSummaryKey, onValidationChange);
9942
9981
  const sensors = useSensors(
9943
9982
  useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),
9944
9983
  useSensor(TouchSensor, { activationConstraint: { delay: 150, tolerance: 8 } }),
@@ -10045,11 +10084,16 @@ function BlockKitchen(props) {
10045
10084
  showSend: sendEnabled,
10046
10085
  primaryAction: !sendEnabled && primaryAction ? {
10047
10086
  label: primaryAction.label,
10048
- onClick: () => primaryAction.onClick({ blocks: blockPayloads, validation: validationSummary }),
10087
+ onClick: () => primaryAction.onClick({
10088
+ blocks: blockPayloads,
10089
+ validation: validationSummary,
10090
+ loadedMessage: activeEditTarget
10091
+ }),
10049
10092
  disabled: primaryAction.disableWhenInvalid ? !validationSummary.valid : false
10050
10093
  } : null,
10051
10094
  sendButtonLabel,
10052
- editingEnabled: !!editingConfig,
10095
+ loadEnabled,
10096
+ updateEnabled: Boolean(onUpdate),
10053
10097
  editBadge: activeEditTarget ? {
10054
10098
  channelLabel: activeEditTarget.channelName ? `#${activeEditTarget.channelName}` : activeEditTarget.channelId,
10055
10099
  ts: activeEditTarget.ts
@@ -10057,9 +10101,13 @@ function BlockKitchen(props) {
10057
10101
  onOpenLoad: () => setLoadOpen(true),
10058
10102
  onOpenUpdate: () => setUpdateOpen(true),
10059
10103
  onExitEdit: () => {
10104
+ if (sendEnabled) {
10105
+ setEditTarget(null);
10106
+ replaceAll([]);
10107
+ setLoadOpen(true);
10108
+ return;
10109
+ }
10060
10110
  setEditTarget(null);
10061
- replaceAll([]);
10062
- setLoadOpen(true);
10063
10111
  },
10064
10112
  loadButtonLabel,
10065
10113
  updateButtonLabel
@@ -10149,7 +10197,7 @@ function BlockKitchen(props) {
10149
10197
  }
10150
10198
  }
10151
10199
  ) : null,
10152
- activeEditTarget && editingConfig && loadSendAsUserStatus ? /* @__PURE__ */ jsx(
10200
+ activeEditTarget && onUpdate && loadSendAsUserStatus ? /* @__PURE__ */ jsx(
10153
10201
  UpdateDialog,
10154
10202
  {
10155
10203
  open: updateOpen,
@@ -10157,7 +10205,7 @@ function BlockKitchen(props) {
10157
10205
  target: activeEditTarget,
10158
10206
  blocks: blockPayloads,
10159
10207
  loadSendAsUserStatus,
10160
- onUpdate: editingConfig.onUpdate,
10208
+ onUpdate,
10161
10209
  confirmUpdateLabel,
10162
10210
  errorCount: validation.total,
10163
10211
  onShowIssues: () => {
@@ -10166,25 +10214,17 @@ function BlockKitchen(props) {
10166
10214
  }
10167
10215
  }
10168
10216
  ) : null,
10169
- editingConfig && loadChannels ? /* @__PURE__ */ jsx(
10217
+ loading ? /* @__PURE__ */ jsx(
10170
10218
  LoadMessageDialog,
10171
10219
  {
10172
10220
  open: loadOpen,
10173
10221
  onOpenChange: setLoadOpen,
10174
- onLoadMessage: editingConfig.onLoadMessage,
10175
- loadRecentMessages: editingConfig.loadRecentMessages,
10176
- loadChannels,
10222
+ onLoadMessage: loading.onLoadMessage,
10223
+ loadRecentMessages: loading.loadRecentMessages,
10224
+ loadChannels: recentChannelSource,
10177
10225
  onLoaded: (result) => {
10178
10226
  replaceAll(result.blocks);
10179
- setEditTarget({
10180
- channelId: result.channelId,
10181
- channelName: result.channelName,
10182
- ts: result.ts,
10183
- editableVia: result.editableVia,
10184
- workspaceName: result.workspaceName,
10185
- username: result.username,
10186
- iconUrl: result.iconUrl
10187
- });
10227
+ setEditTarget(toLoadedMessage(result));
10188
10228
  setLoadOpen(false);
10189
10229
  },
10190
10230
  onOpenAsNew: (loadedBlocks) => {