@box/box-ai-content-answers 0.67.1 → 0.68.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.
@@ -1,10 +1,10 @@
1
1
  import "../../../../styles/footer.css";
2
2
  import * as e from "react";
3
3
  import { useIntl as D } from "react-intl";
4
- import { useBreakpoint as S, Breakpoint as Y, Avatar as J, TextArea as Q, Button as V } from "@box/blueprint-web";
5
- import { ArrowUp as Z } from "@box/blueprint-web-assets/icons/Line";
6
- import { useAgents as g } from "@box/box-ai-agent-selector";
7
- import { useAgents as q } from "../../contexts/AgentsContext.js";
4
+ import { useBreakpoint as S, Breakpoint as Y, Avatar as q, TextArea as J, Button as Q } from "@box/blueprint-web";
5
+ import { ArrowUp as V } from "@box/blueprint-web-assets/icons/Line";
6
+ import { useAgents as Z } from "@box/box-ai-agent-selector";
7
+ import { useAgents as g } from "../../contexts/AgentsContext.js";
8
8
  import { FooterActions as P } from "./footer-actions.js";
9
9
  import tt from "../../messages.js";
10
10
  import { getAIAgentConfig as X } from "../common/agentUtils.js";
@@ -19,48 +19,48 @@ const st = "_questionInput_1pdo1_1", it = "_avatar_1pdo1_11", nt = "_submitButto
19
19
  submitButton: nt,
20
20
  textArea: mt,
21
21
  submitButtonTooltip: ut
