mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 08:18:42 +00:00
* feat(agent): serve a website widget channel and its embed script A website widget is a public chat a website opens in a panel from a button. Its model extends the public chat's with the button's text and corner and never has a password. GET /api/agent/public-chat/<slug>/widget.js returns the button's script with the widget's settings written in, cached for five minutes. ADR 016 records the decision. * feat(agent): add website widgets in the Channels section Channel types now come from a frontend registry: "Add channel" opens a menu of them and each card shows its type's form. The website widget's form has the embed code and the button's text and corner, and shares the title, welcome text and appearance with the public chat. Embedded in the widget's panel, the chat page fills it with its background, keeps text readable on a dark one, and asks the widget to close on Escape. * fix(agent): copy only a channel type's own settings Export and import copied the public chat's appearance fields for every public chat type, so an imported widget kept a background it can't show or change. Each type now lists its appearance fields once, and copies use that list; the password follows the same rule. The widget's chat URL is built with get_embedded_share_url, so a share URL ending in / works. * test(agent): run the widget script on another website An e2e test embeds the widget on a page from another origin, with markup as the button text and title, and checks both show as text and the chat opens in the panel. * fix(agent): backend default button text, focus the channel menu, keep widget names visible A new widget gets its button text from the backend only, as one created through the API does. "Add channel" moves focus into its menu like the other menus, and a card's type label gives its space up before the name. A test covers choosing Automatic to clear a colour. * fix(agent): visible hover without an accent, no suggestions while a message is locked Without an accent colour the chat's buttons darken on hover as the member chat's do, and custom accents get the stronger hover again. The member chat hides suggested messages while the message box is read-only for a pending or failed send, since a click couldn't change it. * test(agent): serve the widget test's website on loopback CI's Chrome blocks a public page's scripts from loopback, so the routed website never loaded the widget.
98 lines
3.5 KiB
JavaScript
98 lines
3.5 KiB
JavaScript
import { AgentApplicationType } from '@baserow/modules/agent/applicationTypes'
|
|
import { AgentChatRunType } from '@baserow/modules/agent/chatRunTypes'
|
|
import { AgentLastViewedItemType } from '@baserow/modules/agent/lastViewedItemTypes'
|
|
import { AgentApplicationSearchType } from '@baserow/modules/agent/searchTypes'
|
|
import { agentToolPresentationTypes } from '@baserow/modules/agent/toolPresentationTypes'
|
|
import {
|
|
TriggerDataProviderType,
|
|
ActionInputDataProviderType,
|
|
} from '@baserow/modules/agent/dataProviderTypes'
|
|
import {
|
|
HTTPAgentTriggerType,
|
|
InboundEmailAgentTriggerType,
|
|
RowsCreatedAgentTriggerType,
|
|
RowsDeletedAgentTriggerType,
|
|
RowsUpdatedAgentTriggerType,
|
|
} from '@baserow/modules/agent/agentTriggerTypes'
|
|
import { searchTypeRegistry } from '@baserow/modules/core/search/types/registry'
|
|
import { AgentParticipationPermissionManagerType } from '@baserow/modules/agent/permissionManagerTypes'
|
|
import {
|
|
ActionsAgentConfigurationSectionType,
|
|
ConnectedAppsAgentConfigurationSectionType,
|
|
InstructionsAgentConfigurationSectionType,
|
|
SettingsAgentConfigurationSectionType,
|
|
WhenItRunsAgentConfigurationSectionType,
|
|
WorkspaceAccessAgentConfigurationSectionType,
|
|
} from '@baserow/modules/agent/configurationSectionTypes'
|
|
|
|
export default defineNuxtPlugin({
|
|
name: 'agent',
|
|
dependsOn: ['core'],
|
|
setup(nuxtApp) {
|
|
const context = { app: nuxtApp }
|
|
|
|
for (const ToolPresentation of agentToolPresentationTypes) {
|
|
nuxtApp.$registry.register(
|
|
'toolPresentation',
|
|
new ToolPresentation(context)
|
|
)
|
|
}
|
|
nuxtApp.$registry.register(
|
|
'permissionManager',
|
|
new AgentParticipationPermissionManagerType(context)
|
|
)
|
|
nuxtApp.$registry.registerNamespace('agentConfigurationSection')
|
|
nuxtApp.$registry.registerNamespace('agentDataProvider')
|
|
nuxtApp.$registry.registerNamespace('agentTriggerType')
|
|
nuxtApp.$registry.registerNamespace('agentChannelType')
|
|
for (const TriggerType of [
|
|
HTTPAgentTriggerType,
|
|
InboundEmailAgentTriggerType,
|
|
RowsCreatedAgentTriggerType,
|
|
RowsUpdatedAgentTriggerType,
|
|
RowsDeletedAgentTriggerType,
|
|
]) {
|
|
nuxtApp.$registry.register('agentTriggerType', new TriggerType(context))
|
|
}
|
|
nuxtApp.$registry.register(
|
|
'agentDataProvider',
|
|
new TriggerDataProviderType(context)
|
|
)
|
|
nuxtApp.$registry.register(
|
|
'agentDataProvider',
|
|
new ActionInputDataProviderType(context)
|
|
)
|
|
nuxtApp.$registry.register(
|
|
'agentConfigurationSection',
|
|
new ActionsAgentConfigurationSectionType(context)
|
|
)
|
|
nuxtApp.$registry.register(
|
|
'agentConfigurationSection',
|
|
new InstructionsAgentConfigurationSectionType(context)
|
|
)
|
|
nuxtApp.$registry.register(
|
|
'agentConfigurationSection',
|
|
new WhenItRunsAgentConfigurationSectionType(context)
|
|
)
|
|
nuxtApp.$registry.register(
|
|
'agentConfigurationSection',
|
|
new WorkspaceAccessAgentConfigurationSectionType(context)
|
|
)
|
|
nuxtApp.$registry.register(
|
|
'agentConfigurationSection',
|
|
new ConnectedAppsAgentConfigurationSectionType(context)
|
|
)
|
|
nuxtApp.$registry.register(
|
|
'agentConfigurationSection',
|
|
new SettingsAgentConfigurationSectionType(context)
|
|
)
|
|
nuxtApp.$registry.register('application', new AgentApplicationType(context))
|
|
nuxtApp.$registry.register('chatRunType', new AgentChatRunType(context))
|
|
nuxtApp.$registry.register(
|
|
'lastViewedItem',
|
|
new AgentLastViewedItemType(context)
|
|
)
|
|
searchTypeRegistry.register(new AgentApplicationSearchType(context))
|
|
},
|
|
})
|