@brainfish-ai/components 0.16.10-alpha.5 → 0.16.10

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/convos.d.ts CHANGED
@@ -6,17 +6,6 @@ import { VariantProps } from 'class-variance-authority';
6
6
 
7
7
  declare function AccordionItem({ className, ...props }: React_2.ComponentProps<typeof AccordionPrimitive.Item>): React_2.JSX.Element;
8
8
 
9
- declare type AnswerDiagnostics = {
10
- confidence_score: string;
11
- answer_generation_type?: AnswerGenerationType;
12
- query_context_relevance?: QueryContextRelevance;
13
- context_sufficiency?: ContextSufficiency;
14
- confidence_justification?: string;
15
- evidence_from_context?: EvidenceFromContext[];
16
- };
17
-
18
- declare type AnswerGenerationType = 'Direct Extraction' | 'Summarization' | 'Inference' | 'Combination' | 'Cannot Answer';
19
-
20
9
  declare function Badge({ className, variant, ...props }: BadgeProps): React_2.JSX.Element;
21
10
 
22
11
  declare interface BadgeProps extends React_2.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
@@ -26,8 +15,6 @@ declare const badgeVariants: (props?: ({
26
15
  variant?: "default" | "destructive" | "success" | "warning" | null | undefined;
27
16
  } & ClassProp) | undefined) => string;
28
17
 
29
- declare type ContextSufficiency = 'Sufficient' | 'Partially Sufficient' | 'Insufficient';
30
-
31
18
  /**
32
19
  * Convo component - A single conversation item in an accordion.
33
20
  * Displays conversation metadata and messages, with support for lazy loading.
@@ -35,7 +22,7 @@ declare type ContextSufficiency = 'Sufficient' | 'Partially Sufficient' | 'Insuf
35
22
  * This is a presentational component - it receives messages and loading state as props
36
23
  * rather than managing fetching logic itself.
37
24
  */
38
- export declare function Convo({ locale: localeOverride, value: queryId, question, timestamp, location, source, status, statusMessage, hasAttributes, onClick, className, ...props }: ConvoProps): default_2.JSX.Element;
25
+ export declare function Convo({ locale, value: queryId, question, timestamp, location, source, status, statusMessage, hasAttributes, attributes, messages, isLoading, onClick, className, ...props }: ConvoProps): default_2.JSX.Element;
39
26
 
