@edifice.io/client 2.1.2 → 2.2.0
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/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var T = (u, e, t) => e in u ?
|
|
3
|
-
var
|
|
1
|
+
var D = Object.defineProperty;
|
|
2
|
+
var T = (u, e, t) => e in u ? D(u, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[e] = t;
|
|
3
|
+
var n = (u, e, t) => T(u, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import axios from "axios";
|
|
5
5
|
import { MimeTypeUtils } from "@edifice.io/utilities";
|
|
6
6
|
const ERROR_CODE = {
|
|
@@ -14,7 +14,7 @@ const ERROR_CODE = {
|
|
|
14
14
|
TIME_OUT: "0070",
|
|
15
15
|
MALFORMED_DATA: "0080",
|
|
16
16
|
NOT_LOGGED_IN: "0090"
|
|
17
|
-
}, APP$
|
|
17
|
+
}, APP$4 = {
|
|
18
18
|
ADMIN: "admin",
|
|
19
19
|
ARCHIVE: "archive",
|
|
20
20
|
AUTH: "auth",
|
|
@@ -36,7 +36,8 @@ const ERROR_CODE = {
|
|
|
36
36
|
SCRAPBOOK: "scrapbook",
|
|
37
37
|
COLLABORATIVEWALL: "collaborativewall",
|
|
38
38
|
WIKI: "wiki",
|
|
39
|
-
TIMELINEGENERATOR: "timelinegenerator"
|
|
39
|
+
TIMELINEGENERATOR: "timelinegenerator",
|
|
40
|
+
COLLABORATIVEEDITOR: "collaborativeeditor"
|
|
40
41
|
// TODO compléter/trier les apps suivantes
|
|
41
42
|
/*
|
|
42
43
|
"competences"
|
|
@@ -99,7 +100,7 @@ const ERROR_CODE = {
|
|
|
99
100
|
};
|
|
100
101
|
class Subscription {
|
|
101
102
|
constructor(e, t) {
|
|
102
|
-
|
|
103
|
+
n(this, "revoke");
|
|
103
104
|
this._channel = e, this.revoke = this.setReceiver(
|
|
104
105
|
(s) => t == null ? void 0 : t(s.data)
|
|
105
106
|
);
|
|
@@ -117,7 +118,7 @@ class Subject {
|
|
|
117
118
|
* => We maintain here channels for *sending* messages.
|
|
118
119
|
* *Receiving* channels will be instantiated while subscribing.
|
|
119
120
|
*/
|
|
120
|
-
|
|
121
|
+
n(this, "publishChannels", /* @__PURE__ */ new Map());
|
|
121
122
|
}
|
|
122
123
|
getChannelName(e) {
|
|
123
124
|
return "Subject:" + e;
|
|
@@ -152,9 +153,9 @@ const ASYNC_DATA_NAME = {
|
|
|
152
153
|
class Promisified {
|
|
153
154
|
constructor() {
|
|
154
155
|
//-------------------------------------
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
n(this, "_resolution");
|
|
157
|
+
n(this, "_rejection");
|
|
158
|
+
n(this, "_promise", new Promise((e, t) => {
|
|
158
159
|
this._resolution = e, this._rejection = t;
|
|
159
160
|
}));
|
|
160
161
|
}
|
|
@@ -171,8 +172,8 @@ class Promisified {
|
|
|
171
172
|
class NotifyFramework {
|
|
172
173
|
constructor() {
|
|
173
174
|
//-------------------------------------
|
|
174
|
-
|
|
175
|
-
|
|
175
|
+
n(this, "promises", {});
|
|
176
|
+
n(this, "subject", new Subject());
|
|
176
177
|
}
|
|
177
178
|
asyncData(e) {
|
|
178
179
|
return typeof this.promises[e] > "u" && (this.promises[e] = new Promisified()), this.promises[e];
|
|
@@ -203,8 +204,8 @@ const notify = new NotifyFramework(), loadedScripts$1 = {};
|
|
|
203
204
|
class Http {
|
|
204
205
|
constructor(e) {
|
|
205
206
|
// Axios automatically manages the XSRF-TOKEN cookie and the X-XSRF-TOKEN HTTP header.
|
|
206
|
-
|
|
207
|
-
|
|
207
|
+
n(this, "axios");
|
|
208
|
+
n(this, "_latestResponse");
|
|
208
209
|
this.axios = axios.create(e);
|
|
209
210
|
}
|
|
210
211
|
setCdn(e) {
|
|
@@ -282,15 +283,15 @@ class Http {
|
|
|
282
283
|
}
|
|
283
284
|
getScript(e, t, s) {
|
|
284
285
|
const r = s ?? "exports", i = this.toAxiosConfig(t);
|
|
285
|
-
return i.headers && (i.headers.Accept = "application/javascript"), this.axios.get(this.toCdnUrl(e), i).then((
|
|
286
|
+
return i.headers && (i.headers.Accept = "application/javascript"), this.axios.get(this.toCdnUrl(e), i).then((o) => this.mapAxiosResponse(o, t)).then((o) => {
|
|
286
287
|
try {
|
|
287
|
-
const a = `"use strict";var ${r.split(".")[0]}={};${
|
|
288
|
+
const a = `"use strict";var ${r.split(".")[0]}={};${o};return ${r};`;
|
|
288
289
|
return Function(a)();
|
|
289
290
|
} catch {
|
|
290
|
-
return
|
|
291
|
+
return o;
|
|
291
292
|
}
|
|
292
|
-
}).catch((
|
|
293
|
-
throw this.mapAxiosError(
|
|
293
|
+
}).catch((o) => {
|
|
294
|
+
throw this.mapAxiosError(o, t), o;
|
|
294
295
|
});
|
|
295
296
|
}
|
|
296
297
|
loadScript(e, t) {
|
|
@@ -301,7 +302,7 @@ class Http {
|
|
|
301
302
|
}
|
|
302
303
|
class TransportFramework {
|
|
303
304
|
constructor() {
|
|
304
|
-
|
|
305
|
+
n(this, "_http", new Http());
|
|
305
306
|
}
|
|
306
307
|
get http() {
|
|
307
308
|
return this._http;
|
|
@@ -320,11 +321,11 @@ class ConfigurationFrameworkFactory {
|
|
|
320
321
|
const http$2 = transport.http;
|
|
321
322
|
class Session {
|
|
322
323
|
constructor() {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
324
|
+
n(this, "_me", null);
|
|
325
|
+
n(this, "_currentLanguage", "");
|
|
326
|
+
n(this, "_notLoggedIn", !0);
|
|
327
|
+
n(this, "_description");
|
|
328
|
+
n(this, "_profile");
|
|
328
329
|
}
|
|
329
330
|
get currentLanguage() {
|
|
330
331
|
return this._currentLanguage;
|
|
@@ -369,8 +370,8 @@ class Session {
|
|
|
369
370
|
hasRight(e, t) {
|
|
370
371
|
if (t === "owner")
|
|
371
372
|
return e.owner && e.owner.userId === this._me.userId;
|
|
372
|
-
const s = t.right || t, i = e.shared.filter((a) => (this._me.groupsIds || []).indexOf(a.groupId) !== -1 || a.userId === this._me.userId).find((a) => a[s] || a.manager) !== void 0,
|
|
373
|
-
return i &&
|
|
373
|
+
const s = t.right || t, i = e.shared.filter((a) => (this._me.groupsIds || []).indexOf(a.groupId) !== -1 || a.userId === this._me.userId).find((a) => a[s] || a.manager) !== void 0, o = t.workflow ? this.hasWorkflow(t.workflow) : !0;
|
|
374
|
+
return i && o;
|
|
374
375
|
}
|
|
375
376
|
////////////////////////////////////////////////////////// Storage management
|
|
376
377
|
get latestQuotaAndUsage() {
|
|
@@ -442,7 +443,7 @@ class Session {
|
|
|
442
443
|
}
|
|
443
444
|
class SessionFramework {
|
|
444
445
|
constructor() {
|
|
445
|
-
|
|
446
|
+
n(this, "session", new Session());
|
|
446
447
|
}
|
|
447
448
|
initialize() {
|
|
448
449
|
return this.session.initialize();
|
|
@@ -466,22 +467,22 @@ class SessionFramework {
|
|
|
466
467
|
const session = new SessionFramework();
|
|
467
468
|
class Theme {
|
|
468
469
|
constructor() {
|
|
469
|
-
|
|
470
|
-
|
|
470
|
+
n(this, "_conf");
|
|
471
|
+
n(this, "_loaded");
|
|
471
472
|
// legacy (readonly)
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
473
|
+
n(this, "skinName", "");
|
|
474
|
+
n(this, "themeName", "");
|
|
475
|
+
n(this, "skin", "raw");
|
|
476
|
+
n(this, "themeUrl", "/assets/themes/raw/default/");
|
|
477
|
+
n(this, "templateOverrides", {});
|
|
478
|
+
n(this, "portalTemplate", "/assets/themes/raw/portal.html");
|
|
479
|
+
n(this, "basePath", "");
|
|
480
|
+
n(this, "logoutCallback", "/");
|
|
481
|
+
n(this, "skins", []);
|
|
482
|
+
n(this, "is1D", !1);
|
|
483
|
+
n(this, "is2D", !1);
|
|
484
|
+
n(this, "_onSkinReady", notify.onSkinReady());
|
|
485
|
+
n(this, "_onOverrideReady", notify.onOverridesReady());
|
|
485
486
|
}
|
|
486
487
|
initialize(e) {
|
|
487
488
|
return notify.onSessionReady().promise.then(() => this.load(e));
|
|
@@ -814,8 +815,8 @@ class Idiom {
|
|
|
814
815
|
else {
|
|
815
816
|
const i = new Promisified();
|
|
816
817
|
promises$1[t] = i.promise;
|
|
817
|
-
const
|
|
818
|
-
e && (
|
|
818
|
+
const o = {};
|
|
819
|
+
e && (o["Accept-Language"] = e), transport.http.get(t, { headers: o }).then((a) => {
|
|
819
820
|
Object.assign(bundle$1, a), typeof s == "function" && s(), i.resolve();
|
|
820
821
|
}).catch((a) => {
|
|
821
822
|
typeof s == "function" && s(), i.reject();
|
|
@@ -853,7 +854,7 @@ class Idiom {
|
|
|
853
854
|
class UserPreferences {
|
|
854
855
|
constructor() {
|
|
855
856
|
//-------------------------------------
|
|
856
|
-
|
|
857
|
+
n(this, "data", {});
|
|
857
858
|
}
|
|
858
859
|
get(e) {
|
|
859
860
|
return this.data[e];
|
|
@@ -880,10 +881,10 @@ class UserPreferences {
|
|
|
880
881
|
class User {
|
|
881
882
|
constructor() {
|
|
882
883
|
//-------------------------------------
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
884
|
+
n(this, "_me", null);
|
|
885
|
+
n(this, "_keepOpenOnLogout", !1);
|
|
886
|
+
n(this, "_preferences", new UserPreferences());
|
|
887
|
+
n(this, "_bookmarkedApps", []);
|
|
887
888
|
}
|
|
888
889
|
get keepOpenOnLogout() {
|
|
889
890
|
return this._keepOpenOnLogout;
|
|
@@ -915,7 +916,7 @@ class User {
|
|
|
915
916
|
let s;
|
|
916
917
|
if (t && t.length && typeof t.concat == "function") {
|
|
917
918
|
this._bookmarkedApps = t, s = {
|
|
918
|
-
bookmarks: t.map((
|
|
919
|
+
bookmarks: t.map((o) => o.name),
|
|
919
920
|
applications: []
|
|
920
921
|
}, transport.http.putJson("/userbook/preference/apps", s);
|
|
921
922
|
return;
|
|
@@ -927,15 +928,15 @@ class User {
|
|
|
927
928
|
});
|
|
928
929
|
let r = !0;
|
|
929
930
|
const i = [];
|
|
930
|
-
s.bookmarks.forEach((
|
|
931
|
-
const c = this._me.apps.find((h) => h.name ===
|
|
931
|
+
s.bookmarks.forEach((o, a) => {
|
|
932
|
+
const c = this._me.apps.find((h) => h.name === o);
|
|
932
933
|
if (c) {
|
|
933
934
|
const h = Object.assign({}, c);
|
|
934
935
|
this._bookmarkedApps.push(h);
|
|
935
936
|
} else
|
|
936
|
-
i.push(
|
|
937
|
-
}), i.forEach((
|
|
938
|
-
const a = s.bookmarks.indexOf(
|
|
937
|
+
i.push(o), r = !1;
|
|
938
|
+
}), i.forEach((o) => {
|
|
939
|
+
const a = s.bookmarks.indexOf(o);
|
|
939
940
|
a !== -1 && s.bookmarks.splice(a, 1);
|
|
940
941
|
}), r || transport.http.putJson("/userbook/preference/apps", s);
|
|
941
942
|
});
|
|
@@ -957,9 +958,9 @@ const http$1 = transport == null ? void 0 : transport.http;
|
|
|
957
958
|
class AppConf {
|
|
958
959
|
constructor() {
|
|
959
960
|
//-------------------------------------
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
961
|
+
n(this, "_publicConf", {});
|
|
962
|
+
n(this, "_currentApp");
|
|
963
|
+
n(this, "_appConf", {});
|
|
963
964
|
}
|
|
964
965
|
/**
|
|
965
966
|
* Get the currently initialized App.
|
|
@@ -997,8 +998,8 @@ class AppConf {
|
|
|
997
998
|
class Analytics {
|
|
998
999
|
constructor() {
|
|
999
1000
|
//-------------------------------------
|
|
1000
|
-
|
|
1001
|
-
|
|
1001
|
+
n(this, "_status", "void");
|
|
1002
|
+
n(this, "_params");
|
|
1002
1003
|
}
|
|
1003
1004
|
get status() {
|
|
1004
1005
|
return this._status;
|
|
@@ -1050,8 +1051,8 @@ class Analytics {
|
|
|
1050
1051
|
configure.Platform.apps.currentApp
|
|
1051
1052
|
);
|
|
1052
1053
|
if (!i) return;
|
|
1053
|
-
const
|
|
1054
|
-
if (!
|
|
1054
|
+
const o = i.xiti;
|
|
1055
|
+
if (!o || !o.LIBELLE_SERVICE || !r.UAI) return;
|
|
1055
1056
|
function a(h) {
|
|
1056
1057
|
let l = "";
|
|
1057
1058
|
for (let E = 0; E < h.length; E++)
|
|
@@ -1066,10 +1067,10 @@ class Analytics {
|
|
|
1066
1067
|
Guest: "AUTRE"
|
|
1067
1068
|
};
|
|
1068
1069
|
return {
|
|
1069
|
-
LIBELLE_SERVICE:
|
|
1070
|
+
LIBELLE_SERVICE: o.LIBELLE_SERVICE,
|
|
1070
1071
|
// Which property of LIBELLE_SERVICE to use depends on the frontend.
|
|
1071
|
-
TYPE:
|
|
1072
|
-
OUTIL:
|
|
1072
|
+
TYPE: o.OUTIL ? "TIERS" : "NATIF",
|
|
1073
|
+
OUTIL: o.OUTIL ? o.OUTIL : "",
|
|
1073
1074
|
STRUCT_ID: r.collectiviteId,
|
|
1074
1075
|
STRUCT_UAI: r.UAI,
|
|
1075
1076
|
PROJET: r.projetId ? r.projetId : e.ID_PROJET,
|
|
@@ -1083,7 +1084,7 @@ class Analytics {
|
|
|
1083
1084
|
class ConfigurationFramework {
|
|
1084
1085
|
constructor() {
|
|
1085
1086
|
//-------------------------------------
|
|
1086
|
-
|
|
1087
|
+
n(this, "Platform", {
|
|
1087
1088
|
deploymentTag: "",
|
|
1088
1089
|
cdnDomain: "",
|
|
1089
1090
|
apps: new AppConf(),
|
|
@@ -1092,15 +1093,15 @@ class ConfigurationFramework {
|
|
|
1092
1093
|
idiom: new Idiom(),
|
|
1093
1094
|
listLanguages: () => transport.http.get("/languages")
|
|
1094
1095
|
});
|
|
1095
|
-
|
|
1096
|
+
n(this, "School", {
|
|
1096
1097
|
//apps; -> pinnedApps;
|
|
1097
1098
|
});
|
|
1098
|
-
|
|
1099
|
+
n(this, "User", new User());
|
|
1099
1100
|
}
|
|
1100
1101
|
async initialize(e, t) {
|
|
1101
1102
|
if (!e) {
|
|
1102
|
-
const r = (h) => (h < 10 ? "0" : "") + h.toFixed(0), i = /* @__PURE__ */ new Date(),
|
|
1103
|
-
e = `${
|
|
1103
|
+
const r = (h) => (h < 10 ? "0" : "") + h.toFixed(0), i = /* @__PURE__ */ new Date(), o = i.getFullYear(), a = i.getMonth() + 1, c = i.getDate();
|
|
1104
|
+
e = `${o}${r(a)}${r(c)}`;
|
|
1104
1105
|
}
|
|
1105
1106
|
const s = e;
|
|
1106
1107
|
this.Platform.deploymentTag = e, typeof t == "string" && t.length > 0 && (this.Platform.cdnDomain = t), transport.http.setCdn(this.Platform.cdnDomain), await Promise.all([
|
|
@@ -1142,8 +1143,8 @@ var _;
|
|
|
1142
1143
|
const me = (_ = session == null ? void 0 : session.session) == null ? void 0 : _.user;
|
|
1143
1144
|
class Notification {
|
|
1144
1145
|
constructor(e) {
|
|
1145
|
-
|
|
1146
|
-
|
|
1146
|
+
n(this, "_id");
|
|
1147
|
+
n(this, "model");
|
|
1147
1148
|
e.reported = e.reporters && e.reporters.length > 0, this._id = e._id, this.model = e;
|
|
1148
1149
|
}
|
|
1149
1150
|
isUnread() {
|
|
@@ -1163,14 +1164,14 @@ class Notification {
|
|
|
1163
1164
|
class TimelineApp {
|
|
1164
1165
|
constructor() {
|
|
1165
1166
|
//-------------------------------------
|
|
1166
|
-
|
|
1167
|
-
|
|
1167
|
+
n(this, "_notifications", []);
|
|
1168
|
+
n(this, "_notificationTypes", []);
|
|
1168
1169
|
// ex: ["BLOG"]
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1170
|
+
n(this, "_flashMessages", []);
|
|
1171
|
+
n(this, "_pageNumber", 0);
|
|
1172
|
+
n(this, "_lastPage", !1);
|
|
1173
|
+
n(this, "_loading", !1);
|
|
1174
|
+
n(this, "showMine", !1);
|
|
1174
1175
|
}
|
|
1175
1176
|
get notifications() {
|
|
1176
1177
|
return this._notifications;
|
|
@@ -1191,20 +1192,20 @@ class TimelineApp {
|
|
|
1191
1192
|
return this.preferences.type = this.preferences.type || [], this.preferences.type;
|
|
1192
1193
|
}
|
|
1193
1194
|
get preferences() {
|
|
1194
|
-
return configure.User.preferences.get(APP$
|
|
1195
|
+
return configure.User.preferences.get(APP$4.TIMELINE);
|
|
1195
1196
|
}
|
|
1196
1197
|
get flashMessages() {
|
|
1197
1198
|
return this._flashMessages;
|
|
1198
1199
|
}
|
|
1199
1200
|
savePreferences() {
|
|
1200
|
-
return configure.User.saveAppPrefs(APP$
|
|
1201
|
+
return configure.User.saveAppPrefs(APP$4.TIMELINE);
|
|
1201
1202
|
}
|
|
1202
1203
|
resetPagination() {
|
|
1203
1204
|
this._pageNumber = 0, this._lastPage = !1, this._loading = !1;
|
|
1204
1205
|
}
|
|
1205
1206
|
initialize() {
|
|
1206
1207
|
return Promise.all([
|
|
1207
|
-
configure.User.loadAppPrefs(APP$
|
|
1208
|
+
configure.User.loadAppPrefs(APP$4.TIMELINE),
|
|
1208
1209
|
transport.http.get("/timeline/types")
|
|
1209
1210
|
]).then((e) => {
|
|
1210
1211
|
this._notificationTypes = e[1];
|
|
@@ -1228,10 +1229,10 @@ class TimelineApp {
|
|
|
1228
1229
|
if (this._loading = !1, r.status === "ok")
|
|
1229
1230
|
if (r.number && r.results) {
|
|
1230
1231
|
const i = r.results.filter(
|
|
1231
|
-
(
|
|
1232
|
-
(a) => a._id ===
|
|
1232
|
+
(o) => this._notifications.findIndex(
|
|
1233
|
+
(a) => a._id === o._id
|
|
1233
1234
|
) === -1
|
|
1234
|
-
).map((
|
|
1235
|
+
).map((o) => new Notification(o));
|
|
1235
1236
|
this._notifications = this._notifications.concat(i), this._pageNumber++;
|
|
1236
1237
|
} else
|
|
1237
1238
|
this._lastPage = !0;
|
|
@@ -1319,7 +1320,7 @@ const f = class f {
|
|
|
1319
1320
|
//
|
|
1320
1321
|
// PROTECTED HELPERS
|
|
1321
1322
|
//
|
|
1322
|
-
|
|
1323
|
+
n(this, "checkHttpResponse", (e) => {
|
|
1323
1324
|
if (this.http.latestResponse.status >= 300)
|
|
1324
1325
|
throw this.http.latestResponse.statusText;
|
|
1325
1326
|
return e;
|
|
@@ -1471,7 +1472,7 @@ const f = class f {
|
|
|
1471
1472
|
});
|
|
1472
1473
|
return t.map((r) => {
|
|
1473
1474
|
const i = s.resources.find(
|
|
1474
|
-
(
|
|
1475
|
+
(o) => o.assetId === r
|
|
1475
1476
|
);
|
|
1476
1477
|
if (i === void 0)
|
|
1477
1478
|
throw "explorer.assetid.notfound";
|
|
@@ -1537,10 +1538,10 @@ const f = class f {
|
|
|
1537
1538
|
//
|
|
1538
1539
|
// STATIC REGISTRY
|
|
1539
1540
|
//
|
|
1540
|
-
|
|
1541
|
-
|
|
1541
|
+
n(f, "registry", new ServiceRegistry()), // Expose some useful functions
|
|
1542
|
+
n(f, "register", f.registry.register.bind(f.registry)), n(f, "findService", f.registry.findService.bind(f.registry)), n(f, "findMainService", f.registry.findMainService.bind(f.registry)), n(f, "isRegistered", f.registry.isRegistered.bind(f.registry));
|
|
1542
1543
|
let ResourceService = f;
|
|
1543
|
-
const APP$
|
|
1544
|
+
const APP$3 = "scrapbook", RESOURCE$3 = "scrapbook";
|
|
1544
1545
|
class ScrapbookResourceService extends ResourceService {
|
|
1545
1546
|
create(e) {
|
|
1546
1547
|
throw new Error("Method not implemented.");
|
|
@@ -1558,10 +1559,10 @@ class ScrapbookResourceService extends ResourceService {
|
|
|
1558
1559
|
return this.checkHttpResponse(s), { thumbnail: t, entId: e.entId };
|
|
1559
1560
|
}
|
|
1560
1561
|
getResourceType() {
|
|
1561
|
-
return RESOURCE$
|
|
1562
|
+
return RESOURCE$3;
|
|
1562
1563
|
}
|
|
1563
1564
|
getApplication() {
|
|
1564
|
-
return APP$
|
|
1565
|
+
return APP$3;
|
|
1565
1566
|
}
|
|
1566
1567
|
getFormUrl(e) {
|
|
1567
1568
|
return e ? `/scrapbook?folderid=${e}#/create-scrapbook/` : "/scrapbook#/create-scrapbook/";
|
|
@@ -1580,10 +1581,10 @@ class ScrapbookResourceService extends ResourceService {
|
|
|
1580
1581
|
}
|
|
1581
1582
|
}
|
|
1582
1583
|
ResourceService.register(
|
|
1583
|
-
{ application: RESOURCE$
|
|
1584
|
+
{ application: RESOURCE$3, resourceType: RESOURCE$3 },
|
|
1584
1585
|
(u) => new ScrapbookResourceService(u)
|
|
1585
1586
|
);
|
|
1586
|
-
const APP$
|
|
1587
|
+
const APP$2 = "homeworks", RESOURCE$2 = "homeworks";
|
|
1587
1588
|
class HomeworksResourceService extends ResourceService {
|
|
1588
1589
|
async create(e) {
|
|
1589
1590
|
const t = await this.getThumbnailPath(e.thumbnail), s = await this.http.post("/homeworks", {
|
|
@@ -1606,10 +1607,10 @@ class HomeworksResourceService extends ResourceService {
|
|
|
1606
1607
|
return this.checkHttpResponse(s), { thumbnail: t, entId: e.entId };
|
|
1607
1608
|
}
|
|
1608
1609
|
getResourceType() {
|
|
1609
|
-
return RESOURCE$
|
|
1610
|
+
return RESOURCE$2;
|
|
1610
1611
|
}
|
|
1611
1612
|
getApplication() {
|
|
1612
|
-
return APP$
|
|
1613
|
+
return APP$2;
|
|
1613
1614
|
}
|
|
1614
1615
|
getFormUrl(e) {
|
|
1615
1616
|
return e ? `/homeworks?folderid=${e}#/create-homeworks/` : "/homeworks#/create-homeworks/";
|
|
@@ -1628,10 +1629,10 @@ class HomeworksResourceService extends ResourceService {
|
|
|
1628
1629
|
}
|
|
1629
1630
|
}
|
|
1630
1631
|
ResourceService.register(
|
|
1631
|
-
{ application: RESOURCE$
|
|
1632
|
+
{ application: RESOURCE$2, resourceType: RESOURCE$2 },
|
|
1632
1633
|
(u) => new HomeworksResourceService(u)
|
|
1633
1634
|
);
|
|
1634
|
-
const APP = "timelinegenerator", RESOURCE = "timelinegenerator";
|
|
1635
|
+
const APP$1 = "timelinegenerator", RESOURCE$1 = "timelinegenerator";
|
|
1635
1636
|
class TimelineGeneratorResourceService extends ResourceService {
|
|
1636
1637
|
async create(e) {
|
|
1637
1638
|
const t = e.thumbnail ? await this.getThumbnailPath(e.thumbnail) : "", s = await this.http.post(
|
|
@@ -1661,10 +1662,10 @@ class TimelineGeneratorResourceService extends ResourceService {
|
|
|
1661
1662
|
return this.checkHttpResponse(s), { thumbnail: t, entId: e.entId };
|
|
1662
1663
|
}
|
|
1663
1664
|
getResourceType() {
|
|
1664
|
-
return RESOURCE;
|
|
1665
|
+
return RESOURCE$1;
|
|
1665
1666
|
}
|
|
1666
1667
|
getApplication() {
|
|
1667
|
-
return APP;
|
|
1668
|
+
return APP$1;
|
|
1668
1669
|
}
|
|
1669
1670
|
getFormUrl() {
|
|
1670
1671
|
throw new Error("Method not implemented.");
|
|
@@ -1683,9 +1684,57 @@ class TimelineGeneratorResourceService extends ResourceService {
|
|
|
1683
1684
|
}
|
|
1684
1685
|
}
|
|
1685
1686
|
ResourceService.register(
|
|
1686
|
-
{ application: RESOURCE, resourceType: RESOURCE },
|
|
1687
|
+
{ application: RESOURCE$1, resourceType: RESOURCE$1 },
|
|
1687
1688
|
(u) => new TimelineGeneratorResourceService(u)
|
|
1688
1689
|
);
|
|
1690
|
+
const APP = "collaborativeeditor", RESOURCE = "collaborativeeditor";
|
|
1691
|
+
class CollaborativeEditorResourceService extends ResourceService {
|
|
1692
|
+
async create(e) {
|
|
1693
|
+
const { name: t, description: s, thumbnail: r, folder: i } = e, o = r ? await this.getThumbnailPath(r) : "", a = await this.http.post("/collaborativeeditor", {
|
|
1694
|
+
name: t,
|
|
1695
|
+
description: s,
|
|
1696
|
+
thumbnail: o,
|
|
1697
|
+
folder: i
|
|
1698
|
+
});
|
|
1699
|
+
return this.checkHttpResponse(a), a;
|
|
1700
|
+
}
|
|
1701
|
+
async update(e) {
|
|
1702
|
+
const { name: t, description: s, thumbnail: r, entId: i } = e, o = await this.getThumbnailPath(r), a = await this.http.put(
|
|
1703
|
+
`/collaborativeeditor/${i}`,
|
|
1704
|
+
{
|
|
1705
|
+
name: t,
|
|
1706
|
+
description: s,
|
|
1707
|
+
thumbnail: o
|
|
1708
|
+
}
|
|
1709
|
+
);
|
|
1710
|
+
return this.checkHttpResponse(a), { thumbnail: o, entId: i };
|
|
1711
|
+
}
|
|
1712
|
+
getResourceType() {
|
|
1713
|
+
return RESOURCE;
|
|
1714
|
+
}
|
|
1715
|
+
getApplication() {
|
|
1716
|
+
return APP;
|
|
1717
|
+
}
|
|
1718
|
+
getFormUrl() {
|
|
1719
|
+
throw new Error("Method not implemented.");
|
|
1720
|
+
}
|
|
1721
|
+
getViewUrl(e) {
|
|
1722
|
+
return `/collaborativeeditor#/view/${e}`;
|
|
1723
|
+
}
|
|
1724
|
+
getPrintUrl() {
|
|
1725
|
+
throw new Error("Method not implemented.");
|
|
1726
|
+
}
|
|
1727
|
+
getEditUrl() {
|
|
1728
|
+
throw new Error("Method not implemented.");
|
|
1729
|
+
}
|
|
1730
|
+
getExportUrl() {
|
|
1731
|
+
throw new Error("Method not implemented.");
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
ResourceService.register(
|
|
1735
|
+
{ application: RESOURCE, resourceType: RESOURCE },
|
|
1736
|
+
(u) => new CollaborativeEditorResourceService(u)
|
|
1737
|
+
);
|
|
1689
1738
|
const globalCache = {}, mutexPromise = {};
|
|
1690
1739
|
class CacheService {
|
|
1691
1740
|
constructor(e) {
|
|
@@ -1753,14 +1802,14 @@ class ConfService {
|
|
|
1753
1802
|
]), [r, i] = await Promise.all([
|
|
1754
1803
|
this.getTheme({ conf: t, publicTheme: s === void 0 }),
|
|
1755
1804
|
this.getWebAppConf({ app: e, applications: s ?? [] })
|
|
1756
|
-
]),
|
|
1805
|
+
]), o = {
|
|
1757
1806
|
app: e,
|
|
1758
1807
|
applications: s ?? [],
|
|
1759
1808
|
conf: t,
|
|
1760
1809
|
currentApp: i,
|
|
1761
1810
|
theme: r
|
|
1762
1811
|
};
|
|
1763
|
-
return this.notify.onAppConfReady().resolve(
|
|
1812
|
+
return this.notify.onAppConfReady().resolve(o), o;
|
|
1764
1813
|
}
|
|
1765
1814
|
async getPublicConf(e) {
|
|
1766
1815
|
const { response: t, value: s } = await this.cache.httpGet(
|
|
@@ -1812,23 +1861,23 @@ class ConfService {
|
|
|
1812
1861
|
conf: t,
|
|
1813
1862
|
publicTheme: s
|
|
1814
1863
|
}) {
|
|
1815
|
-
const r = await this.http.get("/theme"), i = s ? null : r,
|
|
1864
|
+
const r = await this.http.get("/theme"), i = s ? null : r, o = t == null ? void 0 : t.overriding.find(
|
|
1816
1865
|
(p) => (
|
|
1817
1866
|
// Public access => simply use the 1st override
|
|
1818
1867
|
i === null || p.child === i.themeName
|
|
1819
1868
|
)
|
|
1820
|
-
), a = (i == null ? void 0 : i.skinName) ||
|
|
1869
|
+
), a = (i == null ? void 0 : i.skinName) || o.skins[0], c = (i == null ? void 0 : i.skin) || `/assets/themes/${o.child}/skins/${a}/`, h = o.skins, l = o.bootstrapVersion.split("-").slice(-1)[0], E = o.parent === "panda";
|
|
1821
1870
|
return {
|
|
1822
1871
|
basePath: `${this.cdnDomain}${c}../../`,
|
|
1823
1872
|
bootstrapVersion: l,
|
|
1824
1873
|
is1d: E,
|
|
1825
1874
|
logoutCallback: (i == null ? void 0 : i.logoutCallback) || "/",
|
|
1826
|
-
skin:
|
|
1875
|
+
skin: o.child,
|
|
1827
1876
|
skinName: a,
|
|
1828
1877
|
skins: h,
|
|
1829
|
-
themeName:
|
|
1878
|
+
themeName: o.child,
|
|
1830
1879
|
themeUrl: c,
|
|
1831
|
-
npmTheme:
|
|
1880
|
+
npmTheme: o.npmTheme ?? void 0
|
|
1832
1881
|
};
|
|
1833
1882
|
}
|
|
1834
1883
|
async getLogoutCallback(e) {
|
|
@@ -1873,13 +1922,13 @@ class DirectoryService {
|
|
|
1873
1922
|
return {
|
|
1874
1923
|
id: s,
|
|
1875
1924
|
displayName: r,
|
|
1876
|
-
groups: t.map(({ name:
|
|
1877
|
-
displayName:
|
|
1925
|
+
groups: t.map(({ name: o, id: a }) => ({
|
|
1926
|
+
displayName: o,
|
|
1878
1927
|
id: a
|
|
1879
1928
|
})),
|
|
1880
|
-
users: i.map(({ displayName:
|
|
1929
|
+
users: i.map(({ displayName: o, id: a, profile: c }) => ({
|
|
1881
1930
|
profile: c,
|
|
1882
|
-
displayName:
|
|
1931
|
+
displayName: o,
|
|
1883
1932
|
// these info are missing from api
|
|
1884
1933
|
firstName: "",
|
|
1885
1934
|
lastName: "",
|
|
@@ -1894,7 +1943,7 @@ class DirectoryService {
|
|
|
1894
1943
|
users: r
|
|
1895
1944
|
}) {
|
|
1896
1945
|
this.cache.clearCache("/directory/sharebookmark/all");
|
|
1897
|
-
const i = r.map((p) => typeof p == "string" ? p : p.id),
|
|
1946
|
+
const i = r.map((p) => typeof p == "string" ? p : p.id), o = s.map((p) => typeof p == "string" ? p : p.id), a = t.map(async (p) => {
|
|
1898
1947
|
if (typeof p == "string") {
|
|
1899
1948
|
const { displayName: d, groups: g, id: A, users: m } = await this.getBookMarkById(p), b = m.map((F) => F.id), C = g.map((F) => F.id);
|
|
1900
1949
|
return {
|
|
@@ -1906,7 +1955,7 @@ class DirectoryService {
|
|
|
1906
1955
|
return Promise.resolve(p);
|
|
1907
1956
|
}), h = (await Promise.all(a)).map((p) => p.members).reduce((p, d) => [...p, ...d], []), l = {
|
|
1908
1957
|
name: e,
|
|
1909
|
-
members: [...i, ...
|
|
1958
|
+
members: [...i, ...o, ...h]
|
|
1910
1959
|
}, { id: E } = await this.http.postJson(
|
|
1911
1960
|
"/directory/sharebookmark",
|
|
1912
1961
|
l
|
|
@@ -1922,10 +1971,10 @@ const loadedScripts = {};
|
|
|
1922
1971
|
class HttpService {
|
|
1923
1972
|
constructor(e, t) {
|
|
1924
1973
|
// Axios automatically manages the XSRF-TOKEN cookie and the X-XSRF-TOKEN HTTP header.
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1974
|
+
n(this, "axios");
|
|
1975
|
+
n(this, "baseUrl");
|
|
1976
|
+
n(this, "headers", {});
|
|
1977
|
+
n(this, "_latestResponse");
|
|
1929
1978
|
this.context = e, this.axios = axios.create(t);
|
|
1930
1979
|
}
|
|
1931
1980
|
fixBaseUrl(e) {
|
|
@@ -1970,15 +2019,15 @@ class HttpService {
|
|
|
1970
2019
|
status: 500,
|
|
1971
2020
|
statusText: ERROR_CODE.UNKNOWN
|
|
1972
2021
|
};
|
|
1973
|
-
const { status: s, statusText: r, headers: i, data:
|
|
2022
|
+
const { status: s, statusText: r, headers: i, data: o } = this._latestResponse;
|
|
1974
2023
|
return t != null && t.disableNotifications || notify.events().publish(LAYER_NAME.TRANSPORT, {
|
|
1975
2024
|
name: EVENT_NAME.ERROR_OCCURED,
|
|
1976
2025
|
data: {
|
|
1977
2026
|
params: t,
|
|
1978
2027
|
response: { status: s, statusText: r, headers: i },
|
|
1979
|
-
payload:
|
|
2028
|
+
payload: o
|
|
1980
2029
|
}
|
|
1981
|
-
}),
|
|
2030
|
+
}), o;
|
|
1982
2031
|
}
|
|
1983
2032
|
mapAxiosResponse(e, t) {
|
|
1984
2033
|
return this._latestResponse = e, e.data;
|
|
@@ -2101,15 +2150,15 @@ class HttpService {
|
|
|
2101
2150
|
}
|
|
2102
2151
|
getScript(e, t, s) {
|
|
2103
2152
|
const r = s ?? "exports", i = this.toAxiosConfig(t);
|
|
2104
|
-
return i.headers && (i.headers.Accept = "application/javascript"), this.axios.get(this.toCdnUrl(e), i).then((
|
|
2153
|
+
return i.headers && (i.headers.Accept = "application/javascript"), this.axios.get(this.toCdnUrl(e), i).then((o) => this.mapAxiosResponse(o, t)).then((o) => {
|
|
2105
2154
|
try {
|
|
2106
|
-
const a = `"use strict";var ${r.split(".")[0]}={};${
|
|
2155
|
+
const a = `"use strict";var ${r.split(".")[0]}={};${o};return ${r};`;
|
|
2107
2156
|
return Function(a)();
|
|
2108
2157
|
} catch {
|
|
2109
|
-
return
|
|
2158
|
+
return o;
|
|
2110
2159
|
}
|
|
2111
|
-
}).catch((
|
|
2112
|
-
throw this.mapAxiosError(
|
|
2160
|
+
}).catch((o) => {
|
|
2161
|
+
throw this.mapAxiosError(o, t), o;
|
|
2113
2162
|
});
|
|
2114
2163
|
}
|
|
2115
2164
|
loadScript(e, t) {
|
|
@@ -2169,13 +2218,13 @@ class RightService {
|
|
|
2169
2218
|
* @returns true if has rights
|
|
2170
2219
|
*/
|
|
2171
2220
|
hasResourceRight({ id: e, groupIds: t }, s, r) {
|
|
2172
|
-
const i = r.map((
|
|
2173
|
-
for (const
|
|
2174
|
-
if (
|
|
2221
|
+
const i = r.map((o) => typeof o == "string" ? this.parseResourceRight(o) : o).filter((o) => o !== void 0);
|
|
2222
|
+
for (const o of i) {
|
|
2223
|
+
if (o.id === e && o.type === "creator")
|
|
2175
2224
|
return !0;
|
|
2176
|
-
if (
|
|
2225
|
+
if (o.id === e && o.type === "user" && o.right === s)
|
|
2177
2226
|
return !0;
|
|
2178
|
-
if (t.includes(
|
|
2227
|
+
if (t.includes(o.id) && o.type === "group" && o.right === s)
|
|
2179
2228
|
return !0;
|
|
2180
2229
|
}
|
|
2181
2230
|
return !1;
|
|
@@ -2312,7 +2361,7 @@ class SessionService {
|
|
|
2312
2361
|
s,
|
|
2313
2362
|
r,
|
|
2314
2363
|
i,
|
|
2315
|
-
|
|
2364
|
+
o
|
|
2316
2365
|
] = await Promise.all([
|
|
2317
2366
|
this.getCurrentLanguage(e),
|
|
2318
2367
|
this.latestQuotaAndUsage(e),
|
|
@@ -2326,7 +2375,7 @@ class SessionService {
|
|
|
2326
2375
|
currentLanguage: t,
|
|
2327
2376
|
userDescription: r,
|
|
2328
2377
|
userProfile: i,
|
|
2329
|
-
bookmarkedApps:
|
|
2378
|
+
bookmarkedApps: o
|
|
2330
2379
|
};
|
|
2331
2380
|
}
|
|
2332
2381
|
login(e, t, s, r) {
|
|
@@ -2420,9 +2469,9 @@ class SessionService {
|
|
|
2420
2469
|
applications: []
|
|
2421
2470
|
});
|
|
2422
2471
|
const i = [];
|
|
2423
|
-
return r.bookmarks.forEach((
|
|
2472
|
+
return r.bookmarks.forEach((o, a) => {
|
|
2424
2473
|
const c = ((e == null ? void 0 : e.apps) || []).find(
|
|
2425
|
-
(h) => h.name ===
|
|
2474
|
+
(h) => h.name === o
|
|
2426
2475
|
);
|
|
2427
2476
|
if (c) {
|
|
2428
2477
|
const h = Object.assign({}, c);
|
|
@@ -2432,8 +2481,8 @@ class SessionService {
|
|
|
2432
2481
|
}
|
|
2433
2482
|
async getUserProfile(e = {}) {
|
|
2434
2483
|
var c, h;
|
|
2435
|
-
const { options: t = {}, params: s = {} } = e, r = new URLSearchParams(s).toString(), i = `/userbook/api/person${r ? `?${r}` : ""}`, { response:
|
|
2436
|
-
return
|
|
2484
|
+
const { options: t = {}, params: s = {} } = e, r = new URLSearchParams(s).toString(), i = `/userbook/api/person${r ? `?${r}` : ""}`, { response: o, value: a } = await this.cache.httpGet(i, t);
|
|
2485
|
+
return o.status < 200 || o.status >= 300 || typeof a == "string" ? ["Guest"] : ((h = (c = a == null ? void 0 : a.result) == null ? void 0 : c[0]) == null ? void 0 : h.type) || ["Guest"];
|
|
2437
2486
|
}
|
|
2438
2487
|
async isAdml() {
|
|
2439
2488
|
const e = await this.getUser();
|
|
@@ -2697,8 +2746,8 @@ class IdiomService {
|
|
|
2697
2746
|
else {
|
|
2698
2747
|
const i = new Promisified();
|
|
2699
2748
|
promises[t] = i.promise;
|
|
2700
|
-
const
|
|
2701
|
-
e && (
|
|
2749
|
+
const o = {};
|
|
2750
|
+
e && (o["Accept-Language"] = e), this.http.get(t, { headers: o }).then((a) => {
|
|
2702
2751
|
Object.assign(bundle, a), typeof s == "function" && s(), i.resolve();
|
|
2703
2752
|
}).catch((a) => {
|
|
2704
2753
|
typeof s == "function" && s(), i.reject();
|
|
@@ -2762,7 +2811,7 @@ class ShareService {
|
|
|
2762
2811
|
async searchShareSubjects(e, t, s) {
|
|
2763
2812
|
const r = StringUtils.removeAccents(s).toLowerCase(), i = await this.cache.httpGetJson(
|
|
2764
2813
|
`/${e}/share/json/${t}?search=${s}`
|
|
2765
|
-
),
|
|
2814
|
+
), o = i.users.visibles.filter(({ username: l, firstName: E, lastName: p, login: d }) => {
|
|
2766
2815
|
const g = StringUtils.removeAccents(
|
|
2767
2816
|
p || ""
|
|
2768
2817
|
).toLowerCase(), A = StringUtils.removeAccents(
|
|
@@ -2795,7 +2844,7 @@ class ShareService {
|
|
|
2795
2844
|
displayName: l.displayName,
|
|
2796
2845
|
id: l.id,
|
|
2797
2846
|
type: "sharebookmark"
|
|
2798
|
-
})), ...
|
|
2847
|
+
})), ...o, ...a];
|
|
2799
2848
|
}
|
|
2800
2849
|
async getShareMapping(e) {
|
|
2801
2850
|
const t = await this.cache.httpGetJson(
|
|
@@ -2809,15 +2858,15 @@ class ShareService {
|
|
|
2809
2858
|
return t;
|
|
2810
2859
|
}
|
|
2811
2860
|
getActionsAvailableFor({ id: e, type: t }, s, r) {
|
|
2812
|
-
const
|
|
2861
|
+
const o = (t === "user" ? s.users.checked[e] : s.groups.checked[e]) || [], a = Object.keys(r), c = [];
|
|
2813
2862
|
for (const h of a)
|
|
2814
2863
|
r[h].filter(
|
|
2815
|
-
(p) =>
|
|
2864
|
+
(p) => o.includes(p)
|
|
2816
2865
|
).length > 0 && c.push(h);
|
|
2817
2866
|
return c;
|
|
2818
2867
|
}
|
|
2819
2868
|
async getRightsForResource(e, t) {
|
|
2820
|
-
const s = await this.directory.getBookMarks(), r = `/${e}/share/json/${t}?search=`, i = await this.cache.httpGetJson(r),
|
|
2869
|
+
const s = await this.directory.getBookMarks(), r = `/${e}/share/json/${t}?search=`, i = await this.cache.httpGetJson(r), o = await this.getShareMapping(e), a = await this.cache.httpGetJson(
|
|
2821
2870
|
"/infra/public/json/sharing-rights.json"
|
|
2822
2871
|
), c = Object.keys(i.users.checked).map((d) => i.users.visibles.find(
|
|
2823
2872
|
(A) => A.id === d
|
|
@@ -2825,7 +2874,7 @@ class ShareService {
|
|
|
2825
2874
|
const g = this.getActionsAvailableFor(
|
|
2826
2875
|
{ id: d.id, type: "user" },
|
|
2827
2876
|
i,
|
|
2828
|
-
|
|
2877
|
+
o
|
|
2829
2878
|
);
|
|
2830
2879
|
return {
|
|
2831
2880
|
id: d.id,
|
|
@@ -2849,7 +2898,7 @@ class ShareService {
|
|
|
2849
2898
|
const g = this.getActionsAvailableFor(
|
|
2850
2899
|
{ id: d.id, type: "group" },
|
|
2851
2900
|
i,
|
|
2852
|
-
|
|
2901
|
+
o
|
|
2853
2902
|
);
|
|
2854
2903
|
return {
|
|
2855
2904
|
id: d.id,
|
|
@@ -2899,25 +2948,25 @@ class ShareService {
|
|
|
2899
2948
|
const h = c.actions.map((E) => r[E.id]).reduce((E, p) => Array.isArray(p) ? [...E, ...p] : E, []), l = [...new Set(h)];
|
|
2900
2949
|
l.length > 0 && (c.type === "user" ? i.users[c.id] = l : c.type === "group" ? i.groups[c.id] = l : i.bookmarks[c.id] = l);
|
|
2901
2950
|
}
|
|
2902
|
-
const
|
|
2903
|
-
return this.cache.clearCache(`/${e}/share/json/${t}?search=`), await this.http.putJson(
|
|
2951
|
+
const o = `/${e}/share/resource/${t}`;
|
|
2952
|
+
return this.cache.clearCache(`/${e}/share/json/${t}?search=`), await this.http.putJson(o, i);
|
|
2904
2953
|
}
|
|
2905
2954
|
async getActionsForApp(e) {
|
|
2906
2955
|
const t = await this.cache.httpGetJson(
|
|
2907
2956
|
"/infra/public/json/sharing-rights.json"
|
|
2908
2957
|
), s = await this.getShareMapping(e);
|
|
2909
2958
|
return Object.keys(t).map((i) => {
|
|
2910
|
-
const
|
|
2959
|
+
const o = t[i];
|
|
2911
2960
|
return {
|
|
2912
2961
|
displayName: i,
|
|
2913
2962
|
id: i,
|
|
2914
|
-
priority:
|
|
2915
|
-
requires:
|
|
2963
|
+
priority: o.priority,
|
|
2964
|
+
requires: o.requires
|
|
2916
2965
|
};
|
|
2917
2966
|
}).filter((i) => {
|
|
2918
|
-
var
|
|
2919
|
-
return ((
|
|
2920
|
-
}).sort((i,
|
|
2967
|
+
var o;
|
|
2968
|
+
return ((o = s[i.id]) == null ? void 0 : o.length) > 0;
|
|
2969
|
+
}).sort((i, o) => i.priority - o.priority);
|
|
2921
2970
|
}
|
|
2922
2971
|
}
|
|
2923
2972
|
const defaultMappers = {
|
|
@@ -2970,15 +3019,15 @@ const defaultMappers = {
|
|
|
2970
3019
|
this.roleMappers || console.warn("[DocumentHelper.role] should not have empty roles", this);
|
|
2971
3020
|
const r = { type: e, previewRole: t, extension: s };
|
|
2972
3021
|
for (const i of this.roleMappers) {
|
|
2973
|
-
const
|
|
2974
|
-
if (
|
|
2975
|
-
return
|
|
3022
|
+
const o = i(r);
|
|
3023
|
+
if (o)
|
|
3024
|
+
return o;
|
|
2976
3025
|
}
|
|
2977
3026
|
return "unknown";
|
|
2978
3027
|
}
|
|
2979
3028
|
};
|
|
2980
3029
|
// FIXME add edumedia support
|
|
2981
|
-
|
|
3030
|
+
n(R, "roleMappers", [
|
|
2982
3031
|
(e) => Object.keys(defaultMappers).find((s) => defaultMappers[s](e))
|
|
2983
3032
|
]);
|
|
2984
3033
|
let DocumentHelper = R;
|
|
@@ -2990,22 +3039,22 @@ class WorkspaceService {
|
|
|
2990
3039
|
return this.context.http();
|
|
2991
3040
|
}
|
|
2992
3041
|
extractMetadata(e) {
|
|
2993
|
-
const t = e.name || "", s = t.split("."), r = e.type || "application/octet-stream", i = s.length > 1 ? s[s.length - 1] : "",
|
|
3042
|
+
const t = e.name || "", s = t.split("."), r = e.type || "application/octet-stream", i = s.length > 1 ? s[s.length - 1] : "", o = {
|
|
2994
3043
|
"content-type": r,
|
|
2995
3044
|
filename: t,
|
|
2996
3045
|
size: e.size,
|
|
2997
3046
|
extension: i,
|
|
2998
3047
|
role: DocumentHelper.role(r, !1, i)
|
|
2999
|
-
}, a = t.replace("." +
|
|
3000
|
-
return { basename: a, fullname: c, metadata:
|
|
3048
|
+
}, a = t.replace("." + o.extension, ""), c = o.extension ? a + "." + o.extension : a;
|
|
3049
|
+
return { basename: a, fullname: c, metadata: o };
|
|
3001
3050
|
}
|
|
3002
3051
|
async saveFile(e, t) {
|
|
3003
3052
|
const { fullname: s, metadata: r } = this.extractMetadata(e), i = new FormData();
|
|
3004
3053
|
i.append("file", e, s);
|
|
3005
|
-
const
|
|
3006
|
-
((t == null ? void 0 : t.visibility) === "public" || (t == null ? void 0 : t.visibility) === "protected") &&
|
|
3054
|
+
const o = [];
|
|
3055
|
+
((t == null ? void 0 : t.visibility) === "public" || (t == null ? void 0 : t.visibility) === "protected") && o.push(`${t.visibility}=true`), t != null && t.application && o.push(`application=${t.application}`), r.role === "img" && o.push("quality=1"), t != null && t.parentId && o.push(`parentId=${t.parentId}`);
|
|
3007
3056
|
const a = await this.http.postFile(
|
|
3008
|
-
`/workspace/document?${
|
|
3057
|
+
`/workspace/document?${o.join("&")}`,
|
|
3009
3058
|
i
|
|
3010
3059
|
);
|
|
3011
3060
|
if (this.http.isResponseError())
|
|
@@ -3013,13 +3062,13 @@ class WorkspaceService {
|
|
|
3013
3062
|
return a;
|
|
3014
3063
|
}
|
|
3015
3064
|
async updateFile(e, t, s) {
|
|
3016
|
-
const { fullname: r, metadata: i } = this.extractMetadata(t),
|
|
3017
|
-
|
|
3065
|
+
const { fullname: r, metadata: i } = this.extractMetadata(t), o = new FormData();
|
|
3066
|
+
o.append("file", t, r);
|
|
3018
3067
|
const a = [];
|
|
3019
3068
|
i.role === "img" && a.push("quality=1"), s != null && s.alt && a.push(`alt=${s.alt}`), s != null && s.legend && a.push(`legend=${s.legend}`), s != null && s.name && a.push(`name=${s.name}`);
|
|
3020
3069
|
const c = await this.http.putFile(
|
|
3021
3070
|
`/workspace/document/${e}?${a.join("&")}`,
|
|
3022
|
-
|
|
3071
|
+
o
|
|
3023
3072
|
);
|
|
3024
3073
|
if (this.http.isResponseError())
|
|
3025
3074
|
throw this.http.latestResponse.statusText;
|
|
@@ -3064,17 +3113,17 @@ class WorkspaceService {
|
|
|
3064
3113
|
{
|
|
3065
3114
|
application: t,
|
|
3066
3115
|
visibility: s,
|
|
3067
|
-
ids: r.map((
|
|
3116
|
+
ids: r.map((o) => o._id)
|
|
3068
3117
|
}
|
|
3069
3118
|
);
|
|
3070
3119
|
if (this.http.isResponseError())
|
|
3071
3120
|
throw this.http.latestResponse.statusText;
|
|
3072
|
-
return r.forEach((
|
|
3121
|
+
return r.forEach((o, a) => {
|
|
3073
3122
|
const c = e.findIndex(
|
|
3074
|
-
(h) => h._id ===
|
|
3123
|
+
(h) => h._id === o._id
|
|
3075
3124
|
);
|
|
3076
3125
|
0 <= c && c < e.length && (e[c] = i[a]);
|
|
3077
|
-
}), e.filter((
|
|
3126
|
+
}), e.filter((o) => !!o);
|
|
3078
3127
|
}
|
|
3079
3128
|
return e;
|
|
3080
3129
|
}
|
|
@@ -3083,13 +3132,13 @@ class WorkspaceService {
|
|
|
3083
3132
|
* or `null` if none exists or can be created.
|
|
3084
3133
|
*/
|
|
3085
3134
|
getThumbnailUrl(e, t = 0, s = 0) {
|
|
3086
|
-
var i,
|
|
3135
|
+
var i, o;
|
|
3087
3136
|
const r = t > 0 || s > 0 ? `${t}x${s}` : "120x120";
|
|
3088
3137
|
if (typeof e == "string")
|
|
3089
3138
|
return e.includes("data:image") || e.includes("thumbnail") ? e : `${e}${e.includes("?") ? "&" : "?"}thumbnail=${r}`;
|
|
3090
3139
|
{
|
|
3091
3140
|
const a = `/workspace/${e.public ? "pub/" : ""}document/${e._id}?thumbnail=`, c = e.thumbnails;
|
|
3092
|
-
if ((
|
|
3141
|
+
if ((o = (i = e.metadata) == null ? void 0 : i["content-type"]) != null && o.includes("video")) {
|
|
3093
3142
|
const h = c && Object.keys(c).length > 0 ? Object.keys(c)[0] : null;
|
|
3094
3143
|
return h ? a + h : null;
|
|
3095
3144
|
} else
|
|
@@ -3185,8 +3234,8 @@ class AnalyticsService {
|
|
|
3185
3234
|
if (!r || !r.active) return;
|
|
3186
3235
|
const i = await configure.Platform.apps.getPublicConf(e);
|
|
3187
3236
|
if (!i) return;
|
|
3188
|
-
const
|
|
3189
|
-
if (!
|
|
3237
|
+
const o = i.xiti;
|
|
3238
|
+
if (!o || !o.LIBELLE_SERVICE || !r.UAI) return;
|
|
3190
3239
|
function a(h) {
|
|
3191
3240
|
let l = "";
|
|
3192
3241
|
for (let E = 0; E < h.length; E++)
|
|
@@ -3201,10 +3250,10 @@ class AnalyticsService {
|
|
|
3201
3250
|
Guest: "AUTRE"
|
|
3202
3251
|
};
|
|
3203
3252
|
return {
|
|
3204
|
-
LIBELLE_SERVICE:
|
|
3253
|
+
LIBELLE_SERVICE: o.LIBELLE_SERVICE,
|
|
3205
3254
|
// Which property of LIBELLE_SERVICE to use depends on the frontend.
|
|
3206
|
-
TYPE:
|
|
3207
|
-
OUTIL:
|
|
3255
|
+
TYPE: o.OUTIL ? "TIERS" : "NATIF",
|
|
3256
|
+
OUTIL: o.OUTIL ? o.OUTIL : "",
|
|
3208
3257
|
STRUCT_ID: r.collectiviteId,
|
|
3209
3258
|
STRUCT_UAI: r.UAI,
|
|
3210
3259
|
PROJET: r.projetId ? r.projetId : u.ID_PROJET,
|
|
@@ -3233,7 +3282,7 @@ const w = class w {
|
|
|
3233
3282
|
async getVideoConf() {
|
|
3234
3283
|
var t;
|
|
3235
3284
|
const e = await this.conf.getPublicConf(
|
|
3236
|
-
APP$
|
|
3285
|
+
APP$4.VIDEO
|
|
3237
3286
|
);
|
|
3238
3287
|
return {
|
|
3239
3288
|
maxWeight: (e == null ? void 0 : e["max-videosize-mbytes"]) ?? w.MAX_WEIGHT,
|
|
@@ -3258,13 +3307,13 @@ const w = class w {
|
|
|
3258
3307
|
throw new Error("Invalid video file.");
|
|
3259
3308
|
if (!e.filename)
|
|
3260
3309
|
throw new Error("Invalid video filename");
|
|
3261
|
-
const i = `${e.browser.name} ${e.browser.version}`,
|
|
3262
|
-
|
|
3310
|
+
const i = `${e.browser.name} ${e.browser.version}`, o = new FormData();
|
|
3311
|
+
o.append("device", e.device || ""), o.append("browser", i), o.append("url", e.url), o.append("app", t), o.append("file", e.file, e.filename), o.append("weight", "" + e.file.size), o.append("captation", "" + s);
|
|
3263
3312
|
let a = `/video/encode?captation=${s}`;
|
|
3264
3313
|
r && (a += `&duration=${r}`);
|
|
3265
3314
|
const c = await this.http.post(
|
|
3266
3315
|
a,
|
|
3267
|
-
|
|
3316
|
+
o,
|
|
3268
3317
|
{ headers: { "Content-Type": "multipart/form-data" } }
|
|
3269
3318
|
);
|
|
3270
3319
|
if (c.state == "running") {
|
|
@@ -3294,8 +3343,8 @@ const w = class w {
|
|
|
3294
3343
|
throw new Error("Video cannot be uploaded.");
|
|
3295
3344
|
}
|
|
3296
3345
|
};
|
|
3297
|
-
|
|
3298
|
-
|
|
3346
|
+
n(w, "MAX_WEIGHT", 50), // in Mbytes. Applies to uploaded videos.
|
|
3347
|
+
n(w, "MAX_DURATION", 3);
|
|
3299
3348
|
let VideoService = w;
|
|
3300
3349
|
class EmbedderService {
|
|
3301
3350
|
constructor(e) {
|
|
@@ -3332,9 +3381,9 @@ class EmbedderService {
|
|
|
3332
3381
|
urlIsFromPattern(e, t) {
|
|
3333
3382
|
const s = new RegExp("[^{}]+(?=(?:[^{}]*{[^}]*})*[^}]*$)", "g"), r = new RegExp("{[^}]*}", "g");
|
|
3334
3383
|
let i = !0;
|
|
3335
|
-
const
|
|
3384
|
+
const o = t.match(s) || [], a = [];
|
|
3336
3385
|
return (t.match(r) || []).forEach((h, l) => {
|
|
3337
|
-
h.includes("ignore") || a.push(
|
|
3386
|
+
h.includes("ignore") || a.push(o[l]);
|
|
3338
3387
|
}), a.forEach((h) => {
|
|
3339
3388
|
if (!e.includes(h)) {
|
|
3340
3389
|
i = !1;
|
|
@@ -3365,7 +3414,7 @@ class EmbedderService {
|
|
|
3365
3414
|
for (const s of e.url)
|
|
3366
3415
|
if (this.urlIsFromPattern(t, s)) {
|
|
3367
3416
|
const r = new RegExp("{[a-zA-Z0-9_.]+}", "g"), i = s.match(r) || [];
|
|
3368
|
-
let
|
|
3417
|
+
let o = e.embed;
|
|
3369
3418
|
for (const a of i) {
|
|
3370
3419
|
let c = s.split(a)[0];
|
|
3371
3420
|
const h = c.split("}");
|
|
@@ -3376,9 +3425,9 @@ class EmbedderService {
|
|
|
3376
3425
|
const E = s.split(a)[1].split("{")[0];
|
|
3377
3426
|
E && (l = l.split(E)[0]);
|
|
3378
3427
|
const p = new RegExp("\\" + a.replace(/}/, "\\}"), "g");
|
|
3379
|
-
|
|
3428
|
+
o = o.replace(p, l);
|
|
3380
3429
|
}
|
|
3381
|
-
return
|
|
3430
|
+
return o;
|
|
3382
3431
|
}
|
|
3383
3432
|
return "";
|
|
3384
3433
|
}
|
|
@@ -3391,7 +3440,7 @@ class AbstractBehaviourService {
|
|
|
3391
3440
|
//-----------------
|
|
3392
3441
|
//--- Utilities ---
|
|
3393
3442
|
//-----------------
|
|
3394
|
-
|
|
3443
|
+
n(this, "_cache");
|
|
3395
3444
|
this.context = e, this._cache = new CacheService(this.context);
|
|
3396
3445
|
}
|
|
3397
3446
|
getApplication() {
|
|
@@ -3425,8 +3474,8 @@ class AbstractBehaviourService {
|
|
|
3425
3474
|
class ActualitesBehaviour extends AbstractBehaviourService {
|
|
3426
3475
|
constructor() {
|
|
3427
3476
|
super(...arguments);
|
|
3428
|
-
|
|
3429
|
-
|
|
3477
|
+
n(this, "APP", "actualites");
|
|
3478
|
+
n(this, "RESOURCE", "actualites");
|
|
3430
3479
|
}
|
|
3431
3480
|
async loadResources() {
|
|
3432
3481
|
return (await this.httpGet(
|
|
@@ -3449,24 +3498,24 @@ class ActualitesBehaviour extends AbstractBehaviourService {
|
|
|
3449
3498
|
class BlogBehaviour extends AbstractBehaviourService {
|
|
3450
3499
|
constructor() {
|
|
3451
3500
|
super(...arguments);
|
|
3452
|
-
|
|
3453
|
-
|
|
3501
|
+
n(this, "APP", "blog");
|
|
3502
|
+
n(this, "RESOURCE", "blog");
|
|
3454
3503
|
}
|
|
3455
3504
|
loadResources() {
|
|
3456
3505
|
return new Promise(async (t, s) => {
|
|
3457
3506
|
try {
|
|
3458
3507
|
const r = await this.httpGet("/blog/linker"), i = [];
|
|
3459
|
-
r.forEach((
|
|
3460
|
-
|
|
3461
|
-
const a =
|
|
3462
|
-
owner:
|
|
3463
|
-
ownerName:
|
|
3464
|
-
title: c.title + " [" +
|
|
3465
|
-
_id: `${
|
|
3466
|
-
icon:
|
|
3467
|
-
path: `/blog/id/${
|
|
3468
|
-
shared: !!(
|
|
3469
|
-
modified:
|
|
3508
|
+
r.forEach((o) => {
|
|
3509
|
+
o.thumbnail ? o.thumbnail = o.thumbnail + "?thumbnail=48x48" : o.thumbnail = "/img/illustrations/blog.svg";
|
|
3510
|
+
const a = o.fetchPosts.map((c) => this.dataToResource({
|
|
3511
|
+
owner: o.author.userId,
|
|
3512
|
+
ownerName: o.author.username,
|
|
3513
|
+
title: c.title + " [" + o.title + "]",
|
|
3514
|
+
_id: `${o._id}#${c._id}`,
|
|
3515
|
+
icon: o.thumbnail,
|
|
3516
|
+
path: `/blog/id/${o._id}/post/${c._id}`,
|
|
3517
|
+
shared: !!(o.shared && o.shared.length >= 0),
|
|
3518
|
+
modified: o.modified
|
|
3470
3519
|
}));
|
|
3471
3520
|
i.push(...a);
|
|
3472
3521
|
}), t(i);
|
|
@@ -3479,8 +3528,8 @@ class BlogBehaviour extends AbstractBehaviourService {
|
|
|
3479
3528
|
class CollaborativewallBehaviour extends AbstractBehaviourService {
|
|
3480
3529
|
constructor() {
|
|
3481
3530
|
super(...arguments);
|
|
3482
|
-
|
|
3483
|
-
|
|
3531
|
+
n(this, "APP", "collaborativewall");
|
|
3532
|
+
n(this, "RESOURCE", "collaborativewall");
|
|
3484
3533
|
}
|
|
3485
3534
|
async loadResources() {
|
|
3486
3535
|
return (await this.httpGet(
|
|
@@ -3502,8 +3551,8 @@ class CollaborativewallBehaviour extends AbstractBehaviourService {
|
|
|
3502
3551
|
class CommunityBehaviour extends AbstractBehaviourService {
|
|
3503
3552
|
constructor() {
|
|
3504
3553
|
super(...arguments);
|
|
3505
|
-
|
|
3506
|
-
|
|
3554
|
+
n(this, "APP", "community");
|
|
3555
|
+
n(this, "RESOURCE", "community");
|
|
3507
3556
|
}
|
|
3508
3557
|
async loadResources() {
|
|
3509
3558
|
return (await this.httpGet(
|
|
@@ -3527,24 +3576,24 @@ class CommunityBehaviour extends AbstractBehaviourService {
|
|
|
3527
3576
|
class ExercizerBehaviour extends AbstractBehaviourService {
|
|
3528
3577
|
constructor() {
|
|
3529
3578
|
super(...arguments);
|
|
3530
|
-
|
|
3531
|
-
|
|
3579
|
+
n(this, "APP", "exercizer");
|
|
3580
|
+
n(this, "RESOURCE", "exercizer");
|
|
3532
3581
|
}
|
|
3533
3582
|
async loadResources() {
|
|
3534
3583
|
return (await this.httpGet(
|
|
3535
3584
|
"/exercizer/subjects-scheduled"
|
|
3536
3585
|
)).map((s) => {
|
|
3537
3586
|
const r = s.picture ? s.picture + "?thumbnail=48x48" : "/img/illustrations/exercizer.svg";
|
|
3538
|
-
let i,
|
|
3587
|
+
let i, o = !1;
|
|
3539
3588
|
const a = JSON.parse(s.scheduled_at);
|
|
3540
|
-
return a.groupList.length > 0 ? (
|
|
3589
|
+
return a.groupList.length > 0 ? (o = !0, i = a.groupList[0].name) : a.userList.length > 0 ? (o = !0, i = a.userList[0].name) : i = "", a.groupList.length + a.userList.length > 1 && (i += "..."), this.dataToResource({
|
|
3541
3590
|
title: s.title,
|
|
3542
3591
|
owner: s.owner,
|
|
3543
3592
|
ownerName: i,
|
|
3544
3593
|
icon: r,
|
|
3545
3594
|
path: "/exercizer#/linker/" + s.id,
|
|
3546
3595
|
_id: "" + s.id,
|
|
3547
|
-
shared:
|
|
3596
|
+
shared: o,
|
|
3548
3597
|
modified: s.modified
|
|
3549
3598
|
});
|
|
3550
3599
|
});
|
|
@@ -3553,8 +3602,8 @@ class ExercizerBehaviour extends AbstractBehaviourService {
|
|
|
3553
3602
|
class FormulaireBehaviour extends AbstractBehaviourService {
|
|
3554
3603
|
constructor() {
|
|
3555
3604
|
super(...arguments);
|
|
3556
|
-
|
|
3557
|
-
|
|
3605
|
+
n(this, "APP", "formulaire");
|
|
3606
|
+
n(this, "RESOURCE", "formulaire");
|
|
3558
3607
|
}
|
|
3559
3608
|
async loadResources() {
|
|
3560
3609
|
return (await this.httpGet(
|
|
@@ -3574,8 +3623,8 @@ class FormulaireBehaviour extends AbstractBehaviourService {
|
|
|
3574
3623
|
class ForumBehaviour extends AbstractBehaviourService {
|
|
3575
3624
|
constructor() {
|
|
3576
3625
|
super(...arguments);
|
|
3577
|
-
|
|
3578
|
-
|
|
3626
|
+
n(this, "APP", "forum");
|
|
3627
|
+
n(this, "RESOURCE", "forum");
|
|
3579
3628
|
}
|
|
3580
3629
|
async loadResources() {
|
|
3581
3630
|
return (await this.httpGet("/forum/categories")).map(
|
|
@@ -3595,8 +3644,8 @@ class ForumBehaviour extends AbstractBehaviourService {
|
|
|
3595
3644
|
class HomeworksBehaviour extends AbstractBehaviourService {
|
|
3596
3645
|
constructor() {
|
|
3597
3646
|
super(...arguments);
|
|
3598
|
-
|
|
3599
|
-
|
|
3647
|
+
n(this, "APP", "homeworks");
|
|
3648
|
+
n(this, "RESOURCE", "homeworks");
|
|
3600
3649
|
}
|
|
3601
3650
|
async loadResources() {
|
|
3602
3651
|
return (await this.httpGet("/homeworks/list")).filter((t) => t.owner && t.trashed === 0).map((t) => this.dataToResource({
|
|
@@ -3614,8 +3663,8 @@ class HomeworksBehaviour extends AbstractBehaviourService {
|
|
|
3614
3663
|
class MagnetoBehaviour extends AbstractBehaviourService {
|
|
3615
3664
|
constructor() {
|
|
3616
3665
|
super(...arguments);
|
|
3617
|
-
|
|
3618
|
-
|
|
3666
|
+
n(this, "APP", "magneto");
|
|
3667
|
+
n(this, "RESOURCE", "magneto");
|
|
3619
3668
|
}
|
|
3620
3669
|
async loadResources() {
|
|
3621
3670
|
const { all: t } = await this.httpGet(
|
|
@@ -3636,8 +3685,8 @@ class MagnetoBehaviour extends AbstractBehaviourService {
|
|
|
3636
3685
|
class MindmapBehaviour extends AbstractBehaviourService {
|
|
3637
3686
|
constructor() {
|
|
3638
3687
|
super(...arguments);
|
|
3639
|
-
|
|
3640
|
-
|
|
3688
|
+
n(this, "APP", "mindmap");
|
|
3689
|
+
n(this, "RESOURCE", "mindmap");
|
|
3641
3690
|
}
|
|
3642
3691
|
async loadResources() {
|
|
3643
3692
|
return (await this.httpGet("/mindmap/list/all")).map(
|
|
@@ -3657,13 +3706,13 @@ class MindmapBehaviour extends AbstractBehaviourService {
|
|
|
3657
3706
|
class PagesBehaviour extends AbstractBehaviourService {
|
|
3658
3707
|
constructor() {
|
|
3659
3708
|
super(...arguments);
|
|
3660
|
-
|
|
3661
|
-
|
|
3709
|
+
n(this, "APP", "pages");
|
|
3710
|
+
n(this, "RESOURCE", "pages");
|
|
3662
3711
|
}
|
|
3663
3712
|
async loadResources() {
|
|
3664
3713
|
const t = await this.httpGet("/pages/list/all"), s = [];
|
|
3665
3714
|
return t.forEach((r) => {
|
|
3666
|
-
var
|
|
3715
|
+
var o;
|
|
3667
3716
|
const i = r.thumbnail ? r.thumbnail + "?thumbnail=48x48" : "/img/illustrations/pages.svg";
|
|
3668
3717
|
s.push(
|
|
3669
3718
|
this.dataToResource({
|
|
@@ -3676,7 +3725,7 @@ class PagesBehaviour extends AbstractBehaviourService {
|
|
|
3676
3725
|
shared: typeof r.shared < "u",
|
|
3677
3726
|
modified: r.modified
|
|
3678
3727
|
})
|
|
3679
|
-
), (
|
|
3728
|
+
), (o = r.pages) == null || o.forEach((a) => {
|
|
3680
3729
|
s.push(
|
|
3681
3730
|
this.dataToResource({
|
|
3682
3731
|
title: a.title,
|
|
@@ -3696,8 +3745,8 @@ class PagesBehaviour extends AbstractBehaviourService {
|
|
|
3696
3745
|
class PollBehaviour extends AbstractBehaviourService {
|
|
3697
3746
|
constructor() {
|
|
3698
3747
|
super(...arguments);
|
|
3699
|
-
|
|
3700
|
-
|
|
3748
|
+
n(this, "APP", "poll");
|
|
3749
|
+
n(this, "RESOURCE", "poll");
|
|
3701
3750
|
}
|
|
3702
3751
|
async loadResources() {
|
|
3703
3752
|
return (await this.httpGet("/poll/list/all")).map((s) => {
|
|
@@ -3718,8 +3767,8 @@ class PollBehaviour extends AbstractBehaviourService {
|
|
|
3718
3767
|
class ScrapbookBehaviour extends AbstractBehaviourService {
|
|
3719
3768
|
constructor() {
|
|
3720
3769
|
super(...arguments);
|
|
3721
|
-
|
|
3722
|
-
|
|
3770
|
+
n(this, "APP", "scrapbook");
|
|
3771
|
+
n(this, "RESOURCE", "scrapbook");
|
|
3723
3772
|
}
|
|
3724
3773
|
async loadResources() {
|
|
3725
3774
|
return (await this.httpGet(
|
|
@@ -3742,25 +3791,25 @@ class ScrapbookBehaviour extends AbstractBehaviourService {
|
|
|
3742
3791
|
class TimelinegeneratorBehaviour extends AbstractBehaviourService {
|
|
3743
3792
|
constructor() {
|
|
3744
3793
|
super(...arguments);
|
|
3745
|
-
|
|
3746
|
-
|
|
3794
|
+
n(this, "APP", "timelinegenerator");
|
|
3795
|
+
n(this, "RESOURCE", "timelinegenerator");
|
|
3747
3796
|
}
|
|
3748
3797
|
loadResources() {
|
|
3749
3798
|
return new Promise(async (t, s) => {
|
|
3750
3799
|
try {
|
|
3751
3800
|
const i = (await this.httpGet(
|
|
3752
3801
|
"/timelinegenerator/timelines"
|
|
3753
|
-
)).map((
|
|
3754
|
-
const a =
|
|
3802
|
+
)).map((o) => {
|
|
3803
|
+
const a = o.icon || "/img/illustrations/timeline-default.png";
|
|
3755
3804
|
return this.dataToResource({
|
|
3756
|
-
title:
|
|
3757
|
-
ownerName:
|
|
3758
|
-
owner:
|
|
3805
|
+
title: o.headline,
|
|
3806
|
+
ownerName: o.owner.displayName,
|
|
3807
|
+
owner: o.owner.userId,
|
|
3759
3808
|
icon: a,
|
|
3760
|
-
path: "/timelinegenerator#/view/" +
|
|
3761
|
-
_id:
|
|
3762
|
-
shared: typeof
|
|
3763
|
-
modified:
|
|
3809
|
+
path: "/timelinegenerator#/view/" + o._id,
|
|
3810
|
+
_id: o._id,
|
|
3811
|
+
shared: typeof o.shared < "u",
|
|
3812
|
+
modified: o.modified
|
|
3764
3813
|
});
|
|
3765
3814
|
});
|
|
3766
3815
|
t(i);
|
|
@@ -3773,8 +3822,8 @@ class TimelinegeneratorBehaviour extends AbstractBehaviourService {
|
|
|
3773
3822
|
class WikiBehaviour extends AbstractBehaviourService {
|
|
3774
3823
|
constructor() {
|
|
3775
3824
|
super(...arguments);
|
|
3776
|
-
|
|
3777
|
-
|
|
3825
|
+
n(this, "APP", "wiki");
|
|
3826
|
+
n(this, "RESOURCE", "wiki");
|
|
3778
3827
|
}
|
|
3779
3828
|
async loadResources() {
|
|
3780
3829
|
return (await this.httpGet(
|
|
@@ -3797,15 +3846,15 @@ class WikiBehaviour extends AbstractBehaviourService {
|
|
|
3797
3846
|
class WorkspaceBehaviour extends AbstractBehaviourService {
|
|
3798
3847
|
constructor() {
|
|
3799
3848
|
super(...arguments);
|
|
3800
|
-
|
|
3801
|
-
|
|
3849
|
+
n(this, "APP", "workspace");
|
|
3850
|
+
n(this, "RESOURCE", "workspace");
|
|
3802
3851
|
}
|
|
3803
3852
|
loadResources({ search: t, asset_id: s }) {
|
|
3804
3853
|
return new Promise(async (r, i) => {
|
|
3805
3854
|
try {
|
|
3806
|
-
let
|
|
3807
|
-
s && s.length ?
|
|
3808
|
-
const c = (await this.httpGet(
|
|
3855
|
+
let o = "/workspace/documents?filter=all&hierarchical=true";
|
|
3856
|
+
s && s.length ? o += `&search=${t}` : t && t.length && (o += `&search=${t}`);
|
|
3857
|
+
const c = (await this.httpGet(o)).filter((h) => !h.deleted).map((h) => {
|
|
3809
3858
|
const l = h.metadata["content-type"] && h.metadata["content-type"].indexOf("image") !== -1 ? `/workspace/document/${h._id}?thumbnail=120x120` : "/img/icons/unknown-large.png";
|
|
3810
3859
|
return this.dataToResource({
|
|
3811
3860
|
title: h.name,
|
|
@@ -3819,8 +3868,8 @@ class WorkspaceBehaviour extends AbstractBehaviourService {
|
|
|
3819
3868
|
});
|
|
3820
3869
|
});
|
|
3821
3870
|
r(c);
|
|
3822
|
-
} catch (
|
|
3823
|
-
i(
|
|
3871
|
+
} catch (o) {
|
|
3872
|
+
i(o);
|
|
3824
3873
|
}
|
|
3825
3874
|
});
|
|
3826
3875
|
}
|
|
@@ -3836,7 +3885,7 @@ const y = class y {
|
|
|
3836
3885
|
e.session().getUser()
|
|
3837
3886
|
]);
|
|
3838
3887
|
i != null && i.apps && (r != null && r.length) && (this.resourceProducingApps = r.filter(
|
|
3839
|
-
(
|
|
3888
|
+
(o) => i.apps.some((a) => a.address.includes(o))
|
|
3840
3889
|
));
|
|
3841
3890
|
} catch (r) {
|
|
3842
3891
|
console.warn("Failed to load resource-producing apps:", r);
|
|
@@ -3913,13 +3962,13 @@ const y = class y {
|
|
|
3913
3962
|
//
|
|
3914
3963
|
// STATIC REGISTRY
|
|
3915
3964
|
//
|
|
3916
|
-
|
|
3917
|
-
|
|
3965
|
+
n(y, "registry", new ServiceRegistry()), // Expose some useful functions
|
|
3966
|
+
n(y, "findBehaviour", y.registry.findService.bind(y.registry)), n(y, "hasBehaviour", y.registry.isRegistered.bind(y.registry)), n(y, "resourceProducingApps", []);
|
|
3918
3967
|
let SnipletsService = y;
|
|
3919
3968
|
const SEND_ALL = "*";
|
|
3920
3969
|
class WebBroker {
|
|
3921
3970
|
constructor(e) {
|
|
3922
|
-
|
|
3971
|
+
n(this, "subscription");
|
|
3923
3972
|
this.odeServices = e;
|
|
3924
3973
|
}
|
|
3925
3974
|
get http() {
|
|
@@ -3951,10 +4000,10 @@ class WebBroker {
|
|
|
3951
4000
|
}
|
|
3952
4001
|
class DataService {
|
|
3953
4002
|
constructor(e) {
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
4003
|
+
n(this, "_webBroker");
|
|
4004
|
+
n(this, "app");
|
|
4005
|
+
n(this, "user");
|
|
4006
|
+
n(this, "profile");
|
|
3958
4007
|
this.odeServices = e;
|
|
3959
4008
|
}
|
|
3960
4009
|
get conf() {
|
|
@@ -3988,12 +4037,12 @@ class DataService {
|
|
|
3988
4037
|
addUserInfos(e) {
|
|
3989
4038
|
return this.user && (e.userId = this.user.userId, e.structure = this.user.structureNames[0]), this.profile && (e.profil = this.profile[0]), e;
|
|
3990
4039
|
}
|
|
3991
|
-
trackVideoSave(e, t, s, r, i,
|
|
4040
|
+
trackVideoSave(e, t, s, r, i, o, a) {
|
|
3992
4041
|
const c = this.addUserInfos({
|
|
3993
4042
|
"event-type": "VIDEO_SAVE",
|
|
3994
4043
|
module: "video",
|
|
3995
4044
|
video_id: e,
|
|
3996
|
-
browser:
|
|
4045
|
+
browser: o,
|
|
3997
4046
|
duration: Math.round(t),
|
|
3998
4047
|
weight: s,
|
|
3999
4048
|
source: r ? "CAPTURED" : "UPLOADED",
|
|
@@ -4002,7 +4051,7 @@ class DataService {
|
|
|
4002
4051
|
this.app && (c["override-module"] = this.app), a && (c.device_type = a), this.trackWebEvent(c);
|
|
4003
4052
|
}
|
|
4004
4053
|
trackVideoRead(e, t, s, r, i) {
|
|
4005
|
-
const
|
|
4054
|
+
const o = this.addUserInfos({
|
|
4006
4055
|
"event-type": "VIDEO_READ",
|
|
4007
4056
|
module: "video",
|
|
4008
4057
|
video_id: e,
|
|
@@ -4010,7 +4059,7 @@ class DataService {
|
|
|
4010
4059
|
source: t ? "CAPTURED" : "UPLOADED",
|
|
4011
4060
|
url: s
|
|
4012
4061
|
});
|
|
4013
|
-
this.app && (
|
|
4062
|
+
this.app && (o["override-module"] = this.app), i && (o.device_type = i), this.trackWebEvent(o);
|
|
4014
4063
|
}
|
|
4015
4064
|
trackSpeechAndText(e) {
|
|
4016
4065
|
const t = this.addUserInfos({
|
|
@@ -4116,20 +4165,20 @@ class AudienceService {
|
|
|
4116
4165
|
}
|
|
4117
4166
|
class OdeServices {
|
|
4118
4167
|
constructor() {
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4168
|
+
n(this, "_analytics");
|
|
4169
|
+
n(this, "_cache");
|
|
4170
|
+
n(this, "_conf");
|
|
4171
|
+
n(this, "_data");
|
|
4172
|
+
n(this, "_directory");
|
|
4173
|
+
n(this, "_http");
|
|
4174
|
+
n(this, "_idiom");
|
|
4175
|
+
n(this, "_notify");
|
|
4176
|
+
n(this, "_rights");
|
|
4177
|
+
n(this, "_session");
|
|
4178
|
+
n(this, "_share");
|
|
4179
|
+
n(this, "_video");
|
|
4180
|
+
n(this, "_workspace");
|
|
4181
|
+
n(this, "_embedder");
|
|
4133
4182
|
this._analytics = new AnalyticsService(this), this._cache = new CacheService(this), this._conf = new ConfService(this), this._data = new DataService(this), this._directory = new DirectoryService(this), this._http = new HttpService(this), this._idiom = new IdiomService(this), this._notify = NotifyFrameworkFactory.instance(), this._rights = new RightService(this), this._session = new SessionService(this), this._share = new ShareService(this), this._video = new VideoService(this), this._workspace = new WorkspaceService(this), this._embedder = new EmbedderService(this);
|
|
4134
4183
|
}
|
|
4135
4184
|
initialize() {
|
|
@@ -4331,10 +4380,10 @@ const isActionAvailable = (u, e) => {
|
|
|
4331
4380
|
class WidgetFramework {
|
|
4332
4381
|
constructor() {
|
|
4333
4382
|
//-------------------------------------
|
|
4334
|
-
|
|
4335
|
-
|
|
4383
|
+
n(this, "_initialized");
|
|
4384
|
+
n(this, "_widgets", []);
|
|
4336
4385
|
////////////////////////////////////// USER PREFERENCES
|
|
4337
|
-
|
|
4386
|
+
n(this, "_userPrefs", {});
|
|
4338
4387
|
}
|
|
4339
4388
|
initialize(e, t) {
|
|
4340
4389
|
return this._initialized || (this._initialized = new Promisified(), notify.onSessionReady().promise.then((s) => {
|
|
@@ -4345,8 +4394,8 @@ class WidgetFramework {
|
|
|
4345
4394
|
var i;
|
|
4346
4395
|
(i = this._initialized) == null || i.resolve();
|
|
4347
4396
|
}).catch((i) => {
|
|
4348
|
-
var
|
|
4349
|
-
(
|
|
4397
|
+
var o;
|
|
4398
|
+
(o = this._initialized) == null || o.reject();
|
|
4350
4399
|
})) : (r = this._initialized) == null || r.reject();
|
|
4351
4400
|
})), this._initialized.promise;
|
|
4352
4401
|
}
|
|
@@ -4387,9 +4436,9 @@ class WidgetFramework {
|
|
|
4387
4436
|
position: c.platformConf.position
|
|
4388
4437
|
}), c.platformConf.mandatory && (this._userPrefs[l].show = !0, this._userPrefs[l].index = defaultWidgetOrder[l] ?? 999), c.platformConf.i18n && s.push(c.platformConf.i18n), c.applyUserPref(this._userPrefs[l]), !0);
|
|
4389
4438
|
});
|
|
4390
|
-
const
|
|
4439
|
+
const o = new Idiom();
|
|
4391
4440
|
this._widgets = this._widgets.sort((c, h) => {
|
|
4392
|
-
const l =
|
|
4441
|
+
const l = o.translate(`timeline.settings.${c.platformConf.name}`).toLowerCase(), E = o.translate(`timeline.settings.${h.platformConf.name}`).toLowerCase();
|
|
4393
4442
|
return l < E ? -1 : l > E ? 1 : 0;
|
|
4394
4443
|
});
|
|
4395
4444
|
});
|
|
@@ -4398,8 +4447,8 @@ class WidgetFramework {
|
|
|
4398
4447
|
class Widget {
|
|
4399
4448
|
//-------------------------------------
|
|
4400
4449
|
constructor(e) {
|
|
4401
|
-
|
|
4402
|
-
|
|
4450
|
+
n(this, "_schoolConf", {});
|
|
4451
|
+
n(this, "_userPref");
|
|
4403
4452
|
this._platformConf = e, this._userPref = null;
|
|
4404
4453
|
}
|
|
4405
4454
|
get platformConf() {
|
|
@@ -4458,7 +4507,7 @@ class WidgetFrameworkFactory {
|
|
|
4458
4507
|
}
|
|
4459
4508
|
export {
|
|
4460
4509
|
ACTION,
|
|
4461
|
-
APP$
|
|
4510
|
+
APP$4 as APP,
|
|
4462
4511
|
BOOLEAN_FILTER,
|
|
4463
4512
|
ConfigurationFrameworkFactory,
|
|
4464
4513
|
DocumentHelper,
|