Server : Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.6 System : Windows NT USER-PC 6.1 build 7601 (Windows 7 Professional Edition Service Pack 1) AMD64 User : User ( 0) PHP Version : 7.4.6 Disable Function : NONE Directory : C:/Program Files/Avast Software/Avast/gui_resources/1.0.663/ |
//{"name":"BrowserExtensions","version":"1.2.349","created":"2021-09-06T10:49:27.603Z"} import e from"./ractive.js";import s from"./i18n.js";import{debugMode as t,serviceRequest as n,napiTracker as r}from"./napi.js";import{productModel as o,napiUtils as a}from"./napiExtensions.js";const i={v:3,t:[{t:7,e:"Page",a:{heading:[{t:2,x:{r:["nls"],s:'_0("bex")'}}],loading:[{t:2,r:"loading"}]},f:[{t:7,e:"div",a:{slot:"page-content"},f:[{t:7,e:"View",f:[{t:7,e:"div",a:{slot:"description"},f:[{t:7,e:"p",a:{class:"kin_description__text"},f:[{t:7,e:"span",a:{class:"h3 g-margin-top--10 g-margin-bottom--10"},f:[{t:7,e:"span",a:{class:"bex_logo logo -brand -ameba -white g-margin-right--5"}}," ",{t:2,x:{r:["nls"],s:'_0("bex.aos.title")'}}]}," ",{t:2,x:{r:["nls"],s:'_0("bex.aos.desc")'}}]}]}," ",{t:7,e:"div",a:{slot:"view-content"},f:[{t:4,f:[{t:8,r:"ratings_and_users"}],n:50,r:"showUsersAndRatings"}," ",{t:7,e:"kin-table",f:[{t:7,e:"div",a:{slot:"table-body",class:"g-margin-top--40"},f:[{t:4,f:[{t:8,r:"partial_extension_row"}],n:52,r:"aosInBrowsers"}," ",{t:4,f:[{t:7,e:"div",a:{role:"row",class:"kin_table__row bex_secure_browser_row","aria-rowindex":[{t:2,r:"@index"}]},f:[{t:7,e:"div",a:{class:"kin_table__name"},f:[{t:7,e:"i",a:{class:"bex_browser_icon svg -safezone"}}," ",{t:7,e:"div",f:[{t:2,x:{r:["nls"],s:'_0("secureBrowser")'}}," ",{t:7,e:"p",a:{class:"p -secondary -small g-margin-top--5"},f:[{t:2,x:{r:["nls"],s:'_0("secureBrowser.noNeedBrowserExtension")'}}]}]}]}," ",{t:7,e:"div",a:{class:"kin_table__end"},f:[{t:7,e:"kin-button",a:{size:"small"},v:{click:"installSecureBrowser"},f:[{t:2,x:{r:["nls"],s:'_0("secureBrowser.installBrowser")'}}]}]}]}],n:50,r:"showAsbPromo"}]}]}]}]}]}]}," ",{t:4,f:[{t:7,e:"Modal",a:{title:[{t:2,x:{r:["nls"],s:'_0("bex.errorRestoreModal.title")'}}]},f:[{t:7,e:"div",a:{class:"g-margin-bottom--20"},f:[{t:2,x:{r:["nls"],s:'_0("bex.sending.error")'}}]}," ",{t:4,f:[{t:7,e:"pre",a:{class:"color-critical -text g-margin-bottom--10"},f:["Debug error: ",{t:2,r:"errorModal"}]}],n:50,r:"DEBUG"}," ",{t:7,e:"div",a:{class:"modal__footer"},f:[{t:7,e:"kin-button",a:{type:"secondary"},v:{click:"Modal.close"},f:[{t:2,x:{r:["nls"],s:'_0("global.close")'}}]}]}]}],n:50,r:"errorModal"}," "],p:{partial_extension_row:[{t:7,e:"div",a:{role:"row",class:["kin_table__row ",{t:2,x:{r:["isBrowserInstalled"],s:'_0?"":"-disabled"'}}],"aria-rowindex":[{t:2,r:"@index"}]},f:[{t:7,e:"div",a:{class:"kin_table__name"},f:[{t:7,e:"i",a:{class:["bex_browser_icon svg -",{t:2,r:"./iconName"}]}}," ",{t:2,r:"./displayName"}]}," ",{t:7,e:"div",a:{class:"kin_table__end"},f:[{t:4,f:[{t:4,f:[{t:7,e:"kin-icon",a:{name:"icon-s-status-ok",size:"16",class:"color-ok -text"}}," ",{t:4,f:[{t:2,x:{r:["nls"],s:'_0("bex.installed")'}}],n:50,x:{r:["./browser"],s:'_0==="Edge"'}},{t:4,n:51,f:[{t:2,x:{r:["nls"],s:'_0("bex.enabled")'}}],x:{r:["./browser"],s:'_0==="Edge"'}}],n:50,r:"./isExtensionActive"},{t:4,n:51,f:[{t:7,e:"kin-button",a:{size:"small"},v:{click:{n:"openStoreExtension",d:[{t:2,r:"./browser"},",",{t:2,r:"./extensionName"}]}},f:[{t:2,x:{r:["nls"],s:'_0("bex.btn.enable")'}}]}],r:"./isExtensionActive"}],n:50,r:"./isExtensionInstalled"},{t:4,n:51,f:[{t:4,n:50,x:{r:["./isBrowserInstalled"],s:"!_0"},f:[{t:2,x:{r:["nls"],s:'_0("bex.browserNotInstalled")'}}]},{t:4,n:50,x:{r:["./isBrowserInstalled"],s:"_0"},f:[" ",{t:7,e:"kin-button",a:{size:"small"},v:{click:{n:"openStoreExtension",d:[{t:2,r:"./browser"},",",{t:2,r:"./extensionName"}]}},f:[{t:2,x:{r:["nls"],s:'_0("bex.btn.enable")'}}]}]}],r:"./isExtensionInstalled"}]}]}],ratings_and_users:[{t:7,e:"p",a:{class:"text g-margin-top--10"},f:[{t:7,e:"span",a:{class:"bex_stars"},f:[{t:7,e:"Icon",a:{name:"star",cssCls:"bex_unrated"}}," ",{t:7,e:"Icon",a:{name:"star",cssCls:"bex_unrated"}}," ",{t:7,e:"Icon",a:{name:"star",cssCls:"bex_unrated"}}," ",{t:7,e:"Icon",a:{name:"star",cssCls:"bex_unrated"}}," ",{t:7,e:"Icon",a:{name:"star",cssCls:"bex_unrated"}}]}," ",{t:7,e:"span",a:{class:"bex_stars -real"},f:[{t:7,e:"Icon",a:{name:"star",cssCls:"color-attention -text"}}," ",{t:7,e:"Icon",a:{name:"star color-attention -text"}}," ",{t:7,e:"Icon",a:{name:"star color-attention -text"}}," ",{t:7,e:"Icon",a:{name:"star color-attention -text"}}," ",{t:7,e:"Icon",a:{name:"star color-attention -text"}}]}]}," ",{t:7,e:"p",a:{class:"bex_ratings text g-margin-top--20"},f:[{t:2,x:{r:["nls","ratingsCountFormatted"],s:'_0("bex.ratings.count",_1)'}}," ",{t:7,e:"span",a:{class:"bex_separator"},f:["|"]}," ",{t:2,x:{r:["nls","usersCountFormatted"],s:'_0("bex.users.count",_1)'}}," ",{t:7,e:"kin-tooltip",f:[{t:7,e:"span",a:{slot:"tooltip-activator"},f:[{t:7,e:"kin-icon",a:{name:"icon-m-action-info",size:"16",class:"bex_tooltip_icon g-margin-left--5"}}]}," ",{t:7,e:"div",a:{slot:"tooltip"},f:[{t:2,x:{r:["nls"],s:'_0("bex.tooltip.caption")'}}]}]}]}]}};const l=function(l,d){return e.extend({template:i,css:".avs .kin_table__row:hover > div {\n background: transparent;\n}\n.kin_table__row {\n grid-template-columns: 70% 30%;\n}\n.kin_table__end {\n padding-right: 15px !important;\n}\n.kin_table__row.-disabled {\n opacity: 0.5;\n}\n.bex_logo {\n margin-top: -5px;\n}\n.bex_unrated.icon {\n opacity: 0.3;\n}\n.bex_stars {\n font-size: 16px;\n margin-top: -3px;\n overflow: hidden;\n position: absolute;\n white-space: nowrap;\n}\n.bex_stars.-real {\n width: 89px;\n}\n.bex_stars .bex_unrated {\n opacity: 0.3;\n}\n.bex_ratings {\n display: flex;\n margin: 1px 0 0 105px;\n}\n.bex_ratings span.bex_separator {\n display: inline-block;\n margin: 0 15px;\n}\n.bex_browser_icon {\n font-size: 40px;\n margin-right: 15px;\n}\n.bex_tooltip_icon {\n margin-top: 3px;\n}\n.bex_secure_browser_row {\n margin-top: 1.5rem;\n}\n.bex_secure_browser_row:after {\n border-bottom: 0;\n}\n[dir='rtl'] .bex_ratings {\n margin: 1px 105px 0;\n}\n[dir='rtl'] .bex_browser_icon {\n margin-right: 0;\n margin-left: 15px;\n}\n",data:function(){return{isChromeInstalled:!0,showAsbPromo:!1,aosInBrowsers:[],errorModal:null,DEBUG:t.isEnabled(),usersCountFormatted:Intl.NumberFormat(s.locale).format(l),ratingsCountFormatted:Intl.NumberFormat(s.locale).format(d),showUsersAndRatings:l>0&&d>0,loading:!0}},oninit(){this.installedBrowsers=null,this.AOS_SUPPORTED_BROWSERS=["Chrome","Firefox","Opera","Edge","ChromiumEdge"],this.storeLinks={},this.interval=null,this.brand=o.getBrand()||"avast",this.avAfb=o.isAfbEdition(),this._setListeners(),this._initData(),this._startPolling()},onteardown(){clearInterval(this.interval)},_setListeners(){this.on("openStoreExtension",this._openStoreExtension.bind(this)),this.on("installSecureBrowser",this._installSecureBrowser.bind(this)),this.on("Modal.close",(()=>this.set({errorModal:null})))},_initData(){Promise.all([n("app.settings.Get","avdef://config/GuiCache/AOSCHStoreLink"),n("app.settings.Get","avdef://config/GuiCache/AOSFFStoreLink"),n("app.settings.Get","avdef://config/GuiCache/AOSOPStoreLink"),n("app.settings.Get","avdef://config/GuiCache/AOSEDStoreLink"),n("app.settings.Get","avdef://config/GuiCache/AOSEDCEFStoreLink"),n("app.utils.GetInstalledBrowsers"),n("app.browserExtensions.GetDetails")]).then((e=>{this.storeLinks={aos:{Chrome:e[0],Firefox:e[1],Opera:e[2],Edge:e[3],ChromiumEdge:e[4]}},this.installedBrowsers=e[5]||{},this._setAosInBrowser(e[6]),this.set({showAsbPromo:a.supportedSince("21.6")&&!this.avAfb&&"avast"===this.brand&&!this.installedBrowsers["avg"===this.brand?"AvgSB":"AvastSB"]}),this.set({loading:!1})})).catch((e=>{console.error("[BrowserExtensions] {index} initData failed",e),this.set({errorModal:"initData failed, error:"+JSON.stringify(e)})}))},_startPolling(){this.interval=setInterval((()=>{Promise.all([n("app.utils.GetInstalledBrowsers"),n("app.browserExtensions.GetDetails")]).then((e=>{this.installedBrowsers=e[0]||{},this._setAosInBrowser(e[1]),this.set({showAsbPromo:a.supportedSince("21.6")&&!this.avAfb&&"avast"===this.brand&&!this.installedBrowsers["avg"===this.brand?"AvgSB":"AvastSB"]})})).catch((e=>{console.error("[BrowserExtensions] {index} error during polling",e),clearInterval(this.interval)}))}),5e3)},_setAosInBrowser(e){const s=e&&e.aos&&e.aos.browsers||{},t=this._mapExtensionInBrowsers({browsersExtension:s});this.set({aosInBrowsers:t})},_mapExtensionInBrowsers({browsersExtension:e,extensionName:s="aos",supportedBrowsers:t=this.AOS_SUPPORTED_BROWSERS}){let n=t.reduce(((t,n)=>{if(this.storeLinks[s]&&this.storeLinks[s][n]&&this.installedBrowsers&&this.installedBrowsers[n]){const r=e[n]||{},o=r.isInstalled||!1,a=r.isActive||!1,i=!0,l="ChromiumEdge"===n?"edge-chromium":n.toLowerCase(),d="ChromiumEdge"===n?"Edge":n;t.push({browser:n,iconName:l,displayName:d,isExtensionInstalled:o,isExtensionActive:a,extensionName:s,isBrowserInstalled:i})}return t}),[]);return 0===n.length&&(n=this._mapAllSupportedBrowsers({extensionName:s,supportedBrowsers:t})),this._filterEdges(n),n},_mapAllSupportedBrowsers:({extensionName:e,supportedBrowsers:s})=>s.map((s=>({browser:s,displayName:"ChromiumEdge"===s?"Edge":s,iconName:"ChromiumEdge"===s?"edge-chromium":s.toLowerCase(),isExtensionInstalled:!1,isExtensionActive:!1,extensionName:e,isBrowserInstalled:!1}))),_openStoreExtension(e,s,t){const o=this.storeLinks[t]&&this.storeLinks[t][s]||"";o?(r.event("Extensions","Click","AOS-"+s),n("app.system.OpenUrl",{url:o,browser:s})):(console.error("[BrowserExtensions] {index} store link not present, for browser:",s,"extension:",t),this.set({errorModal:"store link not present, for browser: "+s+" extension: "+t}))},_installSecureBrowser(){n("app.avast.lis.install",{products:[{mode:"pck",id:"product.ASB",download:{url_id:"asb"},run:{run_id:"asb"}}]})},_filterEdges(e){let s=-1,t=-1;e.forEach(((e,n)=>{s="Edge"===e.browser?n:s,t="ChromiumEdge"===e.browser?n:t})),s>-1&&t>-1&&e.splice(s,1)}})}(1e7,24e3);export default l;const d={name:"BrowserExtensions",version:"1.2.349",created:"2021-09-06T10:49:27.603Z"};export{d as metadata};