AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
fix(billing): show the credits reset as a date when the interval is unknown (#15603)
Abdul9e08754075ac
diff --git a/packages/web/src/features/billing/components/credits-usage-alert.tsx b/packages/web/src/features/billing/components/credits-usage-alert.tsxindex e26be4385e3..e6959cb4ed1 100644--- a/packages/web/src/features/billing/components/credits-usage-alert.tsx+++ b/packages/web/src/features/billing/components/credits-usage-alert.tsx@@ -26,7 +26,6 @@ export const CreditsUsageAlert = React.memo(() => {platformId,usage,isPlatformAdmin,- isPaid,isBillingEnforced,creditsRemaining,isUnlimited,@@ -62,7 +61,6 @@ export const CreditsUsageAlert = React.memo(() => {creditsNextResetAt: usage?.creditsNextResetAt,creditsResetInterval: info?.creditsResetInterval,nextBillingDate: info?.nextBillingDate,- isPaid,dateFormat: BILLING_DATE_FORMAT,});const isDanger = severity === 'error';diff --git a/packages/web/src/features/billing/components/feature-usage/credits-card.tsx b/packages/web/src/features/billing/components/feature-usage/credits-card.tsxindex 844c07fbe30..be045a45823 100644--- a/packages/web/src/features/billing/components/feature-usage/credits-card.tsx+++ b/packages/web/src/features/billing/components/feature-usage/credits-card.tsx@@ -12,7 +12,6 @@ const CARD_DATE_FORMAT = 'D MMM YYYY, h:mm A';export const CreditsCard = ({ info }: CreditsCardProps) => {const { plan, usage } = info;- const isPaid = billingUtils.isPaidPlan(plan.plan);const remaining = usage.creditsRemaining;const isUnlimited = isNil(remaining);const total = plan.includedCredits;@@ -21,7 +20,7 @@ export const CreditsCard = ({ info }: CreditsCardProps) => {used,total: isUnlimited ? null : total,});- const footer = resolveFooter({ info, isPaid });+ const footer = resolveFooter(info);const switchesToPlanName =info.scheduledPlanName ??(info.billingPortalAvailable ? info.autumnPlanName : t('Free'));@@ -75,13 +74,9 @@ export const CreditsCard = ({ info }: CreditsCardProps) => {);};-function resolveFooter({- info,- isPaid,-}: {- info: PlatformBillingInformation;- isPaid: boolean;-}): CreditsResetLine | null {+function resolveFooter(+ info: PlatformBillingInformation,+): CreditsResetLine | null {if (!isNil(info.trialEndsAt)) {return {label: t('Trial ends'),@@ -92,7 +87,6 @@ function resolveFooter({creditsNextResetAt: info.usage.creditsNextResetAt,creditsResetInterval: info.creditsResetInterval,nextBillingDate: info.nextBillingDate,- isPaid,dateFormat: CARD_DATE_FORMAT,});}diff --git a/packages/web/src/features/billing/components/sidebar-usage-limits.tsx b/packages/web/src/features/billing/components/sidebar-usage-limits.tsxindex 4ed50449787..a3c8d91cb56 100644--- a/packages/web/src/features/billing/components/sidebar-usage-limits.tsx+++ b/packages/web/src/features/billing/components/sidebar-usage-limits.tsx@@ -73,7 +73,6 @@ export const SidebarUsageLimits = React.memo(() => {creditsNextResetAt: usage.creditsNextResetAt,creditsResetInterval: info?.creditsResetInterval,nextBillingDate: info?.nextBillingDate,- isPaid,dateFormat: BILLING_DATE_FORMAT,});return (diff --git a/packages/web/src/features/billing/utils/billing-utils.ts b/packages/web/src/features/billing/utils/billing-utils.tsindex 81cf9024081..1ab94df899d 100644--- a/packages/web/src/features/billing/utils/billing-utils.ts+++ b/packages/web/src/features/billing/utils/billing-utils.ts@@ -127,36 +127,12 @@ function resolveResetMoment({creditsNextResetAt,creditsResetInterval,nextBillingDate,- isPaid,}: CreditsResetParams): { at: string; resetsDaily: boolean } | null {- if (!isNil(creditsNextResetAt)) {- return {- at: creditsNextResetAt,- resetsDaily: isDailyReset({ creditsResetInterval, isPaid }),- };- }- if (isPaid) {- return isNil(nextBillingDate)- ? null- : { at: nextBillingDate, resetsDaily: false };- }- return {- at: dayjs().add(1, 'day').startOf('day').toISOString(),- resetsDaily: true,- };-}--function isDailyReset({- creditsResetInterval,- isPaid,-}: {- creditsResetInterval: string | null | undefined;- isPaid: boolean;-}): boolean {- if (isNil(creditsResetInterval)) {- return !isPaid;+ const at = creditsNextResetAt ?? nextBillingDate;+ if (isNil(at)) {+ return null;}- return creditsResetInterval === DAILY_RESET_INTERVAL;+ return { at, resetsDaily: creditsResetInterval === DAILY_RESET_INTERVAL };}function formatTimeUntil(value: string): string {@@ -235,7 +211,6 @@ export type CreditsResetParams = {creditsNextResetAt: string | null | undefined;creditsResetInterval: string | null | undefined;nextBillingDate: string | null | undefined;- isPaid: boolean;};export type CreditsResetLine = {