@medusajs/dashboard 2.22.3-snapshot-20261103230838 → 2.22.3

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
@@ -337,6 +337,10 @@ video {
337
337
  * {
338
338
  border-color: var(--border-base);
339
339
  }
340
+ button:not(:disabled),
341
+ [role=button]:not(:disabled) {
342
+ cursor: pointer;
343
+ }
340
344
  :root {
341
345
  --tag-neutral-border: rgba(228, 228, 231, 1);
342
346
  --tag-neutral-icon: rgba(161, 161, 170, 1);
@@ -1416,6 +1420,9 @@ video {
1416
1420
  .m-4 {
1417
1421
  margin: 1rem;
1418
1422
  }
1423
+ .m-auto {
1424
+ margin: auto;
1425
+ }
1419
1426
  .-mx-1 {
1420
1427
  margin-left: -0.25rem;
1421
1428
  margin-right: -0.25rem;
@@ -2617,11 +2624,6 @@ video {
2617
2624
  .gap-y-8 {
2618
2625
  row-gap: 2rem;
2619
2626
  }
2620
- .space-x-2 > :not([hidden]) ~ :not([hidden]) {
2621
- --tw-space-x-reverse: 0;
2622
- margin-right: calc(0.5rem * var(--tw-space-x-reverse));
2623
- margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));
2624
- }
2625
2627
  .space-y-0 > :not([hidden]) ~ :not([hidden]) {
2626
2628
  --tw-space-y-reverse: 0;
2627
2629
  margin-top: calc(0px * calc(1 - var(--tw-space-y-reverse)));
@@ -2632,11 +2634,6 @@ video {
2632
2634
  margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));
2633
2635
  margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));
2634
2636
  }
