ode-explorer 1.3.3-develop.202402221755 → 1.3.3-develop.202402261150

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
@@ -62463,50 +62463,45 @@ function useHasWorkflow(workflow) {
62463
62463
  }, [workflow, mock]), state;
62464
62464
  }
62465
62465
  const useConversation = () => {
62466
- const zimbraWorkflow = useHasWorkflow("fr.openent.zimbra.controllers.ZimbraController|view"), zimbraPreauth = useHasWorkflow("fr.openent.zimbra.controllers.ZimbraController|preauth"), [messages2, setMessages] = reactExports.useState(0), [msgLink, setMsgLink] = reactExports.useState(""), refreshMails = reactExports.useCallback(async () => {
62467
- if (zimbraWorkflow)
62468
- try {
62469
- const response = await odeServices.http().get("/zimbra/count/INBOX", {
62470
- queryParams: {
62471
- unread: true,
62472
- _: (/* @__PURE__ */ new Date()).getTime()
62473
- }
62474
- });
62475
- response.status !== 200 && setMessages(0), setMessages(response.count);
62476
- } catch {
62477
- console.error("error"), setMessages(0);
62478
- }
62479
- else
62480
- try {
62481
- const response = await odeServices.http().get("/conversation/count/INBOX", {
62482
- queryParams: {
62483
- unread: true,
62484
- _: (/* @__PURE__ */ new Date()).getTime()
62485
- }
62486
- });
62487
- setMessages(response.count);
62488
- } catch {
62489
- console.error("error"), setMessages(0);
62490
- }
62491
- }, [zimbraWorkflow]), goToMessagerie = reactExports.useCallback(() => {
62492
- let messagerieLink = "";
62493
- odeServices.http().get("/userbook/preference/zimbra").then((data) => {
62494
- try {
62495
- data.preference && JSON.parse(data.preference).modeExpert && zimbraPreauth ? messagerieLink = "/zimbra/preauth" : messagerieLink = window.location.origin + "/zimbra/zimbra";
62496
- } catch {
62497
- messagerieLink = "/zimbra/zimbra";
62498
- }
62499
- }), setMsgLink(messagerieLink);
62500
- }, [zimbraPreauth]);
62466
+ const zimbraWorkflow = useHasWorkflow("fr.openent.zimbra.controllers.ZimbraController|view"), zimbraPreauth = useHasWorkflow("fr.openent.zimbra.controllers.ZimbraController|preauth"), [messages2, setMessages] = reactExports.useState(0), [msgLink, setMsgLink] = reactExports.useState(""), queryParams = {
62467
+ unread: true,
62468
+ _: (/* @__PURE__ */ new Date()).getTime()
62469
+ };
62470
+ console.log({
62471
+ zimbraWorkflow
62472
+ });
62473
+ const refreshMails = reactExports.useCallback(async () => {
62474
+ const url = zimbraWorkflow ? "/zimbra/count/INBOX" : "/conversation/count/INBOX";
62475
+ console.log({
62476
+ url
62477
+ });
62478
+ try {
62479
+ const {
62480
+ status,
62481
+ count: count2
62482
+ } = await odeServices.http().get(url, {
62483
+ queryParams
62484
+ });
62485
+ setMessages(status === 200 ? count2 : 0);
62486
+ } catch (error) {
62487
+ console.error(error), setMessages(0);
62488
+ }
62489
+ }, [zimbraWorkflow]), goToMessagerie = reactExports.useCallback(async () => {
62490
+ const defaultLink = "/zimbra/zimbra";
62491
+ try {
62492
+ const {
62493
+ preference
62494
+ } = await odeServices.http().get("/userbook/preference/zimbra"), isExpertMode = preference ? JSON.parse(preference).modeExpert : false;
62495
+ setMsgLink(isExpertMode && zimbraPreauth ? "/zimbra/preauth" : window.location.origin + defaultLink);
62496
+ } catch (error) {
62497
+ console.error(error), setMsgLink(window.location.origin + defaultLink);
62498
+ }
62499
+ }, []);
62501
62500
  return reactExports.useEffect(() => {
62502
- (async () => {
62503
- try {
62504
- await refreshMails();
62505
- } catch (error) {
62506
- console.error(error);
62507
- }
62508
- })(), goToMessagerie();
62509
- }, [goToMessagerie, refreshMails]), {
62501
+ zimbraWorkflow && refreshMails();
62502
+ }, [zimbraWorkflow, refreshMails]), reactExports.useEffect(() => {
62503
+ zimbraPreauth && goToMessagerie();
62504
+ }, [zimbraPreauth, goToMessagerie]), {
62510
62505
  messages: messages2,
62511
62506
  msgLink,
62512
62507
  zimbraWorkflow
package/dist/version.txt CHANGED
@@ -1 +1 @@
1
- ode-explorer=1.0-b2school-SNAPSHOT 22/02/2024 17:55:51
1
+ ode-explorer=1.0-b2school-SNAPSHOT 26/02/2024 11:51:21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ode-explorer",
3
- "version": "1.3.3-develop.202402221755",
3
+ "version": "1.3.3-develop.202402261150",
4
4
  "description": "Open Digital Education Explorer",
5
5
  "homepage": "https://github.com/opendigitaleducation/explorer#readme",
6
6
  "bugs": {