import { Control, Controller } from "react-hook-form"; import { IExtendedWebhook, IWebhookOptions } from "types/webhook"; export enum WebhookTypes { ALL = "all", INDIVIDUAL = "individual", } interface IWebHookOptionsProps { control: Control; } export const WEBHOOK_EVENTS = "webhook_events"; const webhookOptions: IWebhookOptions[] = [ { key: WebhookTypes.ALL, label: "Send everything", name: WEBHOOK_EVENTS, }, { key: WebhookTypes.INDIVIDUAL, label: "Select Individual events", name: WEBHOOK_EVENTS, }, ]; export const WebHookOptions = ({ control }: IWebHookOptionsProps) => ( <>
Which events do you like to trigger this webhook
{webhookOptions.map(({ key, label, name }: IWebhookOptions) => (
( onChange(key)} /> )} />
))} );