2635
- .space-y-3 > :not([hidden]) ~ :not([hidden]) {
2636
- --tw-space-y-reverse: 0;
2637
- margin-top: calc(0.75rem * calc(1 - var(--tw-space-y-reverse)));
2638
- margin-bottom: calc(0.75rem * var(--tw-space-y-reverse));
2639
- }
2640
2637
  .divide-x > :not([hidden]) ~ :not([hidden]) {
2641
2638
  --tw-divide-x-reverse: 0;
2642
2639
  border-right-width: calc(1px * var(--tw-divide-x-reverse));
@@ -2757,6 +2754,9 @@ video {
2757
2754
  .rounded-xl {
2758
2755
  border-radius: 0.75rem;
2759
2756
  }
2757
+ .rounded-xs {
2758
+ border-radius: 0.125rem;
2759
+ }
2760
2760
  .rounded-b-\[4px\] {
2761
2761
  border-bottom-right-radius: 4px;
2762
2762
  border-bottom-left-radius: 4px;
@@ -4073,6 +4073,15 @@ video {
4073
4073
  .will-change-transform {
4074
4074
  will-change: transform;
4075
4075
  }
4076
+ .outline-hidden {
4077
+ outline-style: none;
4078
+ }
4079
+ @media (forced-colors: active) {
4080
+ .outline-hidden {
4081
+ outline: 2px solid transparent;
4082
+ outline-offset: 2px;
4083
+ }
4084
+ }
4076
4085
  @keyframes enter {
4077
4086
  from {
4078
4087
  opacity: var(--tw-enter-opacity, 1);
@@ -4577,6 +4586,15 @@ video {
4577
4586
  outline: 2px solid transparent;
4578
4587
  outline-offset: 2px;
4579
4588
  }
4589
+ .focus-visible\:outline-hidden:focus-visible {
4590
+ outline-style: none;
4591
+ }
4592
+ @media (forced-colors: active) {
4593
+ .focus-visible\:outline-hidden:focus-visible {
4594
+ outline: 2px solid transparent;
4595
+ outline-offset: 2px;
4596
+ }
4597
+ }
4580
4598
  .focus-visible\:hover\:bg-ui-contrast-bg-base-hover:hover:focus-visible {
4581
4599
  background-color: var(--contrast-bg-base-hover);
4582
4600
  }
@@ -4995,27 +5013,15 @@ video {
4995
5013
  .data-\[state\=closed\]\:slide-in-from-bottom-2[data-state=closed] {
4996
5014
  --tw-enter-translate-y: 0.5rem;
4997
5015
  }
4998
- .data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed] {
4999
- --tw-exit-translate-x: -50%;
5000
- }
5001
5016
  .data-\[state\=closed\]\:slide-out-to-right-1\/2[data-state=closed] {
5002
5017
  --tw-exit-translate-x: 50%;
5003
5018
  }
5004
- .data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed] {
5005
- --tw-exit-translate-y: -48%;
5006
- }
5007
5019
  .data-\[state\=open\]\:slide-in-from-bottom-0[data-state=open] {
5008
5020
  --tw-enter-translate-y: 0px;
5009
5021
  }
5010
- .data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open] {
5011
- --tw-enter-translate-x: -50%;
5012
- }
5013
5022
  .data-\[state\=open\]\:slide-in-from-right-1\/2[data-state=open] {
5014
5023
  --tw-enter-translate-x: 50%;
5015
5024
  }
5016
- .data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open] {
5017
- --tw-enter-translate-y: -48%;
5018
- }
5019
5025
  .group[data-state=open] .group-data-\[state\=\'open\'\]\:rotate-90 {
5020
5026
  --tw-rotate: 90deg;
5021
5027
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
@@ -5291,6 +5297,9 @@ video {
5291
5297
  .\[\&\:hover\>div\]\:bg-ui-bg-component-hover:hover > div {
5292
5298
  background-color: var(--bg-component-hover);
5293
5299
  }
5300
+ .\[\&\>\*\+\*\]\:border-t > * + * {
5301
+ border-top-width: 1px;
5302
+ }
5294
5303
  .\[\&\>\*\]\:h-full > * {
5295
5304
  height: 100%;
5296
5305
  }
@@ -5384,7 +5393,7 @@ video {
5384
5393
  .\[\&_div\]\:w-2 div {
5385
5394
  width: 0.5rem;
5386
5395
  }
5387
- .\[\&_div\]\:rounded-sm div {
5396
+ .\[\&_div\]\:rounded-xs div {
5388
5397
  border-radius: 0.125rem;
5389
5398
  }
5390
5399
  .\[\&_div\]\:bg-ui-tag-blue-icon div {
package/dist/app.js CHANGED
@@ -136942,7 +136942,7 @@ var init_permissions_context = __esm({
136942
136942
  });
136943
136943
 
136944
136944
  // src/lib/permissions/constants.ts
136945
- var OPERATION_IMPLICATIONS, DEFAULT_LANDING_ROUTES, NO_PERMISSIONS_ROUTE;
136945
+ var OPERATION_IMPLICATIONS, DEFAULT_LANDING_ROUTES;
136946
136946
  var init_constants = __esm({
136947
136947
  "src/lib/permissions/constants.ts"() {
136948
136948
  "use strict";
@@ -136975,7 +136975,6 @@ var init_constants = __esm({
136975
136975
  { to: "/settings/publishable-api-keys", permission: "api_key:read" },
136976
136976
  { to: "/settings/workflows", permission: "workflow_execution:read" }
136977
136977
  ];
136978
- NO_PERMISSIONS_ROUTE = "/no-permissions";
136979
136978
  }
136980
136979
  });
136981
136980
 
@@ -147062,7 +147061,7 @@ var init_home = __esm({
147062
147061
  const accessible = DEFAULT_LANDING_ROUTES.find(
147063
147062
  (route) => hasPermission(route.permission)
147064
147063
  );
147065
- return accessible?.to ?? NO_PERMISSIONS_ROUTE;
147064
+ return accessible?.to ?? "/settings/profile";
147066
147065
  }, [hasPermission]);
147067
147066
  (0, import_react52.useEffect)(() => {
147068
147067
  if (isLoading) {
@@ -220342,21 +220341,34 @@ var init_adjust_inventory = __esm({
220342
220341
  });
220343
220342
 
220344
220343
  // src/routes/settings/settings.tsx
220345
- var import_react313, import_react_router_dom185, import_jsx_runtime577, Settings;
220344
+ var import_react313, import_react_router_dom185, import_jsx_runtime577, SETTINGS_LANDING_ROUTES, Settings;
220346
220345
  var init_settings = __esm({
220347
220346
  "src/routes/settings/settings.tsx"() {
220348
220347
  "use strict";
220349
220348
  import_react313 = require("react");
220350
220349
  import_react_router_dom185 = require("react-router-dom");
220350
+ init_permissions();
220351
+ init_permissions_provider2();
220351
220352
  import_jsx_runtime577 = require("react/jsx-runtime");
220353
+ SETTINGS_LANDING_ROUTES = DEFAULT_LANDING_ROUTES.filter(
220354
+ (route) => route.to.startsWith("/settings/")
220355
+ );
220352
220356
  Settings = () => {
220353
220357
  const navigate = (0, import_react_router_dom185.useNavigate)();
220354
220358
  const location = (0, import_react_router_dom185.useLocation)();
220359
+ const { hasPermission, isLoading } = usePermissions();
220360
+ const destination = (0, import_react313.useMemo)(() => {
220361
+ const accessible = SETTINGS_LANDING_ROUTES.find(
220362
+ (route) => hasPermission(route.permission)
220363
+ );
220364
+ return accessible?.to ?? "/settings/profile";
220365
+ }, [hasPermission]);
220355
220366
  (0, import_react313.useEffect)(() => {
220356
- if (location.pathname === "/settings") {
220357
- navigate("/settings/store", { replace: true });
220367
+ if (isLoading || location.pathname !== "/settings") {
220368
+ return;
220358
220369
  }
220359
- }, [location.pathname, navigate]);
220370
+ navigate(destination, { replace: true });
220371
+ }, [isLoading, location.pathname, destination, navigate]);
220360
220372
  return /* @__PURE__ */ (0, import_jsx_runtime577.jsx)(import_react_router_dom185.Outlet, {});
220361
220373
  };
220362
220374
  }
package/dist/app.mjs CHANGED
@@ -14,7 +14,7 @@ import "./chunk-P3UUX2T6.mjs";
14
14
  import "./chunk-DG7J63J2.mjs";
15
15
  import {
16
16
  DashboardApp
17
- } from "./chunk-H4VAUQN7.mjs";
17
+ } from "./chunk-GBUMG3AT.mjs";
18
18
  import "./chunk-ONB3JEHR.mjs";
19
19
  import "./chunk-JAW6ZD7F.mjs";
20
20
  import "./chunk-4GQOUCX6.mjs";
@@ -138878,7 +138878,7 @@ function getRouteMap({
138878
138878
  {
138879
138879
  path: "/",
138880
138880
  errorElement: /* @__PURE__ */ jsx21(ErrorBoundary, {}),
138881
- lazy: () => import("./home-NHWOTT5P.mjs")
138881
+ lazy: () => import("./home-PBITRB4B.mjs")
138882
138882
  },
138883
138883
  {
138884
138884
  path: "/no-permissions",
@@ -138900,7 +138900,7 @@ function getRouteMap({
138900
138900
  children: [
138901
138901
  {
138902
138902
  path: "create",
138903
- lazy: () => import("./product-create-3NNLVW2Q.mjs"),
138903
+ lazy: () => import("./product-create-7U2FFSX6.mjs"),
138904
138904
  // The form loads the store, regions, sales channels and
138905
138905
  // price preferences
138906
138906
  handle: {
@@ -138931,7 +138931,7 @@ function getRouteMap({
138931
138931
  path: ":id",
138932
138932
  errorElement: /* @__PURE__ */ jsx21(ErrorBoundary, {}),
138933
138933
  lazy: async () => {
138934
- const { Breadcrumb, loader, seo } = await import("./product-detail-33VXR7Q6.mjs");
138934
+ const { Breadcrumb, loader, seo } = await import("./product-detail-NDBVS3WK.mjs");
138935
138935
  return {
138936
138936
  Component: Outlet5,
138937
138937
  loader,
@@ -138944,11 +138944,11 @@ function getRouteMap({
138944
138944
  children: [
138945
138945
  {
138946
138946
  path: "",
138947
- lazy: () => import("./product-detail-33VXR7Q6.mjs"),
138947
+ lazy: () => import("./product-detail-NDBVS3WK.mjs"),
138948
138948
  children: [
138949
138949
  {
138950
138950
  path: "edit",
138951
- lazy: () => import("./product-edit-LWKBFVFK.mjs"),
138951
+ lazy: () => import("./product-edit-MR7HPS4Y.mjs"),
138952
138952
  handle: { permissions: "product:update" }
138953
138953
  },
138954
138954
  {
@@ -138968,12 +138968,12 @@ function getRouteMap({
138968
138968
  },
138969
138969
  {
138970
138970
  path: "attributes",
138971
- lazy: () => import("./product-attributes-3IJGUWGO.mjs"),
138971
+ lazy: () => import("./product-attributes-44KC3O5H.mjs"),
138972
138972
  handle: { permissions: "product:update" }
138973
138973
  },
138974
138974
  {
138975
138975
  path: "organization",
138976
- lazy: () => import("./product-organization-7BMAMYB5.mjs"),
138976
+ lazy: () => import("./product-organization-5XNP3UM6.mjs"),
138977
138977
  handle: { permissions: "product:update" }
138978
138978
  },
138979
138979
  {
@@ -139047,7 +139047,7 @@ function getRouteMap({
139047
139047
  },
139048
139048
  {
139049
139049
  path: "options/manage",
139050
- lazy: () => import("./product-options-manage-YXTGVK7R.mjs"),
139050
+ lazy: () => import("./product-options-manage-EFUX6E3S.mjs"),
139051
139051
  handle: {
139052
139052
  permissions: [
139053
139053
  "product:update",
@@ -140034,7 +140034,7 @@ function getRouteMap({
140034
140034
  {
140035
140035
  index: true,
140036
140036
  errorElement: /* @__PURE__ */ jsx21(ErrorBoundary, {}),
140037
- lazy: () => import("./settings-FKUZ6EYT.mjs")
140037
+ lazy: () => import("./settings-GY4XBAEY.mjs")
140038
140038
  },
140039
140039
  {
140040
140040
  path: "profile",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getLinkedFields
3
- } from "./chunk-H4VAUQN7.mjs";
3
+ } from "./chunk-GBUMG3AT.mjs";
4
4
 
5
5
  // src/routes/products/product-detail/constants.ts
6
6
  var PRODUCT_DETAIL_FIELDS = getLinkedFields(
@@ -2,8 +2,7 @@ import {
2
2
  usePermissions
3
3
  } from "./chunk-GE3FTJXX.mjs";
4
4
  import {
5
- DEFAULT_LANDING_ROUTES,
6
- NO_PERMISSIONS_ROUTE
5
+ DEFAULT_LANDING_ROUTES
7
6
  } from "./chunk-4IHNRS43.mjs";
8
7
  import "./chunk-QZ7TP4HQ.mjs";
9
8
 
@@ -18,7 +17,7 @@ var Home = () => {
18
17
  const accessible = DEFAULT_LANDING_ROUTES.find(
19
18
  (route) => hasPermission(route.permission)
20
19
  );
21
- return accessible?.to ?? NO_PERMISSIONS_ROUTE;
20
+ return accessible?.to ?? "/settings/profile";
22
21
  }, [hasPermission]);
23
22
  useEffect(() => {
24
23
  if (isLoading) {
@@ -6,7 +6,7 @@ import "./chunk-DG7J63J2.mjs";
6
6
  import {
7
7
  FormExtensionZone,
8
8
  useExtendableForm
9
- } from "./chunk-H4VAUQN7.mjs";
9
+ } from "./chunk-GBUMG3AT.mjs";
10
10
  import "./chunk-ONB3JEHR.mjs";
11
11
  import "./chunk-JAW6ZD7F.mjs";
12
12
  import "./chunk-4GQOUCX6.mjs";
@@ -24,7 +24,7 @@ import {
24
24
  import {
25
25
  FormExtensionZone,
26
26
  useExtendableForm
27
- } from "./chunk-H4VAUQN7.mjs";
27
+ } from "./chunk-GBUMG3AT.mjs";
28
28
  import "./chunk-ONB3JEHR.mjs";
29
29
  import "./chunk-JAW6ZD7F.mjs";
30
30
  import "./chunk-4GQOUCX6.mjs";
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-AM2BU2RH.mjs";
7
7
  import {
8
8
  PRODUCT_DETAIL_FIELDS
9
- } from "./chunk-RE2JBFAB.mjs";
9
+ } from "./chunk-ZU7MUXFY.mjs";
10
10
  import {
11
11
  SidebarLink
12
12
  } from "./chunk-TBU4TBPD.mjs";
@@ -19,7 +19,7 @@ import {
19
19
  getFormattedCountry
20
20
  } from "./chunk-B6ZOPCPA.mjs";
21
21
  import "./chunk-DG7J63J2.mjs";
22
- import "./chunk-H4VAUQN7.mjs";
22
+ import "./chunk-GBUMG3AT.mjs";
23
23
  import "./chunk-ONB3JEHR.mjs";
24
24
  import "./chunk-JAW6ZD7F.mjs";
25
25
  import "./chunk-4GQOUCX6.mjs";
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  FormExtensionZone,
9
9
  useExtendableForm
10
- } from "./chunk-H4VAUQN7.mjs";
10
+ } from "./chunk-GBUMG3AT.mjs";
11
11
  import "./chunk-ONB3JEHR.mjs";
12
12
  import "./chunk-JAW6ZD7F.mjs";
13
13
  import "./chunk-4GQOUCX6.mjs";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  PRODUCT_DETAIL_FIELDS
3
- } from "./chunk-RE2JBFAB.mjs";
3
+ } from "./chunk-ZU7MUXFY.mjs";
4
4
  import {
5
5
  useExtendableForm
6
- } from "./chunk-H4VAUQN7.mjs";
6
+ } from "./chunk-GBUMG3AT.mjs";
7
7
  import "./chunk-ONB3JEHR.mjs";
8
8
  import "./chunk-JAW6ZD7F.mjs";
9
9
  import "./chunk-4GQOUCX6.mjs";
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  FormExtensionZone,
6
6
  useExtendableForm
7
- } from "./chunk-H4VAUQN7.mjs";
7
+ } from "./chunk-GBUMG3AT.mjs";
8
8
  import "./chunk-ONB3JEHR.mjs";
9
9
  import "./chunk-JAW6ZD7F.mjs";
10
10
  import "./chunk-4GQOUCX6.mjs";
@@ -0,0 +1,36 @@
1
+ import {
2
+ usePermissions
3
+ } from "./chunk-GE3FTJXX.mjs";
4
+ import {
5
+ DEFAULT_LANDING_ROUTES
6
+ } from "./chunk-4IHNRS43.mjs";
7
+ import "./chunk-QZ7TP4HQ.mjs";
8
+
9
+ // src/routes/settings/settings.tsx
10
+ import { useEffect, useMemo } from "react";
11
+ import { Outlet, useLocation, useNavigate } from "react-router-dom";
12
+ import { jsx } from "react/jsx-runtime";
13
+ var SETTINGS_LANDING_ROUTES = DEFAULT_LANDING_ROUTES.filter(
14
+ (route) => route.to.startsWith("/settings/")
15
+ );
16
+ var Settings = () => {
17
+ const navigate = useNavigate();
18
+ const location = useLocation();
19
+ const { hasPermission, isLoading } = usePermissions();
20
+ const destination = useMemo(() => {
21
+ const accessible = SETTINGS_LANDING_ROUTES.find(
22
+ (route) => hasPermission(route.permission)
23
+ );
24
+ return accessible?.to ?? "/settings/profile";
25
+ }, [hasPermission]);
26
+ useEffect(() => {
27
+ if (isLoading || location.pathname !== "/settings") {
28
+ return;
29
+ }
30
+ navigate(destination, { replace: true });
31
+ }, [isLoading, location.pathname, destination, navigate]);
32
+ return /* @__PURE__ */ jsx(Outlet, {});
33
+ };
34
+ export {
35
+ Settings as Component
36
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/dashboard",
3
- "version": "2.22.3-snapshot-20261103230838",
3
+ "version": "2.22.3",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "scripts": {
6
6
  "typecheck": "tsgo --noEmit -p tsconfig.typecheck.json",
@@ -72,10 +72,10 @@
72
72
  "@dnd-kit/utilities": "^3.2.2",
73
73
  "@hookform/error-message": "^2.0.1",
74
74
  "@hookform/resolvers": "6.0.0",
75
- "@medusajs/admin-shared": "2.22.3-snapshot-20261103230838",
76
- "@medusajs/icons": "2.22.3-snapshot-20261103230838",
77
- "@medusajs/js-sdk": "2.22.3-snapshot-20261103230838",
78
- "@medusajs/ui": "4.2.10-snapshot-20261103230838",
75
+ "@medusajs/admin-shared": "2.22.3",
76
+ "@medusajs/icons": "2.22.3",
77
+ "@medusajs/js-sdk": "2.22.3",
78
+ "@medusajs/ui": "4.2.10",
79
79
  "@radix-ui/react-dialog": "1.1.4",
80
80
  "@radix-ui/react-dismissable-layer": "1.1.4",
81
81
  "@tanstack/react-query": "5.64.2",
@@ -107,10 +107,10 @@
107
107
  "zod": "4.6.6"
108
108
  },
109
109
  "devDependencies": {
110
- "@medusajs/admin-shared": "2.22.3-snapshot-20261103230838",
111
- "@medusajs/admin-vite-plugin": "2.22.3-snapshot-20261103230838",
112
- "@medusajs/types": "2.22.3-snapshot-20261103230838",
113
- "@medusajs/ui-preset": "2.22.3-snapshot-20261103230838",
110
+ "@medusajs/admin-shared": "2.22.3",
111
+ "@medusajs/admin-vite-plugin": "2.22.3",
112
+ "@medusajs/types": "2.22.3",
113
+ "@medusajs/ui-preset": "2.22.3",
114
114
  "@types/qrcode": "^1.5.5",
115
115
  "@typescript/native-preview": "^7.0.0-dev.20260423.1",
116
116
  "eslint": "^9.39.5",
@@ -1,10 +1,7 @@
1
1
  import { useEffect, useMemo } from "react"
2
2
  import { useNavigate } from "react-router-dom"
3
3
 
4
- import {
5
- DEFAULT_LANDING_ROUTES,
6
- NO_PERMISSIONS_ROUTE,
7
- } from "../../lib/permissions"
4
+ import { DEFAULT_LANDING_ROUTES } from "../../lib/permissions"
8
5
  import { usePermissions } from "../../providers/permissions-provider"
9
6
 
10
7
  export const Home = () => {
@@ -16,7 +13,7 @@ export const Home = () => {
16
13
  hasPermission(route.permission)
17
14
  )
18
15
 
19
- return accessible?.to ?? NO_PERMISSIONS_ROUTE
16
+ return accessible?.to ?? "/settings/profile"
20
17
  }, [hasPermission])
21
18
 
22
19
  useEffect(() => {
@@ -1,15 +1,33 @@
1
- import { useEffect } from "react"
1
+ import { useEffect, useMemo } from "react"
2
2
  import { Outlet, useLocation, useNavigate } from "react-router-dom"
3
3
 
4
+ import { DEFAULT_LANDING_ROUTES } from "../../lib/permissions"
5
+ import { usePermissions } from "../../providers/permissions-provider"
6
+
7
+ const SETTINGS_LANDING_ROUTES = DEFAULT_LANDING_ROUTES.filter((route) =>
8
+ route.to.startsWith("/settings/")
9
+ )
10
+
4
11
  export const Settings = () => {
5
12
  const navigate = useNavigate()
6
13
  const location = useLocation()
14
+ const { hasPermission, isLoading } = usePermissions()
15
+
16
+ const destination = useMemo(() => {
17
+ const accessible = SETTINGS_LANDING_ROUTES.find((route) =>
18
+ hasPermission(route.permission)
19
+ )
20
+
21
+ return accessible?.to ?? "/settings/profile"
22
+ }, [hasPermission])
7
23
 
8
24
  useEffect(() => {
9
- if (location.pathname === "/settings") {
10
- navigate("/settings/store", { replace: true })
25
+ if (isLoading || location.pathname !== "/settings") {
26
+ return
11
27
  }
12
- }, [location.pathname, navigate])
28
+
29
+ navigate(destination, { replace: true })
30
+ }, [isLoading, location.pathname, destination, navigate])
13
31
 
14
32
  return <Outlet />
15
33
  }
@@ -1,19 +0,0 @@
1
- import "./chunk-QZ7TP4HQ.mjs";
2
-
3
- // src/routes/settings/settings.tsx
4
- import { useEffect } from "react";
5
- import { Outlet, useLocation, useNavigate } from "react-router-dom";
6
- import { jsx } from "react/jsx-runtime";
7
- var Settings = () => {
8
- const navigate = useNavigate();
9
- const location = useLocation();
10
- useEffect(() => {
11
- if (location.pathname === "/settings") {
12
- navigate("/settings/store", { replace: true });
13
- }
14
- }, [location.pathname, navigate]);
15
- return /* @__PURE__ */ jsx(Outlet, {});
16
- };
17
- export {
18
- Settings as Component
19
- };