Skip to content

Commit

Permalink
fix: embed link
Browse files Browse the repository at this point in the history
  • Loading branch information
scopsy committed Jan 21, 2025
1 parent 7b9fdca commit f4a0a62
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function IntegrationCard({ integration, provider, environment, onClick }:
if (integration.channel === ChannelTypeEnum.IN_APP && !integration.connected) {
e.stopPropagation();

navigate(ROUTES.INBOX_EMBED + `?environmentId=${environment._id}`);
navigate(ROUTES.INBOX_EMBED + `?environmentId=${environment._id}&source=integrations-page`);
} else {
onClick({
integrationId: integration._id ?? '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ROUTES } from '@/utils/routes';
import { ChannelTypeEnum, StepTypeEnum, WorkflowResponseDto } from '@novu/shared';
import { RiArrowRightUpLine, RiTimeLine } from 'react-icons/ri';
import { useNavigate } from 'react-router-dom';
import { useEnvironment } from '../../context/environment/hooks';
import { Badge, BadgeIcon } from '../primitives/badge';
import { Button } from '../primitives/button';
import { HoverCard, HoverCardContent, HoverCardTrigger } from '../primitives/hover-card';
Expand All @@ -14,18 +15,22 @@ interface WorkflowActionsProps {
}

export function WorkflowActions({ workflow }: WorkflowActionsProps) {
const { currentEnvironment } = useEnvironment();
const { integrations } = useFetchIntegrations();
const navigate = useNavigate();

const hasInAppStep = workflow.steps.some((step) => step.type === StepTypeEnum.IN_APP);
const hasConnectedInAppIntegration = integrations?.some(
(integration) => integration.channel === ChannelTypeEnum.IN_APP && integration.connected
(integration) =>
integration.channel === ChannelTypeEnum.IN_APP &&
integration.connected &&
integration._environmentId === currentEnvironment?._id
);

const showInAppActionRequired = hasInAppStep && !hasConnectedInAppIntegration;

const handleInboxSetup = () => {
navigate(ROUTES.INBOX_EMBED);
navigate(ROUTES.INBOX_EMBED + `?environmentId=${currentEnvironment?._id}&source=workflow-editor`);
};

if (!showInAppActionRequired) {
Expand Down
16 changes: 10 additions & 6 deletions apps/dashboard/src/pages/inbox-embed-page.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import { AnimatedPage } from '@/components/onboarding/animated-page';
import { useEffect } from 'react';
import { useSearchParams } from 'react-router-dom';
import { AuthCard } from '../components/auth/auth-card';
import { ROUTES } from '../utils/routes';
import { InboxEmbed } from '../components/welcome/inbox-embed';
import { UsecasePlaygroundHeader } from '../components/usecase-playground-header';
import { InboxEmbed } from '../components/welcome/inbox-embed';
import { useTelemetry } from '../hooks/use-telemetry';
import { ROUTES } from '../utils/routes';
import { TelemetryEvent } from '../utils/telemetry';
import { useEffect } from 'react';
import { AnimatedPage } from '@/components/onboarding/animated-page';

export function InboxEmbedPage() {
const [searchParams] = useSearchParams();
const telemetry = useTelemetry();

useEffect(() => {
telemetry(TelemetryEvent.INBOX_EMBED_PAGE_VIEWED);
}, [telemetry]);
telemetry(TelemetryEvent.INBOX_EMBED_PAGE_VIEWED, {
referralSource: searchParams.get('source'),
});
}, [telemetry, searchParams]);

return (
<AnimatedPage>
Expand Down

0 comments on commit f4a0a62

Please sign in to comment.