@beam3_dev/api_module 0.0.17 → 0.0.18
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.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/wb3Api.umd.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(m,x){typeof exports=="object"&&typeof module<"u"?module.exports=x(require("uuid"),require("luxon"),require("@widget-lab/3ddashboard-utils")):typeof define=="function"&&define.amd?define(["uuid","luxon","@widget-lab/3ddashboard-utils"],x):(m=typeof globalThis<"u"?globalThis:m||self,m["@beam3_dev/api_module"]=x(m.uuid,m.luxon,m
|
|
2
|
-
function
|
|
1
|
+
(function(m,x){typeof exports=="object"&&typeof module<"u"?module.exports=x(require("uuid"),require("luxon"),require("@widget-lab/3ddashboard-utils")):typeof define=="function"&&define.amd?define(["uuid","luxon","@widget-lab/3ddashboard-utils"],x):(m=typeof globalThis<"u"?globalThis:m||self,m["@beam3_dev/api_module"]=x(m.uuid,m.luxon,m._3ddashboardUtils))})(this,function(m,x,h){"use strict";function _(e,t){h.requirejs(["DS/WAFData/WAFData"],i=>{i.authenticatedRequest(e,t)})}function w(e,t=void 0,i=void 0){h.requirejs(["DS/i3DXCompassServices/i3DXCompassServices"],r=>{(!e||e==="")&&(e=h.widget.getValue("PlatFormInstanceId")),(!e||e==="")&&(e=void 0),r.getPlatformServices({platformId:e,onComplete:t,onFailure:i})}),v(),t&&t(v())}function v(){let e={};return h.requirejs(["DS/PlatformAPI/PlatformAPI"],t=>{const i=t.getTenant(),r=t.getUser(),o=t.getAllApplicationConfigurations(),l=t.getWidgetTenant(),d=t.getApplicationConfiguration("com.3ds.wp.passport.cors");e={tenant:i,user:r,appsConfiguration:o,widgetTenant:l,appConf:d}}),console.log("%cRETOUR API :","color:blue",e),e}const P=new FileReader;P.onload=()=>console.log(P.result);function A(e,t=void 0,i=void 0,r=void 0,o=void 0,l=void 0){const d=`${e.space}/resources/modeler/pno/person?current=true&select=preferredcredentials&select=collabspaces&xrequestedwith=xmlhttprequest`;_(d,{method:"GET",onComplete(s){const n=JSON.parse(s);let f="",C,S,c;if(t){let y=n.collabspaces.find(p=>p.title===t);if(y){C=t;let p=y.couples;p=p.filter((a,u,g)=>u===g.findIndex(T=>T.organization.pid===a.organization.pid&&T.role.pid===a.role.pid)),i&&(Array.isArray(i)?i.forEach(a=>{c||p.forEach(u=>{if(a===u.role.name&&r===u.organization.title)c=a,S=r;else if(a===u.role.name){let g=p.filter(T=>T.role.name===a);g.length===1?(c=g[0].role.name,S=g[0].organization.title):l(g)}})}):p.forEach(a=>{if(i===a.role.name&&r===a.organization.title)c=i,S=r;else if(i===a.role.name){let u=p.filter(g=>g.role.name===i);u.length===1?(c=u[0].role.name,S=u[0].organization.title):l(u)}}))}}C&&S&&c?(f=c+"."+S+"."+C,o(f)):n.preferredcredentials?(f=n.preferredcredentials.role.name+"."+n.preferredcredentials.organization.title+"."+n.preferredcredentials.collabspace.title,o(f)):l&&(f=c+"."+S+"."+C,l(f))},onFailure(s){console.log("Erreur de récupération du contexte de sécurité. => ",s)}})}//!SECTION
|
|
2
|
+
function q(e,t=void 0,i=void 0){const r=e.space+"/api/index/tk";_(r,{onComplete(o,l,d){var n;const s=JSON.parse(o);t&&(e.token=(n=s==null?void 0:s.result)==null?void 0:n.ServerToken,t(s))},onFailure(o){i&&i(o)}})}function D(e,t=void 0,i=void 0){const r=e.space+"/api/user/getcurrent/";q(e,o=>{_(r,{method:"GET",headers:{"X-DS-SWYM-CSRFTOKEN":o.result.ServerToken},onComplete(l,d,s){const n=JSON.parse(l);t&&t(n.result)},onFailure(l){i&&i(l)}})},i)}function O(e,t=void 0,i=void 0){w(null,r=>{let o=[],l=[],d,s={};for(let n of r)"3DSpace"in n&&(l.push({label:`${n.displayName} ( ${n.platformId} )`,value:`${l.length}`}),l.sort(),o.push(n));for(let[n,f]of o.entries())f.platformId===e.tenant&&(s=f,d=n);h.widget.addPreference({name:"_CurrentTenantID_",type:"list",label:"Tenant",defaultValue:d,options:l}),Object.keys(s).length>0,A(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,n=>e.ctx=n,n=>{console.log("on Error CTX =>",n)}),D(e,n=>{t&&t(n,s)},n=>{i&&i(n)})},r=>{console.log("** _getPlatformServices Erreur **",r)})}module.exports={getActiveServices:O};function F(e){const t="Hello "+e;return console.log(t),t}return{sayHello:F}});
|