@@ -2,7 +2,7 @@ import SendGrid from "@sendgrid/mail"
22import { humanizeAmount , zeroDecimalCurrencies } from "medusa-core-utils"
33import { NotificationService } from "medusa-interfaces"
44import { MedusaError } from "@medusajs/utils"
5- import { AttachmentsArray , FromFullFilementService , NewLineItem , EventData , SendGridData } from "../types/generic"
5+ import { AttachmentsArray , FromFullFilementService , NewLineItem , SendGridData } from "../types/generic"
66import { PluginOptions } from "../types"
77import type { CartService , ClaimService , FulfillmentProviderService ,
88 GiftCardService , LineItem , LineItemService , Logger , Order , OrderService , ProductVariantService , Return , ReturnItem , ReturnService ,
@@ -127,7 +127,7 @@ export class SendGridService extends NotificationService {
127127
128128
129129
130- async fetchData ( event : string , eventData : EventData ,
130+ async fetchData ( event : string , eventData : Record < string , unknown > ,
131131 attachmentGenerator : any ) : Promise < Record < any , any > > {
132132 switch ( event ) {
133133 case "order.return_requested" :
@@ -233,7 +233,7 @@ export class SendGridService extends NotificationService {
233233 }
234234
235235
236- async sendNotification ( event : string , eventData : EventData , attachmentGenerator ?: any ) {
236+ async sendNotification ( event : string , eventData : Record < string , unknown > , attachmentGenerator ?: any ) {
237237 const data = await this . fetchData ( event , eventData , attachmentGenerator )
238238
239239 let templateId = this . getTemplateId ( event )
@@ -379,7 +379,7 @@ export class SendGridService extends NotificationService {
379379 return email ;
380380 }
381381
382- async orderShipmentCreatedData ( { id, fulfillment_id } : EventData , attachmentGenerator ?: any ) {
382+ async orderShipmentCreatedData ( { id, fulfillment_id } : Record < string , unknown > , attachmentGenerator ?: any ) {
383383 const order = await this . orderService_ . retrieve ( id , {
384384 select : [
385385 "shipping_total" ,
@@ -431,7 +431,7 @@ export class SendGridService extends NotificationService {
431431 }
432432 }
433433
434- async orderCanceledData ( { id } : EventData ) {
434+ async orderCanceledData ( { id } : Record < string , unknown > ) {
435435 const order = await this . orderService_ . retrieve ( id , {
436436 select : [
437437 "shipping_total" ,
@@ -539,7 +539,7 @@ export class SendGridService extends NotificationService {
539539 }
540540 }
541541
542- async orderPlacedData ( { id } : EventData ) {
542+ async orderPlacedData ( { id } : Record < string , unknown > ) {
543543 const order = await this . orderService_ . retrieve ( id , {
544544 select : [
545545 "shipping_total" ,
@@ -687,7 +687,7 @@ export class SendGridService extends NotificationService {
687687 }
688688 }
689689
690- async gcCreatedData ( { id } : EventData ) {
690+ async gcCreatedData ( { id } : Record < string , unknown > ) {
691691 const giftCard = await this . giftCardService_ . retrieve ( id , {
692692 relations : [ "region" , "order" ] ,
693693 } )
@@ -712,7 +712,7 @@ export class SendGridService extends NotificationService {
712712 }
713713 }
714714
715- async returnRequestedData ( { id, return_id } : EventData ) {
715+ async returnRequestedData ( { id, return_id } : Record < string , unknown > ) {
716716 // Fetch the return request
717717 if ( ! return_id ) {
718718 throw new MedusaError (
@@ -858,7 +858,7 @@ export class SendGridService extends NotificationService {
858858 }
859859 }
860860
861- async swapReceivedData ( { id } : EventData ) {
861+ async swapReceivedData ( { id } : Record < string , unknown > ) {
862862 const store = await this . storeService_ . retrieve ( )
863863
864864 const swap = await this . swapService_ . retrieve ( id , {
@@ -1000,7 +1000,7 @@ export class SendGridService extends NotificationService {
10001000 }
10011001 }
10021002
1003- async swapCreatedData ( { id } : EventData ) {
1003+ async swapCreatedData ( { id } : Record < string , unknown > ) {
10041004 const store = await this . storeService_ . retrieve ( )
10051005 const swap = await this . swapService_ . retrieve ( id , {
10061006 relations : [
@@ -1147,11 +1147,11 @@ export class SendGridService extends NotificationService {
11471147 }
11481148 }
11491149
1150- async itemsReturnedData ( data : EventData ) {
1150+ async itemsReturnedData ( data : Record < string , unknown > ) {
11511151 return this . returnRequestedData ( data )
11521152 }
11531153
1154- async swapShipmentCreatedData ( { id, fulfillment_id } : EventData ) {
1154+ async swapShipmentCreatedData ( { id, fulfillment_id } : Record < string , unknown > ) {
11551155 const swap = await this . swapService_ . retrieve ( id , {
11561156 relations : [
11571157 "shipping_address" ,
@@ -1310,7 +1310,7 @@ export class SendGridService extends NotificationService {
13101310 }
13111311 }
13121312
1313- async claimShipmentCreatedData ( { id, fulfillment_id } : EventData ) {
1313+ async claimShipmentCreatedData ( { id, fulfillment_id } : Record < string , unknown > ) {
13141314 const claim = await this . claimService_ . retrieve ( id , {
13151315 relations : [
13161316 "order.items.variant.product.profiles" ,
@@ -1341,7 +1341,7 @@ export class SendGridService extends NotificationService {
13411341 }
13421342 }
13431343
1344- async restockNotificationData ( { variant_id, emails } : EventData ) {
1344+ async restockNotificationData ( { variant_id, emails } : Record < string , unknown > ) {
13451345 if ( ! variant_id ) {
13461346 throw new MedusaError (
13471347 MedusaError . Types . INVALID_DATA ,
@@ -1368,15 +1368,15 @@ export class SendGridService extends NotificationService {
13681368 }
13691369 }
13701370
1371- userPasswordResetData ( data : EventData ) {
1371+ userPasswordResetData ( data : Record < string , unknown > ) {
13721372 return data
13731373 }
13741374
1375- customerPasswordResetData ( data : EventData ) {
1375+ customerPasswordResetData ( data : Record < string , unknown > ) {
13761376 return data
13771377 }
13781378
1379- async orderRefundCreatedData ( { id, refund_id } : EventData ) {
1379+ async orderRefundCreatedData ( { id, refund_id } : Record < string , unknown > ) {
13801380 const order = await this . orderService_ . retrieveWithTotals ( id , {
13811381 relations : [ "refunds" , "items" ] ,
13821382 } )
0 commit comments