@renterra/sdk 0.2.0 → 0.2.1

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/rest.js CHANGED
@@ -3,7 +3,10 @@ import { createBrowserOAuth } from "./browser-oauth.js";
3
3
  import { createResources } from "./generated/resources.js";
4
4
  import { createResourceTransport } from "./transport.js";
5
5
  export async function connectRenterra(options = {}) {
6
- const hosted = typeof window !== "undefined" && window.location.pathname.startsWith("/beta/artifact-file/");
6
+ const hosted = typeof window !== "undefined" &&
7
+ (window.location.hostname === "app.getrenterra.com" ||
8
+ window.location.hostname === "staging.renterra.engineering" ||
9
+ /^[a-z0-9-]+-renterra\.vercel\.app$/.test(window.location.hostname));
7
10
  const mode = options.mode ?? (hosted ? "session" : "oauth");
8
11
  if (mode === "session" && typeof window === "undefined")
9
12
  throw new Error("Session authentication requires the Renterra browser host");
@@ -24,6 +27,7 @@ export async function connectRenterra(options = {}) {
24
27
  fetch: async (request) => {
25
28
  const url = new URL(request.url);
26
29
  const headers = new Headers(request.headers);
30
+ headers.set("Renterra-Version", "1.0.0");
27
31
  if (mode === "session") {
28
32
  url.pathname = url.pathname.replace(/^\/v1(?=\/|$)/, "/v1/app");
29
33
  headers.delete("authorization");