feat(admin, admin-ui, medusa-js, medusa-react, medusa): Support Admin Extensions (#4761)
Co-authored-by: Rares Stefan <948623+StephixOne@users.noreply.github.com> Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
26c78bbc03
commit
f1a05f4725
@@ -0,0 +1,59 @@
|
||||
export const forbiddenRoutes = [
|
||||
"/products",
|
||||
"/products/:id",
|
||||
"/product-categories",
|
||||
"/product-categories",
|
||||
"/orders",
|
||||
"/orders/:id",
|
||||
"/customers",
|
||||
"/customers/:id",
|
||||
"/customers/groups",
|
||||
"/customers/groups/:id",
|
||||
"/discounts",
|
||||
"/discounts/new",
|
||||
"/discounts/:id",
|
||||
"/gift-cards",
|
||||
"/gift-cards/:id",
|
||||
"/gift-cards/manage",
|
||||
"/pricing",
|
||||
"/pricing/new",
|
||||
"/pricing/:id",
|
||||
"/inventory",
|
||||
"/collections",
|
||||
"/collections/:id",
|
||||
"/draft-orders",
|
||||
"/draft-orders/:id",
|
||||
"/login",
|
||||
"/sales-channels",
|
||||
"/publishable-api-keys",
|
||||
"/oauth",
|
||||
"/oauth/:app_name",
|
||||
] as const
|
||||
|
||||
export const isSettingsRoute = (route: string) => {
|
||||
return route.startsWith("/settings")
|
||||
}
|
||||
|
||||
export const isForbiddenRoute = (route: any): boolean => {
|
||||
if (isSettingsRoute(route)) {
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
console.warn(
|
||||
`The route "${route}" is a settings route. Please register the extension in the "settings" directory instead.`
|
||||
)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
if (forbiddenRoutes.includes(route)) {
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
console.warn(
|
||||
`The route "${route}" is a forbidden route. We do not currently support overriding default routes.`
|
||||
)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
export const injectionZones = [
|
||||
// Order injection zones
|
||||
"order.details.before",
|
||||
"order.details.after",
|
||||
"order.list.before",
|
||||
"order.list.after",
|
||||
// Draft order injection zones
|
||||
"draft_order.list.before",
|
||||
"draft_order.list.after",
|
||||
"draft_order.details.before",
|
||||
"draft_order.details.after",
|
||||
// Customer injection zones
|
||||
"customer.details.before",
|
||||
"customer.details.after",
|
||||
"customer.list.before",
|
||||
"customer.list.after",
|
||||
// Customer group injection zones
|
||||
"customer_group.details.before",
|
||||
"customer_group.details.after",
|
||||
"customer_group.list.before",
|
||||
"customer_group.list.after",
|
||||
// Product injection zones
|
||||
"product.details.before",
|
||||
"product.details.after",
|
||||
"product.list.before",
|
||||
"product.list.after",
|
||||
// Product collection injection zones
|
||||
"product_collection.details.before",
|
||||
"product_collection.details.after",
|
||||
"product_collection.list.before",
|
||||
"product_collection.list.after",
|
||||
// Price list injection zones
|
||||
"price_list.details.before",
|
||||
"price_list.details.after",
|
||||
"price_list.list.before",
|
||||
"price_list.list.after",
|
||||
// Discount injection zones
|
||||
"discount.details.before",
|
||||
"discount.details.after",
|
||||
"discount.list.before",
|
||||
"discount.list.after",
|
||||
// Gift card injection zones
|
||||
"gift_card.details.before",
|
||||
"gift_card.details.after",
|
||||
"gift_card.list.before",
|
||||
"gift_card.list.after",
|
||||
"custom_gift_card.before",
|
||||
"custom_gift_card.after",
|
||||
// Login
|
||||
"login.before",
|
||||
"login.after",
|
||||
] as const
|
||||
@@ -1,2 +1,2 @@
|
||||
export const MEDUSA_BACKEND_URL =
|
||||
__MEDUSA_BACKEND_URL__ || "http://localhost:9000"
|
||||
process.env.MEDUSA_BACKEND_URL || "http://localhost:9000"
|
||||
|
||||
Reference in New Issue
Block a user