## What does this PR do? - Redesigns the organization onboarding flow by merging the brand and details pages - Improves the organization details page with a scrollable interface and visual previews - Adds a new organization-specific browser preview component ## Visual Demo (For contributors especially) #### Image Demo: - The PR replaces the separate brand page with an integrated details page that includes logo and banner uploads - The new organization browser view shows a preview of the organization profile with the selected branding ## Mandatory Tasks (DO NOT REMOVE) - [ ] I have self-reviewed the code. - [ ] I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox. - [ ] I confirm automated tests are in place that prove my fix is effective or that my feature works. ## How should this be tested? - Go through the organization onboarding flow - Test uploading logos and banners - Verify that the organization browser preview updates in real-time with the form inputs - Confirm that the form validation works correctly for organization name and slug - Check that the scrollable interface works properly with fade effects at top and bottom ## Checklist - I have read the [contributing guide](https://github.com/calcom/cal.com/blob/main/CONTRIBUTING.md) - My code follows the style guidelines of this project - I have commented my code, particularly in hard-to-understand areas - I have checked if my changes generate no new warnings <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Split organization brand from the details step and added live previews for organizations and teams. Revamped org/team invites with reusable components, a dedicated email-invite page, and a CSV upload modal. - **New Features** - Separate Brand step with logo, banner, and color; instant org preview via OnboardingOrganizationBrowserView. - Teams browser preview added; invites include email substep (/onboarding/organization/invite/email, /onboarding/teams/invite/email), CSV upload (template + parsing), and Google Workspace (behind flag). - Shared components (EmailInviteForm, InviteOptions, RoleSelector) used across org and team invites. - **Refactors** - Updated org flow: Details → Brand → Teams → Invites; OnboardingLayout now supports dynamic step counts (org=4, team=3, personal=2). - UI polish (OnboardingCard header padding) and org-specific previews now replace generic views across details/brand/invites/teams; ensured org welcome modal takes precedence over personal. <sup>Written for commit d9b55c0b5505aa0d4ca1c4298a513bcd90606915. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. -->
94 lines
2.8 KiB
TypeScript
94 lines
2.8 KiB
TypeScript
import { useRouter } from "next/navigation";
|
|
|
|
import { setShowWelcomeToCalcomModalFlag } from "@calcom/features/shell/hooks/useWelcomeToCalcomModal";
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
|
import { useTelemetry } from "@calcom/lib/hooks/useTelemetry";
|
|
import { telemetryEventTypes } from "@calcom/lib/telemetry";
|
|
import { sessionStorage } from "@calcom/lib/webstorage";
|
|
import { trpc } from "@calcom/trpc/react";
|
|
import { showToast } from "@calcom/ui/components/toast";
|
|
|
|
const ORG_MODAL_STORAGE_KEY = "showNewOrgModal";
|
|
|
|
const DEFAULT_EVENT_TYPES = [
|
|
{
|
|
title: "15min_meeting",
|
|
slug: "15min",
|
|
length: 15,
|
|
},
|
|
{
|
|
title: "30min_meeting",
|
|
slug: "30min",
|
|
length: 30,
|
|
},
|
|
{
|
|
title: "secret_meeting",
|
|
slug: "secret",
|
|
length: 15,
|
|
hidden: true,
|
|
},
|
|
];
|
|
|
|
export const useSubmitPersonalOnboarding = () => {
|
|
const router = useRouter();
|
|
const { t } = useLocale();
|
|
const telemetry = useTelemetry();
|
|
const utils = trpc.useUtils();
|
|
|
|
const { data: eventTypes } = trpc.viewer.eventTypes.list.useQuery();
|
|
const createEventType = trpc.viewer.eventTypesHeavy.create.useMutation();
|
|
|
|
const mutation = trpc.viewer.me.updateProfile.useMutation({
|
|
onSuccess: async () => {
|
|
try {
|
|
// Create default event types if user has none
|
|
if (eventTypes?.length === 0) {
|
|
await Promise.all(
|
|
DEFAULT_EVENT_TYPES.map(async (event) => {
|
|
return createEventType.mutateAsync({
|
|
title: t(event.title),
|
|
slug: event.slug,
|
|
length: event.length,
|
|
hidden: event.hidden,
|
|
});
|
|
})
|
|
);
|
|
}
|
|
} catch (error) {
|
|
console.error(error);
|
|
}
|
|
|
|
await utils.viewer.me.get.refetch();
|
|
// Check if org modal flag is set - if so, don't show personal modal
|
|
// Organization onboarding takes precedence
|
|
const hasOrgModalFlag = sessionStorage.getItem(ORG_MODAL_STORAGE_KEY) === "true";
|
|
|
|
if (!hasOrgModalFlag) {
|
|
// Only set personal modal flag if org modal flag is not set
|
|
setShowWelcomeToCalcomModalFlag();
|
|
router.push("/event-types?welcomeToCalcomModal=true");
|
|
} else {
|
|
// Org modal flag exists - redirect to event-types without personal modal query param
|
|
// The org modal will show via sessionStorage check
|
|
router.push("/event-types?newOrganizationModal=true");
|
|
}
|
|
},
|
|
onError: (error) => {
|
|
showToast(t("something_went_wrong"), "error");
|
|
console.error(error);
|
|
},
|
|
});
|
|
|
|
const submitPersonalOnboarding = () => {
|
|
telemetry.event(telemetryEventTypes.onboardingFinished);
|
|
mutation.mutate({
|
|
completedOnboarding: true,
|
|
});
|
|
};
|
|
|
|
return {
|
|
submitPersonalOnboarding,
|
|
isSubmitting: mutation.isPending,
|
|
};
|
|
};
|