deprocate getProductPrices query in front end (#10397)
**TLDR:** Deprecate getProductPrices in the frontEnd and replace it with BillingBaseProductPrices. **In order to test:** - Have the environment variable IS_BILLING_ENABLED set to true and add the other required environment variables for Billing to work - Do a database reset (to ensure that the new feature flag is properly added and that the billing tables are created) - Run the command: npx nx run twenty-server:command billing:sync-plans-data (if you don't do that the products and prices will not be present in the database) - Run the server , the frontend, the worker, and the stripe listen command (stripe listen --forward-to http://localhost:3000/billing/webhooks) - Buy a subscription for acme workspace the choose your plan should be using the new front end endpoint
This commit is contained in:
committed by
GitHub
parent
e838dfc68b
commit
4d7e52ef25
@ -0,0 +1,18 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const BILLING_BASE_PRODUCT_PRICES = gql`
|
||||
query billingBaseProductPrices {
|
||||
plans {
|
||||
planKey
|
||||
baseProduct {
|
||||
prices {
|
||||
... on BillingPriceLicensedDTO {
|
||||
unitAmount
|
||||
stripePriceId
|
||||
recurringInterval
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -1,14 +0,0 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const GET_PRODUCT_PRICES = gql`
|
||||
query GetProductPrices($product: String!) {
|
||||
getProductPrices(product: $product) {
|
||||
productPrices {
|
||||
created
|
||||
recurringInterval
|
||||
stripePriceId
|
||||
unitAmount
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -0,0 +1,7 @@
|
||||
import { BillingPriceLicensedDto } from '~/generated/graphql';
|
||||
|
||||
export const isBillingPriceLicensed = <T extends { __typename?: string }>(
|
||||
price: T,
|
||||
): price is T & BillingPriceLicensedDto => {
|
||||
return price?.__typename === 'BillingPriceLicensedDTO';
|
||||
};
|
||||
Reference in New Issue
Block a user