core-recommendedapps.js 16 KB

123
  1. /*! For license information please see core-recommendedapps.js.LICENSE.txt */
  2. !function(){"use strict";var t,n={69897:function(t,n,e){var r,o=e(77958),i=e(31352),a=e(20144),c=e(17499),s=null===(r=(0,o.ts)())?(0,c.IY)().setApp("core").build():(0,c.IY)().setApp("core").setUid(r.uid).build(),l=e(93664),u=e(79753),p=e(43554),d=e(63560),f=e(57274);function h(t){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h(t)}function v(){v=function(){return t};var t={},n=Object.prototype,e=n.hasOwnProperty,r=Object.defineProperty||function(t,n,e){t[n]=e.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(t,n,e){return Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[n]}try{s({},"")}catch(t){s=function(t,n,e){return t[n]=e}}function l(t,n,e,o){var i=n&&n.prototype instanceof d?n:d,a=Object.create(i.prototype),c=new O(o||[]);return r(a,"_invoke",{value:C(t,e,c)}),a}function u(t,n,e){try{return{type:"normal",arg:t.call(n,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var p={};function d(){}function f(){}function g(){}var m={};s(m,i,(function(){return this}));var y=Object.getPrototypeOf,A=y&&y(y(I([])));A&&A!==n&&e.call(A,i)&&(m=A);var b=g.prototype=d.prototype=Object.create(m);function w(t){["next","throw","return"].forEach((function(n){s(t,n,(function(t){return this._invoke(n,t)}))}))}function x(t,n){function o(r,i,a,c){var s=u(t[r],t,i);if("throw"!==s.type){var l=s.arg,p=l.value;return p&&"object"==h(p)&&e.call(p,"__await")?n.resolve(p.__await).then((function(t){o("next",t,a,c)}),(function(t){o("throw",t,a,c)})):n.resolve(p).then((function(t){l.value=t,a(l)}),(function(t){return o("throw",t,a,c)}))}c(s.arg)}var i;r(this,"_invoke",{value:function(t,e){function r(){return new n((function(n,r){o(t,e,n,r)}))}return i=i?i.then(r,r):r()}})}function C(t,n,e){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return{value:void 0,done:!0}}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=_(a,e);if(c){if(c===p)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===r)throw r="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);r="executing";var s=u(t,n,e);if("normal"===s.type){if(r=e.done?"completed":"suspendedYield",s.arg===p)continue;return{value:s.arg,done:e.done}}"throw"===s.type&&(r="completed",e.method="throw",e.arg=s.arg)}}}function _(t,n){var e=n.method,r=t.iterator[e];if(void 0===r)return n.delegate=null,"throw"===e&&t.iterator.return&&(n.method="return",n.arg=void 0,_(t,n),"throw"===n.method)||"return"!==e&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+e+"' method")),p;var o=u(r,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,p;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,p):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function k(t){var n={tryLoc:t[0]};1 in t&&(n.catchLoc=t[1]),2 in t&&(n.finallyLoc=t[2],n.afterLoc=t[3]),this.tryEntries.push(n)}function E(t){var n=t.completion||{};n.type="normal",delete n.arg,t.completion=n}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function I(t){if(t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function n(){for(;++r<t.length;)if(e.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=void 0,n.done=!0,n};return o.next=o}}return{next:L}}function L(){return{value:void 0,done:!0}}return f.prototype=g,r(b,"constructor",{value:g,configurable:!0}),r(g,"constructor",{value:f,configurable:!0}),f.displayName=s(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var n="function"==typeof t&&t.constructor;return!!n&&(n===f||"GeneratorFunction"===(n.displayName||n.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,s(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),s(x.prototype,a,(function(){return this})),t.AsyncIterator=x,t.async=function(n,e,r,o,i){void 0===i&&(i=Promise);var a=new x(l(n,e,r,o),i);return t.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),s(b,c,"Generator"),s(b,i,(function(){return this})),s(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var n=Object(t),e=[];for(var r in n)e.push(r);return e.reverse(),function t(){for(;e.length;){var r=e.pop();if(r in n)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=I,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var n in this)"t"===n.charAt(0)&&e.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(e,r){return a.type="throw",a.arg=t,n.next=e,r&&(n.method="next",n.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var c=e.call(i,"catchLoc"),s=e.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,n){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&e.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=n&&n<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=n,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(t,n){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&n&&(this.next=n),p},finish:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var e=this.tryEntries[n];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),E(e),p}},catch:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var e=this.tryEntries[n];if(e.tryLoc===t){var r=e.completion;if("throw"===r.type){var o=r.arg;E(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,e){return this.delegate={iterator:I(t),resultName:n,nextLoc:e},"next"===this.method&&(this.arg=void 0),p}},t}function g(t,n,e,r,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void e(t)}c.done?n(s):Promise.resolve(s).then(r,o)}var m={calendar:{description:(0,i.Iu)("core","Schedule work & meetings, synced with all your devices."),icon:(0,u.imagePath)("core","places/calendar.svg")},contacts:{description:(0,i.Iu)("core","Keep your colleagues and friends in one place without leaking their private info."),icon:(0,u.imagePath)("core","places/contacts.svg")},mail:{description:(0,i.Iu)("core","Simple email app nicely integrated with Files, Contacts and Calendar."),icon:(0,u.imagePath)("core","actions/mail.svg")},spreed:{description:(0,i.Iu)("core","Chatting, video calls, screensharing, online meetings and web conferencing – in your browser and with mobile apps."),icon:(0,u.imagePath)("core","apps/spreed.svg")},richdocuments:{name:"Nextcloud Office",description:(0,i.Iu)("core","Collaborative documents, spreadsheets and presentations, built on Collabora Online."),icon:(0,u.imagePath)("core","apps/richdocuments.svg")},notes:{description:(0,i.Iu)("core","Distraction free note taking app."),icon:(0,u.imagePath)("core","apps/notes.svg")},richdocumentscode:{hidden:!0}},y=Object.keys(m),A={name:"RecommendedApps",components:{NcButton:f.Z},data:function(){return{showInstallButton:!1,installingApps:!1,loadingApps:!0,loadingAppsError:!1,apps:[],defaultPageUrl:(0,p.j)("core","defaultPageUrl")}},computed:{recommendedApps:function(){return this.apps.filter((function(t){return y.includes(t.id)}))}},mounted:function(){var t,n=this;return(t=v().mark((function t(){var e,r;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,l.Z.get((0,u.generateUrl)("settings/apps/list"));case 3:e=t.sent,r=e.data,s.info("".concat(r.apps.length," apps fetched")),n.apps=r.apps.map((function(t){return Object.assign(t,{loading:!1,installationError:!1})})),s.debug("".concat(n.recommendedApps.length," recommended apps found"),{apps:n.recommendedApps}),n.showInstallButton=!0,t.next=15;break;case 11:t.prev=11,t.t0=t.catch(0),s.error("could not fetch app list",{error:t.t0}),n.loadingAppsError=!0;case 15:return t.prev=15,n.loadingApps=!1,t.finish(15);case 18:case"end":return t.stop()}}),t,null,[[0,11,15,18]])})),function(){var n=this,e=arguments;return new Promise((function(r,o){var i=t.apply(n,e);function a(t){g(i,r,o,a,c,"next",t)}function c(t){g(i,r,o,a,c,"throw",t)}a(void 0)}))})()},methods:{installApps:function(){var t=this;this.showInstallButton=!1,this.installingApps=!0;var n=(0,d.Z)(1),e=this.recommendedApps.filter((function(t){return!t.active&&t.isCompatible&&t.canInstall})).map((function(t){return n((function(){return s.info("installing ".concat(t.id)),t.loading=!0,l.Z.post((0,u.generateUrl)("settings/apps/enable"),{appIds:[t.id],groups:[]}).catch((function(n){s.error("could not install ".concat(t.id),{error:n}),t.installationError=!0})).then((function(){s.info("installed ".concat(t.id)),t.loading=!1}))}))}));s.debug("installing ".concat(e.length," recommended apps")),Promise.all(e).then((function(){s.info("all recommended apps installed, redirecting …"),window.location=t.defaultPageUrl})).catch((function(t){return s.error("could not install recommended apps",{error:t})}))},customIcon:function(t){return t in m&&m[t].icon?m[t].icon:(s.warn("no app icon for recommended app ".concat(t)),(0,u.imagePath)("core","places/default-app-icon.svg"))},customName:function(t){return t.id in m&&m[t.id].name||t.name},customDescription:function(t){return t in m?m[t].description:(s.warn("no app description for recommended app ".concat(t)),"")},isHidden:function(t){return t in m&&!!m[t].hidden}}},b=A,w=e(93379),x=e.n(w),C=e(7795),_=e.n(C),k=e(90569),E=e.n(k),O=e(3565),I=e.n(O),L=e(19216),P=e.n(L),j=e(44589),S=e.n(j),B=e(46202),N={};N.styleTagTransform=S(),N.setAttributes=I(),N.insert=E().bind(null,"head"),N.domAPI=_(),N.insertStyleElement=P(),x()(B.Z,N),B.Z&&B.Z.locals&&B.Z.locals;var G=(0,e(51900).Z)(b,(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),D=G.exports;e.nc=btoa((0,o.IH)()),a.default.mixin({methods:{t:i.Iu}}),(new(a.default.extend(D))).$mount("#recommended-apps"),s.debug("recommended apps view rendered")},46202:function(t,n,e){var r=e(87537),o=e.n(r),i=e(23645),a=e.n(i)()(o());a.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:""}]),n.Z=a}},e={};function r(t){var o=e[t];if(void 0!==o)return o.exports;var i=e[t]={id:t,loaded:!1,exports:{}};return n[t].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}r.m=n,t=[],r.O=function(n,e,o,i){if(!e){var a=1/0;for(u=0;u<t.length;u++){e=t[u][0],o=t[u][1],i=t[u][2];for(var c=!0,s=0;s<e.length;s++)(!1&i||a>=i)&&Object.keys(r.O).every((function(t){return r.O[t](e[s])}))?e.splice(s--,1):(c=!1,i<a&&(a=i));if(c){t.splice(u--,1);var l=o();void 0!==l&&(n=l)}}return n}i=i||0;for(var u=t.length;u>0&&t[u-1][2]>i;u--)t[u]=t[u-1];t[u]=[e,o,i]},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,{a:n}),n},r.d=function(t,n){for(var e in n)r.o(n,e)&&!r.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})},r.e=function(){return Promise.resolve()},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=function(t){return t.paths=[],t.children||(t.children=[]),t},r.j=1033,function(){r.b=document.baseURI||self.location.href;var t={1033:0};r.O.j=function(n){return 0===t[n]};var n=function(n,e){var o,i,a=e[0],c=e[1],s=e[2],l=0;if(a.some((function(n){return 0!==t[n]}))){for(o in c)r.o(c,o)&&(r.m[o]=c[o]);if(s)var u=s(r)}for(n&&n(e);l<a.length;l++)i=a[l],r.o(t,i)&&t[i]&&t[i][0](),t[i]=0;return r.O(u)},e=self.webpackChunknextcloud=self.webpackChunknextcloud||[];e.forEach(n.bind(null,0)),e.push=n.bind(null,e.push.bind(e))}(),r.nc=void 0;var o=r.O(void 0,[7874],(function(){return r(69897)}));o=r.O(o)}();
  3. //# sourceMappingURL=core-recommendedapps.js.map?v=ecac1f27fdfdd24de382