docthub-core-components 3.3.20 → 3.3.21
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
|
|
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) {
|
|
4
|
+
return f.some((o) => n === o);
|
|
5
|
+
}
|
|
6
|
+
function l(n) {
|
|
7
7
|
return n.endsWith(".com");
|
|
8
8
|
}
|
|
9
9
|
function p(n) {
|
|
10
10
|
return n.endsWith(".in");
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function s(n) {
|
|
13
13
|
const o = n.toLowerCase();
|
|
14
|
-
return
|
|
14
|
+
return d(o) ? "qa" : l(o) ? "production" : p(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
|
|
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
|
|
20
|
-
if (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (
|
|
20
|
+
var e;
|
|
21
|
+
const n = typeof import.meta < "u" ? import.meta : void 0, o = u((e = n == null ? void 0 : n.env) == null ? void 0 : e.VITE_NAV_ENV);
|
|
22
|
+
if (o !== null) return o;
|
|
23
|
+
if (typeof process < "u") {
|
|
24
|
+
const i = u(process.env.NEXT_PUBLIC_NAV_ENV);
|
|
25
|
+
if (i !== null) return i;
|
|
26
|
+
const t = process.env.NODE_ENV, r = u(t);
|
|
27
|
+
if (r !== null && !(t === "production" && typeof window < "u"))
|
|
28
|
+
return r;
|
|
25
29
|
}
|
|
26
30
|
return null;
|
|
27
31
|
}
|
|
28
|
-
function
|
|
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
|
|
37
|
+
return s(o);
|
|
34
38
|
} catch {
|
|
35
39
|
return null;
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
|
-
function
|
|
39
|
-
var o, e,
|
|
42
|
+
function c() {
|
|
43
|
+
var o, e, i;
|
|
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 =
|
|
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 =
|
|
51
|
+
const t = v();
|
|
48
52
|
if (t !== null) return t;
|
|
49
|
-
const
|
|
50
|
-
if ((e =
|
|
53
|
+
const r = typeof import.meta < "u" ? import.meta : void 0;
|
|
54
|
+
if ((e = r == null ? void 0 : r.env) != null && e.PROD || typeof process < "u" && ((i = process.env) == null ? void 0 : i.NODE_ENV) === "production") return "production";
|
|
51
55
|
}
|
|
52
56
|
return "qa";
|
|
53
57
|
}
|
|
54
|
-
function
|
|
55
|
-
return
|
|
58
|
+
function m() {
|
|
59
|
+
return c() === "production";
|
|
56
60
|
}
|
|
57
61
|
function E() {
|
|
58
|
-
return
|
|
62
|
+
return c() === "qa";
|
|
59
63
|
}
|
|
60
64
|
export {
|
|
61
|
-
|
|
65
|
+
m as isProdNav,
|
|
62
66
|
E as isQaNav,
|
|
63
|
-
|
|
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`
|
|
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
|
|
6
|
+
* 1. Explicit override — `VITE_NAV_ENV`, then `NEXT_PUBLIC_NAV_ENV`, then `NODE_ENV`
|
|
7
|
+
* (same values; `NEXT_PUBLIC_NAV_ENV` wins over `NODE_ENV` when both are 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"`
|
|
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";
|
package/dist/src/vite-env.d.ts
CHANGED
|
@@ -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
|
}
|