All files / src/components/Workflows/create/notifications MsWebhook.tsx

0% Statements 0/15
0% Branches 0/6
0% Functions 0/3
0% Lines 0/15

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47                                                                                             
import React from "react";
import { CircularProgress } from "@mui/material";
import { handleInput } from "../../utils/handleInputs.ts";
import { useGetMSTeamsWebhookOptionsQuery } from "../../../../store/features/triggers/api/getMSTeamsWebhookOptionsApi.ts";
import { useSelector } from "react-redux";
import { currentWorkflowSelector } from "../../../../store/features/workflow/workflowSlice.ts";
import AddNewIntegration from "./AddNewIntegration.tsx";
import CustomInput from "../../../Inputs/CustomInput.tsx";
import { InputTypes } from "../../../../types/inputs/inputTypes.ts";
import { LabelPosition } from "../../../../types/inputs/labelPosition.ts";
 
function MsWebhook() {
  const currentWorkflow = useSelector(currentWorkflowSelector);
  const {
    data,
    isFetching: msTeamsOptionsFetching,
    refetch,
  } = useGetMSTeamsWebhookOptionsQuery();
 
  return (
    <div className="flex items-center gap-2 mt-2">
      {msTeamsOptionsFetching && <CircularProgress size={20} />}
      <CustomInput
        label="Webhook"
        labelPosition={LabelPosition.LEFT}
        inputType={InputTypes.DROPDOWN}
        options={data?.map((e) => {
          return {
            id: e.keyId,
            label: e.name,
          };
        })}
        placeholder="Select Webhook"
        handleChange={(id) => {
          handleInput("ms_webhook", id);
        }}
        value={currentWorkflow?.ms_webhook ?? ""}
        error={currentWorkflow?.errors?.ms_webhook ?? false}
        searchable={true}
        suffix={<AddNewIntegration refetch={refetch} data={data} />}
      />
    </div>
  );
}
 
export default MsWebhook;