@edifice.io/client 2.5.5 → 2.5.6-develop.20260116103750

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
@@ -97,7 +97,7 @@ const ERROR_CODE = {
97
97
  INFOTIP: "infotip",
98
98
  RGPD_COOKIES: "rgpdCookies"
99
99
  // TODO compléter
100
- }, b = class b {
100
+ }, R = class R {
101
101
  constructor(e) {
102
102
  n(this, "name");
103
103
  n(this, "listeners", /* @__PURE__ */ new Set());
@@ -109,8 +109,8 @@ const ERROR_CODE = {
109
109
  * @returns the channel instance
110
110
  */
111
111
  static getChannel(e) {
112
- let t = b.channels.get(e);
113
- return t || (t = new b(e), b.channels.set(e, t)), t;
112
+ let t = R.channels.get(e);
113
+ return t || (t = new R(e), R.channels.set(e, t)), t;
114
114
  }
115
115
  /**
116
116
  * Add a listener and return a revocation function to remove it.
@@ -135,11 +135,11 @@ const ERROR_CODE = {
135
135
  * Close this channel: remove listeners and unregister from global map.
136
136
  */
137
137
  close() {
138
- this.listeners.clear(), b.channels.delete(this.name);
138
+ this.listeners.clear(), R.channels.delete(this.name);
139
139
  }
140
140
  };
141
- n(b, "channels", /* @__PURE__ */ new Map());
142
- let SimpleChannel = b;
141
+ n(R, "channels", /* @__PURE__ */ new Map());
142
+ let SimpleChannel = R;
143
143
  class Subscription {
144
144
  constructor(e, t) {
145
145
  n(this, "revoke");
@@ -970,10 +970,10 @@ class User {
970
970
  let r = !0;
971
971
  const i = [];
972
972
  s.bookmarks.forEach((o, a) => {
973
- const c = this._me.apps.find((h) => h.name === o);
973
+ const c = this._me.apps.find((l) => l.name === o);
974
974
  if (c) {
975
- const h = Object.assign({}, c);
976
- this._bookmarkedApps.push(h);
975
+ const l = Object.assign({}, c);
976
+ this._bookmarkedApps.push(l);
977
977
  } else
978
978
  i.push(o), r = !1;
979
979
  }), i.forEach((o) => {
@@ -1080,10 +1080,10 @@ class Analytics {
1080
1080
  if (!e.structureMap || !configure.Platform.apps.currentApp) return;
1081
1081
  const t = await notify.onSessionReady().promise, s = session.session.description;
1082
1082
  let r;
1083
- for (const h of t.structures) {
1084
- const l = e.structureMap[h];
1085
- if (l && l.collectiviteId && l.UAI) {
1086
- r = l;
1083
+ for (const l of t.structures) {
1084
+ const p = e.structureMap[l];
1085
+ if (p && p.collectiviteId && p.UAI) {
1086
+ r = p;
1087
1087
  break;
1088
1088
  }
1089
1089
  }
@@ -1094,11 +1094,11 @@ class Analytics {
1094
1094
  if (!i) return;
1095
1095
  const o = i.xiti;
1096
1096
  if (!o || !o.LIBELLE_SERVICE || !r.UAI) return;
1097
- function a(h) {
1098
- let l = "";
1099
- for (let E = 0; E < h.length; E++)
1100
- l += h.charCodeAt(E);
1101
- return l;
1097
+ function a(l) {
1098
+ let p = "";
1099
+ for (let E = 0; E < l.length; E++)
1100
+ p += l.charCodeAt(E);
1101
+ return p;
1102
1102
  }
1103
1103
  const c = {
1104
1104
  Student: "ELEVE",
@@ -1141,7 +1141,7 @@ class ConfigurationFramework {
1141
1141
  }
1142
1142
  async initialize(e, t) {
1143
1143
  if (!e) {
1144
- const r = (h) => (h < 10 ? "0" : "") + h.toFixed(0), i = /* @__PURE__ */ new Date(), o = i.getFullYear(), a = i.getMonth() + 1, c = i.getDate();
1144
+ const r = (l) => (l < 10 ? "0" : "") + l.toFixed(0), i = /* @__PURE__ */ new Date(), o = i.getFullYear(), a = i.getMonth() + 1, c = i.getDate();
1145
1145
  e = `${o}${r(a)}${r(c)}`;
1146
1146
  }
1147
1147
  const s = e;
@@ -1180,8 +1180,8 @@ class ConfigurationFramework {
1180
1180
  // }
1181
1181
  }
1182
1182
  const configure = new ConfigurationFramework(), http = transport == null ? void 0 : transport.http;
1183
- var D;
1184
- const me = (D = session == null ? void 0 : session.session) == null ? void 0 : D.user;
1183
+ var v;
1184
+ const me = (v = session == null ? void 0 : session.session) == null ? void 0 : v.user;
1185
1185
  class Notification {
1186
1186
  constructor(e) {
1187
1187
  n(this, "_id");
@@ -1906,17 +1906,17 @@ class ConfService {
1906
1906
  }) {
1907
1907
  var E;
1908
1908
  const r = await this.http.get("/theme"), i = (E = t == null ? void 0 : t.overriding) == null ? void 0 : E.find(
1909
- (p) => (
1909
+ (h) => (
1910
1910
  // Fix #WB2-2660:
1911
1911
  // If Public access => get the neo theme
1912
1912
  // Else get the theme from the user preference
1913
- s ? p.parent === "theme-open-ent" && p.bootstrapVersion === "ode-bootstrap-neo" : p.child === (r == null ? void 0 : r.themeName)
1913
+ s ? h.parent === "theme-open-ent" && h.bootstrapVersion === "ode-bootstrap-neo" : h.child === (r == null ? void 0 : r.themeName)
1914
1914
  )
1915
- ), o = s ? "default" : (r == null ? void 0 : r.skinName) || (i == null ? void 0 : i.skins[0]), a = (r == null ? void 0 : r.skin) || `/assets/themes/${i == null ? void 0 : i.child}/skins/${o}/`, c = i == null ? void 0 : i.skins, h = i == null ? void 0 : i.bootstrapVersion.split("-").slice(-1)[0], l = (i == null ? void 0 : i.parent) === "panda";
1915
+ ), o = s ? "default" : (r == null ? void 0 : r.skinName) || (i == null ? void 0 : i.skins[0]), a = (r == null ? void 0 : r.skin) || `/assets/themes/${i == null ? void 0 : i.child}/skins/${o}/`, c = i == null ? void 0 : i.skins, l = i == null ? void 0 : i.bootstrapVersion.split("-").slice(-1)[0], p = (i == null ? void 0 : i.parent) === "panda";
1916
1916
  return {
1917
1917
  basePath: `${this.cdnDomain}${a}../../`,
1918
- bootstrapVersion: h,
1919
- is1d: l,
1918
+ bootstrapVersion: l,
1919
+ is1d: p,
1920
1920
  logoutCallback: (r == null ? void 0 : r.logoutCallback) || "",
1921
1921
  skin: i == null ? void 0 : i.child,
1922
1922
  skinName: o,
@@ -1969,13 +1969,13 @@ class DirectoryService {
1969
1969
  id: s,
1970
1970
  displayName: r,
1971
1971
  notVisibleCount: o,
1972
- groups: t.map(({ name: a, id: c, nbUsers: h }) => ({
1973
- nbUsers: h,
1972
+ groups: t.map(({ name: a, id: c, nbUsers: l }) => ({
1973
+ nbUsers: l,
1974
1974
  displayName: a,
1975
1975
  id: c
1976
1976
  })),
1977
- users: i.map(({ displayName: a, id: c, profile: h }) => ({
1978
- profile: h,
1977
+ users: i.map(({ displayName: a, id: c, profile: l }) => ({
1978
+ profile: l,
1979
1979
  displayName: a,
1980
1980
  // these info are missing from api
1981
1981
  firstName: "",
@@ -1991,27 +1991,27 @@ class DirectoryService {
1991
1991
  users: r
1992
1992
  }) {
1993
1993
  this.cache.clearCache("/directory/sharebookmark/all");
1994
- 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) => {
1995
- if (typeof p == "string") {
1996
- const { displayName: d, groups: g, id: A, users: f } = await this.getBookMarkById(p), y = f.map((_) => _.id), F = g.map((_) => _.id);
1994
+ 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
+ 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);
1997
1997
  return {
1998
- displayName: d,
1999
- id: A,
2000
- members: [...F, ...y]
1998
+ displayName: y,
1999
+ id: g,
2000
+ members: [...w, ...f]
2001
2001
  };
2002
2002
  } else
2003
- return Promise.resolve(p);
2004
- }), h = (await Promise.all(a)).map((p) => p.members).reduce((p, d) => [...p, ...d], []), l = {
2003
+ return Promise.resolve(h);
2004
+ }), l = (await Promise.all(a)).map((h) => h.members).reduce((h, y) => [...h, ...y], []), p = {
2005
2005
  name: e,
2006
- members: [...i, ...o, ...h]
2006
+ members: [...i, ...o, ...l]
2007
2007
  }, { id: E } = await this.http.postJson(
2008
2008
  "/directory/sharebookmark",
2009
- l
2009
+ p
2010
2010
  );
2011
2011
  return {
2012
2012
  id: E,
2013
2013
  displayName: e,
2014
- members: l.members
2014
+ members: p.members
2015
2015
  };
2016
2016
  }
2017
2017
  }
@@ -2296,7 +2296,7 @@ class RightService {
2296
2296
  return e.map((s) => this.parseResourceRight(s)).filter((s) => s !== void 0);
2297
2297
  }
2298
2298
  /**
2299
- * Check wether a user has the expected right for a ressource
2299
+ * Check wether a user has the expected right for a resource
2300
2300
  * @param user the userId and groupId concerned by the check
2301
2301
  * @param expect the expected right to check
2302
2302
  * @param rights array of Right for the resource
@@ -2556,18 +2556,18 @@ class SessionService {
2556
2556
  const i = [];
2557
2557
  return r.bookmarks.forEach((o, a) => {
2558
2558
  const c = ((e == null ? void 0 : e.apps) || []).find(
2559
- (h) => h.name === o
2559
+ (l) => l.name === o
2560
2560
  );
2561
2561
  if (c) {
2562
- const h = Object.assign({}, c);
2563
- i.push(h);
2562
+ const l = Object.assign({}, c);
2563
+ i.push(l);
2564
2564
  }
2565
2565
  }), i;
2566
2566
  }
2567
2567
  async getUserProfile(e = {}) {
2568
- var c, h;
2568
+ var c, l;
2569
2569
  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);
2570
- 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"];
2570
+ return o.status < 200 || o.status >= 300 || typeof a == "string" ? ["Guest"] : ((l = (c = a == null ? void 0 : a.result) == null ? void 0 : c[0]) == null ? void 0 : l.type) || ["Guest"];
2571
2571
  }
2572
2572
  async isAdml() {
2573
2573
  const e = await this.getUser();
@@ -2893,73 +2893,94 @@ class ShareService {
2893
2893
  get cache() {
2894
2894
  return this.context.cache();
2895
2895
  }
2896
- async searchShareSubjects(e, t, s) {
2897
- const r = StringUtils.removeAccents(s).toLowerCase(), i = await this.cache.httpGetJson(
2898
- `/${e}/share/json/${t}?search=${s}`
2899
- ), o = i.users.visibles.filter(({ username: l, firstName: E, lastName: p, login: d }) => {
2900
- const g = StringUtils.removeAccents(
2901
- p || ""
2902
- ).toLowerCase(), A = StringUtils.removeAccents(
2903
- E || ""
2896
+ getSearchUrl(e, t, s, r) {
2897
+ if (!r)
2898
+ return `/${e}/share/json/${t}?search=${s}`;
2899
+ if (r.includes("?search=")) {
2900
+ const [i] = r.split("?search=");
2901
+ return `${i}?search=${s}`;
2902
+ } else return r.includes("?") ? `${r}&search=${s}` : `${r}?search=${s}`;
2903
+ }
2904
+ async searchShareSubjects(e, t, s, r) {
2905
+ const i = StringUtils.removeAccents(s).toLowerCase(), o = this.getSearchUrl(
2906
+ e,
2907
+ t,
2908
+ s,
2909
+ r
2910
+ ), a = await this.cache.httpGetJson(o), c = a.users.visibles.filter(({ username: h, firstName: y, lastName: d, login: g }) => {
2911
+ const A = StringUtils.removeAccents(
2912
+ d || ""
2904
2913
  ).toLowerCase(), f = StringUtils.removeAccents(
2905
- l || ""
2906
- ).toLowerCase(), y = StringUtils.removeAccents(d || "").toLowerCase();
2907
- return f.includes(r) || A.includes(r) || g.includes(r) || y.includes(r);
2908
- }).map((l) => ({
2909
- avatarUrl: this.directory.getAvatarUrl(l.id, "user"),
2910
- directoryUrl: this.directory.getDirectoryUrl(l.id, "user"),
2911
- displayName: l.username,
2912
- id: l.id,
2913
- profile: l.profile,
2914
+ y || ""
2915
+ ).toLowerCase(), w = StringUtils.removeAccents(
2916
+ h || ""
2917
+ ).toLowerCase(), F = StringUtils.removeAccents(g || "").toLowerCase();
2918
+ return w.includes(i) || f.includes(i) || A.includes(i) || F.includes(i);
2919
+ }).map((h) => ({
2920
+ avatarUrl: this.directory.getAvatarUrl(h.id, "user"),
2921
+ directoryUrl: this.directory.getDirectoryUrl(h.id, "user"),
2922
+ displayName: h.username,
2923
+ id: h.id,
2924
+ profile: h.profile,
2914
2925
  type: "user"
2915
- })), a = i.groups.visibles.filter(({ name: l }) => StringUtils.removeAccents(l || "").toLowerCase().includes(r)).map((l) => ({
2916
- avatarUrl: this.directory.getAvatarUrl(l.id, "group"),
2917
- directoryUrl: this.directory.getDirectoryUrl(l.id, "group"),
2918
- displayName: l.name,
2919
- id: l.id,
2926
+ })), l = a.groups.visibles.filter(({ name: h }) => StringUtils.removeAccents(h || "").toLowerCase().includes(i)).map((h) => ({
2927
+ avatarUrl: this.directory.getAvatarUrl(h.id, "group"),
2928
+ directoryUrl: this.directory.getDirectoryUrl(h.id, "group"),
2929
+ displayName: h.name,
2930
+ id: h.id,
2920
2931
  type: "group",
2921
- structureName: l.structureName
2932
+ structureName: h.structureName
2922
2933
  }));
2923
- return [...(await this.directory.getBookMarks()).filter(({ displayName: l }) => StringUtils.removeAccents(
2924
- l || ""
2925
- ).toLowerCase().includes(r)).map((l) => ({
2934
+ return [...(await this.directory.getBookMarks()).filter(({ displayName: h }) => StringUtils.removeAccents(
2935
+ h || ""
2936
+ ).toLowerCase().includes(i)).map((h) => ({
2926
2937
  avatarUrl: "",
2927
2938
  directoryUrl: "",
2928
2939
  profile: "",
2929
- displayName: l.displayName,
2930
- id: l.id,
2940
+ displayName: h.displayName,
2941
+ id: h.id,
2931
2942
  type: "sharebookmark"
2932
- })), ...o, ...a];
2943
+ })), ...c, ...l];
2933
2944
  }
2934
- async getShareMapping(e) {
2935
- const t = await this.cache.httpGetJson(
2936
- `/${e}/rights/sharing`
2945
+ async getShareMapping(e, t) {
2946
+ const s = await this.cache.httpGetJson(
2947
+ t || `/${e}/rights/sharing`
2937
2948
  );
2938
- for (const s of Object.keys(t))
2939
- if (s.includes(".")) {
2940
- const r = s.split(".")[1], i = t[s];
2941
- delete t[s], t[r] = i;
2949
+ for (const r of Object.keys(s))
2950
+ if (r.includes(".")) {
2951
+ const i = r.split(".")[1], o = s[r];
2952
+ delete s[r], s[i] = o;
2942
2953
  }
2943
- return t;
2954
+ return s;
2944
2955
  }
2945
2956
  getActionsAvailableFor({ id: e, type: t }, s, r) {
2946
2957
  const o = (t === "user" ? s.users.checked[e] : s.groups.checked[e]) || [], a = Object.keys(r), c = [];
2947
- for (const h of a)
2948
- r[h].filter(
2949
- (p) => o.includes(p)
2950
- ).length > 0 && c.push(h);
2958
+ for (const l of a)
2959
+ r[l].filter(
2960
+ (h) => o.includes(h)
2961
+ ).length > 0 && c.push(l);
2951
2962
  return c;
2952
2963
  }
2953
- async getRightsForResource(e, t) {
2954
- 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(
2964
+ async getRightsForResource(e, t, s) {
2965
+ const r = await this.directory.getBookMarks(), i = this.getSearchUrl(
2966
+ e,
2967
+ t,
2968
+ "",
2969
+ s == null ? void 0 : s.getResourceRights
2970
+ ), o = await this.cache.httpGetJson(
2971
+ i
2972
+ ), a = await this.getShareMapping(
2973
+ e,
2974
+ s == null ? void 0 : s.getShareMapping
2975
+ ), c = await this.cache.httpGetJson(
2955
2976
  "/infra/public/json/sharing-rights.json"
2956
- ), c = Object.keys(i.users.checked).map((d) => i.users.visibles.find(
2977
+ ), l = Object.keys(o.users.checked).map((d) => o.users.visibles.find(
2957
2978
  (A) => A.id === d
2958
2979
  )).filter((d) => d !== void 0).map((d) => {
2959
2980
  const g = this.getActionsAvailableFor(
2960
2981
  { id: d.id, type: "user" },
2961
- i,
2962
- o
2982
+ o,
2983
+ a
2963
2984
  );
2964
2985
  return {
2965
2986
  id: d.id,
@@ -2969,21 +2990,21 @@ class ShareService {
2969
2990
  avatarUrl: this.directory.getAvatarUrl(d.id, "user"),
2970
2991
  directoryUrl: this.directory.getDirectoryUrl(d.id, "user"),
2971
2992
  actions: g.map((f) => {
2972
- const y = a[f];
2993
+ const w = c[f];
2973
2994
  return {
2974
2995
  displayName: f,
2975
2996
  id: f,
2976
- priority: y.priority
2997
+ priority: w.priority
2977
2998
  };
2978
2999
  })
2979
3000
  };
2980
- }).sort((d, g) => (d.displayName || "").localeCompare(g.displayName)), h = Object.keys(i.groups.checked).map((d) => i.groups.visibles.find(
3001
+ }).sort((d, g) => (d.displayName || "").localeCompare(g.displayName)), p = Object.keys(o.groups.checked).map((d) => o.groups.visibles.find(
2981
3002
  (A) => A.id === d
2982
3003
  )).filter((d) => d !== void 0).map((d) => {
2983
3004
  const g = this.getActionsAvailableFor(
2984
3005
  { id: d.id, type: "group" },
2985
- i,
2986
- o
3006
+ o,
3007
+ a
2987
3008
  );
2988
3009
  return {
2989
3010
  id: d.id,
@@ -2993,66 +3014,78 @@ class ShareService {
2993
3014
  avatarUrl: this.directory.getAvatarUrl(d.id, "group"),
2994
3015
  directoryUrl: this.directory.getDirectoryUrl(d.id, "group"),
2995
3016
  actions: g.map((f) => {
2996
- const y = a[f];
3017
+ const w = c[f];
2997
3018
  return {
2998
3019
  displayName: f,
2999
3020
  id: f,
3000
- priority: y.priority
3021
+ priority: w.priority
3001
3022
  };
3002
3023
  })
3003
3024
  };
3004
- }).sort((d, g) => (d.displayName || "").localeCompare(g.displayName)), l = [...c, ...h], E = i.groups.visibles.map(
3025
+ }).sort((d, g) => (d.displayName || "").localeCompare(g.displayName)), E = [...l, ...p], h = o.groups.visibles.map(
3005
3026
  ({ groupDisplayName: d, id: g, name: A, labels: f }) => ({
3006
3027
  labels: f,
3007
3028
  displayName: d || A,
3008
3029
  id: g
3009
3030
  })
3010
- ), p = i.users.visibles.map(
3011
- ({ id: d, profile: g, username: A, firstName: f, lastName: y, login: F }) => ({
3031
+ ), y = o.users.visibles.map(
3032
+ ({ id: d, profile: g, username: A, firstName: f, lastName: w, login: F }) => ({
3012
3033
  displayName: A,
3013
3034
  firstName: f,
3014
- lastName: y,
3035
+ lastName: w,
3015
3036
  login: F,
3016
3037
  profile: g,
3017
3038
  id: d
3018
3039
  })
3019
3040
  );
3020
3041
  return {
3021
- rights: l,
3022
- visibleBookmarks: s,
3023
- visibleGroups: E,
3024
- visibleUsers: p
3042
+ rights: E,
3043
+ visibleBookmarks: r,
3044
+ visibleGroups: h,
3045
+ visibleUsers: y
3025
3046
  };
3026
3047
  }
3027
- async saveRights(e, t, s) {
3028
- const r = await this.getShareMapping(e), i = {
3029
- bookmarks: {},
3048
+ async getPutSharePayload(e, t, s) {
3049
+ const r = {
3050
+ users: {},
3030
3051
  groups: {},
3031
- users: {}
3032
- };
3033
- for (const c of s) {
3034
- const h = c.actions.map((E) => r[E.id]).reduce((E, p) => Array.isArray(p) ? [...E, ...p] : E, []), l = [...new Set(h)];
3035
- l.length > 0 && (c.type === "user" ? i.users[c.id] = l : c.type === "group" ? i.groups[c.id] = l : i.bookmarks[c.id] = l);
3052
+ bookmarks: {}
3053
+ }, i = await this.getShareMapping(e, s);
3054
+ for (const o of t) {
3055
+ const a = o.actions.map((l) => i[l.id]).reduce((l, p) => Array.isArray(p) ? [...l, ...p] : l, []), c = [...new Set(a)];
3056
+ c.length > 0 && (o.type === "user" ? r.users[o.id] = c : o.type === "group" ? r.groups[o.id] = c : r.bookmarks[o.id] = c);
3036
3057
  }
3037
- const o = `/${e}/share/resource/${t}`;
3038
- return this.cache.clearCache(`/${e}/share/json/${t}?search=`), await this.http.putJson(o, i);
3058
+ return r;
3059
+ }
3060
+ async saveRights(e, t, s, r) {
3061
+ const i = await this.getPutSharePayload(
3062
+ e,
3063
+ s,
3064
+ r == null ? void 0 : r.getShareMapping
3065
+ ), o = (r == null ? void 0 : r.saveResourceRights) || `/${e}/share/resource/${t}`, a = this.getSearchUrl(
3066
+ e,
3067
+ t,
3068
+ "",
3069
+ r == null ? void 0 : r.getResourceRights
3070
+ );
3071
+ return this.cache.clearCache(a), await this.http.putJson(o, i);
3039
3072
  }
3040
- async getActionsForApp(e) {
3041
- const t = await this.cache.httpGetJson(
3073
+ async getActionsForApp(e, t) {
3074
+ const s = await this.cache.httpGetJson(
3042
3075
  "/infra/public/json/sharing-rights.json"
3043
- ), s = await this.getShareMapping(e);
3044
- return Object.keys(t).map((i) => {
3045
- const o = t[i];
3076
+ ), r = await this.getShareMapping(e, t);
3077
+ return Object.keys(s).map((o) => {
3078
+ const a = s[o];
3046
3079
  return {
3047
- displayName: i,
3048
- id: i,
3049
- priority: o.priority,
3050
- requires: o.requires
3080
+ displayName: o,
3081
+ id: o,
3082
+ priority: a.priority,
3083
+ requires: a.requires
3051
3084
  };
3052
- }).filter((i) => {
3053
- var o;
3054
- return ((o = s[i.id]) == null ? void 0 : o.length) > 0;
3055
- }).sort((i, o) => i.priority - o.priority);
3085
+ }).filter((o) => {
3086
+ var a;
3087
+ return ((a = r[o.id]) == null ? void 0 : a.length) > 0;
3088
+ }).sort((o, a) => o.priority - a.priority);
3056
3089
  }
3057
3090
  }
3058
3091
  const defaultMappers = {
@@ -3089,11 +3122,11 @@ const defaultMappers = {
3089
3122
  zip: function({ type: u }) {
3090
3123
  return u.indexOf("zip") !== -1 || u.indexOf("rar") !== -1 || u.indexOf("tar") !== -1 || u.indexOf("7z") !== -1;
3091
3124
  }
3092
- }, C = class C {
3125
+ }, D = class D {
3093
3126
  /* Similar role notion as in infra-front > workspace > Model.ts */
3094
3127
  static getRole(e) {
3095
3128
  var t, s;
3096
- return C.role(
3129
+ return D.role(
3097
3130
  (t = e.metadata) == null ? void 0 : t["content-type"],
3098
3131
  !1,
3099
3132
  (s = e.metadata) == null ? void 0 : s.extension
@@ -3113,10 +3146,10 @@ const defaultMappers = {
3113
3146
  }
3114
3147
  };
3115
3148
  // FIXME add edumedia support
3116
- n(C, "roleMappers", [
3149
+ n(D, "roleMappers", [
3117
3150
  (e) => Object.keys(defaultMappers).find((s) => defaultMappers[s](e))
3118
3151
  ]);
3119
- let DocumentHelper = C;
3152
+ let DocumentHelper = D;
3120
3153
  class WorkspaceService {
3121
3154
  constructor(e) {
3122
3155
  this.context = e;
@@ -3206,7 +3239,7 @@ class WorkspaceService {
3206
3239
  throw this.http.latestResponse.statusText;
3207
3240
  return r.forEach((o, a) => {
3208
3241
  const c = e.findIndex(
3209
- (h) => h._id === o._id
3242
+ (l) => l._id === o._id
3210
3243
  );
3211
3244
  0 <= c && c < e.length && (e[c] = i[a]);
3212
3245
  }), e.filter((o) => !!o);
@@ -3225,8 +3258,8 @@ class WorkspaceService {
3225
3258
  {
3226
3259
  const a = `/workspace/${e.public ? "pub/" : ""}document/${e._id}?thumbnail=`, c = e.thumbnails;
3227
3260
  if ((o = (i = e.metadata) == null ? void 0 : i["content-type"]) != null && o.includes("video")) {
3228
- const h = c && Object.keys(c).length > 0 ? Object.keys(c)[0] : null;
3229
- return h ? a + h : null;
3261
+ const l = c && Object.keys(c).length > 0 ? Object.keys(c)[0] : null;
3262
+ return l ? a + l : null;
3230
3263
  } else
3231
3264
  return a + r;
3232
3265
  }
@@ -3358,10 +3391,10 @@ class AnalyticsService {
3358
3391
  const t = await this.session.getUser(), s = await this.session.getUserProfile();
3359
3392
  let r;
3360
3393
  if (!(t != null && t.structures)) return;
3361
- for (const h of t.structures) {
3362
- const l = u.structureMap[h];
3363
- if (l && l.collectiviteId && l.UAI) {
3364
- r = l;
3394
+ for (const l of t.structures) {
3395
+ const p = u.structureMap[l];
3396
+ if (p && p.collectiviteId && p.UAI) {
3397
+ r = p;
3365
3398
  break;
3366
3399
  }
3367
3400
  }
@@ -3370,11 +3403,11 @@ class AnalyticsService {
3370
3403
  if (!i) return;
3371
3404
  const o = i.xiti;
3372
3405
  if (!o || !o.LIBELLE_SERVICE || !r.UAI) return;
3373
- function a(h) {
3374
- let l = "";
3375
- for (let E = 0; E < h.length; E++)
3376
- l += h.charCodeAt(E);
3377
- return l;
3406
+ function a(l) {
3407
+ let p = "";
3408
+ for (let E = 0; E < l.length; E++)
3409
+ p += l.charCodeAt(E);
3410
+ return p;
3378
3411
  }
3379
3412
  const c = {
3380
3413
  Student: "ELEVE",
@@ -3398,7 +3431,7 @@ class AnalyticsService {
3398
3431
  };
3399
3432
  }
3400
3433
  }
3401
- const R = class R {
3434
+ const C = class C {
3402
3435
  // in minutes. Applies to recorded videos.
3403
3436
  constructor(e) {
3404
3437
  this.context = e;
@@ -3419,8 +3452,8 @@ const R = class R {
3419
3452
  APP$4.VIDEO
3420
3453
  );
3421
3454
  return {
3422
- maxWeight: (e == null ? void 0 : e["max-videosize-mbytes"]) ?? R.MAX_WEIGHT,
3423
- maxDuration: (e == null ? void 0 : e["max-videoduration-minutes"]) ?? R.MAX_DURATION,
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,
3424
3457
  acceptVideoUploadExtensions: ((t = e == null ? void 0 : e["accept-videoupload-extensions"]) == null ? void 0 : t.map(
3425
3458
  (s) => s.toUpperCase()
3426
3459
  )) ?? []
@@ -3451,35 +3484,35 @@ const R = class R {
3451
3484
  { headers: { "Content-Type": "multipart/form-data" } }
3452
3485
  );
3453
3486
  if (c.state == "running") {
3454
- let h = 0, l = 1;
3487
+ let l = 0, p = 1;
3455
3488
  do {
3456
- const E = l + h;
3489
+ const E = p + l;
3457
3490
  await new Promise(
3458
- (d) => setTimeout(d, E * 1e3)
3459
- ), h = l, l = Math.min(8, E);
3460
- const p = await this.http.get(
3491
+ (y) => setTimeout(y, E * 1e3)
3492
+ ), l = p, p = Math.min(8, E);
3493
+ const h = await this.http.get(
3461
3494
  `/video/status/${c.processid}`
3462
3495
  );
3463
- if (p.state == "succeed")
3464
- return p.videoworkspaceid && p.videosize && this.context.data().trackVideoSave(
3465
- p.videoworkspaceid,
3496
+ if (h.state == "succeed")
3497
+ return h.videoworkspaceid && h.videosize && this.context.data().trackVideoSave(
3498
+ h.videoworkspaceid,
3466
3499
  Math.round(r),
3467
- p.videosize,
3500
+ h.videosize,
3468
3501
  s,
3469
3502
  e.url,
3470
3503
  i,
3471
3504
  e.device
3472
- ), p;
3473
- if (p.state == "error")
3505
+ ), h;
3506
+ if (h.state == "error")
3474
3507
  break;
3475
3508
  } while (!0);
3476
3509
  }
3477
3510
  throw new Error("Video cannot be uploaded.");
3478
3511
  }
3479
3512
  };
3480
- n(R, "MAX_WEIGHT", 50), // in Mbytes. Applies to uploaded videos.
3481
- n(R, "MAX_DURATION", 3);
3482
- let VideoService = R;
3513
+ n(C, "MAX_WEIGHT", 50), // in Mbytes. Applies to uploaded videos.
3514
+ n(C, "MAX_DURATION", 3);
3515
+ let VideoService = C;
3483
3516
  class EmbedderService {
3484
3517
  constructor(e) {
3485
3518
  this.context = e;
@@ -3516,10 +3549,10 @@ class EmbedderService {
3516
3549
  const s = new RegExp("[^{}]+(?=(?:[^{}]*{[^}]*})*[^}]*$)", "g"), r = new RegExp("{[^}]*}", "g");
3517
3550
  let i = !0;
3518
3551
  const o = t.match(s) || [], a = [];
3519
- return (t.match(r) || []).forEach((h, l) => {
3520
- h.includes("ignore") || a.push(o[l]);
3521
- }), a.forEach((h) => {
3522
- if (!e.includes(h)) {
3552
+ return (t.match(r) || []).forEach((l, p) => {
3553
+ l.includes("ignore") || a.push(o[p]);
3554
+ }), a.forEach((l) => {
3555
+ if (!e.includes(l)) {
3523
3556
  i = !1;
3524
3557
  return;
3525
3558
  }
@@ -3551,15 +3584,15 @@ class EmbedderService {
3551
3584
  let o = e.embed;
3552
3585
  for (const a of i) {
3553
3586
  let c = s.split(a)[0];
3554
- const h = c.split("}");
3555
- h.length > 1 && (c = h[h.length - 1]);
3556
- let l = t.split(c)[1];
3557
- if (!l)
3587
+ const l = c.split("}");
3588
+ l.length > 1 && (c = l[l.length - 1]);
3589
+ let p = t.split(c)[1];
3590
+ if (!p)
3558
3591
  continue;
3559
3592
  const E = s.split(a)[1].split("{")[0];
3560
- E && (l = l.split(E)[0]);
3561
- const p = new RegExp("\\" + a.replace(/}/, "\\}"), "g");
3562
- o = o.replace(p, l);
3593
+ E && (p = p.split(E)[0]);
3594
+ const h = new RegExp("\\" + a.replace(/}/, "\\}"), "g");
3595
+ o = o.replace(h, p);
3563
3596
  }
3564
3597
  return o;
3565
3598
  }
@@ -3988,17 +4021,17 @@ class WorkspaceBehaviour extends AbstractBehaviourService {
3988
4021
  try {
3989
4022
  let o = "/workspace/documents?filter=all&hierarchical=true";
3990
4023
  s && s.length ? o += `&search=${t}` : t && t.length && (o += `&search=${t}`);
3991
- const c = (await this.httpGet(o)).filter((h) => !h.deleted).map((h) => {
3992
- const l = h.metadata["content-type"] && h.metadata["content-type"].indexOf("image") !== -1 ? `/workspace/document/${h._id}?thumbnail=120x120` : "/img/icons/unknown-large.png";
4024
+ const c = (await this.httpGet(o)).filter((l) => !l.deleted).map((l) => {
4025
+ const p = l.metadata["content-type"] && l.metadata["content-type"].indexOf("image") !== -1 ? `/workspace/document/${l._id}?thumbnail=120x120` : "/img/icons/unknown-large.png";
3993
4026
  return this.dataToResource({
3994
- title: h.name,
3995
- ownerName: h.ownerName,
3996
- owner: h.owner,
3997
- icon: l,
3998
- path: `/workspace/document/${h._id}`,
3999
- _id: h._id,
4000
- shared: !!(h.shared && h.shared.length >= 0),
4001
- modified: h.modified
4027
+ title: l.name,
4028
+ ownerName: l.ownerName,
4029
+ owner: l.owner,
4030
+ icon: p,
4031
+ path: `/workspace/document/${l._id}`,
4032
+ _id: l._id,
4033
+ shared: !!(l.shared && l.shared.length >= 0),
4034
+ modified: l.modified
4002
4035
  });
4003
4036
  });
4004
4037
  r(c);
@@ -4008,7 +4041,7 @@ class WorkspaceBehaviour extends AbstractBehaviourService {
4008
4041
  });
4009
4042
  }
4010
4043
  }
4011
- const w = class w {
4044
+ const b = class b {
4012
4045
  static async initialize(e, t) {
4013
4046
  const s = e.http();
4014
4047
  if (!this.resourceProducingApps.length) {
@@ -4099,9 +4132,9 @@ const w = class w {
4099
4132
  //
4100
4133
  // STATIC REGISTRY
4101
4134
  //
4102
- n(w, "registry", new ServiceRegistry()), // Expose some useful functions
4103
- n(w, "findBehaviour", w.registry.findService.bind(w.registry)), n(w, "hasBehaviour", w.registry.isRegistered.bind(w.registry)), n(w, "resourceProducingApps", []);
4104
- let SnipletsService = w;
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", []);
4137
+ let SnipletsService = b;
4105
4138
  const SEND_ALL = "*";
4106
4139
  class WebBroker {
4107
4140
  constructor(e) {
@@ -4565,18 +4598,18 @@ class WidgetFramework {
4565
4598
  t.listSkins().then((r) => {
4566
4599
  var a;
4567
4600
  const i = ((a = r.find((c) => c.child === t.skin)) == null ? void 0 : a.parent) === "panda" ? secondLevelWidgets : firstLevelWidgets;
4568
- this._widgets = this._widgets.filter((c, h) => {
4569
- const l = c.platformConf.name;
4570
- return i.indexOf(l) !== -1 ? !1 : (this._userPrefs[l] || (this._userPrefs[l] = {
4571
- index: defaultWidgetOrder[l] ?? 999,
4601
+ this._widgets = this._widgets.filter((c, l) => {
4602
+ const p = c.platformConf.name;
4603
+ return i.indexOf(p) !== -1 ? !1 : (this._userPrefs[p] || (this._userPrefs[p] = {
4604
+ index: defaultWidgetOrder[p] ?? 999,
4572
4605
  show: !0,
4573
4606
  position: c.platformConf.position
4574
- }), 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);
4607
+ }), c.platformConf.mandatory && (this._userPrefs[p].show = !0, this._userPrefs[p].index = defaultWidgetOrder[p] ?? 999), c.platformConf.i18n && s.push(c.platformConf.i18n), c.applyUserPref(this._userPrefs[p]), !0);
4575
4608
  });
4576
4609
  const o = new Idiom();
4577
- this._widgets = this._widgets.sort((c, h) => {
4578
- const l = o.translate(`timeline.settings.${c.platformConf.name}`).toLowerCase(), E = o.translate(`timeline.settings.${h.platformConf.name}`).toLowerCase();
4579
- return l < E ? -1 : l > E ? 1 : 0;
4610
+ this._widgets = this._widgets.sort((c, l) => {
4611
+ const p = o.translate(`timeline.settings.${c.platformConf.name}`).toLowerCase(), E = o.translate(`timeline.settings.${l.platformConf.name}`).toLowerCase();
4612
+ return p < E ? -1 : p > E ? 1 : 0;
4580
4613
  });
4581
4614
  });
4582
4615
  }