UNPKG

@snap/camera-kit

Version:
21 lines 1.08 kB
import { forActions } from "@snap/state-management"; import { filter } from "rxjs"; import { Injectable } from "@snap/ts-inject"; import { TypedCustomEvent } from "../../events/TypedCustomEvent"; import { lensStateFactory } from "../../session/lensState"; import { metricsEventTargetFactory } from "../metricsEventTarget"; export const reportLensValidationFailed = Injectable("reportLensValidationFailed", [lensStateFactory.token, metricsEventTargetFactory.token], (lensState, metricsEventTarget) => { lensState.events .pipe(forActions("applyLensFailed"), filter(([a]) => a.data.error.name === "LensContentValidationError")) .subscribe({ next: ([{ data }]) => { const { lens } = data; const lensContentValidationFailed = { name: "lensContentValidationFailed", lensId: lens.id, }; metricsEventTarget.dispatchEvent(new TypedCustomEvent("lensContentValidationFailed", lensContentValidationFailed)); }, }); }); //# sourceMappingURL=reportLensValidationFailed.js.map