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:
parent
ee04512fc3
commit
56096d81ee
@ -82,32 +82,51 @@ export const zoomOnboardingAdapter: ChannelOnboardingAdapter = {
|
|||||||
|
|
||||||
await noteZoomHelp(prompter);
|
await noteZoomHelp(prompter);
|
||||||
|
|
||||||
const clientId = await prompter.text({
|
const clientId = String(
|
||||||
message: "Zoom Client ID",
|
await prompter.text({
|
||||||
placeholder: "lfcOyplW...",
|
message: "Zoom Client ID",
|
||||||
validate: (value) => (value?.trim() ? undefined : "Client ID is required"),
|
placeholder: "lfcOyplW...",
|
||||||
});
|
validate: (value) => {
|
||||||
|
const trimmed = String(value ?? "").trim();
|
||||||
|
return trimmed ? undefined : "Client ID is required";
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
).trim();
|
||||||
|
|
||||||
const clientSecret = await prompter.text({
|
const clientSecret = String(
|
||||||
message: "Zoom Client Secret",
|
await prompter.text({
|
||||||
placeholder: "rm48DW7m...",
|
message: "Zoom Client Secret",
|
||||||
validate: (value) => (value?.trim() ? undefined : "Client Secret is required"),
|
placeholder: "rm48DW7m...",
|
||||||
});
|
validate: (value) => {
|
||||||
|
const trimmed = String(value ?? "").trim();
|
||||||
|
return trimmed ? undefined : "Client Secret is required";
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
).trim();
|
||||||
|
|
||||||
const botJid = await prompter.text({
|
const botJid = String(
|
||||||
message: "Zoom Bot JID",
|
await prompter.text({
|
||||||
placeholder: "bot@xmpp.zoom.us",
|
message: "Zoom Bot JID",
|
||||||
validate: (value) =>
|
placeholder: "bot@xmpp.zoom.us",
|
||||||
value?.includes("@xmpp")
|
validate: (value) => {
|
||||||
? undefined
|
const str = String(value ?? "").trim();
|
||||||
: "Bot JID should contain @xmpp.zoom.us or @xmppdev.zoom.us",
|
return str.includes("@xmpp")
|
||||||
});
|
? undefined
|
||||||
|
: "Bot JID should contain @xmpp.zoom.us or @xmppdev.zoom.us";
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
).trim();
|
||||||
|
|
||||||
const secretToken = await prompter.text({
|
const secretToken = String(
|
||||||
message: "Zoom Secret Token",
|
await prompter.text({
|
||||||
placeholder: "kVJhHKxo...",
|
message: "Zoom Secret Token",
|
||||||
validate: (value) => (value?.trim() ? undefined : "Secret Token is required"),
|
placeholder: "kVJhHKxo...",
|
||||||
});
|
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");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user