Skip to content

The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.

feat(types): add attribute module types and extend product types (#817)

Jakub Sieradzki17891fc1eb89
diff --git a/.claude/skills/admin-form-ui/SKILL.md b/.claude/skills/admin-form-ui/SKILL.md
index 83ad92156..b2f873b56 100644
--- a/.claude/skills/admin-form-ui/SKILL.md
+++ b/.claude/skills/admin-form-ui/SKILL.md
@@ -57,6 +57,8 @@ Every form field MUST follow this structure:
9. Do NOT use `window.confirm` — use `usePrompt()` for confirmations.
10. Do NOT use raw `<form>` — use `<KeyboundForm>` for Ctrl/Cmd+Enter support.
11. Do NOT skip `isPending` guard on submit — both button `isLoading` AND keyboard submit must check it.
+12. Do NOT hand-roll custom input components — ALWAYS check `packages/admin/src/components/inputs/` and the Field Types Reference table below FIRST. If a component exists (HandleInput, ChipInput, SwitchBox, etc.), use it. Never create a custom wrapper for something that already has a reusable component.
+13. Do NOT call `useRouteModal()` outside of `RouteDrawer` or `RouteFocusModal` — it requires the provider. Split into outer shell (RouteDrawer + data fetch) and inner form component (useRouteModal + form logic). See RouteDrawer Form Structure below.
## Form.Label Features
diff --git a/CLAUDE.md b/CLAUDE.md
index caf95c9cf..3f44a99c9 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -175,6 +175,43 @@ Documentation site built with [Mintlify](https://mintlify.com). Configuration li
- **Sections**: Quick start, Core Concepts, Product (modules, workflows, events, subscribers), Integrations, Deployment, API Reference, Changelog
- **Dev server**: `mintlify dev` from `apps/docs/`
+## Skills (`.claude/skills/`)
+
+Before writing ANY admin UI code, invoke the relevant skill. Skills contain hard rules and exact code patterns.
+
+| Skill | When to use |
+|-------|-------------|
+| `admin-page-ui` | List pages, detail pages, Container sections, ActionMenu, empty states |
+| `admin-form-ui` | Form fields, edit drawers (RouteDrawer), create modals (RouteFocusModal) |
+| `admin-tab-ui` | Tabbed wizard forms (ProgressTabs, TabbedForm) |
+| `medusa-ui-conformance` | Before adding any custom UI — check if @medusajs/ui or local wrapper exists |
+| `cc-alignment` | Renaming/restructuring compound component exports |
+| `compound-components-migration-review` | Migrating pages to compound component pattern |
+| `code-review` | After completing implementation, before merging |
+| `admin-ui-review` | Reviewing admin UI code for pattern consistency |
+
+## Reusable Components (`packages/admin/src/components/`)
+
+**ALWAYS search for existing components before writing custom UI.** Never hand-roll what already exists.
+
+| Component | Path | Use for |
+|-----------|------|---------|
+| `HandleInput` | `components/inputs/handle-input/` | Handle/slug fields with `/` prefix |
+| `ChipInput` | `components/inputs/chip-input/` | Tag-like multi-value inputs |
+| `SwitchBox` | `components/common/switch-box/` | Switch with label + description card |
+| `Form.*` | `components/common/form/` | All form fields (Field, Label, Control, ErrorMessage, Hint) |
+| `ActionMenu` | `components/common/action-menu/` | Dropdown action menus (edit, delete) |
+| `SectionRow` | `components/common/section/` | Key-value rows in detail sections |
+| `RouteDrawer` | `components/modals/` | Edit drawers with route-based open/close |
+| `RouteFocusModal` | `components/modals/` | Create modals with route-based open/close |
+| `useRouteModal` | `components/modals/` | Get `handleSuccess()` — must be INSIDE RouteDrawer/RouteFocusModal |
+| `KeyboundForm` | `components/utilities/keybound-form/` | Form with Ctrl+Enter submit |
+| `_DataTable` | `components/table/data-table/` | Table with filters, search, sort, pagination |
+| `SingleColumnPage` | `components/layout/pages/` | List page wrapper |
+| `TwoColumnPage` | `components/layout/pages/` | Detail page wrapper (Main + Sidebar) |
+| `useDataTable` | `hooks/use-data-table` | Table state (pagination, row selection) synced to URL |
+| `useQueryParams` | `hooks/use-query-params` | Extract typed query params from URL |
+
## Architecture
- **Foundation**: MedusaJS v2 (headless commerce)
diff --git a/bun.lock b/bun.lock
index 49ac0de22..494c8cd27 100644
--- a/bun.lock
+++ b/bun.lock
@@ -17,6 +17,20 @@
"typescript-eslint": "^8.53.0",
},
},
+ "apps/admin": {
+ "name": "@acme/admin",
+ "version": "0.0.0",
+ "dependencies": {
+ "@acme/api": "*",
+ "@mercurjs/admin": "*",
+ "@mercurjs/client": "*",
+ "@mercurjs/dashboard-sdk": "*",
+ "@mercurjs/dashboard-shared": "*",
+ },
+ "devDependencies": {
+ "@types/node": "^24.10.1",
+ },
+ },
"apps/api": {
"name": "@acme/api",
"version": "0.0.1",
@@ -94,13 +108,11 @@
"@medusajs/medusa": "^2.13.4",
"@mercurjs/core-plugin": "*",
"jsonwebtoken": "^9.0.2",
- "meilisearch": "^0.47.0",
"scrypt-kdf": "^2.0.1",
},
"devDependencies": {
"@medusajs/test-utils": "^2.13.4",
"@medusajs/types": "2.13.4",
- "@mercurjs/types": "*",
"@swc/core": "^1.7.28",
"@swc/jest": "^0.2.36",
"@types/jest": "^29.5.13",
@@ -263,7 +275,6 @@
"@types/react-dom": "^18.2.25",
"cors": "^2.8.5",
"http-proxy-middleware": "^3.0.3",
- "jsonwebtoken": "^9.0.2",
"multer": "^2.0.2",
"prop-types": "^15.8.1",
"react": "^18.2.0",
@@ -390,7 +401,6 @@
"@tanstack/react-table": "8.20.5",
"algoliasearch": "^5.40.0",
"jsonwebtoken": "9.0.2",
- "meilisearch": "^0.47.0",
"react-hook-form": "7.49.1",
"react-i18next": "13.5.0",
"react-jwt": "2.0.0",
@@ -401,16 +411,12 @@
"@medusajs/cli": "^2.13.4",
"@mercurjs/cli": "workspace:*",
"@mercurjs/types": "workspace:*",
- "@swc/core": "^1.7.28",
- "@swc/jest": "^0.2.36",
- "@types/jest": "^29.5.13",
"@types/jsonwebtoken": "^9.0.9",
"@types/multer": "^2.0.0",
"@types/node": "^22",
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
"@types/unzipper": "^0.10.10",
- "jest": "^30.2.0",
},
},
"packages/types": {
@@ -475,9 +481,6 @@
"@mercurjs/types": "workspace:*",
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
- "autoprefixer": "^10.4.20",
- "postcss": "^8.4.49",
- "tailwindcss": "^3.4.19",
"tsup": "^8.0.2",
"typescript": "5.9.3",
},
@@ -488,6 +491,8 @@
},
},
"packages": {
+ "@acme/admin": ["@acme/admin@workspace:apps/admin"],
+
"@acme/api": ["@acme/api@workspace:apps/api"],
"@acme/vendor": ["@acme/vendor@workspace:apps/vendor"],
@@ -1844,7 +1849,7 @@
"@types/mute-stream": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-CPM9nzrCPPJHQNA9keH9CVkVI+WR5kMa+7XEs5jcGQ0VoAGnLv242w8lIVgwAEfmE4oufJRaTc9PNLQl0ioAow=="],
- "@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw=="],
+ "@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ=="],
"@types/pg": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*", "pg-protocol": "*", "pg-types": "^2.2.0" } }, "sha512-gT+oueVQkqnj6ajGJXblFR4iavIXWsGAFCk3dP4Kki5+a9R4NMt0JARdk6s8cUKcfUoqP5dAtDSLU8xYUTFV+Q=="],
@@ -2790,8 +2795,6 @@
"media-typer": ["[email protected]", "", {}, "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ=="],
- "meilisearch": ["[email protected]", "", {}, "sha512-Qq+hatuDJ0z5c+szVb0O/uI7Z2jfMUjj8eNB6xPyKp9Og7GVnrOZJRVoDPqGoVY484Iwh+F61y2UreIetda00w=="],
-
"merge-descriptors": ["[email protected]", "", {}, "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ=="],
"merge-stream": ["[email protected]", "", {}, "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w=="],
@@ -3374,7 +3377,7 @@
"unc-path-regex": ["[email protected]", "", {}, "sha512-eXL4nmJT7oCpkZsHZUOJo8hcX3GbsiDOa0Qu9F646fi8dT3XuSVopVqAcEiVzSKKH7UoDti23wNX3qGFxcW5Qg=="],
- "undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+ "undici-types": ["[email protected]", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
"unicorn-magic": ["[email protected]", "", {}, "sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA=="],
@@ -3476,7 +3479,7 @@
"zod-validation-error": ["[email protected]", "", { "peerDependencies": { "zod": "^3.25.0" } }, "sha512-ozT8jy2nHaeKjaRIEThwgRXBwm16hAy0BaTRx1I2IY1xrezPegmlFmYKb5tcvYqZDQm0sfZtDr2IR7CdCJzTGw=="],
- "@acme/vendor/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ=="],
+ "@acme/api/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw=="],
"@acme/vendor/globals": ["[email protected]", "", {}, "sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ=="],
@@ -3568,26 +3571,16 @@
"@istanbuljs/load-nyc-config/js-yaml": ["[email protected]", "", { "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg=="],
- "@jest/console/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ=="],
-
- "@jest/core/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ=="],
-
"@jest/core/ansi-escapes": ["[email protected]", "", { "dependencies": { "type-fest": "^0.21.3" } }, "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ=="],
"@jest/create-cache-key-function/@jest/types": ["@jest/[email protected]", "", { "dependencies": { "@jest/pattern": "30.0.1", "@jest/schemas": "30.0.5", "@types/istanbul-lib-coverage": "^2.0.6", "@types/istanbul-reports": "^3.0.4", "@types/node": "*", "@types/yargs": "^17.0.33", "chalk": "^4.1.2" } }, "sha512-JHm87k7bA33hpBngtU8h6UBub/fqqA9uXfw+21j5Hmk7ooPHlboRNxHq0JcMtC+n8VJGP1mcfnD3Mk+XKe1oSw=="],
- "@jest/environment/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ=="],
-
- "@jest/fake-timers/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ=="],
-
"@jest/pattern/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-F0R/h2+dsy5wJAUe3tAU6oqa2qbWY5TpNfL/RGmo1y38hiyO1w3x2jPtt76wmuaJI4DQnOBu21cNXQ2STIUUWg=="],
"@jest/pattern/jest-regex-util": ["[email protected]", "", {}, "sha512-jHEQgBXAgc+Gh4g0p3bCevgRCVRkB4VB70zhoAE48gxeSr1hfUOsM/C2WoJgVL7Eyg//hudYENbm3Ne+/dRVVA=="],
"@jest/reporters/@jridgewell/trace-mapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
- "@jest/reporters/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ=="],
-
"@jest/reporters/glob": ["[email protected]", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q=="],
"@jest/snapshot-utils/@jest/types": ["@jest/[email protected]", "", { "dependencies": { "@jest/pattern": "30.0.1", "@jest/schemas": "30.0.5", "@types/istanbul-lib-coverage": "^2.0.6", "@types/istanbul-reports": "^3.0.4", "@types/node": "*", "@types/yargs": "^17.0.33", "chalk": "^4.1.2" } }, "sha512-JHm87k7bA33hpBngtU8h6UBub/fqqA9uXfw+21j5Hmk7ooPHlboRNxHq0JcMtC+n8VJGP1mcfnD3Mk+XKe1oSw=="],
@@ -3650,7 +3643,7 @@
"@mercurjs/cli/@mercurjs/dashboard-sdk": ["@mercurjs/[email protected]", "", { "dependencies": { "@babel/parser": "7.25.6", "@babel/traverse": "7.25.6", "@babel/types": "7.25.6", "esbuild-register": "^3.6.0" } }, "sha512-Q0W+bOjALdwrwte503rIrEoE0MrMwNe//MtdiGNJAP20jO9VWxTUS0R1bABCT3HHjXP4SDMv3/7C0OcfSVUU2w=="],
- "@mercurjs/core-plugin/jsonwebtoken": ["[email protected]", "", { "dependencies": { "jws": "^4.0.1", "lodash.includes": "^4.3.0", "lodash.isboolean": "^3.0.3", "lodash.isinteger": "^4.0.4", "lodash.isnumber": "^3.0.3", "lodash.isplainobject": "^4.0.6", "lodash.isstring": "^4.0.1", "lodash.once": "^4.0.0", "ms": "^2.1.1", "semver": "^7.5.4" } }, "sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g=="],
+ "@mercurjs/core-plugin/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw=="],
"@mercurjs/dashboard-sdk/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-F0R/h2+dsy5wJAUe3tAU6oqa2qbWY5TpNfL/RGmo1y38hiyO1w3x2jPtt76wmuaJI4DQnOBu21cNXQ2STIUUWg=="],
@@ -3658,6 +3651,8 @@
"@mercurjs/dashboard-shared/react-jwt": ["[email protected]", "", { "optionalDependencies": { "fsevents": "^2.3.2" }, "peerDependencies": { "react": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-aC+X6q8pi63zoO7A060/4mfF5jM6Ay+4YyY4QgdD8dDOqp89sPcg0IhWEHyPACnVETMjBWzmxMPgIPosQNeYyw=="],
+ "@mercurjs/integration-tests/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw=="],
+
"@mercurjs/integration-tests/jest": ["[email protected]", "", { "dependencies": { "@jest/core": "30.3.0", "@jest/types": "30.3.0", "import-local": "^3.2.0", "jest-cli": "30.3.0" }, "peerDependencies": { "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" }, "optionalPeers": ["node-notifier"], "bin": "./bin/jest.js" }, "sha512-AkXIIFcaazymvey2i/+F94XRnM6TsVLZDhBMLsd1Sf/W0wzsvvpjeyUrCZD6HGG4SDYPgDJDBKeiJTBb10WzMg=="],
"@mercurjs/integration-tests/jsonwebtoken": ["[email protected]", "", { "dependencies": { "jws": "^4.0.1", "lodash.includes": "^4.3.0", "lodash.isboolean": "^3.0.3", "lodash.isinteger": "^4.0.4", "lodash.isnumber": "^3.0.3", "lodash.isplainobject": "^4.0.6", "lodash.isstring": "^4.0.1", "lodash.once": "^4.0.0", "ms": "^2.1.1", "semver": "^7.5.4" } }, "sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g=="],
@@ -3666,8 +3661,6 @@
"@mercurjs/registry/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-F0R/h2+dsy5wJAUe3tAU6oqa2qbWY5TpNfL/RGmo1y38hiyO1w3x2jPtt76wmuaJI4DQnOBu21cNXQ2STIUUWg=="],
- "@mercurjs/registry/jest": ["[email protected]", "", { "dependencies": { "@jest/core": "30.3.0", "@jest/types": "30.3.0", "import-local": "^3.2.0", "jest-cli": "30.3.0" }, "peerDependencies": { "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" }, "optionalPeers": ["node-notifier"], "bin": "./bin/jest.js" }, "sha512-AkXIIFcaazymvey2i/+F94XRnM6TsVLZDhBMLsd1Sf/W0wzsvvpjeyUrCZD6HGG4SDYPgDJDBKeiJTBb10WzMg=="],
-
"@mercurjs/vendor/@mercurjs/client": ["@mercurjs/[email protected]", "", { "dependencies": { "@tanstack/react-query": "^5.64.2", "qs": "^6.12.1" }, "peerDependencies": { "typescript": ">=4.8.0" } }, "sha512-K/cFfsuJas2JC7d4aM5MJuYR9O3fgDP1HaNfj25FmAjWvuHpRpDIQTpOBCYuoURftrKOTPzopNvP7zxwue/IXg=="],
"@mercurjs/vendor/@mercurjs/dashboard-shared": ["@mercurjs/[email protected]", "", { "dependencies": { "@ariakit/react": "^0.4.15", "@babel/runtime": "^7.26.10", "@dnd-kit/core": "^6.1.0", "@dnd-kit/sortable": "^8.0.0", "@dnd-kit/utilities": "^3.2.2", "@hookform/error-message": "^2.0.1", "@hookform/resolvers": "3.4.2", "@medusajs/admin-shared": "^2.13.3", "@medusajs/dashboard": "^2.13.3", "@medusajs/icons": "2.13.3", "@medusajs/ui": "4.1.1", "@mercurjs/client": "2.0.0-canary.97", "@radix-ui/react-dialog": "1.1.4", "@radix-ui/react-dismissable-layer": "1.1.4", "@tanstack/react-query": "5.64.2", "@tanstack/react-table": "8.20.5", "@tanstack/react-virtual": "^3.8.3", "@uiw/react-json-view": "^2.0.0-alpha.17", "cmdk": "^0.2.0", "copy-to-clipboard": "^3.3.3", "date-fns": "^3.6.0", "i18next": "23.7.11", "i18next-browser-languagedetector": "7.2.0", "i18next-http-backend": "2.4.2", "lodash.debounce": "^4.0.8", "lodash.isequal": "^4.5.0", "match-sorter": "^6.3.4", "motion": "^11.15.0", "qs": "^6.12.1", "radix-ui": "1.1.2", "react-country-flag": "^3.1.0", "react-currency-input-field": "^3.6.11", "react-helmet-async": "^2.0.5", "react-hook-form": "7.49.1", "react-i18next": "13.5.0", "react-jwt": "^1.2.0", "react-router-dom": "6.30.3", "zod": "3.25.76" } }, "sha512-LueWIqtFE/5jcOsApZxuDO8iJs3FAcwo5135Y0xA17QJHzjYSDoZbx+QBiJWQxIu/eobnGxRJxTtC0fPM69uJg=="],
@@ -3822,8 +3815,6 @@
"@types/fs-extra/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-F0R/h2+dsy5wJAUe3tAU6oqa2qbWY5TpNfL/RGmo1y38hiyO1w3x2jPtt76wmuaJI4DQnOBu21cNXQ2STIUUWg=="],
- "@types/graceful-fs/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ=="],
-
"@types/http-proxy/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-F0R/h2+dsy5wJAUe3tAU6oqa2qbWY5TpNfL/RGmo1y38hiyO1w3x2jPtt76wmuaJI4DQnOBu21cNXQ2STIUUWg=="],
"@types/jsonfile/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-F0R/h2+dsy5wJAUe3tAU6oqa2qbWY5TpNfL/RGmo1y38hiyO1w3x2jPtt76wmuaJI4DQnOBu21cNXQ2STIUUWg=="],
@@ -3956,22 +3947,10 @@
"jest-changed-files/execa": ["[email protected]", "", { "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", "human-signals": "^2.1.0", "is-stream": "^2.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^4.0.1", "onetime": "^5.1.2", "signal-exit": "^3.0.3", "strip-final-newline": "^2.0.0" } }, "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg=="],
- "jest-circus/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ=="],
-
"jest-cli/yargs": ["[email protected]", "", { "dependencies": { "cliui": "^8.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.3", "y18n": "^5.0.5", "yargs-parser": "^21.1.1" } }, "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w=="],
"jest-config/glob": ["[email protected]", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q=="],
- "jest-environment-node/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ=="],
-
- "jest-haste-map/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ=="],
-
- "jest-mock/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ=="],
-
- "jest-runner/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ=="],
-
- "jest-runtime/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ=="],
-
"jest-runtime/glob": ["[email protected]", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q=="],
"jest-runtime/strip-bom": ["[email protected]", "", {}, "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w=="],
@@ -3980,12 +3959,8 @@
"jest-util/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-F0R/h2+dsy5wJAUe3tAU6oqa2qbWY5TpNfL/RGmo1y38hiyO1w3x2jPtt76wmuaJI4DQnOBu21cNXQ2STIUUWg=="],
- "jest-watcher/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ=="],
-
"jest-watcher/ansi-escapes": ["[email protected]", "", { "dependencies": { "type-fest": "^0.21.3" } }, "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ=="],
- "jest-worker/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ=="],
-
"jest-worker/supports-color": ["[email protected]", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="],
"knex/commander": ["[email protected]", "", {}, "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug=="],
@@ -4090,7 +4065,7 @@
"yargs/string-width": ["[email protected]", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
- "@acme/vendor/@types/node/undici-types": ["[email protected]", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
+ "@acme/api/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
"@aws-crypto/sha1-browser/@smithy/util-utf8/@smithy/util-buffer-from": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/is-array-buffer": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA=="],
@@ -4114,27 +4089,21 @@
"@inquirer/checkbox/ansi-escapes/type-fest": ["[email protected]", "", {}, "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w=="],
+ "@inquirer/core/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
"@inquirer/core/ansi-escapes/type-fest": ["[email protected]", "", {}, "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w=="],
"@istanbuljs/load-nyc-config/find-up/locate-path": ["[email protected]", "", { "dependencies": { "p-locate": "^4.1.0" } }, "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g=="],
"@istanbuljs/load-nyc-config/js-yaml/argparse": ["[email protected]", "", { "dependencies": { "sprintf-js": "~1.0.2" } }, "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg=="],
- "@jest/console/@types/node/undici-types": ["[email protected]", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
-
- "@jest/core/@types/node/undici-types": ["[email protected]", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
-
"@jest/core/ansi-escapes/type-fest": ["[email protected]", "", {}, "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w=="],
"@jest/create-cache-key-function/@jest/types/@jest/schemas": ["@jest/[email protected]", "", { "dependencies": { "@sinclair/typebox": "^0.34.0" } }, "sha512-DmdYgtezMkh3cpU8/1uyXakv3tJRcmcXxBOcO0tbaozPwpmh4YMsnWrQm9ZmZMfa5ocbxzbFk6O4bDPEc/iAnA=="],
"@jest/create-cache-key-function/@jest/types/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-F0R/h2+dsy5wJAUe3tAU6oqa2qbWY5TpNfL/RGmo1y38hiyO1w3x2jPtt76wmuaJI4DQnOBu21cNXQ2STIUUWg=="],
- "@jest/environment/@types/node/undici-types": ["[email protected]", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
-
- "@jest/fake-timers/@types/node/undici-types": ["[email protected]", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
-
- "@jest/reporters/@types/node/undici-types": ["[email protected]", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
+ "@jest/pattern/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
"@jest/snapshot-utils/@jest/types/@jest/schemas": ["@jest/[email protected]", "", { "dependencies": { "@sinclair/typebox": "^0.34.0" } }, "sha512-DmdYgtezMkh3cpU8/1uyXakv3tJRcmcXxBOcO0tbaozPwpmh4YMsnWrQm9ZmZMfa5ocbxzbFk6O4bDPEc/iAnA=="],
@@ -4142,6 +4111,8 @@
"@jest/transform/write-file-atomic/signal-exit": ["[email protected]", "", {}, "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="],
+ "@jest/types/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
"@medusajs/admin-vite-plugin/chokidar/glob-parent": ["[email protected]", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="],
"@medusajs/admin-vite-plugin/chokidar/readdirp": ["[email protected]", "", { "dependencies": { "picomatch": "^2.2.1" } }, "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA=="],
@@ -4192,7 +4163,11 @@
"@mercurjs/admin/@mercurjs/dashboard-shared/@medusajs/icons": ["@medusajs/[email protected]", "", { "peerDependencies": { "react": "^18.3.1" } }, "sha512-yL4J5hAl8URgYT/rCj1ndTbw1HMTwu1B1CwUtmcXweQqplOnYP6nUr2LrYTH9BkTNeFdLp0uCT8hE+2jtulZnw=="],
- "@mercurjs/core-plugin/jsonwebtoken/jws": ["[email protected]", "", { "dependencies": { "jwa": "^2.0.1", "safe-buffer": "^5.0.1" } }, "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA=="],
+ "@mercurjs/core-plugin/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
+ "@mercurjs/dashboard-sdk/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
+ "@mercurjs/integration-tests/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
"@mercurjs/integration-tests/jest/@jest/core": ["@jest/[email protected]", "", { "dependencies": { "@jest/console": "30.3.0", "@jest/pattern": "30.0.1", "@jest/reporters": "30.3.0", "@jest/test-result": "30.3.0", "@jest/transform": "30.3.0", "@jest/types": "30.3.0", "@types/node": "*", "ansi-escapes": "^4.3.2", "chalk": "^4.1.2", "ci-info": "^4.2.0", "exit-x": "^0.2.2", "graceful-fs": "^4.2.11", "jest-changed-files": "30.3.0", "jest-config": "30.3.0", "jest-haste-map": "30.3.0", "jest-message-util": "30.3.0", "jest-regex-util": "30.0.1", "jest-resolve": "30.3.0", "jest-resolve-dependencies": "30.3.0", "jest-runner": "30.3.0", "jest-runtime": "30.3.0", "jest-snapshot": "30.3.0", "jest-util": "30.3.0", "jest-validate": "30.3.0", "jest-watcher": "30.3.0", "pretty-format": "30.3.0", "slash": "^3.0.0" }, "peerDependencies": { "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" }, "optionalPeers": ["node-notifier"] }, "sha512-U5mVPsBxLSO6xYbf+tgkymLx+iAhvZX43/xI1+ej2ZOPnPdkdO1CzDmFKh2mZBn2s4XZixszHeQnzp1gm/DIxw=="],
@@ -4204,11 +4179,7 @@
"@mercurjs/payout-stripe-connect/@mercurjs/types/@medusajs/types": ["@medusajs/[email protected]", "", { "dependencies": { "bignumber.js": "^9.1.2" }, "peerDependencies": { "ioredis": "^5.4.1", "vite": "^5.4.21" }, "optionalPeers": ["ioredis", "vite"] }, "sha512-MWd4NvpROJ+CvsvTuPxF9RsGKom/KMftYeh19UhB+w+K8OGWTNwfHLLzOvW3sAHhAjTzt+IDxLrxbqGcAcgw/w=="],
- "@mercurjs/registry/jest/@jest/core": ["@jest/[email protected]", "", { "dependencies": { "@jest/console": "30.3.0", "@jest/pattern": "30.0.1", "@jest/reporters": "30.3.0", "@jest/test-result": "30.3.0", "@jest/transform": "30.3.0", "@jest/types": "30.3.0", "@types/node": "*", "ansi-escapes": "^4.3.2", "chalk": "^4.1.2", "ci-info": "^4.2.0", "exit-x": "^0.2.2", "graceful-fs": "^4.2.11", "jest-changed-files": "30.3.0", "jest-config": "30.3.0", "jest-haste-map": "30.3.0", "jest-message-util": "30.3.0", "jest-regex-util": "30.0.1", "jest-resolve": "30.3.0", "jest-resolve-dependencies": "30.3.0", "jest-runner": "30.3.0", "jest-runtime": "30.3.0", "jest-snapshot": "30.3.0", "jest-util": "30.3.0", "jest-validate": "30.3.0", "jest-watcher": "30.3.0", "pretty-format": "30.3.0", "slash": "^3.0.0" }, "peerDependencies": { "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" }, "optionalPeers": ["node-notifier"] }, "sha512-U5mVPsBxLSO6xYbf+tgkymLx+iAhvZX43/xI1+ej2ZOPnPdkdO1CzDmFKh2mZBn2s4XZixszHeQnzp1gm/DIxw=="],
-
- "@mercurjs/registry/jest/@jest/types": ["@jest/[email protected]", "", { "dependencies": { "@jest/pattern": "30.0.1", "@jest/schemas": "30.0.5", "@types/istanbul-lib-coverage": "^2.0.6", "@types/istanbul-reports": "^3.0.4", "@types/node": "*", "@types/yargs": "^17.0.33", "chalk": "^4.1.2" } }, "sha512-JHm87k7bA33hpBngtU8h6UBub/fqqA9uXfw+21j5Hmk7ooPHlboRNxHq0JcMtC+n8VJGP1mcfnD3Mk+XKe1oSw=="],
-
- "@mercurjs/registry/jest/jest-cli": ["[email protected]", "", { "dependencies": { "@jest/core": "30.3.0", "@jest/test-result": "30.3.0", "@jest/types": "30.3.0", "chalk": "^4.1.2", "exit-x": "^0.2.2", "import-local": "^3.2.0", "jest-config": "30.3.0", "jest-util": "30.3.0", "jest-validate": "30.3.0", "yargs": "^17.7.2" }, "peerDependencies": { "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" }, "optionalPeers": ["node-notifier"], "bin": { "jest": "./bin/jest.js" } }, "sha512-l6Tqx+j1fDXJEW5bqYykDQQ7mQg+9mhWXtnj+tQZrTWYHyHoi6Be8HPumDSA+UiX2/2buEgjA58iJzdj146uCw=="],
+ "@mercurjs/registry/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
"@mercurjs/vendor/@mercurjs/dashboard-shared/@medusajs/admin-shared": ["@medusajs/[email protected]", "", {}, "sha512-FLZMxH2pBy8o5XJTifgMTxnY6W8ke1skXr3fX02APjiySCdmegiUnok8u70KGVRQNU7rfPyvApldh9ZffvDNxw=="],
@@ -4248,7 +4219,37 @@
"@ts-morph/common/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg=="],
- "@types/graceful-fs/@types/node/undici-types": ["[email protected]", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
+ "@types/body-parser/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
+ "@types/connect/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
+ "@types/cors/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
+ "@types/express-serve-static-core/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
+ "@types/fs-extra/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
+ "@types/http-proxy/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
+ "@types/jsonfile/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
+ "@types/jsonwebtoken/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
+ "@types/mute-stream/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
+ "@types/pg/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
+ "@types/prompts/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
+ "@types/send/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
+ "@types/serve-static/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
+ "@types/tar/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
+ "@types/unzipper/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
+ "@types/wait-on/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
"@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg=="],
@@ -4344,30 +4345,16 @@
"jest-changed-files/execa/strip-final-newline": ["[email protected]", "", {}, "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA=="],
- "jest-circus/@types/node/undici-types": ["[email protected]", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
-
"jest-cli/yargs/cliui": ["[email protected]", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" } }, "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ=="],
"jest-cli/yargs/string-width": ["[email protected]", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
"jest-cli/yargs/yargs-parser": ["[email protected]", "", {}, "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw=="],
- "jest-environment-node/@types/node/undici-types": ["[email protected]", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
-
- "jest-haste-map/@types/node/undici-types": ["[email protected]", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
-
- "jest-mock/@types/node/undici-types": ["[email protected]", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
-
- "jest-runner/@types/node/undici-types": ["[email protected]", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
-
- "jest-runtime/@types/node/undici-types": ["[email protected]", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
-
- "jest-watcher/@types/node/undici-types": ["[email protected]", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
+ "jest-util/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
"jest-watcher/ansi-escapes/type-fest": ["[email protected]", "", {}, "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w=="],
- "jest-worker/@types/node/undici-types": ["[email protected]", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
-
"jest-worker/supports-color/has-flag": ["[email protected]", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],
"knex/debug/ms": ["[email protected]", "", {}, "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="],
@@ -4378,10 +4365,14 @@
"pkg-dir/find-up/locate-path": ["[email protected]", "", { "dependencies": { "p-locate": "^4.1.0" } }, "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g=="],
+ "protobufjs/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
"send/debug/ms": ["[email protected]", "", {}, "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="],
"string-width/strip-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="],
+ "stripe/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
"tailwindcss/chokidar/glob-parent": ["[email protected]", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="],
"tailwindcss/chokidar/readdirp": ["[email protected]", "", { "dependencies": { "picomatch": "^2.2.1" } }, "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA=="],
@@ -4494,8 +4485,12 @@
"@jest/create-cache-key-function/@jest/types/@jest/schemas/@sinclair/typebox": ["@sinclair/[email protected]", "", {}, "sha512-kKJTNuK3AQOrgjjotVxMrCn1sUJwM76wMszfq1kdU4uYVJjvEWuFQ6HgvLt4Xz3fSmZlTOxJ/Ie13KnIcWQXFA=="],
+ "@jest/create-cache-key-function/@jest/types/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
"@jest/snapshot-utils/@jest/types/@jest/schemas/@sinclair/typebox": ["@sinclair/[email protected]", "", {}, "sha512-kKJTNuK3AQOrgjjotVxMrCn1sUJwM76wMszfq1kdU4uYVJjvEWuFQ6HgvLt4Xz3fSmZlTOxJ/Ie13KnIcWQXFA=="],
+ "@jest/snapshot-utils/@jest/types/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
"@medusajs/auth-google/jsonwebtoken/jws/jwa": ["[email protected]", "", { "dependencies": { "buffer-equal-constant-time": "^1.0.1", "ecdsa-sig-formatter": "1.0.11", "safe-buffer": "^5.0.1" } }, "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg=="],
"@medusajs/cli/ora/cli-cursor/restore-cursor": ["[email protected]", "", { "dependencies": { "onetime": "^5.1.0", "signal-exit": "^3.0.2" } }, "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA=="],
@@ -4514,8 +4509,6 @@
"@mercurjs/admin/@mercurjs/dashboard-shared/@medusajs/dashboard/@medusajs/ui": ["@medusajs/[email protected]", "", { "dependencies": { "@dnd-kit/core": "^6.1.0", "@dnd-kit/sortable": "^8.0.0", "@dnd-kit/utilities": "^3.2.2", "@medusajs/icons": "2.13.3", "@radix-ui/react-dialog": "1.1.4", "@radix-ui/react-dismissable-layer": "1.1.4", "@tanstack/react-table": "8.20.5", "clsx": "^1.2.1", "copy-to-clipboard": "^3.3.3", "cva": "1.0.0-beta.1", "lodash.isequal": "^4.5.0", "prism-react-renderer": "^2.0.6", "prismjs": "^1.30.0", "radix-ui": "1.1.2", "react-aria": "^3.33.1", "react-currency-input-field": "^3.6.11", "react-stately": "^3.31.1", "sonner": "^1.5.0", "tailwind-merge": "^2.2.1" }, "peerDependencies": { "react": "^18.3.1", "react-dom": "^18.3.1" } }, "sha512-mvjPFT6yN3I0YElmuSCnbiFnAZ1X4HpVWU46SXKW5PO9raM6Ny/kGDMB3GG2jPGX1Z18CoWAc5rDss8s0deh/g=="],
- "@mercurjs/core-plugin/jsonwebtoken/jws/jwa": ["[email protected]", "", { "dependencies": { "buffer-equal-constant-time": "^1.0.1", "ecdsa-sig-formatter": "1.0.11", "safe-buffer": "^5.0.1" } }, "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg=="],
-
"@mercurjs/integration-tests/jest/@jest/core/@jest/console": ["@jest/[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "chalk": "^4.1.2", "jest-message-util": "30.3.0", "jest-util": "30.3.0", "slash": "^3.0.0" } }, "sha512-PAwCvFJ4696XP2qZj+LAn1BWjZaJ6RjG6c7/lkMaUJnkyMS34ucuIsfqYvfskVNvUI27R/u4P1HMYFnlVXG/Ww=="],
"@mercurjs/integration-tests/jest/@jest/core/@jest/reporters": ["@jest/[email protected]", "", { "dependencies": { "@bcoe/v8-coverage": "^0.2.3", "@jest/console": "30.3.0", "@jest/test-result": "30.3.0", "@jest/transform": "30.3.0", "@jest/types": "30.3.0", "@jridgewell/trace-mapping": "^0.3.25", "@types/node": "*", "chalk": "^4.1.2", "collect-v8-coverage": "^1.0.2", "exit-x": "^0.2.2", "glob": "^10.5.0", "graceful-fs": "^4.2.11", "istanbul-lib-coverage": "^3.0.0", "istanbul-lib-instrument": "^6.0.0", "istanbul-lib-report": "^3.0.0", "istanbul-lib-source-maps": "^5.0.0", "istanbul-reports": "^3.1.3", "jest-message-util": "30.3.0", "jest-util": "30.3.0", "jest-worker": "30.3.0", "slash": "^3.0.0", "string-length": "^4.0.2", "v8-to-istanbul": "^9.0.1" }, "peerDependencies": { "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" }, "optionalPeers": ["node-notifier"] }, "sha512-a09z89S+PkQnL055bVj8+pe2Caed2PBOaczHcXCykW5ngxX9EWx/1uAwncxc/HiU0oZqfwseMjyhxgRjS49qPw=="],
@@ -4574,58 +4567,6 @@
"@mercurjs/integration-tests/jsonwebtoken/jws/jwa": ["[email protected]", "", { "dependencies": { "buffer-equal-constant-time": "^1.0.1", "ecdsa-sig-formatter": "1.0.11", "safe-buffer": "^5.0.1" } }, "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg=="],
- "@mercurjs/registry/jest/@jest/core/@jest/console": ["@jest/[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "chalk": "^4.1.2", "jest-message-util": "30.3.0", "jest-util": "30.3.0", "slash": "^3.0.0" } }, "sha512-PAwCvFJ4696XP2qZj+LAn1BWjZaJ6RjG6c7/lkMaUJnkyMS34ucuIsfqYvfskVNvUI27R/u4P1HMYFnlVXG/Ww=="],
-
- "@mercurjs/registry/jest/@jest/core/@jest/reporters": ["@jest/[email protected]", "", { "dependencies": { "@bcoe/v8-coverage": "^0.2.3", "@jest/console": "30.3.0", "@jest/test-result": "30.3.0", "@jest/transform": "30.3.0", "@jest/types": "30.3.0", "@jridgewell/trace-mapping": "^0.3.25", "@types/node": "*", "chalk": "^4.1.2", "collect-v8-coverage": "^1.0.2", "exit-x": "^0.2.2", "glob": "^10.5.0", "graceful-fs": "^4.2.11", "istanbul-lib-coverage": "^3.0.0", "istanbul-lib-instrument": "^6.0.0", "istanbul-lib-report": "^3.0.0", "istanbul-lib-source-maps": "^5.0.0", "istanbul-reports": "^3.1.3", "jest-message-util": "30.3.0", "jest-util": "30.3.0", "jest-worker": "30.3.0", "slash": "^3.0.0", "string-length": "^4.0.2", "v8-to-istanbul": "^9.0.1" }, "peerDependencies": { "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" }, "optionalPeers": ["node-notifier"] }, "sha512-a09z89S+PkQnL055bVj8+pe2Caed2PBOaczHcXCykW5ngxX9EWx/1uAwncxc/HiU0oZqfwseMjyhxgRjS49qPw=="],
-
- "@mercurjs/registry/jest/@jest/core/@jest/test-result": ["@jest/[email protected]", "", { "dependencies": { "@jest/console": "30.3.0", "@jest/types": "30.3.0", "@types/istanbul-lib-coverage": "^2.0.6", "collect-v8-coverage": "^1.0.2" } }, "sha512-e/52nJGuD74AKTSe0P4y5wFRlaXP0qmrS17rqOMHeSwm278VyNyXE3gFO/4DTGF9w+65ra3lo3VKj0LBrzmgdQ=="],
-
- "@mercurjs/registry/jest/@jest/core/@jest/transform": ["@jest/[email protected]", "", { "dependencies": { "@babel/core": "^7.27.4", "@jest/types": "30.3.0", "@jridgewell/trace-mapping": "^0.3.25", "babel-plugin-istanbul": "^7.0.1", "chalk": "^4.1.2", "convert-source-map": "^2.0.0", "fast-json-stable-stringify": "^2.1.0", "graceful-fs": "^4.2.11", "jest-haste-map": "30.3.0", "jest-regex-util": "30.0.1", "jest-util": "30.3.0", "pirates": "^4.0.7", "slash": "^3.0.0", "write-file-atomic": "^5.0.1" } }, "sha512-TLKY33fSLVd/lKB2YI1pH69ijyUblO/BQvCj566YvnwuzoTNr648iE0j22vRvVNk2HsPwByPxATg3MleS3gf5A=="],
-
- "@mercurjs/registry/jest/@jest/core/ansi-escapes": ["[email protected]", "", { "dependencies": { "type-fest": "^0.21.3" } }, "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ=="],
-
- "@mercurjs/registry/jest/@jest/core/ci-info": ["[email protected]", "", {}, "sha512-77PSwercCZU2Fc4sX94eF8k8Pxte6JAwL4/ICZLFjJLqegs7kCuAsqqj/70NQF6TvDpgFjkubQB2FW2ZZddvQg=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-changed-files": ["[email protected]", "", { "dependencies": { "execa": "^5.1.1", "jest-util": "30.3.0", "p-limit": "^3.1.0" } }, "sha512-B/7Cny6cV5At6M25EWDgf9S617lHivamL8vl6KEpJqkStauzcG4e+WPfDgMMF+H4FVH4A2PLRyvgDJan4441QA=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config": ["[email protected]", "", { "dependencies": { "@babel/core": "^7.27.4", "@jest/get-type": "30.1.0", "@jest/pattern": "30.0.1", "@jest/test-sequencer": "30.3.0", "@jest/types": "30.3.0", "babel-jest": "30.3.0", "chalk": "^4.1.2", "ci-info": "^4.2.0", "deepmerge": "^4.3.1", "glob": "^10.5.0", "graceful-fs": "^4.2.11", "jest-circus": "30.3.0", "jest-docblock": "30.2.0", "jest-environment-node": "30.3.0", "jest-regex-util": "30.0.1", "jest-resolve": "30.3.0", "jest-runner": "30.3.0", "jest-util": "30.3.0", "jest-validate": "30.3.0", "parse-json": "^5.2.0", "pretty-format": "30.3.0", "slash": "^3.0.0", "strip-json-comments": "^3.1.1" }, "peerDependencies": { "@types/node": "*", "esbuild-register": ">=3.4.0", "ts-node": ">=9.0.0" }, "optionalPeers": ["@types/node", "esbuild-register", "ts-node"] }, "sha512-WPMAkMAtNDY9P/oKObtsRG/6KTrhtgPJoBTmk20uDn4Uy6/3EJnnaZJre/FMT1KVRx8cve1r7/FlMIOfRVWL4w=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-haste-map": ["[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "anymatch": "^3.1.3", "fb-watchman": "^2.0.2", "graceful-fs": "^4.2.11", "jest-regex-util": "30.0.1", "jest-util": "30.3.0", "jest-worker": "30.3.0", "picomatch": "^4.0.3", "walker": "^1.0.8" }, "optionalDependencies": { "fsevents": "^2.3.3" } }, "sha512-mMi2oqG4KRU0R9QEtscl87JzMXfUhbKaFqOxmjb2CKcbHcUGFrJCBWHmnTiUqi6JcnzoBlO4rWfpdl2k/RfLCA=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-message-util": ["[email protected]", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@jest/types": "30.3.0", "@types/stack-utils": "^2.0.3", "chalk": "^4.1.2", "graceful-fs": "^4.2.11", "picomatch": "^4.0.3", "pretty-format": "30.3.0", "slash": "^3.0.0", "stack-utils": "^2.0.6" } }, "sha512-Z/j4Bo+4ySJ+JPJN3b2Qbl9hDq3VrXmnjjGEWD/x0BCXeOXPTV1iZYYzl2X8c1MaCOL+ewMyNBcm88sboE6YWw=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-regex-util": ["[email protected]", "", {}, "sha512-jHEQgBXAgc+Gh4g0p3bCevgRCVRkB4VB70zhoAE48gxeSr1hfUOsM/C2WoJgVL7Eyg//hudYENbm3Ne+/dRVVA=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-resolve": ["[email protected]", "", { "dependencies": { "chalk": "^4.1.2", "graceful-fs": "^4.2.11", "jest-haste-map": "30.3.0", "jest-pnp-resolver": "^1.2.3", "jest-util": "30.3.0", "jest-validate": "30.3.0", "slash": "^3.0.0", "unrs-resolver": "^1.7.11" } }, "sha512-NRtTAHQlpd15F9rUR36jqwelbrDV/dY4vzNte3S2kxCKUJRYNd5/6nTSbYiak1VX5g8IoFF23Uj5TURkUW8O5g=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-resolve-dependencies": ["[email protected]", "", { "dependencies": { "jest-regex-util": "30.0.1", "jest-snapshot": "30.3.0" } }, "sha512-9ev8s3YN6Hsyz9LV75XUwkCVFlwPbaFn6Wp75qnI0wzAINYWY8Fb3+6y59Rwd3QaS3kKXffHXsZMziMavfz/nw=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runner": ["[email protected]", "", { "dependencies": { "@jest/console": "30.3.0", "@jest/environment": "30.3.0", "@jest/test-result": "30.3.0", "@jest/transform": "30.3.0", "@jest/types": "30.3.0", "@types/node": "*", "chalk": "^4.1.2", "emittery": "^0.13.1", "exit-x": "^0.2.2", "graceful-fs": "^4.2.11", "jest-docblock": "30.2.0", "jest-environment-node": "30.3.0", "jest-haste-map": "30.3.0", "jest-leak-detector": "30.3.0", "jest-message-util": "30.3.0", "jest-resolve": "30.3.0", "jest-runtime": "30.3.0", "jest-util": "30.3.0", "jest-watcher": "30.3.0", "jest-worker": "30.3.0", "p-limit": "^3.1.0", "source-map-support": "0.5.13" } }, "sha512-gDv6C9LGKWDPLia9TSzZwf4h3kMQCqyTpq+95PODnTRDO0g9os48XIYYkS6D236vjpBir2fF63YmJFtqkS5Duw=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime": ["[email protected]", "", { "dependencies": { "@jest/environment": "30.3.0", "@jest/fake-timers": "30.3.0", "@jest/globals": "30.3.0", "@jest/source-map": "30.0.1", "@jest/test-result": "30.3.0", "@jest/transform": "30.3.0", "@jest/types": "30.3.0", "@types/node": "*", "chalk": "^4.1.2", "cjs-module-lexer": "^2.1.0", "collect-v8-coverage": "^1.0.2", "glob": "^10.5.0", "graceful-fs": "^4.2.11", "jest-haste-map": "30.3.0", "jest-message-util": "30.3.0", "jest-mock": "30.3.0", "jest-regex-util": "30.0.1", "jest-resolve": "30.3.0", "jest-snapshot": "30.3.0", "jest-util": "30.3.0", "slash": "^3.0.0", "strip-bom": "^4.0.0" } }, "sha512-CgC+hIBJbuh78HEffkhNKcbXAytQViplcl8xupqeIWyKQF50kCQA8J7GeJCkjisC6hpnC9Muf8jV5RdtdFbGng=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-snapshot": ["[email protected]", "", { "dependencies": { "@babel/core": "^7.27.4", "@babel/generator": "^7.27.5", "@babel/plugin-syntax-jsx": "^7.27.1", "@babel/plugin-syntax-typescript": "^7.27.1", "@babel/types": "^7.27.3", "@jest/expect-utils": "30.3.0", "@jest/get-type": "30.1.0", "@jest/snapshot-utils": "30.3.0", "@jest/transform": "30.3.0", "@jest/types": "30.3.0", "babel-preset-current-node-syntax": "^1.2.0", "chalk": "^4.1.2", "expect": "30.3.0", "graceful-fs": "^4.2.11", "jest-diff": "30.3.0", "jest-matcher-utils": "30.3.0", "jest-message-util": "30.3.0", "jest-util": "30.3.0", "pretty-format": "30.3.0", "semver": "^7.7.2", "synckit": "^0.11.8" } }, "sha512-f14c7atpb4O2DeNhwcvS810Y63wEn8O1HqK/luJ4F6M4NjvxmAKQwBUWjbExUtMxWJQ0wVgmCKymeJK6NZMnfQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-util": ["[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "chalk": "^4.1.2", "ci-info": "^4.2.0", "graceful-fs": "^4.2.11", "picomatch": "^4.0.3" } }, "sha512-/jZDa00a3Sz7rdyu55NLrQCIrbyIkbBxareejQI315f/i8HjYN+ZWsDLLpoQSiUIEIyZF/R8fDg3BmB8AtHttg=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-validate": ["[email protected]", "", { "dependencies": { "@jest/get-type": "30.1.0", "@jest/types": "30.3.0", "camelcase": "^6.3.0", "chalk": "^4.1.2", "leven": "^3.1.0", "pretty-format": "30.3.0" } }, "sha512-I/xzC8h5G+SHCb2P2gWkJYrNiTbeL47KvKeW5EzplkyxzBRBw1ssSHlI/jXec0ukH2q7x2zAWQm7015iusg62Q=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-watcher": ["[email protected]", "", { "dependencies": { "@jest/test-result": "30.3.0", "@jest/types": "30.3.0", "@types/node": "*", "ansi-escapes": "^4.3.2", "chalk": "^4.1.2", "emittery": "^0.13.1", "jest-util": "30.3.0", "string-length": "^4.0.2" } }, "sha512-PJ1d9ThtTR8aMiBWUdcownq9mDdLXsQzJayTk4kmaBRHKvwNQn+ANveuhEBUyNI2hR1TVhvQ8D5kHubbzBHR/w=="],
-
- "@mercurjs/registry/jest/@jest/core/pretty-format": ["[email protected]", "", { "dependencies": { "@jest/schemas": "30.0.5", "ansi-styles": "^5.2.0", "react-is": "^18.3.1" } }, "sha512-oG4T3wCbfeuvljnyAzhBvpN45E8iOTXCU/TD3zXW80HA3dQ4ahdqMkWGiPWZvjpQwlbyHrPTWUAqUzGzv4l1JQ=="],
-
- "@mercurjs/registry/jest/@jest/types/@jest/schemas": ["@jest/[email protected]", "", { "dependencies": { "@sinclair/typebox": "^0.34.0" } }, "sha512-DmdYgtezMkh3cpU8/1uyXakv3tJRcmcXxBOcO0tbaozPwpmh4YMsnWrQm9ZmZMfa5ocbxzbFk6O4bDPEc/iAnA=="],
-
- "@mercurjs/registry/jest/jest-cli/@jest/test-result": ["@jest/[email protected]", "", { "dependencies": { "@jest/console": "30.3.0", "@jest/types": "30.3.0", "@types/istanbul-lib-coverage": "^2.0.6", "collect-v8-coverage": "^1.0.2" } }, "sha512-e/52nJGuD74AKTSe0P4y5wFRlaXP0qmrS17rqOMHeSwm278VyNyXE3gFO/4DTGF9w+65ra3lo3VKj0LBrzmgdQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config": ["[email protected]", "", { "dependencies": { "@babel/core": "^7.27.4", "@jest/get-type": "30.1.0", "@jest/pattern": "30.0.1", "@jest/test-sequencer": "30.3.0", "@jest/types": "30.3.0", "babel-jest": "30.3.0", "chalk": "^4.1.2", "ci-info": "^4.2.0", "deepmerge": "^4.3.1", "glob": "^10.5.0", "graceful-fs": "^4.2.11", "jest-circus": "30.3.0", "jest-docblock": "30.2.0", "jest-environment-node": "30.3.0", "jest-regex-util": "30.0.1", "jest-resolve": "30.3.0", "jest-runner": "30.3.0", "jest-util": "30.3.0", "jest-validate": "30.3.0", "parse-json": "^5.2.0", "pretty-format": "30.3.0", "slash": "^3.0.0", "strip-json-comments": "^3.1.1" }, "peerDependencies": { "@types/node": "*", "esbuild-register": ">=3.4.0", "ts-node": ">=9.0.0" }, "optionalPeers": ["@types/node", "esbuild-register", "ts-node"] }, "sha512-WPMAkMAtNDY9P/oKObtsRG/6KTrhtgPJoBTmk20uDn4Uy6/3EJnnaZJre/FMT1KVRx8cve1r7/FlMIOfRVWL4w=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-util": ["[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "chalk": "^4.1.2", "ci-info": "^4.2.0", "graceful-fs": "^4.2.11", "picomatch": "^4.0.3" } }, "sha512-/jZDa00a3Sz7rdyu55NLrQCIrbyIkbBxareejQI315f/i8HjYN+ZWsDLLpoQSiUIEIyZF/R8fDg3BmB8AtHttg=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-validate": ["[email protected]", "", { "dependencies": { "@jest/get-type": "30.1.0", "@jest/types": "30.3.0", "camelcase": "^6.3.0", "chalk": "^4.1.2", "leven": "^3.1.0", "pretty-format": "30.3.0" } }, "sha512-I/xzC8h5G+SHCb2P2gWkJYrNiTbeL47KvKeW5EzplkyxzBRBw1ssSHlI/jXec0ukH2q7x2zAWQm7015iusg62Q=="],
-
- "@mercurjs/registry/jest/jest-cli/yargs": ["[email protected]", "", { "dependencies": { "cliui": "^8.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.3", "y18n": "^5.0.5", "yargs-parser": "^21.1.1" } }, "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w=="],
-
"@mercurjs/vendor/@mercurjs/dashboard-shared/@medusajs/dashboard/@medusajs/js-sdk": ["@medusajs/[email protected]", "", { "dependencies": { "fetch-event-stream": "^0.1.5", "qs": "^6.12.1" } }, "sha512-JTXZE8q6kHJvZoat2edGUf7QSDVdOTHSaKQnekFD2cIzO6NRUSK+tRiIk+XQLf7FE9eWUHB/h5v9oQ6i47zhXg=="],
"@mercurjs/vendor/@mercurjs/dashboard-shared/@medusajs/dashboard/@medusajs/ui": ["@medusajs/[email protected]", "", { "dependencies": { "@dnd-kit/core": "^6.1.0", "@dnd-kit/sortable": "^8.0.0", "@dnd-kit/utilities": "^3.2.2", "@medusajs/icons": "2.13.3", "@radix-ui/react-dialog": "1.1.4", "@radix-ui/react-dismissable-layer": "1.1.4", "@tanstack/react-table": "8.20.5", "clsx": "^1.2.1", "copy-to-clipboard": "^3.3.3", "cva": "1.0.0-beta.1", "lodash.isequal": "^4.5.0", "prism-react-renderer": "^2.0.6", "prismjs": "^1.30.0", "radix-ui": "1.1.2", "react-aria": "^3.33.1", "react-currency-input-field": "^3.6.11", "react-stately": "^3.31.1", "sonner": "^1.5.0", "tailwind-merge": "^2.2.1" }, "peerDependencies": { "react": "^18.3.1", "react-dom": "^18.3.1" } }, "sha512-mvjPFT6yN3I0YElmuSCnbiFnAZ1X4HpVWU46SXKW5PO9raM6Ny/kGDMB3GG2jPGX1Z18CoWAc5rDss8s0deh/g=="],
@@ -4640,6 +4581,8 @@
"@oclif/plugin-help/@oclif/errors/fs-extra/universalify": ["[email protected]", "", {}, "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="],
+ "@opentelemetry/instrumentation-pg/@types/pg/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
"@ts-morph/common/minimatch/brace-expansion/balanced-match": ["[email protected]", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="],
"@typescript-eslint/typescript-estree/minimatch/brace-expansion/balanced-match": ["[email protected]", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="],
@@ -4684,6 +4627,8 @@
"@mercurjs/integration-tests/jest/@jest/core/@jest/transform/write-file-atomic": ["[email protected]", "", { "dependencies": { "imurmurhash": "^0.1.4", "signal-exit": "^4.0.1" } }, "sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw=="],
+ "@mercurjs/integration-tests/jest/@jest/core/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
"@mercurjs/integration-tests/jest/@jest/core/ansi-escapes/type-fest": ["[email protected]", "", {}, "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w=="],
"@mercurjs/integration-tests/jest/@jest/core/jest-changed-files/execa": ["[email protected]", "", { "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", "human-signals": "^2.1.0", "is-stream": "^2.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^4.0.1", "onetime": "^5.1.2", "signal-exit": "^3.0.3", "strip-final-newline": "^2.0.0" } }, "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg=="],
@@ -4752,6 +4697,8 @@
"@mercurjs/integration-tests/jest/@jest/types/@jest/schemas/@sinclair/typebox": ["@sinclair/[email protected]", "", {}, "sha512-kKJTNuK3AQOrgjjotVxMrCn1sUJwM76wMszfq1kdU4uYVJjvEWuFQ6HgvLt4Xz3fSmZlTOxJ/Ie13KnIcWQXFA=="],
+ "@mercurjs/integration-tests/jest/@jest/types/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
"@mercurjs/integration-tests/jest/jest-cli/@jest/test-result/@jest/console": ["@jest/[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "chalk": "^4.1.2", "jest-message-util": "30.3.0", "jest-util": "30.3.0", "slash": "^3.0.0" } }, "sha512-PAwCvFJ4696XP2qZj+LAn1BWjZaJ6RjG6c7/lkMaUJnkyMS34ucuIsfqYvfskVNvUI27R/u4P1HMYFnlVXG/Ww=="],
"@mercurjs/integration-tests/jest/jest-cli/jest-config/@jest/test-sequencer": ["@jest/[email protected]", "", { "dependencies": { "@jest/test-result": "30.3.0", "graceful-fs": "^4.2.11", "jest-haste-map": "30.3.0", "slash": "^3.0.0" } }, "sha512-dgbWy9b8QDlQeRZcv7LNF+/jFiiYHTKho1xirauZ7kVwY7avjFF6uTT0RqlgudB5OuIPagFdVtfFMosjVbk1eA=="],
@@ -4790,124 +4737,6 @@
"@mercurjs/integration-tests/jest/jest-cli/yargs/yargs-parser": ["[email protected]", "", {}, "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw=="],
- "@mercurjs/registry/jest/@jest/core/@jest/reporters/@jridgewell/trace-mapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
-
- "@mercurjs/registry/jest/@jest/core/@jest/reporters/glob": ["[email protected]", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg=="],
-
- "@mercurjs/registry/jest/@jest/core/@jest/reporters/istanbul-lib-source-maps": ["[email protected]", "", { "dependencies": { "@jridgewell/trace-mapping": "^0.3.23", "debug": "^4.1.1", "istanbul-lib-coverage": "^3.0.0" } }, "sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A=="],
-
- "@mercurjs/registry/jest/@jest/core/@jest/reporters/jest-worker": ["[email protected]", "", { "dependencies": { "@types/node": "*", "@ungap/structured-clone": "^1.3.0", "jest-util": "30.3.0", "merge-stream": "^2.0.0", "supports-color": "^8.1.1" } }, "sha512-DrCKkaQwHexjRUFTmPzs7sHQe0TSj9nvDALKGdwmK5mW9v7j90BudWirKAJHt3QQ9Dhrg1F7DogPzhChppkJpQ=="],
-
- "@mercurjs/registry/jest/@jest/core/@jest/transform/@jridgewell/trace-mapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
-
- "@mercurjs/registry/jest/@jest/core/@jest/transform/babel-plugin-istanbul": ["[email protected]", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.0.0", "@istanbuljs/load-nyc-config": "^1.0.0", "@istanbuljs/schema": "^0.1.3", "istanbul-lib-instrument": "^6.0.2", "test-exclude": "^6.0.0" } }, "sha512-D8Z6Qm8jCvVXtIRkBnqNHX0zJ37rQcFJ9u8WOS6tkYOsRdHBzypCstaxWiu5ZIlqQtviRYbgnRLSoCEvjqcqbA=="],
-
- "@mercurjs/registry/jest/@jest/core/@jest/transform/write-file-atomic": ["[email protected]", "", { "dependencies": { "imurmurhash": "^0.1.4", "signal-exit": "^4.0.1" } }, "sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw=="],
-
- "@mercurjs/registry/jest/@jest/core/ansi-escapes/type-fest": ["[email protected]", "", {}, "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-changed-files/execa": ["[email protected]", "", { "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", "human-signals": "^2.1.0", "is-stream": "^2.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^4.0.1", "onetime": "^5.1.2", "signal-exit": "^3.0.3", "strip-final-newline": "^2.0.0" } }, "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/@jest/test-sequencer": ["@jest/[email protected]", "", { "dependencies": { "@jest/test-result": "30.3.0", "graceful-fs": "^4.2.11", "jest-haste-map": "30.3.0", "slash": "^3.0.0" } }, "sha512-dgbWy9b8QDlQeRZcv7LNF+/jFiiYHTKho1xirauZ7kVwY7avjFF6uTT0RqlgudB5OuIPagFdVtfFMosjVbk1eA=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/babel-jest": ["[email protected]", "", { "dependencies": { "@jest/transform": "30.3.0", "@types/babel__core": "^7.20.5", "babel-plugin-istanbul": "^7.0.1", "babel-preset-jest": "30.3.0", "chalk": "^4.1.2", "graceful-fs": "^4.2.11", "slash": "^3.0.0" }, "peerDependencies": { "@babel/core": "^7.11.0 || ^8.0.0-0" } }, "sha512-gRpauEU2KRrCox5Z296aeVHR4jQ98BCnu0IO332D/xpHNOsIH/bgSRk9k6GbKIbBw8vFeN6ctuu6tV8WOyVfYQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/glob": ["[email protected]", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/jest-circus": ["[email protected]", "", { "dependencies": { "@jest/environment": "30.3.0", "@jest/expect": "30.3.0", "@jest/test-result": "30.3.0", "@jest/types": "30.3.0", "@types/node": "*", "chalk": "^4.1.2", "co": "^4.6.0", "dedent": "^1.6.0", "is-generator-fn": "^2.1.0", "jest-each": "30.3.0", "jest-matcher-utils": "30.3.0", "jest-message-util": "30.3.0", "jest-runtime": "30.3.0", "jest-snapshot": "30.3.0", "jest-util": "30.3.0", "p-limit": "^3.1.0", "pretty-format": "30.3.0", "pure-rand": "^7.0.0", "slash": "^3.0.0", "stack-utils": "^2.0.6" } }, "sha512-PyXq5szeSfR/4f1lYqCmmQjh0vqDkURUYi9N6whnHjlRz4IUQfMcXkGLeEoiJtxtyPqgUaUUfyQlApXWBSN1RA=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/jest-docblock": ["[email protected]", "", { "dependencies": { "detect-newline": "^3.1.0" } }, "sha512-tR/FFgZKS1CXluOQzZvNH3+0z9jXr3ldGSD8bhyuxvlVUwbeLOGynkunvlTMxchC5urrKndYiwCFC0DLVjpOCA=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/jest-environment-node": ["[email protected]", "", { "dependencies": { "@jest/environment": "30.3.0", "@jest/fake-timers": "30.3.0", "@jest/types": "30.3.0", "@types/node": "*", "jest-mock": "30.3.0", "jest-util": "30.3.0", "jest-validate": "30.3.0" } }, "sha512-4i6HItw/JSiJVsC5q0hnKIe/hbYfZLVG9YJ/0pU9Hz2n/9qZe3Rhn5s5CUZA5ORZlcdT/vmAXRMyONXJwPrmYQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-haste-map/jest-worker": ["[email protected]", "", { "dependencies": { "@types/node": "*", "@ungap/structured-clone": "^1.3.0", "jest-util": "30.3.0", "merge-stream": "^2.0.0", "supports-color": "^8.1.1" } }, "sha512-DrCKkaQwHexjRUFTmPzs7sHQe0TSj9nvDALKGdwmK5mW9v7j90BudWirKAJHt3QQ9Dhrg1F7DogPzhChppkJpQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-haste-map/picomatch": ["[email protected]", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-message-util/picomatch": ["[email protected]", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runner/@jest/environment": ["@jest/[email protected]", "", { "dependencies": { "@jest/fake-timers": "30.3.0", "@jest/types": "30.3.0", "@types/node": "*", "jest-mock": "30.3.0" } }, "sha512-SlLSF4Be735yQXyh2+mctBOzNDx5s5uLv88/j8Qn1wH679PDcwy67+YdADn8NJnGjzlXtN62asGH/T4vWOkfaw=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runner/jest-docblock": ["[email protected]", "", { "dependencies": { "detect-newline": "^3.1.0" } }, "sha512-tR/FFgZKS1CXluOQzZvNH3+0z9jXr3ldGSD8bhyuxvlVUwbeLOGynkunvlTMxchC5urrKndYiwCFC0DLVjpOCA=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runner/jest-environment-node": ["[email protected]", "", { "dependencies": { "@jest/environment": "30.3.0", "@jest/fake-timers": "30.3.0", "@jest/types": "30.3.0", "@types/node": "*", "jest-mock": "30.3.0", "jest-util": "30.3.0", "jest-validate": "30.3.0" } }, "sha512-4i6HItw/JSiJVsC5q0hnKIe/hbYfZLVG9YJ/0pU9Hz2n/9qZe3Rhn5s5CUZA5ORZlcdT/vmAXRMyONXJwPrmYQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runner/jest-leak-detector": ["[email protected]", "", { "dependencies": { "@jest/get-type": "30.1.0", "pretty-format": "30.3.0" } }, "sha512-cuKmUUGIjfXZAiGJ7TbEMx0bcqNdPPI6P1V+7aF+m/FUJqFDxkFR4JqkTu8ZOiU5AaX/x0hZ20KaaIPXQzbMGQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runner/jest-worker": ["[email protected]", "", { "dependencies": { "@types/node": "*", "@ungap/structured-clone": "^1.3.0", "jest-util": "30.3.0", "merge-stream": "^2.0.0", "supports-color": "^8.1.1" } }, "sha512-DrCKkaQwHexjRUFTmPzs7sHQe0TSj9nvDALKGdwmK5mW9v7j90BudWirKAJHt3QQ9Dhrg1F7DogPzhChppkJpQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/@jest/environment": ["@jest/[email protected]", "", { "dependencies": { "@jest/fake-timers": "30.3.0", "@jest/types": "30.3.0", "@types/node": "*", "jest-mock": "30.3.0" } }, "sha512-SlLSF4Be735yQXyh2+mctBOzNDx5s5uLv88/j8Qn1wH679PDcwy67+YdADn8NJnGjzlXtN62asGH/T4vWOkfaw=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/@jest/fake-timers": ["@jest/[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@sinonjs/fake-timers": "^15.0.0", "@types/node": "*", "jest-message-util": "30.3.0", "jest-mock": "30.3.0", "jest-util": "30.3.0" } }, "sha512-WUQDs8SOP9URStX1DzhD425CqbN/HxUYCTwVrT8sTVBfMvFqYt/s61EK5T05qnHu0po6RitXIvP9otZxYDzTGQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/@jest/globals": ["@jest/[email protected]", "", { "dependencies": { "@jest/environment": "30.3.0", "@jest/expect": "30.3.0", "@jest/types": "30.3.0", "jest-mock": "30.3.0" } }, "sha512-+owLCBBdfpgL3HU+BD5etr1SvbXpSitJK0is1kiYjJxAAJggYMRQz5hSdd5pq1sSggfxPbw2ld71pt4x5wwViA=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/@jest/source-map": ["@jest/[email protected]", "", { "dependencies": { "@jridgewell/trace-mapping": "^0.3.25", "callsites": "^3.1.0", "graceful-fs": "^4.2.11" } }, "sha512-MIRWMUUR3sdbP36oyNyhbThLHyJ2eEDClPCiHVbrYAe5g3CHRArIVpBw7cdSB5fr+ofSfIb2Tnsw8iEHL0PYQg=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/cjs-module-lexer": ["[email protected]", "", {}, "sha512-4bHTS2YuzUvtoLjdy+98ykbNB5jS0+07EvFNXerqZQJ89F7DI6ET7OQo/HJuW6K0aVsKA9hj9/RVb2kQVOrPDQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/glob": ["[email protected]", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/jest-mock": ["[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "jest-util": "30.3.0" } }, "sha512-OTzICK8CpE+t4ndhKrwlIdbM6Pn8j00lvmSmq5ejiO+KxukbLjgOflKWMn3KE34EZdQm5RqTuKj+5RIEniYhog=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/strip-bom": ["[email protected]", "", {}, "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-snapshot/@babel/types": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-snapshot/@jest/expect-utils": ["@jest/[email protected]", "", { "dependencies": { "@jest/get-type": "30.1.0" } }, "sha512-j0+W5iQQ8hBh7tHZkTQv3q2Fh/M7Je72cIsYqC4OaktgtO7v1So9UTjp6uPBHIaB6beoF/RRsCgMJKvti0wADA=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-snapshot/expect": ["[email protected]", "", { "dependencies": { "@jest/expect-utils": "30.3.0", "@jest/get-type": "30.1.0", "jest-matcher-utils": "30.3.0", "jest-message-util": "30.3.0", "jest-mock": "30.3.0", "jest-util": "30.3.0" } }, "sha512-1zQrciTiQfRdo7qJM1uG4navm8DayFa2TgCSRlzUyNkhcJ6XUZF3hjnpkyr3VhAqPH7i/9GkG7Tv5abz6fqz0Q=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-snapshot/jest-diff": ["[email protected]", "", { "dependencies": { "@jest/diff-sequences": "30.3.0", "@jest/get-type": "30.1.0", "chalk": "^4.1.2", "pretty-format": "30.3.0" } }, "sha512-n3q4PDQjS4LrKxfWB3Z5KNk1XjXtZTBwQp71OP0Jo03Z6V60x++K5L8k6ZrW8MY8pOFylZvHM0zsjS1RqlHJZQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-snapshot/jest-matcher-utils": ["[email protected]", "", { "dependencies": { "@jest/get-type": "30.1.0", "chalk": "^4.1.2", "jest-diff": "30.3.0", "pretty-format": "30.3.0" } }, "sha512-HEtc9uFQgaUHkC7nLSlQL3Tph4Pjxt/yiPvkIrrDCt9jhoLIgxaubo1G+CFOnmHYMxHwwdaSN7mkIFs6ZK8OhA=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-util/picomatch": ["[email protected]", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
-
- "@mercurjs/registry/jest/@jest/core/pretty-format/@jest/schemas": ["@jest/[email protected]", "", { "dependencies": { "@sinclair/typebox": "^0.34.0" } }, "sha512-DmdYgtezMkh3cpU8/1uyXakv3tJRcmcXxBOcO0tbaozPwpmh4YMsnWrQm9ZmZMfa5ocbxzbFk6O4bDPEc/iAnA=="],
-
- "@mercurjs/registry/jest/@jest/core/pretty-format/ansi-styles": ["[email protected]", "", {}, "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA=="],
-
- "@mercurjs/registry/jest/@jest/core/pretty-format/react-is": ["[email protected]", "", {}, "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="],
-
- "@mercurjs/registry/jest/@jest/types/@jest/schemas/@sinclair/typebox": ["@sinclair/[email protected]", "", {}, "sha512-kKJTNuK3AQOrgjjotVxMrCn1sUJwM76wMszfq1kdU4uYVJjvEWuFQ6HgvLt4Xz3fSmZlTOxJ/Ie13KnIcWQXFA=="],
-
- "@mercurjs/registry/jest/jest-cli/@jest/test-result/@jest/console": ["@jest/[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "chalk": "^4.1.2", "jest-message-util": "30.3.0", "jest-util": "30.3.0", "slash": "^3.0.0" } }, "sha512-PAwCvFJ4696XP2qZj+LAn1BWjZaJ6RjG6c7/lkMaUJnkyMS34ucuIsfqYvfskVNvUI27R/u4P1HMYFnlVXG/Ww=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/@jest/test-sequencer": ["@jest/[email protected]", "", { "dependencies": { "@jest/test-result": "30.3.0", "graceful-fs": "^4.2.11", "jest-haste-map": "30.3.0", "slash": "^3.0.0" } }, "sha512-dgbWy9b8QDlQeRZcv7LNF+/jFiiYHTKho1xirauZ7kVwY7avjFF6uTT0RqlgudB5OuIPagFdVtfFMosjVbk1eA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/babel-jest": ["[email protected]", "", { "dependencies": { "@jest/transform": "30.3.0", "@types/babel__core": "^7.20.5", "babel-plugin-istanbul": "^7.0.1", "babel-preset-jest": "30.3.0", "chalk": "^4.1.2", "graceful-fs": "^4.2.11", "slash": "^3.0.0" }, "peerDependencies": { "@babel/core": "^7.11.0 || ^8.0.0-0" } }, "sha512-gRpauEU2KRrCox5Z296aeVHR4jQ98BCnu0IO332D/xpHNOsIH/bgSRk9k6GbKIbBw8vFeN6ctuu6tV8WOyVfYQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/ci-info": ["[email protected]", "", {}, "sha512-77PSwercCZU2Fc4sX94eF8k8Pxte6JAwL4/ICZLFjJLqegs7kCuAsqqj/70NQF6TvDpgFjkubQB2FW2ZZddvQg=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/glob": ["[email protected]", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus": ["[email protected]", "", { "dependencies": { "@jest/environment": "30.3.0", "@jest/expect": "30.3.0", "@jest/test-result": "30.3.0", "@jest/types": "30.3.0", "@types/node": "*", "chalk": "^4.1.2", "co": "^4.6.0", "dedent": "^1.6.0", "is-generator-fn": "^2.1.0", "jest-each": "30.3.0", "jest-matcher-utils": "30.3.0", "jest-message-util": "30.3.0", "jest-runtime": "30.3.0", "jest-snapshot": "30.3.0", "jest-util": "30.3.0", "p-limit": "^3.1.0", "pretty-format": "30.3.0", "pure-rand": "^7.0.0", "slash": "^3.0.0", "stack-utils": "^2.0.6" } }, "sha512-PyXq5szeSfR/4f1lYqCmmQjh0vqDkURUYi9N6whnHjlRz4IUQfMcXkGLeEoiJtxtyPqgUaUUfyQlApXWBSN1RA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-docblock": ["[email protected]", "", { "dependencies": { "detect-newline": "^3.1.0" } }, "sha512-tR/FFgZKS1CXluOQzZvNH3+0z9jXr3ldGSD8bhyuxvlVUwbeLOGynkunvlTMxchC5urrKndYiwCFC0DLVjpOCA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-environment-node": ["[email protected]", "", { "dependencies": { "@jest/environment": "30.3.0", "@jest/fake-timers": "30.3.0", "@jest/types": "30.3.0", "@types/node": "*", "jest-mock": "30.3.0", "jest-util": "30.3.0", "jest-validate": "30.3.0" } }, "sha512-4i6HItw/JSiJVsC5q0hnKIe/hbYfZLVG9YJ/0pU9Hz2n/9qZe3Rhn5s5CUZA5ORZlcdT/vmAXRMyONXJwPrmYQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-regex-util": ["[email protected]", "", {}, "sha512-jHEQgBXAgc+Gh4g0p3bCevgRCVRkB4VB70zhoAE48gxeSr1hfUOsM/C2WoJgVL7Eyg//hudYENbm3Ne+/dRVVA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-resolve": ["[email protected]", "", { "dependencies": { "chalk": "^4.1.2", "graceful-fs": "^4.2.11", "jest-haste-map": "30.3.0", "jest-pnp-resolver": "^1.2.3", "jest-util": "30.3.0", "jest-validate": "30.3.0", "slash": "^3.0.0", "unrs-resolver": "^1.7.11" } }, "sha512-NRtTAHQlpd15F9rUR36jqwelbrDV/dY4vzNte3S2kxCKUJRYNd5/6nTSbYiak1VX5g8IoFF23Uj5TURkUW8O5g=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner": ["[email protected]", "", { "dependencies": { "@jest/console": "30.3.0", "@jest/environment": "30.3.0", "@jest/test-result": "30.3.0", "@jest/transform": "30.3.0", "@jest/types": "30.3.0", "@types/node": "*", "chalk": "^4.1.2", "emittery": "^0.13.1", "exit-x": "^0.2.2", "graceful-fs": "^4.2.11", "jest-docblock": "30.2.0", "jest-environment-node": "30.3.0", "jest-haste-map": "30.3.0", "jest-leak-detector": "30.3.0", "jest-message-util": "30.3.0", "jest-resolve": "30.3.0", "jest-runtime": "30.3.0", "jest-util": "30.3.0", "jest-watcher": "30.3.0", "jest-worker": "30.3.0", "p-limit": "^3.1.0", "source-map-support": "0.5.13" } }, "sha512-gDv6C9LGKWDPLia9TSzZwf4h3kMQCqyTpq+95PODnTRDO0g9os48XIYYkS6D236vjpBir2fF63YmJFtqkS5Duw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/pretty-format": ["[email protected]", "", { "dependencies": { "@jest/schemas": "30.0.5", "ansi-styles": "^5.2.0", "react-is": "^18.3.1" } }, "sha512-oG4T3wCbfeuvljnyAzhBvpN45E8iOTXCU/TD3zXW80HA3dQ4ahdqMkWGiPWZvjpQwlbyHrPTWUAqUzGzv4l1JQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-util/ci-info": ["[email protected]", "", {}, "sha512-77PSwercCZU2Fc4sX94eF8k8Pxte6JAwL4/ICZLFjJLqegs7kCuAsqqj/70NQF6TvDpgFjkubQB2FW2ZZddvQg=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-util/picomatch": ["[email protected]", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-validate/pretty-format": ["[email protected]", "", { "dependencies": { "@jest/schemas": "30.0.5", "ansi-styles": "^5.2.0", "react-is": "^18.3.1" } }, "sha512-oG4T3wCbfeuvljnyAzhBvpN45E8iOTXCU/TD3zXW80HA3dQ4ahdqMkWGiPWZvjpQwlbyHrPTWUAqUzGzv4l1JQ=="],
-
- "@mercurjs/registry/jest/jest-cli/yargs/cliui": ["[email protected]", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" } }, "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ=="],
-
- "@mercurjs/registry/jest/jest-cli/yargs/string-width": ["[email protected]", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
-
- "@mercurjs/registry/jest/jest-cli/yargs/yargs-parser": ["[email protected]", "", {}, "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw=="],
-
"@oclif/plugin-help/@oclif/config/@oclif/errors/fs-extra/jsonfile": ["[email protected]", "", { "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg=="],
"@oclif/plugin-help/@oclif/config/@oclif/errors/fs-extra/universalify": ["[email protected]", "", {}, "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="],
@@ -5068,6 +4897,8 @@
"@mercurjs/integration-tests/jest/jest-cli/jest-config/pretty-format/react-is": ["[email protected]", "", {}, "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="],
+ "@mercurjs/integration-tests/jest/jest-cli/jest-util/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
"@mercurjs/integration-tests/jest/jest-cli/jest-validate/pretty-format/@jest/schemas": ["@jest/[email protected]", "", { "dependencies": { "@sinclair/typebox": "^0.34.0" } }, "sha512-DmdYgtezMkh3cpU8/1uyXakv3tJRcmcXxBOcO0tbaozPwpmh4YMsnWrQm9ZmZMfa5ocbxzbFk6O4bDPEc/iAnA=="],
"@mercurjs/integration-tests/jest/jest-cli/jest-validate/pretty-format/ansi-styles": ["[email protected]", "", {}, "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA=="],
@@ -5076,160 +4907,6 @@
"@mercurjs/integration-tests/jest/jest-cli/yargs/cliui/wrap-ansi": ["[email protected]", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="],
- "@mercurjs/registry/jest/@jest/core/@jest/reporters/glob/jackspeak": ["[email protected]", "", { "dependencies": { "@isaacs/cliui": "^8.0.2" }, "optionalDependencies": { "@pkgjs/parseargs": "^0.11.0" } }, "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw=="],
-
- "@mercurjs/registry/jest/@jest/core/@jest/reporters/glob/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^2.0.2" } }, "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg=="],
-
- "@mercurjs/registry/jest/@jest/core/@jest/reporters/glob/minipass": ["[email protected]", "", {}, "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A=="],
-
- "@mercurjs/registry/jest/@jest/core/@jest/reporters/glob/path-scurry": ["[email protected]", "", { "dependencies": { "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" } }, "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA=="],
-
- "@mercurjs/registry/jest/@jest/core/@jest/reporters/jest-worker/supports-color": ["[email protected]", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-changed-files/execa/get-stream": ["[email protected]", "", {}, "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-changed-files/execa/human-signals": ["[email protected]", "", {}, "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-changed-files/execa/is-stream": ["[email protected]", "", {}, "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-changed-files/execa/npm-run-path": ["[email protected]", "", { "dependencies": { "path-key": "^3.0.0" } }, "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-changed-files/execa/signal-exit": ["[email protected]", "", {}, "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-changed-files/execa/strip-final-newline": ["[email protected]", "", {}, "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/babel-jest/babel-plugin-istanbul": ["[email protected]", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.0.0", "@istanbuljs/load-nyc-config": "^1.0.0", "@istanbuljs/schema": "^0.1.3", "istanbul-lib-instrument": "^6.0.2", "test-exclude": "^6.0.0" } }, "sha512-D8Z6Qm8jCvVXtIRkBnqNHX0zJ37rQcFJ9u8WOS6tkYOsRdHBzypCstaxWiu5ZIlqQtviRYbgnRLSoCEvjqcqbA=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/babel-jest/babel-preset-jest": ["[email protected]", "", { "dependencies": { "babel-plugin-jest-hoist": "30.3.0", "babel-preset-current-node-syntax": "^1.2.0" }, "peerDependencies": { "@babel/core": "^7.11.0 || ^8.0.0-beta.1" } }, "sha512-6ZcUbWHC+dMz2vfzdNwi87Z1gQsLNK2uLuK1Q89R11xdvejcivlYYwDlEv0FHX3VwEXpbBQ9uufB/MUNpZGfhQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/glob/jackspeak": ["[email protected]", "", { "dependencies": { "@isaacs/cliui": "^8.0.2" }, "optionalDependencies": { "@pkgjs/parseargs": "^0.11.0" } }, "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/glob/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^2.0.2" } }, "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/glob/minipass": ["[email protected]", "", {}, "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/glob/path-scurry": ["[email protected]", "", { "dependencies": { "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" } }, "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/jest-circus/@jest/environment": ["@jest/[email protected]", "", { "dependencies": { "@jest/fake-timers": "30.3.0", "@jest/types": "30.3.0", "@types/node": "*", "jest-mock": "30.3.0" } }, "sha512-SlLSF4Be735yQXyh2+mctBOzNDx5s5uLv88/j8Qn1wH679PDcwy67+YdADn8NJnGjzlXtN62asGH/T4vWOkfaw=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/jest-circus/@jest/expect": ["@jest/[email protected]", "", { "dependencies": { "expect": "30.3.0", "jest-snapshot": "30.3.0" } }, "sha512-76Nlh4xJxk2D/9URCn3wFi98d2hb19uWE1idLsTt2ywhvdOldbw3S570hBgn25P4ICUZ/cBjybrBex2g17IDbg=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/jest-circus/jest-each": ["[email protected]", "", { "dependencies": { "@jest/get-type": "30.1.0", "@jest/types": "30.3.0", "chalk": "^4.1.2", "jest-util": "30.3.0", "pretty-format": "30.3.0" } }, "sha512-V8eMndg/aZ+3LnCJgSm13IxS5XSBM22QSZc9BtPK8Dek6pm+hfUNfwBdvsB3d342bo1q7wnSkC38zjX259qZNA=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/jest-circus/jest-matcher-utils": ["[email protected]", "", { "dependencies": { "@jest/get-type": "30.1.0", "chalk": "^4.1.2", "jest-diff": "30.3.0", "pretty-format": "30.3.0" } }, "sha512-HEtc9uFQgaUHkC7nLSlQL3Tph4Pjxt/yiPvkIrrDCt9jhoLIgxaubo1G+CFOnmHYMxHwwdaSN7mkIFs6ZK8OhA=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/jest-circus/pure-rand": ["[email protected]", "", {}, "sha512-oTUZM/NAZS8p7ANR3SHh30kXB+zK2r2BPcEn/awJIbOvq82WoMN4p62AWWp3Hhw50G0xMsw1mhIBLqHw64EcNQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/jest-environment-node/@jest/environment": ["@jest/[email protected]", "", { "dependencies": { "@jest/fake-timers": "30.3.0", "@jest/types": "30.3.0", "@types/node": "*", "jest-mock": "30.3.0" } }, "sha512-SlLSF4Be735yQXyh2+mctBOzNDx5s5uLv88/j8Qn1wH679PDcwy67+YdADn8NJnGjzlXtN62asGH/T4vWOkfaw=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/jest-environment-node/@jest/fake-timers": ["@jest/[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@sinonjs/fake-timers": "^15.0.0", "@types/node": "*", "jest-message-util": "30.3.0", "jest-mock": "30.3.0", "jest-util": "30.3.0" } }, "sha512-WUQDs8SOP9URStX1DzhD425CqbN/HxUYCTwVrT8sTVBfMvFqYt/s61EK5T05qnHu0po6RitXIvP9otZxYDzTGQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/jest-environment-node/jest-mock": ["[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "jest-util": "30.3.0" } }, "sha512-OTzICK8CpE+t4ndhKrwlIdbM6Pn8j00lvmSmq5ejiO+KxukbLjgOflKWMn3KE34EZdQm5RqTuKj+5RIEniYhog=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-haste-map/jest-worker/supports-color": ["[email protected]", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runner/@jest/environment/@jest/fake-timers": ["@jest/[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@sinonjs/fake-timers": "^15.0.0", "@types/node": "*", "jest-message-util": "30.3.0", "jest-mock": "30.3.0", "jest-util": "30.3.0" } }, "sha512-WUQDs8SOP9URStX1DzhD425CqbN/HxUYCTwVrT8sTVBfMvFqYt/s61EK5T05qnHu0po6RitXIvP9otZxYDzTGQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runner/@jest/environment/jest-mock": ["[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "jest-util": "30.3.0" } }, "sha512-OTzICK8CpE+t4ndhKrwlIdbM6Pn8j00lvmSmq5ejiO+KxukbLjgOflKWMn3KE34EZdQm5RqTuKj+5RIEniYhog=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runner/jest-environment-node/@jest/fake-timers": ["@jest/[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@sinonjs/fake-timers": "^15.0.0", "@types/node": "*", "jest-message-util": "30.3.0", "jest-mock": "30.3.0", "jest-util": "30.3.0" } }, "sha512-WUQDs8SOP9URStX1DzhD425CqbN/HxUYCTwVrT8sTVBfMvFqYt/s61EK5T05qnHu0po6RitXIvP9otZxYDzTGQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runner/jest-environment-node/jest-mock": ["[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "jest-util": "30.3.0" } }, "sha512-OTzICK8CpE+t4ndhKrwlIdbM6Pn8j00lvmSmq5ejiO+KxukbLjgOflKWMn3KE34EZdQm5RqTuKj+5RIEniYhog=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runner/jest-worker/supports-color": ["[email protected]", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/@jest/fake-timers/@sinonjs/fake-timers": ["@sinonjs/[email protected]", "", { "dependencies": { "@sinonjs/commons": "^3.0.1" } }, "sha512-cO5W33JgAPbOh07tvZjUOJ7oWhtaqGHiZw+11DPbyqh2kHTBc3eF/CjJDeQ4205RLQsX6rxCuYOroFQwl7JDRw=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/@jest/globals/@jest/expect": ["@jest/[email protected]", "", { "dependencies": { "expect": "30.3.0", "jest-snapshot": "30.3.0" } }, "sha512-76Nlh4xJxk2D/9URCn3wFi98d2hb19uWE1idLsTt2ywhvdOldbw3S570hBgn25P4ICUZ/cBjybrBex2g17IDbg=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/@jest/source-map/@jridgewell/trace-mapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/glob/jackspeak": ["[email protected]", "", { "dependencies": { "@isaacs/cliui": "^8.0.2" }, "optionalDependencies": { "@pkgjs/parseargs": "^0.11.0" } }, "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/glob/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^2.0.2" } }, "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/glob/minipass": ["[email protected]", "", {}, "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/glob/path-scurry": ["[email protected]", "", { "dependencies": { "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" } }, "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-snapshot/expect/jest-mock": ["[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "jest-util": "30.3.0" } }, "sha512-OTzICK8CpE+t4ndhKrwlIdbM6Pn8j00lvmSmq5ejiO+KxukbLjgOflKWMn3KE34EZdQm5RqTuKj+5RIEniYhog=="],
-
- "@mercurjs/registry/jest/@jest/core/pretty-format/@jest/schemas/@sinclair/typebox": ["@sinclair/[email protected]", "", {}, "sha512-kKJTNuK3AQOrgjjotVxMrCn1sUJwM76wMszfq1kdU4uYVJjvEWuFQ6HgvLt4Xz3fSmZlTOxJ/Ie13KnIcWQXFA=="],
-
- "@mercurjs/registry/jest/jest-cli/@jest/test-result/@jest/console/jest-message-util": ["[email protected]", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@jest/types": "30.3.0", "@types/stack-utils": "^2.0.3", "chalk": "^4.1.2", "graceful-fs": "^4.2.11", "picomatch": "^4.0.3", "pretty-format": "30.3.0", "slash": "^3.0.0", "stack-utils": "^2.0.6" } }, "sha512-Z/j4Bo+4ySJ+JPJN3b2Qbl9hDq3VrXmnjjGEWD/x0BCXeOXPTV1iZYYzl2X8c1MaCOL+ewMyNBcm88sboE6YWw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/@jest/test-sequencer/jest-haste-map": ["[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "anymatch": "^3.1.3", "fb-watchman": "^2.0.2", "graceful-fs": "^4.2.11", "jest-regex-util": "30.0.1", "jest-util": "30.3.0", "jest-worker": "30.3.0", "picomatch": "^4.0.3", "walker": "^1.0.8" }, "optionalDependencies": { "fsevents": "^2.3.3" } }, "sha512-mMi2oqG4KRU0R9QEtscl87JzMXfUhbKaFqOxmjb2CKcbHcUGFrJCBWHmnTiUqi6JcnzoBlO4rWfpdl2k/RfLCA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/babel-jest/@jest/transform": ["@jest/[email protected]", "", { "dependencies": { "@babel/core": "^7.27.4", "@jest/types": "30.3.0", "@jridgewell/trace-mapping": "^0.3.25", "babel-plugin-istanbul": "^7.0.1", "chalk": "^4.1.2", "convert-source-map": "^2.0.0", "fast-json-stable-stringify": "^2.1.0", "graceful-fs": "^4.2.11", "jest-haste-map": "30.3.0", "jest-regex-util": "30.0.1", "jest-util": "30.3.0", "pirates": "^4.0.7", "slash": "^3.0.0", "write-file-atomic": "^5.0.1" } }, "sha512-TLKY33fSLVd/lKB2YI1pH69ijyUblO/BQvCj566YvnwuzoTNr648iE0j22vRvVNk2HsPwByPxATg3MleS3gf5A=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/babel-jest/babel-plugin-istanbul": ["[email protected]", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.0.0", "@istanbuljs/load-nyc-config": "^1.0.0", "@istanbuljs/schema": "^0.1.3", "istanbul-lib-instrument": "^6.0.2", "test-exclude": "^6.0.0" } }, "sha512-D8Z6Qm8jCvVXtIRkBnqNHX0zJ37rQcFJ9u8WOS6tkYOsRdHBzypCstaxWiu5ZIlqQtviRYbgnRLSoCEvjqcqbA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/babel-jest/babel-preset-jest": ["[email protected]", "", { "dependencies": { "babel-plugin-jest-hoist": "30.3.0", "babel-preset-current-node-syntax": "^1.2.0" }, "peerDependencies": { "@babel/core": "^7.11.0 || ^8.0.0-beta.1" } }, "sha512-6ZcUbWHC+dMz2vfzdNwi87Z1gQsLNK2uLuK1Q89R11xdvejcivlYYwDlEv0FHX3VwEXpbBQ9uufB/MUNpZGfhQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/glob/jackspeak": ["[email protected]", "", { "dependencies": { "@isaacs/cliui": "^8.0.2" }, "optionalDependencies": { "@pkgjs/parseargs": "^0.11.0" } }, "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/glob/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^2.0.2" } }, "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/glob/minipass": ["[email protected]", "", {}, "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/glob/path-scurry": ["[email protected]", "", { "dependencies": { "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" } }, "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/@jest/environment": ["@jest/[email protected]", "", { "dependencies": { "@jest/fake-timers": "30.3.0", "@jest/types": "30.3.0", "@types/node": "*", "jest-mock": "30.3.0" } }, "sha512-SlLSF4Be735yQXyh2+mctBOzNDx5s5uLv88/j8Qn1wH679PDcwy67+YdADn8NJnGjzlXtN62asGH/T4vWOkfaw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/@jest/expect": ["@jest/[email protected]", "", { "dependencies": { "expect": "30.3.0", "jest-snapshot": "30.3.0" } }, "sha512-76Nlh4xJxk2D/9URCn3wFi98d2hb19uWE1idLsTt2ywhvdOldbw3S570hBgn25P4ICUZ/cBjybrBex2g17IDbg=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-each": ["[email protected]", "", { "dependencies": { "@jest/get-type": "30.1.0", "@jest/types": "30.3.0", "chalk": "^4.1.2", "jest-util": "30.3.0", "pretty-format": "30.3.0" } }, "sha512-V8eMndg/aZ+3LnCJgSm13IxS5XSBM22QSZc9BtPK8Dek6pm+hfUNfwBdvsB3d342bo1q7wnSkC38zjX259qZNA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-matcher-utils": ["[email protected]", "", { "dependencies": { "@jest/get-type": "30.1.0", "chalk": "^4.1.2", "jest-diff": "30.3.0", "pretty-format": "30.3.0" } }, "sha512-HEtc9uFQgaUHkC7nLSlQL3Tph4Pjxt/yiPvkIrrDCt9jhoLIgxaubo1G+CFOnmHYMxHwwdaSN7mkIFs6ZK8OhA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-message-util": ["[email protected]", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@jest/types": "30.3.0", "@types/stack-utils": "^2.0.3", "chalk": "^4.1.2", "graceful-fs": "^4.2.11", "picomatch": "^4.0.3", "pretty-format": "30.3.0", "slash": "^3.0.0", "stack-utils": "^2.0.6" } }, "sha512-Z/j4Bo+4ySJ+JPJN3b2Qbl9hDq3VrXmnjjGEWD/x0BCXeOXPTV1iZYYzl2X8c1MaCOL+ewMyNBcm88sboE6YWw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-runtime": ["[email protected]", "", { "dependencies": { "@jest/environment": "30.3.0", "@jest/fake-timers": "30.3.0", "@jest/globals": "30.3.0", "@jest/source-map": "30.0.1", "@jest/test-result": "30.3.0", "@jest/transform": "30.3.0", "@jest/types": "30.3.0", "@types/node": "*", "chalk": "^4.1.2", "cjs-module-lexer": "^2.1.0", "collect-v8-coverage": "^1.0.2", "glob": "^10.5.0", "graceful-fs": "^4.2.11", "jest-haste-map": "30.3.0", "jest-message-util": "30.3.0", "jest-mock": "30.3.0", "jest-regex-util": "30.0.1", "jest-resolve": "30.3.0", "jest-snapshot": "30.3.0", "jest-util": "30.3.0", "slash": "^3.0.0", "strip-bom": "^4.0.0" } }, "sha512-CgC+hIBJbuh78HEffkhNKcbXAytQViplcl8xupqeIWyKQF50kCQA8J7GeJCkjisC6hpnC9Muf8jV5RdtdFbGng=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-snapshot": ["[email protected]", "", { "dependencies": { "@babel/core": "^7.27.4", "@babel/generator": "^7.27.5", "@babel/plugin-syntax-jsx": "^7.27.1", "@babel/plugin-syntax-typescript": "^7.27.1", "@babel/types": "^7.27.3", "@jest/expect-utils": "30.3.0", "@jest/get-type": "30.1.0", "@jest/snapshot-utils": "30.3.0", "@jest/transform": "30.3.0", "@jest/types": "30.3.0", "babel-preset-current-node-syntax": "^1.2.0", "chalk": "^4.1.2", "expect": "30.3.0", "graceful-fs": "^4.2.11", "jest-diff": "30.3.0", "jest-matcher-utils": "30.3.0", "jest-message-util": "30.3.0", "jest-util": "30.3.0", "pretty-format": "30.3.0", "semver": "^7.7.2", "synckit": "^0.11.8" } }, "sha512-f14c7atpb4O2DeNhwcvS810Y63wEn8O1HqK/luJ4F6M4NjvxmAKQwBUWjbExUtMxWJQ0wVgmCKymeJK6NZMnfQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/pure-rand": ["[email protected]", "", {}, "sha512-oTUZM/NAZS8p7ANR3SHh30kXB+zK2r2BPcEn/awJIbOvq82WoMN4p62AWWp3Hhw50G0xMsw1mhIBLqHw64EcNQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-environment-node/@jest/environment": ["@jest/[email protected]", "", { "dependencies": { "@jest/fake-timers": "30.3.0", "@jest/types": "30.3.0", "@types/node": "*", "jest-mock": "30.3.0" } }, "sha512-SlLSF4Be735yQXyh2+mctBOzNDx5s5uLv88/j8Qn1wH679PDcwy67+YdADn8NJnGjzlXtN62asGH/T4vWOkfaw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-environment-node/@jest/fake-timers": ["@jest/[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@sinonjs/fake-timers": "^15.0.0", "@types/node": "*", "jest-message-util": "30.3.0", "jest-mock": "30.3.0", "jest-util": "30.3.0" } }, "sha512-WUQDs8SOP9URStX1DzhD425CqbN/HxUYCTwVrT8sTVBfMvFqYt/s61EK5T05qnHu0po6RitXIvP9otZxYDzTGQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-environment-node/jest-mock": ["[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "jest-util": "30.3.0" } }, "sha512-OTzICK8CpE+t4ndhKrwlIdbM6Pn8j00lvmSmq5ejiO+KxukbLjgOflKWMn3KE34EZdQm5RqTuKj+5RIEniYhog=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-resolve/jest-haste-map": ["[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "anymatch": "^3.1.3", "fb-watchman": "^2.0.2", "graceful-fs": "^4.2.11", "jest-regex-util": "30.0.1", "jest-util": "30.3.0", "jest-worker": "30.3.0", "picomatch": "^4.0.3", "walker": "^1.0.8" }, "optionalDependencies": { "fsevents": "^2.3.3" } }, "sha512-mMi2oqG4KRU0R9QEtscl87JzMXfUhbKaFqOxmjb2CKcbHcUGFrJCBWHmnTiUqi6JcnzoBlO4rWfpdl2k/RfLCA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/@jest/console": ["@jest/[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "chalk": "^4.1.2", "jest-message-util": "30.3.0", "jest-util": "30.3.0", "slash": "^3.0.0" } }, "sha512-PAwCvFJ4696XP2qZj+LAn1BWjZaJ6RjG6c7/lkMaUJnkyMS34ucuIsfqYvfskVNvUI27R/u4P1HMYFnlVXG/Ww=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/@jest/environment": ["@jest/[email protected]", "", { "dependencies": { "@jest/fake-timers": "30.3.0", "@jest/types": "30.3.0", "@types/node": "*", "jest-mock": "30.3.0" } }, "sha512-SlLSF4Be735yQXyh2+mctBOzNDx5s5uLv88/j8Qn1wH679PDcwy67+YdADn8NJnGjzlXtN62asGH/T4vWOkfaw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/@jest/transform": ["@jest/[email protected]", "", { "dependencies": { "@babel/core": "^7.27.4", "@jest/types": "30.3.0", "@jridgewell/trace-mapping": "^0.3.25", "babel-plugin-istanbul": "^7.0.1", "chalk": "^4.1.2", "convert-source-map": "^2.0.0", "fast-json-stable-stringify": "^2.1.0", "graceful-fs": "^4.2.11", "jest-haste-map": "30.3.0", "jest-regex-util": "30.0.1", "jest-util": "30.3.0", "pirates": "^4.0.7", "slash": "^3.0.0", "write-file-atomic": "^5.0.1" } }, "sha512-TLKY33fSLVd/lKB2YI1pH69ijyUblO/BQvCj566YvnwuzoTNr648iE0j22vRvVNk2HsPwByPxATg3MleS3gf5A=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-haste-map": ["[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "anymatch": "^3.1.3", "fb-watchman": "^2.0.2", "graceful-fs": "^4.2.11", "jest-regex-util": "30.0.1", "jest-util": "30.3.0", "jest-worker": "30.3.0", "picomatch": "^4.0.3", "walker": "^1.0.8" }, "optionalDependencies": { "fsevents": "^2.3.3" } }, "sha512-mMi2oqG4KRU0R9QEtscl87JzMXfUhbKaFqOxmjb2CKcbHcUGFrJCBWHmnTiUqi6JcnzoBlO4rWfpdl2k/RfLCA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-leak-detector": ["[email protected]", "", { "dependencies": { "@jest/get-type": "30.1.0", "pretty-format": "30.3.0" } }, "sha512-cuKmUUGIjfXZAiGJ7TbEMx0bcqNdPPI6P1V+7aF+m/FUJqFDxkFR4JqkTu8ZOiU5AaX/x0hZ20KaaIPXQzbMGQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-message-util": ["[email protected]", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@jest/types": "30.3.0", "@types/stack-utils": "^2.0.3", "chalk": "^4.1.2", "graceful-fs": "^4.2.11", "picomatch": "^4.0.3", "pretty-format": "30.3.0", "slash": "^3.0.0", "stack-utils": "^2.0.6" } }, "sha512-Z/j4Bo+4ySJ+JPJN3b2Qbl9hDq3VrXmnjjGEWD/x0BCXeOXPTV1iZYYzl2X8c1MaCOL+ewMyNBcm88sboE6YWw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-runtime": ["[email protected]", "", { "dependencies": { "@jest/environment": "30.3.0", "@jest/fake-timers": "30.3.0", "@jest/globals": "30.3.0", "@jest/source-map": "30.0.1", "@jest/test-result": "30.3.0", "@jest/transform": "30.3.0", "@jest/types": "30.3.0", "@types/node": "*", "chalk": "^4.1.2", "cjs-module-lexer": "^2.1.0", "collect-v8-coverage": "^1.0.2", "glob": "^10.5.0", "graceful-fs": "^4.2.11", "jest-haste-map": "30.3.0", "jest-message-util": "30.3.0", "jest-mock": "30.3.0", "jest-regex-util": "30.0.1", "jest-resolve": "30.3.0", "jest-snapshot": "30.3.0", "jest-util": "30.3.0", "slash": "^3.0.0", "strip-bom": "^4.0.0" } }, "sha512-CgC+hIBJbuh78HEffkhNKcbXAytQViplcl8xupqeIWyKQF50kCQA8J7GeJCkjisC6hpnC9Muf8jV5RdtdFbGng=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-watcher": ["[email protected]", "", { "dependencies": { "@jest/test-result": "30.3.0", "@jest/types": "30.3.0", "@types/node": "*", "ansi-escapes": "^4.3.2", "chalk": "^4.1.2", "emittery": "^0.13.1", "jest-util": "30.3.0", "string-length": "^4.0.2" } }, "sha512-PJ1d9ThtTR8aMiBWUdcownq9mDdLXsQzJayTk4kmaBRHKvwNQn+ANveuhEBUyNI2hR1TVhvQ8D5kHubbzBHR/w=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-worker": ["[email protected]", "", { "dependencies": { "@types/node": "*", "@ungap/structured-clone": "^1.3.0", "jest-util": "30.3.0", "merge-stream": "^2.0.0", "supports-color": "^8.1.1" } }, "sha512-DrCKkaQwHexjRUFTmPzs7sHQe0TSj9nvDALKGdwmK5mW9v7j90BudWirKAJHt3QQ9Dhrg1F7DogPzhChppkJpQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/pretty-format/@jest/schemas": ["@jest/[email protected]", "", { "dependencies": { "@sinclair/typebox": "^0.34.0" } }, "sha512-DmdYgtezMkh3cpU8/1uyXakv3tJRcmcXxBOcO0tbaozPwpmh4YMsnWrQm9ZmZMfa5ocbxzbFk6O4bDPEc/iAnA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/pretty-format/ansi-styles": ["[email protected]", "", {}, "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/pretty-format/react-is": ["[email protected]", "", {}, "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-validate/pretty-format/@jest/schemas": ["@jest/[email protected]", "", { "dependencies": { "@sinclair/typebox": "^0.34.0" } }, "sha512-DmdYgtezMkh3cpU8/1uyXakv3tJRcmcXxBOcO0tbaozPwpmh4YMsnWrQm9ZmZMfa5ocbxzbFk6O4bDPEc/iAnA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-validate/pretty-format/ansi-styles": ["[email protected]", "", {}, "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-validate/pretty-format/react-is": ["[email protected]", "", {}, "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="],
-
- "@mercurjs/registry/jest/jest-cli/yargs/cliui/wrap-ansi": ["[email protected]", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="],
-
"@mercurjs/integration-tests/jest/@jest/core/@jest/reporters/glob/jackspeak/@isaacs/cliui": ["@isaacs/[email protected]", "", { "dependencies": { "string-width": "^5.1.2", "string-width-cjs": "npm:string-width@^4.2.0", "strip-ansi": "^7.0.1", "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", "wrap-ansi": "^8.1.0", "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" } }, "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA=="],
"@mercurjs/integration-tests/jest/@jest/core/@jest/reporters/glob/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ=="],
@@ -5272,6 +4949,8 @@
"@mercurjs/integration-tests/jest/@jest/core/jest-runtime/glob/path-scurry/lru-cache": ["[email protected]", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="],
+ "@mercurjs/integration-tests/jest/jest-cli/@jest/test-result/@jest/console/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
"@mercurjs/integration-tests/jest/jest-cli/@jest/test-result/@jest/console/jest-message-util/picomatch": ["[email protected]", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
"@mercurjs/integration-tests/jest/jest-cli/@jest/test-result/@jest/console/jest-message-util/pretty-format": ["[email protected]", "", { "dependencies": { "@jest/schemas": "30.0.5", "ansi-styles": "^5.2.0", "react-is": "^18.3.1" } }, "sha512-oG4T3wCbfeuvljnyAzhBvpN45E8iOTXCU/TD3zXW80HA3dQ4ahdqMkWGiPWZvjpQwlbyHrPTWUAqUzGzv4l1JQ=="],
@@ -5302,6 +4981,8 @@
"@mercurjs/integration-tests/jest/jest-cli/jest-config/jest-circus/@jest/expect/expect": ["[email protected]", "", { "dependencies": { "@jest/expect-utils": "30.3.0", "@jest/get-type": "30.1.0", "jest-matcher-utils": "30.3.0", "jest-message-util": "30.3.0", "jest-mock": "30.3.0", "jest-util": "30.3.0" } }, "sha512-1zQrciTiQfRdo7qJM1uG4navm8DayFa2TgCSRlzUyNkhcJ6XUZF3hjnpkyr3VhAqPH7i/9GkG7Tv5abz6fqz0Q=="],
+ "@mercurjs/integration-tests/jest/jest-cli/jest-config/jest-circus/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
"@mercurjs/integration-tests/jest/jest-cli/jest-config/jest-circus/jest-matcher-utils/jest-diff": ["[email protected]", "", { "dependencies": { "@jest/diff-sequences": "30.3.0", "@jest/get-type": "30.1.0", "chalk": "^4.1.2", "pretty-format": "30.3.0" } }, "sha512-n3q4PDQjS4LrKxfWB3Z5KNk1XjXtZTBwQp71OP0Jo03Z6V60x++K5L8k6ZrW8MY8pOFylZvHM0zsjS1RqlHJZQ=="],
"@mercurjs/integration-tests/jest/jest-cli/jest-config/jest-circus/jest-message-util/picomatch": ["[email protected]", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
@@ -5336,6 +5017,8 @@
"@mercurjs/integration-tests/jest/jest-cli/jest-config/jest-environment-node/@jest/fake-timers/jest-message-util": ["[email protected]", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@jest/types": "30.3.0", "@types/stack-utils": "^2.0.3", "chalk": "^4.1.2", "graceful-fs": "^4.2.11", "picomatch": "^4.0.3", "pretty-format": "30.3.0", "slash": "^3.0.0", "stack-utils": "^2.0.6" } }, "sha512-Z/j4Bo+4ySJ+JPJN3b2Qbl9hDq3VrXmnjjGEWD/x0BCXeOXPTV1iZYYzl2X8c1MaCOL+ewMyNBcm88sboE6YWw=="],
+ "@mercurjs/integration-tests/jest/jest-cli/jest-config/jest-environment-node/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
"@mercurjs/integration-tests/jest/jest-cli/jest-config/jest-resolve/jest-haste-map/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-F0R/h2+dsy5wJAUe3tAU6oqa2qbWY5TpNfL/RGmo1y38hiyO1w3x2jPtt76wmuaJI4DQnOBu21cNXQ2STIUUWg=="],
"@mercurjs/integration-tests/jest/jest-cli/jest-config/jest-resolve/jest-haste-map/jest-worker": ["[email protected]", "", { "dependencies": { "@types/node": "*", "@ungap/structured-clone": "^1.3.0", "jest-util": "30.3.0", "merge-stream": "^2.0.0", "supports-color": "^8.1.1" } }, "sha512-DrCKkaQwHexjRUFTmPzs7sHQe0TSj9nvDALKGdwmK5mW9v7j90BudWirKAJHt3QQ9Dhrg1F7DogPzhChppkJpQ=="],
@@ -5352,6 +5035,8 @@
"@mercurjs/integration-tests/jest/jest-cli/jest-config/jest-runner/@jest/transform/write-file-atomic": ["[email protected]", "", { "dependencies": { "imurmurhash": "^0.1.4", "signal-exit": "^4.0.1" } }, "sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw=="],
+ "@mercurjs/integration-tests/jest/jest-cli/jest-config/jest-runner/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
"@mercurjs/integration-tests/jest/jest-cli/jest-config/jest-runner/jest-haste-map/picomatch": ["[email protected]", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
"@mercurjs/integration-tests/jest/jest-cli/jest-config/jest-runner/jest-message-util/picomatch": ["[email protected]", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
@@ -5378,150 +5063,6 @@
"@mercurjs/integration-tests/jest/jest-cli/jest-validate/pretty-format/@jest/schemas/@sinclair/typebox": ["@sinclair/[email protected]", "", {}, "sha512-kKJTNuK3AQOrgjjotVxMrCn1sUJwM76wMszfq1kdU4uYVJjvEWuFQ6HgvLt4Xz3fSmZlTOxJ/Ie13KnIcWQXFA=="],
- "@mercurjs/registry/jest/@jest/core/@jest/reporters/glob/jackspeak/@isaacs/cliui": ["@isaacs/[email protected]", "", { "dependencies": { "string-width": "^5.1.2", "string-width-cjs": "npm:string-width@^4.2.0", "strip-ansi": "^7.0.1", "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", "wrap-ansi": "^8.1.0", "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" } }, "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA=="],
-
- "@mercurjs/registry/jest/@jest/core/@jest/reporters/glob/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ=="],
-
- "@mercurjs/registry/jest/@jest/core/@jest/reporters/glob/path-scurry/lru-cache": ["[email protected]", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="],
-
- "@mercurjs/registry/jest/@jest/core/@jest/reporters/jest-worker/supports-color/has-flag": ["[email protected]", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/babel-jest/babel-preset-jest/babel-plugin-jest-hoist": ["[email protected]", "", { "dependencies": { "@types/babel__core": "^7.20.5" } }, "sha512-+TRkByhsws6sfPjVaitzadk1I0F5sPvOVUH5tyTSzhePpsGIVrdeunHSw/C36QeocS95OOk8lunc4rlu5Anwsg=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/glob/jackspeak/@isaacs/cliui": ["@isaacs/[email protected]", "", { "dependencies": { "string-width": "^5.1.2", "string-width-cjs": "npm:string-width@^4.2.0", "strip-ansi": "^7.0.1", "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", "wrap-ansi": "^8.1.0", "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" } }, "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/glob/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/glob/path-scurry/lru-cache": ["[email protected]", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/jest-circus/@jest/environment/@jest/fake-timers": ["@jest/[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@sinonjs/fake-timers": "^15.0.0", "@types/node": "*", "jest-message-util": "30.3.0", "jest-mock": "30.3.0", "jest-util": "30.3.0" } }, "sha512-WUQDs8SOP9URStX1DzhD425CqbN/HxUYCTwVrT8sTVBfMvFqYt/s61EK5T05qnHu0po6RitXIvP9otZxYDzTGQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/jest-circus/@jest/environment/jest-mock": ["[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "jest-util": "30.3.0" } }, "sha512-OTzICK8CpE+t4ndhKrwlIdbM6Pn8j00lvmSmq5ejiO+KxukbLjgOflKWMn3KE34EZdQm5RqTuKj+5RIEniYhog=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/jest-circus/@jest/expect/expect": ["[email protected]", "", { "dependencies": { "@jest/expect-utils": "30.3.0", "@jest/get-type": "30.1.0", "jest-matcher-utils": "30.3.0", "jest-message-util": "30.3.0", "jest-mock": "30.3.0", "jest-util": "30.3.0" } }, "sha512-1zQrciTiQfRdo7qJM1uG4navm8DayFa2TgCSRlzUyNkhcJ6XUZF3hjnpkyr3VhAqPH7i/9GkG7Tv5abz6fqz0Q=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/jest-circus/jest-matcher-utils/jest-diff": ["[email protected]", "", { "dependencies": { "@jest/diff-sequences": "30.3.0", "@jest/get-type": "30.1.0", "chalk": "^4.1.2", "pretty-format": "30.3.0" } }, "sha512-n3q4PDQjS4LrKxfWB3Z5KNk1XjXtZTBwQp71OP0Jo03Z6V60x++K5L8k6ZrW8MY8pOFylZvHM0zsjS1RqlHJZQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/jest-environment-node/@jest/fake-timers/@sinonjs/fake-timers": ["@sinonjs/[email protected]", "", { "dependencies": { "@sinonjs/commons": "^3.0.1" } }, "sha512-cO5W33JgAPbOh07tvZjUOJ7oWhtaqGHiZw+11DPbyqh2kHTBc3eF/CjJDeQ4205RLQsX6rxCuYOroFQwl7JDRw=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-haste-map/jest-worker/supports-color/has-flag": ["[email protected]", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runner/@jest/environment/@jest/fake-timers/@sinonjs/fake-timers": ["@sinonjs/[email protected]", "", { "dependencies": { "@sinonjs/commons": "^3.0.1" } }, "sha512-cO5W33JgAPbOh07tvZjUOJ7oWhtaqGHiZw+11DPbyqh2kHTBc3eF/CjJDeQ4205RLQsX6rxCuYOroFQwl7JDRw=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runner/jest-environment-node/@jest/fake-timers/@sinonjs/fake-timers": ["@sinonjs/[email protected]", "", { "dependencies": { "@sinonjs/commons": "^3.0.1" } }, "sha512-cO5W33JgAPbOh07tvZjUOJ7oWhtaqGHiZw+11DPbyqh2kHTBc3eF/CjJDeQ4205RLQsX6rxCuYOroFQwl7JDRw=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runner/jest-worker/supports-color/has-flag": ["[email protected]", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/@jest/globals/@jest/expect/expect": ["[email protected]", "", { "dependencies": { "@jest/expect-utils": "30.3.0", "@jest/get-type": "30.1.0", "jest-matcher-utils": "30.3.0", "jest-message-util": "30.3.0", "jest-mock": "30.3.0", "jest-util": "30.3.0" } }, "sha512-1zQrciTiQfRdo7qJM1uG4navm8DayFa2TgCSRlzUyNkhcJ6XUZF3hjnpkyr3VhAqPH7i/9GkG7Tv5abz6fqz0Q=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/glob/jackspeak/@isaacs/cliui": ["@isaacs/[email protected]", "", { "dependencies": { "string-width": "^5.1.2", "string-width-cjs": "npm:string-width@^4.2.0", "strip-ansi": "^7.0.1", "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", "wrap-ansi": "^8.1.0", "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" } }, "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/glob/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/glob/path-scurry/lru-cache": ["[email protected]", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="],
-
- "@mercurjs/registry/jest/jest-cli/@jest/test-result/@jest/console/jest-message-util/picomatch": ["[email protected]", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
-
- "@mercurjs/registry/jest/jest-cli/@jest/test-result/@jest/console/jest-message-util/pretty-format": ["[email protected]", "", { "dependencies": { "@jest/schemas": "30.0.5", "ansi-styles": "^5.2.0", "react-is": "^18.3.1" } }, "sha512-oG4T3wCbfeuvljnyAzhBvpN45E8iOTXCU/TD3zXW80HA3dQ4ahdqMkWGiPWZvjpQwlbyHrPTWUAqUzGzv4l1JQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/@jest/test-sequencer/jest-haste-map/jest-worker": ["[email protected]", "", { "dependencies": { "@types/node": "*", "@ungap/structured-clone": "^1.3.0", "jest-util": "30.3.0", "merge-stream": "^2.0.0", "supports-color": "^8.1.1" } }, "sha512-DrCKkaQwHexjRUFTmPzs7sHQe0TSj9nvDALKGdwmK5mW9v7j90BudWirKAJHt3QQ9Dhrg1F7DogPzhChppkJpQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/@jest/test-sequencer/jest-haste-map/picomatch": ["[email protected]", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/babel-jest/@jest/transform/@jridgewell/trace-mapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/babel-jest/@jest/transform/jest-haste-map": ["[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "anymatch": "^3.1.3", "fb-watchman": "^2.0.2", "graceful-fs": "^4.2.11", "jest-regex-util": "30.0.1", "jest-util": "30.3.0", "jest-worker": "30.3.0", "picomatch": "^4.0.3", "walker": "^1.0.8" }, "optionalDependencies": { "fsevents": "^2.3.3" } }, "sha512-mMi2oqG4KRU0R9QEtscl87JzMXfUhbKaFqOxmjb2CKcbHcUGFrJCBWHmnTiUqi6JcnzoBlO4rWfpdl2k/RfLCA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/babel-jest/@jest/transform/write-file-atomic": ["[email protected]", "", { "dependencies": { "imurmurhash": "^0.1.4", "signal-exit": "^4.0.1" } }, "sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/babel-jest/babel-preset-jest/babel-plugin-jest-hoist": ["[email protected]", "", { "dependencies": { "@types/babel__core": "^7.20.5" } }, "sha512-+TRkByhsws6sfPjVaitzadk1I0F5sPvOVUH5tyTSzhePpsGIVrdeunHSw/C36QeocS95OOk8lunc4rlu5Anwsg=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/glob/jackspeak/@isaacs/cliui": ["@isaacs/[email protected]", "", { "dependencies": { "string-width": "^5.1.2", "string-width-cjs": "npm:string-width@^4.2.0", "strip-ansi": "^7.0.1", "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", "wrap-ansi": "^8.1.0", "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" } }, "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/glob/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/glob/path-scurry/lru-cache": ["[email protected]", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/@jest/environment/@jest/fake-timers": ["@jest/[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@sinonjs/fake-timers": "^15.0.0", "@types/node": "*", "jest-message-util": "30.3.0", "jest-mock": "30.3.0", "jest-util": "30.3.0" } }, "sha512-WUQDs8SOP9URStX1DzhD425CqbN/HxUYCTwVrT8sTVBfMvFqYt/s61EK5T05qnHu0po6RitXIvP9otZxYDzTGQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/@jest/environment/jest-mock": ["[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "jest-util": "30.3.0" } }, "sha512-OTzICK8CpE+t4ndhKrwlIdbM6Pn8j00lvmSmq5ejiO+KxukbLjgOflKWMn3KE34EZdQm5RqTuKj+5RIEniYhog=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/@jest/expect/expect": ["[email protected]", "", { "dependencies": { "@jest/expect-utils": "30.3.0", "@jest/get-type": "30.1.0", "jest-matcher-utils": "30.3.0", "jest-message-util": "30.3.0", "jest-mock": "30.3.0", "jest-util": "30.3.0" } }, "sha512-1zQrciTiQfRdo7qJM1uG4navm8DayFa2TgCSRlzUyNkhcJ6XUZF3hjnpkyr3VhAqPH7i/9GkG7Tv5abz6fqz0Q=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-matcher-utils/jest-diff": ["[email protected]", "", { "dependencies": { "@jest/diff-sequences": "30.3.0", "@jest/get-type": "30.1.0", "chalk": "^4.1.2", "pretty-format": "30.3.0" } }, "sha512-n3q4PDQjS4LrKxfWB3Z5KNk1XjXtZTBwQp71OP0Jo03Z6V60x++K5L8k6ZrW8MY8pOFylZvHM0zsjS1RqlHJZQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-message-util/picomatch": ["[email protected]", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-runtime/@jest/fake-timers": ["@jest/[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@sinonjs/fake-timers": "^15.0.0", "@types/node": "*", "jest-message-util": "30.3.0", "jest-mock": "30.3.0", "jest-util": "30.3.0" } }, "sha512-WUQDs8SOP9URStX1DzhD425CqbN/HxUYCTwVrT8sTVBfMvFqYt/s61EK5T05qnHu0po6RitXIvP9otZxYDzTGQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-runtime/@jest/globals": ["@jest/[email protected]", "", { "dependencies": { "@jest/environment": "30.3.0", "@jest/expect": "30.3.0", "@jest/types": "30.3.0", "jest-mock": "30.3.0" } }, "sha512-+owLCBBdfpgL3HU+BD5etr1SvbXpSitJK0is1kiYjJxAAJggYMRQz5hSdd5pq1sSggfxPbw2ld71pt4x5wwViA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-runtime/@jest/source-map": ["@jest/[email protected]", "", { "dependencies": { "@jridgewell/trace-mapping": "^0.3.25", "callsites": "^3.1.0", "graceful-fs": "^4.2.11" } }, "sha512-MIRWMUUR3sdbP36oyNyhbThLHyJ2eEDClPCiHVbrYAe5g3CHRArIVpBw7cdSB5fr+ofSfIb2Tnsw8iEHL0PYQg=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-runtime/@jest/transform": ["@jest/[email protected]", "", { "dependencies": { "@babel/core": "^7.27.4", "@jest/types": "30.3.0", "@jridgewell/trace-mapping": "^0.3.25", "babel-plugin-istanbul": "^7.0.1", "chalk": "^4.1.2", "convert-source-map": "^2.0.0", "fast-json-stable-stringify": "^2.1.0", "graceful-fs": "^4.2.11", "jest-haste-map": "30.3.0", "jest-regex-util": "30.0.1", "jest-util": "30.3.0", "pirates": "^4.0.7", "slash": "^3.0.0", "write-file-atomic": "^5.0.1" } }, "sha512-TLKY33fSLVd/lKB2YI1pH69ijyUblO/BQvCj566YvnwuzoTNr648iE0j22vRvVNk2HsPwByPxATg3MleS3gf5A=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-runtime/cjs-module-lexer": ["[email protected]", "", {}, "sha512-4bHTS2YuzUvtoLjdy+98ykbNB5jS0+07EvFNXerqZQJ89F7DI6ET7OQo/HJuW6K0aVsKA9hj9/RVb2kQVOrPDQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-runtime/jest-haste-map": ["[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "anymatch": "^3.1.3", "fb-watchman": "^2.0.2", "graceful-fs": "^4.2.11", "jest-regex-util": "30.0.1", "jest-util": "30.3.0", "jest-worker": "30.3.0", "picomatch": "^4.0.3", "walker": "^1.0.8" }, "optionalDependencies": { "fsevents": "^2.3.3" } }, "sha512-mMi2oqG4KRU0R9QEtscl87JzMXfUhbKaFqOxmjb2CKcbHcUGFrJCBWHmnTiUqi6JcnzoBlO4rWfpdl2k/RfLCA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-runtime/jest-mock": ["[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "jest-util": "30.3.0" } }, "sha512-OTzICK8CpE+t4ndhKrwlIdbM6Pn8j00lvmSmq5ejiO+KxukbLjgOflKWMn3KE34EZdQm5RqTuKj+5RIEniYhog=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-runtime/strip-bom": ["[email protected]", "", {}, "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-snapshot/@babel/types": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-snapshot/@jest/expect-utils": ["@jest/[email protected]", "", { "dependencies": { "@jest/get-type": "30.1.0" } }, "sha512-j0+W5iQQ8hBh7tHZkTQv3q2Fh/M7Je72cIsYqC4OaktgtO7v1So9UTjp6uPBHIaB6beoF/RRsCgMJKvti0wADA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-snapshot/@jest/transform": ["@jest/[email protected]", "", { "dependencies": { "@babel/core": "^7.27.4", "@jest/types": "30.3.0", "@jridgewell/trace-mapping": "^0.3.25", "babel-plugin-istanbul": "^7.0.1", "chalk": "^4.1.2", "convert-source-map": "^2.0.0", "fast-json-stable-stringify": "^2.1.0", "graceful-fs": "^4.2.11", "jest-haste-map": "30.3.0", "jest-regex-util": "30.0.1", "jest-util": "30.3.0", "pirates": "^4.0.7", "slash": "^3.0.0", "write-file-atomic": "^5.0.1" } }, "sha512-TLKY33fSLVd/lKB2YI1pH69ijyUblO/BQvCj566YvnwuzoTNr648iE0j22vRvVNk2HsPwByPxATg3MleS3gf5A=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-snapshot/expect": ["[email protected]", "", { "dependencies": { "@jest/expect-utils": "30.3.0", "@jest/get-type": "30.1.0", "jest-matcher-utils": "30.3.0", "jest-message-util": "30.3.0", "jest-mock": "30.3.0", "jest-util": "30.3.0" } }, "sha512-1zQrciTiQfRdo7qJM1uG4navm8DayFa2TgCSRlzUyNkhcJ6XUZF3hjnpkyr3VhAqPH7i/9GkG7Tv5abz6fqz0Q=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-snapshot/jest-diff": ["[email protected]", "", { "dependencies": { "@jest/diff-sequences": "30.3.0", "@jest/get-type": "30.1.0", "chalk": "^4.1.2", "pretty-format": "30.3.0" } }, "sha512-n3q4PDQjS4LrKxfWB3Z5KNk1XjXtZTBwQp71OP0Jo03Z6V60x++K5L8k6ZrW8MY8pOFylZvHM0zsjS1RqlHJZQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-environment-node/@jest/fake-timers/@sinonjs/fake-timers": ["@sinonjs/[email protected]", "", { "dependencies": { "@sinonjs/commons": "^3.0.1" } }, "sha512-cO5W33JgAPbOh07tvZjUOJ7oWhtaqGHiZw+11DPbyqh2kHTBc3eF/CjJDeQ4205RLQsX6rxCuYOroFQwl7JDRw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-environment-node/@jest/fake-timers/jest-message-util": ["[email protected]", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@jest/types": "30.3.0", "@types/stack-utils": "^2.0.3", "chalk": "^4.1.2", "graceful-fs": "^4.2.11", "picomatch": "^4.0.3", "pretty-format": "30.3.0", "slash": "^3.0.0", "stack-utils": "^2.0.6" } }, "sha512-Z/j4Bo+4ySJ+JPJN3b2Qbl9hDq3VrXmnjjGEWD/x0BCXeOXPTV1iZYYzl2X8c1MaCOL+ewMyNBcm88sboE6YWw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-resolve/jest-haste-map/jest-worker": ["[email protected]", "", { "dependencies": { "@types/node": "*", "@ungap/structured-clone": "^1.3.0", "jest-util": "30.3.0", "merge-stream": "^2.0.0", "supports-color": "^8.1.1" } }, "sha512-DrCKkaQwHexjRUFTmPzs7sHQe0TSj9nvDALKGdwmK5mW9v7j90BudWirKAJHt3QQ9Dhrg1F7DogPzhChppkJpQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-resolve/jest-haste-map/picomatch": ["[email protected]", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/@jest/environment/@jest/fake-timers": ["@jest/[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@sinonjs/fake-timers": "^15.0.0", "@types/node": "*", "jest-message-util": "30.3.0", "jest-mock": "30.3.0", "jest-util": "30.3.0" } }, "sha512-WUQDs8SOP9URStX1DzhD425CqbN/HxUYCTwVrT8sTVBfMvFqYt/s61EK5T05qnHu0po6RitXIvP9otZxYDzTGQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/@jest/environment/jest-mock": ["[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "jest-util": "30.3.0" } }, "sha512-OTzICK8CpE+t4ndhKrwlIdbM6Pn8j00lvmSmq5ejiO+KxukbLjgOflKWMn3KE34EZdQm5RqTuKj+5RIEniYhog=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/@jest/transform/@jridgewell/trace-mapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/@jest/transform/babel-plugin-istanbul": ["[email protected]", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.0.0", "@istanbuljs/load-nyc-config": "^1.0.0", "@istanbuljs/schema": "^0.1.3", "istanbul-lib-instrument": "^6.0.2", "test-exclude": "^6.0.0" } }, "sha512-D8Z6Qm8jCvVXtIRkBnqNHX0zJ37rQcFJ9u8WOS6tkYOsRdHBzypCstaxWiu5ZIlqQtviRYbgnRLSoCEvjqcqbA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/@jest/transform/write-file-atomic": ["[email protected]", "", { "dependencies": { "imurmurhash": "^0.1.4", "signal-exit": "^4.0.1" } }, "sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-haste-map/picomatch": ["[email protected]", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-message-util/picomatch": ["[email protected]", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-runtime/@jest/fake-timers": ["@jest/[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@sinonjs/fake-timers": "^15.0.0", "@types/node": "*", "jest-message-util": "30.3.0", "jest-mock": "30.3.0", "jest-util": "30.3.0" } }, "sha512-WUQDs8SOP9URStX1DzhD425CqbN/HxUYCTwVrT8sTVBfMvFqYt/s61EK5T05qnHu0po6RitXIvP9otZxYDzTGQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-runtime/@jest/globals": ["@jest/[email protected]", "", { "dependencies": { "@jest/environment": "30.3.0", "@jest/expect": "30.3.0", "@jest/types": "30.3.0", "jest-mock": "30.3.0" } }, "sha512-+owLCBBdfpgL3HU+BD5etr1SvbXpSitJK0is1kiYjJxAAJggYMRQz5hSdd5pq1sSggfxPbw2ld71pt4x5wwViA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-runtime/@jest/source-map": ["@jest/[email protected]", "", { "dependencies": { "@jridgewell/trace-mapping": "^0.3.25", "callsites": "^3.1.0", "graceful-fs": "^4.2.11" } }, "sha512-MIRWMUUR3sdbP36oyNyhbThLHyJ2eEDClPCiHVbrYAe5g3CHRArIVpBw7cdSB5fr+ofSfIb2Tnsw8iEHL0PYQg=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-runtime/cjs-module-lexer": ["[email protected]", "", {}, "sha512-4bHTS2YuzUvtoLjdy+98ykbNB5jS0+07EvFNXerqZQJ89F7DI6ET7OQo/HJuW6K0aVsKA9hj9/RVb2kQVOrPDQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-runtime/jest-mock": ["[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "jest-util": "30.3.0" } }, "sha512-OTzICK8CpE+t4ndhKrwlIdbM6Pn8j00lvmSmq5ejiO+KxukbLjgOflKWMn3KE34EZdQm5RqTuKj+5RIEniYhog=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-runtime/jest-snapshot": ["[email protected]", "", { "dependencies": { "@babel/core": "^7.27.4", "@babel/generator": "^7.27.5", "@babel/plugin-syntax-jsx": "^7.27.1", "@babel/plugin-syntax-typescript": "^7.27.1", "@babel/types": "^7.27.3", "@jest/expect-utils": "30.3.0", "@jest/get-type": "30.1.0", "@jest/snapshot-utils": "30.3.0", "@jest/transform": "30.3.0", "@jest/types": "30.3.0", "babel-preset-current-node-syntax": "^1.2.0", "chalk": "^4.1.2", "expect": "30.3.0", "graceful-fs": "^4.2.11", "jest-diff": "30.3.0", "jest-matcher-utils": "30.3.0", "jest-message-util": "30.3.0", "jest-util": "30.3.0", "pretty-format": "30.3.0", "semver": "^7.7.2", "synckit": "^0.11.8" } }, "sha512-f14c7atpb4O2DeNhwcvS810Y63wEn8O1HqK/luJ4F6M4NjvxmAKQwBUWjbExUtMxWJQ0wVgmCKymeJK6NZMnfQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-runtime/strip-bom": ["[email protected]", "", {}, "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-watcher/ansi-escapes": ["[email protected]", "", { "dependencies": { "type-fest": "^0.21.3" } }, "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-worker/supports-color": ["[email protected]", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/pretty-format/@jest/schemas/@sinclair/typebox": ["@sinclair/[email protected]", "", {}, "sha512-kKJTNuK3AQOrgjjotVxMrCn1sUJwM76wMszfq1kdU4uYVJjvEWuFQ6HgvLt4Xz3fSmZlTOxJ/Ie13KnIcWQXFA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-validate/pretty-format/@jest/schemas/@sinclair/typebox": ["@sinclair/[email protected]", "", {}, "sha512-kKJTNuK3AQOrgjjotVxMrCn1sUJwM76wMszfq1kdU4uYVJjvEWuFQ6HgvLt4Xz3fSmZlTOxJ/Ie13KnIcWQXFA=="],
-
"@mercurjs/integration-tests/jest/@jest/core/@jest/reporters/glob/jackspeak/@isaacs/cliui/string-width": ["[email protected]", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="],
"@mercurjs/integration-tests/jest/@jest/core/@jest/reporters/glob/jackspeak/@isaacs/cliui/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^6.2.2" } }, "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w=="],
@@ -5556,6 +5097,8 @@
"@mercurjs/integration-tests/jest/jest-cli/@jest/test-result/@jest/console/jest-message-util/pretty-format/react-is": ["[email protected]", "", {}, "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="],
+ "@mercurjs/integration-tests/jest/jest-cli/jest-config/@jest/test-sequencer/jest-haste-map/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
"@mercurjs/integration-tests/jest/jest-cli/jest-config/@jest/test-sequencer/jest-haste-map/jest-worker/supports-color": ["[email protected]", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="],
"@mercurjs/integration-tests/jest/jest-cli/jest-config/babel-jest/@jest/transform/jest-haste-map/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-F0R/h2+dsy5wJAUe3tAU6oqa2qbWY5TpNfL/RGmo1y38hiyO1w3x2jPtt76wmuaJI4DQnOBu21cNXQ2STIUUWg=="],
@@ -5602,6 +5145,8 @@
"@mercurjs/integration-tests/jest/jest-cli/jest-config/jest-environment-node/@jest/fake-timers/jest-message-util/picomatch": ["[email protected]", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
+ "@mercurjs/integration-tests/jest/jest-cli/jest-config/jest-resolve/jest-haste-map/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
"@mercurjs/integration-tests/jest/jest-cli/jest-config/jest-resolve/jest-haste-map/jest-worker/supports-color": ["[email protected]", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="],
"@mercurjs/integration-tests/jest/jest-cli/jest-config/jest-runner/@jest/environment/@jest/fake-timers/@sinonjs/fake-timers": ["@sinonjs/[email protected]", "", { "dependencies": { "@sinonjs/commons": "^3.0.1" } }, "sha512-cO5W33JgAPbOh07tvZjUOJ7oWhtaqGHiZw+11DPbyqh2kHTBc3eF/CjJDeQ4205RLQsX6rxCuYOroFQwl7JDRw=="],
@@ -5626,108 +5171,6 @@
"@mercurjs/integration-tests/jest/jest-cli/jest-config/jest-runner/jest-worker/supports-color/has-flag": ["[email protected]", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],
- "@mercurjs/registry/jest/@jest/core/@jest/reporters/glob/jackspeak/@isaacs/cliui/string-width": ["[email protected]", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="],
-
- "@mercurjs/registry/jest/@jest/core/@jest/reporters/glob/jackspeak/@isaacs/cliui/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^6.2.2" } }, "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w=="],
-
- "@mercurjs/registry/jest/@jest/core/@jest/reporters/glob/jackspeak/@isaacs/cliui/wrap-ansi": ["[email protected]", "", { "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", "strip-ansi": "^7.0.1" } }, "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/glob/jackspeak/@isaacs/cliui/string-width": ["[email protected]", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/glob/jackspeak/@isaacs/cliui/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^6.2.2" } }, "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/glob/jackspeak/@isaacs/cliui/wrap-ansi": ["[email protected]", "", { "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", "strip-ansi": "^7.0.1" } }, "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/jest-circus/@jest/environment/@jest/fake-timers/@sinonjs/fake-timers": ["@sinonjs/[email protected]", "", { "dependencies": { "@sinonjs/commons": "^3.0.1" } }, "sha512-cO5W33JgAPbOh07tvZjUOJ7oWhtaqGHiZw+11DPbyqh2kHTBc3eF/CjJDeQ4205RLQsX6rxCuYOroFQwl7JDRw=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/jest-circus/@jest/expect/expect/@jest/expect-utils": ["@jest/[email protected]", "", { "dependencies": { "@jest/get-type": "30.1.0" } }, "sha512-j0+W5iQQ8hBh7tHZkTQv3q2Fh/M7Je72cIsYqC4OaktgtO7v1So9UTjp6uPBHIaB6beoF/RRsCgMJKvti0wADA=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/jest-circus/@jest/expect/expect/jest-mock": ["[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "jest-util": "30.3.0" } }, "sha512-OTzICK8CpE+t4ndhKrwlIdbM6Pn8j00lvmSmq5ejiO+KxukbLjgOflKWMn3KE34EZdQm5RqTuKj+5RIEniYhog=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/@jest/globals/@jest/expect/expect/@jest/expect-utils": ["@jest/[email protected]", "", { "dependencies": { "@jest/get-type": "30.1.0" } }, "sha512-j0+W5iQQ8hBh7tHZkTQv3q2Fh/M7Je72cIsYqC4OaktgtO7v1So9UTjp6uPBHIaB6beoF/RRsCgMJKvti0wADA=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/@jest/globals/@jest/expect/expect/jest-matcher-utils": ["[email protected]", "", { "dependencies": { "@jest/get-type": "30.1.0", "chalk": "^4.1.2", "jest-diff": "30.3.0", "pretty-format": "30.3.0" } }, "sha512-HEtc9uFQgaUHkC7nLSlQL3Tph4Pjxt/yiPvkIrrDCt9jhoLIgxaubo1G+CFOnmHYMxHwwdaSN7mkIFs6ZK8OhA=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/glob/jackspeak/@isaacs/cliui/string-width": ["[email protected]", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/glob/jackspeak/@isaacs/cliui/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^6.2.2" } }, "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/glob/jackspeak/@isaacs/cliui/wrap-ansi": ["[email protected]", "", { "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", "strip-ansi": "^7.0.1" } }, "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ=="],
-
- "@mercurjs/registry/jest/jest-cli/@jest/test-result/@jest/console/jest-message-util/pretty-format/@jest/schemas": ["@jest/[email protected]", "", { "dependencies": { "@sinclair/typebox": "^0.34.0" } }, "sha512-DmdYgtezMkh3cpU8/1uyXakv3tJRcmcXxBOcO0tbaozPwpmh4YMsnWrQm9ZmZMfa5ocbxzbFk6O4bDPEc/iAnA=="],
-
- "@mercurjs/registry/jest/jest-cli/@jest/test-result/@jest/console/jest-message-util/pretty-format/ansi-styles": ["[email protected]", "", {}, "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA=="],
-
- "@mercurjs/registry/jest/jest-cli/@jest/test-result/@jest/console/jest-message-util/pretty-format/react-is": ["[email protected]", "", {}, "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/@jest/test-sequencer/jest-haste-map/jest-worker/supports-color": ["[email protected]", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/babel-jest/@jest/transform/jest-haste-map/jest-worker": ["[email protected]", "", { "dependencies": { "@types/node": "*", "@ungap/structured-clone": "^1.3.0", "jest-util": "30.3.0", "merge-stream": "^2.0.0", "supports-color": "^8.1.1" } }, "sha512-DrCKkaQwHexjRUFTmPzs7sHQe0TSj9nvDALKGdwmK5mW9v7j90BudWirKAJHt3QQ9Dhrg1F7DogPzhChppkJpQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/babel-jest/@jest/transform/jest-haste-map/picomatch": ["[email protected]", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/glob/jackspeak/@isaacs/cliui/string-width": ["[email protected]", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/glob/jackspeak/@isaacs/cliui/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^6.2.2" } }, "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/glob/jackspeak/@isaacs/cliui/wrap-ansi": ["[email protected]", "", { "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", "strip-ansi": "^7.0.1" } }, "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/@jest/environment/@jest/fake-timers/@sinonjs/fake-timers": ["@sinonjs/[email protected]", "", { "dependencies": { "@sinonjs/commons": "^3.0.1" } }, "sha512-cO5W33JgAPbOh07tvZjUOJ7oWhtaqGHiZw+11DPbyqh2kHTBc3eF/CjJDeQ4205RLQsX6rxCuYOroFQwl7JDRw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/@jest/expect/expect/@jest/expect-utils": ["@jest/[email protected]", "", { "dependencies": { "@jest/get-type": "30.1.0" } }, "sha512-j0+W5iQQ8hBh7tHZkTQv3q2Fh/M7Je72cIsYqC4OaktgtO7v1So9UTjp6uPBHIaB6beoF/RRsCgMJKvti0wADA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/@jest/expect/expect/jest-mock": ["[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "jest-util": "30.3.0" } }, "sha512-OTzICK8CpE+t4ndhKrwlIdbM6Pn8j00lvmSmq5ejiO+KxukbLjgOflKWMn3KE34EZdQm5RqTuKj+5RIEniYhog=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-runtime/@jest/fake-timers/@sinonjs/fake-timers": ["@sinonjs/[email protected]", "", { "dependencies": { "@sinonjs/commons": "^3.0.1" } }, "sha512-cO5W33JgAPbOh07tvZjUOJ7oWhtaqGHiZw+11DPbyqh2kHTBc3eF/CjJDeQ4205RLQsX6rxCuYOroFQwl7JDRw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-runtime/@jest/source-map/@jridgewell/trace-mapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-runtime/@jest/transform/@jridgewell/trace-mapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-runtime/@jest/transform/babel-plugin-istanbul": ["[email protected]", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.0.0", "@istanbuljs/load-nyc-config": "^1.0.0", "@istanbuljs/schema": "^0.1.3", "istanbul-lib-instrument": "^6.0.2", "test-exclude": "^6.0.0" } }, "sha512-D8Z6Qm8jCvVXtIRkBnqNHX0zJ37rQcFJ9u8WOS6tkYOsRdHBzypCstaxWiu5ZIlqQtviRYbgnRLSoCEvjqcqbA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-runtime/@jest/transform/write-file-atomic": ["[email protected]", "", { "dependencies": { "imurmurhash": "^0.1.4", "signal-exit": "^4.0.1" } }, "sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-runtime/jest-haste-map/jest-worker": ["[email protected]", "", { "dependencies": { "@types/node": "*", "@ungap/structured-clone": "^1.3.0", "jest-util": "30.3.0", "merge-stream": "^2.0.0", "supports-color": "^8.1.1" } }, "sha512-DrCKkaQwHexjRUFTmPzs7sHQe0TSj9nvDALKGdwmK5mW9v7j90BudWirKAJHt3QQ9Dhrg1F7DogPzhChppkJpQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-runtime/jest-haste-map/picomatch": ["[email protected]", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-snapshot/@jest/transform/@jridgewell/trace-mapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-snapshot/@jest/transform/babel-plugin-istanbul": ["[email protected]", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.0.0", "@istanbuljs/load-nyc-config": "^1.0.0", "@istanbuljs/schema": "^0.1.3", "istanbul-lib-instrument": "^6.0.2", "test-exclude": "^6.0.0" } }, "sha512-D8Z6Qm8jCvVXtIRkBnqNHX0zJ37rQcFJ9u8WOS6tkYOsRdHBzypCstaxWiu5ZIlqQtviRYbgnRLSoCEvjqcqbA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-snapshot/@jest/transform/jest-haste-map": ["[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "anymatch": "^3.1.3", "fb-watchman": "^2.0.2", "graceful-fs": "^4.2.11", "jest-regex-util": "30.0.1", "jest-util": "30.3.0", "jest-worker": "30.3.0", "picomatch": "^4.0.3", "walker": "^1.0.8" }, "optionalDependencies": { "fsevents": "^2.3.3" } }, "sha512-mMi2oqG4KRU0R9QEtscl87JzMXfUhbKaFqOxmjb2CKcbHcUGFrJCBWHmnTiUqi6JcnzoBlO4rWfpdl2k/RfLCA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-snapshot/@jest/transform/write-file-atomic": ["[email protected]", "", { "dependencies": { "imurmurhash": "^0.1.4", "signal-exit": "^4.0.1" } }, "sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-snapshot/expect/jest-mock": ["[email protected]", "", { "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", "jest-util": "30.3.0" } }, "sha512-OTzICK8CpE+t4ndhKrwlIdbM6Pn8j00lvmSmq5ejiO+KxukbLjgOflKWMn3KE34EZdQm5RqTuKj+5RIEniYhog=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-environment-node/@jest/fake-timers/jest-message-util/picomatch": ["[email protected]", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-resolve/jest-haste-map/jest-worker/supports-color": ["[email protected]", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/@jest/environment/@jest/fake-timers/@sinonjs/fake-timers": ["@sinonjs/[email protected]", "", { "dependencies": { "@sinonjs/commons": "^3.0.1" } }, "sha512-cO5W33JgAPbOh07tvZjUOJ7oWhtaqGHiZw+11DPbyqh2kHTBc3eF/CjJDeQ4205RLQsX6rxCuYOroFQwl7JDRw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-runtime/@jest/fake-timers/@sinonjs/fake-timers": ["@sinonjs/[email protected]", "", { "dependencies": { "@sinonjs/commons": "^3.0.1" } }, "sha512-cO5W33JgAPbOh07tvZjUOJ7oWhtaqGHiZw+11DPbyqh2kHTBc3eF/CjJDeQ4205RLQsX6rxCuYOroFQwl7JDRw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-runtime/@jest/globals/@jest/expect": ["@jest/[email protected]", "", { "dependencies": { "expect": "30.3.0", "jest-snapshot": "30.3.0" } }, "sha512-76Nlh4xJxk2D/9URCn3wFi98d2hb19uWE1idLsTt2ywhvdOldbw3S570hBgn25P4ICUZ/cBjybrBex2g17IDbg=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-runtime/@jest/source-map/@jridgewell/trace-mapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-runtime/jest-snapshot/@babel/types": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-runtime/jest-snapshot/@jest/expect-utils": ["@jest/[email protected]", "", { "dependencies": { "@jest/get-type": "30.1.0" } }, "sha512-j0+W5iQQ8hBh7tHZkTQv3q2Fh/M7Je72cIsYqC4OaktgtO7v1So9UTjp6uPBHIaB6beoF/RRsCgMJKvti0wADA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-runtime/jest-snapshot/expect": ["[email protected]", "", { "dependencies": { "@jest/expect-utils": "30.3.0", "@jest/get-type": "30.1.0", "jest-matcher-utils": "30.3.0", "jest-message-util": "30.3.0", "jest-mock": "30.3.0", "jest-util": "30.3.0" } }, "sha512-1zQrciTiQfRdo7qJM1uG4navm8DayFa2TgCSRlzUyNkhcJ6XUZF3hjnpkyr3VhAqPH7i/9GkG7Tv5abz6fqz0Q=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-runtime/jest-snapshot/jest-diff": ["[email protected]", "", { "dependencies": { "@jest/diff-sequences": "30.3.0", "@jest/get-type": "30.1.0", "chalk": "^4.1.2", "pretty-format": "30.3.0" } }, "sha512-n3q4PDQjS4LrKxfWB3Z5KNk1XjXtZTBwQp71OP0Jo03Z6V60x++K5L8k6ZrW8MY8pOFylZvHM0zsjS1RqlHJZQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-runtime/jest-snapshot/jest-matcher-utils": ["[email protected]", "", { "dependencies": { "@jest/get-type": "30.1.0", "chalk": "^4.1.2", "jest-diff": "30.3.0", "pretty-format": "30.3.0" } }, "sha512-HEtc9uFQgaUHkC7nLSlQL3Tph4Pjxt/yiPvkIrrDCt9jhoLIgxaubo1G+CFOnmHYMxHwwdaSN7mkIFs6ZK8OhA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-watcher/ansi-escapes/type-fest": ["[email protected]", "", {}, "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-worker/supports-color/has-flag": ["[email protected]", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],
-
"@mercurjs/integration-tests/jest/@jest/core/@jest/reporters/glob/jackspeak/@isaacs/cliui/string-width/emoji-regex": ["[email protected]", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="],
"@mercurjs/integration-tests/jest/@jest/core/@jest/reporters/glob/jackspeak/@isaacs/cliui/strip-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="],
@@ -5752,6 +5195,8 @@
"@mercurjs/integration-tests/jest/jest-cli/jest-config/@jest/test-sequencer/jest-haste-map/jest-worker/supports-color/has-flag": ["[email protected]", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],
+ "@mercurjs/integration-tests/jest/jest-cli/jest-config/babel-jest/@jest/transform/jest-haste-map/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
"@mercurjs/integration-tests/jest/jest-cli/jest-config/babel-jest/@jest/transform/jest-haste-map/jest-worker/supports-color": ["[email protected]", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="],
"@mercurjs/integration-tests/jest/jest-cli/jest-config/glob/jackspeak/@isaacs/cliui/string-width/emoji-regex": ["[email protected]", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="],
@@ -5770,48 +5215,6 @@
"@mercurjs/integration-tests/jest/jest-cli/jest-config/jest-runner/jest-runtime/@jest/globals/@jest/expect/expect": ["[email protected]", "", { "dependencies": { "@jest/expect-utils": "30.3.0", "@jest/get-type": "30.1.0", "jest-matcher-utils": "30.3.0", "jest-message-util": "30.3.0", "jest-mock": "30.3.0", "jest-util": "30.3.0" } }, "sha512-1zQrciTiQfRdo7qJM1uG4navm8DayFa2TgCSRlzUyNkhcJ6XUZF3hjnpkyr3VhAqPH7i/9GkG7Tv5abz6fqz0Q=="],
- "@mercurjs/registry/jest/@jest/core/@jest/reporters/glob/jackspeak/@isaacs/cliui/string-width/emoji-regex": ["[email protected]", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="],
-
- "@mercurjs/registry/jest/@jest/core/@jest/reporters/glob/jackspeak/@isaacs/cliui/strip-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="],
-
- "@mercurjs/registry/jest/@jest/core/@jest/reporters/glob/jackspeak/@isaacs/cliui/wrap-ansi/ansi-styles": ["[email protected]", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/glob/jackspeak/@isaacs/cliui/string-width/emoji-regex": ["[email protected]", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/glob/jackspeak/@isaacs/cliui/strip-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-config/glob/jackspeak/@isaacs/cliui/wrap-ansi/ansi-styles": ["[email protected]", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/@jest/globals/@jest/expect/expect/jest-matcher-utils/jest-diff": ["[email protected]", "", { "dependencies": { "@jest/diff-sequences": "30.3.0", "@jest/get-type": "30.1.0", "chalk": "^4.1.2", "pretty-format": "30.3.0" } }, "sha512-n3q4PDQjS4LrKxfWB3Z5KNk1XjXtZTBwQp71OP0Jo03Z6V60x++K5L8k6ZrW8MY8pOFylZvHM0zsjS1RqlHJZQ=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/glob/jackspeak/@isaacs/cliui/string-width/emoji-regex": ["[email protected]", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/glob/jackspeak/@isaacs/cliui/strip-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="],
-
- "@mercurjs/registry/jest/@jest/core/jest-runtime/glob/jackspeak/@isaacs/cliui/wrap-ansi/ansi-styles": ["[email protected]", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="],
-
- "@mercurjs/registry/jest/jest-cli/@jest/test-result/@jest/console/jest-message-util/pretty-format/@jest/schemas/@sinclair/typebox": ["@sinclair/[email protected]", "", {}, "sha512-kKJTNuK3AQOrgjjotVxMrCn1sUJwM76wMszfq1kdU4uYVJjvEWuFQ6HgvLt4Xz3fSmZlTOxJ/Ie13KnIcWQXFA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/@jest/test-sequencer/jest-haste-map/jest-worker/supports-color/has-flag": ["[email protected]", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/babel-jest/@jest/transform/jest-haste-map/jest-worker/supports-color": ["[email protected]", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/glob/jackspeak/@isaacs/cliui/string-width/emoji-regex": ["[email protected]", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/glob/jackspeak/@isaacs/cliui/strip-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/glob/jackspeak/@isaacs/cliui/wrap-ansi/ansi-styles": ["[email protected]", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-runtime/jest-haste-map/jest-worker/supports-color": ["[email protected]", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-snapshot/@jest/transform/jest-haste-map/jest-worker": ["[email protected]", "", { "dependencies": { "@types/node": "*", "@ungap/structured-clone": "^1.3.0", "jest-util": "30.3.0", "merge-stream": "^2.0.0", "supports-color": "^8.1.1" } }, "sha512-DrCKkaQwHexjRUFTmPzs7sHQe0TSj9nvDALKGdwmK5mW9v7j90BudWirKAJHt3QQ9Dhrg1F7DogPzhChppkJpQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-snapshot/@jest/transform/jest-haste-map/picomatch": ["[email protected]", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-resolve/jest-haste-map/jest-worker/supports-color/has-flag": ["[email protected]", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-runtime/@jest/globals/@jest/expect/expect": ["[email protected]", "", { "dependencies": { "@jest/expect-utils": "30.3.0", "@jest/get-type": "30.1.0", "jest-matcher-utils": "30.3.0", "jest-message-util": "30.3.0", "jest-mock": "30.3.0", "jest-util": "30.3.0" } }, "sha512-1zQrciTiQfRdo7qJM1uG4navm8DayFa2TgCSRlzUyNkhcJ6XUZF3hjnpkyr3VhAqPH7i/9GkG7Tv5abz6fqz0Q=="],
-
"@mercurjs/integration-tests/jest/jest-cli/jest-config/babel-jest/@jest/transform/jest-haste-map/jest-worker/supports-color/has-flag": ["[email protected]", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],
"@mercurjs/integration-tests/jest/jest-cli/jest-config/jest-circus/jest-runtime/jest-haste-map/jest-worker/supports-color/has-flag": ["[email protected]", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],
@@ -5822,22 +5225,8 @@
"@mercurjs/integration-tests/jest/jest-cli/jest-config/jest-runner/jest-runtime/@jest/globals/@jest/expect/expect/jest-matcher-utils": ["[email protected]", "", { "dependencies": { "@jest/get-type": "30.1.0", "chalk": "^4.1.2", "jest-diff": "30.3.0", "pretty-format": "30.3.0" } }, "sha512-HEtc9uFQgaUHkC7nLSlQL3Tph4Pjxt/yiPvkIrrDCt9jhoLIgxaubo1G+CFOnmHYMxHwwdaSN7mkIFs6ZK8OhA=="],
- "@mercurjs/registry/jest/jest-cli/jest-config/babel-jest/@jest/transform/jest-haste-map/jest-worker/supports-color/has-flag": ["[email protected]", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-runtime/jest-haste-map/jest-worker/supports-color/has-flag": ["[email protected]", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-snapshot/@jest/transform/jest-haste-map/jest-worker/supports-color": ["[email protected]", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-runtime/@jest/globals/@jest/expect/expect/@jest/expect-utils": ["@jest/[email protected]", "", { "dependencies": { "@jest/get-type": "30.1.0" } }, "sha512-j0+W5iQQ8hBh7tHZkTQv3q2Fh/M7Je72cIsYqC4OaktgtO7v1So9UTjp6uPBHIaB6beoF/RRsCgMJKvti0wADA=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-runtime/@jest/globals/@jest/expect/expect/jest-matcher-utils": ["[email protected]", "", { "dependencies": { "@jest/get-type": "30.1.0", "chalk": "^4.1.2", "jest-diff": "30.3.0", "pretty-format": "30.3.0" } }, "sha512-HEtc9uFQgaUHkC7nLSlQL3Tph4Pjxt/yiPvkIrrDCt9jhoLIgxaubo1G+CFOnmHYMxHwwdaSN7mkIFs6ZK8OhA=="],
-
"@mercurjs/integration-tests/jest/jest-cli/jest-config/jest-circus/jest-snapshot/@jest/transform/jest-haste-map/jest-worker/supports-color/has-flag": ["[email protected]", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],
"@mercurjs/integration-tests/jest/jest-cli/jest-config/jest-runner/jest-runtime/@jest/globals/@jest/expect/expect/jest-matcher-utils/jest-diff": ["[email protected]", "", { "dependencies": { "@jest/diff-sequences": "30.3.0", "@jest/get-type": "30.1.0", "chalk": "^4.1.2", "pretty-format": "30.3.0" } }, "sha512-n3q4PDQjS4LrKxfWB3Z5KNk1XjXtZTBwQp71OP0Jo03Z6V60x++K5L8k6ZrW8MY8pOFylZvHM0zsjS1RqlHJZQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-circus/jest-snapshot/@jest/transform/jest-haste-map/jest-worker/supports-color/has-flag": ["[email protected]", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],
-
- "@mercurjs/registry/jest/jest-cli/jest-config/jest-runner/jest-runtime/@jest/globals/@jest/expect/expect/jest-matcher-utils/jest-diff": ["[email protected]", "", { "dependencies": { "@jest/diff-sequences": "30.3.0", "@jest/get-type": "30.1.0", "chalk": "^4.1.2", "pretty-format": "30.3.0" } }, "sha512-n3q4PDQjS4LrKxfWB3Z5KNk1XjXtZTBwQp71OP0Jo03Z6V60x++K5L8k6ZrW8MY8pOFylZvHM0zsjS1RqlHJZQ=="],
}
}
diff --git a/packages/admin/src/components/layout/settings-layout/settings-layout.tsx b/packages/admin/src/components/layout/settings-layout/settings-layout.tsx
index 07154b9d4..95000cd60 100644
--- a/packages/admin/src/components/layout/settings-layout/settings-layout.tsx
+++ b/packages/admin/src/components/layout/settings-layout/settings-layout.tsx
@@ -77,6 +77,10 @@ const useSettingRoutes = (): INavItem[] => {
label: t("productTags.domain"),
to: "/settings/product-tags",
},
+ {
+ label: t("attributes.domain"),
+ to: "/settings/attributes",
+ },
{
label: t("stockLocations.domain"),
to: "/settings/locations",
diff --git a/packages/admin/src/get-route-map.tsx b/packages/admin/src/get-route-map.tsx
index 07a228b3b..960517b9b 100644
--- a/packages/admin/src/get-route-map.tsx
+++ b/packages/admin/src/get-route-map.tsx
@@ -1590,6 +1590,79 @@ export function getRouteMap({
},
],
},
+ {
+ path: "attributes",
+ errorElement: <ErrorBoundary />,
+ element: <Outlet />,
+ handle: {
+ breadcrumb: () => t("attributes.domain"),
+ },
+ children: [
+ {
+ path: "",
+ lazy: () => import("./pages/attributes/attribute-list"),
+ children: [
+ {
+ path: "create",
+ lazy: () =>
+ import("./pages/attributes/attribute-create"),
+ },
+ ],
+ },
+ {
+ path: ":id",
+ lazy: async () => {
+ const { Breadcrumb, loader } =
+ await import("./pages/attributes/attribute-detail");
+
+ return {
+ Component: Outlet,
+ loader,
+ handle: {
+ breadcrumb: (
+ match: UIMatch,
+ ) => <Breadcrumb {...match} />,
+ },
+ };
+ },
+ children: [
+ {
+ path: "",
+ lazy: () =>
+ import("./pages/attributes/attribute-detail"),
+ children: [
+ {
+ path: "edit",
+ lazy: () =>
+ import("./pages/attributes/attribute-edit"),
+ },
+ {
+ path: "edit-possible-value",
+ lazy: () =>
+ import(
+ "./pages/attributes/attribute-edit-possible-value"
+ ),
+ },
+ {
+ path: "create-possible-value",
+ lazy: () =>
+ import(
+ "./pages/attributes/attribute-create-possible-value"
+ ),
+ },
+ {
+ path: "edit-ranking",
+ lazy: () =>
+ import(
+ "./pages/attributes/attribute-edit-ranking"
+ ),
+ },
+ ],
+ },
+ ],
+ },
+ ],
+ },
{
path: "product-types",
errorElement: <ErrorBoundary />,
diff --git a/packages/admin/src/hooks/api/attributes.ts b/packages/admin/src/hooks/api/attributes.ts
new file mode 100644
index 000000000..47ea58d6d
--- /dev/null
+++ b/packages/admin/src/hooks/api/attributes.ts
@@ -0,0 +1,164 @@
+import { ClientError } from "@mercurjs/client"
+import {
+ UseMutationOptions,
+ UseQueryOptions,
+ useMutation,
+ useQuery,
+} from "@tanstack/react-query"
+import { sdk } from "../../lib/client"
+import { queryClient } from "../../lib/query-client"
+import { queryKeysFactory } from "../../lib/query-key-factory"
+
+const ATTRIBUTES_QUERY_KEY = "attributes" as const
+export const attributesQueryKeys = queryKeysFactory(ATTRIBUTES_QUERY_KEY)
+
+export const useAttribute = (
+ id: string,
+ query?: Record<string, any>,
+ options?: Omit<
+ UseQueryOptions<
+ { attribute: Record<string, any> },
+ ClientError
+ >,
+ "queryFn" | "queryKey"
+ >
+) => {
+ const { data, ...rest } = useQuery({
+ queryKey: attributesQueryKeys.detail(id, query),
+ queryFn: async () =>
+ sdk.admin.attributes.$id.query({ $id: id, ...query }) as Promise<{
+ attribute: Record<string, any>
+ }>,
+ ...options,
+ })
+
+ return { ...data, ...rest }
+}
+
+export const useAttributes = (
+ query?: Record<string, any>,
+ options?: Omit<
+ UseQueryOptions<
+ { attributes: Record<string, any>[]; count: number },
+ ClientError
+ >,
+ "queryFn" | "queryKey"
+ >
+) => {
+ const { data, ...rest } = useQuery({
+ queryKey: attributesQueryKeys.list(query),
+ queryFn: async () =>
+ sdk.admin.attributes.query({ ...query }) as Promise<{
+ attributes: Record<string, any>[]
+ count: number
+ }>,
+ ...options,
+ })
+
+ return { ...data, ...rest }
+}
+
+export const useCreateAttribute = (
+ options?: UseMutationOptions<any, ClientError, Record<string, any>>
+) => {
+ return useMutation({
+ mutationFn: (payload: Record<string, any>) =>
+ sdk.admin.attributes.mutate(payload as any),
+ onSuccess: (data, variables, context) => {
+ queryClient.invalidateQueries({
+ queryKey: attributesQueryKeys.lists(),
+ })
+
+ options?.onSuccess?.(data, variables, context)
+ },
+ ...options,
+ })
+}
+
+export const useUpdateAttribute = (
+ id: string,
+ options?: UseMutationOptions<any, ClientError, Record<string, any>>
+) => {
+ return useMutation({
+ mutationFn: (payload: Record<string, any>) =>
+ sdk.admin.attributes.$id.mutate({ $id: id, ...payload }),
+ onSuccess: (data, variables, context) => {
+ queryClient.invalidateQueries({
+ queryKey: attributesQueryKeys.lists(),
+ })
+ queryClient.invalidateQueries({
+ queryKey: attributesQueryKeys.detail(id),
+ })
+
+ options?.onSuccess?.(data, variables, context)
+ },
+ ...options,
+ })
+}
+
+export const useDeleteAttribute = (
+ id: string,
+ options?: UseMutationOptions<any, ClientError, void>
+) => {
+ return useMutation({
+ mutationFn: () => sdk.admin.attributes.$id.delete({ $id: id }),
+ onSuccess: (data, variables, context) => {
+ queryClient.invalidateQueries({
+ queryKey: attributesQueryKeys.lists(),
+ })
+ queryClient.invalidateQueries({
+ queryKey: attributesQueryKeys.detail(id),
+ })
+
+ options?.onSuccess?.(data, variables, context)
+ },
+ ...options,
+ })
+}
+
+export const useCreateAttributePossibleValue = (
+ attributeId: string,
+ options?: UseMutationOptions<any, ClientError, Record<string, any>>
+) => {
+ return useMutation({
+ mutationFn: (payload: Record<string, any>) =>
+ sdk.admin.attributes.$id.values.mutate({
+ $id: attributeId,
+ ...payload,
+ } as any),
+ onSuccess: (data, variables, context) => {
+ queryClient.invalidateQueries({
+ queryKey: attributesQueryKeys.detail(attributeId),
+ })
+ queryClient.invalidateQueries({
+ queryKey: attributesQueryKeys.lists(),
+ })
+
+ options?.onSuccess?.(data, variables, context)
+ },
+ ...options,
+ })
+}
+
+export const useUpdateAttributePossibleValue = (
+ attributeId: string,
+ valueId: string,
+ options?: UseMutationOptions<any, ClientError, Record<string, any>>
+) => {
+ return useMutation({
+ mutationFn: (payload: Record<string, any>) =>
+ sdk.admin.attributes.$id.values.$valueId.mutate({
+ $id: attributeId,
+ $valueId: valueId,
+ ...payload,
+ }),
+ onSuccess: (data, variables, context) => {
+ queryClient.invalidateQueries({
+ queryKey: attributesQueryKeys.detail(attributeId),
+ })
+
+ options?.onSuccess?.(data, variables, context)
+ },
+ ...options,
+ })
+}
diff --git a/packages/admin/src/hooks/api/index.ts b/packages/admin/src/hooks/api/index.ts
index 4bc43903c..28c930cd1 100644
--- a/packages/admin/src/hooks/api/index.ts
+++ b/packages/admin/src/hooks/api/index.ts
@@ -1,4 +1,5 @@
export * from "./api-keys";
+export * from "./attributes";
export * from "./auth";
export * from "./campaigns";
export * from "./categories";
diff --git a/packages/admin/src/hooks/table/columns/use-attribute-table-columns.tsx b/packages/admin/src/hooks/table/columns/use-attribute-table-columns.tsx
index 2570c66f9..7e840a50e 100644
--- a/packages/admin/src/hooks/table/columns/use-attribute-table-columns.tsx
+++ b/packages/admin/src/hooks/table/columns/use-attribute-table-columns.tsx
@@ -1,328 +1,315 @@
-import { useMemo, useState } from "react";
-
-import { EllipsisHorizontal, PencilSquare, Trash } from "@medusajs/icons";
+import { createColumnHelper } from "@tanstack/react-table"
+import { useMemo, useState } from "react"
+import { createPortal } from "react-dom"
+import { useTranslation } from "react-i18next"
import {
Badge,
- DropdownMenu,
- IconButton,
+ Button,
+ Heading,
+ Prompt,
Switch,
- createDataTableColumnHelper,
+ Text,
toast,
usePrompt,
-} from "@medusajs/ui";
+} from "@medusajs/ui"
+import { PencilSquare, Trash } from "@medusajs/icons"
+import { TextCell } from "../../../components/table/table-cells/common/text-cell"
+import { ActionMenu } from "../../../components/common/action-menu"
+import { Combobox } from "../../../components/inputs/combobox"
+import {
+ useDeleteAttribute,
+ useUpdateAttribute,
+} from "../../../hooks/api/attributes"
+import { useProductCategories } from "../../../hooks/api"
-import { useQueryClient } from "@tanstack/react-query";
-import { useNavigate } from "react-router-dom";
+const MAX_VISIBLE_VALUES = 2
-import type { AttributeDTO } from "@custom-types/attribute";
+// --- Filterable Toggle ---
-import { attributeQueryKeys } from "@/hooks/api/attributes";
-import { sdk } from "@/lib/client";
-import { CategorySelectionModal } from "@/pages/attributes/attribute-list/components/CategorySelectionModal";
+const FilterableToggle = ({ attribute }: { attribute: Record<string, any> }) => {
+ const { mutateAsync } = useUpdateAttribute(attribute.id)
-const columnHelper = createDataTableColumnHelper<AttributeDTO>();
+ const handleToggle = async (checked: boolean) => {
+ try {
+ await mutateAsync({ is_filterable: checked })
+ } catch (err: any) {
+ toast.error(err.message)
+ }
+ }
-export const useAttributeTableColumns = () => {
- const navigate = useNavigate();
- const queryClient = useQueryClient();
- const prompt = usePrompt();
+ return (
+ <div onClick={(e) => { e.preventDefault(); e.stopPropagation() }}>
+ <Switch
+ checked={!!attribute.is_filterable}
+ onCheckedChange={handleToggle}
+ size="small"
+ />
+ </div>
+ )
+}
- const [isCategoryModalOpen, setIsCategoryModalOpen] = useState(false);
- const [currentAttribute, setCurrentAttribute] = useState<AttributeDTO | null>(
- null,
- );
+// --- Global Toggle with Category Modal ---
- const handleEdit = (attributeId: string) => {
- navigate(`/settings/attributes/${attributeId}/edit`);
- };
+const GlobalToggle = ({ attribute }: { attribute: Record<string, any> }) => {
+ const { t } = useTranslation()
+ const { mutateAsync } = useUpdateAttribute(attribute.id)
+ const [categoryModalOpen, setCategoryModalOpen] = useState(false)
+ const [selectedCategoryIds, setSelectedCategoryIds] = useState<string[]>([])
- const handleToggleFilterable = async (
- attributeId: string,
- currentValue: boolean,
- attribute: AttributeDTO,
- ) => {
- try {
- await sdk.client.fetch(`/admin/attributes/${attributeId}`, {
- method: "POST",
- body: {
- name: attribute.name,
- description: attribute.description,
- handle: attribute.handle,
- is_filterable: !currentValue,
- is_required: attribute.is_required,
- ui_component: attribute.ui_component,
- // metadata: {},
- product_category_ids: attribute.product_categories?.map(
- (category) => category.id,
- ),
- possible_values: attribute.possible_values?.map((value) => ({
- id: value.id,
- value: value.value,
- rank: value.rank,
- metadata: value.metadata,
- })),
- },
- });
+ const categories = attribute.product_categories ?? []
+ const isGlobal = !categories.length
- queryClient.invalidateQueries({ queryKey: attributeQueryKeys.lists() });
- toast.success("Attribute updated!");
- } catch (error) {
- toast.error((error as Error).message);
- }
- };
+ const { product_categories: allCategories } = useProductCategories({
+ limit: 999,
+ })
- const handleToggleGlobal = async (
- attributeId: string,
- newValue: boolean,
- attribute: AttributeDTO,
- ) => {
- const isCurrentlyGlobal = !attribute.product_categories?.length;
+ const categoryOptions = (allCategories ?? []).map((cat: any) => ({
+ label: cat.name,
+ value: cat.id,
+ }))
- if (isCurrentlyGlobal && !newValue) {
- setCurrentAttribute(attribute);
- setIsCategoryModalOpen(true);
+ const handleToggle = async (checked: boolean) => {
+ if (checked) {
+ // Turning ON global — remove category assignments
+ try {
+ await mutateAsync({ product_category_ids: [] })
+ } catch (err: any) {
+ toast.error(err.message)
+ }
+ } else {
+ // Turning OFF global — need to pick categories
+ setSelectedCategoryIds(categories.map((c: any) => c.id))
+ setCategoryModalOpen(true)
+ }
+ }
- return;
+ const handleSaveCategory = async () => {
+ if (!selectedCategoryIds.length) return
+
+ try {
+ await mutateAsync({
+ product_category_ids: selectedCategoryIds,
+ })
+ setCategoryModalOpen(false)
+ setSelectedCategoryIds([])
+ } catch (err: any) {
+ toast.error(err.message)
}
+ }
- if (!isCurrentlyGlobal && newValue) {
- try {
- await sdk.client.fetch(`/admin/attributes/${attributeId}`, {
- method: "POST",
- body: {
- name: attribute.name,
- description: attribute.description,
- handle: attribute.handle,
- is_filterable: attribute.is_filterable,
- is_required: attribute.is_required,
- ui_component: attribute.ui_component,
- product_category_ids: [],
- possible_values: attribute.possible_values?.map((value) => ({
- id: value.id,
- value: value.value,
- rank: value.rank,
- metadata: value.metadata ?? {},
- })),
- },
- });
+ return (
+ <>
+ <div onClick={(e) => { e.preventDefault(); e.stopPropagation() }}>
+ <Switch
+ checked={isGlobal}
+ onCheckedChange={handleToggle}
+ size="small"
+ />
+ </div>
+ {categoryModalOpen &&
+ createPortal(
+ <div
+ className="fixed inset-0 z-50 flex items-center justify-center"
+ onClick={(e) => {
+ e.preventDefault()
+ e.stopPropagation()
+ }}
+ >
+ <div
+ className="bg-ui-bg-overlay fixed inset-0"
+ onClick={(e) => {
+ e.preventDefault()
+ e.stopPropagation()
+ }}
+ />
+ <div className="bg-ui-bg-base shadow-elevation-flyout relative flex w-full max-w-[400px] flex-col rounded-lg border">
+ <div className="flex flex-col gap-y-1 px-6 pt-6">
+ <Heading level="h2">
+ {t("attributes.selectCategory.title")}
+ </Heading>
+ <Text size="small" className="text-ui-fg-subtle">
+ {t("attributes.selectCategory.description")}
+ </Text>
+ </div>
+ <div className="px-6 py-4">
+ <Combobox
+ options={categoryOptions}
+ value={selectedCategoryIds}
+ onChange={(val) => setSelectedCategoryIds(val as string[])}
+ />
+ </div>
+ <div className="flex items-center justify-end gap-x-2 p-6">
+ <Button
+ variant="secondary"
+ size="small"
+ onClick={() => {
+ setCategoryModalOpen(false)
+ setSelectedCategoryIds([])
+ }}
+ >
+ {t("actions.cancel")}
+ </Button>
+ <Button
+ size="small"
+ disabled={!selectedCategoryIds.length}
+ onClick={() => handleSaveCategory()}
+ >
+ {t("actions.save")}
+ </Button>
+ </div>
+ </div>
+ </div>,
+ document.body
+ )}
+ </>
+ )
+}
- queryClient.invalidateQueries({ queryKey: attributeQueryKeys.lists() });
- queryClient.invalidateQueries({
- queryKey: attributeQueryKeys.detail(attributeId),
- });
- toast.success("Attribute updated!");
- } catch (error) {
- toast.error((error as Error).message);
- }
+// --- Delete Actions ---
- return;
- }
- };
+const AttributeActions = ({
+ attribute,
+}: {
+ attribute: Record<string, any>
+}) => {
+ const { t } = useTranslation()
+ const prompt = usePrompt()
+ const { mutateAsync } = useDeleteAttribute(attribute.id)
+ const [inUseOpen, setInUseOpen] = useState(false)
+
+ const handleDelete = async () => {
+ const res = await prompt({
+ title: t("general.areYouSure"),
+ description: t("attributes.delete.confirmation", {
+ name: attribute.name,
+ }),
+ confirmText: t("actions.delete"),
+ cancelText: t("actions.cancel"),
+ })
- const handleCategorySelection = async (selectedCategories: string[]) => {
- if (!currentAttribute) return;
+ if (!res) return
try {
- await sdk.client.fetch(`/admin/attributes/${currentAttribute.id}`, {
- method: "POST",
- body: {
- name: currentAttribute.name,
- description: currentAttribute.description,
- handle: currentAttribute.handle,
- is_filterable: currentAttribute.is_filterable,
- is_required: currentAttribute.is_required,
- ui_component: currentAttribute.ui_component,
- product_category_ids: selectedCategories,
- possible_values: currentAttribute.possible_values?.map((value) => ({
- id: value.id,
- value: value.value,
- rank: value.rank,
- metadata: value.metadata,
- })),
- },
- });
+ await mutateAsync(undefined)
+ toast.success(
+ t("attributes.delete.successToast", { name: attribute.name })
+ )
+ } catch (err: any) {
+ const isInUse = err.message?.includes("can't be deleted")
- queryClient.invalidateQueries({ queryKey: attributeQueryKeys.lists() });
- queryClient.invalidateQueries({
- queryKey: attributeQueryKeys.detail(currentAttribute.id),
- });
- toast.success("Attribute updated!");
- } catch (error) {
- toast.error((error as Error).message);
- } finally {
- setCurrentAttribute(null);
- setIsCategoryModalOpen(false);
+ if (isInUse) {
+ setInUseOpen(true)
+ } else {
+ toast.error(err.message)
+ }
}
- };
+ }
+
+ return (
+ <>
+ <ActionMenu
+ groups={[
+ {
+ actions: [
+ {
+ label: t("actions.edit"),
+ to: `${attribute.id}/edit`,
+ icon: <PencilSquare />,
+ },
+ ],
+ },
+ {
+ actions: [
+ {
+ label: t("actions.delete"),
+ onClick: handleDelete,
+ icon: <Trash />,
+ },
+ ],
+ },
+ ]}
+ />
+ {createPortal(
+ <Prompt open={inUseOpen} variant="confirmation">
+ <Prompt.Content>
+ <Prompt.Header>
+ <Prompt.Title>{t("attributes.delete.title")}</Prompt.Title>
+ <Prompt.Description>
+ {t("attributes.delete.inUseMessage", {
+ name: attribute.name,
+ })}
+ </Prompt.Description>
+ </Prompt.Header>
+ <Prompt.Footer>
+ <Prompt.Action onClick={() => setInUseOpen(false)}>
+ {t("attributes.delete.gotIt")}
+ </Prompt.Action>
+ </Prompt.Footer>
+ </Prompt.Content>
+ </Prompt>,
+ document.body
+ )}
+ </>
+ )
+}
- const handleDelete = async (attributeId: string, attributeName: string) => {
- const confirmed = await prompt({
- title: "Delete Attribute",
- description: `You are about to delete attribute ${attributeName}. This action cannot be undone.`,
- confirmText: "Delete",
- cancelText: "Cancel",
- });
+// --- Columns ---
- if (!confirmed) {
- return;
- }
+const columnHelper = createColumnHelper<any>()
- try {
- await sdk.client.fetch(`/admin/attributes/${attributeId}`, {
- method: "DELETE",
- });
- toast.success("Attribute deleted!");
- queryClient.invalidateQueries({ queryKey: attributeQueryKeys.lists() });
- } catch (error) {
- toast.error((error as Error).message);
- }
- };
+export const useAttributeTableColumns = () => {
+ const { t } = useTranslation()
- const columns = useMemo(
+ return useMemo(
() => [
columnHelper.accessor("name", {
- header: "Name",
+ header: () => t("attributes.fields.productAttribute"),
+ cell: ({ getValue }) => <TextCell text={getValue()} />,
}),
columnHelper.accessor("handle", {
- header: "Handle",
+ header: () => t("attributes.fields.handle"),
+ cell: ({ getValue }) => <TextCell text={getValue() || "-"} />,
}),
columnHelper.accessor("is_filterable", {
- header: "Filterable",
- cell: (info) => {
- const attribute = info.row.original;
-
- return (
- <div onClick={(e) => e.stopPropagation()}>
- <Switch
- checked={info.getValue()}
- onCheckedChange={() =>
- handleToggleFilterable(
- attribute.id,
- info.getValue(),
- attribute,
- )
- }
- data-testid={`attribute-list-filterable-switch-${attribute.id}`}
- />
- </div>
- );
- },
+ header: () => t("attributes.fields.filterable"),
+ cell: ({ row }) => <FilterableToggle attribute={row.original} />,
}),
- columnHelper.accessor("product_categories", {
- header: "Global",
- cell: (info) => {
- const attribute = info.row.original;
- const isGlobal = !info.getValue()?.length;
-
- return (
- <Switch
- checked={isGlobal}
- onCheckedChange={(newValue) =>
- handleToggleGlobal(attribute.id, newValue, attribute)
- }
- onClick={(e) => e.stopPropagation()}
- data-testid={`attribute-list-global-switch-${attribute.id}`}
- />
- );
- },
+ columnHelper.display({
+ id: "is_global",
+ header: () => t("attributes.fields.global"),
+ cell: ({ row }) => <GlobalToggle attribute={row.original} />,
}),
- columnHelper.accessor("possible_values", {
- header: "Possible Values",
- cell: (info) => {
- const values = info.getValue();
- if (!values || values.length === 0) {
- return "-";
- }
-
- if (values.length <= 3) {
- return (
- <div className="flex flex-wrap gap-2">
- {values.map((value) => (
- <Badge size="xsmall" key={value.id}>
- {value.value}
- </Badge>
- ))}
- </div>
- );
+ columnHelper.display({
+ id: "values",
+ header: () => t("attributes.fields.values"),
+ cell: ({ row }) => {
+ const values = row.original.possible_values ?? []
+ if (!values.length) {
+ return <span className="text-ui-fg-muted">-</span>
}
-
- const remainingCount = values.length - 2;
-
+ const visible = values.slice(0, MAX_VISIBLE_VALUES)
+ const remaining = values.length - MAX_VISIBLE_VALUES
return (
- <div className="flex flex-wrap gap-2">
- {values.slice(0, 2).map((value) => (
- <Badge size="xsmall" key={value.id}>
- {value.value}
+ <div className="flex items-center gap-x-1">
+ {visible.map((v: any) => (
+ <Badge key={v.id} size="2xsmall" color="grey">
+ {v.value}
</Badge>
))}
- <Badge size="xsmall" color="grey">
- +{remainingCount}
- </Badge>
+ {remaining > 0 && (
+ <Badge size="2xsmall" color="grey">
+ +{remaining}
+ </Badge>
+ )}
</div>
- );
+ )
},
}),
columnHelper.display({
id: "actions",
- header: "",
- cell: (info) => {
- const attribute = info.row.original;
-
- return (
- <div className="flex items-center justify-end">
- <DropdownMenu>
- <DropdownMenu.Trigger asChild>
- <IconButton
- variant="transparent"
- size="small"
- data-testid={`attribute-list-row-action-menu-trigger-${attribute.id}`}
- >
- <EllipsisHorizontal />
- </IconButton>
- </DropdownMenu.Trigger>
- <DropdownMenu.Content
- align="end"
- data-testid={`attribute-list-row-action-menu-${attribute.id}`}
- >
- <DropdownMenu.Item
- onClick={(e) => {
- (e.stopPropagation(), handleEdit(attribute.id));
- }}
- data-testid={`attribute-list-row-edit-action-${attribute.id}`}
- >
- <span className="flex items-center gap-2">
- <PencilSquare /> Edit
- </span>
- </DropdownMenu.Item>
- <DropdownMenu.Item
- onClick={(e) => {
- (e.stopPropagation(),
- handleDelete(attribute.id, attribute.name));
- }}
- data-testid={`attribute-list-row-delete-action-${attribute.id}`}
- >
- <span className="flex items-center gap-2">
- <Trash /> Delete
- </span>
- </DropdownMenu.Item>
- </DropdownMenu.Content>
- </DropdownMenu>
- </div>
- );
- },
+ cell: ({ row }) => <AttributeActions attribute={row.original} />,
}),
],
- [navigate, queryClient, prompt, handleToggleFilterable, handleToggleGlobal],
- );
-
- return {
- columns,
- modal: (
- <CategorySelectionModal
- open={isCategoryModalOpen}
- onOpenChange={setIsCategoryModalOpen}
- onConfirm={handleCategorySelection}
- />
- ),
- };
-};
+ [t]
+ )
+}
diff --git a/packages/admin/src/hooks/table/filters/index.ts b/packages/admin/src/hooks/table/filters/index.ts
index c07f37a5f..f826b741b 100644
--- a/packages/admin/src/hooks/table/filters/index.ts
+++ b/packages/admin/src/hooks/table/filters/index.ts
@@ -11,3 +11,4 @@ export * from "./use-seller-table-filters"
export * from "./use-region-table-filters"
export * from "./use-shipping-option-table-filters"
export * from "./use-tax-rate-table-filters"
+export * from "./use-attribute-table-filters"
diff --git a/packages/admin/src/hooks/table/filters/use-attribute-table-filters.tsx b/packages/admin/src/hooks/table/filters/use-attribute-table-filters.tsx
new file mode 100644
index 000000000..b83d458f8
--- /dev/null
+++ b/packages/admin/src/hooks/table/filters/use-attribute-table-filters.tsx
@@ -0,0 +1,33 @@
+import { useTranslation } from "react-i18next"
+import { Filter } from "../../../components/table/data-table"
+
+export const useAttributeTableFilters = () => {
+ const { t } = useTranslation()
+
+ const filterableFilter: Filter = {
+ key: "is_filterable",
+ label: t("attributes.fields.filterable"),
+ type: "select",
+ options: [
+ {
+ label: t("filters.radio.yes"),
+ value: "true",
+ },
+ {
+ label: t("filters.radio.no"),
+ value: "false",
+ },
+ ],
+ }
+
+ const dateFilters: Filter[] = [
+ { label: t("fields.createdAt"), key: "created_at" },
+ { label: t("fields.updatedAt"), key: "updated_at" },
+ ].map((f) => ({
+ key: f.key,
+ label: f.label,
+ type: "date" as const,
+ }))
+
+ return [filterableFilter, ...dateFilters]
+}
diff --git a/packages/admin/src/hooks/table/query/index.ts b/packages/admin/src/hooks/table/query/index.ts
index 63c71d7a6..6e0dfd3b5 100644
--- a/packages/admin/src/hooks/table/query/index.ts
+++ b/packages/admin/src/hooks/table/query/index.ts
@@ -16,3 +16,4 @@ export * from "./use-user-invite-table-query";
export * from "./use-seller-orders-table-query";
export * from "./use-payout-table-query"
export * from "./use-sellers-table-query";
+export * from "./use-attribute-table-query";
diff --git a/packages/admin/src/hooks/table/query/use-attribute-table-query.tsx b/packages/admin/src/hooks/table/query/use-attribute-table-query.tsx
new file mode 100644
index 000000000..516733c6e
--- /dev/null
+++ b/packages/admin/src/hooks/table/query/use-attribute-table-query.tsx
@@ -0,0 +1,36 @@
+import { useQueryParams } from "../../use-query-params"
+
+type UseAttributeTableQueryProps = {
+ prefix?: string
+ pageSize?: number
+}
+
+export const useAttributeTableQuery = ({
+ prefix,
+ pageSize = 20,
+}: UseAttributeTableQueryProps) => {
+ const queryObject = useQueryParams(
+ ["offset", "q", "order", "created_at", "updated_at", "is_filterable"],
+ prefix
+ )
+
+ const { offset, q, order, created_at, updated_at, is_filterable } =
+ queryObject
+
+ const searchParams: Record<string, any> = {
+ limit: pageSize,
+ offset: offset ? Number(offset) : 0,
+ order,
+ created_at: created_at ? JSON.parse(created_at) : undefined,
+ updated_at: updated_at ? JSON.parse(updated_at) : undefined,
+ is_filterable:
+ is_filterable !== undefined ? is_filterable === "true" : undefined,
+ q,
+ fields: "*possible_values,*product_categories",
+ }
+
+ return {
+ searchParams,
+ raw: queryObject,
+ }
+}
diff --git a/packages/admin/src/i18n/translations/en.json b/packages/admin/src/i18n/translations/en.json
index f4942efa9..8fd7e681f 100644
--- a/packages/admin/src/i18n/translations/en.json
+++ b/packages/admin/src/i18n/translations/en.json
@@ -2748,6 +2748,92 @@
"createdByLabel": "Created by"
}
},
+ "attributes": {
+ "domain": "Product Attributes",
+ "subtitle": "Manage product attributes and their possible values.",
+ "list": {
+ "title": "Product Attributes",
+ "noRecordsMessage": "No product attributes have been created yet."
+ },
+ "create": {
+ "header": "Create Attribute",
+ "subtitle": "Define a new product attribute.",
+ "tabs": {
+ "details": "Details",
+ "type": "Type"
+ },
+ "fillNameWarning": "Please fill in at least the name field before proceeding to Type configuration.",
+ "possibleValuesRequired": "At least one possible value is required for this type",
+ "successToast": "Attribute \"{{name}}\" was successfully created."
+ },
+ "edit": {
+ "header": "Edit Attribute",
+ "subtitle": "Update attribute details.",
+ "successToast": "Attribute \"{{name}}\" was successfully updated."
+ },
+ "editPossibleValue": {
+ "header": "Edit Possible Value",
+ "subtitle": "Update the possible value details.",
+ "successToast": "Possible value \"{{value}}\" was successfully updated."
+ },
+ "createPossibleValues": {
+ "header": "Create values",
+ "subtitle": "Create additional values to \"{{name}}\" attribute.",
+ "tabs": {
+ "values": "Values",
+ "organizeRanking": "Organize Ranking"
+ },
+ "addValue": "Add value",
+ "enterValue": "Enter value",
+ "successToast": "Values were successfully created."
+ },
+ "deletePossibleValue": {
+ "title": "Delete value",
+ "confirmation": "You are about to delete the possible value \"{{value}}\". This action cannot be undone.",
+ "successToast": "Possible value \"{{value}}\" was successfully deleted.",
+ "inUseMessage": "Value {{value}} can't be deleted because it's currently used by one or more Vendors in their product variants. To edit it, ask the Vendors to update their products first."
+ },
+ "delete": {
+ "title": "Delete attribute",
+ "confirmation": "You are about to delete the attribute \"{{name}}\". This action cannot be undone.",
+ "successToast": "Attribute \"{{name}}\" was successfully deleted.",
+ "inUseMessage": "Attribute {{name}} can't be deleted because it's currently used by one or more Vendors in their product variants. To delete it, ask the Vendors to update their products first.",
+ "gotIt": "Got it"
+ },
+ "fields": {
+ "name": "Name",
+ "handle": "Handle",
+ "description": "Description",
+ "type": "Type",
+ "filterable": "Filterable",
+ "required": "Required",
+ "global": "Global",
+ "category": "Category",
+ "categories": "Product Categories",
+ "productAttribute": "Product Attribute",
+ "values": "Values",
+ "possibleValues": "Possible Values",
+ "value": "Value",
+ "rank": "Rank",
+ "metadata": "Metadata"
+ },
+ "type": {
+ "select": "Single Select",
+ "multivalue": "Multi Select",
+ "unit": "Unit",
+ "toggle": "Toggle",
+ "text_area": "Text Area"
+ },
+ "selectCategory": {
+ "title": "Select category",
+ "description": "Please select the category where this attribute applies.",
+ "placeholder": "Select category"
+ },
+ "hints": {
+ "global": "When enabled, this attribute applies to all products regardless of category.",
+ "categoryInheritance": "Child categories will inherit this attribute."
+ }
+ },
"returnReasons": {
"domain": "Return Reasons",
"subtitle": "Manage reasons for returned items.",
@@ -3211,13 +3297,6 @@
}
}
},
- "attributes": {
- "domain": "Product Attributes",
- "create": {
- "fillNameWarning": "Please fill in at least the name field before proceeding to Type configuration.",
- "possibleValuesRequired": "At least one possible value is required for this type"
- }
- },
"requests": {
"domain": "Requests",
"seller": "Seller",
diff --git a/packages/admin/src/pages/attributes/attribute-create-possible-value/attribute-create-possible-value.tsx b/packages/admin/src/pages/attributes/attribute-create-possible-value/attribute-create-possible-value.tsx
new file mode 100644
index 000000000..2ce4b2382
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-create-possible-value/attribute-create-possible-value.tsx
@@ -0,0 +1,495 @@
+import { useState } from "react"
+import {
+ DndContext,
+ closestCenter,
+ KeyboardSensor,
+ PointerSensor,
+ useSensor,
+ useSensors,
+ type DragEndEvent,
+} from "@dnd-kit/core"
+import {
+ arrayMove,
+ SortableContext,
+ sortableKeyboardCoordinates,
+ useSortable,
+ verticalListSortingStrategy,
+} from "@dnd-kit/sortable"
+import { CSS } from "@dnd-kit/utilities"
+import { DotsSix, XMark, Tag } from "@medusajs/icons"
+import {
+ Button,
+ Heading,
+ IconButton,
+ Input,
+ ProgressTabs,
+ Text,
+ toast,
+} from "@medusajs/ui"
+import { useFieldArray, useForm, useFormContext, FormProvider } from "react-hook-form"
+import { useTranslation } from "react-i18next"
+import { useParams } from "react-router-dom"
+
+import { RouteFocusModal, useRouteModal } from "../../../components/modals"
+import {
+ useAttribute,
+ useCreateAttributePossibleValue,
+ attributesQueryKeys,
+} from "../../../hooks/api/attributes"
+import { sdk } from "../../../lib/client"
+import { queryClient } from "../../../lib/query-client"
+import { ATTRIBUTE_DETAIL_FIELDS } from "../attribute-detail/constants"
+
+type NewValueItem = {
+ id: string
+ value: string
+}
+
+type RankingItem = {
+ id: string
+ value: string
+ isNew: boolean
+}
+
+type CreatePossibleValuesFormValues = {
+ new_values: NewValueItem[]
+}
+
+// --- Sortable Item for Tab 1 (Values) ---
+
+interface SortableValueInputProps {
+ id: string
+ index: number
+ onRemove: () => void
+}
+
+const SortableValueInput = ({
+ id,
+ index,
+ onRemove,
+}: SortableValueInputProps) => {
+ const { t } = useTranslation()
+ const { register } = useFormContext<CreatePossibleValuesFormValues>()
+ const { attributes, listeners, setNodeRef, transform, transition } =
+ useSortable({ id })
+
+ const style = {
+ transform: CSS.Transform.toString(transform),
+ transition,
+ }
+
+ return (
+ <div
+ ref={setNodeRef}
+ style={style}
+ className="flex items-center gap-2 p-2 bg-ui-bg-component border border-ui-border-base rounded-xl mb-2"
+ data-testid={`create-possible-value-input-item-${index}`}
+ >
+ <button
+ type="button"
+ className="cursor-grab active:cursor-grabbing"
+ {...attributes}
+ {...listeners}
+ data-testid={`create-possible-value-drag-handle-${index}`}
+ >
+ <DotsSix className="text-ui-fg-subtle" />
+ </button>
+ <div className="flex-1">
+ <Input
+ className="flex-1"
+ placeholder={t("attributes.createPossibleValues.enterValue")}
+ {...register(`new_values.${index}.value`)}
+ data-testid={`create-possible-value-input-${index}`}
+ />
+ </div>
+ <IconButton
+ variant="transparent"
+ size="small"
+ type="button"
+ onClick={onRemove}
+ data-testid={`create-possible-value-remove-button-${index}`}
+ >
+ <XMark />
+ </IconButton>
+ </div>
+ )
+}
+
+// --- Sortable Item for Tab 2 (Organize Ranking) ---
+
+interface SortableRankingItemProps {
+ id: string
+ value: string
+ index: number
+}
+
+const SortableRankingItem = ({
+ id,
+ value,
+ index,
+}: SortableRankingItemProps) => {
+ const { attributes, listeners, setNodeRef, transform, transition } =
+ useSortable({ id })
+
+ const style = {
+ transform: CSS.Transform.toString(transform),
+ transition,
+ }
+
+ return (
+ <div
+ ref={setNodeRef}
+ style={style}
+ className="flex items-center gap-3 p-3 bg-ui-bg-component border border-ui-border-base rounded-xl mb-2"
+ data-testid={`ranking-item-${index}`}
+ >
+ <button
+ type="button"
+ className="cursor-grab active:cursor-grabbing"
+ {...attributes}
+ {...listeners}
+ data-testid={`ranking-item-drag-handle-${index}`}
+ >
+ <DotsSix className="text-ui-fg-subtle" />
+ </button>
+ <Tag className="text-ui-fg-subtle" />
+ <Text size="small" weight="plus">
+ {value}
+ </Text>
+ </div>
+ )
+}
+
+// --- Inner Form Component ---
+
+const AttributeCreatePossibleValueInner = () => {
+ const { t } = useTranslation()
+ const { id } = useParams()
+ const { handleSuccess } = useRouteModal()
+
+ const { attribute, isPending: isAttributeLoading } = useAttribute(id!, {
+ fields: ATTRIBUTE_DETAIL_FIELDS,
+ })
+
+ const { mutateAsync: createValue } = useCreateAttributePossibleValue(id!)
+
+ const [activeTab, setActiveTab] = useState<"values" | "organize-ranking">(
+ "values"
+ )
+ const [tabStatuses, setTabStatuses] = useState<{
+ valuesStatus: "not-started" | "in-progress" | "completed"
+ organizeStatus: "not-started" | "in-progress" | "completed"
+ }>({
+ valuesStatus: "not-started",
+ organizeStatus: "not-started",
+ })
+ const [rankingItems, setRankingItems] = useState<RankingItem[]>([])
+ const [isSaving, setIsSaving] = useState(false)
+
+ const form = useForm<CreatePossibleValuesFormValues>({
+ defaultValues: {
+ new_values: [{ id: crypto.randomUUID(), value: "" }],
+ },
+ })
+
+ const { fields, append, remove } = useFieldArray({
+ control: form.control,
+ name: "new_values",
+ })
+
+ const sensors = useSensors(
+ useSensor(PointerSensor),
+ useSensor(KeyboardSensor, {
+ coordinateGetter: sortableKeyboardCoordinates,
+ })
+ )
+
+ const handleValuesDragEnd = (event: DragEndEvent) => {
+ const { active, over } = event
+ if (over && active.id !== over.id) {
+ const oldIndex = fields.findIndex((field) => field.id === active.id)
+ const newIndex = fields.findIndex((field) => field.id === over.id)
+ const currentValues = form.getValues("new_values")
+ const reordered = arrayMove(currentValues, oldIndex, newIndex)
+ reordered.forEach((item, idx) => {
+ form.setValue(`new_values.${idx}.id`, item.id)
+ form.setValue(`new_values.${idx}.value`, item.value)
+ })
+ }
+ }
+
+ const handleRankingDragEnd = (event: DragEndEvent) => {
+ const { active, over } = event
+ if (over && active.id !== over.id) {
+ setRankingItems((items) => {
+ const oldIndex = items.findIndex((item) => item.id === active.id)
+ const newIndex = items.findIndex((item) => item.id === over.id)
+ return arrayMove(items, oldIndex, newIndex)
+ })
+ }
+ }
+
+ const handleAddValue = () => {
+ append({ id: crypto.randomUUID(), value: "" })
+ setTabStatuses((prev) => ({
+ ...prev,
+ valuesStatus: "in-progress",
+ }))
+ }
+
+ const handleContinue = () => {
+ const newValues = form
+ .getValues("new_values")
+ .filter((v) => v.value.trim() !== "")
+
+ if (newValues.length === 0) {
+ toast.warning(t("attributes.createPossibleValues.enterValue"))
+ return
+ }
+
+ // Build ranking items: existing values + new values
+ const existingValues: RankingItem[] = (
+ attribute?.possible_values ?? []
+ )
+ .slice()
+ .sort((a: any, b: any) => (a.rank ?? 0) - (b.rank ?? 0))
+ .map((pv: any) => ({
+ id: pv.id,
+ value: pv.value,
+ isNew: false,
+ }))
+
+ const newRankingItems: RankingItem[] = newValues.map((nv) => ({
+ id: nv.id,
+ value: nv.value,
+ isNew: true,
+ }))
+
+ setRankingItems([...existingValues, ...newRankingItems])
+
+ setTabStatuses({
+ valuesStatus: "completed",
+ organizeStatus: "in-progress",
+ })
+ setActiveTab("organize-ranking")
+ }
+
+ const handleTabChange = (value: string) => {
+ const newTab = value as "values" | "organize-ranking"
+
+ if (
+ newTab === "organize-ranking" &&
+ tabStatuses.valuesStatus !== "completed"
+ ) {
+ return
+ }
+
+ setActiveTab(newTab)
+ }
+
+ const handleSave = async () => {
+ setIsSaving(true)
+ try {
+ // Create new values with their rank based on position in the ranking list (1-based)
+ for (const [index, item] of rankingItems.entries()) {
+ if (item.isNew) {
+ await createValue({
+ value: item.value,
+ rank: index + 1,
+ metadata: {},
+ })
+ }
+ }
+
+ // Update existing values whose rank has changed
+ for (const [index, item] of rankingItems.entries()) {
+ if (!item.isNew) {
+ const existingPV = (attribute?.possible_values ?? []).find(
+ (pv: any) => pv.id === item.id
+ )
+ if (existingPV && existingPV.rank !== index + 1) {
+ await sdk.admin.attributes.$id.values.$valueId.mutate({
+ $id: id!,
+ $valueId: item.id,
+ rank: index + 1,
+ } as any)
+ }
+ }
+ }
+
+ // Invalidate queries so the detail page refreshes
+ queryClient.invalidateQueries({
+ queryKey: attributesQueryKeys.detail(id!),
+ })
+
+ toast.success(t("attributes.createPossibleValues.successToast"))
+ handleSuccess(`/settings/attributes/${id}`)
+ } catch (error: any) {
+ toast.error(error.message)
+ } finally {
+ setIsSaving(false)
+ }
+ }
+
+ if (isAttributeLoading || !attribute) {
+ return null
+ }
+
+ return (
+ <FormProvider {...form}>
+ <ProgressTabs
+ value={activeTab}
+ onValueChange={handleTabChange}
+ className="flex size-full flex-col overflow-hidden"
+ data-testid="attribute-create-possible-value-progress-tabs"
+ >
+ <RouteFocusModal.Header data-testid="attribute-create-possible-value-modal-header">
+ <ProgressTabs.List
+ className="justify-start flex w-full items-center"
+ data-testid="attribute-create-possible-value-tabs-list"
+ >
+ <ProgressTabs.Trigger
+ value="values"
+ status={tabStatuses.valuesStatus}
+ data-testid="attribute-create-possible-value-values-tab"
+ >
+ {t("attributes.createPossibleValues.tabs.values")}
+ </ProgressTabs.Trigger>
+ <ProgressTabs.Trigger
+ value="organize-ranking"
+ status={tabStatuses.organizeStatus}
+ data-testid="attribute-create-possible-value-organize-tab"
+ >
+ {t("attributes.createPossibleValues.tabs.organizeRanking")}
+ </ProgressTabs.Trigger>
+ </ProgressTabs.List>
+ </RouteFocusModal.Header>
+
+ <RouteFocusModal.Body
+ className="flex flex-1 justify-center overflow-auto px-6 py-16"
+ data-testid="attribute-create-possible-value-modal-body"
+ >
+ <div className="flex w-full max-w-[720px] flex-col gap-y-8">
+ <div className="flex flex-col gap-y-1">
+ <RouteFocusModal.Title asChild>
+ <Heading data-testid="attribute-create-possible-value-heading">
+ {t("attributes.createPossibleValues.header")}
+ </Heading>
+ </RouteFocusModal.Title>
+ <RouteFocusModal.Description asChild>
+ <Text
+ size="small"
+ className="text-ui-fg-subtle"
+ data-testid="attribute-create-possible-value-subtitle"
+ >
+ {t("attributes.createPossibleValues.subtitle", {
+ name: attribute.name,
+ })}
+ </Text>
+ </RouteFocusModal.Description>
+ </div>
+
+ <ProgressTabs.Content value="values">
+ <div className="flex flex-col gap-y-4">
+ <DndContext
+ sensors={sensors}
+ collisionDetection={closestCenter}
+ onDragEnd={handleValuesDragEnd}
+ >
+ <SortableContext
+ items={fields.map((field) => field.id)}
+ strategy={verticalListSortingStrategy}
+ >
+ {fields.map((field, index) => (
+ <SortableValueInput
+ key={field.id}
+ id={field.id}
+ index={index}
+ onRemove={() => remove(index)}
+ />
+ ))}
+ </SortableContext>
+ </DndContext>
+
+ <Button
+ type="button"
+ variant="secondary"
+ size="small"
+ onClick={handleAddValue}
+ data-testid="attribute-create-possible-value-add-button"
+ >
+ {t("attributes.createPossibleValues.addValue")}
+ </Button>
+ </div>
+ </ProgressTabs.Content>
+
+ <ProgressTabs.Content value="organize-ranking">
+ <DndContext
+ sensors={sensors}
+ collisionDetection={closestCenter}
+ onDragEnd={handleRankingDragEnd}
+ >
+ <SortableContext
+ items={rankingItems.map((item) => item.id)}
+ strategy={verticalListSortingStrategy}
+ >
+ {rankingItems.map((item, index) => (
+ <SortableRankingItem
+ key={item.id}
+ id={item.id}
+ value={item.value}
+ index={index}
+ />
+ ))}
+ </SortableContext>
+ </DndContext>
+ </ProgressTabs.Content>
+ </div>
+ </RouteFocusModal.Body>
+
+ <RouteFocusModal.Footer data-testid="attribute-create-possible-value-modal-footer">
+ <div className="flex items-center justify-end gap-2">
+ <RouteFocusModal.Close asChild>
+ <Button
+ size="small"
+ variant="secondary"
+ type="button"
+ data-testid="attribute-create-possible-value-cancel-button"
+ >
+ {t("actions.cancel")}
+ </Button>
+ </RouteFocusModal.Close>
+ {activeTab === "values" ? (
+ <Button
+ size="small"
+ type="button"
+ onClick={handleContinue}
+ data-testid="attribute-create-possible-value-continue-button"
+ >
+ {t("actions.continue")}
+ </Button>
+ ) : (
+ <Button
+ size="small"
+ type="button"
+ onClick={handleSave}
+ isLoading={isSaving}
+ data-testid="attribute-create-possible-value-save-button"
+ >
+ {t("actions.save")}
+ </Button>
+ )}
+ </div>
+ </RouteFocusModal.Footer>
+ </ProgressTabs>
+ </FormProvider>
+ )
+}
+
+export const AttributeCreatePossibleValue = () => {
+ return (
+ <RouteFocusModal data-testid="attribute-create-possible-value-modal">
+ <AttributeCreatePossibleValueInner />
+ </RouteFocusModal>
+ )
+}
diff --git a/packages/admin/src/pages/attributes/attribute-create-possible-value/index.ts b/packages/admin/src/pages/attributes/attribute-create-possible-value/index.ts
new file mode 100644
index 000000000..87d4106ad
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-create-possible-value/index.ts
@@ -0,0 +1 @@
+export { AttributeCreatePossibleValue as Component } from "./attribute-create-possible-value"
diff --git a/packages/admin/src/pages/attributes/attribute-create/attribute-create.tsx b/packages/admin/src/pages/attributes/attribute-create/attribute-create.tsx
new file mode 100644
index 000000000..e49d1a5b6
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-create/attribute-create.tsx
@@ -0,0 +1,191 @@
+import { useRef, useState } from "react"
+import { Button, Heading, ProgressTabs, Text, toast } from "@medusajs/ui"
+import { useTranslation } from "react-i18next"
+
+import {
+ AttributeForm,
+ type AttributeFormRef,
+} from "../attribute-edit/components/attribute-form"
+import type {
+ CreateAttributeFormValues,
+ UpdateAttributeFormValues,
+} from "../attribute-edit/types"
+import { useCreateAttribute, useProductCategories } from "../../../hooks/api"
+import { RouteFocusModal, useRouteModal } from "../../../components/modals"
+
+const AttributeCreateInner = () => {
+ const { t } = useTranslation()
+ const { handleSuccess } = useRouteModal()
+ const formRef = useRef<AttributeFormRef>(null)
+
+ const [activeTab, setActiveTab] = useState<"details" | "type">("details")
+ const [tabStatuses, setTabStatuses] = useState<{
+ detailsStatus: "not-started" | "in-progress" | "completed"
+ typeStatus: "not-started" | "in-progress" | "completed"
+ }>({
+ detailsStatus: "not-started",
+ typeStatus: "not-started",
+ })
+
+ const { mutateAsync, isPending } = useCreateAttribute()
+ const { product_categories: categories = [] } = useProductCategories({
+ limit: 999,
+ })
+
+ const handleSave = async (
+ data: CreateAttributeFormValues | UpdateAttributeFormValues
+ ) => {
+ await mutateAsync(data as CreateAttributeFormValues, {
+ onSuccess: () => {
+ toast.success(
+ t("attributes.create.successToast", {
+ name: (data as CreateAttributeFormValues).name,
+ })
+ )
+ handleSuccess("/settings/attributes")
+ },
+ onError: (error) => {
+ toast.error(error.message)
+ },
+ })
+ }
+
+ const handleTabChange = (value: string) => {
+ const newTab = value as "details" | "type"
+
+ if (newTab === "type" && tabStatuses.detailsStatus === "not-started") {
+ toast.warning(
+ t(
+ "attributes.create.fillNameWarning",
+ "Please fill in the name first."
+ )
+ )
+ return
+ }
+
+ setActiveTab(newTab)
+ }
+
+ const handleNext = async () => {
+ if (formRef.current) {
+ const isValid = await formRef.current.validateFields(["name"])
+ if (isValid) {
+ setActiveTab("type")
+ }
+ } else {
+ setActiveTab("type")
+ }
+ }
+
+ return (
+ <ProgressTabs
+ value={activeTab}
+ onValueChange={handleTabChange}
+ className="flex size-full flex-col overflow-hidden"
+ data-testid="attribute-create-progress-tabs"
+ >
+ <RouteFocusModal.Header
+ data-testid="attribute-create-modal-header"
+ >
+ <ProgressTabs.List
+ className="justify-start flex w-full items-center"
+ data-testid="attribute-create-progress-tabs-list"
+ >
+ <ProgressTabs.Trigger
+ value="details"
+ status={tabStatuses.detailsStatus}
+ data-testid="attribute-create-details-tab"
+ >
+ {t("attributes.create.tabs.details", "Details")}
+ </ProgressTabs.Trigger>
+ <ProgressTabs.Trigger
+ value="type"
+ status={tabStatuses.typeStatus}
+ data-testid="attribute-create-type-tab"
+ >
+ {t("attributes.create.tabs.type", "Type")}
+ </ProgressTabs.Trigger>
+ </ProgressTabs.List>
+ </RouteFocusModal.Header>
+
+ <RouteFocusModal.Body
+ className="flex flex-1 justify-center overflow-auto px-6 py-16"
+ data-testid="attribute-create-modal-body"
+ >
+ <div className="flex w-full max-w-[720px] flex-col gap-y-8">
+ <div className="flex flex-col gap-y-1">
+ <RouteFocusModal.Title asChild>
+ <Heading data-testid="attribute-create-modal-heading">
+ {t("attributes.create.header", "Create Attribute")}
+ </Heading>
+ </RouteFocusModal.Title>
+ <RouteFocusModal.Description asChild>
+ <Text
+ size="small"
+ className="text-ui-fg-subtle"
+ data-testid="attribute-create-modal-subtitle"
+ >
+ {t(
+ "attributes.create.subtitle",
+ "Define a new product attribute."
+ )}
+ </Text>
+ </RouteFocusModal.Description>
+ </div>
+
+ <AttributeForm
+ ref={formRef}
+ onSubmit={handleSave}
+ categories={categories}
+ mode="create"
+ activeTab={activeTab}
+ onFormStateChange={setTabStatuses}
+ />
+ </div>
+ </RouteFocusModal.Body>
+
+ <RouteFocusModal.Footer data-testid="attribute-create-modal-footer">
+ <div className="flex items-center justify-end gap-2">
+ <RouteFocusModal.Close asChild>
+ <Button
+ size="small"
+ variant="secondary"
+ type="button"
+ data-testid="attribute-create-modal-cancel-button"
+ >
+ {t("actions.cancel", "Cancel")}
+ </Button>
+ </RouteFocusModal.Close>
+ {activeTab === "details" ? (
+ <Button
+ size="small"
+ type="button"
+ onClick={handleNext}
+ data-testid="attribute-create-modal-next-button"
+ >
+ {t("actions.continue", "Next")}
+ </Button>
+ ) : (
+ <Button
+ size="small"
+ type="submit"
+ form="attribute-form"
+ isLoading={isPending}
+ data-testid="attribute-create-modal-save-button"
+ >
+ {t("actions.save", "Save")}
+ </Button>
+ )}
+ </div>
+ </RouteFocusModal.Footer>
+ </ProgressTabs>
+ )
+}
+
+export const AttributeCreate = () => {
+ return (
+ <RouteFocusModal data-testid="attribute-create-modal">
+ <AttributeCreateInner />
+ </RouteFocusModal>
+ )
+}
diff --git a/packages/admin/src/pages/attributes/attribute-create/components/multi-select-category.tsx b/packages/admin/src/pages/attributes/attribute-create/components/multi-select-category.tsx
new file mode 100644
index 000000000..294f75a01
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-create/components/multi-select-category.tsx
@@ -0,0 +1,210 @@
+import { useEffect, useRef, useState } from "react"
+
+import {
+ ArrowUturnLeft,
+ TriangleRightMini,
+ TrianglesMini,
+ XMarkMini,
+} from "@medusajs/icons"
+import type { AdminProductCategory } from "@medusajs/types"
+import { Badge, Text } from "@medusajs/ui"
+import { useTranslation } from "react-i18next"
+
+type MultiSelectCategoryProps = {
+ categories: AdminProductCategory[]
+ value: string[]
+ onChange: (value: string[]) => void
+}
+
+export const MultiSelectCategory = ({
+ categories,
+ value,
+ onChange,
+}: MultiSelectCategoryProps) => {
+ const { t } = useTranslation()
+ const [isOpen, setIsOpen] = useState(false)
+ const dropdownRef = useRef<HTMLDivElement>(null)
+ const triggerRef = useRef<HTMLDivElement>(null)
+ const [currentParentId, setCurrentParentId] = useState<string | null>(null)
+ const [pathHistory, setPathHistory] = useState<(string | null)[]>([])
+
+ useEffect(() => {
+ const handleClickOutside = (event: MouseEvent) => {
+ if (
+ dropdownRef.current &&
+ !dropdownRef.current.contains(event.target as Node) &&
+ triggerRef.current &&
+ !triggerRef.current.contains(event.target as Node)
+ ) {
+ setIsOpen(false)
+ }
+ }
+ document.addEventListener("mousedown", handleClickOutside)
+ return () => {
+ document.removeEventListener("mousedown", handleClickOutside)
+ }
+ }, [])
+
+ const handleToggle = () => {
+ setIsOpen((prev) => !prev)
+ }
+
+ const hasChildren = (categoryId: string) => {
+ return categories.some((cat) => cat.parent_category_id === categoryId)
+ }
+
+ const handleDrillDown = (
+ category: AdminProductCategory,
+ event: React.MouseEvent
+ ) => {
+ event.stopPropagation()
+ setPathHistory([...pathHistory, currentParentId])
+ setCurrentParentId(category.id)
+ }
+
+ const handleGoBack = () => {
+ const newPathHistory = [...pathHistory]
+ const previousParentId = newPathHistory.pop()
+ setPathHistory(newPathHistory)
+ setCurrentParentId(previousParentId || null)
+ }
+
+ const handleItemClick = (categoryId: string) => {
+ const isSelected = value.includes(categoryId)
+ if (isSelected) {
+ onChange(value.filter((id) => id !== categoryId))
+ } else {
+ onChange([...value, categoryId])
+ }
+ }
+
+ const currentCategories = categories.filter(
+ (cat) => cat.parent_category_id === currentParentId
+ )
+
+ const getBackButtonText = (): string => {
+ const parentCategory = categories.find((cat) => cat.id === currentParentId)
+ return parentCategory?.name || ""
+ }
+
+ return (
+ <div
+ className="relative"
+ data-testid="attribute-form-category-multiselect"
+ >
+ <div
+ ref={triggerRef}
+ className="focus-within:ring-ui-ring-interactive relative flex h-10 w-full cursor-pointer items-center justify-between overflow-hidden rounded-md border border-ui-border-base bg-ui-bg-field text-ui-fg-base shadow-sm transition-colors duration-150 ease-in-out focus-within:border-ui-border-interactive focus-within:ring-1 hover:bg-ui-bg-field-hover"
+ onClick={handleToggle}
+ data-testid="attribute-form-category-multiselect-trigger"
+ >
+ <div
+ className="flex items-center gap-2 px-3 py-2"
+ data-testid="attribute-form-category-multiselect-trigger-content"
+ >
+ {value.length > 0 ? (
+ <button
+ type="button"
+ onClick={(e) => {
+ e.stopPropagation()
+ onChange([])
+ }}
+ data-testid="attribute-form-category-multiselect-clear-button"
+ >
+ <Badge
+ size="small"
+ className="w-fit"
+ data-testid="attribute-form-category-multiselect-badge"
+ >
+ {value.length}
+ <XMarkMini />
+ </Badge>
+ </button>
+ ) : (
+ <Text
+ className="text-ui-fg-subtle"
+ data-testid="attribute-form-category-multiselect-placeholder"
+ >
+ {t("attributes.fields.categories", "Select categories")}
+ </Text>
+ )}
+ </div>
+ <span
+ className="flex h-full w-10 items-center justify-center border-l border-ui-border-base"
+ data-testid="attribute-form-category-multiselect-icon"
+ >
+ <TrianglesMini />
+ </span>
+ </div>
+
+ {isOpen && (
+ <div
+ ref={dropdownRef}
+ className="absolute z-10 mt-1 max-h-60 w-full overflow-y-auto rounded-md border border-ui-border-base bg-ui-bg-base shadow-lg"
+ data-testid="attribute-form-category-multiselect-dropdown"
+ >
+ {currentParentId !== null && (
+ <div
+ className="flex cursor-pointer items-center gap-3 border-b border-ui-border-base px-3 py-2 text-ui-fg-subtle hover:bg-ui-bg-base-hover"
+ onClick={handleGoBack}
+ data-testid="attribute-form-category-multiselect-back-button"
+ >
+ <ArrowUturnLeft />
+ <Text data-testid="attribute-form-category-multiselect-back-text">
+ {getBackButtonText()}
+ </Text>
+ </div>
+ )}
+ {currentCategories.length === 0 ? (
+ <div
+ className="p-3 text-ui-fg-subtle"
+ data-testid="attribute-form-category-multiselect-empty"
+ >
+ {t("general.noResultsTitle", "No categories found.")}
+ </div>
+ ) : (
+ currentCategories.map((category) => {
+ const isSelected = value.includes(category.id)
+ const hasChildrenNode = hasChildren(category.id)
+ return (
+ <div
+ key={category.id}
+ className="flex cursor-pointer items-center justify-between px-1 py-1"
+ onClick={() => handleItemClick(category.id)}
+ data-testid={`attribute-form-category-multiselect-item-${category.id}`}
+ >
+ <div
+ className="relative mr-2 flex flex-1 items-center rounded-md px-2 py-1.5 hover:bg-ui-bg-base-hover"
+ data-testid={`attribute-form-category-multiselect-item-${category.id}-content`}
+ >
+ {isSelected && (
+ <span
+ className="absolute left-3 top-1/2 h-1 w-1 -translate-y-1/2 rounded-full bg-ui-fg-base"
+ data-testid={`attribute-form-category-multiselect-item-${category.id}-selected-indicator`}
+ />
+ )}
+ <Text
+ className="ml-6"
+ data-testid={`attribute-form-category-multiselect-item-${category.id}-name`}
+ >
+ {category.name}
+ </Text>
+ </div>
+ {hasChildrenNode && (
+ <div
+ onClick={(e) => handleDrillDown(category, e)}
+ className="rounded-md p-2 hover:bg-ui-bg-base-hover"
+ data-testid={`attribute-form-category-multiselect-item-${category.id}-drill-down`}
+ >
+ <TriangleRightMini className="mr-1" />
+ </div>
+ )}
+ </div>
+ )
+ })
+ )}
+ </div>
+ )}
+ </div>
+ )
+}
diff --git a/packages/admin/src/pages/attributes/attribute-create/components/possible-values-list.tsx b/packages/admin/src/pages/attributes/attribute-create/components/possible-values-list.tsx
new file mode 100644
index 000000000..f725de33a
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-create/components/possible-values-list.tsx
@@ -0,0 +1,203 @@
+import {
+ DndContext,
+ closestCenter,
+ KeyboardSensor,
+ PointerSensor,
+ useSensor,
+ useSensors,
+ type DragEndEvent,
+} from "@dnd-kit/core"
+import {
+ arrayMove,
+ SortableContext,
+ sortableKeyboardCoordinates,
+ useSortable,
+ verticalListSortingStrategy,
+} from "@dnd-kit/sortable"
+import { CSS } from "@dnd-kit/utilities"
+import { DotsSix, XMark } from "@medusajs/icons"
+import { Button, Hint, IconButton, Input, Label } from "@medusajs/ui"
+import { useFieldArray, useFormContext } from "react-hook-form"
+import { useTranslation } from "react-i18next"
+
+type AttributeValueType = {
+ value: string
+ rank: number
+ metadata: Record<string, unknown>
+}
+
+type FormValues = any
+
+interface SortableItemProps {
+ id: string
+ index: number
+ onRemove: () => void
+}
+
+const SortableItem = ({ id, index, onRemove }: SortableItemProps) => {
+ const {
+ register,
+ formState: { errors },
+ } = useFormContext<FormValues>()
+ const { attributes, listeners, setNodeRef, transform, transition } =
+ useSortable({ id })
+
+ const style = {
+ transform: CSS.Transform.toString(transform),
+ transition,
+ }
+
+ const possibleValuesErrors = errors?.possible_values
+ const fieldError =
+ Array.isArray(possibleValuesErrors)
+ ? (possibleValuesErrors[index] as { value?: { message?: string } } | undefined)?.value
+ : undefined
+
+ return (
+ <>
+ <div
+ ref={setNodeRef}
+ style={style}
+ className="flex items-center gap-2 p-2 bg-ui-bg-component border border-ui-border-base rounded-xl mb-2"
+ data-testid={`attribute-form-possible-value-item-${index}`}
+ >
+ <button
+ type="button"
+ className="cursor-grab active:cursor-grabbing"
+ {...attributes}
+ {...listeners}
+ data-testid={`attribute-form-possible-value-drag-handle-${index}`}
+ >
+ <DotsSix className="text-ui-fg-subtle" />
+ </button>
+ <div className="flex-1">
+ <Input
+ className="flex-1"
+ aria-invalid={!!fieldError}
+ placeholder="Enter value"
+ {...register(`possible_values.${index}.value`)}
+ data-testid={`attribute-form-possible-value-input-${index}`}
+ />
+ </div>
+ <IconButton
+ variant="transparent"
+ size="small"
+ type="button"
+ onClick={onRemove}
+ data-testid={`attribute-form-possible-value-remove-button-${index}`}
+ >
+ <XMark />
+ </IconButton>
+ </div>
+ {fieldError && (
+ <Hint
+ variant="error"
+ className="mb-2"
+ data-testid={`attribute-form-possible-value-error-${index}`}
+ >
+ {fieldError.message as string}
+ </Hint>
+ )}
+ </>
+ )
+}
+
+export const PossibleValuesList = () => {
+ const { t } = useTranslation()
+ const { control, getValues, formState } = useFormContext<FormValues>()
+ const { fields, append, remove, update } = useFieldArray({
+ control,
+ name: "possible_values",
+ })
+
+ const sensors = useSensors(
+ useSensor(PointerSensor),
+ useSensor(KeyboardSensor, {
+ coordinateGetter: sortableKeyboardCoordinates,
+ })
+ )
+
+ const handleDragEnd = (event: DragEndEvent) => {
+ const { active, over } = event
+
+ if (over && active.id !== over.id) {
+ const oldIndex = fields.findIndex((field) => field.id === active.id)
+ const newIndex = fields.findIndex((field) => field.id === over.id)
+
+ const currentValues = getValues("possible_values") as AttributeValueType[]
+ const reorderedValues = arrayMove(currentValues, oldIndex, newIndex)
+
+ reorderedValues.forEach((value, index) => {
+ update(index, {
+ value: value.value,
+ rank: index,
+ metadata: value.metadata || {},
+ })
+ })
+ }
+ }
+
+ const handleAddValue = (e: React.MouseEvent<HTMLButtonElement>) => {
+ e.preventDefault()
+ append({
+ value: "",
+ rank: fields.length,
+ metadata: {},
+ })
+ }
+
+ const possibleValuesError = formState.errors.possible_values
+ const shouldShowListError =
+ possibleValuesError && !Array.isArray(possibleValuesError)
+
+ return (
+ <div className="space-y-2" data-testid="attribute-form-possible-values-list">
+ <div
+ className="flex items-center justify-between pb-1"
+ data-testid="attribute-form-possible-values-header"
+ >
+ <Label data-testid="attribute-form-possible-values-label">
+ {t("attributes.fields.possibleValues", "Possible Values")}
+ </Label>
+ <Button
+ type="button"
+ variant="secondary"
+ size="small"
+ onClick={handleAddValue}
+ data-testid="attribute-form-possible-values-add-button"
+ >
+ {t("actions.add", "Add")}
+ </Button>
+ </div>
+
+ <DndContext
+ sensors={sensors}
+ collisionDetection={closestCenter}
+ onDragEnd={handleDragEnd}
+ >
+ <SortableContext
+ items={fields.map((field) => field.id)}
+ strategy={verticalListSortingStrategy}
+ >
+ {fields.map((field, index) => (
+ <SortableItem
+ key={field.id}
+ id={field.id}
+ index={index}
+ onRemove={() => remove(index)}
+ />
+ ))}
+ </SortableContext>
+ </DndContext>
+
+ {shouldShowListError && (
+ <Hint
+ variant="error"
+ data-testid="attribute-form-possible-values-list-error"
+ >
+ {(possibleValuesError as { message?: string }).message as string}
+ </Hint>
+ )}
+ </div>
+ )
+}
diff --git a/packages/admin/src/pages/attributes/attribute-create/index.ts b/packages/admin/src/pages/attributes/attribute-create/index.ts
new file mode 100644
index 000000000..920bd0fb5
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-create/index.ts
@@ -0,0 +1 @@
+export { AttributeCreate as Component } from "./attribute-create"
diff --git a/packages/admin/src/pages/attributes/attribute-detail/attribute-detail.tsx b/packages/admin/src/pages/attributes/attribute-detail/attribute-detail.tsx
new file mode 100644
index 000000000..f8ffb9e38
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-detail/attribute-detail.tsx
@@ -0,0 +1,51 @@
+import { ReactNode, Children } from "react"
+import { useLoaderData, useParams } from "react-router-dom"
+
+import { SingleColumnPageSkeleton } from "../../../components/common/skeleton"
+import { SingleColumnPage } from "../../../components/layout/pages"
+import { useAttribute } from "../../../hooks/api"
+
+import { AttributeGeneralSection } from "./components/attribute-general-section"
+import { AttributePossibleValuesSection } from "./components/attribute-possible-values-section"
+import { attributeDetailLoader } from "./loader"
+import { ATTRIBUTE_DETAIL_FIELDS } from "./constants"
+
+const Root = ({ children }: { children?: ReactNode }) => {
+ const { id } = useParams()
+
+ const initialData = useLoaderData() as Awaited<
+ ReturnType<typeof attributeDetailLoader>
+ >
+
+ const { attribute, isPending, isError, error } = useAttribute(
+ id!,
+ { fields: ATTRIBUTE_DETAIL_FIELDS },
+ {
+ initialData: initialData as any,
+ }
+ )
+
+ if (isPending || !attribute) {
+ return <SingleColumnPageSkeleton sections={2} />
+ }
+
+ if (isError) {
+ throw error
+ }
+
+ return Children.count(children) > 0 ? (
+ <SingleColumnPage hasOutlet data={attribute}>
+ {children}
+ </SingleColumnPage>
+ ) : (
+ <SingleColumnPage hasOutlet data={attribute}>
+ <AttributeGeneralSection attribute={attribute as any} />
+ <AttributePossibleValuesSection attribute={attribute as any} />
+ </SingleColumnPage>
+ )
+}
+
+export const AttributeDetailPage = Object.assign(Root, {
+ GeneralSection: AttributeGeneralSection,
+ PossibleValuesSection: AttributePossibleValuesSection,
+})
diff --git a/packages/admin/src/pages/attributes/attribute-detail/breadcrumb.tsx b/packages/admin/src/pages/attributes/attribute-detail/breadcrumb.tsx
new file mode 100644
index 000000000..2534ddb1a
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-detail/breadcrumb.tsx
@@ -0,0 +1,21 @@
+import { UIMatch } from "react-router-dom"
+import { useAttribute } from "../../../hooks/api"
+
+type AttributeDetailBreadcrumbProps = UIMatch<unknown>
+
+export const AttributeDetailBreadcrumb = (
+ props: AttributeDetailBreadcrumbProps
+) => {
+ const { id } = props.params || {}
+
+ const { attribute } = useAttribute(id!, undefined, {
+ initialData: props.data as any,
+ enabled: Boolean(id),
+ })
+
+ if (!attribute) {
+ return null
+ }
+
+ return <span>{attribute.name}</span>
+}
diff --git a/packages/admin/src/pages/attributes/attribute-detail/components/attribute-general-section/attribute-general-section.tsx b/packages/admin/src/pages/attributes/attribute-detail/components/attribute-general-section/attribute-general-section.tsx
new file mode 100644
index 000000000..daea32857
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-detail/components/attribute-general-section/attribute-general-section.tsx
@@ -0,0 +1,159 @@
+import { PencilSquare, Trash } from "@medusajs/icons"
+import { Badge, Container, Heading, toast, usePrompt } from "@medusajs/ui"
+import { useTranslation } from "react-i18next"
+import { useNavigate } from "react-router-dom"
+
+import { AttributeDTO } from "@mercurjs/types"
+import { ActionMenu } from "../../../../../components/common/action-menu"
+import { SectionRow } from "../../../../../components/common/section/section-row"
+import { useDeleteAttribute } from "../../../../../hooks/api"
+
+type AttributeGeneralSectionProps = {
+ attribute: AttributeDTO & {
+ product_categories?: Array<{ id: string; name: string }>
+ }
+}
+
+export const AttributeGeneralSection = ({
+ attribute,
+}: AttributeGeneralSectionProps) => {
+ const { t } = useTranslation()
+ const navigate = useNavigate()
+ const prompt = usePrompt()
+ const { mutateAsync } = useDeleteAttribute(attribute.id)
+
+ const handleDelete = async () => {
+ const confirmed = await prompt({
+ title: t("general.areYouSure"),
+ description: t("attributes.delete.confirmation", {
+ name: attribute.name,
+ }),
+ confirmText: t("actions.delete"),
+ cancelText: t("actions.cancel"),
+ })
+
+ if (!confirmed) {
+ return
+ }
+
+ await mutateAsync(undefined, {
+ onSuccess: () => {
+ toast.success(
+ t("attributes.delete.successToast", { name: attribute.name })
+ )
+ navigate("/settings/attributes", { replace: true })
+ },
+ onError: (error) => {
+ toast.error(error.message)
+ },
+ })
+ }
+
+ const typeLabel =
+ t(`attributes.type.${attribute.ui_component}`, attribute.ui_component) ??
+ attribute.ui_component
+
+ return (
+ <Container
+ className="divide-y p-0"
+ data-testid="attribute-general-section-container"
+ >
+ <div
+ className="flex items-center justify-between px-6 py-4"
+ data-testid="attribute-general-section-header"
+ >
+ <Heading data-testid="attribute-general-section-heading">
+ {attribute.name}
+ </Heading>
+ <ActionMenu
+ groups={[
+ {
+ actions: [
+ {
+ icon: <PencilSquare />,
+ label: t("actions.edit"),
+ to: "edit",
+ },
+ ],
+ },
+ {
+ actions: [
+ {
+ icon: <Trash />,
+ label: t("actions.delete"),
+ onClick: handleDelete,
+ },
+ ],
+ },
+ ]}
+ data-testid="attribute-general-section-action-menu"
+ />
+ </div>
+
+ <SectionRow
+ title={t("attributes.fields.handle")}
+ value={attribute.handle ? `/${attribute.handle}` : "-"}
+ data-testid="attribute-general-section-handle"
+ />
+
+ <SectionRow
+ title={t("attributes.fields.description")}
+ value={attribute.description || "-"}
+ data-testid="attribute-general-section-description"
+ />
+
+ <SectionRow
+ title={t("attributes.fields.type")}
+ value={typeLabel}
+ data-testid="attribute-general-section-type"
+ />
+
+ <SectionRow
+ title={t("attributes.fields.filterable")}
+ value={
+ attribute.is_filterable ? t("fields.true") : t("fields.false")
+ }
+ data-testid="attribute-general-section-filterable"
+ />
+
+ <SectionRow
+ title={t("attributes.fields.required")}
+ value={
+ attribute.is_required ? t("fields.true") : t("fields.false")
+ }
+ data-testid="attribute-general-section-required"
+ />
+
+ <SectionRow
+ title={t("attributes.fields.global")}
+ value={
+ attribute.product_categories && attribute.product_categories.length > 0
+ ? t("fields.false")
+ : t("fields.true")
+ }
+ data-testid="attribute-general-section-global"
+ />
+
+ <SectionRow
+ title={t("attributes.fields.category")}
+ value={
+ attribute.product_categories && attribute.product_categories.length > 0 ? (
+ <div
+ className="flex flex-wrap gap-1"
+ data-testid="attribute-general-section-categories"
+ >
+ {attribute.product_categories.map((category: any) => (
+ <Badge key={category.id} size="2xsmall">
+ {category.name}
+ </Badge>
+ ))}
+ </div>
+ ) : (
+ "-"
+ )
+ }
+ data-testid="attribute-general-section-categories-row"
+ />
+ </Container>
+ )
+}
diff --git a/packages/admin/src/pages/attributes/attribute-detail/components/attribute-general-section/index.ts b/packages/admin/src/pages/attributes/attribute-detail/components/attribute-general-section/index.ts
new file mode 100644
index 000000000..22af5c7a5
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-detail/components/attribute-general-section/index.ts
@@ -0,0 +1 @@
+export * from "./attribute-general-section"
diff --git a/packages/admin/src/pages/attributes/attribute-detail/components/attribute-possible-values-section/attribute-possible-values-section.tsx b/packages/admin/src/pages/attributes/attribute-detail/components/attribute-possible-values-section/attribute-possible-values-section.tsx
new file mode 100644
index 000000000..170f18bd8
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-detail/components/attribute-possible-values-section/attribute-possible-values-section.tsx
@@ -0,0 +1,213 @@
+import { PencilSquare, Trash } from "@medusajs/icons"
+import {
+ Button,
+ Container,
+ Heading,
+ Input,
+ Prompt,
+ Text,
+ toast,
+ usePrompt,
+} from "@medusajs/ui"
+import { createColumnHelper } from "@tanstack/react-table"
+import { useMemo, useState } from "react"
+import { useTranslation } from "react-i18next"
+import { Link } from "react-router-dom"
+
+import { ActionMenu } from "../../../../../components/common/action-menu"
+import { NoRecords } from "../../../../../components/common/empty-table-content"
+import { _DataTable } from "../../../../../components/table/data-table"
+import { TextCell } from "../../../../../components/table/table-cells/common/text-cell"
+import { useDataTable } from "../../../../../hooks/use-data-table"
+import { useUpdateAttribute } from "../../../../../hooks/api/attributes"
+
+type AttributePossibleValuesSectionProps = {
+ attribute: Record<string, any>
+}
+
+const PossibleValueActions = ({
+ value,
+ attribute,
+}: {
+ value: Record<string, any>
+ attribute: Record<string, any>
+}) => {
+ const { t } = useTranslation()
+ const prompt = usePrompt()
+ const { mutateAsync } = useUpdateAttribute(attribute.id)
+ const [inUseOpen, setInUseOpen] = useState(false)
+
+ const handleDelete = async () => {
+ const res = await prompt({
+ title: t("general.areYouSure"),
+ description: t("attributes.deletePossibleValue.confirmation", {
+ value: value.value,
+ }),
+ confirmText: t("actions.delete"),
+ cancelText: t("actions.cancel"),
+ })
+
+ if (!res) return
+
+ const remainingValues = (attribute.possible_values ?? [])
+ .filter((pv: any) => pv.id !== value.id)
+ .map((pv: any) => ({ id: pv.id, value: pv.value, rank: pv.rank }))
+
+ try {
+ await mutateAsync({ possible_values: remainingValues })
+ toast.success(
+ t("attributes.deletePossibleValue.successToast", {
+ value: value.value,
+ })
+ )
+ } catch (err: any) {
+ const isInUse = err.message?.includes("can't be deleted")
+
+ if (isInUse) {
+ setInUseOpen(true)
+ } else {
+ toast.error(err.message)
+ }
+ }
+ }
+
+ return (
+ <>
+ <ActionMenu
+ groups={[
+ {
+ actions: [
+ {
+ icon: <PencilSquare />,
+ label: t("actions.edit"),
+ to: `edit-possible-value?possible_value_id=${value.id}`,
+ },
+ ],
+ },
+ {
+ actions: [
+ {
+ icon: <Trash />,
+ label: t("actions.delete"),
+ onClick: handleDelete,
+ },
+ ],
+ },
+ ]}
+ />
+ <Prompt open={inUseOpen} variant="confirmation">
+ <Prompt.Content>
+ <Prompt.Header>
+ <Prompt.Title>
+ {t("attributes.deletePossibleValue.title")}
+ </Prompt.Title>
+ <Prompt.Description>
+ {t("attributes.deletePossibleValue.inUseMessage", {
+ value: value.value,
+ })}
+ </Prompt.Description>
+ </Prompt.Header>
+ <Prompt.Footer>
+ <Prompt.Action onClick={() => setInUseOpen(false)}>
+ {t("attributes.delete.gotIt")}
+ </Prompt.Action>
+ </Prompt.Footer>
+ </Prompt.Content>
+ </Prompt>
+ </>
+ )
+}
+
+const columnHelper = createColumnHelper<any>()
+
+const PAGE_SIZE = 10
+
+export const AttributePossibleValuesSection = ({
+ attribute,
+}: AttributePossibleValuesSectionProps) => {
+ const { t } = useTranslation()
+ const [search, setSearch] = useState("")
+
+ const allValues = attribute.possible_values ?? []
+
+ const filtered = useMemo(() => {
+ if (!search) return allValues
+ const q = search.toLowerCase()
+ return allValues.filter((v: any) => v.value?.toLowerCase().includes(q))
+ }, [allValues, search])
+
+ const columns = useMemo(
+ () => [
+ columnHelper.accessor("value", {
+ header: () => t("fields.name"),
+ cell: ({ getValue }) => <TextCell text={getValue()} />,
+ }),
+ columnHelper.accessor("rank", {
+ header: () => t("attributes.fields.rank"),
+ cell: ({ getValue }) => <TextCell text={String(getValue())} />,
+ }),
+ columnHelper.display({
+ id: "actions",
+ cell: ({ row }) => (
+ <PossibleValueActions value={row.original} attribute={attribute} />
+ ),
+ }),
+ ],
+ [t, attribute]
+ )
+
+ const { table } = useDataTable({
+ data: filtered,
+ count: filtered.length,
+ columns,
+ getRowId: (row: any) => row.id,
+ pageSize: PAGE_SIZE,
+ })
+
+ return (
+ <Container className="divide-y p-0">
+ <div className="flex items-center justify-between px-6 py-4">
+ <Heading level="h2">{t("attributes.fields.possibleValues")}</Heading>
+ <div className="flex items-center gap-x-2">
+ <Input
+ size="small"
+ type="search"
+ placeholder={t("general.search")}
+ value={search}
+ onChange={(e) => setSearch(e.target.value)}
+ className="w-[200px]"
+ />
+ <Button variant="secondary" size="small" asChild>
+ <Link to="edit-ranking">
+ {t("attributes.possibleValues.editRanking", "Edit ranking")}
+ </Link>
+ </Button>
+ <Button variant="secondary" size="small" asChild>
+ <Link to="create-possible-value">
+ {t("actions.create")}
+ </Link>
+ </Button>
+ </div>
+ </div>
+ {allValues.length > 0 ? (
+ <_DataTable
+ table={table}
+ columns={columns}
+ pageSize={PAGE_SIZE}
+ count={filtered.length}
+ pagination
+ />
+ ) : (
+ <NoRecords
+ className="border-t"
+ title={t("attributes.possibleValues.noRecordsTitle", "No created values")}
+ message={t("attributes.possibleValues.noRecordsMessage", "Create attribute to organize your products")}
+ action={{
+ to: "create-possible-value",
+ label: t("actions.create"),
+ }}
+ />
+ )}
+ </Container>
+ )
+}
diff --git a/packages/admin/src/pages/attributes/attribute-detail/components/attribute-possible-values-section/index.ts b/packages/admin/src/pages/attributes/attribute-detail/components/attribute-possible-values-section/index.ts
new file mode 100644
index 000000000..6e5881221
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-detail/components/attribute-possible-values-section/index.ts
@@ -0,0 +1 @@
+export * from "./attribute-possible-values-section"
diff --git a/packages/admin/src/pages/attributes/attribute-detail/constants.ts b/packages/admin/src/pages/attributes/attribute-detail/constants.ts
new file mode 100644
index 000000000..660854a0e
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-detail/constants.ts
@@ -0,0 +1 @@
+export const ATTRIBUTE_DETAIL_FIELDS = "id,name,description,handle,is_filterable,is_required,ui_component,metadata,*possible_values,product_categories.id,product_categories.name"
diff --git a/packages/admin/src/pages/attributes/attribute-detail/index.ts b/packages/admin/src/pages/attributes/attribute-detail/index.ts
new file mode 100644
index 000000000..4494bbd24
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-detail/index.ts
@@ -0,0 +1,3 @@
+export { AttributeDetailBreadcrumb as Breadcrumb } from "./breadcrumb"
+export { attributeDetailLoader as loader } from "./loader"
+export { AttributeDetailPage as Component } from "./attribute-detail"
diff --git a/packages/admin/src/pages/attributes/attribute-detail/loader.ts b/packages/admin/src/pages/attributes/attribute-detail/loader.ts
new file mode 100644
index 000000000..e90826091
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-detail/loader.ts
@@ -0,0 +1,19 @@
+import { LoaderFunctionArgs } from "react-router-dom"
+
+import { attributesQueryKeys } from "../../../hooks/api"
+import { sdk } from "../../../lib/client"
+import { queryClient } from "../../../lib/query-client"
+import { ATTRIBUTE_DETAIL_FIELDS } from "./constants"
+
+const attributeDetailQuery = (id: string) => ({
+ queryKey: attributesQueryKeys.detail(id),
+ queryFn: async () =>
+ sdk.admin.attributes.$id.query({ $id: id, fields: ATTRIBUTE_DETAIL_FIELDS }),
+})
+
+export const attributeDetailLoader = async ({ params }: LoaderFunctionArgs) => {
+ const id = params.id
+ const query = attributeDetailQuery(id!)
+
+ return queryClient.ensureQueryData(query)
+}
diff --git a/packages/admin/src/pages/attributes/attribute-edit-possible-value/attribute-edit-possible-value.tsx b/packages/admin/src/pages/attributes/attribute-edit-possible-value/attribute-edit-possible-value.tsx
new file mode 100644
index 000000000..4018c1e83
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-edit-possible-value/attribute-edit-possible-value.tsx
@@ -0,0 +1,295 @@
+import { zodResolver } from "@hookform/resolvers/zod"
+import { Button, Heading, Input, Text, toast } from "@medusajs/ui"
+import { useEffect, useRef } from "react"
+import { useFieldArray, useForm } from "react-hook-form"
+import { useTranslation } from "react-i18next"
+import { useParams, useSearchParams } from "react-router-dom"
+import { Trash } from "@medusajs/icons"
+
+import { ActionMenu } from "../../../components/common/action-menu"
+import { Form } from "../../../components/common/form"
+import { RouteDrawer, useRouteModal } from "../../../components/modals"
+import { KeyboundForm } from "../../../components/utilities/keybound-form"
+import {
+ useAttribute,
+ useUpdateAttributePossibleValue,
+} from "../../../hooks/api/attributes"
+import { ATTRIBUTE_DETAIL_FIELDS } from "../attribute-detail/constants"
+import { UpdatePossibleValueSchema } from "../attribute-edit/schema"
+import type { UpdatePossibleValueFormValues } from "../attribute-edit/types"
+
+type EditPossibleValueFormProps = {
+ attributeId: string
+ possibleValue: Record<string, any>
+}
+
+const EditPossibleValueForm = ({
+ attributeId,
+ possibleValue,
+}: EditPossibleValueFormProps) => {
+ const { t } = useTranslation()
+ const { handleSuccess } = useRouteModal()
+
+ const originalMetadataRef = useRef<Record<string, unknown>>({})
+
+ const { mutateAsync, isPending: isMutating } =
+ useUpdateAttributePossibleValue(attributeId, possibleValue.id)
+
+ const form = useForm<UpdatePossibleValueFormValues>({
+ resolver: zodResolver(UpdatePossibleValueSchema),
+ defaultValues: {
+ value: "",
+ rank: undefined,
+ metadata: [],
+ },
+ })
+
+ const { fields, append, remove } = useFieldArray({
+ control: form.control,
+ name: "metadata",
+ })
+
+ useEffect(() => {
+ if (possibleValue) {
+ const originalMetadata = possibleValue.metadata || {}
+ originalMetadataRef.current = originalMetadata
+
+ const metadataArray = Object.entries(originalMetadata).map(
+ ([key, value]) => ({ key, value: String(value) })
+ )
+
+ form.reset({
+ value: possibleValue.value,
+ rank: possibleValue.rank,
+ metadata:
+ metadataArray.length > 0 ? metadataArray : [{ key: "", value: "" }],
+ })
+ }
+ }, [possibleValue, form])
+
+ const handleSubmit = form.handleSubmit(async (data) => {
+ const transformedMetadata = data.metadata.reduce(
+ (acc, item) => {
+ if (item.key.trim() !== "" && item.value.trim() !== "") {
+ acc[item.key] = item.value
+ }
+ return acc
+ },
+ {} as Record<string, unknown>
+ )
+
+ const finalMetadata: Record<string, unknown> = { ...transformedMetadata }
+
+ const originalKeys = Object.keys(originalMetadataRef.current)
+ const newKeys = Object.keys(transformedMetadata)
+
+ originalKeys.forEach((key) => {
+ if (!newKeys.includes(key)) {
+ finalMetadata[key] = ""
+ }
+ })
+
+ await mutateAsync(
+ {
+ value: data.value,
+ rank: data.rank,
+ metadata: finalMetadata,
+ } as any,
+ {
+ onSuccess: () => {
+ toast.success(
+ t("attributes.editPossibleValue.successToast", {
+ value: data.value,
+ })
+ )
+ handleSuccess()
+ },
+ onError: (err) => {
+ toast.error(err.message)
+ },
+ }
+ )
+ })
+
+ return (
+ <RouteDrawer.Form form={form} data-testid="attribute-edit-possible-value-form">
+ <KeyboundForm
+ className="flex size-full flex-col overflow-hidden"
+ onSubmit={handleSubmit}
+ >
+ <RouteDrawer.Body
+ className="flex flex-1 flex-col gap-y-6 overflow-auto"
+ data-testid="attribute-edit-possible-value-form-body"
+ >
+ <div className="grid grid-cols-2 gap-4">
+ <Form.Field
+ control={form.control}
+ name="value"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label>{t("attributes.fields.value")}</Form.Label>
+ <Form.Control>
+ <Input {...field} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+
+ <Form.Field
+ control={form.control}
+ name="rank"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>{t("attributes.fields.rank")}</Form.Label>
+ <Form.Control>
+ <Input
+ {...field}
+ type="number"
+ value={field.value ?? ""}
+ onChange={(e) =>
+ field.onChange(
+ e.target.value === ""
+ ? undefined
+ : Number(e.target.value)
+ )
+ }
+ />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ </div>
+
+ {/* Metadata Editor */}
+ <div>
+ <Text size="small" weight="plus" className="mb-2">
+ {t("attributes.fields.metadata")}
+ </Text>
+ <table className="w-full overflow-hidden rounded-lg border-separate border-spacing-0 border">
+ <thead>
+ <tr className="bg-ui-bg-subtle">
+ <th className="border-b border-r px-3 py-2 text-left">
+ <Text size="small" weight="plus">{t("fields.key")}</Text>
+ </th>
+ <th className="border-b px-3 py-2 text-left">
+ <Text size="small" weight="plus">{t("attributes.fields.value")}</Text>
+ </th>
+ <th className="w-10 border-b" />
+ </tr>
+ </thead>
+ <tbody>
+ {fields.map((field, index) => (
+ <tr key={field.id} className="border-b last:border-b-0">
+ <td className="border-r px-3 py-2">
+ <input
+ placeholder="Key"
+ className="w-full bg-transparent text-sm outline-none"
+ {...form.register(`metadata.${index}.key`)}
+ />
+ </td>
+ <td className="px-3 py-2">
+ <input
+ placeholder="Value"
+ className="w-full bg-transparent text-sm outline-none"
+ {...form.register(`metadata.${index}.value`)}
+ />
+ </td>
+ <td className="px-1">
+ <ActionMenu
+ groups={[
+ {
+ actions: [
+ {
+ label: t("actions.delete"),
+ onClick: () => remove(index),
+ icon: <Trash />,
+ },
+ ],
+ },
+ ]}
+ />
+ </td>
+ </tr>
+ ))}
+ </tbody>
+ <tfoot>
+ <tr>
+ <td colSpan={3} className="border-t p-3">
+ <Button
+ type="button"
+ variant="secondary"
+ size="small"
+ className="w-full"
+ onClick={() => append({ key: "", value: "" })}
+ >
+ + Add Row
+ </Button>
+ </td>
+ </tr>
+ </tfoot>
+ </table>
+ </div>
+ </RouteDrawer.Body>
+
+ <RouteDrawer.Footer>
+ <div className="flex items-center justify-end gap-x-2">
+ <RouteDrawer.Close asChild>
+ <Button variant="secondary" size="small" type="button">
+ {t("actions.cancel")}
+ </Button>
+ </RouteDrawer.Close>
+ <Button size="small" type="submit" isLoading={isMutating}>
+ {t("actions.save")}
+ </Button>
+ </div>
+ </RouteDrawer.Footer>
+ </KeyboundForm>
+ </RouteDrawer.Form>
+ )
+}
+
+export const AttributeEditPossibleValue = () => {
+ const { id } = useParams()
+ const [searchParams] = useSearchParams()
+ const { t } = useTranslation()
+ const possibleValueId = searchParams.get("possible_value_id")
+
+ const { attribute, isPending, isError, error } = useAttribute(id!, {
+ fields: ATTRIBUTE_DETAIL_FIELDS,
+ })
+
+ if (isError) {
+ throw error
+ }
+
+ if (isPending || !attribute) {
+ return null
+ }
+
+ const possibleValue = attribute.possible_values?.find(
+ (pv: { id: string }) => pv.id === possibleValueId
+ )
+
+ if (!possibleValue) {
+ return null
+ }
+
+ return (
+ <RouteDrawer data-testid="attribute-edit-possible-value-drawer">
+ <RouteDrawer.Header>
+ <RouteDrawer.Title asChild>
+ <Heading>{t("attributes.editPossibleValue.header")}</Heading>
+ </RouteDrawer.Title>
+ <RouteDrawer.Description className="sr-only">
+ {t("attributes.editPossibleValue.subtitle")}
+ </RouteDrawer.Description>
+ </RouteDrawer.Header>
+ <EditPossibleValueForm
+ attributeId={id!}
+ possibleValue={possibleValue}
+ />
+ </RouteDrawer>
+ )
+}
diff --git a/packages/admin/src/pages/attributes/attribute-edit-possible-value/index.ts b/packages/admin/src/pages/attributes/attribute-edit-possible-value/index.ts
new file mode 100644
index 000000000..e1bfbaf27
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-edit-possible-value/index.ts
@@ -0,0 +1 @@
+export { AttributeEditPossibleValue as Component } from "./attribute-edit-possible-value"
diff --git a/packages/admin/src/pages/attributes/attribute-edit-ranking/attribute-edit-ranking.tsx b/packages/admin/src/pages/attributes/attribute-edit-ranking/attribute-edit-ranking.tsx
new file mode 100644
index 000000000..4517d0560
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-edit-ranking/attribute-edit-ranking.tsx
@@ -0,0 +1,194 @@
+import { useState } from "react"
+import {
+ DndContext,
+ closestCenter,
+ KeyboardSensor,
+ PointerSensor,
+ useSensor,
+ useSensors,
+ type DragEndEvent,
+} from "@dnd-kit/core"
+import {
+ arrayMove,
+ SortableContext,
+ sortableKeyboardCoordinates,
+ useSortable,
+ verticalListSortingStrategy,
+} from "@dnd-kit/sortable"
+import { CSS } from "@dnd-kit/utilities"
+import { DotsSix, Tag } from "@medusajs/icons"
+import { Button, Text, toast } from "@medusajs/ui"
+import { useTranslation } from "react-i18next"
+import { useParams } from "react-router-dom"
+
+import {
+ RouteFocusModal,
+ useRouteModal,
+} from "../../../components/modals"
+import { useAttribute, attributesQueryKeys } from "../../../hooks/api/attributes"
+import { sdk } from "../../../lib/client"
+import { queryClient } from "../../../lib/query-client"
+import { ATTRIBUTE_DETAIL_FIELDS } from "../attribute-detail/constants"
+
+type RankingItem = {
+ id: string
+ value: string
+ rank: number
+}
+
+const SortableRankingItem = ({ item }: { item: RankingItem }) => {
+ const { attributes, listeners, setNodeRef, transform, transition } =
+ useSortable({ id: item.id })
+
+ const style = {
+ transform: CSS.Transform.toString(transform),
+ transition,
+ }
+
+ return (
+ <div
+ ref={setNodeRef}
+ style={style}
+ className="flex items-center gap-x-3 border-b px-6 py-3 last:border-b-0"
+ >
+ <button
+ type="button"
+ className="cursor-grab text-ui-fg-muted"
+ {...attributes}
+ {...listeners}
+ >
+ <DotsSix />
+ </button>
+ <Tag className="text-ui-fg-interactive" />
+ <Text size="small">{item.value}</Text>
+ </div>
+ )
+}
+
+const EditRankingInner = () => {
+ const { id } = useParams()
+ const { t } = useTranslation()
+ const { handleSuccess } = useRouteModal()
+
+ const { attribute, isPending: isLoading } = useAttribute(id!, {
+ fields: ATTRIBUTE_DETAIL_FIELDS,
+ })
+
+ const existingValues: RankingItem[] = (attribute?.possible_values ?? [])
+ .sort((a: any, b: any) => (a.rank ?? 0) - (b.rank ?? 0))
+ .map((v: any) => ({
+ id: v.id,
+ value: v.value,
+ rank: v.rank,
+ }))
+
+ const [items, setItems] = useState<RankingItem[]>([])
+ const [initialized, setInitialized] = useState(false)
+
+ if (!initialized && existingValues.length > 0) {
+ setItems(existingValues)
+ setInitialized(true)
+ }
+
+ const sensors = useSensors(
+ useSensor(PointerSensor),
+ useSensor(KeyboardSensor, {
+ coordinateGetter: sortableKeyboardCoordinates,
+ })
+ )
+
+ const handleDragEnd = (event: DragEndEvent) => {
+ const { active, over } = event
+ if (!over || active.id === over.id) return
+
+ setItems((prev) => {
+ const oldIndex = prev.findIndex((item) => item.id === active.id)
+ const newIndex = prev.findIndex((item) => item.id === over.id)
+ return arrayMove(prev, oldIndex, newIndex)
+ })
+ }
+
+ const [isSaving, setIsSaving] = useState(false)
+
+ const handleSave = async () => {
+ setIsSaving(true)
+ try {
+ const updates = items
+ .map((item, index) => ({
+ id: item.id,
+ newRank: index + 1,
+ oldRank: existingValues.find((v) => v.id === item.id)?.rank,
+ }))
+ .filter((u) => u.newRank !== u.oldRank)
+
+ for (const update of updates) {
+ await sdk.admin.attributes.$id.values.$valueId.mutate({
+ $id: id!,
+ $valueId: update.id,
+ rank: update.newRank,
+ })
+ }
+
+ queryClient.invalidateQueries({
+ queryKey: attributesQueryKeys.detail(id!),
+ })
+
+ toast.success(t("attributes.editRanking.successToast", "Ranking updated successfully."))
+ handleSuccess()
+ } catch (err: any) {
+ toast.error(err.message)
+ } finally {
+ setIsSaving(false)
+ }
+ }
+
+ if (isLoading || !attribute) {
+ return null
+ }
+
+ return (
+ <>
+ <RouteFocusModal.Header />
+ <RouteFocusModal.Body className="flex flex-1 flex-col overflow-auto">
+ <DndContext
+ sensors={sensors}
+ collisionDetection={closestCenter}
+ onDragEnd={handleDragEnd}
+ >
+ <SortableContext
+ items={items.map((i) => i.id)}
+ strategy={verticalListSortingStrategy}
+ >
+ {items.map((item) => (
+ <SortableRankingItem key={item.id} item={item} />
+ ))}
+ </SortableContext>
+ </DndContext>
+ </RouteFocusModal.Body>
+ <RouteFocusModal.Footer>
+ <div className="flex items-center justify-end gap-x-2">
+ <RouteFocusModal.Close asChild>
+ <Button variant="secondary" size="small">
+ {t("actions.cancel")}
+ </Button>
+ </RouteFocusModal.Close>
+ <Button
+ size="small"
+ onClick={handleSave}
+ isLoading={isSaving}
+ >
+ {t("actions.save")}
+ </Button>
+ </div>
+ </RouteFocusModal.Footer>
+ </>
+ )
+}
+
+export const AttributeEditRanking = () => {
+ return (
+ <RouteFocusModal>
+ <EditRankingInner />
+ </RouteFocusModal>
+ )
+}
diff --git a/packages/admin/src/pages/attributes/attribute-edit-ranking/index.ts b/packages/admin/src/pages/attributes/attribute-edit-ranking/index.ts
new file mode 100644
index 000000000..8ea3405bd
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-edit-ranking/index.ts
@@ -0,0 +1 @@
+export { AttributeEditRanking as Component } from "./attribute-edit-ranking"
diff --git a/packages/admin/src/pages/attributes/attribute-edit/attribute-edit.tsx b/packages/admin/src/pages/attributes/attribute-edit/attribute-edit.tsx
new file mode 100644
index 000000000..a938bfa51
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-edit/attribute-edit.tsx
@@ -0,0 +1,277 @@
+import { zodResolver } from "@hookform/resolvers/zod"
+import { Button, Input, Select, Switch, Text, Textarea, toast } from "@medusajs/ui"
+import { HandleInput } from "../../../components/inputs/handle-input"
+import { Heading } from "@medusajs/ui"
+import { useForm } from "react-hook-form"
+import { useTranslation } from "react-i18next"
+import { useParams } from "react-router-dom"
+
+import { Form } from "../../../components/common/form"
+import { Combobox } from "../../../components/inputs/combobox"
+import { RouteDrawer, useRouteModal } from "../../../components/modals"
+import { KeyboundForm } from "../../../components/utilities/keybound-form"
+import { useAttribute, useUpdateAttribute } from "../../../hooks/api/attributes"
+import { useProductCategories } from "../../../hooks/api"
+import { ATTRIBUTE_DETAIL_FIELDS } from "../attribute-detail/constants"
+import { AttributeUIComponent, UpdateAttributeSchema } from "./schema"
+import type { UpdateAttributeFormValues } from "./types"
+
+const UI_COMPONENT_LABELS: Record<string, string> = {
+ select: "Single Select",
+ multivalue: "Multi Select",
+ unit: "Unit",
+ toggle: "Toggle",
+ text_area: "Text",
+}
+
+type AttributeEditFormProps = {
+ attribute: Record<string, any>
+}
+
+const AttributeEditForm = ({ attribute }: AttributeEditFormProps) => {
+ const { t } = useTranslation()
+ const { handleSuccess } = useRouteModal()
+
+ const { product_categories: allCategories } = useProductCategories({
+ limit: 999,
+ })
+
+ const categoryOptions = (allCategories ?? []).map((cat: any) => ({
+ label: cat.name,
+ value: cat.id,
+ }))
+
+ const form = useForm<UpdateAttributeFormValues>({
+ resolver: zodResolver(UpdateAttributeSchema),
+ defaultValues: {
+ name: attribute.name ?? "",
+ handle: attribute.handle ?? "",
+ description: attribute.description ?? "",
+ is_filterable: attribute.is_filterable ?? false,
+ is_required: attribute.is_required ?? false,
+ ui_component: attribute.ui_component ?? "select",
+ product_category_ids: (attribute.product_categories ?? []).map(
+ (cat: any) => cat.id
+ ),
+ },
+ })
+
+ const { mutateAsync, isPending: isMutating } = useUpdateAttribute(attribute.id)
+
+ const handleSubmit = form.handleSubmit(async (data) => {
+ await mutateAsync(data, {
+ onSuccess: () => {
+ toast.success(
+ t("attributes.edit.successToast", { name: data.name || attribute.name })
+ )
+ handleSuccess()
+ },
+ onError: (err) => {
+ toast.error(err.message)
+ },
+ })
+ })
+
+ return (
+ <RouteDrawer.Form form={form} data-testid="attribute-edit-form">
+ <KeyboundForm
+ className="flex size-full flex-col overflow-hidden"
+ onSubmit={handleSubmit}
+ >
+ <RouteDrawer.Body
+ className="flex flex-1 flex-col gap-y-6 overflow-auto"
+ data-testid="attribute-edit-form-body"
+ >
+ <Form.Field
+ control={form.control}
+ name="name"
+ render={({ field }) => (
+ <Form.Item data-testid="attribute-edit-name-field">
+ <Form.Label>{t("attributes.fields.name")}</Form.Label>
+ <Form.Control>
+ <Input {...field} size="small" />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+
+ <Form.Field
+ control={form.control}
+ name="handle"
+ render={({ field }) => (
+ <Form.Item data-testid="attribute-edit-handle-field">
+ <Form.Label optional>{t("attributes.fields.handle")}</Form.Label>
+ <Form.Control>
+ <HandleInput {...field} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+
+ <Form.Field
+ control={form.control}
+ name="description"
+ render={({ field }) => (
+ <Form.Item data-testid="attribute-edit-description-field">
+ <Form.Label optional>{t("attributes.fields.description")}</Form.Label>
+ <Form.Control>
+ <Textarea {...field} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+
+ <Form.Field
+ control={form.control}
+ name="ui_component"
+ render={({ field }) => (
+ <Form.Item data-testid="attribute-edit-ui-component-field">
+ <Form.Label>{t("attributes.fields.type")}</Form.Label>
+ <Form.Control>
+ <Select
+ value={field.value as string}
+ onValueChange={field.onChange}
+ >
+ <Select.Trigger>
+ <Select.Value />
+ </Select.Trigger>
+ <Select.Content>
+ {Object.values(AttributeUIComponent).map((component) => (
+ <Select.Item key={component} value={component}>
+ {UI_COMPONENT_LABELS[component] ?? component}
+ </Select.Item>
+ ))}
+ </Select.Content>
+ </Select>
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+
+ <Form.Field
+ control={form.control}
+ name="is_filterable"
+ render={({ field }) => (
+ <Form.Item data-testid="attribute-edit-filterable-field">
+ <div className="rounded-lg bg-ui-bg-component p-4 shadow-elevation-card-rest">
+ <div className="flex gap-3">
+ <Form.Control>
+ <Switch
+ checked={field.value as boolean}
+ onCheckedChange={field.onChange}
+ className="mt-1"
+ />
+ </Form.Control>
+ <div>
+ <Form.Label>
+ {t("attributes.fields.filterable")}
+ </Form.Label>
+ <Text className="mt-1 text-xs text-ui-fg-subtle">
+ {t("attributes.hints.filterable", "If checked, buyers will be able to filter products using this attribute.")}
+ </Text>
+ </div>
+ </div>
+ </div>
+ </Form.Item>
+ )}
+ />
+
+ <Form.Field
+ control={form.control}
+ name="is_required"
+ render={({ field }) => (
+ <Form.Item data-testid="attribute-edit-required-field">
+ <div className="rounded-lg bg-ui-bg-component p-4 shadow-elevation-card-rest">
+ <div className="flex gap-3">
+ <Form.Control>
+ <Switch
+ checked={field.value as boolean}
+ onCheckedChange={field.onChange}
+ className="mt-1"
+ />
+ </Form.Control>
+ <div>
+ <Form.Label>
+ {t("attributes.fields.required")}
+ </Form.Label>
+ <Text className="mt-1 text-xs text-ui-fg-subtle">
+ {t("attributes.hints.required", "If checked, vendors must set a value for this attribute.")}
+ </Text>
+ </div>
+ </div>
+ </div>
+ </Form.Item>
+ )}
+ />
+
+ <Form.Field
+ control={form.control}
+ name="product_category_ids"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>
+ {t("attributes.fields.category")}
+ </Form.Label>
+ <Form.Control>
+ <Combobox
+ options={categoryOptions}
+ {...field}
+ value={field.value ?? []}
+ />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ </RouteDrawer.Body>
+
+ <RouteDrawer.Footer data-testid="attribute-edit-form-footer">
+ <div className="flex items-center justify-end gap-x-2">
+ <RouteDrawer.Close asChild>
+ <Button variant="secondary" size="small" type="button">
+ {t("actions.cancel")}
+ </Button>
+ </RouteDrawer.Close>
+ <Button size="small" type="submit" isLoading={isMutating}>
+ {t("actions.save")}
+ </Button>
+ </div>
+ </RouteDrawer.Footer>
+ </KeyboundForm>
+ </RouteDrawer.Form>
+ )
+}
+
+export const AttributeEdit = () => {
+ const { id } = useParams()
+
+ const { attribute, isPending, isError, error } = useAttribute(id!, {
+ fields: ATTRIBUTE_DETAIL_FIELDS,
+ })
+
+ if (isError) {
+ throw error
+ }
+
+ if (isPending || !attribute) {
+ return null
+ }
+
+ return (
+ <RouteDrawer data-testid="attribute-edit-drawer">
+ <RouteDrawer.Header>
+ <RouteDrawer.Title asChild>
+ <Heading>{attribute.name}</Heading>
+ </RouteDrawer.Title>
+ <RouteDrawer.Description className="sr-only">
+ Edit attribute
+ </RouteDrawer.Description>
+ </RouteDrawer.Header>
+ <AttributeEditForm attribute={attribute} />
+ </RouteDrawer>
+ )
+}
diff --git a/packages/admin/src/pages/attributes/attribute-edit/components/attribute-form.tsx b/packages/admin/src/pages/attributes/attribute-edit/components/attribute-form.tsx
new file mode 100644
index 000000000..71ed8f26e
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-edit/components/attribute-form.tsx
@@ -0,0 +1,472 @@
+import { forwardRef, useEffect, useMemo, useImperativeHandle, useState } from "react"
+import { zodResolver } from "@hookform/resolvers/zod"
+import {
+ InlineTip,
+ Input,
+ Select,
+ Switch,
+ Text,
+ Textarea,
+} from "@medusajs/ui"
+import { FormProvider, useForm, useWatch } from "react-hook-form"
+import { useTranslation } from "react-i18next"
+
+import type { AdminProductCategory } from "@medusajs/types"
+import { AttributeDTO } from "@mercurjs/types"
+import { Form } from "../../../../components/common/form"
+import {
+ AttributeUIComponent,
+ CreateAttributeSchema,
+ UpdateAttributeSchema,
+} from "../schema"
+import type {
+ CreateAttributeFormValues,
+ UpdateAttributeFormValues,
+} from "../types"
+import { MultiSelectCategory } from "../../attribute-create/components/multi-select-category"
+import { PossibleValuesList } from "../../attribute-create/components/possible-values-list"
+
+export interface AttributeFormRef {
+ validateFields: (fields: string[]) => Promise<boolean>
+}
+
+export interface AttributeFormProps {
+ initialData?: AttributeDTO
+ onSubmit: (
+ data: CreateAttributeFormValues | UpdateAttributeFormValues
+ ) => Promise<void>
+ categories?: AdminProductCategory[]
+ mode?: "create" | "update"
+ activeTab?: "details" | "type"
+ onFormStateChange?: (formState: {
+ detailsStatus: "not-started" | "in-progress" | "completed"
+ typeStatus: "not-started" | "in-progress" | "completed"
+ }) => void
+}
+
+const UI_COMPONENT_LABELS: Record<string, string> = {
+ select: "Single Select",
+ multivalue: "Multi Select",
+ unit: "Unit",
+ toggle: "Toggle",
+ text_area: "Text",
+}
+
+export const AttributeForm = forwardRef<AttributeFormRef, AttributeFormProps>(
+ (
+ {
+ initialData,
+ onSubmit,
+ categories,
+ mode = "create",
+ activeTab = "details",
+ onFormStateChange,
+ },
+ ref
+ ) => {
+ const { t } = useTranslation()
+ const [showCategorySection, setShowCategorySection] = useState(
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ ((initialData as any)?.product_categories?.length || 0) > 0
+ )
+
+ const form = useForm<CreateAttributeFormValues | UpdateAttributeFormValues>({
+ resolver: zodResolver(
+ mode === "create" ? CreateAttributeSchema : UpdateAttributeSchema
+ ),
+ defaultValues: {
+ name: initialData?.name ?? "",
+ description: initialData?.description ?? "",
+ handle: initialData?.handle ?? "",
+ ui_component:
+ (initialData?.ui_component as
+ | "select"
+ | "multivalue"
+ | "unit"
+ | "toggle"
+ | "text_area"
+ | undefined) ?? AttributeUIComponent.SELECT,
+ is_filterable: initialData?.is_filterable ?? false,
+ is_required: initialData?.is_required ?? false,
+ possible_values: initialData?.possible_values?.map((v) => ({
+ id: v.id,
+ value: v.value,
+ rank: v.rank,
+ })) ?? [],
+ product_category_ids: [],
+ metadata: {},
+ },
+ })
+
+ const handleSubmit = form.handleSubmit(async (data) => {
+ try {
+ await onSubmit(data)
+ } catch (error) {
+ console.error(error)
+ }
+ })
+
+ useImperativeHandle(ref, () => ({
+ validateFields: async (fields: string[]) => {
+ const result = await form.trigger(
+ fields as (keyof (
+ | CreateAttributeFormValues
+ | UpdateAttributeFormValues
+ ))[]
+ )
+ return result
+ },
+ }))
+
+ const [name, description, handle, uiComponent, possibleValues] = useWatch({
+ control: form.control,
+ name: [
+ "name",
+ "description",
+ "handle",
+ "ui_component",
+ "possible_values",
+ ],
+ })
+
+ const formStateKey = useMemo(() => {
+ return JSON.stringify({
+ name,
+ description,
+ handle,
+ uiComponent,
+ valuesCount: possibleValues?.length ?? 0,
+ })
+ }, [name, description, handle, uiComponent, possibleValues])
+
+ useEffect(() => {
+ if (!onFormStateChange) return
+
+ const hasName = name?.trim()
+ const hasDetailsData = description?.trim() || handle?.trim()
+ const detailsStatus = hasName
+ ? "completed"
+ : hasDetailsData
+ ? "in-progress"
+ : "not-started"
+
+ const hasTypeData =
+ uiComponent && (possibleValues?.length ?? 0) > 0
+ const typeStatus = hasTypeData ? "completed" : "not-started"
+
+ onFormStateChange({
+ detailsStatus: detailsStatus as
+ | "not-started"
+ | "in-progress"
+ | "completed",
+ typeStatus: typeStatus as "not-started" | "in-progress" | "completed",
+ })
+ }, [formStateKey, onFormStateChange])
+
+ const renderDetailsTab = () => (
+ <div className="grid gap-6" data-testid="attribute-form-details-tab">
+ <div className="grid grid-cols-1 gap-4 md:grid-cols-2">
+ <Form.Field
+ control={form.control}
+ name="name"
+ render={({ field }) => (
+ <Form.Item data-testid="attribute-form-name-field">
+ <Form.Label data-testid="attribute-form-name-label">
+ {t("attributes.fields.name", "Name")}
+ </Form.Label>
+ <Form.Control data-testid="attribute-form-name-control">
+ <Input
+ {...field}
+ size="small"
+ data-testid="attribute-form-name-input"
+ />
+ </Form.Control>
+ <Form.ErrorMessage data-testid="attribute-form-name-error" />
+ </Form.Item>
+ )}
+ />
+
+ <Form.Field
+ control={form.control}
+ name="handle"
+ render={({ field }) => (
+ <Form.Item data-testid="attribute-form-handle-field">
+ <Form.Label optional data-testid="attribute-form-handle-label">
+ {t("attributes.fields.handle", "Handle")}
+ </Form.Label>
+ <Form.Control data-testid="attribute-form-handle-control">
+ <div className="relative">
+ <Input
+ {...field}
+ size="small"
+ className="pl-9"
+ data-testid="attribute-form-handle-input"
+ />
+ <div className="z-100 absolute bottom-0 left-0 top-0 flex w-7 items-center justify-center border-r border-ui-border-base px-2 text-ui-fg-muted">
+ /
+ </div>
+ </div>
+ </Form.Control>
+ <Form.ErrorMessage data-testid="attribute-form-handle-error" />
+ </Form.Item>
+ )}
+ />
+ </div>
+
+ <div className="grid grid-cols-1 gap-4">
+ <Form.Field
+ control={form.control}
+ name="description"
+ render={({ field }) => (
+ <Form.Item data-testid="attribute-form-description-field">
+ <Form.Label
+ optional
+ data-testid="attribute-form-description-label"
+ >
+ {t("attributes.fields.description", "Description")}
+ </Form.Label>
+ <Form.Control data-testid="attribute-form-description-control">
+ <Textarea
+ {...field}
+ data-testid="attribute-form-description-input"
+ />
+ </Form.Control>
+ <Form.ErrorMessage data-testid="attribute-form-description-error" />
+ </Form.Item>
+ )}
+ />
+
+ <Form.Field
+ control={form.control}
+ name="is_filterable"
+ render={({ field }) => (
+ <Form.Item data-testid="attribute-form-filterable-field">
+ <div className="rounded-lg bg-ui-bg-component p-4 shadow-elevation-card-rest">
+ <div className="flex gap-3">
+ <Form.Control data-testid="attribute-form-filterable-control">
+ <Switch
+ checked={field.value as boolean}
+ onCheckedChange={field.onChange}
+ className="mt-1"
+ data-testid="attribute-form-filterable-switch"
+ />
+ </Form.Control>
+ <div>
+ <Form.Label data-testid="attribute-form-filterable-label">
+ {t(
+ "attributes.fields.isFilterable",
+ "Yes, this is a filterable attribute"
+ )}
+ </Form.Label>
+ <Text className="mt-1 text-xs text-ui-fg-subtle">
+ {t(
+ "attributes.fields.isFilterableHint",
+ "If checked, buyers will be able to filter products using this attribute."
+ )}
+ </Text>
+ </div>
+ </div>
+ </div>
+ </Form.Item>
+ )}
+ />
+
+ <Form.Field
+ control={form.control}
+ name="is_required"
+ render={({ field }) => (
+ <Form.Item data-testid="attribute-form-required-field">
+ <div className="rounded-lg bg-ui-bg-component p-4 shadow-elevation-card-rest">
+ <div className="flex gap-3">
+ <Form.Control data-testid="attribute-form-required-control">
+ <Switch
+ checked={field.value as boolean}
+ onCheckedChange={field.onChange}
+ className="mt-1"
+ data-testid="attribute-form-required-switch"
+ />
+ </Form.Control>
+ <div>
+ <Form.Label data-testid="attribute-form-required-label">
+ {t(
+ "attributes.fields.isRequired",
+ "Yes, this is a required attribute"
+ )}
+ </Form.Label>
+ <Text className="mt-1 text-xs text-ui-fg-subtle">
+ {t(
+ "attributes.fields.isRequiredHint",
+ "If checked, vendors must set a value to this attribute."
+ )}
+ </Text>
+ </div>
+ </div>
+ </div>
+ </Form.Item>
+ )}
+ />
+
+ <Form.Field
+ control={form.control}
+ name="product_category_ids"
+ render={({ field }) => {
+ const categoryIds = (field.value as string[]) ?? []
+ const isGlobal = categoryIds.length === 0 && !showCategorySection
+ return (
+ <Form.Item data-testid="attribute-form-global-field">
+ <div className="rounded-lg bg-ui-bg-component p-4 shadow-elevation-card-rest">
+ <div className="flex gap-3">
+ <Form.Control data-testid="attribute-form-global-control">
+ <Switch
+ checked={isGlobal}
+ onCheckedChange={(checked) => {
+ if (checked) {
+ field.onChange([])
+ setShowCategorySection(false)
+ } else {
+ setShowCategorySection(true)
+ }
+ }}
+ className="mt-1"
+ data-testid="attribute-form-global-switch"
+ />
+ </Form.Control>
+ <div>
+ <Form.Label data-testid="attribute-form-global-label">
+ {t(
+ "attributes.fields.global",
+ "Yes, this is a global attribute"
+ )}
+ </Form.Label>
+ <Text className="mt-1 text-xs text-ui-fg-subtle">
+ {t(
+ "attributes.hints.global",
+ "When enabled, this attribute applies to all products regardless of category."
+ )}
+ </Text>
+ </div>
+ </div>
+ </div>
+
+ {(showCategorySection || categoryIds.length > 0) && (
+ <div className="mt-4" data-testid="attribute-form-category-field">
+ <Form.Label
+ optional
+ data-testid="attribute-form-category-label"
+ >
+ {t("attributes.fields.categories", "Product Categories")}
+ </Form.Label>
+ <div className="mt-1">
+ <MultiSelectCategory
+ categories={categories ?? []}
+ value={categoryIds}
+ onChange={(value) => field.onChange(value)}
+ />
+ </div>
+ <Form.ErrorMessage data-testid="attribute-form-category-error" />
+ <div className="mt-3">
+ <InlineTip label="Warning" variant="warning">
+ {t(
+ "attributes.hints.categoryInheritance",
+ "Child categories will inherit this attribute."
+ )}
+ </InlineTip>
+ </div>
+ </div>
+ )}
+ </Form.Item>
+ )
+ }}
+ />
+ </div>
+ </div>
+ )
+
+ const renderTypeTab = () => (
+ <div
+ className="grid w-full gap-6"
+ data-testid="attribute-form-type-tab"
+ >
+ <Form.Field
+ control={form.control}
+ name="ui_component"
+ render={({ field }) => (
+ <Form.Item data-testid="attribute-form-ui-component-field">
+ <Form.Label data-testid="attribute-form-ui-component-label">
+ {t("attributes.fields.type", "Type")}
+ </Form.Label>
+ <Form.Control data-testid="attribute-form-ui-component-control">
+ <Select
+ value={field.value as string}
+ onValueChange={field.onChange}
+ data-testid="attribute-form-ui-component-select"
+ >
+ <Select.Trigger
+ className="mt-1"
+ data-testid="attribute-form-ui-component-trigger"
+ >
+ <Select.Value
+ placeholder={t(
+ "attributes.fields.typePlaceholder",
+ "Select Type"
+ )}
+ />
+ </Select.Trigger>
+ <Select.Content data-testid="attribute-form-ui-component-content">
+ {Object.values(AttributeUIComponent).map((component) => (
+ <Select.Item
+ key={component}
+ value={component}
+ data-testid={`attribute-form-ui-component-option-${component}`}
+ >
+ {UI_COMPONENT_LABELS[component] ?? component}
+ </Select.Item>
+ ))}
+ </Select.Content>
+ </Select>
+ </Form.Control>
+ <Form.ErrorMessage data-testid="attribute-form-ui-component-error" />
+ </Form.Item>
+ )}
+ />
+
+ {(uiComponent === AttributeUIComponent.SELECT ||
+ uiComponent === AttributeUIComponent.MULTIVALUE) && (
+ <InlineTip label="Tip" variant="info">
+ {uiComponent === AttributeUIComponent.SELECT
+ ? t(
+ "attributes.tips.singleSelect",
+ "When creating Single Select vendor will be able to choose only one value. This type of attribute will be good for product specifications."
+ )
+ : t(
+ "attributes.tips.multiSelect",
+ "When creating Multi Select vendor will be able to choose multiple values."
+ )}
+ </InlineTip>
+ )}
+
+ {(uiComponent === AttributeUIComponent.SELECT ||
+ uiComponent === AttributeUIComponent.MULTIVALUE) && (
+ <div data-testid="attribute-form-possible-values-section">
+ <PossibleValuesList />
+ </div>
+ )}
+ </div>
+ )
+
+ return (
+ <FormProvider {...form}>
+ <form
+ id="attribute-form"
+ onSubmit={handleSubmit}
+ data-testid="attribute-form"
+ >
+ {activeTab === "details" && renderDetailsTab()}
+ {activeTab === "type" && renderTypeTab()}
+ </form>
+ </FormProvider>
+ )
+ }
+)
+
+AttributeForm.displayName = "AttributeForm"
diff --git a/packages/admin/src/pages/attributes/attribute-edit/index.ts b/packages/admin/src/pages/attributes/attribute-edit/index.ts
new file mode 100644
index 000000000..a7f31d6b7
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-edit/index.ts
@@ -0,0 +1 @@
+export { AttributeEdit as Component } from "./attribute-edit"
diff --git a/packages/admin/src/pages/attributes/attribute-edit/schema.ts b/packages/admin/src/pages/attributes/attribute-edit/schema.ts
new file mode 100644
index 000000000..f697964f4
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-edit/schema.ts
@@ -0,0 +1,80 @@
+import { z } from "zod"
+
+export const AttributeUIComponent = {
+ SELECT: "select",
+ MULTIVALUE: "multivalue",
+ UNIT: "unit",
+ TOGGLE: "toggle",
+ TEXTAREA: "text_area",
+} as const
+
+export const CreateAttributeSchema = z
+ .object({
+ name: z.string().min(1),
+ description: z.string().max(250).optional(),
+ handle: z.string().optional(),
+ is_filterable: z.boolean().default(false),
+ is_required: z.boolean().default(false),
+ ui_component: z
+ .enum(["select", "multivalue", "unit", "toggle", "text_area"])
+ .default("select"),
+ possible_values: z
+ .array(
+ z.object({
+ value: z.string().min(1),
+ rank: z.number(),
+ metadata: z.record(z.string()).optional(),
+ })
+ )
+ .optional(),
+ product_category_ids: z.array(z.string()).optional(),
+ metadata: z.record(z.string()).optional(),
+ })
+ .superRefine((data, ctx) => {
+ if (
+ ["select", "multivalue"].includes(data.ui_component) &&
+ (!data.possible_values || data.possible_values.length === 0)
+ ) {
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ message: "At least one possible value is required for this type.",
+ path: ["possible_values"],
+ })
+ }
+ })
+
+export const UpdateAttributeSchema = z.object({
+ name: z.string().min(1).optional(),
+ description: z.string().max(250).optional(),
+ handle: z.string().optional(),
+ is_filterable: z.boolean().optional(),
+ is_required: z.boolean().optional(),
+ ui_component: z
+ .enum(["select", "multivalue", "unit", "toggle", "text_area"])
+ .optional(),
+ possible_values: z
+ .array(
+ z.object({
+ id: z.string().optional(),
+ value: z.string().min(1),
+ rank: z.number(),
+ metadata: z.record(z.string()).optional(),
+ })
+ )
+ .optional(),
+ product_category_ids: z.array(z.string()).optional(),
+ metadata: z.record(z.string()).optional(),
+})
+
+export const UpdatePossibleValueSchema = z.object({
+ value: z.string().min(1),
+ rank: z.number().min(0).optional(),
+ metadata: z
+ .array(
+ z.object({
+ key: z.string(),
+ value: z.string(),
+ })
+ )
+ .default([]),
+})
diff --git a/packages/admin/src/pages/attributes/attribute-edit/types.ts b/packages/admin/src/pages/attributes/attribute-edit/types.ts
new file mode 100644
index 000000000..8ca0632e4
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-edit/types.ts
@@ -0,0 +1,12 @@
+import { z } from "zod"
+import {
+ CreateAttributeSchema,
+ UpdateAttributeSchema,
+ UpdatePossibleValueSchema,
+} from "./schema"
+
+export type CreateAttributeFormValues = z.infer<typeof CreateAttributeSchema>
+export type UpdateAttributeFormValues = z.infer<typeof UpdateAttributeSchema>
+export type UpdatePossibleValueFormValues = z.infer<
+ typeof UpdatePossibleValueSchema
+>
diff --git a/packages/admin/src/pages/attributes/attribute-list/attribute-list.tsx b/packages/admin/src/pages/attributes/attribute-list/attribute-list.tsx
new file mode 100644
index 000000000..16e0dfe2c
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-list/attribute-list.tsx
@@ -0,0 +1,26 @@
+import { ReactNode, Children } from "react"
+
+import { SingleColumnPage } from "../../../components/layout/pages"
+import {
+ AttributeListView,
+ AttributeListDataTable,
+ AttributeListHeader,
+ AttributeListActions,
+ AttributeListTitle,
+} from "./components/attribute-list-view"
+
+const Root = ({ children }: { children?: ReactNode }) => {
+ return (
+ <SingleColumnPage showMetadata={false} showJSON={false} hasOutlet>
+ {Children.count(children) > 0 ? children : <AttributeListView />}
+ </SingleColumnPage>
+ )
+}
+
+export const AttributeListPage = Object.assign(Root, {
+ Table: AttributeListView,
+ Header: AttributeListHeader,
+ HeaderTitle: AttributeListTitle,
+ HeaderActions: AttributeListActions,
+ DataTable: AttributeListDataTable,
+})
diff --git a/packages/admin/src/pages/attributes/attribute-list/components/attribute-list-view/attribute-list-data-table.tsx b/packages/admin/src/pages/attributes/attribute-list/components/attribute-list-view/attribute-list-data-table.tsx
new file mode 100644
index 000000000..ec090a03b
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-list/components/attribute-list-view/attribute-list-data-table.tsx
@@ -0,0 +1,63 @@
+import { keepPreviousData } from "@tanstack/react-query"
+import { useTranslation } from "react-i18next"
+
+import { _DataTable } from "../../../../../components/table/data-table"
+import { useAttributes } from "../../../../../hooks/api"
+import { useAttributeTableColumns } from "../../../../../hooks/table/columns/use-attribute-table-columns"
+import { useAttributeTableFilters } from "../../../../../hooks/table/filters/use-attribute-table-filters"
+import { useAttributeTableQuery } from "../../../../../hooks/table/query/use-attribute-table-query"
+import { useDataTable } from "../../../../../hooks/use-data-table"
+
+const PAGE_SIZE = 20
+
+export const AttributeListDataTable = () => {
+ const { t } = useTranslation()
+
+ const { searchParams, raw } = useAttributeTableQuery({ pageSize: PAGE_SIZE })
+ const { attributes, count, isPending, isError, error } = useAttributes(
+ searchParams,
+ {
+ placeholderData: keepPreviousData,
+ }
+ )
+
+ const filters = useAttributeTableFilters()
+ const columns = useAttributeTableColumns()
+
+ const { table } = useDataTable({
+ data: attributes ?? [],
+ count,
+ columns,
+ getRowId: (row) => row.id,
+ pageSize: PAGE_SIZE,
+ enablePagination: true,
+ })
+
+ if (isError) {
+ throw error
+ }
+
+ return (
+ <_DataTable
+ table={table}
+ columns={columns}
+ count={count}
+ pageSize={PAGE_SIZE}
+ isLoading={isPending}
+ filters={filters}
+ orderBy={[
+ { key: "name", label: t("fields.name") },
+ { key: "created_at", label: t("fields.createdAt") },
+ { key: "updated_at", label: t("fields.updatedAt") },
+ ]}
+ navigateTo={(row) => row.original.id}
+ pagination
+ search
+ queryObject={raw}
+ noRecords={{
+ message: t("attributes.list.noRecordsMessage"),
+ }}
+ data-testid="attribute-list-table"
+ />
+ )
+}
diff --git a/packages/admin/src/pages/attributes/attribute-list/components/attribute-list-view/attribute-list-header.tsx b/packages/admin/src/pages/attributes/attribute-list/components/attribute-list-view/attribute-list-header.tsx
new file mode 100644
index 000000000..ac8954807
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-list/components/attribute-list-view/attribute-list-header.tsx
@@ -0,0 +1,59 @@
+import { Children, ReactNode } from "react"
+import { Button, Heading } from "@medusajs/ui"
+import { useTranslation } from "react-i18next"
+import { Link } from "react-router-dom"
+
+export const AttributeListTitle = () => {
+ const { t } = useTranslation()
+ return (
+ <Heading data-testid="attribute-list-table-heading">
+ {t("attributes.list.title")}
+ </Heading>
+ )
+}
+
+export const AttributeListActions = ({
+ children,
+}: {
+ children?: ReactNode
+}) => {
+ const { t } = useTranslation()
+ return (
+ <div className="flex items-center justify-center gap-x-2">
+ {Children.count(children) > 0 ? (
+ children
+ ) : (
+ <Button
+ variant="secondary"
+ size="small"
+ asChild
+ data-testid="attribute-list-table-create-button"
+ >
+ <Link to="create">{t("actions.create")}</Link>
+ </Button>
+ )}
+ </div>
+ )
+}
+
+export const AttributeListHeader = ({
+ children,
+}: {
+ children?: ReactNode
+}) => {
+ return (
+ <div
+ className="flex items-center justify-between px-6 py-4"
+ data-testid="attribute-list-table-header"
+ >
+ {Children.count(children) > 0 ? (
+ children
+ ) : (
+ <>
+ <AttributeListTitle />
+ <AttributeListActions />
+ </>
+ )}
+ </div>
+ )
+}
diff --git a/packages/admin/src/pages/attributes/attribute-list/components/attribute-list-view/attribute-list-view.tsx b/packages/admin/src/pages/attributes/attribute-list/components/attribute-list-view/attribute-list-view.tsx
new file mode 100644
index 000000000..7d032375e
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-list/components/attribute-list-view/attribute-list-view.tsx
@@ -0,0 +1,31 @@
+import { ReactNode, Children } from "react"
+import { Container } from "@medusajs/ui"
+
+import { AttributeListDataTable } from "./attribute-list-data-table"
+import { AttributeListHeader } from "./attribute-list-header"
+
+export { AttributeListDataTable } from "./attribute-list-data-table"
+export {
+ AttributeListHeader,
+ AttributeListTitle,
+ AttributeListActions,
+} from "./attribute-list-header"
+
+export const AttributeListView = ({
+ children,
+}: {
+ children?: ReactNode
+}) => {
+ return (
+ <Container className="divide-y p-0">
+ {Children.count(children) > 0 ? (
+ children
+ ) : (
+ <>
+ <AttributeListHeader />
+ <AttributeListDataTable />
+ </>
+ )}
+ </Container>
+ )
+}
diff --git a/packages/admin/src/pages/attributes/attribute-list/components/attribute-list-view/index.ts b/packages/admin/src/pages/attributes/attribute-list/components/attribute-list-view/index.ts
new file mode 100644
index 000000000..287e977b7
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-list/components/attribute-list-view/index.ts
@@ -0,0 +1 @@
+export * from "./attribute-list-view"
diff --git a/packages/admin/src/pages/attributes/attribute-list/index.ts b/packages/admin/src/pages/attributes/attribute-list/index.ts
new file mode 100644
index 000000000..5fa3ccf84
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-list/index.ts
@@ -0,0 +1,2 @@
+export { attributeListLoader as loader } from "./loader"
+export { AttributeListPage as Component } from "./attribute-list"
diff --git a/packages/admin/src/pages/attributes/attribute-list/loader.ts b/packages/admin/src/pages/attributes/attribute-list/loader.ts
new file mode 100644
index 000000000..421512a45
--- /dev/null
+++ b/packages/admin/src/pages/attributes/attribute-list/loader.ts
@@ -0,0 +1,24 @@
+import { LoaderFunctionArgs } from "react-router-dom"
+
+import { attributesQueryKeys } from "../../../hooks/api"
+import { sdk } from "../../../lib/client"
+import { queryClient } from "../../../lib/query-client"
+
+const attributeListQuery = () => ({
+ queryKey: attributesQueryKeys.lists(),
+ queryFn: async () =>
+ sdk.admin.attributes.query({
+ limit: 20,
+ offset: 0,
+ fields: "*possible_values,*product_categories",
+ }),
+})
+
+export const attributeListLoader = async (_args: LoaderFunctionArgs) => {
+ const query = attributeListQuery()
+
+ return (
+ queryClient.getQueryData<any>(query.queryKey) ??
+ (await queryClient.fetchQuery(query))
+ )
+}
diff --git a/packages/admin/src/pages/index.ts b/packages/admin/src/pages/index.ts
index c7a1369d1..9d584027c 100644
--- a/packages/admin/src/pages/index.ts
+++ b/packages/admin/src/pages/index.ts
@@ -1,4 +1,5 @@
export * from "./api-key-management"
+export * from "./attributes/attribute-list"
export * from "./campaigns"
export * from "./categories"
export * from "./collections"
diff --git a/packages/core-plugin/.mercur/_generated/index.ts b/packages/core-plugin/.mercur/_generated/index.ts
index 1bda799f1..4eb7bb0ba 100644
--- a/packages/core-plugin/.mercur/_generated/index.ts
+++ b/packages/core-plugin/.mercur/_generated/index.ts
@@ -443,6 +443,13 @@ export type Routes = {
unterminate: typeof import("../../src/api/admin/sellers/[id]/unterminate/route");
};
};
+ attributes: typeof import("../../src/api/admin/attributes/route") & {
+ $id: typeof import("../../src/api/admin/attributes/[id]/route") & {
+ values: typeof import("../../src/api/admin/attributes/[id]/values/route") & {
+ $valueId: typeof import("../../src/api/admin/attributes/[id]/values/[value_id]/route");
+ };
+ };
+ };
subscriptionPlans: typeof import("../../src/api/admin/subscription-plans/route") & {
$id: typeof import("../../src/api/admin/subscription-plans/[id]/route") & {
overrides: typeof import("../../src/api/admin/subscription-plans/[id]/overrides/route") & {
@@ -635,7 +642,12 @@ export type Routes = {
$optionId: typeof import("../../src/api/vendor/products/[id]/options/[option_id]/route");
};
variants: typeof import("../../src/api/vendor/products/[id]/variants/route") & {
- $variantId: typeof import("../../src/api/vendor/products/[id]/variants/[variant_id]/route");
+ $variantId: typeof import("../../src/api/vendor/products/[id]/variants/[variant_id]/route") & {
+ media: typeof import("../../src/api/vendor/products/[id]/variants/[variant_id]/media/route");
+ };
+ };
+ attributes: typeof import("../../src/api/vendor/products/[id]/attributes/route") & {
+ $attributeId: typeof import("../../src/api/vendor/products/[id]/attributes/[attribute_id]/route");
};
};
};
@@ -697,7 +709,7 @@ export type Routes = {
};
};
sellers: typeof import("../../src/api/vendor/sellers/route") & {
- me: typeof import("@mercurjs/core-plugin/api/vendor/sellers/me/route");
+ me: typeof import("../../src/api/vendor/sellers/me/route");
$id: typeof import("../../src/api/vendor/sellers/[id]/route") & {
address: typeof import("../../src/api/vendor/sellers/[id]/address/route");
members: typeof import("../../src/api/vendor/sellers/[id]/members/route") & {
@@ -731,6 +743,7 @@ export type Routes = {
};
};
uploads: typeof import("../../src/api/vendor/uploads/route");
+ attributes: typeof import("../../src/api/vendor/attributes/route");
featureFlags: typeof import("../../src/api/vendor/feature-flags/route");
fulfillmentProviders: typeof import("../../src/api/vendor/fulfillment-providers/route");
members: {
diff --git a/packages/core-plugin/src/api/admin/attributes/[id]/route.ts b/packages/core-plugin/src/api/admin/attributes/[id]/route.ts
new file mode 100644
index 000000000..4809c697e
--- /dev/null
+++ b/packages/core-plugin/src/api/admin/attributes/[id]/route.ts
@@ -0,0 +1,110 @@
+import {
+ MedusaRequest,
+ MedusaResponse,
+} from "@medusajs/framework/http"
+import {
+ ContainerRegistrationKeys,
+ MedusaError,
+ MedusaErrorTypes,
+} from "@medusajs/framework/utils"
+
+import {
+ deleteAttributeWorkflow,
+ updateAttributesWorkflow,
+} from "../../../../workflows/attribute/workflows"
+import {
+ AdminGetAttributeParamsType,
+ AdminUpdateAttributeType,
+} from "../validators"
+
+export const GET = async (
+ req: MedusaRequest<AdminGetAttributeParamsType>,
+ res: MedusaResponse
+) => {
+ const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
+
+ const attributeId = req.params.id
+
+ const {
+ data: [attribute],
+ } = await query.graph(
+ {
+ entity: "attribute",
+ ...req.queryConfig,
+ filters: {
+ id: attributeId,
+ },
+ },
+ { throwIfKeyNotFound: true }
+ )
+
+ return res.json({ attribute })
+}
+
+export const POST = async (
+ req: MedusaRequest<AdminUpdateAttributeType>,
+ res: MedusaResponse
+) => {
+ const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
+
+ const attributeId = req.params.id
+
+ const {
+ data: [existingAttribute],
+ } = await query.graph({
+ entity: "attribute",
+ fields: ["id"],
+ filters: {
+ id: attributeId,
+ },
+ })
+
+ if (!existingAttribute) {
+ throw new MedusaError(
+ MedusaErrorTypes.NOT_FOUND,
+ `Attribute with id '${attributeId}' not found`
+ )
+ }
+
+ await updateAttributesWorkflow(req.scope).run({
+ input: {
+ attributes: [
+ {
+ ...req.validatedBody,
+ id: attributeId,
+ product_category_ids:
+ req.validatedBody.product_category_ids?.map((id) => ({ id })) ||
+ undefined,
+ },
+ ],
+ },
+ })
+
+ const {
+ data: [attribute],
+ } = await query.graph({
+ entity: "attribute",
+ filters: {
+ id: attributeId,
+ },
+ ...req.queryConfig,
+ })
+
+ return res.json({ attribute })
+}
+
+export const DELETE = async (req: MedusaRequest, res: MedusaResponse) => {
+ const attributeId = req.params.id
+
+ await deleteAttributeWorkflow(req.scope).run({
+ input: {
+ id: attributeId,
+ },
+ })
+
+ return res.json({
+ id: attributeId,
+ object: "attribute",
+ deleted: true,
+ })
+}
diff --git a/packages/core-plugin/src/api/admin/attributes/[id]/values/[value_id]/route.ts b/packages/core-plugin/src/api/admin/attributes/[id]/values/[value_id]/route.ts
new file mode 100644
index 000000000..66c8f11fb
--- /dev/null
+++ b/packages/core-plugin/src/api/admin/attributes/[id]/values/[value_id]/route.ts
@@ -0,0 +1,63 @@
+import {
+ MedusaRequest,
+ MedusaResponse,
+} from "@medusajs/framework/http"
+import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
+
+import { updateAttributePossibleValueWorkflow } from "../../../../../../workflows/attribute/workflows"
+import {
+ AdminGetAttributeValueParamsType,
+ AdminUpdateAttributeValueType,
+} from "../../../validators"
+
+export const GET = async (
+ req: MedusaRequest<AdminGetAttributeValueParamsType>,
+ res: MedusaResponse
+) => {
+ const { value_id } = req.params
+ const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
+
+ const {
+ data: [attribute_possible_value],
+ } = await query.graph(
+ {
+ entity: "attribute_possible_value",
+ ...req.queryConfig,
+ filters: {
+ ...req.filterableFields,
+ id: value_id,
+ },
+ },
+ { throwIfKeyNotFound: true }
+ )
+
+ return res.json({ attribute_possible_value })
+}
+
+export const POST = async (
+ req: MedusaRequest<AdminUpdateAttributeValueType>,
+ res: MedusaResponse
+) => {
+ const { value_id } = req.params
+ const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
+
+ await updateAttributePossibleValueWorkflow(req.scope).run({
+ input: {
+ ...req.validatedBody,
+ id: value_id,
+ },
+ })
+
+ const {
+ data: [attribute_possible_value],
+ } = await query.graph({
+ entity: "attribute_possible_value",
+ ...req.queryConfig,
+ filters: {
+ ...req.filterableFields,
+ id: value_id,
+ },
+ })
+
+ return res.json({ attribute_possible_value })
+}
diff --git a/packages/core-plugin/src/api/admin/attributes/[id]/values/route.ts b/packages/core-plugin/src/api/admin/attributes/[id]/values/route.ts
new file mode 100644
index 000000000..f02e2f1cd
--- /dev/null
+++ b/packages/core-plugin/src/api/admin/attributes/[id]/values/route.ts
@@ -0,0 +1,64 @@
+import {
+ MedusaRequest,
+ MedusaResponse,
+} from "@medusajs/framework/http"
+import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
+
+import { createAttributePossibleValuesWorkflow } from "../../../../../workflows/attribute/workflows"
+import {
+ AdminCreateAttributeValueType,
+ AdminGetAttributeValuesParamsType,
+} from "../../validators"
+
+export const GET = async (
+ req: MedusaRequest<AdminGetAttributeValuesParamsType>,
+ res: MedusaResponse
+) => {
+ const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
+
+ const { data: attribute_possible_values, metadata } = await query.graph({
+ entity: "attribute_possible_value",
+ filters: {
+ attribute_id: req.params.id,
+ },
+ ...req.queryConfig,
+ })
+
+ res.status(200).json({
+ attribute_possible_values,
+ count: metadata?.count,
+ offset: metadata?.skip,
+ limit: metadata?.take,
+ })
+}
+
+export const POST = async (
+ req: MedusaRequest<AdminCreateAttributeValueType>,
+ res: MedusaResponse
+) => {
+ const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
+ const attributeId = req.params.id
+
+ const {
+ result: [createdAttributeValue],
+ } = await createAttributePossibleValuesWorkflow(req.scope).run({
+ input: [
+ {
+ ...req.validatedBody,
+ attribute_id: attributeId,
+ },
+ ],
+ })
+
+ const {
+ data: [attribute_possible_value],
+ } = await query.graph({
+ entity: "attribute_possible_value",
+ filters: {
+ id: createdAttributeValue.id,
+ },
+ ...req.queryConfig,
+ })
+
+ return res.status(201).json({ attribute_possible_value })
+}
diff --git a/packages/core-plugin/src/api/admin/attributes/middlewares.ts b/packages/core-plugin/src/api/admin/attributes/middlewares.ts
new file mode 100644
index 000000000..931905989
--- /dev/null
+++ b/packages/core-plugin/src/api/admin/attributes/middlewares.ts
@@ -0,0 +1,104 @@
+import { MiddlewareRoute } from "@medusajs/framework/http"
+import {
+ validateAndTransformBody,
+ validateAndTransformQuery,
+} from "@medusajs/framework"
+
+import * as QueryConfig from "./query-config"
+import {
+ AdminCreateAttribute,
+ AdminCreateAttributeValue,
+ AdminGetAttributeParams,
+ AdminGetAttributeValueParams,
+ AdminGetAttributeValuesParams,
+ AdminGetAttributesParams,
+ AdminUpdateAttribute,
+ AdminUpdateAttributeValue,
+} from "./validators"
+
+export const adminAttributeMiddlewares: MiddlewareRoute[] = [
+ {
+ method: ["GET"],
+ matcher: "/admin/attributes",
+ middlewares: [
+ validateAndTransformQuery(
+ AdminGetAttributesParams,
+ QueryConfig.listAttributeQueryConfig
+ ),
+ ],
+ },
+ {
+ method: ["POST"],
+ matcher: "/admin/attributes",
+ middlewares: [
+ validateAndTransformBody(AdminCreateAttribute),
+ validateAndTransformQuery(
+ AdminGetAttributeParams,
+ QueryConfig.retrieveAttributeQueryConfig
+ ),
+ ],
+ },
+ {
+ method: ["GET"],
+ matcher: "/admin/attributes/:id",
+ middlewares: [
+ validateAndTransformQuery(
+ AdminGetAttributeParams,
+ QueryConfig.retrieveAttributeQueryConfig
+ ),
+ ],
+ },
+ {
+ method: ["POST"],
+ matcher: "/admin/attributes/:id",
+ middlewares: [
+ validateAndTransformBody(AdminUpdateAttribute),
+ validateAndTransformQuery(
+ AdminGetAttributeParams,
+ QueryConfig.retrieveAttributeQueryConfig
+ ),
+ ],
+ },
+ {
+ method: ["GET"],
+ matcher: "/admin/attributes/:id/values",
+ middlewares: [
+ validateAndTransformQuery(
+ AdminGetAttributeValuesParams,
+ QueryConfig.listAttributeValueQueryConfig
+ ),
+ ],
+ },
+ {
+ method: ["POST"],
+ matcher: "/admin/attributes/:id/values",
+ middlewares: [
+ validateAndTransformBody(AdminCreateAttributeValue),
+ validateAndTransformQuery(
+ AdminGetAttributeValueParams,
+ QueryConfig.retrieveAttributeValueQueryConfig
+ ),
+ ],
+ },
+ {
+ method: ["GET"],
+ matcher: "/admin/attributes/:id/values/:value_id",
+ middlewares: [
+ validateAndTransformQuery(
+ AdminGetAttributeValueParams,
+ QueryConfig.retrieveAttributeValueQueryConfig
+ ),
+ ],
+ },
+ {
+ method: ["POST"],
+ matcher: "/admin/attributes/:id/values/:value_id",
+ middlewares: [
+ validateAndTransformBody(AdminUpdateAttributeValue),
+ validateAndTransformQuery(
+ AdminGetAttributeValueParams,
+ QueryConfig.retrieveAttributeValueQueryConfig
+ ),
+ ],
+ },
+]
diff --git a/packages/core-plugin/src/api/admin/attributes/query-config.ts b/packages/core-plugin/src/api/admin/attributes/query-config.ts
new file mode 100644
index 000000000..e31a1108f
--- /dev/null
+++ b/packages/core-plugin/src/api/admin/attributes/query-config.ts
@@ -0,0 +1,42 @@
+export const defaultAdminAttributeFields = [
+ "id",
+ "name",
+ "description",
+ "handle",
+ "is_filterable",
+ "is_required",
+ "ui_component",
+ "metadata",
+ "*possible_values",
+ "product_categories.id",
+ "product_categories.name",
+]
+
+export const retrieveAttributeQueryConfig = {
+ defaults: defaultAdminAttributeFields,
+ isList: false,
+}
+
+export const listAttributeQueryConfig = {
+ ...retrieveAttributeQueryConfig,
+ defaultLimit: 50,
+ isList: true,
+}
+
+export const defaultAdminAttributeValueFields = [
+ "id",
+ "value",
+ "rank",
+ "metadata",
+]
+
+export const retrieveAttributeValueQueryConfig = {
+ defaults: defaultAdminAttributeValueFields,
+ isList: false,
+}
+
+export const listAttributeValueQueryConfig = {
+ ...retrieveAttributeValueQueryConfig,
+ isList: true,
+ defaultLimit: 50,
+}
diff --git a/packages/core-plugin/src/api/admin/attributes/route.ts b/packages/core-plugin/src/api/admin/attributes/route.ts
new file mode 100644
index 000000000..270a8cb8f
--- /dev/null
+++ b/packages/core-plugin/src/api/admin/attributes/route.ts
@@ -0,0 +1,67 @@
+import {
+ MedusaRequest,
+ MedusaResponse,
+} from "@medusajs/framework/http"
+import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
+
+import categoryAttributeLink from "../../../links/category-attribute-link"
+import { createAttributesWorkflow } from "../../../workflows/attribute/workflows"
+import {
+ AdminCreateAttributeType,
+ AdminGetAttributesParamsType,
+} from "./validators"
+
+export const GET = async (
+ req: MedusaRequest<AdminGetAttributesParamsType>,
+ res: MedusaResponse
+) => {
+ const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
+
+ const { is_global, ...filterableFields } = req.filterableFields
+
+ if (is_global) {
+ const { data: attributes } = await query.graph({
+ entity: categoryAttributeLink.entryPoint,
+ fields: ["attribute_id"],
+ })
+ const attributeIds = attributes.map((attribute) => attribute.attribute_id)
+ filterableFields["id"] = {
+ $nin: attributeIds,
+ }
+ }
+
+ const { data: attributes, metadata } = await query.graph({
+ entity: "attribute",
+ filters: filterableFields,
+ ...req.queryConfig,
+ })
+
+ return res.json({
+ attributes,
+ count: metadata?.count,
+ offset: metadata?.skip,
+ limit: metadata?.take,
+ })
+}
+
+export const POST = async (
+ req: MedusaRequest<AdminCreateAttributeType>,
+ res: MedusaResponse
+) => {
+ const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
+ const { result } = await createAttributesWorkflow(req.scope).run({
+ input: { attributes: [req.validatedBody] },
+ })
+
+ const {
+ data: [attribute],
+ } = await query.graph({
+ entity: "attribute",
+ filters: {
+ id: result[0].id,
+ },
+ ...req.queryConfig,
+ })
+
+ res.status(201).json({ attribute })
+}
diff --git a/packages/core-plugin/src/api/admin/attributes/validators.ts b/packages/core-plugin/src/api/admin/attributes/validators.ts
new file mode 100644
index 000000000..b744a412c
--- /dev/null
+++ b/packages/core-plugin/src/api/admin/attributes/validators.ts
@@ -0,0 +1,126 @@
+import { z } from "zod"
+
+import { applyAndAndOrOperators } from "@medusajs/medusa/api/utils/common-validators/common"
+import {
+ WithAdditionalData,
+ createFindParams,
+ createOperatorMap,
+ createSelectParams,
+} from "@medusajs/medusa/api/utils/validators"
+
+enum AttributeUIComponent {
+ SELECT = "select",
+ MULTIVALUE = "multivalue",
+ UNIT = "unit",
+ TOGGLE = "toggle",
+ TEXTAREA = "text_area",
+ COLOR_PICKER = "color_picker",
+}
+
+export type AdminGetAttributeValueParamsType = z.infer<
+ typeof AdminGetAttributeValueParams
+>
+export const AdminGetAttributeValueParams = createSelectParams()
+
+export type AdminGetAttributeValuesParamsType = z.infer<
+ typeof AdminGetAttributeValueParams
+>
+export const AdminGetAttributeValuesParams = createFindParams()
+
+export type AdminGetAttributeParamsType = z.infer<
+ typeof AdminGetAttributeParams
+>
+export const AdminGetAttributeParams = createSelectParams()
+
+export const GetAttributesParams = z.object({
+ id: z.string().optional(),
+ name: z.string().optional(),
+ handle: z.string().optional(),
+ is_required: z.preprocess((val) => {
+ if (val === "true") return true
+ if (val === "false") return false
+ return val
+ }, z.boolean().optional()),
+ is_filterable: z.preprocess((val) => {
+ if (val === "true") return true
+ if (val === "false") return false
+ return val
+ }, z.boolean().optional()),
+ created_at: createOperatorMap().optional(),
+ updated_at: createOperatorMap().optional(),
+ deleted_at: createOperatorMap().optional(),
+ ui_component: z.nativeEnum(AttributeUIComponent).optional(),
+})
+export type AdminGetAttributesParamsType = z.infer<
+ typeof AdminGetAttributesParams
+>
+export const AdminGetAttributesParams = createFindParams({
+ offset: 0,
+ limit: 50,
+})
+ .merge(applyAndAndOrOperators(GetAttributesParams))
+ .merge(GetAttributesParams)
+
+export type AdminCreateAttributeValueType = z.infer<
+ typeof AdminCreateAttributeValue
+>
+export const AdminCreateAttributeValue = z.object({
+ value: z.string().min(1),
+ rank: z.number(),
+ metadata: z.record(z.unknown()).optional(),
+})
+
+export type AdminUpdateAttributeValueType = z.infer<
+ typeof AdminUpdateAttributeValue
+>
+export const AdminUpdateAttributeValue = z.object({
+ id: z.string().optional(),
+ value: z.string().optional(),
+ rank: z.number().optional(),
+ metadata: z.record(z.unknown()).optional(),
+})
+
+export type AdminUpdateAttributeType = z.infer<typeof AdminUpdateAttribute>
+export const AdminUpdateAttribute = z
+ .object({
+ name: z.string().optional(),
+ description: z.string().optional(),
+ handle: z.string().optional(),
+ is_filterable: z.boolean().optional(),
+ is_required: z.boolean().optional(),
+ metadata: z.record(z.unknown()).optional(),
+ ui_component: z.nativeEnum(AttributeUIComponent).optional(),
+ product_category_ids: z.array(z.string()).optional(),
+ possible_values: z.array(AdminUpdateAttributeValue).optional(),
+ })
+ .strict()
+
+export type AdminCreateAttributeType = z.infer<typeof CreateAttribute>
+export const CreateAttribute = z.object({
+ name: z.string().min(1),
+ description: z.string().optional(),
+ is_filterable: z.boolean().optional(),
+ is_required: z.boolean().optional(),
+ ui_component: z
+ .nativeEnum(AttributeUIComponent)
+ .default(AttributeUIComponent.SELECT),
+ handle: z.string().optional(),
+ metadata: z.record(z.unknown()).optional(),
+ possible_values: z.array(AdminCreateAttributeValue).optional(),
+ product_category_ids: z.array(z.string()).optional(),
+})
+
+export const AdminCreateAttribute = WithAdditionalData(
+ CreateAttribute,
+ (schema) => {
+ return schema.refine(
+ (data) =>
+ data.ui_component !== AttributeUIComponent.SELECT ||
+ (data.possible_values && data.possible_values.length > 0),
+ {
+ message: "Possible values are required when ui_component is SELECT",
+ path: ["possible_values"],
+ }
+ )
+ }
+)
diff --git a/packages/core-plugin/src/api/admin/middlewares.ts b/packages/core-plugin/src/api/admin/middlewares.ts
index d816896db..bd007aee9 100644
--- a/packages/core-plugin/src/api/admin/middlewares.ts
+++ b/packages/core-plugin/src/api/admin/middlewares.ts
@@ -12,6 +12,7 @@ import { adminOrderGroupQueryConfig } from "./order-groups/query-config"
import { AdminGetOrderGroupParams } from "./order-groups/validators"
import { adminPayoutsMiddlewares } from "./payouts/middlewares"
import { adminSellersMiddlewares } from "./sellers/middlewares"
+import { adminAttributeMiddlewares } from "./attributes/middlewares"
import { adminCommissionRatesMiddlewares } from "./commission-rates/middlewares"
import { adminSubscriptionPlanRoutesMiddlewares } from "./subscription-plans/middlewares"
@@ -52,6 +53,7 @@ const maybeApplySellerOrderFilter = (
}
export const adminMiddlewares: MiddlewareRoute[] = [
+ ...adminAttributeMiddlewares,
...adminOrderGroupsMiddlewares,
{
method: ["GET"],
diff --git a/packages/core-plugin/src/api/admin/sellers/route.ts b/packages/core-plugin/src/api/admin/sellers/route.ts
index c6134ec33..0f2e594a5 100644
--- a/packages/core-plugin/src/api/admin/sellers/route.ts
+++ b/packages/core-plugin/src/api/admin/sellers/route.ts
@@ -46,7 +46,7 @@ export const POST = async (
} = await query.graph({
entity: "seller",
fields: req.queryConfig.fields,
- filters: { id: result[0].id },
+ filters: { id: (result as any[])[0].id },
})
res.status(201).json({ seller })
diff --git a/packages/core-plugin/src/api/hooks/payout/route.ts b/packages/core-plugin/src/api/hooks/payout/route.ts
index 5c4a0dfa1..4640fddc9 100644
--- a/packages/core-plugin/src/api/hooks/payout/route.ts
+++ b/packages/core-plugin/src/api/hooks/payout/route.ts
@@ -19,7 +19,7 @@ export const POST = async (req: MedusaRequest, res: MedusaResponse) => {
attempts: 3,
}
)
- } catch (err) {
+ } catch (err: any) {
res.status(400).send(`Webhook Error: ${err.message}`)
return
}
diff --git a/packages/core-plugin/src/api/utils/ensure-seller-middleware.ts b/packages/core-plugin/src/api/utils/ensure-seller-middleware.ts
index cc7dfcf50..fdcedc444 100644
--- a/packages/core-plugin/src/api/utils/ensure-seller-middleware.ts
+++ b/packages/core-plugin/src/api/utils/ensure-seller-middleware.ts
@@ -16,7 +16,21 @@ export async function ensureSellerMiddleware(
res: MedusaResponse,
next: MedusaNextFunction
) {
- const sellerId = req.get(SELLER_ID_HEADER) || req.session?.seller_id
+ let sellerId = req.get(SELLER_ID_HEADER) || req.session?.seller_id
+
+ // If no seller_id from header or session, resolve from member's seller associations
+ if (!sellerId && req.auth_context?.actor_id) {
+ const q = req.scope.resolve(ContainerRegistrationKeys.QUERY)
+ const { data: members } = await q.graph({
+ entity: "member",
+ fields: ["sellers.id"],
+ filters: { id: req.auth_context.actor_id },
+ })
+
+ if (members?.[0]?.sellers?.[0]?.id) {
+ sellerId = members[0].sellers[0].id
+ }
+ }
if (!sellerId) {
return next(
diff --git a/packages/core-plugin/src/api/vendor/attributes/middlewares.ts b/packages/core-plugin/src/api/vendor/attributes/middlewares.ts
new file mode 100644
index 000000000..a86e9f7ab
--- /dev/null
+++ b/packages/core-plugin/src/api/vendor/attributes/middlewares.ts
@@ -0,0 +1,36 @@
+import {
+ validateAndTransformQuery,
+} from "@medusajs/framework"
+import { MiddlewareRoute } from "@medusajs/medusa"
+
+import {
+ AdminGetAttributesParams,
+} from "../../admin/attributes/validators"
+import { createFindParams } from "@medusajs/medusa/api/utils/validators"
+
+const VendorGetAttributesParams = createFindParams({
+ offset: 0,
+ limit: 50,
+}).merge(AdminGetAttributesParams)
+
+export const vendorAttributesMiddlewares: MiddlewareRoute[] = [
+ {
+ method: ["GET"],
+ matcher: "/vendor/attributes",
+ middlewares: [
+ validateAndTransformQuery(VendorGetAttributesParams, {
+ defaults: [
+ "id",
+ "name",
+ "handle",
+ "description",
+ "ui_component",
+ "is_required",
+ "possible_values.*",
+ "product_categories.*",
+ ],
+ isList: true,
+ }),
+ ],
+ },
+]
diff --git a/packages/core-plugin/src/api/vendor/attributes/route.ts b/packages/core-plugin/src/api/vendor/attributes/route.ts
new file mode 100644
index 000000000..00ddab413
--- /dev/null
+++ b/packages/core-plugin/src/api/vendor/attributes/route.ts
@@ -0,0 +1,25 @@
+import {
+ AuthenticatedMedusaRequest,
+ MedusaResponse,
+} from "@medusajs/framework/http"
+import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
+
+export const GET = async (
+ req: AuthenticatedMedusaRequest,
+ res: MedusaResponse
+) => {
+ const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
+
+ const { data: attributes, metadata } = await query.graph({
+ entity: "attribute",
+ filters: req.filterableFields,
+ ...req.queryConfig,
+ })
+
+ return res.json({
+ attributes,
+ count: metadata?.count,
+ offset: metadata?.skip,
+ limit: metadata?.take,
+ })
+}
diff --git a/packages/core-plugin/src/api/vendor/campaigns/[id]/promotions/route.ts b/packages/core-plugin/src/api/vendor/campaigns/[id]/promotions/route.ts
index 88a01b8f2..d1a33eaa7 100644
--- a/packages/core-plugin/src/api/vendor/campaigns/[id]/promotions/route.ts
+++ b/packages/core-plugin/src/api/vendor/campaigns/[id]/promotions/route.ts
@@ -14,7 +14,7 @@ export const POST = async (
res: MedusaResponse<HttpTypes.VendorCampaignResponse>
) => {
const { id } = req.params
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerCampaign(req.scope, sellerId, id)
diff --git a/packages/core-plugin/src/api/vendor/campaigns/[id]/route.ts b/packages/core-plugin/src/api/vendor/campaigns/[id]/route.ts
index adf3000a6..430bba79b 100644
--- a/packages/core-plugin/src/api/vendor/campaigns/[id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/campaigns/[id]/route.ts
@@ -18,7 +18,7 @@ export const GET = async (
) => {
const { id } = req.params
- await validateSellerCampaign(req.scope, req.auth_context.actor_id, id)
+ await validateSellerCampaign(req.scope, req.seller_context!.seller_id, id)
const campaign = await refetchCampaign(
id,
@@ -42,7 +42,7 @@ export const POST = async (
) => {
const { id } = req.params
- await validateSellerCampaign(req.scope, req.auth_context.actor_id, id)
+ await validateSellerCampaign(req.scope, req.seller_context!.seller_id, id)
await updateCampaignsWorkflow(req.scope).run({
input: {
@@ -65,7 +65,7 @@ export const DELETE = async (
) => {
const { id } = req.params
- await validateSellerCampaign(req.scope, req.auth_context.actor_id, id)
+ await validateSellerCampaign(req.scope, req.seller_context!.seller_id, id)
await deleteCampaignsWorkflow(req.scope).run({
input: { ids: [id] },
diff --git a/packages/core-plugin/src/api/vendor/campaigns/middlewares.ts b/packages/core-plugin/src/api/vendor/campaigns/middlewares.ts
index 8fcb01cba..d1ee2b2d0 100644
--- a/packages/core-plugin/src/api/vendor/campaigns/middlewares.ts
+++ b/packages/core-plugin/src/api/vendor/campaigns/middlewares.ts
@@ -24,7 +24,7 @@ const applySellerCampaignLinkFilter = (
res: MedusaResponse,
next: MedusaNextFunction
) => {
- req.filterableFields.seller_id = req.auth_context.actor_id
+ req.filterableFields.seller_id = req.seller_context!.seller_id
return maybeApplyLinkFilter({
entryPoint: "campaign_seller",
diff --git a/packages/core-plugin/src/api/vendor/campaigns/route.ts b/packages/core-plugin/src/api/vendor/campaigns/route.ts
index 5d85c02f0..2be9a3723 100644
--- a/packages/core-plugin/src/api/vendor/campaigns/route.ts
+++ b/packages/core-plugin/src/api/vendor/campaigns/route.ts
@@ -37,7 +37,7 @@ export const POST = async (
req: AuthenticatedMedusaRequest<VendorCreateCampaignType>,
res: MedusaResponse<HttpTypes.VendorCampaignResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const { result } = await createSellerCampaignsWorkflow(req.scope).run({
input: {
diff --git a/packages/core-plugin/src/api/vendor/collections/helpers.ts b/packages/core-plugin/src/api/vendor/collections/helpers.ts
index 61f8ec190..8acd7646c 100644
--- a/packages/core-plugin/src/api/vendor/collections/helpers.ts
+++ b/packages/core-plugin/src/api/vendor/collections/helpers.ts
@@ -27,7 +27,7 @@ export const wrapCollectionsWithProducts = async (collections: ProductCollection
const { data: sellerProducts } = await query.graph({
entity: "product_seller",
filters: {
- seller_id: req.auth_context.actor_id,
+ seller_id: req.seller_context!.seller_id,
},
fields: ["product.*"],
})
diff --git a/packages/core-plugin/src/api/vendor/customers/[id]/route.ts b/packages/core-plugin/src/api/vendor/customers/[id]/route.ts
index 99e910ff1..3683ed6a3 100644
--- a/packages/core-plugin/src/api/vendor/customers/[id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/customers/[id]/route.ts
@@ -15,7 +15,7 @@ export const GET = async (
res: MedusaResponse<HttpTypes.VendorCustomerResponse>
) => {
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerCustomer(req.scope, sellerId, req.params.id)
diff --git a/packages/core-plugin/src/api/vendor/customers/middlewares.ts b/packages/core-plugin/src/api/vendor/customers/middlewares.ts
index 48ec5e4e8..ff079b7dc 100644
--- a/packages/core-plugin/src/api/vendor/customers/middlewares.ts
+++ b/packages/core-plugin/src/api/vendor/customers/middlewares.ts
@@ -15,7 +15,7 @@ const applySellerCustomerLinkFilter = (
res: MedusaResponse,
next: MedusaNextFunction
) => {
- req.filterableFields.seller_id = req.auth_context.actor_id
+ req.filterableFields.seller_id = req.seller_context!.seller_id
return maybeApplyLinkFilter({
entryPoint: "seller_customer",
diff --git a/packages/core-plugin/src/api/vendor/feature-flags/route.ts b/packages/core-plugin/src/api/vendor/feature-flags/route.ts
index dd65330a8..f781b1207 100644
--- a/packages/core-plugin/src/api/vendor/feature-flags/route.ts
+++ b/packages/core-plugin/src/api/vendor/feature-flags/route.ts
@@ -14,7 +14,7 @@ export const GET = async (
const flags = featureFlagRouter.listFlags()
const featureFlags: Record<string, boolean> = {}
- flags.forEach((flag) => {
+ flags.forEach((flag: any) => {
featureFlags[flag.key] = flag.value
})
diff --git a/packages/core-plugin/src/api/vendor/fulfillment-sets/[id]/route.ts b/packages/core-plugin/src/api/vendor/fulfillment-sets/[id]/route.ts
index 5c6528a72..35473fbf2 100644
--- a/packages/core-plugin/src/api/vendor/fulfillment-sets/[id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/fulfillment-sets/[id]/route.ts
@@ -12,7 +12,7 @@ export const DELETE = async (
res: MedusaResponse<HttpTypes.VendorDeleteResponse>
) => {
const { id } = req.params
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerFulfillmentSet(req.scope, sellerId, id)
diff --git a/packages/core-plugin/src/api/vendor/fulfillment-sets/[id]/service-zones/[zone_id]/route.ts b/packages/core-plugin/src/api/vendor/fulfillment-sets/[id]/service-zones/[zone_id]/route.ts
index e6af0ff31..211287e5b 100644
--- a/packages/core-plugin/src/api/vendor/fulfillment-sets/[id]/service-zones/[zone_id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/fulfillment-sets/[id]/service-zones/[zone_id]/route.ts
@@ -22,7 +22,7 @@ export const GET = async (
res: MedusaResponse<HttpTypes.VendorServiceZoneResponse>
) => {
const { id, zone_id } = req.params
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
await validateSellerFulfillmentSet(req.scope, sellerId, id)
@@ -50,7 +50,7 @@ export const POST = async (
res: MedusaResponse<HttpTypes.VendorFulfillmentSetResponse>
) => {
const { id, zone_id } = req.params
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerFulfillmentSet(req.scope, sellerId, id)
@@ -90,7 +90,7 @@ export const DELETE = async (
res: MedusaResponse<HttpTypes.VendorServiceZoneDeleteResponse>
) => {
const { id, zone_id } = req.params
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerFulfillmentSet(req.scope, sellerId, id)
diff --git a/packages/core-plugin/src/api/vendor/fulfillment-sets/[id]/service-zones/route.ts b/packages/core-plugin/src/api/vendor/fulfillment-sets/[id]/service-zones/route.ts
index 4e33d9253..2a3a9f047 100644
--- a/packages/core-plugin/src/api/vendor/fulfillment-sets/[id]/service-zones/route.ts
+++ b/packages/core-plugin/src/api/vendor/fulfillment-sets/[id]/service-zones/route.ts
@@ -13,7 +13,7 @@ export const POST = async (
res: MedusaResponse<HttpTypes.VendorFulfillmentSetResponse>
) => {
const { id } = req.params
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerFulfillmentSet(req.scope, sellerId, id)
diff --git a/packages/core-plugin/src/api/vendor/inventory-items/[id]/location-levels/[location_id]/route.ts b/packages/core-plugin/src/api/vendor/inventory-items/[id]/location-levels/[location_id]/route.ts
index 344a33dd7..c01732cd4 100644
--- a/packages/core-plugin/src/api/vendor/inventory-items/[id]/location-levels/[location_id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/inventory-items/[id]/location-levels/[location_id]/route.ts
@@ -21,7 +21,7 @@ export const POST = async (
) => {
const { id, location_id } = req.params
- await validateSellerInventoryItem(req.scope, req.auth_context.actor_id, id)
+ await validateSellerInventoryItem(req.scope, req.seller_context!.seller_id, id)
await updateInventoryLevelsWorkflow(req.scope).run({
input: {
@@ -44,7 +44,7 @@ export const DELETE = async (
) => {
const { id, location_id } = req.params
- await validateSellerInventoryItem(req.scope, req.auth_context.actor_id, id)
+ await validateSellerInventoryItem(req.scope, req.seller_context!.seller_id, id)
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
diff --git a/packages/core-plugin/src/api/vendor/inventory-items/[id]/location-levels/batch/route.ts b/packages/core-plugin/src/api/vendor/inventory-items/[id]/location-levels/batch/route.ts
index f476ae3a7..0c17cb3f9 100644
--- a/packages/core-plugin/src/api/vendor/inventory-items/[id]/location-levels/batch/route.ts
+++ b/packages/core-plugin/src/api/vendor/inventory-items/[id]/location-levels/batch/route.ts
@@ -14,7 +14,7 @@ export const POST = async (
) => {
const { id } = req.params
- await validateSellerInventoryItem(req.scope, req.auth_context.actor_id, id)
+ await validateSellerInventoryItem(req.scope, req.seller_context!.seller_id, id)
const { result } = await batchInventoryItemLevelsWorkflow(req.scope).run({
input: {
diff --git a/packages/core-plugin/src/api/vendor/inventory-items/[id]/location-levels/route.ts b/packages/core-plugin/src/api/vendor/inventory-items/[id]/location-levels/route.ts
index c1c93fdab..cd1dd04ce 100644
--- a/packages/core-plugin/src/api/vendor/inventory-items/[id]/location-levels/route.ts
+++ b/packages/core-plugin/src/api/vendor/inventory-items/[id]/location-levels/route.ts
@@ -18,7 +18,7 @@ export const GET = async (
) => {
const { id } = req.params
- await validateSellerInventoryItem(req.scope, req.auth_context.actor_id, id)
+ await validateSellerInventoryItem(req.scope, req.seller_context!.seller_id, id)
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
@@ -43,7 +43,7 @@ export const POST = async (
) => {
const { id } = req.params
- await validateSellerInventoryItem(req.scope, req.auth_context.actor_id, id)
+ await validateSellerInventoryItem(req.scope, req.seller_context!.seller_id, id)
await createInventoryLevelsWorkflow(req.scope).run({
input: {
diff --git a/packages/core-plugin/src/api/vendor/inventory-items/[id]/route.ts b/packages/core-plugin/src/api/vendor/inventory-items/[id]/route.ts
index 5f2cdd0a5..e4646f842 100644
--- a/packages/core-plugin/src/api/vendor/inventory-items/[id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/inventory-items/[id]/route.ts
@@ -18,7 +18,7 @@ export const GET = async (
) => {
const { id } = req.params
- await validateSellerInventoryItem(req.scope, req.auth_context.actor_id, id)
+ await validateSellerInventoryItem(req.scope, req.seller_context!.seller_id, id)
const inventoryItem = await refetchInventoryItem(
id,
@@ -42,7 +42,7 @@ export const POST = async (
) => {
const { id } = req.params
- await validateSellerInventoryItem(req.scope, req.auth_context.actor_id, id)
+ await validateSellerInventoryItem(req.scope, req.seller_context!.seller_id, id)
await updateInventoryItemsWorkflow(req.scope).run({
input: {
@@ -65,7 +65,7 @@ export const DELETE = async (
) => {
const { id } = req.params
- await validateSellerInventoryItem(req.scope, req.auth_context.actor_id, id)
+ await validateSellerInventoryItem(req.scope, req.seller_context!.seller_id, id)
await deleteInventoryItemWorkflow(req.scope).run({
input: [id],
diff --git a/packages/core-plugin/src/api/vendor/inventory-items/middlewares.ts b/packages/core-plugin/src/api/vendor/inventory-items/middlewares.ts
index 3ad18cf3f..df4f8b91f 100644
--- a/packages/core-plugin/src/api/vendor/inventory-items/middlewares.ts
+++ b/packages/core-plugin/src/api/vendor/inventory-items/middlewares.ts
@@ -29,7 +29,7 @@ const applySellerInventoryItemLinkFilter = (
res: MedusaResponse,
next: MedusaNextFunction
) => {
- req.filterableFields.seller_id = req.auth_context.actor_id
+ req.filterableFields.seller_id = req.seller_context!.seller_id
return maybeApplyLinkFilter({
entryPoint: "inventory_item_seller",
diff --git a/packages/core-plugin/src/api/vendor/inventory-items/route.ts b/packages/core-plugin/src/api/vendor/inventory-items/route.ts
index 9de427848..a533c46d0 100644
--- a/packages/core-plugin/src/api/vendor/inventory-items/route.ts
+++ b/packages/core-plugin/src/api/vendor/inventory-items/route.ts
@@ -37,7 +37,7 @@ export const POST = async (
req: AuthenticatedMedusaRequest<VendorCreateInventoryItemType>,
res: MedusaResponse<HttpTypes.VendorInventoryItemResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const { result } = await createSellerInventoryItemsWorkflow(req.scope).run({
input: {
diff --git a/packages/core-plugin/src/api/vendor/middlewares.ts b/packages/core-plugin/src/api/vendor/middlewares.ts
index 76c2f2a5a..24a8a4200 100644
--- a/packages/core-plugin/src/api/vendor/middlewares.ts
+++ b/packages/core-plugin/src/api/vendor/middlewares.ts
@@ -37,6 +37,7 @@ import { vendorSubscriptionMiddlewares } from "./subscription/middlewares"
import { vendorUploadsMiddlewares } from "./uploads/middlewares"
import { ensureSellerMiddleware, scanUnauthenticatedRoutes, unlessBaseUrl, vendorCorsMiddleware } from "../utils"
import { vendorProductTagsMiddlewares } from "./product-tags/middlewares"
+import { vendorAttributesMiddlewares } from "./attributes/middlewares"
const unauthenticatedRoutes = [
/^\/vendor\/sellers$/,
@@ -68,6 +69,7 @@ export const vendorMiddlewares: MiddlewareRoute[] = [
},
{
matcher: "/vendor/*",
+ method: ["GET", "POST", "PUT", "PATCH", "DELETE"],
middlewares: [
vendorCorsMiddleware,
unlessBaseUrl(
@@ -115,4 +117,5 @@ export const vendorMiddlewares: MiddlewareRoute[] = [
...vendorUploadsMiddlewares,
...vendorProductTagsMiddlewares,
...vendorSubscriptionMiddlewares,
+ ...vendorAttributesMiddlewares,
]
diff --git a/packages/core-plugin/src/api/vendor/orders/[id]/cancel/route.ts b/packages/core-plugin/src/api/vendor/orders/[id]/cancel/route.ts
index 09ed4895d..fb8553f97 100644
--- a/packages/core-plugin/src/api/vendor/orders/[id]/cancel/route.ts
+++ b/packages/core-plugin/src/api/vendor/orders/[id]/cancel/route.ts
@@ -13,7 +13,7 @@ export const POST = async (
res: MedusaResponse<HttpTypes.VendorOrderResponse>
) => {
const { id } = req.params
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerOrder(req.scope, sellerId, id)
diff --git a/packages/core-plugin/src/api/vendor/orders/[id]/changes/route.ts b/packages/core-plugin/src/api/vendor/orders/[id]/changes/route.ts
index 1e1bb6314..18e57299a 100644
--- a/packages/core-plugin/src/api/vendor/orders/[id]/changes/route.ts
+++ b/packages/core-plugin/src/api/vendor/orders/[id]/changes/route.ts
@@ -12,7 +12,7 @@ export const GET = async (
res: MedusaResponse<HttpTypes.VendorOrderChangesResponse>
) => {
const { id } = req.params
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerOrder(req.scope, sellerId, id)
diff --git a/packages/core-plugin/src/api/vendor/orders/[id]/complete/route.ts b/packages/core-plugin/src/api/vendor/orders/[id]/complete/route.ts
index 4c39f14f9..7d85403fe 100644
--- a/packages/core-plugin/src/api/vendor/orders/[id]/complete/route.ts
+++ b/packages/core-plugin/src/api/vendor/orders/[id]/complete/route.ts
@@ -13,7 +13,7 @@ export const POST = async (
res: MedusaResponse<HttpTypes.VendorOrderResponse>
) => {
const { id } = req.params
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerOrder(req.scope, sellerId, id)
diff --git a/packages/core-plugin/src/api/vendor/orders/[id]/fulfillments/[fulfillment_id]/cancel/route.ts b/packages/core-plugin/src/api/vendor/orders/[id]/fulfillments/[fulfillment_id]/cancel/route.ts
index 73b6e97c4..dfe02927f 100644
--- a/packages/core-plugin/src/api/vendor/orders/[id]/fulfillments/[fulfillment_id]/cancel/route.ts
+++ b/packages/core-plugin/src/api/vendor/orders/[id]/fulfillments/[fulfillment_id]/cancel/route.ts
@@ -13,7 +13,7 @@ export const POST = async (
res: MedusaResponse<HttpTypes.VendorOrderResponse>
) => {
const { id, fulfillment_id } = req.params
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerOrder(req.scope, sellerId, id)
diff --git a/packages/core-plugin/src/api/vendor/orders/[id]/fulfillments/[fulfillment_id]/mark-as-delivered/route.ts b/packages/core-plugin/src/api/vendor/orders/[id]/fulfillments/[fulfillment_id]/mark-as-delivered/route.ts
index faaba1cf6..fe98ed7d5 100644
--- a/packages/core-plugin/src/api/vendor/orders/[id]/fulfillments/[fulfillment_id]/mark-as-delivered/route.ts
+++ b/packages/core-plugin/src/api/vendor/orders/[id]/fulfillments/[fulfillment_id]/mark-as-delivered/route.ts
@@ -13,7 +13,7 @@ export const POST = async (
res: MedusaResponse<HttpTypes.VendorOrderResponse>
) => {
const { id, fulfillment_id } = req.params
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerOrder(req.scope, sellerId, id)
diff --git a/packages/core-plugin/src/api/vendor/orders/[id]/fulfillments/[fulfillment_id]/shipments/route.ts b/packages/core-plugin/src/api/vendor/orders/[id]/fulfillments/[fulfillment_id]/shipments/route.ts
index 44868e1d8..3fb309d6a 100644
--- a/packages/core-plugin/src/api/vendor/orders/[id]/fulfillments/[fulfillment_id]/shipments/route.ts
+++ b/packages/core-plugin/src/api/vendor/orders/[id]/fulfillments/[fulfillment_id]/shipments/route.ts
@@ -14,7 +14,7 @@ export const POST = async (
res: MedusaResponse<HttpTypes.VendorOrderResponse>
) => {
const { id, fulfillment_id } = req.params
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerOrder(req.scope, sellerId, id)
diff --git a/packages/core-plugin/src/api/vendor/orders/[id]/fulfillments/route.ts b/packages/core-plugin/src/api/vendor/orders/[id]/fulfillments/route.ts
index 446b3c554..45c6254df 100644
--- a/packages/core-plugin/src/api/vendor/orders/[id]/fulfillments/route.ts
+++ b/packages/core-plugin/src/api/vendor/orders/[id]/fulfillments/route.ts
@@ -13,7 +13,7 @@ export const POST = async (
res: MedusaResponse<HttpTypes.VendorFulfillmentResponse>
) => {
const { id } = req.params
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerOrder(req.scope, sellerId, id)
diff --git a/packages/core-plugin/src/api/vendor/orders/[id]/preview/route.ts b/packages/core-plugin/src/api/vendor/orders/[id]/preview/route.ts
index d5dc2e2ee..77e61a391 100644
--- a/packages/core-plugin/src/api/vendor/orders/[id]/preview/route.ts
+++ b/packages/core-plugin/src/api/vendor/orders/[id]/preview/route.ts
@@ -12,7 +12,7 @@ export const GET = async (
res: MedusaResponse<HttpTypes.VendorOrderPreviewResponse>
) => {
const { id } = req.params
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerOrder(req.scope, sellerId, id)
diff --git a/packages/core-plugin/src/api/vendor/orders/[id]/route.ts b/packages/core-plugin/src/api/vendor/orders/[id]/route.ts
index aff72233a..6f8f20f96 100644
--- a/packages/core-plugin/src/api/vendor/orders/[id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/orders/[id]/route.ts
@@ -11,7 +11,7 @@ export const GET = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse<HttpTypes.VendorOrderResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerOrder(req.scope, sellerId, req.params.id)
diff --git a/packages/core-plugin/src/api/vendor/orders/middlewares.ts b/packages/core-plugin/src/api/vendor/orders/middlewares.ts
index 3d3655678..415d4a816 100644
--- a/packages/core-plugin/src/api/vendor/orders/middlewares.ts
+++ b/packages/core-plugin/src/api/vendor/orders/middlewares.ts
@@ -27,7 +27,7 @@ const applySellerLinkFilter = (
res: MedusaResponse,
next: MedusaNextFunction
) => {
- req.filterableFields.seller_id = req.auth_context.actor_id
+ req.filterableFields.seller_id = req.seller_context!.seller_id
return maybeApplyLinkFilter({
entryPoint: "order_seller",
diff --git a/packages/core-plugin/src/api/vendor/payments/[id]/capture/route.ts b/packages/core-plugin/src/api/vendor/payments/[id]/capture/route.ts
index e531f98d4..a159b9d83 100644
--- a/packages/core-plugin/src/api/vendor/payments/[id]/capture/route.ts
+++ b/packages/core-plugin/src/api/vendor/payments/[id]/capture/route.ts
@@ -12,7 +12,7 @@ export const POST = async (
req: AuthenticatedMedusaRequest<VendorCreatePaymentCaptureType>,
res: MedusaResponse<HttpTypes.VendorPaymentResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const { id } = req.params
await validateSellerPayment(req.scope, sellerId, id)
diff --git a/packages/core-plugin/src/api/vendor/payments/[id]/refund/route.ts b/packages/core-plugin/src/api/vendor/payments/[id]/refund/route.ts
index 117049499..72b043b95 100644
--- a/packages/core-plugin/src/api/vendor/payments/[id]/refund/route.ts
+++ b/packages/core-plugin/src/api/vendor/payments/[id]/refund/route.ts
@@ -12,7 +12,7 @@ export const POST = async (
req: AuthenticatedMedusaRequest<VendorCreatePaymentRefundType>,
res: MedusaResponse<HttpTypes.VendorPaymentResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const { id } = req.params
await validateSellerPayment(req.scope, sellerId, id)
diff --git a/packages/core-plugin/src/api/vendor/payments/[id]/route.ts b/packages/core-plugin/src/api/vendor/payments/[id]/route.ts
index c14e43f9e..9e3c4ca66 100644
--- a/packages/core-plugin/src/api/vendor/payments/[id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/payments/[id]/route.ts
@@ -10,7 +10,7 @@ export const GET = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse<HttpTypes.VendorPaymentResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerPayment(req.scope, sellerId, req.params.id)
diff --git a/packages/core-plugin/src/api/vendor/payments/middlewares.ts b/packages/core-plugin/src/api/vendor/payments/middlewares.ts
index e26bfa22e..0dc416d27 100644
--- a/packages/core-plugin/src/api/vendor/payments/middlewares.ts
+++ b/packages/core-plugin/src/api/vendor/payments/middlewares.ts
@@ -27,7 +27,7 @@ const applySellerPaymentLinkFilter = (
res: MedusaResponse,
next: MedusaNextFunction
) => {
- req.filterableFields.seller_id = req.auth_context.actor_id
+ req.filterableFields.seller_id = req.seller_context!.seller_id
return maybeApplyLinkFilter({
entryPoint: "seller_payment",
diff --git a/packages/core-plugin/src/api/vendor/payout-accounts/[id]/onboarding/route.ts b/packages/core-plugin/src/api/vendor/payout-accounts/[id]/onboarding/route.ts
index 402a482f6..ea085ce55 100644
--- a/packages/core-plugin/src/api/vendor/payout-accounts/[id]/onboarding/route.ts
+++ b/packages/core-plugin/src/api/vendor/payout-accounts/[id]/onboarding/route.ts
@@ -14,7 +14,7 @@ export const POST = async (
res: MedusaResponse<HttpTypes.VendorOnboardingResponse>
) => {
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerPayoutAccount(req.scope, sellerId, req.params.id)
diff --git a/packages/core-plugin/src/api/vendor/payout-accounts/[id]/route.ts b/packages/core-plugin/src/api/vendor/payout-accounts/[id]/route.ts
index cc13e96db..342c93f1d 100644
--- a/packages/core-plugin/src/api/vendor/payout-accounts/[id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/payout-accounts/[id]/route.ts
@@ -14,7 +14,7 @@ export const GET = async (
res: MedusaResponse<HttpTypes.VendorPayoutAccountResponse>
) => {
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerPayoutAccount(req.scope, sellerId, req.params.id)
diff --git a/packages/core-plugin/src/api/vendor/payout-accounts/middlewares.ts b/packages/core-plugin/src/api/vendor/payout-accounts/middlewares.ts
index 53e99e1d4..f87c67299 100644
--- a/packages/core-plugin/src/api/vendor/payout-accounts/middlewares.ts
+++ b/packages/core-plugin/src/api/vendor/payout-accounts/middlewares.ts
@@ -26,7 +26,7 @@ const applySellerPayoutAccountLinkFilter = (
res: MedusaResponse,
next: MedusaNextFunction
) => {
- req.filterableFields.seller_id = req.auth_context.actor_id
+ req.filterableFields.seller_id = req.seller_context!.seller_id
return maybeApplyLinkFilter({
entryPoint: "seller_payout_account",
diff --git a/packages/core-plugin/src/api/vendor/payout-accounts/route.ts b/packages/core-plugin/src/api/vendor/payout-accounts/route.ts
index 4ef7a9040..40a0bf9ac 100644
--- a/packages/core-plugin/src/api/vendor/payout-accounts/route.ts
+++ b/packages/core-plugin/src/api/vendor/payout-accounts/route.ts
@@ -34,7 +34,7 @@ export const POST = async (
res: MedusaResponse<HttpTypes.VendorPayoutAccountResponse>
) => {
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const { result } = await createPayoutAccountWorkflow(req.scope).run({
input: {
diff --git a/packages/core-plugin/src/api/vendor/payouts/[id]/route.ts b/packages/core-plugin/src/api/vendor/payouts/[id]/route.ts
index 520061b14..9b52b4947 100644
--- a/packages/core-plugin/src/api/vendor/payouts/[id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/payouts/[id]/route.ts
@@ -15,7 +15,7 @@ export const GET = async (
res: MedusaResponse<HttpTypes.VendorPayoutResponse>
) => {
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerPayout(req.scope, sellerId, req.params.id)
diff --git a/packages/core-plugin/src/api/vendor/payouts/middlewares.ts b/packages/core-plugin/src/api/vendor/payouts/middlewares.ts
index c6e604c59..a7f5a4cea 100644
--- a/packages/core-plugin/src/api/vendor/payouts/middlewares.ts
+++ b/packages/core-plugin/src/api/vendor/payouts/middlewares.ts
@@ -15,7 +15,7 @@ const applySellerPayoutLinkFilter = (
res: MedusaResponse,
next: MedusaNextFunction
) => {
- req.filterableFields.seller_id = req.auth_context.actor_id
+ req.filterableFields.seller_id = req.seller_context!.seller_id
return maybeApplyLinkFilter({
entryPoint: "payout_seller",
diff --git a/packages/core-plugin/src/api/vendor/price-lists/[id]/prices/batch/route.ts b/packages/core-plugin/src/api/vendor/price-lists/[id]/prices/batch/route.ts
index 3603b51f7..d054870a6 100644
--- a/packages/core-plugin/src/api/vendor/price-lists/[id]/prices/batch/route.ts
+++ b/packages/core-plugin/src/api/vendor/price-lists/[id]/prices/batch/route.ts
@@ -41,7 +41,7 @@ export const POST = async (
res: MedusaResponse<HttpTypes.VendorPriceListBatchResponse>
) => {
const id = req.params.id
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerPriceList(req.scope, sellerId, id)
diff --git a/packages/core-plugin/src/api/vendor/price-lists/[id]/prices/route.ts b/packages/core-plugin/src/api/vendor/price-lists/[id]/prices/route.ts
index 9a864d5c4..ee347b402 100644
--- a/packages/core-plugin/src/api/vendor/price-lists/[id]/prices/route.ts
+++ b/packages/core-plugin/src/api/vendor/price-lists/[id]/prices/route.ts
@@ -11,7 +11,7 @@ export const GET = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse<HttpTypes.VendorPriceListPricesResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerPriceList(req.scope, sellerId, req.params.id)
diff --git a/packages/core-plugin/src/api/vendor/price-lists/[id]/products/route.ts b/packages/core-plugin/src/api/vendor/price-lists/[id]/products/route.ts
index 4450daef8..89a70c96b 100644
--- a/packages/core-plugin/src/api/vendor/price-lists/[id]/products/route.ts
+++ b/packages/core-plugin/src/api/vendor/price-lists/[id]/products/route.ts
@@ -18,7 +18,7 @@ export const POST = async (
res: MedusaResponse<VendorHttpTypes.VendorPriceListResponse>
) => {
const id = req.params.id
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const { remove = [] } = req.validatedBody
await validateSellerPriceList(req.scope, sellerId, id)
diff --git a/packages/core-plugin/src/api/vendor/price-lists/[id]/route.ts b/packages/core-plugin/src/api/vendor/price-lists/[id]/route.ts
index 40eea32ec..52b8723db 100644
--- a/packages/core-plugin/src/api/vendor/price-lists/[id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/price-lists/[id]/route.ts
@@ -15,7 +15,7 @@ export const GET = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse<HttpTypes.VendorPriceListResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerPriceList(req.scope, sellerId, req.params.id)
@@ -33,7 +33,7 @@ export const POST = async (
res: MedusaResponse<HttpTypes.VendorPriceListResponse>
) => {
const id = req.params.id
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerPriceList(req.scope, sellerId, id)
@@ -53,7 +53,7 @@ export const DELETE = async (
res: MedusaResponse<HttpTypes.VendorDeleteResponse>
) => {
const id = req.params.id
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerPriceList(req.scope, sellerId, id)
diff --git a/packages/core-plugin/src/api/vendor/price-lists/middlewares.ts b/packages/core-plugin/src/api/vendor/price-lists/middlewares.ts
index 9e352f328..f5fcea6e0 100644
--- a/packages/core-plugin/src/api/vendor/price-lists/middlewares.ts
+++ b/packages/core-plugin/src/api/vendor/price-lists/middlewares.ts
@@ -27,7 +27,7 @@ const applySellerPriceListLinkFilter = (
res: MedusaResponse,
next: MedusaNextFunction
) => {
- req.filterableFields.seller_id = req.auth_context.actor_id
+ req.filterableFields.seller_id = req.seller_context!.seller_id
return maybeApplyLinkFilter({
entryPoint: "price_list_seller",
diff --git a/packages/core-plugin/src/api/vendor/price-lists/route.ts b/packages/core-plugin/src/api/vendor/price-lists/route.ts
index 3193d7ac6..7707aeca2 100644
--- a/packages/core-plugin/src/api/vendor/price-lists/route.ts
+++ b/packages/core-plugin/src/api/vendor/price-lists/route.ts
@@ -35,7 +35,7 @@ export const POST = async (
res: MedusaResponse<HttpTypes.VendorPriceListResponse>
) => {
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const { result } = await createSellerPriceListsWorkflow(req.scope).run({
input: {
diff --git a/packages/core-plugin/src/api/vendor/product-categories/[id]/products/route.ts b/packages/core-plugin/src/api/vendor/product-categories/[id]/products/route.ts
index f82ae1513..1316ec6e6 100644
--- a/packages/core-plugin/src/api/vendor/product-categories/[id]/products/route.ts
+++ b/packages/core-plugin/src/api/vendor/product-categories/[id]/products/route.ts
@@ -19,7 +19,7 @@ export const POST = async (
res: MedusaResponse<AdminProductCategoryResponse>
) => {
const { id } = req.params
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const productIdsToValidate = [
...(req.validatedBody.add || []),
diff --git a/packages/core-plugin/src/api/vendor/product-variants/middlewares.ts b/packages/core-plugin/src/api/vendor/product-variants/middlewares.ts
index 65bfda230..e624d53dc 100644
--- a/packages/core-plugin/src/api/vendor/product-variants/middlewares.ts
+++ b/packages/core-plugin/src/api/vendor/product-variants/middlewares.ts
@@ -15,7 +15,7 @@ const applySellerProductVariantLinkFilter = (
res: MedusaResponse,
next: MedusaNextFunction
) => {
- req.filterableFields.seller_id = req.auth_context.actor_id
+ req.filterableFields.seller_id = req.seller_context!.seller_id
return maybeApplyLinkFilter({
entryPoint: "product_seller",
diff --git a/packages/core-plugin/src/api/vendor/products/[id]/attributes/[attribute_id]/route.ts b/packages/core-plugin/src/api/vendor/products/[id]/attributes/[attribute_id]/route.ts
new file mode 100644
index 000000000..1df255236
--- /dev/null
+++ b/packages/core-plugin/src/api/vendor/products/[id]/attributes/[attribute_id]/route.ts
@@ -0,0 +1,239 @@
+import {
+ AuthenticatedMedusaRequest,
+ MedusaResponse,
+} from "@medusajs/framework/http"
+import {
+ ContainerRegistrationKeys,
+ MedusaError,
+} from "@medusajs/framework/utils"
+
+import { AttributeSource, AttributeUIComponent } from "@mercurjs/types"
+
+import {
+ ATTRIBUTE_MODULE,
+ AttributeModuleService,
+} from "../../../../../../modules/attribute"
+import sellerAttributeLink from "../../../../../../links/seller-attribute-link"
+import { VendorUpdateProductAttributeType } from "../../../validators"
+import { transformProductWithInformationalAttributes } from "../../../utils/transform-product-attributes"
+import { convertAttributeToOptionWorkflow } from "../../../../../../workflows/product-attribute/workflows/convert-attribute-to-option"
+import { deleteAttributeValueWorkflow } from "../../../../../../workflows/product-attribute/workflows/delete-attribute-value"
+import { syncProductAttributeValuesWorkflow } from "../../../../../../workflows/product-attribute/workflows/sync-product-attribute-values"
+import { getProductAttributeValues } from "../utils"
+
+export const POST = async (
+ req: AuthenticatedMedusaRequest<VendorUpdateProductAttributeType>,
+ res: MedusaResponse
+) => {
+ const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
+ const attributeService =
+ req.scope.resolve<AttributeModuleService>(ATTRIBUTE_MODULE)
+ const { id: product_id, attribute_id } = req.params
+ const { name, ui_component, values, use_for_variations } =
+ req.validatedBody
+
+ const sellerId = req.seller_context!.seller_id
+
+ const {
+ data: [attribute],
+ } = await query.graph({
+ entity: "attribute",
+ fields: [
+ "id",
+ "name",
+ "source",
+ "is_filterable",
+ "possible_values.value",
+ ],
+ filters: { id: attribute_id },
+ })
+
+ if (!attribute) {
+ throw new MedusaError(
+ MedusaError.Types.NOT_FOUND,
+ `Attribute with id '${attribute_id}' not found`
+ )
+ }
+
+ if (
+ (name || ui_component) &&
+ attribute.source !== AttributeSource.VENDOR
+ ) {
+ throw new MedusaError(
+ MedusaError.Types.NOT_ALLOWED,
+ "Cannot edit admin-defined attribute properties"
+ )
+ }
+
+ if (attribute.source === AttributeSource.VENDOR) {
+ const {
+ data: [ownershipLink],
+ } = await query.graph({
+ entity: sellerAttributeLink.entryPoint,
+ fields: ["attribute_id"],
+ filters: {
+ seller_id: sellerId,
+ attribute_id: attribute_id,
+ },
+ })
+
+ if (!ownershipLink) {
+ throw new MedusaError(
+ MedusaError.Types.NOT_ALLOWED,
+ "You do not own this attribute"
+ )
+ }
+ }
+
+ if (use_for_variations === true) {
+ const attributeValues = await getProductAttributeValues(
+ req.scope,
+ product_id,
+ attribute_id
+ )
+
+ const currentValues = attributeValues.map((av) => av.value)
+ const valueIds = attributeValues.map((av) => av.attribute_value_id)
+
+ await convertAttributeToOptionWorkflow(req.scope).run({
+ input: {
+ product_id,
+ seller_id: sellerId,
+ option_title: attribute.name,
+ option_values: values ?? currentValues,
+ attribute_value_ids: valueIds,
+ },
+ })
+ } else {
+ if (
+ attribute.source === AttributeSource.VENDOR &&
+ (name || ui_component)
+ ) {
+ await attributeService.updateAttributes({
+ id: attribute_id,
+ ...(name && { name }),
+ ...(ui_component && {
+ ui_component: ui_component as AttributeUIComponent,
+ }),
+ })
+ }
+
+ if (values) {
+ const attributeValues = await getProductAttributeValues(
+ req.scope,
+ product_id,
+ attribute_id
+ )
+
+ await syncProductAttributeValuesWorkflow(req.scope).run({
+ input: {
+ product_id,
+ seller_id: sellerId,
+ attribute_id,
+ attribute_source: attribute.source,
+ possible_values:
+ attribute.possible_values?.map(
+ (pv: { value: string }) => pv.value
+ ) ?? [],
+ new_values: values,
+ existing_values: attributeValues.map((value) => ({
+ attribute_value_id: value.attribute_value_id,
+ value: value.value,
+ })),
+ },
+ })
+ }
+ }
+
+ const {
+ data: [product],
+ } = await query.graph({
+ entity: "product",
+ fields: req.queryConfig.fields,
+ filters: { id: product_id },
+ })
+
+ const transformedProduct = transformProductWithInformationalAttributes(
+ product as any
+ )
+
+ res.json({ product: transformedProduct })
+}
+
+export const DELETE = async (
+ req: AuthenticatedMedusaRequest,
+ res: MedusaResponse
+) => {
+ const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
+ const { id: product_id, attribute_id } = req.params
+
+ const sellerId = req.seller_context!.seller_id
+
+ const {
+ data: [attribute],
+ } = await query.graph({
+ entity: "attribute",
+ fields: ["id", "source", "is_required"],
+ filters: { id: attribute_id },
+ })
+
+ if (!attribute) {
+ throw new MedusaError(
+ MedusaError.Types.NOT_FOUND,
+ `Attribute with id '${attribute_id}' not found`
+ )
+ }
+
+ if (
+ attribute.source === AttributeSource.ADMIN &&
+ attribute.is_required
+ ) {
+ throw new MedusaError(
+ MedusaError.Types.NOT_ALLOWED,
+ "Cannot remove required attributes"
+ )
+ }
+
+ if (attribute.source === AttributeSource.VENDOR) {
+ const {
+ data: [ownershipLink],
+ } = await query.graph({
+ entity: sellerAttributeLink.entryPoint,
+ fields: ["attribute_id"],
+ filters: {
+ seller_id: sellerId,
+ attribute_id: attribute_id,
+ },
+ })
+
+ if (!ownershipLink) {
+ throw new MedusaError(
+ MedusaError.Types.NOT_ALLOWED,
+ "You do not own this attribute"
+ )
+ }
+ }
+
+ const attributeValues = await getProductAttributeValues(
+ req.scope,
+ product_id,
+ attribute_id
+ )
+
+ const valuesToRemove = attributeValues.map(
+ (av) => av.attribute_value_id
+ )
+
+ if (valuesToRemove.length > 0) {
+ await deleteAttributeValueWorkflow(req.scope).run({
+ input: valuesToRemove,
+ })
+ }
+
+ res.json({
+ product_id,
+ attribute_id,
+ deleted: true,
+ removed_values_count: valuesToRemove.length,
+ })
+}
diff --git a/packages/core-plugin/src/api/vendor/products/[id]/attributes/route.ts b/packages/core-plugin/src/api/vendor/products/[id]/attributes/route.ts
new file mode 100644
index 000000000..ad8cff8d8
--- /dev/null
+++ b/packages/core-plugin/src/api/vendor/products/[id]/attributes/route.ts
@@ -0,0 +1,185 @@
+import {
+ AuthenticatedMedusaRequest,
+ MedusaResponse,
+} from "@medusajs/framework/http"
+import {
+ ContainerRegistrationKeys,
+ MedusaError,
+} from "@medusajs/framework/utils"
+import { createProductOptionsWorkflow } from "@medusajs/medusa/core-flows"
+
+import { AttributeSource, AttributeUIComponent } from "@mercurjs/types"
+
+import { createAndLinkAttributeValuesWorkflow } from "../../../../../workflows/product-attribute/workflows/create-and-link-attribute-values"
+import { findOrCreateVendorAttribute } from "../../../../../workflows/product-attribute/utils/find-or-create-vendor-attribute"
+import { VendorAddProductAttributeType } from "../../validators"
+import { transformProductWithInformationalAttributes } from "../../utils/transform-product-attributes"
+import { getProductAttributeValues } from "./utils"
+
+export const POST = async (
+ req: AuthenticatedMedusaRequest<VendorAddProductAttributeType>,
+ res: MedusaResponse
+) => {
+ const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
+ const { id: product_id } = req.params
+ const { attribute_id, name, values, use_for_variations, ui_component } =
+ req.validatedBody
+
+ const sellerId = req.seller_context!.seller_id
+
+ if (!attribute_id && !name) {
+ throw new MedusaError(
+ MedusaError.Types.INVALID_DATA,
+ "Either attribute_id or name must be provided"
+ )
+ }
+
+ if (use_for_variations) {
+ const optionTitle =
+ name ?? (await getAttributeName(query, attribute_id!))
+
+ await createProductOptionsWorkflow(req.scope).run({
+ input: {
+ product_options: [
+ {
+ product_id,
+ title: optionTitle,
+ values,
+ },
+ ],
+ },
+ })
+ } else {
+ let resolvedAttributeId: string
+
+ if (attribute_id) {
+ const {
+ data: [attribute],
+ } = await query.graph({
+ entity: "attribute",
+ fields: ["id", "source", "possible_values.value"],
+ filters: { id: attribute_id },
+ })
+
+ if (!attribute) {
+ throw new MedusaError(
+ MedusaError.Types.NOT_FOUND,
+ `Attribute with id '${attribute_id}' not found`
+ )
+ }
+
+ resolvedAttributeId = attribute.id
+
+ const existingValues = await getProductAttributeValues(
+ req.scope,
+ product_id,
+ resolvedAttributeId
+ )
+ if (existingValues.length > 0) {
+ throw new MedusaError(
+ MedusaError.Types.INVALID_DATA,
+ "Attribute already assigned to this product. Use UPDATE endpoint to modify values."
+ )
+ }
+
+ const allowedValues = new Set(
+ attribute.possible_values?.map(
+ (pv: { value: string }) => pv.value
+ ) ?? []
+ )
+
+ const valuesWithSource = values.map((value) => {
+ const isFromPossibleValues =
+ allowedValues.size === 0 || allowedValues.has(value)
+
+ const source = isFromPossibleValues
+ ? AttributeSource.ADMIN
+ : AttributeSource.VENDOR
+
+ return { value, source }
+ })
+
+ await createAndLinkAttributeValuesWorkflow(req.scope).run({
+ input: {
+ product_id,
+ attribute_id: resolvedAttributeId,
+ seller_id: sellerId,
+ values: valuesWithSource,
+ },
+ })
+ } else {
+ const vendorAttribute = await findOrCreateVendorAttribute(
+ req.scope,
+ {
+ sellerId,
+ name: name!,
+ ui_component:
+ (ui_component as AttributeUIComponent) ??
+ AttributeUIComponent.TEXTAREA,
+ }
+ )
+
+ resolvedAttributeId = vendorAttribute.id
+
+ const existingValues = await getProductAttributeValues(
+ req.scope,
+ product_id,
+ resolvedAttributeId
+ )
+ if (existingValues.length > 0) {
+ throw new MedusaError(
+ MedusaError.Types.INVALID_DATA,
+ "Attribute already assigned to this product. Use UPDATE endpoint to modify values."
+ )
+ }
+
+ await createAndLinkAttributeValuesWorkflow(req.scope).run({
+ input: {
+ product_id,
+ attribute_id: resolvedAttributeId,
+ seller_id: sellerId,
+ values: values.map((value) => ({
+ value,
+ source: AttributeSource.VENDOR as AttributeSource,
+ })),
+ },
+ })
+ }
+ }
+
+ const {
+ data: [product],
+ } = await query.graph({
+ entity: "product",
+ fields: req.queryConfig.fields,
+ filters: { id: product_id },
+ })
+
+ const transformedProduct = transformProductWithInformationalAttributes(
+ product as any
+ )
+
+ res.status(201).json({ product: transformedProduct })
+}
+
+async function getAttributeName(
+ query: any,
+ attributeId: string
+): Promise<string> {
+ const {
+ data: [attribute],
+ } = await query.graph({
+ entity: "attribute",
+ fields: ["name"],
+ filters: { id: attributeId },
+ })
+
+ if (!attribute) {
+ throw new MedusaError(
+ MedusaError.Types.NOT_FOUND,
+ `Attribute with id '${attributeId}' not found`
+ )
+ }
+
+ return attribute.name
+}
diff --git a/packages/core-plugin/src/api/vendor/products/[id]/attributes/utils.ts b/packages/core-plugin/src/api/vendor/products/[id]/attributes/utils.ts
new file mode 100644
index 000000000..da6b407ce
--- /dev/null
+++ b/packages/core-plugin/src/api/vendor/products/[id]/attributes/utils.ts
@@ -0,0 +1,28 @@
+import { MedusaContainer } from "@medusajs/framework"
+import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
+
+export interface ProductAttributeValueRow {
+ attribute_value_id: string
+ value: string
+ source: string
+}
+
+export async function getProductAttributeValues(
+ container: MedusaContainer,
+ productId: string,
+ attributeId: string
+): Promise<ProductAttributeValueRow[]> {
+ const knex = container.resolve(ContainerRegistrationKeys.PG_CONNECTION)
+
+ const rows = await knex(
+ "product_product_attribute_attribute_value as link"
+ )
+ .select("av.id as attribute_value_id", "av.value", "av.source")
+ .innerJoin("attribute_value as av", "link.attribute_value_id", "av.id")
+ .where("link.product_id", productId)
+ .where("av.attribute_id", attributeId)
+ .whereNull("link.deleted_at")
+ .whereNull("av.deleted_at")
+
+ return rows
+}
diff --git a/packages/core-plugin/src/api/vendor/products/[id]/options/[option_id]/route.ts b/packages/core-plugin/src/api/vendor/products/[id]/options/[option_id]/route.ts
index 21addd560..88ebfd752 100644
--- a/packages/core-plugin/src/api/vendor/products/[id]/options/[option_id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/products/[id]/options/[option_id]/route.ts
@@ -11,27 +11,63 @@ import { HttpTypes } from "@mercurjs/types"
import { validateSellerProduct } from "../../../helpers"
import { VendorUpdateProductOptionType } from "../../../validators"
+import { convertOptionToAttributeWorkflow } from "../../../../../../workflows/product-attribute/workflows/convert-option-to-attribute"
+import { transformProductWithInformationalAttributes } from "../../../utils/transform-product-attributes"
export const POST = async (
req: AuthenticatedMedusaRequest<VendorUpdateProductOptionType>,
res: MedusaResponse<HttpTypes.VendorProductResponse>
) => {
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
- const sellerId = req.auth_context.actor_id
- const { additional_data, ...update } = req.validatedBody
+ const sellerId = req.seller_context!.seller_id
+ const { additional_data, convert_to_attribute, ...update } =
+ req.validatedBody as any
await validateSellerProduct(req.scope, sellerId, req.params.id)
- await updateProductOptionsWorkflow(req.scope).run({
- input: {
- selector: { id: req.params.option_id },
- update,
- additional_data: {
- ...additional_data,
- seller_id: sellerId,
+ if (convert_to_attribute) {
+ // Fetch option details to get values and metadata
+ const {
+ data: [option],
+ } = await query.graph({
+ entity: "product_option",
+ fields: ["id", "title", "values.*", "metadata"],
+ filters: { id: req.params.option_id },
+ })
+
+ const attributeId = option?.metadata?.attribute_id as
+ | string
+ | undefined
+
+ if (attributeId) {
+ await convertOptionToAttributeWorkflow(req.scope).run({
+ input: {
+ product_id: req.params.id,
+ option_id: req.params.option_id,
+ seller_id: sellerId,
+ attribute_id: attributeId,
+ values:
+ option.values?.map((v: { value: string }) => v.value) ?? [],
+ },
+ })
+ } else {
+ // No linked attribute — just delete the option
+ await deleteProductOptionsWorkflow(req.scope).run({
+ input: { ids: [req.params.option_id] },
+ })
+ }
+ } else {
+ await updateProductOptionsWorkflow(req.scope).run({
+ input: {
+ selector: { id: req.params.option_id },
+ update,
+ additional_data: {
+ ...additional_data,
+ seller_id: sellerId,
+ },
},
- },
- })
+ })
+ }
const {
data: [product],
@@ -41,14 +77,18 @@ export const POST = async (
filters: { id: req.params.id },
})
- res.json({ product })
+ const transformedProduct = transformProductWithInformationalAttributes(
+ product as any
+ )
+
+ res.json({ product: transformedProduct })
}
export const DELETE = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse<HttpTypes.VendorDeleteResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerProduct(req.scope, sellerId, req.params.id)
diff --git a/packages/core-plugin/src/api/vendor/products/[id]/options/route.ts b/packages/core-plugin/src/api/vendor/products/[id]/options/route.ts
index d904430b2..963710a81 100644
--- a/packages/core-plugin/src/api/vendor/products/[id]/options/route.ts
+++ b/packages/core-plugin/src/api/vendor/products/[id]/options/route.ts
@@ -14,7 +14,7 @@ export const POST = async (
res: MedusaResponse<HttpTypes.VendorProductResponse>
) => {
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const { additional_data, ...rest } = req.validatedBody
await validateSellerProduct(req.scope, sellerId, req.params.id)
diff --git a/packages/core-plugin/src/api/vendor/products/[id]/route.ts b/packages/core-plugin/src/api/vendor/products/[id]/route.ts
index fe303d5d2..08e59b9c8 100644
--- a/packages/core-plugin/src/api/vendor/products/[id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/products/[id]/route.ts
@@ -1,7 +1,4 @@
-import {
- deleteProductsWorkflow,
- updateProductsWorkflow,
-} from "@medusajs/core-flows"
+import { deleteProductsWorkflow } from "@medusajs/core-flows"
import {
AuthenticatedMedusaRequest,
MedusaResponse,
@@ -14,13 +11,15 @@ import { HttpTypes } from "@mercurjs/types"
import { validateSellerProduct } from "../helpers"
import { VendorUpdateProductType } from "../validators"
+import { transformProductWithInformationalAttributes } from "../utils/transform-product-attributes"
+import { updateProductWithVariantImagesWorkflow } from "../../../../workflows/product-attribute/workflows/update-product-with-variant-images"
export const GET = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse<HttpTypes.VendorProductResponse>
) => {
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerProduct(req.scope, sellerId, req.params.id)
@@ -39,7 +38,11 @@ export const GET = async (
)
}
- res.json({ product })
+ const transformedProduct = transformProductWithInformationalAttributes(
+ product as any
+ )
+
+ res.json({ product: transformedProduct })
}
export const POST = async (
@@ -47,12 +50,14 @@ export const POST = async (
res: MedusaResponse<HttpTypes.VendorProductResponse>
) => {
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const { additional_data, ...update } = req.validatedBody
await validateSellerProduct(req.scope, sellerId, req.params.id)
- const { result } = await updateProductsWorkflow(req.scope).run({
+ const { result } = await updateProductWithVariantImagesWorkflow(
+ req.scope
+ ).run({
input: {
selector: { id: req.params.id },
update,
@@ -71,14 +76,18 @@ export const POST = async (
filters: { id: result[0].id },
})
- res.json({ product })
+ const transformedProduct = transformProductWithInformationalAttributes(
+ product as any
+ )
+
+ res.json({ product: transformedProduct })
}
export const DELETE = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse<HttpTypes.VendorDeleteResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerProduct(req.scope, sellerId, req.params.id)
diff --git a/packages/core-plugin/src/api/vendor/products/[id]/variants/[variant_id]/media/route.ts b/packages/core-plugin/src/api/vendor/products/[id]/variants/[variant_id]/media/route.ts
new file mode 100644
index 000000000..eda0fb532
--- /dev/null
+++ b/packages/core-plugin/src/api/vendor/products/[id]/variants/[variant_id]/media/route.ts
@@ -0,0 +1,26 @@
+import {
+ AuthenticatedMedusaRequest,
+ MedusaResponse,
+} from "@medusajs/framework/http"
+import { batchVariantImagesWorkflow } from "@medusajs/medusa/core-flows"
+import { VendorBatchVariantImagesType } from "../../../../validators"
+
+export const POST = async (
+ req: AuthenticatedMedusaRequest<VendorBatchVariantImagesType>,
+ res: MedusaResponse
+) => {
+ const variantId = req.params.variant_id
+
+ const { result } = await batchVariantImagesWorkflow(req.scope).run({
+ input: {
+ variant_id: variantId,
+ add: req.validatedBody.add,
+ remove: req.validatedBody.remove,
+ },
+ })
+
+ res.status(200).json({
+ added: result.added,
+ removed: result.removed,
+ })
+}
diff --git a/packages/core-plugin/src/api/vendor/products/[id]/variants/[variant_id]/route.ts b/packages/core-plugin/src/api/vendor/products/[id]/variants/[variant_id]/route.ts
index 4f255519a..4387c4c71 100644
--- a/packages/core-plugin/src/api/vendor/products/[id]/variants/[variant_id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/products/[id]/variants/[variant_id]/route.ts
@@ -21,7 +21,7 @@ export const GET = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerProduct(req.scope, sellerId, req.params.id)
@@ -40,7 +40,7 @@ export const POST = async (
res: MedusaResponse<HttpTypes.VendorProductResponse>
) => {
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const { additional_data, ...update } = req.validatedBody
await validateSellerProduct(req.scope, sellerId, req.params.id)
@@ -71,7 +71,7 @@ export const DELETE = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse<HttpTypes.VendorDeleteResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerProduct(req.scope, sellerId, req.params.id)
diff --git a/packages/core-plugin/src/api/vendor/products/[id]/variants/route.ts b/packages/core-plugin/src/api/vendor/products/[id]/variants/route.ts
index fc6aa82ad..6e64d06b9 100644
--- a/packages/core-plugin/src/api/vendor/products/[id]/variants/route.ts
+++ b/packages/core-plugin/src/api/vendor/products/[id]/variants/route.ts
@@ -14,7 +14,7 @@ export const GET = async (
res: MedusaResponse<HttpTypes.VendorProductVariantListResponse>
) => {
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerProduct(req.scope, sellerId, req.params.id)
@@ -41,7 +41,7 @@ export const POST = async (
res: MedusaResponse<HttpTypes.VendorProductResponse>
) => {
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const { additional_data, ...variantData } = req.validatedBody
await validateSellerProduct(req.scope, sellerId, req.params.id)
diff --git a/packages/core-plugin/src/api/vendor/products/middlewares.ts b/packages/core-plugin/src/api/vendor/products/middlewares.ts
index cd4f0980b..d9f404ab4 100644
--- a/packages/core-plugin/src/api/vendor/products/middlewares.ts
+++ b/packages/core-plugin/src/api/vendor/products/middlewares.ts
@@ -15,6 +15,8 @@ import {
vendorProductVariantQueryConfig,
} from "./query-config"
import {
+ VendorAddProductAttribute,
+ VendorBatchVariantImages,
VendorCreateProduct,
VendorCreateProductOption,
VendorCreateProductVariant,
@@ -23,6 +25,7 @@ import {
VendorGetProductVariantParams,
VendorGetProductVariantsParams,
VendorUpdateProduct,
+ VendorUpdateProductAttribute,
VendorUpdateProductOption,
VendorUpdateProductVariant,
} from "./validators"
@@ -33,7 +36,7 @@ const applySellerProductLinkFilter = (
res: MedusaResponse,
next: MedusaNextFunction
) => {
- req.filterableFields.seller_id = req.auth_context.actor_id
+ req.filterableFields.seller_id = req.seller_context!.seller_id
return maybeApplyLinkFilter({
entryPoint: "product_seller",
@@ -166,4 +169,40 @@ export const vendorProductsMiddlewares: MiddlewareRoute[] = [
matcher: "/vendor/products/:id/options/:option_id",
middlewares: [],
},
+ // Attribute management routes
+ {
+ method: ["POST"],
+ matcher: "/vendor/products/:id/attributes",
+ middlewares: [
+ validateAndTransformBody(VendorAddProductAttribute),
+ validateAndTransformQuery(
+ VendorGetProductParams,
+ vendorProductQueryConfig.retrieve
+ ),
+ ],
+ },
+ {
+ method: ["POST"],
+ matcher: "/vendor/products/:id/attributes/:attribute_id",
+ middlewares: [
+ validateAndTransformBody(VendorUpdateProductAttribute),
+ validateAndTransformQuery(
+ VendorGetProductParams,
+ vendorProductQueryConfig.retrieve
+ ),
+ ],
+ },
+ {
+ method: ["DELETE"],
+ matcher: "/vendor/products/:id/attributes/:attribute_id",
+ middlewares: [],
+ },
+ // Variant media route
+ {
+ method: ["POST"],
+ matcher: "/vendor/products/:id/variants/:variant_id/media",
+ middlewares: [
+ validateAndTransformBody(VendorBatchVariantImages),
+ ],
+ },
]
diff --git a/packages/core-plugin/src/api/vendor/products/query-config.ts b/packages/core-plugin/src/api/vendor/products/query-config.ts
index ff5399918..4337343a1 100644
--- a/packages/core-plugin/src/api/vendor/products/query-config.ts
+++ b/packages/core-plugin/src/api/vendor/products/query-config.ts
@@ -33,7 +33,10 @@ export const vendorProductFields = [
"*variants",
"*variants.prices",
"*variants.options",
+ "*variants.inventory_items",
"*categories",
+ "*attribute_values",
+ "*attribute_values.attribute",
]
export const vendorProductQueryConfig = {
diff --git a/packages/core-plugin/src/api/vendor/products/route.ts b/packages/core-plugin/src/api/vendor/products/route.ts
index 637e4542f..471622797 100644
--- a/packages/core-plugin/src/api/vendor/products/route.ts
+++ b/packages/core-plugin/src/api/vendor/products/route.ts
@@ -34,7 +34,7 @@ export const POST = async (
res: MedusaResponse<HttpTypes.VendorProductResponse>
) => {
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const { additional_data, ...productData } = req.validatedBody
const {
diff --git a/packages/core-plugin/src/api/vendor/products/utils/transform-product-attributes.ts b/packages/core-plugin/src/api/vendor/products/utils/transform-product-attributes.ts
new file mode 100644
index 000000000..c16158177
--- /dev/null
+++ b/packages/core-plugin/src/api/vendor/products/utils/transform-product-attributes.ts
@@ -0,0 +1,144 @@
+import {
+ AttributeSource,
+ AttributeUIComponent,
+ InformationalAttributeDTO,
+ InformationalAttributeValueDTO,
+} from "@mercurjs/types"
+
+interface AttributeValueWithAttribute {
+ id: string
+ value: string
+ source: AttributeSource
+ attribute: {
+ id: string
+ name: string
+ ui_component: string
+ source: AttributeSource
+ is_filterable: boolean
+ is_required: boolean
+ }
+}
+
+interface ProductOption {
+ id: string
+ title: string
+ values?: { id: string; value: string }[]
+}
+
+interface ProductWithAttributes {
+ attribute_values?: AttributeValueWithAttribute[]
+ options?: ProductOption[]
+ [key: string]: unknown
+}
+
+interface AttributeAccumulator {
+ attribute_id: string
+ name: string
+ ui_component: AttributeUIComponent
+ attribute_source: AttributeSource
+ is_filterable: boolean
+ is_required: boolean
+ values: InformationalAttributeValueDTO[]
+}
+
+function transformAttributeValues(
+ attributeValues: AttributeValueWithAttribute[]
+): InformationalAttributeDTO[] {
+ const existingAttributeValues = attributeValues.filter(
+ (av) => av && av.attribute
+ )
+ if (existingAttributeValues.length === 0) {
+ return []
+ }
+
+ const attributeMap = new Map<string, AttributeAccumulator>()
+
+ for (const av of existingAttributeValues) {
+ const attributeId = av.attribute.id
+ const existing = attributeMap.get(attributeId)
+
+ const isValueFilterable =
+ av.attribute.source === AttributeSource.ADMIN &&
+ av.attribute.is_filterable &&
+ av.source === AttributeSource.ADMIN
+
+ const isEditable = av.source === AttributeSource.VENDOR
+
+ const valueDto: InformationalAttributeValueDTO = {
+ value: av.value,
+ source: av.source,
+ attribute_value_id: av.id,
+ is_filterable: isValueFilterable,
+ is_editable: isEditable,
+ }
+
+ if (existing) {
+ existing.values.push(valueDto)
+ } else {
+ attributeMap.set(attributeId, {
+ attribute_id: attributeId,
+ name: av.attribute.name,
+ ui_component: av.attribute.ui_component as AttributeUIComponent,
+ attribute_source: av.attribute.source,
+ is_filterable: av.attribute.is_filterable,
+ is_required: av.attribute.is_required,
+ values: [valueDto],
+ })
+ }
+ }
+
+ const result: InformationalAttributeDTO[] = []
+
+ for (const acc of attributeMap.values()) {
+ const isDefinitionEditable =
+ acc.attribute_source === AttributeSource.VENDOR
+
+ result.push({
+ attribute_id: acc.attribute_id,
+ name: acc.name,
+ ui_component: acc.ui_component,
+ attribute_source: acc.attribute_source,
+ is_filterable: acc.is_filterable,
+ is_required: acc.is_required,
+ is_definition_editable: isDefinitionEditable,
+ values: acc.values,
+ })
+ }
+
+ return result
+}
+
+export function transformProductWithInformationalAttributes<
+ T extends ProductWithAttributes,
+>(
+ product: T
+): T & { informational_attributes: InformationalAttributeDTO[] } {
+ const optionTitles = new Set(
+ (product.options ?? []).map((option) => option.title.toLowerCase())
+ )
+
+ const filteredAttributeValues = (product.attribute_values ?? []).filter(
+ (av) =>
+ av &&
+ av.attribute &&
+ !optionTitles.has(av.attribute.name.toLowerCase())
+ )
+
+ const informationalAttributes =
+ transformAttributeValues(filteredAttributeValues)
+
+ return {
+ ...product,
+ informational_attributes: informationalAttributes,
+ }
+}
+
+export function transformProductsWithInformationalAttributes<
+ T extends ProductWithAttributes,
+>(
+ products: T[]
+): (T & { informational_attributes: InformationalAttributeDTO[] })[] {
+ return products.map((product) =>
+ transformProductWithInformationalAttributes(product)
+ )
+}
diff --git a/packages/core-plugin/src/api/vendor/products/validators.ts b/packages/core-plugin/src/api/vendor/products/validators.ts
index c139d7cd7..eb7226729 100644
--- a/packages/core-plugin/src/api/vendor/products/validators.ts
+++ b/packages/core-plugin/src/api/vendor/products/validators.ts
@@ -72,6 +72,7 @@ export const UpdateProductOption = z.object({
id: z.string().optional(),
title: z.string().optional(),
values: z.array(z.string()).optional(),
+ convert_to_attribute: z.boolean().optional(),
})
export const VendorUpdateProductOption = WithAdditionalData(UpdateProductOption)
@@ -207,6 +208,76 @@ export const UpdateProduct = z
origin_country: z.string().nullish(),
material: z.string().nullish(),
metadata: z.record(z.unknown()).nullish(),
+ additional_data: z.record(z.unknown()).nullish(),
})
- .strict()
export const VendorUpdateProduct = WithAdditionalData(UpdateProduct)
+
+/* Attribute Inputs for Product Creation */
+
+const AttributeUIComponentEnum = z.enum([
+ "select",
+ "multivalue",
+ "unit",
+ "toggle",
+ "text_area",
+ "color_picker",
+])
+
+export type AdminAttributeInputType = z.infer<typeof AdminAttributeInput>
+export const AdminAttributeInput = z.object({
+ attribute_id: z.string(),
+ values: z.array(z.string()).min(1),
+ use_for_variations: z.boolean(),
+})
+
+export type VendorAttributeInputType = z.infer<typeof VendorAttributeInput>
+export const VendorAttributeInput = z.object({
+ name: z.string().min(1),
+ values: z.array(z.string()).min(1),
+ use_for_variations: z.boolean(),
+ ui_component: AttributeUIComponentEnum.optional(),
+ extends_attribute_id: z.string().optional(),
+})
+
+export type ProductAttributesAdditionalDataType = z.infer<
+ typeof ProductAttributesAdditionalData
+>
+export const ProductAttributesAdditionalData = z.object({
+ admin_attributes: z.array(AdminAttributeInput).optional(),
+ vendor_attributes: z.array(VendorAttributeInput).optional(),
+})
+
+/* Attribute Management Endpoints */
+
+export type VendorAddProductAttributeType = z.infer<
+ typeof VendorAddProductAttribute
+>
+export const VendorAddProductAttribute = z.object({
+ attribute_id: z.string().optional(),
+ name: z.string().optional(),
+ values: z.array(z.string()).min(1),
+ use_for_variations: z.boolean().optional().default(false),
+ ui_component: AttributeUIComponentEnum.optional(),
+ rank: z.number().optional(),
+})
+
+export type VendorUpdateProductAttributeType = z.infer<
+ typeof VendorUpdateProductAttribute
+>
+export const VendorUpdateProductAttribute = z.object({
+ name: z.string().optional(),
+ ui_component: AttributeUIComponentEnum.optional(),
+ values: z.array(z.string()).optional(),
+ use_for_variations: z.boolean().optional(),
+ rank: z.number().optional(),
+})
+
+/* Batch Variant Images */
+
+export type VendorBatchVariantImagesType = z.infer<
+ typeof VendorBatchVariantImages
+>
+export const VendorBatchVariantImages = z.object({
+ add: z.array(z.string()).optional(),
+ remove: z.array(z.string()).optional(),
+})
diff --git a/packages/core-plugin/src/api/vendor/promotions/[id]/[rule_type]/route.ts b/packages/core-plugin/src/api/vendor/promotions/[id]/[rule_type]/route.ts
index 2f7e3956d..2a38bed5b 100644
--- a/packages/core-plugin/src/api/vendor/promotions/[id]/[rule_type]/route.ts
+++ b/packages/core-plugin/src/api/vendor/promotions/[id]/[rule_type]/route.ts
@@ -24,7 +24,7 @@ export const GET = async (
) => {
const { id, rule_type: ruleType } = req.params
- await validateSellerPromotion(req.scope, req.auth_context.actor_id, id)
+ await validateSellerPromotion(req.scope, req.seller_context!.seller_id, id)
validateRuleType(ruleType)
diff --git a/packages/core-plugin/src/api/vendor/promotions/[id]/buy-rules/batch/route.ts b/packages/core-plugin/src/api/vendor/promotions/[id]/buy-rules/batch/route.ts
index 069f9de46..b7f1093b5 100644
--- a/packages/core-plugin/src/api/vendor/promotions/[id]/buy-rules/batch/route.ts
+++ b/packages/core-plugin/src/api/vendor/promotions/[id]/buy-rules/batch/route.ts
@@ -21,7 +21,7 @@ export const POST = async (
) => {
const { id } = req.params
- await validateSellerPromotion(req.scope, req.auth_context.actor_id, id)
+ await validateSellerPromotion(req.scope, req.seller_context!.seller_id, id)
const { result } = await batchPromotionRulesWorkflow(req.scope).run({
input: {
diff --git a/packages/core-plugin/src/api/vendor/promotions/[id]/route.ts b/packages/core-plugin/src/api/vendor/promotions/[id]/route.ts
index dbe9e0134..8f39e2ed2 100644
--- a/packages/core-plugin/src/api/vendor/promotions/[id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/promotions/[id]/route.ts
@@ -18,7 +18,7 @@ export const GET = async (
) => {
const { id } = req.params
- await validateSellerPromotion(req.scope, req.auth_context.actor_id, id)
+ await validateSellerPromotion(req.scope, req.seller_context!.seller_id, id)
const promotion = await refetchPromotion(
id,
@@ -42,7 +42,7 @@ export const POST = async (
) => {
const { id } = req.params
- await validateSellerPromotion(req.scope, req.auth_context.actor_id, id)
+ await validateSellerPromotion(req.scope, req.seller_context!.seller_id, id)
await updatePromotionsWorkflow(req.scope).run({
input: {
@@ -65,7 +65,7 @@ export const DELETE = async (
) => {
const { id } = req.params
- await validateSellerPromotion(req.scope, req.auth_context.actor_id, id)
+ await validateSellerPromotion(req.scope, req.seller_context!.seller_id, id)
await deletePromotionsWorkflow(req.scope).run({
input: { ids: [id] },
diff --git a/packages/core-plugin/src/api/vendor/promotions/[id]/rules/batch/route.ts b/packages/core-plugin/src/api/vendor/promotions/[id]/rules/batch/route.ts
index 0efa89e59..7ed78478d 100644
--- a/packages/core-plugin/src/api/vendor/promotions/[id]/rules/batch/route.ts
+++ b/packages/core-plugin/src/api/vendor/promotions/[id]/rules/batch/route.ts
@@ -21,7 +21,7 @@ export const POST = async (
) => {
const { id } = req.params
- await validateSellerPromotion(req.scope, req.auth_context.actor_id, id)
+ await validateSellerPromotion(req.scope, req.seller_context!.seller_id, id)
const { result } = await batchPromotionRulesWorkflow(req.scope).run({
input: {
diff --git a/packages/core-plugin/src/api/vendor/promotions/[id]/target-rules/batch/route.ts b/packages/core-plugin/src/api/vendor/promotions/[id]/target-rules/batch/route.ts
index 2d6b81705..7f0359c49 100644
--- a/packages/core-plugin/src/api/vendor/promotions/[id]/target-rules/batch/route.ts
+++ b/packages/core-plugin/src/api/vendor/promotions/[id]/target-rules/batch/route.ts
@@ -21,7 +21,7 @@ export const POST = async (
) => {
const { id } = req.params
- await validateSellerPromotion(req.scope, req.auth_context.actor_id, id)
+ await validateSellerPromotion(req.scope, req.seller_context!.seller_id, id)
const { result } = await batchPromotionRulesWorkflow(req.scope).run({
input: {
diff --git a/packages/core-plugin/src/api/vendor/promotions/middlewares.ts b/packages/core-plugin/src/api/vendor/promotions/middlewares.ts
index 23fbd2529..21dfe23f3 100644
--- a/packages/core-plugin/src/api/vendor/promotions/middlewares.ts
+++ b/packages/core-plugin/src/api/vendor/promotions/middlewares.ts
@@ -29,7 +29,7 @@ const applySellerPromotionLinkFilter = (
res: MedusaResponse,
next: MedusaNextFunction
) => {
- req.filterableFields.seller_id = req.auth_context.actor_id
+ req.filterableFields.seller_id = req.seller_context!.seller_id
return maybeApplyLinkFilter({
entryPoint: "promotion_seller",
diff --git a/packages/core-plugin/src/api/vendor/promotions/route.ts b/packages/core-plugin/src/api/vendor/promotions/route.ts
index 0c7afe77f..c9dd115c9 100644
--- a/packages/core-plugin/src/api/vendor/promotions/route.ts
+++ b/packages/core-plugin/src/api/vendor/promotions/route.ts
@@ -37,7 +37,7 @@ export const POST = async (
req: AuthenticatedMedusaRequest<VendorCreatePromotionType>,
res: MedusaResponse<HttpTypes.VendorPromotionResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const { result } = await createSellerPromotionsWorkflow(req.scope).run({
input: {
diff --git a/packages/core-plugin/src/api/vendor/promotions/rule-value-options/[rule_type]/[rule_attribute_id]/route.ts b/packages/core-plugin/src/api/vendor/promotions/rule-value-options/[rule_type]/[rule_attribute_id]/route.ts
index 0aac86aae..47d0b70d5 100644
--- a/packages/core-plugin/src/api/vendor/promotions/rule-value-options/[rule_type]/[rule_attribute_id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/promotions/rule-value-options/[rule_type]/[rule_attribute_id]/route.ts
@@ -49,7 +49,7 @@ export const GET = async (
entity: `${queryConfig.entryPoint}_seller`,
fields: [`${queryConfig.entryPoint}_id`],
filters: {
- seller_id: req.auth_context.actor_id,
+ seller_id: req.seller_context!.seller_id,
},
})
diff --git a/packages/core-plugin/src/api/vendor/returns/[id]/cancel/route.ts b/packages/core-plugin/src/api/vendor/returns/[id]/cancel/route.ts
index f27c5fbae..85dc8d541 100644
--- a/packages/core-plugin/src/api/vendor/returns/[id]/cancel/route.ts
+++ b/packages/core-plugin/src/api/vendor/returns/[id]/cancel/route.ts
@@ -14,7 +14,7 @@ export const POST = async (
) => {
const { id } = req.params
- await validateSellerReturn(req.scope, req.auth_context.actor_id, id)
+ await validateSellerReturn(req.scope, req.seller_context!.seller_id, id)
const workflow = cancelReturnWorkflow(req.scope)
const { result } = await workflow.run({
diff --git a/packages/core-plugin/src/api/vendor/returns/[id]/dismiss-items/[action_id]/route.ts b/packages/core-plugin/src/api/vendor/returns/[id]/dismiss-items/[action_id]/route.ts
index 757e61d7d..337ab6687 100644
--- a/packages/core-plugin/src/api/vendor/returns/[id]/dismiss-items/[action_id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/returns/[id]/dismiss-items/[action_id]/route.ts
@@ -18,7 +18,7 @@ export const POST = async (
) => {
const { id, action_id } = req.params
- await validateSellerReturn(req.scope, req.auth_context.actor_id, id)
+ await validateSellerReturn(req.scope, req.seller_context!.seller_id, id)
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
@@ -55,7 +55,7 @@ export const DELETE = async (
) => {
const { id, action_id } = req.params
- await validateSellerReturn(req.scope, req.auth_context.actor_id, id)
+ await validateSellerReturn(req.scope, req.seller_context!.seller_id, id)
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
diff --git a/packages/core-plugin/src/api/vendor/returns/[id]/dismiss-items/route.ts b/packages/core-plugin/src/api/vendor/returns/[id]/dismiss-items/route.ts
index 7c9749b0a..1643b1297 100644
--- a/packages/core-plugin/src/api/vendor/returns/[id]/dismiss-items/route.ts
+++ b/packages/core-plugin/src/api/vendor/returns/[id]/dismiss-items/route.ts
@@ -15,7 +15,7 @@ export const POST = async (
) => {
const { id } = req.params
- await validateSellerReturn(req.scope, req.auth_context.actor_id, id)
+ await validateSellerReturn(req.scope, req.seller_context!.seller_id, id)
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
diff --git a/packages/core-plugin/src/api/vendor/returns/[id]/receive-items/[action_id]/route.ts b/packages/core-plugin/src/api/vendor/returns/[id]/receive-items/[action_id]/route.ts
index b764136b3..6316f949a 100644
--- a/packages/core-plugin/src/api/vendor/returns/[id]/receive-items/[action_id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/returns/[id]/receive-items/[action_id]/route.ts
@@ -18,7 +18,7 @@ export const POST = async (
) => {
const { id, action_id } = req.params
- await validateSellerReturn(req.scope, req.auth_context.actor_id, id)
+ await validateSellerReturn(req.scope, req.seller_context!.seller_id, id)
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
@@ -55,7 +55,7 @@ export const DELETE = async (
) => {
const { id, action_id } = req.params
- await validateSellerReturn(req.scope, req.auth_context.actor_id, id)
+ await validateSellerReturn(req.scope, req.seller_context!.seller_id, id)
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
diff --git a/packages/core-plugin/src/api/vendor/returns/[id]/receive-items/route.ts b/packages/core-plugin/src/api/vendor/returns/[id]/receive-items/route.ts
index d9f243d69..0b1b08640 100644
--- a/packages/core-plugin/src/api/vendor/returns/[id]/receive-items/route.ts
+++ b/packages/core-plugin/src/api/vendor/returns/[id]/receive-items/route.ts
@@ -15,7 +15,7 @@ export const POST = async (
) => {
const { id } = req.params
- await validateSellerReturn(req.scope, req.auth_context.actor_id, id)
+ await validateSellerReturn(req.scope, req.seller_context!.seller_id, id)
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
diff --git a/packages/core-plugin/src/api/vendor/returns/[id]/receive/confirm/route.ts b/packages/core-plugin/src/api/vendor/returns/[id]/receive/confirm/route.ts
index 3742d164d..dda79bc33 100644
--- a/packages/core-plugin/src/api/vendor/returns/[id]/receive/confirm/route.ts
+++ b/packages/core-plugin/src/api/vendor/returns/[id]/receive/confirm/route.ts
@@ -15,14 +15,14 @@ export const POST = async (
) => {
const { id } = req.params
- await validateSellerReturn(req.scope, req.auth_context.actor_id, id)
+ await validateSellerReturn(req.scope, req.seller_context!.seller_id, id)
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
const { result } = await confirmReturnReceiveWorkflow(req.scope).run({
input: {
return_id: id,
- confirmed_by: req.auth_context.actor_id,
+ confirmed_by: req.seller_context!.seller_id,
},
})
diff --git a/packages/core-plugin/src/api/vendor/returns/[id]/receive/route.ts b/packages/core-plugin/src/api/vendor/returns/[id]/receive/route.ts
index 5e8a2e2e0..5065b7a2c 100644
--- a/packages/core-plugin/src/api/vendor/returns/[id]/receive/route.ts
+++ b/packages/core-plugin/src/api/vendor/returns/[id]/receive/route.ts
@@ -22,7 +22,7 @@ export const POST = async (
) => {
const { id } = req.params
- await validateSellerReturn(req.scope, req.auth_context.actor_id, id)
+ await validateSellerReturn(req.scope, req.seller_context!.seller_id, id)
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
const orderModuleService = req.scope.resolve(Modules.ORDER)
@@ -59,7 +59,7 @@ export const DELETE = async (
) => {
const { id } = req.params
- await validateSellerReturn(req.scope, req.auth_context.actor_id, id)
+ await validateSellerReturn(req.scope, req.seller_context!.seller_id, id)
await cancelReturnReceiveWorkflow(req.scope).run({
input: {
diff --git a/packages/core-plugin/src/api/vendor/returns/[id]/request-items/[action_id]/route.ts b/packages/core-plugin/src/api/vendor/returns/[id]/request-items/[action_id]/route.ts
index d8b988da7..60bf03e0c 100644
--- a/packages/core-plugin/src/api/vendor/returns/[id]/request-items/[action_id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/returns/[id]/request-items/[action_id]/route.ts
@@ -18,7 +18,7 @@ export const POST = async (
) => {
const { id, action_id } = req.params
- await validateSellerReturn(req.scope, req.auth_context.actor_id, id)
+ await validateSellerReturn(req.scope, req.seller_context!.seller_id, id)
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
@@ -53,7 +53,7 @@ export const DELETE = async (
) => {
const { id, action_id } = req.params
- await validateSellerReturn(req.scope, req.auth_context.actor_id, id)
+ await validateSellerReturn(req.scope, req.seller_context!.seller_id, id)
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
diff --git a/packages/core-plugin/src/api/vendor/returns/[id]/request-items/route.ts b/packages/core-plugin/src/api/vendor/returns/[id]/request-items/route.ts
index 76461de4e..9ca64ecd3 100644
--- a/packages/core-plugin/src/api/vendor/returns/[id]/request-items/route.ts
+++ b/packages/core-plugin/src/api/vendor/returns/[id]/request-items/route.ts
@@ -15,7 +15,7 @@ export const POST = async (
) => {
const { id } = req.params
- await validateSellerReturn(req.scope, req.auth_context.actor_id, id)
+ await validateSellerReturn(req.scope, req.seller_context!.seller_id, id)
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
diff --git a/packages/core-plugin/src/api/vendor/returns/[id]/request/route.ts b/packages/core-plugin/src/api/vendor/returns/[id]/request/route.ts
index 659e9c157..b8f78c2a6 100644
--- a/packages/core-plugin/src/api/vendor/returns/[id]/request/route.ts
+++ b/packages/core-plugin/src/api/vendor/returns/[id]/request/route.ts
@@ -18,14 +18,14 @@ export const POST = async (
) => {
const { id } = req.params
- await validateSellerReturn(req.scope, req.auth_context.actor_id, id)
+ await validateSellerReturn(req.scope, req.seller_context!.seller_id, id)
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
const { result } = await confirmReturnRequestWorkflow(req.scope).run({
input: {
return_id: id,
- confirmed_by: req.auth_context.actor_id,
+ confirmed_by: req.seller_context!.seller_id,
},
})
@@ -52,7 +52,7 @@ export const DELETE = async (
) => {
const { id } = req.params
- await validateSellerReturn(req.scope, req.auth_context.actor_id, id)
+ await validateSellerReturn(req.scope, req.seller_context!.seller_id, id)
await cancelReturnRequestWorkflow(req.scope).run({
input: {
diff --git a/packages/core-plugin/src/api/vendor/returns/[id]/route.ts b/packages/core-plugin/src/api/vendor/returns/[id]/route.ts
index 3234da5c3..a84f3c3f0 100644
--- a/packages/core-plugin/src/api/vendor/returns/[id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/returns/[id]/route.ts
@@ -15,7 +15,7 @@ export const GET = async (
) => {
const { id } = req.params
- await validateSellerReturn(req.scope, req.auth_context.actor_id, id)
+ await validateSellerReturn(req.scope, req.seller_context!.seller_id, id)
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
@@ -41,7 +41,7 @@ export const POST = async (
) => {
const { id } = req.params
- await validateSellerReturn(req.scope, req.auth_context.actor_id, id)
+ await validateSellerReturn(req.scope, req.seller_context!.seller_id, id)
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
diff --git a/packages/core-plugin/src/api/vendor/returns/[id]/shipping-method/[action_id]/route.ts b/packages/core-plugin/src/api/vendor/returns/[id]/shipping-method/[action_id]/route.ts
index f0593f1c6..4fe6ac19d 100644
--- a/packages/core-plugin/src/api/vendor/returns/[id]/shipping-method/[action_id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/returns/[id]/shipping-method/[action_id]/route.ts
@@ -18,7 +18,7 @@ export const POST = async (
) => {
const { id, action_id } = req.params
- await validateSellerReturn(req.scope, req.auth_context.actor_id, id)
+ await validateSellerReturn(req.scope, req.seller_context!.seller_id, id)
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
@@ -53,7 +53,7 @@ export const DELETE = async (
) => {
const { id, action_id } = req.params
- await validateSellerReturn(req.scope, req.auth_context.actor_id, id)
+ await validateSellerReturn(req.scope, req.seller_context!.seller_id, id)
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
diff --git a/packages/core-plugin/src/api/vendor/returns/[id]/shipping-method/route.ts b/packages/core-plugin/src/api/vendor/returns/[id]/shipping-method/route.ts
index 91986f5dc..fa250f548 100644
--- a/packages/core-plugin/src/api/vendor/returns/[id]/shipping-method/route.ts
+++ b/packages/core-plugin/src/api/vendor/returns/[id]/shipping-method/route.ts
@@ -15,7 +15,7 @@ export const POST = async (
) => {
const { id } = req.params
- await validateSellerReturn(req.scope, req.auth_context.actor_id, id)
+ await validateSellerReturn(req.scope, req.seller_context!.seller_id, id)
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
diff --git a/packages/core-plugin/src/api/vendor/returns/middlewares.ts b/packages/core-plugin/src/api/vendor/returns/middlewares.ts
index e2b5e62dd..acba8e532 100644
--- a/packages/core-plugin/src/api/vendor/returns/middlewares.ts
+++ b/packages/core-plugin/src/api/vendor/returns/middlewares.ts
@@ -36,13 +36,13 @@ const applySellerOrderLinkFilter = async (
if (req.filterableFields.order_id) {
await validateSellerOrder(
req.scope,
- req.auth_context.actor_id,
+ req.seller_context!.seller_id,
req.filterableFields.order_id as string | string[]
)
return next()
}
- req.filterableFields.seller_id = req.auth_context.actor_id
+ req.filterableFields.seller_id = req.seller_context!.seller_id
return maybeApplyLinkFilter({
entryPoint: "order_seller",
diff --git a/packages/core-plugin/src/api/vendor/returns/route.ts b/packages/core-plugin/src/api/vendor/returns/route.ts
index a27eb0eaf..114092bd8 100644
--- a/packages/core-plugin/src/api/vendor/returns/route.ts
+++ b/packages/core-plugin/src/api/vendor/returns/route.ts
@@ -40,13 +40,13 @@ export const POST = async (
) => {
await validateSellerOrder(
req.scope,
- req.auth_context.actor_id,
+ req.seller_context!.seller_id,
req.validatedBody.order_id
)
const input = {
...req.validatedBody,
- created_by: req.auth_context.actor_id,
+ created_by: req.seller_context!.seller_id,
}
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
diff --git a/packages/core-plugin/src/api/vendor/sales-channels/[id]/products/route.ts b/packages/core-plugin/src/api/vendor/sales-channels/[id]/products/route.ts
index 5494cc886..48f981277 100644
--- a/packages/core-plugin/src/api/vendor/sales-channels/[id]/products/route.ts
+++ b/packages/core-plugin/src/api/vendor/sales-channels/[id]/products/route.ts
@@ -14,7 +14,7 @@ export const POST = async (
res: MedusaResponse<VendorHttpTypes.VendorSalesChannelResponse>
) => {
const { id } = req.params
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const { add, remove } = req.validatedBody
const productIdsToValidate = [...(add || []), ...(remove || [])]
diff --git a/packages/core-plugin/src/api/vendor/sellers/me/route.ts b/packages/core-plugin/src/api/vendor/sellers/me/route.ts
new file mode 100644
index 000000000..94dc8aa54
--- /dev/null
+++ b/packages/core-plugin/src/api/vendor/sellers/me/route.ts
@@ -0,0 +1,44 @@
+import {
+ AuthenticatedMedusaRequest,
+ MedusaResponse,
+} from "@medusajs/framework"
+import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
+import { HttpTypes } from "@mercurjs/types"
+
+import { VendorUpdateSellerType } from "../validators"
+
+export const GET = async (
+ req: AuthenticatedMedusaRequest,
+ res: MedusaResponse<HttpTypes.VendorSellerResponse>
+) => {
+ const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
+ const sellerId = req.seller_context!.seller_id
+
+ const {
+ data: [seller],
+ } = await query.graph({
+ entity: "seller",
+ fields: req.queryConfig.fields,
+ filters: { id: sellerId },
+ })
+
+ res.json({ seller })
+}
+
+export const POST = async (
+ req: AuthenticatedMedusaRequest<VendorUpdateSellerType>,
+ res: MedusaResponse<HttpTypes.VendorSellerResponse>
+) => {
+ const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
+ const sellerId = req.seller_context!.seller_id
+
+ const {
+ data: [seller],
+ } = await query.graph({
+ entity: "seller",
+ fields: req.queryConfig.fields,
+ filters: { id: sellerId },
+ })
+
+ res.json({ seller })
+}
diff --git a/packages/core-plugin/src/api/vendor/sellers/middlewares.ts b/packages/core-plugin/src/api/vendor/sellers/middlewares.ts
index 4a882486b..aa9be5629 100644
--- a/packages/core-plugin/src/api/vendor/sellers/middlewares.ts
+++ b/packages/core-plugin/src/api/vendor/sellers/middlewares.ts
@@ -29,6 +29,29 @@ export const vendorSellersMiddlewares: MiddlewareRoute[] = [
validateAndTransformBody(VendorSelectSeller),
],
},
+ // GET /vendor/sellers/me — get current seller
+ {
+ method: ["GET"],
+ matcher: "/vendor/sellers/me",
+ middlewares: [
+ validateAndTransformQuery(
+ VendorGetSellerParams,
+ QueryConfig.retrieveVendorSellerQueryConfig
+ ),
+ ],
+ },
+ // POST /vendor/sellers/me — update current seller
+ {
+ method: ["POST"],
+ matcher: "/vendor/sellers/me",
+ middlewares: [
+ validateAndTransformBody(VendorUpdateSeller),
+ validateAndTransformQuery(
+ VendorGetSellerParams,
+ QueryConfig.retrieveVendorSellerQueryConfig
+ ),
+ ],
+ },
// POST /vendor/sellers — create seller
{
method: ["POST"],
diff --git a/packages/core-plugin/src/api/vendor/shipping-options/[id]/route.ts b/packages/core-plugin/src/api/vendor/shipping-options/[id]/route.ts
index ccf7be0d7..2b5894f6a 100644
--- a/packages/core-plugin/src/api/vendor/shipping-options/[id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/shipping-options/[id]/route.ts
@@ -17,7 +17,7 @@ export const GET = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse<HttpTypes.VendorShippingOptionResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerShippingOption(req.scope, sellerId, req.params.id)
@@ -41,7 +41,7 @@ export const POST = async (
req: AuthenticatedMedusaRequest<VendorUpdateShippingOptionType>,
res: MedusaResponse<HttpTypes.VendorShippingOptionResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerShippingOption(req.scope, sellerId, req.params.id)
@@ -72,7 +72,7 @@ export const DELETE = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse<HttpTypes.VendorShippingOptionDeleteResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const shippingOptionId = req.params.id
await validateSellerShippingOption(req.scope, sellerId, shippingOptionId)
diff --git a/packages/core-plugin/src/api/vendor/shipping-options/[id]/rules/batch/route.ts b/packages/core-plugin/src/api/vendor/shipping-options/[id]/rules/batch/route.ts
index 87e33e725..601645812 100644
--- a/packages/core-plugin/src/api/vendor/shipping-options/[id]/rules/batch/route.ts
+++ b/packages/core-plugin/src/api/vendor/shipping-options/[id]/rules/batch/route.ts
@@ -21,7 +21,7 @@ export const POST = async (
>,
res: MedusaResponse<HttpTypes.VendorUpdateShippingOptionRulesResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const id = req.params.id
await validateSellerShippingOption(req.scope, sellerId, id)
diff --git a/packages/core-plugin/src/api/vendor/shipping-options/middlewares.ts b/packages/core-plugin/src/api/vendor/shipping-options/middlewares.ts
index 64ff168ad..76e3b0de3 100644
--- a/packages/core-plugin/src/api/vendor/shipping-options/middlewares.ts
+++ b/packages/core-plugin/src/api/vendor/shipping-options/middlewares.ts
@@ -30,7 +30,7 @@ const applySellerShippingOptionLinkFilter = (
res: MedusaResponse,
next: MedusaNextFunction
) => {
- req.filterableFields.seller_id = req.auth_context.actor_id
+ req.filterableFields.seller_id = req.seller_context!.seller_id
return maybeApplyLinkFilter({
entryPoint: "shipping_option_seller",
diff --git a/packages/core-plugin/src/api/vendor/shipping-options/route.ts b/packages/core-plugin/src/api/vendor/shipping-options/route.ts
index 630c25d93..9455566fb 100644
--- a/packages/core-plugin/src/api/vendor/shipping-options/route.ts
+++ b/packages/core-plugin/src/api/vendor/shipping-options/route.ts
@@ -34,7 +34,7 @@ export const POST = async (
req: AuthenticatedMedusaRequest<VendorCreateShippingOptionType>,
res: MedusaResponse<HttpTypes.VendorShippingOptionResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const { result } = await createSellerShippingOptionsWorkflow(req.scope).run({
input: {
diff --git a/packages/core-plugin/src/api/vendor/shipping-profiles/[id]/route.ts b/packages/core-plugin/src/api/vendor/shipping-profiles/[id]/route.ts
index efd7fdc67..c67014108 100644
--- a/packages/core-plugin/src/api/vendor/shipping-profiles/[id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/shipping-profiles/[id]/route.ts
@@ -18,7 +18,7 @@ export const GET = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse<HttpTypes.VendorShippingProfileResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerShippingProfile(req.scope, sellerId, req.params.id)
@@ -35,7 +35,7 @@ export const POST = async (
req: AuthenticatedMedusaRequest<VendorUpdateShippingProfileType>,
res: MedusaResponse<HttpTypes.VendorShippingProfileResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const { id } = req.params
await validateSellerShippingProfile(req.scope, sellerId, id)
@@ -57,7 +57,7 @@ export const DELETE = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse<HttpTypes.VendorShippingProfileDeleteResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const { id } = req.params
await validateSellerShippingProfile(req.scope, sellerId, id)
diff --git a/packages/core-plugin/src/api/vendor/shipping-profiles/middlewares.ts b/packages/core-plugin/src/api/vendor/shipping-profiles/middlewares.ts
index 88bc5e670..1ae2f1e75 100644
--- a/packages/core-plugin/src/api/vendor/shipping-profiles/middlewares.ts
+++ b/packages/core-plugin/src/api/vendor/shipping-profiles/middlewares.ts
@@ -23,7 +23,7 @@ const applySellerShippingProfileLinkFilter = (
res: MedusaResponse,
next: MedusaNextFunction
) => {
- req.filterableFields.seller_id = req.auth_context.actor_id
+ req.filterableFields.seller_id = req.seller_context!.seller_id
return maybeApplyLinkFilter({
entryPoint: "shipping_profile_seller",
diff --git a/packages/core-plugin/src/api/vendor/shipping-profiles/route.ts b/packages/core-plugin/src/api/vendor/shipping-profiles/route.ts
index 700b9aa1e..574a999ce 100644
--- a/packages/core-plugin/src/api/vendor/shipping-profiles/route.ts
+++ b/packages/core-plugin/src/api/vendor/shipping-profiles/route.ts
@@ -34,7 +34,7 @@ export const POST = async (
req: AuthenticatedMedusaRequest<VendorCreateShippingProfileType>,
res: MedusaResponse<HttpTypes.VendorShippingProfileResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const { result } = await createSellerShippingProfilesWorkflow(req.scope).run({
input: {
diff --git a/packages/core-plugin/src/api/vendor/stock-locations/[id]/fulfillment-providers/route.ts b/packages/core-plugin/src/api/vendor/stock-locations/[id]/fulfillment-providers/route.ts
index baadb9964..190ca903f 100644
--- a/packages/core-plugin/src/api/vendor/stock-locations/[id]/fulfillment-providers/route.ts
+++ b/packages/core-plugin/src/api/vendor/stock-locations/[id]/fulfillment-providers/route.ts
@@ -23,7 +23,7 @@ export const POST = async (
res: MedusaResponse<VendorHttpTypes.VendorStockLocationResponse>
) => {
const { id } = req.params
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const { add = [], remove = [] } = req.validatedBody
await validateSellerStockLocation(req.scope, sellerId, id)
diff --git a/packages/core-plugin/src/api/vendor/stock-locations/[id]/fulfillment-sets/route.ts b/packages/core-plugin/src/api/vendor/stock-locations/[id]/fulfillment-sets/route.ts
index c00d25be1..209ca3510 100644
--- a/packages/core-plugin/src/api/vendor/stock-locations/[id]/fulfillment-sets/route.ts
+++ b/packages/core-plugin/src/api/vendor/stock-locations/[id]/fulfillment-sets/route.ts
@@ -13,7 +13,7 @@ export const POST = async (
res: MedusaResponse<HttpTypes.VendorStockLocationResponse>
) => {
const { id } = req.params
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerStockLocation(req.scope, sellerId, id)
diff --git a/packages/core-plugin/src/api/vendor/stock-locations/[id]/route.ts b/packages/core-plugin/src/api/vendor/stock-locations/[id]/route.ts
index 9e9cdfb39..4cc87add6 100644
--- a/packages/core-plugin/src/api/vendor/stock-locations/[id]/route.ts
+++ b/packages/core-plugin/src/api/vendor/stock-locations/[id]/route.ts
@@ -16,7 +16,7 @@ export const GET = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse<HttpTypes.VendorStockLocationResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerStockLocation(req.scope, sellerId, req.params.id)
@@ -40,7 +40,7 @@ export const POST = async (
req: AuthenticatedMedusaRequest<VendorUpdateStockLocationType>,
res: MedusaResponse<HttpTypes.VendorStockLocationResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerStockLocation(req.scope, sellerId, req.params.id)
@@ -64,7 +64,7 @@ export const DELETE = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse<HttpTypes.VendorDeleteResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
await validateSellerStockLocation(req.scope, sellerId, req.params.id)
diff --git a/packages/core-plugin/src/api/vendor/stock-locations/[id]/sales-channels/route.ts b/packages/core-plugin/src/api/vendor/stock-locations/[id]/sales-channels/route.ts
index f4709db9e..589e4e068 100644
--- a/packages/core-plugin/src/api/vendor/stock-locations/[id]/sales-channels/route.ts
+++ b/packages/core-plugin/src/api/vendor/stock-locations/[id]/sales-channels/route.ts
@@ -13,7 +13,7 @@ export const POST = async (
res: MedusaResponse<VendorHttpTypes.VendorStockLocationResponse>
) => {
const { id } = req.params
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const { add, remove } = req.validatedBody
await validateSellerStockLocation(req.scope, sellerId, id)
diff --git a/packages/core-plugin/src/api/vendor/stock-locations/middlewares.ts b/packages/core-plugin/src/api/vendor/stock-locations/middlewares.ts
index 705826ba6..9baec6284 100644
--- a/packages/core-plugin/src/api/vendor/stock-locations/middlewares.ts
+++ b/packages/core-plugin/src/api/vendor/stock-locations/middlewares.ts
@@ -25,7 +25,7 @@ const applySellerStockLocationLinkFilter = (
res: MedusaResponse,
next: MedusaNextFunction
) => {
- req.filterableFields.seller_id = req.auth_context.actor_id
+ req.filterableFields.seller_id = req.seller_context!.seller_id
return maybeApplyLinkFilter({
entryPoint: "stock_location_seller",
diff --git a/packages/core-plugin/src/api/vendor/stock-locations/route.ts b/packages/core-plugin/src/api/vendor/stock-locations/route.ts
index b5bb7c75d..3e12c8b26 100644
--- a/packages/core-plugin/src/api/vendor/stock-locations/route.ts
+++ b/packages/core-plugin/src/api/vendor/stock-locations/route.ts
@@ -34,7 +34,7 @@ export const POST = async (
req: AuthenticatedMedusaRequest<VendorCreateStockLocationType>,
res: MedusaResponse<HttpTypes.VendorStockLocationResponse>
) => {
- const sellerId = req.auth_context.actor_id
+ const sellerId = req.seller_context!.seller_id
const { result } = await createSellerStockLocationsWorkflow(req.scope).run({
input: {
diff --git a/packages/core-plugin/src/links/category-attribute-link.ts b/packages/core-plugin/src/links/category-attribute-link.ts
new file mode 100644
index 000000000..9ed4680e1
--- /dev/null
+++ b/packages/core-plugin/src/links/category-attribute-link.ts
@@ -0,0 +1,15 @@
+import { defineLink } from "@medusajs/framework/utils"
+import ProductModule from "@medusajs/medusa/product"
+
+import AttributeModule from "../modules/attribute"
+
+export default defineLink(
+ {
+ linkable: ProductModule.linkable.productCategory,
+ isList: true,
+ },
+ {
+ linkable: AttributeModule.linkable.attribute,
+ isList: true,
+ }
+)
diff --git a/packages/core-plugin/src/links/product-attribute-value-link.ts b/packages/core-plugin/src/links/product-attribute-value-link.ts
new file mode 100644
index 000000000..07a2e148e
--- /dev/null
+++ b/packages/core-plugin/src/links/product-attribute-value-link.ts
@@ -0,0 +1,15 @@
+import { defineLink } from "@medusajs/framework/utils"
+import ProductModule from "@medusajs/medusa/product"
+
+import AttributeModule from "../modules/attribute"
+
+export default defineLink(
+ {
+ linkable: ProductModule.linkable.product,
+ isList: true,
+ },
+ {
+ linkable: AttributeModule.linkable.attributeValue,
+ isList: true,
+ }
+)
diff --git a/packages/core-plugin/src/links/product-vendor-product-attribute-link.ts b/packages/core-plugin/src/links/product-vendor-product-attribute-link.ts
new file mode 100644
index 000000000..94ac6ddcd
--- /dev/null
+++ b/packages/core-plugin/src/links/product-vendor-product-attribute-link.ts
@@ -0,0 +1,16 @@
+import { defineLink } from "@medusajs/framework/utils"
+import ProductModule from "@medusajs/medusa/product"
+
+import VendorProductAttributeModule from "../modules/vendor-product-attribute"
+
+export default defineLink(
+ {
+ linkable: ProductModule.linkable.product,
+ isList: true,
+ },
+ {
+ linkable:
+ VendorProductAttributeModule.linkable.vendorProductAttribute,
+ isList: true,
+ }
+)
diff --git a/packages/core-plugin/src/links/seller-attribute-link.ts b/packages/core-plugin/src/links/seller-attribute-link.ts
new file mode 100644
index 000000000..44a669a45
--- /dev/null
+++ b/packages/core-plugin/src/links/seller-attribute-link.ts
@@ -0,0 +1,9 @@
+import { defineLink } from "@medusajs/framework/utils"
+
+import AttributeModule from "../modules/attribute"
+import SellerModule from "../modules/seller"
+
+export default defineLink(SellerModule.linkable.seller, {
+ linkable: AttributeModule.linkable.attribute,
+ isList: true,
+})
diff --git a/packages/core-plugin/src/links/seller-attribute-value-link.ts b/packages/core-plugin/src/links/seller-attribute-value-link.ts
new file mode 100644
index 000000000..02adeb495
--- /dev/null
+++ b/packages/core-plugin/src/links/seller-attribute-value-link.ts
@@ -0,0 +1,9 @@
+import { defineLink } from "@medusajs/framework/utils"
+
+import AttributeModule from "../modules/attribute"
+import SellerModule from "../modules/seller"
+
+export default defineLink(SellerModule.linkable.seller, {
+ linkable: AttributeModule.linkable.attributeValue,
+ isList: true,
+})
diff --git a/packages/core-plugin/src/links/seller-member-rbac-role.ts b/packages/core-plugin/src/links/seller-member-rbac-role.ts
index 1517e8965..b95db0221 100644
--- a/packages/core-plugin/src/links/seller-member-rbac-role.ts
+++ b/packages/core-plugin/src/links/seller-member-rbac-role.ts
@@ -1,12 +1,13 @@
-import { defineLink } from "@medusajs/framework/utils"
-import RbacModule from "@medusajs/medusa/rbac"
-import SellerModule from "../modules/seller"
-
-export default defineLink(
- {
- linkable: SellerModule.linkable.sellerMember,
- field: "role_id",
- },
- RbacModule.linkable.rbacRole,
- { readOnly: true }
-)
+// TEMP: Commented out - RBAC module not enabled in dev config
+// import { defineLink } from "@medusajs/framework/utils"
+// import RbacModule from "@medusajs/medusa/rbac"
+// import SellerModule from "../modules/seller"
+//
+// export default defineLink(
+// {
+// linkable: SellerModule.linkable.sellerMember,
+// field: "role_id",
+// },
+// RbacModule.linkable.rbacRole,
+// { readOnly: true }
+// )
diff --git a/packages/core-plugin/src/links/seller-vendor-product-attribute-link.ts b/packages/core-plugin/src/links/seller-vendor-product-attribute-link.ts
new file mode 100644
index 000000000..38075c331
--- /dev/null
+++ b/packages/core-plugin/src/links/seller-vendor-product-attribute-link.ts
@@ -0,0 +1,10 @@
+import { defineLink } from "@medusajs/framework/utils"
+
+import SellerModule from "../modules/seller"
+import VendorProductAttributeModule from "../modules/vendor-product-attribute"
+
+export default defineLink(SellerModule.linkable.seller, {
+ linkable:
+ VendorProductAttributeModule.linkable.vendorProductAttribute,
+ isList: true,
+})
diff --git a/packages/core-plugin/src/modules/attribute/index.ts b/packages/core-plugin/src/modules/attribute/index.ts
new file mode 100644
index 000000000..57b68761f
--- /dev/null
+++ b/packages/core-plugin/src/modules/attribute/index.ts
@@ -0,0 +1,11 @@
+import { Module } from "@medusajs/framework/utils"
+import { MercurModules } from "@mercurjs/types"
+
+import AttributeModuleService from "./service"
+
+export const ATTRIBUTE_MODULE = MercurModules.ATTRIBUTE
+export { AttributeModuleService }
+
+export default Module(ATTRIBUTE_MODULE, {
+ service: AttributeModuleService,
+})
diff --git a/packages/core-plugin/src/modules/attribute/migrations/Migration20260325000000.ts b/packages/core-plugin/src/modules/attribute/migrations/Migration20260325000000.ts
new file mode 100644
index 000000000..ec3b429b9
--- /dev/null
+++ b/packages/core-plugin/src/modules/attribute/migrations/Migration20260325000000.ts
@@ -0,0 +1,66 @@
+import { Migration } from "@medusajs/framework/mikro-orm/migrations"
+
+export class Migration20260325000000 extends Migration {
+ override async up(): Promise<void> {
+ this.addSql(
+ `alter table if exists "attribute" drop constraint if exists "attribute_handle_unique";`
+ )
+ this.addSql(
+ `create table if not exists "attribute" ("id" text not null, "name" text not null, "description" text null, "handle" text not null, "metadata" jsonb null, "ui_component" text check ("ui_component" in ('select', 'multivalue', 'unit', 'toggle', 'text_area', 'color_picker')) not null default 'select', "is_filterable" boolean not null default false, "is_required" boolean not null default false, "source" text not null default 'admin', "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "attribute_pkey" primary key ("id"));`
+ )
+ this.addSql(
+ `CREATE UNIQUE INDEX IF NOT EXISTS "IDX_attribute_handle_unique" ON "attribute" (handle) WHERE deleted_at IS NULL;`
+ )
+ this.addSql(
+ `CREATE INDEX IF NOT EXISTS "IDX_attribute_deleted_at" ON "attribute" (deleted_at) WHERE deleted_at IS NULL;`
+ )
+ this.addSql(
+ `CREATE INDEX IF NOT EXISTS "IDX_attribute_source_name" ON "attribute" ("source", "name") WHERE deleted_at IS NULL;`
+ )
+
+ this.addSql(
+ `create table if not exists "attribute_possible_value" ("id" text not null, "value" text not null, "rank" integer not null, "metadata" jsonb null, "attribute_id" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "attribute_possible_value_pkey" primary key ("id"));`
+ )
+ this.addSql(
+ `CREATE INDEX IF NOT EXISTS "IDX_attribute_possible_value_attribute_id" ON "attribute_possible_value" (attribute_id) WHERE deleted_at IS NULL;`
+ )
+ this.addSql(
+ `CREATE INDEX IF NOT EXISTS "IDX_attribute_possible_value_deleted_at" ON "attribute_possible_value" (deleted_at) WHERE deleted_at IS NULL;`
+ )
+ this.addSql(
+ `CREATE UNIQUE INDEX IF NOT EXISTS "UQ_attribute_id_value" ON "attribute_possible_value" (attribute_id, value) WHERE deleted_at IS NULL;`
+ )
+
+ this.addSql(
+ `create table if not exists "attribute_value" ("id" text not null, "value" text not null, "rank" integer not null, "metadata" jsonb null, "source" text not null default 'admin', "attribute_id" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "attribute_value_pkey" primary key ("id"));`
+ )
+ this.addSql(
+ `CREATE INDEX IF NOT EXISTS "IDX_attribute_value_attribute_id" ON "attribute_value" (attribute_id) WHERE deleted_at IS NULL;`
+ )
+ this.addSql(
+ `CREATE INDEX IF NOT EXISTS "IDX_attribute_value_deleted_at" ON "attribute_value" (deleted_at) WHERE deleted_at IS NULL;`
+ )
+ this.addSql(
+ `CREATE INDEX IF NOT EXISTS "IDX_attribute_value_attribute_source" ON "attribute_value" ("attribute_id", "source") WHERE deleted_at IS NULL;`
+ )
+
+ this.addSql(
+ `alter table if exists "attribute_possible_value" add constraint "attribute_possible_value_attribute_id_foreign" foreign key ("attribute_id") references "attribute" ("id") on update cascade on delete cascade;`
+ )
+ this.addSql(
+ `alter table if exists "attribute_value" add constraint "attribute_value_attribute_id_foreign" foreign key ("attribute_id") references "attribute" ("id") on update cascade on delete cascade;`
+ )
+ }
+
+ override async down(): Promise<void> {
+ this.addSql(
+ `alter table if exists "attribute_possible_value" drop constraint if exists "attribute_possible_value_attribute_id_foreign";`
+ )
+ this.addSql(
+ `alter table if exists "attribute_value" drop constraint if exists "attribute_value_attribute_id_foreign";`
+ )
+ this.addSql(`drop table if exists "attribute" cascade;`)
+ this.addSql(`drop table if exists "attribute_possible_value" cascade;`)
+ this.addSql(`drop table if exists "attribute_value" cascade;`)
+ }
+}
diff --git a/packages/core-plugin/src/modules/attribute/models/attribute-possible-value.ts b/packages/core-plugin/src/modules/attribute/models/attribute-possible-value.ts
new file mode 100644
index 000000000..f4060f778
--- /dev/null
+++ b/packages/core-plugin/src/modules/attribute/models/attribute-possible-value.ts
@@ -0,0 +1,23 @@
+import { model } from "@medusajs/framework/utils"
+
+import Attribute from "./attribute"
+
+const AttributePossibleValue = model
+ .define("attribute_possible_value", {
+ id: model.id({ prefix: "attr_pos_val" }).primaryKey(),
+ value: model.text(),
+ rank: model.number(),
+ metadata: model.json().nullable(),
+ attribute: model.belongsTo(() => Attribute, {
+ mappedBy: "possible_values",
+ }),
+ })
+ .indexes([
+ {
+ on: ["attribute_id", "value"],
+ name: "UQ_attribute_id_value",
+ unique: true,
+ },
+ ])
+
+export default AttributePossibleValue
diff --git a/packages/core-plugin/src/modules/attribute/models/attribute-value.ts b/packages/core-plugin/src/modules/attribute/models/attribute-value.ts
new file mode 100644
index 000000000..96e9f4428
--- /dev/null
+++ b/packages/core-plugin/src/modules/attribute/models/attribute-value.ts
@@ -0,0 +1,23 @@
+import { model } from "@medusajs/framework/utils"
+
+import Attribute from "./attribute"
+
+const AttributeValue = model
+ .define("attribute_value", {
+ id: model.id({ prefix: "attr_val" }).primaryKey(),
+ value: model.text(),
+ rank: model.number(),
+ metadata: model.json().nullable(),
+ source: model.text().default("admin"),
+ attribute: model.belongsTo(() => Attribute, {
+ mappedBy: "values",
+ }),
+ })
+ .indexes([
+ {
+ on: ["attribute_id", "source"],
+ name: "IDX_attribute_value_attribute_source",
+ },
+ ])
+
+export default AttributeValue
diff --git a/packages/core-plugin/src/modules/attribute/models/attribute.ts b/packages/core-plugin/src/modules/attribute/models/attribute.ts
new file mode 100644
index 000000000..1ef254a14
--- /dev/null
+++ b/packages/core-plugin/src/modules/attribute/models/attribute.ts
@@ -0,0 +1,33 @@
+import { model } from "@medusajs/framework/utils"
+
+import { AttributeUIComponent } from "@mercurjs/types"
+import AttributePossibleValue from "./attribute-possible-value"
+import AttributeValue from "./attribute-value"
+
+const Attribute = model
+ .define("attribute", {
+ id: model.id({ prefix: "attr" }).primaryKey(),
+ name: model.text().searchable(),
+ description: model.text().nullable(),
+ is_required: model.boolean().default(false),
+ is_filterable: model.boolean().default(false),
+ handle: model.text().unique(),
+ metadata: model.json().nullable(),
+ ui_component: model
+ .enum(Object.values(AttributeUIComponent))
+ .default(AttributeUIComponent.SELECT),
+ source: model.text().default("admin"),
+ values: model.hasMany(() => AttributeValue),
+ possible_values: model.hasMany(() => AttributePossibleValue),
+ })
+ .indexes([
+ {
+ on: ["source", "name"],
+ name: "IDX_attribute_source_name",
+ },
+ ])
+ .cascades({
+ delete: ["values", "possible_values"],
+ })
+
+export default Attribute
diff --git a/packages/core-plugin/src/modules/attribute/models/index.ts b/packages/core-plugin/src/modules/attribute/models/index.ts
new file mode 100644
index 000000000..f48f52690
--- /dev/null
+++ b/packages/core-plugin/src/modules/attribute/models/index.ts
@@ -0,0 +1,3 @@
+export { default as Attribute } from "./attribute"
+export { default as AttributeValue } from "./attribute-value"
+export { default as AttributePossibleValue } from "./attribute-possible-value"
diff --git a/packages/core-plugin/src/modules/attribute/service.ts b/packages/core-plugin/src/modules/attribute/service.ts
new file mode 100644
index 000000000..70ef71adb
--- /dev/null
+++ b/packages/core-plugin/src/modules/attribute/service.ts
@@ -0,0 +1,99 @@
+import { EntityManager } from "@medusajs/framework/mikro-orm/knex"
+import { Context, DAL, InferTypeOf } from "@medusajs/framework/types"
+import {
+ InjectManager,
+ InjectTransactionManager,
+ MedusaContext,
+ MedusaService,
+} from "@medusajs/framework/utils"
+
+import { UpdateAttributeDTO } from "@mercurjs/types"
+import Attribute from "./models/attribute"
+import AttributePossibleValue from "./models/attribute-possible-value"
+import AttributeValue from "./models/attribute-value"
+
+type IAttribute = InferTypeOf<typeof Attribute>
+type IAttributePossibleValue = InferTypeOf<typeof AttributePossibleValue>
+
+type InjectedDependencies = {
+ attributeRepository: DAL.RepositoryService<IAttribute>
+ attributePossibleValueRepository: DAL.RepositoryService<IAttributePossibleValue>
+}
+
+class AttributeModuleService extends MedusaService({
+ Attribute,
+ AttributeValue,
+ AttributePossibleValue,
+}) {
+ protected attributeRepository_: DAL.RepositoryService<IAttribute>
+ protected attributePossibleValueRepository_: DAL.RepositoryService<IAttributePossibleValue>
+
+ constructor({
+ attributeRepository,
+ attributePossibleValueRepository,
+ }: InjectedDependencies) {
+ super(...arguments)
+ this.attributeRepository_ = attributeRepository
+ this.attributePossibleValueRepository_ =
+ attributePossibleValueRepository
+ }
+
+ @InjectManager()
+ async updateAttributeWithUpsertOrReplacePossibleValues(
+ input: UpdateAttributeDTO | UpdateAttributeDTO[],
+ @MedusaContext() sharedContext?: Context<EntityManager>
+ ) {
+ const normalizedInput = Array.isArray(input) ? input : [input]
+
+ return this.updateAttributeWithUpsertOrReplacePossibleValues_(
+ normalizedInput,
+ sharedContext
+ )
+ }
+
+ @InjectTransactionManager()
+ protected async updateAttributeWithUpsertOrReplacePossibleValues_(
+ input: UpdateAttributeDTO[],
+ @MedusaContext() sharedContext?: Context<EntityManager>
+ ) {
+ const inputsWithValues = input.filter(
+ (element) => element.possible_values !== undefined
+ )
+
+ const allPossibleValues = inputsWithValues.flatMap(
+ (element) => element.possible_values!
+ )
+
+ const upsertedValues = allPossibleValues.length
+ ? await this.attributePossibleValueRepository_.upsert(
+ allPossibleValues,
+ sharedContext
+ )
+ : []
+
+ const attributesInput = input.map((toUpdate) => {
+ const { possible_values, ...rest } = toUpdate
+
+ if (possible_values === undefined) {
+ return rest
+ }
+
+ return {
+ ...rest,
+ possible_values: upsertedValues
+ .filter((val) => val.attribute_id === rest.id)
+ .map((upserted) => ({ id: upserted.id })),
+ }
+ })
+
+ const hasRelationUpdates = inputsWithValues.length > 0
+
+ return this.attributeRepository_.upsertWithReplace(
+ attributesInput,
+ { relations: hasRelationUpdates ? ["possible_values"] : [] },
+ sharedContext
+ )
+ }
+}
+
+export default AttributeModuleService
diff --git a/packages/core-plugin/src/modules/vendor-product-attribute/index.ts b/packages/core-plugin/src/modules/vendor-product-attribute/index.ts
new file mode 100644
index 000000000..b83933349
--- /dev/null
+++ b/packages/core-plugin/src/modules/vendor-product-attribute/index.ts
@@ -0,0 +1,12 @@
+import { Module } from "@medusajs/framework/utils"
+import { MercurModules } from "@mercurjs/types"
+
+import VendorProductAttributeModuleService from "./service"
+
+export const VENDOR_PRODUCT_ATTRIBUTE_MODULE =
+ MercurModules.VENDOR_PRODUCT_ATTRIBUTE
+export { VendorProductAttributeModuleService }
+
+export default Module(VENDOR_PRODUCT_ATTRIBUTE_MODULE, {
+ service: VendorProductAttributeModuleService,
+})
diff --git a/packages/core-plugin/src/modules/vendor-product-attribute/migrations/Migration20260325000000.ts b/packages/core-plugin/src/modules/vendor-product-attribute/migrations/Migration20260325000000.ts
new file mode 100644
index 000000000..c60c3abaa
--- /dev/null
+++ b/packages/core-plugin/src/modules/vendor-product-attribute/migrations/Migration20260325000000.ts
@@ -0,0 +1,19 @@
+import { Migration } from "@medusajs/framework/mikro-orm/migrations"
+
+export class Migration20260325000000 extends Migration {
+ override async up(): Promise<void> {
+ this.addSql(
+ `create table if not exists "vendor_product_attribute" ("id" text not null, "name" text not null, "value" text not null, "ui_component" text check ("ui_component" in ('select', 'multivalue', 'unit', 'toggle', 'text_area', 'color_picker')) not null default 'text_area', "extends_attribute_id" text null, "rank" integer not null default 0, "metadata" jsonb null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "vendor_product_attribute_pkey" primary key ("id"));`
+ )
+ this.addSql(
+ `CREATE INDEX IF NOT EXISTS "IDX_vendor_product_attribute_deleted_at" ON "vendor_product_attribute" ("deleted_at") WHERE deleted_at IS NULL;`
+ )
+ this.addSql(
+ `CREATE INDEX IF NOT EXISTS "IDX_vendor_product_attribute_name" ON "vendor_product_attribute" ("name") WHERE deleted_at IS NULL;`
+ )
+ }
+
+ override async down(): Promise<void> {
+ this.addSql(`drop table if exists "vendor_product_attribute" cascade;`)
+ }
+}
diff --git a/packages/core-plugin/src/modules/vendor-product-attribute/models/vendor-product-attribute.ts b/packages/core-plugin/src/modules/vendor-product-attribute/models/vendor-product-attribute.ts
new file mode 100644
index 000000000..db7a6602a
--- /dev/null
+++ b/packages/core-plugin/src/modules/vendor-product-attribute/models/vendor-product-attribute.ts
@@ -0,0 +1,24 @@
+import { model } from "@medusajs/framework/utils"
+
+import { AttributeUIComponent } from "@mercurjs/types"
+
+const VendorProductAttribute = model
+ .define("vendor_product_attribute", {
+ id: model.id({ prefix: "vnd_prod_attr" }).primaryKey(),
+ name: model.text(),
+ value: model.text(),
+ ui_component: model
+ .enum(Object.values(AttributeUIComponent))
+ .default(AttributeUIComponent.TEXTAREA),
+ extends_attribute_id: model.text().nullable(),
+ rank: model.number().default(0),
+ metadata: model.json().nullable(),
+ })
+ .indexes([
+ {
+ on: ["name"],
+ name: "IDX_vendor_product_attribute_name",
+ },
+ ])
+
+export default VendorProductAttribute
diff --git a/packages/core-plugin/src/modules/vendor-product-attribute/service.ts b/packages/core-plugin/src/modules/vendor-product-attribute/service.ts
new file mode 100644
index 000000000..d9e06faab
--- /dev/null
+++ b/packages/core-plugin/src/modules/vendor-product-attribute/service.ts
@@ -0,0 +1,9 @@
+import { MedusaService } from "@medusajs/framework/utils"
+
+import VendorProductAttribute from "./models/vendor-product-attribute"
+
+class VendorProductAttributeModuleService extends MedusaService({
+ VendorProductAttribute,
+}) {}
+
+export default VendorProductAttributeModuleService
diff --git a/packages/core-plugin/src/types/vendor-request.d.ts b/packages/core-plugin/src/types/vendor-request.d.ts
new file mode 100644
index 000000000..51133ac73
--- /dev/null
+++ b/packages/core-plugin/src/types/vendor-request.d.ts
@@ -0,0 +1,14 @@
+import "@medusajs/framework/http"
+
+declare module "@medusajs/framework/http" {
+ interface MedusaRequest {
+ seller_context?: {
+ seller_id: string
+ seller_member?: {
+ id: string
+ seller_id: string
+ member_id: string
+ }
+ }
+ }
+}
diff --git a/packages/core-plugin/src/workflows/attribute/index.ts b/packages/core-plugin/src/workflows/attribute/index.ts
new file mode 100644
index 000000000..e84516860
--- /dev/null
+++ b/packages/core-plugin/src/workflows/attribute/index.ts
@@ -0,0 +1,2 @@
+export * from "./workflows"
+export * from "./steps"
diff --git a/packages/core-plugin/src/workflows/attribute/steps/create-attribute-possible-values.ts b/packages/core-plugin/src/workflows/attribute/steps/create-attribute-possible-values.ts
new file mode 100644
index 000000000..4082dcf9f
--- /dev/null
+++ b/packages/core-plugin/src/workflows/attribute/steps/create-attribute-possible-values.ts
@@ -0,0 +1,35 @@
+import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
+
+import {
+ ATTRIBUTE_MODULE,
+ AttributeModuleService,
+} from "../../../modules/attribute"
+import { CreateAttributeValueDTO } from "@mercurjs/types"
+
+export const createAttributePossibleValuesStepId =
+ "create-attribute-possible-values"
+
+export type CreateAttributePossibleValuesStepInput = CreateAttributeValueDTO[]
+
+export const createAttributePossibleValuesStep = createStep(
+ createAttributePossibleValuesStepId,
+ async (data: CreateAttributePossibleValuesStepInput, { container }) => {
+ const service = container.resolve<AttributeModuleService>(ATTRIBUTE_MODULE)
+
+ const values = await service.createAttributePossibleValues(data)
+
+ return new StepResponse(
+ values,
+ values.map((val) => val.id)
+ )
+ },
+ async (ids, { container }) => {
+ if (!ids?.length) {
+ return
+ }
+
+ const service = container.resolve<AttributeModuleService>(ATTRIBUTE_MODULE)
+
+ await service.deleteAttributeValues(ids)
+ }
+)
diff --git a/packages/core-plugin/src/workflows/attribute/steps/create-attributes.ts b/packages/core-plugin/src/workflows/attribute/steps/create-attributes.ts
new file mode 100644
index 000000000..c5c58002b
--- /dev/null
+++ b/packages/core-plugin/src/workflows/attribute/steps/create-attributes.ts
@@ -0,0 +1,56 @@
+import { MedusaError, toHandle } from "@medusajs/framework/utils"
+import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
+
+import {
+ ATTRIBUTE_MODULE,
+ AttributeModuleService,
+} from "../../../modules/attribute"
+import { CreateAttributeDTO } from "@mercurjs/types"
+
+export const createAttributesStepId = "create-attributes"
+
+type CreateAttributeStepInput = Omit<
+ CreateAttributeDTO,
+ "product_category_ids"
+>[]
+
+export const createAttributesStep = createStep(
+ createAttributesStepId,
+ async (data: CreateAttributeStepInput, { container }) => {
+ const service = container.resolve<AttributeModuleService>(ATTRIBUTE_MODULE)
+
+ const existingAttributes = await service.listAttributes({
+ name: data.map((attribute) => attribute.name),
+ })
+
+ if (existingAttributes.length) {
+ throw new MedusaError(
+ MedusaError.Types.CONFLICT,
+ `Attributes ${existingAttributes.map((attribute) => attribute.name).join(", ")} already exist`
+ )
+ }
+
+ const validated = data.map((attribute) => {
+ return {
+ ...attribute,
+ handle: attribute.handle || toHandle(attribute.name),
+ }
+ })
+
+ //@ts-expect-error Possible values
+ const created = (await service.createAttributes(validated)) as any[]
+ return new StepResponse(
+ created,
+ created.map((attribute) => attribute.id)
+ )
+ },
+ async (createdIds: string[] | undefined, { container }) => {
+ if (!createdIds?.length) {
+ return
+ }
+
+ const service = container.resolve<AttributeModuleService>(ATTRIBUTE_MODULE)
+
+ await service.deleteAttributes(createdIds)
+ }
+)
diff --git a/packages/core-plugin/src/workflows/attribute/steps/delete-attribute.ts b/packages/core-plugin/src/workflows/attribute/steps/delete-attribute.ts
new file mode 100644
index 000000000..0863e6819
--- /dev/null
+++ b/packages/core-plugin/src/workflows/attribute/steps/delete-attribute.ts
@@ -0,0 +1,48 @@
+import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
+import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
+
+import {
+ ATTRIBUTE_MODULE,
+ AttributeModuleService,
+} from "../../../modules/attribute"
+
+export const deleteAttributeStepId = "delete-attribute-step"
+
+type DeleteAttributeStepInput = {
+ id: string
+}
+
+export const deleteAttributeStep = createStep(
+ deleteAttributeStepId,
+ async ({ id }: DeleteAttributeStepInput, { container }) => {
+ const attributeModuleService = container.resolve(
+ ATTRIBUTE_MODULE
+ ) as AttributeModuleService
+ const link = container.resolve(ContainerRegistrationKeys.LINK)
+
+ await attributeModuleService.softDeleteAttributes(id)
+ await link.delete({
+ [ATTRIBUTE_MODULE]: {
+ attribute_id: id,
+ },
+ })
+ return new StepResponse(undefined, id)
+ },
+ async (id: string | undefined, { container }) => {
+ if (!id) {
+ return
+ }
+
+ const attributeModuleService = container.resolve(
+ ATTRIBUTE_MODULE
+ ) as AttributeModuleService
+ const link = container.resolve(ContainerRegistrationKeys.LINK)
+
+ await attributeModuleService.restoreAttributes(id)
+ await link.restore({
+ [ATTRIBUTE_MODULE]: {
+ attribute_id: id,
+ },
+ })
+ }
+)
diff --git a/packages/core-plugin/src/workflows/attribute/steps/index.ts b/packages/core-plugin/src/workflows/attribute/steps/index.ts
new file mode 100644
index 000000000..fa93f1720
--- /dev/null
+++ b/packages/core-plugin/src/workflows/attribute/steps/index.ts
@@ -0,0 +1,7 @@
+export * from "./create-attributes"
+export * from "./update-attributes"
+export * from "./create-attribute-possible-values"
+export * from "./delete-attribute"
+export * from "./validate-attribute-delete"
+export * from "./validate-possible-values-removal"
+export * from "./update-attribute-possible-value"
diff --git a/packages/core-plugin/src/workflows/attribute/steps/update-attribute-possible-value.ts b/packages/core-plugin/src/workflows/attribute/steps/update-attribute-possible-value.ts
new file mode 100644
index 000000000..df8adb1d9
--- /dev/null
+++ b/packages/core-plugin/src/workflows/attribute/steps/update-attribute-possible-value.ts
@@ -0,0 +1,34 @@
+import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
+
+import {
+ ATTRIBUTE_MODULE,
+ AttributeModuleService,
+} from "../../../modules/attribute"
+import { UpdateAttributeValueDTO } from "@mercurjs/types"
+
+export const updateAttributePossibleValueStepId =
+ "update-attribute-possible-value"
+
+type StepInput = UpdateAttributeValueDTO
+
+export const updateAttributePossibleValueStep = createStep(
+ updateAttributePossibleValueStepId,
+ async (payload: StepInput, { container }) => {
+ const attributeModuleService = container.resolve(
+ ATTRIBUTE_MODULE
+ ) as AttributeModuleService
+ const updated =
+ await attributeModuleService.updateAttributePossibleValues(payload)
+ return new StepResponse(updated, payload.id)
+ },
+ async (id: string | undefined, { container }) => {
+ if (!id) {
+ return
+ }
+
+ const attributeModuleService = container.resolve(
+ ATTRIBUTE_MODULE
+ ) as AttributeModuleService
+ await attributeModuleService.deleteAttributePossibleValues(id)
+ }
+)
diff --git a/packages/core-plugin/src/workflows/attribute/steps/update-attributes.ts b/packages/core-plugin/src/workflows/attribute/steps/update-attributes.ts
new file mode 100644
index 000000000..41aef9515
--- /dev/null
+++ b/packages/core-plugin/src/workflows/attribute/steps/update-attributes.ts
@@ -0,0 +1,53 @@
+import {
+ StepResponse,
+ createStep,
+} from "@medusajs/framework/workflows-sdk"
+
+import {
+ ATTRIBUTE_MODULE,
+ AttributeModuleService,
+} from "../../../modules/attribute"
+import { UpdateAttributeDTO } from "@mercurjs/types"
+
+const updateAttributesStepId = "update-attributes"
+
+export const updateAttributesStep = createStep(
+ updateAttributesStepId,
+ async (data: UpdateAttributeDTO[], { container }) => {
+ const service = container.resolve<AttributeModuleService>(ATTRIBUTE_MODULE)
+
+ const prevData = await service.listAttributes({
+ id: data.map((attribute) => attribute.id),
+ })
+
+ const normalized = data.map((attr) => {
+ const { possible_values: values, ...attribute } = attr
+ const valuesWithAttribute = values?.map((val) => ({
+ ...val,
+ attribute_id: attribute.id,
+ }))
+ return {
+ ...attr,
+ possible_values: valuesWithAttribute,
+ }
+ })
+
+ const attributes = normalized.map((element) => {
+ delete element.product_category_ids
+ return element
+ })
+
+ await service.updateAttributeWithUpsertOrReplacePossibleValues(normalized)
+
+ return new StepResponse(attributes, prevData)
+ },
+ async (prevData, { container }) => {
+ if (!prevData?.length) {
+ return
+ }
+ const service = container.resolve<AttributeModuleService>(ATTRIBUTE_MODULE)
+
+ //@ts-expect-error Possible values
+ await service.updateAttributes(prevData)
+ }
+)
diff --git a/packages/core-plugin/src/workflows/attribute/steps/validate-attribute-delete.ts b/packages/core-plugin/src/workflows/attribute/steps/validate-attribute-delete.ts
new file mode 100644
index 000000000..674e3e8da
--- /dev/null
+++ b/packages/core-plugin/src/workflows/attribute/steps/validate-attribute-delete.ts
@@ -0,0 +1,67 @@
+import { ContainerRegistrationKeys, MedusaError } from "@medusajs/framework/utils"
+import { createStep } from "@medusajs/framework/workflows-sdk"
+
+export const validateAttributeDeleteStepId = "validate-attribute-delete-step"
+
+type ValidateAttributeDeleteInput = {
+ id: string
+}
+
+export const validateAttributeDeleteStep = createStep(
+ validateAttributeDeleteStepId,
+ async ({ id }: ValidateAttributeDeleteInput, { container }) => {
+ const query = container.resolve(ContainerRegistrationKeys.QUERY)
+
+ // Get attribute name for error messages
+ const {
+ data: [attribute],
+ } = await query.graph({
+ entity: "attribute",
+ filters: { id },
+ fields: ["name"],
+ })
+
+ const attributeName = attribute?.name ?? id
+
+ // Check attribute_value (same module)
+ try {
+ const { data: attributeValues } = await query.graph({
+ entity: "attribute_value",
+ filters: { attribute_id: id },
+ fields: ["id"],
+ })
+
+ if (attributeValues.length > 0) {
+ throw new MedusaError(
+ MedusaError.Types.NOT_ALLOWED,
+ `Attribute "${attributeName}" can't be deleted because it's currently used by one or more Vendors in their product variants. To delete it, ask the Vendors to update their products first.`
+ )
+ }
+ } catch (err: any) {
+ if (err.type === MedusaError.Types.NOT_ALLOWED) {
+ throw err
+ }
+ }
+
+ // Check vendor_product_attribute (separate module, may not exist)
+ try {
+ const { data: vendorAttributes } = await query.graph({
+ entity: "vendor_product_attribute",
+ filters: { extends_attribute_id: id },
+ fields: ["id"],
+ })
+
+ if (vendorAttributes.length > 0) {
+ throw new MedusaError(
+ MedusaError.Types.NOT_ALLOWED,
+ `Attribute "${attributeName}" can't be deleted because it's currently used by one or more Vendors in their product variants. To delete it, ask the Vendors to update their products first.`
+ )
+ }
+ } catch (err: any) {
+ if (err.type === MedusaError.Types.NOT_ALLOWED) {
+ throw err
+ }
+ // Table doesn't exist yet — no vendor usage, allow deletion
+ }
+ }
+)
diff --git a/packages/core-plugin/src/workflows/attribute/steps/validate-possible-values-removal.ts b/packages/core-plugin/src/workflows/attribute/steps/validate-possible-values-removal.ts
new file mode 100644
index 000000000..7294aaef3
--- /dev/null
+++ b/packages/core-plugin/src/workflows/attribute/steps/validate-possible-values-removal.ts
@@ -0,0 +1,99 @@
+import { ContainerRegistrationKeys, MedusaError } from "@medusajs/framework/utils"
+import { createStep } from "@medusajs/framework/workflows-sdk"
+
+import { UpdateAttributeDTO } from "@mercurjs/types"
+
+export const validatePossibleValuesRemovalStepId =
+ "validate-possible-values-removal-step"
+
+type ValidatePossibleValuesRemovalInput = {
+ attributes: UpdateAttributeDTO[]
+}
+
+export const validatePossibleValuesRemovalStep = createStep(
+ validatePossibleValuesRemovalStepId,
+ async (
+ input: ValidatePossibleValuesRemovalInput,
+ { container }
+ ) => {
+ const query = container.resolve(ContainerRegistrationKeys.QUERY)
+
+ for (const attribute of input.attributes) {
+ if (attribute.possible_values === undefined) {
+ continue
+ }
+
+ const newValueIds = new Set(
+ attribute.possible_values
+ .map((v: any) => v.id)
+ .filter(Boolean)
+ )
+
+ // Get current possible values
+ const { data: currentValues } = await query.graph({
+ entity: "attribute_possible_value",
+ filters: { attribute_id: attribute.id },
+ fields: ["id", "value"],
+ })
+
+ const removedValues = currentValues.filter(
+ (pv: any) => !newValueIds.has(pv.id)
+ )
+
+ if (removedValues.length === 0) {
+ continue
+ }
+
+ // Check if any attribute_value records exist for this attribute
+ // (vendor-assigned values referencing the same attribute)
+ const removedValueTexts = removedValues.map((pv: any) => pv.value)
+
+ try {
+ const { data: usedValues } = await query.graph({
+ entity: "attribute_value",
+ filters: {
+ attribute_id: attribute.id,
+ value: removedValueTexts,
+ },
+ fields: ["id", "value"],
+ })
+
+ if (usedValues.length > 0) {
+ throw new MedusaError(
+ MedusaError.Types.NOT_ALLOWED,
+ `Possible value "${usedValues[0].value}" can't be deleted because it's currently used by one or more Vendors in their product variants. To delete it, ask the Vendors to update their products first.`
+ )
+ }
+ } catch (err: any) {
+ // If error is our own NOT_ALLOWED, rethrow
+ if (err.type === MedusaError.Types.NOT_ALLOWED) {
+ throw err
+ }
+
+ // Try vendor_product_attribute as fallback
+ try {
+ const { data: vendorUsages } = await query.graph({
+ entity: "vendor_product_attribute",
+ filters: {
+ extends_attribute_id: attribute.id,
+ value: removedValueTexts,
+ },
+ fields: ["id", "value"],
+ })
+
+ if (vendorUsages.length > 0) {
+ throw new MedusaError(
+ MedusaError.Types.NOT_ALLOWED,
+ `Possible value "${vendorUsages[0].value}" can't be deleted because it's currently used by one or more Vendors in their product variants. To delete it, ask the Vendors to update their products first.`
+ )
+ }
+ } catch (innerErr: any) {
+ if (innerErr.type === MedusaError.Types.NOT_ALLOWED) {
+ throw innerErr
+ }
+ // Table doesn't exist yet — no vendor usage, allow deletion
+ }
+ }
+ }
+ }
+)
diff --git a/packages/core-plugin/src/workflows/attribute/workflows/create-attribute-possible-values.ts b/packages/core-plugin/src/workflows/attribute/workflows/create-attribute-possible-values.ts
new file mode 100644
index 000000000..1108e8d0b
--- /dev/null
+++ b/packages/core-plugin/src/workflows/attribute/workflows/create-attribute-possible-values.ts
@@ -0,0 +1,23 @@
+import {
+ WorkflowResponse,
+ createWorkflow,
+} from "@medusajs/framework/workflows-sdk"
+
+import { CreateAttributeValueDTO } from "@mercurjs/types"
+
+import { createAttributePossibleValuesStep } from "../steps/create-attribute-possible-values"
+
+const createAttributePossibleValuesWorkflowId =
+ "create-attribute-possible-values"
+
+export type CreateAttributePossibleValuesWorkflowInput =
+ CreateAttributeValueDTO[]
+
+export const createAttributePossibleValuesWorkflow = createWorkflow(
+ createAttributePossibleValuesWorkflowId,
+ (input: CreateAttributePossibleValuesWorkflowInput) => {
+ const createdValues = createAttributePossibleValuesStep(input)
+
+ return new WorkflowResponse(createdValues)
+ }
+)
diff --git a/packages/core-plugin/src/workflows/attribute/workflows/create-attributes.ts b/packages/core-plugin/src/workflows/attribute/workflows/create-attributes.ts
new file mode 100644
index 000000000..1df9d4a87
--- /dev/null
+++ b/packages/core-plugin/src/workflows/attribute/workflows/create-attributes.ts
@@ -0,0 +1,69 @@
+import { LinkDefinition } from "@medusajs/framework/types"
+import { Modules } from "@medusajs/framework/utils"
+import {
+ WorkflowData,
+ WorkflowResponse,
+ createWorkflow,
+ transform,
+ when,
+} from "@medusajs/framework/workflows-sdk"
+import { createRemoteLinkStep } from "@medusajs/medusa/core-flows"
+
+import { ATTRIBUTE_MODULE } from "../../../modules/attribute"
+import { CreateAttributeDTO } from "@mercurjs/types"
+
+import { createAttributesStep } from "../steps/create-attributes"
+
+export const createAttributesWorkflowId = "create-attributes"
+
+type CreateAttributesWorkflowInput = {
+ attributes: CreateAttributeDTO[]
+}
+
+export const createAttributesWorkflow = createWorkflow(
+ createAttributesWorkflowId,
+ (input: WorkflowData<CreateAttributesWorkflowInput>) => {
+ const attributesWithoutExternalRelations = transform(
+ input,
+ ({ attributes }) => {
+ return attributes.map((attribute) => {
+ delete attribute.product_category_ids
+ return attribute
+ })
+ }
+ )
+
+ const createdAttributes = createAttributesStep(
+ attributesWithoutExternalRelations
+ )
+
+ const productCategoryLinks: LinkDefinition[] = transform(
+ { input, createdAttributes },
+ ({ input, createdAttributes }) => {
+ return createdAttributes
+ .map((attribute, idx) => {
+ const inputAttribute = input.attributes[idx]
+ return (
+ inputAttribute.product_category_ids?.map((productCategoryId) => ({
+ [Modules.PRODUCT]: {
+ product_category_id: productCategoryId,
+ },
+ [ATTRIBUTE_MODULE]: {
+ attribute_id: attribute.id,
+ },
+ })) || []
+ )
+ })
+ .flat()
+ }
+ )
+
+ when({ productCategoryLinks }, ({ productCategoryLinks }) => {
+ return productCategoryLinks.length > 0
+ }).then(() => {
+ createRemoteLinkStep(productCategoryLinks)
+ })
+
+ return new WorkflowResponse(createdAttributes)
+ }
+)
diff --git a/packages/core-plugin/src/workflows/attribute/workflows/delete-attribute.ts b/packages/core-plugin/src/workflows/attribute/workflows/delete-attribute.ts
new file mode 100644
index 000000000..621df1eb8
--- /dev/null
+++ b/packages/core-plugin/src/workflows/attribute/workflows/delete-attribute.ts
@@ -0,0 +1,20 @@
+import {
+ WorkflowResponse,
+ createWorkflow,
+} from "@medusajs/framework/workflows-sdk"
+
+import { deleteAttributeStep, validateAttributeDeleteStep } from "../steps"
+
+export const deleteAttributeWorkflowId = "delete-attribute-workflow"
+
+type DeleteAttributeWorkflowInput = {
+ id: string
+}
+
+export const deleteAttributeWorkflow = createWorkflow(
+ deleteAttributeWorkflowId,
+ (input: DeleteAttributeWorkflowInput) => {
+ validateAttributeDeleteStep(input)
+ return new WorkflowResponse(deleteAttributeStep(input))
+ }
+)
diff --git a/packages/core-plugin/src/workflows/attribute/workflows/index.ts b/packages/core-plugin/src/workflows/attribute/workflows/index.ts
new file mode 100644
index 000000000..8582d0075
--- /dev/null
+++ b/packages/core-plugin/src/workflows/attribute/workflows/index.ts
@@ -0,0 +1,5 @@
+export * from "./create-attributes"
+export * from "./update-attributes"
+export * from "./create-attribute-possible-values"
+export * from "./delete-attribute"
+export * from "./update-attribute-possible-value"
diff --git a/packages/core-plugin/src/workflows/attribute/workflows/update-attribute-possible-value.ts b/packages/core-plugin/src/workflows/attribute/workflows/update-attribute-possible-value.ts
new file mode 100644
index 000000000..3c7737ef6
--- /dev/null
+++ b/packages/core-plugin/src/workflows/attribute/workflows/update-attribute-possible-value.ts
@@ -0,0 +1,21 @@
+import {
+ WorkflowResponse,
+ createWorkflow,
+} from "@medusajs/framework/workflows-sdk"
+
+import { UpdateAttributeValueDTO } from "@mercurjs/types"
+
+import { updateAttributePossibleValueStep } from "../steps"
+
+export const updateAttributePossibleValueWorkflowId =
+ "update-attribute-possible-value"
+
+type WorkflowInput = UpdateAttributeValueDTO
+
+export const updateAttributePossibleValueWorkflow = createWorkflow(
+ updateAttributePossibleValueWorkflowId,
+ (input: WorkflowInput) => {
+ const updated = updateAttributePossibleValueStep(input)
+ return new WorkflowResponse(updated)
+ }
+)
diff --git a/packages/core-plugin/src/workflows/attribute/workflows/update-attributes.ts b/packages/core-plugin/src/workflows/attribute/workflows/update-attributes.ts
new file mode 100644
index 000000000..7f06d58d3
--- /dev/null
+++ b/packages/core-plugin/src/workflows/attribute/workflows/update-attributes.ts
@@ -0,0 +1,115 @@
+import { LinkDefinition } from "@medusajs/framework/types"
+import { Modules, arrayDifference } from "@medusajs/framework/utils"
+import {
+ WorkflowResponse,
+ createWorkflow,
+ transform,
+} from "@medusajs/framework/workflows-sdk"
+import {
+ createRemoteLinkStep,
+ dismissRemoteLinkStep,
+ useQueryGraphStep,
+} from "@medusajs/medusa/core-flows"
+
+import { ATTRIBUTE_MODULE } from "../../../modules/attribute"
+import { UpdateAttributeDTO } from "@mercurjs/types"
+
+import categoryAttributeLink from "../../../links/category-attribute-link"
+import {
+ updateAttributesStep,
+ validatePossibleValuesRemovalStep,
+} from "../steps"
+
+const updateAttributesWorkflowId = "update-attributes"
+
+export type UpdateAttributesWorkflowInput = {
+ attributes: UpdateAttributeDTO[]
+}
+
+export const updateAttributesWorkflow = createWorkflow(
+ updateAttributesWorkflowId,
+ (input: UpdateAttributesWorkflowInput) => {
+ validatePossibleValuesRemovalStep(input)
+
+ const toUpdateInput = transform({ input }, ({ input: { attributes } }) => {
+ return attributes.map((attribute) => ({
+ ...attribute,
+ product_category_ids: undefined,
+ }))
+ })
+
+ const updatedAttributes = updateAttributesStep(toUpdateInput)
+
+ const attributesIdsWithCategories = transform(
+ { input, updatedAttributes },
+ ({ input, updatedAttributes }) => {
+ const updatedAttributeIds = updatedAttributes.map((attr) => attr.id)
+ const attributeIdsWithoutCategories = input.attributes
+ .filter((attr) => !attr.product_category_ids)
+ .map((attr) => attr.id)
+ return arrayDifference(
+ updatedAttributeIds,
+ attributeIdsWithoutCategories
+ )
+ }
+ )
+
+ const currentCategoriesLinksResult = useQueryGraphStep({
+ entity: categoryAttributeLink.entryPoint,
+ fields: ["attribute_id", "product_category_id"],
+ filters: {
+ attribute_id: attributesIdsWithCategories,
+ },
+ })
+
+ const currentCategoriesLinks = transform(
+ { currentCategoriesLinksResult },
+ ({ currentCategoriesLinksResult }) => {
+ return currentCategoriesLinksResult.data
+ }
+ )
+
+ const toDeleteCategoriesLinks = transform(
+ { currentCategoriesLinks },
+ ({ currentCategoriesLinks }) => {
+ if (!currentCategoriesLinks.length) {
+ return []
+ }
+
+ return currentCategoriesLinks.map(
+ ({ attribute_id, product_category_id }) => ({
+ [Modules.PRODUCT]: {
+ product_category_id,
+ },
+ [ATTRIBUTE_MODULE]: {
+ attribute_id,
+ },
+ })
+ )
+ }
+ )
+
+ dismissRemoteLinkStep(toDeleteCategoriesLinks)
+
+ const toCreateCategoryLinks: LinkDefinition[] = transform(
+ { input },
+ ({ input: { attributes } }) => {
+ return attributes
+ .filter((attribute) => attribute.product_category_ids)
+ .flatMap((attribute) =>
+ attribute.product_category_ids!.map((attrCat) => ({
+ [Modules.PRODUCT]: {
+ product_category_id: attrCat.id,
+ },
+ [ATTRIBUTE_MODULE]: {
+ attribute_id: attribute.id,
+ },
+ }))
+ )
+ }
+ )
+
+ createRemoteLinkStep(toCreateCategoryLinks)
+ return new WorkflowResponse(updatedAttributes)
+ }
+)
diff --git a/packages/core-plugin/src/workflows/hooks/product-created.ts b/packages/core-plugin/src/workflows/hooks/product-created.ts
index 92886c4ec..26dc9d5ff 100644
--- a/packages/core-plugin/src/workflows/hooks/product-created.ts
+++ b/packages/core-plugin/src/workflows/hooks/product-created.ts
@@ -5,6 +5,8 @@ import { LinkDefinition } from "@medusajs/framework/types"
import { Link, Query } from "@medusajs/framework/modules-sdk"
import { MercurModules } from "@mercurjs/types"
+import { productsCreatedHookHandler } from "../product-attribute/utils/products-created-handler"
+
createProductsWorkflow.hooks.productsCreated(
async ({ products, additional_data }, { container }) => {
if (!additional_data?.seller_id) {
@@ -66,6 +68,13 @@ createProductsWorkflow.hooks.productsCreated(
await link.create(inventoryLinks)
}
+ // Process attribute assignments from additional_data
+ await productsCreatedHookHandler({
+ products,
+ additional_data: additional_data as Record<string, unknown>,
+ container,
+ })
+
return new StepResponse(
{ productLinks: links, inventoryLinks },
{ productLinks: links, inventoryLinks }
diff --git a/packages/core-plugin/src/workflows/product-attribute/steps/create-attribute-value.ts b/packages/core-plugin/src/workflows/product-attribute/steps/create-attribute-value.ts
new file mode 100644
index 000000000..79d45e046
--- /dev/null
+++ b/packages/core-plugin/src/workflows/product-attribute/steps/create-attribute-value.ts
@@ -0,0 +1,36 @@
+import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
+
+import {
+ ATTRIBUTE_MODULE,
+ AttributeModuleService,
+} from "../../../modules/attribute"
+import { CreateProductAttributeValueDTO } from "@mercurjs/types"
+
+export const createAttributeValueStepId = "create-attribute-value"
+
+export const createAttributeValueStep = createStep(
+ createAttributeValueStepId,
+ async (
+ input: Omit<CreateProductAttributeValueDTO, "product_id">,
+ { container }
+ ) => {
+ const attributeModuleService =
+ container.resolve<AttributeModuleService>(ATTRIBUTE_MODULE)
+
+ const created = await attributeModuleService.createAttributeValues({
+ ...input,
+ rank: 0,
+ })
+
+ return new StepResponse(created, created.id)
+ },
+ async (id: string | undefined, { container }) => {
+ if (!id) {
+ return
+ }
+
+ const attributeModuleService =
+ container.resolve<AttributeModuleService>(ATTRIBUTE_MODULE)
+ await attributeModuleService.deleteAttributeValues(id)
+ }
+)
diff --git a/packages/core-plugin/src/workflows/product-attribute/steps/create-attribute-values.ts b/packages/core-plugin/src/workflows/product-attribute/steps/create-attribute-values.ts
new file mode 100644
index 000000000..363e10eaa
--- /dev/null
+++ b/packages/core-plugin/src/workflows/product-attribute/steps/create-attribute-values.ts
@@ -0,0 +1,56 @@
+import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
+
+import { AttributeSource } from "@mercurjs/types"
+
+import {
+ ATTRIBUTE_MODULE,
+ AttributeModuleService,
+} from "../../../modules/attribute"
+
+export const createAttributeValuesStepId = "create-attribute-values"
+
+type CreateAttributeValuesStepInput = {
+ attribute_id: string
+ values: string[]
+ source: AttributeSource
+}
+
+type CreateAttributeValuesStepOutput = {
+ ids: string[]
+}
+
+export const createAttributeValuesStep = createStep(
+ createAttributeValuesStepId,
+ async (input: CreateAttributeValuesStepInput, { container }) => {
+ const attributeModuleService =
+ container.resolve<AttributeModuleService>(ATTRIBUTE_MODULE)
+
+ const created = await Promise.all(
+ input.values.map((value) =>
+ attributeModuleService.createAttributeValues({
+ value,
+ attribute_id: input.attribute_id,
+ source: input.source,
+ rank: 0,
+ })
+ )
+ )
+
+ const ids = created.map((value) => value.id)
+
+ return new StepResponse<CreateAttributeValuesStepOutput, string[]>(
+ { ids },
+ ids
+ )
+ },
+ async (ids: string[] | undefined, { container }) => {
+ if (!ids?.length) {
+ return
+ }
+
+ const attributeModuleService =
+ container.resolve<AttributeModuleService>(ATTRIBUTE_MODULE)
+
+ await attributeModuleService.deleteAttributeValues(ids)
+ }
+)
diff --git a/packages/core-plugin/src/workflows/product-attribute/steps/create-vendor-product-attribute.ts b/packages/core-plugin/src/workflows/product-attribute/steps/create-vendor-product-attribute.ts
new file mode 100644
index 000000000..8b04ffeb4
--- /dev/null
+++ b/packages/core-plugin/src/workflows/product-attribute/steps/create-vendor-product-attribute.ts
@@ -0,0 +1,39 @@
+import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
+
+import { CreateVendorProductAttributeDTO } from "@mercurjs/types"
+
+import {
+ VENDOR_PRODUCT_ATTRIBUTE_MODULE,
+ VendorProductAttributeModuleService,
+} from "../../../modules/vendor-product-attribute"
+
+export const createVendorProductAttributeStepId =
+ "create-vendor-product-attribute"
+
+export const createVendorProductAttributeStep = createStep(
+ createVendorProductAttributeStepId,
+ async (input: CreateVendorProductAttributeDTO, { container }) => {
+ const vendorProductAttributeService =
+ container.resolve<VendorProductAttributeModuleService>(
+ VENDOR_PRODUCT_ATTRIBUTE_MODULE
+ )
+
+ const created =
+ await vendorProductAttributeService.createVendorProductAttributes(
+ input
+ )
+
+ return new StepResponse(created, created.id)
+ },
+ async (id: string | undefined, { container }) => {
+ if (!id) {
+ return
+ }
+
+ const vendorProductAttributeService =
+ container.resolve<VendorProductAttributeModuleService>(
+ VENDOR_PRODUCT_ATTRIBUTE_MODULE
+ )
+ await vendorProductAttributeService.deleteVendorProductAttributes(id)
+ }
+)
diff --git a/packages/core-plugin/src/workflows/product-attribute/steps/delete-attribute-value.ts b/packages/core-plugin/src/workflows/product-attribute/steps/delete-attribute-value.ts
new file mode 100644
index 000000000..8fe36332e
--- /dev/null
+++ b/packages/core-plugin/src/workflows/product-attribute/steps/delete-attribute-value.ts
@@ -0,0 +1,30 @@
+import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
+
+import {
+ ATTRIBUTE_MODULE,
+ AttributeModuleService,
+} from "../../../modules/attribute"
+
+export const deleteAttributeValueStepId = "delete-attribute-value"
+
+export const deleteAttributeValueStep = createStep(
+ deleteAttributeValueStepId,
+ async (ids: string[], { container }) => {
+ const attributeModuleService =
+ container.resolve<AttributeModuleService>(ATTRIBUTE_MODULE)
+
+ await attributeModuleService.softDeleteAttributeValues(ids)
+
+ return new StepResponse(ids, ids)
+ },
+ async (ids: string[] | undefined, { container }) => {
+ if (!ids?.length) {
+ return
+ }
+
+ const attributeModuleService =
+ container.resolve<AttributeModuleService>(ATTRIBUTE_MODULE)
+
+ await attributeModuleService.restoreAttributeValues(ids)
+ }
+)
diff --git a/packages/core-plugin/src/workflows/product-attribute/steps/index.ts b/packages/core-plugin/src/workflows/product-attribute/steps/index.ts
new file mode 100644
index 000000000..3e63767bb
--- /dev/null
+++ b/packages/core-plugin/src/workflows/product-attribute/steps/index.ts
@@ -0,0 +1,7 @@
+export * from "./create-attribute-values"
+export * from "./create-attribute-value"
+export * from "./validate-attribute-value"
+export * from "./delete-attribute-value"
+export * from "./create-vendor-product-attribute"
+export * from "./save-variant-image-associations"
+export * from "./restore-variant-image-associations"
diff --git a/packages/core-plugin/src/workflows/product-attribute/steps/restore-variant-image-associations.ts b/packages/core-plugin/src/workflows/product-attribute/steps/restore-variant-image-associations.ts
new file mode 100644
index 000000000..913be3491
--- /dev/null
+++ b/packages/core-plugin/src/workflows/product-attribute/steps/restore-variant-image-associations.ts
@@ -0,0 +1,96 @@
+import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
+import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
+import {
+ batchVariantImagesWorkflow,
+ updateProductVariantsWorkflow,
+} from "@medusajs/medusa/core-flows"
+import type { WorkflowResult } from "@medusajs/framework/workflows-sdk"
+import type { BatchVariantImagesWorkflowOutput } from "@medusajs/medusa/core-flows"
+import type {
+ ProductImageDTO,
+ ProductVariantDTO,
+} from "@medusajs/framework/types"
+
+export type VariantImageAssociation = {
+ variantId: string
+ imageUrls: string[]
+ thumbnailUrl: string | null
+}
+
+export type RestoreVariantImageAssociationsInput = {
+ productId: string
+ associations: VariantImageAssociation[]
+}
+
+export const restoreVariantImageAssociationsStep = createStep(
+ "restore-variant-image-associations",
+ async (
+ input: RestoreVariantImageAssociationsInput,
+ { container }
+ ): Promise<StepResponse<void>> => {
+ if (!input.associations || input.associations.length === 0) {
+ return new StepResponse(void 0)
+ }
+
+ const query = container.resolve(ContainerRegistrationKeys.QUERY) as any
+
+ const {
+ data: [product],
+ } = await query.graph(
+ {
+ entity: "product",
+ fields: ["id", "images.id", "images.url", "variants.id"],
+ filters: { id: input.productId },
+ },
+ { throwIfKeyNotFound: true }
+ )
+
+ const urlToNewImageId = new Map(
+ ((product.images || []) as ProductImageDTO[]).map((img) => [
+ img.url,
+ img.id,
+ ])
+ )
+
+ const restoreTasks: Array<
+ | Promise<WorkflowResult<BatchVariantImagesWorkflowOutput>>
+ | Promise<WorkflowResult<ProductVariantDTO[]>>
+ > = []
+
+ for (const association of input.associations) {
+ const { variantId, imageUrls, thumbnailUrl } = association
+
+ const newImageIds = imageUrls
+ .map((url) => urlToNewImageId.get(url))
+ .filter((id): id is string => !!id)
+
+ if (newImageIds.length > 0) {
+ restoreTasks.push(
+ batchVariantImagesWorkflow(container).run({
+ input: {
+ variant_id: variantId,
+ add: newImageIds,
+ },
+ })
+ )
+ }
+
+ if (thumbnailUrl && urlToNewImageId.has(thumbnailUrl)) {
+ restoreTasks.push(
+ updateProductVariantsWorkflow(container).run({
+ input: {
+ selector: { id: variantId },
+ update: { thumbnail: thumbnailUrl },
+ },
+ })
+ )
+ }
+ }
+
+ if (restoreTasks.length > 0) {
+ await Promise.all(restoreTasks)
+ }
+
+ return new StepResponse(void 0)
+ }
+)
diff --git a/packages/core-plugin/src/workflows/product-attribute/steps/save-variant-image-associations.ts b/packages/core-plugin/src/workflows/product-attribute/steps/save-variant-image-associations.ts
new file mode 100644
index 000000000..215d50170
--- /dev/null
+++ b/packages/core-plugin/src/workflows/product-attribute/steps/save-variant-image-associations.ts
@@ -0,0 +1,56 @@
+import type {
+ ProductImageDTO,
+ ProductVariantDTO,
+} from "@medusajs/framework/types"
+import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
+import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
+import { VariantImageAssociation } from "./restore-variant-image-associations"
+
+export type SaveVariantImageAssociationsInput = {
+ productId: string
+}
+
+export type SaveVariantImageAssociationsOutput = {
+ associations: VariantImageAssociation[]
+}
+
+export const saveVariantImageAssociationsStep = createStep(
+ "save-variant-image-associations",
+ async (
+ input: SaveVariantImageAssociationsInput,
+ { container }
+ ): Promise<StepResponse<SaveVariantImageAssociationsOutput>> => {
+ const query = container.resolve(ContainerRegistrationKeys.QUERY) as any
+
+ const {
+ data: [product],
+ } = await query.graph(
+ {
+ entity: "product",
+ fields: [
+ "id",
+ "variants.*",
+ "variants.images.*",
+ "variants.thumbnail",
+ ],
+ filters: { id: input.productId },
+ },
+ { throwIfKeyNotFound: true }
+ )
+
+ const associations: VariantImageAssociation[] = []
+
+ for (const variant of (product.variants || []) as ProductVariantDTO[]) {
+ const imageUrls = ((variant.images || []) as ProductImageDTO[]).map(
+ (img) => img.url
+ )
+ associations.push({
+ variantId: variant.id,
+ imageUrls,
+ thumbnailUrl: variant.thumbnail || null,
+ })
+ }
+
+ return new StepResponse({ associations })
+ }
+)
diff --git a/packages/core-plugin/src/workflows/product-attribute/steps/validate-attribute-value.ts b/packages/core-plugin/src/workflows/product-attribute/steps/validate-attribute-value.ts
new file mode 100644
index 000000000..19bd464fb
--- /dev/null
+++ b/packages/core-plugin/src/workflows/product-attribute/steps/validate-attribute-value.ts
@@ -0,0 +1,100 @@
+import {
+ ContainerRegistrationKeys,
+ MedusaError,
+ MedusaErrorTypes,
+} from "@medusajs/framework/utils"
+import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
+
+import { CreateProductAttributeValueDTO } from "@mercurjs/types"
+
+import productAttributeValueLink from "../../../links/product-attribute-value-link"
+
+export const validateAttributeValueStepId = "validate-attribute-value"
+
+export const validateAttributeValueStep = createStep(
+ validateAttributeValueStepId,
+ async (input: CreateProductAttributeValueDTO, { container }) => {
+ const query = container.resolve(ContainerRegistrationKeys.QUERY) as any
+
+ const {
+ data: [attribute],
+ } = await query.graph({
+ entity: "attribute",
+ fields: ["product_categories.id", "possible_values.value"],
+ filters: {
+ id: input.attribute_id,
+ },
+ })
+
+ const allowedValues = attribute.possible_values
+ ?.filter((posVal: any) => posVal != null)
+ .map((posVal: any) => posVal.value)
+
+ if (allowedValues?.length && !allowedValues.includes(input.value)) {
+ throw new MedusaError(
+ MedusaErrorTypes.INVALID_DATA,
+ `Attribute ${input.attribute_id} doesn't define ${input.value} as a possible_value`
+ )
+ }
+
+ const attributeCategoryIds = attribute.product_categories.map(
+ (cat: any) => cat.id
+ )
+
+ if (attributeCategoryIds.length) {
+ const {
+ data: [product],
+ } = await query.graph({
+ entity: "product",
+ fields: ["categories.id"],
+ filters: {
+ id: input.product_id,
+ },
+ })
+
+ const productCategoryIds = product.categories?.map(
+ (cat: any) => cat.id
+ )
+ if (
+ !productCategoryIds?.some((prodCatId: string) =>
+ attributeCategoryIds.includes(prodCatId)
+ )
+ ) {
+ throw new MedusaError(
+ MedusaErrorTypes.INVALID_DATA,
+ `Product ${input.product_id} isn't linked to any category from the requested attributes.`
+ )
+ }
+ }
+
+ const { data: attributeValuesProduct } = await query.graph({
+ entity: productAttributeValueLink.entryPoint,
+ fields: [
+ "attribute_value.value",
+ "attribute_value.attribute_id",
+ ],
+ filters: {
+ product_id: input.product_id,
+ },
+ })
+
+ const attributeValues = attributeValuesProduct
+ .map((element: any) => element.attribute_value)
+ .filter((value: any) => value != null)
+
+ if (
+ attributeValues.some(
+ (value: any) =>
+ value.attribute_id === input.attribute_id &&
+ value.value === input.value
+ )
+ ) {
+ throw new MedusaError(
+ MedusaErrorTypes.DUPLICATE_ERROR,
+ `Attribute value ${input.value} for attribute ${input.attribute_id} already exists for product ${input.product_id}`
+ )
+ }
+
+ return new StepResponse()
+ }
+)
diff --git a/packages/core-plugin/src/workflows/product-attribute/utils/find-or-create-vendor-attribute.ts b/packages/core-plugin/src/workflows/product-attribute/utils/find-or-create-vendor-attribute.ts
new file mode 100644
index 000000000..cf502bfc8
--- /dev/null
+++ b/packages/core-plugin/src/workflows/product-attribute/utils/find-or-create-vendor-attribute.ts
@@ -0,0 +1,87 @@
+import { MedusaContainer } from "@medusajs/framework/types"
+import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
+
+import {
+ AttributeSource,
+ AttributeUIComponent,
+} from "@mercurjs/types"
+
+import {
+ ATTRIBUTE_MODULE,
+ AttributeModuleService,
+} from "../../../modules/attribute"
+import { MercurModules } from "@mercurjs/types"
+
+interface FindOrCreateVendorAttributeInput {
+ sellerId: string
+ name: string
+ ui_component?: AttributeUIComponent
+}
+
+function generateVendorAttributeHandle(
+ sellerId: string,
+ name: string
+): string {
+ const sellerSuffix = sellerId.slice(-8)
+ const slug = name
+ .toLowerCase()
+ .trim()
+ .replace(/[^a-z0-9]+/g, "_")
+ .replace(/^_+|_+$/g, "")
+ return `vendor_${sellerSuffix}_${slug}`
+}
+
+export async function findOrCreateVendorAttribute(
+ container: MedusaContainer,
+ input: FindOrCreateVendorAttributeInput
+): Promise<{ id: string; name: string; isNew: boolean }> {
+ const query = container.resolve(ContainerRegistrationKeys.QUERY)
+ const attributeService =
+ container.resolve<AttributeModuleService>(ATTRIBUTE_MODULE)
+ const linkService = container.resolve(ContainerRegistrationKeys.LINK)
+
+ const normalizedName = input.name.trim()
+ const handle = generateVendorAttributeHandle(
+ input.sellerId,
+ normalizedName
+ )
+
+ const {
+ data: [existingAttribute],
+ } = await query.graph({
+ entity: "attribute",
+ fields: ["id", "name"],
+ filters: {
+ source: AttributeSource.VENDOR,
+ handle,
+ },
+ })
+
+ if (existingAttribute) {
+ return {
+ id: existingAttribute.id,
+ name: existingAttribute.name,
+ isNew: false,
+ }
+ }
+
+ const newAttribute = await attributeService.createAttributes({
+ name: normalizedName,
+ handle,
+ source: AttributeSource.VENDOR,
+ is_filterable: false,
+ is_required: false,
+ ui_component: input.ui_component ?? AttributeUIComponent.TEXTAREA,
+ })
+
+ await linkService.create({
+ [MercurModules.SELLER]: { seller_id: input.sellerId },
+ [ATTRIBUTE_MODULE]: { attribute_id: newAttribute.id },
+ })
+
+ return {
+ id: newAttribute.id,
+ name: newAttribute.name,
+ isNew: true,
+ }
+}
diff --git a/packages/core-plugin/src/workflows/product-attribute/utils/get-applicable-attributes.ts b/packages/core-plugin/src/workflows/product-attribute/utils/get-applicable-attributes.ts
new file mode 100644
index 000000000..204dec40c
--- /dev/null
+++ b/packages/core-plugin/src/workflows/product-attribute/utils/get-applicable-attributes.ts
@@ -0,0 +1,76 @@
+import { MedusaContainer } from "@medusajs/framework/types"
+import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
+
+import categoryAttributeLink from "../../../links/category-attribute-link"
+
+export async function getApplicableAttributes(
+ container: MedusaContainer,
+ product_id: string,
+ fields: string[]
+): Promise<any[]> {
+ const query = container.resolve(ContainerRegistrationKeys.QUERY) as any
+ const knex = container.resolve(ContainerRegistrationKeys.PG_CONNECTION) as any
+
+ const {
+ data: [product],
+ } = await query.graph({
+ entity: "product",
+ fields: ["categories.id"],
+ filters: {
+ id: product_id,
+ },
+ })
+ const categoryIds = product.categories.map(
+ (category: any) => category.id
+ )
+
+ // Fetch global attributes (not assigned to any category)
+ const linkSubquery = knex(
+ "product_product_category_attribute_attribute"
+ )
+ .select("attribute_id")
+ .whereNull("deleted_at")
+ .groupBy("attribute_id")
+
+ const globalAttributeIdRows: { id: string }[] = await knex(
+ "attribute as a"
+ )
+ .select("a.id")
+ .leftJoin(linkSubquery.as("link"), "link.attribute_id", "a.id")
+ .whereNull("a.deleted_at")
+ .whereNull("link.attribute_id")
+
+ const globalAttributeIds = globalAttributeIdRows.map((row) => row.id)
+
+ const globalAttributes =
+ globalAttributeIds.length > 0
+ ? (
+ await query.graph({
+ entity: "attribute",
+ fields,
+ filters: {
+ id: globalAttributeIds,
+ deleted_at: {
+ $eq: null,
+ },
+ },
+ })
+ ).data
+ : []
+
+ const { data: categoryAttributes } = await query.graph({
+ entity: categoryAttributeLink.entryPoint,
+ fields: fields.map((field) => `attribute.${field}`),
+ filters: {
+ product_category_id: categoryIds,
+ deleted_at: {
+ $eq: null,
+ },
+ },
+ })
+
+ return [
+ ...globalAttributes,
+ ...categoryAttributes.map((rel: any) => rel.attribute),
+ ]
+}
diff --git a/packages/core-plugin/src/workflows/product-attribute/utils/products-created-handler.ts b/packages/core-plugin/src/workflows/product-attribute/utils/products-created-handler.ts
new file mode 100644
index 000000000..cf5c1e8b0
--- /dev/null
+++ b/packages/core-plugin/src/workflows/product-attribute/utils/products-created-handler.ts
@@ -0,0 +1,183 @@
+import { MedusaContainer, ProductDTO } from "@medusajs/framework/types"
+import { MedusaError, arrayDifference } from "@medusajs/framework/utils"
+
+import {
+ AdminAttributeInput,
+ AttributeSource,
+ AttributeUIComponent,
+ VendorAttributeInput,
+} from "@mercurjs/types"
+
+import { getApplicableAttributes } from "./get-applicable-attributes"
+import { createAttributeValueWorkflow } from "../workflows/create-attribute-value"
+import { createAndLinkAttributeValuesWorkflow } from "../workflows/create-and-link-attribute-values"
+import { findOrCreateVendorAttribute } from "./find-or-create-vendor-attribute"
+
+type ApplicableAttribute = Awaited<
+ ReturnType<typeof getApplicableAttributes>
+>[number]
+
+function ensureApplicableAttribute(
+ attributeId: string,
+ attributesById: Map<string, ApplicableAttribute>,
+ productTitle: string
+): ApplicableAttribute {
+ const attributeDef = attributesById.get(attributeId)
+ if (!attributeDef) {
+ throw new MedusaError(
+ MedusaError.Types.INVALID_DATA,
+ `Attribute ${attributeId} is not applicable to product "${productTitle}"`
+ )
+ }
+ return attributeDef
+}
+
+function validateVariationAttributeHasOption(
+ attributeName: string,
+ product: ProductDTO,
+ useForVariations: boolean
+): void {
+ if (!useForVariations) {
+ return
+ }
+
+ const optionTitles = (product.options ?? []).map((opt) =>
+ opt.title.toLowerCase()
+ )
+ const attributeNameLower = attributeName.toLowerCase()
+
+ if (!optionTitles.includes(attributeNameLower)) {
+ throw new MedusaError(
+ MedusaError.Types.INVALID_DATA,
+ `Attribute "${attributeName}" has use_for_variations=true but no corresponding ProductOption with title "${attributeName}" exists on product "${product.title}". ` +
+ `When use_for_variations is true, you must also include the attribute in the product options array.`
+ )
+ }
+}
+
+interface ProductsCreatedHookInput {
+ products: ProductDTO[]
+ additional_data: Record<string, unknown> | undefined
+ container: MedusaContainer
+}
+
+export const productsCreatedHookHandler = async ({
+ products,
+ additional_data,
+ container,
+}: ProductsCreatedHookInput) => {
+ const adminAttributeInputs = (additional_data?.admin_attributes ??
+ []) as AdminAttributeInput[]
+ const vendorAttributeInputs = (additional_data?.vendor_attributes ??
+ []) as VendorAttributeInput[]
+ const sellerId = additional_data?.seller_id as string | undefined
+
+ if (!adminAttributeInputs.length && !vendorAttributeInputs.length) {
+ return []
+ }
+
+ for (const product of products) {
+ const applicableAttributes = await getApplicableAttributes(
+ container,
+ product.id,
+ ["id", "name", "is_required", "possible_values.value"]
+ )
+
+ const requiredAttributes = applicableAttributes.filter(
+ (attr: any) => attr.is_required
+ )
+
+ const missingAttributes = arrayDifference(
+ requiredAttributes.map((attr: any) => attr.id),
+ adminAttributeInputs.map((attr) => attr.attribute_id)
+ )
+
+ if (missingAttributes.length) {
+ const missingNames = requiredAttributes
+ .filter((attr: any) => missingAttributes.includes(attr.id))
+ .map((attr: any) => attr.name)
+ throw new MedusaError(
+ MedusaError.Types.INVALID_DATA,
+ `Missing required attributes for product "${product.title}": ${missingNames.join(", ")}`
+ )
+ }
+
+ const attributesById = new Map(
+ applicableAttributes.map((attribute: any) => [
+ attribute.id,
+ attribute,
+ ])
+ )
+
+ // Process admin attributes
+ for (const adminAttr of adminAttributeInputs) {
+ const attributeDef = ensureApplicableAttribute(
+ adminAttr.attribute_id,
+ attributesById,
+ product.title
+ )
+
+ validateVariationAttributeHasOption(
+ attributeDef.name,
+ product,
+ adminAttr.use_for_variations
+ )
+
+ const allowedValues = new Set(
+ attributeDef.possible_values?.map((pv: any) => pv.value) ?? []
+ )
+
+ const creationPromises = adminAttr.values.map((value: string) => {
+ const isFromPossibleValues =
+ allowedValues.size === 0 || allowedValues.has(value)
+
+ return createAttributeValueWorkflow(container).run({
+ input: {
+ attribute_id: adminAttr.attribute_id,
+ value,
+ product_id: product.id,
+ source: isFromPossibleValues
+ ? AttributeSource.ADMIN
+ : AttributeSource.VENDOR,
+ },
+ })
+ })
+
+ await Promise.all(creationPromises)
+ }
+
+ // Process vendor attributes (only informational, not variations)
+ for (const vendorAttr of vendorAttributeInputs) {
+ if (vendorAttr.use_for_variations) {
+ continue
+ }
+
+ if (!sellerId) {
+ throw new MedusaError(
+ MedusaError.Types.INVALID_DATA,
+ "seller_id is required for vendor attributes"
+ )
+ }
+
+ const attribute = await findOrCreateVendorAttribute(container, {
+ sellerId,
+ name: vendorAttr.name,
+ ui_component:
+ (vendorAttr.ui_component as AttributeUIComponent) ??
+ AttributeUIComponent.TEXTAREA,
+ })
+
+ await createAndLinkAttributeValuesWorkflow(container).run({
+ input: {
+ product_id: product.id,
+ attribute_id: attribute.id,
+ seller_id: sellerId,
+ values: vendorAttr.values.map((value) => ({
+ value,
+ source: AttributeSource.VENDOR as AttributeSource,
+ })),
+ },
+ })
+ }
+ }
+}
diff --git a/packages/core-plugin/src/workflows/product-attribute/workflows/convert-attribute-to-option.ts b/packages/core-plugin/src/workflows/product-attribute/workflows/convert-attribute-to-option.ts
new file mode 100644
index 000000000..523b642f8
--- /dev/null
+++ b/packages/core-plugin/src/workflows/product-attribute/workflows/convert-attribute-to-option.ts
@@ -0,0 +1,71 @@
+import {
+ WorkflowResponse,
+ createWorkflow,
+ transform,
+} from "@medusajs/framework/workflows-sdk"
+import {
+ createProductOptionsWorkflow,
+ dismissRemoteLinkStep,
+ useQueryGraphStep,
+} from "@medusajs/medusa/core-flows"
+
+import { ATTRIBUTE_MODULE } from "../../../modules/attribute"
+import { MercurModules } from "@mercurjs/types"
+import sellerAttributeValueLink from "../../../links/seller-attribute-value-link"
+import { deleteAttributeValueWorkflow } from "./delete-attribute-value"
+
+export const convertAttributeToOptionWorkflowId =
+ "convert-attribute-to-option"
+
+type ConvertAttributeToOptionWorkflowInput = {
+ product_id: string
+ seller_id: string
+ option_title: string
+ option_values: string[]
+ attribute_value_ids: string[]
+}
+
+export const convertAttributeToOptionWorkflow: ReturnType<typeof createWorkflow> = createWorkflow(
+ convertAttributeToOptionWorkflowId,
+ (input: ConvertAttributeToOptionWorkflowInput) => {
+ const createdOptions = createProductOptionsWorkflow.runAsStep({
+ input: {
+ product_options: [
+ {
+ product_id: input.product_id,
+ title: input.option_title,
+ values: input.option_values,
+ },
+ ],
+ },
+ })
+
+ const sellerAttributeValueLinks = useQueryGraphStep({
+ entity: sellerAttributeValueLink.entryPoint,
+ fields: ["attribute_value_id"],
+ filters: {
+ seller_id: input.seller_id,
+ attribute_value_id: input.attribute_value_ids,
+ },
+ })
+
+ const linksToDismiss = transform(
+ { sellerAttributeValueLinks, input },
+ ({ sellerAttributeValueLinks, input }) =>
+ sellerAttributeValueLinks.data.map(({ attribute_value_id }) => ({
+ [MercurModules.SELLER]: { seller_id: input.seller_id },
+ [ATTRIBUTE_MODULE]: { attribute_value_id },
+ }))
+ )
+
+ dismissRemoteLinkStep(linksToDismiss)
+
+ deleteAttributeValueWorkflow.runAsStep({
+ input: input.attribute_value_ids,
+ })
+
+ return new WorkflowResponse({
+ options: createdOptions,
+ })
+ }
+)
diff --git a/packages/core-plugin/src/workflows/product-attribute/workflows/convert-option-to-attribute.ts b/packages/core-plugin/src/workflows/product-attribute/workflows/convert-option-to-attribute.ts
new file mode 100644
index 000000000..80cd896c8
--- /dev/null
+++ b/packages/core-plugin/src/workflows/product-attribute/workflows/convert-option-to-attribute.ts
@@ -0,0 +1,52 @@
+import {
+ WorkflowResponse,
+ createWorkflow,
+ transform,
+} from "@medusajs/framework/workflows-sdk"
+import { deleteProductOptionsWorkflow } from "@medusajs/medusa/core-flows"
+
+import { AttributeSource } from "@mercurjs/types"
+
+import { createAndLinkAttributeValuesWorkflow } from "./create-and-link-attribute-values"
+
+export const convertOptionToAttributeWorkflowId =
+ "convert-option-to-attribute"
+
+type ConvertOptionToAttributeWorkflowInput = {
+ product_id: string
+ option_id: string
+ seller_id: string
+ attribute_id: string
+ values: string[]
+}
+
+export const convertOptionToAttributeWorkflow: ReturnType<typeof createWorkflow> = createWorkflow(
+ convertOptionToAttributeWorkflowId,
+ (input: ConvertOptionToAttributeWorkflowInput) => {
+ const createAttributeValuesInput = transform(
+ { input },
+ ({ input }) => ({
+ product_id: input.product_id,
+ attribute_id: input.attribute_id,
+ seller_id: input.seller_id,
+ values: input.values.map((value) => ({
+ value,
+ source: AttributeSource.VENDOR as AttributeSource,
+ })),
+ })
+ )
+
+ const createdAttributeValues =
+ createAndLinkAttributeValuesWorkflow.runAsStep({
+ input: createAttributeValuesInput,
+ })
+
+ deleteProductOptionsWorkflow.runAsStep({
+ input: { ids: [input.option_id] },
+ })
+
+ return new WorkflowResponse({
+ attribute_value_ids: createdAttributeValues.ids,
+ })
+ }
+)
diff --git a/packages/core-plugin/src/workflows/product-attribute/workflows/create-and-link-attribute-values.ts b/packages/core-plugin/src/workflows/product-attribute/workflows/create-and-link-attribute-values.ts
new file mode 100644
index 000000000..2d1b64d88
--- /dev/null
+++ b/packages/core-plugin/src/workflows/product-attribute/workflows/create-and-link-attribute-values.ts
@@ -0,0 +1,117 @@
+import { Modules } from "@medusajs/framework/utils"
+import {
+ WorkflowResponse,
+ createWorkflow,
+ transform,
+ when,
+} from "@medusajs/framework/workflows-sdk"
+import { createRemoteLinkStep } from "@medusajs/medusa/core-flows"
+
+import { AttributeSource } from "@mercurjs/types"
+
+import { ATTRIBUTE_MODULE } from "../../../modules/attribute"
+import { MercurModules } from "@mercurjs/types"
+import { createAttributeValuesStep } from "../steps/create-attribute-values"
+
+export const createAndLinkAttributeValuesWorkflowId =
+ "create-and-link-attribute-values"
+
+export type CreateAndLinkAttributeValuesWorkflowInput = {
+ product_id: string
+ attribute_id: string
+ values: {
+ value: string
+ source: AttributeSource
+ }[]
+ seller_id?: string
+}
+
+export const createAndLinkAttributeValuesWorkflow = createWorkflow(
+ createAndLinkAttributeValuesWorkflowId,
+ (input: CreateAndLinkAttributeValuesWorkflowInput) => {
+ const valuesBySource = transform({ input }, ({ input }) => {
+ const adminValues: string[] = []
+ const vendorValues: string[] = []
+
+ for (const entry of input.values) {
+ if (entry.source === AttributeSource.ADMIN) {
+ adminValues.push(entry.value)
+ } else {
+ vendorValues.push(entry.value)
+ }
+ }
+
+ return {
+ adminValues,
+ vendorValues,
+ }
+ })
+
+ const createdAdminValues = createAttributeValuesStep({
+ attribute_id: input.attribute_id,
+ values: valuesBySource.adminValues,
+ source: AttributeSource.ADMIN,
+ }).config({ name: "create-admin-attribute-values" })
+
+ const createdVendorValues = createAttributeValuesStep({
+ attribute_id: input.attribute_id,
+ values: valuesBySource.vendorValues,
+ source: AttributeSource.VENDOR,
+ }).config({ name: "create-vendor-attribute-values" })
+
+ const createdAttributeValueIds = transform(
+ { createdAdminValues, createdVendorValues },
+ ({ createdAdminValues, createdVendorValues }) => [
+ ...createdAdminValues.ids,
+ ...createdVendorValues.ids,
+ ]
+ )
+
+ const productLinks = transform(
+ { input, createdAttributeValueIds },
+ ({ input, createdAttributeValueIds }) =>
+ createdAttributeValueIds.map((attribute_value_id) => ({
+ [Modules.PRODUCT]: { product_id: input.product_id },
+ [ATTRIBUTE_MODULE]: { attribute_value_id },
+ }))
+ )
+
+ when(
+ { productLinks },
+ ({ productLinks }) => productLinks.length > 0
+ ).then(() => {
+ createRemoteLinkStep(productLinks).config({
+ name: "create-product-attribute-value-links",
+ })
+ })
+
+ const sellerLinks = transform(
+ { input, createdVendorValues },
+ ({ input, createdVendorValues }) => {
+ if (!input.seller_id) {
+ return []
+ }
+
+ return createdVendorValues.ids.map((attribute_value_id) => ({
+ [MercurModules.SELLER]: { seller_id: input.seller_id! },
+ [ATTRIBUTE_MODULE]: { attribute_value_id },
+ }))
+ }
+ )
+
+ when(
+ { sellerLinks },
+ ({ sellerLinks }) => sellerLinks.length > 0
+ ).then(() => {
+ createRemoteLinkStep(sellerLinks).config({
+ name: "create-seller-attribute-value-links",
+ })
+ })
+
+ return new WorkflowResponse({
+ ids: createdAttributeValueIds,
+ vendor_ids: createdVendorValues.ids,
+ admin_ids: createdAdminValues.ids,
+ })
+ }
+)
diff --git a/packages/core-plugin/src/workflows/product-attribute/workflows/create-attribute-value.ts b/packages/core-plugin/src/workflows/product-attribute/workflows/create-attribute-value.ts
new file mode 100644
index 000000000..4da5b19f4
--- /dev/null
+++ b/packages/core-plugin/src/workflows/product-attribute/workflows/create-attribute-value.ts
@@ -0,0 +1,62 @@
+import { Modules } from "@medusajs/framework/utils"
+import {
+ WorkflowResponse,
+ createWorkflow,
+ transform,
+} from "@medusajs/framework/workflows-sdk"
+import { createRemoteLinkStep } from "@medusajs/medusa/core-flows"
+
+import { ATTRIBUTE_MODULE } from "../../../modules/attribute"
+import {
+ AttributeSource,
+ CreateProductAttributeValueDTO,
+} from "@mercurjs/types"
+
+import {
+ createAttributeValueStep,
+} from "../steps/create-attribute-value"
+import {
+ validateAttributeValueStep,
+} from "../steps/validate-attribute-value"
+
+export const createAttributeValueWorkflowId = "create-attribute-value"
+
+export const createAttributeValueWorkflow = createWorkflow(
+ createAttributeValueWorkflowId,
+ (input: CreateProductAttributeValueDTO) => {
+ const attributeValueWithoutExternalRelations = transform(
+ { input },
+ ({ input }) => {
+ return {
+ attribute_id: input.attribute_id,
+ value: input.value,
+ source: input.source ?? AttributeSource.ADMIN,
+ }
+ }
+ )
+
+ validateAttributeValueStep(input)
+
+ const attributeValue = createAttributeValueStep(
+ attributeValueWithoutExternalRelations
+ )
+
+ const link = transform(
+ { input, attributeValue },
+ ({ input, attributeValue }) => [
+ {
+ [Modules.PRODUCT]: {
+ product_id: input.product_id,
+ },
+ [ATTRIBUTE_MODULE]: {
+ attribute_value_id: attributeValue.id,
+ },
+ },
+ ]
+ )
+
+ createRemoteLinkStep(link)
+
+ return new WorkflowResponse(attributeValue)
+ }
+)
diff --git a/packages/core-plugin/src/workflows/product-attribute/workflows/create-vendor-product-attribute.ts b/packages/core-plugin/src/workflows/product-attribute/workflows/create-vendor-product-attribute.ts
new file mode 100644
index 000000000..3a28033bc
--- /dev/null
+++ b/packages/core-plugin/src/workflows/product-attribute/workflows/create-vendor-product-attribute.ts
@@ -0,0 +1,76 @@
+import { LinkDefinition } from "@medusajs/framework/types"
+import { Modules } from "@medusajs/framework/utils"
+import {
+ WorkflowResponse,
+ createWorkflow,
+ transform,
+} from "@medusajs/framework/workflows-sdk"
+import { createRemoteLinkStep } from "@medusajs/medusa/core-flows"
+
+import { AttributeUIComponent } from "@mercurjs/types"
+
+import { VENDOR_PRODUCT_ATTRIBUTE_MODULE } from "../../../modules/vendor-product-attribute"
+import { MercurModules } from "@mercurjs/types"
+
+import { createVendorProductAttributeStep } from "../steps/create-vendor-product-attribute"
+
+export const createVendorProductAttributeWorkflowId =
+ "create-vendor-product-attribute"
+
+export interface CreateVendorProductAttributeWorkflowInput {
+ name: string
+ value: string
+ product_id: string
+ seller_id: string
+ ui_component?: AttributeUIComponent
+ extends_attribute_id?: string
+ rank?: number
+ metadata?: Record<string, unknown>
+}
+
+export const createVendorProductAttributeWorkflow = createWorkflow(
+ createVendorProductAttributeWorkflowId,
+ (input: CreateVendorProductAttributeWorkflowInput) => {
+ const vendorProductAttributeInput = transform(
+ { input },
+ ({ input }) => ({
+ name: input.name,
+ value: input.value,
+ ui_component: input.ui_component,
+ extends_attribute_id: input.extends_attribute_id,
+ rank: input.rank ?? 0,
+ metadata: input.metadata,
+ })
+ )
+
+ const vendorProductAttribute = createVendorProductAttributeStep(
+ vendorProductAttributeInput
+ )
+
+ const links = transform(
+ { input, vendorProductAttribute },
+ ({ input, vendorProductAttribute }): LinkDefinition[] => [
+ {
+ [Modules.PRODUCT]: {
+ product_id: input.product_id,
+ },
+ [VENDOR_PRODUCT_ATTRIBUTE_MODULE]: {
+ vendor_product_attribute_id: vendorProductAttribute.id,
+ },
+ },
+ {
+ [MercurModules.SELLER]: {
+ seller_id: input.seller_id,
+ },
+ [VENDOR_PRODUCT_ATTRIBUTE_MODULE]: {
+ vendor_product_attribute_id: vendorProductAttribute.id,
+ },
+ },
+ ]
+ )
+
+ createRemoteLinkStep(links)
+
+ return new WorkflowResponse(vendorProductAttribute)
+ }
+)
diff --git a/packages/core-plugin/src/workflows/product-attribute/workflows/delete-attribute-value.ts b/packages/core-plugin/src/workflows/product-attribute/workflows/delete-attribute-value.ts
new file mode 100644
index 000000000..d1866a0f7
--- /dev/null
+++ b/packages/core-plugin/src/workflows/product-attribute/workflows/delete-attribute-value.ts
@@ -0,0 +1,87 @@
+import { Modules } from "@medusajs/framework/utils"
+import {
+ WorkflowResponse,
+ createWorkflow,
+ transform,
+} from "@medusajs/framework/workflows-sdk"
+import {
+ dismissRemoteLinkStep,
+ useQueryGraphStep,
+} from "@medusajs/medusa/core-flows"
+
+import { ATTRIBUTE_MODULE } from "../../../modules/attribute"
+import { MercurModules } from "@mercurjs/types"
+
+import productAttributeValue from "../../../links/product-attribute-value-link"
+import sellerAttributeValueLink from "../../../links/seller-attribute-value-link"
+import { deleteAttributeValueStep } from "../steps/delete-attribute-value"
+
+export const deleteAttributeValueWorkflowId = "delete-attribute-value"
+
+export type DeleteAttributeValueWorkflowInput = string | string[]
+
+export const deleteAttributeValueWorkflow = createWorkflow(
+ deleteAttributeValueWorkflowId,
+ (input: DeleteAttributeValueWorkflowInput) => {
+ const normalizedInput = transform({ input }, ({ input }) =>
+ Array.isArray(input) ? input : [input]
+ )
+
+ const attributeValueProductQuery = useQueryGraphStep({
+ entity: productAttributeValue.entryPoint,
+ fields: ["product_id", "attribute_value_id"],
+ filters: {
+ attribute_value_id: normalizedInput,
+ },
+ }).config({ name: "attribute-value-product-query" })
+
+ const attributeValueSellerQuery = useQueryGraphStep({
+ entity: sellerAttributeValueLink.entryPoint,
+ fields: ["seller_id", "attribute_value_id"],
+ filters: {
+ attribute_value_id: normalizedInput,
+ },
+ }).config({ name: "attribute-value-seller-query" })
+
+ const deleted = deleteAttributeValueStep(normalizedInput)
+
+ const productLinks = transform(
+ { attributeValueProductQuery },
+ ({ attributeValueProductQuery }) => {
+ const { data } = attributeValueProductQuery
+ return data.map((element) => ({
+ [Modules.PRODUCT]: {
+ product_id: element.product_id,
+ },
+ [ATTRIBUTE_MODULE]: {
+ attribute_value_id: element.attribute_value_id,
+ },
+ }))
+ }
+ )
+
+ const sellerLinks = transform(
+ { attributeValueSellerQuery },
+ ({ attributeValueSellerQuery }) => {
+ const { data } = attributeValueSellerQuery
+ return data.map((element) => ({
+ [MercurModules.SELLER]: {
+ seller_id: element.seller_id,
+ },
+ [ATTRIBUTE_MODULE]: {
+ attribute_value_id: element.attribute_value_id,
+ },
+ }))
+ }
+ )
+
+ const linksToDismiss = transform(
+ { productLinks, sellerLinks },
+ ({ productLinks, sellerLinks }) => [...productLinks, ...sellerLinks]
+ )
+
+ dismissRemoteLinkStep(linksToDismiss)
+
+ return new WorkflowResponse(deleted)
+ }
+)
diff --git a/packages/core-plugin/src/workflows/product-attribute/workflows/index.ts b/packages/core-plugin/src/workflows/product-attribute/workflows/index.ts
new file mode 100644
index 000000000..9e58387ad
--- /dev/null
+++ b/packages/core-plugin/src/workflows/product-attribute/workflows/index.ts
@@ -0,0 +1,8 @@
+export * from "./create-and-link-attribute-values"
+export * from "./create-attribute-value"
+export * from "./delete-attribute-value"
+export * from "./sync-product-attribute-values"
+export * from "./convert-attribute-to-option"
+export * from "./convert-option-to-attribute"
+export * from "./update-product-with-variant-images"
+export * from "./create-vendor-product-attribute"
diff --git a/packages/core-plugin/src/workflows/product-attribute/workflows/sync-product-attribute-values.ts b/packages/core-plugin/src/workflows/product-attribute/workflows/sync-product-attribute-values.ts
new file mode 100644
index 000000000..6c8240be9
--- /dev/null
+++ b/packages/core-plugin/src/workflows/product-attribute/workflows/sync-product-attribute-values.ts
@@ -0,0 +1,102 @@
+import {
+ WorkflowResponse,
+ createWorkflow,
+ transform,
+ when,
+} from "@medusajs/framework/workflows-sdk"
+
+import { AttributeSource } from "@mercurjs/types"
+
+import { createAndLinkAttributeValuesWorkflow } from "./create-and-link-attribute-values"
+import { deleteAttributeValueWorkflow } from "./delete-attribute-value"
+
+export const syncProductAttributeValuesWorkflowId =
+ "sync-product-attribute-values"
+
+type ExistingAttributeValue = {
+ attribute_value_id: string
+ value: string
+}
+
+type SyncProductAttributeValuesWorkflowInput = {
+ product_id: string
+ seller_id: string
+ attribute_id: string
+ attribute_source: AttributeSource
+ possible_values: string[]
+ new_values: string[]
+ existing_values: ExistingAttributeValue[]
+}
+
+export const syncProductAttributeValuesWorkflow = createWorkflow(
+ syncProductAttributeValuesWorkflowId,
+ (input: SyncProductAttributeValuesWorkflowInput) => {
+ const diff = transform({ input }, ({ input }) => {
+ const existingByValue = new Map(
+ input.existing_values.map((value) => [
+ value.value,
+ value.attribute_value_id,
+ ])
+ )
+ const newValueSet = new Set(input.new_values)
+
+ const toRemove = input.existing_values
+ .filter((value) => !newValueSet.has(value.value))
+ .map((value) => value.attribute_value_id)
+
+ const allowedValues = new Set(input.possible_values)
+ const toAddAdmin: string[] = []
+ const toAddVendor: string[] = []
+
+ for (const value of input.new_values) {
+ if (existingByValue.has(value)) {
+ continue
+ }
+
+ const isAdminValue =
+ input.attribute_source === AttributeSource.ADMIN &&
+ (allowedValues.size === 0 || allowedValues.has(value))
+
+ if (isAdminValue) {
+ toAddAdmin.push(value)
+ } else {
+ toAddVendor.push(value)
+ }
+ }
+
+ return {
+ toRemove,
+ toAdd: [
+ ...toAddAdmin.map((value) => ({
+ value,
+ source: AttributeSource.ADMIN as AttributeSource,
+ })),
+ ...toAddVendor.map((value) => ({
+ value,
+ source: AttributeSource.VENDOR as AttributeSource,
+ })),
+ ],
+ }
+ })
+
+ when({ diff }, ({ diff }) => diff.toRemove.length > 0).then(() => {
+ deleteAttributeValueWorkflow.runAsStep({
+ input: diff.toRemove,
+ })
+ })
+
+ const createdValues = createAndLinkAttributeValuesWorkflow.runAsStep({
+ input: {
+ product_id: input.product_id,
+ attribute_id: input.attribute_id,
+ seller_id: input.seller_id,
+ values: diff.toAdd,
+ },
+ })
+
+ return new WorkflowResponse({
+ removed_values_count: diff.toRemove.length,
+ created_values_count: createdValues.ids.length,
+ })
+ }
+)
diff --git a/packages/core-plugin/src/workflows/product-attribute/workflows/update-product-with-variant-images.ts b/packages/core-plugin/src/workflows/product-attribute/workflows/update-product-with-variant-images.ts
new file mode 100644
index 000000000..eb956825d
--- /dev/null
+++ b/packages/core-plugin/src/workflows/product-attribute/workflows/update-product-with-variant-images.ts
@@ -0,0 +1,64 @@
+import { UpdateProductDTO } from "@medusajs/framework/types"
+import {
+ WorkflowResponse,
+ createWorkflow,
+ transform,
+ when,
+} from "@medusajs/framework/workflows-sdk"
+import { updateProductsWorkflow } from "@medusajs/medusa/core-flows"
+
+import {
+ restoreVariantImageAssociationsStep,
+ saveVariantImageAssociationsStep,
+} from "../steps"
+
+export type UpdateProductWithVariantImagesInput = {
+ selector: { id: string }
+ update: UpdateProductDTO & { id?: never }
+ additional_data?: Record<string, unknown>
+}
+
+export const updateProductWithVariantImagesWorkflow = createWorkflow(
+ "update-product-with-variant-images",
+ function (input: UpdateProductWithVariantImagesInput) {
+ const savedAssociations = when({ input }, ({ input }) => {
+ return !!input.update.images
+ }).then(() => {
+ return saveVariantImageAssociationsStep({
+ productId: input.selector.id,
+ })
+ })
+
+ const updateResult = updateProductsWorkflow.runAsStep({
+ input,
+ })
+
+ when(
+ { savedAssociations },
+ ({ savedAssociations }) => {
+ return !!savedAssociations?.associations
+ }
+ ).then(() => {
+ const productId = transform(
+ { updateResult },
+ ({ updateResult }) => {
+ return updateResult[0].id
+ }
+ )
+
+ const associations = transform(
+ { savedAssociations },
+ ({ savedAssociations }) => {
+ return savedAssociations!.associations
+ }
+ )
+
+ restoreVariantImageAssociationsStep({
+ productId,
+ associations,
+ })
+ })
+
+ return new WorkflowResponse(updateResult)
+ }
+)
diff --git a/packages/core-plugin/src/workflows/seller/workflows/create-seller.ts b/packages/core-plugin/src/workflows/seller/workflows/create-seller.ts
index cb1ce87d6..8c09b58d7 100644
--- a/packages/core-plugin/src/workflows/seller/workflows/create-seller.ts
+++ b/packages/core-plugin/src/workflows/seller/workflows/create-seller.ts
@@ -18,7 +18,7 @@ type CreateSellersWorkflowInput = {
sellers: (CreateSellerDTO & { member: { email: string } })[]
} & AdditionalData
-export const createSellersWorkflow = createWorkflow(
+export const createSellersWorkflow: ReturnType<typeof createWorkflow> = createWorkflow(
createSellersWorkflowId,
function (input: CreateSellersWorkflowInput) {
const sellers = createSellersStep(
diff --git a/packages/core-plugin/src/workflows/seller/workflows/create-sellers.ts b/packages/core-plugin/src/workflows/seller/workflows/create-sellers.ts
index cb1ce87d6..8c09b58d7 100644
--- a/packages/core-plugin/src/workflows/seller/workflows/create-sellers.ts
+++ b/packages/core-plugin/src/workflows/seller/workflows/create-sellers.ts
@@ -18,7 +18,7 @@ type CreateSellersWorkflowInput = {
sellers: (CreateSellerDTO & { member: { email: string } })[]
} & AdditionalData
-export const createSellersWorkflow = createWorkflow(
+export const createSellersWorkflow: ReturnType<typeof createWorkflow> = createWorkflow(
createSellersWorkflowId,
function (input: CreateSellersWorkflowInput) {
const sellers = createSellersStep(
diff --git a/packages/core-plugin/src/workflows/seller/workflows/update-seller-address.ts b/packages/core-plugin/src/workflows/seller/workflows/update-seller-address.ts
index e7f0a52af..8f1af08f8 100644
--- a/packages/core-plugin/src/workflows/seller/workflows/update-seller-address.ts
+++ b/packages/core-plugin/src/workflows/seller/workflows/update-seller-address.ts
@@ -15,7 +15,7 @@ type UpdateSellerAddressWorkflowInput = {
data: UpdateSellerAddressDTO
} & AdditionalData
-export const updateSellerAddressWorkflow = createWorkflow(
+export const updateSellerAddressWorkflow: ReturnType<typeof createWorkflow> = createWorkflow(
updateSellerAddressWorkflowId,
function (input: UpdateSellerAddressWorkflowInput) {
const address = updateSellerAddressStep(input)
diff --git a/packages/core-plugin/src/workflows/seller/workflows/update-seller-payment-details.ts b/packages/core-plugin/src/workflows/seller/workflows/update-seller-payment-details.ts
index 63c16c6f0..ab1f71eda 100644
--- a/packages/core-plugin/src/workflows/seller/workflows/update-seller-payment-details.ts
+++ b/packages/core-plugin/src/workflows/seller/workflows/update-seller-payment-details.ts
@@ -16,7 +16,7 @@ type UpdateSellerPaymentDetailsWorkflowInput = {
data: UpdatePaymentDetailsDTO
} & AdditionalData
-export const updateSellerPaymentDetailsWorkflow = createWorkflow(
+export const updateSellerPaymentDetailsWorkflow: ReturnType<typeof createWorkflow> = createWorkflow(
updateSellerPaymentDetailsWorkflowId,
function (input: UpdateSellerPaymentDetailsWorkflowInput) {
const paymentDetails = updatePaymentDetailsStep(input)
diff --git a/packages/core-plugin/src/workflows/seller/workflows/update-seller-professional-details.ts b/packages/core-plugin/src/workflows/seller/workflows/update-seller-professional-details.ts
index 4e60ecc1c..669e41601 100644
--- a/packages/core-plugin/src/workflows/seller/workflows/update-seller-professional-details.ts
+++ b/packages/core-plugin/src/workflows/seller/workflows/update-seller-professional-details.ts
@@ -16,7 +16,7 @@ type UpdateSellerProfessionalDetailsWorkflowInput = {
data: UpdateProfessionalDetailsDTO
} & AdditionalData
-export const updateSellerProfessionalDetailsWorkflow = createWorkflow(
+export const updateSellerProfessionalDetailsWorkflow: ReturnType<typeof createWorkflow> = createWorkflow(
updateSellerProfessionalDetailsWorkflowId,
function (input: UpdateSellerProfessionalDetailsWorkflowInput) {
const professionalDetails = updateSellerProfessionalDetailsStep(input)
diff --git a/packages/core-plugin/src/workflows/seller/workflows/update-seller.ts b/packages/core-plugin/src/workflows/seller/workflows/update-seller.ts
index 39ccc94e5..3930bd5a2 100644
--- a/packages/core-plugin/src/workflows/seller/workflows/update-seller.ts
+++ b/packages/core-plugin/src/workflows/seller/workflows/update-seller.ts
@@ -18,7 +18,7 @@ type UpdateSellersWorkflowInput = {
update: UpdateSellerDTO
} & AdditionalData
-export const updateSellersWorkflow = createWorkflow(
+export const updateSellersWorkflow: ReturnType<typeof createWorkflow> = createWorkflow(
updateSellersWorkflowId,
function (input: UpdateSellersWorkflowInput) {
const sellers = updateSellersStep(input)
diff --git a/packages/types/src/attribute/common.ts b/packages/types/src/attribute/common.ts
new file mode 100644
index 000000000..89728150d
--- /dev/null
+++ b/packages/types/src/attribute/common.ts
@@ -0,0 +1,88 @@
+export enum AttributeUIComponent {
+ SELECT = "select",
+ MULTIVALUE = "multivalue",
+ UNIT = "unit",
+ TOGGLE = "toggle",
+ TEXTAREA = "text_area",
+ COLOR_PICKER = "color_picker",
+}
+
+export const AttributeSource = {
+ ADMIN: "admin",
+ VENDOR: "vendor",
+} as const
+
+export type AttributeSource =
+ (typeof AttributeSource)[keyof typeof AttributeSource]
+
+export interface AttributePossibleValueDTO {
+ id: string
+ value: string
+ rank: number
+ metadata?: Record<string, unknown>
+ created_at: string
+ updated_at: string
+}
+
+export interface AttributeValueDTO {
+ id: string
+ value: string
+ rank: number
+ source: AttributeSource
+ metadata?: Record<string, unknown>
+ attribute_id: string
+ created_at: string
+ updated_at: string
+}
+
+export interface AttributeDTO {
+ id: string
+ name: string
+ description: string
+ handle: string
+ is_filterable: boolean
+ is_required: boolean
+ source: AttributeSource
+ ui_component: AttributeUIComponent
+ metadata?: Record<string, unknown>
+ possible_values?: AttributePossibleValueDTO[]
+ values?: AttributeValueDTO[]
+ created_at: string
+ updated_at: string
+}
+
+export interface ProductAttributeValueDTO {
+ value: string
+ attribute_id: string
+}
+
+export interface VendorProductAttributeDTO {
+ id: string
+ name: string
+ value: string
+ ui_component: AttributeUIComponent
+ extends_attribute_id?: string | null
+ rank: number
+ metadata?: Record<string, unknown> | null
+ created_at: string
+ updated_at: string
+}
+
+export interface InformationalAttributeValueDTO {
+ value: string
+ source: AttributeSource
+ attribute_value_id: string
+ is_filterable: boolean
+ is_editable: boolean
+}
+
+export interface InformationalAttributeDTO {
+ attribute_id: string
+ name: string
+ ui_component: AttributeUIComponent
+ attribute_source: AttributeSource
+ is_filterable: boolean
+ is_required: boolean
+ is_definition_editable: boolean
+ values: InformationalAttributeValueDTO[]
+}
diff --git a/packages/types/src/attribute/index.ts b/packages/types/src/attribute/index.ts
new file mode 100644
index 000000000..5d3c3b82a
--- /dev/null
+++ b/packages/types/src/attribute/index.ts
@@ -0,0 +1,2 @@
+export * from "./common"
+export * from "./mutations"
diff --git a/packages/types/src/attribute/mutations.ts b/packages/types/src/attribute/mutations.ts
new file mode 100644
index 000000000..d691526ed
--- /dev/null
+++ b/packages/types/src/attribute/mutations.ts
@@ -0,0 +1,109 @@
+import { AttributeSource, AttributeUIComponent } from "./common"
+
+export interface CreateAttributeValueDTO {
+ value: string
+ rank: number
+ attribute_id: string
+ source?: AttributeSource
+ metadata?: Record<string, unknown>
+}
+
+export interface UpdateAttributeDTO {
+ id: string
+ name?: string
+ description?: string
+ handle?: string
+ is_filterable?: boolean
+ is_required?: boolean
+ metadata?: Record<string, unknown>
+ possible_values?: UpsertAttributeValueDTO[]
+ product_category_ids?: { id: string }[]
+}
+
+export interface UpsertAttributeValueDTO {
+ id?: string
+ value?: string
+ rank?: number
+ source?: AttributeSource
+ metadata?: Record<string, unknown>
+ attribute_id?: string
+}
+
+export interface CreateAttributeDTO {
+ name: string
+ description?: string
+ handle?: string
+ is_filterable?: boolean
+ is_required?: boolean
+ source?: AttributeSource
+ metadata?: Record<string, unknown>
+ ui_component: AttributeUIComponent
+ possible_values?: Omit<CreateAttributeValueDTO, "attribute_id">[]
+ product_category_ids?: string[]
+}
+
+export interface UpdateAttributeValueDTO {
+ id: string
+ value?: string
+ rank?: number
+ source?: AttributeSource
+ metadata?: Record<string, unknown> | null
+}
+
+export type CreateProductAttributeValueDTO = {
+ attribute_id: string
+ product_id: string
+ value: string
+ source?: AttributeSource
+}
+
+export interface AdminAttributeInput {
+ attribute_id: string
+ values: string[]
+ use_for_variations: boolean
+}
+
+export interface VendorAttributeInput {
+ name: string
+ values: string[]
+ use_for_variations: boolean
+ ui_component?: AttributeUIComponent
+}
+
+export interface ProductAttributesAdditionalData {
+ admin_attributes?: AdminAttributeInput[]
+ vendor_attributes?: VendorAttributeInput[]
+}
+
+export interface AddProductAttributeInput {
+ attribute_id?: string
+ name?: string
+ values: string[]
+ use_for_variations: boolean
+ ui_component?: AttributeUIComponent
+}
+
+export interface UpdateProductAttributeInput {
+ name?: string
+ ui_component?: AttributeUIComponent
+ values?: string[]
+ use_for_variations?: boolean
+}
+
+export interface CreateVendorProductAttributeDTO {
+ name: string
+ value: string
+ ui_component?: AttributeUIComponent
+ extends_attribute_id?: string
+ rank?: number
+ metadata?: Record<string, unknown>
+}
+
+export interface UpdateVendorProductAttributeDTO {
+ id: string
+ name?: string
+ value?: string
+ ui_component?: AttributeUIComponent
+ rank?: number
+ metadata?: Record<string, unknown> | null
+}
diff --git a/packages/types/src/http/product.ts b/packages/types/src/http/product.ts
index 8419faea4..c01cd6747 100644
--- a/packages/types/src/http/product.ts
+++ b/packages/types/src/http/product.ts
@@ -50,4 +50,6 @@ export interface VendorDeleteResponse {
export interface VendorProduct extends ProductDTO {
sales_channels?: SalesChannelDTO[];
+ informational_attributes?: import("../attribute").InformationalAttributeDTO[];
+ variation_attributes?: import("../attribute").InformationalAttributeDTO[];
}
\ No newline at end of file
diff --git a/packages/types/src/http/review.ts b/packages/types/src/http/review.ts
new file mode 100644
index 000000000..e292f338e
--- /dev/null
+++ b/packages/types/src/http/review.ts
@@ -0,0 +1,28 @@
+import { DeleteResponse, PaginatedResponse } from "@medusajs/types"
+import { ReviewDTO } from "../review"
+
+export interface VendorReviewResponse {
+ review: ReviewDTO
+}
+
+export type VendorReviewListResponse = PaginatedResponse<{
+ reviews: ReviewDTO[]
+}>
+
+export interface AdminReviewResponse {
+ review: ReviewDTO
+}
+
+export type AdminReviewListResponse = PaginatedResponse<{
+ reviews: ReviewDTO[]
+}>
+
+export interface StoreReviewResponse {
+ review: ReviewDTO
+}
+
+export type StoreReviewListResponse = PaginatedResponse<{
+ reviews: ReviewDTO[]
+}>
+
+export type StoreReviewDeleteResponse = DeleteResponse<"review">
diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts
index 14e50f9d0..f1b631b6b 100644
--- a/packages/types/src/index.ts
+++ b/packages/types/src/index.ts
@@ -18,6 +18,9 @@ export * from "./subscription"
// Payout types
export * from "./payout"
+// Attribute types
+export * from "./attribute"
+
// Modules
export * from "./modules"
diff --git a/packages/types/src/modules.ts b/packages/types/src/modules.ts
index 9750611be..55de04537 100644
--- a/packages/types/src/modules.ts
+++ b/packages/types/src/modules.ts
@@ -7,4 +7,6 @@ export enum MercurModules {
VENDOR_UI = "vendor_ui",
ADMIN_UI = "admin_ui",
CODEGEN = "codegen",
+ ATTRIBUTE = "attribute",
+ VENDOR_PRODUCT_ATTRIBUTE = "vendor_product_attribute",
}
diff --git a/packages/types/src/review/common.ts b/packages/types/src/review/common.ts
new file mode 100644
index 000000000..80fbcf368
--- /dev/null
+++ b/packages/types/src/review/common.ts
@@ -0,0 +1,9 @@
+export type ReviewDTO = {
+ id: string
+ reference: "product" | "seller"
+ rating: number
+ customer_note: string | null
+ seller_note: string | null
+ created_at: Date
+ updated_at: Date | null
+}
diff --git a/packages/types/src/review/index.ts b/packages/types/src/review/index.ts
new file mode 100644
index 000000000..a717a5435
--- /dev/null
+++ b/packages/types/src/review/index.ts
@@ -0,0 +1,2 @@
+export * from "./common"
+export * from "./mutation"
diff --git a/packages/types/src/review/mutation.ts b/packages/types/src/review/mutation.ts
new file mode 100644
index 000000000..a50980cf7
--- /dev/null
+++ b/packages/types/src/review/mutation.ts
@@ -0,0 +1,15 @@
+export type CreateReviewDTO = {
+ order_id: string
+ reference: "product" | "seller"
+ reference_id: string
+ rating: number
+ customer_note: string | null
+ customer_id: string
+}
+
+export type UpdateReviewDTO = {
+ id: string
+ rating?: number
+ customer_note?: string
+ seller_note?: string
+}
diff --git a/packages/vendor/.mercur/_generated/index.ts b/packages/vendor/.mercur/_generated/index.ts
new file mode 100644
index 000000000..8cbaf5f08
--- /dev/null
+++ b/packages/vendor/.mercur/_generated/index.ts
@@ -0,0 +1,697 @@
+// This file is generated automatically by Mercur CLI
+// Do not edit this file manually
+
+export type Routes = {
+ admin: {
+ apiKeys: typeof import("@medusajs/medusa/api/admin/api-keys/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/api-keys/[id]/route") & {
+ revoke: typeof import("@medusajs/medusa/api/admin/api-keys/[id]/revoke/route");
+ salesChannels: typeof import("@medusajs/medusa/api/admin/api-keys/[id]/sales-channels/route");
+ };
+ };
+ campaigns: typeof import("@medusajs/medusa/api/admin/campaigns/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/campaigns/[id]/route") & {
+ promotions: typeof import("@medusajs/medusa/api/admin/campaigns/[id]/promotions/route");
+ };
+ };
+ claims: typeof import("@medusajs/medusa/api/admin/claims/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/claims/[id]/route") & {
+ cancel: typeof import("@medusajs/medusa/api/admin/claims/[id]/cancel/route");
+ claimItems: typeof import("@medusajs/medusa/api/admin/claims/[id]/claim-items/route") & {
+ $actionId: typeof import("@medusajs/medusa/api/admin/claims/[id]/claim-items/[action_id]/route");
+ };
+ inbound: {
+ items: typeof import("@medusajs/medusa/api/admin/claims/[id]/inbound/items/route") & {
+ $actionId: typeof import("@medusajs/medusa/api/admin/claims/[id]/inbound/items/[action_id]/route");
+ };
+ shippingMethod: typeof import("@medusajs/medusa/api/admin/claims/[id]/inbound/shipping-method/route") & {
+ $actionId: typeof import("@medusajs/medusa/api/admin/claims/[id]/inbound/shipping-method/[action_id]/route");
+ };
+ };
+ outbound: {
+ items: typeof import("@medusajs/medusa/api/admin/claims/[id]/outbound/items/route") & {
+ $actionId: typeof import("@medusajs/medusa/api/admin/claims/[id]/outbound/items/[action_id]/route");
+ };
+ shippingMethod: typeof import("@medusajs/medusa/api/admin/claims/[id]/outbound/shipping-method/route") & {
+ $actionId: typeof import("@medusajs/medusa/api/admin/claims/[id]/outbound/shipping-method/[action_id]/route");
+ };
+ };
+ request: typeof import("@medusajs/medusa/api/admin/claims/[id]/request/route");
+ };
+ };
+ collections: typeof import("@medusajs/medusa/api/admin/collections/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/collections/[id]/route") & {
+ products: typeof import("@medusajs/medusa/api/admin/collections/[id]/products/route");
+ };
+ };
+ currencies: typeof import("@medusajs/medusa/api/admin/currencies/route") & {
+ $code: typeof import("@medusajs/medusa/api/admin/currencies/[code]/route");
+ };
+ customerGroups: typeof import("@medusajs/medusa/api/admin/customer-groups/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/customer-groups/[id]/route") & {
+ customers: typeof import("@medusajs/medusa/api/admin/customer-groups/[id]/customers/route");
+ };
+ };
+ customers: typeof import("@medusajs/medusa/api/admin/customers/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/customers/[id]/route") & {
+ addresses: typeof import("@medusajs/medusa/api/admin/customers/[id]/addresses/route") & {
+ $addressId: typeof import("@medusajs/medusa/api/admin/customers/[id]/addresses/[address_id]/route");
+ };
+ customerGroups: typeof import("@medusajs/medusa/api/admin/customers/[id]/customer-groups/route");
+ };
+ };
+ draftOrders: typeof import("@medusajs/medusa/api/admin/draft-orders/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/draft-orders/[id]/route") & {
+ convertToOrder: typeof import("@medusajs/medusa/api/admin/draft-orders/[id]/convert-to-order/route");
+ edit: typeof import("@medusajs/medusa/api/admin/draft-orders/[id]/edit/route") & {
+ confirm: typeof import("@medusajs/medusa/api/admin/draft-orders/[id]/edit/confirm/route");
+ items: typeof import("@medusajs/medusa/api/admin/draft-orders/[id]/edit/items/route") & {
+ $actionId: typeof import("@medusajs/medusa/api/admin/draft-orders/[id]/edit/items/[action_id]/route");
+ item: {
+ $itemId: typeof import("@medusajs/medusa/api/admin/draft-orders/[id]/edit/items/item/[item_id]/route");
+ };
+ };
+ promotions: typeof import("@medusajs/medusa/api/admin/draft-orders/[id]/edit/promotions/route");
+ request: typeof import("@medusajs/medusa/api/admin/draft-orders/[id]/edit/request/route");
+ shippingMethods: typeof import("@medusajs/medusa/api/admin/draft-orders/[id]/edit/shipping-methods/route") & {
+ $actionId: typeof import("@medusajs/medusa/api/admin/draft-orders/[id]/edit/shipping-methods/[action_id]/route");
+ method: {
+ $methodId: typeof import("@medusajs/medusa/api/admin/draft-orders/[id]/edit/shipping-methods/method/[method_id]/route");
+ };
+ };
+ };
+ };
+ };
+ exchanges: typeof import("@medusajs/medusa/api/admin/exchanges/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/exchanges/[id]/route") & {
+ cancel: typeof import("@medusajs/medusa/api/admin/exchanges/[id]/cancel/route");
+ inbound: {
+ items: typeof import("@medusajs/medusa/api/admin/exchanges/[id]/inbound/items/route") & {
+ $actionId: typeof import("@medusajs/medusa/api/admin/exchanges/[id]/inbound/items/[action_id]/route");
+ };
+ shippingMethod: typeof import("@medusajs/medusa/api/admin/exchanges/[id]/inbound/shipping-method/route") & {
+ $actionId: typeof import("@medusajs/medusa/api/admin/exchanges/[id]/inbound/shipping-method/[action_id]/route");
+ };
+ };
+ outbound: {
+ items: typeof import("@medusajs/medusa/api/admin/exchanges/[id]/outbound/items/route") & {
+ $actionId: typeof import("@medusajs/medusa/api/admin/exchanges/[id]/outbound/items/[action_id]/route");
+ };
+ shippingMethod: typeof import("@medusajs/medusa/api/admin/exchanges/[id]/outbound/shipping-method/route") & {
+ $actionId: typeof import("@medusajs/medusa/api/admin/exchanges/[id]/outbound/shipping-method/[action_id]/route");
+ };
+ };
+ request: typeof import("@medusajs/medusa/api/admin/exchanges/[id]/request/route");
+ };
+ };
+ featureFlags: typeof import("@medusajs/medusa/api/admin/feature-flags/route");
+ fulfillmentProviders: typeof import("@medusajs/medusa/api/admin/fulfillment-providers/route") & {
+ $id: {
+ options: typeof import("@medusajs/medusa/api/admin/fulfillment-providers/[id]/options/route");
+ };
+ };
+ fulfillmentSets: {
+ $id: typeof import("@medusajs/medusa/api/admin/fulfillment-sets/[id]/route") & {
+ serviceZones: typeof import("@medusajs/medusa/api/admin/fulfillment-sets/[id]/service-zones/route") & {
+ $zoneId: typeof import("@medusajs/medusa/api/admin/fulfillment-sets/[id]/service-zones/[zone_id]/route");
+ };
+ };
+ };
+ fulfillments: typeof import("@medusajs/medusa/api/admin/fulfillments/route") & {
+ $id: {
+ cancel: typeof import("@medusajs/medusa/api/admin/fulfillments/[id]/cancel/route");
+ shipment: typeof import("@medusajs/medusa/api/admin/fulfillments/[id]/shipment/route");
+ };
+ };
+ index: {
+ details: typeof import("@medusajs/medusa/api/admin/index/details/route");
+ sync: typeof import("@medusajs/medusa/api/admin/index/sync/route");
+ };
+ inventoryItems: typeof import("@medusajs/medusa/api/admin/inventory-items/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/inventory-items/[id]/route") & {
+ locationLevels: typeof import("@medusajs/medusa/api/admin/inventory-items/[id]/location-levels/route") & {
+ $locationId: typeof import("@medusajs/medusa/api/admin/inventory-items/[id]/location-levels/[location_id]/route");
+ batch: typeof import("@medusajs/medusa/api/admin/inventory-items/[id]/location-levels/batch/route");
+ };
+ };
+ locationLevels: {
+ batch: typeof import("@medusajs/medusa/api/admin/inventory-items/location-levels/batch/route");
+ };
+ };
+ invites: typeof import("@medusajs/medusa/api/admin/invites/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/invites/[id]/route") & {
+ resend: typeof import("@medusajs/medusa/api/admin/invites/[id]/resend/route");
+ };
+ accept: typeof import("@mercurjs/core-plugin/api/admin/invites/accept/route");
+ };
+ locales: typeof import("@medusajs/medusa/api/admin/locales/route") & {
+ $code: typeof import("@medusajs/medusa/api/admin/locales/[code]/route");
+ };
+ notifications: typeof import("@medusajs/medusa/api/admin/notifications/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/notifications/[id]/route");
+ };
+ orderChanges: {
+ $id: typeof import("@medusajs/medusa/api/admin/order-changes/[id]/route");
+ };
+ orderEdits: typeof import("@medusajs/medusa/api/admin/order-edits/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/order-edits/[id]/route") & {
+ confirm: typeof import("@medusajs/medusa/api/admin/order-edits/[id]/confirm/route");
+ items: typeof import("@medusajs/medusa/api/admin/order-edits/[id]/items/route") & {
+ $actionId: typeof import("@medusajs/medusa/api/admin/order-edits/[id]/items/[action_id]/route");
+ item: {
+ $itemId: typeof import("@medusajs/medusa/api/admin/order-edits/[id]/items/item/[item_id]/route");
+ };
+ };
+ request: typeof import("@medusajs/medusa/api/admin/order-edits/[id]/request/route");
+ shippingMethod: typeof import("@medusajs/medusa/api/admin/order-edits/[id]/shipping-method/route") & {
+ $actionId: typeof import("@medusajs/medusa/api/admin/order-edits/[id]/shipping-method/[action_id]/route");
+ };
+ };
+ };
+ orders: typeof import("@mercurjs/core-plugin/api/admin/orders/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/orders/[id]/route") & {
+ archive: typeof import("@medusajs/medusa/api/admin/orders/[id]/archive/route");
+ cancel: typeof import("@medusajs/medusa/api/admin/orders/[id]/cancel/route");
+ changes: typeof import("@medusajs/medusa/api/admin/orders/[id]/changes/route");
+ complete: typeof import("@medusajs/medusa/api/admin/orders/[id]/complete/route");
+ creditLines: typeof import("@medusajs/medusa/api/admin/orders/[id]/credit-lines/route");
+ fulfillments: typeof import("@medusajs/medusa/api/admin/orders/[id]/fulfillments/route") & {
+ $fulfillmentId: {
+ cancel: typeof import("@medusajs/medusa/api/admin/orders/[id]/fulfillments/[fulfillment_id]/cancel/route");
+ markAsDelivered: typeof import("@medusajs/medusa/api/admin/orders/[id]/fulfillments/[fulfillment_id]/mark-as-delivered/route");
+ shipments: typeof import("@medusajs/medusa/api/admin/orders/[id]/fulfillments/[fulfillment_id]/shipments/route");
+ };
+ };
+ lineItems: typeof import("@medusajs/medusa/api/admin/orders/[id]/line-items/route");
+ preview: typeof import("@medusajs/medusa/api/admin/orders/[id]/preview/route");
+ shippingOptions: typeof import("@medusajs/medusa/api/admin/orders/[id]/shipping-options/route");
+ transfer: typeof import("@medusajs/medusa/api/admin/orders/[id]/transfer/route") & {
+ cancel: typeof import("@medusajs/medusa/api/admin/orders/[id]/transfer/cancel/route");
+ };
+ };
+ export: typeof import("@medusajs/medusa/api/admin/orders/export/route");
+ };
+ paymentCollections: typeof import("@medusajs/medusa/api/admin/payment-collections/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/payment-collections/[id]/route") & {
+ markAsPaid: typeof import("@medusajs/medusa/api/admin/payment-collections/[id]/mark-as-paid/route");
+ };
+ };
+ payments: typeof import("@medusajs/medusa/api/admin/payments/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/payments/[id]/route") & {
+ capture: typeof import("@medusajs/medusa/api/admin/payments/[id]/capture/route");
+ refund: typeof import("@medusajs/medusa/api/admin/payments/[id]/refund/route");
+ };
+ paymentProviders: typeof import("@medusajs/medusa/api/admin/payments/payment-providers/route");
+ };
+ plugins: typeof import("@medusajs/medusa/api/admin/plugins/route");
+ priceLists: typeof import("@medusajs/medusa/api/admin/price-lists/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/price-lists/[id]/route") & {
+ prices: typeof import("@medusajs/medusa/api/admin/price-lists/[id]/prices/route") & {
+ batch: typeof import("@medusajs/medusa/api/admin/price-lists/[id]/prices/batch/route");
+ };
+ products: typeof import("@medusajs/medusa/api/admin/price-lists/[id]/products/route");
+ };
+ };
+ pricePreferences: typeof import("@medusajs/medusa/api/admin/price-preferences/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/price-preferences/[id]/route");
+ };
+ productCategories: typeof import("@medusajs/medusa/api/admin/product-categories/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/product-categories/[id]/route") & {
+ products: typeof import("@medusajs/medusa/api/admin/product-categories/[id]/products/route");
+ };
+ };
+ productTags: typeof import("@medusajs/medusa/api/admin/product-tags/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/product-tags/[id]/route");
+ };
+ productTypes: typeof import("@medusajs/medusa/api/admin/product-types/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/product-types/[id]/route");
+ };
+ productVariants: typeof import("@medusajs/medusa/api/admin/product-variants/route");
+ products: typeof import("@mercurjs/core-plugin/api/admin/products/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/products/[id]/route") & {
+ images: {
+ $imageId: {
+ variants: {
+ batch: typeof import("@medusajs/medusa/api/admin/products/[id]/images/[image_id]/variants/batch/route");
+ };
+ };
+ };
+ options: typeof import("@medusajs/medusa/api/admin/products/[id]/options/route") & {
+ $optionId: typeof import("@medusajs/medusa/api/admin/products/[id]/options/[option_id]/route");
+ };
+ variants: typeof import("@medusajs/medusa/api/admin/products/[id]/variants/route") & {
+ $variantId: typeof import("@medusajs/medusa/api/admin/products/[id]/variants/[variant_id]/route") & {
+ images: {
+ batch: typeof import("@medusajs/medusa/api/admin/products/[id]/variants/[variant_id]/images/batch/route");
+ };
+ inventoryItems: typeof import("@medusajs/medusa/api/admin/products/[id]/variants/[variant_id]/inventory-items/route") & {
+ $inventoryItemId: typeof import("@medusajs/medusa/api/admin/products/[id]/variants/[variant_id]/inventory-items/[inventory_item_id]/route");
+ };
+ };
+ batch: typeof import("@medusajs/medusa/api/admin/products/[id]/variants/batch/route");
+ inventoryItems: {
+ batch: typeof import("@medusajs/medusa/api/admin/products/[id]/variants/inventory-items/batch/route");
+ };
+ };
+ };
+ batch: typeof import("@medusajs/medusa/api/admin/products/batch/route");
+ export: typeof import("@medusajs/medusa/api/admin/products/export/route");
+ import: typeof import("@medusajs/medusa/api/admin/products/import/route") & {
+ $transactionId: {
+ confirm: typeof import("@medusajs/medusa/api/admin/products/import/[transaction_id]/confirm/route");
+ };
+ };
+ imports: typeof import("@medusajs/medusa/api/admin/products/imports/route") & {
+ $transactionId: {
+ confirm: typeof import("@medusajs/medusa/api/admin/products/imports/[transaction_id]/confirm/route");
+ };
+ };
+ };
+ promotions: typeof import("@medusajs/medusa/api/admin/promotions/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/promotions/[id]/route") & {
+ $ruleType: typeof import("@medusajs/medusa/api/admin/promotions/[id]/[rule_type]/route");
+ buyRules: {
+ batch: typeof import("@medusajs/medusa/api/admin/promotions/[id]/buy-rules/batch/route");
+ };
+ rules: {
+ batch: typeof import("@medusajs/medusa/api/admin/promotions/[id]/rules/batch/route");
+ };
+ targetRules: {
+ batch: typeof import("@medusajs/medusa/api/admin/promotions/[id]/target-rules/batch/route");
+ };
+ };
+ ruleAttributeOptions: {
+ $ruleType: typeof import("@medusajs/medusa/api/admin/promotions/rule-attribute-options/[rule_type]/route");
+ };
+ ruleValueOptions: {
+ $ruleType: {
+ $ruleAttributeId: typeof import("@medusajs/medusa/api/admin/promotions/rule-value-options/[rule_type]/[rule_attribute_id]/route");
+ };
+ };
+ };
+ rbac: {
+ policies: typeof import("@medusajs/medusa/api/admin/rbac/policies/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/rbac/policies/[id]/route");
+ };
+ roles: typeof import("@medusajs/medusa/api/admin/rbac/roles/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/rbac/roles/[id]/route") & {
+ policies: typeof import("@medusajs/medusa/api/admin/rbac/roles/[id]/policies/route") & {
+ $policyId: typeof import("@medusajs/medusa/api/admin/rbac/roles/[id]/policies/[policy_id]/route");
+ };
+ };
+ };
+ };
+ refundReasons: typeof import("@medusajs/medusa/api/admin/refund-reasons/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/refund-reasons/[id]/route");
+ };
+ regions: typeof import("@medusajs/medusa/api/admin/regions/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/regions/[id]/route");
+ };
+ reservations: typeof import("@medusajs/medusa/api/admin/reservations/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/reservations/[id]/route");
+ };
+ returnReasons: typeof import("@medusajs/medusa/api/admin/return-reasons/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/return-reasons/[id]/route");
+ };
+ returns: typeof import("@medusajs/medusa/api/admin/returns/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/returns/[id]/route") & {
+ cancel: typeof import("@medusajs/medusa/api/admin/returns/[id]/cancel/route");
+ dismissItems: typeof import("@medusajs/medusa/api/admin/returns/[id]/dismiss-items/route") & {
+ $actionId: typeof import("@medusajs/medusa/api/admin/returns/[id]/dismiss-items/[action_id]/route");
+ };
+ receive: typeof import("@medusajs/medusa/api/admin/returns/[id]/receive/route") & {
+ confirm: typeof import("@medusajs/medusa/api/admin/returns/[id]/receive/confirm/route");
+ };
+ receiveItems: typeof import("@medusajs/medusa/api/admin/returns/[id]/receive-items/route") & {
+ $actionId: typeof import("@medusajs/medusa/api/admin/returns/[id]/receive-items/[action_id]/route");
+ };
+ request: typeof import("@medusajs/medusa/api/admin/returns/[id]/request/route");
+ requestItems: typeof import("@medusajs/medusa/api/admin/returns/[id]/request-items/route") & {
+ $actionId: typeof import("@medusajs/medusa/api/admin/returns/[id]/request-items/[action_id]/route");
+ };
+ shippingMethod: typeof import("@medusajs/medusa/api/admin/returns/[id]/shipping-method/route") & {
+ $actionId: typeof import("@medusajs/medusa/api/admin/returns/[id]/shipping-method/[action_id]/route");
+ };
+ };
+ };
+ salesChannels: typeof import("@medusajs/medusa/api/admin/sales-channels/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/sales-channels/[id]/route") & {
+ products: typeof import("@medusajs/medusa/api/admin/sales-channels/[id]/products/route");
+ };
+ };
+ shippingOptionTypes: typeof import("@medusajs/medusa/api/admin/shipping-option-types/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/shipping-option-types/[id]/route");
+ };
+ shippingOptions: typeof import("@medusajs/medusa/api/admin/shipping-options/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/shipping-options/[id]/route") & {
+ rules: {
+ batch: typeof import("@medusajs/medusa/api/admin/shipping-options/[id]/rules/batch/route");
+ };
+ };
+ };
+ shippingProfiles: typeof import("@medusajs/medusa/api/admin/shipping-profiles/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/shipping-profiles/[id]/route");
+ };
+ stockLocations: typeof import("@medusajs/medusa/api/admin/stock-locations/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/stock-locations/[id]/route") & {
+ fulfillmentProviders: typeof import("@medusajs/medusa/api/admin/stock-locations/[id]/fulfillment-providers/route");
+ fulfillmentSets: typeof import("@medusajs/medusa/api/admin/stock-locations/[id]/fulfillment-sets/route");
+ salesChannels: typeof import("@medusajs/medusa/api/admin/stock-locations/[id]/sales-channels/route");
+ };
+ };
+ stores: typeof import("@medusajs/medusa/api/admin/stores/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/stores/[id]/route");
+ };
+ taxProviders: typeof import("@medusajs/medusa/api/admin/tax-providers/route");
+ taxRates: typeof import("@medusajs/medusa/api/admin/tax-rates/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/tax-rates/[id]/route") & {
+ rules: typeof import("@medusajs/medusa/api/admin/tax-rates/[id]/rules/route") & {
+ $ruleId: typeof import("@medusajs/medusa/api/admin/tax-rates/[id]/rules/[rule_id]/route");
+ };
+ };
+ };
+ taxRegions: typeof import("@medusajs/medusa/api/admin/tax-regions/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/tax-regions/[id]/route");
+ };
+ translations: typeof import("@medusajs/medusa/api/admin/translations/route") & {
+ batch: typeof import("@medusajs/medusa/api/admin/translations/batch/route");
+ entities: typeof import("@medusajs/medusa/api/admin/translations/entities/route");
+ settings: typeof import("@medusajs/medusa/api/admin/translations/settings/route") & {
+ batch: typeof import("@medusajs/medusa/api/admin/translations/settings/batch/route");
+ };
+ statistics: typeof import("@medusajs/medusa/api/admin/translations/statistics/route");
+ };
+ uploads: typeof import("@medusajs/medusa/api/admin/uploads/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/uploads/[id]/route");
+ presignedUrls: typeof import("@medusajs/medusa/api/admin/uploads/presigned-urls/route");
+ };
+ users: typeof import("@medusajs/medusa/api/admin/users/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/users/[id]/route");
+ me: typeof import("@medusajs/medusa/api/admin/users/me/route");
+ };
+ views: {
+ $entity: {
+ columns: typeof import("@medusajs/medusa/api/admin/views/[entity]/columns/route");
+ configurations: typeof import("@medusajs/medusa/api/admin/views/[entity]/configurations/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/views/[entity]/configurations/[id]/route");
+ active: typeof import("@medusajs/medusa/api/admin/views/[entity]/configurations/active/route");
+ };
+ };
+ };
+ workflowsExecutions: typeof import("@medusajs/medusa/api/admin/workflows-executions/route") & {
+ $id: typeof import("@medusajs/medusa/api/admin/workflows-executions/[id]/route");
+ $workflowId: {
+ $transactionId: typeof import("@medusajs/medusa/api/admin/workflows-executions/[workflow_id]/[transaction_id]/route") & {
+ $stepId: {
+ subscribe: typeof import("@medusajs/medusa/api/admin/workflows-executions/[workflow_id]/[transaction_id]/[step_id]/subscribe/route");
+ };
+ };
+ run: typeof import("@medusajs/medusa/api/admin/workflows-executions/[workflow_id]/run/route");
+ steps: {
+ failure: typeof import("@medusajs/medusa/api/admin/workflows-executions/[workflow_id]/steps/failure/route");
+ success: typeof import("@medusajs/medusa/api/admin/workflows-executions/[workflow_id]/steps/success/route");
+ };
+ subscribe: typeof import("@medusajs/medusa/api/admin/workflows-executions/[workflow_id]/subscribe/route");
+ };
+ };
+ commissionRates: typeof import("@mercurjs/core-plugin/api/admin/commission-rates/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/admin/commission-rates/[id]/route") & {
+ rules: typeof import("@mercurjs/core-plugin/api/admin/commission-rates/[id]/rules/route");
+ };
+ };
+ orderGroups: typeof import("@mercurjs/core-plugin/api/admin/order-groups/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/admin/order-groups/[id]/route");
+ };
+ payouts: typeof import("@mercurjs/core-plugin/api/admin/payouts/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/admin/payouts/[id]/route");
+ };
+ sellers: typeof import("@mercurjs/core-plugin/api/admin/sellers/route") & {
+ invite: typeof import("@mercurjs/core-plugin/api/admin/sellers/invite/route");
+ $id: typeof import("@mercurjs/core-plugin/api/admin/sellers/[id]/route");
+ };
+ };
+ auth: {
+ $actorType: {
+ $authProvider: typeof import("@medusajs/medusa/api/auth/[actor_type]/[auth_provider]/route") & {
+ callback: typeof import("@medusajs/medusa/api/auth/[actor_type]/[auth_provider]/callback/route");
+ register: typeof import("@medusajs/medusa/api/auth/[actor_type]/[auth_provider]/register/route");
+ resetPassword: typeof import("@medusajs/medusa/api/auth/[actor_type]/[auth_provider]/reset-password/route");
+ update: typeof import("@medusajs/medusa/api/auth/[actor_type]/[auth_provider]/update/route");
+ };
+ };
+ session: typeof import("@medusajs/medusa/api/auth/session/route");
+ token: {
+ refresh: typeof import("@medusajs/medusa/api/auth/token/refresh/route");
+ };
+ };
+ store: {
+ carts: typeof import("@medusajs/medusa/api/store/carts/route") & {
+ $id: typeof import("@medusajs/medusa/api/store/carts/[id]/route") & {
+ complete: typeof import("@mercurjs/core-plugin/api/store/carts/[id]/complete/route");
+ customer: typeof import("@medusajs/medusa/api/store/carts/[id]/customer/route");
+ lineItems: typeof import("@medusajs/medusa/api/store/carts/[id]/line-items/route") & {
+ $lineId: typeof import("@medusajs/medusa/api/store/carts/[id]/line-items/[line_id]/route");
+ };
+ promotions: typeof import("@mercurjs/core-plugin/api/store/carts/[id]/promotions/route");
+ shippingMethods: typeof import("@mercurjs/core-plugin/api/store/carts/[id]/shipping-methods/route");
+ taxes: typeof import("@medusajs/medusa/api/store/carts/[id]/taxes/route");
+ };
+ };
+ collections: typeof import("@medusajs/medusa/api/store/collections/route") & {
+ $id: typeof import("@medusajs/medusa/api/store/collections/[id]/route");
+ };
+ currencies: typeof import("@medusajs/medusa/api/store/currencies/route") & {
+ $code: typeof import("@medusajs/medusa/api/store/currencies/[code]/route");
+ };
+ customers: typeof import("@medusajs/medusa/api/store/customers/route") & {
+ me: typeof import("@medusajs/medusa/api/store/customers/me/route") & {
+ addresses: typeof import("@medusajs/medusa/api/store/customers/me/addresses/route") & {
+ $addressId: typeof import("@medusajs/medusa/api/store/customers/me/addresses/[address_id]/route");
+ };
+ };
+ };
+ locales: typeof import("@medusajs/medusa/api/store/locales/route");
+ orders: typeof import("@medusajs/medusa/api/store/orders/route") & {
+ $id: typeof import("@medusajs/medusa/api/store/orders/[id]/route") & {
+ transfer: {
+ accept: typeof import("@medusajs/medusa/api/store/orders/[id]/transfer/accept/route");
+ cancel: typeof import("@medusajs/medusa/api/store/orders/[id]/transfer/cancel/route");
+ decline: typeof import("@medusajs/medusa/api/store/orders/[id]/transfer/decline/route");
+ request: typeof import("@medusajs/medusa/api/store/orders/[id]/transfer/request/route");
+ };
+ };
+ };
+ paymentCollections: typeof import("@medusajs/medusa/api/store/payment-collections/route") & {
+ $id: {
+ paymentSessions: typeof import("@medusajs/medusa/api/store/payment-collections/[id]/payment-sessions/route");
+ };
+ };
+ paymentProviders: typeof import("@medusajs/medusa/api/store/payment-providers/route");
+ productCategories: typeof import("@medusajs/medusa/api/store/product-categories/route") & {
+ $id: typeof import("@medusajs/medusa/api/store/product-categories/[id]/route");
+ };
+ productTags: typeof import("@medusajs/medusa/api/store/product-tags/route") & {
+ $id: typeof import("@medusajs/medusa/api/store/product-tags/[id]/route");
+ };
+ productTypes: typeof import("@medusajs/medusa/api/store/product-types/route") & {
+ $id: typeof import("@medusajs/medusa/api/store/product-types/[id]/route");
+ };
+ productVariants: typeof import("@medusajs/medusa/api/store/product-variants/route") & {
+ $id: typeof import("@medusajs/medusa/api/store/product-variants/[id]/route");
+ };
+ products: typeof import("@medusajs/medusa/api/store/products/route") & {
+ $id: typeof import("@medusajs/medusa/api/store/products/[id]/route");
+ };
+ regions: typeof import("@medusajs/medusa/api/store/regions/route") & {
+ $id: typeof import("@medusajs/medusa/api/store/regions/[id]/route");
+ };
+ returnReasons: typeof import("@medusajs/medusa/api/store/return-reasons/route") & {
+ $id: typeof import("@medusajs/medusa/api/store/return-reasons/[id]/route");
+ };
+ returns: typeof import("@medusajs/medusa/api/store/returns/route");
+ shippingOptions: typeof import("@mercurjs/core-plugin/api/store/shipping-options/route") & {
+ $id: {
+ calculate: typeof import("@medusajs/medusa/api/store/shipping-options/[id]/calculate/route");
+ };
+ };
+ orderGroups: typeof import("@mercurjs/core-plugin/api/store/order-groups/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/store/order-groups/[id]/route");
+ };
+ sellers: typeof import("@mercurjs/core-plugin/api/store/sellers/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/store/sellers/[id]/route");
+ };
+ };
+ vendor: {
+ campaigns: typeof import("@mercurjs/core-plugin/api/vendor/campaigns/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/campaigns/[id]/route") & {
+ promotions: typeof import("@mercurjs/core-plugin/api/vendor/campaigns/[id]/promotions/route");
+ };
+ };
+ collections: typeof import("@mercurjs/core-plugin/api/vendor/collections/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/collections/[id]/route") & {
+ products: typeof import("@mercurjs/core-plugin/api/vendor/collections/[id]/products/route");
+ };
+ };
+ currencies: typeof import("@mercurjs/core-plugin/api/vendor/currencies/route") & {
+ $code: typeof import("@mercurjs/core-plugin/api/vendor/currencies/[code]/route");
+ };
+ customers: typeof import("@mercurjs/core-plugin/api/vendor/customers/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/customers/[id]/route");
+ };
+ fulfillmentSets: {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/fulfillment-sets/[id]/route") & {
+ serviceZones: typeof import("@mercurjs/core-plugin/api/vendor/fulfillment-sets/[id]/service-zones/route") & {
+ $zoneId: typeof import("@mercurjs/core-plugin/api/vendor/fulfillment-sets/[id]/service-zones/[zone_id]/route");
+ };
+ };
+ };
+ inventoryItems: typeof import("@mercurjs/core-plugin/api/vendor/inventory-items/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/inventory-items/[id]/route") & {
+ locationLevels: typeof import("@mercurjs/core-plugin/api/vendor/inventory-items/[id]/location-levels/route") & {
+ $locationId: typeof import("@mercurjs/core-plugin/api/vendor/inventory-items/[id]/location-levels/[location_id]/route");
+ batch: typeof import("@mercurjs/core-plugin/api/vendor/inventory-items/[id]/location-levels/batch/route");
+ };
+ };
+ };
+ orders: typeof import("@mercurjs/core-plugin/api/vendor/orders/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/orders/[id]/route") & {
+ cancel: typeof import("@mercurjs/core-plugin/api/vendor/orders/[id]/cancel/route");
+ changes: typeof import("@mercurjs/core-plugin/api/vendor/orders/[id]/changes/route");
+ complete: typeof import("@mercurjs/core-plugin/api/vendor/orders/[id]/complete/route");
+ fulfillments: typeof import("@mercurjs/core-plugin/api/vendor/orders/[id]/fulfillments/route") & {
+ $fulfillmentId: {
+ cancel: typeof import("@mercurjs/core-plugin/api/vendor/orders/[id]/fulfillments/[fulfillment_id]/cancel/route");
+ markAsDelivered: typeof import("@mercurjs/core-plugin/api/vendor/orders/[id]/fulfillments/[fulfillment_id]/mark-as-delivered/route");
+ shipments: typeof import("@mercurjs/core-plugin/api/vendor/orders/[id]/fulfillments/[fulfillment_id]/shipments/route");
+ };
+ };
+ preview: typeof import("@mercurjs/core-plugin/api/vendor/orders/[id]/preview/route");
+ };
+ };
+ payments: typeof import("@mercurjs/core-plugin/api/vendor/payments/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/payments/[id]/route") & {
+ capture: typeof import("@mercurjs/core-plugin/api/vendor/payments/[id]/capture/route");
+ refund: typeof import("@mercurjs/core-plugin/api/vendor/payments/[id]/refund/route");
+ };
+ paymentProviders: typeof import("@mercurjs/core-plugin/api/vendor/payments/payment-providers/route");
+ };
+ payoutAccounts: typeof import("@mercurjs/core-plugin/api/vendor/payout-accounts/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/payout-accounts/[id]/route") & {
+ onboarding: typeof import("@mercurjs/core-plugin/api/vendor/payout-accounts/[id]/onboarding/route");
+ };
+ };
+ payouts: typeof import("@mercurjs/core-plugin/api/vendor/payouts/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/payouts/[id]/route");
+ };
+ priceLists: typeof import("@mercurjs/core-plugin/api/vendor/price-lists/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/price-lists/[id]/route") & {
+ products: typeof import("@mercurjs/core-plugin/api/vendor/price-lists/[id]/products/route");
+ };
+ };
+ pricePreferences: typeof import("@mercurjs/core-plugin/api/vendor/price-preferences/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/price-preferences/[id]/route");
+ };
+ productCategories: typeof import("@mercurjs/core-plugin/api/vendor/product-categories/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/product-categories/[id]/route") & {
+ products: typeof import("@mercurjs/core-plugin/api/vendor/product-categories/[id]/products/route");
+ };
+ };
+ productTags: typeof import("@mercurjs/core-plugin/api/vendor/product-tags/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/product-tags/[id]/route");
+ };
+ productTypes: typeof import("@mercurjs/core-plugin/api/vendor/product-types/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/product-types/[id]/route");
+ };
+ products: typeof import("@mercurjs/core-plugin/api/vendor/products/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/products/[id]/route") & {
+ options: typeof import("@mercurjs/core-plugin/api/vendor/products/[id]/options/route") & {
+ $optionId: typeof import("@mercurjs/core-plugin/api/vendor/products/[id]/options/[option_id]/route");
+ };
+ variants: typeof import("@mercurjs/core-plugin/api/vendor/products/[id]/variants/route") & {
+ $variantId: typeof import("@mercurjs/core-plugin/api/vendor/products/[id]/variants/[variant_id]/route");
+ };
+ };
+ };
+ promotions: typeof import("@mercurjs/core-plugin/api/vendor/promotions/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/promotions/[id]/route") & {
+ $ruleType: typeof import("@mercurjs/core-plugin/api/vendor/promotions/[id]/[rule_type]/route");
+ buyRules: {
+ batch: typeof import("@mercurjs/core-plugin/api/vendor/promotions/[id]/buy-rules/batch/route");
+ };
+ rules: {
+ batch: typeof import("@mercurjs/core-plugin/api/vendor/promotions/[id]/rules/batch/route");
+ };
+ targetRules: {
+ batch: typeof import("@mercurjs/core-plugin/api/vendor/promotions/[id]/target-rules/batch/route");
+ };
+ };
+ ruleAttributeOptions: {
+ $ruleType: typeof import("@mercurjs/core-plugin/api/vendor/promotions/rule-attribute-options/[rule_type]/route");
+ };
+ ruleValueOptions: {
+ $ruleType: {
+ $ruleAttributeId: typeof import("@mercurjs/core-plugin/api/vendor/promotions/rule-value-options/[rule_type]/[rule_attribute_id]/route");
+ };
+ };
+ };
+ refundReasons: typeof import("@mercurjs/core-plugin/api/vendor/refund-reasons/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/refund-reasons/[id]/route");
+ };
+ regions: typeof import("@mercurjs/core-plugin/api/vendor/regions/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/regions/[id]/route");
+ };
+ returnReasons: typeof import("@mercurjs/core-plugin/api/vendor/return-reasons/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/return-reasons/[id]/route");
+ };
+ returns: typeof import("@mercurjs/core-plugin/api/vendor/returns/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/returns/[id]/route") & {
+ cancel: typeof import("@mercurjs/core-plugin/api/vendor/returns/[id]/cancel/route");
+ dismissItems: typeof import("@mercurjs/core-plugin/api/vendor/returns/[id]/dismiss-items/route") & {
+ $actionId: typeof import("@mercurjs/core-plugin/api/vendor/returns/[id]/dismiss-items/[action_id]/route");
+ };
+ receive: typeof import("@mercurjs/core-plugin/api/vendor/returns/[id]/receive/route") & {
+ confirm: typeof import("@mercurjs/core-plugin/api/vendor/returns/[id]/receive/confirm/route");
+ };
+ receiveItems: typeof import("@mercurjs/core-plugin/api/vendor/returns/[id]/receive-items/route") & {
+ $actionId: typeof import("@mercurjs/core-plugin/api/vendor/returns/[id]/receive-items/[action_id]/route");
+ };
+ request: typeof import("@mercurjs/core-plugin/api/vendor/returns/[id]/request/route");
+ requestItems: typeof import("@mercurjs/core-plugin/api/vendor/returns/[id]/request-items/route") & {
+ $actionId: typeof import("@mercurjs/core-plugin/api/vendor/returns/[id]/request-items/[action_id]/route");
+ };
+ shippingMethod: typeof import("@mercurjs/core-plugin/api/vendor/returns/[id]/shipping-method/route") & {
+ $actionId: typeof import("@mercurjs/core-plugin/api/vendor/returns/[id]/shipping-method/[action_id]/route");
+ };
+ };
+ };
+ salesChannels: typeof import("@mercurjs/core-plugin/api/vendor/sales-channels/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/sales-channels/[id]/route") & {
+ products: typeof import("@mercurjs/core-plugin/api/vendor/sales-channels/[id]/products/route");
+ };
+ };
+ sellers: typeof import("@mercurjs/core-plugin/api/vendor/sellers/route") & {
+ me: typeof import("@mercurjs/core-plugin/api/vendor/sellers/me/route");
+ };
+ shippingOptionTypes: typeof import("@mercurjs/core-plugin/api/vendor/shipping-option-types/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/shipping-option-types/[id]/route");
+ };
+ shippingOptions: typeof import("@mercurjs/core-plugin/api/vendor/shipping-options/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/shipping-options/[id]/route") & {
+ rules: {
+ batch: typeof import("@mercurjs/core-plugin/api/vendor/shipping-options/[id]/rules/batch/route");
+ };
+ };
+ };
+ shippingProfiles: typeof import("@mercurjs/core-plugin/api/vendor/shipping-profiles/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/shipping-profiles/[id]/route");
+ };
+ stockLocations: typeof import("@mercurjs/core-plugin/api/vendor/stock-locations/route") & {
+ $id: typeof import("@mercurjs/core-plugin/api/vendor/stock-locations/[id]/route") & {
+ fulfillmentProviders: typeof import("@mercurjs/core-plugin/api/vendor/stock-locations/[id]/fulfillment-providers/route");
+ fulfillmentSets: typeof import("@mercurjs/core-plugin/api/vendor/stock-locations/[id]/fulfillment-sets/route");
+ salesChannels: typeof import("@mercurjs/core-plugin/api/vendor/stock-locations/[id]/sales-channels/route");
+ };
+ };
+ uploads: typeof import("@mercurjs/core-plugin/api/vendor/uploads/route");
+ };
+};
diff --git a/packages/vendor/src/components/data-grid/components/data-grid-boolean-with-text-cell.tsx b/packages/vendor/src/components/data-grid/components/data-grid-boolean-with-text-cell.tsx
new file mode 100644
index 000000000..5b26bfed5
--- /dev/null
+++ b/packages/vendor/src/components/data-grid/components/data-grid-boolean-with-text-cell.tsx
@@ -0,0 +1,88 @@
+import { Switch } from "@medusajs/ui"
+import { Controller, ControllerRenderProps } from "react-hook-form"
+
+import { useCombinedRefs } from "../../../hooks/use-combined-refs"
+import { useDataGridCell, useDataGridCellError } from "../hooks"
+import { DataGridCellProps, InputProps } from "../types"
+import { DataGridCellContainer } from "./data-grid-cell-container"
+
+export const DataGridBooleanWithTextCell = <TData, TValue = any>({
+ context,
+ trueLabel = "True",
+ falseLabel = "False",
+}: DataGridCellProps<TData, TValue> & {
+ trueLabel?: string
+ falseLabel?: string
+}) => {
+ const { field, control, renderProps } = useDataGridCell({
+ context,
+ })
+ const errorProps = useDataGridCellError({ context })
+
+ const { container, input } = renderProps
+
+ return (
+ <Controller
+ control={control}
+ name={field}
+ render={({ field }) => {
+ return (
+ <DataGridCellContainer {...container} {...errorProps}>
+ <Inner
+ field={field}
+ inputProps={input}
+ trueLabel={trueLabel}
+ falseLabel={falseLabel}
+ />
+ </DataGridCellContainer>
+ )
+ }}
+ />
+ )
+}
+
+const Inner = ({
+ field,
+ inputProps,
+ trueLabel,
+ falseLabel,
+}: {
+ field: ControllerRenderProps<any, string>
+ inputProps: InputProps
+ trueLabel: string
+ falseLabel: string
+}) => {
+ const { ref, value, onBlur } = field
+ const {
+ ref: inputRef,
+ onBlur: onInputBlur,
+ onChange,
+ onFocus,
+ ...attributes
+ } = inputProps
+
+ const combinedRefs = useCombinedRefs(ref, inputRef)
+
+ return (
+ <div className="flex size-full items-center justify-between py-2.5">
+ <Switch
+ ref={combinedRefs}
+ size="small"
+ checked={value}
+ onCheckedChange={(newValue) => {
+ onChange(newValue === true, value)
+ }}
+ onFocus={onFocus}
+ onBlur={() => {
+ onBlur()
+ onInputBlur()
+ }}
+ tabIndex={-1}
+ {...attributes}
+ />
+ <span className="txt-compact-small text-ui-fg-subtle">
+ {value ? trueLabel : falseLabel}
+ </span>
+ </div>
+ )
+}
diff --git a/packages/vendor/src/components/data-grid/components/data-grid-media-cell.tsx b/packages/vendor/src/components/data-grid/components/data-grid-media-cell.tsx
new file mode 100644
index 000000000..ef64c09b7
--- /dev/null
+++ b/packages/vendor/src/components/data-grid/components/data-grid-media-cell.tsx
@@ -0,0 +1,207 @@
+import { useEffect, useRef, useState } from "react"
+
+import { Plus } from "@medusajs/icons"
+import { Controller, ControllerRenderProps } from "react-hook-form"
+
+import { Thumbnail } from "../../common/thumbnail"
+import { useDataGridCell, useDataGridCellError } from "../hooks"
+import { DataGridCellProps, InputProps } from "../types"
+import { DataGridCellContainer } from "./data-grid-cell-container"
+
+export type MediaData = {
+ id?: string
+ url: string
+ isThumbnail: boolean
+ file?: File | null
+}
+
+export const DataGridMediaCell = <TData, TValue = MediaData[]>({
+ context,
+ onOpenMediaModal,
+ disabled,
+ ...rest
+}: DataGridCellProps<TData, TValue> & {
+ onOpenMediaModal?: () => void
+ disabled?: boolean
+}) => {
+ const { field, control, renderProps } = useDataGridCell({
+ context,
+ })
+ const errorProps = useDataGridCellError({ context })
+
+ const { container, input } = renderProps
+
+ return (
+ <Controller
+ control={control}
+ name={field}
+ render={({ field }) => {
+ return (
+ <DataGridCellContainer
+ {...container}
+ {...errorProps}
+ outerComponent={
+ <OuterComponent
+ isAnchor={container.isAnchor}
+ onOpenMediaModal={onOpenMediaModal}
+ disabled={disabled}
+ />
+ }
+ >
+ <Inner
+ field={field}
+ inputProps={input}
+ disabled={disabled}
+ {...rest}
+ />
+ </DataGridCellContainer>
+ )
+ }}
+ />
+ )
+}
+
+const OuterComponent = ({
+ isAnchor,
+ onOpenMediaModal,
+ disabled,
+}: {
+ isAnchor: boolean
+ onOpenMediaModal?: () => void
+ disabled?: boolean
+}) => {
+ const buttonRef = useRef<HTMLButtonElement>(null)
+
+ useEffect(() => {
+ const handleKeyDown = (e: KeyboardEvent) => {
+ if (
+ isAnchor &&
+ e.key === "Enter" &&
+ onOpenMediaModal &&
+ !disabled
+ ) {
+ e.preventDefault()
+ onOpenMediaModal()
+ }
+ }
+
+ document.addEventListener("keydown", handleKeyDown)
+ return () => document.removeEventListener("keydown", handleKeyDown)
+ }, [isAnchor, onOpenMediaModal, disabled])
+
+ return (
+ <div className="absolute inset-y-0 right-4 z-[3] flex w-fit items-center justify-center opacity-0 transition-opacity group-hover/container:opacity-100">
+ <button
+ ref={buttonRef}
+ type="button"
+ onClick={onOpenMediaModal}
+ className="txt-compact-small-plus flex items-center justify-center rounded-[4px] p-1 text-ui-fg-interactive outline-none transition-fg hover:text-ui-fg-interactive-hover focus-visible:shadow-borders-focus disabled:cursor-not-allowed disabled:opacity-50"
+ disabled={!onOpenMediaModal || disabled}
+ >
+ <Plus
+ className={disabled ? "text-ui-fg-muted" : undefined}
+ />
+ </button>
+ </div>
+ )
+}
+
+const Inner = ({
+ field,
+ inputProps,
+ disabled,
+}: {
+ field: ControllerRenderProps<any, string>
+ inputProps: InputProps
+ disabled?: boolean
+}) => {
+ const { ref, value, onChange: _, onBlur, ...fieldProps } = field
+ const {
+ ref: inputRef,
+ onChange,
+ onBlur: onInputBlur,
+ onFocus,
+ } = inputProps
+
+ const [localValue, setLocalValue] = useState<MediaData[]>(value || [])
+
+ useEffect(() => {
+ setLocalValue(value || [])
+ }, [value])
+
+ const combinedRef = useCombinedRefs(inputRef, ref)
+
+ const handleOnChange = () => {
+ onChange(localValue, value)
+ }
+
+ const hasMedia = localValue && localValue.length > 0
+ const MAX_VISIBLE_THUMBNAILS = 4
+
+ return (
+ <div
+ className={`flex size-full items-center gap-x-2 ${disabled ? "opacity-50" : ""}`}
+ {...fieldProps}
+ >
+ <div
+ ref={combinedRef}
+ className={`flex h-full flex-1 items-center gap-1.5 overflow-hidden py-2.5 ${disabled ? "cursor-not-allowed" : "cursor-default"}`}
+ onFocus={disabled ? undefined : onFocus}
+ onBlur={
+ disabled
+ ? undefined
+ : () => {
+ onBlur()
+ onInputBlur()
+ handleOnChange()
+ }
+ }
+ tabIndex={disabled ? -1 : -1}
+ >
+ {hasMedia ? (
+ <>
+ {localValue
+ .slice(0, MAX_VISIBLE_THUMBNAILS)
+ .map((media, index) => (
+ <div
+ key={media.id || `media-${index}`}
+ className="shrink-0"
+ >
+ <Thumbnail
+ src={media.url}
+ alt={
+ media.url
+ ? `Product image ${index + 1}`
+ : undefined
+ }
+ size="small"
+ />
+ </div>
+ ))}
+ {localValue.length > MAX_VISIBLE_THUMBNAILS && (
+ <div className="flex h-5 w-4 shrink-0 items-center justify-center rounded border border-ui-border-base bg-ui-bg-component text-[10px] font-medium text-ui-fg-subtle">
+ +{localValue.length - MAX_VISIBLE_THUMBNAILS}
+ </div>
+ )}
+ </>
+ ) : (
+ <Thumbnail size="small" />
+ )}
+ </div>
+ </div>
+ )
+}
+
+function useCombinedRefs<T extends HTMLElement>(
+ ...refs: React.Ref<T>[]
+): React.Ref<T> {
+ return (value: T | null) => {
+ refs.forEach((ref) => {
+ if (typeof ref === "function") {
+ ref(value)
+ } else if (ref) {
+ ;(ref as React.MutableRefObject<T | null>).current = value
+ }
+ })
+ }
+}
diff --git a/packages/vendor/src/components/data-grid/components/data-grid-status-cell.tsx b/packages/vendor/src/components/data-grid/components/data-grid-status-cell.tsx
new file mode 100644
index 000000000..3f3baa950
--- /dev/null
+++ b/packages/vendor/src/components/data-grid/components/data-grid-status-cell.tsx
@@ -0,0 +1,105 @@
+import { clx, Select } from "@medusajs/ui"
+import { Controller, ControllerRenderProps } from "react-hook-form"
+import { useTranslation } from "react-i18next"
+
+import { useCombinedRefs } from "../../../hooks/use-combined-refs"
+import { useDataGridCell, useDataGridCellError } from "../hooks"
+import { DataGridCellProps, InputProps } from "../types"
+import { DataGridCellContainer } from "./data-grid-cell-container"
+
+export const DataGridStatusCell = <TData, TValue = any>({
+ context,
+}: DataGridCellProps<TData, TValue>) => {
+ const { field, control, renderProps } = useDataGridCell({
+ context,
+ })
+ const errorProps = useDataGridCellError({ context })
+
+ const { container, input } = renderProps
+
+ return (
+ <Controller
+ control={control}
+ name={field}
+ render={({ field }) => {
+ return (
+ <DataGridCellContainer {...container} {...errorProps}>
+ <Inner
+ field={field}
+ inputProps={input}
+ isAnchor={container.isAnchor}
+ />
+ </DataGridCellContainer>
+ )
+ }}
+ />
+ )
+}
+
+const Inner = ({
+ field,
+ inputProps,
+ isAnchor,
+}: {
+ field: ControllerRenderProps<any, string>
+ inputProps: InputProps
+ isAnchor: boolean
+}) => {
+ const { t } = useTranslation()
+ const { ref, value, onChange, onBlur } = field
+ const {
+ ref: inputRef,
+ onBlur: onInputBlur,
+ onFocus,
+ onChange: _onChange,
+ ...attributes
+ } = inputProps
+
+ const combinedRefs = useCombinedRefs(ref, inputRef)
+
+ const options = [
+ {
+ label: t("products.productStatus.draft"),
+ value: "draft",
+ },
+ {
+ label: t("products.productStatus.published"),
+ value: "published",
+ },
+ ]
+
+ return (
+ <Select
+ value={value}
+ onValueChange={(newValue) => {
+ onChange(newValue)
+ }}
+ >
+ <Select.Trigger
+ ref={combinedRefs}
+ className={clx(
+ "txt-compact-small h-full w-full rounded-none border-none bg-transparent px-0 py-2.5 shadow-none outline-none",
+ "hover:bg-transparent focus:shadow-none data-[state=open]:!shadow-none"
+ )}
+ onPointerDown={
+ !isAnchor ? (e) => e.preventDefault() : undefined
+ }
+ onFocus={onFocus}
+ onBlur={() => {
+ onBlur()
+ onInputBlur()
+ }}
+ {...attributes}
+ >
+ <Select.Value />
+ </Select.Trigger>
+ <Select.Content>
+ {options.map((option) => (
+ <Select.Item key={option.value} value={option.value}>
+ {option.label}
+ </Select.Item>
+ ))}
+ </Select.Content>
+ </Select>
+ )
+}
diff --git a/packages/vendor/src/components/data-grid/components/data-grid-toggle-cell.tsx b/packages/vendor/src/components/data-grid/components/data-grid-toggle-cell.tsx
new file mode 100644
index 000000000..2d6494191
--- /dev/null
+++ b/packages/vendor/src/components/data-grid/components/data-grid-toggle-cell.tsx
@@ -0,0 +1,92 @@
+import { Switch, Text } from "@medusajs/ui"
+import { useEffect, useRef, useState } from "react"
+import { Controller, ControllerRenderProps } from "react-hook-form"
+import { useTranslation } from "react-i18next"
+import { useDataGridCell, useDataGridCellError } from "../hooks"
+import { DataGridCellProps, InputProps } from "../types"
+import { DataGridCellContainer } from "./data-grid-cell-container"
+
+export const DataGridToggleCell = <TData, TValue = any>({
+ context,
+}: DataGridCellProps<TData, TValue>) => {
+ const { field, control, renderProps } = useDataGridCell({
+ context,
+ })
+ const errorProps = useDataGridCellError({ context })
+ const { container, input } = renderProps
+
+ return (
+ <Controller
+ control={control}
+ name={field}
+ render={({ field }) => {
+ return (
+ <DataGridCellContainer {...container} {...errorProps}>
+ <Inner field={field} inputProps={input} isAnchor={container.isAnchor} />
+ </DataGridCellContainer>
+ )
+ }}
+ />
+ )
+}
+
+const Inner = ({
+ field,
+ inputProps,
+ isAnchor,
+}: {
+ field: ControllerRenderProps<any, string>
+ inputProps: InputProps
+ isAnchor: boolean
+}) => {
+ const { t } = useTranslation()
+ const { value, onChange: _ } = field
+ const { onChange } = inputProps
+ const switchRef = useRef<HTMLButtonElement>(null)
+
+ const [localValue, setLocalValue] = useState(value)
+
+ useEffect(() => {
+ setLocalValue(value)
+ }, [value])
+
+ const handleCheckedChange = (checked: boolean) => {
+ const newValue = { ...localValue, checked }
+ if (!checked) {
+ newValue.quantity = ""
+ }
+ if (checked && (newValue.quantity === "" || newValue.quantity === null)) {
+ newValue.quantity = 0
+ }
+ setLocalValue(newValue)
+ onChange(newValue, value)
+ }
+
+ useEffect(() => {
+ const handleKeyDown = (e: KeyboardEvent) => {
+ if (isAnchor && e.key.toLowerCase() === "x") {
+ e.preventDefault()
+ switchRef.current?.click()
+ }
+ }
+ document.addEventListener("keydown", handleKeyDown)
+ return () => document.removeEventListener("keydown", handleKeyDown)
+ }, [isAnchor])
+
+ return (
+ <div className="flex size-full items-center gap-x-3 px-4">
+ <Switch
+ ref={switchRef}
+ dir="ltr"
+ size="small"
+ className="shrink-0"
+ checked={localValue?.checked ?? false}
+ disabled={localValue?.disabledToggle}
+ onCheckedChange={handleCheckedChange}
+ />
+ <Text size="small" className="text-ui-fg-subtle">
+ {localValue?.checked ? t("general.enabled", "Enabled") : t("inventory.stock.notEnabled", "Not enabled")}
+ </Text>
+ </div>
+ )
+}
diff --git a/packages/vendor/src/components/data-grid/components/data-grid-toggleable-number-cell.tsx b/packages/vendor/src/components/data-grid/components/data-grid-toggleable-number-cell.tsx
index aac12fa3b..a382eeb54 100644
--- a/packages/vendor/src/components/data-grid/components/data-grid-toggleable-number-cell.tsx
+++ b/packages/vendor/src/components/data-grid/components/data-grid-toggleable-number-cell.tsx
@@ -11,12 +11,14 @@ import { DataGridCellContainer } from "./data-grid-cell-container"
export const DataGridTogglableNumberCell = <TData, TValue = any>({
context,
disabledToggleTooltip,
+ hideInput,
...rest
}: DataGridCellProps<TData, TValue> & {
min?: number
max?: number
placeholder?: string
disabledToggleTooltip?: string
+ hideInput?: boolean
}) => {
const { field, control, renderProps } = useDataGridCell({
context,
@@ -43,7 +45,7 @@ export const DataGridTogglableNumberCell = <TData, TValue = any>({
/>
}
>
- <Inner field={field} inputProps={input} {...rest} />
+ <Inner field={field} inputProps={input} hideInput={hideInput} {...rest} />
</DataGridCellContainer>
)
}}
@@ -75,11 +77,7 @@ const OuterComponent = ({
const handleCheckedChange = (update: boolean) => {
const newValue = { ...localValue, checked: update }
- if (!update && !newValue.disabledToggle) {
- newValue.quantity = ""
- }
-
- if (update && newValue.quantity === "") {
+ if (update && (newValue.quantity === "" || newValue.quantity === null || newValue.quantity === undefined)) {
newValue.quantity = 0
}
@@ -123,6 +121,7 @@ const Inner = ({
field,
inputProps,
placeholder,
+ hideInput,
...props
}: {
field: ControllerRenderProps<any, string>
@@ -130,6 +129,7 @@ const Inner = ({
min?: number
max?: number
placeholder?: string
+ hideInput?: boolean
}) => {
const { ref, value, onChange: _, onBlur, ...fieldProps } = field
const {
@@ -179,6 +179,48 @@ const Inner = ({
onChange(localValue, value)
}
+ if (hideInput) {
+ return (
+ <div className="flex size-full items-center gap-x-2 pl-8">
+ <input
+ ref={combinedRefs}
+ className="sr-only"
+ onFocus={onFocus}
+ onBlur={() => {
+ onBlur()
+ onInputBlur()
+ }}
+ tabIndex={-1}
+ readOnly
+ />
+ <span className="txt-compact-small text-ui-fg-subtle">
+ {localValue?.checked ? "Enabled" : "Not enabled"}
+ </span>
+ </div>
+ )
+ }
+
+ if (!localValue?.checked) {
+ return (
+ <div className="flex size-full items-center gap-x-2 pl-8">
+ <input
+ ref={combinedRefs}
+ className="sr-only"
+ onFocus={onFocus}
+ onBlur={() => {
+ onBlur()
+ onInputBlur()
+ }}
+ tabIndex={-1}
+ readOnly
+ />
+ <span className="txt-compact-small text-ui-fg-subtle">
+ Not enabled
+ </span>
+ </div>
+ )
+ }
+
return (
<div className="flex size-full items-center gap-x-2">
<CurrencyInput
@@ -199,7 +241,6 @@ const Inner = ({
decimalsLimit={0}
autoComplete="off"
tabIndex={-1}
- placeholder={!localValue.checked ? placeholder : undefined}
/>
</div>
)
diff --git a/packages/vendor/src/components/data-grid/components/index.ts b/packages/vendor/src/components/data-grid/components/index.ts
index 17aa80e6a..2768e065a 100644
--- a/packages/vendor/src/components/data-grid/components/index.ts
+++ b/packages/vendor/src/components/data-grid/components/index.ts
@@ -1,4 +1,8 @@
export { DataGridBooleanCell } from "./data-grid-boolean-cell"
+export { DataGridBooleanWithTextCell } from "./data-grid-boolean-with-text-cell"
+export { DataGridMediaCell } from "./data-grid-media-cell"
+export type { MediaData } from "./data-grid-media-cell"
+export { DataGridStatusCell } from "./data-grid-status-cell"
export { DataGridCurrencyCell } from "./data-grid-currency-cell"
export { DataGridMultilineCell } from "./data-grid-multiline-cell"
export { DataGridNumberCell } from "./data-grid-number-cell"
diff --git a/packages/vendor/src/components/data-grid/helpers/create-data-grid-location-stock-columns.tsx b/packages/vendor/src/components/data-grid/helpers/create-data-grid-location-stock-columns.tsx
new file mode 100644
index 000000000..83f04b7b7
--- /dev/null
+++ b/packages/vendor/src/components/data-grid/helpers/create-data-grid-location-stock-columns.tsx
@@ -0,0 +1,72 @@
+import { HttpTypes } from "@medusajs/types"
+import { ColumnDef } from "@tanstack/react-table"
+import { TFunction } from "i18next"
+import { FieldPath, FieldValues } from "react-hook-form"
+import { DataGridReadonlyCell } from "../components/data-grid-readonly-cell"
+import { DataGridTogglableNumberCell } from "../components/data-grid-toggleable-number-cell"
+import { FieldContext } from "../types"
+import { createDataGridHelper } from "./create-data-grid-column-helper"
+
+type CreateDataGridLocationStockColumnsProps<
+ TData,
+ TFieldValues extends FieldValues,
+> = {
+ stockLocations: HttpTypes.AdminStockLocation[]
+ isReadyOnly?: (context: FieldContext<TData>) => boolean
+ getFieldName: (
+ context: FieldContext<TData>,
+ stockLocationIndex: number
+ ) => FieldPath<TFieldValues> | null
+ t: TFunction
+}
+
+export const createDataGridLocationStockColumns = <
+ TData,
+ TFieldValues extends FieldValues,
+>({
+ stockLocations,
+ isReadyOnly,
+ getFieldName,
+ t,
+}: CreateDataGridLocationStockColumnsProps<TData, TFieldValues>): ColumnDef<
+ TData,
+ unknown
+>[] => {
+ const columnHelper = createDataGridHelper<TData, TFieldValues>()
+
+ return [
+ ...(stockLocations.map((stockLocation, index) => {
+ return columnHelper.column({
+ id: `stock_locations.${stockLocation.id}`,
+ name: stockLocation.name,
+ field: (context) => {
+ const isReadyOnlyValue = isReadyOnly?.(context)
+ if (isReadyOnlyValue) {
+ return null
+ }
+ return getFieldName(context, index)
+ },
+ type: "togglable-number",
+ header: () => (
+ <div className="flex w-full items-center justify-between gap-3">
+ <span className="truncate" title={stockLocation.name}>
+ {stockLocation.name}
+ </span>
+ </div>
+ ),
+ cell: (context) => {
+ if (isReadyOnly?.(context)) {
+ return <DataGridReadonlyCell context={context} />
+ }
+
+ return (
+ <DataGridTogglableNumberCell
+ context={context}
+ disabledToggleTooltip={t("inventory.stock.disabledToggleTooltip")}
+ />
+ )
+ },
+ })
+ }) ?? []),
+ ]
+}
diff --git a/packages/vendor/src/components/data-grid/helpers/index.ts b/packages/vendor/src/components/data-grid/helpers/index.ts
index 5a4906046..785de5045 100644
--- a/packages/vendor/src/components/data-grid/helpers/index.ts
+++ b/packages/vendor/src/components/data-grid/helpers/index.ts
@@ -1,2 +1,3 @@
export * from "./create-data-grid-column-helper"
+export * from "./create-data-grid-location-stock-columns"
export * from "./create-data-grid-price-columns"
diff --git a/packages/vendor/src/components/inputs/combobox/combobox.tsx b/packages/vendor/src/components/inputs/combobox/combobox.tsx
index a88754432..09915f722 100644
--- a/packages/vendor/src/components/inputs/combobox/combobox.tsx
+++ b/packages/vendor/src/components/inputs/combobox/combobox.tsx
@@ -56,6 +56,7 @@ interface ComboboxProps<T extends Value = Value>
fetchNextPage?: () => void
isFetchingNextPage?: boolean
onCreateOption?: (value: string) => void
+ hideCreateOption?: boolean
noResultsPlaceholder?: ReactNode
allowClear?: boolean
forceHideInput?: boolean // always hide input -> used for singe value select that don't have query/filter
@@ -73,6 +74,7 @@ const ComboboxImpl = <T extends Value = string>(
fetchNextPage,
isFetchingNextPage,
onCreateOption,
+ hideCreateOption,
noResultsPlaceholder,
allowClear,
forceHideInput,
@@ -193,6 +195,15 @@ const ComboboxImpl = <T extends Value = string>(
const handleOpenChange = (open: boolean) => {
if (!open) {
+ // Auto-create on close when hideCreateOption is set and there's unmatched text
+ if (hideCreateOption && onCreateOption && uncontrolledSearchValue.trim()) {
+ const matchesExisting = options.some(
+ (o) => o.label?.toLowerCase() === uncontrolledSearchValue.trim().toLowerCase()
+ )
+ if (!matchesExisting) {
+ onCreateOption(uncontrolledSearchValue.trim())
+ }
+ }
setUncontrolledSearchValue("")
}
@@ -205,7 +216,7 @@ const ComboboxImpl = <T extends Value = string>(
const showSelected = showTag && !searchValue && !open
const hideInput = forceHideInput || (!isArrayValue && hasValue && !open)
- const selectedLabel = options.find((o) => o.value === selectedValues)?.label
+ const selectedLabel = options.find((o) => o.value === selectedValues)?.label || (typeof selectedValues === "string" ? selectedValues : undefined)
const hidePlaceholder = showSelected || open
@@ -370,10 +381,10 @@ const ComboboxImpl = <T extends Value = string>(
}
)}
>
- <PrimitiveComboboxItemCheck className="flex !size-5 items-center justify-center">
+ <PrimitiveComboboxItemCheck className="flex !size-5 shrink-0 items-center justify-center">
{isArrayValue ? <CheckMini /> : <EllipseMiniSolid />}
</PrimitiveComboboxItemCheck>
- <PrimitiveComboboxItemValue className="txt-compact-small">
+ <PrimitiveComboboxItemValue className="txt-compact-small truncate">
{label}
</PrimitiveComboboxItemValue>
</PrimitiveComboboxItem>
@@ -398,7 +409,7 @@ const ComboboxImpl = <T extends Value = string>(
</Text>
</div>
))}
- {!results.length && onCreateOption && (
+ {!results.length && onCreateOption && !hideCreateOption && (
<Fragment>
<PrimitiveSeparator className="bg-ui-border-base -mx-1" />
<PrimitiveComboboxItem
diff --git a/packages/vendor/src/components/inputs/multi-select/index.ts b/packages/vendor/src/components/inputs/multi-select/index.ts
new file mode 100644
index 000000000..5a9c29bf5
--- /dev/null
+++ b/packages/vendor/src/components/inputs/multi-select/index.ts
@@ -0,0 +1,2 @@
+export { default as MultiSelect } from "./multi-select"
+export type { MultiSelectProps, MultiSelectOption } from "./multi-select"
diff --git a/packages/vendor/src/components/inputs/multi-select/multi-select.tsx b/packages/vendor/src/components/inputs/multi-select/multi-select.tsx
new file mode 100644
index 000000000..3734175b1
--- /dev/null
+++ b/packages/vendor/src/components/inputs/multi-select/multi-select.tsx
@@ -0,0 +1,318 @@
+import React, { forwardRef, useEffect, useMemo, useRef, useState } from "react"
+
+import { CheckMini, TrianglesMini, XMarkMini } from "@medusajs/icons"
+import { Badge, Input, Text } from "@medusajs/ui"
+import { useTranslation } from "react-i18next"
+
+type MultiSelectOption = {
+ value: string
+ label: string
+}
+
+type MultiSelectProps = {
+ options: MultiSelectOption[]
+ value: string[] | undefined
+ onChange: (value: string[]) => void
+ onBlur?: () => void
+ name?: string
+ placeholder?: string
+ "aria-invalid"?: boolean
+ disabled?: boolean
+ className?: string
+ showSearch?: boolean
+}
+
+const MultiSelect = forwardRef<HTMLDivElement, MultiSelectProps>(
+ (
+ {
+ options,
+ value,
+ onChange,
+ onBlur,
+ name,
+ placeholder,
+ "aria-invalid": ariaInvalid = false,
+ disabled = false,
+ className = "",
+ showSearch = true,
+ },
+ ref
+ ) => {
+ const { t } = useTranslation()
+ const [isOpen, setIsOpen] = useState(false)
+ const [searchValue, setSearchValue] = useState("")
+ const dropdownRef = useRef<HTMLDivElement>(null)
+ const triggerRef = useRef<HTMLDivElement>(null)
+ const badgesContainerRef = useRef<HTMLDivElement>(null)
+ const [visibleBadgesCount, setVisibleBadgesCount] = useState(0)
+
+ useEffect(() => {
+ const handleClickOutside = (event: MouseEvent) => {
+ if (
+ dropdownRef.current &&
+ !dropdownRef.current.contains(event.target as Node) &&
+ triggerRef.current &&
+ !triggerRef.current.contains(event.target as Node)
+ ) {
+ setIsOpen(false)
+ }
+ }
+ document.addEventListener("mousedown", handleClickOutside)
+ return () => {
+ document.removeEventListener("mousedown", handleClickOutside)
+ }
+ }, [])
+
+ const calculateVisibleBadges = () => {
+ if (!value || value.length === 0 || !badgesContainerRef.current) {
+ setVisibleBadgesCount(0)
+ return
+ }
+
+ const container = badgesContainerRef.current
+ const containerWidth = container.offsetWidth
+ const padding = 24
+ const gap = 8
+ const availableWidth = containerWidth - padding
+
+ const estimateBadgeWidth = (label: string) => {
+ const baseWidth = 32
+ const charWidth = 8
+ return baseWidth + label.length * charWidth
+ }
+
+ let totalWidth = 0
+ let count = 0
+
+ for (let i = 0; i < value.length; i++) {
+ const option = options.find((opt) => opt.value === value[i])
+ const optionLabel = option?.label || "Unknown"
+ const badgeWidth =
+ estimateBadgeWidth(optionLabel) > 200
+ ? 235
+ : estimateBadgeWidth(optionLabel)
+
+ if (
+ totalWidth + badgeWidth + (count > 0 ? gap : 0) <=
+ availableWidth
+ ) {
+ totalWidth += badgeWidth + (count > 0 ? gap : 0)
+ count++
+ } else {
+ break
+ }
+ }
+
+ setVisibleBadgesCount(count)
+ }
+
+ useEffect(() => {
+ calculateVisibleBadges()
+ }, [value, options])
+
+ useEffect(() => {
+ const resizeObserver = new ResizeObserver(() => {
+ calculateVisibleBadges()
+ })
+
+ if (badgesContainerRef.current) {
+ resizeObserver.observe(badgesContainerRef.current)
+ }
+
+ return () => {
+ resizeObserver.disconnect()
+ }
+ }, [value, options])
+
+ const handleToggle = () => {
+ if (disabled) return
+ setIsOpen((prev) => !prev)
+ if (!isOpen && showSearch) {
+ setSearchValue("")
+ }
+ }
+
+ const handleItemClick = (optionValue: string) => {
+ const currentValue = value || []
+ const isSelected = currentValue.includes(optionValue)
+ if (isSelected) {
+ onChange(currentValue.filter((val) => val !== optionValue))
+ } else {
+ onChange([...currentValue, optionValue])
+ }
+ }
+
+ const handleRemoveBadge = (
+ optionValue: string,
+ e: React.MouseEvent
+ ) => {
+ e.stopPropagation()
+ const currentValue = value || []
+ onChange(currentValue.filter((val) => val !== optionValue))
+ }
+
+ const filteredOptions = useMemo(() => {
+ if (!showSearch || !searchValue.trim()) {
+ return options
+ }
+ return options.filter((option) =>
+ option.label.toLowerCase().includes(searchValue.toLowerCase())
+ )
+ }, [options, searchValue, showSearch])
+
+ const handleSearchChange = (
+ e: React.ChangeEvent<HTMLInputElement>
+ ) => {
+ setSearchValue(e.target.value)
+ }
+
+ const handleClearSearch = () => {
+ setSearchValue("")
+ }
+
+ return (
+ <div ref={ref} className={`relative ${className}`}>
+ <div
+ ref={triggerRef}
+ className={`relative flex h-8 w-full cursor-pointer items-center justify-between overflow-hidden rounded-md border bg-ui-bg-field text-ui-fg-base shadow-sm transition-colors duration-150 ease-in-out focus-within:ring-1 hover:bg-ui-bg-field-hover ${
+ disabled
+ ? "cursor-not-allowed bg-ui-bg-disabled opacity-50"
+ : ariaInvalid
+ ? "!shadow-borders-error"
+ : "focus-within:ring-ui-ring-interactive border-ui-border-base focus-within:border-ui-border-interactive"
+ }`}
+ onClick={handleToggle}
+ onBlur={onBlur}
+ tabIndex={0}
+ role="combobox"
+ aria-expanded={isOpen}
+ aria-haspopup="listbox"
+ aria-invalid={ariaInvalid}
+ aria-label={name}
+ >
+ <div
+ ref={badgesContainerRef}
+ className="flex min-w-0 flex-1 items-center gap-2 px-3 py-2"
+ >
+ {value && value.length > 0 ? (
+ <>
+ {value
+ .slice(0, visibleBadgesCount)
+ .map((optionValue) => {
+ const option = options.find(
+ (opt) => opt.value === optionValue
+ )
+ return (
+ <button
+ key={optionValue}
+ type="button"
+ onClick={(e) =>
+ handleRemoveBadge(optionValue, e)
+ }
+ className="flex flex-shrink-0 items-center self-center"
+ disabled={disabled}
+ >
+ <Badge
+ size="2xsmall"
+ className="w-fit bg-ui-bg-base p-0"
+ >
+ <span className="max-w-[200px] truncate text-ellipsis border-r border-ui-border-base px-1.5">
+ {option?.label || "Unknown"}
+ </span>
+ <XMarkMini className="mr-0.5 !text-ui-fg-base" />
+ </Badge>
+ </button>
+ )
+ })}
+ {value && value.length > visibleBadgesCount && (
+ <Badge
+ size="small"
+ className="txt-compact-small-plus w-fit flex-shrink-0 border-none bg-transparent px-0 text-ui-fg-subtle"
+ >
+ +{value.length - visibleBadgesCount}
+ </Badge>
+ )}
+ </>
+ ) : (
+ <Text className="text-ui-fg-subtle">
+ {placeholder || t("general.selectValues")}
+ </Text>
+ )}
+ </div>
+ <div className="flex h-full items-center justify-center">
+ <span className="flex h-full w-8 items-center justify-center">
+ <TrianglesMini className="text-ui-fg-muted" />
+ </span>
+ </div>
+ </div>
+
+ {isOpen && !disabled && (
+ <div
+ ref={dropdownRef}
+ className="absolute z-10 mt-1 max-h-60 w-full overflow-hidden rounded-md border border-ui-border-base bg-ui-bg-base shadow-lg"
+ >
+ {showSearch && (
+ <div className="sticky top-0 z-10 border-b border-ui-border-base bg-ui-bg-base p-2">
+ <div className="relative">
+ <Input
+ value={searchValue}
+ onChange={handleSearchChange}
+ placeholder={t("general.searchOptions")}
+ className="w-full bg-transparent pr-8 shadow-none focus:!shadow-none"
+ autoFocus
+ />
+ {searchValue && (
+ <button
+ type="button"
+ onClick={handleClearSearch}
+ className="absolute right-2 top-1/2 -translate-y-1/2 rounded-md p-1 transition-colors hover:bg-ui-bg-base-hover"
+ aria-label="Clear search"
+ >
+ <XMarkMini className="h-4 w-4 text-ui-fg-muted" />
+ </button>
+ )}
+ </div>
+ </div>
+ )}
+
+ <div
+ className={`${showSearch ? "max-h-48" : "max-h-60"} overflow-y-auto py-1`}
+ >
+ {filteredOptions.length === 0 ? (
+ <div className="txt-compact-small-plus p-3 text-ui-fg-subtle">
+ {showSearch && searchValue.trim()
+ ? t("general.noOptionsFound")
+ : t("general.noOptionsAvailable")}
+ </div>
+ ) : (
+ filteredOptions.map((option) => {
+ const currentValue = value || []
+ const isSelected = currentValue.includes(option.value)
+ return (
+ <div
+ key={option.value}
+ className="flex cursor-pointer items-center px-1 py-1 hover:bg-ui-bg-base-hover"
+ onClick={() => handleItemClick(option.value)}
+ >
+ <div className="flex flex-1 items-center gap-x-2 rounded-md px-2">
+ <div className="flex size-5 shrink-0 items-center justify-center">
+ {isSelected && <CheckMini />}
+ </div>
+ <Text className="truncate">{option.label}</Text>
+ </div>
+ </div>
+ )
+ })
+ )}
+ </div>
+ </div>
+ )}
+ </div>
+ )
+ }
+)
+
+MultiSelect.displayName = "MultiSelect"
+
+export default MultiSelect
+export type { MultiSelectProps, MultiSelectOption }
diff --git a/packages/vendor/src/components/inputs/numeric-input/index.ts b/packages/vendor/src/components/inputs/numeric-input/index.ts
new file mode 100644
index 000000000..61bcdeaa9
--- /dev/null
+++ b/packages/vendor/src/components/inputs/numeric-input/index.ts
@@ -0,0 +1,2 @@
+export { NumericInput } from "./numeric-input"
+export type { NumericInputProps } from "./numeric-input"
diff --git a/packages/vendor/src/components/inputs/numeric-input/numeric-input.tsx b/packages/vendor/src/components/inputs/numeric-input/numeric-input.tsx
new file mode 100644
index 000000000..ce112bab6
--- /dev/null
+++ b/packages/vendor/src/components/inputs/numeric-input/numeric-input.tsx
@@ -0,0 +1,254 @@
+import React, { forwardRef, useEffect, useRef, useState } from "react"
+
+import { Minus, Plus } from "@medusajs/icons"
+import { Input } from "@medusajs/ui"
+import { useTranslation } from "react-i18next"
+
+export interface NumericInputProps {
+ value?: number
+ onChange?: (value: number) => void
+ onBlur?: () => void
+ name?: string
+ placeholder?: string
+ min?: number
+ max?: number
+ step?: number
+ disabled?: boolean
+ className?: string
+ hideControls?: boolean
+ "aria-invalid"?: boolean
+}
+
+export const NumericInput = forwardRef<HTMLInputElement, NumericInputProps>(
+ (
+ {
+ value,
+ onChange,
+ onBlur,
+ name,
+ placeholder,
+ min = 0,
+ max = 999999,
+ step = 1,
+ disabled = false,
+ className = "",
+ hideControls = false,
+ "aria-invalid": ariaInvalid = false,
+ },
+ ref
+ ) => {
+ const { t } = useTranslation()
+ const [inputValue, setInputValue] = useState<string>(
+ value?.toString() || ""
+ )
+ const timeoutRef = useRef<NodeJS.Timeout | null>(null)
+ const intervalRef = useRef<NodeJS.Timeout | null>(null)
+ const isMouseDownRef = useRef<boolean>(false)
+ const currentValueRef = useRef<number>(0)
+ const isUserTypingRef = useRef<boolean>(false)
+ const previousValueRef = useRef<number | undefined>(value)
+
+ useEffect(() => {
+ if (value !== undefined && value !== previousValueRef.current) {
+ if (!isUserTypingRef.current) {
+ setInputValue(value.toString())
+ currentValueRef.current = value
+ }
+ previousValueRef.current = value
+ }
+ }, [value])
+
+ useEffect(() => {
+ return () => {
+ if (timeoutRef.current) {
+ clearTimeout(timeoutRef.current)
+ }
+ if (intervalRef.current) {
+ clearInterval(intervalRef.current)
+ }
+ }
+ }, [])
+
+ const handleInputChange = (
+ e: React.ChangeEvent<HTMLInputElement>
+ ) => {
+ const newValue = e.target.value
+ setInputValue(newValue)
+ isUserTypingRef.current = true
+
+ const numericValue = parseFloat(newValue)
+ if (!isNaN(numericValue) && onChange) {
+ currentValueRef.current = numericValue
+ onChange(numericValue)
+ } else if (newValue === "" && onChange) {
+ currentValueRef.current = 0
+ onChange(undefined as any)
+ } else if (newValue === "0" && onChange) {
+ currentValueRef.current = 0
+ onChange(0)
+ }
+ }
+
+ const handleIncrement = () => {
+ if (disabled) return
+ const currentValue = parseFloat(inputValue) || 0
+ const newValue = Math.min(currentValue + step, max)
+ currentValueRef.current = newValue
+ setInputValue(newValue.toString())
+ if (onChange) {
+ onChange(newValue)
+ }
+ }
+
+ const handleDecrement = () => {
+ if (disabled) return
+ const currentValue = parseFloat(inputValue) || 0
+ const newValue = Math.max(currentValue - step, min)
+ currentValueRef.current = newValue
+ setInputValue(newValue.toString())
+ if (onChange) {
+ onChange(newValue)
+ }
+ }
+
+ const handleKeyDown = (
+ e: React.KeyboardEvent<HTMLInputElement>
+ ) => {
+ if (e.key === "ArrowUp") {
+ e.preventDefault()
+ handleIncrement()
+ } else if (e.key === "ArrowDown") {
+ e.preventDefault()
+ handleDecrement()
+ }
+ }
+
+ const handleBlur = () => {
+ const numericValue = parseFloat(inputValue)
+ if (!isNaN(numericValue)) {
+ const clampedValue = Math.max(Math.min(numericValue, max), min)
+ if (clampedValue !== numericValue) {
+ setInputValue(clampedValue.toString())
+ if (onChange) {
+ onChange(clampedValue)
+ }
+ }
+ }
+ setTimeout(() => {
+ isUserTypingRef.current = false
+ }, 100)
+ if (onBlur) {
+ onBlur()
+ }
+ }
+
+ const clearRepeatInterval = () => {
+ if (timeoutRef.current) {
+ clearTimeout(timeoutRef.current)
+ timeoutRef.current = null
+ }
+ if (intervalRef.current) {
+ clearInterval(intervalRef.current)
+ intervalRef.current = null
+ }
+ isMouseDownRef.current = false
+ }
+
+ const handleMouseDown = (action: "increment" | "decrement") => {
+ if (disabled) return
+ isMouseDownRef.current = true
+ if (action === "increment") {
+ handleIncrement()
+ } else {
+ handleDecrement()
+ }
+ timeoutRef.current = setTimeout(() => {
+ if (isMouseDownRef.current) {
+ intervalRef.current = setInterval(() => {
+ if (isMouseDownRef.current) {
+ if (action === "increment") {
+ handleIncrement()
+ } else {
+ handleDecrement()
+ }
+ } else {
+ clearRepeatInterval()
+ }
+ }, 50)
+ }
+ }, 500)
+ }
+
+ const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
+ e.preventDefault()
+ }
+
+ const handleMouseUp = () => {
+ clearRepeatInterval()
+ }
+
+ const handleMouseLeave = () => {
+ clearRepeatInterval()
+ }
+
+ return (
+ <div className={`relative w-full ${className}`}>
+ <Input
+ ref={ref}
+ type="number"
+ value={inputValue}
+ onChange={handleInputChange}
+ onBlur={handleBlur}
+ onKeyDown={handleKeyDown}
+ name={name}
+ placeholder={
+ placeholder ||
+ t(
+ "products.fields.attributes.enterValuePlaceholder"
+ )
+ }
+ min={min}
+ max={max}
+ step={step}
+ disabled={disabled}
+ aria-invalid={ariaInvalid}
+ className={`w-full [-moz-appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none ${hideControls ? "" : "pr-16"}`}
+ />
+ {!hideControls && (
+ <div className="absolute bottom-0 right-0 top-0 flex flex-row border-l border-ui-border-base">
+ <button
+ type="button"
+ onClick={handleClick}
+ onMouseDown={() => handleMouseDown("decrement")}
+ onMouseUp={handleMouseUp}
+ onMouseLeave={handleMouseLeave}
+ disabled={
+ disabled || (parseFloat(inputValue) || 0) <= min
+ }
+ className="bg-ui-field flex h-full w-8 items-center justify-center border-r border-ui-border-base transition-colors hover:bg-ui-bg-field-hover disabled:cursor-not-allowed disabled:opacity-50"
+ aria-label={t("general.decrement")}
+ >
+ <Minus className="h-3 w-3 text-ui-fg-muted" />
+ </button>
+ <button
+ type="button"
+ onClick={handleClick}
+ onMouseDown={() => handleMouseDown("increment")}
+ onMouseUp={handleMouseUp}
+ onMouseLeave={handleMouseLeave}
+ disabled={
+ disabled || (parseFloat(inputValue) || 0) >= max
+ }
+ className="bg-ui-field flex h-full w-8 items-center justify-center rounded-r-md transition-colors hover:bg-ui-bg-field-hover disabled:cursor-not-allowed disabled:opacity-50"
+ aria-label={t("general.increment")}
+ >
+ <Plus className="h-3 w-3 text-ui-fg-muted" />
+ </button>
+ </div>
+ )}
+ </div>
+ )
+ }
+)
+
+NumericInput.displayName = "NumericInput"
diff --git a/packages/vendor/src/components/tabbed-form/index.ts b/packages/vendor/src/components/tabbed-form/index.ts
index 6e9ac79c3..3d5c26201 100644
--- a/packages/vendor/src/components/tabbed-form/index.ts
+++ b/packages/vendor/src/components/tabbed-form/index.ts
@@ -1,3 +1,3 @@
-export { TabbedForm, useTabbedForm } from "./tabbed-form"
+export { TabbedForm, TabbedFormContext, useTabbedForm } from "./tabbed-form"
export type { TabDefinition } from "./types"
export { useTabManagement } from "./use-tab-management"
diff --git a/packages/vendor/src/components/tabbed-form/tabbed-form.tsx b/packages/vendor/src/components/tabbed-form/tabbed-form.tsx
index 59be84589..30db0f846 100644
--- a/packages/vendor/src/components/tabbed-form/tabbed-form.tsx
+++ b/packages/vendor/src/components/tabbed-form/tabbed-form.tsx
@@ -16,7 +16,7 @@ import { KeyboundForm } from "@components/utilities/keybound-form"
import { TabDefinition } from "./types"
import { useTabManagement } from "./use-tab-management"
-const TabbedFormContext = createContext<UseFormReturn<any> | null>(null)
+export const TabbedFormContext = createContext<UseFormReturn<any> | null>(null)
export const useTabbedForm = <T extends FieldValues = FieldValues>() => {
const form = useContext(TabbedFormContext)
diff --git a/packages/vendor/src/get-route-map.tsx b/packages/vendor/src/get-route-map.tsx
index 5fd30bbf3..c7f1a6a7a 100644
--- a/packages/vendor/src/get-route-map.tsx
+++ b/packages/vendor/src/get-route-map.tsx
@@ -90,6 +90,11 @@ export function getRouteMap({
};
},
},
+ {
+ path: "bulk-edit",
+ lazy: () =>
+ import("./pages/products/bulk-edit"),
+ },
],
},
{
@@ -143,9 +148,14 @@ export function getRouteMap({
import("./pages/products/[id]/attributes"),
},
{
- path: "additional-attributes",
+ path: "attributes/add",
lazy: () =>
- import("./pages/products/[id]/additional-attributes"),
+ import("./pages/products/[id]/attributes/add"),
+ },
+ {
+ path: "informational-attributes/:attribute_id/edit",
+ lazy: () =>
+ import("./pages/products/[id]/informational-attributes/[attribute_id]/edit"),
},
{
path: "metadata",
@@ -166,6 +176,13 @@ export function getRouteMap({
lazy: () =>
import("./pages/products/[id]/options/create"),
},
+ {
+ path: "options/:option_id/edit",
+ lazy: () =>
+ import(
+ "./pages/products/[id]/options/[optionId]/edit"
+ ),
+ },
{
path: "variants/create",
lazy: () =>
@@ -177,6 +194,11 @@ export function getRouteMap({
path: "stock",
lazy: () => import("./pages/products/[id]/stock"),
},
+ {
+ path: "edit-stocks-and-prices",
+ lazy: () =>
+ import("./pages/products/[id]/edit-stocks-and-prices"),
+ },
],
},
],
diff --git a/packages/vendor/src/hooks/api/attributes.tsx b/packages/vendor/src/hooks/api/attributes.tsx
new file mode 100644
index 000000000..3c43e7f36
--- /dev/null
+++ b/packages/vendor/src/hooks/api/attributes.tsx
@@ -0,0 +1,101 @@
+import {
+ QueryKey,
+ UseQueryOptions,
+ useQuery,
+} from "@tanstack/react-query"
+import { fetchQuery } from "../../lib/client"
+import { queryKeysFactory } from "../../lib/query-key-factory"
+
+const ATTRIBUTES_QUERY_KEY = "attributes" as const
+export const attributesQueryKeys = queryKeysFactory(ATTRIBUTES_QUERY_KEY)
+
+type Attribute = {
+ id: string
+ name: string
+ handle: string
+ ui_component: string
+ is_required: boolean
+ description?: string
+ values?: Array<{
+ id: string
+ value: string
+ metadata?: Record<string, any>
+ }>
+ possible_values?: Array<{
+ id: string
+ value: string
+ rank: number
+ }>
+ product_categories?: Array<{
+ id: string
+ name: string
+ }>
+ metadata?: Record<string, any>
+}
+
+export const useAttributes = (
+ query?: {
+ offset?: number
+ limit?: number
+ fields?: string
+ id?: string
+ name?: string
+ handle?: string
+ ui_component?: string
+ },
+ options?: Omit<
+ UseQueryOptions<
+ {
+ attributes: Attribute[]
+ count: number
+ offset: number
+ limit: number
+ },
+ Error,
+ {
+ attributes: Attribute[]
+ count: number
+ offset: number
+ limit: number
+ },
+ QueryKey
+ >,
+ "queryFn" | "queryKey"
+ >
+) => {
+ const { data, ...rest } = useQuery({
+ queryFn: () =>
+ fetchQuery("/vendor/attributes", {
+ method: "GET",
+ query: query as Record<string, string | number>,
+ }),
+ queryKey: attributesQueryKeys.list(query),
+ ...options,
+ })
+
+ return { ...data, ...rest }
+}
+
+export const useAttribute = (
+ id: string,
+ options?: Omit<
+ UseQueryOptions<
+ { attribute: Attribute },
+ Error,
+ { attribute: Attribute },
+ QueryKey
+ >,
+ "queryFn" | "queryKey"
+ >
+) => {
+ const { data, ...rest } = useQuery({
+ queryFn: () =>
+ fetchQuery(`/vendor/attributes/${id}`, {
+ method: "GET",
+ }),
+ queryKey: attributesQueryKeys.detail(id),
+ ...options,
+ })
+
+ return { ...data, ...rest }
+}
diff --git a/packages/vendor/src/hooks/api/inventory.tsx b/packages/vendor/src/hooks/api/inventory.tsx
index 4274837e7..24f3bcf94 100644
--- a/packages/vendor/src/hooks/api/inventory.tsx
+++ b/packages/vendor/src/hooks/api/inventory.tsx
@@ -7,6 +7,7 @@ import {
UseMutationOptions,
UseQueryOptions,
useMutation,
+ useQueries,
useQuery,
} from "@tanstack/react-query";
@@ -228,6 +229,9 @@ export const useUpdateInventoryLevel = (
queryClient.invalidateQueries({
queryKey: inventoryItemLevelsQueryKeys.detail(inventoryItemId),
});
+ queryClient.invalidateQueries({
+ queryKey: inventoryItemLevelsQueryKeys.lists(),
+ });
queryClient.invalidateQueries({
queryKey: variantsQueryKeys.details(),
});
@@ -277,6 +281,84 @@ export const useBatchInventoryItemLocationLevels = (
});
};
+export type InventoryItemLocationLevel = {
+ id: string
+ location_id: string
+ stocked_quantity: number
+ reserved_quantity: number
+ incoming_quantity: number
+ available_quantity: number
+}
+
+export type InventoryItemWithLevels = {
+ inventory_item_id: string
+ location_levels: InventoryItemLocationLevel[]
+}
+
+type UseMultipleInventoryItemLevelsReturn = {
+ inventoryItemsWithLevels: InventoryItemWithLevels[]
+ allLocationLevels: InventoryItemLocationLevel[]
+ isPending: boolean
+ isRefetching: boolean
+ isError: boolean
+ error: Error | null | undefined
+ refetch: () => Promise<void>
+}
+
+export const useMultipleInventoryItemLevels = (
+ inventoryItemIds: string[],
+ query?: Record<string, any>
+): UseMultipleInventoryItemLevelsReturn => {
+ const queries = useQueries({
+ queries: inventoryItemIds.map((id) => ({
+ queryKey: inventoryItemLevelsQueryKeys.detail(id, query),
+ queryFn: () =>
+ fetchQuery(`/vendor/inventory-items/${id}/location-levels`, {
+ method: "GET",
+ query: { fields: "*stock_locations", ...query } as {
+ [key: string]: string | number
+ },
+ }),
+ enabled: Boolean(id),
+ })),
+ })
+
+ const isPending = queries.some((q) => q.isPending)
+ const isRefetching = queries.some((q) => q.isRefetching)
+ const isError = queries.some((q) => q.isError)
+ const error = queries.find((q) => q.error)?.error
+
+ const allLocationLevels: InventoryItemLocationLevel[] = queries
+ .filter((q) => q.data?.inventory_levels)
+ .flatMap((q) => q.data?.inventory_levels || [])
+
+ const inventoryItemsWithLevels: InventoryItemWithLevels[] = queries
+ .map((query, index) => {
+ if (query.data?.inventory_levels) {
+ return {
+ inventory_item_id: inventoryItemIds[index],
+ location_levels: query.data.inventory_levels as InventoryItemLocationLevel[],
+ }
+ }
+ return null
+ })
+ .filter((item): item is InventoryItemWithLevels => item !== null)
+
+ const refetch = async () => {
+ await Promise.all(queries.map((q) => q.refetch()))
+ }
+
+ return {
+ inventoryItemsWithLevels,
+ allLocationLevels,
+ isPending,
+ isRefetching,
+ isError,
+ error,
+ refetch,
+ }
+}
+
export const useBatchInventoryItemsLocationLevels = (
options?: UseMutationOptions<
InferClientOutput<
@@ -295,6 +377,9 @@ export const useBatchInventoryItemsLocationLevels = (
queryClient.invalidateQueries({
queryKey: inventoryItemsQueryKeys.all,
});
+ queryClient.invalidateQueries({
+ queryKey: inventoryItemLevelsQueryKeys.all,
+ });
queryClient.invalidateQueries({
queryKey: variantsQueryKeys.lists(),
});
diff --git a/packages/vendor/src/hooks/api/products.tsx b/packages/vendor/src/hooks/api/products.tsx
index 9f83738bf..9207b3195 100644
--- a/packages/vendor/src/hooks/api/products.tsx
+++ b/packages/vendor/src/hooks/api/products.tsx
@@ -236,6 +236,63 @@ export const useUpdateProductVariant = (
});
};
+type UpdateVariantMediaPayload = {
+ add?: string[];
+ remove?: string[];
+};
+
+export const useUpdateVariantMedia = (
+ productId: string,
+ variantId: string,
+ options?: any
+) => {
+ return useMutation({
+ mutationFn: (payload: UpdateVariantMediaPayload) =>
+ fetchQuery(`/vendor/products/${productId}/variants/${variantId}/media`, {
+ method: "POST",
+ body: payload,
+ }),
+ onSuccess: (data: any, variables: any, context: any) => {
+ queryClient.invalidateQueries({
+ queryKey: productsQueryKeys.detail(productId),
+ });
+ queryClient.invalidateQueries({
+ queryKey: variantsQueryKeys.detail(variantId),
+ });
+ options?.onSuccess?.(data, variables, context);
+ },
+ ...options,
+ });
+};
+
+export const useUpdateProductVariantsBatch = (
+ productId: string,
+ options?: any
+) => {
+ return useMutation({
+ mutationFn: async (variants: Array<{ id: string; [key: string]: any }>) => {
+ const promises = variants.map((variant) => {
+ const { id, ...updateData } = variant
+ return fetchQuery(`/vendor/products/${productId}/variants/${id}`, {
+ method: "POST",
+ body: updateData,
+ })
+ })
+ return Promise.all(promises)
+ },
+ onSuccess: (data: any, variables: any, context: any) => {
+ queryClient.invalidateQueries({
+ queryKey: productsQueryKeys.detail(productId),
+ })
+ queryClient.invalidateQueries({
+ queryKey: variantsQueryKeys.lists(),
+ })
+ options?.onSuccess?.(data, variables, context)
+ },
+ ...options,
+ })
+}
+
export const useDeleteVariant = (
productId: string,
variantId: string,
@@ -442,19 +499,209 @@ const productAttributesQueryKey = (id: string) => [
id,
]
-export const useProductAttributes = (id: string) => {
+export const useProductAttributes = (_id: string) => {
const { data, ...rest } = useQuery<ProductAttributesResponse>({
queryFn: () =>
- fetchQuery(`/vendor/products/${id}/applicable-attributes`, {
- method: "GET",
- query: { fields: "+is_required" },
- }),
- queryKey: productAttributesQueryKey(id),
+ sdk.vendor.attributes.query({
+ fields: "id,name,handle,description,ui_component,is_required,possible_values.*,product_categories.*",
+ limit: 100,
+ } as any),
+ queryKey: productAttributesQueryKey(_id),
})
return { ...data, ...rest }
}
+/* Attribute Management Hooks */
+
+type AddProductAttributePayload = {
+ name?: string
+ values: string[]
+ use_for_variations: boolean
+ ui_component?: string
+ attribute_id?: string
+}
+
+export const useAddProductAttribute = (
+ productId: string,
+ options?: UseMutationOptions<any, ClientError, AddProductAttributePayload>
+) => {
+ return useMutation({
+ mutationFn: (payload: AddProductAttributePayload) =>
+ fetchQuery(`/vendor/products/${productId}/attributes`, {
+ method: "POST",
+ body: payload,
+ }),
+ onSuccess: (data: any, variables: any, context: any) => {
+ queryClient.invalidateQueries({
+ queryKey: productsQueryKeys.detail(productId),
+ })
+ queryClient.invalidateQueries({
+ queryKey: productAttributesQueryKey(productId),
+ })
+ options?.onSuccess?.(data, variables, context)
+ },
+ ...options,
+ })
+}
+
+type UpdateProductAttributePayload = {
+ values?: string[]
+ use_for_variations?: boolean
+ name?: string
+ ui_component?: string
+}
+
+export const useUpdateProductAttribute = (
+ productId: string,
+ attributeId: string,
+ options?: UseMutationOptions<
+ any,
+ ClientError,
+ UpdateProductAttributePayload
+ >
+) => {
+ return useMutation({
+ mutationFn: (payload: UpdateProductAttributePayload) =>
+ fetchQuery(
+ `/vendor/products/${productId}/attributes/${attributeId}`,
+ {
+ method: "POST",
+ body: payload,
+ }
+ ),
+ onSuccess: (data: any, variables: any, context: any) => {
+ queryClient.invalidateQueries({
+ queryKey: productsQueryKeys.detail(productId),
+ })
+ queryClient.invalidateQueries({
+ queryKey: productAttributesQueryKey(productId),
+ })
+ options?.onSuccess?.(data, variables, context)
+ },
+ ...options,
+ })
+}
+
+type RemoveProductAttributeResponse = {
+ product_id: string
+ attribute_id: string
+ deleted: boolean
+ removed_values_count: number
+}
+
+export const useRemoveProductAttribute = (
+ productId: string,
+ attributeId: string,
+ options?: UseMutationOptions<
+ RemoveProductAttributeResponse,
+ ClientError,
+ void
+ >
+) => {
+ return useMutation({
+ mutationFn: () =>
+ fetchQuery(
+ `/vendor/products/${productId}/attributes/${attributeId}`,
+ {
+ method: "DELETE",
+ }
+ ),
+ onSuccess: (data, variables, context) => {
+ queryClient.invalidateQueries({
+ queryKey: productsQueryKeys.detail(productId),
+ })
+ queryClient.invalidateQueries({
+ queryKey: productAttributesQueryKey(productId),
+ })
+ options?.onSuccess?.(data, variables, context)
+ },
+ ...options,
+ })
+}
+
+/* Variant Media Hook */
+
+type BatchVariantImagesPayload = {
+ add?: string[]
+ remove?: string[]
+}
+
+type BatchVariantImagesResponse = {
+ added: number
+ removed: number
+}
+
+export const useBatchVariantImages = (
+ productId: string,
+ variantId: string,
+ options?: UseMutationOptions<
+ BatchVariantImagesResponse,
+ ClientError,
+ BatchVariantImagesPayload
+ >
+) => {
+ return useMutation({
+ mutationFn: (payload: BatchVariantImagesPayload) =>
+ fetchQuery(
+ `/vendor/products/${productId}/variants/${variantId}/media`,
+ {
+ method: "POST",
+ body: payload,
+ }
+ ),
+ onSuccess: (data: any, variables: any, context: any) => {
+ queryClient.invalidateQueries({
+ queryKey: variantsQueryKeys.detail(variantId),
+ })
+ queryClient.invalidateQueries({
+ queryKey: productsQueryKeys.detail(productId),
+ })
+ options?.onSuccess?.(data, variables, context)
+ },
+ ...options,
+ })
+}
+
+/* Batch Update Products */
+
+export type BatchUpdateProductItem = {
+ id: string
+ title?: string
+ status?: "draft" | "published"
+ discountable?: boolean
+}
+
+export type BatchUpdateProductsPayload = {
+ update: BatchUpdateProductItem[]
+ delete?: string[]
+}
+
+export const useBatchUpdateProducts = (
+ options?: UseMutationOptions<void, ClientError, BatchUpdateProductsPayload>
+) => {
+ return useMutation({
+ mutationFn: async (payload: BatchUpdateProductsPayload) => {
+ return fetchQuery(`/vendor/products/batch`, {
+ method: "POST",
+ body: payload,
+ })
+ },
+ onSuccess: (data: any, variables: any, context: any) => {
+ queryClient.invalidateQueries({
+ queryKey: productsQueryKeys.lists(),
+ })
+ variables.update?.forEach((item: BatchUpdateProductItem) => {
+ queryClient.invalidateQueries({
+ queryKey: productsQueryKeys.detail(item.id),
+ })
+ })
+ options?.onSuccess?.(data, variables, context)
+ },
+ ...options,
+ })
+}
+
export const useBulkDeleteProducts = (
options?: UseMutationOptions<any[], ClientError, string[]>
) => {
diff --git a/packages/vendor/src/i18n/translations/en.json b/packages/vendor/src/i18n/translations/en.json
index cc63e3509..5c72facf3 100644
--- a/packages/vendor/src/i18n/translations/en.json
+++ b/packages/vendor/src/i18n/translations/en.json
@@ -64,7 +64,15 @@
"unsavedChangesDescription": "You have unsaved changes that will be lost if you exit this form.",
"includesTaxTooltip": "Prices in this column are tax inclusive.",
"excludesTaxTooltip": "Prices in this column are tax exclusive.",
- "noMoreData": "No more data"
+ "noMoreData": "No more data",
+ "searchOptions": "Search options...",
+ "noOptionsFound": "No options found",
+ "noOptionsAvailable": "No options available",
+ "selectValues": "Select values...",
+ "true": "True",
+ "false": "False",
+ "decrement": "Decrement",
+ "increment": "Increment"
},
"json": {
"header": "JSON",
@@ -101,13 +109,20 @@
}
},
"validation": {
- "mustBeInt": "The value must be a whole number.",
- "mustBePositive": "The value must be a positive number."
+ "rules": {
+ "lower": "At least one lowercase letter",
+ "upper": "At least one uppercase letter",
+ "12chars": "At least 12 characters",
+ "digit": "At least one digit",
+ "specialChar": "At least one special character"
+ },
+ "mustBeInt": "Must be a whole number",
+ "mustBePositive": "Must be a positive number"
},
"actions": {
"save": "Save",
"saveChanges": "Save changes",
- "saveAsDraft": "Save as draft",
+ "saveAsDraft": "Save draft",
"saveAndClose": "Save and close",
"copy": "Copy",
"copied": "Copied",
@@ -429,7 +444,23 @@
"edit": {
"header": "Edit Product",
"description": "Edit the product details.",
- "successToast": "Product {{title}} was successfully updated."
+ "successToast": "Product {{title}} was successfully updated.",
+ "attributes": {
+ "addAttribute": "Add Attribute",
+ "editHeader": "Edit Attribute",
+ "required": "Required attribute",
+ "valuesRequired": "At least one value is required",
+ "valuesPlaceholder": "Select or enter value",
+ "useForVariations": "Use for Variations",
+ "useForVariationsDescription": "Convert this attribute to a product option that generates variants.",
+ "conversionWarning": "Converting this attribute to a variation will affect existing product variants. This action may delete or modify variants.",
+ "editCustomValueTitle": "Custom Value",
+ "editCustomValueDescription": "Replacing this with a custom value will affect how your product appears in search and filters. Custom values are not searchable or filterable."
+ },
+ "informationalAttributes": {
+ "header": "Product Information",
+ "description": "Attributes used for informational purposes"
+ }
},
"create": {
"title": "Create Product",
@@ -439,12 +470,17 @@
"details": "Details",
"organize": "Organize",
"variants": "Variants",
- "inventory": "Inventory kits"
+ "inventory": "Inventory kits",
+ "attributes": "Attributes"
},
"errors": {
"variants": "Please select at least one variant.",
"options": "Please create at least one option.",
- "uniqueSku": "SKU must be unique."
+ "uniqueSku": "SKU must be unique across variants",
+ "primaryCategoryRequired": "Primary category is required",
+ "titleRequired": "Title is required",
+ "handleInvalidFormat": "Handle must contain only lowercase letters, numbers, and hyphens",
+ "handleMustContainLetter": "Handle must contain at least one letter"
},
"inventory": {
"heading": "Inventory kits",
@@ -463,17 +499,26 @@
"placeholder": "Small, Medium, Large"
},
"productVariants": {
- "label": "Product variants",
- "hint": "This ranking will affect the variants' order in your storefront.",
- "alert": "Add options to create variants.",
- "tip": "Variants left unchecked won't be created. You can always create and edit variants afterwards but this list fits the variations in your product options."
+ "searchPlaceholder": "Search variants...",
+ "media": "Media",
+ "tip": "Only variants with prices and stock will be visible to customers."
},
"productOptions": {
"label": "Product options",
"hint": "Define the options for the product, e.g. color, size, etc."
}
},
- "successToast": "Product {{title}} was successfully created."
+ "successToast": "Product {{title}} was successfully created.",
+ "attributes": {
+ "description": "Add attributes to your product. Select from admin-defined attributes or create your own.",
+ "requiredHeading": "Required Attributes",
+ "requiredDescription": "These attributes are required for products in this category.",
+ "buttonLabel": "Attribute",
+ "learnMore": {
+ "label": "Learn more about attributes",
+ "content": "Attributes help customers find and filter your products. Admin-defined attributes appear in search results."
+ }
+ }
},
"export": {
"header": "Export Product List",
@@ -522,6 +567,12 @@
"filtered": {
"heading": "No results",
"description": "No variants match the current filter criteria."
+ },
+ "editStocksAndPrices": {
+ "header": "Edit Stocks & Prices",
+ "description": "Manage stock locations and prices for all variants",
+ "action": "Edit Stocks & Prices",
+ "successToast": "Stocks and prices updated successfully"
}
},
"attributes": "Attributes",
@@ -532,7 +583,7 @@
"label": "Media",
"editHint": "Add media to the product to showcase it in your storefront.",
"manageImageVariants": "Manage associated variants",
- "makeThumbnail": "Make thumbnail",
+ "makeThumbnail": "Make Thumbnail",
"uploadImagesLabel": "Upload images",
"uploadImagesHint": "Drag and drop images here or click to upload.",
"invalidFileType": "'{{name}}' is not a supported file type. Supported file types are: {{types}}.",
@@ -542,21 +593,25 @@
"deleteWarning_other": "You are about to delete {{count}} images. This action cannot be undone.",
"deleteWarningWithThumbnail_one": "You are about to delete {{count}} image including the thumbnail. This action cannot be undone.",
"deleteWarningWithThumbnail_other": "You are about to delete {{count}} images including the thumbnail. This action cannot be undone.",
- "thumbnailTooltip": "Thumbnail",
+ "thumbnailTooltip": "This image is the thumbnail",
"galleryLabel": "Gallery",
"downloadImageLabel": "Download current image",
"deleteImageLabel": "Delete current image",
"emptyState": {
- "header": "No media yet",
- "description": "Add media to showcase it in your storefront.",
- "action": "Add media"
+ "header": "No media",
+ "description": "No images assigned to this variant.",
+ "action": "Add images",
+ "variantDescription": "This variant has no images. Add images to the variant."
},
"successToast": "Media was successfully updated.",
"variantImages": "Variant images",
"showAvailableImages": "Show available images",
"availableImages": "Select images",
"selectToAdd": "Add product images to the variant. To add new images, add them to the product first.",
- "removeSelected": "Remove Selected"
+ "removeSelected": "Remove Selected",
+ "selectImages": "Select Images",
+ "selectImagesHint": "Click images to add them to this variant.",
+ "editLabel": "Edit"
},
"variantMedia": {
"label": "Variant Media",
@@ -597,7 +652,8 @@
"title": {
"label": "Title",
"hint": "Give your product a short and clear title.<0/>50-60 characters is the recommended length for search engines.",
- "placeholder": "Winter jacket"
+ "placeholder": "Winter jacket",
+ "required": "Please enter a title"
},
"subtitle": {
"label": "Subtitle",
@@ -659,9 +715,9 @@
"label": "Product options",
"hint": "Options are used to define the color, size, etc. of the product",
"add": "Add option",
- "optionTitle": "Option title",
+ "optionTitle": "Title",
"optionTitlePlaceholder": "Color",
- "variations": "Variations (comma-separated)",
+ "variations": "Values",
"variantionsPlaceholder": "Red, Blue, Green"
},
"variants": {
@@ -673,6 +729,40 @@
},
"hs_code": {
"label": "HS code"
+ },
+ "attributes": {
+ "add": {
+ "title": {
+ "label": "Title",
+ "placeholder": "Search or type attribute name...",
+ "required": "Attribute title is required"
+ },
+ "values": {
+ "label": "Values",
+ "placeholder": "Type values separated by commas",
+ "required": "At least one value is required"
+ }
+ },
+ "useForVariants": {
+ "label": "Use for Variations",
+ "description": "Enable this to create product variants based on this attribute.",
+ "editDescription": "Changing this will affect existing product variants."
+ },
+ "validation": {
+ "required": "{{name}} is required",
+ "requiredSelect": "Please select a value",
+ "requiredEnter": "Please enter a value",
+ "requiredSelectMultiple": "Please select at least one value"
+ },
+ "enterValuePlaceholder": "Enter value",
+ "selectValuePlaceholder": "Select a value"
+ },
+ "secondaryCategories": {
+ "label": "Secondary Categories"
+ },
+ "primaryCategory": {
+ "label": "Primary Category",
+ "tooltip": "The primary category defines which attributes are available for this product. Attributes are created by the Admin when setting up the marketplace."
}
},
"variant": {
@@ -728,7 +818,11 @@
"header": "Create Option",
"successToast": "Option {{title}} was successfully created."
},
- "deleteWarning": "You are about to delete the product option: {{title}}. This action cannot be undone."
+ "deleteWarning": "Are you sure you want to delete the option \"{{title}}\"? This will remove all associated variants.",
+ "variations": {
+ "label": "Variations",
+ "description": "Attributes used to create product variants."
+ }
},
"organization": {
"header": "Organize",
@@ -772,6 +866,12 @@
"header": "Failed to delete product"
}
}
+ },
+ "bulkEdit": {
+ "title": "Bulk Edit Products",
+ "description": "Edit multiple products at once.",
+ "noChanges": "No changes to save.",
+ "success": "Products updated successfully."
}
},
"collections": {
@@ -3441,4 +3541,4 @@
"cloud": "Log in with Mercur"
}
}
-}
\ No newline at end of file
+}
diff --git a/packages/vendor/src/pages/product-variants/product-variant-detail/components/variant-media-section/index.ts b/packages/vendor/src/pages/product-variants/product-variant-detail/components/variant-media-section/index.ts
new file mode 100644
index 000000000..36d9d753b
--- /dev/null
+++ b/packages/vendor/src/pages/product-variants/product-variant-detail/components/variant-media-section/index.ts
@@ -0,0 +1 @@
+export { VariantMediaSection } from "./variant-media-section"
diff --git a/packages/vendor/src/pages/product-variants/product-variant-detail/components/variant-media-section/variant-media-section.tsx b/packages/vendor/src/pages/product-variants/product-variant-detail/components/variant-media-section/variant-media-section.tsx
new file mode 100644
index 000000000..871c1b754
--- /dev/null
+++ b/packages/vendor/src/pages/product-variants/product-variant-detail/components/variant-media-section/variant-media-section.tsx
@@ -0,0 +1,210 @@
+import { useState } from "react"
+
+import { PencilSquare, ThumbnailBadge } from "@medusajs/icons"
+import type { HttpTypes } from "@medusajs/types"
+import {
+ Button,
+ Checkbox,
+ clx,
+ CommandBar,
+ Container,
+ Heading,
+ Text,
+ Tooltip,
+} from "@medusajs/ui"
+import { useTranslation } from "react-i18next"
+import { Link } from "react-router-dom"
+
+import { ActionMenu } from "@components/common/action-menu"
+import {
+ useUpdateProductVariant,
+ useUpdateVariantMedia,
+} from "@hooks/api/products"
+
+type VariantMediaSectionProps = {
+ variant: any
+ variantImages: HttpTypes.AdminProductImage[]
+ productId: string
+}
+
+type Media = {
+ id: string
+ url: string
+ isThumbnail: boolean
+}
+
+const getMedia = (
+ images: HttpTypes.AdminProductImage[] | null | undefined,
+ thumbnail: string | null | undefined
+): Media[] => {
+ const media: Media[] = (images ?? []).map((image) => ({
+ id: image.id!,
+ url: image.url!,
+ isThumbnail: image.url === thumbnail,
+ }))
+
+ if (thumbnail && !media.some((m) => m.isThumbnail)) {
+ media.unshift({
+ id: "variant_thumbnail",
+ url: thumbnail,
+ isThumbnail: true,
+ })
+ }
+
+ return media
+}
+
+export const VariantMediaSection = ({
+ variant,
+ variantImages,
+ productId,
+}: VariantMediaSectionProps) => {
+ const { t } = useTranslation()
+ const [selection, setSelection] = useState<Record<string, boolean>>({})
+
+ const media = getMedia(variantImages, variant.thumbnail)
+
+ const handleCheckedChange = (id: string) => {
+ setSelection((prev) => {
+ if (prev[id]) {
+ const { [id]: _, ...rest } = prev
+ return rest
+ }
+ return { ...prev, [id]: true }
+ })
+ }
+
+ const { mutateAsync: updateVariantMedia } = useUpdateVariantMedia(
+ productId,
+ variant.id
+ )
+ const { mutateAsync: updateVariant } = useUpdateProductVariant(
+ productId,
+ variant.id
+ )
+
+ const handleRemove = async () => {
+ const ids = Object.keys(selection)
+ const includingThumbnail = ids.some(
+ (id) => media.find((m) => m.id === id)?.isThumbnail
+ )
+
+ const imageIdsToRemove = ids.filter((id) => id !== "variant_thumbnail")
+
+ const ops: Promise<unknown>[] = []
+
+ if (imageIdsToRemove.length) {
+ ops.push(updateVariantMedia({ remove: imageIdsToRemove }))
+ }
+
+ if (includingThumbnail) {
+ ops.push(updateVariant({ thumbnail: null } as any))
+ }
+
+ if (!ops.length) {
+ setSelection({})
+ return
+ }
+
+ await Promise.all(ops)
+ setSelection({})
+ }
+
+ return (
+ <Container className="divide-y p-0">
+ <div className="flex items-center justify-between px-6 py-4">
+ <Heading level="h2">{t("products.media.label")}</Heading>
+ <ActionMenu
+ groups={[
+ {
+ actions: [
+ {
+ label: t("actions.edit"),
+ to: "media?view=edit",
+ icon: <PencilSquare />,
+ },
+ ],
+ },
+ ]}
+ />
+ </div>
+ {media.length > 0 ? (
+ <div className="grid grid-cols-[repeat(auto-fill,minmax(96px,1fr))] gap-4 px-6 py-4">
+ {media.map((item, index) => {
+ const isSelected = selection[item.id]
+
+ return (
+ <div
+ className="group relative aspect-square size-full cursor-pointer overflow-hidden rounded-[8px] shadow-elevation-card-rest transition-fg hover:shadow-elevation-card-hover"
+ key={item.id}
+ >
+ <div
+ className={clx(
+ "invisible absolute right-2 top-2 opacity-0 transition-fg group-hover:visible group-hover:opacity-100",
+ { "visible opacity-100": isSelected }
+ )}
+ >
+ <Checkbox
+ checked={selection[item.id] || false}
+ onCheckedChange={() => handleCheckedChange(item.id)}
+ aria-label={t("actions.select")}
+ />
+ </div>
+ {item.isThumbnail && (
+ <div className="absolute left-2 top-2">
+ <Tooltip content={t("fields.thumbnail")}>
+ <ThumbnailBadge />
+ </Tooltip>
+ </div>
+ )}
+ <Link to="media" state={{ curr: index }}>
+ <img
+ src={item.url}
+ alt={`${variant.title ?? ""} image ${index + 1}`}
+ className="size-full object-cover"
+ />
+ </Link>
+ </div>
+ )
+ })}
+ </div>
+ ) : (
+ <div className="flex flex-col items-center gap-y-4 pb-8 pt-6">
+ <div className="flex flex-col items-center">
+ <Text
+ size="small"
+ leading="compact"
+ weight="plus"
+ className="text-ui-fg-subtle"
+ >
+ {t("products.media.emptyState.header")}
+ </Text>
+ <Text size="small" className="text-ui-fg-muted">
+ {t("products.media.emptyState.variantDescription")}
+ </Text>
+ </div>
+ <Button size="small" variant="secondary" asChild>
+ <Link to="media?view=edit">
+ {t("products.media.emptyState.action")}
+ </Link>
+ </Button>
+ </div>
+ )}
+ <CommandBar open={!!Object.keys(selection).length}>
+ <CommandBar.Bar>
+ <CommandBar.Value>
+ {t("general.countSelected", {
+ count: Object.keys(selection).length,
+ })}
+ </CommandBar.Value>
+ <CommandBar.Seperator />
+ <CommandBar.Command
+ action={handleRemove}
+ label={t("actions.remove")}
+ shortcut="r"
+ />
+ </CommandBar.Bar>
+ </CommandBar>
+ </Container>
+ )
+}
diff --git a/packages/vendor/src/pages/product-variants/product-variant-detail/components/variant-prices-section/variant-prices-section.tsx b/packages/vendor/src/pages/product-variants/product-variant-detail/components/variant-prices-section/variant-prices-section.tsx
index 15364bc1a..81477587d 100644
--- a/packages/vendor/src/pages/product-variants/product-variant-detail/components/variant-prices-section/variant-prices-section.tsx
+++ b/packages/vendor/src/pages/product-variants/product-variant-detail/components/variant-prices-section/variant-prices-section.tsx
@@ -16,8 +16,8 @@ type VariantPricesSectionProps = {
export function VariantPricesSection({ variant }: VariantPricesSectionProps) {
const { t } = useTranslation()
const prices = variant.prices
- ?.filter((p) => !Object.keys(p.rules || {}).length)
- .sort((p1, p2) => p1.currency_code?.localeCompare(p2.currency_code))
+ ?.filter((p) => p.currency_code && p.currency_code.length <= 3 && !Object.keys(p.rules || {}).length)
+ .sort((p1, p2) => (p1.currency_code ?? "").localeCompare(p2.currency_code ?? ""))
const hasPrices = !!prices?.length
const [pageSize, setPageSize] = useState(3)
diff --git a/packages/vendor/src/pages/product-variants/product-variant-detail/product-variant-detail.tsx b/packages/vendor/src/pages/product-variants/product-variant-detail/product-variant-detail.tsx
index 64de4cf5c..e3e2e2ce2 100644
--- a/packages/vendor/src/pages/product-variants/product-variant-detail/product-variant-detail.tsx
+++ b/packages/vendor/src/pages/product-variants/product-variant-detail/product-variant-detail.tsx
@@ -1,54 +1,88 @@
-import { useParams } from "react-router-dom";
+import { useMemo } from "react"
+import { useParams } from "react-router-dom"
-import { useProduct } from "@hooks/api/products";
+import { useProduct, useProductVariants } from "@hooks/api/products"
-import { TwoColumnPageSkeleton } from "@components/common/skeleton";
-import { TwoColumnPage } from "@components/layout/pages";
-import { VariantGeneralSection } from "./components/variant-general-section";
+import { TwoColumnPageSkeleton } from "@components/common/skeleton"
+import { TwoColumnPage } from "@components/layout/pages"
+import { getExplicitVariantImages } from "../../../utils/get-explicit-variant-images"
+import { VariantGeneralSection } from "./components/variant-general-section"
import {
InventorySectionPlaceholder,
VariantInventorySection,
-} from "./components/variant-inventory-section";
-import { VariantPricesSection } from "./components/variant-prices-section";
+} from "./components/variant-inventory-section"
+import { VariantMediaSection } from "./components/variant-media-section"
+import { VariantPricesSection } from "./components/variant-prices-section"
export const ProductVariantDetail = () => {
- const { product_id, variant_id } = useParams();
- const { product, isLoading, isError, error } = useProduct(product_id!, {
- fields: "*variants.inventory_items",
- });
+ const { product_id, variant_id } = useParams()
+ const {
+ product,
+ isLoading: isProductLoading,
+ isError,
+ error,
+ } = useProduct(product_id!, {
+ fields: "*variants.inventory_items,*images",
+ })
- const variant = product?.variants?.find((item) => item.id === variant_id);
+ const { variants, isLoading: isVariantsLoading } = useProductVariants(
+ product_id!,
+ { fields: "*images" } as any
+ )
- if (isLoading || !variant) {
- return <TwoColumnPageSkeleton mainSections={2} sidebarSections={1} />;
+ const productVariant = product?.variants?.find(
+ (item) => item.id === variant_id
+ )
+ const variantsDataVariant = variants?.find((v: any) => v.id === variant_id)
+
+ const variantImages = useMemo(() => {
+ if (!variantsDataVariant?.images) {
+ return []
+ }
+ return getExplicitVariantImages(
+ variantsDataVariant.images as any,
+ variant_id!
+ )
+ }, [variantsDataVariant?.images, variant_id])
+
+ const isLoading = isProductLoading || isVariantsLoading
+
+ if (isLoading || !productVariant) {
+ return <TwoColumnPageSkeleton mainSections={3} sidebarSections={1} />
}
if (isError) {
- throw error;
+ throw error
}
+
return (
- <TwoColumnPage data={variant} hasOutlet>
+ <TwoColumnPage data={productVariant} hasOutlet>
<TwoColumnPage.Main>
- <VariantGeneralSection variant={variant} />
- {!variant.manage_inventory ? (
+ <VariantGeneralSection variant={productVariant} />
+ <VariantMediaSection
+ variant={productVariant}
+ variantImages={variantImages}
+ productId={product_id!}
+ />
+ {!productVariant.manage_inventory ? (
<InventorySectionPlaceholder />
) : (
- variant.inventory_items && (
+ productVariant.inventory_items && (
<VariantInventorySection
- inventoryItems={variant.inventory_items.map((i) => {
+ inventoryItems={productVariant.inventory_items.map((i) => {
return {
id: i.inventory_item_id,
required_quantity: i.required_quantity,
- variant,
- };
+ variant: productVariant,
+ }
})}
/>
)
)}
</TwoColumnPage.Main>
<TwoColumnPage.Sidebar>
- <VariantPricesSection variant={variant} />
+ <VariantPricesSection variant={productVariant} />
</TwoColumnPage.Sidebar>
</TwoColumnPage>
- );
-};
+ )
+}
diff --git a/packages/vendor/src/pages/products/[id]/_components/product-additional-attribute-section/ProductAdditionalAttributesSection.tsx b/packages/vendor/src/pages/products/[id]/_components/product-additional-attribute-section/ProductAdditionalAttributesSection.tsx
index bd70864b7..6dfe494c1 100644
--- a/packages/vendor/src/pages/products/[id]/_components/product-additional-attribute-section/ProductAdditionalAttributesSection.tsx
+++ b/packages/vendor/src/pages/products/[id]/_components/product-additional-attribute-section/ProductAdditionalAttributesSection.tsx
@@ -1,55 +1,156 @@
-import { Container, Heading } from "@medusajs/ui"
-import { PencilSquare } from "@medusajs/icons"
+import { DropCap, PencilSquare, Plus, Swatch, Trash } from "@medusajs/icons"
+import { Badge, Container, Heading, Text, toast, usePrompt } from "@medusajs/ui"
+import { useTranslation } from "react-i18next"
+
import { ActionMenu } from "@components/common/action-menu"
-import { useProductAttributes } from "@hooks/api/products"
import { SectionRow } from "@components/common/section"
-import { useMemo } from "react"
-import { useProductDetailContext } from "../../context"
-
-export const ProductAdditionalAttributesSection = () => {
- const { product } = useProductDetailContext()
- const { attributes, isLoading } = useProductAttributes(product.id)
-
- const attributeList = useMemo(() => {
- return attributes?.map((attribute) => {
- const value =
- product.attribute_values?.find((av) => av && av.attribute_id === attribute.id)
- ?.value || "-"
- return {
- ...attribute,
- value,
- }
+import { useDeleteProductOption, useRemoveProductAttribute } from "@hooks/api/products"
+import {
+ ExtendedAdminProduct,
+ ExtendedAdminProductOption,
+ ProductInformationalAttribute,
+ ProductInformationalAttributeValue,
+} from "../../../types"
+
+type ProductAttributeSectionProps = {
+ product: ExtendedAdminProduct
+}
+
+const OptionRowActions = ({ productId, option }: { productId: string; option: ExtendedAdminProductOption }) => {
+ const { t } = useTranslation()
+ const prompt = usePrompt()
+ const { mutateAsync, isPending } = useDeleteProductOption(productId, option.id)
+ const canDelete = option.metadata?.author !== "admin"
+
+ const handleDelete = async () => {
+ const res = await prompt({
+ title: t("general.areYouSure"),
+ description: t("products.options.deleteWarning", { title: option.title }),
+ confirmText: t("actions.delete"),
+ cancelText: t("actions.cancel"),
+ })
+ if (!res) return
+ await mutateAsync(undefined, { onError: (err) => toast.error(err.message) })
+ }
+
+ return (
+ <ActionMenu
+ groups={[
+ { actions: [{ icon: <PencilSquare />, label: t("actions.edit"), to: `options/${option.id}/edit` }] },
+ ...(canDelete
+ ? [{ actions: [{ icon: <Trash />, label: t("actions.delete"), disabled: isPending, onClick: handleDelete }] }]
+ : []),
+ ]}
+ />
+ )
+}
+
+const InformationalAttributeRowActions = ({ productId, attribute }: { productId: string; attribute: ProductInformationalAttribute }) => {
+ const { t } = useTranslation()
+ const prompt = usePrompt()
+ const { mutateAsync, isPending } = useRemoveProductAttribute(productId, attribute.attribute_id)
+ const isVendorSource = attribute.attribute_source === "vendor"
+
+ const handleDelete = async () => {
+ const res = await prompt({
+ title: t("general.areYouSure"),
+ description: "You are about to remove this attribute from the product. This action cannot be undone.",
+ confirmText: t("actions.delete"),
+ cancelText: t("actions.cancel"),
})
- }, [attributes, product.attribute_values])
+ if (!res) return
+ await mutateAsync(undefined, { onError: (err) => toast.error(err.message) })
+ }
+
+ return (
+ <ActionMenu
+ groups={[
+ { actions: [{ icon: <PencilSquare />, label: t("actions.edit"), to: `informational-attributes/${attribute.attribute_id}/edit` }] },
+ ...(isVendorSource
+ ? [{ actions: [{ icon: <Trash />, label: t("actions.delete"), disabled: isPending, onClick: handleDelete }] }]
+ : []),
+ ]}
+ />
+ )
+}
+
+export const ProductAdditionalAttributesSection = ({ product }: ProductAttributeSectionProps) => {
+ const { t } = useTranslation()
+ const informationalAttributes = product.informational_attributes?.filter(Boolean) ?? []
+ const options = product.options?.filter(Boolean) ?? []
- if (isLoading) return
+ if (!informationalAttributes.length && !options.length) return null
return (
- <Container className="divide-y p-0">
- <div className="flex items-center justify-between px-6 py-4">
- <Heading level="h2">Attributes</Heading>
- <ActionMenu
- groups={[
- {
- actions: [
- {
- label: "Edit",
- to: "additional-attributes",
- icon: <PencilSquare />,
- },
- ],
- },
- ]}
- />
+ <Container className="p-0">
+ <div className="flex items-center justify-between border-b px-6 py-4">
+ <Heading>{t("products.attributes")}</Heading>
+ <ActionMenu groups={[{ actions: [{ label: t("actions.add"), to: "attributes/add", icon: <Plus /> }] }]} />
</div>
- {attributeList?.map((attribute) => (
- <SectionRow
- key={attribute.id}
- title={attribute.name}
- value={attribute.value}
- tooltip={attribute.description}
- />
- ))}
+
+ {options.length > 0 && (
+ <div className="px-3 py-4">
+ <div className="flex items-center gap-x-3 px-3 pb-4">
+ <div className="flex size-7 items-center justify-center rounded-md bg-ui-bg-base shadow-borders-base">
+ <div className="flex size-6 items-center justify-center rounded-[4px] bg-ui-bg-component">
+ <Swatch className="text-ui-fg-subtle" />
+ </div>
+ </div>
+ <div>
+ <Text size="small" weight="plus" leading="compact">{t("products.options.variations.label")}</Text>
+ <Text size="xsmall" leading="compact" className="text-ui-fg-subtle">{t("products.options.variations.description")}</Text>
+ </div>
+ </div>
+ <div className="divide-y overflow-hidden rounded-lg border">
+ {options.map((option) => (
+ <SectionRow
+ key={option.id}
+ title={option.title}
+ actions={<OptionRowActions productId={product.id} option={option} />}
+ className="bg-ui-bg-component p-3"
+ value={option.values?.map((value, index) => (
+ <Badge key={`${option.id}-${value.value}-${index}`} size="2xsmall" className="flex min-w-[20px] items-center justify-center">
+ {value.value}
+ </Badge>
+ ))}
+ tooltip={option.metadata?.author === "admin" ? t("products.edit.attributes.required") : undefined}
+ />
+ ))}
+ </div>
+ </div>
+ )}
+
+ {options.length > 0 && informationalAttributes.length > 0 && (
+ <div className="border-t border-dashed border-ui-border-base" />
+ )}
+
+ {informationalAttributes.length > 0 && (
+ <div className="px-3 py-4">
+ <div className="flex items-center gap-x-3 px-3 pb-4">
+ <div className="flex size-7 items-center justify-center rounded-md bg-ui-bg-base shadow-borders-base">
+ <div className="flex size-6 items-center justify-center rounded-[4px] bg-ui-bg-component">
+ <DropCap className="text-ui-fg-subtle" />
+ </div>
+ </div>
+ <div>
+ <Text size="small" weight="plus" leading="compact">{t("products.edit.informationalAttributes.header")}</Text>
+ <Text size="xsmall" leading="compact" className="text-ui-fg-subtle">{t("products.edit.informationalAttributes.description")}</Text>
+ </div>
+ </div>
+ <div className="divide-y overflow-hidden rounded-lg border">
+ {informationalAttributes.map((attribute) => (
+ <SectionRow
+ key={`${attribute.attribute_id}-${attribute.attribute_source}`}
+ title={attribute.name}
+ actions={<InformationalAttributeRowActions productId={product.id} attribute={attribute} />}
+ className="bg-ui-bg-component p-3 [&>p]:gap-x-1"
+ value={attribute.values?.length ? attribute.values.map((v: ProductInformationalAttributeValue) => v.value).join(", ") : "-"}
+ tooltip={attribute.is_required ? t("products.edit.attributes.required") : undefined}
+ />
+ ))}
+ </div>
+ </div>
+ )}
</Container>
)
}
diff --git a/packages/vendor/src/pages/products/[id]/_components/product-general-section/product-general-section.tsx b/packages/vendor/src/pages/products/[id]/_components/product-general-section/product-general-section.tsx
index 57240329a..d4f5030fb 100644
--- a/packages/vendor/src/pages/products/[id]/_components/product-general-section/product-general-section.tsx
+++ b/packages/vendor/src/pages/products/[id]/_components/product-general-section/product-general-section.tsx
@@ -85,12 +85,12 @@ export const ProductGeneralSection = () => {
</div>
</div>
- <SectionRow title={t("fields.description")} value={product.description} />
- {/* <SectionRow title={t("fields.subtitle")} value={product.subtitle} /> */}
+ <SectionRow title={t("fields.description")} value={product.description || "-"} />
+ <SectionRow title={t("fields.subtitle")} value={product.subtitle || "-"} />
<SectionRow title={t("fields.handle")} value={`/${product.handle}`} />
<SectionRow
title={t("fields.discountable")}
- value={product.discountable ? t("fields.true") : t("fields.false")}
+ value={product.discountable ? "True" : "False"}
/>
</Container>
);
diff --git a/packages/vendor/src/pages/products/[id]/_components/product-organization-section/product-organization-section.tsx b/packages/vendor/src/pages/products/[id]/_components/product-organization-section/product-organization-section.tsx
index f10613348..b82ded931 100644
--- a/packages/vendor/src/pages/products/[id]/_components/product-organization-section/product-organization-section.tsx
+++ b/packages/vendor/src/pages/products/[id]/_components/product-organization-section/product-organization-section.tsx
@@ -1,15 +1,45 @@
+import { useMemo } from "react";
import { PencilSquare } from "@medusajs/icons";
import { Badge, Container, Heading, Tooltip } from "@medusajs/ui";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";
import { ActionMenu } from "@components/common/action-menu";
import { SectionRow } from "@components/common/section";
+import { useProductCategories } from "@hooks/api/categories";
import { useProductDetailContext } from "../../context";
export const ProductOrganizationSection = () => {
const { product } = useProductDetailContext();
const { t } = useTranslation();
+ const additionalSecondaryCategoryIds = useMemo(() => {
+ const additional = (product as any).additional_data?.secondary_categories
+ if (!additional || !Array.isArray(additional)) return []
+ return additional.flatMap((entry: any) =>
+ Array.isArray(entry.category_ids) ? entry.category_ids : []
+ )
+ }, [product])
+
+ const hasSecondaryFromAdditional = additionalSecondaryCategoryIds.length > 0
+
+ const { product_categories: allCategories } = useProductCategories(
+ {
+ id: additionalSecondaryCategoryIds,
+ limit: 100,
+ },
+ { enabled: hasSecondaryFromAdditional }
+ )
+
+ const secondaryCategories = useMemo(() => {
+ if ((product as any).secondary_categories?.length) {
+ return (product as any).secondary_categories
+ }
+ if (hasSecondaryFromAdditional && allCategories) {
+ return allCategories
+ }
+ return []
+ }, [product, hasSecondaryFromAdditional, allCategories])
+
return (
<Container className="divide-y p-0">
<div className="flex items-center justify-between px-6 py-4">
@@ -68,7 +98,7 @@ export const ProductOrganizationSection = () => {
/>
<SectionRow
- title={t("fields.categories")}
+ title={t("products.fields.primaryCategory.label")}
value={
product.categories?.length
? product.categories.map((pcat) => (
@@ -81,6 +111,21 @@ export const ProductOrganizationSection = () => {
: undefined
}
/>
+
+ <SectionRow
+ title={t("products.fields.secondaryCategories.label", "Secondary Categories")}
+ value={
+ secondaryCategories?.length
+ ? secondaryCategories.map((cat: any) => (
+ <OrganizationTag
+ key={cat.id}
+ label={cat.name}
+ to={`/categories/${cat.id}`}
+ />
+ ))
+ : undefined
+ }
+ />
</Container>
);
};
diff --git a/packages/vendor/src/pages/products/[id]/_components/product-variant-section/product-variant-section.tsx b/packages/vendor/src/pages/products/[id]/_components/product-variant-section/product-variant-section.tsx
index 1fcff3a5b..8deb08d61 100644
--- a/packages/vendor/src/pages/products/[id]/_components/product-variant-section/product-variant-section.tsx
+++ b/packages/vendor/src/pages/products/[id]/_components/product-variant-section/product-variant-section.tsx
@@ -60,7 +60,7 @@ export const ProductVariantSection = () => {
? JSON.parse(manage_inventory)
: undefined,
fields:
- "title,sku,thumbnail,*options,created_at,*inventory_items.inventory.location_levels,inventory_quantity,manage_inventory",
+ "title,sku,thumbnail,*options,created_at,updated_at,*inventory_items.inventory.location_levels,inventory_quantity,manage_inventory",
},
{
placeholderData: keepPreviousData,
@@ -103,15 +103,10 @@ export const ProductVariantSection = () => {
{
actions: [
{
- label: t("products.editPrices"),
- to: `prices`,
+ label: t("products.variants.editStocksAndPrices.action", "Edit Stocks & Prices"),
+ to: `edit-stocks-and-prices`,
icon: <PencilSquare />,
},
- {
- label: t("inventory.stock.action"),
- to: `stock`,
- icon: <Buildings />,
- },
],
},
],
@@ -253,8 +248,6 @@ const useColumns = (product: HttpTypes.AdminProduct) => {
};
}
- const quantity = variant.inventory_quantity;
-
const inventoryItems = castVariant.inventory_items
?.map((i) => i.inventory)
.filter(Boolean) as HttpTypes.AdminInventoryItem[];
@@ -262,14 +255,17 @@ const useColumns = (product: HttpTypes.AdminProduct) => {
const hasInventoryKit = inventoryItems.length > 1;
const locations: Record<string, boolean> = {};
+ let totalStocked = 0;
inventoryItems.forEach((i) => {
i.location_levels?.forEach((l) => {
locations[l.id] = true;
+ totalStocked += (l as any).stocked_quantity ?? 0;
});
});
const locationCount = Object.keys(locations).length;
+ const quantity = variant.inventory_quantity ?? totalStocked;
const text = hasInventoryKit
? t("products.variant.tableItemAvailable", {
@@ -312,6 +308,22 @@ const useColumns = (product: HttpTypes.AdminProduct) => {
sortAscLabel: t("filters.sorting.alphabeticallyAsc"),
sortDescLabel: t("filters.sorting.alphabeticallyDesc"),
}),
+ columnHelper.accessor("created_at", {
+ header: t("fields.createdAt"),
+ enableSorting: true,
+ sortAscLabel: t("filters.sorting.dateAsc"),
+ sortDescLabel: t("filters.sorting.dateDesc"),
+ enableHiding: true,
+ isVisibleByDefault: false,
+ }),
+ columnHelper.accessor("updated_at", {
+ header: t("fields.updatedAt"),
+ enableSorting: true,
+ sortAscLabel: t("filters.sorting.dateAsc"),
+ sortDescLabel: t("filters.sorting.dateDesc"),
+ enableHiding: true,
+ isVisibleByDefault: false,
+ }),
...optionColumns,
columnHelper.display({
id: "inventory",
diff --git a/packages/vendor/src/pages/products/[id]/additional-attributes/AttributeSelect.tsx b/packages/vendor/src/pages/products/[id]/additional-attributes/AttributeSelect.tsx
deleted file mode 100644
index 1b3b471df..000000000
--- a/packages/vendor/src/pages/products/[id]/additional-attributes/AttributeSelect.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import { Select } from "@medusajs/ui"
-import { ProductAttributePossibleValue } from "@custom-types/products"
-import { ControllerRenderProps } from "react-hook-form"
-
-export const AttributeSelect = ({
- values,
- field,
-}: {
- values: ProductAttributePossibleValue[]
- field: ControllerRenderProps<any, string>
-}) => {
- const handleChange = (value: string) => {
- field.onChange(value)
- }
-
- return (
- <Select onValueChange={(value) => handleChange(value)} value={field.value}>
- <Select.Trigger className="bg-ui-bg-base">
- <Select.Value placeholder="Select value" />
- </Select.Trigger>
- <Select.Content>
- {values.map(({ id, attribute_id, value }) => (
- <Select.Item
- key={`select-option-${attribute_id}-${id}`}
- value={value}
- >
- {value}
- </Select.Item>
- ))}
- </Select.Content>
- </Select>
- )
-}
diff --git a/packages/vendor/src/pages/products/[id]/additional-attributes/Components.tsx b/packages/vendor/src/pages/products/[id]/additional-attributes/Components.tsx
deleted file mode 100644
index 6825ca456..000000000
--- a/packages/vendor/src/pages/products/[id]/additional-attributes/Components.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import { Input, Switch, Textarea } from "@medusajs/ui"
-import { AttributeSelect } from "./AttributeSelect"
-import { ProductAttribute } from "@custom-types/products"
-import { ControllerRenderProps } from "react-hook-form"
-
-export const Components = ({
- attribute,
- field,
-}: {
- attribute: ProductAttribute
- field: ControllerRenderProps<any, string>
-}) => {
- const { ui_component, possible_values } = attribute
-
- if (ui_component === "select")
- return <AttributeSelect values={possible_values} field={field} />
-
- if (ui_component === "toggle")
- return (
- <Switch
- {...field}
- onCheckedChange={field.onChange}
- checked={field.value === "true" || field.value === true}
- />
- )
-
- if (ui_component === "text_area") return <Textarea {...field} rows={4} />
-
- if (ui_component === "unit") return <Input type="number" {...field} />
-
- if (ui_component === "text") return <Input {...field} />
-
- return <Input {...field} />
-}
diff --git a/packages/vendor/src/pages/products/[id]/additional-attributes/index.tsx b/packages/vendor/src/pages/products/[id]/additional-attributes/index.tsx
deleted file mode 100644
index e7d78acce..000000000
--- a/packages/vendor/src/pages/products/[id]/additional-attributes/index.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-// Route: /products/:id/additional-attributes
-import { useParams } from "react-router-dom"
-import { Heading } from "@medusajs/ui"
-import { Spinner } from "@medusajs/icons"
-import { useProduct, useProductAttributes } from "@hooks/api"
-import { RouteDrawer } from "@components/modals"
-import { ProductAdditionalAttributesForm } from "./product-additional-attributes-form"
-
-export const Component = () => {
- const { id } = useParams()
- const { product, isLoading: isProductLoading } = useProduct(id!)
-
- const { attributes, isLoading: isAttributesLoading } = useProductAttributes(
- id!,
- )
-
- const isReady = !isAttributesLoading && attributes && !isProductLoading && product
-
- return (
- <RouteDrawer>
- <RouteDrawer.Header>
- <Heading level="h2">Edit Additional Attributes</Heading>
- </RouteDrawer.Header>
- {isReady ? (
- <ProductAdditionalAttributesForm product={product} attributes={attributes} id={id!} />
- ) : (
- <Spinner className="text-ui-fg-interactive animate-spin" />
- )}
- </RouteDrawer>
- )
-}
diff --git a/packages/vendor/src/pages/products/[id]/additional-attributes/product-additional-attributes-form.tsx b/packages/vendor/src/pages/products/[id]/additional-attributes/product-additional-attributes-form.tsx
deleted file mode 100644
index 57e380feb..000000000
--- a/packages/vendor/src/pages/products/[id]/additional-attributes/product-additional-attributes-form.tsx
+++ /dev/null
@@ -1,127 +0,0 @@
-'use client';
-
-import { InformationCircleSolid } from '@medusajs/icons';
-import { Button, toast, Tooltip } from '@medusajs/ui';
-import { useForm } from 'react-hook-form';
-import { useTranslation } from 'react-i18next';
-
-import { Form } from "@components/common/form"
-import { RouteDrawer, useRouteModal } from "@components/modals"
-import { KeyboundForm } from "@components/utilities/keybound-form"
-import { useUpdateProduct } from "@hooks/api"
-import { ExtendedAdminProduct, ProductAttribute } from '../../../../types/products';
-import { Components } from './Components';
-
-interface Props {
- product: ExtendedAdminProduct;
- attributes: ProductAttribute[];
- id: string;
-}
-
-export const ProductAdditionalAttributesForm = ({ product, attributes, id }: Props) => {
- const { t } = useTranslation();
- const { handleSuccess } = useRouteModal();
- const filteredAttributes = product?.attribute_values?.filter(a => !!a?.attribute_id);
- const defaultValues = filteredAttributes?.reduce((acc: any, curr: any) => {
- acc[curr.attribute_id] = curr.value;
- return acc;
- }, {});
-
- const form = useForm({
- defaultValues
- });
-
- const { mutate: updateProduct, isPending: isMutating } = useUpdateProduct(id);
-
- const handleSubmit = form.handleSubmit(async (data: any) => {
- const values = Object.keys(data).reduce((acc: Array<Record<string, string>>, key) => {
- acc.push({ attribute_id: key, value: data[key] });
- return acc;
- }, []);
-
- await updateProduct(
- {
- additional_data: { values }
- },
- {
- onSuccess: () => {
- toast.success(
- t('products.edit.successToast', {
- title: product.title
- })
- );
- handleSuccess(`/products/${id}`);
- },
- onError: error => {
- toast.error(error.message);
- }
- }
- );
- });
-
- return (
- <RouteDrawer.Form form={form}>
- <KeyboundForm
- onSubmit={handleSubmit}
- className="flex flex-1 flex-col"
- >
- <RouteDrawer.Body className="max-h-[calc(86vh)] overflow-y-auto py-2">
- {attributes?.map((a: ProductAttribute) => (
- <Form.Field
- key={`form-field-${a.handle}-${a.id}`}
- control={form.control}
- name={a.id}
- render={({ field }) => {
- return (
- <Form.Item
- key={a.id}
- className="mb-4 w-full"
- >
- <Form.Label className="flex w-full flex-col gap-y-2">
- <span className="flex items-center gap-x-2">
- {a.name}
- {a.description && (
- <Tooltip content={a.description}>
- <InformationCircleSolid />
- </Tooltip>
- )}
- </span>
-
- <Form.Control>
- <Components
- attribute={a}
- field={field}
- />
- </Form.Control>
- </Form.Label>
- </Form.Item>
- );
- }}
- />
- ))}
- </RouteDrawer.Body>
- <RouteDrawer.Footer>
- <div className="flex items-center justify-end gap-x-2">
- <RouteDrawer.Close asChild>
- <Button
- size="small"
- variant="secondary"
- type="button"
- disabled={isMutating}
- >
- {t('actions.cancel')}
- </Button>
- </RouteDrawer.Close>
- <Button
- size="small"
- type="submit"
- isLoading={isMutating}
- >
- {t('actions.save')}
- </Button>
- </div>
- </RouteDrawer.Footer>
- </KeyboundForm>
- </RouteDrawer.Form>
- );
-};
diff --git a/packages/vendor/src/pages/products/[id]/attributes/add/index.tsx b/packages/vendor/src/pages/products/[id]/attributes/add/index.tsx
new file mode 100644
index 000000000..ca18df553
--- /dev/null
+++ b/packages/vendor/src/pages/products/[id]/attributes/add/index.tsx
@@ -0,0 +1,2 @@
+// Route: /products/:id/attributes/add
+export { ProductAddAttribute as Component } from "../../../product-add-attribute/product-add-attribute"
diff --git a/packages/vendor/src/pages/products/[id]/edit-stocks-and-prices/components/stocks-and-prices-edit-form.tsx b/packages/vendor/src/pages/products/[id]/edit-stocks-and-prices/components/stocks-and-prices-edit-form.tsx
new file mode 100644
index 000000000..d66666d8b
--- /dev/null
+++ b/packages/vendor/src/pages/products/[id]/edit-stocks-and-prices/components/stocks-and-prices-edit-form.tsx
@@ -0,0 +1,152 @@
+import { HttpTypes } from "@medusajs/types"
+import { useMemo } from "react"
+import { UseFormReturn, useWatch } from "react-hook-form"
+import { useTranslation } from "react-i18next"
+import { Text } from "@medusajs/ui"
+import {
+ DataGrid,
+ createDataGridHelper,
+ createDataGridPriceColumns,
+ createDataGridLocationStockColumns,
+} from "@components/data-grid"
+import { useRouteModal } from "@components/modals"
+import { usePricePreferences } from "@hooks/api/price-preferences"
+import { useRegions } from "@hooks/api/regions"
+import { useStore } from "@hooks/api/store"
+import { UpdateVariantStocksSchemaType } from "../schema"
+
+type StocksAndPricesFormProps = {
+ form: UseFormReturn<UpdateVariantStocksSchemaType>
+ stockLocations: HttpTypes.AdminStockLocation[]
+ product: HttpTypes.AdminProduct
+}
+
+export const StocksAndPricesEditForm = ({
+ form,
+ stockLocations,
+ product,
+}: StocksAndPricesFormProps) => {
+ const { store } = useStore()
+ const { regions } = useRegions({ limit: 9999 })
+ const { price_preferences: pricePreferences } = usePricePreferences({})
+
+ const { setCloseOnEscape } = useRouteModal()
+
+ const columns = useStocksAndPricesGridColumns({
+ stockLocations,
+ currencies: store?.supported_currencies,
+ regions,
+ pricePreferences,
+ })
+
+ const variants = useWatch({
+ control: form.control,
+ name: "variants",
+ }) as any
+
+ const dataWithProductInfo = useMemo(() => {
+ if (!variants?.length) return []
+
+ const productInfoRow = {
+ id: `product-info-${product.id}`,
+ title: product.title,
+ isProductInfo: true,
+ prices: {},
+ locations: stockLocations.map((location) => ({
+ id: location.id,
+ quantity: null,
+ checked: false,
+ disabledToggle: true,
+ level_id: undefined,
+ })),
+ }
+
+ return [productInfoRow, ...variants]
+ }, [variants, product.title, product.id, stockLocations])
+
+ return (
+ <DataGrid
+ columns={columns}
+ data={dataWithProductInfo}
+ state={form}
+ onEditingChange={(editing) => setCloseOnEscape(!editing)}
+ />
+ )
+}
+
+const columnHelper = createDataGridHelper<
+ HttpTypes.AdminProductVariant,
+ any
+>()
+
+const useStocksAndPricesGridColumns = ({
+ stockLocations = [],
+ currencies = [],
+ regions = [],
+ pricePreferences = [],
+}: {
+ stockLocations?: HttpTypes.AdminStockLocation[]
+ currencies?: HttpTypes.AdminStore["supported_currencies"]
+ regions?: HttpTypes.AdminRegion[]
+ pricePreferences?: HttpTypes.AdminPricePreference[]
+}) => {
+ const { t } = useTranslation()
+
+ return useMemo(() => {
+ return [
+ columnHelper.column({
+ id: t("fields.title"),
+ header: t("fields.title"),
+ cell: (context) => {
+ const entity = context.row.original
+ const isProductInfo = (entity as any).isProductInfo
+
+ return (
+ <DataGrid.ReadonlyCell context={context}>
+ <div
+ className={`flex items-center gap-x-2 overflow-hidden ${
+ isProductInfo
+ ? "bg-ui-bg-field text-ui-fg-disabled"
+ : "text-ui-fg-subtle"
+ }`}
+ >
+ <Text as="span" className="truncate">
+ {entity.title}
+ </Text>
+ </div>
+ </DataGrid.ReadonlyCell>
+ )
+ },
+ disableHiding: true,
+ }),
+ ...createDataGridLocationStockColumns<
+ HttpTypes.AdminProductVariant,
+ any
+ >({
+ stockLocations,
+ isReadyOnly: (context) => (context.row.original as any).isProductInfo,
+ getFieldName: (context, stockLocationIndex) => {
+ const entity = context.row.original as any
+ if (entity.isProductInfo) return null
+ return `variants.${context.row.index - 1}.locations.${stockLocationIndex}` as any
+ },
+ t,
+ }),
+ ...createDataGridPriceColumns<
+ HttpTypes.AdminProductVariant,
+ any
+ >({
+ currencies: currencies.map((c) => c.currency_code),
+ regions: [],
+ pricePreferences,
+ isReadyOnly: (context) => (context.row.original as any).isProductInfo,
+ getFieldName: (context, value) => {
+ const entity = context.row.original as any
+ if (entity.isProductInfo) return null
+ return `variants.${context.row.index - 1}.prices.${value}`
+ },
+ t,
+ }),
+ ]
+ }, [t, currencies, regions, pricePreferences, stockLocations])
+}
diff --git a/packages/vendor/src/pages/products/[id]/edit-stocks-and-prices/components/stocks-and-prices-edit.tsx b/packages/vendor/src/pages/products/[id]/edit-stocks-and-prices/components/stocks-and-prices-edit.tsx
new file mode 100644
index 000000000..0917d87f1
--- /dev/null
+++ b/packages/vendor/src/pages/products/[id]/edit-stocks-and-prices/components/stocks-and-prices-edit.tsx
@@ -0,0 +1,216 @@
+import { zodResolver } from "@hookform/resolvers/zod"
+import { HttpTypes } from "@medusajs/types"
+import { Button, toast } from "@medusajs/ui"
+import { useForm } from "react-hook-form"
+import { useTranslation } from "react-i18next"
+
+import { RouteFocusModal, useRouteModal } from "@components/modals"
+import { KeyboundForm } from "@components/utilities/keybound-form"
+import { useBatchInventoryItemsLocationLevels } from "@hooks/api/inventory"
+import { useUpdateProductVariantsBatch } from "@hooks/api/products"
+import { castNumber } from "@lib/cast-number"
+import { InventoryItemWithLevels } from "@hooks/api/inventory"
+import { UpdateVariantStocksSchema, UpdateVariantStocksSchemaType } from "../schema"
+import { StocksAndPricesEditForm } from "./stocks-and-prices-edit-form"
+
+type StocksAndPricesEditProps = {
+ product: any
+ inventoryItems: InventoryItemWithLevels[]
+ stockLocations: HttpTypes.AdminStockLocation[]
+ productId: string
+}
+
+const createFormValues = (
+ product: any,
+ stockLocations: HttpTypes.AdminStockLocation[],
+ inventoryItems: InventoryItemWithLevels[]
+) => {
+ if (!product?.variants) return { variants: [] }
+
+ const data = product.variants.reduce(
+ (acc: any[], variant: HttpTypes.AdminProductVariant) => {
+ const prices =
+ variant.prices?.reduce((acc: Record<string, number>, price) => {
+ acc[price.currency_code] = price.amount
+ return acc
+ }, {}) || {}
+
+ const locations =
+ stockLocations?.map((location) => {
+ const inventoryItem = inventoryItems?.find(
+ (item) =>
+ item.inventory_item_id ===
+ variant.inventory_items?.[0]?.inventory_item_id
+ )
+ const value = inventoryItem?.location_levels?.find(
+ (level) => level.location_id === location.id
+ )
+
+ return {
+ id: location.id,
+ level_id: value?.id,
+ quantity:
+ typeof value?.stocked_quantity === "number"
+ ? value.stocked_quantity
+ : null,
+ checked: !!value,
+ disabledToggle: false,
+ }
+ }) || []
+
+ acc.push({
+ id: variant.id,
+ title: variant.title,
+ inventory_item_id: variant.inventory_items?.[0]?.inventory_item_id,
+ prices,
+ locations,
+ })
+ return acc
+ },
+ []
+ )
+ return { variants: data }
+}
+
+const getPricesPayload = (
+ variants: UpdateVariantStocksSchemaType["variants"]
+) => {
+ return variants
+ .filter((variant) => Object.keys(variant.prices || {}).length)
+ .map((variant) => {
+ const prices = Object.entries(variant.prices || {})
+ .filter(
+ ([_, amount]) =>
+ amount !== null && amount !== undefined && amount !== ""
+ )
+ .map(([currency_code, amount]) => ({
+ currency_code,
+ amount: typeof amount === "string" ? parseFloat(amount) : amount,
+ }))
+
+ return {
+ id: variant.id,
+ prices,
+ }
+ })
+}
+
+const getInventoryLocationLevelsPayload = (
+ variants: UpdateVariantStocksSchemaType["variants"]
+) => {
+ const payload: HttpTypes.AdminBatchInventoryItemsLocationLevels = {
+ create: [],
+ update: [],
+ delete: [],
+ force: true,
+ }
+
+ variants.forEach((variant) => {
+ variant.locations?.forEach(({ checked, level_id, quantity, id }) => {
+ if (!level_id && checked) {
+ payload.create.push({
+ inventory_item_id: variant.inventory_item_id as string,
+ location_id: id,
+ stocked_quantity: quantity ? castNumber(quantity) : 0,
+ })
+ } else if (level_id && !checked) {
+ payload.delete.push(level_id)
+ } else if (level_id && checked) {
+ payload.update.push({
+ inventory_item_id: variant.inventory_item_id as string,
+ location_id: id,
+ stocked_quantity: quantity ? castNumber(quantity) : 0,
+ })
+ }
+ })
+ })
+ return payload
+}
+
+export const StocksAndPricesEdit = ({
+ product,
+ inventoryItems,
+ stockLocations,
+ productId,
+}: StocksAndPricesEditProps) => {
+ const { t } = useTranslation()
+ const { handleSuccess } = useRouteModal()
+
+ const form = useForm<UpdateVariantStocksSchemaType>({
+ defaultValues: createFormValues(product, stockLocations, inventoryItems),
+ resolver: zodResolver(UpdateVariantStocksSchema, {}),
+ })
+
+ const updateVariantsBatch = useUpdateProductVariantsBatch(productId)
+ const updateInventoryLocationLevels = useBatchInventoryItemsLocationLevels()
+
+ const handleSave = form.handleSubmit(async (data) => {
+ try {
+ const pricesPayload = getPricesPayload(data.variants)
+ const inventoryPayload = getInventoryLocationLevelsPayload(data.variants)
+
+ await Promise.all([
+ updateVariantsBatch.mutateAsync(pricesPayload),
+ updateInventoryLocationLevels.mutateAsync(inventoryPayload),
+ ])
+
+ toast.success(
+ t("products.variants.editStocksAndPrices.successToast")
+ )
+ handleSuccess(`/products/${product.id}`)
+ } catch (error) {
+ if (error instanceof Error) {
+ toast.error(error.message)
+ }
+ }
+ })
+
+ const isLoading =
+ updateVariantsBatch.isPending || updateInventoryLocationLevels.isPending
+
+ return (
+ <RouteFocusModal.Form form={form}>
+ <KeyboundForm
+ onSubmit={handleSave}
+ className="flex size-full flex-col"
+ >
+ <RouteFocusModal.Header>
+ <RouteFocusModal.Title asChild>
+ <span className="sr-only">
+ {t("products.variants.editStocksAndPrices.header")}
+ </span>
+ </RouteFocusModal.Title>
+ <RouteFocusModal.Description asChild>
+ <span className="sr-only">
+ {t("products.variants.editStocksAndPrices.description")}
+ </span>
+ </RouteFocusModal.Description>
+ </RouteFocusModal.Header>
+ <RouteFocusModal.Body className="flex flex-col overflow-hidden">
+ <StocksAndPricesEditForm
+ form={form}
+ stockLocations={stockLocations}
+ product={product}
+ />
+ </RouteFocusModal.Body>
+ <RouteFocusModal.Footer>
+ <div className="flex w-full items-center justify-end gap-x-2">
+ <RouteFocusModal.Close asChild>
+ <Button variant="secondary" size="small">
+ {t("actions.cancel")}
+ </Button>
+ </RouteFocusModal.Close>
+ <Button
+ type="submit"
+ variant="primary"
+ size="small"
+ isLoading={isLoading}
+ >
+ {t("actions.save")}
+ </Button>
+ </div>
+ </RouteFocusModal.Footer>
+ </KeyboundForm>
+ </RouteFocusModal.Form>
+ )
+}
diff --git a/packages/vendor/src/pages/products/[id]/edit-stocks-and-prices/index.tsx b/packages/vendor/src/pages/products/[id]/edit-stocks-and-prices/index.tsx
new file mode 100644
index 000000000..1baadbe4f
--- /dev/null
+++ b/packages/vendor/src/pages/products/[id]/edit-stocks-and-prices/index.tsx
@@ -0,0 +1,85 @@
+import { useMemo } from "react"
+import { useParams } from "react-router-dom"
+
+import { RouteFocusModal } from "@components/modals"
+import { useStockLocations } from "@hooks/api"
+import { useMultipleInventoryItemLevels } from "@hooks/api/inventory"
+import { useProduct } from "@hooks/api/products"
+import { StocksAndPricesEdit } from "./components/stocks-and-prices-edit"
+
+export const ProductEditStocksAndPrices = () => {
+ const { id } = useParams()
+
+ if (!id) {
+ return null
+ }
+
+ const {
+ stock_locations,
+ isPending: isStockLocationsPending,
+ isError: isErrorStockLocations,
+ error: errorStockLocations,
+ } = useStockLocations({
+ limit: 9999,
+ })
+
+ const {
+ product,
+ isPending: isProductPending,
+ isError: isProductError,
+ error: productError,
+ } = useProduct(id, {
+ fields: "*variants,*variants.inventory_items,*categories",
+ } as any)
+
+ const inventoryItemIds = useMemo(() => {
+ if (!product || !product.variants) return []
+
+ const ids: string[] = []
+ product.variants.forEach((variant: any) => {
+ variant.inventory_items?.forEach((item: any) => {
+ ids.push(item.inventory_item_id)
+ })
+ })
+
+ return ids
+ }, [product])
+
+ const {
+ inventoryItemsWithLevels,
+ isPending: isInventoryPending,
+ isError: isInventoryError,
+ error: inventoryError,
+ } = useMultipleInventoryItemLevels(inventoryItemIds, {
+ fields: "*stock_locations",
+ })
+
+ const isError = isProductError || isErrorStockLocations || isInventoryError
+ const error = productError || errorStockLocations || inventoryError
+ const isPending =
+ isProductPending || isStockLocationsPending || isInventoryPending
+ const ready =
+ !isPending &&
+ !!product &&
+ !!inventoryItemsWithLevels &&
+ !!stock_locations
+
+ if (isError) {
+ throw error
+ }
+
+ return (
+ <RouteFocusModal>
+ {ready && (
+ <StocksAndPricesEdit
+ product={product}
+ inventoryItems={inventoryItemsWithLevels}
+ stockLocations={stock_locations}
+ productId={id!}
+ />
+ )}
+ </RouteFocusModal>
+ )
+}
+
+export const Component = ProductEditStocksAndPrices
diff --git a/packages/vendor/src/pages/products/[id]/edit-stocks-and-prices/schema.ts b/packages/vendor/src/pages/products/[id]/edit-stocks-and-prices/schema.ts
new file mode 100644
index 000000000..2a04bbf9d
--- /dev/null
+++ b/packages/vendor/src/pages/products/[id]/edit-stocks-and-prices/schema.ts
@@ -0,0 +1,27 @@
+import * as zod from "zod"
+
+const LocationSchema = zod.object({
+ id: zod.string(),
+ quantity: zod.union([zod.number(), zod.string(), zod.null()]).optional(),
+ checked: zod.boolean(),
+ disabledToggle: zod.boolean(),
+ level_id: zod.string().optional(),
+})
+
+export const UpdateVariantStocksSchema = zod.object({
+ variants: zod.array(
+ zod.object({
+ id: zod.string(),
+ title: zod.string().optional(),
+ inventory_item_id: zod.string().optional(),
+ prices: zod
+ .record(zod.string(), zod.string().or(zod.number()).optional())
+ .optional(),
+ locations: zod.array(LocationSchema),
+ })
+ ),
+})
+
+export type UpdateVariantStocksSchemaType = zod.infer<
+ typeof UpdateVariantStocksSchema
+>
diff --git a/packages/vendor/src/pages/products/[id]/informational-attributes/[attribute_id]/edit/index.tsx b/packages/vendor/src/pages/products/[id]/informational-attributes/[attribute_id]/edit/index.tsx
new file mode 100644
index 000000000..440319a8e
--- /dev/null
+++ b/packages/vendor/src/pages/products/[id]/informational-attributes/[attribute_id]/edit/index.tsx
@@ -0,0 +1,2 @@
+// Route: /products/:id/informational-attributes/:attribute_id/edit
+export { ProductEditAttribute as Component } from "../../../../product-edit-attribute/product-edit-attribute"
diff --git a/packages/vendor/src/pages/products/[id]/loader.tsx b/packages/vendor/src/pages/products/[id]/loader.tsx
index 6310da1a0..00275af45 100644
--- a/packages/vendor/src/pages/products/[id]/loader.tsx
+++ b/packages/vendor/src/pages/products/[id]/loader.tsx
@@ -4,9 +4,24 @@ import { productsQueryKeys } from "@hooks/api/products";
import { sdk } from "@lib/client";
import { queryClient } from "@lib/query-client";
+export const PRODUCT_DETAIL_FIELDS = [
+ "*variants.inventory_items",
+ "*variants.images",
+ "*categories",
+ "+additional_data",
+ "+attribute_values.*",
+ "+attribute_values.attribute.*",
+ "+options.*",
+ "+options.values.*",
+].join(",");
+
const productDetailQuery = (id: string) => ({
- queryKey: productsQueryKeys.detail(id),
- queryFn: async () => sdk.vendor.products.$id.query({ $id: id }),
+ queryKey: productsQueryKeys.detail(id, { fields: PRODUCT_DETAIL_FIELDS }),
+ queryFn: async () =>
+ sdk.vendor.products.$id.query({
+ $id: id,
+ fields: PRODUCT_DETAIL_FIELDS,
+ } as any),
});
export const loader = async ({ params }: LoaderFunctionArgs) => {
diff --git a/packages/vendor/src/pages/products/[id]/options/[optionId]/edit/components/edit-product-option-form.tsx b/packages/vendor/src/pages/products/[id]/options/[optionId]/edit/components/edit-product-option-form.tsx
new file mode 100644
index 000000000..c1ef7db97
--- /dev/null
+++ b/packages/vendor/src/pages/products/[id]/options/[optionId]/edit/components/edit-product-option-form.tsx
@@ -0,0 +1,223 @@
+import { zodResolver } from "@hookform/resolvers/zod"
+import { Button, InlineTip, Input, usePrompt } from "@medusajs/ui"
+import { useForm } from "react-hook-form"
+import { useTranslation } from "react-i18next"
+import { z } from "zod"
+
+import { Form } from "@components/common/form"
+import { SwitchBox } from "@components/common/switch-box"
+import { Combobox } from "@components/inputs/combobox"
+import { RouteDrawer, useRouteModal } from "@components/modals"
+import { i18n } from "@components/utilities/i18n"
+import { KeyboundForm } from "@components/utilities/keybound-form"
+import {
+ useProductAttributes,
+ useUpdateProductOption,
+} from "@hooks/api/products"
+import type { ExtendedAdminProductOption } from "@pages/products/types"
+
+type EditProductOptionFormProps = {
+ option: ExtendedAdminProductOption
+}
+
+const EditProductOptionSchema = z.object({
+ title: z
+ .string()
+ .min(1, i18n.t("products.edit.attributes.titleRequired")),
+ values: z
+ .array(z.string())
+ .min(1, i18n.t("products.edit.attributes.valuesRequired")),
+ use_for_variations: z.boolean(),
+})
+
+export const EditProductOptionForm = ({
+ option,
+}: EditProductOptionFormProps) => {
+ const { t } = useTranslation()
+ const { handleSuccess } = useRouteModal()
+ const prompt = usePrompt()
+
+ const isAdminOption = option.metadata?.author === "admin"
+
+ const { attributes } = useProductAttributes(option.product_id!)
+ const attributeDefinition = attributes?.find(
+ (a: any) =>
+ a.id === option.metadata?.attribute_id || a.name === option.title
+ )
+ const predefinedValueOptions =
+ attributeDefinition?.possible_values?.map((v: any) => ({
+ value: v.value,
+ label: v.value,
+ })) ?? []
+
+ const currentValueOptions = (option?.values ?? []).map((v) => ({
+ value: v.value,
+ label: v.value,
+ }))
+
+ const seenValues = new Set<string>()
+ const allValueOptions = [...predefinedValueOptions, ...currentValueOptions].filter(
+ (o) => {
+ if (seenValues.has(o.value)) return false
+ seenValues.add(o.value)
+ return true
+ }
+ )
+
+ const form = useForm<z.infer<typeof EditProductOptionSchema>>({
+ defaultValues: {
+ title: option.title,
+ values: option?.values?.map((v) => v.value),
+ use_for_variations: true,
+ },
+ resolver: zodResolver(EditProductOptionSchema),
+ })
+
+ const useForVariations = form.watch("use_for_variations")
+
+ const { mutateAsync: updateOption, isPending } = useUpdateProductOption(
+ option.product_id!,
+ option.id
+ )
+
+ const handleSubmit = form.handleSubmit(async (data) => {
+ if (isAdminOption) {
+ if (data.title !== option.title) {
+ const confirmed = await prompt({
+ title: t(
+ "products.edit.attributes.editCustomValueTitle",
+ "Edit Attribute"
+ ),
+ description: t(
+ "products.edit.attributes.editCustomValueDescription",
+ "Replacing this attribute with a custom one will affect how your products appear in search and filters. Custom attributes are not searchable or filterable. Do you want to continue?"
+ ),
+ })
+
+ if (!confirmed) return
+ }
+
+ await updateOption(
+ {
+ title: data.title,
+ values: data.values,
+ metadata: { author: "vendor" },
+ } as any,
+ {
+ onSuccess: () => handleSuccess(),
+ }
+ )
+
+ return
+ }
+
+ const { use_for_variations, ...rest } = data
+
+ if (!use_for_variations) {
+ await updateOption({ convert_to_attribute: true } as any, {
+ onSuccess: () => handleSuccess(),
+ })
+
+ return
+ }
+
+ await updateOption(rest as any, { onSuccess: () => handleSuccess() })
+ })
+
+ return (
+ <RouteDrawer.Form form={form}>
+ <KeyboundForm
+ onSubmit={handleSubmit}
+ className="flex flex-1 flex-col overflow-hidden"
+ >
+ <RouteDrawer.Body className="flex flex-1 flex-col gap-y-4 overflow-auto">
+ <div className="flex flex-col gap-y-2 rounded-xl border bg-ui-bg-component p-1.5">
+ <div className="flex flex-col gap-y-2">
+ <Form.Field
+ control={form.control}
+ name="title"
+ render={({ field }) => {
+ return (
+ <Form.Item className="flex flex-row items-start gap-x-1.5 space-y-0 [&>div:last-child]:w-full">
+ <Form.Label className="min-w-[60px] px-2 py-1.5">
+ {t("products.fields.options.optionTitle")}
+ </Form.Label>
+ <Form.Control>
+ <div className="flex w-full flex-col gap-y-1.5">
+ <Input
+ {...field}
+ disabled={!useForVariations}
+ placeholder={t(
+ "products.fields.options.optionTitlePlaceholder"
+ )}
+ className="w-full bg-ui-bg-base"
+ />
+ <Form.ErrorMessage />
+ </div>
+ </Form.Control>
+ </Form.Item>
+ )
+ }}
+ />
+ <Form.Field
+ control={form.control}
+ name="values"
+ render={({ field }) => {
+ return (
+ <Form.Item className="flex flex-row items-start gap-x-1.5 space-y-0">
+ <Form.Label className="min-w-[60px] px-2 py-1.5">
+ {t("products.fields.options.variations")}
+ </Form.Label>
+ <Form.Control>
+ <div className="flex w-full flex-col gap-y-1.5">
+ <Combobox
+ value={field.value}
+ onChange={(val) => field.onChange(val ?? [])}
+ options={allValueOptions}
+ disabled={!useForVariations}
+ placeholder={t(
+ "products.fields.options.variantionsPlaceholder"
+ )}
+ className="w-full bg-ui-bg-base"
+ />
+ <Form.ErrorMessage />
+ </div>
+ </Form.Control>
+ </Form.Item>
+ )
+ }}
+ />
+ </div>
+ <SwitchBox
+ control={form.control}
+ name="use_for_variations"
+ label={t("products.edit.attributes.useForVariations")}
+ description={t(
+ "products.edit.attributes.useForVariationsDescription"
+ )}
+ className="pl-14 [&>*]:shadow-none"
+ />
+ </div>
+
+ {!useForVariations && (
+ <InlineTip variant="warning" label={t("general.warning")}>
+ {t("products.edit.attributes.conversionWarning")}
+ </InlineTip>
+ )}
+ </RouteDrawer.Body>
+ <RouteDrawer.Footer>
+ <div className="flex items-center justify-end gap-x-2">
+ <RouteDrawer.Close asChild>
+ <Button variant="secondary" size="small">
+ {t("actions.cancel")}
+ </Button>
+ </RouteDrawer.Close>
+ <Button type="submit" size="small" isLoading={isPending}>
+ {t("actions.save")}
+ </Button>
+ </div>
+ </RouteDrawer.Footer>
+ </KeyboundForm>
+ </RouteDrawer.Form>
+ )
+}
diff --git a/packages/vendor/src/pages/products/[id]/options/[optionId]/edit/index.ts b/packages/vendor/src/pages/products/[id]/options/[optionId]/edit/index.ts
new file mode 100644
index 000000000..0d70a2c55
--- /dev/null
+++ b/packages/vendor/src/pages/products/[id]/options/[optionId]/edit/index.ts
@@ -0,0 +1 @@
+export { ProductEditOption as Component } from "./product-edit-option"
diff --git a/packages/vendor/src/pages/products/[id]/options/[optionId]/edit/product-edit-option.tsx b/packages/vendor/src/pages/products/[id]/options/[optionId]/edit/product-edit-option.tsx
new file mode 100644
index 000000000..ca4c64cd2
--- /dev/null
+++ b/packages/vendor/src/pages/products/[id]/options/[optionId]/edit/product-edit-option.tsx
@@ -0,0 +1,38 @@
+import { Heading } from "@medusajs/ui"
+import { useTranslation } from "react-i18next"
+import { json, useParams } from "react-router-dom"
+
+import { RouteDrawer } from "@components/modals"
+import { useProduct } from "@hooks/api/products"
+import { EditProductOptionForm } from "./components/edit-product-option-form"
+
+export const ProductEditOption = () => {
+ const { id, option_id } = useParams()
+ const { t } = useTranslation()
+
+ const { product, isPending, isFetching, isError, error } = useProduct(id!)
+
+ const option = product?.options?.find((o) => o.id === option_id)
+
+ if (!isPending && !isFetching && !option) {
+ throw json(
+ { message: `An option with ID ${option_id} was not found` },
+ 404
+ )
+ }
+
+ if (isError) {
+ throw error
+ }
+
+ return (
+ <RouteDrawer>
+ <RouteDrawer.Header>
+ <RouteDrawer.Title asChild>
+ <Heading>{t("products.options.edit.header")}</Heading>
+ </RouteDrawer.Title>
+ </RouteDrawer.Header>
+ {option && <EditProductOptionForm option={option} />}
+ </RouteDrawer>
+ )
+}
diff --git a/packages/vendor/src/pages/products/[id]/organization/product-organization-form/product-organization-form.tsx b/packages/vendor/src/pages/products/[id]/organization/product-organization-form/product-organization-form.tsx
index 18f907f42..d767f3b1f 100644
--- a/packages/vendor/src/pages/products/[id]/organization/product-organization-form/product-organization-form.tsx
+++ b/packages/vendor/src/pages/products/[id]/organization/product-organization-form/product-organization-form.tsx
@@ -1,6 +1,9 @@
-import { ExtendedAdminProduct } from "@custom-types/products";
+import { useMemo } from "react";
+import { HttpTypes } from "@medusajs/types";
import { Button, toast } from "@medusajs/ui";
import { useTranslation } from "react-i18next";
+import { useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
import * as zod from "zod";
import { Form } from "@components/common/form";
@@ -9,25 +12,91 @@ import { RouteDrawer, useRouteModal } from "@components/modals";
import { KeyboundForm } from "@components/utilities/keybound-form";
import { useUpdateProduct } from "@hooks/api/products";
import { useComboboxData } from "@hooks/use-combobox-data";
-import { sdk, fetchQuery } from "@lib/client";
+import { sdk } from "@lib/client";
import { CategoryCombobox } from "@pages/products/common/components/category-combobox";
-import { useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
+import { ExtendedAdminProduct } from "@custom-types/products";
type ProductOrganizationFormProps = {
product: ExtendedAdminProduct;
};
+type ProductWithAdditionalData = ExtendedAdminProduct & {
+ additional_data?: {
+ secondary_categories?: Array<{
+ sec_cat_product_key?: string;
+ category_ids?: string[];
+ secondary_categories_ids?: string[];
+ }>;
+ };
+ secondary_categories?: HttpTypes.AdminProductCategory[];
+};
+
+const uniq = (arr: string[]) => Array.from(new Set(arr.filter(Boolean)));
+const isCategoryId = (id: string) => id.startsWith("pcat_");
+const isSecondaryCategoryRelationId = (id: string) => id.startsWith("sec_cat_");
+
+const getSecondaryCategoriesSnapshot = (product: ProductWithAdditionalData) => {
+ const relationEntries = (product.secondary_categories ?? []) as any[];
+
+ const relationSecCatIds = relationEntries
+ .map((cat: any) => cat?.id)
+ .filter((id: any): id is string => typeof id === "string" && isSecondaryCategoryRelationId(id));
+
+ const relationCategoryIds = relationEntries
+ .map((cat: any) => {
+ const candidates = [
+ cat?.id, cat?.category_id, cat?.product_category_id,
+ cat?.product_category?.id, cat?.category?.id,
+ ].filter(Boolean) as string[];
+ return candidates.find(isCategoryId);
+ })
+ .filter((id): id is string => Boolean(id));
+
+ const entries = product.additional_data?.secondary_categories ?? [];
+ const additionalCategoryIds = entries.flatMap((entry) => (entry as any)?.category_ids ?? []);
+ const additionalIds = entries.flatMap((entry) => (entry as any)?.secondary_categories_ids ?? []);
+ const additionalCategoryIdsFromSecondaryIds = additionalIds.filter(isCategoryId);
+ const additionalSecCatIds = additionalIds.filter(isSecondaryCategoryRelationId);
+
+ const categoryIds = uniq(
+ relationCategoryIds.length
+ ? relationCategoryIds
+ : additionalCategoryIds.length
+ ? additionalCategoryIds
+ : additionalCategoryIdsFromSecondaryIds
+ );
+
+ const secCatIdByCategoryId = new Map<string, string>();
+ relationEntries.forEach((entry: any) => {
+ const secCatId = typeof entry?.id === "string" && isSecondaryCategoryRelationId(entry.id) ? entry.id : undefined;
+ const catIdCandidates = [entry?.category_id, entry?.product_category_id, entry?.product_category?.id, entry?.category?.id].filter(Boolean) as string[];
+ const catId = catIdCandidates.find(isCategoryId);
+ if (secCatId && catId) secCatIdByCategoryId.set(catId, secCatId);
+ });
+
+ if (additionalCategoryIds.length > 0 && additionalSecCatIds.length > 0 && additionalCategoryIds.length === additionalSecCatIds.length) {
+ for (let i = 0; i < additionalCategoryIds.length; i++) {
+ secCatIdByCategoryId.set(additionalCategoryIds[i], additionalSecCatIds[i]);
+ }
+ }
+
+ return { categoryIds, secCatIds: uniq([...relationSecCatIds, ...additionalSecCatIds]), secCatIdByCategoryId };
+};
+
+const diff = (next: string[], prev: string[]) => {
+ const prevSet = new Set(prev);
+ return next.filter((id) => !prevSet.has(id));
+};
+
const ProductOrganizationSchema = zod.object({
type_id: zod.string().nullable(),
collection_id: zod.string().nullable(),
- categories: zod.array(zod.string()),
- tag_ids: zod.array(zod.string()),
+ categories: zod.array(zod.string()).min(1),
+ secondary_categories: zod.array(zod.string()).optional(),
+ tag_ids: zod.array(zod.string()).nullable(),
});
-export const ProductOrganizationForm = ({
- product,
-}: ProductOrganizationFormProps) => {
+export const ProductOrganizationForm = ({ product }: ProductOrganizationFormProps) => {
const { t } = useTranslation();
const { handleSuccess } = useRouteModal();
@@ -69,11 +138,17 @@ export const ProductOrganizationForm = ({
})),
});
+ const secondarySnapshot = useMemo(
+ () => getSecondaryCategoriesSnapshot(product as ProductWithAdditionalData),
+ [product]
+ );
+
const form = useForm({
defaultValues: {
type_id: product.type_id ?? "",
collection_id: product.collection_id ?? "",
- categories: product.categories?.map((c) => c.id) || [],
+ categories: product.categories?.map((cat) => cat.id) || [],
+ secondary_categories: secondarySnapshot.categoryIds,
tag_ids: product.tags?.map((t) => t.id) || [],
},
resolver: zodResolver(ProductOrganizationSchema),
@@ -82,27 +157,50 @@ export const ProductOrganizationForm = ({
const { mutateAsync, isPending } = useUpdateProduct(product.id);
const handleSubmit = form.handleSubmit(async (data) => {
- await mutateAsync(
- {
- type_id: data.type_id ? data.type_id : undefined,
- collection_id: data.collection_id ? data.collection_id : undefined,
- categories: data.categories?.map((id) => ({ id })) ?? [],
- tags: data.tag_ids?.map((t) => ({ id: t })) ?? [],
- },
- {
- onSuccess: ({ product }) => {
- toast.success(
- t("products.organization.edit.toasts.success", {
- title: product.title,
- }),
- );
- handleSuccess();
- },
- onError: (error) => {
- toast.error(error.message);
+ const nextCategoryIds = uniq(Array.isArray(data.secondary_categories) ? data.secondary_categories : []);
+ const currentCategoryIds = secondarySnapshot.categoryIds;
+ const addCategoryIds = diff(nextCategoryIds, currentCategoryIds);
+ const removedCategoryIds = diff(currentCategoryIds, nextCategoryIds);
+
+ const existingSecCatIds = secondarySnapshot.secCatIds;
+ const removeSecCatIdsFromMap = removedCategoryIds
+ .map((catId) => secondarySnapshot.secCatIdByCategoryId.get(catId))
+ .filter((id): id is string => Boolean(id));
+ const canMapAllRemovals = removedCategoryIds.length === removeSecCatIdsFromMap.length;
+ const removeSecCatIds = uniq(
+ removedCategoryIds.length === 0 ? [] : canMapAllRemovals ? removeSecCatIdsFromMap : existingSecCatIds
+ );
+
+ const hasSecondaryCatsChanges = addCategoryIds.length > 0 || removedCategoryIds.length > 0;
+
+ const payload = {
+ type_id: data.type_id || null,
+ collection_id: data.collection_id || null,
+ categories: data.categories?.map((id) => ({ id })) || [],
+ tags: data.tag_ids?.map((t) => ({ id: t })) ?? [],
+ ...(hasSecondaryCatsChanges && {
+ additional_data: {
+ secondary_categories: [
+ {
+ product_id: product.id,
+ add: canMapAllRemovals ? addCategoryIds : nextCategoryIds,
+ remove: removeSecCatIds,
+ secondary_categories_ids: existingSecCatIds,
+ },
+ ],
},
+ }),
+ } as HttpTypes.AdminUpdateProduct;
+
+ await mutateAsync(payload as any, {
+ onSuccess: ({ product }: any) => {
+ toast.success(t("products.organization.edit.toasts.success", { title: product?.title }));
+ handleSuccess();
},
- );
+ onError: (error: any) => {
+ toast.error(error.message);
+ },
+ });
});
return (
@@ -112,89 +210,93 @@ export const ProductOrganizationForm = ({
<div className="flex h-full flex-col gap-y-4">
<Form.Field
control={form.control}
- name="type_id"
- render={({ field }) => {
- return (
- <Form.Item>
- <Form.Label optional>
- {t("products.fields.type.label")}
- </Form.Label>
- <Form.Control>
- <Combobox
- {...field}
- options={types.options}
- searchValue={types.searchValue}
- onSearchValueChange={types.onSearchValueChange}
- fetchNextPage={types.fetchNextPage}
- />
- </Form.Control>
- <Form.ErrorMessage />
- </Form.Item>
- );
- }}
+ name="tag_ids"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>{t("products.fields.tags.label")}</Form.Label>
+ <Form.Control>
+ <Combobox
+ {...field}
+ multiple
+ options={tags.options}
+ onSearchValueChange={tags.onSearchValueChange}
+ searchValue={tags.searchValue}
+ allowClear
+ />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
/>
<Form.Field
control={form.control}
- name="collection_id"
- render={({ field }) => {
- return (
- <Form.Item>
- <Form.Label optional>
- {t("products.fields.collection.label")}
- </Form.Label>
- <Form.Control>
- <Combobox
- {...field}
- multiple={false}
- options={collections.options}
- onSearchValueChange={collections.onSearchValueChange}
- searchValue={collections.searchValue}
- />
- </Form.Control>
- <Form.ErrorMessage />
- </Form.Item>
- );
- }}
+ name="type_id"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>{t("products.fields.type.label")}</Form.Label>
+ <Form.Control>
+ <Combobox
+ {...field}
+ options={types.options}
+ searchValue={types.searchValue}
+ onSearchValueChange={types.onSearchValueChange}
+ fetchNextPage={types.fetchNextPage}
+ allowClear
+ />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
/>
<Form.Field
control={form.control}
name="categories"
- render={({ field }) => {
- return (
- <Form.Item>
- <Form.Label optional>
- {t("products.fields.categories.label")}
- </Form.Label>
- <Form.Control>
- <CategoryCombobox {...field} />
- </Form.Control>
- <Form.ErrorMessage />
- </Form.Item>
- );
- }}
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label tooltip={t("products.fields.primaryCategory.tooltip")}>
+ {t("products.fields.primaryCategory.label")}
+ </Form.Label>
+ <Form.Control>
+ <CategoryCombobox {...field} isSingleSelect allowClear={false} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
/>
<Form.Field
control={form.control}
- name="tag_ids"
- render={({ field }) => {
- return (
- <Form.Item>
- <Form.Label optional>
- {t("products.fields.tags.label")}
- </Form.Label>
- <Form.Control>
- <Combobox
- {...field}
- multiple
- options={tags.options}
- onSearchValueChange={tags.onSearchValueChange}
- searchValue={tags.searchValue}
- />
- </Form.Control>
- <Form.ErrorMessage />
- </Form.Item>
- );
- }}
+ name="secondary_categories"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>
+ {t("products.fields.secondaryCategories.label", "Secondary Categories")}
+ </Form.Label>
+ <Form.Control>
+ <CategoryCombobox {...field} value={field.value || []} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ <Form.Field
+ control={form.control}
+ name="collection_id"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>{t("products.fields.collection.label")}</Form.Label>
+ <Form.Control>
+ <Combobox
+ {...field}
+ multiple={false}
+ options={collections.options}
+ onSearchValueChange={collections.onSearchValueChange}
+ searchValue={collections.searchValue}
+ allowClear
+ />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
/>
</div>
</RouteDrawer.Body>
diff --git a/packages/vendor/src/pages/products/[id]/product-detail-page.tsx b/packages/vendor/src/pages/products/[id]/product-detail-page.tsx
index ce09ca052..279d213a9 100644
--- a/packages/vendor/src/pages/products/[id]/product-detail-page.tsx
+++ b/packages/vendor/src/pages/products/[id]/product-detail-page.tsx
@@ -38,12 +38,11 @@ const Root = ({ children }: { children?: ReactNode }) => {
<TwoColumnPage.Main>
<ProductGeneralSection />
<ProductMediaSection />
- <ProductOptionSection />
<ProductVariantSection />
</TwoColumnPage.Main>
<TwoColumnPage.Sidebar>
- <ProductShippingProfileSection />
<ProductOrganizationSection />
+ <ProductAdditionalAttributesSection product={product} />
</TwoColumnPage.Sidebar>
</TwoColumnPage>
)}
diff --git a/packages/vendor/src/pages/products/_components/product-list-table/product-list-data-table.tsx b/packages/vendor/src/pages/products/_components/product-list-table/product-list-data-table.tsx
index dd7849179..f3510d094 100644
--- a/packages/vendor/src/pages/products/_components/product-list-table/product-list-data-table.tsx
+++ b/packages/vendor/src/pages/products/_components/product-list-table/product-list-data-table.tsx
@@ -7,7 +7,8 @@ import {
} from "@tanstack/react-table";
import { useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
-import { Trash } from "@medusajs/icons";
+import { useNavigate } from "react-router-dom";
+import { PencilSquare, Trash } from "@medusajs/icons";
import { ExtendedAdminProduct } from "@custom-types/products";
import { ActionMenu } from "@components/common/action-menu";
@@ -26,6 +27,7 @@ export const PAGE_SIZE = 10;
export const ProductListDataTable = () => {
const { t } = useTranslation();
+ const navigate = useNavigate();
const [rowSelection, setRowSelection] = useState<RowSelectionState>({});
@@ -133,6 +135,21 @@ export const ProductListDataTable = () => {
},
]}
commands={[
+ {
+ action: () => {
+ const selectedIds = Object.keys(rowSelection)
+ const selectedProducts = (products ?? []).filter((p: any) =>
+ selectedIds.includes(p.id)
+ )
+ if (selectedProducts.length > 0) {
+ navigate("bulk-edit", {
+ state: { products: selectedProducts },
+ })
+ }
+ },
+ label: t("actions.edit"),
+ shortcut: "e",
+ },
{
action: handleDelete,
label: t("actions.delete"),
diff --git a/packages/vendor/src/pages/products/bulk-edit/index.tsx b/packages/vendor/src/pages/products/bulk-edit/index.tsx
new file mode 100644
index 000000000..2d630967f
--- /dev/null
+++ b/packages/vendor/src/pages/products/bulk-edit/index.tsx
@@ -0,0 +1,2 @@
+// Route: /products/bulk-edit
+export { ProductBulkEdit as Component } from "../product-bulk-edit/product-bulk-edit"
diff --git a/packages/vendor/src/pages/products/common/components/category-combobox/category-combobox.tsx b/packages/vendor/src/pages/products/common/components/category-combobox/category-combobox.tsx
index efbe8621d..88367563f 100644
--- a/packages/vendor/src/pages/products/common/components/category-combobox/category-combobox.tsx
+++ b/packages/vendor/src/pages/products/common/components/category-combobox/category-combobox.tsx
@@ -32,6 +32,8 @@ interface CategoryComboboxProps extends Omit<
> {
value: string[];
onChange: (value: string[]) => void;
+ isSingleSelect?: boolean;
+ allowClear?: boolean;
}
type Level = {
@@ -45,7 +47,7 @@ const TAG_BASE_WIDTH = 28;
export const CategoryCombobox = forwardRef<
HTMLInputElement,
CategoryComboboxProps
->(({ value, onChange, className, ...props }, ref) => {
+>(({ value, onChange, className, isSingleSelect, allowClear, ...props }, ref) => {
const innerRef = useRef<HTMLInputElement>(null);
useImperativeHandle<HTMLInputElement | null, HTMLInputElement | null>(
diff --git a/packages/vendor/src/pages/products/create/constants.ts b/packages/vendor/src/pages/products/create/constants.ts
index e1fc08b9b..13eb645ac 100644
--- a/packages/vendor/src/pages/products/create/constants.ts
+++ b/packages/vendor/src/pages/products/create/constants.ts
@@ -40,23 +40,27 @@ const ProductCreateVariantSchema = z.object({
})
)
.optional(),
+ media: z.array(MediaSchema).optional(),
})
export type ProductCreateVariantSchema = z.infer<
typeof ProductCreateVariantSchema
>
-const ProductCreateOptionSchema = z.object({
- title: z.string(),
- values: z.array(z.string()).min(1),
+export const ProductCreateOptionSchema = z.object({
+ title: z.string().min(1, i18n.t("products.fields.attributes.add.title.required")),
+ values: z.array(z.string()).min(1, i18n.t("products.fields.attributes.add.values.required")),
+ metadata: z.record(z.unknown()).optional(),
+ useForVariants: z.boolean().optional(),
+ attributeId: z.string().optional(),
})
-export type ProductCreateOptionSchema = z.infer<
+export type ProductCreateOptionSchemaType = z.infer<
typeof ProductCreateOptionSchema
>
export const ProductCreateBaseSchema = z.object({
- title: z.string().min(1),
+ title: z.string().min(1, i18n.t("products.fields.title.required")),
subtitle: z.string().optional(),
handle: z.string().optional(),
description: z.string().optional(),
@@ -64,7 +68,8 @@ export const ProductCreateBaseSchema = z.object({
type_id: z.string().optional(),
collection_id: z.string().optional(),
shipping_profile_id: z.string().optional(),
- categories: z.array(z.string()),
+ categories: z.array(z.string()).min(1, i18n.t("products.create.errors.primaryCategoryRequired")),
+ secondary_categories: z.array(z.string()).optional(),
tags: z.array(z.string()).optional(),
sales_channels: z
.array(
@@ -82,7 +87,7 @@ export const ProductCreateBaseSchema = z.object({
weight: z.string().optional(),
mid_code: z.string().optional(),
hs_code: z.string().optional(),
- options: z.array(ProductCreateOptionSchema).min(1),
+ options: z.array(ProductCreateOptionSchema),
enable_variants: z.boolean(),
variants: z.array(ProductCreateVariantSchema).min(1),
media: z.array(MediaSchema).optional(),
@@ -122,15 +127,10 @@ export const EditProductMediaSchema = z.object({
export const PRODUCT_CREATE_FORM_DEFAULTS: Partial<
z.infer<typeof ProductCreateSchema>
> = {
- discountable: true,
+ discountable: false,
tags: [],
sales_channels: [],
- options: [
- {
- title: "Default option",
- values: ["Default option value"],
- },
- ],
+ options: [],
variants: decorateVariantsWithDefaultValues([
{
title: "Default variant",
@@ -146,6 +146,7 @@ export const PRODUCT_CREATE_FORM_DEFAULTS: Partial<
enable_variants: false,
media: [],
categories: [],
+ secondary_categories: [],
collection_id: "",
shipping_profile_id: "",
description: "",
diff --git a/packages/vendor/src/pages/products/create/edit-variant-media-form/edit-variant-media-form.tsx b/packages/vendor/src/pages/products/create/edit-variant-media-form/edit-variant-media-form.tsx
new file mode 100644
index 000000000..38ea76f31
--- /dev/null
+++ b/packages/vendor/src/pages/products/create/edit-variant-media-form/edit-variant-media-form.tsx
@@ -0,0 +1,310 @@
+import { Fragment, useCallback, useEffect, useMemo, useState } from "react"
+
+import { ThumbnailBadge } from "@medusajs/icons"
+import { Checkbox, clx, CommandBar, Tooltip } from "@medusajs/ui"
+import { useTranslation } from "react-i18next"
+
+type MediaItem = {
+ file?: File
+ url?: string
+ isThumbnail?: boolean
+ id?: string
+}
+
+type EditVariantMediaFormProps = {
+ variantIndex: number
+ variantTitle?: string
+ onSaveMedia?: (variantIndex: number, media: MediaItem[]) => void
+ onClose?: () => void
+ saveRef: React.MutableRefObject<(() => void) | null>
+ initialMedia?: MediaItem[]
+ productMedia: MediaItem[]
+}
+
+export const EditVariantMediaForm = ({
+ variantIndex,
+ onSaveMedia,
+ onClose,
+ saveRef,
+ initialMedia = [],
+ productMedia = [],
+}: EditVariantMediaFormProps) => {
+ const { t } = useTranslation()
+
+ const [selectedUrls, setSelectedUrls] = useState<Set<string>>(
+ () => new Set(initialMedia.filter((m) => m.url).map((m) => m.url!))
+ )
+
+ const [thumbnailUrl, setThumbnailUrl] = useState<string | null>(
+ () => {
+ const thumb = initialMedia.find((m) => m.isThumbnail)
+ return thumb?.url ?? null
+ }
+ )
+
+ const [checkedUrls, setCheckedUrls] = useState<
+ Record<string, true>
+ >({})
+
+ const availableMedia = useMemo(
+ () =>
+ productMedia.filter(
+ (m): m is MediaItem & { url: string } => !!m.url
+ ),
+ [productMedia]
+ )
+
+ const selectedImages = useMemo(
+ () => availableMedia.filter((m) => selectedUrls.has(m.url)),
+ [availableMedia, selectedUrls]
+ )
+
+ const unselectedImages = useMemo(
+ () => availableMedia.filter((m) => !selectedUrls.has(m.url)),
+ [availableMedia, selectedUrls]
+ )
+
+ const handleSelectImage = useCallback((url: string) => {
+ setSelectedUrls((prev) => {
+ const next = new Set(prev)
+ next.add(url)
+ return next
+ })
+ }, [])
+
+ const handleDeselectImage = useCallback(
+ (url: string) => {
+ setSelectedUrls((prev) => {
+ const next = new Set(prev)
+ next.delete(url)
+ return next
+ })
+
+ if (thumbnailUrl === url) {
+ setThumbnailUrl(null)
+ }
+
+ const { [url]: _, ...restChecked } = checkedUrls
+ setCheckedUrls(restChecked)
+ },
+ [thumbnailUrl, checkedUrls]
+ )
+
+ const handleCheckedChange = useCallback(
+ (url: string, value: boolean) => {
+ if (!value) {
+ const { [url]: _, ...rest } = checkedUrls
+ setCheckedUrls(rest)
+ return
+ }
+ setCheckedUrls((prev) => ({ ...prev, [url]: true }))
+ },
+ [checkedUrls]
+ )
+
+ const handlePromoteToThumbnail = useCallback(() => {
+ const urls = Object.keys(checkedUrls)
+ if (urls.length !== 1) {
+ return
+ }
+ setThumbnailUrl(urls[0])
+ setCheckedUrls({})
+ }, [checkedUrls])
+
+ const getEffectiveThumbnailUrl = useCallback(() => {
+ if (selectedUrls.size === 0) {
+ return null
+ }
+ if (thumbnailUrl && selectedUrls.has(thumbnailUrl)) {
+ return thumbnailUrl
+ }
+ return [...selectedUrls][0]
+ }, [selectedUrls, thumbnailUrl])
+
+ const handleSave = useCallback(() => {
+ const effectiveThumb = getEffectiveThumbnailUrl()
+ const media: MediaItem[] = [...selectedUrls].map((url) => ({
+ url,
+ isThumbnail: url === effectiveThumb,
+ }))
+ onSaveMedia?.(variantIndex, media)
+ onClose?.()
+ }, [
+ getEffectiveThumbnailUrl,
+ selectedUrls,
+ onSaveMedia,
+ variantIndex,
+ onClose,
+ ])
+
+ useEffect(() => {
+ saveRef.current = handleSave
+ }, [handleSave, saveRef])
+
+ const checkedCount = Object.keys(checkedUrls).length
+
+ return (
+ <div className="flex size-full flex-col overflow-hidden">
+ <div className="flex size-full">
+ <div className="flex-1 overflow-auto bg-ui-bg-subtle p-6">
+ <div className="flex flex-wrap content-start gap-6">
+ {selectedImages.map((img) => {
+ const effectiveThumb = getEffectiveThumbnailUrl()
+ const isThumb = img.url === effectiveThumb
+
+ return (
+ <SelectedImageCard
+ key={img.url}
+ image={img}
+ isThumbnail={isThumb}
+ checked={!!checkedUrls[img.url]}
+ onCheckedChange={(val) =>
+ handleCheckedChange(img.url, val)
+ }
+ />
+ )
+ })}
+ </div>
+ </div>
+ <div className="w-px shrink-0 bg-ui-border-base" />
+ <div className="flex w-[318px] shrink-0 flex-col">
+ <div className="p-4">
+ <p className="txt-compact-small-plus text-ui-fg-base">
+ {t("products.media.selectImages")}
+ </p>
+ <p className="txt-small mt-1 text-ui-fg-subtle">
+ {t("products.media.selectImagesHint")}
+ </p>
+ </div>
+ <div className="h-px bg-ui-border-base" />
+ <div className="flex-1 overflow-auto p-4">
+ <div className="grid grid-cols-2 gap-4">
+ {unselectedImages.map((img) => (
+ <UnselectedImageCard
+ key={img.url}
+ image={img}
+ onSelect={() => handleSelectImage(img.url)}
+ />
+ ))}
+ </div>
+ </div>
+ </div>
+ </div>
+ <CommandBar open={!!checkedCount}>
+ <CommandBar.Bar>
+ <CommandBar.Value>
+ {t("general.countSelected", {
+ count: checkedCount,
+ })}
+ </CommandBar.Value>
+ <CommandBar.Seperator />
+ {checkedCount === 1 && (
+ <Fragment>
+ <CommandBar.Command
+ action={handlePromoteToThumbnail}
+ label={t("products.media.makeThumbnail")}
+ shortcut="t"
+ />
+ <CommandBar.Seperator />
+ </Fragment>
+ )}
+ <CommandBar.Command
+ action={() => {
+ Object.keys(checkedUrls).forEach((url) =>
+ handleDeselectImage(url)
+ )
+ setCheckedUrls({})
+ }}
+ label={t("actions.remove")}
+ shortcut="r"
+ />
+ </CommandBar.Bar>
+ </CommandBar>
+ </div>
+ )
+}
+
+type SelectedImageCardProps = {
+ image: MediaItem & { url: string }
+ isThumbnail: boolean
+ checked: boolean
+ onCheckedChange: (value: boolean) => void
+}
+
+const SelectedImageCard = ({
+ image,
+ isThumbnail,
+ checked,
+ onCheckedChange,
+}: SelectedImageCardProps) => {
+ const { t } = useTranslation()
+
+ return (
+ <div
+ className={clx(
+ "group relative size-[156px] shrink-0 overflow-hidden rounded-lg",
+ "shadow-elevation-card-rest"
+ )}
+ >
+ {isThumbnail && (
+ <div className="absolute left-2 top-2 z-[1]">
+ <Tooltip
+ content={t("products.media.thumbnailTooltip")}
+ >
+ <ThumbnailBadge />
+ </Tooltip>
+ </div>
+ )}
+ <div
+ className={clx(
+ "absolute right-2 top-2 z-[1] opacity-0 transition-opacity",
+ "group-hover:opacity-100",
+ { "opacity-100": checked }
+ )}
+ >
+ <Checkbox
+ checked={checked}
+ onCheckedChange={onCheckedChange}
+ aria-label={t("actions.select")}
+ />
+ </div>
+ <img
+ src={image.url}
+ alt=""
+ className="size-full object-cover object-center"
+ />
+ </div>
+ )
+}
+
+type UnselectedImageCardProps = {
+ image: MediaItem & { url: string }
+ onSelect: () => void
+}
+
+const UnselectedImageCard = ({
+ image,
+ onSelect,
+}: UnselectedImageCardProps) => {
+ const { t } = useTranslation()
+
+ return (
+ <button
+ type="button"
+ onClick={onSelect}
+ className={clx(
+ "aspect-square w-full overflow-hidden rounded-lg",
+ "shadow-elevation-card-rest transition-shadow",
+ "hover:shadow-elevation-card-hover",
+ "outline-none focus-visible:shadow-borders-focus"
+ )}
+ aria-label={t("products.media.selectImages")}
+ >
+ <img
+ src={image.url}
+ alt=""
+ className="size-full object-cover object-center"
+ />
+ </button>
+ )
+}
diff --git a/packages/vendor/src/pages/products/create/product-create-attributes-form/index.ts b/packages/vendor/src/pages/products/create/product-create-attributes-form/index.ts
new file mode 100644
index 000000000..7249bf35e
--- /dev/null
+++ b/packages/vendor/src/pages/products/create/product-create-attributes-form/index.ts
@@ -0,0 +1,4 @@
+export {
+ ProductCreateAttributesForm,
+ type ProductCreateAttributesFormRef,
+} from "./product-create-attributes-form"
diff --git a/packages/vendor/src/pages/products/create/product-create-attributes-form/product-create-attributes-form.tsx b/packages/vendor/src/pages/products/create/product-create-attributes-form/product-create-attributes-form.tsx
new file mode 100644
index 000000000..7d75a9d3a
--- /dev/null
+++ b/packages/vendor/src/pages/products/create/product-create-attributes-form/product-create-attributes-form.tsx
@@ -0,0 +1,332 @@
+import { forwardRef, useEffect, useImperativeHandle } from "react"
+
+import { CircleInfoSolid } from "@medusajs/icons"
+import { Button, Divider, Heading, Text, Tooltip } from "@medusajs/ui"
+import { Path, useFieldArray, UseFormReturn } from "react-hook-form"
+import { useTranslation } from "react-i18next"
+
+import { useAttributes } from "../../../../hooks/api/attributes"
+import { ProductAttribute } from "../../types"
+import { ProductCreateSchemaType } from "../types"
+import { createAttributeValidationRules } from "../utils/attribute-validation"
+import {
+ processAttributes,
+ type FormField,
+} from "../utils/process-attributes"
+import { RequiredAttributesList } from "./required-attributes-list"
+import { UserCreatedOptionsList } from "./user-created-options-list"
+
+export interface ProductCreateAttributesFormRef {
+ validateAttributes: () => Promise<boolean>
+ requiredFormFields: FormField[]
+}
+
+type ProductCreateAttributesFormProps = {
+ form: UseFormReturn<ProductCreateSchemaType>
+}
+
+export const ProductCreateAttributesForm = forwardRef<
+ ProductCreateAttributesFormRef,
+ ProductCreateAttributesFormProps
+>(({ form }, ref) => {
+ const { t } = useTranslation()
+
+ const primaryCategoryId = form.watch("categories")?.[0]
+
+ const options = useFieldArray({
+ control: form.control,
+ name: "options",
+ })
+
+ const { attributes: allAttributes, isLoading: allAttributesLoading } =
+ useAttributes({
+ fields:
+ "id,name,handle,description,ui_component,is_required,product_categories.*,possible_values.*",
+ })
+
+ const processedAttributes = processAttributes(
+ allAttributes,
+ primaryCategoryId
+ )
+ const requiredFormFields = processedAttributes.required.all
+
+ const validationRules = createAttributeValidationRules(
+ requiredFormFields,
+ t as any
+ )
+
+ const validateAttributes = async () => {
+ const errors: Record<string, string> = {}
+
+ requiredFormFields.forEach((field) => {
+ if (field.is_required) {
+ const value = form.getValues(
+ field.handle as Path<ProductCreateSchemaType>
+ )
+
+ switch (field.ui_component) {
+ case "select":
+ case "toggle":
+ if (!value || value === "") {
+ errors[field.handle] = t(
+ "products.fields.attributes.validation.requiredSelect"
+ )
+ }
+ break
+ case "text":
+ case "text_area":
+ if (!value || value === "") {
+ errors[field.handle] = t(
+ "products.fields.attributes.validation.requiredEnter"
+ )
+ }
+ break
+ case "multivalue":
+ if (
+ !value ||
+ !Array.isArray(value) ||
+ value.length === 0
+ ) {
+ errors[field.handle] = t(
+ "products.fields.attributes.validation.requiredSelectMultiple"
+ )
+ }
+ break
+ case "unit":
+ if (
+ value === undefined ||
+ value === null ||
+ value === ""
+ ) {
+ errors[field.handle] = t(
+ "products.fields.attributes.validation.requiredEnter"
+ )
+ }
+ break
+ }
+ }
+ })
+
+ requiredFormFields.forEach((field) => {
+ if (field.is_required) {
+ form.clearErrors(
+ field.handle as Path<ProductCreateSchemaType>
+ )
+ }
+ })
+
+ Object.keys(errors).forEach((fieldName) => {
+ form.setError(fieldName as Path<ProductCreateSchemaType>, {
+ type: "required",
+ message: errors[fieldName],
+ })
+ })
+
+ const currentOptions = form.getValues("options") || []
+ const optionsValid = currentOptions.length > 0
+ ? await form.trigger("options")
+ : true
+
+ return Object.keys(errors).length === 0 && optionsValid
+ }
+
+ useImperativeHandle(
+ ref,
+ () => ({
+ validateAttributes,
+ requiredFormFields,
+ }),
+ [validateAttributes, requiredFormFields, form, t]
+ )
+
+ useEffect(() => {
+ const subscription = form.watch((values, { name }) => {
+ if (
+ name &&
+ requiredFormFields.some((field) => field.handle === name)
+ ) {
+ const field = requiredFormFields.find(
+ (f) => f.handle === name
+ )
+ if (field && field.is_required) {
+ const value = values[name as keyof typeof values]
+ let isValid = false
+
+ switch (field.ui_component) {
+ case "select":
+ case "toggle":
+ isValid = typeof value === "string" && value !== ""
+ break
+ case "text":
+ case "text_area":
+ isValid = typeof value === "string" && value !== ""
+ break
+ case "multivalue":
+ isValid =
+ Array.isArray(value) && value.length > 0
+ break
+ case "unit":
+ isValid =
+ value !== undefined &&
+ value !== null &&
+ value !== ""
+ break
+ default:
+ isValid = false
+ break
+ }
+
+ if (isValid) {
+ form.clearErrors(
+ name as Path<ProductCreateSchemaType>
+ )
+ }
+ }
+ }
+ })
+
+ return () => subscription.unsubscribe()
+ }, [form, requiredFormFields])
+
+ const nonRequiredAttributes = allAttributes?.filter(
+ (attribute: any) => !attribute.is_required
+ )
+ const availableAttributes = nonRequiredAttributes?.filter(
+ (attribute: any) =>
+ !options.fields?.some(
+ (option: any) => option.attributeId === attribute.id
+ )
+ )
+
+ return (
+ <div className="flex flex-col items-center p-16">
+ <div className="flex w-full max-w-[720px] flex-col gap-y-8">
+ <Header options={options} />
+ <div className="flex flex-col gap-y-8">
+ <UserCreatedOptionsList
+ form={form}
+ options={options}
+ availableAttributes={
+ availableAttributes as ProductAttribute[]
+ }
+ allNonRequiredAttributes={
+ nonRequiredAttributes as ProductAttribute[]
+ }
+ allowCreate={true}
+ />
+
+ {requiredFormFields.length === 0 ? (
+ <div className="py-8 text-center text-gray-500">
+ {allAttributesLoading
+ ? "Loading attributes..."
+ : null}
+ </div>
+ ) : (
+ <>
+ <Divider variant="dashed" />
+ <div className="flex flex-col gap-y-2">
+ <Heading level="h3" className="text-ui-fg-base">
+ {t(
+ "products.create.attributes.requiredHeading"
+ )}
+ </Heading>
+ <Text
+ size="small"
+ className="text-ui-fg-subtle"
+ >
+ {t(
+ "products.create.attributes.requiredDescription"
+ )}
+ </Text>
+ </div>
+
+ <RequiredAttributesList
+ form={form}
+ fields={requiredFormFields}
+ validationRules={validationRules}
+ />
+ </>
+ )}
+ </div>
+ </div>
+ </div>
+ )
+})
+
+ProductCreateAttributesForm.displayName =
+ "ProductCreateAttributesForm"
+
+type HeaderProps = {
+ options: {
+ append: (
+ option: {
+ title: string
+ values: string[]
+ metadata?: Record<string, unknown>
+ useForVariants: boolean
+ },
+ focusOptions: Record<string, boolean>
+ ) => void
+ }
+}
+
+const Header = ({ options }: HeaderProps) => {
+ const { t } = useTranslation()
+
+ return (
+ <div className="flex flex-col gap-y-2">
+ <div className="flex items-start justify-between">
+ <div className="flex flex-col gap-y-2">
+ <Heading level="h1" className="text-ui-fg-base">
+ {t("products.create.tabs.attributes")}
+ </Heading>
+ <div className="space-y-0.5">
+ <Text
+ size="small"
+ className="max-w-[440px] text-ui-fg-subtle"
+ >
+ {t("products.create.attributes.description")}
+ </Text>
+ <Text
+ size="small"
+ className="flex items-center gap-1 text-ui-fg-subtle"
+ >
+ {t(
+ "products.create.attributes.learnMore.label"
+ )}
+ <Tooltip
+ content={t(
+ "products.create.attributes.learnMore.content"
+ )}
+ >
+ <CircleInfoSolid />
+ </Tooltip>
+ </Text>
+ </div>
+ </div>
+ <Button
+ size="small"
+ variant="secondary"
+ type="button"
+ className="min-w-[100px]"
+ onClick={() => {
+ options.append(
+ {
+ title: "",
+ values: [],
+ metadata: { author: "vendor" },
+ useForVariants: true,
+ },
+ {
+ shouldFocus: false,
+ }
+ )
+ }}
+ >
+ {t("actions.add")}{" "}
+ {t("products.create.attributes.buttonLabel")}
+ </Button>
+ </div>
+ </div>
+ )
+}
diff --git a/packages/vendor/src/pages/products/create/product-create-attributes-form/required-attributes-list.tsx b/packages/vendor/src/pages/products/create/product-create-attributes-form/required-attributes-list.tsx
new file mode 100644
index 000000000..c9e38a4d1
--- /dev/null
+++ b/packages/vendor/src/pages/products/create/product-create-attributes-form/required-attributes-list.tsx
@@ -0,0 +1,213 @@
+import { Select, Textarea } from "@medusajs/ui"
+import { UseFormReturn } from "react-hook-form"
+import { useTranslation } from "react-i18next"
+
+import { Form } from "@components/common/form"
+import { SwitchBox } from "@components/common/switch-box"
+import { Combobox } from "@components/inputs/combobox"
+import { MultiSelect } from "../../../../components/inputs/multi-select"
+import { NumericInput } from "../../../../components/inputs/numeric-input"
+import { ProductCreateSchemaType } from "../types"
+
+type RequiredAttributesListProps = {
+ form: UseFormReturn<ProductCreateSchemaType>
+ fields: any[]
+ validationRules: Record<string, any>
+}
+
+export const RequiredAttributesList = ({
+ form,
+ fields,
+ validationRules,
+}: RequiredAttributesListProps) => {
+ const { t } = useTranslation()
+
+ return (
+ <>
+ {fields.map((field: any) => (
+ <div key={field.id} className="flex flex-col gap-y-4">
+ {field.ui_component === "select" && (
+ <Form.Field
+ control={form.control}
+ name={field.handle as any}
+ rules={validationRules[field.handle] || {}}
+ render={({ field: formField, fieldState }) => (
+ <Form.Item>
+ <Form.Label optional={!field.is_required}>
+ {field.name}
+ </Form.Label>
+ {field.description && (
+ <p className="txt-compact-small !my-1 text-ui-fg-subtle">
+ {field.description}
+ </p>
+ )}
+ <Form.Control>
+ <Combobox
+ {...formField}
+ options={field.possible_values}
+ aria-invalid={!!fieldState.error}
+ />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ )}
+
+ {field.ui_component === "multivalue" && (
+ <div className="flex flex-col gap-y-2">
+ <Form.Field
+ control={form.control}
+ name={field.handle as any}
+ rules={validationRules[field.handle] || {}}
+ render={({ field: formField, fieldState }) => (
+ <Form.Item>
+ <Form.Label optional={!field.is_required}>
+ {field.name}
+ </Form.Label>
+ {field.description && (
+ <p className="txt-compact-small mb-1 text-ui-fg-subtle">
+ {field.description}
+ </p>
+ )}
+ <Form.Control>
+ <MultiSelect
+ value={formField.value}
+ onChange={formField.onChange}
+ name={formField.name}
+ options={field.possible_values}
+ showSearch={true}
+ aria-invalid={!!fieldState.error}
+ />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ <SwitchBox
+ control={form.control as any}
+ name={`${field.handle}UseForVariants` as any}
+ label={t(
+ "products.fields.attributes.useForVariants.label"
+ )}
+ description={t(
+ "products.fields.attributes.useForVariants.description"
+ )}
+ />
+ </div>
+ )}
+
+ {field.ui_component === "text_area" && (
+ <Form.Field
+ control={form.control}
+ name={field.handle as any}
+ rules={validationRules[field.handle] || {}}
+ render={({ field: formField, fieldState }) => (
+ <Form.Item>
+ <Form.Label optional={!field.is_required}>
+ {field.name}
+ </Form.Label>
+ {field.description && (
+ <p className="txt-compact-small !my-1 text-ui-fg-subtle">
+ {field.description}
+ </p>
+ )}
+ <Form.Control>
+ <Textarea
+ {...formField}
+ placeholder={t(
+ "products.fields.attributes.enterValuePlaceholder"
+ )}
+ aria-invalid={!!fieldState.error}
+ />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ )}
+
+ {field.ui_component === "toggle" && (
+ <Form.Field
+ control={form.control}
+ name={field.handle as any}
+ rules={validationRules[field.handle] || {}}
+ render={({ field: formField, fieldState }) => (
+ <Form.Item>
+ <Form.Label optional={!field.is_required}>
+ {field.name}
+ </Form.Label>
+ {field.description && (
+ <p className="txt-compact-small !my-1 text-ui-fg-subtle">
+ {field.description}
+ </p>
+ )}
+ <Form.Control>
+ <Select
+ {...formField}
+ onValueChange={formField.onChange}
+ value={formField.value}
+ >
+ <Select.Trigger
+ aria-invalid={!!fieldState.error}
+ >
+ <Select.Value
+ placeholder={t(
+ "products.fields.attributes.selectValuePlaceholder"
+ )}
+ />
+ </Select.Trigger>
+ <Select.Content>
+ <Select.Item value="true">
+ {t("general.true")}
+ </Select.Item>
+ <Select.Item value="false">
+ {t("general.false")}
+ </Select.Item>
+ </Select.Content>
+ </Select>
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ )}
+
+ {field.ui_component === "unit" && (
+ <Form.Field
+ control={form.control}
+ name={field.handle as any}
+ rules={validationRules[field.handle] || {}}
+ render={({ field: formField, fieldState }) => (
+ <Form.Item>
+ <Form.Label optional={!field.is_required}>
+ {field.name}
+ </Form.Label>
+ {field.description && (
+ <p className="txt-compact-small !my-1 text-ui-fg-subtle">
+ {field.description}
+ </p>
+ )}
+ <Form.Control>
+ <NumericInput
+ value={formField.value}
+ onChange={formField.onChange}
+ onBlur={formField.onBlur}
+ name={formField.name}
+ placeholder={t(
+ "products.fields.attributes.enterValuePlaceholder"
+ )}
+ aria-invalid={!!fieldState.error}
+ hideControls
+ />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ )}
+ </div>
+ ))}
+ </>
+ )
+}
diff --git a/packages/vendor/src/pages/products/create/product-create-attributes-form/user-created-options-list.tsx b/packages/vendor/src/pages/products/create/product-create-attributes-form/user-created-options-list.tsx
new file mode 100644
index 000000000..f28ac22ef
--- /dev/null
+++ b/packages/vendor/src/pages/products/create/product-create-attributes-form/user-created-options-list.tsx
@@ -0,0 +1,375 @@
+import { XMarkMini } from "@medusajs/icons"
+import { IconButton, Input, Select, Textarea } from "@medusajs/ui"
+import { UseFormReturn } from "react-hook-form"
+import { useTranslation } from "react-i18next"
+
+import { Form } from "@components/common/form"
+import { SwitchBox } from "@components/common/switch-box"
+import { ChipInput } from "@components/inputs/chip-input"
+import { Combobox } from "@components/inputs/combobox"
+import { NumericInput } from "../../../../components/inputs/numeric-input"
+import { ProductAttribute } from "../../types"
+import { ProductCreateSchemaType } from "../types"
+
+type UserCreatedOptionsListProps = {
+ form: UseFormReturn<ProductCreateSchemaType>
+ options: {
+ fields: Array<{ id: string }>
+ append: (option: {
+ title: string
+ values: string[]
+ metadata?: Record<string, unknown>
+ attributeId?: string
+ }) => void
+ remove: (index: number) => void
+ }
+ allowRemove?: boolean
+ availableAttributes: ProductAttribute[]
+ allNonRequiredAttributes?: ProductAttribute[]
+ isExistingProduct?: boolean
+ allowCreate?: boolean
+}
+
+export const UserCreatedOptionsList = ({
+ form,
+ options,
+ allowRemove = true,
+ availableAttributes,
+ allNonRequiredAttributes,
+ isExistingProduct = false,
+ allowCreate = true,
+}: UserCreatedOptionsListProps) => {
+ const { t } = useTranslation()
+
+ if (options?.fields?.length === 0) {
+ return null
+ }
+
+ return (
+ <ul className="flex flex-col gap-y-4">
+ {options.fields.map(({ id }, index) => {
+ const attributeLookup =
+ allNonRequiredAttributes || availableAttributes
+ const selectedAttribute = attributeLookup?.find(
+ (attribute) =>
+ attribute.id ===
+ form.watch(`options.${index}.attributeId`)
+ )
+ const uiComponent = selectedAttribute?.ui_component
+ const possibleValueOptions =
+ selectedAttribute?.possible_values.map(({ value }) => ({
+ label: value,
+ value: value,
+ })) ?? []
+ const showUseForVariants =
+ !selectedAttribute || uiComponent === "multivalue"
+
+ return (
+ <li
+ className="flex flex-col gap-y-2 rounded-xl border bg-ui-bg-component p-1.5"
+ key={id}
+ >
+ <div className="flex items-center gap-1.5">
+ <div className="flex grow flex-col gap-y-2">
+ <Form.Field
+ control={form.control}
+ name={`options.${index}.title`}
+ render={({
+ field: { onChange, ...field },
+ fieldState,
+ }) => {
+ return (
+ <Form.Item>
+ <Form.Label>
+ {t(
+ "products.fields.attributes.add.title.label"
+ )}
+ </Form.Label>
+ <Form.Control>
+ <div className="flex flex-col gap-y-1.5">
+ <Combobox
+ {...field}
+ placeholder={t(
+ "products.fields.attributes.add.title.placeholder"
+ )}
+ aria-invalid={!!fieldState.error}
+ options={[
+ ...(availableAttributes || []).map(
+ (attribute) => ({
+ label: attribute.name,
+ value: attribute.id,
+ })
+ ),
+ ]}
+ onChange={(v) => {
+ const foundAttribute =
+ availableAttributes?.find(
+ (attribute) =>
+ attribute.id === v
+ )
+ if (foundAttribute) {
+ form.setValue(
+ `options.${index}.values`,
+ []
+ )
+ form.setValue(
+ `options.${index}.attributeId`,
+ v as string
+ )
+ form.setValue(
+ `options.${index}.title`,
+ foundAttribute.name || ""
+ )
+ form.setValue(
+ `options.${index}.metadata`,
+ { author: "admin" }
+ )
+ form.setValue(
+ `options.${index}.useForVariants`,
+ false
+ )
+ return
+ }
+ form.setValue(
+ `options.${index}.values`,
+ []
+ )
+ form.setValue(
+ `options.${index}.attributeId`,
+ ""
+ )
+ form.setValue(
+ `options.${index}.metadata`,
+ { author: "vendor" }
+ )
+ onChange(v)
+ }}
+ onCreateOption={
+ allowCreate
+ ? (value) => {
+ form.setValue(
+ `options.${index}.title`,
+ value
+ )
+ form.setValue(
+ `options.${index}.attributeId`,
+ ""
+ )
+ form.setValue(
+ `options.${index}.metadata`,
+ { author: "vendor" }
+ )
+ form.setValue(
+ `options.${index}.values`,
+ []
+ )
+ }
+ : undefined
+ }
+ className="w-full bg-ui-bg-base hover:bg-ui-bg-base-hover"
+ multiple={false}
+ showCheck={false}
+ />
+ <Form.ErrorMessage />
+ </div>
+ </Form.Control>
+ </Form.Item>
+ )
+ }}
+ />
+ <Form.Field
+ control={form.control}
+ name={`options.${index}.values`}
+ render={({ field: { ...field }, fieldState }) => {
+ const renderInput = () => {
+ if (!selectedAttribute) {
+ return (
+ <ChipInput
+ {...field}
+ variant="contrast"
+ placeholder={t(
+ "products.fields.attributes.add.values.placeholder"
+ )}
+ className="w-full"
+ aria-invalid={!!fieldState.error}
+ />
+ )
+ }
+
+ if (uiComponent === "select") {
+ return (
+ <Combobox
+ value={field.value[0] ?? ""}
+ onChange={(val) =>
+ field.onChange(
+ val ? [val as string] : []
+ )
+ }
+ options={possibleValueOptions}
+ multiple={false}
+ showCheck={false}
+ aria-invalid={!!fieldState.error}
+ className="w-full bg-ui-bg-base hover:bg-ui-bg-base-hover"
+ />
+ )
+ }
+
+ if (uiComponent === "text") {
+ return (
+ <Input
+ value={field.value[0] ?? ""}
+ onChange={(e) =>
+ field.onChange([e.target.value])
+ }
+ placeholder={t(
+ "products.fields.attributes.add.values.placeholder"
+ )}
+ className="w-full"
+ aria-invalid={!!fieldState.error}
+ />
+ )
+ }
+
+ if (uiComponent === "text_area") {
+ return (
+ <Textarea
+ value={field.value[0] ?? ""}
+ onChange={(e) =>
+ field.onChange([e.target.value])
+ }
+ placeholder={t(
+ "products.fields.attributes.add.values.placeholder"
+ )}
+ className="w-full"
+ aria-invalid={!!fieldState.error}
+ />
+ )
+ }
+
+ if (uiComponent === "toggle") {
+ return (
+ <Select
+ value={field.value[0] ?? ""}
+ onValueChange={(val) =>
+ field.onChange([val])
+ }
+ >
+ <Select.Trigger
+ className="w-full"
+ aria-invalid={!!fieldState.error}
+ >
+ <Select.Value
+ placeholder={t(
+ "products.fields.attributes.selectValuePlaceholder"
+ )}
+ />
+ </Select.Trigger>
+ <Select.Content>
+ <Select.Item value="true">
+ {t("general.true")}
+ </Select.Item>
+ <Select.Item value="false">
+ {t("general.false")}
+ </Select.Item>
+ </Select.Content>
+ </Select>
+ )
+ }
+
+ if (uiComponent === "unit") {
+ return (
+ <NumericInput
+ value={
+ field.value[0] !== undefined
+ ? parseFloat(field.value[0])
+ : undefined
+ }
+ onChange={(val) =>
+ field.onChange([
+ String(val ?? ""),
+ ])
+ }
+ placeholder={t(
+ "products.fields.attributes.add.values.placeholder"
+ )}
+ aria-invalid={!!fieldState.error}
+ hideControls
+ />
+ )
+ }
+
+ return (
+ <Combobox
+ {...field}
+ options={possibleValueOptions}
+ onCreateOption={
+ allowCreate
+ ? (value) => {
+ form.setValue(
+ `options.${index}.values`,
+ [...field.value, value]
+ )
+ }
+ : undefined
+ }
+ aria-invalid={!!fieldState.error}
+ className="w-full bg-ui-bg-base hover:bg-ui-bg-base-hover"
+ />
+ )
+ }
+
+ return (
+ <Form.Item className="flex flex-row items-start gap-x-1.5 space-y-0">
+ <Form.Label className="min-w-[60px] px-2 py-1.5">
+ {t(
+ "products.fields.attributes.add.values.label"
+ )}
+ </Form.Label>
+ <Form.Control>
+ <div className="flex w-full flex-col gap-y-1.5">
+ {renderInput()}
+ <Form.ErrorMessage />
+ </div>
+ </Form.Control>
+ </Form.Item>
+ )
+ }}
+ />
+ </div>
+ {allowRemove && (
+ <IconButton
+ type="button"
+ size="small"
+ variant="transparent"
+ className="text-ui-fg-muted"
+ onClick={() => options.remove(index)}
+ >
+ <XMarkMini />
+ </IconButton>
+ )}
+ </div>
+ {showUseForVariants && (
+ <SwitchBox
+ control={form.control as any}
+ name={`options.${index}.useForVariants` as any}
+ label={t(
+ "products.fields.attributes.useForVariants.label"
+ )}
+ description={
+ isExistingProduct
+ ? t(
+ "products.fields.attributes.useForVariants.editDescription"
+ )
+ : t(
+ "products.fields.attributes.useForVariants.description"
+ )
+ }
+ className="pl-14 [&>*]:shadow-none"
+ />
+ )}
+ </li>
+ )
+ })}
+ </ul>
+ )
+}
diff --git a/packages/vendor/src/pages/products/create/product-create-details-form/components/product-create-details-general-section/product-create-general-section.tsx b/packages/vendor/src/pages/products/create/product-create-details-form/components/product-create-details-general-section/product-create-general-section.tsx
index c02764e27..48d73cf2e 100644
--- a/packages/vendor/src/pages/products/create/product-create-details-form/components/product-create-details-general-section/product-create-general-section.tsx
+++ b/packages/vendor/src/pages/products/create/product-create-details-form/components/product-create-details-general-section/product-create-general-section.tsx
@@ -24,6 +24,7 @@ export const ProductCreateGeneralSection = () => {
<Form.Control>
<Input {...field} placeholder="Winter jacket" />
</Form.Control>
+ <Form.ErrorMessage>{form.formState.errors.title?.message}</Form.ErrorMessage>
</Form.Item>
)
}}
@@ -59,6 +60,7 @@ export const ProductCreateGeneralSection = () => {
<Form.Control>
<HandleInput {...field} placeholder="winter-jacket" />
</Form.Control>
+ <Form.ErrorMessage>{form.formState.errors.handle?.message}</Form.ErrorMessage>
</Form.Item>
)
}}
diff --git a/packages/vendor/src/pages/products/create/product-create-details-form/product-create-details-form.tsx b/packages/vendor/src/pages/products/create/product-create-details-form/product-create-details-form.tsx
index 7f5b08f46..3ddbce152 100644
--- a/packages/vendor/src/pages/products/create/product-create-details-form/product-create-details-form.tsx
+++ b/packages/vendor/src/pages/products/create/product-create-details-form/product-create-details-form.tsx
@@ -1,11 +1,10 @@
-import { Divider, Heading } from "@medusajs/ui";
+import { Heading } from "@medusajs/ui";
import { Children, ReactNode } from "react";
import { useTranslation } from "react-i18next";
import { TabDefinition } from "../types";
import { ProductCreateGeneralSection } from "./components/product-create-details-general-section";
import { ProductCreateMediaSection } from "./components/product-create-details-media-section";
-import { ProductCreateVariantsSection } from "./components/product-create-details-variant-section";
const Root = ({ children }: { children?: ReactNode }) => {
if (Children.count(children) > 0) {
@@ -27,8 +26,6 @@ const Root = ({ children }: { children?: ReactNode }) => {
<ProductCreateGeneralSection />
<ProductCreateMediaSection />
</div>
- <Divider />
- <ProductCreateVariantsSection />
</div>
</div>
);
@@ -37,7 +34,7 @@ const Root = ({ children }: { children?: ReactNode }) => {
Root._tabMeta = {
id: "details",
labelKey: "products.create.tabs.details",
- validationFields: ["title", "media", "options", "variants", "enable_variants"],
+ validationFields: ["title", "media"],
} satisfies TabDefinition;
const Header = () => {
@@ -45,7 +42,7 @@ const Header = () => {
return (
<div className="flex flex-col">
- <Heading>{t("products.create.header")}</Heading>
+ <Heading>{t("products.create.tabs.details")}</Heading>
</div>
);
};
@@ -54,5 +51,4 @@ export const ProductCreateDetailsForm = Object.assign(Root, {
_tabMeta: Root._tabMeta,
GeneralSection: ProductCreateGeneralSection,
MediaSection: ProductCreateMediaSection,
- VariantsSection: ProductCreateVariantsSection,
});
diff --git a/packages/vendor/src/pages/products/create/product-create-form/product-create-form.tsx b/packages/vendor/src/pages/products/create/product-create-form/product-create-form.tsx
index 7a1aa502d..970708ea9 100644
--- a/packages/vendor/src/pages/products/create/product-create-form/product-create-form.tsx
+++ b/packages/vendor/src/pages/products/create/product-create-form/product-create-form.tsx
@@ -1,136 +1,544 @@
-import { Button, toast } from "@medusajs/ui"
+import { useCallback, useEffect, useMemo, useRef, useState } from "react"
+
import { HttpTypes } from "@medusajs/types"
-import { Children, ReactNode, useCallback, useMemo } from "react"
+import { Button, ProgressStatus, ProgressTabs, toast } from "@medusajs/ui"
import { useForm, useWatch } from "react-hook-form"
import { useTranslation } from "react-i18next"
+import { z } from "zod"
+import { zodResolver } from "@hookform/resolvers/zod"
+
import { RouteFocusModal, useRouteModal } from "@components/modals"
-import { TabbedForm, TabDefinition } from "@components/tabbed-form"
+import { TabbedFormContext } from "@components/tabbed-form"
+import { KeyboundForm } from "@components/utilities/keybound-form"
+import { useRegions } from "@hooks/api"
+import { useAttributes } from "../../../../hooks/api/attributes"
+import { usePricePreferences } from "@hooks/api/price-preferences"
import { useCreateProduct } from "@hooks/api/products"
+import { useStockLocations } from "@hooks/api/stock-locations"
import { uploadFilesQuery } from "@lib/client"
import {
PRODUCT_CREATE_FORM_DEFAULTS,
ProductCreateSchema,
-} from "@pages/products/create/constants"
+} from "../constants"
+import { ProductCreateSchemaType } from "../types"
+import { decorateVariantsWithDefaultValues } from "../utils"
+import {
+ ProductCreateAttributesForm,
+ ProductCreateAttributesFormRef,
+} from "../product-create-attributes-form/product-create-attributes-form"
import { ProductCreateDetailsForm } from "../product-create-details-form"
import { ProductCreateInventoryKitForm } from "../product-create-inventory-kit-form"
import { ProductCreateOrganizeForm } from "../product-create-organize-form"
import { ProductCreateVariantsForm } from "../product-create-variants-form"
-import { zodResolver } from "@hookform/resolvers/zod"
-import { ProductCreateSchemaType } from "../types"
-import { z } from "zod"
+
+enum Tab {
+ DETAILS = "details",
+ ORGANIZE = "organize",
+ ATTRIBUTES = "attributes",
+ VARIANTS = "variants",
+ INVENTORY = "inventory",
+}
+
+type TabState = Record<Tab, ProgressStatus>
+
+type MediaItem = {
+ file?: File
+ url?: string
+ isThumbnail?: boolean
+ id?: string
+}
+
+type UploadedMedia = HttpTypes.AdminFile & {
+ isThumbnail: boolean
+}
const SAVE_DRAFT_BUTTON = "save-draft-button"
+const SEC_CAT_PRODUCT_KEY = "sec_cat_product_key"
+
+const TAB_ORDER: Tab[] = [
+ Tab.DETAILS,
+ Tab.ORGANIZE,
+ Tab.ATTRIBUTES,
+ Tab.VARIANTS,
+ Tab.INVENTORY,
+]
+
+const isMovingForward = (currentTab: Tab, newTab: Tab): boolean => {
+ const currentIndex = TAB_ORDER.indexOf(currentTab)
+ const newIndex = TAB_ORDER.indexOf(newTab)
+ return newIndex > currentIndex
+}
type ProductCreateFormProps = {
defaultChannel?: HttpTypes.AdminSalesChannel
- children?: ReactNode
- schema?: z.ZodType<any>
- defaultValues?: Record<string, any>
+ store?: HttpTypes.AdminStore
+ onOpenMediaModal?: (
+ variantIndex: number,
+ variantTitle?: string,
+ initialMedia?: MediaItem[],
+ productMedia?: MediaItem[]
+ ) => void
+ onSaveVariantMediaRef?: React.MutableRefObject<
+ ((variantIndex: number, media: MediaItem[]) => void) | null
+ >
}
export const ProductCreateForm = ({
- defaultChannel: defaultChannelProp,
- children,
- schema,
- defaultValues: extraDefaults,
+ defaultChannel,
+ store,
+ onOpenMediaModal,
+ onSaveVariantMediaRef,
}: ProductCreateFormProps) => {
+ const [tab, setTab] = useState<Tab>(Tab.DETAILS)
+ const [maxReachedTab, setMaxReachedTab] = useState<Tab>(Tab.DETAILS)
+ const [tabState, setTabState] = useState<TabState>({
+ [Tab.DETAILS]: "in-progress",
+ [Tab.ORGANIZE]: "not-started",
+ [Tab.ATTRIBUTES]: "not-started",
+ [Tab.VARIANTS]: "not-started",
+ [Tab.INVENTORY]: "not-started",
+ })
+
const { t } = useTranslation()
const { handleSuccess } = useRouteModal()
- const defaultChannel = defaultChannelProp
+ const { regions } = useRegions({ limit: 9999 })
+ const { price_preferences: pricePreferences } = usePricePreferences({
+ limit: 9999,
+ })
+
+ const { attributes: allAttributes } = useAttributes({
+ fields:
+ "id,name,handle,description,ui_component,is_required,product_categories.*,possible_values.*",
+ })
- const form = useForm<ProductCreateSchemaType>({
+ const { stock_locations = [] } = useStockLocations({
+ limit: 9999,
+ fields: "id,name",
+ })
+
+ const dynamicAttributeSchema = useMemo(() => {
+ const attributeFields: Record<string, z.ZodTypeAny> = {}
+
+ allAttributes?.forEach((attr: any) => {
+ switch (attr.ui_component) {
+ case "multivalue":
+ attributeFields[attr.handle] = z
+ .array(z.string())
+ .optional()
+ attributeFields[`${attr.handle}UseForVariants`] = z
+ .boolean()
+ .optional()
+ break
+ case "select":
+ case "text":
+ case "text_area":
+ attributeFields[attr.handle] = z.string().optional()
+ break
+ case "unit":
+ attributeFields[attr.handle] = z
+ .union([z.string(), z.number()])
+ .optional()
+ break
+ case "toggle":
+ attributeFields[attr.handle] = z.string().optional()
+ break
+ }
+ })
+
+ return attributeFields
+ }, [allAttributes])
+
+ const extendedSchema = useMemo(() => {
+ const baseSchema = ProductCreateSchema.innerType()
+ const extendedBaseSchema = baseSchema.extend({
+ ...dynamicAttributeSchema,
+ })
+
+ return extendedBaseSchema.superRefine((data, ctx) => {
+ if (data.variants.every((v: any) => !v.should_create)) {
+ return ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ path: ["variants"],
+ message: "invalid_length",
+ })
+ }
+
+ const skus = new Set<string>()
+ data.variants.forEach((v: any, index: any) => {
+ if (v.sku) {
+ if (skus.has(v.sku)) {
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ path: [`variants.${index}.sku`],
+ message: "SKU must be unique",
+ })
+ }
+ skus.add(v.sku)
+ }
+ })
+ })
+ }, [dynamicAttributeSchema])
+
+ const dynamicDefaultValues = useMemo(() => {
+ const defaults: Record<string, any> = {}
+
+ allAttributes?.forEach((attr: any) => {
+ switch (attr.ui_component) {
+ case "multivalue":
+ defaults[attr.handle] = []
+ defaults[`${attr.handle}UseForVariants`] = false
+ break
+ case "select":
+ case "text":
+ case "unit":
+ case "text_area":
+ case "toggle":
+ defaults[attr.handle] = undefined
+ break
+ }
+ })
+
+ return defaults
+ }, [allAttributes])
+
+ const form = useForm({
defaultValues: {
...PRODUCT_CREATE_FORM_DEFAULTS,
- ...extraDefaults,
+ ...dynamicDefaultValues,
sales_channels: defaultChannel
- ? [
- {
- id: defaultChannel.id,
- name: defaultChannel.name,
- },
- ]
+ ? [{ id: defaultChannel.id, name: defaultChannel.name }]
: [],
- },
- resolver: zodResolver(schema ?? ProductCreateSchema),
+ } as any,
+ resolver: zodResolver(extendedSchema),
+ mode: "onBlur",
})
const { mutateAsync, isPending } = useCreateProduct()
- const defaultTabs = useMemo(
- () => [
- <ProductCreateDetailsForm key="details" />,
- <ProductCreateOrganizeForm key="organize" />,
- <ProductCreateVariantsForm key="variants" />,
- <ProductCreateInventoryKitForm key="inventory" />,
- ],
- []
- )
-
- const hasCustomChildren = Children.count(children) > 0
+ const attributesFormRef =
+ useRef<ProductCreateAttributesFormRef>(null)
- /**
- * TODO: Important to revisit this - use variants watch so high in the tree can cause needless rerenders of the entire page
- * which is suboptimal when rerenders are caused by bulk editor changes
- */
const watchedVariants = useWatch({
control: form.control,
name: "variants",
})
- const transformTabs = useCallback(
- (tabs: TabDefinition<ProductCreateSchemaType>[]) =>
- tabs.map((tab) => {
- if (tab.id === "inventory" && tab.isVisible) {
- return {
- ...tab,
- isVisible: () =>
- watchedVariants.some(
- (v) => v.manage_inventory && v.inventory_kit
- ),
- }
- }
- return tab
- }),
+ const watchedMedia = useWatch({
+ control: form.control,
+ name: "media",
+ }) as MediaItem[] | undefined
+
+ const showInventoryTab = useMemo(
+ () =>
+ watchedVariants.some(
+ (v: any) => v.manage_inventory && v.inventory_kit
+ ),
[watchedVariants]
)
+ const handleSaveVariantMedia = useCallback(
+ (variantIndex: number, media: MediaItem[]) => {
+ const currentVariants = form.getValues("variants") || []
+ if (currentVariants[variantIndex]) {
+ const updatedVariants = [...currentVariants]
+ updatedVariants[variantIndex] = {
+ ...updatedVariants[variantIndex],
+ media,
+ }
+ form.setValue("variants", updatedVariants, {
+ shouldDirty: true,
+ })
+ }
+ },
+ [form]
+ )
+
+ useEffect(() => {
+ if (tab === Tab.VARIANTS) {
+ const currentOptions = form.getValues("options")
+ const currentVariants = form.getValues("variants")
+ if (
+ currentOptions.length === 0 &&
+ currentVariants.length === 0
+ ) {
+ form.setValue(
+ "variants",
+ decorateVariantsWithDefaultValues([
+ {
+ title: "Default variant",
+ should_create: true,
+ variant_rank: 0,
+ options: {},
+ is_default: true,
+ },
+ ])
+ )
+ }
+ }
+ }, [tab])
+
+ useEffect(() => {
+ if (onSaveVariantMediaRef) {
+ onSaveVariantMediaRef.current = handleSaveVariantMedia
+ }
+ }, [handleSaveVariantMedia, onSaveVariantMediaRef])
+
const handleSubmit = form.handleSubmit(async (values, e) => {
let isDraftSubmission = false
if (e?.nativeEvent instanceof SubmitEvent) {
- const submitter = e?.nativeEvent?.submitter as HTMLButtonElement
- isDraftSubmission = submitter.dataset.name === SAVE_DRAFT_BUTTON
+ const submitter = e?.nativeEvent
+ ?.submitter as HTMLButtonElement
+ isDraftSubmission =
+ submitter.dataset.name === SAVE_DRAFT_BUTTON
}
const media = values.media || []
- const payload = { ...values, media: undefined }
+ const { secondary_categories, ...rest } = values as any
+ const secCatProductKey =
+ Array.isArray(secondary_categories) &&
+ secondary_categories.length > 0
+ ? `sec-cat-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`
+ : undefined
+
+ const adminAttributes: Array<{
+ attribute_id: string
+ values: string[]
+ use_for_variations: boolean
+ }> = []
+
+ const vendorAttributes: Array<{
+ name: string
+ values: string[]
+ use_for_variations: boolean
+ ui_component: string
+ }> = []
+
+ const allFieldNames = Object.keys(values)
+
+ let dynamicAttributeFields: string[] = []
+
+ if (allAttributes && allAttributes.length > 0) {
+ dynamicAttributeFields = allAttributes.map(
+ (attr: any) => attr.handle || attr.id
+ )
+ }
- let uploadedMedia: (HttpTypes.AdminFile & {
- isThumbnail: boolean
- })[] = []
+ const vendorOptions =
+ rest.options?.filter(
+ (opt: any) =>
+ opt.metadata?.author === "vendor" &&
+ opt.title &&
+ opt.values?.length > 0
+ ) || []
+
+ const vendorOptionsForVariants = vendorOptions.filter(
+ (opt: any) => opt.useForVariants === true
+ )
+
+ const adminOptionsForVariants = (rest.options || []).filter(
+ (opt: any) =>
+ opt.useForVariants === true &&
+ opt.metadata?.author === "admin" &&
+ opt.attributeId &&
+ opt.title &&
+ opt.values?.length > 0
+ )
+
+ const requiredAttributeOptions: Array<{
+ title: string
+ values: string[]
+ metadata: Record<string, unknown>
+ useForVariants: boolean
+ }> = []
+
+ allAttributes?.forEach((attr: any) => {
+ if (!attr.is_required) return
+
+ const fieldHandle = attr.handle || attr.id
+ const value = form.getValues(fieldHandle as any)
+ if (value === undefined || value === null || value === "")
+ return
+
+ if (
+ attr.ui_component === "multivalue" &&
+ Array.isArray(value) &&
+ value.length > 0
+ ) {
+ const useForVariants = form.getValues(
+ `${fieldHandle}UseForVariants` as any
+ )
+ const selectedValues = value
+ .map((valueId: string) => {
+ const possibleValue = attr.possible_values?.find(
+ (pv: any) => pv.id === valueId
+ )
+ return possibleValue ? possibleValue.value : null
+ })
+ .filter((item: any): item is string => item !== null)
+
+ if (selectedValues.length > 0 && useForVariants === true) {
+ requiredAttributeOptions.push({
+ title: attr.name,
+ values: selectedValues,
+ metadata: { author: "admin" },
+ useForVariants: true,
+ })
+ }
+ }
+ })
+
+ const allOptions = [
+ ...vendorOptionsForVariants,
+ ...requiredAttributeOptions,
+ ...adminOptionsForVariants,
+ ]
+
+ dynamicAttributeFields.forEach((fieldName) => {
+ const value = form.getValues(fieldName as any)
+ if (value === undefined || value === null || value === "")
+ return
+
+ const attribute = allAttributes?.find(
+ (attr: any) => (attr.handle || attr.id) === fieldName
+ )
+ if (!attribute) return
+
+ if (Array.isArray(value) && value.length > 0) {
+ const attrFieldHandle = (attribute as any).handle || (attribute as any).id
+ const useForVariants = form.getValues(
+ `${attrFieldHandle}UseForVariants` as any
+ )
+ const vals = value
+ .map((valueId: string) => {
+ const possibleValue = (
+ attribute as any
+ ).possible_values?.find(
+ (pv: any) => pv.id === valueId
+ )
+ return possibleValue ? possibleValue.value : valueId
+ })
+ .filter(
+ (item: any): item is string =>
+ item !== null && item !== undefined
+ )
+
+ if (vals.length > 0) {
+ adminAttributes.push({
+ attribute_id: (attribute as any).id,
+ values: vals.map((item: any) => String(item)),
+ use_for_variations: useForVariants === true,
+ })
+ }
+ } else if (!Array.isArray(value)) {
+ let actualValue = value
+ if (
+ (attribute as any).possible_values &&
+ typeof value === "string"
+ ) {
+ const possibleValue = (
+ attribute as any
+ ).possible_values.find(
+ (pv: any) => pv.id === value
+ )
+ if (possibleValue) {
+ actualValue = possibleValue.value
+ }
+ }
+
+ adminAttributes.push({
+ attribute_id: (attribute as any).id,
+ values: [String(actualValue)],
+ use_for_variations: false,
+ })
+ }
+ })
+
+ vendorOptions.forEach((option: any) => {
+ vendorAttributes.push({
+ name: option.title,
+ values: option.values.map((value: any) => String(value)),
+ use_for_variations: option.useForVariants === true,
+ ui_component: "multivalue",
+ })
+ })
+
+ const allFormOptions: any[] = rest.options || []
+
+ allFormOptions
+ .filter(
+ (opt: any) =>
+ opt.useForVariants === false &&
+ opt.metadata?.author === "admin" &&
+ opt.attributeId &&
+ opt.title &&
+ opt.values?.length > 0
+ )
+ .forEach((option: any) => {
+ adminAttributes.push({
+ attribute_id: option.attributeId,
+ values: option.values.map((value: any) =>
+ String(value)
+ ),
+ use_for_variations: false,
+ })
+ })
+
+ adminOptionsForVariants.forEach((option: any) => {
+ adminAttributes.push({
+ attribute_id: option.attributeId,
+ values: option.values.map((value: any) => String(value)),
+ use_for_variations: true,
+ })
+ })
+
+ const { ...payload } = rest
+ dynamicAttributeFields.forEach((fieldName) => {
+ delete payload[fieldName as keyof typeof payload]
+ })
+ const useForVariantsFields = allFieldNames.filter((fieldName) =>
+ fieldName.endsWith("UseForVariants")
+ )
+ useForVariantsFields.forEach((fieldName) => {
+ delete payload[fieldName as keyof typeof payload]
+ })
+
+ const finalPayload = { ...payload, media: undefined }
+
+ let uploadedMedia: UploadedMedia[] = []
try {
if (media.length) {
- const thumbnailReq = media.filter((m) => m.isThumbnail)
- const otherMediaReq = media.filter((m) => !m.isThumbnail)
+ const thumbnailReq = media.filter(
+ (m: MediaItem) => m.isThumbnail && m.file
+ )
+ const otherMediaReq = media.filter(
+ (m: MediaItem) => !m.isThumbnail && m.file
+ )
- const fileReqs = []
+ const fileReqs: Array<Promise<UploadedMedia[]>> = []
if (thumbnailReq?.length) {
fileReqs.push(
- uploadFilesQuery(thumbnailReq).then((r: any) =>
- r.files.map((f: any) => ({
- ...f,
- isThumbnail: true,
- }))
+ uploadFilesQuery(thumbnailReq).then(
+ (r: { files?: HttpTypes.AdminFile[] }) =>
+ (Array.isArray(r?.files) ? r.files : []).map(
+ (f: HttpTypes.AdminFile) => ({
+ ...f,
+ isThumbnail: true,
+ })
+ )
)
)
}
if (otherMediaReq?.length) {
fileReqs.push(
- uploadFilesQuery(otherMediaReq).then((r: any) =>
- r.files.map((f: any) => ({
- ...f,
- isThumbnail: false,
- }))
+ uploadFilesQuery(otherMediaReq).then(
+ (r: { files?: HttpTypes.AdminFile[] }) =>
+ (Array.isArray(r?.files) ? r.files : []).map(
+ (f: HttpTypes.AdminFile) => ({
+ ...f,
+ isThumbnail: false,
+ })
+ )
)
)
}
@@ -143,107 +551,573 @@ export const ProductCreateForm = ({
}
}
- await mutateAsync(
- {
- ...payload,
- status: isDraftSubmission ? "draft" : "published",
- images: uploadedMedia,
- weight: parseInt(payload.weight || "") || undefined,
- length: parseInt(payload.length || "") || undefined,
- height: parseInt(payload.height || "") || undefined,
- width: parseInt(payload.width || "") || undefined,
- type_id: payload.type_id || undefined,
- tags:
- payload.tags?.map((tag) => ({
- id: tag,
- })) || [],
- collection_id: payload.collection_id || undefined,
- shipping_profile_id: undefined,
- enable_variants: undefined,
- additional_data: undefined,
- categories: payload.categories.map((cat) => ({
- id: cat,
- })),
- variants: payload.variants.map((variant) => ({
- ...variant,
- sku: variant.sku === "" ? undefined : variant.sku,
+ const blobToUploadedUrl = new Map<string, string>()
+ const allOriginalMedia = media as MediaItem[]
+
+ if (uploadedMedia.length > 0) {
+ const thumbnailItems = allOriginalMedia.filter(
+ (m: MediaItem) => m.isThumbnail && m.file
+ )
+ const otherItems = allOriginalMedia.filter(
+ (m: MediaItem) => !m.isThumbnail && m.file
+ )
+
+ let thumbIdx = 0
+ let otherIdx = 0
+
+ for (const uploaded of uploadedMedia) {
+ if (
+ uploaded.isThumbnail &&
+ thumbIdx < thumbnailItems.length
+ ) {
+ const blobUrl = thumbnailItems[thumbIdx].url
+ if (blobUrl) {
+ blobToUploadedUrl.set(blobUrl, uploaded.url)
+ }
+ thumbIdx++
+ }
+ if (
+ !uploaded.isThumbnail &&
+ otherIdx < otherItems.length
+ ) {
+ const blobUrl = otherItems[otherIdx].url
+ if (blobUrl) {
+ blobToUploadedUrl.set(blobUrl, uploaded.url)
+ }
+ otherIdx++
+ }
+ }
+ }
+
+ const variantsToCreate = finalPayload.variants.filter(
+ (variant: any) => variant.should_create === true
+ )
+
+ const variantImageKeyByIndex = new Map<number, string>()
+ const variantsImages: any[] = []
+
+ for (let i = 0; i < variantsToCreate.length; i++) {
+ const variant = variantsToCreate[i]
+ const variantMedia: MediaItem[] = variant.media || []
+ if (!variantMedia.length) continue
+
+ const resolvedUrls = variantMedia
+ .map((m: any) =>
+ m.url ? blobToUploadedUrl.get(m.url) : undefined
+ )
+ .filter((url: any): url is string => !!url)
+
+ if (resolvedUrls.length === 0) continue
+
+ const variantThumb = variantMedia.find(
+ (m: any) => m.isThumbnail
+ )
+ const resolvedThumbUrl = variantThumb?.url
+ ? blobToUploadedUrl.get(variantThumb.url)
+ : undefined
+ const thumbnailUrl = resolvedThumbUrl || resolvedUrls[0]
+
+ const variantImageKey = `variant-${i}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`
+
+ variantImageKeyByIndex.set(i, variantImageKey)
+ variantsImages.push({
+ variant_image_key: variantImageKey,
+ image_urls: resolvedUrls,
+ thumbnail_url: thumbnailUrl,
+ })
+ }
+
+ const mappedVariants = variantsToCreate.map(
+ (variant: any, index: number) => {
+ const mappedOptions: Record<string, string> = {}
+
+ allOptions.forEach((option: any) => {
+ if (variant.options && variant.options[option.title]) {
+ mappedOptions[option.title] =
+ variant.options[option.title]
+ } else {
+ const variantTitle = variant.title || ""
+ const optionValues = option.values || []
+ const matchingValue = optionValues.find(
+ (value: string) => variantTitle.includes(value)
+ )
+ if (matchingValue) {
+ mappedOptions[option.title] = matchingValue
+ } else if (optionValues.length > 0) {
+ mappedOptions[option.title] = optionValues[0]
+ }
+ }
+ })
+
+ const variantImageKey = variantImageKeyByIndex.get(index)
+ const {
+ media: _media,
+ stock_locations: _sl,
+ ...variantWithoutMedia
+ } = variant
+
+ return {
+ ...variantWithoutMedia,
+ options:
+ Object.keys(mappedOptions).length > 0
+ ? mappedOptions
+ : { "Default option": "Default option value" },
+ ...(variantImageKey && {
+ metadata: { variant_image_key: variantImageKey },
+ }),
+ }
+ }
+ )
+
+ const payloadToSend = {
+ ...finalPayload,
+ status: isDraftSubmission ? "draft" : "proposed",
+ images: uploadedMedia,
+ weight:
+ parseInt((finalPayload as any).weight || "") || undefined,
+ length:
+ parseInt((finalPayload as any).length || "") || undefined,
+ height:
+ parseInt((finalPayload as any).height || "") || undefined,
+ width:
+ parseInt((finalPayload as any).width || "") || undefined,
+ type_id: (finalPayload as any).type_id || undefined,
+ tags:
+ (finalPayload as any).tags?.map((tag: any) => ({
+ id: tag,
+ })) || [],
+ collection_id:
+ (finalPayload as any).collection_id || undefined,
+ shipping_profile_id: undefined,
+ enable_variants: undefined,
+ options:
+ allOptions.length > 0
+ ? allOptions
+ : [
+ {
+ title: "Default option",
+ values: ["Default option value"],
+ },
+ ],
+ metadata: (() => {
+ const existing = (finalPayload as any)?.metadata ?? undefined
+ if (!secCatProductKey) return existing
+ return {
+ ...(existing ?? {}),
+ [SEC_CAT_PRODUCT_KEY]: secCatProductKey,
+ }
+ })(),
+ additional_data: (() => {
+ const additionalData: Record<string, any> = {}
+ if (adminAttributes.length > 0) {
+ additionalData.admin_attributes = adminAttributes
+ }
+ if (vendorAttributes.length > 0) {
+ additionalData.vendor_attributes = vendorAttributes
+ }
+ if (
+ Array.isArray(secondary_categories) &&
+ secondary_categories.length > 0 &&
+ secCatProductKey
+ ) {
+ additionalData.secondary_categories = [
+ {
+ sec_cat_product_key: secCatProductKey,
+ category_ids: secondary_categories,
+ },
+ ]
+ }
+ if (variantsImages.length > 0) {
+ additionalData.variants_images = variantsImages
+ }
+ return Object.keys(additionalData).length > 0
+ ? additionalData
+ : undefined
+ })(),
+ categories: finalPayload.categories.map((cat: any) => ({
+ id: cat,
+ })),
+ variants: mappedVariants.map((variant: any) => {
+ const {
+ media: _m,
+ stock_locations: _sl,
+ ...variantWithoutMedia
+ } = variant
+ return {
+ ...variantWithoutMedia,
+ sku:
+ variant.sku === "" ? undefined : variant.sku,
manage_inventory: true,
allow_backorder: false,
should_create: undefined,
is_default: undefined,
inventory_kit: undefined,
inventory: undefined,
- prices: Object.keys(variant.prices || {}).map((key) => ({
- currency_code: key,
- amount: parseFloat(variant.prices?.[key] as string),
- })),
- })),
- },
- {
- onSuccess: (data) => {
- toast.success(
- t("products.create.successToast", {
- title: data.product.title,
+ prices: Object.keys(variant.prices || {}).map(
+ (key: string) => ({
+ currency_code: key,
+ amount: parseFloat(variant.prices?.[key] as string),
})
- )
+ ),
+ }
+ }),
+ }
- handleSuccess(`../${data.product.id}`)
- },
- onError: (error) => {
- toast.error(error.message)
- },
- }
- )
+ const productData = await mutateAsync(payloadToSend as any, {
+ onError: (error) => {
+ toast.error(error.message)
+ },
+ })
+
+ toast.success(t("products.create.successToast", { title: (productData as any).product.title }))
+ handleSuccess(`../${(productData as any).product.id}`)
})
+ const onNext = async (currentTab: Tab) => {
+ let fieldsToValidate: (keyof ProductCreateSchemaType)[] = []
+ let shouldProceed = true
+
+ switch (currentTab) {
+ case Tab.DETAILS:
+ fieldsToValidate = ["title", "handle"]
+ break
+ case Tab.ORGANIZE:
+ fieldsToValidate = ["categories"]
+ break
+ case Tab.ATTRIBUTES:
+ if (attributesFormRef.current) {
+ shouldProceed =
+ await attributesFormRef.current.validateAttributes()
+ }
+ break
+ case Tab.VARIANTS:
+ fieldsToValidate = ["variants", "options"]
+ break
+ case Tab.INVENTORY:
+ break
+ }
+
+ if (fieldsToValidate.length > 0) {
+ const valid = await form.trigger(fieldsToValidate)
+ if (!valid) return
+ }
+
+ if (!shouldProceed) return
+
+ let nextTab: Tab
+ if (currentTab === Tab.DETAILS) {
+ nextTab = Tab.ORGANIZE
+ } else if (currentTab === Tab.ORGANIZE) {
+ nextTab = Tab.ATTRIBUTES
+ } else if (currentTab === Tab.ATTRIBUTES) {
+ nextTab = Tab.VARIANTS
+ } else if (currentTab === Tab.VARIANTS) {
+ nextTab = Tab.INVENTORY
+ } else {
+ return
+ }
+
+ const currentTabIndex = TAB_ORDER.indexOf(currentTab)
+ const currentMaxIndex = TAB_ORDER.indexOf(maxReachedTab)
+ if (currentTabIndex >= currentMaxIndex) {
+ setMaxReachedTab(TAB_ORDER[currentMaxIndex + 1])
+ }
+
+ setTab(nextTab)
+ }
+
+ useEffect(() => {
+ const currentIndex = TAB_ORDER.indexOf(tab)
+ const maxReachedIndex = TAB_ORDER.indexOf(maxReachedTab)
+
+ const currentState: TabState = {
+ [Tab.DETAILS]: "not-started",
+ [Tab.ORGANIZE]: "not-started",
+ [Tab.ATTRIBUTES]: "not-started",
+ [Tab.VARIANTS]: "not-started",
+ [Tab.INVENTORY]: "not-started",
+ }
+
+ TAB_ORDER.forEach((tabItem, index) => {
+ if (index < currentIndex && index <= maxReachedIndex) {
+ currentState[tabItem] = "completed"
+ } else if (index === currentIndex) {
+ currentState[tabItem] = "in-progress"
+ } else if (
+ index > currentIndex &&
+ index <= maxReachedIndex
+ ) {
+ currentState[tabItem] = "completed"
+ } else {
+ currentState[tabItem] = "not-started"
+ }
+ })
+
+ setTabState(currentState)
+ }, [tab, maxReachedTab])
+
return (
- <TabbedForm
- form={form}
- onSubmit={handleSubmit}
- isLoading={isPending}
- transformTabs={transformTabs}
- footer={({ isLastTab, onNext, isLoading }) => (
- <div className="flex items-center justify-end gap-x-2">
- <RouteFocusModal.Close asChild>
- <Button variant="secondary" size="small">
- {t("actions.cancel")}
- </Button>
- </RouteFocusModal.Close>
- <Button
- data-name={SAVE_DRAFT_BUTTON}
- size="small"
- type="submit"
- isLoading={isLoading}
- className="whitespace-nowrap"
+ <TabbedFormContext.Provider value={form}>
+ <RouteFocusModal.Form form={form}>
+ <KeyboundForm
+ onKeyDown={(e) => {
+ if (e.key === "Enter") {
+ if (
+ e.target instanceof HTMLTextAreaElement &&
+ !(e.metaKey || e.ctrlKey)
+ ) {
+ return
+ }
+ e.preventDefault()
+ if (e.metaKey || e.ctrlKey) {
+ if (tab !== Tab.VARIANTS) {
+ e.stopPropagation()
+ onNext(tab)
+ return
+ }
+ handleSubmit()
+ }
+ }
+ }}
+ onSubmit={handleSubmit}
+ className="flex h-full flex-col"
+ >
+ <ProgressTabs
+ value={tab}
+ onValueChange={async (newTab) => {
+ const newTabValue = newTab as Tab
+ const currentIndex = TAB_ORDER.indexOf(tab)
+ const newIndex = TAB_ORDER.indexOf(newTabValue)
+ const maxReachedIndex =
+ TAB_ORDER.indexOf(maxReachedTab)
+
+ const movingForward = isMovingForward(
+ tab,
+ newTabValue
+ )
+
+ if (movingForward) {
+ if (newIndex > maxReachedIndex + 1) return
+
+ let fieldsToValidate: (keyof ProductCreateSchemaType)[] =
+ []
+
+ switch (tab) {
+ case Tab.DETAILS:
+ fieldsToValidate = ["title", "handle"]
+ break
+ case Tab.ORGANIZE:
+ fieldsToValidate = ["categories"]
+ break
+ case Tab.ATTRIBUTES:
+ fieldsToValidate = []
+ break
+ case Tab.VARIANTS:
+ fieldsToValidate = ["variants", "options"]
+ break
+ case Tab.INVENTORY:
+ break
+ }
+
+ if (fieldsToValidate.length > 0) {
+ const valid =
+ await form.trigger(fieldsToValidate)
+ if (!valid) return
+ } else if (tab === Tab.ATTRIBUTES) {
+ if (attributesFormRef.current) {
+ const valid =
+ await attributesFormRef.current.validateAttributes()
+ if (!valid) return
+ }
+ }
+
+ if (currentIndex >= maxReachedIndex) {
+ setMaxReachedTab(
+ TAB_ORDER[currentIndex + 1]
+ )
+ }
+ }
+
+ setTab(newTabValue)
+ }}
+ className="flex h-full flex-col overflow-hidden"
>
- Draft
- </Button>
- {isLastTab ? (
- <Button
- data-name="publish-button"
- key="submit-button"
- type="submit"
- variant="primary"
- size="small"
- isLoading={isLoading}
- >
- Create Product
- </Button>
- ) : (
- <Button
- key="next-button"
- type="button"
- variant="primary"
- size="small"
- onClick={() => onNext()}
- >
- {t("actions.continue")}
- </Button>
- )}
- </div>
- )}
+ <RouteFocusModal.Header>
+ <div className="-my-2 w-full border-l">
+ <ProgressTabs.List className="justify-start-start flex w-full items-center">
+ <ProgressTabs.Trigger
+ status={tabState[Tab.DETAILS]}
+ value={Tab.DETAILS}
+ className="max-w-[200px] truncate"
+ >
+ {t("products.create.tabs.details")}
+ </ProgressTabs.Trigger>
+ <ProgressTabs.Trigger
+ status={tabState[Tab.ORGANIZE]}
+ value={Tab.ORGANIZE}
+ className="max-w-[200px] truncate"
+ >
+ {t("products.create.tabs.organize")}
+ </ProgressTabs.Trigger>
+ <ProgressTabs.Trigger
+ status={tabState[Tab.ATTRIBUTES]}
+ value={Tab.ATTRIBUTES}
+ className="max-w-[200px] truncate"
+ >
+ {t("products.create.tabs.attributes")}
+ </ProgressTabs.Trigger>
+ <ProgressTabs.Trigger
+ status={tabState[Tab.VARIANTS]}
+ value={Tab.VARIANTS}
+ className="max-w-[200px] truncate"
+ >
+ {t("products.create.tabs.variants")}
+ </ProgressTabs.Trigger>
+ {showInventoryTab && (
+ <ProgressTabs.Trigger
+ status={tabState[Tab.INVENTORY]}
+ value={Tab.INVENTORY}
+ className="max-w-[200px] truncate"
+ >
+ {t("products.create.tabs.inventory")}
+ </ProgressTabs.Trigger>
+ )}
+ </ProgressTabs.List>
+ </div>
+ </RouteFocusModal.Header>
+ <RouteFocusModal.Body className="size-full overflow-hidden">
+ <ProgressTabs.Content
+ className="size-full overflow-y-auto"
+ value={Tab.DETAILS}
+ >
+ <ProductCreateDetailsForm form={form as any} />
+ </ProgressTabs.Content>
+ <ProgressTabs.Content
+ className="size-full overflow-y-auto"
+ value={Tab.ORGANIZE}
+ >
+ <ProductCreateOrganizeForm
+ form={form as any}
+ />
+ </ProgressTabs.Content>
+ <ProgressTabs.Content
+ className="size-full overflow-y-auto"
+ value={Tab.ATTRIBUTES}
+ >
+ <ProductCreateAttributesForm
+ form={form as any}
+ ref={attributesFormRef}
+ />
+ </ProgressTabs.Content>
+ <ProgressTabs.Content
+ className="size-full overflow-y-auto"
+ value={Tab.VARIANTS}
+ >
+ <ProductCreateVariantsForm
+ form={form as any}
+ store={store}
+ regions={regions}
+ pricePreferences={pricePreferences}
+ onOpenMediaModal={onOpenMediaModal}
+ productMedia={watchedMedia || []}
+ />
+ </ProgressTabs.Content>
+ {showInventoryTab && (
+ <ProgressTabs.Content
+ className="size-full overflow-y-auto"
+ value={Tab.INVENTORY}
+ >
+ <ProductCreateInventoryKitForm
+ form={form as any}
+ />
+ </ProgressTabs.Content>
+ )}
+ </RouteFocusModal.Body>
+ </ProgressTabs>
+ <RouteFocusModal.Footer>
+ <div className="flex items-center justify-end gap-x-2">
+ <RouteFocusModal.Close asChild>
+ <Button variant="secondary" size="small">
+ {t("actions.cancel")}
+ </Button>
+ </RouteFocusModal.Close>
+ <Button
+ data-name={SAVE_DRAFT_BUTTON}
+ size="small"
+ type="submit"
+ onClick={() => {
+ if (
+ form.getValues("categories").length ===
+ 0 &&
+ form.getValues("title")
+ ) {
+ onNext(Tab.DETAILS)
+ return
+ }
+ handleSubmit()
+ }}
+ isLoading={isPending}
+ variant="secondary"
+ className="whitespace-nowrap"
+ >
+ {t("actions.saveAsDraft")}
+ </Button>
+ <PrimaryButton
+ tab={tab}
+ next={onNext}
+ isLoading={isPending}
+ showInventoryTab={showInventoryTab}
+ />
+ </div>
+ </RouteFocusModal.Footer>
+ </KeyboundForm>
+ </RouteFocusModal.Form>
+ </TabbedFormContext.Provider>
+ )
+}
+
+type PrimaryButtonProps = {
+ tab: Tab
+ next: (tab: Tab) => void
+ isLoading?: boolean
+ showInventoryTab: boolean
+}
+
+const PrimaryButton = ({
+ tab,
+ next,
+ isLoading,
+ showInventoryTab,
+}: PrimaryButtonProps) => {
+ const { t } = useTranslation()
+
+ if (
+ (tab === Tab.VARIANTS && !showInventoryTab) ||
+ (tab === Tab.INVENTORY && showInventoryTab)
+ ) {
+ return (
+ <Button
+ data-name="publish-button"
+ key="submit-button"
+ type="submit"
+ variant="primary"
+ size="small"
+ isLoading={isLoading}
+ >
+ {t("actions.publish")}
+ </Button>
+ )
+ }
+
+ return (
+ <Button
+ key="next-button"
+ type="button"
+ variant="primary"
+ size="small"
+ onClick={() => next(tab)}
>
- {hasCustomChildren ? children : defaultTabs}
- </TabbedForm>
+ {t("actions.continue")}
+ </Button>
)
}
diff --git a/packages/vendor/src/pages/products/create/product-create-organize-form/components/product-create-organize-section/product-create-details-organize-section.tsx b/packages/vendor/src/pages/products/create/product-create-organize-form/components/product-create-organize-section/product-create-details-organize-section.tsx
index 50ce5cee7..eba159373 100644
--- a/packages/vendor/src/pages/products/create/product-create-organize-form/components/product-create-organize-section/product-create-details-organize-section.tsx
+++ b/packages/vendor/src/pages/products/create/product-create-organize-form/components/product-create-organize-section/product-create-details-organize-section.tsx
@@ -1,3 +1,5 @@
+import { useState } from "react";
+
import { Heading } from "@medusajs/ui";
import { useTranslation } from "react-i18next";
@@ -66,21 +68,20 @@ export const ProductCreateOrganizationSection = () => {
<div className="grid grid-cols-1 gap-4 md:grid-cols-2">
<Form.Field
control={form.control}
- name="type_id"
+ name="tags"
render={({ field }) => {
return (
<Form.Item>
<Form.Label optional>
- {t("products.fields.type.label")}
+ {t("products.fields.tags.label")}
</Form.Label>
<Form.Control>
<Combobox
{...field}
- options={types.options}
- searchValue={types.searchValue}
- onSearchValueChange={types.onSearchValueChange}
- fetchNextPage={types.fetchNextPage}
- allowClear
+ options={tags.options}
+ searchValue={tags.searchValue}
+ onSearchValueChange={tags.onSearchValueChange}
+ fetchNextPage={tags.fetchNextPage}
/>
</Form.Control>
<Form.ErrorMessage />
@@ -90,20 +91,20 @@ export const ProductCreateOrganizationSection = () => {
/>
<Form.Field
control={form.control}
- name="collection_id"
+ name="type_id"
render={({ field }) => {
return (
<Form.Item>
<Form.Label optional>
- {t("products.fields.collection.label")}
+ {t("products.fields.type.label")}
</Form.Label>
<Form.Control>
<Combobox
{...field}
- options={collections.options}
- searchValue={collections.searchValue}
- onSearchValueChange={collections.onSearchValueChange}
- fetchNextPage={collections.fetchNextPage}
+ options={types.options}
+ searchValue={types.searchValue}
+ onSearchValueChange={types.onSearchValueChange}
+ fetchNextPage={types.fetchNextPage}
allowClear
/>
</Form.Control>
@@ -117,36 +118,70 @@ export const ProductCreateOrganizationSection = () => {
<Form.Field
control={form.control}
name="categories"
+ render={({ field }) => {
+ const [isFocused, setIsFocused] = useState(false);
+
+ return (
+ <Form.Item>
+ <Form.Label tooltip={t("products.fields.primaryCategory.tooltip")}>
+ {t("products.fields.primaryCategory.label")}
+ </Form.Label>
+ <Form.Control>
+ <CategoryCombobox
+ {...field}
+ onFocus={() => setIsFocused(true)}
+ onBlur={() => {
+ setIsFocused(false);
+ field.onBlur();
+ }}
+ isSingleSelect
+ allowClear={false}
+ />
+ </Form.Control>
+ {!isFocused && <Form.ErrorMessage />}
+ </Form.Item>
+ );
+ }}
+ />
+ <Form.Field
+ control={form.control}
+ name={"secondary_categories" as any}
render={({ field }) => {
return (
<Form.Item>
<Form.Label optional>
- {t("products.fields.categories.label")}
+ {t("products.fields.secondaryCategories.label", "Secondary Categories")}
</Form.Label>
<Form.Control>
- <CategoryCombobox {...field} />
+ <CategoryCombobox
+ {...field}
+ value={field.value || []}
+ />
</Form.Control>
<Form.ErrorMessage />
</Form.Item>
);
}}
/>
+ </div>
+ <div className="grid grid-cols-1 gap-4 md:grid-cols-2">
<Form.Field
control={form.control}
- name="tags"
+ name="collection_id"
render={({ field }) => {
return (
<Form.Item>
<Form.Label optional>
- {t("products.fields.tags.label")}
+ {t("products.fields.collection.label")}
</Form.Label>
<Form.Control>
<Combobox
{...field}
- options={tags.options}
- searchValue={tags.searchValue}
- onSearchValueChange={tags.onSearchValueChange}
- fetchNextPage={tags.fetchNextPage}
+ options={collections.options}
+ searchValue={collections.searchValue}
+ onSearchValueChange={collections.onSearchValueChange}
+ fetchNextPage={collections.fetchNextPage}
+ allowClear
/>
</Form.Control>
<Form.ErrorMessage />
diff --git a/packages/vendor/src/pages/products/create/product-create-page.tsx b/packages/vendor/src/pages/products/create/product-create-page.tsx
index 735bfc857..58cf14e63 100644
--- a/packages/vendor/src/pages/products/create/product-create-page.tsx
+++ b/packages/vendor/src/pages/products/create/product-create-page.tsx
@@ -1,7 +1,7 @@
-import { Children, ReactNode } from "react"
+import { Children, ReactNode, useCallback, useRef, useState } from "react"
import { useTranslation } from "react-i18next"
-import { RouteFocusModal } from "@components/modals"
+import { RouteFocusModal, StackedFocusModal, useStackedModal } from "@components/modals"
import { useSalesChannels } from "@hooks/api"
import { useStore } from "@hooks/api/store"
@@ -10,9 +10,95 @@ import { ProductCreateDetailsForm } from "./product-create-details-form"
import { ProductCreateOrganizeForm } from "./product-create-organize-form"
import { ProductCreateVariantsForm } from "./product-create-variants-form"
import { ProductCreateInventoryKitForm } from "./product-create-inventory-kit-form"
+import { VariantMediaView } from "./variant-media-view/variant-media-view"
import { TabbedForm } from "@components/tabbed-form"
import { HttpTypes } from "@mercurjs/types"
+type MediaItem = {
+ file?: File
+ url?: string
+ isThumbnail?: boolean
+ id?: string
+}
+
+const ProductCreateFormWithModal = ({
+ defaultChannel,
+ store,
+}: {
+ defaultChannel?: HttpTypes.AdminSalesChannel
+ store?: HttpTypes.AdminStore
+}) => {
+ const { setIsOpen } = useStackedModal()
+ const [selectedVariantIndex, setSelectedVariantIndex] = useState<number | null>(null)
+ const [selectedVariantTitle, setSelectedVariantTitle] = useState<string | undefined>(undefined)
+ const [selectedVariantMedia, setSelectedVariantMedia] = useState<MediaItem[] | undefined>(undefined)
+ const [productMedia, setProductMedia] = useState<MediaItem[]>([])
+ const saveVariantMediaRef = useRef<
+ ((variantIndex: number, media: MediaItem[]) => void) | null
+ >(null)
+
+ const handleOpenMediaModal = useCallback(
+ (
+ variantIndex: number,
+ variantTitle?: string,
+ initialMedia?: MediaItem[],
+ currentProductMedia?: MediaItem[]
+ ) => {
+ setSelectedVariantIndex(variantIndex)
+ setSelectedVariantTitle(variantTitle)
+ setSelectedVariantMedia(initialMedia)
+ setProductMedia(currentProductMedia || [])
+ setIsOpen("variant-media-modal", true)
+ },
+ []
+ )
+
+ const handleCloseModal = () => {
+ setIsOpen("variant-media-modal", false)
+ setSelectedVariantIndex(null)
+ setSelectedVariantTitle(undefined)
+ setSelectedVariantMedia(undefined)
+ setProductMedia([])
+ }
+
+ const handleSaveMedia = useCallback((variantIndex: number, media: MediaItem[]) => {
+ if (saveVariantMediaRef.current) {
+ saveVariantMediaRef.current(variantIndex, media)
+ }
+ handleCloseModal()
+ }, [])
+
+ return (
+ <>
+ <ProductCreateForm
+ defaultChannel={defaultChannel}
+ store={store}
+ onOpenMediaModal={handleOpenMediaModal}
+ onSaveVariantMediaRef={saveVariantMediaRef}
+ />
+ <StackedFocusModal
+ id="variant-media-modal"
+ onOpenChangeCallback={(open) => {
+ if (!open) {
+ handleCloseModal()
+ }
+ }}
+ >
+ {selectedVariantIndex !== null && (
+ <VariantMediaView
+ variantIndex={selectedVariantIndex}
+ variantTitle={selectedVariantTitle}
+ onClose={handleCloseModal}
+ onSaveMedia={handleSaveMedia}
+ initialMedia={selectedVariantMedia}
+ productMedia={productMedia}
+ />
+ )}
+ </StackedFocusModal>
+ </>
+ )
+}
+
const Root = ({ children }: { children?: ReactNode }) => {
const { t } = useTranslation()
@@ -39,7 +125,7 @@ const Root = ({ children }: { children?: ReactNode }) => {
Children.count(children) > 0 ? (
children
) : (
- <ProductCreateForm defaultChannel={defaultChannel} />
+ <ProductCreateFormWithModal defaultChannel={defaultChannel} store={store} />
)
)}
</RouteFocusModal>
diff --git a/packages/vendor/src/pages/products/create/product-create-variants-form/product-create-variants-form.tsx b/packages/vendor/src/pages/products/create/product-create-variants-form/product-create-variants-form.tsx
index ef33592f8..5c7e51120 100644
--- a/packages/vendor/src/pages/products/create/product-create-variants-form/product-create-variants-form.tsx
+++ b/packages/vendor/src/pages/products/create/product-create-variants-form/product-create-variants-form.tsx
@@ -1,5 +1,9 @@
-import { Children, ReactNode, useMemo } from "react"
-import { useWatch } from "react-hook-form"
+import { useCallback, useEffect, useMemo, useRef, useState } from "react"
+
+import { HttpTypes } from "@medusajs/types"
+import { Checkbox, Tooltip } from "@medusajs/ui"
+import { ColumnDef } from "@tanstack/react-table"
+import { UseFormReturn, useWatch } from "react-hook-form"
import { useTranslation } from "react-i18next"
import {
@@ -7,32 +11,48 @@ import {
createDataGridPriceColumns,
DataGrid,
} from "@components/data-grid"
-import { useRouteModal } from "@components/modals"
-import { useTabbedForm } from "@components/tabbed-form"
-import { useStore } from "@hooks/api/store"
-import { useRegions } from "@hooks/api"
-import { usePricePreferences } from "@hooks/api/price-preferences"
-import {
- ProductCreateOptionSchema,
- ProductCreateVariantSchema,
-} from "../constants"
-import { ProductCreateSchemaType, TabDefinition } from "../types"
+import { DataGridMediaCell } from "../../../../components/data-grid/components/data-grid-media-cell"
+import { useAttributes } from "../../../../hooks/api/attributes"
+import { useStockLocations } from "@hooks/api/stock-locations"
+import { ProductCreateVariantSchema } from "../constants"
+import { ProductCreateSchemaType } from "../types"
+import { decorateVariantsWithDefaultValues } from "../utils"
+
+type MediaItem = {
+ file?: File
+ url?: string
+ isThumbnail?: boolean
+ id?: string
+}
+
+type ProductCreateVariantsFormProps = {
+ form: UseFormReturn<ProductCreateSchemaType>
+ store?: HttpTypes.AdminStore
+ regions?: HttpTypes.AdminRegion[]
+ pricePreferences?: HttpTypes.AdminPricePreference[]
+ onOpenMediaModal?: (
+ variantIndex: number,
+ variantTitle?: string,
+ initialMedia?: MediaItem[],
+ productMedia?: MediaItem[]
+ ) => void
+ productMedia?: MediaItem[]
+}
type VariantWithIndex = ProductCreateVariantSchema & {
originalIndex: number
}
-const Root = ({ children }: { children?: ReactNode }) => {
- const form = useTabbedForm<ProductCreateSchemaType>()
- const { store } = useStore()
- const { regions } = useRegions({ limit: 9999 })
- const { price_preferences: pricePreferences } = usePricePreferences({ limit: 9999 })
- const { setCloseOnEscape } = useRouteModal()
-
- const currencyCodes = useMemo(
- () => store?.supported_currencies?.map((c) => c.currency_code) || [],
- [store]
- )
+export const ProductCreateVariantsForm = ({
+ form,
+ store,
+ regions = [],
+ pricePreferences = [],
+ onOpenMediaModal,
+ productMedia = [],
+}: ProductCreateVariantsFormProps) => {
+ const { t } = useTranslation()
+ const [searchValue, setSearchValue] = useState("")
const variants = useWatch({
control: form.control,
@@ -40,129 +60,539 @@ const Root = ({ children }: { children?: ReactNode }) => {
defaultValue: [],
})
- const options = useWatch({
+ const attributesResult = useAttributes()
+ const allAttributes = (attributesResult as any).attributes || []
+
+ const { stock_locations = [] } = useStockLocations({
+ limit: 9999,
+ fields: "id,name",
+ })
+
+ const formValues = useWatch({
control: form.control,
- name: "options",
- defaultValue: [],
})
+ const variantAttributes = useMemo(() => {
+ const result: Array<{
+ handle: string
+ name: string
+ selectedValues: Array<{ id: string; value: string }>
+ }> = []
+
+ allAttributes.forEach((attr: any) => {
+ if (attr.ui_component === "multivalue") {
+ const useForVariants = (formValues as any)?.[
+ `${attr.handle}UseForVariants`
+ ]
+ if (useForVariants === false) return
+
+ const selectedValueIds = (formValues as any)?.[attr.handle]
+
+ if (
+ selectedValueIds &&
+ Array.isArray(selectedValueIds) &&
+ selectedValueIds.length > 0
+ ) {
+ const selectedValues = selectedValueIds
+ .map((valueId: string) => {
+ const possibleValue = attr.possible_values?.find(
+ (pv: any) => pv.id === valueId
+ )
+ return possibleValue
+ ? { id: valueId, value: possibleValue.value }
+ : null
+ })
+ .filter(
+ (item: any): item is { id: string; value: string } =>
+ item !== null
+ )
+
+ if (selectedValues.length > 0) {
+ result.push({
+ handle: attr.handle,
+ name: attr.name,
+ selectedValues,
+ })
+ }
+ }
+ }
+ })
+
+ const options = (formValues as any)?.options || []
+ options.forEach((option: any) => {
+ if (
+ option?.useForVariants !== false &&
+ option?.title &&
+ option?.values &&
+ Array.isArray(option.values) &&
+ option.values.length > 0
+ ) {
+ result.push({
+ handle: `option-${option.title}`,
+ name: option.title,
+ selectedValues: option.values.map((value: string) => ({
+ id: value,
+ value,
+ })),
+ })
+ }
+ })
+
+ return result
+ }, [allAttributes, formValues])
+
+ const hasProductMedia = productMedia.length > 0
+
const columns = useColumns({
- options,
- currencies: currencyCodes,
+ variantAttributes,
+ store,
regions,
pricePreferences,
+ stockLocations: stock_locations,
+ onOpenMediaModal,
+ form,
+ productMedia,
+ hasProductMedia,
})
const variantData = useMemo(() => {
const ret: VariantWithIndex[] = []
- variants.forEach((v, i) => {
- if (v.should_create) {
- ret.push({ ...v, originalIndex: i })
+ if (variantAttributes.length > 0) {
+ const totalCombinations = variantAttributes.reduce(
+ (acc, attr) => acc * attr.selectedValues.length,
+ 1
+ )
+
+ for (let i = 0; i < totalCombinations; i++) {
+ const variantOptions: Record<string, string> = {}
+ variantAttributes.forEach((attr) => {
+ let valueIndex = 0
+ let divisor = 1
+
+ for (let j = variantAttributes.length - 1; j >= 0; j--) {
+ if (variantAttributes[j].handle === attr.handle) {
+ valueIndex =
+ Math.floor(i / divisor) %
+ attr.selectedValues.length
+ break
+ }
+ divisor *= variantAttributes[j].selectedValues.length
+ }
+
+ variantOptions[attr.name] =
+ attr.selectedValues[valueIndex]?.value || ""
+ })
+
+ const autoTitle = variantAttributes
+ .map((attr) => variantOptions[attr.name])
+ .filter(Boolean)
+ .join(" / ")
+
+ const existingVariant = variants.find((v) => {
+ if (!v.options) return false
+ return variantAttributes.every(
+ (attr) => v.options[attr.name] === variantOptions[attr.name]
+ )
+ })
+
+ ret.push({
+ title: autoTitle,
+ should_create: existingVariant?.should_create ?? true,
+ variant_rank: i,
+ options: variantOptions,
+ sku: existingVariant?.sku || "",
+ prices: existingVariant?.prices || {},
+ is_default: i === 0,
+ media: existingVariant?.media || [],
+ originalIndex: existingVariant
+ ? variants.indexOf(existingVariant)
+ : i,
+ } as VariantWithIndex)
}
- })
+ } else {
+ variants.forEach((v, i) => {
+ if (v.should_create) {
+ ret.push({
+ ...v,
+ originalIndex: i,
+ } as VariantWithIndex)
+ }
+ })
+ }
return ret
- }, [variants])
+ }, [variants, variantAttributes])
+
+ const filteredVariantData = useMemo(() => {
+ if (!searchValue.trim()) return variantData
+
+ return variantData.filter((variant) =>
+ variant.title.toLowerCase().includes(searchValue.toLowerCase())
+ )
+ }, [variantData, searchValue])
+
+ const variantStructureKey = useMemo(() => {
+ return variantAttributes
+ .map(
+ (attr) =>
+ `${attr.handle}:${attr.selectedValues.map((v) => v.id).join(",")}`
+ )
+ .join("|")
+ }, [variantAttributes])
+
+ useEffect(() => {
+ if (variantAttributes.length > 0) {
+ const totalCombinations = variantAttributes.reduce(
+ (acc, attr) => acc * attr.selectedValues.length,
+ 1
+ )
+ const currentVariants = form.getValues("variants") || []
+ const newVariants: any[] = []
+
+ for (let i = 0; i < totalCombinations; i++) {
+ const variantOptions: Record<string, string> = {}
+ variantAttributes.forEach((attr) => {
+ let valueIndex = 0
+ let divisor = 1
+
+ for (let j = variantAttributes.length - 1; j >= 0; j--) {
+ if (variantAttributes[j].handle === attr.handle) {
+ valueIndex =
+ Math.floor(i / divisor) %
+ attr.selectedValues.length
+ break
+ }
+ divisor *= variantAttributes[j].selectedValues.length
+ }
+
+ variantOptions[attr.name] =
+ attr.selectedValues[valueIndex]?.value || ""
+ })
+
+ const autoTitle = variantAttributes
+ .map((attr) => variantOptions[attr.name])
+ .filter(Boolean)
+ .join(" / ")
- if (Children.count(children) > 0) {
- return <>{children}</>
- }
+ const existingVariant = currentVariants.find((v) => {
+ if (!v.options) return false
+ return variantAttributes.every(
+ (attr) => v.options[attr.name] === variantOptions[attr.name]
+ )
+ })
+
+ newVariants.push({
+ title: autoTitle,
+ should_create: existingVariant?.should_create ?? true,
+ variant_rank: i,
+ options: variantOptions,
+ sku: existingVariant?.sku || "",
+ prices: existingVariant?.prices || {},
+ is_default: i === 0,
+ media: existingVariant?.media || [],
+ })
+ }
+
+ form.setValue("variants", newVariants)
+ } else {
+ const currentVariants = form.getValues("variants") || []
+
+ if (currentVariants.length === 0) {
+ const defaultVariant = decorateVariantsWithDefaultValues([
+ {
+ title: "Default variant",
+ should_create: true,
+ variant_rank: 0,
+ options: {},
+ sku: "",
+ prices: {},
+ is_default: true,
+ media: [],
+ },
+ ])
+
+ form.setValue("variants", defaultVariant)
+ } else {
+ const hasOnlyDefaultVariant =
+ currentVariants.length === 1 && currentVariants[0].is_default
+ if (!hasOnlyDefaultVariant) {
+ const defaultVariant = decorateVariantsWithDefaultValues([
+ {
+ title: "Default variant",
+ should_create: true,
+ variant_rank: 0,
+ options: {},
+ sku: "",
+ prices: {},
+ is_default: true,
+ media: [],
+ },
+ ])
+
+ form.setValue("variants", defaultVariant)
+ }
+ }
+ }
+ }, [variantStructureKey, form])
return (
- <div className="flex size-full flex-col divide-y overflow-hidden">
+ <div className="border-ui-border flex h-full flex-col justify-between divide-y">
<DataGrid
columns={columns}
- data={variantData}
+ data={filteredVariantData}
state={form}
- onEditingChange={(editing) => setCloseOnEscape(!editing)}
+ searchValue={searchValue}
+ onSearchChange={setSearchValue}
+ searchPlaceholder={t(
+ "products.create.variants.productVariants.searchPlaceholder"
+ )}
/>
</div>
)
}
-Root._tabMeta = {
- id: "variants",
- labelKey: "products.create.tabs.variants",
-} satisfies TabDefinition
-
-export const ProductCreateVariantsForm = Object.assign(Root, {
- _tabMeta: Root._tabMeta,
-})
-
const columnHelper = createDataGridHelper<
VariantWithIndex,
ProductCreateSchemaType
>()
const useColumns = ({
- options,
- currencies = [],
+ variantAttributes = [],
+ store,
regions = [],
pricePreferences = [],
+ stockLocations = [],
+ onOpenMediaModal,
+ form,
+ productMedia = [],
+ hasProductMedia = false,
}: {
- options: ProductCreateOptionSchema[]
- currencies?: string[]
- regions?: import("@medusajs/types").HttpTypes.AdminRegion[]
- pricePreferences?: import("@medusajs/types").HttpTypes.AdminPricePreference[]
+ variantAttributes?: Array<{
+ handle: string
+ name: string
+ selectedValues: Array<{ id: string; value: string }>
+ }>
+ store?: HttpTypes.AdminStore
+ regions?: HttpTypes.AdminRegion[]
+ pricePreferences?: HttpTypes.AdminPricePreference[]
+ stockLocations?: HttpTypes.AdminStockLocation[]
+ onOpenMediaModal?: (
+ variantIndex: number,
+ variantTitle?: string,
+ initialMedia?: MediaItem[],
+ productMedia?: MediaItem[]
+ ) => void
+ form: UseFormReturn<ProductCreateSchemaType>
+ productMedia?: MediaItem[]
+ hasProductMedia?: boolean
}) => {
const { t } = useTranslation()
+ const variants = useWatch({
+ control: form.control,
+ name: "variants",
+ defaultValue: [],
+ })
+
+ const variantsRef = useRef(variants)
+ variantsRef.current = variants
+
+ const allSelected =
+ variants.length > 0 && variants.every((v) => v.should_create)
+ const someSelected =
+ variants.some((v) => v.should_create) && !allSelected
+
+ const handleSelectAll = useCallback(
+ (checked: boolean) => {
+ const currentVariants = form.getValues("variants") || []
+ const updatedVariants = currentVariants.map((v) => ({
+ ...v,
+ should_create: checked,
+ }))
+ form.setValue("variants", updatedVariants)
+ },
+ [form]
+ )
+
return useMemo(
- () => [
- columnHelper.column({
- id: "options",
- header: () => (
- <div className="flex size-full items-center overflow-hidden">
- <span className="truncate">
- {options.map((o) => o.title).join(" / ")}
- </span>
- </div>
- ),
- cell: (context) => {
- return (
- <DataGrid.ReadonlyCell context={context}>
- {options
- .map((o) => context.row.original.options[o.title])
- .join(" / ")}
- </DataGrid.ReadonlyCell>
- )
- },
- disableHiding: true,
- }),
- columnHelper.column({
- id: "title",
- name: t("fields.title"),
- header: t("fields.title"),
- field: (context) =>
- `variants.${context.row.original.originalIndex}.title`,
- type: "text",
- cell: (context) => {
- return <DataGrid.TextCell context={context} />
- },
- }),
- columnHelper.column({
- id: "sku",
- name: t("fields.sku"),
- header: t("fields.sku"),
- field: (context) =>
- `variants.${context.row.original.originalIndex}.sku`,
- type: "text",
- cell: (context) => {
- return <DataGrid.TextCell context={context} />
- },
- }),
-
- ...createDataGridPriceColumns<VariantWithIndex, ProductCreateSchemaType>({
- currencies,
- regions,
- pricePreferences,
- getFieldName: (context, value) => {
- return `variants.${context.row.original.originalIndex}.prices.${value}`
- },
- t,
- }),
- ],
- [currencies, regions, options, pricePreferences, t]
+ () =>
+ [
+ columnHelper.column({
+ id: "checkbox",
+ header: () => (
+ <Checkbox
+ checked={
+ allSelected
+ ? true
+ : someSelected
+ ? "indeterminate"
+ : false
+ }
+ onCheckedChange={handleSelectAll}
+ />
+ ),
+ field: (context) => {
+ const rowData = context.row
+ .original as VariantWithIndex
+ return `variants.${rowData.originalIndex}.should_create`
+ },
+ type: "boolean",
+ cell: (context) => (
+ <DataGrid.BooleanCell context={context} />
+ ),
+ disableHiding: true,
+ size: 52,
+ pin: "left",
+ }),
+ columnHelper.column({
+ id: "options_combined",
+ name:
+ variantAttributes.length > 0
+ ? variantAttributes
+ .map((attr) => attr.name)
+ .join(" / ")
+ : "Options",
+ header: () => {
+ const label =
+ variantAttributes.length > 0
+ ? variantAttributes
+ .map((attr) => attr.name)
+ .join(" / ")
+ : "Options"
+
+ return (
+ <Tooltip content={label}>
+ <span className="w-full truncate">{label}</span>
+ </Tooltip>
+ )
+ },
+ cell: (context) => {
+ if (variantAttributes.length === 0) {
+ return (
+ <DataGrid.ReadonlyCell context={context} />
+ )
+ }
+ const rowData = context.row
+ .original as VariantWithIndex
+ const combinedValue = variantAttributes
+ .map(
+ (attr) => rowData.options?.[attr.name] || ""
+ )
+ .filter(Boolean)
+ .join(" / ")
+
+ return (
+ <DataGrid.ReadonlyCell context={context}>
+ {combinedValue}
+ </DataGrid.ReadonlyCell>
+ )
+ },
+ disableHiding: true,
+ pin: "left",
+ }),
+ columnHelper.column({
+ id: "title",
+ name: t("fields.title"),
+ header: t("fields.title"),
+ field: (context) => {
+ const rowData = context.row
+ .original as VariantWithIndex
+ return `variants.${rowData.originalIndex}.title`
+ },
+ type: "text",
+ cell: (context) => (
+ <DataGrid.TextCell context={context} />
+ ),
+ disableHiding: true,
+ pin: "left",
+ }),
+ columnHelper.column({
+ id: "media",
+ name: t(
+ "products.create.variants.productVariants.media"
+ ),
+ header: t(
+ "products.create.variants.productVariants.media"
+ ),
+ field: (context) => {
+ const rowData = context.row
+ .original as VariantWithIndex
+ return `variants.${rowData.originalIndex}.media`
+ },
+ type: "media" as any,
+ cell: (context) => {
+ const rowData = context.row
+ .original as VariantWithIndex
+
+ return (
+ <DataGridMediaCell
+ context={context}
+ disabled={!hasProductMedia}
+ onOpenMediaModal={
+ hasProductMedia
+ ? () => {
+ const currentMedia =
+ variantsRef.current[
+ rowData.originalIndex
+ ]?.media
+ onOpenMediaModal?.(
+ rowData.originalIndex,
+ rowData.title,
+ currentMedia,
+ productMedia
+ )
+ }
+ : undefined
+ }
+ />
+ )
+ },
+ }),
+ columnHelper.column({
+ id: "sku",
+ name: t("fields.sku"),
+ header: t("fields.sku"),
+ field: (context) => {
+ const rowData = context.row
+ .original as VariantWithIndex
+ return `variants.${rowData.originalIndex}.sku`
+ },
+ type: "text",
+ cell: (context) => (
+ <DataGrid.TextCell context={context} />
+ ),
+ }),
+ ...createDataGridPriceColumns<
+ VariantWithIndex,
+ ProductCreateSchemaType
+ >({
+ currencies:
+ store?.supported_currencies?.map(
+ (c) => c.currency_code
+ ) || [],
+ pricePreferences,
+ getFieldName: (context, value) => {
+ const rowData = context.row
+ .original as VariantWithIndex
+ return `variants.${rowData.originalIndex}.prices.${value}`
+ },
+ t,
+ }),
+ ] as ColumnDef<VariantWithIndex>[],
+ [
+ variantAttributes,
+ t,
+ store,
+ regions,
+ pricePreferences,
+ stockLocations,
+ onOpenMediaModal,
+ allSelected,
+ someSelected,
+ handleSelectAll,
+ hasProductMedia,
+ productMedia,
+ ]
)
}
diff --git a/packages/vendor/src/pages/products/create/utils/attribute-validation.ts b/packages/vendor/src/pages/products/create/utils/attribute-validation.ts
new file mode 100644
index 000000000..27681fa6e
--- /dev/null
+++ b/packages/vendor/src/pages/products/create/utils/attribute-validation.ts
@@ -0,0 +1,150 @@
+import { z } from "zod"
+
+type TranslationFunction = (key: string, options?: any) => string
+
+export const createAttributeValidationSchema = (
+ attributes: Array<{
+ handle: string
+ ui_component: string
+ is_required: boolean
+ name: string
+ }>,
+ t: TranslationFunction
+) => {
+ const attributeFields: Record<string, z.ZodTypeAny> = {}
+
+ attributes.forEach((attr) => {
+ const fieldName = attr.handle
+ const isRequired = attr.is_required
+
+ switch (attr.ui_component) {
+ case "select":
+ attributeFields[fieldName] = isRequired
+ ? z.string().min(1, t("products.fields.attributes.validation.required", { name: attr.name }))
+ : z.string().optional()
+ break
+ case "multivalue":
+ attributeFields[fieldName] = isRequired
+ ? z.array(z.string()).min(1, t("products.fields.attributes.validation.required", { name: attr.name }))
+ : z.array(z.string()).optional()
+ attributeFields[`${fieldName}UseForVariants`] = z.boolean().optional()
+ break
+ case "text":
+ case "text_area":
+ attributeFields[fieldName] = isRequired
+ ? z.string().min(1, t("products.fields.attributes.validation.required", { name: attr.name }))
+ : z.string().optional()
+ break
+ case "toggle":
+ attributeFields[fieldName] = isRequired
+ ? z.boolean().refine((val) => val === true, {
+ message: t("products.fields.attributes.validation.required", { name: attr.name }),
+ })
+ : z.boolean().optional()
+ break
+ case "unit":
+ attributeFields[fieldName] = isRequired
+ ? z.number().min(0, t("products.fields.attributes.validation.required", { name: attr.name }))
+ : z.number().optional()
+ break
+ default:
+ attributeFields[fieldName] = isRequired
+ ? z.string().min(1, t("products.fields.attributes.validation.required", { name: attr.name }))
+ : z.string().optional()
+ break
+ }
+ })
+
+ return z.object(attributeFields)
+}
+
+export const createAttributeValidationRules = (
+ attributes: Array<{
+ handle: string
+ ui_component: string
+ is_required: boolean
+ name: string
+ }>,
+ t: TranslationFunction
+): Record<
+ string,
+ { required?: string; validate: (value: unknown) => boolean | string }
+> => {
+ const rules: Record<
+ string,
+ {
+ required?: string
+ validate: (value: unknown) => boolean | string
+ }
+ > = {}
+
+ attributes.forEach((attr) => {
+ const fieldName = attr.handle
+ const isRequired = attr.is_required
+
+ if (isRequired) {
+ switch (attr.ui_component) {
+ case "select":
+ case "toggle":
+ rules[fieldName] = {
+ required: t("products.fields.attributes.validation.requiredSelect"),
+ validate: (value: unknown) => {
+ if (typeof value !== "string" || !value || value === "") {
+ return t("products.fields.attributes.validation.requiredSelect")
+ }
+ return true
+ },
+ }
+ break
+ case "text":
+ case "text_area":
+ case "color_picker":
+ rules[fieldName] = {
+ required: t("products.fields.attributes.validation.requiredEnter"),
+ validate: (value: unknown) => {
+ if (typeof value !== "string" || !value || value === "") {
+ return t("products.fields.attributes.validation.requiredEnter")
+ }
+ return true
+ },
+ }
+ break
+ case "multivalue":
+ rules[fieldName] = {
+ required: t("products.fields.attributes.validation.requiredSelectMultiple"),
+ validate: (value: unknown) => {
+ if (!Array.isArray(value) || value.length === 0) {
+ return t("products.fields.attributes.validation.requiredSelectMultiple")
+ }
+ return true
+ },
+ }
+ break
+ case "unit":
+ rules[fieldName] = {
+ required: t("products.fields.attributes.validation.requiredEnter"),
+ validate: (value: unknown) => {
+ if (value === undefined || value === null || value === "") {
+ return t("products.fields.attributes.validation.requiredEnter")
+ }
+ return true
+ },
+ }
+ break
+ default:
+ rules[fieldName] = {
+ required: t("products.fields.attributes.validation.requiredEnter"),
+ validate: (value: unknown) => {
+ if (typeof value !== "string" || !value || value === "") {
+ return t("products.fields.attributes.validation.requiredEnter")
+ }
+ return true
+ },
+ }
+ break
+ }
+ }
+ })
+
+ return rules
+}
diff --git a/packages/vendor/src/pages/products/create/utils/process-attributes.ts b/packages/vendor/src/pages/products/create/utils/process-attributes.ts
new file mode 100644
index 000000000..d20c475b8
--- /dev/null
+++ b/packages/vendor/src/pages/products/create/utils/process-attributes.ts
@@ -0,0 +1,104 @@
+export type FormField = {
+ key: string
+ id: string
+ name: string
+ handle: string
+ ui_component:
+ | "select"
+ | "multivalue"
+ | "unit"
+ | "toggle"
+ | "text"
+ | "text_area"
+ | "color_picker"
+ is_required: boolean
+ description?: string
+ possible_values: Array<{ value: string; label: string }>
+}
+
+export type ProcessedAttributes = {
+ required: {
+ categorySpecific: FormField[]
+ global: FormField[]
+ all: FormField[]
+ }
+}
+
+export const processAttributes = (
+ allAttributes:
+ | Array<{
+ id: string
+ name: string
+ handle: string
+ ui_component: string
+ is_required: boolean
+ description?: string
+ product_categories?: Array<{ id: string; name: string }>
+ possible_values?: Array<{ id: string; value: string }>
+ }>
+ | undefined,
+ primaryCategoryId: string | undefined
+): ProcessedAttributes => {
+ if (!allAttributes || allAttributes.length === 0) {
+ return {
+ required: {
+ categorySpecific: [],
+ global: [],
+ all: [],
+ },
+ }
+ }
+
+ const globalAttributes = allAttributes.filter(
+ (attr) =>
+ !attr.product_categories ||
+ attr.product_categories.length === 0
+ )
+
+ const categorySpecificAttributes = allAttributes.filter(
+ (attr) =>
+ attr.product_categories && attr.product_categories.length > 0
+ )
+
+ const applicableCategoryAttributes =
+ categorySpecificAttributes.filter((attr) =>
+ attr.product_categories?.some(
+ (cat) => cat.id === primaryCategoryId
+ )
+ )
+
+ const mapToFormField = (attr: (typeof allAttributes)[number]): FormField => ({
+ key: attr.id,
+ id: attr.id,
+ name: attr.name,
+ handle: attr.handle || attr.id,
+ ui_component: attr.ui_component as FormField["ui_component"],
+ is_required: attr.is_required,
+ description: attr.description,
+ possible_values:
+ attr.possible_values?.map((value) => ({
+ value: value.id,
+ label: value.value,
+ })) || [],
+ })
+
+ const requiredCategorySpecificFormFields: FormField[] =
+ applicableCategoryAttributes
+ .filter((attr) => attr.is_required)
+ .map(mapToFormField)
+
+ const requiredGlobalFormFields: FormField[] = globalAttributes
+ .filter((attr) => attr.is_required)
+ .map(mapToFormField)
+
+ return {
+ required: {
+ categorySpecific: requiredCategorySpecificFormFields,
+ global: requiredGlobalFormFields,
+ all: [
+ ...requiredCategorySpecificFormFields,
+ ...requiredGlobalFormFields,
+ ],
+ },
+ }
+}
diff --git a/packages/vendor/src/pages/products/create/variant-media-view/components/variant-media-gallery/variant-media-gallery.tsx b/packages/vendor/src/pages/products/create/variant-media-view/components/variant-media-gallery/variant-media-gallery.tsx
new file mode 100644
index 000000000..2c0b7e8f5
--- /dev/null
+++ b/packages/vendor/src/pages/products/create/variant-media-view/components/variant-media-gallery/variant-media-gallery.tsx
@@ -0,0 +1,137 @@
+import { useCallback, useEffect, useState } from "react"
+
+import {
+ ThumbnailBadge,
+ TriangleLeftMini,
+ TriangleRightMini,
+} from "@medusajs/icons"
+import { Button, clx, IconButton, Text, Tooltip } from "@medusajs/ui"
+import { useTranslation } from "react-i18next"
+
+import { VariantMediaViewContext } from "../../variant-media-view-context"
+
+type Media = {
+ id: string
+ url: string
+ isThumbnail: boolean
+}
+
+type VariantMediaGalleryProps = {
+ goToEdit: () => void
+ variantMedia?: any[]
+}
+
+export const VariantMediaGallery = ({
+ goToEdit,
+ variantMedia = [],
+}: VariantMediaGalleryProps) => {
+ const [curr, setCurr] = useState<number>(0)
+ const { t } = useTranslation()
+
+ const media: Media[] = (variantMedia || []).map(
+ (m: any, idx: number) => ({
+ ...m,
+ id: m.id || `variant-${idx}-${m.url}`,
+ })
+ )
+
+ const next = useCallback(() => {
+ setCurr((prev) => (prev + 1) % media.length)
+ }, [media.length])
+
+ const prev = useCallback(() => {
+ setCurr((prev) => (prev - 1 + media.length) % media.length)
+ }, [media.length])
+
+ const goTo = useCallback(
+ (index: number) => {
+ if (index < 0 || index >= media.length) return
+ setCurr(index)
+ },
+ [media.length]
+ )
+
+ useEffect(() => {
+ const handleKeyDown = (e: KeyboardEvent) => {
+ if (e.key === "ArrowRight") next()
+ else if (e.key === "ArrowLeft") prev()
+ }
+ document.addEventListener("keydown", handleKeyDown)
+ return () => document.removeEventListener("keydown", handleKeyDown)
+ }, [next, prev])
+
+ const noMedia = !media.length
+
+ return (
+ <VariantMediaViewContext.Consumer>
+ {() => (
+ <div className="flex size-full flex-col bg-ui-bg-subtle">
+ {noMedia ? (
+ <div className="flex size-full flex-col items-center justify-center gap-y-4 bg-ui-bg-subtle pb-8 pt-6">
+ <div className="flex flex-col items-center">
+ <Text size="small" leading="compact" weight="plus" className="text-ui-fg-subtle">
+ {t("products.media.emptyState.header", "No media")}
+ </Text>
+ <Text size="small" className="text-ui-fg-muted">
+ {t("products.media.emptyState.description", "No images assigned to this variant.")}
+ </Text>
+ </div>
+ <Button size="small" variant="secondary" onClick={goToEdit}>
+ {t("products.media.emptyState.action", "Add images")}
+ </Button>
+ </div>
+ ) : (
+ <>
+ <div className="relative size-full overflow-hidden bg-ui-bg-subtle">
+ <div className="flex size-full items-center justify-center p-6">
+ <div className="relative inline-block max-h-full max-w-full">
+ {media[curr]?.isThumbnail && (
+ <div className="absolute left-2 top-2">
+ <Tooltip content={t("products.media.thumbnailTooltip")}>
+ <ThumbnailBadge />
+ </Tooltip>
+ </div>
+ )}
+ <img
+ src={media[curr]?.url}
+ alt=""
+ className="object-fit max-h-[calc(100vh-200px)] w-auto rounded-xl object-contain shadow-elevation-card-rest"
+ />
+ </div>
+ </div>
+ </div>
+ {media.length > 1 && (
+ <div className="flex shrink-0 items-center justify-center gap-x-2 border-t p-3">
+ <IconButton size="small" variant="transparent" className="text-ui-fg-muted" type="button" onClick={prev}>
+ <TriangleLeftMini />
+ </IconButton>
+ <div className="flex items-center gap-x-2">
+ {media.slice(0, 8).map((item, idx) => {
+ const isCurrentImage = item.id === media[curr]?.id
+ const originalIndex = media.findIndex((i) => i.id === item.id)
+ return (
+ <button
+ type="button"
+ onClick={() => goTo(originalIndex)}
+ className={clx("size-7 overflow-hidden rounded-[4px] outline-none transition-fg", {
+ "shadow-borders-focus": isCurrentImage,
+ })}
+ key={item.id}
+ >
+ <img src={item.url} alt="" className="size-full object-cover" />
+ </button>
+ )
+ })}
+ </div>
+ <IconButton size="small" variant="transparent" className="text-ui-fg-muted" type="button" onClick={next}>
+ <TriangleRightMini />
+ </IconButton>
+ </div>
+ )}
+ </>
+ )}
+ </div>
+ )}
+ </VariantMediaViewContext.Consumer>
+ )
+}
diff --git a/packages/vendor/src/pages/products/create/variant-media-view/variant-media-view-context.tsx b/packages/vendor/src/pages/products/create/variant-media-view/variant-media-view-context.tsx
new file mode 100644
index 000000000..910bf3372
--- /dev/null
+++ b/packages/vendor/src/pages/products/create/variant-media-view/variant-media-view-context.tsx
@@ -0,0 +1,12 @@
+import { createContext } from "react"
+
+type VariantMediaViewContextValue = {
+ goToGallery: () => void
+ goToEdit: () => void
+ onSubmit?: () => void
+ onCancel?: () => void
+ onClose?: () => void
+}
+
+export const VariantMediaViewContext =
+ createContext<VariantMediaViewContextValue | null>(null)
diff --git a/packages/vendor/src/pages/products/create/variant-media-view/variant-media-view.tsx b/packages/vendor/src/pages/products/create/variant-media-view/variant-media-view.tsx
new file mode 100644
index 000000000..4d4eeea5d
--- /dev/null
+++ b/packages/vendor/src/pages/products/create/variant-media-view/variant-media-view.tsx
@@ -0,0 +1,108 @@
+import { useRef, useState } from "react"
+
+import { Button } from "@medusajs/ui"
+import { useTranslation } from "react-i18next"
+
+import { StackedFocusModal } from "@components/modals"
+import { EditVariantMediaForm } from "../edit-variant-media-form/edit-variant-media-form"
+import { VariantMediaGallery } from "./components/variant-media-gallery/variant-media-gallery"
+import { VariantMediaViewContext } from "./variant-media-view-context"
+
+type MediaItem = {
+ file?: File
+ url?: string
+ isThumbnail?: boolean
+ id?: string
+}
+
+type VariantMediaViewProps = {
+ variantIndex: number
+ variantTitle?: string
+ onClose?: () => void
+ onSaveMedia?: (variantIndex: number, media: MediaItem[]) => void
+ initialMedia?: MediaItem[]
+ productMedia: MediaItem[]
+}
+
+enum View {
+ GALLERY = "gallery",
+ EDIT = "edit",
+}
+
+const getView = (currentView: string | undefined) => {
+ if (currentView === View.EDIT) return View.EDIT
+ return View.GALLERY
+}
+
+export const VariantMediaView = ({
+ variantIndex,
+ variantTitle,
+ onClose,
+ onSaveMedia,
+ initialMedia,
+ productMedia,
+}: VariantMediaViewProps) => {
+ const [currentView, setCurrentView] = useState<string | undefined>(View.EDIT)
+ const view = getView(currentView)
+ const { t } = useTranslation()
+ const saveRef = useRef<(() => void) | null>(null)
+
+ const handleGoToView = (v: View) => () => setCurrentView(v)
+
+ const contextValue = {
+ goToGallery: handleGoToView(View.GALLERY),
+ goToEdit: handleGoToView(View.EDIT),
+ onCancel: onClose,
+ onClose,
+ }
+
+ const handleFooterSave = () => {
+ saveRef.current?.()
+ }
+
+ return (
+ <VariantMediaViewContext.Provider value={contextValue}>
+ <StackedFocusModal.Content>
+ <StackedFocusModal.Header>
+ {view === View.EDIT ? (
+ <Button variant="secondary" size="small" onClick={contextValue.goToGallery}>
+ {t("products.media.galleryLabel", "Gallery")}
+ </Button>
+ ) : (
+ <Button variant="secondary" size="small" onClick={contextValue.goToEdit}>
+ {t("products.media.editLabel", "Edit")}
+ </Button>
+ )}
+ </StackedFocusModal.Header>
+ <StackedFocusModal.Body className="flex flex-col overflow-hidden">
+ {view === View.GALLERY && (
+ <VariantMediaGallery goToEdit={contextValue.goToEdit} variantMedia={initialMedia} />
+ )}
+ {view === View.EDIT && (
+ <EditVariantMediaForm
+ variantIndex={variantIndex}
+ variantTitle={variantTitle}
+ onSaveMedia={onSaveMedia}
+ onClose={onClose}
+ saveRef={saveRef}
+ initialMedia={initialMedia}
+ productMedia={productMedia}
+ />
+ )}
+ </StackedFocusModal.Body>
+ {view === View.EDIT && (
+ <StackedFocusModal.Footer>
+ <div className="flex justify-end gap-x-2">
+ <Button variant="secondary" size="small" onClick={onClose}>
+ {t("actions.cancel")}
+ </Button>
+ <Button size="small" onClick={handleFooterSave}>
+ {t("actions.save")}
+ </Button>
+ </div>
+ </StackedFocusModal.Footer>
+ )}
+ </StackedFocusModal.Content>
+ </VariantMediaViewContext.Provider>
+ )
+}
diff --git a/packages/vendor/src/pages/products/product-add-attribute/product-add-attribute.tsx b/packages/vendor/src/pages/products/product-add-attribute/product-add-attribute.tsx
new file mode 100644
index 000000000..dff9e1297
--- /dev/null
+++ b/packages/vendor/src/pages/products/product-add-attribute/product-add-attribute.tsx
@@ -0,0 +1,158 @@
+import { zodResolver } from "@hookform/resolvers/zod"
+import { Button, Heading, toast } from "@medusajs/ui"
+import { useFieldArray, useForm } from "react-hook-form"
+import { useTranslation } from "react-i18next"
+import { useNavigate, useParams } from "react-router-dom"
+import { z } from "zod"
+
+import { RouteDrawer } from "@components/modals"
+import { KeyboundForm } from "@components/utilities/keybound-form"
+import {
+ useAddProductAttribute,
+ useProduct,
+ useProductAttributes,
+} from "@hooks/api/products"
+import { UserCreatedOptionsList } from "../create/product-create-attributes-form/user-created-options-list"
+import { ProductCreateOptionSchema } from "../create/constants"
+import { ProductCreateSchemaType } from "../create/types"
+
+export const ProductAddAttribute = () => {
+ const { t } = useTranslation()
+ const navigate = useNavigate()
+ const { id } = useParams()
+ const form = useForm<ProductCreateSchemaType>({
+ defaultValues: {
+ options: [
+ {
+ title: "",
+ values: [],
+ metadata: { author: "vendor" },
+ attributeId: "",
+ useForVariants: true,
+ },
+ ],
+ },
+ resolver: zodResolver(
+ z.object({
+ options: z.array(ProductCreateOptionSchema),
+ })
+ ),
+ })
+
+ const { attributes: allAttributes, isLoading: allAttributesLoading } =
+ useProductAttributes(id!)
+ const { product, isLoading: isProductLoading } = useProduct(id!)
+
+ const nonRequiredAttributes = allAttributes
+ ?.filter((attribute: any) => !attribute.is_required)
+
+ const availableAttributes = nonRequiredAttributes
+ ?.filter(
+ (attribute: any) =>
+ !product?.informational_attributes?.some(
+ (infoAttribute: any) =>
+ infoAttribute.attribute_id === attribute.id
+ )
+ )
+
+ const options = useFieldArray({
+ control: form.control,
+ name: "options",
+ })
+
+ const { mutateAsync, isPending } = useAddProductAttribute(id!)
+
+ const handleSubmit = form.handleSubmit(async (data) => {
+ const option = data.options?.[0]
+
+ const name = option?.title?.trim()
+ const values = (option?.values ?? [])
+ .map((v) => v.trim())
+ .filter(Boolean)
+ const use_for_variations = option?.useForVariants === true
+ const selectedAttribute = availableAttributes?.find(
+ (attr: any) => attr.id === option?.attributeId
+ )
+ const ui_component =
+ selectedAttribute?.ui_component ?? "multivalue"
+
+ await mutateAsync(
+ {
+ name,
+ values,
+ use_for_variations,
+ ui_component,
+ attribute_id: option?.attributeId || undefined,
+ },
+ {
+ onSuccess: () => {
+ toast.success(t("actions.save"))
+ navigate(`/products/${id}`, {
+ replace: true,
+ state: { isSubmitSuccessful: true },
+ })
+ },
+ onError: (err) => {
+ toast.error(err.message)
+ },
+ }
+ )
+ })
+
+ if (allAttributesLoading || isProductLoading) {
+ return null
+ }
+
+ return (
+ <RouteDrawer>
+ <RouteDrawer.Header>
+ <div className="flex items-center justify-between">
+ <RouteDrawer.Title asChild>
+ <Heading>
+ {t("products.edit.attributes.addAttribute")}
+ </Heading>
+ </RouteDrawer.Title>
+ </div>
+ </RouteDrawer.Header>
+ <RouteDrawer.Form form={form}>
+ <KeyboundForm
+ onSubmit={handleSubmit}
+ className="flex h-full flex-col"
+ >
+ <RouteDrawer.Body className="flex flex-col gap-y-4">
+ <UserCreatedOptionsList
+ form={form}
+ options={options}
+ allowRemove={false}
+ availableAttributes={availableAttributes ?? []}
+ allNonRequiredAttributes={nonRequiredAttributes ?? []}
+ isExistingProduct
+ allowCreate
+ />
+ </RouteDrawer.Body>
+ <RouteDrawer.Footer>
+ <div className="flex items-center justify-end gap-x-2">
+ <RouteDrawer.Close asChild>
+ <Button
+ size="small"
+ variant="secondary"
+ type="button"
+ disabled={isPending}
+ >
+ {t("actions.cancel")}
+ </Button>
+ </RouteDrawer.Close>
+ <Button
+ size="small"
+ type="submit"
+ isLoading={isPending}
+ >
+ {t("actions.create")}
+ </Button>
+ </div>
+ </RouteDrawer.Footer>
+ </KeyboundForm>
+ </RouteDrawer.Form>
+ </RouteDrawer>
+ )
+}
diff --git a/packages/vendor/src/pages/products/product-bulk-edit/components/product-bulk-edit-form/index.ts b/packages/vendor/src/pages/products/product-bulk-edit/components/product-bulk-edit-form/index.ts
new file mode 100644
index 000000000..30ebf8b18
--- /dev/null
+++ b/packages/vendor/src/pages/products/product-bulk-edit/components/product-bulk-edit-form/index.ts
@@ -0,0 +1 @@
+export { ProductBulkEditForm } from "./product-bulk-edit-form"
diff --git a/packages/vendor/src/pages/products/product-bulk-edit/components/product-bulk-edit-form/product-bulk-edit-form.tsx b/packages/vendor/src/pages/products/product-bulk-edit/components/product-bulk-edit-form/product-bulk-edit-form.tsx
new file mode 100644
index 000000000..45d18b29c
--- /dev/null
+++ b/packages/vendor/src/pages/products/product-bulk-edit/components/product-bulk-edit-form/product-bulk-edit-form.tsx
@@ -0,0 +1,155 @@
+import { zodResolver } from "@hookform/resolvers/zod"
+import { Button, toast } from "@medusajs/ui"
+import { useRef } from "react"
+import { DefaultValues, useForm } from "react-hook-form"
+import { useTranslation } from "react-i18next"
+import { DataGrid } from "@components/data-grid"
+import {
+ RouteFocusModal,
+ useRouteModal,
+} from "@components/modals"
+import { KeyboundForm } from "@components/utilities/keybound-form"
+import {
+ BatchUpdateProductItem,
+ useBatchUpdateProducts,
+} from "@hooks/api/products"
+import { ExtendedAdminProduct } from "../../../types"
+import { useProductBulkEditColumns } from "../../hooks/use-product-bulk-edit-columns"
+import {
+ ProductBulkEditItemSchema,
+ ProductBulkEditSchema,
+} from "../../schema"
+
+type ProductBulkEditFormProps = {
+ products: ExtendedAdminProduct[]
+}
+
+export const ProductBulkEditForm = ({
+ products,
+}: ProductBulkEditFormProps) => {
+ const { t } = useTranslation()
+ const { setCloseOnEscape, handleSuccess } = useRouteModal()
+
+ const initialValues = useRef(getDefaultValues(products))
+
+ const form = useForm<ProductBulkEditSchema>({
+ defaultValues: getDefaultValues(products),
+ resolver: zodResolver(ProductBulkEditSchema),
+ })
+
+ const columns = useProductBulkEditColumns()
+
+ const { mutateAsync, isPending } = useBatchUpdateProducts()
+
+ const onSubmit = form.handleSubmit(async (data) => {
+ const updates: BatchUpdateProductItem[] = []
+
+ for (const [productId, item] of Object.entries(
+ data.products
+ )) {
+ const original =
+ initialValues.current?.products?.[productId]
+
+ if (!original) continue
+
+ const changes: BatchUpdateProductItem = { id: productId }
+ let hasChanges = false
+
+ if (item.title !== original.title) {
+ changes.title = item.title
+ hasChanges = true
+ }
+
+ if (item.status !== original.status) {
+ changes.status = item.status
+ hasChanges = true
+ }
+
+ if (item.discountable !== original.discountable) {
+ changes.discountable = item.discountable
+ hasChanges = true
+ }
+
+ if (hasChanges) {
+ updates.push(changes)
+ }
+ }
+
+ if (updates.length === 0) {
+ toast.info(t("products.bulkEdit.noChanges"))
+ return
+ }
+
+ await mutateAsync(
+ { update: updates },
+ {
+ onSuccess: () => {
+ toast.success(t("products.bulkEdit.success"))
+ handleSuccess()
+ },
+ onError: (error) => {
+ toast.error(error.message)
+ },
+ }
+ )
+ })
+
+ return (
+ <RouteFocusModal.Form form={form}>
+ <KeyboundForm
+ onSubmit={onSubmit}
+ className="flex size-full flex-col"
+ >
+ <RouteFocusModal.Header />
+ <RouteFocusModal.Body className="size-full flex-1 overflow-y-auto">
+ <DataGrid
+ columns={columns}
+ data={products}
+ state={form}
+ onEditingChange={(editing) => {
+ setCloseOnEscape(!editing)
+ }}
+ />
+ </RouteFocusModal.Body>
+ <RouteFocusModal.Footer>
+ <div className="flex items-center justify-end gap-2">
+ <RouteFocusModal.Close asChild>
+ <Button
+ variant="secondary"
+ size="small"
+ type="button"
+ >
+ {t("actions.cancel")}
+ </Button>
+ </RouteFocusModal.Close>
+ <Button
+ type="submit"
+ size="small"
+ isLoading={isPending}
+ >
+ {t("actions.save")}
+ </Button>
+ </div>
+ </RouteFocusModal.Footer>
+ </KeyboundForm>
+ </RouteFocusModal.Form>
+ )
+}
+
+function getDefaultValues(
+ products: ExtendedAdminProduct[]
+): DefaultValues<ProductBulkEditSchema> {
+ return {
+ products: products.reduce(
+ (acc, product) => {
+ acc[product.id] = {
+ title: product.title || "",
+ status: product.status as "draft" | "published",
+ discountable: product.discountable ?? true,
+ }
+ return acc
+ },
+ {} as Record<string, ProductBulkEditItemSchema>
+ ),
+ }
+}
diff --git a/packages/vendor/src/pages/products/product-bulk-edit/hooks/use-product-bulk-edit-columns.tsx b/packages/vendor/src/pages/products/product-bulk-edit/hooks/use-product-bulk-edit-columns.tsx
new file mode 100644
index 000000000..ab67dd9a8
--- /dev/null
+++ b/packages/vendor/src/pages/products/product-bulk-edit/hooks/use-product-bulk-edit-columns.tsx
@@ -0,0 +1,73 @@
+import { useMemo } from "react"
+
+import { useTranslation } from "react-i18next"
+
+import { createDataGridHelper } from "@components/data-grid"
+import {
+ DataGridBooleanWithTextCell,
+ DataGridStatusCell,
+ DataGridTextCell,
+} from "../../../../components/data-grid/components"
+import { ExtendedAdminProduct } from "../../types"
+import { ProductBulkEditSchema } from "../schema"
+
+const helper = createDataGridHelper<
+ ExtendedAdminProduct,
+ ProductBulkEditSchema
+>()
+
+export const useProductBulkEditColumns = () => {
+ const { t } = useTranslation()
+
+ return useMemo(
+ () => [
+ helper.column({
+ id: "title",
+ name: t("fields.title"),
+ header: t("fields.title"),
+ field: (context) => {
+ const product = context.row.original
+ return `products.${product.id}.title` as const
+ },
+ type: "text",
+ cell: (context) => {
+ return <DataGridTextCell context={context} />
+ },
+ disableHiding: true,
+ }),
+ helper.column({
+ id: "status",
+ name: t("fields.status"),
+ header: t("fields.status"),
+ field: (context) => {
+ const product = context.row.original
+ return `products.${product.id}.status` as const
+ },
+ type: "select",
+ cell: (context) => {
+ return <DataGridStatusCell context={context} />
+ },
+ }),
+ helper.column({
+ id: "discountable",
+ name: t("fields.discountable"),
+ header: t("fields.discountable"),
+ field: (context) => {
+ const product = context.row.original
+ return `products.${product.id}.discountable` as const
+ },
+ type: "boolean",
+ cell: (context) => {
+ return (
+ <DataGridBooleanWithTextCell
+ context={context}
+ trueLabel="True"
+ falseLabel="False"
+ />
+ )
+ },
+ }),
+ ],
+ [t]
+ )
+}
diff --git a/packages/vendor/src/pages/products/product-bulk-edit/product-bulk-edit.tsx b/packages/vendor/src/pages/products/product-bulk-edit/product-bulk-edit.tsx
new file mode 100644
index 000000000..634f42a9d
--- /dev/null
+++ b/packages/vendor/src/pages/products/product-bulk-edit/product-bulk-edit.tsx
@@ -0,0 +1,34 @@
+import { useTranslation } from "react-i18next"
+import { useLocation } from "react-router-dom"
+import { RouteFocusModal } from "@components/modals"
+import { ExtendedAdminProduct } from "../types"
+import { ProductBulkEditForm } from "./components/product-bulk-edit-form"
+
+type LocationState = {
+ products?: ExtendedAdminProduct[]
+}
+
+export const ProductBulkEdit = () => {
+ const { t } = useTranslation()
+ const location = useLocation()
+ const state = location.state as LocationState | null
+ const products = state?.products || []
+
+ const ready = products.length > 0
+
+ return (
+ <RouteFocusModal>
+ <RouteFocusModal.Title asChild>
+ <span className="sr-only">
+ {t("products.bulkEdit.title")}
+ </span>
+ </RouteFocusModal.Title>
+ <RouteFocusModal.Description asChild>
+ <span className="sr-only">
+ {t("products.bulkEdit.description")}
+ </span>
+ </RouteFocusModal.Description>
+ {ready && <ProductBulkEditForm products={products} />}
+ </RouteFocusModal>
+ )
+}
diff --git a/packages/vendor/src/pages/products/product-bulk-edit/schema.ts b/packages/vendor/src/pages/products/product-bulk-edit/schema.ts
new file mode 100644
index 000000000..e21e0e78d
--- /dev/null
+++ b/packages/vendor/src/pages/products/product-bulk-edit/schema.ts
@@ -0,0 +1,18 @@
+import { z } from "zod"
+
+const ProductBulkEditItemSchema = z.object({
+ title: z.string(),
+ status: z.enum(["draft", "published"]),
+ discountable: z.boolean(),
+})
+
+export const ProductBulkEditSchema = z.object({
+ products: z.record(ProductBulkEditItemSchema),
+})
+
+export type ProductBulkEditItemSchema = z.infer<
+ typeof ProductBulkEditItemSchema
+>
+export type ProductBulkEditSchema = z.infer<
+ typeof ProductBulkEditSchema
+>
diff --git a/packages/vendor/src/pages/products/product-edit-attribute/components/edit-product-attribute-form.tsx b/packages/vendor/src/pages/products/product-edit-attribute/components/edit-product-attribute-form.tsx
new file mode 100644
index 000000000..671537799
--- /dev/null
+++ b/packages/vendor/src/pages/products/product-edit-attribute/components/edit-product-attribute-form.tsx
@@ -0,0 +1,346 @@
+import { useRef } from "react"
+
+import { zodResolver } from "@hookform/resolvers/zod"
+import { CircleInfoSolid } from "@medusajs/icons"
+import {
+ Button,
+ InlineTip,
+ Input,
+ Select,
+ Text,
+ Textarea,
+ Tooltip,
+ usePrompt,
+} from "@medusajs/ui"
+import { useForm } from "react-hook-form"
+import { useTranslation } from "react-i18next"
+import { z } from "zod"
+
+import { Form } from "@components/common/form"
+import { SwitchBox } from "@components/common/switch-box"
+import { ChipInput } from "@components/inputs/chip-input"
+import { Combobox } from "@components/inputs/combobox"
+import { NumericInput } from "../../../../components/inputs/numeric-input"
+import { RouteDrawer, useRouteModal } from "@components/modals"
+import { i18n } from "@components/utilities/i18n"
+import { KeyboundForm } from "@components/utilities/keybound-form"
+import { useUpdateProductAttribute } from "@hooks/api/products"
+import {
+ ProductAttribute,
+ ProductInformationalAttribute,
+} from "../../types"
+
+type EditProductAttributeFormProps = {
+ productId: string
+ attribute: ProductInformationalAttribute
+ attributeDefinition?: ProductAttribute
+}
+
+const EditProductAttributeSchema = z.object({
+ values: z
+ .array(z.string())
+ .min(1, i18n.t("products.edit.attributes.valuesRequired")),
+ use_for_variations: z.boolean(),
+})
+
+export const EditProductAttributeForm = ({
+ productId,
+ attribute,
+ attributeDefinition,
+}: EditProductAttributeFormProps) => {
+ const { t } = useTranslation()
+ const { handleSuccess } = useRouteModal()
+ const prompt = usePrompt()
+
+ const currentValues =
+ attribute.values?.map((v) => v.value) ?? []
+
+ const form = useForm<
+ z.infer<typeof EditProductAttributeSchema>
+ >({
+ defaultValues: {
+ values: currentValues,
+ use_for_variations: false,
+ },
+ resolver: zodResolver(EditProductAttributeSchema),
+ })
+
+ const useForVariations = form.watch("use_for_variations")
+
+ const { mutateAsync, isPending } =
+ useUpdateProductAttribute(
+ productId,
+ attribute.attribute_id
+ )
+
+ const handleSubmit = form.handleSubmit(async (data) => {
+ await mutateAsync(
+ {
+ values: data.values,
+ use_for_variations: data.use_for_variations,
+ },
+ {
+ onSuccess: () => {
+ handleSuccess()
+ },
+ }
+ )
+ })
+
+ const uiComponent =
+ attributeDefinition?.ui_component ?? attribute.ui_component
+ const possibleValueOptions =
+ attributeDefinition?.possible_values?.map((pv) => ({
+ value: pv.value,
+ label: pv.value,
+ })) ?? []
+
+ const isAdminAttribute =
+ attribute.attribute_source === "admin"
+ const customValueCreatedRef = useRef(false)
+
+ const confirmCustomValue = async () => {
+ return prompt({
+ title: t("products.edit.attributes.editCustomValueTitle"),
+ description: t(
+ "products.edit.attributes.editCustomValueDescription"
+ ),
+ })
+ }
+
+ return (
+ <RouteDrawer.Form form={form}>
+ <KeyboundForm
+ onSubmit={handleSubmit}
+ className="flex flex-1 flex-col overflow-hidden"
+ >
+ <RouteDrawer.Body className="flex flex-1 flex-col gap-y-2 overflow-auto">
+ <div className="flex flex-col gap-y-2">
+ <Text
+ size="small"
+ weight="plus"
+ className="flex items-center gap-x-2"
+ >
+ {attribute.name}
+ {(attribute.description || attribute.is_required) && (
+ <Tooltip
+ content={
+ attribute.description ||
+ t("products.edit.attributes.required")
+ }
+ >
+ <CircleInfoSolid className="text-ui-fg-muted" />
+ </Tooltip>
+ )}
+ </Text>
+
+ <Form.Field
+ control={form.control}
+ name="values"
+ render={({ field }) => {
+ const renderValuesInput = () => {
+ if (uiComponent === "select") {
+ return (
+ <Combobox
+ value={field.value[0] ?? ""}
+ onChange={async (val) => {
+ const strVal = val as string
+ if (
+ isAdminAttribute &&
+ customValueCreatedRef.current
+ ) {
+ customValueCreatedRef.current = false
+ const confirmed =
+ await confirmCustomValue()
+ if (!confirmed) return
+ }
+ field.onChange(
+ val ? [strVal] : []
+ )
+ }}
+ options={possibleValueOptions}
+ onCreateOption={() => {
+ customValueCreatedRef.current = true
+ }}
+ multiple={false}
+ placeholder={t(
+ "products.edit.attributes.valuesPlaceholder"
+ )}
+ />
+ )
+ }
+
+ if (uiComponent === "multivalue") {
+ return (
+ <Combobox
+ value={field.value}
+ onChange={async (val) => {
+ const arrVal = (val ?? []) as string[]
+ if (
+ isAdminAttribute &&
+ customValueCreatedRef.current
+ ) {
+ customValueCreatedRef.current = false
+ const confirmed =
+ await confirmCustomValue()
+ if (!confirmed) return
+ }
+ field.onChange(arrVal)
+ }}
+ options={possibleValueOptions}
+ onCreateOption={() => {
+ customValueCreatedRef.current = true
+ }}
+ placeholder={t(
+ "products.edit.attributes.valuesPlaceholder"
+ )}
+ />
+ )
+ }
+
+ if (uiComponent === "text") {
+ return (
+ <Input
+ value={field.value[0] ?? ""}
+ onChange={(e) =>
+ field.onChange([e.target.value])
+ }
+ placeholder={t(
+ "products.edit.attributes.valuesPlaceholder"
+ )}
+ />
+ )
+ }
+
+ if (uiComponent === "text_area") {
+ return (
+ <Textarea
+ value={field.value[0] ?? ""}
+ onChange={(e) =>
+ field.onChange([e.target.value])
+ }
+ placeholder={t(
+ "products.edit.attributes.valuesPlaceholder"
+ )}
+ />
+ )
+ }
+
+ if (uiComponent === "toggle") {
+ return (
+ <Select
+ value={field.value[0] ?? ""}
+ onValueChange={(val) =>
+ field.onChange([val])
+ }
+ >
+ <Select.Trigger>
+ <Select.Value
+ placeholder={t(
+ "products.fields.attributes.selectValuePlaceholder"
+ )}
+ />
+ </Select.Trigger>
+ <Select.Content>
+ <Select.Item value="true">
+ {t("general.true")}
+ </Select.Item>
+ <Select.Item value="false">
+ {t("general.false")}
+ </Select.Item>
+ </Select.Content>
+ </Select>
+ )
+ }
+
+ if (uiComponent === "unit") {
+ return (
+ <NumericInput
+ value={
+ field.value[0] !== undefined
+ ? parseFloat(field.value[0])
+ : undefined
+ }
+ onChange={(val) =>
+ field.onChange([
+ String(val ?? ""),
+ ])
+ }
+ placeholder={t(
+ "products.edit.attributes.valuesPlaceholder"
+ )}
+ hideControls
+ />
+ )
+ }
+
+ return (
+ <ChipInput
+ value={field.value}
+ onChange={field.onChange}
+ placeholder={t(
+ "products.edit.attributes.valuesPlaceholder"
+ )}
+ />
+ )
+ }
+
+ return (
+ <Form.Item>
+ <Form.Control>
+ {renderValuesInput()}
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )
+ }}
+ />
+ </div>
+
+ {uiComponent === "multivalue" && (
+ <>
+ <SwitchBox
+ control={form.control}
+ name="use_for_variations"
+ label={t(
+ "products.edit.attributes.useForVariations"
+ )}
+ description={t(
+ "products.edit.attributes.useForVariationsDescription"
+ )}
+ />
+
+ {useForVariations && (
+ <InlineTip
+ variant="warning"
+ label={t("general.warning")}
+ className="mt-2"
+ >
+ {t(
+ "products.edit.attributes.conversionWarning"
+ )}
+ </InlineTip>
+ )}
+ </>
+ )}
+ </RouteDrawer.Body>
+ <RouteDrawer.Footer>
+ <div className="flex items-center justify-end gap-x-2">
+ <RouteDrawer.Close asChild>
+ <Button variant="secondary" size="small">
+ {t("actions.cancel")}
+ </Button>
+ </RouteDrawer.Close>
+ <Button
+ type="submit"
+ size="small"
+ isLoading={isPending}
+ >
+ {t("actions.save")}
+ </Button>
+ </div>
+ </RouteDrawer.Footer>
+ </KeyboundForm>
+ </RouteDrawer.Form>
+ )
+}
diff --git a/packages/vendor/src/pages/products/product-edit-attribute/product-edit-attribute.tsx b/packages/vendor/src/pages/products/product-edit-attribute/product-edit-attribute.tsx
new file mode 100644
index 000000000..4ef848960
--- /dev/null
+++ b/packages/vendor/src/pages/products/product-edit-attribute/product-edit-attribute.tsx
@@ -0,0 +1,55 @@
+import { Heading } from "@medusajs/ui"
+import { useTranslation } from "react-i18next"
+import { json, useParams } from "react-router-dom"
+
+import { RouteDrawer } from "@components/modals"
+import { useProduct, useProductAttributes } from "@hooks/api/products"
+import { EditProductAttributeForm } from "./components/edit-product-attribute-form"
+
+export const ProductEditAttribute = () => {
+ const { id, attribute_id } = useParams()
+ const { t } = useTranslation()
+
+ const { product, isPending, isFetching, isError, error } =
+ useProduct(id!)
+
+ const { attributes } = useProductAttributes(id!)
+
+ const attribute = (product as any)?.informational_attributes?.find(
+ (a: any) => a.attribute_id === attribute_id
+ )
+
+ const attributeDefinition = attributes?.find(
+ (a: any) => a.id === attribute_id
+ )
+
+ if (!isPending && !isFetching && !attribute) {
+ throw json(
+ {
+ message: `An attribute with ID ${attribute_id} was not found`,
+ },
+ 404
+ )
+ }
+
+ if (isError) {
+ throw error
+ }
+
+ return (
+ <RouteDrawer>
+ <RouteDrawer.Header>
+ <Heading>
+ {t("products.edit.attributes.editHeader")}
+ </Heading>
+ </RouteDrawer.Header>
+ {attribute && (
+ <EditProductAttributeForm
+ productId={id!}
+ attribute={attribute}
+ attributeDefinition={attributeDefinition}
+ />
+ )}
+ </RouteDrawer>
+ )
+}
diff --git a/packages/vendor/src/pages/products/types.ts b/packages/vendor/src/pages/products/types.ts
new file mode 100644
index 000000000..c33c0d703
--- /dev/null
+++ b/packages/vendor/src/pages/products/types.ts
@@ -0,0 +1,69 @@
+export interface ProductAttributePossibleValue {
+ id: string
+ value: string
+ rank: number
+ metadata?: Record<string, any>
+ attribute_id?: string
+}
+
+export interface ProductOptionMetadata {
+ author?: string
+ attribute_id?: string
+ [key: string]: unknown
+}
+
+export interface ProductInformationalAttributeValue {
+ value: string
+ source: "vendor" | "admin"
+ attribute_value_id: string
+ is_filterable: boolean
+ is_editable: boolean
+}
+
+export interface ProductInformationalAttribute {
+ attribute_id: string
+ description?: string | null
+ is_filterable: boolean
+ is_required?: boolean
+ attribute_source: "vendor" | "admin"
+ source?: "vendor" | "admin"
+ is_definition_editable?: boolean
+ name: string
+ ui_component: string
+ values: ProductInformationalAttributeValue[]
+}
+
+export interface ExtendedAdminProductOption {
+ id: string
+ title: string
+ values?: Array<{ id: string; value: string }>
+ metadata?: ProductOptionMetadata | null
+}
+
+export interface ExtendedAdminProduct {
+ id: string
+ title: string
+ options?: ExtendedAdminProductOption[]
+ informational_attributes?: ProductInformationalAttribute[]
+ [key: string]: any
+}
+
+export interface ProductAttribute {
+ id: string
+ name: string
+ description?: string
+ handle: string
+ is_filterable: boolean
+ is_required: boolean
+ ui_component:
+ | "toggle"
+ | "select"
+ | "text"
+ | "text_area"
+ | "unit"
+ | "multivalue"
+ | "color_picker"
+ metadata?: Record<string, any>
+ possible_values: ProductAttributePossibleValue[]
+ product_categories?: Array<{ id: string; name: string }>
+}
diff --git a/packages/vendor/src/utils/get-explicit-variant-images.ts b/packages/vendor/src/utils/get-explicit-variant-images.ts
new file mode 100644
index 000000000..7aab95db5
--- /dev/null
+++ b/packages/vendor/src/utils/get-explicit-variant-images.ts
@@ -0,0 +1,20 @@
+import type { HttpTypes } from "@medusajs/types"
+
+type ImageWithVariants = HttpTypes.AdminProductImage & {
+ variants?: Array<string | { id: string }>
+}
+
+export const getExplicitVariantImages = (
+ images: ImageWithVariants[],
+ variantId: string
+): HttpTypes.AdminProductImage[] => {
+ return images.filter((img) => {
+ if (!img.variants || img.variants.length === 0) {
+ return false
+ }
+
+ return img.variants.some((v) =>
+ typeof v === "string" ? v === variantId : v.id === variantId
+ )
+ })
+}
diff --git a/tools/template-sync/check.ts b/tools/template-sync/check.ts
new file mode 100644
index 000000000..568bf3418
--- /dev/null
+++ b/tools/template-sync/check.ts
@@ -0,0 +1,203 @@
+import { execFileSync } from "node:child_process";
+import fs from "node:fs";
+import path from "node:path";
+
+import { canonicalSkillPolicies, templateBasicRules } from "./config";
+
+type WarningRecord = {
+ title: string;
+ body: string;
+};
+
+function runGit(args: string[]): string {
+ return execFileSync("git", args, {
+ cwd: process.cwd(),
+ encoding: "utf8",
+ stdio: ["ignore", "pipe", "pipe"],
+ }).trim();
+}
+
+function tryGit(args: string[]): string | null {
+ try {
+ return runGit(args);
+ } catch {
+ return null;
+ }
+}
+
+function parseBaseArg(argv: string[]): string | null {
+ for (let i = 0; i < argv.length; i += 1) {
+ const arg = argv[i];
+ if ((arg === "--base" || arg === "-b") && argv[i + 1]) {
+ return argv[i + 1];
+ }
+ }
+ return null;
+}
+
+function refExists(ref: string): boolean {
+ return tryGit(["rev-parse", "--verify", `${ref}^{commit}`]) !== null;
+}
+
+function resolveBaseRef(argv: string[]): string {
+ const candidates = [
+ parseBaseArg(argv),
+ process.env.TEMPLATE_SYNC_BASE || null,
+ process.env.GITHUB_BASE_REF ? `origin/${process.env.GITHUB_BASE_REF}` : null,
+ process.env.GITHUB_BASE_REF || null,
+ "origin/new",
+ "new",
+ "HEAD~1",
+ ].filter(Boolean) as string[];
+
+ for (const candidate of candidates) {
+ if (refExists(candidate)) {
+ return candidate;
+ }
+ }
+
+ return "HEAD~1";
+}
+
+function listChangedFiles(baseRef: string): string[] {
+ const diff =
+ tryGit(["diff", "--name-only", `${baseRef}...HEAD`]) ??
+ tryGit(["diff", "--name-only", baseRef, "HEAD"]) ??
+ "";
+
+ return diff
+ .split("\n")
+ .map((line) => line.trim())
+ .filter(Boolean);
+}
+
+function matchesWatchedPath(filePath: string, watchedPath: string): boolean {
+ if (watchedPath.endsWith("/")) {
+ return filePath === watchedPath.slice(0, -1) || filePath.startsWith(watchedPath);
+ }
+
+ return filePath === watchedPath;
+}
+
+function anyChangedInPaths(changedFiles: string[], watchedPaths: string[]): boolean {
+ return changedFiles.some((filePath) =>
+ watchedPaths.some((watchedPath) => matchesWatchedPath(filePath, watchedPath))
+ );
+}
+
+function changedPathsForRule(changedFiles: string[], watchedPaths: string[]): string[] {
+ return watchedPaths.filter((watchedPath) =>
+ changedFiles.some((filePath) => matchesWatchedPath(filePath, watchedPath))
+ );
+}
+
+function listCanonicalSkills(): string[] {
+ const skillsDir = path.resolve(process.cwd(), ".ai/skills");
+ if (!fs.existsSync(skillsDir)) {
+ return [];
+ }
+
+ return fs
+ .readdirSync(skillsDir, { withFileTypes: true })
+ .filter((entry) => entry.isDirectory())
+ .map((entry) => entry.name)
+ .filter((name) => fs.existsSync(path.join(skillsDir, name, "SKILL.md")))
+ .sort();
+}
+
+function writeSummary(markdown: string): void {
+ const summaryPath = process.env.GITHUB_STEP_SUMMARY;
+ if (!summaryPath) {
+ return;
+ }
+
+ fs.appendFileSync(summaryPath, `${markdown}\n`);
+}
+
+const baseRef = resolveBaseRef(process.argv.slice(2));
+const changedFiles = listChangedFiles(baseRef);
+const warnings: WarningRecord[] = [];
+
+const touchedRules = templateBasicRules
+ .map((rule) => {
+ const sourceTouched = anyChangedInPaths(changedFiles, rule.sourcePaths);
+ const changedTargets = changedPathsForRule(changedFiles, rule.targetPaths);
+ const unchangedTargets = rule.targetPaths.filter(
+ (targetPath) => !changedTargets.includes(targetPath)
+ );
+
+ if (sourceTouched && unchangedTargets.length > 0) {
+ warnings.push({
+ title: `starter drift risk: ${rule.id}`,
+ body: `${rule.reviewMessage}\nUnchanged starter targets:\n- ${unchangedTargets.join("\n- ")}`,
+ });
+ }
+
+ return {
+ ...rule,
+ sourceTouched,
+ changedTargets,
+ unchangedTargets,
+ };
+ })
+ .filter((rule) => rule.sourceTouched);
+
+const canonicalSkills = listCanonicalSkills();
+const unclassifiedSkills = canonicalSkills.filter(
+ (skillName) => !(skillName in canonicalSkillPolicies)
+);
+
+if (unclassifiedSkills.length > 0) {
+ warnings.push({
+ title: "unclassified canonical skills",
+ body: `Add starter relevance entries for:\n- ${unclassifiedSkills.join("\n- ")}`,
+ });
+}
+
+const markdownLines: string[] = [
+ "## Template/basic sync check",
+ "",
+ `- Base ref: \`${baseRef}\``,
+ `- Changed files: ${changedFiles.length}`,
+ `- Starter-relevant groups touched: ${touchedRules.length}`,
+ "",
+];
+
+if (touchedRules.length === 0) {
+ markdownLines.push("No starter-relevant source changes detected.");
+} else {
+ markdownLines.push("### Touched rule groups", "");
+ for (const rule of touchedRules) {
+ markdownLines.push(
+ `- \`${rule.id}\` (${rule.mode}, ${rule.starterPolicy}) — ${rule.description}`
+ );
+ }
+}
+
+markdownLines.push("", "### Canonical skill classification", "");
+markdownLines.push(
+ `- Canonical skills discovered: ${canonicalSkills.length}`,
+ `- Unclassified canonical skills: ${unclassifiedSkills.length}`
+);
+
+if (warnings.length > 0) {
+ markdownLines.push("", "### Warnings", "");
+ for (const warning of warnings) {
+ markdownLines.push(`- **${warning.title}**`);
+ for (const line of warning.body.split("\n")) {
+ markdownLines.push(` ${line}`);
+ }
+ }
+} else {
+ markdownLines.push("", "No starter drift warnings detected.");
+}
+
+const markdown = `${markdownLines.join("\n")}\n`;
+process.stdout.write(markdown);
+writeSummary(markdown);
+
+if (warnings.length > 0) {
+ const warningTitle = "Template Basic Sync";
+ const warningBody = `${warnings.length} starter drift warning(s) detected. See job summary for details.`;
+ process.stdout.write(`::warning title=${warningTitle}::${warningBody}\n`);
+}
diff --git a/tools/template-sync/config.ts b/tools/template-sync/config.ts
new file mode 100644
index 000000000..28a3784b9
--- /dev/null
+++ b/tools/template-sync/config.ts
@@ -0,0 +1,237 @@
+export type StarterPolicy = "sync" | "manual" | "exclude";
+export type SyncMode = "copy" | "adapt";
+
+export interface TemplateBasicRule {
+ id: string;
+ description: string;
+ sourcePaths: string[];
+ targetPaths: string[];
+ starterPolicy: Exclude<StarterPolicy, "exclude">;
+ mode: SyncMode;
+ reviewMessage: string;
+}
+
+export interface CanonicalSkillPolicy {
+ starterPolicy: StarterPolicy;
+ reason: string;
+ targetPaths: string[];
+}
+
+export const templateBasicRules: TemplateBasicRule[] = [
+ {
+ id: "shared-governance",
+ description: "Root agent workflow guidance that shapes how the starter explains agent operations.",
+ sourcePaths: [
+ "AGENTS.md",
+ ".ai/skills/README.md",
+ "templates/ai-governance/AGENTS.md",
+ "templates/ai-governance/.ai/skills/README.md",
+ ],
+ targetPaths: [
+ "templates/basic/AGENTS.md",
+ "templates/basic/.ai/skills/README.md",
+ ],
+ starterPolicy: "sync",
+ mode: "adapt",
+ reviewMessage:
+ "Starter root guidance or starter skill index may need updating.",
+ },
+ {
+ id: "mercur-cli-knowledge",
+ description: "CLI behavior and command selection guidance relevant to starter users.",
+ sourcePaths: [
+ ".ai/skills/mercur-cli/",
+ "packages/cli/README.md",
+ "packages/cli/src/commands/create.ts",
+ "packages/cli/src/commands/init.ts",
+ "packages/cli/src/commands/add.ts",
+ "packages/cli/src/commands/search.ts",
+ "packages/cli/src/commands/view.ts",
+ "packages/cli/src/commands/diff.ts",
+ ],
+ targetPaths: [
+ "templates/basic/AGENTS.md",
+ "templates/basic/packages/api/AGENTS.md",
+ "templates/basic/.ai/skills/mercur-cli/",
+ "templates/basic/.claude/skills/mercur-cli/",
+ "templates/basic/.codex/skills/mercur-cli/",
+ ],
+ starterPolicy: "sync",
+ mode: "copy",
+ reviewMessage:
+ "Starter CLI skill or starter guides may be stale relative to current CLI behavior.",
+ },
+ {
+ id: "mercur-blocks-workflow",
+ description: "Block discovery, install, alias, and post-install verification knowledge.",
+ sourcePaths: [
+ ".ai/skills/mercur-blocks/",
+ "packages/cli/README.md",
+ "packages/cli/src/registry/",
+ "packages/cli/src/commands/add.ts",
+ "packages/cli/src/commands/search.ts",
+ "packages/cli/src/commands/view.ts",
+ "packages/cli/src/commands/diff.ts",
+ "templates/basic/blocks.json",
+ ],
+ targetPaths: [
+ "templates/basic/AGENTS.md",
+ "templates/basic/packages/api/AGENTS.md",
+ "templates/basic/.ai/skills/mercur-blocks/",
+ "templates/basic/.claude/skills/mercur-blocks/",
+ "templates/basic/.codex/skills/mercur-blocks/",
+ ],
+ starterPolicy: "sync",
+ mode: "adapt",
+ reviewMessage:
+ "Starter block workflow docs may need an update because aliasing or registry behavior changed.",
+ },
+ {
+ id: "admin-ui-skills",
+ description: "Starter-safe admin page, form, and tab skills.",
+ sourcePaths: [
+ ".ai/skills/medusa-ui-conformance/",
+ ".ai/skills/admin-page-ui/",
+ ".ai/skills/admin-form-ui/",
+ ".ai/skills/admin-tab-ui/",
+ ],
+ targetPaths: [
+ "templates/basic/.ai/skills/medusa-ui-conformance/",
+ "templates/basic/.ai/skills/admin-page-ui/",
+ "templates/basic/.ai/skills/admin-form-ui/",
+ "templates/basic/.ai/skills/admin-tab-ui/",
+ "templates/basic/.claude/skills/medusa-ui-conformance/",
+ "templates/basic/.claude/skills/admin-page-ui/",
+ "templates/basic/.claude/skills/admin-form-ui/",
+ "templates/basic/.claude/skills/admin-tab-ui/",
+ "templates/basic/.codex/skills/medusa-ui-conformance/",
+ "templates/basic/.codex/skills/admin-page-ui/",
+ "templates/basic/.codex/skills/admin-form-ui/",
+ "templates/basic/.codex/skills/admin-tab-ui/",
+ ],
+ starterPolicy: "sync",
+ mode: "adapt",
+ reviewMessage:
+ "Starter admin UI skills may be stale relative to the canonical admin UI skills.",
+ },
+ {
+ id: "api-extension-knowledge",
+ description: "How the starter backend should explain routes, modules, workflows, links, and codegen.",
+ sourcePaths: [
+ "packages/core-plugin/AGENTS.md",
+ "packages/core-plugin/src/api/README.md",
+ "packages/core-plugin/src/modules/README.md",
+ "packages/types/AGENTS.md",
+ "packages/core-plugin/package.json",
+ ],
+ targetPaths: [
+ "templates/basic/AGENTS.md",
+ "templates/basic/packages/api/AGENTS.md",
+ ],
+ starterPolicy: "sync",
+ mode: "adapt",
+ reviewMessage:
+ "Starter API workspace guide may need updating after backend guidance or codegen behavior changed.",
+ },
+ {
+ id: "admin-extension-knowledge",
+ description: "How the starter should explain admin custom pages and extension points.",
+ sourcePaths: [
+ "packages/admin/AGENTS.md",
+ "templates/basic/apps/admin/src/README.md",
+ ],
+ targetPaths: [
+ "templates/basic/apps/admin/AGENTS.md",
+ ],
+ starterPolicy: "sync",
+ mode: "adapt",
+ reviewMessage:
+ "Starter admin guide may need updating after admin extension conventions changed.",
+ },
+ {
+ id: "vendor-extension-knowledge",
+ description: "How the starter should explain vendor custom pages and extension points.",
+ sourcePaths: [
+ "packages/vendor/AGENTS.md",
+ ],
+ targetPaths: [
+ "templates/basic/apps/vendor/AGENTS.md",
+ ],
+ starterPolicy: "sync",
+ mode: "adapt",
+ reviewMessage:
+ "Starter vendor guide may need updating after vendor extension conventions changed.",
+ },
+];
+
+export const canonicalSkillPolicies: Record<string, CanonicalSkillPolicy> = {
+ "mercur-cli": {
+ starterPolicy: "sync",
+ reason: "Core starter workflow skill for CLI command choice and workdir selection.",
+ targetPaths: [
+ "templates/basic/.ai/skills/mercur-cli/",
+ "templates/basic/.claude/skills/mercur-cli/",
+ "templates/basic/.codex/skills/mercur-cli/",
+ ],
+ },
+ "mercur-blocks": {
+ starterPolicy: "sync",
+ reason: "Core starter workflow skill for block discovery, install impact, and verification.",
+ targetPaths: [
+ "templates/basic/.ai/skills/mercur-blocks/",
+ "templates/basic/.claude/skills/mercur-blocks/",
+ "templates/basic/.codex/skills/mercur-blocks/",
+ ],
+ },
+ "medusa-ui-conformance": {
+ starterPolicy: "sync",
+ reason: "Starter should guide custom dashboard UI toward local wrappers and Medusa UI before lower-level primitives.",
+ targetPaths: [
+ "templates/basic/.ai/skills/medusa-ui-conformance/",
+ "templates/basic/.claude/skills/medusa-ui-conformance/",
+ "templates/basic/.codex/skills/medusa-ui-conformance/",
+ ],
+ },
+ "admin-page-ui": {
+ starterPolicy: "sync",
+ reason: "Starter ships admin page extension knowledge from day one.",
+ targetPaths: [
+ "templates/basic/.ai/skills/admin-page-ui/",
+ "templates/basic/.claude/skills/admin-page-ui/",
+ "templates/basic/.codex/skills/admin-page-ui/",
+ ],
+ },
+ "admin-form-ui": {
+ starterPolicy: "sync",
+ reason: "Starter ships admin form conventions from day one.",
+ targetPaths: [
+ "templates/basic/.ai/skills/admin-form-ui/",
+ "templates/basic/.claude/skills/admin-form-ui/",
+ "templates/basic/.codex/skills/admin-form-ui/",
+ ],
+ },
+ "admin-tab-ui": {
+ starterPolicy: "sync",
+ reason: "Starter ships tabbed admin flow conventions from day one.",
+ targetPaths: [
+ "templates/basic/.ai/skills/admin-tab-ui/",
+ "templates/basic/.claude/skills/admin-tab-ui/",
+ "templates/basic/.codex/skills/admin-tab-ui/",
+ ],
+ },
+ "compound-components-migration-review": {
+ starterPolicy: "exclude",
+ reason: "Migration and review skill for the main repo, not day-one starter knowledge.",
+ targetPaths: [],
+ },
+ "cc-alignment": {
+ starterPolicy: "exclude",
+ reason: "Repo-specific alignment workflow, not a starter-level task.",
+ targetPaths: [],
+ },
+ "admin-ui-review": {
+ starterPolicy: "exclude",
+ reason: "Review-specific skill; starter focuses on implementation workflows.",
+ targetPaths: [],
+ },
+};