refactor: notification mail services

This commit is contained in:
Ahmed Bouhuolia
2024-11-02 14:59:57 +02:00
parent 0cc80bc179
commit d09aebcebb
19 changed files with 270 additions and 123 deletions

View File

@@ -13,6 +13,7 @@ import {
SALE_ESTIMATE_DELETED,
SALE_ESTIMATE_PDF_VIEWED,
SALE_ESTIMATE_VIEWED,
SALE_ESTIMATE_MAIL_SENT,
} from '@/constants/event-tracker';
@Service()
@@ -44,6 +45,10 @@ export class SaleEstimateEventsTracker extends EventSubscriber {
events.saleEstimate.onViewed,
this.handleTrackViewedEstimateEvent
);
bus.subscribe(
events.saleEstimate.onMailSent,
this.handleTrackMailSentEstimateEvent
);
}
private handleTrackEstimateCreatedEvent = ({
@@ -93,4 +98,12 @@ export class SaleEstimateEventsTracker extends EventSubscriber {
properties: {},
});
};
private handleTrackMailSentEstimateEvent = ({ tenantId }) => {
this.posthog.trackEvent({
distinctId: `tenant-${tenantId}`,
event: SALE_ESTIMATE_MAIL_SENT,
properties: {},
});
};
}