@endora-commerce/admin-shell 0.100.2 → 0.101.0

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.
@@ -40,6 +40,23 @@ export interface AdminRootProps {
40
40
  * cannot name a file in the project that consumes it.
41
41
  */
42
42
  readonly contributions: readonly AdminRegistryEntry[];
43
+ /**
44
+ * The path this admin is served under — `/admin` — when it is not the root.
45
+ *
46
+ * Defaults to the bundle's own base ({@link routerBasename} over Vite's
47
+ * `import.meta.env.BASE_URL`), so a project that builds with
48
+ * `base: '/admin/'` gets a router under `/admin` with nothing else to set:
49
+ * one value, the bundler's, moves the asset URLs and the routes together.
50
+ */
51
+ readonly basename?: string | undefined;
43
52
  }
44
- export declare function AdminRoot({ contributions }: AdminRootProps): ReactNode;
53
+ /**
54
+ * The router's basename for a bundler `base`.
55
+ *
56
+ * `'/admin/'` is `'/admin'`; the root — `'/'`, the empty string, and Vite's
57
+ * relative `'./'` — is no basename at all, which is the router this shell has
58
+ * always mounted.
59
+ */
60
+ export declare function routerBasename(base: string | undefined): string | undefined;
61
+ export declare function AdminRoot({ contributions, basename }: AdminRootProps): ReactNode;
45
62
  //# sourceMappingURL=AdminRoot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AdminRoot.d.ts","sourceRoot":"","sources":["../src/AdminRoot.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAKnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,MAAM,WAAW,cAAc;IAC7B;;;;;;;OAOG;IACH,QAAQ,CAAC,aAAa,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACvD;AAED,wBAAgB,SAAS,CAAC,EAAE,aAAa,EAAE,EAAE,cAAc,GAAG,SAAS,CAoBtE"}
