@airporting/integrations-app 0.4.146 → 0.4.147

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.
@@ -5,7 +5,7 @@
5
5
  "name": "integrations_app",
6
6
  "type": "app",
7
7
  "buildInfo": {
8
- "buildVersion": "0.4.146",
8
+ "buildVersion": "0.4.147",
9
9
  "buildName": "@airporting/integrations-app"
10
10
  },
11
11
  "remoteEntry": {
@@ -22,7 +22,7 @@
22
22
  "globalName": "integrations_app",
23
23
  "pluginVersion": "0.17.1",
24
24
  "prefetchInterface": false,
25
- "publicPath": "https://unpkg.com/@airporting/integrations-app@0.4.146/dist/mf/"
25
+ "publicPath": "https://unpkg.com/@airporting/integrations-app@0.4.147/dist/mf/"
26
26
  },
27
27
  "shared": [
28
28
  {
@@ -476,7 +476,7 @@
476
476
  "js": {
477
477
  "sync": [
478
478
  "9005.js",
479
- "1067.js",
479
+ "2039.js",
480
480
  "__federation_expose_single_connector.js"
481
481
  ],
482
482
  "async": [
@@ -5,7 +5,7 @@
5
5
  "name": "integrations_app",
6
6
  "type": "app",
7
7
  "buildInfo": {
8
- "buildVersion": "0.4.146",
8
+ "buildVersion": "0.4.147",
9
9
  "buildName": "@airporting/integrations-app"
10
10
  },
11
11
  "remoteEntry": {
@@ -22,7 +22,7 @@
22
22
  "globalName": "integrations_app",
23
23
  "pluginVersion": "0.17.1",
24
24
  "prefetchInterface": false,
25
- "publicPath": "https://unpkg.com/@airporting/integrations-app@0.4.146/dist/mf/"
25
+ "publicPath": "https://unpkg.com/@airporting/integrations-app@0.4.147/dist/mf/"
26
26
  },
27
27
  "shared": [
28
28
  {
@@ -226,9 +226,9 @@
226
226
  }
227
227
  },
228
228
  "usedIn": [
229
- "./synchronisation",
230
229
  "./connectors",
231
- "./single-connector"
230
+ "./single-connector",
231
+ "./synchronisation"
232
232
  ]
233
233
  },
234
234
  {
@@ -279,9 +279,9 @@
279
279
  }
280
280
  },
281
281
  "usedIn": [
282
- "./synchronisation",
283
282
  "./connectors",
284
- "./single-connector"
283
+ "./single-connector",
284
+ "./synchronisation"
285
285
  ]
286
286
  },
287
287
  {
@@ -421,8 +421,8 @@
421
421
  }
422
422
  },
423
423
  "usedIn": [
424
- "./synchronisation",
425
- "./single-connector"
424
+ "./single-connector",
425
+ "./synchronisation"
426
426
  ]
427
427
  },
428
428
  {
@@ -517,9 +517,9 @@
517
517
  }
518
518
  },
519
519
  "usedIn": [
520
- "./synchronisation",
521
520
  "./connectors",
522
- "./single-connector"
521
+ "./single-connector",
522
+ "./synchronisation"
523
523
  ]
524
524
  },
