Skip to content

Commit

Permalink
fix: send spellchecked query to Backroom (#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarodE authored Jul 9, 2024
1 parent 6126323 commit fdb750e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import { QueryPreviewInfo } from '@empathyco/x-components/queries-preview';
import { UrlHandler } from '@empathyco/x-components/url';
import { SnippetConfigExtraParams } from '@empathyco/x-components/extra-params';
import { InternalSearchRequest } from '@empathyco/x-components/search';
import { InternalSearchRequest, InternalSearchResponse } from '@empathyco/x-components/search';
import { Component, Inject, Provide, Vue, Watch } from 'vue-property-decorator';
import { useDevice } from './composables/use-device.composable';
import currencies from './i18n/currencies';
Expand Down Expand Up @@ -60,8 +60,15 @@
}
@XOn(['SearchRequestChanged'])
setWysiwygContext(payload: InternalSearchRequest | null): void {
window.wysiwyg?.setContext({ query: payload?.query });
onSearchRequestChanged(payload: InternalSearchRequest | null): void {
window.wysiwyg?.setContext({ query: payload?.query, spellcheckedQuery: undefined });
}
@XOn(['SearchResponseChanged'])
onSearchResponseChanged(payload: InternalSearchResponse): void {
if (payload.spellcheck) {
window.wysiwyg?.setContext({ spellcheckedQuery: payload.spellcheck });
}
}
@XOn(['ParamsLoadedFromUrl'])
Expand Down
7 changes: 6 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ declare global {
requestAuth: () => Promise<void>;
open: () => Promise<void>;
close: () => Promise<void>;
setContext: (newContext: { query: string | undefined }) => void;
setContext: (
newContext: Partial<{
query: string | undefined;
spellcheckedQuery: string | undefined;
}>
) => void;
};
}
}
Expand Down

0 comments on commit fdb750e

Please sign in to comment.