mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 22:30:31 +00:00
refactor: events tracker to nestjs
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import {
|
||||
IAccountEventCreatedPayload,
|
||||
IAccountEventEditedPayload,
|
||||
IAccountEventDeletedPayload,
|
||||
} from '../../Accounts/Accounts.types';
|
||||
import { EventTrackerService } from '../EventTracker.service';
|
||||
import {
|
||||
ACCOUNT_CREATED,
|
||||
ACCOUNT_EDITED,
|
||||
ACCOUNT_DELETED,
|
||||
ACCOUNT_VIEWED,
|
||||
} from '../event-tracker';
|
||||
import { events } from '@/common/events/events';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
|
||||
@Injectable()
|
||||
export class AccountEventsTracker {
|
||||
constructor(public readonly posthog: EventTrackerService) {}
|
||||
|
||||
@OnEvent(events.accounts.onCreated)
|
||||
public handleTrackAccountCreatedEvent({}: IAccountEventCreatedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: ACCOUNT_CREATED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.accounts.onEdited)
|
||||
public handleTrackEditedAccountEvent({}: IAccountEventEditedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: ACCOUNT_EDITED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.accounts.onDeleted)
|
||||
public handleTrackDeletedAccountEvent({}: IAccountEventDeletedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: ACCOUNT_DELETED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.accounts.onViewed)
|
||||
public handleTrackAccountViewedEvent({}) {
|
||||
this.posthog.trackEvent({
|
||||
event: ACCOUNT_VIEWED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
import { EventTrackerService } from '../EventTracker.service';
|
||||
import { AUTH_SIGNED_UP } from '../event-tracker';
|
||||
import { events } from '@/common/events/events';
|
||||
|
||||
@Injectable()
|
||||
export class AuthenticationEventsTracker {
|
||||
constructor(public readonly posthog: EventTrackerService) {}
|
||||
|
||||
// @OnEvent(events.auth.onSignedUp)
|
||||
// public handleTrackSignUpEvent({ user }: IAuthSignedUpEventPayload) {
|
||||
// this.posthog.trackEvent({
|
||||
// event: AUTH_SIGNED_UP,
|
||||
// properties: {
|
||||
// firstName: user.firstName,
|
||||
// lastName: user.lastName,
|
||||
// email: user.email,
|
||||
// },
|
||||
// });
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import {
|
||||
IBankRuleEventCreatedPayload,
|
||||
IBankRuleEventEditedPayload,
|
||||
IBankRuleEventDeletedPayload,
|
||||
} from '../../BankRules/types';
|
||||
import { EventTrackerService } from '../EventTracker.service';
|
||||
import { events } from '@/common/events/events';
|
||||
import {
|
||||
BANK_RULE_CREATED,
|
||||
BANK_RULE_EDITED,
|
||||
BANK_RULE_DELETED,
|
||||
} from '../event-tracker';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
|
||||
@Injectable()
|
||||
export class BankRuleEventsTracker {
|
||||
constructor(public readonly posthog: EventTrackerService) {}
|
||||
|
||||
@OnEvent(events.bankRules.onCreated)
|
||||
public handleTrackBankRuleCreatedEvent({}: IBankRuleEventCreatedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: BANK_RULE_CREATED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.bankRules.onEdited)
|
||||
public handleTrackEditedBankRuleEvent({}: IBankRuleEventEditedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: BANK_RULE_EDITED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.bankRules.onDeleted)
|
||||
public handleTrackDeletedBankRuleEvent({}: IBankRuleEventDeletedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: BANK_RULE_DELETED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
import {
|
||||
BANK_TRANSACTION_MATCHED,
|
||||
BANK_TRANSACTION_EXCLUDED,
|
||||
BANK_TRANSACTION_CATEGORIZED,
|
||||
BANK_TRANSACTION_UNCATEGORIZED,
|
||||
BANK_ACCOUNT_DISCONNECTED,
|
||||
} from '../event-tracker';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { EventTrackerService } from '../EventTracker.service';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
import { events } from '@/common/events/events';
|
||||
import { IBankTransactionMatchedEventPayload } from '@/modules/BankingMatching/types';
|
||||
import { IBankTransactionExcludedEventPayload } from '@/modules/BankingTransactionsExclude/types/BankTransactionsExclude.types';
|
||||
import {
|
||||
ICashflowTransactionCategorizedPayload,
|
||||
ICashflowTransactionUncategorizedPayload,
|
||||
} from '@/modules/BankingTransactions/types/BankingTransactions.types';
|
||||
import { IBankAccountDisconnectedEventPayload } from '@/modules/BankingAccounts/types/BankAccounts.types';
|
||||
|
||||
@Injectable()
|
||||
export class BankTransactionEventsTracker {
|
||||
constructor(public readonly posthog: EventTrackerService) {}
|
||||
|
||||
@OnEvent(events.bankMatch.onMatched)
|
||||
public handleTrackBankTransactionMatchedEvent({}: IBankTransactionMatchedEventPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: BANK_TRANSACTION_MATCHED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.bankTransactions.onExcluded)
|
||||
public handleTrackBankTransactionExcludedEvent({}: IBankTransactionExcludedEventPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: BANK_TRANSACTION_EXCLUDED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.cashflow.onTransactionCategorized)
|
||||
public handleTrackBankTransactionCategorizedEvent({}: ICashflowTransactionCategorizedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: BANK_TRANSACTION_CATEGORIZED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.cashflow.onTransactionUncategorized)
|
||||
public handleTrackBankTransactionUncategorizedEvent({}: ICashflowTransactionUncategorizedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: BANK_TRANSACTION_UNCATEGORIZED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.bankAccount.onDisconnected)
|
||||
public handleTrackBankAccountDisconnectedEvent({}: IBankAccountDisconnectedEventPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: BANK_ACCOUNT_DISCONNECTED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import {
|
||||
IBillPaymentEventCreatedPayload,
|
||||
IBillPaymentEventEditedPayload,
|
||||
IBillPaymentEventDeletedPayload,
|
||||
} from '../../BillPayments/types/BillPayments.types';
|
||||
import { EventTrackerService } from '../EventTracker.service';
|
||||
import { BILL_CREATED, BILL_EDITED, BILL_DELETED } from '../event-tracker';
|
||||
import { events } from '@/common/events/events';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
|
||||
@Injectable()
|
||||
export class BillEventsTracker {
|
||||
constructor(public readonly posthog: EventTrackerService) {}
|
||||
|
||||
@OnEvent(events.bill.onCreated)
|
||||
public handleTrackBillCreatedEvent({}: IBillPaymentEventCreatedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: BILL_CREATED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.bill.onEdited)
|
||||
public handleTrackEditedBillEvent({}: IBillPaymentEventEditedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: BILL_EDITED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.bill.onDeleted)
|
||||
public handleTrackDeletedBillEvent({}: IBillPaymentEventDeletedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: BILL_DELETED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
import {
|
||||
ICustomerEventCreatedPayload,
|
||||
ICustomerEventEditedPayload,
|
||||
ICustomerEventDeletedPayload,
|
||||
} from '../../Customers/types/Customers.types';
|
||||
import { EventTrackerService } from '../EventTracker.service';
|
||||
import { events } from '@/common/events/events';
|
||||
import {
|
||||
CUSTOMER_CREATED,
|
||||
CUSTOMER_EDITED,
|
||||
CUSTOMER_DELETED,
|
||||
} from '../event-tracker';
|
||||
|
||||
@Injectable()
|
||||
export class CustomerEventsTracker {
|
||||
constructor(public readonly posthog: EventTrackerService) {}
|
||||
|
||||
@OnEvent(events.customers.onCreated)
|
||||
public handleTrackCustomerCreatedEvent({}: ICustomerEventCreatedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: CUSTOMER_CREATED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.customers.onEdited)
|
||||
public handleTrackEditedCustomerEvent({}: ICustomerEventEditedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: CUSTOMER_EDITED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.customers.onDeleted)
|
||||
public handleTrackDeletedCustomerEvent({}: ICustomerEventDeletedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: CUSTOMER_DELETED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
import {
|
||||
IExpenseCreatedPayload,
|
||||
IExpenseEventEditPayload,
|
||||
IExpenseEventDeletePayload,
|
||||
} from '../../Expenses/Expenses.types';
|
||||
import { EventTrackerService } from '../EventTracker.service';
|
||||
import { events } from '@/common/events/events';
|
||||
import {
|
||||
EXPENSE_CREATED,
|
||||
EXPENSE_EDITED,
|
||||
EXPENSE_DELETED,
|
||||
} from '../event-tracker';
|
||||
|
||||
@Injectable()
|
||||
export class ExpenseEventsTracker {
|
||||
constructor(public readonly posthog: EventTrackerService) {}
|
||||
|
||||
@OnEvent(events.expenses.onCreated)
|
||||
public handleTrackExpenseCreatedEvent({}: IExpenseCreatedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: EXPENSE_CREATED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.expenses.onEdited)
|
||||
public handleTrackEditedExpenseEvent({}: IExpenseEventEditPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: EXPENSE_EDITED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.expenses.onDeleted)
|
||||
public handleTrackDeletedExpenseEvent({}: IExpenseEventDeletePayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: EXPENSE_DELETED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
import {
|
||||
IItemEventCreatedPayload,
|
||||
IItemEventEditedPayload,
|
||||
IItemEventDeletedPayload,
|
||||
} from '@/interfaces/Item';
|
||||
import { EventTrackerService } from '../EventTracker.service';
|
||||
import { events } from '@/common/events/events';
|
||||
import {
|
||||
ITEM_EVENT_CREATED,
|
||||
ITEM_EVENT_EDITED,
|
||||
ITEM_EVENT_DELETED,
|
||||
ITEM_EVENT_VIEWED,
|
||||
} from '../event-tracker';
|
||||
|
||||
@Injectable()
|
||||
export class ItemEventsTracker {
|
||||
constructor(public readonly posthog: EventTrackerService) {}
|
||||
|
||||
@OnEvent(events.item.onCreated)
|
||||
public handleTrackItemCreatedEvent({}: IItemEventCreatedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: ITEM_EVENT_CREATED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.item.onEdited)
|
||||
public handleTrackEditedItemEvent({}: IItemEventEditedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: ITEM_EVENT_EDITED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.item.onDeleted)
|
||||
public handleTrackDeletedItemEvent({}: IItemEventDeletedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: ITEM_EVENT_DELETED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.item.onViewed)
|
||||
public handleTrackViewedItemEvent({}: IItemEventDeletedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: ITEM_EVENT_VIEWED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
import {
|
||||
IManualJournalEventCreatedPayload,
|
||||
IManualJournalEventEditedPayload,
|
||||
IManualJournalEventDeletedPayload,
|
||||
} from '../../ManualJournals/types/ManualJournals.types';
|
||||
import { EventTrackerService } from '../EventTracker.service';
|
||||
import { events } from '@/common/events/events';
|
||||
import {
|
||||
MANUAL_JOURNAL_CREATED,
|
||||
MANUAL_JOURNAL_EDITED,
|
||||
MANUAL_JOURNAL_DELETED,
|
||||
} from '../event-tracker';
|
||||
|
||||
@Injectable()
|
||||
export class ManualJournalEventsTracker {
|
||||
constructor(public readonly posthog: EventTrackerService) {}
|
||||
|
||||
@OnEvent(events.manualJournals.onCreated)
|
||||
public handleTrackManualJournalCreatedEvent(
|
||||
payload: IManualJournalEventCreatedPayload,
|
||||
) {
|
||||
this.posthog.trackEvent({
|
||||
event: MANUAL_JOURNAL_CREATED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.manualJournals.onEdited)
|
||||
public handleTrackEditedManualJournalEvent(
|
||||
payload: IManualJournalEventEditedPayload,
|
||||
) {
|
||||
this.posthog.trackEvent({
|
||||
event: MANUAL_JOURNAL_EDITED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.manualJournals.onDeleted)
|
||||
public handleTrackDeletedManualJournalEvent(
|
||||
payload: IManualJournalEventDeletedPayload,
|
||||
) {
|
||||
this.posthog.trackEvent({
|
||||
event: MANUAL_JOURNAL_DELETED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
import { EventTrackerService } from '../EventTracker.service';
|
||||
import { events } from '@/common/events/events';
|
||||
import { INVOICE_PAYMENT_LINK_GENERATED } from '../event-tracker';
|
||||
|
||||
@Injectable()
|
||||
export class PaymentLinkEventsTracker {
|
||||
constructor(public readonly posthog: EventTrackerService) {}
|
||||
|
||||
@OnEvent(events.saleInvoice.onPublicLinkGenerated)
|
||||
public handleTrackInvoicePublicLinkGeneratedEvent() {
|
||||
this.posthog.trackEvent({
|
||||
event: INVOICE_PAYMENT_LINK_GENERATED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
import {
|
||||
IBillPaymentEventCreatedPayload,
|
||||
IBillPaymentEditingPayload,
|
||||
IBillPaymentEventDeletedPayload,
|
||||
} from '../../BillPayments/types/BillPayments.types';
|
||||
import { EventTrackerService } from '../EventTracker.service';
|
||||
import { events } from '@/common/events/events';
|
||||
import {
|
||||
PAYMENT_MADE_CREATED,
|
||||
PAYMENT_MADE_EDITED,
|
||||
PAYMENT_MADE_DELETED,
|
||||
} from '../event-tracker';
|
||||
|
||||
@Injectable()
|
||||
export class PaymentMadeEventsTracker {
|
||||
constructor(public readonly posthog: EventTrackerService) {}
|
||||
|
||||
@OnEvent(events.billPayment.onCreated)
|
||||
public handleTrackPaymentMadeCreatedEvent({}: IBillPaymentEventCreatedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: PAYMENT_MADE_CREATED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.billPayment.onEdited)
|
||||
public handleTrackEditedPaymentMadeEvent({}: IBillPaymentEditingPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: PAYMENT_MADE_EDITED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.billPayment.onDeleted)
|
||||
public handleTrackDeletedPaymentMadeEvent({}: IBillPaymentEventDeletedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: PAYMENT_MADE_DELETED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
import { EventTrackerService } from '../EventTracker.service';
|
||||
import { events } from '@/common/events/events';
|
||||
import {
|
||||
PAYMENT_METHOD_EDITED,
|
||||
PAYMENT_METHOD_DELETED,
|
||||
} from '../event-tracker';
|
||||
|
||||
@Injectable()
|
||||
export class PaymentMethodEventsTracker {
|
||||
constructor(public readonly posthog: EventTrackerService) {}
|
||||
|
||||
@OnEvent(events.paymentMethod.onEdited)
|
||||
public handleTrackPaymentMethodEditedEvent({}) {
|
||||
this.posthog.trackEvent({
|
||||
event: PAYMENT_METHOD_EDITED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.paymentMethod.onDeleted)
|
||||
public handleTrackPaymentMethodDeletedEvent({}) {
|
||||
this.posthog.trackEvent({
|
||||
event: PAYMENT_METHOD_DELETED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
import {
|
||||
IPaymentReceivedCreatedPayload,
|
||||
IPaymentReceivedEditedPayload,
|
||||
IPaymentReceivedDeletedPayload,
|
||||
} from '../../PaymentReceived/types/PaymentReceived.types';
|
||||
import { EventTrackerService } from '../EventTracker.service';
|
||||
import { events } from '@/common/events/events';
|
||||
import {
|
||||
PAYMENT_RECEIVED_CREATED,
|
||||
PAYMENT_RECEIVED_EDITED,
|
||||
PAYMENT_RECEIVED_DELETED,
|
||||
PAYMENT_RECEIVED_PDF_VIEWED,
|
||||
PAYMENT_RECEIVED_MAIL_SENT,
|
||||
} from '../event-tracker';
|
||||
|
||||
@Injectable()
|
||||
export class PaymentReceivedEventsTracker {
|
||||
constructor(public readonly posthog: EventTrackerService) {}
|
||||
|
||||
@OnEvent(events.paymentReceive.onCreated)
|
||||
public handleTrackPaymentReceivedCreatedEvent({}: IPaymentReceivedCreatedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: PAYMENT_RECEIVED_CREATED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.paymentReceive.onEdited)
|
||||
public handleTrackEditedPaymentReceivedEvent({}: IPaymentReceivedEditedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: PAYMENT_RECEIVED_EDITED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.paymentReceive.onDeleted)
|
||||
public handleTrackDeletedPaymentReceivedEvent({}: IPaymentReceivedDeletedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: PAYMENT_RECEIVED_DELETED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.paymentReceive.onPdfViewed)
|
||||
public handleTrackPdfViewedPaymentReceivedEvent({}: IPaymentReceivedDeletedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: PAYMENT_RECEIVED_PDF_VIEWED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.paymentReceive.onMailSent)
|
||||
public handleTrackMailSentPaymentReceivedEvent({}: IPaymentReceivedDeletedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: PAYMENT_RECEIVED_MAIL_SENT,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
import {
|
||||
PDF_TEMPLATE_CREATED,
|
||||
PDF_TEMPLATE_EDITED,
|
||||
PDF_TEMPLATE_DELETED,
|
||||
PDF_TEMPLATE_ASSIGNED_DEFAULT,
|
||||
} from '../event-tracker';
|
||||
import { EventTrackerService } from '../EventTracker.service';
|
||||
import { events } from '@/common/events/events';
|
||||
|
||||
@Injectable()
|
||||
export class PdfTemplateEventsTracker {
|
||||
constructor(public readonly posthog: EventTrackerService) {}
|
||||
|
||||
@OnEvent(events.pdfTemplate.onCreated)
|
||||
public handleTrackPdfTemplateCreatedEvent({}) {
|
||||
this.posthog.trackEvent({
|
||||
event: PDF_TEMPLATE_CREATED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.pdfTemplate.onEdited)
|
||||
public handleTrackEditedPdfTemplateEvent({}) {
|
||||
this.posthog.trackEvent({
|
||||
event: PDF_TEMPLATE_EDITED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.pdfTemplate.onDeleted)
|
||||
public handleTrackDeletedPdfTemplateEvent({}) {
|
||||
this.posthog.trackEvent({
|
||||
event: PDF_TEMPLATE_DELETED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.pdfTemplate.onAssignedDefault)
|
||||
public handleTrackAssignedAsDefaultPdfTemplateEvent({}) {
|
||||
this.posthog.trackEvent({
|
||||
event: PDF_TEMPLATE_ASSIGNED_DEFAULT,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import { EventSubscriber } from '@/lib/EventPublisher/EventPublisher';
|
||||
// import { ReportsEvents } from '@/constants/event-tracker';
|
||||
// import { PosthogService } from '../EventTracker.service';
|
||||
// import events from '@/subscribers/events';
|
||||
// import {
|
||||
// BALANCE_SHEET_VIEWED,
|
||||
// TRIAL_BALANCE_SHEET_VIEWED,
|
||||
// PROFIT_LOSS_SHEET_VIEWED,
|
||||
// CASHFLOW_STATEMENT_VIEWED,
|
||||
// GENERAL_LEDGER_VIEWED,
|
||||
// JOURNAL_VIEWED,
|
||||
// RECEIVABLE_AGING_VIEWED,
|
||||
// PAYABLE_AGING_VIEWED,
|
||||
// CUSTOMER_BALANCE_SUMMARY_VIEWED,
|
||||
// VENDOR_BALANCE_SUMMARY_VIEWED,
|
||||
// INVENTORY_VALUATION_VIEWED,
|
||||
// CUSTOMER_TRANSACTIONS_VIEWED,
|
||||
// VENDOR_TRANSACTIONS_VIEWED,
|
||||
// SALES_BY_ITEM_VIEWED,
|
||||
// PURCHASES_BY_ITEM_VIEWED,
|
||||
// } from '@/constants/event-tracker';
|
||||
|
||||
// @Service()
|
||||
// export class ReportsEventsTracker extends EventSubscriber {
|
||||
// @Inject()
|
||||
// private posthog: PosthogService;
|
||||
|
||||
// /**
|
||||
// * Constructor method.
|
||||
// */
|
||||
// public attach(bus) {
|
||||
// bus.subscribe(
|
||||
// events.reports.onBalanceSheetViewed,
|
||||
// this.handleTrackBalanceSheetViewedEvent
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.reports.onTrialBalanceSheetView,
|
||||
// this.handleTrackTrialBalanceSheetViewedEvent
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.reports.onProfitLossSheetViewed,
|
||||
// this.handleTrackProfitLossSheetViewedEvent
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.reports.onCashflowStatementViewed,
|
||||
// this.handleTrackCashflowStatementViewedEvent
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.reports.onGeneralLedgerViewed,
|
||||
// this.handleTrackGeneralLedgerViewedEvent
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.reports.onJournalViewed,
|
||||
// this.handleTrackJournalViewedEvent
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.reports.onReceivableAgingViewed,
|
||||
// this.handleTrackReceivableAgingViewedEvent
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.reports.onPayableAgingViewed,
|
||||
// this.handleTrackPayableAgingViewedEvent
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.reports.onCustomerBalanceSummaryViewed,
|
||||
// this.handleTrackCustomerBalanceSummaryViewedEvent
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.reports.onVendorBalanceSummaryViewed,
|
||||
// this.handleTrackVendorBalanceSummaryViewedEvent
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.reports.onInventoryValuationViewed,
|
||||
// this.handleTrackInventoryValuationViewedEvent
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.reports.onCustomerTransactionsViewed,
|
||||
// this.handleTrackCustomerTransactionsViewedEvent
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.reports.onVendorTransactionsViewed,
|
||||
// this.handleTrackVendorTransactionsViewedEvent
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.reports.onSalesByItemViewed,
|
||||
// this.handleTrackSalesByItemViewedEvent
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.reports.onPurchasesByItemViewed,
|
||||
// this.handleTrackPurchasesByItemViewedEvent
|
||||
// );
|
||||
// }
|
||||
|
||||
// private handleTrackBalanceSheetViewedEvent(
|
||||
// { tenantId }: ReportsEvents
|
||||
// ) {
|
||||
// this.posthog.trackEvent({
|
||||
// distinctId: `tenant-${tenantId}`,
|
||||
// event: BALANCE_SHEET_VIEWED,
|
||||
// properties: {},
|
||||
// });
|
||||
// }
|
||||
|
||||
// private handleTrackTrialBalanceSheetViewedEvent(
|
||||
// { tenantId }: ReportsEvents
|
||||
// ) {
|
||||
// this.posthog.trackEvent({
|
||||
// distinctId: `tenant-${tenantId}`,
|
||||
// event: TRIAL_BALANCE_SHEET_VIEWED,
|
||||
// properties: {},
|
||||
// });
|
||||
// }
|
||||
|
||||
// private handleTrackProfitLossSheetViewedEvent(
|
||||
// { tenantId }: ReportsEvents
|
||||
// ) {
|
||||
// this.posthog.trackEvent({
|
||||
// distinctId: `tenant-${tenantId}`,
|
||||
// event: PROFIT_LOSS_SHEET_VIEWED,
|
||||
// properties: {},
|
||||
// });
|
||||
// }
|
||||
|
||||
// private handleTrackCashflowStatementViewedEvent(
|
||||
// { tenantId }: ReportsEvents
|
||||
// ) {
|
||||
// this.posthog.trackEvent({
|
||||
// distinctId: `tenant-${tenantId}`,
|
||||
// event: CASHFLOW_STATEMENT_VIEWED,
|
||||
// properties: {},
|
||||
// });
|
||||
// }
|
||||
|
||||
// private handleTrackGeneralLedgerViewedEvent(
|
||||
// { tenantId }: ReportsEvents
|
||||
// ) {
|
||||
// this.posthog.trackEvent({
|
||||
// distinctId: `tenant-${tenantId}`,
|
||||
// event: GENERAL_LEDGER_VIEWED,
|
||||
// properties: {},
|
||||
// });
|
||||
// }
|
||||
|
||||
// private handleTrackJournalViewedEvent({ tenantId }: ReportsEvents) {
|
||||
// this.posthog.trackEvent({
|
||||
// distinctId: `tenant-${tenantId}`,
|
||||
// event: JOURNAL_VIEWED,
|
||||
// properties: {},
|
||||
// });
|
||||
// }
|
||||
|
||||
// private handleTrackReceivableAgingViewedEvent(
|
||||
// { tenantId }: ReportsEvents
|
||||
// ) {
|
||||
// this.posthog.trackEvent({
|
||||
// distinctId: `tenant-${tenantId}`,
|
||||
// event: RECEIVABLE_AGING_VIEWED,
|
||||
// properties: {},
|
||||
// });
|
||||
// }
|
||||
|
||||
// private handleTrackPayableAgingViewedEvent(
|
||||
// { tenantId }: ReportsEvents
|
||||
// ) {
|
||||
// this.posthog.trackEvent({
|
||||
// distinctId: `tenant-${tenantId}`,
|
||||
// event: PAYABLE_AGING_VIEWED,
|
||||
// properties: {},
|
||||
// });
|
||||
// }
|
||||
|
||||
// private handleTrackCustomerBalanceSummaryViewedEvent(
|
||||
// { tenantId }: ReportsEvents
|
||||
// ) {
|
||||
// this.posthog.trackEvent({
|
||||
// distinctId: `tenant-${tenantId}`,
|
||||
// event: CUSTOMER_BALANCE_SUMMARY_VIEWED,
|
||||
// properties: {},
|
||||
// });
|
||||
// }
|
||||
|
||||
// private handleTrackVendorBalanceSummaryViewedEvent(
|
||||
// { tenantId }: ReportsEvents
|
||||
// ) {
|
||||
// this.posthog.trackEvent({
|
||||
// distinctId: `tenant-${tenantId}`,
|
||||
// event: VENDOR_BALANCE_SUMMARY_VIEWED,
|
||||
// properties: {},
|
||||
// });
|
||||
// }
|
||||
|
||||
// private handleTrackInventoryValuationViewedEvent(
|
||||
// { tenantId }: ReportsEvents
|
||||
// ) {
|
||||
// this.posthog.trackEvent({
|
||||
// distinctId: `tenant-${tenantId}`,
|
||||
// event: INVENTORY_VALUATION_VIEWED,
|
||||
// properties: {},
|
||||
// });
|
||||
// }
|
||||
|
||||
// private handleTrackCustomerTransactionsViewedEvent(
|
||||
// { tenantId }: ReportsEvents
|
||||
// ) {
|
||||
// this.posthog.trackEvent({
|
||||
// distinctId: `tenant-${tenantId}`,
|
||||
// event: CUSTOMER_TRANSACTIONS_VIEWED,
|
||||
// properties: {},
|
||||
// });
|
||||
// }
|
||||
|
||||
// private handleTrackVendorTransactionsViewedEvent(
|
||||
// { tenantId }: ReportsEvents
|
||||
// ) {
|
||||
// this.posthog.trackEvent({
|
||||
// distinctId: `tenant-${tenantId}`,
|
||||
// event: VENDOR_TRANSACTIONS_VIEWED,
|
||||
// properties: {},
|
||||
// });
|
||||
// }
|
||||
|
||||
// private handleTrackSalesByItemViewedEvent({ tenantId }: ReportsEvents) {
|
||||
// this.posthog.trackEvent({
|
||||
// distinctId: `tenant-${tenantId}`,
|
||||
// event: SALES_BY_ITEM_VIEWED,
|
||||
// properties: {},
|
||||
// });
|
||||
// }
|
||||
|
||||
// private handleTrackPurchasesByItemViewedEvent(
|
||||
// { tenantId }: ReportsEvents
|
||||
// ) {
|
||||
// this.posthog.trackEvent({
|
||||
// distinctId: `tenant-${tenantId}`,
|
||||
// event: PURCHASES_BY_ITEM_VIEWED,
|
||||
// properties: {},
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,70 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
import {
|
||||
ISaleEstimateCreatedPayload,
|
||||
ISaleEstimateEditedPayload,
|
||||
ISaleEstimateDeletedPayload,
|
||||
} from '../../SaleEstimates/types/SaleEstimates.types';
|
||||
import { EventTrackerService } from '../EventTracker.service';
|
||||
import {
|
||||
SALE_ESTIMATE_CREATED,
|
||||
SALE_ESTIMATE_EDITED,
|
||||
SALE_ESTIMATE_DELETED,
|
||||
SALE_ESTIMATE_PDF_VIEWED,
|
||||
SALE_ESTIMATE_VIEWED,
|
||||
SALE_ESTIMATE_MAIL_SENT,
|
||||
} from '../event-tracker';
|
||||
import { events } from '@/common/events/events';
|
||||
|
||||
@Injectable()
|
||||
export class SaleEstimateEventsTracker {
|
||||
constructor(public readonly posthog: EventTrackerService) {}
|
||||
|
||||
@OnEvent(events.saleEstimate.onCreated)
|
||||
public handleTrackEstimateCreatedEvent({}: ISaleEstimateCreatedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: SALE_ESTIMATE_CREATED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.saleEstimate.onEdited)
|
||||
public handleTrackEditedEstimateEvent({}: ISaleEstimateEditedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: SALE_ESTIMATE_EDITED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.saleEstimate.onDeleted)
|
||||
public handleTrackDeletedEstimateEvent({}: ISaleEstimateDeletedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: SALE_ESTIMATE_DELETED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.saleEstimate.onPdfViewed)
|
||||
public handleTrackPdfViewedEstimateEvent({}: ISaleEstimateDeletedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: SALE_ESTIMATE_PDF_VIEWED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.saleEstimate.onViewed)
|
||||
public handleTrackViewedEstimateEvent({}) {
|
||||
this.posthog.trackEvent({
|
||||
event: SALE_ESTIMATE_VIEWED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.saleEstimate.onMailSent)
|
||||
public handleTrackMailSentEstimateEvent({}) {
|
||||
this.posthog.trackEvent({
|
||||
event: SALE_ESTIMATE_MAIL_SENT,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
import {
|
||||
ISaleInvoiceCreatedPayload,
|
||||
ISaleInvoiceEditedPayload,
|
||||
} from '../../SaleInvoices/SaleInvoice.types';
|
||||
import { EventTrackerService } from '../EventTracker.service';
|
||||
import { events } from '@/common/events/events';
|
||||
import {
|
||||
SALE_INVOICE_CREATED,
|
||||
SALE_INVOICE_DELETED,
|
||||
SALE_INVOICE_EDITED,
|
||||
SALE_INVOICE_MAIL_SENT,
|
||||
SALE_INVOICE_PDF_VIEWED,
|
||||
SALE_INVOICE_VIEWED,
|
||||
} from '../event-tracker';
|
||||
|
||||
@Injectable()
|
||||
export class SaleInvoiceEventsTracker {
|
||||
constructor(public readonly posthog: EventTrackerService) {}
|
||||
|
||||
@OnEvent(events.saleInvoice.onCreated)
|
||||
public handleTrackInvoiceCreatedEvent({}: ISaleInvoiceCreatedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: SALE_INVOICE_CREATED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.saleInvoice.onEdited)
|
||||
public handleTrackEditedInvoiceEvent({}: ISaleInvoiceEditedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: SALE_INVOICE_EDITED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.saleInvoice.onDeleted)
|
||||
public handleTrackDeletedInvoiceEvent({}: ISaleInvoiceEditedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: SALE_INVOICE_DELETED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.saleInvoice.onViewed)
|
||||
public handleTrackViewedInvoiceEvent({}) {
|
||||
this.posthog.trackEvent({
|
||||
event: SALE_INVOICE_VIEWED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.saleInvoice.onPdfViewed)
|
||||
public handleTrackPdfViewedInvoiceEvent({}) {
|
||||
this.posthog.trackEvent({
|
||||
event: SALE_INVOICE_PDF_VIEWED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.saleInvoice.onMailSent)
|
||||
public handleTrackMailSentInvoiceEvent({}) {
|
||||
this.posthog.trackEvent({
|
||||
event: SALE_INVOICE_MAIL_SENT,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { events } from '@/common/events/events';
|
||||
import { ISaleInvoiceCreatedPayload } from '@/modules/SaleInvoices/SaleInvoice.types';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
import { STRIPE_INTEGRAION_CONNECTED } from '../event-tracker';
|
||||
import { EventTrackerService } from '../EventTracker.service';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
export class StripeIntegrationEventsTracker {
|
||||
constructor(private readonly posthog: EventTrackerService) {}
|
||||
|
||||
@OnEvent(events.stripeIntegration.onOAuthCodeGranted)
|
||||
public handleTrackOAuthCodeGrantedTrackEvent({}: ISaleInvoiceCreatedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: STRIPE_INTEGRAION_CONNECTED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
import { ITransactionsLockingPartialUnlocked } from '../../TransactionsLocking/types/TransactionsLocking.types';
|
||||
import { EventTrackerService } from '../EventTracker.service';
|
||||
import {
|
||||
TRANSACTIONS_LOCKING_LOCKED,
|
||||
TRANSACTIONS_LOCKING_LOCKING_CANCELLED,
|
||||
TRANSACTIONS_LOCKING_PARTIALLY_UNLOCK_CANCELLED,
|
||||
TRANSACTIONS_LOCKING_PARTIALLY_UNLOCKED,
|
||||
} from '../event-tracker';
|
||||
import { events } from '@/common/events/events';
|
||||
|
||||
@Injectable()
|
||||
export class TransactionsLockingEventsTracker {
|
||||
constructor(public readonly posthog: EventTrackerService) {}
|
||||
|
||||
@OnEvent(events.transactionsLocking.locked)
|
||||
public handleTransactionsLockingLockedEvent({}: ITransactionsLockingPartialUnlocked) {
|
||||
this.posthog.trackEvent({
|
||||
event: TRANSACTIONS_LOCKING_LOCKED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.transactionsLocking.lockCanceled)
|
||||
public handleTransactionsLockingCancelledEvent({}: ITransactionsLockingPartialUnlocked) {
|
||||
this.posthog.trackEvent({
|
||||
event: TRANSACTIONS_LOCKING_LOCKING_CANCELLED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.transactionsLocking.partialUnlocked)
|
||||
public handleTransactionsLockingPartiallyUnlockedEvent({}: ITransactionsLockingPartialUnlocked) {
|
||||
this.posthog.trackEvent({
|
||||
event: TRANSACTIONS_LOCKING_PARTIALLY_UNLOCKED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.transactionsLocking.partialUnlockCanceled)
|
||||
public handleTransactionsLockingPartiallyUnlockCancelledEvent({}: ITransactionsLockingPartialUnlocked) {
|
||||
this.posthog.trackEvent({
|
||||
event: TRANSACTIONS_LOCKING_PARTIALLY_UNLOCK_CANCELLED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
import { ITransactionsLockingPartialUnlocked } from '@/interfaces';
|
||||
import {
|
||||
SUBSCRIPTION_CANCELLED,
|
||||
SUBSCRIPTION_PAYMENT_FAILED,
|
||||
SUBSCRIPTION_PAYMENT_SUCCEED,
|
||||
SUBSCRIPTION_PLAN_CHANGED,
|
||||
SUBSCRIPTION_RESUMED,
|
||||
} from '../event-tracker';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { EventTrackerService } from '../EventTracker.service';
|
||||
|
||||
import { events } from '@/common/events/events';
|
||||
@Injectable()
|
||||
export class TransactionsLockingEventsTracker {
|
||||
constructor(public readonly posthog: EventTrackerService) {}
|
||||
|
||||
@OnEvent(events.subscription.onSubscriptionResumed)
|
||||
public handleSubscriptionResumedEvent() {
|
||||
this.posthog.trackEvent({
|
||||
event: SUBSCRIPTION_RESUMED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.subscription.onSubscriptionCancelled)
|
||||
public handleSubscriptionCancelledEvent() {
|
||||
this.posthog.trackEvent({
|
||||
event: SUBSCRIPTION_CANCELLED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.subscription.onSubscriptionPlanChanged)
|
||||
public handleSubscriptionPlanChangedEvent() {
|
||||
this.posthog.trackEvent({
|
||||
event: SUBSCRIPTION_PLAN_CHANGED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.subscription.onSubscriptionPaymentFailed)
|
||||
public handleSubscriptionPaymentFailedEvent() {
|
||||
this.posthog.trackEvent({
|
||||
event: SUBSCRIPTION_PAYMENT_FAILED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.subscription.onSubscriptionPaymentSucceed)
|
||||
public handleSubscriptionPaymentSucceed() {
|
||||
this.posthog.trackEvent({
|
||||
event: SUBSCRIPTION_PAYMENT_SUCCEED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import {
|
||||
IVendorEventCreatedPayload,
|
||||
IVendorEventEditedPayload,
|
||||
IVendorEventDeletedPayload,
|
||||
} from '../../Vendors/types/Vendors.types';
|
||||
import { EventTrackerService } from '../EventTracker.service';
|
||||
import { events } from '@/common/events/events';
|
||||
import {
|
||||
VENDOR_CREATED,
|
||||
VENDOR_EDITED,
|
||||
VENDOR_DELETED,
|
||||
} from '../event-tracker';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
|
||||
@Injectable()
|
||||
export class VendorEventsTracker {
|
||||
constructor(public readonly posthog: EventTrackerService) {}
|
||||
|
||||
@OnEvent(events.vendors.onCreated)
|
||||
public handleTrackVendorCreatedEvent({}: IVendorEventCreatedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: VENDOR_CREATED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.vendors.onEdited)
|
||||
public handleTrackEditedVendorEvent({}: IVendorEventEditedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: VENDOR_EDITED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(events.vendors.onDeleted)
|
||||
public handleTrackDeletedVendorEvent({}: IVendorEventDeletedPayload) {
|
||||
this.posthog.trackEvent({
|
||||
event: VENDOR_DELETED,
|
||||
properties: {},
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user