@box/box-ai-content-answers 0.155.0 → 0.156.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.
Files changed (44) hide show
  1. package/dist/esm/lib/components/api-wrapper/hooks/useContentAnswers.js +113 -109
  2. package/dist/esm/lib/components/api-wrapper/records.js +10 -8
  3. package/dist/esm/lib/components/api-wrapper/utils/stream.js +27 -27
  4. package/dist/esm/lib/components/chat/chat.js +90 -84
  5. package/dist/esm/lib/components/thinkingBubble/boxAILoadingIndicator.js +235 -0
  6. package/dist/esm/lib/components/thinkingBubble/messages.js +26 -0
  7. package/dist/esm/lib/components/thinkingBubble/thinkingBubble.js +122 -0
  8. package/dist/i18n/bn-IN.js +5 -0
  9. package/dist/i18n/da-DK.js +5 -0
  10. package/dist/i18n/de-DE.js +5 -0
  11. package/dist/i18n/en-AU.js +5 -0
  12. package/dist/i18n/en-CA.js +5 -0
  13. package/dist/i18n/en-GB.js +5 -0
  14. package/dist/i18n/en-US.js +5 -0
  15. package/dist/i18n/en-US.properties +10 -0
  16. package/dist/i18n/en-x-pseudo.js +5 -0
  17. package/dist/i18n/es-419.js +5 -0
  18. package/dist/i18n/es-ES.js +5 -0
  19. package/dist/i18n/fi-FI.js +5 -0
  20. package/dist/i18n/fr-CA.js +5 -0
  21. package/dist/i18n/fr-FR.js +5 -0
  22. package/dist/i18n/hi-IN.js +5 -0
  23. package/dist/i18n/it-IT.js +5 -0
  24. package/dist/i18n/ja-JP.js +5 -0
  25. package/dist/i18n/json/src/lib/components/thinkingBubble/messages.json +1 -0
  26. package/dist/i18n/ko-KR.js +5 -0
  27. package/dist/i18n/nb-NO.js +5 -0
  28. package/dist/i18n/nl-NL.js +5 -0
  29. package/dist/i18n/pl-PL.js +5 -0
  30. package/dist/i18n/pt-BR.js +5 -0
  31. package/dist/i18n/ru-RU.js +5 -0
  32. package/dist/i18n/sv-SE.js +5 -0
  33. package/dist/i18n/tr-TR.js +5 -0
  34. package/dist/i18n/zh-CN.js +5 -0
  35. package/dist/i18n/zh-TW.js +5 -0
  36. package/dist/styles/boxAILoadingIndicator.css +1 -0
  37. package/dist/styles/thinkingBubble.css +1 -0
  38. package/dist/types/lib/components/api-wrapper/records.d.ts +1 -0
  39. package/dist/types/lib/components/api-wrapper/types.d.ts +1 -0
  40. package/dist/types/lib/components/thinkingBubble/boxAILoadingIndicator.d.ts +3 -0
  41. package/dist/types/lib/components/thinkingBubble/messages.d.ts +28 -0
  42. package/dist/types/lib/components/thinkingBubble/thinkingBubble.d.ts +26 -0
  43. package/dist/types/lib/types.d.ts +1 -0
  44. package/package.json +1 -1
@@ -1,37 +1,37 @@
1
- import { useAgentsDispatch as as, ACTIONS as ns } from "@box/box-ai-agent-selector";
1
+ import { useAgentsDispatch as as, ACTIONS as is } from "@box/box-ai-agent-selector";
2
2
  import us from "lodash/camelCase";
