fix: More accurate rounded days in subscription end message (#2193)
Resolves https://github.com/webrecorder/browsertrix/issues/2192 ## Changes - Displays more accurate subscription/trial end message when subscription ends between 1-2 days - Shows timezone for end date --------- Co-authored-by: SuaYoo <SuaYoo@users.noreply.github.com>
This commit is contained in:
parent
17459dc8cd
commit
9736297c49
@ -1,5 +1,5 @@
|
||||
import { localized, msg, str } from "@lit/localize";
|
||||
import { differenceInDays } from "date-fns/fp";
|
||||
import { differenceInHours } from "date-fns/fp";
|
||||
import { html, type TemplateResult } from "lit";
|
||||
import { customElement } from "lit/decorators.js";
|
||||
|
||||
@ -62,18 +62,21 @@ export class OrgStatusBanner extends BtrixElement {
|
||||
execMinutesQuotaReached,
|
||||
} = this.org;
|
||||
|
||||
let hoursDiff = 0;
|
||||
let daysDiff = 0;
|
||||
let dateStr = "";
|
||||
const futureCancelDate = subscription?.futureCancelDate || null;
|
||||
|
||||
if (futureCancelDate) {
|
||||
daysDiff = differenceInDays(new Date(), new Date(futureCancelDate));
|
||||
hoursDiff = differenceInHours(new Date(), new Date(futureCancelDate));
|
||||
daysDiff = Math.trunc(hoursDiff / 24);
|
||||
|
||||
dateStr = this.localize.date(futureCancelDate, {
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
year: "numeric",
|
||||
hour: "numeric",
|
||||
timeZoneName: "short",
|
||||
});
|
||||
}
|
||||
|
||||
@ -90,12 +93,11 @@ export class OrgStatusBanner extends BtrixElement {
|
||||
content: () => {
|
||||
return {
|
||||
title:
|
||||
daysDiff > 1
|
||||
? msg(
|
||||
str`Your org will be deleted in
|
||||
${daysDiff} days`,
|
||||
)
|
||||
: `Your org will be deleted within one day`,
|
||||
hoursDiff < 24
|
||||
? msg("Your org will be deleted within one day")
|
||||
: daysDiff === 1
|
||||
? msg("Your org will be deleted in one day.")
|
||||
: msg(str`Your org will be deleted in ${daysDiff} days`),
|
||||
detail: html`
|
||||
<p>
|
||||
${msg(
|
||||
@ -124,11 +126,13 @@ export class OrgStatusBanner extends BtrixElement {
|
||||
content: () => {
|
||||
return {
|
||||
title:
|
||||
daysDiff > 1
|
||||
? msg(
|
||||
str`You have ${daysDiff} days left of your Browsertrix trial`,
|
||||
)
|
||||
: msg(`Your trial ends within one day`),
|
||||
hoursDiff < 24
|
||||
? msg("Your trial ends within one day")
|
||||
: daysDiff === 1
|
||||
? msg("You have one day left of your Browsertrix trial")
|
||||
: msg(
|
||||
str`You have ${daysDiff} days left of your Browsertrix trial`,
|
||||
),
|
||||
|
||||
detail: html`
|
||||
<p>
|
||||
|
@ -2935,10 +2935,6 @@
|
||||
<trans-unit id="sc154fb69dffcdef9">
|
||||
<source>billing settings</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="s71c5c2d34bb2c4c2">
|
||||
<source>Your org will be deleted in
|
||||
<x equiv-text="${daysDiff}" id="0"/> days</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="s7fa0d24b94690373">
|
||||
<source>Your subscription ends on <x equiv-text="${dateStr}" id="0"/>. Your user account, org, and all associated data will be deleted.</source>
|
||||
</trans-unit>
|
||||
@ -3835,17 +3831,30 @@
|
||||
<trans-unit id="sab5061cf8c519285">
|
||||
<source><x equiv-text="${storageBytesText}" id="0"/> of disk space</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="saecba9c0445090e6">
|
||||
<source>Choose a Browsertrix Crawler release channel. If available, other versions may provide new/experimental crawling features.</source>
|
||||
<trans-unit id="s8be75efeafa7ffe1">
|
||||
<source>Your org will be deleted within one day</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="s22cec6a3e464a4e9">
|
||||
<source>Gracefully stop archiving after the specified amount of time has elapsed.</source>
|
||||
<trans-unit id="sfa1778ba000b56f5">
|
||||
<source>Your org will be deleted in one day.</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="s2823887bf8a836da">
|
||||
<source>Gracefully stop archiving after the specified amount of data has been captured.</source>
|
||||
<trans-unit id="se392e1f811076a30">
|
||||
<source>Your org will be deleted in <x equiv-text="${daysDiff}" id="0"/> days</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="s9aa0dfb832cb7f69">
|
||||
<source>View error logs</source>
|
||||
<trans-unit id="se1037ae4d9adb08a">
|
||||
<source>You have one day left of your Browsertrix trial</source>
|
||||
<trans-unit id="saecba9c0445090e6">
|
||||
<source>Choose a Browsertrix Crawler release channel. If available, other versions may provide new/experimental crawling features.</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="s22cec6a3e464a4e9">
|
||||
<source>Gracefully stop archiving after the specified amount of time has elapsed.</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="s2823887bf8a836da">
|
||||
<source>Gracefully stop archiving after the specified amount of data has been captured.</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="s9aa0dfb832cb7f69">
|
||||
<source>View error logs</source>
|
||||
</trans-unit>
|
||||
<source>You have one day left of your Browsertrix trial</source>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
|
Loading…
Reference in New Issue
Block a user