{"version":3,"file":"errors.mjs","sources":["../../../../../../../../../web/src/ui/react/utils/errors.ts"],"sourcesContent":["// The strings in this file are only for developers\n/* eslint-disable lingui/no-unlocalized-strings */\n\nimport { RUN_IN_DEV } from '@stytch/core';\n\nexport function serverRenderError(name: string) {\n  RUN_IN_DEV(() => {\n    if (typeof window === 'undefined') {\n      throw new Error(\n        `<${name} /> cannot be rendered on the server. If you are using Next.js, use the @stytch/nextjs package or 'use client' directives`,\n      );\n    }\n  });\n}\n\nexport const noProviderError = (item: string, provider = 'StytchProvider'): string =>\n  `${item} can only be used inside <${provider}>.`;\n\nexport const providerMustBeUniqueError = 'You cannot render a <StytchProvider> inside another <StytchProvider>.';\n\nexport const cannotInvokeMethodOnServerError = (path: string) =>\n  process.env.NODE_ENV === 'production'\n    ? `[Stytch] Invalid server-side function call to ${path}`\n    : `[Stytch] Invalid server-side function call to ${path}.\nThe Stytch JavaScript SDK is intended to only be used on the client side.\nMake sure to wrap your API calls in a hook to ensure they are executed on the client.\n\n\\`\\`\\`\nconst myComponent = () => {\n  const stytch = useStytch();\n  // This will error out on the server.\n  stytch.magicLinks.authenticate(...);\n  useEffect(() => {\n    // This will work well\n    stytch.magicLinks.authenticate(...);\n  }, []);\n}\n\\`\\`\\`\n\nIf you want to make API calls from server environments, please use the Stytch Node Library\nhttps://www.npmjs.com/package/stytch.`;\n"],"names":["cannotInvokeMethodOnServerError","path"],"mappings":"AAAA;AAoBO,MAAMA,+BAAAA,GAAkC,CAACC,IAAAA,GAE1C,CAAC,8CAA8C,EAAEA,IAAAA,CAAAA,CAAK;;;;"}