@beam3_dev/api_module 0.0.28 → 0.0.29

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,1849 +1,9 @@
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 le(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 pe(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 ue(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 fe(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 me(e, t, s) {
113
- O(["DS/DataDragAndDrop/DataDragAndDrop"], (n) => {
114
- n.draggable(e, { data: t, start: s });
115
- });
116
- }
117
- function ge(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 he(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 Se(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 ye(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 _e(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 Te(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 we(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 Ce(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 Oe(e, t) {
310
- const { space: s } = e, i = `${s}/3drdfpersist/resources/v1/usersgroup/${t}`;
311
- f(i, {
312
- method: "DELETE"
313
- });
314
- }
315
- function Ne(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 be(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 ke(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 Fe(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 Ue(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 $e(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 De(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 Ae(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 Re(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 ve(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 je(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 Ie(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 xe(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 z(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
- module.exports = { getActiveServices: z };
1131
- async function Pe(e, t, s) {
1132
- const n = `${e.space}/resources/v1/application/CSRF`;
1133
- f(n, {
1134
- onComplete(i) {
1135
- i = JSON.parse(i), t && t(i.csrf);
1136
- },
1137
- onFailure(i) {
1138
- s && s(i);
1139
- }
1140
- });
1141
- }
1142
- function Me(e, t = void 0, s = void 0) {
1143
- const n = {
1144
- base: `${e.space}`,
1145
- uri: "/resources/bps/cspaces",
1146
- optTenant: `tenant=${e.tenant}`
1147
- }, i = `${n.base}${n.uri}?${n.optTenant}`;
1148
- f(i, {
1149
- method: "GET",
1150
- headers: {
1151
- Accept: "application/json,text/javascript,*/*",
1152
- "Content-Type": "application/ds-json"
1153
- },
1154
- onComplete(c, r) {
1155
- const a = JSON.parse(c);
1156
- t && t(a, r);
1157
- },
1158
- onFailure(c, r, a) {
1159
- s && s(c, r, a);
1160
- }
1161
- });
1162
- }
1163
- function Le(e, t, s, n) {
1164
- D(
1165
- e.space,
1166
- t,
1167
- (i) => {
1168
- f(i, {
1169
- header: { ENO_CSRF_TOKEN: e.token },
1170
- onComplete: (c) => {
1171
- s && s(c);
1172
- },
1173
- onFailure: (c) => {
1174
- console.log("error http", c), n && n(c);
1175
- }
1176
- });
1177
- },
1178
- (i) => {
1179
- console.log("error file URL", i), n && n(i);
1180
- }
1181
- );
1182
- }
1183
- async function Ee(e, t, s = void 0, n = void 0) {
1184
- return new Promise((i) => {
1185
- D(e.space, t, (c) => {
1186
- f(c, {
1187
- onComplete: (r, a, o) => (i(JSON.parse(r)), s && s(JSON.parse(r), a, o), i),
1188
- onFailure: (r, a, o) => {
1189
- n && n(r, a, o), console.log(r, a?.errormsg);
1190
- }
1191
- });
1192
- });
1193
- });
1194
- }
1195
- function Je(e, t, s, n = void 0, i = void 0) {
1196
- const c = new Blob([JSON.stringify(t)], { type: "text/plain" });
1197
- k(
1198
- e,
1199
- s,
1200
- (r) => {
1201
- 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;
1202
- V(
1203
- e,
1204
- s,
1205
- a,
1206
- c,
1207
- o,
1208
- (d) => {
1209
- n && n(d);
1210
- },
1211
- (d) => {
1212
- i && i(d);
1213
- }
1214
- );
1215
- },
1216
- (r) => {
1217
- console.log("En cas d'erreur nous avons :", r), alert("Erreur lors de la sauvegarde, Veuillez réessayez"), i && i(r);
1218
- }
1219
- );
1220
- }
1221
- let P, M;
1222
- const R = [];
1223
- async function Ge(e, t = void 0, s = void 0) {
1224
- console.log(
1225
- `%c 3ds & objID ok ${e.space} et ${e.objID} *`,
1226
- "color: green"
1227
- ), e.objID && e.objID !== "" ? k(
1228
- e.space,
1229
- e.objID,
1230
- (n) => {
1231
- t && t(n.csrf.value);
1232
- },
1233
- (n) => {
1234
- s && s(n);
1235
- }
1236
- ) : e.objID === null && C(e);
1237
- }
1238
- async function Ke(e, t = void 0, s = void 0) {
1239
- await x(
1240
- e,
1241
- (n) => {
1242
- const i = {};
1243
- i.obj = n, H(
1244
- e,
1245
- (c) => {
1246
- i.datas = c, t && t(i);
1247
- },
1248
- (c) => {
1249
- s && s(c);
1250
- }
1251
- );
1252
- },
1253
- (n) => {
1254
- s && s(n);
1255
- }
1256
- );
1257
- }
1258
- function H(e, t = void 0, s = void 0) {
1259
- const n = [];
1260
- e.objIds.forEach((i, c) => {
1261
- x(
1262
- e,
1263
- i.objId,
1264
- (r) => {
1265
- n.push({ [i.name]: r }), i.name === "dbProjets" && (P = r.affaires.map((a) => a.objectID), q(e, M)), c === e.objIds.length - 1 && t && t(n);
1266
- },
1267
- (r) => {
1268
- s && s(r);
1269
- }
1270
- );
1271
- });
1272
- }
1273
- function q(e, t, s = void 0, n = void 0) {
1274
- X(
1275
- e,
1276
- P,
1277
- (i) => {
1278
- const c = [...t];
1279
- c.find((r) => r.objectID === i.objectId).data = i.data, M = c, R.push(i.data), s && s(R);
1280
- },
1281
- (i) => {
1282
- n && (n(i), console.log(i));
1283
- }
1284
- );
1285
- }
1286
- const Q = "FA35FB9B177A280065800EA0000F599C", Z = [
1287
- "swym",
1288
- "3dspace",
1289
- "drive",
1290
- "usersgroup",
1291
- "3dplan",
1292
- "dashboard"
1293
- ], L = {
1294
- how: "ds6w:how",
1295
- what: "ds6w:what",
1296
- when: "ds6w:when",
1297
- where: "ds6w:where",
1298
- who: "ds6w:who",
1299
- why: "ds6w:why"
1300
- }, ee = {
1301
- objId: Q,
1302
- pred: "who",
1303
- order_by: "desc",
1304
- tag: "testTag"
1305
- };
1306
- function Ve(e, t, s = void 0, n = void 0) {
1307
- const { space: i, tenant: c } = e, { objId: r, pred: a, tag: o } = t, d = {
1308
- uri: "/resources/6w/tags",
1309
- otpCTX: "SecurityContext=preferred",
1310
- optTenant: `tenant=${c}`
1311
- }, l = `${i}${d.uri}?${d.otpCTX}&${d.optTenant}`, p = {
1312
- tag: [
1313
- {
1314
- subject: [
1315
- {
1316
- uri: `pid://${r}`
1317
- }
1318
- ],
1319
- predicate: L[a],
1320
- object: {
1321
- literal: o
1322
- }
1323
- }
1324
- ]
1325
- };
1326
- f(l, {
1327
- method: "PUT",
1328
- headers: {
1329
- "Content-Type": "application/json",
1330
- Accept: "application/json"
1331
- },
1332
- data: JSON.stringify(p),
1333
- onComplete(u) {
1334
- JSON.parse(u);
1335
- const m = {};
1336
- setTimeout(() => {
1337
- K(
1338
- e,
1339
- r,
1340
- (g) => {
1341
- 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;
1342
- m.name = h, m.ext = S, m.createBy = y, t.info = { ...m }, te(
1343
- e,
1344
- t,
1345
- (_) => {
1346
- s && s(_);
1347
- },
1348
- (_) => {
1349
- n && n(_);
1350
- }
1351
- );
1352
- },
1353
- (g, h) => {
1354
- const S = g;
1355
- S.msg = h.errormsg, S.errCode = h.errorcode, console.log("❌ sendDirectMessage => ", S), n && n(S);
1356
- }
1357
- );
1358
- }, 2e3);
1359
- },
1360
- onFailure(u, m) {
1361
- const g = u;
1362
- g.msg = m.errormsg, g.errCode = m.errorcode, console.log("❌ sendDirectMessage => ", g), n && n(g);
1363
- }
1364
- });
1365
- }
1366
- function te(e, t, s = void 0, n = void 0) {
1367
- console.log("obj ", t);
1368
- const i = t.info.name, c = {
1369
- baseUrl: `https://${e.tenant.toLowerCase()}-eu1-fedsearch.3dexperience.3ds.com`,
1370
- uri: "/federated/search"
1371
- }, r = `${c.baseUrl}${c.uri}`, a = {
1372
- "Content-Type": "application/json",
1373
- Accept: "application/json,text/javascript,*/*"
1374
- }, o = j(), d = {
1375
- with_indexing_date: !0,
1376
- with_synthesis: !0,
1377
- with_nls: !1,
1378
- label: `3DSearch-${e.currentUser.username}-AjoutDeTagBeam-${o}`,
1379
- locale: "fr",
1380
- select_predicate: [
1381
- "ds6w:label",
1382
- "ds6w:type",
1383
- "ds6w:description",
1384
- "ds6w:identifier",
1385
- "ds6w:modified",
1386
- "ds6w:created",
1387
- "ds6wg:revision",
1388
- "ds6w:status",
1389
- "ds6w:responsible",
1390
- "owner",
1391
- "ds6w:responsibleUid",
1392
- "ds6wg:filesize",
1393
- "ds6w:project",
1394
- "ds6w:dataSource",
1395
- "ds6w:community",
1396
- "ds6w:originator",
1397
- "dsgeo:referential",
1398
- "ds6w:lastModifiedBy",
1399
- "ds6w:repository",
1400
- "dcterms:title",
1401
- "dcterms:description",
1402
- "ds6w:containerUid"
1403
- ],
1404
- with_synthesis_hierarchical: !0,
1405
- select_file: ["icon", "thumbnail_2d"],
1406
- query: i,
1407
- specific_source_parameter: {
1408
- "3dspace": {
1409
- 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)'
1410
- },
1411
- drive: {
1412
- additional_query: ' AND NOT ([flattenedtaxonomies]:"types/DriveNode" AND ( [current]:"Trashed" OR [policy]:"Drive File Iteration") )'
1413
- }
1414
- },
1415
- select_exclude_synthesis: ["ds6w:what/ds6w:topic"],
1416
- order_by: ee.order_by,
1417
- order_field: "relevance",
1418
- select_snippets: [
1419
- "ds6w:snippet",
1420
- "ds6w:label:snippet",
1421
- "ds6w:responsible:snippet",
1422
- "ds6w:community:snippet",
1423
- "swym:message_text:snippet"
1424
- ],
1425
- nresults: 40,
1426
- start: "0",
1427
- source: Z,
1428
- tenant: e.tenant,
1429
- login: {
1430
- "3dspace": {
1431
- SecurityContext: e.ctx
1432
- }
1433
- }
1434
- };
1435
- console.log("dataPattern => ", d), f(r, {
1436
- method: "POST",
1437
- headers: a,
1438
- data: JSON.stringify(d),
1439
- onComplete(l) {
1440
- const p = JSON.parse(l);
1441
- s(p);
1442
- },
1443
- onFailure(l, p) {
1444
- const u = l;
1445
- 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);
1446
- }
1447
- });
1448
- }
1449
- function We(e, t, s = void 0, n = void 0) {
1450
- const { objId: i, pred: c, tag: r } = t, a = {
1451
- uri: "/resources/6w/tags",
1452
- otpCTX: "SecurityContext=preferred",
1453
- optTenant: `tenant=${e.tenant}`
1454
- }, o = `${e.space}${a.uri}?${a.otpCTX}&${a.optTenant}`, d = {
1455
- tag: [
1456
- {
1457
- subject: [
1458
- {
1459
- uri: `pid://${i}`
1460
- }
1461
- ],
1462
- predicate: L[c],
1463
- object: {
1464
- literal: r
1465
- }
1466
- }
1467
- ]
1468
- };
1469
- f(o, {
1470
- method: "DELETE",
1471
- data: JSON.stringify(d),
1472
- headers: {
1473
- "Content-Type": "application/json",
1474
- Accept: "application/json,text/javascript,*/*"
1475
- },
1476
- onComplete(l) {
1477
- s && s(l);
1478
- },
1479
- onFailure(l, p) {
1480
- const u = l;
1481
- u.msg = p.errormsg, u.errCode = p.errorcode, console.log("❌ sendDirectMessage => ", u), n && n(u);
1482
- }
1483
- });
1484
- }
1485
- function Xe(e, t = "", s = void 0, n = void 0) {
1486
- const { space: i } = e;
1487
- if (t === "")
1488
- return;
1489
- const c = {
1490
- uri: "/enovia/resources/v1/modeler/documents"
1491
- }, r = {
1492
- "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
1493
- Accept: "application/json,text/javascript,*/*"
1494
- }, 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}`;
1495
- f(a, {
1496
- method: "POST",
1497
- headers: r,
1498
- data: o,
1499
- onComplete(d) {
1500
- s && s(JSON.parse(d));
1501
- },
1502
- onFailure(d, l) {
1503
- const p = d;
1504
- p.msg = l.error, n && n(p);
1505
- }
1506
- });
1507
- }
1508
- function Ye(e, t = void 0, s = void 0) {
1509
- const n = {
1510
- base: e.space,
1511
- uri: "/api/community/listmycommunities",
1512
- limit: `/limit/${e.limit ? e.limit : 128}`,
1513
- page: `/page/${e.page ? e.page : "1"}`
1514
- }, i = `${n.base}${n.uri}${n.limit}${n.page}`, c = [];
1515
- T(e, (r) => {
1516
- f(i, {
1517
- method: "GET",
1518
- headers: {
1519
- "X-DS-SWYM-CSRFTOKEN": r.result.ServerToken
1520
- },
1521
- onComplete(a, o, d) {
1522
- const p = JSON.parse(a).result;
1523
- let u = 0;
1524
- p.forEach((m) => {
1525
- const g = {
1526
- description: m.description,
1527
- id: m.id,
1528
- title: m.title,
1529
- owner: m.owner,
1530
- role: m.role,
1531
- access: m.access
1532
- };
1533
- ne(
1534
- e,
1535
- m.id,
1536
- (h) => {
1537
- u++, g.members = h, c.push(g), u === p.length && t && t(c);
1538
- },
1539
- (h) => s(h)
1540
- );
1541
- });
1542
- },
1543
- onFailure(a, o) {
1544
- const d = a;
1545
- d.status = o.status, d.response = o.errormsg, s && s(d);
1546
- }
1547
- });
1548
- });
1549
- }
1550
- function ne(e, t, s, n) {
1551
- const i = `${e.space}/api/community/listmembers`, c = {
1552
- params: {
1553
- page: e.page ? e.page : 1,
1554
- limit: e.limit ? e.limit : 50,
1555
- community_id: t
1556
- }
1557
- };
1558
- T(e, (r) => {
1559
- f(i, {
1560
- method: "POST",
1561
- headers: {
1562
- "Content-type": "application/json;charset=UTF-8",
1563
- Accept: "application/json",
1564
- "X-DS-SWYM-CSRFTOKEN": r.result.ServerToken
1565
- },
1566
- data: JSON.stringify(c),
1567
- type: "json",
1568
- onComplete(a, o, d) {
1569
- s && s(a);
1570
- },
1571
- onFailure(a, o) {
1572
- const d = a;
1573
- d.status = o.status, d.response = o.errormsg, n && n(d);
1574
- }
1575
- });
1576
- });
1577
- }
1578
- function Be(e, t = void 0, s = void 0) {
1579
- const n = "YXdA5x4DSUKtlAi2wmnyTA";
1580
- e.commu_id || (e.commu_id = n);
1581
- const i = `${e.space}/api/v2/communities/${e.commu_id}/ideas/statuses`;
1582
- T(e, (c) => {
1583
- f(i, {
1584
- method: "GET",
1585
- headers: {
1586
- "Content-type": "application/json;charset=UTF-8",
1587
- Accept: "application/json",
1588
- "X-DS-SWYM-CSRFTOKEN": c.result.ServerToken
1589
- },
1590
- onComplete(r) {
1591
- const a = JSON.parse(r);
1592
- t && t(a);
1593
- },
1594
- onFailure(r, a) {
1595
- const o = r;
1596
- o.status = a.status, o.response = a.errormsg, s && s(o);
1597
- }
1598
- });
1599
- });
1600
- }
1601
- function ze(e, t, s = void 0, n = void 0) {
1602
- const { listAllContacts: i, currentUser: c } = e;
1603
- console.log("__listAllContacts", i.hits);
1604
- const r = `${e.space}/api/directmessages`, a = {
1605
- users: [c.login].concat(t.receipt)
1606
- }, o = {
1607
- id_msg: "",
1608
- senderId: e.currentUser.login,
1609
- senderName: `${e.currentUser.first_name} ${e.currentUser.last_name}`,
1610
- msg: ae(t.msg)
1611
- };
1612
- let d = !1;
1613
- se(
1614
- a.users,
1615
- (l) => {
1616
- l !== void 0 && (o.id_msg = l.id, d = !0, v(e, o));
1617
- },
1618
- (l) => {
1619
- d = !1, console.log("_3dSwym_findCommunityToInstantMSG callback", l), n && n(l), o.id_msg = "";
1620
- }
1621
- ), d === !1 && setTimeout(() => {
1622
- d === !1 && T(e, (l) => {
1623
- f(r, {
1624
- method: "POST",
1625
- headers: {
1626
- "Content-Type": "application/json",
1627
- Accept: "application/json",
1628
- "X-DS-SWYM-CSRFTOKEN": l.result.ServerToken
1629
- },
1630
- data: JSON.stringify(a),
1631
- type: "json",
1632
- onComplete(p, u, m) {
1633
- const g = p;
1634
- g.reponse = JSON.parse(m.response), g.status = m.status, s && s(g), o.id_msg = g.result.id, v(e, o);
1635
- },
1636
- onFailure(p, u, m) {
1637
- const g = p;
1638
- g.msg = u.errormsg, g.status = u.status, n && n(g);
1639
- }
1640
- });
1641
- });
1642
- }, 500);
1643
- }
1644
- function se(e, t, s, n) {
1645
- const i = `${e.space}/api/directmessages/lite?with_favorites=false`;
1646
- T(e, (c) => {
1647
- f(i, {
1648
- method: "GET",
1649
- headers: {
1650
- Accept: "application/json,text/javascript,*/*",
1651
- "X-DS-SWYM-CSRFTOKEN": c.result.ServerToken
1652
- },
1653
- onComplete(r) {
1654
- const a = JSON.parse(r), o = [];
1655
- a.result.forEach((p) => {
1656
- p.users = p.users.sort((u, m) => u.login.localeCompare(m.login)), p.users.length === t.length && o.push(p);
1657
- });
1658
- const d = t.sort(), l = o.find((p) => {
1659
- const u = [];
1660
- return p.users.forEach((m) => {
1661
- u.push(m.login);
1662
- }), JSON.stringify(u) === JSON.stringify(d);
1663
- });
1664
- s && l !== void 0 ? s(l) : (n || l === void 0) && n(l);
1665
- },
1666
- onFailure(r) {
1667
- const a = r;
1668
- a.msg = headers.errormsg, a.errCode = headers.errorcode, console.log("❌ sendDirectMessageLite => ", a), n && n(a);
1669
- }
1670
- });
1671
- });
1672
- }
1673
- function v(e, t, s = void 0, n = void 0) {
1674
- const i = {
1675
- base: e.space,
1676
- uri: "/api/community",
1677
- id_msg: `${t.id_msg}`,
1678
- endUri: "/instantmessages"
1679
- }, c = `${i.base}${i.uri}/${i.id_msg}${i.endUri}`, r = {
1680
- author: { login: t.senderId, displayName: t.senderName },
1681
- accessState: null,
1682
- commentUri: null,
1683
- comments: null,
1684
- endorsements: null,
1685
- moderationState: null,
1686
- parentCommentUri: null,
1687
- richMessage: t.msg
1688
- };
1689
- console.log("_3dSwym_sendDirectMessageData url ", c), T(e, (a) => {
1690
- f(c, {
1691
- method: "POST",
1692
- headers: {
1693
- "Content-Type": "application/json",
1694
- Accept: "application/json",
1695
- "X-DS-SWYM-CSRFTOKEN": a.result.ServerToken
1696
- },
1697
- data: JSON.stringify(r),
1698
- type: "json",
1699
- onComplete(o, d, l) {
1700
- const p = o;
1701
- p.status = l.status, p.response = JSON.parse(l.response), console.log("✅ _3dSwym_sendDirectMessageData => ", p), s && s(p);
1702
- },
1703
- onFailure(o, d) {
1704
- const l = o;
1705
- l.msg = d.errormsg, l.errCode = d.errorcode, console.log("❌ sendDirectMessage => ", l), n && n(l);
1706
- }
1707
- });
1708
- });
1709
- }
1710
- function ae(e) {
1711
- const t = (/* @__PURE__ */ new Date()).toLocaleDateString(), s = (/* @__PURE__ */ new Date()).toLocaleTimeString();
1712
- return `<p>${e} </p>
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>
1713
4
  <br/>
1714
5
  <hr/>
1715
- <p><u>envoyer :</u>Le <b>${t} à ${s}</b></p>`;
1716
- }
1717
- const ie = {
1718
- title: "TEST DEV COMMUNITY IDEA",
1719
- // titre du post
1720
- community_id: "YXdA5x4DSUKtlAi2wmnyTA",
1721
- // STATUT PROJETS - Phase commerciale, tenant PIVETEAU TEST
1722
- community_title: "TEST DEV COMMUNITY",
1723
- // Possibilité de recherche par titre de la communauté (option)
1724
- idee_id: "THhRI8rlQNWKRxpv3Xqqug"
1725
- // id de l'idee qui est créer au post (_3dSwym_postIdea)
1726
- };
1727
- function He(e, t, s = void 0, n = void 0) {
1728
- const i = `${e.space}/api/idea/add`, c = e.swymCommunities.find(
1729
- (o) => o.id === t.community_id
1730
- ), r = e.swymCommunities.find(
1731
- (o) => o.title.toLowerCase() === t.community_title.toLowerCase()
1732
- ), a = {
1733
- params: {
1734
- title: t.title,
1735
- // String, le nom de l'affaire
1736
- community_id: c?.id !== void 0 ? c.id : r.id,
1737
- // String, l'id de la communauté
1738
- message: oe(t.text_html),
1739
- // STRING => le contenue du message doit être au format HTML
1740
- published: 1
1741
- // 1 publier, 0 non publier
1742
- }
1743
- };
1744
- T(e, (o) => {
1745
- const d = {
1746
- "Content-type": "application/json;charset=UTF-8",
1747
- Accept: "application/json",
1748
- "X-DS-SWYM-CSRFTOKEN": o.result.ServerToken
1749
- };
1750
- f(i, {
1751
- method: "POST",
1752
- headers: d,
1753
- data: JSON.stringify(a),
1754
- type: "json",
1755
- onComplete(l, p, u) {
1756
- const m = JSON.parse(l);
1757
- m.status = u.status, m.response = u.response, s && s(m);
1758
- },
1759
- onFailure(l, p, u) {
1760
- const m = l;
1761
- m.status = p.status, m.response = p.errormsg, n && n(m);
1762
- }
1763
- });
1764
- });
1765
- }
1766
- function qe(e, t, s = void 0, n = void 0) {
1767
- const i = `${e.space}/api/idea/delete`, c = {
1768
- params: {
1769
- community_id: t.community_id,
1770
- ideationIds: [t.idee_id]
1771
- }
1772
- };
1773
- T(e, (r) => {
1774
- f(i, {
1775
- method: "POST",
1776
- headers: {
1777
- "Content-type": "application/json;charset=UTF-8",
1778
- Accept: "application/json",
1779
- "X-DS-SWYM-CSRFTOKEN": r.result.ServerToken
1780
- },
1781
- data: JSON.stringify(c),
1782
- type: "json",
1783
- onComplete(a, o, d) {
1784
- s && s(a);
1785
- },
1786
- onFailure(a, o, d) {
1787
- const l = a;
1788
- l.status = o.status, l.response = o.errormsg, n && n(l);
1789
- }
1790
- });
1791
- });
1792
- }
1793
- function Qe(e, t = "", s = void 0, n = void 0) {
1794
- const i = e.tenant.toLowerCase() === "r1132101716373" ? "tFtz0G4MR6qNtKgJjNfTog" : e.tenant.toLowerCase() === "r1132101286859" ? "Qpv3HN-tTDOsU-7_c5DnDg" : "Template_d'idée_à_créer";
1795
- t === "" && (t = i);
1796
- const c = `${e.space}/api/idea/get`, r = {
1797
- params: {
1798
- id: t
1799
- }
1800
- };
1801
- T(e, (a) => {
1802
- f(c, {
1803
- method: "POST",
1804
- headers: {
1805
- "Content-type": "application/json;charset=UTF-8",
1806
- Accept: "application/json",
1807
- "X-DS-SWYM-CSRFTOKEN": a.result.ServerToken
1808
- },
1809
- data: JSON.stringify(r),
1810
- type: "json",
1811
- onComplete(o) {
1812
- const d = o;
1813
- d.msg = d.result.message, s && s(d);
1814
- },
1815
- onFailure(o) {
1816
- const d = o;
1817
- d.status = headers.status, d.response = headers.errormsg, n && n(d);
1818
- }
1819
- });
1820
- });
1821
- }
1822
- function Ze(e, t = ie, s = void 0, n = void 0) {
1823
- const i = {
1824
- uri: "/api/idea/list",
1825
- comId: `/community_id/${e.tenant.toLowerCase() === "r1132101716373" ? t.community_id : "bgnIsG74SUWswyGzS6NC6g"}`,
1826
- limit: `/limit/${t.limit ? t.limit : 10}`
1827
- }, c = `${e.space}${i.uri}${i.comId}${i.limit}`;
1828
- T(e, (r) => {
1829
- f(c, {
1830
- method: "GET",
1831
- headers: {
1832
- "X-DS-SWYM-CSRFTOKEN": r.result.ServerToken
1833
- },
1834
- onComplete(a) {
1835
- const o = JSON.parse(a);
1836
- s && s(o);
1837
- },
1838
- onFailure(a, o) {
1839
- const d = a;
1840
- d.status = o.status, d.response = o.errormsg, n && n(d);
1841
- }
1842
- });
1843
- });
1844
- }
1845
- function oe(e) {
1846
- return !e || e === "" ? `<h2><u>INFORMATIONS AFFAIRE :</u></h2>
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>
1847
7
  <p><u>|⚠️<em> Merci de respecter l&#39;écriture des tags, en MAJUSCULES, nom complet, pas de caractères</em></u></p>
1848
8
  <p><u><em>|spéciaux, séparation par &#34;_&#34; si besoin !</em></u></p>
1849
9
  <p><strong>Référence client </strong>: <em>
@@ -1915,80 +75,4 @@ function oe(e) {
1915
75
  <tr><td><strong>Service études de prix</strong></td><td><br /></td></tr>
1916
76
  </tbody></table>
1917
77
  <p>
1918
- </p>` : e;
1919
- }
1920
- function et(e) {
1921
- const t = "Hello " + e;
1922
- return console.log(t), t;
1923
- }
1924
- export {
1925
- j as UUID,
1926
- Ue as _3DSpace_Create_Doc,
1927
- C as _3DSpace_csrf,
1928
- x as _3DSpace_download_doc,
1929
- X as _3DSpace_download_multidoc,
1930
- V as _3DSpace_file_update,
1931
- W as _3DSpace_file_update_csr,
1932
- D as _3DSpace_file_url,
1933
- Fe as _3DSpace_file_url_csr,
1934
- k as _3DSpace_get_csrf,
1935
- K as _3DSpace_get_docInfo,
1936
- Y as _3DSpace_get_downloadTicket_multidoc,
1937
- N as _3DSpace_get_securityContexts,
1938
- ve as _3DSpace_lifecycle_changeRevision,
1939
- De as _3DSpace_lifecycle_changeState,
1940
- Ae as _3DSpace_lifecycle_getGraph,
1941
- Re as _3DSpace_lifecycle_getNextRevision,
1942
- $e as _3DSpace_lifecycle_getNextStates,
1943
- Ye as _3DSwim_getAllCommunities,
1944
- ne as _3DSwim_getMembersCommunity,
1945
- ze as _3DSwym_buildDirectMessage,
1946
- qe as _3DSwym_deleteIdea,
1947
- se as _3DSwym_findCommunityToInstantMSG,
1948
- je as _3DSwym_getAllNews,
1949
- Ie as _3DSwym_getFamiliarPeople,
1950
- Be as _3DSwym_getIdeaStatusMaturity,
1951
- Qe as _3DSwym_getSWYMIdea,
1952
- Ze as _3DSwym_get_AllSWYMIdeas,
1953
- B as _3DSwym_get_currentUser,
1954
- xe as _3DSwym_get_findUser,
1955
- T as _3DSwym_get_version,
1956
- He as _3DSwym_postIdea,
1957
- v as _3DSwym_sendMessageData,
1958
- _e as _AppMngt_get_info_user,
1959
- ye as _AppMngt_get_users,
1960
- A as _getPlateformInfos,
1961
- I as _getPlatformServices,
1962
- f as _httpCallAuthenticated,
1963
- me as _setDraggable,
1964
- he as _setDroppable,
1965
- ge as _setupTagger,
1966
- Ve as addTagToDoc,
1967
- Se as compass_getListAdditionalApps,
1968
- J as couleurs,
1969
- Te as createUserGroups,
1970
- q as dataMixing,
1971
- Oe as deleteUserGroups,
1972
- pe as findAdresse,
1973
- z as getActiveServices,
1974
- Me as getAllContextSecurity,
1975
- Pe as getCSRFToken,
1976
- le as getCommunes,
1977
- we as getComplementUG,
1978
- Le as getDataFrom3DSpace,
1979
- ue as getDataFromGouvFr,
1980
- Ke as getDatasByTenant,
1981
- H as getDatasFrom3DSpace,
1982
- Ee as getDownloadDocument,
1983
- Xe as getInfoDocTags,
1984
- Ce as getUserGroupsList,
1985
- G as getUsersGroupRules,
1986
- Ge as get_3DSpace_csrf,
1987
- Ne as patchUserGroups,
1988
- be as patchUserGroupsControl,
1989
- Je as pushDataIn3DSpace,
1990
- ke as readUserGroupControl,
1991
- We as removeTagToDoc,
1992
- et as sayHello,
1993
- fe as updateEvent
1994
- };
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;