📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
Clean-up
Blue Mouse7ec99177ab14
diff --git a/web/app/pages/UserSettings/UserSettings.tsx b/web/app/pages/UserSettings/UserSettings.tsxindex 4f737f1d0..04b250b63 100644--- a/web/app/pages/UserSettings/UserSettings.tsx+++ b/web/app/pages/UserSettings/UserSettings.tsx@@ -199,11 +199,6 @@ const DEFAULT_USAGE_INFO: UsageInfo = {captchaPerc: 0,}-const WEBSITE_ADDON_QUANTITY_OPTIONS = Array.from(- { length: 21 },- (_, index) => index * 50,-)-const formatBillingPrice = (amount: number) =>Number.isInteger(amount) ? amount.toFixed(0) : amount.toFixed(2)@@ -318,10 +313,6 @@ const UserSettings = () => {return Math.min(100, Math.max(0, raw))})()const remainingUsage = _round(Math.max(0, 100 - totalUsage), 2)- const projectsUsage =- maxProjects > 0- ? Math.min(100, _round((usageInfo.projects / maxProjects) * 100, 2))- : 0const replayLimitLabel =typeof sessionReplaysIncluded === 'number'? sessionReplaysIncluded.toLocaleString()@@ -535,7 +526,8 @@ const UserSettings = () => {const currentWebsiteAddonPreview = useMemo(() => {if (websiteAddonPreview?.quantity === selectedWebsiteAddonQuantity &&- websiteAddonPreview.billingInterval === selectedWebsiteAddonBillingInterval+ websiteAddonPreview.billingInterval ===+ selectedWebsiteAddonBillingInterval) {return websiteAddonPreview}@@ -582,7 +574,8 @@ const UserSettings = () => {const isWebsiteAddonDisabled = !!websiteAddonDisabledReasonconst hasWebsiteAddonChanges =selectedWebsiteAddonQuantity !== activeWebsiteAddonQuantity ||- selectedWebsiteAddonBillingInterval !== currentWebsiteAddonBillingInterval ||+ selectedWebsiteAddonBillingInterval !==+ currentWebsiteAddonBillingInterval ||hasPendingWebsiteAddonChangeconst websiteAddonPreviewError =websiteAddonPreviewFetcher.data?.intent === 'preview-website-addon' &&@@ -674,11 +667,7 @@ const UserSettings = () => {useEffect(() => {setSelectedWebsiteAddonQuantity(activeWebsiteAddonQuantity)setSelectedWebsiteAddonBillingInterval(currentWebsiteAddonBillingInterval)- }, [- activeWebsiteAddonQuantity,- currentWebsiteAddonBillingInterval,- user?.id,- ])+ }, [activeWebsiteAddonQuantity, currentWebsiteAddonBillingInterval, user?.id])useEffect(() => {if (@@ -1794,19 +1783,6 @@ const UserSettings = () => {</Alert>) : null}- <Text- as='p'- size='sm'- colour='secondary'- className='mb-4'- >- {t('billing.usageOverview', {- tracked: (usageInfo.total || 0).toLocaleString(),- trackedPerc: totalUsage || 0,- maxEvents: (maxEventsCount || 0).toLocaleString(),- })}- </Text>-<div className='grid grid-cols-2 gap-x-6 gap-y-3'><div className='flex items-center'><div className='size-2 rounded-full bg-blue-600 dark:bg-blue-500' />@@ -1978,24 +1954,19 @@ const UserSettings = () => {{(usageInfo.projects || 0).toLocaleString()} /{' '}{(maxProjects || 0).toLocaleString()}</Text>- {purchasedWebsiteAddons ? (- <Text- as='p'- size='xs'- colour='muted'- className='mt-1'- >- {t('billing.addedWebsites', {- amount: purchasedWebsiteAddons.toLocaleString(),- })}- </Text>- ) : null}- <div className='mt-2 h-1.5 overflow-hidden rounded-full bg-gray-200 dark:bg-slate-800'>- <div- className='h-full rounded-full bg-slate-900 dark:bg-slate-100'- style={{ width: `${projectsUsage}%` }}- />- </div>+ <Text+ as='p'+ size='xs'+ colour='muted'+ className='mt-1'+ >+ {purchasedWebsiteAddons+ ? t('billing.addedWebsites', {+ amount:+ purchasedWebsiteAddons.toLocaleString(),+ })+ : t('billing.websitesIncludedCaption')}+ </Text></div><div>@@ -2157,8 +2128,8 @@ const UserSettings = () => {title={t('billing.addonsTitle')}description={t('billing.addonsDesc')}>- <div className='grid gap-4 border-t border-gray-200 pt-4 xl:grid-cols-[minmax(0,1.55fr)_minmax(300px,0.85fr)] dark:border-slate-800'>- <div className='rounded-lg border border-gray-200 p-4 dark:border-slate-800'>+ <div className='grid gap-x-8 gap-y-6 border-t border-gray-200 pt-4 xl:grid-cols-[minmax(0,1.55fr)_minmax(280px,0.85fr)] dark:border-slate-800'>+ <div><div className='flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between'><div><Text as='h4' size='base' weight='semibold'>@@ -2179,7 +2150,10 @@ const UserSettings = () => {})}</Text></div>- <Text as='span' className={websiteAddonStatusClassName}>+ <Text+ as='span'+ className={websiteAddonStatusClassName}+ >{websiteAddonStatusLabel}</Text></div>@@ -2197,7 +2171,9 @@ const UserSettings = () => {className='mt-1'>{t('billing.xofy', {- x: (usageInfo.projects || 0).toLocaleString(),+ x: (+ usageInfo.projects || 0+ ).toLocaleString(),y: (displayedWebsiteLimit || 0).toLocaleString(),@@ -2246,6 +2222,12 @@ const UserSettings = () => {</div></div>+ {websiteAddonDisabledReason ? (+ <Alert variant='info' className='mt-4'>+ {websiteAddonDisabledReason}+ </Alert>+ ) : null}+<div className='mt-4 grid gap-4 lg:grid-cols-[minmax(0,1fr)_minmax(260px,0.8fr)]'><div><Text as='label' size='sm' weight='medium'>@@ -2268,29 +2250,21 @@ const UserSettings = () => {><MinusIcon className='size-4' /></Button>- <Select<number>- selectedItem={selectedWebsiteAddonQuantity}- items={WEBSITE_ADDON_QUANTITY_OPTIONS}- onSelect={setSelectedWebsiteAddonQuantity}- disabled={isWebsiteAddonDisabled}- className='min-w-44 flex-1'- title={- selectedWebsiteAddonQuantity- ? t('billing.extraWebsitesAmount', {- amount:- selectedWebsiteAddonQuantity.toLocaleString(),- })- : t('billing.noAdditionalWebsites')- }- labelExtractor={(amount) =>- amount- ? t('billing.extraWebsitesAmount', {- amount: amount.toLocaleString(),- })- : t('billing.noAdditionalWebsites')- }- keyExtractor={(amount) => String(amount)}- />+ <div+ aria-live='polite'+ className={cx(+ 'flex min-w-44 flex-1 items-center justify-center rounded-md border border-gray-300 bg-gray-50 px-3 py-2 text-center text-sm font-semibold text-slate-900 tabular-nums dark:border-slate-700/80 dark:bg-slate-950 dark:text-gray-50',+ isWebsiteAddonDisabled &&+ 'cursor-not-allowed opacity-60',+ )}+ >+ {selectedWebsiteAddonQuantity+ ? t('billing.extraWebsitesAmount', {+ amount:+ selectedWebsiteAddonQuantity.toLocaleString(),+ })+ : t('billing.noAdditionalWebsites')}+ </div><Buttonvariant='icon'aria-label={t(@@ -2315,31 +2289,31 @@ const UserSettings = () => {{t('billing.websiteAddonBillingInterval')}</Text><div className='mt-1.5 grid grid-cols-2 rounded-md border border-gray-300 bg-gray-50 p-1 dark:border-slate-700/80 dark:bg-slate-950'>- {(['monthly', 'yearly'] as BillingInterval[]).map(- (interval) => (- <button- key={interval}- type='button'- disabled={isWebsiteAddonDisabled}- onClick={() =>- setSelectedWebsiteAddonBillingInterval(- interval,- )- }- className={cx(- 'rounded-sm px-3 py-1.5 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-60',- selectedWebsiteAddonBillingInterval ===- interval- ? 'bg-white text-slate-900 ring-1 ring-gray-200 dark:bg-slate-900 dark:text-gray-50 dark:ring-slate-700'- : 'text-gray-600 hover:text-slate-900 dark:text-gray-300 dark:hover:text-gray-50',- )}- >- {interval === 'monthly'- ? t('billing.websiteAddonMonthly')- : t('billing.websiteAddonYearly')}- </button>- ),- )}+ {(+ ['monthly', 'yearly'] as BillingInterval[]+ ).map((interval) => (+ <button+ key={interval}+ type='button'+ disabled={isWebsiteAddonDisabled}+ onClick={() =>+ setSelectedWebsiteAddonBillingInterval(+ interval,+ )+ }+ className={cx(+ 'rounded-sm px-3 py-1.5 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-60',+ selectedWebsiteAddonBillingInterval ===+ interval+ ? 'bg-white text-slate-900 ring-1 ring-gray-200 dark:bg-slate-900 dark:text-gray-50 dark:ring-slate-700'+ : 'text-gray-600 hover:text-slate-900 dark:text-gray-300 dark:hover:text-gray-50',+ )}+ >+ {interval === 'monthly'+ ? t('billing.websiteAddonMonthly')+ : t('billing.websiteAddonYearly')}+ </button>+ ))}</div><Textas='p'@@ -2352,11 +2326,6 @@ const UserSettings = () => {</div></div>- {websiteAddonDisabledReason ? (- <Alert variant='info' className='mt-4'>- {websiteAddonDisabledReason}- </Alert>- ) : null}{hasPendingWebsiteAddonChange &&!websiteAddonDisabledReason ? (<Alert variant='warning' className='mt-4'>@@ -2393,7 +2362,9 @@ const UserSettings = () => {? `${currency.symbol}${formatBillingPrice(currentWebsiteAddonPreview.dueNow,)}`- : t('billing.websiteAddonNoImmediateCharge')}+ : t(+ 'billing.websiteAddonNoImmediateCharge',+ )}</Text></div><div>@@ -2474,7 +2445,7 @@ const UserSettings = () => {</div></div>- <div className='rounded-lg border border-gray-200 p-4 dark:border-slate-800'>+ <div className='border-t border-gray-200 pt-6 xl:border-t-0 xl:border-l xl:pt-0 xl:pl-8 dark:border-slate-800'><div className='flex items-start justify-between gap-3'><div><Text as='h4' size='base' weight='semibold'>@@ -2501,12 +2472,7 @@ const UserSettings = () => {{t('billing.comingSoon')}</Text></div>- <Text- as='p'- size='lg'- weight='bold'- className='mt-4'- >+ <Text as='p' size='lg' weight='bold' className='mt-4'>{currency.symbol}{formatBillingPrice(sessionReplayAddonPrice)}<Textdiff --git a/web/public/locales/en.json b/web/public/locales/en.jsonindex 9d0fb8109..ff533def5 100644--- a/web/public/locales/en.json+++ b/web/public/locales/en.json@@ -2846,7 +2846,7 @@"negativePayment": "A negative amount means you will receive {{currency}}{{dueNowAmount}} in account credit. You will be charged {{currency}}0.00 on {{dueNowDate}}. After the credit is used, your recurring payment will be {{currency}}{{nextPaymentAmount}} each billing cycle.","nextPayment": "Next payment","subscription": "Subscription",- "planUsageDesc": "Usage shows the events counted toward your monthly plan limit, including pageviews, custom events, CAPTCHA events, and error events.",+ "planUsageDesc": "Events counted toward your monthly plan limit.","xofy": "{{x}} of {{y}}","resetDate": "Usage resets on the first day of each month. {{days}} days until reset.","selectPlan": "Select a plan to continue using Swetrix.",@@ -2862,7 +2862,7 @@"choosePlanPageDesc": "Pick your monthly event volume, plan type, and billing period. You'll see the exact price before checkout.","choosePlanCurrentPlanDesc": "Pick your monthly event volume, plan type, and billing period. Your current plan is {{plan}} with {{events}} events per month, and changes are prorated automatically.","planFaqTitle": "Plan questions",- "membersNotification": "Pageviews, custom events, CAPTCHA events, and error events count toward the account owner's plan limit. Invited project members do not need their own subscription.",+ "membersNotification": "Invited project members do not need their own subscription; their usage counts toward the account owner's plan limit.","trialDescription": "Your free trial includes all features and unlimited data collection. When it ends, choose a paid plan that matches your usage to keep using Swetrix.","trialChargeWarning": "You will be charged automatically when the trial ends unless you cancel first. You can cancel anytime from this page.","cannotChangePlanDuringTrial": "You cannot change plans during your trial. You can switch plans after the trial ends, or cancel the trial and subscribe to a different plan.",@@ -2884,6 +2884,7 @@"invalidCurrency": "Invalid currency","websites": "Websites","websitesAddonTooltip": "Need more websites? Add recurring website add-ons from this page.",+ "websitesIncludedCaption": "Included in your plan","addedWebsites": "+{{amount}} added","sessionReplays": "Session replays","sessionReplaysAddonTooltip": "Need more recorded sessions? Session replay add-ons can extend this monthly quota.",