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gBAAiB9O,KAAKoK,0BACtF,IAGJ,OAAOtG,OAAOmL,GAClB,CAvSA9K,UAAU+K,8BAA8B3N,UAAAA,EAAU+B,WAAWC,eAAe,WACxEF,kBAAkBpC,WAAWuC,oBACjC,G,uFCbA,SAAS2L,QAAQC,GAGf,OAAOD,QAAU,mBAAqBE,QAAU,iBAAmBA,OAAOC,SAAW,SAAUF,GAC7F,cAAcA,CAChB,EAAI,SAAUA,GACZ,OAAOA,GAAK,mBAAqBC,QAAUD,EAAEG,cAAgBF,QAAUD,IAAMC,OAAOpP,UAAY,gBAAkBmP,CACpH,EAAGD,QAAQC,EACb,CCNA,SAASI,cAAcC,GACrB,IAAIlP,ECFN,SAAqBkP,EAAGC,GACtB,GAAI,UAAYP,QAAQM,KAAOA,EAAG,OAAOA,EACzC,IAAItJ,EAAIsJ,EAAEJ,OAAOM,aACjB,QAAI,IAAWxJ,EAAG,CAChB,IAAI5F,EAAI4F,EAAEhF,KAAKsO,EAAGC,GAAK,WACvB,GAAI,UAAYP,QAAQ5O,GAAI,OAAOA,EACnC,MAAM,IAAIqP,UAAU,+CACtB,CACA,OAAQ,WAAaF,EAAIG,OAASC,QAAQL,EAC5C,CDPUE,CAAYF,EAAG,UACvB,MAAO,UAAYN,QAAQ5O,GAAKA,EAAIA,EAAI,EAC1C,CEJA,SAASwP,gBAAgB5J,EAAGuJ,EAAGD,GAC7B,OAAQC,EAAIF,cAAcE,MAAOvJ,EAAI6J,OAAOC,eAAe9J,EAAGuJ,EAAG,CAC/D3Q,MAAO0Q,EACPS,YAAY,EACZC,cAAc,EACdC,UAAU,IACPjK,EAAEuJ,GAAKD,EAAGtJ,CACjB,C","sources":["webpack://RdoWeb/./ResourcePackages/Main/assets/src/scripts/filters/to-miles.js","webpack://RdoWeb/./ResourcePackages/Main/assets/src/scripts/functions/element-enumerator.js","webpack://RdoWeb/./ResourcePackages/Main/assets/src/scripts/functions/widget-initializer.js","webpack://RdoWeb/./ResourcePackages/Main/assets/src/scripts/functions/google-utils.js","webpack://RdoWeb/./ResourcePackages/Main/assets/src/scripts/widgets/branch-finder.js","webpack://RdoWeb/./node_modules/@babel/runtime/helpers/esm/typeof.js","webpack://RdoWeb/./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","webpack://RdoWeb/./node_modules/@babel/runtime/helpers/esm/toPrimitive.js","webpack://RdoWeb/./node_modules/@babel/runtime/helpers/esm/defineProperty.js"],"sourcesContent":["import { widgetInitialisation } from \"../functions/widget-init\";\r\nimport { NumberUtils } from \"../functions/number-utils\";\r\n\r\nwidgetInitialisation(initToMilesFilter);\r\n\r\nfunction initToMilesFilter() {\r\n Vue.filter('toMiles', function (value, options) {\r\n options = options || {};\r\n\r\n if (typeof value !== \"number\") {\r\n var parsedValue = NumberUtils.tryParse(value);\r\n if (parsedValue === null)\r\n return value;\r\n\r\n value = parsedValue;\r\n }\r\n\r\n if (value === 0)\r\n return \"\";\r\n\r\n var minimumFractionDigits = '2';\r\n if (typeof options.minimumFractionDigits === \"number\")\r\n minimumFractionDigits = options.minimumFractionDigits.toString();\r\n\r\n var formattedToPrecision = value.toFixed(minimumFractionDigits);\r\n var result = formattedToPrecision;\r\n if (formattedToPrecision.startsWith(\"0\"))\r\n result = formattedToPrecision.substring(1);\r\n\r\n var showMilesLabel = true;\r\n if (options.hasOwnProperty(\"showMilesLabel\"))\r\n showMilesLabel = options.showMilesLabel;\r\n\r\n if (showMilesLabel)\r\n result = `${result} Miles Away`;\r\n\r\n return result;\r\n });\r\n}","export var ElementsEnumerator = function (elementsClass) {\r\n this.elementsClass = elementsClass;\r\n};\r\n\rElementsEnumerator.prototype.getElements = function () {\r var elements = document.getElementsByClassName(this.elementsClass);\r\n var elementIdPrefix = this.elementsClass + \"-\";\r\n for (var i = 0; i < elements.length; i++) {\r\n var element = elements[i];\r\n element.setAttribute(\"id\", (elementIdPrefix + (i + 1)));\r\n }\r return elements;\r};","import { widgetInitialisation } from \"./widget-init\";\r\nimport { ElementsEnumerator } from \"./element-enumerator\";\r\n\r\nconst initializedVueAppAttrName = \"data-vue-initialized\";\r\n\r\nexport var WidgetInitializer = function (elementsClass) {\r\n this.elementsClass = elementsClass;\r\n};\r\n\r\nWidgetInitializer.prototype.initialize = function (initializationCallback) {\r\n var that = this;\r\n widgetInitialisation(function () {\r\n return innerInitialization.call(that, initializationCallback);\r\n });\r\n};\r\n\r\nfunction innerInitialization(initializationCallback) {\r\n var elementsEnumerator = new ElementsEnumerator(this.elementsClass);\r\n var notInitializedElements = elementsEnumerator.getElements();\r\n for (var i = 0; i < notInitializedElements.length; i++) {\r\n var element = notInitializedElements[i];\r\n if (element.hasAttribute(initializedVueAppAttrName))\r\n return;\r\n\r\n var newElement = initializationCallback(element);\r\n if (newElement)\r\n { element = newElement; }\r\n\r\n element.setAttribute(initializedVueAppAttrName, '');\r\n }\r\n};","import { Constants } from \"./constants\";\r\n\r\nexport var GoogleUtils = {\r\n getGeocodeRequestUrl: function (key, address) {\r return `${Constants.GOOGLE.GEOCODE.URL}?language=en&${Constants.GOOGLE.GEOCODE.PARAMETERS.KEY}=${key}&${Constants.GOOGLE.GEOCODE.PARAMETERS.ADDRESS}=${address}`;\r },\r\r extractGeocodeLocationDetails: function (response) {\r\n if (!response)\r\n return null;\r\n\r\n if (!Array.isArray(response.results))\r\n return null;\r\n\r\n if (response.results.length === 0)\r\n return null;\r\n\r\n var firstResult = response.results[0];\r\n if (!firstResult)\r\n return null;\r\n\r\n if (!firstResult.geometry)\r\n return null;\r\n\r\n if (!firstResult.geometry.location)\r\n return null;\r\n\r\n var locationDetails = {};\r\n\r\n if (!firstResult.geometry.location.lat)\r\n return null;\r\n\r\n locationDetails.latitude = firstResult.geometry.location.lat;\r\n\r\n if (!firstResult.geometry.location.lng)\r\n return null;\r\n\r\n locationDetails.longitude = firstResult.geometry.location.lng;\r\n\r\n if (!Array.isArray(firstResult.address_components))\r\n return null;\r\n\r\n var stateAddressComponent = firstResult.address_components.find(component => component.types.some(type => type === \"administrative_area_level_1\"));\r\n if (!stateAddressComponent)\r\n return null;\r\n\r\n if (!stateAddressComponent.short_name)\r\n return null;\r\n\r\n locationDetails.stateCode = stateAddressComponent.short_name;\r\n locationDetails.stateName = stateAddressComponent.long_name || \"\";\r\n\r\n return locationDetails;\r\n }\r}","import { WidgetInitializer } from \"../functions/widget-initializer\";\r\nimport { ConfigUtils } from \"../functions/config-utils\";\r\nimport { Constants } from \"../functions/constants\";\r\nimport { GoogleUtils } from \"../functions/google-utils\";\r\nimport { LocalStorageUtils } from \"../functions/local-storage-utils\";\r\nimport { BranchUtils } from \"../functions/branch-utils\";\r\nimport { ArrayUtils } from \"../functions/array-utils\";\r\n\r\nimport '../filters/to-miles';\r\n\r\nvar widgetInitializer = new WidgetInitializer(Constants.COMPONENTS.BRANCH_FINDER);\r\nGlobalApp.registerInitializationHandler(Constants.COMPONENTS.BRANCH_FINDER, function () {\r\n widgetInitializer.initialize(initBranchFinderApp);\r\n});\r\n\r\nfunction initBranchFinderApp(element) {\r\n var config = ConfigUtils.getConfigFor(element);\r\n var vueApp = new Vue({\r\n el: '#' + element.id,\r\n data: {\r\n initializationReadyHook: GlobalApp.getInitializationReadyHook(),\r\n type_filters: config.equipmentTypes,\r\n locations_data: [],\r\n filters_open: false,\r\n has_preselection: false,\r\n searchTerm: '',\r\n map: null,\r\n markers: [],\r\n myStoreId: null,\r\n search_request: {\r\n \"equipmentTypes\": [],\r\n \"pageNumber\": \"1\",\r\n \"pageSize\": \"20\",\r\n \"searchRadius\": Constants.LOCAL_STORAGE.DEFAULT_RADIUS\r\n },\r\n mapCenter: {\r\n latitude: 0,\r\n longitude: 0\r\n },\r\n radius_options: config.radiusOptions\r\n },\r\n watch: {\r\n mapLoaded: {\r\n immediate: true,\r\n handler(newVal, oldVal) {\r\n if (newVal)\r\n this.init();\r\n }\r\n },\r\n search_request: {\r\n immediate: true,\r\n deep: true,\r\n handler(newVal, oldVal) {\r\n {\r\n if (newVal && newVal.equipmentTypes) {\r\n this.has_preselection = newVal.equipmentTypes.length !== 0\r\n }\r\n }\r\n }\r\n },\r\n },\r\n\r\n computed: {\r\n mapLoaded() {\r\n return window.mapLoaded;\r\n }\r\n },\r\n\r\n methods: {\r\n init: async function init() {\r\n await this.initSearchFilters();\r\n\r\n this.initGoogleMaps();\r\n\r\n try {\r\n await this.search(false);\r\n } catch (e) {\r\n GlobalApp.ErrorHandler.autoHandle(e);\r\n }\r\n\r\n // If the only branch in the list of results is the Online branch - recenter the map\r\n if (this.locations_data.length <= 1) {\r\n this.centerMap();\r\n }\r\n\r\n this.initializationReadyHook(element.id);\r\n },\r\n initSearchFilters: async function () {\r\n var queryLocationFilters = await BranchUtils.getQueryLocationFilters();\r\n\r\n this.mapCenter = queryLocationFilters.searchFilters;\r\n var deviceLocationFilters = queryLocationFilters.distanceFilters;\r\n\r\n this.search_request = { ...this.search_request, ...this.mapCenter, ...deviceLocationFilters };\r\n\r\n if (this.search_request?.equipmentTypes?.length > 0) {\r\n this.filters_open = true;\r\n this.has_preselection = true;\r\n }\r\n },\r\n initGoogleMaps: function () {\r\n this.map = new window.google.maps.Map(this.$refs[\"map\"], {\r\n zoom: Constants.LOCATIONS_GOOGLE_MAP.ZOOM,\r\n maxZoom: Constants.LOCATIONS_GOOGLE_MAP.MAX_ZOOM\r\n });\r\n },\r\n search: function (scrollToResults) {\r\n var $this = this;\r\n this.persistSearchParameters();\r\n\r\n if (!this.searchTerm)\r\n return $this.executeBranchSearch();\r\n\r\n var geocodeUrl = GoogleUtils.getGeocodeRequestUrl(GlobalApp.generalSettings.googleMapApiV3Key, this.searchTerm);\r\n return GlobalApp.FetchClient.fetchJson(geocodeUrl, {\r\n method: 'GET',\r\n skipHeaders: ['Accept', 'Content-Type', 'Cache-Control']\r\n }).then(locationData => {\r\n var locationDetails = GoogleUtils.extractGeocodeLocationDetails(locationData);\r\n if (locationDetails) {\r\n $this.search_request.Latitude = locationDetails.latitude;\r\n $this.search_request.Longitude = locationDetails.longitude;\r\n } else {\r\n return $this.getOnlineBranch();\r\n }\r\n if (window.isMobile && typeof scrollToResults === 'object') {\r\n window.scroll({\r\n top: 630, \r\n left: 0, \r\n behavior: 'smooth'\r\n });\r\n }\r\n \r\n return $this.executeBranchSearch();\r\n })\r\n },\r\n async getOnlineBranch() {\r\n var onlineBranch = await GlobalApp.BranchService.getOnlineBranch();\r\n if (onlineBranch && onlineBranch.BranchName)\r\n this.locations_data = [onlineBranch];\r\n },\r\n async executeBranchSearch() {\r\n let branchesData = await GlobalApp.BranchService.query(this.search_request);\r\n this.locations_data = branchesData?.Items || [];\r\n if (ArrayUtils.isNotEmpty(this.locations_data) === false) {\r\n await this.getOnlineBranch();\r\n }\r\n\r\n this.removeOldMarkers();\r\n this.setMarkers();\r\n this.drawMarkers();\r\n },\r\n toggleFilters: function toggleFilters() {\r\n this.filters_open = !this.filters_open;\r\n },\r\n getButtonText: function getButtonText(mystore) {\r\n return mystore ? 'My Store' : 'Make My Store';\r\n },\r\n setMyStore: function setMyStore(item) {\r\n this.myStoreId = item.Id;\r\n GlobalApp.MyStoreService.updateMyStorePreferencesAndNotify(this, item);\r\n },\r\n myStoreUpdateEventHandler: function (object, branchDetails) {\r\n if (object === this)\r\n return;\r\n\r\n if (!branchDetails)\r\n return;\r\n\r\n this.myStoreId = branchDetails.Id;\r\n },\r\n setMarkers: function setMarkers() {\r\n this.markers = [];\r\n\r\n var _icon = {\r\n url: \"/ResourcePackages/Main/assets/static_assets/location-pin-green.svg\",\r\n scaledSize: new google.maps.Size(33, 38)\r\n // origin: new google.maps.Point(0, 0),\r\n // anchor: new google.maps.Point(0, 0)\r\n };\r\n\r\n this.locations_data.map(el => {\r\n var $this = this;\r\n var marker = new window.google.maps.Marker({\r\n position: { lat: el.Address.Latitude, lng: el.Address.Longitude },\r\n map: null,\r\n displayed: true,\r\n icon: _icon,\r\n name: el.BranchName,\r\n equipmentTypes: el.equipmentTypes,\r\n infowindow: $this.getInfoWindow(el)\r\n });\r\n this.markers.push(marker);\r\n\r\n var $map = $this.map;\r\n google.maps.event.addListener(marker, 'click', function () { \r\n if (window.current_info_window) {\r\n window.current_info_window.close()\r\n }\r\n marker.infowindow.open({\r\n anchor: this,\r\n $map\r\n });\r\n window.current_info_window = marker.infowindow;\r\n });\r\n });\r\n },\r\n getInfoWindow: function getInfoWindow(location) {\r\n var address_string = `${location.Address.Street}
${location.Address.City}, ${location.Address.StateCode} ${location.Address.Zip}`;\r\n var phones = JSON.parse(location.PhoneNumbers);\r\n var phone_string = '';\r\n phones.map(el => {\r\n if (el.isVisible) {\r\n var phone_line = `${el.name}: ${el.value}`\r\n phone_string += phone_line;\r\n }\r\n });\r\n var contentString = `
\r\n

