@beam3_dev/api_module 0.0.72 → 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,1960 +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({ response: o, headers: c, xhr: r });
435
- }
436
- });
437
- } else
438
- n && n("ERROR : url du 3DSpace non défini.");
439
- }
440
- function U(e, t = void 0, n = void 0) {
441
- let s = e.space + `/resources/v1/modeler/documents/${e.objID}/files/DownloadTicket`;
442
- k(
443
- e,
444
- (o) => {
445
- f(s, {
446
- method: "PUT",
447
- headers: {
448
- ENO_CSRF_TOKEN: e.token
449
- },
450
- onComplete(c) {
451
- const a = JSON.parse(c).data[0].dataelements.ticketURL;
452
- t && t(a);
453
- },
454
- onFailure(c, r) {
455
- console.warn("☠️ error => ", c, r), n && n(c, r);
456
- }
457
- });
458
- },
459
- (o) => {
460
- console.warn("_3DSpace_get_ticket / error => ", o), n && n(o);
461
- }
462
- );
463
- }
464
- function Ne(e, t, n, s = void 0, o = void 0) {
465
- const c = `${e.space}/resources/v1/modeler/documents/${t}/files/DownloadTicket`;
466
- n || (n = e.token), f(c, {
467
- method: "PUT",
468
- headers: {
469
- ENO_CSRF_TOKEN: n
470
- },
471
- onComplete(r) {
472
- let a = JSON.parse(r);
473
- if (console.log("☠️ info => ", a), a.success === !0)
474
- try {
475
- const i = a.data[0].dataelements.ticketURL;
476
- s && s(i);
477
- } catch (i) {
478
- o && o(i);
479
- }
480
- },
481
- onFailure(r) {
482
- o && o(r);
483
- }
484
- });
485
- }
486
- function K(e, t, n, s, o, c = void 0, r = void 0) {
487
- k(
488
- e,
489
- t,
490
- (a) => {
491
- W(
492
- e,
493
- t,
494
- n,
495
- s,
496
- o,
497
- a.csrf.value,
498
- c,
499
- r
500
- );
501
- }
502
- );
503
- }
504
- function W(e, t, n, s, o, c, r = void 0, a = void 0) {
505
- const i = e.space + `/resources/v1/modeler/documents/${t}/files/CheckinTicket`;
506
- f(i, {
507
- method: "PUT",
508
- headers: {
509
- ENO_CSRF_TOKEN: c
510
- },
511
- onComplete(d, l, p) {
512
- const u = JSON.parse(d).data[0].dataelements, m = new FormData();
513
- m.append("__fcs__jobTicket", u.ticket), m.append("file_0", s, o);
514
- const g = {};
515
- g.method = "POST", g.data = m, g.onComplete = function(h) {
516
- let S = "temp_" + Date.now(), _ = {
517
- method: "PUT",
518
- headers: {
519
- ENO_CSRF_TOKEN: c
520
- },
521
- data: JSON.stringify({
522
- data: [
523
- {
524
- id: t,
525
- relateddata: {
526
- files: [
527
- {
528
- id: n,
529
- dataelements: {
530
- title: o,
531
- receipt: h
532
- },
533
- updateAction: "REVISE"
534
- }
535
- ]
536
- },
537
- tempId: S
538
- }
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
- {
593
- type: "Document",
594
- dataelements: {
595
- title: `Title_${n.toLowerCase().split(" ").join("_")}`,
596
- policy: "Document Release",
597
- description: s
598
- },
599
- relateddata: {
600
- files: [
601
- {
602
- dataelements: {
603
- title: `${n}.json`,
604
- receipt: T
605
- }
606
- }
607
- ]
608
- },
609
- tempId: I()
610
- }
611
- ]
612
- }),
613
- type: "json",
614
- timeout: 0,
615
- onComplete: _,
616
- onFailure: y
617
- };
618
- i !== "" && f(p.url_Post, D);
619
- } else
620
- console.warn("le store est vide");
621
- },
622
- onFailure: y
623
- };
624
- function _(T) {
625
- console.log("Success -- response ", T.data[0]), o && o(T);
626
- }
627
- function y(T, D) {
628
- console.log("Erreur -- response ", T, `
629
- headers `, D), c && c(T);
630
- }
631
- f(h.ticketURL, S);
632
- }
633
- });
634
- }
635
- function b(e, t = void 0, n = void 0, s = void 0, o = void 0, c = void 0) {
636
- const r = `${e.space}/resources/modeler/pno/person?current=true&select=preferredcredentials&select=collabspaces`;
637
- f(r, {
638
- method: "GET",
639
- onComplete(a) {
640
- const i = JSON.parse(a);
641
- let d = "", l, p, u;
642
- if (t) {
643
- let m = i.collabspaces.find((g) => g.title === t);
644
- if (m) {
645
- l = t;
646
- let g = m.couples;
647
- g = g.filter(
648
- (h, S, _) => S === _.findIndex(
649
- (y) => y.organization.pid === h.organization.pid && y.role.pid === h.role.pid
650
- )
651
- ), n && (Array.isArray(n) ? n.forEach((h) => {
652
- u || g.forEach((S) => {
653
- if (h === S.role.name && s === S.organization.title)
654
- u = h, p = s;
655
- else if (h === S.role.name) {
656
- let _ = g.filter(
657
- (y) => y.role.name === h
658
- );
659
- _.length === 1 ? (u = _[0].role.name, p = _[0].organization.title) : c(_);
660
- }
661
- });
662
- }) : g.forEach((h) => {
663
- if (n === h.role.name && s === h.organization.title)
664
- u = n, p = s;
665
- else if (n === h.role.name) {
666
- let S = g.filter(
667
- (_) => _.role.name === n
668
- );
669
- S.length === 1 ? (u = S[0].role.name, p = S[0].organization.title) : c(S);
670
- }
671
- }));
672
- }
673
- }
674
- 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));
675
- },
676
- onFailure(a) {
677
- console.log("Erreur de récupération du contexte de sécurité. => ", a);
678
- }
679
- });
680
- }
681
- async function R(e, t = void 0, n = void 0) {
682
- return (!e.objID || e.objID === "") && console.warn(
683
- "_3DSpace_download_doc() / Le paramètre objectId est obligatoire"
684
- ), (e.space === "" || !e.space) && console.warn(
685
- "_3DSpace_download_doc() / Le paramètre space est obligatoire"
686
- ), (e.token === "" || !e.token) && (J(
687
- e,
688
- (o) => {
689
- e.token = o;
690
- },
691
- (o) => {
692
- console.log("☠️ error => ", o);
693
- }
694
- ), console.warn(
695
- "_3DSpace_download_doc() / Le paramètre token est obligatoire"
696
- )), new Promise((o, c) => {
697
- U(
698
- e,
699
- (r) => {
700
- f(r, {
701
- headers: {
702
- "Content-Type": "application/json",
703
- Accept: "application/json"
704
- },
705
- onComplete(i) {
706
- const d = JSON.parse(i);
707
- t && t(d), o(d);
708
- },
709
- onFailure(i, d, l) {
710
- n && (console.log("error http", i), n({ msg: JSON.parse(i), headers: d, xhr: l }), c({ msg: JSON.parse(i), headers: d, xhr: l }));
711
- }
712
- });
713
- },
714
- (r) => {
715
- n && n(r), console.log("*_3dspace_download_doc / error file URL *", r), c(r);
716
- }
717
- );
718
- });
719
- }
720
- async function X(e, t, n = void 0, s = void 0) {
721
- let o = [];
722
- for (let a = 0; a < t.length; a += 80) {
723
- const i = t.slice(a, a + 80);
724
- o.push(i);
725
- }
726
- const r = (a) => {
727
- V(
728
- e,
729
- o[a],
730
- () => {
731
- a++, a < o.length && r(a);
732
- },
733
- (i) => {
734
- n && n(i);
735
- }
736
- );
737
- };
738
- r(0);
739
- }
740
- function V(e, t, n = void 0, s = void 0, o = void 0) {
741
- const c = [];
742
- t.forEach((i) => {
743
- c.push({
744
- id: i
745
- });
746
- });
747
- let r = JSON.stringify({
748
- csrf: {
749
- name: "ENO_CSRF_TOKEN",
750
- value: e.token
751
- },
752
- data: c
753
- });
754
- const a = `${e.space}/resources/v1/modeler/documents/DownloadTicket?tenant=${e.tenant}&e6w-lang=fr&e6w-timezone=-120`;
755
- f(a, {
756
- method: "PUT",
757
- data: r,
758
- type: "json",
759
- onComplete(i) {
760
- const d = i.data;
761
- i.success === !0 && (n && n(), d.forEach((l) => {
762
- try {
763
- const p = l.dataelements.fileName, u = l.dataelements.ticketURL;
764
- f(u, {
765
- onComplete: (m) => {
766
- s && s({
767
- objectId: l.id,
768
- fileName: p,
769
- data: JSON.parse(m)
770
- });
771
- },
772
- onFailure: (m) => {
773
- console.log("error http", m);
774
- }
775
- });
776
- } catch (p) {
777
- console.log(p), o && o(p);
778
- }
779
- }));
780
- },
781
- onFailure(i) {
782
- console.log(i), o && o(i);
783
- }
784
- });
785
- }
786
- function De(e, t, n = void 0, s = void 0) {
787
- return new Promise((o) => {
788
- if (e.token === "" && C(e), t !== void 0 && t !== "" && t !== null) {
789
- const c = `${e.space}/resources/v1/modeler/dslc/maturity/getNextStates`;
790
- b(
791
- e.space,
792
- "ESPACE COMMUN",
793
- ["VPLMProjectLeader", "VPLMCreator"],
794
- void 0,
795
- (a) => e.ctx = a,
796
- (a) => {
797
- console.log("onError =>", a);
798
- }
799
- );
800
- let r = {
801
- method: "POST",
802
- headers: {
803
- SecurityContext: "ctx::" + e.ctx,
804
- ENO_CSRF_TOKEN: e.token,
805
- Accept: "application/json",
806
- "Content-Type": "application/json"
807
- },
808
- data: JSON.stringify({
809
- data: [
810
- {
811
- id: t
812
- }
813
- ]
814
- }),
815
- type: "json",
816
- onComplete(a) {
817
- n && n(a);
818
- },
819
- onFailure(a) {
820
- s && s(a);
821
- }
822
- };
823
- f(c, r);
824
- }
825
- });
826
- }
827
- function Fe(e, t, n, s = void 0, o = void 0) {
828
- return new Promise((c) => {
829
- if (e.token === "" && C(e), t !== void 0 && t !== "" && t !== null) {
830
- const r = `${e.space}/resources/v1/modeler/dslc/maturity/changeState`;
831
- b(
832
- e.space,
833
- "ESPACE COMMUN",
834
- ["VPLMProjectLeader", "VPLMCreator"],
835
- void 0,
836
- (i) => e.ctx = i,
837
- (i) => {
838
- console.log("onError =>", i);
839
- }
840
- );
841
- let a = {
842
- method: "POST",
843
- headers: {
844
- SecurityContext: "ctx::" + e.ctx,
845
- ENO_CSRF_TOKEN: e.token,
846
- Accept: "application/json",
847
- "Content-Type": "application/json"
848
- },
849
- data: JSON.stringify({
850
- data: [
851
- {
852
- id: t,
853
- nextState: n
854
- }
855
- ]
856
- }),
857
- type: "json",
858
- onComplete(i) {
859
- s && s(i);
860
- },
861
- onFailure(i) {
862
- o && o(i);
863
- }
864
- };
865
- f(r, a);
866
- }
867
- });
868
- }
869
- function Ue(e, t, n = void 0, s = void 0) {
870
- return new Promise((o) => {
871
- if (e.token === "" && C(e), t !== void 0 && t !== "" && t !== null) {
872
- const c = `${e.space}/resources/v1/dslc/versiongraph?withThumbnail=0&withIsLastVersion=0&withAttributes=0&withCopyFrom=0&tenant=${e.tenant}`;
873
- b(
874
- e.space,
875
- "ESPACE COMMUN",
876
- ["VPLMProjectLeader", "VPLMCreator"],
877
- void 0,
878
- (a) => e.ctx = a,
879
- (a) => {
880
- console.log("onError =>", a);
881
- }
882
- );
883
- let r = {
884
- method: "POST",
885
- headers: {
886
- securitycontext: "ctx::" + e.ctx,
887
- ENO_CSRF_TOKEN: e.token,
888
- Accept: "application/json",
889
- "Content-Type": "application/json"
890
- },
891
- data: JSON.stringify({
892
- graphRequests: [
893
- {
894
- id: t
895
- }
896
- ]
897
- }),
898
- type: "json",
899
- onComplete(a) {
900
- n && n(a);
901
- },
902
- onFailure(a) {
903
- s && s(a);
904
- }
905
- };
906
- f(c, r);
907
- }
908
- });
909
- }
910
- function je(e, t, n = void 0, s = void 0) {
911
- return new Promise((o) => {
912
- if (e.token === "" && C(e), t !== void 0 && t !== "" && t !== null) {
913
- const c = `${e.space}/resources/lifecycle/revise/prepare_revise_maskattributes?tenant=${e.tenant}`;
914
- b(
915
- e.space,
916
- "ESPACE COMMUN",
917
- ["VPLMProjectLeader", "VPLMCreator"],
918
- void 0,
919
- (a) => e.ctx = a,
920
- (a) => {
921
- console.log("onError =>", a);
922
- }
923
- );
924
- let r = {
925
- method: "POST",
926
- headers: {
927
- SecurityContext: "ctx::" + e.ctx,
928
- ENO_CSRF_TOKEN: e.token,
929
- Accept: "application/json",
930
- "Content-Type": "application/json"
931
- },
932
- data: JSON.stringify({
933
- data: [
934
- {
935
- "attribute[PLMReference.V_versionComment]": null,
936
- physicalid: t,
937
- type: "Document",
938
- tenant: e.tenant,
939
- objectId: t,
940
- policy: "Document Release",
941
- availableSemantic: ["E", "LAST", "NEW", "DUP"]
942
- }
943
- ]
944
- }),
945
- type: "json",
946
- onComplete(a) {
947
- n && n(a);
948
- },
949
- onFailure(a) {
950
- s && s(a);
951
- }
952
- };
953
- f(c, r);
954
- }
955
- });
956
- }
957
- function $e(e, t, n, s = void 0, o = void 0) {
958
- return new Promise((c) => {
959
- if (e.token === "" && C(e), t !== void 0 && t !== "" && t !== null) {
960
- const r = `${e.space}/resources/lifecycle/revise/major?tenant=${e.tenant}`;
961
- b(
962
- e.space,
963
- "ESPACE COMMUN",
964
- ["VPLMProjectLeader", "VPLMCreator"],
965
- void 0,
966
- (i) => e.ctx = i,
967
- (i) => {
968
- console.log("onError =>", i);
969
- }
970
- );
971
- let a = {
972
- method: "POST",
973
- headers: {
974
- securitycontext: "ctx::" + e.ctx,
975
- ENO_CSRF_TOKEN: e.token,
976
- Accept: "application/json",
977
- "Content-Type": "application/json"
978
- },
979
- data: JSON.stringify({
980
- data: [
981
- {
982
- physicalid: t,
983
- proposedRevision: n,
984
- modifiedAttributes: {
985
- revision: n
986
- }
987
- }
988
- ],
989
- folderid: null,
990
- notificationTimeout: 600
991
- }),
992
- type: "json",
993
- onComplete(i) {
994
- s && s(i);
995
- },
996
- onFailure(i) {
997
- o && o(i);
998
- }
999
- };
1000
- f(r, a);
1001
- }
1002
- });
1003
- }
1004
- //!SECTION
1005
- function Ae(e, t = void 0, n = void 0) {
1006
- const s = {
1007
- base: `${e.space}`,
1008
- uri: "/resources/bps/cspaces",
1009
- optTenant: `tenant=${e.tenant}`
1010
- }, o = `${s.base}${s.uri}?${s.optTenant}`;
1011
- f(o, {
1012
- method: "GET",
1013
- headers: {
1014
- Accept: "application/json,text/javascript,*/*",
1015
- "Content-Type": "application/ds-json"
1016
- },
1017
- onComplete(c, r) {
1018
- const a = JSON.parse(c);
1019
- t && t(a, r);
1020
- },
1021
- onFailure(c, r, a) {
1022
- n && n({ response: c, headers: r, xhr: a });
1023
- }
1024
- });
1025
- }
1026
- function Ie(e, t, n, s) {
1027
- U(
1028
- e.space,
1029
- t,
1030
- (o) => {
1031
- f(o, {
1032
- header: { ENO_CSRF_TOKEN: e.token },
1033
- onComplete: (c) => {
1034
- n && n(c);
1035
- },
1036
- onFailure: (c) => {
1037
- console.log("error http", c), s && s(c);
1038
- }
1039
- });
1040
- }
1041
- );
1042
- }
1043
- async function Re(e, t, n = void 0, s = void 0) {
1044
- return new Promise((o) => {
1045
- U(e, t, (c) => {
1046
- f(c, {
1047
- onComplete: (r, a, i) => (o(JSON.parse(r)), n && n(JSON.parse(r), a, i), o),
1048
- onFailure: (r, a, i) => {
1049
- s && s(r, a, i), console.log(r, a?.errormsg);
1050
- }
1051
- });
1052
- });
1053
- });
1054
- }
1055
- function ve(e, t, n, s = void 0, o = void 0) {
1056
- const c = new Blob([JSON.stringify(t)], { type: "text/plain" });
1057
- k(
1058
- e,
1059
- n,
1060
- (r) => {
1061
- 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;
1062
- K(
1063
- e,
1064
- n,
1065
- a,
1066
- c,
1067
- i,
1068
- (d) => {
1069
- s && s(d);
1070
- },
1071
- (d) => {
1072
- o && o(d);
1073
- }
1074
- );
1075
- }
1076
- );
1077
- }
1078
- let v, P;
1079
- const j = [];
1080
- async function Pe(e, t = void 0, n = void 0) {
1081
- e.objID && e.objID !== "" ? k(
1082
- e,
1083
- (s) => {
1084
- t && t(s);
1085
- },
1086
- (s) => {
1087
- n && n(s);
1088
- }
1089
- ) : (e.objID === null || e.objID === "") && C(
1090
- e,
1091
- (s) => {
1092
- t && t({ rep: s, msg: "Pas d'objID, ou invalide" });
1093
- },
1094
- (s) => {
1095
- n && n({ msg: "Pas d'objID et erreur sur le Space", err: s });
1096
- }
1097
- );
1098
- }
1099
- async function xe(e, t = void 0, n = void 0) {
1100
- console.log("getDatasByTenant (getDocuments)", e), await R(
1101
- e,
1102
- (s) => {
1103
- const o = {};
1104
- o.obj = s, console.log("getDatasByTenant (getDocuments) _datas", o), t && t?.(o);
1105
- },
1106
- (s) => {
1107
- n && n?.(s);
1108
- }
1109
- );
1110
- }
1111
- function Me(e, t = void 0, n = void 0) {
1112
- const s = [];
1113
- if (!e.objIds && !Array.isArray(e.objIds) && e.objIds.length === 0) {
1114
- console.warn("la liste est vide ou n'est pas un tableau");
1115
- return;
1116
- }
1117
- e.objIds.forEach((o, c) => {
1118
- R(
1119
- e,
1120
- o.objID,
1121
- (r) => {
1122
- 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);
1123
- }
1124
- );
1125
- });
1126
- }
1127
- function B(e, t, n = void 0, s = void 0) {
1128
- X(
1129
- e,
1130
- v,
1131
- (o) => {
1132
- const c = [...t];
1133
- c.find((r) => r.objectID === o.objectId).data = o.data, P = c, j.push(o.data), n && n(j);
1134
- },
1135
- (o) => {
1136
- s && (s(o), console.log(o));
1137
- }
1138
- );
1139
- }
1140
- const Y = "FA35FB9B177A280065800EA0000F599C", H = [
1141
- "swym",
1142
- "3dspace",
1143
- "drive",
1144
- "usersgroup",
1145
- "3dplan",
1146
- "dashboard"
1147
- ], x = {
1148
- how: "ds6w:how",
1149
- what: "ds6w:what",
1150
- when: "ds6w:when",
1151
- where: "ds6w:where",
1152
- who: "ds6w:who",
1153
- why: "ds6w:why"
1154
- }, z = {
1155
- objId: Y,
1156
- pred: "who",
1157
- order_by: "desc",
1158
- tag: "testTag"
1159
- };
1160
- function Le(e, t, n = void 0, s = void 0) {
1161
- const { space: o, tenant: c } = e, { objId: r, pred: a, tag: i } = t, d = {
1162
- uri: "/resources/6w/tags",
1163
- otpCTX: "SecurityContext=preferred",
1164
- optTenant: `tenant=${c}`
1165
- }, l = `${o}${d.uri}?${d.otpCTX}&${d.optTenant}`, p = {
1166
- tag: [
1167
- {
1168
- subject: [
1169
- {
1170
- uri: `pid://${r}`
1171
- }
1172
- ],
1173
- predicate: x[a],
1174
- object: {
1175
- literal: i
1176
- }
1177
- }
1178
- ]
1179
- };
1180
- f(l, {
1181
- method: "PUT",
1182
- headers: {
1183
- "Content-Type": "application/json",
1184
- Accept: "application/json"
1185
- },
1186
- data: JSON.stringify(p),
1187
- onComplete(u) {
1188
- JSON.parse(u);
1189
- const m = {};
1190
- setTimeout(() => {
1191
- G(
1192
- e,
1193
- r,
1194
- (g) => {
1195
- 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;
1196
- m.name = h, m.ext = S, m.createBy = _, t.info = { ...m }, q(
1197
- e,
1198
- t,
1199
- (y) => {
1200
- n && n(y);
1201
- },
1202
- (y) => {
1203
- s && s(y);
1204
- }
1205
- );
1206
- },
1207
- (g, h) => {
1208
- const S = g;
1209
- S.msg = h.errormsg, S.errCode = h.errorcode, console.log("❌ sendDirectMessage => ", S), s && s(S);
1210
- }
1211
- );
1212
- }, 2e3);
1213
- },
1214
- onFailure(u, m) {
1215
- const g = u;
1216
- g.msg = m.errormsg, g.errCode = m.errorcode, console.log("❌ sendDirectMessage => ", g), s && s(g);
1217
- }
1218
- });
1219
- }
1220
- function q(e, t, n = void 0, s = void 0) {
1221
- console.log("obj ", t);
1222
- const o = t.info.name, c = {
1223
- baseUrl: `https://${e.tenant.toLowerCase()}-eu1-fedsearch.3dexperience.3ds.com`,
1224
- uri: "/federated/search"
1225
- }, r = `${c.baseUrl}${c.uri}`, a = {
1226
- "Content-Type": "application/json",
1227
- Accept: "application/json,text/javascript,*/*"
1228
- }, i = I(), d = {
1229
- with_indexing_date: !0,
1230
- with_synthesis: !0,
1231
- with_nls: !1,
1232
- label: `3DSearch-${e.currentUser.username}-AjoutDeTagBeam-${i}`,
1233
- locale: "fr",
1234
- select_predicate: [
1235
- "ds6w:label",
1236
- "ds6w:type",
1237
- "ds6w:description",
1238
- "ds6w:identifier",
1239
- "ds6w:modified",
1240
- "ds6w:created",
1241
- "ds6wg:revision",
1242
- "ds6w:status",
1243
- "ds6w:responsible",
1244
- "owner",
1245
- "ds6w:responsibleUid",
1246
- "ds6wg:filesize",
1247
- "ds6w:project",
1248
- "ds6w:dataSource",
1249
- "ds6w:community",
1250
- "ds6w:originator",
1251
- "dsgeo:referential",
1252
- "ds6w:lastModifiedBy",
1253
- "ds6w:repository",
1254
- "dcterms:title",
1255
- "dcterms:description",
1256
- "ds6w:containerUid"
1257
- ],
1258
- with_synthesis_hierarchical: !0,
1259
- select_file: ["icon", "thumbnail_2d"],
1260
- query: o,
1261
- specific_source_parameter: {
1262
- "3dspace": {
1263
- 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)'
1264
- },
1265
- drive: {
1266
- additional_query: ' AND NOT ([flattenedtaxonomies]:"types/DriveNode" AND ( [current]:"Trashed" OR [policy]:"Drive File Iteration") )'
1267
- }
1268
- },
1269
- select_exclude_synthesis: ["ds6w:what/ds6w:topic"],
1270
- order_by: z.order_by,
1271
- order_field: "relevance",
1272
- select_snippets: [
1273
- "ds6w:snippet",
1274
- "ds6w:label:snippet",
1275
- "ds6w:responsible:snippet",
1276
- "ds6w:community:snippet",
1277
- "swym:message_text:snippet"
1278
- ],
1279
- nresults: 40,
1280
- start: "0",
1281
- source: H,
1282
- tenant: e.tenant,
1283
- login: {
1284
- "3dspace": {
1285
- SecurityContext: e.ctx
1286
- }
1287
- }
1288
- };
1289
- console.log("dataPattern => ", d), f(r, {
1290
- method: "POST",
1291
- headers: a,
1292
- data: JSON.stringify(d),
1293
- onComplete(l) {
1294
- const p = JSON.parse(l);
1295
- n(p);
1296
- },
1297
- onFailure(l, p) {
1298
- const u = l;
1299
- 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);
1300
- }
1301
- });
1302
- }
1303
- function Ee(e, t, n = void 0, s = void 0) {
1304
- const { objId: o, pred: c, tag: r } = t, a = {
1305
- uri: "/resources/6w/tags",
1306
- otpCTX: "SecurityContext=preferred",
1307
- optTenant: `tenant=${e.tenant}`
1308
- }, i = `${e.space}${a.uri}?${a.otpCTX}&${a.optTenant}`, d = {
1309
- tag: [
1310
- {
1311
- subject: [
1312
- {
1313
- uri: `pid://${o}`
1314
- }
1315
- ],
1316
- predicate: x[c],
1317
- object: {
1318
- literal: r
1319
- }
1320
- }
1321
- ]
1322
- };
1323
- f(i, {
1324
- method: "DELETE",
1325
- data: JSON.stringify(d),
1326
- headers: {
1327
- "Content-Type": "application/json",
1328
- Accept: "application/json,text/javascript,*/*"
1329
- },
1330
- onComplete(l) {
1331
- n && n(l);
1332
- },
1333
- onFailure(l, p) {
1334
- const u = l;
1335
- u.msg = p.errormsg, u.errCode = p.errorcode, console.log("❌ sendDirectMessage => ", u), s && s(u);
1336
- }
1337
- });
1338
- }
1339
- function Je(e, t = "", n = void 0, s = void 0) {
1340
- const { space: o } = e;
1341
- if (t === "")
1342
- return;
1343
- const c = {
1344
- uri: "/resources/v1/modeler/documents"
1345
- }, r = {
1346
- "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
1347
- Accept: "application/json,text/javascript,*/*"
1348
- }, 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}`;
1349
- f(a, {
1350
- method: "POST",
1351
- headers: r,
1352
- data: i,
1353
- onComplete(d) {
1354
- n && n(JSON.parse(d));
1355
- },
1356
- onFailure(d, l) {
1357
- const p = d;
1358
- p.msg = l.error, s && s(p);
1359
- }
1360
- });
1361
- }
1362
- async function w(e, t = void 0, n = void 0) {
1363
- const s = e.space + "/api/index/tk";
1364
- return f(s, {
1365
- onComplete(o, c, r) {
1366
- const a = JSON.parse(o);
1367
- if (t)
1368
- return t(a), e.token = a?.result?.ServerToken;
1369
- },
1370
- onFailure(o) {
1371
- n && n(o);
1372
- }
1373
- });
1374
- }
1375
- function Ge(e, t = void 0, n = void 0) {
1376
- const s = `${e.space}/api/exalead/whatsnew`, o = {
1377
- params: {
1378
- community_id: null,
1379
- hash_key: null,
1380
- legacyFormat: !1,
1381
- nresults: 1,
1382
- query: "#all",
1383
- start: 0
1384
- }
1385
- };
1386
- w(e, (c) => {
1387
- f(s, {
1388
- method: "POST",
1389
- headers: {
1390
- "X-DS-SWYM-CSRFTOKEN": c.result.ServerToken,
1391
- "Content-type": "application/json;charset=UTF-8",
1392
- Accept: "application/json"
1393
- },
1394
- data: JSON.stringify(o),
1395
- type: "json",
1396
- onComplete(r, a) {
1397
- t && t(r, a);
1398
- },
1399
- onFailure(r, a) {
1400
- n && n(r, a);
1401
- }
1402
- });
1403
- });
1404
- }
1405
- function Ke(e, t = void 0, n = void 0) {
1406
- const s = `${e.space}/api/Recommendation/getpeoplefamiliartocurrentuser`, o = {
1407
- params: {
1408
- idsToFilterArr: [],
1409
- mode: "offline",
1410
- limit: 30,
1411
- itemType: "User",
1412
- maxNbOfCommonElements: "5"
1413
- }
1414
- };
1415
- w(e, (c) => {
1416
- f(s, {
1417
- method: "POST",
1418
- headers: {
1419
- "X-DS-SWYM-CSRFTOKEN": c.result.ServerToken,
1420
- "Content-type": "application/json;charset=UTF-8",
1421
- Accept: "application/json"
1422
- },
1423
- data: JSON.stringify(o),
1424
- type: "json",
1425
- onComplete(r, a) {
1426
- const i = r.result.hits.map((d) => ({ login: d.login, fullName: d.name }));
1427
- t && t(i, r);
1428
- },
1429
- onFailure(r, a) {
1430
- n && n(r, a);
1431
- }
1432
- });
1433
- });
1434
- }
1435
- function We(e, t = void 0, n = void 0) {
1436
- const s = {
1437
- base: e.space,
1438
- uri: "/api/community/listmycommunities",
1439
- limit: `/limit/${e.limit ? e.limit : 128}`,
1440
- page: `/page/${e.page ? e.page : "1"}`
1441
- }, o = `${s.base}${s.uri}${s.limit}${s.page}`, c = [];
1442
- w(e, (r) => {
1443
- f(o, {
1444
- method: "GET",
1445
- headers: {
1446
- "X-DS-SWYM-CSRFTOKEN": r.result.ServerToken
1447
- },
1448
- onComplete(a, i, d) {
1449
- const p = JSON.parse(a).result;
1450
- let u = 0;
1451
- p.forEach((m) => {
1452
- const g = {
1453
- description: m.description,
1454
- id: m.id,
1455
- title: m.title,
1456
- owner: m.owner,
1457
- role: m.role,
1458
- access: m.access
1459
- };
1460
- Q(
1461
- e,
1462
- m.id,
1463
- (h) => {
1464
- u++, g.members = h, c.push(g), u === p.length && t && t(c);
1465
- },
1466
- (h) => n(h)
1467
- );
1468
- });
1469
- },
1470
- onFailure(a, i) {
1471
- const d = a;
1472
- d.status = i.status, d.response = i.errormsg, n && n(d);
1473
- }
1474
- });
1475
- });
1476
- }
1477
- function Q(e, t, n, s) {
1478
- const o = `${e.space}/api/community/listmembers`, c = {
1479
- params: {
1480
- page: e.page ? e.page : 1,
1481
- limit: e.limit ? e.limit : 50,
1482
- community_id: t
1483
- }
1484
- };
1485
- w(e, (r) => {
1486
- f(o, {
1487
- method: "POST",
1488
- headers: {
1489
- "Content-type": "application/json;charset=UTF-8",
1490
- Accept: "application/json",
1491
- "X-DS-SWYM-CSRFTOKEN": r.result.ServerToken
1492
- },
1493
- data: JSON.stringify(c),
1494
- type: "json",
1495
- onComplete(a, i, d) {
1496
- n && n(a);
1497
- },
1498
- onFailure(a, i) {
1499
- const d = a;
1500
- d.status = i.status, d.response = i.errormsg, s && s(d);
1501
- }
1502
- });
1503
- });
1504
- }
1505
- function Xe(e, t = void 0, n = void 0) {
1506
- const s = "YXdA5x4DSUKtlAi2wmnyTA";
1507
- e.commu_id || (e.commu_id = s);
1508
- const o = `${e.space}/api/v2/communities/${e.commu_id}/ideas/statuses`;
1509
- w(e, (c) => {
1510
- f(o, {
1511
- method: "GET",
1512
- headers: {
1513
- "Content-type": "application/json;charset=UTF-8",
1514
- Accept: "application/json",
1515
- "X-DS-SWYM-CSRFTOKEN": c.result.ServerToken
1516
- },
1517
- onComplete(r) {
1518
- const a = JSON.parse(r);
1519
- t && t(a);
1520
- },
1521
- onFailure(r, a) {
1522
- const i = r;
1523
- i.status = a.status, i.response = a.errormsg, n && n(i);
1524
- }
1525
- });
1526
- });
1527
- }
1528
- function Ve(e, t, n = void 0, s = void 0) {
1529
- const { listAllContacts: o, currentUser: c } = e;
1530
- console.log("__listAllContacts", o.hits);
1531
- const r = `${e.space}/api/directmessages`, a = {
1532
- users: [c.login].concat(t.receipt)
1533
- }, i = {
1534
- id_msg: "",
1535
- senderId: e.currentUser.login,
1536
- senderName: `${e.currentUser.first_name} ${e.currentUser.last_name}`,
1537
- msg: ee(t.msg)
1538
- };
1539
- let d = !1;
1540
- Z(
1541
- a.users,
1542
- (l) => {
1543
- l !== void 0 && (i.id_msg = l.id, d = !0, $(e, i));
1544
- },
1545
- (l) => {
1546
- d = !1, console.log("_3dSwym_findCommunityToInstantMSG callback", l), s && s(l), i.id_msg = "";
1547
- }
1548
- ), d === !1 && setTimeout(() => {
1549
- d === !1 && w(e, (l) => {
1550
- f(r, {
1551
- method: "POST",
1552
- headers: {
1553
- "Content-Type": "application/json",
1554
- Accept: "application/json",
1555
- "X-DS-SWYM-CSRFTOKEN": l.result.ServerToken
1556
- },
1557
- data: JSON.stringify(a),
1558
- type: "json",
1559
- onComplete(p, u, m) {
1560
- const g = p;
1561
- g.reponse = JSON.parse(m.response), g.status = m.status, n && n(g), i.id_msg = g.result.id, $(e, i);
1562
- },
1563
- onFailure(p, u, m) {
1564
- const g = p;
1565
- g.msg = u.errormsg, g.status = u.status, s && s(g);
1566
- }
1567
- });
1568
- });
1569
- }, 500);
1570
- }
1571
- function Z(e, t, n, s) {
1572
- const o = `${e.space}/api/directmessages/lite?with_favorites=false`;
1573
- w(e, (c) => {
1574
- f(o, {
1575
- method: "GET",
1576
- headers: {
1577
- Accept: "application/json,text/javascript,*/*",
1578
- "X-DS-SWYM-CSRFTOKEN": c.result.ServerToken
1579
- },
1580
- onComplete(r) {
1581
- const a = JSON.parse(r), i = [];
1582
- a.result.forEach((p) => {
1583
- p.users = p.users.sort((u, m) => u.login.localeCompare(m.login)), p.users.length === t.length && i.push(p);
1584
- });
1585
- const d = t.sort(), l = i.find((p) => {
1586
- const u = [];
1587
- return p.users.forEach((m) => {
1588
- u.push(m.login);
1589
- }), JSON.stringify(u) === JSON.stringify(d);
1590
- });
1591
- n && l !== void 0 ? n(l) : (s || l === void 0) && s(l);
1592
- },
1593
- onFailure(r) {
1594
- const a = r;
1595
- a.msg = headers.errormsg, a.errCode = headers.errorcode, console.log("❌ sendDirectMessageLite => ", a), s && s(a);
1596
- }
1597
- });
1598
- });
1599
- }
1600
- function $(e, t, n = void 0, s = void 0) {
1601
- const o = {
1602
- base: e.space,
1603
- uri: "/api/community",
1604
- id_msg: `${t.id_msg}`,
1605
- endUri: "/instantmessages"
1606
- }, c = `${o.base}${o.uri}/${o.id_msg}${o.endUri}`, r = {
1607
- author: { login: t.senderId, displayName: t.senderName },
1608
- accessState: null,
1609
- commentUri: null,
1610
- comments: null,
1611
- endorsements: null,
1612
- moderationState: null,
1613
- parentCommentUri: null,
1614
- richMessage: t.msg
1615
- };
1616
- console.log("_3dSwym_sendDirectMessageData url ", c), w(e, (a) => {
1617
- f(c, {
1618
- method: "POST",
1619
- headers: {
1620
- "Content-Type": "application/json",
1621
- Accept: "application/json",
1622
- "X-DS-SWYM-CSRFTOKEN": a.result.ServerToken
1623
- },
1624
- data: JSON.stringify(r),
1625
- type: "json",
1626
- onComplete(i, d, l) {
1627
- const p = i;
1628
- p.status = l.status, p.response = JSON.parse(l.response), console.log("✅ _3dSwym_sendDirectMessageData => ", p), n && n(p);
1629
- },
1630
- onFailure(i, d) {
1631
- const l = i;
1632
- l.msg = d.errormsg, l.errCode = d.errorcode, console.log("❌ sendDirectMessage => ", l), s && s(l);
1633
- }
1634
- });
1635
- });
1636
- }
1637
- function ee(e) {
1638
- const t = (/* @__PURE__ */ new Date()).toLocaleDateString(), n = (/* @__PURE__ */ new Date()).toLocaleTimeString();
1639
- return `<p>${e} </p>
1640
- <br/>
1641
- <hr/>
1642
- <p><u>envoyer :</u>Le <b>${t} à ${n}</b></p>`;
1643
- }
1644
- const te = {
1645
- title: "TEST DEV COMMUNITY IDEA",
1646
- // titre du post
1647
- community_id: "YXdA5x4DSUKtlAi2wmnyTA",
1648
- // STATUT PROJETS - Phase commerciale, tenant PIVETEAU TEST
1649
- community_title: "TEST DEV COMMUNITY",
1650
- // Possibilité de recherche par titre de la communauté (option)
1651
- idee_id: "THhRI8rlQNWKRxpv3Xqqug"
1652
- // id de l'idee qui est créer au post (_3dSwym_postIdea)
1653
- };
1654
- function Be(e, t, n = void 0, s = void 0) {
1655
- const o = `${e.space}/api/idea/add`, c = e.swymCommunities.find(
1656
- (i) => i.id === t.community_id
1657
- ), r = e.swymCommunities.find(
1658
- (i) => i.title.toLowerCase() === t.community_title.toLowerCase()
1659
- ), a = {
1660
- params: {
1661
- title: t.title,
1662
- // String, le nom de l'affaire
1663
- community_id: c?.id !== void 0 ? c.id : r.id,
1664
- // String, l'id de la communauté
1665
- message: ne(t.text_html),
1666
- // STRING => le contenue du message doit être au format HTML
1667
- published: 1
1668
- // 1 publier, 0 non publier
1669
- }
1670
- };
1671
- w(e, (i) => {
1672
- const d = {
1673
- "Content-type": "application/json;charset=UTF-8",
1674
- Accept: "application/json",
1675
- "X-DS-SWYM-CSRFTOKEN": i.result.ServerToken
1676
- };
1677
- f(o, {
1678
- method: "POST",
1679
- headers: d,
1680
- data: JSON.stringify(a),
1681
- type: "json",
1682
- onComplete(l, p, u) {
1683
- const m = JSON.parse(l);
1684
- m.status = u.status, m.response = u.response, n && n(m);
1685
- },
1686
- onFailure(l, p, u) {
1687
- const m = l;
1688
- m.status = p.status, m.response = p.errormsg, s && s(m);
1689
- }
1690
- });
1691
- });
1692
- }
1693
- function Ye(e, t, n = void 0, s = void 0) {
1694
- const o = `${e.space}/api/idea/delete`, c = {
1695
- params: {
1696
- community_id: t.community_id,
1697
- ideationIds: [t.idee_id]
1698
- }
1699
- };
1700
- w(e, (r) => {
1701
- f(o, {
1702
- method: "POST",
1703
- headers: {
1704
- "Content-type": "application/json;charset=UTF-8",
1705
- Accept: "application/json",
1706
- "X-DS-SWYM-CSRFTOKEN": r.result.ServerToken
1707
- },
1708
- data: JSON.stringify(c),
1709
- type: "json",
1710
- onComplete(a, i, d) {
1711
- n && n(a);
1712
- },
1713
- onFailure(a, i, d) {
1714
- const l = a;
1715
- l.status = i.status, l.response = i.errormsg, s && s(l);
1716
- }
1717
- });
1718
- });
1719
- }
1720
- function He(e, t = "", n = void 0, s = void 0) {
1721
- const o = e.tenant.toLowerCase() === "r1132101716373" ? "tFtz0G4MR6qNtKgJjNfTog" : e.tenant.toLowerCase() === "r1132101286859" ? "Qpv3HN-tTDOsU-7_c5DnDg" : "Template_d'idée_à_créer";
1722
- t === "" && (t = o);
1723
- const c = `${e.space}/api/idea/get`, r = {
1724
- params: {
1725
- id: t
1726
- }
1727
- };
1728
- w(e, (a) => {
1729
- f(c, {
1730
- method: "POST",
1731
- headers: {
1732
- "Content-type": "application/json;charset=UTF-8",
1733
- Accept: "application/json",
1734
- "X-DS-SWYM-CSRFTOKEN": a.result.ServerToken
1735
- },
1736
- data: JSON.stringify(r),
1737
- type: "json",
1738
- onComplete(i) {
1739
- const d = i;
1740
- d.msg = d.result.message, n && n(d);
1741
- },
1742
- onFailure(i) {
1743
- const d = i;
1744
- d.status = headers.status, d.response = headers.errormsg, s && s(d);
1745
- }
1746
- });
1747
- });
1748
- }
1749
- function ze(e, t = te, n = void 0, s = void 0) {
1750
- const o = {
1751
- uri: "/api/idea/list",
1752
- comId: `/community_id/${e.tenant.toLowerCase() === "r1132101716373" ? t.community_id : "bgnIsG74SUWswyGzS6NC6g"}`,
1753
- limit: `/limit/${t.limit ? t.limit : 10}`
1754
- }, c = `${e.space}${o.uri}${o.comId}${o.limit}`;
1755
- w(e, (r) => {
1756
- f(c, {
1757
- method: "GET",
1758
- headers: {
1759
- "X-DS-SWYM-CSRFTOKEN": r.result.ServerToken
1760
- },
1761
- onComplete(a) {
1762
- const i = JSON.parse(a);
1763
- n && n(i);
1764
- },
1765
- onFailure(a, i) {
1766
- const d = a;
1767
- d.status = i.status, d.response = i.errormsg, s && s(d);
1768
- }
1769
- });
1770
- });
1771
- }
1772
- function ne(e) {
1773
- return !e || e === "" ? `<h2><u>INFORMATIONS AFFAIRE :</u></h2>
1774
- <p><u>|⚠️<em> Merci de respecter l&#39;écriture des tags, en MAJUSCULES, nom complet, pas de caractères</em></u></p>
1775
- <p><u><em>|spéciaux, séparation par &#34;_&#34; si besoin !</em></u></p>
1776
- <p><strong>Référence client </strong>: <em>
1777
- <a data-predicate="ds6w:who" data-type="internal" class="s6m-tag-link s6m-link">CLIENT</a>
1778
- </em></p>
1779
- <p><strong>Référence projet </strong>: <em>
1780
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">NOM AFFAIRE</a>
1781
- <a data-predicate="ds6w:where" data-type="internal" class="s6m-tag-link s6m-link">VILLE</a>
1782
- <a data-predicate="ds6w:where" data-type="internal" class="s6m-tag-link s6m-link">DPT</a>
1783
- </em></p>
1784
- <p>&#x1f4dd; <strong>Base documentaire</strong> : LIEN projet</p>
1785
- <p>&#x1f4dd; <strong>Fiche COCLICO</strong> : LIEN projet<em><strong></strong>
1786
- </em></p>
1787
- <p><br /></p>
1788
- <table border="1">
1789
- <tbody>
1790
- <tr><td><strong>Description projet </strong>:
1791
- <br /><br /></td></tr>
1792
- </tbody>
1793
- </table>
1794
- <p><br /></p>
1795
- <p><br /></p>
1796
- <p><strong>Produit :<em> </em></strong><em>
1797
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Hexapli Usiné</a>
1798
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Hexapli MP</a>
1799
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Lamwood</a>
1800
- </em></p>
1801
- <p><strong>Type de Bâtiment :</strong><em>
1802
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Logements</a>
1803
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">BUP</a>
1804
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">ERP</a>
1805
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Plateforme Logistique</a>
1806
- </em></p>
1807
- <p><strong>Essence :</strong> <em>
1808
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">DOUGLAS</a>
1809
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">PIN</a>
1810
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">MIXTE</a>
1811
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">EPICEA</a>
1812
- </em></p>
1813
- <p><strong>Qualité : </strong><em>
1814
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">NVI</a>
1815
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">VI1F</a>
1816
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">VI2F</a>
1817
- </em><strong></strong></p>
1818
- <p><strong>Traitement : </strong><em>
1819
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">PARKA</a>
1820
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">CT2</a>
1821
- </em></p>
1822
- <p><strong>Type de Paroi : </strong><em>
1823
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Murs Intérieurs</a>
1824
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Murs Extérieurs</a>
1825
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Planchers</a>
1826
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Couverture</a>
1827
- </em></p>
1828
- <p><em>
1829
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Etanchéité Accessible</a>
1830
- <a data-predicate="ds6w:what" data-type="internal" class="s6m-tag-link s6m-link">Etanchéité Non-Accessible</a>
1831
- </em></p>
1832
- <p><strong>Hauteur Dernier Plancher :</strong><em><strong> </strong>
1833
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">Hauteur &lt;8m</a>
1834
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">8m&lt; Hauteur &lt;28m</a>
1835
- <a data-predicate="ds6w:how" data-type="internal" class="s6m-tag-link s6m-link">28m&lt; Hauteur &lt;50m</a>
1836
- </em></p>
1837
- <h2><br /></h2>
1838
- <h2><u>EQUIPE PIVETEAU :</u></h2>
1839
- <table border="1">
1840
- <tbody>
1841
- <tr><td><strong>Chargé d&#39;Affaires</strong></td><td><br /></td></tr>
1842
- <tr><td><strong>Service études de prix</strong></td><td><br /></td></tr>
1843
- </tbody></table>
1844
- <p>
1845
- </p>` : e;
1846
- }
1847
- function qe(e, t = void 0, n = void 0) {
1848
- const s = e.space + "/api/user/getcurrent/";
1849
- w(e, (o) => {
1850
- f(s, {
1851
- method: "GET",
1852
- headers: {
1853
- "X-DS-SWYM-CSRFTOKEN": o.result.ServerToken
1854
- },
1855
- onComplete(c, r, a) {
1856
- const i = JSON.parse(c);
1857
- t && t(i.result);
1858
- },
1859
- onFailure(c, r, a) {
1860
- const i = { erreur: JSON.parse(c), headers: r, xhr: a };
1861
- n && n(i);
1862
- }
1863
- });
1864
- });
1865
- }
1866
- function Qe(e, t, n = void 0, s = void 0) {
1867
- const o = e.space + "/api/user/find/login/" + t;
1868
- w(
1869
- e,
1870
- (c) => {
1871
- f(o, {
1872
- method: "GET",
1873
- headers: { "X-DS-SWYM-CSRFTOKEN": c.result.ServerToken },
1874
- onComplete(r, a, i) {
1875
- const d = JSON.parse(r);
1876
- n && n(d);
1877
- },
1878
- onFailure(r) {
1879
- s && s(r);
1880
- }
1881
- });
1882
- },
1883
- s
1884
- );
1885
- }
1886
- function Ze(e) {
1887
- const t = "Hello " + e;
1888
- return console.log(t), t;
1889
- }
1890
- export {
1891
- I as UUID,
1892
- ke as _3DSpace_Create_Doc,
1893
- C as _3DSpace_csrf,
1894
- R as _3DSpace_download_doc,
1895
- X as _3DSpace_download_multidoc,
1896
- K as _3DSpace_file_update,
1897
- W as _3DSpace_file_update_csr,
1898
- Ne as _3DSpace_file_url_csr,
1899
- k as _3DSpace_get_csrf,
1900
- G as _3DSpace_get_docInfo,
1901
- V as _3DSpace_get_downloadTicket_multidoc,
1902
- b as _3DSpace_get_securityContexts,
1903
- U as _3DSpace_get_ticket,
1904
- $e as _3DSpace_lifecycle_changeRevision,
1905
- Fe as _3DSpace_lifecycle_changeState,
1906
- Ue as _3DSpace_lifecycle_getGraph,
1907
- je as _3DSpace_lifecycle_getNextRevision,
1908
- De as _3DSpace_lifecycle_getNextStates,
1909
- We as _3DSwim_getAllCommunities,
1910
- Q as _3DSwim_getMembersCommunity,
1911
- Ve as _3DSwym_buildDirectMessage,
1912
- Ye as _3DSwym_deleteIdea,
1913
- Z as _3DSwym_findCommunityToInstantMSG,
1914
- Ge as _3DSwym_getAllNews,
1915
- Ke as _3DSwym_getFamiliarPeople,
1916
- Xe as _3DSwym_getIdeaStatusMaturity,
1917
- He as _3DSwym_getSWYMIdea,
1918
- ze as _3DSwym_get_AllSWYMIdeas,
1919
- qe as _3DSwym_get_currentUser,
1920
- Qe as _3DSwym_get_findUser,
1921
- w as _3DSwym_get_version,
1922
- Be as _3DSwym_postIdea,
1923
- $ as _3DSwym_sendMessageData,
1924
- Se as _AppMngt_get_info_user,
1925
- he as _AppMngt_get_users,
1926
- me as _getPlateformInfos,
1927
- fe as _getPlatformServices,
1928
- f as _httpCallAuthenticated,
1929
- le as _setDraggable,
1930
- ue as _setDroppable,
1931
- pe as _setupTagger,
1932
- Le as addTagToDoc,
1933
- ge as compass_getListAdditionalApps,
1934
- L as couleurs,
1935
- _e as createUserGroups,
1936
- B as dataMixing,
1937
- Te as deleteUserGroups,
1938
- re as findAdresse,
1939
- Ae as getAllContextSecurity,
1940
- J as getCSRFToken,
1941
- ie as getCommunes,
1942
- ye as getComplementUG,
1943
- Ie as getDataFrom3DSpace,
1944
- ce as getDataFromGouvFr,
1945
- xe as getDatasByTenant,
1946
- Me as getDatasFrom3DSpace,
1947
- Re as getDownloadDocument,
1948
- Je as getInfoDocTags,
1949
- we as getUserGroupsList,
1950
- E as getUsersGroupRules,
1951
- Pe as get_3DSpace_csrf,
1952
- Ce as patchUserGroups,
1953
- Oe as patchUserGroupsControl,
1954
- ve as pushDataIn3DSpace,
1955
- be as readUserGroupControl,
1956
- Ee as removeTagToDoc,
1957
- Ze as sayHello,
1958
- de as updateEvent
1959
- };
1960
- //# sourceMappingURL=wb3Api.js.map