{"version":3,"file":"api-CtA-fjgl.js","sources":["../../../app/javascript/api/api.ts"],"sourcesContent":["import axios from \"axios\";\naxios.defaults.headers.common[\"X-Requested-With\"] = \"XMLHttpRequest\";\nimport {\n RpaOperationTemplatesRequestParams,\n RpaTwoFactorAuthSetting,\n ConnectingServiceList,\n TriggerConnectingServiceList,\n} from \"../types/types\";\n\n// PATCH: http://localhost/:client_code/workflow_templates/:workflow_template_id/rpa_operation_templates/:id\nexport const apiRpaOperationTemplatesSubmit = async (\n clientCode: string,\n workflowTemplateId: number,\n operationId: number,\n requestParams: RpaOperationTemplatesRequestParams,\n) => {\n const response = await axios\n .patch(\n `/${clientCode}/workflow_templates/${workflowTemplateId}/rpa_operation_templates/${operationId}`,\n requestParams,\n )\n .catch((error) => {\n return error.response;\n });\n return response;\n};\n\nexport const apiRpaOperationTemplatesTest = async (\n clientCode: string,\n workflowTemplateId: number,\n operationId: number,\n requestParams: RpaOperationTemplatesRequestParams,\n) => {\n const response = await axios\n .post(\n `/${clientCode}/workflow_templates/${workflowTemplateId}/rpa_operation_templates/${operationId}/request_test`,\n requestParams,\n )\n .catch((error) => {\n return error.response;\n });\n\n return response;\n};\n\nexport const apiRpaOperationTemplateTerminateTest = async (\n clientCode: string,\n workflowTemplateId: number,\n operationId: number,\n) => {\n const response = await axios\n .get(\n `/${clientCode}/workflow_templates/${workflowTemplateId}/rpa_operation_templates/${operationId}/terminate_test`,\n )\n .catch((error) => {\n return error.response;\n });\n\n return response;\n};\n\nexport const apiRpaOperationTemplateOutputs = async (\n clientCode: string,\n workflowTemplateId: number,\n operationId: number,\n) => {\n const response = await axios\n .get(`/${clientCode}/workflow_templates/${workflowTemplateId}/rpa_operation_templates/${operationId}/fetch_outputs`)\n .catch((error) => {\n error.response;\n return error.response;\n });\n return response;\n};\n\nexport const apiRpaOperationTemplateTestResult = async (\n clientCode: string,\n workflowTemplateId: number,\n operationId: number,\n priority: number,\n) => {\n const response = await axios\n .get(\n `/${clientCode}/workflow_templates/${workflowTemplateId}/rpa_operation_templates/${operationId}/fetch_test_result`,\n { params: { priority: priority } },\n )\n .catch((error) => {\n return error.response;\n });\n return response;\n};\n\nexport const apiAppTriggerAutoOffExtend = async (\n clientCode: string,\n workflowTemplateId: number,\n appTriggerId: number,\n) => {\n const response = await axios\n .patch(\n `/${clientCode}/workflow_templates/${workflowTemplateId}/app_triggers/${appTriggerId}/extend_draft_auto_off_date`,\n )\n .catch((error) => {\n return error.response;\n });\n return response;\n};\n\nexport const updateHubspotContact = async (clientCode: string, hubspotContact: object) => {\n const response = await axios.patch(`/${clientCode}/members/hubspot_contact`, hubspotContact).catch((error) => {\n return error.response;\n });\n return response;\n};\n\nexport const createRpaAccount = async (\n clientCode: string,\n client_id: number,\n member_id: number,\n service_name: string,\n account_id: string,\n password: string,\n) => {\n const response = await axios\n .post(`/${clientCode}/rpa_accounts`, {\n rpa_account: {\n client_id: client_id,\n owner_id: member_id,\n service_name: service_name,\n account_id: account_id,\n password: password,\n },\n })\n .catch((error) => {\n return error.response;\n });\n return response;\n};\n\nexport const getRpaTwoFactorAuthSettingCode = async (\n clientCode: string,\n rpa_two_factor_auth_setting: RpaTwoFactorAuthSetting,\n) => {\n if (!rpa_two_factor_auth_setting) {\n return { data: { error: \"2要素認証コードの生成に失敗しました。\" } };\n }\n\n const response = await axios\n .get(`/${clientCode}/rpa_two_factor_auth_settings/${rpa_two_factor_auth_setting.id}/fetch_code`)\n .catch((error) => {\n return error.response;\n });\n return response;\n};\n\nexport const apiOutputTransformOperationTemplates = async (requestUrl: string) => {\n const response = await axios.post(requestUrl).catch((error) => {\n return error.response;\n });\n return response;\n};\n\nexport const apiCopyWorkflowTemplate = async (requestUrl: string) => {\n const response = await axios.get(requestUrl).catch((error) => {\n return error.response;\n });\n return response;\n};\n\nexport const apiDeleteWorkflowTemplate = async (requestUrl: string) => {\n const response = await axios.delete(requestUrl).catch((error) => {\n return error.response;\n });\n return response;\n};\n\nexport const apiUpdateWorkflowCompletionNotification = async (requestUrl: string, isNotify: boolean) => {\n const response = await axios\n .patch(requestUrl, {\n complete_notification: isNotify ? \"enabled\" : \"disabled\",\n })\n .catch((error) => {\n return error.response;\n });\n return response;\n};\n\nexport const apiUpdateWorkflowPublish = async (requestUrl: string, isPublish: boolean) => {\n const response = await axios\n .patch(requestUrl, {\n workflow_template: {\n published: isPublish ? 1 : 0,\n },\n })\n .catch((error) => {\n return error.response;\n });\n return response;\n};\n\nexport const apiUpdateAjaxRequest = async (requestUrl: string, requestParams: object) => {\n const response = await axios.patch(requestUrl, requestParams).catch((error) => {\n return error.response;\n });\n return response;\n};\n\nexport const apiFetchWorkflowTemplateIcon = async (clientCode: string, workflowTemplateId: number) => {\n const response = await axios.get(`/${clientCode}/icons/workflow_templates/${workflowTemplateId}`).catch((error) => {\n return error.response;\n });\n return response;\n};\n\nexport const apiFetchOperationList = async () => {\n const currentUrl = window.location.href;\n const requestUrl = currentUrl.includes(\"edit\")\n ? currentUrl.replace(\"edit\", \"operation_list\")\n : `${currentUrl}/operation_list`;\n const response = await axios.get(requestUrl).catch((error) => {\n return error.response;\n });\n return response;\n};\n\nexport const apiDuplicateOperation = async ({\n id,\n params,\n}: {\n id: number;\n params: {\n previous_workflow_template_action_id: number;\n next_workflow_template_action_id?: number;\n switch_command_logic_template_id?: number;\n };\n}) => {\n const currentUrl = window.location.href;\n const endpoint = `${currentUrl.replace(\"edit\", `workflow_template_actions/${id}/copy`)}`;\n const response = await axios.get(endpoint, { params }).catch((error) => {\n return error.response;\n });\n return response;\n};\n\nexport const apiFetchServiceActions = async (connectingServices: ConnectingServiceList) => {\n const currentUrl = window.location.href;\n const requestUrl = currentUrl.includes(\"edit\")\n ? currentUrl.replace(\"edit\", \"fetch_operation_service_actions\")\n : `${currentUrl}/fetch_operation_service_actions`;\n const response = await axios.post(requestUrl, { connectingServices: connectingServices }).catch((error) => {\n return error.response;\n });\n return response;\n};\n\nexport const apiFetchTriggerServiceActions = async (connectingServices: TriggerConnectingServiceList) => {\n const currentUrl = window.location.href;\n const requestUrl = currentUrl.includes(\"edit\")\n ? currentUrl.replace(\"edit\", \"fetch_trigger_service_actions\")\n : `${currentUrl}/fetch_trigger_service_actions`;\n const response = await axios.post(requestUrl, { connectingServices: connectingServices }).catch((error) => {\n return error.response;\n });\n return response;\n};\n"],"names":["axios","apiRpaOperationTemplatesSubmit","clientCode","workflowTemplateId","operationId","requestParams","error","apiRpaOperationTemplatesTest","apiRpaOperationTemplateTerminateTest","apiRpaOperationTemplateOutputs","apiRpaOperationTemplateTestResult","priority","apiAppTriggerAutoOffExtend","appTriggerId","updateHubspotContact","hubspotContact","createRpaAccount","client_id","member_id","service_name","account_id","password","getRpaTwoFactorAuthSettingCode","rpa_two_factor_auth_setting","apiOutputTransformOperationTemplates","requestUrl","apiCopyWorkflowTemplate","apiDeleteWorkflowTemplate","apiUpdateWorkflowCompletionNotification","isNotify","apiUpdateWorkflowPublish","isPublish","apiUpdateAjaxRequest","apiFetchWorkflowTemplateIcon","apiFetchOperationList","currentUrl","apiDuplicateOperation","id","params","endpoint","apiFetchServiceActions","connectingServices","apiFetchTriggerServiceActions"],"mappings":"wCACAA,EAAM,SAAS,QAAQ,OAAO,kBAAkB,EAAI,iBAS7C,MAAMC,EAAiC,MAC5CC,EACAC,EACAC,EACAC,IAEiB,MAAML,EACpB,MACC,IAAIE,CAAU,uBAAuBC,CAAkB,4BAA4BC,CAAW,GAC9FC,CAAA,EAED,MAAOC,GACCA,EAAM,QACd,EAIQC,EAA+B,MAC1CL,EACAC,EACAC,EACAC,IAEiB,MAAML,EACpB,KACC,IAAIE,CAAU,uBAAuBC,CAAkB,4BAA4BC,CAAW,gBAC9FC,CAAA,EAED,MAAOC,GACCA,EAAM,QACd,EAKQE,EAAuC,MAClDN,EACAC,EACAC,IAEiB,MAAMJ,EACpB,IACC,IAAIE,CAAU,uBAAuBC,CAAkB,4BAA4BC,CAAW,iBAAA,EAE/F,MAAOE,GACCA,EAAM,QACd,EAKQG,EAAiC,MAC5CP,EACAC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