@airporting/integrations-app 0.4.97 → 0.4.99
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/1067.js +1 -0
- package/dist/mf/@mf-types/compiled-types/api/microsoft/addExcelFileMutation.d.ts +4 -0
- package/dist/mf/@mf-types/compiled-types/api/microsoft/deleteExcelFileMutation.d.ts +3 -0
- package/dist/mf/@mf-types/compiled-types/api/microsoft/excelFilesQuery.d.ts +10 -0
- package/dist/mf/@mf-types/compiled-types/api/microsoft/resolveFileMutation.d.ts +11 -0
- package/dist/mf/@mf-types/compiled-types/components/microsoft/ExcelFilesSection.d.ts +3 -0
- package/dist/mf/@mf-types/compiled-types/gen/IntegrationsApi.d.ts +160 -0
- 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/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/4601.js +0 -1
package/dist/mf/mf-manifest.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"name": "integrations_app",
|
|
6
6
|
"type": "app",
|
|
7
7
|
"buildInfo": {
|
|
8
|
-
"buildVersion": "0.4.
|
|
8
|
+
"buildVersion": "0.4.99",
|
|
9
9
|
"buildName": "@airporting/integrations-app"
|
|
10
10
|
},
|
|
11
11
|
"remoteEntry": {
|
|
@@ -474,7 +474,7 @@
|
|
|
474
474
|
"assets": {
|
|
475
475
|
"js": {
|
|
476
476
|
"sync": [
|
|
477
|
-
"
|
|
477
|
+
"1067.js",
|
|
478
478
|
"__federation_expose_single_connector.js"
|
|
479
479
|
],
|
|
480
480
|
"async": [
|
package/dist/mf/mf-stats.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"name": "integrations_app",
|
|
6
6
|
"type": "app",
|
|
7
7
|
"buildInfo": {
|
|
8
|
-
"buildVersion": "0.4.
|
|
8
|
+
"buildVersion": "0.4.99",
|
|
9
9
|
"buildName": "@airporting/integrations-app"
|
|
10
10
|
},
|
|
11
11
|
"remoteEntry": {
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
"usedIn": [
|
|
50
|
-
"./single-connector",
|
|
51
50
|
"./connectors",
|
|
51
|
+
"./single-connector",
|
|
52
52
|
"./synchronisation"
|
|
53
53
|
]
|
|
54
54
|
},
|
|
@@ -226,8 +226,8 @@
|
|
|
226
226
|
}
|
|
227
227
|
},
|
|
228
228
|
"usedIn": [
|
|
229
|
-
"./single-connector",
|
|
230
229
|
"./connectors",
|
|
230
|
+
"./single-connector",
|
|
231
231
|
"./synchronisation"
|
|
232
232
|
]
|
|
233
233
|
},
|
|
@@ -253,8 +253,8 @@
|
|
|
253
253
|
}
|
|
254
254
|
},
|
|
255
255
|
"usedIn": [
|
|
256
|
-
"./
|
|
257
|
-
"./
|
|
256
|
+
"./synchronisation",
|
|
257
|
+
"./connectors"
|
|
258
258
|
]
|
|
259
259
|
},
|
|
260
260
|
{
|
|
@@ -279,8 +279,8 @@
|
|
|
279
279
|
}
|
|
280
280
|
},
|
|
281
281
|
"usedIn": [
|
|
282
|
-
"./single-connector",
|
|
283
282
|
"./connectors",
|
|
283
|
+
"./single-connector",
|
|
284
284
|
"./synchronisation"
|
|
285
285
|
]
|
|
286
286
|
},
|
|
@@ -617,7 +617,7 @@
|
|
|
617
617
|
"assets": {
|
|
618
618
|
"js": {
|
|
619
619
|
"sync": [
|
|
620
|
-
"
|
|
620
|
+
"1067.js",
|
|
621
621
|
"__federation_expose_single_connector.js"
|
|
622
622
|
],
|
|
623
623
|
"async": [
|
package/package.json
CHANGED
package/dist/mf/4601.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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."})})]})]})}}}]);
|