{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///../codebase/storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/util.js","webpack:///../codebase/tkooples/cartridges/app_core_tkooples/cartridge/client/default/js/storeLocator.js","webpack:///../codebase/tkooples/cartridges/app_core_tkooples/cartridge/client/default/js/storeLocator/storeLocator.js"],"names":[],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFa;;AAEb;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;;;;;;;;;;;;ACZa;;AAEb,qBAAqB,mBAAO,CAAC,mIAAW;;AAExC;AACA,mBAAmB,mBAAO,CAAC,+IAA6B;AACxD,CAAC;;;;;;;;;;;;;ACND;AACa;AACb;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;;AAEA;AACA,SAAS;;AAET;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;AACD;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,YAAY;AACvB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,sCAAsC;AACtE;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,oBAAoB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,mBAAmB;AACzC;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;;AAEA,SAAS;AACT,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;;AAEb;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;;;AAGD;AACA;AACA;AACA;AACA;AACA,CAAC,E","file":"default/js/storeLocator.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"../codebase/tkooples/cartridges/app_core_tkooples/cartridge/client/default/js/storeLocator.js\");\n","'use strict';\n\nmodule.exports = function (include) {\n if (typeof include === 'function') {\n include();\n } else if (typeof include === 'object') {\n Object.keys(include).forEach(function (key) {\n if (typeof include[key] === 'function') {\n include[key]();\n }\n });\n }\n};\n","'use strict';\n\nvar processInclude = require('base/util');\n\n$(document).ready(function () {\n processInclude(require('./storeLocator/storeLocator'));\n});\n","/* globals google */\n'use strict';\nvar urlParams = new URLSearchParams(window.location.search);\nvar infowindow = new google.maps.InfoWindow();\n\n/**\n * appends params to a url\n * @param {string} url - Original url\n * @param {Object} params - Parameters to append\n * @returns {string} result url with appended parameters\n */\nfunction appendToUrl(url, params) {\n var newUrl = url;\n newUrl += (newUrl.indexOf('?') !== -1 ? '&' : '?') + Object.keys(params).map(function (key) {\n return key + '=' + encodeURIComponent(params[key]);\n }).join('&');\n\n return newUrl;\n}\nvar map;\n/**\n * Uses google maps api to render a map\n */\nfunction maps() {\n // Init U.S. Map in the center of the viewport\n var latlng = new google.maps.LatLng(parseFloat($(\"#lat\").val()), parseFloat($(\"#long\").val()));\n var mapOptions = {\n scrollwheel: false,\n zoom: 5,\n center: latlng\n };\n\n map = new google.maps.Map($('.map-canvas')[0], mapOptions);\n var mapdiv = $('.map-canvas').attr('data-locations');\n\n mapdiv = JSON.parse(mapdiv);\n\n var bounds = new google.maps.LatLngBounds();\n\n // Customized google map marker icon with svg format\n var markerImg = {\n path: 'M17.9159 19.4362L17.3359 18.6215L17.3263 18.6285L17.9159 19.4362ZM6.08405 19.4362L6.67369 18.6285L6.66404 18.6216L6.08405 19.4362ZM11.2252 26.4453L12.2098 26.2706L11.2252 26.4453ZM12.7748 26.4453L13.7595 26.6199V26.6199L12.7748 26.4453ZM18.4959 20.2508C21.218 18.3128 23 15.1759 23 11.625H21C21 14.4857 19.5672 17.033 17.336 18.6216L18.4959 20.2508ZM23 11.625C23 5.69277 18.045 0.9375 12 0.9375V2.9375C17.0007 2.9375 21 6.85672 21 11.625H23ZM12 0.9375C5.95503 0.9375 1 5.69277 1 11.625H3C3 6.85672 6.99927 2.9375 12 2.9375V0.9375ZM1 11.625C1 15.1759 2.78202 18.3128 5.50406 20.2508L6.66404 18.6216C4.4328 17.033 3 14.4857 3 11.625H1ZM12.2098 26.2706C11.5182 22.3715 8.56064 20.006 6.67365 18.6285L5.49446 20.2439C7.36413 21.6087 9.69888 23.566 10.2405 26.6199L12.2098 26.2706ZM12 26.1221C12.068 26.1221 12.1236 26.1495 12.1568 26.1789C12.1875 26.2062 12.2041 26.2387 12.2098 26.2706L10.2405 26.6199C10.384 27.4289 11.0791 28.1221 12 28.1221V26.1221ZM11.7902 26.2706C11.7959 26.2387 11.8125 26.2062 11.8432 26.1789C11.8764 26.1495 11.932 26.1221 12 26.1221V28.1221C12.9209 28.1221 13.616 27.4289 13.7595 26.6199L11.7902 26.2706ZM17.3263 18.6285C15.4394 20.006 12.4818 22.3715 11.7902 26.2706L13.7595 26.6199C14.3011 23.566 16.6359 21.6087 18.5055 20.2439L17.3263 18.6285Z',\n fillColor: 'black',\n fillOpacity: 2,\n scale: 0.8,\n strokeColor: 'black',\n strokeWeight: 2,\n anchor: new google.maps.Point(13, 30),\n labelOrigin: new google.maps.Point(12, 12),\n };\n\n Object.keys(mapdiv).forEach(function (key) {\n var item = mapdiv[key];\n var icon = window.location.origin ;\n icon +=$('#icon-hidden').val();\n var lable = parseInt(key, 10) + 1;\n var storeLocation = new google.maps.LatLng(item.latitude, item.longitude);\n var marker = new google.maps.Marker({\n position: storeLocation,\n map: map,\n title: item.name,\n icon: icon\n });\n\n function scrollToStore(element, parent) {\n \n $(parent).animate({\n scrollTop: $(parent).scrollTop() + $(element).offset().top - $(parent).offset().top\n }, {\n duration: 'slow',\n easing: 'swing'\n });\n }\n\n marker.addListener('click', function (event) {\n event.preventDefault;\n infowindow.close();\n\n infowindow.setOptions({\n content: item.infoWindowHtml\n });\n infowindow.open(map, marker);\n $('.results .card-body').removeClass('active');\n $('.results .card-body#'+(item.id).toLowerCase()).addClass('active');\n\n var store_select_desktop = $('.store-locator-container .results-card .results');\n var store_block = store_select_desktop.find('.card-body.active');\n \n\n var store_details_mobile = $('.store-details-mobile');\n store_details_mobile.find('.store-details-content').empty().append($('.results .card-body.active').html());\n store_details_mobile.addClass('show');\n\n if ( $(window).width() < 840 ) {\n $('html, body').animate({\n scrollTop: $('.map-canvas').offset().top\n }, 1000);\n }\n\n scrollToStore(store_block, store_select_desktop);\n\n centerMapStore(item.latitude,item.longitude);\n });\n\n // Create a minimum bound based on a set of storeLocations\n bounds.extend(marker.position);\n });\n // Fit the all the store marks in the center of a minimum bounds when any store has been found.\n if (mapdiv && mapdiv.length !== 0) {\n map.fitBounds(bounds);\n }\n}\n\n$('.store-details-mobile .icon-close-small').on('click', function () {\n $('.store-details-mobile').removeClass('show');\n});\n/**\n * Renders the results of the search and updates the map\n * @param {Object} data - Response from the server\n */\nfunction updateStoresResults(data) {\n var $resultsDiv = $('.results');\n var $mapDiv = $('.map-canvas');\n var hasResults = data.stores.length > 0;\n\n if (!hasResults) {\n $('.store-locator-no-results').show();\n } else {\n $('.store-locator-no-results').hide();\n }\n\n $resultsDiv.empty()\n .data('has-results', hasResults)\n .data('radius', data.radius)\n .data('search-key', data.searchKey);\n\n $mapDiv.attr('data-locations', data.locations);\n if ($mapDiv.data('has-google-api')) {\n maps();\n } else {\n $('.store-locator-no-apiKey').show();\n }\n\n if (data.storesResultsHtml) {\n $resultsDiv.append(data.storesResultsHtml);\n }\n}\n\n/**\n * Search for stores with new zip code\n * @param {HTMLElement} element - the target html element\n * @returns {boolean} false to prevent default event\n */\nfunction search(element) {\n var dialog = element.closest('.in-store-inventory-dialog');\n var spinner = dialog.length ? dialog.spinner() : $.spinner();\n spinner.start();\n var $form = element.closest('.store-locator');\n var radius = $('.results').data('radius');\n var url = $form.attr('action');\n var urlParams = { radius: radius };\n\n var payload = $form.is(\"form\")\n ? $form.serialize()\n : {\n postalCode: $form.find('[name=\"postalCode\"]').val(),\n lat: $form.find('[name=\"lat\"]').val(),\n long: $form.find('[name=\"long\"]').val()\n };\n\n url = appendToUrl(url, urlParams);\n $.ajax({\n url: url,\n type: $form.attr('method'),\n data: payload,\n dataType: 'json',\n success: function (data) {\n spinner.stop();\n updateStoresResults(data);\n $('.select-store').prop('disabled', true);\n }\n });\n return false;\n}\n\nfunction centerMapStore(latitude,longitude) {\n const pos = {\n lat: latitude,\n lng: longitude,\n };\n map.setCenter(pos);\n}\n\nlet autocomplete;\nlet address1Field;\nlet address2Field;\nlet postalField;\nlet latField;\nlet lngField;\n\nfunction initAutocomplete() {\n postalField = document.querySelector(\"#store-postal-code\");\n latField = document.querySelector(\"#lat\");\n lngField = document.querySelector(\"#long\");\n var center = new google.maps.LatLng(parseFloat($(\"#lat\").val()), parseFloat($(\"#long\").val()));\n var defaultBounds = new google.maps.LatLngBounds();\n // Create the autocomplete object, restricting the search predictions to\n // addresses in the US and Canada.\n autocomplete = new google.maps.places.Autocomplete(postalField, {\n bounds: defaultBounds,\n componentRestrictions: { country: [$(\"#storeCountry\").val()] },\n fields: [\"address_components\", \"geometry\", \"name\"],\n types: [],\n strictBounds: false,\n });\n // address1Field.focus();\n // When the user selects an address from the drop-down, populate the\n // address fields in the form.\n autocomplete.addListener(\"place_changed\", fillInAddress);\n};\n\nfunction fillInAddress() {\n // Get the place details from the autocomplete object.\n const place = autocomplete.getPlace();\n let postcode = \"\";\n var lat = 0.0;\n var lng = 0.0;\n if (place.geometry && place.geometry.location) {\n lat = place.geometry.location.lat();\n lng = place.geometry.location.lng();\n }\n\n var address = place.address_components;\n for (var i = 0; i < address.length; i++) {\n const componentType = address[i].types[0];\n switch (componentType) {\n case \"street_number\": {\n postcode += ' ' + address[i][\"long_name\"];\n break;\n }\n case \"route\": {\n postcode += ' ' + address[i][\"long_name\"];\n break;\n }\n case \"postal_code\": {\n postcode += ' ' + address[i][\"long_name\"];\n break;\n }\n case \"postal_code_suffix\": {\n break;\n }\n case \"locality\":{\n postcode += ' ' + address[i][\"long_name\"];\n break;\n }\n case \"administrative_area_level_1\": {\n break;\n }\n case \"administrative_area_level_2\": {\n break;\n }\n case \"country\":{\n break;\n }\n }\n\n }\n postalField.value = postcode;\n latField.value = lat;\n lngField.value = lng;\n};\n\nfunction triggerChangeCountry(){\n $(\"#storeCountry\").on('change', function(){\n initAutocomplete();\n clearCityField();\n \n var lat = parseFloat($(\"#storeCountry :selected\").data('lat'));\n var lng = parseFloat($(\"#storeCountry :selected\").data('lng'));\n if (lat && lng) {\n centerMapStore(lat, lng);\n \n $('#lat').val(lat);\n $('#long').val(lng);\n\n $('.btn-storelocator-search[type=\"button\"]').trigger('click');\n }\n });\n}\n\nfunction fillCountryCityFields(lng, lat){\n const geocoder = new google.maps.Geocoder();\n $('#lat').val(parseFloat(lat));\n $('#long').val(parseFloat(lng));\n const latlng = {\n lat: parseFloat(lat),\n lng: parseFloat(lng),\n };\n geocoder.geocode({ location: latlng }).then((response) => {\n if (response.results[0]) {\n response.results[0].address_components.forEach(component => {\n if (component.types.includes('country')) {\n $(\"#storeCountry\").val(component.short_name);\n } else if (component.types.includes('locality')) {\n $(\"#store-postal-code\").val(component.short_name);\n }\n });\n $('.invalid-feedback').empty();\n }\n })\n .catch((e) => window.alert(\"Geocoder failed due to: \" + e));\n\n}\n\nfunction clearCityField(){\n $('#store-postal-code').val('');\n}\n\nfunction getStores(url) {\n $.ajax({\n url: url,\n type: 'get',\n dataType: 'json',\n success: function (data) {\n $.spinner().stop();\n updateStoresResults(data);\n $('.select-store').prop('disabled', true);\n }\n });\n}\n\nmodule.exports = {\n init: function () {\n if ($('.map-canvas').data('has-google-api')) {\n maps();\n initAutocomplete();\n triggerChangeCountry();\n $('.skp-search-icon').click(function () {\n $('.store-locator-container form.store-locator').submit();\n });\n $(document).on('click', '.results .card-body', function (e) {\n\n infowindow.close();\n\n $('.results .card-body').removeClass('active');\n var $this = $(this);\n $this.toggleClass('active');\n var lat = $this.data('lat');\n var long = $this.data('long');\n centerMapStore(lat,long);\n\n var title = $this.data('store-info');\n var storeLocation = new google.maps.LatLng(lat, long);\n var icon = window.location.origin ;\n var marker = new google.maps.Marker({\n position: storeLocation,\n map: map,\n title: title,\n icon: icon\n });\n infowindow.setOptions({\n content: $this.data('store-details')\n });\n infowindow.open(map, marker);\n \n });\n } else {\n $('.store-locator-no-apiKey').show();\n }\n\n // if (!$('.results').data('has-results')) {\n // $('.store-locator-no-results').show();\n // }\n },\n\n detectLocation: function () {\n // clicking on detect location.\n $('.detect-location').on('click', function () {\n $.spinner().start();\n if (!navigator.geolocation) {\n $.spinner().stop();\n return;\n }\n var $detectLocationButton = $('.detect-location');\n var url = $detectLocationButton.data('action');\n var radius = $('.results').data('radius');\n navigator.geolocation.getCurrentPosition(position => {\n var urlParams = {\n radius: radius,\n lat: position.coords.latitude,\n long: position.coords.longitude\n };\n\n url = appendToUrl(url, urlParams);\n getStores(url);\n fillCountryCityFields(urlParams.long, urlParams.lat);\n }, () => {\n var urlParams = {\n radius: radius,\n storeCountry: $(\"#storeCountry :selected\").val(),\n lat: parseFloat($(\"#storeCountry :selected\").data('lat')),\n long: parseFloat($(\"#storeCountry :selected\").data('lng'))\n };\n \n url = appendToUrl(url, urlParams);\n getStores(url);\n });\n \n $.spinner().stop();\n });\n },\n\n search: function () {\n $('.store-locator-container form.store-locator').submit(function (e) {\n e.preventDefault();\n search($(this));\n\n });\n $('.store-locator-container .btn-storelocator-search[type=\"button\"]').click(function (e) {\n e.preventDefault();\n search($(this));\n });\n },\n\n changeRadius: function () {\n $('.store-locator-container .radius').change(function () {\n var radius = $(this).val();\n var searchKeys = $('.results').data('search-key');\n var url = $(this).data('action-url');\n var urlParams = {};\n\n if (searchKeys.postalCode) {\n urlParams = {\n radius: radius,\n postalCode: searchKeys.postalCode\n };\n } else if (searchKeys.lat && searchKeys.long) {\n urlParams = {\n radius: radius,\n lat: searchKeys.lat,\n long: searchKeys.long\n };\n }\n\n url = appendToUrl(url, urlParams);\n var dialog = $(this).closest('.in-store-inventory-dialog');\n var spinner = dialog.length ? dialog.spinner() : $.spinner();\n spinner.start();\n getStores(url)\n });\n },\n selectStore: function () {\n $('.store-locator-container').on('click', '.select-store', (function (e) {\n e.preventDefault();\n var selectedStore = $(':checked', '.results-card .results');\n var data = {\n storeID: selectedStore.val(),\n searchRadius: $('#radius').val(),\n searchPostalCode: $('.results').data('search-key').postalCode,\n storeDetailsHtml: selectedStore.siblings('label').find('.store-details').html(),\n event: e\n };\n\n $('body').trigger('store:selected', data);\n }));\n },\n updateSelectStoreButton: function () {\n $('body').on('change', '.select-store-input', (function () {\n $('.select-store').prop('disabled', false);\n }));\n }\n};\n\nvar btnStore = $('.btn-store'),\n panelShow =$('.panel-show');\n $(document).on('click', '.btn-store', function (e) {\n var self__ =$(this);\n self__.toggleClass('active');\n});\nfunction deplace(){\n var wdithofwindow = $(window).width();\n if(wdithofwindow <= 756){\n $('.SKP-Store .skp-store-result').insertAfter('.SKP-Store .col-lg-8');\n }\n}\ndeplace();\n$(window).on('resize', function(){\n deplace()\n});\n$(window).on('load', function() {\n if(!urlParams.has('storeid')) {\n $('.detect-location').trigger('click');\n }\n centerMapStore(parseFloat($(\"#lat\").val()),parseFloat($(\"#long\").val()));\n});\n\nfunction showMapListe(){\n $('.showListe').on('click', function () {\n $(this).addClass('active').siblings().removeClass('active');\n $('.map-canvas').addClass('d-none').removeClass('d-block');\n $('.skp-store-result').addClass('d-block').removeClass('d-none');\n\n });\n $('.showMap').on('click', function () {\n $(this).addClass('active').siblings().removeClass('active');\n $('.skp-store-result').addClass('d-none').removeClass('d-block');\n $('.map-canvas').addClass('d-block').removeClass('d-none');\n });\n}\nshowMapListe()\n\n$('.btn-storelocator-search').on('click', function () {\n if (($('.skp-city-store').val().length == 0)) {\n $('.skp-city-store').parent().next($('.invalid-feedback')).removeClass('d-none');\n } else {\n $('.skp-city-store').parent().next($('.invalid-feedback')).addClass('d-none');\n }\n});\n\n\n$('.SKP-Location input[type=text]').on('keyup', function () {\n var input = $(this);\n if (($(input).val().length !== 0)) {\n $(input).parent().next($('.invalid-feedback')).addClass('d-none');\n }\n});"],"sourceRoot":""}