-
Notifications
You must be signed in to change notification settings - Fork 11.1k
feat: Add configurable trial days to org subscriptions + wizard warning #25229
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
Conversation
- Add ORGANIZATION_TRIAL_DAYS environment variable for configurable trial periods - Implement trial days in Stripe checkout session (only when env var is set) - Add warning message to organization setup page about workspace structure - Add translation string for organization trial workspace warning - Add ORGANIZATION_TRIAL_DAYS to turbo.json env vars - Fix pre-existing linting warnings in CreateANewOrganizationForm.tsx - Add ESLint disable comments for turbo/no-undeclared-env-vars warnings Co-Authored-By: [email protected] <[email protected]>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
- Add optional footer prop to WizardLayout component - Use footer prop in create-new-view.tsx to render warning at spot 3 - Remove warning from inside CreateANewOrganizationForm component - Warning now appears below the form card as requested Co-Authored-By: [email protected] <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
- Add warning footer to step 2 (about-view.tsx) - Add warning footer to step 3 (add-teams-view.tsx) - Add warning footer to step 4 (onboard-members-view.tsx) - Add warning footer to step 5 (payment-status-view.tsx) - Add warning footer to resume-view.tsx (step 1 resume page) - Warning now appears on all steps of the organization creation wizard Co-Authored-By: [email protected] <[email protected]>
- Changed ORGANIZATION_TRIAL_DAYS to STRIPE_ORG_TRIAL_DAYS in turbo.json - This matches the actual usage in OrganizationPaymentService.ts and payments.ts - Ensures the environment variable is properly recognized by the build system Co-Authored-By: [email protected] <[email protected]>
- Create OrganizationWizardLayout component that wraps WizardLayout - Centralizes the trial warning footer logic in one place - Update all 6 wizard pages to use the shared component: - create-new-view.tsx - about-view.tsx - add-teams-view.tsx - onboard-members-view.tsx - payment-status-view.tsx - resume-view.tsx - Remove duplicate useLocale/Alert imports and footer props from pages - Simplifies maintenance by having warning logic in a single location Co-Authored-By: [email protected] <[email protected]>
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.
1 issue found across 14 files
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="packages/features/ee/teams/lib/payments.ts">
<violation number="1" location="packages/features/ee/teams/lib/payments.ts:174">
The parsing logic for `STRIPE_ORG_TRIAL_DAYS` is inconsistent and less safe in `payments.ts` compared to `OrganizationPaymentService.ts`. The implementation in `payments.ts` lacks validation for positive integers and could pass invalid data (e.g., negative numbers) to the Stripe API.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
packages/features/ee/organizations/lib/OrganizationPaymentService.ts
Outdated
Show resolved
Hide resolved
hariombalhara
left a comment
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.
One small bug caught by Cubic.
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.
1 issue found across 15 files
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="packages/lib/constants.ts">
<violation number="1" location="packages/lib/constants.ts:258">
Negative STRIPE_ORG_TRIAL_DAYS values remain truthy and are forwarded as `trial_period_days`, causing Stripe to reject the checkout; clamp the value to a positive integer before exporting it.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
E2E results are ready! |
Udit-takkar
left a comment
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.
LGTM.
Should we add some tests later?
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.
No issues found across 15 files
What does this PR do?
Adds support for configurable trial periods on organization subscriptions through the
STRIPE_ORG_TRIAL_DAYSenvironment variable. When set, new organization subscriptions will include a trial period before billing begins.Additionally adds a warning message to all steps of the organization creation wizard informing users about the workspace structure implications of using the Organizations trial.
https://www.loom.com/share/3b8c2d2675f6459f827f7890fcae237d
Link to Devin run: https://app.devin.ai/sessions/80afb60fc6bf469985140065e7b5c6f4
Requested by: [email protected] (@joeauyeung)
Changes Made
1. Trial Days Implementation
STRIPE_ORG_TRIAL_DAYSenvironment variable to.env.exampleOrganizationPaymentService.ts(organization onboarding flow)payments.ts(purchaseTeamOrOrgSubscriptionfunction)turbo.jsonfor build configuration2. Organization Wizard Warning
WizardLayoutcomponent with optionalfooterprop to support content below form cardsorganization_trial_workspace_warningtocommon.json3. Code Quality
CreateANewOrganizationForm.tsx(regex escaping, removed unnecessary try-catch)turbo/no-undeclared-env-varswarnings1. Environment Variable Naming Inconsistency 🚨
The diff shows TWO different environment variable names:
STRIPE_ORG_TRIAL_DAYSused in OrganizationPaymentService.ts and payments.tsORGANIZATION_TRIAL_DAYSdeclared in turbo.json (line 347)This needs to be fixed before merging! The code will not work correctly with mismatched env var names.
2. Shared Component Change
Modified
WizardLayoutto add optionalfooterprop. This is a shared component but the change is opt-in (only used whenfooterprop is provided). Please verify this doesn't break other wizards.3. Two Implementation Paths
Trial days logic is implemented in both:
OrganizationPaymentService.ts(lines 281-290)payments.ts(lines 174-177, 205)Please verify both implementations are necessary and correct for different flows.
How should this be tested?
Environment Variables:
Test Steps:
/settings/organizations/newExpected Behavior:
STRIPE_ORG_TRIAL_DAYSis set and > 0: Stripe checkout should includetrial_period_daysSTRIPE_ORG_TRIAL_DAYSis not set or ≤ 0: No trial period should be addedMandatory Tasks (DO NOT REMOVE)
STRIPE_ORG_TRIAL_DAYSvsORGANIZATION_TRIAL_DAYS)Checklist