source: main/trunk/model-interfaces-dev/whakatohea/iframe/Tīpuna-WMTB_files/main-commerce-browse.js@ 33835

Last change on this file since 33835 was 33835, checked in by davidb, 4 years ago

Supporting iframe files now located within interface area

File size: 59.6 KB
Line 
1publishedWBJP([13],{0:function(t,e,i){t.exports=i(611)},20:function(t,e,i){var n,o;!(n=[],o=function(){window._W.Analytics=window._W.Analytics||{trackers:{}};var t;var e={getGA:function(){var t=window.ga;var e=window.gaTrackingId;if(typeof e!=="undefined"&&typeof t!=="undefined"){return t}else{return function(){}}},getWeeblyGA:function(){var t=window[window._W.Analytics.trackers.wGA];if(typeof t!=="undefined"){return function(){t.push(Array.prototype.slice.call(arguments))}}else{return function(){}}},getSP:function(){var t=window[window._W.Analytics.trackers.wSP];if(typeof t!=="undefined"){return function(){t.apply(this,arguments)}}else{return function(){}}},getKeen:function(){var t=window.Keen;if(typeof t!=="undefined"){return function(){t.addEvent.apply(t,arguments)}}else{return function(){}}},getMixpanel:function(){var t=window.mixpanel&&window.mixpanel.wsite;if(typeof t!=="undefined"){return function(){t.track.apply(t,arguments)}}else{return function(){}}},getIdPrefix:function(){if(t){return t}t="";if(window._W.Analytics.user_id){t=window._W.Analytics.user_id}if(window._W.Analytics.site_id){t+=":"+window._W.Analytics.site_id}return t},fireTrackingCode:function(t,e){var i=document.getElementById("tracking-pixel-"+t);if(i!=null){var n=document.createElement("iframe");n.setAttribute("src","about:blank");n.setAttribute("style","width: 0; height: 0; border: none; overflow: hidden;");document.querySelector("body").appendChild(n);var o=this.decodeHtml(i.innerHTML);if(e){o=o.replace(/{txid}/g,e.get("site_order_id"));o=o.replace(/{tax}/g,e.get("order_tax_total"));o=o.replace(/{shipping}/g,e.get("order_shipping_subtotal"));o=o.replace(/{subtotal}/g,e.get("order_subtotal"));o=o.replace(/{total}/g,e.get("order_total"))}var r="<!DOCTYPE html>"+"<head></head>"+"<body>"+o+"</body></html>";setTimeout(function(){var t=n.contentDocument;t.open().write(r);t.close()},500)}},trackPageView:function(t,e){var i=this.getGA();var n=this.getWeeblyGA();var o=this.getSP();var r=this.getKeen();var a=this.getMixpanel();i("send","pageview",{page:t,title:e});n("_trackPageview",t,e);o("trackPageView",e);r("wsite-views",{title:e});a("wsite-views",{title:e})},trackTransaction:function(t){var e=this.getGA();var i=this.getSP();var n=this.getKeen();var o=this.getMixpanel();var r={id:t.get("site_order_id"),revenue:t.get("order_total"),shipping:t.get("order_shipping_total"),tax:t.get("order_tax_total")};if(typeof window.gaAffiliation!=="undefined"){r["affiliation"]=window.gaAffiliation}e("require","ecommerce","ecommerce.js");e("ecommerce:addTransaction",r);i("addTrans",r.id,null,r.revenue,r.tax,r.shipping);n("wsite-order",{order:r});o("wsite-order",{order:r});var a=t.get("items");if(Array.isArray(a)){for(var s=0;s<a.length;s++){var c=a[s];var u={id:c.site_order_id,name:c.name,sku:c.sku,quantity:c.quantity,price:c.total_price/c.quantity};e("ecommerce:addItem",u);i("addItem",c.site_order_id,c.site_product_id+"-"+c.site_product_sku_id,c.name,c.sku,c.total_price/c.quantity,c.quantity);n("wsite-order-items",{item:u});o("wsite-order-items",{item:u})}}else{a.each(function(t){var r={id:t.get("site_order_id"),name:t.get("name"),sku:t.get("sku"),quantity:t.get("quantity"),price:t.get("total_price")/t.get("quantity")};e("ecommerce:addItem",r);i("addItem",t.get("site_order_id"),t.get("site_product_id")+"-"+t.get("site_product_sku_id"),t.get("name"),t.get("sku"),t.get("total_price")/t.get("quantity"),t.get("quantity"));n("wsite-order-items",{item:r});o("wsite-order-items",{item:r})})}e("ecommerce:send");i("trackTrans")},viewProductDetail:function(t){t.list="product_detail";this.addEnhancedImpressionContext(t);this.addEnhancedProductContext(t);this.trackEcommerceAction("detail",{list:"product_detail"})},trackCheckoutLanding:function(t){this.addProductContextsForOrder(t);this.trackEcommerceAction("view",{site_order_id:t.get("site_order_id"),list:"view:checkout",affiliation:"shopping.checkout"})},trackAddToCart:function(t,e,i){this.trackCartModification("add",t,e,i)},trackRemoveFromCart:function(t,e,i){this.trackCartModification("remove",t,e,i)},trackCartModification:function(t,e,i,n){if(e){n.list=e;i.list=e}this.addEnhancedProductContext(i);this.trackEcommerceAction(t,n)},trackCheckoutProgress:function(t,e,i){this.addProductContextsForOrder(i);this.trackEcommerceAction("checkout",{site_order_id:i.get("site_order_id"),revenue:i.get("order_total"),tax:i.get("order_tax_total"),shipping:i.get("order_shipping_total"),step:t,list:e})},trackCheckoutOption:function(t,e,i,n){this.trackEcommerceAction("checkout_option",{site_order_id:n.get("site_order_id"),revenue:n.get("order_total"),tax:n.get("order_tax_total"),step:t,option:i,list:e})},addProductContextsForOrder:function(t){var e=this;t.get("items").each(function(t){e.addEnhancedProductContext({site_product_id:t.get("site_product_id"),site_product_sku_id:t.get("site_product_sku_id"),name:t.get("name"),optionshash:t.get("options"),price:t.get("current_price"),quantity:t.get("quantity")})})},addEnhancedImpressionContext:function(t){var e=this.getSP()},trackEcommerceNativePaymentCheckoutStarted:function(t,e){var i=this.getSP();if(e.site_order_id){e.id=this.getIdPrefix()+":"+e.site_order_id}i("trackStructEvent",t,"start_checkout",null,e.id,null)},trackEcommerceABTestSegment:function(t,e,i){var n=this.getSP();if(i.site_order_id){i.id=this.getIdPrefix()+":"+i.site_order_id}n("trackStructEvent","ab_segment",t,e,i.id,null)},trackEcommerceCheckoutInstrument:function(t,e){var i=this.getSP();if(e.site_order_id){e.id=this.getIdPrefix()+":"+e.site_order_id}i("trackStructEvent","commerce","checkout","instrument",e.id,t)},trackNativePaymentError:function(t,e){var i=this.getSP();i("trackStructEvent","native_payment","error",t||"",this.getIdPrefix()+":"+e,null)},trackClosedNativePayment:function(t){var e=this.getSP();e("trackStructEvent","native_payment","user_closed","",this.getIdPrefix()+":"+t,null)},trackStoredPaymentAction:function(t,e,i){this.trackEcommerceAction(t,{site_order_id:i,list:e,affiliation:"shopping.checkout"})},trackEcommerceAction:function(t,e){var i=this.getSP();var n=["click","detail","add","remove","checkout","checkout_option","purchase","refund","promo_click","view"];if(n.indexOf(t)===-1){t="view"}if(e){if(e.site_order_id){e.id=this.getIdPrefix()+":"+e.site_order_id}i("addEnhancedEcommerceActionContext",e.id||"",e.affiliation||"",e.revenue||"",e.tax||"",e.shipping||"",e.coupon||"",e.list||"",e.step||"",e.affiliation||"")}i("trackEnhancedEcommerceAction",t)},addEnhancedProductContext:function(t){var e=this.getSP();if(t.optionshash){t.variant=Object.values(t.optionshash||{}).join("/")}if(t.site_product_id){t.id=this.getIdPrefix()+":"+t.site_product_id}if(t.site_product_sku_id){t.id+=":"+t.site_product_sku_id}e("addEnhancedEcommerceProductContext",t.id||"",t.name||"",t.list||"",t.brand||"",t.category||"",t.variant||"",t.price||"",t.quantity||"",t.coupon||"",t.position||"")},trackCustomerAccountsAction:function(t){var e=this.getSP();e("trackStructEvent","customer_accounts",t,"",this.getIdPrefix(),null)},trackPageAction:function(t,e,i,n,o){if(!t){throw new Error("Missing param 1. Category must be defined")}if(!e){throw new Error("Missing param 2. Action must be defined")}var r=this.getSP();r("trackStructEvent",t,e,i?i:null,n?n:null,o?o:null)},decodeHtml:function(t){var e=document.createElement("div");e.innerHTML=t;return e.childNodes.length===0?"":e.childNodes[0].nodeValue}};return e}.apply(e,n),o!==undefined&&(t.exports=o))},22:function(t,e,i){var n,o;!(n=[i(2),i(1)],o=function(t,e){var i={filterOptionText:function(t){return t.replace(/<#[A-Za-z0-9]+>$/,"")},saveProductField:function(i,n,o){var r=e("#"+i);var a=r[0].className.match(/price|title|description/);if(a){a=a[0]}if(a==="price"){n=r.text();n=n.replace(/[^\d\.]/g,"")}var s;if(a){s=i.replace(/[^\d]/g,"")}else{s=t.Elements.getCurrentProductID()}var c=r[0].up(".element");var u=c?c.id:"";new window.Ajax.Request(window.ajax,{parameters:{pos:"updateproduct",productID:s,type:a,value:n,ucfid:u,align:o,cookie:document.cookie,token:t.RequestToken},onFailure:window.errFunc})}};window.saveProductField=i.saveProductField;return i}.apply(e,n),o!==undefined&&(t.exports=o))},54:function(t,e,i){var n,o;!(n=[i(2),i(1)],o=function(t,e){function i(t,i){var n=function(){};n.prototype=new t;n.prototype.constructor=n;n.prototype.parent=t.prototype;n.prototype=e.extend(n.prototype,i);return n}var n=i(Object,{element:null,id:null,value:null,delta:0,valid:true,name:null,selectionMessage:null,minSelected:0,maxSelected:0,initialize:function(t){this.element=e(t);this.id=this.element.data("modifier-id");this.name=this.element.data("modifier-name");this.minSelected=this.element.data("min-selected");this.maxSelected=this.element.data("max-selected");this.resetSelectionMessage()},onChange:function(t){this.element.on("modifier:changed",t)},getPriceDelta:function(){return this.delta},getSelection:function(){return null},isValid:function(){return this.valid},getSelectionMessage:function(){return this.selectionMessage},isValueEmpty:function(){return this.value==null||this.value===""},resetSelectionMessage:function(){this.selectionMessage=this.element.data("modifier-selection-message")||t.stl("product_modifiers.validation.generic",this.name)}});n.extend=function(t){return i(n,t)};return n}.apply(e,n),o!==undefined&&(t.exports=o))},55:function(t,e,i){var n,o;!(n=[i(1)],o=function(t){function e(e,i){var n=function(){};n.prototype=new e;n.prototype.constructor=n;n.prototype.parent=e.prototype;n.prototype=t.extend(n.prototype,i);return n}var i=e(Object,{initialize:function(e){this.el=e.el;this.$el=t(this.el);this.onChange=typeof e.onChange==="function"?e.onChange:function(){};this.initializeEvents();this.render()},initializeEvents:function(){},render:function(){}});return i}.apply(e,n),o!==undefined&&(t.exports=o))},60:function(t,e,i){var n,o;!(n=[i(2),i(5),i(61)],o=function(t,e,i){var n=e.Collection.extend({model:i,sync:function(e,i,n){if(e==="read"){t.Commerce.RPC.Checkout.getCart().done(function(t){i.reset(t.data.order.items)})}},subtotal:function(){var t=this.models,e=0;for(var i=0;i<t.length;i++){e+=t[i].get("total_price")}return e}});return n}.apply(e,n),o!==undefined&&(t.exports=o))},61:function(t,e,i){var n,o;!(n=[i(2),i(3),i(7)],o=function(t,e,i){var n=i.RelationalModel.extend(e.extend({sync:function(t,e,i){}},t.Commerce.BackboneModelData.OrderItem));return n}.apply(e,n),o!==undefined&&(t.exports=o))},84:function(t,e,i){var n,o;!(n=[i(2),i(3),i(7)],o=function(t,e,i){var n=i.RelationalModel.extend(e.extend({},t.Commerce.BackboneModelData.Order));return n}.apply(e,n),o!==undefined&&(t.exports=o))},86:function(t,e,i){var n,o;!(n=[i(2),i(3),i(5),i(6),i(22)],o=function(t,e,i,n,o){var r=i.View.extend({tagName:"div",initialize:function(t){this.options=t;this.render()},render:function(){var e='<input type="hidden" name="item_name_{{ itemNumber }}" value="{{ name }}">'+'<input type="hidden" name="amount_{{ itemNumber }}" value="{{ price }}">'+'<input type="hidden" name="quantity_{{ itemNumber }}" value="{{ quantity }}">';var i=this.model.get("name");if(!i){i=this.model.get("short_description")?this.model.get("short_description").substring(0,60):t.stl("javascript.commerce.site.view.checkout.OrderItem.PaypalItem_1")}var o={quantity:this.model.get("quantity"),name:i,price:this.model.get("discounted_price"),itemNumber:this.options.itemNumber+1};e=n.render(e,o);e+=this.renderOptions();this.$el.html(e);return this},renderOptions:function(){var t=this;var i="";var r='<input type="hidden" name="on{{ index }}_{{ itemNumber }}" value="{{ name }}">'+'<input type="hidden" name="os{{ index }}_{{ itemNumber }}" value="{{ value }}">';if(!e.isEmpty(this.model.get("options"))){var a=0;e.each(this.model.get("options"),function(e,s){var c={itemNumber:t.options.itemNumber+1,value:o.filterOptionText(e),name:s,index:a++};i+=n.render(r,c)})}return i}});return r}.apply(e,n),o!==undefined&&(t.exports=o))},89:function(t,e,i){var n,o;!(n=[i(1),i(6),i(7)],o=function(t,e,i){var n='<div class="{{classPrefix}}-image-container wsite-imageaspectratio-image-container">';n+=' <div class="{{classPrefix}}-image-height wsite-imageaspectratio-image-height"></div>';n+=' <div class="{{classPrefix}}-image-wrap wsite-imageaspectratio-image-wrap">';n+=' <img class="{{classPrefix}}-image wsite-imageaspectratio-image" style="width:{{imagePercentWidth}}%;top:{{imagePercentTop}}%;left:{{imagePercentLeft}}%" />';n+=" </div>";n+="</div>";var o=e.compile(n);function r(e,n,o,r,l){var h,f,m,v;var g=Math.floor((1+Math.random())*16777216).toString(16).substring(1);l=l||n.regenerate&&n.regenerate.bind(n);if(typeof n=="string"){m=u(n.replace("{size}",o));v=a(e,m,o,r,l)}else if(n instanceof i.Model){o=n.getMaxAvailableWidth(o);m=u(n.uri(o));f=Math.round(n.get("width")/n.get("height")*1e4)/1e4}else{if(n.hasOwnProperty("width")){var w=parseInt(n["width"]);if(o>w){o=w}}m=u(n["url"].replace("{size}",o));f=Math.round(n.width/n.height*1e4)/1e4}if(f){var y=s(f,r),_=0;if(d()){v=p(e,m)}else{var C=c(e,y);var x=t("<div>").append(C);x.find("img").attr("id",g).error(function(){_++;if(_==10){l&&l()}t("#"+g).attr("src","//"+window.ASSETS_BASE+"/images/blank.gif").addClass("image-waiting");if(_<60){setTimeout(function(){x.find("img").attr("src",m)},2500)}}).load(function(){t("#"+g).attr("src",m).removeClass("image-waiting")}).attr("src",m);v=x.html()}}return v}function a(e,i,n,o,r){var a=Math.floor((1+Math.random())*16777216).toString(16).substring(1);var c=i.replace("{size}",n);var u=new Image;t(u).on("load",function(){var t=Math.round(this.width/this.height*1e4)/1e4;var i=s(t,o);l(e,i,c,r,a)});u.src=i;return'<div id="'+a+'" class="aspectratio-image-loading"></div>'}function s(t,e){var i;var n;var o;if(typeof e==="string"){e=1}if(t>e){n=(t/e*100).toFixed(2);o=0;i=-((t/e-1)/2*100).toFixed(2)}else{n=100;o=-((e/t-1)/2*100).toFixed(2);i=0}return{width:n,top:o,left:i}}function c(t,e){return o({classPrefix:t,imagePercentWidth:e.width,imagePercentTop:e.top,imagePercentLeft:e.left})}function u(t){var e=t;var i=t.charAt(0)=="/";var n=t.indexOf("://")>=0;if(!i&&!n){e="//"+t}return e}function l(e,i,n,o,r,a){var s=t("#"+r),u=0;if(s.length>0){s.removeClass("aspectratio-image-loading");if(d()){var h=p(e,n);s.html(h)}else{var h=c(e,i);s.html(h);s.find("img").error(function(){u++;o&&o();window.$html.find("img").hide();if(u<60){setTimeout(function(){window.$html.find("img").attr("src",n+"?"+Date.now()).show()},2500)}}).attr("src",n)}}else{setTimeout(function(){if(a<5){a=(a||0)+1;l(e,i,n,o,r,a)}},50)}}function d(){return false}function p(t,e){var i='<span class="wsite-css-sizer '+t+'-sizer"></span>';return'<div class="wsite-css-aspect '+t+'-css-aspect" style="background-image: url('+e+');">'+i+"</div>"}return r}.apply(e,n),o!==undefined&&(t.exports=o))},122:function(t,e,i){var n,o;!(n=[i(2)],o=function(t){var e={customerLocale:t.customerLocale,storeCurrency:t.storeCurrency,setCustomerLocale:function(t){this.customerLocale=t},setStoreCurrency:function(t){this.storeCurrency=t}};return e}.apply(e,n),o!==undefined&&(t.exports=o))},123:function(t,e,i){var n,o;!(n=[],o=function(){var t={formatCurrency:function(t,e,i){t=parseFloat(t);if(e){e=e.replace("_","-")}else{e=navigator.language||"en-US"}return t.toLocaleString(e,{style:"currency",currency:i})},formatTaxRate:function(t){return(t*100).toLocaleString(undefined,{maximumFractionDigits:this.DEFAULT_TAX_RATE_DECIMALS})},DEFAULT_TAX_RATE_DECIMALS:3};return t}.apply(e,n),o!==undefined&&(t.exports=o))},127:function(t,e,i){var n=i(1);!function(t){"use strict";var e=function(t,e){this.init("tooltip",t,e)};e.prototype={constructor:e,init:function(e,i,n){var o,r,a,s,c;this.type=e;this.$element=t(i);this.options=this.getOptions(n);this.enabled=true;a=this.options.trigger.split(" ");for(c=a.length;c--;){s=a[c];if(s=="click"){this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this))}else if(s!="manual"){o=s=="hover"?"mouseenter":"focus";r=s=="hover"?"mouseleave":"blur";this.$element.on(o+"."+this.type,this.options.selector,t.proxy(this.enter,this));this.$element.on(r+"."+this.type,this.options.selector,t.proxy(this.leave,this))}}this.options.selector?this._options=t.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(e){e=t.extend({},t.fn[this.type].defaults,this.$element.data(),e);if(e.delay&&typeof e.delay=="number"){e.delay={show:e.delay,hide:e.delay}}return e},enter:function(e){var i=t.fn[this.type].defaults,n={},o;this._options&&t.each(this._options,function(t,e){if(i[t]!=e)n[t]=e},this);o=t(e.currentTarget)[this.type](n).data(this.type);if(!o.options.delay||!o.options.delay.show)return o.show();clearTimeout(this.timeout);o.hoverState="in";this.timeout=setTimeout(function(){if(o.hoverState=="in")o.show()},o.options.delay.show)},leave:function(e){var i=t(e.currentTarget)[this.type](this._options).data(this.type);if(this.timeout)clearTimeout(this.timeout);if(!i.options.delay||!i.options.delay.hide)return i.hide();i.hoverState="out";this.timeout=setTimeout(function(){if(i.hoverState=="out")i.hide()},i.options.delay.hide)},show:function(){var e,i,n,o,r,a,s=t.Event("tooltipshow");if(this.hasContent()&&this.enabled){this.$element.trigger(s);if(s.isDefaultPrevented())return;e=this.tip();this.setContent();if(this.options.animation){e.addClass("fade")}r=typeof this.options.placement=="function"?this.options.placement.call(this,e[0],this.$element[0]):this.options.placement;e.detach().css({top:0,left:0,display:"block"});this.options.container?e.appendTo(this.options.container):e.insertAfter(this.$element);i=this.getPosition();n=e[0].offsetWidth;o=e[0].offsetHeight;switch(r){case"bottom":a={top:i.top+i.height,left:i.left+i.width/2-n/2};break;case"top":a={top:i.top-o,left:i.left+i.width/2-n/2};break;case"left":a={top:i.top+i.height/2-o/2,left:i.left-n};break;case"right":a={top:i.top+i.height/2-o/2,left:i.left+i.width};break}this.applyPlacement(a,r);this.$element.trigger("shown")}},applyPlacement:function(t,e){var i=this.tip(),n=i[0].offsetWidth,o=i[0].offsetHeight,r,a,s,c;i.offset(t).addClass(e).addClass("in");r=i[0].offsetWidth;a=i[0].offsetHeight;if(e=="top"&&a!=o){t.top=t.top+o-a;c=true}if(e=="bottom"||e=="top"){s=0;if(t.left<0){s=t.left*-2;t.left=0;i.offset(t);r=i[0].offsetWidth;a=i[0].offsetHeight}this.replaceArrow(s-n+r,r,"left")}else{this.replaceArrow(a-o,a,"top")}if(c)i.offset(t)},replaceArrow:function(t,e,i){this.arrow().css(i,t?50*(1-t/e)+"%":"")},setContent:function(){var t=this.tip(),e=this.getTitle();t.find(".tooltip-inner")[this.options.html?"html":"text"](e);t.removeClass("fade in top bottom left right")},hide:function(){var e=this,i=this.tip(),n=t.Event("tooltiphide");this.$element.trigger(n);if(n.isDefaultPrevented())return;i.removeClass("in");function o(){var e=setTimeout(function(){i.off(t.support.transition.end).detach()},500);i.one(t.support.transition.end,function(){clearTimeout(e);i.detach()})}t.support.transition&&this.$tip.hasClass("fade")?o():i.detach();this.$element.trigger("hidden");return this},fixTitle:function(){var t=this.$element;if(t.attr("title")||typeof t.attr("data-original-title")!="string"){t.attr("data-original-title",t.attr("title")||"").attr("title","")}},hasContent:function(){return this.getTitle()},getPosition:function(){var e=this.$element[0];return t.extend({},typeof e.getBoundingClientRect=="function"?e.getBoundingClientRect():{width:e.offsetWidth,height:e.offsetHeight},this.$element.offset())},getTitle:function(){var t,e=this.$element,i=this.options;t=e.attr("data-original-title")||(typeof i.title=="function"?i.title.call(e[0]):i.title);return t},tip:function(){return this.$tip=this.$tip||t(this.options.template)},arrow:function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},validate:function(){if(!this.$element[0].parentNode){this.hide();this.$element=null;this.options=null}},enable:function(){this.enabled=true},disable:function(){this.enabled=false},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(e){var i=e?t(e.currentTarget)[this.type](this._options).data(this.type):this;i.tip().hasClass("in")?i.hide():i.show()},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}};var i=t.fn.tooltip;t.fn.tooltip=function(i){return this.each(function(){var n=t(this),o=n.data("tooltip"),r=typeof i=="object"&&i;if(!o)n.data("tooltip",o=new e(this,r));if(typeof i=="string")o[i]()})};t.fn.tooltip.Constructor=e;t.fn.tooltip.defaults={animation:true,placement:"top",selector:false,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:false,container:false};t.fn.tooltip.noConflict=function(){t.fn.tooltip=i;return this}}(n);!function(t){"use strict";var e=function(t,e){this.init("popover",t,e)};e.prototype=t.extend({},t.fn.tooltip.Constructor.prototype,{constructor:e,setContent:function(){var t=this.tip(),e=this.getTitle(),i=this.getContent();t.find(".popover-title")[this.options.html?"html":"text"](e);t.find(".popover-content")[this.options.html?"html":"text"](i);t.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var t,e=this.$element,i=this.options;t=(typeof i.content=="function"?i.content.call(e[0]):i.content)||e.attr("data-content");return t},tip:function(){if(!this.$tip){this.$tip=t(this.options.template)}return this.$tip},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}});var i=t.fn.popover;t.fn.popover=function(i){return this.each(function(){var n=t(this),o=n.data("popover"),r=typeof i=="object"&&i;if(!o)n.data("popover",o=new e(this,r));if(typeof i=="string")o[i]()})};t.fn.popover.Constructor=e;t.fn.popover.defaults=t.extend({},t.fn.tooltip.defaults,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'});t.fn.popover.noConflict=function(){t.fn.popover=i;return this}}(n)},211:function(t,e,i){var n,o;!(n=[i(2),i(1),i(3),i(219),i(218),i(220),i(221),i(217),i(86),i(20),i(123),i(122),i(127),i(215),i(216),i(214),i(213)],o=function(t,e,i,n,o,r,a,s,c,u,l,d,p,h,f,m,v){function g(t){return e("<div>",{id:"wsite-com-issue-overlay",append:function(){return[e("<div>",{class:"close-overlay"}),e("<p>",{class:"warning-message",html:t})]},appendTo:"body",click:function(){e(this).remove()}})}function w(e,i,n){var o=e.popover({content:i?i:t.stl("javascript.commerce.site.view.ProductPageView_5"),trigger:"manual",placement:"top",container:"body"}).popover("show");if(n){window.setTimeout(function(){o.popover("hide")},n)}return o}function y(e,i,n){var o=e.popover({content:i?i:t.stl("javascript.commerce.site.view.BaseProductPageView_9"),trigger:"manual",placement:"top",container:"body"}).popover("show");if(n){window.setTimeout(function(){o.popover("hide")},n)}return o}var _={el:null,$el:null,selectors:{variationData:null,modifiersData:null,productElementContainer:null,productPageContainer:null,siteProductIdElement:null,productTitle:null,modifiersSelector:null,purchaseSourceSelector:null},options:{salePriceClass:null,nonSalePriceClass:null,soldOutPriceClass:null,priceRangeClass:null,unavailablePriceClass:null},ui:{},variationData:[],modifiersData:[],modifiersAggregate:null,initialize:function(){this.initializeUI();s.initialize(this.buy.bind(this));if(!this.$el.length){return}this.initializeVariations();this.initializeModifiers();if(this.variationData.length||this.modifiersAggregate){this.update()}u.viewProductDetail({site_product_id:e(this.selectors.siteProductIdElement).attr("data-id"),name:e(this.selectors.productTitle).eq(0).text().trim()})},initializeUI:function(){this.$el=e(this.el);if(!this.$el.length){return}this.el=this.$el[0];i.each(this.ui,function(t,e){this.ui[e]=this.$el.find(t)},this);e.event.trigger("viewproduct",[e(this.selectors.siteProductIdElement).attr("data-id")])},initializeVariations:function(){var t=this.$el.find(this.selectors.variationData)[0];this.variationData=t?JSON.parse(t.value):[];var i,s=this;this.ui["option-groups"].each(function(t,c){switch(c.getAttribute("data-type")){case"color":i=new o;break;case"radio":i=new r;break;case"text":i=new a;break;case"dropdown":default:i=new n;break}i.initialize({el:c,onChange:function(t){s.update.apply(s,arguments)}});e(c).data("renderer",i)})},initializeModifiers:function(){if(!this.selectors.modifiersSelector){return}var t=this.$el.find(this.selectors.modifiersSelector);var i={text:f,dropdown:m,checkbox:v};var n=new h;var o=this;n.onChange(function(t,e){o.update.apply(o,arguments)});t.each(function(){var t=e(this);var o=t.data("type");if(typeof i[o]!=="undefined"){var r=new i[o];r.initialize(t);n.add(r)}});this.modifiersAggregate=n},updateImage:function(){},update:function(e){if(e){if(this.modifiersAggregate){this.modifiersAggregate.modifiers.forEach(function(t){if(t.isValid()){t.element.popover("destroy")}})}if(this.ui["add-to-cart"]){this.ui["add-to-cart"].popover("destroy")}if(e.$el){e.$el.popover("destroy")}else{i.each(e,function(t,e){this.$el.find('[data-option-name="'+e+'"]').popover("destroy")},this)}}var n=this.getValues();var o=this.getCurrentRecord(n);var r=i.pluck(this.variationData,"options");this.updateAvailability(this.ui["option-groups"],r,n);var a=this.modifiersAggregate?this.modifiersAggregate.getPriceDelta():0;if(o){this.ui["price-area"].removeClass();if(this.options.salePriceClass){this.ui["price-area"].toggleClass(this.options.salePriceClass,!i.isNull(o.sale_price))}if(this.options.nonSalePriceClass){this.ui["price-area"].toggleClass(this.options.nonSalePriceClass,i.isNull(o.sale_price))}var s=l.formatCurrency(o.price+a,d.customerLocale,d.storeCurrency);this.ui["price-amount"].text(l.formatCurrency(o.price+a,d.customerLocale,d.storeCurrency));this.ui["price-sale-amount"].text(i.isNull(o.sale_price)?"":l.formatCurrency(o.sale_price+a,d.customerLocale,d.storeCurrency));if(o.inventory===0){this.ui["price-area"].addClass(this.options.soldOutPriceClass)}var c=this.modifiersAggregate?this.modifiersAggregate.isValid():true;var u=typeof o.inventory==="undefined"||o.inventory>0;var p=true;if(o.fulfillment_options&&o.fulfillment_options.length===1&&o.fulfillment_options[0]==="pickup"&&!o.pickup_location){p=false}var h=u&&c&&p;if(h){this.ui["add-to-cart"].removeClass("wsite-com-product-disabled").attr("tabindex",0)}else{this.ui["add-to-cart"].addClass("wsite-com-product-disabled").attr("tabindex",-1)}this.updateImage(o);return o}var f=this.getAvailableOptions(n,this.variationData);if(f.length===0){this.ui["price-area"].removeClass().addClass(this.options.unavailablePriceClass);if(this.ui["inventory-message"]){this.ui["inventory-message"].text(t.stl("javascript.commerce.site.view.ProductPageView_4"))}this.ui["price-amount"].empty();this.ui["price-sale-amount"].empty()}else{var m=i.find(f,function(t){return!i.isEmpty(t.image_order)});if(m!==undefined){this.updateImage({image_order:m.image_order})}this.updateProductLevelPricing(a);this.ui["price-area"].removeClass().addClass(this.options.priceRangeClass)}return null},getBasePurchasablePriceRange:function(){var t=this.variationData.map(function(t){return t.sale_price!==null?t.sale_price:t.price});return{min:i.min(t)||0,max:i.max(t)||0}},getPurchasablePriceRange:function(t){var e=this.getBasePurchasablePriceRange();return{min:e.min+t,max:e.max+t}},getFormattedPurchasablePriceRange:function(t){var e=this.getPurchasablePriceRange(t);return{min:l.formatCurrency(e.min,d.customerLocale,d.storeCurrency),max:l.formatCurrency(e.max,d.customerLocale,d.storeCurrency)}},updateProductLevelPricing:function(t){var e=this.getBasePurchasablePriceRange();var n=this.getFormattedPurchasablePriceRange(t);if(e.min!==e.max){this.ui["price-range-amount"].text(n.min+" - "+n.max)}else{this.ui["price-range-amount"].text(n.min)}var o=i.pluck(this.variationData,"price");var r=i.min(o)||0;var a=r+t;this.ui["price-amount"].text(l.formatCurrency(a,d.customerLocale,d.storeCurrency))},buy:function(n,o){var r=e(n.currentTarget);var a=this;n.stopPropagation();n.preventDefault();var s=e.Deferred().reject().promise();if(window.inEditor&&window.inEditor()){return s}var c=r.closest(this.selectors.productElementContainer);var l=true;if(!c.length){l=false;c=r.closest(this.selectors.productPageContainer)}c.find(".wsite-com-product-option").popover("destroy");r.popover("destroy");if(r.hasClass("wsite-soldout-product-button")){w(r);return s}if(this.ui.options&&!l){var d=this.getAllValues();var p=this.getUnmatchedValues(d);p.forEach(function(e){c.find('[data-option-name="'+e+'"]').popover({content:t.stl("javascript.commerce.site.view.ProductPageView_6",e),trigger:"manual",placement:a.placeOptionPopover,container:"body"}).popover("show")})}if(!l&&this.modifiersAggregate&&!this.modifiersAggregate.isValid()){this.modifiersAggregate.modifiers.map(function(t){if(!t.isValid()){t.element.popover({content:t.getSelectionMessage(),trigger:"manual",placement:a.placeOptionPopover,container:"body"}).popover("show")}})}var h;if(l){h={price:parseFloat(r.data("price")),sale_price:r.data("sale-price")?parseFloat(r.data("sale-price")):null,site_product_sku_id:r.data("site-product-sku-id"),site_product_id:r.data("site-product-id")};if(r.data("sale-price")===0){h.sale_price=0}}else{h=this.variationData.length===1?this.variationData[0]:this.getCurrentRecord(this.getValues(),this.variationData)}if(!h){return s}if(h.inventory===0){w(r);return s}if(h.fulfillment_options&&h.fulfillment_options.length===1&&h.fulfillment_options[0]==="pickup"&&!h.pickup_location){y(r);return s}if(r.hasClass("wsite-com-product-disabled")){return s}var f=h.sale_price!==null&&h.sale_price!==undefined?h.sale_price:h.price;if(f===null||f===undefined){return s}h.site_product_id=h.site_product_id||e(this.selectors.siteProductIdElement).attr("data-id");var m;if(!l){m=this.ui.quantity.val()}else{m=1}if(m<=0){return s}var v=false;h.custom_options=h.custom_options||{};if(o&&o.length){e.each(o,function(t,i){var n=a.validateTextInput(i);e(i).siblings(".text-option-error-message").text(n);if(n.length){v=true}h.custom_options[i.getAttribute("name")]=i.value})}if(v){return s}var _=r.find(".wsite-button-inner");var C=_.html();var x=this.$el.find("#wsite-com-product-quantity-limit-custom-message");return t.Commerce.RPC.Checkout.addItem(h.site_product_id,h.site_product_sku_id,m,h.custom_options,this.getModifiersSelection(),this.getPurchaseSource()).then(function(n){if(!n.success){if(n.data&&n.data.has_payment===false){g(n.message)}else{var o=n.data&&n.data.custom_exceeded_message;if(Boolean(o)){x.text(o)}w(r,n.message,3e3)}_.html(C);r.removeClass("wsite-disabled");return s}var c={};i.each(h.options,function(t,e){c[e]=t.choices});return t.Commerce.RPC.Checkout.getMiniCart().then(function(i){var o=t.Commerce.hasCart?"product_detail":"buy_now";u.trackAddToCart(o,{site_product_id:h.site_product_id,site_product_sku_id:h.site_product_sku_id,name:e(a.selectors.productTitle).eq(0).text().trim(),optionshash:c,quantity:m,price:f},{site_order_id:i.data.order.site_order_id});e.event.trigger("addtocart",[h.site_product_id]);return e.Deferred().resolve(n,false,i).promise()})}).fail(function(t,i){var n=e.parseJSON(i.responseText);if(n.error.code!=-1){g(t);_.html(C);r.removeClass("wsite-disabled")}return s})},getPurchaseSource:function(){if(!this.selectors.purchaseSourceSelector){return}var t=this.$el.find(this.selectors.purchaseSourceSelector);if(t.length>0){return t[0].value}return},getModifiersSelection:function(){if(!this.modifiersAggregate){return[]}return this.modifiersAggregate.getSelection()},updateAvailability:function(t,n,o){var r=this;var a,s,c;t.each(function(t,u){a={};c=u.getAttribute("data-option-name");s=i.omit(o,c);i.each(n,function(t){if(r.objectContains(t,s)){i.each(t,function(t,e){if(e===c){var i=t["renderer"]==="text"?o[c]||"":t.choices;a[i]={available:true,options:t}}})}});e(u).data("renderer").update(a)})},getValues:function(){
2var t;if(this.ui.options.is("form")){t=this.ui.options}else{t=this.ui.options.find("[name]")}var e=t.serializeArray();var n={};i.each(e,function(t){n[t.name]=t.value});return n},getAllValues:function(){var t={};this.ui.options.find("[name]").each(function(){if(!t[this.name]){t[this.name]=[]}t[this.name].push(this)});var n={};i.each(t,function(t,i){n[i]=null;var o=e(t).serializeArray();if(o.length){n[i]=o[0].value}});return n},getCurrentRecord:function(t,e){var n;this.variationData=e||this.variationData;i.each(this.variationData,function(e){var o={};e.custom_options={};i.each(e.options,function(i,n){o[n]=i["choices"];if(i["renderer"]==="text"&&!a.prototype.validateTextOption(i,t[n]).length){o[n]=e.custom_options[n]=t[n]}});if(i.isEqual(o,t)){n=e;return false}});return n},getUnmatchedValues:function(t){var e=Object.keys(t);i.each(this.variationData,function(n){i.each(n.options,function(i,n){var o=e.indexOf(n);if(o===-1){return}var r=i.choices;if(i.renderer==="text"&&!a.prototype.validateTextOption(i,t[n]).length){r=t[n]}if(t[n]===r){e.splice(o,1)}})});return e},getAvailableOptions:function(t,e){this.variationData=e||this.variationData;var n=i.filter(this.variationData,function(e){return i.every(t,function(t,i){return e.options[i].renderer=="text"||t==""||t==e.options[i].choices})});return n},validateTextInput:function(e){var i=!!e.getAttribute("data-required");var n=e.getAttribute("data-max-length");if(e.value===undefined){}else if(i&&e.value.length===0){return t.stl("javascript.commerce.site.view.BaseProductPageView_7")}else if(n&&e.value.length>n){return t.stl("javascript.commerce.site.view.BaseProductPageView_8",n)}return""},objectContains:function(t,e){var n=true;i.each(t,function(t,i){if(e[i]&&t["renderer"]!=="text"&&e[i]!==t["choices"]){n=false}});return n}};return _}.apply(e,n),o!==undefined&&(t.exports=o))},213:function(t,e,i){var n,o;!(n=[i(1),i(54)],o=function(t,e){var i=e.extend({checkboxes:[],initialize:function(i){e.prototype.initialize.call(this,i);this.checkboxes=t("input[type=checkbox]",i);var n=this;this.checkboxes.on("change",function(){var e=n.checkboxes.filter(":checked").map(function(){return{value:t(this).val(),delta:t(this).data("price")||0}}).toArray();n.value=e.map(function(t){return t.value});n.delta=e.reduce(function(t,e){return t+e.delta},0);n.validate.apply(n,null);n.element.trigger("modifier:changed",n)}).first().change()},getSelection:function(){if(this.value.length>0){return{id:this.id,value:this.value,name:this.element.data("modifier-name"),site_product_modifier_id:this.element.data("site-product-modifier-id")}}return null},validate:function(){var t=this.maxSelected===0;this.valid=this.value.length>=this.minSelected&&(t||this.value.length<=this.maxSelected)}});return i}.apply(e,n),o!==undefined&&(t.exports=o))},214:function(t,e,i){var n,o;!(n=[i(1),i(54)],o=function(t,e){var i=e.extend({initialize:function(i){e.prototype.initialize.call(this,i);var n=this;t("select",i).on("change",function(){var e=t(this);n.value=e.val();n.delta=t("option:selected",e).data("price")||0;n.validate.apply(n,null);n.element.trigger("modifier:changed",n)}).change()},getSelection:function(){if(this.value){return{id:this.id,value:[this.value],name:this.element.data("modifier-name"),site_product_modifier_id:this.element.data("site-product-modifier-id")}}return null},validate:function(){if(this.minSelected===this.maxSelected&&this.isValueEmpty()){this.selectionMessage=window._W.stl("product_modifiers.validation.required");this.valid=false;return}this.valid=true}});return i}.apply(e,n),o!==undefined&&(t.exports=o))},215:function(t,e,i){var n,o;!(n=[i(1),i(3),i(54)],o=function(t,e,i){var n=i.extend({modifiers:[],listeners:[],initialize:function(){},add:function(t){this.modifiers.push(t);var i=this;t.onChange(function(t){e.each(i.listeners,function(e){e.call(i,t,{delta:i.getPriceDelta(),selections:i.getSelection()})})})},getPriceDelta:function(){return this.modifiers.reduce(function(t,e){return t+e.getPriceDelta()},0)},getSelection:function(){return this.modifiers.map(function(t){return t.getSelection()}).filter(e.identity)},onChange:function(t){this.listeners.push(t)},isValid:function(){return!this.modifiers.some(function(t){return!t.isValid()})}});return n}.apply(e,n),o!==undefined&&(t.exports=o))},216:function(t,e,i){var n,o;!(n=[i(2),i(1),i(54)],o=function(t,e,i){var n=i.extend({initialize:function(t){i.prototype.initialize.call(this,t);var n=this;e(".text-modifier-input",t).on("change keyup paste",function(){n.value=e(this).val().trim();n.validate.apply(n,null);n.element.trigger("modifier:changed",n)}).change()},getSelection:function(){return{id:this.id,value:this.value,name:this.element.data("modifier-name"),site_product_modifier_id:this.element.data("site-product-modifier-id")}},validate:function(){if(this.minSelected>=1&&this.isValueEmpty()){this.selectionMessage=t.stl("product_modifiers.validation.required");this.valid=false;return}if(this.maxSelected>=1&&!this.isValueEmpty()&&this.value.length>this.maxSelected){this.resetSelectionMessage();this.valid=false;return}this.valid=true}});return n}.apply(e,n),o!==undefined&&(t.exports=o))},217:function(t,e,i){var n,o;!(n=[i(2),i(1)],o=function(t,e){var i={initialize:function(i){e(".wsite-product, .product").each(function(n,o){var r=e(o);var a=r.find("[data-add-to-cart]");var s=r.find(".product-text-option");if(a.length&&t.Commerce.RPC.Product.isInStock){t.Commerce.RPC.Product.isInStock(a.data("site-product-id"),a.data("site-product-sku-id")).done(function(t){if(!t){a.addClass("wsite-soldout-product-button")}});a.on({click:function(t){i(t,s)},keypress:function(t){if(t.which===32||t.which===13){i(t)}}})}})}};return i}.apply(e,n),o!==undefined&&(t.exports=o))},218:function(t,e,i){var n,o;!(n=[i(2),i(1),i(3),i(6),i(55)],o=function(t,e,i,n,o){var r=n.compile(['<div class="wsite-com-product-option-color-container {{^available}}wsite-com-product-option-color-unavailable{{/available}}">','<span class="wsite-com-product-option-color-select"></span>','<span class="wsite-com-product-option-color-swatch" style="background-color:{{color}}" title="{{name}}" data-value="{{value}}" tabindex="0"></span>',"</div>"].join(""));function a(t,i){var n=function(){};n.prototype=new t;n.prototype.constructor=n;n.prototype.parent=t.prototype;n.prototype=e.extend(n.prototype,i);return n}var s=a(o,{initializeEvents:function(){var t=this;this.select=this.$el.find("select");this.container=e(document.createElement("div")).addClass("wsite-com-product-option-swatches");this.select.after(this.container);this.$el.on("click",".wsite-com-product-option-color-swatch",function(){t.setValue(this.getAttribute("data-value"))});this.$el.on("keypress",".wsite-com-product-option-color-swatch",function(e){if(i.indexOf([32,13],e.which)!==-1){e.preventDefault();e.stopPropagation();t.setValue(e.target.getAttribute("data-value"))}})},setValue:function(t){var e={};e[this.select.attr("name")]=t;this.select.val(t);this.onChange(e);this.highlight(t)},render:function(){var i=this,n,o,a,s;this.select.addClass("w-input-offscreen").attr("tabindex","-1");this.select.children().each(function(c,u){if(u.value==="")return true;n=u.getAttribute("data-color-hex");o=u.getAttribute("data-color-name");a=u.getAttribute("data-available")==="1";s=e(r({available:a,color:n,name:a?o:o+"&nbsp;"+t.stl("javascript.commerce.site.view.renderers.ColorRenderer_1"),value:u.value}));i.container.append(s)});this.highlight(this.select.val())},highlight:function(t){this.container.find(".wsite-selected").removeClass("wsite-selected");if(t){this.container.find(".wsite-com-product-option-color-swatch").filter('[data-value="'+t+'"]').addClass("wsite-selected")}},update:function(t){var i,n,o=this,r=this.select.val();this.container.children(".wsite-com-product-option-color-container").each(function(o,r){i=e(r);n=i.find("[data-value]").attr("data-value");if(n!==""){i.toggleClass("wsite-com-product-option-color-unavailable",!t[n])}})}});return s}.apply(e,n),o!==undefined&&(t.exports=o))},219:function(t,e,i){var n,o;!(n=[i(2),i(1),i(55),i(22)],o=function(t,e,i,n){function o(t,i){var n=function(){};n.prototype=new t;n.prototype.constructor=n;n.prototype.parent=t.prototype;n.prototype=e.extend(n.prototype,i);return n}var r=o(i,{initializeEvents:function(){var t=this,e;this.select=this.$el.find("select");this.select.on("change",function(e){t.onChange.call(this,t)})},render:function(){},update:function(e){var i=this.select.val(),o=this.select;this.select.children("option").each(function(i,o){if(o.value===""){return}var r=n.filterOptionText(o.value);o.innerText=r+(e[o.value]?"":t.stl("javascript.commerce.site.view.renderers.DropdownRenderer_1"))})}});return r}.apply(e,n),o!==undefined&&(t.exports=o))},220:function(t,e,i){var n,o;!(n=[i(2),i(1),i(55)],o=function(t,e,i){function n(t,i){var n=function(){};n.prototype=new t;n.prototype.constructor=n;n.prototype.parent=t.prototype;n.prototype=e.extend(n.prototype,i);return n}var o=n(i,{initializeEvents:function(){var t=this,e;this.radios=this.$el.find("input[type=radio]");this.radios.on("change",function(i){e={};e[this.name]=this.value;t.onChange.call(t,e)})},render:function(){},update:function(i){var n=this.radios.val(),o=this.radios;this.radios.each(function(n,o){if(o.value!==""){var r=e(o);var a=r.closest("label");a=a.length===0?r.siblings("label"):a;a.toggleClass("wsite-com-product-option-label-unavailable",!i[o.value]).find(".wsite-com-product-option-radio-availability").text(i[o.value]?"":t.stl("javascript.commerce.site.view.renderers.RadioRenderer_1"))}})}});return o}.apply(e,n),o!==undefined&&(t.exports=o))},221:function(t,e,i){var n,o;!(n=[i(1),i(55),i(22)],o=function(t,e,i){function n(e,i){var n=function(){};n.prototype=new e;n.prototype.constructor=n;n.prototype.parent=e.prototype;n.prototype=t.extend(n.prototype,i);return n}var o=n(e,{initializeEvents:function(){var t=this;t.input=t.$el.find(".text-option-input");t.input.val("");t.errorMessageDiv=t.$el.find(".product-option-error-message");t.input.on("keyup change blur",function(e){t.onChange.call(this,t);if(!t.validate){t.validate=t.validateTextOption}})},update:function(t){var e=this.input.val();e=e.replace(/\r?\n/g,"\r\n");if(this.validate){this.errorMessageDiv.text(this.validate(t[e]["options"],e))}},validateTextOption:function(t,e){if(e===undefined||e===null){}else if(t.required&&e.length===0){return"Text input is required"}else if(t.max_length&&e.length>t.max_length){return"Maximum number of characters is "+t.max_length}return""}});return o}.apply(e,n),o!==undefined&&(t.exports=o))},298:function(t,e,i){var n,o;!(n=[i(2),i(1),i(5),i(3),i(6),i(60),i(584),i(123),i(122),i(307)],o=function(t,e,i,n,o,r,a,s,c){var u=i.View.extend({id:"wsite-mini-cart",className:"wsite-cart-contents",initialize:function(){e("body").append(this.$el);if(t.Commerce.RPC.Checkout){t.Commerce.RPC.Checkout.getMiniCart().done(this.populate.bind(this))}else if(t.Commerce.RPC.Order){t.Commerce.RPC.Order.getMiniCart().done(this.populate.bind(this))}this.$el.hide();this.bindCartNav();var i=this;e(window).on("resize",function(){i.positionCart()})},populate:function(e){var i;if(!e.success){return}this.cart_template=this.cart_template||e.data.cart_template;this.item_template=this.item_template||e.data.cart_item_template;this.currency=this.currency||e.data.currency;if(e.data.checkout_url){this.checkout_url=e.data.checkout_url}this.item_empty_template=this.item_empty_template||e.data.cart_item_empty_template;this.order=e.data.order;if(this.OrderItems){i=n.reduce(e.data.order.items,function(t,e){return t+e.quantity},0);this.OrderItems.off();t.events.trigger("minicart:add",i);t.events.trigger("minicart:change",i)}this.OrderItems=new r;this.OrderItems.on("reset",this.render,this);this.OrderItems.on("change",function(){this.render();this.showCart();i=window.getCartCount();t.events.trigger("minicart:remove",i);t.events.trigger("minicart:change",i)},this);var o=this;window.getCartCount=function(){var t=0;for(var e=0;e<o.OrderItems.length;e++){t+=o.OrderItems.at(e).get("quantity")}return t};if(window.refreshPublishedFlyoutMenus!==undefined){window.refreshPublishedFlyoutMenus()}this.OrderItems.reset(e.data.order.items);this.positionCart()},hideCart:function(){var t=e("#wsite-nav-cart-a").parents(".wsite-nav-cart");this.$el.fadeOut(200);t.attr("id","");this.cartPinned=false},showCart:function(t){var i=this;this.cartPinned=this.cartPinned||t;var n=e("#wsite-nav-cart-a").parents(".wsite-nav-cart");this.$el.fadeIn(200);this.setEllipsis();n.attr("id","active");i.positionCart();if(this.cartPinned){var o=function(t){var n=e(t.target);if(n.parents("#wsite-mini-cart").length===0&&!n.is(".wsite-remove-button")){i.hideCart()}else{e(document).one("click",o)}};var r=function(t){if(t.keyCode===27){i.hideCart()}else{e(document).one("keydown",r)}};e(document).one("keydown",r);e(document).one("click",o)}},scrollToCart:function(){var t=e(".wsite-nav-cart");if(e(window).scrollTop()>t.offset().top){e("html, body").animate({scrollTop:t.offset().top-25},"slow")}else if(e(window).scrollTop()+e(window).height()<t.offset().top+t.height()){e("html, body").animate({scrollTop:t.offset().top+this.$el.height()+25},"slow")}},positionCart:function(){var i=e("#wsite-nav-cart-a").parents(".wsite-nav-cart");if(!i.length){return}var n=i.offset();var o=this.$el.offsetParent();if(typeof window.safeCumulativeOffset!=="undefined"){var r=window.safeCumulativeOffset(o);n.left-=r.left;n.top-=r.top;n.top+=o.scrollTop();n.left+=o.scrollLeft()}if(t.Menus&&t.Menus.inVerticalList(i,true,"active")){this.$el.addClass("arrow-left");var a=n.top+i.outerHeight()/2-this.$el.outerHeight()*.2;var s=n.left+i.outerWidth()+8;a=Math.max(a,0);s=Math.max(s,9)}else{this.$el.addClass("arrow-top");a=n.top+i.outerHeight()+8;if(i.offset().left+i.outerWidth()/2<this.$el.outerWidth()*.8){this.$el.addClass("arrow-top-left");s=n.left+i.outerWidth()/2-this.$el.outerWidth()*.2}else{this.$el.removeClass("arrow-top-left");s=n.left+i.outerWidth()/2-this.$el.outerWidth()*.8}a=Math.max(a,9);s=Math.max(s,0)}this.$el.css({position:"absolute",left:s+"px",top:a+"px"})},focusOnCheckoutButton:function(){e("#wsite-com-minicart-checkout-button").focus()},setEllipsis:function(){var t=this.$el;var e=t.find(".wsite-product-description");var i=t.find(".wsite-product-option");i.hide();var n=e.width();e.width(n);i.show()},bindCartNav:function(){var t=this;var i=window.getCartNavElement();if(!i){window.reportCartNavElement=function(e){t.bindCartNav()};return}e(i).on("click",function(){if(t.cartPinned){t.hideCart()}else{t.showCart(true)}return false});var n=function(e){if(e.type==="mouseleave"&&!t.cartPinned){window.clearTimeout(t.fadeTimeout);t.fadeTimeout=window.setTimeout(function(){t.hideCart()},200)}else{window.clearTimeout(t.fadeTimeout);t.showCart()}return false};t.positionCart();e(i).on("hover",n);this.$el.on("hover",n)},render:function(){e("#wsite-nav-cart-num").text(window.getCartCount());this.$el.empty();var t=new a({collection:this.OrderItems,template:this.item_template,emptyTemplate:this.item_empty_template,currency:this.currency});this.$el.html(t.el);var i=this.checkout_url;var n={price_number:s.formatCurrency(this.OrderItems.subtotal(),c.customerLocale,this.currency),checkout_url:i};var r=o.render(this.cart_template,n);this.$el.append(r)}});var l={};e(function(){if(window.inEditor&&window.inEditor()||window.inPreview){return}i.$=e;l.cart=new u});return l}.apply(e,n),o!==undefined&&(t.exports=o))},576:function(t,e,i){var n,o;!(n=[i(2),i(1),i(3)],o=function(t,e,i){if(!t.Commerce.Site.Category)t.Commerce.Site.Category={};if(!t.Commerce.Site.Category.View)t.Commerce.Site.Category.View={};var n=t.Commerce.Site.Category,o=n.View;n.initialize=function(){o.ProductList.initialize();var t=false;if(e("body.wsite-mobile").length>0){e(document).resize(function(){if(t){o.ProductList.clearHeights();o.ProductList.setHeights()}t=true})}};o.ProductList={Pager:{page:0,onChange:function(i,r,a){var s=e("#wsite-com-category-product-group-pagelimit").val();a=a===undefined?this.page:a,i.stopPropagation();i.preventDefault();t.Commerce.RPC.Category.generateProductList(r,a,s).done(function(i){e("#wsite-com-category-product-group").replaceWith(i.content);e("#wsite-com-category-product-group-pagelist").html(i.pagelist);o.ProductList.total=i.total;o.ProductList.offset=a*s;o.ProductList.setHeights();e("body").scrollTop(0);e("html").scrollTop(0);if(t.Commerce&&t.Commerce.Editor){if(typeof n.onPageChange==="function"){n.onPageChange(a)}}})}},initialize:function(){o.ProductList.offset=0;this.setHeights();var t=e("#wsite-com-category-id").val();e("#wsite-com-category-product-group-pagelist").off("click.pagechange").on("click.pagechange","a",function(e){var i=e.target,n=i.getAttribute("data-page");o.ProductList.Pager.onChange(e,t,n)})},setHeights:function(){var t=e(".wsite-com-category-product-featured,.wsite-com-category-product"),i=e(".wsite-com-category-subcategory-featured,.wsite-com-category-subcategory"),n="#wsite-com-category-product-group",o=".wsite-com-category-subcategory-group",r,a,s=[t,i],c=[n,o];for(var u=0;u<s.length;u++){var l=s[u];var d=c[u];r=[];a=-1;if(l.length){var p=Math.round(e(d).width()/l.width());if(p>1){for(var h=0;h<l.length;h++){if(h%p==0)a++;r[a]=Math.max(l.eq(h).height(),r[a]||0)}for(var f=0;f<r.length;f++){l.slice(p*f,p*(f+1)).each(function(){e(this).height(r[f])})}}}}},clearHeights:function(){e(".wsite-com-category-product-featured,.wsite-com-category-product").each(function(){e(this).css("height","")})}};e(document).ready(n.initialize);return n}.apply(e,n),o!==undefined&&(t.exports=o))},577:function(t,e,i){var n,o;!(n=[i(2),i(1),i(3),i(211),i(593),i(594),i(298)],o=function(t,e,i,n,o,r,a){var s=function(){};s.prototype=Object.create(n);s.prototype=i.extend(s.prototype,{el:"#wsite-com-product-gen",selectors:{variationData:"#wsite-com-product-view-variation-data",modifiersData:"#wsite-com-product-view-modifiers-data",productElementContainer:".wsite-product, .product",productPageContainer:"#wsite-com-product-info",siteProductIdElement:"#wsite-com-product-gen",productTitle:"#wsite-com-product-title",modifiersSelector:".wsite-com-product-modifier",purchaseSourceSelector:"#wsite-com-purchase-source"},options:{salePriceClass:"wsite-com-product-show-price-on-sale",priceRangeClass:"wsite-com-product-show-price-range",unavailablePriceClass:"wsite-com-product-show-price-unavailable",nonSalePriceClass:""},initialize:function(){var t=this;n.initialize.apply(this,arguments);var e=this.$el.length;if(e){o.initialize(this.$el);r.initialize(this.$el);this.$el.find("#wsite-com-product-add-to-cart").on({click:this.buy.bind(this),keypress:function(e){if(e.which===32||e.which===13){t.buy(e)}}})}},ui:{"images-strip":"#wsite-com-product-images-strip",sku:"#wsite-com-product-sku","sku-value":"#wsite-com-product-sku-value",options:"#wsite-com-product-options","option-groups":"#wsite-com-product-options .wsite-com-product-option","price-area":"#wsite-com-product-price-area",price:"#wsite-com-product-price","price-sale":"#wsite-com-product-price-sale","price-unavailable":"#wsite-com-product-price-unavailable","price-amount":"#wsite-com-product-price .wsite-com-product-price-amount","price-sale-amount":"#wsite-com-product-price-sale .wsite-com-product-price-amount","price-range-amount":"#wsite-com-product-price-range .wsite-com-product-price-amount","inventory-legacy-message":"#wsite-com-product-inventory-message","inventory-out-of-stock-message":"#wsite-com-product-inventory-out-of-stock-message","inventory-low-stock-message":"#wsite-com-product-inventory-low-stock-message",quantity:"#wsite-com-product-quantity-input","add-to-cart":"#wsite-com-product-add-to-cart","fulfillment-options-container":"#wsite-com-product-fulfillment-options-container","fulfillment-options":"#wsite-com-product-fulfillment-options","fulfillment-options-tooltip":"#wsite-com-product-fulfillment-options__tooltip","fulfillment-options-tooltip-text":"#wsite-com-product-fulfillment-options__tooltip_text","on-sale":"#wsite-com-product-on-sale"},updateImage:function(t){var e=t.image_order?this.ui["images-strip"].find("#wsite-com-product-images-secondary-"+t.image_order[0]):this.ui["images-strip"].children(":first-child");e.trigger("click")},update:function(){var e=n.update.apply(this,arguments);var o="";var r="";var a="";if(e===null||e.pickup_location===null){this.ui["fulfillment-options-container"].hide()}if(e){if(e.inventory===0){if(this.ui["inventory-out-of-stock-message"].length===0){o=t.stl("javascript.commerce.site.view.ProductPageView_1")}r=t.stl("ecommerce.common.out_of_stock")}else if(e.inventory<=5){if(this.ui["inventory-low-stock-message"].length===0){o=t.stl("javascript.commerce.site.view.ProductPageView_2",e.inventory)}a=t.stl("ecommerce.common.low_stock_with_count",e.inventory)}if(e.pickup_location!==null&&e.product_type==="physical"){this.ui["fulfillment-options-tooltip-text"].html(t.stl("ecommerce.common.pickup_address_header")+"<br />"+e.pickup_location);this.ui["fulfillment-options-container"].show();if(!e.fulfillment_options.includes("pickup")){this.ui["fulfillment-options-tooltip"].hide()}else{this.ui["fulfillment-options-tooltip"].show()}}if(e.product_type!=="physical"){this.ui["fulfillment-options-container"].hide()}this.ui["inventory-legacy-message"].text(o);this.ui["inventory-out-of-stock-message"].text(r);this.ui["inventory-low-stock-message"].text(a);this.ui["fulfillment-options"].text(e.fulfillment_message);var s=this.ui["quantity"].val();var c=s>e.inventory||e.inventory===0?e.inventory:parseInt(s)||1;this.ui["quantity"].toggleClass("wsite-com-product-disabled",e.inventory===0).attr("max",e.inventory).attr("disabled",e.inventory===0).val(c);if(e.inventory===undefined){this.ui["quantity"].removeAttr("max")}this.ui["on-sale"].toggleClass("wsite-com-product-on-sale-visible",!i.isNull(e.sale_price));this.ui["sku"].toggleClass("wsite-com-product-sku-none",!e.sku);this.ui["sku-value"].text(e.sku)}else{this.ui["sku"].toggleClass("wsite-com-product-sku-none",true);this.ui["sku-value"].empty();this.ui["add-to-cart"].toggleClass("wsite-com-product-disabled",true);this.ui["quantity"].toggleClass("wsite-com-product-disabled",true).attr("max",0).attr("disabled",true).val(0);var u=i.pluck(this.variationData,"inventory");var l=i.reduce(u,function(t,e){return t+e},0);var d=i.min(u);if(l===0){if(this.ui["inventory-out-of-stock-message"].length===0){o=t.stl("javascript.commerce.site.view.ProductPageView_1")}r=t.stl("ecommerce.common.out_of_stock")}else if(d<=5){a=t.stl("ecommerce.common.low_stock")}this.ui["inventory-legacy-message"].text(o);this.ui["inventory-out-of-stock-message"].text(r);this.ui["inventory-low-stock-message"].text(a);var p=i.pluck(this.variationData,"price");var h=i.max(p);var f=i.min(p);var m=i.pluck(this.variationData,"sale_price");this.ui["on-sale"].toggleClass("wsite-com-product-on-sale-visible",Boolean(m.length));if(i.compact(m).length){var v=h==f&&h>i.max(m);if(v){this.ui["price-area"].removeClass().addClass("wsite-com-product-show-price-range-on-sale")}}}},placeOptionPopover:function(t,i){i=e(i);t=e(t);t.appendTo(this.options.container);if(i.offset().left>=t.width()){return"left"}return"bottom"},buy:function(){n.buy.apply(this,arguments).done(function(e,i,n){if(!e.success){return}if(t.Commerce.hasCart){a.cart.populate(e.data.mini_cart);a.cart.showCart(true);a.cart.scrollToCart();a.cart.focusOnCheckoutButton()}else{window.location.href=n.data.checkout_url}})}});e(document).ready(function(){if(window.inEditor&&window.inEditor()||window.inPreview){return}(new s).initialize()});return s}.apply(e,n),o!==undefined&&(t.exports=o))},582:function(t,e,i){var n,o;!(n=[i(2),i(1),i(3),i(5),i(6),i(89),i(20),i(22),i(123),i(122),i(596)],o=function(t,e,i,n,o,r,a,s,c,u,l){var d=n.View.extend({tagName:"li",className:"wsite-product-item",events:{"click .wsite-remove-button":"handleDeleteButton"},initialize:function(t){this.options=t;this.render();this.model.on("change",this.handleModelChange,this);this.model.on("remove",this.handleModelRemove,this)},render:function(){var e=this.options.template;var n=this.model.get("discounted_price");n=Number(n).toFixed(2);var a=this.model.get("name");var d=this.model.get("product_type");var p=this.model.get("options");var h=i.map(this.model.get("modifier_selections"),function(t){return{name:t.name,value:t.choice_name_formatted}}.bind(this));var f=i.map(p,function(t,e){var i=s.filterOptionText(t);return{name:e,value:i}});f=f.concat(h);if(d==="giftcard"){f=[{name:t.stl("ecommerce.checkout.gift_card.for_email"),value:f[l.RECIPIENT_EMAIL].value}]}var m={thumbnail_html:r("wsite-list",this.model.get("image_info"),80,1),url:this.model.get("product_url"),title_html:a,options:f,price_number:c.formatCurrency(n,u.customerLocale,this.options.currency),quantity:this.model.get("quantity")};this.template=o.render(e,m);this.$el.html(this.template);return this},handleModelRemove:function(){this.$el.fadeOut(200,function(){e(this).remove()})},handleModelChange:function(){var t=this.model.changedAttributes();if(t&&t.quantity===0){this.model.destroy()}},handleDeleteButton:function(t){this.model.save({quantity:0,total_price:0});var i=e(t.currentTarget);this.updateQuantity(i,0)},updateQuantity:function(i,n){var o=e.isNumeric(n)?n:parseInt(i.val());var r=this.model.get("quantity");var s=this;e("#wsite-com-checkout-cart .wsite-checkout-server-error").remove();if(o===""||isNaN(o)){i.val(this.model.get("quantity"));return}t.Commerce.RPC.OrderItem.updateQuantity({site_order_id:this.model.get("site_order_id"),site_order_item_id:this.model.get("site_order_item_id"),quantity:o}).done(function(t){var e=t.data.quantity;if(t.success){s.model.save({quantity:e,total_price:s.model.get("discounted_price")*e});var n=e-r;var o={site_product_id:s.model.get("site_product_id"),site_product_sku_id:s.model.get("site_product_sku_id"),name:s.model.get("name"),optionshash:s.model.get("options"),price:s.model.get("current_price")};var c={site_order_id:s.model.get("site_order_id")};if(n<=0){o.quantity=n*-1;a.trackRemoveFromCart("mini_cart",o,c)}else{o.quantity=n;a.trackAddToCart("mini_cart",o,c)}}else{i.val(e).focus();s.trigger("error",t.message)}})}});return d}.apply(e,n),o!==undefined&&(t.exports=o))},583:function(t,e,i){var n,o;!(n=[i(5),i(6)],o=function(t,e){var i=t.View.extend({tagName:"li",initialize:function(t){var e=this;e.options=t;e.render()},render:function(){var t=this,i=t.options.template,n={};t.template=e.render(i,n);t.$el.html(t.template);return t}});return i}.apply(e,n),o!==undefined&&(t.exports=o))},584:function(t,e,i){var n,o;!(n=[i(5),i(582),i(583)],o=function(t,e,i){var n=t.View.extend({tagName:"ul",className:"wsite-product-list",initialize:function(t){this.options=t;this.render();this.collection.on("change",this.handleCollectionChange,this)},render:function(){var t=this,n=t.options,o;if(this.collection.length){this.collection.each(function(i){o=new e({template:n.template,model:i,id:"item-"+i.get("site_product_id")+"-"+i.get("site_product_sku_id"),currency:n.currency});t.$el.append(o.el)})}else{o=new i({template:n.emptyTemplate});t.$el.html(o.el)}return t},handleCollectionChange:function(){if(this.collection.length===0){this.render()}}});return n}.apply(e,n),o!==undefined&&(t.exports=o))},593:function(t,e,i){var n,o;!(n=[i(2),i(1)],o=function(t,e){var i={initialize:function(t){var i=t.find(".cloud-zoom, .cloud-zoom-gallery");i.CloudZoom&&i.CloudZoom();e(document).off("keydown",this.navigateProductImages).on("keydown",this.navigateProductImages)},navigateProductImages:function(i){var n=["input","textarea"];if(e.inArray(i.target.nodeName.toLowerCase(),n)!==0&&e("#wsite-com-product-images-strip").children("a.wsite-com-product-images-secondary").length){if(!t.Commerce.Editor||e("#wsite-com-product-area").length&&i.target.contentEditable!="true"){var o=e("#wsite-com-product-images-strip").children("a.wsite-com-product-images-secondary"),r=e("#zoom1")[0],a=o.filter(function(){return this.href==r.href});if(i.keyCode==37&&!a.prev().click().length){o.last().click()}else if(i.keyCode==39&&!a.next().click().length){o.first().click()}}}}};return i}.apply(e,n),o!==undefined&&(t.exports=o))},594:function(t,e,i){var n,o;!(n=[i(2),i(1)],o=function(t,e){var i={networks:{twitter:{height:440,width:585},pinterest:{height:340,width:765},facebook:{height:315,width:485},plus:{height:600,width:600}},initialize:function(e){if(window.inEditor&&window.inEditor())return;var n;e.find("#wsite-com-product-social-sharing").on("click","a",function(e){n=i.networks[e.currentTarget.getAttribute("data-network")];n=n?n:{height:500,width:500};window.open(e.currentTarget.href,t.utl("Share"),"height="+n.height+", width="+n.width+" scrollbars=no, resizeable=no");e.preventDefault()})}};return i}.apply(e,n),o!==undefined&&(t.exports=o))},596:function(t,e,i){var n;!(n=function(){return{AMOUNT:0,SENDER_NAME:1,RECIPIENT_NAME:2,RECIPIENT_EMAIL:3,GIFT_MESSAGE:4}}.call(e,i,e,t),n!==undefined&&(t.exports=n))},611:function(t,e,i){var n,o;!(n=[i(101),i(84),i(61),i(60),i(577),i(576),i(298)],o=function(){}.apply(e,n),o!==undefined&&(t.exports=o))}});
Note: See TracBrowser for help on using the repository browser.