{"version":3,"file":"OutputForm-CF75Xaqw.js","sources":["../../../app/javascript/components/common/FlowBots/Outputs/OutputLabel.tsx","../../../app/javascript/components/common/FlowBots/Outputs/MailOutputLabel.tsx","../../../app/javascript/components/common/FlowBots/Outputs/OutputForm.tsx"],"sourcesContent":["// @ts-nocheck\nimport React, { useEffect, useRef, useState } from \"react\";\nimport style from \"./OutputForm.module.scss\";\nimport { getImageUrl } from \"../../../../commons/assets_path\";\nimport axios from \"axios\";\nimport { useTranslation } from \"react-i18next\";\naxios.defaults.headers.common[\"X-Requested-With\"] = \"XMLHttpRequest\";\n\ntype Props = {\n label: object[];\n i: number;\n iconPath: string;\n isDisplayNameEditable: boolean;\n isTestValueEditable: boolean;\n template_class_name: string;\n clientCode: string;\n};\n\nexport const OutputLabel = ({\n label,\n i,\n iconPath,\n isDisplayNameEditable,\n isTestValueEditable,\n template_class_name,\n clientCode,\n}: Props) => {\n const { t } = useTranslation();\n const [labelValue, setLabelValue] = useState(label);\n const [editValue, setEditValue] = useState({});\n const [showModal, setShowModal] = useState(false);\n const [showEdit, setShowEdit] = useState(false);\n const [showFileDownload, setShowFileDownload] = useState(false);\n const titleRef = useRef(null);\n const valueRef = useRef(null);\n\n const outputDuplicationCheck = async (name) => {\n await axios\n .post(\n location.href.replace(\n /workflow_templates.*/,\n `workflow_templates/${window.location.pathname.split(\"/\")[3]}/ajax_output_duplication`,\n ),\n {\n target_display_name: name,\n target_id: labelValue?.target_id,\n },\n )\n .then((res) => {\n setEditValue((prevLabelValue) => ({ ...prevLabelValue, is_duplicated: res.data.is_duplicated }));\n setLabelValue((prevLabelValue) => ({ ...prevLabelValue, is_duplicated: res.data.is_duplicated }));\n });\n };\n const editLabel = () => {\n setEditValue(labelValue);\n setShowModal(true);\n };\n const submit = () => {\n setLabelValue(editValue);\n setShowModal(false);\n };\n const downloadFile = () => {\n const hiddenInput = document.createElement(\"input\");\n hiddenInput.type = \"hidden\";\n hiddenInput.id = \"no-before-unload\";\n document.body.appendChild(hiddenInput);\n\n location.href = `${window.location.origin}/${clientCode}/workflow_templates/${label.workflow_template_id}/workflow_template_action_outputs/${label.id}/download`;\n\n setTimeout(() => {\n document.body.removeChild(hiddenInput);\n }, 1000);\n };\n\n useEffect(() => {\n if (editValue?.test_value) {\n const _copy = editValue.test_value.replace(/\\n/g, \" \");\n setEditValue((prevState) => ({ ...prevState, test_value: _copy }));\n }\n if (document.getElementsByName(\"set_trigger\")[0]) {\n if (showModal) {\n document.getElementsByName(\"set_trigger\")[0].disabled = true;\n } else {\n document.getElementsByName(\"set_trigger\")[0].disabled = false;\n }\n }\n }, [showModal]);\n\n return (\n