box-ui-elements 23.4.0-beta.7 → 23.4.0-beta.9

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,4 +1,4 @@
1
- const _excluded = ["cache", "contentName", "elementId", "fileExtension", "fileID", "getSuggestedQuestions", "isIntelligentQueryMode", "isFeedbackEnabled", "isFeedbackFormEnabled", "isStopResponseEnabled", "items", "itemSize", "localizedQuestions", "onFeedbackFormSubmit", "onUserInteraction", "recordAction", "setCacheValue", "shouldFeedbackFormIncludeFeedbackText", "shouldPreinitSession", "setHasQuestions"];
1
+ const _excluded = ["cache", "contentName", "elementId", "fileExtension", "fileID", "getSuggestedQuestions", "isIntelligentQueryMode", "isFeedbackEnabled", "isFeedbackFormEnabled", "isStopResponseEnabled", "items", "itemSize", "localizedQuestions", "onFeedbackFormSubmit", "onUserInteraction", "recordAction", "renderRemoteModule", "setCacheValue", "shouldFeedbackFormIncludeFeedbackText", "shouldPreinitSession", "setHasQuestions"];
2
2
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
3
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
4
4
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
@@ -31,6 +31,7 @@ const BoxAISidebar = props => {
31
31
  onFeedbackFormSubmit,
32
32
  onUserInteraction,
33
33
  recordAction,
34
+ renderRemoteModule,
34
35
  setCacheValue,
35
36
  shouldFeedbackFormIncludeFeedbackText,
36
37
  shouldPreinitSession = true,
@@ -65,6 +66,9 @@ const BoxAISidebar = props => {
65
66
  setHasQuestions(questions.length > 0);
66
67
  }
67
68
  }, [questions.length, setHasQuestions]);
69
+ if (renderRemoteModule) {
70
+ return renderRemoteModule(elementId);
71
+ }
68
72
  let questionsWithoutInProgress = questions;
