@xwiki/cristal-authentication-nextcloud-ui 1.0.0 → 1.1.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.
@@ -1,4 +1,4 @@
1
- import { defineComponent as C, inject as I, ref as L, watch as O, resolveComponent as d, createBlock as h, openBlock as _, unref as e, isRef as f, withCtx as n, createVNode as r, createTextVNode as v, toDisplayString as b, createElementVNode as y, createCommentVNode as U } from "vue";
1
+ import { defineComponent as C, inject as I, ref as L, watch as O, resolveComponent as d, openBlock as h, createBlock as _, unref as e, isRef as f, withCtx as n, createVNode as r, createTextVNode as v, toDisplayString as b, createElementVNode as y, createCommentVNode as U } from "vue";
2
2
  import { NextcloudAuthenticationState as M } from "@xwiki/cristal-authentication-nextcloud-state";
3
3
  import { useI18n as z } from "vue-i18n";
4
4
  const B = {
@@ -39,7 +39,7 @@ const B = {
39
39
  }
40
40
  ), (i, a) => {
41
41
  const w = d("x-alert"), g = d("x-text-field"), N = d("x-form"), k = d("x-btn"), S = d("x-dialog");
42
- return _(), h(S, {
42
+ return h(), _(S, {
43
43
  modelValue: e(l),
44
44
  "onUpdate:modelValue": a[2] || (a[2] = (u) => f(l) ? l.value = u : null),
45
45
  width: "auto",
@@ -48,7 +48,7 @@ const B = {
48
48
  default: n(() => [
49
49
  y("div", j, [
50
50
  y("div", q, [
51
- s.value === 401 ? (_(), h(w, {
51
+ s.value === 401 ? (h(), _(w, {
52
52
  key: 0,
53
53
  type: "error"
54
54
  }, {
@@ -56,7 +56,7 @@ const B = {
56
56
  v(b(e(t)("authentication.nextcloud.modal.error.invalid")), 1)
57
57
  ]),
58
58
  _: 1
59
- })) : s.value !== void 0 ? (_(), h(w, {
59
+ })) : s.value !== void 0 ? (h(), _(w, {
60
60
  key: 1,
61
61
  type: "error"
62
62
  }, {
@@ -118,4 +118,4 @@ const B = {
118
118
  export {
119
119
  G as default
120
120
  };
121
- //# sourceMappingURL=NextcloudLoginMenu-DAg25dSf.js.map
121
+ //# sourceMappingURL=NextcloudLoginMenu-BhEWp9P3.js.map
@@ -1 +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,QAAID,KAAY,CAACC,MACfZ,EAAoB,SAAS,QAAQ,IACrCA,EAAoB,SAAS,QAAQ,IACrCM,EAAY,QAAQ;AAAA,MAExB;AAAA,IAAA;;kBAKAO,EA4CWC,GAAA;AAAA,oBA3CAC,EAAAZ,CAAA;AAAA,6DAAAA,EAAW,QAAAa,IAAA;AAAA,QACpB,OAAM;AAAA,QACL,OAAOD,EAAA,CAAA,EAAC,sCAAA;AAAA,MAAA;QAEE,WAIT,MAaM;AAAA,UAbNE,EAaM,OAbNC,GAaM;AAAA,YAZJD,EAWM,OAXNE,GAWM;AAAA,cAVWb,EAAA,UAAW,YAA1BO,EAEUO,GAAA;AAAA;gBAF0B,MAAK;AAAA,cAAA;2BACvC,MAAuD;AAAA,sBAApDL,EAAA,CAAA,EAAC,8CAAA,CAAA,GAAA,CAAA;AAAA,gBAAA;;oBAEcT,EAAA,UAAgB,eAApCO,EAMUO,GAAA;AAAA;gBANqC,MAAK;AAAA,cAAA;2BAClD,MAIE;AAAA,sBAHAL,EAAA,CAAA,EAAC,gDAAA;AAAA,4BAA2ET,EAAA;AAAA,kBAAA;;;;;;UAOpFe,EAcSC,GAAA;AAAA,YAdD,IAAG;AAAA,YAAwB,UAAQd;AAAA,UAAA;uBACzC,MAMgB;AAAA,cANhBa,EAMgBE,GAAA;AAAA,4BALLR,EAAAX,CAAA;AAAA,qEAAAA,EAAQ,QAAAY,IAAA;AAAA,gBAChB,OAAOD,EAAA,CAAA,EAAC,+CAAA;AAAA,gBACR,MAAMA,EAAA,CAAA,EAAC,8CAAA;AAAA,gBACR,WAAA;AAAA,gBACA,UAAA;AAAA,cAAA;cAEFM,EAKgBE,GAAA;AAAA,4BAJLR,EAAAV,CAAA;AAAA,qEAAAA,EAAQ,QAAAW,IAAA;AAAA,gBACjB,MAAK;AAAA,gBACJ,OAAOD,EAAA,CAAA,EAAC,+CAAA;AAAA,gBACR,MAAMA,EAAA,CAAA,EAAC,8CAAA;AAAA,cAAA;;;;;QAIH,UACT,MAEU;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
+ {"version":3,"file":"NextcloudLoginMenu-BhEWp9P3.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,QAAID,KAAY,CAACC,MACfZ,EAAoB,SAAS,QAAQ,IACrCA,EAAoB,SAAS,QAAQ,IACrCM,EAAY,QAAQ;AAAA,MAExB;AAAA,IAAA;;kBAKAO,EA4CWC,GAAA;AAAA,oBA3CAC,EAAAZ,CAAA;AAAA,6DAAAA,EAAW,QAAAa,IAAA;AAAA,QACpB,OAAM;AAAA,QACL,OAAOD,EAAA,CAAA,EAAC,sCAAA;AAAA,MAAA;QAEE,WAIT,MAaM;AAAA,UAbNE,EAaM,OAbNC,GAaM;AAAA,YAZJD,EAWM,OAXNE,GAWM;AAAA,cAVWb,EAAA,UAAW,YAA1BO,EAEUO,GAAA;AAAA;gBAF0B,MAAK;AAAA,cAAA;2BACvC,MAAuD;AAAA,sBAApDL,EAAA,CAAA,EAAC,8CAAA,CAAA,GAAA,CAAA;AAAA,gBAAA;;oBAEcT,EAAA,UAAgB,eAApCO,EAMUO,GAAA;AAAA;gBANqC,MAAK;AAAA,cAAA;2BAClD,MAIE;AAAA,sBAHAL,EAAA,CAAA,EAAC,gDAAA;AAAA,4BAA2ET,EAAA;AAAA,kBAAA;;;;;;UAOpFe,EAcSC,GAAA;AAAA,YAdD,IAAG;AAAA,YAAwB,UAAQd;AAAA,UAAA;uBACzC,MAMgB;AAAA,cANhBa,EAMgBE,GAAA;AAAA,4BALLR,EAAAX,CAAA;AAAA,qEAAAA,EAAQ,QAAAY,IAAA;AAAA,gBAChB,OAAOD,EAAA,CAAA,EAAC,+CAAA;AAAA,gBACR,MAAMA,EAAA,CAAA,EAAC,8CAAA;AAAA,gBACR,WAAA;AAAA,gBACA,UAAA;AAAA,cAAA;cAEFM,EAKgBE,GAAA;AAAA,4BAJLR,EAAAV,CAAA;AAAA,qEAAAA,EAAQ,QAAAW,IAAA;AAAA,gBACjB,MAAK;AAAA,gBACJ,OAAOD,EAAA,CAAA,EAAC,+CAAA;AAAA,gBACR,MAAMA,EAAA,CAAA,EAAC,8CAAA;AAAA,cAAA;;;;;QAIH,UACT,MAEU;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;;;;;;;;;;;;;;"}
package/dist/index.es.js CHANGED
@@ -14,7 +14,7 @@ let o = class {
14
14
  order = 2100;
15
15
  parameters = {};
16
16
  async component() {
17
- return (await import("./NextcloudLoginMenu-DAg25dSf.js")).default;
17
+ return (await import("./NextcloudLoginMenu-BhEWp9P3.js")).default;
18
18
  }
19
19
  async enabled() {
20
20
  return !await this.authenticationManager.get()?.isAuthenticated();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xwiki/cristal-authentication-nextcloud-ui",
3
- "version": "1.0.0",
3
+ "version": "1.1.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
- "@xwiki/platform-api": "18.0.0",
32
- "@xwiki/platform-authentication-api": "18.0.0",
33
- "vue-i18n": "11.2.2",
34
- "@xwiki/cristal-authentication-nextcloud-state": "1.0.0",
35
- "@xwiki/cristal-uiextension-api": "1.0.0"
31
+ "@xwiki/platform-api": "18.1.0",
32
+ "@xwiki/platform-authentication-api": "18.1.0",
33
+ "vue-i18n": "11.2.8",
34
+ "@xwiki/cristal-uiextension-api": "1.1.0",
35
+ "@xwiki/cristal-authentication-nextcloud-state": "1.1.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
- "@xwiki/platform-dsapi": "18.0.0",
44
+ "@xwiki/platform-dsapi": "18.1.0",
45
45
  "inversify": "7.11.0",
46
46
  "reflect-metadata": "0.2.2",
47
47
  "typescript": "5.9.3",
48
48
  "vite": "7.3.1",
49
- "vitest": "4.0.16",
50
- "vue": "3.5.26",
51
- "vue-tsc": "3.2.2",
52
- "@xwiki/cristal-dev-config": "1.0.0",
53
- "@xwiki/cristal-dev-test-utils": "1.0.0"
49
+ "vitest": "4.0.18",
50
+ "vue": "3.5.28",
51
+ "vue-tsc": "3.2.4",
52
+ "@xwiki/cristal-dev-test-utils": "1.1.0",
53
+ "@xwiki/cristal-dev-config": "1.1.0"
54
54
  },
55
55
  "scripts": {
56
56
  "api-extractor:local": "api-extractor run --local",