@mantajs/dashboard 0.1.10 → 0.1.12

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/app.css CHANGED
@@ -1574,6 +1574,9 @@ video {
1574
1574
  .grid {
1575
1575
  display: grid;
1576
1576
  }
1577
+ .contents {
1578
+ display: contents;
1579
+ }
1577
1580
  .hidden {
1578
1581
  display: none;
1579
1582
  }
package/dist/app.js CHANGED
@@ -100539,7 +100539,7 @@ var init_main_layout = __esm({
100539
100539
  items: item.items?.map((sub2) => ({
100540
100540
  label: sub2.useTranslation ? t5(sub2.label) : sub2.label,
100541
100541
  to: sub2.to
100542
- }))
100542
+ })) ?? []
100543
100543
  }));
100544
100544
  };
100545
100545
  Searchbar = () => {
@@ -100569,7 +100569,7 @@ var init_main_layout = __esm({
100569
100569
  menuItems.forEach((item) => {
100570
100570
  if (item.nested) {
100571
100571
  const route = coreRoutes.find((route2) => route2.to === item.nested);
100572
- if (route) {
100572
+ if (route && !route.items?.some((existing) => existing.to === item.to)) {
100573
100573
  route.items?.push(item);
100574
100574
  }
100575
100575
  }
@@ -102790,6 +102790,42 @@ var init_loader = __esm({
102790
102790
  }
102791
102791
  });
102792
102792
 
102793
+ // src/dashboard-app/routes/merge-extension-routes.ts
102794
+ function mergeExtensionRoutes(staticRoutes, extensionRoutes) {
102795
+ if (!extensionRoutes.length) return staticRoutes;
102796
+ const result = [...staticRoutes];
102797
+ for (const ext of extensionRoutes) {
102798
+ const extPath = (ext.path ?? "").replace(/^\/+/, "");
102799
+ const idx = result.findIndex(
102800
+ (r) => (r.path ?? "").replace(/^\/+/, "") === extPath
102801
+ );
102802
+ if (idx === -1) {
102803
+ result.push(ext);
102804
+ continue;
102805
+ }
102806
+ const existing = result[idx];
102807
+ const merged = { ...existing };
102808
+ if (ext.lazy) {
102809
+ merged.lazy = ext.lazy;
102810
+ delete merged.Component;
102811
+ delete merged.loader;
102812
+ }
102813
+ if (ext.children || existing.children) {
102814
+ merged.children = mergeExtensionRoutes(
102815
+ existing.children || [],
102816
+ ext.children || []
102817
+ );
102818
+ }
102819
+ result[idx] = merged;
102820
+ }
102821
+ return result;
102822
+ }
102823
+ var init_merge_extension_routes = __esm({
102824
+ "src/dashboard-app/routes/merge-extension-routes.ts"() {
102825
+ "use strict";
102826
+ }
102827
+ });
102828
+
102793
102829
  // src/routes/home/home.tsx
102794
102830
  var import_react28, import_react_router_dom13, import_jsx_runtime27, Home;
102795
102831
  var init_home = __esm({
@@ -193924,7 +193960,7 @@ function getRouteMap({
193924
193960
  children: [
193925
193961
  {
193926
193962
  element: /* @__PURE__ */ (0, import_jsx_runtime706.jsx)(MainLayout, {}),
193927
- children: [
193963
+ children: mergeExtensionRoutes([
193928
193964
  {
193929
193965
  path: "/",
193930
193966
  errorElement: /* @__PURE__ */ (0, import_jsx_runtime706.jsx)(ErrorBoundary, {}),
@@ -194610,9 +194646,8 @@ function getRouteMap({
194610
194646
  ]
194611
194647
  }
194612
194648
  ]
194613
- },
194614
- ...coreRoutes
194615
- ]
194649
+ }
194650
+ ], coreRoutes)
194616
194651
  }
194617
194652
  ]
194618
194653
  },
@@ -194626,7 +194661,7 @@ function getRouteMap({
194626
194661
  breadcrumb: () => (0, import_i18next9.t)("app.nav.settings.header")
194627
194662
  },
194628
194663
  element: /* @__PURE__ */ (0, import_jsx_runtime706.jsx)(SettingsLayout, {}),
194629
- children: [
194664
+ children: mergeExtensionRoutes([
194630
194665
  {
194631
194666
  index: true,
194632
194667
  errorElement: /* @__PURE__ */ (0, import_jsx_runtime706.jsx)(ErrorBoundary, {}),
@@ -195357,9 +195392,8 @@ function getRouteMap({
195357
195392
  lazy: () => Promise.resolve().then(() => (init_add_locales2(), add_locales_exports))
195358
195393
  }
195359
195394
  ]
195360
- },
195361
- ...settingsRoutes?.[0]?.children || []
195362
- ]
195395
+ }
195396
+ ], settingsRoutes?.[0]?.children || [])
195363
195397
  }
195364
195398
  ]
195365
195399
  },
@@ -195404,6 +195438,7 @@ var init_get_route_map = __esm({
195404
195438
  init_error_boundary2();
195405
195439
  init_breadcrumb();
195406
195440
  init_loader();
195441
+ init_merge_extension_routes();
195407
195442
  import_jsx_runtime706 = require("react/jsx-runtime");
195408
195443
  }
195409
195444
  });
package/dist/app.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DashboardApp
3
- } from "./chunk-6AOXP3RP.mjs";
3
+ } from "./chunk-VHUQFKRO.mjs";
4
4
  import "./chunk-2SSUH2HJ.mjs";
