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CpKf8D,EAAAC,OAAA,EAAkB","sources":["webpack://_N_E/../../packages/ui/hooks/usePredictiveSearch.ts","webpack://_N_E/../../packages/ui/js/utils/validators.ts","webpack://_N_E/./src/components/core/ServiceCheckForm/ServiceCheckSingleLine.tsx","webpack://_N_E/./src/components/core/ServiceCheckForm/styles/ServiceCheckSingleLine.module.css","webpack://_N_E/"],"sourcesContent":["// @ts-nocheck\n/**\n * @module Predictive Search API\n * @description Our zipcode / address API\n */\nimport { useContext } from 'react';\nimport { useGoogleReCaptcha } from 'react-google-recaptcha-v3';\nimport DOMPurify from 'isomorphic-dompurify';\nimport Cookies from 'js-cookie';\nimport merge from 'lodash-es/merge';\n\nimport { Address } from '~/types/address';\n\nimport { CartContext } from 'ui/providers/cart';\nimport { onlySpaces } from 'ui/js/utils/filters';\nimport { trackEvent } from 'ui/js/helpers/tracking';\nimport { addPageAction } from 'ui/js/utils/new-relic';\n\n/**\n * @function usePredictiveSearch\n * @description\n */\nexport const usePredictiveSearch = ( refs, setSuggestions, formContext ) => {\n const { apiUrl, clickThrough, throttleTime } = useContext( CartContext );\n\n /**\n * @function buildAddress\n * @description Build the address\n */\n const buildAddress = ( suggestion ) => {\n let whiteSpace = ' ';\n if ( suggestion.secondary ) {\n if ( suggestion.entries > 1 ) {\n suggestion.secondary += ` (${ suggestion.entries } entries)`;\n }\n whiteSpace = ' ';\n }\n return `${ suggestion.addressLine1 }${ whiteSpace }${ suggestion.addressLine2 } ${ suggestion.city }, ${ suggestion.stateProvince } ${ suggestion.zipCode }`;\n };\n\n /**\n * @function handleInput\n * @description track our events\n */\n const handleInput = ( event ) => {\n const { target } = event;\n const { fieldName, fieldType, fieldValue } = JSON.parse( target.getAttribute( 'data-payload' ) );\n\n const data = {\n formContext,\n fieldName,\n fieldType,\n fieldValue\n };\n\n // need to wait for formstarted to run\n setTimeout( () => {\n trackEvent( { action: 'fieldInputted', data, event } );\n }, 100 );\n };\n\n /**\n * @function handleKeyDown\n * @description Handle a keydown event\n */\n const handleKeyDownEvent = ( event ) => {\n // handle escape key\n if ( event.key === 'Escape' ) {\n setSuggestions( [ ] );\n return refs.addressField.current.removeEventListener( 'keydown', handleKeyDownEvent );\n }\n };\n\n /**\n * @function handleClickEvent\n * @description Handle a keydown event\n */\n const handleClickEvent = ( event ) => {\n const { target } = event;\n\n if ( target.hasAttribute( 'data-address' ) ) {\n return;\n }\n\n setSuggestions( [ ] );\n };\n\n /**\n * @function fetchAddressSuggestions\n * @description Fetch the address\n */\n const fetchAddressSuggestions = async ( value: string, selected ) => {\n if ( ! value || onlySpaces( value ) ) {\n return;\n }\n\n const url = new URL( `${ apiUrl }/predictive` );\n const params = url.searchParams;\n\n params.set( 'inFootPrint', 'false' );\n params.set( 'serviceAddressRecord', 'false' );\n params.set( 'excludeChildren', 'false' );\n\n if ( selected !== '' ) {\n params.set( 'selected', selected );\n } else if ( params.has( 'selected' ) ) {\n params.delete( 'selected' );\n }\n\n params.set( 'address', value );\n\n const addresses = await fetch( url )\n .then( ( res ) => res.json() )\n .then( ( data ) => {\n if ( ! data ) {\n return [];\n }\n\n const suggestions: Address[] = [];\n\n if ( ! data.length ) {\n return suggestions;\n }\n\n if ( data === null || typeof data === 'undefined' ) {\n suggestions.push( { } );\n return suggestions;\n }\n\n Object.values( data ).forEach( ( suggestion ) => {\n const address = {\n value: buildAddress( suggestion ),\n addressKey: suggestion.addressKey,\n addressLine1: suggestion.addressLine1,\n addressLine2: suggestion.addressLine2,\n city: suggestion.city,\n stateProvince: suggestion.stateProvince,\n zipCode: suggestion.zipCode,\n zipCode4: suggestion.zipCode4,\n latitude: suggestion.latitude,\n longitude: suggestion.longitude,\n parsedAddress: suggestion.parsedAddress\n };\n\n suggestions.push( address );\n } );\n\n return suggestions;\n } );\n\n return addresses;\n };\n\n /**\n * @function addressAsciiSanitization\n * @description Remove non-ascii characters and replace special characters with their regular counterpart\n */\n const addressAsciiSanitization = ( address ) => address.normalize( 'NFD' ).replace( /([\\u0300-\\u036f]|[^0-9a-zA-Z\\s])/g, '' );\n\n /**\n * @function fetchAddress\n * @description Fetch our address suggestions\n */\n const fetchAddress = async ( event ) => {\n const { target } = event;\n const { value } = target;\n\n handleInput( event );\n\n if ( ! value || value.length < 3 ) {\n setSuggestions( [ ] );\n return;\n }\n\n const suggestionValues = await fetchAddressSuggestions( addressAsciiSanitization( DOMPurify.sanitize( value ) ), '' );\n\n setSuggestions( suggestionValues || [ ] );\n\n // register keydown listeners once address suggestions populate\n refs.addressField.current.addEventListener( 'keydown', handleKeyDownEvent );\n document.addEventListener( 'click', handleClickEvent );\n };\n\n /**\n * @function setSuggestionValue\n * @description Set suggestion value on address and zip\n */\n const setSuggestionValue = async ( event ) => {\n const { target } = event;\n\n const address = target.getAttribute( 'data-address' );\n const zip = target.getAttribute( 'data-zip' );\n const addressData = JSON.parse( target.getAttribute( 'data-object' ) );\n\n if ( address.includes( 'entries' ) ) {\n const value = address.replace( ' entries', '' );\n const suggestionValues = await fetchAddressSuggestions( address, value );\n\n return setSuggestions( suggestionValues );\n }\n\n refs.addressField.current.value = address.replace( ` ${ zip }`, '' );\n\n if ( refs.zipField ) {\n refs.zipField.current.value = zip;\n\n const { fieldName, fieldType, fieldValue } = JSON.parse( refs.zipField.current.getAttribute( 'data-payload' ) );\n\n const data = {\n formContext,\n fieldName,\n fieldType,\n fieldValue,\n autofilled: true\n };\n trackEvent( { action: 'fieldInputted', data, event } );\n }\n\n setSuggestions( [ ] );\n\n return { address, zip, addressData };\n };\n\n // ReCaptcha\n const { executeRecaptcha } = useGoogleReCaptcha();\n\n /**\n * @function handleSubmit\n * @description Handle submission of form\n */\n const handleSubmit = async ( event ) => {\n event.preventDefault();\n\n if ( refs.honeyPotField.current.value !== '' ) {\n return;\n }\n\n const token = await executeRecaptcha();\n const currentCookieString = Cookies.get('frontierSiteDetailPredictive');\n const currentCookie = currentCookieString ? JSON.parse(currentCookieString) : {};\n\n const addressObject = JSON.parse( event.target.getAttribute( 'data-address-object' ) );\n const userData = {\n address: {\n value: addressObject.value,\n addressKey: addressObject.addressKey,\n addressLine1: addressObject.addressLine1,\n addressLine2: addressObject.addressLine2,\n city: addressObject.city,\n stateProvince: addressObject.stateProvince,\n zipCode: addressObject.zipCode,\n zipCode4: addressObject.zipCode4,\n latitude: addressObject.latitude,\n longitude: addressObject.longitude,\n parsedAddress: addressObject.parsedAddress\n },\n plansDrop: true, // TODO: what do these do?\n showCTA: true, // TODO: what do these do?\n token,\n formUrl: encodeURI(window.location.href), // The URL the form was submitted on\n referringUrl: encodeURI(document.referrer),\n };\n\n trackEvent( { action: 'formSubmitted', data: formContext, event } );\n addPageAction( 'cartEntrance', { method: 'ADDRESS FORM' } );\n\n // Set our cookie\n const newCookieData = merge(currentCookie, userData);\n const cookieDomain = process.env.environment === 'production' ? 'frontier.com' : undefined;\n Cookies.set('frontierSiteDetailPredictive', JSON.stringify(newCookieData), { expires: 1, path: '/', domain: cookieDomain });\n\n // Redirect to the cart\n setTimeout( () => {\n window.location.href = clickThrough;\n }, 100 );\n };\n\n return {\n fetchAddress, fetchAddressSuggestions, handleInput, executeRecaptcha, handleSubmit, handleClickEvent, handleKeyDownEvent, setSuggestionValue, throttleTime\n };\n};\n\nexport default usePredictiveSearch;\n","/**\n * @module Validators\n * @description Some handy validators\n */\n\n/**\n * @function isValidZipInput\n * @description Check for zip 5 and numeric input, Does not allow for Zip9\n * @param { number } value zip input\n */\nexport const isValidZipInput = ( value: string ) => value.length === 5 && ! Number.isNaN( value );\n\n/**\n * @function isValidAddressInput\n * @description Check if address contains street name and suffix (street, avenue, etc)\n * Number is optional i.e. 7th Street & 123 7th Street are both acceptable\n * @param { string } value address input\n */\nexport const isValidAddressInput = ( value: string ) => {\n const regex = /^(?:(\\d+\\s))?[A-z0-9]+\\s[A-z]+/;\n\n if ( ! value ) {\n return false;\n }\n\n return regex.test( value );\n};\n\n/**\n * @function standardRegex\n * @description\n * Regex strings\n * Base: letter, number, & backspace\n * Name: letter, space, & backspace\n * Email: letter, number, @, period(.), & backspace\n * Date: number only\n * Address: letter, number, space, period(.), and backspace\n */\nexport const standardRegex = {\n base: /^[a-zA-Z0-9\\b]/,\n name: /[a-zA-Z\\s\\b]/,\n email: /[a-zA-Z0-9@.\\b]/,\n date: /[0-9]/,\n address: /^[a-zA-Z0-9\\s.\\b]/\n};\n","/**\n * @module ServiceCheckForm\n * @description\n */\nimport React, { FC, MouseEvent, FormEvent } from 'react';\nimport { useState, useRef, useEffect } from 'react';\nimport debounce from 'lodash/debounce';\nimport { usePredictiveSearch } from 'ui/hooks/usePredictiveSearch';\nimport { isValidAddressInput } from 'ui/js/utils/validators';\nimport { stringify } from 'ui/js/utils/filters';\nimport { trackEvent } from 'ui/js/helpers/tracking';\nimport state from 'ui/js/config/state';\nimport { Address } from '~/types/address';\nimport { v4 as uuidv4 } from 'uuid';\nimport styles from './styles/ServiceCheckSingleLine.module.css';\n\nconst formContext = {\n formType: 'SERVICE CHECK - SINGLE LINE',\n formName: 'SERVICE CHECK - SINGLE LINE'\n};\n\ninterface Props {\n isDark?: boolean;\n isHero?: boolean;\n}\n\nconst ServiceCheckSingleLine: FC = ( { ...props } ) => {\n const {\n isDark,\n isHero\n } = props;\n\n const [ addressValid, setAddressValid ] = useState( false );\n const [ addressError, setAddressError ] = useState( false );\n const [ suggestions, setSuggestions ] = useState( [ ] );\n const [ addressObject, setAddressObject ] = useState( { } );\n const [ formStarted, setFormStarted ] = useState( false );\n const [ addressKey, setAddressKey ] = useState( false );\n const [ placeholderText, setPlaceholderText ] = useState( 'Enter your address.' );\n const id = uuidv4();\n\n const addressField = useRef( null );\n const honeyPotField = useRef( null );\n\n const predictive = usePredictiveSearch( { addressField, honeyPotField }, setSuggestions, formContext );\n\n const setSuggestionValue = async ( event:MouseEvent ) => {\n const { address, addressData } = await predictive.setSuggestionValue( event );\n\n setAddressValid( isValidAddressInput( address ) );\n setAddressError( ! isValidAddressInput( address ) );\n setAddressObject( addressData );\n setAddressKey( true );\n };\n\n const fetchAddress = async ( event: FormEvent ) => {\n if ( ! formStarted ) {\n trackEvent( { action: 'formStarted', data: formContext } );\n setFormStarted( true );\n }\n\n predictive.fetchAddress( event );\n };\n\n const handleResize = () => {\n if ( ! state.is_mobile && ! isHero ) {\n return setPlaceholderText( 'Enter your address to view plans in your area.' );\n }\n\n if( state.is_hd && isHero ) {\n return setPlaceholderText( 'Enter your address to view plans in your area.' );\n }\n\n setPlaceholderText( 'Enter your address.' );\n };\n\n useEffect( () => {\n handleResize();\n document.addEventListener( 'redventures/resize_executed', handleResize );\n }, [] );\n\n return (\n
\n
\n \n
\n \n \n Invalid Address\n
0 ? styles.suggestionsActive : '' }` }>\n { suggestions && suggestions.length > 0 &&\n <>\n
    \n { suggestions.map( ( suggestion: Address, index ) => (\n
  • \n \n { suggestion.value }\n \n
  • \n ) ) }\n
\n
\n setSuggestions( [ ] ) }\n >Close address suggestions\n
\n \n }\n
{ /* */ }\n
{ /* */ }\n\n
\n \n \n
{ /* */ }\n\n \n Check availability\n \n \n
\n );\n};\n\nServiceCheckSingleLine.displayName = 'ServiceCheckSingleLine';\n\nexport default ServiceCheckSingleLine;\n","// extracted by mini-css-extract-plugin\nmodule.exports = {\"u-color-white\":\"ServiceCheckSingleLine_u-color-white__9ZcZ_\",\"u-color-midnight\":\"ServiceCheckSingleLine_u-color-midnight__qPKSx\",\"u-color-blue\":\"ServiceCheckSingleLine_u-color-blue__7_f4g\",\"u-color-red\":\"ServiceCheckSingleLine_u-color-red__j8M_K\",\"u-text-bold\":\"ServiceCheckSingleLine_u-text-bold__0RCGU\",\"u-textdecoration-color-white\":\"ServiceCheckSingleLine_u-textdecoration-color-white__P_SLK\",\"u-textdecoration-color-midnight\":\"ServiceCheckSingleLine_u-textdecoration-color-midnight__8UMFh\",\"u-textdecoration-color-blue\":\"ServiceCheckSingleLine_u-textdecoration-color-blue__h0zZc\",\"u-textdecoration-color-red\":\"ServiceCheckSingleLine_u-textdecoration-color-red__6hKKp\",\"u-theme-white\":\"ServiceCheckSingleLine_u-theme-white__2c6jm\",\"u-theme-light\":\"ServiceCheckSingleLine_u-theme-light__V_ygB\",\"u-theme-black\":\"ServiceCheckSingleLine_u-theme-black__Zkg7w\",\"u-theme-dark\":\"ServiceCheckSingleLine_u-theme-dark__T5xho\",\"u-theme-light-blue\":\"ServiceCheckSingleLine_u-theme-light-blue__XXGgq\",\"u-theme-blue\":\"ServiceCheckSingleLine_u-theme-blue__3arHB\",\"u-theme-red\":\"ServiceCheckSingleLine_u-theme-red__ZVeLu\",\"u-theme-holiday\":\"ServiceCheckSingleLine_u-theme-holiday__fGmhN\",\"u-theme-neutral-light\":\"ServiceCheckSingleLine_u-theme-neutral-light__4u7po\",\"hide-for-small-only\":\"ServiceCheckSingleLine_hide-for-small-only__ASyNW\",\"show-for-small-only\":\"ServiceCheckSingleLine_show-for-small-only__tku_h\",\"hide-for-medium\":\"ServiceCheckSingleLine_hide-for-medium__t3AKB\",\"show-for-medium\":\"ServiceCheckSingleLine_show-for-medium__RH00G\",\"hide-for-medium-only\":\"ServiceCheckSingleLine_hide-for-medium-only__zRYGa\",\"show-for-medium-only\":\"ServiceCheckSingleLine_show-for-medium-only__IiD24\",\"hide-for-large\":\"ServiceCheckSingleLine_hide-for-large__HtAHz\",\"show-for-large\":\"ServiceCheckSingleLine_show-for-large___Kv4i\",\"hide-for-large-only\":\"ServiceCheckSingleLine_hide-for-large-only__RaQVk\",\"show-for-large-only\":\"ServiceCheckSingleLine_show-for-large-only__8zpvm\",\"form\":\"ServiceCheckSingleLine_form__jd_ku\",\"formField\":\"ServiceCheckSingleLine_formField__2kO7Y\",\"suggestions\":\"ServiceCheckSingleLine_suggestions__YnsHl\",\"suggestionsActive\":\"ServiceCheckSingleLine_suggestionsActive__a3UJa\",\"suggestionsList\":\"ServiceCheckSingleLine_suggestionsList__gdrGX\",\"manual\":\"ServiceCheckSingleLine_manual__hSban\",\"component\":\"ServiceCheckSingleLine_component__vsJ0p\",\"component__isDark\":\"ServiceCheckSingleLine_component__isDark__XP8r1\",\"component__isHero\":\"ServiceCheckSingleLine_component__isHero__f3UWD\",\"icon\":\"ServiceCheckSingleLine_icon__hex5N\",\"isDark\":\"ServiceCheckSingleLine_isDark__AroPu\"};"],"names":["usePredictiveSearch","refs","setSuggestions","formContext","apiUrl","clickThrough","throttleTime","useContext","CartContext","buildAddress","whiteSpace","suggestion","secondary","entries","concat","addressLine1","addressLine2","city","stateProvince","zipCode","handleInput","target","event","fieldName","fieldType","fieldValue","JSON","parse","getAttribute","data","setTimeout","trackEvent","action","handleKeyDownEvent","key","addressField","current","removeEventListener","handleClickEvent","hasAttribute","fetchAddressSuggestions","value","selected","onlySpaces","url","URL","params","searchParams","set","has","delete","addresses","fetch","then","res","json","suggestions","length","push","Object","values","forEach","address","addressKey","zipCode4","latitude","longitude","parsedAddress","addressAsciiSanitization","normalize","replace","fetchAddress","suggestionValues","DOMPurify","addEventListener","document","setSuggestionValue","zip","addressData","includes","zipField","autofilled","executeRecaptcha","useGoogleReCaptcha","handleSubmit","preventDefault","honeyPotField","token","currentCookieString","Cookies","currentCookie","addressObject","userData","plansDrop","showCTA","formUrl","encodeURI","window","location","href","referringUrl","referrer","addPageAction","method","newCookieData","merge","stringify","expires","path","domain","undefined","isValidAddressInput","regex","test","formType","formName","ServiceCheckSingleLine","props","param","isDark","isHero","addressValid","setAddressValid","useState","addressError","setAddressError","setAddressObject","formStarted","setFormStarted","setAddressKey","placeholderText","setPlaceholderText","id","uuidv4","useRef","predictive","handleResize","state","useEffect","jsx_runtime","jsx","div","className","styles","jsxs","form","name","autoComplete","onSubmit","data-address-object","data-cypress","span","label","htmlFor","input","ref","type","data-test-id","onInput","debounce","placeholder","data-payload","Fragment","ul","map","index","li","button","role","data-address","data-zip","data-object","onClick","data-hidden-input","disabled","aria-disabled","displayName","ServiceCheckForm_ServiceCheckSingleLine","module","exports"],"sourceRoot":""}