@githat/nextjs 0.2.6 → 0.2.7
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.d.mts +65 -1
- package/dist/index.d.ts +65 -1
- package/dist/index.js +93 -66
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -0
- package/dist/index.mjs.map +1 -1
- package/dist/server.d.mts +41 -1
- package/dist/server.d.ts +41 -1
- package/dist/server.js +18 -0
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +17 -0
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -599,6 +599,31 @@ function useData() {
|
|
|
599
599
|
}), [client]);
|
|
600
600
|
}
|
|
601
601
|
|
|
602
|
+
// src/email.ts
|
|
603
|
+
import { useMemo as useMemo4 } from "react";
|
|
604
|
+
function useEmail() {
|
|
605
|
+
const ctx = useAuth();
|
|
606
|
+
const client = useMemo4(
|
|
607
|
+
() => createClient(ctx.config.apiUrl, ctx.config.publishableKey),
|
|
608
|
+
[ctx.config.apiUrl, ctx.config.publishableKey]
|
|
609
|
+
);
|
|
610
|
+
return useMemo4(() => ({
|
|
611
|
+
/**
|
|
612
|
+
* Send a transactional email.
|
|
613
|
+
* @param options - Email options (to, subject, html/text, replyTo)
|
|
614
|
+
*/
|
|
615
|
+
send: async (options) => {
|
|
616
|
+
if (!options.to) throw new Error('Recipient "to" is required');
|
|
617
|
+
if (!options.subject) throw new Error("Subject is required");
|
|
618
|
+
if (!options.html && !options.text) throw new Error('At least one of "html" or "text" is required');
|
|
619
|
+
return client.fetchApi("/email/send", {
|
|
620
|
+
method: "POST",
|
|
621
|
+
body: JSON.stringify(options)
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
}), [client]);
|
|
625
|
+
}
|
|
626
|
+
|
|
602
627
|
// src/components/SignInForm.tsx
|
|
603
628
|
import { useState as useState2 } from "react";
|
|
604
629
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
@@ -1790,6 +1815,7 @@ export {
|
|
|
1790
1815
|
VerifyEmailStatus,
|
|
1791
1816
|
useAuth,
|
|
1792
1817
|
useData,
|
|
1818
|
+
useEmail,
|
|
1793
1819
|
useGitHat
|
|
1794
1820
|
};
|
|
1795
1821
|
//# sourceMappingURL=index.mjs.map
|