@beam3_dev/api_module 0.0.29 → 0.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/wb3Api.mjs DELETED
@@ -1,1994 +0,0 @@
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>
1713
- <br/>
1714
- <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>
1847
- <p><u>|⚠️<em> Merci de respecter l&#39;écriture des tags, en MAJUSCULES, nom complet, pas de caractères</em></u></p>
1848
- <p><u><em>|spéciaux, séparation par &#34;_&#34; si besoin !</em></u></p>
1849
- <p><strong>Référence client </strong>: <em>
1850
- <a data-predicate="ds6w:who" data-type="internal" class="s6m-tag-link s6m-link">CLIENT</a>
1851
- </em></p>
1852
- <p><strong>Référence projet </strong>: <em>
1853
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">NOM AFFAIRE</a>
1854
- <a data-predicate="ds6w:where" data-type="internal" class="s6m-tag-link s6m-link">VILLE</a>
1855
- <a data-predicate="ds6w:where" data-type="internal" class="s6m-tag-link s6m-link">DPT</a>
1856
- </em></p>
1857
- <p>&#x1f4dd; <strong>Base documentaire</strong> : LIEN projet</p>
1858
- <p>&#x1f4dd; <strong>Fiche COCLICO</strong> : LIEN projet<em><strong></strong>
1859
- </em></p>
1860
- <p><br /></p>
1861
- <table border="1">
1862
- <tbody>
1863
- <tr><td><strong>Description projet </strong>:
1864
- <br /><br /></td></tr>
1865
- </tbody>
1866
- </table>
1867
- <p><br /></p>
1868
- <p><br /></p>
1869
- <p><strong>Produit :<em> </em></strong><em>
1870
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Hexapli Usiné</a>
1871
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Hexapli MP</a>
1872
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Lamwood</a>
1873
- </em></p>
1874
- <p><strong>Type de Bâtiment :</strong><em>
1875
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Logements</a>
1876
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">BUP</a>
1877
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">ERP</a>
1878
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Plateforme Logistique</a>
1879
- </em></p>
1880
- <p><strong>Essence :</strong> <em>
1881
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">DOUGLAS</a>
1882
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">PIN</a>
1883
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">MIXTE</a>
1884
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">EPICEA</a>
1885
- </em></p>
1886
- <p><strong>Qualité : </strong><em>
1887
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">NVI</a>
1888
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">VI1F</a>
1889
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">VI2F</a>
1890
- </em><strong></strong></p>
1891
- <p><strong>Traitement : </strong><em>
1892
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">PARKA</a>
1893
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">CT2</a>
1894
- </em></p>
1895
- <p><strong>Type de Paroi : </strong><em>
1896
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Murs Intérieurs</a>
1897
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Murs Extérieurs</a>
1898
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Planchers</a>
1899
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Couverture</a>
1900
- </em></p>
1901
- <p><em>
1902
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Etanchéité Accessible</a>
1903
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Etanchéité Non-Accessible</a>
1904
- </em></p>
1905
- <p><strong>Hauteur Dernier Plancher :</strong><em><strong> </strong>
1906
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">Hauteur &lt;8m</a>
1907
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">8m&lt; Hauteur &lt;28m</a>
1908
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">28m&lt; Hauteur &lt;50m</a>
1909
- </em></p>
1910
- <h2><br /></h2>
1911
- <h2><u>EQUIPE PIVETEAU :</u></h2>
1912
- <table border="1">
1913
- <tbody>
1914
- <tr><td><strong>Chargé d&#39;Affaires</strong></td><td><br /></td></tr>
1915
- <tr><td><strong>Service études de prix</strong></td><td><br /></td></tr>
1916
- </tbody></table>
1917
- <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
- };