Skip to content

Commit e3879d6

Browse files
authored
Merge pull request #18 from NicolasGorga/issue-17
Change deprecated NotificationService inheritance to AbstractNotificationService
2 parents 98f07ad + ac8ff19 commit e3879d6

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/services/sendgrid.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import SendGrid from "@sendgrid/mail"
22
import { humanizeAmount, zeroDecimalCurrencies } from "medusa-core-utils"
3-
import { NotificationService } from "medusa-interfaces"
43
import { MedusaError } from "@medusajs/utils"
54
import { AttachmentsArray, FromFullFilementService, NewLineItem, SendGridData } from "../types/generic"
65
import { PluginOptions } from "../types"
7-
import type { CartService, ClaimService, FulfillmentProviderService,
8-
GiftCardService, LineItem, LineItemService, Logger, Order, OrderService, ProductVariantService, Return, ReturnItem, ReturnService,
9-
StoreService, SwapService, TotalsService } from "@medusajs/medusa"
6+
import {
7+
AbstractNotificationService, CartService, ClaimService, FulfillmentProviderService,
8+
GiftCardService, LineItem, LineItemService, Logger, Order, OrderService, ProductVariantService, Return, ReturnItem, ReturnService,
9+
StoreService, SwapService, TotalsService
10+
} from "@medusajs/medusa"
1011

11-
export class SendGridService extends NotificationService {
12+
export class SendGridService extends AbstractNotificationService {
1213
static identifier = "sendgrid"
1314

1415
options_: PluginOptions
@@ -58,7 +59,8 @@ export class SendGridService extends NotificationService {
5859
},
5960
options: PluginOptions
6061
) {
61-
super()
62+
// @ts-expect-error prefer-rest-params
63+
super(...arguments)
6264

6365
this.options_ = options
6466

@@ -370,7 +372,7 @@ export class SendGridService extends NotificationService {
370372
.then(() => "sent")
371373
.catch(() => "failed")
372374

373-
return { to: sendOptions.to, status, data: sendOptions }
375+
return { to: sendOptions.to as string, status, data: sendOptions as unknown as Record<string, unknown> }
374376
}
375377

376378

0 commit comments

Comments
 (0)