5
5
  import "./chunk-ONB3JEHR.mjs";
6
6
  import "./chunk-YCDDT44O.mjs";
@@ -95537,7 +95537,7 @@ var useCoreRoutes = () => {
95537
95537
  items: item.items?.map((sub) => ({
95538
95538
  label: sub.useTranslation ? t2(sub.label) : sub.label,
95539
95539
  to: sub.to
95540
- }))
95540
+ })) ?? []
95541
95541
  }));
95542
95542
  };
95543
95543
  var Searchbar = () => {
@@ -95567,7 +95567,7 @@ var CoreRouteSection = () => {
95567
95567
  menuItems.forEach((item) => {
95568
95568
  if (item.nested) {
95569
95569
  const route = coreRoutes.find((route2) => route2.to === item.nested);
95570
- if (route) {
95570
+ if (route && !route.items?.some((existing) => existing.to === item.to)) {
95571
95571
  route.items?.push(item);
95572
95572
  }
95573
95573
  }
@@ -95910,6 +95910,37 @@ var ErrorBoundary = () => {
95910
95910
  ] }) }) });
95911
95911
  };
95912
95912
 
95913
+ // src/dashboard-app/routes/merge-extension-routes.ts
95914
+ function mergeExtensionRoutes(staticRoutes, extensionRoutes) {
95915
+ if (!extensionRoutes.length) return staticRoutes;
95916
+ const result = [...staticRoutes];
95917
+ for (const ext of extensionRoutes) {
95918
+ const extPath = (ext.path ?? "").replace(/^\/+/, "");
95919
+ const idx = result.findIndex(
95920
+ (r) => (r.path ?? "").replace(/^\/+/, "") === extPath
95921
+ );
95922
+ if (idx === -1) {
95923
+ result.push(ext);
95924
+ continue;
95925
+ }
95926
+ const existing = result[idx];
95927
+ const merged = { ...existing };
95928
+ if (ext.lazy) {
95929
+ merged.lazy = ext.lazy;
95930
+ delete merged.Component;
95931
+ delete merged.loader;
95932
+ }
95933
+ if (ext.children || existing.children) {
95934
+ merged.children = mergeExtensionRoutes(
95935
+ existing.children || [],
95936
+ ext.children || []
95937
+ );
95938
+ }
95939
+ result[idx] = merged;
95940
+ }
95941
+ return result;
95942
+ }
95943
+
95913
95944
  // src/dashboard-app/routes/get-route.map.tsx
