@xwiki/cristal-authentication-nextcloud-ui 0.24.0 → 0.25.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.
@@ -114,8 +114,8 @@ const B = {
114
114
  for (const [o, l] of t)
115
115
  m[o] = l;
116
116
  return m;
117
- }, G = /* @__PURE__ */ D(A, [["__scopeId", "data-v-9d125113"]]);
117
+ }, G = /* @__PURE__ */ D(A, [["__scopeId", "data-v-65826e44"]]);
118
118
  export {
119
119
  G as default
120
120
  };
121
- //# sourceMappingURL=NextcloudLoginMenu-KxFlJo82.js.map
121
+ //# sourceMappingURL=NextcloudLoginMenu-DAg25dSf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NextcloudLoginMenu-DAg25dSf.js","sources":["../src/translations.ts","../src/vue/NextcloudLoginMenu.vue"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport en from \"../langs/translation-en.json\";\nimport fr from \"../langs/translation-fr.json\";\n\nconst translations = {\n en,\n fr,\n};\nexport default translations;\n","<!--\n See the LICENSE file distributed with this work for additional\n information regarding copyright ownership.\n\n This is free software; you can redistribute it and/or modify it\n under the terms of the GNU Lesser General Public License as\n published by the Free Software Foundation; either version 2.1 of\n the License, or (at your option) any later version.\n\n This software is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public\n License along with this software; if not, write to the Free\n Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n-->\n\n<script lang=\"ts\" setup>\nimport messages from \"../translations\";\nimport { NextcloudAuthenticationState } from \"@xwiki/cristal-authentication-nextcloud-state\";\nimport { inject, ref, watch } from \"vue\";\nimport { useI18n } from \"vue-i18n\";\nimport type { CristalApp } from \"@xwiki/platform-api\";\nimport type { Ref } from \"vue\";\n\nconst { t } = useI18n({\n messages,\n});\n\nconst cristal = inject<CristalApp>(\"cristal\")!;\n\nconst authenticationState = cristal\n .getContainer()\n .get<NextcloudAuthenticationState>(NextcloudAuthenticationState);\nconst modalOpened: Ref<boolean> = authenticationState.modalOpened;\nconst username: Ref<string> = authenticationState.username;\nconst password: Ref<string> = authenticationState.password;\nconst errorStatus: Ref<number | undefined> = ref(undefined);\n\nasync function callback() {\n const response = await authenticationState.callback();\n if (!response.success) {\n errorStatus.value = response.status;\n }\n}\n\nwatch(\n authenticationState.modalOpened,\n async (newValue: boolean, oldValue: boolean) => {\n if (newValue && !oldValue) {\n authenticationState.username.value = \"\";\n authenticationState.password.value = \"\";\n errorStatus.value = undefined;\n }\n },\n);\n</script>\n\n<template>\n <x-dialog\n v-model=\"modalOpened\"\n width=\"auto\"\n :title=\"t('authentication.nextcloud.modal.title')\"\n >\n <template #default>\n <!-- We need 2 different divs to implement the following behavior:\n - Use max available width from the parent\n - Do not resize the parent if the content is larger -->\n <div class=\"alerts-wrapper\">\n <div class=\"alerts\">\n <x-alert v-if=\"errorStatus === 401\" type=\"error\">\n {{ t(\"authentication.nextcloud.modal.error.invalid\") }}\n </x-alert>\n <x-alert v-else-if=\"errorStatus !== undefined\" type=\"error\">\n {{\n t(\"authentication.nextcloud.modal.error.generic\", {\n status: errorStatus,\n })\n }}\n </x-alert>\n </div>\n </div>\n <x-form id=\"nextcloud-login-form\" @submit=\"callback\">\n <x-text-field\n v-model=\"username\"\n :label=\"t('authentication.nextcloud.modal.username.label')\"\n :help=\"t('authentication.nextcloud.modal.username.help')\"\n autofocus\n required\n ></x-text-field>\n <x-text-field\n v-model=\"password\"\n type=\"password\"\n :label=\"t('authentication.nextcloud.modal.password.label')\"\n :help=\"t('authentication.nextcloud.modal.password.help')\"\n ></x-text-field>\n </x-form>\n </template>\n <template #footer>\n <x-btn variant=\"primary\" type=\"submit\" form=\"nextcloud-login-form\">{{\n t(\"authentication.nextcloud.modal.submit.label\")\n }}</x-btn>\n </template>\n </x-dialog>\n</template>\n\n<style scoped>\n.alerts-wrapper {\n display: flex;\n}\n.alerts {\n flex-grow: 1;\n width: 0;\n}\n</style>\n"],"names":["translations","en","fr","useI18n","messages","authenticationState","inject","NextcloudAuthenticationState","modalOpened","username","password","errorStatus","ref","callback","response","watch","newValue","oldValue","_createBlock","_component_x_dialog","_unref","$event","_createElementVNode","_hoisted_1","_hoisted_2","_component_x_alert","_createVNode","_component_x_form","_component_x_text_field","_component_x_btn"],"mappings":";;;;;;;;;;;;;;;;;;;;;GAuBMA,IAAe;AAAA,EACnB,IAAAC;AAAA,EACA,IAAAC;AACF;;;ACEA,UAAM,EAAE,EAAA,IAAMC,EAAQ;AAAA,MAAA,UACpBC;AAAAA,IAAA,CACD,GAIKC,IAFUC,EAAmB,SAAS,EAGzC,aAAA,EACA,IAAkCC,CAA4B,GAC3DC,IAA4BH,EAAoB,aAChDI,IAAwBJ,EAAoB,UAC5CK,IAAwBL,EAAoB,UAC5CM,IAAuCC,EAAI,MAAS;AAE1D,mBAAeC,IAAW;AACxB,YAAMC,IAAW,MAAMT,EAAoB,SAAA;AAC3C,MAAKS,EAAS,YACZH,EAAY,QAAQG,EAAS;AAAA,IAEjC;AAEA,WAAAC;AAAA,MACEV,EAAoB;AAAA,MACpB,OAAOW,GAAmBC,MAAsB;AAC9C,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AEU;AAAA,UAFVM,EAEUG,GAAA;AAAA,YAFH,SAAQ;AAAA,YAAU,MAAK;AAAA,YAAS,MAAK;AAAA,UAAA;uBAAuB,MAEjE;AAAA,kBADAT,EAAA,CAAA,EAAC,6CAAA,CAAA,GAAA,CAAA;AAAA,YAAA;;;;;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
- import { AuthenticationManagerProvider } from '@xwiki/cristal-authentication-api';
2
1
  import { UIExtension } from '@xwiki/cristal-uiextension-api';
2
+ import { AuthenticationManagerProvider } from '@xwiki/platform-authentication-api';
3
3
  import { Component } from 'vue';
