@iblai/web-utils 1.11.6 → 1.11.8

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.
@@ -6,7 +6,7 @@ type GetReportsArgs = {
6
6
  type GetReportDetailArgs = {
7
7
  key: string;
8
8
  reportName: string;
9
- mentorUniqueId?: string;
9
+ mentor_unique_id?: string;
10
10
  };
11
11
  type CreateReportArgs = {
12
12
  key: string;
package/dist/index.esm.js CHANGED
@@ -10422,7 +10422,8 @@ function MentorProvider({ children, fallback, onAuthSuccess, onAuthFailure, redi
10422
10422
  console.log("[determineMentorToRedirectTo] starredMentors ", starredMentors);
10423
10423
  if (starredMentors && starredMentors.length > 0) {
10424
10424
  const starredMentor = starredMentors[0];
10425
- if (starredMentor === null || starredMentor === void 0 ? void 0 : starredMentor.unique_id) {
10425
+ // @ts-expect-error - mentor is not part of the starred mentor object
10426
+ if ((starredMentor === null || starredMentor === void 0 ? void 0 : starredMentor.unique_id) || (starredMentor === null || starredMentor === void 0 ? void 0 : starredMentor.mentor)) {
10426
10427
  return starredMentor;
10427
10428
  }
10428
10429
  }
@@ -14478,6 +14479,7 @@ function useAdvancedChat({ tenantKey, mentorId, username = ANONYMOUS_USERNAME, t
14478
14479
  // `addUserMessage`) between the two `getChats` resolutions.
14479
14480
  const startNewChatInFlightRef = React__default.useRef(false);
14480
14481
  const startNewChat = React__default.useCallback(async () => {
14482
+ var _a, _b, _c;
14481
14483
  // Reset all chat state
14482
14484
  if (!showingSharedChat) {
14483
14485
  dispatch(chatActions.resetChats(undefined));
@@ -14510,6 +14512,10 @@ function useAdvancedChat({ tenantKey, mentorId, username = ANONYMOUS_USERNAME, t
14510
14512
  requestBody,
14511
14513
  }).unwrap();
14512
14514
  dispatch(chatActions.updateSessionIds(response.session_id));
14515
+ // The backend is the source of truth for which tools/artifacts are
14516
+ // enabled by default; seed the UI toggles from the create-session response.
14517
+ dispatch(chatActions.setTools((_b = (_a = response.tools) === null || _a === void 0 ? void 0 : _a.map((t) => t.slug).filter(Boolean)) !== null && _b !== void 0 ? _b : []));
14518
+ dispatch(chatActions.setArtifactsEnabled((_c = response.enable_artifacts) !== null && _c !== void 0 ? _c : false));
14513
14519
  onStartNewChat === null || onStartNewChat === void 0 ? void 0 : onStartNewChat(response.session_id);
14514
14520
  }
14515
14521
  catch (error) {
@@ -14629,7 +14635,7 @@ function useAdvancedChat({ tenantKey, mentorId, username = ANONYMOUS_USERNAME, t
14629
14635
  sendMessage,
14630
14636
  ]);
14631
14637
  async function changeTab(tab) {
14632
- var _a, _b, _c, _d;
14638
+ var _a, _b, _c, _d, _e, _f, _g;
14633
14639
  // while responding to a message, do not change the tab
14634
14640
  if (streaming) {
14635
14641
  errorHandler === null || errorHandler === void 0 ? void 0 : errorHandler("Cannot change tab while streaming");
@@ -14658,14 +14664,18 @@ function useAdvancedChat({ tenantKey, mentorId, username = ANONYMOUS_USERNAME, t
14658
14664
  requestBody,
14659
14665
  }).unwrap();
14660
14666
  dispatch(chatActions.updateSessionIds(response.session_id));
14667
+ // The backend is the source of truth for which tools/artifacts are
14668
+ // enabled by default; seed the UI toggles from the create-session response.
14669
+ dispatch(chatActions.setTools((_b = (_a = response.tools) === null || _a === void 0 ? void 0 : _a.map((t) => t.slug).filter(Boolean)) !== null && _b !== void 0 ? _b : []));
14670
+ dispatch(chatActions.setArtifactsEnabled((_c = response.enable_artifacts) !== null && _c !== void 0 ? _c : false));
14661
14671
  // if the tab we are going to activate has no session Id (this is the first time we are creating the session for this tag)
14662
14672
  // we need to send a proactive prompt if the advanced tabs properties has no tag.
14663
14673
  // (presence of tag indicates an ACTIONABLE UI)
14664
- if (!((_a = advancedTabsProperties[tab]) === null || _a === void 0 ? void 0 : _a.tag)) {
14665
- for (const prompt of (_c = (_b = advancedTabsProperties[tab]) === null || _b === void 0 ? void 0 : _b.prompts) !== null && _c !== void 0 ? _c : []) {
14674
+ if (!((_d = advancedTabsProperties[tab]) === null || _d === void 0 ? void 0 : _d.tag)) {
14675
+ for (const prompt of (_f = (_e = advancedTabsProperties[tab]) === null || _e === void 0 ? void 0 : _e.prompts) !== null && _f !== void 0 ? _f : []) {
14666
14676
  // @ts-expect-error - Type mismatch
14667
14677
  if (prompt.type === "human" && (prompt === null || prompt === void 0 ? void 0 : prompt.proactive)) {
14668
- sendMessage(tab, (_d = prompt.content) !== null && _d !== void 0 ? _d : "", { visible: false });
14678
+ sendMessage(tab, (_g = prompt.content) !== null && _g !== void 0 ? _g : "", { visible: false });
14669
14679
  }
14670
14680
  }
14671
14681
  }