@singlebase/elements 0.1.0 → 0.3.0

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.
@@ -50,7 +50,7 @@ function Tr(i) {
50
50
  function Ur(i) {
51
51
  return i === "localhost" || i === "127.0.0.1" || i === "0.0.0.0";
52
52
  }
53
- const Bs = "https://v1.singlebase.io/api";
53
+ const Bs = "https://v1.api.singlebase.io";
54
54
  function Nr(i) {
55
55
  if (i.baseUrl === void 0) return Bs;
56
56
  if (i.baseUrl === null || String(i.baseUrl).trim() === "")
@@ -81,11 +81,8 @@ function Mr(i) {
81
81
  async function wi(i, t, e, s = {}) {
82
82
  const r = Lr(i), n = { operation: t, payload: e };
83
83
  s.options && (n.options = s.options);
84
- const a = {
85
- "Content-Type": "application/json",
86
- "X-API-Key": i.apiKey
87
- };
88
- s.token && (a.Authorization = `Bearer ${s.token}`);
84
+ const a = { "Content-Type": "application/json" };
85
+ i.apiKey && (a["X-API-Key"] = i.apiKey), s.token && (a.Authorization = `Bearer ${s.token}`);
89
86
  const o = i.fetch ?? globalThis.fetch;
90
87
  let c;
91
88
  try {
@@ -552,7 +549,7 @@ function en(i) {
552
549
  return [
553
550
  i.baseUrl ?? Bs,
554
551
  i.urlAccessKey ?? "",
555
- i.apiKey,
552
+ i.apiKey ?? "",
556
553
  i.audience ?? "web"
557
554
  ].join("|");
558
555
  }
@@ -7564,12 +7561,14 @@ j = st([
7564
7561
  et("singlebase-authui-display")
7565
7562
  ], j);
7566
7563
  function Na() {
7567
- const i = document.currentScript ?? document.querySelector("script[data-singlebase-api-key]");
7564
+ const i = document.currentScript ?? document.querySelector(
7565
+ "script[data-singlebase-api-key], script[data-singlebase-url-access-key], script[data-singlebase-base-url]"
7566
+ );
7568
7567
  if (!i) return null;
7569
- const { baseUrl: t, singlebaseUrlAccessKey: e, singlebaseApiKey: s, singlebaseBaseUrl: r } = i.dataset, n = s;
7570
- if (!n) return null;
7571
- const a = { apiKey: n }, o = r ?? t;
7572
- return o && (a.baseUrl = o), e && (a.urlAccessKey = e), a;
7568
+ const { baseUrl: t, singlebaseUrlAccessKey: e, singlebaseApiKey: s, singlebaseBaseUrl: r } = i.dataset, n = r ?? t;
7569
+ if (!s && !e && !n) return null;
7570
+ const a = {};
7571
+ return n && (a.baseUrl = n), e && (a.urlAccessKey = e), s && (a.apiKey = s), a;
7573
7572
  }
7574
7573
  if (typeof document < "u") {
7575
7574
  const i = Na();