-
Notifications
You must be signed in to change notification settings - Fork 890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: pricing & payments v2 for formbricks cloud #2648
base: main
Are you sure you want to change the base?
Conversation
Thank you for following the naming conventions for pull request titles! 🙏 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! @ShubhamPalriwala thanks for the PR! looks good and works well, I just left a few comments, pls address them 🙏
also, there is no data migration right now so the older teams won't work with this, please write a data migration for backwards compatibility.
I also encountered this weird error that exists when I try to switch plans:
Screen.Recording.2024-05-23.at.4.20.51.PM.mov
you can see that only after reloading the page does the UI actually update (and I hard reloaded the page for it to work). Also, when I click on any Switch Plan
button, all the other buttons also get a loading state, pls also fix these 🙏
<div className="mb-2 flex items-center gap-x-4"></div> | ||
{ | ||
<div className="relative mx-8 mb-16 mt-4"> | ||
Responses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please wrap this text inside a html tag like the p
tag and give it some color as well 🙏 pls do the same for all the text elements
const product = await stripe.products.retrieve( | ||
stripeSubscriptionObject.items.data[0].price.product as string | ||
); | ||
if (!product) throw new Error("Product not found"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should be consistent here with the other services and throw a ResourceNotFoundError
instead of just an Error
for more context. Also pls do this for the other not found errors 🙏
if (!product) throw new Error("Product not found"); | ||
|
||
let updatedBilling = team.billing; | ||
let responses = product.metadata.responses as unknown as number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't type cast these as numbers, they won't actually be converted to numbers, but the typescript compiler will still be treating them as numbers which could lead to runtime errors. Please use parseInt
here to actually convert these to numbers 🙏
|
||
let updatedBilling = team.billing; | ||
let responses = product.metadata.responses as unknown as number; | ||
let miu = product.metadata.miu as unknown as number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here as above 😊
@@ -1,23 +1,25 @@ | |||
export enum ProductFeatureKeys { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this file contains constants, please use the upper case for all of them, you can take a look at the COLOR_DEFAULTS
under packages/lib/styling/constants.ts
for reference, its basically to be consistent around constants, like you've done with LIMITS 🙏
}); | ||
}); | ||
if (!priceObject) throw new Error("Price not found"); | ||
const responses = (priceObject.product as Stripe.Product).metadata.responses as unknown as number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as mentioned above, pls don't type cast it and actually convert it to an integer using parseInt
What does this PR do?
Closes https://github.com/formbricks/internal/issues/192
How should this be tested?
Checklist
Required
pnpm build
console.logs
git pull origin main
Appreciated