@beam3_dev/api_module 0.0.29 → 0.0.31

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 CHANGED
@@ -1,9 +1,1848 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Q=require("uuid"),b=require("luxon"),T=require("@widget-lab/3ddashboard-utils");function $(){return Q.v4()}const M={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 Z(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 ee(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 te(e,t=M){let s=b.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===b.DateTime.fromISO(o.date).toISODate()&&l.name==="Férié : "+o.comment)===-1&&a.events.push({name:"Férié : "+o.comment,start:b.DateTime.fromISO(o.date).toISODate(),end:b.DateTime.fromISO(o.date).toISODate(),color:t.b3BusinnessDays,timed:!1});return a})()}async function ne(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 se(e,t,s){T.requirejs(["DS/DataDragAndDrop/DataDragAndDrop"],n=>{n.draggable(e,{data:t,start:s})})}function ae(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 ie(e,t){T.requirejs(["DS/DataDragAndDrop/DataDragAndDrop"],s=>{s.droppable(e,{drop:t})})}function v(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})}),k(),t&&t(k())}function k(){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 oe(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 re(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 ce(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 de(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 le(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 x(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 pe(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(h=>h.owner===i.email),_=m.filter(h=>h.members.includes(i.email)),S=g.concat(_);u.iam=S,u.UG=m,u.iamMember=_,x(e,h=>{u.rules=h,t&&t(u)},h=>{s&&s(h)})}},onFailure(l){s&&s(l)}})}catch(l){console.log(l)}}function ue(e,t){const{space:s}=e,i=`${s}/3drdfpersist/resources/v1/usersgroup/${t}`;f(i,{method:"DELETE"})}function fe(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 me(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 ge(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)}})}async function P(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 N(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 C(e)}function C(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 U(e,t,s=void 0,n=void 0){let i=e.space+`/resources/v1/modeler/documents/${t}/files/DownloadTicket`;N(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 _e(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 L(e,t,s,n,i,c=void 0,r=void 0){N(e,t,a=>{E(e,t,s,n,i,a.csrf.value,c,r)},r)}function E(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(_){let S="temp_"+Date.now(),h={method:"PUT",headers:{ENO_CSRF_TOKEN:c},data:JSON.stringify({data:[{id:t,relateddata:{files:[{id:s,dataelements:{title:i,receipt:_},updateAction:"REVISE"}]},tempId:S}]}),type:"json",onComplete(y){r&&r(y)},onFailure(y){a&&a(y)}};f(e.space+"/resources/v1/modeler/documents",h)},g.onFailure=function(_){a&&a(_)},g.timeout=0,f(u.ticketURL,g)}})}async function Se(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 _=JSON.parse(u).data[0].dataelements;d.append("__fcs__jobTicket",_.ticket),d.append("filename",l,s);const S={method:"POST",data:d,onComplete(D){if(o!==""&&a!==""){const F={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:D}}]},tempId:$()}]}),type:"json",timeout:0,onComplete:h,onFailure:y};o!==""&&f(p.url_Post,F)}else console.warn("le store est vide")},onFailure:y};function h(D){console.log("Success -- response ",D.data[0]),i&&i(D)}function y(D,F){console.log("Erreur -- response ",D,`
2
- headers `,F),c&&c(D)}f(_.ticketURL,S)}})}function O(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((_,S,h)=>S===h.findIndex(y=>y.organization.pid===_.organization.pid&&y.role.pid===_.role.pid)),s&&(Array.isArray(s)?s.forEach(_=>{u||g.forEach(S=>{if(_===S.role.name&&n===S.organization.title)u=_,p=n;else if(_===S.role.name){let h=g.filter(y=>y.role.name===_);h.length===1?(u=h[0].role.name,p=h[0].organization.title):c(h)}})}):g.forEach(_=>{if(s===_.role.name&&n===_.organization.title)u=s,p=n;else if(s===_.role.name){let S=g.filter(h=>h.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 I(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)&&v(),t!==void 0&&t!==""&&t!==null&&U(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 J(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=>{G(e,i[a],()=>{a++,a<i.length&&r(a)},o=>{s&&s(o)})};r(0)}function G(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 he(e,t,s=void 0,n=void 0){return new Promise(i=>{if(e.token===""&&C(e),t!==void 0&&t!==""&&t!==null){const c=`${e.space}/resources/v1/modeler/dslc/maturity/getNextStates`;O(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 ye(e,t,s,n=void 0,i=void 0){return new Promise(c=>{if(e.token===""&&C(e),t!==void 0&&t!==""&&t!==null){const r=`${e.space}/resources/v1/modeler/dslc/maturity/changeState`;O(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 we(e,t,s=void 0,n=void 0){return new Promise(i=>{if(e.token===""&&C(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}`;O(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 Te(e,t,s=void 0,n=void 0){return new Promise(i=>{if(e.token===""&&C(e),t!==void 0&&t!==""&&t!==null){const c=`${e.space}/resources/lifecycle/revise/prepare_revise_maskattributes?tenant=${e.tenant}`;O(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 Ce(e,t,s,n=void 0,i=void 0){return new Promise(c=>{if(e.token===""&&C(e),t!==void 0&&t!==""&&t!==null){const r=`${e.space}/resources/lifecycle/revise/major?tenant=${e.tenant}`;O(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 w(e,t=void 0,s=void 0){const n=e.space+"/api/index/tk";f(n,{onComplete(i,c,r){const a=JSON.parse(i);t&&(e.token=a?.result?.ServerToken,t(a))},onFailure(i){s&&s(i)}})}function De(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}};w(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 Oe(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"}};w(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 K(e,t=void 0,s=void 0){const n=e.space+"/api/user/getcurrent/";w(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 Ne(e,t,s=void 0,n=void 0){const i=e.space+"/api/user/find/login/"+t;w(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 V(e,t=void 0,s=void 0){v(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,O(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,o=>e.ctx=o,o=>{console.log("on Error CTX =>",o)}),K(e,o=>{t&&t(o,a)},o=>{s&&s(o)})},n=>{console.log("** _getPlatformServices Erreur **",n)})}module.exports={getActiveServices:V};async function be(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 Ue(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 Fe(e,t,s,n){U(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 ke(e,t,s=void 0,n=void 0){return new Promise(i=>{U(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?.errormsg)}})})})}function Ae(e,t,s,n=void 0,i=void 0){const c=new Blob([JSON.stringify(t)],{type:"text/plain"});N(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;L(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 W,X;const j=[];async function $e(e,t=void 0,s=void 0){console.log(`%c 3ds & objID ok ${e.space} et ${e.objID} *`,"color: green"),e.objID&&e.objID!==""?N(e.space,e.objID,n=>{t&&t(n.csrf.value)},n=>{s&&s(n)}):e.objID===null&&C(e)}async function ve(e,t=void 0,s=void 0){await I(e,n=>{const i={};i.obj=n,Y(e,c=>{i.datas=c,t&&t(i)},c=>{s&&s(c)})},n=>{s&&s(n)})}function Y(e,t=void 0,s=void 0){const n=[];e.objIds.forEach((i,c)=>{I(e,i.objId,r=>{n.push({[i.name]:r}),i.name==="dbProjets"&&(W=r.affaires.map(a=>a.objectID),B(e,X)),c===e.objIds.length-1&&t&&t(n)},r=>{s&&s(r)})})}function B(e,t,s=void 0,n=void 0){J(e,W,i=>{const c=[...t];c.find(r=>r.objectID===i.objectId).data=i.data,X=c,j.push(i.data),s&&s(j)},i=>{n&&(n(i),console.log(i))})}const Re="FA35FB9B177A280065800EA0000F599C",Ie=["swym","3dspace","drive","usersgroup","3dplan","dashboard"],q={how:"ds6w:how",what:"ds6w:what",when:"ds6w:when",where:"ds6w:where",who:"ds6w:who",why:"ds6w:why"},je={objId:Re,pred:"who",order_by:"desc",tag:"testTag"};function Me(e,t,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:q[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(()=>{P(e,r,g=>{const _=g.data[0].dataelements.title,S=g.data[0].dataelements.fileExtension!==void 0?g.data[0].dataelements.fileExtension:"",h=g.data[0].relateddata.ownerInfo[0].dataelements.name;m.name=_,m.ext=S,m.createBy=h,t.info={...m},xe(e,t,y=>{s&&s(y)},y=>{n&&n(y)})},(g,_)=>{const S=g;S.msg=_.errormsg,S.errCode=_.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 xe(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={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:je.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 Pe(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:q[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 Le(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 Ee(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=[];w(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};H(e,m.id,_=>{u++,g.members=_,c.push(g),u===p.length&&t&&t(c)},_=>s(_))})},onFailure(a,o){const d=a;d.status=o.status,d.response=o.errormsg,s&&s(d)}})})}function H(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}};w(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 Je(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`;w(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 Ge(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:Ke(t.msg)};let d=!1;z(a.users,l=>{l!==void 0&&(o.id_msg=l.id,d=!0,A(e,o))},l=>{d=!1,console.log("_3dSwym_findCommunityToInstantMSG callback",l),n&&n(l),o.id_msg=""}),d===!1&&setTimeout(()=>{d===!1&&w(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,A(e,o)},onFailure(p,u,m){const g=p;g.msg=u.errormsg,g.status=u.status,n&&n(g)}})})},500)}function z(e,t,s,n){const i=`${e.space}/api/directmessages/lite?with_favorites=false`;w(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 A(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),w(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 Ke(e){const t=new Date().toLocaleDateString(),s=new Date().toLocaleTimeString();return`<p>${e} </p>
1
+ import { v4 as E } from "uuid";
2
+ import { DateTime as b } from "luxon";
3
+ import { requirejs as O, widget as U } from "@widget-lab/3ddashboard-utils";
4
+ function j() {
5
+ return E();
6
+ }
7
+ const J = {
8
+ b3M3Yellow: "#FFB300",
9
+ b3AboutageBlue: "#42A5F5",
10
+ b3UsinageGreen: "#689F38",
11
+ b3PanneauOrange: "#ff8000",
12
+ b3M350percent: "#fafa6e",
13
+ b3M380percent: "#aae479",
14
+ b3M390percent: "#64c987",
15
+ b3M3100percent: "#23aa8f",
16
+ b3M3105percent: "#00898a",
17
+ b3M3110percent: "#176877",
18
+ b3M3120percent: "#2a4858",
19
+ b3Aboutage50percent: "#fafa6e",
20
+ b3Aboutage80percent: "#aae479",
21
+ b3Aboutage90percent: "#64c987",
22
+ b3Aboutage100percent: "#23aa8f",
23
+ b3Aboutage105percent: "#00898a",
24
+ b3Aboutage110percent: "#176877",
25
+ b3Aboutage120percent: "#2a4858",
26
+ b3Warning: "#FF0000",
27
+ b3Edit1: "#AD1457",
28
+ b3Edit2: "#F4511E",
29
+ b3Edit3: "#009688",
30
+ b3Edit4: "#D50000",
31
+ b3Edit5: "#039BE5",
32
+ b3Edit6: "#9E69AF",
33
+ b3Edit7: "#A79B8E",
34
+ b3Edit8: "#616161",
35
+ b3Edit9: "#795548"
36
+ };
37
+ async function de(e, t = void 0, s = void 0) {
38
+ const n = parseInt(e);
39
+ await fetch(
40
+ "https://apicarto.ign.fr/api/codes-postaux/communes/" + n,
41
+ {
42
+ method: "GET",
43
+ headers: {
44
+ Accept: "application/json"
45
+ }
46
+ }
47
+ ).then((i) => i.json()).then((i) => {
48
+ t && t(i);
49
+ }).catch((i) => {
50
+ s && s(i), console.error("Erreur : " + i);
51
+ });
52
+ }
53
+ async function le(e, t = void 0, s = void 0) {
54
+ e = encodeURIComponent(e), await fetch(
55
+ "https://api-adresse.data.gouv.fr/search/?q=" + e + "&limit=15",
56
+ {
57
+ method: "GET",
58
+ headers: {
59
+ Accept: "application/json"
60
+ }
61
+ }
62
+ ).then((n) => n.json()).then((n) => {
63
+ t && t(n);
64
+ }).catch((n) => {
65
+ s && s(n), console.error("Erreur : " + n);
66
+ });
67
+ }
68
+ async function pe(e, t = J) {
69
+ let s = b.now().year;
70
+ const n = e, i = [], c = (a) => {
71
+ for (let o in a)
72
+ i.push({ date: o, comment: a[o] });
73
+ };
74
+ for (let a = s; a <= s + 1; a++)
75
+ await fetch(
76
+ "https://calendrier.api.gouv.fr/jours-feries/metropole/" + a + ".json",
77
+ {
78
+ method: "GET",
79
+ headers: {
80
+ Accept: "application/json"
81
+ }
82
+ }
83
+ ).then((o) => o.json()).then((o) => {
84
+ c(o);
85
+ }).catch((o) => console.error("Erreur : " + o));
86
+ return (() => {
87
+ const a = n.length === 0 ? {
88
+ events: []
89
+ } : n;
90
+ for (let o of i)
91
+ a.events.findIndex(
92
+ (l) => l.start === b.fromISO(o.date).toISODate() && l.name === "Férié : " + o.comment
93
+ ) === -1 && a.events.push({
94
+ name: "Férié : " + o.comment,
95
+ start: b.fromISO(o.date).toISODate(),
96
+ end: b.fromISO(o.date).toISODate(),
97
+ color: t.b3BusinnessDays,
98
+ timed: !1
99
+ });
100
+ return a;
101
+ })();
102
+ }
103
+ async function ue(e, t, s = !0) {
104
+ const n = e.events.findIndex((i) => i.uuid === t.uuid);
105
+ 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;
106
+ }
107
+ function f(e, t) {
108
+ O(["DS/WAFData/WAFData"], (s) => {
109
+ s.authenticatedRequest(e, t);
110
+ });
111
+ }
112
+ function fe(e, t, s) {
113
+ O(["DS/DataDragAndDrop/DataDragAndDrop"], (n) => {
114
+ n.draggable(e, { data: t, start: s });
115
+ });
116
+ }
117
+ function me(e, t = void 0) {
118
+ O(["DS/TagNavigatorProxy/TagNavigatorProxy"], (s) => {
119
+ let n;
120
+ n === void 0 && (n = s.createProxy({
121
+ widgetId: U.id,
122
+ filteringMode: "WithFilteringServices"
123
+ }), t !== void 0 && n.addEvent("onFilterSubjectsChange", t)), n.setSubjectsTags(e);
124
+ });
125
+ }
126
+ function ge(e, t) {
127
+ O(["DS/DataDragAndDrop/DataDragAndDrop"], (s) => {
128
+ s.droppable(e, { drop: t });
129
+ });
130
+ }
131
+ function I(e, t = void 0, s = void 0) {
132
+ O(
133
+ ["DS/i3DXCompassServices/i3DXCompassServices"],
134
+ (n) => {
135
+ (!e || e === "") && (e = U.getValue("PlatFormInstanceId")), (!e || e === "") && (e = void 0), n.getPlatformServices({
136
+ platformId: e,
137
+ onComplete: t,
138
+ onFailure: s
139
+ });
140
+ }
141
+ ), A(), t && t(A());
142
+ }
143
+ function A() {
144
+ let e = {};
145
+ return O(["DS/PlatformAPI/PlatformAPI"], (t) => {
146
+ const s = t.getTenant(), n = t.getUser(), i = t.getAllApplicationConfigurations(), c = t.getWidgetTenant(), r = t.getApplicationConfiguration(
147
+ "com.3ds.wp.passport.cors"
148
+ );
149
+ e = {
150
+ tenant: s,
151
+ user: n,
152
+ appsConfiguration: i,
153
+ widgetTenant: c,
154
+ appConf: r
155
+ };
156
+ }), console.log("%cRETOUR API :", "color:blue", e), e;
157
+ }
158
+ function he(e, t, s) {
159
+ const n = {
160
+ base: `${e.space}`,
161
+ uri: "/resources/AppsMngt/api/custom/applications",
162
+ option: `?filter=${e.tenant}`
163
+ // facultatif
164
+ }, i = `${n.base}${n.uri}${n.option}`;
165
+ f(i, {
166
+ method: "GET",
167
+ headers: {
168
+ "Content-Type": "application/json",
169
+ Accept: "application/json"
170
+ },
171
+ onComplete(c, r, a) {
172
+ const o = JSON.parse(c), d = o.data.map((l) => {
173
+ const p = l.attributes.name, u = l.id;
174
+ return { name: p, id: u };
175
+ });
176
+ t && t(d, o);
177
+ },
178
+ onFailure(c, r) {
179
+ const a = c;
180
+ a.msg = r.errormsg, a.errCode = r.errorcode, s && s(a);
181
+ }
182
+ });
183
+ }
184
+ function Se(e, t = void 0, s = void 0) {
185
+ let n = `${e.space}/resources/AppsMngt/user?platform=${e.tenant}&limit=-1`;
186
+ f(n, {
187
+ onComplete(i, c, r) {
188
+ const a = JSON.parse(i);
189
+ console.log("_AppMngt_get_users => ", a), t && t(a);
190
+ },
191
+ onFailure(i, c) {
192
+ const r = i;
193
+ r.msg = c.errormsg, r.errCode = c.errorcode, s && s(r);
194
+ }
195
+ });
196
+ }
197
+ function ye(e, t, s = void 0, n = void 0) {
198
+ let i = `${e.space}/resources/AppsMngt/user?platform=${e.tenant}&id=${t}`;
199
+ f(i, {
200
+ onComplete(c, r, a) {
201
+ const o = JSON.parse(c);
202
+ s && s(o);
203
+ },
204
+ onFailure(c, r) {
205
+ const a = c;
206
+ a.msg = r.errormsg, a.errCode = r.errorcode, n && n(a);
207
+ }
208
+ });
209
+ }
210
+ const $ = {
211
+ "Content-Type": "application/json",
212
+ Accept: "application/json,text/javascript,*/*"
213
+ };
214
+ function _e(e, t, s = void 0, n = void 0) {
215
+ const { space: i, currentUser: c } = e, a = `${i}${{
216
+ URIUGr: "/3drdfpersist/resources/v1/usersgroup"
217
+ }.URIUGr}`, o = {
218
+ groups: [
219
+ {
220
+ title: t.title,
221
+ description: t.description,
222
+ members: t.members || [c.email, "samuel.mureau@beam3.fr"],
223
+ pending_members: [],
224
+ sharing: t.sharing,
225
+ visibility: t.visibility
226
+ }
227
+ ]
228
+ };
229
+ f(a, {
230
+ method: "POST",
231
+ headers: $,
232
+ data: JSON.stringify(o),
233
+ onComplete(d) {
234
+ s && s(JSON.parse(d));
235
+ },
236
+ onFailure(d, l) {
237
+ console.log(d);
238
+ const p = d;
239
+ p.msg = l.errormsg, p.errCode = l.errorcode, console.log("❌ sendDirectMessage => ", p), n && n(p);
240
+ }
241
+ });
242
+ }
243
+ function Te(e, t, s = void 0, n = void 0) {
244
+ 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}`;
245
+ f(d, {
246
+ opts: {
247
+ method: "GET",
248
+ headers: {
249
+ "Content-Type": "application/json",
250
+ Accept: "application/json,text/javascript,*/*"
251
+ }
252
+ },
253
+ onComplete(u) {
254
+ s && s(JSON.parse(u));
255
+ },
256
+ onFailure(u, m) {
257
+ const g = u;
258
+ g.msg = m.errormsg, g.errCode = m.errorcode, n && n(g);
259
+ }
260
+ });
261
+ }
262
+ function G(e, t = void 0, s = void 0) {
263
+ const { space: n, tenant: i } = e, c = n, r = "/3drdfpersist/resources/v1/option-sets/dsusergroup:ListOfGroupResponsibilities/options", a = `?tenant=dstenant:${i}`, o = {
264
+ method: "GET",
265
+ Accept: "application/json,*/*,test/javascript"
266
+ }, d = `${c}${r}${a}`;
267
+ f(d, {
268
+ OPTsH: o,
269
+ onComplete(l) {
270
+ t && t(JSON.parse(l));
271
+ },
272
+ onFailure(l, p) {
273
+ const u = l;
274
+ u.msg = p.errormsg, u.errCode = p.errorcode, s && s(u);
275
+ }
276
+ });
277
+ }
278
+ function we(e, t = void 0, s = void 0) {
279
+ 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: {
280
+ "Content-Type": "application/json",
281
+ Accept: "application/json,text/javascript,*/*"
282
+ } };
283
+ try {
284
+ f(a, {
285
+ opts: d,
286
+ onComplete(l) {
287
+ const p = JSON.parse(l), u = {}, m = p.groups.filter((g) => g.uri.startsWith("uuid:"));
288
+ if (i && Object.keys(i).length > 0) {
289
+ const g = m.filter((y) => y.owner === i.email), h = m.filter((y) => y.members.includes(i.email)), S = g.concat(h);
290
+ u.iam = S, u.UG = m, u.iamMember = h, G(
291
+ e,
292
+ (y) => {
293
+ u.rules = y, t && t(u);
294
+ },
295
+ (y) => {
296
+ s && s(y);
297
+ }
298
+ );
299
+ }
300
+ },
301
+ onFailure(l) {
302
+ s && s(l);
303
+ }
304
+ });
305
+ } catch (l) {
306
+ console.log(l);
307
+ }
308
+ }
309
+ function Ce(e, t) {
310
+ const { space: s } = e, i = `${s}/3drdfpersist/resources/v1/usersgroup/${t}`;
311
+ f(i, {
312
+ method: "DELETE"
313
+ });
314
+ }
315
+ function Oe(e, t, s, n = void 0, i = void 0) {
316
+ const { space: c, tenant: r } = e, a = {
317
+ URITI: "/3drdfpersist/resources/v1/template-instances",
318
+ URIUGr: "/3drdfpersist/resources/v1/usersgroup",
319
+ nextURICh: "/characteristics",
320
+ nextURIGr: "/group",
321
+ nexURImem: "/members",
322
+ OPTsTI: "?$mask=dsaccess:Mask.GroupUI.Properties",
323
+ OPTsTenant: `tenant=dstenant:${r}`
324
+ }, o = s, d = `${c}${a.URIUGr}/${t}`, l = JSON.stringify(o);
325
+ f(d, {
326
+ headers: $,
327
+ method: "PATCH",
328
+ data: l,
329
+ type: "json",
330
+ onComplete(p) {
331
+ n && n(p);
332
+ },
333
+ onFailure(p) {
334
+ i && i(p);
335
+ }
336
+ });
337
+ }
338
+ function Ne(e, t, s, n = void 0, i = void 0) {
339
+ const { space: c } = e, a = `${c}/3drdfpersist/resources/v1/usersgroup/${t}/sharing`;
340
+ f(a, {
341
+ method: "PATCH",
342
+ headers: $,
343
+ data: JSON.stringify(s),
344
+ type: "json",
345
+ onComplete(d) {
346
+ n && n(d);
347
+ },
348
+ onFailure(d) {
349
+ i && i(d);
350
+ }
351
+ });
352
+ }
353
+ function be(e, t, s = void 0, n = void 0) {
354
+ const { space: i } = e, r = `${i}/3drdfpersist/resources/v1/usersgroup/${t}/sharing`;
355
+ f(r, {
356
+ opts: {
357
+ method: "GET",
358
+ headers: {
359
+ "Content-Type": "application/json",
360
+ Accept: "application/json,text/javascript,*/*"
361
+ }
362
+ },
363
+ onComplete(d) {
364
+ s && s(JSON.parse(d));
365
+ },
366
+ onFailure(d) {
367
+ n && n(d);
368
+ }
369
+ });
370
+ }
371
+ async function K(e, t = void 0, s = void 0, n = void 0) {
372
+ const i = e.space;
373
+ if (t === void 0) {
374
+ console.log("Le paramètre docid est obligatoire");
375
+ return;
376
+ }
377
+ const c = i + `/resources/v1/modeler/documents/${t}`;
378
+ f(c, {
379
+ onComplete(r, a, o) {
380
+ const d = JSON.parse(r);
381
+ s && s(d);
382
+ },
383
+ onFailure(r) {
384
+ n && n(r);
385
+ }
386
+ });
387
+ }
388
+ function k(e, t, s = void 0, n = void 0) {
389
+ if (t !== null) {
390
+ let i = `${e.space}/resources/v1/modeler/documents/${t}`;
391
+ f(i, {
392
+ onComplete(c, r, a) {
393
+ const o = JSON.parse(c);
394
+ s && s(o);
395
+ },
396
+ onFailure(c) {
397
+ n && n(c);
398
+ }
399
+ });
400
+ } else
401
+ C(e);
402
+ }
403
+ function C(e, t = void 0, s = void 0) {
404
+ const n = e.space;
405
+ if (n !== "" && !n) {
406
+ const i = n + "/resources/v1/application/CSRF";
407
+ f(i, {
408
+ onComplete(c, r, a) {
409
+ const o = JSON.parse(c);
410
+ t && t(o.csrf.value);
411
+ },
412
+ onFailure(c) {
413
+ s && s(c);
414
+ }
415
+ });
416
+ } else
417
+ s && s("ERROR : url du 3DSpace non défini.");
418
+ }
419
+ function D(e, t, s = void 0, n = void 0) {
420
+ let i = e.space + `/resources/v1/modeler/documents/${t}/files/DownloadTicket`;
421
+ k(
422
+ e,
423
+ t,
424
+ (c) => {
425
+ f(i, {
426
+ method: "PUT",
427
+ headers: {
428
+ ENO_CSRF_TOKEN: c.csrf.value
429
+ },
430
+ onComplete(r) {
431
+ let a = JSON.parse(r);
432
+ if (a.success === !0)
433
+ try {
434
+ const o = a.data[0].dataelements.ticketURL;
435
+ s && s(o);
436
+ } catch (o) {
437
+ n && n(o);
438
+ }
439
+ },
440
+ onFailure(r, a) {
441
+ console.log("☠️ error => ", r, a), n && n(r, a);
442
+ }
443
+ });
444
+ },
445
+ n
446
+ );
447
+ }
448
+ function ke(e, t, s, n = void 0, i = void 0) {
449
+ const c = `${e.space}/resources/v1/modeler/documents/${t}/files/DownloadTicket`;
450
+ f(c, {
451
+ method: "PUT",
452
+ headers: {
453
+ ENO_CSRF_TOKEN: s
454
+ },
455
+ onComplete(r) {
456
+ let a = JSON.parse(r);
457
+ if (a.success === !0)
458
+ try {
459
+ const o = a.data[0].dataelements.ticketURL;
460
+ n && n(o);
461
+ } catch (o) {
462
+ i && i(o);
463
+ }
464
+ },
465
+ onFailure(r) {
466
+ i && i(r);
467
+ }
468
+ });
469
+ }
470
+ function V(e, t, s, n, i, c = void 0, r = void 0) {
471
+ k(
472
+ e,
473
+ t,
474
+ (a) => {
475
+ W(
476
+ e,
477
+ t,
478
+ s,
479
+ n,
480
+ i,
481
+ a.csrf.value,
482
+ c,
483
+ r
484
+ );
485
+ },
486
+ r
487
+ );
488
+ }
489
+ function W(e, t, s, n, i, c, r = void 0, a = void 0) {
490
+ const o = e.space + `/resources/v1/modeler/documents/${t}/files/CheckinTicket`;
491
+ f(o, {
492
+ method: "PUT",
493
+ headers: {
494
+ ENO_CSRF_TOKEN: c
495
+ },
496
+ onComplete(d, l, p) {
497
+ const u = JSON.parse(d).data[0].dataelements, m = new FormData();
498
+ m.append("__fcs__jobTicket", u.ticket), m.append("file_0", n, i);
499
+ const g = {};
500
+ g.method = "POST", g.data = m, g.onComplete = function(h) {
501
+ let S = "temp_" + Date.now(), y = {
502
+ method: "PUT",
503
+ headers: {
504
+ ENO_CSRF_TOKEN: c
505
+ },
506
+ data: JSON.stringify({
507
+ data: [
508
+ {
509
+ id: t,
510
+ relateddata: {
511
+ files: [
512
+ {
513
+ id: s,
514
+ dataelements: {
515
+ title: i,
516
+ receipt: h
517
+ },
518
+ updateAction: "REVISE"
519
+ }
520
+ ]
521
+ },
522
+ tempId: S
523
+ }
524
+ ]
525
+ }),
526
+ type: "json",
527
+ onComplete(_) {
528
+ r && r(_);
529
+ },
530
+ onFailure(_) {
531
+ a && a(_);
532
+ }
533
+ };
534
+ f(
535
+ e.space + "/resources/v1/modeler/documents",
536
+ y
537
+ );
538
+ }, g.onFailure = function(h) {
539
+ a && a(h);
540
+ }, g.timeout = 0, f(u.ticketURL, g);
541
+ }
542
+ });
543
+ }
544
+ async function Fe(e, t, s, n, i = void 0, c = void 0) {
545
+ const r = e.space, a = e.token, o = e.ctx, d = new FormData(), l = new Blob([JSON.stringify(t)], {
546
+ type: "text/plain"
547
+ }), p = {
548
+ url_Ticket: `${r}/resources/v1/modeler/documents/files/CheckinTicket`,
549
+ url_Post: `${r}/resources/v1/modeler/documents/?SecurityContext=ctx::${o}`
550
+ };
551
+ if (!r && r !== "") {
552
+ console.log("le store._3DSpace est vide");
553
+ return;
554
+ }
555
+ f(p.url_Ticket, {
556
+ method: "PUT",
557
+ headers: {
558
+ ENO_CSRF_TOKEN: a.value
559
+ },
560
+ onComplete(u, m, g) {
561
+ const h = JSON.parse(u).data[0].dataelements;
562
+ d.append("__fcs__jobTicket", h.ticket), d.append("filename", l, s);
563
+ const S = {
564
+ method: "POST",
565
+ data: d,
566
+ onComplete(w) {
567
+ if (o !== "" && a !== "") {
568
+ const F = {
569
+ method: "POST",
570
+ headers: {
571
+ ENO_CSRF_TOKEN: a,
572
+ Accept: "application/json",
573
+ "Content-Type": "application/json"
574
+ },
575
+ data: JSON.stringify({
576
+ data: [
577
+ {
578
+ type: "Document",
579
+ dataelements: {
580
+ title: `Title_${s.toLowerCase().split(" ").join("_")}`,
581
+ policy: "Document Release",
582
+ description: n
583
+ },
584
+ relateddata: {
585
+ files: [
586
+ {
587
+ dataelements: {
588
+ title: `${s}.json`,
589
+ receipt: w
590
+ }
591
+ }
592
+ ]
593
+ },
594
+ tempId: j()
595
+ }
596
+ ]
597
+ }),
598
+ type: "json",
599
+ timeout: 0,
600
+ onComplete: y,
601
+ onFailure: _
602
+ };
603
+ o !== "" && f(p.url_Post, F);
604
+ } else
605
+ console.warn("le store est vide");
606
+ },
607
+ onFailure: _
608
+ };
609
+ function y(w) {
610
+ console.log("Success -- response ", w.data[0]), i && i(w);
611
+ }
612
+ function _(w, F) {
613
+ console.log("Erreur -- response ", w, `
614
+ headers `, F), c && c(w);
615
+ }
616
+ f(h.ticketURL, S);
617
+ }
618
+ });
619
+ }
620
+ function N(e, t = void 0, s = void 0, n = void 0, i = void 0, c = void 0) {
621
+ const r = `${e.space}/resources/modeler/pno/person?current=true&select=preferredcredentials&select=collabspaces&xrequestedwith=xmlhttprequest`;
622
+ f(r, {
623
+ method: "GET",
624
+ onComplete(a) {
625
+ const o = JSON.parse(a);
626
+ let d = "", l, p, u;
627
+ if (t) {
628
+ let m = o.collabspaces.find((g) => g.title === t);
629
+ if (m) {
630
+ l = t;
631
+ let g = m.couples;
632
+ g = g.filter(
633
+ (h, S, y) => S === y.findIndex(
634
+ (_) => _.organization.pid === h.organization.pid && _.role.pid === h.role.pid
635
+ )
636
+ ), s && (Array.isArray(s) ? s.forEach((h) => {
637
+ u || g.forEach((S) => {
638
+ if (h === S.role.name && n === S.organization.title)
639
+ u = h, p = n;
640
+ else if (h === S.role.name) {
641
+ let y = g.filter(
642
+ (_) => _.role.name === h
643
+ );
644
+ y.length === 1 ? (u = y[0].role.name, p = y[0].organization.title) : c(y);
645
+ }
646
+ });
647
+ }) : g.forEach((h) => {
648
+ if (s === h.role.name && n === h.organization.title)
649
+ u = s, p = n;
650
+ else if (s === h.role.name) {
651
+ let S = g.filter(
652
+ (y) => y.role.name === s
653
+ );
654
+ S.length === 1 ? (u = S[0].role.name, p = S[0].organization.title) : c(S);
655
+ }
656
+ }));
657
+ }
658
+ }
659
+ 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));
660
+ },
661
+ onFailure(a) {
662
+ console.log("Erreur de récupération du contexte de sécurité. => ", a);
663
+ }
664
+ });
665
+ }
666
+ async function x(e, t, s = void 0, n = void 0, i = void 0) {
667
+ return t === void 0 || t === "" ? "Le paramètre objectId est obligatoire" : new Promise((c) => {
668
+ (e.space === "" || !e.space) && I(), t !== void 0 && t !== "" && t !== null && D(
669
+ e.space,
670
+ t,
671
+ (r) => {
672
+ f(r, {
673
+ headers: {
674
+ ENO_CSRF_TOKEN: e.token
675
+ },
676
+ onComplete(a) {
677
+ return s && s(JSON.parse(a)), c = JSON.parse(a), c;
678
+ },
679
+ onFailure(a) {
680
+ n && (console.log("error http", a), n(a));
681
+ }
682
+ });
683
+ },
684
+ (r) => {
685
+ n && n(r), console.log("*_3dspace_download_doc / error file URL *", r);
686
+ }
687
+ );
688
+ });
689
+ }
690
+ async function X(e, t, s = void 0, n = void 0) {
691
+ let i = [];
692
+ for (let a = 0; a < t.length; a += 80) {
693
+ const o = t.slice(a, a + 80);
694
+ i.push(o);
695
+ }
696
+ const r = (a) => {
697
+ Y(
698
+ e,
699
+ i[a],
700
+ () => {
701
+ a++, a < i.length && r(a);
702
+ },
703
+ (o) => {
704
+ s && s(o);
705
+ }
706
+ );
707
+ };
708
+ r(0);
709
+ }
710
+ function Y(e, t, s = void 0, n = void 0, i = void 0) {
711
+ const c = [];
712
+ t.forEach((o) => {
713
+ c.push({
714
+ id: o
715
+ });
716
+ });
717
+ let r = JSON.stringify({
718
+ csrf: {
719
+ name: "ENO_CSRF_TOKEN",
720
+ value: e.token
721
+ },
722
+ data: c
723
+ });
724
+ const a = `${e.space}/resources/v1/modeler/documents/DownloadTicket?tenant=${e.tenant}&e6w-lang=fr&e6w-timezone=-120`;
725
+ f(a, {
726
+ method: "PUT",
727
+ data: r,
728
+ type: "json",
729
+ onComplete(o) {
730
+ const d = o.data;
731
+ o.success === !0 && (s && s(), d.forEach((l) => {
732
+ try {
733
+ const p = l.dataelements.fileName, u = l.dataelements.ticketURL;
734
+ f(u, {
735
+ onComplete: (m) => {
736
+ n && n({
737
+ objectId: l.id,
738
+ fileName: p,
739
+ data: JSON.parse(m)
740
+ });
741
+ },
742
+ onFailure: (m) => {
743
+ console.log("error http", m);
744
+ }
745
+ });
746
+ } catch (p) {
747
+ console.log(p), i && i(p);
748
+ }
749
+ }));
750
+ },
751
+ onFailure(o) {
752
+ console.log(o), i && i(o);
753
+ }
754
+ });
755
+ }
756
+ function Ue(e, t, s = void 0, n = void 0) {
757
+ return new Promise((i) => {
758
+ if (e.token === "" && C(e), t !== void 0 && t !== "" && t !== null) {
759
+ const c = `${e.space}/resources/v1/modeler/dslc/maturity/getNextStates`;
760
+ N(
761
+ e.space,
762
+ "ESPACE COMMUN",
763
+ ["VPLMProjectLeader", "VPLMCreator"],
764
+ void 0,
765
+ (a) => e.ctx = a,
766
+ (a) => {
767
+ console.log("onError =>", a);
768
+ }
769
+ );
770
+ let r = {
771
+ method: "POST",
772
+ headers: {
773
+ SecurityContext: "ctx::" + e.ctx,
774
+ ENO_CSRF_TOKEN: e.token,
775
+ Accept: "application/json",
776
+ "Content-Type": "application/json"
777
+ },
778
+ data: JSON.stringify({
779
+ data: [
780
+ {
781
+ id: t
782
+ }
783
+ ]
784
+ }),
785
+ type: "json",
786
+ onComplete(a) {
787
+ s && s(a);
788
+ },
789
+ onFailure(a) {
790
+ n && n(a);
791
+ }
792
+ };
793
+ f(c, r);
794
+ }
795
+ });
796
+ }
797
+ function $e(e, t, s, n = void 0, i = void 0) {
798
+ return new Promise((c) => {
799
+ if (e.token === "" && C(e), t !== void 0 && t !== "" && t !== null) {
800
+ const r = `${e.space}/resources/v1/modeler/dslc/maturity/changeState`;
801
+ N(
802
+ e.space,
803
+ "ESPACE COMMUN",
804
+ ["VPLMProjectLeader", "VPLMCreator"],
805
+ void 0,
806
+ (o) => e.ctx = o,
807
+ (o) => {
808
+ console.log("onError =>", o);
809
+ }
810
+ );
811
+ let a = {
812
+ method: "POST",
813
+ headers: {
814
+ SecurityContext: "ctx::" + e.ctx,
815
+ ENO_CSRF_TOKEN: e.token,
816
+ Accept: "application/json",
817
+ "Content-Type": "application/json"
818
+ },
819
+ data: JSON.stringify({
820
+ data: [
821
+ {
822
+ id: t,
823
+ nextState: s
824
+ }
825
+ ]
826
+ }),
827
+ type: "json",
828
+ onComplete(o) {
829
+ n && n(o);
830
+ },
831
+ onFailure(o) {
832
+ i && i(o);
833
+ }
834
+ };
835
+ f(r, a);
836
+ }
837
+ });
838
+ }
839
+ function De(e, t, s = void 0, n = void 0) {
840
+ return new Promise((i) => {
841
+ if (e.token === "" && C(e), t !== void 0 && t !== "" && t !== null) {
842
+ const c = `${e.space}/resources/v1/dslc/versiongraph?withThumbnail=0&withIsLastVersion=0&withAttributes=0&withCopyFrom=0&tenant=${e.tenant}`;
843
+ N(
844
+ e.space,
845
+ "ESPACE COMMUN",
846
+ ["VPLMProjectLeader", "VPLMCreator"],
847
+ void 0,
848
+ (a) => e.ctx = a,
849
+ (a) => {
850
+ console.log("onError =>", a);
851
+ }
852
+ );
853
+ let r = {
854
+ method: "POST",
855
+ headers: {
856
+ securitycontext: "ctx::" + e.ctx,
857
+ ENO_CSRF_TOKEN: e.token,
858
+ Accept: "application/json",
859
+ "Content-Type": "application/json"
860
+ },
861
+ data: JSON.stringify({
862
+ graphRequests: [
863
+ {
864
+ id: t
865
+ }
866
+ ]
867
+ }),
868
+ type: "json",
869
+ onComplete(a) {
870
+ s && s(a);
871
+ },
872
+ onFailure(a) {
873
+ n && n(a);
874
+ }
875
+ };
876
+ f(c, r);
877
+ }
878
+ });
879
+ }
880
+ function Ae(e, t, s = void 0, n = void 0) {
881
+ return new Promise((i) => {
882
+ if (e.token === "" && C(e), t !== void 0 && t !== "" && t !== null) {
883
+ const c = `${e.space}/resources/lifecycle/revise/prepare_revise_maskattributes?tenant=${e.tenant}`;
884
+ N(
885
+ e.space,
886
+ "ESPACE COMMUN",
887
+ ["VPLMProjectLeader", "VPLMCreator"],
888
+ void 0,
889
+ (a) => e.ctx = a,
890
+ (a) => {
891
+ console.log("onError =>", a);
892
+ }
893
+ );
894
+ let r = {
895
+ method: "POST",
896
+ headers: {
897
+ SecurityContext: "ctx::" + e.ctx,
898
+ ENO_CSRF_TOKEN: e.token,
899
+ Accept: "application/json",
900
+ "Content-Type": "application/json"
901
+ },
902
+ data: JSON.stringify({
903
+ data: [
904
+ {
905
+ "attribute[PLMReference.V_versionComment]": null,
906
+ physicalid: t,
907
+ type: "Document",
908
+ tenant: e.tenant,
909
+ objectId: t,
910
+ policy: "Document Release",
911
+ availableSemantic: ["E", "LAST", "NEW", "DUP"]
912
+ }
913
+ ]
914
+ }),
915
+ type: "json",
916
+ onComplete(a) {
917
+ s && s(a);
918
+ },
919
+ onFailure(a) {
920
+ n && n(a);
921
+ }
922
+ };
923
+ f(c, r);
924
+ }
925
+ });
926
+ }
927
+ function Re(e, t, s, n = void 0, i = void 0) {
928
+ return new Promise((c) => {
929
+ if (e.token === "" && C(e), t !== void 0 && t !== "" && t !== null) {
930
+ const r = `${e.space}/resources/lifecycle/revise/major?tenant=${e.tenant}`;
931
+ N(
932
+ e.space,
933
+ "ESPACE COMMUN",
934
+ ["VPLMProjectLeader", "VPLMCreator"],
935
+ void 0,
936
+ (o) => e.ctx = o,
937
+ (o) => {
938
+ console.log("onError =>", o);
939
+ }
940
+ );
941
+ let a = {
942
+ method: "POST",
943
+ headers: {
944
+ securitycontext: "ctx::" + e.ctx,
945
+ ENO_CSRF_TOKEN: e.token,
946
+ Accept: "application/json",
947
+ "Content-Type": "application/json"
948
+ },
949
+ data: JSON.stringify({
950
+ data: [
951
+ {
952
+ physicalid: t,
953
+ proposedRevision: s,
954
+ modifiedAttributes: {
955
+ revision: s
956
+ }
957
+ }
958
+ ],
959
+ folderid: null,
960
+ notificationTimeout: 600
961
+ }),
962
+ type: "json",
963
+ onComplete(o) {
964
+ n && n(o);
965
+ },
966
+ onFailure(o) {
967
+ i && i(o);
968
+ }
969
+ };
970
+ f(r, a);
971
+ }
972
+ });
973
+ }
974
+ //!SECTION
975
+ function T(e, t = void 0, s = void 0) {
976
+ const n = e.space + "/api/index/tk";
977
+ f(n, {
978
+ onComplete(i, c, r) {
979
+ const a = JSON.parse(i);
980
+ t && (e.token = a?.result?.ServerToken, t(a));
981
+ },
982
+ onFailure(i) {
983
+ s && s(i);
984
+ }
985
+ });
986
+ }
987
+ function ve(e, t = void 0, s = void 0) {
988
+ const n = `${e.space}/api/exalead/whatsnew`, i = {
989
+ params: {
990
+ community_id: null,
991
+ hash_key: null,
992
+ legacyFormat: !1,
993
+ nresults: 1,
994
+ query: "#all",
995
+ start: 0
996
+ }
997
+ };
998
+ T(e, (c) => {
999
+ f(n, {
1000
+ method: "POST",
1001
+ headers: {
1002
+ "X-DS-SWYM-CSRFTOKEN": c.result.ServerToken,
1003
+ "Content-type": "application/json;charset=UTF-8",
1004
+ Accept: "application/json"
1005
+ },
1006
+ data: JSON.stringify(i),
1007
+ type: "json",
1008
+ onComplete(r, a) {
1009
+ t && t(r, a);
1010
+ },
1011
+ onFailure(r, a) {
1012
+ s && s(r, a);
1013
+ }
1014
+ });
1015
+ });
1016
+ }
1017
+ function je(e, t = void 0, s = void 0) {
1018
+ const n = `${e.space}/api/Recommendation/getpeoplefamiliartocurrentuser`, i = {
1019
+ params: {
1020
+ idsToFilterArr: [],
1021
+ mode: "offline",
1022
+ limit: 30,
1023
+ itemType: "User",
1024
+ maxNbOfCommonElements: "5"
1025
+ }
1026
+ };
1027
+ T(e, (c) => {
1028
+ f(n, {
1029
+ method: "POST",
1030
+ headers: {
1031
+ "X-DS-SWYM-CSRFTOKEN": c.result.ServerToken,
1032
+ "Content-type": "application/json;charset=UTF-8",
1033
+ Accept: "application/json"
1034
+ },
1035
+ data: JSON.stringify(i),
1036
+ type: "json",
1037
+ onComplete(r, a) {
1038
+ const o = r.result.hits.map((d) => ({ login: d.login, fullName: d.name }));
1039
+ t && t(o, r);
1040
+ },
1041
+ onFailure(r, a) {
1042
+ s && s(r, a);
1043
+ }
1044
+ });
1045
+ });
1046
+ }
1047
+ function B(e, t = void 0, s = void 0) {
1048
+ const n = e.space + "/api/user/getcurrent/";
1049
+ T(
1050
+ e,
1051
+ (i) => {
1052
+ f(n, {
1053
+ method: "GET",
1054
+ headers: { "X-DS-SWYM-CSRFTOKEN": i.result.ServerToken },
1055
+ onComplete(c, r, a) {
1056
+ const o = JSON.parse(c);
1057
+ t && t(o.result);
1058
+ },
1059
+ onFailure(c) {
1060
+ s && s(c);
1061
+ }
1062
+ });
1063
+ },
1064
+ s
1065
+ );
1066
+ }
1067
+ function Ie(e, t, s = void 0, n = void 0) {
1068
+ const i = e.space + "/api/user/find/login/" + t;
1069
+ T(
1070
+ e,
1071
+ (c) => {
1072
+ f(i, {
1073
+ method: "GET",
1074
+ headers: { "X-DS-SWYM-CSRFTOKEN": c.result.ServerToken },
1075
+ onComplete(r, a, o) {
1076
+ const d = JSON.parse(r);
1077
+ s && s(d);
1078
+ },
1079
+ onFailure(r) {
1080
+ n && n(r);
1081
+ }
1082
+ });
1083
+ },
1084
+ n
1085
+ );
1086
+ }
1087
+ function xe(e, t = void 0, s = void 0) {
1088
+ I(
1089
+ null,
1090
+ (n) => {
1091
+ let i = [], c = [], r, a = {};
1092
+ for (let o of n)
1093
+ "3DSpace" in o && (c.push({
1094
+ label: `${o.displayName} ( ${o.platformId} )`,
1095
+ value: `${c.length}`
1096
+ }), c.sort(), i.push(o));
1097
+ for (let [o, d] of i.entries())
1098
+ d.platformId === e.tenant && (a = d, r = o);
1099
+ U.addPreference({
1100
+ name: "_CurrentTenantID_",
1101
+ type: "list",
1102
+ label: "Tenant",
1103
+ defaultValue: r,
1104
+ options: c
1105
+ }), Object.keys(a).length > 0, N(
1106
+ e.space,
1107
+ "ESPACE COMMUN",
1108
+ // "B3-R&D" || "ESPACE COMMUN",
1109
+ ["VPLMProjectLeader", "VPLMCreator"],
1110
+ void 0,
1111
+ (o) => e.ctx = o,
1112
+ (o) => {
1113
+ console.log("on Error CTX =>", o);
1114
+ }
1115
+ ), B(
1116
+ e,
1117
+ (o) => {
1118
+ t && t(o, a);
1119
+ },
1120
+ (o) => {
1121
+ s && s(o);
1122
+ }
1123
+ );
1124
+ },
1125
+ (n) => {
1126
+ console.log("** _getPlatformServices Erreur **", n);
1127
+ }
1128
+ );
1129
+ }
1130
+ async function Pe(e, t, s) {
1131
+ const n = `${e.space}/resources/v1/application/CSRF`;
1132
+ f(n, {
1133
+ onComplete(i) {
1134
+ i = JSON.parse(i), t && t(i.csrf);
1135
+ },
1136
+ onFailure(i) {
1137
+ s && s(i);
1138
+ }
1139
+ });
1140
+ }
1141
+ function Me(e, t = void 0, s = void 0) {
1142
+ const n = {
1143
+ base: `${e.space}`,
1144
+ uri: "/resources/bps/cspaces",
1145
+ optTenant: `tenant=${e.tenant}`
1146
+ }, i = `${n.base}${n.uri}?${n.optTenant}`;
1147
+ f(i, {
1148
+ method: "GET",
1149
+ headers: {
1150
+ Accept: "application/json,text/javascript,*/*",
1151
+ "Content-Type": "application/ds-json"
1152
+ },
1153
+ onComplete(c, r) {
1154
+ const a = JSON.parse(c);
1155
+ t && t(a, r);
1156
+ },
1157
+ onFailure(c, r, a) {
1158
+ s && s(c, r, a);
1159
+ }
1160
+ });
1161
+ }
1162
+ function Le(e, t, s, n) {
1163
+ D(
1164
+ e.space,
1165
+ t,
1166
+ (i) => {
1167
+ f(i, {
1168
+ header: { ENO_CSRF_TOKEN: e.token },
1169
+ onComplete: (c) => {
1170
+ s && s(c);
1171
+ },
1172
+ onFailure: (c) => {
1173
+ console.log("error http", c), n && n(c);
1174
+ }
1175
+ });
1176
+ },
1177
+ (i) => {
1178
+ console.log("error file URL", i), n && n(i);
1179
+ }
1180
+ );
1181
+ }
1182
+ async function Ee(e, t, s = void 0, n = void 0) {
1183
+ return new Promise((i) => {
1184
+ D(e.space, t, (c) => {
1185
+ f(c, {
1186
+ onComplete: (r, a, o) => (i(JSON.parse(r)), s && s(JSON.parse(r), a, o), i),
1187
+ onFailure: (r, a, o) => {
1188
+ n && n(r, a, o), console.log(r, a?.errormsg);
1189
+ }
1190
+ });
1191
+ });
1192
+ });
1193
+ }
1194
+ function Je(e, t, s, n = void 0, i = void 0) {
1195
+ const c = new Blob([JSON.stringify(t)], { type: "text/plain" });
1196
+ k(
1197
+ e,
1198
+ s,
1199
+ (r) => {
1200
+ 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;
1201
+ V(
1202
+ e,
1203
+ s,
1204
+ a,
1205
+ c,
1206
+ o,
1207
+ (d) => {
1208
+ n && n(d);
1209
+ },
1210
+ (d) => {
1211
+ i && i(d);
1212
+ }
1213
+ );
1214
+ },
1215
+ (r) => {
1216
+ console.log("En cas d'erreur nous avons :", r), alert("Erreur lors de la sauvegarde, Veuillez réessayez"), i && i(r);
1217
+ }
1218
+ );
1219
+ }
1220
+ let P, M;
1221
+ const R = [];
1222
+ async function Ge(e, t = void 0, s = void 0) {
1223
+ console.log(
1224
+ `%c 3ds & objID ok ${e.space} et ${e.objID} *`,
1225
+ "color: green"
1226
+ ), e.objID && e.objID !== "" ? k(
1227
+ e.space,
1228
+ e.objID,
1229
+ (n) => {
1230
+ t && t(n.csrf.value);
1231
+ },
1232
+ (n) => {
1233
+ s && s(n);
1234
+ }
1235
+ ) : e.objID === null && C(e);
1236
+ }
1237
+ async function Ke(e, t = void 0, s = void 0) {
1238
+ await x(
1239
+ e,
1240
+ (n) => {
1241
+ const i = {};
1242
+ i.obj = n, z(
1243
+ e,
1244
+ (c) => {
1245
+ i.datas = c, t && t(i);
1246
+ },
1247
+ (c) => {
1248
+ s && s(c);
1249
+ }
1250
+ );
1251
+ },
1252
+ (n) => {
1253
+ s && s(n);
1254
+ }
1255
+ );
1256
+ }
1257
+ function z(e, t = void 0, s = void 0) {
1258
+ const n = [];
1259
+ e.objIds.forEach((i, c) => {
1260
+ x(
1261
+ e,
1262
+ i.objId,
1263
+ (r) => {
1264
+ n.push({ [i.name]: r }), i.name === "dbProjets" && (P = r.affaires.map((a) => a.objectID), H(e, M)), c === e.objIds.length - 1 && t && t(n);
1265
+ },
1266
+ (r) => {
1267
+ s && s(r);
1268
+ }
1269
+ );
1270
+ });
1271
+ }
1272
+ function H(e, t, s = void 0, n = void 0) {
1273
+ X(
1274
+ e,
1275
+ P,
1276
+ (i) => {
1277
+ const c = [...t];
1278
+ c.find((r) => r.objectID === i.objectId).data = i.data, M = c, R.push(i.data), s && s(R);
1279
+ },
1280
+ (i) => {
1281
+ n && (n(i), console.log(i));
1282
+ }
1283
+ );
1284
+ }
1285
+ const q = "FA35FB9B177A280065800EA0000F599C", Q = [
1286
+ "swym",
1287
+ "3dspace",
1288
+ "drive",
1289
+ "usersgroup",
1290
+ "3dplan",
1291
+ "dashboard"
1292
+ ], L = {
1293
+ how: "ds6w:how",
1294
+ what: "ds6w:what",
1295
+ when: "ds6w:when",
1296
+ where: "ds6w:where",
1297
+ who: "ds6w:who",
1298
+ why: "ds6w:why"
1299
+ }, Z = {
1300
+ objId: q,
1301
+ pred: "who",
1302
+ order_by: "desc",
1303
+ tag: "testTag"
1304
+ };
1305
+ function Ve(e, t, s = void 0, n = void 0) {
1306
+ const { space: i, tenant: c } = e, { objId: r, pred: a, tag: o } = t, d = {
1307
+ uri: "/resources/6w/tags",
1308
+ otpCTX: "SecurityContext=preferred",
1309
+ optTenant: `tenant=${c}`
1310
+ }, l = `${i}${d.uri}?${d.otpCTX}&${d.optTenant}`, p = {
1311
+ tag: [
1312
+ {
1313
+ subject: [
1314
+ {
1315
+ uri: `pid://${r}`
1316
+ }
1317
+ ],
1318
+ predicate: L[a],
1319
+ object: {
1320
+ literal: o
1321
+ }
1322
+ }
1323
+ ]
1324
+ };
1325
+ f(l, {
1326
+ method: "PUT",
1327
+ headers: {
1328
+ "Content-Type": "application/json",
1329
+ Accept: "application/json"
1330
+ },
1331
+ data: JSON.stringify(p),
1332
+ onComplete(u) {
1333
+ JSON.parse(u);
1334
+ const m = {};
1335
+ setTimeout(() => {
1336
+ K(
1337
+ e,
1338
+ r,
1339
+ (g) => {
1340
+ 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;
1341
+ m.name = h, m.ext = S, m.createBy = y, t.info = { ...m }, ee(
1342
+ e,
1343
+ t,
1344
+ (_) => {
1345
+ s && s(_);
1346
+ },
1347
+ (_) => {
1348
+ n && n(_);
1349
+ }
1350
+ );
1351
+ },
1352
+ (g, h) => {
1353
+ const S = g;
1354
+ S.msg = h.errormsg, S.errCode = h.errorcode, console.log("❌ sendDirectMessage => ", S), n && n(S);
1355
+ }
1356
+ );
1357
+ }, 2e3);
1358
+ },
1359
+ onFailure(u, m) {
1360
+ const g = u;
1361
+ g.msg = m.errormsg, g.errCode = m.errorcode, console.log("❌ sendDirectMessage => ", g), n && n(g);
1362
+ }
1363
+ });
1364
+ }
1365
+ function ee(e, t, s = void 0, n = void 0) {
1366
+ console.log("obj ", t);
1367
+ const i = t.info.name, c = {
1368
+ baseUrl: `https://${e.tenant.toLowerCase()}-eu1-fedsearch.3dexperience.3ds.com`,
1369
+ uri: "/federated/search"
1370
+ }, r = `${c.baseUrl}${c.uri}`, a = {
1371
+ "Content-Type": "application/json",
1372
+ Accept: "application/json,text/javascript,*/*"
1373
+ }, o = j(), d = {
1374
+ with_indexing_date: !0,
1375
+ with_synthesis: !0,
1376
+ with_nls: !1,
1377
+ label: `3DSearch-${e.currentUser.username}-AjoutDeTagBeam-${o}`,
1378
+ locale: "fr",
1379
+ select_predicate: [
1380
+ "ds6w:label",
1381
+ "ds6w:type",
1382
+ "ds6w:description",
1383
+ "ds6w:identifier",
1384
+ "ds6w:modified",
1385
+ "ds6w:created",
1386
+ "ds6wg:revision",
1387
+ "ds6w:status",
1388
+ "ds6w:responsible",
1389
+ "owner",
1390
+ "ds6w:responsibleUid",
1391
+ "ds6wg:filesize",
1392
+ "ds6w:project",
1393
+ "ds6w:dataSource",
1394
+ "ds6w:community",
1395
+ "ds6w:originator",
1396
+ "dsgeo:referential",
1397
+ "ds6w:lastModifiedBy",
1398
+ "ds6w:repository",
1399
+ "dcterms:title",
1400
+ "dcterms:description",
1401
+ "ds6w:containerUid"
1402
+ ],
1403
+ with_synthesis_hierarchical: !0,
1404
+ select_file: ["icon", "thumbnail_2d"],
1405
+ query: i,
1406
+ specific_source_parameter: {
1407
+ "3dspace": {
1408
+ 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)'
1409
+ },
1410
+ drive: {
1411
+ additional_query: ' AND NOT ([flattenedtaxonomies]:"types/DriveNode" AND ( [current]:"Trashed" OR [policy]:"Drive File Iteration") )'
1412
+ }
1413
+ },
1414
+ select_exclude_synthesis: ["ds6w:what/ds6w:topic"],
1415
+ order_by: Z.order_by,
1416
+ order_field: "relevance",
1417
+ select_snippets: [
1418
+ "ds6w:snippet",
1419
+ "ds6w:label:snippet",
1420
+ "ds6w:responsible:snippet",
1421
+ "ds6w:community:snippet",
1422
+ "swym:message_text:snippet"
1423
+ ],
1424
+ nresults: 40,
1425
+ start: "0",
1426
+ source: Q,
1427
+ tenant: e.tenant,
1428
+ login: {
1429
+ "3dspace": {
1430
+ SecurityContext: e.ctx
1431
+ }
1432
+ }
1433
+ };
1434
+ console.log("dataPattern => ", d), f(r, {
1435
+ method: "POST",
1436
+ headers: a,
1437
+ data: JSON.stringify(d),
1438
+ onComplete(l) {
1439
+ const p = JSON.parse(l);
1440
+ s(p);
1441
+ },
1442
+ onFailure(l, p) {
1443
+ const u = l;
1444
+ 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);
1445
+ }
1446
+ });
1447
+ }
1448
+ function We(e, t, s = void 0, n = void 0) {
1449
+ const { objId: i, pred: c, tag: r } = t, a = {
1450
+ uri: "/resources/6w/tags",
1451
+ otpCTX: "SecurityContext=preferred",
1452
+ optTenant: `tenant=${e.tenant}`
1453
+ }, o = `${e.space}${a.uri}?${a.otpCTX}&${a.optTenant}`, d = {
1454
+ tag: [
1455
+ {
1456
+ subject: [
1457
+ {
1458
+ uri: `pid://${i}`
1459
+ }
1460
+ ],
1461
+ predicate: L[c],
1462
+ object: {
1463
+ literal: r
1464
+ }
1465
+ }
1466
+ ]
1467
+ };
1468
+ f(o, {
1469
+ method: "DELETE",
1470
+ data: JSON.stringify(d),
1471
+ headers: {
1472
+ "Content-Type": "application/json",
1473
+ Accept: "application/json,text/javascript,*/*"
1474
+ },
1475
+ onComplete(l) {
1476
+ s && s(l);
1477
+ },
1478
+ onFailure(l, p) {
1479
+ const u = l;
1480
+ u.msg = p.errormsg, u.errCode = p.errorcode, console.log("❌ sendDirectMessage => ", u), n && n(u);
1481
+ }
1482
+ });
1483
+ }
1484
+ function Xe(e, t = "", s = void 0, n = void 0) {
1485
+ const { space: i } = e;
1486
+ if (t === "")
1487
+ return;
1488
+ const c = {
1489
+ uri: "/enovia/resources/v1/modeler/documents"
1490
+ }, r = {
1491
+ "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
1492
+ Accept: "application/json,text/javascript,*/*"
1493
+ }, 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}`;
1494
+ f(a, {
1495
+ method: "POST",
1496
+ headers: r,
1497
+ data: o,
1498
+ onComplete(d) {
1499
+ s && s(JSON.parse(d));
1500
+ },
1501
+ onFailure(d, l) {
1502
+ const p = d;
1503
+ p.msg = l.error, n && n(p);
1504
+ }
1505
+ });
1506
+ }
1507
+ function Ye(e, t = void 0, s = void 0) {
1508
+ const n = {
1509
+ base: e.space,
1510
+ uri: "/api/community/listmycommunities",
1511
+ limit: `/limit/${e.limit ? e.limit : 128}`,
1512
+ page: `/page/${e.page ? e.page : "1"}`
1513
+ }, i = `${n.base}${n.uri}${n.limit}${n.page}`, c = [];
1514
+ T(e, (r) => {
1515
+ f(i, {
1516
+ method: "GET",
1517
+ headers: {
1518
+ "X-DS-SWYM-CSRFTOKEN": r.result.ServerToken
1519
+ },
1520
+ onComplete(a, o, d) {
1521
+ const p = JSON.parse(a).result;
1522
+ let u = 0;
1523
+ p.forEach((m) => {
1524
+ const g = {
1525
+ description: m.description,
1526
+ id: m.id,
1527
+ title: m.title,
1528
+ owner: m.owner,
1529
+ role: m.role,
1530
+ access: m.access
1531
+ };
1532
+ te(
1533
+ e,
1534
+ m.id,
1535
+ (h) => {
1536
+ u++, g.members = h, c.push(g), u === p.length && t && t(c);
1537
+ },
1538
+ (h) => s(h)
1539
+ );
1540
+ });
1541
+ },
1542
+ onFailure(a, o) {
1543
+ const d = a;
1544
+ d.status = o.status, d.response = o.errormsg, s && s(d);
1545
+ }
1546
+ });
1547
+ });
1548
+ }
1549
+ function te(e, t, s, n) {
1550
+ const i = `${e.space}/api/community/listmembers`, c = {
1551
+ params: {
1552
+ page: e.page ? e.page : 1,
1553
+ limit: e.limit ? e.limit : 50,
1554
+ community_id: t
1555
+ }
1556
+ };
1557
+ T(e, (r) => {
1558
+ f(i, {
1559
+ method: "POST",
1560
+ headers: {
1561
+ "Content-type": "application/json;charset=UTF-8",
1562
+ Accept: "application/json",
1563
+ "X-DS-SWYM-CSRFTOKEN": r.result.ServerToken
1564
+ },
1565
+ data: JSON.stringify(c),
1566
+ type: "json",
1567
+ onComplete(a, o, d) {
1568
+ s && s(a);
1569
+ },
1570
+ onFailure(a, o) {
1571
+ const d = a;
1572
+ d.status = o.status, d.response = o.errormsg, n && n(d);
1573
+ }
1574
+ });
1575
+ });
1576
+ }
1577
+ function Be(e, t = void 0, s = void 0) {
1578
+ const n = "YXdA5x4DSUKtlAi2wmnyTA";
1579
+ e.commu_id || (e.commu_id = n);
1580
+ const i = `${e.space}/api/v2/communities/${e.commu_id}/ideas/statuses`;
1581
+ T(e, (c) => {
1582
+ f(i, {
1583
+ method: "GET",
1584
+ headers: {
1585
+ "Content-type": "application/json;charset=UTF-8",
1586
+ Accept: "application/json",
1587
+ "X-DS-SWYM-CSRFTOKEN": c.result.ServerToken
1588
+ },
1589
+ onComplete(r) {
1590
+ const a = JSON.parse(r);
1591
+ t && t(a);
1592
+ },
1593
+ onFailure(r, a) {
1594
+ const o = r;
1595
+ o.status = a.status, o.response = a.errormsg, s && s(o);
1596
+ }
1597
+ });
1598
+ });
1599
+ }
1600
+ function ze(e, t, s = void 0, n = void 0) {
1601
+ const { listAllContacts: i, currentUser: c } = e;
1602
+ console.log("__listAllContacts", i.hits);
1603
+ const r = `${e.space}/api/directmessages`, a = {
1604
+ users: [c.login].concat(t.receipt)
1605
+ }, o = {
1606
+ id_msg: "",
1607
+ senderId: e.currentUser.login,
1608
+ senderName: `${e.currentUser.first_name} ${e.currentUser.last_name}`,
1609
+ msg: se(t.msg)
1610
+ };
1611
+ let d = !1;
1612
+ ne(
1613
+ a.users,
1614
+ (l) => {
1615
+ l !== void 0 && (o.id_msg = l.id, d = !0, v(e, o));
1616
+ },
1617
+ (l) => {
1618
+ d = !1, console.log("_3dSwym_findCommunityToInstantMSG callback", l), n && n(l), o.id_msg = "";
1619
+ }
1620
+ ), d === !1 && setTimeout(() => {
1621
+ d === !1 && T(e, (l) => {
1622
+ f(r, {
1623
+ method: "POST",
1624
+ headers: {
1625
+ "Content-Type": "application/json",
1626
+ Accept: "application/json",
1627
+ "X-DS-SWYM-CSRFTOKEN": l.result.ServerToken
1628
+ },
1629
+ data: JSON.stringify(a),
1630
+ type: "json",
1631
+ onComplete(p, u, m) {
1632
+ const g = p;
1633
+ g.reponse = JSON.parse(m.response), g.status = m.status, s && s(g), o.id_msg = g.result.id, v(e, o);
1634
+ },
1635
+ onFailure(p, u, m) {
1636
+ const g = p;
1637
+ g.msg = u.errormsg, g.status = u.status, n && n(g);
1638
+ }
1639
+ });
1640
+ });
1641
+ }, 500);
1642
+ }
1643
+ function ne(e, t, s, n) {
1644
+ const i = `${e.space}/api/directmessages/lite?with_favorites=false`;
1645
+ T(e, (c) => {
1646
+ f(i, {
1647
+ method: "GET",
1648
+ headers: {
1649
+ Accept: "application/json,text/javascript,*/*",
1650
+ "X-DS-SWYM-CSRFTOKEN": c.result.ServerToken
1651
+ },
1652
+ onComplete(r) {
1653
+ const a = JSON.parse(r), o = [];
1654
+ a.result.forEach((p) => {
1655
+ p.users = p.users.sort((u, m) => u.login.localeCompare(m.login)), p.users.length === t.length && o.push(p);
1656
+ });
1657
+ const d = t.sort(), l = o.find((p) => {
1658
+ const u = [];
1659
+ return p.users.forEach((m) => {
1660
+ u.push(m.login);
1661
+ }), JSON.stringify(u) === JSON.stringify(d);
1662
+ });
1663
+ s && l !== void 0 ? s(l) : (n || l === void 0) && n(l);
1664
+ },
1665
+ onFailure(r) {
1666
+ const a = r;
1667
+ a.msg = headers.errormsg, a.errCode = headers.errorcode, console.log("❌ sendDirectMessageLite => ", a), n && n(a);
1668
+ }
1669
+ });
1670
+ });
1671
+ }
1672
+ function v(e, t, s = void 0, n = void 0) {
1673
+ const i = {
1674
+ base: e.space,
1675
+ uri: "/api/community",
1676
+ id_msg: `${t.id_msg}`,
1677
+ endUri: "/instantmessages"
1678
+ }, c = `${i.base}${i.uri}/${i.id_msg}${i.endUri}`, r = {
1679
+ author: { login: t.senderId, displayName: t.senderName },
1680
+ accessState: null,
1681
+ commentUri: null,
1682
+ comments: null,
1683
+ endorsements: null,
1684
+ moderationState: null,
1685
+ parentCommentUri: null,
1686
+ richMessage: t.msg
1687
+ };
1688
+ console.log("_3dSwym_sendDirectMessageData url ", c), T(e, (a) => {
1689
+ f(c, {
1690
+ method: "POST",
1691
+ headers: {
1692
+ "Content-Type": "application/json",
1693
+ Accept: "application/json",
1694
+ "X-DS-SWYM-CSRFTOKEN": a.result.ServerToken
1695
+ },
1696
+ data: JSON.stringify(r),
1697
+ type: "json",
1698
+ onComplete(o, d, l) {
1699
+ const p = o;
1700
+ p.status = l.status, p.response = JSON.parse(l.response), console.log("✅ _3dSwym_sendDirectMessageData => ", p), s && s(p);
1701
+ },
1702
+ onFailure(o, d) {
1703
+ const l = o;
1704
+ l.msg = d.errormsg, l.errCode = d.errorcode, console.log("❌ sendDirectMessage => ", l), n && n(l);
1705
+ }
1706
+ });
1707
+ });
1708
+ }
1709
+ function se(e) {
1710
+ const t = (/* @__PURE__ */ new Date()).toLocaleDateString(), s = (/* @__PURE__ */ new Date()).toLocaleTimeString();
1711
+ return `<p>${e} </p>
4
1712
  <br/>
5
1713
  <hr/>
6
- <p><u>envoyer :</u>Le <b>${t} à ${s}</b></p>`}const Ve={title:"TEST DEV COMMUNITY IDEA",community_id:"YXdA5x4DSUKtlAi2wmnyTA",community_title:"TEST DEV COMMUNITY",idee_id:"THhRI8rlQNWKRxpv3Xqqug"};function We(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?.id!==void 0?c.id:r.id,message:qe(t.text_html),published:1}};w(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 Xe(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]}};w(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 Ye(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}};w(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=Ve,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}`;w(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 qe(e){return!e||e===""?`<h2><u>INFORMATIONS AFFAIRE :</u></h2>
1714
+ <p><u>envoyer :</u>Le <b>${t} à ${s}</b></p>`;
1715
+ }
1716
+ const ae = {
1717
+ title: "TEST DEV COMMUNITY IDEA",
1718
+ // titre du post
1719
+ community_id: "YXdA5x4DSUKtlAi2wmnyTA",
1720
+ // STATUT PROJETS - Phase commerciale, tenant PIVETEAU TEST
1721
+ community_title: "TEST DEV COMMUNITY",
1722
+ // Possibilité de recherche par titre de la communauté (option)
1723
+ idee_id: "THhRI8rlQNWKRxpv3Xqqug"
1724
+ // id de l'idee qui est créer au post (_3dSwym_postIdea)
1725
+ };
1726
+ function He(e, t, s = void 0, n = void 0) {
1727
+ const i = `${e.space}/api/idea/add`, c = e.swymCommunities.find(
1728
+ (o) => o.id === t.community_id
1729
+ ), r = e.swymCommunities.find(
1730
+ (o) => o.title.toLowerCase() === t.community_title.toLowerCase()
1731
+ ), a = {
1732
+ params: {
1733
+ title: t.title,
1734
+ // String, le nom de l'affaire
1735
+ community_id: c?.id !== void 0 ? c.id : r.id,
1736
+ // String, l'id de la communauté
1737
+ message: ie(t.text_html),
1738
+ // STRING => le contenue du message doit être au format HTML
1739
+ published: 1
1740
+ // 1 publier, 0 non publier
1741
+ }
1742
+ };
1743
+ T(e, (o) => {
1744
+ const d = {
1745
+ "Content-type": "application/json;charset=UTF-8",
1746
+ Accept: "application/json",
1747
+ "X-DS-SWYM-CSRFTOKEN": o.result.ServerToken
1748
+ };
1749
+ f(i, {
1750
+ method: "POST",
1751
+ headers: d,
1752
+ data: JSON.stringify(a),
1753
+ type: "json",
1754
+ onComplete(l, p, u) {
1755
+ const m = JSON.parse(l);
1756
+ m.status = u.status, m.response = u.response, s && s(m);
1757
+ },
1758
+ onFailure(l, p, u) {
1759
+ const m = l;
1760
+ m.status = p.status, m.response = p.errormsg, n && n(m);
1761
+ }
1762
+ });
1763
+ });
1764
+ }
1765
+ function qe(e, t, s = void 0, n = void 0) {
1766
+ const i = `${e.space}/api/idea/delete`, c = {
1767
+ params: {
1768
+ community_id: t.community_id,
1769
+ ideationIds: [t.idee_id]
1770
+ }
1771
+ };
1772
+ T(e, (r) => {
1773
+ f(i, {
1774
+ method: "POST",
1775
+ headers: {
1776
+ "Content-type": "application/json;charset=UTF-8",
1777
+ Accept: "application/json",
1778
+ "X-DS-SWYM-CSRFTOKEN": r.result.ServerToken
1779
+ },
1780
+ data: JSON.stringify(c),
1781
+ type: "json",
1782
+ onComplete(a, o, d) {
1783
+ s && s(a);
1784
+ },
1785
+ onFailure(a, o, d) {
1786
+ const l = a;
1787
+ l.status = o.status, l.response = o.errormsg, n && n(l);
1788
+ }
1789
+ });
1790
+ });
1791
+ }
1792
+ function Qe(e, t = "", s = void 0, n = void 0) {
1793
+ const i = e.tenant.toLowerCase() === "r1132101716373" ? "tFtz0G4MR6qNtKgJjNfTog" : e.tenant.toLowerCase() === "r1132101286859" ? "Qpv3HN-tTDOsU-7_c5DnDg" : "Template_d'idée_à_créer";
1794
+ t === "" && (t = i);
1795
+ const c = `${e.space}/api/idea/get`, r = {
1796
+ params: {
1797
+ id: t
1798
+ }
1799
+ };
1800
+ T(e, (a) => {
1801
+ f(c, {
1802
+ method: "POST",
1803
+ headers: {
1804
+ "Content-type": "application/json;charset=UTF-8",
1805
+ Accept: "application/json",
1806
+ "X-DS-SWYM-CSRFTOKEN": a.result.ServerToken
1807
+ },
1808
+ data: JSON.stringify(r),
1809
+ type: "json",
1810
+ onComplete(o) {
1811
+ const d = o;
1812
+ d.msg = d.result.message, s && s(d);
1813
+ },
1814
+ onFailure(o) {
1815
+ const d = o;
1816
+ d.status = headers.status, d.response = headers.errormsg, n && n(d);
1817
+ }
1818
+ });
1819
+ });
1820
+ }
1821
+ function Ze(e, t = ae, s = void 0, n = void 0) {
1822
+ const i = {
1823
+ uri: "/api/idea/list",
1824
+ comId: `/community_id/${e.tenant.toLowerCase() === "r1132101716373" ? t.community_id : "bgnIsG74SUWswyGzS6NC6g"}`,
1825
+ limit: `/limit/${t.limit ? t.limit : 10}`
1826
+ }, c = `${e.space}${i.uri}${i.comId}${i.limit}`;
1827
+ T(e, (r) => {
1828
+ f(c, {
1829
+ method: "GET",
1830
+ headers: {
1831
+ "X-DS-SWYM-CSRFTOKEN": r.result.ServerToken
1832
+ },
1833
+ onComplete(a) {
1834
+ const o = JSON.parse(a);
1835
+ s && s(o);
1836
+ },
1837
+ onFailure(a, o) {
1838
+ const d = a;
1839
+ d.status = o.status, d.response = o.errormsg, n && n(d);
1840
+ }
1841
+ });
1842
+ });
1843
+ }
1844
+ function ie(e) {
1845
+ return !e || e === "" ? `<h2><u>INFORMATIONS AFFAIRE :</u></h2>
7
1846
  <p><u>|⚠️<em> Merci de respecter l&#39;écriture des tags, en MAJUSCULES, nom complet, pas de caractères</em></u></p>
8
1847
  <p><u><em>|spéciaux, séparation par &#34;_&#34; si besoin !</em></u></p>
9
1848
  <p><strong>Référence client </strong>: <em>
@@ -75,4 +1914,80 @@ function w(e,t=void 0,s=void 0){const n=e.space+"/api/index/tk";f(n,{onComplete(
75
1914
  <tr><td><strong>Service études de prix</strong></td><td><br /></td></tr>
76
1915
  </tbody></table>
77
1916
  <p>
78
- </p>`:e}function He(e){const t="Hello "+e;return console.log(t),t}exports.UUID=$;exports._3DSpace_Create_Doc=Se;exports._3DSpace_csrf=C;exports._3DSpace_download_doc=I;exports._3DSpace_download_multidoc=J;exports._3DSpace_file_update=L;exports._3DSpace_file_update_csr=E;exports._3DSpace_file_url=U;exports._3DSpace_file_url_csr=_e;exports._3DSpace_get_csrf=N;exports._3DSpace_get_docInfo=P;exports._3DSpace_get_downloadTicket_multidoc=G;exports._3DSpace_get_securityContexts=O;exports._3DSpace_lifecycle_changeRevision=Ce;exports._3DSpace_lifecycle_changeState=ye;exports._3DSpace_lifecycle_getGraph=we;exports._3DSpace_lifecycle_getNextRevision=Te;exports._3DSpace_lifecycle_getNextStates=he;exports._3DSwim_getAllCommunities=Ee;exports._3DSwim_getMembersCommunity=H;exports._3DSwym_buildDirectMessage=Ge;exports._3DSwym_deleteIdea=Xe;exports._3DSwym_findCommunityToInstantMSG=z;exports._3DSwym_getAllNews=De;exports._3DSwym_getFamiliarPeople=Oe;exports._3DSwym_getIdeaStatusMaturity=Je;exports._3DSwym_getSWYMIdea=Ye;exports._3DSwym_get_AllSWYMIdeas=Be;exports._3DSwym_get_currentUser=K;exports._3DSwym_get_findUser=Ne;exports._3DSwym_get_version=w;exports._3DSwym_postIdea=We;exports._3DSwym_sendMessageData=A;exports._AppMngt_get_info_user=ce;exports._AppMngt_get_users=re;exports._getPlateformInfos=k;exports._getPlatformServices=v;exports._httpCallAuthenticated=f;exports._setDraggable=se;exports._setDroppable=ie;exports._setupTagger=ae;exports.addTagToDoc=Me;exports.compass_getListAdditionalApps=oe;exports.couleurs=M;exports.createUserGroups=de;exports.dataMixing=B;exports.deleteUserGroups=ue;exports.findAdresse=ee;exports.getActiveServices=V;exports.getAllContextSecurity=Ue;exports.getCSRFToken=be;exports.getCommunes=Z;exports.getComplementUG=le;exports.getDataFrom3DSpace=Fe;exports.getDataFromGouvFr=te;exports.getDatasByTenant=ve;exports.getDatasFrom3DSpace=Y;exports.getDownloadDocument=ke;exports.getInfoDocTags=Le;exports.getUserGroupsList=pe;exports.getUsersGroupRules=x;exports.get_3DSpace_csrf=$e;exports.patchUserGroups=fe;exports.patchUserGroupsControl=me;exports.pushDataIn3DSpace=Ae;exports.readUserGroupControl=ge;exports.removeTagToDoc=Pe;exports.sayHello=He;exports.updateEvent=ne;
1917
+ </p>` : e;
1918
+ }
1919
+ function et(e) {
1920
+ const t = "Hello " + e;
1921
+ return console.log(t), t;
1922
+ }
1923
+ export {
1924
+ j as UUID,
1925
+ Fe as _3DSpace_Create_Doc,
1926
+ C as _3DSpace_csrf,
1927
+ x as _3DSpace_download_doc,
1928
+ X as _3DSpace_download_multidoc,
1929
+ V as _3DSpace_file_update,
1930
+ W as _3DSpace_file_update_csr,
1931
+ D as _3DSpace_file_url,
1932
+ ke as _3DSpace_file_url_csr,
1933
+ k as _3DSpace_get_csrf,
1934
+ K as _3DSpace_get_docInfo,
1935
+ Y as _3DSpace_get_downloadTicket_multidoc,
1936
+ N as _3DSpace_get_securityContexts,
1937
+ Re as _3DSpace_lifecycle_changeRevision,
1938
+ $e as _3DSpace_lifecycle_changeState,
1939
+ De as _3DSpace_lifecycle_getGraph,
1940
+ Ae as _3DSpace_lifecycle_getNextRevision,
1941
+ Ue as _3DSpace_lifecycle_getNextStates,
1942
+ Ye as _3DSwim_getAllCommunities,
1943
+ te as _3DSwim_getMembersCommunity,
1944
+ ze as _3DSwym_buildDirectMessage,
1945
+ qe as _3DSwym_deleteIdea,
1946
+ ne as _3DSwym_findCommunityToInstantMSG,
1947
+ ve as _3DSwym_getAllNews,
1948
+ je as _3DSwym_getFamiliarPeople,
1949
+ Be as _3DSwym_getIdeaStatusMaturity,
1950
+ Qe as _3DSwym_getSWYMIdea,
1951
+ Ze as _3DSwym_get_AllSWYMIdeas,
1952
+ B as _3DSwym_get_currentUser,
1953
+ Ie as _3DSwym_get_findUser,
1954
+ T as _3DSwym_get_version,
1955
+ He as _3DSwym_postIdea,
1956
+ v as _3DSwym_sendMessageData,
1957
+ ye as _AppMngt_get_info_user,
1958
+ Se as _AppMngt_get_users,
1959
+ A as _getPlateformInfos,
1960
+ I as _getPlatformServices,
1961
+ f as _httpCallAuthenticated,
1962
+ fe as _setDraggable,
1963
+ ge as _setDroppable,
1964
+ me as _setupTagger,
1965
+ Ve as addTagToDoc,
1966
+ he as compass_getListAdditionalApps,
1967
+ J as couleurs,
1968
+ _e as createUserGroups,
1969
+ H as dataMixing,
1970
+ Ce as deleteUserGroups,
1971
+ le as findAdresse,
1972
+ xe as getActiveServices,
1973
+ Me as getAllContextSecurity,
1974
+ Pe as getCSRFToken,
1975
+ de as getCommunes,
1976
+ Te as getComplementUG,
1977
+ Le as getDataFrom3DSpace,
1978
+ pe as getDataFromGouvFr,
1979
+ Ke as getDatasByTenant,
1980
+ z as getDatasFrom3DSpace,
1981
+ Ee as getDownloadDocument,
1982
+ Xe as getInfoDocTags,
1983
+ we as getUserGroupsList,
1984
+ G as getUsersGroupRules,
1985
+ Ge as get_3DSpace_csrf,
1986
+ Oe as patchUserGroups,
1987
+ Ne as patchUserGroupsControl,
1988
+ Je as pushDataIn3DSpace,
1989
+ be as readUserGroupControl,
1990
+ We as removeTagToDoc,
1991
+ et as sayHello,
1992
+ ue as updateEvent
1993
+ };