${location.BranchName}

\r\n

${address_string}

\r\n

${phone_string}

\r\n Details\r\n
`;\r\n\r\n var infowindow = new google.maps.InfoWindow({\r\n content: contentString,\r\n });\r\n\r\n return infowindow;\r\n },\r\n drawMarkers: function drawMarkers() {\r\n if (!this.map)\r\n return;\r\n\r\n if (ArrayUtils.isNotEmpty(this.markers) === false) {\r\n var circle = new google.maps.Circle({\r\n strokeOpacity: 0,\r\n strokeWeight: 0,\r\n fillOpacity: 0,\r\n map: this.map,\r\n center: new google.maps.LatLng(parseFloat(this.search_request.Latitude), parseFloat(this.search_request.Longitude)),\r\n radius: parseInt(this.search_request.searchRadius, 10) * 1609\r\n });\r\n this.map.fitBounds(circle.getBounds());\r\n return;\r\n }\r\n\r\n var bounds = new google.maps.LatLngBounds();\r\n this.markers.map(el => {\r\n el.setMap(this.map);\r\n bounds.extend(el.position);\r\n });\r\n this.map.fitBounds(bounds);\r\n },\r\n removeOldMarkers() {\r\n this.markers.forEach(marker => {\r\n if (marker && typeof marker.setMap === 'function') {\r\n marker.setMap(null);\r\n }\r\n });\r\n },\r\n centerMap: function getAddressString() {\r\n if (!this.map)\r\n return;\r\n\r\n this.map.setCenter(new google.maps.LatLng(parseFloat(this.mapCenter.Latitude), parseFloat(this.mapCenter.Longitude)));\r\n },\r\n getAddressString: function getAddressString(location) {\r\n return BranchUtils.getAddressString(location);\r\n },\r\n isMyStore: function isMyStore(location) {\r\n return this.myStoreId === location.Id;\r\n },\r\n mapMyStore: function (myStoreId) {\r\n if (this.myStoreId === null)\r\n this.myStoreId = myStoreId;\r\n },\r\n mapSearchParameters: function () {\r\n var stored_data = LocalStorageUtils.getLocalStorageData();\r\n this.search_request.searchRadius = stored_data.searchRadius;\r\n this.search_request.equipmentTypes = stored_data.equipmentTypes;\r\n this.searchTerm = stored_data.searchTerm;\r\n },\r\n persistSearchParameters: function () {\r\n LocalStorageUtils.updateLocalStorageData(otherPreferences => {\r\n otherPreferences.searchRadius = this.search_request.searchRadius;\r\n otherPreferences.searchTerm = this.searchTerm;\r\n otherPreferences.equipmentTypes = this.search_request.equipmentTypes;\r\n });\r\n }\r\n },\r\n\r\n created: function () {\r\n GlobalApp.MyStoreService.getMyStoreId().then(this.mapMyStore);\r\n\r\n this.mapSearchParameters();\r\n\r\n GlobalApp.EventHub.subscribeToEvent(Constants.EVENTS.CART.MY_STORE_UPDATE, this.myStoreUpdateEventHandler);\r\n },\r\n\r\n destroyed() {\r\n GlobalApp.EventHub.unsubscribeToEvent(Constants.EVENTS.CART.MY_STORE_UPDATE, this.myStoreUpdateEventHandler);\r\n }\r\n });\r\n\r\n return vueApp.$el;\r\n}","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}\nexport { _typeof as default };","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nfunction toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : i + \"\";\n}\nexport { toPropertyKey as default };","import _typeof from \"./typeof.js\";\nfunction toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nexport { toPrimitive as default };","import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperty(e, r, t) {\n return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n value: t,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[r] = t, e;\n}\nexport { _defineProperty as default };"],"names":["widgetInitialisation","Vue","filter","value","options","parsedValue","NumberUtils","tryParse","minimumFractionDigits","toString","formattedToPrecision","toFixed","result","startsWith","substring","showMilesLabel","hasOwnProperty","concat","ElementsEnumerator","elementsClass","this","prototype","getElements","elements","document","getElementsByClassName","elementIdPrefix","i","length","setAttribute","WidgetInitializer","innerInitialization","initializationCallback","notInitializedElements","element","hasAttribute","newElement","initialize","that","call","GoogleUtils","key","address","Constants","GOOGLE","GEOCODE","URL","PARAMETERS","KEY","ADDRESS","response","Array","isArray","results","firstResult","geometry","location","locationDetails","lat","latitude","lng","longitude","address_components","stateAddressComponent","find","component","types","some","type","short_name","stateCode","stateName","long_name","widgetInitializer","COMPONENTS","BRANCH_FINDER","initBranchFinderApp","_initSearchFilters","_init","config","ConfigUtils","getConfigFor","vueApp","el","id","data","initializationReadyHook","GlobalApp","getInitializationReadyHook","type_filters","equipmentTypes","locations_data","filters_open","has_preselection","searchTerm","map","markers","myStoreId","search_request","LOCAL_STORAGE","DEFAULT_RADIUS","mapCenter","radius_options","radiusOptions","watch","mapLoaded","immediate","handler","newVal","oldVal","init","deep","computed","window","methods","_asyncToGenerator","initSearchFilters","initGoogleMaps","search","e","ErrorHandler","autoHandle","centerMap","apply","arguments","_this$search_request","queryLocationFilters","BranchUtils","getQueryLocationFilters","searchFilters","deviceLocationFilters","distanceFilters","_objectSpread","google","maps","Map","$refs","zoom","LOCATIONS_GOOGLE_MAP","ZOOM","maxZoom","MAX_ZOOM","scrollToResults","$this","persistSearchParameters","executeBranchSearch","geocodeUrl","generalSettings","googleMapApiV3Key","FetchClient","fetchJson","method","skipHeaders","then","locationData","Latitude","Longitude","isMobile","scroll","top","left","behavior","getOnlineBranch","_this","onlineBranch","BranchService","BranchName","_this2","branchesData","query","Items","ArrayUtils","isNotEmpty","removeOldMarkers","setMarkers","drawMarkers","toggleFilters","getButtonText","mystore","setMyStore","item","Id","MyStoreService","updateMyStorePreferencesAndNotify","myStoreUpdateEventHandler","object","branchDetails","_icon","url","scaledSize","Size","marker","Marker","position","Address","displayed","icon","name","infowindow","getInfoWindow","push","$map","event","addListener","current_info_window","close","open","anchor","address_string","Street","City","StateCode","Zip","phones","JSON","parse","PhoneNumbers","phone_string","isVisible","phone_line","contentString","Url","InfoWindow","content","bounds","LatLngBounds","setMap","extend","fitBounds","circle","Circle","strokeOpacity","strokeWeight","fillOpacity","center","LatLng","parseFloat","radius","parseInt","searchRadius","getBounds","forEach","setCenter","getAddressString","isMyStore","mapMyStore","mapSearchParameters","stored_data","LocalStorageUtils","getLocalStorageData","updateLocalStorageData","otherPreferences","created","getMyStoreId","EventHub","subscribeToEvent","EVENTS","CART","MY_STORE_UPDATE","destroyed","unsubscribeToEvent","$el","registerInitializationHandler","_typeof","o","Symbol","iterator","constructor","toPropertyKey","t","r","toPrimitive","TypeError","String","Number","_defineProperty","Object","defineProperty","enumerable","configurable","writable"],"sourceRoot":""}