| 1 |
import { Button } from '@wordpress/components' |
| 2 |
import { __ } from '@wordpress/i18n' |
| 3 |
import { General } from '@library/api/General' |
| 4 |
import { useGlobalStore } from '@library/state/GlobalState' |
| 5 |
import { useUserStore } from '@library/state/User' |
| 6 |
|
| 7 |
export default function WelcomeNotice() { |
| 8 |
const setOpen = useGlobalStore((state) => state.setOpen) |
| 9 |
|
| 10 |
const disableLibrary = () => { |
| 11 |
const button = document.getElementById( |
| 12 |
'extendify-templates-inserter-btn', |
| 13 |
) |
| 14 |
button.classList.add('invisible') |
| 15 |
useUserStore.setState({ enabled: false }) |
| 16 |
setOpen(false) |
| 17 |
} |
| 18 |
|
| 19 |
return ( |
| 20 |
<> |
| 21 |
<span className="text-black"> |
| 22 |
{__('Welcome to the Extendify Library', 'extendify')} |
| 23 |
</span> |
| 24 |
<span className="px-2 opacity-50" aria-hidden="true"> |
| 25 |
| |
| 26 |
</span> |
| 27 |
<div className="flex items-center justify-center space-x-2"> |
| 28 |
<Button |
| 29 |
variant="link" |
| 30 |
className="h-auto p-0 text-black underline hover:no-underline" |
| 31 |
href={`https://extendify.com/welcome/?utm_source=${window.extendifyData.sdk_partner}&utm_medium=library&utm_campaign=welcome-notice&utm_content=tell-me-more`} |
| 32 |
onClick={async () => |
| 33 |
await General.ping('welcome-notice-tell-me-more-click') |
| 34 |
} |
| 35 |
target="_blank"> |
| 36 |
{__('Tell me more', 'extendify')} |
| 37 |
</Button> |
| 38 |
{window.extendifyData.standalone ? null : ( |
| 39 |
<> |
| 40 |
<span className="font-bold" aria-hidden="true"> |
| 41 |
• |
| 42 |
</span> |
| 43 |
<Button |
| 44 |
variant="link" |
| 45 |
className="h-auto p-0 text-black underline hover:no-underline" |
| 46 |
onClick={disableLibrary}> |
| 47 |
{__('Turn off the library', 'extendify')} |
| 48 |
</Button> |
| 49 |
</> |
| 50 |
)} |
| 51 |
</div> |
| 52 |
</> |
| 53 |
) |
| 54 |
} |
| 55 |
|