Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/embed/app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3293,6 +3293,26 @@ describe('AppEmbed getEmbedParamsObject', () => {

expect(params.isFullHeightPinboard).toBeUndefined();
});

test('getUpdateEmbedParamsObject should send the Spotter embedParams at the top level', async () => {
const spotterViz = { brandName: 'MyBrand' };
const starterPrompts = { enable: true };
const appEmbed = new AppEmbed(getRootEl(), {
...defaultViewConfig,
spotterViz,
spotterChatConfig: { starterPrompts },
spotterSidebarConfig: { enableSpotterInstructionAndMoreSettings: true },
enablePastConversationsSidebar: false,
} as AppViewConfig);

const params = await (appEmbed as any).getUpdateEmbedParamsObject();

expect(params.embedParams).toBeUndefined();
expect(params.spotterVizConfig).toEqual(spotterViz);
expect(params.starterPrompts).toEqual(starterPrompts);
expect(params.enableSpotterInstructionAndMoreSettings).toBe(true);
expect(params.spotterSidebarConfig).toEqual({ enablePastConversationsSidebar: false });
});
});

describe('AppEmbed updatedSpotterExperience tests', () => {
Expand Down
4 changes: 3 additions & 1 deletion src/embed/ts-embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -903,11 +903,13 @@ export class TsEmbed {
Object.keys(queryParams).forEach((key) => {
queryParams[key] = deserializeParam(queryParams[key]);
});
const appInitData = await this.getAppInitData();
const { embedParams, ...appInitData }: Record<string, any> = await this.getAppInitData();
return {
...this.viewConfig,
...queryParams,
...appInitData,
// The app reads these top-level, as it flattens APP_INIT's copy.
...embedParams,
// A show cycle has no URL to carry these, so the payload always
// states them — including "none", which is the case that leaks the
// previous filters.
Expand Down
Loading