add metered products usage (#11452)

- add metered products usage module on settings/billing page
- add new resolver + logic with meter event data fetching from Stripe

<img width="590" alt="Screenshot 2025-04-08 at 16 34 07"
src="https://github.com/user-attachments/assets/34327af1-3482-4d61-91a6-e2dbaeb017ab"
/>
<img width="570" alt="Screenshot 2025-04-08 at 16 31 58"
src="https://github.com/user-attachments/assets/55aa221a-925f-48bf-88c4-f20713c79962"
/>

- bonus : disable subscription switch from yearly to monthly

closes https://github.com/twentyhq/core-team-issues/issues/681
This commit is contained in:
Etienne
2025-04-09 11:26:49 +02:00
committed by GitHub
parent b25ee28c12
commit 11fb8e0284
23 changed files with 570 additions and 139 deletions

View File

@ -0,0 +1,13 @@
import { gql } from '@apollo/client';
export const GET_METERED_PRODUCTS_USAGE = gql`
query GetMeteredProductsUsage {
getMeteredProductsUsage {
productKey
usageQuantity
includedFreeQuantity
unitPriceCents
totalCostCents
}
}
`;

View File

@ -0,0 +1,9 @@
import { gql } from '@apollo/client';
export const SWITCH_SUBSCRIPTION_TO_YEARLY_INTERVAL = gql`
mutation SwitchSubscriptionToYearlyInterval {
switchToYearlyInterval {
success
}
}
`;

View File

@ -1,9 +0,0 @@
import { gql } from '@apollo/client';
export const UPDATE_BILLING_SUBSCRIPTION = gql`
mutation UpdateBillingSubscription {
updateBillingSubscription {
success
}
}
`;