4
4
  /**
5
5
  * Login {@link UIExtension} for the Nextcloud backend.
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".alerts-wrapper[data-v-9d125113]{display:flex}.alerts[data-v-9d125113]{flex-grow:1;width:0}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".alerts-wrapper[data-v-65826e44]{display:flex}.alerts[data-v-65826e44]{flex-grow:1;width:0}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
2
  import { injectable as s, inject as u } from "inversify";
3
3
  var d = Object.getOwnPropertyDescriptor, l = (t, e, i, n) => {
4
4
  for (var a = n > 1 ? void 0 : n ? d(e, i) : e, r = t.length - 1, c; r >= 0; r--)
@@ -14,7 +14,7 @@ let o = class {
14
14
  order = 2100;
15
15
  parameters = {};
16
16
  async component() {
17
- return (await import("./NextcloudLoginMenu-KxFlJo82.js")).default;
17
+ return (await import("./NextcloudLoginMenu-DAg25dSf.js")).default;
18
18
  }
19
19
  async enabled() {
20
20
  return !await this.authenticationManager.get()?.isAuthenticated();
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../src/NextcloudLoginMenuUIExtension.ts","../src/index.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { inject, injectable } from \"inversify\";\nimport type {\n AuthenticationManager,\n AuthenticationManagerProvider,\n} from \"@xwiki/cristal-authentication-api\";\nimport type { UIExtension } from \"@xwiki/cristal-uiextension-api\";\nimport type { Component } from \"vue\";\n\n/**\n * Login {@link UIExtension} for the Nextcloud backend.\n *\n * @since 0.16\n * @beta\n */\n@injectable()\nexport class NextcloudLoginMenuUIExtension implements UIExtension {\n id = \"sidebar.actions.nextcloudLoginMenu\";\n uixpName = \"sidebar.actions\";\n order = 2100;\n parameters = {};\n\n constructor(\n @inject(\"AuthenticationManagerProvider\")\n private authenticationManager: AuthenticationManagerProvider,\n ) {}\n\n async component(): Promise<Component> {\n return (await import(\"./vue/NextcloudLoginMenu.vue\")).default;\n }\n\n async enabled(): Promise<boolean> {\n const authenticationManager: AuthenticationManager =\n this.authenticationManager.get()!;\n const authenticated: boolean =\n await authenticationManager?.isAuthenticated();\n return !authenticated;\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { NextcloudLoginMenuUIExtension } from \"./NextcloudLoginMenuUIExtension\";\nimport { Container } from \"inversify\";\nimport type { UIExtension } from \"@xwiki/cristal-uiextension-api\";\n\n/**\n * @beta\n */\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<UIExtension>(\"UIExtension\")\n .to(NextcloudLoginMenuUIExtension)\n .inSingletonScope();\n }\n}\n"],"names":["NextcloudLoginMenuUIExtension","authenticationManager","__decorateClass","injectable","__decorateParam","ComponentInit","container"],"mappings":";;;;;;AAmCO,IAAMA,IAAN,MAA2D;AAAA,EAMhE,YAEUC,GACR;AADQ,SAAA,wBAAAA;AAAA,EACP;AAAA,EARH,KAAK;AAAA,EACL,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,aAAa,CAAA;AAAA,EAOb,MAAM,YAAgC;AACpC,YAAQ,MAAM,OAAO,kCAA8B,GAAG;AAAA,EACxD;AAAA,EAEA,MAAM,UAA4B;AAKhC,WAAO,CADL,MAFA,KAAK,sBAAsB,IAAA,GAEE,gBAAA;AAAA,EAEjC;AACF;AAtBaD,IAANE,EAAA;AAAA,EADNC,EAAA;AAAA,EAQIC,OAAO,+BAA+B,CAAA;AAAA,GAP9BJ,CAAA;ACRN,MAAMK,EAAc;AAAA,EACzB,YAAYC,GAAsB;AAChC,IAAAA,EACG,KAAkB,aAAa,EAC/B,GAAGN,CAA6B,EAChC,iBAAA;AAAA,EACL;AACF;"}
1
+ {"version":3,"file":"index.es.js","sources":["../src/NextcloudLoginMenuUIExtension.ts","../src/index.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { inject, injectable } from \"inversify\";\nimport type { UIExtension } from \"@xwiki/cristal-uiextension-api\";\nimport type {\n AuthenticationManager,\n AuthenticationManagerProvider,\n} from \"@xwiki/platform-authentication-api\";\nimport type { Component } from \"vue\";\n\n/**\n * Login {@link UIExtension} for the Nextcloud backend.\n *\n * @since 0.16\n * @beta\n */\n@injectable()\nexport class NextcloudLoginMenuUIExtension implements UIExtension {\n id = \"sidebar.actions.nextcloudLoginMenu\";\n uixpName = \"sidebar.actions\";\n order = 2100;\n parameters = {};\n\n constructor(\n @inject(\"AuthenticationManagerProvider\")\n private authenticationManager: AuthenticationManagerProvider,\n ) {}\n\n async component(): Promise<Component> {\n return (await import(\"./vue/NextcloudLoginMenu.vue\")).default;\n }\n\n async enabled(): Promise<boolean> {\n const authenticationManager: AuthenticationManager =\n this.authenticationManager.get()!;\n const authenticated: boolean =\n await authenticationManager?.isAuthenticated();\n return !authenticated;\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { NextcloudLoginMenuUIExtension } from \"./NextcloudLoginMenuUIExtension\";\nimport { Container } from \"inversify\";\nimport type { UIExtension } from \"@xwiki/cristal-uiextension-api\";\n\n/**\n * @beta\n */\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<UIExtension>(\"UIExtension\")\n .to(NextcloudLoginMenuUIExtension)\n .inSingletonScope();\n }\n}\n"],"names":["NextcloudLoginMenuUIExtension","authenticationManager","__decorateClass","injectable","__decorateParam","ComponentInit","container"],"mappings":";;;;;;AAmCO,IAAMA,IAAN,MAA2D;AAAA,EAMhE,YAEUC,GACR;AADQ,SAAA,wBAAAA;AAAA,EACP;AAAA,EARH,KAAK;AAAA,EACL,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,aAAa,CAAA;AAAA,EAOb,MAAM,YAAgC;AACpC,YAAQ,MAAM,OAAO,kCAA8B,GAAG;AAAA,EACxD;AAAA,EAEA,MAAM,UAA4B;AAKhC,WAAO,CADL,MAFA,KAAK,sBAAsB,IAAA,GAEE,gBAAA;AAAA,EAEjC;AACF;AAtBaD,IAANE,EAAA;AAAA,EADNC,EAAA;AAAA,EAQIC,OAAO,+BAA+B,CAAA;AAAA,GAP9BJ,CAAA;ACRN,MAAMK,EAAc;AAAA,EACzB,YAAYC,GAAsB;AAChC,IAAAA,EACG,KAAkB,aAAa,EAC/B,GAAGN,CAA6B,EAChC,iBAAA;AAAA,EACL;AACF;"}
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".alerts-wrapper[data-v-9d125113]{display:flex}.alerts[data-v-9d125113]{flex-grow:1;width:0}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
- (function(a,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("inversify"),require("vue"),require("@xwiki/cristal-authentication-nextcloud-state"),require("vue-i18n")):typeof define=="function"&&define.amd?define(["exports","inversify","vue","@xwiki/cristal-authentication-nextcloud-state","vue-i18n"],c):(a=typeof globalThis<"u"?globalThis:a||self,c(a["cristal_authentication-nextcloud-ui"]={},a.inversify,a.Vue,a.cristalAuthenticationNextcloudState,a.vueI18n))})(this,(function(a,c,e,w,g){"use strict";var h=document.createElement("style");h.textContent=`.alerts-wrapper[data-v-9d125113]{display:flex}.alerts[data-v-9d125113]{flex-grow:1;width:0}
3
- /*$vite$:1*/`,document.head.appendChild(h);var b=Object.getOwnPropertyDescriptor,y=(o,t,r,n)=>{for(var i=n>1?void 0:n?b(t,r):t,s=o.length-1,d;s>=0;s--)(d=o[s])&&(i=d(i)||i);return i},N=(o,t)=>(r,n)=>t(r,n,o);let x=class{constructor(o){this.authenticationManager=o}id="sidebar.actions.nextcloudLoginMenu";uixpName="sidebar.actions";order=2100;parameters={};async component(){return(await Promise.resolve().then(()=>k)).default}async enabled(){return!await this.authenticationManager.get()?.isAuthenticated()}};x=y([c.injectable(),N(0,c.inject("AuthenticationManagerProvider"))],x);class C{constructor(t){t.bind("UIExtension").to(x).inSingletonScope()}}const V={en:{"authentication.nextcloud.modal.title":"Nextcloud Login","authentication.nextcloud.modal.username.label":"Username","authentication.nextcloud.modal.username.help":"Enter your username.","authentication.nextcloud.modal.password.label":"Password","authentication.nextcloud.modal.password.help":"It is not recommended to enter your own personal password, you should enter a specific application password instead.","authentication.nextcloud.modal.submit.label":"Log-in","authentication.nextcloud.modal.error.invalid":"Invalid username or password.","authentication.nextcloud.modal.error.generic":"Login check failed. Response status: {status}."},fr:{"authentication.nextcloud.modal.title":"Connexion à Nextcloud","authentication.nextcloud.modal.username.label":"Nom d'utilisateur","authentication.nextcloud.modal.username.help":"Saisissez votre nom d'utilisateur.","authentication.nextcloud.modal.password.label":"Mot de passe","authentication.nextcloud.modal.password.help":"Il n'est pas recommandé de saisir votre mot de passe personnel, vous devriez saisir un mot de passe d'application à la place.","authentication.nextcloud.modal.submit.label":"Se connecter","authentication.nextcloud.modal.error.invalid":"Nom d'utilisateur ou mot de passe non valide.","authentication.nextcloud.modal.error.generic":"Échec d’authentification. Statut de la réponse : {status}."}},S={class:"alerts-wrapper"},M={class:"alerts"},k=Object.freeze(Object.defineProperty({__proto__:null,default:((o,t)=>{const r=o.__vccOpts||o;for(const[n,i]of t)r[n]=i;return r})(e.defineComponent({__name:"NextcloudLoginMenu",setup(o){const{t}=g.useI18n({messages:V}),n=e.inject("cristal").getContainer().get(w.NextcloudAuthenticationState),i=n.modalOpened,s=n.username,d=n.password,u=e.ref(void 0);async function I(){const m=await n.callback();m.success||(u.value=m.status)}return e.watch(n.modalOpened,async(m,l)=>{m&&!l&&(n.username.value="",n.password.value="",u.value=void 0)}),(m,l)=>{const f=e.resolveComponent("x-alert"),_=e.resolveComponent("x-text-field"),O=e.resolveComponent("x-form"),L=e.resolveComponent("x-btn"),j=e.resolveComponent("x-dialog");return e.openBlock(),e.createBlock(j,{modelValue:e.unref(i),"onUpdate:modelValue":l[2]||(l[2]=p=>e.isRef(i)?i.value=p:null),width:"auto",title:e.unref(t)("authentication.nextcloud.modal.title")},{default:e.withCtx(()=>[e.createElementVNode("div",S,[e.createElementVNode("div",M,[u.value===401?(e.openBlock(),e.createBlock(f,{key:0,type:"error"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("authentication.nextcloud.modal.error.invalid")),1)]),_:1})):u.value!==void 0?(e.openBlock(),e.createBlock(f,{key:1,type:"error"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("authentication.nextcloud.modal.error.generic",{status:u.value})),1)]),_:1})):e.createCommentVNode("",!0)])]),e.createVNode(O,{id:"nextcloud-login-form",onSubmit:I},{default:e.withCtx(()=>[e.createVNode(_,{modelValue:e.unref(s),"onUpdate:modelValue":l[0]||(l[0]=p=>e.isRef(s)?s.value=p:null),label:e.unref(t)("authentication.nextcloud.modal.username.label"),help:e.unref(t)("authentication.nextcloud.modal.username.help"),autofocus:"",required:""},null,8,["modelValue","label","help"]),e.createVNode(_,{modelValue:e.unref(d),"onUpdate:modelValue":l[1]||(l[1]=p=>e.isRef(d)?d.value=p:null),type:"password",label:e.unref(t)("authentication.nextcloud.modal.password.label"),help:e.unref(t)("authentication.nextcloud.modal.password.help")},null,8,["modelValue","label","help"])]),_:1})]),footer:e.withCtx(()=>[e.createVNode(L,{variant:"primary",type:"submit",form:"nextcloud-login-form"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("authentication.nextcloud.modal.submit.label")),1)]),_:1})]),_:1},8,["modelValue","title"])}}}),[["__scopeId","data-v-9d125113"]])},Symbol.toStringTag,{value:"Module"}));a.ComponentInit=C,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".alerts-wrapper[data-v-65826e44]{display:flex}.alerts[data-v-65826e44]{flex-grow:1;width:0}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
+ (function(a,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("inversify"),require("vue"),require("@xwiki/cristal-authentication-nextcloud-state"),require("vue-i18n")):typeof define=="function"&&define.amd?define(["exports","inversify","vue","@xwiki/cristal-authentication-nextcloud-state","vue-i18n"],c):(a=typeof globalThis<"u"?globalThis:a||self,c(a["cristal_authentication-nextcloud-ui"]={},a.inversify,a.Vue,a.cristalAuthenticationNextcloudState,a.vueI18n))})(this,(function(a,c,e,w,g){"use strict";var h=document.createElement("style");h.textContent=`.alerts-wrapper[data-v-65826e44]{display:flex}.alerts[data-v-65826e44]{flex-grow:1;width:0}
3
+ /*$vite$:1*/`,document.head.appendChild(h);var b=Object.getOwnPropertyDescriptor,y=(o,t,r,n)=>{for(var i=n>1?void 0:n?b(t,r):t,s=o.length-1,d;s>=0;s--)(d=o[s])&&(i=d(i)||i);return i},N=(o,t)=>(r,n)=>t(r,n,o);let x=class{constructor(o){this.authenticationManager=o}id="sidebar.actions.nextcloudLoginMenu";uixpName="sidebar.actions";order=2100;parameters={};async component(){return(await Promise.resolve().then(()=>k)).default}async enabled(){return!await this.authenticationManager.get()?.isAuthenticated()}};x=y([c.injectable(),N(0,c.inject("AuthenticationManagerProvider"))],x);class C{constructor(t){t.bind("UIExtension").to(x).inSingletonScope()}}const V={en:{"authentication.nextcloud.modal.title":"Nextcloud Login","authentication.nextcloud.modal.username.label":"Username","authentication.nextcloud.modal.username.help":"Enter your username.","authentication.nextcloud.modal.password.label":"Password","authentication.nextcloud.modal.password.help":"It is not recommended to enter your own personal password, you should enter a specific application password instead.","authentication.nextcloud.modal.submit.label":"Log-in","authentication.nextcloud.modal.error.invalid":"Invalid username or password.","authentication.nextcloud.modal.error.generic":"Login check failed. Response status: {status}."},fr:{"authentication.nextcloud.modal.title":"Connexion à Nextcloud","authentication.nextcloud.modal.username.label":"Nom d'utilisateur","authentication.nextcloud.modal.username.help":"Saisissez votre nom d'utilisateur.","authentication.nextcloud.modal.password.label":"Mot de passe","authentication.nextcloud.modal.password.help":"Il n'est pas recommandé de saisir votre mot de passe personnel, vous devriez saisir un mot de passe d'application à la place.","authentication.nextcloud.modal.submit.label":"Se connecter","authentication.nextcloud.modal.error.invalid":"Nom d'utilisateur ou mot de passe non valide.","authentication.nextcloud.modal.error.generic":"Échec d’authentification. Statut de la réponse : {status}."}},S={class:"alerts-wrapper"},M={class:"alerts"},k=Object.freeze(Object.defineProperty({__proto__:null,default:((o,t)=>{const r=o.__vccOpts||o;for(const[n,i]of t)r[n]=i;return r})(e.defineComponent({__name:"NextcloudLoginMenu",setup(o){const{t}=g.useI18n({messages:V}),n=e.inject("cristal").getContainer().get(w.NextcloudAuthenticationState),i=n.modalOpened,s=n.username,d=n.password,u=e.ref(void 0);async function I(){const m=await n.callback();m.success||(u.value=m.status)}return e.watch(n.modalOpened,async(m,l)=>{m&&!l&&(n.username.value="",n.password.value="",u.value=void 0)}),(m,l)=>{const f=e.resolveComponent("x-alert"),_=e.resolveComponent("x-text-field"),O=e.resolveComponent("x-form"),L=e.resolveComponent("x-btn"),j=e.resolveComponent("x-dialog");return e.openBlock(),e.createBlock(j,{modelValue:e.unref(i),"onUpdate:modelValue":l[2]||(l[2]=p=>e.isRef(i)?i.value=p:null),width:"auto",title:e.unref(t)("authentication.nextcloud.modal.title")},{default:e.withCtx(()=>[e.createElementVNode("div",S,[e.createElementVNode("div",M,[u.value===401?(e.openBlock(),e.createBlock(f,{key:0,type:"error"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("authentication.nextcloud.modal.error.invalid")),1)]),_:1})):u.value!==void 0?(e.openBlock(),e.createBlock(f,{key:1,type:"error"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("authentication.nextcloud.modal.error.generic",{status:u.value})),1)]),_:1})):e.createCommentVNode("",!0)])]),e.createVNode(O,{id:"nextcloud-login-form",onSubmit:I},{default:e.withCtx(()=>[e.createVNode(_,{modelValue:e.unref(s),"onUpdate:modelValue":l[0]||(l[0]=p=>e.isRef(s)?s.value=p:null),label:e.unref(t)("authentication.nextcloud.modal.username.label"),help:e.unref(t)("authentication.nextcloud.modal.username.help"),autofocus:"",required:""},null,8,["modelValue","label","help"]),e.createVNode(_,{modelValue:e.unref(d),"onUpdate:modelValue":l[1]||(l[1]=p=>e.isRef(d)?d.value=p:null),type:"password",label:e.unref(t)("authentication.nextcloud.modal.password.label"),help:e.unref(t)("authentication.nextcloud.modal.password.help")},null,8,["modelValue","label","help"])]),_:1})]),footer:e.withCtx(()=>[e.createVNode(L,{variant:"primary",type:"submit",form:"nextcloud-login-form"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("authentication.nextcloud.modal.submit.label")),1)]),_:1})]),_:1},8,["modelValue","title"])}}}),[["__scopeId","data-v-65826e44"]])},Symbol.toStringTag,{value:"Module"}));a.ComponentInit=C,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
4
4
  //# sourceMappingURL=index.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":["../src/NextcloudLoginMenuUIExtension.ts","../src/index.ts","../src/translations.ts","../src/vue/NextcloudLoginMenu.vue"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { inject, injectable } from \"inversify\";\nimport type {\n AuthenticationManager,\n AuthenticationManagerProvider,\n} from \"@xwiki/cristal-authentication-api\";\nimport type { UIExtension } from \"@xwiki/cristal-uiextension-api\";\nimport type { Component } from \"vue\";\n\n/**\n * Login {@link UIExtension} for the Nextcloud backend.\n *\n * @since 0.16\n * @beta\n */\n@injectable()\nexport class NextcloudLoginMenuUIExtension implements UIExtension {\n id = \"sidebar.actions.nextcloudLoginMenu\";\n uixpName = \"sidebar.actions\";\n order = 2100;\n parameters = {};\n\n constructor(\n @inject(\"AuthenticationManagerProvider\")\n private authenticationManager: AuthenticationManagerProvider,\n ) {}\n\n async component(): Promise<Component> {\n return (await import(\"./vue/NextcloudLoginMenu.vue\")).default;\n }\n\n async enabled(): Promise<boolean> {\n const authenticationManager: AuthenticationManager =\n this.authenticationManager.get()!;\n const authenticated: boolean =\n await authenticationManager?.isAuthenticated();\n return !authenticated;\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { NextcloudLoginMenuUIExtension } from \"./NextcloudLoginMenuUIExtension\";\nimport { Container } from \"inversify\";\nimport type { UIExtension } from \"@xwiki/cristal-uiextension-api\";\n\n/**\n * @beta\n */\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<UIExtension>(\"UIExtension\")\n .to(NextcloudLoginMenuUIExtension)\n .inSingletonScope();\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport en from \"../langs/translation-en.json\";\nimport fr from \"../langs/translation-fr.json\";\n\nconst translations = {\n en,\n fr,\n};\nexport default translations;\n","<!--\n See the LICENSE file distributed with this work for additional\n information regarding copyright ownership.\n\n This is free software; you can redistribute it and/or modify it\n under the terms of the GNU Lesser General Public License as\n published by the Free Software Foundation; either version 2.1 of\n the License, or (at your option) any later version.\n\n This software is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public\n License along with this software; if not, write to the Free\n Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n-->\n\n<script lang=\"ts\" setup>\nimport messages from \"../translations\";\nimport { NextcloudAuthenticationState } from \"@xwiki/cristal-authentication-nextcloud-state\";\nimport { inject, ref, watch } from \"vue\";\nimport { useI18n } from \"vue-i18n\";\nimport type { CristalApp } from \"@xwiki/cristal-api\";\nimport type { Ref } from \"vue\";\n\nconst { t } = useI18n({\n messages,\n});\n\nconst cristal = inject<CristalApp>(\"cristal\")!;\n\nconst authenticationState = cristal\n .getContainer()\n .get<NextcloudAuthenticationState>(NextcloudAuthenticationState);\nconst modalOpened: Ref<boolean> = authenticationState.modalOpened;\nconst username: Ref<string> = authenticationState.username;\nconst password: Ref<string> = authenticationState.password;\nconst errorStatus: Ref<number | undefined> = ref(undefined);\n\nasync function callback() {\n const response = await authenticationState.callback();\n if (!response.success) {\n errorStatus.value = response.status;\n }\n}\n\nwatch(\n authenticationState.modalOpened,\n async (newValue: boolean, oldValue: boolean) => {\n if (newValue && !oldValue) {\n authenticationState.username.value = \"\";\n authenticationState.password.value = \"\";\n errorStatus.value = undefined;\n }\n },\n);\n</script>\n\n<template>\n <x-dialog\n v-model=\"modalOpened\"\n width=\"auto\"\n :title=\"t('authentication.nextcloud.modal.title')\"\n >\n <template #default>\n <!-- We need 2 different divs to implement the following behavior:\n - Use max available width from the parent\n - Do not resize the parent if the content is larger -->\n <div class=\"alerts-wrapper\">\n <div class=\"alerts\">\n <x-alert v-if=\"errorStatus === 401\" type=\"error\">\n {{ t(\"authentication.nextcloud.modal.error.invalid\") }}\n </x-alert>\n <x-alert v-else-if=\"errorStatus !== undefined\" type=\"error\">\n {{\n t(\"authentication.nextcloud.modal.error.generic\", {\n status: errorStatus,\n })\n }}\n </x-alert>\n </div>\n </div>\n <x-form id=\"nextcloud-login-form\" @submit=\"callback\">\n <x-text-field\n v-model=\"username\"\n :label=\"t('authentication.nextcloud.modal.username.label')\"\n :help=\"t('authentication.nextcloud.modal.username.help')\"\n autofocus\n required\n ></x-text-field>\n <x-text-field\n v-model=\"password\"\n type=\"password\"\n :label=\"t('authentication.nextcloud.modal.password.label')\"\n :help=\"t('authentication.nextcloud.modal.password.help')\"\n ></x-text-field>\n </x-form>\n </template>\n <template #footer>\n <x-btn variant=\"primary\" type=\"submit\" form=\"nextcloud-login-form\">{{\n t(\"authentication.nextcloud.modal.submit.label\")\n }}</x-btn>\n </template>\n </x-dialog>\n</template>\n\n<style scoped>\n.alerts-wrapper {\n display: flex;\n}\n.alerts {\n flex-grow: 1;\n width: 0;\n}\n</style>\n"],"names":["NextcloudLoginMenuUIExtension","authenticationManager","NextcloudLoginMenu$1","__decorateClass","injectable","__decorateParam","ComponentInit","container","translations","useI18n","messages","authenticationState","inject","NextcloudAuthenticationState","modalOpened","username","password","errorStatus","ref","callback","response","watch","newValue","oldValue","_createBlock","_component_x_dialog","_unref","$event","_createElementVNode","_hoisted_1","_hoisted_2","_component_x_alert","_createVNode","_component_x_form","_component_x_text_field","_component_x_btn"],"mappings":";gNAmCO,IAAMA,EAAN,KAA2D,CAMhE,YAEUC,EACR,CADQ,KAAA,sBAAAA,CACP,CARH,GAAK,qCACL,SAAW,kBACX,MAAQ,KACR,WAAa,CAAA,EAOb,MAAM,WAAgC,CACpC,OAAQ,MAAM,QAAA,QAAA,EAAA,KAAA,IAAAC,CAAA,GAAwC,OACxD,CAEA,MAAM,SAA4B,CAKhC,MAAO,CADL,MAFA,KAAK,sBAAsB,IAAA,GAEE,gBAAA,CAEjC,CACF,EAtBaF,EAAN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,CAAA,EAAC,+CAAA,QAA2ET,EAAA,KAAA,gDAOpFe,EAAAA,YAcSC,EAAA,CAdD,GAAG,uBAAwB,SAAQd,CAAA,qBACzC,IAMgB,CANhBa,EAAAA,YAMgBE,EAAA,YALLR,EAAAA,MAAAX,CAAA,kDAAAA,EAAQ,MAAAY,EAAA,MAChB,MAAOD,EAAAA,MAAA,CAAA,EAAC,+CAAA,EACR,KAAMA,EAAAA,MAAA,CAAA,EAAC,8CAAA,EACR,UAAA,GACA,SAAA,EAAA,wCAEFM,EAAAA,YAKgBE,EAAA,YAJLR,EAAAA,MAAAV,CAAA,kDAAAA,EAAQ,MAAAW,EAAA,MACjB,KAAK,WACJ,MAAOD,EAAAA,MAAA,CAAA,EAAC,+CAAA,EACR,KAAMA,EAAAA,MAAA,CAAA,EAAC,8CAAA,CAAA,kDAIH,iBACT,IAEU,CAFVM,EAAAA,YAEUG,EAAA,CAFH,QAAQ,UAAU,KAAK,SAAS,KAAK,sBAAA,qBAAuB,IAEjE,qCADAT,EAAAA,MAAA,CAAA,EAAC,6CAAA,CAAA,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"index.umd.js","sources":["../src/NextcloudLoginMenuUIExtension.ts","../src/index.ts","../src/translations.ts","../src/vue/NextcloudLoginMenu.vue"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { inject, injectable } from \"inversify\";\nimport type { UIExtension } from \"@xwiki/cristal-uiextension-api\";\nimport type {\n AuthenticationManager,\n AuthenticationManagerProvider,\n} from \"@xwiki/platform-authentication-api\";\nimport type { Component } from \"vue\";\n\n/**\n * Login {@link UIExtension} for the Nextcloud backend.\n *\n * @since 0.16\n * @beta\n */\n@injectable()\nexport class NextcloudLoginMenuUIExtension implements UIExtension {\n id = \"sidebar.actions.nextcloudLoginMenu\";\n uixpName = \"sidebar.actions\";\n order = 2100;\n parameters = {};\n\n constructor(\n @inject(\"AuthenticationManagerProvider\")\n private authenticationManager: AuthenticationManagerProvider,\n ) {}\n\n async component(): Promise<Component> {\n return (await import(\"./vue/NextcloudLoginMenu.vue\")).default;\n }\n\n async enabled(): Promise<boolean> {\n const authenticationManager: AuthenticationManager =\n this.authenticationManager.get()!;\n const authenticated: boolean =\n await authenticationManager?.isAuthenticated();\n return !authenticated;\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { NextcloudLoginMenuUIExtension } from \"./NextcloudLoginMenuUIExtension\";\nimport { Container } from \"inversify\";\nimport type { UIExtension } from \"@xwiki/cristal-uiextension-api\";\n\n/**\n * @beta\n */\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<UIExtension>(\"UIExtension\")\n .to(NextcloudLoginMenuUIExtension)\n .inSingletonScope();\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport en from \"../langs/translation-en.json\";\nimport fr from \"../langs/translation-fr.json\";\n\nconst translations = {\n en,\n fr,\n};\nexport default translations;\n","<!--\n See the LICENSE file distributed with this work for additional\n information regarding copyright ownership.\n\n This is free software; you can redistribute it and/or modify it\n under the terms of the GNU Lesser General Public License as\n published by the Free Software Foundation; either version 2.1 of\n the License, or (at your option) any later version.\n\n This software is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public\n License along with this software; if not, write to the Free\n Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n-->\n\n<script lang=\"ts\" setup>\nimport messages from \"../translations\";\nimport { NextcloudAuthenticationState } from \"@xwiki/cristal-authentication-nextcloud-state\";\nimport { inject, ref, watch } from \"vue\";\nimport { useI18n } from \"vue-i18n\";\nimport type { CristalApp } from \"@xwiki/platform-api\";\nimport type { Ref } from \"vue\";\n\nconst { t } = useI18n({\n messages,\n});\n\nconst cristal = inject<CristalApp>(\"cristal\")!;\n\nconst authenticationState = cristal\n .getContainer()\n .get<NextcloudAuthenticationState>(NextcloudAuthenticationState);\nconst modalOpened: Ref<boolean> = authenticationState.modalOpened;\nconst username: Ref<string> = authenticationState.username;\nconst password: Ref<string> = authenticationState.password;\nconst errorStatus: Ref<number | undefined> = ref(undefined);\n\nasync function callback() {\n const response = await authenticationState.callback();\n if (!response.success) {\n errorStatus.value = response.status;\n }\n}\n\nwatch(\n authenticationState.modalOpened,\n async (newValue: boolean, oldValue: boolean) => {\n if (newValue && !oldValue) {\n authenticationState.username.value = \"\";\n authenticationState.password.value = \"\";\n errorStatus.value = undefined;\n }\n },\n);\n</script>\n\n<template>\n <x-dialog\n v-model=\"modalOpened\"\n width=\"auto\"\n :title=\"t('authentication.nextcloud.modal.title')\"\n >\n <template #default>\n <!-- We need 2 different divs to implement the following behavior:\n - Use max available width from the parent\n - Do not resize the parent if the content is larger -->\n <div class=\"alerts-wrapper\">\n <div class=\"alerts\">\n <x-alert v-if=\"errorStatus === 401\" type=\"error\">\n {{ t(\"authentication.nextcloud.modal.error.invalid\") }}\n </x-alert>\n <x-alert v-else-if=\"errorStatus !== undefined\" type=\"error\">\n {{\n t(\"authentication.nextcloud.modal.error.generic\", {\n status: errorStatus,\n })\n }}\n </x-alert>\n </div>\n </div>\n <x-form id=\"nextcloud-login-form\" @submit=\"callback\">\n <x-text-field\n v-model=\"username\"\n :label=\"t('authentication.nextcloud.modal.username.label')\"\n :help=\"t('authentication.nextcloud.modal.username.help')\"\n autofocus\n required\n ></x-text-field>\n <x-text-field\n v-model=\"password\"\n type=\"password\"\n :label=\"t('authentication.nextcloud.modal.password.label')\"\n :help=\"t('authentication.nextcloud.modal.password.help')\"\n ></x-text-field>\n </x-form>\n </template>\n <template #footer>\n <x-btn variant=\"primary\" type=\"submit\" form=\"nextcloud-login-form\">{{\n t(\"authentication.nextcloud.modal.submit.label\")\n }}</x-btn>\n </template>\n </x-dialog>\n</template>\n\n<style scoped>\n.alerts-wrapper {\n display: flex;\n}\n.alerts {\n flex-grow: 1;\n width: 0;\n}\n</style>\n"],"names":["NextcloudLoginMenuUIExtension","authenticationManager","NextcloudLoginMenu$1","__decorateClass","injectable","__decorateParam","ComponentInit","container","translations","useI18n","messages","authenticationState","inject","NextcloudAuthenticationState","modalOpened","username","password","errorStatus","ref","callback","response","watch","newValue","oldValue","_createBlock","_component_x_dialog","_unref","$event","_createElementVNode","_hoisted_1","_hoisted_2","_component_x_alert","_createVNode","_component_x_form","_component_x_text_field","_component_x_btn"],"mappings":";gNAmCO,IAAMA,EAAN,KAA2D,CAMhE,YAEUC,EACR,CADQ,KAAA,sBAAAA,CACP,CARH,GAAK,qCACL,SAAW,kBACX,MAAQ,KACR,WAAa,CAAA,EAOb,MAAM,WAAgC,CACpC,OAAQ,MAAM,QAAA,QAAA,EAAA,KAAA,IAAAC,CAAA,GAAwC,OACxD,CAEA,MAAM,SAA4B,CAKhC,MAAO,CADL,MAFA,KAAK,sBAAsB,IAAA,GAEE,gBAAA,CAEjC,CACF,EAtBaF,EAANG,EAAA,CADNC,aAAA,EAQIC,aAAO,+BAA+B,CAAA,CAAA,EAP9BL,CAAA,ECRN,MAAMM,CAAc,CACzB,YAAYC,EAAsB,CAChCA,EACG,KAAkB,aAAa,EAC/B,GAAGP,CAA6B,EAChC,iBAAA,CACL,CACF,CCXA,MAAMQ,EAAe,CACnB,soBACA,itBACF,2OCEA,KAAM,CAAE,CAAA,EAAMC,UAAQ,CAAA,SACpBC,CAAA,CACD,EAIKC,EAFUC,EAAAA,OAAmB,SAAS,EAGzC,aAAA,EACA,IAAkCC,EAAAA,4BAA4B,EAC3DC,EAA4BH,EAAoB,YAChDI,EAAwBJ,EAAoB,SAC5CK,EAAwBL,EAAoB,SAC5CM,EAAuCC,EAAAA,IAAI,MAAS,EAE1D,eAAeC,GAAW,CACxB,MAAMC,EAAW,MAAMT,EAAoB,SAAA,EACtCS,EAAS,UACZH,EAAY,MAAQG,EAAS,OAEjC,CAEAC,OAAAA,EAAAA,MACEV,EAAoB,YACpB,MAAOW,EAAmBC,IAAsB,CAC1CD,GAAY,CAACC,IACfZ,EAAoB,SAAS,MA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A,CAAA"}
