From 06b6bd4d3ca3fe26a1bcea1030d2fbfb203a2728 Mon Sep 17 00:00:00 2001 From: Adam Horowitz Date: Thu, 7 May 2026 14:08:44 -0400 Subject: [PATCH 1/2] feat(content-preview): forward monitoring dimensions to Preview Accept accessPattern, previewMode, sharedLinkAuth as props on ContentPreview and pass them through to the underlying Preview library so emitted metric/error events are tagged for the monitoring dashboard. PREVIEW-225 Co-Authored-By: Claude Opus 4.7 (1M context) --- i18n/en-US.properties | 12 +++++++ .../content-preview/ContentPreview.js | 9 ++++++ .../__tests__/ContentPreview.test.js | 32 +++++++++++++++++++ 3 files changed, 53 insertions(+) diff --git a/i18n/en-US.properties b/i18n/en-US.properties index d4cffb1b42..09b91c9587 100644 --- a/i18n/en-US.properties +++ b/i18n/en-US.properties @@ -490,6 +490,10 @@ be.expand = Expand be.externalFolder = External Folder # Label for face skill section in the preview sidebar be.faceSkill = Faces +# Call-to-action text describing what to do to navigate to specified feedback form +be.feedbackCtaText = Click to provide feedback +# Accessible text used to describe the form used for feedback +be.feedbackFormDescription = Beta Feedback Form # Icon title for a Box item of type file be.file = File # File access stats error message @@ -968,6 +972,12 @@ boxui.accessStats.accessStatsPreviews = Previews boxui.accessStats.accessStatsViewDetails = View Details # The label for the view category of access stats for box notes boxui.accessStats.accessStatsViews = Views +# Description text about advanced content insights. +boxui.advancedContentInsights.advancedContentInsightsDescription = Get actionable insights into how viewers are engaging with this content. Measure average time spent, page-by-page engagement, per person and per visit details. +# Advanced Content Insights toggle title +boxui.advancedContentInsights.advancedContentInsightsTitleDisabled = Activate Engagement Insights +# Advanced Content Insights toggle title +boxui.advancedContentInsights.advancedContentInsightsTitleEnabled = Engagement Insights is activated # Text for an icon aria label to convey an external user of the enterprise boxui.avatar.externalUser = External user # Text for the beta badge @@ -984,6 +994,8 @@ boxui.base.previousMonth = Previous Month boxui.breadcrumb.breadcrumbLabel = Breadcrumb # Button label for the "more" dropdown menu boxui.categorySelector.label.more = More +# Icon to display more information on the checkbox +boxui.checkboxTooltip.iconInfoText = Info # Button to add classification on an item boxui.classification.add = Add # Title of the card that shows the reason why the AI classification was applied when no date is available. diff --git a/src/elements/content-preview/ContentPreview.js b/src/elements/content-preview/ContentPreview.js index 2b88d87a84..941f558ab2 100644 --- a/src/elements/content-preview/ContentPreview.js +++ b/src/elements/content-preview/ContentPreview.js @@ -132,6 +132,9 @@ type Props = { previewLibraryVersion: string, requestInterceptor?: Function, responseInterceptor?: Function, + accessPattern?: 'file_list' | 'direct_link' | 'shared_link', + previewMode?: 'default' | 'shared_file' | 'shared_folder' | 'editable_shared_file' | 'inline_feed', + sharedLinkAuth?: 'logged_in' | 'logged_out' | 'na', sharedLink?: string, sharedLinkPassword?: string, showAnnotations?: boolean, @@ -899,6 +902,7 @@ class ContentPreview extends React.PureComponent { */ loadPreview = async (): Promise => { const { + accessPattern, advancedContentInsights, // will be removed once preview package will be updated to utilize feature flip for ACI annotatorState: { activeAnnotationId } = {}, renderCustomPreview, @@ -910,6 +914,8 @@ class ContentPreview extends React.PureComponent { onAnnotator, onContentInsightsEventReport, previewExperiences, + previewMode, + sharedLinkAuth, showAnnotationsControls, token: tokenOrTokenFunction, ...rest @@ -951,6 +957,7 @@ class ContentPreview extends React.PureComponent { } const previewOptions = { + accessPattern, advancedContentInsights, // will be removed once preview package will be updated to utilize feature flip for ACI container: `#${this.id} .bcpr-content`, enableBoundingBoxHighlights, @@ -960,6 +967,8 @@ class ContentPreview extends React.PureComponent { header: 'none', headerElement: `#${this.id} .bcpr-PreviewHeader`, experiences: previewExperiences, + previewMode, + sharedLinkAuth, showAnnotations: this.canViewAnnotations(), showAnnotationsControls, showDownload: this.canDownload(), diff --git a/src/elements/content-preview/__tests__/ContentPreview.test.js b/src/elements/content-preview/__tests__/ContentPreview.test.js index 315013ac5a..ab37758454 100644 --- a/src/elements/content-preview/__tests__/ContentPreview.test.js +++ b/src/elements/content-preview/__tests__/ContentPreview.test.js @@ -385,6 +385,38 @@ describe('elements/content-preview/ContentPreview', () => { ); }); + test('should forward host-supplied monitoring dimensions to preview options', async () => { + const wrapper = getWrapper({ + ...props, + accessPattern: 'file_list', + previewMode: 'default', + sharedLinkAuth: 'na', + }); + wrapper.setState({ file }); + const instance = wrapper.instance(); + await instance.loadPreview(); + expect(instance.preview.show).toHaveBeenCalledWith( + file.id, + expect.any(Function), + expect.objectContaining({ + accessPattern: 'file_list', + previewMode: 'default', + sharedLinkAuth: 'na', + }), + ); + }); + + test('should pass monitoring dimensions as undefined when host omits them', async () => { + const wrapper = getWrapper(props); + wrapper.setState({ file }); + const instance = wrapper.instance(); + await instance.loadPreview(); + const options = instance.preview.show.mock.calls[0][2]; + expect(options.accessPattern).toBeUndefined(); + expect(options.previewMode).toBeUndefined(); + expect(options.sharedLinkAuth).toBeUndefined(); + }); + test('should call preview show with file version params if provided', async () => { const wrapper = getWrapper(props); wrapper.setState({ From 47c4e392259745a4eed99b17e6dd0584fcb77c06 Mon Sep 17 00:00:00 2001 From: Adam Horowitz Date: Fri, 8 May 2026 16:36:00 -0400 Subject: [PATCH 2/2] feat(content-preview): forward preload/prefetch status to Preview MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Accepts two new optional props on ContentPreview — prefetchStatus and preloadStatus — and threads them into previewOptions so box-content-preview can tag emitted load/error/outcome events. PREVIEW-225 Co-Authored-By: Claude Opus 4.7 (1M context) --- i18n/en-US.properties | 12 ------------ src/elements/content-preview/ContentPreview.js | 6 ++++++ .../content-preview/__tests__/ContentPreview.test.js | 6 ++++++ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/i18n/en-US.properties b/i18n/en-US.properties index 09b91c9587..d4cffb1b42 100644 --- a/i18n/en-US.properties +++ b/i18n/en-US.properties @@ -490,10 +490,6 @@ be.expand = Expand be.externalFolder = External Folder # Label for face skill section in the preview sidebar be.faceSkill = Faces -# Call-to-action text describing what to do to navigate to specified feedback form -be.feedbackCtaText = Click to provide feedback -# Accessible text used to describe the form used for feedback -be.feedbackFormDescription = Beta Feedback Form # Icon title for a Box item of type file be.file = File # File access stats error message @@ -972,12 +968,6 @@ boxui.accessStats.accessStatsPreviews = Previews boxui.accessStats.accessStatsViewDetails = View Details # The label for the view category of access stats for box notes boxui.accessStats.accessStatsViews = Views -# Description text about advanced content insights. -boxui.advancedContentInsights.advancedContentInsightsDescription = Get actionable insights into how viewers are engaging with this content. Measure average time spent, page-by-page engagement, per person and per visit details. -# Advanced Content Insights toggle title -boxui.advancedContentInsights.advancedContentInsightsTitleDisabled = Activate Engagement Insights -# Advanced Content Insights toggle title -boxui.advancedContentInsights.advancedContentInsightsTitleEnabled = Engagement Insights is activated # Text for an icon aria label to convey an external user of the enterprise boxui.avatar.externalUser = External user # Text for the beta badge @@ -994,8 +984,6 @@ boxui.base.previousMonth = Previous Month boxui.breadcrumb.breadcrumbLabel = Breadcrumb # Button label for the "more" dropdown menu boxui.categorySelector.label.more = More -# Icon to display more information on the checkbox -boxui.checkboxTooltip.iconInfoText = Info # Button to add classification on an item boxui.classification.add = Add # Title of the card that shows the reason why the AI classification was applied when no date is available. diff --git a/src/elements/content-preview/ContentPreview.js b/src/elements/content-preview/ContentPreview.js index 941f558ab2..0119694bc8 100644 --- a/src/elements/content-preview/ContentPreview.js +++ b/src/elements/content-preview/ContentPreview.js @@ -133,6 +133,8 @@ type Props = { requestInterceptor?: Function, responseInterceptor?: Function, accessPattern?: 'file_list' | 'direct_link' | 'shared_link', + prefetchStatus?: 'hit' | 'miss', + preloadStatus?: 'hit' | 'miss', previewMode?: 'default' | 'shared_file' | 'shared_folder' | 'editable_shared_file' | 'inline_feed', sharedLinkAuth?: 'logged_in' | 'logged_out' | 'na', sharedLink?: string, @@ -913,6 +915,8 @@ class ContentPreview extends React.PureComponent { onAnnotatorEvent, onAnnotator, onContentInsightsEventReport, + prefetchStatus, + preloadStatus, previewExperiences, previewMode, sharedLinkAuth, @@ -967,6 +971,8 @@ class ContentPreview extends React.PureComponent { header: 'none', headerElement: `#${this.id} .bcpr-PreviewHeader`, experiences: previewExperiences, + prefetchStatus, + preloadStatus, previewMode, sharedLinkAuth, showAnnotations: this.canViewAnnotations(), diff --git a/src/elements/content-preview/__tests__/ContentPreview.test.js b/src/elements/content-preview/__tests__/ContentPreview.test.js index ab37758454..806a13cbde 100644 --- a/src/elements/content-preview/__tests__/ContentPreview.test.js +++ b/src/elements/content-preview/__tests__/ContentPreview.test.js @@ -389,6 +389,8 @@ describe('elements/content-preview/ContentPreview', () => { const wrapper = getWrapper({ ...props, accessPattern: 'file_list', + prefetchStatus: 'hit', + preloadStatus: 'miss', previewMode: 'default', sharedLinkAuth: 'na', }); @@ -400,6 +402,8 @@ describe('elements/content-preview/ContentPreview', () => { expect.any(Function), expect.objectContaining({ accessPattern: 'file_list', + prefetchStatus: 'hit', + preloadStatus: 'miss', previewMode: 'default', sharedLinkAuth: 'na', }), @@ -413,6 +417,8 @@ describe('elements/content-preview/ContentPreview', () => { await instance.loadPreview(); const options = instance.preview.show.mock.calls[0][2]; expect(options.accessPattern).toBeUndefined(); + expect(options.prefetchStatus).toBeUndefined(); + expect(options.preloadStatus).toBeUndefined(); expect(options.previewMode).toBeUndefined(); expect(options.sharedLinkAuth).toBeUndefined(); });