2023-11-13 15:27:36 +01:00
|
|
|
import { SessionState, ContinueChatResponse } from '@typebot.io/schemas'
|
2023-12-13 10:22:02 +01:00
|
|
|
import { parseVariables } from '@typebot.io/variables/parseVariables'
|
2023-08-29 10:01:28 +02:00
|
|
|
|
|
|
|
export const parseDynamicTheme = (
|
|
|
|
state: SessionState | undefined
|
2023-11-13 15:27:36 +01:00
|
|
|
): ContinueChatResponse['dynamicTheme'] => {
|
2023-08-29 10:01:28 +02:00
|
|
|
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
|
|
|
|
),
|
|
|
|
}
|
|
|
|
}
|