import ProductInsightsSDK from "../core/base"; import MetricModule from "./metric"; import { Events, RecordFeedBackPayload, EntityType } from "../types"; class Features { private metric: MetricModule; constructor(private sdk: ProductInsightsSDK) { this.metric = new MetricModule(this.sdk, EntityType.FEATURE); } async getAll() { await this.sdk.sendEvent(Events.FETCH_FEATURES, {}); } async recordFeedback(payload: RecordFeedBackPayload) { await this.sdk.sendEvent(Events.RECORD_FEEDBACK, payload); } async initMetric(entityDocumentId: string) { this.metric.initMetric({ entityDocumentId, }); } async setHasCompleted(entityDocumentId: string) { this.metric.complete(entityDocumentId); } async setHasCanceled(entityDocumentId: string) { this.metric.cancel(entityDocumentId); } } export default Features;