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,CAAC,CAClDpB,IAAI,CAACC,QAAQ,IAAI;IACd,OAAOA,QAAQ;EACnB,CAAC,CAAC;AACV","sources":["webpack://sfra-boilerplate/./cartridges/app_custom_core/cartridge/client/default/js/widgets/toolbox/woosmapAddressMgr.js","webpack://sfra-boilerplate/./cartridges/app_custom_core/cartridge/client/default/js/widgets/toolbox/woosmapMgr.js"],"sourcesContent":["/**\n * @description Return address component by provided type\n * @private\n * @param {Array<any>} addressComponents - API address components\n * @param {string} type - Target component type\n * @returns {object|undefined} Address component\n */\nfunction getAddressComponentByType(addressComponents, type) {\n    return addressComponents.find((addressComponent) => {\n        return addressComponent.types.indexOf(type) === 0;\n    });\n}\n\n/**\n * @description gets fallback component\n * @private\n * @param {Array<string>} fallbackProperties - Fallback field types\n * @param {Array<any>} addressComponents - API address components\n * @param {string} aimProperty - Field property\n * @returns {string} fallback address component\n */\nfunction getFallbackComponent(fallbackProperties, addressComponents, aimProperty) {\n    const properties = fallbackProperties.reduce((propertiesString, fallbackProperty) => {\n        const addressComponent = getAddressComponentByType(addressComponents, fallbackProperty);\n        const componentValue = (addressComponent && addressComponent[aimProperty]) || '';\n\n        if (!propertiesString) {\n            propertiesString = componentValue;\n\n            return propertiesString;\n        }\n\n        return propertiesString.concat(' ', componentValue);\n    }, '');\n\n    return properties;\n}\n\n/**\n * @description gets related component\n * @private\n * @param {Array<string>} relatedProperties - Related field types\n * @param {Array<any>} addressComponents - API address components\n * @returns {(object|boolean)} result\n */\nfunction getRelatedComponents(relatedProperties, addressComponents) {\n    let relatedComponents = true;\n\n    if (relatedProperties.length) {\n        relatedComponents = false;\n\n        const property = relatedProperties.find((relatedProperty) => {\n            return getAddressComponentByType(addressComponents, relatedProperty);\n        });\n\n        if (property) {\n            relatedComponents = getAddressComponentByType(addressComponents, property);\n        }\n    }\n\n    return relatedComponents;\n}\n\n/**\n * @description Return mapping config for provided country\n * @param {string} country - Mapping config country\n * @returns {object} Mapping config\n */\nexport function getAddressFieldsMappingConfig(country) {\n    const config = {\n        address1: {\n            serviceObjectTypes: ['premise', 'organisation'],\n            serviceObjectFallbackTypes: ['street_number', 'route'],\n            serviceObjectProperty: 'long_name'\n        },\n        address2: {\n            serviceObjectTypes: ['street_number', 'route'],\n            serviceObjectRelatedTypes: ['premise', 'organisation'],\n            serviceObjectProperty: 'long_name'\n        },\n        city: {\n            serviceObjectTypes: [['locality', 'postal_town']],\n            serviceObjectProperty: 'long_name'\n        },\n        stateCode: {\n            serviceObjectTypes: ['administrative_area_level_1'],\n            serviceObjectProperty: 'short_name'\n        },\n        postalCode: {\n            serviceObjectTypes: ['postal_codes'],\n            serviceObjectProperty: 'long_name'\n        }\n    };\n\n    switch (country) {\n        case 'GB':\n            config.stateCode.serviceObjectTypes = ['administrative_area_level_2'];\n            break;\n        default:\n            break;\n    }\n\n    return config;\n}\n\n/**\n * @description Return address component by provided type\n * @param {Array<any>} addressComponents - API address components\n * @param {object} fieldConfig - Configuration object for current field\n * @param {Array<(string|Array<string>)>} fieldConfig.serviceObjectTypes - Fields required types\n * @param {string} fieldConfig.serviceObjectProperty - Field property\n * @param {Array<string>} fieldConfig.serviceObjectFallbackTypes - Fallback field types\n * @param {Array<string>} fieldConfig.serviceObjectRelatedTypes - Field related types\n * @returns {string} Address field\n */\n// eslint-disable-next-line sonarjs/cognitive-complexity\nexport function getAddressField(addressComponents, fieldConfig) {\n    const typesForMerge = fieldConfig.serviceObjectTypes;\n    const aimProperty = fieldConfig.serviceObjectProperty;\n    const fallbackProperties = fieldConfig.serviceObjectFallbackTypes || [];\n    const relatedProperties = fieldConfig.serviceObjectRelatedTypes || [];\n    const targetAddressProperties = [];\n\n    typesForMerge.forEach((mergeType) => {\n        let addressComponent = null;\n\n        if (Array.isArray(mergeType)) {\n            for (let i = 0, l = mergeType.length; i < l; i++) {\n                addressComponent = getAddressComponentByType(addressComponents, mergeType[i]);\n\n                if (addressComponent && addressComponent[aimProperty]) {\n                    break;\n                }\n            }\n        } else {\n            addressComponent = getAddressComponentByType(addressComponents, mergeType);\n        }\n\n        const relatedComponents = getRelatedComponents(relatedProperties, addressComponents);\n\n        if (addressComponent && addressComponent[aimProperty] && relatedComponents) {\n            targetAddressProperties.push(addressComponent[aimProperty]);\n        }\n    });\n\n    if (!targetAddressProperties.length) {\n        const fallbackComponent = getFallbackComponent(fallbackProperties, addressComponents, aimProperty);\n\n        targetAddressProperties.push(fallbackComponent);\n    }\n\n    return targetAddressProperties.join(' ');\n}\n","import { submitCORS } from 'core/toolbox/ajax';\nimport { appendParamsToUrl } from 'widgets/toolbox/util';\nimport { getAddressField, getAddressFieldsMappingConfig } from './woosmapAddressMgr';\n\nlet localitiesWidgetURL = 'https://sdk.woosmap.com/localities/localitieswidget.2.0.js';\nlet localitiesStylesURL = 'https://sdk.woosmap.com/localities/style.2.0.css';\nlet woosMapBaseURL = 'https://sdk.woosmap.com/map/map.js';\nconst woosMapDetailsBaseURL = 'https://api.woosmap.com/localities/details';\nconst woosMapPositionBaseURL = 'https://api.woosmap.com/geolocation/position';\nconst woosMapDistancematrixBaseURL = 'https://api.woosmap.com/distance/distancematrix/json';\nconst woosMapGeocodeBaseURL = 'https://api.woosmap.com/address/geocode/json';\n\nlet resolveWoosmapAPILocalities;\nlet resolveWoosmapAPIBase;\n\nconst initializationPromiseLocalities = new Promise((resolve) => {\n    resolveWoosmapAPILocalities = resolve;\n});\n\nconst initializationPromiseBase = new Promise((resolve) => {\n    resolveWoosmapAPIBase = resolve;\n});\n\nexport function initWoosmapMapAPI(key) {\n    const { woosmap } = window;\n\n    if (!(woosmap && woosmap.map)) {\n        var head = document.getElementsByTagName('head')[0];\n        var script = document.createElement('script');\n\n        woosMapBaseURL = appendParamsToUrl(woosMapBaseURL, {\n            key: key\n        });\n\n        script.type = 'text/javascript';\n        script.addEventListener('load', function _handler() {\n            this.removeEventListener('load', _handler);\n            resolveWoosmapAPIBase();\n        });\n        script.src = woosMapBaseURL;\n        head.appendChild(script);\n    }\n\n    return initializationPromiseBase;\n}\n\nexport function initWoosmapMap(selector, config) {\n    return new window.woosmap.map.Map(selector, config);\n}\n\nexport function initWoosmapMapMarker(params) {\n    return new window.woosmap.map.Marker(params);\n}\n\nexport function initWoosmapMapStoresOverlay(style = {}) {\n    return new window.woosmap.map.StoresOverlay(style);\n}\n\nexport function getWoosmapMapBounds() {\n    return new window.woosmap.map.LatLngBounds();\n}\n\nexport function getWoosmapMapInfoWindow(params = {}) {\n    return new window.woosmap.map.InfoWindow(params);\n}\n\nexport function createWoosmapMapLatLng(params = {}) {\n    return new window.woosmap.map.LatLng(params);\n}\n\nexport function initWoosMapAPI(key) {\n    const { woosmap } = window;\n\n    if (!(woosmap && woosmap.localities)) {\n        var head = document.getElementsByTagName('head')[0];\n        var script = document.createElement('script');\n        var link = document.createElement('link');\n\n        link.rel = 'stylesheet';\n        link.href = localitiesStylesURL;\n        head.appendChild(link);\n\n        localitiesWidgetURL = appendParamsToUrl(localitiesWidgetURL, {\n            key: key\n        });\n\n        script.type = 'text/javascript';\n        script.addEventListener('load', function _handler() {\n            this.removeEventListener('load', _handler);\n            resolveWoosmapAPILocalities();\n        });\n        script.src = localitiesWidgetURL;\n        head.appendChild(script);\n    }\n\n    return initializationPromiseLocalities;\n}\n\nexport function initWoosMapAutocomplete(params) {\n    return Promise.resolve(new window.woosmap.localities.Autocomplete(params.selector, params.config));\n}\n\nexport function woosMapGetDetails(params) {\n    const woosMapDetailsURL = appendParamsToUrl(woosMapDetailsBaseURL, params);\n\n    return submitCORS(woosMapDetailsURL)\n        .then(response => {\n            return response.result;\n        });\n}\n\n/**\n * @description Returns parsed address object\n * @param {array} addressComponents - Array with wossmap address components\n * @param {string} country - Components country\n * @returns {object} result\n */\nexport function parseAddress(addressComponents, country) {\n    const mappingConfig = getAddressFieldsMappingConfig(country);\n    const address = Object.keys(mappingConfig).reduce((addressObject, field) => {\n        addressObject[field] = getAddressField(addressComponents, mappingConfig[field]);\n\n        return addressObject;\n    }, {});\n\n    return Promise.resolve(address);\n}\n\n/**\n * @description Returns customer geolocation\n * @param {string} key - Woosmap API key\n * @returns {object} result\n */\nexport function getGeoLocation(key) {\n    const woosMapPositionURL = appendParamsToUrl(woosMapPositionBaseURL, {\n        key: key\n    });\n\n    return submitCORS(woosMapPositionURL)\n        .then(response => {\n            return response;\n        });\n}\n\n/**\n * @description Find the Address or Coordinates for places\n * @param {string} key - Woosmap API key\n * @param {object} geocoderRequestParams - position coordinates\n * @param {string} geocoderRequestParams.latitude - position latitude\n * @param {string} geocoderRequestParams.longitude - position longitude\n * @param {string} geocoderRequestParams.address - address phrase\n * @returns {object} result\n */\nexport function Geocode(key, geocoderRequestParams) {\n    const woosMapGeocodeURL = appendParamsToUrl(woosMapGeocodeBaseURL, {\n        key: key,\n        ...geocoderRequestParams\n    });\n\n    return submitCORS(woosMapGeocodeURL)\n        .then(response => {\n            return response;\n        });\n}\n\n/**\n * @description Returns customer geolocation\n * @param {string} key - Woosmap API key\n * @param {object} data - Woosmap request data\n * @returns {object} result\n */\nexport function getDistance(key, data) {\n    const { destinations, units, origins } = data;\n    const woosMapPositionURL = appendParamsToUrl(woosMapDistancematrixBaseURL, {\n        key: key\n    });\n    const body = { destinations, units, origins };\n\n    return submitCORS(woosMapPositionURL, 'POST', {}, body)\n        .then(response => {\n            return response;\n        });\n}\n"],"names":["getAddressComponentByType","addressComponents","type","find","addressComponent","types","indexOf","getFallbackComponent","fallbackProperties","aimProperty","properties","reduce","propertiesString","fallbackProperty","componentValue","concat","getRelatedComponents","relatedProperties","relatedComponents","length","property","relatedProperty","getAddressFieldsMappingConfig","country","config","address1","serviceObjectTypes","serviceObjectFallbackTypes","serviceObjectProperty","address2","serviceObjectRelatedTypes","city","stateCode","postalCode","getAddressField","fieldConfig","typesForMerge","targetAddressProperties","forEach","mergeType","Array","isArray","i","l","push","fallbackComponent","join","submitCORS","appendParamsToUrl","localitiesWidgetURL","localitiesStylesURL","woosMapBaseURL","woosMapDetailsBaseURL","woosMapPositionBaseURL","woosMapDistancematrixBaseURL","woosMapGeocodeBaseURL","resolveWoosmapAPILocalities","resolveWoosmapAPIBase","initializationPromiseLocalities","Promise","resolve","initializationPromiseBase","initWoosmapMapAPI","key","woosmap","window","map","head","document","getElementsByTagName","script","createElement","addEventListener","_handler","removeEventListener","src","appendChild","initWoosmapMap","selector","Map","initWoosmapMapMarker","params","Marker","initWoosmapMapStoresOverlay","style","StoresOverlay","getWoosmapMapBounds","LatLngBounds","getWoosmapMapInfoWindow","InfoWindow","createWoosmapMapLatLng","LatLng","initWoosMapAPI","localities","link","rel","href","initWoosMapAutocomplete","Autocomplete","woosMapGetDetails","woosMapDetailsURL","then","response","result","parseAddress","mappingConfig","address","Object","keys","addressObject","field","getGeoLocation","woosMapPositionURL","Geocode","geocoderRequestParams","woosMapGeocodeURL","getDistance","data","destinations","units","origins","body"],"sourceRoot":""}