Skip to content

feat(content-preview): forward monitoring dimensions#4542

Open
ahorowitz123 wants to merge 5 commits into
box:masterfrom
ahorowitz123:PREVIEW-225
Open

feat(content-preview): forward monitoring dimensions#4542
ahorowitz123 wants to merge 5 commits into
box:masterfrom
ahorowitz123:PREVIEW-225

Conversation

@ahorowitz123
Copy link
Copy Markdown
Contributor

@ahorowitz123 ahorowitz123 commented May 7, 2026

Summary

Accepts four new optional props on `` and threads them into `previewOptions` so the underlying Preview library can tag emitted `preview_metric` / `preview_error` events for a performance monitoring dashboard:

  • `accessPattern` — how the user reached preview (`file_list` / `direct_link` / `shared_link`)
  • `previewMode` — which preview surface (`default` / `shared_file` / `shared_folder` / `editable_shared_file` / `inline_feed`)
  • `sharedLinkAuth` — shared-link auth state (`logged_in` / `logged_out` / `na`)
  • `preloadStatus` — whether the host called `Preview.prefetch({preload: true})` for this fileId (`hit` / `miss`)

All four props are optional; when omitted the underlying library defaults behavior is preserved.

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

Summary by CodeRabbit

Release Notes

  • New Features
    • Content preview now includes support for additional configuration options: access patterns, preview modes, and shared link authentication states. These options enable customization of content display behavior across different sharing scenarios and access contexts, allowing the preview feature to adapt to various use cases and deployment environments throughout the application.

Review Change Stack

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

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: a785dd3c-5b77-421e-a4fc-35e0666b055b

📥 Commits

Reviewing files that changed from the base of the PR and between 2c24d63 and ced2cdf.

📒 Files selected for processing (2)
  • src/elements/content-preview/ContentPreview.js
  • src/elements/content-preview/__tests__/ContentPreview.test.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/elements/content-preview/tests/ContentPreview.test.js

Walkthrough

ContentPreview Props gain three optional monitoring fields (accessPattern, previewMode, sharedLinkAuth); loadPreview destructures and forwards them into the options passed to preview.show. Tests assert the fields are present when provided and undefined when omitted.

Changes

Preview Monitoring Dimensions

Layer / File(s) Summary
Props Type Definition
src/elements/content-preview/ContentPreview.js
Adds three optional string-literal properties: accessPattern, previewMode, and sharedLinkAuth.
Implementation: loadPreview
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
Adds tests asserting the monitoring dimensions are forwarded into preview.show options when provided and are undefined when omitted; removes a malformed trailing gap in prior tests.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

ready-to-merge

Suggested reviewers

  • jackiejou
  • shahzadaziz
  • jfox-box

Poem

🐰 I nudged three props into preview's song,
Softly forwarded where options belong.
Tests hopped in, checked both yes and none,
Metrics now ready — the work is done. 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding four monitoring dimension props to ContentPreview and threading them into previewOptions.
Description check ✅ Passed The PR description clearly documents the purpose, lists all four props with their value domains, explains the test plan, and confirms all tests pass.
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.

ahorowitz123 and others added 3 commits May 8, 2026 16:37
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) <noreply@anthropic.com>
box-content-preview now derives both signals internally. The wrapper
no longer accepts these props.

PREVIEW-225

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Wrapper accepts preloadStatus prop and threads it into previewOptions
so box-content-preview can tag emitted load/error/outcome events.

PREVIEW-225

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{}

@ahorowitz123 ahorowitz123 changed the title feat(content-preview): forward monitoring dimensions [PREVIEW-225] feat(content-preview): forward monitoring dimensions May 12, 2026
jmcbgaston
jmcbgaston previously approved these changes May 12, 2026
previewLibraryVersion: string,
requestInterceptor?: Function,
responseInterceptor?: Function,
accessPattern?: 'file_list' | 'direct_link' | 'shared_link',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we sort these new props, looks like current ones are sorted

Addresses PR comment: merge the 4 new monitoring-dimension props into
alphabetical order with the existing Props type members.

PREVIEW-225

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

3 participants