@githat/nextjs 0.2.6 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -502,7 +502,6 @@ function useGitHat() {
502
502
  return {
503
503
  fetch: client.fetchApi,
504
504
  getUserOrgs: () => client.fetchApi("/user/orgs"),
505
- verifyMCP: (domain) => client.fetchApi(`/verify/mcp/${domain}`),
506
505
  verifyAgent: (wallet) => client.fetchApi(`/verify/agent/${wallet}`),
507
506
  getOrgMetadata,
508
507
  updateOrgMetadata,
@@ -599,6 +598,31 @@ function useData() {
599
598
  }), [client]);
600
599
  }
601
600
 
601
+ // src/email.ts
602
+ import { useMemo as useMemo4 } from "react";
603
+ function useEmail() {
604
+ const ctx = useAuth();
605
+ const client = useMemo4(
606
+ () => createClient(ctx.config.apiUrl, ctx.config.publishableKey),
607
+ [ctx.config.apiUrl, ctx.config.publishableKey]
608
+ );
609
+ return useMemo4(() => ({
610
+ /**
611
+ * Send a transactional email.
612
+ * @param options - Email options (to, subject, html/text, replyTo)
613
+ */
614
+ send: async (options) => {
615
+ if (!options.to) throw new Error('Recipient "to" is required');
616
+ if (!options.subject) throw new Error("Subject is required");
617
+ if (!options.html && !options.text) throw new Error('At least one of "html" or "text" is required');
618
+ return client.fetchApi("/email/send", {
619
+ method: "POST",
620
+ body: JSON.stringify(options)
621
+ });
622
+ }
623
+ }), [client]);
624
+ }
625
+
602
626
  // src/components/SignInForm.tsx
603
627
  import { useState as useState2 } from "react";
604
628
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
@@ -924,8 +948,7 @@ function VerifiedBadge({ type, identifier, label }) {
924
948
  setVerified(cached.verified);
925
949
  return;
926
950
  }
927
- const verify = type === "mcp" ? githat.verifyMCP : githat.verifyAgent;
928
- verify(identifier).then((data) => {
951
+ githat.verifyAgent(identifier).then((data) => {
929
952
  if (mounted.current) {
930
953
  setVerified(data.verified);
931
954
  cache.set(key, { verified: data.verified, ts: Date.now() });
@@ -1790,6 +1813,7 @@ export {
1790
1813
  VerifyEmailStatus,
1791
1814
  useAuth,
1792
1815
  useData,
1816
+ useEmail,
1793
1817
  useGitHat
1794
1818
  };
1795
1819
  //# sourceMappingURL=index.mjs.map