* Wire onboarding activation into Account, observers, and shared Inertia data Add onboarding casts/hasFinishedOnboarding, AccessToken ObservedBy, Platform::connectableOptions, Post/SocialAccount onboarding broadcast hooks, and lazy onboardingResidual share + SharedData types. * Register onboarding routes and post-checkout activation redirects. Wire billing processing and the sidebar checklist so owners land on activation after subscribe, with locale sidebar/uk onboarding strings. * Align MCP grant usability with onboarding activation checks Unbound MCP tokens fall back to the user's current workspace and require createPost so viewer/unscoped grants neither unlock the checklist nor broadcast onboarding status. * Require bound MCP workspace for onboarding activation. Drop current-workspace fallback from usable MCP grants so checklist detection and broadcasts match Passport token scoping; viewers still cannot unlock the MCP step. Co-authored-by: Cursor <cursoragent@cursor.com> * Harden onboarding review findings and tighten locale strings. Fix Welcome/Persona/TrackPost suites broken by the activation route reuse and PostObserver analytics side effects, restore Echo poll fallbacks, reject unbound MCP grants in tests, and drop unused onboarding.mcp keys. Co-authored-by: Cursor <cursoragent@cursor.com> * Remove unused sidebar and MCP authorization locale keys. Drop dead sidebar menu/theme strings (including the overwritten workspace label and api_keys nav entry) and unused MCP authorize app_title/approving copy across all locales. Co-authored-by: Cursor <cursoragent@cursor.com> * Fix SetLocale crashing on Passport Symfony OAuth responses. OAuth errors return a raw Symfony Response without withCookie(); attach the default locale cookie via headers so authorize no longer 500s. Co-authored-by: Cursor <cursoragent@cursor.com> * Prompt OAuth guests to log in before rejecting unknown clients. MCP Inspector often reuses a stale client_id; validateAuthorizationRequest was returning invalid_client JSON before the login redirect. Guests now hit /login first, then client validation runs after authentication. Co-authored-by: Cursor <cursoragent@cursor.com> * Render Inertia OAuth authorize errors for browser logins. After login, Inertia follows the intended authorize URL; raw invalid_client JSON broke that visit. HTML/Inertia requests now get mcp/AuthorizeError while API JSON clients still receive the OAuth error payload. Co-authored-by: Cursor <cursoragent@cursor.com> * Detect Inertia OAuth error pages via Request::inertia(). Use the framework helper so post-login authorize failures keep returning an Inertia page instead of raw OAuth JSON. Co-authored-by: Cursor <cursoragent@cursor.com> * Simplify OAuth authorize error page detection to expectsJson. Drop the X-Inertia header sniff; browser and Inertia visits already do not expectsJson, while API clients still receive the OAuth JSON payload. Co-authored-by: Cursor <cursoragent@cursor.com> * Share MCP authorize layout and drop the error close button. Keep authorize and authorize-error on the same centered card shell instead of the auth split layout. Co-authored-by: Cursor <cursoragent@cursor.com> * Simplify onboarding activation for reviewability and safety. Use an exists-based MCP check, keep GETs read-only, move sync into syncAndNotify, clear MCP skips on connect, restrict complete to owners, and share Echo/poll via one composable. Co-authored-by: Cursor <cursoragent@cursor.com> * Move MCP OAuth authorize UX out of the onboarding PR. Keep the activation checklist focused; OAuth guest/error-page work now lives on fix/mcp-oauth-authorize-ux. Co-authored-by: Cursor <cursoragent@cursor.com> * Fix corrupted French MCP locale after OAuth key cleanup. Co-authored-by: Cursor <cursoragent@cursor.com> * Restore MCP OAuth authorize UX onto the onboarding branch. Keep authorize error page, guest login-before-client validation, and SetLocale Symfony cookie fix in #250. Co-authored-by: Cursor <cursoragent@cursor.com> * Fix OAuth prompt=none redirects and harden onboarding tests. Keep login_required/consent_required as redirects instead of Inertia, add regression coverage for owner-only activation, require invite email confirmation, and align MCP connected apps with the sessions list UI. Co-authored-by: Cursor <cursoragent@cursor.com> * Simplify onboarding guards and dedupe viewed analytics. Introduce isOnboardingOpen / belongsToAccount helpers, collapse duplicated sync/dispatch paths, and capture onboarding.viewed once per account. Co-authored-by: Cursor <cursoragent@cursor.com> * Simplify onboarding event, observers, and status helpers. Tighten Account onboarding predicates, drop nullable broadcast/dispatch APIs, and collapse repeated observer/controller guards. Co-authored-by: Cursor <cursoragent@cursor.com> * Treat in-app users as always having an account. Add resolveAccount(), tighten belongsToAccount to string ids, and fold guest residual handling into ResolveOnboardingStatus. Co-authored-by: Cursor <cursoragent@cursor.com> * Rename onboarding residual share test to progress. Co-authored-by: Cursor <cursoragent@cursor.com> * Simplify onboarding status and rename residual to progress. Use accountOrFail, extract MCP onboarding scope, auto-leave the ready screen, and send non-onboarding checkout back to accounts. Co-authored-by: Cursor <cursoragent@cursor.com> * Extract HasAccount and prefer data_get in onboarding flows. Move account helpers off User, drop nullable sidebarProgress, and read OAuth/onboarding payloads with data_get. Co-authored-by: Cursor <cursoragent@cursor.com> * Simplify onboarding checks and extract HasOnboarding. Use Eloquent + policies for MCP/backfill paths, and move account onboarding helpers into a dedicated trait. Co-authored-by: Cursor <cursoragent@cursor.com> * Add trait tests and tidy onboarding imports. Cover HasAccount and HasOnboarding under Models/Traits, prefer filled() for checkout session ids, and import Throwable instead of FQCN. Co-authored-by: Cursor <cursoragent@cursor.com> * Simplify checkout session_id and OAuth error props. Read session_id via request->string(), and take OAuth error details from the League exception instead of decoding the response body. Co-authored-by: Cursor <cursoragent@cursor.com> * Simplify PostObserver onboarding notify path. Share one otherPosts check for first-create and last-delete instead of separate callbacks. Co-authored-by: Cursor <cursoragent@cursor.com> * Use post author as onboarding sync actor. Drop Auth::user() preference in PostObserver; checklist sync attributes to $post->user. Co-authored-by: Cursor <cursoragent@cursor.com> * Simplify SocialAccountObserver and OAuth authorize flow. Share create/delete onboarding notify, drop Auth actor fallback to owner, and inline Passport Inertia error handling. Co-authored-by: Cursor <cursoragent@cursor.com> * Use lazy Inertia props for onboarding partial reloads. Drop partial-header branching; wrap page props in closures and always redirect completed/dismissed accounts to the calendar. Co-authored-by: Cursor <cursoragent@cursor.com> * Defer sidebar onboarding progress and stamp completion as owner-only. Skip the MCP checklist work on full Inertia visits via deferred shared props, early-exit token scans, and keep account completion stamps owner-gated. Co-authored-by: Cursor <cursoragent@cursor.com> * Simplify deferred onboarding progress share via canShowProgress. Co-authored-by: Cursor <cursoragent@cursor.com> * Add User firstName for shared auth and simplify onboarding page. Co-authored-by: Cursor <cursoragent@cursor.com> * Move User firstName coverage into UserTest. Co-authored-by: Cursor <cursoragent@cursor.com> * Use first_name directly without empty-name fallbacks. Co-authored-by: Cursor <cursoragent@cursor.com> * Resolve onboarding sample prompt on the frontend via i18n. Co-authored-by: Cursor <cursoragent@cursor.com> * Stamp onboarding completion via the account owner after teammate unlocks. Co-authored-by: Cursor <cursoragent@cursor.com> * Count only the account owner MCP grant toward onboarding activation. Co-authored-by: Cursor <cursoragent@cursor.com> * Fix OAuth consent auth-token mismatch for mid-activation owners. Skip deferred onboardingProgress on Passport authorize so Inertia does not rotate the session authToken, cover happy and stale-token paths in tests, and polish MCP setup copy plus sidebar/onboarding layout. Co-authored-by: Cursor <cursoragent@cursor.com> * Keep users on onboarding after activation completes. Stamp completion and re-render the finished checklist instead of redirecting to the calendar so owners can review the done state. Co-authored-by: Cursor <cursoragent@cursor.com> * Clarify Passport consent-view opt-out and guard app-route deferral. Rename the authorize-only route check and assert onboardingProgress still defers on calendar, onboarding, and MCP settings. Co-authored-by: Cursor <cursoragent@cursor.com> * Harden onboarding completion and MCP consent workspace binding. Reject OAuth approve without a workspace, retry auto-complete until stamped, send dismissed complete straight to calendar, and cover the device consent defer opt-out. Co-authored-by: Cursor <cursoragent@cursor.com> * Enable activation checklist for self-hosted installs. Remove the self-hosted onboarding redirects, keep the SaaS-only dismiss backfill, and cover subscription-less owners plus skip/complete destinations. Co-authored-by: Cursor <cursoragent@cursor.com> * Add GitHub, Hacker News, and directories referral sources. Expand the welcome referral step with open-source and directory discovery channels. Co-authored-by: Cursor <cursoragent@cursor.com> * Refine welcome referral sources and labels. Split Instagram/Threads, add Founder, and shorten Google, GitHub, AI, and blog option labels. Co-authored-by: Cursor <cursoragent@cursor.com> * Sort accounts platforms alphabetically and drop connect hover plus. Reuse connectableOptions for the accounts index and remove the unused plus badge on disconnected cards. Co-authored-by: Cursor <cursoragent@cursor.com> * Centralize PostHog once-capture so disabled installs don't burn dedupe keys. Move isEnabled + Cache::add into PostHogService::captureOnce and route onboarding viewed/step events through it. Co-authored-by: Cursor <cursoragent@cursor.com> * Simplify onboarding backfill to complete every existing open account. Drop self-hosted and subscription filters; down clears completed_at again. Co-authored-by: Cursor <cursoragent@cursor.com> * Drop PostHog captureOnce and use plain capture for onboarding. Remove cache-based event dedupe; callers rely on PostHogService::capture gating. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
315 lines
10 KiB
Vue
315 lines
10 KiB
Vue
<script setup lang="ts">
|
|
import { Link, usePage } from '@inertiajs/vue3';
|
|
import {
|
|
IconAffiliate,
|
|
IconAlertTriangle,
|
|
IconBolt,
|
|
IconBrandDiscord,
|
|
IconCalendar,
|
|
IconChartBar,
|
|
IconChevronRight,
|
|
IconClock,
|
|
IconFileCheck,
|
|
IconFileText,
|
|
IconGift,
|
|
IconHash,
|
|
IconLifebuoy,
|
|
IconPencil,
|
|
IconPhoto,
|
|
IconPlugConnected,
|
|
IconSelector,
|
|
IconTag,
|
|
} from '@tabler/icons-vue';
|
|
import { trans } from 'laravel-vue-i18n';
|
|
import { computed } from 'vue';
|
|
|
|
import {
|
|
create as createPost,
|
|
index as postsIndex,
|
|
} from '@/actions/App/Http/Controllers/App/PostController';
|
|
import NavMain from '@/components/NavMain.vue';
|
|
import NavSupport from '@/components/NavSupport.vue';
|
|
import NotificationBell from '@/components/NotificationBell.vue';
|
|
import SidebarOnboarding from '@/components/onboarding/SidebarOnboarding.vue';
|
|
import { Avatar } from '@/components/ui/avatar';
|
|
import { Button } from '@/components/ui/button';
|
|
import {
|
|
DropdownMenu,
|
|
DropdownMenuContent,
|
|
DropdownMenuTrigger,
|
|
} from '@/components/ui/dropdown-menu';
|
|
import {
|
|
Sidebar,
|
|
SidebarContent,
|
|
SidebarFooter,
|
|
SidebarHeader,
|
|
SidebarMenu,
|
|
SidebarMenuButton,
|
|
SidebarMenuItem,
|
|
useSidebar,
|
|
} from '@/components/ui/sidebar';
|
|
import WorkspaceMenuContent from '@/components/WorkspaceMenuContent.vue';
|
|
import { useWorkspaceRole } from '@/composables/useWorkspaceRole';
|
|
import { accounts, analytics, calendar } from '@/routes/app';
|
|
import { index as assets } from '@/routes/app/assets';
|
|
import { index as automations } from '@/routes/app/automations';
|
|
import { portal } from '@/routes/app/billing';
|
|
import { index as labels } from '@/routes/app/labels';
|
|
import { index as mcp } from '@/routes/app/mcp';
|
|
import { index as signatures } from '@/routes/app/signatures';
|
|
import type { NavItem, User } from '@/types';
|
|
|
|
interface Workspace {
|
|
id: string;
|
|
name: string;
|
|
logo_url: string | null;
|
|
}
|
|
|
|
const page = usePage();
|
|
const user = computed(() => page.props.auth.user as User);
|
|
const currentWorkspace = computed<Workspace | null>(
|
|
() => page.props.auth.currentWorkspace as Workspace | null,
|
|
);
|
|
const workspaces = computed<Workspace[]>(
|
|
() => page.props.auth.workspaces as Workspace[],
|
|
);
|
|
const subscriptionPastDue = computed<boolean>(() =>
|
|
Boolean(page.props.auth.subscriptionPastDue),
|
|
);
|
|
|
|
const {
|
|
canCreatePost,
|
|
canManageAccounts,
|
|
canManageAutomations,
|
|
canCreateWorkspace,
|
|
} = useWorkspaceRole();
|
|
const { isMobile } = useSidebar();
|
|
|
|
const mainNavItems = computed<NavItem[]>(() => [
|
|
{
|
|
title: trans('sidebar.posts.calendar'),
|
|
href: calendar.url(),
|
|
icon: IconCalendar,
|
|
},
|
|
{
|
|
title: trans('sidebar.analytics'),
|
|
href: analytics.url(),
|
|
icon: IconChartBar,
|
|
},
|
|
...(canManageAutomations.value
|
|
? [
|
|
{
|
|
title: trans('sidebar.automations'),
|
|
href: automations.url(),
|
|
icon: IconBolt,
|
|
badge: trans('common.beta'),
|
|
},
|
|
]
|
|
: []),
|
|
]);
|
|
|
|
const postsNavItems = computed<NavItem[]>(() => [
|
|
{
|
|
title: trans('sidebar.posts.all'),
|
|
href: postsIndex.url(),
|
|
icon: IconFileText,
|
|
excludeActive: [
|
|
postsIndex.url('scheduled'),
|
|
postsIndex.url('published'),
|
|
postsIndex.url('draft'),
|
|
],
|
|
},
|
|
{
|
|
title: trans('sidebar.posts.scheduled'),
|
|
href: postsIndex.url('scheduled'),
|
|
icon: IconClock,
|
|
},
|
|
{
|
|
title: trans('sidebar.posts.posted'),
|
|
href: postsIndex.url('published'),
|
|
icon: IconFileCheck,
|
|
},
|
|
{
|
|
title: trans('sidebar.posts.drafts'),
|
|
href: postsIndex.url('draft'),
|
|
icon: IconPencil,
|
|
},
|
|
]);
|
|
|
|
const workspaceNavItems = computed<NavItem[]>(() => [
|
|
...(canManageAccounts.value
|
|
? [
|
|
{
|
|
title: trans('sidebar.workspace.connections'),
|
|
href: accounts.url(),
|
|
icon: IconAffiliate,
|
|
},
|
|
]
|
|
: []),
|
|
...(canCreatePost.value
|
|
? [
|
|
{
|
|
title: trans('sidebar.workspace.signatures'),
|
|
href: signatures.url(),
|
|
icon: IconHash,
|
|
},
|
|
{
|
|
title: trans('sidebar.workspace.labels'),
|
|
href: labels.url(),
|
|
icon: IconTag,
|
|
},
|
|
{
|
|
title: trans('sidebar.workspace.assets'),
|
|
href: assets.url(),
|
|
icon: IconPhoto,
|
|
},
|
|
]
|
|
: []),
|
|
{
|
|
title: trans('sidebar.workspace.mcp'),
|
|
href: mcp.url(),
|
|
icon: IconPlugConnected,
|
|
},
|
|
]);
|
|
|
|
const bottomNavItems = computed(() => [
|
|
{
|
|
title: trans('sidebar.support.referral'),
|
|
href: 'https://affiliates.trypost.it/',
|
|
icon: IconGift,
|
|
},
|
|
{
|
|
title: trans('sidebar.support.discord'),
|
|
href: 'https://trypost.it/discord',
|
|
icon: IconBrandDiscord,
|
|
},
|
|
{
|
|
title: trans('sidebar.support.docs'),
|
|
href: 'https://docs.trypost.it',
|
|
icon: IconLifebuoy,
|
|
},
|
|
]);
|
|
</script>
|
|
|
|
<template>
|
|
<Sidebar collapsible="offcanvas">
|
|
<SidebarHeader>
|
|
<SidebarMenu>
|
|
<SidebarMenuItem>
|
|
<div class="flex items-center gap-1">
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger as-child>
|
|
<SidebarMenuButton
|
|
size="lg"
|
|
class="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
|
|
data-test="sidebar-menu-button"
|
|
data-testid="sidebar-workspace-menu"
|
|
dusk="sidebar-workspace-menu"
|
|
>
|
|
<Avatar
|
|
:src="currentWorkspace?.logo_url"
|
|
:name="currentWorkspace?.name ?? '?'"
|
|
class="h-8 w-8 shrink-0 rounded-md border-2 border-foreground"
|
|
fallback-class="bg-violet-100 text-violet-700 font-bold"
|
|
/>
|
|
<div
|
|
class="grid min-w-0 flex-1 text-left text-sm leading-tight"
|
|
>
|
|
<span class="truncate font-semibold">
|
|
{{
|
|
currentWorkspace?.name ??
|
|
$t('sidebar.select_workspace')
|
|
}}
|
|
</span>
|
|
</div>
|
|
<component
|
|
:is="
|
|
isMobile
|
|
? IconSelector
|
|
: IconChevronRight
|
|
"
|
|
class="ml-auto size-4"
|
|
/>
|
|
</SidebarMenuButton>
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent
|
|
class="w-(--reka-dropdown-menu-trigger-width) min-w-64"
|
|
align="start"
|
|
:side="isMobile ? 'bottom' : 'right'"
|
|
:side-offset="4"
|
|
>
|
|
<WorkspaceMenuContent
|
|
:user="user"
|
|
:current-workspace="currentWorkspace"
|
|
:workspaces="workspaces"
|
|
:can-create-workspace="canCreateWorkspace"
|
|
/>
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
|
|
<NotificationBell v-if="currentWorkspace" />
|
|
</div>
|
|
</SidebarMenuItem>
|
|
</SidebarMenu>
|
|
</SidebarHeader>
|
|
|
|
<SidebarContent class="gap-px">
|
|
<div v-if="currentWorkspace && canCreatePost" class="px-2 py-2">
|
|
<Link :href="createPost.url()" class="block">
|
|
<Button class="w-full">
|
|
{{ $t('sidebar.create_post') }}
|
|
</Button>
|
|
</Link>
|
|
</div>
|
|
|
|
<NavMain v-if="currentWorkspace" :items="mainNavItems" />
|
|
<NavMain
|
|
v-if="currentWorkspace"
|
|
:items="postsNavItems"
|
|
:label="$t('sidebar.groups.posts')"
|
|
/>
|
|
<NavMain
|
|
v-if="currentWorkspace && workspaceNavItems.length"
|
|
:items="workspaceNavItems"
|
|
:label="$t('sidebar.groups.workspace')"
|
|
/>
|
|
|
|
<div class="mt-auto">
|
|
<NavSupport
|
|
v-if="currentWorkspace"
|
|
:items="bottomNavItems"
|
|
:label="$t('sidebar.groups.others')"
|
|
/>
|
|
</div>
|
|
</SidebarContent>
|
|
<SidebarFooter>
|
|
<SidebarOnboarding v-if="currentWorkspace" />
|
|
|
|
<div
|
|
v-if="subscriptionPastDue"
|
|
dusk="past-due-notice"
|
|
class="mx-1 mb-1 rounded-md border-2 border-destructive bg-destructive/10 p-3"
|
|
>
|
|
<div class="flex items-center gap-2 text-destructive">
|
|
<IconAlertTriangle class="size-4 shrink-0" />
|
|
<span class="text-sm font-semibold">{{
|
|
$t('billing.past_due_notice.title')
|
|
}}</span>
|
|
</div>
|
|
<p class="mt-1 text-xs text-muted-foreground">
|
|
{{ $t('billing.past_due_notice.description') }}
|
|
</p>
|
|
<Button
|
|
as="a"
|
|
:href="portal.url()"
|
|
variant="destructive"
|
|
size="sm"
|
|
class="mt-2 w-full"
|
|
dusk="past-due-cta"
|
|
>
|
|
{{ $t('billing.past_due_notice.cta') }}
|
|
</Button>
|
|
</div>
|
|
</SidebarFooter>
|
|
</Sidebar>
|
|
</template>
|