fix(admin-shared,dashboard): Add missing injection zones (#10098)

**What**
- Adds missing InjectionZones for ProductVariant details page.
- Removes v1 related zones, such as GiftCard and DraftOrder.
This commit is contained in:
Kasper Fabricius Kristensen authored and GitHub committed 2024-11-14 18:32:36 +00:00
1 parent 79a3dc1e82
commit a153bc477c
3 files changed
+23 -27

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
---
"@medusajs/admin-shared": patch
"@medusajs/dashboard": patch
---
fix(admin-shared,dashboard): Add missing Injection Zones and remove unused zones"
@@ -7,15 +7,6 @@ const ORDER_INJECTION_ZONES = [
"order.list.after", "order.list.after",
] as const ] as const
const DRAFT_ORDER_INJECTION_ZONES = [
"draft_order.list.before",
"draft_order.list.after",
"draft_order.details.side.before",
"draft_order.details.side.after",
"draft_order.details.before",
"draft_order.details.after",
] as const
const CUSTOMER_INJECTION_ZONES = [ const CUSTOMER_INJECTION_ZONES = [
"customer.details.before", "customer.details.before",
"customer.details.after", "customer.details.after",
@@ -39,6 +30,13 @@ const PRODUCT_INJECTION_ZONES = [
"product.details.side.after", "product.details.side.after",
] as const ] as const
const PRODUCT_VARIANT_INJECTION_ZONES = [
"product_variant.details.before",
"product_variant.details.after",
"product_variant.details.side.before",
"product_variant.details.side.after",
] as const
const PRODUCT_COLLECTION_INJECTION_ZONES = [ const PRODUCT_COLLECTION_INJECTION_ZONES = [
"product_collection.details.before", "product_collection.details.before",
"product_collection.details.after", "product_collection.details.after",
@@ -96,15 +94,6 @@ const CAMPAIGN_INJECTION_ZONES = [
"campaign.list.after", "campaign.list.after",
] as const ] as const
const 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",
] as const
const USER_INJECTION_ZONES = [ const USER_INJECTION_ZONES = [
"user.details.before", "user.details.before",
"user.details.after", "user.details.after",
@@ -204,15 +193,16 @@ const INVENTORY_ITEM_INJECTION_ZONES = [
*/ */
export const INJECTION_ZONES = [ export const INJECTION_ZONES = [
...ORDER_INJECTION_ZONES, ...ORDER_INJECTION_ZONES,
...DRAFT_ORDER_INJECTION_ZONES,
...CUSTOMER_INJECTION_ZONES, ...CUSTOMER_INJECTION_ZONES,
...CUSTOMER_GROUP_INJECTION_ZONES, ...CUSTOMER_GROUP_INJECTION_ZONES,
...PRODUCT_INJECTION_ZONES, ...PRODUCT_INJECTION_ZONES,
...PRODUCT_VARIANT_INJECTION_ZONES,
...PRODUCT_COLLECTION_INJECTION_ZONES, ...PRODUCT_COLLECTION_INJECTION_ZONES,
...PRODUCT_CATEGORY_INJECTION_ZONES, ...PRODUCT_CATEGORY_INJECTION_ZONES,
...PRODUCT_TYPE_INJECTION_ZONES,
...PRODUCT_TAG_INJECTION_ZONES,
...PRICE_LIST_INJECTION_ZONES, ...PRICE_LIST_INJECTION_ZONES,
...PROMOTION_INJECTION_ZONES, ...PROMOTION_INJECTION_ZONES,
...GIFT_CARD_INJECTION_ZONES,
...USER_INJECTION_ZONES, ...USER_INJECTION_ZONES,
...STORE_INJECTION_ZONES, ...STORE_INJECTION_ZONES,
...PROFILE_INJECTION_ZONES, ...PROFILE_INJECTION_ZONES,
@@ -226,8 +216,6 @@ export const INJECTION_ZONES = [
...WORKFLOW_INJECTION_ZONES, ...WORKFLOW_INJECTION_ZONES,
...CAMPAIGN_INJECTION_ZONES, ...CAMPAIGN_INJECTION_ZONES,
...TAX_INJECTION_ZONES, ...TAX_INJECTION_ZONES,
...PRODUCT_TYPE_INJECTION_ZONES,
...PRODUCT_TAG_INJECTION_ZONES,
...RETURN_REASON_INJECTION_ZONES, ...RETURN_REASON_INJECTION_ZONES,
...INVENTORY_ITEM_INJECTION_ZONES, ...INVENTORY_ITEM_INJECTION_ZONES,
] as const ] as const
@@ -4,6 +4,7 @@ import { useProductVariant } from "../../../hooks/api/products"
import { TwoColumnPageSkeleton } from "../../../components/common/skeleton" import { TwoColumnPageSkeleton } from "../../../components/common/skeleton"
import { TwoColumnPage } from "../../../components/layout/pages" import { TwoColumnPage } from "../../../components/layout/pages"
import { useDashboardExtension } from "../../../extensions"
import { VariantGeneralSection } from "./components/variant-general-section" import { VariantGeneralSection } from "./components/variant-general-section"
import { import {
InventorySectionPlaceholder, InventorySectionPlaceholder,
@@ -28,6 +29,8 @@ export const ProductVariantDetail = () => {
} }
) )
const { getWidgets } = useDashboardExtension()
if (isLoading || !variant) { if (isLoading || !variant) {
return ( return (
<TwoColumnPageSkeleton <TwoColumnPageSkeleton
@@ -49,12 +52,11 @@ export const ProductVariantDetail = () => {
hasOutlet hasOutlet
showJSON showJSON
showMetadata showMetadata
// TODO: Add widgets zones for variant detail page
widgets={{ widgets={{
after: [], after: getWidgets("product_variant.details.after"),
before: [], before: getWidgets("product_variant.details.before"),
sideAfter: [], sideAfter: getWidgets("product_variant.details.side.after"),
sideBefore: [], sideBefore: getWidgets("product_variant.details.side.before"),
}} }}
> >
<TwoColumnPage.Main> <TwoColumnPage.Main>