@medusajs/admin-shared 2.22.0-snapshot-20261021091347 → 2.22.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.
Files changed (3) hide show
  1. package/AGENTS.md +57 -0
  2. package/README.md +49 -1
  3. package/package.json +6 -2
package/AGENTS.md ADDED
@@ -0,0 +1,57 @@
1
+ # @medusajs/admin-shared
2
+
3
+ Shared constants, types, and validators for the Admin extension system, used by `@medusajs/admin-sdk`, `@medusajs/admin-vite-plugin`, `@medusajs/admin-bundler`, and `@medusajs/dashboard`. It defines the set of valid injection zones, nested route positions, core layouts, custom-field zones, and virtual module ids.
4
+
5
+ ## Using this package
6
+
7
+ App code rarely imports it directly. The main reason to use it is TypeScript augmentation in a plugin:
8
+
9
+ ```ts
10
+ // my-plugin/index.d.ts (listed in package.json "files" and "exports"."."."types")
11
+ declare module "@medusajs/admin-shared" {
12
+ interface InjectionZoneRegistry {
13
+ "brand.details": true
14
+ "brand.details.side": true
15
+ "brand.list": true
16
+ }
17
+ interface LayoutSectionRegistry {
18
+ "my-plugin:three-column": "main" | "left" | "right"
19
+ }
20
+ }
21
+ ```
22
+
23
+ - `InjectionZoneRegistry` augmentation adds zones to `defineWidgetConfig`'s `zone` autocomplete.
24
+ - `LayoutSectionRegistry` augmentation types `LayoutComposer`'s `sections` for a custom layout registered with `defineLayoutConfig`.
25
+ - `CORE_LAYOUT_IDS`: `core:single-column`, `core:single-row`, `core:two-column`, `core:settings-sidebar`.
26
+
27
+ Docs: https://docs.medusajs.com/learn/fundamentals/admin/custom-injection-zones.md
28
+
29
+ ## Architecture
30
+
31
+ - `src/extensions/widgets/`:
32
+ - `INJECTION_ZONES`: one `LEGACY_*` (`.before` / `.after`) and one current array per entity, spread into a single list.
33
+ - `InjectionZoneRegistry`: an interface built from that list, so plugins can extend it.
34
+ - `isValidInjectionZone`: accepts any string.
35
+ - `src/extensions/routes/`: `NESTED_ROUTE_POSITIONS` (`/orders`, `/products`, `/inventory`, `/customers`, `/promotions`, `/price-lists`).
36
+ - `src/extensions/layouts/`: `CORE_LAYOUT_IDS`, `LayoutSection` (`ordering`: `list` | `grid` | `horizontal-stretched` | `horizontal-list`), `LayoutSectionRegistry`.
37
+ - `src/extensions/custom-fields/`: models, form zones, tabs, and display zones for the experimental custom-fields API. Only `product` is implemented (`product/`).
38
+ - `src/virtual-modules/constants.ts`: `virtual:medusa/*` ids and the `VIRTUAL_MODULES` list.
39
+ - `src/utils/`: `deepMerge`, `isObject`.
40
+
41
+ ## Development
42
+
43
+ ```bash
44
+ yarn build # tsup
45
+ ```
46
+
47
+ No tests in this package. Behavior is covered by `@medusajs/admin-vite-plugin` specs.
48
+
49
+ ## Gotchas
50
+
51
+ - Adding a zone to a core dashboard page:
52
+ - Add the non-suffixed zone(s) to the entity's `*_INJECTION_ZONES` array and make sure that array is spread into `INJECTION_ZONES`.
53
+ - Update the zone docs under `www/apps/resources/app/commerce-modules/*/admin-widget-zones/`.
54
+ - Never add new `.before` / `.after` zones. The layout composer ignores them (`login.before` / `login.after` are the only exception).
55
+ - `isValidInjectionZone` returns `true` for unknown strings and only logs a warning, so custom zones work but typos are not rejected at build time.
56
+ - Adding a virtual module means updating `VIRTUAL_MODULES` here, `vmod.ts` in `@medusajs/admin-vite-plugin`, and the `external` list in the dashboard's `tsup.config.cjs`.
57
+ - Any change to an exported union type is a public API change for `@medusajs/admin-sdk` users.
package/README.md CHANGED
@@ -1 +1,49 @@
1
- # @medusajs/admin-shared
1
+ <p align="center">
2
+ <a href="https://www.medusajs.com">
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/59018053/229103275-b5e482bb-4601-46e6-8142-244f531cebdb.svg">
5
+ <source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/59018053/229103726-e5b529a3-9b3f-4970-8a1f-c6af37f087bf.svg">
6
+ <img alt="Medusa logo" src="https://user-images.githubusercontent.com/59018053/229103726-e5b529a3-9b3f-4970-8a1f-c6af37f087bf.svg">
7
+ </picture>
8
+ </a>
9
+ </p>
10
+ <h1 align="center">
11
+ @medusajs/admin-shared
12
+ </h1>
13
+
14
+ <h4 align="center">
15
+ <a href="https://docs.medusajs.com">Documentation</a> |
16
+ <a href="https://www.medusajs.com">Website</a>
17
+ </h4>
18
+
19
+ <p align="center">
20
+ Building blocks for digital commerce
21
+ </p>
22
+ <p align="center">
23
+ <a href="https://github.com/medusajs/medusa/blob/develop/LICENSE">
24
+ <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="Medusa is released under the MIT license." />
25
+ </a>
26
+ <a href="https://github.com/medusajs/medusa/blob/develop/CONTRIBUTING.md">
27
+ <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat" alt="PRs welcome!" />
28
+ </a>
29
+ <a href="https://discord.gg/xpCwq3Kfn8">
30
+ <img src="https://img.shields.io/badge/chat-on%20discord-7289DA.svg" alt="Discord Chat" />
31
+ </a>
32
+ <a href="https://twitter.com/intent/follow?screen_name=medusajs">
33
+ <img src="https://img.shields.io/twitter/follow/medusajs.svg?label=Follow%20@medusajs" alt="Follow @medusajs" />
34
+ </a>
35
+ </p>
36
+
37
+ Shared constants, types, and utilities for Medusa's admin packages, such as the list of widget injection zones (`INJECTION_ZONES`, `InjectionZone`) and custom field, route, and layout extension types. It's internal plumbing used by `@medusajs/admin-sdk`, `@medusajs/admin-vite-plugin`, `@medusajs/admin-bundler`, and `@medusajs/dashboard`; you don't need to install or import it directly to build admin extensions.
38
+
39
+ ## At a glance
40
+
41
+ | | |
42
+ |---|---|
43
+ | Package | `@medusajs/admin-shared` |
44
+ | Type | Internal tooling |
45
+
46
+ ## Resources
47
+
48
+ - [Widget Injection Zones](https://docs.medusajs.com/resources/admin-widget-injection-zones)
49
+ - [Admin Development](https://docs.medusajs.com/learn/fundamentals/admin)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@medusajs/admin-shared",
3
3
  "description": "Shared code for Medusa admin packages.",
4
- "version": "2.22.0-snapshot-20261021091347",
4
+ "version": "2.22.0",
5
5
  "author": "Kasper Kristensen <kasper@medusajs.com>",
6
6
  "types": "dist/index.d.ts",
7
7
  "main": "dist/index.js",
@@ -16,8 +16,12 @@
16
16
  },
17
17
  "files": [
18
18
  "dist",
19
- "package.json"
19
+ "package.json",
20
+ "AGENTS.md"
20
21
  ],
22
+ "llms": "https://docs.medusajs.com/llms.txt",
23
+ "llmsFull": "https://docs.medusajs.com/llms-full.txt",
24
+ "mcpServer": "https://docs.medusajs.com/mcp",
21
25
  "scripts": {
22
26
  "build": "yarn run -T tsup"
23
27
  },