{"version":3,"sources":["components/offices-list/hooks/useOfficesList.ts","components/offices-list-tem/OfficesListItem.tsx","components/offices-list/OfficesList.tsx","App.tsx","reportWebVitals.ts","index.tsx"],"names":["useOfficesList","residencyAlpha2","contentUrl","useState","offices","setOffices","useEffect","fetchOffices","then","res","officesFormatted","data","officesList","length","content","components","forEach","item","keys","split","itemKey","trim","itemValue","replace","Object","map","key","formatOfficesList","err","console","log","a","fetch","response","json","OfficesListItem","office","isActive","active","setActive","className","onClick","prevState","title","src","alt","adr_street1","adr_street2","adr_city","adr_province","adr_postal","phone_1","rel","target","href","x-ms-format-detection","phone_2","working_hours_calls","working_hours_visits","toLocaleLowerCase","office_id","OfficesList","index","App","reportWebVitals","onPerfEntry","Function","getCLS","getFID","getFCP","getLCP","getTTFB","rootElement","document","getElementById","dataset","ReactDOM","render","StrictMode"],"mappings":"+QAGaA,EAAiB,SAACC,EAAyBC,GAAwB,IAAD,EAC7CC,mBAAoB,IADyB,mBACpEC,EADoE,KAC3DC,EAD2D,KAY3E,OATAC,qBAAU,Y,8CACNC,CAAaN,EAAiBC,GAAYM,MAAK,SAACC,GAC5C,IAAMC,EAkBlB,SAA2BC,GACvB,IAAIC,EAAmB,GAEvB,GAAID,GAAQA,EAAKE,QAAUF,EAAK,GAAGG,SAAWH,EAAK,GAAGG,QAAQC,WAAY,CACjDJ,EAAK,GAAGG,QAAQC,WAExBC,SAAQ,SAACC,GAClB,IAAMC,EAAOD,EAAI,KAASE,MAAM,KAC1BC,EAAUF,EAAK,GAAGG,OAClBC,EAAYL,EAAI,MAEjBL,EAAYQ,KACbR,EAAYQ,GAAW,IAE3BR,EAAYQ,GAASF,EAAK,GAAGK,QAAQ,MAAO,MAAQD,KAI5D,OAAOE,OAAON,KAAKN,GAAaa,KAAI,SAACC,GAAD,OAAiBd,EAAYc,MApChCC,CAAkBlB,GAC3CJ,EAAWK,MACZ,SAACkB,GACAC,QAAQC,IAAI,2BAA4BF,QAE7C,CAAC3B,EAAiBC,IAEd,C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L1B,EAAOO,YAVxB,qBAAKH,UAAU,4BAAf,SACI,qBAAKA,UAAU,2BCEpBuB,MATf,YAAoD,IAAtC9D,EAAqC,EAArCA,gBAAiBC,EAAoB,EAApBA,WAC3B,OACI,cAAC,EAAD,CACID,gBAAiBA,EACjBC,WAAYA,KCCT8D,EAZS,SAACC,GACnBA,GAAeA,aAAuBC,UACxC,6BAAqB1D,MAAK,YAAkD,IAA/C2D,EAA8C,EAA9CA,OAAQC,EAAsC,EAAtCA,OAAQC,EAA8B,EAA9BA,OAAQC,EAAsB,EAAtBA,OAAQC,EAAc,EAAdA,QAC3DJ,EAAOF,GACPG,EAAOH,GACPI,EAAOJ,GACPK,EAAOL,GACPM,EAAQN,OCHRO,EAAcC,SAASC,eAAe,8B,GAK7B,OAAXF,QAAW,IAAXA,OAAA,EAAAA,EAAaG,UAAW,G,IAFxB1E,uB,MAAkB,K,MAClBC,kB,MAAa,mC,EAGjB0E,IAASC,OACP,cAAC,IAAMC,WAAP,UACE,cAAC,EAAD,CACI7E,gBAAiBA,EACjBC,WAAYA,MAGlBuE,SAASC,eAAe,+BAM1BV,M","file":"static/js/main.95aebe17.chunk.js","sourcesContent":["import {useEffect, useState} from 'react';\nimport IOffice from '../../../interfaces/IOffice';\n\nexport const useOfficesList = (residencyAlpha2: string, contentUrl: string) => {\n const [offices, setOffices] = useState([]);\n\n useEffect(() => {\n fetchOffices(residencyAlpha2, contentUrl).then((res) => {\n const officesFormatted = formatOfficesList(res);\n setOffices(officesFormatted);\n }, (err) => {\n console.log('Error during get offices', err);\n });\n }, [residencyAlpha2, contentUrl])\n\n return {\n offices,\n }\n}\n\nasync function fetchOffices(residencyAlpha2: string, contentUrl: string) {\n const response = await fetch(`${contentUrl}/services/offices/items?lang=en&filter=residency::${residencyAlpha2}`);\n return await response.json();\n}\n\n\nfunction formatOfficesList(data: any): IOffice[] {\n let officesList: any = {};\n\n if (data && data.length && data[0].content && data[0].content.components) {\n const officesItems = data[0].content.components;\n\n officesItems.forEach((item: any) => {\n const keys = item['name'].split('|');\n const itemKey = keys[0].trim();\n const itemValue = item['value'];\n\n if (!officesList[itemKey]) {\n officesList[itemKey] = {};\n }\n officesList[itemKey][keys[1].replace(/-/gi, '_')] = itemValue;\n });\n }\n\n return Object.keys(officesList).map((key: string) => officesList[key]);\n}\n","import React, {useState} from 'react';\nimport IOffice from '../../interfaces/IOffice';\n\ntype Props = {\n office: IOffice\n residencyAlpha2: string\n isActive: boolean\n}\n\nconst OfficesListItem: React.FC = ({office, residencyAlpha2, isActive}) => {\n const [active, setActive] = useState(isActive);\n\n const handleClick = (): void => {\n setActive((prevState) => !prevState)\n }\n\n return (\n
  • \n
    \n {office.title}\n \n
    \n
    \n
    \n
    \n \"logo\"\n
    \n
    \n \n
    \n
    Address\n
    VisaHQ.com Inc.
    \n
    \n {office.adr_street1 && (\n <>{office.adr_street1}
    \n )}\n {office.adr_street2 && (\n <>{office.adr_street2}
    \n )}\n {office.adr_city && (\n {office.adr_city},\n )}\n {office.adr_province && (\n {office.adr_province}\n )}\n {office.adr_postal && (\n {office.adr_postal}\n )}\n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n Phone\n
    \n {office.phone_1 && (\n <>\n \n {office.phone_1}\n \n \n \n {office.phone_1}\n \n
    \n \n )}\n\n {office.phone_2 && (\n <>\n \n {office.phone_2}\n \n \n \n {office.phone_2}\n \n
    \n \n )}\n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n Working Hours\n
    \n {office.working_hours_calls && (\n
    For calls: {office.working_hours_calls}
    \n )}\n\n {office.working_hours_visits && (\n
    For visits: {office.working_hours_visits}
    \n )}\n
    \n
    \n
    \n \n
    \n
    \n \n \n \n
    \n
    \n
    \n
  • \n )\n}\n\nexport default OfficesListItem;\n","import React from 'react';\nimport {useOfficesList} from './hooks';\nimport OfficesListItem from '../offices-list-tem/OfficesListItem';\n\ntype Props = {\n residencyAlpha2: string\n contentUrl: string\n}\n\nconst OfficesList: React.FC = ({residencyAlpha2, contentUrl}) => {\n const {offices} = useOfficesList(residencyAlpha2, contentUrl);\n\n return (\n
    \n {!offices.length ? (\n
    \n
    \n
    \n ) : (\n
      \n {offices.map((office, index) => (\n \n ))}\n
    \n )}\n
    \n );\n}\n\nexport default OfficesList\n","import React from 'react';\nimport './App.css';\nimport OfficesList from './components/offices-list/OfficesList';\n\ntype Props = {\n residencyAlpha2: string\n contentUrl: string\n}\n\nfunction App({residencyAlpha2, contentUrl}: Props) {\n return (\n \n );\n}\n\nexport default App;\n","import { ReportHandler } from 'web-vitals';\n\nconst reportWebVitals = (onPerfEntry?: ReportHandler) => {\n if (onPerfEntry && onPerfEntry instanceof Function) {\n import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n getCLS(onPerfEntry); \n getFID(onPerfEntry);\n getFCP(onPerfEntry);\n getLCP(onPerfEntry);\n getTTFB(onPerfEntry);\n });\n }\n}\n\nexport default reportWebVitals;\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './index.css';\nimport App from './App';\nimport reportWebVitals from './reportWebVitals';\n\nconst rootElement = document.getElementById('vhq-offices-list-accordion');\n\nconst {\n residencyAlpha2 = 'US',\n contentUrl = 'https://content11p.visahq.org/v0',\n} = rootElement?.dataset || {};\n\nReactDOM.render(\n \n \n ,\n document.getElementById('vhq-offices-list-accordion')\n);\n\n// If you want to start measuring performance in your app, pass a function\n// to log results (for example: reportWebVitals(console.log))\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\nreportWebVitals();\n"],"sourceRoot":""}