@brainfish-ai/components 0.23.0 → 0.23.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/chat-search.d.ts +1 -1
  2. package/dist/esm/chunks/{ChatSearch.C6RERao6.js → ChatSearch.DVi90w5m.js} +15 -18
  3. package/dist/esm/chunks/ChatSearch.DVi90w5m.js.map +1 -0
  4. package/dist/esm/chunks/{FormattedMessage.DFWDPJoI.js → FormattedMessage.Br7XTLD2.js} +5 -50
  5. package/dist/esm/chunks/FormattedMessage.Br7XTLD2.js.map +1 -0
  6. package/dist/esm/chunks/MermaidDiagram.xQ0CVFOI.js +50 -0
  7. package/dist/esm/chunks/MermaidDiagram.xQ0CVFOI.js.map +1 -0
  8. package/dist/esm/chunks/{hooks.DI5ftshU.js → hooks.Dii4V-O3.js} +11 -18
  9. package/dist/esm/chunks/hooks.Dii4V-O3.js.map +1 -0
  10. package/dist/esm/chunks/{layout.Cw9KlzMD.js → layout.B4f3-2zh.js} +2 -2
  11. package/dist/esm/chunks/{layout.Cw9KlzMD.js.map → layout.B4f3-2zh.js.map} +1 -1
  12. package/dist/esm/chunks/{sidebar.BejmvpB3.js → sidebar.kcxBRKYA.js} +12 -3
  13. package/dist/esm/chunks/sidebar.kcxBRKYA.js.map +1 -0
  14. package/dist/esm/components/chat-search.js +1 -1
  15. package/dist/esm/components/convos.js +1 -1
  16. package/dist/esm/components/markdown.js +2 -1
  17. package/dist/esm/components/markdown.js.map +1 -1
  18. package/dist/esm/components/ui/icon.js +17 -7
  19. package/dist/esm/components/ui/icon.js.map +1 -1
  20. package/dist/esm/global.css +1 -1
  21. package/dist/esm/index.js +5 -4
  22. package/dist/esm/index.js.map +1 -1
  23. package/dist/esm/layouts/full-layout.js +1 -1
  24. package/dist/esm/layouts/sidebar.js +1 -1
  25. package/dist/icon.d.ts +0 -14
  26. package/dist/index.d.ts +1 -15
  27. package/dist/stats.html +1 -1
  28. package/package.json +1 -1
  29. package/dist/esm/chunks/ChatSearch.C6RERao6.js.map +0 -1
  30. package/dist/esm/chunks/FormattedMessage.DFWDPJoI.js.map +0 -1
  31. package/dist/esm/chunks/hooks.DI5ftshU.js.map +0 -1
  32. package/dist/esm/chunks/sidebar.BejmvpB3.js.map +0 -1
