27 lines
1.6 KiB
TypeScript
27 lines
1.6 KiB
TypeScript
// Metro module 11089 (f11090).
|
|
import { useCallback } from "react";
|
|
import SafetyHubStore from "../SafetyHubStore";
|
|
import { SafetyHubAnalyticsActionSource } from "../SafetyHubConstants";
|
|
import { AnalyticEvents, EMPTY_STRING_SNOWFLAKE_ID } from "../../../Constants";
|
|
import { useStateFromStores } from "../../../_bundle/Module589";
|
|
import { useSafetyHubClassification } from "./useSafetyHubClassifications";
|
|
import { useSafetyHubAccountStanding } from "./useSafetyHubAccountStanding";
|
|
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
|
|
export function useEmitAppealIngestionEvent() {
|
|
let safetyHubClassification, safetyHubAccountStanding, stateFromStores2;
|
|
const stateFromStores = useStateFromStores([SafetyHubStore], () => SafetyHubStore.getAppealClassificationId());
|
|
safetyHubClassification = useSafetyHubClassification(stateFromStores == null ? EMPTY_STRING_SNOWFLAKE_ID : stateFromStores);
|
|
safetyHubAccountStanding = useSafetyHubAccountStanding();
|
|
stateFromStores2 = useStateFromStores([SafetyHubStore], () => SafetyHubStore.getIsDsaEligible());
|
|
return useCallback((a0) => {
|
|
AnalyticsUtils.track(AnalyticEvents.SAFETY_HUB_ACTION, {
|
|
action: a0,
|
|
account_standing: safetyHubAccountStanding.state,
|
|
classification_ids: stateFromStores != null ? [Number(stateFromStores)] : null,
|
|
source: SafetyHubAnalyticsActionSource.AppealIngestion,
|
|
is_dsa_eligible: stateFromStores2,
|
|
violation_type: safetyHubClassification.violationType
|
|
});
|
|
}, [safetyHubAccountStanding.state, stateFromStores, safetyHubClassification, stateFromStores2]);
|
|
}
|