chore: support Zendesk widget (#25517)
This commit is contained in:
parent
af7f67dc9c
commit
07d067d828
8 changed files with 155 additions and 35 deletions
21
web/app/components/base/zendesk/index.tsx
Normal file
21
web/app/components/base/zendesk/index.tsx
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import { memo } from 'react'
|
||||
import { type UnsafeUnwrappedHeaders, headers } from 'next/headers'
|
||||
import Script from 'next/script'
|
||||
import { IS_CE_EDITION, ZENDESK_WIDGET_KEY } from '@/config'
|
||||
|
||||
const Zendesk = () => {
|
||||
if (IS_CE_EDITION || !ZENDESK_WIDGET_KEY)
|
||||
return null
|
||||
|
||||
const nonce = process.env.NODE_ENV === 'production' ? (headers() as unknown as UnsafeUnwrappedHeaders).get('x-nonce') ?? '' : ''
|
||||
|
||||
return (
|
||||
<Script
|
||||
nonce={nonce ?? undefined}
|
||||
id="ze-snippet"
|
||||
src={`https://static.zdassets.com/ekr/snippet.js?key=${ZENDESK_WIDGET_KEY}`}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export default memo(Zendesk)
|
||||
Loading…
Add table
Add a link
Reference in a new issue