Skip to content

Commit 3880e6b

Browse files
committed
post-registration dialog: show origin page, /p dashboard, and /m storefront links
Replace the verbose two-variant dialog with clean action links. With contact email: API page + dashboard + share link. Without: API page + share link + nudge to add email.
1 parent 4bbfb84 commit 3880e6b

1 file changed

Lines changed: 56 additions & 95 deletions

File tree

  • apps/scan/src/app/(app)/(home)/resources/register/_components

apps/scan/src/app/(app)/(home)/resources/register/_components/form.tsx

Lines changed: 56 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ export const RegisterResourceForm = () => {
678678
/>
679679
) : null}
680680

681-
{activeBulkResult?.originId ? (
681+
{activeBulkResult?.originId && activeSummaryOrigin ? (
682682
<>
683683
<Link href={`/server/${activeBulkResult.originId}`}>
684684
<Button variant="outline" className="w-full">
@@ -688,6 +688,7 @@ export const RegisterResourceForm = () => {
688688
<PostRegistrationDialog
689689
contactEmail={contactEmail}
690690
originId={activeBulkResult.originId}
691+
origin={activeSummaryOrigin}
691692
/>
692693
</>
693694
) : null}
@@ -704,109 +705,69 @@ export const RegisterResourceForm = () => {
704705
function PostRegistrationDialog({
705706
contactEmail,
706707
originId,
708+
origin,
707709
}: {
708710
contactEmail: string | undefined;
709711
originId: string;
712+
origin: string;
710713
}) {
711714
const [open, setOpen] = useState(true);
712715

716+
let hostname: string;
717+
try {
718+
hostname = new URL(origin).hostname;
719+
} catch {
720+
hostname = origin;
721+
}
722+
713723
return (
714724
<Dialog open={open} onOpenChange={setOpen}>
715725
<DialogContent className="sm:max-w-md">
716-
{contactEmail ? (
717-
<>
718-
<DialogHeader>
719-
<DialogTitle>You&apos;re all set</DialogTitle>
720-
<DialogDescription>
721-
We detected your contact email in your openapi.json.
722-
</DialogDescription>
723-
</DialogHeader>
724-
<div className="space-y-3 text-sm text-muted-foreground">
725-
<p>
726-
You&apos;re eligible for a free merchant dashboard on{' '}
727-
<Link
728-
href="https://tryponcho.com"
729-
target="_blank"
730-
className="underline font-medium text-foreground"
731-
>
732-
Poncho
733-
</Link>{' '}
734-
with:
735-
</p>
736-
<ul className="list-disc pl-5 space-y-1">
737-
<li>Usage analytics for your endpoints</li>
738-
<li>Endpoint health monitoring</li>
739-
<li>A shareable link to onboard your users instantly</li>
740-
</ul>
741-
<p>
742-
Log into{' '}
743-
<Link
744-
href="https://tryponcho.com"
745-
target="_blank"
746-
className="underline font-medium text-foreground"
747-
>
748-
tryponcho.com
749-
</Link>{' '}
750-
with the same email to access your dashboard.
751-
</p>
752-
</div>
753-
<div className="flex gap-2 pt-2">
754-
<Button asChild className="flex-1">
755-
<Link href={`/server/${originId}`}>View your API page</Link>
756-
</Button>
757-
<Button asChild variant="outline" className="flex-1">
758-
<Link href="https://tryponcho.com" target="_blank">
759-
Open Poncho
760-
</Link>
761-
</Button>
762-
</div>
763-
</>
764-
) : (
765-
<>
766-
<DialogHeader>
767-
<DialogTitle>
768-
Want usage analytics and a shareable onboarding link?
769-
</DialogTitle>
770-
<DialogDescription>
771-
Add your contact email to unlock your free merchant dashboard.
772-
</DialogDescription>
773-
</DialogHeader>
774-
<div className="space-y-3 text-sm text-muted-foreground">
775-
<p>
776-
Add{' '}
777-
<code className="font-mono bg-muted px-1 rounded text-xs">
778-
info.contact.email
779-
</code>{' '}
780-
to your openapi.json to unlock your free merchant dashboard on{' '}
781-
<Link
782-
href="https://tryponcho.com"
783-
target="_blank"
784-
className="underline font-medium text-foreground"
785-
>
786-
Poncho
787-
</Link>
788-
:
789-
</p>
790-
<ul className="list-disc pl-5 space-y-1">
791-
<li>See how agents use your API</li>
792-
<li>Monitor endpoint health</li>
793-
<li>Share a one-click onboarding link for new users</li>
794-
</ul>
795-
<p>
796-
No extra cost. Log into tryponcho.com with the same email to
797-
access your dashboard.
798-
</p>
799-
</div>
800-
<div className="flex gap-2 pt-2">
801-
<Button asChild className="flex-1">
802-
<Link href={`/server/${originId}`}>View your API page</Link>
803-
</Button>
804-
<Button variant="outline" className="flex-1" asChild>
805-
<Link href="/discovery#merchant-dashboard">Learn more</Link>
806-
</Button>
807-
</div>
808-
</>
809-
)}
726+
<DialogHeader>
727+
<DialogTitle>You&apos;re registered!</DialogTitle>
728+
<DialogDescription>
729+
{contactEmail
730+
? 'Your contact email was detected \u2014 your merchant dashboard is ready.'
731+
: 'Here\u2019s what you can do next.'}
732+
</DialogDescription>
733+
</DialogHeader>
734+
<div className="flex flex-col gap-2">
735+
<Button asChild className="w-full">
736+
<Link href={`/server/${originId}`}>View your API page &rarr;</Link>
737+
</Button>
738+
{contactEmail && (
739+
<Button asChild variant="outline" className="w-full">
740+
<Link
741+
href={`https://tryponcho.com/p/${hostname}`}
742+
target="_blank"
743+
>
744+
Open your merchant dashboard &rarr;
745+
</Link>
746+
</Button>
747+
)}
748+
<Button asChild variant="outline" className="w-full">
749+
<Link href={`https://tryponcho.com/m/${hostname}`} target="_blank">
750+
Share with your users &rarr;
751+
</Link>
752+
</Button>
753+
{!contactEmail && (
754+
<p className="text-xs text-muted-foreground text-center pt-1">
755+
Add{' '}
756+
<code className="font-mono bg-muted px-1 rounded text-[11px]">
757+
info.contact.email
758+
</code>{' '}
759+
to your openapi.json to unlock your free{' '}
760+
<Link
761+
href="https://tryponcho.com"
762+
target="_blank"
763+
className="underline"
764+
>
765+
merchant dashboard
766+
</Link>
767+
.
768+
</p>
769+
)}
770+
</div>
810771
</DialogContent>
811772
</Dialog>
812773
);

0 commit comments

Comments
 (0)