\n
\n
\n '+this.terms["title.Default"]+"\n
\n "+this.terms["subtitle.Default"]+'\n
\n
\n '+this.terms.getAppText+"\n \n
";this.bannerElement=a(e),this.innerContainer=this.siteContainer.firstElementChild,this.bindEvents(),o(this.bannerElement),this.biLogger.logBannerShown(),this.autoHideTimer=setTimeout(this.hideBanner,18e3)})),t()(this,"renderBannerWithDelay",(()=>{window.wixEmbedsAPI?this.loadTerms().then(this.renderBanner):window.addEventListener("wixEmbedsAPIReady",(()=>{this.loadTerms().then(this.renderBanner)}),N)})),t()(this,"setContainerHeight",(()=>{const e=window.innerHeight-this.bannerHeight;this.innerContainer.style.setProperty("height",e+"px")}))}async loadTerms(){this.terms||(this.terms=z())}async shouldShowBanner(){return this.isBannerDismissed().then((e=>!e&&W(navigator.userAgent)&&!I()))}isBannerDismissed(){return ve.read(f).catch((()=>!1))}dismissBanner(e){return ve.write(f,e,e),clearTimeout(this.autoHideTimer),this.hideBanner()}getAppLink(){const e=document.getElementById(g);if(!e)return"#";return E(e.getAttribute("data-app-link"),k.TOP)}moveSiteViewport(){this.siteContainer.classList.add(be,xe),this.setContainerHeight(),this.registerSizingEvents()}registerSizingEvents(){window.addEventListener("orientationchange",this.setContainerHeight,B),window.addEventListener("resize",this.setContainerHeight,B)}unregisterSizingEvents(){window.removeEventListener("orientationchange",this.setContainerHeight,B),window.removeEventListener("resize",this.setContainerHeight,B)}restoreSiteViewport(){this.unregisterSizingEvents(),this.siteContainer.classList.remove(be)}bindEvents(){this.bannerElement.querySelector("."+Oe).addEventListener("click",this.onCloseClick,N),this.bannerElement.addEventListener("click",this.onBannerClick,N)}onLoad(){this.shouldShowBanner().then((e=>{e&&("complete"===document.readyState||"interactive"===document.readyState?this.renderBannerWithDelay():document.addEventListener("DOMContentLoaded",this.renderBannerWithDelay,N))}))}},Ne=n(891),je=n.n(Ne);function We(e){switch(e){case S.WixOneApp:return O.WixOneApp;case S.WixRestaurantsApp:return O.WixRestaurantsApp;case S.WixFitnessApp:return O.WixFitnessApp;case S.WixBrandedApp:return O.WixBrandedApp;default:return O.WixOneApp}}const Ie={fetch:async function(){var e;const{msId:t}=j(),n=t||(null==(e=window.rendererModel)?void 0:e.metaSiteId),r=S.WixOneApp;if(n)try{var i,a;const e={businessIds:[n]},t=null==(i=window.wixEmbedsAPI)?void 0:i.getAppToken(y),o=await D({method:"POST",url:"/_/clubs/api/v1/business/join/details",body:JSON.stringify(e),headers:{Authorization:t}}),u=je().get(o,"joinDetails."+n);if(!u)return;const s=null!=(a=u.preferredApp)?a:r;return{title:u.title,imageUrl:u.imageUrl,appColor:We(s),preferredApp:s}}catch(e){return}}};var Ee;!function(e){e.Default="",e.OwnerAccount="owner-account"}(Ee||(Ee={}));var De={UseNewApi:"__WIXEXP_USE_NEW_API",ConductionMethod:"__WIXEXP_CONDUCTION_METHOD_",OwnerAccountId:"__WIXEXP_OWNER_ACCOUNT_ID_",LoggedInUserId:"__WIXEXP_LOGGED_IN_USER_ID_"};function Te(e,t,n){var r,i;if("undefined"!=typeof self)if("function"==typeof n){if(void 0!==n(self[t]))return(r={})[e]=n(self[t]),r}else if(typeof self[t]===n)return(i={})[e]=self[t],i;return{}}var Ce=function(e){return Object.keys(Ee).filter((function(t){return Ee[t]===e})).length>0?e:void 0};function Re(e){return function(e){return e.conductionMethod===Ee.OwnerAccount&&e.siteOwnerId&&e.loggedInUserId}(e)?{forSiteOwner:{siteOwnerId:e.siteOwnerId,loggedInUserId:e.loggedInUserId}}:{}}var ze=function(e){return"string"==typeof e&&""!==e},Le=function(e){return ze(e.loggedInUserId)&&ze(e.siteOwnerId)?"&requestContext.forSiteOwner.loggedInUserId="+e.loggedInUserId+"&requestContext.forSiteOwner.siteOwnerId="+e.siteOwnerId:""},Ue=function(e){return ze(e.visitorId)&&ze(e.siteOwnerId)?"&requestContext.forSiteVisitors.visitorId="+e.visitorId+"&requestContext.forSiteVisitors.siteOwnerId="+e.siteOwnerId:""},Pe=function(e){return ze(e.entityId)?"&requestContext.overrideCriteria.entityId="+e.entityId:""};function Fe(e){void 0===e&&(e={});var t=e.forSiteOwner,n=e.forSiteVisitors,r=e.overrideCriteria,i="";if(["forSiteOwner","forSiteVisitors"].reduce((function(t,n){return e[n]?t+1:t}),0)>1)throw new Error('Only one of "forSiteOwner" or "forSiteVisitors" is accepted.');return t&&(i+=Le(t)),n&&(i+=Ue(n)),r&&(i+=Pe(r)),i}function Me(e){if("string"==typeof e)try{return JSON.parse(e)}catch(e){}return e}var Je={new:{conductAllInScope:"/_api/wix-laboratory-server/v1/laboratory/platform/conductAllInScope",conductExperiment:"/_api/wix-laboratory-server/v1/laboratory/platform/conductExperiment"},old:{conductAllInScope:"/_api/wix-laboratory-server/laboratory/conductAllInScope",conductExperiment:"/_api/wix-laboratory-server/laboratory/conductExperiment"}};function Ve(e,t){return-1!==e.indexOf(t?Je.new.conductAllInScope:Je.old.conductAllInScope)}var qe=function(e,t,n){return void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n=!1),n?Je.new.conductExperiment+"?key="+encodeURIComponent(e)+"&fallbackValue="+encodeURIComponent(t):Je.old.conductExperiment+"?key="+encodeURIComponent(e)+"&fallback="+encodeURIComponent(t)};function Ge(e,t,n){var r=""+qe(t,"",n);return e.includes(r)}var $e=function(){function e(){this.urlMap=new Map,this.pendingUrlMap=new Map}return e.prototype.addUrlRequest=function(e,t){return J(this,void 0,void 0,(function(){var n=this;return V(this,(function(r){switch(r.label){case 0:return this.pendingUrlMap.set(e,t),[4,t.then((function(t){return n.addUrlResponse(e,t)}))];case 1:return r.sent(),[2]}}))}))},e.prototype.addUrlResponse=function(e,t){this.urlMap.set(e,t)},e.prototype.getUrlResponse=function(e){return this.urlMap.get(e)},e.prototype.getUrlRequest=function(e){return this.pendingUrlMap.get(e)},e.prototype.getExperimentValue=function(e,t){var n,r;try{for(var i=q(this.urlMap.keys()),a=i.next();!a.done;a=i.next()){var o=a.value;if(Ge(o,e,t))return this.urlMap.get(o);if(Ve(o,t)){var u=Me(this.urlMap.get(o));if("object"==typeof u&&e in u)return u[e]}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},e}();!function(){function e(){}e.prototype.addUrlRequest=function(){},e.prototype.addUrlResponse=function(){},e.prototype.getUrlResponse=function(){},e.prototype.getUrlRequest=function(){},e.prototype.getExperimentValue=function(){}}();function He(){return void 0===self.experimentsCacheV2&&(self.experimentsCacheV2=new $e),self.experimentsCacheV2}var Ke=function(){function e(e){var t;this.experiments=null!==(t=e.experiments)&&void 0!==t?t:{}}return e.prototype.get=function(e){return this.experiments[e]},e.prototype.enabled=function(e){return"true"===this.get(e)},e.prototype.pending=function(){return!1},e.prototype.ready=function(){return Promise.resolve()},e.prototype.all=function(){return this.experiments},e}(),Xe=function(){};const Ze=new(function(e){function t(t){void 0===t&&(t={});var n=e.call(this,t)||this,r=M(M(M(M({},Te("useNewApi",De.UseNewApi,"boolean")),Te("conductionMethod",De.ConductionMethod,Ce)),Te("siteOwnerId",De.OwnerAccountId,"string")),Te("loggedInUserId",De.LoggedInUserId,"string"));return n.useNewApi=void 0!==t.useNewApi?t.useNewApi:r.useNewApi||!1,n.experiments=t.experiments||{},n.loaders=new Map,n.baseUrl=(n.useNewApi,t.baseUrl||""),n.requestContext=t.requestContext||Re(r),n.onError=t.onError||Xe,t.scope&&n.load(t.scope),t.scopes&&t.scopes.forEach(n.load.bind(n)),n}return F(t,e),t.prototype.add=function(e){this.experiments=M(M({},this.experiments),e)},t.prototype._addLoader=function(e,t){var n=this;return this.loaders.set(e,t),t.then((function(){n.loaders.delete(e)})),t},t.prototype._getUrlWithFallback=function(e,t){var n=this,r=He().getUrlResponse(e);if(void 0!==r)return Promise.resolve(r);var i=He().getUrlRequest(e);if(void 0!==i)return i;var a=this.loaders.get(e);if(void 0!==a)return a;var o=function(e){return new Promise((function(t,n){var r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="text",r.withCredentials=!0,r.onload=function(){r.status>=200&&r.status<400?t(r.responseText):n(new Error("Failed to load "+e+", status "+r.status))},r.onerror=function(){return n(new Error("Failed to load "+e))},r.send()}))}(e);return He().addUrlRequest(e,o),o.catch((function(e){return n.onError(e),t}))},t.prototype.load=function(e){var t=this,n=function(e,t){return void 0===e&&(e=""),void 0===t&&(t=!1),t?Je.new.conductAllInScope+"?scope="+encodeURIComponent(e):Je.old.conductAllInScope+"?scope="+encodeURIComponent(e)}(e,this.useNewApi),r=this.useNewApi?Fe(this.requestContext):"",i=""+this.baseUrl+n+r,a=this._getUrlWithFallback(i,"{}").then((function(e){return Me(e)})).then((function(e){return t.useNewApi?e.values:e})).then((function(e){return t.add(e),e}));return this._addLoader(i,a)},t.prototype.conduct=function(e,t){var n=this,r=He().getExperimentValue(e,this.useNewApi);if(void 0!==r)return this._addConductResult(e,r);var i=qe(e,t,this.useNewApi),a=this.useNewApi?Fe(this.requestContext):"",o=""+this.baseUrl+i+a,u=this._getUrlWithFallback(o,null!=t?t:"").then((function(t){return n._addConductResult(e,t)}));return this._addLoader(o,u)},t.prototype.pending=function(){return!!this.loaders.size},t.prototype.ready=function(){return Promise.all(Array.from(this.loaders.values()))},t.prototype._addConductResult=function(e,t){var n,r=this.useNewApi?JSON.parse(t).value:t;return this.add(((n={})[e]=r,n)),Promise.resolve(r)},t}(Ke))({scope:"wix-one-app"});const Qe={isFetchPlaceDetailsEnabled:async function(){return async function(e){return new Promise((t=>{Ze.conduct(e,"false").then((e=>t("true"===e))).catch((()=>t(!1)))}))}("specs.woa.GrowthMobileBannerDataFetch")}};(new class{constructor(){t()(this,"onLoad",(async()=>{const e=this.getConfig();if(e&&e.type===k.BOTTOM){const t=await Qe.isFetchPlaceDetailsEnabled();if(e.isFetchPlaceDetailsEnabled=t,t){const t=await Ie.fetch();e.preferredApp=t.preferredApp,e.placeImageUrl=t.imageUrl,e.appColor=t.appColor,e.placeName=t.title}(new me).onLoad(e)}else(new Be).onLoad()})),t()(this,"getConfig",(()=>{const e=document.getElementById(g);if(!e)return console.error("Unable to find app banner script.please make sure you included the script along with a %s id",g),"#";try{const t=e.getAttribute("config").split("***").join('"').split("###").join(" ");return JSON.parse(t)}catch(e){return}}))}}).onLoad()}(),r}()}));
//# sourceMappingURL=mobile-app-invite-banner.umd.min.js.map