-
Notifications
You must be signed in to change notification settings - Fork 1.1k
web: new onboarding #1188
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
Merged
Merged
web: new onboarding #1188
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
3f5c7bc
wip
ameer2468 2c4c410
onboarding backend
ameer2468 e68957c
modify stripe webhook to handle checkout from onboarding
ameer2468 e3b25de
decrease timeout
ameer2468 ae3ef1d
put deployment url on success for testing
ameer2468 9b26d12
cancel url
ameer2468 8d4f42d
fixes
ameer2468 08ff461
set completion
ameer2468 6f59fed
attempt fix redirection
ameer2468 f5e1c65
logging
ameer2468 609278a
logs
ameer2468 0f3dda7
restore server env
ameer2468 d4c17c4
Update _journal.json
ameer2468 952f019
Merge branch 'main' into onboarding
richiemcilroy badaa37
cleanup
ameer2468 7da87fe
Merge branch 'onboarding' of https://github.com/CapSoftware/Cap into …
ameer2468 73bc732
minor refinements
ameer2468 a42f264
copy changes
richiemcilroy cdbeced
Merge branch 'onboarding' of https://github.com/CapSoftware/cap into …
richiemcilroy c52cf61
use transactions
ameer2468 b81659a
Merge branch 'onboarding' of https://github.com/CapSoftware/Cap into …
ameer2468 906d278
scaffold user rpcs
Brendonovich c70d720
rpc
ameer2468 2a1b233
Delete ONBOARDING_RPC_MIGRATION.md
ameer2468 6594be4
use S3 bucket service
ameer2468 4cfeedd
remove api endpoints
ameer2468 5ee586f
download page and fixes
ameer2468 9fb84d0
Merge branch 'main' into onboarding
ameer2468 44aff44
Update route.ts
ameer2468 724a038
cleanups
ameer2468 b54a556
Merge branch 'main' into onboarding
ameer2468 9088554
Update Items.tsx
ameer2468 dc24b11
remove dead code
ameer2468 8a644fe
Merge branch 'main' into onboarding
ameer2468 0d602f7
remove pushing
ameer2468 47c0b9f
conditional pushing
ameer2468 7d3645a
mb
ameer2468 f9e1710
prefill org name
ameer2468 c56f999
Merge branch 'main' into staging
ameer2468 a8ab75b
Update CustomDomainPage.tsx
ameer2468 63d06c2
Merge branch 'main' into staging
ameer2468 6c56457
Merge branch 'main' into onboarding
Brendonovich 3004f01
Merge branch 'onboarding' of https://github.com/CapSoftware/Cap into …
Brendonovich 60ec6de
use stripe context
ameer2468 6facdf6
Merge branch 'onboarding' of https://github.com/CapSoftware/Cap into …
ameer2468 a6f3843
Update CustomDomainPage.tsx
ameer2468 8e7372a
ts
ameer2468 16c5b6b
move user call into org-setup block
ameer2468 15a0935
redirect to org settings when checking out during onboarding
ameer2468 9858c08
add signout and skip
ameer2468 a2a136c
Update DownloadPage.tsx
ameer2468 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import { getCurrentUser } from "@cap/database/auth/session"; | ||
| import { redirect } from "next/navigation"; | ||
|
|
||
| export default async function OnboardingStepLayout({ | ||
| children, | ||
| params, | ||
| }: { | ||
| children: React.ReactNode; | ||
| params: Promise<{ steps: string[] }>; | ||
| }) { | ||
| const user = await getCurrentUser(); | ||
|
|
||
| if (!user) { | ||
| redirect("/login"); | ||
| } | ||
|
|
||
| const steps = user.onboardingSteps || {}; | ||
| const currentStep = (await params).steps?.[0] ?? "welcome"; | ||
|
|
||
| const ordered = [ | ||
| "welcome", | ||
| "organization-setup", | ||
| "custom-domain", | ||
| "invite-team", | ||
| "download", | ||
| ] as const; | ||
| const isComplete = (s: (typeof ordered)[number]) => | ||
| s === "welcome" | ||
| ? Boolean(steps.welcome && user.name) | ||
| : s === "organization-setup" | ||
| ? Boolean(steps.organizationSetup) | ||
| : s === "custom-domain" | ||
| ? Boolean(steps.customDomain) | ||
| : s === "invite-team" | ||
| ? Boolean(steps.inviteTeam) | ||
| : Boolean(steps.download); | ||
|
|
||
| const firstIncomplete = ordered.find((s) => !isComplete(s)) ?? "download"; | ||
|
|
||
| if (currentStep !== firstIncomplete) { | ||
| redirect(`/onboarding/${firstIncomplete}`); | ||
| } | ||
|
|
||
| return children; | ||
| } |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import { getCurrentUser } from "@cap/database/auth/session"; | ||
| import { CustomDomainPage } from "../components/CustomDomainPage"; | ||
| import { DownloadPage } from "../components/DownloadPage"; | ||
| import { InviteTeamPage } from "../components/InviteTeamPage"; | ||
| import { OrganizationSetupPage } from "../components/OrganizationSetupPage"; | ||
| import { WelcomePage } from "../components/WelcomePage"; | ||
|
|
||
| export default async function OnboardingStepPage({ | ||
| params, | ||
| }: { | ||
| params: Promise<{ | ||
| steps: "welcome" | "organization-setup" | "custom-domain" | "invite-team"; | ||
| }>; | ||
| }) { | ||
| const step = (await params).steps[0]; | ||
|
|
||
| switch (step) { | ||
| case "welcome": | ||
| return <WelcomePage />; | ||
| case "organization-setup": { | ||
| const user = await getCurrentUser(); | ||
| return <OrganizationSetupPage firstName={user?.name} />; | ||
| } | ||
| case "custom-domain": | ||
| return <CustomDomainPage />; | ||
| case "invite-team": | ||
| return <InviteTeamPage />; | ||
| case "download": | ||
| return <DownloadPage />; | ||
| default: | ||
| return null; | ||
| } | ||
| } |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| "use client"; | ||
|
|
||
| import { LogoBadge } from "@cap/ui"; | ||
| import { faArrowLeft } from "@fortawesome/free-solid-svg-icons"; | ||
| import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
| import clsx from "clsx"; | ||
| import { useRouter } from "next/navigation"; | ||
|
|
||
| export const Base = ({ | ||
| children, | ||
| title, | ||
| description, | ||
| descriptionClassName, | ||
| hideBackButton = true, | ||
| }: { | ||
| children: React.ReactNode; | ||
| title: string; | ||
| description: string | React.ReactNode; | ||
| descriptionClassName?: string; | ||
| hideBackButton?: boolean; | ||
| }) => { | ||
| const router = useRouter(); | ||
| return ( | ||
| <div className="relative w-[calc(100%-2%)] space-y-7 p-7 max-w-[472px] bg-gray-2 border border-gray-4 rounded-2xl"> | ||
| {!hideBackButton && ( | ||
| <div | ||
| onClick={() => router.back()} | ||
| className="absolute overflow-hidden flex top-5 rounded-full left-5 z-20 hover:bg-gray-1 gap-2 items-center py-1.5 px-3 text-gray-12 bg-transparent border border-gray-4 transition-colors duration-300 cursor-pointer" | ||
| > | ||
| <FontAwesomeIcon className="w-2" icon={faArrowLeft} /> | ||
| <p className="text-xs text-inherit">Back</p> | ||
| </div> | ||
| )} | ||
| <a href="/"> | ||
| <LogoBadge className="mx-auto w-auto h-12" /> | ||
| </a> | ||
| <div className="flex flex-col justify-center items-center space-y-1 text-center"> | ||
| <h2 className="text-2xl font-semibold text-gray-12">{title}</h2> | ||
| {typeof description === "string" ? ( | ||
| <p | ||
| className={clsx( | ||
| "w-full text-base max-w-[260px] text-gray-10", | ||
| descriptionClassName, | ||
| )} | ||
| > | ||
| {description} | ||
| </p> | ||
| ) : ( | ||
| description | ||
| )} | ||
| </div> | ||
| {children} | ||
| </div> | ||
| ); | ||
| }; |
Oops, something went wrong.
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.
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.
🧩 Analysis chain
Verify onboarding step enforcement is handled elsewhere.
The current code only checks
user.namebefore allowing dashboard access. Given the PR adds multi-step onboarding with tracked steps (welcome, organizationSetup, customDomain, inviteTeam, download as mentioned in the AI summary), verify that:/dashboardafter only completing the welcome stepThe previous version (per past review comments) had checks for individual
onboardingStepsproperties here that were problematic for existing users. If those checks were intentionally moved to the onboarding layout, that's correct. If they were removed without being relocated, incomplete onboarding users could access the dashboard.Run the following script to verify where onboarding step checks are enforced:
🏁 Script executed:
Length of output: 2510
🏁 Script executed:
Length of output: 27
🏁 Script executed:
Length of output: 4530
Enforce full onboarding in dashboard layout.
In
apps/web/app/(org)/dashboard/layout.tsx, add checks foruser.onboardingSteps.organizationSetup,.customDomain, and.inviteTeam(beyond justuser.name) and redirect to the respective onboarding step if any are incomplete; currently onlyuser.nameis gated, allowing dashboard access after only the welcome step.🤖 Prompt for AI Agents