51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
// Metro module 14874 (f14875).
|
|
import { AgeGateAnalyticAction } from "./AgeGateConstants";
|
|
import { AnalyticEvents, Endpoints } from "../../Constants";
|
|
import trackAgeGateSubmitted from "../auth/experiment/trackAgeGateSubmitted";
|
|
import AnalyticsUtils from "../../utils/AnalyticsUtils";
|
|
import { HTTP } from "../../_bundle/sendRequest";
|
|
import Dispatcher from "../../Dispatcher";
|
|
export function submitDateOfBirth(a0, a1) {
|
|
const source = a1;
|
|
trackAgeGateSubmitted(a0, a1);
|
|
AnalyticsUtils.track(AnalyticEvents.AGE_GATE_ACTION, {
|
|
source: a1,
|
|
action: AgeGateAnalyticAction.AGE_GATE_SUBMITTED
|
|
});
|
|
return HTTP.patch({
|
|
url: Endpoints.ME,
|
|
oldFormErrors: true,
|
|
body: {
|
|
date_of_birth: a0.format("YYYY-MM-DD")
|
|
},
|
|
rejectWithError: false
|
|
}).then((result) => {
|
|
Dispatcher.dispatch({
|
|
type: "CURRENT_USER_UPDATE",
|
|
user: result.body
|
|
});
|
|
AnalyticsUtils.track(AnalyticEvents.AGE_GATE_ACTION, {
|
|
source,
|
|
action: AgeGateAnalyticAction.AGE_GATE_SUCCESS
|
|
});
|
|
});
|
|
}
|
|
export function preventUnderageRegistration(a0) {
|
|
Dispatcher.dispatch({
|
|
type: "AGE_GATE_PREVENT_UNDERAGE_REGISTRATION"
|
|
});
|
|
AnalyticsUtils.track(AnalyticEvents.AGE_GATE_ACTION, {
|
|
source: a0,
|
|
action: AgeGateAnalyticAction.AGE_GATE_PREVENT_UNDERAGE_REGISTRATION
|
|
});
|
|
}
|
|
export function logoutUnderageNewUser(a0) {
|
|
Dispatcher.dispatch({
|
|
type: "AGE_GATE_LOGOUT_UNDERAGE_NEW_USER"
|
|
});
|
|
AnalyticsUtils.track(AnalyticEvents.AGE_GATE_ACTION, {
|
|
source: a0,
|
|
action: AgeGateAnalyticAction.AGE_GATE_LOGOUT_UNDERAGE_NEW_USER
|
|
});
|
|
}
|