@burdenoff/fe-libs 2026.601.14 → 2026.608.1
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProducts.d.ts","sourceRoot":"","sources":["../../../../src/shared/hooks/shell/useProducts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
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,iFAAiF;IACjF,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAiDD,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,CAyD3E"}
|
|
@@ -4,7 +4,11 @@ import "../../../shared-graphql.js";
|
|
|
4
4
|
import { useCallback as r, useEffect as i, useState as a } from "react";
|
|
5
5
|
import { gql as o } from "@apollo/client/core";
|
|
6
6
|
//#region src/shared/hooks/shell/useProducts.ts
|
|
7
|
-
var s = new Set(e.map((e) => e.id)), c =
|
|
7
|
+
var s = new Set(e.map((e) => e.id)), c = new Map(e.map((e) => [e.id, e.comingSoon === !0]));
|
|
8
|
+
function l(e, t, n) {
|
|
9
|
+
return c.get(e) ? !0 : t !== "ACTIVE" || !n;
|
|
10
|
+
}
|
|
11
|
+
var u = o`
|
|
8
12
|
query GetAccessibleProducts($limit: Int, $offset: Int) {
|
|
9
13
|
myAccessibleProducts(limit: $limit, offset: $offset) {
|
|
10
14
|
items {
|
|
@@ -21,17 +25,17 @@ var s = new Set(e.map((e) => e.id)), c = o`
|
|
|
21
25
|
}
|
|
22
26
|
}
|
|
23
27
|
`;
|
|
24
|
-
function
|
|
28
|
+
function d(e) {
|
|
25
29
|
return s.has(e);
|
|
26
30
|
}
|
|
27
|
-
var
|
|
31
|
+
var f = {
|
|
28
32
|
fluidgrids: "#3b82f6",
|
|
29
33
|
bigconsole: "#8b5cf6",
|
|
30
34
|
workspaces: "#06b6d4",
|
|
31
35
|
vibecontrols: "#10b981",
|
|
32
36
|
botlit: "#f59e0b"
|
|
33
|
-
},
|
|
34
|
-
function
|
|
37
|
+
}, p = "#6b7280";
|
|
38
|
+
function m(e, t) {
|
|
35
39
|
let n = {
|
|
36
40
|
fluidgrids: "FG",
|
|
37
41
|
bigconsole: "BC",
|
|
@@ -43,55 +47,57 @@ function f(e, t) {
|
|
|
43
47
|
let r = e.split(/\s+/);
|
|
44
48
|
return r.length >= 2 ? (r[0][0] + r[1][0]).toUpperCase() : e.substring(0, 2).toUpperCase();
|
|
45
49
|
}
|
|
46
|
-
function
|
|
47
|
-
return t?.color && typeof t.color == "string" ? t.color :
|
|
50
|
+
function h(e, t) {
|
|
51
|
+
return t?.color && typeof t.color == "string" ? t.color : f[e] || p;
|
|
48
52
|
}
|
|
49
|
-
function
|
|
53
|
+
function g() {
|
|
50
54
|
return e.map((e) => ({
|
|
51
55
|
id: e.id,
|
|
52
56
|
name: e.name,
|
|
53
57
|
url: t(e.id),
|
|
54
58
|
icon: e.icon,
|
|
55
|
-
color: e.color
|
|
59
|
+
color: e.color,
|
|
60
|
+
comingSoon: e.comingSoon
|
|
56
61
|
}));
|
|
57
62
|
}
|
|
58
|
-
function
|
|
59
|
-
let
|
|
60
|
-
|
|
63
|
+
function _(e) {
|
|
64
|
+
let o = n("global"), [s, c] = a(g()), [f, p] = a(e?.autoFetch !== !1), [_, v] = a(null), y = r(async () => {
|
|
65
|
+
p(!0), v(null);
|
|
61
66
|
try {
|
|
62
|
-
let e = ((await
|
|
63
|
-
query:
|
|
67
|
+
let e = ((await o.query({
|
|
68
|
+
query: u,
|
|
64
69
|
variables: {
|
|
65
70
|
limit: 50,
|
|
66
71
|
offset: 0
|
|
67
72
|
},
|
|
68
73
|
fetchPolicy: "cache-first"
|
|
69
|
-
})).data?.myAccessibleProducts?.items || []).filter((e) =>
|
|
74
|
+
})).data?.myAccessibleProducts?.items || []).filter((e) => d(e.slug)).map((e) => ({
|
|
70
75
|
id: e.slug,
|
|
71
76
|
name: e.name,
|
|
72
|
-
url: e.appUrl,
|
|
73
|
-
icon:
|
|
74
|
-
color:
|
|
77
|
+
url: e.appUrl || t(e.slug),
|
|
78
|
+
icon: m(e.name, e.slug),
|
|
79
|
+
color: h(e.slug, e.metadata),
|
|
80
|
+
comingSoon: l(e.slug, e.status, e.appUrl)
|
|
75
81
|
}));
|
|
76
|
-
e.sort((e, t) => e.name.localeCompare(t.name)),
|
|
82
|
+
e.sort((e, t) => e.name.localeCompare(t.name)), c(e.length > 0 ? e : g());
|
|
77
83
|
} catch (e) {
|
|
78
|
-
|
|
84
|
+
v(e instanceof Error ? e.message : "Failed to fetch products"), c(g());
|
|
79
85
|
} finally {
|
|
80
|
-
|
|
86
|
+
p(!1);
|
|
81
87
|
}
|
|
82
|
-
}, [
|
|
88
|
+
}, [o]);
|
|
83
89
|
return i(() => {
|
|
84
90
|
if (e?.autoFetch === !1) {
|
|
85
|
-
|
|
91
|
+
p(!1);
|
|
86
92
|
return;
|
|
87
93
|
}
|
|
88
|
-
|
|
94
|
+
y();
|
|
89
95
|
}, []), {
|
|
90
|
-
products:
|
|
91
|
-
isLoading:
|
|
92
|
-
error:
|
|
93
|
-
refetch:
|
|
96
|
+
products: s,
|
|
97
|
+
isLoading: f,
|
|
98
|
+
error: _,
|
|
99
|
+
refetch: y
|
|
94
100
|
};
|
|
95
101
|
}
|
|
96
102
|
//#endregion
|
|
97
|
-
export {
|
|
103
|
+
export { _ as useProducts };
|