{"version":3,"sources":["components/agent/networkPartners/api/AirportCodeAPI.js","actions/commonActions/dataActions.js","actions/agentActions/agentApplicationsActions.js","components/common/SelectDropdown.js","components/agent/AgentStats.js"],"names":["AirportCodeApi","get","axios","r","data","fetchAllCountries","options","dispatch","then","response","map","c","label","value","type","FETCH_ALL_COUNTRIES","payload","catch","error","fetchAllCurrencies","FETCH_ALL_CURRENCIES","fetchTrackerStatuses","FETCH_TRACKER_STATUSES","fetchPrivateTrackerStatuses","FETCH_PRIVATE_TRACKER_STATUSES","fetchSLADestinations","results","inOptions","consignee_country","FETCH_SLA_DESTINATIONS","fetchSLANPs","partner_name","partner_id","FETCH_SLA_NPS","fetchPorts","a","resAirports","ap","airport_name","airport_code","name","municipality","FETCH_PORTS","addAgentApplications","agentApplicationName","agentApplicationContactPerson","agentApplicationNumber","agentApplicationEmail","labelLogoUrl","isActive","post","agent_application_name","agent_application_contact_person","agent_application_number","agent_application_email","label_logo_url","is_active","ADD_AGENT_APPLICATIONS","editAgentApplicationsSecretKey","agentApplicationId","patch","EDIT_AGENT_APPLICATIONS_SECRET_KEY","fetchAgentApplications","params","FETCH_AGENT_APPLICATIONS","clearAgentApplicationsErrors","CLEAR_AGENT_APPLICATIONS_ERRORS","fetchPaginatedAgentApplications","res","FETCH_PAGINATED_AGENT_APPLICATIONS","fetchPaginatedAgentApplicationsById","id","FETCH_PAGINATED_AGENT_APPLICATION_BY_ID","editPaginatedAgentApplication","put","CLEAR_PAGINATED_AGENT_APPLICATION_DATA","isEmpty","Object","keys","forEach","key","join","EDIT_PAGINATED_AGENT_APPLICATION_ERROR","clearEditPaginatedAgentApplicationData","addSubAccountsAgentApplication","sub_accounts","ADD_SUB_ACCOUNTS_AGENT_APPLICATION","ADD_SUB_ACCOUNTS_AGENT_APPLICATION_ERROR","clearSubAccountsAgentApplicationError","CLEAR_SUB_ACCOUNTS_AGENT_APPLICATION_ERROR","customStyles","groupHeading","provided","state","backgroundColor","paddingTop","paddingBottom","SelectDropdown","props","dropdownClassName","labelClassName","textLabel","groupedOptions","renderItems","useMemo","placeholder","item","obj","optionObject","push","className","style","color","styles","isMulti","onChange","formatGroupLabel","PublicStatuses","connect","auth","agentStats","agentApplications","stats","countries","applications","useState","pickupCountry","setPickupCountry","consigneeCountry","setConsigneeCountry","agentAppId","setAgentAppId","countStatus","padding","e","agentApp","agent_application_id","status","width","capitalizeUnderscore","to","role"],"mappings":"wKAceA,EAZQ,CACfC,IADe,6KAIDC,IAAMD,IAJL,yCAIXE,EAJW,yBAKVA,EAAEC,MALQ,+ICahB,SAASC,EAAkBC,GAGhC,OAAO,SAASC,GACdL,IAAMD,IAAN,qBACGO,MAAK,SAACC,GACP,IAAIL,EAAOK,EAASL,KAChBE,IACFF,EAAOA,EAAKM,KAAI,SAAAC,GAAC,MAAK,CAAEC,MAAOD,EAAGE,MAAOF,OAEzCJ,EAAS,CACPO,KAAMC,KACNC,QAASZ,OAGZa,OAAM,SAACC,QAMP,SAASC,IAGd,OAAO,SAASZ,GACdL,IAAMD,IAAN,yBACGO,MAAK,SAACC,GACLF,EAAS,CACPO,KAAMM,KACNJ,QAASP,EAASL,UAGrBa,OAAM,SAACC,QAyBP,SAASG,IAGd,OAAO,SAASd,GACdL,IAAMD,IAAN,iCAEGO,MAAK,SAACC,GACLF,EAAS,CACPO,KAAMQ,KACNN,QAASP,EAASL,UAGrBa,OAAM,SAACC,QAMP,SAASK,IAGd,OAAO,SAAShB,GACdL,IAAMD,IAAN,kCAEGO,MAAK,SAACC,GACLF,EAAS,CACPO,KAAMU,KACNR,QAASP,EAASL,UAGrBa,OAAM,SAACC,QAwBP,SAASO,EAAqBnB,GACnC,OAAO,SAASC,GACdL,IAAMD,IAAN,oCACCO,MAAK,SAACC,GAAc,IACbiB,EAAYjB,EAASL,KAArBsB,SACN,OAAIpB,QAAJ,IAAIA,OAAJ,EAAIA,EAASqB,aACXD,EAAUA,EAAQhB,KAAI,SAACC,GAAD,MAAQ,CAC5BC,MAAOD,EAAEiB,kBACT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S,SACrGhB,EAAe3G,KAAI,SAAA+H,GAClB,OACE,yBAAK3B,UAAU,WAAWC,MAAO,CAAE2B,MAAO,UAExC,yBAAK5B,UAAU,iBACb,wBAAIA,UAAU,mDACbsB,EAAYK,IAAW,GAExB,wBAAI3B,UAAU,kCAAkC6B,YAAqBF,UAQ/E,yBAAK3B,UAAU,qCACb,yBAAKA,UAAU,kCAAf,kBAEA,kBAAC,IAAD,CAAS8B,GAAG,uBACV,yBAAK9B,UAAU,sCAAsC+B,KAAK,SAA1D","file":"static/js/AgentStats.abd145e3.chunk.js","sourcesContent":["import axios from 'axios'\n\nconst AirportCodeApi = {\n async get() {\n const url = `/api/location/airports/`\n try {\n const r = await axios.get(url)\n return r.data\n } catch(e) {\n console.log(e)\n }\n }\n}\n\nexport default AirportCodeApi","import axios from 'axios';\nimport {\n FETCH_ALL_COUNTRIES,\n FETCH_ALL_CURRENCIES,\n FETCH_AGENT_STATUSES,\n FETCH_TRACKER_STATUSES,\n FETCH_FIRSTMILE_STATUSES,\n FETCH_PRIVATE_TRACKER_STATUSES,\n FETCH_PORTS,\n FETCH_SLA_NPS,\n FETCH_SLA_DESTINATIONS\n} from '../types';\n\nimport AirportCodeApi from '../../components/agent/networkPartners/api/AirportCodeAPI'\n\nexport function fetchAllCountries(options) {\n console.log('fetching all countries...');\n\n return function(dispatch) {\n axios.get(`/api/data/places/`)\n .then((response) => {\n let data = response.data;\n if (options) {\n data = data.map(c => ({ label: c, value: c }));\n }\n dispatch({\n type: FETCH_ALL_COUNTRIES,\n payload: data\n });\n })\n .catch((error) => {\n console.log(error);\n });\n }\n}\n\nexport function fetchAllCurrencies() {\n console.log('fetching all currencies...');\n\n return function(dispatch) {\n axios.get(`/api/data/currencies/`)\n .then((response) => {\n dispatch({\n type: FETCH_ALL_CURRENCIES,\n payload: response.data\n });\n })\n .catch((error) => {\n console.log(error);\n });\n }\n}\n\nexport function fetchAgentStatuses() {\n console.log('fetching agent statuses...');\n\n return function(dispatch) {\n axios.get(`/api/data/agent-statuses/`\n )\n .then((response) => {\n dispatch({\n type: FETCH_AGENT_STATUSES,\n payload: response.data\n });\n })\n .catch((error) => {\n console.log(error);\n });\n }\n}\n\n// fetch public and private tracker statuses\nexport function fetchTrackerStatuses() {\n console.log('fetching tracker statuses...');\n\n return function(dispatch) {\n axios.get(`/api/tracker/public-statuses/`\n )\n .then((response) => {\n dispatch({\n type: FETCH_TRACKER_STATUSES,\n payload: response.data\n });\n })\n .catch((error) => {\n console.log(error);\n });\n }\n}\n\nexport function fetchPrivateTrackerStatuses() {\n console.log('fetching tracker statuses...');\n\n return function(dispatch) {\n axios.get(`/api/tracker/private-statuses/`\n )\n .then((response) => {\n dispatch({\n type: FETCH_PRIVATE_TRACKER_STATUSES,\n payload: response.data\n });\n })\n .catch((error) => {\n console.log(error);\n });\n }\n}\n\nexport function fetchFirstmileStatuses() {\n console.log('fetching firstmile statuses...');\n\n return function(dispatch) {\n axios.get(`/api/data/firstmile-statuses/`\n )\n .then((response) => {\n dispatch({\n type: FETCH_FIRSTMILE_STATUSES,\n payload: response.data\n });\n })\n .catch((error) => {\n console.log(error);\n });\n }\n}\n\nexport function fetchSLADestinations(options) {\n return function(dispatch) {\n axios.get(`/api/sla/last-mile/destinations/`)\n .then((response) => {\n let { results } = response.data;\n if (options?.inOptions) {\n results = results.map((c) => ({\n label: c.consignee_country,\n value: c.consignee_country\n }));\n }\n dispatch({\n type: FETCH_SLA_DESTINATIONS,\n payload: results,\n });\n })\n .catch((error) => {\n console.log(error);\n });\n }\n}\n\nexport function fetchSLANPs(options) {\n return function(dispatch) {\n axios.get(`/api/sla/last-mile/network_partners/`)\n .then((response) => {\n let { results } = response.data;\n if (options?.inOptions) {\n results = results.map((c) => ({\n label: c.partner_name,\n value: c.partner_id\n }));\n }\n dispatch({\n type: FETCH_SLA_NPS,\n payload: results,\n });\n })\n .catch((error) => {\n console.log(error);\n });\n }\n}\n\nexport function fetchPorts(options = false) {\n console.log('fetching ports...');\n\n return async function(dispatch) {\n let resAirports = await AirportCodeApi.get();\n if (options) {\n resAirports = resAirports?.map((ap) => ({\n label: `${ap.airport_name} (${ap.airport_code})`,\n value: ap.airport_code,\n name: ap.municipality,\n }));\n }\n dispatch({\n type: FETCH_PORTS,\n payload: resAirports\n });\n };\n}","import axios from \"axios\";\nimport {\n ADD_AGENT_APPLICATIONS,\n CLEAR_AGENT_APPLICATIONS_ERRORS,\n CLEAR_PAGINATED_AGENT_APPLICATION_DATA,\n EDIT_AGENT_APPLICATIONS,\n EDIT_AGENT_APPLICATIONS_SECRET_KEY,\n EDIT_PAGINATED_AGENT_APPLICATION_ERROR,\n FETCH_AGENT_APPLICATIONS,\n FETCH_AGENT_APPLICATION_BY_ID,\n FETCH_PAGINATED_AGENT_APPLICATIONS,\n FETCH_PAGINATED_AGENT_APPLICATION_BY_ID,\n ADD_SUB_ACCOUNTS_AGENT_APPLICATION,\n ADD_SUB_ACCOUNTS_AGENT_APPLICATION_ERROR,\n CLEAR_SUB_ACCOUNTS_AGENT_APPLICATION_ERROR,\n} from \"../types\";\nimport { isEmpty } from \"lodash\";\n\nexport function addAgentApplications(agentApplicationName, agentApplicationContactPerson, agentApplicationNumber, agentApplicationEmail, labelLogoUrl, isActive) {\n console.log(\"adding agent applications...\");\n\n return function (dispatch) {\n axios\n .post(`/api/order/app/`, {\n agent_application_name: agentApplicationName,\n agent_application_contact_person: agentApplicationContactPerson,\n agent_application_number: agentApplicationNumber,\n agent_application_email: agentApplicationEmail,\n label_logo_url: labelLogoUrl,\n is_active: isActive,\n })\n .then((response) => {\n console.log(response);\n dispatch({\n type: ADD_AGENT_APPLICATIONS,\n payload: false,\n });\n });\n };\n}\n\nexport function editAgentApplicationsSecretKey(agentApplicationId) {\n console.log(\"editing agent applications secretKey...\");\n\n return function (dispatch) {\n axios.patch(`/api/order/app/${agentApplicationId}/`).then((response) => {\n dispatch({\n type: EDIT_AGENT_APPLICATIONS_SECRET_KEY,\n payload: false,\n });\n });\n };\n}\n\nexport function editAgentApplications(payload) {\n console.log(\"editing agent applications...\");\n\n return function (dispatch) {\n axios\n .put(`/api/order/app/${payload.agentApplicationId}/`, {\n agent_application_name: payload.agentApplicationName,\n agent_application_contact_person: payload.agentApplicationContactPerson,\n agent_application_number: payload.agentApplicationNumber,\n agent_application_email: payload.agentApplicationEmail,\n xero_account: payload.xeroAccount,\n billingAddress: payload.billingAddress,\n is_blocked: payload.isBlocked,\n })\n .then((response) => {\n dispatch({\n type: EDIT_AGENT_APPLICATIONS,\n payload: false,\n });\n });\n };\n}\n\nexport function fetchAgentApplications(params) {\n console.log(\"fetching agent applications...\");\n\n return function (dispatch) {\n axios\n .get(`/api/order/app/`, { params })\n .then((response) => {\n dispatch({\n type: FETCH_AGENT_APPLICATIONS,\n payload: response.data,\n });\n })\n .catch((error) => {\n console.log(error);\n });\n };\n}\n\nexport function fetchAgentApplicationById(agentApplicationId) {\n console.log(\"fetching agent application by agentApplicationId \" + agentApplicationId + \"...\");\n\n return function (dispatch) {\n axios\n .get(`/api/order/app/${agentApplicationId}/`)\n .then((response) => {\n dispatch({\n type: FETCH_AGENT_APPLICATION_BY_ID,\n payload: response.data,\n });\n })\n .catch((error) => {\n console.log(error);\n });\n };\n}\n\nexport function clearAgentApplicationsErrors() {\n console.log(\"clearing agent applications errors...\");\n return {\n type: CLEAR_AGENT_APPLICATIONS_ERRORS,\n };\n}\n\nexport function fetchPaginatedAgentApplications(params) {\n return async function (dispatch) {\n try {\n const res = await axios.get(\"/api/order/paginated_apps/\", { params });\n dispatch({\n type: FETCH_PAGINATED_AGENT_APPLICATIONS,\n payload: res.data,\n });\n } catch (err) {\n console.log(err);\n }\n };\n}\n\nexport function fetchPaginatedAgentApplicationsById(id) {\n return async function (dispatch) {\n try {\n const res = await axios.get(`/api/order/paginated_apps/${id}`);\n dispatch({\n type: FETCH_PAGINATED_AGENT_APPLICATION_BY_ID,\n payload: res.data,\n });\n } catch (err) {\n console.log(err);\n }\n };\n}\n\nexport function editPaginatedAgentApplication(payload) {\n return async function (dispatch) {\n try {\n await axios.put(`/api/order/paginated_apps/${payload.agentApplicationId}/`, payload);\n dispatch({\n type: CLEAR_PAGINATED_AGENT_APPLICATION_DATA,\n });\n dispatch(fetchPaginatedAgentApplicationsById(payload.agentApplicationId));\n } catch (err) {\n if (!isEmpty(err.response.data)) {\n const data = err.response.data;\n const keys = Object.keys(data);\n keys.forEach((key) => {\n data[key] = data[key].join(\" \");\n });\n dispatch({\n type: EDIT_PAGINATED_AGENT_APPLICATION_ERROR,\n payload: {\n error: data,\n },\n });\n }\n console.log(err);\n }\n };\n}\n\nexport function clearEditPaginatedAgentApplicationData() {\n return function (dispatch) {\n dispatch({\n type: CLEAR_PAGINATED_AGENT_APPLICATION_DATA,\n });\n };\n}\n\nexport function addSubAccountsAgentApplication(sub_accounts) {\n return async function (dispatch) {\n try {\n const response = await axios.post(\"/api/order/sub-accounts/\", { sub_accounts });\n dispatch({\n type: ADD_SUB_ACCOUNTS_AGENT_APPLICATION,\n payload: response.data,\n });\n } catch (error) {\n dispatch({\n type: ADD_SUB_ACCOUNTS_AGENT_APPLICATION_ERROR,\n payload: error.response.data,\n });\n }\n };\n}\n\nexport function clearSubAccountsAgentApplicationError() {\n return function (dispatch) {\n dispatch({\n type: CLEAR_SUB_ACCOUNTS_AGENT_APPLICATION_ERROR,\n });\n };\n}\n","import React, { useMemo } from 'react'\nimport Select from 'react-select'\n\nconst customStyles = {\n groupHeading: (provided, state) => ({\n ...provided,\n backgroundColor: \"#E5E5E5\",\n paddingTop: 8,\n paddingBottom: 8,\n })\n}\n\nconst SelectDropdown = props => {\n const { dropdownClassName, labelClassName, textLabel, groupedOptions } = props\n \n const renderItems = useMemo(() => {\n if (!!groupedOptions) {\n return groupedOptions\n }\n let options = [{\n value: '',\n label: props.placeholder\n }]\n if (!props.options) return options\n\n props.options.forEach(item => {\n let obj = props.optionObject ? props.optionObject(item): {value: item, label: item}\n options.push(obj)\n })\n return options\n }, [props.options, groupedOptions])\n\n return useMemo(() =>\n
\n {\n textLabel ?\n \n :\n null\n }\n \n
,\n [textLabel, labelClassName, dropdownClassName, props.placeholder, props.isMulti, props.onChange, props.value, renderItems]\n )\n}\n\nexport default SelectDropdown","import React, { useState } from \"react\";\nimport { connect } from \"react-redux\";\nimport {NavLink} from 'react-router-dom';\nimport {\n fetchAllCountries\n} from \"../../actions/commonActions/dataActions\";\nimport { fetchAgentApplications } from '../../actions/agentActions/agentApplicationsActions';\n\nimport AgentDashboard from './AgentDashboard';\nimport SelectDropdown from \"../common/SelectDropdown\";\nimport { capitalizeUnderscore } from \"../../utils\";\n\nconst PublicStatuses = [\n \"ORDER_CREATED\",\n \"PENDING_PICKUP\",\n \"READY_FOR_COLLECTION\",\n \"IN_TRANSIT_WITHIN_ORIGIN_COUNTRY\",\n \"CROSS_BORDER_TRANSIT\",\n \"DESTINATION_COUNTRY_CUSTOMS\",\n \"IN_TRANSIT_WITHIN_DESTINATION_COUNTRY\",\n \"DELIVERY_IN_PROGRESS\",\n \"DELIVERY_COMPLETED\",\n \"FAILED_DELIVERY\",\n \"RETURN_TO_SENDER\",\n \"EXCEPTION\",\n \"CANCELLED\",\n]\n\nconst AgentStats = (props) => {\n const [pickupCountry, setPickupCountry] = useState(null)\n const [consigneeCountry, setConsigneeCountry] = useState(null)\n const [agentAppId, setAgentAppId] = useState(null)\n const [countStatus] = useState({})\n\n return (\n
\n \n
Overview
\n
\n
\n
\n \n setPickupCountry(e)}\n value={pickupCountry}\n options={props.countries}\n />\n
\n
\n \n setConsigneeCountry(e)}\n value={consigneeCountry}\n options={props.countries}\n />\n
\n
\n \n setAgentAppId(e)}\n value={agentAppId}\n options={props.applications}\n optionObject={agentApp => ({\n value: agentApp.agent_application_id,\n label: agentApp.agent_application_name\n })}\n />\n
\n
\n\n
\n {PublicStatuses.map(status => {\n return (\n
\n {/* */}\n
\n
\n {countStatus[status] || 0}\n
\n
{capitalizeUnderscore(status)}
\n
\n {/*
*/}\n
\n )\n })}\n
\n\n
\n
Common Actions
\n\n \n
View All Orders
\n
\n
\n
\n
\n
\n );\n}\n\nfunction mapStateToProps({ auth, agentStats, data, agentApplications }) {\n return {\n stats: agentStats.stats,\n countries: data.countries,\n applications: agentApplications.agentApplications,\n };\n}\n\nexport default connect(mapStateToProps, {\n fetchAllCountries,\n fetchAgentApplications\n})(AgentStats);\n"],"sourceRoot":""}