import { RUN_IN_DEV } from '../../../../../core/src/utils/dev.mjs';

// The strings in this file are only for developers
function serverRenderError(name) {
    RUN_IN_DEV(()=>{
        if (typeof window === 'undefined') {
            throw new Error(`<${name} /> cannot be rendered on the server. If you are using Next.js, use the @stytch/nextjs package or 'use client' directives`);
        }
    });
}
const noProviderError = (item, provider = 'StytchProvider')=>`${item} can only be used inside <${provider}>.`;
const providerMustBeUniqueError = 'You cannot render a <StytchProvider> inside another <StytchProvider>.';
const cannotInvokeMethodOnServerError = (path)=>`[Stytch] Invalid server-side function call to ${path}.
The Stytch JavaScript SDK is intended to only be used on the client side.
Make sure to wrap your API calls in a hook to ensure they are executed on the client.

\`\`\`
const myComponent = () => {
  const stytch = useStytch();
  // This will error out on the server.
  stytch.magicLinks.authenticate(...);
  useEffect(() => {
    // This will work well
    stytch.magicLinks.authenticate(...);
  }, []);
}
\`\`\`

If you want to make API calls from server environments, please use the Stytch Node Library
https://www.npmjs.com/package/stytch.`;

export { cannotInvokeMethodOnServerError, noProviderError, providerMustBeUniqueError, serverRenderError };
//# sourceMappingURL=errors.mjs.map
