(null)\n\n const values = watch()\n\n const isUSCitizen = values.citizenshipCountry === 'US'\n const isUSBorn = values.birthCountry === 'US'\n const needsSubDivision = countriesWithSubdivisions.includes(\n birthCountry || ''\n )\n\n useEffect(() => {\n scrollToRef(alertRef)\n }, [errors.nonImmigrantVisaStatus])\n\n useEffect(() => {\n if (!!citizenshipCountry && citizenshipCountry !== 'US') {\n register('nonImmigrantVisaStatus')\n } else {\n unregister('nonImmigrantVisaStatus')\n }\n }, [citizenshipCountry, register, unregister])\n\n const getPhotoIdListADropdownData = () => {\n return isUSCitizen\n ? optionData?.photoId?.citizen.filter((option: DropdownOption) =>\n citizenSupportingDocumentNotRequired.includes(option.value)\n )\n : optionData?.photoId?.nonCitizen.filter((option: DropdownOption) =>\n nonCitizenSupportingDocumentNotRequired.includes(option.value)\n )\n }\n\n const getPhotoIdListBDropdownData = () => {\n return isUSCitizen\n ? optionData?.photoId?.citizen.filter(\n (option: DropdownOption) =>\n !citizenSupportingDocumentNotRequired.includes(option.value)\n )\n : optionData?.photoId?.nonCitizen.filter(\n (option: DropdownOption) =>\n !nonCitizenSupportingDocumentNotRequired.includes(option.value)\n )\n }\n\n const hideDocumentDropdown =\n !values.photoId ||\n (isUSCitizen &&\n citizenSupportingDocumentNotRequired.includes(values.photoId)) ||\n (!isUSCitizen &&\n nonCitizenSupportingDocumentNotRequired.includes(values.photoId))\n\n const getDocumentDropdownData = () => {\n if (!values.photoId) return []\n if (isLoadingOptionData) return []\n if (isUSCitizen && isUSBorn) {\n return optionData.document.citizenUSBorn\n }\n if (isUSCitizen && !isUSBorn) {\n return optionData.document.citizenNonUSBorn\n }\n return []\n }\n\n useEffect(() => {\n if (hideDocumentDropdown) {\n unregister('document')\n unregister('namesOnDocumentsMatch')\n }\n }, [hideDocumentDropdown, unregister])\n\n const onSubmit = async (formData: DocumentCheckValues) => {\n clearErrors('global')\n setIsLoading(true)\n const xCLEARCorrelationInfo = getXCLEARCorrelationInfo()\n const baseMetaData = {\n kpi: KPI.USER_INTERACTION,\n xCLEARCorrelationInfo,\n url: router.route,\n }\n try {\n const preDocumentCheckStep = {\n ...copyAndRemoveEmptyEntries(formData),\n namesOnDocumentsMatch:\n formData.namesOnDocumentsMatch !== undefined\n ? formData.namesOnDocumentsMatch\n : undefined,\n }\n await client.reportCitizenship({\n xCLEARCorrelationInfo,\n enrollmentId: state.id,\n preCitizenshipStep: {\n birthCountry: formData.birthCountry,\n birthLocality: formData.birthLocality,\n birthSubdivision: formData.birthSubdivision,\n citizenshipCountry: formData.citizenshipCountry,\n nonImmigrantVisaStatus: formData.nonImmigrantVisaStatus,\n },\n })\n\n dispatchCustomEvent(Enrollment.LogEntryLevelEnum.INFO, {\n payload: {\n message: 'Submit document check begin',\n },\n metadata: {\n ...baseMetaData,\n event: DiscreteEvent.DOCUMENT_CHECK_SUBMIT_BEGIN,\n },\n })\n const response = await client.chooseDocuments({\n xCLEARCorrelationInfo,\n enrollmentId: state.id,\n preDocumentCheckStep,\n })\n updateState(response)\n\n router.push('/enroll/you')\n } catch (error) {\n dispatchCustomEvent(Enrollment.LogEntryLevelEnum.ERROR, {\n payload: {\n message: error?.message,\n stack: error?.stack,\n },\n metadata: {\n event: DiscreteEvent.DOCUMENT_CHECK_SUBMIT_FAILURE,\n ...baseMetaData,\n },\n })\n if (error.status === 401) {\n sessionTimeoutHandler()\n }\n setFormErrors(await extractErrors(error, formData), setError)\n }\n setIsLoading(false)\n }\n\n useEffect(() => {\n if (values.document === 'BC') {\n setShowModal(true)\n }\n }, [values.document])\n\n const modalBody = (\n <>\n Has all required fields:
\n \n - Name, date of birth, place of birth
\n - Issuing city, county, or state
\n - Date filed with registrar's office
\n - Parents' names field
\n - \n Signature of the city, county, or state official registrar (not a\n church or religious entity)\n
\n
\n \n First and last name match the Photo ID EXACTLY. If names are not an\n exact match, you MUST include a name-linking document\n
\n Is NOT:
\n \n - Birth document titled \"Registration\" or \"Notification\"
\n - Private hospital-issued document (even with a seal)
\n - Foreign birth document
\n - \"No Record Certification of Birth\" document
\n - Puerto Rico birth certificate issued before July 1, 2010
\n - Illegible due to wear/tear/damage/scan quality
\n - A photocopy
\n
\n \n )\n const label = (\n \n Required Documentation\n
\n \n Please choose one of the documents from List A. If you do not have a\n document from List A, select a document from List B.\n \n
\n )\n\n const handleSelect = (value: string, list: 'A' | 'B') => {\n if (value === '') {\n setIsListADisabled(false)\n setIsListBDisabled(false)\n setValue('photoId', value)\n trigger('photoId')\n return\n }\n if (list === 'A') {\n setIsListBDisabled(true)\n setIsListADisabled(false)\n } else {\n setIsListBDisabled(false)\n setIsListADisabled(true)\n }\n setValue('photoId', value)\n trigger('photoId')\n }\n return (\n \n \n Citizenship and Required Documentation\n \n {errors.nonImmigrantVisaStatus && (\n \n \n \n )}\n\n \n )\n}\n\nexport default DocumentCheckPage\n","import { getXCLEARCorrelationInfo } from '@api/utils'\n\nexport const baseLookup = async (\n key: string\n): Promise<{ label: string; value: any }[]> => {\n const response = await fetch(\n `${process.env.NEXT_PUBLIC_LOOKUP_API_ENDPOINT}/lookup?categories=${key}`,\n {\n headers: {\n 'X-CLEAR-CorrelationInfo': getXCLEARCorrelationInfo(),\n },\n }\n )\n\n const data = await response.json()\n\n return data[0].values.map((x: any) => ({\n label: x.text,\n value: x.key,\n }))\n}\n","import { baseLookup } from './lookupClient'\nexport interface CountryOption {\n value: string\n label: string\n}\n\nconst getCountries = () => baseLookup('countries')\n\nexport default getCountries\n","const US = [\n {\n text: 'Alabama',\n key: 'AL',\n },\n {\n text: 'Alaska',\n key: 'AK',\n },\n {\n text: 'American Samoa',\n key: 'AS',\n },\n {\n text: 'Arizona',\n key: 'AZ',\n },\n {\n text: 'Arkansas',\n key: 'AR',\n },\n {\n text: 'California',\n key: 'CA',\n },\n {\n text: 'Colorado',\n key: 'CO',\n },\n {\n text: 'Connecticut',\n key: 'CT',\n },\n {\n text: 'Delaware',\n key: 'DE',\n },\n {\n text: 'District Of Columbia',\n key: 'DC',\n },\n {\n text: 'Florida',\n key: 'FL',\n },\n {\n text: 'Georgia',\n key: 'GA',\n },\n {\n text: 'Guam',\n key: 'GU',\n },\n {\n text: 'Hawaii',\n key: 'HI',\n },\n {\n text: 'Idaho',\n key: 'ID',\n },\n {\n text: 'Illinois',\n key: 'IL',\n },\n {\n text: 'Indiana',\n key: 'IN',\n },\n {\n text: 'Iowa',\n key: 'IA',\n },\n {\n text: 'Kansas',\n key: 'KS',\n },\n {\n text: 'Kentucky',\n key: 'KY',\n },\n {\n text: 'Louisiana',\n key: 'LA',\n },\n {\n text: 'Maine',\n key: 'ME',\n },\n {\n text: 'Marshall Islands',\n key: 'MH',\n },\n {\n text: 'Maryland',\n key: 'MD',\n },\n {\n text: 'Massachusetts',\n key: 'MA',\n },\n {\n text: 'Michigan',\n key: 'MI',\n },\n {\n text: 'Minnesota',\n key: 'MN',\n },\n {\n text: 'Mississippi',\n key: 'MS',\n },\n {\n text: 'Missouri',\n key: 'MO',\n },\n {\n text: 'Montana',\n key: 'MT',\n },\n {\n text: 'Nebraska',\n key: 'NE',\n },\n {\n text: 'Nevada',\n key: 'NV',\n },\n {\n text: 'New Hampshire',\n key: 'NH',\n },\n {\n text: 'New Jersey',\n key: 'NJ',\n },\n {\n text: 'New Mexico',\n key: 'NM',\n },\n {\n text: 'New York',\n key: 'NY',\n },\n {\n text: 'North Carolina',\n key: 'NC',\n },\n {\n text: 'North Dakota',\n key: 'ND',\n },\n {\n text: 'Northern Mariana Islands',\n key: 'MP',\n },\n {\n text: 'Ohio',\n key: 'OH',\n },\n {\n text: 'Oklahoma',\n key: 'OK',\n },\n {\n text: 'Oregon',\n key: 'OR',\n },\n {\n text: 'Pennsylvania',\n key: 'PA',\n },\n {\n text: 'Puerto Rico',\n key: 'PR',\n },\n {\n text: 'Rhode Island',\n key: 'RI',\n },\n {\n text: 'South Carolina',\n key: 'SC',\n },\n {\n text: 'South Dakota',\n key: 'SD',\n },\n {\n text: 'Tennessee',\n key: 'TN',\n },\n {\n text: 'Texas',\n key: 'TX',\n },\n {\n text: 'Utah',\n key: 'UT',\n },\n {\n text: 'Vermont',\n key: 'VT',\n },\n {\n text: 'US Virgin Islands',\n key: 'VI',\n },\n {\n text: 'Virginia',\n key: 'VA',\n },\n {\n text: 'Washington',\n key: 'WA',\n },\n {\n text: 'West Virginia',\n key: 'WV',\n },\n {\n text: 'Wisconsin',\n key: 'WI',\n },\n {\n text: 'Wyoming',\n key: 'WY',\n },\n]\n\nconst MX = [\n {\n key: 'AG',\n text: 'Aguascalientes',\n },\n {\n key: 'BC',\n text: 'Baja California',\n },\n {\n key: 'BS',\n text: 'Baja California Sur',\n },\n {\n key: 'CH',\n text: 'Chihuahua',\n },\n {\n key: 'CL',\n text: 'Colima',\n },\n {\n key: 'CM',\n text: 'Campeche',\n },\n {\n key: 'CO',\n text: 'Coahuila',\n },\n {\n key: 'CS',\n text: 'Chiapas',\n },\n {\n key: 'DF',\n text: 'Federal District',\n },\n {\n key: 'DG',\n text: 'Durango',\n },\n {\n key: 'GR',\n text: 'Guerrero',\n },\n {\n key: 'GT',\n text: 'Guanajuato',\n },\n {\n key: 'HG',\n text: 'Hidalgo',\n },\n {\n key: 'JA',\n text: 'Jalisco',\n },\n {\n key: 'ME',\n text: 'México State',\n },\n {\n key: 'MI',\n text: 'Michoacán',\n },\n {\n key: 'MO',\n text: 'Morelos',\n },\n {\n key: 'NA',\n text: 'Nayarit',\n },\n {\n key: 'NL',\n text: 'Nuevo León',\n },\n {\n key: 'OA',\n text: 'Oaxaca',\n },\n {\n key: 'PB',\n text: 'Puebla',\n },\n {\n key: 'QE',\n text: 'Querétaro',\n },\n {\n key: 'QR',\n text: 'Quintana Roo',\n },\n {\n key: 'SI',\n text: 'Sinaloa',\n },\n {\n key: 'SL',\n text: 'San Luis PotosÃ',\n },\n {\n key: 'SO',\n text: 'Sonora',\n },\n {\n key: 'TB',\n text: 'Tabasco',\n },\n {\n key: 'TL',\n text: 'Tlaxcala',\n },\n {\n key: 'TM',\n text: 'Tamaulipas',\n },\n {\n key: 'VE',\n text: 'Veracruz',\n },\n {\n key: 'YU',\n text: 'Yucatán',\n },\n {\n key: 'ZA',\n text: 'Zacatecas',\n },\n]\n\nconst CA = [\n {\n text: 'Alberta',\n key: 'AB',\n },\n {\n text: 'British Columbia',\n key: 'BC',\n },\n {\n text: 'Manitoba',\n key: 'MB',\n },\n {\n text: 'New Brunswick',\n key: 'NB',\n },\n {\n text: 'Newfoundland and Labrador',\n key: 'NL',\n },\n {\n text: 'Northwest Territories',\n key: 'NT',\n },\n {\n text: 'Nova Scotia',\n key: 'NS',\n },\n {\n text: 'Nunavut',\n key: 'NU',\n },\n {\n text: 'Ontario',\n key: 'ON',\n },\n {\n text: 'Prince Edward Island',\n key: 'PE',\n },\n {\n text: 'Quebec',\n key: 'QC',\n },\n {\n text: 'Saskatchewan',\n key: 'SK',\n },\n {\n text: 'Yukon Territory',\n key: 'YT',\n },\n]\n\nexport interface StateOption {\n value: string\n label: string\n}\n\nexport interface StateIndex {\n [key: string]: StateOption[]\n}\n\nconst getStates = (): Promise =>\n Promise.resolve({\n US: US.map((x) => ({\n label: x.text,\n value: x.key,\n })),\n MX: MX.map((x) => ({\n label: x.text,\n value: x.key,\n })),\n CA: CA.map((x) => ({\n label: x.text,\n value: x.key,\n })),\n })\n\nexport default getStates\n","import getCountries, { CountryOption } from '@api/getCountries'\nimport getStates, { StateOption, StateIndex } from '@api/getStates'\nimport { useState, useEffect } from 'react'\nimport { sortCountries, popularCountries } from '../utils/countries'\n\nlet stateCache: StateIndex | null = null\nlet countryCache: CountryOption[] | null = null\n\nexport default function useGetLocales(): [\n CountryOption[],\n (country: string) => StateOption[],\n boolean\n] {\n const [states, setStates] = useState(stateCache || {})\n const [countries, setCountries] = useState(\n countryCache || []\n )\n const [isLoading, setIsLoading] = useState(false)\n useEffect(() => {\n const fetchData = async () => {\n if (!stateCache) {\n setIsLoading(true)\n stateCache = await getStates()\n }\n if (!countryCache) {\n setIsLoading(true)\n countryCache = sortCountries(await getCountries(), popularCountries)\n }\n setStates(stateCache)\n setCountries(countryCache)\n setIsLoading(false)\n }\n fetchData()\n }, [])\n const getStatesByCountry = (country: string) => {\n return states[country] || []\n }\n return [countries, getStatesByCountry, isLoading]\n}\n","import { baseLookup } from '@api/lookupClient'\nimport { useState, useEffect } from 'react'\n\nconst cache: Record = {}\n\nexport const TSADecisionTimeframe = '60 days'\n\nexport enum KEYS {\n 'us-born-citizenship-immigration-documents' = 'us-born-citizenship-immigration-documents',\n 'subdivisions-ca' = 'subdivisions-ca',\n 'preferred-contact-methods' = 'preferred-contact-methods',\n 'uploadable-proofs-of-citizenship' = 'uploadable-proofs-of-citizenship',\n 'hair-colors' = 'hair-colors',\n 'subdivisions-mx' = 'subdivisions-mx',\n 'non-us-born-citizenship-immigration-documents' = 'non-us-born-citizenship-immigration-documents',\n 'non-us-citizen-photo-ids' = 'non-us-citizen-photo-ids',\n 'subdivisions-us' = 'subdivisions-us',\n 'name-suffixes' = 'name-suffixes',\n 'genders' = 'genders',\n 'non-immigrant-visa-statuses' = 'non-immigrant-visa-statuses',\n 'eye-colors' = 'eye-colors',\n 'us-citizen-photo-ids' = 'us-citizen-photo-ids',\n 'countries' = 'countries',\n}\n\nexport default function useLookupData(\n keys: KEYS[]\n): [Record, boolean] {\n const [isLoading, setIsLoading] = useState(false)\n const [data, setData] = useState<\n Record\n >({})\n\n useEffect(() => {\n setIsLoading(true)\n const fetchData = async () => {\n const d: Record = {}\n await Promise.all(\n keys.map(async (key) => {\n if (!cache[key]) {\n const val = await baseLookup(key)\n cache[key] = val\n }\n d[key] = cache[key]\n return cache[key]\n })\n )\n setData(d)\n setIsLoading(false)\n }\n fetchData()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n return [data, isLoading]\n}\n","import { CountryOption } from '@api/getCountries'\n\nexport function sortCountries(\n countries: CountryOption[],\n popularCountryCodes: string[]\n) {\n const otherCountries = countries.filter(\n ({ value }) => !popularCountryCodes.includes(value)\n )\n\n const popularCountries = popularCountryCodes\n .map(\n (popularCountryCode) =>\n countries.find((country) => country.value === popularCountryCode)!\n )\n .filter((country) => country !== undefined)\n\n return [...popularCountries, ...otherCountries]\n}\n\nexport const countriesWithSubdivisions = ['US', 'CA', 'MX']\nexport const countriesWithZipCodes = ['US', 'CA', 'MX']\nexport const popularCountries = ['US', 'CA', 'MX']\n","import { RefObject } from 'react'\n\nconst scrollToRef = (\n ref: RefObject,\n options?: ScrollIntoViewOptions\n) => {\n if (ref?.current) {\n ref.current.scrollIntoView({ behavior: 'smooth', ...options })\n }\n}\n\nexport default scrollToRef\n","\n (window.__NEXT_P = window.__NEXT_P || []).push([\n \"/enroll/document-check\",\n function () {\n return require(\"private-next-pages/enroll/document-check.tsx\");\n }\n ]);\n "],"names":["DocumentCheckKeys","citizenSupportingDocumentNotRequired","nonCitizenSupportingDocumentNotRequired","DocumentCheckLabels","PHOTO_ID","DOCUMENT","COUNTRY_OF_BIRTH","CITY_OF_BIRTH","STATE_OF_BIRTH","CITIZENSHIP_COUNTRY","NON_IMMIGRANT_VISA_STATUS","isNameLinkingDocumentRequired","photoId","includes","documentCheckSchema","object","shape","string","required","document","when","is","then","otherwise","notRequired","namesOnDocumentsMatch","boolean","citizenshipChanged","membershipNameMatchesLegalName","label","value","countriesWithSubdivisions","oneOf","copyAndRemoveEmptyEntries","obj","copy","Object","keys","forEach","key","radioGroupNameLinkingOptions","defaultValues","birthCountry","birthSubdivision","citizenshipCountry","nonImmigrantVisaStatus","birthLocality","lprOptions","getFormStateEnrollment","enrollment","documentCheck","citizenship","undefined","useEnrollmentApi","client","state","documentCheckCache","updateState","clearEnrollmentState","clearState","useForm","mode","resolver","yupResolver","register","handleSubmit","watch","formState","setError","clearErrors","unregister","setValue","trigger","useEnrollmentContext","affiliate","biographicAuthInfo","countryOfBirth","useEffect","userHasAccessToken","id","setIsLoading","handleSelectPlan","getAccessToken","PlanTypes","errors","router","useRouter","sessionTimeoutHandler","useSessionTimer","useState","showModal","setShowModal","isLoading","isListADisabled","setIsListADisabled","isListBDisabled","setIsListBDisabled","useLookupData","KEYS","lookupData","isLoadingLookupData","data","setData","citizen","Array","from","Set","nonCitizen","citizenNonUSBorn","citizenUSBorn","useDocumentDropdownOptions","optionData","isLoadingOptionData","useGetLocales","countries","getStatesByCountry","alertRef","useRef","values","isUSCitizen","isUSBorn","needsSubDivision","scrollToRef","hideDocumentDropdown","onSubmit","formData","xCLEARCorrelationInfo","getXCLEARCorrelationInfo","baseMetaData","kpi","KPI","url","route","preDocumentCheckStep","reportCitizenship","enrollmentId","preCitizenshipStep","dispatchCustomEvent","Enrollment","payload","message","metadata","event","DiscreteEvent","chooseDocuments","response","push","stack","status","setFormErrors","extractErrors","modalBody","className","handleSelect","list","PageContent","current","percent","steps","enrollSteps","mb","defaultIcon","backgroundColor","color","text","ref","variant","Form","mt","placeholder","options","error","autoComplete","disabled","flexDirection","justifyContent","alignItems","my","containerProps","shouldUnregister","selected","toLowerCase","mx","onChange","e","target","filter","option","getPhotoIdListADropdownData","getPhotoIdListBDropdownData","citizenshipDocument","p","FinePrint","isValid","onClick","Spinner","global","Modal","body","header","canClose","successButtonText","successClick","baseLookup","fetch","process","headers","json","map","x","US","MX","CA","Promise","resolve","stateCache","countryCache","states","setStates","setCountries","getStates","sortCountries","getCountries","popularCountries","fetchData","country","cache","TSADecisionTimeframe","d","all","val","popularCountryCodes","otherCountries","popularCountryCode","find","countriesWithZipCodes","scrollIntoView","behavior","window","__NEXT_P"],"sourceRoot":""}