Skip to content

[SCAL-336732]-SDK changes Add a first-class darkMode option to the embed config - #672

Open
msk052002 wants to merge 4 commits into
mainfrom
SCAL-336732-SDK-changes
Open

msk052002 wants to merge 4 commits into
mainfrom
SCAL-336732-SDK-changes

Conversation

@msk052002

Copy link
Copy Markdown
Collaborator

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

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) <[email protected]>
@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 on lines +569 to +572
* init({
* ...embedConfig,
* darkMode: true,
* })

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.

medium

The code example for init() is missing the closing });. According to the style guide (rule #65), init() calls in examples must be complete to be syntactically valid.

Suggested change
* init({
* ...embedConfig,
* darkMode: true,
* })
init({
...embedConfig,
darkMode: true,
});
References
  1. Rule test-exported memb #65: init() calls in examples must include the closing });. (link)

Comment thread src/types.ts Outdated
Comment on lines +1171 to +1175
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed, SearchEmbed, or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* darkMode: true,
* });

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.

medium

The code example uses which is not valid JavaScript/TypeScript syntax, violating style guide rule #61. Additionally, the indentation within the code block is inconsistent. Please use a concrete component name for the example and ensure consistent indentation for better readability.

Suggested change
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed, SearchEmbed, or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* darkMode: true,
* });
// Replace AppEmbed with a specific embed component like SearchEmbed or LiveboardEmbed
const embed = new AppEmbed('#tsEmbed', {
... // other embed view config
darkMode: true,
});
References
  1. Rule SCAL-232534 - Added flags to enable disable spotter features #61: Code examples must use syntactically valid JavaScript/TypeScript. (link)

@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: ef6b1ab

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) <[email protected]>
Comment thread src/types.ts Outdated
* The host application owns the appearance of an embed, so this overrides
* the appearance preference of the signed-in user and the color scheme of
* their operating system. Leave it unset to render in light appearance.
* @version SDK: 1.53.0 | ThoughtSpot Cloud: 26.10.0.cl

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.

who this is 26.10.0.cl are we doing mcp?

Comment thread src/types.ts Outdated
* The host application owns the appearance of an embed, so this overrides
* the appearance preference of the signed-in user and the color scheme of
* their operating system. Leave it unset to render in light appearance.
* @version SDK: 1.53.0 | ThoughtSpot Cloud: 26.11.0.cl

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.

it will be 54
@version SDK: 1.50.0 | ThoughtSpot Cloud: 26.7.0.cl

@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

This branch has not been deployed

No deployments
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.

2 participants