Skip to content

The open alternative to Salesforce, designed for AI.

1.1 KB
Raw Blame
import { gql } from '@apollo/client';
import { BILLING_SUBSCRIPTION_SCHEDULE_PHASE_FRAGMENT } from '@/settings/billing/graphql/fragments/billingSubscriptionSchedulePhaseFragment';
import { BILLING_SUBSCRIPTION_SCHEDULE_PHASE_ITEM_FRAGMENT } from '@/settings/billing/graphql/fragments/billingSubscriptionSchedulePhaseItemFragment';

export const CURRENT_BILLING_SUBSCRIPTION_FRAGMENT = gql`
  fragment CurrentBillingSubscriptionFragment on BillingSubscription {
    id
    status
    interval
    metadata
    currentPeriodEnd
    cancelAt
    collectionMethod
    hasUserCredits
    phases {
      ...BillingSubscriptionSchedulePhaseFragment
    }
    billingSubscriptionItems {
      id
      hasReachedCurrentPeriodCap
      quantity
      stripePriceId
      unitAmount
      creditAmount
      billingProduct {
        name
        description
        images
        metadata {
          productKey
          planKey
          priceUsageBased
          isLegacy
        }
      }
    }
  }

  ${BILLING_SUBSCRIPTION_SCHEDULE_PHASE_ITEM_FRAGMENT}
  ${BILLING_SUBSCRIPTION_SCHEDULE_PHASE_FRAGMENT}
`;