2
0

🚸 (engine) Improve engine v2 client loading and timings

Client actions are triggered after the correct bubble block. If the send message request is longer than 1s we show a loading chunk

Closes #276
This commit is contained in:
Baptiste Arnaud
2023-01-27 10:54:59 +01:00
parent a738897dbb
commit 4f78dda640
16 changed files with 408 additions and 262 deletions

View File

@ -87,11 +87,15 @@ const embedMessageSchema = z.object({
content: embedBubbleContentSchema,
})
const chatMessageSchema = textMessageSchema
.or(imageMessageSchema)
.or(videoMessageSchema)
.or(audioMessageSchema)
.or(embedMessageSchema)
const chatMessageSchema = z
.object({ id: z.string() })
.and(
textMessageSchema
.or(imageMessageSchema)
.or(videoMessageSchema)
.or(audioMessageSchema)
.or(embedMessageSchema)
)
const codeToExecuteSchema = z.object({
content: z.string(),
@ -167,29 +171,35 @@ const replyLogSchema = logSchema
const clientSideActionSchema = z
.object({
codeToExecute: codeToExecuteSchema,
lastBubbleBlockId: z.string().optional(),
})
.or(
z.object({
redirect: redirectOptionsSchema,
})
)
.or(
z.object({
chatwoot: z.object({ codeToExecute: codeToExecuteSchema }),
})
)
.or(
z.object({
googleAnalytics: googleAnalyticsOptionsSchema,
})
)
.or(
z.object({
wait: z.object({
secondsToWaitFor: z.number(),
}),
})
.and(
z
.object({
codeToExecute: codeToExecuteSchema,
})
.or(
z.object({
redirect: redirectOptionsSchema,
})
)
.or(
z.object({
chatwoot: z.object({ codeToExecute: codeToExecuteSchema }),
})
)
.or(
z.object({
googleAnalytics: googleAnalyticsOptionsSchema,
})
)
.or(
z.object({
wait: z.object({
secondsToWaitFor: z.number(),
}),
})
)
)
export const chatReplySchema = z.object({