$(document).on("ready",function(){function getParameterByName(name,url){url||(url=window.location.href),name=name.replace(/[\[\]]/g,"\\$&");var regex=new RegExp("[?&]"+name+"(=([^&#]*)|&|#|$)"),results=regex.exec(url);return results?results[2]?decodeURIComponent(results[2].replace(/\+/g," ")):"":null}$(".js-gift-builder-go-to-step-1").on("click touchstart",function(){$(".js-gift-builder-step-2, .js-gift-builder-step-3").removeClass("active").addClass("hide"),$(".js-gift-builder-step-1").removeClass("hide").addClass("active"),$(".js-gift-builder-step-2-no-hide, .js-gift-builder-step-3-no-hide").removeClass("active"),$(".js-gift-builder-step-1-no-hide").addClass("active"),$(window).width()<750&&(document.body.scrollTop=document.documentElement.scrollTop=0)}),$(".js-gift-builder-go-to-step-2").on("click touchstart",function(){Cookies.get("gift-kit-temp-id")==="0"&&($(".js-gift-builder-step-1, .js-gift-builder-step-3").removeClass("active").addClass("hide"),$(".js-gift-builder-step-2").removeClass("hide").addClass("active"),$(".js-gift-builder-step-1-no-hide, .js-gift-builder-step-3-no-hide").removeClass("active"),$(".js-gift-builder-step-2-no-hide").addClass("active")),$(window).width()<750&&(document.body.scrollTop=document.documentElement.scrollTop=0)}),$(".js-gift-builder-go-to-step-3").on("click touchstart",function(){var variant_id_1=$("input.js-gift-kit-variant-id-1").val(),variant_id_2=$("input.js-gift-kit-variant-id-2").val(),variant_id_3=$("input.js-gift-kit-variant-id-3").val(),variants_filled_out=!1;if($(".klaviyo-kit-info.selected .kit-product-count").html()=="3"?variant_id_1.length>1&&variant_id_2.length>1&&variant_id_3.length>1&&(variants_filled_out=!0):$(".klaviyo-kit-info.selected .kit-product-count").html()=="2"?variant_id_1.length>1&&variant_id_2.length>1&&(variants_filled_out=!0):$(".klaviyo-kit-info.selected .kit-product-count").html()=="1"&&variant_id_1.length>1&&(variants_filled_out=!0),Cookies.get("gift-kit-temp-id")==="0"&&variants_filled_out)$(".js-gift-builder-step-1, .js-gift-builder-step-2").removeClass("active").addClass("hide"),$(".js-gift-builder-step-3").removeClass("hide").addClass("active"),$(".js-gift-builder-step-1-no-hide, .js-gift-builder-step-2-no-hide").removeClass("active"),$(".js-gift-builder-step-3-no-hide").addClass("active"),setTimeout(function(){$(".js-gift-builder-checkout").addClass("enabled")},1e3);else{var scrolled=!1;$.each($(".kit-items-container.selected .single-option-selector"),function(index){var $this=$(this);$this.children("option:selected").val().includes("Select A")&&($this.parents(".selector-container").css("border","1px solid red"),scrolled||(scrolled=!0,$("html, body").animate({scrollTop:$this.offset().top-30},400)),setTimeout(function(){$this.parents(".selector-container").css("border","none")},3e3))})}$(window).width()<750&&(document.body.scrollTop=document.documentElement.scrollTop=0)}),$(".gift-builder-page-step-one .js-gift-kit-view-more").on("click",function(){var $this=$(this);$this.parents(".gift-builder-page").find(".kit-container").addClass("medium-up--hide"),$this.data("next-page-id")=="2"?($this.data("next-page-id","3"),$this.html('

View

More

'),$this.parents(".gift-builder-page").find('.kit-container[data-page-id="2"]').removeClass("medium-up--hide")):$this.data("next-page-id")=="3"?($this.data("next-page-id","1"),$this.html('

Go

Back

'),$this.parents(".gift-builder-page").find('.kit-container[data-page-id="3"]').removeClass("medium-up--hide")):$this.data("next-page-id")=="1"&&($this.data("next-page-id","2"),$this.html('

View

More

'),$this.parents(".gift-builder-page").find('.kit-container[data-page-id="1"]').removeClass("medium-up--hide"))}),$(".gift-builder-page-step-three .gift-kit-product-images-scroll-left").on("click",function(){var $this=$(this),items_container=$this.parents(".kit-items-container");items_container.find(".item-confirmation-container").addClass("hide"),$this.data("current-product")=="0"?$this.data("products-count")=="3"?($this.siblings(".gift-kit-product-images-scroll-right").data("current-product","2"),$this.data("current-product","2"),items_container.find('.item-confirmation-container[data-product-count="2"]').removeClass("hide")):$this.data("products-count")=="2"&&($this.siblings(".gift-kit-product-images-scroll-right").data("current-product","1"),$this.data("current-product","1"),items_container.find('.item-confirmation-container[data-product-count="1"]').removeClass("hide")):$this.data("current-product")=="1"?($this.siblings(".gift-kit-product-images-scroll-right").data("current-product","0"),$this.data("current-product","0"),items_container.find('.item-confirmation-container[data-product-count="0"]').removeClass("hide")):$this.data("current-product")=="2"&&($this.siblings(".gift-kit-product-images-scroll-right").data("current-product","1"),$this.data("current-product","1"),items_container.find('.item-confirmation-container[data-product-count="1"]').removeClass("hide"))}),$(".gift-builder-page-step-three .gift-kit-product-images-scroll-right").on("click",function(){var $this=$(this),items_container=$this.parents(".kit-items-container");items_container.find(".item-confirmation-container").addClass("hide"),$this.data("current-product")=="0"?($this.siblings(".gift-kit-product-images-scroll-left").data("current-product","1"),$this.data("current-product","1"),items_container.find('.item-confirmation-container[data-product-count="1"]').removeClass("hide")):$this.data("current-product")=="1"?$this.data("products-count")=="3"?($this.siblings(".gift-kit-product-images-scroll-right").data("current-product","2"),$this.data("current-product","2"),items_container.find('.item-confirmation-container[data-product-count="2"]').removeClass("hide")):$this.data("products-count")=="2"&&($this.siblings(".gift-kit-product-images-scroll-right").data("current-product","0"),$this.data("current-product","0"),items_container.find('.item-confirmation-container[data-product-count="0"]').removeClass("hide")):$this.data("current-product")=="2"&&($this.siblings(".gift-kit-product-images-scroll-left").data("current-product","0"),$this.data("current-product","0"),items_container.find('.item-confirmation-container[data-product-count="0"]').removeClass("hide"))}),$(".js-desktop-gift-kit-start-building").on("click",function(){var $this=$(this);Cookies.set("gift-kit-temp-id","0",{expires:30}),$(".kit-container").removeClass("selected"),$(this).addClass("selected"),$(".js-gift-kit-variant-id").val(""),$(".kit-items-container").addClass("hide").removeClass("selected"),$(".kit-items-container[data-kit-identifier="+$(this).data("kit-identifier")+"]").removeClass("hide").addClass("selected"),$this.data("kit-identifier")==="get-it-together-kit"&&$("input.js-gift-kit-variant-id-1").val("13835413127277"),$(".klaviyo-kit-info").removeClass("selected"),$(".klaviyo-kit-info[data-kit-identifier="+$(this).data("kit-identifier")+"]").addClass("selected"),$('.js-gift-kit-variant-id[data-index="'+$(".klaviyo-kit-info.selected .kit-product-count-from-zero").html()+'"]').val($(".klaviyo-kit-info.selected .kit-third-party-id").val()),$(".js-gift-builder-step-1, .js-gift-builder-step-3").removeClass("active").addClass("hide"),$(".js-gift-builder-step-2").removeClass("hide").addClass("active"),$(".js-gift-builder-step-1-no-hide, .js-gift-builder-step-3-no-hide").removeClass("active"),$(".js-gift-builder-step-2-no-hide").addClass("active"),$(window).width()<750&&(document.body.scrollTop=document.documentElement.scrollTop=0)}),$(".js-gift-builder-checkout").on("click",function(){var $this=$(this),current_button_text=$this.html();$this.html("Submitting..."),$this.attr("disabled",!0),Cookies.set("gift-kit-id","0",{expires:30}),Cookies.set("gift-message-to",$("input.gift-message-to").val(),{expires:30}),Cookies.set("gift-message-from",$("input.gift-message-from").val(),{expires:30}),Cookies.set("gift-message-content",$("textarea.gift-message-content").val(),{expires:30}),_learnq.push(["identify",{$email:$(".gift-kit-email-input").val(),gift_kit_name:$(".klaviyo-kit-info.selected .kit-name").html(),gift_kit_image:$(".klaviyo-kit-info.selected .kit-image").html()}]);var variant_id_1=$("input.js-gift-kit-variant-id-1").val(),variant_id_2=$("input.js-gift-kit-variant-id-2").val(),variant_id_3=$("input.js-gift-kit-variant-id-3").val(),variants_filled_out=!1,gift_message_filled_out=!1;if($(".klaviyo-kit-info.selected .kit-product-count").html()=="3"?variant_id_1.length>1&&variant_id_2.length>1&&variant_id_3.length>1&&(variants_filled_out=!0):$(".klaviyo-kit-info.selected .kit-product-count").html()=="2"?variant_id_1.length>1&&variant_id_2.length>1&&(variants_filled_out=!0):$(".klaviyo-kit-info.selected .kit-product-count").html()=="1"&&variant_id_1.length>1&&(variants_filled_out=!0),$("input.gift-message-to").val().length>0&&$("input.gift-message-from").val().length>0&&$("textarea.gift-message-content").val().length>0?gift_message_filled_out=!0:($this.html(current_button_text),!$("textarea.gift-message-content").val().length>0&&($("textarea.gift-message-content").css("border","1px solid red"),$("html, body").animate({scrollTop:$this.offset().top-30},400),setTimeout(function(){$("textarea.gift-message-content").css("border","none"),$("textarea.gift-message-content").css("border-bottom","1px solid black")},3e3)),!$("input.gift-message-from").val().length>0&&($("input.gift-message-from").css("border","1px solid red"),$("html, body").animate({scrollTop:$this.offset().top-30},400),setTimeout(function(){$("input.gift-message-from").css("border","none"),$("input.gift-message-from").css("border-bottom","1px solid black")},3e3)),!$("input.gift-message-to").val().length>0&&($("input.gift-message-to").css("border","1px solid red"),$("html, body").animate({scrollTop:$this.offset().top-30},400),setTimeout(function(){$("input.gift-message-to").css("border","none"),$("input.gift-message-to").css("border-bottom","1px solid black")},3e3))),variants_filled_out&&gift_message_filled_out){var gift_kit_count=1;CartJS.setAttributes({gift_kit_count:gift_kit_count,gift_to:$("input.gift-message-to").val(),gift_from:$("input.gift-message-from").val(),gift_message:$("textarea.gift-message-content").val()}),CartJS.addItem(variant_id_1,1,{gift_wrap:"Please Add To Gift Kit #"+gift_kit_count,gift_to:$("input.gift-message-to").val(),gift_from:$("input.gift-message-from").val(),gift_message:$("textarea.gift-message-content").val(),gift_kit_name:$(".klaviyo-kit-info.selected .kit-name").html(),gift_kit_price:$(".klaviyo-kit-info.selected .kit-price").html()},{success:function(data_1,textStatus,jqXHR){$(".klaviyo-kit-info.selected .kit-product-count").html()=="1"?window.location="https://summersalt.com/collections/travelwear?show_cart=true":CartJS.addItem(variant_id_2,1,{gift_wrap:"Please Add To Gift Kit #"+gift_kit_count},{success:function(data_2,textStatus2,jqXHR2){$(".klaviyo-kit-info.selected .kit-product-count").html()=="2"?window.location="https://summersalt.com/collections/travelwear?show_cart=true":CartJS.addItem(variant_id_3,1,{gift_wrap:"Please Add To Gift Kit #"+gift_kit_count},{success:function(data_3,textStatus3,jqXHR3){window.location="https://summersalt.com/collections/travelwear?show_cart=true"},error:function(jqXHR3,textStatus3,errorThrown){CartJS.clear(),$this.attr("disabled",!1),$this.html("Error")}})},error:function(jqXHR2,textStatus2,errorThrown){CartJS.clear(),$this.attr("disabled",!1),$this.html("Error")}})},error:function(jqXHR,textStatus,errorThrown){CartJS.clear(),$this.attr("disabled",!1),$this.html("Error")}})}else $this.attr("disabled",!1)}),$(".js-gift-kit-item-option").on("change",function(){var $this=$(this),product_id=$this.data("product-id"),option_index=$this.data("index");$('.js-gift-kit-item-confirmation[data-product-id="'+product_id+'"][data-option="'+option_index+'"]').html($this.val()),$this.parents(".selector-container").find(".error-container").addClass("hide");var color=$this.parents(".selector-container").find('select[data-option="color"]').val(),size=$this.parents(".selector-container").find('select[data-option="size"]').val(),variant_select=$this.parents(".selector-container").find(".js-gift-kit-all-variants"),variant_option=variant_select.find('option[data-color="'+color+'"][data-size="'+size+'"]');if(variant_option.length===0&&(variant_option=variant_select.find('option[data-color="'+color+'"]:first')),variant_option.length>0&&!variant_option.is(":disabled")){variant_select.val(variant_option.val());var variant_forloop_index=variant_select.data("forloop-index");$('input.js-gift-kit-variant-id[data-index="'+variant_forloop_index+'"]').val(variant_select.val())}else variant_option.is(":disabled")&&$this.parents(".selector-container").find(".error-container").removeClass("hide")}),$(".template-page-gift_builder").length>0&&Cookies.set("gift-kit-temp-id","1",{expires:30}),Cookies.get("gift-kit-id")=="0"&&($(".gift-kit--cart__row").removeClass("hide"),$(".cart-gift-message-to").html(Cookies.get("gift-message-to")),$(".cart-gift-message-content").html(Cookies.get("gift-message-content")),$(".cart-gift-message-from").html(Cookies.get("gift-message-from")))}); //# sourceMappingURL=/cdn/shop/t/140/assets/gift_builder.js.map