Skip to content

[SCAL-336732] Add an isDarkMode option to the embed config - #672

Merged
harshitbhardwaj-ts merged 10 commits into
mainfrom
SCAL-336732-SDK-changes
Oct 1, 2026
Merged

harshitbhardwaj-ts merged 10 commits into
mainfrom
SCAL-336732-SDK-changes

Conversation

@msk052002

@msk052002 msk052002 commented Sep 16, 2026 •

Copy link
Copy Markdown
Collaborator

Let an embed host choose the appearance of the embedded application without reaching for additionalFlags

The value travels as a query param on the iframe URL, so the embedded application has it from its first load.

  • Add EmbedConfig.isDarkMode, the default for every embed on the page
  • Add BaseViewConfig.isDarkMode, so one embed can override that
  • Add Param.IsDarkMode and emit it from getBaseQueryParams, the base query params every embed type builds on
  • Resolve the two levels with ??, so that an explicit view-level false overrides an init-level true
  • Omit the param entirely when neither level sets it, keeping the URL short for the hosts that never ask for a dark embed
  • When it is true, also send radiantThemeEnabled: true, because the application's dark mode lives in its radiant theme; a host can still override that through additionalFlags
  • Keep both params in BOOTSTRAP_URL_PARAMS, so they stay on the URL when excludeConfigFromURL is set; without that, the embed flickered on load until they arrived over UpdateEmbedParams
  • Cover both config levels, an explicit false, the omitted case, the additionalFlags override and the excludeConfigFromURL case

Let an embed host choose the appearance of the embedded application
without reaching for additionalFlags, the generic escape hatch whose
own doc comment warns it is for advanced use only and that we do not
publish the supported keys for.

The value travels as a query param on the iframe URL, so the embedded
application has it before first paint and renders dark with no flash
of the light theme.

- Add EmbedConfig.darkMode, the appearance for every embed on the page
- Add BaseViewConfig.darkMode, so one embed can override that
- Add Param.DarkMode and emit it from getBaseQueryParams, the single
  origin of the query params for every embed type
- Resolve the two levels with ??, so that an explicit view-level false
  overrides an init-level true and only undefined falls through
- Omit the param entirely when neither level sets it, keeping the URL
  short for the hosts that never ask for a dark embed
- Cover both config levels, an explicit false and the omitted case

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@msk052002
msk052002 requested a review from a team as a code owner September 16, 2026 09:03

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request introduces support for a darkMode option, allowing the embedded application to be rendered in dark or light appearance. It adds darkMode configuration options to both EmbedConfig and BaseViewConfig, updates the query parameter generation in TsEmbed, and includes comprehensive unit tests. The review feedback highlights two style guide violations in the JSDoc code examples within src/types.ts: one example is missing a closing }); for an init() call, and another uses invalid placeholder syntax instead of valid JavaScript/TypeScript.

Comment thread src/types.ts Outdated
Comment thread src/types.ts Outdated
@pkg-pr-new

pkg-pr-new Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@thoughtspot/visual-embed-sdk@672

commit: c441771

Review feedback on the code examples in the darkMode doc comments,
against the two style guide rules under Code Example Integrity.

- Close the init() example with `});`, per the rule that init() calls
  in examples must include it
- Name a concrete component in the view config example instead of
  `new <EmbedComponent>(...)`, which is not valid JavaScript
- Line up the indentation inside the view config example

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Comment thread src/types.ts Outdated
Comment thread src/types.ts Outdated

@shivam-kumar-ts shivam-kumar-ts left a comment •

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.

LGTM

@harshitbhardwaj-ts harshitbhardwaj-ts changed the title [SCAL-336732]-SDK changes Add a first-class darkMode option to the embed config [SCAL-336732] Add an isDarkMode option to the embed config Sep 29, 2026
Comment thread src/embed/ts-embed.ts
Comment thread src/types.ts Outdated

@shivam-kumar-ts shivam-kumar-ts left a comment

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.

LGTM

@harshitbhardwaj-ts
harshitbhardwaj-ts merged commit 3116014 into main Oct 1, 2026
16 checks passed
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.

4 participants