⚡ (setVariable) Add "Environment name" value in Set variable block (#850)
Closes #848 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ### Summary by CodeRabbit - New Feature: Added "Environment name" as a new value type in the SetVariable function, allowing users to distinguish between 'web' and 'whatsapp' environments. - Refactor: Simplified session state handling in `resumeWhatsAppFlow.ts` for improved code clarity. - Refactor: Updated `startWhatsAppSession.ts` to include an initial session state with WhatsApp contact and expiry timeout, enhancing session management. - Bug Fix: Improved null handling in `executeSetVariable.ts` for 'Contact name' and 'Phone number', preventing potential issues with falsy values. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@ -30,11 +30,13 @@ import { injectVariablesFromExistingResult } from './variables/injectVariablesFr
|
||||
type Props = {
|
||||
startParams: StartParams
|
||||
userId: string | undefined
|
||||
initialSessionState?: Pick<SessionState, 'whatsApp' | 'expiryTimeout'>
|
||||
}
|
||||
|
||||
export const startSession = async ({
|
||||
startParams,
|
||||
userId,
|
||||
initialSessionState,
|
||||
}: Props): Promise<ChatReply & { newSessionState: SessionState }> => {
|
||||
if (!startParams)
|
||||
throw new TRPCError({
|
||||
@ -108,6 +110,7 @@ export const startSession = async ({
|
||||
dynamicTheme: parseDynamicThemeInState(typebot.theme),
|
||||
isStreamEnabled: startParams.isStreamEnabled,
|
||||
typingEmulation: typebot.settings.typingEmulation,
|
||||
...initialSessionState,
|
||||
}
|
||||
|
||||
if (startParams.isOnlyRegistering) {
|
||||
|
Reference in New Issue
Block a user