@edifice.io/client 2.0.1-develop-hotfix.1736861031453 → 2.0.1-develop-hotfix.1736863177286
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.cjs +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/index.js +87 -75
- package/dist/index.umd.cjs +1 -1
- package/dist/services/OdeServices.d.ts +10 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -536,10 +536,10 @@ class AnalyticsService {
|
|
|
536
536
|
const t = await this.session.getUser(), s = await this.session.getUserProfile();
|
|
537
537
|
let r;
|
|
538
538
|
if (!(t != null && t.structures)) return;
|
|
539
|
-
for (const
|
|
540
|
-
const
|
|
541
|
-
if (
|
|
542
|
-
r =
|
|
539
|
+
for (const l of t.structures) {
|
|
540
|
+
const h = n.structureMap[l];
|
|
541
|
+
if (h && h.collectiviteId && h.UAI) {
|
|
542
|
+
r = h;
|
|
543
543
|
break;
|
|
544
544
|
}
|
|
545
545
|
}
|
|
@@ -548,11 +548,11 @@ class AnalyticsService {
|
|
|
548
548
|
if (!i) return;
|
|
549
549
|
const o = i.xiti;
|
|
550
550
|
if (!o || !o.LIBELLE_SERVICE || !r.UAI) return;
|
|
551
|
-
function u(
|
|
552
|
-
let
|
|
553
|
-
for (let g = 0; g <
|
|
554
|
-
|
|
555
|
-
return
|
|
551
|
+
function u(l) {
|
|
552
|
+
let h = "";
|
|
553
|
+
for (let g = 0; g < l.length; g++)
|
|
554
|
+
h += l.charCodeAt(g);
|
|
555
|
+
return h;
|
|
556
556
|
}
|
|
557
557
|
const c = {
|
|
558
558
|
Student: "ELEVE",
|
|
@@ -801,15 +801,15 @@ class ConfService {
|
|
|
801
801
|
// Public access => simply use the 1st override
|
|
802
802
|
i === null || d.child === i.themeName
|
|
803
803
|
)
|
|
804
|
-
), u = (i == null ? void 0 : i.skinName) || o.skins[0], c = (i == null ? void 0 : i.skin) || `/assets/themes/${o.child}/skins/${u}/`,
|
|
804
|
+
), u = (i == null ? void 0 : i.skinName) || o.skins[0], c = (i == null ? void 0 : i.skin) || `/assets/themes/${o.child}/skins/${u}/`, l = o.skins, h = o.bootstrapVersion.split("-").slice(-1)[0], g = o.parent === "panda";
|
|
805
805
|
return {
|
|
806
806
|
basePath: `${this.cdnDomain}${c}../../`,
|
|
807
|
-
bootstrapVersion:
|
|
807
|
+
bootstrapVersion: h,
|
|
808
808
|
is1d: g,
|
|
809
809
|
logoutCallback: (i == null ? void 0 : i.logoutCallback) || "/",
|
|
810
810
|
skin: o.child,
|
|
811
811
|
skinName: u,
|
|
812
|
-
skins:
|
|
812
|
+
skins: l,
|
|
813
813
|
themeName: o.child,
|
|
814
814
|
themeUrl: c,
|
|
815
815
|
npmTheme: o.npmTheme ?? void 0
|
|
@@ -888,17 +888,17 @@ class DirectoryService {
|
|
|
888
888
|
};
|
|
889
889
|
} else
|
|
890
890
|
return Promise.resolve(d);
|
|
891
|
-
}),
|
|
891
|
+
}), l = (await Promise.all(u)).map((d) => d.members).reduce((d, p) => [...d, ...p], []), h = {
|
|
892
892
|
name: e,
|
|
893
|
-
members: [...i, ...o, ...
|
|
893
|
+
members: [...i, ...o, ...l]
|
|
894
894
|
}, { id: g } = await this.http.postJson(
|
|
895
895
|
"/directory/sharebookmark",
|
|
896
|
-
|
|
896
|
+
h
|
|
897
897
|
);
|
|
898
898
|
return {
|
|
899
899
|
id: g,
|
|
900
900
|
displayName: e,
|
|
901
|
-
members:
|
|
901
|
+
members: h.members
|
|
902
902
|
};
|
|
903
903
|
}
|
|
904
904
|
}
|
|
@@ -938,10 +938,10 @@ class EmbedderService {
|
|
|
938
938
|
const s = new RegExp("[^{}]+(?=(?:[^{}]*{[^}]*})*[^}]*$)", "g"), r = new RegExp("{[^}]*}", "g");
|
|
939
939
|
let i = !0;
|
|
940
940
|
const o = t.match(s) || [], u = [];
|
|
941
|
-
return (t.match(r) || []).forEach((
|
|
942
|
-
|
|
943
|
-
}), u.forEach((
|
|
944
|
-
if (!e.includes(
|
|
941
|
+
return (t.match(r) || []).forEach((l, h) => {
|
|
942
|
+
l.includes("ignore") || u.push(o[h]);
|
|
943
|
+
}), u.forEach((l) => {
|
|
944
|
+
if (!e.includes(l)) {
|
|
945
945
|
i = !1;
|
|
946
946
|
return;
|
|
947
947
|
}
|
|
@@ -973,15 +973,15 @@ class EmbedderService {
|
|
|
973
973
|
let o = e.embed;
|
|
974
974
|
for (const u of i) {
|
|
975
975
|
let c = s.split(u)[0];
|
|
976
|
-
const
|
|
977
|
-
|
|
978
|
-
let
|
|
979
|
-
if (!
|
|
976
|
+
const l = c.split("}");
|
|
977
|
+
l.length > 1 && (c = l[l.length - 1]);
|
|
978
|
+
let h = t.split(c)[1];
|
|
979
|
+
if (!h)
|
|
980
980
|
continue;
|
|
981
981
|
const g = s.split(u)[1].split("{")[0];
|
|
982
|
-
g && (
|
|
982
|
+
g && (h = h.split(g)[0]);
|
|
983
983
|
const d = new RegExp("\\" + u.replace(/}/, "\\}"), "g");
|
|
984
|
-
o = o.replace(d,
|
|
984
|
+
o = o.replace(d, h);
|
|
985
985
|
}
|
|
986
986
|
return o;
|
|
987
987
|
}
|
|
@@ -1793,17 +1793,17 @@ class WorkspaceBehaviour extends AbstractBehaviourService {
|
|
|
1793
1793
|
try {
|
|
1794
1794
|
let o = "/workspace/documents?filter=all&hierarchical=true";
|
|
1795
1795
|
s && s.length ? o += `&search=${t}` : t && t.length && (o += `&search=${t}`);
|
|
1796
|
-
const c = (await this.httpGet(o)).filter((
|
|
1797
|
-
const
|
|
1796
|
+
const c = (await this.httpGet(o)).filter((l) => !l.deleted).map((l) => {
|
|
1797
|
+
const h = l.metadata["content-type"] && l.metadata["content-type"].indexOf("image") !== -1 ? `/workspace/document/${l._id}?thumbnail=120x120` : "/img/icons/unknown-large.png";
|
|
1798
1798
|
return this.dataToResource({
|
|
1799
|
-
title:
|
|
1800
|
-
ownerName:
|
|
1801
|
-
owner:
|
|
1802
|
-
icon:
|
|
1803
|
-
path: `/workspace/document/${
|
|
1804
|
-
_id:
|
|
1805
|
-
shared: !!(
|
|
1806
|
-
modified:
|
|
1799
|
+
title: l.name,
|
|
1800
|
+
ownerName: l.ownerName,
|
|
1801
|
+
owner: l.owner,
|
|
1802
|
+
icon: h,
|
|
1803
|
+
path: `/workspace/document/${l._id}`,
|
|
1804
|
+
_id: l._id,
|
|
1805
|
+
shared: !!(l.shared && l.shared.length >= 0),
|
|
1806
|
+
modified: l.modified
|
|
1807
1807
|
});
|
|
1808
1808
|
});
|
|
1809
1809
|
r(c);
|
|
@@ -2217,9 +2217,9 @@ class SessionService {
|
|
|
2217
2217
|
}), i;
|
|
2218
2218
|
}
|
|
2219
2219
|
async getUserProfile(e = {}) {
|
|
2220
|
-
var c,
|
|
2220
|
+
var c, l;
|
|
2221
2221
|
const { options: t = {}, params: s = {} } = e, r = new URLSearchParams(s).toString(), i = `/userbook/api/person${r ? `?${r}` : ""}`, { response: o, value: u } = await this.cache.httpGet(i, t);
|
|
2222
|
-
return o.status < 200 || o.status >= 300 || typeof u == "string" ? ["Guest"] : ((
|
|
2222
|
+
return o.status < 200 || o.status >= 300 || typeof u == "string" ? ["Guest"] : ((l = (c = u == null ? void 0 : u.result) == null ? void 0 : c[0]) == null ? void 0 : l.type) || ["Guest"];
|
|
2223
2223
|
}
|
|
2224
2224
|
async isAdml() {
|
|
2225
2225
|
const e = await this.getUser();
|
|
@@ -2266,38 +2266,38 @@ class ShareService {
|
|
|
2266
2266
|
async searchShareSubjects(e, t, s) {
|
|
2267
2267
|
const r = StringUtils.removeAccents(s).toLowerCase(), i = await this.cache.httpGetJson(
|
|
2268
2268
|
`/${e}/share/json/${t}?search=${s}`
|
|
2269
|
-
), o = i.users.visibles.filter(({ username:
|
|
2269
|
+
), o = i.users.visibles.filter(({ username: h, firstName: g, lastName: d, login: p }) => {
|
|
2270
2270
|
const E = StringUtils.removeAccents(
|
|
2271
2271
|
d || ""
|
|
2272
2272
|
).toLowerCase(), A = StringUtils.removeAccents(
|
|
2273
2273
|
g || ""
|
|
2274
2274
|
).toLowerCase(), m = StringUtils.removeAccents(
|
|
2275
|
-
|
|
2275
|
+
h || ""
|
|
2276
2276
|
).toLowerCase(), w = StringUtils.removeAccents(p || "").toLowerCase();
|
|
2277
2277
|
return m.includes(r) || A.includes(r) || E.includes(r) || w.includes(r);
|
|
2278
|
-
}).map((
|
|
2279
|
-
avatarUrl: this.directory.getAvatarUrl(
|
|
2280
|
-
directoryUrl: this.directory.getDirectoryUrl(
|
|
2281
|
-
displayName:
|
|
2282
|
-
id:
|
|
2283
|
-
profile:
|
|
2278
|
+
}).map((h) => ({
|
|
2279
|
+
avatarUrl: this.directory.getAvatarUrl(h.id, "user"),
|
|
2280
|
+
directoryUrl: this.directory.getDirectoryUrl(h.id, "user"),
|
|
2281
|
+
displayName: h.username,
|
|
2282
|
+
id: h.id,
|
|
2283
|
+
profile: h.profile,
|
|
2284
2284
|
type: "user"
|
|
2285
|
-
})), u = i.groups.visibles.filter(({ name:
|
|
2286
|
-
avatarUrl: this.directory.getAvatarUrl(
|
|
2287
|
-
directoryUrl: this.directory.getDirectoryUrl(
|
|
2288
|
-
displayName:
|
|
2289
|
-
id:
|
|
2285
|
+
})), u = i.groups.visibles.filter(({ name: h }) => StringUtils.removeAccents(h || "").toLowerCase().includes(r)).map((h) => ({
|
|
2286
|
+
avatarUrl: this.directory.getAvatarUrl(h.id, "group"),
|
|
2287
|
+
directoryUrl: this.directory.getDirectoryUrl(h.id, "group"),
|
|
2288
|
+
displayName: h.name,
|
|
2289
|
+
id: h.id,
|
|
2290
2290
|
type: "group",
|
|
2291
|
-
structureName:
|
|
2291
|
+
structureName: h.structureName
|
|
2292
2292
|
}));
|
|
2293
|
-
return [...(await this.directory.getBookMarks()).filter(({ displayName:
|
|
2294
|
-
|
|
2295
|
-
).toLowerCase().includes(r)).map((
|
|
2293
|
+
return [...(await this.directory.getBookMarks()).filter(({ displayName: h }) => StringUtils.removeAccents(
|
|
2294
|
+
h || ""
|
|
2295
|
+
).toLowerCase().includes(r)).map((h) => ({
|
|
2296
2296
|
avatarUrl: "",
|
|
2297
2297
|
directoryUrl: "",
|
|
2298
2298
|
profile: "",
|
|
2299
|
-
displayName:
|
|
2300
|
-
id:
|
|
2299
|
+
displayName: h.displayName,
|
|
2300
|
+
id: h.id,
|
|
2301
2301
|
type: "sharebookmark"
|
|
2302
2302
|
})), ...o, ...u];
|
|
2303
2303
|
}
|
|
@@ -2314,10 +2314,10 @@ class ShareService {
|
|
|
2314
2314
|
}
|
|
2315
2315
|
getActionsAvailableFor({ id: e, type: t }, s, r) {
|
|
2316
2316
|
const o = (t === "user" ? s.users.checked[e] : s.groups.checked[e]) || [], u = Object.keys(r), c = [];
|
|
2317
|
-
for (const
|
|
2318
|
-
r[
|
|
2317
|
+
for (const l of u)
|
|
2318
|
+
r[l].filter(
|
|
2319
2319
|
(d) => o.includes(d)
|
|
2320
|
-
).length > 0 && c.push(
|
|
2320
|
+
).length > 0 && c.push(l);
|
|
2321
2321
|
return c;
|
|
2322
2322
|
}
|
|
2323
2323
|
async getRightsForResource(e, t) {
|
|
@@ -2347,7 +2347,7 @@ class ShareService {
|
|
|
2347
2347
|
};
|
|
2348
2348
|
})
|
|
2349
2349
|
};
|
|
2350
|
-
}).sort((p, E) => (p.displayName || "").localeCompare(E.displayName)),
|
|
2350
|
+
}).sort((p, E) => (p.displayName || "").localeCompare(E.displayName)), l = Object.keys(i.groups.checked).map((p) => i.groups.visibles.find(
|
|
2351
2351
|
(A) => A.id === p
|
|
2352
2352
|
)).filter((p) => p !== void 0).map((p) => {
|
|
2353
2353
|
const E = this.getActionsAvailableFor(
|
|
@@ -2371,7 +2371,7 @@ class ShareService {
|
|
|
2371
2371
|
};
|
|
2372
2372
|
})
|
|
2373
2373
|
};
|
|
2374
|
-
}).sort((p, E) => (p.displayName || "").localeCompare(E.displayName)),
|
|
2374
|
+
}).sort((p, E) => (p.displayName || "").localeCompare(E.displayName)), h = [...c, ...l], g = i.groups.visibles.map(
|
|
2375
2375
|
({ groupDisplayName: p, id: E, name: A }) => ({
|
|
2376
2376
|
displayName: p || A,
|
|
2377
2377
|
id: E
|
|
@@ -2387,7 +2387,7 @@ class ShareService {
|
|
|
2387
2387
|
})
|
|
2388
2388
|
);
|
|
2389
2389
|
return {
|
|
2390
|
-
rights:
|
|
2390
|
+
rights: h,
|
|
2391
2391
|
visibleBookmarks: s,
|
|
2392
2392
|
visibleGroups: g,
|
|
2393
2393
|
visibleUsers: d
|
|
@@ -2400,8 +2400,8 @@ class ShareService {
|
|
|
2400
2400
|
users: {}
|
|
2401
2401
|
};
|
|
2402
2402
|
for (const c of s) {
|
|
2403
|
-
const
|
|
2404
|
-
|
|
2403
|
+
const l = c.actions.map((g) => r[g.id]).reduce((g, d) => Array.isArray(d) ? [...g, ...d] : g, []), h = [...new Set(l)];
|
|
2404
|
+
h.length > 0 && (c.type === "user" ? i.users[c.id] = h : c.type === "group" ? i.groups[c.id] = h : i.bookmarks[c.id] = h);
|
|
2405
2405
|
}
|
|
2406
2406
|
const o = `/${e}/share/resource/${t}`;
|
|
2407
2407
|
return this.cache.clearCache(`/${e}/share/json/${t}?search=`), await this.http.putJson(o, i);
|
|
@@ -2441,10 +2441,10 @@ class HttpService {
|
|
|
2441
2441
|
return this.axios = e, this;
|
|
2442
2442
|
}
|
|
2443
2443
|
useBaseUrl(e) {
|
|
2444
|
-
return this.baseUrl = e, this;
|
|
2444
|
+
return this.baseUrl = e, this.axios.defaults.baseURL = e, this;
|
|
2445
2445
|
}
|
|
2446
2446
|
useHeaders(e) {
|
|
2447
|
-
return this.headers = e, this;
|
|
2447
|
+
return this.headers = e, this.axios.defaults.headers.common = e, this;
|
|
2448
2448
|
}
|
|
2449
2449
|
setCdn(e) {
|
|
2450
2450
|
e && XMLHttpRequest && !XMLHttpRequest.prototype.cdnUrl && (XMLHttpRequest.prototype.cdnUrl = e, XMLHttpRequest.prototype.baseOpen = XMLHttpRequest.prototype.open, XMLHttpRequest.prototype.open = function() {
|
|
@@ -2676,12 +2676,12 @@ const R = class R {
|
|
|
2676
2676
|
{ headers: { "Content-Type": "multipart/form-data" } }
|
|
2677
2677
|
);
|
|
2678
2678
|
if (c.state == "running") {
|
|
2679
|
-
let
|
|
2679
|
+
let l = 0, h = 1;
|
|
2680
2680
|
do {
|
|
2681
|
-
const g =
|
|
2681
|
+
const g = h + l;
|
|
2682
2682
|
await new Promise(
|
|
2683
2683
|
(p) => setTimeout(p, g * 1e3)
|
|
2684
|
-
),
|
|
2684
|
+
), l = h, h = Math.min(8, g);
|
|
2685
2685
|
const d = await this.http.get(
|
|
2686
2686
|
`/video/status/${c.processid}`
|
|
2687
2687
|
);
|
|
@@ -2848,7 +2848,7 @@ class WorkspaceService {
|
|
|
2848
2848
|
throw this.http.latestResponse.statusText;
|
|
2849
2849
|
return r.forEach((o, u) => {
|
|
2850
2850
|
const c = e.findIndex(
|
|
2851
|
-
(
|
|
2851
|
+
(l) => l._id === o._id
|
|
2852
2852
|
);
|
|
2853
2853
|
0 <= c && c < e.length && (e[c] = i[u]);
|
|
2854
2854
|
}), e.filter((o) => !!o);
|
|
@@ -2867,8 +2867,8 @@ class WorkspaceService {
|
|
|
2867
2867
|
{
|
|
2868
2868
|
const u = `/workspace/${e.public ? "pub/" : ""}document/${e._id}?thumbnail=`, c = e.thumbnails;
|
|
2869
2869
|
if ((o = (i = e.metadata) == null ? void 0 : i["content-type"]) != null && o.includes("video")) {
|
|
2870
|
-
const
|
|
2871
|
-
return
|
|
2870
|
+
const l = c && Object.keys(c).length > 0 ? Object.keys(c)[0] : null;
|
|
2871
|
+
return l ? u + l : null;
|
|
2872
2872
|
} else
|
|
2873
2873
|
return u + r;
|
|
2874
2874
|
}
|
|
@@ -2890,11 +2890,23 @@ class OdeServices {
|
|
|
2890
2890
|
a(this, "_video");
|
|
2891
2891
|
a(this, "_workspace");
|
|
2892
2892
|
a(this, "_embedder");
|
|
2893
|
-
|
|
2893
|
+
a(this, "baseUrl");
|
|
2894
|
+
a(this, "headers", {});
|
|
2895
|
+
a(this, "axiosInstance");
|
|
2896
|
+
this._analytics = new AnalyticsService(this), this._cache = new CacheService(this), this._conf = new ConfService(this), this._directory = new DirectoryService(this), this._http = new HttpService(this), this._idiom = new IdiomService(this), 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), this.axiosInstance = axios;
|
|
2894
2897
|
}
|
|
2895
2898
|
initialize() {
|
|
2896
2899
|
return this;
|
|
2897
2900
|
}
|
|
2901
|
+
withAxiosInstance(e) {
|
|
2902
|
+
return this.axiosInstance = e, this;
|
|
2903
|
+
}
|
|
2904
|
+
withHeaders(e) {
|
|
2905
|
+
return this.headers = e, this;
|
|
2906
|
+
}
|
|
2907
|
+
withBaseUrl(e) {
|
|
2908
|
+
return this.baseUrl = e, this;
|
|
2909
|
+
}
|
|
2898
2910
|
analytics() {
|
|
2899
2911
|
return this._analytics;
|
|
2900
2912
|
}
|
|
@@ -2914,7 +2926,7 @@ class OdeServices {
|
|
|
2914
2926
|
return this._directory;
|
|
2915
2927
|
}
|
|
2916
2928
|
http() {
|
|
2917
|
-
return this._http;
|
|
2929
|
+
return this._http.useAxiosInstance(this.axiosInstance).useBaseUrl(this.baseUrl).useHeaders(this.headers);
|
|
2918
2930
|
}
|
|
2919
2931
|
idiom() {
|
|
2920
2932
|
return this._idiom;
|