import { BoxWithBorder } from "../../../components/box-with-border"; import { Box, Button, ProductsIcons, Switch, TableEditIcon, Text } from "@saleor/macaw-ui/next"; import { defaultPadding } from "../../../components/ui-defaults"; import { trpcClient } from "../../trpc/trpc-client"; import { Controller, useForm } from "react-hook-form"; import { BoxFooter } from "../../../components/box-footer"; import { SectionWithDescription } from "../../../components/section-with-description"; import { zodResolver } from "@hookform/resolvers/zod"; import { Multiselect } from "../../../components/react-hook-form-macaw/Multiselect"; import { AssignedChannelsMessage } from "./assigned-channels-message"; import { ChannelConfiguration, UpdateChannelsInput, updateChannelsInputSchema, } from "../channel-configuration-schema"; interface UniversalChannelsSectionProps { configurationId: string; channelConfiguration: ChannelConfiguration; onSubmit: (formData: UpdateChannelsInput) => void; } export const UniversalChannelsSection = ({ configurationId, channelConfiguration, onSubmit, }: UniversalChannelsSectionProps) => { const { handleSubmit, control, register } = useForm({ defaultValues: { id: configurationId, ...channelConfiguration, }, resolver: zodResolver(updateChannelsInputSchema), }); const { data: channels } = trpcClient.channels.fetch.useQuery(); return ( By default, provider will work for every channel. You can change this behavior with excluding or including strategy. Excluding - all current channels and new created channels will work, excluding selected Including - only selected channels will work, new created channels will not work } >
{ onSubmit(data); })} > Current behaviour channel.slug) || []} channelConfiguration={channelConfiguration} /> Settings ( Include Exclude )} /> ({ label: channel.name, value: channel.slug, })) || [] } />
); };