MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / getCodingPlanBillingDate

Function getCodingPlanBillingDate

apps/web/src/components/subscriptions/helpers.ts:28–52  ·  view source on GitHub ↗
(params: {
  status: string;
  cancelAtPeriodEnd: boolean;
  currentPeriodEnd: string;
  creditRenewalAt: string;
  paymentGraceExpiresAt: string | null;
  canceledAt: string | null;
})

Source from the content-addressed store, hash-verified

26}
27
28export function getCodingPlanBillingDate(params: {
29 status: string;
30 cancelAtPeriodEnd: boolean;
31 currentPeriodEnd: string;
32 creditRenewalAt: string;
33 paymentGraceExpiresAt: string | null;
34 canceledAt: string | null;
35}): { label: string; date: string } {
36 if (params.status === 'canceled') {
37 return { label: 'Ended at', date: params.canceledAt ?? params.currentPeriodEnd };
38 }
39
40 if (params.status === 'past_due') {
41 return {
42 label: 'Grace expires',
43 date: params.paymentGraceExpiresAt ?? params.currentPeriodEnd,
44 };
45 }
46
47 if (params.cancelAtPeriodEnd) {
48 return { label: 'Access ends', date: params.currentPeriodEnd };
49 }
50
51 return { label: 'Renews at', date: params.creditRenewalAt };
52}
53
54export function getCodingPlanPriceParts(
55 costKiloCredits: number,

Callers 3

helpers.test.tsFile · 0.90
CodingPlanDetailFunction · 0.90
CodingPlansGroupFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected