mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 17:40:23 +03:00
1 line
No EOL
568 KiB
Text
1 line
No EOL
568 KiB
Text
{"version":3,"sources":["common/img/ShlinkLogo.tsx","servers/helpers/withSelectedServer.tsx","common/NotFound.tsx","servers/ServersListGroup.tsx","utils/helpers/hooks.ts","common/services/provideServices.ts","common/ScrollToTop.tsx","common/ErrorHandler.tsx","common/services/ImageDownloader.ts","utils/services/provideServices.ts","utils/services/LocalStorage.ts","utils/services/ColorGenerator.ts","servers/data/index.ts","common/ShlinkVersions.tsx","common/ShlinkVersionsContainer.tsx","common/MainHeader.tsx","common/Home.tsx","common/MenuLayout.tsx","common/AsideMenu.tsx","utils/utils.ts","utils/SimpleCard.tsx","utils/helpers/features.ts","utils/theme/index.ts","utils/helpers/query.ts","utils/Message.tsx","utils/SearchField.tsx","utils/helpers/ordering.ts","api/services/ShlinkApiClient.ts","api/services/ShlinkApiClientBuilder.ts","api/services/provideServices.ts","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","utils/BooleanControl.tsx","utils/ToggleSwitch.tsx","utils/TooltipToggleSwitch.tsx","short-urls/helpers/hooks.ts","short-urls/ShortUrlsFilteringBar.tsx","utils/OrderingDropdown.tsx","mercure/helpers/boundToMercureHub.tsx","mercure/helpers/index.ts","mercure/helpers/Topics.ts","utils/table/TableOrderIcon.tsx","visits/VisitsStats.tsx","utils/helpers/redux.ts","settings/reducers/settings.ts","utils/helpers/numbers.ts","utils/helpers/pagination.ts","short-urls/Paginator.tsx","short-urls/data/index.ts","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","utils/DropdownBtnMenu.tsx","short-urls/helpers/ShortUrlsRowMenu.tsx","short-urls/CreateShortUrl.tsx","utils/Result.tsx","api/utils/index.ts","api/ShlinkApiError.tsx","short-urls/helpers/DeleteShortUrlModal.tsx","short-urls/helpers/CreateShortUrlResult.tsx","short-urls/helpers/index.ts","visits/reducers/visitCreation.ts","short-urls/reducers/shortUrlDeletion.ts","short-urls/reducers/shortUrlCreation.ts","short-urls/reducers/shortUrlEdition.ts","short-urls/reducers/shortUrlsList.ts","short-urls/ShortUrlsTable.tsx","short-urls/helpers/qr-codes/QrFormatDropdown.tsx","short-urls/helpers/qr-codes/QrErrorCorrectionDropdown.tsx","short-urls/helpers/QrCodeModal.tsx","utils/helpers/qrCodes.ts","utils/Checkbox.tsx","short-urls/UseExistingIfFoundInfoIcon.tsx","utils/InfoTooltip.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/forms/LabeledFormGroup.tsx","utils/forms/InputFormGroup.tsx","servers/helpers/ServerForm.tsx","servers/helpers/DuplicatedServersModal.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/helpers/HighlightCard.tsx","servers/Overview.tsx","servers/ManageServers.tsx","servers/ManageServersRow.tsx","servers/ManageServersRowDropdown.tsx","servers/services/ServersImporter.ts","servers/services/ServersExporter.ts","servers/services/provideServices.ts","visits/helpers/MapModal.tsx","visits/VisitsHeader.tsx","visits/ShortUrlVisitsHeader.tsx","utils/NavPills.tsx","utils/helpers/visits.ts","utils/helpers/charts.ts","visits/charts/LineChartCard.tsx","common/SimplePaginator.tsx","visits/VisitsTable.tsx","visits/helpers/OpenMapModalBtn.tsx","visits/types/helpers.ts","visits/services/VisitsParser.ts","visits/helpers/VisitsFilterDropdown.tsx","visits/charts/DoughnutChartLegend.tsx","visits/charts/DoughnutChart.tsx","visits/charts/ChartCard.tsx","visits/charts/DoughnutChartCard.tsx","utils/PaginationDropdown.tsx","visits/charts/HorizontalBarChart.tsx","visits/charts/SortableBarChartCard.tsx","visits/ShortUrlVisits.tsx","visits/TagVisitsHeader.tsx","visits/TagVisits.tsx","visits/OrphanVisitsHeader.tsx","visits/OrphanVisits.tsx","visits/NonOrphanVisitsHeader.tsx","visits/NonOrphanVisits.tsx","visits/reducers/common.ts","visits/reducers/shortUrlVisits.ts","visits/reducers/tagVisits.ts","visits/reducers/orphanVisits.ts","visits/reducers/nonOrphanVisits.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/data/TagsListChildrenProps.ts","tags/TagsModeDropdown.tsx","tags/TagsList.tsx","tags/reducers/tagDelete.ts","tags/reducers/tagEdit.ts","tags/reducers/tagsList.ts","tags/TagsCards.tsx","tags/TagsTable.tsx","tags/TagsTableRow.tsx","tags/services/provideServices.ts","mercure/reducers/mercureInfo.ts","mercure/services/provideServices.ts","utils/forms/FormText.tsx","settings/RealTimeUpdatesSettings.tsx","settings/Settings.tsx","settings/ShortUrlCreationSettings.tsx","settings/UserInterfaceSettings.tsx","utils/dates/DateIntervalSelector.tsx","settings/VisitsSettings.tsx","settings/TagsSettings.tsx","settings/ShortUrlsListSettings.tsx","settings/services/provideServices.ts","utils/helpers/uri.ts","domains/reducers/domainRedirects.ts","domains/reducers/domainsList.ts","domains/DomainSelector.tsx","domains/helpers/EditDomainRedirectsModal.tsx","domains/helpers/DomainStatusIcon.tsx","domains/DomainRow.tsx","domains/ManageDomains.tsx","domains/services/provideServices.ts","app/reducers/appUpdates.ts","common/AppUpdateBanner.tsx","utils/helpers/sw.ts","app/App.tsx","app/services/provideServices.ts","container/index.ts","reducers/index.ts","container/store.ts","settings/helpers/index.ts","serviceWorkerRegistration.ts","utils/helpers/leaflet.ts","index.tsx","common/NoMenuLayout.tsx","utils/helpers/version.ts","servers/helpers/withoutSelectedServer.tsx","utils/helpers/files.ts"],"names":["ShlinkLogo","color","MAIN_COLOR","className","viewBox","version","xmlns","fill","d","withSelectedServer","WrappedComponent","ServerError","props","params","useParams","selectServer","selectedServer","useEffect","serverId","isNotFoundServer","loading","NotFound","to","children","ServerListItem","id","name","tag","Link","icon","chevronIcon","ServersListGroup","servers","embedded","length","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","useQueryState","paramName","initialState","value","setValue","window","location","history","query","parseQuery","search","pushState","pathname","stringifyQuery","useEffectExceptFirstTime","deps","isFirstLoad","useGoBack","navigate","useNavigate","provideServices","bottle","connect","constant","global","console","axios","service","ImageDownloader","serviceFactory","ScrollToTop","MainHeader","Home","decorator","withoutSelectedServer","MenuLayout","AsideMenu","ShlinkVersionsContainer","ErrorHandler","useLocation","scrollTo","error","state","hasError","this","outline","onClick","reload","Component","imgUrl","filename","get","responseType","data","url","URL","createObjectURL","saveUrl","localStorage","LocalStorage","ColorGenerator","buildPath","path","key","item","getItem","JSON","parse","set","setItem","stringify","HEX_DIGITS","floor","Math","random","sqrt","round","normalizeKey","toLowerCase","trim","perceivedLightness","r","g","b","storage","colors","lights","getColorForKey","normalizedKey","setColorForKey","rangeOf","join","isColorLightForKey","colorHex","substring","isNil","rgb","match","hex","parseInt","hexColorToRgbArray","hasServerData","server","apiKey","isServerWithId","hasOwnProperty","isReachableServer","getServerId","serverWithIdToServerData","omit","normalizeVersion","pipe","versionToSemVer","versionToPrintable","VersionLink","project","href","ShlinkVersions","clientVersion","normalizedClientVersion","printableVersion","classes","ServersDropdown","isOpen","toggleOpen","close","settingsPath","toggleClass","dark","fixed","expand","arrowIcon","navbar","active","startsWith","cogsIcon","serversList","values","hasServers","isEmpty","autoConnectServer","find","autoConnect","noGutters","faPlus","faExternalLinkAlt","TagsList","ShortUrlsList","CreateShortUrl","ShortUrlVisits","TagVisits","OrphanVisits","NonOrphanVisits","Overview","EditShortUrl","ManageDomains","sidebarVisible","toggleSidebar","addOrphanVisitsRoute","supportsOrphanVisits","addNonOrphanVisitsRoute","supportsNonOrphanVisits","addManageDomainsRoute","supportsDomainRedirects","burgerClasses","swipeableProps","burgerIcon","showOnMobile","index","element","replace","AsideMenuItem","rest","isActive","DeleteServerButton","hasId","addManageDomainsLink","asideClass","suffix","fixedWidth","overviewIcon","listIcon","createIcon","flip","tagsIcon","domainsIcon","editIcon","textClassName","size","mappingFn","startAt","range","hasValue","handleEventPreventingDefault","handler","preventDefault","nonEmptyValueOrNull","capitalize","charAt","toUpperCase","slice","SimpleCard","title","bodyClassName","serverMatchesVersions","versions","versionMatch","supportsQrCodeSizeInQuery","minVersion","supportsShortUrlTitle","supportsQrCodeMargin","supportsTagsInPatch","supportsBotVisits","supportsCrawlableVisits","supportsQrErrorCorrection","supportsForwardQuery","supportsDefaultDomainRedirectsEdition","supportsAllTagsFiltering","MAIN_COLOR_ALPHA","HIGHLIGHTED_COLOR","HIGHLIGHTED_COLOR_ALPHA","PRIMARY_LIGHT_COLOR","PRIMARY_DARK_COLOR","changeThemeInMarkup","theme","getElementsByTagName","setAttribute","isDarkThemeEnabled","getAttribute","qs","ignoreQueryPrefix","arrayFormat","getClassForType","type","default","getTextClassForType","Message","fullWidth","body","preloader","spin","timer","determineOrderDir","currentField","newField","currentOrderDir","ASC","DESC","sortList","list","field","dir","sort","a","greaterThan","smallerThan","orderToString","order","stringToOrder","split","buildShlinkBaseUrl","rejectNilProps","reject","normalizeOrderByInParams","orderBy","ShlinkApiClient","baseUrl","listShortUrls","performRequest","then","shortUrls","createShortUrl","options","filteredOptions","resp","getShortUrlVisits","shortCode","visits","getTagVisits","getOrphanVisits","getNonOrphanVisits","getVisitsOverview","getShortUrl","domain","deleteShortUrl","updateShortUrlTags","tags","updateShortUrl","listTags","withStats","stats","deleteTags","editTag","oldName","newName","health","mercureInfo","listDomains","domains","editDomainRedirects","domainRedirects","method","headers","paramsSerializer","apiClients","buildShlinkApiClient","getStateOrSelectedServer","getState","isGetState","prop","Error","clientKey","SearchField","onChange","large","noBorder","searchTerm","setSearchTerm","resetTimer","searchTermChanged","newSearchTerm","placeholder","target","searchIcon","hidden","Tag","text","clearable","colorGenerator","onClose","style","backgroundColor","cursor","DropdownBtn","disabled","dropdownClassName","right","minWidth","toggle","toggleClasses","caret","isDateObject","date","formatDateFromFormat","theFormat","format","formatISO","formatIsoDate","formatInternational","formatDate","parseISO","stdParseISO","isBetween","start","end","isWithinInterval","isBeforeOrEqual","dateToCompare","isEqual","isBefore","dateRangeIsEmpty","dateRange","filter","Boolean","rangeIsInterval","INTERVAL_TO_STRING_MAP","today","yesterday","last7Days","last30Days","last90Days","last180Days","last365Days","all","DATE_INTERVALS","Object","keys","rangeOrIntervalToString","startDate","endDate","dateRangeToString","startOfDaysAgo","daysAgo","startOfDay","subDays","Date","endingToday","endOfDay","intervalToDateRange","dateInterval","dateToMatchingInterval","theDate","cond","T","DateInput","isClearable","selected","showCalendarIcon","ref","dateFormat","calendarIcon","input","focus","DateRangeRow","onStartDateChange","onEndDateChange","placeholderText","maxDate","minDate","DateIntervalDropdownItems","allText","divider","interval","DateRangeSelector","onDatesChange","initialDateRange","defaultText","updatable","initialIntervalIsRange","activeInterval","setActiveInterval","activeDateRange","setActiveDateRange","updateDateRange","updateInterval","isDateInterval","header","BooleanControl","checked","identity","inline","uuid","typeClasses","display","htmlFor","ToggleSwitch","TooltipToggleSwitch","tooltip","el","useShortUrlsQuery","useMemo","extra","mergedQuery","normalizedQuery","evolvedQuery","queryString","dateOrNull","ShortUrlsFilteringBar","tagsMode","toFirstPage","selectedTags","setDates","setSearch","removeTag","selectedTag","tagsList","canChangeTagsMode","toggleTagsMode","placement","OrderingDropdown","items","isButton","handleItemClick","fieldKey","newOrderDir","toPairs","fieldValue","sortAscIcon","sortDescIcon","boundToMercureHub","getTopicsForProps","pendingUpdates","Set","createNewVisits","loadMercureInfo","topics","closeEventSource","onMessage","onTokenExpired","mercureHubUrl","token","onEventSourceMessage","onEventSourceError","status","subscriptions","topic","hubUrl","searchParams","append","es","EventSource","Authorization","onmessage","onerror","forEach","bindToMercureTopic","visit","add","setInterval","clear","clearInterval","Topics","TableOrderIcon","currentOrder","caretUpIcon","caretDownIcon","orphanVisits","shortUrlVisits","selectedBar","buildReducer","action","actionHandler","currentState","buildActionCreator","SET_SETTINGS","DEFAULT_SHORT_URLS_ORDERING","realTimeUpdates","enabled","shortUrlCreation","validateUrls","ui","defaultInterval","shortUrlsList","defaultOrdering","mergeDeepRight","dissoc","toggleRealTimeUpdates","setRealTimeUpdatesInterval","setShortUrlCreationSettings","settings","setShortUrlsListSettings","setUiSettings","setVisitsSettings","setTagsSettings","ceil","formatter","Intl","NumberFormat","prettify","number","Number","ELLIPSIS","progressivePagination","currentPage","pageCount","pages","max","min","unshift","push","pageIsEllipsis","pageNumber","prettifyPageNumber","keyForPage","Paginator","paginator","currentQueryString","pagesCount","urlForPage","listClassName","previous","next","SHORT_URLS_ORDERABLE_FIELDS","dateCreated","longUrl","ShortUrlsTable","page","actualOrderBy","setActualOrderBy","pagination","handleOrderBy","addTag","newTag","orderByColumn","renderOrderIcon","onTagClick","CopyToClipboardIcon","onCopy","copyIcon","Time","relative","dateObject","dateTime","getUnixTime","formatDistance","buildUrl","ShortUrlDetailLink","shortUrl","ShortUrlVisitsCount","visitsCount","maxVisits","meta","visitsLink","prettifiedMaxVisits","tooltipRef","infoIcon","ShortUrlsRow","ShortUrlsRowMenu","copiedToClipboard","setCopiedToClipboard","setActive","isFirstRun","data-th","DropdownBtnMenu","menuIcon","DeleteShortUrlModal","QrCodeModal","isQrModalOpen","toggleQrCode","isDeleteModalOpen","toggleDelete","pieChartIcon","qrIcon","deleteIcon","ShortUrlForm","CreateShortUrlResult","shortUrlCreationResult","resetCreateShortUrl","basicMode","shortUrlCreationSettings","customSlug","shortCodeLength","validSince","validUntil","findIfExists","validateUrl","forwardQuery","getInitialState","saving","mode","onSave","canBeClosed","Result","small","parseApiError","response","isInvalidDeletionError","ShlinkApiError","errorData","fallbackMessage","detail","invalidElements","shortUrlDeletion","resetDeleteShortUrl","inputValue","setInputValue","handleDeleteUrl","catch","centered","onSubmit","result","showCopyTooltip","setShowCopyTooltip","closeIcon","shortUrlMatches","CREATE_VISITS","createdVisits","DELETE_SHORT_URL_START","DELETE_SHORT_URL_ERROR","SHORT_URL_DELETED","RESET_DELETE_SHORT_URL","dispatch","CREATE_SHORT_URL_START","CREATE_SHORT_URL_ERROR","CREATE_SHORT_URL","RESET_CREATE_SHORT_URL","_","EDIT_SHORT_URL_START","EDIT_SHORT_URL_ERROR","SHORT_URL_EDITED","editShortUrl","sendTagsSeparately","Promise","LIST_SHORT_URLS_START","LIST_SHORT_URLS_ERROR","LIST_SHORT_URLS","assocPath","totalItems","currentShortUrl","lastVisit","last","assoc","ITEMS_IN_OVERVIEW_PAGE","editedShortUrl","actionableFieldClasses","orderableColumnsClasses","tableClasses","supportsTitle","colSpan","QrFormatDropdown","setFormat","QrErrorCorrectionDropdown","errorCorrection","setErrorCorrection","imageDownloader","ForServerVersion","setSize","margin","setMargin","capabilities","useSizeInPath","marginIsSupported","errorCorrectionIsSupported","willRenderThreeControls","qrCodeUrl","buildQrCodeUrl","totalSize","modalSize","step","src","alt","block","saveImage","downloadIcon","Checkbox","InfoModal","UseExistingIfFoundInfoIcon","isModalOpen","toggleModal","InfoTooltip","ShortUrlFormCheckboxGroup","infoTooltip","normalizeTag","toDate","dynamicColClasses","TagsSelector","DomainSelector","shortUrlData","setShortUrlData","isEdit","isBasicMode","hadTitleOriginally","resolveNewTitle","hasNewTitle","matcher","submit","renderOptionalInput","fromGroupProps","renderDateInput","basicComponents","bsSize","required","showCustomizeCard","limitAccessCardClasses","showCrawlableControl","showForwardQueryControl","showBehaviorCard","extraChecksCardClasses","crawlable","shortUrlDetail","getShortUrlDetail","shortUrlEdition","goBack","savingError","savingErrorData","savingSucceeded","isSuccessful","isNotSuccessful","faArrowLeft","GET_SHORT_URL_DETAIL_START","GET_SHORT_URL_DETAIL_ERROR","GET_SHORT_URL_DETAIL","LabeledFormGroup","label","labelClassName","noMargin","InputFormGroup","ServerForm","initialValues","setName","setUrl","setApiKey","handleSubmit","DuplicatedServersModal","duplicatedServers","onDiscard","hasMultipleServers","ImportResult","CreateServer","ImportServersBtn","createServer","serversImported","setServersImported","errorImporting","setErrorImporting","isConfirmModalOpen","toggleConfirmModal","serverData","setServerData","save","NoMenuLayout","tooltipPlacement","onImport","onImportError","nav","inNavbar","serverIcon","plusIcon","DeleteServerModal","deleteServer","redirectHome","showModal","hideModal","EditServer","editServer","serversFiltering","importServersFromFile","createServers","fileRef","serversToCreate","setServersToCreate","setDuplicatedServers","create","createAllServers","createNonDuplicatedServers","complement","onFile","files","existingServers","hasDuplicatedServers","click","importIcon","accept","SELECT_SERVER","RESET_SELECTED_SERVER","toSemVer","getServerVersion","memoizeWith","_serverId","resetSelectedServer","serverNotFound","serverNotReachable","EDIT_SERVER","DELETE_SERVER","CREATE_SERVERS","SET_AUTO_CONNECT","newServers","fromPairs","evaluatedServerId","serversListToMap","reduce","acc","setAutoConnect","responseToServersList","Array","isArray","fetchServers","homepage","remoteList","maxVersion","HighlightCard","link","buildExtraProps","linkIcon","loadVisitsOverview","visitsOverview","loadingTags","loadingVisits","orphanVisitsCount","linkToOrphanVisits","linkToNonOrphanVisits","itemsPerPage","encodeURIComponent","ManageServers","serversExporter","ManageServersRow","allServers","setServersList","hasAutoConnect","exportServers","exportIcon","width","ManageServersRowDropdown","checkIcon","isMenuOpen","toggleMenu","serverUrl","isAutoConnect","autoConnectIcon","toggleOffIcon","toggleOnIcon","connectIcon","validateServer","validateServers","every","ServersImporter","csvJson","fileReaderFactory","file","reader","resolve","addEventListener","content","toString","toObject","readAsText","ServersExporter","csvjson","csv","toCSV","saveCsv","FileReader","OpenStreetMapTile","TileLayer","attribution","calculateMapProps","locations","bounds","zoom","center","latLong","MapModal","contentClassName","MapContainer","cityName","count","Marker","position","Popup","VisitsHeader","ShortUrlVisitsHeader","shortLink","longLink","visitsStatsTitle","NavPillItem","RouterNavLink","NavPills","pills","Children","child","isValidElement","DEFAULT","BROWSERS_WHITELIST","extractDomain","includes","fillTheGaps","labels","zipObj","pointerOnHover","native","firstElement","renderChartLabel","dataset","formattedValue","renderPieChartLabel","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","tension","borderColor","selectedLabel","chartElementAtEvent","datasetsByPoint","setSelectedVisits","chart","LineChartCard","highlightedVisits","highlightedLabel","oldestVisitDate","now","always","determineInitialStep","setStep","skipNoVisits","toggleSkipNoVisits","visitsToDatasetGroups","reverse","groupedVisits","groupedHighlighted","generateChartDatasets","mainDataset","maintainAspectRatio","plugins","legend","intersect","axis","callbacks","scales","y","beginAtZero","ticks","precision","x","onHover","renderLineChart","datasets","getElementAtEvent","entries","menuText","SimplePaginator","setCurrentPage","searchVisits","browser","os","referer","country","city","visitedUrl","visitMatchesSearch","calculateVisits","allVisits","sortedVisits","sortVisits","total","visitsGroups","splitEvery","VisitsTable","selectedVisits","matchMedia","isOrphanVisits","headerCellsClass","matchMobile","matches","isMobileDevice","setIsMobileDevice","setOrder","resultSet","setPage","supportsBots","fullSizeColSpan","listener","removeEventListener","flat","botIcon","isSelected","v","potentialBot","OpenMapModalBtn","modalTitle","activeCities","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","DoughnutChartLegend","config","defaultColor","borderWidth","DoughnutChart","memo","chartRef","setChartRef","chartData","generateChartData","height","ChartCard","footer","DoughnutChartCard","PaginationDropdown","toggleClassName","ranges","Infinity","dropLabelIfHidden","highlightedData","HorizontalBarChart","highlightedStats","statsAreDefined","highlightedKey","stacked","indexAxis","determineHeight","renderChartComponent","customKey","toLowerIfString","toLower","pickKeyFromPair","pickValueFromPair","SortableBarChartCard","sortingItems","extraHeaderContent","withPagination","setItemsPerPage","determineCurrentPagePairs","firstPageLength","i","sortedPairs","pairs","sortBy","getSortedPairsForStats","sortedKeys","sortedHighlightedPairs","currentPageStats","currentPageHighlightedStats","highlightedPages","determineStats","sections","byTime","subPath","faCalendarAlt","byContext","faChartPie","byLocation","faMapMarkedAlt","faList","VisitsStats","visitsInfo","getVisits","cancelGetVisits","exportCsv","loadingLarge","progress","fallbackInterval","initialInterval","setInitialInterval","setDateRange","setHighlightedVisits","setHighlightedLabel","visitsFilter","setVisitsFilter","buildSectionUrl","normalizedVisits","mapLocations","highlightVisitsForProp","newSelectedBar","propEq","faFileDownload","striped","amount","exportVisits","cancelGetShortUrlVisits","doIntervalFallback","TagVisitsHeader","tagVisits","cancelGetTagVisits","OrphanVisitsHeader","cancelGetOrphanVisits","NonOrphanVisitsHeader","nonOrphanVisits","cancelGetNonOrphanVisits","ITEMS_PER_PAGE","isLastPage","calcProgress","getVisitsWithLoader","visitsLoader","lastVisitLoader","extraFinishActionData","actionMap","shouldCancel","loadVisitsInParallel","flatten","loadPagesBlocks","pagesBlocks","concat","loadVisits","pagesRange","fallbackToInterval","finish","lastVisitLoaderForLoader","loader","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","GET_SHORT_URL_VISITS_FALLBACK_TO_INTERVAL","cancelLoad","newVisits","GET_TAG_VISITS_START","GET_TAG_VISITS_ERROR","GET_TAG_VISITS","GET_TAG_VISITS_LARGE","GET_TAG_VISITS_CANCEL","GET_TAG_VISITS_PROGRESS_CHANGED","GET_TAG_VISITS_FALLBACK_TO_INTERVAL","GET_ORPHAN_VISITS_START","GET_ORPHAN_VISITS_ERROR","GET_ORPHAN_VISITS","GET_ORPHAN_VISITS_LARGE","GET_ORPHAN_VISITS_CANCEL","GET_ORPHAN_VISITS_PROGRESS_CHANGED","GET_ORPHAN_VISITS_FALLBACK_TO_INTERVAL","matchesType","GET_NON_ORPHAN_VISITS_START","GET_NON_ORPHAN_VISITS_ERROR","GET_NON_ORPHAN_VISITS","GET_NON_ORPHAN_VISITS_LARGE","GET_NON_ORPHAN_VISITS_CANCEL","GET_NON_ORPHAN_VISITS_PROGRESS_CHANGED","GET_NON_ORPHAN_VISITS_FALLBACK_TO_INTERVAL","GET_OVERVIEW_START","GET_OVERVIEW_ERROR","GET_OVERVIEW","VisitsExporter","visitsParser","TagBullet","toComponentTag","searchMode","tagFilteringMode","tagComponent","onDelete","suggestions","suggestionComponent","allowNew","addOnBlur","minQueryLength","delimiters","suggestionsTransform","removedTagIndex","tagsCopy","splice","onAddition","TagCard","DeleteTagConfirmModal","EditTagModal","displayed","isEditModalOpen","toggleEdit","hasTitle","displayTitle","titleRef","scrollWidth","clientWidth","faLink","faEye","deleteTag","tagDelete","tagDeleted","deleting","doDelete","tagEdited","tagEdit","newTagName","setNewTagName","setColor","showColorPicker","toggleColorPicker","hideColorPicker","editing","saveTag","onClosed","colorIcon","hideArrow","popperClassName","TAGS_ORDERABLE_FIELDS","TagsModeDropdown","renderTitle","cardsIcon","TagsCards","TagsTable","filterTags","forceListTags","defaultMode","setMode","resolveSortedTags","filteredTags","shortUrlsCount","normalizedTags","sortedTags","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","tagStats","stateTags","displayedTag","setDisplayedTag","tagsCount","tagsGroups","group","TagsTableRow","pageFromQuery","showPaginator","isDropdownOpen","listTagsActionFactory","force","processedStats","factory","GET_MERCURE_INFO_START","GET_MERCURE_INFO_ERROR","GET_MERCURE_INFO","info","FormText","RealTimeUpdatesSettings","SettingsSections","Settings","RealTimeUpdates","ShortUrlCreation","UserInterface","Visits","Tags","tagFilteringModeText","ShortUrlCreationSettings","changeTagsFilteringMode","UserInterfaceSettings","faMoon","faSun","useDarkTheme","DateIntervalSelector","VisitsSettings","TagsSettings","ShortUrlsListSettings","replaceAuthorityFromUri","uri","newAuthority","schema","pathParts","normalizedPath","EDIT_DOMAIN_REDIRECTS","redirects","LIST_DOMAINS_START","LIST_DOMAINS_ERROR","LIST_DOMAINS","FILTER_DOMAINS","VALIDATE_DOMAIN","filteredDomains","replaceRedirectsOnDomain","replaceStatusOnDomain","defaultRedirects","filterDomains","checkDomainHealth","domainsList","inputDisplayed","showInput","hideInput","valueIsEmpty","unselectDomain","faUndo","trigger","isDefault","FormGroup","isLast","EditDomainRedirectsModal","baseUrlRedirect","setBaseUrlRedirect","regular404Redirect","setRegular404Redirect","invalidShortUrlRedirect","setInvalidShortUrlRedirect","DomainStatusIcon","matchesMobile","isMobile","setIsMobile","loadingStatusIcon","invalidIcon","autohide","Nr","fallback","DefaultDomain","defaultDomainIcon","DomainRow","authority","canEditDomain","forbiddenIcon","resolvedDefaultRedirects","column","APP_UPDATE_AVAILABLE","RESET_APP_UPDATE","appUpdateAvailable","resetAppUpdate","AppUpdateBanner","forceUpdate","isUpdating","setUpdating","reloadIcon","navigator","serviceWorker","getRegistrations","registrations","registration","waiting","postMessage","App","appUpdated","isHome","Bottle","container","mapActionService","actionName","serviceName","lazyService","propsFromState","actionServiceNames","reduxConnect","provideAppServices","provideCommonServices","provideApiServices","provideShortUrlsServices","provideServersServices","provideTagsServices","provideVisitsServices","provideUtilsServices","provideMercureServices","provideSettingsServices","provideDomainsServices","combineReducers","serversReducer","selectedServerReducer","shortUrlsListReducer","shortUrlCreationReducer","shortUrlDeletionReducer","shortUrlEditionReducer","shortUrlVisitsReducer","tagVisitsReducer","orphanVisitsReducer","nonOrphanVisitsReducer","shortUrlDetailReducer","tagsListReducer","tagDeleteReducer","tagEditReducer","mercureInfoReducer","settingsReducer","domainsListReducer","visitsOverviewReducer","appUpdatesReducer","composeEnhancers","__REDUX_DEVTOOLS_EXTENSION_COMPOSE__","compose","localStorageConfig","states","namespace","namespaceSeparator","debounce","preloadedState","migrateDeprecatedSettings","load","store","createStore","reducers","applyMiddleware","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","render","basename","getElementById","process","origin","fetch","contentType","indexOf","ready","unregister","checkValidServiceWorker","registerServiceWorker","versionToMatch","matchesMinVersion","compare","versionIsValidSemVer","defaultValue","createElement","visibility","appendChild","removeChild","blob","Blob"],"mappings":"iLAAA,qDAOaA,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,uiBAEJ,sBACEA,EAAE,8X,4HCTH,SAASC,EAA2BC,EAAmDC,GAC5F,OAAO,SAACC,GACN,IAAMC,EAASC,cACPC,EAAiCH,EAAjCG,aAAcC,EAAmBJ,EAAnBI,eAMtB,OAJAC,qBAAU,WACRJ,EAAOK,UAAYH,EAAaF,EAAOK,YACtC,CAAEL,EAAOK,WAEPF,EAQDG,YAAiBH,GACZ,cAACL,EAAD,IAGF,cAACD,EAAD,eAAsBE,IAVzB,cAAC,IAAD,UACE,cAAC,IAAD,CAASQ,SAAO,S,iCCtB1B,2BAqBeC,IAdqB,SAAC,GAAD,QAAGC,UAAH,MAAQ,IAAR,MAAaC,gBAAb,MAAwB,OAAxB,SAClC,qBAAKpB,UAAU,OAAf,SACE,eAAC,IAAD,CAAYA,UAAU,MAAtB,UACE,0EACA,iJAIA,uBACA,cAAC,IAAD,CAAMmB,GAAIA,EAAInB,UAAU,iCAAxB,SAA0DoB,W,2FCH1DC,EAAiB,SAAC,GAAD,IAAGC,EAAH,EAAGA,GAAIC,EAAP,EAAOA,KAAP,OACrB,eAAC,IAAD,CAAeC,IAAKC,IAAMN,GAAE,kBAAaG,GAAMtB,UAAU,4BAAzD,UACGuB,EACD,cAAC,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esContent":["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 { useParams } from 'react-router-dom';\nimport Message from '../../utils/Message';\nimport { isNotFoundServer, SelectedServer } from '../data';\nimport { NoMenuLayout } from '../../common/NoMenuLayout';\n\ninterface WithSelectedServerProps {\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 params = useParams<{ serverId: string }>();\n const { selectServer, selectedServer } = props;\n\n useEffect(() => {\n params.serverId && selectServer(params.serverId);\n }, [ 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, EffectCallback, DependencyList, useEffect } from 'react';\nimport { useSwipeable as useReactSwipeable } from 'react-swipeable';\nimport { useNavigate } from 'react-router-dom';\nimport { parseQuery, stringifyQuery } from './query';\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\nexport const useQueryState = <T>(paramName: string, initialState: T): [ T, (newValue: T) => void ] => {\n const [ value, setValue ] = useState(initialState);\n const setValueWithLocation = (value: T) => {\n const { location, history } = window;\n const query = parseQuery<any>(location.search);\n\n query[paramName] = value;\n history.pushState(null, '', `${location.pathname}?${stringifyQuery(query)}`);\n setValue(value);\n };\n\n return [ value, setValueWithLocation ];\n};\n\nexport const useEffectExceptFirstTime = (callback: EffectCallback, deps: DependencyList): void => {\n const isFirstLoad = useRef(true);\n\n useEffect(() => {\n !isFirstLoad.current && callback();\n isFirstLoad.current = false;\n }, deps);\n};\n\nexport const useGoBack = () => {\n const navigate = useNavigate();\n\n return () => navigate(-1);\n};\n","import axios from 'axios';\nimport Bottle 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';\nimport { ImageDownloader } from './ImageDownloader';\n\nconst provideServices = (bottle: Bottle, connect: ConnectDecorator) => {\n // Services\n bottle.constant('window', (global as any).window);\n bottle.constant('console', global.console);\n bottle.constant('axios', axios);\n\n bottle.service('ImageDownloader', ImageDownloader, 'axios', 'window');\n\n // Components\n bottle.serviceFactory('ScrollToTop', ScrollToTop);\n\n bottle.serviceFactory('MainHeader', MainHeader, 'ServersDropdown');\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 'ShortUrlsList',\n 'AsideMenu',\n 'CreateShortUrl',\n 'ShortUrlVisits',\n 'TagVisits',\n 'OrphanVisits',\n 'NonOrphanVisits',\n 'ServerError',\n 'Overview',\n 'EditShortUrl',\n 'ManageDomains',\n );\n bottle.decorator('MenuLayout', connect([ 'selectedServer' ], [ 'selectServer' ]));\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 { FC, useEffect } from 'react';\nimport { useLocation } from 'react-router-dom';\n\nconst ScrollToTop = (): FC => ({ children }) => {\n const location = useLocation();\n\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 { AxiosInstance } from 'axios';\nimport { saveUrl } from '../../utils/helpers/files';\n\nexport class ImageDownloader {\n public constructor(private readonly axios: AxiosInstance, private readonly window: Window) {}\n\n public async saveImage(imgUrl: string, filename: string): Promise<void> {\n const { data } = await this.axios.get(imgUrl, { responseType: 'blob' });\n const url = URL.createObjectURL(data);\n\n saveUrl(this.window, url, filename);\n }\n}\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 { isNil } from 'ramda';\nimport { rangeOf } from '../utils';\nimport LocalStorage from './LocalStorage';\n\nconst HEX_COLOR_LENGTH = 6;\nconst HEX_DIGITS = '0123456789ABCDEF';\nconst LIGHTNESS_BREAKPOINT = 128;\n\nconst { floor, random, sqrt, round } = Math;\nconst buildRandomColor = () =>\n `#${rangeOf(HEX_COLOR_LENGTH, () => HEX_DIGITS[floor(random() * HEX_DIGITS.length)]).join('')}`;\nconst normalizeKey = (key: string) => key.toLowerCase().trim();\nconst hexColorToRgbArray = (colorHex: string): number[] =>\n (colorHex.match(/../g) ?? []).map((hex) => parseInt(hex, 16) || 0);\n// HSP by Darel Rex Finley https://alienryderflex.com/hsp.html\nconst perceivedLightness = (r = 0, g = 0, b = 0) => round(sqrt(0.299 * r ** 2 + 0.587 * g ** 2 + 0.114 * b ** 2));\n\nexport default class ColorGenerator {\n private readonly colors: Record<string, string>;\n private readonly lights: Record<string, boolean>;\n\n public constructor(private readonly storage: LocalStorage) {\n this.colors = this.storage.get<Record<string, string>>('colors') ?? {};\n this.lights = {};\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 public readonly isColorLightForKey = (key: string): boolean => {\n const colorHex = this.getColorForKey(key).substring(1);\n\n if (isNil(this.lights[colorHex])) {\n const rgb = hexColorToRgbArray(colorHex);\n\n this.lights[colorHex] = perceivedLightness(...rgb) >= LIGHTNESS_BREAKPOINT;\n }\n\n return this.lights[colorHex];\n };\n}\n","import { omit } from 'ramda';\nimport { 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 autoConnect?: boolean;\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\nexport const getServerId = (server: SelectedServer) => isServerWithId(server) ? server.id : '';\n\nexport const serverWithIdToServerData = (server: ServerWithId): ServerData =>\n omit<ServerWithId, 'id' | 'autoConnect'>([ 'id', 'autoConnect' ], server);\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, useLocation } from 'react-router-dom';\nimport { Collapse, Nav, Navbar, NavbarBrand, NavbarToggler, NavItem, NavLink } from 'reactstrap';\nimport classNames from 'classnames';\nimport { useToggle } from '../utils/helpers/hooks';\nimport { ShlinkLogo } from './img/ShlinkLogo';\nimport './MainHeader.scss';\n\nconst MainHeader = (ServersDropdown: FC) => () => {\n const [ isOpen, toggleOpen, , close ] = useToggle();\n const location = useLocation();\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=\"ms-auto\">\n <NavItem>\n <NavLink tag={Link} to={settingsPath} active={pathname.startsWith(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 { useEffect } from 'react';\nimport { isEmpty, values } from 'ramda';\nimport { Link, useNavigate } 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 navigate = useNavigate();\n const serversList = values(servers);\n const hasServers = !isEmpty(serversList);\n\n useEffect(() => {\n // Try to redirect to the first server marked as auto-connect\n const autoConnectServer = serversList.find(({ autoConnect }) => autoConnect);\n\n autoConnectServer && navigate(`/server/${autoConnectServer.id}`);\n }, []);\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=\"home__logo-wrapper\">\n <div className=\"home__logo\">\n <ShlinkLogo />\n </div>\n </div>\n </div>\n <div className=\"col-md-7 home__servers-container\">\n <div className=\"home__title-wrapper\">\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 me-2\">\n <FontAwesomeIcon icon={faPlus} /> <span className=\"ms-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=\"me-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 { Navigate, Route, Routes, useLocation } 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 { supportsDomainRedirects, supportsNonOrphanVisits, supportsOrphanVisits } 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 ShortUrlsList: FC,\n AsideMenu: FC<AsideMenuProps>,\n CreateShortUrl: FC,\n ShortUrlVisits: FC,\n TagVisits: FC,\n OrphanVisits: FC,\n NonOrphanVisits: FC,\n ServerError: FC,\n Overview: FC,\n EditShortUrl: FC,\n ManageDomains: FC,\n) => withSelectedServer(({ selectedServer }) => {\n const location = useLocation();\n const [ sidebarVisible, toggleSidebar, showSidebar, hideSidebar ] = useToggle();\n\n useEffect(() => hideSidebar(), [ location ]);\n\n if (!isReachableServer(selectedServer)) {\n return <ServerError />;\n }\n\n const addOrphanVisitsRoute = supportsOrphanVisits(selectedServer);\n const addNonOrphanVisitsRoute = supportsNonOrphanVisits(selectedServer);\n const addManageDomainsRoute = supportsDomainRedirects(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 <Routes>\n <Route index element={<Navigate replace to=\"overview\" />} />\n <Route path=\"/overview\" element={<Overview />} />\n <Route path=\"/list-short-urls/:page\" element={<ShortUrlsList />} />\n <Route path=\"/create-short-url\" element={<CreateShortUrl />} />\n <Route path=\"/short-code/:shortCode/visits/*\" element={<ShortUrlVisits />} />\n <Route path=\"/short-code/:shortCode/edit\" element={<EditShortUrl />} />\n <Route path=\"/tag/:tag/visits/*\" element={<TagVisits />} />\n {addOrphanVisitsRoute && <Route path=\"/orphan-visits/*\" element={<OrphanVisits />} />}\n {addNonOrphanVisitsRoute && <Route path=\"/non-orphan-visits/*\" element={<NonOrphanVisits />} />}\n <Route path=\"/manage-tags\" element={<TagsList />} />\n {addManageDomainsRoute && <Route path=\"/manage-domains\" element={<ManageDomains />} />}\n <Route\n path=\"*\"\n element={<NotFound to={`/server/${selectedServer.id}/list-short-urls/1`}>List short URLs</NotFound>}\n />\n </Routes>\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 faGlobe as domainsIcon,\n} from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { FC } from 'react';\nimport { NavLink, NavLinkProps, useLocation } from 'react-router-dom';\nimport classNames from 'classnames';\nimport { DeleteServerButtonProps } from '../servers/DeleteServerButton';\nimport { isServerWithId, SelectedServer } from '../servers/data';\nimport { supportsDomainRedirects } from '../utils/helpers/features';\nimport './AsideMenu.scss';\n\nexport interface AsideMenuProps {\n selectedServer: SelectedServer;\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={({ isActive }) => classNames('aside-menu__item', className, { 'aside-menu__item--selected': isActive })}\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 hasId = isServerWithId(selectedServer);\n const serverId = hasId ? selectedServer.id : '';\n const { pathname } = useLocation();\n const addManageDomainsLink = supportsDomainRedirects(selectedServer);\n const asideClass = classNames('aside-menu', {\n 'aside-menu--hidden': !showOnMobile,\n });\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 fixedWidth icon={overviewIcon} />\n <span className=\"aside-menu__item-text\">Overview</span>\n </AsideMenuItem>\n <AsideMenuItem\n to={buildPath('/list-short-urls/1')}\n className={classNames({ 'aside-menu__item--selected': pathname.match('/list-short-urls') !== null })}\n >\n <FontAwesomeIcon fixedWidth icon={listIcon} />\n <span className=\"aside-menu__item-text\">List short URLs</span>\n </AsideMenuItem>\n <AsideMenuItem to={buildPath('/create-short-url')}>\n <FontAwesomeIcon fixedWidth 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 fixedWidth icon={tagsIcon} />\n <span className=\"aside-menu__item-text\">Manage tags</span>\n </AsideMenuItem>\n {addManageDomainsLink && (\n <AsideMenuItem to={buildPath('/manage-domains')}>\n <FontAwesomeIcon fixedWidth icon={domainsIcon} />\n <span className=\"aside-menu__item-text\">Manage domains</span>\n </AsideMenuItem>\n )}\n <AsideMenuItem to={buildPath('/edit')} className=\"aside-menu__item--push\">\n <FontAwesomeIcon fixedWidth icon={editIcon} />\n <span className=\"aside-menu__item-text\">Edit this server</span>\n </AsideMenuItem>\n {hasId && (\n <DeleteServerButton\n className=\"aside-menu__item aside-menu__item--danger\"\n textClassName=\"aside-menu__item-text\"\n server={selectedServer}\n />\n )}\n </nav>\n </aside>\n );\n};\n\nexport default AsideMenu;\n","import { isEmpty, isNil, pipe, range } from 'ramda';\nimport { SyntheticEvent } from 'react';\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\nexport const nonEmptyValueOrNull = <T>(value: T): T | null => isEmpty(value) ? null : value;\n\nexport const capitalize = <T extends string>(value: T): string => `${value.charAt(0).toUpperCase()}${value.slice(1)}`;\n","import { Card, CardBody, CardHeader, CardProps } 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 { 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 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\nexport const supportsQrErrorCorrection = serverMatchesVersions({ minVersion: '2.8.0' });\n\nexport const supportsDomainRedirects = supportsQrErrorCorrection;\n\nexport const supportsForwardQuery = serverMatchesVersions({ minVersion: '2.9.0' });\n\nexport const supportsDefaultDomainRedirectsEdition = serverMatchesVersions({ minVersion: '2.10.0' });\n\nexport const supportsNonOrphanVisits = serverMatchesVersions({ minVersion: '3.0.0' });\n\nexport const supportsAllTagsFiltering = supportsNonOrphanVisits;\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 document.getElementsByTagName('html')?.[0]?.setAttribute('data-theme', theme);\n\nexport const isDarkThemeEnabled = (): boolean =>\n document.getElementsByTagName('html')?.[0]?.getAttribute('data-theme') === 'dark';\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","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=\"ms-2\">{children ?? 'Loading...'}</span>}\n {!loading && children}\n </h3>\n </Card>\n </div>\n </Row>\n );\n};\n\nexport default Message;\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 large?: boolean;\n noBorder?: boolean;\n initialValue?: string;\n}\n\nconst SearchField = ({ onChange, className, large = true, noBorder = false, initialValue = '' }: SearchFieldProps) => {\n const [ searchTerm, setSearchTerm ] = useState(initialValue);\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=\"Search...\"\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","export type OrderDir = 'ASC' | 'DESC' | undefined;\n\nexport interface Order<Fields> {\n field?: Fields;\n dir?: OrderDir;\n}\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 sortList = <List>(list: List[], { field, dir }: Order<Partial<keyof List>>) => !field || !dir\n ? list\n : list.sort((a, b) => {\n const greaterThan = dir === 'ASC' ? 1 : -1;\n const smallerThan = dir === 'ASC' ? -1 : 1;\n\n return a[field] > b[field] ? greaterThan : smallerThan;\n });\n\nexport const orderToString = <T>(order: Order<T>): string | undefined =>\n order.dir ? `${order.field}-${order.dir}` : undefined;\n\nexport const stringToOrder = <T>(order: string): Order<T> => {\n const [ field, dir ] = order.split('-') as [ T | undefined, OrderDir | undefined ];\n\n return { field, dir };\n};\n","import { isEmpty, isNil, reject } from 'ramda';\nimport { AxiosInstance, AxiosResponse, Method } from 'axios';\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 ShlinkDomainsResponse,\n ShlinkVisitsOverview,\n ShlinkEditDomainRedirects,\n ShlinkDomainRedirects,\n ShlinkShortUrlsListParams,\n ShlinkShortUrlsListNormalizedParams,\n} from '../types';\nimport { stringifyQuery } from '../../utils/helpers/query';\nimport { orderToString } from '../../utils/helpers/ordering';\n\nconst buildShlinkBaseUrl = (url: string) => url ? `${url}/rest/v2` : '';\nconst rejectNilProps = reject(isNil);\nconst normalizeOrderByInParams = (params: ShlinkShortUrlsListParams): ShlinkShortUrlsListNormalizedParams => {\n const { orderBy = {}, ...rest } = params;\n\n return { ...rest, orderBy: orderToString(orderBy) };\n};\n\nexport default class ShlinkApiClient {\n public constructor(\n private readonly axios: AxiosInstance,\n private readonly baseUrl: string,\n private readonly apiKey: string,\n ) {\n }\n\n public readonly listShortUrls = async (params: ShlinkShortUrlsListParams = {}): Promise<ShlinkShortUrlsResponse> =>\n this.performRequest<{ shortUrls: ShlinkShortUrlsResponse }>('/short-urls', 'GET', normalizeOrderByInParams(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 getNonOrphanVisits = async (query?: Omit<ShlinkVisitsParams, 'domain'>): Promise<ShlinkVisits> =>\n this.performRequest<{ visits: ShlinkVisits }>('/visits/non-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 // eslint-disable-next-line valid-jsdoc\n /**\n * @deprecated. If using Shlink 2.6.0 or greater, use updateShortUrl instead\n */\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<ShlinkDomainsResponse> =>\n this.performRequest<{ domains: ShlinkDomainsResponse }>('/domains', 'GET').then(({ data }) => data.domains);\n\n public readonly editDomainRedirects = async (\n domainRedirects: ShlinkEditDomainRedirects,\n ): Promise<ShlinkDomainRedirects> =>\n this.performRequest<ShlinkDomainRedirects>('/domains/redirects', 'PATCH', {}, domainRedirects).then(({ data }) => data);\n\n private readonly performRequest = async <T>(url: string, method: Method = 'GET', query = {}, body = {}): Promise<AxiosResponse<T>> =>\n this.axios({\n method,\n url: `${buildShlinkBaseUrl(this.baseUrl)}${url}`,\n headers: { 'X-Api-Key': this.apiKey },\n params: rejectNilProps(query),\n data: body,\n paramsSerializer: stringifyQuery,\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, MouseEventHandler } from 'react';\nimport classNames from 'classnames';\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={classNames('badge tag', className, { 'tag--light-bg': colorGenerator.isColorLightForKey(text) })}\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, isBefore, isEqual, isWithinInterval, parse, parseISO as stdParseISO } from 'date-fns';\nimport { OptionalString } from '../utils';\n\nexport type DateOrString = Date | string;\n\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\nexport const parseISO = (date: DateOrString): Date => isDateObject(date) ? date : stdParseISO(date);\n\nexport const isBetween = (date: DateOrString, start?: DateOrString, end?: DateOrString): boolean => {\n try {\n return isWithinInterval(parseISO(date), { start: parseISO(start ?? date), end: parseISO(end ?? date) });\n } catch (e) {\n return false;\n }\n};\n\nexport const isBeforeOrEqual = (date: Date | number, dateToCompare: Date | number) =>\n isEqual(date, dateToCompare) || isBefore(date, dateToCompare);\n","import { subDays, startOfDay, endOfDay } from 'date-fns';\nimport { cond, filter, isEmpty, T } from 'ramda';\nimport { DateOrString, formatInternational, isBeforeOrEqual, parseISO } from '../../helpers/date';\n\nexport interface DateRange {\n startDate?: Date | null;\n endDate?: Date | null;\n}\n\nexport type DateInterval = 'all' | '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 =>\n typeof range === 'string';\n\nconst INTERVAL_TO_STRING_MAP: Record<DateInterval, string | undefined> = {\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 all: undefined,\n};\n\nexport const DATE_INTERVALS = Object.keys(INTERVAL_TO_STRING_MAP).filter((value) => value !== 'all') 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 || range === 'all') {\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));\nconst endingToday = (startDate: Date): DateRange => ({ startDate, endDate: endOfDay(new Date()) });\n\nexport const intervalToDateRange = (dateInterval?: DateInterval): DateRange => {\n if (!dateInterval || dateInterval === 'all') {\n return {};\n }\n\n switch (dateInterval) {\n case 'today':\n return endingToday(startOfDay(new Date()));\n case 'yesterday':\n return { startDate: startOfDaysAgo(1), endDate: endOfDay(subDays(new Date(), 1)) };\n case 'last7Days':\n return endingToday(startOfDaysAgo(7));\n case 'last30Days':\n return endingToday(startOfDaysAgo(30));\n case 'last90Days':\n return endingToday(startOfDaysAgo(90));\n case 'last180Days':\n return endingToday(startOfDaysAgo(180));\n case 'last365Days':\n return endingToday(startOfDaysAgo(365));\n }\n\n return {};\n};\n\nexport const dateToMatchingInterval = (date: DateOrString): DateInterval => {\n const theDate: Date = parseISO(date);\n\n return cond<never, DateInterval>([\n [ () => isBeforeOrEqual(startOfDay(new Date()), theDate), () => 'today' ],\n [ () => isBeforeOrEqual(startOfDaysAgo(1), theDate), () => 'yesterday' ],\n [ () => isBeforeOrEqual(startOfDaysAgo(7), theDate), () => 'last7Days' ],\n [ () => isBeforeOrEqual(startOfDaysAgo(30), theDate), () => 'last30Days' ],\n [ () => isBeforeOrEqual(startOfDaysAgo(90), theDate), () => 'last90Days' ],\n [ () => isBeforeOrEqual(startOfDaysAgo(180), theDate), () => 'last180Days' ],\n [ () => isBeforeOrEqual(startOfDaysAgo(365), theDate), () => 'last365Days' ],\n [ T, () => 'all' ],\n ])();\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 allText: string;\n onChange: (interval: DateInterval) => void;\n}\n\nexport const DateIntervalDropdownItems: FC<DateIntervalDropdownProps> = ({ active, allText, onChange }) => (\n <>\n <DropdownItem active={active === 'all'} onClick={() => onChange('all')}>\n {allText}\n </DropdownItem>\n <DropdownItem divider />\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 { useEffectExceptFirstTime } from '../helpers/hooks';\nimport {\n DateInterval,\n DateRange,\n rangeOrIntervalToString,\n intervalToDateRange,\n rangeIsInterval,\n dateRangeIsEmpty,\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 updatable?: boolean;\n}\n\nexport const DateRangeSelector = (\n { onDatesChange, initialDateRange, defaultText, disabled, updatable = false }: DateRangeSelectorProps,\n) => {\n const initialIntervalIsRange = rangeIsInterval(initialDateRange);\n const [ activeInterval, setActiveInterval ] = useState(initialIntervalIsRange ? initialDateRange : undefined);\n const [ activeDateRange, setActiveDateRange ] = useState(initialIntervalIsRange ? undefined : initialDateRange);\n\n const updateDateRange = (dateRange: DateRange) => {\n setActiveInterval(dateRangeIsEmpty(dateRange) ? 'all' : 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 updatable && useEffectExceptFirstTime(() => {\n const isDateInterval = rangeIsInterval(initialDateRange);\n\n isDateInterval && updateInterval(initialDateRange);\n initialDateRange && !isDateInterval && updateDateRange(initialDateRange);\n }, [ initialDateRange ]);\n\n return (\n <DropdownBtn disabled={disabled} text={rangeOrIntervalToString(activeInterval ?? activeDateRange) ?? defaultText}>\n <DateIntervalDropdownItems allText={defaultText} active={activeInterval} onChange={updateInterval} />\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 { 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 'form-switch': type === 'switch',\n 'form-checkbox': type === 'checkbox',\n };\n const style = inline ? { display: 'inline-block' } : {};\n\n return (\n <span className={classNames('form-check', typeClasses, className)} style={style}>\n <input type=\"checkbox\" className=\"form-check-input\" id={id} checked={checked} onChange={onChecked} />\n <label className=\"form-check-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 ToggleSwitch: FC<BooleanControlProps> = (props) => <BooleanControl type=\"switch\" {...props} />;\n\nexport default ToggleSwitch;\n","import { FC, useRef } from 'react';\nimport { UncontrolledTooltip, UncontrolledTooltipProps } from 'reactstrap';\nimport { BooleanControlProps } from './BooleanControl';\nimport ToggleSwitch from './ToggleSwitch';\n\nexport type TooltipToggleSwitchProps = BooleanControlProps & { tooltip?: Omit<UncontrolledTooltipProps, 'target'> };\n\nexport const TooltipToggleSwitch: FC<TooltipToggleSwitchProps> = ({ children, tooltip = {}, ...rest }) => {\n const ref = useRef<HTMLSpanElement>();\n\n return (\n <>\n <span\n ref={(el) => {\n ref.current = el ?? undefined;\n }}\n >\n <ToggleSwitch {...rest} />\n </span>\n <UncontrolledTooltip target={(() => ref.current) as any} {...tooltip}>{children}</UncontrolledTooltip>\n </>\n );\n};\n","import { useParams, useLocation, useNavigate } from 'react-router-dom';\nimport { useMemo } from 'react';\nimport { isEmpty, pipe } from 'ramda';\nimport { parseQuery, stringifyQuery } from '../../utils/helpers/query';\nimport { ShortUrlsOrder, ShortUrlsOrderableFields } from '../data';\nimport { orderToString, stringToOrder } from '../../utils/helpers/ordering';\nimport { TagsFilteringMode } from '../../api/types';\n\ntype ToFirstPage = (extra: Partial<ShortUrlsFiltering>) => void;\n\nexport interface ShortUrlListRouteParams {\n page: string;\n serverId: string;\n}\n\ninterface ShortUrlsQueryCommon {\n tags?: string;\n search?: string;\n startDate?: string;\n endDate?: string;\n tagsMode?: TagsFilteringMode;\n}\n\ninterface ShortUrlsQuery extends ShortUrlsQueryCommon {\n orderBy?: string;\n}\n\ninterface ShortUrlsFiltering extends ShortUrlsQueryCommon {\n orderBy?: ShortUrlsOrder;\n}\n\nexport const useShortUrlsQuery = (): [ShortUrlsFiltering, ToFirstPage] => {\n const navigate = useNavigate();\n const location = useLocation();\n const params = useParams<{ serverId: string }>();\n\n const query = useMemo(\n pipe(\n () => parseQuery<ShortUrlsQuery>(location.search),\n ({ orderBy, ...rest }: ShortUrlsQuery): ShortUrlsFiltering => !orderBy ? rest : {\n ...rest,\n orderBy: stringToOrder<ShortUrlsOrderableFields>(orderBy),\n },\n ),\n [ location.search ],\n );\n const toFirstPageWithExtra = (extra: Partial<ShortUrlsFiltering>) => {\n const { orderBy, ...mergedQuery } = { ...query, ...extra };\n const normalizedQuery: ShortUrlsQuery = { ...mergedQuery, orderBy: orderBy && orderToString(orderBy) };\n const evolvedQuery = stringifyQuery(normalizedQuery);\n const queryString = isEmpty(evolvedQuery) ? '' : `?${evolvedQuery}`;\n\n navigate(`/server/${params.serverId}/list-short-urls/1${queryString}`);\n };\n\n return [ query, toFirstPageWithExtra ];\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 { supportsAllTagsFiltering } from '../utils/helpers/features';\nimport { SelectedServer } from '../servers/data';\nimport { TooltipToggleSwitch } from '../utils/TooltipToggleSwitch';\nimport { useShortUrlsQuery } from './helpers/hooks';\nimport './ShortUrlsFilteringBar.scss';\n\ninterface ShortUrlsFilteringProps {\n selectedServer: SelectedServer;\n}\n\nconst dateOrNull = (date?: string) => date ? parseISO(date) : null;\n\nconst ShortUrlsFilteringBar = (colorGenerator: ColorGenerator) => ({ selectedServer }: ShortUrlsFilteringProps) => {\n const [{ search, tags, startDate, endDate, tagsMode = 'any' }, toFirstPage ] = useShortUrlsQuery();\n const selectedTags = tags?.split(',') ?? [];\n const setDates = pipe(\n ({ startDate, endDate }: DateRange) => ({\n startDate: formatIsoDate(startDate) ?? undefined,\n endDate: formatIsoDate(endDate) ?? undefined,\n }),\n toFirstPage,\n );\n const setSearch = pipe(\n (searchTerm: string) => isEmpty(searchTerm) ? undefined : searchTerm,\n (search) => toFirstPage({ search }),\n );\n const removeTag = pipe(\n (tag: string) => selectedTags.filter((selectedTag) => selectedTag !== tag),\n (tagsList) => tagsList.length === 0 ? undefined : tagsList.join(','),\n (tags) => toFirstPage({ tags }),\n );\n const canChangeTagsMode = supportsAllTagsFiltering(selectedServer);\n const toggleTagsMode = pipe(\n () => tagsMode === 'any' ? 'all' : 'any',\n (tagsMode) => toFirstPage({ tagsMode }),\n );\n\n return (\n <div className=\"short-urls-filtering-bar-container\">\n <SearchField initialValue={search} onChange={setSearch} />\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(startDate),\n endDate: dateOrNull(endDate),\n }}\n onDatesChange={setDates}\n />\n </div>\n </div>\n </div>\n\n {selectedTags.length > 0 && (\n <h4 className=\"mt-3\">\n {canChangeTagsMode && selectedTags.length > 1 && (\n <div className=\"float-end ms-2 mt-1\">\n <TooltipToggleSwitch\n checked={tagsMode === 'all'}\n tooltip={{ placement: 'left' }}\n onChange={toggleTagsMode}\n >\n {tagsMode === 'all' ? 'Short URLs including all tags.' : 'Short URLs including any tag.'}\n </TooltipToggleSwitch>\n </div>\n )}\n <FontAwesomeIcon icon={tagsIcon} className=\"short-urls-filtering-bar__tags-icon me-1\" />\n {selectedTags.map((tag) =>\n <Tag colorGenerator={colorGenerator} key={tag} text={tag} clearable onClose={() => removeTag(tag)} />)}\n </h4>\n )}\n </div>\n );\n};\n\nexport default ShortUrlsFilteringBar;\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, Order, OrderDir } from './helpers/ordering';\nimport './OrderingDropdown.scss';\n\nexport interface OrderingDropdownProps<T extends string = string> {\n items: Record<T, string>;\n order: Order<T>;\n onChange: (orderField?: T, orderDir?: OrderDir) => void;\n isButton?: boolean;\n right?: boolean;\n}\n\nexport function OrderingDropdown<T extends string = string>(\n { items, order, onChange, isButton = true, right = false }: OrderingDropdownProps<T>,\n) {\n const handleItemClick = (fieldKey: T) => () => {\n const newOrderDir = determineOrderDir(fieldKey, order.field, order.dir);\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 && !order.field && <>Order by...</>}\n {isButton && order.field && `Order by: \"${items[order.field]}\" - \"${order.dir ?? 'DESC'}\"`}\n </DropdownToggle>\n <DropdownMenu\n right={right}\n className={classNames('w-100', { 'ordering-dropdown__menu--link': !isButton })}\n >\n {toPairs(items).map(([ fieldKey, fieldValue ]) => (\n <DropdownItem key={fieldKey} active={order.field === fieldKey} onClick={handleItemClick(fieldKey as T)}>\n {fieldValue}\n {order.field === fieldKey && (\n <FontAwesomeIcon\n icon={order.dir === 'ASC' ? sortAscIcon : sortDescIcon}\n className=\"ordering-dropdown__sort-icon\"\n />\n )}\n </DropdownItem>\n ))}\n <DropdownItem divider />\n <DropdownItem disabled={!order.field} 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 { useParams } from 'react-router-dom';\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, routeParams: any) => 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 const params = useParams();\n\n useEffect(() => {\n const onMessage = (visit: CreateVisit) => interval ? pendingUpdates.add(visit) : createNewVisits([ visit ]);\n const topics = getTopicsForProps(props, params);\n const closeEventSource = bindToMercureTopic(mercureInfo, topics, 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","export class Topics {\n public static readonly visits = 'https://shlink.io/new-visit';\n\n public static readonly orphanVisits = 'https://shlink.io/new-orphan-visit';\n\n public static readonly shortUrlVisits = (shortCode: string) => `https://shlink.io/new-visit/${shortCode}`;\n}\n","import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faCaretDown as caretDownIcon, faCaretUp as caretUpIcon } from '@fortawesome/free-solid-svg-icons';\nimport { Order } from '../helpers/ordering';\n\ninterface TableOrderIconProps<T> {\n currentOrder: Order<T>;\n field: T;\n className?: string;\n}\n\nexport function TableOrderIcon<T extends string = string>(\n { currentOrder, field, className = 'ms-1' }: TableOrderIconProps<T>,\n) {\n if (!currentOrder.dir || currentOrder.field !== field) {\n return null;\n }\n\n return <FontAwesomeIcon icon={currentOrder.dir === 'ASC' ? caretUpIcon : caretDownIcon} className={className} />;\n}\n","import { isEmpty, propEq, values } from 'ramda';\nimport { useState, useEffect, useMemo, FC, useRef } from 'react';\nimport { Button, 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, Routes, Navigate } from 'react-router-dom';\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 { prettify } from '../utils/helpers/numbers';\nimport { NavPillItem, NavPills } from '../utils/NavPills';\nimport LineChartCard from './charts/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 { DoughnutChartCard } from './charts/DoughnutChartCard';\nimport { SortableBarChartCard } from './charts/SortableBarChartCard';\n\nexport interface VisitsStatsProps {\n getVisits: (params: VisitsParams, doIntervalFallback?: boolean) => void;\n visitsInfo: VisitsInfo;\n settings: Settings;\n selectedServer: SelectedServer;\n cancelGetVisits: () => void;\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: 'by-time', 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 VisitsStats: FC<VisitsStatsProps> = ({\n children,\n visitsInfo,\n getVisits,\n cancelGetVisits,\n domain,\n settings,\n exportCsv,\n selectedServer,\n isOrphanVisits = false,\n}) => {\n const { visits, loading, loadingLarge, error, errorData, progress, fallbackInterval } = visitsInfo;\n const [ initialInterval, setInitialInterval ] = useState<DateInterval>(\n fallbackInterval ?? settings.visits?.defaultInterval ?? 'last30Days',\n );\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 const isFirstLoad = useRef(true);\n\n const buildSectionUrl = (subPath?: string) => {\n const query = domain ? `?domain=${domain}` : '';\n\n return !subPath ? `${query}` : `${subPath}${query}`;\n };\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 }, isFirstLoad.current);\n isFirstLoad.current = false;\n }, [ dateRange, visitsFilter ]);\n useEffect(() => {\n fallbackInterval && setInitialInterval(fallbackInterval);\n }, [ fallbackInterval ]);\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 <NavPills fill>\n {Object.values(sections).map(({ title, icon, subPath }, index) => (\n <NavPillItem key={index} to={buildSectionUrl(subPath)} replace>\n <FontAwesomeIcon icon={icon} />\n <span className=\"ms-2 d-none d-sm-inline\">{title}</span>\n </NavPillItem>\n ))}\n </NavPills>\n <Row>\n <Routes>\n <Route\n path={sections.byTime.subPath}\n element={(\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 )}\n />\n\n <Route\n path={sections.byContext.subPath}\n element={(\n <>\n <div className={classNames('mt-3 col-lg-6', { 'col-xl-4': !isOrphanVisits })}>\n <DoughnutChartCard title=\"Operating systems\" stats={os} />\n </div>\n <div className={classNames('mt-3 col-lg-6', { 'col-xl-4': !isOrphanVisits })}>\n <DoughnutChartCard title=\"Browsers\" stats={browsers} />\n </div>\n <div className={classNames('mt-3', { 'col-xl-4': !isOrphanVisits, 'col-lg-6': isOrphanVisits })}>\n <SortableBarChartCard\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 <SortableBarChartCard\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 </>\n )}\n />\n\n <Route\n path={sections.byLocation.subPath}\n element={(\n <>\n <div className=\"col-lg-6 mt-3\">\n <SortableBarChartCard\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 <SortableBarChartCard\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 </>\n )}\n />\n\n <Route\n path={sections.list.subPath}\n element={(\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 )}\n />\n\n <Route path=\"*\" element={<Navigate replace to={buildSectionUrl(sections.byTime.subPath)} />} />\n </Routes>\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 updatable\n disabled={loading}\n initialDateRange={initialInterval}\n defaultText=\"All visits\"\n onDatesChange={setDateRange}\n />\n </div>\n <VisitsFilterDropdown\n className=\"ms-0 ms-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 me-2\"\n onClick={() => setSelectedVisits([])}\n >\n Clear selection {highlightedVisits.length > 0 && <>({prettify(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 ({prettify(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 { 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 { 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';\nimport { TagsOrder } from '../../tags/data/TagsListChildrenProps';\nimport { ShortUrlsOrder } from '../../short-urls/data';\n\nexport const SET_SETTINGS = 'shlink/realTimeUpdates/SET_SETTINGS';\n\nexport const DEFAULT_SHORT_URLS_ORDERING: ShortUrlsOrder = {\n field: 'dateCreated',\n dir: 'DESC',\n};\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\nexport interface RealTimeUpdatesSettings {\n enabled: boolean;\n interval?: number;\n}\n\nexport type TagFilteringMode = 'startsWith' | 'includes';\n\nexport interface ShortUrlCreationSettings {\n validateUrls: boolean;\n tagFilteringMode?: TagFilteringMode;\n forwardQuery?: boolean;\n}\n\nexport type TagsMode = 'cards' | 'list';\n\nexport interface UiSettings {\n theme: Theme;\n}\n\nexport interface VisitsSettings {\n defaultInterval: DateInterval;\n}\n\nexport interface TagsSettings {\n defaultOrdering?: TagsOrder;\n defaultMode?: TagsMode;\n}\n\nexport interface ShortUrlsListSettings {\n defaultOrdering?: ShortUrlsOrder;\n}\n\nexport interface Settings {\n realTimeUpdates: RealTimeUpdatesSettings;\n shortUrlCreation?: ShortUrlCreationSettings;\n shortUrlsList?: ShortUrlsListSettings;\n ui?: UiSettings;\n visits?: VisitsSettings;\n tags?: TagsSettings;\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 shortUrlsList: {\n defaultOrdering: DEFAULT_SHORT_URLS_ORDERING,\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 setShortUrlsListSettings = (settings: ShortUrlsListSettings): PartialSettingsAction => ({\n type: SET_SETTINGS,\n shortUrlsList: 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\nexport const setTagsSettings = (settings: TagsSettings): PartialSettingsAction => ({\n type: SET_SETTINGS,\n tags: settings,\n});\n","const TEN_ROUNDING_NUMBER = 10;\nconst { ceil } = Math;\nconst formatter = new Intl.NumberFormat('en-US');\n\nexport const prettify = (number: number | string) => formatter.format(Number(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 {\n pageIsEllipsis,\n keyForPage,\n progressivePagination,\n prettifyPageNumber,\n NumberOrEllipsis,\n} from '../utils/helpers/pagination';\nimport { ShlinkPaginator } from '../api/types';\n\ninterface PaginatorProps {\n paginator?: ShlinkPaginator;\n serverId: string;\n currentQueryString?: string;\n}\n\nconst Paginator = ({ paginator, serverId, currentQueryString = '' }: PaginatorProps) => {\n const { currentPage = 0, pagesCount = 0 } = paginator ?? {};\n const urlForPage = (pageNumber: NumberOrEllipsis) =>\n `/server/${serverId}/list-short-urls/${pageNumber}${currentQueryString}`;\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 tag={Link} to={urlForPage(pageNumber)}>\n {prettifyPageNumber(pageNumber)}\n </PaginationLink>\n </PaginationItem>\n ));\n\n return (\n <Pagination className=\"sticky-card-paginator\" listClassName=\"flex-wrap justify-content-center mb-0\">\n <PaginationItem disabled={currentPage === 1}>\n <PaginationLink previous tag={Link} to={urlForPage(currentPage - 1)} />\n </PaginationItem>\n {renderPages()}\n <PaginationItem disabled={currentPage >= pagesCount}>\n <PaginationLink next tag={Link} to={urlForPage(currentPage + 1)} />\n </PaginationItem>\n </Pagination>\n );\n};\n\nexport default Paginator;\n","import { Nullable, OptionalString } from '../../utils/utils';\nimport { Order } from '../../utils/helpers/ordering';\n\nexport interface EditShortUrlData {\n longUrl?: string;\n tags?: string[];\n title?: string | null;\n validSince?: Date | string | null;\n validUntil?: Date | string | null;\n maxVisits?: number | null;\n validateUrl?: boolean;\n crawlable?: boolean;\n forwardQuery?: boolean;\n}\n\nexport interface ShortUrlData extends EditShortUrlData {\n longUrl: string;\n customSlug?: string;\n shortCodeLength?: number;\n domain?: string;\n findIfExists?: boolean;\n}\n\nexport interface ShortUrl {\n shortCode: string;\n shortUrl: string;\n longUrl: string;\n dateCreated: string;\n visitsCount: number;\n meta: Required<Nullable<ShortUrlMeta>>;\n tags: string[];\n domain: string | null;\n title?: string | null;\n crawlable?: boolean;\n forwardQuery?: boolean;\n}\n\nexport interface ShortUrlMeta {\n validSince?: string;\n validUntil?: string;\n maxVisits?: number;\n}\n\nexport interface ShortUrlModalProps {\n shortUrl: ShortUrl;\n isOpen: boolean;\n toggle: () => void;\n}\n\nexport interface ShortUrlIdentifier {\n shortCode: string;\n domain: OptionalString;\n}\n\nexport const SHORT_URLS_ORDERABLE_FIELDS = {\n dateCreated: 'Created at',\n shortCode: 'Short URL',\n longUrl: 'Long URL',\n title: 'Title',\n visits: 'Visits',\n};\n\nexport type ShortUrlsOrderableFields = keyof typeof SHORT_URLS_ORDERABLE_FIELDS;\n\nexport type ShortUrlsOrder = Order<ShortUrlsOrderableFields>;\n","import { pipe } from 'ramda';\nimport { FC, useEffect, useMemo, useState } from 'react';\nimport { Card } from 'reactstrap';\nimport { useLocation, useParams } from 'react-router-dom';\nimport { OrderingDropdown } from '../utils/OrderingDropdown';\nimport { determineOrderDir, OrderDir } from '../utils/helpers/ordering';\nimport { getServerId, SelectedServer } from '../servers/data';\nimport { boundToMercureHub } from '../mercure/helpers/boundToMercureHub';\nimport { Topics } from '../mercure/helpers/Topics';\nimport { TableOrderIcon } from '../utils/table/TableOrderIcon';\nimport { ShlinkShortUrlsListParams } from '../api/types';\nimport { DEFAULT_SHORT_URLS_ORDERING, Settings } from '../settings/reducers/settings';\nimport { ShortUrlsList as ShortUrlsListState } from './reducers/shortUrlsList';\nimport { ShortUrlsTableProps } from './ShortUrlsTable';\nimport Paginator from './Paginator';\nimport { useShortUrlsQuery } from './helpers/hooks';\nimport { ShortUrlsOrderableFields, SHORT_URLS_ORDERABLE_FIELDS } from './data';\n\ninterface ShortUrlsListProps {\n selectedServer: SelectedServer;\n shortUrlsList: ShortUrlsListState;\n listShortUrls: (params: ShlinkShortUrlsListParams) => void;\n settings: Settings;\n}\n\nconst ShortUrlsList = (ShortUrlsTable: FC<ShortUrlsTableProps>, ShortUrlsFilteringBar: FC) => boundToMercureHub(({\n listShortUrls,\n shortUrlsList,\n selectedServer,\n settings,\n}: ShortUrlsListProps) => {\n const serverId = getServerId(selectedServer);\n const { page } = useParams();\n const location = useLocation();\n const [{ tags, search, startDate, endDate, orderBy, tagsMode }, toFirstPage ] = useShortUrlsQuery();\n const [ actualOrderBy, setActualOrderBy ] = useState(\n // This separated state handling is needed to be able to fall back to settings value, but only once when loaded\n orderBy ?? settings.shortUrlsList?.defaultOrdering ?? DEFAULT_SHORT_URLS_ORDERING,\n );\n const selectedTags = useMemo(() => tags?.split(',') ?? [], [ tags ]);\n const { pagination } = shortUrlsList?.shortUrls ?? {};\n const handleOrderBy = (field?: ShortUrlsOrderableFields, dir?: OrderDir) => {\n toFirstPage({ orderBy: { field, dir } });\n setActualOrderBy({ field, dir });\n };\n const orderByColumn = (field: ShortUrlsOrderableFields) => () =>\n handleOrderBy(field, determineOrderDir(field, actualOrderBy.field, actualOrderBy.dir));\n const renderOrderIcon = (field: ShortUrlsOrderableFields) =>\n <TableOrderIcon currentOrder={actualOrderBy} field={field} />;\n const addTag = pipe(\n (newTag: string) => [ ...new Set([ ...selectedTags, newTag ]) ].join(','),\n (tags) => toFirstPage({ tags }),\n );\n\n useEffect(() => {\n listShortUrls({\n page,\n searchTerm: search,\n tags: selectedTags,\n startDate,\n endDate,\n orderBy: actualOrderBy,\n tagsMode,\n });\n }, [ page, search, selectedTags, startDate, endDate, actualOrderBy, tagsMode ]);\n\n return (\n <>\n <div className=\"mb-3\"><ShortUrlsFilteringBar /></div>\n <div className=\"d-block d-lg-none mb-3\">\n <OrderingDropdown items={SHORT_URLS_ORDERABLE_FIELDS} order={actualOrderBy} onChange={handleOrderBy} />\n </div>\n <Card body className=\"pb-1\">\n <ShortUrlsTable\n selectedServer={selectedServer}\n shortUrlsList={shortUrlsList}\n orderByColumn={orderByColumn}\n renderOrderIcon={renderOrderIcon}\n onTagClick={addTag}\n />\n <Paginator paginator={pagination} serverId={serverId} currentQueryString={location.search} />\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=\"ms-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=\"responsive-table__row\">\n <td className=\"indivisible short-urls-row__cell responsive-table__cell\" data-th=\"Created at\">\n <Time date={shortUrl.dateCreated} />\n </td>\n <td className=\"responsive-table__cell 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 bg-warning text-black short-urls-row__copy-hint\" hidden={!copiedToClipboard}>\n Copied short URL!\n </span>\n </span>\n </td>\n <td className=\"responsive-table__cell 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 responsive-table__cell short-urls-row__cell--break d-lg-none\" data-th=\"Long URL\">\n <ExternalLink href={shortUrl.longUrl} />\n </td>\n )}\n <td className=\"responsive-table__cell short-urls-row__cell\" data-th=\"Tags\">{renderTags(shortUrl.tags)}</td>\n <td className=\"responsive-table__cell short-urls-row__cell text-lg-end\" data-th=\"Visits\">\n <ShortUrlVisitsCount\n visitsCount={shortUrl.visitsCount}\n shortUrl={shortUrl}\n selectedServer={selectedServer}\n active={active}\n />\n </td>\n <td className=\"responsive-table__cell short-urls-row__cell\">\n <ShortUrlsRowMenu selectedServer={selectedServer} shortUrl={shortUrl} />\n </td>\n </tr>\n );\n};\n\nexport default ShortUrlsRow;\n","import { FC } from 'react';\nimport { ButtonDropdown, DropdownMenu, DropdownToggle } from 'reactstrap';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faEllipsisV as menuIcon } from '@fortawesome/free-solid-svg-icons';\nimport './DropdownBtnMenu.scss';\n\nexport interface DropdownBtnMenuProps {\n isOpen: boolean;\n toggle: () => void;\n right?: boolean;\n}\n\nexport const DropdownBtnMenu: FC<DropdownBtnMenuProps> = ({ isOpen, toggle, children, right = true }) => (\n <ButtonDropdown toggle={toggle} isOpen={isOpen}>\n <DropdownToggle size=\"sm\" caret outline className=\"dropdown-btn-menu__dropdown-toggle\">\n <FontAwesomeIcon icon={menuIcon} /> \n </DropdownToggle>\n <DropdownMenu right={right}>{children}</DropdownMenu>\n </ButtonDropdown>\n);\n","import {\n faChartPie as pieChartIcon,\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 { DropdownItem } from 'reactstrap';\nimport { useToggle } from '../../utils/helpers/hooks';\nimport { ShortUrl, ShortUrlModalProps } from '../data';\nimport { SelectedServer } from '../../servers/data';\nimport { DropdownBtnMenu } from '../../utils/DropdownBtnMenu';\nimport ShortUrlDetailLink from './ShortUrlDetailLink';\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 <DropdownBtnMenu toggle={toggle} isOpen={isOpen}>\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=\"dropdown-item--danger\" onClick={toggleDelete}>\n <FontAwesomeIcon icon={deleteIcon} fixedWidth /> Delete short URL\n </DropdownItem>\n <DeleteShortUrlModal shortUrl={shortUrl} isOpen={isDeleteModalOpen} toggle={toggleDelete} />\n </DropdownBtnMenu>\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 forwardQuery: settings?.forwardQuery ?? true,\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 { 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' || error?.type === 'INVALID_SHORT_URL_DELETION';\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-end 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-end 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 { 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 { 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';\nimport { ApiErrorAction } from '../../api/types/actions';\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\nconst initialState: ShortUrlDeletion = {\n shortCode: '',\n loading: false,\n error: false,\n};\n\nexport default buildReducer<ShortUrlDeletion, DeleteShortUrlAction & ApiErrorAction>({\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: any) {\n dispatch<ApiErrorAction>({ 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';\nimport { ApiErrorAction } from '../../api/types/actions';\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\nconst initialState: ShortUrlCreation = {\n result: null,\n saving: false,\n error: false,\n};\n\nexport default buildReducer<ShortUrlCreation, CreateShortUrlAction & ApiErrorAction>({\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: any) {\n dispatch<ApiErrorAction>({ 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';\nimport { ApiErrorAction } from '../../api/types/actions';\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\nconst initialState: ShortUrlEdition = {\n saving: false,\n error: false,\n};\n\nexport default buildReducer<ShortUrlEdition, ShortUrlEditedAction & ApiErrorAction>({\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: any) {\n dispatch<ApiErrorAction>({ type: EDIT_SHORT_URL_ERROR, errorData: parseApiError(e) });\n\n throw e;\n }\n};\n","import { assoc, assocPath, 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 { ShlinkShortUrlsListParams, ShlinkShortUrlsResponse } from '../../api/types';\nimport { DeleteShortUrlAction, SHORT_URL_DELETED } from './shortUrlDeletion';\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 const ITEMS_IN_OVERVIEW_PAGE = 5;\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}\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.\n // We can also remove the items above the amount that is displayed there.\n (state: ShortUrlsList, { result }: CreateShortUrlAction) => !state.shortUrls ? state : assocPath(\n [ 'shortUrls', 'data' ],\n [ result, ...state.shortUrls.data.slice(0, ITEMS_IN_OVERVIEW_PAGE - 1) ],\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: ShlinkShortUrlsListParams = {},\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 });\n } catch (e) {\n dispatch({ type: LIST_SHORT_URLS_ERROR });\n }\n};\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 { ShortUrlsOrderableFields } from './data';\nimport './ShortUrlsTable.scss';\n\nexport interface ShortUrlsTableProps {\n orderByColumn?: (column: ShortUrlsOrderableFields) => () => void;\n renderOrderIcon?: (column: ShortUrlsOrderableFields) => 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 responsive-table', 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 text-dark\">\n Something went wrong while loading short URLs :(\n </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=\"responsive-table__header short-urls-table__header\">\n <tr>\n <th className={orderableColumnsClasses} onClick={orderByColumn?.('dateCreated')}>\n Created at {renderOrderIcon?.('dateCreated')}\n </th>\n <th className={orderableColumnsClasses} onClick={orderByColumn?.('shortCode')}>\n Short URL {renderOrderIcon?.('shortCode')}\n </th>\n {!supportsTitle && (\n <th className={orderableColumnsClasses} onClick={orderByColumn?.('longUrl')}>\n Long URL {renderOrderIcon?.('longUrl')}\n </th>\n ) || (\n <th className=\"short-urls-table__header-cell\">\n <span className={actionableFieldClasses} onClick={orderByColumn?.('title')}>\n Title {renderOrderIcon?.('title')}\n </span>\n / \n <span className={actionableFieldClasses} onClick={orderByColumn?.('longUrl')}>\n <span className=\"indivisible\">Long URL</span> {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 { FC } from 'react';\nimport { DropdownItem } from 'reactstrap';\nimport { DropdownBtn } from '../../../utils/DropdownBtn';\nimport { QrCodeFormat } from '../../../utils/helpers/qrCodes';\n\ninterface QrFormatDropdownProps {\n format: QrCodeFormat;\n setFormat: (format: QrCodeFormat) => void;\n}\n\nexport const QrFormatDropdown: FC<QrFormatDropdownProps> = ({ format, setFormat }) => (\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);\n","import { FC } from 'react';\nimport { DropdownItem } from 'reactstrap';\nimport { DropdownBtn } from '../../../utils/DropdownBtn';\nimport { QrErrorCorrection } from '../../../utils/helpers/qrCodes';\n\ninterface QrErrorCorrectionDropdownProps {\n errorCorrection: QrErrorCorrection;\n setErrorCorrection: (errorCorrection: QrErrorCorrection) => void;\n}\n\nexport const QrErrorCorrectionDropdown: FC<QrErrorCorrectionDropdownProps> = (\n { errorCorrection, setErrorCorrection },\n) => (\n <DropdownBtn text={`Error correction (${errorCorrection})`}>\n <DropdownItem active={errorCorrection === 'L'} onClick={() => setErrorCorrection('L')}>\n <b>L</b>ow\n </DropdownItem>\n <DropdownItem active={errorCorrection === 'M'} onClick={() => setErrorCorrection('M')}>\n <b>M</b>edium\n </DropdownItem>\n <DropdownItem active={errorCorrection === 'Q'} onClick={() => setErrorCorrection('Q')}>\n <b>Q</b>uartile\n </DropdownItem>\n <DropdownItem active={errorCorrection === 'H'} onClick={() => setErrorCorrection('H')}>\n <b>H</b>igh\n </DropdownItem>\n </DropdownBtn>\n);\n","import { FC, useMemo, useState } from 'react';\nimport { Modal, FormGroup, ModalBody, ModalHeader, Row, Button } from 'reactstrap';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faFileDownload as downloadIcon } from '@fortawesome/free-solid-svg-icons';\nimport { ExternalLink } from 'react-external-link';\nimport { ShortUrlModalProps } from '../data';\nimport { SelectedServer } from '../../servers/data';\nimport { CopyToClipboardIcon } from '../../utils/CopyToClipboardIcon';\nimport { buildQrCodeUrl, QrCodeCapabilities, QrCodeFormat, QrErrorCorrection } from '../../utils/helpers/qrCodes';\nimport {\n supportsQrCodeSizeInQuery,\n supportsQrCodeMargin,\n supportsQrErrorCorrection,\n} from '../../utils/helpers/features';\nimport { ImageDownloader } from '../../common/services/ImageDownloader';\nimport { Versions } from '../../utils/helpers/version';\nimport { QrFormatDropdown } from './qr-codes/QrFormatDropdown';\nimport './QrCodeModal.scss';\nimport { QrErrorCorrectionDropdown } from './qr-codes/QrErrorCorrectionDropdown';\n\ninterface QrCodeModalConnectProps extends ShortUrlModalProps {\n selectedServer: SelectedServer;\n}\n\nconst QrCodeModal = (imageDownloader: ImageDownloader, ForServerVersion: FC<Versions>) => ( // eslint-disable-line\n { shortUrl: { shortUrl, shortCode }, toggle, isOpen, selectedServer }: QrCodeModalConnectProps,\n) => {\n const [ size, setSize ] = useState(300);\n const [ margin, setMargin ] = useState(0);\n const [ format, setFormat ] = useState<QrCodeFormat>('png');\n const [ errorCorrection, setErrorCorrection ] = useState<QrErrorCorrection>('L');\n const capabilities: QrCodeCapabilities = useMemo(() => ({\n useSizeInPath: !supportsQrCodeSizeInQuery(selectedServer),\n marginIsSupported: supportsQrCodeMargin(selectedServer),\n errorCorrectionIsSupported: supportsQrErrorCorrection(selectedServer),\n }), [ selectedServer ]);\n const willRenderThreeControls = capabilities.marginIsSupported !== capabilities.errorCorrectionIsSupported;\n const qrCodeUrl = useMemo(\n () => buildQrCodeUrl(shortUrl, { size, format, margin, errorCorrection }, capabilities),\n [ shortUrl, size, format, margin, errorCorrection, 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>\n <FormGroup className={`d-grid ${willRenderThreeControls ? 'col-md-4' : 'col-md-6'}`}>\n <label>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 {capabilities.marginIsSupported && (\n <FormGroup className={`d-grid ${willRenderThreeControls ? 'col-md-4' : 'col-md-6'}`}>\n <label>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 )}\n <FormGroup className={willRenderThreeControls ? 'col-md-4' : 'col-md-6'}>\n <QrFormatDropdown format={format} setFormat={setFormat} />\n </FormGroup>\n {capabilities.errorCorrectionIsSupported && (\n <FormGroup className=\"col-md-6\">\n <QrErrorCorrectionDropdown errorCorrection={errorCorrection} setErrorCorrection={setErrorCorrection} />\n </FormGroup>\n )}\n </Row>\n <div className=\"text-center\">\n <div className=\"mb-3\">\n <ExternalLink href={qrCodeUrl} />\n <CopyToClipboardIcon text={qrCodeUrl} />\n </div>\n <img src={qrCodeUrl} className=\"qr-code-modal__img\" alt=\"QR code\" />\n <ForServerVersion minVersion=\"2.9.0\">\n <div className=\"mt-3\">\n <Button\n block\n color=\"primary\"\n onClick={async () => imageDownloader.saveImage(qrCodeUrl, `${shortCode}-qr-code.${format}`)}\n >\n Download <FontAwesomeIcon icon={downloadIcon} className=\"ms-1\" />\n </Button>\n </div>\n </ForServerVersion>\n </div>\n </ModalBody>\n </Modal>\n );\n};\n\nexport default QrCodeModal;\n","import { isEmpty } from 'ramda';\nimport { stringifyQuery } from './query';\n\nexport interface QrCodeCapabilities {\n useSizeInPath: boolean;\n marginIsSupported: boolean;\n errorCorrectionIsSupported: boolean;\n}\n\nexport type QrCodeFormat = 'svg' | 'png';\n\nexport type QrErrorCorrection = 'L' | 'M' | 'Q' | 'H';\n\nexport interface QrCodeOptions {\n size: number;\n format: QrCodeFormat;\n margin: number;\n errorCorrection: QrErrorCorrection;\n}\n\nexport const buildQrCodeUrl = (\n shortUrl: string,\n { size, format, margin, errorCorrection }: QrCodeOptions,\n { useSizeInPath, marginIsSupported, errorCorrectionIsSupported }: QrCodeCapabilities,\n): string => {\n const baseUrl = `${shortUrl}/qr-code${useSizeInPath ? `/${size}` : ''}`;\n const query = stringifyQuery({\n size: useSizeInPath ? undefined : size,\n format,\n margin: marginIsSupported && margin > 0 ? margin : undefined,\n errorCorrection: errorCorrectionIsSupported ? errorCorrection : undefined,\n });\n\n return `${baseUrl}${isEmpty(query) ? '' : `?${query}`}`;\n};\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 { FC, useRef } from 'react';\nimport * as Popper from 'popper.js';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faInfoCircle as infoIcon } from '@fortawesome/free-solid-svg-icons';\nimport { UncontrolledTooltip } from 'reactstrap';\n\ninterface InfoTooltipProps {\n className?: string;\n placement: Popper.Placement;\n}\n\nexport const InfoTooltip: FC<InfoTooltipProps> = ({ className = '', placement, children }) => {\n const ref = useRef<HTMLSpanElement | null>();\n const refCallback = (el: HTMLSpanElement) => {\n ref.current = el;\n };\n\n return (\n <>\n <span className={className} ref={refCallback}>\n <FontAwesomeIcon icon={infoIcon} />\n </span>\n <UncontrolledTooltip target={(() => ref.current) as any} placement={placement}>{children}</UncontrolledTooltip>\n </>\n );\n};\n","import { ChangeEvent, FC } from 'react';\nimport Checkbox from '../../utils/Checkbox';\nimport { InfoTooltip } from '../../utils/InfoTooltip';\n\ninterface ShortUrlFormCheckboxGroupProps {\n checked?: boolean;\n onChange?: (checked: boolean, e: ChangeEvent<HTMLInputElement>) => void;\n infoTooltip?: string;\n}\n\nexport const ShortUrlFormCheckboxGroup: FC<ShortUrlFormCheckboxGroupProps> = (\n { children, infoTooltip, checked, onChange },\n) => (\n <p>\n <Checkbox inline checked={checked} className={infoTooltip ? 'me-2' : ''} onChange={onChange}>\n {children}\n </Checkbox>\n {infoTooltip && <InfoTooltip placement=\"right\">{infoTooltip}</InfoTooltip>}\n </p>\n);\n","import { FC, useEffect, useState } from 'react';\nimport { InputType } from 'reactstrap/types/lib/Input';\nimport { Button, FormGroup, Input, Row } from 'reactstrap';\nimport { cond, isEmpty, pipe, replace, trim, T } from 'ramda';\nimport classNames from 'classnames';\nimport { parseISO } from 'date-fns';\nimport DateInput, { DateInputProps } from '../utils/DateInput';\nimport { supportsCrawlableVisits, supportsForwardQuery, supportsShortUrlTitle } from '../utils/helpers/features';\nimport { SimpleCard } from '../utils/SimpleCard';\nimport { handleEventPreventingDefault, hasValue, OptionalString } 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;\nconst dynamicColClasses = (flag: boolean) => ({ 'col-sm-6': flag, 'col-sm-12': !flag });\n\nexport const ShortUrlForm = (\n TagsSelector: FC<TagsSelectorProps>,\n DomainSelector: FC<DomainSelectorProps>,\n): FC<ShortUrlFormProps> => ({ mode, saving, onSave, initialState, selectedServer }) => {\n const [ shortUrlData, setShortUrlData ] = useState(initialState);\n const isEdit = mode === 'edit';\n const isBasicMode = mode === 'create-basic';\n const hadTitleOriginally = hasValue(initialState.title);\n const changeTags = (tags: string[]) => setShortUrlData({ ...shortUrlData, tags: tags.map(normalizeTag) });\n const reset = () => setShortUrlData(initialState);\n const resolveNewTitle = (): OptionalString => {\n const hasNewTitle = hasValue(shortUrlData.title);\n const matcher = cond<never, OptionalString>([\n [ () => !hasNewTitle && !hadTitleOriginally, () => undefined ],\n [ () => !hasNewTitle && hadTitleOriginally, () => null ],\n [ T, () => shortUrlData.title ],\n ]);\n\n return matcher();\n };\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: resolveNewTitle(),\n }).then(() => !isEdit && reset()).catch(() => {}));\n\n useEffect(() => {\n setShortUrlData(initialState);\n }, [ initialState ]);\n\n const renderOptionalInput = (\n id: NonDateFields,\n placeholder: string,\n type: InputType = 'text',\n props = {},\n fromGroupProps = {},\n ) => (\n <FormGroup {...fromGroupProps}>\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 <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 );\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 <Row>\n {isBasicMode && renderOptionalInput('customSlug', 'Custom slug', 'text', { bsSize: 'lg' }, { className: 'col-lg-6' })}\n <div className={isBasicMode ? 'col-lg-6' : 'col-12 mb-0'}>\n <TagsSelector selectedTags={shortUrlData.tags ?? []} onChange={changeTags} />\n </div>\n </Row>\n </>\n );\n\n const supportsTitle = supportsShortUrlTitle(selectedServer);\n const showCustomizeCard = supportsTitle || !isEdit;\n const limitAccessCardClasses = classNames('mb-3', dynamicColClasses(showCustomizeCard));\n const showCrawlableControl = supportsCrawlableVisits(selectedServer);\n const showForwardQueryControl = supportsForwardQuery(selectedServer);\n const showBehaviorCard = showCrawlableControl || showForwardQueryControl;\n const extraChecksCardClasses = classNames('mb-3', dynamicColClasses(showBehaviorCard));\n\n return (\n <form className=\"short-url-form\" onSubmit={submit}>\n {isBasicMode && basicComponents}\n {!isBasicMode && (\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: hasValue(shortUrlData.customSlug),\n })}\n </div>\n </Row>\n <DomainSelector\n value={shortUrlData.domain}\n onChange={(domain?: string) => setShortUrlData({ ...shortUrlData, domain })}\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 <div className=\"mb-3\">\n {renderDateInput('validSince', 'Enabled since...', { maxDate: shortUrlData.validUntil ? toDate(shortUrlData.validUntil) : undefined })}\n </div>\n {renderDateInput('validUntil', 'Enabled until...', { minDate: shortUrlData.validSince ? toDate(shortUrlData.validSince) : undefined })}\n </SimpleCard>\n </div>\n </Row>\n\n <Row>\n <div className={extraChecksCardClasses}>\n <SimpleCard title=\"Extra checks\">\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 {!isEdit && (\n <p>\n <Checkbox\n inline\n className=\"me-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 </div>\n {showBehaviorCard && (\n <div className=\"col-sm-6 mb-3\">\n <SimpleCard title=\"Configure behavior\">\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 {showForwardQueryControl && (\n <ShortUrlFormCheckboxGroup\n infoTooltip=\"When this short URL is visited, any query params appended to it will be forwarded to the long URL.\"\n checked={shortUrlData.forwardQuery}\n onChange={(forwardQuery) => setShortUrlData({ ...shortUrlData, forwardQuery })}\n >\n Forward query params on redirect\n </ShortUrlFormCheckboxGroup>\n )}\n </SimpleCard>\n </div>\n )}\n </Row>\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 { 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 { useLocation, useParams } from 'react-router-dom';\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 { useGoBack, 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 {\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 forwardQuery: shortUrl.forwardQuery,\n validateUrl,\n };\n};\n\nexport const EditShortUrl = (ShortUrlForm: FC<ShortUrlFormProps>) => ({\n settings: { shortUrlCreation: shortUrlCreationSettings },\n selectedServer,\n shortUrlDetail,\n getShortUrlDetail,\n shortUrlEdition,\n editShortUrl,\n}: EditShortUrlConnectProps) => {\n const { search } = useLocation();\n const params = useParams<{ shortCode: string }>();\n const goBack = useGoBack();\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 params.shortCode && 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 me-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';\nimport { ApiErrorAction } from '../../api/types/actions';\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\nconst initialState: ShortUrlDetail = {\n loading: false,\n error: false,\n};\n\nexport default buildReducer<ShortUrlDetail, ShortUrlDetailAction & ApiErrorAction>({\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: any) {\n dispatch<ApiErrorAction>({ type: GET_SHORT_URL_DETAIL_ERROR, errorData: parseApiError(e) });\n }\n};\n","import Bottle from 'bottlejs';\nimport ShortUrlsFilteringBar from '../ShortUrlsFilteringBar';\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 { 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('ShortUrlsList', ShortUrlsList, 'ShortUrlsTable', 'ShortUrlsFilteringBar');\n bottle.decorator('ShortUrlsList', connect(\n [ 'selectedServer', 'mercureInfo', 'shortUrlsList', 'settings' ],\n [ 'listShortUrls', '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, 'ImageDownloader', 'ForServerVersion');\n bottle.decorator('QrCodeModal', connect([ 'selectedServer' ]));\n\n bottle.serviceFactory('ShortUrlsFilteringBar', ShortUrlsFilteringBar, 'ColorGenerator');\n bottle.decorator('ShortUrlsFilteringBar', connect([ 'selectedServer' ]));\n\n // Actions\n bottle.serviceFactory('listShortUrls', listShortUrls, 'buildShlinkApiClient');\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, ReactNode } from 'react';\n\ninterface LabeledFormGroupProps {\n label: ReactNode;\n noMargin?: boolean;\n className?: string;\n labelClassName?: string;\n}\n\nexport const LabeledFormGroup: FC<LabeledFormGroupProps> = (\n { children, label, className = '', labelClassName = '', noMargin = false },\n) => (\n <div className={`${className} ${noMargin ? '' : 'mb-3'}`}>\n <label className={`form-label ${labelClassName}`}>{label}</label>\n {children}\n </div>\n);\n","import { FC } from 'react';\nimport { InputType } from 'reactstrap/types/lib/Input';\nimport { LabeledFormGroup } from './LabeledFormGroup';\n\nexport interface InputFormGroupProps {\n value: string;\n onChange: (newValue: string) => void;\n id?: string;\n type?: InputType;\n required?: boolean;\n placeholder?: string;\n className?: string;\n labelClassName?: string;\n}\n\nexport const InputFormGroup: FC<InputFormGroupProps> = (\n { children, value, onChange, type, required, placeholder, className, labelClassName },\n) => (\n <LabeledFormGroup label={<>{children}:</>} className={className ?? ''} labelClassName={labelClassName}>\n <input\n className=\"form-control\"\n type={type ?? 'text'}\n value={value}\n required={required ?? true}\n placeholder={placeholder}\n onChange={(e) => onChange(e.target.value)}\n />\n </LabeledFormGroup>\n);\n","import { FC, ReactNode, useEffect, useState } from 'react';\nimport { InputFormGroup } from '../../utils/forms/InputFormGroup';\nimport { handleEventPreventingDefault } from '../../utils/utils';\nimport { ServerData } from '../data';\nimport { SimpleCard } from '../../utils/SimpleCard';\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 <InputFormGroup value={name} onChange={setName}>Name</InputFormGroup>\n <InputFormGroup type=\"url\" value={url} onChange={setUrl}>URL</InputFormGroup>\n <InputFormGroup value={apiKey} onChange={setApiKey}>API key</InputFormGroup>\n </SimpleCard>\n\n <div className=\"text-end\">{children}</div>\n </form>\n );\n};\n","import { FC, Fragment } from 'react';\nimport { Button, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap';\nimport { ServerData } from '../data';\n\ninterface DuplicatedServersModalProps {\n duplicatedServers: ServerData[];\n isOpen: boolean;\n onDiscard: () => void;\n onSave: () => void;\n}\n\nexport const DuplicatedServersModal: FC<DuplicatedServersModalProps> = (\n { isOpen, duplicatedServers, onDiscard, onSave },\n) => {\n const hasMultipleServers = duplicatedServers.length > 1;\n\n return (\n <Modal centered isOpen={isOpen}>\n <ModalHeader>Duplicated server{hasMultipleServers && 's'}</ModalHeader>\n <ModalBody>\n <p>{hasMultipleServers ? 'The next servers already exist:' : 'There is already a server with:'}</p>\n <ul>\n {duplicatedServers.map(({ url, apiKey }, index) => !hasMultipleServers ? (\n <Fragment key={index}>\n <li>URL: <b>{url}</b></li>\n <li>API key: <b>{apiKey}</b></li>\n </Fragment>\n ) : <li key={index}><b>{url}</b> - <b>{apiKey}</b></li>)}\n </ul>\n <span>\n {hasMultipleServers ? 'Do you want to ignore duplicated servers' : 'Do you want to save this server anyway'}?\n </span>\n </ModalBody>\n <ModalFooter>\n <Button color=\"link\" onClick={onDiscard}>{hasMultipleServers ? 'Ignore duplicated' : 'Discard'}</Button>\n <Button color=\"primary\" onClick={onSave}>Save anyway</Button>\n </ModalFooter>\n </Modal>\n );\n};\n","import { FC, useEffect, useState } from 'react';\nimport { v4 as uuid } from 'uuid';\nimport { Button } from 'reactstrap';\nimport { useNavigate } from 'react-router-dom';\nimport { Result } from '../utils/Result';\nimport { NoMenuLayout } from '../common/NoMenuLayout';\nimport { StateFlagTimeout, useGoBack, useToggle } from '../utils/helpers/hooks';\nimport { ServerForm } from './helpers/ServerForm';\nimport { ImportServersBtnProps } from './helpers/ImportServersBtn';\nimport { ServerData, ServersMap, ServerWithId } from './data';\nimport { DuplicatedServersModal } from './helpers/DuplicatedServersModal';\n\nconst SHOW_IMPORT_MSG_TIME = 4000;\n\ninterface CreateServerProps {\n createServer: (server: ServerWithId) => void;\n servers: ServersMap;\n}\n\nconst ImportResult = ({ type }: { type: 'error' | 'success' }) => (\n <div className=\"mt-3\">\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 </div>\n);\n\nconst CreateServer = (ImportServersBtn: FC<ImportServersBtnProps>, useStateFlagTimeout: StateFlagTimeout) => (\n { servers, createServer }: CreateServerProps,\n) => {\n const navigate = useNavigate();\n const goBack = useGoBack();\n const hasServers = !!Object.keys(servers).length;\n const [ serversImported, setServersImported ] = useStateFlagTimeout(false, SHOW_IMPORT_MSG_TIME);\n const [ errorImporting, setErrorImporting ] = useStateFlagTimeout(false, SHOW_IMPORT_MSG_TIME);\n const [ isConfirmModalOpen, toggleConfirmModal ] = useToggle();\n const [ serverData, setServerData ] = useState<ServerData | undefined>();\n const save = () => {\n if (!serverData) {\n return;\n }\n\n const id = uuid();\n\n createServer({ ...serverData, id });\n navigate(`/server/${id}`);\n };\n\n useEffect(() => {\n const serverExists = Object.values(servers).some(\n ({ url, apiKey }) => serverData?.url === url && serverData?.apiKey === apiKey,\n );\n\n serverExists ? toggleConfirmModal() : save();\n }, [ serverData ]);\n\n return (\n <NoMenuLayout>\n <ServerForm title={<h5 className=\"mb-0\">Add new server</h5>} onSubmit={setServerData}>\n {!hasServers &&\n <ImportServersBtn tooltipPlacement=\"top\" onImport={setServersImported} onImportError={setErrorImporting} />}\n {hasServers && <Button outline onClick={goBack}>Cancel</Button>}\n <Button outline color=\"primary\" className=\"ms-2\">Create server</Button>\n </ServerForm>\n\n {serversImported && <ImportResult type=\"success\" />}\n {errorImporting && <ImportResult type=\"error\" />}\n\n <DuplicatedServersModal\n isOpen={isConfirmModalOpen}\n duplicatedServers={serverData ? [ serverData ] : []}\n onDiscard={goBack}\n onSave={save}\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, faServer as serverIcon } from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { getServerId, SelectedServer, ServersMap } from './data';\n\nexport interface ServersDropdownProps {\n servers: ServersMap;\n selectedServer: SelectedServer;\n}\n\nconst ServersDropdown = ({ servers, selectedServer }: ServersDropdownProps) => {\n const serversList = values(servers);\n\n const renderServers = () => {\n if (isEmpty(serversList)) {\n return (\n <DropdownItem tag={Link} to=\"/server/create\">\n <FontAwesomeIcon icon={plusIcon} /> <span className=\"ms-1\">Add a server</span>\n </DropdownItem>\n );\n }\n\n return (\n <>\n {serversList.map(({ name, id }) => (\n <DropdownItem key={id} tag={Link} to={`/server/${id}`} active={getServerId(selectedServer) === id}>\n {name}\n </DropdownItem>\n ))}\n <DropdownItem divider />\n <DropdownItem tag={Link} to=\"/manage-servers\">\n <FontAwesomeIcon icon={serverIcon} /> <span className=\"ms-1\">Manage servers</span>\n </DropdownItem>\n </>\n );\n };\n\n return (\n <UncontrolledDropdown nav inNavbar>\n <DropdownToggle nav caret>\n <FontAwesomeIcon icon={serverIcon} /> <span className=\"ms-1\">Servers</span>\n </DropdownToggle>\n <DropdownMenu right style={{ right: 0 }}>{renderServers()}</DropdownMenu>\n </UncontrolledDropdown>\n );\n};\n\nexport default ServersDropdown;\n","import { FC } from 'react';\nimport { Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap';\nimport { useNavigate } from 'react-router-dom';\nimport { ServerWithId } from './data';\n\nexport interface DeleteServerModalProps {\n server: ServerWithId;\n toggle: () => void;\n isOpen: boolean;\n redirectHome?: boolean;\n}\n\ninterface DeleteServerModalConnectProps extends DeleteServerModalProps {\n deleteServer: (server: ServerWithId) => void;\n}\n\nconst DeleteServerModal: FC<DeleteServerModalConnectProps> = (\n { server, toggle, isOpen, deleteServer, redirectHome = true },\n) => {\n const navigate = useNavigate();\n const closeModal = () => {\n deleteServer(server);\n toggle();\n redirectHome && navigate('/');\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 fixedWidth 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 { useGoBack } from '../utils/helpers/hooks';\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>(({ editServer, selectedServer }) => {\n const goBack = useGoBack();\n\n if (!isServerWithId(selectedServer)) {\n return null;\n }\n\n const handleSubmit = (serverData: ServerData) => {\n editServer(selectedServer.id, serverData);\n goBack();\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=\"me-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, FC, useState, useEffect } from 'react';\nimport { Button, UncontrolledTooltip } from 'reactstrap';\nimport { complement, pipe } from 'ramda';\nimport { faFileUpload as importIcon } from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { useToggle } from '../../utils/helpers/hooks';\nimport { ServersImporter } from '../services/ServersImporter';\nimport { ServerData, ServersMap } from '../data';\nimport { DuplicatedServersModal } from './DuplicatedServersModal';\nimport './ImportServersBtn.scss';\n\ntype Ref<T> = RefObject<T> | MutableRefObject<T>;\n\nexport interface ImportServersBtnProps {\n onImport?: () => void;\n onImportError?: (error: Error) => void;\n tooltipPlacement?: 'top' | 'bottom';\n className?: string;\n}\n\ninterface ImportServersBtnConnectProps extends ImportServersBtnProps {\n createServers: (servers: ServerData[]) => void;\n servers: ServersMap;\n fileRef: Ref<HTMLInputElement>;\n}\n\nconst serversFiltering = (servers: ServerData[]) =>\n ({ url, apiKey }: ServerData) => servers.some((server) => server.url === url && server.apiKey === apiKey);\n\nconst ImportServersBtn = ({ importServersFromFile }: ServersImporter): FC<ImportServersBtnConnectProps> => ({\n createServers,\n servers,\n fileRef,\n children,\n onImport = () => {},\n onImportError = () => {},\n tooltipPlacement = 'bottom',\n className = '',\n}) => {\n const ref = fileRef ?? useRef<HTMLInputElement>();\n const [ serversToCreate, setServersToCreate ] = useState<ServerData[] | undefined>();\n const [ duplicatedServers, setDuplicatedServers ] = useState<ServerData[]>([]);\n const [ isModalOpen,, showModal, hideModal ] = useToggle();\n const create = pipe(createServers, onImport);\n const createAllServers = pipe(() => create(serversToCreate ?? []), hideModal);\n const createNonDuplicatedServers = pipe(\n () => create((serversToCreate ?? []).filter(complement(serversFiltering(duplicatedServers)))),\n hideModal,\n );\n const onFile = async ({ target }: ChangeEvent<HTMLInputElement>) =>\n importServersFromFile(target.files?.[0])\n .then(setServersToCreate)\n .then(() => {\n // Reset input after processing file\n (target as { value: string | null }).value = null;\n })\n .catch(onImportError);\n\n useEffect(() => {\n if (!serversToCreate) {\n return;\n }\n\n const existingServers = Object.values(servers);\n const duplicatedServers = serversToCreate.filter(serversFiltering(existingServers));\n const hasDuplicatedServers = !!duplicatedServers.length;\n\n !hasDuplicatedServers ? create(serversToCreate) : setDuplicatedServers(duplicatedServers);\n hasDuplicatedServers && showModal();\n }, [ serversToCreate ]);\n\n return (\n <>\n <Button outline id=\"importBtn\" className={className} onClick={() => ref.current?.click()}>\n <FontAwesomeIcon icon={importIcon} fixedWidth /> {children ?? 'Import from file'}\n </Button>\n <UncontrolledTooltip placement={tooltipPlacement} 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=\"import-servers-btn__csv-select\" ref={ref} onChange={onFile} />\n\n <DuplicatedServersModal\n isOpen={isModalOpen}\n duplicatedServers={duplicatedServers}\n onDiscard={createNonDuplicatedServers}\n onSave={createAllServers}\n />\n </>\n );\n};\n\nexport default ImportServersBtn;\n","import { identity, memoizeWith, pipe } from 'ramda';\nimport { Action, Dispatch } from 'redux';\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\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, fromPairs, map, pipe, reduce, toPairs } 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';\nexport const SET_AUTO_CONNECT = 'shlink/servers/SET_AUTO_CONNECT';\n/* eslint-enable padding-line-between-statements */\n\nexport interface CreateServersAction extends Action<string> {\n newServers: ServersMap;\n}\n\ninterface DeleteServerAction extends Action<string> {\n serverId: string;\n}\n\ninterface SetAutoConnectAction extends Action<string> {\n serverId: string;\n autoConnect: boolean;\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 & DeleteServerAction & SetAutoConnectAction>({\n [CREATE_SERVERS]: (state, { newServers }) => ({ ...state, ...newServers }),\n [DELETE_SERVER]: (state, { serverId }) => dissoc(serverId, state),\n [EDIT_SERVER]: (state, { serverId, serverData }: any) => !state[serverId]\n ? state\n : assoc(serverId, { ...state[serverId], ...serverData }, state),\n [SET_AUTO_CONNECT]: (state, { serverId, autoConnect }) => {\n if (!state[serverId]) {\n return state;\n }\n\n if (!autoConnect) {\n return assoc(serverId, { ...state[serverId], autoConnect }, state);\n }\n\n return fromPairs(\n toPairs(state).map(([ evaluatedServerId, server ]) => [\n evaluatedServerId,\n { ...server, autoConnect: evaluatedServerId === serverId },\n ]),\n );\n },\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): DeleteServerAction => ({ type: DELETE_SERVER, serverId: id });\n\nexport const setAutoConnect = ({ id }: ServerWithId, autoConnect: boolean): SetAutoConnectAction => ({\n type: SET_AUTO_CONNECT,\n serverId: id,\n autoConnect,\n});\n","import { pipe, prop } from 'ramda';\nimport { AxiosInstance } from 'axios';\nimport { Dispatch } from 'redux';\nimport { homepage } from '../../../package.json';\nimport { hasServerData, ServerData } from '../data';\nimport { createServers } from './servers';\n\nconst responseToServersList = pipe(\n prop<any, any>('data'),\n (data: any): ServerData[] => Array.isArray(data) ? data.filter(hasServerData) : [],\n);\n\nexport const fetchServers = ({ get }: AxiosInstance) => () => async (dispatch: Dispatch) => {\n const resp = await get(`${homepage}/servers.json`);\n const remoteList = responseToServersList(resp);\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 } from 'react';\nimport { Card, CardText, CardTitle } from 'reactstrap';\nimport { Link } from 'react-router-dom';\nimport { faArrowAltCircleRight as linkIcon } from '@fortawesome/free-regular-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport './HighlightCard.scss';\n\nexport interface HighlightCardProps {\n title: string;\n link?: string | false;\n}\n\nconst buildExtraProps = (link?: string | false) => !link ? {} : { tag: Link, to: link };\n\nexport const HighlightCard: FC<HighlightCardProps> = ({ children, title, link }) => (\n <Card className=\"highlight-card\" body {...buildExtraProps(link)}>\n {link && <FontAwesomeIcon size=\"3x\" className=\"highlight-card__link-icon\" icon={linkIcon} />}\n <CardTitle tag=\"h5\" className=\"highlight-card__title\">{title}</CardTitle>\n <CardText tag=\"h2\">{children}</CardText>\n </Card>\n);\n","import { FC, useEffect } from 'react';\nimport { Card, CardBody, CardHeader, Row } from 'reactstrap';\nimport { Link, useNavigate } from 'react-router-dom';\nimport { ITEMS_IN_OVERVIEW_PAGE, 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 { ShlinkShortUrlsListParams } from '../api/types';\nimport { supportsNonOrphanVisits, supportsOrphanVisits } from '../utils/helpers/features';\nimport { getServerId, SelectedServer } from './data';\nimport { HighlightCard } from './helpers/HighlightCard';\n\ninterface OverviewConnectProps {\n shortUrlsList: ShortUrlsListState;\n listShortUrls: (params: ShlinkShortUrlsListParams) => 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 = getServerId(selectedServer);\n const linkToOrphanVisits = supportsOrphanVisits(selectedServer);\n const linkToNonOrphanVisits = supportsNonOrphanVisits(selectedServer);\n const navigate = useNavigate();\n\n useEffect(() => {\n listShortUrls({ itemsPerPage: ITEMS_IN_OVERVIEW_PAGE, orderBy: { field: 'dateCreated', dir: 'DESC' } });\n listTags();\n loadVisitsOverview();\n }, []);\n\n return (\n <>\n <Row>\n <div className=\"col-lg-6 col-xl-3 mb-3\">\n <HighlightCard title=\"Visits\" link={linkToNonOrphanVisits && `/server/${serverId}/non-orphan-visits`}>\n {loadingVisits ? 'Loading...' : prettify(visitsCount)}\n </HighlightCard>\n </div>\n <div className=\"col-lg-6 col-xl-3 mb-3\">\n <HighlightCard title=\"Orphan visits\" link={linkToOrphanVisits && `/server/${serverId}/orphan-visits`}>\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 </HighlightCard>\n </div>\n <div className=\"col-lg-6 col-xl-3 mb-3\">\n <HighlightCard title=\"Short URLs\" link={`/server/${serverId}/list-short-urls/1`}>\n {loading ? 'Loading...' : prettify(shortUrls?.pagination.totalItems ?? 0)}\n </HighlightCard>\n </div>\n <div className=\"col-lg-6 col-xl-3 mb-3\">\n <HighlightCard title=\"Tags\" link={`/server/${serverId}/manage-tags`}>\n {loadingTags ? 'Loading...' : prettify(tagsList.tags.length)}\n </HighlightCard>\n </div>\n </Row>\n\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-end\" 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-end\" 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) => navigate(`/server/${serverId}/list-short-urls/1?tags=${encodeURIComponent(tag)}`)}\n />\n </CardBody>\n </Card>\n </>\n );\n}, () => [ Topics.visits, Topics.orphanVisits ]);\n","import { FC, useEffect, useState } from 'react';\nimport { Button, Row } from 'reactstrap';\nimport { faFileDownload as exportIcon, faPlus as plusIcon } from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { Link } from 'react-router-dom';\nimport { NoMenuLayout } from '../common/NoMenuLayout';\nimport { SimpleCard } from '../utils/SimpleCard';\nimport SearchField from '../utils/SearchField';\nimport { Result } from '../utils/Result';\nimport { StateFlagTimeout } from '../utils/helpers/hooks';\nimport { ImportServersBtnProps } from './helpers/ImportServersBtn';\nimport { ServersMap } from './data';\nimport { ManageServersRowProps } from './ManageServersRow';\nimport ServersExporter from './services/ServersExporter';\n\ninterface ManageServersProps {\n servers: ServersMap;\n}\n\nconst SHOW_IMPORT_MSG_TIME = 4000;\n\nexport const ManageServers = (\n serversExporter: ServersExporter,\n ImportServersBtn: FC<ImportServersBtnProps>,\n useStateFlagTimeout: StateFlagTimeout,\n ManageServersRow: FC<ManageServersRowProps>,\n): FC<ManageServersProps> => ({ servers }) => {\n const allServers = Object.values(servers);\n const [ serversList, setServersList ] = useState(allServers);\n const filterServers = (searchTerm: string) => setServersList(\n allServers.filter(({ name, url }) => `${name} ${url}`.match(searchTerm)),\n );\n const hasAutoConnect = serversList.some(({ autoConnect }) => !!autoConnect);\n const [ errorImporting, setErrorImporting ] = useStateFlagTimeout(false, SHOW_IMPORT_MSG_TIME);\n\n useEffect(() => {\n setServersList(Object.values(servers));\n }, [ servers ]);\n\n return (\n <NoMenuLayout>\n <SearchField className=\"mb-3\" onChange={filterServers} />\n\n <Row className=\"mb-3\">\n <div className=\"col-md-6 d-flex d-md-block mb-2 mb-md-0\">\n <ImportServersBtn className=\"flex-fill\" onImportError={setErrorImporting}>Import servers</ImportServersBtn>\n {allServers.length > 0 && (\n <Button outline className=\"ms-2 flex-fill\" onClick={async () => serversExporter.exportServers()}>\n <FontAwesomeIcon icon={exportIcon} fixedWidth /> Export servers\n </Button>\n )}\n </div>\n <div className=\"col-md-6 text-md-end d-flex d-md-block\">\n <Button outline color=\"primary\" className=\"flex-fill\" tag={Link} to=\"/server/create\">\n <FontAwesomeIcon icon={plusIcon} fixedWidth /> Add a server\n </Button>\n </div>\n </Row>\n\n <SimpleCard>\n <table className=\"table table-hover responsive-table mb-0\">\n <thead className=\"responsive-table__header\">\n <tr>\n {hasAutoConnect && <th style={{ width: '50px' }} />}\n <th>Name</th>\n <th>Base URL</th>\n <th />\n </tr>\n </thead>\n <tbody>\n {!serversList.length && <tr className=\"text-center\"><td colSpan={4}>No servers found.</td></tr>}\n {serversList.map((server) =>\n <ManageServersRow key={server.id} server={server} hasAutoConnect={hasAutoConnect} />)\n }\n </tbody>\n </table>\n </SimpleCard>\n\n {errorImporting && (\n <div className=\"mt-3\">\n <Result type=\"error\">The servers could not be imported. Make sure the format is correct.</Result>\n </div>\n )}\n </NoMenuLayout>\n );\n};\n","import { FC } from 'react';\nimport { UncontrolledTooltip } from 'reactstrap';\nimport { Link } from 'react-router-dom';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faCheck as checkIcon } from '@fortawesome/free-solid-svg-icons';\nimport { ServerWithId } from './data';\nimport { ManageServersRowDropdownProps } from './ManageServersRowDropdown';\n\nexport interface ManageServersRowProps {\n server: ServerWithId;\n hasAutoConnect: boolean;\n}\n\nexport const ManageServersRow = (\n ManageServersRowDropdown: FC<ManageServersRowDropdownProps>,\n): FC<ManageServersRowProps> => ({ server, hasAutoConnect }) => (\n <tr className=\"responsive-table__row\">\n {hasAutoConnect && (\n <td className=\"responsive-table__cell\" data-th=\"Auto-connect\">\n {server.autoConnect && (\n <>\n <FontAwesomeIcon icon={checkIcon} className=\"text-primary\" id=\"autoConnectIcon\" />\n <UncontrolledTooltip target=\"autoConnectIcon\" placement=\"right\">\n Auto-connect to this server\n </UncontrolledTooltip>\n </>\n )}\n </td>\n )}\n <th className=\"responsive-table__cell\" data-th=\"Name\">\n <Link to={`/server/${server.id}`}>{server.name}</Link>\n </th>\n <td className=\"responsive-table__cell\" data-th=\"Base URL\">{server.url}</td>\n <td className=\"responsive-table__cell text-end\">\n <ManageServersRowDropdown server={server} />\n </td>\n </tr>\n);\n","import { FC } from 'react';\nimport { DropdownItem } from 'reactstrap';\nimport { Link } from 'react-router-dom';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport {\n faBan as toggleOffIcon,\n faEdit as editIcon,\n faMinusCircle as deleteIcon,\n faPlug as connectIcon,\n} from '@fortawesome/free-solid-svg-icons';\nimport { faCircle as toggleOnIcon } from '@fortawesome/free-regular-svg-icons';\nimport { DropdownBtnMenu } from '../utils/DropdownBtnMenu';\nimport { useToggle } from '../utils/helpers/hooks';\nimport { DeleteServerModalProps } from './DeleteServerModal';\nimport { ServerWithId } from './data';\n\nexport interface ManageServersRowDropdownProps {\n server: ServerWithId;\n}\n\ninterface ManageServersRowDropdownConnectProps extends ManageServersRowDropdownProps {\n setAutoConnect: (server: ServerWithId, autoConnect: boolean) => void;\n}\n\nexport const ManageServersRowDropdown = (\n DeleteServerModal: FC<DeleteServerModalProps>,\n): FC<ManageServersRowDropdownConnectProps> => ({ server, setAutoConnect }) => {\n const [ isMenuOpen, toggleMenu ] = useToggle();\n const [ isModalOpen,, showModal, hideModal ] = useToggle();\n const serverUrl = `/server/${server.id}`;\n const { autoConnect: isAutoConnect } = server;\n const autoConnectIcon = isAutoConnect ? toggleOffIcon : toggleOnIcon;\n\n return (\n <DropdownBtnMenu isOpen={isMenuOpen} toggle={toggleMenu}>\n <DropdownItem tag={Link} to={serverUrl}>\n <FontAwesomeIcon icon={connectIcon} fixedWidth /> Connect\n </DropdownItem>\n <DropdownItem tag={Link} to={`${serverUrl}/edit`}>\n <FontAwesomeIcon icon={editIcon} fixedWidth /> Edit server\n </DropdownItem>\n <DropdownItem onClick={() => setAutoConnect(server, !server.autoConnect)}>\n <FontAwesomeIcon icon={autoConnectIcon} fixedWidth /> {isAutoConnect ? 'Do not a' : 'A'}uto-connect\n </DropdownItem>\n <DropdownItem divider />\n <DropdownItem className=\"dropdown-item--danger\" onClick={showModal}>\n <FontAwesomeIcon icon={deleteIcon} fixedWidth /> Remove server\n </DropdownItem>\n\n <DeleteServerModal redirectHome={false} server={server} isOpen={isModalOpen} toggle={hideModal} />\n </DropdownBtnMenu>\n );\n};\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 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","import { values } from 'ramda';\nimport { CsvJson } from 'csvjson';\nimport LocalStorage from '../../utils/services/LocalStorage';\nimport { ServersMap, serverWithIdToServerData } from '../data';\nimport { saveCsv } from '../../utils/helpers/files';\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(serverWithIdToServerData);\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 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, setAutoConnect } 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 { ManageServers } from '../ManageServers';\nimport { ManageServersRow } from '../ManageServersRow';\nimport { ManageServersRowDropdown } from '../ManageServersRowDropdown';\nimport { ServersImporter } from './ServersImporter';\nimport ServersExporter from './ServersExporter';\n\nconst provideServices = (bottle: Bottle, connect: ConnectDecorator) => {\n // Components\n bottle.serviceFactory(\n 'ManageServers',\n ManageServers,\n 'ServersExporter',\n 'ImportServersBtn',\n 'useStateFlagTimeout',\n 'ManageServersRow',\n );\n bottle.decorator('ManageServers', connect([ 'servers' ]));\n\n bottle.serviceFactory('ManageServersRow', ManageServersRow, 'ManageServersRowDropdown');\n\n bottle.serviceFactory('ManageServersRowDropdown', ManageServersRowDropdown, 'DeleteServerModal');\n bottle.decorator('ManageServersRowDropdown', connect(null, [ 'setAutoConnect' ]));\n\n bottle.serviceFactory('CreateServer', CreateServer, 'ImportServersBtn', 'useStateFlagTimeout');\n bottle.decorator('CreateServer', withoutSelectedServer);\n bottle.decorator('CreateServer', connect([ 'selectedServer', 'servers' ], [ 'createServer', 'resetSelectedServer' ]));\n\n bottle.serviceFactory('EditServer', EditServer, 'ServerError');\n bottle.decorator('EditServer', connect([ 'selectedServer' ], [ 'editServer', 'selectServer' ]));\n\n bottle.serviceFactory('ServersDropdown', () => ServersDropdown);\n bottle.decorator('ServersDropdown', connect([ 'servers', 'selectedServer' ]));\n\n bottle.serviceFactory('DeleteServerModal', () => DeleteServerModal);\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([ 'servers' ], [ '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('setAutoConnect', () => setAutoConnect);\n bottle.serviceFactory('fetchServers', fetchServers, 'axios');\n\n bottle.serviceFactory('resetSelectedServer', () => resetSelectedServer);\n};\n\nexport default provideServices;\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=\"btn-close float-end\" onClick={toggle} />\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 { 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 me-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 ms-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 { FC, Children, isValidElement } from 'react';\nimport { Card, Nav, NavLink } from 'reactstrap';\nimport { NavLink as RouterNavLink } from 'react-router-dom';\nimport './NavPills.scss';\n\ninterface NavPillsProps {\n fill?: boolean;\n className?: string;\n}\n\ninterface NavPillProps {\n to: string;\n replace?: boolean;\n}\n\nexport const NavPillItem: FC<NavPillProps> = ({ children, ...rest }) => (\n <NavLink className=\"nav-pills__nav-link\" tag={RouterNavLink} {...rest}>\n {children}\n </NavLink>\n);\n\nexport const NavPills: FC<NavPillsProps> = ({ children, fill = false, className = '' }) => (\n <Card className={`nav-pills__nav p-0 overflow-hidden ${className}`} body>\n <Nav pills fill={fill}>\n {Children.map(children, (child) => {\n if (!isValidElement(child) || child.type !== NavPillItem) {\n throw new Error('Only NavPillItem children are allowed inside NavPills.');\n }\n\n return child;\n })}\n </Nav>\n </Card>\n);\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 { ActiveElement, ChartEvent, ChartType, TooltipItem } from 'chart.js';\nimport { prettify } from './numbers';\n\nexport const pointerOnHover = ({ native }: ChartEvent, [ firstElement ]: ActiveElement[]) => {\n if (!native?.target) {\n return;\n }\n\n const canvas = native.target as HTMLCanvasElement;\n\n canvas.style.cursor = firstElement ? 'pointer' : 'default';\n};\n\nexport const renderChartLabel = ({ dataset, formattedValue }: TooltipItem<ChartType>) =>\n `${dataset.label}: ${prettify(formattedValue)}`;\n\nexport const renderPieChartLabel = ({ label, formattedValue }: TooltipItem<ChartType>) =>\n `${label}: ${prettify(formattedValue)}`;\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 { ChartData, ChartDataset, 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, renderChartLabel } 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): ChartDataset => ({\n label,\n data,\n fill: false,\n tension: 0.2,\n borderColor: color,\n backgroundColor: color,\n});\n\nlet selectedLabel: string | null = null;\n\nconst chartElementAtEvent = (\n labels: string[],\n datasetsByPoint: Record<string, NormalizedVisit[]>,\n setSelectedVisits?: (visits: NormalizedVisit[]) => void,\n) => ([ chart ]: [{ index: number }]) => {\n if (!setSelectedVisits || !chart) {\n return;\n }\n\n const { index } = chart;\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 const generateChartDatasets = (): ChartDataset[] => {\n const mainDataset = generateDataset(groupedVisits, 'Visits', MAIN_COLOR);\n\n if (highlightedVisits.length === 0) {\n return [ mainDataset ];\n }\n\n const highlightedDataset = generateDataset(groupedHighlighted, highlightedLabel, HIGHLIGHTED_COLOR);\n\n return [ mainDataset, highlightedDataset ];\n };\n const generateChartData = (): ChartData => ({ labels, datasets: generateChartDatasets() });\n\n const options: ChartOptions = {\n maintainAspectRatio: false,\n plugins: {\n legend: { display: false },\n tooltip: {\n intersect: false,\n axis: 'x',\n callbacks: { label: renderChartLabel },\n },\n },\n scales: {\n y: {\n beginAtZero: true,\n ticks: {\n precision: 0,\n callback: prettify,\n },\n },\n x: {\n title: { display: true, text: STEPS_MAP[step] },\n },\n },\n onHover: pointerOnHover,\n };\n const renderLineChart = () => (\n <Line\n data={generateChartData()}\n options={options}\n getElementAtEvent={chartElementAtEvent(labels, datasetsByPoint, setSelectedVisits) as any}\n />\n );\n\n return (\n <Card>\n <CardHeader>\n {title}\n <div className=\"float-end\">\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-end me-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 {/* It's VERY IMPORTANT to render two different components here, as one has 1 dataset and the other has 2 */}\n {/* Using the same component causes a crash when switching from 1 to 2 datasets, and then back to 1 dataset */}\n {highlightedVisits.length > 0 && renderLineChart()}\n {highlightedVisits.length === 0 && renderLineChart()}\n </CardBody>\n </Card>\n );\n};\n\nexport default LineChartCard;\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 { useEffect, useMemo, useState, useRef } from 'react';\nimport classNames from 'classnames';\nimport { min, splitEvery } from 'ramda';\nimport { faCheck as checkIcon, faRobot as botIcon } 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, Order, sortList } from '../utils/helpers/ordering';\nimport { prettify } from '../utils/helpers/numbers';\nimport { supportsBotVisits } from '../utils/helpers/features';\nimport { SelectedServer } from '../servers/data';\nimport { Time } from '../utils/Time';\nimport { TableOrderIcon } from '../utils/table/TableOrderIcon';\nimport { MediaMatcher } from '../utils/types';\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?: MediaMatcher;\n isOrphanVisits?: boolean;\n selectedServer: SelectedServer;\n}\n\ntype OrderableFields = 'date' | 'country' | 'city' | 'browser' | 'os' | 'referer' | 'visitedUrl' | 'potentialBot';\ntype VisitsOrder = Order<OrderableFields>;\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 = (order: VisitsOrder, visits: NormalizedVisit[]) => sortList<NormalizedVisit>(visits, order as any);\nconst calculateVisits = (allVisits: NormalizedVisit[], searchTerm: string | undefined, order: VisitsOrder) => {\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<VisitsOrder>({});\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) =>\n <TableOrderIcon currentOrder={order} field={field} className=\"visits-table__header-icon\" />;\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 <div className=\"table-responsive-md\">\n <table className=\"table table-bordered table-hover table-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 </div>\n );\n};\n\nexport default VisitsTable;\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';\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=\"me-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 { FC } from 'react';\nimport { Chart } from 'chart.js';\nimport './DoughnutChartLegend.scss';\n\ninterface DoughnutChartLegendProps {\n chart: Chart;\n}\n\nexport const DoughnutChartLegend: FC<DoughnutChartLegendProps> = ({ chart }) => {\n const { config } = chart;\n const { labels = [], datasets = [] } = config.data ?? {};\n const [{ backgroundColor: colors }] = datasets;\n const { defaultColor } = config.options ?? {} as any;\n\n return (\n <ul className=\"doughnut-chart-legend\">\n {(labels as string[]).map((label, index) => (\n <li key={label} className=\"doughnut-chart-legend__item d-flex\">\n <div\n className=\"doughnut-chart-legend__item-color\"\n style={{ backgroundColor: (colors as string[])[index] ?? defaultColor }}\n />\n <small className=\"doughnut-chart-legend__item-text flex-fill\">{label}</small>\n </li>\n ))}\n </ul>\n );\n};\n","import { FC, useState, memo } from 'react';\nimport { Chart, ChartData, ChartDataset, ChartOptions } from 'chart.js';\nimport { keys, values } from 'ramda';\nimport { Doughnut } from 'react-chartjs-2';\nimport { renderPieChartLabel } from '../../utils/helpers/charts';\nimport { isDarkThemeEnabled, PRIMARY_DARK_COLOR, PRIMARY_LIGHT_COLOR } from '../../utils/theme';\nimport { Stats } from '../types';\nimport { DoughnutChartLegend } from './DoughnutChartLegend';\n\ninterface DoughnutChartProps {\n stats: Stats;\n}\n\nconst generateChartDatasets = (data: number[]): ChartDataset[] => [\n {\n data,\n backgroundColor: [\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: isDarkThemeEnabled() ? PRIMARY_DARK_COLOR : PRIMARY_LIGHT_COLOR,\n borderWidth: 2,\n },\n];\nconst generateChartData = (labels: string[], data: number[]): ChartData => ({\n labels,\n datasets: generateChartDatasets(data),\n});\n\nexport const DoughnutChart: FC<DoughnutChartProps> = memo(({ stats }) => {\n const [ chartRef, setChartRef ] = useState<Chart | undefined>(); // Cannot use useRef here\n const labels = keys(stats);\n const data = values(stats);\n\n const options: ChartOptions = {\n plugins: {\n legend: { display: false },\n tooltip: {\n intersect: true,\n callbacks: { label: renderPieChartLabel },\n },\n },\n };\n const chartData = generateChartData(labels, data);\n\n return (\n <div className=\"row\">\n <div className=\"col-sm-12 col-md-7\">\n <Doughnut\n height={300}\n data={chartData}\n options={options}\n ref={(element) => {\n setChartRef(element ?? undefined);\n }}\n />\n </div>\n <div className=\"col-sm-12 col-md-5\">\n {chartRef && <DoughnutChartLegend chart={chartRef} />}\n </div>\n </div>\n );\n});\n","import { Card, CardHeader, CardBody, CardFooter } from 'reactstrap';\nimport { FC, ReactNode } from 'react';\nimport './ChartCard.scss';\n\ninterface ChartCardProps {\n title: Function | string;\n footer?: ReactNode;\n}\n\nexport const ChartCard: FC<ChartCardProps> = ({ title, footer, children }) => (\n <Card>\n <CardHeader className=\"chart-card__header\">{typeof title === 'function' ? title() : title}</CardHeader>\n <CardBody>{children}</CardBody>\n {footer && <CardFooter className=\"chart-card__footer--sticky\">{footer}</CardFooter>}\n </Card>\n);\n","import { FC } from 'react';\nimport { Stats } from '../types';\nimport { DoughnutChart } from './DoughnutChart';\nimport { ChartCard } from './ChartCard';\n\ninterface DoughnutChartCardProps {\n title: string;\n stats: Stats;\n}\n\nexport const DoughnutChartCard: FC<DoughnutChartCardProps> = ({ title, stats }) => (\n <ChartCard title={title}>\n <DoughnutChart stats={stats} />\n </ChartCard>\n);\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 { ChartData, ChartDataset, ChartOptions } from 'chart.js';\nimport { keys, values } from 'ramda';\nimport { Bar } from 'react-chartjs-2';\nimport { fillTheGaps } from '../../utils/helpers/visits';\nimport { pointerOnHover, renderChartLabel } from '../../utils/helpers/charts';\nimport { prettify } from '../../utils/helpers/numbers';\nimport { Stats } from '../types';\nimport { HIGHLIGHTED_COLOR, HIGHLIGHTED_COLOR_ALPHA, MAIN_COLOR, MAIN_COLOR_ALPHA } from '../../utils/theme';\n\nexport interface HorizontalBarChartProps {\n stats: Stats;\n max?: number;\n highlightedStats?: Stats;\n highlightedLabel?: string;\n onClick?: (label: string) => void;\n}\n\nconst dropLabelIfHidden = (label: string) => label.startsWith('hidden') ? '' : label;\nconst statsAreDefined = (stats: Stats | undefined): stats is Stats => !!stats && Object.keys(stats).length > 0;\nconst determineHeight = (labels: string[]): number | undefined => labels.length > 20 ? labels.length * 10 : undefined;\n\nconst generateChartDatasets = (\n data: number[],\n highlightedData: number[],\n highlightedLabel?: string,\n): ChartDataset[] => {\n const mainDataset: ChartDataset = {\n data,\n label: highlightedLabel ? 'Non-selected' : 'Visits',\n backgroundColor: MAIN_COLOR_ALPHA,\n borderColor: MAIN_COLOR,\n borderWidth: 2,\n };\n\n if (highlightedData.every((value) => value === 0)) {\n return [ mainDataset ];\n }\n\n const highlightedDataset: ChartDataset = {\n label: highlightedLabel ?? 'Selected',\n data: highlightedData,\n backgroundColor: HIGHLIGHTED_COLOR_ALPHA,\n borderColor: HIGHLIGHTED_COLOR,\n borderWidth: 2,\n };\n\n return [ mainDataset, highlightedDataset ];\n};\nconst generateChartData = (\n labels: string[],\n data: number[],\n highlightedData: number[],\n highlightedLabel?: string,\n): ChartData => ({\n labels,\n datasets: generateChartDatasets(data, highlightedData, highlightedLabel),\n});\n\ntype ClickedCharts = [{ index: number }] | [];\nconst chartElementAtEvent = (labels: string[], onClick?: (label: string) => void) => ([ chart ]: ClickedCharts) => {\n if (!onClick || !chart) {\n return;\n }\n\n onClick(labels[chart.index]);\n};\n\nexport const HorizontalBarChart: FC<HorizontalBarChartProps> = (\n { stats, highlightedStats, highlightedLabel, onClick, max },\n) => {\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 = fillTheGaps(highlightedStats ?? {}, labels);\n\n const options: ChartOptions = {\n plugins: {\n legend: { display: false },\n tooltip: {\n mode: 'y',\n // Do not show tooltip on items with empty label when in a bar chart\n filter: ({ label }) => label !== '',\n callbacks: { label: renderChartLabel },\n },\n },\n scales: {\n x: {\n beginAtZero: true,\n stacked: true,\n max,\n ticks: {\n precision: 0,\n callback: prettify,\n },\n },\n y: { stacked: true },\n },\n onHover: pointerOnHover,\n indexAxis: 'y',\n };\n const chartData = generateChartData(labels, data, highlightedData, highlightedLabel);\n const height = determineHeight(labels);\n\n // Provide a key based on the height, to force re-render every time the dataset changes (example, due to pagination)\n const renderChartComponent = (customKey: string) => (\n <Bar\n key={`${height}_${customKey}`}\n data={chartData}\n options={options}\n height={height}\n getElementAtEvent={chartElementAtEvent(labels, onClick) as any}\n />\n );\n\n return (\n <>\n {/* It's VERY IMPORTANT to render two different components here, as one has 1 dataset and the other has 2 */}\n {/* Using the same component causes a crash when switching from 1 to 2 datasets, and then back to 1 dataset */}\n {highlightedStats !== undefined && renderChartComponent('with_stats')}\n {highlightedStats === undefined && renderChartComponent('without_stats')}\n </>\n );\n};\n","import { FC, useState } from 'react';\nimport { fromPairs, pipe, reverse, sortBy, splitEvery, toLower, toPairs, type, zipObj } from 'ramda';\nimport { rangeOf } from '../../utils/utils';\nimport { Order } from '../../utils/helpers/ordering';\nimport SimplePaginator from '../../common/SimplePaginator';\nimport { roundTen } from '../../utils/helpers/numbers';\nimport { OrderingDropdown } from '../../utils/OrderingDropdown';\nimport PaginationDropdown from '../../utils/PaginationDropdown';\nimport { Stats, StatsRow } from '../types';\nimport { HorizontalBarChart, HorizontalBarChartProps } from './HorizontalBarChart';\nimport { ChartCard } from './ChartCard';\n\ninterface SortableBarChartCardProps extends Omit<HorizontalBarChartProps, 'max'> {\n title: Function | string;\n sortingItems: Record<string, string>;\n withPagination?: boolean;\n extraHeaderContent?: Function;\n}\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\nexport const SortableBarChartCard: FC<SortableBarChartCardProps> = ({\n stats,\n highlightedStats,\n title,\n sortingItems,\n extraHeaderContent,\n withPagination = true,\n ...rest\n}) => {\n const [ order, setOrder ] = useState<Order<string>>({});\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.field ? pairs : sortBy(\n pipe<StatsRow, string | number, string | number>(\n order.field === Object.keys(sortingItems)[0] ? pickKeyFromPair : pickValueFromPair,\n toLowerIfString,\n ),\n pairs,\n );\n\n return !order.dir || order.dir === '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-end\">\n <OrderingDropdown\n isButton={false}\n right\n items={sortingItems}\n order={order}\n onChange={(field, dir) => {\n setOrder({ field, dir });\n setCurrentPage(1);\n }}\n />\n </div>\n {withPagination && Object.keys(stats).length > 50 && (\n <div className=\"float-end\">\n <PaginationDropdown\n toggleClassName=\"btn-sm p-0 me-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-end\">\n {extraHeaderContent(pagination ? activeCities : undefined)}\n </div>\n )}\n </>\n );\n\n return (\n <ChartCard\n title={computeTitle}\n footer={pagination}\n >\n <HorizontalBarChart stats={currentPageStats} highlightedStats={currentPageHighlightedStats} max={max} {...rest} />\n </ChartCard>\n );\n};\n","import { useEffect } from 'react';\nimport { useLocation, useParams } from 'react-router-dom';\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 { useGoBack } from '../utils/helpers/hooks';\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 {\n getShortUrlVisits: (shortCode: string, query?: ShlinkVisitsParams, doIntervalFallback?: boolean) => void;\n shortUrlVisits: ShortUrlVisitsState;\n getShortUrlDetail: Function;\n shortUrlDetail: ShortUrlDetail;\n cancelGetShortUrlVisits: () => void;\n}\n\nconst ShortUrlVisits = ({ exportVisits }: VisitsExporter) => boundToMercureHub(({\n shortUrlVisits,\n shortUrlDetail,\n getShortUrlVisits,\n getShortUrlDetail,\n cancelGetShortUrlVisits,\n settings,\n selectedServer,\n}: ShortUrlVisitsProps) => {\n const { shortCode = '' } = useParams<{ shortCode: string }>();\n const { search } = useLocation();\n const goBack = useGoBack();\n const { domain } = parseQuery<{ domain?: string }>(search);\n const loadVisits = (params: VisitsParams, doIntervalFallback?: boolean) =>\n getShortUrlVisits(shortCode, { ...toApiParams(params), domain }, doIntervalFallback);\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 domain={domain}\n settings={settings}\n exportCsv={exportCsv}\n selectedServer={selectedServer}\n >\n <ShortUrlVisitsHeader shortUrlDetail={shortUrlDetail} shortUrlVisits={shortUrlVisits} goBack={goBack} />\n </VisitsStats>\n );\n}, (_, params) => [ Topics.shortUrlVisits(params.shortCode) ]);\n\nexport default ShortUrlVisits;\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=\"me-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 { useParams } from 'react-router-dom';\nimport { boundToMercureHub } from '../mercure/helpers/boundToMercureHub';\nimport ColorGenerator from '../utils/services/ColorGenerator';\nimport { ShlinkVisitsParams } from '../api/types';\nimport { Topics } from '../mercure/helpers/Topics';\nimport { useGoBack } from '../utils/helpers/hooks';\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 {\n getTagVisits: (tag: string, query?: ShlinkVisitsParams, doIntervalFallback?: boolean) => void;\n tagVisits: TagVisitsState;\n cancelGetTagVisits: () => void;\n}\n\nconst TagVisits = (colorGenerator: ColorGenerator, { exportVisits }: VisitsExporter) => boundToMercureHub(({\n getTagVisits,\n tagVisits,\n cancelGetTagVisits,\n settings,\n selectedServer,\n}: TagVisitsProps) => {\n const goBack = useGoBack();\n const { tag = '' } = useParams();\n const loadVisits = (params: ShlinkVisitsParams, doIntervalFallback?: boolean) =>\n getTagVisits(tag, toApiParams(params), doIntervalFallback);\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 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 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 { boundToMercureHub } from '../mercure/helpers/boundToMercureHub';\nimport { ShlinkVisitsParams } from '../api/types';\nimport { Topics } from '../mercure/helpers/Topics';\nimport { useGoBack } from '../utils/helpers/hooks';\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 {\n getOrphanVisits: (\n params?: ShlinkVisitsParams,\n orphanVisitsType?: OrphanVisitType,\n doIntervalFallback?: boolean,\n ) => void;\n orphanVisits: VisitsInfo;\n cancelGetOrphanVisits: () => void;\n}\n\nexport const OrphanVisits = ({ exportVisits }: VisitsExporter) => boundToMercureHub(({\n getOrphanVisits,\n orphanVisits,\n cancelGetOrphanVisits,\n settings,\n selectedServer,\n}: OrphanVisitsProps) => {\n const goBack = useGoBack();\n const exportCsv = (visits: NormalizedVisit[]) => exportVisits('orphan_visits.csv', visits);\n const loadVisits = (params: VisitsParams, doIntervalFallback?: boolean) =>\n getOrphanVisits(toApiParams(params), params.filter?.orphanVisitsType, doIntervalFallback);\n\n return (\n <VisitsStats\n getVisits={loadVisits}\n cancelGetVisits={cancelGetOrphanVisits}\n visitsInfo={orphanVisits}\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 VisitsHeader from './VisitsHeader';\nimport { VisitsInfo } from './types';\nimport './ShortUrlVisitsHeader.scss';\n\ninterface NonOrphanVisitsHeaderProps {\n nonOrphanVisits: VisitsInfo;\n goBack: () => void;\n}\n\nexport const NonOrphanVisitsHeader = ({ nonOrphanVisits, goBack }: NonOrphanVisitsHeaderProps) => {\n const { visits } = nonOrphanVisits;\n\n return <VisitsHeader title=\"Non-orphan visits\" goBack={goBack} visits={visits} />;\n};\n","import { boundToMercureHub } from '../mercure/helpers/boundToMercureHub';\nimport { ShlinkVisitsParams } from '../api/types';\nimport { Topics } from '../mercure/helpers/Topics';\nimport { useGoBack } from '../utils/helpers/hooks';\nimport VisitsStats from './VisitsStats';\nimport { NormalizedVisit, VisitsInfo, VisitsParams } from './types';\nimport { VisitsExporter } from './services/VisitsExporter';\nimport { CommonVisitsProps } from './types/CommonVisitsProps';\nimport { toApiParams } from './types/helpers';\nimport { NonOrphanVisitsHeader } from './NonOrphanVisitsHeader';\n\nexport interface NonOrphanVisitsProps extends CommonVisitsProps {\n getNonOrphanVisits: (params?: ShlinkVisitsParams, doIntervalFallback?: boolean) => void;\n nonOrphanVisits: VisitsInfo;\n cancelGetNonOrphanVisits: () => void;\n}\n\nexport const NonOrphanVisits = ({ exportVisits }: VisitsExporter) => boundToMercureHub(({\n getNonOrphanVisits,\n nonOrphanVisits,\n cancelGetNonOrphanVisits,\n settings,\n selectedServer,\n}: NonOrphanVisitsProps) => {\n const goBack = useGoBack();\n const exportCsv = (visits: NormalizedVisit[]) => exportVisits('non_orphan_visits.csv', visits);\n const loadVisits = (params: VisitsParams, doIntervalFallback?: boolean) =>\n getNonOrphanVisits(toApiParams(params), doIntervalFallback);\n\n return (\n <VisitsStats\n getVisits={loadVisits}\n cancelGetVisits={cancelGetNonOrphanVisits}\n visitsInfo={nonOrphanVisits}\n settings={settings}\n exportCsv={exportCsv}\n selectedServer={selectedServer}\n >\n <NonOrphanVisitsHeader nonOrphanVisits={nonOrphanVisits} goBack={goBack} />\n </VisitsStats>\n );\n}, () => [ Topics.visits ]);\n","import { flatten, prop, range, splitEvery } from 'ramda';\nimport { Action, Dispatch } from 'redux';\nimport { ShlinkPaginator, ShlinkVisits, ShlinkVisitsParams } from '../../api/types';\nimport { Visit } from '../types';\nimport { parseApiError } from '../../api/utils';\nimport { ApiErrorAction } from '../../api/types/actions';\nimport { dateToMatchingInterval } from '../../utils/dates/types';\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>;\ntype LastVisitLoader = () => Promise<Visit | undefined>;\ninterface ActionMap {\n start: string;\n large: string;\n finish: string;\n error: string;\n progress: string;\n fallbackToInterval: string;\n}\n\nexport const getVisitsWithLoader = async <T extends Action<string> & { visits: Visit[] }>(\n visitsLoader: VisitsLoader,\n lastVisitLoader: LastVisitLoader,\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, lastVisit ] = await Promise.all([ loadVisits(), lastVisitLoader() ]);\n\n dispatch(\n !visits.length && lastVisit\n ? { type: actionMap.fallbackToInterval, fallbackInterval: dateToMatchingInterval(lastVisit.date) }\n : { ...extraFinishActionData, visits, type: actionMap.finish },\n );\n } catch (e: any) {\n dispatch<ApiErrorAction>({ type: actionMap.error, errorData: parseApiError(e) });\n }\n};\n\nexport const lastVisitLoaderForLoader = (\n doIntervalFallback: boolean,\n loader: (params: ShlinkVisitsParams) => Promise<ShlinkVisits>,\n): LastVisitLoader => {\n if (!doIntervalFallback) {\n return async () => Promise.resolve(undefined);\n }\n\n return async () => loader({ page: 1, itemsPerPage: 1 }).then((result) => result.data[0]);\n};\n","import { Action, Dispatch } from 'redux';\nimport { shortUrlMatches } from '../../short-urls/helpers';\nimport { Visit, VisitsFallbackIntervalAction, VisitsInfo, 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 { ApiErrorAction } from '../../api/types/actions';\nimport { isBetween } from '../../utils/helpers/date';\nimport { getVisitsWithLoader, lastVisitLoaderForLoader } 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';\nexport const GET_SHORT_URL_VISITS_FALLBACK_TO_INTERVAL = 'shlink/shortUrlVisits/GET_SHORT_URL_VISITS_FALLBACK_TO_INTERVAL';\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 query?: ShlinkVisitsParams;\n}\n\ntype ShortUrlVisitsCombinedAction = ShortUrlVisitsAction\n& VisitsLoadProgressChangedAction\n& VisitsFallbackIntervalAction\n& CreateVisitsAction\n& ApiErrorAction;\n\nconst initialState: ShortUrlVisits = {\n visits: [],\n shortCode: '',\n domain: undefined, // Deprecated. Value from query params can be used instead\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]: (state, { visits, query, shortCode, domain }) => ({\n ...state,\n visits,\n shortCode,\n domain,\n query,\n loading: false,\n error: false,\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 [GET_SHORT_URL_VISITS_FALLBACK_TO_INTERVAL]: (state, { fallbackInterval }) => ({ ...state, fallbackInterval }),\n [CREATE_VISITS]: (state, { createdVisits }) => {\n const { shortCode, domain, visits, query = {} } = state;\n const { startDate, endDate } = query;\n const newVisits = createdVisits\n .filter(\n ({ shortUrl, visit }) =>\n shortUrl && shortUrlMatches(shortUrl, shortCode, domain) && isBetween(visit.date, startDate, endDate),\n )\n .map(({ visit }) => visit);\n\n return newVisits.length === 0 ? state : { ...state, visits: [ ...newVisits, ...visits ] };\n },\n}, initialState);\n\nexport const getShortUrlVisits = (buildShlinkApiClient: ShlinkApiClientBuilder) => (\n shortCode: string,\n query: ShlinkVisitsParams = {},\n doIntervalFallback = false,\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 lastVisitLoader = lastVisitLoaderForLoader(\n doIntervalFallback,\n async (params) => getShortUrlVisits(shortCode, { ...params, domain: query.domain }),\n );\n const shouldCancel = () => getState().shortUrlVisits.cancelLoad;\n const extraFinishActionData: Partial<ShortUrlVisitsAction> = { shortCode, query, 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 fallbackToInterval: GET_SHORT_URL_VISITS_FALLBACK_TO_INTERVAL,\n };\n\n return getVisitsWithLoader(visitsLoader, lastVisitLoader, extraFinishActionData, actionMap, dispatch, shouldCancel);\n};\n\nexport const cancelGetShortUrlVisits = buildActionCreator(GET_SHORT_URL_VISITS_CANCEL);\n","import { Action, Dispatch } from 'redux';\nimport { Visit, VisitsFallbackIntervalAction, VisitsInfo, 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 { ApiErrorAction } from '../../api/types/actions';\nimport { isBetween } from '../../utils/helpers/date';\nimport { getVisitsWithLoader, lastVisitLoaderForLoader } 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';\nexport const GET_TAG_VISITS_FALLBACK_TO_INTERVAL = 'shlink/tagVisits/GET_TAG_VISITS_FALLBACK_TO_INTERVAL';\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 query?: ShlinkVisitsParams;\n}\n\ntype TagsVisitsCombinedAction = TagVisitsAction\n& VisitsLoadProgressChangedAction\n& VisitsFallbackIntervalAction\n& CreateVisitsAction\n& ApiErrorAction;\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]: (state, { visits, tag, query }) => ({ ...state, visits, tag, query, loading: false, error: false }),\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 [GET_TAG_VISITS_FALLBACK_TO_INTERVAL]: (state, { fallbackInterval }) => ({ ...state, fallbackInterval }),\n [CREATE_VISITS]: (state, { createdVisits }) => {\n const { tag, visits, query = {} } = state;\n const { startDate, endDate } = query;\n const newVisits = createdVisits\n .filter(({ shortUrl, visit }) => shortUrl?.tags.includes(tag) && isBetween(visit.date, startDate, endDate))\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 doIntervalFallback = false,\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 lastVisitLoader = lastVisitLoaderForLoader(doIntervalFallback, async (params) => getTagVisits(tag, params));\n const shouldCancel = () => getState().tagVisits.cancelLoad;\n const extraFinishActionData: Partial<TagVisitsAction> = { tag, query };\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 fallbackToInterval: GET_TAG_VISITS_FALLBACK_TO_INTERVAL,\n };\n\n return getVisitsWithLoader(visitsLoader, lastVisitLoader, extraFinishActionData, actionMap, dispatch, shouldCancel);\n};\n\nexport const cancelGetTagVisits = buildActionCreator(GET_TAG_VISITS_CANCEL);\n","import { Action, Dispatch } from 'redux';\nimport {\n OrphanVisit,\n OrphanVisitType,\n Visit,\n VisitsFallbackIntervalAction,\n VisitsInfo,\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 { ApiErrorAction } from '../../api/types/actions';\nimport { isBetween } from '../../utils/helpers/date';\nimport { getVisitsWithLoader, lastVisitLoaderForLoader } 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';\nexport const GET_ORPHAN_VISITS_FALLBACK_TO_INTERVAL = 'shlink/orphanVisits/GET_ORPHAN_VISITS_FALLBACK_TO_INTERVAL';\n/* eslint-enable padding-line-between-statements */\n\nexport interface OrphanVisitsAction extends Action<string> {\n visits: Visit[];\n query?: ShlinkVisitsParams;\n}\n\ntype OrphanVisitsCombinedAction = OrphanVisitsAction\n& VisitsLoadProgressChangedAction\n& VisitsFallbackIntervalAction\n& CreateVisitsAction\n& ApiErrorAction;\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]: (state, { visits, query }) => ({ ...state, visits, query, loading: false, error: false }),\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 [GET_ORPHAN_VISITS_FALLBACK_TO_INTERVAL]: (state, { fallbackInterval }) => ({ ...state, fallbackInterval }),\n [CREATE_VISITS]: (state, { createdVisits }) => {\n const { visits, query = {} } = state;\n const { startDate, endDate } = query;\n const newVisits = createdVisits\n .filter(({ visit, shortUrl }) => !shortUrl && isBetween(visit.date, startDate, endDate))\n .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 doIntervalFallback = false,\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 lastVisitLoader = lastVisitLoaderForLoader(doIntervalFallback, getOrphanVisits);\n const shouldCancel = () => getState().orphanVisits.cancelLoad;\n const extraFinishActionData: Partial<OrphanVisitsAction> = { query };\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 fallbackToInterval: GET_ORPHAN_VISITS_FALLBACK_TO_INTERVAL,\n };\n\n return getVisitsWithLoader(visitsLoader, lastVisitLoader, extraFinishActionData, actionMap, dispatch, shouldCancel);\n};\n\nexport const cancelGetOrphanVisits = buildActionCreator(GET_ORPHAN_VISITS_CANCEL);\n","import { Action, Dispatch } from 'redux';\nimport {\n Visit,\n VisitsFallbackIntervalAction,\n VisitsInfo,\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 { ApiErrorAction } from '../../api/types/actions';\nimport { isBetween } from '../../utils/helpers/date';\nimport { getVisitsWithLoader, lastVisitLoaderForLoader } from './common';\nimport { CREATE_VISITS, CreateVisitsAction } from './visitCreation';\n\n/* eslint-disable padding-line-between-statements */\nexport const GET_NON_ORPHAN_VISITS_START = 'shlink/orphanVisits/GET_NON_ORPHAN_VISITS_START';\nexport const GET_NON_ORPHAN_VISITS_ERROR = 'shlink/orphanVisits/GET_NON_ORPHAN_VISITS_ERROR';\nexport const GET_NON_ORPHAN_VISITS = 'shlink/orphanVisits/GET_NON_ORPHAN_VISITS';\nexport const GET_NON_ORPHAN_VISITS_LARGE = 'shlink/orphanVisits/GET_NON_ORPHAN_VISITS_LARGE';\nexport const GET_NON_ORPHAN_VISITS_CANCEL = 'shlink/orphanVisits/GET_NON_ORPHAN_VISITS_CANCEL';\nexport const GET_NON_ORPHAN_VISITS_PROGRESS_CHANGED = 'shlink/orphanVisits/GET_NON_ORPHAN_VISITS_PROGRESS_CHANGED';\nexport const GET_NON_ORPHAN_VISITS_FALLBACK_TO_INTERVAL = 'shlink/orphanVisits/GET_NON_ORPHAN_VISITS_FALLBACK_TO_INTERVAL';\n/* eslint-enable padding-line-between-statements */\n\nexport interface NonOrphanVisitsAction extends Action<string> {\n visits: Visit[];\n query?: ShlinkVisitsParams;\n}\n\ntype NonOrphanVisitsCombinedAction = NonOrphanVisitsAction\n& VisitsLoadProgressChangedAction\n& VisitsFallbackIntervalAction\n& CreateVisitsAction\n& ApiErrorAction;\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, NonOrphanVisitsCombinedAction>({\n [GET_NON_ORPHAN_VISITS_START]: () => ({ ...initialState, loading: true }),\n [GET_NON_ORPHAN_VISITS_ERROR]: (_, { errorData }) => ({ ...initialState, error: true, errorData }),\n [GET_NON_ORPHAN_VISITS]: (state, { visits, query }) => ({ ...state, visits, query, loading: false, error: false }),\n [GET_NON_ORPHAN_VISITS_LARGE]: (state) => ({ ...state, loadingLarge: true }),\n [GET_NON_ORPHAN_VISITS_CANCEL]: (state) => ({ ...state, cancelLoad: true }),\n [GET_NON_ORPHAN_VISITS_PROGRESS_CHANGED]: (state, { progress }) => ({ ...state, progress }),\n [GET_NON_ORPHAN_VISITS_FALLBACK_TO_INTERVAL]: (state, { fallbackInterval }) => ({ ...state, fallbackInterval }),\n [CREATE_VISITS]: (state, { createdVisits }) => {\n const { visits, query = {} } = state;\n const { startDate, endDate } = query;\n const newVisits = createdVisits\n .filter(({ visit }) => isBetween(visit.date, startDate, endDate))\n .map(({ visit }) => visit);\n\n return { ...state, visits: [ ...newVisits, ...visits ] };\n },\n}, initialState);\n\nexport const getNonOrphanVisits = (buildShlinkApiClient: ShlinkApiClientBuilder) => (\n query: ShlinkVisitsParams = {},\n doIntervalFallback = false,\n) => async (dispatch: Dispatch, getState: GetState) => {\n const { getNonOrphanVisits } = buildShlinkApiClient(getState);\n const visitsLoader = async (page: number, itemsPerPage: number) =>\n getNonOrphanVisits({ ...query, page, itemsPerPage });\n const lastVisitLoader = lastVisitLoaderForLoader(doIntervalFallback, getNonOrphanVisits);\n const shouldCancel = () => getState().orphanVisits.cancelLoad;\n const extraFinishActionData: Partial<NonOrphanVisitsAction> = { query };\n const actionMap = {\n start: GET_NON_ORPHAN_VISITS_START,\n large: GET_NON_ORPHAN_VISITS_LARGE,\n finish: GET_NON_ORPHAN_VISITS,\n error: GET_NON_ORPHAN_VISITS_ERROR,\n progress: GET_NON_ORPHAN_VISITS_PROGRESS_CHANGED,\n fallbackToInterval: GET_NON_ORPHAN_VISITS_FALLBACK_TO_INTERVAL,\n };\n\n return getVisitsWithLoader(visitsLoader, lastVisitLoader, extraFinishActionData, actionMap, dispatch, shouldCancel);\n};\n\nexport const cancelGetNonOrphanVisits = buildActionCreator(GET_NON_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/files';\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 MapModal from '../helpers/MapModal';\nimport { createNewVisits } from '../reducers/visitCreation';\nimport ShortUrlVisits from '../ShortUrlVisits';\nimport TagVisits from '../TagVisits';\nimport { OrphanVisits } from '../OrphanVisits';\nimport { NonOrphanVisits } from '../NonOrphanVisits';\nimport { cancelGetShortUrlVisits, getShortUrlVisits } from '../reducers/shortUrlVisits';\nimport { cancelGetTagVisits, getTagVisits } from '../reducers/tagVisits';\nimport { cancelGetOrphanVisits, getOrphanVisits } from '../reducers/orphanVisits';\nimport { cancelGetNonOrphanVisits, getNonOrphanVisits } from '../reducers/nonOrphanVisits';\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 bottle.serviceFactory('NonOrphanVisits', NonOrphanVisits, 'VisitsExporter');\n bottle.decorator('NonOrphanVisits', connect(\n [ 'nonOrphanVisits', 'mercureInfo', 'settings', 'selectedServer' ],\n [ 'getNonOrphanVisits', 'cancelGetNonOrphanVisits', '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('getNonOrphanVisits', getNonOrphanVisits, 'buildShlinkApiClient');\n bottle.serviceFactory('cancelGetNonOrphanVisits', () => cancelGetNonOrphanVisits);\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 { Settings } from '../../settings/reducers/settings';\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 settings: Settings;\n}\n\nconst toComponentTag = (tag: string) => ({ id: tag, name: tag });\n\nconst TagsSelector = (colorGenerator: ColorGenerator) => (\n { selectedTags, onChange, placeholder, listTags, tagsList, settings }: TagsSelectorConnectProps,\n) => {\n useEffect(() => {\n listTags();\n }, []);\n\n const searchMode = settings.shortUrlCreation?.tagFilteringMode ?? 'startsWith';\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 ?? 'Add tags to the URL'}\n minQueryLength={1}\n delimiters={[ 'Enter', 'Tab', ',' ]}\n suggestionsTransform={\n searchMode === 'includes'\n ? (query, suggestions) => suggestions.filter(({ name }) => name.includes(query))\n : undefined\n }\n onDelete={(removedTagIndex) => {\n const tagsCopy = [ ...selectedTags ];\n\n tagsCopy.splice(removedTagIndex, 1);\n onChange(tagsCopy);\n }}\n onAddition={({ name: newTag }) => onChange(\n // * Avoid duplicated tags (thanks to the Set),\n // * Split any of the new tags by comma, allowing to paste multiple comma-separated tags at once.\n [ ...new Set([ ...selectedTags, ...newTag.toLowerCase().split(',') ]) ],\n )}\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, useEffect, useRef } from 'react';\nimport { Link } from 'react-router-dom';\nimport { prettify } from '../utils/helpers/numbers';\nimport { useToggle } from '../utils/helpers/hooks';\nimport ColorGenerator from '../utils/services/ColorGenerator';\nimport { getServerId, SelectedServer } from '../servers/data';\nimport TagBullet from './helpers/TagBullet';\nimport { NormalizedTag, TagModalProps } from './data';\nimport './TagCard.scss';\n\nexport interface TagCardProps {\n tag: NormalizedTag;\n selectedServer: SelectedServer;\n displayed: boolean;\n toggle: () => void;\n}\n\nconst isTruncated = (el: HTMLElement | undefined): boolean => !!el && el.scrollWidth > el.clientWidth;\n\nconst TagCard = (\n DeleteTagConfirmModal: FC<TagModalProps>,\n EditTagModal: FC<TagModalProps>,\n colorGenerator: ColorGenerator,\n) => ({ tag, selectedServer, displayed, toggle }: TagCardProps) => {\n const [ isDeleteModalOpen, toggleDelete ] = useToggle();\n const [ isEditModalOpen, toggleEdit ] = useToggle();\n const [ hasTitle,, displayTitle ] = useToggle();\n const titleRef = useRef<HTMLElement>();\n const serverId = getServerId(selectedServer);\n\n useEffect(() => {\n if (isTruncated(titleRef.current)) {\n displayTitle();\n }\n }, [ titleRef.current ]);\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\n className=\"tag-card__tag-title text-ellipsis\"\n title={hasTitle ? tag.tag : undefined}\n ref={(el) => {\n titleRef.current = el ?? undefined;\n }}\n >\n <TagBullet tag={tag.tag} colorGenerator={colorGenerator} />\n <span className=\"tag-card__tag-name\" onClick={toggle}>{tag.tag}</span>\n </h5>\n </CardHeader>\n\n <Collapse isOpen={displayed}>\n <CardBody className=\"tag-card__body\">\n <Link\n to={`/server/${serverId}/list-short-urls/1?tags=${encodeURIComponent(tag.tag)}`}\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=\"me-2\" />Short URLs</span>\n <b>{prettify(tag.shortUrls)}</b>\n </Link>\n <Link\n to={`/server/${serverId}/tag/${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=\"me-2\" />Visits</span>\n <b>{prettify(tag.visits)}</b>\n </Link>\n </CardBody>\n </Collapse>\n\n <DeleteTagConfirmModal tag={tag.tag} toggle={toggleDelete} isOpen={isDeleteModalOpen} />\n <EditTagModal tag={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 { Button, Input, Modal, ModalBody, ModalFooter, ModalHeader, Popover, InputGroup } from 'reactstrap';\nimport { HexColorPicker } from 'react-colorful';\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(\n async () => editTag(tag, newTagName, color)\n .then(() => tagEdited(tag, newTagName, color))\n .then(toggle)\n .catch(() => {}),\n );\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 <InputGroup>\n <div\n id=\"colorPickerBtn\"\n className=\"input-group-text edit-tag-modal__color-picker-toggle\"\n style={{ backgroundColor: color, borderColor: color }}\n onClick={toggleColorPicker}\n >\n <FontAwesomeIcon icon={colorIcon} className=\"edit-tag-modal__color-icon\" />\n </div>\n <Popover\n isOpen={showColorPicker}\n toggle={toggleColorPicker}\n target=\"colorPickerBtn\"\n placement=\"right\"\n hideArrow\n popperClassName=\"edit-tag-modal__popover\"\n >\n <HexColorPicker color={color} onChange={setColor} />\n </Popover>\n <Input\n value={newTagName}\n placeholder=\"Tag\"\n required\n onChange={({ target }) => setNewTagName(target.value)}\n />\n </InputGroup>\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\" color=\"link\" onClick={toggle}>Cancel</Button>\n <Button color=\"primary\" disabled={editing}>{editing ? 'Saving...' : 'Save'}</Button>\n </ModalFooter>\n </form>\n </Modal>\n );\n};\n\nexport default EditTagModal;\n","import { SelectedServer } from '../../servers/data';\nimport { Order } from '../../utils/helpers/ordering';\nimport { NormalizedTag } from './index';\n\nexport const TAGS_ORDERABLE_FIELDS = {\n tag: 'Tag',\n shortUrls: 'Short URLs',\n visits: 'Visits',\n};\n\nexport type TagsOrderableFields = keyof typeof TAGS_ORDERABLE_FIELDS;\n\nexport type TagsOrder = Order<TagsOrderableFields>;\n\nexport interface TagsListChildrenProps {\n sortedTags: NormalizedTag[];\n selectedServer: SelectedServer;\n}\n","import { FC } from 'react';\nimport { DropdownItem } from 'reactstrap';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faBars as listIcon, faThLarge as cardsIcon } from '@fortawesome/free-solid-svg-icons';\nimport { DropdownBtn } from '../utils/DropdownBtn';\nimport { TagsMode } from '../settings/reducers/settings';\n\ninterface TagsModeDropdownProps {\n mode: TagsMode;\n onChange: (newMode: TagsMode) => void;\n renderTitle?: (mode: TagsMode) => string;\n}\n\nexport const TagsModeDropdown: FC<TagsModeDropdownProps> = ({ mode, onChange, renderTitle }) => (\n <DropdownBtn text={renderTitle?.(mode) ?? `Display mode: ${mode}`}>\n <DropdownItem active={mode === 'cards'} onClick={() => onChange('cards')}>\n <FontAwesomeIcon icon={cardsIcon} fixedWidth className=\"me-1\" /> Cards\n </DropdownItem>\n <DropdownItem active={mode === 'list'} onClick={() => onChange('list')}>\n <FontAwesomeIcon icon={listIcon} fixedWidth className=\"me-1\" /> List\n </DropdownItem>\n </DropdownBtn>\n);\n","import { FC, useEffect, useState } from 'react';\nimport { Row } from 'reactstrap';\nimport { pipe } 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 { Settings, TagsMode } from '../settings/reducers/settings';\nimport { determineOrderDir, sortList } from '../utils/helpers/ordering';\nimport { OrderingDropdown } from '../utils/OrderingDropdown';\nimport { TagsList as TagsListState } from './reducers/tagsList';\nimport {\n TagsOrderableFields,\n TAGS_ORDERABLE_FIELDS,\n TagsListChildrenProps,\n TagsOrder,\n} from './data/TagsListChildrenProps';\nimport { TagsModeDropdown } from './TagsModeDropdown';\nimport { NormalizedTag } from './data';\nimport { TagsTableProps } from './TagsTable';\n\nexport interface TagsListProps {\n filterTags: (searchTerm: string) => void;\n forceListTags: Function;\n tagsList: TagsListState;\n selectedServer: SelectedServer;\n settings: Settings;\n}\n\nconst TagsList = (TagsCards: FC<TagsListChildrenProps>, TagsTable: FC<TagsTableProps>) => boundToMercureHub((\n { filterTags, forceListTags, tagsList, selectedServer, settings }: TagsListProps,\n) => {\n const [ mode, setMode ] = useState<TagsMode>(settings.tags?.defaultMode ?? 'cards');\n const [ order, setOrder ] = useState<TagsOrder>(settings.tags?.defaultOrdering ?? {});\n const resolveSortedTags = pipe(\n () => tagsList.filteredTags.map((tag): NormalizedTag => ({\n tag,\n shortUrls: tagsList.stats[tag]?.shortUrlsCount ?? 0,\n visits: tagsList.stats[tag]?.visitsCount ?? 0,\n })),\n (normalizedTags) => sortList<NormalizedTag>(normalizedTags, order),\n );\n\n useEffect(() => {\n forceListTags();\n }, []);\n\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 orderByColumn = (field: TagsOrderableFields) => () => {\n const dir = determineOrderDir(field, order.field, order.dir);\n\n setOrder({ field: dir ? field : undefined, dir });\n };\n\n const renderContent = () => {\n if (tagsList.filteredTags.length < 1) {\n return <Message>No tags found</Message>;\n }\n\n const sortedTags = resolveSortedTags();\n\n return mode === 'cards'\n ? <TagsCards sortedTags={sortedTags} selectedServer={selectedServer} />\n : (\n <TagsTable\n sortedTags={sortedTags}\n selectedServer={selectedServer}\n currentOrder={order}\n orderByColumn={orderByColumn}\n />\n );\n };\n\n return (\n <>\n <SearchField className=\"mb-3\" onChange={filterTags} />\n <Row className=\"mb-3\">\n <div className=\"col-lg-6\">\n <TagsModeDropdown mode={mode} onChange={setMode} />\n </div>\n <div className=\"col-lg-6 mt-3 mt-lg-0\">\n <OrderingDropdown\n items={TAGS_ORDERABLE_FIELDS}\n order={order}\n onChange={(field, dir) => setOrder({ field, dir })}\n />\n </div>\n </Row>\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';\nimport { ApiErrorAction } from '../../api/types/actions';\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\nconst initialState: TagDeletion = {\n deleting: false,\n error: false,\n};\n\nexport default buildReducer<TagDeletion, ApiErrorAction>({\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: any) {\n dispatch<ApiErrorAction>({ 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';\nimport { ApiErrorAction } from '../../api/types/actions';\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\nconst initialState: TagEdition = {\n oldName: '',\n newName: '',\n editing: false,\n error: false,\n};\n\nexport default buildReducer<TagEdition, EditTagAction & ApiErrorAction>({\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: any) {\n dispatch<ApiErrorAction>({ 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 { ApiErrorAction } from '../../api/types/actions';\nimport { CREATE_SHORT_URL, CreateShortUrlAction } from '../../short-urls/reducers/shortUrlCreation';\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 FilterTagsAction extends Action<string> {\n searchTerm: string;\n}\n\ntype TagsCombinedAction = ListTagsAction\n& DeleteTagAction\n& CreateVisitsAction\n& CreateShortUrlAction\n& EditTagAction\n& FilterTagsAction\n& ApiErrorAction;\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, TagsCombinedAction>({\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 [CREATE_SHORT_URL]: ({ tags: stateTags, ...rest }, { result }) => ({\n ...rest,\n tags: stateTags.concat(result.tags.filter((tag) => !stateTags.includes(tag))), // More performant than [ ...new Set(...) ]\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: any) {\n dispatch<ApiErrorAction>({ type: LIST_TAGS_ERROR, errorData: parseApiError(e) });\n }\n};\n\nexport const filterTags = (searchTerm: string): FilterTagsAction => ({ type: FILTER_TAGS, searchTerm });\n","import { FC, useState } from 'react';\nimport { splitEvery } from 'ramda';\nimport { Row } from 'reactstrap';\nimport { TagCardProps } from './TagCard';\nimport { TagsListChildrenProps } from './data/TagsListChildrenProps';\n\nconst { ceil } = Math;\nconst TAGS_GROUPS_AMOUNT = 4;\n\nexport const TagsCards = (TagCard: FC<TagCardProps>): FC<TagsListChildrenProps> => ({ sortedTags, selectedServer }) => {\n const [ displayedTag, setDisplayedTag ] = useState<string | undefined>();\n const tagsCount = sortedTags.length;\n const tagsGroups = splitEvery(ceil(tagsCount / TAGS_GROUPS_AMOUNT), sortedTags);\n\n return (\n <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.tag}\n tag={tag}\n selectedServer={selectedServer}\n displayed={displayedTag === tag.tag}\n toggle={() => setDisplayedTag(displayedTag !== tag.tag ? tag.tag : undefined)}\n />\n ))}\n </div>\n ))}\n </Row>\n );\n};\n","import { FC, useEffect, useRef } from 'react';\nimport { splitEvery } from 'ramda';\nimport { useLocation } from 'react-router-dom';\nimport { SimpleCard } from '../utils/SimpleCard';\nimport SimplePaginator from '../common/SimplePaginator';\nimport { useQueryState } from '../utils/helpers/hooks';\nimport { parseQuery } from '../utils/helpers/query';\nimport { TableOrderIcon } from '../utils/table/TableOrderIcon';\nimport { TagsOrderableFields, TagsListChildrenProps, TagsOrder } from './data/TagsListChildrenProps';\nimport { TagsTableRowProps } from './TagsTableRow';\nimport './TagsTable.scss';\n\nexport interface TagsTableProps extends TagsListChildrenProps {\n orderByColumn: (field: TagsOrderableFields) => () => void;\n currentOrder: TagsOrder;\n}\n\nconst TAGS_PER_PAGE = 20; // TODO Allow customizing this value in settings\n\nexport const TagsTable = (TagsTableRow: FC<TagsTableRowProps>) => (\n { sortedTags, selectedServer, orderByColumn, currentOrder }: TagsTableProps,\n) => {\n const isFirstLoad = useRef(true);\n const { search } = useLocation();\n const { page: pageFromQuery = 1 } = parseQuery<{ page?: number | string }>(search);\n const [ page, setPage ] = useQueryState<number>('page', Number(pageFromQuery));\n const pages = splitEvery(TAGS_PER_PAGE, sortedTags);\n const showPaginator = pages.length > 1;\n const currentPage = pages[page - 1] ?? [];\n\n useEffect(() => {\n !isFirstLoad.current && setPage(1);\n isFirstLoad.current = false;\n }, [ sortedTags ]);\n useEffect(() => {\n scrollTo(0, 0);\n }, [ page ]);\n\n return (\n <SimpleCard key={page} bodyClassName={showPaginator ? 'pb-1' : ''}>\n <table className=\"table table-hover responsive-table mb-0\">\n <thead className=\"responsive-table__header\">\n <tr>\n <th className=\"tags-table__header-cell\" onClick={orderByColumn('tag')}>\n Tag <TableOrderIcon currentOrder={currentOrder} field=\"tag\" />\n </th>\n <th className=\"tags-table__header-cell text-lg-end\" onClick={orderByColumn('shortUrls')}>\n Short URLs <TableOrderIcon currentOrder={currentOrder} field=\"shortUrls\" />\n </th>\n <th className=\"tags-table__header-cell text-lg-end\" onClick={orderByColumn('visits')}>\n Visits <TableOrderIcon currentOrder={currentOrder} field=\"visits\" />\n </th>\n <th className=\"tags-table__header-cell\" />\n </tr>\n <tr><th colSpan={4} className=\"p-0 border-top-0\" /></tr>\n </thead>\n <tbody>\n {currentPage.length === 0 && <tr><td colSpan={4} className=\"text-center\">No results found</td></tr>}\n {currentPage.map((tag) => <TagsTableRow key={tag.tag} tag={tag} selectedServer={selectedServer} />)}\n </tbody>\n </table>\n\n {showPaginator && (\n <div className=\"sticky-card-paginator\">\n <SimplePaginator pagesCount={pages.length} currentPage={page} setCurrentPage={setPage} />\n </div>\n )}\n </SimpleCard>\n );\n};\n","import { FC } from 'react';\nimport { Link } from 'react-router-dom';\nimport { DropdownItem } from 'reactstrap';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faTrash as deleteIcon, faPencilAlt as editIcon } from '@fortawesome/free-solid-svg-icons';\nimport { getServerId, SelectedServer } from '../servers/data';\nimport ColorGenerator from '../utils/services/ColorGenerator';\nimport { prettify } from '../utils/helpers/numbers';\nimport { useToggle } from '../utils/helpers/hooks';\nimport { DropdownBtnMenu } from '../utils/DropdownBtnMenu';\nimport TagBullet from './helpers/TagBullet';\nimport { NormalizedTag, TagModalProps } from './data';\n\nexport interface TagsTableRowProps {\n tag: NormalizedTag;\n selectedServer: SelectedServer;\n}\n\nexport const TagsTableRow = (\n DeleteTagConfirmModal: FC<TagModalProps>,\n EditTagModal: FC<TagModalProps>,\n colorGenerator: ColorGenerator,\n) => ({ tag, selectedServer }: TagsTableRowProps) => {\n const [ isDeleteModalOpen, toggleDelete ] = useToggle();\n const [ isEditModalOpen, toggleEdit ] = useToggle();\n const [ isDropdownOpen, toggleDropdown ] = useToggle();\n const serverId = getServerId(selectedServer);\n\n return (\n <tr className=\"responsive-table__row\">\n <th className=\"responsive-table__cell\" data-th=\"Tag\">\n <TagBullet tag={tag.tag} colorGenerator={colorGenerator} /> {tag.tag}\n </th>\n <td className=\"responsive-table__cell text-lg-end\" data-th=\"Short URLs\">\n <Link to={`/server/${serverId}/list-short-urls/1?tags=${encodeURIComponent(tag.tag)}`}>\n {prettify(tag.shortUrls)}\n </Link>\n </td>\n <td className=\"responsive-table__cell text-lg-end\" data-th=\"Visits\">\n <Link to={`/server/${serverId}/tag/${tag.tag}/visits`}>\n {prettify(tag.visits)}\n </Link>\n </td>\n <td className=\"responsive-table__cell text-lg-end\">\n <DropdownBtnMenu toggle={toggleDropdown} isOpen={isDropdownOpen}>\n <DropdownItem onClick={toggleEdit}>\n <FontAwesomeIcon icon={editIcon} fixedWidth className=\"me-1\" /> Edit\n </DropdownItem>\n <DropdownItem onClick={toggleDelete}>\n <FontAwesomeIcon icon={deleteIcon} fixedWidth className=\"me-1\" /> Delete\n </DropdownItem>\n </DropdownBtnMenu>\n </td>\n\n <EditTagModal tag={tag.tag} toggle={toggleEdit} isOpen={isEditModalOpen} />\n <DeleteTagConfirmModal tag={tag.tag} toggle={toggleDelete} isOpen={isDeleteModalOpen} />\n </tr>\n );\n};\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';\nimport { TagsCards } from '../TagsCards';\nimport { TagsTable } from '../TagsTable';\nimport { TagsTableRow } from '../TagsTableRow';\n\nconst provideServices = (bottle: Bottle, connect: ConnectDecorator) => {\n // Components\n bottle.serviceFactory('TagsSelector', TagsSelector, 'ColorGenerator');\n bottle.decorator('TagsSelector', connect([ 'tagsList', 'settings' ], [ 'listTags' ]));\n\n bottle.serviceFactory('TagCard', TagCard, 'DeleteTagConfirmModal', 'EditTagModal', 'ColorGenerator');\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('TagsCards', TagsCards, 'TagCard');\n bottle.serviceFactory('TagsTableRow', TagsTableRow, 'DeleteTagConfirmModal', 'EditTagModal', 'ColorGenerator');\n\n bottle.serviceFactory('TagsTable', TagsTable, 'TagsTableRow');\n\n bottle.serviceFactory('TagsList', TagsList, 'TagsCards', 'TagsTable');\n bottle.decorator('TagsList', connect(\n [ 'tagsList', 'selectedServer', 'mercureInfo', 'settings' ],\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 { FC } from 'react';\n\nexport const FormText: FC = ({ children }) => <small className=\"form-text text-muted d-block\">{children}</small>;\n","import { FormGroup, Input } from 'reactstrap';\nimport classNames from 'classnames';\nimport ToggleSwitch from '../utils/ToggleSwitch';\nimport { SimpleCard } from '../utils/SimpleCard';\nimport { FormText } from '../utils/forms/FormText';\nimport { LabeledFormGroup } from '../utils/forms/LabeledFormGroup';\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 RealTimeUpdatesSettings = (\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.\n <FormText>\n Real-time updates are currently being <b>{realTimeUpdates.enabled ? 'processed' : 'ignored'}</b>.\n </FormText>\n </ToggleSwitch>\n </FormGroup>\n <LabeledFormGroup\n noMargin\n label=\"Real-time updates frequency (in minutes):\"\n labelClassName={classNames('form-label', { 'text-muted': !realTimeUpdates.enabled })}\n >\n <Input\n type=\"number\"\n min={0}\n placeholder=\"Immediate\"\n disabled={!realTimeUpdates.enabled}\n value={intervalValue(realTimeUpdates.interval)}\n onChange={({ target }) => setRealTimeUpdatesInterval(Number(target.value))}\n />\n {realTimeUpdates.enabled && (\n <FormText>\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 </FormText>\n )}\n </LabeledFormGroup>\n </SimpleCard>\n);\n\nexport default RealTimeUpdatesSettings;\n","import { FC, ReactNode } from 'react';\nimport { Navigate, Routes, Route } from 'react-router-dom';\nimport { NoMenuLayout } from '../common/NoMenuLayout';\nimport { NavPillItem, NavPills } from '../utils/NavPills';\n\nconst SettingsSections: FC<{ items: ReactNode[] }> = ({ items }) => (\n <>\n {items.map((child, index) => <div key={index} className=\"mb-3\">{child}</div>)}\n </>\n);\n\nconst Settings = (\n RealTimeUpdates: FC,\n ShortUrlCreation: FC,\n ShortUrlsList: FC,\n UserInterface: FC,\n Visits: FC,\n Tags: FC,\n) => () => (\n <NoMenuLayout>\n <NavPills className=\"mb-3\">\n <NavPillItem to=\"general\">General</NavPillItem>\n <NavPillItem to=\"short-urls\">Short URLs</NavPillItem>\n <NavPillItem to=\"other-items\">Other items</NavPillItem>\n </NavPills>\n\n <Routes>\n <Route path=\"general\" element={<SettingsSections items={[ <UserInterface key=\"one\" />, <RealTimeUpdates key=\"two\" /> ]} />} />\n <Route path=\"short-urls\" element={<SettingsSections items={[ <ShortUrlCreation key=\"one\" />, <ShortUrlsList key=\"two\" /> ]} />} />\n <Route path=\"other-items\" element={<SettingsSections items={[ <Tags key=\"one\" />, <Visits key=\"two\" /> ]} />} />\n <Route path=\"*\" element={<Navigate replace to=\"general\" />} />\n </Routes>\n </NoMenuLayout>\n);\n\nexport default Settings;\n","import { FC, ReactNode } from 'react';\nimport { DropdownItem, FormGroup } from 'reactstrap';\nimport { SimpleCard } from '../utils/SimpleCard';\nimport ToggleSwitch from '../utils/ToggleSwitch';\nimport { DropdownBtn } from '../utils/DropdownBtn';\nimport { FormText } from '../utils/forms/FormText';\nimport { LabeledFormGroup } from '../utils/forms/LabeledFormGroup';\nimport { Settings, ShortUrlCreationSettings as ShortUrlsSettings, TagFilteringMode } from './reducers/settings';\n\ninterface ShortUrlCreationProps {\n settings: Settings;\n setShortUrlCreationSettings: (settings: ShortUrlsSettings) => void;\n}\n\nconst tagFilteringModeText = (tagFilteringMode: TagFilteringMode | undefined): string =>\n tagFilteringMode === 'includes' ? 'Suggest tags including input' : 'Suggest tags starting with input';\nconst tagFilteringModeHint = (tagFilteringMode: TagFilteringMode | undefined): ReactNode =>\n tagFilteringMode === 'includes'\n ? <>The list of suggested tags will contain those <b>including</b> provided input.</>\n : <>The list of suggested tags will contain those <b>starting with</b> provided input.</>;\n\nexport const ShortUrlCreationSettings: FC<ShortUrlCreationProps> = ({ settings, setShortUrlCreationSettings }) => {\n const shortUrlCreation: ShortUrlsSettings = settings.shortUrlCreation ?? { validateUrls: false };\n const changeTagsFilteringMode = (tagFilteringMode: TagFilteringMode) => () => setShortUrlCreationSettings(\n { ...shortUrlCreation ?? { validateUrls: false }, tagFilteringMode },\n );\n\n return (\n <SimpleCard title=\"Short URLs form\" className=\"h-100\">\n <FormGroup>\n <ToggleSwitch\n checked={shortUrlCreation.validateUrls ?? false}\n onChange={(validateUrls) => setShortUrlCreationSettings({ ...shortUrlCreation, validateUrls })}\n >\n Request validation on long URLs when creating new short URLs.\n <FormText>\n The initial state of the <b>Validate URL</b> checkbox will\n be <b>{shortUrlCreation.validateUrls ? 'checked' : 'unchecked'}</b>.\n </FormText>\n </ToggleSwitch>\n </FormGroup>\n <FormGroup>\n <ToggleSwitch\n checked={shortUrlCreation.forwardQuery ?? true}\n onChange={(forwardQuery) => setShortUrlCreationSettings({ ...shortUrlCreation, forwardQuery })}\n >\n Make all new short URLs forward their query params to the long URL.\n <FormText>\n The initial state of the <b>Forward query params on redirect</b> checkbox will\n be <b>{shortUrlCreation.forwardQuery ?? true ? 'checked' : 'unchecked'}</b>.\n </FormText>\n </ToggleSwitch>\n </FormGroup>\n <LabeledFormGroup noMargin label=\"Tag suggestions search mode:\">\n <DropdownBtn text={tagFilteringModeText(shortUrlCreation.tagFilteringMode)}>\n <DropdownItem\n active={!shortUrlCreation.tagFilteringMode || shortUrlCreation.tagFilteringMode === 'startsWith'}\n onClick={changeTagsFilteringMode('startsWith')}\n >\n {tagFilteringModeText('startsWith')}\n </DropdownItem>\n <DropdownItem\n active={shortUrlCreation.tagFilteringMode === 'includes'}\n onClick={changeTagsFilteringMode('includes')}\n >\n {tagFilteringModeText('includes')}\n </DropdownItem>\n </DropdownBtn>\n <FormText>{tagFilteringModeHint(shortUrlCreation.tagFilteringMode)}</FormText>\n </LabeledFormGroup>\n </SimpleCard>\n );\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 './UserInterfaceSettings.scss';\n\ninterface UserInterfaceProps {\n settings: Settings;\n setUiSettings: (settings: UiSettings) => void;\n}\n\nexport const UserInterfaceSettings: 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({ ...ui, 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, allText }) => (\n <DropdownBtn text={rangeOrIntervalToString(active) ?? allText}>\n <DateIntervalDropdownItems allText={allText} active={active} onChange={onChange} />\n </DropdownBtn>\n);\n","import { FC } from 'react';\nimport { SimpleCard } from '../utils/SimpleCard';\nimport { DateIntervalSelector } from '../utils/dates/DateIntervalSelector';\nimport { LabeledFormGroup } from '../utils/forms/LabeledFormGroup';\nimport { Settings, VisitsSettings as VisitsSettingsConfig } from './reducers/settings';\n\ninterface VisitsProps {\n settings: Settings;\n setVisitsSettings: (settings: VisitsSettingsConfig) => void;\n}\n\nexport const VisitsSettings: FC<VisitsProps> = ({ settings, setVisitsSettings }) => (\n <SimpleCard title=\"Visits\" className=\"h-100\">\n <LabeledFormGroup noMargin label=\"Default interval to load on visits sections:\">\n <DateIntervalSelector\n allText=\"All visits\"\n active={settings.visits?.defaultInterval ?? 'last30Days'}\n onChange={(defaultInterval) => setVisitsSettings({ defaultInterval })}\n />\n </LabeledFormGroup>\n </SimpleCard>\n);\n","import { FC } from 'react';\nimport { SimpleCard } from '../utils/SimpleCard';\nimport { TagsModeDropdown } from '../tags/TagsModeDropdown';\nimport { capitalize } from '../utils/utils';\nimport { OrderingDropdown } from '../utils/OrderingDropdown';\nimport { TAGS_ORDERABLE_FIELDS } from '../tags/data/TagsListChildrenProps';\nimport { FormText } from '../utils/forms/FormText';\nimport { LabeledFormGroup } from '../utils/forms/LabeledFormGroup';\nimport { Settings, TagsSettings as TagsSettingsOptions } from './reducers/settings';\n\ninterface TagsProps {\n settings: Settings;\n setTagsSettings: (settings: TagsSettingsOptions) => void;\n}\n\nexport const TagsSettings: FC<TagsProps> = ({ settings: { tags }, setTagsSettings }) => (\n <SimpleCard title=\"Tags\" className=\"h-100\">\n <LabeledFormGroup label=\"Default display mode when managing tags:\">\n <TagsModeDropdown\n mode={tags?.defaultMode ?? 'cards'}\n renderTitle={(tagsMode) => capitalize(tagsMode)}\n onChange={(defaultMode) => setTagsSettings({ ...tags, defaultMode })}\n />\n <FormText>Tags will be displayed as <b>{tags?.defaultMode ?? 'cards'}</b>.</FormText>\n </LabeledFormGroup>\n <LabeledFormGroup noMargin label=\"Default ordering for tags list:\">\n <OrderingDropdown\n items={TAGS_ORDERABLE_FIELDS}\n order={tags?.defaultOrdering ?? {}}\n onChange={(field, dir) => setTagsSettings({ ...tags, defaultOrdering: { field, dir } })}\n />\n </LabeledFormGroup>\n </SimpleCard>\n);\n","import { FC } from 'react';\nimport { OrderingDropdown } from '../utils/OrderingDropdown';\nimport { SHORT_URLS_ORDERABLE_FIELDS } from '../short-urls/data';\nimport { SimpleCard } from '../utils/SimpleCard';\nimport { LabeledFormGroup } from '../utils/forms/LabeledFormGroup';\nimport { DEFAULT_SHORT_URLS_ORDERING, Settings, ShortUrlsListSettings as ShortUrlsSettings } from './reducers/settings';\n\ninterface ShortUrlsListProps {\n settings: Settings;\n setShortUrlsListSettings: (settings: ShortUrlsSettings) => void;\n}\n\nexport const ShortUrlsListSettings: FC<ShortUrlsListProps> = (\n { settings: { shortUrlsList }, setShortUrlsListSettings },\n) => (\n <SimpleCard title=\"Short URLs list\" className=\"h-100\">\n <LabeledFormGroup noMargin label=\"Default ordering for short URLs list:\">\n <OrderingDropdown\n items={SHORT_URLS_ORDERABLE_FIELDS}\n order={shortUrlsList?.defaultOrdering ?? DEFAULT_SHORT_URLS_ORDERING}\n onChange={(field, dir) => setShortUrlsListSettings({ defaultOrdering: { field, dir } })}\n />\n </LabeledFormGroup>\n </SimpleCard>\n);\n","import Bottle from 'bottlejs';\nimport RealTimeUpdatesSettings from '../RealTimeUpdatesSettings';\nimport Settings from '../Settings';\nimport {\n setRealTimeUpdatesInterval,\n setShortUrlCreationSettings,\n setShortUrlsListSettings,\n setTagsSettings,\n setUiSettings,\n setVisitsSettings,\n toggleRealTimeUpdates,\n} from '../reducers/settings';\nimport { ConnectDecorator } from '../../container/types';\nimport { withoutSelectedServer } from '../../servers/helpers/withoutSelectedServer';\nimport { ShortUrlCreationSettings } from '../ShortUrlCreationSettings';\nimport { UserInterfaceSettings } from '../UserInterfaceSettings';\nimport { VisitsSettings } from '../VisitsSettings';\nimport { TagsSettings } from '../TagsSettings';\nimport { ShortUrlsListSettings } from '../ShortUrlsListSettings';\n\nconst provideServices = (bottle: Bottle, connect: ConnectDecorator) => {\n // Components\n bottle.serviceFactory(\n 'Settings',\n Settings,\n 'RealTimeUpdatesSettings',\n 'ShortUrlCreationSettings',\n 'ShortUrlsListSettings',\n 'UserInterfaceSettings',\n 'VisitsSettings',\n 'TagsSettings',\n );\n bottle.decorator('Settings', withoutSelectedServer);\n bottle.decorator('Settings', connect(null, [ 'resetSelectedServer' ]));\n\n bottle.serviceFactory('RealTimeUpdatesSettings', () => RealTimeUpdatesSettings);\n bottle.decorator(\n 'RealTimeUpdatesSettings',\n connect([ 'settings' ], [ 'toggleRealTimeUpdates', 'setRealTimeUpdatesInterval' ]),\n );\n\n bottle.serviceFactory('ShortUrlCreationSettings', () => ShortUrlCreationSettings);\n bottle.decorator('ShortUrlCreationSettings', connect([ 'settings' ], [ 'setShortUrlCreationSettings' ]));\n\n bottle.serviceFactory('UserInterfaceSettings', () => UserInterfaceSettings);\n bottle.decorator('UserInterfaceSettings', connect([ 'settings' ], [ 'setUiSettings' ]));\n\n bottle.serviceFactory('VisitsSettings', () => VisitsSettings);\n bottle.decorator('VisitsSettings', connect([ 'settings' ], [ 'setVisitsSettings' ]));\n\n bottle.serviceFactory('TagsSettings', () => TagsSettings);\n bottle.decorator('TagsSettings', connect([ 'settings' ], [ 'setTagsSettings' ]));\n\n bottle.serviceFactory('ShortUrlsListSettings', () => ShortUrlsListSettings);\n bottle.decorator('ShortUrlsListSettings', connect([ 'settings' ], [ 'setShortUrlsListSettings' ]));\n\n // Actions\n bottle.serviceFactory('toggleRealTimeUpdates', () => toggleRealTimeUpdates);\n bottle.serviceFactory('setRealTimeUpdatesInterval', () => setRealTimeUpdatesInterval);\n bottle.serviceFactory('setShortUrlCreationSettings', () => setShortUrlCreationSettings);\n bottle.serviceFactory('setShortUrlsListSettings', () => setShortUrlsListSettings);\n bottle.serviceFactory('setUiSettings', () => setUiSettings);\n bottle.serviceFactory('setVisitsSettings', () => setVisitsSettings);\n bottle.serviceFactory('setTagsSettings', () => setTagsSettings);\n};\n\nexport default provideServices;\n","export const replaceAuthorityFromUri = (uri: string, newAuthority: string): string => {\n const [ schema, rest ] = uri.split('://');\n const [ , ...pathParts ] = rest.split('/');\n const normalizedPath = pathParts.length ? `/${pathParts.join('/')}` : '';\n\n return `${schema}://${newAuthority}${normalizedPath}`;\n};\n","import { Action, Dispatch } from 'redux';\nimport { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';\nimport { ShlinkDomainRedirects } from '../../api/types';\nimport { GetState } from '../../container/types';\nimport { ApiErrorAction } from '../../api/types/actions';\nimport { parseApiError } from '../../api/utils';\n\n/* eslint-disable padding-line-between-statements */\nexport const EDIT_DOMAIN_REDIRECTS_START = 'shlink/domainRedirects/EDIT_DOMAIN_REDIRECTS_START';\nexport const EDIT_DOMAIN_REDIRECTS_ERROR = 'shlink/domainRedirects/EDIT_DOMAIN_REDIRECTS_ERROR';\nexport const EDIT_DOMAIN_REDIRECTS = 'shlink/domainRedirects/EDIT_DOMAIN_REDIRECTS';\n/* eslint-enable padding-line-between-statements */\n\nexport interface EditDomainRedirectsAction extends Action<string> {\n domain: string;\n redirects: ShlinkDomainRedirects;\n}\n\nexport const editDomainRedirects = (buildShlinkApiClient: ShlinkApiClientBuilder) => (\n domain: string,\n domainRedirects: Partial<ShlinkDomainRedirects>,\n) => async (dispatch: Dispatch, getState: GetState) => {\n dispatch({ type: EDIT_DOMAIN_REDIRECTS_START });\n const { editDomainRedirects } = buildShlinkApiClient(getState);\n\n try {\n const redirects = await editDomainRedirects({ domain, ...domainRedirects });\n\n dispatch<EditDomainRedirectsAction>({ type: EDIT_DOMAIN_REDIRECTS, domain, redirects });\n } catch (e: any) {\n dispatch<ApiErrorAction>({ type: EDIT_DOMAIN_REDIRECTS_ERROR, errorData: parseApiError(e) });\n }\n};\n","import { Action, Dispatch } from 'redux';\nimport { ProblemDetailsError, ShlinkDomainRedirects } from '../../api/types';\nimport { buildReducer } from '../../utils/helpers/redux';\nimport { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';\nimport { GetState } from '../../container/types';\nimport { parseApiError } from '../../api/utils';\nimport { ApiErrorAction } from '../../api/types/actions';\nimport { Domain, DomainStatus } from '../data';\nimport { hasServerData } from '../../servers/data';\nimport { replaceAuthorityFromUri } from '../../utils/helpers/uri';\nimport { EDIT_DOMAIN_REDIRECTS, EditDomainRedirectsAction } from './domainRedirects';\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';\nexport const FILTER_DOMAINS = 'shlink/domainsList/FILTER_DOMAINS';\nexport const VALIDATE_DOMAIN = 'shlink/domainsList/VALIDATE_DOMAIN';\n/* eslint-enable padding-line-between-statements */\n\nexport interface DomainsList {\n domains: Domain[];\n filteredDomains: Domain[];\n defaultRedirects?: ShlinkDomainRedirects;\n loading: boolean;\n error: boolean;\n errorData?: ProblemDetailsError;\n}\n\nexport interface ListDomainsAction extends Action<string> {\n domains: Domain[];\n defaultRedirects?: ShlinkDomainRedirects;\n}\n\ninterface FilterDomainsAction extends Action<string> {\n searchTerm: string;\n}\n\ninterface ValidateDomain extends Action<string> {\n domain: string;\n status: DomainStatus;\n}\n\nconst initialState: DomainsList = {\n domains: [],\n filteredDomains: [],\n loading: false,\n error: false,\n};\n\nexport type DomainsCombinedAction = ListDomainsAction\n& ApiErrorAction\n& FilterDomainsAction\n& EditDomainRedirectsAction\n& ValidateDomain;\n\nexport const replaceRedirectsOnDomain = (domain: string, redirects: ShlinkDomainRedirects) =>\n (d: Domain): Domain => d.domain !== domain ? d : { ...d, redirects };\n\nexport const replaceStatusOnDomain = (domain: string, status: DomainStatus) =>\n (d: Domain): Domain => d.domain !== domain ? d : { ...d, status };\n\nexport default buildReducer<DomainsList, DomainsCombinedAction>({\n [LIST_DOMAINS_START]: () => ({ ...initialState, loading: true }),\n [LIST_DOMAINS_ERROR]: ({ errorData }) => ({ ...initialState, error: true, errorData }),\n [LIST_DOMAINS]: (_, { domains, defaultRedirects }) =>\n ({ ...initialState, domains, filteredDomains: domains, defaultRedirects }),\n [FILTER_DOMAINS]: (state, { searchTerm }) => ({\n ...state,\n filteredDomains: state.domains.filter(({ domain }) => domain.toLowerCase().match(searchTerm)),\n }),\n [EDIT_DOMAIN_REDIRECTS]: (state, { domain, redirects }) => ({\n ...state,\n domains: state.domains.map(replaceRedirectsOnDomain(domain, redirects)),\n filteredDomains: state.filteredDomains.map(replaceRedirectsOnDomain(domain, redirects)),\n }),\n [VALIDATE_DOMAIN]: (state, { domain, status }) => ({\n ...state,\n domains: state.domains.map(replaceStatusOnDomain(domain, status)),\n filteredDomains: state.filteredDomains.map(replaceStatusOnDomain(domain, status)),\n }),\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, defaultRedirects } = await listDomains().then(({ data, defaultRedirects }) => ({\n domains: data.map((domain): Domain => ({ ...domain, status: 'validating' })),\n defaultRedirects,\n }));\n\n dispatch<ListDomainsAction>({ type: LIST_DOMAINS, domains, defaultRedirects });\n } catch (e: any) {\n dispatch<ApiErrorAction>({ type: LIST_DOMAINS_ERROR, errorData: parseApiError(e) });\n }\n};\n\nexport const filterDomains = (searchTerm: string): FilterDomainsAction => ({ type: FILTER_DOMAINS, searchTerm });\n\nexport const checkDomainHealth = (buildShlinkApiClient: ShlinkApiClientBuilder) => (domain: string) => async (\n dispatch: Dispatch,\n getState: GetState,\n) => {\n const { selectedServer } = getState();\n\n if (!hasServerData(selectedServer)) {\n dispatch<ValidateDomain>({ type: VALIDATE_DOMAIN, domain, status: 'invalid' });\n\n return;\n }\n\n try {\n const { url, ...rest } = selectedServer;\n const { health } = buildShlinkApiClient({\n ...rest,\n url: replaceAuthorityFromUri(url, domain),\n });\n\n const { status } = await health();\n\n dispatch<ValidateDomain>({ type: VALIDATE_DOMAIN, domain, status: status === 'pass' ? 'valid' : 'invalid' });\n } catch (e) {\n dispatch<ValidateDomain>({ type: VALIDATE_DOMAIN, domain, status: 'invalid' });\n }\n};\n","import { useEffect } from 'react';\nimport { Button, DropdownItem, Input, InputGroup, UncontrolledTooltip, InputProps } from 'reactstrap';\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 <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 </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-end 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 { FC, useState } from 'react';\nimport { Button, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap';\nimport { ShlinkDomain, ShlinkDomainRedirects } from '../../api/types';\nimport { InputFormGroup, InputFormGroupProps } from '../../utils/forms/InputFormGroup';\nimport { handleEventPreventingDefault, nonEmptyValueOrNull } from '../../utils/utils';\nimport { InfoTooltip } from '../../utils/InfoTooltip';\n\ninterface EditDomainRedirectsModalProps {\n domain: ShlinkDomain;\n isOpen: boolean;\n toggle: () => void;\n editDomainRedirects: (domain: string, redirects: Partial<ShlinkDomainRedirects>) => Promise<void>;\n}\n\nconst FormGroup: FC<InputFormGroupProps & { isLast?: boolean }> = ({ isLast, ...rest }) => (\n <InputFormGroup\n {...rest}\n required={false}\n type=\"url\"\n placeholder=\"No redirect\"\n className={isLast ? 'mb-0' : ''}\n />\n);\n\nexport const EditDomainRedirectsModal: FC<EditDomainRedirectsModalProps> = (\n { isOpen, toggle, domain, editDomainRedirects },\n) => {\n const [ baseUrlRedirect, setBaseUrlRedirect ] = useState(domain.redirects?.baseUrlRedirect ?? '');\n const [ regular404Redirect, setRegular404Redirect ] = useState(domain.redirects?.regular404Redirect ?? '');\n const [ invalidShortUrlRedirect, setInvalidShortUrlRedirect ] = useState(\n domain.redirects?.invalidShortUrlRedirect ?? '',\n );\n const handleSubmit = handleEventPreventingDefault(async () => editDomainRedirects(domain.domain, {\n baseUrlRedirect: nonEmptyValueOrNull(baseUrlRedirect),\n regular404Redirect: nonEmptyValueOrNull(regular404Redirect),\n invalidShortUrlRedirect: nonEmptyValueOrNull(invalidShortUrlRedirect),\n }).then(toggle));\n\n return (\n <Modal isOpen={isOpen} toggle={toggle} centered>\n <form onSubmit={handleSubmit}>\n <ModalHeader toggle={toggle}>Edit redirects for <b>{domain.domain}</b></ModalHeader>\n <ModalBody>\n <FormGroup value={baseUrlRedirect} onChange={setBaseUrlRedirect}>\n <InfoTooltip className=\"me-2\" placement=\"bottom\">\n Visitors accessing the base url, as in <b>https://{domain.domain}/</b>, will be redirected to this URL.\n </InfoTooltip>\n Base URL\n </FormGroup>\n <FormGroup value={regular404Redirect} onChange={setRegular404Redirect}>\n <InfoTooltip className=\"me-2\" placement=\"bottom\">\n Visitors accessing a url not matching a short URL pattern, as in <b>https://{domain.domain}/???/[...]</b>,\n will be redirected to this URL.\n </InfoTooltip>\n Regular 404\n </FormGroup>\n <FormGroup value={invalidShortUrlRedirect} isLast onChange={setInvalidShortUrlRedirect}>\n <InfoTooltip className=\"me-2\" placement=\"bottom\">\n Visitors accessing a url matching a short URL pattern, but not matching an existing short code, will be\n redirected to this URL.\n </InfoTooltip>\n Invalid short URL\n </FormGroup>\n </ModalBody>\n <ModalFooter>\n <Button color=\"link\" type=\"button\" onClick={toggle}>Cancel</Button>\n <Button color=\"primary\">Save</Button>\n </ModalFooter>\n </form>\n </Modal>\n );\n};\n","import { FC, useEffect, useRef, useState } from 'react';\nimport { UncontrolledTooltip } from 'reactstrap';\nimport { ExternalLink } from 'react-external-link';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport {\n faTimes as invalidIcon,\n faCheck as checkIcon,\n faCircleNotch as loadingStatusIcon,\n} from '@fortawesome/free-solid-svg-icons';\nimport { MediaMatcher } from '../../utils/types';\nimport { DomainStatus } from '../data';\n\ninterface DomainStatusIconProps {\n status: DomainStatus;\n matchMedia?: MediaMatcher;\n}\n\nexport const DomainStatusIcon: FC<DomainStatusIconProps> = ({ status, matchMedia = window.matchMedia }) => {\n const ref = useRef<HTMLSpanElement>();\n const matchesMobile = () => matchMedia('(max-width: 991px)').matches;\n const [ isMobile, setIsMobile ] = useState<boolean>(matchesMobile());\n\n useEffect(() => {\n const listener = () => setIsMobile(matchesMobile());\n\n window.addEventListener('resize', listener);\n\n return () => window.removeEventListener('resize', listener);\n }, []);\n\n if (status === 'validating') {\n return <FontAwesomeIcon fixedWidth icon={loadingStatusIcon} spin />;\n }\n\n return (\n <>\n <span\n ref={(el: HTMLSpanElement) => {\n ref.current = el;\n }}\n >\n {status === 'valid'\n ? <FontAwesomeIcon fixedWidth icon={checkIcon} className=\"text-muted\" />\n : <FontAwesomeIcon fixedWidth icon={invalidIcon} className=\"text-danger\" />}\n </span>\n <UncontrolledTooltip\n target={(() => ref.current) as any}\n placement={isMobile ? 'top-start' : 'left'}\n autohide={status === 'valid'}\n >\n {status === 'valid' ? 'Congratulations! This domain is properly configured.' : (\n <span>\n Oops! There is some missing configuration, and short URLs shared with this domain will not work.\n <br />\n Check the <ExternalLink href=\"https://slnk.to/multi-domain-docs\">documentation</ExternalLink> in order to\n find out what is missing.\n </span>\n )}\n </UncontrolledTooltip>\n </>\n );\n};\n","import { FC, useEffect } from 'react';\nimport { Button, UncontrolledTooltip } from 'reactstrap';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport {\n faBan as forbiddenIcon,\n faDotCircle as defaultDomainIcon,\n faEdit as editIcon,\n} from '@fortawesome/free-solid-svg-icons';\nimport { ShlinkDomainRedirects } from '../api/types';\nimport { useToggle } from '../utils/helpers/hooks';\nimport { OptionalString } from '../utils/utils';\nimport { SelectedServer } from '../servers/data';\nimport { supportsDefaultDomainRedirectsEdition } from '../utils/helpers/features';\nimport { EditDomainRedirectsModal } from './helpers/EditDomainRedirectsModal';\nimport { Domain } from './data';\nimport { DomainStatusIcon } from './helpers/DomainStatusIcon';\n\ninterface DomainRowProps {\n domain: Domain;\n defaultRedirects?: ShlinkDomainRedirects;\n editDomainRedirects: (domain: string, redirects: Partial<ShlinkDomainRedirects>) => Promise<void>;\n checkDomainHealth: (domain: string) => void;\n selectedServer: SelectedServer;\n}\n\nconst Nr: FC<{ fallback: OptionalString }> = ({ fallback }) => (\n <span className=\"text-muted\">\n {!fallback && <small>No redirect</small>}\n {fallback && <>{fallback} <small>(as fallback)</small></>}\n </span>\n);\nconst DefaultDomain: FC = () => (\n <>\n <FontAwesomeIcon fixedWidth icon={defaultDomainIcon} className=\"text-primary\" id=\"defaultDomainIcon\" />\n <UncontrolledTooltip target=\"defaultDomainIcon\" placement=\"right\">Default domain</UncontrolledTooltip>\n </>\n);\n\nexport const DomainRow: FC<DomainRowProps> = (\n { domain, editDomainRedirects, checkDomainHealth, defaultRedirects, selectedServer },\n) => {\n const [ isOpen, toggle ] = useToggle();\n const { domain: authority, isDefault, redirects, status } = domain;\n const canEditDomain = !isDefault || supportsDefaultDomainRedirectsEdition(selectedServer);\n\n useEffect(() => {\n checkDomainHealth(domain.domain);\n }, []);\n\n return (\n <tr className=\"responsive-table__row\">\n <td className=\"responsive-table__cell\" data-th=\"Is default domain\">{isDefault && <DefaultDomain />}</td>\n <th className=\"responsive-table__cell\" data-th=\"Domain\">{authority}</th>\n <td className=\"responsive-table__cell\" data-th=\"Base path redirect\">\n {redirects?.baseUrlRedirect ?? <Nr fallback={defaultRedirects?.baseUrlRedirect} />}\n </td>\n <td className=\"responsive-table__cell\" data-th=\"Regular 404 redirect\">\n {redirects?.regular404Redirect ?? <Nr fallback={defaultRedirects?.regular404Redirect} />}\n </td>\n <td className=\"responsive-table__cell\" data-th=\"Invalid short URL redirect\">\n {redirects?.invalidShortUrlRedirect ?? <Nr fallback={defaultRedirects?.invalidShortUrlRedirect} />}\n </td>\n <td className=\"responsive-table__cell text-lg-center\" data-th=\"Status\">\n <DomainStatusIcon status={status} />\n </td>\n <td className=\"responsive-table__cell text-end\">\n <span id={!canEditDomain ? 'defaultDomainBtn' : undefined}>\n <Button outline size=\"sm\" disabled={!canEditDomain} onClick={!canEditDomain ? undefined : toggle}>\n <FontAwesomeIcon fixedWidth icon={!canEditDomain ? forbiddenIcon : editIcon} />\n </Button>\n </span>\n {!canEditDomain && (\n <UncontrolledTooltip target=\"defaultDomainBtn\" placement=\"left\">\n Redirects for default domain cannot be edited here.\n <br />\n Use config options or env vars directly on the server.\n </UncontrolledTooltip>\n )}\n </td>\n <EditDomainRedirectsModal\n domain={domain}\n isOpen={isOpen}\n toggle={toggle}\n editDomainRedirects={editDomainRedirects}\n />\n </tr>\n );\n};\n","import { FC, useEffect } from 'react';\nimport Message from '../utils/Message';\nimport { Result } from '../utils/Result';\nimport { ShlinkApiError } from '../api/ShlinkApiError';\nimport { SimpleCard } from '../utils/SimpleCard';\nimport SearchField from '../utils/SearchField';\nimport { ShlinkDomainRedirects } from '../api/types';\nimport { SelectedServer } from '../servers/data';\nimport { DomainsList } from './reducers/domainsList';\nimport { DomainRow } from './DomainRow';\n\ninterface ManageDomainsProps {\n listDomains: Function;\n filterDomains: (searchTerm: string) => void;\n editDomainRedirects: (domain: string, redirects: Partial<ShlinkDomainRedirects>) => Promise<void>;\n checkDomainHealth: (domain: string) => void;\n domainsList: DomainsList;\n selectedServer: SelectedServer;\n}\n\nconst headers = [ '', 'Domain', 'Base path redirect', 'Regular 404 redirect', 'Invalid short URL redirect', '', '' ];\n\nexport const ManageDomains: FC<ManageDomainsProps> = (\n { listDomains, domainsList, filterDomains, editDomainRedirects, checkDomainHealth, selectedServer },\n) => {\n const { filteredDomains: domains, defaultRedirects, loading, error, errorData } = domainsList;\n const resolvedDefaultRedirects = defaultRedirects ?? domains.find(({ isDefault }) => isDefault)?.redirects;\n\n useEffect(() => {\n listDomains();\n }, []);\n\n if (loading) {\n return <Message loading />;\n }\n\n const renderContent = () => {\n if (error) {\n return (\n <Result type=\"error\">\n <ShlinkApiError errorData={errorData} fallbackMessage=\"Error loading domains :(\" />\n </Result>\n );\n }\n\n return (\n <SimpleCard>\n <table className=\"table table-hover responsive-table mb-0\">\n <thead className=\"responsive-table__header\">\n <tr>{headers.map((column, index) => <th key={index}>{column}</th>)}</tr>\n </thead>\n <tbody>\n {domains.length < 1 && <tr><td colSpan={headers.length} className=\"text-center\">No results found</td></tr>}\n {domains.map((domain) => (\n <DomainRow\n key={domain.domain}\n domain={domain}\n editDomainRedirects={editDomainRedirects}\n checkDomainHealth={checkDomainHealth}\n defaultRedirects={resolvedDefaultRedirects}\n selectedServer={selectedServer}\n />\n ))}\n </tbody>\n </table>\n </SimpleCard>\n );\n };\n\n return (\n <>\n <SearchField className=\"mb-3\" onChange={filterDomains} />\n {renderContent()}\n </>\n );\n};\n","import Bottle from 'bottlejs';\nimport { ConnectDecorator } from '../../container/types';\nimport { checkDomainHealth, filterDomains, listDomains } from '../reducers/domainsList';\nimport { DomainSelector } from '../DomainSelector';\nimport { ManageDomains } from '../ManageDomains';\nimport { editDomainRedirects } from '../reducers/domainRedirects';\n\nconst provideServices = (bottle: Bottle, connect: ConnectDecorator) => {\n // Components\n bottle.serviceFactory('DomainSelector', () => DomainSelector);\n bottle.decorator('DomainSelector', connect([ 'domainsList' ], [ 'listDomains' ]));\n\n bottle.serviceFactory('ManageDomains', () => ManageDomains);\n bottle.decorator('ManageDomains', connect(\n [ 'domainsList', 'selectedServer' ],\n [ 'listDomains', 'filterDomains', 'editDomainRedirects', 'checkDomainHealth' ],\n ));\n\n // Actions\n bottle.serviceFactory('listDomains', listDomains, 'buildShlinkApiClient');\n bottle.serviceFactory('filterDomains', () => filterDomains);\n bottle.serviceFactory('editDomainRedirects', editDomainRedirects, 'buildShlinkApiClient');\n bottle.serviceFactory('checkDomainHealth', checkDomainHealth, '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=\"ms-2\" color=\"secondary\" size=\"sm\" onClick={update}>\n {!isUpdating && <>Restart now <FontAwesomeIcon icon={reloadIcon} className=\"ms-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, Routes, useLocation } from 'react-router-dom';\nimport classNames from 'classnames';\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 ManageServers: FC,\n ShlinkVersionsContainer: FC,\n) => ({ fetchServers, servers, settings, appUpdated, resetAppUpdate }: AppProps) => {\n const location = useLocation();\n const isHome = location.pathname === '/';\n\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={classNames('shlink-wrapper', { 'd-flex d-md-block align-items-center': isHome })}>\n <Routes>\n <Route index element={<Home />} />\n <Route path=\"/settings/*\" element={<Settings />} />\n <Route path=\"/manage-servers\" element={<ManageServers />} />\n <Route path=\"/server/create\" element={<CreateServer />} />\n <Route path=\"/server/:serverId/edit\" element={<EditServer />} />\n <Route path=\"/server/:serverId/*\" element={<MenuLayout />} />\n <Route path=\"*\" element={<NotFound />} />\n </Routes>\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 'ManageServers',\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 { 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();\n\nexport const { 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);\nprovideApiServices(bottle);\nprovideShortUrlsServices(bottle, connect);\nprovideServersServices(bottle, connect);\nprovideTagsServices(bottle, connect);\nprovideVisitsServices(bottle, connect);\nprovideUtilsServices(bottle);\nprovideMercureServices(bottle);\nprovideSettingsServices(bottle, connect);\nprovideDomainsServices(bottle, connect);\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 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 nonOrphanVisitsReducer from '../visits/reducers/nonOrphanVisits';\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 shortUrlCreationResult: shortUrlCreationReducer,\n shortUrlDeletion: shortUrlDeletionReducer,\n shortUrlEdition: shortUrlEditionReducer,\n shortUrlVisits: shortUrlVisitsReducer,\n tagVisits: tagVisitsReducer,\n orphanVisits: orphanVisitsReducer,\n nonOrphanVisits: nonOrphanVisitsReducer,\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';\nimport { migrateDeprecatedSettings } from '../settings/helpers';\nimport { ShlinkState } from './types';\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};\nconst preloadedState = migrateDeprecatedSettings(load(localStorageConfig) as ShlinkState);\n\nexport const store = createStore(reducers, preloadedState, composeEnhancers(\n applyMiddleware(save(localStorageConfig), ReduxThunk),\n));\n","import { ShlinkState } from '../../container/types';\n\nexport const migrateDeprecatedSettings = (state: Partial<ShlinkState>): Partial<ShlinkState> => {\n if (!state.settings) {\n return state;\n }\n\n // The \"last180Days\" interval had a typo, with a lowercase d\n if ((state.settings.visits?.defaultInterval as any) === 'last180days') {\n state.settings.visits && (state.settings.visits.defaultInterval = 'last180Days');\n }\n\n // The \"tags display mode\" option has been moved from \"ui\" to \"tags\"\n state.settings.tags = {\n ...state.settings.tags,\n defaultMode: state.settings.tags?.defaultMode ?? (state.settings.ui as any)?.tagsMode,\n };\n state.settings.ui && delete (state.settings.ui as any).tagsMode;\n\n return state;\n};\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 } from 'react';\nimport './NoMenuLayout.scss';\n\nexport const NoMenuLayout: FC = ({ children }) => <div className=\"no-menu-wrapper container-xl\">{children}</div>;\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 { 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","export const saveUrl = ({ document }: Window, url: string, filename: string) => {\n const link = document.createElement('a');\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\nexport const saveCsv = (window: Window, csv: string, filename: string) => {\n const blob = new Blob([ csv ], { type: 'text/csv;charset=utf-8;' });\n const url = URL.createObjectURL(blob);\n\n saveUrl(window, url, filename);\n};\n"],"sourceRoot":""} |