Skip to content

Commit

Permalink
fix: onboarding updates
Browse files Browse the repository at this point in the history
  • Loading branch information
scopsy committed Dec 4, 2024
1 parent 17eaa75 commit 0bd8a76
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
6 changes: 3 additions & 3 deletions apps/dashboard/src/components/auth/inbox-playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export function InboxPlayground() {
});

const { triggerWorkflow, isPending } = useTriggerWorkflow();
const { data } = useWorkflows({ query: ONBOARDING_DEMO_WORKFLOW_ID });
const { data, isLoading } = useWorkflows({ query: ONBOARDING_DEMO_WORKFLOW_ID });
const auth = useAuth();
const [hasNotificationBeenSent, setHasNotificationBeenSent] = useState(false);
const navigate = useNavigate();
Expand All @@ -102,7 +102,7 @@ export function InboxPlayground() {
}, [telemetry]);

useEffect(() => {
if (!data) return;
if (!data || isLoading) return;

/**
* We only want to create the demo workflow if it doesn't exist yet.
Expand All @@ -116,7 +116,7 @@ export function InboxPlayground() {
};

initializeDemoWorkflow();
}, [data]);
}, [data, isLoading]);

const handleSendNotification = async () => {
try {
Expand Down
12 changes: 11 additions & 1 deletion apps/dashboard/src/components/auth/questionnaire-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { TelemetryEvent } from '../../utils/telemetry';
import { useNavigate } from 'react-router-dom';
import { ROUTES } from '../../utils/routes';
import { useMutation } from '@tanstack/react-query';
import { useUser } from '@clerk/clerk-react';

interface QuestionnaireFormData {
jobTitle: JobTitleEnum;
Expand All @@ -33,7 +34,7 @@ interface SubmitQuestionnaireData {
export function QuestionnaireForm() {
const { control, watch, handleSubmit } = useForm<QuestionnaireFormData>();
const submitQuestionnaireMutation = useSubmitQuestionnaire();

const { user } = useUser();
const selectedJobTitle = watch('jobTitle');
const selectedOrgType = watch('organizationType');
const companySize = watch('companySize');
Expand All @@ -58,6 +59,15 @@ export function QuestionnaireForm() {
pageName: 'Create Organization Form',
hubspotContext: hubspotContext || '',
});

if (!user?.unsafeMetadata?.newDashboardOptInStatus) {
await user?.update({
unsafeMetadata: {
newDashboardOptInStatus: 'opted_in',
},
});
await user?.reload();
}
};

return (
Expand Down
8 changes: 8 additions & 0 deletions apps/dashboard/src/pages/usecase-select-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ export function UsecaseSelectPage() {
const [selectedUseCases, setSelectedUseCases] = useState<ChannelTypeEnum[]>([]);
const [hoveredUseCase, setHoveredUseCase] = useState<ChannelTypeEnum | null>(null);

useEffect(() => {
// Preload all usecase images
channelOptions.forEach((option) => {
const img = new Image();
img.src = `/images/auth/${option.image}`;
});
}, []);

useEffect(() => {
track(TelemetryEvent.USECASE_SELECT_PAGE_VIEWED);
}, [track]);
Expand Down

0 comments on commit 0bd8a76

Please sign in to comment.