@burdenoff/fe-libs 2026.719.4 → 2026.719.5
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.
|
@@ -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,CA4MpD,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
|
+
}), m && /* @__PURE__ */ o("div", {
|
|
86
87
|
className: "absolute right-0 mt-2 w-[calc(100vw-1.5rem)] sm:w-64 max-w-64 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
156
|
title: e.comingSoon ? "Coming soon" : void 0,
|
|
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 ===
|
|
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
|
+
/* @__PURE__ */ a("span", {
|
|
164
165
|
className: "flex-1 truncate text-left",
|
|
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
170
|
children: "Coming soon"
|
|
170
|
-
}) : e.id ===
|
|
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 };
|