95914
95945
  import { jsx as jsx17 } from "react/jsx-runtime";
95915
95946
  function getRouteMap({
@@ -95923,7 +95954,7 @@ function getRouteMap({
95923
95954
  children: [
95924
95955
  {
95925
95956
  element: /* @__PURE__ */ jsx17(MainLayout, {}),
95926
- children: [
95957
+ children: mergeExtensionRoutes([
95927
95958
  {
95928
95959
  path: "/",
95929
95960
  errorElement: /* @__PURE__ */ jsx17(ErrorBoundary, {}),
@@ -95950,7 +95981,7 @@ function getRouteMap({
95950
95981
  children: [
95951
95982
  {
95952
95983
  path: "create",
95953
- lazy: () => import("./product-create-T4PVLEL7.mjs")
95984
+ lazy: () => import("./product-create-GZANVK54.mjs")
95954
95985
  },
95955
95986
  {
95956
95987
  path: "import",
@@ -95966,7 +95997,7 @@ function getRouteMap({
95966
95997
  path: ":id",
95967
95998
  errorElement: /* @__PURE__ */ jsx17(ErrorBoundary, {}),
95968
95999
  lazy: async () => {
95969
- const { Breadcrumb, loader } = await import("./product-detail-77R3VVI5.mjs");
96000
+ const { Breadcrumb, loader } = await import("./product-detail-P3LEJNTC.mjs");
95970
96001
  return {
95971
96002
  Component: Outlet4,
95972
96003
  loader,
@@ -95978,11 +96009,11 @@ function getRouteMap({
95978
96009
  children: [
95979
96010
  {
95980
96011
  path: "",
95981
- lazy: () => import("./product-detail-77R3VVI5.mjs"),
96012
+ lazy: () => import("./product-detail-P3LEJNTC.mjs"),
95982
96013
  children: [
95983
96014
  {
95984
96015
  path: "edit",
95985
- lazy: () => import("./product-edit-CPKK4QSD.mjs")
96016
+ lazy: () => import("./product-edit-ZWEDI4DK.mjs")
95986
96017
  },
95987
96018
  {
95988
96019
  path: "edit-variant",
@@ -95994,11 +96025,11 @@ function getRouteMap({
95994
96025
  },
95995
96026
  {
95996
96027
  path: "attributes",
95997
- lazy: () => import("./product-attributes-WOKHQSU3.mjs")
96028
+ lazy: () => import("./product-attributes-NT25DQN6.mjs")
95998
96029
  },
95999
96030
  {
96000
96031
  path: "organization",
96001
- lazy: () => import("./product-organization-BH5TZRYS.mjs")
96032
+ lazy: () => import("./product-organization-3PJP3Y43.mjs")
96002
96033
  },
96003
96034
  {
96004
96035
  path: "shipping-profile",
@@ -96609,9 +96640,8 @@ function getRouteMap({
96609
96640
  ]
96610
96641
  }
96611
96642
  ]
96612
- },
96613
- ...coreRoutes
96614
- ]
96643
+ }
96644
+ ], coreRoutes)
96615
96645
  }
96616
96646
  ]
96617
96647
  },
@@ -96625,7 +96655,7 @@ function getRouteMap({
96625
96655
  breadcrumb: () => t("app.nav.settings.header")
96626
96656
  },
96627
96657
  element: /* @__PURE__ */ jsx17(SettingsLayout, {}),
96628
- children: [
96658
+ children: mergeExtensionRoutes([
96629
96659
  {
96630
96660
  index: true,
96631
96661
  errorElement: /* @__PURE__ */ jsx17(ErrorBoundary, {}),
@@ -97356,9 +97386,8 @@ function getRouteMap({
97356
97386
  lazy: () => import("./add-locales-47HF5EWF.mjs")
97357
97387
  }
97358
97388
  ]
97359
- },
97360
- ...settingsRoutes?.[0]?.children || []
97361
- ]
97389
+ }
97390
+ ], settingsRoutes?.[0]?.children || [])
97362
97391
  }
97363
97392
  ]
97364
97393
  },