docthub-core-components 3.3.20 → 3.3.22

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.
@@ -1,64 +1,68 @@
1
1
  "use client";
2
- const c = ["localhost", "127.0.0.1", "[::1]"];
3
- function f(n) {
4
- return c.some((o) => n === o);
5
- }
2
+ const f = ["localhost", "127.0.0.1", "[::1]"];
6
3
  function d(n) {
7
- return n.endsWith(".com");
4
+ return f.some((o) => n === o);
8
5
  }
9
6
  function p(n) {
7
+ return n.endsWith(".com");
8
+ }
9
+ function l(n) {
10
10
  return n.endsWith(".in");
11
11
  }
12
- function u(n) {
12
+ function s(n) {
13
13
  const o = n.toLowerCase();
14
- return f(o) ? "qa" : d(o) ? "production" : p(o) ? "qa" : null;
14
+ return d(o) ? "qa" : p(o) ? "production" : l(o) ? "qa" : null;
15
+ }
16
+ function u(n) {
17
+ return n ? n === "production" || n === "prod" ? "production" : n === "qa" || n === "dev" ? "qa" : null : null;
15
18
  }
16
19
  function a() {
17
- var e, r;
18
- const n = typeof import.meta < "u" ? import.meta : void 0, o = (e = n == null ? void 0 : n.env) == null ? void 0 : e.VITE_NAV_ENV;
19
- if (o === "production" || o === "prod") return "production";
20
- if (o === "qa" || o === "dev") return "qa";
21
- if (typeof process < "u" && ((r = process.env) != null && r.NEXT_PUBLIC_NAV_ENV)) {
22
- const t = process.env.NEXT_PUBLIC_NAV_ENV;
23
- if (t === "production" || t === "prod") return "production";
20
+ var r;
21
+ const n = typeof import.meta < "u" ? import.meta : void 0, o = u((r = n == null ? void 0 : n.env) == null ? void 0 : r.VITE_NAV_ENV);
22
+ if (o !== null) return o;
23
+ if (typeof process < "u") {
24
+ const e = u(process.env.NEXT_PUBLIC_NAV_ENV);
25
+ if (e !== null) return e;
26
+ const t = process.env.NODE_ENV;
24
27
  if (t === "qa" || t === "dev") return "qa";
28
+ if (t === "prod") return "production";
25
29
  }
26
30
  return null;
27
31
  }
28
- function l() {
32
+ function v() {
29
33
  var n;
30
34
  if (typeof process > "u" || !((n = process.env) != null && n.NEXT_PUBLIC_BASE_URL)) return null;
31
35
  try {
32
36
  const o = new URL(process.env.NEXT_PUBLIC_BASE_URL).hostname;
33
- return u(o);
37
+ return s(o);
34
38
  } catch {
35
39
  return null;
36
40
  }
37
41
  }
38
- function s() {
39
- var o, e, r;
42
+ function c() {
43
+ var o, r, e;
40
44
  const n = a();
41
45
  if (n !== null) return n;
42
46
  if (typeof window < "u" && ((o = window.location) != null && o.hostname)) {
43
- const t = u(window.location.hostname);
47
+ const t = s(window.location.hostname);
44
48
  if (t !== null) return t;
45
49
  }
46
50
  if (typeof window > "u") {
47
- const t = l();
51
+ const t = v();
48
52
  if (t !== null) return t;
49
53
  const i = typeof import.meta < "u" ? import.meta : void 0;
50
- if ((e = i == null ? void 0 : i.env) != null && e.PROD || typeof process < "u" && ((r = process.env) == null ? void 0 : r.NODE_ENV) === "production") return "production";
54
+ if ((r = i == null ? void 0 : i.env) != null && r.PROD || typeof process < "u" && ((e = process.env) == null ? void 0 : e.NODE_ENV) === "production") return "production";
51
55
  }
52
56
  return "qa";
53
57
  }
54
- function v() {
55
- return s() === "production";
56
- }
57
58
  function E() {
58
- return s() === "qa";
59
+ return c() === "production";
60
+ }
61
+ function m() {
62
+ return c() === "qa";
59
63
  }
60
64
  export {
61
- v as isProdNav,
62
- E as isQaNav,
63
- s as resolveNavEnv
65
+ E as isProdNav,
66
+ m as isQaNav,
67
+ c as resolveNavEnv
64
68
  };
@@ -65,8 +65,8 @@ export declare function getFooterRoutes(): FooterRoutes;
65
65
  * @deprecated Use {@link getFooterRoutes} instead.
66
66
  *
67
67
  * Module-level constant — evaluated once at import time. In SSR contexts
68
- * (Next.js SSR) `window` is unavailable. Without `NEXT_PUBLIC_NAV_ENV` or
69
- * `NEXT_PUBLIC_BASE_URL` (hostname *.in / *.com), `resolveNavEnv()` falls back
68
+ * (Next.js SSR) `window` is unavailable. Without `NEXT_PUBLIC_NAV_ENV`, `NODE_ENV=qa`,
69
+ * or `NEXT_PUBLIC_BASE_URL` (hostname *.in / *.com), `resolveNavEnv()` falls back
70
70
  * to `import.meta.env.PROD` / `NODE_ENV === "production"`, which can point QA
71
71
  * builds at production URLs. Prefer `getFooterRoutes()` at render time and set
72
72
  * those env vars for correct SSR on QA.
@@ -3,11 +3,12 @@
3
3
  * Used by both individual and organization nav menus.
4
4
  *
5
5
  * Resolution order:
6
- * 1. Explicit override — `VITE_NAV_ENV` (Vite) or `NEXT_PUBLIC_NAV_ENV` (Next.js)
6
+ * 1. Explicit override — `VITE_NAV_ENV`, then `NEXT_PUBLIC_NAV_ENV`, then custom
7
+ * `NODE_ENV` (`qa` / `dev` / `prod` only; `NEXT_PUBLIC_NAV_ENV` wins when both set)
7
8
  * 2. `window.location.hostname` — localhost → QA; *.com → prod; *.in → QA
8
9
  * 3. SSR only — parse `NEXT_PUBLIC_BASE_URL` hostname (Next.js) when `window` is unavailable
9
10
  * 4. `import.meta.env.PROD` — Vite prod build (SSR fallback)
10
- * 5. `process.env.NODE_ENV === "production"` Node/Next SSR fallback
11
+ * 5. SSR only — `process.env.NODE_ENV === "production"` (standard Node prod builds)
11
12
  * 6. Default → QA
12
13
  */
13
14
  export declare function resolveNavEnv(): "qa" | "production";
@@ -7,7 +7,10 @@ interface ImportMetaEnv {
7
7
  /** Used when this package is consumed from Next.js (SSR resolves `process.env`). */
8
8
  declare namespace NodeJS {
9
9
  interface ProcessEnv {
10
+ /** Nav env override (Next.js). Takes precedence over `NODE_ENV`. */
10
11
  readonly NEXT_PUBLIC_NAV_ENV?: "qa" | "dev" | "production" | "prod";
12
+ /** Nav env override when set to `qa`, `dev`, or `prod`. Coexists with `NEXT_PUBLIC_NAV_ENV`. */
13
+ readonly NODE_ENV?: "qa" | "dev" | "production" | "prod";
11
14
  readonly NEXT_PUBLIC_BASE_URL?: string;
12
15
  }
13
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docthub-core-components",
3
- "version": "3.3.20",
3
+ "version": "3.3.22",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",