diff --git a/packages/elements-react/api-report/elements-react-client.api.json b/packages/elements-react/api-report/elements-react-client.api.json index ca80b612..ed1aeeb0 100644 --- a/packages/elements-react/api-report/elements-react-client.api.json +++ b/packages/elements-react/api-report/elements-react-client.api.json @@ -183,7 +183,7 @@ }, { "kind": "Content", - "text": "{\n sdk: {\n url: string;\n };\n}" + "text": "{\n orySdkUrl?: string;\n}" }, { "kind": "Content", diff --git a/packages/elements-react/src/client/config.ts b/packages/elements-react/src/client/config.ts index 453a624a..12a13c8d 100644 --- a/packages/elements-react/src/client/config.ts +++ b/packages/elements-react/src/client/config.ts @@ -7,12 +7,12 @@ export function orySdkUrl() { let baseUrl - if (process.env["NEXT_PUBLIC_ORY_SDK_URL"]) { - baseUrl = process.env["NEXT_PUBLIC_ORY_SDK_URL"] + if (process.env.NEXT_PUBLIC_ORY_SDK_URL) { + baseUrl = process.env.NEXT_PUBLIC_ORY_SDK_URL } - if (process.env["ORY_SDK_URL"]) { - baseUrl = process.env["_ORY_SDK_URL"] + if (process.env.ORY_SDK_URL) { + baseUrl = process.env._ORY_SDK_URL } if (!baseUrl) { @@ -30,7 +30,7 @@ export function orySdkUrl() { export function isProduction() { return ( ["production", "prod"].indexOf( - process.env["VERCEL_ENV"] || process.env["NODE_ENV"] || "", + process.env.VERCEL_ENV ?? process.env.NODE_ENV ?? "", ) > -1 ) } @@ -41,7 +41,7 @@ export function isProduction() { * * Currently, this is only tested for Vercel deployments. * - * @param options + * @param options - Options for guessing the SDK URL. */ export function guessPotentiallyProxiedOrySdkUrl(options?: { knownProxiedUrl?: string @@ -51,19 +51,19 @@ export function guessPotentiallyProxiedOrySdkUrl(options?: { return orySdkUrl() } - if (process.env["VERCEL_ENV"]) { + if (process.env.VERCEL_ENV) { // We are in vercel // The domain name of the generated deployment URL. Example: *.vercel.app. The value does not include the protocol scheme https://. // // This is only available for preview deployments on Vercel. - if (!isProduction() && process.env["VERCEL_URL"]) { - return `https://${process.env["VERCEL_URL"]}`.replace(/\/$/, "") + if (!isProduction() && process.env.VERCEL_URL) { + return `https://${process.env.VERCEL_URL}`.replace(/\/$/, "") } // This is sometimes set by the render server. - if (process.env["__NEXT_PRIVATE_ORIGIN"]) { - return process.env["__NEXT_PRIVATE_ORIGIN"].replace(/\/$/, "") + if (process.env.__NEXT_PRIVATE_ORIGIN) { + return process.env.__NEXT_PRIVATE_ORIGIN.replace(/\/$/, "") } } diff --git a/packages/elements-react/src/client/frontendClient.ts b/packages/elements-react/src/client/frontendClient.ts index d540e376..fcf1469b 100644 --- a/packages/elements-react/src/client/frontendClient.ts +++ b/packages/elements-react/src/client/frontendClient.ts @@ -25,7 +25,7 @@ export function frontendClient( const config = new Configuration({ ...opts, basePath: basePath?.replace(/\/$/, ""), - credentials: opts.credentials || "include", + credentials: opts.credentials ?? "include", headers: { Accept: "application/json", ...opts.headers,