69
73
  if (questions.length > 0 && !questions[questions.length - 1].isCompleted) {
70
74
  // pass only fully completed questions to not show loading indicator of question where we canceled API request
@@ -1 +1 @@
1
- {"version":3,"file":"BoxAISidebar.js","names":["React","useIntl","AgentsProvider","BoxAISidebarContent","BoxAISidebarContext","SPREADSHEET_FILE_EXTENSIONS","messages","BoxAISidebar","props","cache","contentName","elementId","fileExtension","fileID","getSuggestedQuestions","isIntelligentQueryMode","isFeedbackEnabled","isFeedbackFormEnabled","isStopResponseEnabled","items","itemSize","localizedQuestions","onFeedbackFormSubmit","onUserInteraction","recordAction","setCacheValue","shouldFeedbackFormIncludeFeedbackText","shouldPreinitSession","setHasQuestions","rest","_objectWithoutProperties","_excluded","questions","formatMessage","contextValue","useMemo","useEffect","length","questionsWithoutInProgress","isCompleted","slice","isSpreadsheet","includes","spreadsheetNotice","welcomeMessageSpreadsheetNotice","welcomeMessageIntelligentQueryNotice","handleSuggestedQuestionsFetched","fetchedSuggestedQuestions","suggestedQuestions","createElement","value","agents","Provider","_extends","cachedSuggestedQuestions","isOpen","itemID","itemIDs","onSuggestedQuestionsFetched","restoredQuestions","restoredSession","encodedSession","restoredShouldShowLandingPage","shouldShowLandingPage","warningNotice","warningNoticeAriaLabel","welcomeMessageSpreadsheetNoticeAriaLabel"],"sources":["../../../src/elements/content-sidebar/BoxAISidebar.tsx"],"sourcesContent":["/**\n * @file Box AI Sidebar Container\n * @author Box\n */\nimport * as React from 'react';\nimport { useIntl } from 'react-intl';\nimport { type FeedbackFormData, type ItemType, SuggestedQuestionType } from '@box/box-ai-content-answers';\nimport { AgentsProvider, RecordActionType } from '@box/box-ai-agent-selector';\nimport BoxAISidebarContent from './BoxAISidebarContent';\nimport { BoxAISidebarContext } from './context/BoxAISidebarContext';\nimport { SPREADSHEET_FILE_EXTENSIONS } from '../common/content-answers/constants';\nimport type { BoxAISidebarCache, BoxAISidebarCacheSetter } from './types/BoxAISidebarTypes';\n\nimport messages from '../common/content-answers/messages';\n\nexport interface BoxAISidebarProps {\n contentName: string;\n cache: BoxAISidebarCache;\n createSessionRequest: (payload: Record<string, unknown>, itemID: string) => Promise<unknown>;\n elementId: string;\n fetchTimeout: Record<string, unknown>;\n fileExtension: string;\n fileID: string;\n getAgentConfig: (payload: Record<string, unknown>) => Promise<unknown>;\n getAIStudioAgents: () => Promise<unknown>;\n getAnswer: (\n payload: Record<string, unknown>,\n itemID?: string,\n itemIDs?: Array<string>,\n state?: Record<string, unknown>,\n ) => Promise<unknown>;\n getAnswerStreaming: (\n payload: Record<string, unknown>,\n itemID?: string,\n itemIDs?: Array<string>,\n abortController?: AbortController,\n state?: Record<string, unknown>,\n ) => Promise<unknown>;\n getSuggestedQuestions: (itemID: string) => Promise<unknown> | null;\n hostAppName: string;\n isAgentSelectorEnabled: boolean;\n isAIStudioAgentSelectorEnabled: boolean;\n isCitationsEnabled: boolean;\n isDebugModeEnabled: boolean;\n isFeedbackEnabled: boolean;\n isFeedbackFormEnabled: boolean;\n isIntelligentQueryMode: boolean;\n isMarkdownEnabled: boolean;\n isResetChatEnabled: boolean;\n isStopResponseEnabled?: boolean;\n isStreamingEnabled: boolean;\n items: Array<ItemType>;\n itemSize?: string;\n localizedQuestions: Array<{ id: string; label: string; prompt: string }>;\n onFeedbackFormSubmit?: (data: FeedbackFormData, onSuccess: () => void) => void;\n onUserInteraction?: () => void;\n recordAction: (params: RecordActionType) => void;\n setCacheValue: BoxAISidebarCacheSetter;\n shouldFeedbackFormIncludeFeedbackText?: boolean;\n shouldPreinitSession?: boolean;\n setHasQuestions: (hasQuestions: boolean) => void;\n}\n\nconst BoxAISidebar = (props: BoxAISidebarProps) => {\n const {\n cache,\n contentName,\n elementId,\n fileExtension,\n fileID,\n getSuggestedQuestions,\n isIntelligentQueryMode,\n isFeedbackEnabled,\n isFeedbackFormEnabled,\n isStopResponseEnabled,\n items,\n itemSize,\n localizedQuestions,\n onFeedbackFormSubmit,\n onUserInteraction,\n recordAction,\n setCacheValue,\n shouldFeedbackFormIncludeFeedbackText,\n shouldPreinitSession = true,\n setHasQuestions,\n ...rest\n } = props;\n const { questions } = cache;\n const { formatMessage } = useIntl();\n const contextValue = React.useMemo(\n () => ({\n cache,\n contentName,\n elementId,\n fileExtension,\n isFeedbackEnabled,\n isFeedbackFormEnabled,\n isStopResponseEnabled,\n items,\n itemSize,\n onFeedbackFormSubmit,\n onUserInteraction,\n recordAction,\n setCacheValue,\n shouldFeedbackFormIncludeFeedbackText,\n shouldPreinitSession,\n }),\n [\n cache,\n contentName,\n elementId,\n fileExtension,\n isFeedbackEnabled,\n isFeedbackFormEnabled,\n isStopResponseEnabled,\n items,\n itemSize,\n onFeedbackFormSubmit,\n onUserInteraction,\n recordAction,\n setCacheValue,\n shouldFeedbackFormIncludeFeedbackText,\n shouldPreinitSession,\n ],\n );\n\n React.useEffect(() => {\n if (setHasQuestions) {\n setHasQuestions(questions.length > 0);\n }\n }, [questions.length, setHasQuestions]);\n\n let questionsWithoutInProgress = questions;\n if (questions.length > 0 && !questions[questions.length - 1].isCompleted) {\n // pass only fully completed questions to not show loading indicator of question where we canceled API request\n questionsWithoutInProgress = questionsWithoutInProgress.slice(0, -1);\n }\n\n const isSpreadsheet = SPREADSHEET_FILE_EXTENSIONS.includes(fileExtension);\n\n let spreadsheetNotice = isSpreadsheet ? formatMessage(messages.welcomeMessageSpreadsheetNotice) : '';\n if (isIntelligentQueryMode) {\n spreadsheetNotice = formatMessage(messages.welcomeMessageIntelligentQueryNotice);\n } else if (isSpreadsheet) {\n spreadsheetNotice = formatMessage(messages.welcomeMessageSpreadsheetNotice);\n }\n\n const handleSuggestedQuestionsFetched = (fetchedSuggestedQuestions: SuggestedQuestionType[]) => {\n setCacheValue('suggestedQuestions', fetchedSuggestedQuestions);\n };\n\n const suggestedQuestions = getSuggestedQuestions === null ? localizedQuestions : [];\n\n return (\n // BoxAISidebarContent is using withApiWrapper that is not passing all provided props,\n // that's why we need to use provider to pass other props\n <AgentsProvider value={cache.agents}>\n <BoxAISidebarContext.Provider value={contextValue}>\n <BoxAISidebarContent\n cachedSuggestedQuestions={cache.suggestedQuestions}\n getSuggestedQuestions={getSuggestedQuestions}\n isOpen\n isStopResponseEnabled={isStopResponseEnabled}\n itemID={fileID}\n itemIDs={[fileID]}\n onSuggestedQuestionsFetched={handleSuggestedQuestionsFetched}\n restoredQuestions={questionsWithoutInProgress}\n restoredSession={cache.encodedSession}\n restoredShouldShowLandingPage={cache.shouldShowLandingPage}\n shouldPreinitSession={shouldPreinitSession}\n suggestedQuestions={\n cache.suggestedQuestions.length > 0 ? cache.suggestedQuestions : suggestedQuestions\n }\n warningNotice={spreadsheetNotice}\n warningNoticeAriaLabel={formatMessage(messages.welcomeMessageSpreadsheetNoticeAriaLabel)}\n {...rest}\n />\n </BoxAISidebarContext.Provider>\n </AgentsProvider>\n );\n};\n\nexport default BoxAISidebar;\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,OAAO,QAAQ,YAAY;AAEpC,SAASC,cAAc,QAA0B,4BAA4B;AAC7E,OAAOC,mBAAmB,MAAM,uBAAuB;AACvD,SAASC,mBAAmB,QAAQ,+BAA+B;AACnE,SAASC,2BAA2B,QAAQ,qCAAqC;AAGjF,OAAOC,QAAQ,MAAM,oCAAoC;AAkDzD,MAAMC,YAAY,GAAIC,KAAwB,IAAK;EAC/C,MAAM;MACFC,KAAK;MACLC,WAAW;MACXC,SAAS;MACTC,aAAa;MACbC,MAAM;MACNC,qBAAqB;MACrBC,sBAAsB;MACtBC,iBAAiB;MACjBC,qBAAqB;MACrBC,qBAAqB;MACrBC,KA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BAAqB;MAC3CqB,kBAAkB,EACdvC,KAAK,CAACuC,kBAAkB,CAACX,MAAM,GAAG,CAAC,GAAG5B,KAAK,CAACuC,kBAAkB,GAAGA,kBACpE;MACDgB,aAAa,EAAErB,iBAAkB;MACjCsB,sBAAsB,EAAEhC,aAAa,CAAC3B,QAAQ,CAAC4D,wCAAwC;IAAE,GACrFrC,IAAI,CACX,CACyB,CAClB;EAAC;AAEzB,CAAC;AAED,eAAetB,YAAY","ignoreList":[]}
1
+ {"version":3,"file":"BoxAISidebar.js","names":["React","useIntl","AgentsProvider","BoxAISidebarContent","BoxAISidebarContext","SPREADSHEET_FILE_EXTENSIONS","messages","BoxAISidebar","props","cache","contentName","elementId","fileExtension","fileID","getSuggestedQuestions","isIntelligentQueryMode","isFeedbackEnabled","isFeedbackFormEnabled","isStopResponseEnabled","items","itemSize","localizedQuestions","onFeedbackFormSubmit","onUserInteraction","recordAction","renderRemoteModule","setCacheValue","shouldFeedbackFormIncludeFeedbackText","shouldPreinitSession","setHasQuestions","rest","_objectWithoutProperties","_excluded","questions","formatMessage","contextValue","useMemo","useEffect","length","questionsWithoutInProgress","isCompleted","slice","isSpreadsheet","includes","spreadsheetNotice","welcomeMessageSpreadsheetNotice","welcomeMessageIntelligentQueryNotice","handleSuggestedQuestionsFetched","fetchedSuggestedQuestions","suggestedQuestions","createElement","value","agents","Provider","_extends","cachedSuggestedQuestions","isOpen","itemID","itemIDs","onSuggestedQuestionsFetched","restoredQuestions","restoredSession","encodedSession","restoredShouldShowLandingPage","shouldShowLandingPage","warningNotice","warningNoticeAriaLabel","welcomeMessageSpreadsheetNoticeAriaLabel"],"sources":["../../../src/elements/content-sidebar/BoxAISidebar.tsx"],"sourcesContent":["/**\n * @file Box AI Sidebar Container\n * @author Box\n */\nimport * as React from 'react';\nimport { useIntl } from 'react-intl';\nimport { type FeedbackFormData, type ItemType, SuggestedQuestionType } from '@box/box-ai-content-answers';\nimport { AgentsProvider, RecordActionType } from '@box/box-ai-agent-selector';\nimport BoxAISidebarContent from './BoxAISidebarContent';\nimport { BoxAISidebarContext } from './context/BoxAISidebarContext';\nimport { SPREADSHEET_FILE_EXTENSIONS } from '../common/content-answers/constants';\nimport type { BoxAISidebarCache, BoxAISidebarCacheSetter } from './types/BoxAISidebarTypes';\nimport messages from '../common/content-answers/messages';\n\nexport interface BoxAISidebarProps {\n contentName: string;\n cache: BoxAISidebarCache;\n createSessionRequest: (payload: Record<string, unknown>, itemID: string) => Promise<unknown>;\n elementId: string;\n fetchTimeout: Record<string, unknown>;\n fileExtension: string;\n fileID: string;\n getAgentConfig: (payload: Record<string, unknown>) => Promise<unknown>;\n getAIStudioAgents: () => Promise<unknown>;\n getAnswer: (\n payload: Record<string, unknown>,\n itemID?: string,\n itemIDs?: Array<string>,\n state?: Record<string, unknown>,\n ) => Promise<unknown>;\n getAnswerStreaming: (\n payload: Record<string, unknown>,\n itemID?: string,\n itemIDs?: Array<string>,\n abortController?: AbortController,\n state?: Record<string, unknown>,\n ) => Promise<unknown>;\n getSuggestedQuestions: (itemID: string) => Promise<unknown> | null;\n hostAppName: string;\n isAgentSelectorEnabled: boolean;\n isAIStudioAgentSelectorEnabled: boolean;\n isCitationsEnabled: boolean;\n isDebugModeEnabled: boolean;\n isFeedbackEnabled: boolean;\n isFeedbackFormEnabled: boolean;\n isIntelligentQueryMode: boolean;\n isMarkdownEnabled: boolean;\n isResetChatEnabled: boolean;\n isStopResponseEnabled?: boolean;\n isStreamingEnabled: boolean;\n items: Array<ItemType>;\n itemSize?: string;\n localizedQuestions: Array<{ id: string; label: string; prompt: string }>;\n onFeedbackFormSubmit?: (data: FeedbackFormData, onSuccess: () => void) => void;\n onUserInteraction?: () => void;\n recordAction: (params: RecordActionType) => void;\n setCacheValue: BoxAISidebarCacheSetter;\n shouldFeedbackFormIncludeFeedbackText?: boolean;\n renderRemoteModule?: (elementId: string) => React.ReactNode;\n shouldPreinitSession?: boolean;\n setHasQuestions: (hasQuestions: boolean) => void;\n}\n\nconst BoxAISidebar = (props: BoxAISidebarProps) => {\n const {\n cache,\n contentName,\n elementId,\n fileExtension,\n fileID,\n getSuggestedQuestions,\n isIntelligentQueryMode,\n isFeedbackEnabled,\n isFeedbackFormEnabled,\n isStopResponseEnabled,\n items,\n itemSize,\n localizedQuestions,\n onFeedbackFormSubmit,\n onUserInteraction,\n recordAction,\n renderRemoteModule,\n setCacheValue,\n shouldFeedbackFormIncludeFeedbackText,\n shouldPreinitSession = true,\n setHasQuestions,\n ...rest\n } = props;\n const { questions } = cache;\n const { formatMessage } = useIntl();\n const contextValue = React.useMemo(\n () => ({\n cache,\n contentName,\n elementId,\n fileExtension,\n isFeedbackEnabled,\n isFeedbackFormEnabled,\n isStopResponseEnabled,\n items,\n itemSize,\n onFeedbackFormSubmit,\n onUserInteraction,\n recordAction,\n setCacheValue,\n shouldFeedbackFormIncludeFeedbackText,\n shouldPreinitSession,\n }),\n [\n cache,\n contentName,\n elementId,\n fileExtension,\n isFeedbackEnabled,\n isFeedbackFormEnabled,\n isStopResponseEnabled,\n items,\n itemSize,\n onFeedbackFormSubmit,\n onUserInteraction,\n recordAction,\n setCacheValue,\n shouldFeedbackFormIncludeFeedbackText,\n shouldPreinitSession,\n ],\n );\n\n React.useEffect(() => {\n if (setHasQuestions) {\n setHasQuestions(questions.length > 0);\n }\n }, [questions.length, setHasQuestions]);\n\n if (renderRemoteModule) {\n return renderRemoteModule(elementId);\n }\n\n let questionsWithoutInProgress = questions;\n if (questions.length > 0 && !questions[questions.length - 1].isCompleted) {\n // pass only fully completed questions to not show loading indicator of question where we canceled API request\n questionsWithoutInProgress = questionsWithoutInProgress.slice(0, -1);\n }\n\n const isSpreadsheet = SPREADSHEET_FILE_EXTENSIONS.includes(fileExtension);\n\n let spreadsheetNotice = isSpreadsheet ? formatMessage(messages.welcomeMessageSpreadsheetNotice) : '';\n if (isIntelligentQueryMode) {\n spreadsheetNotice = formatMessage(messages.welcomeMessageIntelligentQueryNotice);\n } else if (isSpreadsheet) {\n spreadsheetNotice = formatMessage(messages.welcomeMessageSpreadsheetNotice);\n }\n\n const handleSuggestedQuestionsFetched = (fetchedSuggestedQuestions: SuggestedQuestionType[]) => {\n setCacheValue('suggestedQuestions', fetchedSuggestedQuestions);\n };\n\n const suggestedQuestions = getSuggestedQuestions === null ? localizedQuestions : [];\n\n return (\n // BoxAISidebarContent is using withApiWrapper that is not passing all provided props,\n // that's why we need to use provider to pass other props\n <AgentsProvider value={cache.agents}>\n <BoxAISidebarContext.Provider value={contextValue}>\n <BoxAISidebarContent\n cachedSuggestedQuestions={cache.suggestedQuestions}\n getSuggestedQuestions={getSuggestedQuestions}\n isOpen\n isStopResponseEnabled={isStopResponseEnabled}\n itemID={fileID}\n itemIDs={[fileID]}\n onSuggestedQuestionsFetched={handleSuggestedQuestionsFetched}\n restoredQuestions={questionsWithoutInProgress}\n restoredSession={cache.encodedSession}\n restoredShouldShowLandingPage={cache.shouldShowLandingPage}\n shouldPreinitSession={shouldPreinitSession}\n suggestedQuestions={\n cache.suggestedQuestions.length > 0 ? cache.suggestedQuestions : suggestedQuestions\n }\n warningNotice={spreadsheetNotice}\n warningNoticeAriaLabel={formatMessage(messages.welcomeMessageSpreadsheetNoticeAriaLabel)}\n {...rest}\n />\n </BoxAISidebarContext.Provider>\n </AgentsProvider>\n );\n};\n\nexport default BoxAISidebar;\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,OAAO,QAAQ,YAAY;AAEpC,SAASC,cAAc,QAA0B,4BAA4B;AAC7E,OAAOC,mBAAmB,MAAM,uBAAuB;AACvD,SAASC,mBAAmB,QAAQ,+BAA+B;AACnE,SAASC,2BAA2B,QAAQ,qCAAqC;AAEjF,OAAOC,QAAQ,MAAM,oCAAoC;AAmDzD,MAAMC,YAAY,GAAIC,KAAwB,IAAK;EAC/C,MAAM;MACFC,KAAK;MACLC,WAAW;MACXC,SAAS;MACTC,aAAa;MACbC,MAAM;MACNC,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AA2B,EAAEZ,+BAAgC;MAC7Da,iBAAiB,EAAErB,0BAA2B;MAC9CsB,eAAe,EAAEpD,KAAK,CAACqD,cAAe;MACtCC,6BAA6B,EAAEtD,KAAK,CAACuD,qBAAsB;MAC3DpC,oBAAoB,EAAEA,oBAAqB;MAC3CqB,kBAAkB,EACdxC,KAAK,CAACwC,kBAAkB,CAACX,MAAM,GAAG,CAAC,GAAG7B,KAAK,CAACwC,kBAAkB,GAAGA,kBACpE;MACDgB,aAAa,EAAErB,iBAAkB;MACjCsB,sBAAsB,EAAEhC,aAAa,CAAC5B,QAAQ,CAAC6D,wCAAwC;IAAE,GACrFrC,IAAI,CACX,CACyB,CAClB;EAAC;AAEzB,CAAC;AAED,eAAevB,YAAY","ignoreList":[]}
@@ -43,8 +43,9 @@ export interface BoxAISidebarProps {
43
43
  recordAction: (params: RecordActionType) => void;
44
44
  setCacheValue: BoxAISidebarCacheSetter;
45
45
  shouldFeedbackFormIncludeFeedbackText?: boolean;
46
+ renderRemoteModule?: (elementId: string) => React.ReactNode;
46
47
  shouldPreinitSession?: boolean;
47
48
  setHasQuestions: (hasQuestions: boolean) => void;
48
49
  }
49
- declare const BoxAISidebar: (props: BoxAISidebarProps) => React.JSX.Element;
50
+ declare const BoxAISidebar: (props: BoxAISidebarProps) => string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element;
50
51
  export default BoxAISidebar;
package/i18n/ja-JP.js CHANGED
@@ -605,7 +605,7 @@ export default {
605
605
  "boxui.itemDetails.url": "URL",
606
606
  "boxui.itemDetails.urlPlaceholder": "有効なURLを入力",
607
607
  "boxui.media.menuButtonArialLabel": "オプション",
608
- "boxui.metadataInstanceEditor.aiAutofillDescription": "Use Box AI to automatically extract metadata values.",
608
+ "boxui.metadataInstanceEditor.aiAutofillDescription": "Box AIを使用して自動的にメタデータ値を抽出します。",
609
609
  "boxui.metadataInstanceEditor.aiAutofillLearnMore": "詳細を表示",
610
610
  "boxui.metadataInstanceEditor.allAttributesAreHidden": "このテンプレートのすべての属性が非表示になっています。",
611
611
  "boxui.metadataInstanceEditor.applyCascadePolicyText": "このフォルダとそのサブフォルダのすべての新規および既存の項目に、テンプレートとその値を適用します。",
@@ -627,7 +627,7 @@ export default {
627
627
  "boxui.metadataInstanceEditor.customValue": "値",
628
628
  "boxui.metadataInstanceEditor.customValuePlaceholder": "例: 42",
629
629
  "boxui.metadataInstanceEditor.editTooltip": "メタデータを編集",
630
- "boxui.metadataInstanceEditor.enableAIAutofill": "Box AI Autofill",
630
+ "boxui.metadataInstanceEditor.enableAIAutofill": "Box AIの自動入力",
631
631
  "boxui.metadataInstanceEditor.enableCascadePolicy": "カスケードポリシーを有効にする",
632
632
  "boxui.metadataInstanceEditor.fileMetadataRemoveCustomTemplateConfirm": "このカスタムメタデータおよびそのすべての値をこのファイルから削除してもよろしいですか?",
633
633
  "boxui.metadataInstanceEditor.fileMetadataRemoveTemplateConfirm": "\"{metadataName}\"およびそのすべての値をこのファイルから削除してもよろしいですか?",
@@ -979,8 +979,8 @@ export default {
979
979
  "boxui.unifiedShare.previewerUploaderLevelDescription": "アップロードとプレビューが可能です",
980
980
  "boxui.unifiedShare.previewerUploaderLevelText": "プレビューアー/アップローダー",
981
981
  "boxui.unifiedShare.recommendedSharingTooltipCalloutText": "お客様の使用状況から、{fullName}さんにはこのファイルもお勧めです。",
982
- "boxui.unifiedShare.removeCollaboratorConfirmationDescription": "Are you sure you want to remove {name} as a collaborator?",
983
- "boxui.unifiedShare.removeCollaboratorConfirmationTitle": "Remove Collaborator",
982
+ "boxui.unifiedShare.removeCollaboratorConfirmationDescription": "コラボレータから{name}を削除してもよろしいですか?",
983
+ "boxui.unifiedShare.removeCollaboratorConfirmationTitle": "コラボレータの削除",
984
984
  "boxui.unifiedShare.removeLinkConfirmationDescription": "これにより、共有リンクが完全に削除されます。この項目が他のサイトに埋め込まれている場合は、そのサイトでもアクセスできなくなります。カスタムプロパティ、設定、有効期限も削除されます。続行しますか?",
985
985
  "boxui.unifiedShare.removeLinkConfirmationTitle": "共有リンクを削除",
986
986
  "boxui.unifiedShare.removeLinkTooltip": "リンクを削除する権限がありません。",
@@ -1211,7 +1211,7 @@ boxui.itemDetails.urlPlaceholder = 有効なURLを入力
1211
1211
  # Label for comment options menu
1212
1212
  boxui.media.menuButtonArialLabel = オプション
1213
1213
  # Description for AI autofill toggle switch
1214
- boxui.metadataInstanceEditor.aiAutofillDescription = Use Box AI to automatically extract metadata values.
1214
+ boxui.metadataInstanceEditor.aiAutofillDescription = Box AIを使用して自動的にメタデータ値を抽出します。
1215
1215
  # Learn more link for AI autofill
1216
1216
  boxui.metadataInstanceEditor.aiAutofillLearnMore = 詳細を表示
1217
1217
  # Informational text below collapsible header indicating that all fields for this template are hidden
@@ -1255,7 +1255,7 @@ boxui.metadataInstanceEditor.customValuePlaceholder = 例: 42
1255
1255
  # Text that shows in a tooltip above the edit pencil button.
1256
1256
  boxui.metadataInstanceEditor.editTooltip = メタデータを編集
1257
1257
  # Label for enable AI autofill toggle switch
1258
- boxui.metadataInstanceEditor.enableAIAutofill = Box AI Autofill
1258
+ boxui.metadataInstanceEditor.enableAIAutofill = Box AIの自動入力
1259
1259
  # Label for enable cascade policy toggle switch
1260
1260
  boxui.metadataInstanceEditor.enableCascadePolicy = カスケードポリシーを有効にする
1261
1261
  # Message for users who may attempt to remove a custom metadata instance for a file. Also non-recoverable
@@ -1959,9 +1959,9 @@ boxui.unifiedShare.previewerUploaderLevelText = プレビューアー/アップ
1959
1959
  # Tooltip description to explain recommendation for sharing tooltip
1960
1960
  boxui.unifiedShare.recommendedSharingTooltipCalloutText = お客様の使用状況から、{fullName}さんにはこのファイルもお勧めです。
1961
1961
  # Description for confirmation modal to remove a collaborator
1962
- boxui.unifiedShare.removeCollaboratorConfirmationDescription = Are you sure you want to remove {name} as a collaborator?
1962
+ boxui.unifiedShare.removeCollaboratorConfirmationDescription = コラボレータから{name}を削除してもよろしいですか?
1963
1963
  # Label for confirmation modal to remove a collaborator (title-case)
1964
- boxui.unifiedShare.removeCollaboratorConfirmationTitle = Remove Collaborator
1964
+ boxui.unifiedShare.removeCollaboratorConfirmationTitle = コラボレータの削除
1965
1965
  # Description for confirmation modal to remove a shared link
1966
1966
  boxui.unifiedShare.removeLinkConfirmationDescription = これにより、共有リンクが完全に削除されます。この項目が他のサイトに埋め込まれている場合は、そのサイトでもアクセスできなくなります。カスタムプロパティ、設定、有効期限も削除されます。続行しますか?
1967
1967
  # Label for confirmation modal to remove a shared link (title-case)
package/i18n/pl-PL.js CHANGED
@@ -963,10 +963,10 @@ export default {
963
963
  "boxui.unifiedShare.peopleInEnterpriseName": "Osoby w przedsiębiorstwie {enterpriseName}",
964
964
  "boxui.unifiedShare.peopleInItemCanAccessFile": "Tylko zaproszeni użytkownicy mogą uzyskać dostęp do tego pliku",
965
965
  "boxui.unifiedShare.peopleInItemCanAccessFolder": "Tylko zaproszeni użytkownicy mogą uzyskać dostęp do tego folderu",
966
- "boxui.unifiedShare.peopleInItemCanAccessHub": "Only invited people can access this hub",
966
+ "boxui.unifiedShare.peopleInItemCanAccessHub": "Tylko zaproszone osoby mogą uzyskać dostęp do tego hub",
967
967
  "boxui.unifiedShare.peopleInSpecifiedCompanyCanAccessFile": "Wszyscy użytkownicy w firmie {company} dysponujący łączem lub użytkownicy zaproszeni do tego pliku mogą uzyskać dostęp",
968
968
  "boxui.unifiedShare.peopleInSpecifiedCompanyCanAccessFolder": "Wszyscy użytkownicy w firmie {company} dysponujący łączem lub użytkownicy zaproszeni do tego folderu mogą uzyskać dostęp",
969
- "boxui.unifiedShare.peopleInSpecifiedCompanyCanAccessHub": "Anyone at {company} with the link or people invited to this hub can access",
969
+ "boxui.unifiedShare.peopleInSpecifiedCompanyCanAccessHub": "Każda osoba w {company} posiadająca łącze lub osoby zaproszone do tego hub mogą uzyskać dostęp",
970
970
  "boxui.unifiedShare.peopleInThisFile": "Tylko zaproszeni użytkownicy",
971
971
  "boxui.unifiedShare.peopleInThisFolder": "Tylko zaproszeni użytkownicy",
972
972
  "boxui.unifiedShare.peopleInYourCompany": "Osoby w Twojej firmie",
@@ -1927,13 +1927,13 @@ boxui.unifiedShare.peopleInItemCanAccessFile = Tylko zaproszeni użytkownicy mog
1927
1927
  # Description of a collaborator-only shared link for a folder
1928
1928
  boxui.unifiedShare.peopleInItemCanAccessFolder = Tylko zaproszeni użytkownicy mogą uzyskać dostęp do tego folderu
1929
1929
  # Description of a collaborator-only shared link for a hub
1930
- boxui.unifiedShare.peopleInItemCanAccessHub = Only invited people can access this hub
1930
+ boxui.unifiedShare.peopleInItemCanAccessHub = Tylko zaproszone osoby mogą uzyskać dostęp do tego hub
1931
1931
  # Description of a specific company shared link for a file. {company} is the company name
1932
1932
  boxui.unifiedShare.peopleInSpecifiedCompanyCanAccessFile = Wszyscy użytkownicy w firmie {company} dysponujący łączem lub użytkownicy zaproszeni do tego pliku mogą uzyskać dostęp
1933
1933
  # Description of a specific company shared link for a folder. {company} is the company name
1934
1934
  boxui.unifiedShare.peopleInSpecifiedCompanyCanAccessFolder = Wszyscy użytkownicy w firmie {company} dysponujący łączem lub użytkownicy zaproszeni do tego folderu mogą uzyskać dostęp
1935
1935
  # Description of a specific company shared link for a hub. {company} is the company name
1936
- boxui.unifiedShare.peopleInSpecifiedCompanyCanAccessHub = Anyone at {company} with the link or people invited to this hub can access
1936
+ boxui.unifiedShare.peopleInSpecifiedCompanyCanAccessHub = Każda osoba w {company} posiadająca łącze lub osoby zaproszone do tego hub mogą uzyskać dostęp
1937
1937
  # Label for "People in this file" option
1938
1938
  boxui.unifiedShare.peopleInThisFile = Tylko zaproszeni użytkownicy
1939
1939
  # Label for "People in this folder" option
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "box-ui-elements",
3
- "version": "23.4.0-beta.7",
3
+ "version": "23.4.0-beta.9",
4
4
  "description": "Box UI Elements",
5
5
  "author": "Box (https://www.box.com/)",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -150,13 +150,12 @@
150
150
  "@storybook/addon-interactions": "^8.2.4",
151
151
  "@storybook/addon-knobs": "^8.0.1",
152
152
  "@storybook/addon-links": "^8.2.4",
153
- "@storybook/addon-styling": "^1.3.7",
154
- "@storybook/addon-styling-webpack": "^1.0.0",
153
+ "@storybook/addon-styling-webpack": "^1.0.1",
155
154
  "@storybook/addon-webpack5-compiler-babel": "^3.0.3",
156
155
  "@storybook/blocks": "^8.2.4",
157
156
  "@storybook/manager-api": "^8.2.4",
158
157
  "@storybook/preview-api": "^8.2.4",
159
- "@storybook/react-webpack5": "^8.2.4",
158
+ "@storybook/react-webpack5": "^8.6.14",
160
159
  "@storybook/test": "^8.2.4",
161
160
  "@storybook/theming": "^8.2.4",
162
161
  "@testing-library/jest-dom": "^6.4.6",
@@ -276,7 +275,7 @@
276
275
  "semantic-release": "^24.2.3",
277
276
  "sinon": "^2.3.7",
278
277
  "source-map-loader": "^0.2.4",
279
- "storybook": "^8.2.4",
278
+ "storybook": "^8.6.14",
280
279
  "storybook-react-intl": "^3.1.1",
281
280
  "string-replace-loader": "^3.1.0",
282
281
  "styled-components": "5.0.0",
@@ -10,7 +10,6 @@ import BoxAISidebarContent from './BoxAISidebarContent';
10
10
  import { BoxAISidebarContext } from './context/BoxAISidebarContext';
11
11
  import { SPREADSHEET_FILE_EXTENSIONS } from '../common/content-answers/constants';
12
12
  import type { BoxAISidebarCache, BoxAISidebarCacheSetter } from './types/BoxAISidebarTypes';
13
-
14
13
  import messages from '../common/content-answers/messages';
15
14
 
16
15
  export interface BoxAISidebarProps {
@@ -57,6 +56,7 @@ export interface BoxAISidebarProps {
57
56
  recordAction: (params: RecordActionType) => void;
58
57
  setCacheValue: BoxAISidebarCacheSetter;
59
58
  shouldFeedbackFormIncludeFeedbackText?: boolean;
59
+ renderRemoteModule?: (elementId: string) => React.ReactNode;
60
60
  shouldPreinitSession?: boolean;
61
61
  setHasQuestions: (hasQuestions: boolean) => void;
62
62
  }
@@ -79,6 +79,7 @@ const BoxAISidebar = (props: BoxAISidebarProps) => {
79
79
  onFeedbackFormSubmit,
80
80
  onUserInteraction,
81
81
  recordAction,
82
+ renderRemoteModule,
82
83
  setCacheValue,
83
84
  shouldFeedbackFormIncludeFeedbackText,
84
85
  shouldPreinitSession = true,
@@ -130,6 +131,10 @@ const BoxAISidebar = (props: BoxAISidebarProps) => {
130
131
  }
131
132
  }, [questions.length, setHasQuestions]);
132
133
 
134
+ if (renderRemoteModule) {
135
+ return renderRemoteModule(elementId);
136
+ }
137
+
133
138
  let questionsWithoutInProgress = questions;
134
139
  if (questions.length > 0 && !questions[questions.length - 1].isCompleted) {
135
140
  // pass only fully completed questions to not show loading indicator of question where we canceled API request
@@ -347,6 +347,26 @@ describe('elements/content-sidebar/BoxAISidebar', () => {
347
347
  expect(screen.queryByTestId('content-answers-modal')).not.toBeInTheDocument();
348
348
  });
349
349
 
350
+ describe('remote sidebar component', () => {
351
+ const MockRemoteSidebar = jest.fn(() => <div data-testid="remote-sidebar" />);
352
+ const renderRemoteModule = jest.fn(() => <MockRemoteSidebar elementId={mockProps.elementId} />);
353
+
354
+ test('should render remote sidebar component when provided', async () => {
355
+ await renderComponent({ renderRemoteModule });
356
+
357
+ expect(renderRemoteModule).toHaveBeenCalledWith(mockProps.elementId);
358
+ expect(screen.getByTestId('remote-sidebar')).toBeInTheDocument();
359
+ });
360
+
361
+ test('should not render default sidebar when remote component is provided', async () => {
362
+ await renderComponent({ renderRemoteModule });
363
+
364
+ expect(screen.queryByTestId('boxai-sidebar-title')).not.toBeInTheDocument();
365
+ expect(screen.queryByTestId('sidebar-agent-selector')).not.toBeInTheDocument();
366
+ expect(screen.queryByRole('button', { name: 'Clear conversation' })).not.toBeInTheDocument();
367
+ });
368
+ });
369
+
350
370
  describe('given shouldPreinitSession = false, should create session on user intent', () => {
351
371
  test('agents list open', async () => {
352
372
  MockBoxAiAgentSelectorWithApi.mockImplementation(({ onAgentsListOpen }) => {