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ACrD,KACHrT,EAAM2R,SAAU,SAAC,EAAY,CAACvN,KAAM2M,EAAYE,MAAOjF,KAAM7G,EAAMmO,qBAAyB,SAGxG,IAGLtB,EAAclB,YAAc,gBAG5BkB,EAAcuB,UAAY,CACtB3O,YAAa,WACb1E,MAAO,YAAkB,YACzBoP,YAAa,WACbf,WAAY,WACZ+B,UAAW,SACXyC,UAAW,SACXM,uBAAwB,WACxBC,mBAAoB,WACpBE,aAAc,UAIlBxB,EAAcyB,aAAe,CACzBvT,MAAO,CAAC,WACRoP,YAAa,uBACb+D,uBAAwB,oBACxBC,mBAAoB,+BACpB/E,WAAY,IACZ+B,WAAW,EACXkD,cAAc,GAGlB,O","sources":["webpack://@whistleout/webui/./Areas/Shared/React/js/actions/SearchAddressActions.js","webpack://@whistleout/webui/./Areas/Shared/React/js/utils/AddressHelper.js","webpack://@whistleout/webui/./Areas/Shared/React/js/components/Popover.tsx","webpack://@whistleout/webui/./Areas/Shared/React/js/components/addressSearch/StateNames.js","webpack://@whistleout/webui/./Areas/Shared/React/js/components/addressSearch/AddressAutocomplete.tsx","webpack://@whistleout/webui/./Areas/Shared/React/js/components/addressSearch/TomtomGeocodeService.js","webpack://@whistleout/webui/./Areas/Shared/React/js/components/addressSearch/MessageLabel.tsx","webpack://@whistleout/webui/./Areas/Shared/React/js/components/addressSearch/AddressSearch.tsx"],"sourcesContent":["import { actions } from '../../../js/redux/sharedSlice';\nimport { dispatch } from '../../../js/redux/store';\n\nconst onAddressCookieInit = address =>\n dispatch(\n actions.addressCookieInit({\n address: JSON.parse(address)\n })\n );\n\nexport default class SearchAddressActions {\n static setAddressCookie(value) {\n if (typeof window === 'undefined' || !window || !wo$) {\n return;\n }\n\n if (!value) {\n Cookies.set('address', null, { path: '/', expires: -1 });\n return;\n }\n\n const newValue = JSON.stringify({\n placeId: value.placeId,\n label: value.label,\n latitude: value.latitude,\n longitude: value.longitude,\n unit: value.unit,\n streetNumber: value.streetNumber,\n street: value.street,\n city: value.city,\n state: value.state,\n postcode: value.postcode,\n types: value.types,\n partialMatch: value.partialMatch\n });\n\n const current = window.Cookies.get('address');\n if (newValue === current) {\n onAddressCookieInit(current);\n return;\n }\n\n Cookies.set('address', newValue, { path: '/', expires: 1 });\n onAddressCookieInit(newValue);\n }\n\n static invalidateAddressCookie(value) {\n if (typeof window === 'undefined' || !window || !wo$) {\n return;\n }\n\n if (!value) {\n Cookies.set('address', null, { path: '/', expires: -1 });\n return;\n }\n\n const current = window.Cookies.get('address');\n if (current) {\n const currentValue = JSON.parse(current);\n if (currentValue && currentValue.label !== value) {\n Cookies.set('address', null, { path: '/', expires: -1 });\n }\n }\n }\n}\n","export default class AddressHelper {\n\n static isEqual(a, b) {\n if (a === b) return true;\n\n const labelA = a ? a.label : null;\n const labelB = b ? b.label : null;\n\n if (labelA === labelB) return true;\n\n // Unable to use placeId from Mapbox, because it is not unique\n // For example, 115 and 116 Alexander St Crows Nest have the same Id in mapbox\n\n // const placeIdA = a ? a.placeId : null;\n // const placeIdB = b ? b.placeId : null;\n\n // if (placeIdA == placeIdB) return true;\n }\n\n static cleanUpFormattedAddress(str, components) {\n if (!str) {\n return '';\n }\n\n const parts = str.split(', ');\n if (parts.length < 2) {\n return str;\n }\n\n // Remove country name\n const country = parts[parts.length - 1];\n let res = str.substring(0, str.indexOf(`, ${country}`));\n\n // Remove location name\n const locationName = parts[0];\n if (components.locationName && (\n locationName === components.locationName.long_name\n || locationName === components.locationName.short_name\n )) {\n res = res.substring(`${locationName}, `.length, res.length);\n }\n\n return res;\n }\n\n static map(gmaps, appCountry) {\n if (!gmaps || !gmaps.place_id) {\n return null;\n }\n\n const location = {\n lat: gmaps.geometry.location.lat(),\n lng: gmaps.geometry.location.lng()\n };\n\n const components = this.getAddressComponentDictionary(gmaps.address_components);\n const res = {\n placeId: gmaps.place_id,\n latitude: location.lat,\n longitude: location.lng,\n unit: this.mapAddressComponent(components.unit),\n streetNumber: this.mapAddressComponent(components.streetNumber),\n street: this.mapAddressComponent(components.street),\n city: this.mapAddressComponent(components.city),\n state: this.mapAddressComponent(components.state),\n postcode: this.mapAddressComponent(components.postcode),\n country: this.mapAddressComponent(components.country),\n types: gmaps.types,\n partialMatch: gmaps.partial_match\n };\n if (!res.city) {\n res.city = this.mapAddressComponent(components.colloquial);\n }\n this.FixGMapsComponents(res, appCountry);\n res.label = this.getLabel(res);\n return res;\n }\n\n static FixGMapsComponents(address, appCountry) {\n // Set the state in case it's not correctly defined by Google.\n // For example some territories in Australia: Christams Island, Cocos Island, Norfolk Island\n if (this.isOtherState(appCountry, (address.country || {}).shortName)) {\n if (!address.city) {\n address.city = address.country;\n }\n if (!address.state) {\n address.state = {\n shortName: null,\n longName: null\n };\n }\n address.country = {\n shortName: appCountry.toUpperCase(),\n longName: this.getCountryLongName(appCountry)\n };\n }\n this.FixForJbt(address, appCountry);\n }\n\n static FixForJbt(address, appCountry) {\n if (appCountry.toUpperCase() === 'AU' && address.state &&\n address.state.shortName && address.state.shortName.toUpperCase() === 'JBT') {\n address.state = {\n shortName: 'NSW',\n longName: null\n };\n address.postcode = {\n shortName: '2540',\n longName: '2540'\n };\n if (address.placeId === 'ChIJRWcFsaSIFGsR8NZDkLQJBgQ') {\n address.city = {\n shortName: 'Jervis Bay',\n longName: 'Jervis Bay'\n };\n }\n }\n if (appCountry.toUpperCase() === 'AU' && address.placeId === 'ChIJCz4U9E2OFGsRFI-_VVoFsaE') {\n address.state = {\n shortName: 'NSW',\n longName: null\n };\n address.postcode = {\n shortName: '2540',\n longName: '2540'\n };\n address.latitude = -35.149092;\n address.longitude = 150.69611540000005;\n }\n\n }\n\n static getLabel(address) {\n if (!address) {\n return '';\n }\n\n if (\n !address.unit\n && !address.streetNumber\n && !address.street\n && !address.city\n && !address.postcode\n ) {\n return address.state\n ? this.getComponentValue(address.state)\n : this.getComponentValue(address.country);\n }\n\n const isNullOrWhiteSpace = p => !p || p.trim() === '';\n\n let label = '';\n const appendWithSpaceIfNeeded = p => {\n if (!isNullOrWhiteSpace(p)) {\n if (!isNullOrWhiteSpace(label)) {\n label += ' ';\n }\n label += p;\n }\n };\n\n if (address.unit) {\n label += this.getComponentValue(address.unit);\n }\n\n if (address.streetNumber) {\n if (!isNullOrWhiteSpace(label)) {\n label += '/';\n }\n label += this.getComponentValue(address.streetNumber);\n }\n\n appendWithSpaceIfNeeded(this.getComponentValue(address.street, true));\n\n if (!isNullOrWhiteSpace(label)) {\n label += ',';\n }\n\n appendWithSpaceIfNeeded(this.getComponentValue(address.city));\n appendWithSpaceIfNeeded(this.getComponentValue(address.state, true));\n appendWithSpaceIfNeeded(this.getComponentValue(address.postcode));\n\n return label;\n }\n\n static getComponentValue(component, preferShorter) {\n if (!component)\n return '';\n if (preferShorter === true && component.shortName && component.shortName.length > 0)\n return component.shortName;\n return component.longName;\n }\n\n static handleCountryName(gmaps, components) {\n const country = components.country;\n const countryName = country.long_name || this.getCountryLongName(country.short_name);\n // HACK: Sometimes the 'formatted_address' value returned by Google only has the country name\n // so we use the 'name' property instead\n return gmaps.formatted_address === countryName && gmaps.name !== countryName\n ? gmaps.name\n : gmaps.formatted_address;\n }\n\n static getCountryLongName(shortName) {\n if (shortName.toLowerCase() === 'au') {\n return 'Australia';\n }\n if (shortName.toLowerCase() === 'ca') {\n return 'Canada';\n }\n if (shortName.toLowerCase() === 'us') {\n return 'United States';\n }\n }\n\n static removeUnitName(formattedAddress, components) {\n var regex = new RegExp(`(${components.unit.long_name})[\\\\s|-|/]+`);\n return formattedAddress.replace(regex, '');\n }\n\n // See https://developers.google.com/maps/documentation/geocoding/intro#Types\n static getAddressComponentType(types) {\n if (types.indexOf('colloquial_area') > -1) {\n return 'colloquial';\n }\n\n if (types.indexOf('premise') > -1) {\n return 'locationName';\n }\n\n if (types.indexOf('subpremise') > -1) {\n return 'unit';\n }\n\n if (types.indexOf('street_number') > -1) {\n return 'streetNumber';\n }\n\n if (types.indexOf('route') > -1) {\n return 'street';\n }\n\n if (types.indexOf('locality') > -1 && types.indexOf('colloquial_area') === -1) {\n return 'city';\n }\n\n if (types.indexOf('administrative_area_level_1') > -1) {\n return 'state';\n }\n\n if (types.indexOf('postal_code') > -1) {\n return 'postcode';\n }\n\n if (types.indexOf('country') > -1) {\n return 'country';\n }\n\n return null;\n }\n\n static getAddressComponentDictionary(addressComponents) {\n const res = {};\n addressComponents.forEach(function (item) {\n const type = this.getAddressComponentType(item.types);\n if (type) {\n res[type] = item;\n }\n }, this);\n return res;\n }\n\n static mapAddressComponent(component) {\n return component ? {\n shortName: component.short_name,\n longName: component.long_name\n } : null;\n }\n\n static isSameState(gmaps, expectedTerms, appCountry) {\n if (!expectedTerms || expectedTerms.length < 1) {\n return true;\n }\n\n const components = this.getAddressComponentDictionary(gmaps.address_components);\n const actual = this.isOtherState(appCountry, (components.country || {}).short_name) && !components.state\n ? components.country || {}\n : components.state || {};\n\n return expectedTerms.some(term => {\n if (!term || !term.value) {\n return false;\n }\n\n const expected = term.value.toLowerCase();\n return (actual.short_name || '').toLowerCase() === expected ||\n (actual.long_name || '').toLowerCase() === expected;\n });\n }\n\n static isEqualCountry(gmaps, countryCode) {\n if (!gmaps) {\n return true;\n }\n\n const components = this.getAddressComponentDictionary(gmaps.address_components);\n if (!components || !components.country) {\n return false;\n }\n\n const gmapsCountryCodes = this.getGmapsCountryCodes(countryCode);\n const gmapsCountryCode = (components.country.short_name || '').toUpperCase();\n return gmapsCountryCodes.indexOf(gmapsCountryCode) > -1;\n }\n\n static isCountry(address) {\n return !address ||\n !address.unit &&\n !address.streetNumber &&\n !address.street &&\n !address.city &&\n !address.postcode &&\n !address.state\n ;\n }\n\n static getGmapsCountryCodes(country) {\n if (!country) {\n return null;\n }\n\n const countryCode = country.toUpperCase();\n if (countryCode === 'AU') {\n\n // Include Australian territories which Google treats as separate country codes\n const christmasIsland = 'CX';\n const cocosIsland = 'CC';\n const norfolkIsland = 'NF';\n\n return [\n countryCode,\n christmasIsland,\n cocosIsland,\n norfolkIsland\n ];\n }\n\n return [country.toUpperCase()];\n }\n\n static isOtherState(appCountry, addressCountry) {\n if (!addressCountry) {\n return false;\n }\n\n const addressCountryUpper = addressCountry.toUpperCase();\n\n if (appCountry.toUpperCase() === 'AU') {\n return addressCountryUpper === 'CX' ||\n addressCountryUpper === 'CC' ||\n addressCountryUpper === 'NF';\n }\n\n return false;\n }\n}\n","// TODO: Use https://react-bootstrap.github.io instead\n\nimport React, { useCallback, useEffect, useRef } from 'react';\n\ninterface Props {\n container: string | Element | false;\n content: string;\n title: string | JSX.Element;\n linkClassName: string;\n placement: 'auto' | 'top' | 'bottom' | 'left' | 'right';\n}\n\nconst Popover = (props: Props) => {\n const ref = useRef();\n\n const handleMount = useCallback(() => {\n const container = wo$(ref.current);\n WhistleOut.applyPopover(container);\n }, []);\n\n useEffect(() => handleMount(), [handleMount]);\n\n return (\n
\n {props.title}\n {props.content ? (\n \n {' '}\n \n \n ) : null}\n
\n );\n};\n\nexport default Popover;\n","export default class StateNames {\n constructor() {\n this.abbreviate = this.abbreviate.bind(this);\n }\n\n static abbreviate(name, country) {\n if (!name || name.length === 0) {\n return name;\n }\n\n if (country && country.length > 0) {\n const countryStates = this._states\n .filter(p => p.country.toLowerCase() === country.toLowerCase())[0];\n\n if (countryStates) {\n const match = this.getMatch(countryStates.states, name);\n if (match) {\n return match[0];\n }\n }\n }\n\n // All countries\n for (let i = 0; i < this._states.length; i++) {\n if (country && country.length > 0 && this._states[i].country.toLowerCase() === country.toLowerCase()) {\n // Already checked\n continue;\n }\n\n const match = this.getMatch(this._states[i].states, name);\n if (match) {\n return match[0];\n }\n }\n }\n\n static getMatch(items, name) {\n return items.filter(p => p[1].toLowerCase() === name.toLowerCase())[0];\n }\n}\n\n/*\n SELECT\n '[ ''' + [Code] + ''', ''' + [Name] + ''' ],'\n FROM [dbo].[State]\n*/\nStateNames._states = [\n {\n country: 'au',\n states: [\n ['ACT', 'Australian Capital Territory'],\n ['NSW', 'New South Wales'],\n ['NT', 'Northern Territory'],\n ['QLD', 'Queensland'],\n ['SA', 'South Australia'],\n ['TAS', 'Tasmania'],\n ['VIC', 'Victoria'],\n ['WA', 'Western Australia']\n ]\n },\n {\n country: 'ca',\n states: [\n ['AB', 'Alberta'],\n ['BC', 'British Columbia'],\n ['MB', 'Manitoba'],\n ['NB', 'New Brunswick'],\n ['NL', 'Newfoundland and Labrador'],\n ['NS', 'Nova Scotia'],\n ['ON', 'Ontario'],\n ['PE', 'Prince Edward Island'],\n ['QC', 'Quebec'],\n ['SK', 'Saskatchewan'],\n ['NT', 'Northwest Territories'],\n ['NU', 'Nunavut'],\n ['YT', 'Yukon Territory']\n ]\n },\n {\n country: 'mx',\n states: [\n ['AGU', 'Aguascalientes'],\n ['BCN', 'Baja California'],\n ['BCS', 'Baja California Sur'],\n ['CAM', 'Campeche\t'],\n ['CHP', 'Chiapas'],\n ['CHH', 'Chihuahua'],\n ['COA', 'Coahuila\t'],\n ['COL', 'Colima'],\n ['MEX', 'Estado de México'],\n ['DUR', 'Durango'],\n ['CDMX', 'Ciudad de Mexico'],\n ['GUA', 'Guanajuato'],\n ['GRO', 'Guerrero\t'],\n ['HID', 'Hidalgo'],\n ['JAL', 'Jalisco'],\n ['MIC', 'Michoacán'],\n ['MOR', 'Morelos'],\n ['NAY', 'Nayarit'],\n ['NLE', 'Nuevo León'],\n ['OAX', 'Oaxaca'],\n ['PUE', 'Puebla'],\n ['QUE', 'Querétaro'],\n ['ROO', 'Quintana Roo\t'],\n ['SLP', 'San Luis Potosí'],\n ['SIN', 'Sinaloa'],\n ['SON', 'Sonora'],\n ['TAB', 'Tabasco'],\n ['TAM', 'Tamaulipas'],\n ['TLA', 'Tlaxcala\t'],\n ['VER', 'Veracruz\t'],\n ['YUC', 'Yucatán'],\n ['ZAC', 'Zacatecas']\n ]\n },\n {\n country: 'us',\n states: [\n ['AL', 'Alabama'],\n ['AK', 'Alaska'],\n ['AZ', 'Arizona'],\n ['AR', 'Arkansas'],\n ['CA', 'California'],\n ['CO', 'Colorado'],\n ['CT', 'Connecticut'],\n ['DE', 'Delaware'],\n ['FL', 'Florida'],\n ['GA', 'Georgia'],\n ['HI', 'Hawaii'],\n ['ID', 'Idaho'],\n ['IL', 'Illinois'],\n ['IN', 'Indiana'],\n ['IA', 'Iowa'],\n ['KS', 'Kansas'],\n ['KY', 'Kentucky'],\n ['LA', 'Louisiana'],\n ['ME', 'Maine'],\n ['MD', 'Maryland'],\n ['MA', 'Massachusetts'],\n ['MI', 'Michigan'],\n ['MN', 'Minnesota'],\n ['MS', 'Mississippi'],\n ['MO', 'Missouri'],\n ['MT', 'Montana'],\n ['NE', 'Nebraska'],\n ['NV', 'Nevada'],\n ['NH', 'New Hampshire'],\n ['NJ', 'New Jersey'],\n ['NM', 'New Mexico'],\n ['NY', 'New York'],\n ['NC', 'North Carolina'],\n ['ND', 'North Dakota'],\n ['OH', 'Ohio'],\n ['OK', 'Oklahoma'],\n ['OR', 'Oregon'],\n ['PA', 'Pennsylvania'],\n ['RI', 'Rhode Island'],\n ['SC', 'South Carolina'],\n ['SD', 'South Dakota'],\n ['TN', 'Tennessee'],\n ['TX', 'Texas'],\n ['UT', 'Utah'],\n ['VT', 'Vermont'],\n ['VA', 'Virginia'],\n ['WA', 'Washington'],\n ['WV', 'West Virginia'],\n ['WI', 'Wisconsin'],\n ['WY', 'Wyoming']\n ]\n }\n];","import { createSlice, PayloadAction } from '@reduxjs/toolkit';\nimport ClassNames from 'classnames';\nimport React, {\n forwardRef,\n lazy,\n Suspense,\n useCallback,\n useEffect,\n useImperativeHandle,\n useReducer,\n useRef\n} from 'react';\nimport type Autocomplete from 'react-autocomplete';\n\nimport type { Address, AddressPart } from '../../../../js/@types/Address';\nimport type { GetLocationError, GetLocationResult } from '../../../../js/@types/WhistleOutContext';\nimport { rollbar } from '../../../../js/common/rollbar';\nimport GeocodeService from './TomtomGeocodeService.js';\n\ninterface State {\n value?: string;\n resultsFor?: string;\n values: Address[];\n center?: GetLocationResult;\n shouldSelectFirst?: boolean;\n errorCount: number;\n setCenterErrorCount: number;\n error?: string;\n}\n\ninterface Props {\n apiKey: string;\n country: string;\n inputClassName: string;\n inputElementId: string;\n inputProps: React.HTMLProps;\n autofocus?: boolean;\n onChange(e: React.ChangeEvent, value: string): void;\n onEmptyResults(error: string): void;\n onResponseError(error: GetLocationError): void;\n onSelect(address: Address): void;\n placeholder: string;\n queryDelay: number;\n searchTermMinLength: number;\n types: string[];\n value: string;\n wrapperProps?: React.HTMLProps;\n}\n\ninterface AutocompleteItem {\n label: string;\n abbr: string;\n source: Address;\n}\n\n// TODO: Move to geocode service\ninterface GeocodeError {\n error: GetLocationError;\n requestUrl: string;\n args: GeocodeArgs;\n}\n\n// TODO: Move to geocode service\ninterface GeocodeArgs {\n term: string;\n country: string;\n apiKey: string;\n proximityLatLng: GetLocationResult;\n types: string[];\n}\n\nconst { actions, reducer } = createSlice({\n name: 'address-autocomplete',\n initialState: {\n values: [],\n value: null,\n center: null,\n errorCount: 0,\n setCenterErrorCount: 0\n } as State,\n reducers: {\n onError: (state, action: PayloadAction) => {\n state.values = [];\n state.errorCount++;\n state.error = action.payload.error.textStatus;\n },\n onEmptyResults: (state, action: PayloadAction<{ resultsFor: string }>) => {\n state.resultsFor = action.payload.resultsFor;\n state.values = [];\n state.errorCount = 0;\n state.setCenterErrorCount = 0;\n state.error = null;\n },\n onSelect: (state, action: PayloadAction) => {\n state.shouldSelectFirst = false;\n\n if (state.value === action.payload) {\n return;\n }\n\n state.value = action.payload;\n state.errorCount = 0;\n state.setCenterErrorCount = 0;\n state.error = null;\n },\n onSetCenterError: state => {\n state.setCenterErrorCount++;\n },\n onResult: (\n state,\n action: PayloadAction<{\n resultsFor: string;\n values: State['values'];\n }>\n ) => {\n const { resultsFor, values } = action.payload;\n\n state.resultsFor = resultsFor;\n state.values = values || [];\n\n state.errorCount = 0;\n state.setCenterErrorCount = 0;\n state.error = null;\n },\n processError: state => {\n state.errorCount = 0;\n state.setCenterErrorCount = 0;\n },\n requestSearch: (state, action: PayloadAction<{ shouldSelectFirst: boolean }>) => {\n state.shouldSelectFirst = action.payload.shouldSelectFirst;\n },\n setCenter: (state, action: PayloadAction) => {\n state.center = action.payload;\n },\n setInputValue: (state, action: PayloadAction) => {\n if (state.value === action.payload) {\n return;\n }\n\n state.value = action.payload;\n state.values = [];\n state.errorCount = 0;\n state.setCenterErrorCount = 0;\n state.error = null;\n }\n }\n});\n\nexport interface AddressSearchHandle {\n focus: () => void;\n setValue: (value: string) => void;\n doSearch: (term?: string) => void;\n selectFirstSuggest: (term?: string) => void;\n}\n\nconst geocodeService = new GeocodeService();\nconst ReactAutocomplete = lazy(() => import('react-autocomplete'));\n\nconst AddressAutocomplete = forwardRef((props, ref) => {\n const inputRef = useRef();\n\n const autocompleteRef = useCallback((element: Autocomplete) => {\n if (!element) {\n return;\n }\n inputRef.current = element.refs.input as HTMLInputElement;\n }, []);\n\n const [state, dispatch] = useReducer(reducer, {\n values: [],\n value: props.value,\n center: null,\n errorCount: 0,\n setCenterErrorCount: 0\n });\n\n const inputDelayTimeout = useRef();\n const doSearchTimeout = useRef();\n\n const sendRollbarError = useCallback(\n (error: string, data: unknown) => {\n dispatch(actions.processError());\n rollbar.instance.error(error, {\n errorDetails: data,\n props: props,\n state: state\n });\n },\n [props, state]\n );\n\n const setCenter = useCallback(\n (callback: () => void) => {\n WhistleOut.getCurrentLatLng(\n latLng => {\n if (\n !props.country ||\n !latLng.countryCode ||\n (props.country || '').toLowerCase() === (latLng.countryCode || '').toLowerCase()\n ) {\n dispatch(actions.setCenter(latLng));\n }\n callback();\n },\n error => {\n const errorCountLimit = 5;\n dispatch(actions.onSetCenterError());\n if (state.setCenterErrorCount > errorCountLimit) {\n sendRollbarError('Error on setting geocode bias center', error);\n }\n\n if (callback) {\n // Proceed with the callback on error\n callback();\n }\n }\n );\n },\n [props.country, sendRollbarError, state.setCenterErrorCount]\n );\n\n const focus = useCallback(() => {\n const input = inputRef.current;\n if (!input) {\n return;\n }\n\n dispatch(actions.setInputValue(input.value));\n\n if (document.activeElement !== input) {\n input.focus();\n }\n\n if (WhistleOut.isiOS()) {\n window.setTimeout(() => {\n input.setSelectionRange(0, 999);\n }, 3);\n } else {\n input.select();\n }\n }, []);\n\n const onInputFocus = useCallback(() => {\n focus();\n }, [focus]);\n\n const getItemValue = useCallback((item: AutocompleteItem) => {\n return item.label;\n }, []);\n\n const onResponseError = useCallback(\n (e: GeocodeError) => {\n dispatch(actions.onError(e));\n\n console.log('onResponseError: ', e);\n\n const errorCountLimit = 3;\n if (state.errorCount >= errorCountLimit) {\n sendRollbarError('Address autocomplete search error', e);\n }\n\n if (props.onResponseError) {\n props.onResponseError(e.error);\n }\n },\n [props, sendRollbarError, state.errorCount]\n );\n\n const onEmptyResults = useCallback(\n (resultFor: string, error: string) => {\n dispatch(actions.onEmptyResults({ resultsFor: resultFor }));\n\n if (props.onEmptyResults) {\n props.onEmptyResults(error);\n }\n console.log('onEmptyResults: ', error);\n },\n [props]\n );\n\n const onSearchResponse = useCallback(\n (values: Address[], term: string, shouldSelectFirst: boolean) => {\n dispatch(\n actions.onResult({\n resultsFor: term,\n values: values\n })\n );\n\n if (!values || values.length === 0) {\n if (shouldSelectFirst) {\n onEmptyResults(term, 'Not found');\n }\n return;\n }\n\n if (shouldSelectFirst && props.onSelect) {\n console.log(`onSearchResponse -> props.onSelect: ${values[0].label}`);\n props.onSelect(values[0]);\n }\n },\n [onEmptyResults, props]\n );\n\n const doSearch = useCallback(\n (term: string, shouldSelectFirst?: boolean, initialise?: boolean) => {\n if (!initialise && !state.center) {\n setCenter(() => doSearch(term, shouldSelectFirst, true));\n return;\n }\n\n dispatch(actions.requestSearch({ shouldSelectFirst }));\n\n if (\n // Empty string\n !term ||\n term.length === 0 ||\n new RegExp('^\\\\s+$', 'i').test(term) ||\n // Min length\n term.length < (props.searchTermMinLength || 3)\n ) {\n dispatch(actions.onEmptyResults({ resultsFor: term }));\n return;\n }\n\n clearTimeout(doSearchTimeout.current);\n doSearchTimeout.current = setTimeout(\n () => {\n const args: GeocodeArgs = {\n term,\n country: props.country,\n apiKey: props.apiKey,\n proximityLatLng: state.center,\n types: props.types\n };\n\n geocodeService.doSearch(\n args,\n (results: Address[]) => onSearchResponse(results, term, shouldSelectFirst),\n onResponseError\n );\n },\n initialise ? 0 : 150\n );\n },\n [\n onResponseError,\n onSearchResponse,\n props.apiKey,\n props.country,\n props.searchTermMinLength,\n props.types,\n setCenter,\n state\n ]\n );\n\n const onChange = useCallback(\n (e: React.ChangeEvent, value: string) => {\n const term = e.currentTarget.value;\n dispatch(actions.setInputValue(term));\n\n if (props.onChange) {\n props.onChange(e, value);\n }\n\n const trim = (p: string) => (p || '').trim().toLowerCase();\n\n clearTimeout(inputDelayTimeout.current);\n if (trim(state.resultsFor) !== trim(term)) {\n inputDelayTimeout.current = window.setTimeout(() => {\n doSearch(term);\n }, props.queryDelay || 250);\n }\n },\n [doSearch, props, state]\n );\n\n const onSelect = useCallback(\n (value: string) => {\n dispatch(actions.onSelect(value));\n\n let address;\n if (!value) {\n address = null;\n } else {\n const matches = state.values.filter(p => p.label === value);\n if (!matches || matches.length === 0) {\n return;\n }\n address = matches[0];\n }\n\n if (props.onSelect) {\n props.onSelect(address);\n }\n },\n [props, state]\n );\n\n useEffect(() => {\n const ensureFirstIsSelected = () => {\n if (state.shouldSelectFirst && state.values?.length > 0) {\n const label = state.values[0].label;\n if (label !== state.value) {\n onSelect(label);\n }\n }\n };\n ensureFirstIsSelected();\n }, [onSelect, state.shouldSelectFirst, state.value, state.values]);\n\n const selectFirstSuggest = useCallback(\n (input?: string) => {\n const searchText = input || inputRef.current.value;\n if (!searchText) {\n onSelect('');\n return;\n }\n\n if (state.resultsFor?.trim().toLowerCase() === searchText.trim().toLowerCase()) {\n const values = state.values;\n if (values && values.length > 0) {\n onSelect(values[0].label);\n return;\n }\n }\n\n doSearch(searchText, true);\n },\n [doSearch, onSelect, state.resultsFor, state.values]\n );\n\n // TODO: Replace depricated keypress event\n const onKeyPress = useCallback(\n (event: KeyboardEvent) => {\n if (event.keyCode === 13) {\n window.setTimeout(() => {\n selectFirstSuggest();\n }, 350); // Use time out to prevent duplicate search call\n event.preventDefault();\n }\n },\n [selectFirstSuggest]\n );\n\n const mapAutocompleteItem = useCallback((source: Address) => {\n return {\n label: source.label,\n abbr: source.source.id,\n source: source\n } as AutocompleteItem;\n }, []);\n\n // TODO: Implement Consider using Mark.js\n // highlightTerms(element, keyword) {\n // const options = {\n // separateWordSearch: true,\n // diacritics: true\n // };\n\n // // // Determine selected options\n // // var options = {};\n // // [].forEach.call(optionInputs, function (opt) {\n // // options[opt.value] = opt.checked;\n // // });\n\n // const target = new Mark(wo$(element));\n // // Remove previous marked elements and mark\n // // the new keyword inside the context\n // target.unmark({\n // done: function () {\n // target.mark(keyword, options);\n // }\n // });\n // }\n\n const renderInput = useCallback(\n (p: React.HTMLProps) => {\n return (\n \n );\n },\n [props.inputClassName, props.inputElementId, props.inputProps, props.placeholder]\n );\n\n const renderItem = useCallback((item: AutocompleteItem, isHighlighted: boolean) => {\n const getText = (p: AddressPart) => (p ? p.shortName : '');\n const address = item.source;\n\n return (\n \n {address.unit ? {getText(address.unit)}/ : null}\n {address.streetNumber ? {getText(address.streetNumber)} : null}\n {address.streetNumber && address.street ? : null}\n {address.street ? {getText(address.street)} : null}\n {address.streetNumber || address.street ? , : null}\n \n {getText(address.city)}\n {address.city ? : null}\n {getText(address.state)} {getText(address.postcode)}\n \n \n );\n }, []);\n\n const renderMenu = useCallback((children: string[] | JSX.Element[]) => {\n return (\n // TODO: Replace inline styles with classes\n !children || children.length === 0 ? (\n
\n ) : (\n \n
    {children}
\n
\n )\n );\n }, []);\n\n useEffect(() => {\n const input = inputRef.current;\n if (!input) {\n return;\n }\n\n input.addEventListener('focus', onInputFocus);\n input.addEventListener('keypress', onKeyPress, false);\n\n // HACK: Chrome doesn't honour autocomplete=\"off\" on elements, so we set it to a random string\n // see: https://stackoverflow.com/questions/25823448/ng-form-and-autocomplete-off/39689037#39689037\n // and https://stackoverflow.com/questions/12374442/chrome-ignores-autocomplete-off#38961567\n // Updated: Setting the value to something other than 'off' disables address auto fill as long as there is no form tag around it. If there is then it will show the text based auto fill\n input.setAttribute('autocomplete', 'nope');\n\n if (props.autofocus) {\n focus();\n }\n\n // TODO\n // highlightTerms(el, state.value);\n return () => {\n input.removeEventListener('focus', onInputFocus);\n input.removeEventListener('keypress', onKeyPress);\n };\n }, [focus, onInputFocus, onKeyPress, props.autofocus]);\n\n useImperativeHandle(ref, () => ({\n focus: () => focus(),\n setValue: (value: string) => {\n inputRef.current.value = value;\n },\n doSearch: (term: string) => selectFirstSuggest(term),\n selectFirstSuggest: (term: string) => selectFirstSuggest(term)\n }));\n\n return (\n Loading...}>\n \n \n );\n});\n\nAddressAutocomplete.displayName = 'AddressAutocomplete';\nexport default AddressAutocomplete;\n","import AddressHelper from '../../utils/AddressHelper';\nimport StateNames from './StateNames';\n\nexport default class TomtomGeocodeService {\n constructor() {\n this.mapAddressItem = this.mapAddressItem.bind(this);\n this.getWeight = this.getWeight.bind(this);\n }\n\n doSearch(args, onResponse, onError) {\n if (!args) {\n onResponse([]);\n return;\n }\n\n const requestUrl = this.getRequestUrl(args);\n wo$.ajax({\n type: 'GET',\n url: requestUrl,\n success: response => {\n console.log(response);\n try {\n const items = this.mapAddressItems(response, args);\n return onResponse(items);\n }\n catch (ex) {\n // HACK: Unable to serialise exception object\n const exObj = JSON.parse(JSON.stringify(ex, Object.getOwnPropertyNames(ex)));\n exObj.stack = ex.stack;\n\n onError({\n error: `Unable to map address results. ${ex.toString()}`,\n exception: exObj\n });\n }\n },\n error: (jqXHR, textStatus, errorThrown) => onError({\n error: {\n jqXHR: jqXHR,\n textStatus: textStatus,\n errorThrown: errorThrown\n },\n requestUrl,\n args\n })\n });\n }\n\n getRequestUrl(args) {\n const requestTemplate =\n 'https://api.tomtom.com/search/2/geocode/{query}.json?' +\n 'countrySet={country}&' +\n 'key={accessToken}&' +\n 'typeahead=true&' +\n 'limit=5&' +\n 'language={language}';\n\n let url = requestTemplate.replace('{query}', this.cleanupSearchText(args.term))\n .replace('{country}', args.country)\n .replace('{language}', 'en-US')\n .replace('{accessToken}', args.apiKey);\n\n const proximity = this.getProximity(args.proximityLatLng);\n if (proximity) {\n url += `&lat=${proximity.lat}&lon=${proximity.lng}`;\n }\n\n const types = this.getTypes(args.types);\n if (types) {\n url += `&idxSet=${types}`;\n }\n\n return url;\n }\n\n // TODO: Extract to GeocodeServiceHelper\n cleanupSearchText(input) {\n const cleanedUp = input\n .substring(0, 50)\n .replace('/', ' ')\n // Remove 'unit'\n .replace(/^(unit\\s+)(.+)$/i, '$2')\n // Remove unit number including the ones with letters (i.e. '100a')\n .replace(/^(\\d+\\w*\\s+)(\\d+.+)$/i, '$2')\n ;\n\n return encodeURIComponent(cleanedUp);\n }\n\n getProximity(latLng) {\n if (!latLng) {\n return null;\n }\n\n const center = {\n lat: latLng.lat.toFixed(3),\n lng: latLng.lng.toFixed(3)\n };\n\n return center;\n }\n\n // See: https://developer.tomtom.com/online-search/online-search-documentation-geocoding/structured-geocode#TypesAbbrv\n getTypes(items) {\n return !items || items.length === 0\n ? null\n : items.join(',');\n }\n\n mapAddressItems(response, args) {\n if (!response || !args) {\n return null;\n }\n\n const results = response.results;\n if (!results || results.length === 0) {\n return null;\n }\n\n const all = results\n .map(p => this.mapAddressItem(p, args.term.split(/\\/|\\s+/)))\n // Exclude country\n .filter(p => p.label !== p.country.longName)\n .sort(this.compare);\n\n const res = [];\n for (let i = 0; i < all.length; i++) {\n const element = all[i];\n if (res.filter(p => p.label === element.label).length === 0) {\n res.push(element);\n }\n }\n\n return res;\n }\n\n mapAddressItem(source, query) {\n // See: https://developer.tomtom.com/online-search/online-search-documentation-geocoding/structured-geocode\n\n const camelise = p =>\n p.replace(/(\\w)(\\w+)/g, (g0, g1, g2) => g1.toLowerCase() + g2);\n\n const getSegment = segmentName => {\n return source.address[segmentName] ||\n source.address[camelise(segmentName)];\n };\n\n const res = {\n placeId: source.id,\n longitude: source.position.lon,\n latitude: source.position.lat,\n relevance: source.score,\n source: source\n };\n\n const streetNumber = getSegment('streetNumber');\n res.streetNumber = this.getAddressComponent(streetNumber);\n if (res.streetNumber) {\n res.unit = this.getUnitComponent(query, streetNumber);\n }\n\n res.street = this.getStreetComponent(getSegment('streetName'));\n res.city = this.getCityComponent(\n getSegment('municipalitySubdivision') ||\n getSegment('municipality') ||\n getSegment('countrySecondarySubdivision'));\n\n res.postcode = this.getPostcodeComponent(getSegment('postalCode'));\n\n const countryCode = getSegment('countryCode');\n res.state = this.getStateComponent(getSegment('countrySubdivision'), countryCode);\n res.country = this.getAddressComponent(getSegment('country'), countryCode);\n\n res.label = AddressHelper.getLabel(res);\n res.weight = this.getWeight(res, query);\n return res;\n }\n\n // TODO: Extract to GeocodeServiceHelper\n getAddressComponent(longName, shortName) {\n if (!longName && !shortName) {\n return null;\n }\n\n return {\n longName: longName,\n shortName: shortName || longName,\n };\n }\n\n // TODO: Extract to GeocodeServiceHelper\n getUnitComponent(query, streetNumber) {\n const hasDigit = p => /\\d+/.test(p);\n\n const firstNumberIndex = hasDigit(query[0]) ? 0 : 1;\n if (!hasDigit(query[firstNumberIndex + 1])) {\n // Query has only street number\n return null;\n }\n\n // Check if the unit comes second in the query\n const unit = query[firstNumberIndex] !== streetNumber\n ? query[firstNumberIndex]\n : query[firstNumberIndex + 1];\n\n return this.getAddressComponent(unit, unit);\n }\n\n // TODO: Extract to GeocodeServiceHelper\n getStreetComponent(text) {\n if (!text || text.length === 0) {\n return this.getAddressComponent(text);\n }\n\n const streetName = text.split(',')[0];\n\n return this.getAddressComponent(streetName);\n }\n\n getPostcodeComponent(text) {\n if (!text || text.length === 0) {\n return this.getAddressComponent(text);\n }\n\n const postcode = text.split(',')[0];\n\n return this.getAddressComponent(postcode);\n }\n\n getCityComponent(text) {\n if (!text || text.length === 0) {\n return this.getAddressComponent(text);\n }\n\n const cityName = text.split(',')[0];\n\n return this.getAddressComponent(cityName);\n }\n\n // TODO: Extract to GeocodeServiceHelper\n getStateComponent(text, country) {\n if (!text || text.length === 0) {\n return this.getAddressComponent(text);\n }\n\n // TomTom can return multiple states, for example 'New South Wales, Australian Capital Territory'\n const items = text.split(',');\n if (items.length === 0) {\n return this.getAddressComponent(text);\n }\n\n // The last one is more specific, so we use that\n const longName = items[items.length - 1].trim();\n const shortName = StateNames.abbreviate(longName, country);\n if (!shortName || shortName.length === 0) {\n return this.getAddressComponent(longName);\n }\n\n return this.getAddressComponent(longName, shortName);\n }\n\n // TODO: Extract to GeocodeServiceHelper\n getWeight(address, query) {\n const getAddressTypeOrder = address => {\n if (!address) {\n return 0;\n }\n\n const cleanUp = p => !p ? '' : p.toLowerCase().replace(/,|\\s/, '');\n if (cleanUp(query.join(' ')) === cleanUp(address.label)) {\n return 100;\n }\n\n return address.unit\n ? 7\n : address.streetNumber\n ? 6\n : address.street\n ? 5\n : address.city\n ? 4\n : address.postcode\n ? 3\n : address.state\n ? 2\n : 1;\n };\n\n return getAddressTypeOrder(address) + address.relevance * 10;\n }\n\n // TODO: Extract to GeocodeServiceHelper\n compare(a, b) {\n // Order by weight descending\n return a.weight < b.weight\n ? 1\n : a.weight > b.weight\n ? -1\n : 0;\n }\n}\n","import ClassNames from 'classnames';\nimport isEmpty from 'lodash/isEmpty';\nimport React from 'react';\n\ninterface Props {\n type: MessageType;\n text: string;\n}\n\nexport enum MessageType {\n Error = 'error',\n Warning = 'warning'\n}\n\nconst MessageLabel = ({ type, text }: Props) => {\n if (isEmpty(text)) {\n return null;\n }\n\n const colour = type === MessageType.Error ? 'c-brand-danger' : 'c-brand-warning';\n\n return (\n <>\n
\n
\n {text}\n
\n
\n
\n
\n {text}\n
\n
\n \n );\n};\n\nexport default MessageLabel;\n","import { createSlice, PayloadAction } from '@reduxjs/toolkit';\nimport PropTypes from 'prop-types';\nimport React, { forwardRef, useCallback, useEffect, useImperativeHandle, useReducer, useRef } from 'react';\n\nimport type { Address } from '../../../../js/@types/Address';\nimport type { GetLocationError } from '../../../../js/@types/WhistleOutContext';\nimport SearchAddressActions from '../../actions/SearchAddressActions';\nimport AddressHelper from '../../utils/AddressHelper';\nimport Popover from '../Popover';\nimport AddressAutocomplete, { AddressSearchHandle } from './AddressAutocomplete';\nimport MessageLabel, { MessageType } from './MessageLabel';\n\nexport type AddressChangedEventArgs = {\n sender: unknown;\n address: Address;\n};\n\n// TODO: Rename to event name\nexport const onAddressChangedEvent = 'AddressSearch.onAddressChanged';\n\nexport const dispatchAddressChangedEvent = (args: AddressChangedEventArgs) => {\n const event = new CustomEvent(onAddressChangedEvent, {\n detail: args\n });\n dispatchEvent(event);\n};\n\nexport interface AddressSearchProps {\n key?: string;\n ref?: React.RefObject;\n className?: string;\n inputClassName?: string;\n inputProps?: {\n 'data-address-input'?: boolean;\n 'data-address'?: boolean;\n } & React.HTMLProps;\n current: Address;\n countryCode: string;\n placeholder?: string;\n tooltipLink?: string | JSX.Element;\n tooltipDescription?: string;\n addressNotFoundMessage?: string;\n commonErrorMessage?: string;\n types: string[];\n queryDelay: number;\n apiKey: string;\n showProgress?: boolean;\n hideLabel?: boolean;\n autofocus?: boolean;\n skipGlobalUpdate?: boolean;\n onInput?: (value: string) => void;\n onChange?: (address: Address) => void;\n onEndProgress?: () => void;\n onInitialized?: (input: HTMLInputElement) => void;\n onEmptyResults?: (status: string) => void;\n onResponseError?: (error: GetLocationError) => void;\n onSearchClick?: () => void;\n onSelect?: () => void;\n onStartProgress?: () => void;\n}\n\ntype Props = React.PropsWithChildren;\n\ninterface State {\n initialLabel: string;\n selected: Address;\n addressNotFound: boolean;\n isError: boolean;\n shouldSetInputText: boolean;\n}\n\nlet counter = 0;\n\nconst { actions, reducer } = createSlice({\n name: 'address-autocomplete',\n initialState: {\n initialLabel: null,\n selected: null,\n addressNotFound: null,\n isError: false,\n shouldSetInputText: false\n } as State,\n reducers: {\n onEmptyResults: state => {\n state.selected = null;\n state.addressNotFound = true;\n state.isError = false;\n state.shouldSetInputText = false;\n },\n onInput: state => {\n state.selected = null;\n state.addressNotFound = false;\n state.isError = false;\n },\n onResponseError: state => {\n state.selected = null;\n state.addressNotFound = false;\n state.isError = true;\n state.shouldSetInputText = false;\n },\n onSetInputText: state => {\n state.shouldSetInputText = false;\n },\n setAddress: (state, action: PayloadAction
) => {\n const address = action.payload;\n if (address?.label === state.initialLabel) {\n return;\n }\n\n state.initialLabel = address?.label;\n state.selected = address;\n state.addressNotFound = !address || address?.partialMatch;\n state.isError = false;\n state.shouldSetInputText = false;\n }\n }\n});\n\nconst AddressSearch = forwardRef((props, ref) => {\n const autocompleteRef = useRef(null);\n\n const id = useRef(counter++);\n const elementId = useRef(`enterAddressLocationInput-${id.current}`);\n\n const [state, dispatch] = useReducer(reducer, {\n initialLabel: props.current?.label,\n selected: props.current,\n addressNotFound: props.current?.partialMatch,\n isError: false,\n shouldSetInputText: false\n });\n\n useEffect(() => {\n dispatch(actions.setAddress(props.current || ({} as Address)));\n }, [props]);\n\n // TODO: Rewrite this, use state.isLoading\n const endProgress = useCallback(() => {\n if (props.onEndProgress) {\n props.onEndProgress();\n }\n }, [props]);\n\n const getInputElement = useCallback(() => {\n if (typeof window === 'undefined' || !window) {\n return null;\n }\n\n return document.getElementById(elementId.current) as HTMLInputElement;\n }, []);\n\n const onInput = useCallback(\n (e: React.ChangeEvent, value: string) => {\n dispatch(actions.onInput());\n\n if (props.onInput) {\n props.onInput(value);\n }\n },\n [props]\n );\n\n const setInputText = useCallback((address: Address) => {\n dispatch(actions.onSetInputText());\n\n if (address && !address.label) {\n address.label = AddressHelper.getLabel(address);\n }\n\n const inputText = address ? address.label : null;\n autocompleteRef.current.setValue(inputText);\n }, []);\n\n const isEmpty = useCallback((address: Address) => {\n return (\n !address ||\n (!address.unit &&\n !address.streetNumber &&\n !address.street &&\n !address.city &&\n !address.postcode &&\n !address.state)\n );\n }, []);\n\n const onAddressSelect = useCallback(\n (address: Address) => {\n endProgress();\n\n if (isEmpty(address)) {\n address = null;\n }\n\n setInputText(address);\n\n if (address && AddressHelper.isEqual(state.selected, address)) {\n if (props.onSelect) {\n props.onSelect();\n }\n return;\n }\n\n console.log('onAddressSelect', address);\n\n dispatch(actions.setAddress(address));\n\n if (!props.skipGlobalUpdate) {\n SearchAddressActions.setAddressCookie(address);\n }\n\n if (props.onChange) {\n props.onChange(address);\n }\n\n if (!props.skipGlobalUpdate) {\n dispatchAddressChangedEvent({\n sender: elementId.current,\n address: address\n });\n }\n\n if (props.onSelect) {\n props.onSelect();\n }\n },\n [endProgress, isEmpty, props, setInputText, state.selected]\n );\n\n const onAddressChangedEventHandler = useCallback(\n (e: CustomEvent) => {\n if (!e.detail || e.detail.sender === elementId.current) {\n return;\n }\n\n setInputText(e.detail.address);\n\n if (AddressHelper.isEqual(state.selected, e.detail.address)) {\n return;\n }\n\n dispatch(actions.setAddress(e.detail.address));\n\n if (props.onChange) {\n props.onChange(e.detail.address);\n }\n },\n [props, setInputText, state]\n );\n\n const onEmptyResults = useCallback(\n (status: string) => {\n endProgress();\n\n console.log('onEmptyResults', status);\n dispatch(actions.onEmptyResults());\n\n // Reset Cookie\n SearchAddressActions.setAddressCookie(null);\n\n if (props.onEmptyResults) {\n props.onEmptyResults(status);\n }\n },\n [endProgress, props]\n );\n\n const onResponseError = useCallback(\n (error: GetLocationError) => {\n endProgress();\n\n console.log('onResponseError', error);\n dispatch(actions.onResponseError());\n\n // Reset Cookie\n SearchAddressActions.setAddressCookie(null);\n\n if (props.onResponseError) {\n props.onResponseError(error);\n }\n },\n [endProgress, props]\n );\n\n useEffect(() => {\n addEventListener(onAddressChangedEvent, onAddressChangedEventHandler);\n\n if (props.onInitialized) {\n const input = getInputElement();\n props.onInitialized(input);\n }\n\n return () => {\n removeEventListener(onAddressChangedEvent, onAddressChangedEventHandler);\n };\n }, [getInputElement, onAddressChangedEventHandler, props]);\n\n useImperativeHandle(ref, () => ({\n focus: autocompleteRef.current.focus,\n setValue: autocompleteRef.current.setValue,\n doSearch: autocompleteRef.current.doSearch,\n selectFirstSuggest: autocompleteRef.current.selectFirstSuggest\n }));\n\n const label = (state.selected || {}).label;\n return (\n \n \n
\n {\n //\n !props.hideLabel ? (\n \n ) : null\n }\n \n {props.children}\n
\n {props.tooltipLink ? (\n \n ) : null}\n {state.addressNotFound ? (\n \n ) : null}\n {state.isError ? : null}\n
\n
\n );\n});\n\nAddressSearch.displayName = 'AddressSearch';\n\n/* eslint-disable import/no-named-as-default-member */\nAddressSearch.propTypes = {\n countryCode: PropTypes.string,\n types: PropTypes.arrayOf(PropTypes.string),\n placeholder: PropTypes.string,\n queryDelay: PropTypes.number,\n autofocus: PropTypes.bool,\n hideLabel: PropTypes.bool,\n addressNotFoundMessage: PropTypes.string,\n commonErrorMessage: PropTypes.string,\n showProgress: PropTypes.bool\n};\n/* eslint-enable */\n\nAddressSearch.defaultProps = {\n types: ['geocode'],\n placeholder: 'Enter Street Address',\n addressNotFoundMessage: 'Address not found',\n commonErrorMessage: 'Unable to verify the address',\n queryDelay: 350,\n autofocus: false,\n showProgress: true\n};\n\nexport default AddressSearch;\n"],"names":["onAddressCookieInit","address","dispatch","actions","JSON","parse","SearchAddressActions","setAddressCookie","value","window","wo$","Cookies","set","path","expires","newValue","stringify","placeId","label","latitude","longitude","unit","streetNumber","street","city","state","postcode","types","partialMatch","current","get","invalidateAddressCookie","currentValue","AddressHelper","isEqual","a","b","cleanUpFormattedAddress","str","components","parts","split","length","country","res","substring","indexOf","locationName","long_name","short_name","map","gmaps","appCountry","place_id","location","lat","geometry","lng","this","getAddressComponentDictionary","address_components","mapAddressComponent","partial_match","colloquial","FixGMapsComponents","getLabel","isOtherState","shortName","longName","toUpperCase","getCountryLongName","FixForJbt","getComponentValue","isNullOrWhiteSpace","p","trim","appendWithSpaceIfNeeded","component","preferShorter","handleCountryName","countryName","formatted_address","name","toLowerCase","removeUnitName","formattedAddress","regex","RegExp","replace","getAddressComponentType","addressComponents","forEach","item","type","isSameState","expectedTerms","actual","some","term","expected","isEqualCountry","countryCode","gmapsCountryCodes","getGmapsCountryCodes","gmapsCountryCode","isCountry","addressCountry","addressCountryUpper","props","ref","useRef","handleMount","useCallback","container","WhistleOut","applyPopover","useEffect","className","title","content","placement","StateNames","constructor","abbreviate","bind","countryStates","_states","filter","match","getMatch","states","i","items","reducer","initialState","values","center","errorCount","setCenterErrorCount","reducers","onError","action","error","payload","textStatus","onEmptyResults","resultsFor","onSelect","shouldSelectFirst","onSetCenterError","onResult","processError","requestSearch","setCenter","setInputValue","geocodeService","mapAddressItem","getWeight","doSearch","args","onResponse","requestUrl","getRequestUrl","ajax","url","success","response","mapAddressItems","ex","exObj","Object","getOwnPropertyNames","stack","toString","exception","jqXHR","errorThrown","cleanupSearchText","apiKey","proximity","getProximity","proximityLatLng","getTypes","input","cleanedUp","encodeURIComponent","latLng","toFixed","join","results","all","sort","compare","element","push","source","query","getSegment","segmentName","g0","g1","g2","id","position","lon","relevance","score","getAddressComponent","getUnitComponent","getStreetComponent","getCityComponent","getPostcodeComponent","getStateComponent","weight","hasDigit","test","firstNumberIndex","text","streetName","cityName","cleanUp","getAddressTypeOrder","ReactAutocomplete","lazy","AddressAutocomplete","forwardRef","inputRef","autocompleteRef","refs","useReducer","inputDelayTimeout","doSearchTimeout","sendRollbarError","data","rollbar","errorDetails","callback","getCurrentLatLng","focus","document","activeElement","isiOS","setTimeout","setSelectionRange","select","onInputFocus","getItemValue","onResponseError","e","resultFor","onSearchResponse","initialise","searchTermMinLength","clearTimeout","onChange","currentTarget","queryDelay","matches","ensureFirstIsSelected","selectFirstSuggest","searchText","onKeyPress","event","keyCode","preventDefault","mapAutocompleteItem","abbr","renderInput","inputProps","inputElementId","inputClassName","placeholder","style","display","renderItem","isHighlighted","getText","backgroundColor","renderMenu","children","width","top","offsetHeight","zIndex","cursor","addEventListener","setAttribute","autofocus","removeEventListener","useImperativeHandle","setValue","Suspense","fallback","wrapperProps","wrapperStyle","displayName","MessageType","colour","Error","onAddressChangedEvent","dispatchAddressChangedEvent","CustomEvent","detail","dispatchEvent","counter","initialLabel","selected","addressNotFound","isError","shouldSetInputText","onInput","onSetInputText","setAddress","AddressSearch","elementId","endProgress","onEndProgress","getInputElement","getElementById","setInputText","inputText","isEmpty","onAddressSelect","skipGlobalUpdate","sender","onAddressChangedEventHandler","status","onInitialized","hideLabel","htmlFor","tooltipLink","linkClassName","tooltipDescription","Warning","addressNotFoundMessage","commonErrorMessage","propTypes","showProgress","defaultProps"],"sourceRoot":""}