mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
feat: Track events of pdf documents views
This commit is contained in:
@@ -6,6 +6,8 @@ import HasTenancyService from '@/services/Tenancy/TenancyService';
|
||||
import { SaleEstimatePdfTemplate } from '../Invoices/SaleEstimatePdfTemplate';
|
||||
import { transformEstimateToPdfTemplate } from './utils';
|
||||
import { EstimatePdfBrandingAttributes } from './constants';
|
||||
import events from '@/subscribers/events';
|
||||
import { EventPublisher } from '@/lib/EventPublisher/EventPublisher';
|
||||
|
||||
@Service()
|
||||
export class SaleEstimatesPdf {
|
||||
@@ -24,6 +26,9 @@ export class SaleEstimatesPdf {
|
||||
@Inject()
|
||||
private estimatePdfTemplate: SaleEstimatePdfTemplate;
|
||||
|
||||
@Inject()
|
||||
private eventPublisher: EventPublisher;
|
||||
|
||||
/**
|
||||
* Retrieve sale invoice pdf content.
|
||||
* @param {number} tenantId -
|
||||
@@ -50,6 +55,13 @@ export class SaleEstimatesPdf {
|
||||
tenantId,
|
||||
htmlContent
|
||||
);
|
||||
const eventPayload = { tenantId, saleEstimateId };
|
||||
|
||||
// Triggers the `onSaleEstimatePdfViewed` event.
|
||||
await this.eventPublisher.emitAsync(
|
||||
events.saleEstimate.onPdfViewed,
|
||||
eventPayload
|
||||
);
|
||||
return [content, filename];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user