@tightknitai/block-kitchen 0.8.11 → 0.9.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,6 +1,6 @@
1
1
  import * as react from 'react';
2
- import { B as BlockKitchenProps, $ as Template, K as PreviewSurface, N as PreviewTheme } from './palette-Bup05opK.cjs';
3
- export { A as AlertBlock, a as AlertLevel, b as BrandPreset, c as BrandTheme, d as BrandTokens, e as BuilderBlock, C as CardBlock, f as CarouselBlock, g as CartesianChart, h as ChannelOption, i as Chart, j as ChartAxisConfig, k as ChartDataPoint, l as ChartSeries, m as ChartType, n as ContainerBlock, o as ContainerChildBlock, p as ContextActionsBlock, q as ContextActionsElement, r as CustomEmoji, D as DataVisualizationBlock, E as EditableVia, s as EditingConfig, F as FeedbackButtonSubobject, t as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, u as IconButtonIcon, v as InputBlock, L as LoadMessageInput, w as LoadResult, M as MarkdownBlock, P as PaletteSection, x as PaletteVariant, y as PieChart, z as PieChartSegment, G as PlanBlock, J as PreviewHooks, R as RecentMessage, S as SendAsUserStatus, O as SendPayload, Q as SendResult, T as SupportedBlock, U as SupportedBlockType, V as SupportedHeaderBlock, W as TableBlock, X as TableCell, Y as TableColumnSetting, Z as TaskCardBlock, _ as TaskCardStatus, a0 as UpdatePayload, a1 as UpdateResult, a2 as UrlSourceElement, a3 as VideoBlock, a5 as defaultPalette, a6 as extraAlertVariant, a7 as legacyInputVariants } from './palette-Bup05opK.cjs';
2
+ import { B as BlockKitchenProps, $ as Template, K as PreviewSurface, N as PreviewTheme } from './palette-DIbvAzRA.cjs';
3
+ export { A as AlertBlock, a as AlertLevel, b as BrandPreset, c as BrandTheme, d as BrandTokens, e as BuilderBlock, C as CardBlock, f as CarouselBlock, g as CartesianChart, h as ChannelOption, i as Chart, j as ChartAxisConfig, k as ChartDataPoint, l as ChartSeries, m as ChartType, n as ContainerBlock, o as ContainerChildBlock, p as ContextActionsBlock, q as ContextActionsElement, r as CustomEmoji, D as DataVisualizationBlock, E as EditableVia, s as EditingConfig, F as FeedbackButtonSubobject, t as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, u as IconButtonIcon, v as InputBlock, L as LoadMessageInput, w as LoadResult, M as MarkdownBlock, P as PaletteSection, x as PaletteVariant, y as PieChart, z as PieChartSegment, G as PlanBlock, J as PreviewHooks, R as RecentMessage, S as SendAsUserStatus, O as SendPayload, Q as SendResult, T as SupportedBlock, U as SupportedBlockType, V as SupportedHeaderBlock, W as TableBlock, X as TableCell, Y as TableColumnSetting, Z as TaskCardBlock, _ as TaskCardStatus, a0 as UpdatePayload, a1 as UpdateResult, a2 as UrlSourceElement, a3 as VideoBlock, a5 as defaultPalette, a6 as extraAlertVariant, a7 as legacyInputVariants } from './palette-DIbvAzRA.cjs';
4
4
  export { decodeBlocksFromString, encodeBlocksToString, toSlackBlocks } from './helpers.cjs';
5
5
  import 'slack-web-api-client';
