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.

fix: update scan-unauthenticated-routes to use project root, fix template config and vendor UI

vholik869e05f3fdb4
diff --git a/packages/core-plugin/src/api/utils/scan-unauthenticated-routes.ts b/packages/core-plugin/src/api/utils/scan-unauthenticated-routes.ts
index 9a2fd3365..8319628f0 100644
--- a/packages/core-plugin/src/api/utils/scan-unauthenticated-routes.ts
+++ b/packages/core-plugin/src/api/utils/scan-unauthenticated-routes.ts
@@ -57,9 +57,10 @@ function filePathToRegex(filePath: string, apiDir: string): RegExp {
return new RegExp("^\\/" + regexSegments.join("\\/") + "$")
}
-export function scanUnauthenticatedRoutes(vendorDir: string): RegExp[] {
- const apiDir = path.dirname(vendorDir)
- const routeFiles = crawlRoutes(vendorDir)
+export function scanUnauthenticatedRoutes(projectRoot: string): RegExp[] {
+ const vendorApiDir = path.join(projectRoot, "src", "api", "vendor")
+ const apiDir = path.join(projectRoot, "src", "api")
+ const routeFiles = crawlRoutes(vendorApiDir)
const patterns: RegExp[] = []
for (const file of routeFiles) {
diff --git a/packages/core-plugin/src/api/vendor/middlewares.ts b/packages/core-plugin/src/api/vendor/middlewares.ts
index c52db4f9c..d3f5a6cf2 100644
--- a/packages/core-plugin/src/api/vendor/middlewares.ts
+++ b/packages/core-plugin/src/api/vendor/middlewares.ts
@@ -44,7 +44,7 @@ import { vendorProductTagsMiddlewares } from "./product-tags/middlewares"
const unauthenticatedRoutes = [
/^\/vendor\/sellers$/,
- ...scanUnauthenticatedRoutes(__dirname),
+ ...scanUnauthenticatedRoutes(process.cwd()),
]
export const vendorMiddlewares: MiddlewareRoute[] = [
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 a4d47ccf9..dd7849179 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
@@ -139,14 +139,6 @@ export const ProductListDataTable = () => {
shortcut: "d",
},
]}
- noRecords={{
- title: t("products.list.noRecordsTitle"),
- message: t("products.list.noRecordsMessage"),
- action: {
- to: "/products/create",
- label: t("actions.add"),
- },
- }}
/>
);
};
diff --git a/templates/basic/apps/vendor/package.json b/templates/basic/apps/vendor/package.json
index 414c9b1f6..03759ef54 100644
--- a/templates/basic/apps/vendor/package.json
+++ b/templates/basic/apps/vendor/package.json
@@ -12,6 +12,7 @@
"dependencies": {
"@medusajs/icons": "^2.13.0",
"@mercurjs/dashboard-sdk": "2.0.0-canary.19",
+ "@mercurjs/dashboard-shared": "2.0.0-canary.19",
"@mercurjs/vendor": "2.0.0-canary.19",
"react": "^18.0.0",
"react-dom": "^18.0.0",
diff --git a/templates/basic/apps/vendor/src/lib/client.ts b/templates/basic/apps/vendor/src/lib/client.ts
index 2803d24a0..078a11c58 100644
--- a/templates/basic/apps/vendor/src/lib/client.ts
+++ b/templates/basic/apps/vendor/src/lib/client.ts
@@ -5,4 +5,7 @@ declare const __BACKEND_URL__: string
export const client: InferClient<Routes> = createClient({
baseUrl: __BACKEND_URL__,
+ fetchOptions: {
+ credentials: 'include',
+ }
})
diff --git a/templates/basic/blocks.json b/templates/basic/blocks.json
index e9876e944..39b78331a 100644
--- a/templates/basic/blocks.json
+++ b/templates/basic/blocks.json
@@ -6,7 +6,7 @@
"api": "packages/api/src/api",
"modules": "packages/api/src/modules",
"vendor": "apps/vendor/src",
- "admin": "apps/admin/src",
+ "admin": "packages/api/src/admin",
"lib": "packages/api/src/lib"
},
"registries": {}