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

141 lines
3.7 KiB
TypeScript

// Metro module 9235 (f9236).
import AuthenticationStore from "../../stores/AuthenticationStore";
import { PHONE_VERIFICATION_MODAL_KEY } from "./PhoneConstants";
import { Endpoints } from "../../Constants";
import Dispatcher from "../../Dispatcher";
import { HTTP, rejectWithMigratedError } from "../../_bundle/sendRequest";
import TrackedHTTPUtils from "../../utils/TrackedHTTPUtils";
import { NetworkActionNames } from "../../_bundle/Module503";
const r22 = {
USER_ACTION_REQUIRED: "user_action_required",
USER_SETTINGS_UPDATE: "user_settings_update",
GUILD_PHONE_REQUIRED: "guild_phone_required",
MFA_PHONE_UPDATE: "mfa_phone_update",
CONTACT_SYNC: "contact_sync"
};
const r29 = {
setCountryCode: (a0) => {
Dispatcher.dispatch({
type: "PHONE_SET_COUNTRY_CODE",
countryCode: a0
});
},
removePhone: (a0, a1) => HTTP.del({
url: Endpoints.PHONE,
body: {
password: a0,
change_phone_reason: a1
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}),
resendCode: (a0) => {
const fingerprint = AuthenticationStore.getFingerprint();
const r11 = fingerprint != null && fingerprint !== "";
const headers = {};
if (r11) {
headers["X-Fingerprint"] = fingerprint;
}
return HTTP.post({
url: Endpoints.RESEND_PHONE,
headers,
body: {
phone: a0
},
rejectWithError: rejectWithMigratedError()
});
},
beginAddPhone: (a0, a1) => HTTP.post({
url: Endpoints.PHONE,
body: {
phone: a0,
change_phone_reason: a1
},
rejectWithError: rejectWithMigratedError()
}),
addPhone: (a0, a1, a2) => HTTP.post({
url: Endpoints.PHONE,
body: {
phone_token: a0,
password: a1,
change_phone_reason: a2
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}),
addPhoneWithoutPassword: (a0) => HTTP.post({
url: Endpoints.PHONE_VERIFY_NO_PASSWORD,
body: {
code: a0
},
rejectWithError: rejectWithMigratedError()
}),
beginReverifyPhone: (a0, a1) => HTTP.post({
url: Endpoints.PHONE_REVERIFY,
body: {
phone: a0,
change_phone_reason: a1
},
rejectWithError: rejectWithMigratedError()
}),
reverifyPhone: (a0, a1, a2) => HTTP.post({
url: Endpoints.PHONE_REVERIFY,
body: {
phone_token: a0,
password: a1,
change_phone_reason: a2
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}),
validatePhoneForSupport: (a0) => HTTP.post({
url: Endpoints.VERIFY_PHONE_FOR_TICKET,
body: {
token: a0
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}),
verifyPhone: async function verifyPhone(phone, code, r6 = true) {
let c17082_2 = r6;
let r4 = arguments[3];
if (r4 === void 0) {
r4 = false;
}
let c17082_3 = r4;
let c26400_1;
c26400_1 = void 0;
const fingerprint = AuthenticationStore.getFingerprint();
const r36 = fingerprint != null && fingerprint !== "";
const headers = {};
if (r36) {
headers["X-Fingerprint"] = fingerprint;
}
if (c17082_3) {
headers.authorization = "";
}
let c30069_0 = await TrackedHTTPUtils.post({
url: Endpoints.VERIFY_PHONE,
headers,
body: {
phone,
code
},
oldFormErrors: true,
trackedActionData: {
event: NetworkActionNames.USER_VERIFY_PHONE
},
rejectWithError: rejectWithMigratedError()
});
if (c17082_2) {
Dispatcher.dispatch({
type: "MODAL_POP",
key: PHONE_VERIFICATION_MODAL_KEY
});
}
return c30069_0.body;
}
};
export default r29;
export { r22 as ChangePhoneReason };