@beam3_dev/api_module 0.0.10 → 0.0.12

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,8 +1,8 @@
1
- import { v4 as te } from "uuid";
1
+ import { v4 as ee } from "uuid";
2
2
  import { DateTime as F } from "luxon";
3
3
  import { requirejs as N, widget as R } from "@widget-lab/3ddashboard-utils";
4
4
  function D() {
5
- return te();
5
+ return ee();
6
6
  }
7
7
  const M = {
8
8
  b3M3Yellow: "#FFB300",
@@ -34,7 +34,7 @@ const M = {
34
34
  b3Edit8: "#616161",
35
35
  b3Edit9: "#795548"
36
36
  };
37
- async function ne(e, t = void 0, s = void 0) {
37
+ async function te(e, t = void 0, s = void 0) {
38
38
  const n = parseInt(e);
39
39
  await fetch(
40
40
  "https://apicarto.ign.fr/api/codes-postaux/communes/" + n,
@@ -50,7 +50,7 @@ async function ne(e, t = void 0, s = void 0) {
50
50
  s && s(i), console.error("Erreur : " + i);
51
51
  });
52
52
  }
53
- async function se(e, t = void 0, s = void 0) {
53
+ async function ne(e, t = void 0, s = void 0) {
54
54
  e = encodeURIComponent(e), await fetch(
55
55
  "https://api-adresse.data.gouv.fr/search/?q=" + e + "&limit=15",
56
56
  {
@@ -65,7 +65,7 @@ async function se(e, t = void 0, s = void 0) {
65
65
  s && s(n), console.error("Erreur : " + n);
66
66
  });
67
67
  }
68
- async function ae(e, t = M) {
68
+ async function se(e, t = M) {
69
69
  let s = F.now().year;
70
70
  const n = e, i = [], c = (a) => {
71
71
  for (let o in a)
@@ -100,7 +100,7 @@ async function ae(e, t = M) {
100
100
  return a;
101
101
  })();
102
102
  }
103
- async function ie(e, t, s = !0) {
103
+ async function ae(e, t, s = !0) {
104
104
  const n = e.events.findIndex((i) => i.uuid === t.uuid);
105
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
106
  }
@@ -109,12 +109,12 @@ function f(e, t) {
109
109
  s.authenticatedRequest(e, t);
110
110
  });
111
111
  }
112
- function oe(e, t, s) {
112
+ function ie(e, t, s) {
113
113
  N(["DS/DataDragAndDrop/DataDragAndDrop"], (n) => {
114
114
  n.draggable(e, { data: t, start: s });
115
115
  });
116
116
  }
117
- function re(e, t = void 0) {
117
+ function oe(e, t = void 0) {
118
118
  N(["DS/TagNavigatorProxy/TagNavigatorProxy"], (s) => {
119
119
  let n;
120
120
  n === void 0 && (n = s.createProxy({
@@ -123,7 +123,7 @@ function re(e, t = void 0) {
123
123
  }), t !== void 0 && n.addEvent("onFilterSubjectsChange", t)), n.setSubjectsTags(e);
124
124
  });
125
125
  }
126
- function ce(e, t) {
126
+ function re(e, t) {
127
127
  N(["DS/DataDragAndDrop/DataDragAndDrop"], (s) => {
128
128
  s.droppable(e, { drop: t });
129
129
  });
@@ -155,7 +155,7 @@ function $() {
155
155
  };
156
156
  }), console.log("%cRETOUR API :", "color:blue", e), e;
157
157
  }
158
- function de(e, t, s) {
158
+ function ce(e, t, s) {
159
159
  const n = {
160
160
  base: `${e.space}`,
161
161
  uri: "/resources/AppsMngt/api/custom/applications",
@@ -181,7 +181,7 @@ function de(e, t, s) {
181
181
  }
182
182
  });
183
183
  }
184
- function le(e, t = void 0, s = void 0) {
184
+ function de(e, t = void 0, s = void 0) {
185
185
  let n = `${e.space}/resources/AppsMngt/user?platform=${e.tenant}&limit=-1`;
186
186
  f(n, {
187
187
  onComplete(i, c, r) {
@@ -194,7 +194,7 @@ function le(e, t = void 0, s = void 0) {
194
194
  }
195
195
  });
196
196
  }
197
- function pe(e, t, s = void 0, n = void 0) {
197
+ function le(e, t, s = void 0, n = void 0) {
198
198
  let i = `${e.space}/resources/AppsMngt/user?platform=${e.tenant}&id=${t}`;
199
199
  f(i, {
200
200
  onComplete(c, r, a) {
@@ -211,7 +211,7 @@ const j = {
211
211
  "Content-Type": "application/json",
212
212
  Accept: "application/json,text/javascript,*/*"
213
213
  };
214
- function ue(e, t, s = void 0, n = void 0) {
214
+ function pe(e, t, s = void 0, n = void 0) {
215
215
  const { space: i, currentUser: c } = e, a = `${i}${{
216
216
  URIUGr: "/3drdfpersist/resources/v1/usersgroup"
217
217
  }.URIUGr}`, o = {
@@ -240,7 +240,7 @@ function ue(e, t, s = void 0, n = void 0) {
240
240
  }
241
241
  });
242
242
  }
243
- function fe(e, t, s = void 0, n = void 0) {
243
+ function ue(e, t, s = void 0, n = void 0) {
244
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
245
  f(d, {
246
246
  opts: {
@@ -275,7 +275,7 @@ function L(e, t = void 0, s = void 0) {
275
275
  }
276
276
  });
277
277
  }
278
- function me(e, t = void 0, s = void 0) {
278
+ function fe(e, t = void 0, s = void 0) {
279
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
280
  "Content-Type": "application/json",
281
281
  Accept: "application/json,text/javascript,*/*"
@@ -306,13 +306,13 @@ function me(e, t = void 0, s = void 0) {
306
306
  console.log(l);
307
307
  }
308
308
  }
309
- function ge(e, t) {
309
+ function me(e, t) {
310
310
  const { space: s } = e, i = `${s}/3drdfpersist/resources/v1/usersgroup/${t}`;
311
311
  f(i, {
312
312
  method: "DELETE"
313
313
  });
314
314
  }
315
- function he(e, t, s, n = void 0, i = void 0) {
315
+ function ge(e, t, s, n = void 0, i = void 0) {
316
316
  const { space: c, tenant: r } = e, a = {
317
317
  URITI: "/3drdfpersist/resources/v1/template-instances",
318
318
  URIUGr: "/3drdfpersist/resources/v1/usersgroup",
@@ -335,7 +335,7 @@ function he(e, t, s, n = void 0, i = void 0) {
335
335
  }
336
336
  });
337
337
  }
338
- function Se(e, t, s, n = void 0, i = void 0) {
338
+ function he(e, t, s, n = void 0, i = void 0) {
339
339
  const { space: c } = e, a = `${c}/3drdfpersist/resources/v1/usersgroup/${t}/sharing`;
340
340
  f(a, {
341
341
  method: "PATCH",
@@ -350,7 +350,7 @@ function Se(e, t, s, n = void 0, i = void 0) {
350
350
  }
351
351
  });
352
352
  }
353
- function _e(e, t, s = void 0, n = void 0) {
353
+ function Se(e, t, s = void 0, n = void 0) {
354
354
  const { space: i } = e, r = `${i}/3drdfpersist/resources/v1/usersgroup/${t}/sharing`;
355
355
  f(r, {
356
356
  opts: {
@@ -447,7 +447,7 @@ function U(e, t, s = void 0, n = void 0) {
447
447
  n
448
448
  );
449
449
  }
450
- function ye(e, t, s, n = void 0, i = void 0) {
450
+ function _e(e, t, s, n = void 0, i = void 0) {
451
451
  const c = `${e.space}/resources/v1/modeler/documents/${t}/files/DownloadTicket`;
452
452
  f(c, {
453
453
  method: "PUT",
@@ -543,7 +543,7 @@ function G(e, t, s, n, i, c, r = void 0, a = void 0) {
543
543
  }
544
544
  });
545
545
  }
546
- async function we(e, t, s, n, i = void 0, c = void 0) {
546
+ async function ye(e, t, s, n, i = void 0, c = void 0) {
547
547
  const r = e.space, a = e.token, o = e.ctx, d = new FormData(), l = new Blob([JSON.stringify(t)], {
548
548
  type: "text/plain"
549
549
  }), p = {
@@ -755,7 +755,7 @@ function V(e, t, s = void 0, n = void 0, i = void 0) {
755
755
  }
756
756
  });
757
757
  }
758
- function Te(e, t, s = void 0, n = void 0) {
758
+ function we(e, t, s = void 0, n = void 0) {
759
759
  return new Promise((i) => {
760
760
  if (e.token === "" && T(e), t !== void 0 && t !== "" && t !== null) {
761
761
  const c = `${e.space}/resources/v1/modeler/dslc/maturity/getNextStates`;
@@ -796,7 +796,7 @@ function Te(e, t, s = void 0, n = void 0) {
796
796
  }
797
797
  });
798
798
  }
799
- function Ce(e, t, s, n = void 0, i = void 0) {
799
+ function Te(e, t, s, n = void 0, i = void 0) {
800
800
  return new Promise((c) => {
801
801
  if (e.token === "" && T(e), t !== void 0 && t !== "" && t !== null) {
802
802
  const r = `${e.space}/resources/v1/modeler/dslc/maturity/changeState`;
@@ -838,7 +838,7 @@ function Ce(e, t, s, n = void 0, i = void 0) {
838
838
  }
839
839
  });
840
840
  }
841
- function Oe(e, t, s = void 0, n = void 0) {
841
+ function Ce(e, t, s = void 0, n = void 0) {
842
842
  return new Promise((i) => {
843
843
  if (e.token === "" && T(e), t !== void 0 && t !== "" && t !== null) {
844
844
  const c = `${e.space}/resources/v1/dslc/versiongraph?withThumbnail=0&withIsLastVersion=0&withAttributes=0&withCopyFrom=0&tenant=${e.tenant}`;
@@ -879,7 +879,7 @@ function Oe(e, t, s = void 0, n = void 0) {
879
879
  }
880
880
  });
881
881
  }
882
- function Ne(e, t, s = void 0, n = void 0) {
882
+ function Oe(e, t, s = void 0, n = void 0) {
883
883
  return new Promise((i) => {
884
884
  if (e.token === "" && T(e), t !== void 0 && t !== "" && t !== null) {
885
885
  const c = `${e.space}/resources/lifecycle/revise/prepare_revise_maskattributes?tenant=${e.tenant}`;
@@ -926,7 +926,7 @@ function Ne(e, t, s = void 0, n = void 0) {
926
926
  }
927
927
  });
928
928
  }
929
- function be(e, t, s, n = void 0, i = void 0) {
929
+ function Ne(e, t, s, n = void 0, i = void 0) {
930
930
  return new Promise((c) => {
931
931
  if (e.token === "" && T(e), t !== void 0 && t !== "" && t !== null) {
932
932
  const r = `${e.space}/resources/lifecycle/revise/major?tenant=${e.tenant}`;
@@ -987,7 +987,7 @@ function w(e, t = void 0, s = void 0) {
987
987
  }
988
988
  });
989
989
  }
990
- function Fe(e, t = void 0, s = void 0) {
990
+ function be(e, t = void 0, s = void 0) {
991
991
  const n = `${e.space}/api/exalead/whatsnew`, i = {
992
992
  params: {
993
993
  community_id: null,
@@ -1017,7 +1017,7 @@ function Fe(e, t = void 0, s = void 0) {
1017
1017
  });
1018
1018
  });
1019
1019
  }
1020
- function Ue(e, t = void 0, s = void 0) {
1020
+ function Fe(e, t = void 0, s = void 0) {
1021
1021
  const n = `${e.space}/api/Recommendation/getpeoplefamiliartocurrentuser`, i = {
1022
1022
  params: {
1023
1023
  idsToFilterArr: [],
@@ -1067,7 +1067,7 @@ function W(e, t = void 0, s = void 0) {
1067
1067
  s
1068
1068
  );
1069
1069
  }
1070
- function ke(e, t, s = void 0, n = void 0) {
1070
+ function Ue(e, t, s = void 0, n = void 0) {
1071
1071
  const i = e.space + "/api/user/find/login/" + t;
1072
1072
  w(
1073
1073
  e,
@@ -1131,7 +1131,7 @@ function X(e, t = void 0, s = void 0) {
1131
1131
  );
1132
1132
  }
1133
1133
  module.exports = { getActiveServices: X };
1134
- async function $e(e, t, s) {
1134
+ async function ke(e, t, s) {
1135
1135
  const n = `${e.space}/resources/v1/application/CSRF`;
1136
1136
  f(n, {
1137
1137
  onComplete(i) {
@@ -1142,7 +1142,7 @@ async function $e(e, t, s) {
1142
1142
  }
1143
1143
  });
1144
1144
  }
1145
- function Ae(e, t = void 0, s = void 0) {
1145
+ function $e(e, t = void 0, s = void 0) {
1146
1146
  const n = {
1147
1147
  base: `${e.space}`,
1148
1148
  uri: "/resources/bps/cspaces",
@@ -1163,7 +1163,7 @@ function Ae(e, t = void 0, s = void 0) {
1163
1163
  }
1164
1164
  });
1165
1165
  }
1166
- function Re(e, t, s, n) {
1166
+ function Ae(e, t, s, n) {
1167
1167
  U(
1168
1168
  e.space,
1169
1169
  t,
@@ -1183,7 +1183,7 @@ function Re(e, t, s, n) {
1183
1183
  }
1184
1184
  );
1185
1185
  }
1186
- async function De(e, t, s = void 0, n = void 0) {
1186
+ async function Re(e, t, s = void 0, n = void 0) {
1187
1187
  return new Promise((i) => {
1188
1188
  U(e.space, t, (c) => {
1189
1189
  f(c, {
@@ -1195,7 +1195,7 @@ async function De(e, t, s = void 0, n = void 0) {
1195
1195
  });
1196
1196
  });
1197
1197
  }
1198
- function ve(e, t, s, n = void 0, i = void 0) {
1198
+ function De(e, t, s, n = void 0, i = void 0) {
1199
1199
  const c = new Blob([JSON.stringify(t)], { type: "text/plain" });
1200
1200
  b(
1201
1201
  e,
@@ -1223,7 +1223,7 @@ function ve(e, t, s, n = void 0, i = void 0) {
1223
1223
  }
1224
1224
  let Y, B;
1225
1225
  const P = [];
1226
- async function je(e, t = void 0, s = void 0) {
1226
+ async function ve(e, t = void 0, s = void 0) {
1227
1227
  console.log(
1228
1228
  `%c 3ds & objID ok ${e.space} et ${e.objID} *`,
1229
1229
  "color: green"
@@ -1238,7 +1238,7 @@ async function je(e, t = void 0, s = void 0) {
1238
1238
  }
1239
1239
  ) : e.objID === null && T(e);
1240
1240
  }
1241
- async function xe(e, t = void 0, s = void 0) {
1241
+ async function je(e, t = void 0, s = void 0) {
1242
1242
  await x(
1243
1243
  e,
1244
1244
  (n) => {
@@ -1286,7 +1286,7 @@ function H(e, t, s = void 0, n = void 0) {
1286
1286
  }
1287
1287
  );
1288
1288
  }
1289
- const Ie = "FA35FB9B177A280065800EA0000F599C", Pe = [
1289
+ const xe = "FA35FB9B177A280065800EA0000F599C", Ie = [
1290
1290
  "swym",
1291
1291
  "3dspace",
1292
1292
  "drive",
@@ -1300,13 +1300,13 @@ const Ie = "FA35FB9B177A280065800EA0000F599C", Pe = [
1300
1300
  where: "ds6w:where",
1301
1301
  who: "ds6w:who",
1302
1302
  why: "ds6w:why"
1303
- }, Q = {
1304
- objId: Ie,
1303
+ }, Pe = {
1304
+ objId: xe,
1305
1305
  pred: "who",
1306
1306
  order_by: "desc",
1307
1307
  tag: "testTag"
1308
1308
  };
1309
- function Me(e, t = Q, s = void 0, n = void 0) {
1309
+ function Me(e, t, s = void 0, n = void 0) {
1310
1310
  const { space: i, tenant: c } = e, { objId: r, pred: a, tag: o } = t, d = {
1311
1311
  uri: "/resources/6w/tags",
1312
1312
  otpCTX: "SecurityContext=preferred",
@@ -1416,7 +1416,7 @@ function Le(e, t, s = void 0, n = void 0) {
1416
1416
  }
1417
1417
  },
1418
1418
  select_exclude_synthesis: ["ds6w:what/ds6w:topic"],
1419
- order_by: Q.order_by,
1419
+ order_by: Pe.order_by,
1420
1420
  order_field: "relevance",
1421
1421
  select_snippets: [
1422
1422
  "ds6w:snippet",
@@ -1427,7 +1427,7 @@ function Le(e, t, s = void 0, n = void 0) {
1427
1427
  ],
1428
1428
  nresults: 40,
1429
1429
  start: "0",
1430
- source: Pe,
1430
+ source: Ie,
1431
1431
  tenant: e.tenant,
1432
1432
  login: {
1433
1433
  "3dspace": {
@@ -1533,7 +1533,7 @@ function Ge(e, t = void 0, s = void 0) {
1533
1533
  role: m.role,
1534
1534
  access: m.access
1535
1535
  };
1536
- Z(
1536
+ Q(
1537
1537
  e,
1538
1538
  m.id,
1539
1539
  (h) => {
@@ -1550,7 +1550,7 @@ function Ge(e, t = void 0, s = void 0) {
1550
1550
  });
1551
1551
  });
1552
1552
  }
1553
- function Z(e, t, s, n) {
1553
+ function Q(e, t, s, n) {
1554
1554
  const i = `${e.space}/api/community/listmembers`, c = {
1555
1555
  params: {
1556
1556
  page: e.page ? e.page : 1,
@@ -1613,7 +1613,7 @@ function Ve(e, t, s = void 0, n = void 0) {
1613
1613
  msg: We(t.msg)
1614
1614
  };
1615
1615
  let d = !1;
1616
- ee(
1616
+ Z(
1617
1617
  a.users,
1618
1618
  (l) => {
1619
1619
  l !== void 0 && (o.id_msg = l.id, d = !0, A(e, o));
@@ -1644,7 +1644,7 @@ function Ve(e, t, s = void 0, n = void 0) {
1644
1644
  });
1645
1645
  }, 500);
1646
1646
  }
1647
- function ee(e, t, s, n) {
1647
+ function Z(e, t, s, n) {
1648
1648
  const i = `${e.space}/api/directmessages/lite?with_favorites=false`;
1649
1649
  w(e, (c) => {
1650
1650
  f(i, {
@@ -1927,72 +1927,72 @@ function Qe(e) {
1927
1927
  const nt = {
1928
1928
  sayHello: Qe,
1929
1929
  _3DSwym_get_version: w,
1930
- _3DSwym_getAllNews: Fe,
1931
- _3DSwym_getFamiliarPeople: Ue,
1932
- _3DSpace_Create_Doc: we,
1930
+ _3DSwym_getAllNews: be,
1931
+ _3DSwym_getFamiliarPeople: Fe,
1932
+ _3DSpace_Create_Doc: ye,
1933
1933
  _3DSpace_csrf: T,
1934
1934
  _3DSpace_download_doc: x,
1935
1935
  _3DSpace_download_multidoc: K,
1936
1936
  _3DSpace_file_update_csr: G,
1937
1937
  _3DSpace_file_update: J,
1938
- _3DSpace_file_url_csr: ye,
1938
+ _3DSpace_file_url_csr: _e,
1939
1939
  _3DSpace_file_url: U,
1940
1940
  _3DSpace_get_csrf: b,
1941
1941
  _3DSpace_get_docInfo: E,
1942
1942
  _3DSpace_get_downloadTicket_multidoc: V,
1943
1943
  _3DSpace_get_securityContexts: O,
1944
- _3DSpace_lifecycle_changeRevision: be,
1945
- _3DSpace_lifecycle_changeState: Ce,
1946
- _3DSpace_lifecycle_getGraph: Oe,
1947
- _3DSpace_lifecycle_getNextRevision: Ne,
1948
- _3DSpace_lifecycle_getNextStates: Te,
1944
+ _3DSpace_lifecycle_changeRevision: Ne,
1945
+ _3DSpace_lifecycle_changeState: Te,
1946
+ _3DSpace_lifecycle_getGraph: Ce,
1947
+ _3DSpace_lifecycle_getNextRevision: Oe,
1948
+ _3DSpace_lifecycle_getNextStates: we,
1949
1949
  _3DSwim_getAllCommunities: Ge,
1950
- _3DSwim_getMembersCommunity: Z,
1950
+ _3DSwim_getMembersCommunity: Q,
1951
1951
  _3DSwym_buildDirectMessage: Ve,
1952
1952
  _3DSwym_deleteIdea: Be,
1953
- _3DSwym_findCommunityToInstantMSG: ee,
1953
+ _3DSwym_findCommunityToInstantMSG: Z,
1954
1954
  _3DSwym_get_AllSWYMIdeas: He,
1955
1955
  _3DSwym_get_currentUser: W,
1956
- _3DSwym_get_findUser: ke,
1956
+ _3DSwym_get_findUser: Ue,
1957
1957
  _3DSwym_getIdeaStatusMaturity: Ke,
1958
1958
  _3DSwym_getSWYMIdea: ze,
1959
1959
  _3DSwym_postIdea: Ye,
1960
1960
  _3DSwym_sendMessageData: A,
1961
- _AppMngt_get_info_user: pe,
1962
- _AppMngt_get_users: le,
1961
+ _AppMngt_get_info_user: le,
1962
+ _AppMngt_get_users: de,
1963
1963
  _getPlateformInfos: $,
1964
1964
  _getPlatformServices: v,
1965
1965
  _httpCallAuthenticated: f,
1966
- _setDraggable: oe,
1967
- _setDroppable: ce,
1968
- _setupTagger: re,
1966
+ _setDraggable: ie,
1967
+ _setDroppable: re,
1968
+ _setupTagger: oe,
1969
1969
  addTagToDoc: Me,
1970
- compass_getListAdditionalApps: de,
1970
+ compass_getListAdditionalApps: ce,
1971
1971
  couleurs: M,
1972
- createUserGroups: ue,
1972
+ createUserGroups: pe,
1973
1973
  dataMixing: H,
1974
- deleteUserGroups: ge,
1975
- findAdresse: se,
1976
- get_3DSpace_csrf: je,
1974
+ deleteUserGroups: me,
1975
+ findAdresse: ne,
1976
+ get_3DSpace_csrf: ve,
1977
1977
  getActiveServices: X,
1978
- getAllContextSecurity: Ae,
1979
- getCommunes: ne,
1980
- getComplementUG: fe,
1981
- getCSRFToken: $e,
1982
- getDataFrom3DSpace: Re,
1983
- getDataFromGouvFr: ae,
1984
- getDatasByTenant: xe,
1978
+ getAllContextSecurity: $e,
1979
+ getCommunes: te,
1980
+ getComplementUG: ue,
1981
+ getCSRFToken: ke,
1982
+ getDataFrom3DSpace: Ae,
1983
+ getDataFromGouvFr: se,
1984
+ getDatasByTenant: je,
1985
1985
  getDatasFrom3DSpace: z,
1986
- getDownloadDocument: De,
1986
+ getDownloadDocument: Re,
1987
1987
  getInfoDocTags: Je,
1988
- getUserGroupsList: me,
1988
+ getUserGroupsList: fe,
1989
1989
  getUsersGroupRules: L,
1990
- patchUserGroups: he,
1991
- patchUserGroupsControl: Se,
1992
- pushDataIn3DSpace: ve,
1993
- readUserGroupControl: _e,
1990
+ patchUserGroups: ge,
1991
+ patchUserGroupsControl: he,
1992
+ pushDataIn3DSpace: De,
1993
+ readUserGroupControl: Se,
1994
1994
  removeTagToDoc: Ee,
1995
- updateEvent: ie,
1995
+ updateEvent: ae,
1996
1996
  UUID: D
1997
1997
  };
1998
1998
  export {
@@ -1,6 +1,6 @@
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>
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 ee(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 te(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 ne(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 se(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 ae(e,t,s){T.requirejs(["DS/DataDragAndDrop/DataDragAndDrop"],n=>{n.draggable(e,{data:t,start:s})})}function ie(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 oe(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 re(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 ce(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 de(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 le(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 pe(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 ue(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 fe(e,t){const{space:s}=e,i=`${s}/3drdfpersist/resources/v1/usersgroup/${t}`;f(i,{method:"DELETE"})}function me(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 ge(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 he(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 Se(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 ye(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 _e(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 we(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 Te(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 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/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 Oe(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 Ne(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 be(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 Fe(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 ke(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 $e(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 De(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 Ue(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 Ae(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 Re(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 je(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 ve="FA35FB9B177A280065800EA0000F599C",xe=["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"},Ie={objId:ve,pred:"who",order_by:"desc",tag:"testTag"};function Pe(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: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:Ie.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:xe,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};Q(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 Q(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;Z(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 Z(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
4
  <br/>
5
5
  <hr/>
6
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>
@@ -75,4 +75,4 @@ function _(e,t=void 0,s=void 0){const n=e.space+"/api/index/tk";f(n,{onComplete(
75
75
  <tr><td><strong>Service études de prix</strong></td><td><br /></td></tr>
76
76
  </tbody></table>
77
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}});
78
+ </p>`:e}function He(e){const t="Hello "+e;return console.log(t),t}return{sayHello:He,_3DSwym_get_version:_,_3DSwym_getAllNews:Ne,_3DSwym_getFamiliarPeople:be,_3DSpace_Create_Doc:ye,_3DSpace_csrf:N,_3DSpace_download_doc:j,_3DSpace_download_multidoc:G,_3DSpace_file_update_csr:J,_3DSpace_file_update:E,_3DSpace_file_url_csr:Se,_3DSpace_file_url:$,_3DSpace_get_csrf:k,_3DSpace_get_docInfo:L,_3DSpace_get_downloadTicket_multidoc:K,_3DSpace_get_securityContexts:b,_3DSpace_lifecycle_changeRevision:Oe,_3DSpace_lifecycle_changeState:we,_3DSpace_lifecycle_getGraph:Te,_3DSpace_lifecycle_getNextRevision:Ce,_3DSpace_lifecycle_getNextStates:_e,_3DSwim_getAllCommunities:Je,_3DSwim_getMembersCommunity:Q,_3DSwym_buildDirectMessage:Ke,_3DSwym_deleteIdea:Ye,_3DSwym_findCommunityToInstantMSG:Z,_3DSwym_get_AllSWYMIdeas:Be,_3DSwym_get_currentUser:V,_3DSwym_get_findUser:Fe,_3DSwym_getIdeaStatusMaturity:Ge,_3DSwym_getSWYMIdea:qe,_3DSwym_postIdea:Xe,_3DSwym_sendMessageData:v,_AppMngt_get_info_user:de,_AppMngt_get_users:ce,_getPlateformInfos:A,_getPlatformServices:U,_httpCallAuthenticated:f,_setDraggable:ae,_setDroppable:oe,_setupTagger:ie,addTagToDoc:Pe,compass_getListAdditionalApps:re,couleurs:I,createUserGroups:le,dataMixing:z,deleteUserGroups:fe,findAdresse:te,get_3DSpace_csrf:Re,getActiveServices:W,getAllContextSecurity:$e,getCommunes:ee,getComplementUG:pe,getCSRFToken:ke,getDataFrom3DSpace:De,getDataFromGouvFr:ne,getDatasByTenant:je,getDatasFrom3DSpace:B,getDownloadDocument:Ue,getInfoDocTags:Ee,getUserGroupsList:ue,getUsersGroupRules:P,patchUserGroups:me,patchUserGroupsControl:ge,pushDataIn3DSpace:Ae,readUserGroupControl:he,removeTagToDoc:Le,updateEvent:se,UUID:D}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beam3_dev/api_module",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "type": "module",
5
5
  "main": "./dist/wb3Api.umd.cjs",
6
6
  "module": "./dist/wb3Api.js",
@@ -17,7 +17,7 @@
17
17
  "dev": "vite",
18
18
  "build": "vite build",
19
19
  "preview": "vite preview",
20
- "clean": "rm -rf ./dist"
20
+ "clean": "rm -rf dist node_modules"
21
21
  },
22
22
  "devDependencies": {
23
23
  "vite": "^5.0.8"