react-code-dataset / wp-calypso /client /signup /help-center-step-button /use-should-render-help-center-button.ts
react-code-dataset / wp-calypso /client /signup /help-center-step-button /use-should-render-help-center-button.ts
Download wp-calypso/client/signup/help-center-step-button/use-should-render-help-center-button.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 634 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/signup/help-center-step-button/use-should-render-help-center-button.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/signup/help-center-step-button/use-should-render-help-center-button.ts
-
curl -L -o use-should-render-help-center-button.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/signup/help-center-step-button/use-should-render-help-center-button.ts
634 Bytes
| import { useSupportStatus } from '@automattic/help-center/src/data/use-support-status'; | |
| import { useLocale } from '@automattic/i18n-utils'; | |
| import { isDIFMFlow } from '@automattic/onboarding'; | |
| export default function useShouldRenderHelpCenterButton( { | |
| flowName, | |
| enabledLocales, | |
| }: { | |
| flowName: string; | |
| enabledLocales?: string[]; | |
| } ) { | |
| const locale = useLocale(); | |
| const { data: supportStatus } = useSupportStatus(); | |
| if ( isDIFMFlow( flowName ) ) { | |
| if ( ! supportStatus?.availability.is_difm_chat_open ) { | |
| return false; | |
| } | |
| } | |
| if ( ! locale || ! enabledLocales?.includes( locale ) ) { | |
| return false; | |
| } | |
| return true; | |
| } | |