@@ -215,7 +215,7 @@ export declare interface ChatSearchProps {
215
215
  searchEndpoint: string;
216
216
  answerEndpoint: string;
217
217
  answerStreamEndpoint: string;
218
- presignedUrlEndpoint?: string;
218
+ uploadEndpoint?: string;
219
219
  feedbackEndpoint?: string;
220
220
  feedbackReasonEndpoint?: string;
221
221
  loadConversationEndpoint?: string;
@@ -4,8 +4,8 @@ import rehypeRaw from 'rehype-raw';
4
4
  import remarkGfm from 'remark-gfm';
5
5
  import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from '../components/ui/tooltip.js';
6
6
  import { Button } from '../components/ui/button.js';
7
- import { XCircle, X, Check, Copy, CaretDown, ArrowSquareOut, CaretRight, ArrowsVertical, Globe, LockSimple, MagnifyingGlass, Plus, ArrowRight, ArrowLeft, ArrowsInSimple, ArrowsOutSimple } from '@phosphor-icons/react';
8
- import { F as FormattedMessage, b as addPopupWidgetUtm, M as MemoizedReactMarkdown } from './FormattedMessage.DFWDPJoI.js';
7
+ import { XCircle, X, Check, Copy, CaretDown, ArrowSquareOut, CaretRight, ArrowsVertical, Globe, LockSimple, MagnifyingGlass, Image, ArrowRight, ArrowLeft, ArrowsInSimple, ArrowsOutSimple } from '@phosphor-icons/react';
8
+ import { F as FormattedMessage, a as addPopupWidgetUtm, M as MemoizedReactMarkdown } from './FormattedMessage.Br7XTLD2.js';
9
9
  import { appendErrors, useForm, Controller } from 'react-hook-form';
10
10
  import { validateFieldsNatively, toNestErrors } from '@hookform/resolvers';
11
11
  import require$$0 from 'ajv';
@@ -28,7 +28,7 @@ import { Switch } from '../components/ui/switch.js';
28
28
  import { C as Combobox } from './combobox.DNYCWyub.js';
29
29
  import { T as TwoLevelCombobox } from './two-level-combobox.DsWPDcI6.js';
30
30
  import { X as X$1 } from 'lucide-react';
31
- import { l as loadConversation, c as createConversationId, r as requestPresignedUrl, a as uploadFileToS3, b as useAutocomplete, s as sendFeedbackReason, d as sendFeedback, e as searchApi, f as fetchAnswerStream, g as fetchFollowUpQuestions } from './hooks.DI5ftshU.js';
31
+ import { l as loadConversation, c as createConversationId, a as uploadFileToApi, b as useAutocomplete, s as sendFeedbackReason, d as sendFeedback, e as searchApi, f as fetchAnswerStream, g as fetchFollowUpQuestions } from './hooks.Dii4V-O3.js';
32
32
  import { ScrollArea } from '../components/ui/scroll-area.js';
33
33
 
34
34
  import '../ChatSearch.css';function Suggestions({ suggestions, onQuestionClick, title = "Suggested questions" }) {
@@ -4593,7 +4593,7 @@ const MAX_FILE_SIZE = 10 * 1024 * 1024;
4593
4593
  const MAX_FILE_COUNT = 5;
4594
4594
  let nextFileId = 0;
4595
4595
  const generateFileId = () => `file-${++nextFileId}`;
4596
- function useFileAttachment({ presignedUrlEndpoint, headers, getConversationId, onError }) {
4596
+ function useFileAttachment({ uploadEndpoint, headers, getConversationId, onError }) {
4597
4597
  const [attachedFiles, setAttachedFiles] = useState([]);
4598
4598
  const removeFile = useCallback((id) => {
4599
4599
  setAttachedFiles((prev) => {
@@ -4628,8 +4628,8 @@ function useFileAttachment({ presignedUrlEndpoint, headers, getConversationId, o
4628
4628
  if (filesToAdd.length < validFiles.length) {
4629
4629
  onError?.("Maximum 5 images. Some images were not attached.");
4630
4630
  }
4631
- if (!presignedUrlEndpoint) {
4632
- console.error("[useFileAttachment] presignedUrlEndpoint is not configured — file attachment is unavailable.");
4631
+ if (!uploadEndpoint) {
4632
+ console.error("[useFileAttachment] uploadEndpoint is not configured — file attachment is unavailable.");
4633
4633
  onError?.("Something went wrong. Please try again later.");
4634
4634
  return;
4635
4635
  }
@@ -4645,15 +4645,12 @@ function useFileAttachment({ presignedUrlEndpoint, headers, getConversationId, o
4645
4645
  newFiles.forEach((newFile) => {
4646
4646
  void (async () => {
4647
4647
  try {
4648
- const { uploadUrl, publicUrl } = await requestPresignedUrl({
4649
- endpoint: presignedUrlEndpoint,
4648
+ const { publicUrl } = await uploadFileToApi({
4649
+ endpoint: uploadEndpoint,
4650
4650
  conversationId,
4651
- filename: newFile.file.name,
4652
- contentType: newFile.file.type,
4653
- size: newFile.file.size,
4651
+ file: newFile.file,
4654
4652
  headers
4655
4653
  });
4656
- await uploadFileToS3(uploadUrl, newFile.file);
4657
4654
  setAttachedFiles((prev) => prev.map((f) => f.id === newFile.id ? { ...f, status: "uploaded", publicUrl } : f));
4658
4655
  } catch (error) {
4659
4656
  console.error("Upload failed:", error);
@@ -4667,7 +4664,7 @@ function useFileAttachment({ presignedUrlEndpoint, headers, getConversationId, o
4667
4664
  })();
4668
4665
  });
4669
4666
  },
4670
- [attachedFiles, presignedUrlEndpoint, headers, getConversationId, onError]
4667
+ [attachedFiles, uploadEndpoint, headers, getConversationId, onError]
4671
4668
  );
4672
4669
  const clearAttachedFiles = useCallback(() => {
4673
4670
  attachedFiles.forEach((f) => URL.revokeObjectURL(f.preview));
@@ -5257,7 +5254,7 @@ const PrimarySearch = React__default.forwardRef(
5257
5254
  disabled: attachedFiles.length >= 5,
5258
5255
  "aria-label": textConfig.attachImageText
5259
5256
  },
5260
- /* @__PURE__ */ React__default.createElement(Plus, { className: "size-4 text-secondary-foreground" })
5257
+ /* @__PURE__ */ React__default.createElement(Image, { weight: "regular", className: "size-4 text-secondary-foreground" })
5261
5258
  )), /* @__PURE__ */ React__default.createElement("div", { className: "flex gap-1", "data-name": "collections-dropdown" }, allowedRegions.length > 0 && collections.length > 0 ? (
5262
5259
  // Two-level selection: Region -> Collection
5263
5260
  /* @__PURE__ */ React__default.createElement(
@@ -5548,7 +5545,7 @@ const FollowUpSearchBar = React__default.forwardRef(
5548
5545
  disabled: attachedFiles.length >= 5,
5549
5546
  "aria-label": textConfig.attachImageText
5550
5547
  },
5551
- /* @__PURE__ */ React__default.createElement(Plus, { className: "size-4 text-secondary-foreground" })
5548
+ /* @__PURE__ */ React__default.createElement(Image, { weight: "regular", className: "size-4 text-secondary-foreground" })
5552
5549
  )), !enableFileAttachment && /* @__PURE__ */ React__default.createElement("div", { className: "size-6 flex flex-shrink-0 justify-center items-center" }, /* @__PURE__ */ React__default.createElement(MagnifyingGlass, { className: "size-5 text-secondary-foreground" })), /* @__PURE__ */ React__default.createElement(
5553
5550
  Textarea,
5554
5551
  {
@@ -5803,7 +5800,7 @@ const ChatSearchComponent = forwardRef(
5803
5800
  fetchRegionConfig,
5804
5801
  searchEndpoint,
5805
5802
  answerStreamEndpoint,
5806
- presignedUrlEndpoint,
5803
+ uploadEndpoint,
5807
5804
  feedbackEndpoint,
5808
5805
  feedbackReasonEndpoint,
5809
5806
  loadConversationEndpoint,
@@ -5865,7 +5862,7 @@ const ChatSearchComponent = forwardRef(
5865
5862
  return conversationId;
5866
5863
  }, [currentConversationId, setCurrentConversationId]);
5867
5864
  const { attachedFiles, isUploading, addFiles, removeFile, clearAttachedFiles, getUploadedAttachments } = useFileAttachment({
5868
- presignedUrlEndpoint,
5865
+ uploadEndpoint,
5869
5866
  headers,
5870
5867
  getConversationId: getOrCreateConversationId,
5871
5868
  onError: showToast
@@ -6686,4 +6683,4 @@ const ChatSearch = forwardRef(({ featureFlags, ...props }, ref) => /* @__PURE__
6686
6683
  ChatSearch.displayName = "ChatSearch";
6687
6684
 
6688
6685
  export { ChatSearch as C, ChatSearchProvider as a, useIsChatSearchDirty as b, useChatSearch as u };
6689
- //# sourceMappingURL=ChatSearch.C6RERao6.js.map
6686
+ //# sourceMappingURL=ChatSearch.DVi90w5m.js.map