decord/source/modules/phone/PhoneActionCreators.tsx

110 lines
4.5 KiB
TypeScript
Raw Normal View History

// Module ID: 7148
// Function ID: 7149
// Name: PhoneActionCreators
// Dependencies: [5, 502, 7146, 1074, 573, 1272, 4829, 1250, 2]
2026-07-20 16:05:17 +00:00
// Module 7148 (PhoneActionCreators)
import DispatcherDefault from "Dispatcher" /* 573 */;
import HTTPUtils from "HTTPUtils" /* 1272 */;
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
import AuthenticationStore from "AuthenticationStore" /* 502 */;
2026-07-23 10:11:24 +00:00
require = fn;
let closure_5 = fn(7146).PHONE_VERIFICATION_MODAL_KEY;
const Endpoints = fn(1074).Endpoints;
const size = fn(2);
const result = size.fileFinishedImporting("modules/phone/PhoneActionCreators.tsx");
2026-07-20 16:05:17 +00:00
export default {
setCountryCode(countryCode) {
DispatcherDefault.dispatch({ type: "PHONE_SET_COUNTRY_CODE", countryCode });
2026-07-20 16:05:17 +00:00
},
removePhone(password, reason) {
const HTTP = HTTPUtils.HTTP;
const request = { url: Endpoints.PHONE, body: { password, change_phone_reason: reason }, oldFormErrors: true, rejectWithError: HTTPUtils.rejectWithMigratedError() };
return HTTP.del(request);
2026-07-20 16:05:17 +00:00
},
resendCode(phone) {
const fingerprint = AuthenticationStore.getFingerprint();
2026-07-20 16:05:17 +00:00
let tmp2 = null != fingerprint;
if (tmp2) {
tmp2 = "" !== fingerprint;
}
const obj = {};
2026-07-20 16:05:17 +00:00
if (tmp2) {
2026-07-23 10:11:24 +00:00
obj["X-Fingerprint"] = fingerprint;
2026-07-20 16:05:17 +00:00
}
const HTTP = HTTPUtils.HTTP;
const request = { url: Endpoints.RESEND_PHONE, headers: obj, body: { phone }, rejectWithError: HTTPUtils.rejectWithMigratedError() };
return HTTP.post(request);
2026-07-20 16:05:17 +00:00
},
beginAddPhone(combined, change_phone_reason) {
const HTTP = HTTPUtils.HTTP;
const request = { url: Endpoints.PHONE, body: { phone: combined, change_phone_reason }, rejectWithError: HTTPUtils.rejectWithMigratedError() };
return HTTP.post(request);
2026-07-20 16:05:17 +00:00
},
addPhone(phoneToken, password, reason) {
const HTTP = HTTPUtils.HTTP;
const request = { url: Endpoints.PHONE, body: { phone_token: phoneToken, password, change_phone_reason: reason }, oldFormErrors: true, rejectWithError: HTTPUtils.rejectWithMigratedError() };
return HTTP.post(request);
2026-07-20 16:05:17 +00:00
},
addPhoneWithoutPassword(code) {
const HTTP = HTTPUtils.HTTP;
const request = { url: Endpoints.PHONE_VERIFY_NO_PASSWORD, body: { code }, rejectWithError: HTTPUtils.rejectWithMigratedError() };
return HTTP.post(request);
2026-07-20 16:05:17 +00:00
},
beginReverifyPhone(combined, change_phone_reason) {
const HTTP = HTTPUtils.HTTP;
const request = { url: Endpoints.PHONE_REVERIFY, body: { phone: combined, change_phone_reason }, rejectWithError: HTTPUtils.rejectWithMigratedError() };
return HTTP.post(request);
2026-07-20 16:05:17 +00:00
},
reverifyPhone(phone_token, password, USER_ACTION_REQUIRED) {
const HTTP = HTTPUtils.HTTP;
const request = { url: Endpoints.PHONE_REVERIFY, body: { phone_token, password, change_phone_reason: USER_ACTION_REQUIRED }, oldFormErrors: true, rejectWithError: HTTPUtils.rejectWithMigratedError() };
return HTTP.post(request);
2026-07-20 16:05:17 +00:00
},
validatePhoneForSupport(token) {
const HTTP = HTTPUtils.HTTP;
const request = { url: Endpoints.VERIFY_PHONE_FOR_TICKET, body: { token }, oldFormErrors: true, rejectWithError: HTTPUtils.rejectWithMigratedError() };
return HTTP.post(request);
2026-07-20 16:05:17 +00:00
},
verifyPhone(arg0, arg1) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
closure_1 = arg1;
2026-07-29 08:29:29 +00:00
let flag = arg2;
2026-07-20 16:05:17 +00:00
if (arg2 === undefined) {
flag = true;
}
2026-07-29 08:29:29 +00:00
let flag2 = arg3;
if (arg3 === undefined) {
2026-07-20 16:05:17 +00:00
flag2 = false;
}
2026-07-29 08:29:29 +00:00
return flag2(function*() {
const code = tmp2;
const phone = tmp5;
fingerprint = fingerprint.getFingerprint();
2026-08-04 21:03:28 +00:00
let tmp15 = null != fingerprint;
if (tmp15) {
tmp15 = "" !== fingerprint;
2026-07-29 08:29:29 +00:00
}
const obj4 = {};
2026-08-04 21:03:28 +00:00
if (tmp15) {
obj4["X-Fingerprint"] = fingerprint;
2026-08-04 21:03:28 +00:00
}
if (flag2) {
obj4.authorization = "";
2026-08-04 21:03:28 +00:00
}
const request = { url: constants.VERIFY_PHONE, headers: obj4, body: { phone, code }, oldFormErrors: true, trackedActionData: { event: phone(1250).NetworkActionNames.USER_VERIFY_PHONE }, rejectWithError: null };
{ event: phone(1250).NetworkActionNames.USER_VERIFY_PHONE };
request.rejectWithError = phone(1272).rejectWithMigratedError();
closure_128_0 = yield code(4829).post(request);
if (closure_129_2) {
code(573).dispatch({ type: "MODAL_POP", key });
code(573);
2026-08-04 21:03:28 +00:00
}
return closure_128_0.body;
2026-07-29 08:29:29 +00:00
})();
2026-07-20 16:05:17 +00:00
}
};
export const ChangePhoneReason = { 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" };