6
6
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
- import { B as BlockKitchenProps, $ as Template, K as PreviewSurface, N as PreviewTheme } from './palette-Bup05opK.js';
3
- export { A as AlertBlock, a as AlertLevel, b as BrandPreset, c as BrandTheme, d as BrandTokens, e as BuilderBlock, C as CardBlock, f as CarouselBlock, g as CartesianChart, h as ChannelOption, i as Chart, j as ChartAxisConfig, k as ChartDataPoint, l as ChartSeries, m as ChartType, n as ContainerBlock, o as ContainerChildBlock, p as ContextActionsBlock, q as ContextActionsElement, r as CustomEmoji, D as DataVisualizationBlock, E as EditableVia, s as EditingConfig, F as FeedbackButtonSubobject, t as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, u as IconButtonIcon, v as InputBlock, L as LoadMessageInput, w as LoadResult, M as MarkdownBlock, P as PaletteSection, x as PaletteVariant, y as PieChart, z as PieChartSegment, G as PlanBlock, J as PreviewHooks, R as RecentMessage, S as SendAsUserStatus, O as SendPayload, Q as SendResult, T as SupportedBlock, U as SupportedBlockType, V as SupportedHeaderBlock, W as TableBlock, X as TableCell, Y as TableColumnSetting, Z as TaskCardBlock, _ as TaskCardStatus, a0 as UpdatePayload, a1 as UpdateResult, a2 as UrlSourceElement, a3 as VideoBlock, a5 as defaultPalette, a6 as extraAlertVariant, a7 as legacyInputVariants } from './palette-Bup05opK.js';
2
+ import { B as BlockKitchenProps, $ as Template, K as PreviewSurface, N as PreviewTheme } from './palette-DIbvAzRA.js';
3
+ export { A as AlertBlock, a as AlertLevel, b as BrandPreset, c as BrandTheme, d as BrandTokens, e as BuilderBlock, C as CardBlock, f as CarouselBlock, g as CartesianChart, h as ChannelOption, i as Chart, j as ChartAxisConfig, k as ChartDataPoint, l as ChartSeries, m as ChartType, n as ContainerBlock, o as ContainerChildBlock, p as ContextActionsBlock, q as ContextActionsElement, r as CustomEmoji, D as DataVisualizationBlock, E as EditableVia, s as EditingConfig, F as FeedbackButtonSubobject, t as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, u as IconButtonIcon, v as InputBlock, L as LoadMessageInput, w as LoadResult, M as MarkdownBlock, P as PaletteSection, x as PaletteVariant, y as PieChart, z as PieChartSegment, G as PlanBlock, J as PreviewHooks, R as RecentMessage, S as SendAsUserStatus, O as SendPayload, Q as SendResult, T as SupportedBlock, U as SupportedBlockType, V as SupportedHeaderBlock, W as TableBlock, X as TableCell, Y as TableColumnSetting, Z as TaskCardBlock, _ as TaskCardStatus, a0 as UpdatePayload, a1 as UpdateResult, a2 as UrlSourceElement, a3 as VideoBlock, a5 as defaultPalette, a6 as extraAlertVariant, a7 as legacyInputVariants } from './palette-DIbvAzRA.js';
4
4
  export { decodeBlocksFromString, encodeBlocksToString, toSlackBlocks } from './helpers.js';
5
5
  import 'slack-web-api-client';
6
6
 
