@edifice.io/client 2.5.10 → 2.5.12

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,8 +1,9 @@
1
1
  var T = Object.defineProperty;
2
- var P = (u, e, t) => e in u ? T(u, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[e] = t;
3
- var n = (u, e, t) => P(u, typeof e != "symbol" ? e + "" : e, t);
2
+ var P = (n, e, t) => e in n ? T(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var u = (n, e, t) => P(n, typeof e != "symbol" ? e + "" : e, t);
4
4
  import axios from "axios";
5
5
  import { MimeTypeUtils } from "@edifice.io/utilities";
6
+ import { UAParser } from "ua-parser-js";
6
7
  const ERROR_CODE = {
7
8
  SUCCESS: "0000",
8
9
  UNKNOWN: "0010",
@@ -97,10 +98,10 @@ const ERROR_CODE = {
97
98
  INFOTIP: "infotip",
98
99
  RGPD_COOKIES: "rgpdCookies"
99
100
  // TODO compléter
100
- }, R = class R {
101
+ }, C = class C {
101
102
  constructor(e) {
102
- n(this, "name");
103
- n(this, "listeners", /* @__PURE__ */ new Set());
103
+ u(this, "name");
104
+ u(this, "listeners", /* @__PURE__ */ new Set());
104
105
  this.name = e;
105
106
  }
106
107
  /**
@@ -109,8 +110,8 @@ const ERROR_CODE = {
109
110
  * @returns the channel instance
110
111
  */
111
112
  static getChannel(e) {
112
- let t = R.channels.get(e);
113
- return t || (t = new R(e), R.channels.set(e, t)), t;
113
+ let t = C.channels.get(e);
114
+ return t || (t = new C(e), C.channels.set(e, t)), t;
114
115
  }
115
116
  /**
116
117
  * Add a listener and return a revocation function to remove it.
@@ -135,14 +136,14 @@ const ERROR_CODE = {
135
136
  * Close this channel: remove listeners and unregister from global map.
136
137
  */
137
138
  close() {
138
- this.listeners.clear(), R.channels.delete(this.name);
139
+ this.listeners.clear(), C.channels.delete(this.name);
139
140
  }
140
141
  };
141
- n(R, "channels", /* @__PURE__ */ new Map());
142
- let SimpleChannel = R;
142
+ u(C, "channels", /* @__PURE__ */ new Map());
143
+ let SimpleChannel = C;
143
144
  class Subscription {
144
145
  constructor(e, t) {
145
- n(this, "revoke");
146
+ u(this, "revoke");
146
147
  this._channel = e, this.revoke = this.setReceiver((s) => t == null ? void 0 : t(s));
147
148
  }
148
149
  setReceiver(e) {
@@ -159,7 +160,7 @@ class Subject {
159
160
  /* We maintain channels for sending messages.
160
161
  * Receiving channels are instantiated per subscription.
161
162
  */
162
- n(this, "publishChannels", /* @__PURE__ */ new Map());
163
+ u(this, "publishChannels", /* @__PURE__ */ new Map());
163
164
  }
164
165
  getChannelName(e) {
165
166
  return "Subject:" + e;
@@ -194,9 +195,9 @@ const ASYNC_DATA_NAME = {
194
195
  class Promisified {
195
196
  constructor() {
196
197
  //-------------------------------------
197
- n(this, "_resolution");
198
- n(this, "_rejection");
199
- n(this, "_promise", new Promise((e, t) => {
198
+ u(this, "_resolution");
199
+ u(this, "_rejection");
200
+ u(this, "_promise", new Promise((e, t) => {
200
201
  this._resolution = e, this._rejection = t;
201
202
  }));
202
203
  }
@@ -213,8 +214,8 @@ class Promisified {
213
214
  class NotifyFramework {
214
215
  constructor() {
215
216
  //-------------------------------------
216
- n(this, "promises", {});
217
- n(this, "subject", new Subject());
217
+ u(this, "promises", {});
218
+ u(this, "subject", new Subject());
218
219
  }
219
220
  asyncData(e) {
220
221
  return typeof this.promises[e] > "u" && (this.promises[e] = new Promisified()), this.promises[e];
@@ -245,8 +246,8 @@ const notify = new NotifyFramework(), loadedScripts$1 = {};
245
246
  class Http {
246
247
  constructor(e) {
247
248
  // Axios automatically manages the XSRF-TOKEN cookie and the X-XSRF-TOKEN HTTP header.
248
- n(this, "axios");
249
- n(this, "_latestResponse");
249
+ u(this, "axios");
250
+ u(this, "_latestResponse");
250
251
  this.axios = axios.create(e);
251
252
  }
252
253
  setCdn(e) {
@@ -343,7 +344,7 @@ class Http {
343
344
  }
344
345
  class TransportFramework {
345
346
  constructor() {
346
- n(this, "_http", new Http());
347
+ u(this, "_http", new Http());
347
348
  }
348
349
  get http() {
349
350
  return this._http;
@@ -362,11 +363,11 @@ class ConfigurationFrameworkFactory {
362
363
  const http$2 = transport.http;
363
364
  class Session {
364
365
  constructor() {
365
- n(this, "_me", null);
366
- n(this, "_currentLanguage", "");
367
- n(this, "_notLoggedIn", !0);
368
- n(this, "_description");
369
- n(this, "_profile");
366
+ u(this, "_me", null);
367
+ u(this, "_currentLanguage", "");
368
+ u(this, "_notLoggedIn", !0);
369
+ u(this, "_description");
370
+ u(this, "_profile");
370
371
  }
371
372
  get currentLanguage() {
372
373
  return this._currentLanguage;
@@ -484,7 +485,7 @@ class Session {
484
485
  }
485
486
  class SessionFramework {
486
487
  constructor() {
487
- n(this, "session", new Session());
488
+ u(this, "session", new Session());
488
489
  }
489
490
  initialize() {
490
491
  return this.session.initialize();
@@ -508,22 +509,22 @@ class SessionFramework {
508
509
  const session = new SessionFramework();
509
510
  class Theme {
510
511
  constructor() {
511
- n(this, "_conf");
512
- n(this, "_loaded");
512
+ u(this, "_conf");
513
+ u(this, "_loaded");
513
514
  // legacy (readonly)
514
- n(this, "skinName", "");
515
- n(this, "themeName", "");
516
- n(this, "skin", "raw");
517
- n(this, "themeUrl", "/assets/themes/raw/default/");
518
- n(this, "templateOverrides", {});
519
- n(this, "portalTemplate", "/assets/themes/raw/portal.html");
520
- n(this, "basePath", "");
521
- n(this, "logoutCallback", "");
522
- n(this, "skins", []);
523
- n(this, "is1D", !1);
524
- n(this, "is2D", !1);
525
- n(this, "_onSkinReady", notify.onSkinReady());
526
- n(this, "_onOverrideReady", notify.onOverridesReady());
515
+ u(this, "skinName", "");
516
+ u(this, "themeName", "");
517
+ u(this, "skin", "raw");
518
+ u(this, "themeUrl", "/assets/themes/raw/default/");
519
+ u(this, "templateOverrides", {});
520
+ u(this, "portalTemplate", "/assets/themes/raw/portal.html");
521
+ u(this, "basePath", "");
522
+ u(this, "logoutCallback", "");
523
+ u(this, "skins", []);
524
+ u(this, "is1D", !1);
525
+ u(this, "is2D", !1);
526
+ u(this, "_onSkinReady", notify.onSkinReady());
527
+ u(this, "_onOverrideReady", notify.onOverridesReady());
527
528
  }
528
529
  initialize(e) {
529
530
  return notify.onSessionReady().promise.then(() => this.load(e));
@@ -895,7 +896,7 @@ class Idiom {
895
896
  class UserPreferences {
896
897
  constructor() {
897
898
  //-------------------------------------
898
- n(this, "data", {});
899
+ u(this, "data", {});
899
900
  }
900
901
  get(e) {
901
902
  return this.data[e];
@@ -922,10 +923,10 @@ class UserPreferences {
922
923
  class User {
923
924
  constructor() {
924
925
  //-------------------------------------
925
- n(this, "_me", null);
926
- n(this, "_keepOpenOnLogout", !1);
927
- n(this, "_preferences", new UserPreferences());
928
- n(this, "_bookmarkedApps", []);
926
+ u(this, "_me", null);
927
+ u(this, "_keepOpenOnLogout", !1);
928
+ u(this, "_preferences", new UserPreferences());
929
+ u(this, "_bookmarkedApps", []);
929
930
  }
930
931
  get keepOpenOnLogout() {
931
932
  return this._keepOpenOnLogout;
@@ -999,9 +1000,9 @@ const http$1 = transport == null ? void 0 : transport.http;
999
1000
  class AppConf {
1000
1001
  constructor() {
1001
1002
  //-------------------------------------
1002
- n(this, "_publicConf", {});
1003
- n(this, "_currentApp");
1004
- n(this, "_appConf", {});
1003
+ u(this, "_publicConf", {});
1004
+ u(this, "_currentApp");
1005
+ u(this, "_appConf", {});
1005
1006
  }
1006
1007
  /**
1007
1008
  * Get the currently initialized App.
@@ -1039,8 +1040,8 @@ class AppConf {
1039
1040
  class Analytics {
1040
1041
  constructor() {
1041
1042
  //-------------------------------------
1042
- n(this, "_status", "void");
1043
- n(this, "_params");
1043
+ u(this, "_status", "void");
1044
+ u(this, "_params");
1044
1045
  }
1045
1046
  get status() {
1046
1047
  return this._status;
@@ -1122,10 +1123,61 @@ class Analytics {
1122
1123
  };
1123
1124
  }
1124
1125
  }
1126
+ function setCookie(n, e) {
1127
+ if (typeof document > "u") return;
1128
+ const t = location.protocol === "https:" ? "; Secure" : "";
1129
+ document.cookie = `${n}=${encodeURIComponent(e)}; path=/; SameSite=Strict${t}`;
1130
+ }
1131
+ function getCookie(n) {
1132
+ if (typeof document > "u") return null;
1133
+ const e = document.cookie.match(new RegExp("(^| )" + n + "=([^;]+)"));
1134
+ if (e)
1135
+ try {
1136
+ return decodeURIComponent(e[2]);
1137
+ } catch {
1138
+ return e[2];
1139
+ }
1140
+ return null;
1141
+ }
1142
+ function isPad() {
1143
+ return typeof window < "u" && "ongesturechange" in window;
1144
+ }
1145
+ function detectDevice() {
1146
+ if (typeof window > "u")
1147
+ return { osName: "", osVersion: "", deviceType: "", deviceName: "" };
1148
+ const n = UAParser(), e = isPad(), t = n.device.vendor || "", s = n.device.model || "", r = t && s ? `${t} ${s}` : s || t || "Unknown";
1149
+ let i = n.os.name || "Unknown", o = n.device.type || (e ? "tablet" : "desktop"), a = r;
1150
+ return e && i.toLowerCase() == "macos" && (i = "iPadOS", o = "tablet", a = "iPad"), {
1151
+ osName: i,
1152
+ osVersion: n.os.version || "Unknown",
1153
+ deviceType: o,
1154
+ deviceName: a
1155
+ };
1156
+ }
1157
+ function readDeviceCookies() {
1158
+ const n = getCookie("osName"), e = getCookie("osVersion"), t = getCookie("deviceType"), s = getCookie("deviceName");
1159
+ return n && e && t && s ? { osName: n, osVersion: e, deviceType: t, deviceName: s } : null;
1160
+ }
1161
+ function setDeviceCookies() {
1162
+ try {
1163
+ const n = readDeviceCookies();
1164
+ if (n != null)
1165
+ return n;
1166
+ const e = detectDevice();
1167
+ return setCookie("osName", e.osName), setCookie("osVersion", e.osVersion), setCookie("deviceType", e.deviceType), setCookie("deviceName", e.deviceName), e;
1168
+ } catch (n) {
1169
+ return console.warn("Device detection failed, using Unknown values:", n), {
1170
+ osName: "Unknown",
1171
+ osVersion: "Unknown",
1172
+ deviceType: "Unknown",
1173
+ deviceName: "Unknown"
1174
+ };
1175
+ }
1176
+ }
1125
1177
  class ConfigurationFramework {
1126
1178
  constructor() {
1127
1179
  //-------------------------------------
1128
- n(this, "Platform", {
1180
+ u(this, "Platform", {
1129
1181
  deploymentTag: "",
1130
1182
  cdnDomain: "",
1131
1183
  apps: new AppConf(),
@@ -1134,10 +1186,11 @@ class ConfigurationFramework {
1134
1186
  idiom: new Idiom(),
1135
1187
  listLanguages: () => transport.http.get("/languages")
1136
1188
  });
1137
- n(this, "School", {
1189
+ u(this, "School", {
1138
1190
  //apps; -> pinnedApps;
1139
1191
  });
1140
- n(this, "User", new User());
1192
+ u(this, "User", new User());
1193
+ setDeviceCookies();
1141
1194
  }
1142
1195
  async initialize(e, t) {
1143
1196
  if (!e) {
@@ -1180,12 +1233,12 @@ class ConfigurationFramework {
1180
1233
  // }
1181
1234
  }
1182
1235
  const configure = new ConfigurationFramework(), http = transport == null ? void 0 : transport.http;
1183
- var v;
1184
- const me = (v = session == null ? void 0 : session.session) == null ? void 0 : v.user;
1236
+ var D;
1237
+ const me = (D = session == null ? void 0 : session.session) == null ? void 0 : D.user;
1185
1238
  class Notification {
1186
1239
  constructor(e) {
1187
- n(this, "_id");
1188
- n(this, "model");
1240
+ u(this, "_id");
1241
+ u(this, "model");
1189
1242
  e.reported = e.reporters && e.reporters.length > 0, this._id = e._id, this.model = e;
1190
1243
  }
1191
1244
  isUnread() {
@@ -1205,14 +1258,14 @@ class Notification {
1205
1258
  class TimelineApp {
1206
1259
  constructor() {
1207
1260
  //-------------------------------------
1208
- n(this, "_notifications", []);
1209
- n(this, "_notificationTypes", []);
1261
+ u(this, "_notifications", []);
1262
+ u(this, "_notificationTypes", []);
1210
1263
  // ex: ["BLOG"]
1211
- n(this, "_flashMessages", []);
1212
- n(this, "_pageNumber", 0);
1213
- n(this, "_lastPage", !1);
1214
- n(this, "_loading", !1);
1215
- n(this, "showMine", !1);
1264
+ u(this, "_flashMessages", []);
1265
+ u(this, "_pageNumber", 0);
1266
+ u(this, "_lastPage", !1);
1267
+ u(this, "_loading", !1);
1268
+ u(this, "showMine", !1);
1216
1269
  }
1217
1270
  get notifications() {
1218
1271
  return this._notifications;
@@ -1361,7 +1414,7 @@ const m = class m {
1361
1414
  //
1362
1415
  // PROTECTED HELPERS
1363
1416
  //
1364
- n(this, "checkHttpResponse", (e) => {
1417
+ u(this, "checkHttpResponse", (e) => {
1365
1418
  if (this.http.latestResponse.status >= 300)
1366
1419
  throw this.http.latestResponse.statusText;
1367
1420
  return e;
@@ -1579,8 +1632,8 @@ const m = class m {
1579
1632
  //
1580
1633
  // STATIC REGISTRY
1581
1634
  //
1582
- n(m, "registry", new ServiceRegistry()), // Expose some useful functions
1583
- n(m, "register", m.registry.register.bind(m.registry)), n(m, "findService", m.registry.findService.bind(m.registry)), n(m, "findMainService", m.registry.findMainService.bind(m.registry)), n(m, "isRegistered", m.registry.isRegistered.bind(m.registry));
1635
+ u(m, "registry", new ServiceRegistry()), // Expose some useful functions
1636
+ u(m, "register", m.registry.register.bind(m.registry)), u(m, "findService", m.registry.findService.bind(m.registry)), u(m, "findMainService", m.registry.findMainService.bind(m.registry)), u(m, "isRegistered", m.registry.isRegistered.bind(m.registry));
1584
1637
  let ResourceService = m;
1585
1638
  const APP$3 = "scrapbook", RESOURCE$3 = "scrapbook";
1586
1639
  class ScrapbookResourceService extends ResourceService {
@@ -1623,7 +1676,7 @@ class ScrapbookResourceService extends ResourceService {
1623
1676
  }
1624
1677
  ResourceService.register(
1625
1678
  { application: RESOURCE$3, resourceType: RESOURCE$3 },
1626
- (u) => new ScrapbookResourceService(u)
1679
+ (n) => new ScrapbookResourceService(n)
1627
1680
  );
1628
1681
  const APP$2 = "homeworks", RESOURCE$2 = "homeworks";
1629
1682
  class HomeworksResourceService extends ResourceService {
@@ -1673,7 +1726,7 @@ class HomeworksResourceService extends ResourceService {
1673
1726
  }
1674
1727
  ResourceService.register(
1675
1728
  { application: RESOURCE$2, resourceType: RESOURCE$2 },
1676
- (u) => new HomeworksResourceService(u)
1729
+ (n) => new HomeworksResourceService(n)
1677
1730
  );
1678
1731
  const APP$1 = "timelinegenerator", RESOURCE$1 = "timelinegenerator";
1679
1732
  class TimelineGeneratorResourceService extends ResourceService {
@@ -1728,7 +1781,7 @@ class TimelineGeneratorResourceService extends ResourceService {
1728
1781
  }
1729
1782
  ResourceService.register(
1730
1783
  { application: RESOURCE$1, resourceType: RESOURCE$1 },
1731
- (u) => new TimelineGeneratorResourceService(u)
1784
+ (n) => new TimelineGeneratorResourceService(n)
1732
1785
  );
1733
1786
  const APP = "collaborativeeditor", RESOURCE = "collaborativeeditor";
1734
1787
  class CollaborativeEditorResourceService extends ResourceService {
@@ -1776,7 +1829,7 @@ class CollaborativeEditorResourceService extends ResourceService {
1776
1829
  }
1777
1830
  ResourceService.register(
1778
1831
  { application: RESOURCE, resourceType: RESOURCE },
1779
- (u) => new CollaborativeEditorResourceService(u)
1832
+ (n) => new CollaborativeEditorResourceService(n)
1780
1833
  );
1781
1834
  const globalCache = {}, mutexPromise = {};
1782
1835
  class CacheService {
@@ -1993,7 +2046,7 @@ class DirectoryService {
1993
2046
  this.cache.clearCache("/directory/sharebookmark/all");
1994
2047
  const i = r.map((h) => typeof h == "string" ? h : h.id), o = s.map((h) => typeof h == "string" ? h : h.id), a = t.map(async (h) => {
1995
2048
  if (typeof h == "string") {
1996
- const { displayName: y, groups: d, id: g, users: A } = await this.getBookMarkById(h), f = A.map((_) => _.id), w = d.map((_) => _.id);
2049
+ const { displayName: y, groups: d, id: g, users: A } = await this.getBookMarkById(h), f = A.map((v) => v.id), w = d.map((v) => v.id);
1997
2050
  return {
1998
2051
  displayName: y,
1999
2052
  id: g,
@@ -2019,10 +2072,10 @@ const loadedScripts = {};
2019
2072
  class HttpService {
2020
2073
  constructor(e, t) {
2021
2074
  // Axios automatically manages the XSRF-TOKEN cookie and the X-XSRF-TOKEN HTTP header.
2022
- n(this, "axios");
2023
- n(this, "baseUrl");
2024
- n(this, "headers", {});
2025
- n(this, "_latestResponse");
2075
+ u(this, "axios");
2076
+ u(this, "baseUrl");
2077
+ u(this, "headers", {});
2078
+ u(this, "_latestResponse");
2026
2079
  this.context = e, this.axios = axios.create(t);
2027
2080
  }
2028
2081
  fixBaseUrl(e) {
@@ -3089,44 +3142,44 @@ class ShareService {
3089
3142
  }
3090
3143
  }
3091
3144
  const defaultMappers = {
3092
- csv: function({ type: u, extension: e }) {
3093
- return MimeTypeUtils.INSTANCE.isCsvLike(u, e);
3145
+ csv: function({ type: n, extension: e }) {
3146
+ return MimeTypeUtils.INSTANCE.isCsvLike(n, e);
3094
3147
  },
3095
- doc: function({ type: u, extension: e }) {
3096
- return MimeTypeUtils.INSTANCE.isWordLike(u, e) ? !0 : u.indexOf("document") !== -1 && u.indexOf("wordprocessing") !== -1;
3148
+ doc: function({ type: n, extension: e }) {
3149
+ return MimeTypeUtils.INSTANCE.isWordLike(n, e) ? !0 : n.indexOf("document") !== -1 && n.indexOf("wordprocessing") !== -1;
3097
3150
  },
3098
- xls: function({ type: u, extension: e }) {
3099
- return MimeTypeUtils.INSTANCE.isExcelLike(u, e) ? !0 : u.indexOf("document") !== -1 && u.indexOf("spreadsheet") !== -1 || u.indexOf("ms-excel") !== -1;
3151
+ xls: function({ type: n, extension: e }) {
3152
+ return MimeTypeUtils.INSTANCE.isExcelLike(n, e) ? !0 : n.indexOf("document") !== -1 && n.indexOf("spreadsheet") !== -1 || n.indexOf("ms-excel") !== -1;
3100
3153
  },
3101
- img: function({ type: u }) {
3102
- return u.indexOf("image") !== -1;
3154
+ img: function({ type: n }) {
3155
+ return n.indexOf("image") !== -1;
3103
3156
  },
3104
- pdf: function({ type: u }) {
3105
- return u.indexOf("pdf") !== -1 || u === "application/x-download";
3157
+ pdf: function({ type: n }) {
3158
+ return n.indexOf("pdf") !== -1 || n === "application/x-download";
3106
3159
  },
3107
- ppt: function({ type: u, extension: e }) {
3108
- return MimeTypeUtils.INSTANCE.isPowerpointLike(u, e) ? !0 : u.indexOf("document") !== -1 && u.indexOf("presentation") !== -1 || u.indexOf("powerpoint") !== -1;
3160
+ ppt: function({ type: n, extension: e }) {
3161
+ return MimeTypeUtils.INSTANCE.isPowerpointLike(n, e) ? !0 : n.indexOf("document") !== -1 && n.indexOf("presentation") !== -1 || n.indexOf("powerpoint") !== -1;
3109
3162
  },
3110
- txt: function({ type: u, extension: e }) {
3111
- return MimeTypeUtils.INSTANCE.isTxtLike(u, e);
3163
+ txt: function({ type: n, extension: e }) {
3164
+ return MimeTypeUtils.INSTANCE.isTxtLike(n, e);
3112
3165
  },
3113
- md: function({ type: u, extension: e }) {
3114
- return MimeTypeUtils.INSTANCE.isMdLike(u, e);
3166
+ md: function({ type: n, extension: e }) {
3167
+ return MimeTypeUtils.INSTANCE.isMdLike(n, e);
3115
3168
  },
3116
- video: function({ type: u }) {
3117
- return u.indexOf("video") !== -1;
3169
+ video: function({ type: n }) {
3170
+ return n.indexOf("video") !== -1;
3118
3171
  },
3119
- audio: function({ type: u }) {
3120
- return u.indexOf("audio") !== -1;
3172
+ audio: function({ type: n }) {
3173
+ return n.indexOf("audio") !== -1;
3121
3174
  },
3122
- zip: function({ type: u }) {
3123
- return u.indexOf("zip") !== -1 || u.indexOf("rar") !== -1 || u.indexOf("tar") !== -1 || u.indexOf("7z") !== -1;
3175
+ zip: function({ type: n }) {
3176
+ return n.indexOf("zip") !== -1 || n.indexOf("rar") !== -1 || n.indexOf("tar") !== -1 || n.indexOf("7z") !== -1;
3124
3177
  }
3125
- }, D = class D {
3178
+ }, _ = class _ {
3126
3179
  /* Similar role notion as in infra-front > workspace > Model.ts */
3127
3180
  static getRole(e) {
3128
3181
  var t, s;
3129
- return D.role(
3182
+ return _.role(
3130
3183
  (t = e.metadata) == null ? void 0 : t["content-type"],
3131
3184
  !1,
3132
3185
  (s = e.metadata) == null ? void 0 : s.extension
@@ -3146,10 +3199,10 @@ const defaultMappers = {
3146
3199
  }
3147
3200
  };
3148
3201
  // FIXME add edumedia support
3149
- n(D, "roleMappers", [
3202
+ u(_, "roleMappers", [
3150
3203
  (e) => Object.keys(defaultMappers).find((s) => defaultMappers[s](e))
3151
3204
  ]);
3152
- let DocumentHelper = D;
3205
+ let DocumentHelper = _;
3153
3206
  class WorkspaceService {
3154
3207
  constructor(e) {
3155
3208
  this.context = e;
@@ -3315,8 +3368,8 @@ class WorkspaceService {
3315
3368
  }
3316
3369
  let ATTag;
3317
3370
  class AnalyticsService {
3318
- constructor(u) {
3319
- this.context = u;
3371
+ constructor(n) {
3372
+ this.context = n;
3320
3373
  }
3321
3374
  get http() {
3322
3375
  return this.context.http();
@@ -3329,7 +3382,7 @@ class AnalyticsService {
3329
3382
  * @param locationPath
3330
3383
  * @param app
3331
3384
  */
3332
- async trackPageLoad(u, e) {
3385
+ async trackPageLoad(n, e) {
3333
3386
  const [t] = await Promise.all([
3334
3387
  // get Xiti configuration
3335
3388
  this.getXitiConfig(e.name.toLowerCase()),
@@ -3339,7 +3392,7 @@ class AnalyticsService {
3339
3392
  if (!t || !ATInternet) return;
3340
3393
  let s = t.LIBELLE_SERVICE.default || null;
3341
3394
  for (const r in t.LIBELLE_SERVICE)
3342
- if (r !== "default" && u.indexOf(r) >= 0) {
3395
+ if (r !== "default" && n.indexOf(r) >= 0) {
3343
3396
  s = t.LIBELLE_SERVICE[r];
3344
3397
  break;
3345
3398
  }
@@ -3366,7 +3419,7 @@ class AnalyticsService {
3366
3419
  level2: t.STRUCT_UAI
3367
3420
  }), ATTag.dispatch();
3368
3421
  }
3369
- async getXitiConfig(u) {
3422
+ async getXitiConfig(n) {
3370
3423
  const [e, t] = await Promise.all([
3371
3424
  this.http.get("/analyticsConf"),
3372
3425
  //FIXME change servers config to only keep the "all-in-one" query to /analyticsConf.
@@ -3374,7 +3427,7 @@ class AnalyticsService {
3374
3427
  ]);
3375
3428
  if (!(e != null && e.type))
3376
3429
  throw ERROR_CODE.MALFORMED_DATA;
3377
- return t != null && t.active && (e.xiti = await this.getXitiTrackingParams(t, u)), e.xiti;
3430
+ return t != null && t.active && (e.xiti = await this.getXitiTrackingParams(t, n)), e.xiti;
3378
3431
  }
3379
3432
  async loadXitiScript() {
3380
3433
  if (typeof ATInternet > "u") {
@@ -3386,13 +3439,13 @@ class AnalyticsService {
3386
3439
  eval(response);
3387
3440
  }
3388
3441
  }
3389
- async getXitiTrackingParams(u, e) {
3390
- if (!u.structureMap || !e) return;
3442
+ async getXitiTrackingParams(n, e) {
3443
+ if (!n.structureMap || !e) return;
3391
3444
  const t = await this.session.getUser(), s = await this.session.getUserProfile();
3392
3445
  let r;
3393
3446
  if (!(t != null && t.structures)) return;
3394
3447
  for (const l of t.structures) {
3395
- const p = u.structureMap[l];
3448
+ const p = n.structureMap[l];
3396
3449
  if (p && p.collectiviteId && p.UAI) {
3397
3450
  r = p;
3398
3451
  break;
@@ -3423,15 +3476,15 @@ class AnalyticsService {
3423
3476
  OUTIL: o.OUTIL ? o.OUTIL : "",
3424
3477
  STRUCT_ID: r.collectiviteId,
3425
3478
  STRUCT_UAI: r.UAI,
3426
- PROJET: r.projetId ? r.projetId : u.ID_PROJET,
3427
- EXPLOITANT: u.ID_EXPLOITANT,
3428
- PLATFORME: r.plateformeId ? r.plateformeId : u.ID_PLATEFORME,
3479
+ PROJET: r.projetId ? r.projetId : n.ID_PROJET,
3480
+ EXPLOITANT: n.ID_EXPLOITANT,
3481
+ PLATFORME: r.plateformeId ? r.plateformeId : n.ID_PLATEFORME,
3429
3482
  ID_PERSO: a(t.userId),
3430
3483
  PROFILE: s && s.length > 0 ? c[s[0]] ?? "" : ""
3431
3484
  };
3432
3485
  }
3433
3486
  }
3434
- const C = class C {
3487
+ const R = class R {
3435
3488
  // in minutes. Applies to recorded videos.
3436
3489
  constructor(e) {
3437
3490
  this.context = e;
@@ -3452,8 +3505,8 @@ const C = class C {
3452
3505
  APP$4.VIDEO
3453
3506
  );
3454
3507
  return {
3455
- maxWeight: (e == null ? void 0 : e["max-videosize-mbytes"]) ?? C.MAX_WEIGHT,
3456
- maxDuration: (e == null ? void 0 : e["max-videoduration-minutes"]) ?? C.MAX_DURATION,
3508
+ maxWeight: (e == null ? void 0 : e["max-videosize-mbytes"]) ?? R.MAX_WEIGHT,
3509
+ maxDuration: (e == null ? void 0 : e["max-videoduration-minutes"]) ?? R.MAX_DURATION,
3457
3510
  acceptVideoUploadExtensions: ((t = e == null ? void 0 : e["accept-videoupload-extensions"]) == null ? void 0 : t.map(
3458
3511
  (s) => s.toUpperCase()
3459
3512
  )) ?? []
@@ -3510,9 +3563,9 @@ const C = class C {
3510
3563
  throw new Error("Video cannot be uploaded.");
3511
3564
  }
3512
3565
  };
3513
- n(C, "MAX_WEIGHT", 50), // in Mbytes. Applies to uploaded videos.
3514
- n(C, "MAX_DURATION", 3);
3515
- let VideoService = C;
3566
+ u(R, "MAX_WEIGHT", 50), // in Mbytes. Applies to uploaded videos.
3567
+ u(R, "MAX_DURATION", 3);
3568
+ let VideoService = R;
3516
3569
  class EmbedderService {
3517
3570
  constructor(e) {
3518
3571
  this.context = e;
@@ -3607,7 +3660,7 @@ class AbstractBehaviourService {
3607
3660
  //-----------------
3608
3661
  //--- Utilities ---
3609
3662
  //-----------------
3610
- n(this, "_cache");
3663
+ u(this, "_cache");
3611
3664
  this.context = e, this._cache = new CacheService(this.context);
3612
3665
  }
3613
3666
  getApplication() {
@@ -3641,8 +3694,8 @@ class AbstractBehaviourService {
3641
3694
  class ActualitesBehaviour extends AbstractBehaviourService {
3642
3695
  constructor() {
3643
3696
  super(...arguments);
3644
- n(this, "APP", "actualites");
3645
- n(this, "RESOURCE", "actualites");
3697
+ u(this, "APP", "actualites");
3698
+ u(this, "RESOURCE", "actualites");
3646
3699
  }
3647
3700
  async loadResources() {
3648
3701
  return (await this.httpGet(
@@ -3665,8 +3718,8 @@ class ActualitesBehaviour extends AbstractBehaviourService {
3665
3718
  class BlogBehaviour extends AbstractBehaviourService {
3666
3719
  constructor() {
3667
3720
  super(...arguments);
3668
- n(this, "APP", "blog");
3669
- n(this, "RESOURCE", "blog");
3721
+ u(this, "APP", "blog");
3722
+ u(this, "RESOURCE", "blog");
3670
3723
  }
3671
3724
  loadResources() {
3672
3725
  return new Promise(async (t, s) => {
@@ -3695,8 +3748,8 @@ class BlogBehaviour extends AbstractBehaviourService {
3695
3748
  class CollaborativewallBehaviour extends AbstractBehaviourService {
3696
3749
  constructor() {
3697
3750
  super(...arguments);
3698
- n(this, "APP", "collaborativewall");
3699
- n(this, "RESOURCE", "collaborativewall");
3751
+ u(this, "APP", "collaborativewall");
3752
+ u(this, "RESOURCE", "collaborativewall");
3700
3753
  }
3701
3754
  async loadResources() {
3702
3755
  return (await this.httpGet(
@@ -3718,8 +3771,8 @@ class CollaborativewallBehaviour extends AbstractBehaviourService {
3718
3771
  class CommunityBehaviour extends AbstractBehaviourService {
3719
3772
  constructor() {
3720
3773
  super(...arguments);
3721
- n(this, "APP", "community");
3722
- n(this, "RESOURCE", "community");
3774
+ u(this, "APP", "community");
3775
+ u(this, "RESOURCE", "community");
3723
3776
  }
3724
3777
  async loadResources() {
3725
3778
  return (await this.httpGet(
@@ -3743,8 +3796,8 @@ class CommunityBehaviour extends AbstractBehaviourService {
3743
3796
  class ExercizerBehaviour extends AbstractBehaviourService {
3744
3797
  constructor() {
3745
3798
  super(...arguments);
3746
- n(this, "APP", "exercizer");
3747
- n(this, "RESOURCE", "exercizer");
3799
+ u(this, "APP", "exercizer");
3800
+ u(this, "RESOURCE", "exercizer");
3748
3801
  }
3749
3802
  async loadResources() {
3750
3803
  return (await this.httpGet(
@@ -3769,8 +3822,8 @@ class ExercizerBehaviour extends AbstractBehaviourService {
3769
3822
  class FormulaireBehaviour extends AbstractBehaviourService {
3770
3823
  constructor() {
3771
3824
  super(...arguments);
3772
- n(this, "APP", "formulaire");
3773
- n(this, "RESOURCE", "formulaire");
3825
+ u(this, "APP", "formulaire");
3826
+ u(this, "RESOURCE", "formulaire");
3774
3827
  }
3775
3828
  async loadResources() {
3776
3829
  return (await this.httpGet(
@@ -3790,8 +3843,8 @@ class FormulaireBehaviour extends AbstractBehaviourService {
3790
3843
  class ForumBehaviour extends AbstractBehaviourService {
3791
3844
  constructor() {
3792
3845
  super(...arguments);
3793
- n(this, "APP", "forum");
3794
- n(this, "RESOURCE", "forum");
3846
+ u(this, "APP", "forum");
3847
+ u(this, "RESOURCE", "forum");
3795
3848
  }
3796
3849
  async loadResources() {
3797
3850
  return (await this.httpGet("/forum/categories")).map(
@@ -3811,8 +3864,8 @@ class ForumBehaviour extends AbstractBehaviourService {
3811
3864
  class HomeworksBehaviour extends AbstractBehaviourService {
3812
3865
  constructor() {
3813
3866
  super(...arguments);
3814
- n(this, "APP", "homeworks");
3815
- n(this, "RESOURCE", "homeworks");
3867
+ u(this, "APP", "homeworks");
3868
+ u(this, "RESOURCE", "homeworks");
3816
3869
  }
3817
3870
  async loadResources() {
3818
3871
  return (await this.httpGet("/homeworks/list")).filter((t) => t.owner && t.trashed === 0).map((t) => this.dataToResource({
@@ -3830,8 +3883,8 @@ class HomeworksBehaviour extends AbstractBehaviourService {
3830
3883
  class MagnetoBehaviour extends AbstractBehaviourService {
3831
3884
  constructor() {
3832
3885
  super(...arguments);
3833
- n(this, "APP", "magneto");
3834
- n(this, "RESOURCE", "magneto");
3886
+ u(this, "APP", "magneto");
3887
+ u(this, "RESOURCE", "magneto");
3835
3888
  }
3836
3889
  async loadResources() {
3837
3890
  const { all: t } = await this.httpGet(
@@ -3852,8 +3905,8 @@ class MagnetoBehaviour extends AbstractBehaviourService {
3852
3905
  class MindmapBehaviour extends AbstractBehaviourService {
3853
3906
  constructor() {
3854
3907
  super(...arguments);
3855
- n(this, "APP", "mindmap");
3856
- n(this, "RESOURCE", "mindmap");
3908
+ u(this, "APP", "mindmap");
3909
+ u(this, "RESOURCE", "mindmap");
3857
3910
  }
3858
3911
  async loadResources() {
3859
3912
  return (await this.httpGet("/mindmap/list/all")).map(
@@ -3873,8 +3926,8 @@ class MindmapBehaviour extends AbstractBehaviourService {
3873
3926
  class PagesBehaviour extends AbstractBehaviourService {
3874
3927
  constructor() {
3875
3928
  super(...arguments);
3876
- n(this, "APP", "pages");
3877
- n(this, "RESOURCE", "pages");
3929
+ u(this, "APP", "pages");
3930
+ u(this, "RESOURCE", "pages");
3878
3931
  }
3879
3932
  async loadResources() {
3880
3933
  const t = await this.httpGet("/pages/list/all"), s = [];
@@ -3912,8 +3965,8 @@ class PagesBehaviour extends AbstractBehaviourService {
3912
3965
  class PollBehaviour extends AbstractBehaviourService {
3913
3966
  constructor() {
3914
3967
  super(...arguments);
3915
- n(this, "APP", "poll");
3916
- n(this, "RESOURCE", "poll");
3968
+ u(this, "APP", "poll");
3969
+ u(this, "RESOURCE", "poll");
3917
3970
  }
3918
3971
  async loadResources() {
3919
3972
  return (await this.httpGet("/poll/list/all")).map((s) => {
@@ -3934,8 +3987,8 @@ class PollBehaviour extends AbstractBehaviourService {
3934
3987
  class ScrapbookBehaviour extends AbstractBehaviourService {
3935
3988
  constructor() {
3936
3989
  super(...arguments);
3937
- n(this, "APP", "scrapbook");
3938
- n(this, "RESOURCE", "scrapbook");
3990
+ u(this, "APP", "scrapbook");
3991
+ u(this, "RESOURCE", "scrapbook");
3939
3992
  }
3940
3993
  async loadResources() {
3941
3994
  return (await this.httpGet(
@@ -3958,8 +4011,8 @@ class ScrapbookBehaviour extends AbstractBehaviourService {
3958
4011
  class TimelinegeneratorBehaviour extends AbstractBehaviourService {
3959
4012
  constructor() {
3960
4013
  super(...arguments);
3961
- n(this, "APP", "timelinegenerator");
3962
- n(this, "RESOURCE", "timelinegenerator");
4014
+ u(this, "APP", "timelinegenerator");
4015
+ u(this, "RESOURCE", "timelinegenerator");
3963
4016
  }
3964
4017
  loadResources() {
3965
4018
  return new Promise(async (t, s) => {
@@ -3989,8 +4042,8 @@ class TimelinegeneratorBehaviour extends AbstractBehaviourService {
3989
4042
  class WikiBehaviour extends AbstractBehaviourService {
3990
4043
  constructor() {
3991
4044
  super(...arguments);
3992
- n(this, "APP", "wiki");
3993
- n(this, "RESOURCE", "wiki");
4045
+ u(this, "APP", "wiki");
4046
+ u(this, "RESOURCE", "wiki");
3994
4047
  }
3995
4048
  async loadResources() {
3996
4049
  return (await this.httpGet(
@@ -4013,8 +4066,8 @@ class WikiBehaviour extends AbstractBehaviourService {
4013
4066
  class WorkspaceBehaviour extends AbstractBehaviourService {
4014
4067
  constructor() {
4015
4068
  super(...arguments);
4016
- n(this, "APP", "workspace");
4017
- n(this, "RESOURCE", "workspace");
4069
+ u(this, "APP", "workspace");
4070
+ u(this, "RESOURCE", "workspace");
4018
4071
  }
4019
4072
  loadResources({ search: t, asset_id: s }) {
4020
4073
  return new Promise(async (r, i) => {
@@ -4132,13 +4185,13 @@ const b = class b {
4132
4185
  //
4133
4186
  // STATIC REGISTRY
4134
4187
  //
4135
- n(b, "registry", new ServiceRegistry()), // Expose some useful functions
4136
- n(b, "findBehaviour", b.registry.findService.bind(b.registry)), n(b, "hasBehaviour", b.registry.isRegistered.bind(b.registry)), n(b, "resourceProducingApps", []);
4188
+ u(b, "registry", new ServiceRegistry()), // Expose some useful functions
4189
+ u(b, "findBehaviour", b.registry.findService.bind(b.registry)), u(b, "hasBehaviour", b.registry.isRegistered.bind(b.registry)), u(b, "resourceProducingApps", []);
4137
4190
  let SnipletsService = b;
4138
4191
  const SEND_ALL = "*";
4139
4192
  class WebBroker {
4140
4193
  constructor(e) {
4141
- n(this, "subscription");
4194
+ u(this, "subscription");
4142
4195
  this.odeServices = e;
4143
4196
  }
4144
4197
  get http() {
@@ -4170,10 +4223,10 @@ class WebBroker {
4170
4223
  }
4171
4224
  class DataService {
4172
4225
  constructor(e) {
4173
- n(this, "_webBroker");
4174
- n(this, "app");
4175
- n(this, "user");
4176
- n(this, "profile");
4226
+ u(this, "_webBroker");
4227
+ u(this, "app");
4228
+ u(this, "user");
4229
+ u(this, "profile");
4177
4230
  this.odeServices = e;
4178
4231
  }
4179
4232
  get conf() {
@@ -4335,20 +4388,20 @@ class AudienceService {
4335
4388
  }
4336
4389
  class OdeServices {
4337
4390
  constructor() {
4338
- n(this, "_analytics");
4339
- n(this, "_cache");
4340
- n(this, "_conf");
4341
- n(this, "_data");
4342
- n(this, "_directory");
4343
- n(this, "_http");
4344
- n(this, "_idiom");
4345
- n(this, "_notify");
4346
- n(this, "_rights");
4347
- n(this, "_session");
4348
- n(this, "_share");
4349
- n(this, "_video");
4350
- n(this, "_workspace");
4351
- n(this, "_embedder");
4391
+ u(this, "_analytics");
4392
+ u(this, "_cache");
4393
+ u(this, "_conf");
4394
+ u(this, "_data");
4395
+ u(this, "_directory");
4396
+ u(this, "_http");
4397
+ u(this, "_idiom");
4398
+ u(this, "_notify");
4399
+ u(this, "_rights");
4400
+ u(this, "_session");
4401
+ u(this, "_share");
4402
+ u(this, "_video");
4403
+ u(this, "_workspace");
4404
+ u(this, "_embedder");
4352
4405
  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);
4353
4406
  }
4354
4407
  initialize() {
@@ -4481,9 +4534,9 @@ class TransportFrameworkFactory {
4481
4534
  return transport;
4482
4535
  }
4483
4536
  }
4484
- const isActionAvailable = (u, e) => {
4537
+ const isActionAvailable = (n, e) => {
4485
4538
  const t = e == null ? void 0 : e.filter(
4486
- (s) => s.id === u && s.available
4539
+ (s) => s.id === n && s.available
4487
4540
  );
4488
4541
  return t && t.length > 0;
4489
4542
  }, firstLevelWidgets = [
@@ -4550,10 +4603,10 @@ const isActionAvailable = (u, e) => {
4550
4603
  class WidgetFramework {
4551
4604
  constructor() {
4552
4605
  //-------------------------------------
4553
- n(this, "_initialized");
4554
- n(this, "_widgets", []);
4606
+ u(this, "_initialized");
4607
+ u(this, "_widgets", []);
4555
4608
  ////////////////////////////////////// USER PREFERENCES
4556
- n(this, "_userPrefs", {});
4609
+ u(this, "_userPrefs", {});
4557
4610
  }
4558
4611
  initialize(e, t) {
4559
4612
  return this._initialized || (this._initialized = new Promisified(), notify.onSessionReady().promise.then((s) => {
@@ -4617,8 +4670,8 @@ class WidgetFramework {
4617
4670
  class Widget {
4618
4671
  //-------------------------------------
4619
4672
  constructor(e) {
4620
- n(this, "_schoolConf", {});
4621
- n(this, "_userPref");
4673
+ u(this, "_schoolConf", {});
4674
+ u(this, "_userPref");
4622
4675
  this._platformConf = e, this._userPref = null;
4623
4676
  }
4624
4677
  get platformConf() {