40
27
  declare interface ConvoInput {
41
28
  value: string;
@@ -59,47 +46,11 @@ export declare type ConvoProps = default_2.ComponentPropsWithRef<typeof Accordio
59
46
  * @param convos - Array of conversation data
60
47
  * @param fetchMessages - Async function to fetch messages for a conversation
61
48
  */
62
- export declare function Convos({ convos, fetchMessages, fetchAttributes, fetchAnswerDiagnostics, onDiscard, onApprove, }: ConvosProps): default_2.JSX.Element;
63
-
64
- declare interface ConvosContextValue {
65
- fetchMessages: (conversationId: string) => Promise<MessageProps[]>;
66
- fetchAttributes: (conversationId: string) => Promise<Record<string, any>>;
67
- getMessages: (conversationId: string) => MessageProps[];
68
- isLoading: (conversationId: string) => boolean;
69
- handleFetchMessages: (conversationId: string) => void;
70
- locale?: string;
71
- fetchAnswerDiagnostics: () => Promise<AnswerDiagnostics>;
72
- onDiscard: (id: string, reason: DiscardReason, suggestedAnswer?: string) => Promise<void>;
73
- onApprove: (id: string) => Promise<void>;
74
- }
49
+ export declare function Convos({ convos, fetchMessages }: ConvosProps): default_2.JSX.Element;
75
50
 
76
51
  declare interface ConvosProps {
77
52
  convos: ConvoInput[];
78
53
  fetchMessages: (conversationId: string) => Promise<MessageProps[]>;
79
- fetchAttributes: (conversationId: string) => Promise<Record<string, any>>;
80
- fetchAnswerDiagnostics: () => Promise<AnswerDiagnostics>;
81
- onDiscard: (id: string, reason: DiscardReason, suggestedAnswer?: string) => Promise<void>;
82
- onApprove: (id: string) => Promise<void>;
83
- }
84
-
85
- export declare function ConvosProvider({ children, value }: ConvosProviderProps): default_2.JSX.Element;
86
-
87
- declare interface ConvosProviderProps {
88
- children: default_2.ReactNode;
89
- value: ConvosContextValue;
90
- }
91
-
92
- declare enum DiscardReason {
93
- INCORRECT_ANSWER = "incorrect_answer",
94
- HALLUCINATED_ANSWER = "hallucinated_answer",
95
- OVERSHARING = "oversharing",
96
- WRONG_ARTICLE_SURFACED = "wrong_article_surfaced",
97
- OTHER = "other"
98
- }
99
-
100
- declare interface EvidenceFromContext {
101
- supporting_quote?: string;
102
- url?: string;
103
54
  }
104
55
 
105
56
  export declare enum Feedback {
@@ -107,7 +58,7 @@ export declare enum Feedback {
107
58
  Negative = "negative"
108
59
  }
109
60
 
110
- export declare function Message({ id, type, role, content, relatedArticles, feedback, timestamp, locale: localeOverride, discarded, discardedMeta, }: MessageProps): default_2.JSX.Element;
61
+ export declare function Message({ type, role, content, relatedArticles, feedback, timestamp, locale }: MessageProps): default_2.JSX.Element;
111
62
 
112
63
  export declare interface MessageProps {
113
64
  id: string;
@@ -118,11 +69,6 @@ export declare interface MessageProps {
118
69
  feedback?: Feedback;
119
70
  type?: MessageType;
120
71
  locale?: string;
121
- discarded?: boolean;
122
- discardedMeta?: {
123
- reason: DiscardReason;
124
- suggestedAnswer?: string;
125
- };
126
72
  }
127
73
 
128
74
  export declare enum MessageType {
@@ -143,11 +89,12 @@ declare interface Props_2 {
143
89
  status?: default_2.ComponentProps<typeof StatusBadge>['variant'];
144
90
  statusMessage?: string;
145
91
  hasAttributes?: boolean;
92
+ attributes?: Record<string, any>;
93
+ messages?: MessageProps[];
94
+ isLoading?: boolean;
146
95
  onClick?: () => void;
147
96
  }
148
97
 
149
- declare type QueryContextRelevance = 'High' | 'Medium' | 'Low';
150
-
151
98
  export declare interface RelatedArticle {
152
99
  id: string;
153
100
  title: string;
@@ -157,6 +104,4 @@ export declare interface RelatedArticle {
157
104
 
158
105
  export declare function StatusBadge({ ...props }: Props): default_2.JSX.Element;
159
106
 
160
- export declare function useConvosContext(): ConvosContextValue;
161
-
162
107
  export { }
@@ -4897,6 +4897,23 @@ function IncludePageToggle({ value, loading, disabled, onToggle }) {
4897
4897
  return /* @__PURE__ */ React__default.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React__default.createElement(Switch, { id: "include-page", checked: value, onCheckedChange: onToggle, disabled: loading || disabled }), /* @__PURE__ */ React__default.createElement("label", { htmlFor: "include-page", className: "text-sm text-foreground flex items-center gap-2" }, "Include page", loading && /* @__PURE__ */ React__default.createElement("div", { className: "animate-spin rounded-full size-3 border-2 border-t-transparent border-primary" })));
4898
4898
  }
4899
4899
 
4900
+ const FeatureFlagContext = createContext(void 0);
4901
+ function FeatureFlagProvider({ children, flags }) {
4902
+ return /* @__PURE__ */ React__default.createElement(FeatureFlagContext.Provider, { value: flags ?? {} }, children);
4903
+ }
4904
+ function useBooleanFlagValue(flagKey, defaultValue) {
4905
+ const flags = useContext(FeatureFlagContext);
4906
+ if (!flags) {
4907
+ console.warn(`useBooleanFlagValue("${flagKey}") used outside of FeatureFlagProvider. Returning default value.`);
4908
+ return defaultValue;
4909
+ }
4910
+ const value = flags[flagKey];
4911
+ if (value === void 0) {
4912
+ return defaultValue;
4913
+ }
4914
+ return Boolean(value);
4915
+ }
4916
+
4900
4917
  const PrimarySearch = React__default.forwardRef(
4901
4918
  ({
4902
4919
  query,
@@ -4925,6 +4942,7 @@ const PrimarySearch = React__default.forwardRef(
4925
4942
  }, ref) => {
4926
4943
  const fileInputRef = useRef(null);
4927
4944
  const [showSuggestions, setShowSuggestions] = useState(false);
4945
+ const showIncludePageToggle = useBooleanFlagValue("showIncludePageToggle", false);
4928
4946
  const regionItems = [
4929
4947
  {
4930
4948
  value: "all",
@@ -5128,7 +5146,7 @@ const PrimarySearch = React__default.forwardRef(
5128
5146
  onChange: (value) => onCollectionChange?.(value)
5129
5147
  }
5130
5148
  )
5131
- ) : null), isAgentAssist && onIncludePageToggle && /* @__PURE__ */ React__default.createElement(
5149
+ ) : null), isAgentAssist && onIncludePageToggle && showIncludePageToggle && /* @__PURE__ */ React__default.createElement(
5132
5150
  IncludePageToggle,
5133
5151
  {
5134
5152
  value: includePageEnabled,
@@ -5518,11 +5536,6 @@ const LoadingConversation = () => {
5518
5536
  );
5519
5537
  };
5520
5538
 
5521
- const FeatureFlagContext = createContext(void 0);
5522
- function FeatureFlagProvider({ children, flags }) {
5523
- return /* @__PURE__ */ React__default.createElement(FeatureFlagContext.Provider, { value: flags ?? {} }, children);
5524
- }
5525
-
5526
5539
  function useDebounce(value, delay) {
5527
5540
  const [debouncedValue, setDebouncedValue] = useState(value);
5528
5541
  useEffect(() => {
@@ -6465,4 +6478,4 @@ const ChatSearch = forwardRef(({ featureFlags, ...props }, ref) => /* @__PURE__
6465
6478
  ChatSearch.displayName = "ChatSearch";
6466
6479
 
6467
6480
  export { ChatSearch as C, ChatSearchProvider as a, useIsChatSearchDirty as b, useChatSearch as u };
6468
- //# sourceMappingURL=ChatSearch.CUhpNmNF.js.map
6481
+ //# sourceMappingURL=ChatSearch.B4QTqo-0.js.map