package/dist/index.js CHANGED
@@ -2821,19 +2821,25 @@ function LoadMessageDialog({
2821
2821
  onOpenChange,
2822
2822
  onLoadMessage,
2823
2823
  loadRecentMessages,
2824
+ loadChannels,
2824
2825
  onLoaded,
2825
2826
  onOpenAsNew
2826
2827
  }) {
2827
2828
  const [link, setLink] = useState("");
2828
2829
  const [status, setStatus] = useState({ kind: "idle" });
2830
+ const [channels, setChannels] = useState(null);
2831
+ const [channelsError, setChannelsError] = useState(null);
2832
+ const [channelId, setChannelId] = useState("");
2829
2833
  const [recent, setRecent] = useState(null);
2830
2834
  const [recentError, setRecentError] = useState(null);
2831
2835
  const inputRef = useRef(null);
2832
2836
  const onLoadMessageRef = useRef(onLoadMessage);
2833
2837
  const loadRecentMessagesRef = useRef(loadRecentMessages);
2838
+ const loadChannelsRef = useRef(loadChannels);
2834
2839
  useEffect(() => {
2835
2840
  onLoadMessageRef.current = onLoadMessage;
2836
2841
  loadRecentMessagesRef.current = loadRecentMessages;
2842
+ loadChannelsRef.current = loadChannels;
2837
2843
  });
2838
2844
  const hasRecent = !!loadRecentMessages;
2839
2845
  useEffect(() => {
@@ -2842,15 +2848,38 @@ function LoadMessageDialog({
2842
2848
  }
2843
2849
  setLink("");
2844
2850
  setStatus({ kind: "idle" });
2851
+ setChannelId("");
2852
+ setRecent(null);
2853
+ setRecentError(null);
2845
2854
  if (!loadRecentMessagesRef.current) {
2846
- setRecent([]);
2847
- setRecentError(null);
2855
+ setChannels([]);
2856
+ setChannelsError(null);
2857
+ return;
2858
+ }
2859
+ setChannels(null);
2860
+ setChannelsError(null);
2861
+ let cancelled = false;
2862
+ loadChannelsRef.current().then((list) => {
2863
+ if (!cancelled) {
2864
+ setChannels(list);
2865
+ }
2866
+ }).catch((e) => {
2867
+ if (!cancelled) {
2868
+ setChannelsError(e instanceof Error ? e.message : "Failed to load channels");
2869
+ }
2870
+ });
2871
+ return () => {
2872
+ cancelled = true;
2873
+ };
2874
+ }, [open]);
2875
+ useEffect(() => {
2876
+ if (!open || !loadRecentMessagesRef.current || !channelId) {
2848
2877
  return;
2849
2878
  }
2850
2879
  setRecent(null);
2851
2880
  setRecentError(null);
2852
2881
  let cancelled = false;
2853
- loadRecentMessagesRef.current().then((list) => {
2882
+ loadRecentMessagesRef.current(channelId).then((list) => {
2854
2883
  if (!cancelled) {
2855
2884
  setRecent(list);
2856
2885
  }
@@ -2862,7 +2891,7 @@ function LoadMessageDialog({
2862
2891
  return () => {
2863
2892
  cancelled = true;
2864
2893
  };
2865
- }, [open]);
2894
+ }, [open, channelId]);
2866
2895
  const handleLoad = async () => {
2867
2896
  const trimmed = link.trim();
2868
2897
  if (!trimmed) {
@@ -2966,10 +2995,33 @@ function LoadMessageDialog({
2966
2995
  "or pick a recent message",
2967
2996
  /* @__PURE__ */ jsx("span", { className: "h-px flex-1 bg-border" })
2968
2997
  ] }),
2969
- recent === null && !recentError && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Loading recent messages\u2026" }),
2970
- recentError && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: recentError }),
2971
- recent && recent.length === 0 && !recentError && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "No recent messages from this app." }),
2972
- recent && recent.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex max-h-48 flex-col gap-1 overflow-y-auto", children: recent.map((m) => {
2998
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
2999
+ /* @__PURE__ */ jsx(Label, { htmlFor: "recent-channel-picker", children: "Channel" }),
3000
+ channels === null && !channelsError && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Loading channels\u2026" }),
3001
+ channelsError && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: channelsError }),
3002
+ channels && channels.length === 0 && !channelsError && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "No public channels available." }),
3003
+ channels && channels.length > 0 && /* @__PURE__ */ jsxs(
3004
+ "select",
3005
+ {
3006
+ id: "recent-channel-picker",
3007
+ value: channelId,
3008
+ onChange: (e) => setChannelId(e.target.value),
3009
+ className: "flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
3010
+ children: [
3011
+ /* @__PURE__ */ jsx("option", { value: "", disabled: true, children: "Select a channel\u2026" }),
3012
+ channels.map((c) => /* @__PURE__ */ jsxs("option", { value: c.id, children: [
3013
+ "#",
3014
+ c.name
3015
+ ] }, c.id))
3016
+ ]
3017
+ }
3018
+ )
3019
+ ] }),
3020
+ !channelId && channels && channels.length > 0 && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Select a channel to see recent messages." }),
3021
+ channelId && recent === null && !recentError && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Loading recent messages\u2026" }),
3022
+ channelId && recentError && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: recentError }),
3023
+ channelId && recent && recent.length === 0 && !recentError && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "No recent messages from this app in this channel." }),
3024
+ channelId && recent && recent.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex max-h-48 flex-col gap-1 overflow-y-auto", children: recent.map((m) => {
2973
3025
  const asUser = (m.editableVia ?? "bot") === "user";
2974
3026
  return /* @__PURE__ */ jsxs(
2975
3027
  "button",
@@ -9810,6 +9862,7 @@ function BlockKitchen(props) {
9810
9862
  onOpenChange: setLoadOpen,
9811
9863
  onLoadMessage: editing.onLoadMessage,
9812
9864
  loadRecentMessages: editing.loadRecentMessages,
9865
+ loadChannels,
9813
9866
  onLoaded: (result) => {
9814
9867
  replaceAll(result.blocks);
9815
9868
  setEditTarget({