core-recommendedapps.js 9.3 KB

123
  1. /*! For license information please see core-recommendedapps.js.LICENSE.txt */
  2. (()=>{"use strict";var t,n={28151:(t,n,e)=>{var o=e(92457),a=e(53334),i=e(85471),r=e(53529);const s=null===(l=(0,o.HW)())?(0,r.YK)().setApp("core").build():(0,r.YK)().setApp("core").setUid(l.uid).build();var l,c=e(26287),p=e(99498),d=e(38613),u=e(98959);function A(t){if(!Number.isInteger(t)&&t!==Number.POSITIVE_INFINITY||!(t>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up");const n=new u.A;let e=0;const o=async(t,o,a)=>{e++;const i=(async()=>t(...a))();o(i);try{await i}catch{}e--,n.size>0&&n.dequeue()()},a=function(a){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];return new Promise((i=>{((a,i,r)=>{n.enqueue(o.bind(void 0,a,i,r)),(async()=>{await Promise.resolve(),e<t&&n.size>0&&n.dequeue()()})()})(a,i,r)}))};return Object.defineProperties(a,{activeCount:{get:()=>e},pendingCount:{get:()=>n.size},clearQueue:{value:()=>{n.clear()}}}),a}var m=e(54576);const g={calendar:{description:(0,a.Tl)("core","Schedule work & meetings, synced with all your devices."),icon:(0,p.d0)("core","places/calendar.svg")},contacts:{description:(0,a.Tl)("core","Keep your colleagues and friends in one place without leaking their private info."),icon:(0,p.d0)("core","places/contacts.svg")},mail:{description:(0,a.Tl)("core","Simple email app nicely integrated with Files, Contacts and Calendar."),icon:(0,p.d0)("core","actions/mail.svg")},spreed:{description:(0,a.Tl)("core","Chatting, video calls, screensharing, online meetings and web conferencing – in your browser and with mobile apps."),icon:(0,p.d0)("core","apps/spreed.svg")},richdocuments:{name:"Nextcloud Office",description:(0,a.Tl)("core","Collaborative documents, spreadsheets and presentations, built on Collabora Online."),icon:(0,p.d0)("core","apps/richdocuments.svg")},notes:{description:(0,a.Tl)("core","Distraction free note taking app."),icon:(0,p.d0)("core","apps/notes.svg")},richdocumentscode:{hidden:!0}},h=Object.keys(g),f={name:"RecommendedApps",components:{NcButton:m.A},data:()=>({showInstallButton:!1,installingApps:!1,loadingApps:!0,loadingAppsError:!1,apps:[],defaultPageUrl:(0,d.C)("core","defaultPageUrl")}),computed:{recommendedApps(){return this.apps.filter((t=>h.includes(t.id)))}},async mounted(){try{const{data:t}=await c.A.get((0,p.Jv)("settings/apps/list"));s.info("".concat(t.apps.length," apps fetched")),this.apps=t.apps.map((t=>Object.assign(t,{loading:!1,installationError:!1}))),s.debug("".concat(this.recommendedApps.length," recommended apps found"),{apps:this.recommendedApps}),this.showInstallButton=!0}catch(t){s.error("could not fetch app list",{error:t}),this.loadingAppsError=!0}finally{this.loadingApps=!1}},methods:{installApps(){this.showInstallButton=!1,this.installingApps=!0;const t=A(1),n=this.recommendedApps.filter((t=>!t.active&&t.isCompatible&&t.canInstall)).map((n=>t((()=>(s.info("installing ".concat(n.id)),n.loading=!0,c.A.post((0,p.Jv)("settings/apps/enable"),{appIds:[n.id],groups:[]}).catch((t=>{s.error("could not install ".concat(n.id),{error:t}),n.installationError=!0})).then((()=>{s.info("installed ".concat(n.id)),n.loading=!1})))))));s.debug("installing ".concat(n.length," recommended apps")),Promise.all(n).then((()=>{s.info("all recommended apps installed, redirecting …"),window.location=this.defaultPageUrl})).catch((t=>s.error("could not install recommended apps",{error:t})))},customIcon:t=>t in g&&g[t].icon?g[t].icon:(s.warn("no app icon for recommended app ".concat(t)),(0,p.d0)("core","places/default-app-icon.svg")),customName:t=>t.id in g&&g[t.id].name||t.name,customDescription:t=>t in g?g[t].description:(s.warn("no app description for recommended app ".concat(t)),""),isHidden:t=>t in g&&!!g[t].hidden}};var v=e(85072),b=e.n(v),C=e(97825),y=e.n(C),w=e(77659),_=e.n(w),x=e(55056),k=e.n(x),I=e(10540),O=e.n(I),B=e(41113),P=e.n(B),T=e(83276),j={};j.styleTagTransform=P(),j.setAttributes=k(),j.insert=_().bind(null,"head"),j.domAPI=y(),j.insertStyleElement=O(),b()(T.A,j),T.A&&T.A.locals&&T.A.locals;const E=(0,e(14486).A)(f,(function(){var t=this,n=t._self._c;return n("div",{staticClass:"guest-box"},[n("h2",[t._v(t._s(t.t("core","Recommended apps")))]),t._v(" "),t.loadingApps?n("p",{staticClass:"loading text-center"},[t._v("\n\t\t"+t._s(t.t("core","Loading apps …"))+"\n\t")]):t.loadingAppsError?n("p",{staticClass:"loading-error text-center"},[t._v("\n\t\t"+t._s(t.t("core","Could not fetch list of apps from the App Store."))+"\n\t")]):t.installingApps?n("p",{staticClass:"text-center"},[t._v("\n\t\t"+t._s(t.t("core","Installing apps …"))+"\n\t")]):t._e(),t._v(" "),t._l(t.recommendedApps,(function(e){return n("div",{key:e.id,staticClass:"app"},[t.isHidden(e.id)?t._e():[n("img",{attrs:{src:t.customIcon(e.id),alt:""}}),t._v(" "),n("div",{staticClass:"info"},[n("h3",[t._v("\n\t\t\t\t\t"+t._s(t.customName(e))+"\n\t\t\t\t\t"),e.loading?n("span",{staticClass:"icon icon-loading-small-dark"}):e.active?n("span",{staticClass:"icon icon-checkmark-white"}):t._e()]),t._v(" "),n("p",{domProps:{innerHTML:t._s(t.customDescription(e.id))}}),t._v(" "),e.installationError?n("p",[n("strong",[t._v(t._s(t.t("core","App download or installation failed")))])]):e.isCompatible?e.canInstall?t._e():n("p",[n("strong",[t._v(t._s(t.t("core","Cannot install this app")))])]):n("p",[n("strong",[t._v(t._s(t.t("core","Cannot install this app because it is not compatible")))])])])]],2)})),t._v(" "),n("div",{staticClass:"dialog-row"},[t.showInstallButton?n("NcButton",{attrs:{type:"tertiary",role:"link",href:t.defaultPageUrl}},[t._v("\n\t\t\t"+t._s(t.t("core","Skip"))+"\n\t\t")]):t._e(),t._v(" "),t.showInstallButton?n("NcButton",{attrs:{type:"primary"},on:{click:function(n){return n.stopPropagation(),n.preventDefault(),t.installApps.apply(null,arguments)}}},[t._v("\n\t\t\t"+t._s(t.t("core","Install recommended apps"))+"\n\t\t")]):t._e()],1)],2)}),[],!1,null,"880500b4",null).exports;e.nc=btoa((0,o.do)()),i.Ay.mixin({methods:{t:a.Tl}}),(new(i.Ay.extend(E))).$mount("#recommended-apps"),s.debug("recommended apps view rendered")},83276:(t,n,e)=>{e.d(n,{A:()=>s});var o=e(71354),a=e.n(o),i=e(76314),r=e.n(i)()(a());r.push([t.id,".dialog-row[data-v-880500b4]{display:flex;justify-content:end;margin-top:8px}p.loading[data-v-880500b4],p.loading-error[data-v-880500b4]{height:100px}p[data-v-880500b4]:last-child{margin-top:10px}.text-center[data-v-880500b4]{text-align:center}.app[data-v-880500b4]{display:flex;flex-direction:row}.app img[data-v-880500b4]{height:50px;width:50px;filter:var(--background-invert-if-dark)}.app img[data-v-880500b4],.app .info[data-v-880500b4]{padding:12px}.app .info h3[data-v-880500b4],.app .info p[data-v-880500b4]{text-align:left}.app .info h3[data-v-880500b4]{margin-top:0}.app .info h3>span.icon[data-v-880500b4]{display:inline-block}","",{version:3,sources:["webpack://./core/src/components/setup/RecommendedApps.vue"],names:[],mappings:"AACA,6BACC,YAAA,CACA,mBAAA,CACA,cAAA,CAIA,4DAEC,YAAA,CAGD,8BACC,eAAA,CAIF,8BACC,iBAAA,CAGD,sBACC,YAAA,CACA,kBAAA,CAEA,0BACC,WAAA,CACA,UAAA,CACA,uCAAA,CAGD,sDACC,YAAA,CAIA,6DACC,eAAA,CAGD,+BACC,YAAA,CAGD,yCACC,oBAAA",sourcesContent:["\n.dialog-row {\n\tdisplay: flex;\n\tjustify-content: end;\n\tmargin-top: 8px;\n}\n\np {\n\t&.loading,\n\t&.loading-error {\n\t\theight: 100px;\n\t}\n\n\t&:last-child {\n\t\tmargin-top: 10px;\n\t}\n}\n\n.text-center {\n\ttext-align: center;\n}\n\n.app {\n\tdisplay: flex;\n\tflex-direction: row;\n\n\timg {\n\t\theight: 50px;\n\t\twidth: 50px;\n\t\tfilter: var(--background-invert-if-dark);\n\t}\n\n\timg, .info {\n\t\tpadding: 12px;\n\t}\n\n\t.info {\n\t\th3, p {\n\t\t\ttext-align: left;\n\t\t}\n\n\t\th3 {\n\t\t\tmargin-top: 0;\n\t\t}\n\n\t\th3 > span.icon {\n\t\t\tdisplay: inline-block;\n\t\t}\n\t}\n}\n"],sourceRoot:""}]);const s=r}},e={};function o(t){var a=e[t];if(void 0!==a)return a.exports;var i=e[t]={id:t,loaded:!1,exports:{}};return n[t].call(i.exports,i,i.exports,o),i.loaded=!0,i.exports}o.m=n,t=[],o.O=(n,e,a,i)=>{if(!e){var r=1/0;for(p=0;p<t.length;p++){e=t[p][0],a=t[p][1],i=t[p][2];for(var s=!0,l=0;l<e.length;l++)(!1&i||r>=i)&&Object.keys(o.O).every((t=>o.O[t](e[l])))?e.splice(l--,1):(s=!1,i<r&&(r=i));if(s){t.splice(p--,1);var c=a();void 0!==c&&(n=c)}}return n}i=i||0;for(var p=t.length;p>0&&t[p-1][2]>i;p--)t[p]=t[p-1];t[p]=[e,a,i]},o.n=t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return o.d(n,{a:n}),n},o.d=(t,n)=>{for(var e in n)o.o(n,e)&&!o.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})},o.e=()=>Promise.resolve(),o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),o.j=2696,(()=>{o.b=document.baseURI||self.location.href;var t={2696:0};o.O.j=n=>0===t[n];var n=(n,e)=>{var a,i,r=e[0],s=e[1],l=e[2],c=0;if(r.some((n=>0!==t[n]))){for(a in s)o.o(s,a)&&(o.m[a]=s[a]);if(l)var p=l(o)}for(n&&n(e);c<r.length;c++)i=r[c],o.o(t,i)&&t[i]&&t[i][0](),t[i]=0;return o.O(p)},e=self.webpackChunknextcloud=self.webpackChunknextcloud||[];e.forEach(n.bind(null,0)),e.push=n.bind(null,e.push.bind(e))})(),o.nc=void 0;var a=o.O(void 0,[4208],(()=>o(28151)));a=o.O(a)})();
  3. //# sourceMappingURL=core-recommendedapps.js.map?v=7e1fe8a9f91c0724cace