@beam3_dev/api_module 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/wb3Api.js +2000 -0
- package/dist/wb3Api.umd.cjs +78 -0
- package/package.json +8 -5
- package/index.html +0 -13
- package/src/index.js +0 -164
- package/src/lib/add/index.js +0 -12
- package/src/lib/api/index.js +0 -9
- package/src/lib/gouv/colors.js +0 -31
- package/src/lib/gouv/gouv_api.js +0 -139
- package/src/lib/plateform/Compass/index.js +0 -51
- package/src/lib/plateform/Swym/3dswym_api.js +0 -141
- package/src/lib/plateform/Swym/communaute/index.js +0 -443
- package/src/lib/plateform/Swym/idea/index.js +0 -333
- package/src/lib/plateform/Swym/media/index.js +0 -0
- package/src/lib/plateform/Swym/post/index.js +0 -0
- package/src/lib/plateform/Swym/question/index.js +0 -0
- package/src/lib/plateform/Swym/user/index.js +0 -87
- package/src/lib/plateform/Swym/wiki/index.js +0 -0
- package/src/lib/plateform/Tag/index.js +0 -384
- package/src/lib/plateform/Usersgroup/index.js +0 -449
- package/src/lib/plateform/main/3dcompass_api.js +0 -78
- package/src/lib/plateform/main/3dexperience_api.js +0 -143
- package/src/lib/plateform/main/3dspace_api.js +0 -1310
- package/src/lib/plateform/main/getActiveServices.js +0 -92
- package/src/lib/plateform/main/getCSRFToken.js +0 -30
- package/src/lib/plateform/main/getCTX.js +0 -46
- package/src/lib/plateform/main/getDataFrom3DSpace.js +0 -47
- package/src/lib/plateform/main/getDownloadDocument.js +0 -40
- package/src/lib/plateform/main/loadDatas.js +0 -189
- package/src/lib/plateform/main/pushDataIn3DSpace.js +0 -61
- package/src/lib/utils/updateEvent.js +0 -27
- package/vite.config.js +0 -23
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
(function(C,O){typeof exports=="object"&&typeof module<"u"?module.exports=O(require("uuid"),require("luxon"),require("@widget-lab/3ddashboard-utils")):typeof define=="function"&&define.amd?define(["uuid","luxon","@widget-lab/3ddashboard-utils"],O):(C=typeof globalThis<"u"?globalThis:C||self,C["@beam3_dev/api_module"]=O(C.uuid,C.luxon,C["@widget-lab/3ddashboard-utils"]))})(this,function(C,O,T){"use strict";function D(){return C.v4()}const I={b3M3Yellow:"#FFB300",b3AboutageBlue:"#42A5F5",b3UsinageGreen:"#689F38",b3PanneauOrange:"#ff8000",b3M350percent:"#fafa6e",b3M380percent:"#aae479",b3M390percent:"#64c987",b3M3100percent:"#23aa8f",b3M3105percent:"#00898a",b3M3110percent:"#176877",b3M3120percent:"#2a4858",b3Aboutage50percent:"#fafa6e",b3Aboutage80percent:"#aae479",b3Aboutage90percent:"#64c987",b3Aboutage100percent:"#23aa8f",b3Aboutage105percent:"#00898a",b3Aboutage110percent:"#176877",b3Aboutage120percent:"#2a4858",b3Warning:"#FF0000",b3Edit1:"#AD1457",b3Edit2:"#F4511E",b3Edit3:"#009688",b3Edit4:"#D50000",b3Edit5:"#039BE5",b3Edit6:"#9E69AF",b3Edit7:"#A79B8E",b3Edit8:"#616161",b3Edit9:"#795548"};async function te(e,t=void 0,s=void 0){const n=parseInt(e);await fetch("https://apicarto.ign.fr/api/codes-postaux/communes/"+n,{method:"GET",headers:{Accept:"application/json"}}).then(i=>i.json()).then(i=>{t&&t(i)}).catch(i=>{s&&s(i),console.error("Erreur : "+i)})}async function ne(e,t=void 0,s=void 0){e=encodeURIComponent(e),await fetch("https://api-adresse.data.gouv.fr/search/?q="+e+"&limit=15",{method:"GET",headers:{Accept:"application/json"}}).then(n=>n.json()).then(n=>{t&&t(n)}).catch(n=>{s&&s(n),console.error("Erreur : "+n)})}async function se(e,t=I){let s=O.DateTime.now().year;const n=e,i=[],c=a=>{for(let o in a)i.push({date:o,comment:a[o]})};for(let a=s;a<=s+1;a++)await fetch("https://calendrier.api.gouv.fr/jours-feries/metropole/"+a+".json",{method:"GET",headers:{Accept:"application/json"}}).then(o=>o.json()).then(o=>{c(o)}).catch(o=>console.error("Erreur : "+o));return(()=>{const a=n.length===0?{events:[]}:n;for(let o of i)a.events.findIndex(l=>l.start===O.DateTime.fromISO(o.date).toISODate()&&l.name==="Férié : "+o.comment)===-1&&a.events.push({name:"Férié : "+o.comment,start:O.DateTime.fromISO(o.date).toISODate(),end:O.DateTime.fromISO(o.date).toISODate(),color:t.b3BusinnessDays,timed:!1});return a})()}async function ae(e,t,s=!0){const n=e.events.findIndex(i=>i.uuid===t.uuid);return n===-1?e.events.push(t):s?e.events[n]=t:e.events.splice(n,1),e.length>0&&e.sort((i,c)=>i.start-c.start),e}function f(e,t){T.requirejs(["DS/WAFData/WAFData"],s=>{s.authenticatedRequest(e,t)})}function ie(e,t,s){T.requirejs(["DS/DataDragAndDrop/DataDragAndDrop"],n=>{n.draggable(e,{data:t,start:s})})}function oe(e,t=void 0){T.requirejs(["DS/TagNavigatorProxy/TagNavigatorProxy"],s=>{let n;n===void 0&&(n=s.createProxy({widgetId:T.widget.id,filteringMode:"WithFilteringServices"}),t!==void 0&&n.addEvent("onFilterSubjectsChange",t)),n.setSubjectsTags(e)})}function re(e,t){T.requirejs(["DS/DataDragAndDrop/DataDragAndDrop"],s=>{s.droppable(e,{drop:t})})}function U(e,t=void 0,s=void 0){T.requirejs(["DS/i3DXCompassServices/i3DXCompassServices"],n=>{(!e||e==="")&&(e=T.widget.getValue("PlatFormInstanceId")),(!e||e==="")&&(e=void 0),n.getPlatformServices({platformId:e,onComplete:t,onFailure:s})}),A(),t&&t(A())}function A(){let e={};return T.requirejs(["DS/PlatformAPI/PlatformAPI"],t=>{const s=t.getTenant(),n=t.getUser(),i=t.getAllApplicationConfigurations(),c=t.getWidgetTenant(),r=t.getApplicationConfiguration("com.3ds.wp.passport.cors");e={tenant:s,user:n,appsConfiguration:i,widgetTenant:c,appConf:r}}),console.log("%cRETOUR API :","color:blue",e),e}function ce(e,t,s){const n={base:`${e.space}`,uri:"/resources/AppsMngt/api/custom/applications",option:`?filter=${e.tenant}`},i=`${n.base}${n.uri}${n.option}`;f(i,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},onComplete(c,r,a){const o=JSON.parse(c),d=o.data.map(l=>{const p=l.attributes.name,u=l.id;return{name:p,id:u}});t&&t(d,o)},onFailure(c,r){const a=c;a.msg=r.errormsg,a.errCode=r.errorcode,s&&s(a)}})}function de(e,t=void 0,s=void 0){let n=`${e.space}/resources/AppsMngt/user?platform=${e.tenant}&limit=-1`;f(n,{onComplete(i,c,r){const a=JSON.parse(i);console.log("_AppMngt_get_users => ",a),t&&t(a)},onFailure(i,c){const r=i;r.msg=c.errormsg,r.errCode=c.errorcode,s&&s(r)}})}function le(e,t,s=void 0,n=void 0){let i=`${e.space}/resources/AppsMngt/user?platform=${e.tenant}&id=${t}`;f(i,{onComplete(c,r,a){const o=JSON.parse(c);s&&s(o)},onFailure(c,r){const a=c;a.msg=r.errormsg,a.errCode=r.errorcode,n&&n(a)}})}const R={"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"};function pe(e,t,s=void 0,n=void 0){const{space:i,currentUser:c}=e,a=`${i}${{URIUGr:"/3drdfpersist/resources/v1/usersgroup"}.URIUGr}`,o={groups:[{title:t.title,description:t.description,members:t.members||[c.email,"samuel.mureau@beam3.fr"],pending_members:[],sharing:t.sharing,visibility:t.visibility}]};f(a,{method:"POST",headers:R,data:JSON.stringify(o),onComplete(d){s&&s(JSON.parse(d))},onFailure(d,l){console.log(d);const p=d;p.msg=l.errormsg,p.errCode=l.errorcode,console.log("❌ sendDirectMessage => ",p),n&&n(p)}})}function ue(e,t,s=void 0,n=void 0){const{space:i,tenant:c}=e,r=i,a=`/3drdfpersist/v1/resources/${t}`,o=`?$mask=dsaccess:Mask.GroupUI.Properties&tenant=dstenant:${c}`,d=`${r}${a}${o}`;f(d,{opts:{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"}},onComplete(u){s&&s(JSON.parse(u))},onFailure(u,m){const g=u;g.msg=m.errormsg,g.errCode=m.errorcode,n&&n(g)}})}function P(e,t=void 0,s=void 0){const{space:n,tenant:i}=e,c=n,r="/3drdfpersist/resources/v1/option-sets/dsusergroup:ListOfGroupResponsibilities/options",a=`?tenant=dstenant:${i}`,o={method:"GET",Accept:"application/json,*/*,test/javascript"},d=`${c}${r}${a}`;f(d,{OPTsH:o,onComplete(l){t&&t(JSON.parse(l))},onFailure(l,p){const u=l;u.msg=p.errormsg,u.errCode=p.errorcode,s&&s(u)}})}function fe(e,t=void 0,s=void 0){const{space:n,currentUser:i}=e,a=`${n}/3drdfpersist/resources/v1/usersgroup?select=uri,title,description,owner,members,pending_members,creation_date,modification_date,visibility`,d={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"}};try{f(a,{opts:d,onComplete(l){const p=JSON.parse(l),u={},m=p.groups.filter(g=>g.uri.startsWith("uuid:"));if(i&&Object.keys(i).length>0){const g=m.filter(y=>y.owner===i.email),h=m.filter(y=>y.members.includes(i.email)),S=g.concat(h);u.iam=S,u.UG=m,u.iamMember=h,P(e,y=>{u.rules=y,t&&t(u)},y=>{s&&s(y)})}},onFailure(l){s&&s(l)}})}catch(l){console.log(l)}}function me(e,t){const{space:s}=e,i=`${s}/3drdfpersist/resources/v1/usersgroup/${t}`;f(i,{method:"DELETE"})}function ge(e,t,s,n=void 0,i=void 0){const{space:c,tenant:r}=e,a={URITI:"/3drdfpersist/resources/v1/template-instances",URIUGr:"/3drdfpersist/resources/v1/usersgroup",nextURICh:"/characteristics",nextURIGr:"/group",nexURImem:"/members",OPTsTI:"?$mask=dsaccess:Mask.GroupUI.Properties",OPTsTenant:`tenant=dstenant:${r}`},o=s,d=`${c}${a.URIUGr}/${t}`,l=JSON.stringify(o);f(d,{headers:R,method:"PATCH",data:l,type:"json",onComplete(p){n&&n(p)},onFailure(p){i&&i(p)}})}function he(e,t,s,n=void 0,i=void 0){const{space:c}=e,a=`${c}/3drdfpersist/resources/v1/usersgroup/${t}/sharing`;f(a,{method:"PATCH",headers:R,data:JSON.stringify(s),type:"json",onComplete(d){n&&n(d)},onFailure(d){i&&i(d)}})}function Se(e,t,s=void 0,n=void 0){const{space:i}=e,r=`${i}/3drdfpersist/resources/v1/usersgroup/${t}/sharing`;f(r,{opts:{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"}},onComplete(d){s&&s(JSON.parse(d))},onFailure(d){n&&n(d)}})}const M=new FileReader;M.onload=()=>console.log(M.result);async function L(e,t=void 0,s=void 0,n=void 0){const i=e.space;if(t===void 0){console.log("Le paramètre docid est obligatoire");return}const c=i+`/resources/v1/modeler/documents/${t}`;f(c,{onComplete(r,a,o){const d=JSON.parse(r);s&&s(d)},onFailure(r){n&&n(r)}})}function k(e,t,s=void 0,n=void 0){if(t!==null){let i=`${e.space}/resources/v1/modeler/documents/${t}`;f(i,{onComplete(c,r,a){const o=JSON.parse(c);s&&s(o)},onFailure(c){n&&n(c)}})}else N(e)}function N(e,t=void 0,s=void 0){const n=e.space;if(n!==""&&!n){const i=n+"/resources/v1/application/CSRF";f(i,{onComplete(c,r,a){const o=JSON.parse(c);t&&t(o.csrf.value)},onFailure(c){s&&s(c)}})}else s&&s("ERROR : url du 3DSpace non défini.")}function $(e,t,s=void 0,n=void 0){let i=e.space+`/resources/v1/modeler/documents/${t}/files/DownloadTicket`;k(e,t,c=>{f(i,{method:"PUT",headers:{ENO_CSRF_TOKEN:c.csrf.value},onComplete(r){let a=JSON.parse(r);if(a.success===!0)try{const o=a.data[0].dataelements.ticketURL;s&&s(o)}catch(o){n&&n(o)}},onFailure(r,a){console.log("☠️ error => ",r,a),n&&n(r,a)}})},n)}function ye(e,t,s,n=void 0,i=void 0){const c=`${e.space}/resources/v1/modeler/documents/${t}/files/DownloadTicket`;f(c,{method:"PUT",headers:{ENO_CSRF_TOKEN:s},onComplete(r){let a=JSON.parse(r);if(a.success===!0)try{const o=a.data[0].dataelements.ticketURL;n&&n(o)}catch(o){i&&i(o)}},onFailure(r){i&&i(r)}})}function E(e,t,s,n,i,c=void 0,r=void 0){k(e,t,a=>{J(e,t,s,n,i,a.csrf.value,c,r)},r)}function J(e,t,s,n,i,c,r=void 0,a=void 0){const o=e.space+`/resources/v1/modeler/documents/${t}/files/CheckinTicket`;f(o,{method:"PUT",headers:{ENO_CSRF_TOKEN:c},onComplete(d,l,p){const u=JSON.parse(d).data[0].dataelements,m=new FormData;m.append("__fcs__jobTicket",u.ticket),m.append("file_0",n,i);const g={};g.method="POST",g.data=m,g.onComplete=function(h){let S="temp_"+Date.now(),y={method:"PUT",headers:{ENO_CSRF_TOKEN:c},data:JSON.stringify({data:[{id:t,relateddata:{files:[{id:s,dataelements:{title:i,receipt:h},updateAction:"REVISE"}]},tempId:S}]}),type:"json",onComplete(w){r&&r(w)},onFailure(w){a&&a(w)}};f(e.space+"/resources/v1/modeler/documents",y)},g.onFailure=function(h){a&&a(h)},g.timeout=0,f(u.ticketURL,g)}})}async function _e(e,t,s,n,i=void 0,c=void 0){const r=e.space,a=e.token,o=e.ctx,d=new FormData,l=new Blob([JSON.stringify(t)],{type:"text/plain"}),p={url_Ticket:`${r}/resources/v1/modeler/documents/files/CheckinTicket`,url_Post:`${r}/resources/v1/modeler/documents/?SecurityContext=ctx::${o}`};if(!r&&r!==""){console.log("le store._3DSpace est vide");return}f(p.url_Ticket,{method:"PUT",headers:{ENO_CSRF_TOKEN:a.value},onComplete(u,m,g){const h=JSON.parse(u).data[0].dataelements;d.append("__fcs__jobTicket",h.ticket),d.append("filename",l,s);const S={method:"POST",data:d,onComplete(F){if(o!==""&&a!==""){const x={method:"POST",headers:{ENO_CSRF_TOKEN:a,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({data:[{type:"Document",dataelements:{title:`Title_${s.toLowerCase().split(" ").join("_")}`,policy:"Document Release",description:n},relateddata:{files:[{dataelements:{title:`${s}.json`,receipt:F}}]},tempId:D()}]}),type:"json",timeout:0,onComplete:y,onFailure:w};o!==""&&f(p.url_Post,x)}else console.warn("le store est vide")},onFailure:w};function y(F){console.log("Success -- response ",F.data[0]),i&&i(F)}function w(F,x){console.log("Erreur -- response ",F,`
|
|
2
|
+
headers `,x),c&&c(F)}f(h.ticketURL,S)}})}function b(e,t=void 0,s=void 0,n=void 0,i=void 0,c=void 0){const r=`${e.space}/resources/modeler/pno/person?current=true&select=preferredcredentials&select=collabspaces&xrequestedwith=xmlhttprequest`;f(r,{method:"GET",onComplete(a){const o=JSON.parse(a);let d="",l,p,u;if(t){let m=o.collabspaces.find(g=>g.title===t);if(m){l=t;let g=m.couples;g=g.filter((h,S,y)=>S===y.findIndex(w=>w.organization.pid===h.organization.pid&&w.role.pid===h.role.pid)),s&&(Array.isArray(s)?s.forEach(h=>{u||g.forEach(S=>{if(h===S.role.name&&n===S.organization.title)u=h,p=n;else if(h===S.role.name){let y=g.filter(w=>w.role.name===h);y.length===1?(u=y[0].role.name,p=y[0].organization.title):c(y)}})}):g.forEach(h=>{if(s===h.role.name&&n===h.organization.title)u=s,p=n;else if(s===h.role.name){let S=g.filter(y=>y.role.name===s);S.length===1?(u=S[0].role.name,p=S[0].organization.title):c(S)}}))}}l&&p&&u?(d=u+"."+p+"."+l,i(d)):o.preferredcredentials?(d=o.preferredcredentials.role.name+"."+o.preferredcredentials.organization.title+"."+o.preferredcredentials.collabspace.title,i(d)):c&&(d=u+"."+p+"."+l,c(d))},onFailure(a){console.log("Erreur de récupération du contexte de sécurité. => ",a)}})}async function j(e,t,s=void 0,n=void 0,i=void 0){return t===void 0||t===""?"Le paramètre objectId est obligatoire":new Promise(c=>{(e.space===""||!e.space)&&U(),t!==void 0&&t!==""&&t!==null&&$(e.space,t,r=>{f(r,{headers:{ENO_CSRF_TOKEN:e.token},onComplete(a){return s&&s(JSON.parse(a)),c=JSON.parse(a),c},onFailure(a){n&&(console.log("error http",a),n(a))}})},r=>{n&&n(r),console.log("*_3dspace_download_doc / error file URL *",r)})})}async function G(e,t,s=void 0,n=void 0){let i=[];for(let a=0;a<t.length;a+=80){const o=t.slice(a,a+80);i.push(o)}const r=a=>{K(e,i[a],()=>{a++,a<i.length&&r(a)},o=>{s&&s(o)})};r(0)}function K(e,t,s=void 0,n=void 0,i=void 0){const c=[];t.forEach(o=>{c.push({id:o})});let r=JSON.stringify({csrf:{name:"ENO_CSRF_TOKEN",value:e.token},data:c});const a=`${e.space}/resources/v1/modeler/documents/DownloadTicket?tenant=${e.tenant}&e6w-lang=fr&e6w-timezone=-120`;f(a,{method:"PUT",data:r,type:"json",onComplete(o){const d=o.data;o.success===!0&&(s&&s(),d.forEach(l=>{try{const p=l.dataelements.fileName,u=l.dataelements.ticketURL;f(u,{onComplete:m=>{n&&n({objectId:l.id,fileName:p,data:JSON.parse(m)})},onFailure:m=>{console.log("error http",m)}})}catch(p){console.log(p),i&&i(p)}}))},onFailure(o){console.log(o),i&&i(o)}})}function we(e,t,s=void 0,n=void 0){return new Promise(i=>{if(e.token===""&&N(e),t!==void 0&&t!==""&&t!==null){const c=`${e.space}/resources/v1/modeler/dslc/maturity/getNextStates`;b(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,a=>e.ctx=a,a=>{console.log("onError =>",a)});let r={method:"POST",headers:{SecurityContext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({data:[{id:t}]}),type:"json",onComplete(a){s&&s(a)},onFailure(a){n&&n(a)}};f(c,r)}})}function Te(e,t,s,n=void 0,i=void 0){return new Promise(c=>{if(e.token===""&&N(e),t!==void 0&&t!==""&&t!==null){const r=`${e.space}/resources/v1/modeler/dslc/maturity/changeState`;b(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,o=>e.ctx=o,o=>{console.log("onError =>",o)});let a={method:"POST",headers:{SecurityContext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({data:[{id:t,nextState:s}]}),type:"json",onComplete(o){n&&n(o)},onFailure(o){i&&i(o)}};f(r,a)}})}function Ce(e,t,s=void 0,n=void 0){return new Promise(i=>{if(e.token===""&&N(e),t!==void 0&&t!==""&&t!==null){const c=`${e.space}/resources/v1/dslc/versiongraph?withThumbnail=0&withIsLastVersion=0&withAttributes=0&withCopyFrom=0&tenant=${e.tenant}`;b(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,a=>e.ctx=a,a=>{console.log("onError =>",a)});let r={method:"POST",headers:{securitycontext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({graphRequests:[{id:t}]}),type:"json",onComplete(a){s&&s(a)},onFailure(a){n&&n(a)}};f(c,r)}})}function Oe(e,t,s=void 0,n=void 0){return new Promise(i=>{if(e.token===""&&N(e),t!==void 0&&t!==""&&t!==null){const c=`${e.space}/resources/lifecycle/revise/prepare_revise_maskattributes?tenant=${e.tenant}`;b(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,a=>e.ctx=a,a=>{console.log("onError =>",a)});let r={method:"POST",headers:{SecurityContext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({data:[{"attribute[PLMReference.V_versionComment]":null,physicalid:t,type:"Document",tenant:e.tenant,objectId:t,policy:"Document Release",availableSemantic:["E","LAST","NEW","DUP"]}]}),type:"json",onComplete(a){s&&s(a)},onFailure(a){n&&n(a)}};f(c,r)}})}function Ne(e,t,s,n=void 0,i=void 0){return new Promise(c=>{if(e.token===""&&N(e),t!==void 0&&t!==""&&t!==null){const r=`${e.space}/resources/lifecycle/revise/major?tenant=${e.tenant}`;b(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,o=>e.ctx=o,o=>{console.log("onError =>",o)});let a={method:"POST",headers:{securitycontext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({data:[{physicalid:t,proposedRevision:s,modifiedAttributes:{revision:s}}],folderid:null,notificationTimeout:600}),type:"json",onComplete(o){n&&n(o)},onFailure(o){i&&i(o)}};f(r,a)}})}//!SECTION
|
|
3
|
+
function _(e,t=void 0,s=void 0){const n=e.space+"/api/index/tk";f(n,{onComplete(i,c,r){var o;const a=JSON.parse(i);t&&(e.token=(o=a==null?void 0:a.result)==null?void 0:o.ServerToken,t(a))},onFailure(i){s&&s(i)}})}function be(e,t=void 0,s=void 0){const n=`${e.space}/api/exalead/whatsnew`,i={params:{community_id:null,hash_key:null,legacyFormat:!1,nresults:1,query:"#all",start:0}};_(e,c=>{f(n,{method:"POST",headers:{"X-DS-SWYM-CSRFTOKEN":c.result.ServerToken,"Content-type":"application/json;charset=UTF-8",Accept:"application/json"},data:JSON.stringify(i),type:"json",onComplete(r,a){t&&t(r,a)},onFailure(r,a){s&&s(r,a)}})})}function Fe(e,t=void 0,s=void 0){const n=`${e.space}/api/Recommendation/getpeoplefamiliartocurrentuser`,i={params:{idsToFilterArr:[],mode:"offline",limit:30,itemType:"User",maxNbOfCommonElements:"5"}};_(e,c=>{f(n,{method:"POST",headers:{"X-DS-SWYM-CSRFTOKEN":c.result.ServerToken,"Content-type":"application/json;charset=UTF-8",Accept:"application/json"},data:JSON.stringify(i),type:"json",onComplete(r,a){const o=r.result.hits.map(d=>({login:d.login,fullName:d.name}));t&&t(o,r)},onFailure(r,a){s&&s(r,a)}})})}function V(e,t=void 0,s=void 0){const n=e.space+"/api/user/getcurrent/";_(e,i=>{f(n,{method:"GET",headers:{"X-DS-SWYM-CSRFTOKEN":i.result.ServerToken},onComplete(c,r,a){const o=JSON.parse(c);t&&t(o.result)},onFailure(c){s&&s(c)}})},s)}function ke(e,t,s=void 0,n=void 0){const i=e.space+"/api/user/find/login/"+t;_(e,c=>{f(i,{method:"GET",headers:{"X-DS-SWYM-CSRFTOKEN":c.result.ServerToken},onComplete(r,a,o){const d=JSON.parse(r);s&&s(d)},onFailure(r){n&&n(r)}})},n)}function W(e,t=void 0,s=void 0){U(null,n=>{let i=[],c=[],r,a={};for(let o of n)"3DSpace"in o&&(c.push({label:`${o.displayName} ( ${o.platformId} )`,value:`${c.length}`}),c.sort(),i.push(o));for(let[o,d]of i.entries())d.platformId===e.tenant&&(a=d,r=o);T.widget.addPreference({name:"_CurrentTenantID_",type:"list",label:"Tenant",defaultValue:r,options:c}),Object.keys(a).length>0,b(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,o=>e.ctx=o,o=>{console.log("on Error CTX =>",o)}),V(e,o=>{t&&t(o,a)},o=>{s&&s(o)})},n=>{console.log("** _getPlatformServices Erreur **",n)})}module.exports={getActiveServices:W};async function $e(e,t,s){const n=`${e.space}/resources/v1/application/CSRF`;f(n,{onComplete(i){i=JSON.parse(i),t&&t(i.csrf)},onFailure(i){s&&s(i)}})}function De(e,t=void 0,s=void 0){const n={base:`${e.space}`,uri:"/resources/bps/cspaces",optTenant:`tenant=${e.tenant}`},i=`${n.base}${n.uri}?${n.optTenant}`;f(i,{method:"GET",headers:{Accept:"application/json,text/javascript,*/*","Content-Type":"application/ds-json"},onComplete(c,r){const a=JSON.parse(c);t&&t(a,r)},onFailure(c,r,a){s&&s(c,r,a)}})}function Ue(e,t,s,n){$(e.space,t,i=>{f(i,{header:{ENO_CSRF_TOKEN:e.token},onComplete:c=>{s&&s(c)},onFailure:c=>{console.log("error http",c),n&&n(c)}})},i=>{console.log("error file URL",i),n&&n(i)})}async function Ae(e,t,s=void 0,n=void 0){return new Promise(i=>{$(e.space,t,c=>{f(c,{onComplete:(r,a,o)=>(i(JSON.parse(r)),s&&s(JSON.parse(r),a,o),i),onFailure:(r,a,o)=>{n&&n(r,a,o),console.log(r,a==null?void 0:a.errormsg)}})})})}function Re(e,t,s,n=void 0,i=void 0){const c=new Blob([JSON.stringify(t)],{type:"text/plain"});k(e,s,r=>{const a=r.data[0].relateddata.files[0].id,o=r.data[0].dataelements.secondaryTitle!==""?r.data[0].dataelements.secondaryTitle:r.data[0].dataelements.title;E(e,s,a,c,o,d=>{n&&n(d)},d=>{i&&i(d)})},r=>{console.log("En cas d'erreur nous avons :",r),alert("Erreur lors de la sauvegarde, Veuillez réessayez"),i&&i(r)})}let X,Y;const q=[];async function je(e,t=void 0,s=void 0){console.log(`%c 3ds & objID ok ${e.space} et ${e.objID} *`,"color: green"),e.objID&&e.objID!==""?k(e.space,e.objID,n=>{t&&t(n.csrf.value)},n=>{s&&s(n)}):e.objID===null&&N(e)}async function ve(e,t=void 0,s=void 0){await j(e,n=>{const i={};i.obj=n,B(e,c=>{i.datas=c,t&&t(i)},c=>{s&&s(c)})},n=>{s&&s(n)})}function B(e,t=void 0,s=void 0){const n=[];e.objIds.forEach((i,c)=>{j(e,i.objId,r=>{n.push({[i.name]:r}),i.name==="dbProjets"&&(X=r.affaires.map(a=>a.objectID),z(e,Y)),c===e.objIds.length-1&&t&&t(n)},r=>{s&&s(r)})})}function z(e,t,s=void 0,n=void 0){G(e,X,i=>{const c=[...t];c.find(r=>r.objectID===i.objectId).data=i.data,Y=c,q.push(i.data),s&&s(q)},i=>{n&&(n(i),console.log(i))})}const xe="FA35FB9B177A280065800EA0000F599C",Ie=["swym","3dspace","drive","usersgroup","3dplan","dashboard"],H={how:"ds6w:how",what:"ds6w:what",when:"ds6w:when",where:"ds6w:where",who:"ds6w:who",why:"ds6w:why"},Q={objId:xe,pred:"who",order_by:"desc",tag:"testTag"};function Pe(e,t=Q,s=void 0,n=void 0){const{space:i,tenant:c}=e,{objId:r,pred:a,tag:o}=t,d={uri:"/resources/6w/tags",otpCTX:"SecurityContext=preferred",optTenant:`tenant=${c}`},l=`${i}${d.uri}?${d.otpCTX}&${d.optTenant}`,p={tag:[{subject:[{uri:`pid://${r}`}],predicate:H[a],object:{literal:o}}]};f(l,{method:"PUT",headers:{"Content-Type":"application/json",Accept:"application/json"},data:JSON.stringify(p),onComplete(u){JSON.parse(u);const m={};setTimeout(()=>{L(e,r,g=>{const h=g.data[0].dataelements.title,S=g.data[0].dataelements.fileExtension!==void 0?g.data[0].dataelements.fileExtension:"",y=g.data[0].relateddata.ownerInfo[0].dataelements.name;m.name=h,m.ext=S,m.createBy=y,t.info={...m},Me(e,t,w=>{s&&s(w)},w=>{n&&n(w)})},(g,h)=>{const S=g;S.msg=h.errormsg,S.errCode=h.errorcode,console.log("❌ sendDirectMessage => ",S),n&&n(S)})},2e3)},onFailure(u,m){const g=u;g.msg=m.errormsg,g.errCode=m.errorcode,console.log("❌ sendDirectMessage => ",g),n&&n(g)}})}function Me(e,t,s=void 0,n=void 0){console.log("obj ",t);const i=t.info.name,c={baseUrl:`https://${e.tenant.toLowerCase()}-eu1-fedsearch.3dexperience.3ds.com`,uri:"/federated/search"},r=`${c.baseUrl}${c.uri}`,a={"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"},o=D(),d={with_indexing_date:!0,with_synthesis:!0,with_nls:!1,label:`3DSearch-${e.currentUser.username}-AjoutDeTagBeam-${o}`,locale:"fr",select_predicate:["ds6w:label","ds6w:type","ds6w:description","ds6w:identifier","ds6w:modified","ds6w:created","ds6wg:revision","ds6w:status","ds6w:responsible","owner","ds6w:responsibleUid","ds6wg:filesize","ds6w:project","ds6w:dataSource","ds6w:community","ds6w:originator","dsgeo:referential","ds6w:lastModifiedBy","ds6w:repository","dcterms:title","dcterms:description","ds6w:containerUid"],with_synthesis_hierarchical:!0,select_file:["icon","thumbnail_2d"],query:i,specific_source_parameter:{"3dspace":{additional_query:' AND NOT (owner:"ENOVIA_CLOUD" OR owner:"Service Creator" OR owner:"Corporate" OR owner:"User Agent" OR owner:"SLMInstallerAdmin" OR owner:"Creator" OR owner:"VPLMAdminUser") AND (ds6w_58_islastrevisionperstate:true OR NOT listoffields:ds6w_58_islastrevisionperstate)'},drive:{additional_query:' AND NOT ([flattenedtaxonomies]:"types/DriveNode" AND ( [current]:"Trashed" OR [policy]:"Drive File Iteration") )'}},select_exclude_synthesis:["ds6w:what/ds6w:topic"],order_by:Q.order_by,order_field:"relevance",select_snippets:["ds6w:snippet","ds6w:label:snippet","ds6w:responsible:snippet","ds6w:community:snippet","swym:message_text:snippet"],nresults:40,start:"0",source:Ie,tenant:e.tenant,login:{"3dspace":{SecurityContext:e.ctx}}};console.log("dataPattern => ",d),f(r,{method:"POST",headers:a,data:JSON.stringify(d),onComplete(l){const p=JSON.parse(l);s(p)},onFailure(l,p){const u=l;u.msg=p.errormsg,u.errCode=p.errorcode,console.log("❌ sendDirectMessage => ",u),n&&n(u),console.log("Erreur de recuperation d'id du doc et des tags",l)}})}function Le(e,t,s=void 0,n=void 0){const{objId:i,pred:c,tag:r}=t,a={uri:"/resources/6w/tags",otpCTX:"SecurityContext=preferred",optTenant:`tenant=${e.tenant}`},o=`${e.space}${a.uri}?${a.otpCTX}&${a.optTenant}`,d={tag:[{subject:[{uri:`pid://${i}`}],predicate:H[c],object:{literal:r}}]};f(o,{method:"DELETE",data:JSON.stringify(d),headers:{"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"},onComplete(l){s&&s(l)},onFailure(l,p){const u=l;u.msg=p.errormsg,u.errCode=p.errorcode,console.log("❌ sendDirectMessage => ",u),n&&n(u)}})}function Ee(e,t="",s=void 0,n=void 0){const{space:i}=e;if(t==="")return;const c={uri:"/enovia/resources/v1/modeler/documents"},r={"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Accept:"application/json,text/javascript,*/*"},a=`${i}${c.uri}`,o=`$include=none,lockerInfo,ownerInfo,originatorInfo,files,ownerInfo,originatorInfo&$fields=none,title,name,typeNLS,collabSpaceTitle,revision,isLatestRevision,files,lockStatus,lockerInfo.name,lockerInfo.firstname,lockerInfo.lastname,owner,ownerInfo.name,ownerInfo.firstname,ownerInfo.lastname,stateNLS,modified,policy,state,organizationTitle,originator,originatorInfo.name,originatorInfo.firstname,originatorInfo.lastname,hasModifyAccess,fileExtension,files.name,files.title,files.revision,files.locker,ownerInfo,ownerInfo.name,ownerInfo.firstname,ownerInfo.lastname,originatorInfo,originatorInfo.name,originatorInfo.firstname,originatorInfo.lastname&$ids=${t}`;f(a,{method:"POST",headers:r,data:o,onComplete(d){s&&s(JSON.parse(d))},onFailure(d,l){const p=d;p.msg=l.error,n&&n(p)}})}function Je(e,t=void 0,s=void 0){const n={base:e.space,uri:"/api/community/listmycommunities",limit:`/limit/${e.limit?e.limit:128}`,page:`/page/${e.page?e.page:"1"}`},i=`${n.base}${n.uri}${n.limit}${n.page}`,c=[];_(e,r=>{f(i,{method:"GET",headers:{"X-DS-SWYM-CSRFTOKEN":r.result.ServerToken},onComplete(a,o,d){const p=JSON.parse(a).result;let u=0;p.forEach(m=>{const g={description:m.description,id:m.id,title:m.title,owner:m.owner,role:m.role,access:m.access};Z(e,m.id,h=>{u++,g.members=h,c.push(g),u===p.length&&t&&t(c)},h=>s(h))})},onFailure(a,o){const d=a;d.status=o.status,d.response=o.errormsg,s&&s(d)}})})}function Z(e,t,s,n){const i=`${e.space}/api/community/listmembers`,c={params:{page:e.page?e.page:1,limit:e.limit?e.limit:50,community_id:t}};_(e,r=>{f(i,{method:"POST",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":r.result.ServerToken},data:JSON.stringify(c),type:"json",onComplete(a,o,d){s&&s(a)},onFailure(a,o){const d=a;d.status=o.status,d.response=o.errormsg,n&&n(d)}})})}function Ge(e,t=void 0,s=void 0){const n="YXdA5x4DSUKtlAi2wmnyTA";e.commu_id||(e.commu_id=n);const i=`${e.space}/api/v2/communities/${e.commu_id}/ideas/statuses`;_(e,c=>{f(i,{method:"GET",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":c.result.ServerToken},onComplete(r){const a=JSON.parse(r);t&&t(a)},onFailure(r,a){const o=r;o.status=a.status,o.response=a.errormsg,s&&s(o)}})})}function Ke(e,t,s=void 0,n=void 0){const{listAllContacts:i,currentUser:c}=e;console.log("__listAllContacts",i.hits);const r=`${e.space}/api/directmessages`,a={users:[c.login].concat(t.receipt)},o={id_msg:"",senderId:e.currentUser.login,senderName:`${e.currentUser.first_name} ${e.currentUser.last_name}`,msg:Ve(t.msg)};let d=!1;ee(a.users,l=>{l!==void 0&&(o.id_msg=l.id,d=!0,v(e,o))},l=>{d=!1,console.log("_3dSwym_findCommunityToInstantMSG callback",l),n&&n(l),o.id_msg=""}),d===!1&&setTimeout(()=>{d===!1&&_(e,l=>{f(r,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":l.result.ServerToken},data:JSON.stringify(a),type:"json",onComplete(p,u,m){const g=p;g.reponse=JSON.parse(m.response),g.status=m.status,s&&s(g),o.id_msg=g.result.id,v(e,o)},onFailure(p,u,m){const g=p;g.msg=u.errormsg,g.status=u.status,n&&n(g)}})})},500)}function ee(e,t,s,n){const i=`${e.space}/api/directmessages/lite?with_favorites=false`;_(e,c=>{f(i,{method:"GET",headers:{Accept:"application/json,text/javascript,*/*","X-DS-SWYM-CSRFTOKEN":c.result.ServerToken},onComplete(r){const a=JSON.parse(r),o=[];a.result.forEach(p=>{p.users=p.users.sort((u,m)=>u.login.localeCompare(m.login)),p.users.length===t.length&&o.push(p)});const d=t.sort(),l=o.find(p=>{const u=[];return p.users.forEach(m=>{u.push(m.login)}),JSON.stringify(u)===JSON.stringify(d)});s&&l!==void 0?s(l):(n||l===void 0)&&n(l)},onFailure(r){const a=r;a.msg=headers.errormsg,a.errCode=headers.errorcode,console.log("❌ sendDirectMessageLite => ",a),n&&n(a)}})})}function v(e,t,s=void 0,n=void 0){const i={base:e.space,uri:"/api/community",id_msg:`${t.id_msg}`,endUri:"/instantmessages"},c=`${i.base}${i.uri}/${i.id_msg}${i.endUri}`,r={author:{login:t.senderId,displayName:t.senderName},accessState:null,commentUri:null,comments:null,endorsements:null,moderationState:null,parentCommentUri:null,richMessage:t.msg};console.log("_3dSwym_sendDirectMessageData url ",c),_(e,a=>{f(c,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":a.result.ServerToken},data:JSON.stringify(r),type:"json",onComplete(o,d,l){const p=o;p.status=l.status,p.response=JSON.parse(l.response),console.log("✅ _3dSwym_sendDirectMessageData => ",p),s&&s(p)},onFailure(o,d){const l=o;l.msg=d.errormsg,l.errCode=d.errorcode,console.log("❌ sendDirectMessage => ",l),n&&n(l)}})})}function Ve(e){const t=new Date().toLocaleDateString(),s=new Date().toLocaleTimeString();return`<p>${e} </p>
|
|
4
|
+
<br/>
|
|
5
|
+
<hr/>
|
|
6
|
+
<p><u>envoyer :</u>Le <b>${t} à ${s}</b></p>`}const We={title:"TEST DEV COMMUNITY IDEA",community_id:"YXdA5x4DSUKtlAi2wmnyTA",community_title:"TEST DEV COMMUNITY",idee_id:"THhRI8rlQNWKRxpv3Xqqug"};function Xe(e,t,s=void 0,n=void 0){const i=`${e.space}/api/idea/add`,c=e.swymCommunities.find(o=>o.id===t.community_id),r=e.swymCommunities.find(o=>o.title.toLowerCase()===t.community_title.toLowerCase()),a={params:{title:t.title,community_id:(c==null?void 0:c.id)!==void 0?c.id:r.id,message:ze(t.text_html),published:1}};_(e,o=>{const d={"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":o.result.ServerToken};f(i,{method:"POST",headers:d,data:JSON.stringify(a),type:"json",onComplete(l,p,u){const m=JSON.parse(l);m.status=u.status,m.response=u.response,s&&s(m)},onFailure(l,p,u){const m=l;m.status=p.status,m.response=p.errormsg,n&&n(m)}})})}function Ye(e,t,s=void 0,n=void 0){const i=`${e.space}/api/idea/delete`,c={params:{community_id:t.community_id,ideationIds:[t.idee_id]}};_(e,r=>{f(i,{method:"POST",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":r.result.ServerToken},data:JSON.stringify(c),type:"json",onComplete(a,o,d){s&&s(a)},onFailure(a,o,d){const l=a;l.status=o.status,l.response=o.errormsg,n&&n(l)}})})}function qe(e,t="",s=void 0,n=void 0){const i=e.tenant.toLowerCase()==="r1132101716373"?"tFtz0G4MR6qNtKgJjNfTog":e.tenant.toLowerCase()==="r1132101286859"?"Qpv3HN-tTDOsU-7_c5DnDg":"Template_d'idée_à_créer";t===""&&(t=i);const c=`${e.space}/api/idea/get`,r={params:{id:t}};_(e,a=>{f(c,{method:"POST",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":a.result.ServerToken},data:JSON.stringify(r),type:"json",onComplete(o){const d=o;d.msg=d.result.message,s&&s(d)},onFailure(o){const d=o;d.status=headers.status,d.response=headers.errormsg,n&&n(d)}})})}function Be(e,t=We,s=void 0,n=void 0){const i={uri:"/api/idea/list",comId:`/community_id/${e.tenant.toLowerCase()==="r1132101716373"?t.community_id:"bgnIsG74SUWswyGzS6NC6g"}`,limit:`/limit/${t.limit?t.limit:10}`},c=`${e.space}${i.uri}${i.comId}${i.limit}`;_(e,r=>{f(c,{method:"GET",headers:{"X-DS-SWYM-CSRFTOKEN":r.result.ServerToken},onComplete(a){const o=JSON.parse(a);s&&s(o)},onFailure(a,o){const d=a;d.status=o.status,d.response=o.errormsg,n&&n(d)}})})}function ze(e){return!e||e===""?`<h2><u>INFORMATIONS AFFAIRE :</u></h2>
|
|
7
|
+
<p><u>|⚠️<em> Merci de respecter l'écriture des tags, en MAJUSCULES, nom complet, pas de caractères</em></u></p>
|
|
8
|
+
<p><u><em>|spéciaux, séparation par "_" si besoin !</em></u></p>
|
|
9
|
+
<p><strong>Référence client </strong>: <em>
|
|
10
|
+
<a data-predicate="ds6w:who" data-type="internal" class="s6m-tag-link s6m-link">CLIENT</a>
|
|
11
|
+
</em></p>
|
|
12
|
+
<p><strong>Référence projet </strong>: <em>
|
|
13
|
+
<a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">NOM AFFAIRE</a>
|
|
14
|
+
<a data-predicate="ds6w:where" data-type="internal" class="s6m-tag-link s6m-link">VILLE</a>
|
|
15
|
+
<a data-predicate="ds6w:where" data-type="internal" class="s6m-tag-link s6m-link">DPT</a>
|
|
16
|
+
</em></p>
|
|
17
|
+
<p>📝 <strong>Base documentaire</strong> : LIEN projet</p>
|
|
18
|
+
<p>📝 <strong>Fiche COCLICO</strong> : LIEN projet<em><strong></strong>
|
|
19
|
+
</em></p>
|
|
20
|
+
<p><br /></p>
|
|
21
|
+
<table border="1">
|
|
22
|
+
<tbody>
|
|
23
|
+
<tr><td><strong>Description projet </strong>:
|
|
24
|
+
<br /><br /></td></tr>
|
|
25
|
+
</tbody>
|
|
26
|
+
</table>
|
|
27
|
+
<p><br /></p>
|
|
28
|
+
<p><br /></p>
|
|
29
|
+
<p><strong>Produit :<em> </em></strong><em>
|
|
30
|
+
<a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Hexapli Usiné</a>
|
|
31
|
+
<a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Hexapli MP</a>
|
|
32
|
+
<a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Lamwood</a>
|
|
33
|
+
</em></p>
|
|
34
|
+
<p><strong>Type de Bâtiment :</strong><em>
|
|
35
|
+
<a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Logements</a>
|
|
36
|
+
<a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">BUP</a>
|
|
37
|
+
<a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">ERP</a>
|
|
38
|
+
<a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Plateforme Logistique</a>
|
|
39
|
+
</em></p>
|
|
40
|
+
<p><strong>Essence :</strong> <em>
|
|
41
|
+
<a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">DOUGLAS</a>
|
|
42
|
+
<a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">PIN</a>
|
|
43
|
+
<a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">MIXTE</a>
|
|
44
|
+
<a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">EPICEA</a>
|
|
45
|
+
</em></p>
|
|
46
|
+
<p><strong>Qualité : </strong><em>
|
|
47
|
+
<a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">NVI</a>
|
|
48
|
+
<a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">VI1F</a>
|
|
49
|
+
<a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">VI2F</a>
|
|
50
|
+
</em><strong></strong></p>
|
|
51
|
+
<p><strong>Traitement : </strong><em>
|
|
52
|
+
<a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">PARKA</a>
|
|
53
|
+
<a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">CT2</a>
|
|
54
|
+
</em></p>
|
|
55
|
+
<p><strong>Type de Paroi : </strong><em>
|
|
56
|
+
<a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Murs Intérieurs</a>
|
|
57
|
+
<a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Murs Extérieurs</a>
|
|
58
|
+
<a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Planchers</a>
|
|
59
|
+
<a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Couverture</a>
|
|
60
|
+
</em></p>
|
|
61
|
+
<p><em>
|
|
62
|
+
<a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Etanchéité Accessible</a>
|
|
63
|
+
<a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Etanchéité Non-Accessible</a>
|
|
64
|
+
</em></p>
|
|
65
|
+
<p><strong>Hauteur Dernier Plancher :</strong><em><strong> </strong>
|
|
66
|
+
<a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">Hauteur <8m</a>
|
|
67
|
+
<a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">8m< Hauteur <28m</a>
|
|
68
|
+
<a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">28m< Hauteur <50m</a>
|
|
69
|
+
</em></p>
|
|
70
|
+
<h2><br /></h2>
|
|
71
|
+
<h2><u>EQUIPE PIVETEAU :</u></h2>
|
|
72
|
+
<table border="1">
|
|
73
|
+
<tbody>
|
|
74
|
+
<tr><td><strong>Chargé d'Affaires</strong></td><td><br /></td></tr>
|
|
75
|
+
<tr><td><strong>Service études de prix</strong></td><td><br /></td></tr>
|
|
76
|
+
</tbody></table>
|
|
77
|
+
<p>
|
|
78
|
+
</p>`:e}function He(e){const t="Hello "+e;return console.log(t),t}return{sayHello:He,_3DSwym_get_version:_,_3DSwym_getAllNews:be,_3DSwym_getFamiliarPeople:Fe,_3DSpace_Create_Doc:_e,_3DSpace_csrf:N,_3DSpace_download_doc:j,_3DSpace_download_multidoc:G,_3DSpace_file_update_csr:J,_3DSpace_file_update:E,_3DSpace_file_url_csr:ye,_3DSpace_file_url:$,_3DSpace_get_csrf:k,_3DSpace_get_docInfo:L,_3DSpace_get_downloadTicket_multidoc:K,_3DSpace_get_securityContexts:b,_3DSpace_lifecycle_changeRevision:Ne,_3DSpace_lifecycle_changeState:Te,_3DSpace_lifecycle_getGraph:Ce,_3DSpace_lifecycle_getNextRevision:Oe,_3DSpace_lifecycle_getNextStates:we,_3DSwim_getAllCommunities:Je,_3DSwim_getMembersCommunity:Z,_3DSwym_buildDirectMessage:Ke,_3DSwym_deleteIdea:Ye,_3DSwym_findCommunityToInstantMSG:ee,_3DSwym_get_AllSWYMIdeas:Be,_3DSwym_get_currentUser:V,_3DSwym_get_findUser:ke,_3DSwym_getIdeaStatusMaturity:Ge,_3DSwym_getSWYMIdea:qe,_3DSwym_postIdea:Xe,_3DSwym_sendMessageData:v,_AppMngt_get_info_user:le,_AppMngt_get_users:de,_getPlateformInfos:A,_getPlatformServices:U,_httpCallAuthenticated:f,_setDraggable:ie,_setDroppable:re,_setupTagger:oe,addTagToDoc:Pe,compass_getListAdditionalApps:ce,couleurs:I,createUserGroups:pe,dataMixing:z,deleteUserGroups:me,findAdresse:ne,get_3DSpace_csrf:je,getActiveServices:W,getAllContextSecurity:De,getCommunes:te,getComplementUG:ue,getCSRFToken:$e,getDataFrom3DSpace:Ue,getDataFromGouvFr:se,getDatasByTenant:ve,getDatasFrom3DSpace:B,getDownloadDocument:Ae,getInfoDocTags:Ee,getUserGroupsList:fe,getUsersGroupRules:P,patchUserGroups:ge,patchUserGroupsControl:he,pushDataIn3DSpace:Re,readUserGroupControl:Se,removeTagToDoc:Le,updateEvent:ae,UUID:D}});
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beam3_dev/api_module",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/wb3Api.umd.cjs",
|
|
6
6
|
"module": "./dist/wb3Api.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
7
10
|
"exports": {
|
|
8
11
|
".": {
|
|
9
12
|
"import": "./dist/wb3Api.js",
|
|
@@ -20,11 +23,11 @@
|
|
|
20
23
|
"vite": "^5.0.8"
|
|
21
24
|
},
|
|
22
25
|
"peerDependencies": {
|
|
23
|
-
"raw-loader": "4.0.2",
|
|
24
|
-
"luxon": "^3.4.4",
|
|
25
|
-
"uuid": "^9.0.1",
|
|
26
26
|
"@widget-lab/3ddashboard-utils": "https://btcc.3ds.com/widget-lab/npm/widget-lab-3ddashboard-utils-1.4.0.tgz",
|
|
27
27
|
"jsdoc": "^4.0.2",
|
|
28
|
-
"
|
|
28
|
+
"luxon": "^3.4.4",
|
|
29
|
+
"raw-loader": "4.0.2",
|
|
30
|
+
"requirejs": "2.3.6",
|
|
31
|
+
"uuid": "^9.0.1"
|
|
29
32
|
}
|
|
30
33
|
}
|
package/index.html
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>Vite App</title>
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div id="app"></div>
|
|
11
|
-
<script type="module" src="/main.js"></script>
|
|
12
|
-
</body>
|
|
13
|
-
</html>
|
package/src/index.js
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { UUID } from "./lib/api/index";
|
|
2
|
-
import { couleurs } from "./lib/gouv/colors";
|
|
3
|
-
import {
|
|
4
|
-
findAdresse,
|
|
5
|
-
getCommunes,
|
|
6
|
-
getDataFromGouvFr,
|
|
7
|
-
} from "./lib/gouv/gouv_api";
|
|
8
|
-
import { updateEvent } from "./lib/utils/updateEvent";
|
|
9
|
-
import { compass_getListAdditionalApps } from "./lib/plateform/Compass";
|
|
10
|
-
import {
|
|
11
|
-
_setDraggable,
|
|
12
|
-
_setDroppable,
|
|
13
|
-
_getPlatformServices,
|
|
14
|
-
_getPlateformInfos,
|
|
15
|
-
_httpCallAuthenticated,
|
|
16
|
-
_setupTagger,
|
|
17
|
-
} from "./lib/plateform/main/3dexperience_api";
|
|
18
|
-
import {
|
|
19
|
-
_AppMngt_get_users,
|
|
20
|
-
_AppMngt_get_info_user,
|
|
21
|
-
} from "./lib/plateform/main/3dcompass_api";
|
|
22
|
-
import {
|
|
23
|
-
createUserGroups,
|
|
24
|
-
getComplementUG,
|
|
25
|
-
getUsersGroupRules,
|
|
26
|
-
getUserGroupsList,
|
|
27
|
-
deleteUserGroups,
|
|
28
|
-
patchUserGroups,
|
|
29
|
-
patchUserGroupsControl,
|
|
30
|
-
readUserGroupControl,
|
|
31
|
-
} from "./lib/plateform/Usersgroup";
|
|
32
|
-
import {
|
|
33
|
-
_3DSpace_get_docInfo,
|
|
34
|
-
_3DSpace_get_csrf,
|
|
35
|
-
_3DSpace_csrf,
|
|
36
|
-
_3DSpace_file_url,
|
|
37
|
-
_3DSpace_file_url_csr,
|
|
38
|
-
_3DSpace_file_update,
|
|
39
|
-
_3DSpace_file_update_csr,
|
|
40
|
-
_3DSpace_Create_Doc,
|
|
41
|
-
_3DSpace_get_securityContexts,
|
|
42
|
-
_3DSpace_download_doc,
|
|
43
|
-
_3DSpace_download_multidoc,
|
|
44
|
-
_3DSpace_get_downloadTicket_multidoc,
|
|
45
|
-
_3DSpace_lifecycle_getNextStates,
|
|
46
|
-
_3DSpace_lifecycle_changeState,
|
|
47
|
-
_3DSpace_lifecycle_getGraph,
|
|
48
|
-
_3DSpace_lifecycle_getNextRevision,
|
|
49
|
-
_3DSpace_lifecycle_changeRevision,
|
|
50
|
-
} from "./lib/plateform/main/3dspace_api";
|
|
51
|
-
import { getActiveServices } from "./lib/plateform/main/getActiveServices";
|
|
52
|
-
import { getCSRFToken } from "./lib/plateform/main/getCSRFToken";
|
|
53
|
-
import { getAllContextSecurity } from "./lib/plateform/main/getCTX";
|
|
54
|
-
import { getDataFrom3DSpace } from "./lib/plateform/main/getDataFrom3DSpace";
|
|
55
|
-
import { getDownloadDocument } from "./lib/plateform/main/getDownloadDocument";
|
|
56
|
-
import { pushDataIn3DSpace } from "./lib/plateform/main/pushDataIn3DSpace";
|
|
57
|
-
import {
|
|
58
|
-
getDatasFrom3DSpace,
|
|
59
|
-
dataMixing,
|
|
60
|
-
getDatasByTenant,
|
|
61
|
-
get_3DSpace_csrf,
|
|
62
|
-
} from "./lib/plateform/main/loadDatas";
|
|
63
|
-
import {
|
|
64
|
-
getInfoDocTags,
|
|
65
|
-
removeTagToDoc,
|
|
66
|
-
addTagToDoc,
|
|
67
|
-
} from "./lib/plateform/Tag";
|
|
68
|
-
import {
|
|
69
|
-
_3DSwim_getAllCommunities,
|
|
70
|
-
_3DSwim_getMembersCommunity,
|
|
71
|
-
_3DSwym_getIdeaStatusMaturity,
|
|
72
|
-
_3DSwym_buildDirectMessage,
|
|
73
|
-
_3DSwym_findCommunityToInstantMSG,
|
|
74
|
-
_3DSwym_sendMessageData,
|
|
75
|
-
} from "./lib/plateform/Swym/communaute";
|
|
76
|
-
import {
|
|
77
|
-
_3DSwym_postIdea,
|
|
78
|
-
_3DSwym_deleteIdea,
|
|
79
|
-
_3DSwym_getSWYMIdea,
|
|
80
|
-
_3DSwym_get_AllSWYMIdeas,
|
|
81
|
-
} from "./lib/plateform/Swym/idea";
|
|
82
|
-
import {
|
|
83
|
-
_3DSwym_get_currentUser,
|
|
84
|
-
_3DSwym_get_findUser,
|
|
85
|
-
} from "./lib/plateform/Swym/user";
|
|
86
|
-
import {
|
|
87
|
-
_3DSwym_get_version,
|
|
88
|
-
_3DSwym_getAllNews,
|
|
89
|
-
_3DSwym_getFamiliarPeople,
|
|
90
|
-
} from "./lib/plateform/Swym/3dswym_api";
|
|
91
|
-
|
|
92
|
-
import { sayHello } from "./lib/add";
|
|
93
|
-
|
|
94
|
-
export default {
|
|
95
|
-
sayHello,
|
|
96
|
-
_3DSwym_get_version,
|
|
97
|
-
_3DSwym_getAllNews,
|
|
98
|
-
_3DSwym_getFamiliarPeople,
|
|
99
|
-
_3DSpace_Create_Doc,
|
|
100
|
-
_3DSpace_csrf,
|
|
101
|
-
_3DSpace_download_doc,
|
|
102
|
-
_3DSpace_download_multidoc,
|
|
103
|
-
_3DSpace_file_update_csr,
|
|
104
|
-
_3DSpace_file_update,
|
|
105
|
-
_3DSpace_file_url_csr,
|
|
106
|
-
_3DSpace_file_url,
|
|
107
|
-
_3DSpace_get_csrf,
|
|
108
|
-
_3DSpace_get_docInfo,
|
|
109
|
-
_3DSpace_get_downloadTicket_multidoc,
|
|
110
|
-
_3DSpace_get_securityContexts,
|
|
111
|
-
_3DSpace_lifecycle_changeRevision,
|
|
112
|
-
_3DSpace_lifecycle_changeState,
|
|
113
|
-
_3DSpace_lifecycle_getGraph,
|
|
114
|
-
_3DSpace_lifecycle_getNextRevision,
|
|
115
|
-
_3DSpace_lifecycle_getNextStates,
|
|
116
|
-
_3DSwim_getAllCommunities,
|
|
117
|
-
_3DSwim_getMembersCommunity,
|
|
118
|
-
_3DSwym_buildDirectMessage,
|
|
119
|
-
_3DSwym_deleteIdea,
|
|
120
|
-
_3DSwym_findCommunityToInstantMSG,
|
|
121
|
-
_3DSwym_get_AllSWYMIdeas,
|
|
122
|
-
_3DSwym_get_currentUser,
|
|
123
|
-
_3DSwym_get_findUser,
|
|
124
|
-
_3DSwym_getIdeaStatusMaturity,
|
|
125
|
-
_3DSwym_getSWYMIdea,
|
|
126
|
-
_3DSwym_postIdea,
|
|
127
|
-
_3DSwym_sendMessageData,
|
|
128
|
-
_AppMngt_get_info_user,
|
|
129
|
-
_AppMngt_get_users,
|
|
130
|
-
_getPlateformInfos,
|
|
131
|
-
_getPlatformServices,
|
|
132
|
-
_httpCallAuthenticated,
|
|
133
|
-
_setDraggable,
|
|
134
|
-
_setDroppable,
|
|
135
|
-
_setupTagger,
|
|
136
|
-
addTagToDoc,
|
|
137
|
-
compass_getListAdditionalApps,
|
|
138
|
-
couleurs,
|
|
139
|
-
createUserGroups,
|
|
140
|
-
dataMixing,
|
|
141
|
-
deleteUserGroups,
|
|
142
|
-
findAdresse,
|
|
143
|
-
get_3DSpace_csrf,
|
|
144
|
-
getActiveServices,
|
|
145
|
-
getAllContextSecurity,
|
|
146
|
-
getCommunes,
|
|
147
|
-
getComplementUG,
|
|
148
|
-
getCSRFToken,
|
|
149
|
-
getDataFrom3DSpace,
|
|
150
|
-
getDataFromGouvFr,
|
|
151
|
-
getDatasByTenant,
|
|
152
|
-
getDatasFrom3DSpace,
|
|
153
|
-
getDownloadDocument,
|
|
154
|
-
getInfoDocTags,
|
|
155
|
-
getUserGroupsList,
|
|
156
|
-
getUsersGroupRules,
|
|
157
|
-
patchUserGroups,
|
|
158
|
-
patchUserGroupsControl,
|
|
159
|
-
pushDataIn3DSpace,
|
|
160
|
-
readUserGroupControl,
|
|
161
|
-
removeTagToDoc,
|
|
162
|
-
updateEvent,
|
|
163
|
-
UUID,
|
|
164
|
-
};
|
package/src/lib/add/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description Fonction Test permettant de tester l'installation de la librairie
|
|
3
|
-
*
|
|
4
|
-
* @param {String} _name une simple chaine
|
|
5
|
-
*
|
|
6
|
-
* @return {String}
|
|
7
|
-
*/
|
|
8
|
-
export function sayHello(_name) {
|
|
9
|
-
const name = "Hello " + _name;
|
|
10
|
-
console.log(name);
|
|
11
|
-
return name;
|
|
12
|
-
}
|
package/src/lib/api/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { v4 as uuid } from "uuid";
|
|
2
|
-
/**
|
|
3
|
-
* @description La fonction UUID génère un UUID (Universally Unique Identifier) aléatoire.
|
|
4
|
-
* @returns La fonction UUID renvoie un UUID (Universally Unique Identifier) généré aléatoirement à l'aide de la fonction uuid.
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
export function UUID() {
|
|
8
|
-
return uuid();
|
|
9
|
-
}
|
package/src/lib/gouv/colors.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// pour les charts Piveteau
|
|
2
|
-
export const couleurs = {
|
|
3
|
-
b3M3Yellow: "#FFB300",
|
|
4
|
-
b3AboutageBlue: "#42A5F5",
|
|
5
|
-
b3UsinageGreen: "#689F38",
|
|
6
|
-
b3PanneauOrange: "#ff8000",
|
|
7
|
-
b3M350percent: "#fafa6e",
|
|
8
|
-
b3M380percent: "#aae479",
|
|
9
|
-
b3M390percent: "#64c987",
|
|
10
|
-
b3M3100percent: "#23aa8f",
|
|
11
|
-
b3M3105percent: "#00898a",
|
|
12
|
-
b3M3110percent: "#176877",
|
|
13
|
-
b3M3120percent: "#2a4858",
|
|
14
|
-
b3Aboutage50percent: "#fafa6e",
|
|
15
|
-
b3Aboutage80percent: "#aae479",
|
|
16
|
-
b3Aboutage90percent: "#64c987",
|
|
17
|
-
b3Aboutage100percent: "#23aa8f",
|
|
18
|
-
b3Aboutage105percent: "#00898a",
|
|
19
|
-
b3Aboutage110percent: "#176877",
|
|
20
|
-
b3Aboutage120percent: "#2a4858",
|
|
21
|
-
b3Warning: "#FF0000",
|
|
22
|
-
b3Edit1: "#AD1457",
|
|
23
|
-
b3Edit2: "#F4511E",
|
|
24
|
-
b3Edit3: "#009688",
|
|
25
|
-
b3Edit4: "#D50000",
|
|
26
|
-
b3Edit5: "#039BE5",
|
|
27
|
-
b3Edit6: "#9E69AF",
|
|
28
|
-
b3Edit7: "#A79B8E",
|
|
29
|
-
b3Edit8: "#616161",
|
|
30
|
-
b3Edit9: "#795548",
|
|
31
|
-
};
|
package/src/lib/gouv/gouv_api.js
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { DateTime } from "luxon";
|
|
2
|
-
import { couleurs } from "./colors";
|
|
3
|
-
/**
|
|
4
|
-
* Cette fonction récupère une liste de communes en fonction d'un code postal donné à l'aide d'une API
|
|
5
|
-
* d'IGN France.
|
|
6
|
-
* @param {String} cp - Le paramètre `cp` est une chaîne représentant un code postal français. Il est converti
|
|
7
|
-
* en entier à l'aide de `parseInt()` avant d'être utilisé dans la requête API.
|
|
8
|
-
* @param { Function } - onDone est une fonction de rappel qui sera exécutée lorsque l'appel API réussit et
|
|
9
|
-
* renvoie une réponse. Il prend les données de réponse comme argument et peut être utilisé pour gérer
|
|
10
|
-
* les données dans la fonction appelante.
|
|
11
|
-
* @param { Function } - Le paramètre `onError` est une fonction de rappel qui sera exécutée s'il y a une
|
|
12
|
-
* erreur lors de la requête de récupération. Il permet une gestion personnalisée des erreurs et peut
|
|
13
|
-
* être utilisé pour afficher des messages d'erreur ou effectuer d'autres actions en réponse à une
|
|
14
|
-
* erreur.
|
|
15
|
-
*/
|
|
16
|
-
export async function getCommunes(cp, onDone = undefined, onError = undefined) {
|
|
17
|
-
const codePostal = parseInt(cp);
|
|
18
|
-
await fetch(
|
|
19
|
-
"https://apicarto.ign.fr/api/codes-postaux/communes/" + codePostal,
|
|
20
|
-
{
|
|
21
|
-
method: "GET",
|
|
22
|
-
headers: {
|
|
23
|
-
Accept: "application/json",
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
)
|
|
27
|
-
.then((response) => response.json())
|
|
28
|
-
.then((json) => {
|
|
29
|
-
if (onDone) onDone(json);
|
|
30
|
-
})
|
|
31
|
-
.catch((error) => {
|
|
32
|
-
if (onError) onError(error);
|
|
33
|
-
console.error("Erreur : " + error);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Il s'agit d'une fonction JavaScript qui utilise l'API-adresse.data.gouv.fr pour rechercher des
|
|
39
|
-
* adresses à partir d'une requête et renvoie les résultats au format JSON.
|
|
40
|
-
* @param { String } query - L'adresse ou la requête d'emplacement à rechercher dans l'API.
|
|
41
|
-
* @param { Function } - onDone est une fonction de rappel qui sera exécutée lorsque l'appel API réussit et
|
|
42
|
-
* renvoie une réponse. Il prend la réponse JSON comme paramètre.
|
|
43
|
-
* @param { Function } - Le paramètre `onError` est une fonction de rappel qui sera exécutée s'il y a une
|
|
44
|
-
* erreur lors de l'appel de l'API. C'est un paramètre optionnel qui peut être passé à la fonction
|
|
45
|
-
* `findAdresse`. S'il est fourni, il recevra l'objet d'erreur comme argument.
|
|
46
|
-
*/
|
|
47
|
-
export async function findAdresse(
|
|
48
|
-
query,
|
|
49
|
-
onDone = undefined,
|
|
50
|
-
onError = undefined,
|
|
51
|
-
) {
|
|
52
|
-
// https://api-adresse.data.gouv.fr/search/?q=
|
|
53
|
-
query = encodeURIComponent(query);
|
|
54
|
-
await fetch(
|
|
55
|
-
"https://api-adresse.data.gouv.fr/search/?q=" + query + "&limit=15",
|
|
56
|
-
{
|
|
57
|
-
method: "GET",
|
|
58
|
-
headers: {
|
|
59
|
-
Accept: "application/json",
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
)
|
|
63
|
-
.then((response) => response.json())
|
|
64
|
-
.then((json) => {
|
|
65
|
-
if (onDone) onDone(json);
|
|
66
|
-
})
|
|
67
|
-
.catch((error) => {
|
|
68
|
-
if (onError) onError(error);
|
|
69
|
-
console.error("Erreur : " + error);
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Cette fonction récupère les données d'une API du gouvernement français contenant des informations
|
|
75
|
-
* sur les jours fériés et les formate pour les utiliser dans une application de calendrier.
|
|
76
|
-
*/
|
|
77
|
-
/**
|
|
78
|
-
* La fonction `getDataFromGouvFr` récupère les données de l'API du gouvernement français pour les
|
|
79
|
-
* jours fériés et les formate dans une structure de données spécifique.
|
|
80
|
-
* @param events - Le paramètre `events` est un tableau d'objets représentant des événements. (store.loadedEvents)
|
|
81
|
-
* @param colors - Le paramètre `colors` est un objets représentant des couleurs. (Piveteau)
|
|
82
|
-
* @returns les données formatées, qui incluent les événements récupérés depuis le point de terminaison
|
|
83
|
-
* API "https://calendrier.api.gouv.fr/jours-feries/metropole/". Les événements sont formatés dans une
|
|
84
|
-
* structure spécifique et renvoyés sous forme d'objet.
|
|
85
|
-
*/
|
|
86
|
-
export async function getDataFromGouvFr(events, colors = couleurs) {
|
|
87
|
-
let year = DateTime.now().year;
|
|
88
|
-
const loadedEvents = events;
|
|
89
|
-
const sortedData = [];
|
|
90
|
-
|
|
91
|
-
const formatData = (json) => {
|
|
92
|
-
for (let date in json) sortedData.push({ date, comment: json[date] });
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
for (let i = year; i <= year + 1; i++) {
|
|
96
|
-
await fetch(
|
|
97
|
-
"https://calendrier.api.gouv.fr/jours-feries/metropole/" + i + ".json",
|
|
98
|
-
{
|
|
99
|
-
method: "GET",
|
|
100
|
-
headers: {
|
|
101
|
-
Accept: "application/json",
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
)
|
|
105
|
-
.then((response) => response.json())
|
|
106
|
-
.then((json) => {
|
|
107
|
-
formatData(json);
|
|
108
|
-
})
|
|
109
|
-
.catch((error) => console.error("Erreur : " + error));
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
const formatedData = () => {
|
|
113
|
-
const data =
|
|
114
|
-
loadedEvents.length === 0
|
|
115
|
-
? {
|
|
116
|
-
events: [],
|
|
117
|
-
}
|
|
118
|
-
: loadedEvents;
|
|
119
|
-
for (let each of sortedData) {
|
|
120
|
-
const index = data.events.findIndex(
|
|
121
|
-
(event) =>
|
|
122
|
-
event.start === DateTime.fromISO(each.date).toISODate() &&
|
|
123
|
-
event.name === "Férié : " + each.comment,
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
if (index === -1)
|
|
127
|
-
data.events.push({
|
|
128
|
-
name: "Férié : " + each.comment,
|
|
129
|
-
start: DateTime.fromISO(each.date).toISODate(),
|
|
130
|
-
end: DateTime.fromISO(each.date).toISODate(),
|
|
131
|
-
color: colors.b3BusinnessDays,
|
|
132
|
-
timed: false,
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
return data;
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
return formatedData();
|
|
139
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { _httpCallAuthenticated } from "../main/3dexperience_api";
|
|
2
|
-
/**
|
|
3
|
-
* @description La fonction `compass_getListAdditionalApps` effectue une requête HTTP GET authentifiée pour
|
|
4
|
-
* récupérer une liste d'applications supplémentaires en fonction des informations d'identification
|
|
5
|
-
* fournies.
|
|
6
|
-
* @param {Object} credentials Un objet contenant les informations d'identification nécessaires à
|
|
7
|
-
* l'authentification. Il doit avoir les propriétés suivantes : space, token
|
|
8
|
-
* @property {String} [space] - L'URL du serveur sur lequel l'API est déployée.(ex: 3DSpace, 3DSwym, 3DCompass...)
|
|
9
|
-
* @property {String} [tenant] - le tenant courant (ex: R1132100968447)
|
|
10
|
-
* @param onDone - Le paramètre `onDone` est une fonction de rappel qui sera appelée lorsque l'appel
|
|
11
|
-
* d'API réussit et que les données de réponse sont formatées. Il prend deux arguments :
|
|
12
|
-
* `formatedInfos` et `info`. `formatedInfos` est un tableau d'objets contenant le nom et l'identifiant
|
|
13
|
-
* de chaque application,
|
|
14
|
-
* @param onError - Le paramètre `onError` est une fonction de rappel qui sera appelée s'il y a une
|
|
15
|
-
* erreur lors de la requête HTTP. Il prend un paramètre, « info », qui est un objet contenant des
|
|
16
|
-
* informations sur l'erreur.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
export function compass_getListAdditionalApps(credentials, onDone, onError) {
|
|
20
|
-
const URL = {
|
|
21
|
-
base: `${credentials.space}`,
|
|
22
|
-
uri: "/resources/AppsMngt/api/custom/applications",
|
|
23
|
-
option: `?filter=${credentials.tenant}`, // facultatif
|
|
24
|
-
};
|
|
25
|
-
const url = `${URL.base}${URL.uri}${URL.option}`;
|
|
26
|
-
|
|
27
|
-
_httpCallAuthenticated(url, {
|
|
28
|
-
method: "GET",
|
|
29
|
-
headers: {
|
|
30
|
-
"Content-Type": "application/json",
|
|
31
|
-
Accept: "application/json",
|
|
32
|
-
},
|
|
33
|
-
onComplete(response, headers, xhr) {
|
|
34
|
-
const info = JSON.parse(response);
|
|
35
|
-
const formatedInfos = info.data.map((app) => {
|
|
36
|
-
const name = app.attributes.name;
|
|
37
|
-
const id = app.id;
|
|
38
|
-
return { name, id };
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
if (onDone) onDone(formatedInfos, info);
|
|
42
|
-
},
|
|
43
|
-
onFailure(response, headers) {
|
|
44
|
-
const info = response;
|
|
45
|
-
info["msg"] = headers.errormsg;
|
|
46
|
-
info["errCode"] = headers.errorcode;
|
|
47
|
-
|
|
48
|
-
if (onError) onError(info);
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
}
|