@@ -0,0 +1,10 @@
1
+ {
2
+ "authentication.nextcloud.modal.username.help": "Gib deinen Benutzernamen ein.",
3
+ "authentication.nextcloud.modal.username.label": "Benutzername",
4
+ "authentication.nextcloud.modal.password.label": "Passwort",
5
+ "authentication.nextcloud.modal.password.help": "Es ist nicht empfehlenswert, dein eigenes Passwort einzugeben. Du solltest stattdessen ein spezielles Passwort für die Anwendung verwenden.",
6
+ "authentication.nextcloud.modal.submit.label": "Anmelden",
7
+ "authentication.nextcloud.modal.error.invalid": "Der Benutzername oder das Passwort stimmt nicht.",
8
+ "authentication.nextcloud.modal.error.generic": "Die Anmeldung hat nicht geklappt. Antwortstatus: {status}.",
9
+ "authentication.nextcloud.modal.title": "Nextcloud Login"
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xwiki/cristal-authentication-nextcloud-ui",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "license": "LGPL 2.1",
5
5
  "author": "XWiki Org Community <contact@xwiki.org>",
6
6
  "homepage": "https://cristal.xwiki.org/",
@@ -28,11 +28,11 @@
28
28
  "main": "./dist/index.es.js",
29
29
  "types": "./dist/index.d.ts",
30
30
  "dependencies": {
31
- "vue-i18n": "11.1.12",
32
- "@xwiki/cristal-api": "0.24.0",
33
- "@xwiki/cristal-authentication-nextcloud-state": "0.24.0",
34
- "@xwiki/cristal-authentication-api": "0.24.0",
35
- "@xwiki/cristal-uiextension-api": "0.24.0"
31
+ "@xwiki/platform-api": "18.0.0-1766398944",
32
+ "@xwiki/platform-authentication-api": "18.0.0-1766398944",
33
+ "vue-i18n": "11.2.2",
34
+ "@xwiki/cristal-authentication-nextcloud-state": "0.25.0",
35
+ "@xwiki/cristal-uiextension-api": "0.25.0"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "inversify": "7.x",
@@ -41,16 +41,16 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@vue/test-utils": "2.4.6",
44
- "inversify": "7.10.4",
44
+ "@xwiki/platform-dsapi": "18.0.0-1766398944",
45
+ "inversify": "7.10.6",
45
46
  "reflect-metadata": "0.2.2",
46
47
  "typescript": "5.9.3",
47
- "vite": "7.1.12",
48
- "vitest": "4.0.6",
49
- "vue": "3.5.22",
50
- "vue-tsc": "3.1.3",
51
- "@xwiki/cristal-dsapi": "0.24.0",
52
- "@xwiki/cristal-dev-test-utils": "0.24.0",
53
- "@xwiki/cristal-dev-config": "0.24.0"
48
+ "vite": "7.2.7",
49
+ "vitest": "4.0.15",
50
+ "vue": "3.5.25",
51
+ "vue-tsc": "3.1.8",
52
+ "@xwiki/cristal-dev-test-utils": "0.25.0",
53
+ "@xwiki/cristal-dev-config": "0.25.0"
54
54
  },
55
55
  "scripts": {
56
56
  "api-extractor:local": "api-extractor run --local",
@@ -19,11 +19,11 @@
19
19
  */
20
20
 
21
21
  import { inject, injectable } from "inversify";
22
+ import type { UIExtension } from "@xwiki/cristal-uiextension-api";
22
23
  import type {
23
24
  AuthenticationManager,
24
25
  AuthenticationManagerProvider,
25
- } from "@xwiki/cristal-authentication-api";
26
- import type { UIExtension } from "@xwiki/cristal-uiextension-api";
26
+ } from "@xwiki/platform-authentication-api";
27
27
  import type { Component } from "vue";
28
28
 
29
29
  /**
@@ -23,7 +23,7 @@ import messages from "../translations";
23
23
  import { NextcloudAuthenticationState } from "@xwiki/cristal-authentication-nextcloud-state";
24
24
  import { inject, ref, watch } from "vue";
25
25
  import { useI18n } from "vue-i18n";
26
- import type { CristalApp } from "@xwiki/cristal-api";
26
+ import type { CristalApp } from "@xwiki/platform-api";
27
27
  import type { Ref } from "vue";
28
28
 
29
29
  const { t } = useI18n({
package/tsconfig.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "outDir": "dist",
5
5
  "resolveJsonModule": true,
6
6
  "isolatedDeclarations": false,
7
- "types": ["@xwiki/cristal-dsapi"]
7
+ "types": ["@xwiki/platform-dsapi"]
8
8
  },
9
9
  "extends": "../../../tsconfig.json",
10
10
  "include": [
package/CHANGELOG.md DELETED
@@ -1,127 +0,0 @@
1
- # @xwiki/cristal-authentication-nextcloud-ui
2
-
3
- ## 0.23.0
4
-
5
- ### Minor Changes
6
-
7
- - Cristal 0.23 Release
8
-
9
- ### Patch Changes
10
-
11
- - Updated dependencies
12
- - @xwiki/cristal-api@0.23.0
13
- - @xwiki/cristal-authentication-api@0.23.0
14
- - @xwiki/cristal-authentication-nextcloud-state@0.23.0
15
- - @xwiki/cristal-uiextension-api@0.23.0
16
-
17
- ## 0.22.0
18
-
19
- ### Minor Changes
20
-
21
- - Cristal 0.22 Release
22
-
23
- ### Patch Changes
24
-
25
- - Updated dependencies
26
- - @xwiki/cristal-api@0.22.0
27
- - @xwiki/cristal-authentication-api@0.22.0
28
- - @xwiki/cristal-authentication-nextcloud-state@0.22.0
29
- - @xwiki/cristal-uiextension-api@0.22.0
30
-
31
- ## 0.21.0
32
-
33
- ### Minor Changes
34
-
35
- - Cristal 0.21 Release
36
-
37
- ### Patch Changes
38
-
39
- - Updated dependencies
40
- - @xwiki/cristal-api@0.21.0
41
- - @xwiki/cristal-authentication-api@0.21.0
42
- - @xwiki/cristal-authentication-nextcloud-state@0.21.0
43
- - @xwiki/cristal-uiextension-api@0.21.0
44
-
45
- ## 0.20.0
46
-
47
- ### Minor Changes
48
-
49
- - Cristal 0.20 Release
50
-
51
- ### Patch Changes
52
-
53
- - Updated dependencies
54
- - @xwiki/cristal-api@0.20.0
55
- - @xwiki/cristal-authentication-api@0.20.0
56
- - @xwiki/cristal-authentication-nextcloud-state@0.20.0
57
- - @xwiki/cristal-uiextension-api@0.20.0
58
-
59
- ## 0.20.0-rc.0
60
-
61
- ### Minor Changes
62
-
63
- - Cristal 0.20-rc-1 Release
64
-
65
- ### Patch Changes
66
-
67
- - Updated dependencies
68
- - @xwiki/cristal-api@0.20.0-rc.0
69
- - @xwiki/cristal-authentication-api@0.20.0-rc.0
70
- - @xwiki/cristal-authentication-nextcloud-state@0.20.0-rc.0
71
- - @xwiki/cristal-uiextension-api@0.20.0-rc.0
72
-
73
- ## 0.19.0
74
-
75
- ### Minor Changes
76
-
77
- - 3eea53e: Cristal 0.19 Release
78
-
79
- ### Patch Changes
80
-
81
- - Updated dependencies [3eea53e]
82
- - @xwiki/cristal-api@0.19.0
83
- - @xwiki/cristal-authentication-api@0.19.0
84
- - @xwiki/cristal-authentication-nextcloud-state@0.19.0
85
- - @xwiki/cristal-uiextension-api@0.19.0
86
-
87
- ## 0.18.0
88
-
89
- ### Minor Changes
90
-
91
- - Cristal 0.18 Release
92
-
93
- ### Patch Changes
94
-
95
- - Updated dependencies
96
- - @xwiki/cristal-api@0.18.0
97
- - @xwiki/cristal-authentication-api@0.18.0
98
- - @xwiki/cristal-authentication-nextcloud-state@0.18.0
99
- - @xwiki/cristal-uiextension-api@0.18.0
100
-
101
- ## 0.17.0
102
-
103
- ### Minor Changes
104
-
105
- - Cristal 0.17 Release
106
-
107
- ### Patch Changes
108
-
109
- - Updated dependencies
110
- - @xwiki/cristal-api@0.17.0
111
- - @xwiki/cristal-authentication-api@0.17.0
112
- - @xwiki/cristal-authentication-nextcloud-state@0.17.0
113
- - @xwiki/cristal-uiextension-api@0.17.0
114
-
115
- ## 0.16.0
116
-
117
- ### Minor Changes
118
-
119
- - Cristal 0.16 Release
120
-
121
- ### Patch Changes
122
-
123
- - Updated dependencies
124
- - @xwiki/cristal-api@0.16.0
125
- - @xwiki/cristal-authentication-api@0.16.0
126
- - @xwiki/cristal-authentication-nextcloud-state@0.16.0
127
- - @xwiki/cristal-uiextension-api@0.16.0
@@ -1 +0,0 @@
1
- {"version":3,"file":"NextcloudLoginMenu-KxFlJo82.js","sources":["../src/translations.ts","../src/vue/NextcloudLoginMenu.vue"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport en from \"../langs/translation-en.json\";\nimport fr from \"../langs/translation-fr.json\";\n\nconst translations = {\n en,\n fr,\n};\nexport default translations;\n","<!--\n See the LICENSE file distributed with this work for additional\n information regarding copyright ownership.\n\n This is free software; you can redistribute it and/or modify it\n under the terms of the GNU Lesser General Public License as\n published by the Free Software Foundation; either version 2.1 of\n the License, or (at your option) any later version.\n\n This software is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public\n License along with this software; if not, write to the Free\n Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n-->\n\n<script lang=\"ts\" setup>\nimport messages from \"../translations\";\nimport { NextcloudAuthenticationState } from \"@xwiki/cristal-authentication-nextcloud-state\";\nimport { inject, ref, watch } from \"vue\";\nimport { useI18n } from \"vue-i18n\";\nimport type { CristalApp } from \"@xwiki/cristal-api\";\nimport type { Ref } from \"vue\";\n\nconst { t } = useI18n({\n messages,\n});\n\nconst cristal = inject<CristalApp>(\"cristal\")!;\n\nconst authenticationState = cristal\n .getContainer()\n .get<NextcloudAuthenticationState>(NextcloudAuthenticationState);\nconst modalOpened: Ref<boolean> = authenticationState.modalOpened;\nconst username: Ref<string> = authenticationState.username;\nconst password: Ref<string> = authenticationState.password;\nconst errorStatus: Ref<number | undefined> = ref(undefined);\n\nasync function callback() {\n const response = await authenticationState.callback();\n if (!response.success) {\n errorStatus.value = response.status;\n }\n}\n\nwatch(\n authenticationState.modalOpened,\n async (newValue: boolean, oldValue: boolean) => {\n if (newValue && !oldValue) {\n authenticationState.username.value = \"\";\n authenticationState.password.value = \"\";\n errorStatus.value = undefined;\n }\n },\n);\n</script>\n\n<template>\n <x-dialog\n v-model=\"modalOpened\"\n width=\"auto\"\n :title=\"t('authentication.nextcloud.modal.title')\"\n >\n <template #default>\n <!-- We need 2 different divs to implement the following behavior:\n - Use max available width from the parent\n - Do not resize the parent if the content is larger -->\n <div class=\"alerts-wrapper\">\n <div class=\"alerts\">\n <x-alert v-if=\"errorStatus === 401\" type=\"error\">\n {{ t(\"authentication.nextcloud.modal.error.invalid\") }}\n </x-alert>\n <x-alert v-else-if=\"errorStatus !== undefined\" type=\"error\">\n {{\n t(\"authentication.nextcloud.modal.error.generic\", {\n status: errorStatus,\n })\n }}\n </x-alert>\n </div>\n </div>\n <x-form id=\"nextcloud-login-form\" @submit=\"callback\">\n <x-text-field\n v-model=\"username\"\n :label=\"t('authentication.nextcloud.modal.username.label')\"\n :help=\"t('authentication.nextcloud.modal.username.help')\"\n autofocus\n required\n ></x-text-field>\n <x-text-field\n v-model=\"password\"\n type=\"password\"\n :label=\"t('authentication.nextcloud.modal.password.label')\"\n :help=\"t('authentication.nextcloud.modal.password.help')\"\n ></x-text-field>\n </x-form>\n </template>\n <template #footer>\n <x-btn variant=\"primary\" type=\"submit\" form=\"nextcloud-login-form\">{{\n t(\"authentication.nextcloud.modal.submit.label\")\n }}</x-btn>\n </template>\n </x-dialog>\n</template>\n\n<style scoped>\n.alerts-wrapper {\n display: flex;\n}\n.alerts {\n flex-grow: 1;\n width: 0;\n}\n</style>\n"],"names":["translations","en","fr","useI18n","messages","authenticationState","inject","NextcloudAuthenticationState","modalOpened","username","password","errorStatus","ref","callback","response","watch","newValue","oldValue","_createBlock","_component_x_dialog","_unref","$event","_createElementVNode","_hoisted_1","_hoisted_2","_component_x_alert","_createVNode","_component_x_form","_component_x_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