Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
refactor(web): scope website embedding previews to their dialog (#43522)
yyhbc47710c2ae0
diff --git a/web/app/components/app/access-point/__tests__/web-app-card.spec.tsx b/web/app/components/app/access-point/__tests__/web-app-card.spec.tsxindex d4b61cf917e..df14cae72d6 100644--- a/web/app/components/app/access-point/__tests__/web-app-card.spec.tsx+++ b/web/app/components/app/access-point/__tests__/web-app-card.spec.tsx@@ -8,6 +8,7 @@ import { useStore as useAppStore } from '@/app/components/app/store'import { BlockEnum, InputVarType } from '@/app/components/workflow/types'import { toast } from '@/app/notifications'import { AccessMode } from '@/models/access-control'+import { seedAccountProfileQuery } from '@/test/console/account-profile'import { render } from '@/test/console/render'import { createAppDetailFixture, createAppSiteFixture } from '@/test/fixtures/app'import { createTestQueryClient } from '@/test/query-client'@@ -28,32 +29,37 @@ vi.mock('@/app/notifications', () => ({},}))-vi.mock('@/service/console', () => ({- consoleQuery: {- apps: {- byAppId: {- siteEnable: {- post: {- mutationOptions: (options = {}) => ({- mutationFn: mocks.siteEnable,- ...options,- }),- },- },- site: {- accessTokenReset: {+vi.mock('@/service/console', async (importOriginal) => {+ const actual = await importOriginal<typeof import('@/service/console')>()+ return {+ ...actual,+ consoleQuery: {+ account: actual.consoleQuery.account,+ apps: {+ byAppId: {+ siteEnable: {post: {mutationOptions: (options = {}) => ({- mutationFn: mocks.resetSiteAccessToken,+ mutationFn: mocks.siteEnable,...options,}),},},+ site: {+ accessTokenReset: {+ post: {+ mutationOptions: (options = {}) => ({+ mutationFn: mocks.resetSiteAccessToken,+ ...options,+ }),+ },+ },+ },},},},- },-}))+ }+})vi.mock('@/service/access-control/use-app-access-control', async (importOriginal) => {const actual =@@ -96,21 +102,6 @@ vi.mock('@/app/components/app/overview/settings', () => ({default: () => null,}))-vi.mock('@/app/components/app/overview/embedded', () => ({- default: ({- hiddenInputs = [],- isShow,- }: {- hiddenInputs?: Array<{ variable: string }>- isShow: boolean- }) =>- isShow ? (- <div role="dialog" aria-label="embed into site">- {hiddenInputs.map((input) => input.variable).join(',')}- </div>- ) : null,-}))-function createAppInfo(mode: AppModeEnum): AppDetailWithSite {return createAppDetailFixture({access_mode: AccessMode.PUBLIC,@@ -151,6 +142,7 @@ function renderCard(appDetail: { ...createAppInfo(mode), ...appOverrides, access_mode: accessMode },})const queryClient = createTestQueryClient()+ seedAccountProfileQuery(queryClient)queryClient.setQueryData(['system-features'], {webapp_auth: { enabled: showAccessControl },})@@ -403,7 +395,9 @@ describe('WebAppAccessPointCard', () => {await user.click(screen.getByRole('button', { name: /embedIntoSite/ }))- expect(screen.getByRole('dialog', { name: 'embed into site' })).toBeInTheDocument()+ expect(+ screen.getByRole('dialog', { name: 'appOverview.overview.appInfo.embedded.title' }),+ ).toBeInTheDocument()})it('updates site status through the generated contract', async () => {@@ -464,7 +458,8 @@ describe('WebAppAccessPointCard', () => {await user.click(screen.getByRole('button', { name: /embedIntoSite/ }))- expect(screen.getByRole('dialog', { name: 'embed into site' })).toHaveTextContent('secret')+ await user.click(screen.getByRole('button', { name: /hiddenInputs.title/ }))+ expect(screen.getByLabelText('Secret')).toBeInTheDocument()})it('configures hidden workflow inputs before opening the Web App', async () => {diff --git a/web/app/components/app/access-point/built-in-access-points/web-app-card.tsx b/web/app/components/app/access-point/built-in-access-points/web-app-card.tsxindex 790b91aac06..dd1722c6c51 100644--- a/web/app/components/app/access-point/built-in-access-points/web-app-card.tsx+++ b/web/app/components/app/access-point/built-in-access-points/web-app-card.tsx@@ -17,12 +17,13 @@ import {AlertDialogTitle,} from '@langgenius/dify-ui/alert-dialog'import { Button } from '@langgenius/dify-ui/button'+import { Dialog, DialogTrigger } from '@langgenius/dify-ui/dialog'import { useMutation } from '@tanstack/react-query'import { useState } from 'react'import { useTranslation } from 'react-i18next'import AccessControl from '@/app/components/app/app-access-control'import { CustomizeDialog } from '@/app/components/app/overview/customize'-import EmbeddedModal from '@/app/components/app/overview/embedded'+import { EmbeddedDialogContent } from '@/app/components/app/overview/embedded'import SettingsModal from '@/app/components/app/overview/settings'import { WorkflowLaunchDialog } from '@/app/components/app/overview/workflow-launch-dialog'import { useStore as useAppStore } from '@/app/components/app/store'@@ -92,7 +93,6 @@ export function WebAppAccessPointCard({])const setAppDetail = useAppStore((state) => state.setAppDetail)const [showSettings, setShowSettings] = useState(false)- const [showEmbedded, setShowEmbedded] = useState(false)const [showAccess, setShowAccess] = useState(false)const [showRegenerate, setShowRegenerate] = useState(false)const [showWorkflowLaunch, setShowWorkflowLaunch] = useState(false)@@ -218,15 +218,23 @@ export function WebAppAccessPointCard({</Button>)}{supportsEmbedded && (- <Button- className="flex items-center gap-1 px-3"- variant="secondary"- disabled={!actionsAvailable || !canManageAccessPoint}- onClick={() => setShowEmbedded(true)}- >- <span aria-hidden className="i-ri-window-line size-4" />- {t(($) => $['studio.accessPoint.embedIntoSite'], { ns: 'deployments' })}- </Button>+ <Dialog>+ <DialogTrigger+ disabled={!actionsAvailable || !canManageAccessPoint || !site?.access_token}+ render={<Button variant="secondary" className="px-3" />}+ >+ <span aria-hidden className="i-ri-window-line size-4" />+ {t(($) => $['studio.accessPoint.embedIntoSite'], { ns: 'deployments' })}+ </DialogTrigger>+ {site?.access_token && (+ <EmbeddedDialogContent+ siteInfo={site}+ appBaseUrl={site.app_base_url}+ accessToken={site.access_token}+ hiddenInputs={hiddenLaunchVariables}+ />+ )}+ </Dialog>)}<CustomizeDialogappId={appInfo.id}@@ -294,16 +302,6 @@ export function WebAppAccessPointCard({onSave={onSaveSiteConfig}/>)}- {supportsEmbedded && site?.access_token && (- <EmbeddedModal- siteInfo={site}- isShow={showEmbedded}- onClose={() => setShowEmbedded(false)}- appBaseUrl={site.app_base_url}- accessToken={site.access_token}- hiddenInputs={hiddenLaunchVariables}- />- )}{showAccess && (<AccessControlapp={appInfo}diff --git a/web/app/components/app/overview/embedded/__tests__/embedded-dialog.browser.spec.tsx b/web/app/components/app/overview/embedded/__tests__/embedded-dialog.browser.spec.tsxnew file mode 100644index 00000000000..1c411925119--- /dev/null+++ b/web/app/components/app/overview/embedded/__tests__/embedded-dialog.browser.spec.tsx@@ -0,0 +1,183 @@+import { Dialog, DialogTrigger } from '@langgenius/dify-ui/dialog'+import { QueryClient, QueryClientProvider } from '@tanstack/react-query'+import copy from 'copy-to-clipboard'+import { userEvent } from 'vite-plus/test/browser'+import { render } from 'vitest-browser-react'+import { InputVarType } from '@/app/components/workflow/types'+import { seedAccountProfileQuery } from '@/test/console/account-profile'+import { EmbeddedDialogContent } from '../index'++const { getProfile } = vi.hoisted(() => ({ getProfile: vi.fn() }))++vi.mock('copy-to-clipboard', () => ({ default: vi.fn() }))+vi.mock('@/service/base', () => ({+ get: getProfile,+ post: vi.fn(),+ request: vi.fn(),+ getPublic: vi.fn(),+ getMarketplace: vi.fn(),+ postPublic: vi.fn(),+ postMarketplace: vi.fn(),+ put: vi.fn(),+ del: vi.fn(),+ delPublic: vi.fn(),+ patch: vi.fn(),+ patchPublic: vi.fn(),+ upload: vi.fn(),+ ssePost: vi.fn(),+ sseGet: vi.fn(),+ sseGeneratorPost: vi.fn(),+ handleStream: vi.fn(),+ buildSigninUrlWithRedirect: vi.fn(),+ isWebAppSigninPath: vi.fn(),+ buildWebAppSigninUrlWithRedirect: vi.fn(),+}))++const prefix = 'appOverview.overview.appInfo.embedded'+const triggerLabel = 'deployments.studio.accessPoint.embedIntoSite'+const hiddenInputs = [+ {+ variable: 'secret',+ label: 'Secret',+ type: InputVarType.textInput,+ hide: true,+ required: true,+ default: 'initial value',+ },+]++function createClient() {+ return new QueryClient({ defaultOptions: { queries: { staleTime: Infinity, retry: false } } })+}++function dialogView(queryClient: QueryClient) {+ return (+ <QueryClientProvider client={queryClient}>+ <Dialog>+ <DialogTrigger>{triggerLabel}</DialogTrigger>+ <EmbeddedDialogContent+ accessToken="embed-token"+ appBaseUrl="https://app.example.com"+ hiddenInputs={hiddenInputs}+ />+ </Dialog>+ </QueryClientProvider>+ )+}++beforeEach(() => {+ vi.clearAllMocks()+})++afterEach(() => vi.unstubAllGlobals())++it('keeps Close focused while account data loads and returns to the keyboard trigger', async () => {+ const queryClient = createClient()+ const { profile } = seedAccountProfileQuery(createClient())+ let resolveProfile!: (response: Response) => void+ getProfile.mockReturnValueOnce(+ new Promise<Response>((resolve) => {+ resolveProfile = resolve+ }),+ )+ const screen = await render(dialogView(queryClient))+ const trigger = screen.getByRole('button', { name: triggerLabel })+ await userEvent.tab()+ await expect.element(trigger).toHaveFocus()+ await userEvent.keyboard('{Enter}')+ const dialog = screen.getByRole('dialog', { name: `${prefix}.title` })+ const close = dialog.getByRole('button', { name: 'common.operation.close' })+ await expect.element(close).toHaveFocus()+ const initialClose = close.element()+ await expect.poll(() => getProfile.mock.calls.length).toBe(1)+ await expect+ .element(dialog.getByRole('tab', { name: `${prefix}.iframe` }))+ .not.toBeInTheDocument()++ resolveProfile(+ new Response(JSON.stringify(profile), {+ headers: { 'content-type': 'application/json', 'x-env': 'PRODUCTION' },+ }),+ )+ await expect.element(dialog.getByRole('tab', { name: `${prefix}.iframe` })).toBeVisible()+ expect(close.element()).toBe(initialClose)+ await expect.element(close).toHaveFocus()+ await userEvent.keyboard('{Escape}')+ await expect.element(dialog).not.toBeInTheDocument()+ await expect.element(trigger).toHaveFocus()+})++it('preserves the hidden input, selected tab and copied preview through exit, then starts fresh', async () => {+ vi.stubGlobal('BASE_UI_ANIMATIONS_DISABLED', false)+ const queryClient = createClient()+ seedAccountProfileQuery(queryClient)+ const screen = await render(dialogView(queryClient))+ const trigger = screen.getByRole('button', { name: triggerLabel })+ await trigger.click()+ const dialog = screen.getByRole('dialog', { name: `${prefix}.title` })+ const disclosure = dialog.getByRole('button', {+ name: new RegExp(`${prefix}.hiddenInputs.title`),+ })+ await expect.element(disclosure).toHaveAttribute('aria-expanded', 'false')+ await disclosure.click()+ const input = dialog.getByRole('textbox', { name: 'Secret' })+ await input.fill('draft secret')+ const scriptsTab = dialog.getByRole('tab', { name: `${prefix}.scripts` })+ await scriptsTab.click()+ const panel = dialog.getByRole('tabpanel', { name: `${prefix}.scripts` })+ await expect.poll(() => panel.element().textContent).toContain('draft secret')+ await panel.getByRole('button', { name: `${prefix}.copy`, exact: true }).click()+ const copied = panel.getByRole('button', { name: `${prefix}.copied`, exact: true })+ await expect.element(copied).toBeVisible()+ expect(copy).toHaveBeenLastCalledWith(expect.stringContaining('draft secret'))++ const popup = dialog.element()+ const draftInput = input.element() as HTMLInputElement+ const activeTab = scriptsTab.element()+ const preview = panel.element()+ const copyButton = copied.element()+ await expect.poll(() => getComputedStyle(popup).opacity).toBe('1')+ const exitFrame = new Promise<{+ draft: string+ selected: string | null+ preview: string | null+ copied: string | null+ opacity: number+ }>((resolve) => {+ const onTransition = (event: Event) => {+ if (event.target !== popup || (event as TransitionEvent).propertyName !== 'opacity') return+ popup.removeEventListener('transitionrun', onTransition)+ resolve({+ draft: draftInput.value,+ selected: activeTab.getAttribute('aria-selected'),+ preview: preview.textContent,+ copied: copyButton.getAttribute('aria-label'),+ opacity: Number(getComputedStyle(popup).opacity),+ })+ }+ popup.addEventListener('transitionrun', onTransition)+ })+ await dialog.getByRole('button', { name: 'common.operation.close' }).click()+ const closing = await exitFrame+ expect(closing.opacity).toBeGreaterThan(0)+ expect(closing.draft).toBe('draft secret')+ expect(closing.selected).toBe('true')+ expect(closing.preview).toContain('draft secret')+ expect(closing.copied).toBe(`${prefix}.copied`)+ await expect.element(dialog).not.toBeInTheDocument()+ await expect.element(trigger).toHaveFocus()++ await userEvent.keyboard(' ')+ await expect+ .element(dialog.getByRole('tab', { name: `${prefix}.iframe` }))+ .toHaveAttribute('aria-selected', 'true')+ await expect.element(disclosure).toHaveAttribute('aria-expanded', 'false')+ await expect+ .element(dialog.getByRole('button', { name: `${prefix}.copy`, exact: true }))+ .toBeVisible()+ await disclosure.click()+ await expect.element(input).toHaveValue('initial value')+ await userEvent.keyboard('{Escape}')+ await expect.element(dialog).not.toBeInTheDocument()+ await expect.element(trigger).toHaveFocus()+})diff --git a/web/app/components/app/overview/embedded/__tests__/index.spec.tsx b/web/app/components/app/overview/embedded/__tests__/index.spec.tsxindex eff6e8da9fd..0fc2168fba1 100644--- a/web/app/components/app/overview/embedded/__tests__/index.spec.tsx+++ b/web/app/components/app/overview/embedded/__tests__/index.spec.tsx@@ -1,4 +1,6 @@+import type { ComponentProps } from 'react'import type { SiteInfo } from '@/models/share'+import { Dialog, DialogTrigger } from '@langgenius/dify-ui/dialog'import { fireEvent, screen, waitFor, within } from '@testing-library/react'import userEvent from '@testing-library/user-event'import copy from 'copy-to-clipboard'@@ -7,7 +9,7 @@ import { act } from 'react'import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from 'vite-plus/test'import { InputVarType } from '@/app/components/workflow/types'import { renderWithConsoleQuery as render } from '@/test/console/query-data'-import Embedded from '../index'+import { EmbeddedDialogContent } from '../index'vi.mock('../style.module.css', () => ({default: {@@ -33,17 +35,23 @@ const siteInfo: SiteInfo = {}const baseProps = {- isShow: true,siteInfo,- onClose: vi.fn(),appBaseUrl: 'https://app.example.com',accessToken: 'token',- className: 'custom-modal',+}++function EmbeddedDialog(props: ComponentProps<typeof EmbeddedDialogContent>) {+ return (+ <Dialog>+ <DialogTrigger>embedIntoSite</DialogTrigger>+ <EmbeddedDialogContent {...props} />+ </Dialog>+ )}const getCopyButton = () => screen.getByRole('button', { name: /copy/i })-describe('Embedded', () => {+describe('EmbeddedDialog', () => {beforeAll(() => {class MockCompressionStream {readable: ReadableStream<Uint8Array>@@ -74,8 +82,9 @@ describe('Embedded', () => {const user = userEvent.setup()await act(async () => {- render(<Embedded {...baseProps} />)+ render(<EmbeddedDialog {...baseProps} />)})+ await user.click(screen.getByRole('button', { name: /embedIntoSite/ }))await waitFor(() => {expect(@@ -97,8 +106,9 @@ describe('Embedded', () => {it('links each embed method tab to a panel and supports arrow key selection', async () => {const user = userEvent.setup()await act(async () => {- render(<Embedded {...baseProps} />)+ render(<EmbeddedDialog {...baseProps} />)})+ await user.click(screen.getByRole('button', { name: /embedIntoSite/ }))const iframe = screen.getByRole('tab', {name: 'appOverview.overview.appInfo.embedded.iframe',@@ -135,8 +145,9 @@ describe('Embedded', () => {it('opens chrome plugin store link when chrome option selected', async () => {const user = userEvent.setup()await act(async () => {- render(<Embedded {...baseProps} />)+ render(<EmbeddedDialog {...baseProps} />)})+ await user.click(screen.getByRole('button', { name: /embedIntoSite/ }))await user.click(screen.getByRole('tab', {@@ -157,23 +168,25 @@ describe('Embedded', () => {)})- it('calls onClose when the close button is clicked', async () => {+ it('starts a fresh tab session after closing and reopening', async () => {const user = userEvent.setup()- const onClose = vi.fn()-- await act(async () => {- render(<Embedded {...baseProps} onClose={onClose} />)- })-+ render(<EmbeddedDialog {...baseProps} />)+ const trigger = screen.getByRole('button', { name: /embedIntoSite/ })+ await user.click(trigger)+ await user.click(screen.getByRole('tab', { name: /embedded.scripts/ }))await user.click(screen.getByRole('button', { name: 'common.operation.close' }))-- expect(onClose).toHaveBeenCalledTimes(1)+ await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument())+ await user.click(trigger)+ expect(screen.getByRole('tab', { name: /embedded.iframe/ })).toHaveAttribute(+ 'aria-selected',+ 'true',+ )})it('keeps hidden inputs collapsed by default and updates iframe and script content when values change', async () => {const user = userEvent.setup()render(- <Embedded+ <EmbeddedDialog{...baseProps}hiddenInputs={[{@@ -188,6 +201,8 @@ describe('Embedded', () => {/>,)+ await user.click(screen.getByRole('button', { name: /embedIntoSite/ }))+expect(screen.queryByLabelText('Secret')).not.toBeInTheDocument()await act(async () => {@@ -231,8 +246,9 @@ describe('Embedded', () => {const user = userEvent.setup()await act(async () => {- render(<Embedded {...baseProps} />)+ render(<EmbeddedDialog {...baseProps} />)})+ await user.click(screen.getByRole('button', { name: /embedIntoSite/ }))await user.click(screen.getByRole('tab', {@@ -258,8 +274,9 @@ describe('Embedded', () => {const user = userEvent.setup()await act(async () => {- render(<Embedded {...baseProps} />)+ render(<EmbeddedDialog {...baseProps} />)})+ await user.click(screen.getByRole('button', { name: /embedIntoSite/ }))await user.click(screen.getByRole('tab', {diff --git a/web/app/components/app/overview/embedded/index.tsx b/web/app/components/app/overview/embedded/index.tsxindex 913d3476a97..c633c6d1352 100644--- a/web/app/components/app/overview/embedded/index.tsx+++ b/web/app/components/app/overview/embedded/index.tsx@@ -6,7 +6,13 @@ import type {WorkflowLaunchInputValue,} from '../app-card-utils'import { cn } from '@langgenius/dify-ui/cn'-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'+import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from '@langgenius/dify-ui/collapsible'+import {+ DialogClose,+ DialogContent,+ DialogDescription,+ DialogTitle,+} from '@langgenius/dify-ui/dialog'import { IconButton } from '@langgenius/dify-ui/icon-button'import { Tabs, TabsList, TabsPanel, TabsTab } from '@langgenius/dify-ui/tabs'import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip'@@ -29,15 +35,12 @@ import {import WorkflowHiddenInputFields from '../workflow-hidden-input-fields'import style from './style.module.css'-type Props = Readonly<{+type EmbeddedDialogContentProps = Readonly<{siteInfo?: Partial<Pick<AppDetailSiteResponse, 'chat_color_theme' | 'chat_color_theme_inverted'>>- isShow: boolean- onClose: () => void- accessToken?: string+ accessToken: stringappBaseUrl?: stringwebAppRoute?: EmbeddedWebAppRoutehiddenInputs?: WorkflowHiddenStartVariable[]- className?: string}>const OPTION_KEYS = ['iframe', 'scripts', 'chromePlugin'] as const@@ -114,8 +117,8 @@ const EmbeddedContent = ({accessToken,webAppRoute = 'chatbot',hiddenInputs,-}: Required<Pick<Props, 'accessToken' | 'appBaseUrl'>> &- Pick<Props, 'siteInfo' | 'webAppRoute' | 'hiddenInputs'>) => {+}: Required<Pick<EmbeddedDialogContentProps, 'accessToken' | 'appBaseUrl'>> &+ Pick<EmbeddedDialogContentProps, 'siteInfo' | 'webAppRoute' | 'hiddenInputs'>) => {const { t } = useTranslation(['appOverview'])const supportedHiddenInputs = useMemo<WorkflowHiddenStartVariable[]>(() => (hiddenInputs ?? []).filter(isWorkflowLaunchInputSupported),@@ -127,7 +130,6 @@ const EmbeddedContent = ({)const [option, setOption] = useState<Option>('iframe')const [copiedOption, setCopiedOption] = useState<Option | null>(null)- const [hiddenInputsCollapsed, setHiddenInputsCollapsed] = useState(true)const [hiddenInputValues, setHiddenInputValues] = useState<Record<string, WorkflowLaunchInputValue>>(() => initialHiddenInputValues)@@ -213,16 +215,12 @@ const EmbeddedContent = ({return (<>- <div className="mt-8 mb-4 system-sm-medium text-text-primary">+ <DialogDescription className="mt-8 mb-4 system-sm-medium text-text-primary">{t(($) => $[`${prefixEmbedded}.explanation`], { ns: 'appOverview' })}- </div>+ </DialogDescription>{supportedHiddenInputs.length > 0 && (- <div className="mb-6 rounded-xl border-[0.5px] border-components-panel-border bg-background-section">- <button- type="button"- className="flex w-full items-center justify-between gap-3 px-4 py-3 text-left"- onClick={() => setHiddenInputsCollapsed((prev) => !prev)}- >+ <Collapsible className="mb-6 rounded-xl border-[0.5px] border-components-panel-border bg-background-section">+ <CollapsibleTrigger className="group flex w-full items-center justify-between gap-3 rounded-xl px-4 py-3 text-left"><div><div className="system-sm-medium text-text-primary">{t(($) => $[`${prefixEmbedded}.hiddenInputs.title`], { ns: 'appOverview' })}@@ -231,19 +229,12 @@ const EmbeddedContent = ({{t(($) => $[`${prefixEmbedded}.hiddenInputs.description`], { ns: 'appOverview' })}</div></div>- {hiddenInputsCollapsed ? (- <span- aria-hidden- className="i-ri-arrow-right-s-line size-4 shrink-0 text-text-tertiary"- />- ) : (- <span- aria-hidden- className="i-ri-arrow-down-s-line size-4 shrink-0 text-text-tertiary"- />- )}- </button>- {!hiddenInputsCollapsed && (+ <span+ aria-hidden+ className="i-ri-arrow-right-s-line size-4 shrink-0 text-text-tertiary group-data-panel-open:rotate-90"+ />+ </CollapsibleTrigger>+ <CollapsiblePanel><div className="max-h-72 space-y-4 overflow-y-auto border-t-[0.5px] border-divider-subtle px-4 py-4"><WorkflowHiddenInputFieldshiddenVariables={supportedHiddenInputs}@@ -252,8 +243,8 @@ const EmbeddedContent = ({fieldIdPrefix="embedded-hidden-input"/></div>- )}- </div>+ </CollapsiblePanel>+ </Collapsible>)}<Tabsvalue={option}@@ -368,58 +359,47 @@ const EmbeddedContent = ({)}-const Embedded = ({+export function EmbeddedDialogContent({siteInfo,- isShow,- onClose,appBaseUrl,accessToken,webAppRoute = 'chatbot',hiddenInputs,- className,-}: Props) => {+}: EmbeddedDialogContentProps) {const { t } = useTranslation(['appOverview', 'common'])return (- <Dialog- open={isShow}- onOpenChange={(open) => {- if (open) return- onClose()- }}- >- <DialogContent- className={cn('flex max-h-[calc(100dvh-2rem)] w-160 flex-col overflow-hidden!', className)}- >- <DialogTitle className="shrink-0 title-2xl-semi-bold text-text-primary">- {t(($) => $[`${prefixEmbedded}.title`], { ns: 'appOverview' })}- </DialogTitle>- <DialogClose- render={- <IconButton- aria-label={t(($) => $['operation.close'], { ns: 'common' })}- size="lg"- className="absolute inset-e-6 top-6"- >- <span aria-hidden className="i-ri-close-line size-4" />- </IconButton>+ <DialogContent className="flex max-h-[calc(100dvh-2rem)] w-160 flex-col overflow-hidden">+ <DialogTitle className="shrink-0 title-2xl-semi-bold text-text-primary">+ {t(($) => $[`${prefixEmbedded}.title`], { ns: 'appOverview' })}+ </DialogTitle>+ <DialogClose+ render={+ <IconButton+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}+ size="lg"+ className="absolute inset-e-6 top-6"+ >+ <span aria-hidden className="i-ri-close-line size-4" />+ </IconButton>+ }+ />+ <div className="min-h-0 flex-1 overflow-y-auto overscroll-contain">+ <Suspense+ fallback={+ <div className="py-8 text-text-tertiary">{t(($) => $.loading, { ns: 'common' })}</div>}- />- <div className="min-h-0 flex-1 overflow-y-auto overscroll-contain">- {isShow && (- <EmbeddedContent- key={`${appBaseUrl ?? ''}:${accessToken ?? ''}:${webAppRoute}:${JSON.stringify(hiddenInputs ?? [])}`}- siteInfo={siteInfo}- appBaseUrl={appBaseUrl ?? ''}- accessToken={accessToken ?? ''}- webAppRoute={webAppRoute}- hiddenInputs={hiddenInputs}- />- )}- </div>- </DialogContent>- </Dialog>+ >+ <EmbeddedContent+ key={`${appBaseUrl ?? ''}:${accessToken}:${webAppRoute}:${JSON.stringify(hiddenInputs ?? [])}`}+ siteInfo={siteInfo}+ appBaseUrl={appBaseUrl ?? ''}+ accessToken={accessToken}+ webAppRoute={webAppRoute}+ hiddenInputs={hiddenInputs}+ />+ </Suspense>+ </div>+ </DialogContent>)}--export default Embeddeddiff --git a/web/features/agent-v2/agent-detail/access/components/web-app-access-card.tsx b/web/features/agent-v2/agent-detail/access/components/web-app-access-card.tsxindex 255b262cbc7..47f24beb121 100644--- a/web/features/agent-v2/agent-detail/access/components/web-app-access-card.tsx+++ b/web/features/agent-v2/agent-detail/access/components/web-app-access-card.tsx@@ -5,6 +5,7 @@ import type { AppSiteUpdatePayload } from '@dify/contracts/api/console/apps/typeimport type { SettingsAppInfo } from '@/app/components/app/overview/settings'import type { AppIconType } from '@/types/app'import { Button } from '@langgenius/dify-ui/button'+import { Dialog, DialogTrigger } from '@langgenius/dify-ui/dialog'import { useMutation, useQueryClient } from '@tanstack/react-query'import dynamic from 'next/dynamic'import { useState } from 'react'@@ -14,7 +15,7 @@ import {WebAppAccessControlEntrySkeleton,} from '@/app/components/app/access-point/shared/web-app-access-control'import { CustomizeDialog } from '@/app/components/app/overview/customize'-import EmbeddedModal from '@/app/components/app/overview/embedded'+import { EmbeddedDialogContent } from '@/app/components/app/overview/embedded'import SettingsModal from '@/app/components/app/overview/settings'import { AccessPointCard } from '@/app/components/base/access-point/card'import { AccessPointUrl } from '@/app/components/base/access-point/url'@@ -73,7 +74,6 @@ export function WebAppAccessCard({appId,}: null- const [showEmbeddedModal, setShowEmbeddedModal] = useState(false)const [showSettingsModal, setShowSettingsModal] = useState(false)const [showAccessControl, setShowAccessControl] = useState(false)const accessControl = useWebAppAccessControl(agent, isLoading)@@ -232,15 +232,23 @@ export function WebAppAccessCard({onEnabledChange={handleEnabledChange}actions={<>- <Button- variant="secondary"- disabled={!canUseIntegrationActions || !embeddedConfig}- onClick={() => setShowEmbeddedModal(true)}- className="flex items-center gap-1 px-3"- >- <span aria-hidden className="i-ri-window-line size-4" />- {t(($) => $['agentDetail.access.webApp.actions.embedIntoSite'])}- </Button>+ <Dialog>+ <DialogTrigger+ disabled={!canUseIntegrationActions || !embeddedConfig}+ render={<Button variant="secondary" className="px-3" />}+ >+ <span aria-hidden className="i-ri-window-line size-4" />+ {t(($) => $['agentDetail.access.webApp.actions.embedIntoSite'])}+ </DialogTrigger>+ {embeddedConfig && (+ <EmbeddedDialogContent+ appBaseUrl={embeddedConfig.appBaseUrl}+ accessToken={embeddedConfig.accessToken}+ siteInfo={embeddedConfig.siteInfo}+ webAppRoute="agent"+ />+ )}+ </Dialog>{canManageWebApp && customizeConfig ? (<CustomizeDialogappId={customizeConfig.appId}@@ -317,16 +325,6 @@ export function WebAppAccessCard({onSave={handleSaveSettings}/>)}- {canManageWebApp && embeddedConfig && (- <EmbeddedModal- isShow={showEmbeddedModal}- onClose={() => setShowEmbeddedModal(false)}- appBaseUrl={embeddedConfig.appBaseUrl}- accessToken={embeddedConfig.accessToken}- siteInfo={embeddedConfig.siteInfo}- webAppRoute="agent"- />- )}{canManageAccessPoint && showAccessControl && accessControl.state === 'ready' && (<AccessControlapp={accessControl.app}