({ organization }: { organization: Organization })
| 382 | const MAX_PAYMENT_METHODS = 2; |
| 383 | |
| 384 | const PlanText = ({ organization }: { organization: Organization }) => { |
| 385 | const planType = organization.subscription?.type; |
| 386 | |
| 387 | switch (planType) { |
| 388 | case "evaluation": { |
| 389 | const trialExpirationDate = organization.trialExpiresAt |
| 390 | ? new Date(organization.trialExpiresAt) |
| 391 | : null; |
| 392 | |
| 393 | const hasTrialEnded = getIsTrialExpired(organization); |
| 394 | |
| 395 | return ( |
| 396 | <Text textStyle="text-small"> |
| 397 | Free trial |
| 398 | {!hasTrialEnded && trialExpirationDate |
| 399 | ? ` ends on ${formatDateInUtc( |
| 400 | trialExpirationDate, |
| 401 | FRIENDLY_DATETIME_FORMAT_NO_SECONDS, |
| 402 | )}` |
| 403 | : " has ended"} |
| 404 | </Text> |
| 405 | ); |
| 406 | } |
| 407 | |
| 408 | case "on-demand": { |
| 409 | const nextPaymentDate = calculateNextOnDemandPaymentDate(); |
| 410 | return ( |
| 411 | <VStack alignItems="start" spacing="0"> |
| 412 | <Text textStyle="text-small"> |
| 413 | Next payment on{" "} |
| 414 | {formatDateInUtc(nextPaymentDate, FRIENDLY_DATE_FORMAT)} |
| 415 | </Text> |
| 416 | <Text textStyle="text-small">On-Demand plan, paid monthly</Text> |
| 417 | </VStack> |
| 418 | ); |
| 419 | } |
| 420 | case "capacity": |
| 421 | return <Text textStyle="text-small">Capacity plan</Text>; |
| 422 | case "internal": |
| 423 | return <Text textStyle="text-small">Internal plan</Text>; |
| 424 | default: |
| 425 | return null; |
| 426 | } |
| 427 | }; |
| 428 | |
| 429 | function getPaymentErrorMessage(error: unknown, fallback: string): string { |
| 430 | if (isApiError(error) && error.status === 403) { |
nothing calls this directly
no test coverage detected