1
+ {"version":3,"file":"AdminRoot.d.ts","sourceRoot":"","sources":["../src/AdminRoot.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAKnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,MAAM,WAAW,cAAc;IAC7B;;;;;;;OAOG;IACH,QAAQ,CAAC,aAAa,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACtD;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAI3E;AAYD,wBAAgB,SAAS,CAAC,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,cAAc,GAAG,SAAS,CAqBhF"}
package/dist/AdminRoot.js CHANGED
@@ -33,7 +33,30 @@ import { StrictMode } from 'react';
33
33
  import { BrowserRouter } from 'react-router-dom';
34
34
  import { App } from './App.js';
35
35
  import { AuthProvider } from './lib/auth.js';
36
- export function AdminRoot({ contributions }) {
37
- return (_jsx(StrictMode, { children: _jsx(BrowserRouter, { useTransitions: false, children: _jsx(AuthProvider, { children: _jsx(App, { contributions: contributions }) }) }) }));
36
+ /**
37
+ * The router's basename for a bundler `base`.
38
+ *
39
+ * `'/admin/'` is `'/admin'`; the root — `'/'`, the empty string, and Vite's
40
+ * relative `'./'` — is no basename at all, which is the router this shell has
41
+ * always mounted.
42
+ */
43
+ export function routerBasename(base) {
44
+ if (base === undefined || !base.startsWith('/'))
45
+ return undefined;
46
+ const trimmed = base.replace(/\/+$/, '');
47
+ return trimmed.length === 0 ? undefined : trimmed;
48
+ }
49
+ /**
50
+ * The base the bundle was built with. Vite replaces the expression at build
51
+ * time in the consuming project, exactly as it does `VITE_API_BASE_URL`
52
+ * (`@endora-commerce/admin-kit`'s api client); outside a Vite build it is
53
+ * absent and the router sits at the root.
54
+ */
55
+ function bundleBase() {
56
+ return import.meta.env?.BASE_URL;
57
+ }
58
+ export function AdminRoot({ contributions, basename }) {
59
+ const under = basename ?? routerBasename(bundleBase());
60
+ return (_jsx(StrictMode, { children: _jsx(BrowserRouter, { useTransitions: false, ...(under === undefined ? {} : { basename: under }), children: _jsx(AuthProvider, { children: _jsx(App, { contributions: contributions }) }) }) }));
38
61
  }
39
62
  //# sourceMappingURL=AdminRoot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AdminRoot.js","sourceRoot":"","sources":["../src/AdminRoot.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAe7C,MAAM,UAAU,SAAS,CAAC,EAAE,aAAa,EAAkB;IACzD,OAAO,CACL,KAAC,UAAU,cAWT,KAAC,aAAa,IAAC,cAAc,EAAE,KAAK,YAClC,KAAC,YAAY,cACX,KAAC,GAAG,IAAC,aAAa,EAAE,aAAa,GAAI,GACxB,GACD,GACL,CACd,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"AdminRoot.js","sourceRoot":"","sources":["../src/AdminRoot.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAwB7C;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,IAAwB;IACrD,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IAClE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACzC,OAAO,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;AACpD,CAAC;AAED;;;;;GAKG;AACH,SAAS,UAAU;IACjB,OAAQ,MAAM,CAAC,IAAwC,CAAC,GAAG,EAAE,QAAQ,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,EAAE,aAAa,EAAE,QAAQ,EAAkB;IACnE,MAAM,KAAK,GAAG,QAAQ,IAAI,cAAc,CAAC,UAAU,EAAE,CAAC,CAAC;IACvD,OAAO,CACL,KAAC,UAAU,cAWT,KAAC,aAAa,IAAC,cAAc,EAAE,KAAK,KAAM,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,YACxF,KAAC,YAAY,cACX,KAAC,GAAG,IAAC,aAAa,EAAE,aAAa,GAAI,GACxB,GACD,GACL,CACd,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -44,7 +44,7 @@
44
44
  * binding, forwarded, so an instance's `main.tsx` names **one** package and the
45
45
  * provider `useAuth` reads is the same one in every process.
46
46
  */
47
- export { AdminRoot } from './AdminRoot.js';
47
+ export { AdminRoot, routerBasename } from './AdminRoot.js';
48
48
  export type { AdminRootProps } from './AdminRoot.js';
49
49
  export { App } from './App.js';
50
50
  export type { AppProps } from './App.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,YAAY,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAChE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,YAAY,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAChE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC"}
package/dist/index.js CHANGED
@@ -44,7 +44,7 @@
44
44
  * binding, forwarded, so an instance's `main.tsx` names **one** package and the
45
45
  * provider `useAuth` reads is the same one in every process.
46
46
  */
47
- export { AdminRoot } from './AdminRoot.js';
47
+ export { AdminRoot, routerBasename } from './AdminRoot.js';
48
48
  export { App } from './App.js';
49
49
  export { registerAdminServiceWorker } from './registerSw.js';
50
50
  export { AuthProvider } from './lib/auth.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@endora-commerce/admin-shell",
3
- "version": "0.100.2",
3
+ "version": "0.101.0",
4
4
  "type": "module",
5
5
  "description": "The admin application itself (feature 110, FR-016) — the router, the sidebar and palette shell, the sign-in screen and the host's own screens. An instance depends on it and holds only index.html, main.tsx, the configuration, the brand assets, the theme overrides and the generated contribution registry.",
6
6
  "license": "MIT",
@@ -37,8 +37,8 @@
37
37
  "react-router-dom": "^7.18.2",
38
38
  "tailwindcss": "^4.2.4",
39
39
  "vite": "^7.3.2",
40
- "@endora-commerce/admin-kit": "0.100.2",
41
- "@endora-commerce/contracts": "0.100.2"
40
+ "@endora-commerce/admin-kit": "0.101.0",
41
+ "@endora-commerce/contracts": "0.101.0"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "@tailwindcss/vite": {
@@ -66,8 +66,8 @@
66
66
  "react-router-dom": "^7.18.2",
67
67
  "typescript": "^5.9.3",
68
68
  "vite": "^7.3.2",
69
- "@endora-commerce/contracts": "0.100.2",
70
- "@endora-commerce/admin-kit": "0.100.2"
69
+ "@endora-commerce/admin-kit": "0.101.0",
70
+ "@endora-commerce/contracts": "0.101.0"
71
71
  },
72
72
  "scripts": {
73
73
  "build": "tsc -p tsconfig.build.json",