3
- import t, { useMemo as is, useCallback as cs } from "react";
4
- import { A as R, C as Es, R as V } from "../../../../../chunks/types.js";
5
- import { SET_NEW_ITEM as fs, UPDATE_QUESTION as rs, SET_MODAL_ERROR as Cs, SET_MODAL_SUCCESS as _s, SET_IS_LOADING as X, SET_ANSWER_FEEDBACK as Ts, CLEAR_CONVERSATION_HISTORY as Rs, SET_SUGGESTED_QUESTIONS_REQUEST_STATE as Y, SET_SUGGESTED_QUESTIONS as ds } from "../actions.js";
6
- import { QuestionRecord as Ns } from "../records.js";
7
- import { defaultFormatSuggestions as Os, defaultFormatCitations as ys } from "../utils/format.js";
8
- import { getAnswerRequest as Ss } from "../utils/request.js";
3
+ import t, { useMemo as cs, useCallback as Es } from "react";
4
+ import { A as T, C as fs, R as V } from "../../../../../chunks/types.js";
5
+ import { SET_NEW_ITEM as rs, UPDATE_QUESTION as Cs, SET_MODAL_ERROR as _s, SET_MODAL_SUCCESS as Ts, SET_IS_LOADING as X, SET_ANSWER_FEEDBACK as Rs, CLEAR_CONVERSATION_HISTORY as ds, SET_SUGGESTED_QUESTIONS_REQUEST_STATE as Y, SET_SUGGESTED_QUESTIONS as Ns } from "../actions.js";
6
+ import { QuestionRecord as Os } from "../records.js";
7
+ import { defaultFormatSuggestions as ys, defaultFormatCitations as Ss } from "../utils/format.js";
8
+ import { getAnswerRequest as As } from "../utils/request.js";
9
9
  import F from "../utils/stream.js";
10
10
  const Ls = /Too Many Requests/i, z = "Agent not found";
