/* main */ var InffuseWelcomebar=new function(){var b=this;this.platform="bigcommerce";this.server="https://inffuse-platform.appspot.com";this.apiVersion="v0.1";this.editing=false;this._viewMode="site";var a={};this.init=function(){window.addEventListener("message",function(d){var c=d.data;if(c.app!="inffuse"){return}b.receiveMessage(c)},false);b.on("publish",function(){if(!b.project){return}b.project.publish()})};this.ready=function(c){if(typeof c!="undefined"){if(b.isready){c(b)}else{if(typeof b.readyCallbacks=="undefined"){b.readyCallbacks=[]}b.readyCallbacks.push(c)}return}if(b.readyCallbacks){for(var d in b.readyCallbacks){b.readyCallbacks[d](b)}}b.broadcast("ready");b.isready=true};this.viewMode=function(){return this._viewMode};this.error=function(d){var c="[Inffuse error] "+d+".";if(window.console){console.error(c)}};this.on=function(d,c){if(!c||typeof c!="function"){throw"[Inffuse] Inffuse.on - invalid handler passed (function is required)";return}if(typeof a[d]=="undefined"){a[d]=[]}a[d].push(c)};this.off=function(d,c){if(typeof a[d]=="undefined"){return}a[d]=a[d].filter(function(e){return e!=c})};this.trigger=function(d,e){var c=a[d];if(typeof c=="undefined"||c.length==0){return false}a[d].map(function(f){f(e)});return true};this.broadcast=function(d,e,c){if(!window.parent||!window.parent.postMessage){return}var f={app:"inffuse",user:b.user?b.user.key():null,project:b.project?b.project.key():null,type:d,params:e};window.parent.postMessage(f,"*");if(c){b.trigger(d,e)}};this.requestAPI=function(g,h,j,c,f){if(typeof j=="undefined"){j="GET"}h.app=b.app.id();h.platform=b.platform;;var i=b.user.accessToken();if(i){h.access_token=i}var e=[b.server,"api",b.apiVersion,g].join("/");if(j=="GET"||j=="DELETE"){e+="?"+$.param(h);h=undefined}var d={url:e,type:j,data:h,async:!f};if(c){d.crossDomain=true;d.xhrFields={withCredentials:true}}return $.ajax(d);};this.receiveMessage=function(d){switch(d.type){case"data-changed":if(b.project){var c=d.params;for(key in c){b.project.set(key,c[key],true)}}break}b.trigger(d.type,d.params)}};InffuseWelcomebar.init(); /* datastore */ (function(a){a.DataStore=function(d,c,e){var b=this;var g=false;var f={};this.populate=function(h){f=h};this.set=function(j,k,i){f[j]=k;if(i){return}var h=[d,c,"data",e,j].join("/");var l={user:a.user.id(),value:JSON.stringify(k)};return a.requestAPI(h,l,"PUT").success(function(m){var n={};n[j]=k;a.broadcast("data-changed",n)})};this.get=function(i,h){if(typeof i=="undefined"){return f}if(i in f==false){return h}return f[i]};this.loadData=function(j,h){var k={user:a.user.id(),};if(j){var i=[d,c,"data",e,j].join("/");return a.requestAPI(i,k,"GET").success(function(l){f[j]=l.data;return f[j]})}else{var i=[d,c,"data",e].join("/");return a.requestAPI(i,k,"GET").success(function(l){f=l.data;return f})}};this.append=function(i,j){if(f[i]===undefined){f[i]=[]}f[i].push(j);var h=[d,c,"data",e,i].join("/");var k={user:a.user.id(),value:JSON.stringify(j)};return a.requestAPI(h,k,"POST").success(function(l){var m={};console.log(i);console.log(f);m[i]=f[i];a.broadcast("data-changed",m)})};this.del=function(h,i){delete f[h];if(typeof i=="undefined"||i){b.save()}};this.setData=function(h){f=h};this.setMulti=function(j,i){if(i){return}var h=["projects",c,"data",e].join("/");var k={user:a.user.id(),obj:JSON.stringify(j)};return a.requestAPI(h,k,"POST").success(function(l){a.broadcast("data-changed",j)})};this.save=function(){var h=[d,c,"data",e].join("/");var i={user:a.user.id(),obj:JSON.stringify(f)};return a.requestAPI(h,i,"PUT").success(function(j){a.broadcast("data-changed",f)})}}})(InffuseWelcomebar); /* loader */ (function(a){a.loader=new function(){var b={};var c=function(){var d;var e=false;this.next=function(){};this.then=function(f){if(e){return f()}this.next=f;d=new c();return d};this.done=function(){e=true;var f=this.next();if(f&&f.then){f.then(function(){d.done()})}}};this.init=function(){};this.loadScript=function(f){var g=new c;if(b[f]){g.done()}else{var h=a.server;if(f.indexOf("//")==-1){f=h+f}var e=document.getElementsByTagName("head")[0];var d=document.createElement("script");d.type="text/javascript";d.src=f;e.appendChild(d);d.onload=function(){b[f]=true;g.done()}}return g}}})(InffuseWelcomebar); /* app */ (function(a){a.app=new function(){var b=this;var d={"id": "welcomebar"};var c={};this.init=function(){};this.id=function(){return d.id};this.platform=function(){return d.platform};this.name=function(){return d.name};this.set=function(e,g,f){c[e]=g;if(typeof f=="undefined"||f){this.save()}};this.get=function(f,e){if(typeof f=="undefined"){return c}if(f in c==false){return e}return c[f]};this.remove=function(e,f){delete c[e];if(typeof f=="undefined"||f){this.save()}}}})(InffuseWelcomebar); /* site */ (function(a){a.site=new function(){var b=this;var c={"domain": "www.beamersmoke.com", "user_id": "user_zT0yx9t3p2WDTv3eNRIXA", "title": null, "key_name": "6ep32", "created": 1587147116000, "platform": "bigcommerce", "plan": null, "plan_override": null, "id": "site_ZxrR3fXYUVx18iGP3TOgg"};this.id=function(){return c?c.id:null};this.created=function(){return c?c.created:null};this.key=function(){return c?c.key_name:null};this.meta=function(d){a.error("Inffuse.site.meta() method is not implemented on "+a.platform+" platform")};this.pages=function(d){a.error("Inffuse.site.pages() method is not implemented on "+a.platform+" platform")};this.currentPage=function(d){a.error("Inffuse.site.currentPage() method is not implemented on "+a.platform+" platform")};this.getDataStore=function(d){if(!b.dataStore){b.dataStore=new a.DataStore("sites",b.id(),"private")}return b.dataStore};this.manage=function(){var e=a.server.indexOf("local")==-1?"dashboard.inffuse.com":"dev.inffuse.local:28099";var d=["http:/",e,"app:"+a.app.id(),"users","site:"+b.id()].join("/");console.log("To manage the site go to: ",d)}}})(InffuseWelcomebar); /* user */ (function(a){a.UserClass=function(d,c){var b=this;var e=d.access_token||null;this.init=function(){};this.create=function(h,g,f){var i={name:h,email:g,password:f};return a.requestAPI("users",i,"POST",true).success(function(j){d=j.user;e=j.user.access_token})};this.login=function(g,f){var h={email:g,password:f};return a.requestAPI("users/login",h,"POST",true).success(function(i){d=i.user;e=i.user.access_token})};this.logout=function(){return a.requestAPI("users/logout",{},"POST",true).success(function(f){d={};e=null})};this.loggedin=function(){return !!this.id()};this.id=function(){return d.id};this.created=function(){return d.created};this.key=function(){return d.key_name};this.plan=function(){return d.plan};this.isNew=function(){return d["new"]==true};this.email=function(f){if(typeof f=="undefined"){return d.email}d.email=f;var g={user:a.user.id(),email:f};return a.requestAPI("users/update",g,"POST")};this.name=function(f){if(typeof f=="undefined"){return d.name}d.name=f;var g={user:a.user.id(),name:f};return a.requestAPI("users/update",g,"POST")};this.upgrade=function(g){var f="stripe";switch(f){case"stripe":a.services.stripe.checkout({type:"subscription",amount:15,plan:g,description:"Subscribe to "+g+" plan"});break}a.ui.alert("Inffuse error :: upgrade() is not supported on "+a.platform+" platform")};this.accessToken=function(){return e};this.getDataStore=function(f){if(!b.dataStore){b.dataStore=new a.DataStore("users",b.id(),"private")}return b.dataStore};this.is=function(f){return(f==this.plan())};this.free=function(){var f=this.plan();return(!f||f=="free")};this.manage=function(){var g=a.server.indexOf("local")==-1?"dashboard.inffuse.com":"dev.inffuse.local:28099";var f=["http:/",g,"app:"+a.app.id(),"users","user:"+a.user.id()].join("/");console.log("To manage the user go to: ",f)}}})(InffuseWelcomebar);(function(c){var b={"name": null, "created": 1587147116000, "plan_override": null, "email": "ryan@beamersmoke.com", "platform": "bigcommerce", "plan": "free", "key_name": "490225", "id": "user_zT0yx9t3p2WDTv3eNRIXA"};var a={};c.user=new c.UserClass(b,a)})(InffuseWelcomebar); /* project */ (function(a){a.ProjectClass=function(d,f){var b=this;var i=false;var e=a.user.accessToken()?"private":"public";var c={};var h;function g(){c["private"]=new a.DataStore("projects",b.id(),"private");c["public"]=new a.DataStore("projects",b.id(),"public");h=c[e];h.populate(f)}this.meta=function(j){return d?d[j]:null};this.getDataStore=function(j){if(j){return c[j]}return h};this.id=function(){return d?d.id:null};this.created=function(){return meta?meta.created:null};this.key=function(){return d?d.key_name:null};this.name=function(){return d?d.name:null};this.isNew=function(){return d["new"]==true};this.set=function(k,m,j,l){if(!this.id()){return a.error("Project does not exist")}return this.getDataStore(l).set(k,m,j)};this.get=function(k,j){if(!this.id()){return a.error("Project does not exist")}return h.get(k,j)};this.loadData=function(k,l,j){if(!this.id()){return a.error("Project does not exist")}return this.getDataStore(l).loadData(k,j)};this.append=function(j,k){if(!this.id()){return a.error("Project does not exist")}return h.append(j,k)};this.del=function(j,k){return h.del(j,k)};this.setData=function(j){return h.setData(j)};this.setMulti=function(k,j){if(!this.id()){a.error("Project does not exist")}return h.setMulti(k,j)};this.setToken=function(l,j,k){var m={project:b.id(),service:l,key:j,value:k};return a.requestAPI("projects/settoken",m,"POST")};this.save=function(){if(!this.id()){a.error("Project does not exist")}return h.save()};this.publish=function(){a.broadcast("project-published",undefined,true);var j=["projects",b.id(),"data","publish"].join("/");var k={user:a.user.id(),project:b.id()};return a.requestAPI(j,k,"POST")};this.remove=function(){a.broadcast("project-deleted",undefined,true);var j=["projects",b.id()].join("/");var k={user:a.user.id()};return a.requestAPI(j,k,"DELETE",false,true)};this.refreshWidget=function(j){a.broadcast("refresh-widget",j)};this.updateHeight=function(j){if(typeof j=="undefined"){var k=$(".inffuse-container");if(!k.length){k=$(document)}j=k.outerHeight()}b.resize({height:j})};this.resize=function(j){if(j.height&&a.platform=="wix"&&typeof Wix!="undefined"){Wix.setHeight(j.height)}a.broadcast("resize",j)};this.preview=function(j){b.refreshWidget(j)};this.manage=function(){var k=a.server.indexOf("local")==-1?"dashboard.inffuse.com":"dev.inffuse.local:28099";var j=["http:/",k,"app:"+a.app.id(),"users","project:"+b.id()].join("/");console.log("To manage the project go to: ",j)};g()}})(InffuseWelcomebar);(function(c){var a={"user_id": "user_zT0yx9t3p2WDTv3eNRIXA", "name": null, "created": 1587387958000, "key_name": "1", "site_id": "site_ZxrR3fXYUVx18iGP3TOgg", "state": null, "accessed": 1714176347000, "accessed_from": "", "id": "proj_SIKGNfvFPCCaC193Ayf8M"};var b={"Installdate": 1587387958928, "fontFamily": "'Open Sans', sans-serif", "closeButton": "true", "Addressbook": [{"date": "2021-07-19T18:09:56.038Z", "email": "austin.valdez@gmail.com"}], "BarText": {"ShareLikeFollow": "Connect with us!", "ClickLink": "Check out this link", "None": "We're back! Thanks for choosing Beamer Smoke. ", "CollectEmail": "Join our mailing list"}, "slider": false, "fontSize": "12", "backgroundcolor": "rgba(36,36,36,1)", "removePoweredby": "true"};if(a){c.project=new c.ProjectClass(a,b)}})(InffuseWelcomebar); /* ui */ (function(a){a.ui=new function(){var b=this;this.init=function(){$("[data-section-title]").click(function(){b.toggleSection($(this).parent())})};this.toggleSection=function(d){var c=d.hasClass("open");$("[data-section]").removeClass("open");$("[data-section]").addClass("closed");if(c){d.removeClass("open");d.addClass("closed")}else{d.addClass("open");d.removeClass("closed")}};this.openColorSelect=function(o,s,h){if(o.find(".colorpopup").length){return}function k(i){var v=o.find("input.hex");v.val(a.ui.rgbToHex(i))}function m(v){var i=$(v.target);if(i.hasClass("colorcell")){o.find(".current").removeClass("current");i.addClass("current");k(i.attr("data-color"));p()}v.preventDefault();return false}function q(i){o.find(".colorpopup").remove();$("body").unbind("click",q);if(i){i.preventDefault()}}function p(v){var i=o.find(".hex").val();i=a.ui.hexToRgb(i);if(i){h(i)}q()}var r=[["","rgb(0,0,0)","rgb(77,77,77)","rgb(115,115,115)","rgb(171,171,171)","rgb(224,224,224)","rgb(242,242,242)","rgb(255,255,255)"],["rgb(255,0,0)","rgb(255,153,0)","rgb(255,255,0)","rgb(0,255,0)","rgb(0,255,255)","rgb(0,0,255)","rgb(153,0,255)","rgb(255,0,255)"],["rgb(244,204,204)","rgb(252,229,205)","rgb(255,242,204)","rgb(217,234,211)","rgb(208,224,227)","rgb(207,226,243)","rgb(217,210,233)","rgb(234,209,220)"],["rgb(234,153,153)","rgb(249,203,156)","rgb(255,229,153)","rgb(182,215,168)","rgb(162,196,201)","rgb(159,197,232)","rgb(180,167,214)","rgb(213,166,189)"],["rgb(224,102,102)","rgb(246,178,107)","rgb(255,217,102)","rgb(147,196,125)","rgb(118,165,175)","rgb(111,168,220)","rgb(142,124,195)","rgb(194,123,160)"],["rgb(204,0,0)","rgb(230,145,56)","rgb(241,194,50)","rgb(106,168,79)","rgb(69,129,142)","rgb(61,133,198)","rgb(103,78,167)","rgb(166,77,121)"],["rgb(153,0,0)","rgb(180,95,6)","rgb(191,144,0)","rgb(56,118,29)","rgb(19,79,92)","rgb(11,83,148)","rgb(53,28,117)","rgb(116,27,71)"],["rgb(102,0,0)","rgb(120,63,4)","rgb(127,96,0)","rgb(39,78,19)","rgb(12,52,61)","rgb(7,55,99)","rgb(32,18,77)","rgb(76,17,48)"]];var n=[["rgb(0,0,0)","rgb(153,51,0)","rgb(51,51,0)","rgb(0,0,128)","rgb(51,51,153)","rgb(51,51,51)"],["rgb(128,0,0)","rgb(255,102,0)","rgb(128,128,0)","rgb(0,128,0)","rgb(0,128,128)","rgb(0,0,255)"],["rgb(102,102,153)","rgb(128,128,128)","rgb(255,0,0)","rgb(255,153,0)","rgb(153,204,0)","rgb(51,153,102)"],["rgb(51,204,204)","rgb(51,102,255)","rgb(128,0,128)","rgb(153,153,153)","rgb(255,0,255)","rgb(255,204,0)"],["rgb(255,255,0)","rgb(0,255,0)","rgb(0,255,255)","rgb(0,204,255)","rgb(153,51,102)","rgb(192,192,192)"],["rgb(255,153,204)","rgb(255,204,153)","rgb(255,255,153)","rgb(204,255,255)","rgb(153,204,255)","rgb(255,255,255)"]];var d=$('
');for(var j in n){var f=$('
');for(var u in n[j]){var t=n[j][u];var g=(t=="")?"url(/static/wix/img/none.png)":t;var e=$('
');if(t==s){e.addClass("current")}f.append(e);e.click(m)}d.append(f)}var l=$('
hex:
');l.find("input").change(m);d.append(l);var c=$('');c.click(p).append('
');d.append(c);o.append(d);if(d.offset().top+d.height()>$("body").height()){d.addClass("top")}setTimeout(function(){k(s);$("body").bind("click",q);$(d).click(function(){return false})},0)};this.rgbToHex=function(c){if(typeof c=="undefined"){return""}function d(f){var e=(1*f).toString(16);return e.length==1?"0"+e:e}c=c.substr(4,c.length-5);return"#"+c.split(",").map(d).join("")};this.hexToRgb=function(e){var c=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(!c){c=/^#?([a-f\d])([a-f\d])([a-f\d])$/i.exec(e)}if(!c){return null}c.shift();var d=c.map(function(f){if(f.length==1){f=f+f}return parseInt(f,16)});return"rgb("+d.join(",")+")"};this.addCssRule=function(c,d){d=d+" !important";if(document.styleSheets[1].insertRule){document.styleSheets[1].insertRule(c+" {"+d+" }",0)}else{if(document.styleSheets[1].addRule){document.styleSheets[1].addRule(c,d,0)}}};this.opacity=function(c,d){if(!c){return c}if(c[0]=="#"){c=c.substr(1);shorthand=(c.length==3);if(shorthand){colors=[c[0]+c[0],c[1]+c[1],c[2]+c[2]]}else{colors=[c.substr(0,2),c.substr(2,2),c.substr(4,2)]}colors=colors.map(function(e){return parseInt(e,16)});colors.push(d);c="rgba("+colors.join(",")+")"}else{if(c.indexOf("rgb")==0){c=c.replace("rgb(","");c=c.replace("rgba(","");c=c.replace(")","");c=c.replace(" ","");colors=c.split(",").slice(0,3);colors.push(d);c="rgba("+colors.join(",")+")"}else{if(c.indexOf("hsl")==0){c=c.replace("hsl(","");c=c.replace("hsla(","");c=c.replace(")","");c=c.replace(" ","");colors=c.split(",").slice(0,3);colors.push(d);c="hsla("+colors.join(",")+")"}}}return c};this.openModal=function(c){a.ui.alert("Inffuse error :: openModal is not supported on "+a.platform+" platform")};this.closeModal=function(){a.ui.alert("Inffuse error :: closeModal is not supported on "+a.platform+" platform")};this.alert=function(c){alert(c)}}})(InffuseWelcomebar); /* quotas */ (function(a){a.quotas=new function(){var b={};this.get=function(c){if(typeof b[c]=="undefined"){return -1}return b[c]};this.consume=function(e,d){if(typeof d=="undefined"){d=1}params={};params.count=d;var c=b[e];if(typeof c=="undefined"){return false}if(c.value==0){return false}switch(c.scope){case"project":params.project=a.project.id();break;case"user":params.user=a.user.id();break;case"site":params.site=a.site.id();break}return a.requestAPI("quotas/"+e+"/consume",params,"POST").success(function(f){c.remaining=f.remaining})}}})(InffuseWelcomebar); /* bigcommerce */ InffuseWelcomebar.ready(); /* services */ (function(a){a.services=new function(){function b(g,j,c,e){var l=[j,c].join(".");var f=l.split(".");for(var h=0;h