Files
discord-decomp/modules/captcha/SharedCaptchaUtils.tsx
T
2026-11-01 12:12:55 +02:00

39 lines
1.2 KiB
TypeScript

// Metro module 9470 (f9471).
import { flushCaptchaServeVolume, incrementCaptchaServeVolume, isCaptchaStoreVolumeEmpty } from "./CaptchaStore";
import { CAPTCHA_SERVE_VOLUME_DISTRIBUTION_AGGREGATION_WINDOW_MS } from "./CaptchaConstants";
const r19 = {
CANCEL: "cancel",
ERROR: "error",
EXPIRED: "expired"
};
class CaptchaCancelError extends Error {
constructor() {
super("Captcha cancelled");
}
}
export { r19 as CaptchaError };
export function extractCaptchaPropsFromResponse(a0) {
let should_serve_invisible = a0.should_serve_invisible;
if (should_serve_invisible == null) {
should_serve_invisible = false;
}
return {
captchaService: a0.captcha_service,
sitekey: a0.captcha_sitekey,
captchaSessionId: a0.captcha_session_id,
options: {
rqdata: a0.captcha_rqdata,
rqtoken: a0.captcha_rqtoken,
serveInvisible: should_serve_invisible,
userflow: a0.user_flow
}
};
}
export function emitCaptchaDistributionMetric(a0) {
if (isCaptchaStoreVolumeEmpty()) {
setTimeout(() => flushCaptchaServeVolume(), CAPTCHA_SERVE_VOLUME_DISTRIBUTION_AGGREGATION_WINDOW_MS);
}
incrementCaptchaServeVolume(a0);
}
export { CaptchaCancelError };