fix: handle undefined values in Zoom onboarding prompts

- Wrap prompter.text() results with String() and trim()
- Fixes TypeError when accessing .includes() on undefined
- Ensures all input values are properly converted to strings

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Pranav Katariya 2026-01-27 18:53:27 -08:00
parent ee04512fc3
commit 56096d81ee

View File

@ -82,32 +82,51 @@ export const zoomOnboardingAdapter: ChannelOnboardingAdapter = {
await noteZoomHelp(prompter); await noteZoomHelp(prompter);
const clientId = await prompter.text({ const clientId = String(
await prompter.text({
message: "Zoom Client ID", message: "Zoom Client ID",
placeholder: "lfcOyplW...", placeholder: "lfcOyplW...",
validate: (value) => (value?.trim() ? undefined : "Client ID is required"), validate: (value) => {
}); const trimmed = String(value ?? "").trim();
return trimmed ? undefined : "Client ID is required";
},
}),
).trim();
const clientSecret = await prompter.text({ const clientSecret = String(
await prompter.text({
message: "Zoom Client Secret", message: "Zoom Client Secret",
placeholder: "rm48DW7m...", placeholder: "rm48DW7m...",
validate: (value) => (value?.trim() ? undefined : "Client Secret is required"), validate: (value) => {
}); const trimmed = String(value ?? "").trim();
return trimmed ? undefined : "Client Secret is required";
},
}),
).trim();
const botJid = await prompter.text({ const botJid = String(
await prompter.text({
message: "Zoom Bot JID", message: "Zoom Bot JID",
placeholder: "bot@xmpp.zoom.us", placeholder: "bot@xmpp.zoom.us",
validate: (value) => validate: (value) => {
value?.includes("@xmpp") const str = String(value ?? "").trim();
return str.includes("@xmpp")
? undefined ? undefined
: "Bot JID should contain @xmpp.zoom.us or @xmppdev.zoom.us", : "Bot JID should contain @xmpp.zoom.us or @xmppdev.zoom.us";
}); },
}),
).trim();
const secretToken = await prompter.text({ const secretToken = String(
await prompter.text({
message: "Zoom Secret Token", message: "Zoom Secret Token",
placeholder: "kVJhHKxo...", placeholder: "kVJhHKxo...",
validate: (value) => (value?.trim() ? undefined : "Secret Token is required"), validate: (value) => {
}); const trimmed = String(value ?? "").trim();
return trimmed ? undefined : "Secret Token is required";
},
}),
).trim();
// Determine environment from Bot JID // Determine environment from Bot JID
const isDev = botJid.includes("@xmppdev"); const isDev = botJid.includes("@xmppdev");