@formant/data-sdk 1.48.0 → 1.49.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.
@@ -2,8 +2,16 @@ var Rn = Object.defineProperty;
2
2
  var Bn = (e, t, n) => t in e ? Rn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var he = (e, t, n) => (Bn(e, typeof t != "symbol" ? t + "" : t, n), n);
4
4
  const DEFAULT_FORMANT_API_URL = "https://api.formant.io";
5
- function whichFormantApiUrl(e, t) {
5
+ function whichFormantApiUrl(e, t, n) {
6
6
  try {
7
+ if (n) {
8
+ if (n.includes("app-dev.formant.io") || n.includes("localhost"))
9
+ return "https://api-dev.formant.io";
10
+ if (n.includes("app-stage.formant.io"))
11
+ return "https://api-stage.formant.io";
12
+ if (n.includes("app.formant.io"))
13
+ return "https://api.formant.local";
14
+ }
7
15
  if (t.get("formant_stage"))
8
16
  return "https://api-stage.formant.io";
9
17
  if (t.get("formant_dev"))
@@ -11,13 +19,13 @@ function whichFormantApiUrl(e, t) {
11
19
  if (t.get("formant_local"))
12
20
  return "https://api.formant.local";
13
21
  if (t.get("formant_url")) {
14
- const n = t.get("formant_url");
15
- if (n !== null)
22
+ const r = t.get("formant_url");
23
+ if (r !== null)
16
24
  try {
17
- return new URL(n).origin;
25
+ return new URL(r).origin;
18
26
  } catch {
19
27
  console.warn(
20
- `Ignoring malformed \`formant_url\` url parameter: ${n}`
28
+ `Ignoring malformed \`formant_url\` url parameter: ${r}`
21
29
  );
22
30
  }
23
31
  }
@@ -29,7 +37,8 @@ const FORMANT_API_URL = whichFormantApiUrl(
29
37
  typeof window != "undefined" ? window : globalThis,
30
38
  new URLSearchParams(
31
39
  typeof window != "undefined" && window.location ? window.location.search : void 0
32
- )
40
+ ),
41
+ typeof window != "undefined" && window.location ? window.location.host : void 0
33
42
  );
34
43
  var commonjsGlobal = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
35
44
  function getDefaultExportFromCjs(e) {