Skip to content

Commit

Permalink
Merge pull request #487 from empathyco/feat/set-wysiwyg-context
Browse files Browse the repository at this point in the history
feat: Emit Search context change for WYSIWYG
  • Loading branch information
alvarodE authored May 24, 2024
2 parents 8acd3ab + 39c2bc2 commit eae1a72
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +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 { 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 @@ -58,6 +59,11 @@
}
}
@XOn(['SearchRequestChanged'])
setWysiwygContext(payload: InternalSearchRequest | null): void {
window.wysiwyg?.setContext({ query: payload?.query });
}
@XOn(['ParamsLoadedFromUrl'])
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async requestAuthWysiwyg(payload: UrlParams): Promise<void> {
Expand Down
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ declare global {
requestAuth: () => Promise<void>;
open: () => Promise<void>;
close: () => Promise<void>;
setContext: (newContext: { query: string | undefined }) => void;
};
}
}
Expand Down

0 comments on commit eae1a72

Please sign in to comment.