Skip to content

feat(content-preview): forward monitoring dimensions [PREVIEW-225]#4542

Open
ahorowitz123 wants to merge 1 commit intobox:masterfrom
ahorowitz123:PREVIEW-225
Open

feat(content-preview): forward monitoring dimensions [PREVIEW-225]#4542
ahorowitz123 wants to merge 1 commit intobox:masterfrom
ahorowitz123:PREVIEW-225

Conversation

@ahorowitz123
Copy link
Copy Markdown
Contributor

@ahorowitz123 ahorowitz123 commented May 7, 2026

Summary

Accepts three new optional props on <ContentPreview>accessPattern, previewMode, sharedLinkAuth — and threads them into previewOptions so the underlying Preview library can tag emitted preview_metric / preview_error events for the monitoring dashboard.

Why

Part of the Preview Performance Monitoring dashboard rollout under WEBAPP-53337. The dashboard needs to slice TTPL by access pattern, preview mode, and shared-link auth. Companion box-content-preview work (accepting + emitting these dimensions) landed in PREVIEW-224; host app call sites land in PREVIEW-226 and PREVIEW-227.

Ticket

PREVIEW-225

Test plan

  • Unit test: props forward to preview.show() options when supplied
  • Unit test: options are undefined when props omitted
  • Full ContentPreview test suite passes (147 tests)
  • ESLint clean
  • Manual verification: host app sets the props and confirms payloads carry the dimensions (tracked by PREVIEW-226/227)

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features
    • Enhanced content preview with new optional configuration settings for access patterns, preview modes, and authentication levels, enabling more granular control over preview behavior across different sharing and access scenarios.

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) <noreply@anthropic.com>
@ahorowitz123 ahorowitz123 requested review from a team as code owners May 7, 2026 18:38
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8e2fdbee-bf91-4875-84d3-a7cc3867167d

📥 Commits

Reviewing files that changed from the base of the PR and between 4c8cf11 and 06b6bd4.

⛔ Files ignored due to path filters (1)
  • i18n/en-US.properties is excluded by !i18n/**
📒 Files selected for processing (2)
  • src/elements/content-preview/ContentPreview.js
  • src/elements/content-preview/__tests__/ContentPreview.test.js

Walkthrough

ContentPreview component extends its Props interface with three optional monitoring dimension properties (accessPattern, previewMode, sharedLinkAuth), destructures these props in loadPreview, and forwards them into the options passed to the underlying Box.Preview library's preview.show method. Tests verify the props are correctly forwarded or undefined when omitted.

Changes

Preview Monitoring Dimensions

Layer / File(s) Summary
Props Type Definition
src/elements/content-preview/ContentPreview.js
Props interface adds three optional string-literal properties: accessPattern, previewMode, and sharedLinkAuth.
Preview Option Forwarding
src/elements/content-preview/ContentPreview.js
loadPreview destructures the new props from this.props and includes them in the previewOptions object passed to preview.show.
Tests
src/elements/content-preview/__tests__/ContentPreview.test.js
Two new test cases verify monitoring dimensions are forwarded into preview.show options when provided, and are undefined when omitted.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • box/box-ui-elements#4391: Both PRs modify ContentPreview's loadPreview behavior — the main PR forwards new preview options into preview.show while the retrieved PR adds a preview SDK load guard and tracking.
  • box/box-ui-elements#4452: Both PRs modify ContentPreview's initialization/loadPreview flow — the main PR adds forwarding of monitoring props while the retrieved PR adds an early-return when customPreviewContent is provided.
  • box/box-ui-elements#4494: Both PRs modify ContentPreview to add new props that are extracted and forwarded into the options passed to global.Box.Preview.show.

Suggested labels

ready-to-merge

Suggested reviewers

  • JChan106
  • shahzadaziz
  • bfoxx1906

Poem

🐰 Three props now flow through the Preview,
Monitoring dimensions set to arrive,
AccessPattern hops, PreviewMode thrives,
SharedLinkAuth joins the forwarder's drive! 🎯

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: forwarding monitoring dimensions to the preview library.
Description check ✅ Passed The description provides a clear summary, explains the purpose (monitoring dashboard support), references related tickets, and details the test plan with completed verification steps.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant