mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 17:40:23 +03:00
1 line
No EOL
457 KiB
Text
1 line
No EOL
457 KiB
Text
{"version":3,"sources":["common/img/ShlinkLogo.tsx","servers/helpers/withSelectedServer.tsx","common/NotFound.tsx","servers/ServersListGroup.tsx","utils/helpers/hooks.ts","utils/utils.ts","servers/data/index.ts","common/services/provideServices.ts","common/ScrollToTop.tsx","common/ErrorHandler.tsx","utils/services/provideServices.ts","utils/services/LocalStorage.ts","utils/services/ColorGenerator.ts","utils/SimpleCard.tsx","common/ShlinkVersions.tsx","common/ShlinkVersionsContainer.tsx","common/MainHeader.tsx","common/Home.tsx","common/MenuLayout.tsx","common/AsideMenu.tsx","utils/helpers/features.ts","utils/theme/index.ts","utils/Message.tsx","common/NoMenuLayout.tsx","utils/helpers/version.ts","utils/SearchField.tsx","api/services/ShlinkApiClient.ts","api/services/ShlinkApiClientBuilder.ts","api/services/provideServices.ts","short-urls/ShortUrls.tsx","tags/helpers/Tag.tsx","utils/DropdownBtn.tsx","utils/helpers/date.ts","utils/dates/types/index.ts","utils/DateInput.tsx","utils/dates/DateRangeRow.tsx","utils/dates/DateIntervalDropdownItems.tsx","utils/dates/DateRangeSelector.tsx","short-urls/SearchBar.tsx","utils/SortingDropdown.tsx","mercure/helpers/boundToMercureHub.tsx","mercure/helpers/index.ts","utils/helpers/query.ts","mercure/helpers/Topics.ts","utils/helpers/redux.ts","visits/VisitsStats.tsx","short-urls/helpers/index.ts","visits/reducers/visitCreation.ts","api/utils/index.ts","short-urls/reducers/shortUrlDeletion.ts","short-urls/reducers/shortUrlCreation.ts","short-urls/reducers/shortUrlEdition.ts","short-urls/reducers/shortUrlsList.ts","short-urls/reducers/shortUrlsListParams.ts","utils/helpers/numbers.ts","utils/helpers/pagination.ts","short-urls/Paginator.tsx","short-urls/ShortUrlsList.tsx","utils/CopyToClipboardIcon.tsx","utils/Time.tsx","short-urls/helpers/ShortUrlDetailLink.tsx","short-urls/helpers/ShortUrlVisitsCount.tsx","short-urls/helpers/ShortUrlsRow.tsx","short-urls/helpers/ShortUrlsRowMenu.tsx","short-urls/CreateShortUrl.tsx","utils/Result.tsx","api/ShlinkApiError.tsx","short-urls/helpers/DeleteShortUrlModal.tsx","short-urls/helpers/CreateShortUrlResult.tsx","short-urls/ShortUrlsTable.tsx","utils/helpers/qrCodes.ts","short-urls/helpers/QrCodeModal.tsx","utils/BooleanControl.tsx","utils/Checkbox.tsx","short-urls/UseExistingIfFoundInfoIcon.tsx","short-urls/helpers/ShortUrlFormCheckboxGroup.tsx","short-urls/ShortUrlForm.tsx","short-urls/EditShortUrl.tsx","short-urls/reducers/shortUrlDetail.ts","short-urls/services/provideServices.ts","utils/FormGroupContainer.tsx","servers/helpers/ServerForm.tsx","servers/CreateServer.tsx","servers/ServersDropdown.tsx","servers/DeleteServerModal.tsx","servers/DeleteServerButton.tsx","servers/EditServer.tsx","servers/helpers/ImportServersBtn.tsx","servers/reducers/selectedServer.ts","servers/reducers/servers.ts","servers/reducers/remoteServers.ts","servers/helpers/ForServerVersion.tsx","servers/helpers/ServerError.tsx","servers/Overview.tsx","servers/services/ServersImporter.ts","utils/helpers/csv.ts","servers/services/ServersExporter.ts","servers/services/provideServices.ts","visits/VisitsHeader.tsx","visits/ShortUrlVisitsHeader.tsx","utils/PaginationDropdown.tsx","common/SimplePaginator.tsx","utils/helpers/visits.ts","utils/helpers/charts.ts","visits/helpers/DefaultChart.tsx","visits/helpers/GraphCard.tsx","visits/helpers/SortableBarGraph.tsx","utils/ToggleSwitch.tsx","visits/helpers/LineChartCard.tsx","visits/VisitsTable.tsx","visits/helpers/MapModal.tsx","visits/helpers/OpenMapModalBtn.tsx","visits/types/helpers.ts","visits/services/VisitsParser.ts","visits/helpers/VisitsFilterDropdown.tsx","visits/ShortUrlVisits.tsx","visits/reducers/common.ts","visits/reducers/shortUrlVisits.ts","visits/TagVisitsHeader.tsx","visits/TagVisits.tsx","visits/reducers/tagVisits.ts","visits/OrphanVisitsHeader.tsx","visits/OrphanVisits.tsx","visits/reducers/orphanVisits.ts","visits/reducers/visitsOverview.ts","visits/services/VisitsExporter.ts","visits/services/provideServices.ts","tags/helpers/TagBullet.tsx","tags/helpers/TagsSelector.tsx","tags/TagCard.tsx","tags/helpers/DeleteTagConfirmModal.tsx","tags/helpers/EditTagModal.tsx","tags/TagsList.tsx","tags/reducers/tagDelete.ts","tags/reducers/tagEdit.ts","tags/reducers/tagsList.ts","tags/services/provideServices.ts","mercure/reducers/mercureInfo.ts","mercure/services/provideServices.ts","settings/RealTimeUpdates.tsx","settings/Settings.tsx","settings/reducers/settings.ts","settings/ShortUrlCreation.tsx","settings/UserInterface.tsx","utils/dates/DateIntervalSelector.tsx","settings/Visits.tsx","settings/services/provideServices.ts","domains/reducers/domainsList.ts","domains/DomainSelector.tsx","domains/services/provideServices.ts","app/reducers/appUpdates.ts","common/AppUpdateBanner.tsx","utils/helpers/sw.ts","App.tsx","app/services/provideServices.ts","container/index.ts","reducers/index.ts","container/store.ts","serviceWorkerRegistration.ts","utils/helpers/leaflet.ts","index.tsx","servers/helpers/withoutSelectedServer.tsx"],"names":["ShlinkLogo","color","MAIN_COLOR","className","viewBox","version","xmlns","fill","d","withSelectedServer","WrappedComponent","ServerError","props","selectServer","selectedServer","match","useEffect","params","serverId","isNotFoundServer","loading","NotFound","to","children","ServerListItem","id","name","ListGroupItem","tag","Link","icon","chevronIcon","ServersListGroup","servers","embedded","length","ListGroup","classNames","map","useStateFlagTimeout","setTimeout","clearTimeout","initialValue","delay","useState","flag","setFlag","timeout","useRef","undefined","callback","current","useToggle","useSwipeable","showSidebar","hideSidebar","swipeMenuIfNoModalExists","e","event","composedPath","some","classList","contains","document","querySelector","useReactSwipeable","delta","onSwipedLeft","onSwipedRight","determineOrderDir","currentField","newField","currentOrderDir","ASC","DESC","rangeOf","size","mappingFn","startAt","range","hasValue","value","isNil","isEmpty","handleEventPreventingDefault","handler","pipe","preventDefault","hasServerData","server","url","apiKey","isServerWithId","hasOwnProperty","isReachableServer","provideServices","bottle","connect","withRouter","constant","global","window","console","axios","serviceFactory","ScrollToTop","decorator","MainHeader","Home","withoutSelectedServer","MenuLayout","AsideMenu","ShlinkVersionsContainer","ErrorHandler","location","scrollTo","error","state","hasError","this","outline","onClick","reload","Component","localStorage","service","LocalStorage","ColorGenerator","buildPath","path","get","key","item","getItem","JSON","parse","set","setItem","stringify","floor","Math","random","letters","normalizeKey","toLowerCase","trim","storage","colors","getColorForKey","normalizedKey","setColorForKey","join","SimpleCard","title","bodyClassName","rest","normalizeVersion","versionToSemVer","versionToPrintable","VersionLink","project","href","ShlinkVersions","clientVersion","normalizedClientVersion","printableVersion","classes","ServersDropdown","isOpen","toggleOpen","close","pathname","toggleClass","Navbar","dark","fixed","expand","NavbarBrand","NavbarToggler","arrowIcon","Collapse","navbar","Nav","NavItem","NavLink","active","cogsIcon","serversList","values","hasServers","Card","Row","noGutters","faPlus","faExternalLinkAlt","TagsList","ShortUrls","CreateShortUrl","ShortUrlVisits","TagVisits","OrphanVisits","Overview","EditShortUrl","sidebarVisible","toggleSidebar","addTagsVisitsRoute","supportsTagVisits","addOrphanVisitsRoute","supportsOrphanVisits","burgerClasses","swipeableProps","burgerIcon","showOnMobile","exact","from","component","render","AsideMenuItem","activeClassName","DeleteServerButton","asideClass","suffix","overviewIcon","isActive","_","listIcon","createIcon","flip","tagsIcon","editIcon","textClassName","serverMatchesVersions","versions","versionMatch","supportsSettingShortCodeLength","minVersion","supportsListingDomains","supportsQrCodeSvgFormat","supportsValidateUrl","supportsQrCodeSizeInQuery","supportsShortUrlTitle","supportsQrCodeMargin","supportsTagsInPatch","supportsBotVisits","supportsCrawlableVisits","MAIN_COLOR_ALPHA","HIGHLIGHTED_COLOR","HIGHLIGHTED_COLOR_ALPHA","PRIMARY_LIGHT_COLOR","PRIMARY_DARK_COLOR","changeThemeInMarkup","theme","html","getElementsByTagName","setAttribute","isDarkThemeEnabled","getAttribute","getClassForType","type","default","getTextClassForType","Message","fullWidth","body","preloader","spin","NoMenuLayout","versionToMatch","maxVersion","matchesMinVersion","compare","versionIsValidSemVer","memoizeWith","identity","defaultValue","timer","buildShlinkBaseUrl","apiVersion","rejectNilProps","reject","ShlinkApiClient","baseUrl","listShortUrls","a","performRequest","then","data","shortUrls","createShortUrl","options","filteredOptions","resp","getShortUrlVisits","shortCode","query","visits","getTagVisits","getOrphanVisits","getVisitsOverview","getShortUrl","domain","deleteShortUrl","updateShortUrlTags","tags","updateShortUrl","listTags","withStats","stats","deleteTags","editTag","oldName","newName","health","mercureInfo","listDomains","domains","method","headers","paramsSerializer","qs","arrayFormat","response","apiClients","buildShlinkApiClient","getStateOrSelectedServer","getState","isGetState","prop","Error","clientKey","SearchBar","ShortUrlsList","page","urlsListKey","setUrlsListKey","SearchField","onChange","placeholder","large","noBorder","searchTerm","setSearchTerm","resetTimer","searchTermChanged","newSearchTerm","target","searchIcon","hidden","Tag","text","clearable","colorGenerator","onClose","style","backgroundColor","cursor","DropdownBtn","disabled","dropdownClassName","right","minWidth","toggle","toggleClasses","Dropdown","DropdownToggle","caret","DropdownMenu","isDateObject","date","formatDateFromFormat","theFormat","format","formatISO","formatIsoDate","formatInternational","formatDate","dateRangeIsEmpty","dateRange","filter","Boolean","rangeIsInterval","INTERVAL_TO_STRING_MAP","today","yesterday","last7Days","last30Days","last90Days","last180days","last365Days","DATE_INTERVALS","Object","keys","rangeOrIntervalToString","startDate","endDate","dateRangeToString","startOfDaysAgo","daysAgo","startOfDay","subDays","Date","intervalToDateRange","dateInterval","endOfDay","DateInput","isClearable","selected","showCalendarIcon","ref","dateFormat","calendarIcon","input","focus","DateRangeRow","onStartDateChange","onEndDateChange","placeholderText","maxDate","minDate","DateIntervalDropdownItems","interval","DropdownItem","DateRangeSelector","onDatesChange","initialDateRange","defaultText","activeInterval","setActiveInterval","activeDateRange","setActiveDateRange","updateDateRange","updateInterval","divider","header","dateOrNull","parseISO","shortUrlsListParams","selectedTags","setDates","dates","selectedTag","SortingDropdown","items","orderField","orderDir","isButton","handleItemClick","fieldKey","newOrderDir","UncontrolledDropdown","toPairs","fieldValue","sortAscIcon","sortDescIcon","boundToMercureHub","getTopicsForProps","pendingUpdates","Set","createNewVisits","loadMercureInfo","closeEventSource","topics","onMessage","onTokenExpired","mercureHubUrl","token","onEventSourceMessage","onEventSourceError","status","subscriptions","topic","hubUrl","URL","searchParams","append","es","EventSource","Authorization","onmessage","onerror","forEach","bindToMercureTopic","visit","add","setInterval","clear","clearInterval","parseQuery","search","ignoreQueryPrefix","Topics","shortUrlVisits","orphanVisits","selectedBar","buildReducer","initialState","action","actionHandler","currentState","buildActionCreator","shortUrlMatches","shortUrl","CREATE_VISITS","createdVisits","parseApiError","isInvalidDeletionError","DELETE_SHORT_URL_START","DELETE_SHORT_URL_ERROR","SHORT_URL_DELETED","RESET_DELETE_SHORT_URL","errorData","dispatch","resetDeleteShortUrl","CREATE_SHORT_URL_START","CREATE_SHORT_URL_ERROR","CREATE_SHORT_URL","RESET_CREATE_SHORT_URL","result","saving","resetCreateShortUrl","EDIT_SHORT_URL_START","EDIT_SHORT_URL_ERROR","SHORT_URL_EDITED","editShortUrl","sendTagsSeparately","Promise","all","LIST_SHORT_URLS_START","LIST_SHORT_URLS_ERROR","LIST_SHORT_URLS","assocPath","pagination","totalItems","currentShortUrl","lastVisit","last","assoc","visitsCount","init","editedShortUrl","RESET_SHORT_URL_PARAMS","SORTABLE_FIELDS","dateCreated","longUrl","orderBy","resetShortUrlParams","ceil","formatter","Intl","NumberFormat","prettify","number","ELLIPSIS","progressivePagination","currentPage","pageCount","pages","max","min","unshift","push","pageIsEllipsis","pageNumber","prettifyPageNumber","keyForPage","index","Paginator","paginator","pagesCount","Pagination","listClassName","PaginationItem","PaginationLink","previous","next","ShortUrlsTable","shortUrlsList","head","order","setOrder","refreshList","extraParams","handleOrderBy","decodeURIComponent","itemsPerPage","orderByColumn","field","renderOrderIcon","caretUpIcon","caretDownIcon","onTagClick","CopyToClipboardIcon","onCopy","copyIcon","Time","relative","dateObject","dateTime","getUnixTime","formatDistance","buildUrl","ShortUrlDetailLink","ShortUrlVisitsCount","maxVisits","meta","visitsLink","prettifiedMaxVisits","tooltipRef","el","infoIcon","UncontrolledTooltip","placement","ShortUrlsRow","ShortUrlsRowMenu","copiedToClipboard","setCopiedToClipboard","setActive","isFirstRun","data-th","DeleteShortUrlModal","QrCodeModal","isQrModalOpen","toggleQrCode","isDeleteModalOpen","toggleDelete","ButtonDropdown","menuIcon","pieChartIcon","fixedWidth","qrIcon","deleteIcon","ShortUrlForm","CreateShortUrlResult","shortUrlCreationResult","basicMode","shortUrlCreationSettings","settings","shortUrlCreation","useMemo","customSlug","shortCodeLength","validSince","validUntil","findIfExists","validateUrl","validateUrls","getInitialState","mode","onSave","canBeClosed","Result","small","ShlinkApiError","fallbackMessage","detail","invalidElements","shortUrlDeletion","inputValue","setInputValue","handleDeleteUrl","catch","Modal","centered","onSubmit","ModalHeader","ModalBody","ModalFooter","showCopyTooltip","setShowCopyTooltip","closeIcon","Tooltip","actionableFieldClasses","orderableColumnsClasses","tableClasses","supportsTitle","colSpan","buildQrCodeUrl","margin","useSizeInPath","svgIsSupported","marginIsSupported","stringifyQuery","setSize","setMargin","setFormat","capabilities","qrCodeUrl","totalSize","modalSize","FormGroup","step","Number","src","alt","BooleanControl","checked","inline","uuid","typeClasses","display","htmlFor","Checkbox","InfoModal","UseExistingIfFoundInfoIcon","isModalOpen","toggleModal","InfoTooltip","tooltip","ShortUrlFormCheckboxGroup","infoTooltip","normalizeTag","replace","toDate","TagsSelector","DomainSelector","shortUrlData","setShortUrlData","isEdit","submit","renderOptionalInput","Input","renderDateInput","basicComponents","bsSize","required","showDomainSelector","disableShortCodeLength","showCustomizeCard","limitAccessCardClasses","showValidateUrl","showCrawlableControl","showExtraValidationsCard","crawlable","Button","goBack","history","shortUrlDetail","getShortUrlDetail","shortUrlEdition","savingError","savingErrorData","savingSucceeded","isSuccessful","isNotSuccessful","faArrowLeft","GET_SHORT_URL_DETAIL_START","GET_SHORT_URL_DETAIL_ERROR","GET_SHORT_URL_DETAIL","find","FormGroupContainer","ServerForm","initialValues","setName","setUrl","setApiKey","handleSubmit","ImportResult","CreateServer","ImportServersBtn","createServer","serversImported","setServersImported","errorImporting","setErrorImporting","serverData","onImport","onImportError","serversExporter","createServerItem","plusIcon","nav","inNavbar","serverIcon","exportServers","exportIcon","DeleteServerModal","deleteServer","showModal","hideModal","EditServer","editServer","importServersFromFile","createServers","fileRef","files","click","accept","SELECT_SERVER","RESET_SELECTED_SERVER","toSemVer","getServerVersion","_serverId","resetSelectedServer","serverNotFound","serverNotReachable","EDIT_SERVER","DELETE_SERVER","CREATE_SERVERS","newServers","dissoc","serversListToMap","reduce","acc","responseToServersList","Array","isArray","fetchServers","homepage","remoteList","ForServerVersion","tagsList","loadVisitsOverview","visitsOverview","loadingTags","loadingVisits","orphanVisitsCount","useHistory","CardTitle","CardText","CardHeader","CardBody","validateServer","validateServers","every","ServersImporter","csvJson","fileReaderFactory","file","reader","resolve","addEventListener","content","toString","toObject","readAsText","saveCsv","csv","filename","link","createElement","blob","Blob","createObjectURL","visibility","appendChild","removeChild","ServersExporter","csvjson","toCSV","FileReader","VisitsHeader","ShortUrlVisitsHeader","shortLink","longLink","visitsStatsTitle","PaginationDropdown","toggleClassName","ranges","setValue","Infinity","SimplePaginator","setCurrentPage","DEFAULT","BROWSERS_WHITELIST","extractDomain","split","includes","fillTheGaps","labels","zipObj","pointerOnHover","chartElement","renderNonDoughnutChartLabel","labelToPick","datasets","datasetIndex","datasetLabel","label","renderDoughnutChartLabel","dropLabelIfHidden","startsWith","renderPieChartLegend","config","defaultColor","chartElementAtEvent","chart","_index","_chart","statsAreDefined","DefaultChart","isBarChart","highlightedStats","highlightedLabel","HorizontalBar","Doughnut","highlightedKey","highlightedData","chartRef","setChartRef","legend","legendCallback","scales","xAxes","ticks","beginAtZero","precision","stacked","yAxes","tooltips","intersect","yLabel","callbacks","onHover","graphData","borderColor","borderWidth","generateGraphData","height","determineHeight","element","getElementAtEvent","chartInstance","generateLegend","GraphCard","footer","CardFooter","toLowerIfString","toLower","pickKeyFromPair","pickValueFromPair","SortableBarGraph","sortingItems","extraHeaderContent","withPagination","setItemsPerPage","determineCurrentPagePairs","firstPageLength","i","sortedPairs","pairs","sortBy","reverse","getSortedPairsForStats","sortedKeys","sortedHighlightedPairs","currentPageStats","fromPairs","currentPageHighlightedStats","splitEvery","highlightedPages","determineStats","activeCities","ToggleSwitch","STEPS_MAP","monthly","weekly","daily","hourly","STEP_TO_DURATION_MAP","hours","days","weeks","months","STEP_TO_DIFF_FUNC_MAP","differenceInHours","differenceInDays","differenceInWeeks","differenceInMonths","STEP_TO_DATE_FORMAT","firstWeekDay","startOfISOWeek","lastWeekDay","endOfISOWeek","groupVisitsByStep","countBy","generateLabelsAndGroupedVisits","groupedVisitsWithGaps","skipNoElements","diffFunc","newerDate","oldestDate","duration","num","generateLabels","generateDataset","lineTension","selectedLabel","datasetsByPoint","setSelectedVisits","LineChartCard","highlightedVisits","oldestVisitDate","now","cond","always","matcher","determineInitialStep","setStep","skipNoVisits","toggleSkipNoVisits","visitsToDatasetGroups","groupedVisits","groupedHighlighted","maintainAspectRatio","scaleLabel","labelString","axis","entries","menuText","searchVisits","browser","os","referer","country","city","visitedUrl","visitMatchesSearch","VisitsTable","selectedVisits","matchMedia","isOrphanVisits","headerCellsClass","matchMobile","matches","isMobileDevice","setIsMobileDevice","dir","resultSet","allVisits","sortedVisits","sort","b","greaterThan","smallerThan","sortVisits","total","visitsGroups","calculateVisits","isFirstLoad","setPage","end","start","supportsBots","fullSizeColSpan","listener","removeEventListener","flat","checkIcon","botIcon","isSelected","v","potentialBot","OpenStreetMapTile","TileLayer","attribution","calculateMapProps","locations","bounds","zoom","center","latLong","MapModal","contentClassName","MapContainer","cityName","count","Marker","position","Popup","OpenMapModalBtn","modalTitle","mapIsOpened","openMap","closeMap","dropdownIsOpened","toggleDropdown","openDropdown","locationsToShow","setLocationsToShow","buttonRef","openMapWithLocations","filtered","mapIcon","isOrphanVisit","groupNewVisitsByType","groupBy","newVisit","regularVisits","highlightedVisitsToStats","property","toApiParams","excludeBots","visitHasProperty","propertyName","optionalNumericToNumber","numeric","parseFloat","updateLocationsStatsForVisit","updateCountriesStatsForVisit","updateCitiesStatsForVisit","processStatsFromVisits","osStats","updateOsStatsForVisit","browsersStats","updateBrowsersStatsForVisit","browsers","referrersStats","updateReferrersStatsForVisit","referrers","countries","cities","citiesForMapStats","latitude","longitude","currentCity","updateCitiesForMapForVisit","citiesForMap","visitedUrlsStats","isNormalizedOrphanVisit","updateVisitedUrlsForVisit","visitedUrls","normalizeVisits","userAgent","visitLocation","common","bowser","parseUserAgent","countryName","VisitsFilterDropdown","botsSupported","orphanVisitsType","propsForOrphanVisitsTypeItem","sections","byTime","subPath","faCalendarAlt","byContext","faChartPie","byLocation","faMapMarkedAlt","list","faList","VisitsNavLink","RouterNavLink","endsWith","VisitsStats","visitsInfo","getVisits","cancelGetVisits","exportCsv","initialInterval","defaultInterval","setDateRange","setHighlightedVisits","setHighlightedLabel","visitsFilter","setVisitsFilter","buildSectionUrl","loadingLarge","progress","normalizedVisits","mapLocations","highlightVisitsForProp","newSelectedBar","propEq","faFileDownload","Progress","striped","pills","section","amount","exportVisits","cancelGetShortUrlVisits","ITEMS_PER_PAGE","isLastPage","calcProgress","getVisitsWithLoader","visitsLoader","extraFinishActionData","actionMap","shouldCancel","loadVisitsInParallel","flatten","loadPagesBlocks","pagesBlocks","concat","loadVisits","pagesRange","finish","GET_SHORT_URL_VISITS_START","GET_SHORT_URL_VISITS_ERROR","GET_SHORT_URL_VISITS","GET_SHORT_URL_VISITS_LARGE","GET_SHORT_URL_VISITS_CANCEL","GET_SHORT_URL_VISITS_PROGRESS_CHANGED","cancelLoad","newVisits","TagVisitsHeader","tagVisits","cancelGetTagVisits","GET_TAG_VISITS_START","GET_TAG_VISITS_ERROR","GET_TAG_VISITS","GET_TAG_VISITS_LARGE","GET_TAG_VISITS_CANCEL","GET_TAG_VISITS_PROGRESS_CHANGED","OrphanVisitsHeader","cancelGetOrphanVisits","GET_ORPHAN_VISITS_START","GET_ORPHAN_VISITS_ERROR","GET_ORPHAN_VISITS","GET_ORPHAN_VISITS_LARGE","GET_ORPHAN_VISITS_CANCEL","GET_ORPHAN_VISITS_PROGRESS_CHANGED","matchesType","GET_OVERVIEW_START","GET_OVERVIEW_ERROR","GET_OVERVIEW","VisitsExporter","visitsParser","TagBullet","toComponentTag","tagComponent","onDelete","suggestions","suggestionComponent","allowNew","addOnBlur","minQueryLength","removedTagIndex","tagsCopy","splice","onAddition","newTag","TagCard","DeleteTagConfirmModal","EditTagModal","tagStats","displayed","isEditModalOpen","toggleEdit","shortUrlsLink","encodeURIComponent","faLink","shortUrlsCount","faEye","deleteTag","tagDelete","tagDeleted","deleting","doDelete","tagEdited","tagEdit","newTagName","setNewTagName","setColor","showColorPicker","toggleColorPicker","hideColorPicker","editing","saveTag","onClosed","colorIcon","Popover","disableAlpha","hex","filterTags","forceListTags","displayedTag","setDisplayedTag","tagsCount","filteredTags","tagsGroups","group","renderContent","DELETE_TAG_START","DELETE_TAG_ERROR","DELETE_TAG","TAG_DELETED","EDIT_TAG_START","EDIT_TAG_ERROR","EDIT_TAG","TAG_EDITED","pick","LIST_TAGS_START","LIST_TAGS_ERROR","LIST_TAGS","FILTER_TAGS","renameTag","rejectTag","tagToReject","calculateVisitsPerTag","increase","listTagsActionFactory","force","processedStats","factory","GET_MERCURE_INFO_START","GET_MERCURE_INFO_ERROR","GET_MERCURE_INFO","realTimeUpdates","enabled","info","RealTimeUpdates","toggleRealTimeUpdates","setRealTimeUpdatesInterval","SettingsSections","child","subChild","subIndex","Settings","ShortUrlCreation","UserInterface","Visits","SET_SETTINGS","mergeDeepRight","ui","setShortUrlCreationSettings","setUiSettings","setVisitsSettings","faMoon","faSun","useDarkTheme","DateIntervalSelector","LIST_DOMAINS_START","LIST_DOMAINS_ERROR","LIST_DOMAINS","domainsList","inputDisplayed","showInput","hideInput","valueIsEmpty","unselectDomain","InputGroup","InputGroupAddon","addonType","faUndo","trigger","isDefault","APP_UPDATE_AVAILABLE","RESET_APP_UPDATE","appUpdateAvailable","resetAppUpdate","AppUpdateBanner","forceUpdate","isUpdating","setUpdating","Alert","reloadIcon","navigator","serviceWorker","getRegistrations","registrations","registration","waiting","postMessage","App","appUpdated","Bottle","container","mapActionService","actionName","serviceName","lazyService","propsFromState","actionServiceNames","reduxConnect","provideAppServices","provideCommonServices","provideApiServices","provideShortUrlsServices","provideServersServices","provideTagsServices","provideVisitsServices","provideUtilsServices","provideMercureServices","provideSettingsServices","provideDomainsServices","combineReducers","serversReducer","selectedServerReducer","shortUrlsListReducer","shortUrlsListParamsReducer","shortUrlCreationReducer","shortUrlDeletionReducer","shortUrlEditionReducer","shortUrlVisitsReducer","tagVisitsReducer","orphanVisitsReducer","shortUrlDetailReducer","tagsListReducer","tagDeleteReducer","tagEditReducer","mercureInfoReducer","settingsReducer","domainsListReducer","visitsOverviewReducer","appUpdatesReducer","composeEnhancers","__REDUX_DEVTOOLS_EXTENSION_COMPOSE__","compose","localStorageConfig","states","namespace","namespaceSeparator","debounce","store","createStore","reducers","load","applyMiddleware","save","ReduxThunk","isLocalhost","hostname","registerValidSW","swUrl","register","onupdatefound","installingWorker","installing","onstatechange","controller","log","onUpdate","onSuccess","L","Icon","Default","prototype","_getIconUrl","mergeOptions","iconRetinaUrl","marker2x","iconUrl","marker","shadowUrl","markerShadow","basename","getElementById","process","origin","fetch","contentType","indexOf","ready","unregister","checkValidServiceWorker","registerServiceWorker"],"mappings":"8OAOaA,EAAa,SAAC,GAAD,QAAGC,aAAH,MAAWC,IAAX,EAAuBC,EAAvB,EAAuBA,UAAvB,OACxB,qBAAKA,UAAWA,EAAWC,QAAQ,cAAcC,QAAQ,MAAMC,MAAM,6BAArE,SACE,oBAAGC,KAAMN,EAAT,UACE,sBACEO,EAAE,6lBAEJ,sBACEA,EAAE,uiBAEJ,sBACEA,EAAE,u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,EAA8BnG,GAC5C,OAAO,SAACE,GAKN,OAJAI,qBAAU,WACRJ,EAAM4wB,wBACL,IAEI,cAAC9wB,EAAD,eAAsBE,Q","file":"static/js/main.00248ebe.chunk.js","sourcesContent":["import { MAIN_COLOR } from '../../utils/theme';\n\nexport interface ShlinkLogoProps {\n color?: string;\n className?: string;\n}\n\nexport const ShlinkLogo = ({ color = MAIN_COLOR, className }: ShlinkLogoProps) => (\n <svg className={className} viewBox=\"0 0 512 512\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <g fill={color}>\n <path\n d=\" M 23.71 85.08 C 17.22 49.81 49.44 14.86 85.08 18.12 C 118.83 19.21 145.72 53.33 139.45 86.37 C 155.64 102.30 171.32 118.83 187.87 134.36 C 198.32 111.73 208.84 89.12 219.57 66.62 C 226.05 53.84 243.47 48.74 255.73 56.27 C 263.76 62.10 270.34 69.69 277.25 76.75 C 286.28 86.61 285.72 102.89 276.31 112.31 C 223.38 165.37 170.38 218.37 117.35 271.34 C 107.72 280.99 91.01 281.25 81.11 271.86 C 74.39 264.94 66.82 258.69 61.24 250.77 C 53.72 238.52 58.85 221.07 71.64 214.62 C 94.11 203.87 116.72 193.38 139.33 182.91 C 123.81 166.36 107.30 150.68 91.37 134.49 C 60.20 140.28 27.37 116.78 23.71 85.08 Z\"\n />\n <path\n d=\" M 205.21 201.23 C 225.32 181.36 260.88 181.11 281.14 200.86 C 299.25 218.75 317.37 236.65 335.10 254.93 C 356.73 278.01 352.01 318.70 326.03 336.56 C 320.07 330.47 313.73 324.65 308.12 318.28 C 323.86 309.39 328.76 286.18 316.63 272.39 C 301.73 256.95 286.30 242.03 271.24 226.75 C 264.49 219.65 256.80 212.00 246.37 211.52 C 224.65 208.64 205.52 233.36 214.49 253.58 C 221.09 266.81 234.22 275.12 243.62 286.24 C 240.43 295.96 238.09 306.13 238.29 316.46 C 225.55 304.29 213.16 291.73 200.89 279.09 C 180.97 257.57 183.10 220.45 205.21 201.23 Z\"\n />\n <path\n d=\" M 273.90 352.07 C 252.28 328.99 256.98 288.31 282.96 270.46 C 288.93 276.54 295.26 282.36 300.88 288.72 C 285.14 297.62 280.23 320.82 292.38 334.61 C 307.27 350.05 322.70 364.96 337.75 380.25 C 344.51 387.35 352.20 395.00 362.64 395.48 C 384.35 398.37 403.49 373.64 394.51 353.42 C 387.92 340.18 374.78 331.88 365.38 320.76 C 368.56 311.04 370.91 300.86 370.71 290.54 C 383.45 302.70 395.84 315.27 408.11 327.91 C 428.03 349.43 425.90 386.55 403.78 405.77 C 383.68 425.64 348.13 425.89 327.86 406.14 C 309.75 388.25 291.60 370.37 273.90 352.07 Z\"\n />\n <path\n d=\" M 422.11 403.83 C 431.96 394.07 441.60 384.06 451.66 374.51 C 460.90 383.74 471.89 392.70 474.89 406.11 C 480.16 429.97 484.08 454.13 488.76 478.12 C 490.00 483.41 484.47 488.29 479.35 486.63 C 454.66 481.52 429.55 478.12 405.14 471.84 C 393.17 467.97 385.20 457.75 376.55 449.27 C 386.39 439.49 396.13 429.60 406.06 419.91 C 416.37 433.45 435.74 414.00 422.11 403.83 Z\"\n />\n </g>\n </svg>\n);\n","import { FC, useEffect } from 'react';\nimport { RouteComponentProps } from 'react-router';\nimport Message from '../../utils/Message';\nimport { isNotFoundServer, SelectedServer } from '../data';\nimport NoMenuLayout from '../../common/NoMenuLayout';\n\ninterface WithSelectedServerProps extends RouteComponentProps<{ serverId: string }> {\n selectServer: (serverId: string) => void;\n selectedServer: SelectedServer;\n}\n\nexport function withSelectedServer<T = {}>(WrappedComponent: FC<WithSelectedServerProps & T>, ServerError: FC) {\n return (props: WithSelectedServerProps & T) => {\n const { selectServer, selectedServer, match } = props;\n\n useEffect(() => {\n selectServer(match.params.serverId);\n }, [ match.params.serverId ]);\n\n if (!selectedServer) {\n return (\n <NoMenuLayout>\n <Message loading />\n </NoMenuLayout>\n );\n }\n\n if (isNotFoundServer(selectedServer)) {\n return <ServerError />;\n }\n\n return <WrappedComponent {...props} />;\n };\n}\n","import { FC } from 'react';\nimport { Link } from 'react-router-dom';\nimport { SimpleCard } from '../utils/SimpleCard';\n\ninterface NotFoundProps {\n to?: string;\n}\n\nconst NotFound: FC<NotFoundProps> = ({ to = '/', children = 'Home' }) => (\n <div className=\"home\">\n <SimpleCard className=\"p-4\">\n <h2>Oops! We could not find requested route.</h2>\n <p>\n Use your browser's back button to navigate to the page you have previously come from, or just press this\n button.\n </p>\n <br />\n <Link to={to} className=\"btn btn-outline-primary btn-lg\">{children}</Link>\n </SimpleCard>\n </div>\n);\n\nexport default NotFound;\n","import { FC } from 'react';\nimport { ListGroup, ListGroupItem } from 'reactstrap';\nimport { Link } from 'react-router-dom';\nimport classNames from 'classnames';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faChevronRight as chevronIcon } from '@fortawesome/free-solid-svg-icons';\nimport { ServerWithId } from './data';\nimport './ServersListGroup.scss';\n\ninterface ServersListGroupProps {\n servers: ServerWithId[];\n embedded?: boolean;\n}\n\nconst ServerListItem = ({ id, name }: { id: string; name: string }) => (\n <ListGroupItem tag={Link} to={`/server/${id}`} className=\"servers-list__server-item\">\n {name}\n <FontAwesomeIcon icon={chevronIcon} className=\"servers-list__server-item-icon\" />\n </ListGroupItem>\n);\n\nconst ServersListGroup: FC<ServersListGroupProps> = ({ servers, children, embedded = false }) => (\n <>\n {children && <h5 className=\"mb-md-3\">{children}</h5>}\n {servers.length > 0 && (\n <ListGroup\n className={classNames('servers-list__list-group', { 'servers-list__list-group--embedded': embedded })}\n >\n {servers.map(({ id, name }) => <ServerListItem key={id} id={id} name={name} />)}\n </ListGroup>\n )}\n </>\n);\n\nexport default ServersListGroup;\n","import { useState, useRef } from 'react';\nimport { useSwipeable as useReactSwipeable } from 'react-swipeable';\n\nconst DEFAULT_DELAY = 2000;\n\nexport type StateFlagTimeout = (initialValue?: boolean, delay?: number) => [ boolean, () => void ];\n\nexport const useStateFlagTimeout = (\n setTimeout: (callback: Function, timeout: number) => number,\n clearTimeout: (timer: number) => void,\n): StateFlagTimeout => (initialValue = false, delay = DEFAULT_DELAY) => {\n const [ flag, setFlag ] = useState<boolean>(initialValue);\n const timeout = useRef<number | undefined>(undefined);\n const callback = () => {\n setFlag(!initialValue);\n\n if (timeout.current) {\n clearTimeout(timeout.current);\n }\n\n timeout.current = setTimeout(() => setFlag(initialValue), delay);\n };\n\n return [ flag, callback ];\n};\n\ntype ToggleResult = [ boolean, () => void, () => void, () => void ];\n\nexport const useToggle = (initialValue = false): ToggleResult => {\n const [ flag, setFlag ] = useState<boolean>(initialValue);\n\n return [ flag, () => setFlag(!flag), () => setFlag(true), () => setFlag(false) ];\n};\n\nexport const useSwipeable = (showSidebar: () => void, hideSidebar: () => void) => {\n const swipeMenuIfNoModalExists = (callback: () => void) => (e: any) => {\n const swippedOnVisitsTable = (e.event.composedPath() as HTMLElement[]).some( // eslint-disable-line @typescript-eslint/no-unsafe-call\n ({ classList }) => classList?.contains('visits-table'),\n );\n\n if (swippedOnVisitsTable || document.querySelector('.modal')) {\n return;\n }\n\n callback();\n };\n\n return useReactSwipeable({\n delta: 40,\n onSwipedLeft: swipeMenuIfNoModalExists(hideSidebar),\n onSwipedRight: swipeMenuIfNoModalExists(showSidebar),\n });\n};\n","import { isEmpty, isNil, pipe, range } from 'ramda';\nimport { SyntheticEvent } from 'react';\n\nexport type OrderDir = 'ASC' | 'DESC' | undefined;\n\nexport const determineOrderDir = <T extends string = string>(\n currentField: T,\n newField?: T,\n currentOrderDir?: OrderDir,\n): OrderDir => {\n if (currentField !== newField) {\n return 'ASC';\n }\n\n const newOrderMap: Record<'ASC' | 'DESC', OrderDir> = {\n ASC: 'DESC',\n DESC: undefined,\n };\n\n return currentOrderDir ? newOrderMap[currentOrderDir] : 'ASC';\n};\n\nexport const rangeOf = <T>(size: number, mappingFn: (value: number) => T, startAt = 1): T[] =>\n range(startAt, size + 1).map(mappingFn);\n\nexport type Empty = null | undefined | '' | never[];\n\nexport const hasValue = <T>(value: T | Empty): value is T => !isNil(value) && !isEmpty(value);\n\nexport const handleEventPreventingDefault = <T>(handler: () => T) => pipe(\n (e: SyntheticEvent) => e.preventDefault(),\n handler,\n);\n\nexport type Nullable<T> = {\n [P in keyof T]: T[P] | null\n};\n\ntype Optional<T> = T | null | undefined;\n\nexport type OptionalString = Optional<string>;\n\nexport type RecursivePartial<T> = {\n [P in keyof T]?: RecursivePartial<T[P]>;\n};\n","import { SemVer } from '../../utils/helpers/version';\n\nexport interface ServerData {\n name: string;\n url: string;\n apiKey: string;\n}\n\nexport interface ServerWithId extends ServerData {\n id: string;\n}\n\nexport interface ReachableServer extends ServerWithId {\n version: SemVer;\n printableVersion: string;\n}\n\nexport interface NonReachableServer extends ServerWithId {\n serverNotReachable: true;\n}\n\nexport interface NotFoundServer {\n serverNotFound: true;\n}\n\nexport type RegularServer = ReachableServer | NonReachableServer;\n\nexport type SelectedServer = RegularServer | NotFoundServer | null;\n\nexport type ServersMap = Record<string, ServerWithId>;\n\nexport const hasServerData = (server: SelectedServer | ServerData): server is ServerData =>\n !!(server as ServerData)?.url && !!(server as ServerData)?.apiKey;\n\nexport const isServerWithId = (server: SelectedServer | ServerWithId): server is ServerWithId =>\n !!server?.hasOwnProperty('id');\n\nexport const isReachableServer = (server: SelectedServer): server is ReachableServer =>\n !!server?.hasOwnProperty('version');\n\nexport const isNotFoundServer = (server: SelectedServer): server is NotFoundServer =>\n !!server?.hasOwnProperty('serverNotFound');\n","import axios from 'axios';\nimport Bottle, { Decorator } from 'bottlejs';\nimport ScrollToTop from '../ScrollToTop';\nimport MainHeader from '../MainHeader';\nimport Home from '../Home';\nimport MenuLayout from '../MenuLayout';\nimport AsideMenu from '../AsideMenu';\nimport ErrorHandler from '../ErrorHandler';\nimport ShlinkVersionsContainer from '../ShlinkVersionsContainer';\nimport { ConnectDecorator } from '../../container/types';\nimport { withoutSelectedServer } from '../../servers/helpers/withoutSelectedServer';\n\nconst provideServices = (bottle: Bottle, connect: ConnectDecorator, withRouter: Decorator) => {\n bottle.constant('window', (global as any).window);\n bottle.constant('console', global.console);\n bottle.constant('axios', axios);\n\n bottle.serviceFactory('ScrollToTop', ScrollToTop);\n bottle.decorator('ScrollToTop', withRouter);\n\n bottle.serviceFactory('MainHeader', MainHeader, 'ServersDropdown');\n bottle.decorator('MainHeader', withRouter);\n\n bottle.serviceFactory('Home', () => Home);\n bottle.decorator('Home', withoutSelectedServer);\n bottle.decorator('Home', connect([ 'servers' ], [ 'resetSelectedServer' ]));\n\n bottle.serviceFactory(\n 'MenuLayout',\n MenuLayout,\n 'TagsList',\n 'ShortUrls',\n 'AsideMenu',\n 'CreateShortUrl',\n 'ShortUrlVisits',\n 'TagVisits',\n 'OrphanVisits',\n 'ServerError',\n 'Overview',\n 'EditShortUrl',\n );\n bottle.decorator('MenuLayout', connect([ 'selectedServer', 'shortUrlsListParams' ], [ 'selectServer' ]));\n bottle.decorator('MenuLayout', withRouter);\n\n bottle.serviceFactory('AsideMenu', AsideMenu, 'DeleteServerButton');\n\n bottle.serviceFactory('ShlinkVersionsContainer', () => ShlinkVersionsContainer);\n bottle.decorator('ShlinkVersionsContainer', connect([ 'selectedServer' ]));\n\n bottle.serviceFactory('ErrorHandler', ErrorHandler, 'window', 'console');\n};\n\nexport default provideServices;\n","import { PropsWithChildren, useEffect } from 'react';\nimport { RouteComponentProps } from 'react-router';\n\nconst ScrollToTop = () => ({ location, children }: PropsWithChildren<RouteComponentProps>) => {\n useEffect(() => {\n scrollTo(0, 0);\n }, [ location ]);\n\n return <>{children}</>;\n};\n\nexport default ScrollToTop;\n","import { Component, ReactNode } from 'react';\nimport { Button } from 'reactstrap';\nimport { SimpleCard } from '../utils/SimpleCard';\n\ninterface ErrorHandlerState {\n hasError: boolean;\n}\n\nconst ErrorHandler = (\n { location }: Window,\n { error }: Console,\n) => class ErrorHandler extends Component<any, ErrorHandlerState> {\n public constructor(props: object) {\n super(props);\n this.state = { hasError: false };\n }\n\n public static getDerivedStateFromError(): ErrorHandlerState {\n return { hasError: true };\n }\n\n public componentDidCatch(e: Error): void {\n if (process.env.NODE_ENV !== 'development') {\n error(e);\n }\n }\n\n public render(): ReactNode {\n if (this.state.hasError) {\n return (\n <div className=\"home\">\n <SimpleCard className=\"p-4\">\n <h1>Oops! This is awkward :S</h1>\n <p>It seems that something went wrong. Try refreshing the page or just click this button.</p>\n <br />\n <Button outline color=\"primary\" onClick={() => location.reload()}>Take me back</Button>\n </SimpleCard>\n </div>\n );\n }\n\n return this.props.children;\n }\n};\n\nexport default ErrorHandler;\n","import Bottle from 'bottlejs';\nimport { useStateFlagTimeout } from '../helpers/hooks';\nimport LocalStorage from './LocalStorage';\nimport ColorGenerator from './ColorGenerator';\n\nconst provideServices = (bottle: Bottle) => {\n bottle.constant('localStorage', (global as any).localStorage);\n bottle.service('Storage', LocalStorage, 'localStorage');\n bottle.service('ColorGenerator', ColorGenerator, 'Storage');\n\n bottle.constant('setTimeout', global.setTimeout);\n bottle.constant('clearTimeout', global.clearTimeout);\n bottle.serviceFactory('useStateFlagTimeout', useStateFlagTimeout, 'setTimeout', 'clearTimeout');\n};\n\nexport default provideServices;\n","const PREFIX = 'shlink';\nconst buildPath = (path: string) => `${PREFIX}.${path}`;\n\nexport default class LocalStorage {\n public constructor(private readonly localStorage: Storage) {}\n\n public readonly get = <T>(key: string): T | undefined => {\n const item = this.localStorage.getItem(buildPath(key));\n\n return item ? JSON.parse(item) as T : undefined;\n };\n\n public readonly set = (key: string, value: any) => this.localStorage.setItem(buildPath(key), JSON.stringify(value));\n}\n","import { rangeOf } from '../utils';\nimport LocalStorage from './LocalStorage';\n\nconst HEX_COLOR_LENGTH = 6;\nconst { floor, random } = Math;\nconst letters = '0123456789ABCDEF';\nconst buildRandomColor = () => `#${rangeOf(HEX_COLOR_LENGTH, () => letters[floor(random() * letters.length)]).join('')}`;\nconst normalizeKey = (key: string) => key.toLowerCase().trim();\n\nexport default class ColorGenerator {\n private readonly colors: Record<string, string>;\n\n public constructor(private readonly storage: LocalStorage) {\n this.colors = this.storage.get<Record<string, string>>('colors') ?? {};\n }\n\n public readonly getColorForKey = (key: string) => {\n const normalizedKey = normalizeKey(key);\n const color = this.colors[normalizedKey];\n\n // If a color has not been set yet, generate a random one and save it\n if (!color) {\n return this.setColorForKey(normalizedKey, buildRandomColor());\n }\n\n return color;\n };\n\n public readonly setColorForKey = (key: string, color: string) => {\n const normalizedKey = normalizeKey(key);\n\n this.colors[normalizedKey] = color;\n this.storage.set('colors', this.colors);\n\n return color;\n };\n}\n","import { CardProps } from 'reactstrap/lib/Card';\nimport { Card, CardBody, CardHeader } from 'reactstrap';\nimport { ReactNode } from 'react';\n\ninterface SimpleCardProps extends Omit<CardProps, 'title'> {\n title?: ReactNode;\n bodyClassName?: string;\n}\n\nexport const SimpleCard = ({ title, children, bodyClassName, ...rest }: SimpleCardProps) => (\n <Card {...rest}>\n {title && <CardHeader>{title}</CardHeader>}\n <CardBody className={bodyClassName}>{children}</CardBody>\n </Card>\n);\n","import { pipe } from 'ramda';\nimport { ExternalLink } from 'react-external-link';\nimport { versionToPrintable, versionToSemVer } from '../utils/helpers/version';\nimport { isReachableServer } from '../servers/data';\nimport { ShlinkVersionsContainerProps } from './ShlinkVersionsContainer';\n\nconst SHLINK_WEB_CLIENT_VERSION = '%_VERSION_%';\nconst normalizeVersion = pipe(versionToSemVer(), versionToPrintable);\n\nexport interface ShlinkVersionsProps extends ShlinkVersionsContainerProps {\n clientVersion?: string;\n}\n\nconst VersionLink = ({ project, version }: { project: 'shlink' | 'shlink-web-client'; version: string }) => (\n <ExternalLink href={`https://github.com/shlinkio/${project}/releases/${version}`} className=\"text-muted\">\n <b>{version}</b>\n </ExternalLink>\n);\n\nconst ShlinkVersions = ({ selectedServer, clientVersion = SHLINK_WEB_CLIENT_VERSION }: ShlinkVersionsProps) => {\n const normalizedClientVersion = normalizeVersion(clientVersion);\n\n return (\n <small className=\"text-muted\">\n {isReachableServer(selectedServer) &&\n <>Server: <VersionLink project=\"shlink\" version={selectedServer.printableVersion} /> - </>\n }\n Client: <VersionLink project=\"shlink-web-client\" version={normalizedClientVersion} />\n </small>\n );\n};\n\nexport default ShlinkVersions;\n","import classNames from 'classnames';\nimport { isReachableServer, SelectedServer } from '../servers/data';\nimport ShlinkVersions from './ShlinkVersions';\nimport './ShlinkVersionsContainer.scss';\n\nexport interface ShlinkVersionsContainerProps {\n selectedServer: SelectedServer;\n}\n\nconst ShlinkVersionsContainer = ({ selectedServer }: ShlinkVersionsContainerProps) => {\n const classes = classNames('text-center', {\n 'shlink-versions-container--with-server': isReachableServer(selectedServer),\n });\n\n return (\n <div className={classes}>\n <ShlinkVersions selectedServer={selectedServer} />\n </div>\n );\n};\n\nexport default ShlinkVersionsContainer;\n","import { faChevronDown as arrowIcon, faCogs as cogsIcon } from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { FC, useEffect } from 'react';\nimport { Link } from 'react-router-dom';\nimport { Collapse, Nav, Navbar, NavbarBrand, NavbarToggler, NavItem, NavLink } from 'reactstrap';\nimport classNames from 'classnames';\nimport { RouteComponentProps } from 'react-router';\nimport { useToggle } from '../utils/helpers/hooks';\nimport { ShlinkLogo } from './img/ShlinkLogo';\nimport './MainHeader.scss';\n\nconst MainHeader = (ServersDropdown: FC) => ({ location }: RouteComponentProps) => {\n const [ isOpen, toggleOpen, , close ] = useToggle();\n const { pathname } = location;\n\n useEffect(close, [ location ]);\n\n const settingsPath = '/settings';\n const toggleClass = classNames('main-header__toggle-icon', { 'main-header__toggle-icon--opened': isOpen });\n\n return (\n <Navbar color=\"primary\" dark fixed=\"top\" className=\"main-header\" expand=\"md\">\n <NavbarBrand tag={Link} to=\"/\">\n <ShlinkLogo className=\"main-header__brand-logo\" color=\"white\" /> Shlink\n </NavbarBrand>\n\n <NavbarToggler onClick={toggleOpen}>\n <FontAwesomeIcon icon={arrowIcon} className={toggleClass} />\n </NavbarToggler>\n\n <Collapse navbar isOpen={isOpen}>\n <Nav navbar className=\"ml-auto\">\n <NavItem>\n <NavLink tag={Link} to={'/settings'} active={pathname === settingsPath}>\n <FontAwesomeIcon icon={cogsIcon} /> Settings\n </NavLink>\n </NavItem>\n <ServersDropdown />\n </Nav>\n </Collapse>\n </Navbar>\n );\n};\n\nexport default MainHeader;\n","import { isEmpty, values } from 'ramda';\nimport { Link } from 'react-router-dom';\nimport { Card, Row } from 'reactstrap';\nimport { ExternalLink } from 'react-external-link';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faExternalLinkAlt, faPlus } from '@fortawesome/free-solid-svg-icons';\nimport ServersListGroup from '../servers/ServersListGroup';\nimport { ServersMap } from '../servers/data';\nimport { ShlinkLogo } from './img/ShlinkLogo';\nimport './Home.scss';\n\nexport interface HomeProps {\n servers: ServersMap;\n}\n\nconst Home = ({ servers }: HomeProps) => {\n const serversList = values(servers);\n const hasServers = !isEmpty(serversList);\n\n return (\n <div className=\"home\">\n <Card className=\"home__main-card\">\n <Row noGutters>\n <div className=\"col-md-5 d-none d-md-block\">\n <div className=\"p-4\">\n <ShlinkLogo />\n </div>\n </div>\n <div className=\"col-md-7 home__servers-container\">\n <div className=\"p-4\">\n <h1 className=\"home__title\">Welcome!</h1>\n </div>\n <ServersListGroup embedded servers={serversList}>\n {!hasServers && (\n <div className=\"p-4 text-center\">\n <p className=\"mb-5\">This application will help you manage your Shlink servers.</p>\n <p>\n <Link to=\"/server/create\" className=\"btn btn-outline-primary btn-lg mr-2\">\n <FontAwesomeIcon icon={faPlus} /> <span className=\"ml-1\">Add a server</span>\n </Link>\n </p>\n <p className=\"mb-0 mt-5\">\n <ExternalLink href=\"https://shlink.io/documentation\">\n <small>\n <span className=\"mr-1\">Learn more about Shlink</span> <FontAwesomeIcon icon={faExternalLinkAlt} />\n </small>\n </ExternalLink>\n </p>\n </div>\n )}\n </ServersListGroup>\n </div>\n </Row>\n </Card>\n </div>\n );\n};\n\nexport default Home;\n","import { FC, useEffect } from 'react';\nimport { Redirect, Route, Switch } from 'react-router-dom';\nimport { faBars as burgerIcon } from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport classNames from 'classnames';\nimport { withSelectedServer } from '../servers/helpers/withSelectedServer';\nimport { useSwipeable, useToggle } from '../utils/helpers/hooks';\nimport { supportsOrphanVisits, supportsTagVisits } from '../utils/helpers/features';\nimport { isReachableServer } from '../servers/data';\nimport NotFound from './NotFound';\nimport { AsideMenuProps } from './AsideMenu';\nimport './MenuLayout.scss';\n\nconst MenuLayout = (\n TagsList: FC,\n ShortUrls: FC,\n AsideMenu: FC<AsideMenuProps>,\n CreateShortUrl: FC,\n ShortUrlVisits: FC,\n TagVisits: FC,\n OrphanVisits: FC,\n ServerError: FC,\n Overview: FC,\n EditShortUrl: FC,\n) => withSelectedServer(({ location, selectedServer }) => {\n const [ sidebarVisible, toggleSidebar, showSidebar, hideSidebar ] = useToggle();\n\n useEffect(() => hideSidebar(), [ location ]);\n\n if (!isReachableServer(selectedServer)) {\n return <ServerError />;\n }\n\n const addTagsVisitsRoute = supportsTagVisits(selectedServer);\n const addOrphanVisitsRoute = supportsOrphanVisits(selectedServer);\n const burgerClasses = classNames('menu-layout__burger-icon', { 'menu-layout__burger-icon--active': sidebarVisible });\n const swipeableProps = useSwipeable(showSidebar, hideSidebar);\n\n return (\n <>\n <FontAwesomeIcon icon={burgerIcon} className={burgerClasses} onClick={toggleSidebar} />\n\n <div {...swipeableProps} className=\"menu-layout__swipeable\">\n <div className=\"menu-layout__swipeable-inner\">\n <AsideMenu selectedServer={selectedServer} showOnMobile={sidebarVisible} />\n <div className=\"menu-layout__container\" onClick={() => hideSidebar()}>\n <div className=\"container-xl\">\n <Switch>\n <Redirect exact from=\"/server/:serverId\" to=\"/server/:serverId/overview\" />\n <Route exact path=\"/server/:serverId/overview\" component={Overview} />\n <Route exact path=\"/server/:serverId/list-short-urls/:page\" component={ShortUrls} />\n <Route exact path=\"/server/:serverId/create-short-url\" component={CreateShortUrl} />\n <Route path=\"/server/:serverId/short-code/:shortCode/visits\" component={ShortUrlVisits} />\n <Route path=\"/server/:serverId/short-code/:shortCode/edit\" component={EditShortUrl} />\n {addTagsVisitsRoute && <Route path=\"/server/:serverId/tag/:tag/visits\" component={TagVisits} />}\n {addOrphanVisitsRoute && <Route path=\"/server/:serverId/orphan-visits\" component={OrphanVisits} />}\n <Route exact path=\"/server/:serverId/manage-tags\" component={TagsList} />\n <Route\n render={() => <NotFound to={`/server/${selectedServer.id}/list-short-urls/1`}>List short URLs</NotFound>}\n />\n </Switch>\n </div>\n </div>\n </div>\n </div>\n </>\n );\n}, ServerError);\n\nexport default MenuLayout;\n","import {\n faList as listIcon,\n faLink as createIcon,\n faTags as tagsIcon,\n faPen as editIcon,\n faHome as overviewIcon,\n} from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { FC } from 'react';\nimport { NavLink, NavLinkProps } from 'react-router-dom';\nimport classNames from 'classnames';\nimport { Location } from 'history';\nimport { DeleteServerButtonProps } from '../servers/DeleteServerButton';\nimport { ServerWithId } from '../servers/data';\nimport './AsideMenu.scss';\n\nexport interface AsideMenuProps {\n selectedServer: ServerWithId;\n className?: string;\n showOnMobile?: boolean;\n}\n\ninterface AsideMenuItemProps extends NavLinkProps {\n to: string;\n}\n\nconst AsideMenuItem: FC<AsideMenuItemProps> = ({ children, to, className, ...rest }) => (\n <NavLink\n className={classNames('aside-menu__item', className)}\n activeClassName=\"aside-menu__item--selected\"\n to={to}\n {...rest}\n >\n {children}\n </NavLink>\n);\n\nconst AsideMenu = (DeleteServerButton: FC<DeleteServerButtonProps>) => (\n { selectedServer, showOnMobile = false }: AsideMenuProps,\n) => {\n const serverId = selectedServer ? selectedServer.id : '';\n const asideClass = classNames('aside-menu', {\n 'aside-menu--hidden': !showOnMobile,\n });\n const shortUrlsIsActive = (_: null, location: Location) => location.pathname.match('/list-short-urls') !== null;\n const buildPath = (suffix: string) => `/server/${serverId}${suffix}`;\n\n return (\n <aside className={asideClass}>\n <nav className=\"nav flex-column aside-menu__nav\">\n <AsideMenuItem to={buildPath('/overview')}>\n <FontAwesomeIcon icon={overviewIcon} />\n <span className=\"aside-menu__item-text\">Overview</span>\n </AsideMenuItem>\n <AsideMenuItem to={buildPath('/list-short-urls/1')} isActive={shortUrlsIsActive}>\n <FontAwesomeIcon icon={listIcon} />\n <span className=\"aside-menu__item-text\">List short URLs</span>\n </AsideMenuItem>\n <AsideMenuItem to={buildPath('/create-short-url')}>\n <FontAwesomeIcon icon={createIcon} flip=\"horizontal\" />\n <span className=\"aside-menu__item-text\">Create short URL</span>\n </AsideMenuItem>\n <AsideMenuItem to={buildPath('/manage-tags')}>\n <FontAwesomeIcon icon={tagsIcon} />\n <span className=\"aside-menu__item-text\">Manage tags</span>\n </AsideMenuItem>\n <AsideMenuItem to={buildPath('/edit')} className=\"aside-menu__item--push\">\n <FontAwesomeIcon icon={editIcon} />\n <span className=\"aside-menu__item-text\">Edit this server</span>\n </AsideMenuItem>\n <DeleteServerButton\n className=\"aside-menu__item aside-menu__item--danger\"\n textClassName=\"aside-menu__item-text\"\n server={selectedServer}\n />\n </nav>\n </aside>\n );\n};\n\nexport default AsideMenu;\n","import { isReachableServer, SelectedServer } from '../../servers/data';\nimport { versionMatch, Versions } from './version';\n\nconst serverMatchesVersions = (versions: Versions) => (selectedServer: SelectedServer): boolean =>\n isReachableServer(selectedServer) && versionMatch(selectedServer.version, versions);\n\nexport const supportsSettingShortCodeLength = serverMatchesVersions({ minVersion: '2.1.0' });\n\nexport const supportsTagVisits = serverMatchesVersions({ minVersion: '2.2.0' });\n\nexport const supportsListingDomains = serverMatchesVersions({ minVersion: '2.4.0' });\n\nexport const supportsQrCodeSvgFormat = supportsListingDomains;\n\nexport const supportsValidateUrl = supportsListingDomains;\n\nexport const supportsQrCodeSizeInQuery = serverMatchesVersions({ minVersion: '2.5.0' });\n\nexport const supportsShortUrlTitle = serverMatchesVersions({ minVersion: '2.6.0' });\n\nexport const supportsOrphanVisits = supportsShortUrlTitle;\n\nexport const supportsQrCodeMargin = supportsShortUrlTitle;\n\nexport const supportsTagsInPatch = supportsShortUrlTitle;\n\nexport const supportsBotVisits = serverMatchesVersions({ minVersion: '2.7.0' });\n\nexport const supportsCrawlableVisits = supportsBotVisits;\n","export const MAIN_COLOR = '#4696e5';\n\nexport const MAIN_COLOR_ALPHA = 'rgba(70, 150, 229, 0.4)';\n\nexport const HIGHLIGHTED_COLOR = '#f77f28';\n\nexport const HIGHLIGHTED_COLOR_ALPHA = 'rgba(247, 127, 40, 0.4)';\n\nexport const PRIMARY_LIGHT_COLOR = 'white';\n\nexport const PRIMARY_DARK_COLOR = '#161b22';\n\nexport type Theme = 'dark' | 'light';\n\nexport const changeThemeInMarkup = (theme: Theme) => {\n const html = document.getElementsByTagName('html');\n\n html?.[0]?.setAttribute('data-theme', theme);\n};\n\nexport const isDarkThemeEnabled = (): boolean => {\n const html = document.getElementsByTagName('html');\n\n return html?.[0]?.getAttribute('data-theme') === 'dark';\n};\n","import { FC } from 'react';\nimport { Card, Row } from 'reactstrap';\nimport classNames from 'classnames';\nimport { faCircleNotch as preloader } from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\n\ntype MessageType = 'default' | 'error';\n\nconst getClassForType = (type: MessageType) => {\n const map: Record<MessageType, string> = {\n error: 'border-danger',\n default: '',\n };\n\n return map[type];\n};\nconst getTextClassForType = (type: MessageType) => {\n const map: Record<MessageType, string> = {\n error: 'text-danger',\n default: 'text-muted',\n };\n\n return map[type];\n};\n\nexport interface MessageProps {\n className?: string;\n loading?: boolean;\n fullWidth?: boolean;\n type?: MessageType;\n}\n\nconst Message: FC<MessageProps> = ({ className, children, loading = false, type = 'default', fullWidth = false }) => {\n const classes = classNames({\n 'col-md-12': fullWidth,\n 'col-md-10 offset-md-1': !fullWidth,\n });\n\n return (\n <Row noGutters className={className}>\n <div className={classes}>\n <Card className={getClassForType(type)} body>\n <h3 className={classNames('text-center mb-0', getTextClassForType(type))}>\n {loading && <FontAwesomeIcon icon={preloader} spin />}\n {loading && <span className=\"ml-2\">{children ?? 'Loading...'}</span>}\n {!loading && children}\n </h3>\n </Card>\n </div>\n </Row>\n );\n};\n\nexport default Message;\n","import { FC } from 'react';\nimport './NoMenuLayout.scss';\n\nconst NoMenuLayout: FC = ({ children }) => <div className=\"no-menu-wrapper container-xl\">{children}</div>;\n\nexport default NoMenuLayout;\n","import { compare } from 'compare-versions';\nimport { identity, memoizeWith } from 'ramda';\nimport { Empty, hasValue } from '../utils';\n\ntype SemVerPatternFragment = `${bigint | '*'}`;\n\nexport type SemVerPattern = SemVerPatternFragment\n| `${SemVerPatternFragment}.${SemVerPatternFragment}`\n| `${SemVerPatternFragment}.${SemVerPatternFragment}.${SemVerPatternFragment}`;\n\nexport interface Versions {\n maxVersion?: SemVerPattern;\n minVersion?: SemVerPattern;\n}\n\nexport type SemVer = `${bigint}.${bigint}.${bigint}` | 'latest';\n\nexport const versionMatch = (versionToMatch: SemVer | Empty, { maxVersion, minVersion }: Versions): boolean => {\n if (!hasValue(versionToMatch)) {\n return false;\n }\n\n const matchesMinVersion = !minVersion || compare(versionToMatch, minVersion, '>=');\n const matchesMaxVersion = !maxVersion || compare(versionToMatch, maxVersion, '<=');\n\n return matchesMaxVersion && matchesMinVersion;\n};\n\nconst versionIsValidSemVer = memoizeWith(identity, (version: string): version is SemVer => {\n try {\n return compare(version, version, '=');\n } catch (e) {\n return false;\n }\n});\n\nexport const versionToPrintable = (version: string) => !versionIsValidSemVer(version) ? version : `v${version}`;\n\nexport const versionToSemVer = (defaultValue: SemVer = 'latest') =>\n (version: string): SemVer => versionIsValidSemVer(version) ? version : defaultValue;\n","import { useState } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faSearch as searchIcon } from '@fortawesome/free-solid-svg-icons';\nimport classNames from 'classnames';\nimport './SearchField.scss';\n\nconst DEFAULT_SEARCH_INTERVAL = 500;\nlet timer: NodeJS.Timeout | null;\n\ninterface SearchFieldProps {\n onChange: (value: string) => void;\n className?: string;\n placeholder?: string;\n large?: boolean;\n noBorder?: boolean;\n}\n\nconst SearchField = (\n { onChange, className, placeholder = 'Search...', large = true, noBorder = false }: SearchFieldProps,\n) => {\n const [ searchTerm, setSearchTerm ] = useState('');\n\n const resetTimer = () => {\n timer && clearTimeout(timer);\n timer = null;\n };\n const searchTermChanged = (newSearchTerm: string, timeout = DEFAULT_SEARCH_INTERVAL) => {\n setSearchTerm(newSearchTerm);\n\n resetTimer();\n\n timer = setTimeout(() => {\n onChange(newSearchTerm);\n resetTimer();\n }, timeout);\n };\n\n return (\n <div className={classNames('search-field', className)}>\n <input\n type=\"text\"\n className={classNames('form-control search-field__input', {\n 'form-control-lg': large,\n 'search-field__input--no-border': noBorder,\n })}\n placeholder={placeholder}\n value={searchTerm}\n onChange={(e) => searchTermChanged(e.target.value)}\n />\n <FontAwesomeIcon icon={searchIcon} className=\"search-field__icon\" />\n <div\n className=\"close search-field__close\"\n hidden={searchTerm === ''}\n id=\"search-field__close\"\n onClick={() => searchTermChanged('', 0)}\n >\n ×\n </div>\n </div>\n );\n};\n\nexport default SearchField;\n","import qs from 'qs';\nimport { isEmpty, isNil, reject } from 'ramda';\nimport { AxiosInstance, AxiosResponse, Method } from 'axios';\nimport { ShortUrlsListParams } from '../../short-urls/reducers/shortUrlsListParams';\nimport { ShortUrl, ShortUrlData } from '../../short-urls/data';\nimport { OptionalString } from '../../utils/utils';\nimport {\n ShlinkHealth,\n ShlinkMercureInfo,\n ShlinkShortUrlsResponse,\n ShlinkTags,\n ShlinkTagsResponse,\n ShlinkVisits,\n ShlinkVisitsParams,\n ShlinkShortUrlData,\n ShlinkDomain,\n ShlinkDomainsResponse,\n ShlinkVisitsOverview,\n} from '../types';\n\nconst buildShlinkBaseUrl = (url: string, apiVersion: number) => url ? `${url}/rest/v${apiVersion}` : '';\nconst rejectNilProps = reject(isNil);\n\nexport default class ShlinkApiClient {\n private apiVersion: number;\n\n public constructor(\n private readonly axios: AxiosInstance,\n private readonly baseUrl: string,\n private readonly apiKey: string,\n ) {\n this.apiVersion = 2;\n }\n\n public readonly listShortUrls = async (params: ShortUrlsListParams = {}): Promise<ShlinkShortUrlsResponse> =>\n this.performRequest<{ shortUrls: ShlinkShortUrlsResponse }>('/short-urls', 'GET', params)\n .then(({ data }) => data.shortUrls);\n\n public readonly createShortUrl = async (options: ShortUrlData): Promise<ShortUrl> => {\n const filteredOptions = reject((value) => isEmpty(value) || isNil(value), options as any);\n\n return this.performRequest<ShortUrl>('/short-urls', 'POST', {}, filteredOptions)\n .then((resp) => resp.data);\n };\n\n public readonly getShortUrlVisits = async (shortCode: string, query?: ShlinkVisitsParams): Promise<ShlinkVisits> =>\n this.performRequest<{ visits: ShlinkVisits }>(`/short-urls/${shortCode}/visits`, 'GET', query)\n .then(({ data }) => data.visits);\n\n public readonly getTagVisits = async (tag: string, query?: Omit<ShlinkVisitsParams, 'domain'>): Promise<ShlinkVisits> =>\n this.performRequest<{ visits: ShlinkVisits }>(`/tags/${tag}/visits`, 'GET', query)\n .then(({ data }) => data.visits);\n\n public readonly getOrphanVisits = async (query?: Omit<ShlinkVisitsParams, 'domain'>): Promise<ShlinkVisits> =>\n this.performRequest<{ visits: ShlinkVisits }>('/visits/orphan', 'GET', query)\n .then(({ data }) => data.visits);\n\n public readonly getVisitsOverview = async (): Promise<ShlinkVisitsOverview> =>\n this.performRequest<{ visits: ShlinkVisitsOverview }>('/visits', 'GET')\n .then(({ data }) => data.visits);\n\n public readonly getShortUrl = async (shortCode: string, domain?: OptionalString): Promise<ShortUrl> =>\n this.performRequest<ShortUrl>(`/short-urls/${shortCode}`, 'GET', { domain })\n .then(({ data }) => data);\n\n public readonly deleteShortUrl = async (shortCode: string, domain?: OptionalString): Promise<void> =>\n this.performRequest(`/short-urls/${shortCode}`, 'DELETE', { domain })\n .then(() => {});\n\n /* @deprecated. If using Shlink 2.6.0 or greater, use updateShortUrl instead */\n public readonly updateShortUrlTags = async (\n shortCode: string,\n domain: OptionalString,\n tags: string[],\n ): Promise<string[]> =>\n this.performRequest<{ tags: string[] }>(`/short-urls/${shortCode}/tags`, 'PUT', { domain }, { tags })\n .then(({ data }) => data.tags);\n\n public readonly updateShortUrl = async (\n shortCode: string,\n domain: OptionalString,\n data: ShlinkShortUrlData,\n ): Promise<ShortUrl> =>\n this.performRequest<ShortUrl>(`/short-urls/${shortCode}`, 'PATCH', { domain }, data)\n .then(({ data }) => data);\n\n public readonly listTags = async (): Promise<ShlinkTags> =>\n this.performRequest<{ tags: ShlinkTagsResponse }>('/tags', 'GET', { withStats: 'true' })\n .then((resp) => resp.data.tags)\n .then(({ data, stats }) => ({ tags: data, stats }));\n\n public readonly deleteTags = async (tags: string[]): Promise<{ tags: string[] }> =>\n this.performRequest('/tags', 'DELETE', { tags })\n .then(() => ({ tags }));\n\n public readonly editTag = async (oldName: string, newName: string): Promise<{ oldName: string; newName: string }> =>\n this.performRequest('/tags', 'PUT', {}, { oldName, newName })\n .then(() => ({ oldName, newName }));\n\n public readonly health = async (): Promise<ShlinkHealth> =>\n this.performRequest<ShlinkHealth>('/health', 'GET')\n .then((resp) => resp.data);\n\n public readonly mercureInfo = async (): Promise<ShlinkMercureInfo> =>\n this.performRequest<ShlinkMercureInfo>('/mercure-info', 'GET')\n .then((resp) => resp.data);\n\n public readonly listDomains = async (): Promise<ShlinkDomain[]> =>\n this.performRequest<{ domains: ShlinkDomainsResponse }>('/domains', 'GET').then(({ data }) => data.domains.data);\n\n private readonly performRequest = async <T>(url: string, method: Method = 'GET', query = {}, body = {}): Promise<AxiosResponse<T>> => {\n try {\n return await this.axios({\n method,\n url: `${buildShlinkBaseUrl(this.baseUrl, this.apiVersion)}${url}`,\n headers: { 'X-Api-Key': this.apiKey },\n params: rejectNilProps(query),\n data: body,\n paramsSerializer: (params) => qs.stringify(params, { arrayFormat: 'brackets' }),\n });\n } catch (e) {\n const { response } = e;\n\n // Due to a bug on all previous Shlink versions, requests to non-matching URLs will always result on a CORS error\n // when performed from the browser (due to the preflight request not returning a 2xx status.\n // See https://github.com/shlinkio/shlink/issues/614), which will make the \"response\" prop not to be set here.\n // The bug will be fixed on upcoming Shlink patches, but for other versions, we can consider this situation as\n // if a request has been performed to a not supported API version.\n const apiVersionIsNotSupported = !response;\n\n // When the request is not invalid or we have already tried both API versions, throw the error and let the\n // caller handle it\n if (!apiVersionIsNotSupported || this.apiVersion === 2) {\n throw e;\n }\n\n this.apiVersion = this.apiVersion - 1;\n\n return await this.performRequest(url, method, query, body);\n }\n };\n}\n","import { AxiosInstance } from 'axios';\nimport { prop } from 'ramda';\nimport { hasServerData, SelectedServer, ServerWithId } from '../../servers/data';\nimport { GetState } from '../../container/types';\nimport ShlinkApiClient from './ShlinkApiClient';\n\nconst apiClients: Record<string, ShlinkApiClient> = {};\n\nconst isGetState = (getStateOrSelectedServer: GetState | ServerWithId): getStateOrSelectedServer is GetState =>\n typeof getStateOrSelectedServer === 'function';\nconst getSelectedServerFromState = (getState: GetState): SelectedServer => prop('selectedServer', getState());\n\nexport type ShlinkApiClientBuilder = (getStateOrSelectedServer: GetState | ServerWithId) => ShlinkApiClient;\n\nconst buildShlinkApiClient = (axios: AxiosInstance): ShlinkApiClientBuilder => (\n getStateOrSelectedServer: GetState | ServerWithId,\n) => {\n const server = isGetState(getStateOrSelectedServer)\n ? getSelectedServerFromState(getStateOrSelectedServer)\n : getStateOrSelectedServer;\n\n if (!hasServerData(server)) {\n throw new Error('There\\'s no selected server or it is not found');\n }\n\n const { url, apiKey } = server;\n const clientKey = `${url}_${apiKey}`;\n\n if (!apiClients[clientKey]) {\n apiClients[clientKey] = new ShlinkApiClient(axios, url, apiKey);\n }\n\n return apiClients[clientKey];\n};\n\nexport default buildShlinkApiClient;\n","import Bottle from 'bottlejs';\nimport buildShlinkApiClient from './ShlinkApiClientBuilder';\n\nconst provideServices = (bottle: Bottle) => {\n bottle.serviceFactory('buildShlinkApiClient', buildShlinkApiClient, 'axios');\n};\n\nexport default provideServices;\n","import { FC, useEffect, useState } from 'react';\nimport { ShortUrlsListProps } from './ShortUrlsList';\n\nconst ShortUrls = (SearchBar: FC, ShortUrlsList: FC<ShortUrlsListProps>) => (props: ShortUrlsListProps) => {\n const { match } = props;\n const { page = '1', serverId = '' } = match?.params ?? {};\n const [ urlsListKey, setUrlsListKey ] = useState(`${serverId}_${page}`);\n\n // Using a key on a component makes react to create a new instance every time the key changes\n // Without it, pagination on the URL will not make the component to be refreshed\n useEffect(() => {\n setUrlsListKey(`${serverId}_${page}`);\n }, [ serverId, page ]);\n\n return (\n <>\n <div className=\"form-group\"><SearchBar /></div>\n <ShortUrlsList {...props} key={urlsListKey} />\n </>\n );\n};\n\nexport default ShortUrls;\n","import { FC, MouseEventHandler } from 'react';\nimport ColorGenerator from '../../utils/services/ColorGenerator';\nimport './Tag.scss';\n\ninterface TagProps {\n colorGenerator: ColorGenerator;\n text: string;\n className?: string;\n clearable?: boolean;\n onClick?: MouseEventHandler;\n onClose?: MouseEventHandler;\n}\n\nconst Tag: FC<TagProps> = ({ text, children, clearable, className = '', colorGenerator, onClick, onClose }) => (\n <span\n className={`badge tag ${className}`}\n style={{ backgroundColor: colorGenerator.getColorForKey(text), cursor: clearable || !onClick ? 'auto' : 'pointer' }}\n onClick={onClick}\n >\n {children ?? text}\n {clearable && <span className=\"close tag__close-selected-tag\" onClick={onClose}>×</span>}\n </span>\n);\n\nexport default Tag;\n","import { FC } from 'react';\nimport { Dropdown, DropdownMenu, DropdownToggle } from 'reactstrap';\nimport { useToggle } from './helpers/hooks';\nimport './DropdownBtn.scss';\n\nexport interface DropdownBtnProps {\n text: string;\n disabled?: boolean;\n className?: string;\n dropdownClassName?: string;\n right?: boolean;\n minWidth?: number;\n}\n\nexport const DropdownBtn: FC<DropdownBtnProps> = (\n { text, disabled = false, className = '', children, dropdownClassName, right = false, minWidth },\n) => {\n const [ isOpen, toggle ] = useToggle();\n const toggleClasses = `dropdown-btn__toggle btn-block ${className}`;\n const style = { minWidth: minWidth && `${minWidth}px` };\n\n return (\n <Dropdown isOpen={isOpen} toggle={toggle} disabled={disabled} className={dropdownClassName}>\n <DropdownToggle caret className={toggleClasses} color=\"primary\">{text}</DropdownToggle>\n <DropdownMenu className=\"w-100\" right={right} style={style}>{children}</DropdownMenu>\n </Dropdown>\n );\n};\n","import { format, formatISO, parse } from 'date-fns';\nimport { OptionalString } from '../utils';\n\ntype DateOrString = Date | string;\ntype NullableDate = DateOrString | null;\n\nexport const isDateObject = (date: DateOrString): date is Date => typeof date !== 'string';\n\nconst formatDateFromFormat = (date?: NullableDate, theFormat?: string): OptionalString => {\n if (!date || !isDateObject(date)) {\n return date;\n }\n\n return theFormat ? format(date, theFormat) : formatISO(date);\n};\n\nexport const formatDate = (format = 'yyyy-MM-dd') => (date?: NullableDate) => formatDateFromFormat(date, format);\n\nexport const formatIsoDate = (date?: NullableDate) => formatDateFromFormat(date, undefined);\n\nexport const formatInternational = formatDate();\n\nexport const parseDate = (date: string, format: string) => parse(date, format, new Date());\n","import { subDays, startOfDay, endOfDay } from 'date-fns';\nimport { filter, isEmpty } from 'ramda';\nimport { formatInternational } from '../../helpers/date';\n\nexport interface DateRange {\n startDate?: Date | null;\n endDate?: Date | null;\n}\n\nexport type DateInterval = 'today' | 'yesterday' | 'last7Days' | 'last30Days' | 'last90Days' | 'last180days' | 'last365Days';\n\nexport const dateRangeIsEmpty = (dateRange?: DateRange): boolean => dateRange === undefined\n || isEmpty(filter(Boolean, dateRange as any));\n\nexport const rangeIsInterval = (range?: DateRange | DateInterval): range is DateInterval => typeof range === 'string';\n\nconst INTERVAL_TO_STRING_MAP: Record<DateInterval, string> = {\n today: 'Today',\n yesterday: 'Yesterday',\n last7Days: 'Last 7 days',\n last30Days: 'Last 30 days',\n last90Days: 'Last 90 days',\n last180days: 'Last 180 days',\n last365Days: 'Last 365 days',\n};\n\nexport const DATE_INTERVALS: DateInterval[] = Object.keys(INTERVAL_TO_STRING_MAP) as DateInterval[];\n\nconst dateRangeToString = (range?: DateRange): string | undefined => {\n if (!range || dateRangeIsEmpty(range)) {\n return undefined;\n }\n\n if (range.startDate && !range.endDate) {\n return `Since ${formatInternational(range.startDate)}`;\n }\n\n if (!range.startDate && range.endDate) {\n return `Until ${formatInternational(range.endDate)}`;\n }\n\n return `${formatInternational(range.startDate)} - ${formatInternational(range.endDate)}`;\n};\n\nexport const rangeOrIntervalToString = (range?: DateRange | DateInterval): string | undefined => {\n if (!range) {\n return undefined;\n }\n\n if (!rangeIsInterval(range)) {\n return dateRangeToString(range);\n }\n\n return INTERVAL_TO_STRING_MAP[range];\n};\n\nconst startOfDaysAgo = (daysAgo: number) => startOfDay(subDays(new Date(), daysAgo));\n\nexport const intervalToDateRange = (dateInterval?: DateInterval): DateRange => {\n if (!dateInterval) {\n return {};\n }\n\n switch (dateInterval) {\n case 'today':\n return { startDate: startOfDay(new Date()), endDate: new Date() };\n case 'yesterday':\n return { startDate: startOfDaysAgo(1), endDate: endOfDay(subDays(new Date(), 1)) };\n case 'last7Days':\n return { startDate: startOfDaysAgo(7), endDate: new Date() };\n case 'last30Days':\n return { startDate: startOfDaysAgo(30), endDate: new Date() };\n case 'last90Days':\n return { startDate: startOfDaysAgo(90), endDate: new Date() };\n case 'last180days':\n return { startDate: startOfDaysAgo(180), endDate: new Date() };\n case 'last365Days':\n return { startDate: startOfDaysAgo(365), endDate: new Date() };\n }\n\n return {};\n};\n","import { useRef } from 'react';\nimport { isNil } from 'ramda';\nimport DatePicker, { ReactDatePickerProps } from 'react-datepicker';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faCalendarAlt as calendarIcon } from '@fortawesome/free-regular-svg-icons';\nimport classNames from 'classnames';\nimport './DateInput.scss';\n\nexport type DateInputProps = ReactDatePickerProps;\n\nconst DateInput = (props: DateInputProps) => {\n const { className, isClearable, selected } = props;\n const showCalendarIcon = !isClearable || isNil(selected);\n const ref = useRef<{ input: HTMLInputElement }>();\n\n return (\n <div className=\"date-input-container\">\n <DatePicker\n {...props}\n dateFormat=\"yyyy-MM-dd\"\n className={classNames('date-input-container__input form-control', className)}\n // @ts-expect-error The DatePicker type definition is wrong. It has a ref prop\n ref={ref}\n />\n {showCalendarIcon && (\n <FontAwesomeIcon\n icon={calendarIcon}\n className=\"date-input-container__icon\"\n onClick={() => ref.current?.input.focus()}\n />\n )}\n </div>\n );\n};\n\nexport default DateInput;\n","import DateInput from '../DateInput';\nimport { DateRange } from './types';\n\ninterface DateRangeRowProps extends DateRange {\n onStartDateChange: (date: Date | null) => void;\n onEndDateChange: (date: Date | null) => void;\n disabled?: boolean;\n}\n\nconst DateRangeRow = (\n { startDate = null, endDate = null, disabled = false, onStartDateChange, onEndDateChange }: DateRangeRowProps,\n) => (\n <div className=\"row\">\n <div className=\"col-md-6\">\n <DateInput\n selected={startDate}\n placeholderText=\"Since...\"\n isClearable\n maxDate={endDate ?? undefined}\n disabled={disabled}\n onChange={onStartDateChange}\n />\n </div>\n <div className=\"col-md-6\">\n <DateInput\n className=\"mt-2 mt-md-0\"\n selected={endDate}\n placeholderText=\"Until...\"\n isClearable\n minDate={startDate ?? undefined}\n disabled={disabled}\n onChange={onEndDateChange}\n />\n </div>\n </div>\n);\n\nexport default DateRangeRow;\n","import { DropdownItem } from 'reactstrap';\nimport { FC } from 'react';\nimport { DATE_INTERVALS, DateInterval, rangeOrIntervalToString } from './types';\n\nexport interface DateIntervalDropdownProps {\n active?: DateInterval;\n onChange: (interval: DateInterval) => void;\n}\n\nexport const DateIntervalDropdownItems: FC<DateIntervalDropdownProps> = ({ active, onChange }) => (\n <>\n {DATE_INTERVALS.map(\n (interval) => (\n <DropdownItem key={interval} active={active === interval} onClick={() => onChange(interval)}>\n {rangeOrIntervalToString(interval)}\n </DropdownItem>\n ),\n )}\n </>\n);\n","import { useState } from 'react';\nimport { DropdownItem } from 'reactstrap';\nimport { DropdownBtn } from '../DropdownBtn';\nimport {\n DateInterval,\n DateRange,\n dateRangeIsEmpty,\n rangeOrIntervalToString,\n intervalToDateRange,\n rangeIsInterval,\n} from './types';\nimport DateRangeRow from './DateRangeRow';\nimport { DateIntervalDropdownItems } from './DateIntervalDropdownItems';\n\nexport interface DateRangeSelectorProps {\n initialDateRange?: DateInterval | DateRange;\n disabled?: boolean;\n onDatesChange: (dateRange: DateRange) => void;\n defaultText: string;\n}\n\nexport const DateRangeSelector = (\n { onDatesChange, initialDateRange, defaultText, disabled }: DateRangeSelectorProps,\n) => {\n const [ activeInterval, setActiveInterval ] = useState(\n rangeIsInterval(initialDateRange) ? initialDateRange : undefined,\n );\n const [ activeDateRange, setActiveDateRange ] = useState(\n !rangeIsInterval(initialDateRange) ? initialDateRange : undefined,\n );\n const updateDateRange = (dateRange: DateRange) => {\n setActiveInterval(undefined);\n setActiveDateRange(dateRange);\n onDatesChange(dateRange);\n };\n const updateInterval = (dateInterval?: DateInterval) => () => {\n setActiveInterval(dateInterval);\n setActiveDateRange(undefined);\n onDatesChange(intervalToDateRange(dateInterval));\n };\n\n return (\n <DropdownBtn disabled={disabled} text={rangeOrIntervalToString(activeInterval ?? activeDateRange) ?? defaultText}>\n <DropdownItem\n active={activeInterval === undefined && dateRangeIsEmpty(activeDateRange)}\n onClick={updateInterval(undefined)}\n >\n {defaultText}\n </DropdownItem>\n <DropdownItem divider />\n <DateIntervalDropdownItems active={activeInterval} onChange={(interval) => updateInterval(interval)()} />\n <DropdownItem divider />\n <DropdownItem header>Custom:</DropdownItem>\n <DropdownItem text>\n <DateRangeRow\n {...activeDateRange}\n onStartDateChange={(startDate) => updateDateRange({ ...activeDateRange, startDate })}\n onEndDateChange={(endDate) => updateDateRange({ ...activeDateRange, endDate })}\n />\n </DropdownItem>\n </DropdownBtn>\n );\n};\n","import { faTags as tagsIcon } from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { isEmpty, pipe } from 'ramda';\nimport { parseISO } from 'date-fns';\nimport SearchField from '../utils/SearchField';\nimport Tag from '../tags/helpers/Tag';\nimport { DateRangeSelector } from '../utils/dates/DateRangeSelector';\nimport { formatIsoDate } from '../utils/helpers/date';\nimport ColorGenerator from '../utils/services/ColorGenerator';\nimport { DateRange } from '../utils/dates/types';\nimport { ShortUrlsListParams } from './reducers/shortUrlsListParams';\nimport './SearchBar.scss';\n\ninterface SearchBarProps {\n listShortUrls: (params: ShortUrlsListParams) => void;\n shortUrlsListParams: ShortUrlsListParams;\n}\n\nconst dateOrNull = (date?: string) => date ? parseISO(date) : null;\n\nconst SearchBar = (colorGenerator: ColorGenerator) => ({ listShortUrls, shortUrlsListParams }: SearchBarProps) => {\n const selectedTags = shortUrlsListParams.tags ?? [];\n const setDates = pipe(\n ({ startDate, endDate }: DateRange) => ({\n startDate: formatIsoDate(startDate) ?? undefined,\n endDate: formatIsoDate(endDate) ?? undefined,\n }),\n (dates) => listShortUrls({ ...shortUrlsListParams, ...dates }),\n );\n\n return (\n <div className=\"search-bar-container\">\n <SearchField\n onChange={\n (searchTerm) => listShortUrls({ ...shortUrlsListParams, searchTerm })\n }\n />\n\n <div className=\"mt-3\">\n <div className=\"row\">\n <div className=\"col-lg-8 offset-lg-4 col-xl-6 offset-xl-6\">\n <DateRangeSelector\n defaultText=\"All short URLs\"\n initialDateRange={{\n startDate: dateOrNull(shortUrlsListParams.startDate),\n endDate: dateOrNull(shortUrlsListParams.endDate),\n }}\n onDatesChange={setDates}\n />\n </div>\n </div>\n </div>\n\n {!isEmpty(selectedTags) && (\n <h4 className=\"search-bar__selected-tag mt-3\">\n <FontAwesomeIcon icon={tagsIcon} className=\"search-bar__tags-icon\" />\n \n {selectedTags.map((tag) => (\n <Tag\n colorGenerator={colorGenerator}\n key={tag}\n text={tag}\n clearable\n onClose={() => listShortUrls(\n {\n ...shortUrlsListParams,\n tags: selectedTags.filter((selectedTag) => selectedTag !== tag),\n },\n )}\n />\n ))}\n </h4>\n )}\n </div>\n );\n};\n\nexport default SearchBar;\n","import { UncontrolledDropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap';\nimport { toPairs } from 'ramda';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faSortAmountUp as sortAscIcon, faSortAmountDown as sortDescIcon } from '@fortawesome/free-solid-svg-icons';\nimport classNames from 'classnames';\nimport { determineOrderDir, OrderDir } from './utils';\nimport './SortingDropdown.scss';\n\nexport interface SortingDropdownProps<T extends string = string> {\n items: Record<T, string>;\n orderField?: T;\n orderDir?: OrderDir;\n onChange: (orderField?: T, orderDir?: OrderDir) => void;\n isButton?: boolean;\n right?: boolean;\n}\n\nexport default function SortingDropdown<T extends string = string>(\n { items, orderField, orderDir, onChange, isButton = true, right = false }: SortingDropdownProps<T>,\n) {\n const handleItemClick = (fieldKey: T) => () => {\n const newOrderDir = determineOrderDir(fieldKey, orderField, orderDir);\n\n onChange(newOrderDir ? fieldKey : undefined, newOrderDir);\n };\n\n return (\n <UncontrolledDropdown>\n <DropdownToggle\n caret\n color={isButton ? 'primary' : 'link'}\n className={classNames({ 'dropdown-btn__toggle btn-block': isButton, 'btn-sm p-0': !isButton })}\n >\n {!isButton && <>Order by</>}\n {isButton && !orderField && <>Order by...</>}\n {isButton && orderField && `Order by: \"${items[orderField]}\" - \"${orderDir ?? 'DESC'}\"`}\n </DropdownToggle>\n <DropdownMenu\n right={right}\n className={classNames('w-100', { 'sorting-dropdown__menu--link': !isButton })}\n >\n {toPairs(items).map(([ fieldKey, fieldValue ]) => (\n <DropdownItem key={fieldKey} active={orderField === fieldKey} onClick={handleItemClick(fieldKey as T)}>\n {fieldValue}\n {orderField === fieldKey && (\n <FontAwesomeIcon\n icon={orderDir === 'ASC' ? sortAscIcon : sortDescIcon}\n className=\"sorting-dropdown__sort-icon\"\n />\n )}\n </DropdownItem>\n ))}\n <DropdownItem divider />\n <DropdownItem disabled={!orderField} onClick={() => onChange()}>\n <i>Clear selection</i>\n </DropdownItem>\n </DropdownMenu>\n </UncontrolledDropdown>\n );\n}\n","import { FC, useEffect } from 'react';\nimport { pipe } from 'ramda';\nimport { CreateVisit } from '../../visits/types';\nimport { MercureInfo } from '../reducers/mercureInfo';\nimport { bindToMercureTopic } from './index';\n\nexport interface MercureBoundProps {\n createNewVisits: (createdVisits: CreateVisit[]) => void;\n loadMercureInfo: () => void;\n mercureInfo: MercureInfo;\n}\n\nexport function boundToMercureHub<T = {}>(\n WrappedComponent: FC<MercureBoundProps & T>,\n getTopicsForProps: (props: T) => string[],\n) {\n const pendingUpdates = new Set<CreateVisit>();\n\n return (props: MercureBoundProps & T) => {\n const { createNewVisits, loadMercureInfo, mercureInfo } = props;\n const { interval } = mercureInfo;\n\n useEffect(() => {\n const onMessage = (visit: CreateVisit) => interval ? pendingUpdates.add(visit) : createNewVisits([ visit ]);\n const closeEventSource = bindToMercureTopic(mercureInfo, getTopicsForProps(props), onMessage, loadMercureInfo);\n\n if (!interval) {\n return closeEventSource;\n }\n\n const timer = setInterval(() => {\n createNewVisits([ ...pendingUpdates ]);\n pendingUpdates.clear();\n }, interval * 1000 * 60);\n\n return pipe(() => clearInterval(timer), () => closeEventSource?.());\n }, [ mercureInfo ]);\n\n return <WrappedComponent {...props} />;\n };\n}\n","import { EventSourcePolyfill as EventSource } from 'event-source-polyfill';\nimport { MercureInfo } from '../reducers/mercureInfo';\n\nexport const bindToMercureTopic = <T>(mercureInfo: MercureInfo, topics: string[], onMessage: (message: T) => void, onTokenExpired: () => void) => { // eslint-disable-line max-len\n const { mercureHubUrl, token, loading, error } = mercureInfo;\n\n if (loading || error || !mercureHubUrl) {\n return undefined;\n }\n\n const onEventSourceMessage = ({ data }: { data: string }) => onMessage(JSON.parse(data) as T);\n const onEventSourceError = ({ status }: { status: number }) => status === 401 && onTokenExpired();\n\n const subscriptions = topics.map((topic) => {\n const hubUrl = new URL(mercureHubUrl);\n\n hubUrl.searchParams.append('topic', topic);\n const es = new EventSource(hubUrl, {\n headers: {\n Authorization: `Bearer ${token}`,\n },\n });\n\n es.onmessage = onEventSourceMessage;\n es.onerror = onEventSourceError;\n\n return es;\n });\n\n return () => subscriptions.forEach((es) => es.close());\n};\n","import qs from 'qs';\n\nexport const parseQuery = <T>(search: string) => qs.parse(search, { ignoreQueryPrefix: true }) as unknown as T;\n\nexport const stringifyQuery = (query: any): string => qs.stringify(query, { arrayFormat: 'brackets' });\n","export class Topics {\n public static visits = () => 'https://shlink.io/new-visit';\n\n public static shortUrlVisits = (shortCode: string) => `https://shlink.io/new-visit/${shortCode}`;\n\n public static orphanVisits = () => 'https://shlink.io/new-orphan-visit';\n}\n","import { Action } from 'redux';\n\ntype ActionHandler<State, AT> = (currentState: State, action: AT) => State;\ntype ActionHandlerMap<State, AT> = Record<string, ActionHandler<State, AT>>;\n\nexport const buildReducer = <State, AT extends Action>(map: ActionHandlerMap<State, AT>, initialState: State) => (\n state: State | undefined,\n action: AT,\n): State => {\n const { type } = action;\n const actionHandler = map[type];\n const currentState = state ?? initialState;\n\n return actionHandler ? actionHandler(currentState, action) : currentState;\n};\n\nexport const buildActionCreator = <T extends string>(type: T) => (): Action<T> => ({ type });\n","import { isEmpty, propEq, values } from 'ramda';\nimport { useState, useEffect, useMemo, FC } from 'react';\nimport { Button, Card, Nav, NavLink, Progress, Row } from 'reactstrap';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faCalendarAlt, faMapMarkedAlt, faList, faChartPie, faFileDownload } from '@fortawesome/free-solid-svg-icons';\nimport { IconDefinition } from '@fortawesome/fontawesome-common-types';\nimport { Route, Switch, NavLink as RouterNavLink, Redirect } from 'react-router-dom';\nimport { Location } from 'history';\nimport classNames from 'classnames';\nimport { DateRangeSelector } from '../utils/dates/DateRangeSelector';\nimport Message from '../utils/Message';\nimport { DateInterval, DateRange, intervalToDateRange } from '../utils/dates/types';\nimport { Result } from '../utils/Result';\nimport { ShlinkApiError } from '../api/ShlinkApiError';\nimport { Settings } from '../settings/reducers/settings';\nimport { SelectedServer } from '../servers/data';\nimport { supportsBotVisits } from '../utils/helpers/features';\nimport SortableBarGraph from './helpers/SortableBarGraph';\nimport GraphCard from './helpers/GraphCard';\nimport LineChartCard from './helpers/LineChartCard';\nimport VisitsTable from './VisitsTable';\nimport { NormalizedOrphanVisit, NormalizedVisit, VisitsFilter, VisitsInfo, VisitsParams } from './types';\nimport OpenMapModalBtn from './helpers/OpenMapModalBtn';\nimport { normalizeVisits, processStatsFromVisits } from './services/VisitsParser';\nimport { VisitsFilterDropdown } from './helpers/VisitsFilterDropdown';\nimport { HighlightableProps, highlightedVisitsToStats } from './types/helpers';\nimport './VisitsStats.scss';\n\nexport interface VisitsStatsProps {\n getVisits: (params: VisitsParams) => void;\n visitsInfo: VisitsInfo;\n settings: Settings;\n selectedServer: SelectedServer;\n cancelGetVisits: () => void;\n baseUrl: string;\n domain?: string;\n exportCsv: (visits: NormalizedVisit[]) => void;\n isOrphanVisits?: boolean;\n}\n\ninterface VisitsNavLinkProps {\n title: string;\n subPath: string;\n icon: IconDefinition;\n}\n\ntype Section = 'byTime' | 'byContext' | 'byLocation' | 'list';\n\nconst sections: Record<Section, VisitsNavLinkProps> = {\n byTime: { title: 'By time', subPath: '', icon: faCalendarAlt },\n byContext: { title: 'By context', subPath: '/by-context', icon: faChartPie },\n byLocation: { title: 'By location', subPath: '/by-location', icon: faMapMarkedAlt },\n list: { title: 'List', subPath: '/list', icon: faList },\n};\n\nlet selectedBar: string | undefined;\n\nconst VisitsNavLink: FC<VisitsNavLinkProps & { to: string }> = ({ subPath, title, icon, to }) => (\n <NavLink\n tag={RouterNavLink}\n className=\"visits-stats__nav-link\"\n to={to}\n isActive={(_: null, { pathname }: Location) => pathname.endsWith(`visits${subPath}`)}\n replace\n >\n <FontAwesomeIcon icon={icon} />\n <span className=\"ml-2 d-none d-sm-inline\">{title}</span>\n </NavLink>\n);\n\nconst VisitsStats: FC<VisitsStatsProps> = ({\n children,\n visitsInfo,\n getVisits,\n cancelGetVisits,\n baseUrl,\n domain,\n settings,\n exportCsv,\n selectedServer,\n isOrphanVisits = false,\n}) => {\n const initialInterval: DateInterval = settings.visits?.defaultInterval ?? 'last30Days';\n const [ dateRange, setDateRange ] = useState<DateRange>(intervalToDateRange(initialInterval));\n const [ highlightedVisits, setHighlightedVisits ] = useState<NormalizedVisit[]>([]);\n const [ highlightedLabel, setHighlightedLabel ] = useState<string | undefined>();\n const [ visitsFilter, setVisitsFilter ] = useState<VisitsFilter>({});\n const botsSupported = supportsBotVisits(selectedServer);\n\n const buildSectionUrl = (subPath?: string) => {\n const query = domain ? `?domain=${domain}` : '';\n\n return !subPath ? `${baseUrl}${query}` : `${baseUrl}${subPath}${query}`;\n };\n const { visits, loading, loadingLarge, error, errorData, progress } = visitsInfo;\n const normalizedVisits = useMemo(() => normalizeVisits(visits), [ visits ]);\n const { os, browsers, referrers, countries, cities, citiesForMap, visitedUrls } = useMemo(\n () => processStatsFromVisits(normalizedVisits),\n [ normalizedVisits ],\n );\n const mapLocations = values(citiesForMap);\n\n const setSelectedVisits = (selectedVisits: NormalizedVisit[]) => {\n selectedBar = undefined;\n setHighlightedVisits(selectedVisits);\n };\n const highlightVisitsForProp = (prop: HighlightableProps<NormalizedOrphanVisit>) => (value: string) => {\n const newSelectedBar = `${prop}_${value}`;\n\n if (selectedBar === newSelectedBar) {\n setHighlightedVisits([]);\n setHighlightedLabel(undefined);\n selectedBar = undefined;\n } else {\n setHighlightedVisits((normalizedVisits as NormalizedOrphanVisit[]).filter(propEq(prop, value)));\n setHighlightedLabel(value);\n selectedBar = newSelectedBar;\n }\n };\n\n useEffect(() => cancelGetVisits, []);\n useEffect(() => {\n getVisits({ dateRange, filter: visitsFilter });\n }, [ dateRange, visitsFilter ]);\n\n const renderVisitsContent = () => {\n if (loadingLarge) {\n return (\n <Message loading>\n This is going to take a while... :S\n <Progress value={progress} striped={progress === 100} className=\"mt-3\" />\n </Message>\n );\n }\n\n if (loading) {\n return <Message loading />;\n }\n\n if (error) {\n return (\n <Result type=\"error\">\n <ShlinkApiError errorData={errorData} fallbackMessage=\"An error occurred while loading visits :(\" />\n </Result>\n );\n }\n\n if (isEmpty(visits)) {\n return <Message>There are no visits matching current filter :(</Message>;\n }\n\n return (\n <>\n <Card className=\"visits-stats__nav p-0 overflow-hidden\" body>\n <Nav pills fill>\n {Object.entries(sections).map(([ section, props ]) =>\n <VisitsNavLink key={section} {...props} to={buildSectionUrl(props.subPath)} />)}\n </Nav>\n </Card>\n <Row>\n <Switch>\n <Route exact path={baseUrl}>\n <div className=\"col-12 mt-3\">\n <LineChartCard\n title=\"Visits during time\"\n visits={normalizedVisits}\n highlightedVisits={highlightedVisits}\n highlightedLabel={highlightedLabel}\n setSelectedVisits={setSelectedVisits}\n />\n </div>\n </Route>\n\n <Route exact path={`${baseUrl}${sections.byContext.subPath}`}>\n <div className={classNames('mt-3 col-lg-6', { 'col-xl-4': !isOrphanVisits })}>\n <GraphCard title=\"Operating systems\" stats={os} />\n </div>\n <div className={classNames('mt-3 col-lg-6', { 'col-xl-4': !isOrphanVisits })}>\n <GraphCard title=\"Browsers\" stats={browsers} />\n </div>\n <div className={classNames('mt-3', { 'col-xl-4': !isOrphanVisits, 'col-lg-6': isOrphanVisits })}>\n <SortableBarGraph\n title=\"Referrers\"\n stats={referrers}\n withPagination={false}\n highlightedStats={highlightedVisitsToStats(highlightedVisits, 'referer')}\n highlightedLabel={highlightedLabel}\n sortingItems={{\n name: 'Referrer name',\n amount: 'Visits amount',\n }}\n onClick={highlightVisitsForProp('referer')}\n />\n </div>\n {isOrphanVisits && (\n <div className=\"mt-3 col-lg-6\">\n <SortableBarGraph\n title=\"Visited URLs\"\n stats={visitedUrls}\n highlightedLabel={highlightedLabel}\n highlightedStats={highlightedVisitsToStats(highlightedVisits, 'visitedUrl')}\n sortingItems={{\n visitedUrl: 'Visited URL',\n amount: 'Visits amount',\n }}\n onClick={highlightVisitsForProp('visitedUrl')}\n />\n </div>\n )}\n </Route>\n\n <Route exact path={`${baseUrl}${sections.byLocation.subPath}`}>\n <div className=\"col-lg-6 mt-3\">\n <SortableBarGraph\n title=\"Countries\"\n stats={countries}\n highlightedStats={highlightedVisitsToStats(highlightedVisits, 'country')}\n highlightedLabel={highlightedLabel}\n sortingItems={{\n name: 'Country name',\n amount: 'Visits amount',\n }}\n onClick={highlightVisitsForProp('country')}\n />\n </div>\n <div className=\"col-lg-6 mt-3\">\n <SortableBarGraph\n title=\"Cities\"\n stats={cities}\n highlightedStats={highlightedVisitsToStats(highlightedVisits, 'city')}\n highlightedLabel={highlightedLabel}\n extraHeaderContent={(activeCities: string[]) =>\n mapLocations.length > 0 &&\n <OpenMapModalBtn modalTitle=\"Cities\" locations={mapLocations} activeCities={activeCities} />\n }\n sortingItems={{\n name: 'City name',\n amount: 'Visits amount',\n }}\n onClick={highlightVisitsForProp('city')}\n />\n </div>\n </Route>\n\n <Route exact path={`${baseUrl}${sections.list.subPath}`}>\n <div className=\"col-12\">\n <VisitsTable\n visits={normalizedVisits}\n selectedVisits={highlightedVisits}\n setSelectedVisits={setSelectedVisits}\n isOrphanVisits={isOrphanVisits}\n selectedServer={selectedServer}\n />\n </div>\n </Route>\n\n <Redirect to={baseUrl} />\n </Switch>\n </Row>\n </>\n );\n };\n\n return (\n <>\n {children}\n\n <section className=\"mt-3\">\n <div className=\"row flex-md-row-reverse\">\n <div className=\"col-lg-7 col-xl-6\">\n <div className=\"d-md-flex\">\n <div className=\"flex-fill\">\n <DateRangeSelector\n disabled={loading}\n initialDateRange={initialInterval}\n defaultText=\"All visits\"\n onDatesChange={setDateRange}\n />\n </div>\n <VisitsFilterDropdown\n className=\"ml-0 ml-md-2 mt-3 mt-md-0\"\n isOrphanVisits={isOrphanVisits}\n botsSupported={botsSupported}\n selected={visitsFilter}\n onChange={setVisitsFilter}\n />\n </div>\n </div>\n {visits.length > 0 && (\n <div className=\"col-lg-5 col-xl-6 mt-3 mt-lg-0\">\n <div className=\"d-flex\">\n <Button\n outline\n disabled={highlightedVisits.length === 0}\n className=\"btn-md-block mr-2\"\n onClick={() => setSelectedVisits([])}\n >\n Clear selection {highlightedVisits.length > 0 && <>({highlightedVisits.length})</>}\n </Button>\n <Button\n outline\n color=\"primary\"\n className=\"btn-md-block\"\n onClick={() => exportCsv(normalizedVisits)}\n >\n <FontAwesomeIcon icon={faFileDownload} /> Export ({normalizedVisits.length})\n </Button>\n </div>\n </div>\n )}\n </div>\n </section>\n\n <section className=\"mt-3\">\n {renderVisitsContent()}\n </section>\n </>\n );\n};\n\nexport default VisitsStats;\n","import { isNil } from 'ramda';\nimport { ShortUrl } from '../data';\nimport { OptionalString } from '../../utils/utils';\n\nexport const shortUrlMatches = (shortUrl: ShortUrl, shortCode: string, domain: OptionalString): boolean => {\n if (isNil(domain)) {\n return shortUrl.shortCode === shortCode && !shortUrl.domain;\n }\n\n return shortUrl.shortCode === shortCode && shortUrl.domain === domain;\n};\n","import { Action } from 'redux';\nimport { CreateVisit } from '../types';\n\nexport const CREATE_VISITS = 'shlink/visitCreation/CREATE_VISITS';\n\nexport interface CreateVisitsAction extends Action<typeof CREATE_VISITS> {\n createdVisits: CreateVisit[];\n}\n\nexport const createNewVisits = (createdVisits: CreateVisit[]): CreateVisitsAction => ({\n type: CREATE_VISITS,\n createdVisits,\n});\n","import { AxiosError } from 'axios';\nimport { InvalidArgumentError, InvalidShortUrlDeletion, ProblemDetailsError } from '../types';\n\nexport const parseApiError = (e: AxiosError<ProblemDetailsError>) => e.response?.data;\n\nexport const isInvalidArgumentError = (error?: ProblemDetailsError): error is InvalidArgumentError =>\n error?.type === 'INVALID_ARGUMENT';\n\nexport const isInvalidDeletionError = (error?: ProblemDetailsError): error is InvalidShortUrlDeletion =>\n error?.type === 'INVALID_SHORTCODE_DELETION';\n","import { Action, Dispatch } from 'redux';\nimport { buildActionCreator, buildReducer } from '../../utils/helpers/redux';\nimport { ProblemDetailsError } from '../../api/types';\nimport { GetState } from '../../container/types';\nimport { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';\nimport { parseApiError } from '../../api/utils';\n\n/* eslint-disable padding-line-between-statements */\nexport const DELETE_SHORT_URL_START = 'shlink/deleteShortUrl/DELETE_SHORT_URL_START';\nexport const DELETE_SHORT_URL_ERROR = 'shlink/deleteShortUrl/DELETE_SHORT_URL_ERROR';\nexport const SHORT_URL_DELETED = 'shlink/deleteShortUrl/SHORT_URL_DELETED';\nexport const RESET_DELETE_SHORT_URL = 'shlink/deleteShortUrl/RESET_DELETE_SHORT_URL';\n/* eslint-enable padding-line-between-statements */\n\nexport interface ShortUrlDeletion {\n shortCode: string;\n loading: boolean;\n error: boolean;\n errorData?: ProblemDetailsError;\n}\n\nexport interface DeleteShortUrlAction extends Action<string> {\n shortCode: string;\n domain?: string | null;\n}\n\ninterface DeleteShortUrlErrorAction extends Action<string> {\n errorData?: ProblemDetailsError;\n}\n\nconst initialState: ShortUrlDeletion = {\n shortCode: '',\n loading: false,\n error: false,\n};\n\nexport default buildReducer<ShortUrlDeletion, DeleteShortUrlAction & DeleteShortUrlErrorAction>({\n [DELETE_SHORT_URL_START]: (state) => ({ ...state, loading: true, error: false }),\n [DELETE_SHORT_URL_ERROR]: (state, { errorData }) => ({ ...state, errorData, loading: false, error: true }),\n [SHORT_URL_DELETED]: (state, { shortCode }) => ({ ...state, shortCode, loading: false, error: false }),\n [RESET_DELETE_SHORT_URL]: () => initialState,\n}, initialState);\n\nexport const deleteShortUrl = (buildShlinkApiClient: ShlinkApiClientBuilder) => (\n shortCode: string,\n domain?: string | null,\n) => async (dispatch: Dispatch, getState: GetState) => {\n dispatch({ type: DELETE_SHORT_URL_START });\n const { deleteShortUrl } = buildShlinkApiClient(getState);\n\n try {\n await deleteShortUrl(shortCode, domain);\n dispatch<DeleteShortUrlAction>({ type: SHORT_URL_DELETED, shortCode, domain });\n } catch (e) {\n dispatch<DeleteShortUrlErrorAction>({ type: DELETE_SHORT_URL_ERROR, errorData: parseApiError(e) });\n\n throw e;\n }\n};\n\nexport const resetDeleteShortUrl = buildActionCreator(RESET_DELETE_SHORT_URL);\n","import { Action, Dispatch } from 'redux';\nimport { GetState } from '../../container/types';\nimport { ShortUrl, ShortUrlData } from '../data';\nimport { buildReducer, buildActionCreator } from '../../utils/helpers/redux';\nimport { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';\nimport { ProblemDetailsError } from '../../api/types';\nimport { parseApiError } from '../../api/utils';\n\n/* eslint-disable padding-line-between-statements */\nexport const CREATE_SHORT_URL_START = 'shlink/createShortUrl/CREATE_SHORT_URL_START';\nexport const CREATE_SHORT_URL_ERROR = 'shlink/createShortUrl/CREATE_SHORT_URL_ERROR';\nexport const CREATE_SHORT_URL = 'shlink/createShortUrl/CREATE_SHORT_URL';\nexport const RESET_CREATE_SHORT_URL = 'shlink/createShortUrl/RESET_CREATE_SHORT_URL';\n/* eslint-enable padding-line-between-statements */\n\nexport interface ShortUrlCreation {\n result: ShortUrl | null;\n saving: boolean;\n error: boolean;\n errorData?: ProblemDetailsError;\n}\n\nexport interface CreateShortUrlAction extends Action<string> {\n result: ShortUrl;\n}\n\nexport interface CreateShortUrlFailedAction extends Action<string> {\n errorData?: ProblemDetailsError;\n}\n\nconst initialState: ShortUrlCreation = {\n result: null,\n saving: false,\n error: false,\n};\n\nexport default buildReducer<ShortUrlCreation, CreateShortUrlAction & CreateShortUrlFailedAction>({\n [CREATE_SHORT_URL_START]: (state) => ({ ...state, saving: true, error: false }),\n [CREATE_SHORT_URL_ERROR]: (state, { errorData }) => ({ ...state, saving: false, error: true, errorData }),\n [CREATE_SHORT_URL]: (_, { result }) => ({ result, saving: false, error: false }),\n [RESET_CREATE_SHORT_URL]: () => initialState,\n}, initialState);\n\nexport const createShortUrl = (buildShlinkApiClient: ShlinkApiClientBuilder) => (data: ShortUrlData) => async (\n dispatch: Dispatch,\n getState: GetState,\n) => {\n dispatch({ type: CREATE_SHORT_URL_START });\n const { createShortUrl } = buildShlinkApiClient(getState);\n\n try {\n const result = await createShortUrl(data);\n\n dispatch<CreateShortUrlAction>({ type: CREATE_SHORT_URL, result });\n } catch (e) {\n dispatch<CreateShortUrlFailedAction>({ type: CREATE_SHORT_URL_ERROR, errorData: parseApiError(e) });\n\n throw e;\n }\n};\n\nexport const resetCreateShortUrl = buildActionCreator(RESET_CREATE_SHORT_URL);\n","import { Action, Dispatch } from 'redux';\nimport { buildReducer } from '../../utils/helpers/redux';\nimport { GetState } from '../../container/types';\nimport { OptionalString } from '../../utils/utils';\nimport { EditShortUrlData, ShortUrl } from '../data';\nimport { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';\nimport { ProblemDetailsError } from '../../api/types';\nimport { parseApiError } from '../../api/utils';\nimport { supportsTagsInPatch } from '../../utils/helpers/features';\n\n/* eslint-disable padding-line-between-statements */\nexport const EDIT_SHORT_URL_START = 'shlink/shortUrlEdition/EDIT_SHORT_URL_START';\nexport const EDIT_SHORT_URL_ERROR = 'shlink/shortUrlEdition/EDIT_SHORT_URL_ERROR';\nexport const SHORT_URL_EDITED = 'shlink/shortUrlEdition/SHORT_URL_EDITED';\n/* eslint-enable padding-line-between-statements */\n\nexport interface ShortUrlEdition {\n shortUrl?: ShortUrl;\n saving: boolean;\n error: boolean;\n errorData?: ProblemDetailsError;\n}\n\nexport interface ShortUrlEditedAction extends Action<string> {\n shortUrl: ShortUrl;\n}\n\nexport interface ShortUrlEditionFailedAction extends Action<string> {\n errorData?: ProblemDetailsError;\n}\n\nconst initialState: ShortUrlEdition = {\n saving: false,\n error: false,\n};\n\nexport default buildReducer<ShortUrlEdition, ShortUrlEditedAction & ShortUrlEditionFailedAction>({\n [EDIT_SHORT_URL_START]: (state) => ({ ...state, saving: true, error: false }),\n [EDIT_SHORT_URL_ERROR]: (state, { errorData }) => ({ ...state, saving: false, error: true, errorData }),\n [SHORT_URL_EDITED]: (_, { shortUrl }) => ({ shortUrl, saving: false, error: false }),\n}, initialState);\n\nexport const editShortUrl = (buildShlinkApiClient: ShlinkApiClientBuilder) => (\n shortCode: string,\n domain: OptionalString,\n data: EditShortUrlData,\n) => async (dispatch: Dispatch, getState: GetState) => {\n dispatch({ type: EDIT_SHORT_URL_START });\n\n const { selectedServer } = getState();\n const sendTagsSeparately = !supportsTagsInPatch(selectedServer);\n const { updateShortUrl, updateShortUrlTags } = buildShlinkApiClient(getState);\n\n try {\n const [ shortUrl ] = await Promise.all([\n updateShortUrl(shortCode, domain, data as any), // FIXME Parse dates\n sendTagsSeparately && data.tags ? updateShortUrlTags(shortCode, domain, data.tags) : undefined,\n ]);\n\n dispatch<ShortUrlEditedAction>({ shortUrl, type: SHORT_URL_EDITED });\n } catch (e) {\n dispatch<ShortUrlEditionFailedAction>({ type: EDIT_SHORT_URL_ERROR, errorData: parseApiError(e) });\n\n throw e;\n }\n};\n","import { assoc, assocPath, init, last, pipe, reject } from 'ramda';\nimport { Action, Dispatch } from 'redux';\nimport { shortUrlMatches } from '../helpers';\nimport { CREATE_VISITS, CreateVisitsAction } from '../../visits/reducers/visitCreation';\nimport { buildReducer } from '../../utils/helpers/redux';\nimport { GetState } from '../../container/types';\nimport { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';\nimport { ShlinkShortUrlsResponse } from '../../api/types';\nimport { DeleteShortUrlAction, SHORT_URL_DELETED } from './shortUrlDeletion';\nimport { ShortUrlsListParams } from './shortUrlsListParams';\nimport { CREATE_SHORT_URL, CreateShortUrlAction } from './shortUrlCreation';\nimport { SHORT_URL_EDITED, ShortUrlEditedAction } from './shortUrlEdition';\n\n/* eslint-disable padding-line-between-statements */\nexport const LIST_SHORT_URLS_START = 'shlink/shortUrlsList/LIST_SHORT_URLS_START';\nexport const LIST_SHORT_URLS_ERROR = 'shlink/shortUrlsList/LIST_SHORT_URLS_ERROR';\nexport const LIST_SHORT_URLS = 'shlink/shortUrlsList/LIST_SHORT_URLS';\n/* eslint-enable padding-line-between-statements */\n\nexport interface ShortUrlsList {\n shortUrls?: ShlinkShortUrlsResponse;\n loading: boolean;\n error: boolean;\n}\n\nexport interface ListShortUrlsAction extends Action<string> {\n shortUrls: ShlinkShortUrlsResponse;\n params: ShortUrlsListParams;\n}\n\nexport type ListShortUrlsCombinedAction = (\n ListShortUrlsAction\n & CreateVisitsAction\n & CreateShortUrlAction\n & DeleteShortUrlAction\n & ShortUrlEditedAction\n);\n\nconst initialState: ShortUrlsList = {\n loading: true,\n error: false,\n};\n\nexport default buildReducer<ShortUrlsList, ListShortUrlsCombinedAction>({\n [LIST_SHORT_URLS_START]: (state) => ({ ...state, loading: true, error: false }),\n [LIST_SHORT_URLS_ERROR]: () => ({ loading: false, error: true }),\n [LIST_SHORT_URLS]: (_, { shortUrls }) => ({ loading: false, error: false, shortUrls }),\n [SHORT_URL_DELETED]: pipe(\n (state: ShortUrlsList, { shortCode, domain }: DeleteShortUrlAction) => !state.shortUrls ? state : assocPath(\n [ 'shortUrls', 'data' ],\n reject((shortUrl) => shortUrlMatches(shortUrl, shortCode, domain), state.shortUrls.data),\n state,\n ),\n (state) => !state.shortUrls ? state : assocPath(\n [ 'shortUrls', 'pagination', 'totalItems' ],\n state.shortUrls.pagination.totalItems - 1,\n state,\n ),\n ),\n [CREATE_VISITS]: (state, { createdVisits }) => assocPath(\n [ 'shortUrls', 'data' ],\n state.shortUrls?.data?.map(\n (currentShortUrl) => {\n // Find the last of the new visit for this short URL, and pick the amount of visits from it\n const lastVisit = last(\n createdVisits.filter(\n ({ shortUrl }) => shortUrl && shortUrlMatches(currentShortUrl, shortUrl.shortCode, shortUrl.domain),\n ),\n );\n\n return lastVisit?.shortUrl\n ? assoc('visitsCount', lastVisit.shortUrl.visitsCount, currentShortUrl)\n : currentShortUrl;\n },\n ),\n state,\n ),\n [CREATE_SHORT_URL]: pipe(\n // The only place where the list and the creation form coexist is the overview page.\n // There we can assume we are displaying page 1, and therefore, we can safely prepend the new short URL and remove the last one.\n (state: ShortUrlsList, { result }: CreateShortUrlAction) => !state.shortUrls ? state : assocPath(\n [ 'shortUrls', 'data' ],\n [ result, ...init(state.shortUrls.data) ],\n state,\n ),\n (state: ShortUrlsList) => !state.shortUrls ? state : assocPath(\n [ 'shortUrls', 'pagination', 'totalItems' ],\n state.shortUrls.pagination.totalItems + 1,\n state,\n ),\n ),\n [SHORT_URL_EDITED]: (state, { shortUrl: editedShortUrl }) => !state.shortUrls ? state : assocPath(\n [ 'shortUrls', 'data' ],\n state.shortUrls.data.map((shortUrl) => {\n const { shortCode, domain } = editedShortUrl;\n\n return shortUrlMatches(shortUrl, shortCode, domain) ? editedShortUrl : shortUrl;\n }),\n state,\n ),\n}, initialState);\n\nexport const listShortUrls = (buildShlinkApiClient: ShlinkApiClientBuilder) => (\n params: ShortUrlsListParams = {},\n) => async (dispatch: Dispatch, getState: GetState) => {\n dispatch({ type: LIST_SHORT_URLS_START });\n const { listShortUrls } = buildShlinkApiClient(getState);\n\n try {\n const shortUrls = await listShortUrls(params);\n\n dispatch<ListShortUrlsAction>({ type: LIST_SHORT_URLS, shortUrls, params });\n } catch (e) {\n dispatch({ type: LIST_SHORT_URLS_ERROR, params });\n }\n};\n","import { buildActionCreator, buildReducer } from '../../utils/helpers/redux';\nimport { OrderDir } from '../../utils/utils';\nimport { LIST_SHORT_URLS, ListShortUrlsAction } from './shortUrlsList';\n\nexport const RESET_SHORT_URL_PARAMS = 'shlink/shortUrlsListParams/RESET_SHORT_URL_PARAMS';\n\nexport const SORTABLE_FIELDS = {\n dateCreated: 'Created at',\n shortCode: 'Short URL',\n longUrl: 'Long URL',\n title: 'Title',\n visits: 'Visits',\n};\n\nexport type OrderableFields = keyof typeof SORTABLE_FIELDS;\n\nexport interface ShortUrlsListParams {\n page?: string;\n itemsPerPage?: number;\n tags?: string[];\n searchTerm?: string;\n startDate?: string;\n endDate?: string;\n orderBy?: Partial<Record<OrderableFields, OrderDir>>;\n}\n\nconst initialState: ShortUrlsListParams = {\n page: '1',\n orderBy: { dateCreated: 'DESC' },\n};\n\nexport default buildReducer<ShortUrlsListParams, ListShortUrlsAction>({\n [LIST_SHORT_URLS]: (state, { params }) => ({ ...state, ...params }),\n [RESET_SHORT_URL_PARAMS]: () => initialState,\n}, initialState);\n\nexport const resetShortUrlParams = buildActionCreator(RESET_SHORT_URL_PARAMS);\n","const TEN_ROUNDING_NUMBER = 10;\nconst { ceil } = Math;\nconst formatter = new Intl.NumberFormat('en-US');\n\nexport const prettify = (number: number) => formatter.format(number);\n\nexport const roundTen = (number: number) => ceil(number / TEN_ROUNDING_NUMBER) * TEN_ROUNDING_NUMBER;\n","import { max, min, range } from 'ramda';\nimport { prettify } from './numbers';\n\nconst DELTA = 2;\n\nexport const ELLIPSIS = '...';\n\ntype Ellipsis = typeof ELLIPSIS;\n\nexport type NumberOrEllipsis = number | Ellipsis;\n\nexport const progressivePagination = (currentPage: number, pageCount: number): NumberOrEllipsis[] => {\n const pages: NumberOrEllipsis[] = range(\n max(DELTA, currentPage - DELTA),\n min(pageCount - 1, currentPage + DELTA) + 1,\n );\n\n if (currentPage - DELTA > DELTA) {\n pages.unshift(ELLIPSIS);\n }\n if (currentPage + DELTA < pageCount - 1) {\n pages.push(ELLIPSIS);\n }\n\n pages.unshift(1);\n pages.push(pageCount);\n\n return pages;\n};\n\nexport const pageIsEllipsis = (pageNumber: NumberOrEllipsis): pageNumber is Ellipsis => pageNumber === ELLIPSIS;\n\nexport const prettifyPageNumber = (pageNumber: NumberOrEllipsis): string =>\n pageIsEllipsis(pageNumber) ? pageNumber : prettify(pageNumber);\n\nexport const keyForPage = (pageNumber: NumberOrEllipsis, index: number) => !pageIsEllipsis(pageNumber) ? `${pageNumber}` : `${pageNumber}_${index}`;\n","import { Link } from 'react-router-dom';\nimport { Pagination, PaginationItem, PaginationLink } from 'reactstrap';\nimport { pageIsEllipsis, keyForPage, progressivePagination, prettifyPageNumber } from '../utils/helpers/pagination';\nimport { ShlinkPaginator } from '../api/types';\nimport './Paginator.scss';\n\ninterface PaginatorProps {\n paginator?: ShlinkPaginator;\n serverId: string;\n}\n\nconst Paginator = ({ paginator, serverId }: PaginatorProps) => {\n const { currentPage = 0, pagesCount = 0 } = paginator ?? {};\n\n if (pagesCount <= 1) {\n return null;\n }\n\n const renderPages = () =>\n progressivePagination(currentPage, pagesCount).map((pageNumber, index) => (\n <PaginationItem\n key={keyForPage(pageNumber, index)}\n disabled={pageIsEllipsis(pageNumber)}\n active={currentPage === pageNumber}\n >\n <PaginationLink\n tag={Link}\n to={`/server/${serverId}/list-short-urls/${pageNumber}`}\n >\n {prettifyPageNumber(pageNumber)}\n </PaginationLink>\n </PaginationItem>\n ));\n\n return (\n <Pagination className=\"short-urls-paginator\" listClassName=\"flex-wrap justify-content-center mb-0\">\n <PaginationItem disabled={currentPage === 1}>\n <PaginationLink\n previous\n tag={Link}\n to={`/server/${serverId}/list-short-urls/${currentPage - 1}`}\n />\n </PaginationItem>\n {renderPages()}\n <PaginationItem disabled={currentPage >= pagesCount}>\n <PaginationLink\n next\n tag={Link}\n to={`/server/${serverId}/list-short-urls/${currentPage + 1}`}\n />\n </PaginationItem>\n </Pagination>\n );\n};\n\nexport default Paginator;\n","import { faCaretDown as caretDownIcon, faCaretUp as caretUpIcon } from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { head, keys, values } from 'ramda';\nimport { FC, useEffect, useState } from 'react';\nimport { RouteComponentProps } from 'react-router';\nimport { Card } from 'reactstrap';\nimport SortingDropdown from '../utils/SortingDropdown';\nimport { determineOrderDir, OrderDir } from '../utils/utils';\nimport { isReachableServer, SelectedServer } from '../servers/data';\nimport { boundToMercureHub } from '../mercure/helpers/boundToMercureHub';\nimport { parseQuery } from '../utils/helpers/query';\nimport { Topics } from '../mercure/helpers/Topics';\nimport { ShortUrlsList as ShortUrlsListState } from './reducers/shortUrlsList';\nimport { OrderableFields, ShortUrlsListParams, SORTABLE_FIELDS } from './reducers/shortUrlsListParams';\nimport { ShortUrlsTableProps } from './ShortUrlsTable';\nimport Paginator from './Paginator';\nimport './ShortUrlsList.scss';\n\ninterface RouteParams {\n page: string;\n serverId: string;\n}\n\nexport interface ShortUrlsListProps extends RouteComponentProps<RouteParams> {\n selectedServer: SelectedServer;\n shortUrlsList: ShortUrlsListState;\n listShortUrls: (params: ShortUrlsListParams) => void;\n shortUrlsListParams: ShortUrlsListParams;\n resetShortUrlParams: () => void;\n}\n\nconst ShortUrlsList = (ShortUrlsTable: FC<ShortUrlsTableProps>) => boundToMercureHub(({\n listShortUrls,\n resetShortUrlParams,\n shortUrlsListParams,\n match,\n location,\n shortUrlsList,\n selectedServer,\n}: ShortUrlsListProps) => {\n const { orderBy } = shortUrlsListParams;\n const [ order, setOrder ] = useState<{ orderField?: OrderableFields; orderDir?: OrderDir }>({\n orderField: orderBy && (head(keys(orderBy)) as OrderableFields),\n orderDir: orderBy && head(values(orderBy)),\n });\n const { pagination } = shortUrlsList?.shortUrls ?? {};\n const refreshList = (extraParams: ShortUrlsListParams) => listShortUrls({ ...shortUrlsListParams, ...extraParams });\n const handleOrderBy = (orderField?: OrderableFields, orderDir?: OrderDir) => {\n setOrder({ orderField, orderDir });\n refreshList({ orderBy: orderField ? { [orderField]: orderDir } : undefined });\n };\n const orderByColumn = (field: OrderableFields) => () =>\n handleOrderBy(field, determineOrderDir(field, order.orderField, order.orderDir));\n const renderOrderIcon = (field: OrderableFields) => {\n if (order.orderField !== field) {\n return null;\n }\n\n if (!order.orderDir) {\n return null;\n }\n\n return (\n <FontAwesomeIcon\n icon={order.orderDir === 'ASC' ? caretUpIcon : caretDownIcon}\n className=\"short-urls-list__header-icon\"\n />\n );\n };\n\n useEffect(() => {\n const { tag } = parseQuery<{ tag?: string }>(location.search);\n const tags = tag ? [ decodeURIComponent(tag) ] : shortUrlsListParams.tags;\n\n refreshList({ page: match.params.page, tags, itemsPerPage: undefined });\n\n return resetShortUrlParams;\n }, []);\n\n return (\n <>\n <div className=\"d-block d-lg-none mb-3\">\n <SortingDropdown\n items={SORTABLE_FIELDS}\n orderField={order.orderField}\n orderDir={order.orderDir}\n onChange={handleOrderBy}\n />\n </div>\n <Card body className=\"pb-1\">\n <ShortUrlsTable\n orderByColumn={orderByColumn}\n renderOrderIcon={renderOrderIcon}\n selectedServer={selectedServer}\n shortUrlsList={shortUrlsList}\n onTagClick={(tag) => refreshList({ tags: [ ...shortUrlsListParams.tags ?? [], tag ] })}\n />\n <Paginator paginator={pagination} serverId={isReachableServer(selectedServer) ? selectedServer.id : ''} />\n </Card>\n </>\n );\n}, () => [ Topics.visits() ]);\n\nexport default ShortUrlsList;\n","import { FC } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faCopy as copyIcon } from '@fortawesome/free-regular-svg-icons';\nimport CopyToClipboard from 'react-copy-to-clipboard';\nimport './CopyToClipboardIcon.scss';\n\ninterface CopyToClipboardIconProps {\n text: string;\n onCopy?: (text: string, result: boolean) => void;\n}\n\nexport const CopyToClipboardIcon: FC<CopyToClipboardIconProps> = ({ text, onCopy }) => (\n <CopyToClipboard text={text} onCopy={onCopy}>\n <FontAwesomeIcon icon={copyIcon} className=\"ml-2 copy-to-clipboard-icon\" />\n </CopyToClipboard>\n);\n","import { parseISO, format as formatDate, getUnixTime, formatDistance } from 'date-fns';\nimport { isDateObject } from './helpers/date';\n\nexport interface DateProps {\n date: Date | string;\n format?: string;\n relative?: boolean;\n}\n\nexport const Time = ({ date, format = 'yyyy-MM-dd HH:mm', relative = false }: DateProps) => {\n const dateObject = isDateObject(date) ? date : parseISO(date);\n\n return (\n <time dateTime={`${getUnixTime(dateObject)}000`}>\n {relative ? `${formatDistance(new Date(), dateObject)} ago` : formatDate(dateObject, format)}\n </time>\n );\n};\n","import { FC } from 'react';\nimport { Link } from 'react-router-dom';\nimport { isServerWithId, SelectedServer, ServerWithId } from '../../servers/data';\nimport { ShortUrl } from '../data';\n\nexport type LinkSuffix = 'visits' | 'edit';\n\nexport interface ShortUrlDetailLinkProps {\n shortUrl?: ShortUrl | null;\n selectedServer?: SelectedServer;\n suffix: LinkSuffix;\n}\n\nconst buildUrl = ({ id }: ServerWithId, { shortCode, domain }: ShortUrl, suffix: LinkSuffix) => {\n const query = domain ? `?domain=${domain}` : '';\n\n return `/server/${id}/short-code/${shortCode}/${suffix}${query}`;\n};\n\nconst ShortUrlDetailLink: FC<ShortUrlDetailLinkProps & Record<string | number, any>> = (\n { selectedServer, shortUrl, suffix, children, ...rest },\n) => {\n if (!selectedServer || !isServerWithId(selectedServer) || !shortUrl) {\n return <span {...rest}>{children}</span>;\n }\n\n return <Link to={buildUrl(selectedServer, shortUrl, suffix)} {...rest}>{children}</Link>;\n};\n\nexport default ShortUrlDetailLink;\n","import { useRef } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faInfoCircle as infoIcon } from '@fortawesome/free-solid-svg-icons';\nimport { UncontrolledTooltip } from 'reactstrap';\nimport classNames from 'classnames';\nimport { prettify } from '../../utils/helpers/numbers';\nimport { ShortUrl } from '../data';\nimport { SelectedServer } from '../../servers/data';\nimport ShortUrlDetailLink from './ShortUrlDetailLink';\nimport './ShortUrlVisitsCount.scss';\n\ninterface ShortUrlVisitsCountProps {\n shortUrl?: ShortUrl | null;\n selectedServer?: SelectedServer;\n visitsCount: number;\n active?: boolean;\n}\n\nconst ShortUrlVisitsCount = ({ visitsCount, shortUrl, selectedServer, active = false }: ShortUrlVisitsCountProps) => {\n const maxVisits = shortUrl?.meta?.maxVisits;\n const visitsLink = (\n <ShortUrlDetailLink selectedServer={selectedServer} shortUrl={shortUrl} suffix=\"visits\">\n <strong\n className={classNames('short-url-visits-count__amount', { 'short-url-visits-count__amount--big': active })}\n >\n {prettify(visitsCount)}\n </strong>\n </ShortUrlDetailLink>\n );\n\n if (!maxVisits) {\n return visitsLink;\n }\n\n const prettifiedMaxVisits = prettify(maxVisits);\n const tooltipRef = useRef<HTMLElement | null>();\n\n return (\n <>\n <span className=\"indivisible\">\n {visitsLink}\n <small\n className=\"short-urls-visits-count__max-visits-control\"\n ref={(el) => {\n tooltipRef.current = el;\n }}\n >\n {' '}/ {prettifiedMaxVisits}{' '}\n <sup>\n <FontAwesomeIcon icon={infoIcon} />\n </sup>\n </small>\n </span>\n <UncontrolledTooltip target={(() => tooltipRef.current) as any} placement=\"bottom\">\n This short URL will not accept more than <b>{prettifiedMaxVisits}</b> visits.\n </UncontrolledTooltip>\n </>\n );\n};\n\nexport default ShortUrlVisitsCount;\n","import { FC, useEffect, useRef } from 'react';\nimport { isEmpty } from 'ramda';\nimport { ExternalLink } from 'react-external-link';\nimport ColorGenerator from '../../utils/services/ColorGenerator';\nimport { StateFlagTimeout } from '../../utils/helpers/hooks';\nimport Tag from '../../tags/helpers/Tag';\nimport { SelectedServer } from '../../servers/data';\nimport { CopyToClipboardIcon } from '../../utils/CopyToClipboardIcon';\nimport { ShortUrl } from '../data';\nimport { Time } from '../../utils/Time';\nimport ShortUrlVisitsCount from './ShortUrlVisitsCount';\nimport { ShortUrlsRowMenuProps } from './ShortUrlsRowMenu';\nimport './ShortUrlsRow.scss';\n\nexport interface ShortUrlsRowProps {\n onTagClick?: (tag: string) => void;\n selectedServer: SelectedServer;\n shortUrl: ShortUrl;\n}\n\nconst ShortUrlsRow = (\n ShortUrlsRowMenu: FC<ShortUrlsRowMenuProps>,\n colorGenerator: ColorGenerator,\n useStateFlagTimeout: StateFlagTimeout,\n) => ({ shortUrl, selectedServer, onTagClick }: ShortUrlsRowProps) => {\n const [ copiedToClipboard, setCopiedToClipboard ] = useStateFlagTimeout();\n const [ active, setActive ] = useStateFlagTimeout(false, 500);\n const isFirstRun = useRef(true);\n\n const renderTags = (tags: string[]) => {\n if (isEmpty(tags)) {\n return <i className=\"indivisible\"><small>No tags</small></i>;\n }\n\n return tags.map((tag) => (\n <Tag\n colorGenerator={colorGenerator}\n key={tag}\n text={tag}\n onClick={() => onTagClick?.(tag)}\n />\n ));\n };\n\n useEffect(() => {\n if (isFirstRun.current) {\n isFirstRun.current = false;\n } else {\n setActive();\n }\n }, [ shortUrl.visitsCount ]);\n\n return (\n <tr className=\"short-urls-row\">\n <td className=\"indivisible short-urls-row__cell\" data-th=\"Created at: \">\n <Time date={shortUrl.dateCreated} />\n </td>\n <td className=\"short-urls-row__cell\" data-th=\"Short URL: \">\n <span className=\"indivisible short-urls-row__cell--relative\">\n <ExternalLink href={shortUrl.shortUrl} />\n <CopyToClipboardIcon text={shortUrl.shortUrl} onCopy={setCopiedToClipboard} />\n <span className=\"badge badge-warning short-urls-row__copy-hint\" hidden={!copiedToClipboard}>\n Copied short URL!\n </span>\n </span>\n </td>\n <td className=\"short-urls-row__cell short-urls-row__cell--break\" data-th={`${shortUrl.title ? 'Title' : 'Long URL'}: `}>\n <ExternalLink href={shortUrl.longUrl}>{shortUrl.title ?? shortUrl.longUrl}</ExternalLink>\n </td>\n {shortUrl.title && (\n <td className=\"short-urls-row__cell short-urls-row__cell--break d-lg-none\" data-th=\"Long URL: \">\n <ExternalLink href={shortUrl.longUrl} />\n </td>\n )}\n <td className=\"short-urls-row__cell\" data-th=\"Tags: \">{renderTags(shortUrl.tags)}</td>\n <td className=\"short-urls-row__cell text-md-right\" data-th=\"Visits: \">\n <ShortUrlVisitsCount\n visitsCount={shortUrl.visitsCount}\n shortUrl={shortUrl}\n selectedServer={selectedServer}\n active={active}\n />\n </td>\n <td className=\"short-urls-row__cell\">\n <ShortUrlsRowMenu selectedServer={selectedServer} shortUrl={shortUrl} />\n </td>\n </tr>\n );\n};\n\nexport default ShortUrlsRow;\n","import {\n faChartPie as pieChartIcon,\n faEllipsisV as menuIcon,\n faQrcode as qrIcon,\n faMinusCircle as deleteIcon,\n faEdit as editIcon,\n} from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { FC } from 'react';\nimport { ButtonDropdown, DropdownItem, DropdownMenu, DropdownToggle } from 'reactstrap';\nimport { useToggle } from '../../utils/helpers/hooks';\nimport { ShortUrl, ShortUrlModalProps } from '../data';\nimport { SelectedServer } from '../../servers/data';\nimport ShortUrlDetailLink from './ShortUrlDetailLink';\nimport './ShortUrlsRowMenu.scss';\n\nexport interface ShortUrlsRowMenuProps {\n selectedServer: SelectedServer;\n shortUrl: ShortUrl;\n}\ntype ShortUrlModal = FC<ShortUrlModalProps>;\n\nconst ShortUrlsRowMenu = (\n DeleteShortUrlModal: ShortUrlModal,\n QrCodeModal: ShortUrlModal,\n) => ({ shortUrl, selectedServer }: ShortUrlsRowMenuProps) => {\n const [ isOpen, toggle ] = useToggle();\n const [ isQrModalOpen, toggleQrCode ] = useToggle();\n const [ isDeleteModalOpen, toggleDelete ] = useToggle();\n\n return (\n <ButtonDropdown toggle={toggle} isOpen={isOpen}>\n <DropdownToggle size=\"sm\" caret outline className=\"short-urls-row-menu__dropdown-toggle\">\n <FontAwesomeIcon icon={menuIcon} /> \n </DropdownToggle>\n <DropdownMenu right>\n <DropdownItem tag={ShortUrlDetailLink} selectedServer={selectedServer} shortUrl={shortUrl} suffix=\"visits\">\n <FontAwesomeIcon icon={pieChartIcon} fixedWidth /> Visit stats\n </DropdownItem>\n\n <DropdownItem tag={ShortUrlDetailLink} selectedServer={selectedServer} shortUrl={shortUrl} suffix=\"edit\">\n <FontAwesomeIcon icon={editIcon} fixedWidth /> Edit short URL\n </DropdownItem>\n\n <DropdownItem onClick={toggleQrCode}>\n <FontAwesomeIcon icon={qrIcon} fixedWidth /> QR code\n </DropdownItem>\n <QrCodeModal shortUrl={shortUrl} isOpen={isQrModalOpen} toggle={toggleQrCode} />\n\n <DropdownItem divider />\n\n <DropdownItem className=\"short-urls-row-menu__dropdown-item--danger\" onClick={toggleDelete}>\n <FontAwesomeIcon icon={deleteIcon} fixedWidth /> Delete short URL\n </DropdownItem>\n <DeleteShortUrlModal shortUrl={shortUrl} isOpen={isDeleteModalOpen} toggle={toggleDelete} />\n </DropdownMenu>\n </ButtonDropdown>\n );\n};\n\nexport default ShortUrlsRowMenu;\n","import { FC, useMemo } from 'react';\nimport { SelectedServer } from '../servers/data';\nimport { Settings, ShortUrlCreationSettings } from '../settings/reducers/settings';\nimport { ShortUrlData } from './data';\nimport { ShortUrlCreation } from './reducers/shortUrlCreation';\nimport { CreateShortUrlResultProps } from './helpers/CreateShortUrlResult';\nimport { ShortUrlFormProps } from './ShortUrlForm';\n\nexport interface CreateShortUrlProps {\n basicMode?: boolean;\n}\n\ninterface CreateShortUrlConnectProps extends CreateShortUrlProps {\n settings: Settings;\n shortUrlCreationResult: ShortUrlCreation;\n selectedServer: SelectedServer;\n createShortUrl: (data: ShortUrlData) => Promise<void>;\n resetCreateShortUrl: () => void;\n}\n\nconst getInitialState = (settings?: ShortUrlCreationSettings): ShortUrlData => ({\n longUrl: '',\n tags: [],\n customSlug: '',\n title: undefined,\n shortCodeLength: undefined,\n domain: '',\n validSince: undefined,\n validUntil: undefined,\n maxVisits: undefined,\n findIfExists: false,\n validateUrl: settings?.validateUrls ?? false,\n});\n\nconst CreateShortUrl = (ShortUrlForm: FC<ShortUrlFormProps>, CreateShortUrlResult: FC<CreateShortUrlResultProps>) => ({\n createShortUrl,\n shortUrlCreationResult,\n resetCreateShortUrl,\n selectedServer,\n basicMode = false,\n settings: { shortUrlCreation: shortUrlCreationSettings },\n}: CreateShortUrlConnectProps) => {\n const initialState = useMemo(() => getInitialState(shortUrlCreationSettings), [ shortUrlCreationSettings ]);\n\n return (\n <>\n <ShortUrlForm\n initialState={initialState}\n saving={shortUrlCreationResult.saving}\n selectedServer={selectedServer}\n mode={basicMode ? 'create-basic' : 'create'}\n onSave={async (data: ShortUrlData) => {\n resetCreateShortUrl();\n\n return createShortUrl(data);\n }}\n />\n <CreateShortUrlResult\n {...shortUrlCreationResult}\n resetCreateShortUrl={resetCreateShortUrl}\n canBeClosed={basicMode}\n />\n </>\n );\n};\n\nexport default CreateShortUrl;\n","import { FC } from 'react';\nimport { Row } from 'reactstrap';\nimport classNames from 'classnames';\nimport { SimpleCard } from './SimpleCard';\n\nexport type ResultType = 'success' | 'error' | 'warning';\n\nexport interface ResultProps {\n type: ResultType;\n className?: string;\n small?: boolean;\n}\n\nexport const Result: FC<ResultProps> = ({ children, type, className, small = false }) => (\n <Row className={className}>\n <div className={classNames({ 'col-md-10 offset-md-1': !small, 'col-12': small })}>\n <SimpleCard\n className={classNames('text-center', {\n 'bg-main': type === 'success',\n 'bg-danger': type === 'error',\n 'bg-warning': type === 'warning',\n 'text-white': type !== 'warning',\n })}\n bodyClassName={classNames({ 'p-2': small })}\n >\n {children}\n </SimpleCard>\n </div>\n </Row>\n);\n","import { ProblemDetailsError } from './types';\nimport { isInvalidArgumentError } from './utils';\n\nexport interface ShlinkApiErrorProps {\n errorData?: ProblemDetailsError;\n fallbackMessage?: string;\n}\n\nexport const ShlinkApiError = ({ errorData, fallbackMessage }: ShlinkApiErrorProps) => (\n <>\n {errorData?.detail ?? fallbackMessage}\n {isInvalidArgumentError(errorData) &&\n <p className=\"mb-0\">Invalid elements: [{errorData.invalidElements.join(', ')}]</p>\n }\n </>\n);\n","import { useEffect, useState } from 'react';\nimport { Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap';\nimport { identity, pipe } from 'ramda';\nimport { ShortUrlDeletion } from '../reducers/shortUrlDeletion';\nimport { ShortUrlModalProps } from '../data';\nimport { handleEventPreventingDefault, OptionalString } from '../../utils/utils';\nimport { Result } from '../../utils/Result';\nimport { isInvalidDeletionError } from '../../api/utils';\nimport { ShlinkApiError } from '../../api/ShlinkApiError';\n\ninterface DeleteShortUrlModalConnectProps extends ShortUrlModalProps {\n shortUrlDeletion: ShortUrlDeletion;\n deleteShortUrl: (shortCode: string, domain: OptionalString) => Promise<void>;\n resetDeleteShortUrl: () => void;\n}\n\nconst DeleteShortUrlModal = (\n { shortUrl, toggle, isOpen, shortUrlDeletion, resetDeleteShortUrl, deleteShortUrl }: DeleteShortUrlModalConnectProps,\n) => {\n const [ inputValue, setInputValue ] = useState('');\n\n useEffect(() => resetDeleteShortUrl, []);\n\n const { error, errorData } = shortUrlDeletion;\n const close = pipe(resetDeleteShortUrl, toggle);\n const handleDeleteUrl = handleEventPreventingDefault(() => {\n const { shortCode, domain } = shortUrl;\n\n deleteShortUrl(shortCode, domain)\n .then(toggle)\n .catch(identity);\n });\n\n return (\n <Modal isOpen={isOpen} toggle={close} centered>\n <form onSubmit={handleDeleteUrl}>\n <ModalHeader toggle={close}>\n <span className=\"text-danger\">Delete short URL</span>\n </ModalHeader>\n <ModalBody>\n <p><b className=\"text-danger\">Caution!</b> You are about to delete a short URL.</p>\n <p>This action cannot be undone. Once you have deleted it, all the visits stats will be lost.</p>\n <p>Write <b>{shortUrl.shortCode}</b> to confirm deletion.</p>\n\n <input\n type=\"text\"\n className=\"form-control\"\n placeholder={`Insert the short code (${shortUrl.shortCode})`}\n value={inputValue}\n onChange={(e) => setInputValue(e.target.value)}\n />\n\n {error && (\n <Result type={isInvalidDeletionError(errorData) ? 'warning' : 'error'} small className=\"mt-2\">\n <ShlinkApiError errorData={errorData} fallbackMessage=\"Something went wrong while deleting the URL :(\" />\n </Result>\n )}\n </ModalBody>\n <ModalFooter>\n <button type=\"button\" className=\"btn btn-link\" onClick={close}>Cancel</button>\n <button\n type=\"submit\"\n className=\"btn btn-danger\"\n disabled={inputValue !== shortUrl.shortCode || shortUrlDeletion.loading}\n >\n {shortUrlDeletion.loading ? 'Deleting...' : 'Delete'}\n </button>\n </ModalFooter>\n </form>\n </Modal>\n );\n};\n\nexport default DeleteShortUrlModal;\n","import { faCopy as copyIcon } from '@fortawesome/free-regular-svg-icons';\nimport { faTimes as closeIcon } from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { isNil } from 'ramda';\nimport { useEffect } from 'react';\nimport CopyToClipboard from 'react-copy-to-clipboard';\nimport { Tooltip } from 'reactstrap';\nimport { ShortUrlCreation } from '../reducers/shortUrlCreation';\nimport { StateFlagTimeout } from '../../utils/helpers/hooks';\nimport { Result } from '../../utils/Result';\nimport './CreateShortUrlResult.scss';\nimport { ShlinkApiError } from '../../api/ShlinkApiError';\n\nexport interface CreateShortUrlResultProps extends ShortUrlCreation {\n resetCreateShortUrl: () => void;\n canBeClosed?: boolean;\n}\n\nconst CreateShortUrlResult = (useStateFlagTimeout: StateFlagTimeout) => (\n { error, errorData, result, resetCreateShortUrl, canBeClosed = false }: CreateShortUrlResultProps,\n) => {\n const [ showCopyTooltip, setShowCopyTooltip ] = useStateFlagTimeout();\n\n useEffect(() => {\n resetCreateShortUrl();\n }, []);\n\n if (error) {\n return (\n <Result type=\"error\" className=\"mt-3\">\n {canBeClosed && <FontAwesomeIcon icon={closeIcon} className=\"float-right pointer\" onClick={resetCreateShortUrl} />}\n <ShlinkApiError errorData={errorData} fallbackMessage=\"An error occurred while creating the URL :(\" />\n </Result>\n );\n }\n\n if (isNil(result)) {\n return null;\n }\n\n const { shortUrl } = result;\n\n return (\n <Result type=\"success\" className=\"mt-3\">\n {canBeClosed && <FontAwesomeIcon icon={closeIcon} className=\"float-right pointer\" onClick={resetCreateShortUrl} />}\n <b>Great!</b> The short URL is <b>{shortUrl}</b>\n\n <CopyToClipboard text={shortUrl} onCopy={setShowCopyTooltip}>\n <button\n className=\"btn btn-light btn-sm create-short-url-result__copy-btn\"\n id=\"copyBtn\"\n type=\"button\"\n >\n <FontAwesomeIcon icon={copyIcon} /> Copy\n </button>\n </CopyToClipboard>\n\n <Tooltip placement=\"left\" isOpen={showCopyTooltip} target=\"copyBtn\">\n Copied!\n </Tooltip>\n </Result>\n );\n};\n\nexport default CreateShortUrlResult;\n","import { FC, ReactNode } from 'react';\nimport { isEmpty } from 'ramda';\nimport classNames from 'classnames';\nimport { SelectedServer } from '../servers/data';\nimport { supportsShortUrlTitle } from '../utils/helpers/features';\nimport { ShortUrlsList as ShortUrlsListState } from './reducers/shortUrlsList';\nimport { ShortUrlsRowProps } from './helpers/ShortUrlsRow';\nimport { OrderableFields } from './reducers/shortUrlsListParams';\nimport './ShortUrlsTable.scss';\n\nexport interface ShortUrlsTableProps {\n orderByColumn?: (column: OrderableFields) => () => void;\n renderOrderIcon?: (column: OrderableFields) => ReactNode;\n shortUrlsList: ShortUrlsListState;\n selectedServer: SelectedServer;\n onTagClick?: (tag: string) => void;\n className?: string;\n}\n\nexport const ShortUrlsTable = (ShortUrlsRow: FC<ShortUrlsRowProps>) => ({\n orderByColumn,\n renderOrderIcon,\n shortUrlsList,\n onTagClick,\n selectedServer,\n className,\n}: ShortUrlsTableProps) => {\n const { error, loading, shortUrls } = shortUrlsList;\n const actionableFieldClasses = classNames({ 'short-urls-table__header-cell--with-action': !!orderByColumn });\n const orderableColumnsClasses = classNames('short-urls-table__header-cell', actionableFieldClasses);\n const tableClasses = classNames('table table-hover', className);\n const supportsTitle = supportsShortUrlTitle(selectedServer);\n\n const renderShortUrls = () => {\n if (error) {\n return (\n <tr>\n <td colSpan={6} className=\"text-center table-danger\">Something went wrong while loading short URLs :(</td>\n </tr>\n );\n }\n\n if (loading) {\n return <tr><td colSpan={6} className=\"text-center\">Loading...</td></tr>;\n }\n\n if (!loading && isEmpty(shortUrls?.data)) {\n return <tr><td colSpan={6} className=\"text-center\">No results found</td></tr>;\n }\n\n return shortUrls?.data.map((shortUrl) => (\n <ShortUrlsRow\n key={shortUrl.shortUrl}\n shortUrl={shortUrl}\n selectedServer={selectedServer}\n onTagClick={onTagClick}\n />\n ));\n };\n\n return (\n <table className={tableClasses}>\n <thead className=\"short-urls-table__header\">\n <tr>\n <th className={orderableColumnsClasses} onClick={orderByColumn?.('dateCreated')}>\n Created at\n {renderOrderIcon?.('dateCreated')}\n </th>\n <th className={orderableColumnsClasses} onClick={orderByColumn?.('shortCode')}>\n Short URL\n {renderOrderIcon?.('shortCode')}\n </th>\n {!supportsTitle && (\n <th className={orderableColumnsClasses} onClick={orderByColumn?.('longUrl')}>\n Long URL\n {renderOrderIcon?.('longUrl')}\n </th>\n ) || (\n <th className=\"short-urls-table__header-cell\">\n <span className={actionableFieldClasses} onClick={orderByColumn?.('title')}>\n Title\n {renderOrderIcon?.('title')}\n </span>\n / \n <span className={actionableFieldClasses} onClick={orderByColumn?.('longUrl')}>\n <span className=\"indivisible\">Long URL</span>\n {renderOrderIcon?.('longUrl')}\n </span>\n </th>\n )}\n <th className=\"short-urls-table__header-cell\">Tags</th>\n <th className={orderableColumnsClasses} onClick={orderByColumn?.('visits')}>\n <span className=\"indivisible\">Visits{renderOrderIcon?.('visits')}</span>\n </th>\n <th className=\"short-urls-table__header-cell\"> </th>\n </tr>\n </thead>\n <tbody>\n {renderShortUrls()}\n </tbody>\n </table>\n );\n};\n","import { isEmpty } from 'ramda';\nimport { stringifyQuery } from './query';\n\nexport interface QrCodeCapabilities {\n useSizeInPath: boolean;\n svgIsSupported: boolean;\n marginIsSupported: boolean;\n}\n\nexport type QrCodeFormat = 'svg' | 'png';\n\nexport interface QrCodeOptions {\n size: number;\n format: QrCodeFormat;\n margin: number;\n}\n\nexport const buildQrCodeUrl = (\n shortUrl: string,\n { size, format, margin }: QrCodeOptions,\n { useSizeInPath, svgIsSupported, marginIsSupported }: QrCodeCapabilities,\n): string => {\n const baseUrl = `${shortUrl}/qr-code${useSizeInPath ? `/${size}` : ''}`;\n const query = stringifyQuery({\n size: useSizeInPath ? undefined : size,\n format: svgIsSupported ? format : undefined,\n margin: marginIsSupported && margin > 0 ? margin : undefined,\n });\n\n return `${baseUrl}${isEmpty(query) ? '' : `?${query}`}`;\n};\n","import { useMemo, useState } from 'react';\nimport { Modal, DropdownItem, FormGroup, ModalBody, ModalHeader, Row } from 'reactstrap';\nimport { ExternalLink } from 'react-external-link';\nimport classNames from 'classnames';\nimport { ShortUrlModalProps } from '../data';\nimport { SelectedServer } from '../../servers/data';\nimport { DropdownBtn } from '../../utils/DropdownBtn';\nimport { CopyToClipboardIcon } from '../../utils/CopyToClipboardIcon';\nimport { buildQrCodeUrl, QrCodeCapabilities, QrCodeFormat } from '../../utils/helpers/qrCodes';\nimport { supportsQrCodeSizeInQuery, supportsQrCodeSvgFormat, supportsQrCodeMargin } from '../../utils/helpers/features';\nimport './QrCodeModal.scss';\n\ninterface QrCodeModalConnectProps extends ShortUrlModalProps {\n selectedServer: SelectedServer;\n}\n\nconst QrCodeModal = ({ shortUrl: { shortUrl }, toggle, isOpen, selectedServer }: QrCodeModalConnectProps) => {\n const [ size, setSize ] = useState(300);\n const [ margin, setMargin ] = useState(0);\n const [ format, setFormat ] = useState<QrCodeFormat>('png');\n const capabilities: QrCodeCapabilities = useMemo(() => ({\n useSizeInPath: !supportsQrCodeSizeInQuery(selectedServer),\n svgIsSupported: supportsQrCodeSvgFormat(selectedServer),\n marginIsSupported: supportsQrCodeMargin(selectedServer),\n }), [ selectedServer ]);\n const qrCodeUrl = useMemo(\n () => buildQrCodeUrl(shortUrl, { size, format, margin }, capabilities),\n [ shortUrl, size, format, margin, capabilities ],\n );\n const totalSize = useMemo(() => size + margin, [ size, margin ]);\n const modalSize = useMemo(() => {\n if (totalSize < 500) {\n return undefined;\n }\n\n return totalSize < 800 ? 'lg' : 'xl';\n }, [ totalSize ]);\n\n return (\n <Modal isOpen={isOpen} toggle={toggle} centered size={modalSize}>\n <ModalHeader toggle={toggle}>\n QR code for <ExternalLink href={shortUrl}>{shortUrl}</ExternalLink>\n </ModalHeader>\n <ModalBody>\n <Row className=\"mb-2\">\n <div\n className={classNames({\n 'col-md-4': capabilities.marginIsSupported && capabilities.svgIsSupported,\n 'col-md-6': (!capabilities.marginIsSupported && capabilities.svgIsSupported) || (capabilities.marginIsSupported && !capabilities.svgIsSupported),\n 'col-12': !capabilities.marginIsSupported && !capabilities.svgIsSupported,\n })}\n >\n <FormGroup>\n <label className=\"mb-0\">Size: {size}px</label>\n <input\n type=\"range\"\n className=\"form-control-range\"\n value={size}\n step={10}\n min={50}\n max={1000}\n onChange={(e) => setSize(Number(e.target.value))}\n />\n </FormGroup>\n </div>\n {capabilities.marginIsSupported && (\n <div className={capabilities.svgIsSupported ? 'col-md-4' : 'col-md-6'}>\n <FormGroup>\n <label className=\"mb-0\">Margin: {margin}px</label>\n <input\n type=\"range\"\n className=\"form-control-range\"\n value={margin}\n step={1}\n min={0}\n max={100}\n onChange={(e) => setMargin(Number(e.target.value))}\n />\n </FormGroup>\n </div>\n )}\n {capabilities.svgIsSupported && (\n <div className={capabilities.marginIsSupported ? 'col-md-4' : 'col-md-6'}>\n <DropdownBtn text={`Format (${format})`}>\n <DropdownItem active={format === 'png'} onClick={() => setFormat('png')}>PNG</DropdownItem>\n <DropdownItem active={format === 'svg'} onClick={() => setFormat('svg')}>SVG</DropdownItem>\n </DropdownBtn>\n </div>\n )}\n </Row>\n <div className=\"text-center\">\n <div className=\"mb-3\">\n <div>QR code URL:</div>\n <ExternalLink href={qrCodeUrl} />\n <CopyToClipboardIcon text={qrCodeUrl} />\n </div>\n <img src={qrCodeUrl} className=\"qr-code-modal__img\" alt=\"QR code\" />\n <div className=\"mt-2\">{size}x{size}</div>\n </div>\n </ModalBody>\n </Modal>\n );\n};\n\nexport default QrCodeModal;\n","import { ChangeEvent, FC, useRef } from 'react';\nimport classNames from 'classnames';\nimport { v4 as uuid } from 'uuid';\nimport { identity } from 'ramda';\n\nexport interface BooleanControlProps {\n checked?: boolean;\n onChange?: (checked: boolean, e: ChangeEvent<HTMLInputElement>) => void;\n className?: string;\n inline?: boolean;\n}\n\ninterface BooleanControlWithTypeProps extends BooleanControlProps {\n type: 'switch' | 'checkbox';\n}\n\nconst BooleanControl: FC<BooleanControlWithTypeProps> = (\n { checked = false, onChange = identity, className, children, type, inline = false },\n) => {\n const { current: id } = useRef(uuid());\n const onChecked = (e: ChangeEvent<HTMLInputElement>) => onChange(e.target.checked, e);\n const typeClasses = {\n 'custom-switch': type === 'switch',\n 'custom-checkbox': type === 'checkbox',\n };\n const style = inline ? { display: 'inline-block' } : {};\n\n return (\n <span className={classNames('custom-control', typeClasses, className)} style={style}>\n <input type=\"checkbox\" className=\"custom-control-input\" id={id} checked={checked} onChange={onChecked} />\n <label className=\"custom-control-label\" htmlFor={id}>{children}</label>\n </span>\n );\n};\n\nexport default BooleanControl;\n","import { FC } from 'react';\nimport BooleanControl, { BooleanControlProps } from './BooleanControl';\n\nconst Checkbox: FC<BooleanControlProps> = (props) => <BooleanControl type=\"checkbox\" {...props} />;\n\nexport default Checkbox;\n","import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faInfoCircle as infoIcon } from '@fortawesome/free-solid-svg-icons';\nimport { Modal, ModalBody, ModalHeader } from 'reactstrap';\nimport { useToggle } from '../utils/helpers/hooks';\nimport './UseExistingIfFoundInfoIcon.scss';\n\nconst InfoModal = ({ isOpen, toggle }: { isOpen: boolean; toggle: () => void }) => (\n <Modal isOpen={isOpen} toggle={toggle} centered size=\"lg\">\n <ModalHeader toggle={toggle}>Info</ModalHeader>\n <ModalBody>\n <p>\n When the \n <b><i>"Use existing URL if found"</i></b>\n checkbox is checked, the server will return an existing short URL if it matches provided params.\n </p>\n <p>\n These are the checks performed by Shlink in order to determine if an existing short URL should be returned:\n </p>\n <ul>\n <li>\n When only the long URL is provided: The most recent match will be returned, or a new short URL will be created\n if none is found.\n </li>\n <li>\n When long URL and custom slug and/or domain are provided: Same as in previous case, but it will try to match\n the short URL using both the long URL and the slug, the long URL and the domain, or the three of them.\n <br />\n If the slug is being used by another long URL, an error will be returned.\n </li>\n <li>\n When other params are provided: Same as in previous cases, but it will try to match existing short URLs with\n all provided data. If any of them does not match, a new short URL will be created\n </li>\n </ul>\n </ModalBody>\n </Modal>\n);\n\nconst UseExistingIfFoundInfoIcon = () => {\n const [ isModalOpen, toggleModal ] = useToggle();\n\n return (\n <>\n <span title=\"What does this mean?\">\n <FontAwesomeIcon icon={infoIcon} style={{ cursor: 'pointer' }} onClick={toggleModal} />\n </span>\n <InfoModal isOpen={isModalOpen} toggle={toggleModal} />\n </>\n );\n};\n\nexport default UseExistingIfFoundInfoIcon;\n","import { ChangeEvent, FC, useRef } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faInfoCircle as infoIcon } from '@fortawesome/free-solid-svg-icons';\nimport { UncontrolledTooltip } from 'reactstrap';\nimport Checkbox from '../../utils/Checkbox';\n\ninterface ShortUrlFormCheckboxGroupProps {\n checked?: boolean;\n onChange?: (checked: boolean, e: ChangeEvent<HTMLInputElement>) => void;\n infoTooltip?: string;\n}\n\nconst InfoTooltip: FC<{ tooltip: string }> = ({ tooltip }) => {\n const ref = useRef<HTMLElement | null>();\n\n return (\n <>\n <span\n ref={(el) => {\n ref.current = el;\n }}\n >\n <FontAwesomeIcon icon={infoIcon} />\n </span>\n <UncontrolledTooltip target={(() => ref.current) as any} placement=\"right\">{tooltip}</UncontrolledTooltip>\n </>\n );\n};\n\nexport const ShortUrlFormCheckboxGroup: FC<ShortUrlFormCheckboxGroupProps> = (\n { children, infoTooltip, checked, onChange },\n) => (\n <p>\n <Checkbox inline checked={checked} className={infoTooltip ? 'mr-2' : ''} onChange={onChange}>\n {children}\n </Checkbox>\n {infoTooltip && <InfoTooltip tooltip={infoTooltip} />}\n </p>\n);\n","import { FC, useEffect, useState } from 'react';\nimport { InputType } from 'reactstrap/lib/Input';\nimport { Button, FormGroup, Input, Row } from 'reactstrap';\nimport { isEmpty, pipe, replace, trim } from 'ramda';\nimport classNames from 'classnames';\nimport { parseISO } from 'date-fns';\nimport DateInput, { DateInputProps } from '../utils/DateInput';\nimport {\n supportsCrawlableVisits,\n supportsListingDomains,\n supportsSettingShortCodeLength,\n supportsShortUrlTitle,\n supportsValidateUrl,\n} from '../utils/helpers/features';\nimport { SimpleCard } from '../utils/SimpleCard';\nimport { handleEventPreventingDefault, hasValue } from '../utils/utils';\nimport Checkbox from '../utils/Checkbox';\nimport { SelectedServer } from '../servers/data';\nimport { TagsSelectorProps } from '../tags/helpers/TagsSelector';\nimport { DomainSelectorProps } from '../domains/DomainSelector';\nimport { formatIsoDate } from '../utils/helpers/date';\nimport UseExistingIfFoundInfoIcon from './UseExistingIfFoundInfoIcon';\nimport { ShortUrlData } from './data';\nimport { ShortUrlFormCheckboxGroup } from './helpers/ShortUrlFormCheckboxGroup';\nimport './ShortUrlForm.scss';\n\nexport type Mode = 'create' | 'create-basic' | 'edit';\n\ntype DateFields = 'validSince' | 'validUntil';\ntype NonDateFields = 'longUrl' | 'customSlug' | 'shortCodeLength' | 'domain' | 'maxVisits' | 'title';\n\nexport interface ShortUrlFormProps {\n mode: Mode;\n saving: boolean;\n initialState: ShortUrlData;\n onSave: (shortUrlData: ShortUrlData) => Promise<unknown>;\n selectedServer: SelectedServer;\n}\n\nconst normalizeTag = pipe(trim, replace(/ /g, '-'));\nconst toDate = (date?: string | Date): Date | undefined => typeof date === 'string' ? parseISO(date) : date;\n\nexport const ShortUrlForm = (\n TagsSelector: FC<TagsSelectorProps>,\n DomainSelector: FC<DomainSelectorProps>,\n): FC<ShortUrlFormProps> => ({ mode, saving, onSave, initialState, selectedServer }) => { // eslint-disable-line complexity\n const [ shortUrlData, setShortUrlData ] = useState(initialState);\n const isEdit = mode === 'edit';\n const changeTags = (tags: string[]) => setShortUrlData({ ...shortUrlData, tags: tags.map(normalizeTag) });\n const reset = () => setShortUrlData(initialState);\n const submit = handleEventPreventingDefault(async () => onSave({\n ...shortUrlData,\n validSince: formatIsoDate(shortUrlData.validSince) ?? null,\n validUntil: formatIsoDate(shortUrlData.validUntil) ?? null,\n maxVisits: !hasValue(shortUrlData.maxVisits) ? null : Number(shortUrlData.maxVisits),\n title: !hasValue(shortUrlData.title) ? undefined : shortUrlData.title,\n }).then(() => !isEdit && reset()).catch(() => {}));\n\n useEffect(() => {\n setShortUrlData(initialState);\n }, [ initialState ]);\n\n const renderOptionalInput = (id: NonDateFields, placeholder: string, type: InputType = 'text', props = {}) => (\n <FormGroup>\n <Input\n id={id}\n type={type}\n placeholder={placeholder}\n value={shortUrlData[id] ?? ''}\n onChange={(e) => setShortUrlData({ ...shortUrlData, [id]: e.target.value })}\n {...props}\n />\n </FormGroup>\n );\n const renderDateInput = (id: DateFields, placeholder: string, props: Partial<DateInputProps> = {}) => (\n <div className=\"form-group\">\n <DateInput\n selected={shortUrlData[id] ? toDate(shortUrlData[id] as string | Date) : null}\n placeholderText={placeholder}\n isClearable\n onChange={(date) => setShortUrlData({ ...shortUrlData, [id]: date })}\n {...props}\n />\n </div>\n );\n const basicComponents = (\n <>\n <FormGroup>\n <Input\n bsSize=\"lg\"\n type=\"url\"\n placeholder=\"URL to be shortened\"\n required\n value={shortUrlData.longUrl}\n onChange={(e) => setShortUrlData({ ...shortUrlData, longUrl: e.target.value })}\n />\n </FormGroup>\n\n <FormGroup>\n <TagsSelector selectedTags={shortUrlData.tags ?? []} onChange={changeTags} />\n </FormGroup>\n </>\n );\n\n const showDomainSelector = supportsListingDomains(selectedServer);\n const disableShortCodeLength = !supportsSettingShortCodeLength(selectedServer);\n const supportsTitle = supportsShortUrlTitle(selectedServer);\n const showCustomizeCard = supportsTitle || !isEdit;\n const limitAccessCardClasses = classNames('mb-3', {\n 'col-sm-6': showCustomizeCard,\n 'col-sm-12': !showCustomizeCard,\n });\n const showValidateUrl = supportsValidateUrl(selectedServer);\n const showCrawlableControl = supportsCrawlableVisits(selectedServer);\n const showExtraValidationsCard = showValidateUrl || showCrawlableControl || !isEdit;\n\n return (\n <form className=\"short-url-form\" onSubmit={submit}>\n {mode === 'create-basic' && basicComponents}\n {mode !== 'create-basic' && (\n <>\n <SimpleCard title=\"Basic options\" className=\"mb-3\">\n {basicComponents}\n </SimpleCard>\n\n <Row>\n {showCustomizeCard && (\n <div className=\"col-sm-6 mb-3\">\n <SimpleCard title=\"Customize the short URL\">\n {supportsTitle && renderOptionalInput('title', 'Title')}\n {!isEdit && (\n <>\n <Row>\n <div className=\"col-lg-6\">\n {renderOptionalInput('customSlug', 'Custom slug', 'text', {\n disabled: hasValue(shortUrlData.shortCodeLength),\n })}\n </div>\n <div className=\"col-lg-6\">\n {renderOptionalInput('shortCodeLength', 'Short code length', 'number', {\n min: 4,\n disabled: disableShortCodeLength || hasValue(shortUrlData.customSlug),\n ...disableShortCodeLength && {\n title: 'Shlink 2.1.0 or higher is required to be able to provide the short code length',\n },\n })}\n </div>\n </Row>\n {!showDomainSelector && renderOptionalInput('domain', 'Domain', 'text')}\n {showDomainSelector && (\n <FormGroup>\n <DomainSelector\n value={shortUrlData.domain}\n onChange={(domain?: string) => setShortUrlData({ ...shortUrlData, domain })}\n />\n </FormGroup>\n )}\n </>\n )}\n </SimpleCard>\n </div>\n )}\n\n <div className={limitAccessCardClasses}>\n <SimpleCard title=\"Limit access to the short URL\">\n {renderOptionalInput('maxVisits', 'Maximum number of visits allowed', 'number', { min: 1 })}\n {renderDateInput('validSince', 'Enabled since...', { maxDate: shortUrlData.validUntil ? toDate(shortUrlData.validUntil) : undefined })}\n {renderDateInput('validUntil', 'Enabled until...', { minDate: shortUrlData.validSince ? toDate(shortUrlData.validSince) : undefined })}\n </SimpleCard>\n </div>\n </Row>\n\n {showExtraValidationsCard && (\n <SimpleCard title=\"Extra checks\" className=\"mb-3\">\n {showValidateUrl && (\n <ShortUrlFormCheckboxGroup\n infoTooltip=\"If checked, Shlink will try to reach the long URL, failing in case it's not publicly accessible.\"\n checked={shortUrlData.validateUrl}\n onChange={(validateUrl) => setShortUrlData({ ...shortUrlData, validateUrl })}\n >\n Validate URL\n </ShortUrlFormCheckboxGroup>\n )}\n {showCrawlableControl && (\n <ShortUrlFormCheckboxGroup\n infoTooltip=\"This short URL will be included in the robots.txt for your Shlink instance, allowing web crawlers (like Google) to index it.\"\n checked={shortUrlData.crawlable}\n onChange={(crawlable) => setShortUrlData({ ...shortUrlData, crawlable })}\n >\n Make it crawlable\n </ShortUrlFormCheckboxGroup>\n )}\n {!isEdit && (\n <p>\n <Checkbox\n inline\n className=\"mr-2\"\n checked={shortUrlData.findIfExists}\n onChange={(findIfExists) => setShortUrlData({ ...shortUrlData, findIfExists })}\n >\n Use existing URL if found\n </Checkbox>\n <UseExistingIfFoundInfoIcon />\n </p>\n )}\n </SimpleCard>\n )}\n </>\n )}\n\n <div className=\"text-center\">\n <Button\n outline\n color=\"primary\"\n disabled={saving || isEmpty(shortUrlData.longUrl)}\n className=\"btn-xs-block\"\n >\n {saving ? 'Saving...' : 'Save'}\n </Button>\n </div>\n </form>\n );\n};\n","import { FC, useEffect, useMemo } from 'react';\nimport { RouteComponentProps } from 'react-router';\nimport { Button, Card } from 'reactstrap';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faArrowLeft } from '@fortawesome/free-solid-svg-icons';\nimport { ExternalLink } from 'react-external-link';\nimport { SelectedServer } from '../servers/data';\nimport { Settings, ShortUrlCreationSettings } from '../settings/reducers/settings';\nimport { OptionalString } from '../utils/utils';\nimport { parseQuery } from '../utils/helpers/query';\nimport Message from '../utils/Message';\nimport { Result } from '../utils/Result';\nimport { ShlinkApiError } from '../api/ShlinkApiError';\nimport { useToggle } from '../utils/helpers/hooks';\nimport { ShortUrlFormProps } from './ShortUrlForm';\nimport { ShortUrlDetail } from './reducers/shortUrlDetail';\nimport { EditShortUrlData, ShortUrl, ShortUrlData } from './data';\nimport { ShortUrlEdition } from './reducers/shortUrlEdition';\n\ninterface EditShortUrlConnectProps extends RouteComponentProps<{ shortCode: string }> {\n settings: Settings;\n selectedServer: SelectedServer;\n shortUrlDetail: ShortUrlDetail;\n shortUrlEdition: ShortUrlEdition;\n getShortUrlDetail: (shortCode: string, domain: OptionalString) => void;\n editShortUrl: (shortUrl: string, domain: OptionalString, data: EditShortUrlData) => Promise<void>;\n}\n\nconst getInitialState = (shortUrl?: ShortUrl, settings?: ShortUrlCreationSettings): ShortUrlData => {\n const validateUrl = settings?.validateUrls ?? false;\n\n if (!shortUrl) {\n return { longUrl: '', validateUrl };\n }\n\n return {\n longUrl: shortUrl.longUrl,\n tags: shortUrl.tags,\n title: shortUrl.title ?? undefined,\n domain: shortUrl.domain ?? undefined,\n validSince: shortUrl.meta.validSince ?? undefined,\n validUntil: shortUrl.meta.validUntil ?? undefined,\n maxVisits: shortUrl.meta.maxVisits ?? undefined,\n crawlable: shortUrl.crawlable,\n validateUrl,\n };\n};\n\nexport const EditShortUrl = (ShortUrlForm: FC<ShortUrlFormProps>) => ({\n history: { goBack },\n match: { params },\n location: { search },\n settings: { shortUrlCreation: shortUrlCreationSettings },\n selectedServer,\n shortUrlDetail,\n getShortUrlDetail,\n shortUrlEdition,\n editShortUrl,\n}: EditShortUrlConnectProps) => {\n const { loading, error, errorData, shortUrl } = shortUrlDetail;\n const { saving, error: savingError, errorData: savingErrorData } = shortUrlEdition;\n const { domain } = parseQuery<{ domain?: string }>(search);\n const initialState = useMemo(\n () => getInitialState(shortUrl, shortUrlCreationSettings),\n [ shortUrl, shortUrlCreationSettings ],\n );\n const [ savingSucceeded,, isSuccessful, isNotSuccessful ] = useToggle();\n\n useEffect(() => {\n getShortUrlDetail(params.shortCode, domain);\n }, []);\n\n if (loading) {\n return <Message loading />;\n }\n\n if (error) {\n return (\n <Result type=\"error\">\n <ShlinkApiError errorData={errorData} fallbackMessage=\"An error occurred while loading short URL detail :(\" />\n </Result>\n );\n }\n\n return (\n <>\n <header className=\"mb-3\">\n <Card body>\n <h2 className=\"d-sm-flex justify-content-between align-items-center mb-0\">\n <Button color=\"link\" size=\"lg\" className=\"p-0 mr-3\" onClick={goBack}>\n <FontAwesomeIcon icon={faArrowLeft} />\n </Button>\n <span className=\"text-center\">\n <small>Edit <ExternalLink href={shortUrl?.shortUrl ?? ''} /></small>\n </span>\n <span />\n </h2>\n </Card>\n </header>\n <ShortUrlForm\n initialState={initialState}\n saving={saving}\n selectedServer={selectedServer}\n mode=\"edit\"\n onSave={async (shortUrlData) => {\n if (!shortUrl) {\n return;\n }\n\n isNotSuccessful();\n editShortUrl(shortUrl.shortCode, shortUrl.domain, shortUrlData)\n .then(isSuccessful)\n .catch(isNotSuccessful);\n }}\n />\n {savingError && (\n <Result type=\"error\" className=\"mt-3\">\n <ShlinkApiError errorData={savingErrorData} fallbackMessage=\"An error occurred while updating short URL :(\" />\n </Result>\n )}\n {savingSucceeded && <Result type=\"success\" className=\"mt-3\">Short URL properly edited.</Result>}\n </>\n );\n};\n","import { Action, Dispatch } from 'redux';\nimport { ShortUrl } from '../data';\nimport { buildReducer } from '../../utils/helpers/redux';\nimport { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';\nimport { OptionalString } from '../../utils/utils';\nimport { GetState } from '../../container/types';\nimport { shortUrlMatches } from '../helpers';\nimport { ProblemDetailsError } from '../../api/types';\nimport { parseApiError } from '../../api/utils';\n\n/* eslint-disable padding-line-between-statements */\nexport const GET_SHORT_URL_DETAIL_START = 'shlink/shortUrlDetail/GET_SHORT_URL_DETAIL_START';\nexport const GET_SHORT_URL_DETAIL_ERROR = 'shlink/shortUrlDetail/GET_SHORT_URL_DETAIL_ERROR';\nexport const GET_SHORT_URL_DETAIL = 'shlink/shortUrlDetail/GET_SHORT_URL_DETAIL';\n/* eslint-enable padding-line-between-statements */\n\nexport interface ShortUrlDetail {\n shortUrl?: ShortUrl;\n loading: boolean;\n error: boolean;\n errorData?: ProblemDetailsError;\n}\n\nexport interface ShortUrlDetailAction extends Action<string> {\n shortUrl: ShortUrl;\n}\n\nexport interface ShortUrlDetailFailedAction extends Action<string> {\n errorData?: ProblemDetailsError;\n}\n\nconst initialState: ShortUrlDetail = {\n loading: false,\n error: false,\n};\n\nexport default buildReducer<ShortUrlDetail, ShortUrlDetailAction & ShortUrlDetailFailedAction>({\n [GET_SHORT_URL_DETAIL_START]: () => ({ loading: true, error: false }),\n [GET_SHORT_URL_DETAIL_ERROR]: (_, { errorData }) => ({ loading: false, error: true, errorData }),\n [GET_SHORT_URL_DETAIL]: (_, { shortUrl }) => ({ shortUrl, ...initialState }),\n}, initialState);\n\nexport const getShortUrlDetail = (buildShlinkApiClient: ShlinkApiClientBuilder) => (\n shortCode: string,\n domain: OptionalString,\n) => async (dispatch: Dispatch, getState: GetState) => {\n dispatch({ type: GET_SHORT_URL_DETAIL_START });\n\n try {\n const { shortUrlsList } = getState();\n const shortUrl = shortUrlsList?.shortUrls?.data.find(\n (shortUrl) => shortUrlMatches(shortUrl, shortCode, domain),\n ) ?? await buildShlinkApiClient(getState).getShortUrl(shortCode, domain);\n\n dispatch<ShortUrlDetailAction>({ shortUrl, type: GET_SHORT_URL_DETAIL });\n } catch (e) {\n dispatch<ShortUrlDetailFailedAction>({ type: GET_SHORT_URL_DETAIL_ERROR, errorData: parseApiError(e) });\n }\n};\n","import Bottle from 'bottlejs';\nimport ShortUrls from '../ShortUrls';\nimport SearchBar from '../SearchBar';\nimport ShortUrlsList from '../ShortUrlsList';\nimport ShortUrlsRow from '../helpers/ShortUrlsRow';\nimport ShortUrlsRowMenu from '../helpers/ShortUrlsRowMenu';\nimport CreateShortUrl from '../CreateShortUrl';\nimport DeleteShortUrlModal from '../helpers/DeleteShortUrlModal';\nimport CreateShortUrlResult from '../helpers/CreateShortUrlResult';\nimport { listShortUrls } from '../reducers/shortUrlsList';\nimport { createShortUrl, resetCreateShortUrl } from '../reducers/shortUrlCreation';\nimport { deleteShortUrl, resetDeleteShortUrl } from '../reducers/shortUrlDeletion';\nimport { resetShortUrlParams } from '../reducers/shortUrlsListParams';\nimport { editShortUrl } from '../reducers/shortUrlEdition';\nimport { ConnectDecorator } from '../../container/types';\nimport { ShortUrlsTable } from '../ShortUrlsTable';\nimport QrCodeModal from '../helpers/QrCodeModal';\nimport { ShortUrlForm } from '../ShortUrlForm';\nimport { EditShortUrl } from '../EditShortUrl';\nimport { getShortUrlDetail } from '../reducers/shortUrlDetail';\n\nconst provideServices = (bottle: Bottle, connect: ConnectDecorator) => {\n // Components\n bottle.serviceFactory('ShortUrls', ShortUrls, 'SearchBar', 'ShortUrlsList');\n bottle.decorator('ShortUrls', connect([ 'shortUrlsList' ]));\n\n bottle.serviceFactory('ShortUrlsList', ShortUrlsList, 'ShortUrlsTable');\n bottle.decorator('ShortUrlsList', connect(\n [ 'selectedServer', 'shortUrlsListParams', 'mercureInfo' ],\n [ 'listShortUrls', 'resetShortUrlParams', 'createNewVisits', 'loadMercureInfo' ],\n ));\n\n bottle.serviceFactory('ShortUrlsTable', ShortUrlsTable, 'ShortUrlsRow');\n bottle.serviceFactory('ShortUrlsRow', ShortUrlsRow, 'ShortUrlsRowMenu', 'ColorGenerator', 'useStateFlagTimeout');\n bottle.serviceFactory('ShortUrlsRowMenu', ShortUrlsRowMenu, 'DeleteShortUrlModal', 'QrCodeModal');\n bottle.serviceFactory('CreateShortUrlResult', CreateShortUrlResult, 'useStateFlagTimeout');\n bottle.serviceFactory('ShortUrlForm', ShortUrlForm, 'TagsSelector', 'DomainSelector');\n\n bottle.serviceFactory('CreateShortUrl', CreateShortUrl, 'ShortUrlForm', 'CreateShortUrlResult');\n bottle.decorator(\n 'CreateShortUrl',\n connect([ 'shortUrlCreationResult', 'selectedServer', 'settings' ], [ 'createShortUrl', 'resetCreateShortUrl' ]),\n );\n\n bottle.serviceFactory('EditShortUrl', EditShortUrl, 'ShortUrlForm');\n bottle.decorator('EditShortUrl', connect(\n [ 'shortUrlDetail', 'shortUrlEdition', 'selectedServer', 'settings' ],\n [ 'getShortUrlDetail', 'editShortUrl' ],\n ));\n\n bottle.serviceFactory('DeleteShortUrlModal', () => DeleteShortUrlModal);\n bottle.decorator('DeleteShortUrlModal', connect([ 'shortUrlDeletion' ], [ 'deleteShortUrl', 'resetDeleteShortUrl' ]));\n\n bottle.serviceFactory('QrCodeModal', () => QrCodeModal);\n bottle.decorator('QrCodeModal', connect([ 'selectedServer' ]));\n\n // Services\n bottle.serviceFactory('SearchBar', SearchBar, 'ColorGenerator');\n bottle.decorator('SearchBar', connect([ 'shortUrlsListParams' ], [ 'listShortUrls' ]));\n\n // Actions\n bottle.serviceFactory('listShortUrls', listShortUrls, 'buildShlinkApiClient');\n bottle.serviceFactory('resetShortUrlParams', () => resetShortUrlParams);\n\n bottle.serviceFactory('createShortUrl', createShortUrl, 'buildShlinkApiClient');\n bottle.serviceFactory('resetCreateShortUrl', () => resetCreateShortUrl);\n\n bottle.serviceFactory('deleteShortUrl', deleteShortUrl, 'buildShlinkApiClient');\n bottle.serviceFactory('resetDeleteShortUrl', () => resetDeleteShortUrl);\n\n bottle.serviceFactory('getShortUrlDetail', getShortUrlDetail, 'buildShlinkApiClient');\n\n bottle.serviceFactory('editShortUrl', editShortUrl, 'buildShlinkApiClient');\n};\n\nexport default provideServices;\n","import { FC } from 'react';\nimport { v4 as uuid } from 'uuid';\nimport { InputType } from 'reactstrap/lib/Input';\n\ninterface FormGroupContainerProps {\n value: string;\n onChange: (newValue: string) => void;\n id?: string;\n type?: InputType;\n required?: boolean;\n}\n\nexport const FormGroupContainer: FC<FormGroupContainerProps> = (\n { children, value, onChange, id = uuid(), type = 'text', required = true },\n) => (\n <div className=\"form-group\">\n <label htmlFor={id} className=\"create-server__label\">\n {children}:\n </label>\n <input\n className=\"form-control\"\n type={type}\n id={id}\n value={value}\n required={required}\n onChange={(e) => onChange(e.target.value)}\n />\n </div>\n);\n","import { FC, ReactNode, useEffect, useState } from 'react';\nimport { FormGroupContainer } from '../../utils/FormGroupContainer';\nimport { handleEventPreventingDefault } from '../../utils/utils';\nimport { ServerData } from '../data';\nimport { SimpleCard } from '../../utils/SimpleCard';\nimport './ServerForm.scss';\n\ninterface ServerFormProps {\n onSubmit: (server: ServerData) => void;\n initialValues?: ServerData;\n title?: ReactNode;\n}\n\nexport const ServerForm: FC<ServerFormProps> = ({ onSubmit, initialValues, children, title }) => {\n const [ name, setName ] = useState('');\n const [ url, setUrl ] = useState('');\n const [ apiKey, setApiKey ] = useState('');\n const handleSubmit = handleEventPreventingDefault(() => onSubmit({ name, url, apiKey }));\n\n useEffect(() => {\n initialValues && setName(initialValues.name);\n initialValues && setUrl(initialValues.url);\n initialValues && setApiKey(initialValues.apiKey);\n }, [ initialValues ]);\n\n return (\n <form className=\"server-form\" onSubmit={handleSubmit}>\n <SimpleCard className=\"mb-3\" title={title}>\n <FormGroupContainer value={name} onChange={setName}>Name</FormGroupContainer>\n <FormGroupContainer type=\"url\" value={url} onChange={setUrl}>URL</FormGroupContainer>\n <FormGroupContainer value={apiKey} onChange={setApiKey}>API key</FormGroupContainer>\n </SimpleCard>\n\n <div className=\"text-right\">{children}</div>\n </form>\n );\n};\n","import { FC } from 'react';\nimport { v4 as uuid } from 'uuid';\nimport { RouterProps } from 'react-router';\nimport { Result } from '../utils/Result';\nimport NoMenuLayout from '../common/NoMenuLayout';\nimport { StateFlagTimeout } from '../utils/helpers/hooks';\nimport { ServerForm } from './helpers/ServerForm';\nimport { ImportServersBtnProps } from './helpers/ImportServersBtn';\nimport { ServerData, ServerWithId } from './data';\nimport './CreateServer.scss';\n\nconst SHOW_IMPORT_MSG_TIME = 4000;\n\ninterface CreateServerProps extends RouterProps {\n createServer: (server: ServerWithId) => void;\n}\n\nconst ImportResult = ({ type }: { type: 'error' | 'success' }) => (\n <Result type={type}>\n {type === 'success' && 'Servers properly imported. You can now select one from the list :)'}\n {type === 'error' && 'The servers could not be imported. Make sure the format is correct.'}\n </Result>\n);\n\nconst CreateServer = (ImportServersBtn: FC<ImportServersBtnProps>, useStateFlagTimeout: StateFlagTimeout) => (\n { createServer, history: { push } }: CreateServerProps,\n) => {\n const [ serversImported, setServersImported ] = useStateFlagTimeout(false, SHOW_IMPORT_MSG_TIME);\n const [ errorImporting, setErrorImporting ] = useStateFlagTimeout(false, SHOW_IMPORT_MSG_TIME);\n const handleSubmit = (serverData: ServerData) => {\n const id = uuid();\n\n createServer({ ...serverData, id });\n push(`/server/${id}`);\n };\n\n return (\n <NoMenuLayout>\n <ServerForm title={<h5 className=\"mb-0\">Add new server</h5>} onSubmit={handleSubmit}>\n <ImportServersBtn onImport={setServersImported} onImportError={setErrorImporting} />\n <button className=\"btn btn-outline-primary\">Create server</button>\n </ServerForm>\n\n {(serversImported || errorImporting) && (\n <div className=\"mt-3\">\n {serversImported && <ImportResult type=\"success\" />}\n {errorImporting && <ImportResult type=\"error\" />}\n </div>\n )}\n </NoMenuLayout>\n );\n};\n\nexport default CreateServer;\n","import { isEmpty, values } from 'ramda';\nimport { DropdownItem, DropdownMenu, DropdownToggle, UncontrolledDropdown } from 'reactstrap';\nimport { Link } from 'react-router-dom';\nimport { faPlus as plusIcon, faFileDownload as exportIcon, faServer as serverIcon } from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport ServersExporter from './services/ServersExporter';\nimport { isServerWithId, SelectedServer, ServersMap } from './data';\n\nexport interface ServersDropdownProps {\n servers: ServersMap;\n selectedServer: SelectedServer;\n}\n\nconst ServersDropdown = (serversExporter: ServersExporter) => ({ servers, selectedServer }: ServersDropdownProps) => {\n const serversList = values(servers);\n const createServerItem = (\n <DropdownItem tag={Link} to=\"/server/create\">\n <FontAwesomeIcon icon={plusIcon} /> <span className=\"ml-1\">Add a server</span>\n </DropdownItem>\n );\n\n const renderServers = () => {\n if (isEmpty(serversList)) {\n return createServerItem;\n }\n\n return (\n <>\n {serversList.map(({ name, id }) => (\n <DropdownItem\n key={id}\n tag={Link}\n to={`/server/${id}`}\n active={isServerWithId(selectedServer) && selectedServer.id === id}\n >\n {name}\n </DropdownItem>\n ))}\n <DropdownItem divider />\n {createServerItem}\n <DropdownItem className=\"servers-dropdown__export-item\" onClick={async () => serversExporter.exportServers()}>\n <FontAwesomeIcon icon={exportIcon} /> <span className=\"ml-1\">Export servers</span>\n </DropdownItem>\n </>\n );\n };\n\n return (\n <UncontrolledDropdown nav inNavbar>\n <DropdownToggle nav caret>\n <FontAwesomeIcon icon={serverIcon} /> <span className=\"ml-1\">Servers</span>\n </DropdownToggle>\n <DropdownMenu right>{renderServers()}</DropdownMenu>\n </UncontrolledDropdown>\n );\n};\n\nexport default ServersDropdown;\n","import { Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap';\nimport { RouterProps } from 'react-router';\nimport { ServerWithId } from './data';\n\nexport interface DeleteServerModalProps {\n server: ServerWithId;\n toggle: () => void;\n isOpen: boolean;\n}\n\ninterface DeleteServerModalConnectProps extends DeleteServerModalProps, RouterProps {\n deleteServer: (server: ServerWithId) => void;\n}\n\nconst DeleteServerModal = ({ server, toggle, isOpen, deleteServer, history }: DeleteServerModalConnectProps) => {\n const closeModal = () => {\n deleteServer(server);\n toggle();\n history.push('/');\n };\n\n return (\n <Modal isOpen={isOpen} toggle={toggle} centered>\n <ModalHeader toggle={toggle}><span className=\"text-danger\">Remove server</span></ModalHeader>\n <ModalBody>\n <p>Are you sure you want to remove <b>{server ? server.name : ''}</b>?</p>\n <p>\n <i>\n No data will be deleted, only the access to this server will be removed from this device.\n You can create it again at any moment.\n </i>\n </p>\n </ModalBody>\n <ModalFooter>\n <button className=\"btn btn-link\" onClick={toggle}>Cancel</button>\n <button className=\"btn btn-danger\" onClick={() => closeModal()}>Delete</button>\n </ModalFooter>\n </Modal>\n );\n};\n\nexport default DeleteServerModal;\n","import { FC } from 'react';\nimport { faMinusCircle as deleteIcon } from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { useToggle } from '../utils/helpers/hooks';\nimport { DeleteServerModalProps } from './DeleteServerModal';\nimport { ServerWithId } from './data';\n\nexport interface DeleteServerButtonProps {\n server: ServerWithId;\n className?: string;\n textClassName?: string;\n}\n\nconst DeleteServerButton = (DeleteServerModal: FC<DeleteServerModalProps>): FC<DeleteServerButtonProps> => (\n { server, className, children, textClassName },\n) => {\n const [ isModalOpen, , showModal, hideModal ] = useToggle();\n\n return (\n <>\n <span className={className} onClick={showModal}>\n {!children && <FontAwesomeIcon icon={deleteIcon} />}\n <span className={textClassName}>{children ?? 'Remove this server'}</span>\n </span>\n\n <DeleteServerModal server={server} isOpen={isModalOpen} toggle={hideModal} />\n </>\n );\n};\n\nexport default DeleteServerButton;\n","import { FC } from 'react';\nimport { Button } from 'reactstrap';\nimport NoMenuLayout from '../common/NoMenuLayout';\nimport { ServerForm } from './helpers/ServerForm';\nimport { withSelectedServer } from './helpers/withSelectedServer';\nimport { isServerWithId, ServerData } from './data';\n\ninterface EditServerProps {\n editServer: (serverId: string, serverData: ServerData) => void;\n}\n\nexport const EditServer = (ServerError: FC) => withSelectedServer<EditServerProps>((\n { editServer, selectedServer, history: { push, goBack } },\n) => {\n if (!isServerWithId(selectedServer)) {\n return null;\n }\n\n const handleSubmit = (serverData: ServerData) => {\n editServer(selectedServer.id, serverData);\n push(`/server/${selectedServer.id}`);\n };\n\n return (\n <NoMenuLayout>\n <ServerForm\n title={<h5 className=\"mb-0\">Edit "{selectedServer.name}"</h5>}\n initialValues={selectedServer}\n onSubmit={handleSubmit}\n >\n <Button outline className=\"mr-2\" onClick={goBack}>Cancel</Button>\n <Button outline color=\"primary\">Save</Button>\n </ServerForm>\n </NoMenuLayout>\n );\n}, ServerError);\n","import { useRef, RefObject, ChangeEvent, MutableRefObject } from 'react';\nimport { UncontrolledTooltip } from 'reactstrap';\nimport ServersImporter from '../services/ServersImporter';\nimport { ServerData } from '../data';\n\ntype Ref<T> = RefObject<T> | MutableRefObject<T>;\n\nexport interface ImportServersBtnProps {\n onImport?: () => void;\n onImportError?: (error: Error) => void;\n}\n\ninterface ImportServersBtnConnectProps extends ImportServersBtnProps {\n createServers: (servers: ServerData[]) => void;\n fileRef: Ref<HTMLInputElement>;\n}\n\nconst ImportServersBtn = ({ importServersFromFile }: ServersImporter) => ({\n createServers,\n fileRef,\n onImport = () => {},\n onImportError = () => {},\n}: ImportServersBtnConnectProps) => {\n const ref = fileRef ?? useRef<HTMLInputElement>();\n const onChange = async ({ target }: ChangeEvent<HTMLInputElement>) =>\n importServersFromFile(target.files?.[0])\n .then(createServers)\n .then(onImport)\n .then(() => {\n // Reset input after processing file\n (target as { value: string | null }).value = null;\n })\n .catch(onImportError);\n\n return (\n <>\n <button\n type=\"button\"\n className=\"btn btn-outline-secondary mr-2\"\n id=\"importBtn\"\n onClick={() => ref.current?.click()}\n >\n Import from file\n </button>\n <UncontrolledTooltip placement=\"top\" target=\"importBtn\">\n You can create servers by importing a CSV file with columns <b>name</b>, <b>apiKey</b> and <b>url</b>.\n </UncontrolledTooltip>\n\n <input type=\"file\" accept=\"text/csv\" className=\"create-server__csv-select\" ref={ref} onChange={onChange} />\n </>\n );\n};\n\nexport default ImportServersBtn;\n","import { identity, memoizeWith, pipe } from 'ramda';\nimport { Action, Dispatch } from 'redux';\nimport { resetShortUrlParams } from '../../short-urls/reducers/shortUrlsListParams';\nimport { versionToPrintable, versionToSemVer as toSemVer } from '../../utils/helpers/version';\nimport { SelectedServer } from '../data';\nimport { GetState } from '../../container/types';\nimport { ShlinkHealth } from '../../api/types';\nimport { buildActionCreator, buildReducer } from '../../utils/helpers/redux';\nimport { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';\n\n/* eslint-disable padding-line-between-statements */\nexport const SELECT_SERVER = 'shlink/selectedServer/SELECT_SERVER';\nexport const RESET_SELECTED_SERVER = 'shlink/selectedServer/RESET_SELECTED_SERVER';\n\nexport const MIN_FALLBACK_VERSION = '1.0.0';\nexport const MAX_FALLBACK_VERSION = '999.999.999';\nexport const LATEST_VERSION_CONSTRAINT = 'latest';\n/* eslint-enable padding-line-between-statements */\n\nexport interface SelectServerAction extends Action<string> {\n selectedServer: SelectedServer;\n}\n\nconst versionToSemVer = pipe(\n (version: string) => version === LATEST_VERSION_CONSTRAINT ? MAX_FALLBACK_VERSION : version,\n toSemVer(MIN_FALLBACK_VERSION),\n);\n\nconst getServerVersion = memoizeWith(\n identity,\n async (_serverId: string, health: () => Promise<ShlinkHealth>) => health().then(({ version }) => ({\n version: versionToSemVer(version),\n printableVersion: versionToPrintable(version),\n })),\n);\n\nconst initialState: SelectedServer = null;\n\nexport default buildReducer<SelectedServer, SelectServerAction>({\n [RESET_SELECTED_SERVER]: () => initialState,\n [SELECT_SERVER]: (_, { selectedServer }) => selectedServer,\n}, initialState);\n\nexport const resetSelectedServer = buildActionCreator(RESET_SELECTED_SERVER);\n\nexport const selectServer = (\n buildShlinkApiClient: ShlinkApiClientBuilder,\n loadMercureInfo: () => Action,\n) => (\n serverId: string,\n) => async (\n dispatch: Dispatch,\n getState: GetState,\n) => {\n dispatch(resetSelectedServer());\n dispatch(resetShortUrlParams());\n\n const { servers } = getState();\n const selectedServer = servers[serverId];\n\n if (!selectedServer) {\n dispatch<SelectServerAction>({\n type: SELECT_SERVER,\n selectedServer: { serverNotFound: true },\n });\n\n return;\n }\n\n try {\n const { health } = buildShlinkApiClient(selectedServer);\n const { version, printableVersion } = await getServerVersion(serverId, health);\n\n dispatch<SelectServerAction>({\n type: SELECT_SERVER,\n selectedServer: {\n ...selectedServer,\n version,\n printableVersion,\n },\n });\n dispatch(loadMercureInfo());\n } catch (e) {\n dispatch<SelectServerAction>({\n type: SELECT_SERVER,\n selectedServer: { ...selectedServer, serverNotReachable: true },\n });\n }\n};\n","import { assoc, dissoc, map, pipe, reduce } from 'ramda';\nimport { v4 as uuid } from 'uuid';\nimport { Action } from 'redux';\nimport { ServerData, ServersMap, ServerWithId } from '../data';\nimport { buildReducer } from '../../utils/helpers/redux';\n\n/* eslint-disable padding-line-between-statements */\nexport const EDIT_SERVER = 'shlink/servers/EDIT_SERVER';\nexport const DELETE_SERVER = 'shlink/servers/DELETE_SERVER';\nexport const CREATE_SERVERS = 'shlink/servers/CREATE_SERVERS';\n/* eslint-enable padding-line-between-statements */\n\nexport interface CreateServersAction extends Action<string> {\n newServers: ServersMap;\n}\n\nconst initialState: ServersMap = {};\n\nconst serverWithId = (server: ServerWithId | ServerData): ServerWithId => {\n if ((server as ServerWithId).id) {\n return server as ServerWithId;\n }\n\n return assoc('id', uuid(), server);\n};\n\nexport default buildReducer<ServersMap, CreateServersAction>({\n [CREATE_SERVERS]: (state, { newServers }) => ({ ...state, ...newServers }),\n [DELETE_SERVER]: (state, { serverId }: any) => dissoc(serverId, state),\n [EDIT_SERVER]: (state, { serverId, serverData }: any) => !state[serverId]\n ? state\n : assoc(serverId, { ...state[serverId], ...serverData }, state),\n}, initialState);\n\nconst serversListToMap = reduce<ServerWithId, ServersMap>((acc, server) => assoc(server.id, server, acc), {});\n\nexport const createServers = pipe(\n map(serverWithId),\n serversListToMap,\n (newServers: ServersMap) => ({ type: CREATE_SERVERS, newServers }),\n);\n\nexport const createServer = (server: ServerWithId) => createServers([ server ]);\n\nexport const editServer = (serverId: string, serverData: Partial<ServerData>) => ({\n type: EDIT_SERVER,\n serverId,\n serverData,\n});\n\nexport const deleteServer = ({ id }: ServerWithId) => ({ type: DELETE_SERVER, serverId: id });\n","import { pipe, prop } from 'ramda';\nimport { AxiosInstance } from 'axios';\nimport { Dispatch } from 'redux';\nimport { homepage } from '../../../package.json';\nimport { ServerData } from '../data';\nimport { createServers } from './servers';\n\nconst responseToServersList = pipe(\n prop<any, any>('data'),\n (data: any): ServerData[] => {\n if (!Array.isArray(data)) {\n throw new Error('Value is not an array');\n }\n\n return data as ServerData[];\n },\n);\n\nexport const fetchServers = ({ get }: AxiosInstance) => () => async (dispatch: Dispatch) => {\n const remoteList = await get(`${homepage}/servers.json`)\n .then(responseToServersList)\n .catch(() => []);\n\n dispatch(createServers(remoteList));\n};\n","import { FC } from 'react';\nimport { versionMatch, Versions } from '../../utils/helpers/version';\nimport { isReachableServer, SelectedServer } from '../data';\n\ninterface ForServerVersionProps extends Versions {\n selectedServer: SelectedServer;\n}\n\nconst ForServerVersion: FC<ForServerVersionProps> = ({ minVersion, maxVersion, selectedServer, children }) => {\n if (!isReachableServer(selectedServer)) {\n return null;\n }\n\n const { version } = selectedServer;\n const matchesVersion = versionMatch(version, { maxVersion, minVersion });\n\n if (!matchesVersion) {\n return null;\n }\n\n return <>{children}</>;\n};\n\nexport default ForServerVersion;\n","import { FC } from 'react';\nimport { Link } from 'react-router-dom';\nimport Message from '../../utils/Message';\nimport ServersListGroup from '../ServersListGroup';\nimport { DeleteServerButtonProps } from '../DeleteServerButton';\nimport { isServerWithId, SelectedServer, ServersMap } from '../data';\nimport NoMenuLayout from '../../common/NoMenuLayout';\nimport './ServerError.scss';\n\ninterface ServerErrorProps {\n servers: ServersMap;\n selectedServer: SelectedServer;\n}\n\nexport const ServerError = (DeleteServerButton: FC<DeleteServerButtonProps>): FC<ServerErrorProps> => (\n { servers, selectedServer },\n) => (\n <NoMenuLayout>\n <div className=\"server-error__container flex-column\">\n <Message className=\"w-100 mb-3 mb-md-5\" type=\"error\" fullWidth>\n {!isServerWithId(selectedServer) && 'Could not find this Shlink server.'}\n {isServerWithId(selectedServer) && (\n <>\n <p>Oops! Could not connect to this Shlink server.</p>\n Make sure you have internet connection, and the server is properly configured and on-line.\n </>\n )}\n </Message>\n\n <ServersListGroup servers={Object.values(servers)}>\n These are the Shlink servers currently configured. Choose one of\n them or <Link to=\"/server/create\">add a new one</Link>.\n </ServersListGroup>\n\n {isServerWithId(selectedServer) && (\n <div className=\"container mt-3 mt-md-5\">\n <h5>\n Alternatively, if you think you may have miss-configured this server, you\n can <DeleteServerButton server={selectedServer} className=\"server-error__delete-btn\">remove it</DeleteServerButton> or \n <Link to={`/server/${selectedServer.id}/edit`}>edit it</Link>.\n </h5>\n </div>\n )}\n </div>\n </NoMenuLayout>\n);\n","import { FC, useEffect } from 'react';\nimport { Card, CardBody, CardHeader, CardText, CardTitle, Row } from 'reactstrap';\nimport { Link, useHistory } from 'react-router-dom';\nimport { ShortUrlsListParams } from '../short-urls/reducers/shortUrlsListParams';\nimport { ShortUrlsList as ShortUrlsListState } from '../short-urls/reducers/shortUrlsList';\nimport { prettify } from '../utils/helpers/numbers';\nimport { TagsList } from '../tags/reducers/tagsList';\nimport { ShortUrlsTableProps } from '../short-urls/ShortUrlsTable';\nimport { boundToMercureHub } from '../mercure/helpers/boundToMercureHub';\nimport { CreateShortUrlProps } from '../short-urls/CreateShortUrl';\nimport { VisitsOverview } from '../visits/reducers/visitsOverview';\nimport { Versions } from '../utils/helpers/version';\nimport { Topics } from '../mercure/helpers/Topics';\nimport { isServerWithId, SelectedServer } from './data';\nimport './Overview.scss';\n\ninterface OverviewConnectProps {\n shortUrlsList: ShortUrlsListState;\n listShortUrls: (params: ShortUrlsListParams) => void;\n listTags: Function;\n tagsList: TagsList;\n selectedServer: SelectedServer;\n visitsOverview: VisitsOverview;\n loadVisitsOverview: Function;\n}\n\nexport const Overview = (\n ShortUrlsTable: FC<ShortUrlsTableProps>,\n CreateShortUrl: FC<CreateShortUrlProps>,\n ForServerVersion: FC<Versions>,\n) => boundToMercureHub(({\n shortUrlsList,\n listShortUrls,\n listTags,\n tagsList,\n selectedServer,\n loadVisitsOverview,\n visitsOverview,\n}: OverviewConnectProps) => {\n const { loading, shortUrls } = shortUrlsList;\n const { loading: loadingTags } = tagsList;\n const { loading: loadingVisits, visitsCount, orphanVisitsCount } = visitsOverview;\n const serverId = isServerWithId(selectedServer) ? selectedServer.id : '';\n const history = useHistory();\n\n useEffect(() => {\n listShortUrls({ itemsPerPage: 5, orderBy: { dateCreated: 'DESC' } });\n listTags();\n loadVisitsOverview();\n }, []);\n\n return (\n <>\n <Row>\n <div className=\"col-md-6 col-xl-3\">\n <Card className=\"overview__card mb-3\" body>\n <CardTitle tag=\"h5\" className=\"overview__card-title\">Visits</CardTitle>\n <CardText tag=\"h2\">\n <ForServerVersion minVersion=\"2.2.0\">\n {loadingVisits ? 'Loading...' : prettify(visitsCount)}\n </ForServerVersion>\n <ForServerVersion maxVersion=\"2.1.*\">\n <small className=\"text-muted\"><i>Shlink 2.2 is needed</i></small>\n </ForServerVersion>\n </CardText>\n </Card>\n </div>\n <div className=\"col-md-6 col-xl-3\">\n <Card className=\"overview__card mb-3\" body tag={Link} to={`/server/${serverId}/orphan-visits`}>\n <CardTitle tag=\"h5\" className=\"overview__card-title\">Orphan visits</CardTitle>\n <CardText tag=\"h2\">\n <ForServerVersion minVersion=\"2.6.0\">\n {loadingVisits ? 'Loading...' : prettify(orphanVisitsCount ?? 0)}\n </ForServerVersion>\n <ForServerVersion maxVersion=\"2.5.*\">\n <small className=\"text-muted\"><i>Shlink 2.6 is needed</i></small>\n </ForServerVersion>\n </CardText>\n </Card>\n </div>\n <div className=\"col-md-6 col-xl-3\">\n <Card className=\"overview__card mb-3\" body tag={Link} to={`/server/${serverId}/list-short-urls/1`}>\n <CardTitle tag=\"h5\" className=\"overview__card-title\">Short URLs</CardTitle>\n <CardText tag=\"h2\">\n {loading ? 'Loading...' : prettify(shortUrls?.pagination.totalItems ?? 0)}\n </CardText>\n </Card>\n </div>\n <div className=\"col-md-6 col-xl-3\">\n <Card className=\"overview__card mb-3\" body tag={Link} to={`/server/${serverId}/manage-tags`}>\n <CardTitle tag=\"h5\" className=\"overview__card-title\">Tags</CardTitle>\n <CardText tag=\"h2\">{loadingTags ? 'Loading...' : prettify(tagsList.tags.length)}</CardText>\n </Card>\n </div>\n </Row>\n <Card className=\"mb-3\">\n <CardHeader>\n <span className=\"d-sm-none\">Create a short URL</span>\n <h5 className=\"d-none d-sm-inline\">Create a short URL</h5>\n <Link className=\"float-right\" to={`/server/${serverId}/create-short-url`}>Advanced options »</Link>\n </CardHeader>\n <CardBody>\n <CreateShortUrl basicMode />\n </CardBody>\n </Card>\n <Card>\n <CardHeader>\n <span className=\"d-sm-none\">Recently created URLs</span>\n <h5 className=\"d-none d-sm-inline\">Recently created URLs</h5>\n <Link className=\"float-right\" to={`/server/${serverId}/list-short-urls/1`}>See all »</Link>\n </CardHeader>\n <CardBody>\n <ShortUrlsTable\n shortUrlsList={shortUrlsList}\n selectedServer={selectedServer}\n className=\"mb-0\"\n onTagClick={(tag) => history.push(`/server/${serverId}/list-short-urls/1?tag=${tag}`)}\n />\n </CardBody>\n </Card>\n </>\n );\n}, () => [ Topics.visits(), Topics.orphanVisits() ]);\n","import { CsvJson } from 'csvjson';\nimport { ServerData } from '../data';\n\nconst validateServer = (server: any): server is ServerData =>\n typeof server.url === 'string' && typeof server.apiKey === 'string' && typeof server.name === 'string';\n\nconst validateServers = (servers: any): servers is ServerData[] =>\n Array.isArray(servers) && servers.every(validateServer);\n\nexport default class ServersImporter {\n public constructor(private readonly csvJson: CsvJson, private readonly fileReaderFactory: () => FileReader) {}\n\n public readonly importServersFromFile = async (file?: File | null): Promise<ServerData[]> => {\n if (!file) {\n throw new Error('No file provided');\n }\n\n const reader = this.fileReaderFactory();\n\n return new Promise((resolve, reject) => {\n reader.addEventListener('loadend', (e: ProgressEvent<FileReader>) => {\n try {\n // TODO Read as stream, otherwise, if the file is too big, this will block the browser tab\n const content = e.target?.result?.toString() ?? '';\n const servers = this.csvJson.toObject(content);\n\n if (!validateServers(servers)) {\n throw new Error('Provided file does not have the right format.');\n }\n\n resolve(servers);\n } catch (e) {\n reject(e);\n }\n });\n reader.readAsText(file);\n });\n };\n}\n","export const saveCsv = ({ document }: Window, csv: string, filename: string) => {\n const link = document.createElement('a');\n const blob = new Blob([ csv ], { type: 'text/csv;charset=utf-8;' });\n const url = URL.createObjectURL(blob);\n\n link.setAttribute('href', url);\n link.setAttribute('download', filename);\n link.style.visibility = 'hidden';\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n};\n","import { dissoc, values } from 'ramda';\nimport { CsvJson } from 'csvjson';\nimport LocalStorage from '../../utils/services/LocalStorage';\nimport { ServersMap } from '../data';\nimport { saveCsv } from '../../utils/helpers/csv';\n\nconst SERVERS_FILENAME = 'shlink-servers.csv';\n\nexport default class ServersExporter {\n public constructor(\n private readonly storage: LocalStorage,\n private readonly window: Window,\n private readonly csvjson: CsvJson,\n ) {}\n\n public readonly exportServers = async () => {\n const servers = values(this.storage.get<ServersMap>('servers') ?? {}).map(dissoc('id'));\n\n try {\n const csv = this.csvjson.toCSV(servers, { headers: 'key' });\n\n saveCsv(this.window, csv, SERVERS_FILENAME);\n } catch (e) {\n // FIXME Handle error\n console.error(e); // eslint-disable-line no-console\n }\n };\n}\n","import csvjson from 'csvjson';\nimport Bottle, { Decorator } from 'bottlejs';\nimport CreateServer from '../CreateServer';\nimport ServersDropdown from '../ServersDropdown';\nimport DeleteServerModal from '../DeleteServerModal';\nimport DeleteServerButton from '../DeleteServerButton';\nimport { EditServer } from '../EditServer';\nimport ImportServersBtn from '../helpers/ImportServersBtn';\nimport { resetSelectedServer, selectServer } from '../reducers/selectedServer';\nimport { createServer, createServers, deleteServer, editServer } from '../reducers/servers';\nimport { fetchServers } from '../reducers/remoteServers';\nimport ForServerVersion from '../helpers/ForServerVersion';\nimport { ServerError } from '../helpers/ServerError';\nimport { ConnectDecorator } from '../../container/types';\nimport { withoutSelectedServer } from '../helpers/withoutSelectedServer';\nimport { Overview } from '../Overview';\nimport ServersImporter from './ServersImporter';\nimport ServersExporter from './ServersExporter';\n\nconst provideServices = (bottle: Bottle, connect: ConnectDecorator, withRouter: Decorator) => {\n // Components\n bottle.serviceFactory('CreateServer', CreateServer, 'ImportServersBtn', 'useStateFlagTimeout');\n bottle.decorator('CreateServer', withoutSelectedServer);\n bottle.decorator('CreateServer', connect([ 'selectedServer' ], [ 'createServer', 'resetSelectedServer' ]));\n\n bottle.serviceFactory('EditServer', EditServer, 'ServerError');\n bottle.decorator('EditServer', connect([ 'selectedServer' ], [ 'editServer', 'selectServer' ]));\n\n bottle.serviceFactory('ServersDropdown', ServersDropdown, 'ServersExporter');\n bottle.decorator('ServersDropdown', connect([ 'servers', 'selectedServer' ]));\n\n bottle.serviceFactory('DeleteServerModal', () => DeleteServerModal);\n bottle.decorator('DeleteServerModal', withRouter);\n bottle.decorator('DeleteServerModal', connect(null, [ 'deleteServer' ]));\n\n bottle.serviceFactory('DeleteServerButton', DeleteServerButton, 'DeleteServerModal');\n\n bottle.serviceFactory('ImportServersBtn', ImportServersBtn, 'ServersImporter');\n bottle.decorator('ImportServersBtn', connect(null, [ 'createServers' ]));\n\n bottle.serviceFactory('ForServerVersion', () => ForServerVersion);\n bottle.decorator('ForServerVersion', connect([ 'selectedServer' ]));\n\n bottle.serviceFactory('ServerError', ServerError, 'DeleteServerButton');\n bottle.decorator('ServerError', connect([ 'servers', 'selectedServer' ]));\n\n bottle.serviceFactory('Overview', Overview, 'ShortUrlsTable', 'CreateShortUrl', 'ForServerVersion');\n bottle.decorator('Overview', connect(\n [ 'shortUrlsList', 'tagsList', 'selectedServer', 'mercureInfo', 'visitsOverview' ],\n [ 'listShortUrls', 'listTags', 'createNewVisits', 'loadMercureInfo', 'loadVisitsOverview' ],\n ));\n\n // Services\n bottle.constant('csvjson', csvjson);\n bottle.constant('fileReaderFactory', () => new FileReader());\n bottle.service('ServersImporter', ServersImporter, 'csvjson', 'fileReaderFactory');\n bottle.service('ServersExporter', ServersExporter, 'Storage', 'window', 'csvjson');\n\n // Actions\n bottle.serviceFactory('selectServer', selectServer, 'buildShlinkApiClient', 'loadMercureInfo');\n bottle.serviceFactory('createServer', () => createServer);\n bottle.serviceFactory('createServers', () => createServers);\n bottle.serviceFactory('deleteServer', () => deleteServer);\n bottle.serviceFactory('editServer', () => editServer);\n bottle.serviceFactory('fetchServers', fetchServers, 'axios');\n\n bottle.serviceFactory('resetSelectedServer', () => resetSelectedServer);\n};\n\nexport default provideServices;\n","import { Button, Card } from 'reactstrap';\nimport { FC, ReactNode } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faArrowLeft } from '@fortawesome/free-solid-svg-icons';\nimport ShortUrlVisitsCount from '../short-urls/helpers/ShortUrlVisitsCount';\nimport { ShortUrl } from '../short-urls/data';\nimport { Visit } from './types';\n\ninterface VisitsHeaderProps {\n visits: Visit[];\n goBack: () => void;\n title: ReactNode;\n shortUrl?: ShortUrl;\n}\n\nconst VisitsHeader: FC<VisitsHeaderProps> = ({ visits, goBack, shortUrl, children, title }) => (\n <header>\n <Card body>\n <h2 className=\"d-flex justify-content-between align-items-center mb-0\">\n <Button color=\"link\" size=\"lg\" className=\"p-0 mr-3\" onClick={goBack}>\n <FontAwesomeIcon icon={faArrowLeft} />\n </Button>\n <span className=\"text-center d-none d-sm-block\">\n <small>{title}</small>\n </span>\n <span className=\"badge badge-main ml-3\">\n Visits:{' '}\n <ShortUrlVisitsCount visitsCount={visits.length} shortUrl={shortUrl} />\n </span>\n </h2>\n <h3 className=\"text-center d-block d-sm-none mb-0 mt-3\">\n <small>{title}</small>\n </h3>\n\n {children && <div className=\"mt-md-2\">{children}</div>}\n </Card>\n </header>\n);\n\nexport default VisitsHeader;\n","import { UncontrolledTooltip } from 'reactstrap';\nimport { ExternalLink } from 'react-external-link';\nimport { ShortUrlDetail } from '../short-urls/reducers/shortUrlDetail';\nimport { Time } from '../utils/Time';\nimport { ShortUrlVisits } from './reducers/shortUrlVisits';\nimport VisitsHeader from './VisitsHeader';\nimport './ShortUrlVisitsHeader.scss';\n\ninterface ShortUrlVisitsHeaderProps {\n shortUrlDetail: ShortUrlDetail;\n shortUrlVisits: ShortUrlVisits;\n goBack: () => void;\n}\n\nconst ShortUrlVisitsHeader = ({ shortUrlDetail, shortUrlVisits, goBack }: ShortUrlVisitsHeaderProps) => {\n const { shortUrl, loading } = shortUrlDetail;\n const { visits } = shortUrlVisits;\n const shortLink = shortUrl?.shortUrl ?? '';\n const longLink = shortUrl?.longUrl ?? '';\n const title = shortUrl?.title;\n\n const renderDate = () => !shortUrl ? <small>Loading...</small> : (\n <span>\n <b id=\"created\" className=\"short-url-visits-header__created-at\">\n <Time date={shortUrl.dateCreated} relative />\n </b>\n <UncontrolledTooltip placement=\"bottom\" target=\"created\">\n <Time date={shortUrl.dateCreated} />\n </UncontrolledTooltip>\n </span>\n );\n const visitsStatsTitle = <>Visits for <ExternalLink href={shortLink} /></>;\n\n return (\n <VisitsHeader title={visitsStatsTitle} goBack={goBack} visits={visits} shortUrl={shortUrl}>\n <hr />\n <div>Created: {renderDate()}</div>\n <div>\n {`${title ? 'Title' : 'Long URL'}: `}\n {loading && <small>Loading...</small>}\n {!loading && <ExternalLink href={longLink}>{title ?? longLink}</ExternalLink>}\n </div>\n </VisitsHeader>\n );\n};\n\nexport default ShortUrlVisitsHeader;\n","import { DropdownItem, DropdownMenu, DropdownToggle, UncontrolledDropdown } from 'reactstrap';\n\ninterface PaginationDropdownProps {\n ranges: number[];\n value: number;\n setValue: (newValue: number) => void;\n toggleClassName?: string;\n}\n\nconst PaginationDropdown = ({ toggleClassName, ranges, value, setValue }: PaginationDropdownProps) => (\n <UncontrolledDropdown>\n <DropdownToggle caret color=\"link\" className={toggleClassName}>\n Paginate\n </DropdownToggle>\n <DropdownMenu right>\n {ranges.map((itemsPerPage) => (\n <DropdownItem key={itemsPerPage} active={itemsPerPage === value} onClick={() => setValue(itemsPerPage)}>\n <b>{itemsPerPage}</b> items per page\n </DropdownItem>\n ))}\n <DropdownItem divider />\n <DropdownItem disabled={value === Infinity} onClick={() => setValue(Infinity)}>\n <i>Clear pagination</i>\n </DropdownItem>\n </DropdownMenu>\n </UncontrolledDropdown>\n);\n\nexport default PaginationDropdown;\n","import { FC } from 'react';\nimport classNames from 'classnames';\nimport { Pagination, PaginationItem, PaginationLink } from 'reactstrap';\nimport {\n pageIsEllipsis,\n keyForPage,\n NumberOrEllipsis,\n progressivePagination,\n prettifyPageNumber,\n} from '../utils/helpers/pagination';\nimport './SimplePaginator.scss';\n\ninterface SimplePaginatorProps {\n pagesCount: number;\n currentPage: number;\n setCurrentPage: (currentPage: number) => void;\n centered?: boolean;\n}\n\nconst SimplePaginator: FC<SimplePaginatorProps> = ({ pagesCount, currentPage, setCurrentPage, centered = true }) => {\n if (pagesCount < 2) {\n return null;\n }\n\n const onClick = (page: NumberOrEllipsis) => () => !pageIsEllipsis(page) && setCurrentPage(page);\n\n return (\n <Pagination listClassName={classNames('flex-wrap mb-0 simple-paginator', { 'justify-content-center': centered })}>\n <PaginationItem disabled={currentPage <= 1}>\n <PaginationLink previous tag=\"span\" onClick={onClick(currentPage - 1)} />\n </PaginationItem>\n {progressivePagination(currentPage, pagesCount).map((pageNumber, index) => (\n <PaginationItem\n key={keyForPage(pageNumber, index)}\n disabled={pageIsEllipsis(pageNumber)}\n active={currentPage === pageNumber}\n >\n <PaginationLink tag=\"span\" onClick={onClick(pageNumber)}>{prettifyPageNumber(pageNumber)}</PaginationLink>\n </PaginationItem>\n ))}\n <PaginationItem disabled={currentPage >= pagesCount}>\n <PaginationLink next tag=\"span\" onClick={onClick(currentPage + 1)} />\n </PaginationItem>\n </Pagination>\n );\n};\n\nexport default SimplePaginator;\n","import bowser from 'bowser';\nimport { zipObj } from 'ramda';\nimport { Empty, hasValue } from '../utils';\nimport { Stats, UserAgent } from '../../visits/types';\n\nconst DEFAULT = 'Others';\nconst BROWSERS_WHITELIST = [\n 'Android Browser',\n 'Chrome',\n 'Chromium',\n 'Firefox',\n 'Internet Explorer',\n 'Microsoft Edge',\n 'Opera',\n 'Safari',\n 'Samsung Internet for Android',\n 'Vivaldi',\n 'WeChat',\n];\n\nexport const parseUserAgent = (userAgent: string | Empty): UserAgent => {\n if (!hasValue(userAgent)) {\n return { browser: DEFAULT, os: DEFAULT };\n }\n\n const { browser: { name: browser }, os: { name: os } } = bowser.parse(userAgent);\n\n return { os: os ?? DEFAULT, browser: browser && BROWSERS_WHITELIST.includes(browser) ? browser : DEFAULT };\n};\n\nexport const extractDomain = (url: string | Empty): string => {\n if (!hasValue(url)) {\n return 'Direct';\n }\n\n return url.split('/')[url.includes('://') ? 2 : 0]?.split(':')[0] ?? '';\n};\n\nexport const fillTheGaps = (stats: Stats, labels: string[]): number[] =>\n Object.values({ ...zipObj(labels, labels.map(() => 0)), ...stats });\n","import { ChangeEvent, FC } from 'react';\nimport { ChartData, ChartTooltipItem } from 'chart.js';\nimport { prettify } from './numbers';\n\nexport const pointerOnHover = ({ target }: ChangeEvent<HTMLElement>, chartElement: FC[]) => {\n target.style.cursor = chartElement[0] ? 'pointer' : 'default';\n};\n\nexport const renderNonDoughnutChartLabel = (labelToPick: 'yLabel' | 'xLabel') => (\n item: ChartTooltipItem,\n { datasets }: ChartData,\n) => {\n const { datasetIndex } = item;\n const value = item[labelToPick];\n const datasetLabel = datasetIndex !== undefined && datasets?.[datasetIndex]?.label || '';\n\n return `${datasetLabel}: ${prettify(Number(value))}`;\n};\n\nexport const renderDoughnutChartLabel = (\n { datasetIndex, index }: ChartTooltipItem,\n { labels, datasets }: ChartData,\n) => {\n const datasetLabel = index !== undefined && labels?.[index] || '';\n const value = datasetIndex !== undefined && index !== undefined\n && datasets?.[datasetIndex]?.data?.[index]\n || '';\n\n return `${datasetLabel}: ${prettify(Number(value))}`; // eslint-disable-line @typescript-eslint/no-base-to-string\n};\n","import { useState } from 'react';\nimport { Doughnut, HorizontalBar } from 'react-chartjs-2';\nimport { keys, values } from 'ramda';\nimport classNames from 'classnames';\nimport Chart, { ChartData, ChartDataSets, ChartOptions } from 'chart.js';\nimport { fillTheGaps } from '../../utils/helpers/visits';\nimport { Stats } from '../types';\nimport { prettify } from '../../utils/helpers/numbers';\nimport { pointerOnHover, renderDoughnutChartLabel, renderNonDoughnutChartLabel } from '../../utils/helpers/charts';\nimport {\n HIGHLIGHTED_COLOR,\n HIGHLIGHTED_COLOR_ALPHA,\n isDarkThemeEnabled,\n MAIN_COLOR,\n MAIN_COLOR_ALPHA,\n PRIMARY_DARK_COLOR,\n PRIMARY_LIGHT_COLOR,\n} from '../../utils/theme';\nimport './DefaultChart.scss';\n\nexport interface DefaultChartProps {\n title: Function | string;\n stats: Stats;\n isBarChart?: boolean;\n max?: number;\n highlightedStats?: Stats;\n highlightedLabel?: string;\n onClick?: (label: string) => void;\n}\n\nconst generateGraphData = (\n title: Function | string,\n isBarChart: boolean,\n labels: string[],\n data: number[],\n highlightedData?: number[],\n highlightedLabel?: string,\n): ChartData => ({\n labels,\n datasets: [\n {\n title,\n label: highlightedData ? 'Non-selected' : 'Visits',\n data,\n backgroundColor: isBarChart ? MAIN_COLOR_ALPHA : [\n '#97BBCD',\n '#F7464A',\n '#46BFBD',\n '#FDB45C',\n '#949FB1',\n '#57A773',\n '#414066',\n '#08B2E3',\n '#B6C454',\n '#DCDCDC',\n '#463730',\n ],\n borderColor: isBarChart ? MAIN_COLOR : isDarkThemeEnabled() ? PRIMARY_DARK_COLOR : PRIMARY_LIGHT_COLOR,\n borderWidth: 2,\n },\n highlightedData && {\n title,\n label: highlightedLabel ?? 'Selected',\n data: highlightedData,\n backgroundColor: HIGHLIGHTED_COLOR_ALPHA,\n borderColor: HIGHLIGHTED_COLOR,\n borderWidth: 2,\n },\n ].filter(Boolean) as ChartDataSets[],\n});\n\nconst dropLabelIfHidden = (label: string) => label.startsWith('hidden') ? '' : label;\n\nconst determineHeight = (isBarChart: boolean, labels: string[]): number | undefined => {\n if (!isBarChart) {\n return 300;\n }\n\n return isBarChart && labels.length > 20 ? labels.length * 8 : undefined;\n};\n\nconst renderPieChartLegend = ({ config }: Chart) => {\n const { labels = [], datasets = [] } = config.data ?? {};\n const { defaultColor } = config.options ?? {} as any;\n const [{ backgroundColor: colors }] = datasets;\n\n return (\n <ul className=\"default-chart__pie-chart-legend\">\n {labels.map((label, index) => (\n <li key={label as string} className=\"default-chart__pie-chart-legend-item d-flex\">\n <div\n className=\"default-chart__pie-chart-legend-item-color\"\n style={{ backgroundColor: (colors as string[])[index] || defaultColor }}\n />\n <small className=\"default-chart__pie-chart-legend-item-text flex-fill\">{label}</small>\n </li>\n ))}\n </ul>\n );\n};\n\nconst chartElementAtEvent = (onClick?: (label: string) => void) => ([ chart ]: [{ _index: number; _chart: Chart }]) => {\n if (!onClick || !chart) {\n return;\n }\n\n const { _index, _chart: { data } } = chart;\n const { labels } = data;\n\n onClick(labels?.[_index] as string);\n};\n\nconst statsAreDefined = (stats: Stats | undefined): stats is Stats => !!stats && Object.keys(stats).length > 0;\n\nconst DefaultChart = (\n { title, isBarChart = false, stats, max, highlightedStats, highlightedLabel, onClick }: DefaultChartProps,\n) => {\n const Component = isBarChart ? HorizontalBar : Doughnut;\n const labels = keys(stats).map(dropLabelIfHidden);\n const data = values(\n !statsAreDefined(highlightedStats) ? stats : keys(highlightedStats).reduce((acc, highlightedKey) => {\n if (acc[highlightedKey]) {\n acc[highlightedKey] -= highlightedStats[highlightedKey];\n }\n\n return acc;\n }, { ...stats }),\n );\n const highlightedData = statsAreDefined(highlightedStats) ? fillTheGaps(highlightedStats, labels) : undefined;\n const [ chartRef, setChartRef ] = useState<HorizontalBar | Doughnut | undefined>();\n\n const options: ChartOptions = {\n legend: { display: false },\n legendCallback: !isBarChart && renderPieChartLegend as any,\n scales: !isBarChart ? undefined : {\n xAxes: [\n {\n ticks: {\n beginAtZero: true,\n precision: 0,\n callback: prettify,\n max,\n },\n stacked: true,\n },\n ],\n yAxes: [{ stacked: true }],\n },\n tooltips: {\n intersect: !isBarChart,\n // Do not show tooltip on items with empty label when in a bar chart\n filter: ({ yLabel }) => !isBarChart || yLabel !== '',\n callbacks: {\n label: isBarChart ? renderNonDoughnutChartLabel('xLabel') : renderDoughnutChartLabel,\n },\n },\n onHover: !isBarChart ? undefined : (pointerOnHover) as any, // TODO Types seem to be incorrectly defined in @types/chart.js\n };\n const graphData = generateGraphData(title, isBarChart, labels, data, highlightedData, highlightedLabel);\n const height = determineHeight(isBarChart, labels);\n\n // Provide a key based on the height, so that every time the dataset changes, a new graph is rendered\n return (\n <div className=\"row\">\n <div className={classNames('col-sm-12', { 'col-md-7': !isBarChart })}>\n <Component\n ref={(element) => setChartRef(element ?? undefined)}\n key={height}\n data={graphData}\n options={options}\n height={height}\n getElementAtEvent={chartElementAtEvent(onClick)}\n />\n </div>\n {!isBarChart && (\n <div className=\"col-sm-12 col-md-5\">\n {chartRef?.chartInstance.generateLegend()}\n </div>\n )}\n </div>\n );\n};\n\nexport default DefaultChart;\n","import { Card, CardHeader, CardBody, CardFooter } from 'reactstrap';\nimport { ReactNode } from 'react';\nimport DefaultChart, { DefaultChartProps } from './DefaultChart';\nimport './GraphCard.scss';\n\ninterface GraphCardProps extends DefaultChartProps {\n footer?: ReactNode;\n}\n\nconst GraphCard = ({ title, footer, ...rest }: GraphCardProps) => (\n <Card>\n <CardHeader className=\"graph-card__header\">{typeof title === 'function' ? title() : title}</CardHeader>\n <CardBody>\n <DefaultChart title={title} {...rest} />\n </CardBody>\n {footer && <CardFooter className=\"graph-card__footer--sticky\">{footer}</CardFooter>}\n </Card>\n);\n\nexport default GraphCard;\n","import { useState } from 'react';\nimport { fromPairs, pipe, reverse, sortBy, splitEvery, toLower, toPairs, type, zipObj } from 'ramda';\nimport SortingDropdown from '../../utils/SortingDropdown';\nimport PaginationDropdown from '../../utils/PaginationDropdown';\nimport { OrderDir, rangeOf } from '../../utils/utils';\nimport { roundTen } from '../../utils/helpers/numbers';\nimport SimplePaginator from '../../common/SimplePaginator';\nimport { Stats, StatsRow } from '../types';\nimport GraphCard from './GraphCard';\nimport { DefaultChartProps } from './DefaultChart';\n\nconst toLowerIfString = (value: any) => type(value) === 'String' ? toLower(value) : value; // eslint-disable-line @typescript-eslint/no-unsafe-return\nconst pickKeyFromPair = ([ key ]: StatsRow) => key;\nconst pickValueFromPair = ([ , value ]: StatsRow) => value;\n\ninterface SortableBarGraphProps extends DefaultChartProps {\n sortingItems: Record<string, string>;\n withPagination?: boolean;\n extraHeaderContent?: Function;\n}\n\nconst SortableBarGraph = ({\n stats,\n highlightedStats,\n title,\n sortingItems,\n extraHeaderContent,\n withPagination = true,\n ...rest\n}: SortableBarGraphProps) => {\n const [ order, setOrder ] = useState<{ orderField?: string; orderDir?: OrderDir }>({\n orderField: undefined,\n orderDir: undefined,\n });\n const [ currentPage, setCurrentPage ] = useState(1);\n const [ itemsPerPage, setItemsPerPage ] = useState(50);\n\n const getSortedPairsForStats = (stats: Stats, sortingItems: Record<string, string>) => {\n const pairs = toPairs(stats);\n const sortedPairs = !order.orderField ? pairs : sortBy(\n pipe<StatsRow, string | number, string | number>(\n order.orderField === Object.keys(sortingItems)[0] ? pickKeyFromPair : pickValueFromPair,\n toLowerIfString,\n ),\n pairs,\n );\n\n return !order.orderDir || order.orderDir === 'ASC' ? sortedPairs : reverse(sortedPairs);\n };\n const determineCurrentPagePairs = (pages: StatsRow[][]): StatsRow[] => {\n const page = pages[currentPage - 1];\n\n if (currentPage < pages.length) {\n return page;\n }\n\n const firstPageLength = pages[0].length;\n\n // Using the \"hidden\" key, the chart will just replace the label by an empty string\n return [ ...page, ...rangeOf(firstPageLength - page.length, (i): StatsRow => [ `hidden_${i}`, 0 ]) ];\n };\n const renderPagination = (pagesCount: number) =>\n <SimplePaginator currentPage={currentPage} pagesCount={pagesCount} setCurrentPage={setCurrentPage} />;\n const determineStats = (stats: Stats, highlightedStats: Stats | undefined, sortingItems: Record<string, string>) => {\n const sortedPairs = getSortedPairsForStats(stats, sortingItems);\n const sortedKeys = sortedPairs.map(pickKeyFromPair);\n // The highlighted stats have to be ordered based on the regular stats, not on its own values\n const sortedHighlightedPairs = highlightedStats && toPairs(\n { ...zipObj(sortedKeys, sortedKeys.map(() => 0)), ...highlightedStats },\n );\n\n if (sortedPairs.length <= itemsPerPage) {\n return {\n currentPageStats: fromPairs(sortedPairs),\n currentPageHighlightedStats: sortedHighlightedPairs && fromPairs(sortedHighlightedPairs),\n };\n }\n\n const pages = splitEvery(itemsPerPage, sortedPairs);\n const highlightedPages = sortedHighlightedPairs && splitEvery(itemsPerPage, sortedHighlightedPairs);\n\n return {\n currentPageStats: fromPairs(determineCurrentPagePairs(pages)),\n currentPageHighlightedStats: highlightedPages && fromPairs(determineCurrentPagePairs(highlightedPages)),\n pagination: renderPagination(pages.length),\n max: roundTen(Math.max(...sortedPairs.map(pickValueFromPair))),\n };\n };\n\n const { currentPageStats, currentPageHighlightedStats, pagination, max } = determineStats(\n stats,\n highlightedStats && Object.keys(highlightedStats).length > 0 ? highlightedStats : undefined,\n sortingItems,\n );\n const activeCities = Object.keys(currentPageStats);\n const computeTitle = () => (\n <>\n {title}\n <div className=\"float-right\">\n <SortingDropdown\n isButton={false}\n right\n items={sortingItems}\n orderField={order.orderField}\n orderDir={order.orderDir}\n onChange={(orderField, orderDir) => {\n setOrder({ orderField, orderDir });\n setCurrentPage(1);\n }}\n />\n </div>\n {withPagination && Object.keys(stats).length > 50 && (\n <div className=\"float-right\">\n <PaginationDropdown\n toggleClassName=\"btn-sm p-0 mr-3\"\n ranges={[ 50, 100, 200, 500 ]}\n value={itemsPerPage}\n setValue={(itemsPerPage) => {\n setItemsPerPage(itemsPerPage);\n setCurrentPage(1);\n }}\n />\n </div>\n )}\n {extraHeaderContent && (\n <div className=\"float-right\">\n {extraHeaderContent(pagination ? activeCities : undefined)}\n </div>\n )}\n </>\n );\n\n return (\n <GraphCard\n isBarChart\n title={computeTitle}\n stats={currentPageStats}\n highlightedStats={currentPageHighlightedStats}\n footer={pagination}\n max={max}\n {...rest}\n />\n );\n};\n\nexport default SortableBarGraph;\n","import { FC } from 'react';\nimport BooleanControl, { BooleanControlProps } from './BooleanControl';\n\nconst ToggleSwitch: FC<BooleanControlProps> = (props) => <BooleanControl type=\"switch\" {...props} />;\n\nexport default ToggleSwitch;\n","import { useState, useMemo } from 'react';\nimport {\n Card,\n CardHeader,\n CardBody,\n UncontrolledDropdown,\n DropdownToggle,\n DropdownMenu,\n DropdownItem,\n} from 'reactstrap';\nimport { Line } from 'react-chartjs-2';\nimport { always, cond, countBy, reverse } from 'ramda';\nimport {\n add,\n differenceInDays,\n differenceInHours,\n differenceInMonths,\n differenceInWeeks,\n parseISO,\n format,\n startOfISOWeek,\n endOfISOWeek,\n} from 'date-fns';\nimport Chart, { ChartData, ChartDataSets, ChartOptions } from 'chart.js';\nimport { NormalizedVisit, Stats } from '../types';\nimport { fillTheGaps } from '../../utils/helpers/visits';\nimport { useToggle } from '../../utils/helpers/hooks';\nimport { rangeOf } from '../../utils/utils';\nimport ToggleSwitch from '../../utils/ToggleSwitch';\nimport { prettify } from '../../utils/helpers/numbers';\nimport { pointerOnHover, renderNonDoughnutChartLabel } from '../../utils/helpers/charts';\nimport { HIGHLIGHTED_COLOR, MAIN_COLOR } from '../../utils/theme';\nimport './LineChartCard.scss';\n\ninterface LineChartCardProps {\n title: string;\n highlightedLabel?: string;\n visits: NormalizedVisit[];\n highlightedVisits: NormalizedVisit[];\n setSelectedVisits?: (visits: NormalizedVisit[]) => void;\n}\n\ntype Step = 'monthly' | 'weekly' | 'daily' | 'hourly';\n\nconst STEPS_MAP: Record<Step, string> = {\n monthly: 'Month',\n weekly: 'Week',\n daily: 'Day',\n hourly: 'Hour',\n};\n\nconst STEP_TO_DURATION_MAP: Record<Step, (amount: number) => Duration> = {\n hourly: (hours: number) => ({ hours }),\n daily: (days: number) => ({ days }),\n weekly: (weeks: number) => ({ weeks }),\n monthly: (months: number) => ({ months }),\n};\n\nconst STEP_TO_DIFF_FUNC_MAP: Record<Step, (dateLeft: Date, dateRight: Date) => number> = {\n hourly: differenceInHours,\n daily: differenceInDays,\n weekly: differenceInWeeks,\n monthly: differenceInMonths,\n};\n\nconst STEP_TO_DATE_FORMAT: Record<Step, (date: Date) => string> = {\n hourly: (date) => format(date, 'yyyy-MM-dd HH:00'),\n daily: (date) => format(date, 'yyyy-MM-dd'),\n weekly(date) {\n const firstWeekDay = format(startOfISOWeek(date), 'yyyy-MM-dd');\n const lastWeekDay = format(endOfISOWeek(date), 'yyyy-MM-dd');\n\n return `${firstWeekDay} - ${lastWeekDay}`;\n },\n monthly: (date) => format(date, 'yyyy-MM'),\n};\n\nconst determineInitialStep = (oldestVisitDate: string): Step => {\n const now = new Date();\n const oldestDate = parseISO(oldestVisitDate);\n const matcher = cond<never, Step | undefined>([\n [ () => differenceInDays(now, oldestDate) <= 2, always<Step>('hourly') ], // Less than 2 days\n [ () => differenceInMonths(now, oldestDate) <= 1, always<Step>('daily') ], // Between 2 days and 1 month\n [ () => differenceInMonths(now, oldestDate) <= 6, always<Step>('weekly') ], // Between 1 and 6 months\n ]);\n\n return matcher() ?? 'monthly';\n};\n\nconst groupVisitsByStep = (step: Step, visits: NormalizedVisit[]): Stats => countBy(\n (visit) => STEP_TO_DATE_FORMAT[step](parseISO(visit.date)),\n visits,\n);\n\nconst visitsToDatasetGroups = (step: Step, visits: NormalizedVisit[]) =>\n visits.reduce<Record<string, NormalizedVisit[]>>(\n (acc, visit) => {\n const key = STEP_TO_DATE_FORMAT[step](parseISO(visit.date));\n\n acc[key] = acc[key] ?? [];\n acc[key].push(visit);\n\n return acc;\n },\n {},\n );\n\nconst generateLabels = (step: Step, visits: NormalizedVisit[]): string[] => {\n const diffFunc = STEP_TO_DIFF_FUNC_MAP[step];\n const formatter = STEP_TO_DATE_FORMAT[step];\n const newerDate = parseISO(visits[0].date);\n const oldestDate = parseISO(visits[visits.length - 1].date);\n const size = diffFunc(newerDate, oldestDate);\n const duration = STEP_TO_DURATION_MAP[step];\n\n return [\n formatter(oldestDate),\n ...rangeOf(size, (num) => formatter(add(oldestDate, duration(num)))),\n ];\n};\n\nconst generateLabelsAndGroupedVisits = (\n visits: NormalizedVisit[],\n groupedVisitsWithGaps: Stats,\n step: Step,\n skipNoElements: boolean,\n): [string[], number[]] => {\n if (skipNoElements) {\n return [ Object.keys(groupedVisitsWithGaps), Object.values(groupedVisitsWithGaps) ];\n }\n\n const labels = generateLabels(step, visits);\n\n return [ labels, fillTheGaps(groupedVisitsWithGaps, labels) ];\n};\n\nconst generateDataset = (data: number[], label: string, color: string): ChartDataSets => ({\n label,\n data,\n fill: false,\n lineTension: 0.2,\n borderColor: color,\n backgroundColor: color,\n});\n\nlet selectedLabel: string | null = null;\n\nconst chartElementAtEvent = (\n datasetsByPoint: Record<string, NormalizedVisit[]>,\n setSelectedVisits?: (visits: NormalizedVisit[]) => void,\n) => ([ chart ]: [{ _index: number; _chart: Chart }]) => {\n if (!setSelectedVisits || !chart) {\n return;\n }\n\n const { _index: index, _chart: { data } } = chart;\n const { labels } = data as { labels: string[] };\n\n if (selectedLabel === labels[index]) {\n setSelectedVisits([]);\n selectedLabel = null;\n } else {\n setSelectedVisits(labels[index] && datasetsByPoint[labels[index]] || []);\n selectedLabel = labels[index] ?? null;\n }\n};\n\nconst LineChartCard = (\n { title, visits, highlightedVisits, highlightedLabel = 'Selected', setSelectedVisits }: LineChartCardProps,\n) => {\n const [ step, setStep ] = useState<Step>(\n visits.length > 0 ? determineInitialStep(visits[visits.length - 1].date) : 'monthly',\n );\n const [ skipNoVisits, toggleSkipNoVisits ] = useToggle(true);\n\n const datasetsByPoint = useMemo(() => visitsToDatasetGroups(step, visits), [ step, visits ]);\n const groupedVisitsWithGaps = useMemo(() => groupVisitsByStep(step, reverse(visits)), [ step, visits ]);\n const [ labels, groupedVisits ] = useMemo(\n () => generateLabelsAndGroupedVisits(visits, groupedVisitsWithGaps, step, skipNoVisits),\n [ visits, step, skipNoVisits ],\n );\n const groupedHighlighted = useMemo(\n () => fillTheGaps(groupVisitsByStep(step, reverse(highlightedVisits)), labels),\n [ highlightedVisits, step, labels ],\n );\n\n const data: ChartData = {\n labels,\n datasets: [\n generateDataset(groupedVisits, 'Visits', MAIN_COLOR),\n highlightedVisits.length > 0 && generateDataset(groupedHighlighted, highlightedLabel, HIGHLIGHTED_COLOR),\n ].filter(Boolean) as ChartDataSets[],\n };\n const options: ChartOptions = {\n maintainAspectRatio: false,\n legend: { display: false },\n scales: {\n yAxes: [\n {\n ticks: {\n beginAtZero: true,\n precision: 0,\n callback: prettify,\n },\n },\n ],\n xAxes: [\n {\n scaleLabel: { display: true, labelString: STEPS_MAP[step] },\n },\n ],\n },\n tooltips: {\n intersect: false,\n axis: 'x',\n callbacks: {\n label: renderNonDoughnutChartLabel('yLabel'),\n },\n },\n onHover: (pointerOnHover) as any, // TODO Types seem to be incorrectly defined in @types/chart.js\n };\n\n return (\n <Card>\n <CardHeader>\n {title}\n <div className=\"float-right\">\n <UncontrolledDropdown>\n <DropdownToggle caret color=\"link\" className=\"btn-sm p-0\">\n Group by\n </DropdownToggle>\n <DropdownMenu right>\n {Object.entries(STEPS_MAP).map(([ value, menuText ]) => (\n <DropdownItem key={value} active={step === value} onClick={() => setStep(value as Step)}>\n {menuText}\n </DropdownItem>\n ))}\n </DropdownMenu>\n </UncontrolledDropdown>\n </div>\n <div className=\"float-right mr-2\">\n <ToggleSwitch checked={skipNoVisits} onChange={toggleSkipNoVisits}>\n <small>Skip dates with no visits</small>\n </ToggleSwitch>\n </div>\n </CardHeader>\n <CardBody className=\"line-chart-card__body\">\n <Line\n data={data}\n options={options}\n getElementAtEvent={chartElementAtEvent(datasetsByPoint, setSelectedVisits)}\n />\n </CardBody>\n </Card>\n );\n};\n\nexport default LineChartCard;\n","import { useEffect, useMemo, useState, useRef } from 'react';\nimport classNames from 'classnames';\nimport { min, splitEvery } from 'ramda';\nimport {\n faCaretDown as caretDownIcon,\n faCaretUp as caretUpIcon,\n faCheck as checkIcon,\n faRobot as botIcon,\n} from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { UncontrolledTooltip } from 'reactstrap';\nimport SimplePaginator from '../common/SimplePaginator';\nimport SearchField from '../utils/SearchField';\nimport { determineOrderDir, OrderDir } from '../utils/utils';\nimport { prettify } from '../utils/helpers/numbers';\nimport { supportsBotVisits } from '../utils/helpers/features';\nimport { SelectedServer } from '../servers/data';\nimport { Time } from '../utils/Time';\nimport { NormalizedOrphanVisit, NormalizedVisit } from './types';\nimport './VisitsTable.scss';\n\nexport interface VisitsTableProps {\n visits: NormalizedVisit[];\n selectedVisits?: NormalizedVisit[];\n setSelectedVisits: (visits: NormalizedVisit[]) => void;\n matchMedia?: (query: string) => MediaQueryList;\n isOrphanVisits?: boolean;\n selectedServer: SelectedServer;\n}\n\ntype OrderableFields = 'date' | 'country' | 'city' | 'browser' | 'os' | 'referer' | 'visitedUrl' | 'potentialBot';\n\ninterface Order {\n field?: OrderableFields;\n dir?: OrderDir;\n}\n\nconst PAGE_SIZE = 20;\nconst visitMatchesSearch = ({ browser, os, referer, country, city, ...rest }: NormalizedVisit, searchTerm: string) =>\n `${browser} ${os} ${referer} ${country} ${city} ${(rest as NormalizedOrphanVisit).visitedUrl}`.toLowerCase().includes(\n searchTerm.toLowerCase(),\n );\nconst searchVisits = (searchTerm: string, visits: NormalizedVisit[]) =>\n visits.filter((visit) => visitMatchesSearch(visit, searchTerm));\nconst sortVisits = ({ field, dir }: Order, visits: NormalizedVisit[]) => !field || !dir ? visits : visits.sort(\n (a, b) => {\n const greaterThan = dir === 'ASC' ? 1 : -1;\n const smallerThan = dir === 'ASC' ? -1 : 1;\n\n return (a as NormalizedOrphanVisit)[field] > (b as NormalizedOrphanVisit)[field] ? greaterThan : smallerThan;\n },\n);\nconst calculateVisits = (allVisits: NormalizedVisit[], searchTerm: string | undefined, order: Order) => {\n const filteredVisits = searchTerm ? searchVisits(searchTerm, allVisits) : [ ...allVisits ];\n const sortedVisits = sortVisits(order, filteredVisits);\n const total = sortedVisits.length;\n const visitsGroups = splitEvery(PAGE_SIZE, sortedVisits);\n\n return { visitsGroups, total };\n};\n\nconst VisitsTable = ({\n visits,\n selectedVisits = [],\n setSelectedVisits,\n selectedServer,\n matchMedia = window.matchMedia,\n isOrphanVisits = false,\n}: VisitsTableProps) => {\n const headerCellsClass = 'visits-table__header-cell visits-table__sticky';\n const matchMobile = () => matchMedia('(max-width: 767px)').matches;\n\n const [ isMobileDevice, setIsMobileDevice ] = useState(matchMobile());\n const [ searchTerm, setSearchTerm ] = useState<string | undefined>(undefined);\n const [ order, setOrder ] = useState<Order>({ field: undefined, dir: undefined });\n const resultSet = useMemo(() => calculateVisits(visits, searchTerm, order), [ searchTerm, order ]);\n const isFirstLoad = useRef(true);\n const [ page, setPage ] = useState(1);\n const end = page * PAGE_SIZE;\n const start = end - PAGE_SIZE;\n const supportsBots = supportsBotVisits(selectedServer);\n const fullSizeColSpan = 7 + Number(supportsBots) + Number(isOrphanVisits);\n\n const orderByColumn = (field: OrderableFields) =>\n () => setOrder({ field, dir: determineOrderDir(field, order.field, order.dir) });\n const renderOrderIcon = (field: OrderableFields) => order.dir && order.field === field && (\n <FontAwesomeIcon\n icon={order.dir === 'ASC' ? caretUpIcon : caretDownIcon}\n className=\"visits-table__header-icon\"\n />\n );\n\n useEffect(() => {\n const listener = () => setIsMobileDevice(matchMobile());\n\n window.addEventListener('resize', listener);\n\n return () => window.removeEventListener('resize', listener);\n }, []);\n useEffect(() => {\n setPage(1);\n\n !isFirstLoad.current && setSelectedVisits([]);\n isFirstLoad.current = false;\n }, [ searchTerm ]);\n\n return (\n <table className=\"table table-bordered table-hover table-sm table-responsive-sm visits-table\">\n <thead className=\"visits-table__header\">\n <tr>\n <th\n className={`${headerCellsClass} text-center`}\n onClick={() => setSelectedVisits(\n selectedVisits.length < resultSet.total ? resultSet.visitsGroups.flat() : [],\n )}\n >\n <FontAwesomeIcon icon={checkIcon} className={classNames({ 'text-primary': selectedVisits.length > 0 })} />\n </th>\n {supportsBots && (\n <th className={`${headerCellsClass} text-center`} onClick={orderByColumn('potentialBot')}>\n <FontAwesomeIcon icon={botIcon} />\n {renderOrderIcon('potentialBot')}\n </th>\n )}\n <th className={headerCellsClass} onClick={orderByColumn('date')}>\n Date\n {renderOrderIcon('date')}\n </th>\n <th className={headerCellsClass} onClick={orderByColumn('country')}>\n Country\n {renderOrderIcon('country')}\n </th>\n <th className={headerCellsClass} onClick={orderByColumn('city')}>\n City\n {renderOrderIcon('city')}\n </th>\n <th className={headerCellsClass} onClick={orderByColumn('browser')}>\n Browser\n {renderOrderIcon('browser')}\n </th>\n <th className={headerCellsClass} onClick={orderByColumn('os')}>\n OS\n {renderOrderIcon('os')}\n </th>\n <th className={headerCellsClass} onClick={orderByColumn('referer')}>\n Referrer\n {renderOrderIcon('referer')}\n </th>\n {isOrphanVisits && (\n <th className={headerCellsClass} onClick={orderByColumn('visitedUrl')}>\n Visited URL\n {renderOrderIcon('visitedUrl')}\n </th>\n )}\n </tr>\n <tr>\n <td colSpan={fullSizeColSpan} className=\"p-0\">\n <SearchField noBorder large={false} onChange={setSearchTerm} />\n </td>\n </tr>\n </thead>\n <tbody>\n {!resultSet.visitsGroups[page - 1]?.length && (\n <tr>\n <td colSpan={fullSizeColSpan} className=\"text-center\">\n No visits found with current filtering\n </td>\n </tr>\n )}\n {resultSet.visitsGroups[page - 1]?.map((visit, index) => {\n const isSelected = selectedVisits.includes(visit);\n\n return (\n <tr\n key={index}\n style={{ cursor: 'pointer' }}\n className={classNames({ 'table-active': isSelected })}\n onClick={() => setSelectedVisits(\n isSelected ? selectedVisits.filter((v) => v !== visit) : [ ...selectedVisits, visit ],\n )}\n >\n <td className=\"text-center\">\n {isSelected && <FontAwesomeIcon icon={checkIcon} className=\"text-primary\" />}\n </td>\n {supportsBots && (\n <td className=\"text-center\">\n {visit.potentialBot && (\n <>\n <FontAwesomeIcon icon={botIcon} id={`botIcon${index}`} />\n <UncontrolledTooltip placement=\"right\" target={`botIcon${index}`}>\n Potentially a visit from a bot or crawler\n </UncontrolledTooltip>\n </>\n )}\n </td>\n )}\n <td><Time date={visit.date} /></td>\n <td>{visit.country}</td>\n <td>{visit.city}</td>\n <td>{visit.browser}</td>\n <td>{visit.os}</td>\n <td>{visit.referer}</td>\n {isOrphanVisits && <td>{(visit as NormalizedOrphanVisit).visitedUrl}</td>}\n </tr>\n );\n })}\n </tbody>\n {resultSet.total > PAGE_SIZE && (\n <tfoot>\n <tr>\n <td colSpan={fullSizeColSpan} className=\"visits-table__footer-cell visits-table__sticky\">\n <div className=\"row\">\n <div className=\"col-md-6\">\n <SimplePaginator\n pagesCount={Math.ceil(resultSet.total / PAGE_SIZE)}\n currentPage={page}\n setCurrentPage={setPage}\n centered={isMobileDevice}\n />\n </div>\n <div\n className={classNames('col-md-6', {\n 'd-flex align-items-center flex-row-reverse': !isMobileDevice,\n 'text-center mt-3': isMobileDevice,\n })}\n >\n <div>\n Visits <b>{prettify(start + 1)}</b> to{' '}\n <b>{prettify(min(end, resultSet.total))}</b> of{' '}\n <b>{prettify(resultSet.total)}</b>\n </div>\n </div>\n </div>\n </td>\n </tr>\n </tfoot>\n )}\n </table>\n );\n};\n\nexport default VisitsTable;\n","import { FC } from 'react';\nimport { Modal, ModalBody } from 'reactstrap';\nimport { MapContainer, TileLayer, Marker, Popup, MapContainerProps } from 'react-leaflet';\nimport { prop } from 'ramda';\nimport { CityStats } from '../types';\nimport './MapModal.scss';\n\ninterface MapModalProps {\n toggle: () => void;\n isOpen: boolean;\n title: string;\n locations?: CityStats[];\n}\n\nconst OpenStreetMapTile: FC = () => (\n <TileLayer\n attribution='&copy <a href=\"http://osm.org/copyright\">OpenStreetMap</a> contributors'\n url=\"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\"\n />\n);\n\nconst calculateMapProps = (locations: CityStats[]): MapContainerProps => {\n if (locations.length === 0) {\n return {};\n }\n\n if (locations.length > 1) {\n return { bounds: locations.map(prop('latLong')) };\n }\n\n // When there's only one location, an error is thrown if trying to calculate the bounds.\n // When that happens, we use zoom and center as a workaround\n const [{ latLong: center }] = locations;\n\n return { zoom: 10, center };\n};\n\nconst MapModal = ({ toggle, isOpen, title, locations = [] }: MapModalProps) => (\n <Modal toggle={toggle} isOpen={isOpen} className=\"map-modal__modal\" contentClassName=\"map-modal__modal-content\">\n <ModalBody className=\"map-modal__modal-body\">\n <h3 className=\"map-modal__modal-title\">\n {title}\n <button type=\"button\" className=\"close\" onClick={toggle}>×</button>\n </h3>\n <MapContainer {...calculateMapProps(locations)}>\n <OpenStreetMapTile />\n {locations.map(({ cityName, latLong, count }, index) => (\n <Marker key={index} position={latLong}>\n <Popup><b>{count}</b> visit{count > 1 ? 's' : ''} from <b>{cityName}</b></Popup>\n </Marker>\n ))}\n </MapContainer>\n </ModalBody>\n </Modal>\n);\n\nexport default MapModal;\n","import { useRef, useState } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faMapMarkedAlt as mapIcon } from '@fortawesome/free-solid-svg-icons';\nimport { Dropdown, DropdownItem, DropdownMenu, UncontrolledTooltip } from 'reactstrap';\nimport { useToggle } from '../../utils/helpers/hooks';\nimport { CityStats } from '../types';\nimport MapModal from './MapModal';\nimport './OpenMapModalBtn.scss';\n\ninterface OpenMapModalBtnProps {\n modalTitle: string;\n activeCities: string[];\n locations?: CityStats[];\n}\n\nconst OpenMapModalBtn = ({ modalTitle, activeCities, locations = [] }: OpenMapModalBtnProps) => {\n const [ mapIsOpened, , openMap, closeMap ] = useToggle();\n const [ dropdownIsOpened, toggleDropdown, openDropdown ] = useToggle();\n const [ locationsToShow, setLocationsToShow ] = useState<CityStats[]>([]);\n const buttonRef = useRef<HTMLElement>();\n\n const filterLocations = (cities: CityStats[]) => cities.filter(({ cityName }) => activeCities.includes(cityName));\n const onClick = () => {\n if (!activeCities) {\n setLocationsToShow(locations);\n openMap();\n\n return;\n }\n\n openDropdown();\n };\n const openMapWithLocations = (filtered: boolean) => () => {\n setLocationsToShow(filtered ? filterLocations(locations) : locations);\n openMap();\n };\n\n return (\n <>\n <button className=\"btn btn-link open-map-modal-btn__btn\" ref={buttonRef as any} onClick={onClick}>\n <FontAwesomeIcon icon={mapIcon} />\n </button>\n <UncontrolledTooltip placement=\"left\" target={(() => buttonRef.current) as any}>Show in map</UncontrolledTooltip>\n <Dropdown isOpen={dropdownIsOpened} toggle={toggleDropdown} inNavbar>\n <DropdownMenu right>\n <DropdownItem onClick={openMapWithLocations(false)}>Show all locations</DropdownItem>\n <DropdownItem onClick={openMapWithLocations(true)}>Show locations in current page</DropdownItem>\n </DropdownMenu>\n </Dropdown>\n <MapModal toggle={closeMap} isOpen={mapIsOpened} title={modalTitle} locations={locationsToShow} />\n </>\n );\n};\n\nexport default OpenMapModalBtn;\n","import { countBy, groupBy, pipe, prop } from 'ramda';\nimport { formatIsoDate } from '../../utils/helpers/date';\nimport { ShlinkVisitsParams } from '../../api/types';\nimport { CreateVisit, NormalizedOrphanVisit, NormalizedVisit, OrphanVisit, Stats, Visit, VisitsParams } from './index';\n\nexport const isOrphanVisit = (visit: Visit): visit is OrphanVisit => visit.hasOwnProperty('visitedUrl');\n\nexport const isNormalizedOrphanVisit = (visit: NormalizedVisit): visit is NormalizedOrphanVisit =>\n visit.hasOwnProperty('visitedUrl');\n\nexport interface GroupedNewVisits {\n orphanVisits: CreateVisit[];\n regularVisits: CreateVisit[];\n}\n\nexport const groupNewVisitsByType = pipe(\n groupBy((newVisit: CreateVisit) => isOrphanVisit(newVisit.visit) ? 'orphanVisits' : 'regularVisits'),\n // @ts-expect-error Type declaration on groupBy is not correct. It can return undefined props\n (result): GroupedNewVisits => ({ orphanVisits: [], regularVisits: [], ...result }),\n);\n\nexport type HighlightableProps<T extends NormalizedVisit> = T extends NormalizedOrphanVisit\n ? ('referer' | 'country' | 'city' | 'visitedUrl')\n : ('referer' | 'country' | 'city');\n\nexport const highlightedVisitsToStats = <T extends NormalizedVisit>(\n highlightedVisits: T[],\n property: HighlightableProps<T>,\n): Stats => countBy(prop(property) as any, highlightedVisits);\n\nexport const toApiParams = ({ page, itemsPerPage, filter, dateRange }: VisitsParams): ShlinkVisitsParams => {\n const startDate = (dateRange?.startDate && formatIsoDate(dateRange?.startDate)) ?? undefined;\n const endDate = (dateRange?.endDate && formatIsoDate(dateRange?.endDate)) ?? undefined;\n const excludeBots = filter?.excludeBots || undefined; // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing\n\n return { page, itemsPerPage, startDate, endDate, excludeBots };\n};\n","import { isNil, map } from 'ramda';\nimport { extractDomain, parseUserAgent } from '../../utils/helpers/visits';\nimport { hasValue } from '../../utils/utils';\nimport { CityStats, NormalizedVisit, Stats, Visit, VisitsStats } from '../types';\nimport { isNormalizedOrphanVisit, isOrphanVisit } from '../types/helpers';\n\nconst visitHasProperty = (visit: NormalizedVisit, propertyName: keyof NormalizedVisit) =>\n !isNil(visit) && hasValue(visit[propertyName]);\n\nconst optionalNumericToNumber = (numeric: string | number | null | undefined): number => {\n if (typeof numeric === 'number') {\n return numeric;\n }\n\n return numeric ? parseFloat(numeric) : 0;\n};\n\nconst updateOsStatsForVisit = (osStats: Stats, { os }: NormalizedVisit) => {\n osStats[os] = (osStats[os] || 0) + 1;\n};\n\nconst updateBrowsersStatsForVisit = (browsersStats: Stats, { browser }: NormalizedVisit) => {\n browsersStats[browser] = (browsersStats[browser] || 0) + 1;\n};\n\nconst updateReferrersStatsForVisit = (referrersStats: Stats, { referer: domain }: NormalizedVisit) => {\n referrersStats[domain] = (referrersStats[domain] || 0) + 1;\n};\n\nconst updateLocationsStatsForVisit = (propertyName: 'country' | 'city') => (stats: Stats, visit: NormalizedVisit) => {\n const hasLocationProperty = visitHasProperty(visit, propertyName);\n const value = hasLocationProperty ? visit[propertyName] : 'Unknown';\n\n stats[value] = (stats[value] || 0) + 1;\n};\n\nconst updateCountriesStatsForVisit = updateLocationsStatsForVisit('country');\nconst updateCitiesStatsForVisit = updateLocationsStatsForVisit('city');\n\nconst updateCitiesForMapForVisit = (citiesForMapStats: Record<string, CityStats>, visit: NormalizedVisit) => {\n if (!visitHasProperty(visit, 'city') || visit.city === 'Unknown') {\n return;\n }\n\n const { city, latitude, longitude } = visit;\n const currentCity = citiesForMapStats[city] || {\n cityName: city,\n count: 0,\n latLong: [ optionalNumericToNumber(latitude), optionalNumericToNumber(longitude) ],\n };\n\n currentCity.count++;\n\n citiesForMapStats[city] = currentCity;\n};\n\nconst updateVisitedUrlsForVisit = (visitedUrlsStats: Stats, visit: NormalizedVisit) => {\n if (!isNormalizedOrphanVisit(visit)) {\n return;\n }\n\n const { visitedUrl } = visit;\n\n visitedUrlsStats[visitedUrl] = (visitedUrlsStats[visitedUrl] || 0) + 1;\n};\n\nexport const processStatsFromVisits = (visits: NormalizedVisit[]) => visits.reduce(\n (stats: VisitsStats, visit: NormalizedVisit) => {\n // We mutate the original object because it has a big performance impact when large data sets are processed\n updateOsStatsForVisit(stats.os, visit);\n updateBrowsersStatsForVisit(stats.browsers, visit);\n updateReferrersStatsForVisit(stats.referrers, visit);\n updateCountriesStatsForVisit(stats.countries, visit);\n updateCitiesStatsForVisit(stats.cities, visit);\n updateCitiesForMapForVisit(stats.citiesForMap, visit);\n updateVisitedUrlsForVisit(stats.visitedUrls, visit);\n\n return stats;\n },\n { os: {}, browsers: {}, referrers: {}, countries: {}, cities: {}, citiesForMap: {}, visitedUrls: {} },\n);\n\nexport const normalizeVisits = map((visit: Visit): NormalizedVisit => {\n const { userAgent, date, referer, visitLocation, potentialBot = false } = visit;\n const common = {\n date,\n potentialBot,\n ...parseUserAgent(userAgent),\n referer: extractDomain(referer),\n country: visitLocation?.countryName || 'Unknown', // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing\n city: visitLocation?.cityName || 'Unknown', // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing\n latitude: visitLocation?.latitude,\n longitude: visitLocation?.longitude,\n };\n\n if (!isOrphanVisit(visit)) {\n return common;\n }\n\n return { ...common, type: visit.type, visitedUrl: visit.visitedUrl };\n});\n\nexport interface VisitsParser {\n processStatsFromVisits: (normalizedVisits: NormalizedVisit[]) => VisitsStats;\n normalizeVisits: (visits: Visit[]) => NormalizedVisit[];\n}\n","import { DropdownItem, DropdownItemProps } from 'reactstrap'; // eslint-disable-line import/named\nimport { OrphanVisitType, VisitsFilter } from '../types';\nimport { DropdownBtn } from '../../utils/DropdownBtn';\nimport { hasValue } from '../../utils/utils';\n\ninterface VisitsFilterDropdownProps {\n onChange: (filters: VisitsFilter) => void;\n selected?: VisitsFilter;\n className?: string;\n isOrphanVisits: boolean;\n botsSupported: boolean;\n}\n\nexport const VisitsFilterDropdown = (\n { onChange, selected = {}, className, isOrphanVisits, botsSupported }: VisitsFilterDropdownProps,\n) => {\n if (!botsSupported && !isOrphanVisits) {\n return null;\n }\n\n const { orphanVisitsType, excludeBots = false } = selected;\n const propsForOrphanVisitsTypeItem = (type: OrphanVisitType): DropdownItemProps => ({\n active: orphanVisitsType === type,\n onClick: () => onChange({ ...selected, orphanVisitsType: type === selected?.orphanVisitsType ? undefined : type }),\n });\n const onBotsClick = () => onChange({ ...selected, excludeBots: !selected?.excludeBots });\n\n return (\n <DropdownBtn text=\"Filters\" dropdownClassName={className} className=\"mr-3\" right minWidth={250}>\n {botsSupported && (\n <>\n <DropdownItem header>Bots:</DropdownItem>\n <DropdownItem active={excludeBots} onClick={onBotsClick}>Exclude potential bots</DropdownItem>\n </>\n )}\n\n {botsSupported && isOrphanVisits && <DropdownItem divider />}\n\n {isOrphanVisits && (\n <>\n <DropdownItem header>Orphan visits type:</DropdownItem>\n <DropdownItem {...propsForOrphanVisitsTypeItem('base_url')}>Base URL</DropdownItem>\n <DropdownItem {...propsForOrphanVisitsTypeItem('invalid_short_url')}>Invalid short URL</DropdownItem>\n <DropdownItem {...propsForOrphanVisitsTypeItem('regular_404')}>Regular 404</DropdownItem>\n </>\n )}\n\n <DropdownItem divider />\n <DropdownItem disabled={!hasValue(selected)} onClick={() => onChange({})}><i>Clear filters</i></DropdownItem>\n </DropdownBtn>\n );\n};\n","import { useEffect } from 'react';\nimport { RouteComponentProps } from 'react-router';\nimport { boundToMercureHub } from '../mercure/helpers/boundToMercureHub';\nimport { ShlinkVisitsParams } from '../api/types';\nimport { parseQuery } from '../utils/helpers/query';\nimport { Topics } from '../mercure/helpers/Topics';\nimport { ShortUrlDetail } from '../short-urls/reducers/shortUrlDetail';\nimport { ShortUrlVisits as ShortUrlVisitsState } from './reducers/shortUrlVisits';\nimport ShortUrlVisitsHeader from './ShortUrlVisitsHeader';\nimport VisitsStats from './VisitsStats';\nimport { VisitsExporter } from './services/VisitsExporter';\nimport { NormalizedVisit, VisitsParams } from './types';\nimport { CommonVisitsProps } from './types/CommonVisitsProps';\nimport { toApiParams } from './types/helpers';\n\nexport interface ShortUrlVisitsProps extends CommonVisitsProps, RouteComponentProps<{ shortCode: string }> {\n getShortUrlVisits: (shortCode: string, query?: ShlinkVisitsParams) => void;\n shortUrlVisits: ShortUrlVisitsState;\n getShortUrlDetail: Function;\n shortUrlDetail: ShortUrlDetail;\n cancelGetShortUrlVisits: () => void;\n}\n\nconst ShortUrlVisits = ({ exportVisits }: VisitsExporter) => boundToMercureHub(({\n history: { goBack },\n match: { params, url },\n location: { search },\n shortUrlVisits,\n shortUrlDetail,\n getShortUrlVisits,\n getShortUrlDetail,\n cancelGetShortUrlVisits,\n settings,\n selectedServer,\n}: ShortUrlVisitsProps) => {\n const { shortCode } = params;\n const { domain } = parseQuery<{ domain?: string }>(search);\n const loadVisits = (params: VisitsParams) => getShortUrlVisits(shortCode, { ...toApiParams(params), domain });\n const exportCsv = (visits: NormalizedVisit[]) => exportVisits(\n `short-url_${shortUrlDetail.shortUrl?.shortUrl.replace(/https?:\\/\\//g, '')}_visits.csv`,\n visits,\n );\n\n useEffect(() => {\n getShortUrlDetail(shortCode, domain);\n }, []);\n\n return (\n <VisitsStats\n getVisits={loadVisits}\n cancelGetVisits={cancelGetShortUrlVisits}\n visitsInfo={shortUrlVisits}\n baseUrl={url}\n domain={domain}\n settings={settings}\n exportCsv={exportCsv}\n selectedServer={selectedServer}\n >\n <ShortUrlVisitsHeader shortUrlDetail={shortUrlDetail} shortUrlVisits={shortUrlVisits} goBack={goBack} />\n </VisitsStats>\n );\n}, ({ match }) => [ Topics.shortUrlVisits(match.params.shortCode) ]);\n\nexport default ShortUrlVisits;\n","import { flatten, prop, range, splitEvery } from 'ramda';\nimport { Action, Dispatch } from 'redux';\nimport { ShlinkPaginator, ShlinkVisits } from '../../api/types';\nimport { Visit, VisitsLoadFailedAction } from '../types';\nimport { parseApiError } from '../../api/utils';\n\nconst ITEMS_PER_PAGE = 5000;\nconst PARALLEL_REQUESTS_COUNT = 4;\nconst PARALLEL_STARTING_PAGE = 2;\n\nconst isLastPage = ({ currentPage, pagesCount }: ShlinkPaginator): boolean => currentPage >= pagesCount;\nconst calcProgress = (total: number, current: number): number => current * 100 / total;\n\ntype VisitsLoader = (page: number, itemsPerPage: number) => Promise<ShlinkVisits>;\ninterface ActionMap {\n start: string;\n large: string;\n finish: string;\n error: string;\n progress: string;\n}\n\nexport const getVisitsWithLoader = async <T extends Action<string> & { visits: Visit[] }>(\n visitsLoader: VisitsLoader,\n extraFinishActionData: Partial<T>,\n actionMap: ActionMap,\n dispatch: Dispatch,\n shouldCancel: () => boolean,\n) => {\n dispatch({ type: actionMap.start });\n\n const loadVisitsInParallel = async (pages: number[]): Promise<Visit[]> =>\n Promise.all(pages.map(async (page) => visitsLoader(page, ITEMS_PER_PAGE).then(prop('data')))).then(flatten);\n\n const loadPagesBlocks = async (pagesBlocks: number[][], index = 0): Promise<Visit[]> => {\n if (shouldCancel()) {\n return [];\n }\n\n const data = await loadVisitsInParallel(pagesBlocks[index]);\n\n dispatch({ type: actionMap.progress, progress: calcProgress(pagesBlocks.length, index + PARALLEL_STARTING_PAGE) });\n\n if (index < pagesBlocks.length - 1) {\n return data.concat(await loadPagesBlocks(pagesBlocks, index + 1));\n }\n\n return data;\n };\n\n const loadVisits = async (page = 1) => {\n const { pagination, data } = await visitsLoader(page, ITEMS_PER_PAGE);\n\n // If pagination was not returned, then this is an old shlink version. Just return data\n if (!pagination || isLastPage(pagination)) {\n return data;\n }\n\n // If there are more pages, make requests in blocks of 4\n const pagesRange = range(PARALLEL_STARTING_PAGE, pagination.pagesCount + 1);\n const pagesBlocks = splitEvery(PARALLEL_REQUESTS_COUNT, pagesRange);\n\n if (pagination.pagesCount - 1 > PARALLEL_REQUESTS_COUNT) {\n dispatch({ type: actionMap.large });\n }\n\n return data.concat(await loadPagesBlocks(pagesBlocks));\n };\n\n try {\n const visits = await loadVisits();\n\n dispatch({ ...extraFinishActionData, visits, type: actionMap.finish });\n } catch (e) {\n dispatch<VisitsLoadFailedAction>({ type: actionMap.error, errorData: parseApiError(e) });\n }\n};\n","import { Action, Dispatch } from 'redux';\nimport { shortUrlMatches } from '../../short-urls/helpers';\nimport { Visit, VisitsInfo, VisitsLoadFailedAction, VisitsLoadProgressChangedAction } from '../types';\nimport { ShortUrlIdentifier } from '../../short-urls/data';\nimport { buildActionCreator, buildReducer } from '../../utils/helpers/redux';\nimport { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';\nimport { GetState } from '../../container/types';\nimport { ShlinkVisitsParams } from '../../api/types';\nimport { getVisitsWithLoader } from './common';\nimport { CREATE_VISITS, CreateVisitsAction } from './visitCreation';\n\n/* eslint-disable padding-line-between-statements */\nexport const GET_SHORT_URL_VISITS_START = 'shlink/shortUrlVisits/GET_SHORT_URL_VISITS_START';\nexport const GET_SHORT_URL_VISITS_ERROR = 'shlink/shortUrlVisits/GET_SHORT_URL_VISITS_ERROR';\nexport const GET_SHORT_URL_VISITS = 'shlink/shortUrlVisits/GET_SHORT_URL_VISITS';\nexport const GET_SHORT_URL_VISITS_LARGE = 'shlink/shortUrlVisits/GET_SHORT_URL_VISITS_LARGE';\nexport const GET_SHORT_URL_VISITS_CANCEL = 'shlink/shortUrlVisits/GET_SHORT_URL_VISITS_CANCEL';\nexport const GET_SHORT_URL_VISITS_PROGRESS_CHANGED = 'shlink/shortUrlVisits/GET_SHORT_URL_VISITS_PROGRESS_CHANGED';\n/* eslint-enable padding-line-between-statements */\n\nexport interface ShortUrlVisits extends VisitsInfo, ShortUrlIdentifier {}\n\ninterface ShortUrlVisitsAction extends Action<string>, ShortUrlIdentifier {\n visits: Visit[];\n}\n\ntype ShortUrlVisitsCombinedAction = ShortUrlVisitsAction\n& VisitsLoadProgressChangedAction\n& CreateVisitsAction\n& VisitsLoadFailedAction;\n\nconst initialState: ShortUrlVisits = {\n visits: [],\n shortCode: '',\n domain: undefined,\n loading: false,\n loadingLarge: false,\n error: false,\n cancelLoad: false,\n progress: 0,\n};\n\nexport default buildReducer<ShortUrlVisits, ShortUrlVisitsCombinedAction>({\n [GET_SHORT_URL_VISITS_START]: () => ({ ...initialState, loading: true }),\n [GET_SHORT_URL_VISITS_ERROR]: (_, { errorData }) => ({ ...initialState, error: true, errorData }),\n [GET_SHORT_URL_VISITS]: (_, { visits, shortCode, domain }) => ({\n ...initialState,\n visits,\n shortCode,\n domain,\n }),\n [GET_SHORT_URL_VISITS_LARGE]: (state) => ({ ...state, loadingLarge: true }),\n [GET_SHORT_URL_VISITS_CANCEL]: (state) => ({ ...state, cancelLoad: true }),\n [GET_SHORT_URL_VISITS_PROGRESS_CHANGED]: (state, { progress }) => ({ ...state, progress }),\n [CREATE_VISITS]: (state, { createdVisits }) => {\n const { shortCode, domain, visits } = state;\n const newVisits = createdVisits\n .filter(({ shortUrl }) => shortUrl && shortUrlMatches(shortUrl, shortCode, domain))\n .map(({ visit }) => visit);\n\n return { ...state, visits: [ ...newVisits, ...visits ] };\n },\n}, initialState);\n\nexport const getShortUrlVisits = (buildShlinkApiClient: ShlinkApiClientBuilder) => (\n shortCode: string,\n query: ShlinkVisitsParams = {},\n) => async (dispatch: Dispatch, getState: GetState) => {\n const { getShortUrlVisits } = buildShlinkApiClient(getState);\n const visitsLoader = async (page: number, itemsPerPage: number) => getShortUrlVisits(\n shortCode,\n { ...query, page, itemsPerPage },\n );\n const shouldCancel = () => getState().shortUrlVisits.cancelLoad;\n const extraFinishActionData: Partial<ShortUrlVisitsAction> = { shortCode, domain: query.domain };\n const actionMap = {\n start: GET_SHORT_URL_VISITS_START,\n large: GET_SHORT_URL_VISITS_LARGE,\n finish: GET_SHORT_URL_VISITS,\n error: GET_SHORT_URL_VISITS_ERROR,\n progress: GET_SHORT_URL_VISITS_PROGRESS_CHANGED,\n };\n\n return getVisitsWithLoader(visitsLoader, extraFinishActionData, actionMap, dispatch, shouldCancel);\n};\n\nexport const cancelGetShortUrlVisits = buildActionCreator(GET_SHORT_URL_VISITS_CANCEL);\n","import Tag from '../tags/helpers/Tag';\nimport ColorGenerator from '../utils/services/ColorGenerator';\nimport VisitsHeader from './VisitsHeader';\nimport { TagVisits } from './reducers/tagVisits';\nimport './ShortUrlVisitsHeader.scss';\n\ninterface TagVisitsHeaderProps {\n tagVisits: TagVisits;\n goBack: () => void;\n colorGenerator: ColorGenerator;\n}\n\nconst TagVisitsHeader = ({ tagVisits, goBack, colorGenerator }: TagVisitsHeaderProps) => {\n const { visits, tag } = tagVisits;\n\n const visitsStatsTitle = (\n <span className=\"d-flex align-items-center justify-content-center\">\n <span className=\"mr-2\">Visits for</span>\n <Tag text={tag} colorGenerator={colorGenerator} />\n </span>\n );\n\n return <VisitsHeader title={visitsStatsTitle} goBack={goBack} visits={visits} />;\n};\n\nexport default TagVisitsHeader;\n","import { RouteComponentProps } from 'react-router';\nimport { boundToMercureHub } from '../mercure/helpers/boundToMercureHub';\nimport ColorGenerator from '../utils/services/ColorGenerator';\nimport { ShlinkVisitsParams } from '../api/types';\nimport { Topics } from '../mercure/helpers/Topics';\nimport { TagVisits as TagVisitsState } from './reducers/tagVisits';\nimport TagVisitsHeader from './TagVisitsHeader';\nimport VisitsStats from './VisitsStats';\nimport { VisitsExporter } from './services/VisitsExporter';\nimport { NormalizedVisit } from './types';\nimport { CommonVisitsProps } from './types/CommonVisitsProps';\nimport { toApiParams } from './types/helpers';\n\nexport interface TagVisitsProps extends CommonVisitsProps, RouteComponentProps<{ tag: string }> {\n getTagVisits: (tag: string, query?: ShlinkVisitsParams) => void;\n tagVisits: TagVisitsState;\n cancelGetTagVisits: () => void;\n}\n\nconst TagVisits = (colorGenerator: ColorGenerator, { exportVisits }: VisitsExporter) => boundToMercureHub(({\n history: { goBack },\n match: { params, url },\n getTagVisits,\n tagVisits,\n cancelGetTagVisits,\n settings,\n selectedServer,\n}: TagVisitsProps) => {\n const { tag } = params;\n const loadVisits = (params: ShlinkVisitsParams) => getTagVisits(tag, toApiParams(params));\n const exportCsv = (visits: NormalizedVisit[]) => exportVisits(`tag_${tag}_visits.csv`, visits);\n\n return (\n <VisitsStats\n getVisits={loadVisits}\n cancelGetVisits={cancelGetTagVisits}\n visitsInfo={tagVisits}\n baseUrl={url}\n settings={settings}\n exportCsv={exportCsv}\n selectedServer={selectedServer}\n >\n <TagVisitsHeader tagVisits={tagVisits} goBack={goBack} colorGenerator={colorGenerator} />\n </VisitsStats>\n );\n}, () => [ Topics.visits() ]);\n\nexport default TagVisits;\n","import { Action, Dispatch } from 'redux';\nimport { Visit, VisitsInfo, VisitsLoadFailedAction, VisitsLoadProgressChangedAction } from '../types';\nimport { buildActionCreator, buildReducer } from '../../utils/helpers/redux';\nimport { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';\nimport { GetState } from '../../container/types';\nimport { ShlinkVisitsParams } from '../../api/types';\nimport { getVisitsWithLoader } from './common';\nimport { CREATE_VISITS, CreateVisitsAction } from './visitCreation';\n\n/* eslint-disable padding-line-between-statements */\nexport const GET_TAG_VISITS_START = 'shlink/tagVisits/GET_TAG_VISITS_START';\nexport const GET_TAG_VISITS_ERROR = 'shlink/tagVisits/GET_TAG_VISITS_ERROR';\nexport const GET_TAG_VISITS = 'shlink/tagVisits/GET_TAG_VISITS';\nexport const GET_TAG_VISITS_LARGE = 'shlink/tagVisits/GET_TAG_VISITS_LARGE';\nexport const GET_TAG_VISITS_CANCEL = 'shlink/tagVisits/GET_TAG_VISITS_CANCEL';\nexport const GET_TAG_VISITS_PROGRESS_CHANGED = 'shlink/tagVisits/GET_TAG_VISITS_PROGRESS_CHANGED';\n/* eslint-enable padding-line-between-statements */\n\nexport interface TagVisits extends VisitsInfo {\n tag: string;\n}\n\nexport interface TagVisitsAction extends Action<string> {\n visits: Visit[];\n tag: string;\n}\n\ntype TagsVisitsCombinedAction = TagVisitsAction\n& VisitsLoadProgressChangedAction\n& CreateVisitsAction\n& VisitsLoadFailedAction;\n\nconst initialState: TagVisits = {\n visits: [],\n tag: '',\n loading: false,\n loadingLarge: false,\n error: false,\n cancelLoad: false,\n progress: 0,\n};\n\nexport default buildReducer<TagVisits, TagsVisitsCombinedAction>({\n [GET_TAG_VISITS_START]: () => ({ ...initialState, loading: true }),\n [GET_TAG_VISITS_ERROR]: (_, { errorData }) => ({ ...initialState, error: true, errorData }),\n [GET_TAG_VISITS]: (_, { visits, tag }) => ({ ...initialState, visits, tag }),\n [GET_TAG_VISITS_LARGE]: (state) => ({ ...state, loadingLarge: true }),\n [GET_TAG_VISITS_CANCEL]: (state) => ({ ...state, cancelLoad: true }),\n [GET_TAG_VISITS_PROGRESS_CHANGED]: (state, { progress }) => ({ ...state, progress }),\n [CREATE_VISITS]: (state, { createdVisits }) => {\n const { tag, visits } = state;\n const newVisits = createdVisits\n .filter(({ shortUrl }) => shortUrl?.tags.includes(tag))\n .map(({ visit }) => visit);\n\n return { ...state, visits: [ ...newVisits, ...visits ] };\n },\n}, initialState);\n\nexport const getTagVisits = (buildShlinkApiClient: ShlinkApiClientBuilder) => (\n tag: string,\n query: ShlinkVisitsParams = {},\n) => async (dispatch: Dispatch, getState: GetState) => {\n const { getTagVisits } = buildShlinkApiClient(getState);\n const visitsLoader = async (page: number, itemsPerPage: number) => getTagVisits(\n tag,\n { ...query, page, itemsPerPage },\n );\n const shouldCancel = () => getState().tagVisits.cancelLoad;\n const extraFinishActionData: Partial<TagVisitsAction> = { tag };\n const actionMap = {\n start: GET_TAG_VISITS_START,\n large: GET_TAG_VISITS_LARGE,\n finish: GET_TAG_VISITS,\n error: GET_TAG_VISITS_ERROR,\n progress: GET_TAG_VISITS_PROGRESS_CHANGED,\n };\n\n return getVisitsWithLoader(visitsLoader, extraFinishActionData, actionMap, dispatch, shouldCancel);\n};\n\nexport const cancelGetTagVisits = buildActionCreator(GET_TAG_VISITS_CANCEL);\n","import VisitsHeader from './VisitsHeader';\nimport { VisitsInfo } from './types';\nimport './ShortUrlVisitsHeader.scss';\n\ninterface OrphanVisitsHeaderProps {\n orphanVisits: VisitsInfo;\n goBack: () => void;\n}\n\nexport const OrphanVisitsHeader = ({ orphanVisits, goBack }: OrphanVisitsHeaderProps) => {\n const { visits } = orphanVisits;\n\n return <VisitsHeader title=\"Orphan visits\" goBack={goBack} visits={visits} />;\n};\n","import { RouteComponentProps } from 'react-router';\nimport { boundToMercureHub } from '../mercure/helpers/boundToMercureHub';\nimport { ShlinkVisitsParams } from '../api/types';\nimport { Topics } from '../mercure/helpers/Topics';\nimport VisitsStats from './VisitsStats';\nimport { OrphanVisitsHeader } from './OrphanVisitsHeader';\nimport { NormalizedVisit, OrphanVisitType, VisitsInfo, VisitsParams } from './types';\nimport { VisitsExporter } from './services/VisitsExporter';\nimport { CommonVisitsProps } from './types/CommonVisitsProps';\nimport { toApiParams } from './types/helpers';\n\nexport interface OrphanVisitsProps extends CommonVisitsProps, RouteComponentProps {\n getOrphanVisits: (params?: ShlinkVisitsParams, orphanVisitsType?: OrphanVisitType) => void;\n orphanVisits: VisitsInfo;\n cancelGetOrphanVisits: () => void;\n}\n\nexport const OrphanVisits = ({ exportVisits }: VisitsExporter) => boundToMercureHub(({\n history: { goBack },\n match: { url },\n getOrphanVisits,\n orphanVisits,\n cancelGetOrphanVisits,\n settings,\n selectedServer,\n}: OrphanVisitsProps) => {\n const exportCsv = (visits: NormalizedVisit[]) => exportVisits('orphan_visits.csv', visits);\n const loadVisits = (params: VisitsParams) => getOrphanVisits(toApiParams(params), params.filter?.orphanVisitsType);\n\n return (\n <VisitsStats\n getVisits={loadVisits}\n cancelGetVisits={cancelGetOrphanVisits}\n visitsInfo={orphanVisits}\n baseUrl={url}\n settings={settings}\n exportCsv={exportCsv}\n selectedServer={selectedServer}\n isOrphanVisits\n >\n <OrphanVisitsHeader orphanVisits={orphanVisits} goBack={goBack} />\n </VisitsStats>\n );\n}, () => [ Topics.orphanVisits() ]);\n","import { Action, Dispatch } from 'redux';\nimport {\n OrphanVisit,\n OrphanVisitType,\n Visit,\n VisitsInfo,\n VisitsLoadFailedAction,\n VisitsLoadProgressChangedAction,\n} from '../types';\nimport { buildActionCreator, buildReducer } from '../../utils/helpers/redux';\nimport { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';\nimport { GetState } from '../../container/types';\nimport { ShlinkVisitsParams } from '../../api/types';\nimport { isOrphanVisit } from '../types/helpers';\nimport { getVisitsWithLoader } from './common';\nimport { CREATE_VISITS, CreateVisitsAction } from './visitCreation';\n\n/* eslint-disable padding-line-between-statements */\nexport const GET_ORPHAN_VISITS_START = 'shlink/orphanVisits/GET_ORPHAN_VISITS_START';\nexport const GET_ORPHAN_VISITS_ERROR = 'shlink/orphanVisits/GET_ORPHAN_VISITS_ERROR';\nexport const GET_ORPHAN_VISITS = 'shlink/orphanVisits/GET_ORPHAN_VISITS';\nexport const GET_ORPHAN_VISITS_LARGE = 'shlink/orphanVisits/GET_ORPHAN_VISITS_LARGE';\nexport const GET_ORPHAN_VISITS_CANCEL = 'shlink/orphanVisits/GET_ORPHAN_VISITS_CANCEL';\nexport const GET_ORPHAN_VISITS_PROGRESS_CHANGED = 'shlink/orphanVisits/GET_ORPHAN_VISITS_PROGRESS_CHANGED';\n/* eslint-enable padding-line-between-statements */\n\nexport interface OrphanVisitsAction extends Action<string> {\n visits: Visit[];\n}\n\ntype OrphanVisitsCombinedAction = OrphanVisitsAction\n& VisitsLoadProgressChangedAction\n& CreateVisitsAction\n& VisitsLoadFailedAction;\n\nconst initialState: VisitsInfo = {\n visits: [],\n loading: false,\n loadingLarge: false,\n error: false,\n cancelLoad: false,\n progress: 0,\n};\n\nexport default buildReducer<VisitsInfo, OrphanVisitsCombinedAction>({\n [GET_ORPHAN_VISITS_START]: () => ({ ...initialState, loading: true }),\n [GET_ORPHAN_VISITS_ERROR]: (_, { errorData }) => ({ ...initialState, error: true, errorData }),\n [GET_ORPHAN_VISITS]: (_, { visits }) => ({ ...initialState, visits }),\n [GET_ORPHAN_VISITS_LARGE]: (state) => ({ ...state, loadingLarge: true }),\n [GET_ORPHAN_VISITS_CANCEL]: (state) => ({ ...state, cancelLoad: true }),\n [GET_ORPHAN_VISITS_PROGRESS_CHANGED]: (state, { progress }) => ({ ...state, progress }),\n [CREATE_VISITS]: (state, { createdVisits }) => {\n const { visits } = state;\n const newVisits = createdVisits.map(({ visit }) => visit);\n\n return { ...state, visits: [ ...newVisits, ...visits ] };\n },\n}, initialState);\n\nconst matchesType = (visit: OrphanVisit, orphanVisitsType?: OrphanVisitType) =>\n !orphanVisitsType || orphanVisitsType === visit.type;\n\nexport const getOrphanVisits = (buildShlinkApiClient: ShlinkApiClientBuilder) => (\n query: ShlinkVisitsParams = {},\n orphanVisitsType?: OrphanVisitType,\n) => async (dispatch: Dispatch, getState: GetState) => {\n const { getOrphanVisits } = buildShlinkApiClient(getState);\n const visitsLoader = async (page: number, itemsPerPage: number) => getOrphanVisits({ ...query, page, itemsPerPage })\n .then((result) => {\n const visits = result.data.filter((visit) => isOrphanVisit(visit) && matchesType(visit, orphanVisitsType));\n\n return { ...result, data: visits };\n });\n const shouldCancel = () => getState().orphanVisits.cancelLoad;\n const actionMap = {\n start: GET_ORPHAN_VISITS_START,\n large: GET_ORPHAN_VISITS_LARGE,\n finish: GET_ORPHAN_VISITS,\n error: GET_ORPHAN_VISITS_ERROR,\n progress: GET_ORPHAN_VISITS_PROGRESS_CHANGED,\n };\n\n return getVisitsWithLoader(visitsLoader, {}, actionMap, dispatch, shouldCancel);\n};\n\nexport const cancelGetOrphanVisits = buildActionCreator(GET_ORPHAN_VISITS_CANCEL);\n","import { Action, Dispatch } from 'redux';\nimport { ShlinkVisitsOverview } from '../../api/types';\nimport { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';\nimport { GetState } from '../../container/types';\nimport { buildReducer } from '../../utils/helpers/redux';\nimport { groupNewVisitsByType } from '../types/helpers';\nimport { CREATE_VISITS, CreateVisitsAction } from './visitCreation';\n\n/* eslint-disable padding-line-between-statements */\nexport const GET_OVERVIEW_START = 'shlink/visitsOverview/GET_OVERVIEW_START';\nexport const GET_OVERVIEW_ERROR = 'shlink/visitsOverview/GET_OVERVIEW_ERROR';\nexport const GET_OVERVIEW = 'shlink/visitsOverview/GET_OVERVIEW';\n/* eslint-enable padding-line-between-statements */\n\nexport interface VisitsOverview {\n visitsCount: number;\n orphanVisitsCount?: number;\n loading: boolean;\n error: boolean;\n}\n\nexport type GetVisitsOverviewAction = ShlinkVisitsOverview & Action<string>;\n\nconst initialState: VisitsOverview = {\n visitsCount: 0,\n orphanVisitsCount: 0,\n loading: false,\n error: false,\n};\n\nexport default buildReducer<VisitsOverview, GetVisitsOverviewAction & CreateVisitsAction>({\n [GET_OVERVIEW_START]: () => ({ ...initialState, loading: true }),\n [GET_OVERVIEW_ERROR]: () => ({ ...initialState, error: true }),\n [GET_OVERVIEW]: (_, { visitsCount, orphanVisitsCount }) => ({ ...initialState, visitsCount, orphanVisitsCount }),\n [CREATE_VISITS]: ({ visitsCount, orphanVisitsCount = 0, ...rest }, { createdVisits }) => {\n const { regularVisits, orphanVisits } = groupNewVisitsByType(createdVisits);\n\n return {\n ...rest,\n visitsCount: visitsCount + regularVisits.length,\n orphanVisitsCount: orphanVisitsCount + orphanVisits.length,\n };\n },\n}, initialState);\n\nexport const loadVisitsOverview = (buildShlinkApiClient: ShlinkApiClientBuilder) => () => async (\n dispatch: Dispatch,\n getState: GetState,\n) => {\n dispatch({ type: GET_OVERVIEW_START });\n\n try {\n const { getVisitsOverview } = buildShlinkApiClient(getState);\n const result = await getVisitsOverview();\n\n dispatch({ type: GET_OVERVIEW, ...result });\n } catch (e) {\n dispatch({ type: GET_OVERVIEW_ERROR });\n }\n};\n","import { CsvJson } from 'csvjson';\nimport { NormalizedVisit } from '../types';\nimport { saveCsv } from '../../utils/helpers/csv';\n\nexport class VisitsExporter {\n public constructor(\n private readonly window: Window,\n private readonly csvjson: CsvJson,\n ) {}\n\n public readonly exportVisits = (filename: string, visits: NormalizedVisit[]) => {\n if (!visits.length) {\n return;\n }\n\n const csv = this.csvjson.toCSV(visits, { headers: 'key' });\n\n saveCsv(this.window, csv, filename);\n };\n}\n","import Bottle from 'bottlejs';\nimport ShortUrlVisits from '../ShortUrlVisits';\nimport { cancelGetShortUrlVisits, getShortUrlVisits } from '../reducers/shortUrlVisits';\nimport MapModal from '../helpers/MapModal';\nimport { createNewVisits } from '../reducers/visitCreation';\nimport TagVisits from '../TagVisits';\nimport { cancelGetTagVisits, getTagVisits } from '../reducers/tagVisits';\nimport { OrphanVisits } from '../OrphanVisits';\nimport { cancelGetOrphanVisits, getOrphanVisits } from '../reducers/orphanVisits';\nimport { ConnectDecorator } from '../../container/types';\nimport { loadVisitsOverview } from '../reducers/visitsOverview';\nimport * as visitsParser from './VisitsParser';\nimport { VisitsExporter } from './VisitsExporter';\n\nconst provideServices = (bottle: Bottle, connect: ConnectDecorator) => {\n // Components\n bottle.serviceFactory('MapModal', () => MapModal);\n\n bottle.serviceFactory('ShortUrlVisits', ShortUrlVisits, 'VisitsExporter');\n bottle.decorator('ShortUrlVisits', connect(\n [ 'shortUrlVisits', 'shortUrlDetail', 'mercureInfo', 'settings', 'selectedServer' ],\n [ 'getShortUrlVisits', 'getShortUrlDetail', 'cancelGetShortUrlVisits', 'createNewVisits', 'loadMercureInfo' ],\n ));\n\n bottle.serviceFactory('TagVisits', TagVisits, 'ColorGenerator', 'VisitsExporter');\n bottle.decorator('TagVisits', connect(\n [ 'tagVisits', 'mercureInfo', 'settings', 'selectedServer' ],\n [ 'getTagVisits', 'cancelGetTagVisits', 'createNewVisits', 'loadMercureInfo' ],\n ));\n\n bottle.serviceFactory('OrphanVisits', OrphanVisits, 'VisitsExporter');\n bottle.decorator('OrphanVisits', connect(\n [ 'orphanVisits', 'mercureInfo', 'settings', 'selectedServer' ],\n [ 'getOrphanVisits', 'cancelGetOrphanVisits', 'createNewVisits', 'loadMercureInfo' ],\n ));\n\n // Services\n bottle.serviceFactory('VisitsParser', () => visitsParser);\n bottle.service('VisitsExporter', VisitsExporter, 'window', 'csvjson');\n\n // Actions\n bottle.serviceFactory('getShortUrlVisits', getShortUrlVisits, 'buildShlinkApiClient');\n bottle.serviceFactory('cancelGetShortUrlVisits', () => cancelGetShortUrlVisits);\n\n bottle.serviceFactory('getTagVisits', getTagVisits, 'buildShlinkApiClient');\n bottle.serviceFactory('cancelGetTagVisits', () => cancelGetTagVisits);\n\n bottle.serviceFactory('getOrphanVisits', getOrphanVisits, 'buildShlinkApiClient');\n bottle.serviceFactory('cancelGetOrphanVisits', () => cancelGetOrphanVisits);\n\n bottle.serviceFactory('createNewVisits', () => createNewVisits);\n bottle.serviceFactory('loadVisitsOverview', loadVisitsOverview, 'buildShlinkApiClient');\n};\n\nexport default provideServices;\n","import ColorGenerator from '../../utils/services/ColorGenerator';\nimport './TagBullet.scss';\n\ninterface TagBulletProps {\n tag: string;\n colorGenerator: ColorGenerator;\n}\n\nconst TagBullet = ({ tag, colorGenerator }: TagBulletProps) => (\n <div\n style={{ backgroundColor: colorGenerator.getColorForKey(tag) }}\n className=\"tag-bullet\"\n />\n);\n\nexport default TagBullet;\n","import { useEffect } from 'react';\nimport ReactTags, { SuggestionComponentProps, TagComponentProps } from 'react-tag-autocomplete';\nimport ColorGenerator from '../../utils/services/ColorGenerator';\nimport { TagsList } from '../reducers/tagsList';\nimport TagBullet from './TagBullet';\nimport Tag from './Tag';\n\nexport interface TagsSelectorProps {\n selectedTags: string[];\n onChange: (tags: string[]) => void;\n placeholder?: string;\n}\n\ninterface TagsSelectorConnectProps extends TagsSelectorProps {\n listTags: Function;\n tagsList: TagsList;\n}\n\nconst toComponentTag = (tag: string) => ({ id: tag, name: tag });\n\nconst TagsSelector = (colorGenerator: ColorGenerator) => (\n { selectedTags, onChange, listTags, tagsList, placeholder = 'Add tags to the URL' }: TagsSelectorConnectProps,\n) => {\n useEffect(() => {\n listTags();\n }, []);\n\n const ReactTagsTag = ({ tag, onDelete }: TagComponentProps) =>\n <Tag colorGenerator={colorGenerator} text={tag.name} clearable className=\"react-tags__tag\" onClose={onDelete} />;\n const ReactTagsSuggestion = ({ item }: SuggestionComponentProps) => (\n <>\n <TagBullet tag={`${item.name}`} colorGenerator={colorGenerator} />\n {item.name}\n </>\n );\n\n return (\n <ReactTags\n tags={selectedTags.map(toComponentTag)}\n tagComponent={ReactTagsTag}\n suggestions={tagsList.tags.filter((tag) => !selectedTags.includes(tag)).map(toComponentTag)}\n suggestionComponent={ReactTagsSuggestion}\n allowNew\n addOnBlur\n placeholderText={placeholder}\n minQueryLength={1}\n onDelete={(removedTagIndex) => {\n const tagsCopy = [ ...selectedTags ];\n\n tagsCopy.splice(removedTagIndex, 1);\n onChange(tagsCopy);\n }}\n onAddition={({ name: newTag }) => onChange([ ...selectedTags, newTag.toLowerCase() ])}\n />\n );\n};\n\nexport default TagsSelector;\n","import { Card, CardHeader, CardBody, Button, Collapse } from 'reactstrap';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faTrash as deleteIcon, faPencilAlt as editIcon, faLink, faEye } from '@fortawesome/free-solid-svg-icons';\nimport { FC } from 'react';\nimport { Link } from 'react-router-dom';\nimport { prettify } from '../utils/helpers/numbers';\nimport { useToggle } from '../utils/helpers/hooks';\nimport { Versions } from '../utils/helpers/version';\nimport ColorGenerator from '../utils/services/ColorGenerator';\nimport { isServerWithId, SelectedServer } from '../servers/data';\nimport TagBullet from './helpers/TagBullet';\nimport { TagModalProps, TagStats } from './data';\nimport './TagCard.scss';\n\nexport interface TagCardProps {\n tag: string;\n tagStats?: TagStats;\n selectedServer: SelectedServer;\n displayed: boolean;\n toggle: () => void;\n}\n\nconst TagCard = (\n DeleteTagConfirmModal: FC<TagModalProps>,\n EditTagModal: FC<TagModalProps>,\n ForServerVersion: FC<Versions>,\n colorGenerator: ColorGenerator,\n) => ({ tag, tagStats, selectedServer, displayed, toggle }: TagCardProps) => {\n const [ isDeleteModalOpen, toggleDelete ] = useToggle();\n const [ isEditModalOpen, toggleEdit ] = useToggle();\n\n const serverId = isServerWithId(selectedServer) ? selectedServer.id : '';\n const shortUrlsLink = `/server/${serverId}/list-short-urls/1?tag=${encodeURIComponent(tag)}`;\n\n return (\n <Card className=\"tag-card\">\n <CardHeader className=\"tag-card__header\">\n <Button color=\"link\" size=\"sm\" className=\"tag-card__btn tag-card__btn--last\" onClick={toggleDelete}>\n <FontAwesomeIcon icon={deleteIcon} />\n </Button>\n <Button color=\"link\" size=\"sm\" className=\"tag-card__btn\" onClick={toggleEdit}>\n <FontAwesomeIcon icon={editIcon} />\n </Button>\n <h5 className=\"tag-card__tag-title text-ellipsis\">\n <TagBullet tag={tag} colorGenerator={colorGenerator} />\n <ForServerVersion minVersion=\"2.2.0\">\n <span className=\"tag-card__tag-name\" onClick={toggle}>{tag}</span>\n </ForServerVersion>\n <ForServerVersion maxVersion=\"2.1.*\">\n <Link to={shortUrlsLink}>{tag}</Link>\n </ForServerVersion>\n </h5>\n </CardHeader>\n\n {tagStats && (\n <Collapse isOpen={displayed}>\n <CardBody className=\"tag-card__body\">\n <Link\n to={shortUrlsLink}\n className=\"btn btn-outline-secondary btn-block d-flex justify-content-between align-items-center mb-1\"\n >\n <span className=\"text-ellipsis\"><FontAwesomeIcon icon={faLink} className=\"mr-2\" />Short URLs</span>\n <b>{prettify(tagStats.shortUrlsCount)}</b>\n </Link>\n <Link\n to={`/server/${serverId}/tag/${tag}/visits`}\n className=\"btn btn-outline-secondary btn-block d-flex justify-content-between align-items-center\"\n >\n <span className=\"text-ellipsis\"><FontAwesomeIcon icon={faEye} className=\"mr-2\" />Visits</span>\n <b>{prettify(tagStats.visitsCount)}</b>\n </Link>\n </CardBody>\n </Collapse>\n )}\n\n <DeleteTagConfirmModal tag={tag} toggle={toggleDelete} isOpen={isDeleteModalOpen} />\n <EditTagModal tag={tag} toggle={toggleEdit} isOpen={isEditModalOpen} />\n </Card>\n );\n};\n\nexport default TagCard;\n","import { Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap';\nimport { TagDeletion } from '../reducers/tagDelete';\nimport { TagModalProps } from '../data';\nimport { Result } from '../../utils/Result';\nimport { ShlinkApiError } from '../../api/ShlinkApiError';\n\ninterface DeleteTagConfirmModalProps extends TagModalProps {\n deleteTag: (tag: string) => Promise<void>;\n tagDeleted: (tag: string) => void;\n tagDelete: TagDeletion;\n}\n\nconst DeleteTagConfirmModal = (\n { tag, toggle, isOpen, deleteTag, tagDelete, tagDeleted }: DeleteTagConfirmModalProps,\n) => {\n const { deleting, error, errorData } = tagDelete;\n const doDelete = async () => {\n await deleteTag(tag);\n tagDeleted(tag);\n toggle();\n };\n\n return (\n <Modal toggle={toggle} isOpen={isOpen} centered>\n <ModalHeader toggle={toggle}>\n <span className=\"text-danger\">Delete tag</span>\n </ModalHeader>\n <ModalBody>\n Are you sure you want to delete tag <b>{tag}</b>?\n {error && (\n <Result type=\"error\" small className=\"mt-2\">\n <ShlinkApiError errorData={errorData} fallbackMessage=\"Something went wrong while deleting the tag :(\" />\n </Result>\n )}\n </ModalBody>\n <ModalFooter>\n <button className=\"btn btn-link\" onClick={toggle}>Cancel</button>\n <button className=\"btn btn-danger\" disabled={deleting} onClick={doDelete}>\n {deleting ? 'Deleting tag...' : 'Delete tag'}\n </button>\n </ModalFooter>\n </Modal>\n );\n};\n\nexport default DeleteTagConfirmModal;\n","import { useState } from 'react';\nimport { Modal, ModalBody, ModalFooter, ModalHeader, Popover } from 'reactstrap';\nimport { ChromePicker } from 'react-color';\nimport { faPalette as colorIcon } from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { useToggle } from '../../utils/helpers/hooks';\nimport { handleEventPreventingDefault } from '../../utils/utils';\nimport ColorGenerator from '../../utils/services/ColorGenerator';\nimport { TagModalProps } from '../data';\nimport { TagEdition } from '../reducers/tagEdit';\nimport { Result } from '../../utils/Result';\nimport { ShlinkApiError } from '../../api/ShlinkApiError';\nimport './EditTagModal.scss';\n\ninterface EditTagModalProps extends TagModalProps {\n tagEdit: TagEdition;\n editTag: (oldName: string, newName: string, color: string) => Promise<void>;\n tagEdited: (oldName: string, newName: string, color: string) => void;\n}\n\nconst EditTagModal = ({ getColorForKey }: ColorGenerator) => (\n { tag, editTag, toggle, tagEdited, isOpen, tagEdit }: EditTagModalProps,\n) => {\n const [ newTagName, setNewTagName ] = useState(tag);\n const [ color, setColor ] = useState(getColorForKey(tag));\n const [ showColorPicker, toggleColorPicker, , hideColorPicker ] = useToggle();\n const { editing, error, errorData } = tagEdit;\n const saveTag = handleEventPreventingDefault(async () => editTag(tag, newTagName, color)\n .then(() => tagEdited(tag, newTagName, color))\n .then(toggle)\n .catch(() => {}));\n\n return (\n <Modal isOpen={isOpen} toggle={toggle} centered onClosed={hideColorPicker}>\n <form onSubmit={saveTag}>\n <ModalHeader toggle={toggle}>Edit tag</ModalHeader>\n <ModalBody>\n <div className=\"input-group\">\n <div className=\"input-group-prepend\" id=\"colorPickerBtn\" onClick={toggleColorPicker}>\n <div\n className=\"input-group-text edit-tag-modal__color-picker-toggle\"\n style={{ backgroundColor: color, borderColor: color }}\n >\n <FontAwesomeIcon icon={colorIcon} className=\"edit-tag-modal__color-icon\" />\n </div>\n </div>\n <Popover isOpen={showColorPicker} toggle={toggleColorPicker} target=\"colorPickerBtn\" placement=\"right\">\n <ChromePicker color={color} disableAlpha onChange={({ hex }) => setColor(hex)} />\n </Popover>\n <input\n type=\"text\"\n value={newTagName}\n placeholder=\"Tag\"\n required\n className=\"form-control\"\n onChange={(e) => setNewTagName(e.target.value)}\n />\n </div>\n\n {error && (\n <Result type=\"error\" small className=\"mt-2\">\n <ShlinkApiError errorData={errorData} fallbackMessage=\"Something went wrong while editing the tag :(\" />\n </Result>\n )}\n </ModalBody>\n <ModalFooter>\n <button type=\"button\" className=\"btn btn-link\" onClick={toggle}>Cancel</button>\n <button type=\"submit\" className=\"btn btn-primary\" disabled={editing}>{editing ? 'Saving...' : 'Save'}</button>\n </ModalFooter>\n </form>\n </Modal>\n );\n};\n\nexport default EditTagModal;\n","import { FC, useEffect, useState } from 'react';\nimport { splitEvery } from 'ramda';\nimport Message from '../utils/Message';\nimport SearchField from '../utils/SearchField';\nimport { SelectedServer } from '../servers/data';\nimport { boundToMercureHub } from '../mercure/helpers/boundToMercureHub';\nimport { Result } from '../utils/Result';\nimport { ShlinkApiError } from '../api/ShlinkApiError';\nimport { Topics } from '../mercure/helpers/Topics';\nimport { TagsList as TagsListState } from './reducers/tagsList';\nimport { TagCardProps } from './TagCard';\n\nconst { ceil } = Math;\nconst TAGS_GROUPS_AMOUNT = 4;\n\nexport interface TagsListProps {\n filterTags: (searchTerm: string) => void;\n forceListTags: Function;\n tagsList: TagsListState;\n selectedServer: SelectedServer;\n}\n\nconst TagsList = (TagCard: FC<TagCardProps>) => boundToMercureHub((\n { filterTags, forceListTags, tagsList, selectedServer }: TagsListProps,\n) => {\n const [ displayedTag, setDisplayedTag ] = useState<string | undefined>();\n\n useEffect(() => {\n forceListTags();\n }, []);\n\n const renderContent = () => {\n if (tagsList.loading) {\n return <Message loading />;\n }\n\n if (tagsList.error) {\n return (\n <Result type=\"error\">\n <ShlinkApiError errorData={tagsList.errorData} fallbackMessage=\"Error loading tags :(\" />\n </Result>\n );\n }\n\n const tagsCount = tagsList.filteredTags.length;\n\n if (tagsCount < 1) {\n return <Message>No tags found</Message>;\n }\n\n const tagsGroups = splitEvery(ceil(tagsCount / TAGS_GROUPS_AMOUNT), tagsList.filteredTags);\n\n return (\n <div className=\"row\">\n {tagsGroups.map((group, index) => (\n <div key={index} className=\"col-md-6 col-xl-3\">\n {group.map((tag) => (\n <TagCard\n key={tag}\n tag={tag}\n tagStats={tagsList.stats[tag]}\n selectedServer={selectedServer}\n displayed={displayedTag === tag}\n toggle={() => setDisplayedTag(displayedTag !== tag ? tag : undefined)}\n />\n ))}\n </div>\n ))}\n </div>\n );\n };\n\n return (\n <>\n {!tagsList.loading && <SearchField className=\"mb-3\" placeholder=\"Search tags...\" onChange={filterTags} />}\n {renderContent()}\n </>\n );\n}, () => [ Topics.visits() ]);\n\nexport default TagsList;\n","import { Action, Dispatch } from 'redux';\nimport { buildReducer } from '../../utils/helpers/redux';\nimport { GetState } from '../../container/types';\nimport { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';\nimport { ProblemDetailsError } from '../../api/types';\nimport { parseApiError } from '../../api/utils';\n\n/* eslint-disable padding-line-between-statements */\nexport const DELETE_TAG_START = 'shlink/deleteTag/DELETE_TAG_START';\nexport const DELETE_TAG_ERROR = 'shlink/deleteTag/DELETE_TAG_ERROR';\nexport const DELETE_TAG = 'shlink/deleteTag/DELETE_TAG';\nexport const TAG_DELETED = 'shlink/deleteTag/TAG_DELETED';\n/* eslint-enable padding-line-between-statements */\n\nexport interface TagDeletion {\n deleting: boolean;\n error: boolean;\n errorData?: ProblemDetailsError;\n}\n\nexport interface DeleteTagAction extends Action<string> {\n tag: string;\n}\n\nexport interface DeleteTagFailedAction extends Action<string> {\n errorData?: ProblemDetailsError;\n}\n\nconst initialState: TagDeletion = {\n deleting: false,\n error: false,\n};\n\nexport default buildReducer<TagDeletion, DeleteTagFailedAction>({\n [DELETE_TAG_START]: () => ({ deleting: true, error: false }),\n [DELETE_TAG_ERROR]: (_, { errorData }) => ({ deleting: false, error: true, errorData }),\n [DELETE_TAG]: () => ({ deleting: false, error: false }),\n}, initialState);\n\nexport const deleteTag = (buildShlinkApiClient: ShlinkApiClientBuilder) => (tag: string) => async (\n dispatch: Dispatch,\n getState: GetState,\n) => {\n dispatch({ type: DELETE_TAG_START });\n const { deleteTags } = buildShlinkApiClient(getState);\n\n try {\n await deleteTags([ tag ]);\n dispatch({ type: DELETE_TAG });\n } catch (e) {\n dispatch<DeleteTagFailedAction>({ type: DELETE_TAG_ERROR, errorData: parseApiError(e) });\n\n throw e;\n }\n};\n\nexport const tagDeleted = (tag: string): DeleteTagAction => ({ type: TAG_DELETED, tag });\n","import { pick } from 'ramda';\nimport { Action, Dispatch } from 'redux';\nimport { buildReducer } from '../../utils/helpers/redux';\nimport { GetState } from '../../container/types';\nimport ColorGenerator from '../../utils/services/ColorGenerator';\nimport { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';\nimport { ProblemDetailsError } from '../../api/types';\nimport { parseApiError } from '../../api/utils';\n\n/* eslint-disable padding-line-between-statements */\nexport const EDIT_TAG_START = 'shlink/editTag/EDIT_TAG_START';\nexport const EDIT_TAG_ERROR = 'shlink/editTag/EDIT_TAG_ERROR';\nexport const EDIT_TAG = 'shlink/editTag/EDIT_TAG';\n/* eslint-enable padding-line-between-statements */\n\nexport const TAG_EDITED = 'shlink/editTag/TAG_EDITED';\n\nexport interface TagEdition {\n oldName: string;\n newName: string;\n editing: boolean;\n error: boolean;\n errorData?: ProblemDetailsError;\n}\n\nexport interface EditTagAction extends Action<string> {\n oldName: string;\n newName: string;\n color: string;\n}\n\nexport interface EditTagFailedAction extends Action<string> {\n errorData?: ProblemDetailsError;\n}\n\nconst initialState: TagEdition = {\n oldName: '',\n newName: '',\n editing: false,\n error: false,\n};\n\nexport default buildReducer<TagEdition, EditTagAction & EditTagFailedAction>({\n [EDIT_TAG_START]: (state) => ({ ...state, editing: true, error: false }),\n [EDIT_TAG_ERROR]: (state, { errorData }) => ({ ...state, editing: false, error: true, errorData }),\n [EDIT_TAG]: (_, action) => ({\n ...pick([ 'oldName', 'newName' ], action),\n editing: false,\n error: false,\n }),\n}, initialState);\n\nexport const editTag = (buildShlinkApiClient: ShlinkApiClientBuilder, colorGenerator: ColorGenerator) => (\n oldName: string,\n newName: string,\n color: string,\n) => async (dispatch: Dispatch, getState: GetState) => {\n dispatch({ type: EDIT_TAG_START });\n const { editTag } = buildShlinkApiClient(getState);\n\n try {\n await editTag(oldName, newName);\n colorGenerator.setColorForKey(newName, color);\n dispatch({ type: EDIT_TAG, oldName, newName });\n } catch (e) {\n dispatch<EditTagFailedAction>({ type: EDIT_TAG_ERROR, errorData: parseApiError(e) });\n\n throw e;\n }\n};\n\nexport const tagEdited = (oldName: string, newName: string, color: string): EditTagAction => ({\n type: TAG_EDITED,\n oldName,\n newName,\n color,\n});\n","import { isEmpty, reject } from 'ramda';\nimport { Action, Dispatch } from 'redux';\nimport { CREATE_VISITS, CreateVisitsAction } from '../../visits/reducers/visitCreation';\nimport { buildReducer } from '../../utils/helpers/redux';\nimport { ProblemDetailsError, ShlinkTags } from '../../api/types';\nimport { GetState } from '../../container/types';\nimport { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';\nimport { CreateVisit, Stats } from '../../visits/types';\nimport { parseApiError } from '../../api/utils';\nimport { TagStats } from '../data';\nimport { DeleteTagAction, TAG_DELETED } from './tagDelete';\nimport { EditTagAction, TAG_EDITED } from './tagEdit';\n\n/* eslint-disable padding-line-between-statements */\nexport const LIST_TAGS_START = 'shlink/tagsList/LIST_TAGS_START';\nexport const LIST_TAGS_ERROR = 'shlink/tagsList/LIST_TAGS_ERROR';\nexport const LIST_TAGS = 'shlink/tagsList/LIST_TAGS';\nexport const FILTER_TAGS = 'shlink/tagsList/FILTER_TAGS';\n/* eslint-enable padding-line-between-statements */\n\ntype TagsStatsMap = Record<string, TagStats>;\n\nexport interface TagsList {\n tags: string[];\n filteredTags: string[];\n stats: TagsStatsMap;\n loading: boolean;\n error: boolean;\n errorData?: ProblemDetailsError;\n}\n\ninterface ListTagsAction extends Action<string> {\n tags: string[];\n stats: TagsStatsMap;\n}\n\ninterface ListTagsFailedAction extends Action<string> {\n errorData?: ProblemDetailsError;\n}\n\ninterface FilterTagsAction extends Action<string> {\n searchTerm: string;\n}\n\ntype ListTagsCombinedAction = ListTagsAction\n& DeleteTagAction\n& CreateVisitsAction\n& EditTagAction\n& FilterTagsAction\n& ListTagsFailedAction;\n\nconst initialState = {\n tags: [],\n filteredTags: [],\n stats: {},\n loading: false,\n error: false,\n};\n\ntype TagIncrease = [string, number];\n\nconst renameTag = (oldName: string, newName: string) => (tag: string) => tag === oldName ? newName : tag;\nconst rejectTag = (tags: string[], tagToReject: string) => reject((tag) => tag === tagToReject, tags);\nconst increaseVisitsForTags = (tags: TagIncrease[], stats: TagsStatsMap) => tags.reduce((stats, [ tag, increase ]) => {\n if (!stats[tag]) {\n return stats;\n }\n\n const tagStats = stats[tag];\n\n tagStats.visitsCount = tagStats.visitsCount + increase;\n stats[tag] = tagStats;\n\n return stats;\n}, { ...stats });\nconst calculateVisitsPerTag = (createdVisits: CreateVisit[]): TagIncrease[] => Object.entries(\n createdVisits.reduce<Stats>((acc, { shortUrl }) => {\n shortUrl?.tags.forEach((tag) => {\n acc[tag] = (acc[tag] || 0) + 1;\n });\n\n return acc;\n }, {}),\n);\n\nexport default buildReducer<TagsList, ListTagsCombinedAction>({\n [LIST_TAGS_START]: () => ({ ...initialState, loading: true }),\n [LIST_TAGS_ERROR]: (_, { errorData }) => ({ ...initialState, error: true, errorData }),\n [LIST_TAGS]: (_, { tags, stats }) => ({ ...initialState, stats, tags, filteredTags: tags }),\n [TAG_DELETED]: (state, { tag }) => ({\n ...state,\n tags: rejectTag(state.tags, tag),\n filteredTags: rejectTag(state.filteredTags, tag),\n }),\n [TAG_EDITED]: (state, { oldName, newName }) => ({\n ...state,\n tags: state.tags.map(renameTag(oldName, newName)).sort(),\n filteredTags: state.filteredTags.map(renameTag(oldName, newName)).sort(),\n }),\n [FILTER_TAGS]: (state, { searchTerm }) => ({\n ...state,\n filteredTags: state.tags.filter((tag) => tag.toLowerCase().match(searchTerm)),\n }),\n [CREATE_VISITS]: (state, { createdVisits }) => ({\n ...state,\n stats: increaseVisitsForTags(calculateVisitsPerTag(createdVisits), state.stats),\n }),\n}, initialState);\n\nexport const listTags = (buildShlinkApiClient: ShlinkApiClientBuilder, force = true) => () => async (\n dispatch: Dispatch,\n getState: GetState,\n) => {\n const { tagsList } = getState();\n\n if (!force && (tagsList.loading || !isEmpty(tagsList.tags))) {\n return;\n }\n\n dispatch({ type: LIST_TAGS_START });\n\n try {\n const { listTags } = buildShlinkApiClient(getState);\n const { tags, stats = [] }: ShlinkTags = await listTags();\n const processedStats = stats.reduce<TagsStatsMap>((acc, { tag, shortUrlsCount, visitsCount }) => {\n acc[tag] = { shortUrlsCount, visitsCount };\n\n return acc;\n }, {});\n\n dispatch<ListTagsAction>({ tags, stats: processedStats, type: LIST_TAGS });\n } catch (e) {\n dispatch<ListTagsFailedAction>({ type: LIST_TAGS_ERROR, errorData: parseApiError(e) });\n }\n};\n\nexport const filterTags = (searchTerm: string): FilterTagsAction => ({ type: FILTER_TAGS, searchTerm });\n","import Bottle, { IContainer } from 'bottlejs';\nimport TagsSelector from '../helpers/TagsSelector';\nimport TagCard from '../TagCard';\nimport DeleteTagConfirmModal from '../helpers/DeleteTagConfirmModal';\nimport EditTagModal from '../helpers/EditTagModal';\nimport TagsList from '../TagsList';\nimport { filterTags, listTags } from '../reducers/tagsList';\nimport { deleteTag, tagDeleted } from '../reducers/tagDelete';\nimport { editTag, tagEdited } from '../reducers/tagEdit';\nimport { ConnectDecorator } from '../../container/types';\n\nconst provideServices = (bottle: Bottle, connect: ConnectDecorator) => {\n // Components\n bottle.serviceFactory('TagsSelector', TagsSelector, 'ColorGenerator');\n bottle.decorator('TagsSelector', connect([ 'tagsList' ], [ 'listTags' ]));\n\n bottle.serviceFactory(\n 'TagCard',\n TagCard,\n 'DeleteTagConfirmModal',\n 'EditTagModal',\n 'ForServerVersion',\n 'ColorGenerator',\n );\n\n bottle.serviceFactory('DeleteTagConfirmModal', () => DeleteTagConfirmModal);\n bottle.decorator('DeleteTagConfirmModal', connect([ 'tagDelete' ], [ 'deleteTag', 'tagDeleted' ]));\n\n bottle.serviceFactory('EditTagModal', EditTagModal, 'ColorGenerator');\n bottle.decorator('EditTagModal', connect([ 'tagEdit' ], [ 'editTag', 'tagEdited' ]));\n\n bottle.serviceFactory('TagsList', TagsList, 'TagCard');\n bottle.decorator('TagsList', connect(\n [ 'tagsList', 'selectedServer', 'mercureInfo' ],\n [ 'forceListTags', 'filterTags', 'createNewVisits', 'loadMercureInfo' ],\n ));\n\n // Actions\n const listTagsActionFactory = (force: boolean) =>\n ({ buildShlinkApiClient }: IContainer) => listTags(buildShlinkApiClient, force);\n\n bottle.factory('listTags', listTagsActionFactory(false));\n bottle.factory('forceListTags', listTagsActionFactory(true));\n bottle.serviceFactory('filterTags', () => filterTags);\n bottle.serviceFactory('tagDeleted', () => tagDeleted);\n bottle.serviceFactory('tagEdited', () => tagEdited);\n\n bottle.serviceFactory('deleteTag', deleteTag, 'buildShlinkApiClient');\n bottle.serviceFactory('editTag', editTag, 'buildShlinkApiClient', 'ColorGenerator');\n};\n\nexport default provideServices;\n","import { Action, Dispatch } from 'redux';\nimport { ShlinkMercureInfo } from '../../api/types';\nimport { GetState } from '../../container/types';\nimport { buildReducer } from '../../utils/helpers/redux';\nimport { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';\n\n/* eslint-disable padding-line-between-statements */\nexport const GET_MERCURE_INFO_START = 'shlink/mercure/GET_MERCURE_INFO_START';\nexport const GET_MERCURE_INFO_ERROR = 'shlink/mercure/GET_MERCURE_INFO_ERROR';\nexport const GET_MERCURE_INFO = 'shlink/mercure/GET_MERCURE_INFO';\n/* eslint-enable padding-line-between-statements */\n\nexport interface MercureInfo {\n token?: string;\n mercureHubUrl?: string;\n interval?: number;\n loading: boolean;\n error: boolean;\n}\n\nexport type GetMercureInfoAction = Action<string> & ShlinkMercureInfo & { interval?: number };\n\nconst initialState: MercureInfo = {\n loading: true,\n error: false,\n};\n\nexport default buildReducer<MercureInfo, GetMercureInfoAction>({\n [GET_MERCURE_INFO_START]: (state) => ({ ...state, loading: true, error: false }),\n [GET_MERCURE_INFO_ERROR]: (state) => ({ ...state, loading: false, error: true }),\n [GET_MERCURE_INFO]: (_, action) => ({ ...action, loading: false, error: false }),\n}, initialState);\n\nexport const loadMercureInfo = (buildShlinkApiClient: ShlinkApiClientBuilder) =>\n () => async (dispatch: Dispatch, getState: GetState) => {\n dispatch({ type: GET_MERCURE_INFO_START });\n\n const { settings } = getState();\n const { mercureInfo } = buildShlinkApiClient(getState);\n\n if (!settings.realTimeUpdates.enabled) {\n dispatch({ type: GET_MERCURE_INFO_ERROR });\n\n return;\n }\n\n try {\n const info = await mercureInfo();\n\n dispatch<GetMercureInfoAction>({ type: GET_MERCURE_INFO, interval: settings.realTimeUpdates.interval, ...info });\n } catch (e) {\n dispatch({ type: GET_MERCURE_INFO_ERROR });\n }\n };\n","import Bottle from 'bottlejs';\nimport { loadMercureInfo } from '../reducers/mercureInfo';\n\nconst provideServices = (bottle: Bottle) => {\n // Actions\n bottle.serviceFactory('loadMercureInfo', loadMercureInfo, 'buildShlinkApiClient');\n};\n\nexport default provideServices;\n","import { FormGroup, Input } from 'reactstrap';\nimport classNames from 'classnames';\nimport ToggleSwitch from '../utils/ToggleSwitch';\nimport { SimpleCard } from '../utils/SimpleCard';\nimport { Settings } from './reducers/settings';\n\ninterface RealTimeUpdatesProps {\n settings: Settings;\n toggleRealTimeUpdates: (enabled: boolean) => void;\n setRealTimeUpdatesInterval: (interval: number) => void;\n}\n\nconst intervalValue = (interval?: number) => !interval ? '' : `${interval}`;\n\nconst RealTimeUpdates = (\n { settings: { realTimeUpdates }, toggleRealTimeUpdates, setRealTimeUpdatesInterval }: RealTimeUpdatesProps,\n) => (\n <SimpleCard title=\"Real-time updates\" className=\"h-100\">\n <FormGroup>\n <ToggleSwitch checked={realTimeUpdates.enabled} onChange={toggleRealTimeUpdates}>\n Enable or disable real-time updates, when using Shlink v2.2.0 or newer.\n <small className=\"form-text text-muted\">\n Real-time updates are currently being <b>{realTimeUpdates.enabled ? 'processed' : 'ignored'}</b>.\n </small>\n </ToggleSwitch>\n </FormGroup>\n <FormGroup className=\"mb-0\">\n <label className={classNames({ 'text-muted': !realTimeUpdates.enabled })}>\n Real-time updates frequency (in minutes):\n </label>\n <Input\n type=\"number\"\n min={0}\n placeholder=\"Immediate\"\n disabled={!realTimeUpdates.enabled}\n value={intervalValue(realTimeUpdates.interval)}\n onChange={(e) => setRealTimeUpdatesInterval(Number(e.target.value))}\n />\n {realTimeUpdates.enabled && (\n <small className=\"form-text text-muted\">\n {realTimeUpdates.interval !== undefined && realTimeUpdates.interval > 0 && (\n <span>\n Updates will be reflected in the UI every <b>{realTimeUpdates.interval}</b> minute{realTimeUpdates.interval > 1 && 's'}.\n </span>\n )}\n {!realTimeUpdates.interval && 'Updates will be reflected in the UI as soon as they happen.'}\n </small>\n )}\n </FormGroup>\n </SimpleCard>\n);\n\nexport default RealTimeUpdates;\n","import { FC, ReactNode } from 'react';\nimport { Row } from 'reactstrap';\nimport NoMenuLayout from '../common/NoMenuLayout';\n\nconst SettingsSections: FC<{ items: ReactNode[][] }> = ({ items }) => (\n <>\n {items.map((child, index) => (\n <Row key={index}>\n {child.map((subChild, subIndex) => (\n <div key={subIndex} className=\"col-lg-6 mb-3\">\n {subChild}\n </div>\n ))}\n </Row>\n ))}\n </>\n);\n\nconst Settings = (RealTimeUpdates: FC, ShortUrlCreation: FC, UserInterface: FC, Visits: FC) => () => (\n <NoMenuLayout>\n <SettingsSections\n items={[\n [ <UserInterface />, <ShortUrlCreation /> ], // eslint-disable-line react/jsx-key\n [ <Visits />, <RealTimeUpdates /> ], // eslint-disable-line react/jsx-key\n ]}\n />\n </NoMenuLayout>\n);\n\nexport default Settings;\n","import { Action } from 'redux';\nimport { dissoc, mergeDeepRight } from 'ramda';\nimport { buildReducer } from '../../utils/helpers/redux';\nimport { RecursivePartial } from '../../utils/utils';\nimport { Theme } from '../../utils/theme';\nimport { DateInterval } from '../../utils/dates/types';\n\nexport const SET_SETTINGS = 'shlink/realTimeUpdates/SET_SETTINGS';\n\n/**\n * Important! When adding new props in the main Settings interface or any of the nested props, they have to be set as\n * optional, as old instances of the app will load partial objects from local storage until it is saved again.\n */\n\ninterface RealTimeUpdatesSettings {\n enabled: boolean;\n interval?: number;\n}\n\nexport interface ShortUrlCreationSettings {\n validateUrls: boolean;\n}\n\nexport interface UiSettings {\n theme: Theme;\n}\n\nexport interface VisitsSettings {\n defaultInterval: DateInterval;\n}\n\nexport interface Settings {\n realTimeUpdates: RealTimeUpdatesSettings;\n shortUrlCreation?: ShortUrlCreationSettings;\n ui?: UiSettings;\n visits?: VisitsSettings;\n}\n\nconst initialState: Settings = {\n realTimeUpdates: {\n enabled: true,\n },\n shortUrlCreation: {\n validateUrls: false,\n },\n ui: {\n theme: 'light',\n },\n visits: {\n defaultInterval: 'last30Days',\n },\n};\n\ntype SettingsAction = Action & Settings;\n\ntype PartialSettingsAction = Action & RecursivePartial<Settings>;\n\nexport default buildReducer<Settings, SettingsAction>({\n [SET_SETTINGS]: (state, action) => mergeDeepRight(state, dissoc('type', action)),\n}, initialState);\n\nexport const toggleRealTimeUpdates = (enabled: boolean): PartialSettingsAction => ({\n type: SET_SETTINGS,\n realTimeUpdates: { enabled },\n});\n\nexport const setRealTimeUpdatesInterval = (interval: number): PartialSettingsAction => ({\n type: SET_SETTINGS,\n realTimeUpdates: { interval },\n});\n\nexport const setShortUrlCreationSettings = (settings: ShortUrlCreationSettings): PartialSettingsAction => ({\n type: SET_SETTINGS,\n shortUrlCreation: settings,\n});\n\nexport const setUiSettings = (settings: UiSettings): PartialSettingsAction => ({\n type: SET_SETTINGS,\n ui: settings,\n});\n\nexport const setVisitsSettings = (settings: VisitsSettings): PartialSettingsAction => ({\n type: SET_SETTINGS,\n visits: settings,\n});\n","import { FC } from 'react';\nimport { FormGroup } from 'reactstrap';\nimport { SimpleCard } from '../utils/SimpleCard';\nimport ToggleSwitch from '../utils/ToggleSwitch';\nimport { Settings, ShortUrlCreationSettings } from './reducers/settings';\n\ninterface ShortUrlCreationProps {\n settings: Settings;\n setShortUrlCreationSettings: (settings: ShortUrlCreationSettings) => void;\n}\n\nexport const ShortUrlCreation: FC<ShortUrlCreationProps> = (\n { settings: { shortUrlCreation }, setShortUrlCreationSettings },\n) => (\n <SimpleCard title=\"Short URLs creation\" className=\"h-100\">\n <FormGroup className=\"mb-0\">\n <ToggleSwitch\n checked={shortUrlCreation?.validateUrls ?? false}\n onChange={(validateUrls) => setShortUrlCreationSettings({ validateUrls })}\n >\n By default, request validation on long URLs when creating new short URLs.\n <small className=\"form-text text-muted\">\n The initial state of the <b>Validate URL</b> checkbox will\n be <b>{shortUrlCreation?.validateUrls ? 'checked' : 'unchecked'}</b>.\n </small>\n </ToggleSwitch>\n </FormGroup>\n </SimpleCard>\n);\n","import { FC } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faSun, faMoon } from '@fortawesome/free-solid-svg-icons';\nimport { SimpleCard } from '../utils/SimpleCard';\nimport ToggleSwitch from '../utils/ToggleSwitch';\nimport { changeThemeInMarkup, Theme } from '../utils/theme';\nimport { Settings, UiSettings } from './reducers/settings';\nimport './UserInterface.scss';\n\ninterface UserInterfaceProps {\n settings: Settings;\n setUiSettings: (settings: UiSettings) => void;\n}\n\nexport const UserInterface: FC<UserInterfaceProps> = ({ settings: { ui }, setUiSettings }) => (\n <SimpleCard title=\"User interface\" className=\"h-100\">\n <FontAwesomeIcon icon={ui?.theme === 'dark' ? faMoon : faSun} className=\"user-interface__theme-icon\" />\n <ToggleSwitch\n checked={ui?.theme === 'dark'}\n onChange={(useDarkTheme) => {\n const theme: Theme = useDarkTheme ? 'dark' : 'light';\n\n setUiSettings({ theme });\n changeThemeInMarkup(theme);\n }}\n >\n Use dark theme.\n </ToggleSwitch>\n </SimpleCard>\n);\n","import { FC } from 'react';\nimport { DropdownBtn } from '../DropdownBtn';\nimport { rangeOrIntervalToString } from './types';\nimport { DateIntervalDropdownItems, DateIntervalDropdownProps } from './DateIntervalDropdownItems';\n\nexport const DateIntervalSelector: FC<DateIntervalDropdownProps> = ({ onChange, active }) => (\n <DropdownBtn text={rangeOrIntervalToString(active) ?? ''}>\n <DateIntervalDropdownItems active={active} onChange={onChange} />\n </DropdownBtn>\n);\n","import { FormGroup } from 'reactstrap';\nimport { FC } from 'react';\nimport { SimpleCard } from '../utils/SimpleCard';\nimport { DateIntervalSelector } from '../utils/dates/DateIntervalSelector';\nimport { Settings, VisitsSettings } from './reducers/settings';\n\ninterface VisitsProps {\n settings: Settings;\n setVisitsSettings: (settings: VisitsSettings) => void;\n}\n\nexport const Visits: FC<VisitsProps> = ({ settings, setVisitsSettings }) => (\n <SimpleCard title=\"Visits\" className=\"h-100\">\n <FormGroup className=\"mb-0\">\n <label>Default interval to load on visits sections:</label>\n <DateIntervalSelector\n active={settings.visits?.defaultInterval ?? 'last30Days'}\n onChange={(defaultInterval) => setVisitsSettings({ defaultInterval })}\n />\n </FormGroup>\n </SimpleCard>\n);\n","import Bottle from 'bottlejs';\nimport RealTimeUpdates from '../RealTimeUpdates';\nimport Settings from '../Settings';\nimport {\n setRealTimeUpdatesInterval,\n setShortUrlCreationSettings,\n setUiSettings,\n setVisitsSettings,\n toggleRealTimeUpdates,\n} from '../reducers/settings';\nimport { ConnectDecorator } from '../../container/types';\nimport { withoutSelectedServer } from '../../servers/helpers/withoutSelectedServer';\nimport { ShortUrlCreation } from '../ShortUrlCreation';\nimport { UserInterface } from '../UserInterface';\nimport { Visits } from '../Visits';\n\nconst provideServices = (bottle: Bottle, connect: ConnectDecorator) => {\n // Components\n bottle.serviceFactory('Settings', Settings, 'RealTimeUpdates', 'ShortUrlCreation', 'UserInterface', 'Visits');\n bottle.decorator('Settings', withoutSelectedServer);\n bottle.decorator('Settings', connect(null, [ 'resetSelectedServer' ]));\n\n bottle.serviceFactory('RealTimeUpdates', () => RealTimeUpdates);\n bottle.decorator(\n 'RealTimeUpdates',\n connect([ 'settings' ], [ 'toggleRealTimeUpdates', 'setRealTimeUpdatesInterval' ]),\n );\n\n bottle.serviceFactory('ShortUrlCreation', () => ShortUrlCreation);\n bottle.decorator('ShortUrlCreation', connect([ 'settings' ], [ 'setShortUrlCreationSettings' ]));\n\n bottle.serviceFactory('UserInterface', () => UserInterface);\n bottle.decorator('UserInterface', connect([ 'settings' ], [ 'setUiSettings' ]));\n\n bottle.serviceFactory('Visits', () => Visits);\n bottle.decorator('Visits', connect([ 'settings' ], [ 'setVisitsSettings' ]));\n\n // Actions\n bottle.serviceFactory('toggleRealTimeUpdates', () => toggleRealTimeUpdates);\n bottle.serviceFactory('setRealTimeUpdatesInterval', () => setRealTimeUpdatesInterval);\n bottle.serviceFactory('setShortUrlCreationSettings', () => setShortUrlCreationSettings);\n bottle.serviceFactory('setUiSettings', () => setUiSettings);\n bottle.serviceFactory('setVisitsSettings', () => setVisitsSettings);\n};\n\nexport default provideServices;\n","import { Action, Dispatch } from 'redux';\nimport { ShlinkDomain } from '../../api/types';\nimport { buildReducer } from '../../utils/helpers/redux';\nimport { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';\nimport { GetState } from '../../container/types';\n\n/* eslint-disable padding-line-between-statements */\nexport const LIST_DOMAINS_START = 'shlink/domainsList/LIST_DOMAINS_START';\nexport const LIST_DOMAINS_ERROR = 'shlink/domainsList/LIST_DOMAINS_ERROR';\nexport const LIST_DOMAINS = 'shlink/domainsList/LIST_DOMAINS';\n/* eslint-enable padding-line-between-statements */\n\nexport interface DomainsList {\n domains: ShlinkDomain[];\n loading: boolean;\n error: boolean;\n}\n\nexport interface ListDomainsAction extends Action<string> {\n domains: ShlinkDomain[];\n}\n\nconst initialState: DomainsList = {\n domains: [],\n loading: false,\n error: false,\n};\n\nexport default buildReducer<DomainsList, ListDomainsAction>({\n [LIST_DOMAINS_START]: () => ({ ...initialState, loading: true }),\n [LIST_DOMAINS_ERROR]: () => ({ ...initialState, error: true }),\n [LIST_DOMAINS]: (_, { domains }) => ({ ...initialState, domains }),\n}, initialState);\n\nexport const listDomains = (buildShlinkApiClient: ShlinkApiClientBuilder) => () => async (\n dispatch: Dispatch,\n getState: GetState,\n) => {\n dispatch({ type: LIST_DOMAINS_START });\n const { listDomains } = buildShlinkApiClient(getState);\n\n try {\n const domains = await listDomains();\n\n dispatch<ListDomainsAction>({ type: LIST_DOMAINS, domains });\n } catch (e) {\n dispatch({ type: LIST_DOMAINS_ERROR });\n }\n};\n","import { useEffect } from 'react';\nimport { Button, DropdownItem, Input, InputGroup, InputGroupAddon, UncontrolledTooltip } from 'reactstrap';\nimport { InputProps } from 'reactstrap/lib/Input';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faUndo } from '@fortawesome/free-solid-svg-icons';\nimport { isEmpty, pipe } from 'ramda';\nimport { DropdownBtn } from '../utils/DropdownBtn';\nimport { useToggle } from '../utils/helpers/hooks';\nimport { DomainsList } from './reducers/domainsList';\nimport './DomainSelector.scss';\n\nexport interface DomainSelectorProps extends Omit<InputProps, 'onChange'> {\n value?: string;\n onChange: (domain: string) => void;\n}\n\ninterface DomainSelectorConnectProps extends DomainSelectorProps {\n listDomains: Function;\n domainsList: DomainsList;\n}\n\nexport const DomainSelector = ({ listDomains, value, domainsList, onChange }: DomainSelectorConnectProps) => {\n const [ inputDisplayed,, showInput, hideInput ] = useToggle();\n const { domains } = domainsList;\n const valueIsEmpty = isEmpty(value);\n const unselectDomain = () => onChange('');\n\n useEffect(() => {\n listDomains();\n }, []);\n\n return inputDisplayed ? (\n <InputGroup>\n <Input\n value={value}\n placeholder=\"Domain\"\n onChange={(e) => onChange(e.target.value)}\n />\n <InputGroupAddon addonType=\"append\">\n <Button\n id=\"backToDropdown\"\n outline\n type=\"button\"\n className=\"domains-dropdown__back-btn\"\n onClick={pipe(unselectDomain, hideInput)}\n >\n <FontAwesomeIcon icon={faUndo} />\n </Button>\n <UncontrolledTooltip target=\"backToDropdown\" placement=\"left\" trigger=\"hover\">\n Existing domains\n </UncontrolledTooltip>\n </InputGroupAddon>\n </InputGroup>\n ) : (\n <DropdownBtn\n text={valueIsEmpty ? 'Domain' : `Domain: ${value}`}\n className={!valueIsEmpty ? 'domains-dropdown__toggle-btn--active' : 'domains-dropdown__toggle-btn'}\n >\n {domains.map(({ domain, isDefault }) => (\n <DropdownItem\n key={domain}\n active={value === domain || isDefault && valueIsEmpty}\n onClick={() => onChange(domain)}\n >\n {domain}\n {isDefault && <span className=\"float-right text-muted\">default</span>}\n </DropdownItem>\n ))}\n <DropdownItem divider />\n <DropdownItem onClick={pipe(unselectDomain, showInput)}>\n <i>New domain</i>\n </DropdownItem>\n </DropdownBtn>\n );\n};\n","import Bottle from 'bottlejs';\nimport { ConnectDecorator } from '../../container/types';\nimport { listDomains } from '../reducers/domainsList';\nimport { DomainSelector } from '../DomainSelector';\n\nconst provideServices = (bottle: Bottle, connect: ConnectDecorator) => {\n // Components\n bottle.serviceFactory('DomainSelector', () => DomainSelector);\n bottle.decorator('DomainSelector', connect([ 'domainsList' ], [ 'listDomains' ]));\n\n // Actions\n bottle.serviceFactory('listDomains', listDomains, 'buildShlinkApiClient');\n};\n\nexport default provideServices;\n","import { Action } from 'redux';\nimport { buildActionCreator, buildReducer } from '../../utils/helpers/redux';\n\n/* eslint-disable padding-line-between-statements */\nexport const APP_UPDATE_AVAILABLE = 'shlink/appUpdates/APP_UPDATE_AVAILABLE';\nexport const RESET_APP_UPDATE = 'shlink/appUpdates/RESET_APP_UPDATE';\n/* eslint-enable padding-line-between-statements */\n\nconst initialState = false;\n\nexport default buildReducer<boolean, Action<string>>({\n [APP_UPDATE_AVAILABLE]: () => true,\n [RESET_APP_UPDATE]: () => false,\n}, initialState);\n\nexport const appUpdateAvailable = buildActionCreator(APP_UPDATE_AVAILABLE);\n\nexport const resetAppUpdate = buildActionCreator(RESET_APP_UPDATE);\n","import { FC, MouseEventHandler } from 'react';\nimport { Alert, Button } from 'reactstrap';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faSyncAlt as reloadIcon } from '@fortawesome/free-solid-svg-icons';\nimport { SimpleCard } from '../utils/SimpleCard';\nimport { useToggle } from '../utils/helpers/hooks';\nimport './AppUpdateBanner.scss';\n\ninterface AppUpdateBannerProps {\n isOpen: boolean;\n toggle: MouseEventHandler<any>;\n forceUpdate: Function;\n}\n\nexport const AppUpdateBanner: FC<AppUpdateBannerProps> = ({ isOpen, toggle, forceUpdate }) => {\n const [ isUpdating,, setUpdating ] = useToggle();\n const update = () => {\n setUpdating();\n forceUpdate();\n };\n\n return (\n <Alert className=\"app-update-banner\" isOpen={isOpen} toggle={toggle} tag={SimpleCard} color=\"secondary\">\n <h4 className=\"mb-4\">This app has just been updated!</h4>\n <p className=\"mb-0\">\n Restart it to enjoy the new features.\n <Button disabled={isUpdating} className=\"ml-2\" color=\"secondary\" size=\"sm\" onClick={update}>\n {!isUpdating && <>Restart now <FontAwesomeIcon icon={reloadIcon} className=\"ml-1\" /></>}\n {isUpdating && <>Restarting...</>}\n </Button>\n </p>\n </Alert>\n );\n};\n","export const forceUpdate = async () => {\n const registrations = await navigator.serviceWorker?.getRegistrations() ?? [];\n\n for (const registration of registrations) {\n const { waiting } = registration;\n\n waiting?.addEventListener('statechange', (event) => {\n if ((event.target as any)?.state === 'activated') {\n window.location.reload();\n }\n });\n\n // The logic that makes skipWaiting to be called when this message is posted is in service-worker.ts\n waiting?.postMessage({ type: 'SKIP_WAITING' });\n }\n};\n","import { useEffect, FC } from 'react';\nimport { Route, Switch } from 'react-router-dom';\nimport NotFound from './common/NotFound';\nimport { ServersMap } from './servers/data';\nimport { Settings } from './settings/reducers/settings';\nimport { changeThemeInMarkup } from './utils/theme';\nimport { AppUpdateBanner } from './common/AppUpdateBanner';\nimport { forceUpdate } from './utils/helpers/sw';\nimport './App.scss';\n\ninterface AppProps {\n fetchServers: () => void;\n servers: ServersMap;\n settings: Settings;\n resetAppUpdate: () => void;\n appUpdated: boolean;\n}\n\nconst App = (\n MainHeader: FC,\n Home: FC,\n MenuLayout: FC,\n CreateServer: FC,\n EditServer: FC,\n Settings: FC,\n ShlinkVersionsContainer: FC,\n) => ({ fetchServers, servers, settings, appUpdated, resetAppUpdate }: AppProps) => {\n useEffect(() => {\n // On first load, try to fetch the remote servers if the list is empty\n if (Object.keys(servers).length === 0) {\n fetchServers();\n }\n\n changeThemeInMarkup(settings.ui?.theme ?? 'light');\n }, []);\n\n return (\n <div className=\"container-fluid app-container\">\n <MainHeader />\n\n <div className=\"app\">\n <div className=\"shlink-wrapper\">\n <Switch>\n <Route exact path=\"/\" component={Home} />\n <Route exact path=\"/settings\" component={Settings} />\n <Route exact path=\"/server/create\" component={CreateServer} />\n <Route exact path=\"/server/:serverId/edit\" component={EditServer} />\n <Route path=\"/server/:serverId\" component={MenuLayout} />\n <Route component={NotFound} />\n </Switch>\n </div>\n\n <div className=\"shlink-footer\">\n <ShlinkVersionsContainer />\n </div>\n </div>\n\n <AppUpdateBanner isOpen={appUpdated} toggle={resetAppUpdate} forceUpdate={forceUpdate} />\n </div>\n );\n};\n\nexport default App;\n","import Bottle from 'bottlejs';\nimport { appUpdateAvailable, resetAppUpdate } from '../reducers/appUpdates';\nimport App from '../../App';\nimport { ConnectDecorator } from '../../container/types';\n\nconst provideServices = (bottle: Bottle, connect: ConnectDecorator) => {\n // Components\n bottle.serviceFactory(\n 'App',\n App,\n 'MainHeader',\n 'Home',\n 'MenuLayout',\n 'CreateServer',\n 'EditServer',\n 'Settings',\n 'ShlinkVersionsContainer',\n );\n bottle.decorator('App', connect([ 'servers', 'settings', 'appUpdated' ], [ 'fetchServers', 'resetAppUpdate' ]));\n\n // Actions\n bottle.serviceFactory('appUpdateAvailable', () => appUpdateAvailable);\n bottle.serviceFactory('resetAppUpdate', () => resetAppUpdate);\n};\n\nexport default provideServices;\n","import Bottle, { IContainer } from 'bottlejs';\nimport { withRouter } from 'react-router-dom';\nimport { connect as reduxConnect } from 'react-redux';\nimport { pick } from 'ramda';\nimport provideApiServices from '../api/services/provideServices';\nimport provideCommonServices from '../common/services/provideServices';\nimport provideShortUrlsServices from '../short-urls/services/provideServices';\nimport provideServersServices from '../servers/services/provideServices';\nimport provideVisitsServices from '../visits/services/provideServices';\nimport provideTagsServices from '../tags/services/provideServices';\nimport provideUtilsServices from '../utils/services/provideServices';\nimport provideMercureServices from '../mercure/services/provideServices';\nimport provideSettingsServices from '../settings/services/provideServices';\nimport provideDomainsServices from '../domains/services/provideServices';\nimport provideAppServices from '../app/services/provideServices';\nimport { ConnectDecorator } from './types';\n\ntype LazyActionMap = Record<string, Function>;\n\nconst bottle = new Bottle();\nconst { container } = bottle;\n\nconst lazyService = <T extends Function, K>(container: IContainer, serviceName: string) =>\n (...args: any[]) => (container[serviceName] as T)(...args) as K;\nconst mapActionService = (map: LazyActionMap, actionName: string): LazyActionMap => ({\n ...map,\n // Wrap actual action service in a function so that it is lazily created the first time it is called\n [actionName]: lazyService(container, actionName),\n});\nconst connect: ConnectDecorator = (propsFromState: string[] | null, actionServiceNames: string[] = []) =>\n reduxConnect(\n propsFromState ? pick(propsFromState) : null,\n actionServiceNames.reduce(mapActionService, {}),\n );\n\nprovideAppServices(bottle, connect);\nprovideCommonServices(bottle, connect, withRouter);\nprovideApiServices(bottle);\nprovideShortUrlsServices(bottle, connect);\nprovideServersServices(bottle, connect, withRouter);\nprovideTagsServices(bottle, connect);\nprovideVisitsServices(bottle, connect);\nprovideUtilsServices(bottle);\nprovideMercureServices(bottle);\nprovideSettingsServices(bottle, connect);\nprovideDomainsServices(bottle, connect);\n\nexport default container;\n","import { combineReducers } from 'redux';\nimport serversReducer from '../servers/reducers/servers';\nimport selectedServerReducer from '../servers/reducers/selectedServer';\nimport shortUrlsListReducer from '../short-urls/reducers/shortUrlsList';\nimport shortUrlsListParamsReducer from '../short-urls/reducers/shortUrlsListParams';\nimport shortUrlCreationReducer from '../short-urls/reducers/shortUrlCreation';\nimport shortUrlDeletionReducer from '../short-urls/reducers/shortUrlDeletion';\nimport shortUrlEditionReducer from '../short-urls/reducers/shortUrlEdition';\nimport shortUrlVisitsReducer from '../visits/reducers/shortUrlVisits';\nimport tagVisitsReducer from '../visits/reducers/tagVisits';\nimport orphanVisitsReducer from '../visits/reducers/orphanVisits';\nimport shortUrlDetailReducer from '../short-urls/reducers/shortUrlDetail';\nimport tagsListReducer from '../tags/reducers/tagsList';\nimport tagDeleteReducer from '../tags/reducers/tagDelete';\nimport tagEditReducer from '../tags/reducers/tagEdit';\nimport mercureInfoReducer from '../mercure/reducers/mercureInfo';\nimport settingsReducer from '../settings/reducers/settings';\nimport domainsListReducer from '../domains/reducers/domainsList';\nimport visitsOverviewReducer from '../visits/reducers/visitsOverview';\nimport appUpdatesReducer from '../app/reducers/appUpdates';\nimport { ShlinkState } from '../container/types';\n\nexport default combineReducers<ShlinkState>({\n servers: serversReducer,\n selectedServer: selectedServerReducer,\n shortUrlsList: shortUrlsListReducer,\n shortUrlsListParams: shortUrlsListParamsReducer,\n shortUrlCreationResult: shortUrlCreationReducer,\n shortUrlDeletion: shortUrlDeletionReducer,\n shortUrlEdition: shortUrlEditionReducer,\n shortUrlVisits: shortUrlVisitsReducer,\n tagVisits: tagVisitsReducer,\n orphanVisits: orphanVisitsReducer,\n shortUrlDetail: shortUrlDetailReducer,\n tagsList: tagsListReducer,\n tagDelete: tagDeleteReducer,\n tagEdit: tagEditReducer,\n mercureInfo: mercureInfoReducer,\n settings: settingsReducer,\n domainsList: domainsListReducer,\n visitsOverview: visitsOverviewReducer,\n appUpdated: appUpdatesReducer,\n});\n","import ReduxThunk from 'redux-thunk';\nimport { applyMiddleware, compose, createStore } from 'redux';\nimport { save, load, RLSOptions } from 'redux-localstorage-simple';\nimport reducers from '../reducers';\n\nconst isProduction = process.env.NODE_ENV !== 'production';\nconst composeEnhancers: Function = !isProduction && (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;\n\nconst localStorageConfig: RLSOptions = {\n states: [ 'settings', 'servers' ],\n namespace: 'shlink',\n namespaceSeparator: '.',\n debounce: 300,\n};\n\nconst store = createStore(reducers, load(localStorageConfig), composeEnhancers(\n applyMiddleware(save(localStorageConfig), ReduxThunk),\n));\n\nexport default store;\n","// This optional code is used to register a service worker.\n// register() is not called by default.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on subsequent visits to a page, after all the\n// existing tabs open on the page have been closed, since previously cached\n// resources are updated in the background.\n\n// To learn more about the benefits of this model and instructions on how to\n// opt-in, read https://cra.link/PWA\n\nconst isLocalhost = Boolean(\n window.location.hostname === 'localhost' ||\n // [::1] is the IPv6 localhost address.\n window.location.hostname === '[::1]' ||\n // 127.0.0.0/8 are considered localhost for IPv4.\n window.location.hostname.match(/^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)\n);\n\ntype Config = {\n onSuccess?: (registration: ServiceWorkerRegistration) => void;\n onUpdate?: (registration: ServiceWorkerRegistration) => void;\n};\n\nexport function register(config?: Config) {\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n // The URL constructor is available in all browsers that support SW.\n const publicUrl = new URL(process.env.PUBLIC_URL ?? '', window.location.href);\n if (publicUrl.origin !== window.location.origin) {\n // Our service worker won't work if PUBLIC_URL is on a different origin\n // from what our page is served on. This might happen if a CDN is used to\n // serve assets; see https://github.com/facebook/create-react-app/issues/2374\n return;\n }\n\n window.addEventListener('load', () => {\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n if (isLocalhost) {\n // This is running on localhost. Let's check if a service worker still exists or not.\n checkValidServiceWorker(swUrl, config);\n\n // Add some additional logging to localhost, pointing developers to the\n // service worker/PWA documentation.\n navigator.serviceWorker.ready.then(() => {\n console.log(\n 'This web app is being served cache-first by a service ' +\n 'worker. To learn more, visit https://cra.link/PWA'\n );\n });\n } else {\n // Is not localhost. Just register service worker\n registerValidSW(swUrl, config);\n }\n });\n }\n}\n\nfunction registerValidSW(swUrl: string, config?: Config) {\n navigator.serviceWorker\n .register(swUrl)\n .then((registration) => {\n registration.onupdatefound = () => {\n const installingWorker = registration.installing;\n if (installingWorker == null) {\n return;\n }\n installingWorker.onstatechange = () => {\n if (installingWorker.state === 'installed') {\n if (navigator.serviceWorker.controller) {\n // At this point, the updated precached content has been fetched,\n // but the previous service worker will still serve the older\n // content until all client tabs are closed.\n console.log(\n 'New content is available and will be used when all ' +\n 'tabs for this page are closed. See https://cra.link/PWA.'\n );\n\n // Execute callback\n if (config && config.onUpdate) {\n config.onUpdate(registration);\n }\n } else {\n // At this point, everything has been precached.\n // It's the perfect time to display a\n // \"Content is cached for offline use.\" message.\n console.log('Content is cached for offline use.');\n\n // Execute callback\n if (config && config.onSuccess) {\n config.onSuccess(registration);\n }\n }\n }\n };\n };\n })\n .catch((error) => {\n console.error('Error during service worker registration:', error);\n });\n}\n\nfunction checkValidServiceWorker(swUrl: string, config?: Config) {\n // Check if the service worker can be found. If it can't reload the page.\n fetch(swUrl, {\n headers: { 'Service-Worker': 'script' },\n })\n .then((response) => {\n // Ensure service worker exists, and that we really are getting a JS file.\n const contentType = response.headers.get('content-type');\n if (\n response.status === 404 ||\n (contentType != null && contentType.indexOf('javascript') === -1)\n ) {\n // No service worker found. Probably a different app. Reload the page.\n navigator.serviceWorker.ready.then((registration) => {\n registration.unregister().then(() => {\n window.location.reload();\n });\n });\n } else {\n // Service worker found. Proceed as normal.\n registerValidSW(swUrl, config);\n }\n })\n .catch(() => {\n console.log('No internet connection found. App is running in offline mode.');\n });\n}\n\nexport function unregister() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.ready\n .then((registration) => {\n registration.unregister();\n })\n .catch((error) => {\n console.error(error.message);\n });\n }\n}\n","import L from 'leaflet';\nimport marker2x from 'leaflet/dist/images/marker-icon-2x.png';\nimport marker from 'leaflet/dist/images/marker-icon.png';\nimport markerShadow from 'leaflet/dist/images/marker-shadow.png';\n\nexport const fixLeafletIcons = () => {\n delete (L.Icon.Default.prototype as any)._getIconUrl;\n\n L.Icon.Default.mergeOptions({\n iconRetinaUrl: marker2x,\n iconUrl: marker,\n shadowUrl: markerShadow,\n });\n};\n","import { render } from 'react-dom';\nimport { Provider } from 'react-redux';\nimport { BrowserRouter } from 'react-router-dom';\nimport { homepage } from '../package.json';\nimport container from './container';\nimport store from './container/store';\nimport { fixLeafletIcons } from './utils/helpers/leaflet';\nimport { register as registerServiceWorker } from './serviceWorkerRegistration';\nimport 'react-datepicker/dist/react-datepicker.css';\nimport 'leaflet/dist/leaflet.css';\nimport './index.scss';\n\n// This overwrites icons used for leaflet maps, fixing some issues caused by webpack while processing the CSS\nfixLeafletIcons();\n\nconst { App, ScrollToTop, ErrorHandler, appUpdateAvailable } = container;\n\nrender(\n <Provider store={store}>\n <BrowserRouter basename={homepage}>\n <ErrorHandler>\n <ScrollToTop>\n <App />\n </ScrollToTop>\n </ErrorHandler>\n </BrowserRouter>\n </Provider>,\n document.getElementById('root'),\n);\n\n// If you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n// Learn more about service workers: https://cra.link/PWA\nregisterServiceWorker({\n onUpdate() {\n store.dispatch(appUpdateAvailable()); // eslint-disable-line @typescript-eslint/no-unsafe-call\n },\n});\n","import { FC, useEffect } from 'react';\n\ninterface WithoutSelectedServerProps {\n resetSelectedServer: Function;\n}\n\nexport function withoutSelectedServer<T = {}>(WrappedComponent: FC<WithoutSelectedServerProps & T>) {\n return (props: WithoutSelectedServerProps & T) => {\n useEffect(() => {\n props.resetSelectedServer();\n }, []);\n\n return <WrappedComponent {...props} />;\n };\n}\n"],"sourceRoot":""} |