import React, { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import copy from 'copy-to-clipboard' import style from './style.module.css' import cn from '@/utils/classnames' import Modal from '@/app/components/base/modal' import copyStyle from '@/app/components/base/copy-btn/style.module.css' import Tooltip from '@/app/components/base/tooltip' import { useAppContext } from '@/context/app-context' import { IS_CE_EDITION } from '@/config' import type { SiteInfo } from '@/models/share' import { useThemeContext } from '@/app/components/base/chat/embedded-chatbot/theme/theme-context' type Props = { siteInfo?: SiteInfo isShow: boolean onClose: () => void accessToken: string appBaseUrl: string className?: string } const OPTION_MAP = { iframe: { getContent: (url: string, token: string) => ``, }, scripts: { getContent: (url: string, token: string, primaryColor: string, isTestEnv?: boolean) => ` `, }, chromePlugin: { getContent: (url: string, token: string) => `ChatBot URL: ${url}/chatbot/${token}`, }, } const prefixEmbedded = 'appOverview.overview.appInfo.embedded' type Option = keyof typeof OPTION_MAP type OptionStatus = { iframe: boolean scripts: boolean chromePlugin: boolean } const Embedded = ({ siteInfo, isShow, onClose, appBaseUrl, accessToken, className }: Props) => { const { t } = useTranslation() const [option, setOption] = useState