22
- }, Et = ({
22
+ }, Tt = ({
23
23
  askSuggestedQuestion: h,
24
- contentType: T,
24
+ contentType: x,
25
25
  enableDebugMode: b = !1,
26
26
  hasRequestInProgress: r,
27
27
  isAgentSelectorEnabled: f,
28
28
  isAIStudioAgentSelectorEnabled: _,
29
- isDebugModeShown: k,
29
+ isDebugModeShown: L,
30
30
  isSidebarOpen: H = !1,
31
31
  isStopResponseEnabled: y,
32
32
  isStreamingEnabled: F,
33
- lastQuestion: L,
34
- onRetryQuestion: E,
33
+ lastQuestion: M,
34
+ onRetryQuestion: T,
35
35
  onStopQuestion: I,
36
36
  recordAction: o,
37
- sendQuestion: M,
37
+ sendQuestion: E,
38
38
  setAskSuggestedQuestion: B,
39
39
  toggleDebugMode: n,
40
40
  user: G
41
41
  }) => {
42
42
  const s = D(), K = S(), a = /* @__PURE__ */ e.createRef(), v = K <= Y.Medium || H, [c, N] = e.useState(!0), [j, O] = e.useState(!1), {
43
43
  selectedAgent: d
44
- } = q(), {
44
+ } = g(), {
45
45
  selectedAgent: C
46
- } = g(), x = e.useCallback(() => {
46
+ } = Z(), k = e.useCallback(() => {
47
47
  a.current && a.current.focus();
48
48
  }, [a]), U = e.useCallback(() => {
49
49
  var m;
50
50
  let t = ((m = a.current) == null ? void 0 : m.value) ?? "";
51
51
  a.current && t.length > i.MAX_LENGTH && (a.current.value = t.slice(0, i.MAX_LENGTH), t = a.current.value), O(t.length >= i.MAX_LENGTH), N(t.trim().length === 0);
52
52
  }, [a]), l = e.useCallback(() => {
53
- if (x(), !r && a.current) {
53
+ if (k(), !r && a.current) {
54
54
  const t = {
55
55
  prompt: a.current.value
56
56
  };
57
57
  if (t.prompt && t.prompt.trim()) {
58
58
  const m = X(f, d, _, C);
59
- M(t, m), a.current.value = "", N(!0), O(!1);
59
+ E(t, m), a.current.value = "", N(!0), O(!1);
60
60
  }
61
- k && n && n();
61
+ L && n && n();
62
62
  }
63
- }, [C, x, r, a, _, f, k, d, M, n]), W = e.useCallback((t) => {
63
+ }, [C, k, r, a, _, f, L, d, E, n]), W = e.useCallback((t) => {
64
64
  t.preventDefault(), !r && !c && o && o({
65
65
  ...R,
66
66
  action: rt,
@@ -74,17 +74,17 @@ const st = "_questionInput_1pdo1_1", it = "_avatar_1pdo1_11", nt = "_submitButto
74
74
  }), l());
75
75
  }, [b, r, c, o, l, n]), z = e.useCallback((t) => {
76
76
  const m = X(f, d, _, C);
77
- E(t, m);
78
- }, [C, _, f, E, d]);
77
+ T(t, m);
78
+ }, [C, _, f, T, d]);
79
79
  return e.useEffect(() => {
80
- setTimeout(x, 0);
80
+ queueMicrotask(k);
81
81
  }, []), e.useEffect(() => {
82
82
  h && a.current && !r && B && (a.current.value = h, l(), B(null));
83
83
  }, [h]), /* @__PURE__ */ w("div", {
84
- children: [L && /* @__PURE__ */ p(P, {
84
+ children: [M && /* @__PURE__ */ p(P, {
85
85
  isStopResponseEnabled: y,
86
86
  isStreamingEnabled: F,
87
- lastQuestion: L,
87
+ lastQuestion: M,
88
88
  onRetryQuestion: z,
89
89
  onStopQuestion: I,
90
90
  recordAction: o
@@ -93,13 +93,13 @@ const st = "_questionInput_1pdo1_1", it = "_avatar_1pdo1_11", nt = "_submitButto
93
93
  children: [!v && /* @__PURE__ */ p("div", {
94
94
  className: A.avatar,
95
95
  "data-testid": "content-answers-question-input-avatar",
96
- children: /* @__PURE__ */ p(J, {
96
+ children: /* @__PURE__ */ p(q, {
97
97
  alt: s.formatMessage(tt.userAvatar),
98
98
  colorIndex: 0,
99
99
  src: G.avatarURL,
100
100
  text: G.name.charAt(0)
101
101
  })
102
- }), /* @__PURE__ */ p(Q, {
102
+ }), /* @__PURE__ */ p(J, {
103
103
  ref: a,
104
104
  className: A.textArea,
105
105
  "data-testid": "content-answers-question-input",
@@ -108,21 +108,21 @@ const st = "_questionInput_1pdo1_1", it = "_avatar_1pdo1_11", nt = "_submitButto
108
108
  }),
109
109
  hideLabel: !0,
110
110
  label: s.formatMessage(u.askQuestionPlaceholder, {
111
- type: T
111
+ type: x
112
112
  }),
113
113
  maxLength: i.MAX_LENGTH,
114
114
  maxRows: v ? i.MAX_ROWS_MOBILE : i.MAX_ROWS,
115
115
  onChange: U,
116
116
  onKeyDown: $,
117
117
  placeholder: s.formatMessage(u.askQuestionPlaceholder, {
118
- type: T
118
+ type: x
119
119
  })
120
- }), /* @__PURE__ */ p(V, {
120
+ }), /* @__PURE__ */ p(Q, {
121
121
  "aria-label": s.formatMessage(u.ask),
122
122
  className: A.submitButton,
123
123
  "data-testid": "content-answers-submit-button",
124
124
  disabled: c || r,
125
- icon: v ? Z : void 0,
125
+ icon: v ? V : void 0,
126
126
  loading: r,
127
127
  loadingAriaLabel: s.formatMessage(u.askDisabledTooltip),
128
128
  onClick: W,
@@ -133,5 +133,5 @@ const st = "_questionInput_1pdo1_1", it = "_avatar_1pdo1_11", nt = "_submitButto
133
133
  });
134
134
  };
135
135
  export {
136
- Et as Footer
136
+ Tt as Footer
137
137
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/box-ai-content-answers",
3
- "version": "0.67.1",
3
+ "version": "0.68.0",
4
4
  "peerDependencies": {
5
5
  "@box/blueprint-web": "^7.8.0",
6
6
  "@box/blueprint-web-assets": "^4.16.0",
@@ -14,9 +14,9 @@
14
14
  "remarkable": "^2.0.1"
15
15
  },
16
16
  "devDependencies": {
17
- "@box/blueprint-web": "^8.8.1",
17
+ "@box/blueprint-web": "^9.0.0",
18
18
  "@box/blueprint-web-assets": "^4.30.0",
19
- "@box/box-ai-agent-selector": "^0.16.1",
19
+ "@box/box-ai-agent-selector": "^0.17.0",
20
20
  "@box/storybook-utils": "^0.7.0",
21
21
  "@testing-library/react": "^15.0.6",
22
22
  "react": "^18.3.0",
@@ -54,5 +54,5 @@
54
54
  "**/*.css"
55
55
  ],
56
56
  "license": "SEE LICENSE IN LICENSE",
57
- "gitHead": "84b0da3b7df701ce396ed038ab4297e2da27d64f"
57
+ "gitHead": "8371b326ea09e2a07955fb57e63e15e9b14abc4c"
58
58
  }