fix: export ProductImage to allow for custom links to add alt text (#12357)
This commit is contained in:
1 parent
c35e9e5104
commit
e4d853185f
6 files changed
+33
-2
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/product": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: export ProductImage to allow for custom links to add alt text
|
||||||
@@ -9,7 +9,8 @@ const eventBaseNames: [
|
|||||||
"productType",
|
"productType",
|
||||||
"productTag",
|
"productTag",
|
||||||
"productCategory",
|
"productCategory",
|
||||||
"productCollection"
|
"productCollection",
|
||||||
|
"productImage"
|
||||||
] = [
|
] = [
|
||||||
"product",
|
"product",
|
||||||
"productVariant",
|
"productVariant",
|
||||||
@@ -19,6 +20,7 @@ const eventBaseNames: [
|
|||||||
"productTag",
|
"productTag",
|
||||||
"productCategory",
|
"productCategory",
|
||||||
"productCollection",
|
"productCollection",
|
||||||
|
"productImage",
|
||||||
]
|
]
|
||||||
|
|
||||||
export const ProductEvents = buildEventNamesFromEntityName(
|
export const ProductEvents = buildEventNamesFromEntityName(
|
||||||
|
|||||||
+8
@@ -1161,6 +1161,14 @@ moduleIntegrationTestRunner<IProductModuleService>({
|
|||||||
source: Modules.PRODUCT,
|
source: Modules.PRODUCT,
|
||||||
action: CommonEvents.DELETED,
|
action: CommonEvents.DELETED,
|
||||||
}),
|
}),
|
||||||
|
composeMessage(ProductEvents.PRODUCT_IMAGE_DELETED, {
|
||||||
|
data: {
|
||||||
|
id: [products[0].images[0].id],
|
||||||
|
},
|
||||||
|
object: "product_image",
|
||||||
|
source: Modules.PRODUCT,
|
||||||
|
action: CommonEvents.DELETED,
|
||||||
|
}),
|
||||||
composeMessage(ProductEvents.PRODUCT_OPTION_VALUE_DELETED, {
|
composeMessage(ProductEvents.PRODUCT_OPTION_VALUE_DELETED, {
|
||||||
data: {
|
data: {
|
||||||
id: [products[0].options[0].values[0].id],
|
id: [products[0].options[0].values[0].id],
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ moduleIntegrationTestRunner<Service>({
|
|||||||
service: ProductModuleService,
|
service: ProductModuleService,
|
||||||
}).linkable
|
}).linkable
|
||||||
|
|
||||||
expect(Object.keys(linkable)).toHaveLength(8)
|
expect(Object.keys(linkable)).toHaveLength(9)
|
||||||
expect(Object.keys(linkable)).toEqual(
|
expect(Object.keys(linkable)).toEqual(
|
||||||
expect.arrayContaining([
|
expect.arrayContaining([
|
||||||
"product",
|
"product",
|
||||||
@@ -66,6 +66,7 @@ moduleIntegrationTestRunner<Service>({
|
|||||||
"productTag",
|
"productTag",
|
||||||
"productCollection",
|
"productCollection",
|
||||||
"productCategory",
|
"productCategory",
|
||||||
|
"productImage",
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -153,6 +154,15 @@ moduleIntegrationTestRunner<Service>({
|
|||||||
field: "productCategory",
|
field: "productCategory",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
productImage: {
|
||||||
|
id: {
|
||||||
|
entity: "ProductImage",
|
||||||
|
field: "productImage",
|
||||||
|
linkable: "product_image_id",
|
||||||
|
primaryKey: "id",
|
||||||
|
serviceName: "product",
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import {
|
|||||||
Product,
|
Product,
|
||||||
ProductCategory,
|
ProductCategory,
|
||||||
ProductCollection,
|
ProductCollection,
|
||||||
|
ProductImage,
|
||||||
ProductOption,
|
ProductOption,
|
||||||
ProductOptionValue,
|
ProductOptionValue,
|
||||||
ProductTag,
|
ProductTag,
|
||||||
@@ -22,6 +23,7 @@ export const joinerConfig = defineJoinerConfig(Modules.PRODUCT, {
|
|||||||
ProductTag,
|
ProductTag,
|
||||||
ProductCollection,
|
ProductCollection,
|
||||||
ProductCategory,
|
ProductCategory,
|
||||||
|
ProductImage,
|
||||||
],
|
],
|
||||||
linkableKeys: {
|
linkableKeys: {
|
||||||
// Merged with the autogenerated ones to maintain backward compatibility
|
// Merged with the autogenerated ones to maintain backward compatibility
|
||||||
|
|||||||
@@ -96,6 +96,9 @@ export default class ProductModuleService
|
|||||||
ProductVariant: {
|
ProductVariant: {
|
||||||
dto: ProductTypes.ProductVariantDTO
|
dto: ProductTypes.ProductVariantDTO
|
||||||
}
|
}
|
||||||
|
ProductImage: {
|
||||||
|
dto: ProductTypes.ProductImageDTO
|
||||||
|
}
|
||||||
}>({
|
}>({
|
||||||
Product,
|
Product,
|
||||||
ProductCategory,
|
ProductCategory,
|
||||||
@@ -105,6 +108,7 @@ export default class ProductModuleService
|
|||||||
ProductTag,
|
ProductTag,
|
||||||
ProductType,
|
ProductType,
|
||||||
ProductVariant,
|
ProductVariant,
|
||||||
|
ProductImage,
|
||||||
})
|
})
|
||||||
implements ProductTypes.IProductModuleService
|
implements ProductTypes.IProductModuleService
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user