1
0

core-recommendedapps.js 9.7 KB

123
  1. /*! For license information please see core-recommendedapps.js.LICENSE.txt */
  2. !function(){"use strict";var n,t={69295:function(n,t,e){var o,i=e(45994),a=e(31352),r=e(20144),s=e(17499),c=null===(o=(0,i.ts)())?(0,s.IY)().setApp("core").build():(0,s.IY)().setApp("core").setUid(o.uid).build(),p=e(4820),l=e(79753),d=e(79954),u=e(63560),f=e(10861),g=e.n(f);function m(n,t,e,o,i,a,r){try{var s=n[a](r),c=s.value}catch(n){return void e(n)}s.done?t(c):Promise.resolve(c).then(o,i)}var A={calendar:{description:(0,a.Iu)("core","Schedule work & meetings, synced with all your devices."),icon:(0,l.imagePath)("core","places/calendar.svg")},contacts:{description:(0,a.Iu)("core","Keep your colleagues and friends in one place without leaking their private info."),icon:(0,l.imagePath)("core","places/contacts.svg")},mail:{description:(0,a.Iu)("core","Simple email app nicely integrated with Files, Contacts and Calendar."),icon:(0,l.imagePath)("core","actions/mail.svg")},spreed:{description:(0,a.Iu)("core","Chatting, video calls, screensharing, online meetings and web conferencing – in your browser and with mobile apps."),icon:(0,l.imagePath)("core","apps/spreed.svg")},richdocuments:{name:"Nextcloud Office",description:(0,a.Iu)("core","Collaborative documents, spreadsheets and presentations, built on Collabora Online."),icon:(0,l.imagePath)("core","apps/richdocuments.svg")},notes:{description:(0,a.Iu)("core","Distraction free note taking app."),icon:(0,l.imagePath)("core","apps/notes.svg")},richdocumentscode:{hidden:!0}},h=Object.keys(A),v=(0,d.j)("core","defaultPageUrl"),b={name:"RecommendedApps",components:{NcButton:g()},data:function(){return{showInstallButton:!1,installingApps:!1,loadingApps:!0,loadingAppsError:!1,apps:[],defaultPageUrl:v}},computed:{recommendedApps:function(){return this.apps.filter((function(n){return h.includes(n.id)}))}},mounted:function(){var n,t=this;return(n=regeneratorRuntime.mark((function n(){var e,o;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,p.default.get((0,l.generateUrl)("settings/apps/list"));case 3:e=n.sent,o=e.data,c.info("".concat(o.apps.length," apps fetched")),t.apps=o.apps.map((function(n){return Object.assign(n,{loading:!1,installationError:!1})})),c.debug("".concat(t.recommendedApps.length," recommended apps found"),{apps:t.recommendedApps}),t.showInstallButton=!0,n.next=15;break;case 11:n.prev=11,n.t0=n.catch(0),c.error("could not fetch app list",{error:n.t0}),t.loadingAppsError=!0;case 15:return n.prev=15,t.loadingApps=!1,n.finish(15);case 18:case"end":return n.stop()}}),n,null,[[0,11,15,18]])})),function(){var t=this,e=arguments;return new Promise((function(o,i){var a=n.apply(t,e);function r(n){m(a,o,i,r,s,"next",n)}function s(n){m(a,o,i,r,s,"throw",n)}r(void 0)}))})()},methods:{installApps:function(){this.showInstallButton=!1,this.installingApps=!0;var n=(0,u.Z)(1),t=this.recommendedApps.filter((function(n){return!n.active&&n.isCompatible&&n.canInstall})).map((function(t){return n((function(){return c.info("installing ".concat(t.id)),t.loading=!0,p.default.post((0,l.generateUrl)("settings/apps/enable"),{appIds:[t.id],groups:[]}).catch((function(n){c.error("could not install ".concat(t.id),{error:n}),t.installationError=!0})).then((function(){c.info("installed ".concat(t.id)),t.loading=!1}))}))}));c.debug("installing ".concat(t.length," recommended apps")),Promise.all(t).then((function(){c.info("all recommended apps installed, redirecting …"),window.location=v})).catch((function(n){return c.error("could not install recommended apps",{error:n})}))},customIcon:function(n){return n in A&&A[n].icon?A[n].icon:(c.warn("no app icon for recommended app ".concat(n)),(0,l.imagePath)("core","places/default-app-icon.svg"))},customName:function(n){return n.id in A&&A[n.id].name||n.name},customDescription:function(n){return n in A?A[n].description:(c.warn("no app description for recommended app ".concat(n)),"")},isHidden:function(n){return n in A&&!!A[n].hidden},goTo:function(n){window.location.href=n}}},C=b,x=e(93379),w=e.n(x),_=e(7795),y=e.n(_),k=e(90569),I=e.n(k),P=e(3565),B=e.n(P),O=e(19216),j=e.n(O),D=e(44589),E=e.n(D),S=e(84430),T={};T.styleTagTransform=E(),T.setAttributes=B(),T.insert=I().bind(null,"head"),T.domAPI=y(),T.insertStyleElement=j(),w()(S.Z,T),S.Z&&S.Z.locals&&S.Z.locals;var U=(0,e(51900).Z)(C,(function(){var n=this,t=n._self._c;return t("div",{staticClass:"guest-box"},[t("h2",[n._v(n._s(n.t("core","Recommended apps")))]),n._v(" "),n.loadingApps?t("p",{staticClass:"loading text-center"},[n._v("\n\t\t"+n._s(n.t("core","Loading apps …"))+"\n\t")]):n.loadingAppsError?t("p",{staticClass:"loading-error text-center"},[n._v("\n\t\t"+n._s(n.t("core","Could not fetch list of apps from the App Store."))+"\n\t")]):n.installingApps?t("p",{staticClass:"text-center"},[n._v("\n\t\t"+n._s(n.t("core","Installing apps …"))+"\n\t")]):n._e(),n._v(" "),n._l(n.recommendedApps,(function(e){return t("div",{key:e.id,staticClass:"app"},[n.isHidden(e.id)?n._e():[t("img",{attrs:{src:n.customIcon(e.id),alt:""}}),n._v(" "),t("div",{staticClass:"info"},[t("h3",[n._v("\n\t\t\t\t\t"+n._s(n.customName(e))+"\n\t\t\t\t\t"),e.loading?t("span",{staticClass:"icon icon-loading-small-dark"}):e.active?t("span",{staticClass:"icon icon-checkmark-white"}):n._e()]),n._v(" "),t("p",{domProps:{innerHTML:n._s(n.customDescription(e.id))}}),n._v(" "),e.installationError?t("p",[t("strong",[n._v(n._s(n.t("core","App download or installation failed")))])]):e.isCompatible?e.canInstall?n._e():t("p",[t("strong",[n._v(n._s(n.t("core","Cannot install this app")))])]):t("p",[t("strong",[n._v(n._s(n.t("core","Cannot install this app because it is not compatible")))])])])]],2)})),n._v(" "),t("div",{staticClass:"dialog-row"},[n.showInstallButton?t("NcButton",{attrs:{type:"tertiary",role:"link",href:"defaultPageUrl"},on:{click:function(t){return n.goTo(n.defaultPageUrl)}}},[n._v("\n\t\t\t"+n._s(n.t("core","Skip"))+"\n\t\t")]):n._e(),n._v(" "),n.showInstallButton?t("NcButton",{attrs:{type:"primary"},on:{click:function(t){return t.stopPropagation(),t.preventDefault(),n.installApps.apply(null,arguments)}}},[n._v("\n\t\t\t"+n._s(n.t("core","Install recommended apps"))+"\n\t\t")]):n._e()],1)],2)}),[],!1,null,"b72b44fa",null),Z=U.exports;e.nc=btoa((0,i.IH)()),r.ZP.mixin({methods:{t:a.Iu}}),(new(r.ZP.extend(Z))).$mount("#recommended-apps"),c.debug("recommended apps view rendered")},84430:function(n,t,e){var o=e(87537),i=e.n(o),a=e(23645),r=e.n(a)()(i());r.push([n.id,".dialog-row[data-v-b72b44fa]{display:flex;justify-content:end;margin-top:8px}p.loading[data-v-b72b44fa],p.loading-error[data-v-b72b44fa]{height:100px}p[data-v-b72b44fa]:last-child{margin-top:10px}.text-center[data-v-b72b44fa]{text-align:center}.app[data-v-b72b44fa]{display:flex;flex-direction:row}.app img[data-v-b72b44fa]{height:50px;width:50px;filter:var(--background-invert-if-dark)}.app img[data-v-b72b44fa],.app .info[data-v-b72b44fa]{padding:12px}.app .info h3[data-v-b72b44fa],.app .info p[data-v-b72b44fa]{text-align:left}.app .info h3[data-v-b72b44fa]{margin-top:0}.app .info h3>span.icon[data-v-b72b44fa]{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:""}]),t.Z=r}},e={};function o(n){var i=e[n];if(void 0!==i)return i.exports;var a=e[n]={id:n,loaded:!1,exports:{}};return t[n].call(a.exports,a,a.exports,o),a.loaded=!0,a.exports}o.m=t,n=[],o.O=function(t,e,i,a){if(!e){var r=1/0;for(l=0;l<n.length;l++){e=n[l][0],i=n[l][1],a=n[l][2];for(var s=!0,c=0;c<e.length;c++)(!1&a||r>=a)&&Object.keys(o.O).every((function(n){return o.O[n](e[c])}))?e.splice(c--,1):(s=!1,a<r&&(r=a));if(s){n.splice(l--,1);var p=i();void 0!==p&&(t=p)}}return t}a=a||0;for(var l=n.length;l>0&&n[l-1][2]>a;l--)n[l]=n[l-1];n[l]=[e,i,a]},o.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return o.d(t,{a:t}),t},o.d=function(n,t){for(var e in t)o.o(t,e)&&!o.o(n,e)&&Object.defineProperty(n,e,{enumerable:!0,get:t[e]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),o.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},o.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},o.nmd=function(n){return n.paths=[],n.children||(n.children=[]),n},o.j=1033,function(){o.b=document.baseURI||self.location.href;var n={1033:0};o.O.j=function(t){return 0===n[t]};var t=function(t,e){var i,a,r=e[0],s=e[1],c=e[2],p=0;if(r.some((function(t){return 0!==n[t]}))){for(i in s)o.o(s,i)&&(o.m[i]=s[i]);if(c)var l=c(o)}for(t&&t(e);p<r.length;p++)a=r[p],o.o(n,a)&&n[a]&&n[a][0](),n[a]=0;return o.O(l)},e=self.webpackChunknextcloud=self.webpackChunknextcloud||[];e.forEach(t.bind(null,0)),e.push=t.bind(null,e.push.bind(e))}(),o.nc=void 0;var i=o.O(void 0,[7874],(function(){return o(69295)}));i=o.O(i)}();
  3. //# sourceMappingURL=core-recommendedapps.js.map?v=38c471d9205b133c0e7d