Files
medusa-store/packages/medusa-interfaces/src/notification-service.js
Adrien de Peretti 45996d58a2 chore(medusa, interfaces): Uniformise class checks (#5869)
**What**
One problem with local development can be the dependencies management. To mitigate that, transform checks from an instance of to value check as well as harmonize utils function to be part of the class as a static method instead of separate utilities. By using this approach we are not dependent of the origin of the class and therefore it should ease the user experience.

**NOTE**
As a next step to discuss, we should probably move the interfaces from the interfaces/medusa package to the utils package. Then we can deprecate the interfaces package and remove it at a later time
2023-12-19 13:26:57 +00:00

36 lines
771 B
JavaScript

import BaseService from "./base-service"
/**
* Interface for Notification Providers
* @interface
* @deprecated use AbstractNotificationService from @medusajs/medusa instead
*/
class BaseNotificationService extends BaseService {
static _isNotificationService = true
static isNotificationService(obj) {
return obj?.constructor?._isNotificationService
}
constructor() {
super()
}
getIdentifier() {
return this.constructor.identifier
}
/**
* Used to retrieve documents related to a shipment.
*/
sendNotification(event, data) {
throw new Error("Must be overridden by child")
}
resendNotification(notification, config = {}) {
throw new Error("Must be overridden by child")
}
}
export default BaseNotificationService