Files
zeekay b2083a6610 Say Hanzo eSign wherever the product names itself
Emails, the signing page's title, the sealed PDF's reason, the sign-in
refusal and the dialogs still said Hanzo Sign. The catalogs change with
the strings, message for message, so every translation keeps its id.
2026-10-20 13:12:22 -07:00

97 lines
2.5 KiB
TypeScript

import { redirect, useLoaderData } from 'react-router';
import { NEXT_PUBLIC_WEBAPP_URL } from '@hanzo/esign-lib/constants/app';
import { getDocumentByAccessToken } from '@hanzo/esign-lib/server-only/document/get-document-by-access-token';
import { DocumentCertificateQRView } from '~/components/general/document/document-certificate-qr-view';
import type { Route } from './+types/share.$slug';
export function meta({ params: { slug } }: Route.MetaArgs) {
if (slug.startsWith('qr_')) {
return undefined;
}
return [
{ title: 'Hanzo eSign - Share' },
{ description: 'I just signed a document in style with Hanzo eSign!' },
{
property: 'og:title',
content: 'Hanzo eSign - Join the open source signing revolution',
},
{
property: 'og:description',
content: 'I just signed with Hanzo eSign!',
},
{
property: 'og:type',
content: 'website',
},
{
property: 'og:image',
content: `${NEXT_PUBLIC_WEBAPP_URL()}/share/${slug}/opengraph`,
},
{
name: 'twitter:site',
content: '@hanzoai',
},
{
name: 'twitter:card',
content: 'summary_large_image',
},
{
name: 'twitter:image',
content: `${NEXT_PUBLIC_WEBAPP_URL()}/share/${slug}/opengraph`,
},
{
name: 'twitter:description',
content: 'I just signed with Hanzo eSign!',
},
];
}
export const loader = async ({ request, params: { slug } }: Route.LoaderArgs) => {
if (slug.startsWith('qr_')) {
const document = await getDocumentByAccessToken({ token: slug });
if (!document) {
throw redirect('/');
}
return {
document,
token: slug,
};
}
const userAgent = request.headers.get('User-Agent') ?? '';
if (/bot|facebookexternalhit|WhatsApp|google|bing|duckduckbot|MetaInspector/i.test(userAgent)) {
return {};
}
// Is hardcoded because this whole meta is hardcoded anyway for Hanzo eSign.
throw redirect('https://esign.hanzo.ai');
};
export default function SharePage() {
const { document, token } = useLoaderData<typeof loader>();
if (document) {
return (
<DocumentCertificateQRView
documentId={document.id}
title={document.title}
documentTeamUrl={document.documentTeamUrl}
internalVersion={document.internalVersion}
envelopeItems={document.envelopeItems}
recipientCount={document.recipientCount}
completedDate={document.completedAt ?? undefined}
token={token}
/>
);
}
return <div></div>;
}