-
Notifications
You must be signed in to change notification settings - Fork 1k
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: $199 pricing model for unlimited plans #1564
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Ignored Deployments
|
Thank you for following the naming conventions for pull request titles! 🙏 |
subscriptionCreatedOrUpdated.ts
async function handleProduct(productName, featureKey, unlimitedKey, unlimitedKey199, team, stripeSubscriptionObject) {
let updatedFeatures = team.billing.features;
if (
!(
stripeSubscriptionObject.cancel_at_period_end &&
team.billing.features[featureKey].status === "cancelled"
)
) {
updatedFeatures[featureKey].status = "active";
}
if (
item.price.lookup_key === unlimitedKey ||
item.price.lookup_key === unlimitedKey199
) {
updatedFeatures[featureKey].unlimited = true;
} else {
const countForTeam = await getMonthlyTeamResponseCount(team.id);
await reportUsage(
stripeSubscriptionObject.items.data,
featureKey,
countForTeam
);
}
return updatedFeatures;
}
for (const item of stripeSubscriptionObject.items.data) {
const product = await stripe.products.retrieve(item.price.product as string);
switch (product.name) {
case StripeProductNames.inAppSurvey:
updatedFeatures = await handleProduct(StripeProductNames.inAppSurvey, ProductFeatureKeys.inAppSurvey, StripePriceLookupKeys.inAppSurveyUnlimited, StripePriceLookupKeys.inAppSurveyUnlimited199, team, stripeSubscriptionObject);
break;
case StripeProductNames.linkSurvey:
updatedFeatures = await handleProduct(StripeProductNames.linkSurvey, ProductFeatureKeys.linkSurvey, StripePriceLookupKeys.linkSurveyUnlimited, StripePriceLookupKeys.linkSurveyUnlimited199, team, stripeSubscriptionObject);
break;
case StripeProductNames.userTargeting:
updatedFeatures = await handleProduct(StripeProductNames.userTargeting, ProductFeatureKeys.userTargeting, StripePriceLookupKeys.userTargetingUnlimited, StripePriceLookupKeys.userTargetingUnlimited199, team, stripeSubscriptionObject);
break;
}
}
class TeamNotFoundError extends Error {
constructor() {
super("Team not found");
this.name = "TeamNotFoundError";
}
}
// Usage
if (!team) {
throw new TeamNotFoundError();
} page.tsx
class UnauthorizedError extends Error {
constructor() {
super("Unauthorized");
this.name = "UnauthorizedError";
}
}
class TeamNotFoundError extends Error {
constructor() {
super("Team not found");
this.name = "TeamNotFoundError";
}
}
// Usage
if (!session) {
throw new UnauthorizedError();
}
if (!team) {
throw new TeamNotFoundError();
} checkoutSessionCompleted.ts
class TeamNotFoundError extends Error {
constructor() {
super("Team not found");
this.name = "TeamNotFoundError";
}
}
// Usage
if (!team) {
throw new TeamNotFoundError();
} |
mattinannt
approved these changes
Nov 6, 2023
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.
💪🙏
kevinkong91
added a commit
to kevinkong91/formbricks
that referenced
this pull request
Nov 7, 2023
* main: (42 commits) chore: add revert to oss-friends (formbricks#745) fix: pass authOptions to getServerSession in authLayout (formbricks#1584) fix: fixed URL example for "Create Survey" API endpoint is wrong formbricks#1555 (formbricks#1586) fix(docs): default account info docs changes (formbricks#1583) chore: Add docker packages to Github Packages on release (formbricks#1585) feat: avatar upload (formbricks#1546) fix: editor crashing (formbricks#1582) fix: Add scroll to the setting navbar (formbricks#1398) are you sure modal missing fix:formbricks#1419 (formbricks#1485) fix: github linting issues (formbricks#1510) refactor: added authorization to airtable integration and create a common actions file (formbricks#1538) docs: add docs for airtable (formbricks#1541) fix: missing static generation store in revalidation due to pages dir (formbricks#1581) feat: Pagination for other values in multi choice (formbricks#1560) feat: $199 pricing model for unlimited plans (formbricks#1564) fix: make pricing pages consistent (formbricks#1567) fix: openText issue (formbricks#1579) fix: avoid blocking the request if it does not have an associated ip (formbricks#1540) feat: Add Unkey to OSS Friends (formbricks#1574) feat: FOR-683 Role Switch (formbricks#1450) ...
kevinkong91
added a commit
to kevinkong91/formbricks
that referenced
this pull request
Nov 7, 2023
* main: (70 commits) chore: add revert to oss-friends (formbricks#745) fix: pass authOptions to getServerSession in authLayout (formbricks#1584) fix: fixed URL example for "Create Survey" API endpoint is wrong formbricks#1555 (formbricks#1586) fix(docs): default account info docs changes (formbricks#1583) chore: Add docker packages to Github Packages on release (formbricks#1585) feat: avatar upload (formbricks#1546) fix: editor crashing (formbricks#1582) fix: Add scroll to the setting navbar (formbricks#1398) are you sure modal missing fix:formbricks#1419 (formbricks#1485) fix: github linting issues (formbricks#1510) refactor: added authorization to airtable integration and create a common actions file (formbricks#1538) docs: add docs for airtable (formbricks#1541) fix: missing static generation store in revalidation due to pages dir (formbricks#1581) feat: Pagination for other values in multi choice (formbricks#1560) feat: $199 pricing model for unlimited plans (formbricks#1564) fix: make pricing pages consistent (formbricks#1567) fix: openText issue (formbricks#1579) fix: avoid blocking the request if it does not have an associated ip (formbricks#1540) feat: Add Unkey to OSS Friends (formbricks#1574) feat: FOR-683 Role Switch (formbricks#1450) ...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Introduce new plan for the unlimited offering and update accordingly in Stripe
Type of change
Checklist
Required
pnpm build
console.logs
git pull origin main
Appreciated