{"version":3,"file":"../location-finder.js","names":["asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","done","Promise","then","_async_to_generator","fn","self","this","args","arguments","apply","err","undefined","_ts_generator","thisArg","body","f","y","t","g","_","label","sent","trys","ops","next","verb","throw","return","Symbol","iterator","n","v","op","TypeError","call","pop","length","push","e","step","locationFinder","thisel","fieldId","_locationFinder","button","search","canada_postal_code_regex","coordinates","reverse_postal_code","callfrom","matches","form","_state","$","parent","find","val","match","get_coordinates_from_search_string","get_postal_code_from_coordinates","attr","indexOf","hasClass","ajax","async","url","ajaxurl","data","action","area","honeypot","nonce","wpml_lang","method","dataType","beforeSend","text","success","response","removeClass","errors","location_window_reference","window","open","target","on","setTimeout","location","reload","end","modal","checkIfLocationFound","ajaxData","getUrlParameter","sParam","i","sURLVariables","decodeURIComponent","substring","split","sParameterName","franchise_id","type","headers","Pragma","cache","res","result","JSON","parse","code","each","siblings","addClass","hide","html","name","fetchEntireContent","jQuery","document","ready","$1","prepopulatePhoneNumber","current","show","stop","slideToggle","eq","setForm","parents","changeCountry","preventDefault","stopPropagation","disabled","cc_lf_in_progress","currId","replace","locationFound","css","$body","off","priceOffer","string","cond","toLowerCase","designerURL"],"sources":["location-finder.js"],"mappings":"AAAA,aAEA,SAASA,mBAAmBC,EAAKC,EAASC,EAAQC,EAAOC,EAAQC,EAAKC,GACpE,IACE,IAAIC,EAAOP,EAAIK,GAAKC,GAChBE,EAAQD,EAAKC,KACnB,CAAE,MAAOC,GAEP,YADAP,EAAOO,EAET,CACIF,EAAKG,KACPT,EAAQO,GAERG,QAAQV,QAAQO,GAAOI,KAAKT,EAAOC,EAEvC,CACA,SAASS,oBAAoBC,GAC3B,OAAO,WACL,IAAIC,EAAOC,KACTC,EAAOC,UACT,OAAO,IAAIP,SAAQ,SAAUV,EAASC,GACpC,IAAIF,EAAMc,EAAGK,MAAMJ,EAAME,GACzB,SAASd,EAAMK,GACbT,mBAAmBC,EAAKC,EAASC,EAAQC,EAAO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U,4BAA4B,SAAU/C,GAC9DuG,WAAWvB,OAAOhH,MAAMiD,KAAK,cAAcC,QAC7ClB,EAAE6F,gBAEN","sourcesContent":["\nasync function locationFinder(thisel, fieldId) {\n\tvar button = $(thisel).parent().parent();\n\n\tlet search = button.find('[name=\"lf\"]').val();\n\tif(search === \"\" || search === 'false') {\n\t\tsearch = button.find('#'+fieldId).val();\n\t\tbutton.find('[name=\"lf\"]').val(search);\n\t}\n\n\t//if search doesn't resemble a postal code, or a partial postal code, run a couple geocoding requests to convert the search to coordinates, and the coordinates to a postal code\n\tconst canada_postal_code_regex = /^[ABCEGHJ-NPRSTVXY]\\d[ABCEGHJ-NPRSTV-Z]([ -]?\\d[ABCEGHJ-NPRSTV-Z]\\d)?$/i;\n\n\tif ( !search.match(canada_postal_code_regex) ) {\n\t\tlet coordinates = await get_coordinates_from_search_string(search);\n\t\tif(coordinates) {\n\t\t\tlet reverse_postal_code = await get_postal_code_from_coordinates(coordinates);\n\t\t\tif(reverse_postal_code) {\n\t\t\t\tsearch = reverse_postal_code;\n\t\t\t\tbutton.find('[name=\"lf\"]').val(search); //write the search back to the form hidden field\n\t\t\t} else {\n\t\t\t}\n\t\t} else {\n\t\t}\n\t}\n\n\tif(fieldId == 'autocompletefooter') {\n\t\tvar callfrom = 'autocompletefooter';\n\t} else {\n\t\t//alert(fieldId == 'autocomplete2');\n\t\tvar callfrom = button.find('#'+fieldId).attr('id');\n\t}\n\n\n\tvar matches = search.match(/\\d+/g);\n\t//alert(matches);\n\t//console.log('111111111111111');\n\t//console.log(matches);\n\tvar countrySelected = 'ca';\n\n\tif(matches == null) {\n\n\t\tif(search.indexOf(\",\") >= 0) {\n\t\t\t// console.log('City, State valid');\n\t\t} else {\n\t\t\t// console.log('City, State invalid');\n\t\t\t//trackSearch(search + ' (' + countrySelected + ')', 'not-valid');\n\t\t\t$('.not-valid-modal').modal();\n\t\t\t//alert('Not a Valid Location!');\n\n\t\t\treturn false;\n\t\t}\n\t}\n\tvar form;\n\tif(button.hasClass('design-consultant-form')) {\n\t\tform = 'our-designers';\n\t} else {\n\t\tform = 'default';\n\t}\n\t// prevent from pinging the server if the honeypot field is not empty\n\tif(button.find('.hidden-field').val() !== \"\" || button.find('[name=\"lf\"]').val() == \"\") {\n\n\t\treturn false;\n\t}\n\n\n\t$.ajax({\n\t\tasync: false,\n\t\turl : ajaxurl,\n\t\tdata : {\n\t\t\taction : 'location-finder',\n\t\t\tsearch : button.find('[name=\"lf\"]').val(),\n\t\t\tarea : button.find('.area').val(),\n\t\t\tform : form,\n\t\t\tcallfrom: callfrom,\n\t\t\thoneypot: button.find('.hidden-field').val(),\n\t\t\t// send the nonce along with the request\n\t\t\tnonce: button.find('.nonce').val(),\n\t\t\twpml_lang: wpml_lang\n\t\t},\n\t\tmethod : \"POST\",\n\t\tdataType : \"json\",\n\t\tbeforeSend: function() {\n\t\t\t$(thisel).attr('disabled', true);\n\t\t\t$(thisel).find('.cc-loading-spinner--screen-reader').text(function (){return $(this).data('loading-label')});\n\t\t\t// console.log(\"Finder ... Before send..\");\n\t\t},\n\t\terror : function(error) {\n\t\t\tconsole.log(\"Finder ... Got Error..\");\n\t\t\tconsole.log(error);\n\t\t\t//console.log(\"postal code: \"+error.zipcode);\n\t\t\t//reset hidden field with geocoding autocomplete\n\t\t\tbutton.find('[name=\"lf\"]').val('')\n\t\t},\n\t\tsuccess : function(response) {\n\t\t\t// console.log(\"Finder ... Success.. \");\n\t\t\t$('.mobile-header .mobile-locate-me a').removeClass('active');\n\t\t\t// console.log(\"Errors: \"+response.errors);\n\n\t\t\tif ( response.errors == '' ) {\n\n\t\t\t\t// console.log('opening location page URL:', response.url, 'Target:', response.target);\n\n\t\t\t\tlet location_window_reference = window.open(response.url, response.target);\n\n\t\t\t\t//if the target is not this same page, check if the popup worked (and reload the page), or show a modal window otherwise.\n\t\t\t\tif (response.target !== '_self') {\n\t\t\t\t\tif (location_window_reference == null) {\n\t\t\t\t\t\t// console.log('window.open failed. showing modal');\n\n\t\t\t\t\t\t$('.location-found-modal')\n\t\t\t\t\t\t\t.find('.location-found-link')\n\t\t\t\t\t\t\t.attr('href', response.url)\n\t\t\t\t\t\t\t.attr('target', response.target)\n\t\t\t\t\t\t\t.on('click', function(e) {\n\t\t\t\t\t\t\t\t// Page reload required to properly show location in case user returns to primary website\n\t\t\t\t\t\t\t\twindow.setTimeout(function(){\n\t\t\t\t\t\t\t\t\t// console.log('reloading page - modal link clicked');\n\t\t\t\t\t\t\t\t\twindow.location.reload();\n\t\t\t\t\t\t\t\t},1000);\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.end()\n\t\t\t\t\t\t\t.modal()\n\t\t\t\t\t\t;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Page reload required to properly show location in case user returns to primary website\n\t\t\t\t\t\tif ( response.target === '_blank' ) {\n\t\t\t\t\t\t\twindow.setTimeout(function(){\n\t\t\t\t\t\t\t\t// console.log('reloading page - external tab opened');\n\t\t\t\t\t\t\t\twindow.location.reload();\n\t\t\t\t\t\t\t},1000);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$(thisel).attr('disabled', false);\n\t\t\t\t$(thisel).find('.cc-loading-spinner--screen-reader').text('');\n\t\t\t\t$('.not-found-modal').modal();\n\t\t\t\t// console.log('triggered not-found-modal')\n\t\t\t}\n\t\t\t//reset hidden field with geocoding autocomplete\n\t\t\tbutton.find('[name=\"lf\"]').val('')\n\t\t}\n\t});\n\n}\n\n/* check if a location is set */\nconst checkIfLocationFound = () => {\n\n\tconst ajaxData = {\n\t\taction: 'calclosets_location_found',\n\t\twpml_lang: wpml_lang\n\t}\n\n\tconst getUrlParameter = (sParam) => {\n\n\t\tconst sPageURL = decodeURIComponent(window.location.search.substring(1)),\n\t\t\tsURLVariables = sPageURL.split('&');\n\n\t\tlet\ti;\n\n\t\tfor ( i = 0; i < sURLVariables.length; i++ ) {\n\n\t\t\tconst sParameterName = sURLVariables[i].split('=');\n\n\t\t\tif ( sParameterName[0] === sParam ) {\n\t\t\t\treturn sParameterName[1] === undefined ? true : sParameterName[1];\n\t\t\t}\n\t\t}\n\t};\n\n\tif ( getUrlParameter('CC1') ) {\n\t\tajaxData.franchise_id = getUrlParameter('CC1');\n\t}\n\n\t$.ajax({\n\t\ttype : 'GET',\n\t\turl : ajaxurl,\n\t\theaders: {\n\t\t\t'Cache-control': 'max-age=86400, public',\n\t\t\t'Pragma' : 'cache'\n\t\t},\n\t\tcache : true,\n\t\tdata : ajaxData,\n\t\tsuccess: function(res) {\n\n\t\t\tconst result = JSON.parse(res);\n\n\t\t\tif ( result.code == 200 ) {\n\n\t\t\t\t$('.location-found').each(function() {\n\n\t\t\t\t\t$(this)\n\t\t\t\t\t\t.siblings()\n\t\t\t\t\t\t.addClass('inactive')\n\t\t\t\t\t\t.hide();\n\n\t\t\t\t\t$(this)\n\t\t\t\t\t\t.removeClass('hide')\n\t\t\t\t\t\t.find('.market-name')\n\t\t\t\t\t\t.attr('href', result.url)\n\t\t\t\t\t\t.attr('target', result.target)\n\t\t\t\t\t\t.html(result.name);\n\t\t\t\t});\n\t\t\t}\n\t\t\tfetchEntireContent();\n\t\t}\n\t});\n}\n\njQuery(document)\n\t.ready(function($) {\n\n\t\t//load default phone number. might be replaced by more-accurate phone number if location found. might also be\n\t\t// replaced by other numbers due to Invoca\n\t\tprepopulatePhoneNumber();\n\n\t\t//load current location. might update phone numbers\n\t\tcheckIfLocationFound();\n\n\n\t\t$('.lf-dropdown .selected')\n\t\t\t.on('click', function() {\n\t\t\t\tvar current = $(this)\n\t\t\t\t\t.attr('data-current'),\n\t\t\t\t\tparent = $(this)\n\t\t\t\t\t\t.parent();\n\n\t\t\t\t//$('.lf-select option').attr('selected', false);\n\t\t\t\tparent.find('li')\n\t\t\t\t\t.show();\n\t\t\t\tparent.find('ul')\n\t\t\t\t\t.stop()\n\t\t\t\t\t.slideToggle()\n\t\t\t\t\t.find('li')\n\t\t\t\t\t.eq(current)\n\t\t\t\t\t.hide();\n\t\t\t\tsetForm(parent.parents('form'));\n\t\t\t\tchangeCountry();\n\t\t\t});\n\n\t\t$('.lf-finder-footer').on('click', function(e) {\n\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t\tvar thisel = this;\n\t\t\t\tthis.disabled = true;\n\t\t\t\tlocationFinder(thisel, 'autocompletefooter');\n\t\t\t\tthis.disabled = false;\n\t\t\t\treturn false;\n\t\t});\n\t\t/*$( document ).on( 'click', '.lf-finder', function( e ) {*/\n\t\t$('.lf-finder').on('click', function(e) {\n\n\t\t\tif (window.cc_lf_in_progress) {\n\t\t\t\treturn; // prevent multiple invocations. it happens when using down arrow and enter to select an autocomplete option.\n\t\t\t}\n\t\t\twindow.cc_lf_in_progress = true;\n\t\t\tsetTimeout(function() {window.cc_lf_in_progress = false;}, 1000);\n\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t\tvar thisel = this;\n\t\t\t\tthis.disabled = true;\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\tlocationFinder(thisel, 'autocomplete');\n\t\t\t\t\tthisel.disabled = false;\n\t\t\t\t}, 500);\n\t\t\t\treturn false;\n\t\t});\n\n\t\t$('[class^=\"lf-finder-\"]').on('click', function(e) {\n\t\t\t\tlet currId = $(this).attr('id');\n\t\t\t\tcurrId = currId.replace('finder-', '');\n\t\t\t\t//alert(currId);\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t\tvar thisel = this;\n\t\t\t\tthis.disabled = true;\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\tlocationFinder(thisel, 'autocomplete'+currId);\n\t\t\t\t\tthisel.disabled = false;\n\t\t\t\t}, 500);\n\t\t\t\treturn false;\n\t\t});\n\n\t\t$('body').on('click', '.lf-change', '.lf-form-mobilee', function(e) {\n\t\t\t\te.stopPropagation();\n\t\t\t\tvar locationFound;\n\t\t\t\t$('#autocomplete').val('');\n\t\t\t\tif($(this).parent().parent().hasClass('showroom-cookie')) {\n\t\t\t\t\tlocationFound = $(this).parent().parent();\n\t\t\t\t} else {\n\t\t\t\t\tlocationFound = $(this).parent();\n\t\t\t\t}\n\n\t\t\t\tlocationFound.hide();\n\n\t\t\t\t$(this).parent('div').find('.inactive').show();\n\t\t\t\tif(locationFound.hasClass('showroom-cookie')) {\n\t\t\t\t\tlocationFound.next().css('display', 'table-cell');\n\t\t\t\t} else {\n\t\t\t\t\tlocationFound.next().show();\n\t\t\t\t}\n\n\t\t\t\t$(document.body).on('click.location-finder', function() {\n\t\t\t\t\t\tvar $body = $(this);\n\t\t\t\t\t\t$('#autocomplete').val('');\n\t\t\t\t\t\tlocationFound.show();\n\t\t\t\t\t\t$('.lf-form.inactive').hide();\n\t\t\t\t\t\t$('.lf-form-mobilee.inactive').hide();\n\t\t\t\t\t\t$('.inactive.mobile-form').hide();\n\t\t\t\t\t\t$body.off('click.location-finder');\n\t\t\t\t\t});\n\t\t});\n\n\t\t$('.lf-form').on('click', function(e) {\n\t\t\te.stopPropagation();\n\t\t});\n\t\t$('.lf-form-mobilee').on('click', function(e) {\n\t\t\te.stopPropagation();\n\t\t});\n});\nvar priceOffer = function(string) {\n\tvar cond = false;\n\tif(jQuery('body')\n\t\t\t.hasClass('en')) {\n\t\tif(string.toLowerCase()\n\t\t\t\t.indexOf('cost') > -1 || string.toLowerCase()\n\t\t\t\t.indexOf('price') > -1) {\n\t\t\tcond = true;\n\t\t}\n\t} else if(jQuery('body')\n\t\t\t.hasClass('fr')) {\n\t\tif(string.toLowerCase()\n\t\t\t\t.indexOf('coût') > -1 || string.toLowerCase()\n\t\t\t\t.indexOf('prix') > -1 || string.toLowerCase()\n\t\t\t\t.indexOf('cout') > -1) {\n\t\t\tcond = true;\n\t\t}\n\t} else {\n\t\tif(string.toLowerCase()\n\t\t\t\t.indexOf('costo') > -1 || string.toLowerCase()\n\t\t\t\t.indexOf('precio') > -1) {\n\t\t\tcond = true;\n\t\t}\n\t}\n\tif(cond) {\n\t\twindow.location.replace(designerURL);\n\t}\n\treturn cond;\n};\njQuery(document)\n\t.on('submit', '.mobile-menu-search form', function(e) {\n\t\tif(priceOffer(jQuery(this)\n\t\t\t\t.find('[name=\"s\"]')\n\t\t\t\t.val())) {\n\t\t\te.preventDefault();\n\t\t}\n\t});\n"]}