{"version":3,"sources":["utils/projectSettings.ts","ui/pages/ProjectSettingsPage/ProjectSettingsPage.tsx"],"names":["loadProjectSettings","ApplicationServices","get","backendApiClient","backendApiPath","version","saveProjectSettings","patch","activeProject","id","ProjectSettingsPage","ProjectName","services","useServices","useState","name","projectName","setProjectName","pending","setPending","useForm","form","useEffect","setFieldsValue","onSave","isFieldsTouched","getFieldsValue","actionNotification","success","reloadPage","error","SettingsPanel","title","children","documentation","maxWidth","UserSettings","user","unlinkUser","showPermissions","setShowPermissions","project","useProject","disableEdit","permissions","allPermissions","includes","ProjectPermission","MODIFY_CONFIG","canEditPermissions","userService","getUser","email","PermissionsEditor","blockedReason","Set","grantedPermissions","setGrantedPermissions","updating","setUpdating","map","p","has","e","copy","target","checked","add","delete","projectService","updatePermissions","message","UsersSettings","useLoaderAsObject","getProjectUsers","isLoading","users","data","reloader","linkUser","userEmail","linkUserToProject","result","alert","confirm","content","onOk","unlinkFromProject","handleError","InviteUserForm","invite","inputVisible","setInputVisible","setEmail","errorMessage","setErrorMessage","value","SlackSettings","setData","loading","flatten","unflatten","onSlackTest","url","notifications","slack","fetch","method","body","response","ok","Error","statusText","console","log","withPermissionRequirement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAIO,QAASA,oBAAT,EAAyD,CAC9D,MAAOC,uCAAmB,CAACC,GAApB,GAA0BC,gBAA1B,CAA2CD,GAA3C,CAA+CE,cAAc,EAA7D,CAAiE,CAAEC,OAAO,CAAE,CAAX,CAAjE,CAAP,CACD,CAEM,QAASC,oBAAT,CAA6BC,KAA7B,CAA4E,CACjF,MAAON,uCAAmB,CAACC,GAApB,GAA0BC,gBAA1B,CAA2CI,KAA3C,CAAiDH,cAAc,EAA/D,CAAmEG,KAAnE,CAA0E,CAAEF,OAAO,CAAE,CAAX,CAA1E,CAAP,CACD,CAED,QAASD,eAAT,EAAkC,CAChC,0BAAoBH,sCAAmB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AAC,CAAC+C,IAAZ,eACC,0EACE,4CAAM,IAAI,CAAExD,IAAZ,CAAkB,QAAQ,CAAEG,MAA5B,wBACE,2BAAC,0BAAD,wBACE,2BAAC,yBAAD,EACE,KAAK,CAAC,OADR,CAEE,OAAO,CAAC,mDAFV,uBAKE,0CAAM,IAAN,EAAW,IAAI,CAAC,yBAAhB,uBACE,4CAAO,IAAI,CAAC,OAAZ,CAAoB,IAAI,CAAC,yBAAzB,CAAmD,WAAW,CAAC,aAA/D,CAA6E,QAAQ,CAAEN,OAAvF,EADF,EALF,EAGM,yBAHN,CADF,EADF,cAYE,4BAAC,2BAAD,yBACE,6CAAQ,IAAI,CAAC,SAAb,CAAuB,IAAI,CAAC,OAA5B,CAAoC,QAAQ,CAAC,QAA7C,CAAsD,OAAO,CAAEA,OAA/D,CAAwE,OAAO,CAAEoF,WAAjF,kBADF,cAIE,6CAAQ,IAAI,CAAC,SAAb,CAAuB,IAAI,CAAC,OAA5B,CAAoC,QAAQ,CAAC,QAA7C,CAAsD,OAAO,CAAEpF,OAA/D,kBAJF,GAZF,GADF,EAJJ,GADF,CA+BD,CAEciG,8KAAyB,CAACzG,mBAAD,CAAsBqC,yCAAiB,CAACC,aAAxC,CAAxC,E","file":"static/js/164.8649a88d.chunk.js","sourcesContent":["// @Services\nimport ApplicationServices from \"lib/services/ApplicationServices\"\nimport { ProjectSettings } from \"../generated/conf-openapi\"\n\nexport function loadProjectSettings(): Promise {\n return ApplicationServices.get().backendApiClient.get(backendApiPath(), { version: 2 })\n}\n\nexport function saveProjectSettings(patch: Partial): Promise {\n return ApplicationServices.get().backendApiClient.patch(backendApiPath(), patch, { version: 2 })\n}\n\nfunction backendApiPath(): string {\n return `/projects/${ApplicationServices.get().activeProject.id}/settings`\n}\n\nexport type { ProjectSettings }\n","import React, { ReactNode, useEffect, useState } from \"react\"\nimport { loadProjectSettings, ProjectSettings, saveProjectSettings } from \"../../../utils/projectSettings\"\nimport { CenteredError, CenteredSpin, handleError } from \"../../../lib/components/components\"\nimport { actionNotification } from \"../../components/ActionNotification/ActionNotification\"\nimport { FormActions, FormField, FormLayout } from \"../../../lib/components/Form/Form\"\nimport { Button, Checkbox, Form, Input, Modal } from \"antd\"\nimport { useLoaderAsObject } from \"../../../hooks/useLoader\"\nimport useForm from \"antd/lib/form/hooks/useForm\"\nimport { flatten, reloadPage, unflatten } from \"lib/commons/utils\"\nimport { useServices } from \"../../../hooks/useServices\"\nimport useProject from \"../../../hooks/useProject\"\nimport { ErrorCard } from \"../../../lib/components/ErrorCard/ErrorCard\"\nimport { BilledButton } from \"lib/components/BilledButton/BilledButton\"\nimport { ProjectPermission, ProjectUserPermissions } from \"../../../generated/conf-openapi\"\nimport { allPermissions, withPermissionRequirement } from \"../../../lib/services/permissions\"\n\nfunction ProjectSettingsPage() {\n return (\n
\n \n \n \n\n \n Configure{\" \"}\n \n slack webhook\n {\" \"}\n to receive notifications about synchronization tasks statuses\n \n }\n >\n \n \n Share your project with other users}>\n \n \n
\n )\n}\n\nexport const ProjectName: React.FC<{}> = () => {\n let services = useServices()\n let [projectName, setProjectName] = useState(services.activeProject.name)\n let [pending, setPending] = useState(false)\n let [form] = useForm<{ projectName: string }>()\n useEffect(() => {\n form.setFieldsValue({ projectName })\n }, [projectName])\n\n let onSave = async () => {\n if (!form.isFieldsTouched()) {\n return\n }\n\n setPending(true)\n try {\n await services.backendApiClient.patch(\n `/projects/${services.activeProject.id}`,\n { name: form.getFieldsValue()[\"projectName\"] },\n { version: 2 }\n )\n services.activeProject.name = projectName\n actionNotification.success(\"Project name has been updated\")\n reloadPage()\n } catch (e) {\n actionNotification.error(`${e}`)\n } finally {\n setPending(false)\n }\n }\n\n return (\n <>\n <>\n
\n \n \n \n \n \n \n \n \n \n \n
\n \n \n )\n}\n\nconst SettingsPanel: React.FC<{ title: ReactNode; documentation?: ReactNode }> = ({\n title,\n children,\n documentation,\n}) => {\n return (\n
\n
\n
\n

{title}

\n {documentation &&
{documentation}
}\n
{children}
\n
\n
\n
\n )\n}\n\nconst UserSettings: React.FC<{\n user: ProjectUserPermissions\n unlinkUser: ({ id, email }: { id: string; email: string }) => void\n}> = ({ user, unlinkUser }) => {\n const services = useServices()\n const [showPermissions, setShowPermissions] = useState(false)\n const project = useProject()\n const disableEdit = !(project.permissions || allPermissions).includes(ProjectPermission.MODIFY_CONFIG)\n const canEditPermissions =\n services.userService.getUser().id === user.id\n ? \"You can't edit your own permissions\"\n : disableEdit\n ? \" You don't have enough permissions to edit other users\"\n : null\n return (\n
\n
\n
\n {user.email}\n
\n
\n \n \n
\n
\n {showPermissions && (\n
\n \n
\n )}\n
\n )\n}\n\nconst PermissionsEditor: React.FC<{\n permissions: ProjectPermission[]\n user: { id: string; email: string }\n blockedReason: string | null\n}> = ({ permissions, user, blockedReason }) => {\n const [grantedPermissions, setGrantedPermissions] = useState>(new Set(permissions))\n const [updating, setUpdating] = useState(false)\n const services = useServices()\n const activeProject = useProject()\n return (\n
\n {allPermissions.map(p => (\n {\n const copy = new Set(grantedPermissions)\n if (e.target.checked) {\n copy.add(p)\n } else {\n copy.delete(p)\n }\n try {\n setUpdating(true)\n await services.projectService.updatePermissions(activeProject.id, user.id, [...copy])\n setGrantedPermissions(copy)\n actionNotification.success(\n <>\n Permissions of {user.email} has been updated\n \n )\n } catch (e) {\n actionNotification.error(\n <>\n Error while updating permissions of {user.email}\n {e?.message ? `: ${e.message}` : \"\"}\n \n )\n } finally {\n setUpdating(false)\n }\n }}\n >\n {p}\n \n ))}\n {blockedReason && - {blockedReason}}\n
\n )\n}\n\nconst UsersSettings: React.FC<{}> = () => {\n const services = useServices()\n const activeProject = useProject()\n const {\n isLoading,\n error,\n data: users,\n reloader,\n } = useLoaderAsObject(async () => {\n return await services.projectService.getProjectUsers(activeProject.id)\n })\n if (isLoading) {\n return \n } else if (error) {\n return \n } else if (!users) {\n return \n }\n\n const linkUser = async (userEmail: string) => {\n const result = await services.projectService.linkUserToProject(services.activeProject.id, { userEmail })\n if (result == \"invitation_sent\") {\n actionNotification.success(\n <>\n Invitation has been sent to {userEmail}. The user will need to create account first\n \n )\n } else {\n actionNotification.success(\n <>\n User {userEmail} already has an account, they has been granted with access to this project\n \n )\n }\n await reloader()\n }\n\n const unlinkUser = ({ id, email }: { id: string; email: string }) => {\n if (id === services.userService.getUser().id) {\n alert(\"You can't unlink yourself from the project!\")\n return\n }\n Modal.confirm({\n title: \"Confirm removal of project member\",\n content: (\n <>\n You're about to remove {email} from your project. Are you sure you want to continue?\n \n ),\n onOk: async () => {\n try {\n await services.projectService.unlinkFromProject(activeProject.id, id)\n } catch (e) {\n handleError(e)\n } finally {\n await reloader()\n }\n },\n })\n }\n\n return (\n
\n {users.map(user => (\n \n ))}\n
\n \n
\n
\n )\n}\n\nconst InviteUserForm: React.FC<{ invite: (email: string) => Promise }> = ({ invite }) => {\n const [inputVisible, setInputVisible] = useState(false)\n const [pending, setPending] = useState(false)\n const [email, setEmail] = useState()\n const [errorMessage, setErrorMessage] = useState()\n\n return (\n <>\n
\n setEmail(e.target.value)}\n placeholder=\"Enter email\"\n disabled={pending}\n className={`${inputVisible ? \"opacity-100 w-full mr-4\" : \"opacity-0 w-0 m-0 p-0 invisible\"}`}\n />\n {\n if (!inputVisible) {\n setInputVisible(true)\n } else {\n setPending(true)\n try {\n await invite(email)\n setInputVisible(false)\n } catch (e) {\n setErrorMessage(\"Failed to add user to the project: \" + e.message)\n } finally {\n setPending(false)\n }\n }\n }}\n >\n {inputVisible ? \"Send invitation\" : \"Add user to the project\"}\n \n
\n
{errorMessage || \"-\"}
\n \n )\n}\n\nfunction SlackSettings() {\n let { error, data, setData, isLoading: loading } = useLoaderAsObject(loadProjectSettings)\n let [pending, setPending] = useState()\n let [form] = useForm()\n useEffect(() => {\n form.setFieldsValue(flatten(data))\n }, [data])\n\n let onSave = async () => {\n if (!form.isFieldsTouched()) {\n return\n }\n\n setPending(true)\n try {\n setData(await saveProjectSettings(unflatten(form.getFieldsValue())))\n actionNotification.success(\"Slack notification settings has been saved\")\n } catch (e) {\n actionNotification.error(`${e}`)\n } finally {\n setPending(false)\n }\n }\n\n let onSlackTest = async () => {\n let url = unflatten(form.getFieldsValue()).notifications?.slack?.url\n try {\n let response = await fetch(url, {\n method: \"POST\",\n body: `{\"text\": \"Jitsu test notification\"}`,\n })\n\n if (!response.ok) {\n throw new Error(response.statusText)\n }\n\n actionNotification.success(\"Slack test notification OK\")\n } catch (e) {\n actionNotification.error(`Failed to send Slack test notification: ${e.message}`)\n console.log(e)\n }\n }\n\n return (\n <>\n {loading && !data && }\n {!!error && !data && }\n {!error && !!data && (\n <>\n
\n \n \n \n \n \n \n \n \n \n \n \n
\n \n )}\n \n )\n}\n\nexport default withPermissionRequirement(ProjectSettingsPage, ProjectPermission.MODIFY_CONFIG)\n"],"sourceRoot":""}