@informedai/react 0.4.3 → 0.4.5

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.js CHANGED
@@ -541,13 +541,13 @@ function InformedAIProvider({ config, children }) {
541
541
  await clientRef.current.sendMessage(session.id, message, handleSSEEvent);
542
542
  } catch (err) {
543
543
  if (isSessionNotFoundError(err)) {
544
- setIsStreaming(false);
545
544
  await handleSessionDeleted();
546
545
  return;
547
546
  }
548
547
  const error2 = err instanceof Error ? err : new Error("Failed to send message");
549
548
  setError(error2);
550
549
  config.onError?.(error2);
550
+ } finally {
551
551
  setIsStreaming(false);
552
552
  }
553
553
  }, [session, handleSSEEvent, handleSessionDeleted, config]);
@@ -886,12 +886,13 @@ function AssistantWidget({ className, theme, position = "inline", defaultCollaps
886
886
  gap: "12px"
887
887
  },
888
888
  children: [
889
- session?.widgetMessages.map((msg) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
889
+ session?.widgetMessages.map((msg, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
890
890
  MessageBubble,
891
891
  {
892
892
  message: msg,
893
893
  theme,
894
- onQuickAction: handleQuickAction
894
+ onQuickAction: handleQuickAction,
895
+ isLatest: index === session.widgetMessages.length - 1
895
896
  },
896
897
  msg.id
897
898
  )),
@@ -1001,7 +1002,9 @@ function AssistantWidget({ className, theme, position = "inline", defaultCollaps
1001
1002
  borderRadius: "8px",
1002
1003
  fontSize: "14px",
1003
1004
  outline: "none",
1004
- fontFamily: "inherit"
1005
+ fontFamily: "inherit",
1006
+ backgroundColor: "#ffffff",
1007
+ color: "#1c1917"
1005
1008
  }
1006
1009
  }
1007
1010
  ),
@@ -1069,9 +1072,9 @@ function QuickActionButton({
1069
1072
  }
1070
1073
  );
1071
1074
  }
1072
- function MessageBubble({ message, theme, onQuickAction }) {
1075
+ function MessageBubble({ message, theme, onQuickAction, isLatest = false }) {
1073
1076
  const isUser = message.role === "user";
1074
- const hasQuickActions = message.quickActions && message.quickActions.length > 0;
1077
+ const hasQuickActions = isLatest && message.quickActions && message.quickActions.length > 0;
1075
1078
  if ((message.type === "quick_actions" || !message.content) && hasQuickActions) {
1076
1079
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: {
1077
1080
  display: "flex",
package/dist/index.mjs CHANGED
@@ -511,13 +511,13 @@ function InformedAIProvider({ config, children }) {
511
511
  await clientRef.current.sendMessage(session.id, message, handleSSEEvent);
512
512
  } catch (err) {
513
513
  if (isSessionNotFoundError(err)) {
514
- setIsStreaming(false);
515
514
  await handleSessionDeleted();
516
515
  return;
517
516
  }
518
517
  const error2 = err instanceof Error ? err : new Error("Failed to send message");
519
518
  setError(error2);
520
519
  config.onError?.(error2);
520
+ } finally {
521
521
  setIsStreaming(false);
522
522
  }
523
523
  }, [session, handleSSEEvent, handleSessionDeleted, config]);
@@ -856,12 +856,13 @@ function AssistantWidget({ className, theme, position = "inline", defaultCollaps
856
856
  gap: "12px"
857
857
  },
858
858
  children: [
859
- session?.widgetMessages.map((msg) => /* @__PURE__ */ jsx2(
859
+ session?.widgetMessages.map((msg, index) => /* @__PURE__ */ jsx2(
860
860
  MessageBubble,
861
861
  {
862
862
  message: msg,
863
863
  theme,
864
- onQuickAction: handleQuickAction
864
+ onQuickAction: handleQuickAction,
865
+ isLatest: index === session.widgetMessages.length - 1
865
866
  },
866
867
  msg.id
867
868
  )),
@@ -971,7 +972,9 @@ function AssistantWidget({ className, theme, position = "inline", defaultCollaps
971
972
  borderRadius: "8px",
972
973
  fontSize: "14px",
973
974
  outline: "none",
974
- fontFamily: "inherit"
975
+ fontFamily: "inherit",
976
+ backgroundColor: "#ffffff",
977
+ color: "#1c1917"
975
978
  }
976
979
  }
977
980
  ),
@@ -1039,9 +1042,9 @@ function QuickActionButton({
1039
1042
  }
1040
1043
  );
1041
1044
  }
1042
- function MessageBubble({ message, theme, onQuickAction }) {
1045
+ function MessageBubble({ message, theme, onQuickAction, isLatest = false }) {
1043
1046
  const isUser = message.role === "user";
1044
- const hasQuickActions = message.quickActions && message.quickActions.length > 0;
1047
+ const hasQuickActions = isLatest && message.quickActions && message.quickActions.length > 0;
1045
1048
  if ((message.type === "quick_actions" || !message.content) && hasQuickActions) {
1046
1049
  return /* @__PURE__ */ jsxs("div", { style: {
1047
1050
  display: "flex",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@informedai/react",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "React SDK for InformedAI Assistant - AI-powered content creation widget",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",