Skip to content

Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.

feat(onboarding): add goal step after persona

Paulo Castellanoafc4c7a80bc4
diff --git a/app/Enums/User/Goal.php b/app/Enums/User/Goal.php
new file mode 100644
index 000000000..2211a2c00
--- /dev/null
+++ b/app/Enums/User/Goal.php
@@ -0,0 +1,30 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Enums\User;
+
+enum Goal: string
+{
+ case SaveTime = 'save_time';
+ case AiContent = 'ai_content';
+ case PlanCalendar = 'plan_calendar';
+ case StayOnBrand = 'stay_on_brand';
+ case GrowAudience = 'grow_audience';
+ case DriveSales = 'drive_sales';
+ case ManageClients = 'manage_clients';
+ case TeamCollaboration = 'team_collaboration';
+ case AutomateApi = 'automate_api';
+ case TrackPerformance = 'track_performance';
+ case JustExploring = 'just_exploring';
+ case Other = 'other';
+
+ /**
+ * Selecting this goal means the user has no specific intent yet, so it is
+ * mutually exclusive with every other goal.
+ */
+ public function isExclusive(): bool
+ {
+ return $this === self::JustExploring;
+ }
+}
diff --git a/app/Http/Controllers/App/OnboardingController.php b/app/Http/Controllers/App/OnboardingController.php
index 1c488797b..1acb2c7e0 100644
--- a/app/Http/Controllers/App/OnboardingController.php
+++ b/app/Http/Controllers/App/OnboardingController.php
@@ -7,7 +7,9 @@ namespace App\Http\Controllers\App;
use App\Actions\Billing\StartSubscriptionCheckout;
use App\Enums\Plan\Slug;
use App\Enums\SocialAccount\Platform as SocialPlatform;
+use App\Enums\User\Goal;
use App\Enums\User\Persona;
+use App\Http\Requests\App\Onboarding\StoreOnboardingGoalsRequest;
use App\Http\Requests\App\Onboarding\StoreOnboardingRequest;
use App\Http\Resources\App\SocialAccountResource;
use App\Models\Account;
@@ -59,6 +61,53 @@ class OnboardingController extends Controller
'persona' => $persona,
]);
+ 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]);
+
+ $postHog->identify($user->id, $this->goalProperties($goals));
+
return redirect()->route('app.onboarding.connect');
}
@@ -78,6 +127,10 @@ class OnboardingController extends Controller
return redirect()->route('app.onboarding');
}
+ if (! $user->goals) {
+ return redirect()->route('app.onboarding.goals');
+ }
+
$workspace = $user->currentWorkspace;
if (! $workspace) {
@@ -130,4 +183,22 @@ class OnboardingController extends Controller
route('app.onboarding.connect'),
);
}
+
+ /**
+ * PostHog person properties for the selected goals: the full array plus a
+ * boolean per goal, so campaigns can be cross-tabbed against each intent.
+ *
+ * @param array<int, string> $goals
+ * @return array<string, mixed>
+ */
+ private function goalProperties(array $goals): array
+ {
+ $properties = ['onboarding_goals' => $goals];
+
+ foreach (Goal::cases() as $goal) {
+ $properties["goal_{$goal->value}"] = in_array($goal->value, $goals, true);
+ }
+
+ return $properties;
+ }
}
diff --git a/app/Http/Requests/App/Onboarding/StoreOnboardingGoalsRequest.php b/app/Http/Requests/App/Onboarding/StoreOnboardingGoalsRequest.php
new file mode 100644
index 000000000..fdda3bbf8
--- /dev/null
+++ b/app/Http/Requests/App/Onboarding/StoreOnboardingGoalsRequest.php
@@ -0,0 +1,40 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Http\Requests\App\Onboarding;
+
+use App\Enums\User\Goal;
+use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Foundation\Http\FormRequest;
+use Illuminate\Validation\Rule;
+
+class StoreOnboardingGoalsRequest extends FormRequest
+{
+ public function authorize(): bool
+ {
+ return true;
+ }
+
+ /**
+ * @return array<string, mixed>
+ */
+ public function rules(): array
+ {
+ return [
+ 'goals' => ['required', 'array', 'min:1'],
+ 'goals.*' => [Rule::enum(Goal::class)],
+ ];
+ }
+
+ public function withValidator(Validator $validator): void
+ {
+ $validator->after(function (Validator $validator): void {
+ $goals = (array) $this->input('goals', []);
+
+ if (in_array(Goal::JustExploring->value, $goals, true) && count($goals) > 1) {
+ $validator->errors()->add('goals', __('onboarding.goals_exclusive'));
+ }
+ });
+ }
+}
diff --git a/app/Models/User.php b/app/Models/User.php
index da109ae4a..d8b11ebea 100644
--- a/app/Models/User.php
+++ b/app/Models/User.php
@@ -44,6 +44,7 @@ class User extends Authenticatable implements MustVerifyEmail, OAuthenticatable
'utm_content',
'registration_ip',
'persona',
+ 'goals',
];
/**
@@ -78,6 +79,7 @@ class User extends Authenticatable implements MustVerifyEmail, OAuthenticatable
'password' => 'hashed',
'two_factor_confirmed_at' => 'datetime',
'persona' => Persona::class,
+ 'goals' => 'array',
];
}
diff --git a/database/migrations/2026_06_25_232554_add_goals_to_users_table.php b/database/migrations/2026_06_25_232554_add_goals_to_users_table.php
new file mode 100644
index 000000000..677aa592d
--- /dev/null
+++ b/database/migrations/2026_06_25_232554_add_goals_to_users_table.php
@@ -0,0 +1,28 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+ /**
+ * Run the migrations.
+ */
+ public function up(): void
+ {
+ Schema::table('users', function (Blueprint $table) {
+ $table->json('goals')->nullable()->after('persona');
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('users', function (Blueprint $table) {
+ $table->dropColumn('goals');
+ });
+ }
+};
diff --git a/lang/en/onboarding.php b/lang/en/onboarding.php
index c0808aae6..a56d1c12b 100644
--- a/lang/en/onboarding.php
+++ b/lang/en/onboarding.php
@@ -17,6 +17,23 @@ return [
'online_store' => 'Online store',
'other' => 'Other',
],
+ 'goals_title' => 'What\'s your goal with TryPost?',
+ 'goals_description' => 'Pick everything that fits and we\'ll set TryPost up for you.',
+ 'goals_exclusive' => 'If you\'re just exploring, leave the other goals unchecked.',
+ 'goals' => [
+ 'save_time' => 'Save time by posting everywhere at once',
+ 'ai_content' => 'Create posts faster with AI',
+ 'plan_calendar' => 'Plan my posts on a calendar',
+ 'stay_on_brand' => 'Keep every post on brand',
+ 'grow_audience' => 'Grow my audience and engagement',
+ 'drive_sales' => 'Get more traffic and sales',
+ 'manage_clients' => 'Manage several brands or clients',
+ 'team_collaboration' => 'Work with my team',
+ 'automate_api' => 'Automate posting with the API, MCP or code',
+ 'track_performance' => 'See how my posts perform',
+ 'just_exploring' => 'Just exploring for now',
+ 'other' => 'Something else',
+ ],
'connect' => [
'title' => 'Connect your first network',
'description' => 'Link at least one social account to start scheduling. You can add more anytime.',
diff --git a/lang/es/onboarding.php b/lang/es/onboarding.php
index cb5ff7ba0..74eac002f 100644
--- a/lang/es/onboarding.php
+++ b/lang/es/onboarding.php
@@ -17,6 +17,23 @@ return [
'online_store' => 'Tienda online',
'other' => 'Otro',
],
+ 'goals_title' => '¿Cuál es tu objetivo con TryPost?',
+ 'goals_description' => 'Marca todo lo que encaje y adaptamos TryPost a ti.',
+ 'goals_exclusive' => 'Si solo estás explorando, deja los demás objetivos sin marcar.',
+ 'goals' => [
+ 'save_time' => 'Ahorrar tiempo publicando en todas mis redes a la vez',
+ 'ai_content' => 'Crear publicaciones más rápido con IA',
+ 'plan_calendar' => 'Planificar mis publicaciones en un calendario',
+ 'stay_on_brand' => 'Mantener la coherencia de mi marca',
+ 'grow_audience' => 'Hacer crecer mi audiencia y engagement',
+ 'drive_sales' => 'Conseguir más tráfico y ventas',
+ 'manage_clients' => 'Gestionar varias marcas o clientes',
+ 'team_collaboration' => 'Trabajar con mi equipo',
+ 'automate_api' => 'Automatizar publicaciones con la API, MCP o código',
+ 'track_performance' => 'Ver cómo rinden mis publicaciones',
+ 'just_exploring' => 'Solo estoy explorando por ahora',
+ 'other' => 'Otra cosa',
+ ],
'connect' => [
'title' => 'Conecta tu primera red',
'description' => 'Vincula al menos una cuenta social para empezar a programar. Puedes añadir más cuando quieras.',
diff --git a/lang/pt-BR/onboarding.php b/lang/pt-BR/onboarding.php
index 350ecf800..49455f303 100644
--- a/lang/pt-BR/onboarding.php
+++ b/lang/pt-BR/onboarding.php
@@ -17,6 +17,23 @@ return [
'online_store' => 'Loja online',
'other' => 'Outro',
],
+ 'goals_title' => 'Qual o seu objetivo com o TryPost?',
+ 'goals_description' => 'Marque tudo que faz sentido e a gente ajusta o TryPost pra você.',
+ 'goals_exclusive' => 'Se você só está dando uma olhada, deixe os outros desmarcados.',
+ 'goals' => [
+ 'save_time' => 'Economizar tempo postando em todas as redes de uma vez',
+ 'ai_content' => 'Criar posts mais rápido com IA',
+ 'plan_calendar' => 'Planejar meus posts num calendário',
+ 'stay_on_brand' => 'Manter a consistência da minha marca',
+ 'grow_audience' => 'Crescer minha audiência e engajamento',
+ 'drive_sales' => 'Conseguir mais tráfego e vendas',
+ 'manage_clients' => 'Gerenciar várias marcas ou clientes',
+ 'team_collaboration' => 'Trabalhar com meu time',
+ 'automate_api' => 'Automatizar publicações com a API, MCP ou código',
+ 'track_performance' => 'Ver o desempenho dos meus posts',
+ 'just_exploring' => 'Só dando uma olhada por enquanto',
+ 'other' => 'Outra coisa',
+ ],
'connect' => [
'title' => 'Conecte sua primeira rede',
'description' => 'Vincule pelo menos uma conta social para começar a agendar. Você pode adicionar mais quando quiser.',
diff --git a/resources/js/pages/onboarding/Goals.vue b/resources/js/pages/onboarding/Goals.vue
new file mode 100644
index 000000000..a5e7db0d1
--- /dev/null
+++ b/resources/js/pages/onboarding/Goals.vue
@@ -0,0 +1,147 @@
+<script setup lang="ts">
+import { Head, useForm } from '@inertiajs/vue3';
+import {
+ IconArrowRight,
+ IconCalendar,
+ IconChartBar,
+ IconCheck,
+ IconClock,
+ IconCoin,
+ IconCompass,
+ IconDots,
+ IconPalette,
+ IconRobot,
+ IconSparkles,
+ IconTrendingUp,
+ IconUsers,
+ IconUsersGroup,
+} from '@tabler/icons-vue';
+import { trans } from 'laravel-vue-i18n';
+import type { FunctionalComponent } from 'vue';
+
+import { Button } from '@/components/ui/button';
+import { store } from '@/routes/app/onboarding/goals';
+
+const props = defineProps<{
+ goals: string[];
+ selected?: string[] | null;
+}>();
+
+const EXCLUSIVE_GOAL = 'just_exploring';
+
+const form = useForm<{ goals: string[] }>({ goals: props.selected ?? [] });
+
+const goalMeta: Record<string, { icon: FunctionalComponent; color: string }> = {
+ save_time: { icon: IconClock, color: 'text-amber-600' },
+ ai_content: { icon: IconSparkles, color: 'text-violet-700' },
+ plan_calendar: { icon: IconCalendar, color: 'text-blue-700' },
+ stay_on_brand: { icon: IconPalette, color: 'text-orange-600' },
+ grow_audience: { icon: IconTrendingUp, color: 'text-rose-600' },
+ drive_sales: { icon: IconCoin, color: 'text-emerald-600' },
+ manage_clients: { icon: IconUsersGroup, color: 'text-cyan-600' },
+ team_collaboration: { icon: IconUsers, color: 'text-fuchsia-600' },
+ automate_api: { icon: IconRobot, color: 'text-teal-600' },
+ track_performance: { icon: IconChartBar, color: 'text-indigo-600' },
+ just_exploring: { icon: IconCompass, color: 'text-sky-600' },
+ other: { icon: IconDots, color: 'text-foreground' },
+};
+
+const goalIcon = (value: string): FunctionalComponent => goalMeta[value]?.icon ?? IconDots;
+
+const goalColor = (value: string): string => goalMeta[value]?.color ?? 'text-foreground';
+
+const goalLabel = (value: string): string => trans(`onboarding.goals.${value}`);
+
+const isSelected = (value: string): boolean => form.goals.includes(value);
+
+const toggle = (value: string): void => {
+ if (value === EXCLUSIVE_GOAL) {
+ form.goals = isSelected(value) ? [] : [value];
+
+ return;
+ }
+
+ const withoutExclusive = form.goals.filter((goal) => goal !== EXCLUSIVE_GOAL);
+
+ form.goals = isSelected(value)
+ ? withoutExclusive.filter((goal) => goal !== value)
+ : [...withoutExclusive, value];
+};
+
+const submit = (): void => {
+ if (form.goals.length === 0 || form.processing) {
+ return;
+ }
+
+ form.post(store.url());
+};
+</script>
+
+<template>
+ <Head :title="$t('onboarding.goals_title')" />
+
+ <section class="relative min-h-screen overflow-hidden bg-background">
+ <div
+ class="pointer-events-none absolute inset-0 opacity-[0.06]"
+ style="background-image: radial-gradient(circle, #0a0a0a 1px, transparent 1px); background-size: 28px 28px;"
+ />
+ <div class="pointer-events-none absolute -top-20 right-0 size-[560px] rounded-full bg-violet-200/50 blur-3xl" />
+
+ <div class="relative mx-auto flex min-h-screen max-w-3xl flex-col justify-center px-6 py-12">
+ <div class="mx-auto mb-10 max-w-xl space-y-3 text-center">
+ <h1
+ class="text-balance text-3xl font-normal leading-[1.1] tracking-tight text-foreground sm:text-4xl"
+ style="font-family: var(--font-display);"
+ >
+ {{ $t('onboarding.goals_title') }}
+ </h1>
+ <p class="text-balance text-base text-muted-foreground">
+ {{ $t('onboarding.goals_description') }}
+ </p>
+ </div>
+
+ <div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
+ <button
+ v-for="goal in goals"
+ :key="goal"
+ type="button"
+ :class="[
+ 'relative flex cursor-pointer flex-col items-start gap-3 rounded-2xl border-2 border-foreground p-5 text-left shadow-2xs transition-shadow hover:shadow-md',
+ isSelected(goal) ? 'bg-violet-100' : 'bg-card',
+ ]"
+ @click="toggle(goal)"
+ >
+ <span class="inline-flex size-10 items-center justify-center rounded-2xl border-2 border-foreground bg-card shadow-2xs">
+ <component
+ :is="goalIcon(goal)"
+ :class="[goalColor(goal), 'size-5']"
+ stroke-width="2.25"
+ />
+ </span>
+ <span class="text-base font-bold tracking-tight text-foreground">
+ {{ goalLabel(goal) }}
+ </span>
+ <span
+ v-if="isSelected(goal)"
+ class="absolute right-4 top-4 inline-flex size-5 items-center justify-center rounded-full border-2 border-foreground bg-foreground"
+ >
+ <IconCheck class="size-3 text-background" stroke-width="3" />
+ </span>
+ </button>
+ </div>
+
+ <div class="mx-auto mt-10 flex w-full max-w-sm flex-col items-center gap-3">
+ <Button
+ type="button"
+ size="lg"
+ class="w-full rounded-full"
+ :disabled="form.goals.length === 0 || form.processing"
+ @click="submit"
+ >
+ {{ $t('onboarding.continue') }}
+ <IconArrowRight class="size-4" />
+ </Button>
+ </div>
+ </div>
+ </section>
+</template>
diff --git a/routes/app.php b/routes/app.php
index f503f8f44..9c64062e1 100644
--- a/routes/app.php
+++ b/routes/app.php
@@ -58,6 +58,8 @@ Route::middleware(['auth'])->group(function () {
Route::get('subscribe', [BillingController::class, 'subscribe'])->name('app.subscribe');
Route::get('onboarding', [OnboardingController::class, 'index'])->name('app.onboarding');
Route::post('onboarding', [OnboardingController::class, 'store'])->name('app.onboarding.store');
+ Route::get('onboarding/goals', [OnboardingController::class, 'goals'])->name('app.onboarding.goals');
+ Route::post('onboarding/goals', [OnboardingController::class, 'storeGoals'])->name('app.onboarding.goals.store');
Route::get('onboarding/connect', [OnboardingController::class, 'connect'])->name('app.onboarding.connect');
Route::post('onboarding/connect', [OnboardingController::class, 'checkout'])->name('app.onboarding.checkout');
Route::get('billing/processing', [BillingController::class, 'processing'])->name('app.billing.processing');
diff --git a/tests/Feature/Onboarding/OnboardingControllerTest.php b/tests/Feature/Onboarding/OnboardingControllerTest.php
index aac0c9bd9..de911dd47 100644
--- a/tests/Feature/Onboarding/OnboardingControllerTest.php
+++ b/tests/Feature/Onboarding/OnboardingControllerTest.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
use App\Actions\Billing\StartSubscriptionCheckout;
use App\Enums\Plan\Slug;
use App\Enums\SocialAccount\Platform;
+use App\Enums\User\Goal;
use App\Enums\User\Persona;
use App\Jobs\PostHog\SendEvent;
use App\Models\Account;
@@ -96,7 +97,7 @@ test('onboarding store does nothing in self-hosted mode', function () {
expect($this->user->fresh()->persona)->toBeNull();
});
-test('onboarding store saves the persona, mirrors to PostHog and advances to the connect step', function () {
+test('onboarding store saves the persona, mirrors to PostHog and advances to the goals step', function () {
config(['services.posthog.enabled' => true, 'services.posthog.api_key' => 'phc_test']);
Bus::fake();
@@ -104,7 +105,7 @@ test('onboarding store saves the persona, mirrors to PostHog and advances to the
'persona' => Persona::Agency->value,
]);
- $response->assertRedirect(route('app.onboarding.connect'));
+ $response->assertRedirect(route('app.onboarding.goals'));
expect($this->user->fresh()->persona)->toBe(Persona::Agency);
Bus::assertDispatched(SendEvent::class);
@@ -121,12 +122,121 @@ test('onboarding store redirects an already-subscribed account to the calendar',
expect($this->user->fresh()->persona)->toBeNull();
});
-test('connect renders the network grid for an unsubscribed account that picked a persona', function () {
+test('goals renders the goal selection for an account that picked a persona', function () {
+ $this->user->update(['persona' => Persona::Agency->value]);
+
+ $response = $this->actingAs($this->user->fresh())->get(route('app.onboarding.goals'));
+
+ $response->assertOk();
+ $response->assertInertia(fn ($page) => $page
+ ->component('onboarding/Goals')
+ ->has('goals', count(Goal::cases()))
+ );
+});
+
+test('goals redirects to the persona step when no persona was chosen', function () {
+ $response = $this->actingAs($this->user)->get(route('app.onboarding.goals'));
+
+ $response->assertRedirect(route('app.onboarding'));
+});
+
+test('goals redirects to calendar in self-hosted mode', function () {
+ config(['trypost.self_hosted' => true]);
+
+ $response = $this->actingAs($this->user)->get(route('app.onboarding.goals'));
+
+ $response->assertRedirect(route('app.calendar'));
+});
+
+test('goals redirects to calendar when already subscribed', function () {
+ subscribeOnboardingAccount($this->user->account);
+
+ $response = $this->actingAs($this->user->fresh())->get(route('app.onboarding.goals'));
+
+ $response->assertRedirect(route('app.calendar'));
+});
+
+test('goals store requires at least one goal', function () {
+ $this->user->update(['persona' => Persona::Agency->value]);
+
+ $response = $this->actingAs($this->user->fresh())->post(route('app.onboarding.goals.store'), ['goals' => []]);
+
+ $response->assertSessionHasErrors('goals');
+ expect($this->user->fresh()->goals)->toBeNull();
+});
+
+test('goals store rejects an invalid goal', function () {
+ $this->user->update(['persona' => Persona::Agency->value]);
+
+ $response = $this->actingAs($this->user->fresh())->post(route('app.onboarding.goals.store'), [
+ 'goals' => ['not-a-goal'],
+ ]);
+
+ $response->assertSessionHasErrors('goals.0');
+});
+
+test('goals store rejects just exploring combined with other goals', function () {
+ $this->user->update(['persona' => Persona::Agency->value]);
+
+ $response = $this->actingAs($this->user->fresh())->post(route('app.onboarding.goals.store'), [
+ 'goals' => [Goal::JustExploring->value, Goal::SaveTime->value],
+ ]);
+
+ $response->assertSessionHasErrors('goals');
+});
+
+test('goals store saves the goals, mirrors to PostHog and advances to the connect step', function () {
+ config(['services.posthog.enabled' => true, 'services.posthog.api_key' => 'phc_test']);
+ Bus::fake();
+
+ $this->user->update(['persona' => Persona::Agency->value]);
+
+ $response = $this->actingAs($this->user->fresh())->post(route('app.onboarding.goals.store'), [
+ 'goals' => [Goal::SaveTime->value, Goal::AiContent->value],
+ ]);
+
+ $response->assertRedirect(route('app.onboarding.connect'));
+ expect($this->user->fresh()->goals)->toBe([Goal::SaveTime->value, Goal::AiContent->value]);
+
+ Bus::assertDispatched(SendEvent::class);
+});
+
+test('goals store redirects to the persona step when no persona was chosen', function () {
+ $response = $this->actingAs($this->user)->post(route('app.onboarding.goals.store'), [
+ 'goals' => [Goal::SaveTime->value],
+ ]);
+
+ $response->assertRedirect(route('app.onboarding'));
+ expect($this->user->fresh()->goals)->toBeNull();
+});
+
+test('goals store does nothing in self-hosted mode', function () {
+ config(['trypost.self_hosted' => true]);
+ $this->user->update(['persona' => Persona::Agency->value]);
+
+ $response = $this->actingAs($this->user->fresh())->post(route('app.onboarding.goals.store'), [
+ 'goals' => [Goal::SaveTime->value],
+ ]);
+
+ $response->assertRedirect(route('app.calendar'));
+ expect($this->user->fresh()->goals)->toBeNull();
+});
+
+test('connect redirects to the goals step when a persona was chosen but no goals', function () {
$this->user->update(['persona' => Persona::Agency->value]);
onboardingWorkspace($this->user);
$response = $this->actingAs($this->user->fresh())->get(route('app.onboarding.connect'));
+ $response->assertRedirect(route('app.onboarding.goals'));
+});
+
+test('connect renders the network grid for an unsubscribed account that picked a persona', function () {
+ $this->user->update(['persona' => Persona::Agency->value, 'goals' => [Goal::SaveTime->value]]);
+ onboardingWorkspace($this->user);
+
+ $response = $this->actingAs($this->user->fresh())->get(route('app.onboarding.connect'));
+
$response->assertOk();
$response->assertInertia(fn ($page) => $page
->component('onboarding/Connect')
@@ -137,7 +247,7 @@ test('connect renders the network grid for an unsubscribed account that picked a
});
test('connect offers a single linkedin card and no standalone linkedin page card', function () {
- $this->user->update(['persona' => Persona::Agency->value]);
+ $this->user->update(['persona' => Persona::Agency->value, 'goals' => [Goal::SaveTime->value]]);
onboardingWorkspace($this->user);
$response = $this->actingAs($this->user->fresh())->get(route('app.onboarding.connect'));
@@ -152,7 +262,7 @@ test('connect offers a single linkedin card and no standalone linkedin page card
});
test('connect lists the workspace social accounts already connected', function () {
- $this->user->update(['persona' => Persona::Agency->value]);
+ $this->user->update(['persona' => Persona::Agency->value, 'goals' => [Goal::SaveTime->value]]);
$workspace = onboardingWorkspace($this->user);
SocialAccount::factory()->create(['workspace_id' => $workspace->id]);
@@ -190,7 +300,7 @@ test('connect redirects to calendar when already subscribed', function () {
});
test('checkout blocks and redirects back when no network is connected', function () {
- $this->user->update(['persona' => Persona::Agency->value]);
+ $this->user->update(['persona' => Persona::Agency->value, 'goals' => [Goal::SaveTime->value]]);
onboardingWorkspace($this->user);
$this->mock(StartSubscriptionCheckout::class)
@@ -203,7 +313,7 @@ test('checkout blocks and redirects back when no network is connected', function
});
test('checkout starts monthly checkout once at least one network is connected', function () {
- $this->user->update(['persona' => Persona::Agency->value]);
+ $this->user->update(['persona' => Persona::Agency->value, 'goals' => [Goal::SaveTime->value]]);
$workspace = onboardingWorkspace($this->user);
SocialAccount::factory()->create(['workspace_id' => $workspace->id]);