2023-08-29 10:01:28 +02:00
|
|
|
import { SessionState, ChatReply } from '@typebot.io/schemas'
|
2023-09-20 15:26:52 +02:00
|
|
|
import { parseVariables } from './variables/parseVariables'
|
2023-08-29 10:01:28 +02:00
|
|
|
|
|
|
|
|
export const parseDynamicTheme = (
|
|
|
|
|
state: SessionState | undefined
|
|
|
|
|
): ChatReply['dynamicTheme'] => {
|
|
|
|
|
if (!state?.dynamicTheme) return
|
|
|
|
|
return {
|
|
|
|
|
hostAvatarUrl: parseVariables(state?.typebotsQueue[0].typebot.variables)(
|
|
|
|
|
state.dynamicTheme.hostAvatarUrl
|
|
|
|
|
),
|
|
|
|
|
guestAvatarUrl: parseVariables(state?.typebotsQueue[0].typebot.variables)(
|
|
|
|
|
state.dynamicTheme.guestAvatarUrl
|
|
|
|
|
),
|
|
|
|
|
}
|
|
|
|
|
}
|