import { Select } from "@saleor/macaw-ui/next"; import React from "react"; import { trpcClient } from "../../trpc/trpc-client"; import { Table } from "../../ui/table"; import { ChannelConfig } from "../channel-config"; import { useDashboardNotification } from "@saleor/apps-shared"; const SelectProvider = (channelConfig: ChannelConfig) => { const { config: { providerConnectionId = "", slug }, id, } = channelConfig; const [value, setValue] = React.useState(providerConnectionId); const { notifySuccess, notifyError } = useDashboardNotification(); const { mutate: upsertMutation } = trpcClient.channelsConfiguration.upsert.useMutation({ onSuccess() { notifySuccess("Success", "Updated channel configuration"); }, onError(error) { notifyError("Error", error.message); }, }); const { data: providerConfigurations = [] } = trpcClient.providersConfiguration.getAll.useQuery(); const changeValue = (nextproviderConnectionId: string) => { setValue(nextproviderConnectionId); upsertMutation({ id, config: { providerConnectionId: nextproviderConnectionId, slug, }, }); }; return (