@logickernel/bridge 0.13.0 → 0.13.2
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/next/components.cjs +2 -173
- package/dist/next/components.cjs.map +1 -1
- package/dist/next/components.js +2 -173
- package/dist/next/components.js.map +1 -1
- package/dist/next/index.cjs +0 -7
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.js +0 -7
- package/dist/next/index.js.map +1 -1
- package/package.json +1 -1
package/dist/next/components.cjs
CHANGED
|
@@ -771,18 +771,6 @@ function NavMain({ items }) {
|
|
|
771
771
|
const shouldUseLink = (url) => {
|
|
772
772
|
const currentContext = getCurrentContext();
|
|
773
773
|
const urlContext = getContextFromPath(url);
|
|
774
|
-
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
775
|
-
const willUseLink = currentContext && urlContext && currentContext === urlContext;
|
|
776
|
-
console.log("[NavMain] shouldUseLink check:", {
|
|
777
|
-
url,
|
|
778
|
-
currentPathname: pathname,
|
|
779
|
-
windowPathname: typeof window !== "undefined" ? window.location.pathname : "N/A",
|
|
780
|
-
currentContext,
|
|
781
|
-
urlContext,
|
|
782
|
-
contextsMatch: currentContext === urlContext,
|
|
783
|
-
willUseLink
|
|
784
|
-
});
|
|
785
|
-
}
|
|
786
774
|
if (currentContext && urlContext && currentContext === urlContext) {
|
|
787
775
|
return true;
|
|
788
776
|
}
|
|
@@ -793,33 +781,11 @@ function NavMain({ items }) {
|
|
|
793
781
|
if (!urlContext) return url;
|
|
794
782
|
return url.substring(urlContext.length) || "/";
|
|
795
783
|
};
|
|
796
|
-
const handleClick = (
|
|
784
|
+
const handleClick = () => {
|
|
797
785
|
if (isMobile) {
|
|
798
786
|
setOpenMobile(false);
|
|
799
787
|
}
|
|
800
|
-
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
801
|
-
const target = e?.currentTarget;
|
|
802
|
-
const url = target.getAttribute("href") || target.closest("a")?.getAttribute("href");
|
|
803
|
-
const isLink = target.closest("a")?.tagName === "A" && !target.closest("a")?.hasAttribute("data-next-link");
|
|
804
|
-
console.log("[NavMain] Click:", {
|
|
805
|
-
url,
|
|
806
|
-
isLinkComponent: !isLink,
|
|
807
|
-
isAnchorTag: isLink,
|
|
808
|
-
willReload: isLink
|
|
809
|
-
});
|
|
810
|
-
}
|
|
811
788
|
};
|
|
812
|
-
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
813
|
-
console.log("[NavMain] Received items:", {
|
|
814
|
-
itemsCount: items.length,
|
|
815
|
-
items: items.map((item) => ({
|
|
816
|
-
title: item.title,
|
|
817
|
-
url: item.url,
|
|
818
|
-
icon: item.icon,
|
|
819
|
-
hasSubItems: !!(item.items && item.items.length > 0)
|
|
820
|
-
}))
|
|
821
|
-
});
|
|
822
|
-
}
|
|
823
789
|
const groups = [];
|
|
824
790
|
let currentGroup = {
|
|
825
791
|
items: []
|
|
@@ -847,39 +813,10 @@ function NavMain({ items }) {
|
|
|
847
813
|
if (currentGroup.items.length > 0 || currentGroup.label) {
|
|
848
814
|
groups.push(currentGroup);
|
|
849
815
|
}
|
|
850
|
-
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
851
|
-
console.log("[NavMain] Groups:", {
|
|
852
|
-
groupsCount: groups.length,
|
|
853
|
-
groups: groups.map((group) => ({
|
|
854
|
-
hasLabel: !!group.label,
|
|
855
|
-
labelTitle: group.label?.title,
|
|
856
|
-
itemsCount: group.items.length,
|
|
857
|
-
items: group.items.map((item) => item.title)
|
|
858
|
-
}))
|
|
859
|
-
});
|
|
860
|
-
const firstGroup = groups.length > 0 ? groups[0] : null;
|
|
861
|
-
console.log("[NavMain] Will render:", {
|
|
862
|
-
groupsLength: groups.length,
|
|
863
|
-
willRender: groups.length > 0,
|
|
864
|
-
firstGroupHasItems: firstGroup ? firstGroup.items.length > 0 : false,
|
|
865
|
-
firstGroupHasLabel: !!firstGroup?.label
|
|
866
|
-
});
|
|
867
|
-
}
|
|
868
816
|
if (groups.length === 0) {
|
|
869
|
-
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
870
|
-
console.warn("[NavMain] No groups to render, returning null");
|
|
871
|
-
}
|
|
872
817
|
return null;
|
|
873
818
|
}
|
|
874
819
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: groups.map((group, groupIndex) => {
|
|
875
|
-
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
876
|
-
console.log(`[NavMain] Rendering group ${groupIndex}:`, {
|
|
877
|
-
hasLabel: !!group.label,
|
|
878
|
-
itemsCount: group.items.length,
|
|
879
|
-
willRenderLabel: !!group.label,
|
|
880
|
-
willRenderItems: group.items.length > 0
|
|
881
|
-
});
|
|
882
|
-
}
|
|
883
820
|
return /* @__PURE__ */ jsxRuntime.jsxs(SidebarGroup, { children: [
|
|
884
821
|
group.label && /* @__PURE__ */ jsxRuntime.jsxs(SidebarGroupLabel, { children: [
|
|
885
822
|
group.label.icon && /* @__PURE__ */ jsxRuntime.jsx(group.label.icon, { className: "mr-2" }),
|
|
@@ -911,16 +848,6 @@ function NavMain({ items }) {
|
|
|
911
848
|
/* @__PURE__ */ jsxRuntime.jsx(CollapsibleContent2, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSub, { children: item.items?.map((subItem) => {
|
|
912
849
|
const useLink2 = shouldUseLink(subItem.url);
|
|
913
850
|
const linkHref2 = useLink2 ? stripContextFromUrl(subItem.url) : subItem.url;
|
|
914
|
-
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
915
|
-
console.log("[NavMain] SubItem navigation:", {
|
|
916
|
-
title: subItem.title,
|
|
917
|
-
originalUrl: subItem.url,
|
|
918
|
-
linkHref: linkHref2,
|
|
919
|
-
currentContext: getCurrentContext(),
|
|
920
|
-
useLink: useLink2,
|
|
921
|
-
willReload: !useLink2
|
|
922
|
-
});
|
|
923
|
-
}
|
|
924
851
|
if (useLink2) {
|
|
925
852
|
return /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubButton, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Link__default.default, { href: linkHref2, onClick: handleClick, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: subItem.title }) }) }) }, subItem.title);
|
|
926
853
|
}
|
|
@@ -933,17 +860,6 @@ function NavMain({ items }) {
|
|
|
933
860
|
}
|
|
934
861
|
const useLink = shouldUseLink(item.url);
|
|
935
862
|
const linkHref = useLink ? stripContextFromUrl(item.url) : item.url;
|
|
936
|
-
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
937
|
-
console.log("[NavMain] Item navigation:", {
|
|
938
|
-
title: item.title,
|
|
939
|
-
originalUrl: item.url,
|
|
940
|
-
linkHref,
|
|
941
|
-
currentContext: getCurrentContext(),
|
|
942
|
-
currentPathname: pathname,
|
|
943
|
-
useLink,
|
|
944
|
-
willReload: !useLink
|
|
945
|
-
});
|
|
946
|
-
}
|
|
947
863
|
if (useLink) {
|
|
948
864
|
return /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
949
865
|
SidebarMenuButton,
|
|
@@ -1306,18 +1222,7 @@ function useNavigation({
|
|
|
1306
1222
|
const [loading, setLoading] = React2.useState(false);
|
|
1307
1223
|
const [error, setError] = React2.useState(null);
|
|
1308
1224
|
React2.useEffect(() => {
|
|
1309
|
-
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
1310
|
-
console.log("[useNavigation] Hook called:", {
|
|
1311
|
-
enabled,
|
|
1312
|
-
organizationId,
|
|
1313
|
-
apiBaseUrl,
|
|
1314
|
-
willFetch: enabled
|
|
1315
|
-
});
|
|
1316
|
-
}
|
|
1317
1225
|
if (!enabled) {
|
|
1318
|
-
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
1319
|
-
console.log("[useNavigation] Skipping fetch: disabled");
|
|
1320
|
-
}
|
|
1321
1226
|
setItems([]);
|
|
1322
1227
|
setOrganizations([]);
|
|
1323
1228
|
setUser(null);
|
|
@@ -1325,9 +1230,6 @@ function useNavigation({
|
|
|
1325
1230
|
}
|
|
1326
1231
|
const fetchNavigation = async () => {
|
|
1327
1232
|
const url = organizationId ? `${apiBaseUrl}/navigation/${organizationId}` : `${apiBaseUrl}/navigation`;
|
|
1328
|
-
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
1329
|
-
console.log("[useNavigation] Fetching navigation:", url);
|
|
1330
|
-
}
|
|
1331
1233
|
setLoading(true);
|
|
1332
1234
|
setError(null);
|
|
1333
1235
|
try {
|
|
@@ -1348,26 +1250,11 @@ function useNavigation({
|
|
|
1348
1250
|
throw new Error(`Failed to fetch navigation: ${response.statusText}`);
|
|
1349
1251
|
}
|
|
1350
1252
|
const data = await response.json();
|
|
1351
|
-
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
1352
|
-
console.log("[useNavigation] Navigation data received:", {
|
|
1353
|
-
itemsCount: data.items?.length || 0,
|
|
1354
|
-
organizationsCount: data.organizations?.length || 0,
|
|
1355
|
-
hasUser: !!data.user,
|
|
1356
|
-
organizationId: data.organizationId
|
|
1357
|
-
});
|
|
1358
|
-
}
|
|
1359
1253
|
setItems(data.items || []);
|
|
1360
1254
|
setOrganizations(data.organizations || []);
|
|
1361
1255
|
setUser(data.user || null);
|
|
1362
1256
|
} catch (err) {
|
|
1363
1257
|
const error2 = err instanceof Error ? err : new Error("Unknown error");
|
|
1364
|
-
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
1365
|
-
console.error("[useNavigation] Fetch error:", {
|
|
1366
|
-
error: error2.message,
|
|
1367
|
-
url,
|
|
1368
|
-
organizationId
|
|
1369
|
-
});
|
|
1370
|
-
}
|
|
1371
1258
|
setError(error2);
|
|
1372
1259
|
setItems([]);
|
|
1373
1260
|
setOrganizations([]);
|
|
@@ -1399,58 +1286,16 @@ function AppSidebar({
|
|
|
1399
1286
|
}
|
|
1400
1287
|
}
|
|
1401
1288
|
const detectedOrgId = organizationId || pathOrgId || void 0;
|
|
1402
|
-
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
1403
|
-
console.log("[AppSidebar] Debug:", {
|
|
1404
|
-
currentPathname,
|
|
1405
|
-
pathSegments,
|
|
1406
|
-
pathOrgId,
|
|
1407
|
-
organizationId,
|
|
1408
|
-
detectedOrgId,
|
|
1409
|
-
apiBaseUrl
|
|
1410
|
-
});
|
|
1411
|
-
}
|
|
1412
1289
|
const {
|
|
1413
1290
|
items: apiNavigationItems,
|
|
1414
1291
|
organizations: apiOrganizations,
|
|
1415
1292
|
user: navigationUser,
|
|
1416
|
-
loading: navigationLoading
|
|
1417
|
-
error: navigationError
|
|
1293
|
+
loading: navigationLoading
|
|
1418
1294
|
} = useNavigation({
|
|
1419
1295
|
organizationId: detectedOrgId,
|
|
1420
1296
|
apiBaseUrl,
|
|
1421
1297
|
enabled: true
|
|
1422
1298
|
});
|
|
1423
|
-
React2__namespace.useEffect(() => {
|
|
1424
|
-
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
1425
|
-
const orgIds = apiOrganizations.map((org) => org.id);
|
|
1426
|
-
const pathOrgIdInList = pathOrgId ? apiOrganizations.some((org) => org.id === pathOrgId) : false;
|
|
1427
|
-
const computedCurrentOrgId = organizationId || (pathOrgId && (apiOrganizations.length === 0 || apiOrganizations.some((org) => org.id === pathOrgId)) ? pathOrgId : void 0) || (detectedOrgId && apiNavigationItems.length > 0 ? detectedOrgId : void 0);
|
|
1428
|
-
console.log("[AppSidebar] Navigation state (ENHANCED):", {
|
|
1429
|
-
currentPathname,
|
|
1430
|
-
pathOrgId,
|
|
1431
|
-
organizationId,
|
|
1432
|
-
detectedOrgId,
|
|
1433
|
-
apiBaseUrl,
|
|
1434
|
-
itemsCount: apiNavigationItems.length,
|
|
1435
|
-
organizationsCount: apiOrganizations.length,
|
|
1436
|
-
organizationIds: orgIds,
|
|
1437
|
-
pathOrgIdInList,
|
|
1438
|
-
computedCurrentOrgId,
|
|
1439
|
-
displayItemsCount: computedCurrentOrgId ? apiNavigationItems.length : 0,
|
|
1440
|
-
loading: navigationLoading,
|
|
1441
|
-
error: navigationError?.message,
|
|
1442
|
-
navigationUrl: detectedOrgId ? `${apiBaseUrl}/navigation/${detectedOrgId}` : "N/A"
|
|
1443
|
-
});
|
|
1444
|
-
console.log("[AppSidebar] KEY VALUES:", {
|
|
1445
|
-
"computedCurrentOrgId": computedCurrentOrgId,
|
|
1446
|
-
"apiNavigationItems.length": apiNavigationItems.length,
|
|
1447
|
-
"apiOrganizations.length": apiOrganizations.length,
|
|
1448
|
-
"pathOrgIdInList": pathOrgIdInList,
|
|
1449
|
-
"organizationIds": orgIds,
|
|
1450
|
-
"willDisplayItems": !!computedCurrentOrgId && apiNavigationItems.length > 0
|
|
1451
|
-
});
|
|
1452
|
-
}
|
|
1453
|
-
}, [currentPathname, pathOrgId, organizationId, detectedOrgId, apiBaseUrl, apiNavigationItems, apiOrganizations, navigationLoading, navigationError]);
|
|
1454
1299
|
const user = navigationUser || userProp;
|
|
1455
1300
|
const currentOrgId = organizationId || (pathOrgId && (apiOrganizations.length === 0 || apiOrganizations.some((org) => org.id === pathOrgId)) ? pathOrgId : void 0) || (detectedOrgId && apiNavigationItems.length > 0 ? detectedOrgId : void 0);
|
|
1456
1301
|
let navigationItems = apiNavigationItems;
|
|
@@ -1465,22 +1310,6 @@ function AppSidebar({
|
|
|
1465
1310
|
}));
|
|
1466
1311
|
}
|
|
1467
1312
|
const displayNavigationItems = currentOrgId ? navigationItems : [];
|
|
1468
|
-
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
1469
|
-
console.log("[AppSidebar] currentOrgId calculation:", {
|
|
1470
|
-
"organizationId prop": organizationId,
|
|
1471
|
-
"pathOrgId": pathOrgId,
|
|
1472
|
-
"detectedOrgId": detectedOrgId,
|
|
1473
|
-
"apiOrganizations.length": apiOrganizations.length,
|
|
1474
|
-
"apiNavigationItems.length": apiNavigationItems.length,
|
|
1475
|
-
"pathOrgIdInList": pathOrgId ? apiOrganizations.some((org) => org.id === pathOrgId) : false,
|
|
1476
|
-
"FINAL currentOrgId": currentOrgId,
|
|
1477
|
-
"navigationItems.length": navigationItems.length,
|
|
1478
|
-
"displayNavigationItems.length": displayNavigationItems.length,
|
|
1479
|
-
"willDisplayItems": displayNavigationItems.length > 0
|
|
1480
|
-
});
|
|
1481
|
-
console.log("[AppSidebar] FINAL currentOrgId:", currentOrgId);
|
|
1482
|
-
console.log("[AppSidebar] displayNavigationItems.length:", displayNavigationItems.length);
|
|
1483
|
-
}
|
|
1484
1313
|
return /* @__PURE__ */ jsxRuntime.jsxs(Sidebar, { collapsible: "icon", ...props, children: [
|
|
1485
1314
|
/* @__PURE__ */ jsxRuntime.jsx(SidebarHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1486
1315
|
TeamSwitcher,
|