@airporting/integrations-app 0.4.95 → 0.4.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mf/4601.js +1 -0
- package/dist/mf/@mf-types/compiled-types/api/connectors/connectorDeleteMutation.d.ts +1 -1
- package/dist/mf/@mf-types/compiled-types/api/microsoft/microsoftTenantQuery.d.ts +2 -0
- package/dist/mf/@mf-types/compiled-types/api/microsoft/startAdminConsentMutation.d.ts +4 -0
- package/dist/mf/@mf-types/compiled-types/api/synchro/synchroJobDeleteMutation.d.ts +4 -1
- package/dist/mf/@mf-types/compiled-types/api/synchro/synchroJobToggleMutation.d.ts +4 -1
- package/dist/mf/@mf-types/compiled-types/api/synchro/synchroSubscriptionMutations.d.ts +7 -2
- package/dist/mf/@mf-types/compiled-types/api/synchro/synchroToggleMutation.d.ts +5 -1
- package/dist/mf/@mf-types/compiled-types/components/microsoft/MicrosoftConsentPanel.d.ts +1 -0
- package/dist/mf/@mf-types/compiled-types/components/microsoft/useMicrosoftConsentPopup.d.ts +15 -0
- package/dist/mf/@mf-types/compiled-types/gen/IntegrationsApi.d.ts +213 -9
- package/dist/mf/@mf-types.zip +0 -0
- package/dist/mf/__federation_expose_connectors.js +1 -1
- package/dist/mf/__federation_expose_single_connector.js +1 -1
- package/dist/mf/__federation_expose_synchronisation.js +1 -1
- package/dist/mf/index.js +3 -3
- package/dist/mf/integrations_app.js +3 -3
- package/dist/mf/mf-manifest.json +2 -2
- package/dist/mf/mf-stats.json +7 -7
- package/package.json +1 -1
- package/dist/mf/5483.js +0 -1
package/dist/mf/4601.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(globalThis["chunk_integrations_app"]=globalThis["chunk_integrations_app"]||[]).push([["4601"],{800:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{F:()=>InlineLoader});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(4848);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(2773);function InlineLoader({label}){return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Center,{flex:1,h:"100%",children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Stack,{align:"center",gap:"md",children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Loader,{size:"md",color:"teal"}),label&&/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Text,{fz:"sm",c:"dimmed",children:label})]})})}},4184:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{q:()=>ConnectorBubble});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(4848);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(2773);var _tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(5200);function ConnectorBubble({connector,rename}){const{colorScheme}=(0,_mantine_core__WEBPACK_IMPORTED_MODULE_1__.useMantineColorScheme)();const bg="dark"===colorScheme?"white":"dark";const logoUrl=connector.main_connectorlist.logo_key?`https://img.logo.dev/${connector.main_connectorlist.logo_key}?token=pk_QvyqAb6uTRGJE2_sDsEb9g&retina=true`:`https://s3.eu-west-3.amazonaws.com/media.airporting/connectors/${connector.main_connectorlist.codename}.png`;return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Card,{children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Stack,{children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Avatar,{src:logoUrl,size:64,radius:"md",bg:bg,color:"dark"===colorScheme?"black":"white",p:18}),rename?rename.editing?/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{gap:"xs",wrap:"nowrap",children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.TextInput,{value:rename.draft,onChange:e=>rename.onDraftChange(e.currentTarget.value),autoFocus:true,onKeyDown:e=>{if("Enter"===e.key)rename.onSave();if("Escape"===e.key)rename.onCancel()},style:{flex:1}}),/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.ActionIcon,{onClick:rename.onSave,"aria-label":"Sauvegarder",loading:rename.isPending,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__.IconCheck,{size:16})}),/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.ActionIcon,{onClick:rename.onCancel,"aria-label":"Annuler",variant:"subtle",children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__.IconX,{size:16})})]}):/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{gap:"xs",wrap:"nowrap",children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Title,{w:"fit-content",order:3,children:connector.name}),/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.ActionIcon,{onClick:rename.onStartEditing,"aria-label":"Renommer",variant:"subtle",children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__.IconPencil,{size:16})})]}):/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Title,{w:"fit-content",order:3,children:connector.name}),/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Text,{c:"dimmed",size:"lg",lineClamp:3,children:connector.main_connectorlist.description_fr})]})})}},6699:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{Qq:()=>HttpClient,cM:()=>ContentType,qx:()=>IntegrationsApi});var ContentType=/*#__PURE__*/function(ContentType){ContentType["Json"]="application/json";ContentType["JsonApi"]="application/vnd.api+json";ContentType["FormData"]="multipart/form-data";ContentType["UrlEncoded"]="application/x-www-form-urlencoded";ContentType["Text"]="text/plain";return ContentType}({});class HttpClient{baseUrl="";securityData=null;securityWorker;abortControllers=new Map;customFetch=(...fetchParams)=>fetch(...fetchParams);baseApiParams={credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"};constructor(apiConfig={}){Object.assign(this,apiConfig)}setSecurityData=data=>{this.securityData=data};encodeQueryParam(key,value){const encodedKey=encodeURIComponent(key);return`${encodedKey}=${encodeURIComponent("number"==typeof value?value:`${value}`)}`}addQueryParam(query,key){return this.encodeQueryParam(key,query[key])}addArrayQueryParam(query,key){const value=query[key];return value.map(v=>this.encodeQueryParam(key,v)).join("&")}toQueryString(rawQuery){const query=rawQuery||{};const keys=Object.keys(query).filter(key=>void 0!==query[key]);return keys.map(key=>Array.isArray(query[key])?this.addArrayQueryParam(query,key):this.addQueryParam(query,key)).join("&")}addQueryParams(rawQuery){const queryString=this.toQueryString(rawQuery);return queryString?`?${queryString}`:""}contentFormatters={["application/json"]:input=>null!==input&&("object"==typeof input||"string"==typeof input)?JSON.stringify(input):input,["application/vnd.api+json"]:input=>null!==input&&("object"==typeof input||"string"==typeof input)?JSON.stringify(input):input,["text/plain"]:input=>null!==input&&"string"!=typeof input?JSON.stringify(input):input,["multipart/form-data"]:input=>{if(input instanceof FormData)return input;return Object.keys(input||{}).reduce((formData,key)=>{const property=input[key];formData.append(key,property instanceof Blob?property:"object"==typeof property&&null!==property?JSON.stringify(property):`${property}`);return formData},new FormData)},["application/x-www-form-urlencoded"]:input=>this.toQueryString(input)};mergeRequestParams(params1,params2){return{...this.baseApiParams,...params1,...params2||{},headers:{...this.baseApiParams.headers||{},...params1.headers||{},...params2&¶ms2.headers||{}}}}createAbortSignal=cancelToken=>{if(this.abortControllers.has(cancelToken)){const abortController=this.abortControllers.get(cancelToken);if(abortController)return abortController.signal;return}const abortController=new AbortController;this.abortControllers.set(cancelToken,abortController);return abortController.signal};abortRequest=cancelToken=>{const abortController=this.abortControllers.get(cancelToken);if(abortController){abortController.abort();this.abortControllers.delete(cancelToken)}};request=async({body,secure,path,type,query,format,baseUrl,cancelToken,...params})=>{const secureParams=("boolean"==typeof secure?secure:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{};const requestParams=this.mergeRequestParams(params,secureParams);const queryString=query&&this.toQueryString(query);const payloadFormatter=this.contentFormatters[type||"application/json"];const responseFormat=format||requestParams.format;return this.customFetch(`${baseUrl||this.baseUrl||""}${path}${queryString?`?${queryString}`:""}`,{...requestParams,headers:{...requestParams.headers||{},...type&&"multipart/form-data"!==type?{"Content-Type":type}:{}},signal:(cancelToken?this.createAbortSignal(cancelToken):requestParams.signal)||null,body:null==body?null:payloadFormatter(body)}).then(async response=>{const r=response;r.data=null;r.error=null;const responseToParse=responseFormat?response.clone():response;const data=responseFormat?await responseToParse[responseFormat]().then(data=>{if(r.ok)r.data=data;else r.error=data;return r}).catch(e=>{r.error=e;return r}):r;if(cancelToken)this.abortControllers.delete(cancelToken);if(!response.ok)throw data;return data})}}class IntegrationsApi{http;constructor(http){this.http=http}status=(params={})=>this.http.request({path:"/status",method:"GET",...params});connectors={getStatsConnectorsV1:({cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/stats`,method:"GET",secure:true,format:"json",...params}),getConnectorsV1:({cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/ok`,method:"GET",secure:true,format:"json",...params}),getIllConnectorsV1:({cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/ill`,method:"GET",secure:true,format:"json",...params}),getCatalogConnectorsV1:({cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/catalog`,method:"GET",secure:true,format:"json",...params}),addConnectorV1:({cid,...query},data,params={})=>this.http.request({path:`/v1/connectors/${cid}/add`,method:"POST",body:data,secure:true,type:"application/json",format:"json",...params}),getConnectorConfigV1:({connector,cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/config/${connector}`,method:"GET",format:"json",...params}),getConnectorSingleV1:({connector,cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/single/${connector}`,method:"GET",format:"json",...params}),putConnectorDataV1:({connector,cid,...query},data,params={})=>this.http.request({path:`/v1/connectors/${cid}/data/${connector}`,method:"PUT",body:data,type:"application/json",format:"json",...params}),renameConnectorV1:({connector,cid,...query},data,params={})=>this.http.request({path:`/v1/connectors/${cid}/${connector}`,method:"PATCH",body:data,secure:true,type:"application/json",format:"json",...params}),deleteConnectorV1:({connector,cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/${connector}`,method:"DELETE",secure:true,format:"json",...params}),getAuthSecretsV1:({connector,cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/${connector}/auth-secrets`,method:"GET",secure:true,format:"json",...params})};microsoft={startAdminConsentV1:({cid,...query},params={})=>this.http.request({path:`/v1/microsoft/${cid}/admin-consent/start`,method:"GET",query:query,secure:true,format:"json",...params}),handleCallbackV1:(query,params={})=>this.http.request({path:"/v1/microsoft/admin-consent/callback",method:"GET",query:query,...params}),getTenantV1:({cid,...query},params={})=>this.http.request({path:`/v1/microsoft/${cid}/tenant`,method:"GET",secure:true,format:"json",...params})}}},9344:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{d:()=>SingleConnectorApp});var jsx_runtime=__webpack_require__(4848);var index_mjs_=__webpack_require__(2773);var index_js_=__webpack_require__(8556);var dist_index_js_=__webpack_require__(4259);var InlineLoader=__webpack_require__(800);var modern_index_js_=__webpack_require__(7714);var useAppConfigConnectorSingle=__webpack_require__(4613);var IntegrationsApi=__webpack_require__(6699);function useApiConnectorSingle(){const config=(0,useAppConfigConnectorSingle.C)();const client=new IntegrationsApi.Qq({baseUrl:config.api.replace(/\/$/,""),baseApiParams:{headers:{Authorization:config.token?`Bearer ${config.token}`:"",From:config.owner}}});return new IntegrationsApi.qx(client)}function useConnectorConfigQuery({enabled=true}={}){const api=useApiConnectorSingle();const config=(0,useAppConfigConnectorSingle.C)();const query=(0,modern_index_js_.useQuery)({queryKey:["connector","config","form",config.company,config.connector],queryFn:async()=>await api.connectors.getConnectorConfigV1({cid:config.company,connector:+config.connector}).then(x=>x.data),enabled,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}var esm_index_mjs_=__webpack_require__(4931);function useConnectorSaveQuery(){const api=useApiConnectorSingle();const config=(0,useAppConfigConnectorSingle.C)();const queryClient=(0,modern_index_js_.useQueryClient)();const query=(0,modern_index_js_.useMutation)({mutationFn:async values=>await api.connectors.putConnectorDataV1({cid:config.company,connector:+config.connector},{data:values}).then(x=>x.data),onSuccess:()=>{queryClient.invalidateQueries({queryKey:["connector","config","single",config.company,config.connector]});queryClient.invalidateQueries({queryKey:["connector","config","form",config.company,config.connector]});queryClient.invalidateQueries({queryKey:["connectors","list",config.company]});queryClient.invalidateQueries({queryKey:["connectors","list","ill",config.company]});esm_index_mjs_.notifications.show({title:"Connecteur sauvegard\xe9",message:"Vos donn\xe9es sont enregistr\xe9es !"})},onError:(error,variables,context)=>{console.error(error,variables,context);esm_index_mjs_.notifications.show({color:"red",title:"Erreur !",message:"Nous rencontrons un soucis technique. Veuillez r\xe9essayer plus tard."})}});return query}function useConnectorSingleQuery(){const api=useApiConnectorSingle();const config=(0,useAppConfigConnectorSingle.C)();const query=(0,modern_index_js_.useQuery)({queryKey:["connector","config","single",config.company,config.connector],queryFn:async()=>await api.connectors.getConnectorSingleV1({cid:config.company,connector:+config.connector}).then(x=>x.data),refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}var connector_bubble=__webpack_require__(4184);function useConnectorRenameMutation(){const api=useApiConnectorSingle();const config=(0,useAppConfigConnectorSingle.C)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async name=>{const res=await api.http.request({path:`/v1/connectors/${config.company}/${config.connector}`,method:"PATCH",body:{name},type:"application/json",format:"json"});return res.data},onSuccess:()=>{queryClient.invalidateQueries({queryKey:["connector","config","single",config.company,config.connector]});queryClient.invalidateQueries({queryKey:["connectors","list",config.company]});queryClient.invalidateQueries({queryKey:["connectors","list","ill",config.company]});queryClient.invalidateQueries({queryKey:["connectors","ok",config.company]});queryClient.invalidateQueries({queryKey:["connectors","ill",config.company]});esm_index_mjs_.notifications.show({color:"green",title:"Connecteur renomm\xe9",message:"Le nom a \xe9t\xe9 mis \xe0 jour avec succ\xe8s."})},onError:error=>{console.error(error);esm_index_mjs_.notifications.show({color:"red",title:"Renommage \xe9chou\xe9",message:"R\xe9essayez dans un instant."})}})}function useMicrosoftTenantQuery(){const api=useApiConnectorSingle();const config=(0,useAppConfigConnectorSingle.C)();return(0,modern_index_js_.useQuery)({queryKey:["microsoft","tenant",config.company],queryFn:async()=>{try{const response=await api.microsoft.getTenantV1({cid:config.company});return response.data}catch(err){const status=err&&"object"==typeof err&&"status"in err?err.status:void 0;if(404===status)return null;throw err}},refetchOnWindowFocus:true,refetchOnReconnect:true,retry:false})}function useStartAdminConsentMutation(){const api=useApiConnectorSingle();const config=(0,useAppConfigConnectorSingle.C)();return(0,modern_index_js_.useMutation)({mutationFn:async({returnTo})=>{const response=await api.microsoft.startAdminConsentV1({cid:config.company,returnTo});return response.data}})}function isConsentMessage(value){if("object"!=typeof value||null===value)return false;const v=value;return"airporting-microsoft-consent"===v.type}const POPUP_NAME="airporting-microsoft-consent";const POPUP_FEATURES="width=600,height=720,resizable,scrollbars";function useMicrosoftConsentPopup({onResult}){const[isOpen,setIsOpen]=(0,index_js_.useState)(false);const popupRef=(0,index_js_.useRef)(null);const pollRef=(0,index_js_.useRef)(null);const stopPolling=(0,index_js_.useCallback)(()=>{if(null!==pollRef.current){window.clearInterval(pollRef.current);pollRef.current=null}},[]);const closePopup=(0,index_js_.useCallback)(()=>{if(popupRef.current&&!popupRef.current.closed)popupRef.current.close();popupRef.current=null;setIsOpen(false);stopPolling()},[stopPolling]);(0,index_js_.useEffect)(()=>{const handler=event=>{if(!isConsentMessage(event.data))return;onResult(event.data);closePopup()};window.addEventListener("message",handler);return()=>{window.removeEventListener("message",handler)}},[onResult,closePopup]);(0,index_js_.useEffect)(()=>()=>{closePopup()},[closePopup]);const openPopup=(0,index_js_.useCallback)(url=>{const popup=window.open(url,POPUP_NAME,POPUP_FEATURES);if(!popup)throw new Error("Impossible d’ouvrir la fen\xeatre Microsoft (popup bloqu\xe9 par le navigateur ?)");popupRef.current=popup;setIsOpen(true);stopPolling();pollRef.current=window.setInterval(()=>{if(popupRef.current?.closed)closePopup()},500)},[closePopup,stopPolling]);return{openPopup,closePopup,isOpen}}function MicrosoftConsentPanel(){const config=(0,useAppConfigConnectorSingle.C)();const tenantQuery=useMicrosoftTenantQuery();const startMutation=useStartAdminConsentMutation();const queryClient=(0,modern_index_js_.useQueryClient)();const[lastError,setLastError]=(0,index_js_.useState)(null);const handleResult=(0,index_js_.useCallback)(message=>{if(message.success){setLastError(null);queryClient.invalidateQueries({queryKey:["microsoft","tenant",config.company]})}else setLastError(message.errorDescription??message.error??"\xc9chec du consentement Microsoft")},[queryClient,config.company]);const{openPopup,isOpen}=useMicrosoftConsentPopup({onResult:handleResult});const handleConnect=(0,index_js_.useCallback)(async()=>{setLastError(null);try{const returnTo=window.location.href;const{url}=await startMutation.mutateAsync({returnTo});openPopup(url)}catch(err){setLastError(err instanceof Error?err.message:String(err))}},[startMutation,openPopup]);if(tenantQuery.isPending)return/*#__PURE__*/(0,jsx_runtime.jsx)(InlineLoader.F,{label:"Chargement du tenant Microsoft..."});if(tenantQuery.isError)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Alert,{color:"red",title:"Erreur de chargement",children:"Impossible de r\xe9cup\xe9rer le statut Microsoft pour cette entreprise."});const tenant=tenantQuery.data;const isConnecting=startMutation.isPending||isOpen;return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Stack,{gap:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Card,{withBorder:true,padding:"lg",radius:"md",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",align:"flex-start",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:4,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:600,fz:"lg",children:"Microsoft 365 (SharePoint / Excel / PowerPoint)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",fz:"sm",children:"Connecte ton organisation Microsoft pour qu'Airporting puisse synchroniser tes fichiers Excel h\xe9berg\xe9s sur SharePoint. Le consentement est donn\xe9 par un administrateur Microsoft de ton entreprise, en un clic."})]}),tenant?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:"green",size:"lg",children:"Connect\xe9"}):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:"gray",size:"lg",children:"Non connect\xe9"})]}),tenant?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:4,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fz:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("b",{children:"Tenant\xa0:"})," ",/*#__PURE__*/(0,jsx_runtime.jsx)("code",{children:tenant.tenant_id})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fz:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("b",{children:"Mode\xa0:"})," ","app_only"===tenant.auth_mode?"app-only (recommand\xe9)":"delegated"]}),tenant.admin_consented_at?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fz:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("b",{children:"Consentement donn\xe9 le\xa0:"})," ",new Date(tenant.admin_consented_at).toLocaleString("fr-FR",{timeZone:"Europe/Paris"})]}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{mt:"sm",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"light",onClick:handleConnect,loading:isConnecting,children:"Reconnecter Microsoft"})})]}):/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{onClick:handleConnect,loading:isConnecting,children:"Connecter Microsoft"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",fz:"xs",children:"Une fen\xeatre Microsoft s'ouvrira pour le consentement administrateur."})]}),lastError?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Alert,{color:"red",title:"Erreur",children:lastError}):null]})})})}function SingleConnectorApp(){const config=(0,useAppConfigConnectorSingle.C)();const itemRes=useConnectorSingleQuery();const item=itemRes.data;const configRes=useConnectorConfigQuery({enabled:!!item?.hasForm});const saveFn=useConnectorSaveQuery();const[editing,setEditing]=(0,index_js_.useState)(false);const[draft,setDraft]=(0,index_js_.useState)("");const renameMutation=useConnectorRenameMutation();(0,index_js_.useEffect)(()=>{if(item?.name)setDraft(item.name)},[item?.name]);const handleSave=()=>{renameMutation.mutate(draft,{onSuccess:()=>setEditing(false)})};const handleCancel=()=>{if(item?.name)setDraft(item.name);setEditing(false)};const backLink={text:"Liste des connecteurs",tab:""};switch(item?.status){case"active":backLink.tab="?tab=active";backLink.text="Connecteurs actifs";break;case"ill":backLink.tab="?tab=ill";backLink.text="Connecteurs \xe0 configurer";break}const isFormLoading=!item||item.hasForm&&!configRes.data;return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{py:10,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:0,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{w:"fit-content",mb:0,order:1,children:"Nos connecteurs"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{w:"fit-content",mb:0,c:"dimmed",fz:"h5",children:"Synchronisez vos comptes bancaires et outils comptables facilement."}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{py:10,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Anchor,{underline:"never",href:`/company/${config.company}/integrations/connectors${backLink.tab}`,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.Circle,{bg:"dark.4",size:24,ml:"auto",c:"white",children:/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.IconArrowUp,{rotate:270})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{w:"fit-content",c:"white",mb:0,order:3,children:backLink.text})]})})})]})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Grid,{w:"100%",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:12,lg:3},children:item?/*#__PURE__*/(0,jsx_runtime.jsx)(connector_bubble.q,{connector:item,rename:{editing,draft,isPending:renameMutation.isPending,onDraftChange:setDraft,onSave:handleSave,onCancel:handleCancel,onStartEditing:()=>setEditing(true)}}):/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:64,width:64,radius:"md"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:28,width:"60%"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:16,width:"80%"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:16,width:"70%"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:12,lg:9},children:isFormLoading?/*#__PURE__*/(0,jsx_runtime.jsx)(InlineLoader.F,{label:"Chargement du connecteur..."}):item.requiresMicrosoftConsent?/*#__PURE__*/(0,jsx_runtime.jsx)(MicrosoftConsentPanel,{}):item.hasForm?/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.DynamicForm,{config:()=>configRes,save:saveFn,revealContext:{cid:config.company,connectorId:config.connector}}):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Alert,{color:"blue",title:"Aucune configuration n\xe9cessaire",children:item.isBridge?"Ce connecteur est g\xe9r\xe9 via Bridge. Il n’y a rien \xe0 configurer ici.":"Ce connecteur ne n\xe9cessite aucune configuration."})})]})]})}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useConnectorDeleteMutation(): import("@tanstack/react-query").UseMutationResult<
|
|
1
|
+
export declare function useConnectorDeleteMutation(): import("@tanstack/react-query").UseMutationResult<import("../../gen/IntegrationsApi").ConnectorDeleteResponse, Error, number, unknown>;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { RecipeDetail } from './types.ts';
|
|
1
2
|
export declare function useSynchroJobDeleteMutation(): import("@tanstack/react-query").UseMutationResult<any, Error, {
|
|
2
3
|
id: number;
|
|
3
4
|
jobId: number;
|
|
4
|
-
},
|
|
5
|
+
}, {
|
|
6
|
+
previousDetail: RecipeDetail | undefined;
|
|
7
|
+
}>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { RecipeDetail } from './types.ts';
|
|
1
2
|
export declare function useSynchroJobToggleMutation(): import("@tanstack/react-query").UseMutationResult<any, Error, {
|
|
2
3
|
id: number;
|
|
3
4
|
jobId: number;
|
|
4
5
|
active: boolean;
|
|
5
|
-
},
|
|
6
|
+
}, {
|
|
7
|
+
previousDetail: RecipeDetail | undefined;
|
|
8
|
+
}>;
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function
|
|
1
|
+
import { SubscriptionsListResponse } from './types.ts';
|
|
2
|
+
export declare function useSynchroSubscribeMutation(): import("@tanstack/react-query").UseMutationResult<any, Error, number, {
|
|
3
|
+
previous: SubscriptionsListResponse | undefined;
|
|
4
|
+
}>;
|
|
5
|
+
export declare function useSynchroUnsubscribeMutation(): import("@tanstack/react-query").UseMutationResult<any, Error, number, {
|
|
6
|
+
previous: SubscriptionsListResponse | undefined;
|
|
7
|
+
}>;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { RecipeCustomer, RecipeDetail } from './types.ts';
|
|
1
2
|
export declare function useSynchroToggleMutation(): import("@tanstack/react-query").UseMutationResult<any, Error, {
|
|
2
3
|
id: number;
|
|
3
4
|
active: boolean;
|
|
4
|
-
},
|
|
5
|
+
}, {
|
|
6
|
+
previousDetail: RecipeDetail | undefined;
|
|
7
|
+
previousList: RecipeCustomer[] | undefined;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function MicrosoftConsentPanel(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type ConsentMessage = {
|
|
2
|
+
type: 'airporting-microsoft-consent';
|
|
3
|
+
success: boolean;
|
|
4
|
+
tenantId: string | null;
|
|
5
|
+
error: string | null;
|
|
6
|
+
errorDescription: string | null;
|
|
7
|
+
};
|
|
8
|
+
export declare function useMicrosoftConsentPopup({ onResult, }: {
|
|
9
|
+
onResult: (message: ConsentMessage) => void;
|
|
10
|
+
}): {
|
|
11
|
+
openPopup: (url: string) => void;
|
|
12
|
+
closePopup: () => void;
|
|
13
|
+
isOpen: boolean;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export interface AddConnectorV1Params {
|
|
2
2
|
cid: string;
|
|
3
3
|
}
|
|
4
|
+
export interface AdminConsentStartResponse {
|
|
5
|
+
url: string;
|
|
6
|
+
}
|
|
4
7
|
export interface CatalogItem {
|
|
5
8
|
codename: string;
|
|
6
9
|
description_fr: string | null;
|
|
@@ -22,6 +25,9 @@ export interface ConnectorAddResponse {
|
|
|
22
25
|
id: number;
|
|
23
26
|
name: string;
|
|
24
27
|
}
|
|
28
|
+
export interface ConnectorAuthSecretsResponse {
|
|
29
|
+
secrets: object;
|
|
30
|
+
}
|
|
25
31
|
export interface ConnectorCatalogResponse {
|
|
26
32
|
list: CatalogItem[];
|
|
27
33
|
}
|
|
@@ -29,18 +35,29 @@ export interface ConnectorConfigResponse {
|
|
|
29
35
|
initialData: object;
|
|
30
36
|
sections: FormSectionConfig[];
|
|
31
37
|
}
|
|
38
|
+
export interface ConnectorDeleteResponse {
|
|
39
|
+
status: string;
|
|
40
|
+
}
|
|
32
41
|
export interface ConnectorItem {
|
|
33
42
|
id: number;
|
|
34
43
|
main_connectorlist: {
|
|
35
44
|
codename: string;
|
|
36
45
|
description_fr: string | null;
|
|
37
|
-
id: number;
|
|
38
46
|
logo_key: string | null;
|
|
39
|
-
name: string;
|
|
40
|
-
original_codename: string;
|
|
41
47
|
};
|
|
42
48
|
name: string;
|
|
43
49
|
}
|
|
50
|
+
export interface ConnectorRenameRequest {
|
|
51
|
+
/**
|
|
52
|
+
* @minLength 1
|
|
53
|
+
* @maxLength 255
|
|
54
|
+
*/
|
|
55
|
+
name: string;
|
|
56
|
+
}
|
|
57
|
+
export interface ConnectorRenameResponse {
|
|
58
|
+
id: number;
|
|
59
|
+
name: string;
|
|
60
|
+
}
|
|
44
61
|
export interface ConnectorSaveDataRequest {
|
|
45
62
|
data: object;
|
|
46
63
|
}
|
|
@@ -48,18 +65,16 @@ export interface ConnectorSaveDataResponse {
|
|
|
48
65
|
status: string;
|
|
49
66
|
}
|
|
50
67
|
export interface ConnectorSingleResponse {
|
|
68
|
+
hasForm: boolean;
|
|
51
69
|
id: number;
|
|
52
70
|
isBridge: boolean;
|
|
53
|
-
hasForm: boolean;
|
|
54
71
|
main_connectorlist: {
|
|
55
72
|
codename: string;
|
|
56
73
|
description_fr: string | null;
|
|
57
|
-
id: number;
|
|
58
74
|
logo_key: string | null;
|
|
59
|
-
name: string;
|
|
60
|
-
original_codename: string;
|
|
61
75
|
};
|
|
62
76
|
name: string;
|
|
77
|
+
requiresMicrosoftConsent: boolean;
|
|
63
78
|
status: object;
|
|
64
79
|
}
|
|
65
80
|
export interface ConnectorsListResponse {
|
|
@@ -77,6 +92,10 @@ export interface DeleteConnectorV1Params {
|
|
|
77
92
|
export interface FormSectionConfig {
|
|
78
93
|
fields: object[];
|
|
79
94
|
}
|
|
95
|
+
export interface GetAuthSecretsV1Params {
|
|
96
|
+
cid: string;
|
|
97
|
+
connector: number;
|
|
98
|
+
}
|
|
80
99
|
export interface GetCatalogConnectorsV1Params {
|
|
81
100
|
cid: string;
|
|
82
101
|
}
|
|
@@ -97,10 +116,38 @@ export interface GetIllConnectorsV1Params {
|
|
|
97
116
|
export interface GetStatsConnectorsV1Params {
|
|
98
117
|
cid: string;
|
|
99
118
|
}
|
|
119
|
+
export interface GetTenantV1Params {
|
|
120
|
+
cid: string;
|
|
121
|
+
}
|
|
122
|
+
export interface HandleCallbackV1Params {
|
|
123
|
+
admin_consent?: string;
|
|
124
|
+
error?: string;
|
|
125
|
+
error_description?: string;
|
|
126
|
+
error_subcode?: string;
|
|
127
|
+
state: string;
|
|
128
|
+
tenant?: string;
|
|
129
|
+
}
|
|
130
|
+
export interface MicrosoftTenantResponse {
|
|
131
|
+
/** @format date-time */
|
|
132
|
+
admin_consented_at: string | null;
|
|
133
|
+
auth_mode: object;
|
|
134
|
+
id: number;
|
|
135
|
+
scopes_granted: string | null;
|
|
136
|
+
tenant_id: string;
|
|
137
|
+
}
|
|
100
138
|
export interface PutConnectorDataV1Params {
|
|
101
139
|
cid: string;
|
|
102
140
|
connector: number;
|
|
103
141
|
}
|
|
142
|
+
export interface RenameConnectorV1Params {
|
|
143
|
+
cid: string;
|
|
144
|
+
connector: number;
|
|
145
|
+
}
|
|
146
|
+
export interface StartAdminConsentV1Params {
|
|
147
|
+
cid: string;
|
|
148
|
+
/** @format uri */
|
|
149
|
+
returnTo: string;
|
|
150
|
+
}
|
|
104
151
|
export declare namespace Connectors {
|
|
105
152
|
/**
|
|
106
153
|
* No description
|
|
@@ -238,13 +285,31 @@ export declare namespace Connectors {
|
|
|
238
285
|
type RequestHeaders = {};
|
|
239
286
|
type ResponseBody = ConnectorSaveDataResponse;
|
|
240
287
|
}
|
|
288
|
+
/**
|
|
289
|
+
* No description
|
|
290
|
+
* @tags Connectors
|
|
291
|
+
* @name RenameConnectorV1
|
|
292
|
+
* @request PATCH:/v1/connectors/{cid}/{connector}
|
|
293
|
+
* @secure
|
|
294
|
+
* @response `200` `ConnectorRenameResponse`
|
|
295
|
+
*/
|
|
296
|
+
namespace RenameConnectorV1 {
|
|
297
|
+
type RequestParams = {
|
|
298
|
+
cid: string;
|
|
299
|
+
connector: number;
|
|
300
|
+
};
|
|
301
|
+
type RequestQuery = {};
|
|
302
|
+
type RequestBody = ConnectorRenameRequest;
|
|
303
|
+
type RequestHeaders = {};
|
|
304
|
+
type ResponseBody = ConnectorRenameResponse;
|
|
305
|
+
}
|
|
241
306
|
/**
|
|
242
307
|
* No description
|
|
243
308
|
* @tags Connectors
|
|
244
309
|
* @name DeleteConnectorV1
|
|
245
310
|
* @request DELETE:/v1/connectors/{cid}/{connector}
|
|
246
311
|
* @secure
|
|
247
|
-
* @response `200` `
|
|
312
|
+
* @response `200` `ConnectorDeleteResponse`
|
|
248
313
|
*/
|
|
249
314
|
namespace DeleteConnectorV1 {
|
|
250
315
|
type RequestParams = {
|
|
@@ -254,8 +319,91 @@ export declare namespace Connectors {
|
|
|
254
319
|
type RequestQuery = {};
|
|
255
320
|
type RequestBody = never;
|
|
256
321
|
type RequestHeaders = {};
|
|
322
|
+
type ResponseBody = ConnectorDeleteResponse;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* No description
|
|
326
|
+
* @tags Connectors
|
|
327
|
+
* @name GetAuthSecretsV1
|
|
328
|
+
* @summary GET /v1/connectors/:cid/:connector/auth-secrets
|
|
329
|
+
|
|
330
|
+
Returns the decrypted auth credentials for a connector.
|
|
331
|
+
Protected by both the standard company guard and RevealTokenGuard,
|
|
332
|
+
which validates the short-lived JWE reveal token from X-Reveal-Token header.
|
|
333
|
+
* @request GET:/v1/connectors/{cid}/{connector}/auth-secrets
|
|
334
|
+
* @secure
|
|
335
|
+
* @response `200` `ConnectorAuthSecretsResponse`
|
|
336
|
+
*/
|
|
337
|
+
namespace GetAuthSecretsV1 {
|
|
338
|
+
type RequestParams = {
|
|
339
|
+
cid: string;
|
|
340
|
+
connector: number;
|
|
341
|
+
};
|
|
342
|
+
type RequestQuery = {};
|
|
343
|
+
type RequestBody = never;
|
|
344
|
+
type RequestHeaders = {};
|
|
345
|
+
type ResponseBody = ConnectorAuthSecretsResponse;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
export declare namespace Microsoft {
|
|
349
|
+
/**
|
|
350
|
+
* No description
|
|
351
|
+
* @tags Microsoft
|
|
352
|
+
* @name StartAdminConsentV1
|
|
353
|
+
* @request GET:/v1/microsoft/{cid}/admin-consent/start
|
|
354
|
+
* @secure
|
|
355
|
+
* @response `200` `AdminConsentStartResponse`
|
|
356
|
+
*/
|
|
357
|
+
namespace StartAdminConsentV1 {
|
|
358
|
+
type RequestParams = {
|
|
359
|
+
cid: string;
|
|
360
|
+
};
|
|
361
|
+
type RequestQuery = {
|
|
362
|
+
/** @format uri */
|
|
363
|
+
returnTo: string;
|
|
364
|
+
};
|
|
365
|
+
type RequestBody = never;
|
|
366
|
+
type RequestHeaders = {};
|
|
367
|
+
type ResponseBody = AdminConsentStartResponse;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* No description
|
|
371
|
+
* @tags Microsoft
|
|
372
|
+
* @name HandleCallbackV1
|
|
373
|
+
* @request GET:/v1/microsoft/admin-consent/callback
|
|
374
|
+
* @response `200` `void`
|
|
375
|
+
*/
|
|
376
|
+
namespace HandleCallbackV1 {
|
|
377
|
+
type RequestParams = {};
|
|
378
|
+
type RequestQuery = {
|
|
379
|
+
admin_consent?: string;
|
|
380
|
+
error?: string;
|
|
381
|
+
error_description?: string;
|
|
382
|
+
error_subcode?: string;
|
|
383
|
+
state: string;
|
|
384
|
+
tenant?: string;
|
|
385
|
+
};
|
|
386
|
+
type RequestBody = never;
|
|
387
|
+
type RequestHeaders = {};
|
|
257
388
|
type ResponseBody = void;
|
|
258
389
|
}
|
|
390
|
+
/**
|
|
391
|
+
* No description
|
|
392
|
+
* @tags Microsoft
|
|
393
|
+
* @name GetTenantV1
|
|
394
|
+
* @request GET:/v1/microsoft/{cid}/tenant
|
|
395
|
+
* @secure
|
|
396
|
+
* @response `200` `MicrosoftTenantResponse`
|
|
397
|
+
*/
|
|
398
|
+
namespace GetTenantV1 {
|
|
399
|
+
type RequestParams = {
|
|
400
|
+
cid: string;
|
|
401
|
+
};
|
|
402
|
+
type RequestQuery = {};
|
|
403
|
+
type RequestBody = never;
|
|
404
|
+
type RequestHeaders = {};
|
|
405
|
+
type ResponseBody = MicrosoftTenantResponse;
|
|
406
|
+
}
|
|
259
407
|
}
|
|
260
408
|
export type QueryParamsType = Record<string | number, any>;
|
|
261
409
|
export type ResponseFormat = keyof Omit<Body, 'body' | 'bodyUsed'>;
|
|
@@ -413,6 +561,16 @@ export declare class IntegrationsApi<SecurityDataType extends unknown> {
|
|
|
413
561
|
* @response `200` `ConnectorSaveDataResponse`
|
|
414
562
|
*/
|
|
415
563
|
putConnectorDataV1: ({ connector, cid, ...query }: PutConnectorDataV1Params, data: ConnectorSaveDataRequest, params?: RequestParams) => Promise<HttpResponse<ConnectorSaveDataResponse, any>>;
|
|
564
|
+
/**
|
|
565
|
+
* No description
|
|
566
|
+
*
|
|
567
|
+
* @tags Connectors
|
|
568
|
+
* @name RenameConnectorV1
|
|
569
|
+
* @request PATCH:/v1/connectors/{cid}/{connector}
|
|
570
|
+
* @secure
|
|
571
|
+
* @response `200` `ConnectorRenameResponse`
|
|
572
|
+
*/
|
|
573
|
+
renameConnectorV1: ({ connector, cid, ...query }: RenameConnectorV1Params, data: ConnectorRenameRequest, params?: RequestParams) => Promise<HttpResponse<ConnectorRenameResponse, any>>;
|
|
416
574
|
/**
|
|
417
575
|
* No description
|
|
418
576
|
*
|
|
@@ -420,9 +578,55 @@ export declare class IntegrationsApi<SecurityDataType extends unknown> {
|
|
|
420
578
|
* @name DeleteConnectorV1
|
|
421
579
|
* @request DELETE:/v1/connectors/{cid}/{connector}
|
|
422
580
|
* @secure
|
|
581
|
+
* @response `200` `ConnectorDeleteResponse`
|
|
582
|
+
*/
|
|
583
|
+
deleteConnectorV1: ({ connector, cid, ...query }: DeleteConnectorV1Params, params?: RequestParams) => Promise<HttpResponse<ConnectorDeleteResponse, any>>;
|
|
584
|
+
/**
|
|
585
|
+
* No description
|
|
586
|
+
*
|
|
587
|
+
* @tags Connectors
|
|
588
|
+
* @name GetAuthSecretsV1
|
|
589
|
+
* @summary GET /v1/connectors/:cid/:connector/auth-secrets
|
|
590
|
+
|
|
591
|
+
Returns the decrypted auth credentials for a connector.
|
|
592
|
+
Protected by both the standard company guard and RevealTokenGuard,
|
|
593
|
+
which validates the short-lived JWE reveal token from X-Reveal-Token header.
|
|
594
|
+
* @request GET:/v1/connectors/{cid}/{connector}/auth-secrets
|
|
595
|
+
* @secure
|
|
596
|
+
* @response `200` `ConnectorAuthSecretsResponse`
|
|
597
|
+
*/
|
|
598
|
+
getAuthSecretsV1: ({ connector, cid, ...query }: GetAuthSecretsV1Params, params?: RequestParams) => Promise<HttpResponse<ConnectorAuthSecretsResponse, any>>;
|
|
599
|
+
};
|
|
600
|
+
microsoft: {
|
|
601
|
+
/**
|
|
602
|
+
* No description
|
|
603
|
+
*
|
|
604
|
+
* @tags Microsoft
|
|
605
|
+
* @name StartAdminConsentV1
|
|
606
|
+
* @request GET:/v1/microsoft/{cid}/admin-consent/start
|
|
607
|
+
* @secure
|
|
608
|
+
* @response `200` `AdminConsentStartResponse`
|
|
609
|
+
*/
|
|
610
|
+
startAdminConsentV1: ({ cid, ...query }: StartAdminConsentV1Params, params?: RequestParams) => Promise<HttpResponse<AdminConsentStartResponse, any>>;
|
|
611
|
+
/**
|
|
612
|
+
* No description
|
|
613
|
+
*
|
|
614
|
+
* @tags Microsoft
|
|
615
|
+
* @name HandleCallbackV1
|
|
616
|
+
* @request GET:/v1/microsoft/admin-consent/callback
|
|
423
617
|
* @response `200` `void`
|
|
424
618
|
*/
|
|
425
|
-
|
|
619
|
+
handleCallbackV1: (query: HandleCallbackV1Params, params?: RequestParams) => Promise<HttpResponse<void, any>>;
|
|
620
|
+
/**
|
|
621
|
+
* No description
|
|
622
|
+
*
|
|
623
|
+
* @tags Microsoft
|
|
624
|
+
* @name GetTenantV1
|
|
625
|
+
* @request GET:/v1/microsoft/{cid}/tenant
|
|
626
|
+
* @secure
|
|
627
|
+
* @response `200` `MicrosoftTenantResponse`
|
|
628
|
+
*/
|
|
629
|
+
getTenantV1: ({ cid, ...query }: GetTenantV1Params, params?: RequestParams) => Promise<HttpResponse<MicrosoftTenantResponse, any>>;
|
|
426
630
|
};
|
|
427
631
|
}
|
|
428
632
|
export {};
|
package/dist/mf/@mf-types.zip
CHANGED
|
Binary file
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
*
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var REACT_ELEMENT_TYPE=Symbol.for("react.transitional.element"),REACT_FRAGMENT_TYPE=Symbol.for("react.fragment");function jsxProd(type,config,maybeKey){var key=null;void 0!==maybeKey&&(key=""+maybeKey);void 0!==config.key&&(key=""+config.key);if("key"in config){maybeKey={};for(var propName in config)"key"!==propName&&(maybeKey[propName]=config[propName])}else maybeKey=config;config=maybeKey.ref;return{$$typeof:REACT_ELEMENT_TYPE,type:type,key:key,ref:void 0!==config?config:null,props:maybeKey}}exports.Fragment=REACT_FRAGMENT_TYPE;exports.jsx=jsxProd;exports.jsxs=jsxProd},4848:function(module,__unused_webpack_exports,__webpack_require__){module.exports=__webpack_require__(9698)},9429:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Connectors});var jsx_runtime=__webpack_require__(4848);var index_js_=__webpack_require__(8556);var index_mjs_=__webpack_require__(2773);var modern_index_js_=__webpack_require__(7714);var IntegrationsApi=__webpack_require__(6699);const AppConfigCtx=/*#__PURE__*/(0,index_js_.createContext)(null);const AppConfigProvider=AppConfigCtx.Provider;function useAppConfig(){const config=(0,index_js_.useContext)(AppConfigCtx);if(!config)throw new Error("Called `useAppConfig` outside a `<AppConfigProvider />`");return config}function useApi(){const config=useAppConfig();const client=new IntegrationsApi.Qq({baseUrl:config.api.replace(/\/$/,""),baseApiParams:{headers:{Authorization:config.token?`Bearer ${config.token}`:"",From:config.owner}}});return new IntegrationsApi.qx(client)}function useStatsQuery(){const api=useApi();const config=useAppConfig();const query=(0,modern_index_js_.useQuery)({queryKey:["connectors","stats",config.company],queryFn:async()=>await api.connectors.getStatsConnectorsV1({cid:config.company}).then(x=>x.data),staleTime:6e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}function useConnectorsListQuery(){const api=useApi();const config=useAppConfig();const query=(0,modern_index_js_.useQuery)({queryKey:["connectors","list",config.company],queryFn:async()=>await api.connectors.getConnectorsV1({cid:config.company}).then(x=>x.data),staleTime:6e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}var connector_bubble=__webpack_require__(4184);var tabler_icons_react_mjs_=__webpack_require__(5200);var esm_index_mjs_=__webpack_require__(4931);function useConnectorDeleteMutation(){const api=useApi();const config=useAppConfig();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async connector=>{const res=await api.connectors.deleteConnectorV1({cid:config.company,connector});return res.data},onSuccess:()=>{queryClient.invalidateQueries({queryKey:["connectors","list",config.company]});queryClient.invalidateQueries({queryKey:["connectors","list","ill",config.company]});queryClient.invalidateQueries({queryKey:["connectors","catalog",config.company]});queryClient.invalidateQueries({queryKey:["connectors","stats",config.company]});queryClient.invalidateQueries({queryKey:["connectors","ok",config.company]});queryClient.invalidateQueries({queryKey:["connectors","ill",config.company]});esm_index_mjs_.notifications.show({color:"green",title:"Connecteur supprim\xe9",message:"Vous pouvez le r\xe9ajouter depuis le catalogue."})},onError:error=>{console.error(error);esm_index_mjs_.notifications.show({color:"red",title:"Suppression \xe9chou\xe9e",message:"R\xe9essayez dans un instant."})}})}var modals_esm_index_mjs_=__webpack_require__(4403);function isDeleteConfirmInput(input){return"DELETE"===input}function DeleteActiveBody({name,onConfirm}){const[input,setInput]=(0,index_js_.useState)("");const isMatch=isDeleteConfirmInput(input);const handleConfirm=()=>{if(!isMatch)return;onConfirm();modals_esm_index_mjs_.modals.closeAll()};return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",children:["Le connecteur ",/*#__PURE__*/(0,jsx_runtime.jsx)("strong",{children:name})," est actuellement actif. Sa suppression arr\xeatera la synchronisation et le retirera de la liste. Vous pourrez le r\xe9ajouter depuis le catalogue plus tard."]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",children:["Pour confirmer, tapez ",/*#__PURE__*/(0,jsx_runtime.jsx)("strong",{children:"DELETE"})," ci-dessous."]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{value:input,onChange:e=>setInput(e.currentTarget.value),placeholder:"DELETE",autoFocus:true,onKeyDown:e=>{if("Enter"===e.key)handleConfirm()}}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:()=>modals_esm_index_mjs_.modals.closeAll(),children:"Annuler"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{color:"red",disabled:!isMatch,onClick:handleConfirm,children:"Supprimer"})]})]})}function openDeleteActiveConnectorModal(name,onConfirm){modals_esm_index_mjs_.modals.open({title:"Supprimer ce connecteur ?",centered:true,children:/*#__PURE__*/(0,jsx_runtime.jsx)(DeleteActiveBody,{name:name,onConfirm:onConfirm})})}function ConnectorMenu({connectorId,connectorName,isActive}){const{mutate,isPending}=useConnectorDeleteMutation();const handleDelete=()=>{if(isActive)openDeleteActiveConnectorModal(connectorName,()=>mutate(connectorId));else mutate(connectorId)};const stopBubble=e=>{e.stopPropagation();e.preventDefault()};return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Menu,{position:"bottom-end",withinPortal:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Target,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{variant:"subtle",color:"gray","aria-label":"Actions du connecteur",onClick:stopBubble,children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconDots,{size:18})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Dropdown,{onClick:stopBubble,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Item,{color:"red",leftSection:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconTrash,{size:16}),onClick:handleDelete,disabled:isPending,children:"Supprimer"})})]})}function ListOkComponent(){const config=useAppConfig();const listResultRes=useConnectorsListQuery();const listResult=listResultRes.data;return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{w:"fit-content",mb:0,order:2,children:"Tous vos connecteurs en marche"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:{base:1,xs:2,sm:3,md:4,lg:5,xl:6},spacing:"lg",verticalSpacing:"lg",style:{alignItems:"stretch"},children:listResult?.list?.map((connector,idx)=>connector?.main_connectorlist?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{pos:"relative",style:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Anchor,{underline:"never",href:`/company/${config.company}/integrations/${connector.id}/connector`,children:/*#__PURE__*/(0,jsx_runtime.jsx)(connector_bubble.q,{connector:connector})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Box,{pos:"absolute",top:8,right:8,children:/*#__PURE__*/(0,jsx_runtime.jsx)(ConnectorMenu,{connectorId:connector.id,connectorName:connector.name,isActive:true})})]},idx):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{radius:"md",animate:true},idx))})]})}function useConnectorsIllListQuery(){const api=useApi();const config=useAppConfig();const query=(0,modern_index_js_.useQuery)({queryKey:["connectors","list","ill",config.company],queryFn:async()=>await api.connectors.getIllConnectorsV1({cid:config.company}).then(x=>x.data),staleTime:6e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}function ListIllComponent(){const config=useAppConfig();const listResultRes=useConnectorsIllListQuery();const listResult=listResultRes.data;return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{w:"fit-content",mb:0,order:2,children:"Tous vos connecteurs \xe0 configurer"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:{base:1,xs:2,sm:3,md:4,lg:5,xl:6},spacing:"lg",verticalSpacing:"lg",style:{alignItems:"stretch"},children:listResult?.list?.map((connector,idx)=>connector?.main_connectorlist?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{pos:"relative",style:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Anchor,{underline:"never",href:`/company/${config.company}/integrations/${connector.id}/connector`,children:/*#__PURE__*/(0,jsx_runtime.jsx)(connector_bubble.q,{connector:connector})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Box,{pos:"absolute",top:8,right:8,children:/*#__PURE__*/(0,jsx_runtime.jsx)(ConnectorMenu,{connectorId:connector.id,connectorName:connector.name,isActive:false})})]},idx):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{radius:"md",animate:true},idx))})]})}function useConnectorAddMutation(){const api=useApi();const config=useAppConfig();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async connector_id=>{const res=await api.connectors.addConnectorV1({cid:config.company},{connector_id});return res.data},onSuccess:()=>{queryClient.invalidateQueries({queryKey:["connectors","catalog",config.company]});queryClient.invalidateQueries({queryKey:["connectors","list",config.company]});queryClient.invalidateQueries({queryKey:["connectors","list","ill",config.company]});queryClient.invalidateQueries({queryKey:["connectors","stats",config.company]});queryClient.invalidateQueries({queryKey:["connectors","ok",config.company]});queryClient.invalidateQueries({queryKey:["connectors","ill",config.company]})}})}function useConnectorCatalogQuery(){const api=useApi();const config=useAppConfig();const query=(0,modern_index_js_.useQuery)({queryKey:["connectors","catalog",config.company],queryFn:async()=>await api.connectors.getCatalogConnectorsV1({cid:config.company}).then(x=>x.data),refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}function CollapsibleGroup({title,count,collapsed,onToggle,children}){return/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.UnstyledButton,{onClick:onToggle,style:{width:"100%",padding:"8px 12px"},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[collapsed?/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconChevronRight,{size:16}):/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconChevronDown,{size:16}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:600,children:title}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{c:"dimmed",children:["(",count,")"]})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Collapse,{in:!collapsed,children:children})]})}const KEY=userId=>`connectors-expanded-groups:${userId}`;function useCollapsedGroups(userId,_allGroupKeys){const[expanded,setExpanded]=(0,index_js_.useState)(()=>{const raw=localStorage.getItem(KEY(userId));if(raw)try{return new Set(JSON.parse(raw))}catch{}return new Set});(0,index_js_.useEffect)(()=>{localStorage.setItem(KEY(userId),JSON.stringify([...expanded]))},[userId,expanded]);const toggle=(0,index_js_.useCallback)(key=>{setExpanded(prev=>{const next=new Set(prev);if(next.has(key))next.delete(key);else next.add(key);return next})},[]);const isCollapsed=(0,index_js_.useCallback)(key=>!expanded.has(key),[expanded]);return{isCollapsed,toggle}}function normalize(value){return(value??"").toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"")}function getBaseName(name){return name.replace(/\s+via\s+.+$/i,"").trim()}function getMethodSuffix(name,baseName){return name.length>baseName.length?name.slice(baseName.length).trim():name}function getLogoUrl(logoKey,codename){return logoKey?`https://img.logo.dev/${logoKey}?token=pk_QvyqAb6uTRGJE2_sDsEb9g&retina=true`:`https://s3.eu-west-3.amazonaws.com/media.airporting/connectors/${codename}.png`}function GroupCard({group,pending}){const{colorScheme}=(0,index_mjs_.useMantineColorScheme)();const bg="dark"===colorScheme?"white":"dark";const first=group.items[0];const logoUrl=getLogoUrl(group.logoKey,first.codename);return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Card,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",align:"flex-start",children:[pending?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Loader,{size:64}):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Avatar,{src:logoUrl,size:64,radius:"md",bg:bg,color:"dark"===colorScheme?"black":"white",p:18}),group.items.length>1&&/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Badge,{variant:"light",color:"blue",children:[group.items.length," m\xe9thodes"]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{w:"fit-content",order:3,children:group.baseName}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",size:"lg",lineClamp:3,children:first.description_fr})]})})}function MethodChoiceCard({item,baseName,pending,disabled,onClick}){const suffix=getMethodSuffix(item.name,baseName);return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Card,{style:{cursor:disabled?"wait":"pointer",opacity:disabled&&!pending?.5:1},onClick:()=>{if(!disabled)onClick()},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",align:"center",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:4,style:{flex:1},children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:600,children:suffix||item.name}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{variant:"light",color:"gray",children:item.sharing_method})]}),item.description_fr&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",size:"sm",lineClamp:2,children:item.description_fr})]}),pending&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Loader,{size:"sm"})]})})}function ListCatalogComponent(){const config=useAppConfig();const result=useConnectorCatalogQuery();const list=result.data?.list;const[searchValue,setSearchValue]=(0,index_js_.useState)("");const[pendingId,setPendingId]=(0,index_js_.useState)(null);const[selectedGroup,setSelectedGroup]=(0,index_js_.useState)(null);const[hoveredGroupKey,setHoveredGroupKey]=(0,index_js_.useState)(null);const mutation=useConnectorAddMutation();const filtered=(0,index_js_.useMemo)(()=>{if(!list)return;const q=normalize(searchValue);if(!q)return list;return list.filter(item=>normalize(`${item.name} ${item.description_fr??""}`).includes(q))},[list,searchValue]);const sections=(0,index_js_.useMemo)(()=>{if(!filtered)return;const groups=new Map;for(const item of filtered){const baseName=getBaseName(item.name);const groupKey=`${item.logo_key??item.codename}::${baseName}`;if(!groups.has(groupKey))groups.set(groupKey,{groupKey,baseName,type:item.type,logoKey:item.logo_key,items:[]});groups.get(groupKey).items.push(item)}const byCategory=new Map;for(const group of groups.values()){const k=group.type.codename;if(!byCategory.has(k))byCategory.set(k,{type:group.type,groups:[]});byCategory.get(k).groups.push(group)}return Array.from(byCategory.values())},[filtered]);const sectionKeys=(0,index_js_.useMemo)(()=>(sections??[]).map(s=>s.type.codename),[sections]);const{isCollapsed,toggle}=useCollapsedGroups(`catalog:${config.owner}`,sectionKeys);const triggerAdd=id=>{setPendingId(id);mutation.mutate(id,{onSuccess:data=>{window.location.href=`/company/${config.company}/integrations/${data.id}/connector`},onError:()=>{setPendingId(null)}})};const handleGroupClick=group=>{if(mutation.isPending)return;if(1===group.items.length)triggerAdd(group.items[0].id);else setSelectedGroup(group)};const handleCloseModal=()=>{if(mutation.isPending)return;setSelectedGroup(null);setPendingId(null)};return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{placeholder:"Rechercher un connecteur...",leftSection:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconSearch,{size:16}),value:searchValue,onChange:e=>setSearchValue(e.currentTarget.value),size:"md"}),sections?sections.map(section=>/*#__PURE__*/(0,jsx_runtime.jsx)(CollapsibleGroup,{title:section.type.name,count:section.groups.length,collapsed:isCollapsed(section.type.codename),onToggle:()=>toggle(section.type.codename),children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:{base:1,xs:2,sm:3,md:4,lg:5,xl:6},spacing:"lg",verticalSpacing:"lg",style:{alignItems:"stretch"},children:section.groups.map(group=>{const isSinglePending=1===group.items.length&&pendingId===group.items[0].id;const isHovered=hoveredGroupKey===group.groupKey&&!mutation.isPending;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{withBorder:true,style:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between",cursor:mutation.isPending?"wait":"pointer",opacity:mutation.isPending&&!isSinglePending?.5:1,borderColor:isHovered?"var(--mantine-color-green-5)":void 0,backgroundColor:isHovered?"var(--mantine-color-green-0)":void 0,transition:"border-color 120ms ease, background-color 120ms ease",position:"relative"},onMouseEnter:()=>setHoveredGroupKey(group.groupKey),onMouseLeave:()=>setHoveredGroupKey(null),onClick:()=>handleGroupClick(group),children:[isHovered&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{variant:"filled",color:"green",style:{position:"absolute",top:8,right:8,zIndex:1},children:"Configurer →"}),/*#__PURE__*/(0,jsx_runtime.jsx)(GroupCard,{group:group,pending:isSinglePending})]},group.groupKey)})})},section.type.codename)):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:{base:1,xs:2,sm:3,md:4,lg:5,xl:6},spacing:"lg",verticalSpacing:"lg",children:Array.from({length:8}).map((_,idx)=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:180,radius:"md",animate:true},idx))}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:null!==selectedGroup,onClose:handleCloseModal,title:selectedGroup?.baseName??"",size:"lg",children:selectedGroup&&/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"Choisir une m\xe9thode de connexion :"}),selectedGroup.items.map(item=>/*#__PURE__*/(0,jsx_runtime.jsx)(MethodChoiceCard,{item:item,baseName:selectedGroup.baseName,pending:pendingId===item.id,disabled:mutation.isPending,onClick:()=>triggerAdd(item.id)},item.id))]})})]})}var dist_index_js_=__webpack_require__(4259);function ConnectorsApp(){const tab=(0,dist_index_js_.useRxState)(new URL(location.href).searchParams.get("tab")??"active");const statsResultRes=useStatsQuery();const statsResult=statsResultRes.data;const[tabValue,setTabValue]=(0,index_js_.useState)(tab.value??"active");(0,index_js_.useEffect)(()=>{tab.dispatch(tabValue)},[tabValue]);return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{size:"xl",px:0,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{py:16,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:0,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{w:"fit-content",mb:0,order:1,children:"Nos connecteurs"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{w:"fit-content",mb:0,c:"dimmed",fz:"h5",children:"Synchronisez vos comptes bancaires et outils comptables facilement."})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{py:16,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SegmentedControl,{value:tabValue,onChange:setTabValue,radius:"md",size:"lg",data:[{label:`Connecteurs actifs (${statsResult?statsResult.ok??0:"…"})`,value:"active"},{label:`Connecteurs \xe0 configurer (${statsResult?statsResult.ill??0:"…"})`,value:"ill"},{label:"Les autres connecteurs",value:"all"}]})}),"active"===tabValue&&/*#__PURE__*/(0,jsx_runtime.jsx)(ListOkComponent,{}),"ill"===tabValue&&/*#__PURE__*/(0,jsx_runtime.jsx)(ListIllComponent,{}),"all"===tabValue&&/*#__PURE__*/(0,jsx_runtime.jsx)(ListCatalogComponent,{})]})}var dist_esm_index_mjs_=__webpack_require__(4449);const theme=(0,index_mjs_.createTheme)((0,dist_esm_index_mjs_.assign)(dist_index_js_.theme,{components:{}}));const cssVarResolver=x=>(0,dist_esm_index_mjs_.assign)(dist_index_js_.cssVarResolver(x),{dark:{},light:{},variables:{}});function Providers(props){const{children,config,mantine,tanstack}=props;return/*#__PURE__*/(0,jsx_runtime.jsx)(AppConfigProvider,{value:config,children:/*#__PURE__*/(0,jsx_runtime.jsx)(modern_index_js_.QueryClientProvider,{client:tanstack?.queryClient??new modern_index_js_.QueryClient,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.MantineProvider,{theme:theme,cssVariablesResolver:cssVarResolver,defaultColorScheme:mantine?.defaultColorScheme,forceColorScheme:mantine?.forceColorScheme,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(modals_esm_index_mjs_.ModalsProvider,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(esm_index_mjs_.Notifications,{}),/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.RevealTokenProvider,{children:children})]})})})})}function Connectors(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(Providers,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(ConnectorsApp,{})})})}},4184:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{q:()=>ConnectorBubble});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(4848);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(2773);var _tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(5200);function ConnectorBubble({connector,rename}){const{colorScheme}=(0,_mantine_core__WEBPACK_IMPORTED_MODULE_1__.useMantineColorScheme)();const bg="dark"===colorScheme?"white":"dark";const logoUrl=connector.main_connectorlist.logo_key?`https://img.logo.dev/${connector.main_connectorlist.logo_key}?token=pk_QvyqAb6uTRGJE2_sDsEb9g&retina=true`:`https://s3.eu-west-3.amazonaws.com/media.airporting/connectors/${connector.main_connectorlist.codename}.png`;return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Card,{children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Stack,{children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Avatar,{src:logoUrl,size:64,radius:"md",bg:bg,color:"dark"===colorScheme?"black":"white",p:18}),rename?rename.editing?/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{gap:"xs",wrap:"nowrap",children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.TextInput,{value:rename.draft,onChange:e=>rename.onDraftChange(e.currentTarget.value),autoFocus:true,onKeyDown:e=>{if("Enter"===e.key)rename.onSave();if("Escape"===e.key)rename.onCancel()},style:{flex:1}}),/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.ActionIcon,{onClick:rename.onSave,"aria-label":"Sauvegarder",loading:rename.isPending,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__.IconCheck,{size:16})}),/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.ActionIcon,{onClick:rename.onCancel,"aria-label":"Annuler",variant:"subtle",children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__.IconX,{size:16})})]}):/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{gap:"xs",wrap:"nowrap",children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Title,{w:"fit-content",order:3,children:connector.name}),/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.ActionIcon,{onClick:rename.onStartEditing,"aria-label":"Renommer",variant:"subtle",children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__.IconPencil,{size:16})})]}):/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Title,{w:"fit-content",order:3,children:connector.name}),/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Text,{c:"dimmed",size:"lg",lineClamp:3,children:connector.main_connectorlist.description_fr})]})})}},6699:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{Qq:()=>HttpClient,cM:()=>ContentType,qx:()=>IntegrationsApi});var ContentType=/*#__PURE__*/function(ContentType){ContentType["Json"]="application/json";ContentType["JsonApi"]="application/vnd.api+json";ContentType["FormData"]="multipart/form-data";ContentType["UrlEncoded"]="application/x-www-form-urlencoded";ContentType["Text"]="text/plain";return ContentType}({});class HttpClient{baseUrl="";securityData=null;securityWorker;abortControllers=new Map;customFetch=(...fetchParams)=>fetch(...fetchParams);baseApiParams={credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"};constructor(apiConfig={}){Object.assign(this,apiConfig)}setSecurityData=data=>{this.securityData=data};encodeQueryParam(key,value){const encodedKey=encodeURIComponent(key);return`${encodedKey}=${encodeURIComponent("number"==typeof value?value:`${value}`)}`}addQueryParam(query,key){return this.encodeQueryParam(key,query[key])}addArrayQueryParam(query,key){const value=query[key];return value.map(v=>this.encodeQueryParam(key,v)).join("&")}toQueryString(rawQuery){const query=rawQuery||{};const keys=Object.keys(query).filter(key=>void 0!==query[key]);return keys.map(key=>Array.isArray(query[key])?this.addArrayQueryParam(query,key):this.addQueryParam(query,key)).join("&")}addQueryParams(rawQuery){const queryString=this.toQueryString(rawQuery);return queryString?`?${queryString}`:""}contentFormatters={["application/json"]:input=>null!==input&&("object"==typeof input||"string"==typeof input)?JSON.stringify(input):input,["application/vnd.api+json"]:input=>null!==input&&("object"==typeof input||"string"==typeof input)?JSON.stringify(input):input,["text/plain"]:input=>null!==input&&"string"!=typeof input?JSON.stringify(input):input,["multipart/form-data"]:input=>{if(input instanceof FormData)return input;return Object.keys(input||{}).reduce((formData,key)=>{const property=input[key];formData.append(key,property instanceof Blob?property:"object"==typeof property&&null!==property?JSON.stringify(property):`${property}`);return formData},new FormData)},["application/x-www-form-urlencoded"]:input=>this.toQueryString(input)};mergeRequestParams(params1,params2){return{...this.baseApiParams,...params1,...params2||{},headers:{...this.baseApiParams.headers||{},...params1.headers||{},...params2&¶ms2.headers||{}}}}createAbortSignal=cancelToken=>{if(this.abortControllers.has(cancelToken)){const abortController=this.abortControllers.get(cancelToken);if(abortController)return abortController.signal;return}const abortController=new AbortController;this.abortControllers.set(cancelToken,abortController);return abortController.signal};abortRequest=cancelToken=>{const abortController=this.abortControllers.get(cancelToken);if(abortController){abortController.abort();this.abortControllers.delete(cancelToken)}};request=async({body,secure,path,type,query,format,baseUrl,cancelToken,...params})=>{const secureParams=("boolean"==typeof secure?secure:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{};const requestParams=this.mergeRequestParams(params,secureParams);const queryString=query&&this.toQueryString(query);const payloadFormatter=this.contentFormatters[type||"application/json"];const responseFormat=format||requestParams.format;return this.customFetch(`${baseUrl||this.baseUrl||""}${path}${queryString?`?${queryString}`:""}`,{...requestParams,headers:{...requestParams.headers||{},...type&&"multipart/form-data"!==type?{"Content-Type":type}:{}},signal:(cancelToken?this.createAbortSignal(cancelToken):requestParams.signal)||null,body:null==body?null:payloadFormatter(body)}).then(async response=>{const r=response;r.data=null;r.error=null;const responseToParse=responseFormat?response.clone():response;const data=responseFormat?await responseToParse[responseFormat]().then(data=>{if(r.ok)r.data=data;else r.error=data;return r}).catch(e=>{r.error=e;return r}):r;if(cancelToken)this.abortControllers.delete(cancelToken);if(!response.ok)throw data;return data})}}class IntegrationsApi{http;constructor(http){this.http=http}status=(params={})=>this.http.request({path:"/status",method:"GET",...params});connectors={getStatsConnectorsV1:({cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/stats`,method:"GET",secure:true,format:"json",...params}),getConnectorsV1:({cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/ok`,method:"GET",secure:true,format:"json",...params}),getIllConnectorsV1:({cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/ill`,method:"GET",secure:true,format:"json",...params}),getCatalogConnectorsV1:({cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/catalog`,method:"GET",secure:true,format:"json",...params}),addConnectorV1:({cid,...query},data,params={})=>this.http.request({path:`/v1/connectors/${cid}/add`,method:"POST",body:data,secure:true,type:"application/json",format:"json",...params}),getConnectorConfigV1:({connector,cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/config/${connector}`,method:"GET",format:"json",...params}),getConnectorSingleV1:({connector,cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/single/${connector}`,method:"GET",format:"json",...params}),putConnectorDataV1:({connector,cid,...query},data,params={})=>this.http.request({path:`/v1/connectors/${cid}/data/${connector}`,method:"PUT",body:data,type:"application/json",format:"json",...params}),deleteConnectorV1:({connector,cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/${connector}`,method:"DELETE",secure:true,...params})}}}}]);
|
|
10
|
+
*/var REACT_ELEMENT_TYPE=Symbol.for("react.transitional.element"),REACT_FRAGMENT_TYPE=Symbol.for("react.fragment");function jsxProd(type,config,maybeKey){var key=null;void 0!==maybeKey&&(key=""+maybeKey);void 0!==config.key&&(key=""+config.key);if("key"in config){maybeKey={};for(var propName in config)"key"!==propName&&(maybeKey[propName]=config[propName])}else maybeKey=config;config=maybeKey.ref;return{$$typeof:REACT_ELEMENT_TYPE,type:type,key:key,ref:void 0!==config?config:null,props:maybeKey}}exports.Fragment=REACT_FRAGMENT_TYPE;exports.jsx=jsxProd;exports.jsxs=jsxProd},4848:function(module,__unused_webpack_exports,__webpack_require__){module.exports=__webpack_require__(9698)},9429:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Connectors});var jsx_runtime=__webpack_require__(4848);var index_js_=__webpack_require__(8556);var index_mjs_=__webpack_require__(2773);var modern_index_js_=__webpack_require__(7714);var IntegrationsApi=__webpack_require__(6699);const AppConfigCtx=/*#__PURE__*/(0,index_js_.createContext)(null);const AppConfigProvider=AppConfigCtx.Provider;function useAppConfig(){const config=(0,index_js_.useContext)(AppConfigCtx);if(!config)throw new Error("Called `useAppConfig` outside a `<AppConfigProvider />`");return config}function useApi(){const config=useAppConfig();const client=new IntegrationsApi.Qq({baseUrl:config.api.replace(/\/$/,""),baseApiParams:{headers:{Authorization:config.token?`Bearer ${config.token}`:"",From:config.owner}}});return new IntegrationsApi.qx(client)}function useStatsQuery(){const api=useApi();const config=useAppConfig();const query=(0,modern_index_js_.useQuery)({queryKey:["connectors","stats",config.company],queryFn:async()=>await api.connectors.getStatsConnectorsV1({cid:config.company}).then(x=>x.data),staleTime:6e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}function useConnectorsListQuery(){const api=useApi();const config=useAppConfig();const query=(0,modern_index_js_.useQuery)({queryKey:["connectors","list",config.company],queryFn:async()=>await api.connectors.getConnectorsV1({cid:config.company}).then(x=>x.data),staleTime:6e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}var connector_bubble=__webpack_require__(4184);var tabler_icons_react_mjs_=__webpack_require__(5200);var esm_index_mjs_=__webpack_require__(4931);function useConnectorDeleteMutation(){const api=useApi();const config=useAppConfig();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async connector=>{const res=await api.connectors.deleteConnectorV1({cid:config.company,connector});return res.data},onSuccess:()=>{queryClient.invalidateQueries({queryKey:["connectors","list",config.company]});queryClient.invalidateQueries({queryKey:["connectors","list","ill",config.company]});queryClient.invalidateQueries({queryKey:["connectors","catalog",config.company]});queryClient.invalidateQueries({queryKey:["connectors","stats",config.company]});queryClient.invalidateQueries({queryKey:["connectors","ok",config.company]});queryClient.invalidateQueries({queryKey:["connectors","ill",config.company]});esm_index_mjs_.notifications.show({color:"green",title:"Connecteur supprim\xe9",message:"Vous pouvez le r\xe9ajouter depuis le catalogue."})},onError:error=>{console.error(error);esm_index_mjs_.notifications.show({color:"red",title:"Suppression \xe9chou\xe9e",message:"R\xe9essayez dans un instant."})}})}var modals_esm_index_mjs_=__webpack_require__(4403);function isDeleteConfirmInput(input){return"DELETE"===input}function DeleteActiveBody({name,onConfirm}){const[input,setInput]=(0,index_js_.useState)("");const isMatch=isDeleteConfirmInput(input);const handleConfirm=()=>{if(!isMatch)return;onConfirm();modals_esm_index_mjs_.modals.closeAll()};return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",children:["Le connecteur ",/*#__PURE__*/(0,jsx_runtime.jsx)("strong",{children:name})," est actuellement actif. Sa suppression arr\xeatera la synchronisation et le retirera de la liste. Vous pourrez le r\xe9ajouter depuis le catalogue plus tard."]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",children:["Pour confirmer, tapez ",/*#__PURE__*/(0,jsx_runtime.jsx)("strong",{children:"DELETE"})," ci-dessous."]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{value:input,onChange:e=>setInput(e.currentTarget.value),placeholder:"DELETE",autoFocus:true,onKeyDown:e=>{if("Enter"===e.key)handleConfirm()}}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:()=>modals_esm_index_mjs_.modals.closeAll(),children:"Annuler"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{color:"red",disabled:!isMatch,onClick:handleConfirm,children:"Supprimer"})]})]})}function openDeleteActiveConnectorModal(name,onConfirm){modals_esm_index_mjs_.modals.open({title:"Supprimer ce connecteur ?",centered:true,children:/*#__PURE__*/(0,jsx_runtime.jsx)(DeleteActiveBody,{name:name,onConfirm:onConfirm})})}function ConnectorMenu({connectorId,connectorName,isActive}){const{mutate,isPending}=useConnectorDeleteMutation();const handleDelete=()=>{if(isActive)openDeleteActiveConnectorModal(connectorName,()=>mutate(connectorId));else mutate(connectorId)};const stopBubble=e=>{e.stopPropagation();e.preventDefault()};return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Menu,{position:"bottom-end",withinPortal:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Target,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{variant:"subtle",color:"gray","aria-label":"Actions du connecteur",onClick:stopBubble,children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconDots,{size:18})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Dropdown,{onClick:stopBubble,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Item,{color:"red",leftSection:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconTrash,{size:16}),onClick:handleDelete,disabled:isPending,children:"Supprimer"})})]})}function ListOkComponent(){const config=useAppConfig();const listResultRes=useConnectorsListQuery();const listResult=listResultRes.data;return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{w:"fit-content",mb:0,order:2,children:"Tous vos connecteurs en marche"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:{base:1,xs:2,sm:3,md:4,lg:5,xl:6},spacing:"lg",verticalSpacing:"lg",style:{alignItems:"stretch"},children:listResult?.list?.map((connector,idx)=>connector?.main_connectorlist?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{pos:"relative",style:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Anchor,{underline:"never",href:`/company/${config.company}/integrations/${connector.id}/connector`,children:/*#__PURE__*/(0,jsx_runtime.jsx)(connector_bubble.q,{connector:connector})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Box,{pos:"absolute",top:8,right:8,children:/*#__PURE__*/(0,jsx_runtime.jsx)(ConnectorMenu,{connectorId:connector.id,connectorName:connector.name,isActive:true})})]},idx):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{radius:"md",animate:true},idx))})]})}function useConnectorsIllListQuery(){const api=useApi();const config=useAppConfig();const query=(0,modern_index_js_.useQuery)({queryKey:["connectors","list","ill",config.company],queryFn:async()=>await api.connectors.getIllConnectorsV1({cid:config.company}).then(x=>x.data),staleTime:6e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}function ListIllComponent(){const config=useAppConfig();const listResultRes=useConnectorsIllListQuery();const listResult=listResultRes.data;return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{w:"fit-content",mb:0,order:2,children:"Tous vos connecteurs \xe0 configurer"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:{base:1,xs:2,sm:3,md:4,lg:5,xl:6},spacing:"lg",verticalSpacing:"lg",style:{alignItems:"stretch"},children:listResult?.list?.map((connector,idx)=>connector?.main_connectorlist?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{pos:"relative",style:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Anchor,{underline:"never",href:`/company/${config.company}/integrations/${connector.id}/connector`,children:/*#__PURE__*/(0,jsx_runtime.jsx)(connector_bubble.q,{connector:connector})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Box,{pos:"absolute",top:8,right:8,children:/*#__PURE__*/(0,jsx_runtime.jsx)(ConnectorMenu,{connectorId:connector.id,connectorName:connector.name,isActive:false})})]},idx):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{radius:"md",animate:true},idx))})]})}function useConnectorAddMutation(){const api=useApi();const config=useAppConfig();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async connector_id=>{const res=await api.connectors.addConnectorV1({cid:config.company},{connector_id});return res.data},onSuccess:()=>{queryClient.invalidateQueries({queryKey:["connectors","catalog",config.company]});queryClient.invalidateQueries({queryKey:["connectors","list",config.company]});queryClient.invalidateQueries({queryKey:["connectors","list","ill",config.company]});queryClient.invalidateQueries({queryKey:["connectors","stats",config.company]});queryClient.invalidateQueries({queryKey:["connectors","ok",config.company]});queryClient.invalidateQueries({queryKey:["connectors","ill",config.company]})}})}function useConnectorCatalogQuery(){const api=useApi();const config=useAppConfig();const query=(0,modern_index_js_.useQuery)({queryKey:["connectors","catalog",config.company],queryFn:async()=>await api.connectors.getCatalogConnectorsV1({cid:config.company}).then(x=>x.data),refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}function CollapsibleGroup({title,count,collapsed,onToggle,children}){return/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.UnstyledButton,{onClick:onToggle,style:{width:"100%",padding:"8px 12px"},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[collapsed?/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconChevronRight,{size:16}):/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconChevronDown,{size:16}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:600,children:title}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{c:"dimmed",children:["(",count,")"]})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Collapse,{in:!collapsed,children:children})]})}const KEY=userId=>`connectors-expanded-groups:${userId}`;function useCollapsedGroups(userId,_allGroupKeys){const[expanded,setExpanded]=(0,index_js_.useState)(()=>{const raw=localStorage.getItem(KEY(userId));if(raw)try{return new Set(JSON.parse(raw))}catch{}return new Set});(0,index_js_.useEffect)(()=>{localStorage.setItem(KEY(userId),JSON.stringify([...expanded]))},[userId,expanded]);const toggle=(0,index_js_.useCallback)(key=>{setExpanded(prev=>{const next=new Set(prev);if(next.has(key))next.delete(key);else next.add(key);return next})},[]);const isCollapsed=(0,index_js_.useCallback)(key=>!expanded.has(key),[expanded]);return{isCollapsed,toggle}}function normalize(value){return(value??"").toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"")}function getBaseName(name){return name.replace(/\s+via\s+.+$/i,"").trim()}function getMethodSuffix(name,baseName){return name.length>baseName.length?name.slice(baseName.length).trim():name}function getLogoUrl(logoKey,codename){return logoKey?`https://img.logo.dev/${logoKey}?token=pk_QvyqAb6uTRGJE2_sDsEb9g&retina=true`:`https://s3.eu-west-3.amazonaws.com/media.airporting/connectors/${codename}.png`}function GroupCard({group,pending}){const{colorScheme}=(0,index_mjs_.useMantineColorScheme)();const bg="dark"===colorScheme?"white":"dark";const first=group.items[0];const logoUrl=getLogoUrl(group.logoKey,first.codename);return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Card,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",align:"flex-start",children:[pending?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Loader,{size:64}):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Avatar,{src:logoUrl,size:64,radius:"md",bg:bg,color:"dark"===colorScheme?"black":"white",p:18}),group.items.length>1&&/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Badge,{variant:"light",color:"blue",children:[group.items.length," m\xe9thodes"]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{w:"fit-content",order:3,children:group.baseName}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",size:"lg",lineClamp:3,children:first.description_fr})]})})}function MethodChoiceCard({item,baseName,pending,disabled,onClick}){const suffix=getMethodSuffix(item.name,baseName);return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Card,{style:{cursor:disabled?"wait":"pointer",opacity:disabled&&!pending?.5:1},onClick:()=>{if(!disabled)onClick()},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",align:"center",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:4,style:{flex:1},children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:600,children:suffix||item.name}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{variant:"light",color:"gray",children:item.sharing_method})]}),item.description_fr&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",size:"sm",lineClamp:2,children:item.description_fr})]}),pending&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Loader,{size:"sm"})]})})}function ListCatalogComponent(){const config=useAppConfig();const result=useConnectorCatalogQuery();const list=result.data?.list;const[searchValue,setSearchValue]=(0,index_js_.useState)("");const[pendingId,setPendingId]=(0,index_js_.useState)(null);const[selectedGroup,setSelectedGroup]=(0,index_js_.useState)(null);const[hoveredGroupKey,setHoveredGroupKey]=(0,index_js_.useState)(null);const mutation=useConnectorAddMutation();const filtered=(0,index_js_.useMemo)(()=>{if(!list)return;const q=normalize(searchValue);if(!q)return list;return list.filter(item=>normalize(`${item.name} ${item.description_fr??""}`).includes(q))},[list,searchValue]);const sections=(0,index_js_.useMemo)(()=>{if(!filtered)return;const groups=new Map;for(const item of filtered){const baseName=getBaseName(item.name);const groupKey=`${item.logo_key??item.codename}::${baseName}`;if(!groups.has(groupKey))groups.set(groupKey,{groupKey,baseName,type:item.type,logoKey:item.logo_key,items:[]});groups.get(groupKey).items.push(item)}const byCategory=new Map;for(const group of groups.values()){const k=group.type.codename;if(!byCategory.has(k))byCategory.set(k,{type:group.type,groups:[]});byCategory.get(k).groups.push(group)}return Array.from(byCategory.values())},[filtered]);const sectionKeys=(0,index_js_.useMemo)(()=>(sections??[]).map(s=>s.type.codename),[sections]);const{isCollapsed,toggle}=useCollapsedGroups(`catalog:${config.owner}`,sectionKeys);const triggerAdd=id=>{setPendingId(id);mutation.mutate(id,{onSuccess:data=>{window.location.href=`/company/${config.company}/integrations/${data.id}/connector`},onError:()=>{setPendingId(null)}})};const handleGroupClick=group=>{if(mutation.isPending)return;if(1===group.items.length)triggerAdd(group.items[0].id);else setSelectedGroup(group)};const handleCloseModal=()=>{if(mutation.isPending)return;setSelectedGroup(null);setPendingId(null)};return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{placeholder:"Rechercher un connecteur...",leftSection:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconSearch,{size:16}),value:searchValue,onChange:e=>setSearchValue(e.currentTarget.value),size:"md"}),sections?sections.map(section=>/*#__PURE__*/(0,jsx_runtime.jsx)(CollapsibleGroup,{title:section.type.name,count:section.groups.length,collapsed:isCollapsed(section.type.codename),onToggle:()=>toggle(section.type.codename),children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:{base:1,xs:2,sm:3,md:4,lg:5,xl:6},spacing:"lg",verticalSpacing:"lg",style:{alignItems:"stretch"},children:section.groups.map(group=>{const isSinglePending=1===group.items.length&&pendingId===group.items[0].id;const isHovered=hoveredGroupKey===group.groupKey&&!mutation.isPending;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{withBorder:true,style:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between",cursor:mutation.isPending?"wait":"pointer",opacity:mutation.isPending&&!isSinglePending?.5:1,borderColor:isHovered?"var(--mantine-color-green-5)":void 0,backgroundColor:isHovered?"var(--mantine-color-green-0)":void 0,transition:"border-color 120ms ease, background-color 120ms ease",position:"relative"},onMouseEnter:()=>setHoveredGroupKey(group.groupKey),onMouseLeave:()=>setHoveredGroupKey(null),onClick:()=>handleGroupClick(group),children:[isHovered&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{variant:"filled",color:"green",style:{position:"absolute",top:8,right:8,zIndex:1},children:"Configurer →"}),/*#__PURE__*/(0,jsx_runtime.jsx)(GroupCard,{group:group,pending:isSinglePending})]},group.groupKey)})})},section.type.codename)):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:{base:1,xs:2,sm:3,md:4,lg:5,xl:6},spacing:"lg",verticalSpacing:"lg",children:Array.from({length:8}).map((_,idx)=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:180,radius:"md",animate:true},idx))}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:null!==selectedGroup,onClose:handleCloseModal,title:selectedGroup?.baseName??"",size:"lg",children:selectedGroup&&/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"Choisir une m\xe9thode de connexion :"}),selectedGroup.items.map(item=>/*#__PURE__*/(0,jsx_runtime.jsx)(MethodChoiceCard,{item:item,baseName:selectedGroup.baseName,pending:pendingId===item.id,disabled:mutation.isPending,onClick:()=>triggerAdd(item.id)},item.id))]})})]})}var dist_index_js_=__webpack_require__(4259);function ConnectorsApp(){const tab=(0,dist_index_js_.useRxState)(new URL(location.href).searchParams.get("tab")??"active");const statsResultRes=useStatsQuery();const statsResult=statsResultRes.data;const[tabValue,setTabValue]=(0,index_js_.useState)(tab.value??"active");(0,index_js_.useEffect)(()=>{tab.dispatch(tabValue)},[tabValue]);return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{size:"xl",px:0,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{py:16,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:0,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{w:"fit-content",mb:0,order:1,children:"Nos connecteurs"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{w:"fit-content",mb:0,c:"dimmed",fz:"h5",children:"Synchronisez vos comptes bancaires et outils comptables facilement."})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{py:16,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SegmentedControl,{value:tabValue,onChange:setTabValue,radius:"md",size:"lg",data:[{label:`Connecteurs actifs (${statsResult?statsResult.ok??0:"…"})`,value:"active"},{label:`Connecteurs \xe0 configurer (${statsResult?statsResult.ill??0:"…"})`,value:"ill"},{label:"Les autres connecteurs",value:"all"}]})}),"active"===tabValue&&/*#__PURE__*/(0,jsx_runtime.jsx)(ListOkComponent,{}),"ill"===tabValue&&/*#__PURE__*/(0,jsx_runtime.jsx)(ListIllComponent,{}),"all"===tabValue&&/*#__PURE__*/(0,jsx_runtime.jsx)(ListCatalogComponent,{})]})}var dist_esm_index_mjs_=__webpack_require__(4449);const theme=(0,index_mjs_.createTheme)((0,dist_esm_index_mjs_.assign)(dist_index_js_.theme,{components:{}}));const cssVarResolver=x=>(0,dist_esm_index_mjs_.assign)(dist_index_js_.cssVarResolver(x),{dark:{},light:{},variables:{}});function Providers(props){const{children,config,mantine,tanstack}=props;return/*#__PURE__*/(0,jsx_runtime.jsx)(AppConfigProvider,{value:config,children:/*#__PURE__*/(0,jsx_runtime.jsx)(modern_index_js_.QueryClientProvider,{client:tanstack?.queryClient??new modern_index_js_.QueryClient,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.MantineProvider,{theme:theme,cssVariablesResolver:cssVarResolver,defaultColorScheme:mantine?.defaultColorScheme,forceColorScheme:mantine?.forceColorScheme,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(modals_esm_index_mjs_.ModalsProvider,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(esm_index_mjs_.Notifications,{}),/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.RevealTokenProvider,{children:children})]})})})})}function Connectors(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(Providers,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(ConnectorsApp,{})})})}},4184:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{q:()=>ConnectorBubble});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(4848);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(2773);var _tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(5200);function ConnectorBubble({connector,rename}){const{colorScheme}=(0,_mantine_core__WEBPACK_IMPORTED_MODULE_1__.useMantineColorScheme)();const bg="dark"===colorScheme?"white":"dark";const logoUrl=connector.main_connectorlist.logo_key?`https://img.logo.dev/${connector.main_connectorlist.logo_key}?token=pk_QvyqAb6uTRGJE2_sDsEb9g&retina=true`:`https://s3.eu-west-3.amazonaws.com/media.airporting/connectors/${connector.main_connectorlist.codename}.png`;return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Card,{children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Stack,{children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Avatar,{src:logoUrl,size:64,radius:"md",bg:bg,color:"dark"===colorScheme?"black":"white",p:18}),rename?rename.editing?/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{gap:"xs",wrap:"nowrap",children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.TextInput,{value:rename.draft,onChange:e=>rename.onDraftChange(e.currentTarget.value),autoFocus:true,onKeyDown:e=>{if("Enter"===e.key)rename.onSave();if("Escape"===e.key)rename.onCancel()},style:{flex:1}}),/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.ActionIcon,{onClick:rename.onSave,"aria-label":"Sauvegarder",loading:rename.isPending,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__.IconCheck,{size:16})}),/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.ActionIcon,{onClick:rename.onCancel,"aria-label":"Annuler",variant:"subtle",children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__.IconX,{size:16})})]}):/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{gap:"xs",wrap:"nowrap",children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Title,{w:"fit-content",order:3,children:connector.name}),/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.ActionIcon,{onClick:rename.onStartEditing,"aria-label":"Renommer",variant:"subtle",children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__.IconPencil,{size:16})})]}):/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Title,{w:"fit-content",order:3,children:connector.name}),/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Text,{c:"dimmed",size:"lg",lineClamp:3,children:connector.main_connectorlist.description_fr})]})})}},6699:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{Qq:()=>HttpClient,cM:()=>ContentType,qx:()=>IntegrationsApi});var ContentType=/*#__PURE__*/function(ContentType){ContentType["Json"]="application/json";ContentType["JsonApi"]="application/vnd.api+json";ContentType["FormData"]="multipart/form-data";ContentType["UrlEncoded"]="application/x-www-form-urlencoded";ContentType["Text"]="text/plain";return ContentType}({});class HttpClient{baseUrl="";securityData=null;securityWorker;abortControllers=new Map;customFetch=(...fetchParams)=>fetch(...fetchParams);baseApiParams={credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"};constructor(apiConfig={}){Object.assign(this,apiConfig)}setSecurityData=data=>{this.securityData=data};encodeQueryParam(key,value){const encodedKey=encodeURIComponent(key);return`${encodedKey}=${encodeURIComponent("number"==typeof value?value:`${value}`)}`}addQueryParam(query,key){return this.encodeQueryParam(key,query[key])}addArrayQueryParam(query,key){const value=query[key];return value.map(v=>this.encodeQueryParam(key,v)).join("&")}toQueryString(rawQuery){const query=rawQuery||{};const keys=Object.keys(query).filter(key=>void 0!==query[key]);return keys.map(key=>Array.isArray(query[key])?this.addArrayQueryParam(query,key):this.addQueryParam(query,key)).join("&")}addQueryParams(rawQuery){const queryString=this.toQueryString(rawQuery);return queryString?`?${queryString}`:""}contentFormatters={["application/json"]:input=>null!==input&&("object"==typeof input||"string"==typeof input)?JSON.stringify(input):input,["application/vnd.api+json"]:input=>null!==input&&("object"==typeof input||"string"==typeof input)?JSON.stringify(input):input,["text/plain"]:input=>null!==input&&"string"!=typeof input?JSON.stringify(input):input,["multipart/form-data"]:input=>{if(input instanceof FormData)return input;return Object.keys(input||{}).reduce((formData,key)=>{const property=input[key];formData.append(key,property instanceof Blob?property:"object"==typeof property&&null!==property?JSON.stringify(property):`${property}`);return formData},new FormData)},["application/x-www-form-urlencoded"]:input=>this.toQueryString(input)};mergeRequestParams(params1,params2){return{...this.baseApiParams,...params1,...params2||{},headers:{...this.baseApiParams.headers||{},...params1.headers||{},...params2&¶ms2.headers||{}}}}createAbortSignal=cancelToken=>{if(this.abortControllers.has(cancelToken)){const abortController=this.abortControllers.get(cancelToken);if(abortController)return abortController.signal;return}const abortController=new AbortController;this.abortControllers.set(cancelToken,abortController);return abortController.signal};abortRequest=cancelToken=>{const abortController=this.abortControllers.get(cancelToken);if(abortController){abortController.abort();this.abortControllers.delete(cancelToken)}};request=async({body,secure,path,type,query,format,baseUrl,cancelToken,...params})=>{const secureParams=("boolean"==typeof secure?secure:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{};const requestParams=this.mergeRequestParams(params,secureParams);const queryString=query&&this.toQueryString(query);const payloadFormatter=this.contentFormatters[type||"application/json"];const responseFormat=format||requestParams.format;return this.customFetch(`${baseUrl||this.baseUrl||""}${path}${queryString?`?${queryString}`:""}`,{...requestParams,headers:{...requestParams.headers||{},...type&&"multipart/form-data"!==type?{"Content-Type":type}:{}},signal:(cancelToken?this.createAbortSignal(cancelToken):requestParams.signal)||null,body:null==body?null:payloadFormatter(body)}).then(async response=>{const r=response;r.data=null;r.error=null;const responseToParse=responseFormat?response.clone():response;const data=responseFormat?await responseToParse[responseFormat]().then(data=>{if(r.ok)r.data=data;else r.error=data;return r}).catch(e=>{r.error=e;return r}):r;if(cancelToken)this.abortControllers.delete(cancelToken);if(!response.ok)throw data;return data})}}class IntegrationsApi{http;constructor(http){this.http=http}status=(params={})=>this.http.request({path:"/status",method:"GET",...params});connectors={getStatsConnectorsV1:({cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/stats`,method:"GET",secure:true,format:"json",...params}),getConnectorsV1:({cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/ok`,method:"GET",secure:true,format:"json",...params}),getIllConnectorsV1:({cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/ill`,method:"GET",secure:true,format:"json",...params}),getCatalogConnectorsV1:({cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/catalog`,method:"GET",secure:true,format:"json",...params}),addConnectorV1:({cid,...query},data,params={})=>this.http.request({path:`/v1/connectors/${cid}/add`,method:"POST",body:data,secure:true,type:"application/json",format:"json",...params}),getConnectorConfigV1:({connector,cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/config/${connector}`,method:"GET",format:"json",...params}),getConnectorSingleV1:({connector,cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/single/${connector}`,method:"GET",format:"json",...params}),putConnectorDataV1:({connector,cid,...query},data,params={})=>this.http.request({path:`/v1/connectors/${cid}/data/${connector}`,method:"PUT",body:data,type:"application/json",format:"json",...params}),renameConnectorV1:({connector,cid,...query},data,params={})=>this.http.request({path:`/v1/connectors/${cid}/${connector}`,method:"PATCH",body:data,secure:true,type:"application/json",format:"json",...params}),deleteConnectorV1:({connector,cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/${connector}`,method:"DELETE",secure:true,format:"json",...params}),getAuthSecretsV1:({connector,cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/${connector}/auth-secrets`,method:"GET",secure:true,format:"json",...params})};microsoft={startAdminConsentV1:({cid,...query},params={})=>this.http.request({path:`/v1/microsoft/${cid}/admin-consent/start`,method:"GET",query:query,secure:true,format:"json",...params}),handleCallbackV1:(query,params={})=>this.http.request({path:"/v1/microsoft/admin-consent/callback",method:"GET",query:query,...params}),getTenantV1:({cid,...query},params={})=>this.http.request({path:`/v1/microsoft/${cid}/tenant`,method:"GET",secure:true,format:"json",...params})}}}}]);
|