mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 17:40:23 +03:00
1 line
No EOL
539 KiB
Text
1 line
No EOL
539 KiB
Text
{"version":3,"sources":["servers/helpers/withoutSelectedServer.tsx","utils/helpers/files.ts","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","servers/data/index.ts","utils/services/LocalStorage.ts","utils/services/ColorGenerator.ts","common/ShlinkVersions.tsx","common/ShlinkVersionsContainer.tsx","utils/utils.ts","common/MainHeader.tsx","common/Home.tsx","common/MenuLayout.tsx","common/AsideMenu.tsx","utils/SimpleCard.tsx","utils/helpers/features.ts","utils/theme/index.ts","utils/helpers/query.ts","utils/SearchField.tsx","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","short-urls/helpers/hooks.ts","short-urls/SearchBar.tsx","utils/helpers/ordering.ts","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/BooleanControl.tsx","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/FormGroupContainer.tsx","servers/helpers/ServerForm.tsx","servers/CreateServer.tsx","servers/ServersDropdown.tsx","servers/DeleteServerModal.tsx","servers/DeleteServerButton.tsx","servers/EditServer.tsx","servers/helpers/ImportServersBtn.tsx","servers/reducers/selectedServer.ts","servers/reducers/servers.ts","servers/reducers/remoteServers.ts","servers/helpers/ForServerVersion.tsx","servers/helpers/ServerError.tsx","servers/Overview.tsx","servers/ManageServers.tsx","servers/ManageServersRow.tsx","servers/ManageServersRowDropdown.tsx","servers/services/ServersImporter.ts","servers/services/ServersExporter.ts","servers/services/provideServices.ts","visits/VisitsHeader.tsx","visits/ShortUrlVisitsHeader.tsx","utils/helpers/visits.ts","utils/ToggleSwitch.tsx","utils/helpers/charts.ts","visits/charts/LineChartCard.tsx","common/SimplePaginator.tsx","visits/VisitsTable.tsx","visits/helpers/MapModal.tsx","visits/helpers/OpenMapModalBtn.tsx","visits/types/helpers.ts","visits/services/VisitsParser.ts","visits/helpers/VisitsFilterDropdown.tsx","visits/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/reducers/common.ts","visits/reducers/shortUrlVisits.ts","visits/TagVisitsHeader.tsx","visits/TagVisits.tsx","visits/reducers/tagVisits.ts","visits/OrphanVisitsHeader.tsx","visits/OrphanVisits.tsx","visits/reducers/orphanVisits.ts","visits/reducers/visitsOverview.ts","visits/services/VisitsExporter.ts","visits/services/provideServices.ts","tags/helpers/TagBullet.tsx","tags/helpers/TagsSelector.tsx","tags/TagCard.tsx","tags/helpers/DeleteTagConfirmModal.tsx","tags/helpers/EditTagModal.tsx","tags/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","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","domains/reducers/domainRedirects.ts","domains/reducers/domainsList.ts","domains/DomainSelector.tsx","domains/helpers/EditDomainRedirectsModal.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","utils/Message.tsx","common/NoMenuLayout.tsx","utils/helpers/version.ts"],"names":["withoutSelectedServer","WrappedComponent","props","useEffect","resetSelectedServer","saveUrl","url","filename","document","link","createElement","setAttribute","style","visibility","body","appendChild","click","removeChild","saveCsv","window","csv","blob","Blob","type","URL","createObjectURL","ShlinkLogo","color","MAIN_COLOR","className","viewBox","version","xmlns","fill","d","withSelectedServer","ServerError","selectServer","selectedServer","match","params","serverId","isNotFoundServer","loading","NotFound","to","children","ServerListItem","id","name","ListGroupItem","tag","Link","icon","chevronIcon","ServersListGroup","servers","embedded","length","ListGroup","classNames","map","useStateFlagTimeout","setTimeout","clearTimeout","initialValue","delay","useState","flag","setFlag","timeout","useRef","undefined","callback","current","useToggle","useSwipeable","showSidebar","hideSidebar","swipeMenuIfNoModalExists","e","event","composedPath","some","classList","contains","querySelector","useReactSwipeable","delta","onSwipedLeft","onSwipedRight","useQueryState","paramName","initialState","value","setValue","location","history","query","parseQuery","search","pushState","pathname","stringifyQuery","useEffectExceptFirstTime","deps","isFirstLoad","provideServices","bottle","connect","withRouter","constant","global","console","axios","service","ImageDownloader","serviceFactory","ScrollToTop","decorator","MainHeader","Home","MenuLayout","AsideMenu","ShlinkVersionsContainer","ErrorHandler","scrollTo","error","state","hasError","this","outline","onClick","reload","Component","imgUrl","get","responseType","data","localStorage","LocalStorage","ColorGenerator","hasServerData","server","apiKey","isServerWithId","hasOwnProperty","isReachableServer","getServerId","serverWithIdToServerData","omit","buildPath","path","key","item","getItem","JSON","parse","set","setItem","stringify","floor","Math","random","letters","normalizeKey","toLowerCase","trim","storage","colors","getColorForKey","normalizedKey","setColorForKey","rangeOf","join","normalizeVersion","pipe","versionToSemVer","versionToPrintable","VersionLink","project","href","ShlinkVersions","clientVersion","normalizedClientVersion","printableVersion","classes","size","mappingFn","startAt","range","hasValue","isNil","isEmpty","handleEventPreventingDefault","handler","preventDefault","nonEmptyValueOrNull","capitalize","charAt","toUpperCase","slice","ServersDropdown","isOpen","toggleOpen","close","settingsPath","toggleClass","Navbar","dark","fixed","expand","NavbarBrand","NavbarToggler","arrowIcon","Collapse","navbar","Nav","NavItem","NavLink","active","cogsIcon","serversList","values","hasServers","autoConnectServer","find","autoConnect","push","Card","Row","noGutters","faPlus","faExternalLinkAlt","TagsList","ShortUrlsList","CreateShortUrl","ShortUrlVisits","TagVisits","OrphanVisits","Overview","EditShortUrl","ManageDomains","sidebarVisible","toggleSidebar","addOrphanVisitsRoute","supportsOrphanVisits","addManageDomainsRoute","supportsDomainRedirects","burgerClasses","swipeableProps","burgerIcon","showOnMobile","exact","from","component","render","AsideMenuItem","rest","activeClassName","DeleteServerButton","hasId","addManageDomainsLink","asideClass","suffix","fixedWidth","overviewIcon","isActive","_","listIcon","createIcon","flip","tagsIcon","domainsIcon","editIcon","textClassName","SimpleCard","title","bodyClassName","serverMatchesVersions","versions","versionMatch","supportsQrCodeSizeInQuery","minVersion","supportsShortUrlTitle","supportsQrCodeMargin","supportsTagsInPatch","supportsBotVisits","supportsCrawlableVisits","supportsQrErrorCorrection","supportsForwardQuery","supportsDefaultDomainRedirectsEdition","MAIN_COLOR_ALPHA","HIGHLIGHTED_COLOR","HIGHLIGHTED_COLOR_ALPHA","PRIMARY_LIGHT_COLOR","PRIMARY_DARK_COLOR","changeThemeInMarkup","theme","html","getElementsByTagName","isDarkThemeEnabled","getAttribute","qs","ignoreQueryPrefix","arrayFormat","timer","buildShlinkBaseUrl","apiVersion","rejectNilProps","reject","normalizeOrderByInParams","orderBy","field","dir","ShlinkApiClient","baseUrl","listShortUrls","a","performRequest","then","shortUrls","createShortUrl","options","filteredOptions","resp","getShortUrlVisits","shortCode","visits","getTagVisits","getOrphanVisits","getVisitsOverview","getShortUrl","domain","deleteShortUrl","updateShortUrlTags","tags","updateShortUrl","listTags","withStats","stats","deleteTags","editTag","oldName","newName","health","mercureInfo","listDomains","domains","editDomainRedirects","domainRedirects","method","headers","paramsSerializer","response","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","backgroundColor","cursor","DropdownBtn","disabled","dropdownClassName","right","minWidth","toggle","toggleClasses","Dropdown","DropdownToggle","caret","DropdownMenu","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","DropdownItem","divider","interval","DateRangeSelector","onDatesChange","initialDateRange","defaultText","updatable","initialIntervalIsRange","activeInterval","setActiveInterval","activeDateRange","setActiveDateRange","updateDateRange","updateInterval","isDateInterval","header","useShortUrlsQuery","useMemo","extra","evolvedQuery","queryString","dateOrNull","SearchBar","toFirstPage","selectedTags","split","setDates","setSearch","removeTag","selectedTag","tagsList","determineOrderDir","currentField","newField","currentOrderDir","ASC","DESC","sortList","list","sort","b","greaterThan","smallerThan","OrderingDropdown","items","order","isButton","handleItemClick","fieldKey","newOrderDir","UncontrolledDropdown","toPairs","fieldValue","sortAscIcon","sortDescIcon","boundToMercureHub","getTopicsForProps","pendingUpdates","Set","createNewVisits","loadMercureInfo","closeEventSource","topics","onMessage","onTokenExpired","mercureHubUrl","token","onEventSourceMessage","onEventSourceError","status","subscriptions","topic","hubUrl","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","pageIsEllipsis","pageNumber","prettifyPageNumber","keyForPage","index","Paginator","paginator","currentQueryString","pagesCount","urlForPage","Pagination","listClassName","PaginationItem","PaginationLink","previous","next","SHORT_URLS_ORDERABLE_FIELDS","dateCreated","longUrl","ShortUrlsTable","initialOrderBy","setOrder","pagination","handleOrderBy","addTag","newTag","page","itemsPerPage","orderByColumn","renderOrderIcon","onTagClick","CopyToClipboardIcon","onCopy","copyIcon","Time","relative","dateObject","dateTime","getUnixTime","formatDistance","buildUrl","ShortUrlDetailLink","shortUrl","ShortUrlVisitsCount","visitsCount","maxVisits","meta","visitsLink","prettifiedMaxVisits","tooltipRef","el","infoIcon","UncontrolledTooltip","placement","ShortUrlsRow","ShortUrlsRowMenu","copiedToClipboard","setCopiedToClipboard","setActive","isFirstRun","data-th","DropdownBtnMenu","ButtonDropdown","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","isInvalidDeletionError","ShlinkApiError","errorData","fallbackMessage","detail","invalidElements","shortUrlDeletion","resetDeleteShortUrl","inputValue","setInputValue","handleDeleteUrl","catch","identity","Modal","centered","onSubmit","ModalHeader","ModalBody","ModalFooter","result","showCopyTooltip","setShowCopyTooltip","closeIcon","Tooltip","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","init","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","Button","block","saveImage","downloadIcon","BooleanControl","checked","inline","uuid","typeClasses","display","htmlFor","Checkbox","InfoModal","UseExistingIfFoundInfoIcon","isModalOpen","toggleModal","InfoTooltip","ShortUrlFormCheckboxGroup","infoTooltip","normalizeTag","replace","toDate","dynamicColClasses","TagsSelector","DomainSelector","shortUrlData","setShortUrlData","isEdit","isBasicMode","hadTitleOriginally","resolveNewTitle","hasNewTitle","matcher","submit","renderOptionalInput","fromGroupProps","Input","renderDateInput","basicComponents","bsSize","required","showCustomizeCard","limitAccessCardClasses","showCrawlableControl","showForwardQueryControl","showBehaviorCard","extraChecksCardClasses","crawlable","goBack","shortUrlDetail","getShortUrlDetail","shortUrlEdition","savingError","savingErrorData","savingSucceeded","isSuccessful","isNotSuccessful","Message","faArrowLeft","GET_SHORT_URL_DETAIL_START","GET_SHORT_URL_DETAIL_ERROR","GET_SHORT_URL_DETAIL","FormGroupContainer","labelClassName","forId","FormGroup","ServerForm","initialValues","setName","setUrl","setApiKey","handleSubmit","ImportResult","CreateServer","ImportServersBtn","createServer","serversImported","setServersImported","errorImporting","setErrorImporting","NoMenuLayout","serverData","tooltipPlacement","onImport","onImportError","nav","inNavbar","serverIcon","plusIcon","DeleteServerModal","deleteServer","redirectHome","showModal","hideModal","EditServer","editServer","importServersFromFile","createServers","fileRef","files","importIcon","accept","SELECT_SERVER","RESET_SELECTED_SERVER","toSemVer","getServerVersion","memoizeWith","_serverId","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","fullWidth","loadVisitsOverview","visitsOverview","loadingTags","loadingVisits","orphanVisitsCount","useHistory","CardTitle","CardText","CardHeader","CardBody","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","toCSV","FileReader","VisitsHeader","ShortUrlVisitsHeader","shortLink","longLink","visitsStatsTitle","DEFAULT","BROWSERS_WHITELIST","extractDomain","includes","fillTheGaps","labels","zipObj","ToggleSwitch","pointerOnHover","native","firstElement","renderChartLabel","dataset","formattedValue","label","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","tooltip","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","resultSet","setPage","supportsBots","fullSizeColSpan","listener","removeEventListener","flat","botIcon","isSelected","v","potentialBot","OpenStreetMapTile","TileLayer","attribution","calculateMapProps","locations","bounds","zoom","center","latLong","MapModal","contentClassName","MapContainer","cityName","count","Marker","position","Popup","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","element","ChartCard","footer","CardFooter","DoughnutChartCard","PaginationDropdown","toggleClassName","ranges","Infinity","dropLabelIfHidden","startsWith","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","VisitsNavLink","RouterNavLink","endsWith","VisitsStats","visitsInfo","getVisits","cancelGetVisits","exportCsv","loadingLarge","progress","fallbackInterval","initialInterval","setInitialInterval","setDateRange","setHighlightedVisits","setHighlightedLabel","visitsFilter","setVisitsFilter","buildSectionUrl","normalizedVisits","mapLocations","highlightVisitsForProp","newSelectedBar","propEq","faFileDownload","Progress","striped","pills","section","amount","exportVisits","cancelGetShortUrlVisits","doIntervalFallback","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","TagVisitsHeader","tagVisits","cancelGetTagVisits","GET_TAG_VISITS_START","GET_TAG_VISITS_ERROR","GET_TAG_VISITS","GET_TAG_VISITS_LARGE","GET_TAG_VISITS_CANCEL","GET_TAG_VISITS_PROGRESS_CHANGED","GET_TAG_VISITS_FALLBACK_TO_INTERVAL","OrphanVisitsHeader","cancelGetOrphanVisits","GET_ORPHAN_VISITS_START","GET_ORPHAN_VISITS_ERROR","GET_ORPHAN_VISITS","GET_ORPHAN_VISITS_LARGE","GET_ORPHAN_VISITS_CANCEL","GET_ORPHAN_VISITS_PROGRESS_CHANGED","GET_ORPHAN_VISITS_FALLBACK_TO_INTERVAL","matchesType","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","Popover","disableAlpha","hex","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","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","RealTimeUpdatesSettings","SettingsSections","child","subChild","subIndex","Settings","RealTimeUpdates","ShortUrlCreation","UserInterface","Visits","Tags","tagFilteringModeText","ShortUrlCreationSettings","changeTagsFilteringMode","UserInterfaceSettings","faMoon","faSun","useDarkTheme","DateIntervalSelector","VisitsSettings","TagsSettings","tagsMode","ShortUrlsListSettings","EDIT_DOMAIN_REDIRECTS","redirects","LIST_DOMAINS_START","LIST_DOMAINS_ERROR","LIST_DOMAINS","FILTER_DOMAINS","filteredDomains","replaceRedirectsOnDomain","defaultRedirects","filterDomains","domainsList","inputDisplayed","showInput","hideInput","valueIsEmpty","unselectDomain","InputGroup","InputGroupAddon","addonType","faUndo","trigger","isDefault","isLast","EditDomainRedirectsModal","baseUrlRedirect","setBaseUrlRedirect","regular404Redirect","setRegular404Redirect","invalidShortUrlRedirect","setInvalidShortUrlRedirect","Nr","fallback","DefaultDomain","defaultDomainIcon","DomainRow","authority","canEditDomain","forbiddenIcon","resolvedDefaultRedirects","column","APP_UPDATE_AVAILABLE","RESET_APP_UPDATE","appUpdateAvailable","resetAppUpdate","AppUpdateBanner","forceUpdate","isUpdating","setUpdating","Alert","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","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","save","ReduxThunk","isLocalhost","hostname","registerValidSW","swUrl","register","onupdatefound","installingWorker","installing","onstatechange","controller","log","onUpdate","onSuccess","L","Icon","Default","prototype","_getIconUrl","mergeOptions","iconRetinaUrl","marker2x","iconUrl","marker","shadowUrl","markerShadow","basename","getElementById","process","origin","fetch","contentType","indexOf","ready","unregister","checkValidServiceWorker","registerServiceWorker","getClassForType","default","getTextClassForType","preloader","spin","versionToMatch","matchesMinVersion","compare","versionIsValidSemVer","defaultValue"],"mappings":"qJAMO,SAASA,EAA8BC,GAC5C,OAAO,SAACC,GAKN,OAJAC,qBAAU,WACRD,EAAME,wBACL,IAEI,cAACH,EAAD,eAAsBC,O,iCCZjC,oEAAO,IAAMG,EAAU,SAAC,EAAsBC,EAAaC,GAAsB,IAAvDC,EAAsD,EAAtDA,SAClBC,EAAOD,EAASE,cAAc,KAEpCD,EAAKE,aAAa,OAAQL,GAC1BG,EAAKE,aAAa,WAAYJ,GAC9BE,EAAKG,MAAMC,WAAa,SACxBL,EAASM,KAAKC,YAAYN,GAC1BA,EAAKO,QACLR,EAASM,KAAKG,YAAYR,IAGfS,EAAU,SAACC,EAAgBC,EAAab,GACnD,IAAMc,EAAO,IAAIC,KAAK,CAAEF,GAAO,CAAEG,KAAM,4BACjCjB,EAAMkB,IAAIC,gBAAgBJ,GAEhChB,EAAQc,EAAQb,EAAKC,K,+KCRVmB,EAAa,SAAC,GAAD,QAAGC,aAAH,MAAWC,IAAX,EAAuBC,EAAvB,EAAuBA,UAAvB,OACxB,qBAAKA,UAAWA,EAAWC,QAAQ,cAAcC,QA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G7E,QAF2B0mB,GAAcyrB,kBAAQF,EAAgBvrB,EAAY,QAEjDwrB,GAGxBE,EAAuB/sB,YAAY9K,KAAU,SAACnqB,GAClD,IACE,OAAO+hD,kBAAQ/hD,EAASA,EAAS,KACjC,MAAOiD,GACP,OAAO,MAIEkG,EAAqB,SAACnJ,GAAD,OAAsBgiD,EAAqBhiD,GAAtB,WAA+CA,GAAdA,GAE3EkJ,EAAkB,eAAC+4C,EAAD,uDAAwB,SAAxB,OAC7B,SAACjiD,GAAD,OAA6BgiD,EAAqBhiD,GAAWA,EAAUiiD,M","file":"static/js/main.e09d9674.chunk.js","sourcesContent":["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","import { MAIN_COLOR } from '../../utils/theme';\n\nexport interface ShlinkLogoProps {\n color?: string;\n className?: string;\n}\n\nexport const ShlinkLogo = ({ color = MAIN_COLOR, className }: ShlinkLogoProps) => (\n <svg className={className} viewBox=\"0 0 512 512\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <g fill={color}>\n <path\n d=\" M 23.71 85.08 C 17.22 49.81 49.44 14.86 85.08 18.12 C 118.83 19.21 145.72 53.33 139.45 86.37 C 155.64 102.30 171.32 118.83 187.87 134.36 C 198.32 111.73 208.84 89.12 219.57 66.62 C 226.05 53.84 243.47 48.74 255.73 56.27 C 263.76 62.10 270.34 69.69 277.25 76.75 C 286.28 86.61 285.72 102.89 276.31 112.31 C 223.38 165.37 170.38 218.37 117.35 271.34 C 107.72 280.99 91.01 281.25 81.11 271.86 C 74.39 264.94 66.82 258.69 61.24 250.77 C 53.72 238.52 58.85 221.07 71.64 214.62 C 94.11 203.87 116.72 193.38 139.33 182.91 C 123.81 166.36 107.30 150.68 91.37 134.49 C 60.20 140.28 27.37 116.78 23.71 85.08 Z\"\n />\n <path\n d=\" M 205.21 201.23 C 225.32 181.36 260.88 181.11 281.14 200.86 C 299.25 218.75 317.37 236.65 335.10 254.93 C 356.73 278.01 352.01 318.70 326.03 336.56 C 320.07 330.47 313.73 324.65 308.12 318.28 C 323.86 309.39 328.76 286.18 316.63 272.39 C 301.73 256.95 286.30 242.03 271.24 226.75 C 264.49 219.65 256.80 212.00 246.37 211.52 C 224.65 208.64 205.52 233.36 214.49 253.58 C 221.09 266.81 234.22 275.12 243.62 286.24 C 240.43 295.96 238.09 306.13 238.29 316.46 C 225.55 304.29 213.16 291.73 200.89 279.09 C 180.97 257.57 183.10 220.45 205.21 201.23 Z\"\n />\n <path\n d=\" M 273.90 352.07 C 252.28 328.99 256.98 288.31 282.96 270.46 C 288.93 276.54 295.26 282.36 300.88 288.72 C 285.14 297.62 280.23 320.82 292.38 334.61 C 307.27 350.05 322.70 364.96 337.75 380.25 C 344.51 387.35 352.20 395.00 362.64 395.48 C 384.35 398.37 403.49 373.64 394.51 353.42 C 387.92 340.18 374.78 331.88 365.38 320.76 C 368.56 311.04 370.91 300.86 370.71 290.54 C 383.45 302.70 395.84 315.27 408.11 327.91 C 428.03 349.43 425.90 386.55 403.78 405.77 C 383.68 425.64 348.13 425.89 327.86 406.14 C 309.75 388.25 291.60 370.37 273.90 352.07 Z\"\n />\n <path\n d=\" M 422.11 403.83 C 431.96 394.07 441.60 384.06 451.66 374.51 C 460.90 383.74 471.89 392.70 474.89 406.11 C 480.16 429.97 484.08 454.13 488.76 478.12 C 490.00 483.41 484.47 488.29 479.35 486.63 C 454.66 481.52 429.55 478.12 405.14 471.84 C 393.17 467.97 385.20 457.75 376.55 449.27 C 386.39 439.49 396.13 429.60 406.06 419.91 C 416.37 433.45 435.74 414.00 422.11 403.83 Z\"\n />\n </g>\n </svg>\n);\n","import { FC, useEffect } from 'react';\nimport { RouteComponentProps } from 'react-router';\nimport Message from '../../utils/Message';\nimport { isNotFoundServer, SelectedServer } from '../data';\nimport NoMenuLayout from '../../common/NoMenuLayout';\n\ninterface WithSelectedServerProps extends RouteComponentProps<{ serverId: string }> {\n selectServer: (serverId: string) => void;\n selectedServer: SelectedServer;\n}\n\nexport function withSelectedServer<T = {}>(WrappedComponent: FC<WithSelectedServerProps & T>, ServerError: FC) {\n return (props: WithSelectedServerProps & T) => {\n const { selectServer, selectedServer, match } = props;\n\n useEffect(() => {\n selectServer(match.params.serverId);\n }, [ match.params.serverId ]);\n\n if (!selectedServer) {\n return (\n <NoMenuLayout>\n <Message loading />\n </NoMenuLayout>\n );\n }\n\n if (isNotFoundServer(selectedServer)) {\n return <ServerError />;\n }\n\n return <WrappedComponent {...props} />;\n };\n}\n","import { FC } from 'react';\nimport { Link } from 'react-router-dom';\nimport { SimpleCard } from '../utils/SimpleCard';\n\ninterface NotFoundProps {\n to?: string;\n}\n\nconst NotFound: FC<NotFoundProps> = ({ to = '/', children = 'Home' }) => (\n <div className=\"home\">\n <SimpleCard className=\"p-4\">\n <h2>Oops! We could not find requested route.</h2>\n <p>\n Use your browser's back button to navigate to the page you have previously come from, or just press this\n button.\n </p>\n <br />\n <Link to={to} className=\"btn btn-outline-primary btn-lg\">{children}</Link>\n </SimpleCard>\n </div>\n);\n\nexport default NotFound;\n","import { FC } from 'react';\nimport { ListGroup, ListGroupItem } from 'reactstrap';\nimport { Link } from 'react-router-dom';\nimport classNames from 'classnames';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faChevronRight as chevronIcon } from '@fortawesome/free-solid-svg-icons';\nimport { ServerWithId } from './data';\nimport './ServersListGroup.scss';\n\ninterface ServersListGroupProps {\n servers: ServerWithId[];\n embedded?: boolean;\n}\n\nconst ServerListItem = ({ id, name }: { id: string; name: string }) => (\n <ListGroupItem tag={Link} to={`/server/${id}`} className=\"servers-list__server-item\">\n {name}\n <FontAwesomeIcon icon={chevronIcon} className=\"servers-list__server-item-icon\" />\n </ListGroupItem>\n);\n\nconst ServersListGroup: FC<ServersListGroupProps> = ({ servers, children, embedded = false }) => (\n <>\n {children && <h5 className=\"mb-md-3\">{children}</h5>}\n {servers.length > 0 && (\n <ListGroup\n className={classNames('servers-list__list-group', { 'servers-list__list-group--embedded': embedded })}\n >\n {servers.map(({ id, name }) => <ServerListItem key={id} id={id} name={name} />)}\n </ListGroup>\n )}\n </>\n);\n\nexport default ServersListGroup;\n","import { useState, useRef, EffectCallback, DependencyList, useEffect } from 'react';\nimport { useSwipeable as useReactSwipeable } from 'react-swipeable';\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","import axios from 'axios';\nimport Bottle, { Decorator } from 'bottlejs';\nimport ScrollToTop from '../ScrollToTop';\nimport MainHeader from '../MainHeader';\nimport Home from '../Home';\nimport MenuLayout from '../MenuLayout';\nimport AsideMenu from '../AsideMenu';\nimport ErrorHandler from '../ErrorHandler';\nimport ShlinkVersionsContainer from '../ShlinkVersionsContainer';\nimport { ConnectDecorator } from '../../container/types';\nimport { withoutSelectedServer } from '../../servers/helpers/withoutSelectedServer';\nimport { ImageDownloader } from './ImageDownloader';\n\nconst provideServices = (bottle: Bottle, connect: ConnectDecorator, withRouter: Decorator) => {\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 bottle.decorator('ScrollToTop', withRouter);\n\n bottle.serviceFactory('MainHeader', MainHeader, 'ServersDropdown');\n bottle.decorator('MainHeader', withRouter);\n\n bottle.serviceFactory('Home', () => Home);\n bottle.decorator('Home', withoutSelectedServer);\n bottle.decorator('Home', withRouter);\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 'ServerError',\n 'Overview',\n 'EditShortUrl',\n 'ManageDomains',\n );\n bottle.decorator('MenuLayout', connect([ 'selectedServer' ], [ 'selectServer' ]));\n bottle.decorator('MenuLayout', withRouter);\n\n bottle.serviceFactory('AsideMenu', AsideMenu, 'DeleteServerButton');\n\n bottle.serviceFactory('ShlinkVersionsContainer', () => ShlinkVersionsContainer);\n bottle.decorator('ShlinkVersionsContainer', connect([ 'selectedServer' ]));\n\n bottle.serviceFactory('ErrorHandler', ErrorHandler, 'window', 'console');\n};\n\nexport default provideServices;\n","import { PropsWithChildren, useEffect } from 'react';\nimport { RouteComponentProps } from 'react-router';\n\nconst ScrollToTop = () => ({ location, children }: PropsWithChildren<RouteComponentProps>) => {\n useEffect(() => {\n scrollTo(0, 0);\n }, [ location ]);\n\n return <>{children}</>;\n};\n\nexport default ScrollToTop;\n","import { Component, ReactNode } from 'react';\nimport { Button } from 'reactstrap';\nimport { SimpleCard } from '../utils/SimpleCard';\n\ninterface ErrorHandlerState {\n hasError: boolean;\n}\n\nconst ErrorHandler = (\n { location }: Window,\n { error }: Console,\n) => class ErrorHandler extends Component<any, ErrorHandlerState> {\n public constructor(props: object) {\n super(props);\n this.state = { hasError: false };\n }\n\n public static getDerivedStateFromError(): ErrorHandlerState {\n return { hasError: true };\n }\n\n public componentDidCatch(e: Error): void {\n if (process.env.NODE_ENV !== 'development') {\n error(e);\n }\n }\n\n public render(): ReactNode {\n if (this.state.hasError) {\n return (\n <div className=\"home\">\n <SimpleCard className=\"p-4\">\n <h1>Oops! This is awkward :S</h1>\n <p>It seems that something went wrong. Try refreshing the page or just click this button.</p>\n <br />\n <Button outline color=\"primary\" onClick={() => location.reload()}>Take me back</Button>\n </SimpleCard>\n </div>\n );\n }\n\n return this.props.children;\n }\n};\n\nexport default ErrorHandler;\n","import { 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","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","const PREFIX = 'shlink';\nconst buildPath = (path: string) => `${PREFIX}.${path}`;\n\nexport default class LocalStorage {\n public constructor(private readonly localStorage: Storage) {}\n\n public readonly get = <T>(key: string): T | undefined => {\n const item = this.localStorage.getItem(buildPath(key));\n\n return item ? JSON.parse(item) as T : undefined;\n };\n\n public readonly set = (key: string, value: any) => this.localStorage.setItem(buildPath(key), JSON.stringify(value));\n}\n","import { rangeOf } from '../utils';\nimport LocalStorage from './LocalStorage';\n\nconst HEX_COLOR_LENGTH = 6;\nconst { floor, random } = Math;\nconst letters = '0123456789ABCDEF';\nconst buildRandomColor = () => `#${rangeOf(HEX_COLOR_LENGTH, () => letters[floor(random() * letters.length)]).join('')}`;\nconst normalizeKey = (key: string) => key.toLowerCase().trim();\n\nexport default class ColorGenerator {\n private readonly colors: Record<string, string>;\n\n public constructor(private readonly storage: LocalStorage) {\n this.colors = this.storage.get<Record<string, string>>('colors') ?? {};\n }\n\n public readonly getColorForKey = (key: string) => {\n const normalizedKey = normalizeKey(key);\n const color = this.colors[normalizedKey];\n\n // If a color has not been set yet, generate a random one and save it\n if (!color) {\n return this.setColorForKey(normalizedKey, buildRandomColor());\n }\n\n return color;\n };\n\n public readonly setColorForKey = (key: string, color: string) => {\n const normalizedKey = normalizeKey(key);\n\n this.colors[normalizedKey] = color;\n this.storage.set('colors', this.colors);\n\n return color;\n };\n}\n","import { 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 { 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 { faChevronDown as arrowIcon, faCogs as cogsIcon } from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { FC, useEffect } from 'react';\nimport { Link } from 'react-router-dom';\nimport { Collapse, Nav, Navbar, NavbarBrand, NavbarToggler, NavItem, NavLink } from 'reactstrap';\nimport classNames from 'classnames';\nimport { RouteComponentProps } from 'react-router';\nimport { useToggle } from '../utils/helpers/hooks';\nimport { ShlinkLogo } from './img/ShlinkLogo';\nimport './MainHeader.scss';\n\nconst MainHeader = (ServersDropdown: FC) => ({ location }: RouteComponentProps) => {\n const [ isOpen, toggleOpen, , close ] = useToggle();\n const { pathname } = location;\n\n useEffect(close, [ location ]);\n\n const settingsPath = '/settings';\n const toggleClass = classNames('main-header__toggle-icon', { 'main-header__toggle-icon--opened': isOpen });\n\n return (\n <Navbar color=\"primary\" dark fixed=\"top\" className=\"main-header\" expand=\"md\">\n <NavbarBrand tag={Link} to=\"/\">\n <ShlinkLogo className=\"main-header__brand-logo\" color=\"white\" /> Shlink\n </NavbarBrand>\n\n <NavbarToggler onClick={toggleOpen}>\n <FontAwesomeIcon icon={arrowIcon} className={toggleClass} />\n </NavbarToggler>\n\n <Collapse navbar isOpen={isOpen}>\n <Nav navbar className=\"ml-auto\">\n <NavItem>\n <NavLink tag={Link} to={settingsPath} active={pathname === settingsPath}>\n <FontAwesomeIcon icon={cogsIcon} /> Settings\n </NavLink>\n </NavItem>\n <ServersDropdown />\n </Nav>\n </Collapse>\n </Navbar>\n );\n};\n\nexport default MainHeader;\n","import { useEffect } from 'react';\nimport { isEmpty, values } from 'ramda';\nimport { Link, RouteChildrenProps } 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 extends RouteChildrenProps {\n servers: ServersMap;\n}\n\nconst Home = ({ servers, history }: HomeProps) => {\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 && history.push(`/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=\"p-4\">\n <ShlinkLogo />\n </div>\n </div>\n <div className=\"col-md-7 home__servers-container\">\n <div className=\"p-4\">\n <h1 className=\"home__title\">Welcome!</h1>\n </div>\n <ServersListGroup embedded servers={serversList}>\n {!hasServers && (\n <div className=\"p-4 text-center\">\n <p className=\"mb-5\">This application will help you manage your Shlink servers.</p>\n <p>\n <Link to=\"/server/create\" className=\"btn btn-outline-primary btn-lg mr-2\">\n <FontAwesomeIcon icon={faPlus} /> <span className=\"ml-1\">Add a server</span>\n </Link>\n </p>\n <p className=\"mb-0 mt-5\">\n <ExternalLink href=\"https://shlink.io/documentation\">\n <small>\n <span className=\"mr-1\">Learn more about Shlink</span> <FontAwesomeIcon icon={faExternalLinkAlt} />\n </small>\n </ExternalLink>\n </p>\n </div>\n )}\n </ServersListGroup>\n </div>\n </Row>\n </Card>\n </div>\n );\n};\n\nexport default Home;\n","import { FC, useEffect } from 'react';\nimport { Redirect, Route, Switch } from 'react-router-dom';\nimport { faBars as burgerIcon } from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport classNames from 'classnames';\nimport { withSelectedServer } from '../servers/helpers/withSelectedServer';\nimport { useSwipeable, useToggle } from '../utils/helpers/hooks';\nimport { supportsDomainRedirects, 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 ServerError: FC,\n Overview: FC,\n EditShortUrl: FC,\n ManageDomains: FC,\n) => withSelectedServer(({ location, selectedServer }) => {\n const [ sidebarVisible, toggleSidebar, showSidebar, hideSidebar ] = useToggle();\n\n useEffect(() => hideSidebar(), [ location ]);\n\n if (!isReachableServer(selectedServer)) {\n return <ServerError />;\n }\n\n const addOrphanVisitsRoute = supportsOrphanVisits(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 <Switch>\n <Redirect exact from=\"/server/:serverId\" to=\"/server/:serverId/overview\" />\n <Route exact path=\"/server/:serverId/overview\" component={Overview} />\n <Route exact path=\"/server/:serverId/list-short-urls/:page\" component={ShortUrlsList} />\n <Route exact path=\"/server/:serverId/create-short-url\" component={CreateShortUrl} />\n <Route path=\"/server/:serverId/short-code/:shortCode/visits\" component={ShortUrlVisits} />\n <Route path=\"/server/:serverId/short-code/:shortCode/edit\" component={EditShortUrl} />\n <Route path=\"/server/:serverId/tag/:tag/visits\" component={TagVisits} />\n {addOrphanVisitsRoute && <Route path=\"/server/:serverId/orphan-visits\" component={OrphanVisits} />}\n <Route exact path=\"/server/:serverId/manage-tags\" component={TagsList} />\n {addManageDomainsRoute && <Route exact path=\"/server/:serverId/manage-domains\" component={ManageDomains} />}\n <Route\n render={() => <NotFound to={`/server/${selectedServer.id}/list-short-urls/1`}>List short URLs</NotFound>}\n />\n </Switch>\n </div>\n </div>\n </div>\n </div>\n </>\n );\n}, ServerError);\n\nexport default MenuLayout;\n","import {\n faList as listIcon,\n faLink as createIcon,\n faTags as tagsIcon,\n faPen as editIcon,\n faHome as overviewIcon,\n faGlobe as domainsIcon,\n} from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { FC } from 'react';\nimport { NavLink, NavLinkProps } from 'react-router-dom';\nimport classNames from 'classnames';\nimport { Location } from 'history';\nimport { DeleteServerButtonProps } from '../servers/DeleteServerButton';\nimport { 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={classNames('aside-menu__item', className)}\n activeClassName=\"aside-menu__item--selected\"\n to={to}\n {...rest}\n >\n {children}\n </NavLink>\n);\n\nconst AsideMenu = (DeleteServerButton: FC<DeleteServerButtonProps>) => (\n { selectedServer, showOnMobile = false }: AsideMenuProps,\n) => {\n const hasId = isServerWithId(selectedServer);\n const serverId = hasId ? selectedServer.id : '';\n const addManageDomainsLink = supportsDomainRedirects(selectedServer);\n const asideClass = classNames('aside-menu', {\n 'aside-menu--hidden': !showOnMobile,\n });\n const shortUrlsIsActive = (_: null, location: Location) => location.pathname.match('/list-short-urls') !== null;\n const buildPath = (suffix: string) => `/server/${serverId}${suffix}`;\n\n return (\n <aside className={asideClass}>\n <nav className=\"nav flex-column aside-menu__nav\">\n <AsideMenuItem to={buildPath('/overview')}>\n <FontAwesomeIcon fixedWidth icon={overviewIcon} />\n <span className=\"aside-menu__item-text\">Overview</span>\n </AsideMenuItem>\n <AsideMenuItem to={buildPath('/list-short-urls/1')} isActive={shortUrlsIsActive}>\n <FontAwesomeIcon 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 { CardProps } from 'reactstrap/lib/Card';\nimport { Card, CardBody, CardHeader } from 'reactstrap';\nimport { ReactNode } from 'react';\n\ninterface SimpleCardProps extends Omit<CardProps, 'title'> {\n title?: ReactNode;\n bodyClassName?: string;\n}\n\nexport const SimpleCard = ({ title, children, bodyClassName, ...rest }: SimpleCardProps) => (\n <Card {...rest}>\n {title && <CardHeader>{title}</CardHeader>}\n <CardBody className={bodyClassName}>{children}</CardBody>\n </Card>\n);\n","import { 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","export const MAIN_COLOR = '#4696e5';\n\nexport const MAIN_COLOR_ALPHA = 'rgba(70, 150, 229, 0.4)';\n\nexport const HIGHLIGHTED_COLOR = '#f77f28';\n\nexport const HIGHLIGHTED_COLOR_ALPHA = 'rgba(247, 127, 40, 0.4)';\n\nexport const PRIMARY_LIGHT_COLOR = 'white';\n\nexport const PRIMARY_DARK_COLOR = '#161b22';\n\nexport type Theme = 'dark' | 'light';\n\nexport const changeThemeInMarkup = (theme: Theme) => {\n const html = document.getElementsByTagName('html');\n\n html?.[0]?.setAttribute('data-theme', theme);\n};\n\nexport const isDarkThemeEnabled = (): boolean => {\n const html = document.getElementsByTagName('html');\n\n return html?.[0]?.getAttribute('data-theme') === 'dark';\n};\n","import 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 { 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","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';\n\nconst buildShlinkBaseUrl = (url: string, apiVersion: number) => url ? `${url}/rest/v${apiVersion}` : '';\nconst rejectNilProps = reject(isNil);\nconst normalizeOrderByInParams = (params: ShlinkShortUrlsListParams): ShlinkShortUrlsListNormalizedParams => {\n const { orderBy = {}, ...rest } = params;\n const { field, dir } = orderBy;\n\n return !dir ? rest : {\n ...rest,\n orderBy: `${field}-${dir}`,\n };\n};\n\nexport default class ShlinkApiClient {\n private apiVersion: number;\n\n public constructor(\n private readonly axios: AxiosInstance,\n private readonly baseUrl: string,\n private readonly apiKey: string,\n ) {\n this.apiVersion = 2;\n }\n\n public readonly listShortUrls = async (params: 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 getVisitsOverview = async (): Promise<ShlinkVisitsOverview> =>\n this.performRequest<{ visits: ShlinkVisitsOverview }>('/visits', 'GET')\n .then(({ data }) => data.visits);\n\n public readonly getShortUrl = async (shortCode: string, domain?: OptionalString): Promise<ShortUrl> =>\n this.performRequest<ShortUrl>(`/short-urls/${shortCode}`, 'GET', { domain })\n .then(({ data }) => data);\n\n public readonly deleteShortUrl = async (shortCode: string, domain?: OptionalString): Promise<void> =>\n this.performRequest(`/short-urls/${shortCode}`, 'DELETE', { domain })\n .then(() => {});\n\n /* @deprecated. If using Shlink 2.6.0 or greater, use updateShortUrl instead */\n public readonly updateShortUrlTags = async (\n shortCode: string,\n domain: OptionalString,\n tags: string[],\n ): Promise<string[]> =>\n this.performRequest<{ tags: string[] }>(`/short-urls/${shortCode}/tags`, 'PUT', { domain }, { tags })\n .then(({ data }) => data.tags);\n\n public readonly updateShortUrl = async (\n shortCode: string,\n domain: OptionalString,\n data: ShlinkShortUrlData,\n ): Promise<ShortUrl> =>\n this.performRequest<ShortUrl>(`/short-urls/${shortCode}`, 'PATCH', { domain }, data)\n .then(({ data }) => data);\n\n public readonly listTags = async (): Promise<ShlinkTags> =>\n this.performRequest<{ tags: ShlinkTagsResponse }>('/tags', 'GET', { withStats: 'true' })\n .then((resp) => resp.data.tags)\n .then(({ data, stats }) => ({ tags: data, stats }));\n\n public readonly deleteTags = async (tags: string[]): Promise<{ tags: string[] }> =>\n this.performRequest('/tags', 'DELETE', { tags })\n .then(() => ({ tags }));\n\n public readonly editTag = async (oldName: string, newName: string): Promise<{ oldName: string; newName: string }> =>\n this.performRequest('/tags', 'PUT', {}, { oldName, newName })\n .then(() => ({ oldName, newName }));\n\n public readonly health = async (): Promise<ShlinkHealth> =>\n this.performRequest<ShlinkHealth>('/health', 'GET')\n .then((resp) => resp.data);\n\n public readonly mercureInfo = async (): Promise<ShlinkMercureInfo> =>\n this.performRequest<ShlinkMercureInfo>('/mercure-info', 'GET')\n .then((resp) => resp.data);\n\n public readonly listDomains = async (): Promise<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 try {\n return await this.axios({\n method,\n url: `${buildShlinkBaseUrl(this.baseUrl, this.apiVersion)}${url}`,\n headers: { 'X-Api-Key': this.apiKey },\n params: rejectNilProps(query),\n data: body,\n paramsSerializer: stringifyQuery,\n });\n } catch (e: any) {\n const { response } = e;\n\n // Due to a bug on all previous Shlink versions, requests to non-matching URLs will always result on a CORS error\n // when performed from the browser (due to the preflight request not returning a 2xx status.\n // See https://github.com/shlinkio/shlink/issues/614), which will make the \"response\" prop not to be set here.\n // The bug will be fixed on upcoming Shlink patches, but for other versions, we can consider this situation as\n // if a request has been performed to a not supported API version.\n const apiVersionIsNotSupported = !response;\n\n // When the request is not invalid or we have already tried both API versions, throw the error and let the\n // caller handle it\n if (!apiVersionIsNotSupported || this.apiVersion === 2) {\n throw e;\n }\n\n this.apiVersion = this.apiVersion - 1;\n\n return await this.performRequest(url, method, query, body);\n }\n };\n}\n","import { AxiosInstance } from 'axios';\nimport { prop } from 'ramda';\nimport { hasServerData, SelectedServer, ServerWithId } from '../../servers/data';\nimport { GetState } from '../../container/types';\nimport ShlinkApiClient from './ShlinkApiClient';\n\nconst apiClients: Record<string, ShlinkApiClient> = {};\n\nconst isGetState = (getStateOrSelectedServer: GetState | ServerWithId): getStateOrSelectedServer is GetState =>\n typeof getStateOrSelectedServer === 'function';\nconst getSelectedServerFromState = (getState: GetState): SelectedServer => prop('selectedServer', getState());\n\nexport type ShlinkApiClientBuilder = (getStateOrSelectedServer: GetState | ServerWithId) => ShlinkApiClient;\n\nconst buildShlinkApiClient = (axios: AxiosInstance): ShlinkApiClientBuilder => (\n getStateOrSelectedServer: GetState | ServerWithId,\n) => {\n const server = isGetState(getStateOrSelectedServer)\n ? getSelectedServerFromState(getStateOrSelectedServer)\n : getStateOrSelectedServer;\n\n if (!hasServerData(server)) {\n throw new Error('There\\'s no selected server or it is not found');\n }\n\n const { url, apiKey } = server;\n const clientKey = `${url}_${apiKey}`;\n\n if (!apiClients[clientKey]) {\n apiClients[clientKey] = new ShlinkApiClient(axios, url, apiKey);\n }\n\n return apiClients[clientKey];\n};\n\nexport default buildShlinkApiClient;\n","import Bottle from 'bottlejs';\nimport buildShlinkApiClient from './ShlinkApiClientBuilder';\n\nconst provideServices = (bottle: Bottle) => {\n bottle.serviceFactory('buildShlinkApiClient', buildShlinkApiClient, 'axios');\n};\n\nexport default provideServices;\n","import { FC, MouseEventHandler } from 'react';\nimport ColorGenerator from '../../utils/services/ColorGenerator';\nimport './Tag.scss';\n\ninterface TagProps {\n colorGenerator: ColorGenerator;\n text: string;\n className?: string;\n clearable?: boolean;\n onClick?: MouseEventHandler;\n onClose?: MouseEventHandler;\n}\n\nconst Tag: FC<TagProps> = ({ text, children, clearable, className = '', colorGenerator, onClick, onClose }) => (\n <span\n className={`badge tag ${className}`}\n style={{ backgroundColor: colorGenerator.getColorForKey(text), cursor: clearable || !onClick ? 'auto' : 'pointer' }}\n onClick={onClick}\n >\n {children ?? text}\n {clearable && <span className=\"close tag__close-selected-tag\" onClick={onClose}>×</span>}\n </span>\n);\n\nexport default Tag;\n","import { FC } from 'react';\nimport { Dropdown, DropdownMenu, DropdownToggle } from 'reactstrap';\nimport { useToggle } from './helpers/hooks';\nimport './DropdownBtn.scss';\n\nexport interface DropdownBtnProps {\n text: string;\n disabled?: boolean;\n className?: string;\n dropdownClassName?: string;\n right?: boolean;\n minWidth?: number;\n}\n\nexport const DropdownBtn: FC<DropdownBtnProps> = (\n { text, disabled = false, className = '', children, dropdownClassName, right = false, minWidth },\n) => {\n const [ isOpen, toggle ] = useToggle();\n const toggleClasses = `dropdown-btn__toggle btn-block ${className}`;\n const style = { minWidth: minWidth && `${minWidth}px` };\n\n return (\n <Dropdown isOpen={isOpen} toggle={toggle} disabled={disabled} className={dropdownClassName}>\n <DropdownToggle caret className={toggleClasses} color=\"primary\">{text}</DropdownToggle>\n <DropdownMenu className=\"w-100\" right={right} style={style}>{children}</DropdownMenu>\n </Dropdown>\n );\n};\n","import { format, formatISO, 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 { RouteChildrenProps } from 'react-router-dom';\nimport { useMemo } from 'react';\nimport { isEmpty } from 'ramda';\nimport { parseQuery, stringifyQuery } from '../../utils/helpers/query';\n\ntype ServerIdRouteProps = RouteChildrenProps<{ serverId: string }>;\ntype ToFirstPage = (extra: Partial<ShortUrlsQuery>) => void;\n\nexport interface ShortUrlListRouteParams {\n page: string;\n serverId: string;\n}\n\ninterface ShortUrlsQuery {\n tags?: string;\n search?: string;\n startDate?: string;\n endDate?: string;\n}\n\nexport const useShortUrlsQuery = ({ history, location, match }: ServerIdRouteProps): [ShortUrlsQuery, ToFirstPage] => {\n const query = useMemo(() => parseQuery<ShortUrlsQuery>(location.search), [ location ]);\n const toFirstPageWithExtra = (extra: Partial<ShortUrlsQuery>) => {\n const evolvedQuery = stringifyQuery({ ...query, ...extra });\n const queryString = isEmpty(evolvedQuery) ? '' : `?${evolvedQuery}`;\n\n history.push(`/server/${match?.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 { RouteChildrenProps } from 'react-router-dom';\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 { ShortUrlListRouteParams, useShortUrlsQuery } from './helpers/hooks';\nimport './SearchBar.scss';\n\nexport type SearchBarProps = RouteChildrenProps<ShortUrlListRouteParams>;\n\nconst dateOrNull = (date?: string) => date ? parseISO(date) : null;\n\nconst SearchBar = (colorGenerator: ColorGenerator) => (props: SearchBarProps) => {\n const [{ search, tags, startDate, endDate }, toFirstPage ] = useShortUrlsQuery(props);\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\n return (\n <div className=\"search-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=\"search-bar__selected-tag mt-3\">\n <FontAwesomeIcon icon={tagsIcon} className=\"search-bar__tags-icon\" />\n \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 SearchBar;\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","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 { CreateVisit } from '../../visits/types';\nimport { MercureInfo } from '../reducers/mercureInfo';\nimport { bindToMercureTopic } from './index';\n\nexport interface MercureBoundProps {\n createNewVisits: (createdVisits: CreateVisit[]) => void;\n loadMercureInfo: () => void;\n mercureInfo: MercureInfo;\n}\n\nexport function boundToMercureHub<T = {}>(\n WrappedComponent: FC<MercureBoundProps & T>,\n getTopicsForProps: (props: T) => string[],\n) {\n const pendingUpdates = new Set<CreateVisit>();\n\n return (props: MercureBoundProps & T) => {\n const { createNewVisits, loadMercureInfo, mercureInfo } = props;\n const { interval } = mercureInfo;\n\n useEffect(() => {\n const onMessage = (visit: CreateVisit) => interval ? pendingUpdates.add(visit) : createNewVisits([ visit ]);\n const closeEventSource = bindToMercureTopic(mercureInfo, getTopicsForProps(props), onMessage, loadMercureInfo);\n\n if (!interval) {\n return closeEventSource;\n }\n\n const timer = setInterval(() => {\n createNewVisits([ ...pendingUpdates ]);\n pendingUpdates.clear();\n }, interval * 1000 * 60);\n\n return pipe(() => clearInterval(timer), () => closeEventSource?.());\n }, [ mercureInfo ]);\n\n return <WrappedComponent {...props} />;\n };\n}\n","import { EventSourcePolyfill as EventSource } from 'event-source-polyfill';\nimport { MercureInfo } from '../reducers/mercureInfo';\n\nexport const bindToMercureTopic = <T>(mercureInfo: MercureInfo, topics: string[], onMessage: (message: T) => void, onTokenExpired: () => void) => { // eslint-disable-line max-len\n const { mercureHubUrl, token, loading, error } = mercureInfo;\n\n if (loading || error || !mercureHubUrl) {\n return undefined;\n }\n\n const onEventSourceMessage = ({ data }: { data: string }) => onMessage(JSON.parse(data) as T);\n const onEventSourceError = ({ status }: { status: number }) => status === 401 && onTokenExpired();\n\n const subscriptions = topics.map((topic) => {\n const hubUrl = new URL(mercureHubUrl);\n\n hubUrl.searchParams.append('topic', topic);\n const es = new EventSource(hubUrl, {\n headers: {\n Authorization: `Bearer ${token}`,\n },\n });\n\n es.onmessage = onEventSourceMessage;\n es.onerror = onEventSourceError;\n\n return es;\n });\n\n return () => subscriptions.forEach((es) => es.close());\n};\n","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 = 'ml-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, Card, Nav, NavLink, Progress, Row } from 'reactstrap';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faCalendarAlt, faMapMarkedAlt, faList, faChartPie, faFileDownload } from '@fortawesome/free-solid-svg-icons';\nimport { IconDefinition } from '@fortawesome/fontawesome-common-types';\nimport { Route, Switch, NavLink as RouterNavLink, Redirect } from 'react-router-dom';\nimport { Location } from 'history';\nimport classNames from 'classnames';\nimport { DateRangeSelector } from '../utils/dates/DateRangeSelector';\nimport Message from '../utils/Message';\nimport { DateInterval, DateRange, intervalToDateRange } from '../utils/dates/types';\nimport { Result } from '../utils/Result';\nimport { ShlinkApiError } from '../api/ShlinkApiError';\nimport { Settings } from '../settings/reducers/settings';\nimport { SelectedServer } from '../servers/data';\nimport { supportsBotVisits } from '../utils/helpers/features';\nimport { prettify } from '../utils/helpers/numbers';\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';\nimport './VisitsStats.scss';\n\nexport interface VisitsStatsProps {\n getVisits: (params: VisitsParams, doIntervalFallback?: boolean) => void;\n visitsInfo: VisitsInfo;\n settings: Settings;\n selectedServer: SelectedServer;\n cancelGetVisits: () => void;\n baseUrl: string;\n domain?: string;\n exportCsv: (visits: NormalizedVisit[]) => void;\n isOrphanVisits?: boolean;\n}\n\ninterface VisitsNavLinkProps {\n title: string;\n subPath: string;\n icon: IconDefinition;\n}\n\ntype Section = 'byTime' | 'byContext' | 'byLocation' | 'list';\n\nconst sections: Record<Section, VisitsNavLinkProps> = {\n byTime: { title: 'By time', subPath: '', icon: faCalendarAlt },\n byContext: { title: 'By context', subPath: '/by-context', icon: faChartPie },\n byLocation: { title: 'By location', subPath: '/by-location', icon: faMapMarkedAlt },\n list: { title: 'List', subPath: '/list', icon: faList },\n};\n\nlet selectedBar: string | undefined;\n\nconst VisitsNavLink: FC<VisitsNavLinkProps & { to: string }> = ({ subPath, title, icon, to }) => (\n <NavLink\n tag={RouterNavLink}\n className=\"visits-stats__nav-link\"\n to={to}\n isActive={(_: null, { pathname }: Location) => pathname.endsWith(`visits${subPath}`)}\n replace\n >\n <FontAwesomeIcon icon={icon} />\n <span className=\"ml-2 d-none d-sm-inline\">{title}</span>\n </NavLink>\n);\n\nconst VisitsStats: FC<VisitsStatsProps> = ({\n children,\n visitsInfo,\n getVisits,\n cancelGetVisits,\n baseUrl,\n domain,\n settings,\n exportCsv,\n selectedServer,\n isOrphanVisits = false,\n}) => {\n const { 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 ? `${baseUrl}${query}` : `${baseUrl}${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 <Card className=\"visits-stats__nav p-0 overflow-hidden\" body>\n <Nav pills fill>\n {Object.entries(sections).map(([ section, props ]) =>\n <VisitsNavLink key={section} {...props} to={buildSectionUrl(props.subPath)} />)}\n </Nav>\n </Card>\n <Row>\n <Switch>\n <Route exact path={baseUrl}>\n <div className=\"col-12 mt-3\">\n <LineChartCard\n title=\"Visits during time\"\n visits={normalizedVisits}\n highlightedVisits={highlightedVisits}\n highlightedLabel={highlightedLabel}\n setSelectedVisits={setSelectedVisits}\n />\n </div>\n </Route>\n\n <Route exact path={`${baseUrl}${sections.byContext.subPath}`}>\n <div className={classNames('mt-3 col-lg-6', { 'col-xl-4': !isOrphanVisits })}>\n <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 </Route>\n\n <Route exact path={`${baseUrl}${sections.byLocation.subPath}`}>\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 </Route>\n\n <Route exact path={`${baseUrl}${sections.list.subPath}`}>\n <div className=\"col-12\">\n <VisitsTable\n visits={normalizedVisits}\n selectedVisits={highlightedVisits}\n setSelectedVisits={setSelectedVisits}\n isOrphanVisits={isOrphanVisits}\n selectedServer={selectedServer}\n />\n </div>\n </Route>\n\n <Redirect to={baseUrl} />\n </Switch>\n </Row>\n </>\n );\n };\n\n return (\n <>\n {children}\n\n <section className=\"mt-3\">\n <div className=\"row flex-md-row-reverse\">\n <div className=\"col-lg-7 col-xl-6\">\n <div className=\"d-md-flex\">\n <div className=\"flex-fill\">\n <DateRangeSelector\n updatable\n disabled={loading}\n initialDateRange={initialInterval}\n defaultText=\"All visits\"\n onDatesChange={setDateRange}\n />\n </div>\n <VisitsFilterDropdown\n className=\"ml-0 ml-md-2 mt-3 mt-md-0\"\n isOrphanVisits={isOrphanVisits}\n botsSupported={botsSupported}\n selected={visitsFilter}\n onChange={setVisitsFilter}\n />\n </div>\n </div>\n {visits.length > 0 && (\n <div className=\"col-lg-5 col-xl-6 mt-3 mt-lg-0\">\n <div className=\"d-flex\">\n <Button\n outline\n disabled={highlightedVisits.length === 0}\n className=\"btn-md-block mr-2\"\n onClick={() => setSelectedVisits([])}\n >\n Clear selection {highlightedVisits.length > 0 && <>({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 { RouteComponentProps } from 'react-router';\nimport { Card } from 'reactstrap';\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 { ShortUrlListRouteParams, useShortUrlsQuery } from './helpers/hooks';\nimport { ShortUrlsOrderableFields, ShortUrlsOrder, SHORT_URLS_ORDERABLE_FIELDS } from './data';\n\ninterface ShortUrlsListProps extends RouteComponentProps<ShortUrlListRouteParams> {\n selectedServer: SelectedServer;\n shortUrlsList: ShortUrlsListState;\n listShortUrls: (params: ShlinkShortUrlsListParams) => void;\n settings: Settings;\n}\n\nconst ShortUrlsList = (ShortUrlsTable: FC<ShortUrlsTableProps>, SearchBar: FC) => boundToMercureHub(({\n listShortUrls,\n match,\n location,\n history,\n shortUrlsList,\n selectedServer,\n settings,\n}: ShortUrlsListProps) => {\n const serverId = getServerId(selectedServer);\n const initialOrderBy = settings.shortUrlsList?.defaultOrdering ?? DEFAULT_SHORT_URLS_ORDERING;\n const [ order, setOrder ] = useState<ShortUrlsOrder>(initialOrderBy);\n const [{ tags, search, startDate, endDate }, toFirstPage ] = useShortUrlsQuery({ history, match, location });\n const selectedTags = useMemo(() => tags?.split(',') ?? [], [ tags ]);\n const { pagination } = shortUrlsList?.shortUrls ?? {};\n\n const handleOrderBy = (field?: ShortUrlsOrderableFields, dir?: OrderDir) => setOrder({ field, dir });\n const orderByColumn = (field: ShortUrlsOrderableFields) => () =>\n handleOrderBy(field, determineOrderDir(field, order.field, order.dir));\n const renderOrderIcon = (field: ShortUrlsOrderableFields) => <TableOrderIcon currentOrder={order} 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: match.params.page,\n searchTerm: search,\n tags: selectedTags,\n itemsPerPage: undefined,\n startDate,\n endDate,\n orderBy: order,\n });\n }, [ match.params.page, search, selectedTags, startDate, endDate, order ]);\n\n return (\n <>\n <div className=\"mb-3\"><SearchBar /></div>\n <div className=\"d-block d-lg-none mb-3\">\n <OrderingDropdown items={SHORT_URLS_ORDERABLE_FIELDS} order={order} 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=\"ml-2 copy-to-clipboard-icon\" />\n </CopyToClipboard>\n);\n","import { parseISO, format as formatDate, getUnixTime, formatDistance } from 'date-fns';\nimport { isDateObject } from './helpers/date';\n\nexport interface DateProps {\n date: Date | string;\n format?: string;\n relative?: boolean;\n}\n\nexport const Time = ({ date, format = 'yyyy-MM-dd HH:mm', relative = false }: DateProps) => {\n const dateObject = isDateObject(date) ? date : parseISO(date);\n\n return (\n <time dateTime={`${getUnixTime(dateObject)}000`}>\n {relative ? `${formatDistance(new Date(), dateObject)} ago` : formatDate(dateObject, format)}\n </time>\n );\n};\n","import { FC } from 'react';\nimport { Link } from 'react-router-dom';\nimport { isServerWithId, SelectedServer, ServerWithId } from '../../servers/data';\nimport { ShortUrl } from '../data';\n\nexport type LinkSuffix = 'visits' | 'edit';\n\nexport interface ShortUrlDetailLinkProps {\n shortUrl?: ShortUrl | null;\n selectedServer?: SelectedServer;\n suffix: LinkSuffix;\n}\n\nconst buildUrl = ({ id }: ServerWithId, { shortCode, domain }: ShortUrl, suffix: LinkSuffix) => {\n const query = domain ? `?domain=${domain}` : '';\n\n return `/server/${id}/short-code/${shortCode}/${suffix}${query}`;\n};\n\nconst ShortUrlDetailLink: FC<ShortUrlDetailLinkProps & Record<string | number, any>> = (\n { selectedServer, shortUrl, suffix, children, ...rest },\n) => {\n if (!selectedServer || !isServerWithId(selectedServer) || !shortUrl) {\n return <span {...rest}>{children}</span>;\n }\n\n return <Link to={buildUrl(selectedServer, shortUrl, suffix)} {...rest}>{children}</Link>;\n};\n\nexport default ShortUrlDetailLink;\n","import { useRef } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faInfoCircle as infoIcon } from '@fortawesome/free-solid-svg-icons';\nimport { UncontrolledTooltip } from 'reactstrap';\nimport classNames from 'classnames';\nimport { prettify } from '../../utils/helpers/numbers';\nimport { ShortUrl } from '../data';\nimport { SelectedServer } from '../../servers/data';\nimport ShortUrlDetailLink from './ShortUrlDetailLink';\nimport './ShortUrlVisitsCount.scss';\n\ninterface ShortUrlVisitsCountProps {\n shortUrl?: ShortUrl | null;\n selectedServer?: SelectedServer;\n visitsCount: number;\n active?: boolean;\n}\n\nconst ShortUrlVisitsCount = ({ visitsCount, shortUrl, selectedServer, active = false }: ShortUrlVisitsCountProps) => {\n const maxVisits = shortUrl?.meta?.maxVisits;\n const visitsLink = (\n <ShortUrlDetailLink selectedServer={selectedServer} shortUrl={shortUrl} suffix=\"visits\">\n <strong\n className={classNames('short-url-visits-count__amount', { 'short-url-visits-count__amount--big': active })}\n >\n {prettify(visitsCount)}\n </strong>\n </ShortUrlDetailLink>\n );\n\n if (!maxVisits) {\n return visitsLink;\n }\n\n const prettifiedMaxVisits = prettify(maxVisits);\n const tooltipRef = useRef<HTMLElement | null>();\n\n return (\n <>\n <span className=\"indivisible\">\n {visitsLink}\n <small\n className=\"short-urls-visits-count__max-visits-control\"\n ref={(el) => {\n tooltipRef.current = el;\n }}\n >\n {' '}/ {prettifiedMaxVisits}{' '}\n <sup>\n <FontAwesomeIcon icon={infoIcon} />\n </sup>\n </small>\n </span>\n <UncontrolledTooltip target={(() => tooltipRef.current) as any} placement=\"bottom\">\n This short URL will not accept more than <b>{prettifiedMaxVisits}</b> visits.\n </UncontrolledTooltip>\n </>\n );\n};\n\nexport default ShortUrlVisitsCount;\n","import { FC, useEffect, useRef } from 'react';\nimport { isEmpty } from 'ramda';\nimport { ExternalLink } from 'react-external-link';\nimport ColorGenerator from '../../utils/services/ColorGenerator';\nimport { StateFlagTimeout } from '../../utils/helpers/hooks';\nimport Tag from '../../tags/helpers/Tag';\nimport { SelectedServer } from '../../servers/data';\nimport { CopyToClipboardIcon } from '../../utils/CopyToClipboardIcon';\nimport { ShortUrl } from '../data';\nimport { Time } from '../../utils/Time';\nimport ShortUrlVisitsCount from './ShortUrlVisitsCount';\nimport { ShortUrlsRowMenuProps } from './ShortUrlsRowMenu';\nimport './ShortUrlsRow.scss';\n\nexport interface ShortUrlsRowProps {\n onTagClick?: (tag: string) => void;\n selectedServer: SelectedServer;\n shortUrl: ShortUrl;\n}\n\nconst ShortUrlsRow = (\n ShortUrlsRowMenu: FC<ShortUrlsRowMenuProps>,\n colorGenerator: ColorGenerator,\n useStateFlagTimeout: StateFlagTimeout,\n) => ({ shortUrl, selectedServer, onTagClick }: ShortUrlsRowProps) => {\n const [ copiedToClipboard, setCopiedToClipboard ] = useStateFlagTimeout();\n const [ active, setActive ] = useStateFlagTimeout(false, 500);\n const isFirstRun = useRef(true);\n\n const renderTags = (tags: string[]) => {\n if (isEmpty(tags)) {\n return <i className=\"indivisible\"><small>No tags</small></i>;\n }\n\n return tags.map((tag) => (\n <Tag\n colorGenerator={colorGenerator}\n key={tag}\n text={tag}\n onClick={() => onTagClick?.(tag)}\n />\n ));\n };\n\n useEffect(() => {\n if (isFirstRun.current) {\n isFirstRun.current = false;\n } else {\n setActive();\n }\n }, [ shortUrl.visitsCount ]);\n\n return (\n <tr className=\"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 badge-warning 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-right\" data-th=\"Visits\">\n <ShortUrlVisitsCount\n visitsCount={shortUrl.visitsCount}\n shortUrl={shortUrl}\n selectedServer={selectedServer}\n active={active}\n />\n </td>\n <td className=\"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';\n","import { ProblemDetailsError } from './types';\nimport { isInvalidArgumentError } from './utils';\n\nexport interface ShlinkApiErrorProps {\n errorData?: ProblemDetailsError;\n fallbackMessage?: string;\n}\n\nexport const ShlinkApiError = ({ errorData, fallbackMessage }: ShlinkApiErrorProps) => (\n <>\n {errorData?.detail ?? fallbackMessage}\n {isInvalidArgumentError(errorData) &&\n <p className=\"mb-0\">Invalid elements: [{errorData.invalidElements.join(', ')}]</p>\n }\n </>\n);\n","import { useEffect, useState } from 'react';\nimport { Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap';\nimport { identity, pipe } from 'ramda';\nimport { ShortUrlDeletion } from '../reducers/shortUrlDeletion';\nimport { ShortUrlModalProps } from '../data';\nimport { handleEventPreventingDefault, OptionalString } from '../../utils/utils';\nimport { Result } from '../../utils/Result';\nimport { isInvalidDeletionError } from '../../api/utils';\nimport { ShlinkApiError } from '../../api/ShlinkApiError';\n\ninterface DeleteShortUrlModalConnectProps extends ShortUrlModalProps {\n shortUrlDeletion: ShortUrlDeletion;\n deleteShortUrl: (shortCode: string, domain: OptionalString) => Promise<void>;\n resetDeleteShortUrl: () => void;\n}\n\nconst DeleteShortUrlModal = (\n { shortUrl, toggle, isOpen, shortUrlDeletion, resetDeleteShortUrl, deleteShortUrl }: DeleteShortUrlModalConnectProps,\n) => {\n const [ inputValue, setInputValue ] = useState('');\n\n useEffect(() => resetDeleteShortUrl, []);\n\n const { error, errorData } = shortUrlDeletion;\n const close = pipe(resetDeleteShortUrl, toggle);\n const handleDeleteUrl = handleEventPreventingDefault(() => {\n const { shortCode, domain } = shortUrl;\n\n deleteShortUrl(shortCode, domain)\n .then(toggle)\n .catch(identity);\n });\n\n return (\n <Modal isOpen={isOpen} toggle={close} centered>\n <form onSubmit={handleDeleteUrl}>\n <ModalHeader toggle={close}>\n <span className=\"text-danger\">Delete short URL</span>\n </ModalHeader>\n <ModalBody>\n <p><b className=\"text-danger\">Caution!</b> You are about to delete a short URL.</p>\n <p>This action cannot be undone. Once you have deleted it, all the visits stats will be lost.</p>\n <p>Write <b>{shortUrl.shortCode}</b> to confirm deletion.</p>\n\n <input\n type=\"text\"\n className=\"form-control\"\n placeholder={`Insert the short code (${shortUrl.shortCode})`}\n value={inputValue}\n onChange={(e) => setInputValue(e.target.value)}\n />\n\n {error && (\n <Result type={isInvalidDeletionError(errorData) ? 'warning' : 'error'} small className=\"mt-2\">\n <ShlinkApiError errorData={errorData} fallbackMessage=\"Something went wrong while deleting the URL :(\" />\n </Result>\n )}\n </ModalBody>\n <ModalFooter>\n <button type=\"button\" className=\"btn btn-link\" onClick={close}>Cancel</button>\n <button\n type=\"submit\"\n className=\"btn btn-danger\"\n disabled={inputValue !== shortUrl.shortCode || shortUrlDeletion.loading}\n >\n {shortUrlDeletion.loading ? 'Deleting...' : 'Delete'}\n </button>\n </ModalFooter>\n </form>\n </Modal>\n );\n};\n\nexport default DeleteShortUrlModal;\n","import { faCopy as copyIcon } from '@fortawesome/free-regular-svg-icons';\nimport { faTimes as closeIcon } from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { isNil } from 'ramda';\nimport { useEffect } from 'react';\nimport CopyToClipboard from 'react-copy-to-clipboard';\nimport { Tooltip } from 'reactstrap';\nimport { ShortUrlCreation } from '../reducers/shortUrlCreation';\nimport { StateFlagTimeout } from '../../utils/helpers/hooks';\nimport { Result } from '../../utils/Result';\nimport './CreateShortUrlResult.scss';\nimport { ShlinkApiError } from '../../api/ShlinkApiError';\n\nexport interface CreateShortUrlResultProps extends ShortUrlCreation {\n resetCreateShortUrl: () => void;\n canBeClosed?: boolean;\n}\n\nconst CreateShortUrlResult = (useStateFlagTimeout: StateFlagTimeout) => (\n { error, errorData, result, resetCreateShortUrl, canBeClosed = false }: CreateShortUrlResultProps,\n) => {\n const [ showCopyTooltip, setShowCopyTooltip ] = useStateFlagTimeout();\n\n useEffect(() => {\n resetCreateShortUrl();\n }, []);\n\n if (error) {\n return (\n <Result type=\"error\" className=\"mt-3\">\n {canBeClosed && <FontAwesomeIcon icon={closeIcon} className=\"float-right pointer\" onClick={resetCreateShortUrl} />}\n <ShlinkApiError errorData={errorData} fallbackMessage=\"An error occurred while creating the URL :(\" />\n </Result>\n );\n }\n\n if (isNil(result)) {\n return null;\n }\n\n const { shortUrl } = result;\n\n return (\n <Result type=\"success\" className=\"mt-3\">\n {canBeClosed && <FontAwesomeIcon icon={closeIcon} className=\"float-right pointer\" onClick={resetCreateShortUrl} />}\n <b>Great!</b> The short URL is <b>{shortUrl}</b>\n\n <CopyToClipboard text={shortUrl} onCopy={setShowCopyTooltip}>\n <button\n className=\"btn btn-light btn-sm create-short-url-result__copy-btn\"\n id=\"copyBtn\"\n type=\"button\"\n >\n <FontAwesomeIcon icon={copyIcon} /> Copy\n </button>\n </CopyToClipboard>\n\n <Tooltip placement=\"left\" isOpen={showCopyTooltip} target=\"copyBtn\">\n Copied!\n </Tooltip>\n </Result>\n );\n};\n\nexport default CreateShortUrlResult;\n","import { 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, init, last, pipe, reject } from 'ramda';\nimport { Action, Dispatch } from 'redux';\nimport { shortUrlMatches } from '../helpers';\nimport { CREATE_VISITS, CreateVisitsAction } from '../../visits/reducers/visitCreation';\nimport { buildReducer } from '../../utils/helpers/redux';\nimport { GetState } from '../../container/types';\nimport { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';\nimport { 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 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 and remove the last one.\n (state: ShortUrlsList, { result }: CreateShortUrlAction) => !state.shortUrls ? state : assocPath(\n [ 'shortUrls', 'data' ],\n [ result, ...init(state.shortUrls.data) ],\n state,\n ),\n (state: ShortUrlsList) => !state.shortUrls ? state : assocPath(\n [ 'shortUrls', 'pagination', 'totalItems' ],\n state.shortUrls.pagination.totalItems + 1,\n state,\n ),\n ),\n [SHORT_URL_EDITED]: (state, { shortUrl: editedShortUrl }) => !state.shortUrls ? state : assocPath(\n [ 'shortUrls', 'data' ],\n state.shortUrls.data.map((shortUrl) => {\n const { shortCode, domain } = editedShortUrl;\n\n return shortUrlMatches(shortUrl, shortCode, domain) ? editedShortUrl : shortUrl;\n }),\n state,\n ),\n}, initialState);\n\nexport const listShortUrls = (buildShlinkApiClient: ShlinkApiClientBuilder) => (\n params: 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', 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 classNames from 'classnames';\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\n className={classNames({ 'col-md-4': willRenderThreeControls, 'col-md-6': !willRenderThreeControls })}\n >\n <label className=\"mb-0\">Size: {size}px</label>\n <input\n type=\"range\"\n className=\"form-control-range\"\n value={size}\n step={10}\n min={50}\n max={1000}\n onChange={(e) => setSize(Number(e.target.value))}\n />\n </FormGroup>\n {capabilities.marginIsSupported && (\n <FormGroup className={willRenderThreeControls ? 'col-md-4' : 'col-md-6'}>\n <label className=\"mb-0\">Margin: {margin}px</label>\n <input\n type=\"range\"\n className=\"form-control-range\"\n value={margin}\n step={1}\n min={0}\n max={100}\n onChange={(e) => setMargin(Number(e.target.value))}\n />\n </FormGroup>\n )}\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=\"ml-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 { ChangeEvent, FC, useRef } from 'react';\nimport classNames from 'classnames';\nimport { v4 as uuid } from 'uuid';\nimport { identity } from 'ramda';\n\nexport interface BooleanControlProps {\n checked?: boolean;\n onChange?: (checked: boolean, e: ChangeEvent<HTMLInputElement>) => void;\n className?: string;\n inline?: boolean;\n}\n\ninterface BooleanControlWithTypeProps extends BooleanControlProps {\n type: 'switch' | 'checkbox';\n}\n\nconst BooleanControl: FC<BooleanControlWithTypeProps> = (\n { checked = false, onChange = identity, className, children, type, inline = false },\n) => {\n const { current: id } = useRef(uuid());\n const onChecked = (e: ChangeEvent<HTMLInputElement>) => onChange(e.target.checked, e);\n const typeClasses = {\n 'custom-switch': type === 'switch',\n 'custom-checkbox': type === 'checkbox',\n };\n const style = inline ? { display: 'inline-block' } : {};\n\n return (\n <span className={classNames('custom-control', typeClasses, className)} style={style}>\n <input type=\"checkbox\" className=\"custom-control-input\" id={id} checked={checked} onChange={onChecked} />\n <label className=\"custom-control-label\" htmlFor={id}>{children}</label>\n </span>\n );\n};\n\nexport default BooleanControl;\n","import { FC } from 'react';\nimport BooleanControl, { BooleanControlProps } from './BooleanControl';\n\nconst Checkbox: FC<BooleanControlProps> = (props) => <BooleanControl type=\"checkbox\" {...props} />;\n\nexport default Checkbox;\n","import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faInfoCircle as infoIcon } from '@fortawesome/free-solid-svg-icons';\nimport { Modal, ModalBody, ModalHeader } from 'reactstrap';\nimport { useToggle } from '../utils/helpers/hooks';\nimport './UseExistingIfFoundInfoIcon.scss';\n\nconst InfoModal = ({ isOpen, toggle }: { isOpen: boolean; toggle: () => void }) => (\n <Modal isOpen={isOpen} toggle={toggle} centered size=\"lg\">\n <ModalHeader toggle={toggle}>Info</ModalHeader>\n <ModalBody>\n <p>\n When the \n <b><i>"Use existing URL if found"</i></b>\n checkbox is checked, the server will return an existing short URL if it matches provided params.\n </p>\n <p>\n These are the checks performed by Shlink in order to determine if an existing short URL should be returned:\n </p>\n <ul>\n <li>\n When only the long URL is provided: The most recent match will be returned, or a new short URL will be created\n if none is found.\n </li>\n <li>\n When long URL and custom slug and/or domain are provided: Same as in previous case, but it will try to match\n the short URL using both the long URL and the slug, the long URL and the domain, or the three of them.\n <br />\n If the slug is being used by another long URL, an error will be returned.\n </li>\n <li>\n When other params are provided: Same as in previous cases, but it will try to match existing short URLs with\n all provided data. If any of them does not match, a new short URL will be created\n </li>\n </ul>\n </ModalBody>\n </Modal>\n);\n\nconst UseExistingIfFoundInfoIcon = () => {\n const [ isModalOpen, toggleModal ] = useToggle();\n\n return (\n <>\n <span title=\"What does this mean?\">\n <FontAwesomeIcon icon={infoIcon} style={{ cursor: 'pointer' }} onClick={toggleModal} />\n </span>\n <InfoModal isOpen={isModalOpen} toggle={toggleModal} />\n </>\n );\n};\n\nexport default UseExistingIfFoundInfoIcon;\n","import { 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 ? 'mr-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/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 <div className=\"form-group\">\n <DateInput\n selected={shortUrlData[id] ? toDate(shortUrlData[id] as string | Date) : null}\n placeholderText={placeholder}\n isClearable\n onChange={(date) => setShortUrlData({ ...shortUrlData, [id]: date })}\n {...props}\n />\n </div>\n );\n const basicComponents = (\n <>\n <FormGroup>\n <Input\n bsSize=\"lg\"\n type=\"url\"\n placeholder=\"URL to be shortened\"\n required\n value={shortUrlData.longUrl}\n onChange={(e) => setShortUrlData({ ...shortUrlData, longUrl: e.target.value })}\n />\n </FormGroup>\n <Row>\n {isBasicMode && renderOptionalInput('customSlug', 'Custom slug', 'text', { bsSize: 'lg' }, { className: 'col-lg-6' })}\n <FormGroup className={isBasicMode ? 'col-lg-6' : 'col-12 mb-0'}>\n <TagsSelector selectedTags={shortUrlData.tags ?? []} onChange={changeTags} />\n </FormGroup>\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 <FormGroup>\n <DomainSelector\n value={shortUrlData.domain}\n onChange={(domain?: string) => setShortUrlData({ ...shortUrlData, domain })}\n />\n </FormGroup>\n </>\n )}\n </SimpleCard>\n </div>\n )}\n\n <div className={limitAccessCardClasses}>\n <SimpleCard title=\"Limit access to the short URL\">\n {renderOptionalInput('maxVisits', 'Maximum number of visits allowed', 'number', { min: 1 })}\n {renderDateInput('validSince', 'Enabled since...', { maxDate: shortUrlData.validUntil ? toDate(shortUrlData.validUntil) : undefined })}\n {renderDateInput('validUntil', 'Enabled until...', { minDate: shortUrlData.validSince ? toDate(shortUrlData.validSince) : undefined })}\n </SimpleCard>\n </div>\n </Row>\n\n <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=\"mr-2\"\n checked={shortUrlData.findIfExists}\n onChange={(findIfExists) => setShortUrlData({ ...shortUrlData, findIfExists })}\n >\n Use existing URL if found\n </Checkbox>\n <UseExistingIfFoundInfoIcon />\n </p>\n )}\n </SimpleCard>\n </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 { RouteComponentProps } from 'react-router';\nimport { Button, Card } from 'reactstrap';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faArrowLeft } from '@fortawesome/free-solid-svg-icons';\nimport { ExternalLink } from 'react-external-link';\nimport { SelectedServer } from '../servers/data';\nimport { Settings, ShortUrlCreationSettings } from '../settings/reducers/settings';\nimport { OptionalString } from '../utils/utils';\nimport { parseQuery } from '../utils/helpers/query';\nimport Message from '../utils/Message';\nimport { Result } from '../utils/Result';\nimport { ShlinkApiError } from '../api/ShlinkApiError';\nimport { useToggle } from '../utils/helpers/hooks';\nimport { ShortUrlFormProps } from './ShortUrlForm';\nimport { ShortUrlDetail } from './reducers/shortUrlDetail';\nimport { EditShortUrlData, ShortUrl, ShortUrlData } from './data';\nimport { ShortUrlEdition } from './reducers/shortUrlEdition';\n\ninterface EditShortUrlConnectProps extends RouteComponentProps<{ shortCode: string }> {\n settings: Settings;\n selectedServer: SelectedServer;\n shortUrlDetail: ShortUrlDetail;\n shortUrlEdition: ShortUrlEdition;\n getShortUrlDetail: (shortCode: string, domain: OptionalString) => void;\n editShortUrl: (shortUrl: string, domain: OptionalString, data: EditShortUrlData) => Promise<void>;\n}\n\nconst getInitialState = (shortUrl?: ShortUrl, settings?: ShortUrlCreationSettings): ShortUrlData => {\n const validateUrl = settings?.validateUrls ?? false;\n\n if (!shortUrl) {\n return { longUrl: '', validateUrl };\n }\n\n return {\n longUrl: shortUrl.longUrl,\n tags: shortUrl.tags,\n title: shortUrl.title ?? undefined,\n domain: shortUrl.domain ?? undefined,\n validSince: shortUrl.meta.validSince ?? undefined,\n validUntil: shortUrl.meta.validUntil ?? undefined,\n maxVisits: shortUrl.meta.maxVisits ?? undefined,\n crawlable: shortUrl.crawlable,\n forwardQuery: shortUrl.forwardQuery,\n validateUrl,\n };\n};\n\nexport const EditShortUrl = (ShortUrlForm: FC<ShortUrlFormProps>) => ({\n history: { goBack },\n match: { params },\n location: { search },\n settings: { shortUrlCreation: shortUrlCreationSettings },\n selectedServer,\n shortUrlDetail,\n getShortUrlDetail,\n shortUrlEdition,\n editShortUrl,\n}: EditShortUrlConnectProps) => {\n const { loading, error, errorData, shortUrl } = shortUrlDetail;\n const { saving, error: savingError, errorData: savingErrorData } = shortUrlEdition;\n const { domain } = parseQuery<{ domain?: string }>(search);\n const initialState = useMemo(\n () => getInitialState(shortUrl, shortUrlCreationSettings),\n [ shortUrl, shortUrlCreationSettings ],\n );\n const [ savingSucceeded,, isSuccessful, isNotSuccessful ] = useToggle();\n\n useEffect(() => {\n getShortUrlDetail(params.shortCode, domain);\n }, []);\n\n if (loading) {\n return <Message loading />;\n }\n\n if (error) {\n return (\n <Result type=\"error\">\n <ShlinkApiError errorData={errorData} fallbackMessage=\"An error occurred while loading short URL detail :(\" />\n </Result>\n );\n }\n\n return (\n <>\n <header className=\"mb-3\">\n <Card body>\n <h2 className=\"d-sm-flex justify-content-between align-items-center mb-0\">\n <Button color=\"link\" size=\"lg\" className=\"p-0 mr-3\" onClick={goBack}>\n <FontAwesomeIcon icon={faArrowLeft} />\n </Button>\n <span className=\"text-center\">\n <small>Edit <ExternalLink href={shortUrl?.shortUrl ?? ''} /></small>\n </span>\n <span />\n </h2>\n </Card>\n </header>\n <ShortUrlForm\n initialState={initialState}\n saving={saving}\n selectedServer={selectedServer}\n mode=\"edit\"\n onSave={async (shortUrlData) => {\n if (!shortUrl) {\n return;\n }\n\n isNotSuccessful();\n editShortUrl(shortUrl.shortCode, shortUrl.domain, shortUrlData)\n .then(isSuccessful)\n .catch(isNotSuccessful);\n }}\n />\n {savingError && (\n <Result type=\"error\" className=\"mt-3\">\n <ShlinkApiError errorData={savingErrorData} fallbackMessage=\"An error occurred while updating short URL :(\" />\n </Result>\n )}\n {savingSucceeded && <Result type=\"success\" className=\"mt-3\">Short URL properly edited.</Result>}\n </>\n );\n};\n","import { Action, Dispatch } from 'redux';\nimport { ShortUrl } from '../data';\nimport { buildReducer } from '../../utils/helpers/redux';\nimport { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';\nimport { OptionalString } from '../../utils/utils';\nimport { GetState } from '../../container/types';\nimport { shortUrlMatches } from '../helpers';\nimport { ProblemDetailsError } from '../../api/types';\nimport { parseApiError } from '../../api/utils';\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, { Decorator } from 'bottlejs';\nimport SearchBar from '../SearchBar';\nimport ShortUrlsList from '../ShortUrlsList';\nimport ShortUrlsRow from '../helpers/ShortUrlsRow';\nimport ShortUrlsRowMenu from '../helpers/ShortUrlsRowMenu';\nimport CreateShortUrl from '../CreateShortUrl';\nimport DeleteShortUrlModal from '../helpers/DeleteShortUrlModal';\nimport CreateShortUrlResult from '../helpers/CreateShortUrlResult';\nimport { listShortUrls } from '../reducers/shortUrlsList';\nimport { createShortUrl, resetCreateShortUrl } from '../reducers/shortUrlCreation';\nimport { deleteShortUrl, resetDeleteShortUrl } from '../reducers/shortUrlDeletion';\nimport { 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, withRouter: Decorator) => {\n // Components\n bottle.serviceFactory('ShortUrlsList', ShortUrlsList, 'ShortUrlsTable', 'SearchBar');\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 // Services\n bottle.serviceFactory('SearchBar', SearchBar, 'ColorGenerator');\n bottle.decorator('SearchBar', withRouter);\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, useRef } from 'react';\nimport { v4 as uuid } from 'uuid';\nimport { InputType } from 'reactstrap/lib/Input';\nimport { FormGroup } from 'reactstrap';\n\nexport interface FormGroupContainerProps {\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 FormGroupContainer: FC<FormGroupContainerProps> = (\n { children, value, onChange, id, type, required, placeholder, className, labelClassName },\n) => {\n const forId = useRef<string>(id ?? uuid());\n\n return (\n <FormGroup className={className ?? ''}>\n <label htmlFor={forId.current} className={labelClassName ?? ''}>\n {children}:\n </label>\n <input\n className=\"form-control\"\n type={type ?? 'text'}\n id={forId.current}\n value={value}\n required={required ?? true}\n placeholder={placeholder}\n onChange={(e) => onChange(e.target.value)}\n />\n </FormGroup>\n );\n};\n","import { FC, ReactNode, useEffect, useState } from 'react';\nimport { FormGroupContainer, FormGroupContainerProps } from '../../utils/FormGroupContainer';\nimport { handleEventPreventingDefault } from '../../utils/utils';\nimport { ServerData } from '../data';\nimport { SimpleCard } from '../../utils/SimpleCard';\nimport './ServerForm.scss';\n\ninterface ServerFormProps {\n onSubmit: (server: ServerData) => void;\n initialValues?: ServerData;\n title?: ReactNode;\n}\n\nconst FormGroup: FC<FormGroupContainerProps> = (props) =>\n <FormGroupContainer {...props} labelClassName=\"create-server__label\" />;\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 <FormGroup value={name} onChange={setName}>Name</FormGroup>\n <FormGroup type=\"url\" value={url} onChange={setUrl}>URL</FormGroup>\n <FormGroup value={apiKey} onChange={setApiKey}>API key</FormGroup>\n </SimpleCard>\n\n <div className=\"text-right\">{children}</div>\n </form>\n );\n};\n","import { FC } from 'react';\nimport { v4 as uuid } from 'uuid';\nimport { RouterProps } from 'react-router';\nimport { Button } from 'reactstrap';\nimport { Result } from '../utils/Result';\nimport NoMenuLayout from '../common/NoMenuLayout';\nimport { StateFlagTimeout } from '../utils/helpers/hooks';\nimport { ServerForm } from './helpers/ServerForm';\nimport { ImportServersBtnProps } from './helpers/ImportServersBtn';\nimport { ServerData, ServersMap, ServerWithId } from './data';\nimport './CreateServer.scss';\n\nconst SHOW_IMPORT_MSG_TIME = 4000;\n\ninterface CreateServerProps extends RouterProps {\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, history: { push, goBack } }: CreateServerProps,\n) => {\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 handleSubmit = (serverData: ServerData) => {\n const id = uuid();\n\n createServer({ ...serverData, id });\n push(`/server/${id}`);\n };\n\n return (\n <NoMenuLayout>\n <ServerForm title={<h5 className=\"mb-0\">Add new server</h5>} onSubmit={handleSubmit}>\n {!hasServers &&\n <ImportServersBtn tooltipPlacement=\"top\" onImport={setServersImported} onImportError={setErrorImporting} />}\n {hasServers && <Button outline onClick={goBack}>Cancel</Button>}\n <Button outline color=\"primary\" className=\"ml-2\">Create server</Button>\n </ServerForm>\n\n {serversImported && <ImportResult type=\"success\" />}\n {errorImporting && <ImportResult type=\"error\" />}\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=\"ml-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=\"ml-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=\"ml-1\">Servers</span>\n </DropdownToggle>\n <DropdownMenu right>{renderServers()}</DropdownMenu>\n </UncontrolledDropdown>\n );\n};\n\nexport default ServersDropdown;\n","import { FC } from 'react';\nimport { Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap';\nimport { RouterProps } from 'react-router';\nimport { ServerWithId } from './data';\n\nexport interface DeleteServerModalProps {\n server: ServerWithId;\n toggle: () => void;\n isOpen: boolean;\n redirectHome?: boolean;\n}\n\ninterface DeleteServerModalConnectProps extends DeleteServerModalProps, RouterProps {\n deleteServer: (server: ServerWithId) => void;\n}\n\nconst DeleteServerModal: FC<DeleteServerModalConnectProps> = (\n { server, toggle, isOpen, deleteServer, history, redirectHome = true },\n) => {\n const closeModal = () => {\n deleteServer(server);\n toggle();\n redirectHome && history.push('/');\n };\n\n return (\n <Modal isOpen={isOpen} toggle={toggle} centered>\n <ModalHeader toggle={toggle}><span className=\"text-danger\">Remove server</span></ModalHeader>\n <ModalBody>\n <p>Are you sure you want to remove <b>{server ? server.name : ''}</b>?</p>\n <p>\n <i>\n No data will be deleted, only the access to this server will be removed from this device.\n You can create it again at any moment.\n </i>\n </p>\n </ModalBody>\n <ModalFooter>\n <button className=\"btn btn-link\" onClick={toggle}>Cancel</button>\n <button className=\"btn btn-danger\" onClick={() => closeModal()}>Delete</button>\n </ModalFooter>\n </Modal>\n );\n};\n\nexport default DeleteServerModal;\n","import { FC } from 'react';\nimport { faMinusCircle as deleteIcon } from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { useToggle } from '../utils/helpers/hooks';\nimport { DeleteServerModalProps } from './DeleteServerModal';\nimport { ServerWithId } from './data';\n\nexport interface DeleteServerButtonProps {\n server: ServerWithId;\n className?: string;\n textClassName?: string;\n}\n\nconst DeleteServerButton = (DeleteServerModal: FC<DeleteServerModalProps>): FC<DeleteServerButtonProps> => (\n { server, className, children, textClassName },\n) => {\n const [ isModalOpen, , showModal, hideModal ] = useToggle();\n\n return (\n <>\n <span className={className} onClick={showModal}>\n {!children && <FontAwesomeIcon 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 { ServerForm } from './helpers/ServerForm';\nimport { withSelectedServer } from './helpers/withSelectedServer';\nimport { isServerWithId, ServerData } from './data';\n\ninterface EditServerProps {\n editServer: (serverId: string, serverData: ServerData) => void;\n}\n\nexport const EditServer = (ServerError: FC) => withSelectedServer<EditServerProps>((\n { editServer, selectedServer, history: { goBack } },\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=\"mr-2\" onClick={goBack}>Cancel</Button>\n <Button outline color=\"primary\">Save</Button>\n </ServerForm>\n </NoMenuLayout>\n );\n}, ServerError);\n","import { useRef, RefObject, ChangeEvent, MutableRefObject, FC } from 'react';\nimport { Button, UncontrolledTooltip } from 'reactstrap';\nimport { pipe } from 'ramda';\nimport { faFileUpload as importIcon } from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport ServersImporter from '../services/ServersImporter';\nimport { ServerData } from '../data';\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 fileRef: Ref<HTMLInputElement>;\n}\n\nconst ImportServersBtn = ({ importServersFromFile }: ServersImporter): FC<ImportServersBtnConnectProps> => ({\n createServers,\n fileRef,\n children,\n onImport = () => {},\n onImportError = () => {},\n tooltipPlacement = 'bottom',\n className = '',\n}) => {\n const ref = fileRef ?? useRef<HTMLInputElement>();\n const onChange = async ({ target }: ChangeEvent<HTMLInputElement>) =>\n importServersFromFile(target.files?.[0])\n .then(pipe(createServers, onImport))\n .then(() => {\n // Reset input after processing file\n (target as { value: string | null }).value = null;\n })\n .catch(onImportError);\n\n return (\n <>\n <Button 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={onChange} />\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, useEffect } from 'react';\nimport { Card, CardBody, CardHeader, CardText, CardTitle, Row } from 'reactstrap';\nimport { Link, useHistory } from 'react-router-dom';\nimport { ShortUrlsList as ShortUrlsListState } from '../short-urls/reducers/shortUrlsList';\nimport { prettify } from '../utils/helpers/numbers';\nimport { TagsList } from '../tags/reducers/tagsList';\nimport { ShortUrlsTableProps } from '../short-urls/ShortUrlsTable';\nimport { boundToMercureHub } from '../mercure/helpers/boundToMercureHub';\nimport { CreateShortUrlProps } from '../short-urls/CreateShortUrl';\nimport { VisitsOverview } from '../visits/reducers/visitsOverview';\nimport { Versions } from '../utils/helpers/version';\nimport { Topics } from '../mercure/helpers/Topics';\nimport { ShlinkShortUrlsListParams } from '../api/types';\nimport { getServerId, SelectedServer } from './data';\nimport './Overview.scss';\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 history = useHistory();\n\n useEffect(() => {\n listShortUrls({ itemsPerPage: 5, orderBy: { field: 'dateCreated', dir: 'DESC' } });\n listTags();\n loadVisitsOverview();\n }, []);\n\n return (\n <>\n <Row>\n <div className=\"col-md-6 col-xl-3\">\n <Card className=\"overview__card mb-3\" body>\n <CardTitle tag=\"h5\" className=\"overview__card-title\">Visits</CardTitle>\n <CardText tag=\"h2\">{loadingVisits ? 'Loading...' : prettify(visitsCount)}</CardText>\n </Card>\n </div>\n <div className=\"col-md-6 col-xl-3\">\n <Card className=\"overview__card mb-3\" body tag={Link} to={`/server/${serverId}/orphan-visits`}>\n <CardTitle tag=\"h5\" className=\"overview__card-title\">Orphan visits</CardTitle>\n <CardText tag=\"h2\">\n <ForServerVersion minVersion=\"2.6.0\">\n {loadingVisits ? 'Loading...' : prettify(orphanVisitsCount ?? 0)}\n </ForServerVersion>\n <ForServerVersion maxVersion=\"2.5.*\">\n <small className=\"text-muted\"><i>Shlink 2.6 is needed</i></small>\n </ForServerVersion>\n </CardText>\n </Card>\n </div>\n <div className=\"col-md-6 col-xl-3\">\n <Card className=\"overview__card mb-3\" body tag={Link} to={`/server/${serverId}/list-short-urls/1`}>\n <CardTitle tag=\"h5\" className=\"overview__card-title\">Short URLs</CardTitle>\n <CardText tag=\"h2\">\n {loading ? 'Loading...' : prettify(shortUrls?.pagination.totalItems ?? 0)}\n </CardText>\n </Card>\n </div>\n <div className=\"col-md-6 col-xl-3\">\n <Card className=\"overview__card mb-3\" body tag={Link} to={`/server/${serverId}/manage-tags`}>\n <CardTitle tag=\"h5\" className=\"overview__card-title\">Tags</CardTitle>\n <CardText tag=\"h2\">{loadingTags ? 'Loading...' : prettify(tagsList.tags.length)}</CardText>\n </Card>\n </div>\n </Row>\n <Card className=\"mb-3\">\n <CardHeader>\n <span className=\"d-sm-none\">Create a short URL</span>\n <h5 className=\"d-none d-sm-inline\">Create a short URL</h5>\n <Link className=\"float-right\" to={`/server/${serverId}/create-short-url`}>Advanced options »</Link>\n </CardHeader>\n <CardBody>\n <CreateShortUrl basicMode />\n </CardBody>\n </Card>\n <Card>\n <CardHeader>\n <span className=\"d-sm-none\">Recently created URLs</span>\n <h5 className=\"d-none d-sm-inline\">Recently created URLs</h5>\n <Link className=\"float-right\" to={`/server/${serverId}/list-short-urls/1`}>See all »</Link>\n </CardHeader>\n <CardBody>\n <ShortUrlsTable\n shortUrlsList={shortUrlsList}\n selectedServer={selectedServer}\n className=\"mb-0\"\n onTagClick={(tag) => history.push(`/server/${serverId}/list-short-urls/1?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=\"ml-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-right 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 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-right\">\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 default class ServersImporter {\n public constructor(private readonly csvJson: CsvJson, private readonly fileReaderFactory: () => FileReader) {}\n\n public readonly importServersFromFile = async (file?: File | null): Promise<ServerData[]> => {\n if (!file) {\n throw new Error('No file provided');\n }\n\n const reader = this.fileReaderFactory();\n\n return new Promise((resolve, reject) => {\n reader.addEventListener('loadend', (e: ProgressEvent<FileReader>) => {\n try {\n // TODO Read as stream, otherwise, if the file is too big, this will block the browser tab\n const content = e.target?.result?.toString() ?? '';\n const servers = this.csvJson.toObject(content);\n\n if (!validateServers(servers)) {\n throw new Error('Provided file does not have the right format.');\n }\n\n resolve(servers);\n } catch (e) {\n reject(e);\n }\n });\n reader.readAsText(file);\n });\n };\n}\n","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, { Decorator } from 'bottlejs';\nimport CreateServer from '../CreateServer';\nimport ServersDropdown from '../ServersDropdown';\nimport DeleteServerModal from '../DeleteServerModal';\nimport DeleteServerButton from '../DeleteServerButton';\nimport { EditServer } from '../EditServer';\nimport ImportServersBtn from '../helpers/ImportServersBtn';\nimport { resetSelectedServer, selectServer } from '../reducers/selectedServer';\nimport { createServer, createServers, deleteServer, editServer, 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, withRouter: Decorator) => {\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', withRouter);\n bottle.decorator('DeleteServerModal', connect(null, [ 'deleteServer' ]));\n\n bottle.serviceFactory('DeleteServerButton', DeleteServerButton, 'DeleteServerModal');\n\n bottle.serviceFactory('ImportServersBtn', ImportServersBtn, 'ServersImporter');\n bottle.decorator('ImportServersBtn', connect(null, [ 'createServers' ]));\n\n bottle.serviceFactory('ForServerVersion', () => ForServerVersion);\n bottle.decorator('ForServerVersion', connect([ 'selectedServer' ]));\n\n bottle.serviceFactory('ServerError', ServerError, 'DeleteServerButton');\n bottle.decorator('ServerError', connect([ 'servers', 'selectedServer' ]));\n\n bottle.serviceFactory('Overview', Overview, 'ShortUrlsTable', 'CreateShortUrl', 'ForServerVersion');\n bottle.decorator('Overview', connect(\n [ 'shortUrlsList', 'tagsList', 'selectedServer', 'mercureInfo', 'visitsOverview' ],\n [ 'listShortUrls', 'listTags', 'createNewVisits', 'loadMercureInfo', 'loadVisitsOverview' ],\n ));\n\n // Services\n bottle.constant('csvjson', csvjson);\n bottle.constant('fileReaderFactory', () => new FileReader());\n bottle.service('ServersImporter', ServersImporter, 'csvjson', 'fileReaderFactory');\n bottle.service('ServersExporter', ServersExporter, 'Storage', 'window', 'csvjson');\n\n // Actions\n bottle.serviceFactory('selectServer', selectServer, 'buildShlinkApiClient', 'loadMercureInfo');\n bottle.serviceFactory('createServer', () => createServer);\n bottle.serviceFactory('createServers', () => createServers);\n bottle.serviceFactory('deleteServer', () => deleteServer);\n bottle.serviceFactory('editServer', () => editServer);\n bottle.serviceFactory('setAutoConnect', () => setAutoConnect);\n bottle.serviceFactory('fetchServers', fetchServers, 'axios');\n\n bottle.serviceFactory('resetSelectedServer', () => resetSelectedServer);\n};\n\nexport default provideServices;\n","import { Button, Card } from 'reactstrap';\nimport { FC, ReactNode } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faArrowLeft } from '@fortawesome/free-solid-svg-icons';\nimport ShortUrlVisitsCount from '../short-urls/helpers/ShortUrlVisitsCount';\nimport { ShortUrl } from '../short-urls/data';\nimport { Visit } from './types';\n\ninterface VisitsHeaderProps {\n visits: Visit[];\n goBack: () => void;\n title: ReactNode;\n shortUrl?: ShortUrl;\n}\n\nconst VisitsHeader: FC<VisitsHeaderProps> = ({ visits, goBack, shortUrl, children, title }) => (\n <header>\n <Card body>\n <h2 className=\"d-flex justify-content-between align-items-center mb-0\">\n <Button color=\"link\" size=\"lg\" className=\"p-0 mr-3\" onClick={goBack}>\n <FontAwesomeIcon icon={faArrowLeft} />\n </Button>\n <span className=\"text-center d-none d-sm-block\">\n <small>{title}</small>\n </span>\n <span className=\"badge badge-main ml-3\">\n Visits:{' '}\n <ShortUrlVisitsCount visitsCount={visits.length} shortUrl={shortUrl} />\n </span>\n </h2>\n <h3 className=\"text-center d-block d-sm-none mb-0 mt-3\">\n <small>{title}</small>\n </h3>\n\n {children && <div className=\"mt-md-2\">{children}</div>}\n </Card>\n </header>\n);\n\nexport default VisitsHeader;\n","import { UncontrolledTooltip } from 'reactstrap';\nimport { ExternalLink } from 'react-external-link';\nimport { ShortUrlDetail } from '../short-urls/reducers/shortUrlDetail';\nimport { Time } from '../utils/Time';\nimport { ShortUrlVisits } from './reducers/shortUrlVisits';\nimport VisitsHeader from './VisitsHeader';\nimport './ShortUrlVisitsHeader.scss';\n\ninterface ShortUrlVisitsHeaderProps {\n shortUrlDetail: ShortUrlDetail;\n shortUrlVisits: ShortUrlVisits;\n goBack: () => void;\n}\n\nconst ShortUrlVisitsHeader = ({ shortUrlDetail, shortUrlVisits, goBack }: ShortUrlVisitsHeaderProps) => {\n const { shortUrl, loading } = shortUrlDetail;\n const { visits } = shortUrlVisits;\n const shortLink = shortUrl?.shortUrl ?? '';\n const longLink = shortUrl?.longUrl ?? '';\n const title = shortUrl?.title;\n\n const renderDate = () => !shortUrl ? <small>Loading...</small> : (\n <span>\n <b id=\"created\" className=\"short-url-visits-header__created-at\">\n <Time date={shortUrl.dateCreated} relative />\n </b>\n <UncontrolledTooltip placement=\"bottom\" target=\"created\">\n <Time date={shortUrl.dateCreated} />\n </UncontrolledTooltip>\n </span>\n );\n const visitsStatsTitle = <>Visits for <ExternalLink href={shortLink} /></>;\n\n return (\n <VisitsHeader title={visitsStatsTitle} goBack={goBack} visits={visits} shortUrl={shortUrl}>\n <hr />\n <div>Created: {renderDate()}</div>\n <div>\n {`${title ? 'Title' : 'Long URL'}: `}\n {loading && <small>Loading...</small>}\n {!loading && <ExternalLink href={longLink}>{title ?? longLink}</ExternalLink>}\n </div>\n </VisitsHeader>\n );\n};\n\nexport default ShortUrlVisitsHeader;\n","import 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 { FC } from 'react';\nimport BooleanControl, { BooleanControlProps } from './BooleanControl';\n\nconst ToggleSwitch: FC<BooleanControlProps> = (props) => <BooleanControl type=\"switch\" {...props} />;\n\nexport default ToggleSwitch;\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-right\">\n <UncontrolledDropdown>\n <DropdownToggle caret color=\"link\" className=\"btn-sm p-0\">\n Group by\n </DropdownToggle>\n <DropdownMenu right>\n {Object.entries(STEPS_MAP).map(([ value, menuText ]) => (\n <DropdownItem key={value} active={step === value} onClick={() => setStep(value as Step)}>\n {menuText}\n </DropdownItem>\n ))}\n </DropdownMenu>\n </UncontrolledDropdown>\n </div>\n <div className=\"float-right mr-2\">\n <ToggleSwitch checked={skipNoVisits} onChange={toggleSkipNoVisits}>\n <small>Skip dates with no visits</small>\n </ToggleSwitch>\n </div>\n </CardHeader>\n <CardBody className=\"line-chart-card__body\">\n {/* 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 { NormalizedOrphanVisit, NormalizedVisit } from './types';\nimport './VisitsTable.scss';\n\nexport interface VisitsTableProps {\n visits: NormalizedVisit[];\n selectedVisits?: NormalizedVisit[];\n setSelectedVisits: (visits: NormalizedVisit[]) => void;\n matchMedia?: (query: string) => MediaQueryList;\n isOrphanVisits?: boolean;\n selectedServer: SelectedServer;\n}\n\ntype OrderableFields = 'date' | 'country' | 'city' | 'browser' | 'os' | 'referer' | 'visitedUrl' | 'potentialBot';\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 <table className=\"table table-bordered table-hover table-sm table-responsive-sm visits-table\">\n <thead className=\"visits-table__header\">\n <tr>\n <th\n className={`${headerCellsClass} text-center`}\n onClick={() => setSelectedVisits(\n selectedVisits.length < resultSet.total ? resultSet.visitsGroups.flat() : [],\n )}\n >\n <FontAwesomeIcon icon={checkIcon} className={classNames({ 'text-primary': selectedVisits.length > 0 })} />\n </th>\n {supportsBots && (\n <th className={`${headerCellsClass} text-center`} onClick={orderByColumn('potentialBot')}>\n <FontAwesomeIcon icon={botIcon} />\n {renderOrderIcon('potentialBot')}\n </th>\n )}\n <th className={headerCellsClass} onClick={orderByColumn('date')}>\n Date\n {renderOrderIcon('date')}\n </th>\n <th className={headerCellsClass} onClick={orderByColumn('country')}>\n Country\n {renderOrderIcon('country')}\n </th>\n <th className={headerCellsClass} onClick={orderByColumn('city')}>\n City\n {renderOrderIcon('city')}\n </th>\n <th className={headerCellsClass} onClick={orderByColumn('browser')}>\n Browser\n {renderOrderIcon('browser')}\n </th>\n <th className={headerCellsClass} onClick={orderByColumn('os')}>\n OS\n {renderOrderIcon('os')}\n </th>\n <th className={headerCellsClass} onClick={orderByColumn('referer')}>\n Referrer\n {renderOrderIcon('referer')}\n </th>\n {isOrphanVisits && (\n <th className={headerCellsClass} onClick={orderByColumn('visitedUrl')}>\n Visited URL\n {renderOrderIcon('visitedUrl')}\n </th>\n )}\n </tr>\n <tr>\n <td colSpan={fullSizeColSpan} className=\"p-0\">\n <SearchField noBorder large={false} onChange={setSearchTerm} />\n </td>\n </tr>\n </thead>\n <tbody>\n {!resultSet.visitsGroups[page - 1]?.length && (\n <tr>\n <td colSpan={fullSizeColSpan} className=\"text-center\">\n No visits found with current filtering\n </td>\n </tr>\n )}\n {resultSet.visitsGroups[page - 1]?.map((visit, index) => {\n const isSelected = selectedVisits.includes(visit);\n\n return (\n <tr\n key={index}\n style={{ cursor: 'pointer' }}\n className={classNames({ 'table-active': isSelected })}\n onClick={() => setSelectedVisits(\n isSelected ? selectedVisits.filter((v) => v !== visit) : [ ...selectedVisits, visit ],\n )}\n >\n <td className=\"text-center\">\n {isSelected && <FontAwesomeIcon icon={checkIcon} className=\"text-primary\" />}\n </td>\n {supportsBots && (\n <td className=\"text-center\">\n {visit.potentialBot && (\n <>\n <FontAwesomeIcon icon={botIcon} id={`botIcon${index}`} />\n <UncontrolledTooltip placement=\"right\" target={`botIcon${index}`}>\n Potentially a visit from a bot or crawler\n </UncontrolledTooltip>\n </>\n )}\n </td>\n )}\n <td><Time date={visit.date} /></td>\n <td>{visit.country}</td>\n <td>{visit.city}</td>\n <td>{visit.browser}</td>\n <td>{visit.os}</td>\n <td>{visit.referer}</td>\n {isOrphanVisits && <td>{(visit as NormalizedOrphanVisit).visitedUrl}</td>}\n </tr>\n );\n })}\n </tbody>\n {resultSet.total > PAGE_SIZE && (\n <tfoot>\n <tr>\n <td colSpan={fullSizeColSpan} className=\"visits-table__footer-cell visits-table__sticky\">\n <div className=\"row\">\n <div className=\"col-md-6\">\n <SimplePaginator\n pagesCount={Math.ceil(resultSet.total / PAGE_SIZE)}\n currentPage={page}\n setCurrentPage={setPage}\n centered={isMobileDevice}\n />\n </div>\n <div\n className={classNames('col-md-6', {\n 'd-flex align-items-center flex-row-reverse': !isMobileDevice,\n 'text-center mt-3': isMobileDevice,\n })}\n >\n <div>\n Visits <b>{prettify(start + 1)}</b> to{' '}\n <b>{prettify(min(end, resultSet.total))}</b> of{' '}\n <b>{prettify(resultSet.total)}</b>\n </div>\n </div>\n </div>\n </td>\n </tr>\n </tfoot>\n )}\n </table>\n );\n};\n\nexport default VisitsTable;\n","import { FC } from 'react';\nimport { Modal, ModalBody } from 'reactstrap';\nimport { MapContainer, TileLayer, Marker, Popup, MapContainerProps } from 'react-leaflet';\nimport { prop } from 'ramda';\nimport { CityStats } from '../types';\nimport './MapModal.scss';\n\ninterface MapModalProps {\n toggle: () => void;\n isOpen: boolean;\n title: string;\n locations?: CityStats[];\n}\n\nconst OpenStreetMapTile: FC = () => (\n <TileLayer\n attribution='&copy <a href=\"http://osm.org/copyright\">OpenStreetMap</a> contributors'\n url=\"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\"\n />\n);\n\nconst calculateMapProps = (locations: CityStats[]): MapContainerProps => {\n if (locations.length === 0) {\n return {};\n }\n\n if (locations.length > 1) {\n return { bounds: locations.map(prop('latLong')) };\n }\n\n // When there's only one location, an error is thrown if trying to calculate the bounds.\n // When that happens, we use zoom and center as a workaround\n const [{ latLong: center }] = locations;\n\n return { zoom: 10, center };\n};\n\nconst MapModal = ({ toggle, isOpen, title, locations = [] }: MapModalProps) => (\n <Modal toggle={toggle} isOpen={isOpen} className=\"map-modal__modal\" contentClassName=\"map-modal__modal-content\">\n <ModalBody className=\"map-modal__modal-body\">\n <h3 className=\"map-modal__modal-title\">\n {title}\n <button type=\"button\" className=\"close\" onClick={toggle}>×</button>\n </h3>\n <MapContainer {...calculateMapProps(locations)}>\n <OpenStreetMapTile />\n {locations.map(({ cityName, latLong, count }, index) => (\n <Marker key={index} position={latLong}>\n <Popup><b>{count}</b> visit{count > 1 ? 's' : ''} from <b>{cityName}</b></Popup>\n </Marker>\n ))}\n </MapContainer>\n </ModalBody>\n </Modal>\n);\n\nexport default MapModal;\n","import { useRef, useState } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faMapMarkedAlt as mapIcon } from '@fortawesome/free-solid-svg-icons';\nimport { Dropdown, DropdownItem, DropdownMenu, UncontrolledTooltip } from 'reactstrap';\nimport { useToggle } from '../../utils/helpers/hooks';\nimport { CityStats } from '../types';\nimport MapModal from './MapModal';\nimport './OpenMapModalBtn.scss';\n\ninterface OpenMapModalBtnProps {\n modalTitle: string;\n activeCities: string[];\n locations?: CityStats[];\n}\n\nconst OpenMapModalBtn = ({ modalTitle, activeCities, locations = [] }: OpenMapModalBtnProps) => {\n const [ mapIsOpened, , openMap, closeMap ] = useToggle();\n const [ dropdownIsOpened, toggleDropdown, openDropdown ] = useToggle();\n const [ locationsToShow, setLocationsToShow ] = useState<CityStats[]>([]);\n const buttonRef = useRef<HTMLElement>();\n\n const filterLocations = (cities: CityStats[]) => cities.filter(({ cityName }) => activeCities.includes(cityName));\n const onClick = () => {\n if (!activeCities) {\n setLocationsToShow(locations);\n openMap();\n\n return;\n }\n\n openDropdown();\n };\n const openMapWithLocations = (filtered: boolean) => () => {\n setLocationsToShow(filtered ? filterLocations(locations) : locations);\n openMap();\n };\n\n return (\n <>\n <button className=\"btn btn-link open-map-modal-btn__btn\" ref={buttonRef as any} onClick={onClick}>\n <FontAwesomeIcon icon={mapIcon} />\n </button>\n <UncontrolledTooltip placement=\"left\" target={(() => buttonRef.current) as any}>Show in map</UncontrolledTooltip>\n <Dropdown isOpen={dropdownIsOpened} toggle={toggleDropdown} inNavbar>\n <DropdownMenu right>\n <DropdownItem onClick={openMapWithLocations(false)}>Show all locations</DropdownItem>\n <DropdownItem onClick={openMapWithLocations(true)}>Show locations in current page</DropdownItem>\n </DropdownMenu>\n </Dropdown>\n <MapModal toggle={closeMap} isOpen={mapIsOpened} title={modalTitle} locations={locationsToShow} />\n </>\n );\n};\n\nexport default OpenMapModalBtn;\n","import { countBy, groupBy, pipe, prop } from 'ramda';\nimport { formatIsoDate } from '../../utils/helpers/date';\nimport { ShlinkVisitsParams } from '../../api/types';\nimport { CreateVisit, NormalizedOrphanVisit, NormalizedVisit, OrphanVisit, Stats, Visit, VisitsParams } from './index';\n\nexport const isOrphanVisit = (visit: Visit): visit is OrphanVisit => visit.hasOwnProperty('visitedUrl');\n\nexport const isNormalizedOrphanVisit = (visit: NormalizedVisit): visit is NormalizedOrphanVisit =>\n visit.hasOwnProperty('visitedUrl');\n\nexport interface GroupedNewVisits {\n orphanVisits: CreateVisit[];\n regularVisits: CreateVisit[];\n}\n\nexport const groupNewVisitsByType = pipe(\n groupBy((newVisit: CreateVisit) => isOrphanVisit(newVisit.visit) ? 'orphanVisits' : 'regularVisits'),\n // @ts-expect-error Type declaration on groupBy is not correct. It can return undefined props\n (result): GroupedNewVisits => ({ orphanVisits: [], regularVisits: [], ...result }),\n);\n\nexport type HighlightableProps<T extends NormalizedVisit> = T extends NormalizedOrphanVisit\n ? ('referer' | 'country' | 'city' | 'visitedUrl')\n : ('referer' | 'country' | 'city');\n\nexport const highlightedVisitsToStats = <T extends NormalizedVisit>(\n highlightedVisits: T[],\n property: HighlightableProps<T>,\n): Stats => countBy(prop(property) as any, highlightedVisits);\n\nexport const toApiParams = ({ page, itemsPerPage, filter, dateRange }: VisitsParams): ShlinkVisitsParams => {\n const startDate = (dateRange?.startDate && formatIsoDate(dateRange?.startDate)) ?? undefined;\n const endDate = (dateRange?.endDate && formatIsoDate(dateRange?.endDate)) ?? undefined;\n const excludeBots = filter?.excludeBots || undefined; // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing\n\n return { page, itemsPerPage, startDate, endDate, excludeBots };\n};\n","import { isNil, map } from 'ramda';\nimport { extractDomain, parseUserAgent } from '../../utils/helpers/visits';\nimport { hasValue } from '../../utils/utils';\nimport { CityStats, NormalizedVisit, Stats, Visit, VisitsStats } from '../types';\nimport { isNormalizedOrphanVisit, isOrphanVisit } from '../types/helpers';\n\nconst visitHasProperty = (visit: NormalizedVisit, propertyName: keyof NormalizedVisit) =>\n !isNil(visit) && hasValue(visit[propertyName]);\n\nconst optionalNumericToNumber = (numeric: string | number | null | undefined): number => {\n if (typeof numeric === 'number') {\n return numeric;\n }\n\n return numeric ? parseFloat(numeric) : 0;\n};\n\nconst updateOsStatsForVisit = (osStats: Stats, { os }: NormalizedVisit) => {\n osStats[os] = (osStats[os] || 0) + 1;\n};\n\nconst updateBrowsersStatsForVisit = (browsersStats: Stats, { browser }: NormalizedVisit) => {\n browsersStats[browser] = (browsersStats[browser] || 0) + 1;\n};\n\nconst updateReferrersStatsForVisit = (referrersStats: Stats, { referer: domain }: NormalizedVisit) => {\n referrersStats[domain] = (referrersStats[domain] || 0) + 1;\n};\n\nconst updateLocationsStatsForVisit = (propertyName: 'country' | 'city') => (stats: Stats, visit: NormalizedVisit) => {\n const hasLocationProperty = visitHasProperty(visit, propertyName);\n const value = hasLocationProperty ? visit[propertyName] : 'Unknown';\n\n stats[value] = (stats[value] || 0) + 1;\n};\n\nconst updateCountriesStatsForVisit = updateLocationsStatsForVisit('country');\nconst updateCitiesStatsForVisit = updateLocationsStatsForVisit('city');\n\nconst updateCitiesForMapForVisit = (citiesForMapStats: Record<string, CityStats>, visit: NormalizedVisit) => {\n if (!visitHasProperty(visit, 'city') || visit.city === 'Unknown') {\n return;\n }\n\n const { city, latitude, longitude } = visit;\n const currentCity = citiesForMapStats[city] || {\n cityName: city,\n count: 0,\n latLong: [ optionalNumericToNumber(latitude), optionalNumericToNumber(longitude) ],\n };\n\n currentCity.count++;\n\n citiesForMapStats[city] = currentCity;\n};\n\nconst updateVisitedUrlsForVisit = (visitedUrlsStats: Stats, visit: NormalizedVisit) => {\n if (!isNormalizedOrphanVisit(visit)) {\n return;\n }\n\n const { visitedUrl } = visit;\n\n visitedUrlsStats[visitedUrl] = (visitedUrlsStats[visitedUrl] || 0) + 1;\n};\n\nexport const processStatsFromVisits = (visits: NormalizedVisit[]) => visits.reduce(\n (stats: VisitsStats, visit: NormalizedVisit) => {\n // We mutate the original object because it has a big performance impact when large data sets are processed\n updateOsStatsForVisit(stats.os, visit);\n updateBrowsersStatsForVisit(stats.browsers, visit);\n updateReferrersStatsForVisit(stats.referrers, visit);\n updateCountriesStatsForVisit(stats.countries, visit);\n updateCitiesStatsForVisit(stats.cities, visit);\n updateCitiesForMapForVisit(stats.citiesForMap, visit);\n updateVisitedUrlsForVisit(stats.visitedUrls, visit);\n\n return stats;\n },\n { os: {}, browsers: {}, referrers: {}, countries: {}, cities: {}, citiesForMap: {}, visitedUrls: {} },\n);\n\nexport const normalizeVisits = map((visit: Visit): NormalizedVisit => {\n const { userAgent, date, referer, visitLocation, potentialBot = false } = visit;\n const common = {\n date,\n potentialBot,\n ...parseUserAgent(userAgent),\n referer: extractDomain(referer),\n country: visitLocation?.countryName || 'Unknown', // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing\n city: visitLocation?.cityName || 'Unknown', // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing\n latitude: visitLocation?.latitude,\n longitude: visitLocation?.longitude,\n };\n\n if (!isOrphanVisit(visit)) {\n return common;\n }\n\n return { ...common, type: visit.type, visitedUrl: visit.visitedUrl };\n});\n\nexport interface VisitsParser {\n processStatsFromVisits: (normalizedVisits: NormalizedVisit[]) => VisitsStats;\n normalizeVisits: (visits: Visit[]) => NormalizedVisit[];\n}\n","import { DropdownItem, DropdownItemProps } from 'reactstrap'; // eslint-disable-line import/named\nimport { OrphanVisitType, VisitsFilter } from '../types';\nimport { DropdownBtn } from '../../utils/DropdownBtn';\nimport { hasValue } from '../../utils/utils';\n\ninterface VisitsFilterDropdownProps {\n onChange: (filters: VisitsFilter) => void;\n selected?: VisitsFilter;\n className?: string;\n isOrphanVisits: boolean;\n botsSupported: boolean;\n}\n\nexport const VisitsFilterDropdown = (\n { onChange, selected = {}, className, isOrphanVisits, botsSupported }: VisitsFilterDropdownProps,\n) => {\n if (!botsSupported && !isOrphanVisits) {\n return null;\n }\n\n const { orphanVisitsType, excludeBots = false } = selected;\n const propsForOrphanVisitsTypeItem = (type: OrphanVisitType): DropdownItemProps => ({\n active: orphanVisitsType === type,\n onClick: () => onChange({ ...selected, orphanVisitsType: type === selected?.orphanVisitsType ? undefined : type }),\n });\n const onBotsClick = () => onChange({ ...selected, excludeBots: !selected?.excludeBots });\n\n return (\n <DropdownBtn text=\"Filters\" dropdownClassName={className} className=\"mr-3\" right minWidth={250}>\n {botsSupported && (\n <>\n <DropdownItem header>Bots:</DropdownItem>\n <DropdownItem active={excludeBots} onClick={onBotsClick}>Exclude potential bots</DropdownItem>\n </>\n )}\n\n {botsSupported && isOrphanVisits && <DropdownItem divider />}\n\n {isOrphanVisits && (\n <>\n <DropdownItem header>Orphan visits type:</DropdownItem>\n <DropdownItem {...propsForOrphanVisitsTypeItem('base_url')}>Base URL</DropdownItem>\n <DropdownItem {...propsForOrphanVisitsTypeItem('invalid_short_url')}>Invalid short URL</DropdownItem>\n <DropdownItem {...propsForOrphanVisitsTypeItem('regular_404')}>Regular 404</DropdownItem>\n </>\n )}\n\n <DropdownItem divider />\n <DropdownItem disabled={!hasValue(selected)} onClick={() => onChange({})}><i>Clear filters</i></DropdownItem>\n </DropdownBtn>\n );\n};\n","import { 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-right\">\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-right\">\n <PaginationDropdown\n toggleClassName=\"btn-sm p-0 mr-3\"\n ranges={[ 50, 100, 200, 500 ]}\n value={itemsPerPage}\n setValue={(itemsPerPage) => {\n setItemsPerPage(itemsPerPage);\n setCurrentPage(1);\n }}\n />\n </div>\n )}\n {extraHeaderContent && (\n <div className=\"float-right\">\n {extraHeaderContent(pagination ? activeCities : undefined)}\n </div>\n )}\n </>\n );\n\n return (\n <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 { RouteComponentProps } from 'react-router';\nimport { boundToMercureHub } from '../mercure/helpers/boundToMercureHub';\nimport { ShlinkVisitsParams } from '../api/types';\nimport { parseQuery } from '../utils/helpers/query';\nimport { Topics } from '../mercure/helpers/Topics';\nimport { ShortUrlDetail } from '../short-urls/reducers/shortUrlDetail';\nimport { ShortUrlVisits as ShortUrlVisitsState } from './reducers/shortUrlVisits';\nimport ShortUrlVisitsHeader from './ShortUrlVisitsHeader';\nimport VisitsStats from './VisitsStats';\nimport { VisitsExporter } from './services/VisitsExporter';\nimport { NormalizedVisit, VisitsParams } from './types';\nimport { CommonVisitsProps } from './types/CommonVisitsProps';\nimport { toApiParams } from './types/helpers';\n\nexport interface ShortUrlVisitsProps extends CommonVisitsProps, RouteComponentProps<{ shortCode: string }> {\n getShortUrlVisits: (shortCode: string, query?: ShlinkVisitsParams, doIntervalFallback?: boolean) => void;\n shortUrlVisits: ShortUrlVisitsState;\n getShortUrlDetail: Function;\n shortUrlDetail: ShortUrlDetail;\n cancelGetShortUrlVisits: () => void;\n}\n\nconst ShortUrlVisits = ({ exportVisits }: VisitsExporter) => boundToMercureHub(({\n history: { goBack },\n match: { params, url },\n location: { search },\n shortUrlVisits,\n shortUrlDetail,\n getShortUrlVisits,\n getShortUrlDetail,\n cancelGetShortUrlVisits,\n settings,\n selectedServer,\n}: ShortUrlVisitsProps) => {\n const { shortCode } = params;\n const { domain } = parseQuery<{ domain?: string }>(search);\n const loadVisits = (params: VisitsParams, 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 baseUrl={url}\n domain={domain}\n settings={settings}\n exportCsv={exportCsv}\n selectedServer={selectedServer}\n >\n <ShortUrlVisitsHeader shortUrlDetail={shortUrlDetail} shortUrlVisits={shortUrlVisits} goBack={goBack} />\n </VisitsStats>\n );\n}, ({ match }) => [ Topics.shortUrlVisits(match.params.shortCode) ]);\n\nexport default ShortUrlVisits;\n","import { flatten, prop, range, splitEvery } from 'ramda';\nimport { Action, Dispatch } from 'redux';\nimport { ShlinkPaginator, ShlinkVisits, 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 Tag from '../tags/helpers/Tag';\nimport ColorGenerator from '../utils/services/ColorGenerator';\nimport VisitsHeader from './VisitsHeader';\nimport { TagVisits } from './reducers/tagVisits';\nimport './ShortUrlVisitsHeader.scss';\n\ninterface TagVisitsHeaderProps {\n tagVisits: TagVisits;\n goBack: () => void;\n colorGenerator: ColorGenerator;\n}\n\nconst TagVisitsHeader = ({ tagVisits, goBack, colorGenerator }: TagVisitsHeaderProps) => {\n const { visits, tag } = tagVisits;\n\n const visitsStatsTitle = (\n <span className=\"d-flex align-items-center justify-content-center\">\n <span className=\"mr-2\">Visits for</span>\n <Tag text={tag} colorGenerator={colorGenerator} />\n </span>\n );\n\n return <VisitsHeader title={visitsStatsTitle} goBack={goBack} visits={visits} />;\n};\n\nexport default TagVisitsHeader;\n","import { RouteComponentProps } from 'react-router';\nimport { boundToMercureHub } from '../mercure/helpers/boundToMercureHub';\nimport ColorGenerator from '../utils/services/ColorGenerator';\nimport { ShlinkVisitsParams } from '../api/types';\nimport { Topics } from '../mercure/helpers/Topics';\nimport { TagVisits as TagVisitsState } from './reducers/tagVisits';\nimport TagVisitsHeader from './TagVisitsHeader';\nimport VisitsStats from './VisitsStats';\nimport { VisitsExporter } from './services/VisitsExporter';\nimport { NormalizedVisit } from './types';\nimport { CommonVisitsProps } from './types/CommonVisitsProps';\nimport { toApiParams } from './types/helpers';\n\nexport interface TagVisitsProps extends CommonVisitsProps, RouteComponentProps<{ tag: string }> {\n getTagVisits: (tag: string, query?: ShlinkVisitsParams, doIntervalFallback?: boolean) => void;\n tagVisits: TagVisitsState;\n cancelGetTagVisits: () => void;\n}\n\nconst TagVisits = (colorGenerator: ColorGenerator, { exportVisits }: VisitsExporter) => boundToMercureHub(({\n history: { goBack },\n match: { params, url },\n getTagVisits,\n tagVisits,\n cancelGetTagVisits,\n settings,\n selectedServer,\n}: TagVisitsProps) => {\n const { tag } = params;\n const loadVisits = (params: ShlinkVisitsParams, 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 baseUrl={url}\n settings={settings}\n exportCsv={exportCsv}\n selectedServer={selectedServer}\n >\n <TagVisitsHeader tagVisits={tagVisits} goBack={goBack} colorGenerator={colorGenerator} />\n </VisitsStats>\n );\n}, () => [ Topics.visits ]);\n\nexport default TagVisits;\n","import { Action, Dispatch } from 'redux';\nimport { Visit, 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 VisitsHeader from './VisitsHeader';\nimport { VisitsInfo } from './types';\nimport './ShortUrlVisitsHeader.scss';\n\ninterface OrphanVisitsHeaderProps {\n orphanVisits: VisitsInfo;\n goBack: () => void;\n}\n\nexport const OrphanVisitsHeader = ({ orphanVisits, goBack }: OrphanVisitsHeaderProps) => {\n const { visits } = orphanVisits;\n\n return <VisitsHeader title=\"Orphan visits\" goBack={goBack} visits={visits} />;\n};\n","import { RouteComponentProps } from 'react-router';\nimport { boundToMercureHub } from '../mercure/helpers/boundToMercureHub';\nimport { ShlinkVisitsParams } from '../api/types';\nimport { Topics } from '../mercure/helpers/Topics';\nimport VisitsStats from './VisitsStats';\nimport { OrphanVisitsHeader } from './OrphanVisitsHeader';\nimport { NormalizedVisit, OrphanVisitType, VisitsInfo, VisitsParams } from './types';\nimport { VisitsExporter } from './services/VisitsExporter';\nimport { CommonVisitsProps } from './types/CommonVisitsProps';\nimport { toApiParams } from './types/helpers';\n\nexport interface OrphanVisitsProps extends CommonVisitsProps, RouteComponentProps {\n getOrphanVisits: (\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 history: { goBack },\n match: { url },\n getOrphanVisits,\n orphanVisits,\n cancelGetOrphanVisits,\n settings,\n selectedServer,\n}: OrphanVisitsProps) => {\n const exportCsv = (visits: NormalizedVisit[]) => exportVisits('orphan_visits.csv', visits);\n const loadVisits = (params: VisitsParams, 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 baseUrl={url}\n settings={settings}\n exportCsv={exportCsv}\n selectedServer={selectedServer}\n isOrphanVisits\n >\n <OrphanVisitsHeader orphanVisits={orphanVisits} goBack={goBack} />\n </VisitsStats>\n );\n}, () => [ Topics.orphanVisits ]);\n","import { Action, Dispatch } from 'redux';\nimport {\n OrphanVisit,\n OrphanVisitType,\n Visit,\n 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 }) => 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 { 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 ShortUrlVisits from '../ShortUrlVisits';\nimport { cancelGetShortUrlVisits, getShortUrlVisits } from '../reducers/shortUrlVisits';\nimport MapModal from '../helpers/MapModal';\nimport { createNewVisits } from '../reducers/visitCreation';\nimport TagVisits from '../TagVisits';\nimport { cancelGetTagVisits, getTagVisits } from '../reducers/tagVisits';\nimport { OrphanVisits } from '../OrphanVisits';\nimport { cancelGetOrphanVisits, getOrphanVisits } from '../reducers/orphanVisits';\nimport { ConnectDecorator } from '../../container/types';\nimport { loadVisitsOverview } from '../reducers/visitsOverview';\nimport * as visitsParser from './VisitsParser';\nimport { VisitsExporter } from './VisitsExporter';\n\nconst provideServices = (bottle: Bottle, connect: ConnectDecorator) => {\n // Components\n bottle.serviceFactory('MapModal', () => MapModal);\n\n bottle.serviceFactory('ShortUrlVisits', ShortUrlVisits, 'VisitsExporter');\n bottle.decorator('ShortUrlVisits', connect(\n [ 'shortUrlVisits', 'shortUrlDetail', 'mercureInfo', 'settings', 'selectedServer' ],\n [ 'getShortUrlVisits', 'getShortUrlDetail', 'cancelGetShortUrlVisits', 'createNewVisits', 'loadMercureInfo' ],\n ));\n\n bottle.serviceFactory('TagVisits', TagVisits, 'ColorGenerator', 'VisitsExporter');\n bottle.decorator('TagVisits', connect(\n [ 'tagVisits', 'mercureInfo', 'settings', 'selectedServer' ],\n [ 'getTagVisits', 'cancelGetTagVisits', 'createNewVisits', 'loadMercureInfo' ],\n ));\n\n bottle.serviceFactory('OrphanVisits', OrphanVisits, 'VisitsExporter');\n bottle.decorator('OrphanVisits', connect(\n [ 'orphanVisits', 'mercureInfo', 'settings', 'selectedServer' ],\n [ 'getOrphanVisits', 'cancelGetOrphanVisits', 'createNewVisits', 'loadMercureInfo' ],\n ));\n\n // Services\n bottle.serviceFactory('VisitsParser', () => visitsParser);\n bottle.service('VisitsExporter', VisitsExporter, 'window', 'csvjson');\n\n // Actions\n bottle.serviceFactory('getShortUrlVisits', getShortUrlVisits, 'buildShlinkApiClient');\n bottle.serviceFactory('cancelGetShortUrlVisits', () => cancelGetShortUrlVisits);\n\n bottle.serviceFactory('getTagVisits', getTagVisits, 'buildShlinkApiClient');\n bottle.serviceFactory('cancelGetTagVisits', () => cancelGetTagVisits);\n\n bottle.serviceFactory('getOrphanVisits', getOrphanVisits, 'buildShlinkApiClient');\n bottle.serviceFactory('cancelGetOrphanVisits', () => cancelGetOrphanVisits);\n\n bottle.serviceFactory('createNewVisits', () => createNewVisits);\n bottle.serviceFactory('loadVisitsOverview', loadVisitsOverview, 'buildShlinkApiClient');\n};\n\nexport default provideServices;\n","import ColorGenerator from '../../utils/services/ColorGenerator';\nimport './TagBullet.scss';\n\ninterface TagBulletProps {\n tag: string;\n colorGenerator: ColorGenerator;\n}\n\nconst TagBullet = ({ tag, colorGenerator }: TagBulletProps) => (\n <div\n style={{ backgroundColor: colorGenerator.getColorForKey(tag) }}\n className=\"tag-bullet\"\n />\n);\n\nexport default TagBullet;\n","import { useEffect } from 'react';\nimport ReactTags, { SuggestionComponentProps, TagComponentProps } from 'react-tag-autocomplete';\nimport ColorGenerator from '../../utils/services/ColorGenerator';\nimport { 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=\"mr-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=\"mr-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 } from 'reactstrap';\nimport { ChromePicker } from 'react-color';\nimport { faPalette as colorIcon } from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { useToggle } from '../../utils/helpers/hooks';\nimport { handleEventPreventingDefault } from '../../utils/utils';\nimport ColorGenerator from '../../utils/services/ColorGenerator';\nimport { TagModalProps } from '../data';\nimport { TagEdition } from '../reducers/tagEdit';\nimport { Result } from '../../utils/Result';\nimport { ShlinkApiError } from '../../api/ShlinkApiError';\nimport './EditTagModal.scss';\n\ninterface EditTagModalProps extends TagModalProps {\n tagEdit: TagEdition;\n editTag: (oldName: string, newName: string, color: string) => Promise<void>;\n tagEdited: (oldName: string, newName: string, color: string) => void;\n}\n\nconst EditTagModal = ({ getColorForKey }: ColorGenerator) => (\n { tag, editTag, toggle, tagEdited, isOpen, tagEdit }: EditTagModalProps,\n) => {\n const [ newTagName, setNewTagName ] = useState(tag);\n const [ color, setColor ] = useState(getColorForKey(tag));\n const [ showColorPicker, toggleColorPicker, , hideColorPicker ] = useToggle();\n const { editing, error, errorData } = tagEdit;\n const saveTag = handleEventPreventingDefault(\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 <div className=\"input-group\">\n <div className=\"input-group-prepend\" id=\"colorPickerBtn\" onClick={toggleColorPicker}>\n <div\n className=\"input-group-text edit-tag-modal__color-picker-toggle\"\n style={{ backgroundColor: color, borderColor: color }}\n >\n <FontAwesomeIcon icon={colorIcon} className=\"edit-tag-modal__color-icon\" />\n </div>\n </div>\n <Popover isOpen={showColorPicker} toggle={toggleColorPicker} target=\"colorPickerBtn\" placement=\"right\">\n <ChromePicker color={color} disableAlpha onChange={({ hex }) => setColor(hex)} />\n </Popover>\n <Input\n value={newTagName}\n placeholder=\"Tag\"\n required\n onChange={({ target }) => setNewTagName(target.value)}\n />\n </div>\n\n {error && (\n <Result type=\"error\" small className=\"mt-2\">\n <ShlinkApiError errorData={errorData} fallbackMessage=\"Something went wrong while editing the tag :(\" />\n </Result>\n )}\n </ModalBody>\n <ModalFooter>\n <Button type=\"button\" 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=\"mr-1\" /> Cards\n </DropdownItem>\n <DropdownItem active={mode === 'list'} onClick={() => onChange('list')}>\n <FontAwesomeIcon icon={listIcon} fixedWidth className=\"mr-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 { 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& 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}, 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 { RouteChildrenProps } from 'react-router';\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, location, orderByColumn, currentOrder }: TagsTableProps & RouteChildrenProps,\n) => {\n const isFirstLoad = useRef(true);\n const { page: pageFromQuery = 1 } = parseQuery<{ page?: number | string }>(location.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 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-right\" onClick={orderByColumn('shortUrls')}>\n Short URLs <TableOrderIcon currentOrder={currentOrder} field=\"shortUrls\" />\n </th>\n <th className=\"tags-table__header-cell text-lg-right\" 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-right\" 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-right\" 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-right\">\n <DropdownBtnMenu toggle={toggleDropdown} isOpen={isDropdownOpen}>\n <DropdownItem onClick={toggleEdit}>\n <FontAwesomeIcon icon={editIcon} fixedWidth className=\"mr-1\" /> Edit\n </DropdownItem>\n <DropdownItem onClick={toggleDelete}>\n <FontAwesomeIcon icon={deleteIcon} fixedWidth className=\"mr-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 { withRouter } from 'react-router-dom';\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 bottle.decorator('TagsTable', withRouter);\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 { FormGroup, Input } from 'reactstrap';\nimport classNames from 'classnames';\nimport ToggleSwitch from '../utils/ToggleSwitch';\nimport { SimpleCard } from '../utils/SimpleCard';\nimport { Settings } from './reducers/settings';\n\ninterface RealTimeUpdatesProps {\n settings: Settings;\n toggleRealTimeUpdates: (enabled: boolean) => void;\n setRealTimeUpdatesInterval: (interval: number) => void;\n}\n\nconst intervalValue = (interval?: number) => !interval ? '' : `${interval}`;\n\nconst 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 <small className=\"form-text text-muted\">\n Real-time updates are currently being <b>{realTimeUpdates.enabled ? 'processed' : 'ignored'}</b>.\n </small>\n </ToggleSwitch>\n </FormGroup>\n <FormGroup className=\"mb-0\">\n <label className={classNames({ 'text-muted': !realTimeUpdates.enabled })}>\n Real-time updates frequency (in minutes):\n </label>\n <Input\n type=\"number\"\n min={0}\n placeholder=\"Immediate\"\n disabled={!realTimeUpdates.enabled}\n value={intervalValue(realTimeUpdates.interval)}\n onChange={({ target }) => setRealTimeUpdatesInterval(Number(target.value))}\n />\n {realTimeUpdates.enabled && (\n <small className=\"form-text text-muted\">\n {realTimeUpdates.interval !== undefined && realTimeUpdates.interval > 0 && (\n <span>\n Updates will be reflected in the UI every <b>{realTimeUpdates.interval}</b> minute{realTimeUpdates.interval > 1 && 's'}.\n </span>\n )}\n {!realTimeUpdates.interval && 'Updates will be reflected in the UI as soon as they happen.'}\n </small>\n )}\n </FormGroup>\n </SimpleCard>\n);\n\nexport default RealTimeUpdatesSettings;\n","import { FC, ReactNode } from 'react';\nimport { Row } from 'reactstrap';\nimport NoMenuLayout from '../common/NoMenuLayout';\n\nconst SettingsSections: FC<{ items: ReactNode[][] }> = ({ items }) => (\n <>\n {items.map((child, index) => (\n <Row key={index}>\n {child.map((subChild, subIndex) => (\n <div key={subIndex} className={`col-lg-${12 / child.length} mb-3`}>\n {subChild}\n </div>\n ))}\n </Row>\n ))}\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 <SettingsSections\n items={[\n [ <UserInterface />, <Visits /> ], // eslint-disable-line react/jsx-key\n [ <ShortUrlCreation />, <ShortUrlsList /> ], // eslint-disable-line react/jsx-key\n [ <Tags />, <RealTimeUpdates /> ], // eslint-disable-line react/jsx-key\n ]}\n />\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 { 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 <small className=\"form-text text-muted\">\n The initial state of the <b>Validate URL</b> checkbox will\n be <b>{shortUrlCreation.validateUrls ? 'checked' : 'unchecked'}</b>.\n </small>\n </ToggleSwitch>\n </FormGroup>\n <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 <small className=\"form-text text-muted\">\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 </small>\n </ToggleSwitch>\n </FormGroup>\n <FormGroup className=\"mb-0\">\n <label>Tag suggestions search mode:</label>\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 <small className=\"form-text text-muted\">\n {tagFilteringModeHint(shortUrlCreation.tagFilteringMode)}\n </small>\n </FormGroup>\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 { FormGroup } from 'reactstrap';\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 <FormGroup>\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 </FormGroup>\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 { FormGroup } from 'reactstrap';\nimport { FC } from 'react';\nimport { SimpleCard } from '../utils/SimpleCard';\nimport { DateIntervalSelector } from '../utils/dates/DateIntervalSelector';\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 <FormGroup className=\"mb-0\">\n <label>Default interval to load on visits sections:</label>\n <DateIntervalSelector\n allText=\"All visits\"\n active={settings.visits?.defaultInterval ?? 'last30Days'}\n onChange={(defaultInterval) => setVisitsSettings({ defaultInterval })}\n />\n </FormGroup>\n </SimpleCard>\n);\n","import { FC } from 'react';\nimport { FormGroup } from 'reactstrap';\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 { 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 <FormGroup>\n <label>Default display mode when managing tags:</label>\n <TagsModeDropdown\n mode={tags?.defaultMode ?? 'cards'}\n renderTitle={(tagsMode) => capitalize(tagsMode)}\n onChange={(defaultMode) => setTagsSettings({ ...tags, defaultMode })}\n />\n <small className=\"form-text text-muted\">Tags will be displayed as <b>{tags?.defaultMode ?? 'cards'}</b>.</small>\n </FormGroup>\n <FormGroup className=\"mb-0\">\n <label>Default ordering for tags list:</label>\n <OrderingDropdown\n items={TAGS_ORDERABLE_FIELDS}\n order={tags?.defaultOrdering ?? {}}\n onChange={(field, dir) => setTagsSettings({ ...tags, defaultOrdering: { field, dir } })}\n />\n </FormGroup>\n </SimpleCard>\n);\n","import { FC } from 'react';\nimport { FormGroup } from 'reactstrap';\nimport { OrderingDropdown } from '../utils/OrderingDropdown';\nimport { SHORT_URLS_ORDERABLE_FIELDS } from '../short-urls/data';\nimport { SimpleCard } from '../utils/SimpleCard';\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 <FormGroup className=\"mb-0\">\n <label>Default ordering for short URLs list:</label>\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 </FormGroup>\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","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, ShlinkDomain, 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 { 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';\n/* eslint-enable padding-line-between-statements */\n\nexport interface DomainsList {\n domains: ShlinkDomain[];\n filteredDomains: ShlinkDomain[];\n defaultRedirects?: ShlinkDomainRedirects;\n loading: boolean;\n error: boolean;\n errorData?: ProblemDetailsError;\n}\n\nexport interface ListDomainsAction extends Action<string> {\n domains: ShlinkDomain[];\n defaultRedirects?: ShlinkDomainRedirects;\n}\n\ninterface FilterDomainsAction extends Action<string> {\n searchTerm: string;\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\nexport const replaceRedirectsOnDomain = (domain: string, redirects: ShlinkDomainRedirects) =>\n (d: ShlinkDomain): ShlinkDomain => d.domain !== domain ? d : { ...d, redirects };\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}, 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 { data: domains, defaultRedirects } = await listDomains();\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","import { useEffect } from 'react';\nimport { Button, DropdownItem, Input, InputGroup, InputGroupAddon, UncontrolledTooltip } from 'reactstrap';\nimport { InputProps } from 'reactstrap/lib/Input';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faUndo } from '@fortawesome/free-solid-svg-icons';\nimport { isEmpty, pipe } from 'ramda';\nimport { DropdownBtn } from '../utils/DropdownBtn';\nimport { useToggle } from '../utils/helpers/hooks';\nimport { DomainsList } from './reducers/domainsList';\nimport './DomainSelector.scss';\n\nexport interface DomainSelectorProps extends Omit<InputProps, 'onChange'> {\n value?: string;\n onChange: (domain: string) => void;\n}\n\ninterface DomainSelectorConnectProps extends DomainSelectorProps {\n listDomains: Function;\n domainsList: DomainsList;\n}\n\nexport const DomainSelector = ({ listDomains, value, domainsList, onChange }: DomainSelectorConnectProps) => {\n const [ inputDisplayed,, showInput, hideInput ] = useToggle();\n const { domains } = domainsList;\n const valueIsEmpty = isEmpty(value);\n const unselectDomain = () => onChange('');\n\n useEffect(() => {\n listDomains();\n }, []);\n\n return inputDisplayed ? (\n <InputGroup>\n <Input\n value={value}\n placeholder=\"Domain\"\n onChange={(e) => onChange(e.target.value)}\n />\n <InputGroupAddon addonType=\"append\">\n <Button\n id=\"backToDropdown\"\n outline\n type=\"button\"\n className=\"domains-dropdown__back-btn\"\n onClick={pipe(unselectDomain, hideInput)}\n >\n <FontAwesomeIcon icon={faUndo} />\n </Button>\n <UncontrolledTooltip target=\"backToDropdown\" placement=\"left\" trigger=\"hover\">\n Existing domains\n </UncontrolledTooltip>\n </InputGroupAddon>\n </InputGroup>\n ) : (\n <DropdownBtn\n text={valueIsEmpty ? 'Domain' : `Domain: ${value}`}\n className={!valueIsEmpty ? 'domains-dropdown__toggle-btn--active' : 'domains-dropdown__toggle-btn'}\n >\n {domains.map(({ domain, isDefault }) => (\n <DropdownItem\n key={domain}\n active={value === domain || isDefault && valueIsEmpty}\n onClick={() => onChange(domain)}\n >\n {domain}\n {isDefault && <span className=\"float-right text-muted\">default</span>}\n </DropdownItem>\n ))}\n <DropdownItem divider />\n <DropdownItem onClick={pipe(unselectDomain, showInput)}>\n <i>New domain</i>\n </DropdownItem>\n </DropdownBtn>\n );\n};\n","import { FC, useState } from 'react';\nimport { Button, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap';\nimport { ShlinkDomain, ShlinkDomainRedirects } from '../../api/types';\nimport { FormGroupContainer, FormGroupContainerProps } from '../../utils/FormGroupContainer';\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<FormGroupContainerProps & { isLast?: boolean }> = ({ isLast, ...rest }) => (\n <FormGroupContainer\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=\"mr-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=\"mr-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=\"mr-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 } from 'react';\nimport { Button, UncontrolledTooltip } from 'reactstrap';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport {\n faBan as forbiddenIcon,\n faCheck as defaultDomainIcon,\n faEdit as editIcon,\n} from '@fortawesome/free-solid-svg-icons';\nimport { ShlinkDomain, 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';\n\ninterface DomainRowProps {\n domain: ShlinkDomain;\n defaultRedirects?: ShlinkDomainRedirects;\n editDomainRedirects: (domain: string, redirects: Partial<ShlinkDomainRedirects>) => Promise<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> = ({ domain, editDomainRedirects, defaultRedirects, selectedServer }) => {\n const [ isOpen, toggle ] = useToggle();\n const { domain: authority, isDefault, redirects } = domain;\n const canEditDomain = !isDefault || supportsDefaultDomainRedirectsEdition(selectedServer);\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-right\">\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 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, 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 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 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 { 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' ],\n ));\n\n // Actions\n bottle.serviceFactory('listDomains', listDomains, 'buildShlinkApiClient');\n bottle.serviceFactory('filterDomains', () => filterDomains);\n bottle.serviceFactory('editDomainRedirects', editDomainRedirects, 'buildShlinkApiClient');\n};\n\nexport default provideServices;\n","import { Action } from 'redux';\nimport { buildActionCreator, buildReducer } from '../../utils/helpers/redux';\n\n/* eslint-disable padding-line-between-statements */\nexport const APP_UPDATE_AVAILABLE = 'shlink/appUpdates/APP_UPDATE_AVAILABLE';\nexport const RESET_APP_UPDATE = 'shlink/appUpdates/RESET_APP_UPDATE';\n/* eslint-enable padding-line-between-statements */\n\nconst initialState = false;\n\nexport default buildReducer<boolean, Action<string>>({\n [APP_UPDATE_AVAILABLE]: () => true,\n [RESET_APP_UPDATE]: () => false,\n}, initialState);\n\nexport const appUpdateAvailable = buildActionCreator(APP_UPDATE_AVAILABLE);\n\nexport const resetAppUpdate = buildActionCreator(RESET_APP_UPDATE);\n","import { FC, MouseEventHandler } from 'react';\nimport { Alert, Button } from 'reactstrap';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faSyncAlt as reloadIcon } from '@fortawesome/free-solid-svg-icons';\nimport { SimpleCard } from '../utils/SimpleCard';\nimport { useToggle } from '../utils/helpers/hooks';\nimport './AppUpdateBanner.scss';\n\ninterface AppUpdateBannerProps {\n isOpen: boolean;\n toggle: MouseEventHandler<any>;\n forceUpdate: Function;\n}\n\nexport const AppUpdateBanner: FC<AppUpdateBannerProps> = ({ isOpen, toggle, forceUpdate }) => {\n const [ isUpdating,, setUpdating ] = useToggle();\n const update = () => {\n setUpdating();\n forceUpdate();\n };\n\n return (\n <Alert className=\"app-update-banner\" isOpen={isOpen} toggle={toggle} tag={SimpleCard} color=\"secondary\">\n <h4 className=\"mb-4\">This app has just been updated!</h4>\n <p className=\"mb-0\">\n Restart it to enjoy the new features.\n <Button disabled={isUpdating} className=\"ml-2\" color=\"secondary\" size=\"sm\" onClick={update}>\n {!isUpdating && <>Restart now <FontAwesomeIcon icon={reloadIcon} className=\"ml-1\" /></>}\n {isUpdating && <>Restarting...</>}\n </Button>\n </p>\n </Alert>\n );\n};\n","export const forceUpdate = async () => {\n const registrations = await navigator.serviceWorker?.getRegistrations() ?? [];\n\n for (const registration of registrations) {\n const { waiting } = registration;\n\n waiting?.addEventListener('statechange', (event) => {\n if ((event.target as any)?.state === 'activated') {\n window.location.reload();\n }\n });\n\n // The logic that makes skipWaiting to be called when this message is posted is in service-worker.ts\n waiting?.postMessage({ type: 'SKIP_WAITING' });\n }\n};\n","import { useEffect, FC } from 'react';\nimport { Route, RouteChildrenProps, Switch } 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 extends RouteChildrenProps {\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, location }: AppProps) => {\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 <Switch>\n <Route exact path=\"/\" component={Home} />\n <Route exact path=\"/settings\" component={Settings} />\n <Route exact path=\"/manage-servers\" component={ManageServers} />\n <Route exact path=\"/server/create\" component={CreateServer} />\n <Route exact path=\"/server/:serverId/edit\" component={EditServer} />\n <Route path=\"/server/:serverId\" component={MenuLayout} />\n <Route component={NotFound} />\n </Switch>\n </div>\n\n <div className=\"shlink-footer\">\n <ShlinkVersionsContainer />\n </div>\n </div>\n\n <AppUpdateBanner isOpen={appUpdated} toggle={resetAppUpdate} forceUpdate={forceUpdate} />\n </div>\n );\n};\n\nexport default App;\n","import Bottle, { Decorator } from 'bottlejs';\nimport { appUpdateAvailable, resetAppUpdate } from '../reducers/appUpdates';\nimport App from '../App';\nimport { ConnectDecorator } from '../../container/types';\n\nconst provideServices = (bottle: Bottle, connect: ConnectDecorator, withRouter: Decorator) => {\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 bottle.decorator('App', withRouter);\n\n // Actions\n bottle.serviceFactory('appUpdateAvailable', () => appUpdateAvailable);\n bottle.serviceFactory('resetAppUpdate', () => resetAppUpdate);\n};\n\nexport default provideServices;\n","import Bottle, { IContainer } from 'bottlejs';\nimport { withRouter } from 'react-router-dom';\nimport { connect as reduxConnect } from 'react-redux';\nimport { pick } from 'ramda';\nimport provideApiServices from '../api/services/provideServices';\nimport provideCommonServices from '../common/services/provideServices';\nimport provideShortUrlsServices from '../short-urls/services/provideServices';\nimport provideServersServices from '../servers/services/provideServices';\nimport provideVisitsServices from '../visits/services/provideServices';\nimport provideTagsServices from '../tags/services/provideServices';\nimport provideUtilsServices from '../utils/services/provideServices';\nimport provideMercureServices from '../mercure/services/provideServices';\nimport provideSettingsServices from '../settings/services/provideServices';\nimport provideDomainsServices from '../domains/services/provideServices';\nimport provideAppServices from '../app/services/provideServices';\nimport { ConnectDecorator } from './types';\n\ntype LazyActionMap = Record<string, Function>;\n\nconst bottle = new Bottle();\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, withRouter);\nprovideCommonServices(bottle, connect, withRouter);\nprovideApiServices(bottle);\nprovideShortUrlsServices(bottle, connect, withRouter);\nprovideServersServices(bottle, connect, withRouter);\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 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 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: ShlinkState): ShlinkState => {\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 { Card, Row } from 'reactstrap';\nimport classNames from 'classnames';\nimport { faCircleNotch as preloader } from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\n\ntype MessageType = 'default' | 'error';\n\nconst getClassForType = (type: MessageType) => {\n const map: Record<MessageType, string> = {\n error: 'border-danger',\n default: '',\n };\n\n return map[type];\n};\nconst getTextClassForType = (type: MessageType) => {\n const map: Record<MessageType, string> = {\n error: 'text-danger',\n default: 'text-muted',\n };\n\n return map[type];\n};\n\nexport interface MessageProps {\n className?: string;\n loading?: boolean;\n fullWidth?: boolean;\n type?: MessageType;\n}\n\nconst Message: FC<MessageProps> = ({ className, children, loading = false, type = 'default', fullWidth = false }) => {\n const classes = classNames({\n 'col-md-12': fullWidth,\n 'col-md-10 offset-md-1': !fullWidth,\n });\n\n return (\n <Row noGutters className={className}>\n <div className={classes}>\n <Card className={getClassForType(type)} body>\n <h3 className={classNames('text-center mb-0', getTextClassForType(type))}>\n {loading && <FontAwesomeIcon icon={preloader} spin />}\n {loading && <span className=\"ml-2\">{children ?? 'Loading...'}</span>}\n {!loading && children}\n </h3>\n </Card>\n </div>\n </Row>\n );\n};\n\nexport default Message;\n","import { FC } from 'react';\nimport './NoMenuLayout.scss';\n\nconst NoMenuLayout: FC = ({ children }) => <div className=\"no-menu-wrapper container-xl\">{children}</div>;\n\nexport default NoMenuLayout;\n","import { compare } from 'compare-versions';\nimport { identity, memoizeWith } from 'ramda';\nimport { Empty, hasValue } from '../utils';\n\ntype SemVerPatternFragment = `${bigint | '*'}`;\n\nexport type SemVerPattern = SemVerPatternFragment\n| `${SemVerPatternFragment}.${SemVerPatternFragment}`\n| `${SemVerPatternFragment}.${SemVerPatternFragment}.${SemVerPatternFragment}`;\n\nexport interface Versions {\n maxVersion?: SemVerPattern;\n minVersion?: SemVerPattern;\n}\n\nexport type SemVer = `${bigint}.${bigint}.${bigint}` | 'latest';\n\nexport const versionMatch = (versionToMatch: SemVer | Empty, { maxVersion, minVersion }: Versions): boolean => {\n if (!hasValue(versionToMatch)) {\n return false;\n }\n\n const matchesMinVersion = !minVersion || compare(versionToMatch, minVersion, '>=');\n const matchesMaxVersion = !maxVersion || compare(versionToMatch, maxVersion, '<=');\n\n return matchesMaxVersion && matchesMinVersion;\n};\n\nconst versionIsValidSemVer = memoizeWith(identity, (version: string): version is SemVer => {\n try {\n return compare(version, version, '=');\n } catch (e) {\n return false;\n }\n});\n\nexport const versionToPrintable = (version: string) => !versionIsValidSemVer(version) ? version : `v${version}`;\n\nexport const versionToSemVer = (defaultValue: SemVer = 'latest') =>\n (version: string): SemVer => versionIsValidSemVer(version) ? version : defaultValue;\n"],"sourceRoot":""} |