fix: export ProductImage to allow for custom links to add alt text (#12357)
This commit is contained in:
5
.changeset/lemon-bees-wave.md
Normal file
5
.changeset/lemon-bees-wave.md
Normal file
@@ -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",
|
||||
"productTag",
|
||||
"productCategory",
|
||||
"productCollection"
|
||||
"productCollection",
|
||||
"productImage"
|
||||
] = [
|
||||
"product",
|
||||
"productVariant",
|
||||
@@ -19,6 +20,7 @@ const eventBaseNames: [
|
||||
"productTag",
|
||||
"productCategory",
|
||||
"productCollection",
|
||||
"productImage",
|
||||
]
|
||||
|
||||
export const ProductEvents = buildEventNamesFromEntityName(
|
||||
|
||||
@@ -1161,6 +1161,14 @@ moduleIntegrationTestRunner<IProductModuleService>({
|
||||
source: Modules.PRODUCT,
|
||||
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, {
|
||||
data: {
|
||||
id: [products[0].options[0].values[0].id],
|
||||
|
||||
@@ -55,7 +55,7 @@ moduleIntegrationTestRunner<Service>({
|
||||
service: ProductModuleService,
|
||||
}).linkable
|
||||
|
||||
expect(Object.keys(linkable)).toHaveLength(8)
|
||||
expect(Object.keys(linkable)).toHaveLength(9)
|
||||
expect(Object.keys(linkable)).toEqual(
|
||||
expect.arrayContaining([
|
||||
"product",
|
||||
@@ -66,6 +66,7 @@ moduleIntegrationTestRunner<Service>({
|
||||
"productTag",
|
||||
"productCollection",
|
||||
"productCategory",
|
||||
"productImage",
|
||||
])
|
||||
)
|
||||
|
||||
@@ -153,6 +154,15 @@ moduleIntegrationTestRunner<Service>({
|
||||
field: "productCategory",
|
||||
},
|
||||
},
|
||||
productImage: {
|
||||
id: {
|
||||
entity: "ProductImage",
|
||||
field: "productImage",
|
||||
linkable: "product_image_id",
|
||||
primaryKey: "id",
|
||||
serviceName: "product",
|
||||
},
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import {
|
||||
Product,
|
||||
ProductCategory,
|
||||
ProductCollection,
|
||||
ProductImage,
|
||||
ProductOption,
|
||||
ProductOptionValue,
|
||||
ProductTag,
|
||||
@@ -22,6 +23,7 @@ export const joinerConfig = defineJoinerConfig(Modules.PRODUCT, {
|
||||
ProductTag,
|
||||
ProductCollection,
|
||||
ProductCategory,
|
||||
ProductImage,
|
||||
],
|
||||
linkableKeys: {
|
||||
// Merged with the autogenerated ones to maintain backward compatibility
|
||||
|
||||
@@ -96,6 +96,9 @@ export default class ProductModuleService
|
||||
ProductVariant: {
|
||||
dto: ProductTypes.ProductVariantDTO
|
||||
}
|
||||
ProductImage: {
|
||||
dto: ProductTypes.ProductImageDTO
|
||||
}
|
||||
}>({
|
||||
Product,
|
||||
ProductCategory,
|
||||
@@ -105,6 +108,7 @@ export default class ProductModuleService
|
||||
ProductTag,
|
||||
ProductType,
|
||||
ProductVariant,
|
||||
ProductImage,
|
||||
})
|
||||
implements ProductTypes.IProductModuleService
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user