) {
const [credentials, setCredentials] = useState(props.credentials ?? {});
const [connected, setConnected] = useState(false);
- return connected ? Credentials saved. Continue to the test conversation.
: {}} agentName="Company Phone Agent" callbackUrl="https://paperclip.example/api/voice-webhooks/endpoint/tools" {...props} credentials={credentials} onChange={setCredentials} onConnect={(values) => { if (!props.repairing && !values.signingSecret?.startsWith("whsec_")) throw new Error("Missing signing secret"); setConnected(true); }} />;
+ return connected ? Credentials saved. Continue to the test conversation.
: {}} agentName="Company Phone Agent" callbackUrl="https://paperclip.example/api/voice-webhooks/endpoint/tools" {...props} credentials={credentials} onChange={setCredentials} onConnect={(values) => { if ((!props.repairing || props.signingSecretConfigured === false) && !values.signingSecret?.startsWith("whsec_")) throw new Error("Missing signing secret"); setConnected(true); }} />;
}
const meta: Meta = { ...voiceStoryLifecycle, title: "Connections/Speko/Provider setup", component: SpekoProviderSetup, parameters: { layout: "padded" } };
export default meta;
@@ -37,3 +37,16 @@ export const KeyboardValidationAndConnect: Story = {
await expect(canvas.getByRole("status")).toHaveTextContent("Credentials saved");
},
};
+
+export const InterruptedBeforeCredentials: Story = {
+ render: () => ,
+ play: async ({canvasElement}) => {
+ const canvas = within(canvasElement);
+ const connect = canvas.getByRole("button", {name: "Reconnect Speko"});
+ await expect(connect).toBeDisabled();
+ await userEvent.type(canvas.getByRole("textbox", {name: "Speko agent ID"}), "agent_fixture");
+ await userEvent.type(canvas.getByLabelText("Speko API key"), "synthetic-not-a-key");
+ await userEvent.click(connect);
+ await expect(canvas.getByRole("status")).toHaveTextContent("Credentials saved");
+ },
+};