diff --git a/apps/api/src/app/workflows-v2/shared/schemas/chat-control.schema.ts b/apps/api/src/app/workflows-v2/shared/schemas/chat-control.schema.ts new file mode 100644 index 00000000000..a90e225ad89 --- /dev/null +++ b/apps/api/src/app/workflows-v2/shared/schemas/chat-control.schema.ts @@ -0,0 +1,27 @@ +import { z } from 'zod'; +import { zodToJsonSchema } from 'zod-to-json-schema'; + +import { JSONSchemaDto, UiComponentEnum, UiSchema, UiSchemaGroupEnum } from '@novu/shared'; + +export const ChatStepControlZodSchema = z + .object({ + body: z.string(), + }) + .strict(); + +export type ChatStepControlType = z.infer; + +export const chatStepControlSchema = zodToJsonSchema(ChatStepControlZodSchema) as JSONSchemaDto; +export const chatStepUiSchema: UiSchema = { + group: UiSchemaGroupEnum.CHAT, + properties: { + body: { + component: UiComponentEnum.CHAT_BODY, + }, + }, +}; + +export const chatStepControl = { + uiSchema: chatStepUiSchema, + schema: chatStepControlSchema, +}; diff --git a/apps/api/src/app/workflows-v2/shared/step-type-to-control.mapper.ts b/apps/api/src/app/workflows-v2/shared/step-type-to-control.mapper.ts index 0b2abd32b4c..fdcd743eebf 100644 --- a/apps/api/src/app/workflows-v2/shared/step-type-to-control.mapper.ts +++ b/apps/api/src/app/workflows-v2/shared/step-type-to-control.mapper.ts @@ -4,6 +4,7 @@ import { emailStepControlSchema, emailStepUiSchema, inAppControlSchema, inAppUiS import { DelayTimeControlSchema, delayUiSchema } from './schemas/delay-control.schema'; import { DigestOutputJsonSchema, digestUiSchema } from './schemas/digest-control.schema'; import { smsStepControl } from './schemas/sms-control.schema'; +import { chatStepControl } from './schemas/chat-control.schema'; export const PERMISSIVE_EMPTY_SCHEMA = { type: 'object', @@ -29,7 +30,8 @@ export const stepTypeToControlSchema: Record