feat: per-workspace pricing, onboarding, and billing overhaul
Pricing
- Bill per workspace ($12/mo or $120/yr each); Stripe quantity tracks the
workspace count and syncs on workspace create/delete.
- 2,500 AI credits per workspace, pooled at the account level; monthly reset
on the billing anniversary, annual granted upfront (no rollover).
- One social account per network per workspace; remove all count-based limits
(workspace/social/member) and the legacy plan tiers (single Workspace plan).
Onboarding (cloud only: SELF_HOSTED=false + PostHog)
- Replace the /subscribe plan picker with /onboarding persona selection
(Creator/Freelancer/Startup/Agency/Small business/Other), saved on the user
(users.persona) and mirrored to PostHog, then Stripe Checkout on the monthly
price. 8-day trial so Stripe displays 7.
Billing screen
- Remove the Change Plan dialog (dead with a single plan); add an annual-upgrade
banner for monthly subscribers (swapToYearly).
- Current-plan card shows the workspace count instead of the plan name.
System AI
- Brand analyzer / workspace autofill is always allowed and never debits credits
(system feature, not the user's usage).
Self-hosted (SELF_HOSTED=true) bypasses all billing, credit, limit, network,
and onboarding logic.
2026-06-21 23:40:03 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\App;
|
|
|
|
|
|
|
|
|
|
use App\Actions\Billing\StartSubscriptionCheckout;
|
|
|
|
|
use App\Enums\Plan\Slug;
|
2026-06-22 15:31:44 +00:00
|
|
|
use App\Enums\SocialAccount\Platform as SocialPlatform;
|
2026-06-25 23:49:04 +00:00
|
|
|
use App\Enums\User\Goal;
|
feat: per-workspace pricing, onboarding, and billing overhaul
Pricing
- Bill per workspace ($12/mo or $120/yr each); Stripe quantity tracks the
workspace count and syncs on workspace create/delete.
- 2,500 AI credits per workspace, pooled at the account level; monthly reset
on the billing anniversary, annual granted upfront (no rollover).
- One social account per network per workspace; remove all count-based limits
(workspace/social/member) and the legacy plan tiers (single Workspace plan).
Onboarding (cloud only: SELF_HOSTED=false + PostHog)
- Replace the /subscribe plan picker with /onboarding persona selection
(Creator/Freelancer/Startup/Agency/Small business/Other), saved on the user
(users.persona) and mirrored to PostHog, then Stripe Checkout on the monthly
price. 8-day trial so Stripe displays 7.
Billing screen
- Remove the Change Plan dialog (dead with a single plan); add an annual-upgrade
banner for monthly subscribers (swapToYearly).
- Current-plan card shows the workspace count instead of the plan name.
System AI
- Brand analyzer / workspace autofill is always allowed and never debits credits
(system feature, not the user's usage).
Self-hosted (SELF_HOSTED=true) bypasses all billing, credit, limit, network,
and onboarding logic.
2026-06-21 23:40:03 +00:00
|
|
|
use App\Enums\User\Persona;
|
2026-07-18 19:07:11 +00:00
|
|
|
use App\Enums\User\ReferralSource;
|
2026-06-25 23:49:04 +00:00
|
|
|
use App\Http\Requests\App\Onboarding\StoreOnboardingGoalsRequest;
|
2026-07-18 19:07:11 +00:00
|
|
|
use App\Http\Requests\App\Onboarding\StoreOnboardingReferralSourceRequest;
|
feat: per-workspace pricing, onboarding, and billing overhaul
Pricing
- Bill per workspace ($12/mo or $120/yr each); Stripe quantity tracks the
workspace count and syncs on workspace create/delete.
- 2,500 AI credits per workspace, pooled at the account level; monthly reset
on the billing anniversary, annual granted upfront (no rollover).
- One social account per network per workspace; remove all count-based limits
(workspace/social/member) and the legacy plan tiers (single Workspace plan).
Onboarding (cloud only: SELF_HOSTED=false + PostHog)
- Replace the /subscribe plan picker with /onboarding persona selection
(Creator/Freelancer/Startup/Agency/Small business/Other), saved on the user
(users.persona) and mirrored to PostHog, then Stripe Checkout on the monthly
price. 8-day trial so Stripe displays 7.
Billing screen
- Remove the Change Plan dialog (dead with a single plan); add an annual-upgrade
banner for monthly subscribers (swapToYearly).
- Current-plan card shows the workspace count instead of the plan name.
System AI
- Brand analyzer / workspace autofill is always allowed and never debits credits
(system feature, not the user's usage).
Self-hosted (SELF_HOSTED=true) bypasses all billing, credit, limit, network,
and onboarding logic.
2026-06-21 23:40:03 +00:00
|
|
|
use App\Http\Requests\App\Onboarding\StoreOnboardingRequest;
|
2026-06-22 15:31:44 +00:00
|
|
|
use App\Http\Resources\App\SocialAccountResource;
|
feat: per-workspace pricing, onboarding, and billing overhaul
Pricing
- Bill per workspace ($12/mo or $120/yr each); Stripe quantity tracks the
workspace count and syncs on workspace create/delete.
- 2,500 AI credits per workspace, pooled at the account level; monthly reset
on the billing anniversary, annual granted upfront (no rollover).
- One social account per network per workspace; remove all count-based limits
(workspace/social/member) and the legacy plan tiers (single Workspace plan).
Onboarding (cloud only: SELF_HOSTED=false + PostHog)
- Replace the /subscribe plan picker with /onboarding persona selection
(Creator/Freelancer/Startup/Agency/Small business/Other), saved on the user
(users.persona) and mirrored to PostHog, then Stripe Checkout on the monthly
price. 8-day trial so Stripe displays 7.
Billing screen
- Remove the Change Plan dialog (dead with a single plan); add an annual-upgrade
banner for monthly subscribers (swapToYearly).
- Current-plan card shows the workspace count instead of the plan name.
System AI
- Brand analyzer / workspace autofill is always allowed and never debits credits
(system feature, not the user's usage).
Self-hosted (SELF_HOSTED=true) bypasses all billing, credit, limit, network,
and onboarding logic.
2026-06-21 23:40:03 +00:00
|
|
|
use App\Models\Account;
|
|
|
|
|
use App\Models\Plan;
|
|
|
|
|
use App\Services\PostHogService;
|
|
|
|
|
use Illuminate\Http\RedirectResponse;
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
use Inertia\Inertia;
|
|
|
|
|
use Inertia\Response;
|
|
|
|
|
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
|
|
|
|
|
|
|
|
|
|
class OnboardingController extends Controller
|
|
|
|
|
{
|
|
|
|
|
public function index(Request $request): Response|RedirectResponse
|
|
|
|
|
{
|
|
|
|
|
if (config('trypost.self_hosted')) {
|
|
|
|
|
return redirect()->route('app.calendar');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$user = $request->user();
|
|
|
|
|
|
|
|
|
|
if ($user->account?->subscribed(Account::SUBSCRIPTION_NAME)) {
|
|
|
|
|
return redirect()->route('app.calendar');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Inertia::render('onboarding/Index', [
|
2026-06-22 00:28:47 +00:00
|
|
|
'personas' => array_map(fn (Persona $persona): string => $persona->value, Persona::cases()),
|
feat: per-workspace pricing, onboarding, and billing overhaul
Pricing
- Bill per workspace ($12/mo or $120/yr each); Stripe quantity tracks the
workspace count and syncs on workspace create/delete.
- 2,500 AI credits per workspace, pooled at the account level; monthly reset
on the billing anniversary, annual granted upfront (no rollover).
- One social account per network per workspace; remove all count-based limits
(workspace/social/member) and the legacy plan tiers (single Workspace plan).
Onboarding (cloud only: SELF_HOSTED=false + PostHog)
- Replace the /subscribe plan picker with /onboarding persona selection
(Creator/Freelancer/Startup/Agency/Small business/Other), saved on the user
(users.persona) and mirrored to PostHog, then Stripe Checkout on the monthly
price. 8-day trial so Stripe displays 7.
Billing screen
- Remove the Change Plan dialog (dead with a single plan); add an annual-upgrade
banner for monthly subscribers (swapToYearly).
- Current-plan card shows the workspace count instead of the plan name.
System AI
- Brand analyzer / workspace autofill is always allowed and never debits credits
(system feature, not the user's usage).
Self-hosted (SELF_HOSTED=true) bypasses all billing, credit, limit, network,
and onboarding logic.
2026-06-21 23:40:03 +00:00
|
|
|
'selected' => $user->persona?->value,
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-22 15:31:44 +00:00
|
|
|
public function store(StoreOnboardingRequest $request, PostHogService $postHog): RedirectResponse
|
|
|
|
|
{
|
feat: per-workspace pricing, onboarding, and billing overhaul
Pricing
- Bill per workspace ($12/mo or $120/yr each); Stripe quantity tracks the
workspace count and syncs on workspace create/delete.
- 2,500 AI credits per workspace, pooled at the account level; monthly reset
on the billing anniversary, annual granted upfront (no rollover).
- One social account per network per workspace; remove all count-based limits
(workspace/social/member) and the legacy plan tiers (single Workspace plan).
Onboarding (cloud only: SELF_HOSTED=false + PostHog)
- Replace the /subscribe plan picker with /onboarding persona selection
(Creator/Freelancer/Startup/Agency/Small business/Other), saved on the user
(users.persona) and mirrored to PostHog, then Stripe Checkout on the monthly
price. 8-day trial so Stripe displays 7.
Billing screen
- Remove the Change Plan dialog (dead with a single plan); add an annual-upgrade
banner for monthly subscribers (swapToYearly).
- Current-plan card shows the workspace count instead of the plan name.
System AI
- Brand analyzer / workspace autofill is always allowed and never debits credits
(system feature, not the user's usage).
Self-hosted (SELF_HOSTED=true) bypasses all billing, credit, limit, network,
and onboarding logic.
2026-06-21 23:40:03 +00:00
|
|
|
if (config('trypost.self_hosted')) {
|
|
|
|
|
return redirect()->route('app.calendar');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$user = $request->user();
|
2026-06-22 12:26:31 +00:00
|
|
|
|
2026-06-22 15:31:44 +00:00
|
|
|
if ($user->account?->subscribed(Account::SUBSCRIPTION_NAME)) {
|
2026-06-22 12:26:31 +00:00
|
|
|
return redirect()->route('app.calendar');
|
|
|
|
|
}
|
|
|
|
|
|
MCP: workspace settings, viewer read access, and token access (#241)
* Add workspace MCP settings and token access controls.
Ship MCP settings UI, OAuth revoke/list helpers, Passport deploy wiring,
and workspace.token:mcp gating so assistants can connect without pulling
in welcome/onboarding from the parent epic.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Type MCP client config shapes instead of string checks.
Encode http/config-root on each advanced client and tighten primary
client ids so snippet generation does not branch on magic strings.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Polish MCP settings follow-ups from review.
Translate Ukrainian MCP copy, deep-link ChatGPT into connector
creation, drop an unused asset and revoke arg, and assert PATs are
rejected on the MCP endpoint.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Harden MCP connected clients, revoke scope, and OAuth consent.
List recoverable sessions with live refresh tokens, revoke only PATs,
throttle registration alone, and block viewers from authorizing MCP.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Simplify MCP OAuth route throttling to a single middleware group.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Allow workspace viewers read-only MCP access with web policy writes.
Mirror the web app: MCP connects on view + OAuth mcp:use, write tools
enforce createPost/update/delete/manageAccounts/manageTeam, and demotion
to Viewer keeps grants. Cover role denials, consent, and disconnect.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Harden MCP tool authz with shared workspace helpers.
Route ApiKey tools through AuthorizesMcpTool, fail closed on null user
or policy argument, and resolve the current workspace before mutating.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Drop redundant string casts on validated request data.
Enum::from and validated() fields are already strings, so the casts
add noise without changing behavior.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Show only the current user's MCP connections in settings.
Match API keys privacy: list and disconnect your own OAuth clients,
not teammates' across the account.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Cover LoadWorkspaceFromToken gaps and harden AuthorizesMcpTool tests.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Drop redundant is_string guard before UpdatePostTool find.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Refactor AppSidebar to always show MCP link and simplify route middleware definition in ai.php. The MCP link is now consistently displayed regardless of the current workspace state, and the route middleware syntax has been streamlined.
* Refresh MCP connected clients with Inertia usePoll.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Bump laravel/mcp to 0.9.1 and add the TryPost server icon.
Requires laravel/boost 2.5 for the Icon attribute; expose images/trypost/icon.png on TryPostServer.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Drop no-op ReflectionClass import in TryPostServerTest.
Co-authored-by: Cursor <cursoragent@cursor.com>
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-06 12:54:51 +00:00
|
|
|
$persona = $request->validated('persona');
|
feat: per-workspace pricing, onboarding, and billing overhaul
Pricing
- Bill per workspace ($12/mo or $120/yr each); Stripe quantity tracks the
workspace count and syncs on workspace create/delete.
- 2,500 AI credits per workspace, pooled at the account level; monthly reset
on the billing anniversary, annual granted upfront (no rollover).
- One social account per network per workspace; remove all count-based limits
(workspace/social/member) and the legacy plan tiers (single Workspace plan).
Onboarding (cloud only: SELF_HOSTED=false + PostHog)
- Replace the /subscribe plan picker with /onboarding persona selection
(Creator/Freelancer/Startup/Agency/Small business/Other), saved on the user
(users.persona) and mirrored to PostHog, then Stripe Checkout on the monthly
price. 8-day trial so Stripe displays 7.
Billing screen
- Remove the Change Plan dialog (dead with a single plan); add an annual-upgrade
banner for monthly subscribers (swapToYearly).
- Current-plan card shows the workspace count instead of the plan name.
System AI
- Brand analyzer / workspace autofill is always allowed and never debits credits
(system feature, not the user's usage).
Self-hosted (SELF_HOSTED=true) bypasses all billing, credit, limit, network,
and onboarding logic.
2026-06-21 23:40:03 +00:00
|
|
|
|
|
|
|
|
$user->update(['persona' => $persona]);
|
|
|
|
|
|
|
|
|
|
$postHog->identify($user->id, [
|
|
|
|
|
'persona' => $persona,
|
|
|
|
|
]);
|
|
|
|
|
|
2026-06-25 23:49:04 +00:00
|
|
|
return redirect()->route('app.onboarding.goals');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function goals(Request $request): Response|RedirectResponse
|
|
|
|
|
{
|
|
|
|
|
if (config('trypost.self_hosted')) {
|
|
|
|
|
return redirect()->route('app.calendar');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$user = $request->user();
|
|
|
|
|
|
|
|
|
|
if ($user->account?->subscribed(Account::SUBSCRIPTION_NAME)) {
|
|
|
|
|
return redirect()->route('app.calendar');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! $user->persona) {
|
|
|
|
|
return redirect()->route('app.onboarding');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Inertia::render('onboarding/Goals', [
|
|
|
|
|
'goals' => array_map(fn (Goal $goal): string => $goal->value, Goal::cases()),
|
|
|
|
|
'selected' => $user->goals ?? [],
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function storeGoals(StoreOnboardingGoalsRequest $request, PostHogService $postHog): RedirectResponse
|
|
|
|
|
{
|
|
|
|
|
if (config('trypost.self_hosted')) {
|
|
|
|
|
return redirect()->route('app.calendar');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$user = $request->user();
|
|
|
|
|
|
|
|
|
|
if ($user->account?->subscribed(Account::SUBSCRIPTION_NAME)) {
|
|
|
|
|
return redirect()->route('app.calendar');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! $user->persona) {
|
|
|
|
|
return redirect()->route('app.onboarding');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$goals = array_values($request->validated('goals'));
|
|
|
|
|
|
|
|
|
|
$user->update(['goals' => $goals]);
|
|
|
|
|
|
2026-06-26 00:06:27 +00:00
|
|
|
$postHog->identify($user->id, [
|
|
|
|
|
'goals' => $goals,
|
|
|
|
|
]);
|
2026-06-25 23:49:04 +00:00
|
|
|
|
2026-07-18 19:07:11 +00:00
|
|
|
return redirect()->route('app.onboarding.referral-source');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function referralSource(Request $request): Response|RedirectResponse
|
|
|
|
|
{
|
|
|
|
|
if (config('trypost.self_hosted')) {
|
|
|
|
|
return redirect()->route('app.calendar');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$user = $request->user();
|
|
|
|
|
|
|
|
|
|
if ($user->account?->subscribed(Account::SUBSCRIPTION_NAME)) {
|
|
|
|
|
return redirect()->route('app.calendar');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! $user->persona) {
|
|
|
|
|
return redirect()->route('app.onboarding');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! $user->goals) {
|
|
|
|
|
return redirect()->route('app.onboarding.goals');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Inertia::render('onboarding/ReferralSource', [
|
|
|
|
|
'sources' => array_map(fn (ReferralSource $source): string => $source->value, ReferralSource::cases()),
|
|
|
|
|
'selected' => $user->referral_source?->value,
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function storeReferralSource(StoreOnboardingReferralSourceRequest $request, PostHogService $postHog): RedirectResponse
|
|
|
|
|
{
|
|
|
|
|
if (config('trypost.self_hosted')) {
|
|
|
|
|
return redirect()->route('app.calendar');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$user = $request->user();
|
|
|
|
|
|
|
|
|
|
if ($user->account?->subscribed(Account::SUBSCRIPTION_NAME)) {
|
|
|
|
|
return redirect()->route('app.calendar');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! $user->persona) {
|
|
|
|
|
return redirect()->route('app.onboarding');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! $user->goals) {
|
|
|
|
|
return redirect()->route('app.onboarding.goals');
|
|
|
|
|
}
|
|
|
|
|
|
MCP: workspace settings, viewer read access, and token access (#241)
* Add workspace MCP settings and token access controls.
Ship MCP settings UI, OAuth revoke/list helpers, Passport deploy wiring,
and workspace.token:mcp gating so assistants can connect without pulling
in welcome/onboarding from the parent epic.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Type MCP client config shapes instead of string checks.
Encode http/config-root on each advanced client and tighten primary
client ids so snippet generation does not branch on magic strings.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Polish MCP settings follow-ups from review.
Translate Ukrainian MCP copy, deep-link ChatGPT into connector
creation, drop an unused asset and revoke arg, and assert PATs are
rejected on the MCP endpoint.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Harden MCP connected clients, revoke scope, and OAuth consent.
List recoverable sessions with live refresh tokens, revoke only PATs,
throttle registration alone, and block viewers from authorizing MCP.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Simplify MCP OAuth route throttling to a single middleware group.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Allow workspace viewers read-only MCP access with web policy writes.
Mirror the web app: MCP connects on view + OAuth mcp:use, write tools
enforce createPost/update/delete/manageAccounts/manageTeam, and demotion
to Viewer keeps grants. Cover role denials, consent, and disconnect.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Harden MCP tool authz with shared workspace helpers.
Route ApiKey tools through AuthorizesMcpTool, fail closed on null user
or policy argument, and resolve the current workspace before mutating.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Drop redundant string casts on validated request data.
Enum::from and validated() fields are already strings, so the casts
add noise without changing behavior.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Show only the current user's MCP connections in settings.
Match API keys privacy: list and disconnect your own OAuth clients,
not teammates' across the account.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Cover LoadWorkspaceFromToken gaps and harden AuthorizesMcpTool tests.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Drop redundant is_string guard before UpdatePostTool find.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Refactor AppSidebar to always show MCP link and simplify route middleware definition in ai.php. The MCP link is now consistently displayed regardless of the current workspace state, and the route middleware syntax has been streamlined.
* Refresh MCP connected clients with Inertia usePoll.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Bump laravel/mcp to 0.9.1 and add the TryPost server icon.
Requires laravel/boost 2.5 for the Icon attribute; expose images/trypost/icon.png on TryPostServer.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Drop no-op ReflectionClass import in TryPostServerTest.
Co-authored-by: Cursor <cursoragent@cursor.com>
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-06 12:54:51 +00:00
|
|
|
$referralSource = $request->validated('referral_source');
|
2026-07-18 19:07:11 +00:00
|
|
|
|
|
|
|
|
$user->update(['referral_source' => $referralSource]);
|
|
|
|
|
|
|
|
|
|
$postHog->identify($user->id, [
|
|
|
|
|
'referral_source' => $referralSource,
|
|
|
|
|
]);
|
|
|
|
|
|
2026-06-22 15:31:44 +00:00
|
|
|
return redirect()->route('app.onboarding.connect');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function connect(Request $request): Response|RedirectResponse
|
|
|
|
|
{
|
|
|
|
|
if (config('trypost.self_hosted')) {
|
|
|
|
|
return redirect()->route('app.calendar');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$user = $request->user();
|
|
|
|
|
|
|
|
|
|
if ($user->account?->subscribed(Account::SUBSCRIPTION_NAME)) {
|
|
|
|
|
return redirect()->route('app.calendar');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! $user->persona) {
|
|
|
|
|
return redirect()->route('app.onboarding');
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-25 23:49:04 +00:00
|
|
|
if (! $user->goals) {
|
|
|
|
|
return redirect()->route('app.onboarding.goals');
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-18 19:07:11 +00:00
|
|
|
if (! $user->referral_source) {
|
|
|
|
|
return redirect()->route('app.onboarding.referral-source');
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-22 15:31:44 +00:00
|
|
|
$workspace = $user->currentWorkspace;
|
|
|
|
|
|
|
|
|
|
if (! $workspace) {
|
|
|
|
|
return redirect()->route('app.workspaces.create');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$accounts = $workspace->socialAccounts()->orderBy('id')->get();
|
|
|
|
|
|
2026-06-25 00:23:27 +00:00
|
|
|
$platforms = collect(SocialPlatform::cases())
|
|
|
|
|
->filter(fn (SocialPlatform $platform): bool => $platform->isConnectable())
|
|
|
|
|
->map(fn (SocialPlatform $platform): array => [
|
|
|
|
|
'value' => $platform->value,
|
|
|
|
|
'label' => $platform->label(),
|
|
|
|
|
'color' => $platform->color(),
|
|
|
|
|
'network' => $platform->network(),
|
|
|
|
|
])->values();
|
2026-06-22 15:31:44 +00:00
|
|
|
|
2026-07-02 12:21:31 +00:00
|
|
|
$plan = Plan::where('slug', Slug::Workspace)->firstOrFail();
|
|
|
|
|
|
2026-06-22 15:31:44 +00:00
|
|
|
return Inertia::render('onboarding/Connect', [
|
|
|
|
|
'platforms' => $platforms,
|
|
|
|
|
'accounts' => SocialAccountResource::collection($accounts)->resolve(),
|
2026-07-02 12:21:31 +00:00
|
|
|
'plan' => [
|
|
|
|
|
'name' => $plan->name,
|
|
|
|
|
'interval' => 'monthly',
|
|
|
|
|
],
|
2026-06-22 15:31:44 +00:00
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function checkout(Request $request, StartSubscriptionCheckout $checkout): SymfonyResponse|RedirectResponse
|
|
|
|
|
{
|
|
|
|
|
if (config('trypost.self_hosted')) {
|
|
|
|
|
return redirect()->route('app.calendar');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$user = $request->user();
|
|
|
|
|
$account = $user->account;
|
|
|
|
|
|
|
|
|
|
if ($account?->subscribed(Account::SUBSCRIPTION_NAME)) {
|
|
|
|
|
return redirect()->route('app.calendar');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$workspace = $user->currentWorkspace;
|
|
|
|
|
|
|
|
|
|
if (! $workspace || ! $workspace->socialAccounts()->exists()) {
|
|
|
|
|
return redirect()->route('app.onboarding.connect')
|
|
|
|
|
->with('flash.banner', __('onboarding.connect.must_connect'))
|
|
|
|
|
->with('flash.bannerStyle', 'danger');
|
|
|
|
|
}
|
|
|
|
|
|
feat: per-workspace pricing, onboarding, and billing overhaul
Pricing
- Bill per workspace ($12/mo or $120/yr each); Stripe quantity tracks the
workspace count and syncs on workspace create/delete.
- 2,500 AI credits per workspace, pooled at the account level; monthly reset
on the billing anniversary, annual granted upfront (no rollover).
- One social account per network per workspace; remove all count-based limits
(workspace/social/member) and the legacy plan tiers (single Workspace plan).
Onboarding (cloud only: SELF_HOSTED=false + PostHog)
- Replace the /subscribe plan picker with /onboarding persona selection
(Creator/Freelancer/Startup/Agency/Small business/Other), saved on the user
(users.persona) and mirrored to PostHog, then Stripe Checkout on the monthly
price. 8-day trial so Stripe displays 7.
Billing screen
- Remove the Change Plan dialog (dead with a single plan); add an annual-upgrade
banner for monthly subscribers (swapToYearly).
- Current-plan card shows the workspace count instead of the plan name.
System AI
- Brand analyzer / workspace autofill is always allowed and never debits credits
(system feature, not the user's usage).
Self-hosted (SELF_HOSTED=true) bypasses all billing, credit, limit, network,
and onboarding logic.
2026-06-21 23:40:03 +00:00
|
|
|
$plan = Plan::where('slug', Slug::Workspace)->firstOrFail();
|
|
|
|
|
|
|
|
|
|
return $checkout->redirect(
|
|
|
|
|
$account,
|
|
|
|
|
(string) $plan->stripe_monthly_price_id,
|
2026-06-22 15:31:44 +00:00
|
|
|
route('app.onboarding.connect'),
|
feat: per-workspace pricing, onboarding, and billing overhaul
Pricing
- Bill per workspace ($12/mo or $120/yr each); Stripe quantity tracks the
workspace count and syncs on workspace create/delete.
- 2,500 AI credits per workspace, pooled at the account level; monthly reset
on the billing anniversary, annual granted upfront (no rollover).
- One social account per network per workspace; remove all count-based limits
(workspace/social/member) and the legacy plan tiers (single Workspace plan).
Onboarding (cloud only: SELF_HOSTED=false + PostHog)
- Replace the /subscribe plan picker with /onboarding persona selection
(Creator/Freelancer/Startup/Agency/Small business/Other), saved on the user
(users.persona) and mirrored to PostHog, then Stripe Checkout on the monthly
price. 8-day trial so Stripe displays 7.
Billing screen
- Remove the Change Plan dialog (dead with a single plan); add an annual-upgrade
banner for monthly subscribers (swapToYearly).
- Current-plan card shows the workspace count instead of the plan name.
System AI
- Brand analyzer / workspace autofill is always allowed and never debits credits
(system feature, not the user's usage).
Self-hosted (SELF_HOSTED=true) bypasses all billing, credit, limit, network,
and onboarding logic.
2026-06-21 23:40:03 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|