@airporting/tech-app 0.0.126 → 0.0.128

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.
Files changed (206) hide show
  1. package/dist/mf/1.js +1 -0
  2. package/dist/mf/1659.js +1 -0
  3. package/dist/mf/{1330.1484499663.js → 2014.js} +3 -3
  4. package/dist/mf/{3235.0c4841ef2f.js → 2436.js} +3 -3
  5. package/dist/mf/{3711.906c609c43.js → 2588.js} +3 -3
  6. package/dist/mf/2880.js +1 -0
  7. package/dist/mf/3080.js +1 -0
  8. package/dist/mf/3364.js +14 -0
  9. package/dist/mf/3429.js +33 -0
  10. package/dist/mf/3724.js +1 -0
  11. package/dist/mf/{6237.60683e513e.js → 4153.js} +3 -3
  12. package/dist/mf/5178.js +1 -0
  13. package/dist/mf/5182.js +10 -0
  14. package/dist/mf/{5616.daffd848ee.js → 5732.js} +3 -3
  15. package/dist/mf/5772.js +10 -0
  16. package/dist/mf/6110.js +18 -0
  17. package/dist/mf/6548.js +10 -0
  18. package/dist/mf/7364.js +1 -0
  19. package/dist/mf/7378.js +10 -0
  20. package/dist/mf/7380.js +1 -0
  21. package/dist/mf/7541.js +1 -0
  22. package/dist/mf/7832.js +10 -0
  23. package/dist/mf/7906.js +1 -0
  24. package/dist/mf/8119.js +1 -0
  25. package/dist/mf/9186.js +1 -0
  26. package/dist/mf/9260.js +1 -0
  27. package/dist/mf/{409.46a4910f4b.js → 9439.js} +2 -2
  28. package/dist/mf/9622.js +10 -0
  29. package/dist/mf/9669.js +10 -0
  30. package/dist/mf/@mf-types/compiled-types/api/tech/sales/createLeadMutation.d.ts +1 -0
  31. package/dist/mf/@mf-types/compiled-types/api/tech/sales/enrichLeadMutation.d.ts +4 -1
  32. package/dist/mf/@mf-types/compiled-types/api/tech/sales/updateLeadMutation.d.ts +1 -0
  33. package/dist/mf/@mf-types/compiled-types/apps/sales/types.d.ts +4 -1
  34. package/dist/mf/@mf-types/compiled-types/gen/TechApi/index.d.ts +11 -1
  35. package/dist/mf/__federation_expose_amex.js +10 -0
  36. package/dist/mf/__federation_expose_bnpp.js +10 -0
  37. package/dist/mf/__federation_expose_credmut.js +10 -0
  38. package/dist/mf/__federation_expose_dashboard.js +1 -0
  39. package/dist/mf/__federation_expose_etat_saisie.js +1 -0
  40. package/dist/mf/__federation_expose_finance_jobs.js +1 -0
  41. package/dist/mf/__federation_expose_github.js +1 -0
  42. package/dist/mf/__federation_expose_mcp_access.js +1 -0
  43. package/dist/mf/__federation_expose_payfit.js +10 -0
  44. package/dist/mf/__federation_expose_pipeline.js +1 -0
  45. package/dist/mf/__federation_expose_sales.js +1 -0
  46. package/dist/mf/__federation_expose_scrapers.js +1 -0
  47. package/dist/mf/__federation_expose_spendesk.js +10 -0
  48. package/dist/mf/__federation_expose_spreadsheet.js +1 -0
  49. package/dist/mf/__federation_expose_synchro.js +1 -0
  50. package/dist/mf/__federation_expose_usage.js +1 -0
  51. package/dist/mf/__federation_expose_wise.js +10 -0
  52. package/dist/mf/{9698.3008e872db.css → index.css} +77 -105
  53. package/dist/mf/index.js +30 -0
  54. package/dist/mf/mf-manifest.json +215 -245
  55. package/dist/mf/mf-stats.json +218 -266
  56. package/dist/mf/tech_app.js +5 -0
  57. package/package.json +5 -5
  58. package/dist/mf/1558.e66a54e73d.js +0 -1
  59. package/dist/mf/2338.94e69795ff.js +0 -1
  60. package/dist/mf/2538.1c194a4bcd.js +0 -1
  61. package/dist/mf/2717.8f7084b540.js +0 -10
  62. package/dist/mf/3548.a2ac3faf5f.js +0 -1
  63. package/dist/mf/3887.b05f65635e.js +0 -33
  64. package/dist/mf/5098.4ad55bcb49.js +0 -10
  65. package/dist/mf/5105.2a1806dc50.js +0 -1
  66. package/dist/mf/537.b7edba1af9.js +0 -14
  67. package/dist/mf/5429.61cff3da77.js +0 -1
  68. package/dist/mf/5564.042f491bc7.js +0 -1
  69. package/dist/mf/668.a271d6c3a3.js +0 -1
  70. package/dist/mf/6755.4779da6101.js +0 -1
  71. package/dist/mf/690.0d77cae419.js +0 -1
  72. package/dist/mf/7486.84364f2d01.js +0 -10
  73. package/dist/mf/758.f1fe1bef41.js +0 -10
  74. package/dist/mf/7770.9beba1af8b.js +0 -1
  75. package/dist/mf/7883.45585213d9.js +0 -1
  76. package/dist/mf/8083.a86dc5cbbe.js +0 -1
  77. package/dist/mf/8473.91f080bae1.js +0 -10
  78. package/dist/mf/854.1a1d1ce0ec.js +0 -10
  79. package/dist/mf/8853.20c1b87755.js +0 -18
  80. package/dist/mf/8949.3f7e30e10c.js +0 -10
  81. package/dist/mf/9415.f2a6811f8c.js +0 -1
  82. package/dist/mf/9698.34be02ab76.js +0 -26
  83. package/dist/mf/__federation_expose_amex.9b5f7a13cf.js +0 -10
  84. package/dist/mf/__federation_expose_bnpp.9e26515b6b.js +0 -10
  85. package/dist/mf/__federation_expose_credmut.e8f19cfe8a.js +0 -10
  86. package/dist/mf/__federation_expose_dashboard.be190d6c02.js +0 -10
  87. package/dist/mf/__federation_expose_etat_saisie.645bdc16bc.js +0 -10
  88. package/dist/mf/__federation_expose_finance_jobs.944394079e.js +0 -1
  89. package/dist/mf/__federation_expose_github.707a6236f7.js +0 -10
  90. package/dist/mf/__federation_expose_mcp_access.82a422dded.js +0 -10
  91. package/dist/mf/__federation_expose_mcp_access.82a422dded.js.LICENSE.txt +0 -9
  92. package/dist/mf/__federation_expose_payfit.515eac3595.js +0 -10
  93. package/dist/mf/__federation_expose_payfit.515eac3595.js.LICENSE.txt +0 -9
  94. package/dist/mf/__federation_expose_pipeline.48dbe478c4.js +0 -10
  95. package/dist/mf/__federation_expose_pipeline.48dbe478c4.js.LICENSE.txt +0 -9
  96. package/dist/mf/__federation_expose_sales.792debdfc0.js +0 -10
  97. package/dist/mf/__federation_expose_sales.792debdfc0.js.LICENSE.txt +0 -9
  98. package/dist/mf/__federation_expose_scrapers.ec2bebbb38.js +0 -10
  99. package/dist/mf/__federation_expose_scrapers.ec2bebbb38.js.LICENSE.txt +0 -9
  100. package/dist/mf/__federation_expose_spendesk.f36a6189d1.js +0 -10
  101. package/dist/mf/__federation_expose_spendesk.f36a6189d1.js.LICENSE.txt +0 -9
  102. package/dist/mf/__federation_expose_spreadsheet.552786fca7.js +0 -1
  103. package/dist/mf/__federation_expose_synchro.090ad23824.js +0 -10
  104. package/dist/mf/__federation_expose_synchro.090ad23824.js.LICENSE.txt +0 -9
  105. package/dist/mf/__federation_expose_usage.be52f862ad.js +0 -10
  106. package/dist/mf/__federation_expose_usage.be52f862ad.js.LICENSE.txt +0 -9
  107. package/dist/mf/__federation_expose_wise.b31a4dcd88.js +0 -10
  108. package/dist/mf/__federation_expose_wise.b31a4dcd88.js.LICENSE.txt +0 -9
  109. package/dist/mf/index.26a8175ef8.js +0 -6
  110. package/dist/mf/index.71e639cd3c.css +0 -2
  111. package/dist/mf/tech_app.b6f1ed84aa.js +0 -6
  112. /package/dist/mf/{1330.1484499663.js.LICENSE.txt → 2014.js.LICENSE.txt} +0 -0
  113. /package/dist/mf/{3235.0c4841ef2f.js.LICENSE.txt → 2436.js.LICENSE.txt} +0 -0
  114. /package/dist/mf/{3711.906c609c43.js.LICENSE.txt → 2588.js.LICENSE.txt} +0 -0
  115. /package/dist/mf/{3887.b05f65635e.js.LICENSE.txt → 3429.js.LICENSE.txt} +0 -0
  116. /package/dist/mf/{6237.60683e513e.js.LICENSE.txt → 4153.js.LICENSE.txt} +0 -0
  117. /package/dist/mf/{2717.8f7084b540.js.LICENSE.txt → 5182.js.LICENSE.txt} +0 -0
  118. /package/dist/mf/{5616.daffd848ee.js.LICENSE.txt → 5732.js.LICENSE.txt} +0 -0
  119. /package/dist/mf/{7486.84364f2d01.js.LICENSE.txt → 5772.js.LICENSE.txt} +0 -0
  120. /package/dist/mf/{8853.20c1b87755.js.LICENSE.txt → 6110.js.LICENSE.txt} +0 -0
  121. /package/dist/mf/{758.f1fe1bef41.js.LICENSE.txt → 6548.js.LICENSE.txt} +0 -0
  122. /package/dist/mf/{8473.91f080bae1.js.LICENSE.txt → 7378.js.LICENSE.txt} +0 -0
  123. /package/dist/mf/{854.1a1d1ce0ec.js.LICENSE.txt → 7832.js.LICENSE.txt} +0 -0
  124. /package/dist/mf/{409.46a4910f4b.js.LICENSE.txt → 9439.js.LICENSE.txt} +0 -0
  125. /package/dist/mf/{5098.4ad55bcb49.js.LICENSE.txt → 9622.js.LICENSE.txt} +0 -0
  126. /package/dist/mf/{8949.3f7e30e10c.js.LICENSE.txt → 9669.js.LICENSE.txt} +0 -0
  127. /package/dist/mf/{__federation_expose_amex.9b5f7a13cf.js.LICENSE.txt → __federation_expose_amex.js.LICENSE.txt} +0 -0
  128. /package/dist/mf/{__federation_expose_bnpp.9e26515b6b.js.LICENSE.txt → __federation_expose_bnpp.js.LICENSE.txt} +0 -0
  129. /package/dist/mf/{__federation_expose_credmut.e8f19cfe8a.js.LICENSE.txt → __federation_expose_credmut.js.LICENSE.txt} +0 -0
  130. /package/dist/mf/{__federation_expose_dashboard.be190d6c02.js.LICENSE.txt → __federation_expose_payfit.js.LICENSE.txt} +0 -0
  131. /package/dist/mf/{__federation_expose_etat_saisie.645bdc16bc.js.LICENSE.txt → __federation_expose_spendesk.js.LICENSE.txt} +0 -0
  132. /package/dist/mf/{__federation_expose_github.707a6236f7.js.LICENSE.txt → __federation_expose_wise.js.LICENSE.txt} +0 -0
  133. /package/dist/mf/{9698.34be02ab76.js.LICENSE.txt → index.js.LICENSE.txt} +0 -0
  134. /package/dist/mf/static/font/{HostGrotesk-VariableFont_wght.5248a50f8f.ttf → HostGrotesk-VariableFont_wght.ttf} +0 -0
  135. /package/dist/mf/static/font/{IBMPlexSans-VariableFont_wdth,wght.b9dbc346df.ttf → IBMPlexSans-VariableFont_wdth,wght.ttf} +0 -0
  136. /package/dist/mf/static/svg/{ad.b565cad3b9.svg → ad.svg} +0 -0
  137. /package/dist/mf/static/svg/{af.c6050ccd88.svg → af.svg} +0 -0
  138. /package/dist/mf/static/svg/{arab.979580f271.svg → arab.svg} +0 -0
  139. /package/dist/mf/static/svg/{as.01647fade1.svg → as.svg} +0 -0
  140. /package/dist/mf/static/svg/{aw.38f249536e.svg → aw.svg} +0 -0
  141. /package/dist/mf/static/svg/{bm.a27098d2f0.svg → bm.svg} +0 -0
  142. /package/dist/mf/static/svg/{bn.c13ab93d4e.svg → bn.svg} +0 -0
  143. /package/dist/mf/static/svg/{bo.9eafaa771a.svg → bo.svg} +0 -0
  144. /package/dist/mf/static/svg/{br.67a6502fcc.svg → br.svg} +0 -0
  145. /package/dist/mf/static/svg/{bt.1a35bb5790.svg → bt.svg} +0 -0
  146. /package/dist/mf/static/svg/{bz.07b1393a39.svg → bz.svg} +0 -0
  147. /package/dist/mf/static/svg/{cy.239da48548.svg → cy.svg} +0 -0
  148. /package/dist/mf/static/svg/{dg.2de1a54797.svg → dg.svg} +0 -0
  149. /package/dist/mf/static/svg/{dm.c3205e29a5.svg → dm.svg} +0 -0
  150. /package/dist/mf/static/svg/{do.5dff1c5f2d.svg → do.svg} +0 -0
  151. /package/dist/mf/static/svg/{eac.8d4776f547.svg → eac.svg} +0 -0
  152. /package/dist/mf/static/svg/{ec.fe749fb472.svg → ec.svg} +0 -0
  153. /package/dist/mf/static/svg/{eg.047d5d7822.svg → eg.svg} +0 -0
  154. /package/dist/mf/static/svg/{es-ga.13ecfea239.svg → es-ga.svg} +0 -0
  155. /package/dist/mf/static/svg/{es.b74b736606.svg → es.svg} +0 -0
  156. /package/dist/mf/static/svg/{fj.a7cdc5d921.svg → fj.svg} +0 -0
  157. /package/dist/mf/static/svg/{fk.2fa702939b.svg → fk.svg} +0 -0
  158. /package/dist/mf/static/svg/{gb-nir.8ec547f4f5.svg → gb-nir.svg} +0 -0
  159. /package/dist/mf/static/svg/{gb-wls.1cf3d9cc10.svg → gb-wls.svg} +0 -0
  160. /package/dist/mf/static/svg/{gq.c572f675c8.svg → gq.svg} +0 -0
  161. /package/dist/mf/static/svg/{gs.fe3374bb83.svg → gs.svg} +0 -0
  162. /package/dist/mf/static/svg/{gt.097451fc17.svg → gt.svg} +0 -0
  163. /package/dist/mf/static/svg/{gu.b033e7a688.svg → gu.svg} +0 -0
  164. /package/dist/mf/static/svg/{hr.f0c84cca2a.svg → hr.svg} +0 -0
  165. /package/dist/mf/static/svg/{ht.9f91507754.svg → ht.svg} +0 -0
  166. /package/dist/mf/static/svg/{im.479ad3e9b6.svg → im.svg} +0 -0
  167. /package/dist/mf/static/svg/{io.fc7eebc158.svg → io.svg} +0 -0
  168. /package/dist/mf/static/svg/{ir.801fbb847c.svg → ir.svg} +0 -0
  169. /package/dist/mf/static/svg/{je.2b7a276f75.svg → je.svg} +0 -0
  170. /package/dist/mf/static/svg/{kg.994fed1d50.svg → kg.svg} +0 -0
  171. /package/dist/mf/static/svg/{kh.e67aa6fd5c.svg → kh.svg} +0 -0
  172. /package/dist/mf/static/svg/{ki.9e4e595c2f.svg → ki.svg} +0 -0
  173. /package/dist/mf/static/svg/{ky.c6d5a8d576.svg → ky.svg} +0 -0
  174. /package/dist/mf/static/svg/{kz.07b60b89d0.svg → kz.svg} +0 -0
  175. /package/dist/mf/static/svg/{li.5cded3252c.svg → li.svg} +0 -0
  176. /package/dist/mf/static/svg/{lk.23166e8c77.svg → lk.svg} +0 -0
  177. /package/dist/mf/static/svg/{md.dba4c7fc54.svg → md.svg} +0 -0
  178. /package/dist/mf/static/svg/{me.7e20b942ca.svg → me.svg} +0 -0
  179. /package/dist/mf/static/svg/{mp.8842d0ea8c.svg → mp.svg} +0 -0
  180. /package/dist/mf/static/svg/{ms.2e19586bd0.svg → ms.svg} +0 -0
  181. /package/dist/mf/static/svg/{mt.b8ab0ef5e2.svg → mt.svg} +0 -0
  182. /package/dist/mf/static/svg/{mx.bc25957663.svg → mx.svg} +0 -0
  183. /package/dist/mf/static/svg/{nf.407d2ab842.svg → nf.svg} +0 -0
  184. /package/dist/mf/static/svg/{ni.bf7fcea52d.svg → ni.svg} +0 -0
  185. /package/dist/mf/static/svg/{om.449f75b209.svg → om.svg} +0 -0
  186. /package/dist/mf/static/svg/{pn.b4e1ab6aa7.svg → pn.svg} +0 -0
  187. /package/dist/mf/static/svg/{pt.acd403c018.svg → pt.svg} +0 -0
  188. /package/dist/mf/static/svg/{py.6523d7909b.svg → py.svg} +0 -0
  189. /package/dist/mf/static/svg/{rs.0f45ed27ff.svg → rs.svg} +0 -0
  190. /package/dist/mf/static/svg/{sa.9a769000dc.svg → sa.svg} +0 -0
  191. /package/dist/mf/static/svg/{sh-ac.103f8fd9a6.svg → sh-ac.svg} +0 -0
  192. /package/dist/mf/static/svg/{sh-hl.664afc561d.svg → sh-hl.svg} +0 -0
  193. /package/dist/mf/static/svg/{sh-ta.9e06bc08e4.svg → sh-ta.svg} +0 -0
  194. /package/dist/mf/static/svg/{sm.9f3be35f44.svg → sm.svg} +0 -0
  195. /package/dist/mf/static/svg/{sv.4a7ef34153.svg → sv.svg} +0 -0
  196. /package/dist/mf/static/svg/{sx.ba3ea51fe1.svg → sx.svg} +0 -0
  197. /package/dist/mf/static/svg/{sz.61ba2742e1.svg → sz.svg} +0 -0
  198. /package/dist/mf/static/svg/{tc.1d40ce70d6.svg → tc.svg} +0 -0
  199. /package/dist/mf/static/svg/{tm.6a8ec56b96.svg → tm.svg} +0 -0
  200. /package/dist/mf/static/svg/{un.98053442eb.svg → un.svg} +0 -0
  201. /package/dist/mf/static/svg/{va.959875d92d.svg → va.svg} +0 -0
  202. /package/dist/mf/static/svg/{vg.56b7d72255.svg → vg.svg} +0 -0
  203. /package/dist/mf/static/svg/{vi.aaeab1462a.svg → vi.svg} +0 -0
  204. /package/dist/mf/static/svg/{xk.961776b909.svg → xk.svg} +0 -0
  205. /package/dist/mf/static/svg/{zm.ef3a9aef9f.svg → zm.svg} +0 -0
  206. /package/dist/mf/static/svg/{zw.3e71d5a4d2.svg → zw.svg} +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["2149"],{1334:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{m:()=>useSalesLeads});var _tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(6197);var _useApi_ts__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(4148);function useSalesLeads(status){const api=(0,_useApi_ts__WEBPACK_IMPORTED_MODULE_1__.h)();return(0,_tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__.useQuery)({queryKey:["tech","sales","leads",status],queryFn:async()=>(await api.sales.listLeadsV1({status})).data,refetchOnWindowFocus:true})}},479:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{P:()=>TEMPERATURE_META,o:()=>TEMPERATURE_ORDER});const TEMPERATURE_META={burning:{emoji:"\uD83D\uDD25\uD83D\uDD25",label:"Br\xfblant",order:5},hot:{emoji:"\uD83D\uDD25",label:"Chaud",order:4},warm:{emoji:"\uD83C\uDF21️",label:"Ti\xe8de",order:3},cold:{emoji:"❄️",label:"Froid",order:2},frozen:{emoji:"\uD83E\uDDCA",label:"Gel\xe9",order:1}};const TEMPERATURE_ORDER=["burning","hot","warm","cold","frozen"]},2722:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Pipeline});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(9735);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);var esm_index_mjs_=__webpack_require__(3863);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useSalesDeals(pipeline,status){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","sales","deals",pipeline,status],queryFn:async()=>(await api.sales.listDealsV1({pipeline,status})).data,refetchOnWindowFocus:true})}var dates_esm_index_mjs_=__webpack_require__(9038);var notifications_esm_index_mjs_=__webpack_require__(1455);function useDeleteDeal(){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async id=>(await api.sales.deleteDealV1({id})).data,onSuccess:()=>{notifications_esm_index_mjs_.notifications.show({title:"Deal",message:"Deal supprim\xe9",color:"green"});queryClient.invalidateQueries({queryKey:["tech","sales"]})},onError:err=>{notifications_esm_index_mjs_.notifications.show({title:"Deal",message:err?.error?.error??err?.message??"\xc9chec de la suppression",color:"red"})}})}function useUpdateDeal(id){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async payload=>(await api.sales.updateDealV1({id},payload)).data,onSuccess:()=>{notifications_esm_index_mjs_.notifications.show({title:"Deal",message:"Modifications enregistr\xe9es",color:"green"});queryClient.invalidateQueries({queryKey:["tech","sales"]})},onError:err=>{notifications_esm_index_mjs_.notifications.show({title:"Deal",message:err?.error?.error??err?.message??"\xc9chec de la mise \xe0 jour",color:"red"})}})}const eurFormatter=new Intl.NumberFormat("fr-FR",{style:"currency",currency:"EUR",maximumFractionDigits:0});const dayFormatter=new Intl.DateTimeFormat("fr-FR",{timeZone:"Europe/Paris",day:"2-digit",month:"2-digit",year:"numeric"});function formatEur(value){if(Number.isNaN(value))return eurFormatter.format(0);return eurFormatter.format(value)}function formatAmount(value,currency){if("EUR"===currency||""===currency)return formatEur(value);return new Intl.NumberFormat("fr-FR",{style:"currency",currency,maximumFractionDigits:0}).format(value)}function formatDay(iso){if(null===iso)return"";const date=new Date(iso);if(Number.isNaN(date.getTime()))return"";return dayFormatter.format(date)}var temperature=__webpack_require__(479);const STATUS_META={open:{label:"Ouvert",color:"blue"},won:{label:"Gagn\xe9",color:"green"},lost:{label:"Perdu",color:"red"}};function personLabel(deal){const parts=[deal.lead.first_name,deal.lead.last_name].filter(Boolean);return parts.join(" ")}function DealDetailForm({deal,stages,onClose}){const update=useUpdateDeal(deal.id);const remove=useDeleteDeal();const[title,setTitle]=(0,index_js_.useState)(deal.title);const[value,setValue]=(0,index_js_.useState)(deal.value);const[probability,setProbability]=(0,index_js_.useState)(null===deal.probability?"":deal.probability);const[expectedCloseDate,setExpectedCloseDate]=(0,index_js_.useState)(deal.expected_close_date??"");const[stageId,setStageId]=(0,index_js_.useState)(String(deal.stage_id));const[lostReason,setLostReason]=(0,index_js_.useState)(deal.lost_reason??"");const statusMeta=STATUS_META[deal.status];function save(){update.mutate({title,value:""===value?0:Number(value),probability:""===probability?null:Number(probability),expected_close_date:""===expectedCloseDate?null:expectedCloseDate,stage_id:null===stageId?void 0:Number(stageId)})}function markWon(){update.mutate({status:"won"},{onSuccess:onClose})}function markLost(){update.mutate({status:"lost",lost_reason:""===lostReason?null:lostReason},{onSuccess:onClose})}function reopen(){update.mutate({status:"open"},{onSuccess:onClose})}function handleDelete(){remove.mutate(deal.id,{onSuccess:onClose})}return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[statusMeta?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{variant:"light",color:statusMeta.color,children:statusMeta.label}):null,"won"===deal.status&&null!==deal.won_at?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",c:"dimmed",children:`Gagn\xe9 le ${formatDay(deal.won_at)}`}):null,"lost"===deal.status&&null!==deal.lost_at?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",c:"dimmed",children:`Perdu le ${formatDay(deal.lost_at)}`}):null]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:`${temperature.P[deal.lead.temperature]?.emoji??""} ${personLabel(deal)}`.trim()}),deal.lead.company?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",c:"dimmed",children:deal.lead.company}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Anchor,{href:"/console/sales",size:"sm",children:"Voir le lead"})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Divider,{}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Titre",value:title,onChange:e=>setTitle(e.currentTarget.value)}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{grow:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.NumberInput,{label:"Montant",value:value,onChange:setValue,min:0,thousandSeparator:" ",decimalSeparator:",",suffix:` ${deal.currency}`}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.NumberInput,{label:"Probabilit\xe9 (%)",value:probability,onChange:setProbability,min:0,max:100})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(dates_esm_index_mjs_.DateInput,{label:"\xc9ch\xe9ance",placeholder:"Pas de date fix\xe9e",clearable:true,valueFormat:"DD/MM/YYYY",value:expectedCloseDate?new Date(expectedCloseDate):null,onChange:v=>setExpectedCloseDate(v?new Date(v).toISOString():"")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{label:"\xc9tape",data:stages.map(s=>({value:String(s.id),label:s.name})),value:stageId,onChange:setStageId}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{color:"red",variant:"light",onClick:handleDelete,children:"Supprimer"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{loading:update.isPending,onClick:save,children:"Enregistrer"})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Divider,{mt:"md"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:5,children:"Statut"}),"open"===deal.status?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Raison de la perte (optionnelle)",value:lostReason,onChange:e=>setLostReason(e.currentTarget.value)}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{color:"red",variant:"light",loading:update.isPending,onClick:markLost,children:"Perdu"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{color:"green",loading:update.isPending,onClick:markWon,children:"Gagn\xe9"})]})]}):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"flex-end",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"light",loading:update.isPending,onClick:reopen,children:"Rouvrir"})})]})}function DealDetailDrawer({deal,stages,onClose}){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Drawer,{opened:null!==deal,onClose:onClose,position:"right",size:"lg",title:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,children:"Deal"}),children:deal?/*#__PURE__*/(0,jsx_runtime.jsx)(DealDetailForm,{deal:deal,stages:stages,onClose:onClose},deal.id):null})}function stageName(stages,stageId){const stage=stages.find(s=>s.id===stageId);if(!stage)return"";return stage.name}function DealsTable({deals,stages,status,onRowClick}){const isLost="lost"===status;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{highlightOnHover:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Titre"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Entreprise"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Montant"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:isLost?"Perdu le":"Gagn\xe9 le"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"\xc9tape"}),isLost?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Raison"}):null]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:deals.map(deal=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{style:{cursor:"pointer"},onClick:()=>onRowClick(deal.id),children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:deal.title}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:deal.lead.company??""}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:formatAmount(deal.value,deal.currency)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:formatDay(isLost?deal.lost_at:deal.won_at)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:stageName(stages,deal.stage_id)}),isLost?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",c:deal.lost_reason?void 0:"dimmed",children:deal.lost_reason??"Non renseign\xe9e"})}):null]},deal.id))})]})}var tabler_icons_react_mjs_=__webpack_require__(9632);function DealCard_personLabel(deal){const parts=[deal.lead.first_name,deal.lead.last_name].filter(Boolean);return parts.join(" ")}function DealCard({deal,stages,onOpen}){const update=useUpdateDeal(deal.id);const index=stages.findIndex(s=>s.id===deal.stage_id);const previous=index>0?stages[index-1]:null;const next=index>=0&&index<stages.length-1?stages[index+1]:null;function move(target){if(null===target)return;update.mutate({stage_id:target.id})}return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Card,{withBorder:true,padding:"sm",radius:"md",style:{cursor:"pointer"},onClick:()=>onOpen(deal.id),children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:6,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",wrap:"nowrap",align:"flex-start",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:500,size:"sm",lineClamp:2,children:deal.title}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{variant:"light",color:"blue",children:formatAmount(deal.value,deal.currency)})]}),deal.lead.company?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:deal.lead.company}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:`${temperature.P[deal.lead.temperature]?.emoji??""} ${DealCard_personLabel(deal)}`.trim()}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[null!==deal.probability?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{variant:"light",color:"gray",size:"sm",children:`${deal.probability} %`}):null,null!==deal.expected_close_date?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{variant:"light",color:"gray",size:"sm",children:`\xc9ch\xe9ance : ${formatDay(deal.expected_close_date)}`}):null]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{variant:"subtle",size:"sm","aria-label":"\xc9tape pr\xe9c\xe9dente",disabled:null===previous||update.isPending,onClick:e=>{e.stopPropagation();move(previous)},children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconChevronLeft,{size:16})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{variant:"subtle",size:"sm","aria-label":"\xc9tape suivante",disabled:null===next||update.isPending,onClick:e=>{e.stopPropagation();move(next)},children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconChevronRight,{size:16})})]})]})})}function KanbanBoard({stages,deals,onOpen}){if(0===stages.length)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",c:"dimmed",children:"Aucune \xe9tape configur\xe9e pour ce pipeline"});return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Box,{style:{display:"flex",gap:"var(--mantine-spacing-md)",alignItems:"flex-start",overflowX:"auto",paddingBottom:"var(--mantine-spacing-sm)"},children:stages.map(stage=>{const stageDeals=deals.filter(d=>d.stage_id===stage.id);return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"sm",style:{flex:"0 0 300px",width:300},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:2,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",wrap:"nowrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:600,size:"sm",children:stage.name}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{variant:"light",color:"gray",children:stage.deal_count})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:formatEur(stage.total_value)})]}),0===stageDeals.length?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:"Aucun deal"}):null,stageDeals.map(deal=>/*#__PURE__*/(0,jsx_runtime.jsx)(DealCard,{deal:deal,stages:stages,onOpen:onOpen},deal.id))]})},stage.id)})})}function useCreateDeal(){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async payload=>(await api.sales.createDealV1(payload)).data,onSuccess:()=>{notifications_esm_index_mjs_.notifications.show({title:"Deal",message:"Deal cr\xe9\xe9",color:"green"});queryClient.invalidateQueries({queryKey:["tech","sales"]})},onError:err=>{notifications_esm_index_mjs_.notifications.show({title:"Deal",message:err?.error?.error??err?.message??"\xc9chec de la cr\xe9ation",color:"red"})}})}var leadsQuery=__webpack_require__(1334);function leadLabel(lead){const name=[lead.first_name,lead.last_name].filter(Boolean).join(" ");if(lead.company&&name)return`${name} (${lead.company})`;if(lead.company)return lead.company;if(name)return name;return`Lead ${lead.id}`}function NewDealForm({onClose,stages}){const leads=(0,leadsQuery.m)("active");const create=useCreateDeal();const[leadId,setLeadId]=(0,index_js_.useState)(null);const[title,setTitle]=(0,index_js_.useState)("");const[value,setValue]=(0,index_js_.useState)("");const[stageId,setStageId]=(0,index_js_.useState)(stages.length>0?String(stages[0].id):null);function submit(){if(null===leadId||null===stageId||""===title.trim())return void notifications_esm_index_mjs_.notifications.show({title:"Deal",message:"Renseignez un lead, un titre et une \xe9tape",color:"orange"});create.mutate({lead_id:Number(leadId),stage_id:Number(stageId),title:title.trim(),value:""===value?0:Number(value),currency:"EUR"},{onSuccess:onClose})}return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{label:"Lead",placeholder:"Rechercher un lead",searchable:true,nothingFoundMessage:"Aucun lead",data:(leads.data?.leads??[]).map(l=>({value:String(l.id),label:leadLabel(l)})),value:leadId,onChange:setLeadId}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Titre",value:title,onChange:e=>setTitle(e.currentTarget.value)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.NumberInput,{label:"Montant (EUR)",value:value,onChange:setValue,min:0,thousandSeparator:" ",decimalSeparator:","}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{label:"\xc9tape",data:stages.map(s=>({value:String(s.id),label:s.name})),value:stageId,onChange:setStageId}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:onClose,children:"Annuler"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{loading:create.isPending,onClick:submit,children:"Cr\xe9er"})]})]})}function NewDealModal({opened,onClose,stages}){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:opened,onClose:onClose,title:"Nouveau deal",children:opened?/*#__PURE__*/(0,jsx_runtime.jsx)(NewDealForm,{onClose:onClose,stages:stages}):null})}function PipelineApp(){const[pipeline,setPipeline]=(0,index_js_.useState)("new_business");const[status,setStatus]=(0,index_js_.useState)("open");const[selectedId,setSelectedId]=(0,index_js_.useState)(null);const[newDealOpened,newDeal]=(0,esm_index_mjs_.useDisclosure)(false);const deals=useSalesDeals(pipeline,status);const stages=deals.data?.stages??[];const rows=deals.data?.deals??[];const selected=(0,index_js_.useMemo)(()=>{if(null===selectedId)return null;return rows.find(d=>d.id===selectedId)??null},[rows,selectedId]);const total=rows.reduce((acc,d)=>acc+d.value,0);return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{fluid:true,my:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",mb:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,children:"Pipeline"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{variant:"light",color:"blue",children:`${rows.length} deal(s) : ${formatEur(total)}`}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{onClick:newDeal.open,disabled:0===stages.length,children:"+ Nouveau deal"})]})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"sm",mb:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SegmentedControl,{value:pipeline,onChange:setPipeline,data:[{label:"New Business",value:"new_business"},{label:"Upsell / Cross-sell",value:"upsell"}]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SegmentedControl,{value:status,onChange:setStatus,data:[{label:"Ouverts",value:"open"},{label:"Gagn\xe9s",value:"won"},{label:"Perdus",value:"lost"}]})]}),deals.isLoading?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Loader,{}):null,deals.data&&"open"===status?/*#__PURE__*/(0,jsx_runtime.jsx)(KanbanBoard,{stages:stages,deals:rows,onOpen:setSelectedId}):null,deals.data&&"open"!==status?/*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment,{children:0===rows.length?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",c:"dimmed",children:"Aucun deal"}):/*#__PURE__*/(0,jsx_runtime.jsx)(DealsTable,{deals:rows,stages:stages,status:status,onRowClick:setSelectedId})}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(NewDealModal,{opened:newDealOpened,onClose:newDeal.close,stages:stages}),/*#__PURE__*/(0,jsx_runtime.jsx)(DealDetailDrawer,{deal:selected,stages:stages,onClose:()=>setSelectedId(null)})]})}function Pipeline(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(providers.C,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(PipelineApp,{})})})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["610"],{1334:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{m:()=>useSalesLeads});var _tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(6197);var _useApi_ts__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(4148);function useSalesLeads(status){const api=(0,_useApi_ts__WEBPACK_IMPORTED_MODULE_1__.h)();return(0,_tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__.useQuery)({queryKey:["tech","sales","leads",status],queryFn:async()=>(await api.sales.listLeadsV1({status})).data,refetchOnWindowFocus:true})}},479:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{P:()=>TEMPERATURE_META,o:()=>TEMPERATURE_ORDER});const TEMPERATURE_META={burning:{emoji:"\uD83D\uDD25\uD83D\uDD25",label:"Br\xfblant",order:5},hot:{emoji:"\uD83D\uDD25",label:"Chaud",order:4},warm:{emoji:"\uD83C\uDF21️",label:"Ti\xe8de",order:3},cold:{emoji:"❄️",label:"Froid",order:2},frozen:{emoji:"\uD83E\uDDCA",label:"Gel\xe9",order:1}};const TEMPERATURE_ORDER=["burning","hot","warm","cold","frozen"]},3897:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{O:()=>BrandLogo});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(207);var _src_components_logoDev_ts__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(243);function BrandLogo({domain,alt,size=24}){return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Image,{src:(0,_src_components_logoDev_ts__WEBPACK_IMPORTED_MODULE_2__.j)(domain),alt:alt,title:alt,w:size,h:size,fit:"contain",radius:"sm",style:{aspectRatio:1}})}},243:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{j:()=>logoDevUrl});const LOGO_DEV_TOKEN="pk_BVN4OQv0Qs-bnqjdIgTppg";function logoDevUrl(domain){return`https://img.logo.dev/${domain}?token=${LOGO_DEV_TOKEN}`}},3189:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Sales});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(9735);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);var esm_index_mjs_=__webpack_require__(3863);var leadsQuery=__webpack_require__(1334);var modern_index_js_=__webpack_require__(6197);var notifications_esm_index_mjs_=__webpack_require__(1455);var useApi=__webpack_require__(4148);function useSalesRescan(){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async()=>(await api.sales.rescanV1()).data,onSuccess:data=>{notifications_esm_index_mjs_.notifications.show({title:"Re-scan",message:data?.message??"Re-scan lanc\xe9",color:data?.ok?"green":"orange"});queryClient.invalidateQueries({queryKey:["tech","sales"]})},onError:err=>{notifications_esm_index_mjs_.notifications.show({title:"Re-scan",message:err?.error?.error??err?.message??"\xc9chec du re-scan",color:"red"})}})}function useSalesSyncState(){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","sales","sync-state"],queryFn:async()=>(await api.sales.syncStateV1()).data,refetchOnWindowFocus:true})}function useSalesScanSummary(){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","sales","scan-summary"],queryFn:async()=>(await api.sales.scanRunSummaryV1()).data,refetchOnWindowFocus:true})}const dateFormatter=new Intl.DateTimeFormat("fr-FR",{timeZone:"Europe/Paris",day:"2-digit",month:"2-digit"});const dateTimeFormatter=new Intl.DateTimeFormat("fr-FR",{timeZone:"Europe/Paris",day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"});function parisDayKey(date){return dateFormatter.format(date)}function formatRelativeParis(iso){if(null===iso)return"jamais";const date=new Date(iso);if(Number.isNaN(date.getTime()))return"jamais";const now=new Date;const diffMs=now.getTime()-date.getTime();if(diffMs<0)return`le ${dateFormatter.format(date)}`;const diffMinutes=Math.floor(diffMs/6e4);if(diffMinutes<1)return"\xe0 l'instant";if(diffMinutes<60)return`il y a ${diffMinutes} min`;const diffHours=Math.floor(diffMinutes/60);if(diffHours<24)return`il y a ${diffHours} h`;const todayKey=parisDayKey(now);const yesterday=new Date(now.getTime()-864e5);const yesterdayKey=parisDayKey(yesterday);const dateKey=parisDayKey(date);if(dateKey===yesterdayKey&&dateKey!==todayKey)return"hier";return`le ${dateFormatter.format(date)}`}function formatDateParis(iso){if(null===iso)return"";const date=new Date(iso);if(Number.isNaN(date.getTime()))return"";return dateTimeFormatter.format(date)}var sales_temperature=__webpack_require__(479);function dueLabel(value){if(!value)return"Pas de date fix\xe9e";return new Date(value).toLocaleDateString("fr-FR",{timeZone:"Europe/Paris"})}function compare(a,b,key,desc){let av;let bv;if("temperature"===key){av=sales_temperature.P[a.temperature].order;bv=sales_temperature.P[b.temperature].order}else{av=a[key]?new Date(a[key]).getTime():0;bv=b[key]?new Date(b[key]).getTime():0}if(desc)return bv-av;return av-bv}function matchesSearch(lead,query){const q=query.trim().toLowerCase();if(!q)return true;const haystack=[lead.first_name,lead.last_name,lead.company,lead.email,lead.phone,lead.linkedin_url].filter(Boolean).join(" ").toLowerCase();return haystack.includes(q)}function LeadsTable({leads,temperatureFilter,search,onRowClick}){const[sortKey,setSortKey]=(0,index_js_.useState)("last_contact_at");const[desc,setDesc]=(0,index_js_.useState)(true);function toggleSort(key){if(key===sortKey)setDesc(d=>!d);else{setSortKey(key);setDesc(true)}}const rows=(0,index_js_.useMemo)(()=>{const filtered=leads.filter(l=>{if(temperatureFilter&&l.temperature!==temperatureFilter)return false;return matchesSearch(l,search)});return[...filtered].sort((a,b)=>compare(a,b,sortKey,desc))},[leads,temperatureFilter,search,sortKey,desc]);return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.ScrollContainer,{minWidth:1250,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{highlightOnHover:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.UnstyledButton,{onClick:()=>toggleSort("temperature"),children:"Temp\xe9rature"})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Pr\xe9nom"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Nom"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Entreprise"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Email"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"T\xe9l\xe9phone"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"LinkedIn"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.UnstyledButton,{onClick:()=>toggleSort("last_contact_at"),children:"Dernier contact"})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Prochaine action"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.UnstyledButton,{onClick:()=>toggleSort("next_action_due_at"),children:"\xc9ch\xe9ance"})})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:rows.map(l=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{style:{cursor:"pointer"},onClick:()=>onRowClick(l.id),children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:sales_temperature.P[l.temperature].emoji}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:l.first_name??""}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:l.last_name??""}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:l.company??""}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:l.email??"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:l.phone??"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:l.linkedin_url?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Anchor,{href:l.linkedin_url,target:"_blank",rel:"noreferrer",onClick:event=>event.stopPropagation(),children:"Profil"}):"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:l.last_contact_at?new Date(l.last_contact_at).toLocaleDateString("fr-FR",{timeZone:"Europe/Paris"}):"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:l.next_action??"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",c:l.next_action_due_at?void 0:"dimmed",children:dueLabel(l.next_action_due_at)})})]},l.id))})]})})}var dates_esm_index_mjs_=__webpack_require__(9038);var tabler_icons_react_mjs_=__webpack_require__(9632);function useSalesLead(id){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","sales","lead",id],enabled:null!==id,queryFn:async()=>(await api.sales.getLeadV1({id})).data})}function useUpdateLead(id){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async payload=>(await api.sales.updateLeadV1({id},payload)).data,onSuccess:()=>{notifications_esm_index_mjs_.notifications.show({title:"Lead",message:"Modifications enregistr\xe9es",color:"green"});queryClient.invalidateQueries({queryKey:["tech","sales"]})},onError:err=>{notifications_esm_index_mjs_.notifications.show({title:"Lead",message:err?.error?.error??err?.message??"\xc9chec de la mise \xe0 jour",color:"red"})}})}function useDeleteLead(){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async id=>(await api.sales.deleteLeadV1({id})).data,onSuccess:()=>{notifications_esm_index_mjs_.notifications.show({title:"Lead",message:"Lead supprim\xe9",color:"green"});queryClient.invalidateQueries({queryKey:["tech","sales"]})},onError:err=>{notifications_esm_index_mjs_.notifications.show({title:"Lead",message:err?.error?.error??err?.message??"\xc9chec de la suppression",color:"red"})}})}function useSetLifecycle(id){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async status=>(await api.sales.setLifecycleV1({id},{status})).data,onSuccess:()=>{notifications_esm_index_mjs_.notifications.show({title:"Lead",message:"Statut mis \xe0 jour",color:"green"});queryClient.invalidateQueries({queryKey:["tech","sales"]})},onError:err=>{notifications_esm_index_mjs_.notifications.show({title:"Lead",message:err?.error?.error??err?.message??"\xc9chec",color:"red"})}})}function useAddComment(id){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async text=>(await api.sales.addCommentV1({id},{text})).data,onSuccess:()=>{notifications_esm_index_mjs_.notifications.show({title:"Lead",message:"Commentaire ajout\xe9",color:"green"});queryClient.invalidateQueries({queryKey:["tech","sales","lead",id]})},onError:err=>{notifications_esm_index_mjs_.notifications.show({title:"Lead",message:err?.error?.error??err?.message??"\xc9chec",color:"red"})}})}function useReconstructLead(id){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async()=>(await api.sales.reconstructV1({id})).data,onSuccess:()=>{notifications_esm_index_mjs_.notifications.show({title:"Scan approfondi",message:"Scan demand\xe9 — trait\xe9 \xe0 la prochaine session agent",color:"green"});queryClient.invalidateQueries({queryKey:["tech","sales"]})},onError:err=>{notifications_esm_index_mjs_.notifications.show({title:"Scan approfondi",message:err?.error?.error??err?.message??"\xc9chec",color:"red"})}})}function useEnrichLead(id){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async kind=>(await api.sales.enrichLeadV1({id,kind})).data,onSuccess:()=>{queryClient.invalidateQueries({queryKey:["tech","sales"]})}})}var BrandLogo=__webpack_require__(3897);const SOURCE_DOMAIN={pipedrive:"pipedrive.com",gmail:"google.com",claap:"claap.io",granola:"granola.ai",lemlist:"lemlist.com",linkedin:"linkedin.com",imessage:"apple.com",whatsapp:"whatsapp.com",slack:"slack.com",calendar:"google.com",pennylane:"pennylane.com",yousign:"yousign.com",notion:"notion.so"};function SourceLogo({source,size=18}){if("manual"===source)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ThemeIcon,{size:size,variant:"light",color:"gray",title:"Note",children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconNote,{size:size-4})});const domain=SOURCE_DOMAIN[source];if(!domain)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",variant:"light",color:"gray",title:source,children:source.slice(0,2).toUpperCase()});return/*#__PURE__*/(0,jsx_runtime.jsx)(BrandLogo.O,{domain:domain,alt:source,size:size})}function directionLabel(direction){if("internal"===direction)return"\uD83D\uDCDD Note";if("inbound"===direction)return"↘ Entrant";return"↗ Sortant"}function LeadTimeline({items}){if(0===items.length)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"Aucun \xe9change."});return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Timeline,{active:items.length,bulletSize:14,lineWidth:2,children:items.map(it=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Timeline.Item,{title:it.summary??"(sans r\xe9sum\xe9)",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",mb:4,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SourceLogo,{source:it.source}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",fw:500,tt:"capitalize",children:it.source}),it.channel?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",variant:"outline",children:it.channel}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:directionLabel(it.direction)})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:new Date(it.occurred_at).toLocaleString("fr-FR",{timeZone:"Europe/Paris"})}),it.external_url?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Anchor,{href:it.external_url,target:"_blank",size:"xs",children:"Ouvrir la source"}):null]})]},it.id))})}const eurFormatter=new Intl.NumberFormat("fr-FR",{style:"currency",currency:"EUR"});function scanCostLabel(lead){const{runs,tokens,cost_eur,last_ran_at}=lead.scan_cost;return`${runs} scan(s) approfondi(s) \xb7 ~${Math.round(tokens/1e3)} k tokens \u{2248} ${eurFormatter.format(cost_eur)} (dernier : ${formatDateParis(last_ran_at)})`}function scanStatusLabel(lead){if("requested"===lead.reconstruction_status)return`Scan demand\xe9 le ${formatDateParis(lead.reconstruction_requested_at)}`;if("done"===lead.reconstruction_status)return`Reconstruit le ${formatDateParis(lead.reconstruction_done_at)}`;return"Jamais reconstruit"}function LeadDetailDrawer({leadId,onClose}){const detail=useSalesLead(leadId);const update=useUpdateLead(leadId??0);const remove=useDeleteLead();const setLifecycle=useSetLifecycle(leadId??0);const addComment=useAddComment(leadId??0);const reconstruct=useReconstructLead(leadId??0);const enrich=useEnrichLead(leadId??0);const[firstName,setFirstName]=(0,index_js_.useState)("");const[lastName,setLastName]=(0,index_js_.useState)("");const[company,setCompany]=(0,index_js_.useState)("");const[email,setEmail]=(0,index_js_.useState)("");const[phone,setPhone]=(0,index_js_.useState)("");const[linkedinUrl,setLinkedinUrl]=(0,index_js_.useState)("");const[temperature,setTemperature]=(0,index_js_.useState)(null);const[nextAction,setNextAction]=(0,index_js_.useState)("");const[dueAt,setDueAt]=(0,index_js_.useState)("");const[comment,setComment]=(0,index_js_.useState)("");(0,index_js_.useEffect)(()=>{if(detail.data){setFirstName(detail.data.first_name??"");setLastName(detail.data.last_name??"");setCompany(detail.data.company??"");setEmail(detail.data.identities?.find(i=>"email"===i.type)?.value??"");setPhone(detail.data.identities?.find(i=>"phone"===i.type)?.value??"");setLinkedinUrl(detail.data.identities?.find(i=>"linkedin_url"===i.type)?.value??"");setTemperature(detail.data.temperature);setNextAction(detail.data.next_action??"");setDueAt(detail.data.next_action_due_at??"")}},[detail.data]);function save(){update.mutate({first_name:""===firstName?null:firstName,last_name:""===lastName?null:lastName,company:""===company?null:company,emails:email?[email]:[],phones:phone?[phone]:[],linkedin_url:linkedinUrl||null,temperature:temperature??void 0,next_action:""===nextAction?null:nextAction,next_action_due_at:""===dueAt?null:dueAt})}function handleDelete(){if(null===leadId)return;remove.mutate(leadId,{onSuccess:onClose})}return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Drawer,{opened:null!==leadId,onClose:onClose,position:"right",size:"lg",title:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,children:"Lead"}),children:[detail.isLoading?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Loader,{}):null,detail.data?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{grow:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Pr\xe9nom",value:firstName,onChange:e=>setFirstName(e.currentTarget.value)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Nom",value:lastName,onChange:e=>setLastName(e.currentTarget.value)})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Entreprise",value:company,onChange:e=>setCompany(e.currentTarget.value)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"URL LinkedIn",placeholder:"https://www.linkedin.com/in/...",value:linkedinUrl,onChange:e=>setLinkedinUrl(e.currentTarget.value)}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{grow:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Email",value:email,onChange:e=>setEmail(e.currentTarget.value)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"T\xe9l\xe9phone",value:phone,onChange:e=>setPhone(e.currentTarget.value)})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"light",leftSection:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconAt,{size:16}),loading:enrich.isPending&&"email"===enrich.variables,disabled:enrich.isPending||Boolean(email),onClick:()=>{enrich.mutate("email",{onSuccess:result=>{const value=result.found.emails[0];if(value)setEmail(value);if(result.added>0)notifications_esm_index_mjs_.notifications.show({title:"Email trouv\xe9",message:`${value}${result.provider?` \xb7 ${result.provider}`:""}`,color:"green"});else notifications_esm_index_mjs_.notifications.show({title:"Email",message:"Aucun email trouv\xe9",color:"gray"})},onError:err=>{notifications_esm_index_mjs_.notifications.show({title:"Email",message:err?.error?.error??err?.message??"\xc9chec",color:"red"})}})},children:"Obtenir email"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"light",leftSection:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconPhone,{size:16}),loading:enrich.isPending&&"phone"===enrich.variables,disabled:enrich.isPending||Boolean(phone),onClick:()=>{enrich.mutate("phone",{onSuccess:result=>{const value=result.found.phones[0];if(value)setPhone(value);notifications_esm_index_mjs_.notifications.show({title:result.added>0?"T\xe9l\xe9phone trouv\xe9":"T\xe9l\xe9phone",message:result.added>0?`${value}${result.provider?` \xb7 ${result.provider}`:""}`:"Aucun t\xe9l\xe9phone trouv\xe9",color:result.added>0?"green":"gray"})},onError:err=>{notifications_esm_index_mjs_.notifications.show({title:"T\xe9l\xe9phone",message:err?.error?.error??err?.message??"\xc9chec",color:"red"})}})},children:"Obtenir t\xe9l\xe9phone"})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Prochaine action",value:nextAction,onChange:e=>setNextAction(e.currentTarget.value),flex:1}),/*#__PURE__*/(0,jsx_runtime.jsx)(dates_esm_index_mjs_.DateInput,{label:"\xc9ch\xe9ance",placeholder:"Pas de date fix\xe9e",clearable:true,valueFormat:"DD/MM/YYYY",value:dueAt?new Date(dueAt):null,onChange:v=>setDueAt(v?new Date(v).toISOString():"")})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{label:"Temp\xe9rature",data:sales_temperature.o.map(t=>({value:t,label:`${sales_temperature.P[t].emoji} ${sales_temperature.P[t].label}`})),value:temperature,onChange:setTemperature}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{label:"D\xe9placer vers",data:[{value:"active",label:"Actif"},{value:"won",label:"Gagn\xe9"},{value:"lost",label:"Perdu"}],value:detail.data.lifecycle_status,onChange:v=>{if(v)setLifecycle.mutate(v)}}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{color:"red",variant:"light",onClick:handleDelete,children:"Supprimer"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{loading:update.isPending,onClick:save,children:"Enregistrer"})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Textarea,{label:"Ajouter un commentaire",value:comment,onChange:e=>setComment(e.currentTarget.value),autosize:true,minRows:2}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"flex-end",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{disabled:!comment,loading:addComment.isPending,onClick:()=>{addComment.mutate(comment,{onSuccess:()=>setComment("")})},children:"Commenter"})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Divider,{mt:"md"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:5,children:"Scan"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",c:"dimmed",children:scanStatusLabel(detail.data)}),detail.data.scan_cost.runs>0?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",c:"dimmed",children:scanCostLabel(detail.data)}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"flex-end",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"light",loading:reconstruct.isPending,disabled:"requested"===detail.data.reconstruction_status,onClick:()=>reconstruct.mutate(),children:"Demander un scan approfondi"})})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:5,mt:"md",children:"Historique"}),/*#__PURE__*/(0,jsx_runtime.jsx)(LeadTimeline,{items:detail.data.interactions})]}):null]})}var form_esm_index_mjs_=__webpack_require__(5021);function useCreateLead(){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async payload=>(await api.sales.createLeadV1(payload)).data,onSuccess:data=>{notifications_esm_index_mjs_.notifications.show({title:"Lead",message:data?.attached?"Coordonn\xe9e d\xe9j\xe0 connue — rattach\xe9 au lead existant":"Lead cr\xe9\xe9",color:"green"});queryClient.invalidateQueries({queryKey:["tech","sales"]})},onError:err=>{notifications_esm_index_mjs_.notifications.show({title:"Lead",message:err?.error?.error??err?.message??"\xc9chec de la cr\xe9ation",color:"red"})}})}function NewLeadModal({opened,onClose}){const create=useCreateLead();const form=(0,form_esm_index_mjs_.useForm)({initialValues:{first_name:"",last_name:"",company:"",email:"",phone:"",linkedin_url:"",note:"",next_action_due_at:null,request_reconstruction:true}});function submit(values){const hasAny=Boolean(values.first_name)||Boolean(values.last_name)||Boolean(values.company)||Boolean(values.email)||Boolean(values.phone)||Boolean(values.linkedin_url);if(!hasAny)return void notifications_esm_index_mjs_.notifications.show({title:"Lead",message:"Renseignez au moins un nom, une entreprise ou une coordonn\xe9e",color:"orange"});create.mutate({first_name:values.first_name||null,last_name:values.last_name||null,company:values.company||null,emails:values.email?[values.email]:[],phones:values.phone?[values.phone]:[],linkedin_url:values.linkedin_url||null,note:values.note||null,next_action_due_at:values.next_action_due_at?new Date(values.next_action_due_at).toISOString():null,request_reconstruction:values.request_reconstruction},{onSuccess:()=>{form.reset();onClose()}})}return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:opened,onClose:onClose,title:"Nouveau lead",children:/*#__PURE__*/(0,jsx_runtime.jsx)("form",{onSubmit:form.onSubmit(submit),children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{grow:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Pr\xe9nom",...form.getInputProps("first_name")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Nom",...form.getInputProps("last_name")})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Entreprise",...form.getInputProps("company")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"URL LinkedIn",placeholder:"https://www.linkedin.com/in/...",...form.getInputProps("linkedin_url")}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{grow:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Email",...form.getInputProps("email")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"T\xe9l\xe9phone",...form.getInputProps("phone")})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Textarea,{label:"Note / prochaine action",...form.getInputProps("note")}),/*#__PURE__*/(0,jsx_runtime.jsx)(dates_esm_index_mjs_.DateInput,{label:"Relancer le",placeholder:"Pas de date fix\xe9e",clearable:true,valueFormat:"DD/MM/YYYY",...form.getInputProps("next_action_due_at")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Checkbox,{label:"Reconstruire l'historique (recherche multi-sources)",...form.getInputProps("request_reconstruction",{type:"checkbox"})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:onClose,children:"Annuler"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{type:"submit",loading:create.isPending,children:"Cr\xe9er"})]})]})})})}const BRAND_COLOR={pipedrive:"#017737",gmail:"#EA4335",pennylane:"#4B4BF5",claap:"#6C5CE7",granola:"#F26B3A",slack:"#4A154B",calendar:"#4285F4",imessage:"#0B93F6",whatsapp:"#25D366",linkedin:"#0A66C2",notion:"#111111",lemlist:"#4B4BF5"};function Tile({size,color,children}){return/*#__PURE__*/(0,jsx_runtime.jsxs)("svg",{width:size,height:size,viewBox:"0 0 24 24",role:"img","aria-hidden":"true",style:{display:"block",flex:"none"},children:[/*#__PURE__*/(0,jsx_runtime.jsx)("rect",{x:"0",y:"0",width:"24",height:"24",rx:"5",fill:color}),children]})}function LetterGlyph({letter}){return/*#__PURE__*/(0,jsx_runtime.jsx)("text",{x:"12",y:"12",textAnchor:"middle",dominantBaseline:"central",fontFamily:"system-ui, sans-serif",fontSize:"13",fontWeight:"700",fill:"#fff",children:letter})}function bubbleGlyph(){return/*#__PURE__*/(0,jsx_runtime.jsx)("path",{d:"M12 5.5c-3.9 0-7 2.4-7 5.4 0 1.6.9 3.1 2.3 4.1-.1 1-.6 1.9-1 2.5 1.1-.2 2.2-.6 3-1.2.8.2 1.6.3 2.7.3 3.9 0 7-2.4 7-5.4s-3.1-5.7-7-5.7z",fill:"#fff"})}function glyphFor(source){if("gmail"===source)return/*#__PURE__*/(0,jsx_runtime.jsxs)("g",{stroke:"#fff",strokeWidth:"1.6",fill:"none",strokeLinejoin:"round",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("rect",{x:"5",y:"8",width:"14",height:"9",rx:"1"}),/*#__PURE__*/(0,jsx_runtime.jsx)("path",{d:"M5.5 8.5 12 13l6.5-4.5"})]});if("calendar"===source)return/*#__PURE__*/(0,jsx_runtime.jsxs)("g",{stroke:"#fff",strokeWidth:"1.6",fill:"none",strokeLinecap:"round",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("rect",{x:"5",y:"6.5",width:"14",height:"12.5",rx:"1.5"}),/*#__PURE__*/(0,jsx_runtime.jsx)("path",{d:"M5 10.5h14"}),/*#__PURE__*/(0,jsx_runtime.jsx)("path",{d:"M9 4.5v3.5M15 4.5v3.5"})]});if("slack"===source)return/*#__PURE__*/(0,jsx_runtime.jsx)("g",{stroke:"#fff",strokeWidth:"1.7",strokeLinecap:"round",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{d:"M9.7 6 8.5 18M15.5 6l-1.2 12M6 9.7h12M5.5 14.3h12"})});if("whatsapp"===source||"imessage"===source)return bubbleGlyph();if("claap"===source)return/*#__PURE__*/(0,jsx_runtime.jsxs)("g",{fill:"none",stroke:"#fff",strokeWidth:"1.6",strokeLinejoin:"round",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("circle",{cx:"12",cy:"12",r:"7"}),/*#__PURE__*/(0,jsx_runtime.jsx)("path",{d:"M10.5 9.2 15 12l-4.5 2.8z",fill:"#fff",stroke:"none"})]});if("granola"===source)return/*#__PURE__*/(0,jsx_runtime.jsxs)("g",{fill:"none",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("rect",{x:"6.5",y:"5",width:"11",height:"14",rx:"1.5",strokeWidth:"1.6"}),/*#__PURE__*/(0,jsx_runtime.jsx)("path",{d:"M9 9h6M9 12h6M9 15h4"})]});if("pipedrive"===source)return/*#__PURE__*/(0,jsx_runtime.jsx)("path",{d:"M6 7h12l-4.5 5.2V18l-3-1.5v-4.3z",fill:"#fff"});if("lemlist"===source)return/*#__PURE__*/(0,jsx_runtime.jsx)("path",{d:"M5 12 19 6l-6 13-2.4-5.4z",fill:"#fff"});if("linkedin"===source)return/*#__PURE__*/(0,jsx_runtime.jsx)(LetterGlyph,{letter:"in"});if("notion"===source)return/*#__PURE__*/(0,jsx_runtime.jsx)(LetterGlyph,{letter:"N"});if("pennylane"===source)return/*#__PURE__*/(0,jsx_runtime.jsx)(LetterGlyph,{letter:"P"});return null}function SourceIcon({source,size=16}){const color=BRAND_COLOR[source];const glyph=glyphFor(source);if(color&&glyph)return/*#__PURE__*/(0,jsx_runtime.jsx)(Tile,{size:size,color:color,children:glyph});const initial=source.length>0?source.charAt(0).toUpperCase():"?";return/*#__PURE__*/(0,jsx_runtime.jsxs)("svg",{width:size,height:size,viewBox:"0 0 24 24",role:"img","aria-hidden":"true",style:{display:"block",flex:"none"},children:[/*#__PURE__*/(0,jsx_runtime.jsx)("circle",{cx:"12",cy:"12",r:"12",fill:"#868e96"}),/*#__PURE__*/(0,jsx_runtime.jsx)(LetterGlyph,{letter:initial})]})}const sales_app_eurFormatter=new Intl.NumberFormat("fr-FR",{style:"currency",currency:"EUR"});function sourceLabel(source){if(0===source.length)return source;return source.charAt(0).toUpperCase()+source.slice(1)}function SalesApp(){const[status,setStatus]=(0,index_js_.useState)("active");const leads=(0,leadsQuery.m)(status);const rescan=useSalesRescan();const syncState=useSalesSyncState();const scanSummary=useSalesScanSummary();const[selectedId,setSelectedId]=(0,index_js_.useState)(null);const[temperatureFilter,setTemperatureFilter]=(0,index_js_.useState)(null);const[search,setSearch]=(0,index_js_.useState)("");const[newLeadOpened,newLead]=(0,esm_index_mjs_.useDisclosure)(false);return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{fluid:true,my:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",mb:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,children:"Leads"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{placeholder:"Rechercher (nom, entreprise)",value:search,onChange:e=>setSearch(e.currentTarget.value),w:260}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{placeholder:"Toutes temp\xe9ratures",clearable:true,data:sales_temperature.o.map(t=>({value:t,label:`${sales_temperature.P[t].emoji} ${sales_temperature.P[t].label}`})),value:temperatureFilter,onChange:v=>setTemperatureFilter(v)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{onClick:newLead.open,children:"+ Nouveau lead"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{loading:rescan.isPending,onClick:()=>rescan.mutate(),variant:"light",children:"Re-scanner"})]})]}),syncState.data&&syncState.data.sources.length>0||scanSummary.data&&scanSummary.data.total_runs>0?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",mb:"md",children:[syncState.data?syncState.data.sources.map(s=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{variant:"light",color:"gray",leftSection:/*#__PURE__*/(0,jsx_runtime.jsx)(SourceIcon,{source:s.source,size:14}),children:`${sourceLabel(s.source)} \xb7 ${formatRelativeParis(s.last_sync_at)}`},s.source)):null,scanSummary.data&&scanSummary.data.total_runs>0?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{variant:"light",color:"blue",children:`Scans agent ce mois : ${scanSummary.data.month_runs} \xb7 ~${Math.round(scanSummary.data.month_tokens/1e3)} k tokens \u{2248} ${sales_app_eurFormatter.format(scanSummary.data.month_cost_eur)}`}):null]}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SegmentedControl,{value:status,onChange:setStatus,mb:"md",data:[{label:"Actifs",value:"active"},{label:"Gagn\xe9s",value:"won"},{label:"Perdus",value:"lost"}]}),leads.isLoading?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Loader,{}):null,leads.data?/*#__PURE__*/(0,jsx_runtime.jsx)(LeadsTable,{leads:leads.data.leads,temperatureFilter:temperatureFilter,search:search,onRowClick:setSelectedId}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(NewLeadModal,{opened:newLeadOpened,onClose:newLead.close}),/*#__PURE__*/(0,jsx_runtime.jsx)(LeadDetailDrawer,{leadId:selectedId,onClose:()=>setSelectedId(null)})]})}function Sales(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(providers.C,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(SalesApp,{})})})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["9047"],{3897:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{O:()=>BrandLogo});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(207);var _src_components_logoDev_ts__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(243);function BrandLogo({domain,alt,size=24}){return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Image,{src:(0,_src_components_logoDev_ts__WEBPACK_IMPORTED_MODULE_2__.j)(domain),alt:alt,title:alt,w:size,h:size,fit:"contain",radius:"sm",style:{aspectRatio:1}})}},3437:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{D:()=>CompanyLogo});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(207);const BASE_URL="https://s3.dualstack.eu-west-3.amazonaws.com/media.airporting/companies";function CompanyLogo({slug,updatedAt,size=20,...rest}){const base=`${BASE_URL}/${slug}.png`;const url=updatedAt?`${base}?v=${new Date(updatedAt).getTime()}`:base;return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Image,{src:url,fallbackSrc:`${BASE_URL}/undefined.png`,alt:slug??"",w:size,h:size,fit:"contain",radius:"sm",style:{aspectRatio:1},...rest})}},1354:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{m:()=>PageHeader});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(207);var _tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(9632);var react__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(9735);function formatRelative(now,then){const seconds=Math.max(0,Math.floor((now-then)/1e3));if(seconds<5)return"\xe0 l’instant";if(seconds<60)return`il y a ${seconds}s`;const minutes=Math.floor(seconds/60);if(minutes<60)return`il y a ${minutes} min`;const hours=Math.floor(minutes/60);return`il y a ${hours} h`}function PageHeader({title,leading,badge,updatedAt,isFetching,isError,onRefresh,actions}){const[now,setNow]=(0,react__WEBPACK_IMPORTED_MODULE_3__.useState)(()=>Date.now());(0,react__WEBPACK_IMPORTED_MODULE_3__.useEffect)(()=>{if(!updatedAt)return;const id=window.setInterval(()=>setNow(Date.now()),1e3);return()=>window.clearInterval(id)},[updatedAt]);const relative=updatedAt?formatRelative(now,updatedAt):null;const color=isError?"orange":isFetching?"teal":"dimmed";return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{justify:"space-between",align:"center",mih:48,mb:"md",children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{gap:"sm",align:"center",children:[leading,/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Title,{order:2,children:title}),badge]}),/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{gap:"sm",align:"center",children:[relative&&/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Text,{size:"xs",c:color,fw:isFetching?600:400,"data-testid":"page-header-freshness",children:isError?"\xe9chec maj":isFetching?"maj…":relative}),onRefresh&&/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Tooltip,{label:"Rafra\xeechir",children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.ActionIcon,{variant:"default",size:"md",onClick:onRefresh,loading:isFetching,"aria-label":"Refresh",children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__.IconRefresh,{size:16})})}),actions]})]})}},243:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{j:()=>logoDevUrl});const LOGO_DEV_TOKEN="pk_BVN4OQv0Qs-bnqjdIgTppg";function logoDevUrl(domain){return`https://img.logo.dev/${domain}?token=${LOGO_DEV_TOKEN}`}},8401:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Scrapers});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(9735);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);var esm_index_mjs_=__webpack_require__(3863);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useScrapersQuery(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useQuery)({queryKey:["tech","scrapers"],queryFn:async()=>await api.getScrapers().then(x=>x.data),refetchInterval:3e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}var PageHeader=__webpack_require__(1354);var BrandLogo=__webpack_require__(3897);function IconBraintree({color="currentColor",size=20,...props}){return/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:size,height:size,viewBox:"0 0 24 24",fill:color,xmlns:"http://www.w3.org/2000/svg",...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{d:"M8.276 20.482h4.717c3.641 0 5.462-1.2 5.462-3.517 0-2.275-1.945-3.517-5.752-3.517H8.276Zm0-16.965v6.538h4.138c3.103 0 4.717-1.159 4.717-3.269 0-2.152-1.655-3.269-4.759-3.269zM1.696 24v-3.518H4.47V3.517H1.697V0h11.089c5.09 0 8.193 2.358 8.193 6.455 0 2.69-1.572 4.345-3.558 5.131 2.855.787 4.882 2.814 4.882 5.586 0 4.386-3.393 6.828-8.938 6.828H1.697"})})}function ScraperCard({scraper,onClick}){const color=scraper.isTooOld?"red":"green";return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{withBorder:true,radius:"md",p:"md",style:{cursor:"pointer"},onClick:onClick,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",mb:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[null!==scraper.logoDomain?/*#__PURE__*/(0,jsx_runtime.jsx)(BrandLogo.O,{domain:scraper.logoDomain,alt:scraper.label}):/*#__PURE__*/(0,jsx_runtime.jsx)(IconBraintree,{size:24}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,children:scraper.label})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Badge,{color:color,variant:"light",children:[scraper.connectors.length," connecteur",1!==scraper.connectors.length?"s":""]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fz:"sm",c:color,children:null!==scraper.lastDataDate?`Derni\xe8re donn\xe9e : ${scraper.lastDataDate}`:"Aucune donn\xe9e"})]})}function PennylaneCard({pennylane}){const color=pennylane.isTooOld?"red":"green";return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{withBorder:true,radius:"md",p:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",mb:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(BrandLogo.O,{domain:"pennylane.com",alt:"Pennylane"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,children:"Pennylane"})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:color,variant:"light",children:"Cookie"})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fz:"sm",c:color,children:["\uD83C\uDF6A Dernier refresh \xe0 ",pennylane.lastTime]})]})}function SpendeskCard({spendesk}){const color=spendesk.isTooOld?"red":"green";return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{withBorder:true,radius:"md",p:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",mb:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(BrandLogo.O,{domain:"spendesk.com",alt:"Spendesk"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,children:"Spendesk"})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Badge,{color:color,variant:"light",children:[spendesk.okCount,"/",spendesk.total," OK"]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fz:"sm",c:color,children:null!==spendesk.lastTime?`\u{1F36A} Dernier refresh \xe0 ${spendesk.lastTime}`:"Aucun connecteur actif"})]})}function SobankCard({sobank,onClick}){const color=sobank.isTooOld?"red":"green";return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{withBorder:true,radius:"md",p:"md",style:{cursor:"pointer"},onClick:onClick,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",mb:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(BrandLogo.O,{domain:"sogescot.com",alt:"Sobank"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,children:"Sobank"})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Badge,{color:color,variant:"light",children:[sobank.count," compte",1!==sobank.count?"s":""]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fz:"sm",c:color,children:null!==sobank.lastDataDate?`Dernier solde : ${sobank.lastDataDate}`:"Aucune donn\xe9e"})]})}var CompanyLogo=__webpack_require__(3437);function ConnectorClient({connector}){if(null===connector.client)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fz:"sm",children:"—"});return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",wrap:"nowrap",children:[null!==connector.companySlug?/*#__PURE__*/(0,jsx_runtime.jsx)(CompanyLogo.D,{slug:connector.companySlug,updatedAt:connector.companyLogoUpdatedAt,size:20}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fz:"sm",children:connector.client})]})}function ConnectorStatus({connector}){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:connector.isTooOld?"red":"green",variant:"light",children:connector.isTooOld?"Retard":"OK"})}function MobileConnectorList({connectors}){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Stack,{gap:"sm",children:connectors.map(connector=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{withBorder:true,radius:"md",p:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",align:"flex-start",wrap:"nowrap",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:4,miw:0,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,truncate:true,children:connector.connector}),/*#__PURE__*/(0,jsx_runtime.jsx)(ConnectorClient,{connector:connector})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(ConnectorStatus,{connector:connector})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",mt:"sm",children:"Derni\xe8re donn\xe9e"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fz:"sm",c:connector.isTooOld?"red":void 0,fw:500,children:connector.lastDataDate??"—"})]},connector.connector))})}function DesktopConnectorTable({connectors}){return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{striped:true,highlightOnHover:true,withTableBorder:true,withColumnBorders:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Connecteur"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Client"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Derni\xe8re donn\xe9e"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Statut"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:connectors.map(connector=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:connector.connector}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(ConnectorClient,{connector:connector})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:connector.lastDataDate??"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:connector.isTooOld?"red":"green",fw:600,fz:"sm",children:connector.isTooOld?"Retard":"OK"})})]},connector.connector))})]})}function ScraperDetailDrawer({scraper,onClose}){const isMobile=(0,esm_index_mjs_.useMediaQuery)("(max-width: 48em)",false);return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Drawer,{opened:null!==scraper,onClose:onClose,title:null!==scraper?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:3,children:scraper.label}):null,position:isMobile?"bottom":"right",size:isMobile?"calc(100dvh - 88px)":"md",styles:isMobile?{content:{borderTopLeftRadius:12,borderTopRightRadius:12}}:void 0,children:null!==scraper?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"md",children:[null!==scraper.logoDomain?/*#__PURE__*/(0,jsx_runtime.jsx)(BrandLogo.O,{domain:scraper.logoDomain,alt:scraper.label,size:40}):/*#__PURE__*/(0,jsx_runtime.jsx)(IconBraintree,{size:40}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fz:"sm",c:"dimmed",children:[scraper.connectors.length," connecteur",1!==scraper.connectors.length?"s":""]}),isMobile?/*#__PURE__*/(0,jsx_runtime.jsx)(MobileConnectorList,{connectors:scraper.connectors}):/*#__PURE__*/(0,jsx_runtime.jsx)(DesktopConnectorTable,{connectors:scraper.connectors})]}):null})}var tabler_icons_react_mjs_=__webpack_require__(9632);function formatBalance(account){const formatted=new Intl.NumberFormat("fr-FR",{minimumFractionDigits:2,maximumFractionDigits:2}).format(account.balance);return null!==account.currency?`${formatted} ${account.currency}`:formatted}function AccountStatus({account}){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:account.isTooOld?"red":"green",variant:"light",children:account.isTooOld?"Retard":"OK"})}function MobileAccountList({accounts}){if(0===accounts.length)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"Aucun compte"});return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Stack,{gap:"sm",children:accounts.map(account=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{withBorder:true,radius:"md",p:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",align:"flex-start",wrap:"nowrap",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:2,miw:0,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,truncate:true,children:account.account}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",c:"dimmed",truncate:true,children:account.bank})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(AccountStatus,{account:account})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",mt:"sm",gap:"md",wrap:"nowrap",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:0,miw:0,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:"IBAN"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",truncate:true,children:account.iban??"—"})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:0,align:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:"Solde"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",fw:700,children:formatBalance(account)})]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",mt:"sm",children:"Date solde"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",c:account.isTooOld?"red":void 0,fw:500,children:account.balanceDate})]},account.iban??`${account.account}|${account.bank}`))})}function DesktopAccountTable({accounts}){return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{striped:true,highlightOnHover:true,withTableBorder:true,withColumnBorders:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Compte"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Banque"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"IBAN"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Solde"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Date solde"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Statut"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:accounts.map(account=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:account.account}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:account.bank}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:account.iban??"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:formatBalance(account)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:account.balanceDate}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:account.isTooOld?"red":"green",fw:600,fz:"sm",children:account.isTooOld?"Retard":"OK"})})]},account.iban??`${account.account}|${account.bank}`))})]})}function SobankDrawer({sobank,opened,onClose}){const[search,setSearch]=(0,index_js_.useState)("");const isMobile=(0,esm_index_mjs_.useMediaQuery)("(max-width: 48em)",false);const filtered=(0,index_js_.useMemo)(()=>{const needle=search.trim().toLowerCase();if(""===needle)return sobank.accounts;return sobank.accounts.filter(a=>{const haystack=`${a.account} ${a.bank} ${a.iban??""}`.toLowerCase();return haystack.includes(needle)})},[sobank.accounts,search]);return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Drawer,{opened:opened,onClose:onClose,title:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:3,children:"Sobank"}),position:isMobile?"bottom":"right",size:isMobile?"calc(100dvh - 88px)":"lg",styles:isMobile?{content:{borderTopLeftRadius:12,borderTopRightRadius:12}}:void 0,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(BrandLogo.O,{domain:"sogescot.com",alt:"Sobank",size:40}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fz:"sm",c:"dimmed",children:[sobank.count," compte",1!==sobank.count?"s":""]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{leftSection:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconSearch,{size:16}),placeholder:"Rechercher (compte, banque, IBAN)…",value:search,onChange:e=>setSearch(e.currentTarget.value)}),isMobile?/*#__PURE__*/(0,jsx_runtime.jsx)(MobileAccountList,{accounts:filtered}):/*#__PURE__*/(0,jsx_runtime.jsx)(DesktopAccountTable,{accounts:filtered})]})})}function getScrapersStats(data){const connectorCount=data.scrapers.reduce((total,scraper)=>total+scraper.connectors.length,0);const alertCount=data.scrapers.filter(scraper=>scraper.isTooOld).length+(data.sobank.isTooOld?1:0)+(data.pennylane.isTooOld?1:0)+(data.spendesk.isTooOld?1:0);const cookieOk=(data.pennylane.isTooOld?0:1)+data.spendesk.okCount;const cookieTotal=1+data.spendesk.total;const sobankOk=data.sobank.accounts.filter(account=>!account.isTooOld).length;return[{label:"Connecteurs",value:connectorCount.toString(),tone:"dimmed"},{label:"\xc0 v\xe9rifier",value:alertCount.toString(),tone:alertCount>0?"red":"green"},{label:"Cookies OK",value:`${cookieOk}/${cookieTotal}`,tone:cookieOk===cookieTotal?"green":"orange"},{label:"Sobank OK",value:`${sobankOk}/${data.sobank.count}`,tone:sobankOk===data.sobank.count?"green":"orange"}]}function ScrapersSummary({data}){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{wrap:"nowrap",gap:"sm",style:{overflowX:"auto",overscrollBehaviorX:"contain",paddingBottom:2},children:getScrapersStats(data).map(stat=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{withBorder:true,radius:"md",p:"sm",miw:128,style:{flex:"1 0 128px"},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",tt:"uppercase",fw:600,children:stat.label}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xl",fw:800,c:stat.tone,children:stat.value})]},stat.label))})}function SectionTitle({children}){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",tt:"uppercase",fw:600,mb:"sm",children:children})}function ScrapersApp(){const query=useScrapersQuery();const isMobile=(0,esm_index_mjs_.useMediaQuery)("(max-width: 48em)",false);const[selected,setSelected]=(0,index_js_.useState)(null);const[sobankOpened,setSobankOpened]=(0,index_js_.useState)(false);return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{fluid:true,my:isMobile?0:"md",px:isMobile?12:void 0,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:isMobile?"md":"lg",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(PageHeader.m,{title:"Scrapers",updatedAt:query.dataUpdatedAt,isFetching:query.isFetching,isError:query.isError,onRefresh:()=>query.refetch()}),query.data?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:isMobile?"lg":"xl",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(ScrapersSummary,{data:query.data}),/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SectionTitle,{children:"Connecteurs"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.SimpleGrid,{cols:{base:1,sm:2,md:3},spacing:isMobile?"sm":"md",children:[query.data.scrapers.map(scraper=>/*#__PURE__*/(0,jsx_runtime.jsx)(ScraperCard,{scraper:scraper,onClick:()=>setSelected(scraper)},scraper.key)),/*#__PURE__*/(0,jsx_runtime.jsx)(SobankCard,{sobank:query.data.sobank,onClick:()=>setSobankOpened(true)})]})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SectionTitle,{children:"Monitoring Cookie"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.SimpleGrid,{cols:{base:1,sm:2,md:3},spacing:isMobile?"sm":"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(PennylaneCard,{pennylane:query.data.pennylane}),/*#__PURE__*/(0,jsx_runtime.jsx)(SpendeskCard,{spendesk:query.data.spendesk})]})]})]}):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"Chargement…"})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(ScraperDetailDrawer,{scraper:selected,onClose:()=>setSelected(null)}),query.data?/*#__PURE__*/(0,jsx_runtime.jsx)(SobankDrawer,{sobank:query.data.sobank,opened:sobankOpened,onClose:()=>setSobankOpened(false)}):null]})}function Scrapers(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(providers.C,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(ScrapersApp,{})})})}}}]);
@@ -0,0 +1,10 @@
1
+ /*! For license information please see __federation_expose_spendesk.js.LICENSE.txt */
2
+ "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["8408"],{631:function(__unused_webpack_module,exports){/**
3
+ * @license React
4
+ * react-jsx-runtime.production.js
5
+ *
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
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},5893:function(module,__unused_webpack_exports,__webpack_require__){module.exports=__webpack_require__(631)},7936:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{$:()=>AppConfigProvider,M:()=>useAppConfig});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(9735);const AppConfigCtx=(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(null);const AppConfigProvider=AppConfigCtx.Provider;function useAppConfig(){const config=(0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(AppConfigCtx);if(!config)throw new Error("Called `useAppConfig` outside a `<AppConfigProvider />`");return config}},7034:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{C:()=>Providers});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _airporting_app_front__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(1380);var _mantine_core__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(207);var _mantine_modals__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(4142);var _mantine_notifications__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(1455);var _tanstack_react_query__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(6197);var radash__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(9877);var _hooks_useAppConfig__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(7936);const theme=(0,_mantine_core__WEBPACK_IMPORTED_MODULE_2__.createTheme)((0,radash__WEBPACK_IMPORTED_MODULE_6__.assign)(_airporting_app_front__WEBPACK_IMPORTED_MODULE_1__.theme,{components:{}}));const cssVarResolver=x=>(0,radash__WEBPACK_IMPORTED_MODULE_6__.assign)(_airporting_app_front__WEBPACK_IMPORTED_MODULE_1__.cssVarResolver(x),{dark:{},light:{},variables:{}});function Providers(props){const{children,config,mantine,tanstack}=props;return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_hooks_useAppConfig__WEBPACK_IMPORTED_MODULE_7__.$,{value:config,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tanstack_react_query__WEBPACK_IMPORTED_MODULE_5__.QueryClientProvider,{client:tanstack?.queryClient??new _tanstack_react_query__WEBPACK_IMPORTED_MODULE_5__.QueryClient,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_2__.MantineProvider,{theme:theme,cssVariablesResolver:cssVarResolver,defaultColorScheme:mantine?.defaultColorScheme,forceColorScheme:mantine?.forceColorScheme,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_modals__WEBPACK_IMPORTED_MODULE_3__.ModalsProvider,{children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_notifications__WEBPACK_IMPORTED_MODULE_4__.Notifications,{}),children]})})})})}},2039:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Spendesk});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(9735);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);function SpendeskApp(){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Container,{my:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,my:"md",children:"Spendesk - soon"})})}function Spendesk(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(providers.C,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(SpendeskApp,{})})})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["509"],{466:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{U:()=>useGsheetStock});var _tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(6197);var _useApi__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(4148);function useGsheetStock(filters={}){const api=(0,_useApi__WEBPACK_IMPORTED_MODULE_1__.h)();const query={...filters.period&&{period:filters.period}};return(0,_tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__.useQuery)({queryKey:["tech","gsheet","stock",filters],queryFn:async()=>(await api.gsheet.getStockV1({query})).data,refetchInterval:3e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true})}},3897:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{O:()=>BrandLogo});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(207);var _src_components_logoDev_ts__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(243);function BrandLogo({domain,alt,size=24}){return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Image,{src:(0,_src_components_logoDev_ts__WEBPACK_IMPORTED_MODULE_2__.j)(domain),alt:alt,title:alt,w:size,h:size,fit:"contain",radius:"sm",style:{aspectRatio:1}})}},243:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{j:()=>logoDevUrl});const LOGO_DEV_TOKEN="pk_BVN4OQv0Qs-bnqjdIgTppg";function logoDevUrl(domain){return`https://img.logo.dev/${domain}?token=${LOGO_DEV_TOKEN}`}},5080:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Spreadsheet});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(9735);var providers=__webpack_require__(7034);var QueueDashboard=__webpack_require__(5351);var index_mjs_=__webpack_require__(207);var tabler_icons_react_mjs_=__webpack_require__(9632);var gsheetStockQuery=__webpack_require__(466);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useGsheetTasks(filters){const api=(0,useApi.h)();const service=filters.service?.toLowerCase()==="all"?void 0:filters.service;const owner=filters.owner?.toLowerCase()==="all"?void 0:filters.owner;const query={...service&&{service},...owner&&{owner},...filters.state&&{state:filters.state},...filters.period&&{period:filters.period},...void 0!==filters.take&&{take:String(filters.take)},...void 0!==filters.skip&&{skip:String(filters.skip)}};return(0,modern_index_js_.useQuery)({queryKey:["tech","gsheet","tasks",filters],queryFn:async()=>(await api.gsheet.listTasksV1(query)).data,refetchOnWindowFocus:false})}function useInvalidate(){const queryClient=(0,modern_index_js_.useQueryClient)();return()=>queryClient.invalidateQueries({queryKey:["tech","gsheet"]})}function useUnstickTask(){const api=(0,useApi.h)();const invalidate=useInvalidate();return(0,modern_index_js_.useMutation)({mutationFn:async id=>(await api.gsheet.unstickV1({id:String(id)})).data,onSuccess:invalidate})}function useDiscardTask(){const api=(0,useApi.h)();const invalidate=useInvalidate();return(0,modern_index_js_.useMutation)({mutationFn:async id=>(await api.gsheet.discardV1({id:String(id)})).data,onSuccess:invalidate})}function useSetTaskOwner(){const api=(0,useApi.h)();const invalidate=useInvalidate();return(0,modern_index_js_.useMutation)({mutationFn:async({id,owner})=>(await api.gsheet.setOwnerV1({id:String(id)},{owner})).data,onSuccess:invalidate})}function useDeleteRedisLock(){const api=(0,useApi.h)();const invalidate=useInvalidate();return(0,modern_index_js_.useMutation)({mutationFn:async id=>(await api.gsheet.deleteRedisLockV1({id:String(id)})).data,onSuccess:invalidate})}var jobLogsContext=__webpack_require__(4302);var esm_index_mjs_=__webpack_require__(1455);function grafanaUrl(traceId){return`https://airporting.grafana.net/d/beegyy3vsp8n4c/recipes?var-trace=${encodeURIComponent(traceId)}&orgId=1&from=now-7d&to=now&timezone=browser&showCategory=Logs&refresh=7d`}function notify(title,message,color){esm_index_mjs_.notifications.show({title,message,color})}function RowActions({taskId,currentOwner,service,spreadsheet,worksheet,githubJob,traceId,onShowLogs}){const[confirm,setConfirm]=(0,index_js_.useState)(null);const[ownerModalOpen,setOwnerModalOpen]=(0,index_js_.useState)(false);const[ownerInput,setOwnerInput]=(0,index_js_.useState)(currentOwner??"");const unstick=useUnstickTask();const discard=useDiscardTask();const setOwner=useSetTaskOwner();const deleteLock=useDeleteRedisLock();const runUnstick=()=>unstick.mutate(taskId,{onSuccess:()=>notify("Unstuck",`Task #${taskId} reset`,"green"),onError:e=>notify("Failed",e?.message??"Unstick failed","red")});const runDiscard=()=>{setConfirm(null);discard.mutate(taskId,{onSuccess:()=>notify("Discarded",`Task #${taskId} marked done`,"green"),onError:e=>notify("Failed",e?.message??"Discard failed","red")})};const runSetOwner=()=>{setOwnerModalOpen(false);setOwner.mutate({id:taskId,owner:ownerInput},{onSuccess:()=>notify("Owner updated",`Task #${taskId} \u{2192} ${ownerInput}`,"green"),onError:e=>notify("Failed",e?.message??"Set owner failed","red")})};const runDeleteLock=()=>{setConfirm(null);deleteLock.mutate(taskId,{onSuccess:data=>notify("Redis lock",data.existed?`Deleted ${data.key}`:`No lock found (${data.key})`,"green"),onError:e=>notify("Failed",e?.message??"Redis delete failed","red")})};const getWorksheetUrl=()=>{if(!spreadsheet)return null;return"excel"===service?`https://airporting.sharepoint.com/:x:/g/personal/airporting_com/ER${spreadsheet}`:`https://docs.google.com/spreadsheets/d/${spreadsheet}/edit`};const worksheetUrl=getWorksheetUrl();return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[worksheetUrl&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:"Ouvrir le tableur",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{component:"a",href:worksheetUrl,target:"_blank",rel:"noopener noreferrer",variant:"subtle","aria-label":"Ouvrir le tableur",children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconFileSpreadsheet,{size:16})})}),githubJob&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:"GitHub Actions logs",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{variant:"subtle",onClick:()=>onShowLogs(githubJob),"aria-label":"GitHub Actions logs",children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconTerminal,{size:16})})}),traceId&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:"Grafana Loki logs",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{component:"a",href:grafanaUrl(traceId),target:"_blank",rel:"noopener noreferrer",variant:"subtle","aria-label":"Grafana Loki logs",children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconFileText,{size:16})})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Menu,{position:"bottom-end",withArrow:true,shadow:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Target,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{variant:"default","aria-label":"Actions",children:"⋮"})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Menu.Dropdown,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Item,{onClick:runUnstick,children:"Unstick"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Item,{onClick:()=>{setOwnerInput(currentOwner??"");setOwnerModalOpen(true)},children:"Set owner…"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Item,{onClick:()=>setConfirm("redis"),children:"Delete Redis lock"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Divider,{}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Item,{color:"red",onClick:()=>setConfirm("discard"),children:"Discard"})]})]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:"discard"===confirm,onClose:()=>setConfirm(null),title:"Discard task",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",style:{wordBreak:"break-all"},children:["Mark task #",taskId," (",spreadsheet,worksheet?`:${worksheet}`:"",") as ",/*#__PURE__*/(0,jsx_runtime.jsx)("b",{children:"done"})," with step=",/*#__PURE__*/(0,jsx_runtime.jsx)("code",{children:"discarded"}),". The task will not be processed by the runner."]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:()=>setConfirm(null),children:"Cancel"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{color:"red",onClick:runDiscard,loading:discard.isPending,children:"Discard"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:"redis"===confirm,onClose:()=>setConfirm(null),title:"Delete Redis lock",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",style:{wordBreak:"break-all"},children:["Delete the Redis running-lock for ",spreadsheet,worksheet?`:${worksheet}`:"",". The runner will be able to pick up the worksheet again on the next iteration."]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:()=>setConfirm(null),children:"Cancel"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{color:"orange",onClick:runDeleteLock,loading:deleteLock.isPending,children:"Delete lock"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:ownerModalOpen,onClose:()=>setOwnerModalOpen(false),title:`Set owner for task #${taskId}`,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Owner email",value:ownerInput,onChange:e=>setOwnerInput(e.currentTarget.value),placeholder:"bob@airporting.com"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:()=>setOwnerModalOpen(false),children:"Cancel"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{onClick:runSetOwner,loading:setOwner.isPending,disabled:!ownerInput.trim(),children:"Save"})]})]})})]})}var BrandLogo=__webpack_require__(3897);const SERVICE_DOMAIN={gsheet:"google.com",excel:"microsoft.com"};const SERVICE_LABEL={gsheet:"Google Sheets",excel:"Excel"};function ServiceLogo({service,size=18}){const domain=SERVICE_DOMAIN[service];const label=SERVICE_LABEL[service]??service;if(!domain)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",variant:"light",color:"gray",title:service,children:service.slice(0,2).toUpperCase()});return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:6,wrap:"nowrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(BrandLogo.O,{domain:domain,alt:label,size:size}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:label})]})}const STATE_COLORS={pending:"gray",running:"blue",stuck:"orange",errored:"red",done:"green"};const STATE_LABELS={pending:"En attente",running:"En cours",stuck:"Bloqu\xe9e",errored:"En erreur",done:"Termin\xe9e"};function fmt(d){return d?new Date(d).toLocaleString("fr-FR"):"—"}function GsheetRowActions({item}){const openLogs=(0,jobLogsContext.j)();return/*#__PURE__*/(0,jsx_runtime.jsx)(RowActions,{taskId:item.id,currentOwner:item.owner,service:item.service,spreadsheet:item.spreadsheet,worksheet:item.worksheet,githubJob:item.github_job,traceId:item.trace_id,onShowLogs:openLogs})}async function runBulk(ids,fn){const results=await Promise.allSettled(ids.map(fn));const ok=results.filter(r=>"fulfilled"===r.status).length;return{ok,failed:results.length-ok}}function useGsheetConfig(){const unstick=useUnstickTask();const discard=useDiscardTask();const setOwner=useSetTaskOwner();const deleteLock=useDeleteRedisLock();return(0,index_js_.useMemo)(()=>({title:"Worksheets : \xe9tat des lieux des copies sur tableurs",source:{useStock:({period})=>(0,gsheetStockQuery.U)({period:period??void 0}),useTasks:({service,owner,state,period},pagination)=>useGsheetTasks({service:service??void 0,owner:owner??void 0,state,period:period??void 0,skip:pagination.skip,take:pagination.take})},initialFilters:{service:null,owner:null,state:"pending",period:"today",search:""},kpis:[{key:"pending",label:"En attente",value:s=>s?.pending??0,filter:{state:"pending"}},{key:"running",label:"En cours",value:s=>s?.running??0,filter:{state:"running"}},{key:"stuck",label:"Bloqu\xe9es",value:s=>s?.stuck??0,tone:s=>(s?.stuck??0)>0?"warn":"neutral",filter:{state:"stuck"}},{key:"errored",label:"En erreur",value:s=>s?.errored??0,tone:s=>(s?.errored??0)>0?"bad":"neutral",filter:{state:"errored"}},{key:"done_today",label:"Termin\xe9es",value:s=>s?.done_today??0,filter:{state:"done"}},{key:"oldest",label:"Plus ancienne en attente",value:s=>s?.oldest?`${s.oldest.ageHours}h`:"—"}],filters:[{kind:"select",key:"service",label:"Service",options:()=>["all","gsheet","excel"],width:240},{kind:"select",key:"owner",label:"Propri\xe9taire",options:s=>["all",...(s?.byOwner??[]).map(e=>e.key)],width:240},{kind:"select",key:"state",label:"\xc9tat",options:()=>["pending","running","stuck","errored","done","all"],clearable:false,width:140},{kind:"select",key:"period",label:"P\xe9riode",options:()=>[{value:"today",label:"Aujourd'hui"},{value:"7d",label:"7 jours"},{value:"30d",label:"30 jours"},{value:"all",label:"Tout"}],clearable:false,width:130},{kind:"search",key:"search",label:"Recherche",placeholder:"id, owner, spreadsheet…",width:240}],columns:[{key:"service",label:"Service",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(ServiceLogo,{service:t.service})},{key:"spreadsheet",label:"ID tableur",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",style:{wordBreak:"break-all"},children:t.spreadsheet})},{key:"worksheet",label:"Onglet",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",style:{wordBreak:"break-all"},children:t.worksheet??"—"})},{key:"company_display_name",label:"Entreprise",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:t.company_display_name??"—"})},{key:"trigger_source",label:"Type",render:t=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",wrap:"nowrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ThemeIcon,{variant:"transparent",color:"gray",size:"sm",children:"manual"===t.trigger_source?/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconUser,{size:16,stroke:1.5}):/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconRobot,{size:16,stroke:1.5})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:"manual"===t.trigger_source?t.owner??"Manuel":"Planifi\xe9"})]})},{key:"state",label:"\xc9tat",render:t=>{const badge=/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:STATE_COLORS[t.state],children:STATE_LABELS[t.state]});return t.error?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:t.error,multiline:true,maw:420,withArrow:true,children:badge}):badge}},{key:"created",label:"Cr\xe9\xe9e",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:fmt(t.created)})},{key:"started",label:"D\xe9marr\xe9e",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:fmt(t.started)})},{key:"finished_at",label:"Termin\xe9e",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:fmt(t.finished_at)})}],rowActions:[{key:"actions",render:item=>/*#__PURE__*/(0,jsx_runtime.jsx)(GsheetRowActions,{item:item})}],bulkActions:[{key:"unstick",label:"D\xe9bloquer",run:ids=>runBulk(ids,id=>unstick.mutateAsync(id))},{key:"set-owner",label:"Changer le propri\xe9taire…",prompt:{label:"E-mail du propri\xe9taire",placeholder:"bob@airporting.com"},run:(ids,owner)=>{if(!owner)return Promise.resolve({ok:0,failed:ids.length});return runBulk(ids,id=>setOwner.mutateAsync({id,owner}))}},{key:"delete-lock",label:"Supprimer le verrou Redis",color:"orange",confirm:{title:"Supprimer le verrou Redis pour {count} t\xe2che(s)",body:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:"fm-task-node-<id>",disabled:true,children:/*#__PURE__*/(0,jsx_runtime.jsxs)("span",{children:["Suppression du verrou Redis pour ","{count}"," t\xe2che(s)."]})})},run:ids=>runBulk(ids,id=>deleteLock.mutateAsync(id))},{key:"discard",label:"Abandonner",color:"red",confirm:{title:"Abandonner {count} t\xe2che(s)",body:"Les t\xe2ches seront marqu\xe9es comme termin\xe9es/abandonn\xe9es."},run:ids=>runBulk(ids,id=>discard.mutateAsync(id))}],getRowId:t=>t.id,searchMatches:(t,q)=>String(t.id).includes(q)||(t.owner??"").toLowerCase().includes(q)||(t.spreadsheet??"").toLowerCase().includes(q)||(t.worksheet??"").toLowerCase().includes(q)||(t.service??"").toLowerCase().includes(q)||(t.company_display_name??"").toLowerCase().includes(q)}),[unstick,discard,setOwner,deleteLock])}function SpreadsheetApp(){const config=useGsheetConfig();return/*#__PURE__*/(0,jsx_runtime.jsx)(QueueDashboard.r,{config:config})}function Spreadsheet(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(providers.C,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(SpreadsheetApp,{})})})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["2124"],{5068:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{U:()=>IconGithub});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);function IconGithub({color="currentColor",size=20,marker,...props}){return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("svg",{width:size,height:size,viewBox:"0 0 24 24",fill:color,xmlns:"http://www.w3.org/2000/svg",...props,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path",{d:"M12 0.297C5.373 0.297 0 5.67 0 12.297c0 5.292 3.438 9.787 8.205 11.387.6.111.82-.261.82-.58 0-.287-.011-1.244-.016-2.255-3.338.726-4.042-1.609-4.042-1.609-.546-1.389-1.333-1.759-1.333-1.759-1.089-.745.083-.73.083-.73 1.205.085 1.84 1.236 1.84 1.236 1.07 1.834 2.807 1.304 3.492.997.107-.775.419-1.305.762-1.605-2.665-.304-5.466-1.332-5.466-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.536-1.524.116-3.176 0 0 1.008-.322 3.301 1.23a11.51 11.51 0 0 1 3.004-.404 c1.019.005 2.047.138 3.004.404 2.291-1.552 3.297-1.23 3.297-1.23.655 1.652.243 2.873.119 3.176.77.84 1.235 1.91 1.235 3.221 0 4.61-2.805 5.624-5.476 5.921.43.372.823 1.104.823 2.223 0 1.606-.015 2.896-.015 3.293 0 .321.216.697.825.578C20.565 22.08 24 17.585 24 12.297 24 5.67 18.627.297 12 .297z"})})}},9098:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Synchro});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(9735);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);var esm_index_mjs_=__webpack_require__(9038);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useSynchroStatsQuery(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useQuery)({queryKey:["tech","synchro","stats"],queryFn:async()=>await api.synchro.getRunStatsV1().then(x=>x.data),refetchInterval:6e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}var tabler_icons_react_mjs_=__webpack_require__(9632);var notifications_esm_index_mjs_=__webpack_require__(1455);function useResetStatsMutation(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useMutation)({mutationFn:async values=>await api.synchro.resetOwnerStatsV1(values).then(x=>x.data),onSuccess:()=>{notifications_esm_index_mjs_.notifications.show({title:"Cible remise \xe0 niveau",message:"C'est reparti comme en 40"})},onError:(error,variables,context)=>{console.error(error,variables,context);notifications_esm_index_mjs_.notifications.show({color:"red",title:"Erreur !",message:"Nous rencontrons un soucis technique. Veuillez r\xe9essayer plus tard."})}});return query}function useSynchroTasks({gas,dateRange,companies,jobs}){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","synchro","tasks","list",{gas,dateRange,companies,jobs}],queryFn:async()=>await api.synchro.getTasksV1({...gas&&{gas},...dateRange&&{dateStart:dateRange[0]??void 0,dateEnd:dateRange[1]??void 0,companyIds:companies?.map(x=>+x),jobNames:jobs}}).then(x=>x.data),refetchInterval:6e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true})}var IconGithub=__webpack_require__(5068);var dist_index_js_=__webpack_require__(1380);var date_fns_index_js_=__webpack_require__(5348);function useCompaniesQuery(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useQuery)({queryKey:["tech","companies"],queryFn:async()=>await api.getCompanies().then(x=>x.data)});return query}function useJobsDefaultQuery(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useQuery)({queryKey:["tech","jobs","defaults"],queryFn:async()=>await api.synchro.getJobsDefaultsV1().then(x=>x.data)});return query}function SynchroApp(){const[gasOnly,setGasOnly]=(0,index_js_.useState)("nodejs");const[dateRange,setDateRange]=(0,index_js_.useState)([(0,date_fns_index_js_.formatISO)((0,date_fns_index_js_.startOfDay)(new Date)),(0,date_fns_index_js_.formatISO)((0,date_fns_index_js_.endOfDay)(new Date))]);const[companies,setCompanies]=(0,index_js_.useState)([]);const[jobs,setJobs]=(0,index_js_.useState)([]);const companiesResult=useCompaniesQuery();const companiesList=(companiesResult.data?.list??[]).map(company=>({value:company.id.toString(),label:company.display_name??company.id.toString()}));const jobsDefaultResult=useJobsDefaultQuery();const jobsDefaultList=(jobsDefaultResult.data?.list??[]).map(jobDefault=>jobDefault.task);const statsResult=useSynchroStatsQuery();const stats=statsResult.data;const tasksListResult=useSynchroTasks({gas:gasOnly,dateRange,companies,jobs});const tasksList=tasksListResult.data;const resetFn=useResetStatsMutation();function resolveStatus(element){if(!element.ready)return"en attente";if(element.need_gas)return element.gas_started?"GAS en cours":"GAS en attente";return element.finished?"fini":"en cours"}const rows=(tasksList?.tasks??[]).map(element=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:element.id}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Td,{children:[element.need_gas?/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconOld,{title:"papi GAS"}):/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconBolt,{title:"fougueux nodejs"})," ",element.job_name,/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}),/*#__PURE__*/(0,jsx_runtime.jsx)("small",{children:element.job_name_fr})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:(0,date_fns_index_js_.format)(element.created,"dd/MM/yyyy HH:mm:ss")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:element.startedAt?(0,date_fns_index_js_.format)(element.startedAt,"dd/MM/yyyy HH:mm:ss"):""}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:resolveStatus(element)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:element.owner}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:element.main_company?.display_name}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Th,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:element.github_job,title:"Github runner",children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})}),/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:`https://airporting.grafana.net/d/beegyy3vsp8n4c/recipes?var-trace=${element.recipe_uuid}-${element.id}&orgId=1&from=now-7d&to=now&timezone=browser&showCategory=Logs&refresh=7d`,children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconFileText,{title:"Logs",size:20})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"subtle",color:"gray",size:"compact-sm",onClick:()=>console.log(`coucou ${element.id}`),children:"log"}),element.finished?/*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment,{}):/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",onClick:async()=>{console.log("stop",element.id)},children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconHandStop,{title:"Stop",size:20})})]})]},element.id));return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{my:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,my:"md",children:"Synchro"}),/*#__PURE__*/(0,jsx_runtime.jsx)("ul",{children:stats&&Object.entries(stats.currentJobsCounters).map(([key,value])=>/*#__PURE__*/(0,jsx_runtime.jsxs)("li",{children:[key,": ",value.db," db, ",value.redis," redis",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"subtle",color:value.db!=value.redis?"red":"green",onClick:async()=>{await resetFn.mutateAsync({owner:key,value:(value.db??0).toString()});await statsResult.refetch()},children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconRefreshDot,{size:20})})]},key))}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Stack,{gap:"sm",my:"md",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{align:"flex-end",wrap:"wrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{label:"GAS et/ou nodejs",data:[{value:"all",label:"Toutes"},{value:"nodejs",label:"nodejs seulement"},{value:"gas",label:"GAS seulement"}],value:gasOnly,onChange:v=>setGasOnly(v??"nodejs"),w:140}),/*#__PURE__*/(0,jsx_runtime.jsx)(esm_index_mjs_.DatePickerInput,{leftSection:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconCalendar,{size:18}),type:"range",label:"Date de cr\xe9ation",placeholder:"S\xe9lectionner une plage",value:dateRange,onChange:setDateRange,clearable:true,allowSingleDateInRange:true,w:260}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.MultiSelect,{label:"Client",placeholder:"S\xe9lectionner un ou plusieurs clients",data:companiesList,onChange:setCompanies,searchable:true,clearable:true}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.MultiSelect,{label:"Fonction",placeholder:"S\xe9lectionner une ou plusieurs fonctions",data:jobsDefaultList,onChange:setJobs,searchable:true,clearable:true})]})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{stickyHeader:true,striped:true,highlightOnHover:true,withTableBorder:true,withColumnBorders:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"ID"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Fonction"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Demand\xe9e"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"D\xe9mar\xe9e"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Statut"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Owner"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Client"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Liens"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:rows})]})]})}function Synchro(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(providers.C,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(SynchroApp,{})})})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["4927"],{1354:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{m:()=>PageHeader});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(207);var _tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(9632);var react__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(9735);function formatRelative(now,then){const seconds=Math.max(0,Math.floor((now-then)/1e3));if(seconds<5)return"\xe0 l’instant";if(seconds<60)return`il y a ${seconds}s`;const minutes=Math.floor(seconds/60);if(minutes<60)return`il y a ${minutes} min`;const hours=Math.floor(minutes/60);return`il y a ${hours} h`}function PageHeader({title,leading,badge,updatedAt,isFetching,isError,onRefresh,actions}){const[now,setNow]=(0,react__WEBPACK_IMPORTED_MODULE_3__.useState)(()=>Date.now());(0,react__WEBPACK_IMPORTED_MODULE_3__.useEffect)(()=>{if(!updatedAt)return;const id=window.setInterval(()=>setNow(Date.now()),1e3);return()=>window.clearInterval(id)},[updatedAt]);const relative=updatedAt?formatRelative(now,updatedAt):null;const color=isError?"orange":isFetching?"teal":"dimmed";return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{justify:"space-between",align:"center",mih:48,mb:"md",children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{gap:"sm",align:"center",children:[leading,/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Title,{order:2,children:title}),badge]}),/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{gap:"sm",align:"center",children:[relative&&/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Text,{size:"xs",c:color,fw:isFetching?600:400,"data-testid":"page-header-freshness",children:isError?"\xe9chec maj":isFetching?"maj…":relative}),onRefresh&&/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Tooltip,{label:"Rafra\xeechir",children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.ActionIcon,{variant:"default",size:"md",onClick:onRefresh,loading:isFetching,"aria-label":"Refresh",children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__.IconRefresh,{size:16})})}),actions]})]})}},6592:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Usage});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(9735);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);var tabler_icons_react_mjs_=__webpack_require__(9632);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);const STALE_MS=6e4;const DAY_REFETCH_MS=3e5;function chargeKey(view,trigger,at){return["tech","usage","charge",view,trigger,at??null]}function chargeParams(view,trigger,at){return{view,..."all"===trigger?{}:{trigger},...at?{at}:{}}}function useUsageCharge(view,trigger,at){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:chargeKey(view,trigger,at),queryFn:async()=>{const response=await api.http.request({path:"/v1/usage/charge",method:"GET",query:chargeParams(view,trigger,at),format:"json"});return response.data},placeholderData:modern_index_js_.keepPreviousData,staleTime:STALE_MS,refetchInterval:"day"===view?DAY_REFETCH_MS:false,refetchOnWindowFocus:false})}function useUsageChargePrefetch(){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(view,trigger,at)=>{queryClient.prefetchQuery({queryKey:chargeKey(view,trigger,at),queryFn:async()=>{const response=await api.http.request({path:"/v1/usage/charge",method:"GET",query:chargeParams(view,trigger,at),format:"json"});return response.data},staleTime:STALE_MS})}}var PageHeader=__webpack_require__(1354);const OPTIONS=[{value:"all",label:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:"Tout"})},{value:"auto",label:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:6,wrap:"nowrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconRobot,{size:16,stroke:1.5}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:"Robots"})]})},{value:"human",label:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:6,wrap:"nowrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconUser,{size:16,stroke:1.5}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:"Humains"})]})}];const HINT="Robots = planificateur et crons d\xe9di\xe9s. Humains = run lanc\xe9 depuis l’app ; c’est un plancher, les runs pass\xe9s par l’ancienne API sont compt\xe9s comme planifi\xe9s.";function TriggerFilter(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:HINT,multiline:true,w:320,withArrow:true,position:"bottom",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SegmentedControl,{value:props.value,onChange:next=>props.onChange(next),data:OPTIONS,size:"xs"})})}const SERVICE_LEVEL_MINUTES=15;const USAGE_COLORS={productive:"#3987e5",errored:"#d03b3b",noop:"#fab219"};const AXIS_INK="#898781";function formatHours(hours){if(hours>=100)return`${Math.round(hours)} h`;return`${hours.toFixed(1).replace(".",",")} h`}function formatCount(value){return new Intl.NumberFormat("fr-FR").format(value)}function formatCompactCount(value){return new Intl.NumberFormat("fr-FR",{notation:"compact",maximumFractionDigits:1}).format(value)}function servicePercent(under,measured){if(measured<=0)return 0;return Math.round(under/measured*100)}function wastePercent(kpis){if(kpis.computeHours<=0)return 0;return Math.round((kpis.erroredHours+kpis.noopHours)/kpis.computeHours*100)}function UsageKpiRow(props){const{kpis}=props;const tiles=[{key:"compute",label:"Compute",value:formatHours(kpis.computeHours),hint:`${formatCount(kpis.tasks)} t\xe2ches, dont ${formatCount(kpis.worksheetTasks)} worksheets`},{key:"companies",label:"Entreprises actives",value:formatCount(kpis.companies),hint:`${formatCount(kpis.distinctJobs)} connecteurs distincts`},{key:"waste",label:"Compute non productif",value:`${formatHours(kpis.erroredHours+kpis.noopHours)} \xb7 ${wastePercent(kpis)} %`,hint:`${formatHours(kpis.erroredHours)} en erreur (${formatCount(kpis.erroredTasks)} t\xe2ches), ${formatHours(kpis.noopHours)} sans r\xe9sultat`,accent:USAGE_COLORS.errored},{key:"concurrency",label:"Concurrence max",value:null===kpis.maxConcurrent?"—":`${formatCount(kpis.maxConcurrent)} t\xe2ches`,hint:null===kpis.maxConcurrent?"Non calcul\xe9 sur 12 mois : trop co\xfbteux \xe0 recouvrir":"Pic de t\xe2ches simultan\xe9es, dur\xe9e born\xe9e \xe0 110 min"},{key:"service",label:`D\xe9marrage < ${SERVICE_LEVEL_MINUTES} min`,value:kpis.waitMeasured>0?`${servicePercent(kpis.waitLe15,kpis.waitMeasured)} %`:"—",hint:kpis.waitMeasured>0?`${servicePercent(kpis.waitLe30,kpis.waitMeasured)} % sous 30 min, ${servicePercent(kpis.waitLe60,kpis.waitMeasured)} % sous 1 h, ${servicePercent(kpis.waitLe240,kpis.waitMeasured)} % sous 4 h \u{2014} sur ${formatCount(kpis.waitMeasured)} t\xe2ches r\xe9ellement ex\xe9cut\xe9es`:"Aucune t\xe2che ex\xe9cut\xe9e sur la p\xe9riode"},{key:"abandoned",label:"Synchros perdues",value:formatCount(kpis.abandonedTasks),hint:0===kpis.abandonedTasks?"Aucune synchro abandonn\xe9e sur la p\xe9riode":`Abandonn\xe9es apr\xe8s 3 d\xe9blocages, sans jamais avoir tourn\xe9. ${formatHours(kpis.abandonedFabricatedHours)} de dur\xe9e fictive exclues du compute.`,accent:kpis.abandonedTasks>0?USAGE_COLORS.errored:void 0},{key:"rows",label:"Lignes synchronis\xe9es",value:formatCompactCount(kpis.rowsSynced),hint:"Somme des compteurs renvoy\xe9s par les jobs — proxy de tendance"}];return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:{base:1,sm:2,md:3,lg:4,xl:7},spacing:"md",children:tiles.map(tile=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:6,align:"center",mb:6,children:[tile.accent?/*#__PURE__*/(0,jsx_runtime.jsx)("span",{"aria-hidden":true,style:{width:8,height:8,borderRadius:2,background:tile.accent,display:"inline-block"}}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",tt:"uppercase",fw:700,children:tile.label})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:tile.hint,withArrow:true,multiline:true,w:260,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fz:26,fw:600,lh:1.1,children:tile.value})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",mt:6,lineClamp:2,children:tile.hint})]},tile.key))})}var esm_index_mjs_=__webpack_require__(7183);const PARIS_TZ="Europe/Paris";const minuteFormatter=new Intl.DateTimeFormat("fr-FR",{timeZone:PARIS_TZ,hour:"2-digit",minute:"2-digit"});const weekDayFormatter=new Intl.DateTimeFormat("fr-FR",{timeZone:PARIS_TZ,weekday:"short",day:"numeric"});const monthFormatter=new Intl.DateTimeFormat("fr-FR",{timeZone:PARIS_TZ,month:"short",year:"2-digit"});const fullDayFormatter=new Intl.DateTimeFormat("fr-FR",{timeZone:PARIS_TZ,weekday:"long",day:"numeric",month:"long"});function bucketDate(t){if(7===t.length)return new Date(`${t}-15T12:00:00Z`);return new Date(`${t}T12:00:00Z`)}function formatMinuteTick(iso){return minuteFormatter.format(new Date(iso))}function formatBucketTick(t,view){if("year"===view)return monthFormatter.format(bucketDate(t));if("month"===view)return String(bucketDate(t).getUTCDate());return weekDayFormatter.format(bucketDate(t))}function formatBucketLong(t,view){if("year"===view)return monthFormatter.format(bucketDate(t));return fullDayFormatter.format(bucketDate(t))}function formatWindow(from,to,view){if("day"===view)return fullDayFormatter.format(new Date(from));if("year"===view){const start=monthFormatter.format(new Date(from));const end=monthFormatter.format(new Date(new Date(to).getTime()-1));return`${start} \u{2192} ${end}`}const start=fullDayFormatter.format(new Date(from));const end=fullDayFormatter.format(new Date(new Date(to).getTime()-1));return`${start} \u{2192} ${end}`}function ConcurrencyTooltip({payload}){const point=payload?.[0]?.payload;if(!point)return null;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{px:"md",py:"sm",withBorder:true,shadow:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:600,mb:4,children:formatMinuteTick(point.t)}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",children:[point.concurrent," t\xe2che",point.concurrent>1?"s":""," en cours"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",children:[point.started," d\xe9marrage",point.started>1?"s":""]}),point.errored>0?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:USAGE_COLORS.errored,children:[point.errored," en erreur"]}):null]})}function ConcurrencyChart(props){const{data}=props;if(0===data.length)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",size:"sm",children:"Aucune t\xe2che sur la journ\xe9e."});return/*#__PURE__*/(0,jsx_runtime.jsx)(esm_index_mjs_.AreaChart,{h:260,data:data,dataKey:"t",withDots:false,strokeWidth:2,curveType:"linear",gridAxis:"y",tickLine:"none",series:[{name:"concurrent",label:"T\xe2ches en cours",color:USAGE_COLORS.productive}],xAxisProps:{tickFormatter:formatMinuteTick,minTickGap:48,stroke:AXIS_INK},yAxisProps:{allowDecimals:false,stroke:AXIS_INK,width:32},tooltipProps:{content:ConcurrencyTooltip},tooltipAnimationDuration:0})}const SURFACE="var(--mantine-color-body)";const SERIES=[{name:"productiveHours",label:"Productif",color:USAGE_COLORS.productive},{name:"noopHours",label:"Sans r\xe9sultat",color:USAGE_COLORS.noop},{name:"erroredHours",label:"En erreur",color:USAGE_COLORS.errored}];const TOP_SERIES=SERIES[SERIES.length-1].name;function makeTooltip(view){return function({payload}){const bucket=payload?.[0]?.payload;if(!bucket)return null;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{px:"md",py:"sm",withBorder:true,shadow:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:600,mb:4,children:formatBucketLong(bucket.t,view)}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",children:[formatHours(bucket.computeHours)," de compute"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:USAGE_COLORS.errored,children:["dont ",formatHours(bucket.erroredHours)," en erreur (",formatCount(bucket.erroredTasks)," t\xe2ches)"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",children:["dont ",formatHours(bucket.noopHours)," sans r\xe9sultat"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",mt:4,children:[formatCount(bucket.tasks)," t\xe2ches \xb7"," ",formatCount(bucket.worksheetTasks)," worksheets"]}),bucket.waitMaxMinutes?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",children:["attente max ",Math.round(bucket.waitMaxMinutes)," min"]}):null]})}}function ChargeStack(props){const{buckets,view}=props;if(0===buckets.length)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",size:"sm",children:"Aucune t\xe2che sur la p\xe9riode."});return/*#__PURE__*/(0,jsx_runtime.jsx)(esm_index_mjs_.BarChart,{h:300,data:buckets,dataKey:"t",type:"stacked",withLegend:true,legendProps:{verticalAlign:"top",height:32},gridAxis:"y",tickLine:"none",unit:" h",series:SERIES,barProps:item=>({stroke:SURFACE,strokeWidth:1.5,strokeOpacity:1,radius:item.name===TOP_SERIES?[4,4,0,0]:0}),xAxisProps:{tickFormatter:t=>formatBucketTick(t,view),stroke:AXIS_INK,minTickGap:4},yAxisProps:{stroke:AXIS_INK,width:44},tooltipProps:{content:makeTooltip(view)},tooltipAnimationDuration:0})}function AbandonedChart_makeTooltip(view){return function({payload}){const bucket=payload?.[0]?.payload;if(!bucket)return null;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{px:"md",py:"sm",withBorder:true,shadow:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:600,mb:4,children:formatBucketLong(bucket.t,view)}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:USAGE_COLORS.errored,children:[formatCount(bucket.abandonedTasks)," synchro",bucket.abandonedTasks>1?"s":""," perdue",bucket.abandonedTasks>1?"s":""]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",children:["sur ",formatCount(bucket.tasks)," t\xe2ches cr\xe9\xe9es"]})]})}}function AbandonedChart(props){const{buckets,view}=props;return/*#__PURE__*/(0,jsx_runtime.jsx)(esm_index_mjs_.BarChart,{h:180,data:buckets,dataKey:"t",gridAxis:"y",tickLine:"none",series:[{name:"abandonedTasks",label:"Synchros perdues",color:USAGE_COLORS.errored}],barProps:{radius:[4,4,0,0]},xAxisProps:{tickFormatter:t=>formatBucketTick(t,view),stroke:AXIS_INK,minTickGap:4},yAxisProps:{stroke:AXIS_INK,width:44,allowDecimals:false},tooltipProps:{content:AbandonedChart_makeTooltip(view)},tooltipAnimationDuration:0})}function toPoints(buckets){return buckets.map(b=>({t:b.t,service:servicePercent(b.waitLe15,b.waitMeasured),under30:servicePercent(b.waitLe30,b.waitMeasured),under60:servicePercent(b.waitLe60,b.waitMeasured),measured:b.waitMeasured}))}function ServiceLevelChart_makeTooltip(view){return function({payload}){const point=payload?.[0]?.payload;if(!point)return null;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{px:"md",py:"sm",withBorder:true,shadow:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:600,mb:4,children:formatBucketLong(point.t,view)}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:USAGE_COLORS.productive,children:[point.service," % d\xe9marr\xe9es sous ",SERVICE_LEVEL_MINUTES," min"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",children:[point.under30," % sous 30 min \xb7 ",point.under60," % sous 1 h"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",mt:4,children:["sur ",formatCount(point.measured)," t\xe2ches ex\xe9cut\xe9es"]})]})}}function ServiceLevelChart(props){const{buckets,view}=props;return/*#__PURE__*/(0,jsx_runtime.jsx)(esm_index_mjs_.LineChart,{h:180,data:toPoints(buckets),dataKey:"t",gridAxis:"y",tickLine:"none",unit:" %",withDots:buckets.length<=40,series:[{name:"service",label:`D\xe9marr\xe9es sous ${SERVICE_LEVEL_MINUTES} min`,color:USAGE_COLORS.productive}],xAxisProps:{tickFormatter:t=>formatBucketTick(t,view),stroke:AXIS_INK,minTickGap:4},yAxisProps:{stroke:AXIS_INK,width:48,domain:[0,100],allowDecimals:false},tooltipProps:{content:ServiceLevelChart_makeTooltip(view)},tooltipAnimationDuration:0})}const TRACTION_SERIES=[{name:"companies",label:"Entreprises actives",color:"#3987e5"},{name:"distinctJobs",label:"Connecteurs distincts",color:"#d95926"}];function TractionTooltip({payload}){const bucket=payload?.[0]?.payload;if(!bucket)return null;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{px:"md",py:"sm",withBorder:true,shadow:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:600,mb:4,children:formatBucketLong(bucket.t,"year")}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",children:[bucket.companies??0," entreprises actives"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",children:[bucket.distinctJobs??0," connecteurs distincts"]})]})}function TractionChart(props){const{buckets}=props;if(0===buckets.length)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",size:"sm",children:"Pas d'historique sur la p\xe9riode."});return/*#__PURE__*/(0,jsx_runtime.jsx)(esm_index_mjs_.LineChart,{h:240,data:buckets,dataKey:"t",withLegend:true,legendProps:{verticalAlign:"top",height:32},strokeWidth:2,dotProps:{r:4},activeDotProps:{r:6},gridAxis:"y",tickLine:"none",series:TRACTION_SERIES,xAxisProps:{tickFormatter:t=>formatBucketTick(t,"year"),stroke:AXIS_INK},yAxisProps:{allowDecimals:false,stroke:AXIS_INK,width:40},tooltipProps:{content:TractionTooltip},tooltipAnimationDuration:0})}function ShareBar(props){const{hours,erroredHours,max}=props;if(max<=0)return null;const total=hours/max*100;const errored=Math.min(erroredHours,hours)/max*100;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Progress.Root,{size:"md",w:140,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Progress.Section,{value:Math.max(total-errored,0),color:USAGE_COLORS.productive}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Progress.Section,{value:errored,color:USAGE_COLORS.errored})]})}function LostCell(props){if(0===props.count)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",c:"dimmed",children:"—"});return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",style:{fontVariantNumeric:"tabular-nums",color:USAGE_COLORS.errored,fontWeight:600},children:formatCount(props.count)})}function TopCompaniesTable(props){const{rows,totalHours}=props;const max=rows.length>0?rows[0].computeHours:0;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{highlightOnHover:true,striped:false,verticalSpacing:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:32,children:"#"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Entreprise"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:150,children:"Part"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:90,ta:"right",children:"Compute"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:70,ta:"right",children:"% total"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:100,ta:"right",children:"T\xe2ches"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:80,ta:"right",children:"Perdues"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:rows.map((row,index)=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{c:"dimmed",children:index+1}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Td,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",fw:500,children:row.displayName??row.slug??`#${row.companyId}`}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:row.slug??`company ${row.companyId}`})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{withArrow:true,label:`${formatHours(row.erroredHours)} en erreur sur ${formatHours(row.computeHours)}`,children:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{children:/*#__PURE__*/(0,jsx_runtime.jsx)(ShareBar,{hours:row.computeHours,erroredHours:row.erroredHours,max:max})})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",style:{fontVariantNumeric:"tabular-nums"},children:formatHours(row.computeHours)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",c:"dimmed",style:{fontVariantNumeric:"tabular-nums"},children:totalHours>0?`${Math.round(row.computeHours/totalHours*100)} %`:"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",c:"dimmed",style:{fontVariantNumeric:"tabular-nums"},children:formatCount(row.tasks)}),/*#__PURE__*/(0,jsx_runtime.jsx)(LostCell,{count:row.abandonedTasks})]},row.companyId))})]})}function TopJobsTable(props){const{rows,totalHours}=props;const max=rows.length>0?rows[0].computeHours:0;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{highlightOnHover:true,verticalSpacing:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:32,children:"#"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Connecteur"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:150,children:"Part"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:90,ta:"right",children:"Compute"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:70,ta:"right",children:"% total"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:110,ta:"right",children:"h / entreprise"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:80,ta:"right",children:"Perdues"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:rows.map((row,index)=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{c:"dimmed",children:index+1}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Td,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",fw:500,children:row.jobName}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"xs",c:"dimmed",children:[formatCount(row.companies)," entreprise",row.companies>1?"s":""," \xb7 ",formatCount(row.tasks)," t\xe2ches"]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{withArrow:true,label:`${formatHours(row.erroredHours)} en erreur sur ${formatHours(row.computeHours)}`,children:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{children:/*#__PURE__*/(0,jsx_runtime.jsx)(ShareBar,{hours:row.computeHours,erroredHours:row.erroredHours,max:max})})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",style:{fontVariantNumeric:"tabular-nums"},children:formatHours(row.computeHours)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",c:"dimmed",style:{fontVariantNumeric:"tabular-nums"},children:totalHours>0?`${Math.round(row.computeHours/totalHours*100)} %`:"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",c:"dimmed",style:{fontVariantNumeric:"tabular-nums"},children:row.companies>0?formatHours(row.computeHours/row.companies):"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(LostCell,{count:row.abandonedTasks})]},row.jobName))})]})}var date_fns_index_js_=__webpack_require__(5348);function shiftPeriod(view,at,direction){if("week"===view)return(0,date_fns_index_js_.addWeeks)(at,direction);if("month"===view)return(0,date_fns_index_js_.addMonths)(at,direction);if("year"===view)return(0,date_fns_index_js_.addMonths)(at,12*direction);return(0,date_fns_index_js_.addDays)(at,direction)}function canGoForward(view,at,now){return shiftPeriod(view,at,1).getTime()<=now.getTime()}const RESET_LABEL={day:"Aujourd'hui",week:"Cette semaine",month:"Ce mois",year:"12 derniers mois"};const VIEW_OPTIONS=[{value:"day",label:"Jour"},{value:"week",label:"Semaine"},{value:"month",label:"Mois"},{value:"year",label:"12 mois"}];const CHART_TITLES={day:"T\xe2ches simultan\xe9es, minute par minute",week:"Compute par jour (lundi → dimanche)",month:"Compute par jour du mois",year:"Compute par mois"};function SectionTitle(props){return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",align:"baseline",mb:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",fw:600,children:props.children}),props.hint?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:props.hint}):null]})}function UsageApp(){const[view,setView]=(0,index_js_.useState)("day");const[at,setAt]=(0,index_js_.useState)(null);const[trigger,setTrigger]=(0,index_js_.useState)("all");const charge=useUsageCharge(view,trigger,at?at.toISOString():void 0);const prefetch=useUsageChargePrefetch();const data=charge.data;const reference=at??new Date;const forwardDisabled=null===at||!canGoForward(view,reference,new Date);(0,index_js_.useEffect)(()=>{if(charge.isFetching)return;const previous=shiftPeriod(view,at??new Date,-1);prefetch(view,trigger,previous.toISOString())},[view,at,trigger,charge.isFetching]);const goto=direction=>{const next=shiftPeriod(view,reference,direction);setAt(next)};const changeView=next=>{setView(next);setAt(null)};return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Container,{fluid:true,my:"md",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"lg",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(PageHeader.m,{title:"Usage & charge",updatedAt:charge.dataUpdatedAt,isFetching:charge.isFetching,isError:charge.isError,onRefresh:()=>charge.refetch()}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",align:"center",wrap:"wrap",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"md",align:"center",wrap:"wrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SegmentedControl,{value:view,onChange:value=>changeView(value),data:VIEW_OPTIONS}),/*#__PURE__*/(0,jsx_runtime.jsx)(TriggerFilter,{value:trigger,onChange:setTrigger})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",align:"center",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{variant:"default",size:"lg","aria-label":"P\xe9riode pr\xe9c\xe9dente",onClick:()=>goto(-1),children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconChevronLeft,{size:18})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",c:"dimmed",ta:"center",miw:280,children:data?`${formatWindow(data.from,data.to,data.view)} \xb7 heure de Paris`:"…"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{variant:"default",size:"lg","aria-label":"P\xe9riode suivante",disabled:forwardDisabled,onClick:()=>goto(1),children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconChevronRight,{size:18})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"subtle",color:"gray",size:"xs",disabled:null===at,onClick:()=>setAt(null),children:RESET_LABEL[view]})]})]}),charge.isError?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Alert,{color:"red",title:"Impossible de charger la charge",children:String(charge.error)}):null,data?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"lg",style:{opacity:charge.isPlaceholderData?.45:1,transition:"opacity 150ms ease",pointerEvents:charge.isPlaceholderData?"none":void 0},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(UsageKpiRow,{kpis:data.kpis}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SectionTitle,{hint:"day"===view?"dur\xe9e born\xe9e \xe0 110 min — au-del\xe0, une t\xe2che est perdue, pas en cours":"heures de compute, d\xe9compos\xe9es par issue",children:CHART_TITLES[view]}),"day"===view?/*#__PURE__*/(0,jsx_runtime.jsx)(ConcurrencyChart,{data:data.concurrency}):/*#__PURE__*/(0,jsx_runtime.jsx)(ChargeStack,{buckets:data.buckets,view:data.view})]}),"year"===view?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SectionTitle,{hint:"deux d\xe9nombrements, un seul axe",children:"Traction — entreprises actives et connecteurs"}),/*#__PURE__*/(0,jsx_runtime.jsx)(TractionChart,{buckets:data.buckets})]}):null,"day"===view&&data.buckets.length>0?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SectionTitle,{hint:"d\xe9composition du compute de la journ\xe9e",children:"Compute de la journ\xe9e"}),/*#__PURE__*/(0,jsx_runtime.jsx)(ChargeStack,{buckets:data.buckets,view:data.view})]}):null,data.buckets.length>1?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SectionTitle,{hint:"cr\xe9ation → ex\xe9cution, sur les t\xe2ches r\xe9ellement ex\xe9cut\xe9es",children:"D\xe9lai de mise en route"}),/*#__PURE__*/(0,jsx_runtime.jsx)(ServiceLevelChart,{buckets:data.buckets,view:data.view})]}):null,data.kpis.abandonedTasks>0?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SectionTitle,{hint:"abandonn\xe9es apr\xe8s 3 d\xe9blocages, sans jamais avoir tourn\xe9",children:"Synchros perdues"}),/*#__PURE__*/(0,jsx_runtime.jsx)(AbandonedChart,{buckets:data.buckets,view:data.view})]}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Divider,{}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Grid,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:12,lg:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",h:"100%",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SectionTitle,{hint:"classement, pas de moyenne",children:"Top consommateurs"}),/*#__PURE__*/(0,jsx_runtime.jsx)(TopCompaniesTable,{rows:data.topCompanies,totalHours:data.kpis.computeHours})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:12,lg:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",h:"100%",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SectionTitle,{hint:"brique de tarification du free",children:"Co\xfbt par connecteur"}),/*#__PURE__*/(0,jsx_runtime.jsx)(TopJobsTable,{rows:data.topJobs,totalHours:data.kpis.computeHours})]})})]})]}):/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:96}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:300})]})]})})}function Usage(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(providers.C,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(UsageApp,{})})})}}}]);
@@ -0,0 +1,10 @@
1
+ /*! For license information please see __federation_expose_wise.js.LICENSE.txt */
2
+ "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["5948"],{631:function(__unused_webpack_module,exports){/**
3
+ * @license React
4
+ * react-jsx-runtime.production.js
5
+ *
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
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},5893:function(module,__unused_webpack_exports,__webpack_require__){module.exports=__webpack_require__(631)},7936:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{$:()=>AppConfigProvider,M:()=>useAppConfig});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(9735);const AppConfigCtx=(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(null);const AppConfigProvider=AppConfigCtx.Provider;function useAppConfig(){const config=(0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(AppConfigCtx);if(!config)throw new Error("Called `useAppConfig` outside a `<AppConfigProvider />`");return config}},7034:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{C:()=>Providers});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _airporting_app_front__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(1380);var _mantine_core__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(207);var _mantine_modals__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(4142);var _mantine_notifications__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(1455);var _tanstack_react_query__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(6197);var radash__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(9877);var _hooks_useAppConfig__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(7936);const theme=(0,_mantine_core__WEBPACK_IMPORTED_MODULE_2__.createTheme)((0,radash__WEBPACK_IMPORTED_MODULE_6__.assign)(_airporting_app_front__WEBPACK_IMPORTED_MODULE_1__.theme,{components:{}}));const cssVarResolver=x=>(0,radash__WEBPACK_IMPORTED_MODULE_6__.assign)(_airporting_app_front__WEBPACK_IMPORTED_MODULE_1__.cssVarResolver(x),{dark:{},light:{},variables:{}});function Providers(props){const{children,config,mantine,tanstack}=props;return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_hooks_useAppConfig__WEBPACK_IMPORTED_MODULE_7__.$,{value:config,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tanstack_react_query__WEBPACK_IMPORTED_MODULE_5__.QueryClientProvider,{client:tanstack?.queryClient??new _tanstack_react_query__WEBPACK_IMPORTED_MODULE_5__.QueryClient,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_2__.MantineProvider,{theme:theme,cssVariablesResolver:cssVarResolver,defaultColorScheme:mantine?.defaultColorScheme,forceColorScheme:mantine?.forceColorScheme,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_modals__WEBPACK_IMPORTED_MODULE_3__.ModalsProvider,{children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_notifications__WEBPACK_IMPORTED_MODULE_4__.Notifications,{}),children]})})})})}},8898:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Wise});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(9735);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);function WiseApp(){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Container,{my:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,my:"md",children:"Wise - soon"})})}function Wise(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(providers.C,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(WiseApp,{})})})}}}]);