Skip to content

Make new response type for workspace preview card. #639

@ethanwinters

Description

@ethanwinters

We need to create a new "workspace preview" response type using the preview card that @devadula-nandan already created. When clicked, it should throw an event that folks will use to open the workspace panel.

We should probably setup and integration branch for workspace stuff since we don't want to release a response type that doesn't do anything.

Acceptance criteria

A new preview workspace response type that fires a new open workspace event on click.

Types

Note, all these types generate the docs so write great ts comments on them.

We need to add the enum: https://github.com/carbon-design-system/carbon-ai-chat/blob/main/packages/ai-chat/src/types/messaging/Messages.ts#L218

Make it part of generic item: https://github.com/carbon-design-system/carbon-ai-chat/blob/main/packages/ai-chat/src/types/messaging/Messages.ts#L646

Define the actual data for the response type: https://github.com/carbon-design-system/carbon-ai-chat/blob/main/packages/ai-chat/src/types/messaging/Messages.ts#L762

We sure be sure to have something generic like additional_data to allow folks to pass in whatever random data they need to open a workspace: https://github.com/carbon-design-system/carbon-ai-chat/blob/main/packages/ai-chat/src/types/messaging/Messages.ts#L801C3-L803C5

Of note, just using the response type isn't going to be able to open up every possible action in the toolbar, we only will really support the "open" action with the OOTB response type. For them to do fancier stuff, they will need to use a user_defined response and compose things themselves.

Registration and Display

That happens in: https://github.com/carbon-design-system/carbon-ai-chat/blob/main/packages/ai-chat/src/chat/components-legacy/MessageTypeComponent.tsx

Import all the types and the component and add it to the switch here: https://github.com/carbon-design-system/carbon-ai-chat/blob/main/packages/ai-chat/src/chat/components-legacy/MessageTypeComponent.tsx#L241

Throwing an event on click

Add the new event to the enum: https://github.com/carbon-design-system/carbon-ai-chat/blob/main/packages/ai-chat/src/types/events/eventBusTypes.ts#L31

Define the event: https://github.com/carbon-design-system/carbon-ai-chat/blob/main/packages/ai-chat/src/types/events/eventBusTypes.ts#L333

You fire the event with serviceManager.fire and you can search for the various implementations.

Preview card updates

We should make use of the new toolbar components inside the preview card.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Status

🏗️ In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions