@beam3_dev/api_module 0.0.76 → 0.0.77

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