11
- function Ms({
12
- contentAnswers: n,
13
- createSessionRequest: O,
11
+ function Fs({
12
+ contentAnswers: a,
13
+ createSessionRequest: y,
14
14
  dispatchStateUpdate: o,
15
15
  enterpriseId: D,
16
- fetchTimeout: k,
17
- formatCitations: v = ys,
16
+ fetchTimeout: m,
17
+ formatCitations: v = Ss,
18
18
  getAnswerStreaming: j,
19
19
  getAnswer: x,
20
20
  getSuggestedQuestions: I,
21
21
  isStopResponseEnabled: K,
22
- isStreamingEnabled: S,
22
+ isStreamingEnabled: A,
23
23
  itemID: E,
24
- items: i,
24
+ items: u,
25
25
  onSuggestedQuestionsFetched: P,
26
- sendErrorLog: G,
27
- shouldPreinitSession: d = !0,
26
+ sendErrorLog: g,
27
+ shouldPreinitSession: N = !0,
28
28
  userId: W
29
29
  }) {
30
- const y = t.useRef(null), $ = as(), L = is(() => Array.isArray(i) && i.length > 1, [i]), B = cs((s) => Array.isArray(s) ? v(s) : null, [v]);
30
+ const S = t.useRef(null), $ = as(), L = cs(() => Array.isArray(u) && u.length > 1, [u]), B = Es((s) => Array.isArray(s) ? v(s) : null, [v]);
31
31
  t.useEffect(
32
32
  (s) => {
33
- E && E !== n.item.id && o({
34
- type: fs,
33
+ E && E !== a.item.id && o({
34
+ type: rs,
35
35
  itemID: E,
36
36
  fileVersionID: s
37
37
  });
@@ -41,109 +41,113 @@ function Ms({
41
41
  );
42
42
  const c = t.useCallback((s, e) => {
43
43
  o({
44
- type: rs,
44
+ type: Cs,
45
45
  newQuestion: s,
46
46
  session: e
47
- }), y.current = s;
47
+ }), S.current = s;
48
48
  }, [o]), H = t.useCallback((s) => {
49
49
  o({
50
- type: Cs,
50
+ type: _s,
51
51
  error: s
52
52
  });
53
- }, [o]), Q = t.useCallback((s, e, a) => {
53
+ }, [o]), G = t.useCallback((s, e, l) => {
54
54
  const {
55
- answer: u,
56
- error: f,
57
- citations: l = [],
58
- createdAt: r = null,
55
+ answer: i,
56
+ thinkingAnswer: f,
57
+ error: n,
58
+ citations: r = [],
59
+ createdAt: R = null,
59
60
  encodedSession: C = void 0,
60
- contextSession: _ = void 0
61
- } = s, N = e.set("citations", B(l)).merge({
62
- answer: u,
63
- error: f,
64
- created_at: r,
61
+ contextSession: d = void 0
62
+ } = s, O = e.set("citations", B(r)).merge({
63
+ answer: i,
64
+ thinkingAnswer: f,
65
+ error: n,
66
+ created_at: R,
65
67
  isLoading: !1,
66
- isCompleted: a
68
+ isCompleted: l
67
69
  });
68
- let T;
69
- C && (T = {
70
+ let _;
71
+ C && (_ = {
70
72
  encodedSession: C
71
- }), _ && (T = {
72
- contextSession: _
73
- }), c(N, T);
74
- }, [c, B]), g = t.useCallback(
73
+ }), d && (_ = {
74
+ contextSession: d
75
+ }), c(O, _);
76
+ }, [c, B]), Q = t.useCallback(
75
77
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
78
  (s, e) => {
77
- var N, T, m;
78
- const a = (s == null ? void 0 : s.message) || "", u = ((N = s == null ? void 0 : s.response) == null ? void 0 : N.status) === 429 || Ls.test(a), f = (s == null ? void 0 : s.code) === z || (s == null ? void 0 : s.errorCode) === z, l = ((T = s == null ? void 0 : s.response) == null ? void 0 : T.status) === 204, r = ((m = s == null ? void 0 : s.response) == null ? void 0 : m.status) === 412, C = l ? R.NO_CONTENT : u ? R.RATE_LIMITING : r ? R.PRECONDITION_FAILED : f ? R.AGENT_NOT_FOUND : R.GENERAL, _ = e.merge({
79
- error: C,
79
+ var d, O, _;
80
+ const l = (s == null ? void 0 : s.message) || "", i = ((d = s == null ? void 0 : s.response) == null ? void 0 : d.status) === 429 || Ls.test(l), f = (s == null ? void 0 : s.code) === z || (s == null ? void 0 : s.errorCode) === z, n = ((O = s == null ? void 0 : s.response) == null ? void 0 : O.status) === 204, r = ((_ = s == null ? void 0 : s.response) == null ? void 0 : _.status) === 412, R = n ? T.NO_CONTENT : i ? T.RATE_LIMITING : r ? T.PRECONDITION_FAILED : f ? T.AGENT_NOT_FOUND : T.GENERAL, C = e.merge({
81
+ error: R,
80
82
  isLoading: !1,
81
83
  isCompleted: !0
82
84
  });
83
- c(_, void 0);
85
+ c(C, void 0);
84
86
  },
85
87
  [c]
86
- ), A = t.useCallback(async (s, e) => {
88
+ ), b = t.useCallback(async (s, e) => {
87
89
  try {
88
- const a = {
90
+ const l = {
89
91
  prompt: s.prompt,
90
92
  aiAgent: e || void 0,
91
93
  userId: W,
92
94
  enterpriseId: D
93
- }, u = `content-answers-${s.id}`;
95
+ }, i = `content-answers-${s.id}`;
94
96
  let f;
95
- S && (f = F.createAbortRequest(u));
96
- const l = await Ss(a, S, u, E, i, n, x, j, f, k, G);
97
- S ? F.receiveStreamedResponse(u, l, (r) => {
97
+ A && (f = F.createAbortRequest(i));
98
+ const n = await As(l, A, i, E, u, a, x, j, f, m, g);
99
+ A ? F.receiveStreamedResponse(i, n, (r) => {
98
100
  const {
99
- code: C,
100
- data: _,
101
- error: N,
102
- citations: T,
103
- contextSession: m,
101
+ code: R,
102
+ data: C,
103
+ error: d,
104
+ citations: O,
105
+ contextSession: _,
104
106
  isCompleted: os,
105
- createdAt: ts
107
+ createdAt: ts,
108
+ thinkingAnswer: ns
106
109
  } = r, ls = {
107
- answer: _,
108
- citations: T,
109
- error: N,
110
- contextSession: m,
110
+ thinkingAnswer: ns,
111
+ answer: C,
112
+ citations: O,
113
+ error: d,
114
+ contextSession: _,
111
115
  createdAt: ts
112
116
  };
113
- l.ok && l.status === 200 ? Q({
117
+ n.ok && n.status === 200 ? G({
114
118
  ...ls
115
- }, s, os) : g({
116
- response: l,
117
- code: C
119
+ }, s, os) : Q({
120
+ response: n,
121
+ code: R
118
122
  }, s);
119
- }, void 0, k, G) : (Object.entries(l).forEach(([r, C]) => {
120
- const _ = us(r);
121
- delete l[r], l[_] = C;
122
- }), Q(l, s, !0));
123
- } catch (a) {
124
- if (K && a instanceof Error && a.name === "AbortError") {
125
- const u = s.set("error", []).merge({
126
- error: R.RESPONSE_STOPPED,
123
+ }, void 0, m, g) : (Object.entries(n).forEach(([r, R]) => {
124
+ const C = us(r);
125
+ delete n[r], n[C] = R;
126
+ }), G(n, s, !0));
127
+ } catch (l) {
128
+ if (K && l instanceof Error && l.name === "AbortError") {
129
+ const i = s.set("error", []).merge({
130
+ error: T.RESPONSE_STOPPED,
127
131
  isLoading: !1,
128
132
  isCompleted: !0
129
133
  });
130
- c(u);
134
+ c(i);
131
135
  } else
132
- g(a, s);
136
+ Q(l, s);
133
137
  }
134
- }, [W, D, S, E, i, n, x, j, k, G, Q, g, K, c]), J = t.useCallback((s) => {
138
+ }, [W, D, A, E, u, a, x, j, m, g, G, Q, K, c]), J = t.useCallback((s) => {
135
139
  const {
136
140
  encoded_session: e,
137
141
  metadata: {
138
- is_large_file: a
142
+ is_large_file: l
139
143
  } = {
140
144
  is_large_file: !1
141
145
  }
142
146
  } = s;
143
147
  o({
144
- type: _s,
148
+ type: Ts,
145
149
  encodedSession: e,
146
- isLargeFile: a
150
+ isLargeFile: l
147
151
  });
148
152
  }, [o]), p = t.useCallback(async (s = !0, e = !0) => {
149
153
  try {
@@ -151,36 +155,36 @@ function Ms({
151
155
  type: X,
152
156
  isLoading: !0
153
157
  });
154
- const a = await O({
155
- items: i
158
+ const l = await y({
159
+ items: u
156
160
  }, E);
157
- J(a);
161
+ J(l);
158
162
  } catch {
159
- if (e && H(Es.GENERAL), !d && (o({
163
+ if (e && H(fs.GENERAL), !N && (o({
160
164
  type: X,
161
165
  isLoading: !1
162
- }), y.current)) {
163
- const u = y.current.set("error", R.GENERAL).merge({
166
+ }), S.current)) {
167
+ const i = S.current.set("error", T.GENERAL).merge({
164
168
  isLoading: !1,
165
169
  isCompleted: !0
166
170
  });
167
- c(u);
171
+ c(i);
168
172
  }
169
173
  }
170
- }, [O, i, E, J, o, d, H, c]), M = t.useCallback((s, e, a = !0) => {
171
- const u = !n.isLoading && !n.encodedSession && !L && O, f = (n == null ? void 0 : n.questions) || [];
172
- a && (s.id = `${f.length}`), !d && u && (s.error = R.GENERAL, s.isLoading = !1, s.isCompleted = !0);
173
- const l = new Ns(s);
174
- return c(l), d || n.encodedSession ? A(l, e) : !n.isLoading && !d && O && p(!0, !1), l;
175
- }, [n.encodedSession, n.isLoading, n == null ? void 0 : n.questions, p, O, L, A, d, c]), Z = t.useCallback((s, e) => {
174
+ }, [y, u, E, J, o, N, H, c]), M = t.useCallback((s, e, l = !0) => {
175
+ const i = !a.isLoading && !a.encodedSession && !L && y, f = (a == null ? void 0 : a.questions) || [];
176
+ l && (s.id = `${f.length}`), !N && i && (s.error = T.GENERAL, s.isLoading = !1, s.isCompleted = !0);
177
+ const n = new Os(s);
178
+ return c(n), N || a.encodedSession ? b(n, e) : !a.isLoading && !N && y && p(!0, !1), n;
179
+ }, [a.encodedSession, a.isLoading, a == null ? void 0 : a.questions, p, y, L, b, N, c]), Z = t.useCallback((s, e) => {
176
180
  o({
177
- type: Ts,
181
+ type: Rs,
178
182
  questionId: s,
179
183
  feedbackValue: e
180
184
  });
181
185
  }, [o]), q = t.useCallback(() => {
182
186
  o({
183
- type: Rs
187
+ type: ds
184
188
  });
185
189
  }, [o]), w = t.useCallback(async (s, e) => {
186
190
  M({
@@ -190,32 +194,32 @@ function Ms({
190
194
  isCompleted: !1,
191
195
  error: null
192
196
  }, e, !1);
193
- }, [M]), U = t.useCallback((s) => {
197
+ }, [M]), h = t.useCallback((s) => {
194
198
  let e;
195
- s ? e = s.id : y.current && (e = y.current.id), e && F.abortRequest(`content-answers-${e}`, !0);
196
- }, []), h = t.useCallback(async (s) => {
199
+ s ? e = s.id : S.current && (e = S.current.id), e && F.abortRequest(`content-answers-${e}`, !0);
200
+ }, []), U = t.useCallback(async (s) => {
197
201
  s && $({
198
- type: ns.SET_ASK_CONFIG,
202
+ type: is.SET_ASK_CONFIG,
199
203
  id: s.id,
200
204
  ask: s == null ? void 0 : s.ask
201
205
  });
202
- }, [$]), [b, ss] = t.useState("");
206
+ }, [$]), [k, ss] = t.useState("");
203
207
  t.useEffect(() => {
204
- if (!i || i.length === 0)
208
+ if (!u || u.length === 0)
205
209
  return;
206
- const s = i.map((e) => e.id).join(",");
207
- s !== b && ss(s);
208
- }, [i, b]);
210
+ const s = u.map((e) => e.id).join(",");
211
+ s !== k && ss(s);
212
+ }, [u, k]);
209
213
  const es = t.useCallback(async () => {
210
- if (!(!b || !I || L)) {
214
+ if (!(!k || !I || L)) {
211
215
  o({
212
216
  type: Y,
213
217
  requestState: V.IN_PROGRESS
214
218
  });
215
219
  try {
216
- const s = Os(await I(E, i));
220
+ const s = ys(await I(E, u));
217
221
  P && P(s), o({
218
- type: ds,
222
+ type: Ns,
219
223
  suggestedQuestions: s
220
224
  });
221
225
  } catch {
@@ -225,20 +229,20 @@ function Ms({
225
229
  });
226
230
  }
227
231
  }
228
- }, [o, I, L, E, b]);
232
+ }, [o, I, L, E, k]);
229
233
  return {
230
234
  clearConversation: q,
231
235
  createSession: p,
232
- fetchAgentConfig: h,
236
+ fetchAgentConfig: U,
233
237
  fetchSuggestedQuestions: es,
234
238
  retryQuestion: w,
235
239
  sendQuestion: M,
236
- sendQuestionAnswerRequest: A,
240
+ sendQuestionAnswerRequest: b,
237
241
  setAnswerFeedback: Z,
238
- stopQuestion: U,
242
+ stopQuestion: h,
239
243
  updateQuestionInState: c
240
244
  };
241
245
  }
242
246
  export {
243
- Ms as useContentAnswers
247
+ Fs as useContentAnswers
244
248
  };
@@ -1,16 +1,17 @@
1
1
  import { Record as e } from "immutable";
2
- import { R as s, U as n } from "../../../../chunks/types.js";
2
+ import { R as n, U as s } from "../../../../chunks/types.js";
3
3
  const o = e({
4
4
  has_streamed_responses: !0,
5
- has_citations_enabled: !1
5
+ has_citations_enabled: !1,
6
+ has_thinking_enabled: !1
6
7
  }), t = e({
7
8
  type: "file",
8
9
  id: null,
9
10
  version_id: null
10
11
  }), r = e({
11
12
  suggestions: [],
12
- requestState: s.NOT_STARTED
13
- }), u = e({
13
+ requestState: n.NOT_STARTED
14
+ }), a = e({
14
15
  config: new o(),
15
16
  encodedSession: null,
16
17
  contextSession: null,
@@ -21,22 +22,23 @@ const o = e({
21
22
  questions: [],
22
23
  shouldShowLandingPage: !0,
23
24
  suggestedQuestions: new r()
24
- }), a = e({
25
+ }), u = e({
25
26
  answer: null,
26
27
  citations: [],
27
28
  created_at: null,
28
29
  id: null,
29
30
  isCompleted: !1,
31
+ thinkingAnswer: null,
30
32
  isLoading: !0,
31
33
  error: null,
32
34
  prompt: null,
33
35
  feedbackValue: "none",
34
- promptType: n
36
+ promptType: s
35
37
  });
36
38
  export {
37
39
  o as ContentAnswersConfigRecord,
38
40
  t as ContentAnswersItemRecord,
39
- u as ContentAnswersRecord,
40
- a as QuestionRecord,
41
+ a as ContentAnswersRecord,
42
+ u as QuestionRecord,
41
43
  r as SuggestedQuestionsRecord
42
44
  };
@@ -1,14 +1,14 @@
1
1
  import b from "lodash/camelCase";
2
- import { A as h } from "../../../../../chunks/types.js";
2
+ import { A as s } from "../../../../../chunks/types.js";
3
3
  const d = {
4
4
  chunk: 15 * 1e3,
5
5
  // fetch timeout for each chunk. We need to abort the fetch if needed.
6
6
  initial: 45 * 1e3
7
7
  // latency p99 (30s) + buffer. Other host integrations can override this value.
8
8
  }, N = {
9
- RESPONSE_FAILED: h.RESPONSE_FAILED,
10
- RESPONSE_INTERRUPTED: h.RESPONSE_INTERRUPTED,
11
- RESPONSE_STOPPED: h.RESPONSE_STOPPED
9
+ RESPONSE_FAILED: s.RESPONSE_FAILED,
10
+ RESPONSE_INTERRUPTED: s.RESPONSE_INTERRUPTED,
11
+ RESPONSE_STOPPED: s.RESPONSE_STOPPED
12
12
  }, O = {
13
13
  CONTINUE: "continue",
14
14
  DONE: "done",
@@ -32,31 +32,31 @@ class T {
32
32
  }
33
33
  // eslint-disable-next-line class-methods-use-this
34
34
  parseNDJSON(r, i, t) {
35
- const e = new TextDecoder().decode(i), o = r.partialData + e, a = /\r?\n/, n = o.trim().split(a);
35
+ const n = new TextDecoder().decode(i), o = r.partialData + n, a = /\r?\n/, e = o.trim().split(a);
36
36
  r.partialData = o.endsWith(`
37
- `) || o.endsWith("}") ? "" : n.pop() || "";
37
+ `) || o.endsWith("}") ? "" : e.pop() || "";
38
38
  let E = "";
39
- n.forEach((c) => {
40
- const l = JSON.parse(c);
41
- l[t] && (E += l[t]), Object.entries(l).forEach(([u, s]) => {
39
+ e.forEach((h) => {
40
+ const l = JSON.parse(h);
41
+ l[t] && (E += l[t]), l.thinking_answer && (r.thinkingAnswer || (r.thinkingAnswer = ""), r.thinkingAnswer += l.thinking_answer), Object.entries(l).forEach(([u, c]) => {
42
42
  const C = b(u);
43
- C !== t && (r[C] = s);
43
+ C !== t && C !== "thinkingAnswer" && (r[C] = c);
44
44
  });
45
45
  }), r.data += E;
46
46
  }
47
- receiveStreamedResponse(r, i, t, e = "answer", o, a) {
47
+ receiveStreamedResponse(r, i, t, n = "answer", o, a) {
48
48
  var u;
49
- const n = this.initializeStreamedResponseState(), E = (u = i.body) == null ? void 0 : u.getReader();
49
+ const e = this.initializeStreamedResponseState(), E = (u = i.body) == null ? void 0 : u.getReader();
50
50
  if (this.chunkTimeout = (o == null ? void 0 : o.chunk) || d.chunk, !E) {
51
- this.handleNoResponseBody(t, n);
51
+ this.handleNoResponseBody(t, e);
52
52
  return;
53
53
  }
54
- let c;
54
+ let h;
55
55
  const l = () => {
56
- E.read().then((s) => {
57
- this.handleChunkSuccess(c, t, s, r, n, e), s.done || (c = this.setChunkTimeout(r, a), l());
58
- }).catch((s) => {
59
- this.handleChunkError(c, t, r, n);
56
+ E.read().then((c) => {
57
+ this.handleChunkSuccess(h, t, c, r, e, n), c.done || (h = this.setChunkTimeout(r, a), l());
58
+ }).catch((c) => {
59
+ this.handleChunkError(h, t, r, e);
60
60
  });
61
61
  };
62
62
  l();
@@ -73,23 +73,23 @@ class T {
73
73
  partialData: ""
74
74
  };
75
75
  }
76
- handleChunkSuccess(r, i, t, e, o, a) {
76
+ handleChunkSuccess(r, i, t, n, o, a) {
77
77
  if (!t)
78
78
  return;
79
79
  clearTimeout(r);
80
80
  const {
81
- completionReason: n
81
+ completionReason: e
82
82
  } = o;
83
- o.isCompleted = t.done || n !== null, t.value && this.parseNDJSON(o, t.value, a), o.isCompleted && (this.removeAbortController(e), n !== O.DONE && (o.data ? o.error = n === O.CONTINUE ? N.RESPONSE_INTERRUPTED : N.RESPONSE_FAILED : o.error = h.NO_CONTENT)), i(o);
83
+ o.isCompleted = t.done || e !== null, t.value && this.parseNDJSON(o, t.value, a), o.isCompleted && (this.removeAbortController(n), e !== O.DONE && (o.data ? o.error = e === O.CONTINUE ? N.RESPONSE_INTERRUPTED : N.RESPONSE_FAILED : o.error = s.NO_CONTENT)), i(o);
84
84
  }
85
- handleChunkError(r, i, t, e) {
86
- e.error = N.RESPONSE_FAILED;
85
+ handleChunkError(r, i, t, n) {
86
+ n.error = N.RESPONSE_FAILED;
87
87
  const o = this.abortControllerMap.get(t);
88
- o && o.isUserInitiatedAbort && (e.error = N.RESPONSE_STOPPED, e.isAborted = o.isUserInitiatedAbort), e.isCompleted = !0, this.removeAbortController(t), clearTimeout(r), i(e);
88
+ o && o.isUserInitiatedAbort && (n.error = N.RESPONSE_STOPPED, n.isAborted = o.isUserInitiatedAbort), n.isCompleted = !0, this.removeAbortController(t), clearTimeout(r), i(n);
89
89
  }
90
90
  // eslint-disable-next-line class-methods-use-this
91
91
  handleNoResponseBody(r, i) {
92
- i.error = h.NO_CONTENT, i.isCompleted = !0, r(i);
92
+ i.error = s.NO_CONTENT, i.isCompleted = !0, r(i);
93
93
  }
94
94
  removeAbortController(r) {
95
95
  this.abortControllerMap.delete(r);
@@ -104,10 +104,10 @@ class T {
104
104
  }, this.chunkTimeout);
105
105
  }
106
106
  }
107
- const k = new T();
107
+ const f = new T();
108
108
  export {
109
109
  d as FETCH_TIMEOUT,
110
110
  O as STREAMING_COMPLETION_REASON,
111
111
  N as STREAM_ERROR,
112
- k as default
112
+ f as default
113
113
  };