@burdenoff/fe-libs 2026.719.4 → 2026.719.6
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/chrome/ProductSwitcher.d.ts +6 -4
- package/dist/chrome/ProductSwitcher.d.ts.map +1 -1
- package/dist/chrome/ProductSwitcher.js +50 -49
- package/dist/shared/config/products.d.ts +10 -0
- package/dist/shared/config/products.d.ts.map +1 -1
- package/dist/shared/config/products.js +6 -2
- package/dist/shared/hooks/shell/useProducts.d.ts.map +1 -1
- package/dist/shared/hooks/shell/useProducts.js +44 -66
- package/package.json +1 -1
|
@@ -34,10 +34,12 @@ export declare function filterProducts<T extends {
|
|
|
34
34
|
/**
|
|
35
35
|
* Resolve the product to render as "current" in the switcher trigger.
|
|
36
36
|
*
|
|
37
|
-
*
|
|
38
|
-
* product
|
|
39
|
-
*
|
|
40
|
-
*
|
|
37
|
+
* Prefers the passed list (e.g. the API-driven access list). If the shell's own
|
|
38
|
+
* product isn't in that list — common for shells whose product isn't returned
|
|
39
|
+
* by `myAccessibleProducts` — fall back to the shared product catalog so the
|
|
40
|
+
* chip still shows the real display name + logo (derived from its app URL)
|
|
41
|
+
* instead of a bare slug + initial. Only when the slug is entirely unknown do we
|
|
42
|
+
* synthesize a neutral entry; `products[0]` is used only when no slug is given.
|
|
41
43
|
*/
|
|
42
44
|
export declare function resolveCurrentProduct(products: Product[], currentProductId?: string): Product | undefined;
|
|
43
45
|
export interface ProductSwitcherProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductSwitcher.d.ts","sourceRoot":"","sources":["../../src/chrome/ProductSwitcher.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ProductSwitcher.d.ts","sourceRoot":"","sources":["../../src/chrome/ProductSwitcher.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAUhC,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,GAAG,MAAM,GAAG,SAAS,CAKrB;AA0CD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,EACzF,QAAQ,EAAE,CAAC,EAAE,EACb,KAAK,EAAE,MAAM,GACZ,CAAC,EAAE,CASL;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,OAAO,EAAE,EACnB,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,GAAG,SAAS,CAOrB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,4CAA4C;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CA6MpD,CAAC"}
|
|
@@ -1,44 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getProductsWithUrls as e } from "../shared/config/products.js";
|
|
2
|
+
import { useEffect as t, useMemo as n, useRef as r, useState as i } from "react";
|
|
3
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
3
4
|
//#region src/chrome/ProductSwitcher.tsx
|
|
4
|
-
var
|
|
5
|
-
function
|
|
5
|
+
var s = 6;
|
|
6
|
+
function c(e) {
|
|
6
7
|
if (e?.logoUrl) return e.logoUrl;
|
|
7
8
|
let t = e?.url;
|
|
8
9
|
if (!(!t || t === "#")) return `${t.replace(/\/+$/, "")}/icons/icon.svg`;
|
|
9
10
|
}
|
|
10
|
-
var
|
|
11
|
-
let [
|
|
12
|
-
return /* @__PURE__ */
|
|
11
|
+
var l = ({ product: e, sizeClass: t, textClass: n }) => {
|
|
12
|
+
let [r, o] = i(!1), s = c(e), l = !!s && !r;
|
|
13
|
+
return /* @__PURE__ */ a("div", {
|
|
13
14
|
className: `${t} rounded-md flex items-center justify-center flex-shrink-0 overflow-hidden ${l ? "bg-white p-0.5 ring-1 ring-border-default dark:ring-border-strong" : `text-text-inverse font-semibold ${n}`}`,
|
|
14
15
|
style: l ? void 0 : { backgroundColor: e?.color || "var(--color-action-primary-bg)" },
|
|
15
|
-
children: l ? /* @__PURE__ */
|
|
16
|
-
src:
|
|
16
|
+
children: l ? /* @__PURE__ */ a("img", {
|
|
17
|
+
src: s,
|
|
17
18
|
alt: e?.name ?? "",
|
|
18
19
|
className: "size-full object-contain",
|
|
19
20
|
onError: () => o(!0)
|
|
20
21
|
}) : e?.icon || e?.name.charAt(0)
|
|
21
22
|
});
|
|
22
23
|
};
|
|
23
|
-
function
|
|
24
|
+
function u(e, t) {
|
|
24
25
|
let n = t.trim().toLowerCase();
|
|
25
26
|
return n ? e.filter((e) => e.name.toLowerCase().includes(n) || e.id.toLowerCase().includes(n) || (e.description ? e.description.toLowerCase().includes(n) : !1)) : e;
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
-
return
|
|
29
|
-
id:
|
|
30
|
-
name:
|
|
28
|
+
function d(t, n) {
|
|
29
|
+
return t.find((e) => e.id === n) || (n ? e().find((e) => e.id === n) || {
|
|
30
|
+
id: n,
|
|
31
|
+
name: n,
|
|
31
32
|
url: "#"
|
|
32
|
-
} :
|
|
33
|
+
} : t[0]);
|
|
33
34
|
}
|
|
34
|
-
var
|
|
35
|
-
let [m, h] =
|
|
36
|
-
|
|
35
|
+
var f = ({ products: e, currentProductId: c, onProductChange: f, compact: p = !1 }) => {
|
|
36
|
+
let [m, h] = i(!1), [g, _] = i(""), v = r(null), y = r(null), b = d(e, c), x = e.length > s, S = n(() => u(e, g), [e, g]);
|
|
37
|
+
t(() => {
|
|
37
38
|
let e = (e) => {
|
|
38
39
|
v.current && !v.current.contains(e.target) && h(!1);
|
|
39
40
|
};
|
|
40
41
|
if (m) return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
41
|
-
}, [m]),
|
|
42
|
+
}, [m]), t(() => {
|
|
42
43
|
if (!m) {
|
|
43
44
|
_("");
|
|
44
45
|
return;
|
|
@@ -51,30 +52,30 @@ var d = ({ products: s, currentProductId: d, onProductChange: f, compact: p = !1
|
|
|
51
52
|
let C = (e) => {
|
|
52
53
|
e.comingSoon || (f ? f(e) : window.location.href = e.url, h(!1));
|
|
53
54
|
};
|
|
54
|
-
return /* @__PURE__ */
|
|
55
|
+
return /* @__PURE__ */ o("div", {
|
|
55
56
|
className: "relative",
|
|
56
57
|
ref: v,
|
|
57
|
-
children: [/* @__PURE__ */
|
|
58
|
+
children: [/* @__PURE__ */ o("button", {
|
|
58
59
|
onClick: () => h(!m),
|
|
59
60
|
className: `flex items-center gap-2 px-3 py-2 rounded-button hover:bg-bg-sunken transition-colors ${m ? "bg-bg-sunken" : ""}`,
|
|
60
61
|
"aria-label": "Switch product",
|
|
61
62
|
"aria-expanded": m,
|
|
62
63
|
children: [
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
+
/* @__PURE__ */ a(l, {
|
|
64
65
|
product: b,
|
|
65
66
|
sizeClass: "size-6",
|
|
66
67
|
textClass: "text-xs"
|
|
67
68
|
}),
|
|
68
|
-
!p && /* @__PURE__ */
|
|
69
|
+
!p && /* @__PURE__ */ a("span", {
|
|
69
70
|
className: "text-body-sm font-medium text-text-primary",
|
|
70
71
|
children: b?.name
|
|
71
72
|
}),
|
|
72
|
-
!p && /* @__PURE__ */
|
|
73
|
+
!p && /* @__PURE__ */ a("svg", {
|
|
73
74
|
className: `w-4 h-4 text-text-secondary transition-transform ${m ? "rotate-180" : ""}`,
|
|
74
75
|
fill: "none",
|
|
75
76
|
stroke: "currentColor",
|
|
76
77
|
viewBox: "0 0 24 24",
|
|
77
|
-
children: /* @__PURE__ */
|
|
78
|
+
children: /* @__PURE__ */ a("path", {
|
|
78
79
|
strokeLinecap: "round",
|
|
79
80
|
strokeLinejoin: "round",
|
|
80
81
|
strokeWidth: 2,
|
|
@@ -82,32 +83,32 @@ var d = ({ products: s, currentProductId: d, onProductChange: f, compact: p = !1
|
|
|
82
83
|
})
|
|
83
84
|
})
|
|
84
85
|
]
|
|
85
|
-
}), m && /* @__PURE__ */
|
|
86
|
-
className: "absolute right-0 mt-2 w-[calc(100vw-1.5rem)] sm:w-
|
|
86
|
+
}), m && /* @__PURE__ */ o("div", {
|
|
87
|
+
className: "absolute right-0 mt-2 w-[calc(100vw-1.5rem)] sm:w-72 max-w-72 bg-bg-elevated border border-border-subtle rounded-card shadow-[var(--shadow-elevation-4)] z-50 py-2 overflow-hidden animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 duration-200",
|
|
87
88
|
children: [
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ a("div", {
|
|
89
90
|
className: "px-4 py-2 border-b border-border-subtle",
|
|
90
|
-
children: /* @__PURE__ */
|
|
91
|
+
children: /* @__PURE__ */ a("p", {
|
|
91
92
|
className: "text-[11px] font-medium text-text-muted uppercase tracking-wider",
|
|
92
93
|
children: "Switch Product"
|
|
93
94
|
})
|
|
94
95
|
}),
|
|
95
|
-
x && /* @__PURE__ */
|
|
96
|
+
x && /* @__PURE__ */ o("div", {
|
|
96
97
|
className: "relative px-3 py-2 border-b border-border-subtle",
|
|
97
98
|
children: [
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ a("svg", {
|
|
99
100
|
className: "pointer-events-none absolute left-6 top-1/2 -translate-y-1/2 size-4 text-text-muted",
|
|
100
101
|
fill: "none",
|
|
101
102
|
stroke: "currentColor",
|
|
102
103
|
viewBox: "0 0 24 24",
|
|
103
|
-
children: /* @__PURE__ */
|
|
104
|
+
children: /* @__PURE__ */ a("path", {
|
|
104
105
|
strokeLinecap: "round",
|
|
105
106
|
strokeLinejoin: "round",
|
|
106
107
|
strokeWidth: 2,
|
|
107
108
|
d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
|
|
108
109
|
})
|
|
109
110
|
}),
|
|
110
|
-
/* @__PURE__ */
|
|
111
|
+
/* @__PURE__ */ a("input", {
|
|
111
112
|
ref: y,
|
|
112
113
|
type: "text",
|
|
113
114
|
value: g,
|
|
@@ -119,17 +120,17 @@ var d = ({ products: s, currentProductId: d, onProductChange: f, compact: p = !1
|
|
|
119
120
|
"aria-label": "Search products",
|
|
120
121
|
className: "w-full rounded-md border border-border-subtle bg-bg-surface py-2 pl-9 pr-8 text-sm text-text-primary placeholder:text-text-muted transition-all duration-200 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-[var(--color-action-primary-border)]"
|
|
121
122
|
}),
|
|
122
|
-
g && /* @__PURE__ */
|
|
123
|
+
g && /* @__PURE__ */ a("button", {
|
|
123
124
|
type: "button",
|
|
124
125
|
onClick: () => _(""),
|
|
125
126
|
"aria-label": "Clear search",
|
|
126
127
|
className: "absolute right-5 top-1/2 -translate-y-1/2 rounded-button p-1 text-text-muted transition-colors hover:bg-bg-sunken hover:text-text-primary",
|
|
127
|
-
children: /* @__PURE__ */
|
|
128
|
+
children: /* @__PURE__ */ a("svg", {
|
|
128
129
|
className: "size-4",
|
|
129
130
|
fill: "none",
|
|
130
131
|
stroke: "currentColor",
|
|
131
132
|
viewBox: "0 0 24 24",
|
|
132
|
-
children: /* @__PURE__ */
|
|
133
|
+
children: /* @__PURE__ */ a("path", {
|
|
133
134
|
strokeLinecap: "round",
|
|
134
135
|
strokeLinejoin: "round",
|
|
135
136
|
strokeWidth: 2,
|
|
@@ -139,39 +140,39 @@ var d = ({ products: s, currentProductId: d, onProductChange: f, compact: p = !1
|
|
|
139
140
|
})
|
|
140
141
|
]
|
|
141
142
|
}),
|
|
142
|
-
/* @__PURE__ */
|
|
143
|
+
/* @__PURE__ */ o("div", {
|
|
143
144
|
className: "py-1 max-h-96 overflow-y-auto",
|
|
144
|
-
children: [S.length === 0 && /* @__PURE__ */
|
|
145
|
+
children: [S.length === 0 && /* @__PURE__ */ o("p", {
|
|
145
146
|
className: "px-4 py-6 text-center text-body-sm text-text-muted",
|
|
146
147
|
children: [
|
|
147
148
|
"No products match “",
|
|
148
149
|
g,
|
|
149
150
|
"”"
|
|
150
151
|
]
|
|
151
|
-
}), S.map((e) => /* @__PURE__ */
|
|
152
|
+
}), S.map((e) => /* @__PURE__ */ o("button", {
|
|
152
153
|
onClick: () => C(e),
|
|
153
154
|
disabled: e.comingSoon,
|
|
154
155
|
"aria-disabled": e.comingSoon,
|
|
155
|
-
title: e.comingSoon ? "
|
|
156
|
-
className: `w-full flex items-center gap-3 px-4 py-2.5 text-body-sm transition-colors ${e.comingSoon ? "text-text-muted cursor-not-allowed opacity-60" : e.id ===
|
|
156
|
+
title: e.comingSoon ? "Soon" : e.name,
|
|
157
|
+
className: `w-full flex items-center gap-3 px-4 py-2.5 text-body-sm transition-colors ${e.comingSoon ? "text-text-muted cursor-not-allowed opacity-60" : e.id === c ? "bg-[var(--color-accent-soft)] text-text-primary font-medium" : "text-text-primary hover:bg-bg-sunken"}`,
|
|
157
158
|
children: [
|
|
158
|
-
/* @__PURE__ */
|
|
159
|
+
/* @__PURE__ */ a(l, {
|
|
159
160
|
product: e,
|
|
160
161
|
sizeClass: "size-8",
|
|
161
162
|
textClass: "text-sm"
|
|
162
163
|
}),
|
|
163
|
-
/* @__PURE__ */
|
|
164
|
-
className: "flex-1
|
|
164
|
+
/* @__PURE__ */ a("span", {
|
|
165
|
+
className: "flex-1 text-left leading-tight",
|
|
165
166
|
children: e.name
|
|
166
167
|
}),
|
|
167
|
-
e.comingSoon ? /* @__PURE__ */
|
|
168
|
+
e.comingSoon ? /* @__PURE__ */ a("span", {
|
|
168
169
|
className: "shrink-0 whitespace-nowrap rounded-full border border-border-subtle bg-bg-sunken px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-text-secondary",
|
|
169
|
-
children: "
|
|
170
|
-
}) : e.id ===
|
|
170
|
+
children: "Soon"
|
|
171
|
+
}) : e.id === c && /* @__PURE__ */ a("svg", {
|
|
171
172
|
className: "size-5 text-action-primary-bg",
|
|
172
173
|
fill: "currentColor",
|
|
173
174
|
viewBox: "0 0 20 20",
|
|
174
|
-
children: /* @__PURE__ */
|
|
175
|
+
children: /* @__PURE__ */ a("path", {
|
|
175
176
|
fillRule: "evenodd",
|
|
176
177
|
d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
|
|
177
178
|
clipRule: "evenodd"
|
|
@@ -185,4 +186,4 @@ var d = ({ products: s, currentProductId: d, onProductChange: f, compact: p = !1
|
|
|
185
186
|
});
|
|
186
187
|
};
|
|
187
188
|
//#endregion
|
|
188
|
-
export {
|
|
189
|
+
export { f as ProductSwitcher, u as filterProducts, c as resolveProductLogo };
|
|
@@ -68,6 +68,16 @@ export declare const PRODUCT_URLS: {
|
|
|
68
68
|
};
|
|
69
69
|
export declare const PRODUCTS: ProductConfig[];
|
|
70
70
|
export declare function getProductUrl(productId: string): string;
|
|
71
|
+
/**
|
|
72
|
+
* Absolute logo URL for a product — ALWAYS the production app's
|
|
73
|
+
* `/icons/icon.svg`, regardless of the current environment.
|
|
74
|
+
*
|
|
75
|
+
* The cross-product switcher renders logos for OTHER products, whose assets
|
|
76
|
+
* only exist at their production domains. It must not use the env-aware
|
|
77
|
+
* `getProductUrl` (which returns `localhost:*` in dev, or `#` for ids missing
|
|
78
|
+
* from the dev map) — that produced broken/absent logos for several products.
|
|
79
|
+
*/
|
|
80
|
+
export declare function getProductLogoUrl(productId: string): string | undefined;
|
|
71
81
|
/**
|
|
72
82
|
* Get all products with environment-aware URLs.
|
|
73
83
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../../src/shared/config/products.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDf,CAAC;AAEX,eAAO,MAAM,QAAQ,EAAE,aAAa,EAkTnC,CAAC;AAOF,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAIvD;AAED;;GAEG;AACH,wBAAgB,mBAAmB;;
|
|
1
|
+
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../../src/shared/config/products.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDf,CAAC;AAEX,eAAO,MAAM,QAAQ,EAAE,aAAa,EAkTnC,CAAC;AAOF,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAIvD;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGvE;AAED;;GAEG;AACH,wBAAgB,mBAAmB;;QAhZ7B,MAAM;UACJ,MAAM;UACN,MAAM;WACL,MAAM;kBACC,MAAM;IACpB;;;;;OAKG;iBACU,OAAO;IAuYrB"}
|
|
@@ -357,11 +357,15 @@ function n() {
|
|
|
357
357
|
function r(t) {
|
|
358
358
|
return e[n()][t] || "#";
|
|
359
359
|
}
|
|
360
|
-
function i() {
|
|
360
|
+
function i(t) {
|
|
361
|
+
let n = e.production[t];
|
|
362
|
+
return n ? `${n}icons/icon.svg` : void 0;
|
|
363
|
+
}
|
|
364
|
+
function a() {
|
|
361
365
|
return t.map((e) => ({
|
|
362
366
|
...e,
|
|
363
367
|
url: r(e.id)
|
|
364
368
|
}));
|
|
365
369
|
}
|
|
366
370
|
//#endregion
|
|
367
|
-
export { t as PRODUCTS, e as PRODUCT_URLS, r as getProductUrl,
|
|
371
|
+
export { t as PRODUCTS, e as PRODUCT_URLS, i as getProductLogoUrl, r as getProductUrl, a as getProductsWithUrls };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProducts.d.ts","sourceRoot":"","sources":["../../../../src/shared/hooks/shell/useProducts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA8DH,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iFAAiF;IACjF,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"useProducts.d.ts","sourceRoot":"","sources":["../../../../src/shared/hooks/shell/useProducts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA8DH,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iFAAiF;IACjF,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAeD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,iBAAiB,CAsE3E"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { PRODUCTS as e,
|
|
2
|
-
import { useGatewayClient as
|
|
1
|
+
import { PRODUCTS as e, getProductLogoUrl as t, getProductUrl as n } from "../../config/products.js";
|
|
2
|
+
import { useGatewayClient as r } from "../../graphql/GatewayContext.js";
|
|
3
3
|
import "../../../shared-graphql.js";
|
|
4
|
-
import { useCallback as
|
|
5
|
-
import { gql as
|
|
4
|
+
import { useCallback as i, useEffect as a, useState as o } from "react";
|
|
5
|
+
import { gql as s } from "@apollo/client/core";
|
|
6
6
|
//#region src/shared/hooks/shell/useProducts.ts
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
return
|
|
7
|
+
var c = new Set(e.map((e) => e.id)), l = new Map(e.map((e) => [e.id, e.comingSoon === !0]));
|
|
8
|
+
function u(e, t, n) {
|
|
9
|
+
return l.get(e) ? !0 : t !== "ACTIVE" || !n;
|
|
10
10
|
}
|
|
11
|
-
var
|
|
11
|
+
var d = s`
|
|
12
12
|
query GetAccessibleProducts($limit: Int, $offset: Int) {
|
|
13
13
|
myAccessibleProducts(limit: $limit, offset: $offset) {
|
|
14
14
|
items {
|
|
@@ -25,84 +25,62 @@ var u = o`
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
`;
|
|
28
|
-
function
|
|
29
|
-
return
|
|
28
|
+
function f(e) {
|
|
29
|
+
return c.has(e);
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
fluidgrids: "#3b82f6",
|
|
33
|
-
bigconsole: "#8b5cf6",
|
|
34
|
-
workspaces: "#06b6d4",
|
|
35
|
-
vibecontrols: "#10b981",
|
|
36
|
-
botlit: "#f59e0b"
|
|
37
|
-
}, p = "#6b7280";
|
|
38
|
-
function m(e, t) {
|
|
39
|
-
let n = {
|
|
40
|
-
fluidgrids: "FG",
|
|
41
|
-
bigconsole: "BC",
|
|
42
|
-
workspaces: "WS",
|
|
43
|
-
vibecontrols: "VC",
|
|
44
|
-
botlit: "BL"
|
|
45
|
-
};
|
|
46
|
-
if (n[t]) return n[t];
|
|
47
|
-
let r = e.split(/\s+/);
|
|
48
|
-
return r.length >= 2 ? (r[0][0] + r[1][0]).toUpperCase() : e.substring(0, 2).toUpperCase();
|
|
49
|
-
}
|
|
50
|
-
function h(e, t) {
|
|
51
|
-
return t?.color && typeof t.color == "string" ? t.color : f[e] || p;
|
|
52
|
-
}
|
|
53
|
-
function g(e) {
|
|
54
|
-
if (e) return `${e.replace(/\/+$/, "")}/icons/icon.svg`;
|
|
55
|
-
}
|
|
56
|
-
function _() {
|
|
31
|
+
function p() {
|
|
57
32
|
return e.map((e) => ({
|
|
58
33
|
id: e.id,
|
|
59
34
|
name: e.name,
|
|
60
|
-
url:
|
|
35
|
+
url: n(e.id),
|
|
61
36
|
icon: e.icon,
|
|
62
37
|
color: e.color,
|
|
63
|
-
logoUrl:
|
|
64
|
-
comingSoon: e.comingSoon
|
|
38
|
+
logoUrl: t(e.id),
|
|
39
|
+
comingSoon: e.comingSoon === !0
|
|
65
40
|
}));
|
|
66
41
|
}
|
|
67
|
-
function
|
|
68
|
-
let
|
|
69
|
-
|
|
42
|
+
function m(s) {
|
|
43
|
+
let c = r("global"), [l, m] = o(p()), [h, g] = o(s?.autoFetch !== !1), [_, v] = o(null), y = i(async () => {
|
|
44
|
+
g(!0), v(null);
|
|
70
45
|
try {
|
|
71
|
-
let
|
|
72
|
-
query:
|
|
46
|
+
let r = (await c.query({
|
|
47
|
+
query: d,
|
|
73
48
|
variables: {
|
|
74
49
|
limit: 50,
|
|
75
50
|
offset: 0
|
|
76
51
|
},
|
|
77
52
|
fetchPolicy: "cache-first"
|
|
78
|
-
})).data?.myAccessibleProducts?.items || []
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
53
|
+
})).data?.myAccessibleProducts?.items || [], i = new Map(r.filter((e) => f(e.slug)).map((e) => [e.slug, e])), a = e.map((e) => {
|
|
54
|
+
let r = i.get(e.id);
|
|
55
|
+
return {
|
|
56
|
+
id: e.id,
|
|
57
|
+
name: e.name,
|
|
58
|
+
url: r?.appUrl || n(e.id),
|
|
59
|
+
icon: e.icon,
|
|
60
|
+
color: r?.metadata && typeof r.metadata.color == "string" ? r.metadata.color : e.color,
|
|
61
|
+
logoUrl: t(e.id),
|
|
62
|
+
comingSoon: r ? u(e.id, r.status, r.appUrl) : e.comingSoon === !0
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
a.sort((e, t) => e.name.localeCompare(t.name)), m(a);
|
|
88
66
|
} catch (e) {
|
|
89
|
-
|
|
67
|
+
v(e instanceof Error ? e.message : "Failed to fetch products"), m(p());
|
|
90
68
|
} finally {
|
|
91
|
-
|
|
69
|
+
g(!1);
|
|
92
70
|
}
|
|
93
|
-
}, [
|
|
94
|
-
return
|
|
95
|
-
if (
|
|
96
|
-
|
|
71
|
+
}, [c]);
|
|
72
|
+
return a(() => {
|
|
73
|
+
if (s?.autoFetch === !1) {
|
|
74
|
+
g(!1);
|
|
97
75
|
return;
|
|
98
76
|
}
|
|
99
|
-
|
|
77
|
+
y();
|
|
100
78
|
}, []), {
|
|
101
|
-
products:
|
|
102
|
-
isLoading:
|
|
103
|
-
error:
|
|
104
|
-
refetch:
|
|
79
|
+
products: l,
|
|
80
|
+
isLoading: h,
|
|
81
|
+
error: _,
|
|
82
|
+
refetch: y
|
|
105
83
|
};
|
|
106
84
|
}
|
|
107
85
|
//#endregion
|
|
108
|
-
export {
|
|
86
|
+
export { m as useProducts };
|