UNPKG

@polar-sh/better-auth

Version:

Polar integration for better-auth

34 lines (33 loc) 913 B
// src/client.ts import { PolarEmbedCheckout } from "@polar-sh/checkout/embed"; var polarClient = () => { return { id: "polar-client", $InferServerPlugin: {}, getActions: ($fetch) => { return { checkoutEmbed: async (data, fetchOptions) => { const res = await $fetch("/checkout", { method: "POST", body: { ...data, redirect: false, embedOrigin: window.location.origin }, ...fetchOptions }); if (res.error) { throw new Error(res.error.message); } const checkout = res.data; const theme = new URL(checkout.url).searchParams.get("theme") ?? "light"; return await PolarEmbedCheckout.create(checkout.url, { theme }); } }; } }; }; export { polarClient }; //# sourceMappingURL=chunk-XH6OI6P2.js.map