525
525
  {
@@ -619,7 +619,7 @@
619
619
  "js": {
620
620
  "sync": [
621
621
  "9005.js",
622
- "1067.js",
622
+ "2039.js",
623
623
  "__federation_expose_single_connector.js"
624
624
  ],
625
625
  "async": [
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@airporting/integrations-app",
3
3
  "description": "⚡ Intégrations app front-end",
4
- "version": "0.4.146",
4
+ "version": "0.4.147",
5
5
  "packageManager": "yarn@4.10.3",
6
6
  "files": [
7
7
  "dist"
@@ -19,6 +19,7 @@
19
19
  "postinstall": "husky",
20
20
  "preview": "rsbuild preview",
21
21
  "publish": "yarn v:patch && yarn build && yarn npm publish",
22
+ "test:fec-imports": "node --import tsx src/components/synchro/fec-imports/fecImportUi.test.ts",
22
23
  "v:major": "npm version major -m \"chore: bump major to %s\"",
23
24
  "v:minor": "npm version minor -m \"chore: bump minor to %s\"",
24
25
  "v:patch": "npm version patch -m \"chore: bump patch to %s\""
package/dist/mf/1067.js DELETED
@@ -1 +0,0 @@
1
- "use strict";(globalThis["chunk_integrations_app"]=globalThis["chunk_integrations_app"]||[]).push([["1067"],{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})]})})}},1094: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."})}})}var tabler_icons_react_mjs_=__webpack_require__(5200);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 useAddExcelFileMutation(){const api=useApiConnectorSingle();const config=(0,useAppConfigConnectorSingle.C)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async({url})=>{const response=await api.microsoft.addExcelFileV1({cid:config.company},{url});return response.data},onSuccess:()=>{queryClient.invalidateQueries({queryKey:["microsoft","excel-files",config.company]})}})}function useDeleteExcelFileMutation(){const api=useApiConnectorSingle();const config=(0,useAppConfigConnectorSingle.C)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async({fileId})=>{await api.microsoft.deleteExcelFileV1({cid:config.company,fileId})},onSuccess:()=>{queryClient.invalidateQueries({queryKey:["microsoft","excel-files",config.company]})}})}function useExcelFilesQuery({enabled}){const api=useApiConnectorSingle();const config=(0,useAppConfigConnectorSingle.C)();return(0,modern_index_js_.useQuery)({queryKey:["microsoft","excel-files",config.company],queryFn:async()=>{const response=await api.microsoft.listExcelFilesV1({cid:config.company});return response.data.list},enabled,refetchOnWindowFocus:true})}function useResolveFileMutation(){const api=useApiConnectorSingle();const config=(0,useAppConfigConnectorSingle.C)();return(0,modern_index_js_.useMutation)({mutationFn:async({url})=>{const response=await api.microsoft.resolveFileV1({cid:config.company},{url});return response.data}})}function ExcelFilesSection({enabled}){const filesQuery=useExcelFilesQuery({enabled});const resolveMutation=useResolveFileMutation();const addMutation=useAddExcelFileMutation();const deleteMutation=useDeleteExcelFileMutation();const[urlInput,setUrlInput]=(0,index_js_.useState)("");const[preview,setPreview]=(0,index_js_.useState)(null);const[error,setError]=(0,index_js_.useState)(null);const handleResolve=(0,index_js_.useCallback)(async()=>{setError(null);setPreview(null);if(!urlInput.trim())return void setError("Renseigne une URL SharePoint d’un fichier Excel");try{const result=await resolveMutation.mutateAsync({url:urlInput.trim()});setPreview(result)}catch(err){setError(err instanceof Error?err.message:"Impossible de r\xe9soudre cette URL c\xf4t\xe9 Microsoft")}},[urlInput,resolveMutation]);const handleConfirm=(0,index_js_.useCallback)(async()=>{if(!preview)return;setError(null);try{await addMutation.mutateAsync({url:urlInput.trim()});setUrlInput("");setPreview(null)}catch(err){setError(err instanceof Error?err.message:String(err))}},[preview,urlInput,addMutation]);const handleCancel=(0,index_js_.useCallback)(()=>{setPreview(null);setError(null)},[]);const handleDelete=(0,index_js_.useCallback)(fileId=>{deleteMutation.mutate({fileId})},[deleteMutation]);if(!enabled)return null;return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Card,{withBorder:true,padding:"lg",radius:"md",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"md",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:"Fichiers Excel \xe0 synchroniser"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{c:"dimmed",fz:"sm",children:["Ajoute les fichiers Excel qu’Airporting doit alimenter. Colle l’URL de partage d’un fichier ",/*#__PURE__*/(0,jsx_runtime.jsx)("code",{children:".xlsx"})," — on r\xe9cup\xe8re automatiquement son nom et son identifiant."]})]}),filesQuery.isPending?/*#__PURE__*/(0,jsx_runtime.jsx)(InlineLoader.F,{label:"Chargement des fichiers..."}):filesQuery.isError?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Alert,{color:"red",title:"Erreur",children:"Impossible de charger la liste des fichiers Excel."}):filesQuery.data&&filesQuery.data.length>0?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Stack,{gap:"xs",children:filesQuery.data.map(file=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Card,{withBorder:true,padding:"sm",radius:"sm",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",wrap:"nowrap",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:2,style:{minWidth:0,flex:1},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:500,truncate:true,children:file.spreadsheet_name??file.spreadsheet_id}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:6,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{c:"dimmed",fz:"xs",children:["ajout\xe9 le"," ",new Date(file.created).toLocaleString("fr-FR",{timeZone:"Europe/Paris"})]}),file.webUrl?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Anchor,{href:file.webUrl,target:"_blank",rel:"noreferrer",fz:"xs",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:4,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconExternalLink,{size:12}),"ouvrir sur SharePoint"]})}):null]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{color:"red",variant:"subtle","aria-label":"Supprimer ce fichier",onClick:()=>handleDelete(file.id),loading:deleteMutation.isPending&&deleteMutation.variables?.fileId===file.id,children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconTrash,{size:16})})]})},file.id))}):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",fz:"sm",children:"Aucun fichier Excel ajout\xe9 pour le moment."}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"URL SharePoint du fichier Excel",placeholder:"https://votreorg.sharepoint.com/:x:/r/sites/.../fichier.xlsx",value:urlInput,onChange:e=>setUrlInput(e.currentTarget.value),disabled:resolveMutation.isPending||addMutation.isPending}),preview?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Alert,{color:"green",title:"Fichier trouv\xe9",children:/*#__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:"Nom\xa0:"})," ",preview.name]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fz:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("b",{children:"Identifiant\xa0:"})," ",/*#__PURE__*/(0,jsx_runtime.jsx)("code",{children:preview.itemId})]}),"site"===preview.kind?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fz:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("b",{children:"Site SharePoint\xa0:"})," ",/*#__PURE__*/(0,jsx_runtime.jsx)("code",{children:preview.siteId})]}):/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fz:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("b",{children:"Drive\xa0:"})," ",/*#__PURE__*/(0,jsx_runtime.jsx)("code",{children:preview.driveId})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{mt:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{onClick:handleConfirm,loading:addMutation.isPending,children:"Confirmer l’ajout"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"subtle",onClick:handleCancel,disabled:addMutation.isPending,children:"Annuler"})]})]})}):/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{onClick:handleResolve,loading:resolveMutation.isPending,disabled:!urlInput.trim(),children:"Valider l’URL"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",fz:"xs",children:"On interroge Microsoft Graph pour r\xe9cup\xe9rer le nom du fichier avant de l’enregistrer."})]}),error?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Alert,{color:"red",title:"Erreur",children:error}):null]})]})})}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 tenantQuery=useMicrosoftTenantQuery();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;if(tenant)return/*#__PURE__*/(0,jsx_runtime.jsx)(ClientHostedView,{tenant:tenant});return/*#__PURE__*/(0,jsx_runtime.jsx)(AirportingHostedView,{})}function AirportingHostedView(){const[advancedOpen,setAdvancedOpen]=(0,index_js_.useState)(false);return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Alert,{color:"teal",variant:"light",radius:"md",icon:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconRocket,{size:20}),title:"Vos fichiers sont h\xe9berg\xe9s chez Airporting",children:"On cr\xe9e et alimente les fichiers Excel directement sur le SharePoint Airporting. Rien \xe0 configurer c\xf4t\xe9 Microsoft, et tu peux y acc\xe9der via le lien de partage qu’on te fournit."}),/*#__PURE__*/(0,jsx_runtime.jsx)(ExcelFilesSection,{enabled:true}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Card,{withBorder:true,padding:"md",radius:"md",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Anchor,{component:"button",type:"button",onClick:()=>setAdvancedOpen(s=>!s),underline:"never",c:"dimmed",fz:"sm",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:4,children:[advancedOpen?/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconChevronUp,{size:14}):/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconChevronDown,{size:14}),"Pr\xe9f\xe9rer h\xe9berger sur votre propre SharePoint d’entreprise\xa0?"]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Collapse,{in:advancedOpen,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"sm",pt:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{c:"dimmed",fz:"sm",children:["Si ton organisation veut conserver la ma\xeetrise compl\xe8te du fichier (sur votre tenant Microsoft 365), tu peux connecter ton SharePoint d’entreprise. Cette op\xe9ration n\xe9cessite un"," ",/*#__PURE__*/(0,jsx_runtime.jsx)("b",{children:"administrateur Microsoft 365"})," (r\xf4le"," ",/*#__PURE__*/(0,jsx_runtime.jsx)("i",{children:"Global Administrator"})," ou \xe9quivalent)."]}),/*#__PURE__*/(0,jsx_runtime.jsx)(AdminConsentBlock,{})]})})]})})]})}function ClientHostedView({tenant}){return/*#__PURE__*/(0,jsx_runtime.jsxs)(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:"SharePoint d’entreprise connect\xe9"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",fz:"sm",children:"Airporting \xe9crit dans les fichiers Excel h\xe9berg\xe9s sur votre propre tenant Microsoft 365."})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:"green",size:"lg",children:"Connect\xe9"})]}),/*#__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)(AdminConsentBlock,{variant:"reconnect"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(ExcelFilesSection,{enabled:true})]})}function AdminConsentBlock({variant="connect"}){const config=(0,useAppConfigConnectorSingle.C)();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]);const isConnecting=startMutation.isPending||isOpen;const label="reconnect"===variant?"Reconnecter Microsoft":"Connecter Microsoft";return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{mt:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"reconnect"===variant?"light":"filled",onClick:handleConnect,loading:isConnecting,children:label}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{c:"dimmed",fz:"xs",children:["Une fen\xeatre Microsoft va s’ouvrir : connecte-toi avec un compte"," ",/*#__PURE__*/(0,jsx_runtime.jsx)("b",{children:"administrateur"}),' Microsoft 365, puis clique sur "Accepter".']})]}),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."})})]})]})}}}]);