react-code-dataset / wp-calypso /packages /help-center /src /hooks /use-start-support-interaction.ts
react-code-dataset / wp-calypso /packages /help-center /src /hooks /use-start-support-interaction.ts
Download wp-calypso/packages/help-center/src/hooks/use-start-support-interaction.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 849 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/help-center/src/hooks/use-start-support-interaction.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/packages/help-center/src/hooks/use-start-support-interaction.ts
-
curl -L -o use-start-support-interaction.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/help-center/src/hooks/use-start-support-interaction.ts
849 Bytes
| import { HELP_CENTER_STORE } from '@automattic/help-center/src/stores'; | |
| import { useManageSupportInteraction } from '@automattic/odie-client/src/data'; | |
| import { useQueryClient } from '@tanstack/react-query'; | |
| import { useDispatch } from '@wordpress/data'; | |
| export const useStartSupportInteraction = () => { | |
| const { setCurrentSupportInteraction } = useDispatch( HELP_CENTER_STORE ); | |
| const { startNewInteraction } = useManageSupportInteraction(); | |
| const queryClient = useQueryClient(); | |
| const startInteraction = async () => { | |
| const interaction = await startNewInteraction( { | |
| event_source: 'help-center', | |
| event_external_id: crypto.randomUUID(), | |
| } ); | |
| await queryClient.invalidateQueries( { | |
| queryKey: [ 'support-interactions', 'get-interactions' ], | |
| } ); | |
| setCurrentSupportInteraction( interaction ); | |
| }; | |
| return startInteraction; | |
| }; | |